solid-tiny-utils 0.10.0 → 0.12.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/dist/{jsx → dom}/attrs.d.mts +1 -1
- package/dist/{jsx → dom}/attrs.mjs +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.mjs +16 -16
- package/dist/{event → solidjs}/create-click-outside.d.mts +1 -1
- package/dist/{event → solidjs}/create-click-outside.mjs +2 -2
- package/dist/{reactive → solidjs}/create-debounce-watch.d.mts +1 -1
- package/dist/{reactive → solidjs}/create-debounce-watch.mjs +2 -2
- package/dist/{fn → solidjs}/create-debounce.d.mts +1 -1
- package/dist/{fn → solidjs}/create-debounce.mjs +2 -2
- package/dist/{event → solidjs}/create-event-listener.d.mts +1 -1
- package/dist/{event → solidjs}/create-event-listener.mjs +4 -5
- package/dist/{event → solidjs}/create-intersection-observer.d.mts +1 -1
- package/dist/{event → solidjs}/create-intersection-observer.mjs +4 -4
- package/dist/solidjs/create-list.d.mts +14 -0
- package/dist/solidjs/create-list.mjs +77 -0
- package/dist/{fn → solidjs}/create-loop-exec.d.mts +1 -1
- package/dist/{fn → solidjs}/create-loop-exec.mjs +3 -3
- package/dist/solidjs/create-presence.d.mts +22 -0
- package/dist/solidjs/create-presence.mjs +89 -0
- package/dist/{fn → solidjs}/create-throttle.d.mts +1 -1
- package/dist/{fn → solidjs}/create-throttle.mjs +2 -2
- package/dist/{event → solidjs}/create-visibility-observer.d.mts +1 -1
- package/dist/{event → solidjs}/create-visibility-observer.mjs +3 -3
- package/dist/{reactive → solidjs}/create-watch.d.mts +1 -1
- package/dist/{reactive → solidjs}/create-watch.mjs +1 -1
- package/dist/solidjs/index.d.mts +13 -0
- package/dist/{event → solidjs}/make-event-listener.d.mts +1 -1
- package/dist/{event → solidjs}/make-event-listener.mjs +2 -2
- package/dist/solidjs/utils.d.mts +10 -0
- package/dist/solidjs/utils.mjs +23 -0
- package/dist/utils/constant.d.mts +4 -0
- package/dist/utils/constant.mjs +5 -0
- package/dist/utils/is.mjs +1 -1
- package/package.json +22 -15
- package/dist/event/create-presence.d.mts +0 -14
- package/dist/event/create-presence.mjs +0 -32
- package/dist/event/index.d.mts +0 -12
- package/dist/event/index.mjs +0 -15
- package/dist/fn/index.d.mts +0 -8
- package/dist/fn/index.mjs +0 -9
- package/dist/reactive/access.d.mts +0 -6
- package/dist/reactive/access.mjs +0 -9
- package/dist/reactive/index.d.mts +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -2,30 +2,30 @@ import { OKLCH, RGB, oklchToRgb, rgbToOklch } from "./color/oklch-rgb.mjs";
|
|
|
2
2
|
import { hexToRgb, rgbToHex } from "./color/hex-rgb.mjs";
|
|
3
3
|
import { isValidHex, isValidOKLCH, isValidRGB } from "./color/validation.mjs";
|
|
4
4
|
import { hasAnimation } from "./dom/animation.mjs";
|
|
5
|
+
import { dataIf } from "./dom/attrs.mjs";
|
|
5
6
|
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
6
7
|
import { AnyFn, Fn } from "./types/fn.mjs";
|
|
7
8
|
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./types/maybe.mjs";
|
|
8
9
|
import "./types/index.mjs";
|
|
9
|
-
import { createClickOutside } from "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { createThrottle } from "./
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { access } from "./
|
|
22
|
-
import
|
|
23
|
-
import { createWatch } from "./reactive/create-watch.mjs";
|
|
24
|
-
import "./reactive/index.mjs";
|
|
10
|
+
import { createClickOutside } from "./solidjs/create-click-outside.mjs";
|
|
11
|
+
import { createDebounce } from "./solidjs/create-debounce.mjs";
|
|
12
|
+
import { createDebouncedWatch } from "./solidjs/create-debounce-watch.mjs";
|
|
13
|
+
import { DocumentEventName, GeneralEventListener, WindowEventName, makeEventListener } from "./solidjs/make-event-listener.mjs";
|
|
14
|
+
import { createEventListener } from "./solidjs/create-event-listener.mjs";
|
|
15
|
+
import { createIntersectionObserver } from "./solidjs/create-intersection-observer.mjs";
|
|
16
|
+
import { createList } from "./solidjs/create-list.mjs";
|
|
17
|
+
import { createLoopExec } from "./solidjs/create-loop-exec.mjs";
|
|
18
|
+
import { MakePresenceOptions, PresencePhase, createPresence } from "./solidjs/create-presence.mjs";
|
|
19
|
+
import { createThrottle } from "./solidjs/create-throttle.mjs";
|
|
20
|
+
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./solidjs/create-visibility-observer.mjs";
|
|
21
|
+
import { createWatch } from "./solidjs/create-watch.mjs";
|
|
22
|
+
import { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
23
|
+
import "./solidjs/index.mjs";
|
|
25
24
|
import { clearArray, iterate, list, range } from "./utils/array.mjs";
|
|
26
25
|
import { runAtNextAnimationFrame, sleep } from "./utils/async.mjs";
|
|
26
|
+
import { noop } from "./utils/constant.mjs";
|
|
27
27
|
import { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined } from "./utils/is.mjs";
|
|
28
28
|
import { clamp, inRange, max, min, toHex } from "./utils/number.mjs";
|
|
29
29
|
import { draw, random, shuffle, uid } from "./utils/random.mjs";
|
|
30
30
|
import { camel, capitalize, dash, pascal, snake, template, title, trim } from "./utils/str.mjs";
|
|
31
|
-
export { AnyFn, CreateVisibilityObserverOption, DocumentEventName, EntryCallback, Fn, GeneralEventListener, MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise, OKLCH,
|
|
31
|
+
export { AnyFn, CreateVisibilityObserverOption, DocumentEventName, EntryCallback, Fn, GeneralEventListener, MakePresenceOptions, MaybeAccessor, MaybeArray, MaybeCallableChild, MaybeNullableAccessor, MaybePromise, OKLCH, PresencePhase, RGB, UseVisibilityObserverFn, WindowEventName, access, callMaybeCallableChild, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEventListener, createIntersectionObserver, createList, createLoopExec, createPresence, createThrottle, createVisibilityObserver, createWatch, dash, dataIf, draw, hasAnimation, hexToRgb, inRange, isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined, isValidHex, isValidOKLCH, isValidRGB, iterate, list, makeEventListener, max, min, mountStyle, noop, oklchToRgb, pascal, random, range, rgbToHex, rgbToOklch, runAtNextAnimationFrame, runSolidEventHandler, shuffle, sleep, snake, stringStyleToObject, template, title, toHex, trim, uid };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined } from "./utils/is.mjs";
|
|
2
2
|
import { clearArray, iterate, list, range } from "./utils/array.mjs";
|
|
3
3
|
import { runAtNextAnimationFrame, sleep } from "./utils/async.mjs";
|
|
4
|
+
import { noop } from "./utils/constant.mjs";
|
|
4
5
|
import { clamp, inRange, max, min, toHex } from "./utils/number.mjs";
|
|
5
6
|
import { draw, random, shuffle, uid } from "./utils/random.mjs";
|
|
6
7
|
import { camel, capitalize, dash, pascal, snake, template, title, trim } from "./utils/str.mjs";
|
|
@@ -8,21 +9,20 @@ import { hexToRgb, rgbToHex } from "./color/hex-rgb.mjs";
|
|
|
8
9
|
import { oklchToRgb, rgbToOklch } from "./color/oklch-rgb.mjs";
|
|
9
10
|
import { isValidHex, isValidOKLCH, isValidRGB } from "./color/validation.mjs";
|
|
10
11
|
import { hasAnimation } from "./dom/animation.mjs";
|
|
12
|
+
import { dataIf } from "./dom/attrs.mjs";
|
|
11
13
|
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { createVisibilityObserver } from "./
|
|
25
|
-
import { runSolidEventHandler } from "./event/index.mjs";
|
|
26
|
-
import { dataIf } from "./jsx/attrs.mjs";
|
|
14
|
+
import { makeEventListener } from "./solidjs/make-event-listener.mjs";
|
|
15
|
+
import { access, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
16
|
+
import { createClickOutside } from "./solidjs/create-click-outside.mjs";
|
|
17
|
+
import { createDebounce } from "./solidjs/create-debounce.mjs";
|
|
18
|
+
import { createWatch } from "./solidjs/create-watch.mjs";
|
|
19
|
+
import { createDebouncedWatch } from "./solidjs/create-debounce-watch.mjs";
|
|
20
|
+
import { createEventListener } from "./solidjs/create-event-listener.mjs";
|
|
21
|
+
import { createIntersectionObserver } from "./solidjs/create-intersection-observer.mjs";
|
|
22
|
+
import { createList } from "./solidjs/create-list.mjs";
|
|
23
|
+
import { createLoopExec } from "./solidjs/create-loop-exec.mjs";
|
|
24
|
+
import { createPresence } from "./solidjs/create-presence.mjs";
|
|
25
|
+
import { createThrottle } from "./solidjs/create-throttle.mjs";
|
|
26
|
+
import { createVisibilityObserver } from "./solidjs/create-visibility-observer.mjs";
|
|
27
27
|
|
|
28
|
-
export { access, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEventListener, createIntersectionObserver, createLoopExec, createPresence, createThrottle, createVisibilityObserver, createWatch, dash, dataIf, draw, hasAnimation, hexToRgb, inRange, isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined, isValidHex, isValidOKLCH, isValidRGB, iterate, list, makeEventListener, max, min, mountStyle, noop, oklchToRgb, pascal, random, range, rgbToHex, rgbToOklch, runAtNextAnimationFrame, runSolidEventHandler, shuffle, sleep, snake, stringStyleToObject, template, title, toHex, trim, uid };
|
|
28
|
+
export { access, callMaybeCallableChild, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEventListener, createIntersectionObserver, createList, createLoopExec, createPresence, createThrottle, createVisibilityObserver, createWatch, dash, dataIf, draw, hasAnimation, hexToRgb, inRange, isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined, isValidHex, isValidOKLCH, isValidRGB, iterate, list, makeEventListener, max, min, mountStyle, noop, oklchToRgb, pascal, random, range, rgbToHex, rgbToOklch, runAtNextAnimationFrame, runSolidEventHandler, shuffle, sleep, snake, stringStyleToObject, template, title, toHex, trim, uid };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
2
|
import "../types/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-click-outside.d.ts
|
|
5
5
|
declare function createClickOutside(target: MaybeAccessor<HTMLElement | null | undefined>, handler: (event: PointerEvent) => void, options?: {
|
|
6
6
|
ignore?: MaybeAccessor<HTMLElement | null | undefined>[];
|
|
7
7
|
}): () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { access } from "../reactive/access.mjs";
|
|
2
1
|
import { makeEventListener } from "./make-event-listener.mjs";
|
|
2
|
+
import { access } from "./utils.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-click-outside.ts
|
|
5
5
|
function createClickOutside(target, handler, options) {
|
|
6
6
|
let shouldListen = false;
|
|
7
7
|
const shouldIgnore = (event) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createDebounce } from "
|
|
1
|
+
import { createDebounce } from "./create-debounce.mjs";
|
|
2
2
|
import { createWatch } from "./create-watch.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-debounce-watch.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates a debounced watch effect.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
2
|
import "../types/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-debounce.d.ts
|
|
5
5
|
declare function createDebounce<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { createDebounce };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { access } from "
|
|
1
|
+
import { access } from "./utils.mjs";
|
|
2
2
|
import { onCleanup } from "solid-js";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-debounce.ts
|
|
5
5
|
function createDebounce(callback, delay) {
|
|
6
6
|
let timeoutId;
|
|
7
7
|
onCleanup(() => {
|
|
@@ -3,7 +3,7 @@ import { MaybeAccessor, MaybeArray } from "../types/maybe.mjs";
|
|
|
3
3
|
import "../types/index.mjs";
|
|
4
4
|
import { DocumentEventName, GeneralEventListener, WindowEventName } from "./make-event-listener.mjs";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/solidjs/create-event-listener.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Overload 2: Explicitly Window target
|
|
9
9
|
*/
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { isArray } from "../utils/is.mjs";
|
|
2
2
|
import { clearArray } from "../utils/array.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { noop } from "../fn/index.mjs";
|
|
5
|
-
import { createWatch } from "../reactive/create-watch.mjs";
|
|
3
|
+
import { noop } from "../utils/constant.mjs";
|
|
6
4
|
import { makeEventListener } from "./make-event-listener.mjs";
|
|
5
|
+
import { access } from "./utils.mjs";
|
|
6
|
+
import { createWatch } from "./create-watch.mjs";
|
|
7
7
|
|
|
8
|
-
//#region src/
|
|
9
|
-
/** biome-ignore-all lint/suspicious/noExplicitAny: I need any */
|
|
8
|
+
//#region src/solidjs/create-event-listener.ts
|
|
10
9
|
function createEventListener(...args) {
|
|
11
10
|
const target = args[0];
|
|
12
11
|
const events = args[1];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
2
|
import "../types/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-intersection-observer.d.ts
|
|
5
5
|
declare function createIntersectionObserver(targets: MaybeAccessor<HTMLElement | null | undefined>[], callback: IntersectionObserverCallback, options?: IntersectionObserverInit): () => void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { createIntersectionObserver };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { clearArray } from "../utils/array.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createWatch } from "
|
|
2
|
+
import { noop } from "../utils/constant.mjs";
|
|
3
|
+
import { access } from "./utils.mjs";
|
|
4
|
+
import { createWatch } from "./create-watch.mjs";
|
|
5
5
|
import { isServer } from "solid-js/web";
|
|
6
6
|
import { onCleanup } from "solid-js";
|
|
7
7
|
|
|
8
|
-
//#region src/
|
|
8
|
+
//#region src/solidjs/create-intersection-observer.ts
|
|
9
9
|
function createIntersectionObserver(targets, callback, options = {}) {
|
|
10
10
|
if (isServer) return noop;
|
|
11
11
|
const io = new IntersectionObserver(callback, options);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SetStoreFunction } from "solid-js/store";
|
|
2
|
+
|
|
3
|
+
//#region src/solidjs/create-list.d.ts
|
|
4
|
+
declare function createList<T>(initialValue?: T[]): readonly [T[], {
|
|
5
|
+
readonly setList: SetStoreFunction<T[]>;
|
|
6
|
+
readonly insert: (item: T, at?: number) => void;
|
|
7
|
+
readonly remove: (at?: number) => void;
|
|
8
|
+
readonly swap: (indexA: number, indexB: number) => void;
|
|
9
|
+
readonly move: (from: number, to: number) => void;
|
|
10
|
+
readonly sort: (compareFn: (a: T, b: T) => number) => void;
|
|
11
|
+
readonly isSortedBy: (compareFn: (a: T, b: T) => number) => boolean;
|
|
12
|
+
}];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createList };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { inRange } from "../utils/number.mjs";
|
|
2
|
+
import { createStore, unwrap } from "solid-js/store";
|
|
3
|
+
|
|
4
|
+
//#region src/solidjs/create-list.ts
|
|
5
|
+
function createInsertHelper(setList) {
|
|
6
|
+
return (item, at) => {
|
|
7
|
+
setList((list) => {
|
|
8
|
+
let atIdx = at ?? list.length;
|
|
9
|
+
if (atIdx < 0 || atIdx > list.length) atIdx = list.length;
|
|
10
|
+
const newList = [...list];
|
|
11
|
+
newList.splice(atIdx, 0, item);
|
|
12
|
+
return newList;
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createRemoveHelper(setList) {
|
|
17
|
+
return (at) => {
|
|
18
|
+
setList((list) => {
|
|
19
|
+
const atIdx = at ?? list.length - 1;
|
|
20
|
+
if (atIdx < 0 || atIdx >= list.length) return list;
|
|
21
|
+
const newList = [...list];
|
|
22
|
+
newList.splice(atIdx, 1);
|
|
23
|
+
return newList;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function createSwapHelper(setList) {
|
|
28
|
+
return (indexA, indexB) => {
|
|
29
|
+
setList((list) => {
|
|
30
|
+
if (indexA === indexB || !inRange(indexA, 0, list.length - 1) || !inRange(indexB, 0, list.length - 1)) return list;
|
|
31
|
+
const newList = [...list];
|
|
32
|
+
[newList[indexA], newList[indexB]] = [newList[indexB], newList[indexA]];
|
|
33
|
+
return newList;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createMoveHelper(setList) {
|
|
38
|
+
return (from, to) => {
|
|
39
|
+
setList((list) => {
|
|
40
|
+
if (from === to || !inRange(from, 0, list.length - 1) || !inRange(to, 0, list.length - 1)) return list;
|
|
41
|
+
const newList = [...list];
|
|
42
|
+
const [item] = newList.splice(from, 1);
|
|
43
|
+
newList.splice(to, 0, item);
|
|
44
|
+
return newList;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createSortHelper(setList) {
|
|
49
|
+
return (compareFn) => {
|
|
50
|
+
setList((list) => {
|
|
51
|
+
const newList = [...list];
|
|
52
|
+
newList.sort(compareFn);
|
|
53
|
+
return newList;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function createIsSortedHelper(list, compareFn) {
|
|
58
|
+
for (let i = 1; i < list.length; i++) if (compareFn(list[i - 1], list[i]) > 0) return false;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
function createList(initialValue) {
|
|
62
|
+
const [list, setList] = createStore(unwrap(initialValue) || []);
|
|
63
|
+
return [list, {
|
|
64
|
+
setList,
|
|
65
|
+
insert: createInsertHelper(setList),
|
|
66
|
+
remove: createRemoveHelper(setList),
|
|
67
|
+
swap: createSwapHelper(setList),
|
|
68
|
+
move: createMoveHelper(setList),
|
|
69
|
+
sort: createSortHelper(setList),
|
|
70
|
+
isSortedBy: (compareFn) => {
|
|
71
|
+
return createIsSortedHelper(list, compareFn);
|
|
72
|
+
}
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { createList };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isNumber } from "../utils/is.mjs";
|
|
2
|
-
import { access } from "
|
|
3
|
-
import { createWatch } from "
|
|
2
|
+
import { access } from "./utils.mjs";
|
|
3
|
+
import { createWatch } from "./create-watch.mjs";
|
|
4
4
|
import { onCleanup } from "solid-js";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/solidjs/create-loop-exec.ts
|
|
7
7
|
/**
|
|
8
8
|
* Repeatedly executes an asynchronous function with a specified delay between each execution.
|
|
9
9
|
* The loop continues until the surrounding SolidJS effect is cleaned up.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
3
|
+
import { Accessor } from "solid-js";
|
|
4
|
+
|
|
5
|
+
//#region src/solidjs/create-presence.d.ts
|
|
6
|
+
interface MakePresenceOptions {
|
|
7
|
+
enterDuration: MaybeAccessor<number>;
|
|
8
|
+
exitDuration: MaybeAccessor<number>;
|
|
9
|
+
initialEnter?: boolean;
|
|
10
|
+
}
|
|
11
|
+
type PresencePhase = "idle" | "pre-enter" | "entering" | "entered" | "exiting" | "exited";
|
|
12
|
+
declare function createPresence<TItem>(item: Accessor<TItem | undefined>, options: MakePresenceOptions): {
|
|
13
|
+
isMounted: () => boolean;
|
|
14
|
+
mountedItem: Accessor<TItem | undefined>;
|
|
15
|
+
isVisible: Accessor<boolean>;
|
|
16
|
+
isAnimating: Accessor<boolean>;
|
|
17
|
+
isEntering: Accessor<boolean>;
|
|
18
|
+
isExiting: Accessor<boolean>;
|
|
19
|
+
phase: Accessor<PresencePhase>;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { MakePresenceOptions, PresencePhase, createPresence };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { isDefined } from "../utils/is.mjs";
|
|
2
|
+
import { runAtNextAnimationFrame } from "../utils/async.mjs";
|
|
3
|
+
import { noop } from "../utils/constant.mjs";
|
|
4
|
+
import { access } from "./utils.mjs";
|
|
5
|
+
import { createWatch } from "./create-watch.mjs";
|
|
6
|
+
import { createEffect, createMemo, createSignal, onCleanup, untrack } from "solid-js";
|
|
7
|
+
|
|
8
|
+
//#region src/solidjs/create-presence.ts
|
|
9
|
+
function makeTimeout(ms, fn) {
|
|
10
|
+
if (ms() <= 0) {
|
|
11
|
+
fn();
|
|
12
|
+
return noop;
|
|
13
|
+
}
|
|
14
|
+
const timeoutId = setTimeout(() => {
|
|
15
|
+
fn();
|
|
16
|
+
}, ms());
|
|
17
|
+
return () => clearTimeout(timeoutId);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Animates the appearance of its children.
|
|
21
|
+
*
|
|
22
|
+
* @internal - to be combined with `createPresence` in the future
|
|
23
|
+
*/
|
|
24
|
+
function createPresenceBase(source, options) {
|
|
25
|
+
const enterDuration = () => access(options.enterDuration);
|
|
26
|
+
const exitDuration = () => access(options.exitDuration);
|
|
27
|
+
const initialSource = untrack(source);
|
|
28
|
+
let initialPhase = "idle";
|
|
29
|
+
if (initialSource) initialPhase = options.initialEnter ? "pre-enter" : "entered";
|
|
30
|
+
const [phase, setPhase] = createSignal(initialPhase);
|
|
31
|
+
let clear = noop;
|
|
32
|
+
onCleanup(clear);
|
|
33
|
+
createWatch(source, (visible) => {
|
|
34
|
+
setPhase((prev) => {
|
|
35
|
+
if (visible) {
|
|
36
|
+
if (prev === "idle" || prev === "exited") return "pre-enter";
|
|
37
|
+
return prev;
|
|
38
|
+
}
|
|
39
|
+
if (prev === "entered" || prev === "entering") return "exiting";
|
|
40
|
+
return prev;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
createWatch(phase, (currentPhase) => {
|
|
44
|
+
clear();
|
|
45
|
+
if (currentPhase === "pre-enter") runAtNextAnimationFrame(() => {
|
|
46
|
+
setPhase("entering");
|
|
47
|
+
});
|
|
48
|
+
if (currentPhase === "entering") clear = makeTimeout(enterDuration, () => setPhase("entered"));
|
|
49
|
+
if (currentPhase === "exiting") clear = makeTimeout(exitDuration, () => setPhase("exited"));
|
|
50
|
+
if (currentPhase === "exited") setPhase("idle");
|
|
51
|
+
});
|
|
52
|
+
const isVisible = createMemo(() => ["entering", "entered"].includes(phase()));
|
|
53
|
+
const isMounted = createMemo(() => phase() !== "idle");
|
|
54
|
+
const isExiting = createMemo(() => phase() === "exiting");
|
|
55
|
+
const isEntering = createMemo(() => phase() === "entering");
|
|
56
|
+
return {
|
|
57
|
+
isMounted,
|
|
58
|
+
isVisible,
|
|
59
|
+
isAnimating: createMemo(() => isEntering() || isExiting()),
|
|
60
|
+
isEntering,
|
|
61
|
+
isExiting,
|
|
62
|
+
phase
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const itemShouldBeMounted = (item) => item !== false && item != null;
|
|
66
|
+
function createPresence(item, options) {
|
|
67
|
+
const initial = untrack(item);
|
|
68
|
+
const [mountedItem, setMountedItem] = createSignal(initial);
|
|
69
|
+
const [shouldBeMounted, setShouldBeMounted] = createSignal(itemShouldBeMounted(initial));
|
|
70
|
+
const { isMounted, ...rest } = createPresenceBase(shouldBeMounted, options);
|
|
71
|
+
createEffect(() => {
|
|
72
|
+
if (mountedItem() !== item()) {
|
|
73
|
+
if (isMounted()) setShouldBeMounted(false);
|
|
74
|
+
else if (itemShouldBeMounted(item())) {
|
|
75
|
+
setMountedItem(() => item());
|
|
76
|
+
setShouldBeMounted(true);
|
|
77
|
+
}
|
|
78
|
+
} else if (!itemShouldBeMounted(item())) setShouldBeMounted(false);
|
|
79
|
+
else if (itemShouldBeMounted(item())) setShouldBeMounted(true);
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
...rest,
|
|
83
|
+
isMounted: () => isMounted() && isDefined(mountedItem()),
|
|
84
|
+
mountedItem
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { createPresence };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
2
|
import "../types/index.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-throttle.d.ts
|
|
5
5
|
declare function createThrottle<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { createThrottle };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { access } from "
|
|
1
|
+
import { access } from "./utils.mjs";
|
|
2
2
|
import { onCleanup } from "solid-js";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/solidjs/create-throttle.ts
|
|
5
5
|
function createThrottle(callback, delay) {
|
|
6
6
|
let timeoutId;
|
|
7
7
|
onCleanup(() => {
|
|
@@ -2,7 +2,7 @@ import { MaybeNullableAccessor } from "../types/maybe.mjs";
|
|
|
2
2
|
import "../types/index.mjs";
|
|
3
3
|
import { Accessor } from "solid-js";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/solidjs/create-visibility-observer.d.ts
|
|
6
6
|
type UseVisibilityObserverFn = (target: MaybeNullableAccessor<HTMLElement>) => Accessor<boolean>;
|
|
7
7
|
type CreateVisibilityObserverOption = IntersectionObserverInit & {
|
|
8
8
|
initialValue?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isObject } from "../utils/is.mjs";
|
|
2
|
-
import { access } from "
|
|
3
|
-
import { createWatch } from "
|
|
2
|
+
import { access } from "./utils.mjs";
|
|
3
|
+
import { createWatch } from "./create-watch.mjs";
|
|
4
4
|
import { createSignal, onCleanup } from "solid-js";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/solidjs/create-visibility-observer.ts
|
|
7
7
|
function createVisibilityObserver(arg1, arg2) {
|
|
8
8
|
let target;
|
|
9
9
|
let options;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Accessor, AccessorArray, OnEffectFunction, OnOptions } from "solid-js";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/solidjs/create-watch.d.ts
|
|
4
4
|
declare function createWatch<S, Next extends Prev, Prev = Next>(targets: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, opt?: OnOptions): void;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { createWatch };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createClickOutside } from "./create-click-outside.mjs";
|
|
2
|
+
import { createDebounce } from "./create-debounce.mjs";
|
|
3
|
+
import { createDebouncedWatch } from "./create-debounce-watch.mjs";
|
|
4
|
+
import { DocumentEventName, GeneralEventListener, WindowEventName, makeEventListener } from "./make-event-listener.mjs";
|
|
5
|
+
import { createEventListener } from "./create-event-listener.mjs";
|
|
6
|
+
import { createIntersectionObserver } from "./create-intersection-observer.mjs";
|
|
7
|
+
import { createList } from "./create-list.mjs";
|
|
8
|
+
import { createLoopExec } from "./create-loop-exec.mjs";
|
|
9
|
+
import { MakePresenceOptions, PresencePhase, createPresence } from "./create-presence.mjs";
|
|
10
|
+
import { createThrottle } from "./create-throttle.mjs";
|
|
11
|
+
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./create-visibility-observer.mjs";
|
|
12
|
+
import { createWatch } from "./create-watch.mjs";
|
|
13
|
+
import { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler } from "./utils.mjs";
|
|
@@ -2,7 +2,7 @@ import { Fn } from "../types/fn.mjs";
|
|
|
2
2
|
import { MaybeArray } from "../types/maybe.mjs";
|
|
3
3
|
import "../types/index.mjs";
|
|
4
4
|
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/solidjs/make-event-listener.d.ts
|
|
6
6
|
interface InferEventTarget<Events> {
|
|
7
7
|
addEventListener: (event: Events, fn?: any, options?: any) => any;
|
|
8
8
|
removeEventListener: (event: Events, fn?: any, options?: any) => any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isArray } from "../utils/is.mjs";
|
|
2
2
|
import { clearArray } from "../utils/array.mjs";
|
|
3
|
-
import { noop } from "../
|
|
3
|
+
import { noop } from "../utils/constant.mjs";
|
|
4
4
|
import { onCleanup } from "solid-js";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/solidjs/make-event-listener.ts
|
|
7
7
|
/** biome-ignore-all lint/suspicious/noExplicitAny: I need any */
|
|
8
8
|
function makeEventListener(...args) {
|
|
9
9
|
let target;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import { JSX } from "solid-js";
|
|
3
|
+
|
|
4
|
+
//#region src/solidjs/utils.d.ts
|
|
5
|
+
declare function access<T>(value: MaybeAccessor<T>): T;
|
|
6
|
+
declare function runSolidEventHandler<T, E extends Event, EHandler extends JSX.EventHandler<T, any> = JSX.EventHandler<T, E>>(event: E, handler?: EHandler | JSX.BoundEventHandler<T, E, EHandler>): void;
|
|
7
|
+
type MaybeCallableChild<T extends unknown[] = []> = JSX.Element | ((...args: T) => JSX.Element);
|
|
8
|
+
declare function callMaybeCallableChild<T extends unknown[] = []>(children: MaybeCallableChild<T>, ...args: T): JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isArray, isFn } from "../utils/is.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/solidjs/utils.ts
|
|
4
|
+
function access(value) {
|
|
5
|
+
return isFn(value) ? value() : value;
|
|
6
|
+
}
|
|
7
|
+
function runSolidEventHandler(event, handler) {
|
|
8
|
+
if (isFn(handler)) {
|
|
9
|
+
handler(event);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (isArray(handler)) {
|
|
13
|
+
const h = handler[0];
|
|
14
|
+
const data = handler[1];
|
|
15
|
+
h(data, event);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function callMaybeCallableChild(children, ...args) {
|
|
19
|
+
return isFn(children) ? children(...args) : children;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { access, callMaybeCallableChild, runSolidEventHandler };
|
package/dist/utils/is.mjs
CHANGED
|
@@ -21,7 +21,7 @@ const isPrimitive = (value) => {
|
|
|
21
21
|
return value === void 0 || value === null || typeof value !== "object" && typeof value !== "function";
|
|
22
22
|
};
|
|
23
23
|
const isFn = (value) => {
|
|
24
|
-
return
|
|
24
|
+
return typeof value === "function";
|
|
25
25
|
};
|
|
26
26
|
const isString = (value) => {
|
|
27
27
|
return typeof value === "string" || value instanceof String;
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-tiny-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A collection of tiny utilities for SolidJS applications",
|
|
5
|
-
"
|
|
5
|
+
"author": "solid tiny",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/solid-tiny/solid-tiny-utils#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/solid-tiny/solid-tiny-utils.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/solid-tiny/solid-tiny-utils/issues"
|
|
14
|
+
},
|
|
6
15
|
"type": "module",
|
|
7
16
|
"files": [
|
|
8
17
|
"dist"
|
|
@@ -12,24 +21,25 @@
|
|
|
12
21
|
"solid-js": "^1.9.7"
|
|
13
22
|
},
|
|
14
23
|
"devDependencies": {
|
|
15
|
-
"@biomejs/biome": "2.3.
|
|
24
|
+
"@biomejs/biome": "2.3.11",
|
|
25
|
+
"@formkit/auto-animate": "^0.9.0",
|
|
16
26
|
"@solidjs/router": "^0.15.4",
|
|
17
27
|
"@solidjs/testing-library": "^0.8.10",
|
|
18
28
|
"@testing-library/jest-dom": "^6.9.1",
|
|
19
29
|
"@testing-library/user-event": "^14.6.1",
|
|
20
30
|
"@types/culori": "^4.0.0",
|
|
21
31
|
"@types/node": "^25.0.3",
|
|
22
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
32
|
+
"@typescript/native-preview": "7.0.0-dev.20260114.1",
|
|
23
33
|
"@vitest/ui": "^4.0.16",
|
|
24
|
-
"bumpp": "^10.2
|
|
34
|
+
"bumpp": "^10.3.2",
|
|
25
35
|
"culori": "^4.0.2",
|
|
26
36
|
"jsdom": "^27.3.0",
|
|
27
37
|
"solid-tiny-context": "0.2.3",
|
|
28
|
-
"tsdown": "^0.
|
|
29
|
-
"ultracite": "
|
|
38
|
+
"tsdown": "^0.19.0",
|
|
39
|
+
"ultracite": "7.0.11",
|
|
30
40
|
"unocss": "^66.3.3",
|
|
31
41
|
"vite": "^7.3.0",
|
|
32
|
-
"vite-plugin-solid": "^2.11.
|
|
42
|
+
"vite-plugin-solid": "^2.11.10",
|
|
33
43
|
"vite-plugin-solid-pages": "^0.3.5",
|
|
34
44
|
"vitest": "^4.0.16"
|
|
35
45
|
},
|
|
@@ -40,9 +50,6 @@
|
|
|
40
50
|
"typescript",
|
|
41
51
|
"utils"
|
|
42
52
|
],
|
|
43
|
-
"author": "",
|
|
44
|
-
"license": "MIT",
|
|
45
|
-
"module": "./dist/index.mjs",
|
|
46
53
|
"types": "./dist/index.d.mts",
|
|
47
54
|
"exports": {
|
|
48
55
|
".": "./dist/index.mjs",
|
|
@@ -54,11 +61,11 @@
|
|
|
54
61
|
"test": "vitest --run",
|
|
55
62
|
"clean": "rimraf dist node_modules pnpm-lock.yaml",
|
|
56
63
|
"test:ui": "vitest --ui",
|
|
57
|
-
"lint": "pnpm
|
|
58
|
-
"lint:error": "pnpm
|
|
59
|
-
"lint:fix": "pnpm
|
|
64
|
+
"lint": "pnpm ultracite check",
|
|
65
|
+
"lint:error": "pnpm ultracite check --diagnostic-level error",
|
|
66
|
+
"lint:fix": "pnpm ultracite fix",
|
|
60
67
|
"type-check": "tsgo --noEmit --skipLibCheck",
|
|
61
|
-
"bump": "pnpm type-check && pnpm
|
|
68
|
+
"bump": "pnpm type-check && pnpm test && pnpm bumpp --no-push",
|
|
62
69
|
"prepublish": "pnpm build"
|
|
63
70
|
}
|
|
64
71
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import { Accessor } from "solid-js";
|
|
3
|
-
|
|
4
|
-
//#region src/event/create-presence.d.ts
|
|
5
|
-
type PresenceState = "opening" | "opened" | "closing" | "closed";
|
|
6
|
-
declare function createPresence(params: {
|
|
7
|
-
show: Accessor<boolean>;
|
|
8
|
-
element: MaybeAccessor<HTMLElement | undefined>;
|
|
9
|
-
}): {
|
|
10
|
-
show: () => boolean;
|
|
11
|
-
state: Accessor<PresenceState>;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { PresenceState, createPresence };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { hasAnimation } from "../dom/animation.mjs";
|
|
2
|
-
import { access } from "../reactive/access.mjs";
|
|
3
|
-
import { noop } from "../fn/index.mjs";
|
|
4
|
-
import { createWatch } from "../reactive/create-watch.mjs";
|
|
5
|
-
import { makeEventListener } from "./make-event-listener.mjs";
|
|
6
|
-
import { createSignal } from "solid-js";
|
|
7
|
-
|
|
8
|
-
//#region src/event/create-presence.ts
|
|
9
|
-
function createPresence(params) {
|
|
10
|
-
const [state, setState] = createSignal(access(params.show) ? "opened" : "closed");
|
|
11
|
-
createWatch(params.show, (show) => {
|
|
12
|
-
if (show) setState("opening");
|
|
13
|
-
else setState("closing");
|
|
14
|
-
}, { defer: true });
|
|
15
|
-
let clear = noop;
|
|
16
|
-
createWatch(state, (current) => {
|
|
17
|
-
clear();
|
|
18
|
-
const el = access(params.element);
|
|
19
|
-
if (!el) return;
|
|
20
|
-
if (current.endsWith("ing")) if (hasAnimation(el)) clear = makeEventListener(el, "animationend", () => {
|
|
21
|
-
setState(current === "opening" ? "opened" : "closed");
|
|
22
|
-
}, { once: true });
|
|
23
|
-
else setState(current === "opening" ? "opened" : "closed");
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
show: () => state() !== "closed",
|
|
27
|
-
state
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { createPresence };
|
package/dist/event/index.d.mts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createClickOutside } from "./create-click-outside.mjs";
|
|
2
|
-
import { DocumentEventName, GeneralEventListener, WindowEventName, makeEventListener } from "./make-event-listener.mjs";
|
|
3
|
-
import { createEventListener } from "./create-event-listener.mjs";
|
|
4
|
-
import { createIntersectionObserver } from "./create-intersection-observer.mjs";
|
|
5
|
-
import { PresenceState, createPresence } from "./create-presence.mjs";
|
|
6
|
-
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./create-visibility-observer.mjs";
|
|
7
|
-
import { JSX } from "solid-js/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
//#region src/event/index.d.ts
|
|
10
|
-
declare function runSolidEventHandler<T, E extends Event, EHandler extends JSX.EventHandler<T, any> = JSX.EventHandler<T, E>>(event: E, handler?: EHandler | JSX.BoundEventHandler<T, E, EHandler>): void;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { runSolidEventHandler };
|
package/dist/event/index.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { makeEventListener } from "./make-event-listener.mjs";
|
|
2
|
-
import { createClickOutside } from "./create-click-outside.mjs";
|
|
3
|
-
import { createEventListener } from "./create-event-listener.mjs";
|
|
4
|
-
import { createIntersectionObserver } from "./create-intersection-observer.mjs";
|
|
5
|
-
import { createPresence } from "./create-presence.mjs";
|
|
6
|
-
import { createVisibilityObserver } from "./create-visibility-observer.mjs";
|
|
7
|
-
|
|
8
|
-
//#region src/event/index.ts
|
|
9
|
-
function runSolidEventHandler(event, handler) {
|
|
10
|
-
if (typeof handler === "function") handler(event);
|
|
11
|
-
if (Array.isArray(handler)) handler[0](handler[1], event);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { runSolidEventHandler };
|
package/dist/fn/index.d.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createDebounce } from "./create-debounce.mjs";
|
|
2
|
-
import { createLoopExec } from "./create-loop-exec.mjs";
|
|
3
|
-
import { createThrottle } from "./create-throttle.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/fn/index.d.ts
|
|
6
|
-
declare const noop: () => void;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { noop };
|
package/dist/fn/index.mjs
DELETED
package/dist/reactive/access.mjs
DELETED