pxd 0.0.44 → 0.0.46
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/dist/components/_internal/fragment-container.d.ts +2 -0
- package/dist/components/_internal/fragment-container.js +25 -0
- package/dist/components/active-graph/index.d.vue.ts +2 -2
- package/dist/components/active-graph/index.vue.d.ts +2 -2
- package/dist/components/avatar/index.vue +1 -1
- package/dist/components/backtop/index.d.vue.ts +2 -2
- package/dist/components/backtop/index.vue.d.ts +2 -2
- package/dist/components/badge/index.d.vue.ts +2 -2
- package/dist/components/badge/index.vue +2 -2
- package/dist/components/badge/index.vue.d.ts +2 -2
- package/dist/components/browser/index.d.vue.ts +2 -2
- package/dist/components/browser/index.vue +3 -1
- package/dist/components/browser/index.vue.d.ts +2 -2
- package/dist/components/button/index.d.vue.ts +4 -4
- package/dist/components/button/index.vue +1 -1
- package/dist/components/button/index.vue.d.ts +4 -4
- package/dist/components/carousel-group/index.d.vue.ts +2 -3
- package/dist/components/carousel-group/index.vue +17 -5
- package/dist/components/carousel-group/index.vue.d.ts +2 -3
- package/dist/components/checkbox-group/index.d.vue.ts +4 -4
- package/dist/components/checkbox-group/index.vue.d.ts +4 -4
- package/dist/components/choicebox/index.d.vue.ts +3 -3
- package/dist/components/choicebox/index.vue +1 -1
- package/dist/components/choicebox/index.vue.d.ts +3 -3
- package/dist/components/choicebox-group/index.d.vue.ts +2 -2
- package/dist/components/choicebox-group/index.vue +1 -1
- package/dist/components/choicebox-group/index.vue.d.ts +2 -2
- package/dist/components/command-menu/index.d.vue.ts +3 -3
- package/dist/components/command-menu/index.vue +6 -2
- package/dist/components/command-menu/index.vue.d.ts +3 -3
- package/dist/components/command-menu-item/index.d.vue.ts +2 -2
- package/dist/components/command-menu-item/index.vue.d.ts +2 -2
- package/dist/components/config-provider/index.d.vue.ts +2 -2
- package/dist/components/config-provider/index.vue +1 -1
- package/dist/components/config-provider/index.vue.d.ts +2 -2
- package/dist/components/countdown/index.d.vue.ts +2 -2
- package/dist/components/countdown/index.vue.d.ts +2 -2
- package/dist/components/dash-line/index.d.vue.ts +13 -0
- package/dist/components/dash-line/index.vue +78 -0
- package/dist/components/dash-line/index.vue.d.ts +13 -0
- package/dist/components/description/index.d.vue.ts +2 -2
- package/dist/components/description/index.vue.d.ts +2 -2
- package/dist/components/drawer/index.d.vue.ts +7 -6
- package/dist/components/drawer/index.vue +7 -2
- package/dist/components/drawer/index.vue.d.ts +7 -6
- package/dist/components/error/index.d.vue.ts +2 -2
- package/dist/components/error/index.vue +1 -1
- package/dist/components/error/index.vue.d.ts +2 -2
- package/dist/components/fader/index.vue +8 -24
- package/dist/components/hold-button/index.d.vue.ts +4 -4
- package/dist/components/hold-button/index.vue.d.ts +4 -4
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +2 -1
- package/dist/components/input/index.d.vue.ts +8 -9
- package/dist/components/input/index.vue +68 -71
- package/dist/components/input/index.vue.d.ts +8 -9
- package/dist/components/intersection-observer/index.d.vue.ts +3 -3
- package/dist/components/intersection-observer/index.vue +5 -5
- package/dist/components/intersection-observer/index.vue.d.ts +3 -3
- package/dist/components/kbd/index.vue +1 -1
- package/dist/components/link-button/index.d.vue.ts +5 -5
- package/dist/components/link-button/index.vue +1 -1
- package/dist/components/link-button/index.vue.d.ts +5 -5
- package/dist/components/list/index.d.vue.ts +2 -2
- package/dist/components/list/index.vue +5 -4
- package/dist/components/list/index.vue.d.ts +2 -2
- package/dist/components/list-item/index.vue +1 -1
- package/dist/components/material/index.d.vue.ts +2 -2
- package/dist/components/material/index.vue.d.ts +2 -2
- package/dist/components/menu/index.d.vue.ts +2 -2
- package/dist/components/menu/index.vue +1 -7
- package/dist/components/menu/index.vue.d.ts +2 -2
- package/dist/components/message/index.vue +6 -2
- package/dist/components/modal/index.d.vue.ts +7 -6
- package/dist/components/modal/index.vue +7 -2
- package/dist/components/modal/index.vue.d.ts +7 -6
- package/dist/components/noise-background/index.d.vue.ts +19 -0
- package/dist/components/noise-background/index.vue +18 -0
- package/dist/components/noise-background/index.vue.d.ts +19 -0
- package/dist/components/note/index.d.vue.ts +3 -3
- package/dist/components/note/index.vue +3 -3
- package/dist/components/note/index.vue.d.ts +3 -3
- package/dist/components/number-input/index.d.vue.ts +4 -4
- package/dist/components/number-input/index.vue +5 -9
- package/dist/components/number-input/index.vue.d.ts +4 -4
- package/dist/components/overlay/index.d.vue.ts +2 -2
- package/dist/components/overlay/index.vue +33 -26
- package/dist/components/overlay/index.vue.d.ts +2 -2
- package/dist/components/overlay/overlay-stack.d.ts +3 -0
- package/dist/components/overlay/overlay-stack.js +17 -0
- package/dist/components/pagination/index.d.vue.ts +2 -2
- package/dist/components/pagination/index.vue +2 -2
- package/dist/components/pagination/index.vue.d.ts +2 -2
- package/dist/components/pin-input/index.d.vue.ts +3 -14
- package/dist/components/pin-input/index.vue +28 -40
- package/dist/components/pin-input/index.vue.d.ts +3 -14
- package/dist/components/placeholder/index.d.vue.ts +12 -4
- package/dist/components/placeholder/index.vue +14 -20
- package/dist/components/placeholder/index.vue.d.ts +12 -4
- package/dist/components/popover/index.d.vue.ts +8 -18
- package/dist/components/popover/index.vue +71 -284
- package/dist/components/popover/index.vue.d.ts +8 -18
- package/dist/components/progress/index.d.vue.ts +1 -1
- package/dist/components/progress/index.vue.d.ts +1 -1
- package/dist/components/radio-group/index.d.vue.ts +4 -4
- package/dist/components/radio-group/index.vue.d.ts +4 -4
- package/dist/components/scrollable/index.vue +2 -2
- package/dist/components/slider/index.d.vue.ts +1 -1
- package/dist/components/slider/index.vue.d.ts +1 -1
- package/dist/components/snippet/index.vue +3 -2
- package/dist/components/stack/index.d.vue.ts +2 -2
- package/dist/components/stack/index.vue +1 -1
- package/dist/components/stack/index.vue.d.ts +2 -2
- package/dist/components/status-dot/index.d.vue.ts +3 -2
- package/dist/components/status-dot/index.vue +1 -1
- package/dist/components/status-dot/index.vue.d.ts +3 -2
- package/dist/components/teleport/index.d.vue.ts +3 -3
- package/dist/components/teleport/index.vue.d.ts +3 -3
- package/dist/components/text/index.d.vue.ts +2 -2
- package/dist/components/text/index.vue +1 -1
- package/dist/components/text/index.vue.d.ts +2 -2
- package/dist/components/textarea/index.d.vue.ts +6 -17
- package/dist/components/textarea/index.vue +25 -33
- package/dist/components/textarea/index.vue.d.ts +6 -17
- package/dist/components/time-picker/index.d.vue.ts +9 -2
- package/dist/components/time-picker/index.vue +76 -93
- package/dist/components/time-picker/index.vue.d.ts +9 -2
- package/dist/components/toggle/index.d.vue.ts +6 -9
- package/dist/components/toggle/index.vue +32 -41
- package/dist/components/toggle/index.vue.d.ts +6 -9
- package/dist/components/tooltip/index.d.vue.ts +3 -3
- package/dist/components/tooltip/index.vue +1 -1
- package/dist/components/tooltip/index.vue.d.ts +3 -3
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-focus-trap.d.ts +9 -1
- package/dist/composables/use-focus-trap.js +33 -51
- package/dist/composables/use-lock-scroll.d.ts +5 -0
- package/dist/composables/use-lock-scroll.js +40 -0
- package/dist/composables/use-outside-click.js +8 -2
- package/dist/composables/use-repeat-action.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/source.css +8 -5
- package/dist/styles/styles.css +2 -2
- package/dist/styles/tw.css +8 -5
- package/dist/types/components/error.d.ts +1 -1
- package/dist/types/components/input.d.ts +1 -1
- package/dist/utils/debounce.d.ts +1 -1
- package/dist/utils/debounce.js +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/dist/utils/dom.js +12 -0
- package/dist/utils/event.js +12 -20
- package/dist/utils/get.d.ts +0 -8
- package/dist/utils/get.js +1 -126
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/throttle.d.ts +7 -1
- package/dist/utils/throttle.js +16 -1
- package/package.json +25 -18
- package/volar.d.ts +2 -1
- package/dist/components/keep-alive-container/index.d.vue.ts +0 -13
- package/dist/components/keep-alive-container/index.vue +0 -11
- package/dist/components/keep-alive-container/index.vue.d.ts +0 -13
- package/dist/utils/debounce/compat.d.ts +0 -143
- package/dist/utils/debounce/compat.js +0 -47
- package/dist/utils/debounce/index.d.ts +0 -73
- package/dist/utils/debounce/index.js +0 -60
- package/dist/utils/throttle/compat.d.ts +0 -79
- package/dist/utils/throttle/compat.js +0 -9
- package/dist/utils/throttle/index.d.ts +0 -53
- package/dist/utils/throttle/index.js +0 -34
package/dist/utils/event.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isOverflowScrollable } from "./dom.js";
|
|
2
2
|
export function on(el, event, handler, options) {
|
|
3
3
|
if (!el) {
|
|
4
4
|
return () => {
|
|
@@ -31,7 +31,7 @@ export function once(el, event, handler, options) {
|
|
|
31
31
|
event,
|
|
32
32
|
handler,
|
|
33
33
|
{
|
|
34
|
-
...options
|
|
34
|
+
...options,
|
|
35
35
|
once: true
|
|
36
36
|
}
|
|
37
37
|
);
|
|
@@ -40,16 +40,20 @@ export function optimizedOn(el, event, handler, options) {
|
|
|
40
40
|
if (!el) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const cacheKey = `__cached_${event}`;
|
|
44
|
+
const cachedEventHandlers = el[cacheKey];
|
|
45
|
+
if (cachedEventHandlers) {
|
|
46
|
+
if (cachedEventHandlers.includes(handler)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
45
49
|
cachedEventHandlers.push(handler);
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
52
|
const scheduler = (ev) => {
|
|
49
|
-
|
|
53
|
+
const list = el[cacheKey];
|
|
54
|
+
list?.slice(1).forEach((handler2) => handler2(ev));
|
|
50
55
|
};
|
|
51
|
-
|
|
52
|
-
el[`__cached_${event}`] = cachedEventHandlers;
|
|
56
|
+
el[cacheKey] = [scheduler, handler];
|
|
53
57
|
el.addEventListener(event, scheduler, options);
|
|
54
58
|
}
|
|
55
59
|
export function optimizedOff(el, event, handler, options) {
|
|
@@ -73,21 +77,9 @@ export function optimizedOff(el, event, handler, options) {
|
|
|
73
77
|
export function sleep(ms) {
|
|
74
78
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
75
79
|
}
|
|
76
|
-
function checkOverflowScroll(ele) {
|
|
77
|
-
const { x: xScrollbar, y: yScrollbar } = hasScrollbar(ele);
|
|
78
|
-
const { x: xScrollable, y: yScrollable } = isScrollable(ele);
|
|
79
|
-
if (xScrollbar && xScrollable || yScrollbar && yScrollable) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
const parent = ele.parentNode;
|
|
83
|
-
if (!(parent instanceof Element) || parent.tagName === "BODY") {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
return checkOverflowScroll(parent);
|
|
87
|
-
}
|
|
88
80
|
export function preventDefaultScroll(ev) {
|
|
89
81
|
const _target = ev.target;
|
|
90
|
-
if (_target instanceof Element &&
|
|
82
|
+
if (_target instanceof Element && isOverflowScrollable(_target)) {
|
|
91
83
|
return false;
|
|
92
84
|
}
|
|
93
85
|
if (ev.touches?.length > 1) {
|
package/dist/utils/get.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
import type { Nullable } from '../types/shared/utils';
|
|
2
|
-
type PathArray = ReadonlyArray<PropertyKey>;
|
|
3
|
-
type PathValue<T, P extends PathArray> = P extends [] ? T : P extends [infer K, ...infer R] ? K extends PropertyKey ? R extends PathArray ? PathValue<GetAtStep<NonNullable<T>, K>, R> : unknown : unknown : unknown;
|
|
4
|
-
type GetAtStep<T, K> = K extends keyof T ? T[K] : K extends number ? T extends readonly (infer U)[] ? U : T extends {
|
|
5
|
-
[key: number]: infer V;
|
|
6
|
-
} ? V : unknown : K extends string ? K extends keyof T ? T[K] : unknown : K extends symbol ? K extends keyof T ? T[K] : unknown : unknown;
|
|
7
|
-
export declare function get<T, P extends PathArray, D = undefined>(obj: T, path: P, defaultValue?: D): PathValue<T, P> | D;
|
|
8
|
-
export declare function get<T, D = undefined>(obj: T, path: string | PropertyKey, defaultValue?: D): unknown | D;
|
|
9
2
|
export declare function getFallbackValue<Variants extends Record<string, any>>(variant: Nullable<string>, variants: Variants, defaultVariant?: keyof Variants): any;
|
|
10
3
|
export declare function getColorByThreshold(value: number, colors: Record<string, string>): string;
|
|
11
|
-
export {};
|
package/dist/utils/get.js
CHANGED
|
@@ -1,128 +1,3 @@
|
|
|
1
|
-
const isIntegerKey = (s) => /^\d+$/.test(s);
|
|
2
|
-
function toPath(input) {
|
|
3
|
-
if (Array.isArray(input)) {
|
|
4
|
-
return input.slice();
|
|
5
|
-
}
|
|
6
|
-
if (typeof input === "symbol") {
|
|
7
|
-
return [input];
|
|
8
|
-
}
|
|
9
|
-
if (typeof input === "number") {
|
|
10
|
-
return [input];
|
|
11
|
-
}
|
|
12
|
-
if (typeof input !== "string") {
|
|
13
|
-
return [String(input)];
|
|
14
|
-
}
|
|
15
|
-
if (input.length === 0) {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
const str = input;
|
|
19
|
-
const result = [];
|
|
20
|
-
let token = "";
|
|
21
|
-
let i = 0;
|
|
22
|
-
const pushToken = () => {
|
|
23
|
-
if (token.length > 0) {
|
|
24
|
-
result.push(isIntegerKey(token) ? Number(token) : token);
|
|
25
|
-
token = "";
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
while (i < str.length) {
|
|
29
|
-
const ch = str[i];
|
|
30
|
-
if (ch === ".") {
|
|
31
|
-
pushToken();
|
|
32
|
-
i++;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (ch === "[") {
|
|
36
|
-
pushToken();
|
|
37
|
-
i++;
|
|
38
|
-
while (i < str.length && (str[i] === " " || str[i] === " " || str[i] === "\n" || str[i] === "\r")) {
|
|
39
|
-
i++;
|
|
40
|
-
}
|
|
41
|
-
if (i >= str.length) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
const start = str[i];
|
|
45
|
-
if (start === "'" || start === '"') {
|
|
46
|
-
const quote = start;
|
|
47
|
-
i++;
|
|
48
|
-
let content2 = "";
|
|
49
|
-
while (i < str.length) {
|
|
50
|
-
const cc = str[i];
|
|
51
|
-
if (cc === "\\") {
|
|
52
|
-
i++;
|
|
53
|
-
if (i < str.length) {
|
|
54
|
-
content2 += str[i];
|
|
55
|
-
i++;
|
|
56
|
-
} else {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (cc === quote) {
|
|
62
|
-
i++;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
content2 += cc;
|
|
66
|
-
i++;
|
|
67
|
-
}
|
|
68
|
-
result.push(content2);
|
|
69
|
-
while (i < str.length && (str[i] === " " || str[i] === " " || str[i] === "\n" || str[i] === "\r")) {
|
|
70
|
-
i++;
|
|
71
|
-
}
|
|
72
|
-
if (str[i] === "]") {
|
|
73
|
-
i++;
|
|
74
|
-
}
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
let content = "";
|
|
78
|
-
while (i < str.length && str[i] !== "]") {
|
|
79
|
-
content += str[i];
|
|
80
|
-
i++;
|
|
81
|
-
}
|
|
82
|
-
if (str[i] === "]") {
|
|
83
|
-
i++;
|
|
84
|
-
}
|
|
85
|
-
const trimmed = content.trim();
|
|
86
|
-
if (trimmed.length > 0) {
|
|
87
|
-
result.push(isIntegerKey(trimmed) ? Number(trimmed) : trimmed);
|
|
88
|
-
} else {
|
|
89
|
-
}
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (ch === "\\") {
|
|
93
|
-
i++;
|
|
94
|
-
if (i < str.length) {
|
|
95
|
-
token += str[i];
|
|
96
|
-
i++;
|
|
97
|
-
} else {
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
token += ch;
|
|
103
|
-
i++;
|
|
104
|
-
}
|
|
105
|
-
pushToken();
|
|
106
|
-
return result;
|
|
107
|
-
}
|
|
108
|
-
export function get(obj, path, defaultValue) {
|
|
109
|
-
if (obj == null) {
|
|
110
|
-
return defaultValue;
|
|
111
|
-
}
|
|
112
|
-
const segments = toPath(path);
|
|
113
|
-
if (segments.length === 0) {
|
|
114
|
-
return obj === void 0 ? defaultValue : obj;
|
|
115
|
-
}
|
|
116
|
-
let cur = obj;
|
|
117
|
-
for (let i = 0; i < segments.length; i++) {
|
|
118
|
-
const key = segments[i];
|
|
119
|
-
if (cur == null) {
|
|
120
|
-
return defaultValue;
|
|
121
|
-
}
|
|
122
|
-
cur = cur[key];
|
|
123
|
-
}
|
|
124
|
-
return cur === void 0 ? defaultValue : cur;
|
|
125
|
-
}
|
|
126
1
|
export function getFallbackValue(variant, variants, defaultVariant = "default") {
|
|
127
2
|
return (variant ? variants[variant] : null) ?? variants[defaultVariant];
|
|
128
3
|
}
|
|
@@ -137,5 +12,5 @@ export function getColorByThreshold(value, colors) {
|
|
|
137
12
|
return colors[keys[i - 1]];
|
|
138
13
|
}
|
|
139
14
|
}
|
|
140
|
-
return colors[keys
|
|
15
|
+
return colors[keys[keyLength - 1]];
|
|
141
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './context';
|
|
2
|
+
export * from './date';
|
|
3
|
+
export * from './debounce';
|
|
4
|
+
export * from './dom';
|
|
5
|
+
export * from './event';
|
|
6
|
+
export * from './format';
|
|
7
|
+
export * from './get';
|
|
8
|
+
export * from './is';
|
|
9
|
+
export * from './regexp';
|
|
10
|
+
export * from './throttle';
|
|
11
|
+
export * from './uid';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./context.js";
|
|
2
|
+
export * from "./date.js";
|
|
3
|
+
export * from "./debounce.js";
|
|
4
|
+
export * from "./dom.js";
|
|
5
|
+
export * from "./event.js";
|
|
6
|
+
export * from "./format.js";
|
|
7
|
+
export * from "./get.js";
|
|
8
|
+
export * from "./is.js";
|
|
9
|
+
export * from "./regexp.js";
|
|
10
|
+
export * from "./throttle.js";
|
|
11
|
+
export * from "./uid.js";
|
package/dist/utils/throttle.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Callback } from '../types/shared';
|
|
2
|
+
export { throttle } from 'es-toolkit/function';
|
|
3
|
+
interface ThrottleByRafReturnType<T extends Callback> {
|
|
4
|
+
(...args: Parameters<T>): void;
|
|
5
|
+
cancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function throttleByRaf<T extends Callback>(callback: T): ThrottleByRafReturnType<T>;
|
package/dist/utils/throttle.js
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { throttle } from "es-toolkit/function";
|
|
2
|
+
export function throttleByRaf(callback) {
|
|
3
|
+
let timer;
|
|
4
|
+
const throttle2 = (...args) => {
|
|
5
|
+
timer && window.cancelAnimationFrame(timer);
|
|
6
|
+
timer = window.requestAnimationFrame(() => {
|
|
7
|
+
callback(...args);
|
|
8
|
+
timer = 0;
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
throttle2.cancel = () => {
|
|
12
|
+
window.cancelAnimationFrame(timer);
|
|
13
|
+
timer = 0;
|
|
14
|
+
};
|
|
15
|
+
return throttle2;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pxd",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.46",
|
|
5
5
|
"description": "A universal UI component library for Vue2&3.",
|
|
6
6
|
"author": "libondev <bon.li@outlook.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,11 +45,15 @@
|
|
|
45
45
|
"types": "./dist/locales/index.d.ts",
|
|
46
46
|
"default": "./dist/locales/index.js"
|
|
47
47
|
},
|
|
48
|
+
"./utils": {
|
|
49
|
+
"types": "./dist/utils/index.d.ts",
|
|
50
|
+
"default": "./dist/utils/index.js"
|
|
51
|
+
},
|
|
48
52
|
"./volar": "./volar.d.ts",
|
|
49
53
|
"./tw.css": "./dist/styles/tw.css",
|
|
50
54
|
"./styles.css": "./dist/styles/styles.css",
|
|
51
55
|
"./components/*": {
|
|
52
|
-
"types": "./dist/components/*/index.vue.
|
|
56
|
+
"types": "./dist/components/*/index.d.vue.ts",
|
|
53
57
|
"default": "./dist/components/*/index.vue"
|
|
54
58
|
},
|
|
55
59
|
"./composables/*": {
|
|
@@ -92,33 +96,36 @@
|
|
|
92
96
|
"vue": ">=2.7.0 || >=3.2.0"
|
|
93
97
|
},
|
|
94
98
|
"dependencies": {
|
|
95
|
-
"@
|
|
96
|
-
"
|
|
99
|
+
"@floating-ui/dom": "^1.7.4",
|
|
100
|
+
"@gdsicon/vue": "^1.0.7",
|
|
101
|
+
"dayjs": "^1.11.19",
|
|
102
|
+
"es-toolkit": "^1.43.0",
|
|
103
|
+
"focus-trap": "^7.7.0"
|
|
97
104
|
},
|
|
98
105
|
"devDependencies": {
|
|
99
106
|
"@antfu/eslint-config": "^4.19.0",
|
|
100
|
-
"@tailwindcss/cli": "^4.1.
|
|
101
|
-
"@tsconfig/node22": "^22.0.
|
|
102
|
-
"@types/node": "^
|
|
103
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
107
|
+
"@tailwindcss/cli": "^4.1.18",
|
|
108
|
+
"@tsconfig/node22": "^22.0.5",
|
|
109
|
+
"@types/node": "^25.0.3",
|
|
110
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
104
111
|
"@vue/test-utils": "^2.4.6",
|
|
105
|
-
"@vue/tsconfig": "^0.
|
|
106
|
-
"eslint": "^9.
|
|
107
|
-
"eslint-plugin-better-tailwindcss": "^3.
|
|
108
|
-
"fs-extra": "^11.3.
|
|
109
|
-
"happy-dom": "^
|
|
112
|
+
"@vue/tsconfig": "^0.8.1",
|
|
113
|
+
"eslint": "^9.39.2",
|
|
114
|
+
"eslint-plugin-better-tailwindcss": "^3.8.0",
|
|
115
|
+
"fs-extra": "^11.3.3",
|
|
116
|
+
"happy-dom": "^20.0.11",
|
|
110
117
|
"husky": "^9.1.7",
|
|
111
|
-
"lint-staged": "^16.2.
|
|
118
|
+
"lint-staged": "^16.2.7",
|
|
112
119
|
"mkdist": "^2.4.1",
|
|
113
120
|
"npm-run-all2": "^8.0.4",
|
|
114
121
|
"tinyglobby": "^0.2.15",
|
|
115
122
|
"typescript": "^5.9.3",
|
|
116
123
|
"unbuild": "^3.6.1",
|
|
117
|
-
"unplugin-vue-components": "^
|
|
118
|
-
"vitest": "^
|
|
119
|
-
"vue": "^3.5.
|
|
124
|
+
"unplugin-vue-components": "^30.0.0",
|
|
125
|
+
"vitest": "^4.0.16",
|
|
126
|
+
"vue": "^3.5.26",
|
|
120
127
|
"vue-sfc-transformer": "^0.1.17",
|
|
121
|
-
"vue-tsc": "^3.
|
|
128
|
+
"vue-tsc": "^3.2.1"
|
|
122
129
|
},
|
|
123
130
|
"lint-staged": {
|
|
124
131
|
"*.{ts,vue}": "eslint --fix"
|
package/volar.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ declare module 'vue' {
|
|
|
26
26
|
PCommandMenuItem: typeof import('pxd/components/command-menu-item')['default']
|
|
27
27
|
PConfigProvider: typeof import('pxd/components/config-provider')['default']
|
|
28
28
|
PCountdown: typeof import('pxd/components/countdown')['default']
|
|
29
|
+
PDashLine: typeof import('pxd/components/dash-line')['default']
|
|
29
30
|
PDescription: typeof import('pxd/components/description')['default']
|
|
30
31
|
PDrawer: typeof import('pxd/components/drawer')['default']
|
|
31
32
|
PEmptyState: typeof import('pxd/components/empty-state')['default']
|
|
@@ -38,7 +39,6 @@ declare module 'vue' {
|
|
|
38
39
|
PInput: typeof import('pxd/components/input')['default']
|
|
39
40
|
PIntersectionObserver: typeof import('pxd/components/intersection-observer')['default']
|
|
40
41
|
PKbd: typeof import('pxd/components/kbd')['default']
|
|
41
|
-
PKeepAliveContainer: typeof import('pxd/components/keep-alive-container')['default']
|
|
42
42
|
PLinkButton: typeof import('pxd/components/link-button')['default']
|
|
43
43
|
PList: typeof import('pxd/components/list')['default']
|
|
44
44
|
PListItem: typeof import('pxd/components/list-item')['default']
|
|
@@ -49,6 +49,7 @@ declare module 'vue' {
|
|
|
49
49
|
PMessage: typeof import('pxd/components/message')['default']
|
|
50
50
|
PModal: typeof import('pxd/components/modal')['default']
|
|
51
51
|
PMoreButton: typeof import('pxd/components/more-button')['default']
|
|
52
|
+
PNoiseBackground: typeof import('pxd/components/noise-background')['default']
|
|
52
53
|
PNote: typeof import('pxd/components/note')['default']
|
|
53
54
|
PNumberInput: typeof import('pxd/components/number-input')['default']
|
|
54
55
|
POverlay: typeof import('pxd/components/overlay')['default']
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare var __VLS_1: {};
|
|
2
|
-
type __VLS_Slots = {} & {
|
|
3
|
-
default?: (props: typeof __VLS_1) => any;
|
|
4
|
-
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
-
declare const _default: typeof __VLS_export;
|
|
8
|
-
export default _default;
|
|
9
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
-
new (): {
|
|
11
|
-
$slots: S;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Since keep-alive can only cache components,
|
|
3
|
-
the content must be wrapped in order to cache internal nodes normally.
|
|
4
|
-
Because there can only be one root node in Vue2, slot cannot be directly used as the root node.
|
|
5
|
-
So we need to wrap the slot with a div. (Vue3 is not affected by this limitation.)
|
|
6
|
-
-->
|
|
7
|
-
<template>
|
|
8
|
-
<div class="pxd-keep-alive-container">
|
|
9
|
-
<slot />
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare var __VLS_1: {};
|
|
2
|
-
type __VLS_Slots = {} & {
|
|
3
|
-
default?: (props: typeof __VLS_1) => any;
|
|
4
|
-
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
-
declare const _default: typeof __VLS_export;
|
|
8
|
-
export default _default;
|
|
9
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
-
new (): {
|
|
11
|
-
$slots: S;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
interface DebounceSettings {
|
|
2
|
-
/**
|
|
3
|
-
* If `true`, the function will be invoked on the leading edge of the timeout.
|
|
4
|
-
* @default false
|
|
5
|
-
*/
|
|
6
|
-
leading?: boolean | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
9
|
-
* @default Infinity
|
|
10
|
-
*/
|
|
11
|
-
maxWait?: number | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* If `true`, the function will be invoked on the trailing edge of the timeout.
|
|
14
|
-
* @default true
|
|
15
|
-
*/
|
|
16
|
-
trailing?: boolean | undefined;
|
|
17
|
-
}
|
|
18
|
-
interface DebounceSettingsLeading extends DebounceSettings {
|
|
19
|
-
leading: true;
|
|
20
|
-
}
|
|
21
|
-
export interface DebouncedFunc<T extends (...args: any[]) => any> {
|
|
22
|
-
/**
|
|
23
|
-
* Call the original function, but applying the debounce rules.
|
|
24
|
-
*
|
|
25
|
-
* If the debounced function can be run immediately, this calls it and returns its return
|
|
26
|
-
* value.
|
|
27
|
-
*
|
|
28
|
-
* Otherwise, it returns the return value of the last invocation, or undefined if the debounced
|
|
29
|
-
* function was not invoked yet.
|
|
30
|
-
*/
|
|
31
|
-
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Throw away any pending invocation of the debounced function.
|
|
34
|
-
*/
|
|
35
|
-
cancel: () => void;
|
|
36
|
-
/**
|
|
37
|
-
* If there is a pending invocation of the debounced function, invoke it immediately and return
|
|
38
|
-
* its return value.
|
|
39
|
-
*
|
|
40
|
-
* Otherwise, return the value from the last invocation, or undefined if the debounced function
|
|
41
|
-
* was never invoked.
|
|
42
|
-
*/
|
|
43
|
-
flush: () => ReturnType<T> | undefined;
|
|
44
|
-
}
|
|
45
|
-
export interface DebouncedFuncLeading<T extends (...args: any[]) => any> extends DebouncedFunc<T> {
|
|
46
|
-
(...args: Parameters<T>): ReturnType<T>;
|
|
47
|
-
flush: () => ReturnType<T>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
51
|
-
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
52
|
-
* method to cancel any pending execution.
|
|
53
|
-
*
|
|
54
|
-
* You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period.
|
|
55
|
-
* If `leading` is true, the function runs immediately on the first call.
|
|
56
|
-
* If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call.
|
|
57
|
-
* If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen
|
|
58
|
-
* (since one debounced function call cannot trigger the function twice).
|
|
59
|
-
*
|
|
60
|
-
* You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called.
|
|
61
|
-
*
|
|
62
|
-
* @template F - The type of function.
|
|
63
|
-
* @param {F} func - The function to debounce.
|
|
64
|
-
* @param {number} debounceMs - The number of milliseconds to delay.
|
|
65
|
-
* @param {DebounceOptions} options - The options object
|
|
66
|
-
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
|
67
|
-
* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout.
|
|
68
|
-
* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout.
|
|
69
|
-
* @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked.
|
|
70
|
-
* @returns A new debounced function with a `cancel` method.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* const debouncedFunction = debounce(() => {
|
|
74
|
-
* console.log('Function executed');
|
|
75
|
-
* }, 1000);
|
|
76
|
-
*
|
|
77
|
-
* // Will log 'Function executed' after 1 second if not called again in that time
|
|
78
|
-
* debouncedFunction();
|
|
79
|
-
*
|
|
80
|
-
* // Will not log anything as the previous call is canceled
|
|
81
|
-
* debouncedFunction.cancel();
|
|
82
|
-
*
|
|
83
|
-
* // With AbortSignal
|
|
84
|
-
* const controller = new AbortController();
|
|
85
|
-
* const signal = controller.signal;
|
|
86
|
-
* const debouncedWithSignal = debounce(() => {
|
|
87
|
-
* console.log('Function executed');
|
|
88
|
-
* }, 1000, { signal });
|
|
89
|
-
*
|
|
90
|
-
* debouncedWithSignal();
|
|
91
|
-
*
|
|
92
|
-
* // Will cancel the debounced function call
|
|
93
|
-
* controller.abort();
|
|
94
|
-
*/
|
|
95
|
-
export declare function debounce<T extends (...args: any) => any>(func: T, debounceMs: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading<T>;
|
|
96
|
-
/**
|
|
97
|
-
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
98
|
-
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
99
|
-
* method to cancel any pending execution.
|
|
100
|
-
*
|
|
101
|
-
* You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period.
|
|
102
|
-
* If `leading` is true, the function runs immediately on the first call.
|
|
103
|
-
* If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call.
|
|
104
|
-
* If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen
|
|
105
|
-
* (since one debounced function call cannot trigger the function twice).
|
|
106
|
-
*
|
|
107
|
-
* You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called.
|
|
108
|
-
*
|
|
109
|
-
* @template F - The type of function.
|
|
110
|
-
* @param {F} func - The function to debounce.
|
|
111
|
-
* @param {number} debounceMs - The number of milliseconds to delay.
|
|
112
|
-
* @param {DebounceOptions} options - The options object
|
|
113
|
-
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
|
114
|
-
* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout.
|
|
115
|
-
* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout.
|
|
116
|
-
* @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked.
|
|
117
|
-
* @returns A new debounced function with a `cancel` method.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* const debouncedFunction = debounce(() => {
|
|
121
|
-
* console.log('Function executed');
|
|
122
|
-
* }, 1000);
|
|
123
|
-
*
|
|
124
|
-
* // Will log 'Function executed' after 1 second if not called again in that time
|
|
125
|
-
* debouncedFunction();
|
|
126
|
-
*
|
|
127
|
-
* // Will not log anything as the previous call is canceled
|
|
128
|
-
* debouncedFunction.cancel();
|
|
129
|
-
*
|
|
130
|
-
* // With AbortSignal
|
|
131
|
-
* const controller = new AbortController();
|
|
132
|
-
* const signal = controller.signal;
|
|
133
|
-
* const debouncedWithSignal = debounce(() => {
|
|
134
|
-
* console.log('Function executed');
|
|
135
|
-
* }, 1000, { signal });
|
|
136
|
-
*
|
|
137
|
-
* debouncedWithSignal();
|
|
138
|
-
*
|
|
139
|
-
* // Will cancel the debounced function call
|
|
140
|
-
* controller.abort();
|
|
141
|
-
*/
|
|
142
|
-
export declare function debounce<T extends (...args: any) => any>(func: T, debounceMs?: number, options?: DebounceSettings): DebouncedFunc<T>;
|
|
143
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { debounce as debounceImpl } from "./index.js";
|
|
2
|
-
export function debounce(func, debounceMs = 0, options = {}) {
|
|
3
|
-
if (typeof options !== "object") {
|
|
4
|
-
options = {};
|
|
5
|
-
}
|
|
6
|
-
const { leading = false, trailing = true, maxWait } = options;
|
|
7
|
-
const edges = Array.from({ length: 2 });
|
|
8
|
-
if (leading) {
|
|
9
|
-
edges[0] = "leading";
|
|
10
|
-
}
|
|
11
|
-
if (trailing) {
|
|
12
|
-
edges[1] = "trailing";
|
|
13
|
-
}
|
|
14
|
-
let result;
|
|
15
|
-
let pendingAt = null;
|
|
16
|
-
const _debounced = debounceImpl(
|
|
17
|
-
function(...args) {
|
|
18
|
-
result = func.apply(this, args);
|
|
19
|
-
pendingAt = null;
|
|
20
|
-
},
|
|
21
|
-
debounceMs,
|
|
22
|
-
{ edges }
|
|
23
|
-
);
|
|
24
|
-
const debounced = function(...args) {
|
|
25
|
-
if (maxWait != null) {
|
|
26
|
-
if (pendingAt === null) {
|
|
27
|
-
pendingAt = Date.now();
|
|
28
|
-
}
|
|
29
|
-
if (Date.now() - pendingAt >= maxWait) {
|
|
30
|
-
result = func.apply(this, args);
|
|
31
|
-
pendingAt = Date.now();
|
|
32
|
-
_debounced.cancel();
|
|
33
|
-
_debounced.schedule();
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
_debounced.apply(this, args);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
const flush = () => {
|
|
41
|
-
_debounced.flush();
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
debounced.cancel = _debounced.cancel;
|
|
45
|
-
debounced.flush = flush;
|
|
46
|
-
return debounced;
|
|
47
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
interface DebounceOptions {
|
|
2
|
-
/**
|
|
3
|
-
* An optional AbortSignal to cancel the debounced function.
|
|
4
|
-
*/
|
|
5
|
-
signal?: AbortSignal;
|
|
6
|
-
/**
|
|
7
|
-
* An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both.
|
|
8
|
-
* If `edges` includes "leading", the function will be invoked at the start of the delay period.
|
|
9
|
-
* If `edges` includes "trailing", the function will be invoked at the end of the delay period.
|
|
10
|
-
* If both "leading" and "trailing" are included, the function will be invoked at both the start and end of the delay period.
|
|
11
|
-
* @default ["trailing"]
|
|
12
|
-
*/
|
|
13
|
-
edges?: Array<'leading' | 'trailing'>;
|
|
14
|
-
}
|
|
15
|
-
export interface DebouncedFunction<F extends (...args: any[]) => void> {
|
|
16
|
-
(...args: Parameters<F>): void;
|
|
17
|
-
/**
|
|
18
|
-
* Schedules the execution of the debounced function after the specified debounce delay.
|
|
19
|
-
* This method resets any existing timer, ensuring that the function is only invoked
|
|
20
|
-
* after the delay has elapsed since the last call to the debounced function.
|
|
21
|
-
* It is typically called internally whenever the debounced function is invoked.
|
|
22
|
-
*
|
|
23
|
-
* @returns {void}
|
|
24
|
-
*/
|
|
25
|
-
schedule: () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Cancels any pending execution of the debounced function.
|
|
28
|
-
* This method clears the active timer and resets any stored context or arguments.
|
|
29
|
-
*/
|
|
30
|
-
cancel: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* Immediately invokes the debounced function if there is a pending execution.
|
|
33
|
-
* This method executes the function right away if there is a pending execution.
|
|
34
|
-
*/
|
|
35
|
-
flush: () => void;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
|
|
39
|
-
* have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
|
|
40
|
-
* method to cancel any pending execution.
|
|
41
|
-
*
|
|
42
|
-
* @template F - The type of function.
|
|
43
|
-
* @param {F} func - The function to debounce.
|
|
44
|
-
* @param {number} debounceMs - The number of milliseconds to delay.
|
|
45
|
-
* @param {DebounceOptions} options - The options object
|
|
46
|
-
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.
|
|
47
|
-
* @returns A new debounced function with a `cancel` method.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* const debouncedFunction = debounce(() => {
|
|
51
|
-
* console.log('Function executed');
|
|
52
|
-
* }, 1000);
|
|
53
|
-
*
|
|
54
|
-
* // Will log 'Function executed' after 1 second if not called again in that time
|
|
55
|
-
* debouncedFunction();
|
|
56
|
-
*
|
|
57
|
-
* // Will not log anything as the previous call is canceled
|
|
58
|
-
* debouncedFunction.cancel();
|
|
59
|
-
*
|
|
60
|
-
* // With AbortSignal
|
|
61
|
-
* const controller = new AbortController();
|
|
62
|
-
* const signal = controller.signal;
|
|
63
|
-
* const debouncedWithSignal = debounce(() => {
|
|
64
|
-
* console.log('Function executed');
|
|
65
|
-
* }, 1000, { signal });
|
|
66
|
-
*
|
|
67
|
-
* debouncedWithSignal();
|
|
68
|
-
*
|
|
69
|
-
* // Will cancel the debounced function call
|
|
70
|
-
* controller.abort();
|
|
71
|
-
*/
|
|
72
|
-
export declare function debounce<F extends (...args: any[]) => void>(func: F, debounceMs: number, { signal, edges }?: DebounceOptions): DebouncedFunction<F>;
|
|
73
|
-
export {};
|