@witchcraft/ui 0.3.19 → 0.3.21

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.
Files changed (83) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/assets/animations.css +1 -1
  3. package/dist/runtime/components/Aria/Aria.d.vue.ts +2 -1
  4. package/dist/runtime/components/Aria/Aria.vue.d.ts +2 -1
  5. package/dist/runtime/components/Icon/Icon.d.vue.ts +3 -2
  6. package/dist/runtime/components/Icon/Icon.vue.d.ts +3 -2
  7. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +5 -4
  8. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +5 -4
  9. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +4 -5
  10. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +4 -5
  11. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +7 -6
  12. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +7 -6
  13. package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +7 -5
  14. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +7 -5
  15. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts +10 -9
  16. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +10 -9
  17. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +156 -5
  18. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +156 -5
  19. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +154 -6
  20. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -4
  21. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +154 -6
  22. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.d.vue.ts +7 -5
  23. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +7 -5
  24. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +7 -6
  25. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +7 -6
  26. package/dist/runtime/components/LibDebug/LibDebug.d.vue.ts +3 -2
  27. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +3 -2
  28. package/dist/runtime/components/LibDevOnly/LibDevOnly.d.vue.ts +3 -2
  29. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +3 -2
  30. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +20 -19
  31. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +20 -19
  32. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +106 -15
  33. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +106 -15
  34. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +3 -2
  35. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -2
  36. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +15 -10
  37. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +15 -10
  38. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +14 -5
  39. package/dist/runtime/components/LibNotifications/LibNotification.vue +2 -2
  40. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +14 -5
  41. package/dist/runtime/components/LibNotifications/LibNotificationTestMessageComponent.d.vue.ts +2 -1
  42. package/dist/runtime/components/LibNotifications/LibNotificationTestMessageComponent.vue.d.ts +2 -1
  43. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +3 -1
  44. package/dist/runtime/components/LibNotifications/LibNotifications.vue +34 -17
  45. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +3 -1
  46. package/dist/runtime/components/LibNotifications/calculateNotificationProgress.d.ts +2 -0
  47. package/dist/runtime/components/LibNotifications/calculateNotificationProgress.js +4 -0
  48. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +51 -50
  49. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +51 -50
  50. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +3 -2
  51. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +3 -2
  52. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +9 -3
  53. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +9 -3
  54. package/dist/runtime/components/LibProgressBar/LibProgressBar.d.vue.ts +3 -2
  55. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +3 -2
  56. package/dist/runtime/components/LibRecorder/LibRecorder.d.vue.ts +3 -2
  57. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +3 -2
  58. package/dist/runtime/components/LibRoot/LibRoot.d.vue.ts +5 -4
  59. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +5 -4
  60. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +18 -13
  61. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
  62. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +18 -13
  63. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +23 -18
  64. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +23 -18
  65. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +34 -13
  66. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +34 -13
  67. package/dist/runtime/components/Template/NAME.d.vue.ts +3 -2
  68. package/dist/runtime/components/Template/NAME.vue.d.ts +3 -2
  69. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +2 -1
  70. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +2 -1
  71. package/dist/runtime/composables/useTimeConditionally.d.ts +16 -0
  72. package/dist/runtime/composables/useTimeConditionally.js +27 -0
  73. package/package.json +50 -50
  74. package/src/runtime/assets/animations.css +52 -5
  75. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +3 -1
  76. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -4
  77. package/src/runtime/components/LibFileInput/LibFileInput.vue +13 -4
  78. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +6 -1
  79. package/src/runtime/components/LibNotifications/LibNotification.vue +2 -2
  80. package/src/runtime/components/LibNotifications/LibNotifications.vue +35 -18
  81. package/src/runtime/components/LibNotifications/calculateNotificationProgress.ts +8 -0
  82. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +2 -0
  83. package/src/runtime/composables/useTimeConditionally.ts +51 -0
@@ -10,20 +10,25 @@ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
10
10
  /** @vue-ignore */
11
11
  WrapperTypes, RealProps {
12
12
  }
13
- declare const _default: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
14
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
15
- readonly "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
16
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (Props & {
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ declare const __VLS_export: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props & {
17
17
  modelValue?: T[];
18
- }) & {}> & import("vue").PublicProps;
19
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
18
+ }) & {
19
+ "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
20
24
  attrs: any;
21
25
  slots: {};
22
- emit: (evt: "update:modelValue", value: T[]) => void;
26
+ emit: (event: "update:modelValue", value: T[]) => void;
23
27
  }>) => import("vue").VNode & {
24
28
  __ctx?: Awaited<typeof __VLS_setup>;
25
29
  };
26
- export default _default;
27
- type __VLS_PrettifyLocal<T> = {
30
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
31
+ [K in keyof T]: T[K];
32
+ } : {
28
33
  [K in keyof T as K]: T[K];
29
- } & {};
34
+ }) & {};
@@ -10,20 +10,25 @@ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
10
10
  /** @vue-ignore */
11
11
  WrapperTypes, RealProps {
12
12
  }
13
- declare const _default: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
14
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
15
- readonly "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
16
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (Props & {
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ declare const __VLS_export: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
16
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props & {
17
17
  modelValue?: T[];
18
- }) & {}> & import("vue").PublicProps;
19
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
18
+ }) & {
19
+ "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
20
24
  attrs: any;
21
25
  slots: {};
22
- emit: (evt: "update:modelValue", value: T[]) => void;
26
+ emit: (event: "update:modelValue", value: T[]) => void;
23
27
  }>) => import("vue").VNode & {
24
28
  __ctx?: Awaited<typeof __VLS_setup>;
25
29
  };
26
- export default _default;
27
- type __VLS_PrettifyLocal<T> = {
30
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
31
+ [K in keyof T]: T[K];
32
+ } : {
28
33
  [K in keyof T as K]: T[K];
29
- } & {};
34
+ }) & {};
@@ -9,7 +9,9 @@ interface Props extends
9
9
  /** @vue-ignore */
10
10
  Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
11
11
  }
12
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {
13
15
  focus: () => void;
14
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
17
  pause: (notification: NotificationEntry) => any;
@@ -21,14 +23,21 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
21
23
  handler: NotificationHandler;
22
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
23
25
  top?: (props: {
24
- notification: any;
26
+ notification: NotificationEntry;
25
27
  }) => any;
26
28
  } & {
27
- title?: (props: any) => any;
29
+ title?: (props: {
30
+ title: string;
31
+ class: string;
32
+ tabindex: number;
33
+ }) => any;
28
34
  } & {
29
- message?: (props: any) => any;
35
+ message?: (props: {
36
+ class: string;
37
+ message: string;
38
+ tabindex: number;
39
+ }) => any;
30
40
  }>;
31
- export default _default;
32
41
  type __VLS_WithSlots<T, S> = T & {
33
42
  new (): {
34
43
  $slots: S;
@@ -4,7 +4,6 @@
4
4
  :class="twMerge(
5
5
  `
6
6
  notification
7
- max-w-700px
8
7
  bg-neutral-50
9
8
  dark:bg-neutral-900
10
9
  text-fg
@@ -65,7 +64,7 @@
65
64
  </div>
66
65
  </slot>
67
66
  <div class="notification--spacer flex-1"/>
68
- <div class="actions flex">
67
+ <div class="notification--actions flex">
69
68
  <LibButton
70
69
  :border="false"
71
70
  class="
@@ -203,6 +202,7 @@ onMounted(() => {
203
202
  if (props.notification.isPaused) return;
204
203
  emit("pause", props.notification);
205
204
  } else {
205
+ if (!props.notification.isPaused) return;
206
206
  emit("resume", props.notification);
207
207
  }
208
208
  }, { signal: mousedownAbortController.signal });
@@ -9,7 +9,9 @@ interface Props extends
9
9
  /** @vue-ignore */
10
10
  Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
11
11
  }
12
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
14
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {
13
15
  focus: () => void;
14
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
17
  pause: (notification: NotificationEntry) => any;
@@ -21,14 +23,21 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
21
23
  handler: NotificationHandler;
22
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
23
25
  top?: (props: {
24
- notification: any;
26
+ notification: NotificationEntry;
25
27
  }) => any;
26
28
  } & {
27
- title?: (props: any) => any;
29
+ title?: (props: {
30
+ title: string;
31
+ class: string;
32
+ tabindex: number;
33
+ }) => any;
28
34
  } & {
29
- message?: (props: any) => any;
35
+ message?: (props: {
36
+ class: string;
37
+ message: string;
38
+ tabindex: number;
39
+ }) => any;
30
40
  }>;
31
- export default _default;
32
41
  type __VLS_WithSlots<T, S> = T & {
33
42
  new (): {
34
43
  $slots: S;
@@ -2,5 +2,6 @@ import type { CustomNotificationComponentProps } from "../../types/index.js";
2
2
  type __VLS_Props = CustomNotificationComponentProps & {
3
3
  customProp: string;
4
4
  };
5
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
6
7
  export default _default;
@@ -2,5 +2,6 @@ import type { CustomNotificationComponentProps } from "../../types/index.js";
2
2
  type __VLS_Props = CustomNotificationComponentProps & {
3
3
  customProp: string;
4
4
  };
5
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
6
7
  export default _default;
@@ -4,10 +4,12 @@ import type { HTMLAttributes } from "vue";
4
4
  type RealProps = LinkableByIdProps & {
5
5
  /** If not provided, uses the global handler (this requires useNotificationHandler be called and configured). */
6
6
  handler?: NotificationHandler;
7
+ progressUpdateInterval?: number;
7
8
  };
8
9
  interface Props extends
9
10
  /** @vue-ignore */
10
11
  Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
11
12
  }
12
- declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
13
14
  export default _default;
15
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -5,17 +5,16 @@
5
5
  tag="div"
6
6
  :class="twMerge(`
7
7
  notifications
8
- [--notification-width:300px]
8
+ [--notification-width:calc(100dvw-var(--spacing)*4)]
9
+ sm:[--notification-width:300px]
9
10
  fixed
10
11
  top-0
11
12
  z-50
12
13
  right-[calc(var(--notification-width)*-1)]
13
14
  w-[calc(var(--spacing)*2+var(--notification-width)*2)]
14
- [&_.notification]:w-[var(--notification-width)]
15
15
  max-h-[100dvh]
16
16
  flex
17
17
  flex-col
18
- [&_.notification]:shrink-0
19
18
  gap-1
20
19
  list-none
21
20
  outline-none
@@ -29,7 +28,16 @@
29
28
  :handler="handler"
30
29
  tabindex="0"
31
30
  :notification="notification"
32
- class="overflow-hidden my-2 max-h-[25dvh] min-h-[300px]"
31
+ class="
32
+ overflow-hidden
33
+ my-2
34
+ max-h-[300px]
35
+ w-[var(--notification-width)]
36
+ shrink-0
37
+ max-sm:[&_.notification--button]:p-2
38
+ max-sm:[&_.notification--button]:py-1
39
+ max-sm:[&_.notification--header]:text-lg
40
+ "
33
41
  v-for="notification of notifications"
34
42
  :key="notification.id"
35
43
  @pause="handler.pause(notification)"
@@ -46,7 +54,7 @@
46
54
  -mx-[calc(var(--spacing)*2+2px)]
47
55
  rounded-none
48
56
  "
49
- :progress="100 - (notification.isPaused ? notification._timer.elapsedBeforePause : notification._timer.elapsedBeforePause + (time - notification.startTime)) / notification.timeout * 100"
57
+ :progress="calculateNotificationProgress(notification, time)"
50
58
  />
51
59
  </template>
52
60
  </lib-notification>
@@ -67,19 +75,27 @@
67
75
  <AlertDialogContent
68
76
  class="
69
77
  data-[state=open]:animate-contentShow
78
+ max-sm:data-[state=open]:animate-slideInUp
70
79
  fixed
71
80
  flex
81
+ max-h-[80dvh]
72
82
  top-[50%]
73
83
  left-[50%]
74
- translate-x-[-50%]
75
- translate-y-[-50%]
76
- max-h-[80dvh]
84
+ sm:translate-x-[-50%]
85
+ sm:translate-y-[-50%]
77
86
  max-w-[700px]
87
+ max-sm:bottom-2
88
+ max-sm:top-[unset]
89
+ max-sm:left-2
90
+ max-sm:right-2
91
+ max-sm:w-[calc(100%-var(--spacing)*4)]
78
92
  z-100
79
93
  "
80
94
  >
81
95
  <lib-notification
82
96
  class="
97
+ w-full
98
+ sm:max-w-[700px]
83
99
  max-w-full
84
100
  max-h-full
85
101
  top-notification
@@ -120,9 +136,11 @@ import {
120
136
  AlertDialogRoot,
121
137
  AlertDialogTitle
122
138
  } from "reka-ui";
123
- import { computed, ref } from "vue";
139
+ import { computed } from "vue";
140
+ import { calculateNotificationProgress } from "./calculateNotificationProgress.js";
124
141
  import LibNotification from "./LibNotification.vue";
125
142
  import { useNotificationHandler } from "../../composables/useNotificationHandler.js";
143
+ import { useTimeConditionally } from "../../composables/useTimeConditionally.js";
126
144
  import { NotificationHandler } from "../../helpers/NotificationHandler.js";
127
145
  import { twMerge } from "../../utils/twMerge.js";
128
146
  import LibProgressBar from "../LibProgressBar/LibProgressBar.vue";
@@ -132,17 +150,16 @@ defineOptions({
132
150
  });
133
151
  const props = defineProps({
134
152
  id: { type: String, required: false },
135
- handler: { type: Object, required: false }
153
+ handler: { type: Object, required: false },
154
+ progressUpdateInterval: { type: Number, required: false }
136
155
  });
156
+ const handler = props.handler ?? useNotificationHandler();
137
157
  const topNotifications = computed(() => handler.queue.filter((entry) => entry.requiresAction).reverse());
138
158
  const notifications = computed(() => handler.queue.filter((entry) => !entry.requiresAction));
139
- const time = ref(Date.now());
140
- setInterval(() => {
141
- requestAnimationFrame(() => {
142
- time.value = Date.now();
143
- });
144
- }, 50);
145
- const handler = props.handler ?? useNotificationHandler();
159
+ const fetchTime = computed(() => {
160
+ return notifications.value.filter((entry) => entry.timeout !== void 0 && !entry.isPaused).length > 0;
161
+ });
162
+ const { time } = useTimeConditionally(fetchTime, { refreshInterval: props.progressUpdateInterval });
146
163
  </script>
147
164
 
148
165
  <script>
@@ -4,10 +4,12 @@ import type { HTMLAttributes } from "vue";
4
4
  type RealProps = LinkableByIdProps & {
5
5
  /** If not provided, uses the global handler (this requires useNotificationHandler be called and configured). */
6
6
  handler?: NotificationHandler;
7
+ progressUpdateInterval?: number;
7
8
  };
8
9
  interface Props extends
9
10
  /** @vue-ignore */
10
11
  Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
11
12
  }
12
- declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
13
14
  export default _default;
15
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,2 @@
1
+ import type { NotificationEntry } from "../../helpers/NotificationHandler.js";
2
+ export declare function calculateNotificationProgress(notification: NotificationEntry, time: number): number;
@@ -0,0 +1,4 @@
1
+ export function calculateNotificationProgress(notification, time) {
2
+ if (notification.timeout === void 0) return 0;
3
+ return 100 - (notification.isPaused ? notification._timer.elapsedBeforePause : notification._timer.elapsedBeforePause + (time - notification.startTime)) / notification.timeout * 100;
4
+ }
@@ -10,7 +10,34 @@ import type { TailwindClassProp } from "../shared/props.js";
10
10
  * </template>
11
11
  * ```
12
12
  */
13
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type RealProps = {
16
+ /** The total number of pages. */
17
+ total: number;
18
+ /** The number of the current page. It must be valid, between 0 - total or the component will throw an error. */
19
+ current: number;
20
+ /** The base route/link path for the page. Should end with a forward slash `/`. */
21
+ route: string;
22
+ /**
23
+ * A function to customize the output href and page link number. By default, page 0 is page 1, page 1 is 1, then everything else is normal.
24
+ *
25
+ * This is because usually we have routes like: `/page/1`, `/page/2`, not `/page/0`.
26
+ *
27
+ * You can use this function to customize things further. For example, make `/page/1` just `/`
28
+ */
29
+ customRoute?: (route: string, i: number) => {
30
+ i: number;
31
+ href: string;
32
+ };
33
+ /** How many extra pages to show to each side of the current page. */
34
+ extraPages?: number;
35
+ };
36
+ interface Props extends
37
+ /** @vue-ignore */
38
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
39
+ }
40
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
41
  customRoute: (route: string, i: number) => {
15
42
  i: number;
16
43
  href: string;
@@ -19,84 +46,58 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {},
19
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
20
47
  link?: (props: {
21
48
  class: string;
22
- i: any;
23
- href: any;
24
- text: any;
25
- ariaLabel: any;
49
+ i: number;
50
+ href: string;
51
+ text: string;
52
+ ariaLabel: string;
26
53
  }) => any;
27
54
  } & {
28
55
  link?: (props: {
29
56
  class: string;
30
57
  i: number;
31
- href: any;
32
- text: any;
33
- ariaLabel: any;
58
+ href: string;
59
+ text: number;
60
+ ariaLabel: string;
34
61
  }) => any;
35
62
  } & {
36
63
  link?: (props: {
37
- i: any;
38
- href: any;
39
- ariaLabel: any;
64
+ i: number;
65
+ href: string;
66
+ ariaLabel: string;
40
67
  class: string;
41
68
  }) => any;
42
69
  } & {
43
70
  current?: (props: {
44
71
  tabindex: string;
45
- i: any;
46
- ariaLabel: any;
72
+ i: number;
73
+ ariaLabel: string;
47
74
  aria_current: boolean;
48
75
  class: string;
49
76
  }) => any;
50
77
  } & {
51
78
  link?: (props: {
52
- i: any;
53
- href: any;
54
- ariaLabel: any;
79
+ i: number;
80
+ href: string;
81
+ ariaLabel: string;
55
82
  class: string;
56
83
  }) => any;
57
84
  } & {
58
85
  link?: (props: {
59
- i: any;
60
- href: any;
61
- text: any;
62
- ariaLabel: any;
86
+ i: number;
87
+ href: string;
88
+ text: number;
89
+ ariaLabel: string;
63
90
  class: string;
64
91
  }) => any;
65
92
  } & {
66
93
  link?: (props: {
67
- i: any;
68
- href: any;
69
- text: any;
70
- ariaLabel: any;
94
+ i: number;
95
+ href: string;
96
+ text: string;
97
+ ariaLabel: string;
71
98
  class: string;
72
99
  }) => any;
73
100
  }>;
74
- export default _default;
75
- type RealProps = {
76
- /** The total number of pages. */
77
- total: number;
78
- /** The number of the current page. It must be valid, between 0 - total or the component will throw an error. */
79
- current: number;
80
- /** The base route/link path for the page. Should end with a forward slash `/`. */
81
- route: string;
82
- /**
83
- * A function to customize the output href and page link number. By default, page 0 is page 1, page 1 is 1, then everything else is normal.
84
- *
85
- * This is because usually we have routes like: `/page/1`, `/page/2`, not `/page/0`.
86
- *
87
- * You can use this function to customize things further. For example, make `/page/1` just `/`
88
- */
89
- customRoute?: (route: string, i: number) => {
90
- i: number;
91
- href: string;
92
- };
93
- /** How many extra pages to show to each side of the current page. */
94
- extraPages?: number;
95
- };
96
- interface Props extends
97
- /** @vue-ignore */
98
- Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
99
- }
100
101
  type __VLS_WithSlots<T, S> = T & {
101
102
  new (): {
102
103
  $slots: S;
@@ -10,7 +10,34 @@ import type { TailwindClassProp } from "../shared/props.js";
10
10
  * </template>
11
11
  * ```
12
12
  */
13
- declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type RealProps = {
16
+ /** The total number of pages. */
17
+ total: number;
18
+ /** The number of the current page. It must be valid, between 0 - total or the component will throw an error. */
19
+ current: number;
20
+ /** The base route/link path for the page. Should end with a forward slash `/`. */
21
+ route: string;
22
+ /**
23
+ * A function to customize the output href and page link number. By default, page 0 is page 1, page 1 is 1, then everything else is normal.
24
+ *
25
+ * This is because usually we have routes like: `/page/1`, `/page/2`, not `/page/0`.
26
+ *
27
+ * You can use this function to customize things further. For example, make `/page/1` just `/`
28
+ */
29
+ customRoute?: (route: string, i: number) => {
30
+ i: number;
31
+ href: string;
32
+ };
33
+ /** How many extra pages to show to each side of the current page. */
34
+ extraPages?: number;
35
+ };
36
+ interface Props extends
37
+ /** @vue-ignore */
38
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
39
+ }
40
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
41
  customRoute: (route: string, i: number) => {
15
42
  i: number;
16
43
  href: string;
@@ -19,84 +46,58 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {},
19
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
20
47
  link?: (props: {
21
48
  class: string;
22
- i: any;
23
- href: any;
24
- text: any;
25
- ariaLabel: any;
49
+ i: number;
50
+ href: string;
51
+ text: string;
52
+ ariaLabel: string;
26
53
  }) => any;
27
54
  } & {
28
55
  link?: (props: {
29
56
  class: string;
30
57
  i: number;
31
- href: any;
32
- text: any;
33
- ariaLabel: any;
58
+ href: string;
59
+ text: number;
60
+ ariaLabel: string;
34
61
  }) => any;
35
62
  } & {
36
63
  link?: (props: {
37
- i: any;
38
- href: any;
39
- ariaLabel: any;
64
+ i: number;
65
+ href: string;
66
+ ariaLabel: string;
40
67
  class: string;
41
68
  }) => any;
42
69
  } & {
43
70
  current?: (props: {
44
71
  tabindex: string;
45
- i: any;
46
- ariaLabel: any;
72
+ i: number;
73
+ ariaLabel: string;
47
74
  aria_current: boolean;
48
75
  class: string;
49
76
  }) => any;
50
77
  } & {
51
78
  link?: (props: {
52
- i: any;
53
- href: any;
54
- ariaLabel: any;
79
+ i: number;
80
+ href: string;
81
+ ariaLabel: string;
55
82
  class: string;
56
83
  }) => any;
57
84
  } & {
58
85
  link?: (props: {
59
- i: any;
60
- href: any;
61
- text: any;
62
- ariaLabel: any;
86
+ i: number;
87
+ href: string;
88
+ text: number;
89
+ ariaLabel: string;
63
90
  class: string;
64
91
  }) => any;
65
92
  } & {
66
93
  link?: (props: {
67
- i: any;
68
- href: any;
69
- text: any;
70
- ariaLabel: any;
94
+ i: number;
95
+ href: string;
96
+ text: string;
97
+ ariaLabel: string;
71
98
  class: string;
72
99
  }) => any;
73
100
  }>;
74
- export default _default;
75
- type RealProps = {
76
- /** The total number of pages. */
77
- total: number;
78
- /** The number of the current page. It must be valid, between 0 - total or the component will throw an error. */
79
- current: number;
80
- /** The base route/link path for the page. Should end with a forward slash `/`. */
81
- route: string;
82
- /**
83
- * A function to customize the output href and page link number. By default, page 0 is page 1, page 1 is 1, then everything else is normal.
84
- *
85
- * This is because usually we have routes like: `/page/1`, `/page/2`, not `/page/0`.
86
- *
87
- * You can use this function to customize things further. For example, make `/page/1` just `/`
88
- */
89
- customRoute?: (route: string, i: number) => {
90
- i: number;
91
- href: string;
92
- };
93
- /** How many extra pages to show to each side of the current page. */
94
- extraPages?: number;
95
- };
96
- interface Props extends
97
- /** @vue-ignore */
98
- Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>, RealProps {
99
- }
100
101
  type __VLS_WithSlots<T, S> = T & {
101
102
  new (): {
102
103
  $slots: S;
@@ -1,6 +1,8 @@
1
1
  import type { Theme } from "metamorphosis";
2
2
  import type { BaseInteractiveProps, LinkableByIdProps } from "../shared/props.js";
3
- declare const _default: import("vue").DefineComponent<LinkableByIdProps & BaseInteractiveProps & {
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: import("vue").DefineComponent<LinkableByIdProps & BaseInteractiveProps & {
4
6
  theme?: Theme;
5
7
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkableByIdProps & BaseInteractiveProps & {
6
8
  theme?: Theme;
@@ -11,4 +13,3 @@ declare const _default: import("vue").DefineComponent<LinkableByIdProps & BaseIn
11
13
  border: boolean;
12
14
  unstyle: boolean;
13
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
- export default _default;