@bikariya/modals 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bikariya/modals
2
2
 
3
- 无头模态框管理,基于 [Pinia](https://pinia.vuejs.org)。
3
+ 模态框状态管理,基于 [Pinia](https://pinia.vuejs.org)。
4
4
 
5
5
  ## 安装
6
6
 
@@ -32,13 +32,10 @@ pnpm i -D @bikariya/modals
32
32
 
33
33
  ```vue
34
34
  <script lang="ts" setup>
35
- defineProps<{
36
- open?: boolean;
37
- }>();
35
+ import type { ModalEmits, ModalProps } from "#modals";
38
36
 
39
- defineEmits<{
40
- close: [];
41
- }>();
37
+ defineProps<ModalProps>();
38
+ defineEmits<ModalEmits>();
42
39
  </script>
43
40
 
44
41
  <template>
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bikariya/modals",
3
3
  "configKey": "modals",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -12,8 +12,9 @@ const module$1 = defineNuxtModule({
12
12
  moduleDependencies: {
13
13
  "@bikariya/core": {}
14
14
  },
15
- setup() {
15
+ setup(options, nuxt) {
16
16
  const resolver = createResolver(import.meta.url);
17
+ nuxt.options.alias["#modals"] = resolver.resolve("runtime/types");
17
18
  addImportsSources({
18
19
  from: resolver.resolve("runtime/store"),
19
20
  imports: [
@@ -5,7 +5,7 @@ const { modals } = storeToRefs(modalStore);
5
5
  </script>
6
6
 
7
7
  <template>
8
- <template v-for="{ vnode, zIndex, open, close } in modals" :key="zIndex">
8
+ <template v-for="{ vnode, zIndex, duration, open, close } in modals" :key="zIndex">
9
9
  <transition>
10
10
  <div
11
11
  v-if="open.value"
@@ -14,6 +14,6 @@ const { modals } = storeToRefs(modalStore);
14
14
  @click="close.value()"
15
15
  ></div>
16
16
  </transition>
17
- <component :is="vnode.value" :open="open.value" :style="{ zIndex }"/>
17
+ <component :is="vnode.value" :duration :open="open.value" :style="{ zIndex }"/>
18
18
  </template>
19
19
  </template>
@@ -7,7 +7,7 @@ interface ModalContext {
7
7
  close: ComputedRef<() => void>;
8
8
  }
9
9
  type ModalStatus = "closed" | "open" | "closing";
10
- interface UseModalOptions {
10
+ export interface UseModalOptions {
11
11
  duration?: number;
12
12
  immediate?: boolean;
13
13
  unique?: boolean;
@@ -0,0 +1,16 @@
1
+ export type { UseModalOptions } from "./store.js";
2
+ export interface ModalProps {
3
+ /**
4
+ * 过渡动画时长 (ms)
5
+ * @default 400
6
+ */
7
+ duration?: number;
8
+ /**
9
+ * 模态框开关状态
10
+ * @internal
11
+ */
12
+ open?: boolean;
13
+ }
14
+ export interface ModalEmits {
15
+ close: [];
16
+ }
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bikariya/modals",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "description": "Bikariya modals for Nuxt",
6
6
  "author": "KazariEX",
7
7
  "license": "MIT",
@@ -15,8 +15,8 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@bikariya/core": "",
19
- "@nuxt/kit": "^4.3.0"
18
+ "@nuxt/kit": "^4.3.1",
19
+ "@bikariya/core": "0.0.7"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "nuxt-module-build build",