pxd 0.0.52 → 0.0.53
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 +6 -3
- package/dist/components/active-graph/index.d.vue.ts +0 -2
- package/dist/components/active-graph/index.vue +35 -37
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +17 -16
- package/dist/components/avatar-group/index.d.vue.ts +1 -1
- package/dist/components/avatar-group/index.vue +4 -1
- package/dist/components/badge/cn.d.ts +90 -0
- package/dist/components/badge/cn.js +44 -0
- package/dist/components/badge/index.d.vue.ts +5 -33
- package/dist/components/badge/index.vue +10 -56
- package/dist/components/book/index.vue +90 -17
- package/dist/components/browser/index.vue +21 -6
- package/dist/components/button/cn.d.ts +121 -0
- package/dist/components/button/cn.js +55 -0
- package/dist/components/button/index.d.vue.ts +8 -14
- package/dist/components/button/index.vue +22 -74
- package/dist/components/carousel-group/index.d.vue.ts +1 -1
- package/dist/components/carousel-group/index.vue +32 -28
- package/dist/components/checkbox/cn.d.ts +67 -0
- package/dist/components/checkbox/cn.js +31 -0
- package/dist/components/checkbox/index.vue +9 -19
- package/dist/components/chip/cn.d.ts +49 -0
- package/dist/components/chip/cn.js +26 -0
- package/dist/components/chip/index.vue +13 -21
- package/dist/components/choicebox/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue +6 -3
- package/dist/components/collapse/index.vue +7 -1
- package/dist/components/collapse-group/index.vue +7 -7
- package/dist/components/command-menu/index.vue +9 -8
- package/dist/components/command-menu-group/index.vue +4 -1
- package/dist/components/config-provider/index.d.vue.ts +1 -0
- package/dist/components/config-provider/index.vue +2 -1
- package/dist/components/countdown/index.vue +2 -10
- package/dist/components/dash-line/index.vue +22 -16
- package/dist/components/description/index.vue +4 -2
- package/dist/components/drawer/index.vue +19 -11
- package/dist/components/empty-state/index.vue +3 -1
- package/dist/components/error/cn.d.ts +22 -0
- package/dist/components/error/cn.js +15 -0
- package/dist/components/error/index.vue +13 -14
- package/dist/components/fader/index.vue +30 -14
- package/dist/components/gauge/index.vue +6 -6
- package/dist/components/grid/index.vue +16 -12
- package/dist/components/grid-item/index.vue +4 -4
- package/dist/components/hold-button/index.vue +19 -13
- package/dist/components/input/cn.d.ts +73 -0
- package/dist/components/input/cn.js +36 -0
- package/dist/components/input/index.d.vue.ts +14 -16
- package/dist/components/input/index.vue +74 -101
- package/dist/components/intersection-observer/index.vue +7 -3
- package/dist/components/kbd/index.vue +2 -2
- package/dist/components/link-button/index.d.vue.ts +8 -8
- package/dist/components/link-button/index.vue +17 -25
- package/dist/components/list/index.d.vue.ts +0 -1
- package/dist/components/list/index.vue +58 -57
- package/dist/components/list-item/cn.d.ts +22 -0
- package/dist/components/list-item/cn.js +15 -0
- package/dist/components/list-item/index.d.vue.ts +3 -3
- package/dist/components/list-item/index.vue +14 -25
- package/dist/components/loading-bar/cn.d.ts +70 -0
- package/dist/components/loading-bar/cn.js +32 -0
- package/dist/components/loading-bar/index.d.vue.ts +2 -0
- package/dist/components/loading-bar/index.vue +68 -61
- package/dist/components/loading-dots/index.vue +12 -4
- package/dist/components/menu/index.d.vue.ts +2 -2
- package/dist/components/menu/index.vue +4 -4
- package/dist/components/message/index.vue +82 -48
- package/dist/components/message-item/index.vue +7 -2
- package/dist/components/modal/index.vue +20 -12
- package/dist/components/more-button/index.d.vue.ts +1 -3
- package/dist/components/more-button/index.vue +7 -17
- package/dist/components/note/cn.d.ts +121 -0
- package/dist/components/note/cn.js +66 -0
- package/dist/components/note/index.d.vue.ts +3 -39
- package/dist/components/note/index.vue +18 -37
- package/dist/components/number-input/index.d.vue.ts +19 -10
- package/dist/components/number-input/index.vue +121 -75
- package/dist/components/overlay/index.vue +4 -20
- package/dist/components/pagination/index.vue +25 -8
- package/dist/components/pin-input/cn.d.ts +46 -0
- package/dist/components/pin-input/cn.js +25 -0
- package/dist/components/pin-input/index.vue +11 -20
- package/dist/components/placeholder/index.vue +11 -4
- package/dist/components/popover/index.d.vue.ts +4 -3
- package/dist/components/popover/index.vue +107 -54
- package/dist/components/progress/cn.d.ts +19 -0
- package/dist/components/progress/cn.js +14 -0
- package/dist/components/progress/index.d.vue.ts +1 -1
- package/dist/components/progress/index.vue +21 -14
- package/dist/components/radio/cn.d.ts +46 -0
- package/dist/components/radio/cn.js +42 -0
- package/dist/components/radio/index.vue +11 -18
- package/dist/components/resizable/index.vue +8 -2
- package/dist/components/resizable-handle/index.vue +1 -0
- package/dist/components/resizable-panel/index.vue +12 -11
- package/dist/components/skeleton/cn.d.ts +43 -0
- package/dist/components/skeleton/cn.js +24 -0
- package/dist/components/skeleton/index.d.vue.ts +4 -3
- package/dist/components/skeleton/index.vue +11 -20
- package/dist/components/slider/index.d.vue.ts +1 -1
- package/dist/components/slider/index.vue +14 -12
- package/dist/components/snippet/cn.d.ts +52 -0
- package/dist/components/snippet/cn.js +27 -0
- package/dist/components/snippet/index.vue +21 -29
- package/dist/components/spinner/index.vue +3 -1
- package/dist/components/stack/cn.d.ts +70 -0
- package/dist/components/stack/cn.js +33 -0
- package/dist/components/stack/index.d.vue.ts +2 -2
- package/dist/components/stack/index.vue +16 -31
- package/dist/components/status-dot/index.vue +5 -1
- package/dist/components/switch/cn.d.ts +16 -0
- package/dist/components/switch/cn.js +13 -0
- package/dist/components/switch/index.vue +5 -11
- package/dist/components/switch-group/index.vue +7 -4
- package/dist/components/text/cn.d.ts +67 -0
- package/dist/components/text/cn.js +34 -0
- package/dist/components/text/index.d.vue.ts +1 -1
- package/dist/components/text/index.vue +16 -25
- package/dist/components/textarea/cn.d.ts +58 -0
- package/dist/components/textarea/cn.js +30 -0
- package/dist/components/textarea/index.d.vue.ts +2 -0
- package/dist/components/textarea/index.vue +17 -24
- package/dist/components/theme-switcher/index.vue +6 -3
- package/dist/components/time-picker/index.d.vue.ts +2 -2
- package/dist/components/time-picker/index.vue +45 -25
- package/dist/components/toggle/index.vue +10 -6
- package/dist/components/tooltip/index.vue +3 -3
- package/dist/components/virtual-list/index.vue +1 -7
- package/dist/composables/use-browser-observer.d.ts +1 -1
- package/dist/composables/use-browser-observer.js +19 -15
- package/dist/composables/use-config-provider-context.d.ts +1 -0
- package/dist/composables/use-config-provider-context.js +5 -10
- package/dist/composables/use-countdown.js +1 -3
- package/dist/composables/use-deferred-value.js +1 -5
- package/dist/composables/use-delay-change.js +1 -4
- package/dist/composables/use-delay-destroy.js +1 -5
- package/dist/composables/use-loading-bar.d.ts +6 -14
- package/dist/composables/use-loading-bar.js +3 -14
- package/dist/composables/use-message.d.ts +9 -3
- package/dist/composables/use-message.js +9 -9
- package/dist/composables/use-model-value.d.ts +1 -0
- package/dist/composables/use-model-value.js +4 -2
- package/dist/composables/use-outside-click.js +12 -8
- package/dist/composables/use-pointer-gesture.js +5 -1
- package/dist/composables/use-toggle-value.js +1 -4
- package/dist/composables/use-virtual-list.js +14 -7
- package/dist/contexts/avatar.js +4 -4
- package/dist/contexts/carousel.js +1 -4
- package/dist/contexts/checkbox.js +1 -4
- package/dist/contexts/choicebox.js +2 -8
- package/dist/contexts/collapse.js +1 -4
- package/dist/contexts/list.js +5 -8
- package/dist/contexts/radio.js +4 -4
- package/dist/contexts/resizable.js +1 -4
- package/dist/contexts/switch.js +2 -8
- package/dist/index.d.ts +1 -0
- package/dist/styles/source.css +106 -59
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +106 -59
- package/dist/types/components/avatar.d.ts +2 -2
- package/dist/types/components/button.d.ts +11 -4
- package/dist/types/components/index.d.ts +12 -0
- package/dist/types/components/input.d.ts +4 -5
- package/dist/types/components/list.d.ts +1 -1
- package/dist/types/components/switch.d.ts +1 -1
- package/dist/types/shared/props.d.ts +6 -4
- package/dist/types/shared/utils.d.ts +3 -1
- package/dist/utils/context.d.ts +2 -8
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.js +1 -5
- package/dist/utils/event.js +6 -18
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/is.d.ts +0 -1
- package/dist/utils/is.js +3 -2
- package/dist/utils/responsive.js +7 -4
- package/dist/utils/throttle.js +4 -2
- package/package.json +45 -43
- package/dist/components/_internal/fragment-container.vue.d.ts +0 -13
- package/dist/components/active-graph/index.vue.d.ts +0 -51
- package/dist/components/avatar/index.vue.d.ts +0 -34
- package/dist/components/avatar-group/index.vue.d.ts +0 -8
- package/dist/components/backtop/index.vue.d.ts +0 -21
- package/dist/components/badge/index.vue.d.ts +0 -52
- package/dist/components/book/index.vue.d.ts +0 -28
- package/dist/components/browser/index.vue.d.ts +0 -16
- package/dist/components/button/index.vue.d.ts +0 -29
- package/dist/components/carousel/index.vue.d.ts +0 -13
- package/dist/components/carousel-group/index.vue.d.ts +0 -35
- package/dist/components/checkbox/index.vue.d.ts +0 -26
- package/dist/components/checkbox-group/index.vue.d.ts +0 -28
- package/dist/components/chip/index.vue.d.ts +0 -24
- package/dist/components/choicebox/index.vue.d.ts +0 -16
- package/dist/components/choicebox-group/index.vue.d.ts +0 -24
- package/dist/components/collapse/index.vue.d.ts +0 -22
- package/dist/components/collapse-group/index.vue.d.ts +0 -20
- package/dist/components/command-menu/index.vue.d.ts +0 -42
- package/dist/components/command-menu-group/index.vue.d.ts +0 -17
- package/dist/components/command-menu-item/index.vue.d.ts +0 -13
- package/dist/components/config-provider/index.vue.d.ts +0 -22
- package/dist/components/countdown/index.vue.d.ts +0 -51
- package/dist/components/dash-line/index.vue.d.ts +0 -13
- package/dist/components/description/index.vue.d.ts +0 -20
- package/dist/components/drawer/index.vue.d.ts +0 -60
- package/dist/components/empty-state/index.vue.d.ts +0 -23
- package/dist/components/error/index.vue.d.ts +0 -22
- package/dist/components/fader/index.vue.d.ts +0 -12
- package/dist/components/gauge/index.vue.d.ts +0 -14
- package/dist/components/grid/index.vue.d.ts +0 -19
- package/dist/components/grid-item/index.vue.d.ts +0 -18
- package/dist/components/hold-button/index.vue.d.ts +0 -42
- package/dist/components/input/index.vue.d.ts +0 -55
- package/dist/components/intersection-observer/index.vue.d.ts +0 -39
- package/dist/components/kbd/index.vue.d.ts +0 -24
- package/dist/components/label/index.vue.d.ts +0 -13
- package/dist/components/link-button/index.vue.d.ts +0 -33
- package/dist/components/list/index.vue.d.ts +0 -44
- package/dist/components/list-item/index.vue.d.ts +0 -29
- package/dist/components/loading-bar/index.vue.d.ts +0 -15
- package/dist/components/loading-dots/index.vue.d.ts +0 -15
- package/dist/components/material/index.vue.d.ts +0 -18
- package/dist/components/menu/index.vue.d.ts +0 -33
- package/dist/components/message/index.vue.d.ts +0 -176
- package/dist/components/message-item/index.vue.d.ts +0 -15
- package/dist/components/modal/index.vue.d.ts +0 -58
- package/dist/components/more-button/index.vue.d.ts +0 -20
- package/dist/components/noise-background/index.vue.d.ts +0 -19
- package/dist/components/note/index.vue.d.ts +0 -64
- package/dist/components/number-input/index.vue.d.ts +0 -39
- package/dist/components/overlay/index.vue.d.ts +0 -35
- package/dist/components/pagination/index.vue.d.ts +0 -21
- package/dist/components/pin-input/index.vue.d.ts +0 -28
- package/dist/components/placeholder/index.vue.d.ts +0 -18
- package/dist/components/popover/index.vue.d.ts +0 -73
- package/dist/components/progress/index.vue.d.ts +0 -34
- package/dist/components/radio/index.vue.d.ts +0 -20
- package/dist/components/radio-group/index.vue.d.ts +0 -22
- package/dist/components/resizable/index.vue.d.ts +0 -19
- package/dist/components/resizable-handle/index.vue.d.ts +0 -3
- package/dist/components/resizable-panel/index.vue.d.ts +0 -20
- package/dist/components/scrollable/index.vue.d.ts +0 -0
- package/dist/components/skeleton/index.vue.d.ts +0 -26
- package/dist/components/slider/index.vue.d.ts +0 -26
- package/dist/components/snippet/index.vue.d.ts +0 -18
- package/dist/components/spinner/index.vue.d.ts +0 -3
- package/dist/components/stack/index.vue.d.ts +0 -30
- package/dist/components/status-dot/index.vue.d.ts +0 -11
- package/dist/components/switch/index.vue.d.ts +0 -20
- package/dist/components/switch-group/index.vue.d.ts +0 -23
- package/dist/components/teleport/index.vue.d.ts +0 -21
- package/dist/components/text/index.vue.d.ts +0 -26
- package/dist/components/textarea/index.vue.d.ts +0 -28
- package/dist/components/theme-switcher/index.vue.d.ts +0 -8
- package/dist/components/time-picker/index.vue.d.ts +0 -35
- package/dist/components/toggle/index.vue.d.ts +0 -41
- package/dist/components/tooltip/index.vue.d.ts +0 -32
- package/dist/components/virtual-list/index.vue.d.ts +0 -24
|
@@ -32,10 +32,10 @@ const SIZES = {
|
|
|
32
32
|
lg: "w-11 h-6"
|
|
33
33
|
};
|
|
34
34
|
const uniqueId = getUniqueId();
|
|
35
|
-
const
|
|
35
|
+
const configProvider = useConfigProvider();
|
|
36
36
|
const modelValue = useModelValue(props, emits);
|
|
37
37
|
const isChecked = computed(() => modelValue.value === props.activeValue);
|
|
38
|
-
const computedSize = computed(() => getFallbackValue(props.size, SIZES,
|
|
38
|
+
const computedSize = computed(() => getFallbackValue(props.size, SIZES, configProvider.size));
|
|
39
39
|
async function onCheckboxChange(e) {
|
|
40
40
|
if (props.loading) {
|
|
41
41
|
return;
|
|
@@ -69,12 +69,13 @@ async function onCheckboxChange(e) {
|
|
|
69
69
|
:checked="isChecked"
|
|
70
70
|
class="pxd-toggle--input peer smallest"
|
|
71
71
|
@change.prevent="onCheckboxChange"
|
|
72
|
-
|
|
72
|
+
/>
|
|
73
73
|
|
|
74
74
|
<span
|
|
75
75
|
v-if="inactiveLabel"
|
|
76
76
|
class="pxd-toggle--label text-sm mr-1.5 pl-0.5 opacity-100 peer-checked:opacity-50 motion-safe:transition-opacity"
|
|
77
|
-
|
|
77
|
+
>{{ inactiveLabel }}</span
|
|
78
|
+
>
|
|
78
79
|
|
|
79
80
|
<div
|
|
80
81
|
class="pxd-toggle--handle rounded-full border border-input bg-(--toggle-inactive-color) p-px peer-focus-ring [--tx:0] peer-checked:bg-(--toggle-active-color) peer-checked:[--tx:100%] peer-disabled:cursor-not-allowed motion-safe:transition-all"
|
|
@@ -84,7 +85,9 @@ async function onCheckboxChange(e) {
|
|
|
84
85
|
'--toggle-inactive-color': inactiveColor
|
|
85
86
|
}"
|
|
86
87
|
>
|
|
87
|
-
<div
|
|
88
|
+
<div
|
|
89
|
+
class="pxd-toggle--handle-icon text-xs shadow-sm relative flex aspect-square h-full translate-x-(--tx) transform-gpu items-center justify-center overflow-hidden rounded-full bg-background-100 text-foreground-secondary motion-safe:transition-transform"
|
|
90
|
+
>
|
|
88
91
|
<div class="inset-0 absolute flex items-center justify-center">
|
|
89
92
|
<Transition name="pxd-transition--fade" mode="out-in">
|
|
90
93
|
<LoaderCircleIcon v-if="loading" class="motion-safe:animate-spin" />
|
|
@@ -98,7 +101,8 @@ async function onCheckboxChange(e) {
|
|
|
98
101
|
<span
|
|
99
102
|
v-if="activeLabel"
|
|
100
103
|
class="pxd-toggle--label text-sm ml-1.5 pr-0.5 opacity-50 peer-checked:opacity-100 motion-safe:transition-opacity"
|
|
101
|
-
|
|
104
|
+
>{{ activeLabel }}</span
|
|
105
|
+
>
|
|
102
106
|
</label>
|
|
103
107
|
</template>
|
|
104
108
|
|
|
@@ -40,9 +40,9 @@ const computedVariant = computed(() => getFallbackValue(props.variant, VARIANTS,
|
|
|
40
40
|
const computedDisabled = computed(() => {
|
|
41
41
|
return props.disabled || props.desktopOnly && isTouchDevice();
|
|
42
42
|
});
|
|
43
|
-
const
|
|
43
|
+
const computedClasses = computed(() => {
|
|
44
44
|
return [
|
|
45
|
-
"px-2 py-2 rounded-md text-
|
|
45
|
+
"px-2 py-2 rounded-md text-sm break-words whitespace-pre-line shadow-border-tooltip bg-(--popover-arrow-bg)",
|
|
46
46
|
computedVariant.value.text,
|
|
47
47
|
props.contentClass
|
|
48
48
|
].join(" ");
|
|
@@ -56,7 +56,7 @@ const mergedClasses = computed(() => {
|
|
|
56
56
|
:disabled="computedDisabled"
|
|
57
57
|
:show-arrow="showArrow"
|
|
58
58
|
:arrow-color="computedVariant.bg"
|
|
59
|
-
:content-class="
|
|
59
|
+
:content-class="computedClasses"
|
|
60
60
|
:content-style="contentStyle"
|
|
61
61
|
v-bind="$attrs"
|
|
62
62
|
>
|
|
@@ -5,13 +5,7 @@ const props = defineProps({
|
|
|
5
5
|
listData: { type: Array, required: false, default: () => [] },
|
|
6
6
|
itemSize: { type: Number, required: false, default: 50 }
|
|
7
7
|
});
|
|
8
|
-
const {
|
|
9
|
-
containerRef,
|
|
10
|
-
renderList,
|
|
11
|
-
listHeight,
|
|
12
|
-
listStyle,
|
|
13
|
-
setItemRef
|
|
14
|
-
} = useVirtualList(props);
|
|
8
|
+
const { containerRef, renderList, listHeight, listStyle, setItemRef } = useVirtualList(props);
|
|
15
9
|
</script>
|
|
16
10
|
|
|
17
11
|
<template>
|
|
@@ -4,7 +4,7 @@ export declare const useIntersectionObserver: (target: TargetRef, callback: Inte
|
|
|
4
4
|
export declare const useMutationObserver: (target: TargetRef, callback: MutationCallback, options?: MaybeRefOrGetter<MutationObserverInit>) => ObserverResults<MutationObserver>;
|
|
5
5
|
export declare const useResizeObserver: (target: TargetRef, callback: ResizeObserverCallback, options?: MaybeRefOrGetter<ResizeObserverOptions>) => ObserverResults<ResizeObserver>;
|
|
6
6
|
type Observers = IntersectionObserver | ResizeObserver | MutationObserver;
|
|
7
|
-
type TargetRef = MaybeRefOrGetter<Nullable<HTMLElement>> | MaybeRefOrGetter<Nullable<HTMLElement>>[]
|
|
7
|
+
type TargetRef = MaybeRefOrGetter<Nullable<HTMLElement>> | MaybeRefOrGetter<Nullable<HTMLElement>>[] | MaybeRefOrGetter<Nullable<HTMLElement>[]>;
|
|
8
8
|
interface ObserverResults<T extends Observers> {
|
|
9
9
|
observer: T | undefined;
|
|
10
10
|
stop: () => void;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
+
import { isNotNil } from "es-toolkit";
|
|
1
2
|
import { computed, onBeforeUnmount, watch } from "vue";
|
|
2
3
|
import { toArray } from "../utils/format.js";
|
|
3
|
-
import { isNotNullish } from "../utils/is.js";
|
|
4
4
|
import { toValue, unrefElement } from "../utils/ref.js";
|
|
5
|
-
export const useIntersectionObserver = createObserver(
|
|
6
|
-
|
|
7
|
-
);
|
|
8
|
-
export const useMutationObserver = createObserver(
|
|
9
|
-
globalThis.MutationObserver
|
|
10
|
-
);
|
|
11
|
-
export const useResizeObserver = createObserver(
|
|
12
|
-
globalThis.ResizeObserver
|
|
13
|
-
);
|
|
5
|
+
export const useIntersectionObserver = createObserver(globalThis.IntersectionObserver);
|
|
6
|
+
export const useMutationObserver = createObserver(globalThis.MutationObserver);
|
|
7
|
+
export const useResizeObserver = createObserver(globalThis.ResizeObserver);
|
|
14
8
|
function createObserver(ObserverConstructor) {
|
|
15
9
|
function observerWrapper(target, callback, options) {
|
|
16
10
|
let observer;
|
|
17
|
-
const targets = computed(
|
|
11
|
+
const targets = computed(
|
|
12
|
+
() => toArray(toValue(target)).map(unrefElement).filter(isNotNil)
|
|
13
|
+
);
|
|
18
14
|
const unwatch = watch(
|
|
19
15
|
() => [targets.value],
|
|
20
16
|
([newTargets]) => {
|
|
@@ -32,11 +28,19 @@ function createObserver(ObserverConstructor) {
|
|
|
32
28
|
);
|
|
33
29
|
newTargets.forEach((el) => observer.observe(el));
|
|
34
30
|
} else if (ObserverConstructor.name === "MutationObserver") {
|
|
35
|
-
observer = new ObserverConstructor(
|
|
36
|
-
|
|
31
|
+
observer = new ObserverConstructor(
|
|
32
|
+
callback
|
|
33
|
+
);
|
|
34
|
+
newTargets.forEach(
|
|
35
|
+
(el) => observer.observe(el, options)
|
|
36
|
+
);
|
|
37
37
|
} else {
|
|
38
|
-
observer = new ObserverConstructor(
|
|
39
|
-
|
|
38
|
+
observer = new ObserverConstructor(
|
|
39
|
+
callback
|
|
40
|
+
);
|
|
41
|
+
newTargets.forEach(
|
|
42
|
+
(el) => observer.observe(el, options)
|
|
43
|
+
);
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
{
|
|
@@ -3,5 +3,6 @@ export declare const injectionKey = "ConfigProvider";
|
|
|
3
3
|
export interface ConfigProviderProps {
|
|
4
4
|
size?: ComponentSize;
|
|
5
5
|
locale?: Record<string, any>;
|
|
6
|
+
popoverShowTransition?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const provideConfigProvider: (contextValue: Required<ConfigProviderProps>) => Required<ConfigProviderProps>, useConfigProvider: ((fallback?: Required<ConfigProviderProps> | undefined) => Required<ConfigProviderProps>) & ((fallback: null) => Required<ConfigProviderProps> | null);
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import enUS from "../locales/en-us.js";
|
|
2
2
|
import { createContext } from "../utils/context.js";
|
|
3
3
|
export const injectionKey = "ConfigProvider";
|
|
4
|
-
export const [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
size: "md",
|
|
11
|
-
locale: enUS
|
|
12
|
-
}
|
|
13
|
-
);
|
|
4
|
+
export const [provideConfigProvider, useConfigProvider] = createContext(injectionKey, {
|
|
5
|
+
size: "md",
|
|
6
|
+
locale: enUS,
|
|
7
|
+
popoverShowTransition: true
|
|
8
|
+
});
|
|
@@ -17,9 +17,7 @@ export function useCountdown(props, emits) {
|
|
|
17
17
|
}
|
|
18
18
|
return Math.max(0, formatTime(durations ?? 0));
|
|
19
19
|
});
|
|
20
|
-
const isInfiniteCountup = computed(
|
|
21
|
-
() => props.invert && totalDuration.value === Infinity
|
|
22
|
-
);
|
|
20
|
+
const isInfiniteCountup = computed(() => props.invert && totalDuration.value === Infinity);
|
|
23
21
|
function formatTime(time = 0) {
|
|
24
22
|
return props.millisecond ? Math.round(time) : Math.round(time * 1e3);
|
|
25
23
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { onBeforeUnmount, ref, watch } from "vue";
|
|
2
2
|
import { toValue } from "../utils/ref.js";
|
|
3
3
|
export function useDeferredValue(defaultValue, options = {}) {
|
|
4
|
-
const {
|
|
5
|
-
deep,
|
|
6
|
-
delay = 300,
|
|
7
|
-
valueChange
|
|
8
|
-
} = options;
|
|
4
|
+
const { deep, delay = 300, valueChange } = options;
|
|
9
5
|
const syncValue = ref(toValue(defaultValue));
|
|
10
6
|
const deferredValue = ref(syncValue.value);
|
|
11
7
|
let syncTimeoutId;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { shallowRef } from "vue";
|
|
2
2
|
export function useDelayChange(value, options = {}) {
|
|
3
|
-
const {
|
|
4
|
-
delay = 300,
|
|
5
|
-
valueChange
|
|
6
|
-
} = options;
|
|
3
|
+
const { delay = 300, valueChange } = options;
|
|
7
4
|
let timerId;
|
|
8
5
|
const delayValue = shallowRef(value);
|
|
9
6
|
function setValue(newValue, immediate = false) {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { shallowRef } from "vue";
|
|
2
2
|
import { toValue } from "../utils/ref.js";
|
|
3
3
|
export function useDelayDestroy(value, options = {}) {
|
|
4
|
-
const {
|
|
5
|
-
delay = 300,
|
|
6
|
-
renderChange,
|
|
7
|
-
visibleChange
|
|
8
|
-
} = options;
|
|
4
|
+
const { delay = 300, renderChange, visibleChange } = options;
|
|
9
5
|
const render = shallowRef(toValue(value));
|
|
10
6
|
const visible = shallowRef(value);
|
|
11
7
|
let destroyTimeoutId;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export
|
|
3
|
-
export declare const FINISH_LOADING_BAR_EVENT_NAME = "#finish-loading-bar";
|
|
4
|
-
export declare const INCREASE_LOADING_BAR_EVENT_NAME = "#increase-loading-bar";
|
|
5
|
-
declare const LOADING_BAR_EVENTS: {
|
|
6
|
-
readonly start: "#start-loading-bar";
|
|
7
|
-
readonly error: "#error-loading-bar";
|
|
8
|
-
readonly finish: "#finish-loading-bar";
|
|
9
|
-
readonly increase: "#increase-loading-bar";
|
|
10
|
-
};
|
|
11
|
-
interface Options extends Record<string, any> {
|
|
12
|
-
type?: keyof typeof LOADING_BAR_EVENTS;
|
|
13
|
-
}
|
|
1
|
+
export declare const UPDATE_LOADING_BAR_EVENT_NAME = "#update-loading-bar";
|
|
2
|
+
export type LoadingBarActionType = 'start' | 'error' | 'finish' | 'increase';
|
|
14
3
|
export interface LoadingBarEventParams {
|
|
4
|
+
type: LoadingBarActionType;
|
|
15
5
|
group: string;
|
|
16
6
|
value?: number;
|
|
17
7
|
}
|
|
18
|
-
|
|
8
|
+
interface Options extends LoadingBarEventParams {
|
|
9
|
+
}
|
|
10
|
+
export declare function useLoadingBar(options: Options): void;
|
|
19
11
|
export declare namespace useLoadingBar {
|
|
20
12
|
var start: (group?: string) => void;
|
|
21
13
|
var error: (group?: string) => void;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export const INCREASE_LOADING_BAR_EVENT_NAME = "#increase-loading-bar";
|
|
5
|
-
const LOADING_BAR_EVENTS = {
|
|
6
|
-
start: START_LOADING_BAR_EVENT_NAME,
|
|
7
|
-
error: ERROR_LOADING_BAR_EVENT_NAME,
|
|
8
|
-
finish: FINISH_LOADING_BAR_EVENT_NAME,
|
|
9
|
-
increase: INCREASE_LOADING_BAR_EVENT_NAME
|
|
10
|
-
};
|
|
11
|
-
export function useLoadingBar(options = {}) {
|
|
12
|
-
const { type = "start", ...data } = options;
|
|
13
|
-
const event = LOADING_BAR_EVENTS[type];
|
|
14
|
-
window.dispatchEvent(new CustomEvent(event, { detail: data }));
|
|
1
|
+
export const UPDATE_LOADING_BAR_EVENT_NAME = "#update-loading-bar";
|
|
2
|
+
export function useLoadingBar(options) {
|
|
3
|
+
window.dispatchEvent(new CustomEvent(UPDATE_LOADING_BAR_EVENT_NAME, { detail: options }));
|
|
15
4
|
}
|
|
16
5
|
useLoadingBar.start = function(group = "default") {
|
|
17
6
|
useLoadingBar({ type: "start", group });
|
|
@@ -39,9 +39,15 @@ interface UseMessage {
|
|
|
39
39
|
error: (msg: MessageContent, options?: Options) => void;
|
|
40
40
|
loading: (msg: MessageContent, options?: Options) => void;
|
|
41
41
|
}
|
|
42
|
-
export declare const
|
|
43
|
-
export
|
|
44
|
-
export
|
|
42
|
+
export declare const UPDATE_MESSAGE_EVENT_NAME = "#update-message";
|
|
43
|
+
export type MessageActionType = 'create' | 'remove' | 'clear';
|
|
44
|
+
export interface MessageUpdateParams {
|
|
45
|
+
type: MessageActionType;
|
|
46
|
+
group: string;
|
|
47
|
+
data?: MessageItemType | {
|
|
48
|
+
id: Options['id'];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
45
51
|
export declare const useMessage: UseMessage;
|
|
46
52
|
export declare function closeMessage(group: Options['group'], id: Options['id']): void;
|
|
47
53
|
export declare function clearMessage(group: Options['group']): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { isServer } from "../utils/is.js";
|
|
2
|
-
export const
|
|
3
|
-
export const CREATE_MESSAGE_EVENT_NAME = "#create-message";
|
|
4
|
-
export const REMOVE_MESSAGE_EVENT_NAME = "#remove-message";
|
|
2
|
+
export const UPDATE_MESSAGE_EVENT_NAME = "#update-message";
|
|
5
3
|
export const useMessage = ((msg, options) => {
|
|
6
4
|
if (isServer()) {
|
|
7
5
|
return;
|
|
@@ -16,13 +14,15 @@ export const useMessage = ((msg, options) => {
|
|
|
16
14
|
closeable: options.closeable ?? false
|
|
17
15
|
};
|
|
18
16
|
window.dispatchEvent(
|
|
19
|
-
new CustomEvent(
|
|
17
|
+
new CustomEvent(UPDATE_MESSAGE_EVENT_NAME, {
|
|
18
|
+
detail: { type: "create", group: message.group, data: message }
|
|
19
|
+
})
|
|
20
20
|
);
|
|
21
21
|
});
|
|
22
22
|
const shortcutTypes = ["info", "error", "loading", "warning", "success"];
|
|
23
23
|
shortcutTypes.forEach((type) => {
|
|
24
24
|
useMessage[type] = (msg, options) => {
|
|
25
|
-
useMessage(msg, { ...options
|
|
25
|
+
useMessage(msg, { ...options, type });
|
|
26
26
|
};
|
|
27
27
|
});
|
|
28
28
|
export function closeMessage(group, id) {
|
|
@@ -30,15 +30,15 @@ export function closeMessage(group, id) {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
window.dispatchEvent(
|
|
33
|
-
new CustomEvent(
|
|
34
|
-
detail: { group: group ?? "default", id }
|
|
33
|
+
new CustomEvent(UPDATE_MESSAGE_EVENT_NAME, {
|
|
34
|
+
detail: { type: "remove", group: group ?? "default", data: { id } }
|
|
35
35
|
})
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
export function clearMessage(group) {
|
|
39
39
|
window.dispatchEvent(
|
|
40
|
-
new CustomEvent(
|
|
41
|
-
detail: { group: group ?? "default" }
|
|
40
|
+
new CustomEvent(UPDATE_MESSAGE_EVENT_NAME, {
|
|
41
|
+
detail: { type: "clear", group: group ?? "default" }
|
|
42
42
|
})
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
-
export function useModelValue(props, emits, options = {}) {
|
|
2
|
+
export function useModelValue(props, emits, options = { withChange: true }) {
|
|
3
3
|
const modelValue = computed({
|
|
4
4
|
get: options.get || (() => props.modelValue),
|
|
5
5
|
set: options.set || ((value) => {
|
|
6
|
-
|
|
6
|
+
if (options.withChange) {
|
|
7
|
+
emits("change", value);
|
|
8
|
+
}
|
|
7
9
|
emits("update:modelValue", value);
|
|
8
10
|
})
|
|
9
11
|
});
|
|
@@ -18,14 +18,18 @@ export function useOutsideClick(container, options = {}) {
|
|
|
18
18
|
}
|
|
19
19
|
onTrigger?.(ev);
|
|
20
20
|
}
|
|
21
|
-
const unwatch = watch(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const unwatch = watch(
|
|
22
|
+
() => toValue(container),
|
|
23
|
+
(dom, _, onCleanup) => {
|
|
24
|
+
if (dom) {
|
|
25
|
+
cachedOn(document, "click", onClick);
|
|
26
|
+
}
|
|
27
|
+
onCleanup(() => {
|
|
28
|
+
cachedOff(document, "click", onClick);
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
{ immediate: true }
|
|
32
|
+
);
|
|
29
33
|
function stop() {
|
|
30
34
|
unwatch();
|
|
31
35
|
cachedOff(document, "click", onClick);
|
|
@@ -220,7 +220,11 @@ export function usePointerGesture(container, options = {}) {
|
|
|
220
220
|
const el = boundEl;
|
|
221
221
|
el.addEventListener("pointermove", onPointerMove, { passive: false, capture: true });
|
|
222
222
|
el.addEventListener("pointerup", onPointerUp, { passive: true, once: true, capture: true });
|
|
223
|
-
el.addEventListener("pointercancel", onPointerCancel, {
|
|
223
|
+
el.addEventListener("pointercancel", onPointerCancel, {
|
|
224
|
+
passive: true,
|
|
225
|
+
once: true,
|
|
226
|
+
capture: true
|
|
227
|
+
});
|
|
224
228
|
boundScrollEl = getScrollEl();
|
|
225
229
|
}
|
|
226
230
|
function onPointerMove(e) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { shallowRef } from "vue";
|
|
2
2
|
export function useToggleValue(initialValue = false, options = {}) {
|
|
3
|
-
const {
|
|
4
|
-
truthyValue = true,
|
|
5
|
-
falsyValue = false
|
|
6
|
-
} = options;
|
|
3
|
+
const { truthyValue = true, falsyValue = false } = options;
|
|
7
4
|
const value = shallowRef(initialValue);
|
|
8
5
|
function toggle(newValue) {
|
|
9
6
|
value.value = newValue ?? (value.value === truthyValue ? falsyValue : truthyValue);
|
|
@@ -133,13 +133,20 @@ export function useVirtualList(props) {
|
|
|
133
133
|
}
|
|
134
134
|
containerHeight.value = containerRef.value.clientHeight;
|
|
135
135
|
}
|
|
136
|
-
const unwatchList = watch(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
const unwatchList = watch(
|
|
137
|
+
() => props.listData,
|
|
138
|
+
() => {
|
|
139
|
+
clearItemRefs();
|
|
140
|
+
initPositions();
|
|
141
|
+
},
|
|
142
|
+
{ immediate: true }
|
|
143
|
+
);
|
|
144
|
+
const unwatchRenderList = watch(
|
|
145
|
+
() => renderList.value,
|
|
146
|
+
() => {
|
|
147
|
+
updatePositions();
|
|
148
|
+
}
|
|
149
|
+
);
|
|
143
150
|
function stop() {
|
|
144
151
|
containerRef.value?.removeEventListener("scroll", handleScroll);
|
|
145
152
|
unwatchRenderList();
|
package/dist/contexts/avatar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export const [provideAvatarGroupContext, useAvatarGroupContext] = createContext(
|
|
3
|
+
"AvatarGroup",
|
|
4
|
+
null
|
|
5
|
+
);
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
provideCheckboxGroupContext,
|
|
4
|
-
useCheckboxGroupContext
|
|
5
|
-
] = createContext("CheckboxGroup", null);
|
|
2
|
+
export const [provideCheckboxGroupContext, useCheckboxGroupContext] = createContext("CheckboxGroup", null);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
provideChoiceboxGroupContext,
|
|
4
|
-
useChoiceboxGroupContext
|
|
5
|
-
] = createContext("ChoiceboxGroup", {
|
|
2
|
+
export const [provideChoiceboxGroupContext, useChoiceboxGroupContext] = createContext("ChoiceboxGroup", {
|
|
6
3
|
multiple: false
|
|
7
4
|
});
|
|
8
|
-
export const [
|
|
9
|
-
provideChoiceboxGroupModelValue,
|
|
10
|
-
useChoiceboxGroupModelValue
|
|
11
|
-
] = createContext("ChoiceboxGroupModalValue");
|
|
5
|
+
export const [provideChoiceboxGroupModelValue, useChoiceboxGroupModelValue] = createContext("ChoiceboxGroupModalValue");
|
package/dist/contexts/list.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
provideListFilterValue,
|
|
8
|
-
useListFilterValue
|
|
9
|
-
] = createContext("ListFilterValue", null);
|
|
2
|
+
export const [provideListContext, useListContext] = createContext("List");
|
|
3
|
+
export const [provideListFilterValue, useListFilterValue] = createContext(
|
|
4
|
+
"ListFilterValue",
|
|
5
|
+
null
|
|
6
|
+
);
|
package/dist/contexts/radio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export const [provideRadioGroupContext, useRadioGroupContext] = createContext(
|
|
3
|
+
"RadioGroup",
|
|
4
|
+
null
|
|
5
|
+
);
|
package/dist/contexts/switch.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { createContext } from "../utils/context.js";
|
|
2
|
-
export const [
|
|
3
|
-
|
|
4
|
-
useSwitchGroupContext
|
|
5
|
-
] = createContext("SwitchGroup");
|
|
6
|
-
export const [
|
|
7
|
-
provideSwitchGroupModelValue,
|
|
8
|
-
useSwitchGroupModelValue
|
|
9
|
-
] = createContext("SwitchGroupModalValue");
|
|
2
|
+
export const [provideSwitchGroupContext, useSwitchGroupContext] = createContext("SwitchGroup");
|
|
3
|
+
export const [provideSwitchGroupModelValue, useSwitchGroupModelValue] = createContext("SwitchGroupModalValue");
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import type { App } from 'vue';
|
|
|
2
2
|
export { version } from '../package.json';
|
|
3
3
|
export * from './components/index.js';
|
|
4
4
|
export * from './composables/index.js';
|
|
5
|
+
export type * from './types/components';
|
|
5
6
|
export type * from './types/shared';
|
|
6
7
|
export default function install(app: App, prefix?: string): void;
|