@yamada-ui/utils 0.1.0
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/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/array.d.ts +3 -0
- package/dist/array.js +30 -0
- package/dist/array.mjs +6 -0
- package/dist/assertion.d.ts +16 -0
- package/dist/assertion.js +63 -0
- package/dist/assertion.mjs +28 -0
- package/dist/calc.d.ts +17 -0
- package/dist/calc.js +55 -0
- package/dist/calc.mjs +6 -0
- package/dist/chunk-A6J4FUU7.mjs +401 -0
- package/dist/chunk-BZAW2D6U.mjs +6 -0
- package/dist/chunk-FW7XS4NH.mjs +120 -0
- package/dist/chunk-IVGIIDMV.mjs +28 -0
- package/dist/chunk-PF7LRFIA.mjs +51 -0
- package/dist/chunk-PURW64JE.mjs +6 -0
- package/dist/chunk-R5OUKGQ5.mjs +31 -0
- package/dist/chunk-SLJ4M7XC.mjs +0 -0
- package/dist/chunk-VYMGBE25.mjs +39 -0
- package/dist/color.d.ts +19 -0
- package/dist/color.js +181 -0
- package/dist/color.mjs +34 -0
- package/dist/dom.d.ts +33 -0
- package/dist/dom.js +168 -0
- package/dist/dom.mjs +54 -0
- package/dist/event.d.ts +30 -0
- package/dist/event.js +83 -0
- package/dist/event.mjs +22 -0
- package/dist/function.d.ts +6 -0
- package/dist/function.js +50 -0
- package/dist/function.mjs +20 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +796 -0
- package/dist/index.mjs +221 -0
- package/dist/index.types.d.ts +14 -0
- package/dist/index.types.js +18 -0
- package/dist/index.types.mjs +1 -0
- package/dist/number.d.ts +8 -0
- package/dist/number.js +68 -0
- package/dist/number.mjs +16 -0
- package/dist/object.d.ts +18 -0
- package/dist/object.js +192 -0
- package/dist/object.mjs +40 -0
- package/dist/react.d.ts +44 -0
- package/dist/react.js +176 -0
- package/dist/react.mjs +46 -0
- package/dist/string.d.ts +3 -0
- package/dist/string.js +30 -0
- package/dist/string.mjs +6 -0
- package/package.json +66 -0
package/dist/dom.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/dom.ts
|
|
21
|
+
var dom_exports = {};
|
|
22
|
+
__export(dom_exports, {
|
|
23
|
+
ariaAttr: () => ariaAttr,
|
|
24
|
+
createdDom: () => createdDom,
|
|
25
|
+
dataAttr: () => dataAttr,
|
|
26
|
+
getActiveElement: () => getActiveElement,
|
|
27
|
+
getAllFocusable: () => getAllFocusable,
|
|
28
|
+
getEventRelatedTarget: () => getEventRelatedTarget,
|
|
29
|
+
getOwnerDocument: () => getOwnerDocument,
|
|
30
|
+
getOwnerWindow: () => getOwnerWindow,
|
|
31
|
+
getPlatform: () => getPlatform,
|
|
32
|
+
hasNegativeTabIndex: () => hasNegativeTabIndex,
|
|
33
|
+
hasTabIndex: () => hasTabIndex,
|
|
34
|
+
isActiveElement: () => isActiveElement,
|
|
35
|
+
isApple: () => isApple,
|
|
36
|
+
isContains: () => isContains,
|
|
37
|
+
isContentEditable: () => isContentEditable,
|
|
38
|
+
isDisabled: () => isDisabled,
|
|
39
|
+
isElement: () => isElement,
|
|
40
|
+
isFocusable: () => isFocusable,
|
|
41
|
+
isHTMLElement: () => isHTMLElement,
|
|
42
|
+
isHidden: () => isHidden,
|
|
43
|
+
isMac: () => isMac,
|
|
44
|
+
isSafari: () => isSafari,
|
|
45
|
+
isTabbable: () => isTabbable,
|
|
46
|
+
platform: () => platform,
|
|
47
|
+
vendor: () => vendor
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(dom_exports);
|
|
50
|
+
var createdDom = () => !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
51
|
+
var getPlatform = () => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
return (_b = (_a = navigator.userAgentData) == null ? void 0 : _a.platform) != null ? _b : navigator.platform;
|
|
54
|
+
};
|
|
55
|
+
var vendor = (v) => createdDom() && v.test(navigator.vendor);
|
|
56
|
+
var platform = (v) => createdDom() && v.test(getPlatform());
|
|
57
|
+
var isMac = () => platform(/^mac/);
|
|
58
|
+
var isApple = () => platform(/mac|iphone|ipad|ipod/i);
|
|
59
|
+
var isSafari = () => isApple() && vendor(/apple/i);
|
|
60
|
+
var isElement = (el) => el != null && typeof el == "object" && "nodeType" in el && el.nodeType === Node.ELEMENT_NODE;
|
|
61
|
+
var isHTMLElement = (el) => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!isElement(el))
|
|
64
|
+
return false;
|
|
65
|
+
const win = (_a = el.ownerDocument.defaultView) != null ? _a : window;
|
|
66
|
+
return el instanceof win.HTMLElement;
|
|
67
|
+
};
|
|
68
|
+
var isHidden = (el) => {
|
|
69
|
+
if (el.parentElement && isHidden(el.parentElement))
|
|
70
|
+
return true;
|
|
71
|
+
return el.hidden;
|
|
72
|
+
};
|
|
73
|
+
var isDisabled = (el) => Boolean(el.getAttribute("disabled")) === true || Boolean(el.getAttribute("aria-disabled")) === true;
|
|
74
|
+
var isVisible = (el) => el.offsetWidth > 0 && el.offsetHeight > 0;
|
|
75
|
+
var hasTabIndex = (el) => el.hasAttribute("tabindex");
|
|
76
|
+
var isContentEditable = (el) => {
|
|
77
|
+
const value = el.getAttribute("contenteditable");
|
|
78
|
+
return value !== "false" && value != null;
|
|
79
|
+
};
|
|
80
|
+
var isContains = (parent, child) => {
|
|
81
|
+
return parent === child || (parent == null ? void 0 : parent.contains(child));
|
|
82
|
+
};
|
|
83
|
+
var getEventRelatedTarget = (ev) => {
|
|
84
|
+
var _a;
|
|
85
|
+
return (_a = ev.relatedTarget) != null ? _a : ev.currentTarget.ownerDocument.activeElement;
|
|
86
|
+
};
|
|
87
|
+
var dataAttr = (condition) => condition ? "" : void 0;
|
|
88
|
+
var ariaAttr = (condition) => condition ? true : void 0;
|
|
89
|
+
var focusableElList = [
|
|
90
|
+
"input:not(:disabled):not([disabled])",
|
|
91
|
+
"select:not(:disabled):not([disabled])",
|
|
92
|
+
"textarea:not(:disabled):not([disabled])",
|
|
93
|
+
"embed",
|
|
94
|
+
"iframe",
|
|
95
|
+
"object",
|
|
96
|
+
"a[href]",
|
|
97
|
+
"area[href]",
|
|
98
|
+
"button:not(:disabled):not([disabled])",
|
|
99
|
+
"[tabindex]",
|
|
100
|
+
"audio[controls]",
|
|
101
|
+
"video[controls]",
|
|
102
|
+
"*[tabindex]:not([aria-disabled])",
|
|
103
|
+
"*[contenteditable]"
|
|
104
|
+
];
|
|
105
|
+
var focusableElSelector = focusableElList.join();
|
|
106
|
+
var getAllFocusable = (container) => {
|
|
107
|
+
const focusableEls = Array.from(container.querySelectorAll(focusableElSelector));
|
|
108
|
+
focusableEls.unshift(container);
|
|
109
|
+
return focusableEls.filter((el) => isFocusable(el) && isVisible(el));
|
|
110
|
+
};
|
|
111
|
+
var isFocusable = (el) => {
|
|
112
|
+
if (!isHTMLElement(el) || isHidden(el) || isDisabled(el)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const { localName } = el;
|
|
116
|
+
const focusableTags = ["input", "select", "textarea", "button"];
|
|
117
|
+
if (focusableTags.indexOf(localName) >= 0)
|
|
118
|
+
return true;
|
|
119
|
+
const others = {
|
|
120
|
+
a: () => el.hasAttribute("href"),
|
|
121
|
+
audio: () => el.hasAttribute("controls"),
|
|
122
|
+
video: () => el.hasAttribute("controls")
|
|
123
|
+
};
|
|
124
|
+
if (localName in others)
|
|
125
|
+
return others[localName]();
|
|
126
|
+
if (isContentEditable(el))
|
|
127
|
+
return true;
|
|
128
|
+
return hasTabIndex(el);
|
|
129
|
+
};
|
|
130
|
+
var hasNegativeTabIndex = (el) => hasTabIndex(el) && el.tabIndex === -1;
|
|
131
|
+
var isTabbable = (el) => el ? isHTMLElement(el) && isFocusable(el) && !hasNegativeTabIndex(el) : false;
|
|
132
|
+
var getOwnerWindow = (node) => {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
return (_b = (_a = getOwnerDocument(node)) == null ? void 0 : _a.defaultView) != null ? _b : window;
|
|
135
|
+
};
|
|
136
|
+
var getOwnerDocument = (el) => isElement(el) ? el.ownerDocument : document;
|
|
137
|
+
var getActiveElement = (el) => getOwnerDocument(el).activeElement;
|
|
138
|
+
var isActiveElement = (el) => {
|
|
139
|
+
return getActiveElement(el) === el;
|
|
140
|
+
};
|
|
141
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
142
|
+
0 && (module.exports = {
|
|
143
|
+
ariaAttr,
|
|
144
|
+
createdDom,
|
|
145
|
+
dataAttr,
|
|
146
|
+
getActiveElement,
|
|
147
|
+
getAllFocusable,
|
|
148
|
+
getEventRelatedTarget,
|
|
149
|
+
getOwnerDocument,
|
|
150
|
+
getOwnerWindow,
|
|
151
|
+
getPlatform,
|
|
152
|
+
hasNegativeTabIndex,
|
|
153
|
+
hasTabIndex,
|
|
154
|
+
isActiveElement,
|
|
155
|
+
isApple,
|
|
156
|
+
isContains,
|
|
157
|
+
isContentEditable,
|
|
158
|
+
isDisabled,
|
|
159
|
+
isElement,
|
|
160
|
+
isFocusable,
|
|
161
|
+
isHTMLElement,
|
|
162
|
+
isHidden,
|
|
163
|
+
isMac,
|
|
164
|
+
isSafari,
|
|
165
|
+
isTabbable,
|
|
166
|
+
platform,
|
|
167
|
+
vendor
|
|
168
|
+
});
|
package/dist/dom.mjs
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ariaAttr,
|
|
3
|
+
createdDom,
|
|
4
|
+
dataAttr,
|
|
5
|
+
getActiveElement,
|
|
6
|
+
getAllFocusable,
|
|
7
|
+
getEventRelatedTarget,
|
|
8
|
+
getOwnerDocument,
|
|
9
|
+
getOwnerWindow,
|
|
10
|
+
getPlatform,
|
|
11
|
+
hasNegativeTabIndex,
|
|
12
|
+
hasTabIndex,
|
|
13
|
+
isActiveElement,
|
|
14
|
+
isApple,
|
|
15
|
+
isContains,
|
|
16
|
+
isContentEditable,
|
|
17
|
+
isDisabled,
|
|
18
|
+
isElement,
|
|
19
|
+
isFocusable,
|
|
20
|
+
isHTMLElement,
|
|
21
|
+
isHidden,
|
|
22
|
+
isMac,
|
|
23
|
+
isSafari,
|
|
24
|
+
isTabbable,
|
|
25
|
+
platform,
|
|
26
|
+
vendor
|
|
27
|
+
} from "./chunk-FW7XS4NH.mjs";
|
|
28
|
+
export {
|
|
29
|
+
ariaAttr,
|
|
30
|
+
createdDom,
|
|
31
|
+
dataAttr,
|
|
32
|
+
getActiveElement,
|
|
33
|
+
getAllFocusable,
|
|
34
|
+
getEventRelatedTarget,
|
|
35
|
+
getOwnerDocument,
|
|
36
|
+
getOwnerWindow,
|
|
37
|
+
getPlatform,
|
|
38
|
+
hasNegativeTabIndex,
|
|
39
|
+
hasTabIndex,
|
|
40
|
+
isActiveElement,
|
|
41
|
+
isApple,
|
|
42
|
+
isContains,
|
|
43
|
+
isContentEditable,
|
|
44
|
+
isDisabled,
|
|
45
|
+
isElement,
|
|
46
|
+
isFocusable,
|
|
47
|
+
isHTMLElement,
|
|
48
|
+
isHidden,
|
|
49
|
+
isMac,
|
|
50
|
+
isSafari,
|
|
51
|
+
isTabbable,
|
|
52
|
+
platform,
|
|
53
|
+
vendor
|
|
54
|
+
};
|
package/dist/event.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent;
|
|
2
|
+
type PointType = 'page' | 'client';
|
|
3
|
+
type Point = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
type PointerEventInfo = {
|
|
8
|
+
point: Point;
|
|
9
|
+
};
|
|
10
|
+
type MixedEventListener = (e: AnyPointerEvent, info: PointerEventInfo) => void;
|
|
11
|
+
declare const isMouseEvent: (ev: any) => ev is MouseEvent;
|
|
12
|
+
declare const isTouchEvent: (ev: AnyPointerEvent) => ev is TouchEvent;
|
|
13
|
+
declare const isMultiTouchEvent: (ev: AnyPointerEvent) => boolean;
|
|
14
|
+
declare const getEventWindow: (ev: Event) => typeof globalThis;
|
|
15
|
+
declare const pointFromTouch: (e: TouchEvent, type?: PointType) => {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
declare const pointFromMouse: (point: MouseEvent | PointerEvent, type?: PointType) => {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
declare const getEventPoint: (ev: AnyPointerEvent, type?: PointType) => {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
declare const addDomEvent: (target: EventTarget, type: string, cb: EventListener, options?: AddEventListenerOptions) => () => void;
|
|
28
|
+
declare const addPointerEvent: (target: EventTarget, type: string, cb: MixedEventListener, options?: AddEventListenerOptions) => () => void;
|
|
29
|
+
|
|
30
|
+
export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch };
|
package/dist/event.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/event.ts
|
|
21
|
+
var event_exports = {};
|
|
22
|
+
__export(event_exports, {
|
|
23
|
+
addDomEvent: () => addDomEvent,
|
|
24
|
+
addPointerEvent: () => addPointerEvent,
|
|
25
|
+
getEventPoint: () => getEventPoint,
|
|
26
|
+
getEventWindow: () => getEventWindow,
|
|
27
|
+
isMouseEvent: () => isMouseEvent,
|
|
28
|
+
isMultiTouchEvent: () => isMultiTouchEvent,
|
|
29
|
+
isTouchEvent: () => isTouchEvent,
|
|
30
|
+
pointFromMouse: () => pointFromMouse,
|
|
31
|
+
pointFromTouch: () => pointFromTouch
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(event_exports);
|
|
34
|
+
var isMouseEvent = (ev) => {
|
|
35
|
+
const win = getEventWindow(ev);
|
|
36
|
+
if (typeof win.PointerEvent !== "undefined" && ev instanceof win.PointerEvent)
|
|
37
|
+
return !!(ev.pointerType === "mouse");
|
|
38
|
+
return ev instanceof win.MouseEvent;
|
|
39
|
+
};
|
|
40
|
+
var isTouchEvent = (ev) => !!ev.touches;
|
|
41
|
+
var isMultiTouchEvent = (ev) => isTouchEvent(ev) && ev.touches.length > 1;
|
|
42
|
+
var getEventWindow = (ev) => {
|
|
43
|
+
var _a;
|
|
44
|
+
return (_a = ev.view) != null ? _a : window;
|
|
45
|
+
};
|
|
46
|
+
var pointFromTouch = (e, type = "page") => {
|
|
47
|
+
const point = e.touches[0] || e.changedTouches[0];
|
|
48
|
+
return { x: point[`${type}X`], y: point[`${type}Y`] };
|
|
49
|
+
};
|
|
50
|
+
var pointFromMouse = (point, type = "page") => ({
|
|
51
|
+
x: point[`${type}X`],
|
|
52
|
+
y: point[`${type}Y`]
|
|
53
|
+
});
|
|
54
|
+
var getEventPoint = (ev, type = "page") => isTouchEvent(ev) ? pointFromTouch(ev, type) : pointFromMouse(ev, type);
|
|
55
|
+
var addDomEvent = (target, type, cb, options) => {
|
|
56
|
+
target.addEventListener(type, cb, options);
|
|
57
|
+
return () => {
|
|
58
|
+
target.removeEventListener(type, cb, options);
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var filter = (cb) => (event) => {
|
|
62
|
+
const isMouse = isMouseEvent(event);
|
|
63
|
+
if (!isMouse || isMouse && event.button === 0)
|
|
64
|
+
cb(event);
|
|
65
|
+
};
|
|
66
|
+
var wrap = (cb, filterPrimary = false) => {
|
|
67
|
+
const listener = (event) => cb(event, { point: getEventPoint(event) });
|
|
68
|
+
const fn = filterPrimary ? filter(listener) : listener;
|
|
69
|
+
return fn;
|
|
70
|
+
};
|
|
71
|
+
var addPointerEvent = (target, type, cb, options) => addDomEvent(target, type, wrap(cb, type === "pointerdown"), options);
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
addDomEvent,
|
|
75
|
+
addPointerEvent,
|
|
76
|
+
getEventPoint,
|
|
77
|
+
getEventWindow,
|
|
78
|
+
isMouseEvent,
|
|
79
|
+
isMultiTouchEvent,
|
|
80
|
+
isTouchEvent,
|
|
81
|
+
pointFromMouse,
|
|
82
|
+
pointFromTouch
|
|
83
|
+
});
|
package/dist/event.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDomEvent,
|
|
3
|
+
addPointerEvent,
|
|
4
|
+
getEventPoint,
|
|
5
|
+
getEventWindow,
|
|
6
|
+
isMouseEvent,
|
|
7
|
+
isMultiTouchEvent,
|
|
8
|
+
isTouchEvent,
|
|
9
|
+
pointFromMouse,
|
|
10
|
+
pointFromTouch
|
|
11
|
+
} from "./chunk-PF7LRFIA.mjs";
|
|
12
|
+
export {
|
|
13
|
+
addDomEvent,
|
|
14
|
+
addPointerEvent,
|
|
15
|
+
getEventPoint,
|
|
16
|
+
getEventWindow,
|
|
17
|
+
isMouseEvent,
|
|
18
|
+
isMultiTouchEvent,
|
|
19
|
+
isTouchEvent,
|
|
20
|
+
pointFromMouse,
|
|
21
|
+
pointFromTouch
|
|
22
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const noop: () => void;
|
|
2
|
+
declare const runIfFunc: <T, U extends any[]>(valOrFunc: T | ((...funcArgs: U) => T), ...args: U) => T;
|
|
3
|
+
declare const handlerAll: <T extends (event: any) => void>(...funcs: (T | undefined)[]) => (event: (T extends (...args: infer R) => any ? R : never)[0]) => void;
|
|
4
|
+
declare const funcAll: <T extends (...args: any[]) => any>(...funcs: (T | undefined)[]) => (arg: (T extends (...args: infer R) => any ? R : never)[0]) => void;
|
|
5
|
+
|
|
6
|
+
export { funcAll, handlerAll, noop, runIfFunc };
|
package/dist/function.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/function.ts
|
|
21
|
+
var function_exports = {};
|
|
22
|
+
__export(function_exports, {
|
|
23
|
+
funcAll: () => funcAll,
|
|
24
|
+
handlerAll: () => handlerAll,
|
|
25
|
+
noop: () => noop,
|
|
26
|
+
runIfFunc: () => runIfFunc
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(function_exports);
|
|
29
|
+
|
|
30
|
+
// src/assertion.ts
|
|
31
|
+
var isFunction = (value) => typeof value === "function";
|
|
32
|
+
|
|
33
|
+
// src/function.ts
|
|
34
|
+
var noop = () => {
|
|
35
|
+
};
|
|
36
|
+
var runIfFunc = (valOrFunc, ...args) => isFunction(valOrFunc) ? valOrFunc(...args) : valOrFunc;
|
|
37
|
+
var handlerAll = (...funcs) => (event) => {
|
|
38
|
+
funcs.some((func) => {
|
|
39
|
+
func == null ? void 0 : func(event);
|
|
40
|
+
return event == null ? void 0 : event.defaultPrevented;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
var funcAll = (...funcs) => (arg) => funcs.forEach((func) => func == null ? void 0 : func(arg));
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
funcAll,
|
|
47
|
+
handlerAll,
|
|
48
|
+
noop,
|
|
49
|
+
runIfFunc
|
|
50
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
funcAll,
|
|
3
|
+
handlerAll,
|
|
4
|
+
noop,
|
|
5
|
+
runIfFunc
|
|
6
|
+
} from "./chunk-A6J4FUU7.mjs";
|
|
7
|
+
import "./chunk-SLJ4M7XC.mjs";
|
|
8
|
+
import "./chunk-VYMGBE25.mjs";
|
|
9
|
+
import "./chunk-BZAW2D6U.mjs";
|
|
10
|
+
import "./chunk-PURW64JE.mjs";
|
|
11
|
+
import "./chunk-IVGIIDMV.mjs";
|
|
12
|
+
import "./chunk-R5OUKGQ5.mjs";
|
|
13
|
+
import "./chunk-FW7XS4NH.mjs";
|
|
14
|
+
import "./chunk-PF7LRFIA.mjs";
|
|
15
|
+
export {
|
|
16
|
+
funcAll,
|
|
17
|
+
handlerAll,
|
|
18
|
+
noop,
|
|
19
|
+
runIfFunc
|
|
20
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Dict, DynamicRecord, Length, Path, StringLiteral, Union } from './index.types.js';
|
|
2
|
+
export { cast, isArray, isEmpty, isFunction, isNotNumber, isNull, isNumber, isNumeric, isObject, isString, isUndefined, isUnit } from './assertion.js';
|
|
3
|
+
export { assignAfter, filterObject, filterUndefined, flattenObject, getMemoizedObject, getObject, keysFormObject, memoizeObject, merge, objectFromEntries, omitObject, pickObject, replaceObject, splitObject } from './object.js';
|
|
4
|
+
export { funcAll, handlerAll, noop, runIfFunc } from './function.js';
|
|
5
|
+
export { DOMAttributes, MaybeRenderProp, PropGetter, RequiredPropGetter, assignRef, createContext, cx, findChildren, getValidChildren, includesChildren, isRefObject, isValidElement, mergeRefs, omitChildren, pickChildren, useCallbackRef, useIsMounted, useMergeRefs, useSafeLayoutEffect, useUnmountEffect, useUpdateEffect } from './react.js';
|
|
6
|
+
export { FocusableElement, ariaAttr, createdDom, dataAttr, getActiveElement, getAllFocusable, getEventRelatedTarget, getOwnerDocument, getOwnerWindow, getPlatform, hasNegativeTabIndex, hasTabIndex, isActiveElement, isApple, isContains, isContentEditable, isDisabled, isElement, isFocusable, isHTMLElement, isHidden, isMac, isSafari, isTabbable, platform, vendor } from './dom.js';
|
|
7
|
+
export { escape } from './string.js';
|
|
8
|
+
export { Operand, calc } from './calc.js';
|
|
9
|
+
export { brightenColor, darkenColor, getColor, isDark, isLight, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor } from './color.js';
|
|
10
|
+
export { filterEmpty } from './array.js';
|
|
11
|
+
export { clampNumber, countDecimal, percentToValue, roundNumberToStep, toPrecision, valueToPercent } from './number.js';
|
|
12
|
+
export { AnyPointerEvent, MixedEventListener, Point, PointType, PointerEventInfo, addDomEvent, addPointerEvent, getEventPoint, getEventWindow, isMouseEvent, isMultiTouchEvent, isTouchEvent, pointFromMouse, pointFromTouch } from './event.js';
|
|
13
|
+
import 'react';
|
|
14
|
+
import '@ctrl/tinycolor';
|