yummies 5.4.7 → 5.4.8
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/async.cjs +70 -0
- package/async.d.cts +28 -0
- package/async.d.cts.map +1 -0
- package/common.cjs +18 -0
- package/common.d.cts +15 -0
- package/common.d.cts.map +1 -0
- package/common.d.ts +1 -1
- package/common.d.ts.map +1 -1
- package/complex/counter.cjs +21 -0
- package/complex/counter.d.cts +15 -0
- package/complex/counter.d.cts.map +1 -0
- package/complex/global-config.cjs +46 -0
- package/complex/global-config.d.cts +11 -0
- package/complex/global-config.d.cts.map +1 -0
- package/complex/global-config.d.ts +1 -1
- package/complex/global-config.d.ts.map +1 -1
- package/complex/index.cjs +19 -0
- package/complex/index.d.cts +4 -0
- package/complex/index.d.cts.map +1 -0
- package/complex/index.d.ts +3 -3
- package/complex/index.d.ts.map +1 -1
- package/complex/index.js +3 -3
- package/complex/modules-factory.cjs +50 -0
- package/complex/modules-factory.d.cts +49 -0
- package/complex/modules-factory.d.cts.map +1 -0
- package/complex/modules-factory.d.ts +1 -1
- package/complex/modules-factory.d.ts.map +1 -1
- package/cookie.cjs +13 -0
- package/cookie.d.cts +3 -0
- package/cookie.d.cts.map +1 -0
- package/cookie.d.ts +1 -1
- package/cookie.d.ts.map +1 -1
- package/css.cjs +28 -0
- package/css.d.cts +36 -0
- package/css.d.cts.map +1 -0
- package/data.cjs +58 -0
- package/data.d.cts +4 -0
- package/data.d.cts.map +1 -0
- package/date-time.cjs +171 -0
- package/date-time.d.cts +28 -0
- package/date-time.d.cts.map +1 -0
- package/date-time.d.ts +1 -1
- package/date-time.d.ts.map +1 -1
- package/date-time.js +4 -4
- package/device.cjs +28 -0
- package/device.d.cts +8 -0
- package/device.d.cts.map +1 -0
- package/encodings.cjs +270 -0
- package/encodings.d.cts +2 -0
- package/encodings.d.cts.map +1 -0
- package/errors.cjs +34 -0
- package/errors.d.cts +19 -0
- package/errors.d.cts.map +1 -0
- package/errors.d.ts +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js +1 -1
- package/file.cjs +29 -0
- package/file.d.cts +3 -0
- package/file.d.cts.map +1 -0
- package/format/_exports.cjs +20 -0
- package/format/_exports.d.cts +5 -0
- package/format/_exports.d.cts.map +1 -0
- package/format/_exports.d.ts +4 -4
- package/format/_exports.d.ts.map +1 -1
- package/format/_exports.js +4 -4
- package/format/constants.cjs +6 -0
- package/format/constants.d.cts +4 -0
- package/format/constants.d.cts.map +1 -0
- package/format/index.cjs +40 -0
- package/format/index.d.cts +3 -0
- package/format/index.d.cts.map +1 -0
- package/format/index.d.ts +1 -1
- package/format/index.d.ts.map +1 -1
- package/format/index.js +1 -1
- package/format/number.cjs +48 -0
- package/format/number.d.cts +36 -0
- package/format/number.d.cts.map +1 -0
- package/format/number.d.ts +1 -1
- package/format/number.d.ts.map +1 -1
- package/format/number.js +3 -3
- package/format/percent.cjs +27 -0
- package/format/percent.d.cts +15 -0
- package/format/percent.d.cts.map +1 -0
- package/format/percent.d.ts +2 -2
- package/format/percent.d.ts.map +1 -1
- package/format/percent.js +3 -3
- package/format/skip-spaces.cjs +8 -0
- package/format/skip-spaces.d.cts +5 -0
- package/format/skip-spaces.d.cts.map +1 -0
- package/html.cjs +202 -0
- package/html.d.cts +44 -0
- package/html.d.cts.map +1 -0
- package/html.d.ts +1 -1
- package/html.d.ts.map +1 -1
- package/html.js +1 -1
- package/id.cjs +76 -0
- package/id.d.cts +63 -0
- package/id.d.cts.map +1 -0
- package/imports.cjs +45 -0
- package/imports.d.cts +15 -0
- package/imports.d.cts.map +1 -0
- package/imports.js +1 -1
- package/math.cjs +23 -0
- package/math.d.cts +13 -0
- package/math.d.cts.map +1 -0
- package/math.d.ts +1 -1
- package/math.d.ts.map +1 -1
- package/media.cjs +115 -0
- package/media.d.cts +20 -0
- package/media.d.cts.map +1 -0
- package/media.js +1 -1
- package/mobx/apply-observable.cjs +16 -0
- package/mobx/apply-observable.d.cts +4 -0
- package/mobx/apply-observable.d.cts.map +1 -0
- package/mobx/apply-observable.d.ts +1 -1
- package/mobx/apply-observable.d.ts.map +1 -1
- package/mobx/create-enhanced-atom.cjs +16 -0
- package/mobx/create-enhanced-atom.d.cts +11 -0
- package/mobx/create-enhanced-atom.d.cts.map +1 -0
- package/mobx/create-enhanced-atom.d.ts +1 -1
- package/mobx/create-enhanced-atom.d.ts.map +1 -1
- package/mobx/deep-observable-struct.cjs +61 -0
- package/mobx/deep-observable-struct.d.cts +7 -0
- package/mobx/deep-observable-struct.d.cts.map +1 -0
- package/mobx/deep-observable-struct.d.ts +1 -1
- package/mobx/deep-observable-struct.d.ts.map +1 -1
- package/mobx/deep-observable-struct.js +1 -1
- package/mobx/get-mobx-administration.cjs +6 -0
- package/mobx/get-mobx-administration.d.cts +6 -0
- package/mobx/get-mobx-administration.d.cts.map +1 -0
- package/mobx/get-mobx-administration.d.ts +1 -1
- package/mobx/get-mobx-administration.d.ts.map +1 -1
- package/mobx/index.cjs +21 -0
- package/mobx/index.d.cts +6 -0
- package/mobx/index.d.cts.map +1 -0
- package/mobx/index.d.ts +5 -5
- package/mobx/index.d.ts.map +1 -1
- package/mobx/index.js +5 -5
- package/mobx/lazy-observe.cjs +47 -0
- package/mobx/lazy-observe.d.cts +8 -0
- package/mobx/lazy-observe.d.cts.map +1 -0
- package/ms.cjs +22 -0
- package/ms.d.cts +19 -0
- package/ms.d.cts.map +1 -0
- package/number.cjs +16 -0
- package/number.d.cts +8 -0
- package/number.d.cts.map +1 -0
- package/package.json +91 -329
- package/parser/_exports.cjs +19 -0
- package/parser/_exports.d.cts +4 -0
- package/parser/_exports.d.cts.map +1 -0
- package/parser/_exports.d.ts +3 -3
- package/parser/_exports.d.ts.map +1 -1
- package/parser/_exports.js +3 -3
- package/parser/index.cjs +40 -0
- package/parser/index.d.cts +3 -0
- package/parser/index.d.cts.map +1 -0
- package/parser/index.d.ts +1 -1
- package/parser/index.d.ts.map +1 -1
- package/parser/index.js +1 -1
- package/parser/number.cjs +48 -0
- package/parser/number.d.cts +21 -0
- package/parser/number.d.cts.map +1 -0
- package/parser/number.d.ts +1 -1
- package/parser/number.d.ts.map +1 -1
- package/parser/number.js +2 -2
- package/parser/percent.cjs +8 -0
- package/parser/percent.d.cts +4 -0
- package/parser/percent.d.cts.map +1 -0
- package/parser/percent.d.ts +2 -2
- package/parser/percent.d.ts.map +1 -1
- package/parser/percent.js +1 -1
- package/parser/string.cjs +18 -0
- package/parser/string.d.cts +7 -0
- package/parser/string.d.cts.map +1 -0
- package/parser/string.d.ts +1 -1
- package/parser/string.d.ts.map +1 -1
- package/parser/string.js +1 -1
- package/price.cjs +21 -0
- package/price.d.cts +6 -0
- package/price.d.cts.map +1 -0
- package/random.cjs +25 -0
- package/random.d.cts +9 -0
- package/random.d.cts.map +1 -0
- package/react/hooks/index.cjs +37 -0
- package/react/hooks/index.d.cts +22 -0
- package/react/hooks/index.d.cts.map +1 -0
- package/react/hooks/index.d.ts +21 -21
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +21 -21
- package/react/hooks/use-abort-controller.cjs +15 -0
- package/react/hooks/use-abort-controller.d.cts +2 -0
- package/react/hooks/use-abort-controller.d.cts.map +1 -0
- package/react/hooks/use-abort-controller.js +1 -1
- package/react/hooks/use-abort-signal.cjs +8 -0
- package/react/hooks/use-abort-signal.d.cts +2 -0
- package/react/hooks/use-abort-signal.d.cts.map +1 -0
- package/react/hooks/use-abort-signal.js +1 -1
- package/react/hooks/use-click-outside.cjs +17 -0
- package/react/hooks/use-click-outside.d.cts +9 -0
- package/react/hooks/use-click-outside.d.cts.map +1 -0
- package/react/hooks/use-click-outside.js +1 -1
- package/react/hooks/use-constant.cjs +19 -0
- package/react/hooks/use-constant.d.cts +9 -0
- package/react/hooks/use-constant.d.cts.map +1 -0
- package/react/hooks/use-define-ref.cjs +19 -0
- package/react/hooks/use-define-ref.d.cts +10 -0
- package/react/hooks/use-define-ref.d.cts.map +1 -0
- package/react/hooks/use-element-ref.cjs +12 -0
- package/react/hooks/use-element-ref.d.cts +2 -0
- package/react/hooks/use-element-ref.d.cts.map +1 -0
- package/react/hooks/use-event-listener.cjs +17 -0
- package/react/hooks/use-event-listener.d.cts +8 -0
- package/react/hooks/use-event-listener.d.cts.map +1 -0
- package/react/hooks/use-event-listener.js +1 -1
- package/react/hooks/use-event.cjs +23 -0
- package/react/hooks/use-event.d.cts +3 -0
- package/react/hooks/use-event.d.cts.map +1 -0
- package/react/hooks/use-event.d.ts +1 -1
- package/react/hooks/use-event.d.ts.map +1 -1
- package/react/hooks/use-flag.cjs +19 -0
- package/react/hooks/use-flag.d.cts +8 -0
- package/react/hooks/use-flag.d.cts.map +1 -0
- package/react/hooks/use-force-update.cjs +11 -0
- package/react/hooks/use-force-update.d.cts +2 -0
- package/react/hooks/use-force-update.d.cts.map +1 -0
- package/react/hooks/use-initial-height.cjs +15 -0
- package/react/hooks/use-initial-height.d.cts +5 -0
- package/react/hooks/use-initial-height.d.cts.map +1 -0
- package/react/hooks/use-instance.cjs +31 -0
- package/react/hooks/use-instance.d.cts +27 -0
- package/react/hooks/use-instance.d.cts.map +1 -0
- package/react/hooks/use-instance.js +2 -2
- package/react/hooks/use-intersection-observer.cjs +14 -0
- package/react/hooks/use-intersection-observer.d.cts +2 -0
- package/react/hooks/use-intersection-observer.d.cts.map +1 -0
- package/react/hooks/use-last-defined-value.cjs +12 -0
- package/react/hooks/use-last-defined-value.d.cts +2 -0
- package/react/hooks/use-last-defined-value.d.cts.map +1 -0
- package/react/hooks/use-last-value-ref.cjs +12 -0
- package/react/hooks/use-last-value-ref.d.cts +2 -0
- package/react/hooks/use-last-value-ref.d.cts.map +1 -0
- package/react/hooks/use-life-cycle.cjs +14 -0
- package/react/hooks/use-life-cycle.d.cts +5 -0
- package/react/hooks/use-life-cycle.d.cts.map +1 -0
- package/react/hooks/use-life-cycle.js +1 -1
- package/react/hooks/use-resize-observer.cjs +15 -0
- package/react/hooks/use-resize-observer.d.cts +2 -0
- package/react/hooks/use-resize-observer.d.cts.map +1 -0
- package/react/hooks/use-resize-observer.js +1 -1
- package/react/hooks/use-sync-ref.cjs +10 -0
- package/react/hooks/use-sync-ref.d.cts +2 -0
- package/react/hooks/use-sync-ref.d.cts.map +1 -0
- package/react/hooks/use-toggle.cjs +10 -0
- package/react/hooks/use-toggle.d.cts +2 -0
- package/react/hooks/use-toggle.d.cts.map +1 -0
- package/react/hooks/use-value.cjs +12 -0
- package/react/hooks/use-value.d.cts +5 -0
- package/react/hooks/use-value.d.cts.map +1 -0
- package/react/hooks/use-visibility-state.cjs +18 -0
- package/react/hooks/use-visibility-state.d.cts +2 -0
- package/react/hooks/use-visibility-state.d.cts.map +1 -0
- package/react/index.cjs +17 -0
- package/react/index.d.cts +2 -0
- package/react/index.d.cts.map +1 -0
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -1
- package/sound.cjs +16 -0
- package/sound.d.cts +7 -0
- package/sound.d.cts.map +1 -0
- package/storage.cjs +48 -0
- package/storage.d.cts +39 -0
- package/storage.d.cts.map +1 -0
- package/text.cjs +53 -0
- package/text.d.cts +15 -0
- package/text.d.cts.map +1 -0
- package/type-guard/_exports.cjs +129 -0
- package/type-guard/_exports.d.cts +86 -0
- package/type-guard/_exports.d.cts.map +1 -0
- package/type-guard/_exports.d.ts +1 -1
- package/type-guard/_exports.d.ts.map +1 -1
- package/type-guard/index.cjs +40 -0
- package/type-guard/index.d.cts +3 -0
- package/type-guard/index.d.cts.map +1 -0
- package/type-guard/index.d.ts +1 -1
- package/type-guard/index.d.ts.map +1 -1
- package/type-guard/index.js +1 -1
- package/utility-types.d.ts +1 -0
- package/utils/types.cjs +2 -0
- package/utils/types.d.cts +395 -0
- package/utils/types.d.cts.map +1 -0
- package/vibrate.cjs +12 -0
- package/vibrate.d.cts +5 -0
- package/vibrate.d.cts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-element-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-element-ref.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,WAAW,EAAE,UAAU,MAAM,CAAC,oDAQrE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEventListener = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const use_sync_ref_js_1 = require("./use-sync-ref.cjs");
|
|
7
|
+
const useEventListener = ({ event, handler, options, deps = [], node = document, }) => {
|
|
8
|
+
const handlerRef = (0, use_sync_ref_js_1.useSyncRef)(handler);
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
const handleEvent = (e) => handlerRef.current(e);
|
|
11
|
+
// @ts-expect-error
|
|
12
|
+
node.addEventListener(event, handleEvent, options);
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
return () => node.removeEventListener(event, handleEvent, options);
|
|
15
|
+
}, deps);
|
|
16
|
+
};
|
|
17
|
+
exports.useEventListener = useEventListener;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useEventListener: <EventName extends keyof HTMLElementEventMap>({ event, handler, options, deps, node, }: {
|
|
2
|
+
event: EventName;
|
|
3
|
+
handler: (e: HTMLElementEventMap[EventName]) => void;
|
|
4
|
+
options?: boolean | AddEventListenerOptions;
|
|
5
|
+
deps?: unknown[];
|
|
6
|
+
node?: HTMLElement | Document | Window;
|
|
7
|
+
}) => void;
|
|
8
|
+
//# sourceMappingURL=use-event-listener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-event-listener.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event-listener.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,GAAI,SAAS,SAAS,MAAM,mBAAmB,EAAE,0CAM3E;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,CAAC,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC5C,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;CACxC,SAYA,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { useSyncRef } from
|
|
3
|
+
import { useSyncRef } from "./use-sync-ref.js";
|
|
4
4
|
export const useEventListener = ({ event, handler, options, deps = [], node = document, }) => {
|
|
5
5
|
const handlerRef = useSyncRef(handler);
|
|
6
6
|
useEffect(() => {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEvent = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A Hook to define an event handler with an always-stable function identity.
|
|
6
|
+
*
|
|
7
|
+
* borrowed from @gaeron
|
|
8
|
+
* https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
|
|
9
|
+
*/
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const useEvent = (handler) => {
|
|
12
|
+
const handlerRef = (0, react_1.useRef)(handler);
|
|
13
|
+
// In a real implementation, this would run before layout effects
|
|
14
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
15
|
+
handlerRef.current = handler;
|
|
16
|
+
});
|
|
17
|
+
return (0, react_1.useCallback)((...args) => {
|
|
18
|
+
// In a real implementation, this would throw if called during render
|
|
19
|
+
const fn = handlerRef.current;
|
|
20
|
+
return fn(...args);
|
|
21
|
+
}, []);
|
|
22
|
+
};
|
|
23
|
+
exports.useEvent = useEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-event.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA6B;AAExD,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,SAAS,CAAC,KAAG,CAa5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-event.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"use-event.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-event.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA6B;AAExD,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,WAAW,EAAE,SAAS,CAAC,KAAG,CAa5D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFlag = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useFlag = (defaultValue = false) => {
|
|
6
|
+
const [enabled, setEnabled] = (0, react_1.useState)(defaultValue);
|
|
7
|
+
const toggle = (0, react_1.useCallback)(() => setEnabled((value) => !value), []);
|
|
8
|
+
const enable = (0, react_1.useCallback)(() => setEnabled(true), []);
|
|
9
|
+
const disable = (0, react_1.useCallback)(() => setEnabled(false), []);
|
|
10
|
+
const flagObjRef = (0, react_1.useRef)({
|
|
11
|
+
enabled,
|
|
12
|
+
toggle,
|
|
13
|
+
enable,
|
|
14
|
+
disable,
|
|
15
|
+
});
|
|
16
|
+
flagObjRef.current.enabled = enabled;
|
|
17
|
+
return flagObjRef.current;
|
|
18
|
+
};
|
|
19
|
+
exports.useFlag = useFlag;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-flag.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-flag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,sBAAoB,KAAG,QAiB9C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useForceUpdate = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useForceUpdate = () => {
|
|
6
|
+
const [, setState] = (0, react_1.useState)(null);
|
|
7
|
+
return (0, react_1.useCallback)(() => {
|
|
8
|
+
setState({});
|
|
9
|
+
}, []);
|
|
10
|
+
};
|
|
11
|
+
exports.useForceUpdate = useForceUpdate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-force-update.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-force-update.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,kBAM1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInitialHeight = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useInitialHeight = () => {
|
|
6
|
+
const ref = (0, react_1.useRef)(null);
|
|
7
|
+
const [initialHeight, setInitialHeight] = (0, react_1.useState)(undefined);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if (ref.current && !initialHeight) {
|
|
10
|
+
setInitialHeight(ref.current.offsetHeight);
|
|
11
|
+
}
|
|
12
|
+
}, [initialHeight]);
|
|
13
|
+
return { ref, initialHeight };
|
|
14
|
+
};
|
|
15
|
+
exports.useInitialHeight = useInitialHeight;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-initial-height.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-initial-height.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,WAAW;;;CAarD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInstance = exports.createUseInstanceHook = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_abort_signal_js_1 = require("./use-abort-signal.cjs");
|
|
6
|
+
const use_constant_js_1 = require("./use-constant.cjs");
|
|
7
|
+
const createUseInstanceHook = (extension) => (factory, config) => {
|
|
8
|
+
const abortSignal = (0, use_abort_signal_js_1.useAbortSignal)();
|
|
9
|
+
const instance = (0, use_constant_js_1.useConstant)(() => factory({
|
|
10
|
+
...extension,
|
|
11
|
+
abortSignal,
|
|
12
|
+
payload: config?.payload,
|
|
13
|
+
}));
|
|
14
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
15
|
+
config?.onUpdate?.(config.payload);
|
|
16
|
+
}, [config?.payload]);
|
|
17
|
+
return instance;
|
|
18
|
+
};
|
|
19
|
+
exports.createUseInstanceHook = createUseInstanceHook;
|
|
20
|
+
/**
|
|
21
|
+
* The `useInstance` hook is used to create and manage an instance of an object
|
|
22
|
+
* that requires access to the root store and an abort signal.
|
|
23
|
+
*
|
|
24
|
+
* You can create YOUR OWN CUSTOM `useInstance` hook using `createUseInstanceHook` if you need
|
|
25
|
+
* to provide some specific data
|
|
26
|
+
*
|
|
27
|
+
* @param factory - A factory function that takes a configuration and returns an instance.
|
|
28
|
+
* @param config - An optional configuration containing additional input parameters and an update function.
|
|
29
|
+
* @returns An instance created by the factory function.
|
|
30
|
+
*/
|
|
31
|
+
exports.useInstance = (0, exports.createUseInstanceHook)();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type InstanceCreateConfig<TPayload, TExtension = {}> = TExtension & {
|
|
2
|
+
abortSignal: AbortSignal;
|
|
3
|
+
payload: TPayload;
|
|
4
|
+
};
|
|
5
|
+
export declare const createUseInstanceHook: <TExtension = {}>(extension?: TExtension) => <TInstance, TPayload>(factory: (config: InstanceCreateConfig<NoInfer<TPayload>, TExtension>) => TInstance, config?: {
|
|
6
|
+
payload?: TPayload;
|
|
7
|
+
onUpdate?: (payload: TPayload) => void;
|
|
8
|
+
}) => TInstance;
|
|
9
|
+
/**
|
|
10
|
+
* The `useInstance` hook is used to create and manage an instance of an object
|
|
11
|
+
* that requires access to the root store and an abort signal.
|
|
12
|
+
*
|
|
13
|
+
* You can create YOUR OWN CUSTOM `useInstance` hook using `createUseInstanceHook` if you need
|
|
14
|
+
* to provide some specific data
|
|
15
|
+
*
|
|
16
|
+
* @param factory - A factory function that takes a configuration and returns an instance.
|
|
17
|
+
* @param config - An optional configuration containing additional input parameters and an update function.
|
|
18
|
+
* @returns An instance created by the factory function.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useInstance: <TInstance, TPayload>(factory: (config: {
|
|
21
|
+
abortSignal: AbortSignal;
|
|
22
|
+
payload: NoInfer<TPayload>;
|
|
23
|
+
}) => TInstance, config?: {
|
|
24
|
+
payload?: TPayload | undefined;
|
|
25
|
+
onUpdate?: ((payload: TPayload) => void) | undefined;
|
|
26
|
+
} | undefined) => TInstance;
|
|
27
|
+
//# sourceMappingURL=use-instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instance.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-instance.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,CAAC,QAAQ,EAAE,UAAU,GAAG,EAAE,IAAI,UAAU,GAAG;IACzE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAC/B,UAAU,GAAG,EAAE,EAAE,YAAY,UAAU,MACvC,SAAS,EAAE,QAAQ,EAClB,SAAS,CACP,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,KACxD,SAAS,EACd,SAAS;IACP,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACxC,cAiBF,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GArCrB,SAAS,EAAE,QAAQ;iBANP,WAAW;;;;uCAYc,IAAI;2BA+BM,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect } from 'react';
|
|
2
|
-
import { useAbortSignal } from
|
|
3
|
-
import { useConstant } from
|
|
2
|
+
import { useAbortSignal } from "./use-abort-signal.js";
|
|
3
|
+
import { useConstant } from "./use-constant.js";
|
|
4
4
|
export const createUseInstanceHook = (extension) => (factory, config) => {
|
|
5
5
|
const abortSignal = useAbortSignal();
|
|
6
6
|
const instance = useConstant(() => factory({
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIntersectionObserver = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useIntersectionObserver = (callback, options) => {
|
|
6
|
+
const [intersectionObserver] = (0, react_1.useState)(() => new IntersectionObserver(callback, options));
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
return () => {
|
|
9
|
+
intersectionObserver.disconnect();
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
return intersectionObserver;
|
|
13
|
+
};
|
|
14
|
+
exports.useIntersectionObserver = useIntersectionObserver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-intersection-observer.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-intersection-observer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,GAClC,UAAU,4BAA4B,EACtC,UAAU,wBAAwB,yBAanC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLastDefinedValue = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useLastDefinedValue = (value) => {
|
|
6
|
+
const ref = (0, react_1.useRef)(value);
|
|
7
|
+
if (value != null) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
return ref.current;
|
|
11
|
+
};
|
|
12
|
+
exports.useLastDefinedValue = useLastDefinedValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-last-defined-value.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-last-defined-value.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAI,CAAC,EAAE,OAAO,CAAC,MAM9C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLastValueRef = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useLastValueRef = (value) => {
|
|
6
|
+
const ref = (0, react_1.useRef)(value);
|
|
7
|
+
if (value != null) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
return ref;
|
|
11
|
+
};
|
|
12
|
+
exports.useLastValueRef = useLastValueRef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-last-value-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-last-value-ref.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,2DAQ7D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLifeCycle = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_sync_ref_js_1 = require("./use-sync-ref.cjs");
|
|
6
|
+
const useLifeCycle = (fn) => {
|
|
7
|
+
const fnRef = (0, use_sync_ref_js_1.useSyncRef)(fn);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
const fnOperation = fnRef.current();
|
|
10
|
+
fnOperation.mount?.();
|
|
11
|
+
return fnOperation.unmount?.();
|
|
12
|
+
}, []);
|
|
13
|
+
};
|
|
14
|
+
exports.useLifeCycle = useLifeCycle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-life-cycle.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-life-cycle.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM;IACR,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,SASF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useResizeObserver = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_define_ref_js_1 = require("./use-define-ref.cjs");
|
|
6
|
+
const useResizeObserver = (callback) => {
|
|
7
|
+
const resizeObserverRef = (0, use_define_ref_js_1.useDefineRef)(() => new ResizeObserver(callback));
|
|
8
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
9
|
+
return () => {
|
|
10
|
+
resizeObserverRef.current.disconnect();
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
return resizeObserverRef;
|
|
14
|
+
};
|
|
15
|
+
exports.useResizeObserver = useResizeObserver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-resize-observer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAAI,UAAU,sBAAsB,qDAUjE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useLayoutEffect } from 'react';
|
|
2
|
-
import { useDefineRef } from
|
|
2
|
+
import { useDefineRef } from "./use-define-ref.js";
|
|
3
3
|
export const useResizeObserver = (callback) => {
|
|
4
4
|
const resizeObserverRef = useDefineRef(() => new ResizeObserver(callback));
|
|
5
5
|
useLayoutEffect(() => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSyncRef = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useSyncRef = (value) => {
|
|
6
|
+
const ref = (0, react_1.useRef)(value);
|
|
7
|
+
ref.current = value;
|
|
8
|
+
return ref;
|
|
9
|
+
};
|
|
10
|
+
exports.useSyncRef = useSyncRef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-ref.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-sync-ref.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,OAAO,CAAC,wCAIrC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useToggle = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useToggle = (initialState) => {
|
|
6
|
+
const [toggled, setToggled] = (0, react_1.useState)(!!initialState);
|
|
7
|
+
const toggle = (0, react_1.useCallback)(() => setToggled((toggled) => !toggled), []);
|
|
8
|
+
return [toggled, toggle, setToggled];
|
|
9
|
+
};
|
|
10
|
+
exports.useToggle = useToggle;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-toggle.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-toggle.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,eAAe,OAAO,sGAM/C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useValue = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useValue = (defaults) => {
|
|
6
|
+
const [value, setValue] = (0, react_1.useState)(defaults);
|
|
7
|
+
return {
|
|
8
|
+
value,
|
|
9
|
+
set: setValue,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.useValue = useValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-value.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-value.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;;;CAOlD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useVisibilityState = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useVisibilityState = () => {
|
|
6
|
+
const [state, setState] = (0, react_1.useState)();
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
const handleVisibilityChange = () => {
|
|
9
|
+
setState(document.visibilityState);
|
|
10
|
+
};
|
|
11
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
12
|
+
return () => {
|
|
13
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
14
|
+
};
|
|
15
|
+
}, []);
|
|
16
|
+
return state;
|
|
17
|
+
};
|
|
18
|
+
exports.useVisibilityState = useVisibilityState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visibility-state.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-visibility-state.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,2CAgB9B,CAAC"}
|
package/react/index.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./hooks/index.cjs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,kCAAiC"}
|
package/react/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./hooks/index.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/react/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,iCAAiC"}
|
package/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./hooks/index.js";
|
package/sound.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.playSound = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Воспроизводит звук из файла
|
|
6
|
+
*/
|
|
7
|
+
const playSound = async (file, { volume = 1 } = {}) => {
|
|
8
|
+
let audio = new Audio(file);
|
|
9
|
+
audio.volume = volume;
|
|
10
|
+
audio.muted = !volume;
|
|
11
|
+
await audio.play();
|
|
12
|
+
audio.remove();
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
audio = null;
|
|
15
|
+
};
|
|
16
|
+
exports.playSound = playSound;
|
package/sound.d.cts
ADDED
package/sound.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../src/sound.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,aAAgB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,kBASzC,CAAC"}
|
package/storage.cjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStorageKey = void 0;
|
|
4
|
+
exports.createStorage = createStorage;
|
|
5
|
+
const storages = {
|
|
6
|
+
session: sessionStorage,
|
|
7
|
+
local: localStorage,
|
|
8
|
+
};
|
|
9
|
+
const createStorageKey = (prefix, key, namespace) => `${prefix}${namespace ? `/${namespace}` : ''}/${key}`;
|
|
10
|
+
exports.createStorageKey = createStorageKey;
|
|
11
|
+
const parseStorageValue = (value) => {
|
|
12
|
+
if (typeof value !== 'string') {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(value);
|
|
17
|
+
return parsed;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const formatValueToStorage = (value) => {
|
|
24
|
+
return JSON.stringify(value);
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Создает интерфейс для работы с хранилищем (localStorage, sessionStorage)
|
|
28
|
+
*/
|
|
29
|
+
function createStorage(storageConfig) {
|
|
30
|
+
return {
|
|
31
|
+
set: (cfg) => {
|
|
32
|
+
const config = cfg;
|
|
33
|
+
const storageType = (config.type ?? storageConfig.type);
|
|
34
|
+
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
35
|
+
const storage = storages[storageType];
|
|
36
|
+
storage.setItem((0, exports.createStorageKey)(storagePrefix, config.key, config.namespace), formatValueToStorage(config.value));
|
|
37
|
+
},
|
|
38
|
+
get: (cfg) => {
|
|
39
|
+
const config = cfg;
|
|
40
|
+
const storageType = (config.type ?? storageConfig.type);
|
|
41
|
+
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
42
|
+
const storage = storages[storageType];
|
|
43
|
+
return (parseStorageValue(storage.getItem((0, exports.createStorageKey)(storagePrefix, config.key, config.namespace))) ??
|
|
44
|
+
config.fallback ??
|
|
45
|
+
null);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|