@v-c/util 1.0.9 → 1.0.10

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 (61) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +2 -2
  3. package/dist/utils/set.d.ts +14 -1
  4. package/dist/utils/set.js +9 -4
  5. package/package.json +49 -1
  6. package/dist/Children/isFragment.cjs +0 -6
  7. package/dist/Children/toArray.cjs +0 -14
  8. package/dist/Dom/addEventListener.cjs +0 -9
  9. package/dist/Dom/canUseDom.cjs +0 -8
  10. package/dist/Dom/class.cjs +0 -16
  11. package/dist/Dom/contains.cjs +0 -15
  12. package/dist/Dom/css.cjs +0 -82
  13. package/dist/Dom/dynamicCSS.cjs +0 -86
  14. package/dist/Dom/findDOMNode.cjs +0 -23
  15. package/dist/Dom/focus.cjs +0 -101
  16. package/dist/Dom/isVisible.cjs +0 -20
  17. package/dist/Dom/scrollLocker.cjs +0 -70
  18. package/dist/Dom/shadow.cjs +0 -12
  19. package/dist/Dom/styleChecker.cjs +0 -22
  20. package/dist/Dom/support.cjs +0 -21
  21. package/dist/EventInterface.cjs +0 -1
  22. package/dist/KeyCode.cjs +0 -250
  23. package/dist/Portal.cjs +0 -45
  24. package/dist/PortalWrapper.cjs +0 -138
  25. package/dist/RenderComponent.cjs +0 -34
  26. package/dist/classnames.cjs +0 -40
  27. package/dist/composeProps.cjs +0 -20
  28. package/dist/createRef.cjs +0 -25
  29. package/dist/debug/diff.cjs +0 -47
  30. package/dist/deprecated.cjs +0 -8
  31. package/dist/getScrollBarSize.cjs +0 -58
  32. package/dist/guid.cjs +0 -9
  33. package/dist/hooks/useControlledState.cjs +0 -19
  34. package/dist/hooks/useEvent.cjs +0 -8
  35. package/dist/hooks/useId.cjs +0 -16
  36. package/dist/hooks/useLayoutEffect.cjs +0 -36
  37. package/dist/hooks/useMemo.cjs +0 -18
  38. package/dist/hooks/useMergedState.cjs +0 -28
  39. package/dist/hooks/useMobile.cjs +0 -19
  40. package/dist/hooks/useState.cjs +0 -13
  41. package/dist/index.cjs +0 -24
  42. package/dist/isEqual.cjs +0 -31
  43. package/dist/isMobile.cjs +0 -10
  44. package/dist/isValid.cjs +0 -9
  45. package/dist/omit.cjs +0 -12
  46. package/dist/pickAttrs.cjs +0 -43
  47. package/dist/props-util/index.cjs +0 -87
  48. package/dist/raf.cjs +0 -48
  49. package/dist/setStyle.cjs +0 -19
  50. package/dist/switchScrollingEffect.cjs +0 -35
  51. package/dist/test/domHook.cjs +0 -39
  52. package/dist/type.cjs +0 -71
  53. package/dist/utils/checkSlotProp.cjs +0 -10
  54. package/dist/utils/get.cjs +0 -13
  55. package/dist/utils/omit.cjs +0 -9
  56. package/dist/utils/set.cjs +0 -53
  57. package/dist/utils/transition.cjs +0 -94
  58. package/dist/utils/watchState.cjs +0 -19
  59. package/dist/vnode.cjs +0 -71
  60. package/dist/vueuse/unref-element.cjs +0 -7
  61. package/dist/warning.cjs +0 -48
package/dist/KeyCode.cjs DELETED
@@ -1,250 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- var KeyCode = {
6
- MAC_ENTER: 3,
7
- BACKSPACE: 8,
8
- TAB: 9,
9
- NUM_CENTER: 12,
10
- ENTER: 13,
11
- SHIFT: 16,
12
- CTRL: 17,
13
- ALT: 18,
14
- PAUSE: 19,
15
- CAPS_LOCK: 20,
16
- ESC: 27,
17
- SPACE: 32,
18
- PAGE_UP: 33,
19
- PAGE_DOWN: 34,
20
- END: 35,
21
- HOME: 36,
22
- LEFT: 37,
23
- UP: 38,
24
- RIGHT: 39,
25
- DOWN: 40,
26
- PRINT_SCREEN: 44,
27
- INSERT: 45,
28
- DELETE: 46,
29
- ZERO: 48,
30
- ONE: 49,
31
- TWO: 50,
32
- THREE: 51,
33
- FOUR: 52,
34
- FIVE: 53,
35
- SIX: 54,
36
- SEVEN: 55,
37
- EIGHT: 56,
38
- NINE: 57,
39
- QUESTION_MARK: 63,
40
- A: 65,
41
- B: 66,
42
- C: 67,
43
- D: 68,
44
- E: 69,
45
- F: 70,
46
- G: 71,
47
- H: 72,
48
- I: 73,
49
- J: 74,
50
- K: 75,
51
- L: 76,
52
- M: 77,
53
- N: 78,
54
- O: 79,
55
- P: 80,
56
- Q: 81,
57
- R: 82,
58
- S: 83,
59
- T: 84,
60
- U: 85,
61
- V: 86,
62
- W: 87,
63
- X: 88,
64
- Y: 89,
65
- Z: 90,
66
- META: 91,
67
- WIN_KEY_RIGHT: 92,
68
- CONTEXT_MENU: 93,
69
- NUM_ZERO: 96,
70
- NUM_ONE: 97,
71
- NUM_TWO: 98,
72
- NUM_THREE: 99,
73
- NUM_FOUR: 100,
74
- NUM_FIVE: 101,
75
- NUM_SIX: 102,
76
- NUM_SEVEN: 103,
77
- NUM_EIGHT: 104,
78
- NUM_NINE: 105,
79
- NUM_MULTIPLY: 106,
80
- NUM_PLUS: 107,
81
- NUM_MINUS: 109,
82
- NUM_PERIOD: 110,
83
- NUM_DIVISION: 111,
84
- F1: 112,
85
- F2: 113,
86
- F3: 114,
87
- F4: 115,
88
- F5: 116,
89
- F6: 117,
90
- F7: 118,
91
- F8: 119,
92
- F9: 120,
93
- F10: 121,
94
- F11: 122,
95
- F12: 123,
96
- NUMLOCK: 144,
97
- SEMICOLON: 186,
98
- DASH: 189,
99
- EQUALS: 187,
100
- COMMA: 188,
101
- PERIOD: 190,
102
- SLASH: 191,
103
- APOSTROPHE: 192,
104
- SINGLE_QUOTE: 222,
105
- OPEN_SQUARE_BRACKET: 219,
106
- BACKSLASH: 220,
107
- CLOSE_SQUARE_BRACKET: 221,
108
- WIN_KEY: 224,
109
- MAC_FF_META: 224,
110
- WIN_IME: 229,
111
- isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
112
- const { keyCode } = e;
113
- if (e.altKey && !e.ctrlKey || e.metaKey || keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) return false;
114
- switch (keyCode) {
115
- case KeyCode.ALT:
116
- case KeyCode.CAPS_LOCK:
117
- case KeyCode.CONTEXT_MENU:
118
- case KeyCode.CTRL:
119
- case KeyCode.DOWN:
120
- case KeyCode.END:
121
- case KeyCode.ESC:
122
- case KeyCode.HOME:
123
- case KeyCode.INSERT:
124
- case KeyCode.LEFT:
125
- case KeyCode.MAC_FF_META:
126
- case KeyCode.META:
127
- case KeyCode.NUMLOCK:
128
- case KeyCode.NUM_CENTER:
129
- case KeyCode.PAGE_DOWN:
130
- case KeyCode.PAGE_UP:
131
- case KeyCode.PAUSE:
132
- case KeyCode.PRINT_SCREEN:
133
- case KeyCode.RIGHT:
134
- case KeyCode.SHIFT:
135
- case KeyCode.UP:
136
- case KeyCode.WIN_KEY:
137
- case KeyCode.WIN_KEY_RIGHT: return false;
138
- default: return true;
139
- }
140
- },
141
- isCharacterKey: function isCharacterKey(keyCode) {
142
- if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) return true;
143
- if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) return true;
144
- if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) return true;
145
- if (window.navigator.userAgent.includes("WebKit") && keyCode === 0) return true;
146
- switch (keyCode) {
147
- case KeyCode.SPACE:
148
- case KeyCode.QUESTION_MARK:
149
- case KeyCode.NUM_PLUS:
150
- case KeyCode.NUM_MINUS:
151
- case KeyCode.NUM_PERIOD:
152
- case KeyCode.NUM_DIVISION:
153
- case KeyCode.SEMICOLON:
154
- case KeyCode.DASH:
155
- case KeyCode.EQUALS:
156
- case KeyCode.COMMA:
157
- case KeyCode.PERIOD:
158
- case KeyCode.SLASH:
159
- case KeyCode.APOSTROPHE:
160
- case KeyCode.SINGLE_QUOTE:
161
- case KeyCode.OPEN_SQUARE_BRACKET:
162
- case KeyCode.BACKSLASH:
163
- case KeyCode.CLOSE_SQUARE_BRACKET: return true;
164
- default: return false;
165
- }
166
- }
167
- };
168
- var KeyCode_default = KeyCode;
169
- const KeyCodeStr = {
170
- Enter: "Enter",
171
- Backspace: "Backspace",
172
- Tab: "Tab",
173
- Space: " ",
174
- Escape: "Escape",
175
- Shift: "Shift",
176
- Control: "Control",
177
- Alt: "Alt",
178
- Meta: "Meta",
179
- ArrowLeft: "ArrowLeft",
180
- ArrowUp: "ArrowUp",
181
- ArrowRight: "ArrowRight",
182
- ArrowDown: "ArrowDown",
183
- Home: "Home",
184
- End: "End",
185
- PageUp: "PageUp",
186
- PageDown: "PageDown",
187
- Insert: "Insert",
188
- Delete: "Delete",
189
- F1: "F1",
190
- F2: "F2",
191
- F3: "F3",
192
- F4: "F4",
193
- F5: "F5",
194
- F6: "F6",
195
- F7: "F7",
196
- F8: "F8",
197
- F9: "F9",
198
- F10: "F10",
199
- F11: "F11",
200
- F12: "F12",
201
- Digit0: "0",
202
- Digit1: "1",
203
- Digit2: "2",
204
- Digit3: "3",
205
- Digit4: "4",
206
- Digit5: "5",
207
- Digit6: "6",
208
- Digit7: "7",
209
- Digit8: "8",
210
- Digit9: "9",
211
- KeyA: "a",
212
- KeyB: "b",
213
- KeyC: "c",
214
- KeyD: "d",
215
- KeyE: "e",
216
- KeyF: "f",
217
- KeyG: "g",
218
- KeyH: "h",
219
- KeyI: "i",
220
- KeyJ: "j",
221
- KeyK: "k",
222
- KeyL: "l",
223
- KeyM: "m",
224
- KeyN: "n",
225
- KeyO: "o",
226
- KeyP: "p",
227
- KeyQ: "q",
228
- KeyR: "r",
229
- KeyS: "s",
230
- KeyT: "t",
231
- KeyU: "u",
232
- KeyV: "v",
233
- KeyW: "w",
234
- KeyX: "x",
235
- KeyY: "y",
236
- KeyZ: "z",
237
- Semicolon: ";",
238
- Equal: "=",
239
- Comma: ",",
240
- Minus: "-",
241
- Period: ".",
242
- Slash: "/",
243
- Backquote: "`",
244
- BracketLeft: "[",
245
- Backslash: "\\",
246
- BracketRight: "]",
247
- Quote: "'"
248
- };
249
- exports.KeyCodeStr = KeyCodeStr;
250
- exports.default = KeyCode_default;
package/dist/Portal.cjs DELETED
@@ -1,45 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_canUseDom = require("./Dom/canUseDom.cjs");
6
- let vue = require("vue");
7
- var Portal = /* @__PURE__ */ (0, vue.defineComponent)((props, ctx) => {
8
- const parentRef = (0, vue.shallowRef)();
9
- const containerRef = (0, vue.shallowRef)();
10
- const initRef = (0, vue.shallowRef)(false);
11
- if (!initRef.value && require_canUseDom.default()) {
12
- containerRef.value = props.getContainer();
13
- parentRef.value = containerRef.value?.parentNode;
14
- initRef.value = true;
15
- }
16
- (0, vue.onMounted)(() => {
17
- if (containerRef.value?.parentNode === null && parentRef.value !== null) parentRef.value.appendChild(containerRef.value);
18
- });
19
- (0, vue.onBeforeUnmount)(() => {
20
- props.didUpdate?.(props);
21
- });
22
- (0, vue.onUnmounted)(() => {
23
- containerRef.value?.parentNode?.removeChild?.(containerRef.value);
24
- });
25
- return () => {
26
- if (containerRef.value) return (0, vue.createVNode)(vue.Teleport, { "to": containerRef.value }, { default: () => [ctx.slots.default?.()] });
27
- return null;
28
- };
29
- }, {
30
- props: {
31
- didUpdate: {
32
- type: Function,
33
- required: false,
34
- default: void 0
35
- },
36
- getContainer: {
37
- type: Function,
38
- required: true,
39
- default: void 0
40
- }
41
- },
42
- inheritAttrs: false
43
- });
44
- var Portal_default = Portal;
45
- exports.default = Portal_default;
@@ -1,138 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_canUseDom = require("./Dom/canUseDom.cjs");
6
- const require_Portal = require("./Portal.cjs");
7
- const require_setStyle = require("./setStyle.cjs");
8
- const require_scrollLocker = require("./Dom/scrollLocker.cjs");
9
- const require_raf = require("./raf.cjs");
10
- let vue = require("vue");
11
- var openCount = 0;
12
- var supportDom = require_canUseDom.default();
13
- function getOpenCount() {
14
- return process.env.NODE_ENV === "test" ? openCount : 0;
15
- }
16
- var cacheOverflow = {};
17
- function getParent(getContainer) {
18
- if (!supportDom) return null;
19
- if (getContainer) {
20
- if (typeof getContainer === "string") return document.querySelectorAll(getContainer)[0];
21
- if (typeof getContainer === "function") return getContainer();
22
- if (typeof getContainer === "object" && getContainer instanceof window.HTMLElement) return getContainer;
23
- }
24
- return document.body;
25
- }
26
- var PortalWrapper = /* @__PURE__ */ (0, vue.defineComponent)((props, ctx) => {
27
- const container = (0, vue.shallowRef)();
28
- const componentRef = (0, vue.shallowRef)();
29
- const rafId = (0, vue.shallowRef)();
30
- const scrollLocker = (0, vue.shallowRef)();
31
- const removeCurrentContainer = () => {
32
- container.value?.parentNode?.removeChild(container.value);
33
- };
34
- const updateOpenCount = (prevProps) => {
35
- const { visible: prevVisible, getContainer: prevGetContainer } = prevProps || {};
36
- const { visible, getContainer: getContainer$1 } = props;
37
- if (visible !== prevVisible && supportDom && getParent(getContainer$1) === document.body) {
38
- if (visible && !prevVisible) openCount += 1;
39
- else if (prevProps) openCount -= 1;
40
- }
41
- if (typeof getContainer$1 === "function" && typeof prevGetContainer === "function" ? getContainer$1.toString() !== prevGetContainer.toString() : getContainer$1 !== prevGetContainer) removeCurrentContainer();
42
- };
43
- const attachToParent = (force = false) => {
44
- if (force || container.value && !container.value.parentNode) {
45
- const parent = getParent(props.getContainer);
46
- if (parent) {
47
- parent.appendChild(container.value);
48
- return true;
49
- }
50
- return false;
51
- }
52
- return true;
53
- };
54
- const setWrapperClassName = () => {
55
- const { wrapperClassName } = props;
56
- if (container.value && wrapperClassName && wrapperClassName !== container.value.className) container.value.className = wrapperClassName;
57
- };
58
- const getContainer = () => {
59
- if (!supportDom) return null;
60
- if (!container.value) {
61
- container.value = document.createElement("div");
62
- attachToParent(true);
63
- }
64
- setWrapperClassName();
65
- return container.value;
66
- };
67
- (0, vue.onMounted)(() => {
68
- scrollLocker.value = new require_scrollLocker.default({ container: getParent(props.getContainer) });
69
- updateOpenCount();
70
- if (!attachToParent()) rafId.value = require_raf.default(() => {});
71
- });
72
- (0, vue.onUpdated)(() => {
73
- updateOpenCount(props);
74
- updateOpenCount(props);
75
- setWrapperClassName();
76
- attachToParent();
77
- });
78
- (0, vue.onBeforeUnmount)(() => {
79
- const { visible, getContainer: getContainer$1 } = props;
80
- if (supportDom && getParent(getContainer$1) === document.body) openCount = visible && openCount ? openCount - 1 : openCount;
81
- removeCurrentContainer();
82
- require_raf.default.cancel(rafId.value);
83
- });
84
- const switchScrollingEffect = () => {
85
- if (openCount === 1 && !Object.keys(cacheOverflow).length) {
86
- switchScrollingEffect();
87
- cacheOverflow = require_setStyle.default({
88
- overflow: "hidden",
89
- overflowX: "hidden",
90
- overflowY: "hidden"
91
- });
92
- } else if (!openCount) {
93
- require_setStyle.default(cacheOverflow);
94
- cacheOverflow = {};
95
- switchScrollingEffect();
96
- }
97
- };
98
- return () => {
99
- const { forceRender, visible } = props;
100
- let portal = null;
101
- const childProps = {
102
- getOpenCount,
103
- getContainer,
104
- switchScrollingEffect,
105
- scrollLocker: scrollLocker.value
106
- };
107
- if (forceRender || visible || componentRef.value) portal = (0, vue.createVNode)(require_Portal.default, {
108
- "getContainer": getContainer,
109
- "ref": componentRef
110
- }, { default: () => [ctx?.slots?.default(childProps)] });
111
- return portal;
112
- };
113
- }, { props: {
114
- visible: {
115
- type: Boolean,
116
- required: false,
117
- default: void 0
118
- },
119
- getContainer: {
120
- type: [String, Function],
121
- required: false,
122
- skipCheck: true,
123
- default: void 0
124
- },
125
- wrapperClassName: {
126
- type: String,
127
- required: false,
128
- default: void 0
129
- },
130
- forceRender: {
131
- type: Boolean,
132
- required: false,
133
- default: void 0
134
- }
135
- } });
136
- var PortalWrapper_default = PortalWrapper;
137
- exports.default = PortalWrapper_default;
138
- exports.getOpenCount = getOpenCount;
@@ -1,34 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- const require_index = require("./props-util/index.cjs");
6
- let vue = require("vue");
7
- function checkIsBaseType(value) {
8
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
9
- return typeof value === "undefined" || value === null;
10
- }
11
- var RenderComponent_default = (0, vue.defineComponent)((props, { attrs }) => {
12
- return () => {
13
- const render = props.render;
14
- if (render && typeof render === "function") {
15
- const _render = render?.();
16
- if (Array.isArray(_render)) return require_index.filterEmpty(_render).map((v) => {
17
- if ((0, vue.isVNode)(v)) return (0, vue.createVNode)(v, { ...attrs });
18
- else return v;
19
- });
20
- return _render;
21
- } else if (Array.isArray(render)) return require_index.filterEmpty(render).map((v) => {
22
- if ((0, vue.isVNode)(v)) return (0, vue.createVNode)(v, { ...attrs });
23
- return v;
24
- });
25
- else if (checkIsBaseType(render)) return render;
26
- if ((0, vue.isVNode)(render)) return (0, vue.createVNode)(render, { ...attrs });
27
- return render;
28
- };
29
- }, {
30
- inheritAttrs: false,
31
- name: "RenderComponent",
32
- props: ["render"]
33
- });
34
- exports.default = RenderComponent_default;
@@ -1,40 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- function toVal(mix) {
6
- let str = "";
7
- if (typeof mix === "string" || typeof mix === "number") str += mix;
8
- else if (typeof mix === "object") {
9
- if (Array.isArray(mix)) {
10
- for (let k = 0; k < mix.length; k++) if (mix[k]) {
11
- const y = toVal(mix[k]);
12
- if (y) {
13
- str && (str += " ");
14
- str += y;
15
- }
16
- }
17
- } else for (const k in mix) if (mix[k]) {
18
- str && (str += " ");
19
- str += k;
20
- }
21
- }
22
- return str;
23
- }
24
- function classNames(...args) {
25
- let str = "";
26
- for (let i = 0; i < args.length; i++) {
27
- const tmp = args[i];
28
- if (tmp) {
29
- const x = toVal(tmp);
30
- if (x) {
31
- str && (str += " ");
32
- str += x;
33
- }
34
- }
35
- }
36
- return str;
37
- }
38
- const clsx = classNames;
39
- exports.clsx = clsx;
40
- exports.default = classNames;
@@ -1,20 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- function composeProps(originProps, patchProps, isAll) {
6
- const composedProps = {
7
- ...originProps,
8
- ...isAll ? patchProps : {}
9
- };
10
- Object.keys(patchProps).forEach((key) => {
11
- const func = patchProps[key];
12
- if (typeof func === "function") composedProps[key] = (...args) => {
13
- func(...args);
14
- return originProps[key]?.(...args);
15
- };
16
- });
17
- return composedProps;
18
- }
19
- var composeProps_default = composeProps;
20
- exports.default = composeProps_default;
@@ -1,25 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- function createRef() {
6
- const func = (node) => {
7
- func.current = node;
8
- };
9
- return func;
10
- }
11
- function fillRef(ref, node) {
12
- if (typeof ref === "function") ref(node);
13
- else if (typeof ref === "object" && ref && "current" in ref) ref.current = node;
14
- }
15
- function composeRef(...refs) {
16
- return (node) => {
17
- refs.forEach((ref) => {
18
- fillRef(ref, node);
19
- });
20
- };
21
- }
22
- var createRef_default = createRef;
23
- exports.composeRef = composeRef;
24
- exports.default = createRef_default;
25
- exports.fillRef = fillRef;
@@ -1,47 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- function createArray() {
6
- const arr = [];
7
- arr.__proto__ = [];
8
- arr.__proto__.format = function toString() {
9
- return this.map((obj) => ({
10
- ...obj,
11
- path: obj.path.join(" > ")
12
- }));
13
- };
14
- arr.__proto__.toString = function toString() {
15
- return JSON.stringify(this.format(), null, 2);
16
- };
17
- return arr;
18
- }
19
- function diff(obj1, obj2, depth = 10, path = [], diffList = createArray()) {
20
- if (depth <= 0) return diffList;
21
- new Set([...Object.keys(obj1), ...Object.keys(obj2)]).forEach((key) => {
22
- const value1 = obj1[key];
23
- const value2 = obj2[key];
24
- if (value1 === value2) return;
25
- const type1 = typeof value1;
26
- if (type1 !== typeof value2) {
27
- diffList.push({
28
- path: path.concat(key),
29
- value1,
30
- value2
31
- });
32
- return;
33
- }
34
- if (Number.isNaN(value1) && Number.isNaN(value2)) return;
35
- if (type1 === "object" && value1 !== null && value2 !== null) {
36
- diff(value1, value2, depth - 1, path.concat(key), diffList);
37
- return;
38
- }
39
- diffList.push({
40
- path: path.concat(key),
41
- value1,
42
- value2
43
- });
44
- });
45
- return diffList;
46
- }
47
- exports.default = diff;
@@ -1,8 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- function deprecated(props, instead, component) {
6
- if (typeof window !== "undefined" && window.console && window.console.error) window.console.error(`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`);
7
- }
8
- exports.default = deprecated;
@@ -1,58 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- var cached;
6
- function getScrollBarSize(fresh) {
7
- if (typeof document === "undefined") return 0;
8
- if (fresh || cached === void 0) {
9
- const inner = document.createElement("div");
10
- inner.style.width = "100%";
11
- inner.style.height = "200px";
12
- const outer = document.createElement("div");
13
- const outerStyle = outer.style;
14
- outerStyle.position = "absolute";
15
- outerStyle.top = "0";
16
- outerStyle.left = "0";
17
- outerStyle.pointerEvents = "none";
18
- outerStyle.visibility = "hidden";
19
- outerStyle.width = "200px";
20
- outerStyle.height = "150px";
21
- outerStyle.overflow = "hidden";
22
- outer.appendChild(inner);
23
- document.body.appendChild(outer);
24
- const widthContained = inner.offsetWidth;
25
- outer.style.overflow = "scroll";
26
- let widthScroll = inner.offsetWidth;
27
- if (widthContained === widthScroll) widthScroll = outer.clientWidth;
28
- document.body.removeChild(outer);
29
- cached = widthContained - widthScroll;
30
- }
31
- return cached;
32
- }
33
- function ensureSize(str) {
34
- const match = str.match(/^(.*)px$/);
35
- const value = Number(match?.[1]);
36
- return Number.isNaN(value) ? getScrollBarSize() : value;
37
- }
38
- function getTargetScrollBarSize(target) {
39
- if (typeof document === "undefined" || !target || !(target instanceof Element)) return {
40
- width: 0,
41
- height: 0
42
- };
43
- if (typeof navigator !== "undefined" && /jsdom/i.test(navigator.userAgent)) return {
44
- width: 0,
45
- height: 0
46
- };
47
- let width = "0px";
48
- let height = "0px";
49
- try {
50
- ({width, height} = getComputedStyle(target, "::-webkit-scrollbar"));
51
- } catch {}
52
- return {
53
- width: ensureSize(width),
54
- height: ensureSize(height)
55
- };
56
- }
57
- exports.default = getScrollBarSize;
58
- exports.getTargetScrollBarSize = getTargetScrollBarSize;
package/dist/guid.cjs DELETED
@@ -1,9 +0,0 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
5
- var seed = 0;
6
- function guid() {
7
- return `${Date.now()}_${seed++}`;
8
- }
9
- exports.default = guid;
@@ -1,19 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let vue = require("vue");
3
- function useControlledState(state, emit, updateKey = "value", defaultState, props) {
4
- const mergedState = (0, vue.shallowRef)(defaultState ?? state.value);
5
- function setState(nextState) {
6
- if (emit) emit(`update:${updateKey}`, nextState);
7
- if (props && props?.[`onUpdate:${updateKey}`]) props?.[`onUpdate:${updateKey}`](nextState);
8
- (0, vue.nextTick)(() => {
9
- if (state.value === void 0 && state.value !== nextState) mergedState.value = nextState;
10
- });
11
- }
12
- (0, vue.watch)(() => (0, vue.toValue)(state), () => {
13
- const prevState = (0, vue.toValue)(mergedState);
14
- const nextState = (0, vue.toValue)(state);
15
- if (prevState !== nextState) mergedState.value = nextState;
16
- });
17
- return [state, setState];
18
- }
19
- exports.useControlledState = useControlledState;