solid-tiny-utils 0.12.0 → 0.13.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/color/hex-rgb.d.mts +0 -1
- package/dist/color/hex-rgb.mjs +1 -3
- package/dist/color/oklch-rgb.d.mts +3 -3
- package/dist/color/oklch-rgb.mjs +1 -3
- package/dist/color/validation.d.mts +0 -1
- package/dist/color/validation.mjs +1 -3
- package/dist/dom/animation.mjs +1 -2
- package/dist/dom/attrs.mjs +1 -2
- package/dist/dom/css.d.mts +1 -2
- package/dist/dom/css.mjs +4 -5
- package/dist/dom/index.d.mts +3 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +5 -4
- package/dist/solidjs/create-click-outside.d.mts +0 -2
- package/dist/solidjs/create-click-outside.mjs +2 -6
- package/dist/solidjs/create-debounce-watch.d.mts +0 -1
- package/dist/solidjs/create-debounce-watch.mjs +1 -3
- package/dist/solidjs/create-debounce.d.mts +0 -2
- package/dist/solidjs/create-debounce.mjs +1 -3
- package/dist/solidjs/create-event-listener.d.mts +0 -1
- package/dist/solidjs/create-event-listener.mjs +1 -3
- package/dist/solidjs/create-intersection-observer.d.mts +0 -2
- package/dist/solidjs/create-intersection-observer.mjs +1 -3
- package/dist/solidjs/create-list.mjs +2 -6
- package/dist/solidjs/create-loop-exec.d.mts +0 -1
- package/dist/solidjs/create-loop-exec.mjs +1 -3
- package/dist/solidjs/create-persisted-store.d.mts +42 -0
- package/dist/solidjs/create-persisted-store.mjs +64 -0
- package/dist/solidjs/create-presence.d.mts +5 -4
- package/dist/solidjs/create-presence.mjs +38 -60
- package/dist/solidjs/create-static-store.d.mts +27 -0
- package/dist/solidjs/create-static-store.mjs +54 -0
- package/dist/solidjs/create-throttle.d.mts +0 -2
- package/dist/solidjs/create-throttle.mjs +1 -3
- package/dist/solidjs/create-visibility-observer.d.mts +0 -1
- package/dist/solidjs/create-visibility-observer.mjs +1 -3
- package/dist/solidjs/create-watch.mjs +1 -3
- package/dist/solidjs/index.d.mts +3 -1
- package/dist/solidjs/make-event-listener.d.mts +0 -2
- package/dist/solidjs/make-event-listener.mjs +1 -3
- package/dist/solidjs/utils.d.mts +4 -1
- package/dist/solidjs/utils.mjs +5 -3
- package/dist/types/index.d.mts +2 -1
- package/dist/types/solidjs.d.mts +6 -0
- package/dist/utils/array.mjs +2 -6
- package/dist/utils/async.mjs +6 -11
- package/dist/utils/constant.mjs +1 -2
- package/dist/utils/is.mjs +9 -27
- package/dist/utils/number.mjs +1 -2
- package/dist/utils/random.mjs +7 -15
- package/dist/utils/str.mjs +6 -17
- package/package.json +37 -38
package/dist/color/hex-rgb.d.mts
CHANGED
package/dist/color/hex-rgb.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isArray } from "../utils/is.mjs";
|
|
2
2
|
import { clamp, toHex } from "../utils/number.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/color/hex-rgb.ts
|
|
5
4
|
const HEX_PREFIX_REGEX = /^#/;
|
|
6
5
|
const HEX_VALIDATION_REGEX = /^[0-9a-fA-F]{6}$/;
|
|
@@ -57,6 +56,5 @@ function rgbToHex(rgb) {
|
|
|
57
56
|
const b = c(rgb_[2]);
|
|
58
57
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
59
58
|
}
|
|
60
|
-
|
|
61
59
|
//#endregion
|
|
62
|
-
export { hexToRgb, rgbToHex };
|
|
60
|
+
export { hexToRgb, rgbToHex };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//#region src/color/oklch-rgb.d.ts
|
|
2
2
|
interface RGB {
|
|
3
|
-
r: number;
|
|
4
|
-
g: number;
|
|
5
3
|
b: number;
|
|
4
|
+
g: number;
|
|
5
|
+
r: number;
|
|
6
6
|
}
|
|
7
7
|
interface OKLCH {
|
|
8
|
-
l: number;
|
|
9
8
|
c: number;
|
|
10
9
|
h: number;
|
|
10
|
+
l: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Converts OKLCH color to RGB color space.
|
package/dist/color/oklch-rgb.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { clamp, max } from "../utils/number.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/color/oklch-rgb.ts
|
|
4
3
|
const PI_180 = Math.PI / 180;
|
|
5
4
|
const INV_PI_180 = 180 / Math.PI;
|
|
@@ -96,6 +95,5 @@ function rgbToOklch(rgb) {
|
|
|
96
95
|
h
|
|
97
96
|
};
|
|
98
97
|
}
|
|
99
|
-
|
|
100
98
|
//#endregion
|
|
101
|
-
export { oklchToRgb, rgbToOklch };
|
|
99
|
+
export { oklchToRgb, rgbToOklch };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { inRange } from "../utils/number.mjs";
|
|
2
2
|
import { hexToRgb } from "./hex-rgb.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/color/validation.ts
|
|
5
4
|
/**
|
|
6
5
|
* Checks if RGB values are in valid range (0-255)
|
|
@@ -30,6 +29,5 @@ function isValidOKLCH(oklch) {
|
|
|
30
29
|
function isValidHex(hex) {
|
|
31
30
|
return hexToRgb(hex) !== null;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
|
-
export { isValidHex, isValidOKLCH, isValidRGB };
|
|
33
|
+
export { isValidHex, isValidOKLCH, isValidRGB };
|
package/dist/dom/animation.mjs
CHANGED
package/dist/dom/attrs.mjs
CHANGED
package/dist/dom/css.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { JSX } from "solid-js/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/dom/css.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Mounts a style element to the document head.
|
|
7
6
|
* If the style element with the given id already exists, it updates its content.
|
|
@@ -12,7 +11,7 @@ import { JSX } from "solid-js/jsx-runtime";
|
|
|
12
11
|
* @param id - The id of the style element.
|
|
13
12
|
* @param refresh - Whether to refresh the style if it already exists. Defaults to **false**.
|
|
14
13
|
*/
|
|
15
|
-
declare function mountStyle(style: string, id: string, refresh?: boolean): void;
|
|
14
|
+
declare function mountStyle(style: string | (() => string), id: string, refresh?: boolean): void;
|
|
16
15
|
declare function stringStyleToObject(style: string): JSX.CSSProperties;
|
|
17
16
|
declare function combineStyle(a: JSX.CSSProperties, b: JSX.CSSProperties | string | undefined): JSX.CSSProperties | string;
|
|
18
17
|
declare function combineClass(defaultClass: string, ...otherClass: (string | undefined | null)[]): string;
|
package/dist/dom/css.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isClient } from "../utils/is.mjs";
|
|
2
|
-
|
|
2
|
+
import { access } from "../solidjs/utils.mjs";
|
|
3
3
|
//#region src/dom/css.ts
|
|
4
4
|
const alreadyInjected = [];
|
|
5
5
|
/**
|
|
@@ -17,12 +17,12 @@ function mountStyle(style, id, refresh = false) {
|
|
|
17
17
|
if (alreadyInjected.includes(id) && !refresh) return;
|
|
18
18
|
let styleElement = document.querySelector(`style#${id}`);
|
|
19
19
|
if (styleElement) {
|
|
20
|
-
styleElement.
|
|
20
|
+
styleElement.textContent = access(style);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
styleElement = document.createElement("style");
|
|
24
24
|
styleElement.id = id;
|
|
25
|
-
styleElement.
|
|
25
|
+
styleElement.textContent = access(style);
|
|
26
26
|
document.head.appendChild(styleElement);
|
|
27
27
|
alreadyInjected.push(id);
|
|
28
28
|
}
|
|
@@ -46,6 +46,5 @@ function combineStyle(a, b) {
|
|
|
46
46
|
function combineClass(defaultClass, ...otherClass) {
|
|
47
47
|
return [defaultClass, ...otherClass].filter(Boolean).join(" ");
|
|
48
48
|
}
|
|
49
|
-
|
|
50
49
|
//#endregion
|
|
51
|
-
export { combineClass, combineStyle, mountStyle, stringStyleToObject };
|
|
50
|
+
export { combineClass, combineStyle, mountStyle, stringStyleToObject };
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { dataIf } from "./dom/attrs.mjs";
|
|
|
6
6
|
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
7
7
|
import { AnyFn, Fn } from "./types/fn.mjs";
|
|
8
8
|
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./types/maybe.mjs";
|
|
9
|
-
import "./types/
|
|
9
|
+
import { SetterParam } from "./types/solidjs.mjs";
|
|
10
10
|
import { createClickOutside } from "./solidjs/create-click-outside.mjs";
|
|
11
11
|
import { createDebounce } from "./solidjs/create-debounce.mjs";
|
|
12
12
|
import { createDebouncedWatch } from "./solidjs/create-debounce-watch.mjs";
|
|
@@ -15,12 +15,13 @@ import { createEventListener } from "./solidjs/create-event-listener.mjs";
|
|
|
15
15
|
import { createIntersectionObserver } from "./solidjs/create-intersection-observer.mjs";
|
|
16
16
|
import { createList } from "./solidjs/create-list.mjs";
|
|
17
17
|
import { createLoopExec } from "./solidjs/create-loop-exec.mjs";
|
|
18
|
+
import { StaticStoreSetter, createStaticStore } from "./solidjs/create-static-store.mjs";
|
|
19
|
+
import { PersistedStorage, PersistedStoreOption, createPersistedStore } from "./solidjs/create-persisted-store.mjs";
|
|
18
20
|
import { MakePresenceOptions, PresencePhase, createPresence } from "./solidjs/create-presence.mjs";
|
|
19
21
|
import { createThrottle } from "./solidjs/create-throttle.mjs";
|
|
20
22
|
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./solidjs/create-visibility-observer.mjs";
|
|
21
23
|
import { createWatch } from "./solidjs/create-watch.mjs";
|
|
22
|
-
import { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
23
|
-
import "./solidjs/index.mjs";
|
|
24
|
+
import { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
24
25
|
import { clearArray, iterate, list, range } from "./utils/array.mjs";
|
|
25
26
|
import { runAtNextAnimationFrame, sleep } from "./utils/async.mjs";
|
|
26
27
|
import { noop } from "./utils/constant.mjs";
|
|
@@ -28,4 +29,4 @@ import { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, is
|
|
|
28
29
|
import { clamp, inRange, max, min, toHex } from "./utils/number.mjs";
|
|
29
30
|
import { draw, random, shuffle, uid } from "./utils/random.mjs";
|
|
30
31
|
import { camel, capitalize, dash, pascal, snake, template, title, trim } from "./utils/str.mjs";
|
|
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 };
|
|
32
|
+
export { AnyFn, CreateVisibilityObserverOption, DocumentEventName, EntryCallback, Fn, GeneralEventListener, MakePresenceOptions, MaybeAccessor, MaybeArray, MaybeCallableChild, MaybeNullableAccessor, MaybePromise, OKLCH, PersistedStorage, PersistedStoreOption, PresencePhase, RGB, SetterParam, StaticStoreSetter, UseVisibilityObserverFn, WindowEventName, access, accessWith, callMaybeCallableChild, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEventListener, createIntersectionObserver, createList, createLoopExec, createPersistedStore, createPresence, createStaticStore, 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
|
@@ -10,9 +10,8 @@ import { oklchToRgb, rgbToOklch } from "./color/oklch-rgb.mjs";
|
|
|
10
10
|
import { isValidHex, isValidOKLCH, isValidRGB } from "./color/validation.mjs";
|
|
11
11
|
import { hasAnimation } from "./dom/animation.mjs";
|
|
12
12
|
import { dataIf } from "./dom/attrs.mjs";
|
|
13
|
-
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
14
13
|
import { makeEventListener } from "./solidjs/make-event-listener.mjs";
|
|
15
|
-
import { access, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
14
|
+
import { access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
16
15
|
import { createClickOutside } from "./solidjs/create-click-outside.mjs";
|
|
17
16
|
import { createDebounce } from "./solidjs/create-debounce.mjs";
|
|
18
17
|
import { createWatch } from "./solidjs/create-watch.mjs";
|
|
@@ -21,8 +20,10 @@ import { createEventListener } from "./solidjs/create-event-listener.mjs";
|
|
|
21
20
|
import { createIntersectionObserver } from "./solidjs/create-intersection-observer.mjs";
|
|
22
21
|
import { createList } from "./solidjs/create-list.mjs";
|
|
23
22
|
import { createLoopExec } from "./solidjs/create-loop-exec.mjs";
|
|
23
|
+
import { createStaticStore } from "./solidjs/create-static-store.mjs";
|
|
24
|
+
import { createPersistedStore } from "./solidjs/create-persisted-store.mjs";
|
|
24
25
|
import { createPresence } from "./solidjs/create-presence.mjs";
|
|
25
26
|
import { createThrottle } from "./solidjs/create-throttle.mjs";
|
|
26
27
|
import { createVisibilityObserver } from "./solidjs/create-visibility-observer.mjs";
|
|
27
|
-
|
|
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 };
|
|
28
|
+
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
29
|
+
export { access, accessWith, callMaybeCallableChild, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEventListener, createIntersectionObserver, createList, createLoopExec, createPersistedStore, createPresence, createStaticStore, 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,6 +1,4 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
|
-
|
|
4
2
|
//#region src/solidjs/create-click-outside.d.ts
|
|
5
3
|
declare function createClickOutside(target: MaybeAccessor<HTMLElement | null | undefined>, handler: (event: PointerEvent) => void, options?: {
|
|
6
4
|
ignore?: MaybeAccessor<HTMLElement | null | undefined>[];
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { makeEventListener } from "./make-event-listener.mjs";
|
|
2
2
|
import { access } from "./utils.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/solidjs/create-click-outside.ts
|
|
5
4
|
function createClickOutside(target, handler, options) {
|
|
6
5
|
let shouldListen = false;
|
|
7
6
|
const shouldIgnore = (event) => {
|
|
8
|
-
return (options?.ignore ? options.ignore : []).map(access).some((el) =>
|
|
9
|
-
return el && (event.target === el || event.composedPath().includes(el));
|
|
10
|
-
});
|
|
7
|
+
return (options?.ignore ? options.ignore : []).map(access).some((el) => el && (event.target === el || event.composedPath().includes(el)));
|
|
11
8
|
};
|
|
12
9
|
const listener = (e) => {
|
|
13
10
|
const el = access(target);
|
|
@@ -28,6 +25,5 @@ function createClickOutside(target, handler, options) {
|
|
|
28
25
|
};
|
|
29
26
|
return stop;
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
//#endregion
|
|
33
|
-
export { createClickOutside };
|
|
29
|
+
export { createClickOutside };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createDebounce } from "./create-debounce.mjs";
|
|
2
2
|
import { createWatch } from "./create-watch.mjs";
|
|
3
|
-
|
|
4
3
|
//#region src/solidjs/create-debounce-watch.ts
|
|
5
4
|
/**
|
|
6
5
|
* Creates a debounced watch effect.
|
|
@@ -10,6 +9,5 @@ import { createWatch } from "./create-watch.mjs";
|
|
|
10
9
|
function createDebouncedWatch(targets, fn, opt) {
|
|
11
10
|
createWatch(targets, createDebounce(fn, opt?.delay ?? 10), opt);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
//#endregion
|
|
15
|
-
export { createDebouncedWatch };
|
|
13
|
+
export { createDebouncedWatch };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
|
-
|
|
4
2
|
//#region src/solidjs/create-debounce.d.ts
|
|
5
3
|
declare function createDebounce<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
6
4
|
//#endregion
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { access } from "./utils.mjs";
|
|
2
2
|
import { onCleanup } from "solid-js";
|
|
3
|
-
|
|
4
3
|
//#region src/solidjs/create-debounce.ts
|
|
5
4
|
function createDebounce(callback, delay) {
|
|
6
5
|
let timeoutId;
|
|
@@ -15,6 +14,5 @@ function createDebounce(callback, delay) {
|
|
|
15
14
|
};
|
|
16
15
|
return run;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
|
-
export { createDebounce };
|
|
18
|
+
export { createDebounce };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fn } from "../types/fn.mjs";
|
|
2
2
|
import { MaybeAccessor, MaybeArray } from "../types/maybe.mjs";
|
|
3
|
-
import "../types/index.mjs";
|
|
4
3
|
import { DocumentEventName, GeneralEventListener, WindowEventName } from "./make-event-listener.mjs";
|
|
5
4
|
|
|
6
5
|
//#region src/solidjs/create-event-listener.d.ts
|
|
@@ -4,7 +4,6 @@ import { noop } from "../utils/constant.mjs";
|
|
|
4
4
|
import { makeEventListener } from "./make-event-listener.mjs";
|
|
5
5
|
import { access } from "./utils.mjs";
|
|
6
6
|
import { createWatch } from "./create-watch.mjs";
|
|
7
|
-
|
|
8
7
|
//#region src/solidjs/create-event-listener.ts
|
|
9
8
|
function createEventListener(...args) {
|
|
10
9
|
const target = args[0];
|
|
@@ -28,6 +27,5 @@ function createEventListener(...args) {
|
|
|
28
27
|
});
|
|
29
28
|
return cleanup;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
|
-
export { createEventListener };
|
|
31
|
+
export { createEventListener };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
|
-
|
|
4
2
|
//#region src/solidjs/create-intersection-observer.d.ts
|
|
5
3
|
declare function createIntersectionObserver(targets: MaybeAccessor<HTMLElement | null | undefined>[], callback: IntersectionObserverCallback, options?: IntersectionObserverInit): () => void;
|
|
6
4
|
//#endregion
|
|
@@ -4,7 +4,6 @@ import { access } from "./utils.mjs";
|
|
|
4
4
|
import { createWatch } from "./create-watch.mjs";
|
|
5
5
|
import { isServer } from "solid-js/web";
|
|
6
6
|
import { onCleanup } from "solid-js";
|
|
7
|
-
|
|
8
7
|
//#region src/solidjs/create-intersection-observer.ts
|
|
9
8
|
function createIntersectionObserver(targets, callback, options = {}) {
|
|
10
9
|
if (isServer) return noop;
|
|
@@ -24,6 +23,5 @@ function createIntersectionObserver(targets, callback, options = {}) {
|
|
|
24
23
|
});
|
|
25
24
|
return () => io.disconnect();
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
|
-
export { createIntersectionObserver };
|
|
27
|
+
export { createIntersectionObserver };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { inRange } from "../utils/number.mjs";
|
|
2
2
|
import { createStore, unwrap } from "solid-js/store";
|
|
3
|
-
|
|
4
3
|
//#region src/solidjs/create-list.ts
|
|
5
4
|
function createInsertHelper(setList) {
|
|
6
5
|
return (item, at) => {
|
|
@@ -67,11 +66,8 @@ function createList(initialValue) {
|
|
|
67
66
|
swap: createSwapHelper(setList),
|
|
68
67
|
move: createMoveHelper(setList),
|
|
69
68
|
sort: createSortHelper(setList),
|
|
70
|
-
isSortedBy: (compareFn) =>
|
|
71
|
-
return createIsSortedHelper(list, compareFn);
|
|
72
|
-
}
|
|
69
|
+
isSortedBy: (compareFn) => createIsSortedHelper(list, compareFn)
|
|
73
70
|
}];
|
|
74
71
|
}
|
|
75
|
-
|
|
76
72
|
//#endregion
|
|
77
|
-
export { createList };
|
|
73
|
+
export { createList };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MaybeAccessor, MaybePromise } from "../types/maybe.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/solidjs/create-loop-exec.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Repeatedly executes an asynchronous function with a specified delay between each execution.
|
|
7
6
|
* The loop continues until the surrounding SolidJS effect is cleaned up.
|
|
@@ -2,7 +2,6 @@ import { isNumber } from "../utils/is.mjs";
|
|
|
2
2
|
import { access } from "./utils.mjs";
|
|
3
3
|
import { createWatch } from "./create-watch.mjs";
|
|
4
4
|
import { onCleanup } from "solid-js";
|
|
5
|
-
|
|
6
5
|
//#region src/solidjs/create-loop-exec.ts
|
|
7
6
|
/**
|
|
8
7
|
* Repeatedly executes an asynchronous function with a specified delay between each execution.
|
|
@@ -54,6 +53,5 @@ function createLoopExec(fn, delay) {
|
|
|
54
53
|
start
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
|
-
|
|
58
56
|
//#endregion
|
|
59
|
-
export { createLoopExec };
|
|
57
|
+
export { createLoopExec };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StaticStoreSetter } from "./create-static-store.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/solidjs/create-persisted-store.d.ts
|
|
4
|
+
interface PersistedStorage {
|
|
5
|
+
getItem(key: string): string | null;
|
|
6
|
+
removeItem(key: string): void;
|
|
7
|
+
setItem(key: string, value: string): void;
|
|
8
|
+
}
|
|
9
|
+
interface PersistedStoreOption {
|
|
10
|
+
/**
|
|
11
|
+
* Storage key used to read and write the store.
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Storage adapter. Defaults to `localStorage` in the browser.
|
|
16
|
+
*/
|
|
17
|
+
storage?: PersistedStorage;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates a static store persisted as JSON.
|
|
21
|
+
*
|
|
22
|
+
* Only keys from `init` are restored. Invalid JSON and storage errors are
|
|
23
|
+
* ignored.
|
|
24
|
+
*
|
|
25
|
+
* @param init Initial store value.
|
|
26
|
+
* @param opts Persistence options.
|
|
27
|
+
* @returns The store object and setter.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const [settings, setSettings] = createPersistedStore(
|
|
32
|
+
* { theme: "system", sidebarOpen: true },
|
|
33
|
+
* { name: "app-settings" }
|
|
34
|
+
* );
|
|
35
|
+
*
|
|
36
|
+
* setSettings("theme", "dark");
|
|
37
|
+
* setSettings({ sidebarOpen: false });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function createPersistedStore<T extends Record<string, unknown>>(init: T, opts?: PersistedStoreOption): readonly [T, StaticStoreSetter<T>];
|
|
41
|
+
//#endregion
|
|
42
|
+
export { PersistedStorage, PersistedStoreOption, createPersistedStore };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isObject } from "../utils/is.mjs";
|
|
2
|
+
import { createWatch } from "./create-watch.mjs";
|
|
3
|
+
import { createStaticStore } from "./create-static-store.mjs";
|
|
4
|
+
import { createUniqueId } from "solid-js";
|
|
5
|
+
//#region src/solidjs/create-persisted-store.ts
|
|
6
|
+
const noopStorage = {
|
|
7
|
+
getItem: () => null,
|
|
8
|
+
removeItem: () => void 0,
|
|
9
|
+
setItem: () => void 0
|
|
10
|
+
};
|
|
11
|
+
function getDefaultStorage() {
|
|
12
|
+
return typeof localStorage === "undefined" ? noopStorage : localStorage;
|
|
13
|
+
}
|
|
14
|
+
function getStore(storage, name) {
|
|
15
|
+
try {
|
|
16
|
+
const val = storage.getItem(name);
|
|
17
|
+
if (!val) return {};
|
|
18
|
+
return JSON.parse(val);
|
|
19
|
+
} catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function strictAssignStore(init, obj) {
|
|
24
|
+
const store = { ...init };
|
|
25
|
+
if (!isObject(obj)) return store;
|
|
26
|
+
for (const key in store) if (Object.hasOwn(obj, key) && Object.hasOwn(store, key)) store[key] = obj[key];
|
|
27
|
+
return store;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a static store persisted as JSON.
|
|
31
|
+
*
|
|
32
|
+
* Only keys from `init` are restored. Invalid JSON and storage errors are
|
|
33
|
+
* ignored.
|
|
34
|
+
*
|
|
35
|
+
* @param init Initial store value.
|
|
36
|
+
* @param opts Persistence options.
|
|
37
|
+
* @returns The store object and setter.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const [settings, setSettings] = createPersistedStore(
|
|
42
|
+
* { theme: "system", sidebarOpen: true },
|
|
43
|
+
* { name: "app-settings" }
|
|
44
|
+
* );
|
|
45
|
+
*
|
|
46
|
+
* setSettings("theme", "dark");
|
|
47
|
+
* setSettings({ sidebarOpen: false });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
function createPersistedStore(init, opts) {
|
|
51
|
+
const name = opts?.name ?? `persisted-${createUniqueId()}`;
|
|
52
|
+
const storage = opts?.storage ?? getDefaultStorage();
|
|
53
|
+
const [store, setStore] = createStaticStore(strictAssignStore(init, getStore(storage, name)));
|
|
54
|
+
createWatch(() => JSON.stringify(store), (jsonData) => {
|
|
55
|
+
try {
|
|
56
|
+
storage.setItem(name, jsonData);
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}, { defer: true });
|
|
61
|
+
return [store, setStore];
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { createPersistedStore };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { Accessor } from "solid-js";
|
|
4
3
|
|
|
5
4
|
//#region src/solidjs/create-presence.d.ts
|
|
@@ -8,14 +7,16 @@ interface MakePresenceOptions {
|
|
|
8
7
|
exitDuration: MaybeAccessor<number>;
|
|
9
8
|
initialEnter?: boolean;
|
|
10
9
|
}
|
|
11
|
-
type PresencePhase = "idle" | "
|
|
10
|
+
type PresencePhase = "idle" | "entering" | "entered" | "exiting";
|
|
11
|
+
/**
|
|
12
|
+
* Keeps an item mounted while its enter and exit animations run.
|
|
13
|
+
*/
|
|
12
14
|
declare function createPresence<TItem>(item: Accessor<TItem | undefined>, options: MakePresenceOptions): {
|
|
13
15
|
isMounted: () => boolean;
|
|
14
|
-
mountedItem: Accessor<TItem | undefined>;
|
|
15
|
-
isVisible: Accessor<boolean>;
|
|
16
16
|
isAnimating: Accessor<boolean>;
|
|
17
17
|
isEntering: Accessor<boolean>;
|
|
18
18
|
isExiting: Accessor<boolean>;
|
|
19
|
+
mountedItem: Accessor<TItem | undefined>;
|
|
19
20
|
phase: Accessor<PresencePhase>;
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
@@ -1,89 +1,67 @@
|
|
|
1
1
|
import { isDefined } from "../utils/is.mjs";
|
|
2
|
-
import { runAtNextAnimationFrame } from "../utils/async.mjs";
|
|
3
2
|
import { noop } from "../utils/constant.mjs";
|
|
4
3
|
import { access } from "./utils.mjs";
|
|
5
4
|
import { createWatch } from "./create-watch.mjs";
|
|
6
5
|
import { createEffect, createMemo, createSignal, onCleanup, untrack } from "solid-js";
|
|
7
|
-
|
|
8
6
|
//#region src/solidjs/create-presence.ts
|
|
9
7
|
function makeTimeout(ms, fn) {
|
|
10
|
-
if (ms
|
|
8
|
+
if (ms <= 0) {
|
|
11
9
|
fn();
|
|
12
10
|
return noop;
|
|
13
11
|
}
|
|
14
12
|
const timeoutId = setTimeout(() => {
|
|
15
13
|
fn();
|
|
16
|
-
}, ms
|
|
14
|
+
}, ms);
|
|
17
15
|
return () => clearTimeout(timeoutId);
|
|
18
16
|
}
|
|
17
|
+
const itemShouldBeMounted = (item) => item !== false && item != null;
|
|
18
|
+
function getInitialPhase(item, initialEnter) {
|
|
19
|
+
if (!itemShouldBeMounted(item)) return "idle";
|
|
20
|
+
if (initialEnter) return "entering";
|
|
21
|
+
return "entered";
|
|
22
|
+
}
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @internal - to be combined with `createPresence` in the future
|
|
24
|
+
* Keeps an item mounted while its enter and exit animations run.
|
|
23
25
|
*/
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
26
|
+
function createPresence(item, options) {
|
|
27
|
+
const initial = untrack(item);
|
|
28
|
+
const [mountedItem, setMountedItem] = createSignal(initial);
|
|
29
|
+
const [phase, setPhase] = createSignal(getInitialPhase(initial, options.initialEnter));
|
|
30
|
+
const isMounted = createMemo(() => phase() !== "idle");
|
|
31
|
+
const isEntering = createMemo(() => phase() === "entering");
|
|
32
|
+
const isExiting = createMemo(() => phase() === "exiting");
|
|
33
|
+
const isAnimating = createMemo(() => isEntering() || isExiting());
|
|
31
34
|
let clear = noop;
|
|
32
35
|
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
36
|
createWatch(phase, (currentPhase) => {
|
|
44
37
|
clear();
|
|
45
|
-
if (currentPhase === "
|
|
46
|
-
|
|
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");
|
|
38
|
+
if (currentPhase === "entering") clear = makeTimeout(access(options.enterDuration), () => setPhase("entered"));
|
|
39
|
+
if (currentPhase === "exiting") clear = makeTimeout(access(options.exitDuration), () => setPhase("idle"));
|
|
51
40
|
});
|
|
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
41
|
createEffect(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
42
|
+
const currentItem = item();
|
|
43
|
+
if (mountedItem() !== currentItem) {
|
|
44
|
+
if (isMounted()) setPhase("exiting");
|
|
45
|
+
else if (itemShouldBeMounted(currentItem)) {
|
|
46
|
+
setMountedItem(() => currentItem);
|
|
47
|
+
setPhase("entering");
|
|
77
48
|
}
|
|
78
|
-
|
|
79
|
-
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (itemShouldBeMounted(currentItem)) {
|
|
52
|
+
if (!isMounted()) setPhase("entering");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (isMounted()) setPhase("exiting");
|
|
80
56
|
});
|
|
81
57
|
return {
|
|
82
|
-
...rest,
|
|
83
58
|
isMounted: () => isMounted() && isDefined(mountedItem()),
|
|
84
|
-
|
|
59
|
+
isAnimating,
|
|
60
|
+
isEntering,
|
|
61
|
+
isExiting,
|
|
62
|
+
mountedItem,
|
|
63
|
+
phase
|
|
85
64
|
};
|
|
86
65
|
}
|
|
87
|
-
|
|
88
66
|
//#endregion
|
|
89
|
-
export { createPresence };
|
|
67
|
+
export { createPresence };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SetterParam } from "../types/solidjs.mjs";
|
|
2
|
+
//#region src/solidjs/create-static-store.d.ts
|
|
3
|
+
interface StaticStoreSetter<T extends object> {
|
|
4
|
+
(setter: (prev: T) => Partial<T>): T;
|
|
5
|
+
(state: Partial<T>): T;
|
|
6
|
+
<K extends keyof T>(key: K, state: SetterParam<T[K]>): T;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates a shallow reactive object with a fixed set of keys.
|
|
10
|
+
*
|
|
11
|
+
* Only top-level properties are tracked. Keys are defined by `init` and are not
|
|
12
|
+
* added or removed later.
|
|
13
|
+
*
|
|
14
|
+
* @param init Initial store value.
|
|
15
|
+
* @returns The store object and setter.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const [state, setState] = createStaticStore({ count: 0 });
|
|
20
|
+
*
|
|
21
|
+
* setState("count", (count) => count + 1);
|
|
22
|
+
* setState({ count: 10 });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createStaticStore<T extends object>(init: T): [access: T, write: StaticStoreSetter<T>];
|
|
26
|
+
//#endregion
|
|
27
|
+
export { StaticStoreSetter, createStaticStore };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isFn, isObject } from "../utils/is.mjs";
|
|
2
|
+
import { accessWith } from "./utils.mjs";
|
|
3
|
+
import { batch, createSignal, getListener, untrack } from "solid-js";
|
|
4
|
+
//#region src/solidjs/create-static-store.ts
|
|
5
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: any */
|
|
6
|
+
/**
|
|
7
|
+
* Creates a shallow reactive object with a fixed set of keys.
|
|
8
|
+
*
|
|
9
|
+
* Only top-level properties are tracked. Keys are defined by `init` and are not
|
|
10
|
+
* added or removed later.
|
|
11
|
+
*
|
|
12
|
+
* @param init Initial store value.
|
|
13
|
+
* @returns The store object and setter.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const [state, setState] = createStaticStore({ count: 0 });
|
|
18
|
+
*
|
|
19
|
+
* setState("count", (count) => count + 1);
|
|
20
|
+
* setState({ count: 10 });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function createStaticStore(init) {
|
|
24
|
+
const copy = { ...init }, store = { ...init }, cache = {};
|
|
25
|
+
const getValue = (key) => {
|
|
26
|
+
let signal = cache[key];
|
|
27
|
+
if (!signal) {
|
|
28
|
+
if (!getListener()) return copy[key];
|
|
29
|
+
cache[key] = signal = createSignal(copy[key], { internal: true });
|
|
30
|
+
delete copy[key];
|
|
31
|
+
}
|
|
32
|
+
return signal[0]();
|
|
33
|
+
};
|
|
34
|
+
for (const key in init) if (Object.hasOwn(init, key)) Object.defineProperty(store, key, {
|
|
35
|
+
get: () => getValue(key),
|
|
36
|
+
enumerable: true
|
|
37
|
+
});
|
|
38
|
+
const setValue = (key, value) => {
|
|
39
|
+
const signal = cache[key];
|
|
40
|
+
if (signal) signal[1](value);
|
|
41
|
+
if (key in copy) copy[key] = accessWith(value, copy[key]);
|
|
42
|
+
};
|
|
43
|
+
return [store, (a, b) => {
|
|
44
|
+
if (isObject(a) || isFn(a)) {
|
|
45
|
+
const entries = untrack(() => Object.entries(accessWith(a, store)));
|
|
46
|
+
batch(() => {
|
|
47
|
+
for (const [key, value] of entries) setValue(key, () => value);
|
|
48
|
+
});
|
|
49
|
+
} else setValue(a, b);
|
|
50
|
+
return store;
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createStaticStore };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
|
-
|
|
4
2
|
//#region src/solidjs/create-throttle.d.ts
|
|
5
3
|
declare function createThrottle<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
6
4
|
//#endregion
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { access } from "./utils.mjs";
|
|
2
2
|
import { onCleanup } from "solid-js";
|
|
3
|
-
|
|
4
3
|
//#region src/solidjs/create-throttle.ts
|
|
5
4
|
function createThrottle(callback, delay) {
|
|
6
5
|
let timeoutId;
|
|
@@ -16,6 +15,5 @@ function createThrottle(callback, delay) {
|
|
|
16
15
|
};
|
|
17
16
|
return run;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
//#endregion
|
|
21
|
-
export { createThrottle };
|
|
19
|
+
export { createThrottle };
|
|
@@ -2,7 +2,6 @@ import { isObject } from "../utils/is.mjs";
|
|
|
2
2
|
import { access } from "./utils.mjs";
|
|
3
3
|
import { createWatch } from "./create-watch.mjs";
|
|
4
4
|
import { createSignal, onCleanup } from "solid-js";
|
|
5
|
-
|
|
6
5
|
//#region src/solidjs/create-visibility-observer.ts
|
|
7
6
|
function createVisibilityObserver(arg1, arg2) {
|
|
8
7
|
let target;
|
|
@@ -41,6 +40,5 @@ function createVisibilityObserver(arg1, arg2) {
|
|
|
41
40
|
if (target) return useVisibilityObserverFn(target);
|
|
42
41
|
return useVisibilityObserverFn;
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
//#endregion
|
|
46
|
-
export { createVisibilityObserver };
|
|
44
|
+
export { createVisibilityObserver };
|
package/dist/solidjs/index.d.mts
CHANGED
|
@@ -6,8 +6,10 @@ import { createEventListener } from "./create-event-listener.mjs";
|
|
|
6
6
|
import { createIntersectionObserver } from "./create-intersection-observer.mjs";
|
|
7
7
|
import { createList } from "./create-list.mjs";
|
|
8
8
|
import { createLoopExec } from "./create-loop-exec.mjs";
|
|
9
|
+
import { StaticStoreSetter, createStaticStore } from "./create-static-store.mjs";
|
|
10
|
+
import { PersistedStorage, PersistedStoreOption, createPersistedStore } from "./create-persisted-store.mjs";
|
|
9
11
|
import { MakePresenceOptions, PresencePhase, createPresence } from "./create-presence.mjs";
|
|
10
12
|
import { createThrottle } from "./create-throttle.mjs";
|
|
11
13
|
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./create-visibility-observer.mjs";
|
|
12
14
|
import { createWatch } from "./create-watch.mjs";
|
|
13
|
-
import { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler } from "./utils.mjs";
|
|
15
|
+
import { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./utils.mjs";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Fn } from "../types/fn.mjs";
|
|
2
2
|
import { MaybeArray } from "../types/maybe.mjs";
|
|
3
|
-
import "../types/index.mjs";
|
|
4
|
-
|
|
5
3
|
//#region src/solidjs/make-event-listener.d.ts
|
|
6
4
|
interface InferEventTarget<Events> {
|
|
7
5
|
addEventListener: (event: Events, fn?: any, options?: any) => any;
|
|
@@ -2,7 +2,6 @@ import { isArray } from "../utils/is.mjs";
|
|
|
2
2
|
import { clearArray } from "../utils/array.mjs";
|
|
3
3
|
import { noop } from "../utils/constant.mjs";
|
|
4
4
|
import { onCleanup } from "solid-js";
|
|
5
|
-
|
|
6
5
|
//#region src/solidjs/make-event-listener.ts
|
|
7
6
|
/** biome-ignore-all lint/suspicious/noExplicitAny: I need any */
|
|
8
7
|
function makeEventListener(...args) {
|
|
@@ -30,6 +29,5 @@ function makeEventListener(...args) {
|
|
|
30
29
|
onCleanup(cleanup);
|
|
31
30
|
return cleanup;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
|
-
export { makeEventListener };
|
|
33
|
+
export { makeEventListener };
|
package/dist/solidjs/utils.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { AnyFn } from "../types/fn.mjs";
|
|
1
2
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
3
|
import { JSX } from "solid-js";
|
|
3
4
|
|
|
4
5
|
//#region src/solidjs/utils.d.ts
|
|
5
6
|
declare function access<T>(value: MaybeAccessor<T>): T;
|
|
7
|
+
/** If value is a function – call it with a given arguments – otherwise get the value as is */
|
|
8
|
+
declare function accessWith<T>(valueOrFn: T, ...args: T extends AnyFn ? Parameters<T> : never): T extends AnyFn ? ReturnType<T> : T;
|
|
6
9
|
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
10
|
type MaybeCallableChild<T extends unknown[] = []> = JSX.Element | ((...args: T) => JSX.Element);
|
|
8
11
|
declare function callMaybeCallableChild<T extends unknown[] = []>(children: MaybeCallableChild<T>, ...args: T): JSX.Element;
|
|
9
12
|
//#endregion
|
|
10
|
-
export { MaybeCallableChild, access, callMaybeCallableChild, runSolidEventHandler };
|
|
13
|
+
export { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler };
|
package/dist/solidjs/utils.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { isArray, isFn } from "../utils/is.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/solidjs/utils.ts
|
|
4
3
|
function access(value) {
|
|
5
4
|
return isFn(value) ? value() : value;
|
|
6
5
|
}
|
|
6
|
+
/** If value is a function – call it with a given arguments – otherwise get the value as is */
|
|
7
|
+
function accessWith(valueOrFn, ...args) {
|
|
8
|
+
return isFn(valueOrFn) ? valueOrFn(...args) : valueOrFn;
|
|
9
|
+
}
|
|
7
10
|
function runSolidEventHandler(event, handler) {
|
|
8
11
|
if (isFn(handler)) {
|
|
9
12
|
handler(event);
|
|
@@ -18,6 +21,5 @@ function runSolidEventHandler(event, handler) {
|
|
|
18
21
|
function callMaybeCallableChild(children, ...args) {
|
|
19
22
|
return isFn(children) ? children(...args) : children;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
24
|
//#endregion
|
|
23
|
-
export { access, callMaybeCallableChild, runSolidEventHandler };
|
|
25
|
+
export { access, accessWith, callMaybeCallableChild, runSolidEventHandler };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { AnyFn, Fn } from "./fn.mjs";
|
|
2
|
-
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./maybe.mjs";
|
|
2
|
+
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./maybe.mjs";
|
|
3
|
+
import { SetterParam } from "./solidjs.mjs";
|
package/dist/utils/array.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isFn } from "./is.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/array.ts
|
|
4
3
|
/**
|
|
5
4
|
* Like a reduce but does not require an array.
|
|
@@ -52,15 +51,12 @@ function* range(startOrLength, end, valueOrMapper = (i) => i, step = 1) {
|
|
|
52
51
|
* list(0, 3, obj) // obj, obj, obj, obj
|
|
53
52
|
* list(0, 6, i => i, 2) // 0, 2, 4, 6
|
|
54
53
|
*/
|
|
55
|
-
const list = (startOrLength, end, valueOrMapper, step) =>
|
|
56
|
-
return Array.from(range(startOrLength, end, valueOrMapper, step));
|
|
57
|
-
};
|
|
54
|
+
const list = (startOrLength, end, valueOrMapper, step) => Array.from(range(startOrLength, end, valueOrMapper, step));
|
|
58
55
|
/**
|
|
59
56
|
* set arr.length to 0
|
|
60
57
|
*/
|
|
61
58
|
function clearArray(arr) {
|
|
62
59
|
arr.length = 0;
|
|
63
60
|
}
|
|
64
|
-
|
|
65
61
|
//#endregion
|
|
66
|
-
export { clearArray, iterate, list, range };
|
|
62
|
+
export { clearArray, iterate, list, range };
|
package/dist/utils/async.mjs
CHANGED
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Async wait
|
|
4
4
|
*/
|
|
5
|
-
const sleep = (milliseconds) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return requestAnimationFrame(() => {
|
|
10
|
-
requestAnimationFrame(() => {
|
|
11
|
-
cb();
|
|
12
|
-
});
|
|
5
|
+
const sleep = (milliseconds) => new Promise((res) => setTimeout(res, milliseconds));
|
|
6
|
+
const runAtNextAnimationFrame = (cb) => requestAnimationFrame(() => {
|
|
7
|
+
requestAnimationFrame(() => {
|
|
8
|
+
cb();
|
|
13
9
|
});
|
|
14
|
-
};
|
|
15
|
-
|
|
10
|
+
});
|
|
16
11
|
//#endregion
|
|
17
|
-
export { runAtNextAnimationFrame, sleep };
|
|
12
|
+
export { runAtNextAnimationFrame, sleep };
|
package/dist/utils/constant.mjs
CHANGED
package/dist/utils/is.mjs
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { isServer } from "solid-js/web";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/is.ts
|
|
4
3
|
/** biome-ignore-all lint/suspicious/noExplicitAny: need any */
|
|
5
|
-
const isSymbol = (value) =>
|
|
6
|
-
return !!value && value.constructor === Symbol;
|
|
7
|
-
};
|
|
4
|
+
const isSymbol = (value) => !!value && value.constructor === Symbol;
|
|
8
5
|
const isArray = Array.isArray;
|
|
9
|
-
const isObject = (value) =>
|
|
10
|
-
return !!value && value.constructor === Object;
|
|
11
|
-
};
|
|
6
|
+
const isObject = (value) => !!value && value.constructor === Object;
|
|
12
7
|
/**
|
|
13
8
|
* Checks if the given value is primitive.
|
|
14
9
|
*
|
|
@@ -17,21 +12,11 @@ const isObject = (value) => {
|
|
|
17
12
|
* @param {*} value value to check
|
|
18
13
|
* @returns {boolean} result
|
|
19
14
|
*/
|
|
20
|
-
const isPrimitive = (value) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
const isString = (value) => {
|
|
27
|
-
return typeof value === "string" || value instanceof String;
|
|
28
|
-
};
|
|
29
|
-
const isInt = (value) => {
|
|
30
|
-
return isNumber(value) && value % 1 === 0;
|
|
31
|
-
};
|
|
32
|
-
const isFloat = (value) => {
|
|
33
|
-
return isNumber(value) && value % 1 !== 0;
|
|
34
|
-
};
|
|
15
|
+
const isPrimitive = (value) => value === void 0 || value === null || typeof value !== "object" && typeof value !== "function";
|
|
16
|
+
const isFn = (value) => typeof value === "function";
|
|
17
|
+
const isString = (value) => typeof value === "string" || value instanceof String;
|
|
18
|
+
const isInt = (value) => isNumber(value) && value % 1 === 0;
|
|
19
|
+
const isFloat = (value) => isNumber(value) && value % 1 !== 0;
|
|
35
20
|
const isNumber = (value) => {
|
|
36
21
|
try {
|
|
37
22
|
return Number(value) === value;
|
|
@@ -39,9 +24,7 @@ const isNumber = (value) => {
|
|
|
39
24
|
return false;
|
|
40
25
|
}
|
|
41
26
|
};
|
|
42
|
-
const isDate = (value) =>
|
|
43
|
-
return Object.prototype.toString.call(value) === "[object Date]";
|
|
44
|
-
};
|
|
27
|
+
const isDate = (value) => Object.prototype.toString.call(value) === "[object Date]";
|
|
45
28
|
/**
|
|
46
29
|
* This is really a _best guess_ promise checking. You
|
|
47
30
|
* should probably use Promise.resolve(value) to be 100%
|
|
@@ -73,6 +56,5 @@ function isUndefined(value) {
|
|
|
73
56
|
function isDefined(value) {
|
|
74
57
|
return !isUndefined(value);
|
|
75
58
|
}
|
|
76
|
-
|
|
77
59
|
//#endregion
|
|
78
|
-
export { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined };
|
|
60
|
+
export { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined };
|
package/dist/utils/number.mjs
CHANGED
|
@@ -122,6 +122,5 @@ function inRange(x, minimum = 0, maximum = 1, inclusivity = "[]") {
|
|
|
122
122
|
function toHex(x, pad = 2) {
|
|
123
123
|
return x.toString(16).padStart(pad, "0");
|
|
124
124
|
}
|
|
125
|
-
|
|
126
125
|
//#endregion
|
|
127
|
-
export { clamp, inRange, max, min, toHex };
|
|
126
|
+
export { clamp, inRange, max, min, toHex };
|
package/dist/utils/random.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { iterate } from "./array.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/random.ts
|
|
4
3
|
/**
|
|
5
4
|
* Generates a random number between min and max
|
|
6
5
|
*/
|
|
7
|
-
const random = (min, max) =>
|
|
8
|
-
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
9
|
-
};
|
|
6
|
+
const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min);
|
|
10
7
|
/**
|
|
11
8
|
* Draw a random item from a list. Returns
|
|
12
9
|
* null if the list is empty
|
|
@@ -16,18 +13,13 @@ const draw = (array) => {
|
|
|
16
13
|
if (max === 0) return null;
|
|
17
14
|
return array[random(0, max - 1)];
|
|
18
15
|
};
|
|
19
|
-
const shuffle = (array) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})).sort((a, b) => a.rand - b.rand).map((a) => a.value);
|
|
24
|
-
};
|
|
16
|
+
const shuffle = (array) => array.map((a) => ({
|
|
17
|
+
rand: Math.random(),
|
|
18
|
+
value: a
|
|
19
|
+
})).sort((a, b) => a.rand - b.rand).map((a) => a.value);
|
|
25
20
|
const uid = (length, specials = "") => {
|
|
26
21
|
const characters = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789${specials}`;
|
|
27
|
-
return iterate(length, (acc) =>
|
|
28
|
-
return acc + characters.charAt(random(0, characters.length - 1));
|
|
29
|
-
}, "");
|
|
22
|
+
return iterate(length, (acc) => acc + characters.charAt(random(0, characters.length - 1)), "");
|
|
30
23
|
};
|
|
31
|
-
|
|
32
24
|
//#endregion
|
|
33
|
-
export { draw, random, shuffle, uid };
|
|
25
|
+
export { draw, random, shuffle, uid };
|
package/dist/utils/str.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
const capitalize = (str) => {
|
|
9
9
|
if (!str || str.length === 0) return "";
|
|
10
10
|
const lower = str.toLowerCase();
|
|
11
|
-
return lower.
|
|
11
|
+
return lower.slice(0, 1).toUpperCase() + lower.slice(1, lower.length);
|
|
12
12
|
};
|
|
13
13
|
const splitRegexp = /(?=[A-Z])|[.\-\s_]/;
|
|
14
14
|
/**
|
|
@@ -22,9 +22,7 @@ const camel = (str) => {
|
|
|
22
22
|
const parts = str?.replace(/([A-Z])+/g, capitalize)?.split(splitRegexp).map((x) => x.toLowerCase()) ?? [];
|
|
23
23
|
if (parts.length === 0) return "";
|
|
24
24
|
if (parts.length === 1) return parts[0];
|
|
25
|
-
return parts.reduce((acc, part) => {
|
|
26
|
-
return `${acc}${part.charAt(0).toUpperCase()}${part.slice(1)}`;
|
|
27
|
-
});
|
|
25
|
+
return parts.reduce((acc, part) => `${acc}${part.charAt(0).toUpperCase()}${part.slice(1)}`);
|
|
28
26
|
};
|
|
29
27
|
const splitOnNumberRegexp = /([A-Za-z]{1}[0-9]{1})/;
|
|
30
28
|
/**
|
|
@@ -40,9 +38,7 @@ const snake = (str, options) => {
|
|
|
40
38
|
const parts = str?.replace(/([A-Z])+/g, capitalize).split(splitRegexp).map((x) => x.toLowerCase()) ?? [];
|
|
41
39
|
if (parts.length === 0) return "";
|
|
42
40
|
if (parts.length === 1) return parts[0];
|
|
43
|
-
const result = parts.reduce((acc, part) => {
|
|
44
|
-
return `${acc}_${part.toLowerCase()}`;
|
|
45
|
-
});
|
|
41
|
+
const result = parts.reduce((acc, part) => `${acc}_${part.toLowerCase()}`);
|
|
46
42
|
return options?.splitOnNumber === false ? result : result.replace(splitOnNumberRegexp, (val) => `${val[0]}_${val[1]}`);
|
|
47
43
|
};
|
|
48
44
|
/**
|
|
@@ -56,9 +52,7 @@ const dash = (str) => {
|
|
|
56
52
|
const parts = str?.replace(/([A-Z])+/g, capitalize)?.split(splitRegexp).map((x) => x.toLowerCase()) ?? [];
|
|
57
53
|
if (parts.length === 0) return "";
|
|
58
54
|
if (parts.length === 1) return parts[0];
|
|
59
|
-
return parts.reduce((acc, part) => {
|
|
60
|
-
return `${acc}-${part.toLowerCase()}`;
|
|
61
|
-
});
|
|
55
|
+
return parts.reduce((acc, part) => `${acc}-${part.toLowerCase()}`);
|
|
62
56
|
};
|
|
63
57
|
const pascalSplitRegexp = /[.\-\s_]/;
|
|
64
58
|
/**
|
|
@@ -91,11 +85,7 @@ const title = (str) => {
|
|
|
91
85
|
* Ex. template('Hello, {{name}}', { name: 'ray' })
|
|
92
86
|
* Ex. template('Hello, <name>', { name: 'ray' }, /<(.+?)>/g)
|
|
93
87
|
*/
|
|
94
|
-
const template = (str, data, regex = /\{\{(.+?)\}\}/g) =>
|
|
95
|
-
return Array.from(str.matchAll(regex)).reduce((acc, match) => {
|
|
96
|
-
return acc.replace(match[0], data[match[1]]);
|
|
97
|
-
}, str);
|
|
98
|
-
};
|
|
88
|
+
const template = (str, data, regex = /\{\{(.+?)\}\}/g) => Array.from(str.matchAll(regex)).reduce((acc, match) => acc.replace(match[0], data[match[1]]), str);
|
|
99
89
|
/**
|
|
100
90
|
* Trims all prefix and suffix characters from the given
|
|
101
91
|
* string. Like the builtin trim function but accepts
|
|
@@ -115,6 +105,5 @@ const trim = (str, charsToTrim = " ") => {
|
|
|
115
105
|
const regex = new RegExp(`^[${toTrim}]+|[${toTrim}]+$`, "g");
|
|
116
106
|
return str.replace(regex, "");
|
|
117
107
|
};
|
|
118
|
-
|
|
119
108
|
//#endregion
|
|
120
|
-
export { camel, capitalize, dash, pascal, snake, template, title, trim };
|
|
109
|
+
export { camel, capitalize, dash, pascal, snake, template, title, trim };
|
package/package.json
CHANGED
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
+
"devDependencies": {
|
|
3
|
+
"@biomejs/biome": "2.4.15",
|
|
4
|
+
"@formkit/auto-animate": "^0.9.0",
|
|
5
|
+
"@solidjs/router": "^0.16.1",
|
|
6
|
+
"@solidjs/testing-library": "^0.8.10",
|
|
7
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
8
|
+
"@testing-library/user-event": "^14.6.1",
|
|
9
|
+
"@types/culori": "^4.0.0",
|
|
10
|
+
"@types/node": "^25.0.3",
|
|
11
|
+
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
12
|
+
"@vitest/ui": "^4.0.16",
|
|
13
|
+
"bumpp": "^11.1.0",
|
|
14
|
+
"culori": "^4.0.2",
|
|
15
|
+
"jsdom": "^29.1.1",
|
|
16
|
+
"tsdown": "^0.22.1",
|
|
17
|
+
"ultracite": "7.7.0",
|
|
18
|
+
"unocss": "^66.7.0",
|
|
19
|
+
"vite": "^8.0.14",
|
|
20
|
+
"vite-plugin-solid": "^2.11.12",
|
|
21
|
+
"vite-plugin-solid-pages": "^0.4.3",
|
|
22
|
+
"vitest": "^4.0.16"
|
|
23
|
+
},
|
|
2
24
|
"name": "solid-tiny-utils",
|
|
3
|
-
"
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"solid-js": "^1.9.7"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"version": "0.13.0",
|
|
4
30
|
"description": "A collection of tiny utilities for SolidJS applications",
|
|
5
31
|
"author": "solid tiny",
|
|
6
32
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/
|
|
33
|
+
"homepage": "https://github.com/sxl-cc/solid-tiny-utils#readme",
|
|
8
34
|
"repository": {
|
|
9
35
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
36
|
+
"url": "git+https://github.com/sxl-cc/solid-tiny-utils.git"
|
|
11
37
|
},
|
|
12
38
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/sxl-cc/solid-tiny-utils/issues"
|
|
14
40
|
},
|
|
15
|
-
"type": "module",
|
|
16
41
|
"files": [
|
|
17
42
|
"dist"
|
|
18
43
|
],
|
|
19
44
|
"sideEffects": false,
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"solid-js": "^1.9.7"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@biomejs/biome": "2.3.11",
|
|
25
|
-
"@formkit/auto-animate": "^0.9.0",
|
|
26
|
-
"@solidjs/router": "^0.15.4",
|
|
27
|
-
"@solidjs/testing-library": "^0.8.10",
|
|
28
|
-
"@testing-library/jest-dom": "^6.9.1",
|
|
29
|
-
"@testing-library/user-event": "^14.6.1",
|
|
30
|
-
"@types/culori": "^4.0.0",
|
|
31
|
-
"@types/node": "^25.0.3",
|
|
32
|
-
"@typescript/native-preview": "7.0.0-dev.20260114.1",
|
|
33
|
-
"@vitest/ui": "^4.0.16",
|
|
34
|
-
"bumpp": "^10.3.2",
|
|
35
|
-
"culori": "^4.0.2",
|
|
36
|
-
"jsdom": "^27.3.0",
|
|
37
|
-
"solid-tiny-context": "0.2.3",
|
|
38
|
-
"tsdown": "^0.19.0",
|
|
39
|
-
"ultracite": "7.0.11",
|
|
40
|
-
"unocss": "^66.3.3",
|
|
41
|
-
"vite": "^7.3.0",
|
|
42
|
-
"vite-plugin-solid": "^2.11.10",
|
|
43
|
-
"vite-plugin-solid-pages": "^0.3.5",
|
|
44
|
-
"vitest": "^4.0.16"
|
|
45
|
-
},
|
|
46
45
|
"keywords": [
|
|
47
46
|
"solidjs",
|
|
48
47
|
"solid",
|
|
@@ -58,14 +57,14 @@
|
|
|
58
57
|
"scripts": {
|
|
59
58
|
"build": "tsdown",
|
|
60
59
|
"dev": "vite -c ./playground/vite.config.ts",
|
|
61
|
-
"test": "vitest
|
|
60
|
+
"test": "vitest run",
|
|
62
61
|
"clean": "rimraf dist node_modules pnpm-lock.yaml",
|
|
63
62
|
"test:ui": "vitest --ui",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
63
|
+
"tc": "tsgo --noEmit --skipLibCheck",
|
|
64
|
+
"bump": "pnpm bumpp --no-push",
|
|
65
|
+
"prepublish": "pnpm build",
|
|
66
|
+
"check": "ultracite check",
|
|
67
|
+
"check:error": "ultracite check --diagnostic-level error",
|
|
68
|
+
"fix": "ultracite fix"
|
|
70
69
|
}
|
|
71
70
|
}
|