Skip to content

Commit

Permalink
build: vite add dts plugin (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rock070 authored Aug 30, 2023
1 parent dd6c20d commit 77e953b
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 13 deletions.
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
],
"scripts": {
"clean": "rimraf dist",
"dev": "vite build -w && pnpm build:type",
"dev": "vite build -w",
"typecheck": "vue-tsc --noEmit",
"build:type": "vue-tsc -p tsconfig.build-dts.json --declaration --emitDeclarationOnly",
"build": "vite build && pnpm build:type"
"build": "vite build"
},
"dependencies": {
"@vueuse/core": "^10.3.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.3",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vite-plugin-dts": "^3.5.3"
}
}
3 changes: 0 additions & 3 deletions packages/core/src/components/Noti.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ watchImmediate(
<div class="vue3-noti">
<div v-if="open" class="vue3-noti-group">
{{ message }}
<!-- <div v-for="no in notificationList" :key="no.id" class="vue3-noti-group__item">
message
</div> -->
</div>
</div>
</template>
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/composables/useNoti.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { inject } from 'vue'

import { INJECT_KEY } from '../constant'
import type { NotiEvent } from '../types'

export function useNoti() {
const noti = inject(INJECT_KEY)
const noti = inject(INJECT_KEY) as NotiEvent
return noti
}
16 changes: 11 additions & 5 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
export const enum NOTI_TYPE {
export enum NOTI_TYPE {
SUCCESS = 'success',
WARNING = 'warning',
ERROR = 'error',
INFO = 'info',
}

export type NotificationType = 'success' | 'warning' | 'error' | 'info'

/**
* An object containing constants for the position of notifications.
*/
export const enum NOTI_POSITION {
export enum NOTI_POSITION {
/**
* Notifications appear at the top right of the screen and slide in from the right.
*/
Expand Down Expand Up @@ -45,11 +47,15 @@ export const enum NOTI_POSITION {
MIDDLE_RIGHT = 'middle-right',
}

// export type NotiPosition = ValueOf<NotiOptions>
export type NotiPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'middle-top' | 'middle-left' | 'middle-right'

export interface NotiOptions {
message: string
type: NOTI_TYPE
position: NOTI_POSITION

type: NotificationType
position: NotiPosition
duration: number
}

export type NotiEvent = (options: NotiOptions) => void
export type NotiEvent = (options: Partial<NotiOptions>) => void
2 changes: 2 additions & 0 deletions packages/core/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'node:path'
import process from 'node:process'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import dts from 'vite-plugin-dts'

const name = 'index'

Expand All @@ -13,6 +14,7 @@ export default defineConfig({
},
plugins: [
Vue(),
dts(),
],
publicDir: false,
build: {
Expand Down
Loading

0 comments on commit 77e953b

Please sign in to comment.