solid-tiny-utils 0.15.0 → 0.16.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/validation.d.mts +0 -1
- package/dist/dom/css.d.mts +0 -1
- package/dist/dom/index.d.mts +2 -1
- package/dist/index.d.mts +10 -7
- package/dist/solidjs/assign-accessors.d.mts +3 -8
- package/dist/solidjs/assign-accessors.mjs +4 -2
- package/dist/solidjs/create-click-outside.d.mts +1 -0
- package/dist/solidjs/create-debounce-watch.d.mts +0 -1
- package/dist/solidjs/create-debounce.d.mts +1 -0
- package/dist/solidjs/create-easy-context.d.mts +0 -1
- package/dist/solidjs/create-event-listener.d.mts +1 -1
- package/dist/solidjs/create-intersection-observer.d.mts +3 -1
- package/dist/solidjs/create-list.d.mts +0 -1
- package/dist/solidjs/create-loop-exec.d.mts +0 -1
- package/dist/solidjs/create-persisted-store.d.mts +0 -1
- package/dist/solidjs/create-presence.d.mts +1 -1
- package/dist/solidjs/create-static-store.d.mts +1 -0
- package/dist/solidjs/create-static-store.mjs +2 -1
- package/dist/solidjs/create-throttle.d.mts +1 -0
- package/dist/solidjs/create-visibility-observer.d.mts +1 -1
- package/dist/solidjs/create-watch.d.mts +0 -1
- package/dist/solidjs/index.d.mts +2 -1
- package/dist/solidjs/make-event-listener.d.mts +1 -0
- package/dist/solidjs/utils.d.mts +1 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/maybe.d.mts +0 -1
- package/dist/types/solidjs.d.mts +0 -1
- package/package.json +4 -4
package/dist/color/hex-rgb.d.mts
CHANGED
package/dist/dom/css.d.mts
CHANGED
package/dist/dom/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { hasAnimation } from "./animation.mjs";
|
|
2
2
|
import { dataIf } from "./attrs.mjs";
|
|
3
|
-
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./css.mjs";
|
|
3
|
+
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./css.mjs";
|
|
4
|
+
export { combineClass, combineStyle, dataIf, hasAnimation, mountStyle, stringStyleToObject };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,16 +4,25 @@ import { isValidHex, isValidOKLCH, isValidRGB } from "./color/validation.mjs";
|
|
|
4
4
|
import { hasAnimation } from "./dom/animation.mjs";
|
|
5
5
|
import { dataIf } from "./dom/attrs.mjs";
|
|
6
6
|
import { combineClass, combineStyle, mountStyle, stringStyleToObject } from "./dom/css.mjs";
|
|
7
|
+
import "./dom/index.mjs";
|
|
7
8
|
import { assignAccessors } from "./solidjs/assign-accessors.mjs";
|
|
8
9
|
import { AnyFn, Fn } from "./types/fn.mjs";
|
|
9
10
|
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./types/maybe.mjs";
|
|
10
11
|
import { SetterParam } from "./types/solidjs.mjs";
|
|
12
|
+
import "./types/index.mjs";
|
|
11
13
|
import { createClickOutside } from "./solidjs/create-click-outside.mjs";
|
|
12
14
|
import { createDebounce } from "./solidjs/create-debounce.mjs";
|
|
13
15
|
import { createDebouncedWatch } from "./solidjs/create-debounce-watch.mjs";
|
|
14
16
|
import { EasyContext, createEasyContext } from "./solidjs/create-easy-context.mjs";
|
|
15
17
|
import { DocumentEventName, GeneralEventListener, WindowEventName, makeEventListener } from "./solidjs/make-event-listener.mjs";
|
|
16
18
|
import { createEventListener } from "./solidjs/create-event-listener.mjs";
|
|
19
|
+
import { clearArray, iterate, list, range } from "./utils/array.mjs";
|
|
20
|
+
import { runAtNextAnimationFrame, sleep } from "./utils/async.mjs";
|
|
21
|
+
import { noop } from "./utils/constant.mjs";
|
|
22
|
+
import { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined } from "./utils/is.mjs";
|
|
23
|
+
import { clamp, inRange, max, min, toHex } from "./utils/number.mjs";
|
|
24
|
+
import { draw, random, shuffle, uid } from "./utils/random.mjs";
|
|
25
|
+
import { camel, capitalize, dash, pascal, snake, template, title, trim } from "./utils/str.mjs";
|
|
17
26
|
import { createIntersectionObserver } from "./solidjs/create-intersection-observer.mjs";
|
|
18
27
|
import { createList } from "./solidjs/create-list.mjs";
|
|
19
28
|
import { createLoopExec } from "./solidjs/create-loop-exec.mjs";
|
|
@@ -24,11 +33,5 @@ import { createThrottle } from "./solidjs/create-throttle.mjs";
|
|
|
24
33
|
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./solidjs/create-visibility-observer.mjs";
|
|
25
34
|
import { createWatch } from "./solidjs/create-watch.mjs";
|
|
26
35
|
import { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./solidjs/utils.mjs";
|
|
27
|
-
import
|
|
28
|
-
import { runAtNextAnimationFrame, sleep } from "./utils/async.mjs";
|
|
29
|
-
import { noop } from "./utils/constant.mjs";
|
|
30
|
-
import { isArray, isClient, isDate, isDefined, isEmpty, isFloat, isFn, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, isUndefined } from "./utils/is.mjs";
|
|
31
|
-
import { clamp, inRange, max, min, toHex } from "./utils/number.mjs";
|
|
32
|
-
import { draw, random, shuffle, uid } from "./utils/random.mjs";
|
|
33
|
-
import { camel, capitalize, dash, pascal, snake, template, title, trim } from "./utils/str.mjs";
|
|
36
|
+
import "./solidjs/index.mjs";
|
|
34
37
|
export { AnyFn, CreateVisibilityObserverOption, DocumentEventName, EasyContext, EntryCallback, Fn, GeneralEventListener, MakePresenceOptions, MaybeAccessor, MaybeArray, MaybeCallableChild, MaybeNullableAccessor, MaybePromise, OKLCH, PersistedStorage, PersistedStoreOption, PresencePhase, RGB, SetterParam, StaticStoreSetter, UseVisibilityObserverFn, WindowEventName, access, accessWith, assignAccessors, callMaybeCallableChild, camel, capitalize, clamp, clearArray, combineClass, combineStyle, createClickOutside, createDebounce, createDebouncedWatch, createEasyContext, 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,13 +1,8 @@
|
|
|
1
1
|
import { Accessor } from "solid-js";
|
|
2
|
-
|
|
3
2
|
//#region src/solidjs/assign-accessors.d.ts
|
|
4
3
|
type AccessorRecord = Record<PropertyKey, Accessor<unknown>>;
|
|
5
|
-
type AccessorValues<T extends AccessorRecord> = { readonly [K in keyof T]: ReturnType<T[K]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
* `append` keys must not already exist on `base`.
|
|
10
|
-
*/
|
|
11
|
-
declare function assignAccessors<Base extends object, Append extends AccessorRecord>(base: Base, append: Append & { [K in keyof Base]?: never }): Readonly<Base & AccessorValues<Append>>;
|
|
4
|
+
type AccessorValues<T extends AccessorRecord> = { readonly [K in keyof T]: ReturnType<T[K]>; };
|
|
5
|
+
declare function assignAccessors<Append extends AccessorRecord>(append: Append): Readonly<AccessorValues<Append>>;
|
|
6
|
+
declare function assignAccessors<Base extends object, Append extends AccessorRecord>(base: Base, append: Append): Readonly<Omit<Base, keyof AccessorValues<Append>> & AccessorValues<Append>>;
|
|
12
7
|
//#endregion
|
|
13
8
|
export { assignAccessors };
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Assigns accessor-backed getters to an object.
|
|
4
4
|
*
|
|
5
|
-
* `append` keys
|
|
5
|
+
* `append` keys override keys that already exist on `base`.
|
|
6
6
|
*/
|
|
7
7
|
function assignAccessors(base, append) {
|
|
8
|
-
|
|
8
|
+
if (!append) return assignAccessors({}, base);
|
|
9
|
+
for (const key in append) if (Object.hasOwn(append, key)) Object.defineProperty(base, key, {
|
|
9
10
|
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
10
12
|
get: append[key]
|
|
11
13
|
});
|
|
12
14
|
return base;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
//#region src/solidjs/create-click-outside.d.ts
|
|
3
4
|
declare function createClickOutside(target: MaybeAccessor<HTMLElement | null | undefined>, handler: (event: PointerEvent) => void, options?: {
|
|
4
5
|
ignore?: MaybeAccessor<HTMLElement | null | undefined>[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
//#region src/solidjs/create-debounce.d.ts
|
|
3
4
|
declare function createDebounce<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
4
5
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fn } from "../types/fn.mjs";
|
|
2
2
|
import { MaybeAccessor, MaybeArray } from "../types/maybe.mjs";
|
|
3
|
+
import "../types/index.mjs";
|
|
3
4
|
import { DocumentEventName, GeneralEventListener, WindowEventName } from "./make-event-listener.mjs";
|
|
4
|
-
|
|
5
5
|
//#region src/solidjs/create-event-listener.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Overload 2: Explicitly Window target
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
3
|
+
import { noop } from "../utils/constant.mjs";
|
|
2
4
|
//#region src/solidjs/create-intersection-observer.d.ts
|
|
3
|
-
declare function createIntersectionObserver(targets: MaybeAccessor<HTMLElement | null | undefined>[], callback: IntersectionObserverCallback, options?: IntersectionObserverInit):
|
|
5
|
+
declare function createIntersectionObserver(targets: MaybeAccessor<HTMLElement | null | undefined>[], callback: IntersectionObserverCallback, options?: IntersectionObserverInit): typeof noop;
|
|
4
6
|
//#endregion
|
|
5
7
|
export { createIntersectionObserver };
|
|
@@ -33,7 +33,8 @@ function createStaticStore(init) {
|
|
|
33
33
|
};
|
|
34
34
|
for (const key in init) if (Object.hasOwn(init, key)) Object.defineProperty(store, key, {
|
|
35
35
|
get: () => getValue(key),
|
|
36
|
-
enumerable: true
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true
|
|
37
38
|
});
|
|
38
39
|
const setValue = (key, value) => {
|
|
39
40
|
const signal = cache[key];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
//#region src/solidjs/create-throttle.d.ts
|
|
3
4
|
declare function createThrottle<Args extends unknown[]>(callback: (...args: Args) => void, delay: MaybeAccessor<number>): (...args: Args) => void;
|
|
4
5
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MaybeNullableAccessor } from "../types/maybe.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
import { Accessor } from "solid-js";
|
|
3
|
-
|
|
4
4
|
//#region src/solidjs/create-visibility-observer.d.ts
|
|
5
5
|
type UseVisibilityObserverFn = (target: MaybeNullableAccessor<HTMLElement>) => Accessor<boolean>;
|
|
6
6
|
type CreateVisibilityObserverOption = IntersectionObserverInit & {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accessor, AccessorArray, OnEffectFunction, OnOptions } from "solid-js";
|
|
2
|
-
|
|
3
2
|
//#region src/solidjs/create-watch.d.ts
|
|
4
3
|
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
4
|
//#endregion
|
package/dist/solidjs/index.d.mts
CHANGED
|
@@ -14,4 +14,5 @@ import { MakePresenceOptions, PresencePhase, createPresence } from "./create-pre
|
|
|
14
14
|
import { createThrottle } from "./create-throttle.mjs";
|
|
15
15
|
import { CreateVisibilityObserverOption, EntryCallback, UseVisibilityObserverFn, createVisibilityObserver } from "./create-visibility-observer.mjs";
|
|
16
16
|
import { createWatch } from "./create-watch.mjs";
|
|
17
|
-
import { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./utils.mjs";
|
|
17
|
+
import { MaybeCallableChild, access, accessWith, callMaybeCallableChild, runSolidEventHandler } from "./utils.mjs";
|
|
18
|
+
export { CreateVisibilityObserverOption, DocumentEventName, EasyContext, EntryCallback, GeneralEventListener, MakePresenceOptions, MaybeCallableChild, PersistedStorage, PersistedStoreOption, PresencePhase, StaticStoreSetter, UseVisibilityObserverFn, WindowEventName, access, accessWith, assignAccessors, callMaybeCallableChild, createClickOutside, createDebounce, createDebouncedWatch, createEasyContext, createEventListener, createIntersectionObserver, createList, createLoopExec, createPersistedStore, createPresence, createStaticStore, createThrottle, createVisibilityObserver, createWatch, makeEventListener, runSolidEventHandler };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fn } from "../types/fn.mjs";
|
|
2
2
|
import { MaybeArray } from "../types/maybe.mjs";
|
|
3
|
+
import "../types/index.mjs";
|
|
3
4
|
//#region src/solidjs/make-event-listener.d.ts
|
|
4
5
|
interface InferEventTarget<Events> {
|
|
5
6
|
addEventListener: (event: Events, fn?: any, options?: any) => any;
|
package/dist/solidjs/utils.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyFn } from "../types/fn.mjs";
|
|
2
2
|
import { MaybeAccessor } from "../types/maybe.mjs";
|
|
3
|
+
import "../types/index.mjs";
|
|
3
4
|
import { JSX } from "solid-js";
|
|
4
|
-
|
|
5
5
|
//#region src/solidjs/utils.d.ts
|
|
6
6
|
declare function access<T>(value: MaybeAccessor<T>): T;
|
|
7
7
|
/** If value is a function – call it with a given arguments – otherwise get the value as is */
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { AnyFn, Fn } from "./fn.mjs";
|
|
2
2
|
import { MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise } from "./maybe.mjs";
|
|
3
|
-
import { SetterParam } from "./solidjs.mjs";
|
|
3
|
+
import { SetterParam } from "./solidjs.mjs";
|
|
4
|
+
export { AnyFn, Fn, MaybeAccessor, MaybeArray, MaybeNullableAccessor, MaybePromise, SetterParam };
|
package/dist/types/maybe.d.mts
CHANGED
package/dist/types/solidjs.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"@testing-library/user-event": "^14.6.1",
|
|
9
9
|
"@types/culori": "^4.0.0",
|
|
10
10
|
"@types/node": "^25.0.3",
|
|
11
|
-
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
12
11
|
"@vitest/ui": "^4.0.16",
|
|
13
12
|
"bumpp": "^11.1.0",
|
|
14
13
|
"culori": "^4.0.2",
|
|
15
14
|
"jsdom": "^29.1.1",
|
|
16
|
-
"tsdown": "^0.22.
|
|
15
|
+
"tsdown": "^0.22.7",
|
|
16
|
+
"typescript": "^7.0.2",
|
|
17
17
|
"ultracite": "7.7.0",
|
|
18
18
|
"unocss": "^66.7.0",
|
|
19
19
|
"vite": "^8.0.14",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"solid-js": "^1.9.7"
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
29
|
-
"version": "0.
|
|
29
|
+
"version": "0.16.0",
|
|
30
30
|
"description": "A collection of tiny utilities for SolidJS applications",
|
|
31
31
|
"author": "solid tiny",
|
|
32
32
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"test": "vitest run",
|
|
61
61
|
"clean": "rimraf dist node_modules pnpm-lock.yaml",
|
|
62
62
|
"test:ui": "vitest --ui",
|
|
63
|
-
"tc": "
|
|
63
|
+
"tc": "tsc --noEmit --skipLibCheck",
|
|
64
64
|
"bump": "pnpm bumpp --no-push",
|
|
65
65
|
"prepublish": "pnpm build",
|
|
66
66
|
"check": "ultracite check",
|