@solid-primitives/utils 4.0.0 → 5.0.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/index.cjs +44 -57
- package/dist/index.d.ts +46 -46
- package/dist/index.js +25 -17
- package/package.json +6 -14
package/dist/index.cjs
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var solidJs = require('solid-js');
|
|
6
4
|
var web = require('solid-js/web');
|
|
7
5
|
|
|
8
6
|
// src/index.ts
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
exports.noop = () => void 0;
|
|
8
|
+
exports.isServer = web.isServer;
|
|
9
|
+
exports.isClient = !exports.isServer;
|
|
10
|
+
exports.isDev = solidJs.DEV && exports.isClient;
|
|
11
|
+
exports.isProd = !exports.isDev;
|
|
12
|
+
exports.ofClass = (v, c) => v instanceof c || v && v.constructor === c;
|
|
15
13
|
function isObject(value) {
|
|
16
14
|
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
exports.compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
17
|
+
exports.arrayEquals = (a, b) => a === b || a.length === b.length && a.every((e, i) => e === b[i]);
|
|
20
18
|
function chain(callbacks) {
|
|
21
19
|
return (...args) => {
|
|
22
20
|
for (const callback of callbacks) {
|
|
@@ -25,22 +23,44 @@ function chain(callbacks) {
|
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const _value = access(value);
|
|
26
|
+
exports.clamp = (n, min, max) => Math.min(Math.max(n, min), max);
|
|
27
|
+
exports.access = (v) => typeof v === "function" && !v.length ? v() : v;
|
|
28
|
+
exports.asArray = (value) => Array.isArray(value) ? value : [value];
|
|
29
|
+
exports.accessArray = (list) => list.map((v) => exports.access(v));
|
|
30
|
+
exports.withAccess = (value, fn) => {
|
|
31
|
+
const _value = exports.access(value);
|
|
34
32
|
typeof _value !== "undefined" && _value !== null && fn(_value);
|
|
35
33
|
};
|
|
36
|
-
|
|
34
|
+
exports.asAccessor = (v) => typeof v === "function" ? v : () => v;
|
|
37
35
|
function accessWith(valueOrFn, ...args) {
|
|
38
36
|
return typeof valueOrFn === "function" ? valueOrFn(...args) : valueOrFn;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
function defer(deps, fn, initialValue) {
|
|
39
|
+
const isArray = Array.isArray(deps);
|
|
40
|
+
let prevInput;
|
|
41
|
+
let shouldDefer = true;
|
|
42
|
+
return (prevValue) => {
|
|
43
|
+
let input;
|
|
44
|
+
if (isArray) {
|
|
45
|
+
input = Array(deps.length);
|
|
46
|
+
for (let i = 0; i < deps.length; i++)
|
|
47
|
+
input[i] = deps[i]();
|
|
48
|
+
} else
|
|
49
|
+
input = deps();
|
|
50
|
+
if (shouldDefer) {
|
|
51
|
+
shouldDefer = false;
|
|
52
|
+
prevInput = input;
|
|
53
|
+
return initialValue;
|
|
54
|
+
}
|
|
55
|
+
const result = solidJs.untrack(() => fn(input, prevInput, prevValue));
|
|
56
|
+
prevInput = input;
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.entries = Object.entries;
|
|
61
|
+
exports.keys = Object.keys;
|
|
62
|
+
exports.tryOnCleanup = (fn) => solidJs.getOwner() ? solidJs.onCleanup(fn) : fn;
|
|
63
|
+
exports.createCallbackStack = () => {
|
|
44
64
|
let stack = [];
|
|
45
65
|
const clear = () => stack = [];
|
|
46
66
|
return {
|
|
@@ -60,19 +80,6 @@ function createMicrotask(fn) {
|
|
|
60
80
|
queueMicrotask(() => --calls === 0 && fn(...args));
|
|
61
81
|
};
|
|
62
82
|
}
|
|
63
|
-
function createProxy(traps) {
|
|
64
|
-
return new Proxy(
|
|
65
|
-
{},
|
|
66
|
-
{
|
|
67
|
-
get: (_, k) => traps.get(k),
|
|
68
|
-
set: (_, k, v) => {
|
|
69
|
-
var _a;
|
|
70
|
-
(_a = traps.set) == null ? void 0 : _a.call(traps, k, v);
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
83
|
function createStaticStore(init) {
|
|
77
84
|
const copy = { ...init };
|
|
78
85
|
const store = {};
|
|
@@ -95,7 +102,7 @@ function createStaticStore(init) {
|
|
|
95
102
|
if (key in copy)
|
|
96
103
|
copy[key] = accessWith(value, [copy[key]]);
|
|
97
104
|
};
|
|
98
|
-
for (const key of keys(init)) {
|
|
105
|
+
for (const key of exports.keys(init)) {
|
|
99
106
|
store[key] = void 0;
|
|
100
107
|
Object.defineProperty(store, key, {
|
|
101
108
|
get: getValue.bind(void 0, key)
|
|
@@ -105,7 +112,7 @@ function createStaticStore(init) {
|
|
|
105
112
|
if (isObject(a))
|
|
106
113
|
solidJs.untrack(() => {
|
|
107
114
|
solidJs.batch(() => {
|
|
108
|
-
for (const [key, value] of entries(accessWith(a, store)))
|
|
115
|
+
for (const [key, value] of exports.entries(accessWith(a, store)))
|
|
109
116
|
setValue(key, () => value);
|
|
110
117
|
});
|
|
111
118
|
});
|
|
@@ -146,31 +153,11 @@ function handleDiffArray(current, prev, handleAdded, handleRemoved) {
|
|
|
146
153
|
handleAdded(currEl);
|
|
147
154
|
}
|
|
148
155
|
}
|
|
149
|
-
var forEachEntry = (obj, fn) => Object.entries(obj).forEach(([key, value]) => fn(key, value));
|
|
150
156
|
|
|
151
|
-
exports.access = access;
|
|
152
|
-
exports.accessArray = accessArray;
|
|
153
157
|
exports.accessWith = accessWith;
|
|
154
|
-
exports.arrayEquals = arrayEquals;
|
|
155
|
-
exports.asAccessor = asAccessor;
|
|
156
|
-
exports.asArray = asArray;
|
|
157
158
|
exports.chain = chain;
|
|
158
|
-
exports.clamp = clamp;
|
|
159
|
-
exports.compare = compare;
|
|
160
|
-
exports.createCallbackStack = createCallbackStack;
|
|
161
159
|
exports.createMicrotask = createMicrotask;
|
|
162
|
-
exports.createProxy = createProxy;
|
|
163
160
|
exports.createStaticStore = createStaticStore;
|
|
164
|
-
exports.
|
|
165
|
-
exports.forEachEntry = forEachEntry;
|
|
161
|
+
exports.defer = defer;
|
|
166
162
|
exports.handleDiffArray = handleDiffArray;
|
|
167
|
-
exports.isClient = isClient;
|
|
168
|
-
exports.isDev = isDev;
|
|
169
163
|
exports.isObject = isObject;
|
|
170
|
-
exports.isProd = isProd;
|
|
171
|
-
exports.isServer = isServer;
|
|
172
|
-
exports.keys = keys;
|
|
173
|
-
exports.noop = noop;
|
|
174
|
-
exports.ofClass = ofClass;
|
|
175
|
-
exports.onRootCleanup = onRootCleanup;
|
|
176
|
-
exports.withAccess = withAccess;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { Accessor, Setter, onCleanup } from 'solid-js';
|
|
1
|
+
import { Accessor, Setter, AccessorArray, NoInfer, EffectFunction, onCleanup } from 'solid-js';
|
|
2
|
+
export { EffectOptions, MemoOptions, OnOptions, SignalOptions } from 'solid-js/types/reactive/signal';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Can be single or in an array
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type Many<T> = T | T[];
|
|
8
|
+
type Values<O extends Object> = O[keyof O];
|
|
9
|
+
type Noop = (...a: any[]) => void;
|
|
10
|
+
type Directive<P = true> = (el: Element, props: Accessor<P>) => void;
|
|
10
11
|
/**
|
|
11
12
|
* Infers the type of the array elements
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type ItemsOf<T> = T extends (infer E)[] ? E : never;
|
|
15
|
+
type ItemsOfMany<T> = T extends any[] ? ItemsOf<T> : T;
|
|
16
|
+
type SetterParam<T> = Parameters<Setter<T>>[0];
|
|
16
17
|
/**
|
|
17
18
|
* T or a reactive/non-reactive function returning T
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
type MaybeAccessor<T> = T | Accessor<T>;
|
|
20
21
|
/**
|
|
21
22
|
* Accessed value of a MaybeAccessor
|
|
22
23
|
* @example
|
|
@@ -29,51 +30,51 @@ declare type MaybeAccessor<T> = T | Accessor<T>;
|
|
|
29
30
|
* // => string | void
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
type MaybeAccessorValue<T extends MaybeAccessor<any>> = T extends () => any ? ReturnType<T> : T;
|
|
34
|
+
type OnAccessEffectFunction<S, Prev, Next extends Prev = Prev> = (input: AccessReturnTypes<S>, prevInput: AccessReturnTypes<S>, v: Prev) => Next;
|
|
35
|
+
type AccessReturnTypes<S> = S extends MaybeAccessor<any>[] ? {
|
|
35
36
|
[I in keyof S]: AccessReturnTypes<S[I]>;
|
|
36
37
|
} : MaybeAccessorValue<S>;
|
|
37
38
|
/** Allows to make shallow overwrites to an interface */
|
|
38
|
-
|
|
39
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
39
40
|
/** Allows to make nested overwrites to an interface */
|
|
40
|
-
|
|
41
|
+
type ModifyDeep<A extends AnyObject, B extends DeepPartialAny<A>> = {
|
|
41
42
|
[K in keyof A]: B[K] extends never ? A[K] : B[K] extends AnyObject ? ModifyDeep<A[K], B[K]> : B[K];
|
|
42
43
|
} & (A extends AnyObject ? Omit<B, keyof A> : A);
|
|
43
44
|
/** Makes each property optional and turns each leaf property into any, allowing for type overrides by narrowing any. */
|
|
44
|
-
|
|
45
|
+
type DeepPartialAny<T> = {
|
|
45
46
|
[P in keyof T]?: T[P] extends AnyObject ? DeepPartialAny<T[P]> : any;
|
|
46
47
|
};
|
|
47
48
|
/** Removes the `[...list]` functionality */
|
|
48
|
-
|
|
49
|
+
type NonIterable<T> = T & {
|
|
49
50
|
[Symbol.iterator]: never;
|
|
50
51
|
};
|
|
51
52
|
/** Unwraps the type definition of an object, making it more readable */
|
|
52
|
-
|
|
53
|
+
type Simplify<T> = T extends object ? {
|
|
53
54
|
[K in keyof T]: T[K];
|
|
54
55
|
} : T;
|
|
55
56
|
/** Unboxes type definition, making it more readable */
|
|
56
|
-
|
|
57
|
+
type UnboxLazy<T> = T extends () => infer U ? U : T;
|
|
57
58
|
/** Get the required keys of an object */
|
|
58
|
-
|
|
59
|
+
type RequiredKeys<T> = keyof {
|
|
59
60
|
[K in keyof T as T extends {
|
|
60
61
|
[_ in K]: unknown;
|
|
61
62
|
} ? K : never]: 0;
|
|
62
63
|
};
|
|
63
64
|
/** Remove the first item of a tuple [1, 2, 3, 4] => [2, 3, 4] */
|
|
64
|
-
|
|
65
|
+
type Tail<T extends any[]> = ((...t: T) => void) extends (x: any, ...u: infer U) => void ? U : never;
|
|
65
66
|
/** `A | B => A & B` */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
68
|
+
type ExtractIfPossible<T, U> = Extract<T, U> extends never ? U : Extract<T, U>;
|
|
69
|
+
type AnyObject = Record<PropertyKey, any>;
|
|
70
|
+
type AnyStatic = [] | any[] | AnyObject;
|
|
71
|
+
type AnyFunction = (...args: any[]) => any;
|
|
72
|
+
type AnyClass = abstract new (...args: any) => any;
|
|
73
|
+
type PrimitiveValue = PropertyKey | boolean | bigint | null | undefined;
|
|
74
|
+
type FalsyValue = false | 0 | "" | null | undefined;
|
|
75
|
+
type Truthy<T> = Exclude<T, FalsyValue>;
|
|
76
|
+
type Falsy<T> = Extract<T, FalsyValue>;
|
|
77
|
+
type Position = {
|
|
77
78
|
x: number;
|
|
78
79
|
y: number;
|
|
79
80
|
};
|
|
@@ -113,7 +114,7 @@ declare const clamp: (n: number, min: number, max: number) => number;
|
|
|
113
114
|
* ```
|
|
114
115
|
*/
|
|
115
116
|
declare const access: <T extends unknown>(v: T) => MaybeAccessorValue<T>;
|
|
116
|
-
declare const asArray: <T>(value: T) => T extends any[] ? T : T[];
|
|
117
|
+
declare const asArray: <T>(value: T) => (T extends any[] ? T[number] : T)[];
|
|
117
118
|
/**
|
|
118
119
|
* Access an array of MaybeAccessors
|
|
119
120
|
* @example
|
|
@@ -130,6 +131,15 @@ declare const withAccess: <T, A extends MaybeAccessor<T>, V = MaybeAccessorValue
|
|
|
130
131
|
declare const asAccessor: <A extends unknown>(v: A) => Accessor<MaybeAccessorValue<A>>;
|
|
131
132
|
/** If value is a function – call it with a given arguments – otherwise get the value as is */
|
|
132
133
|
declare function accessWith<T>(valueOrFn: T, ...args: T extends AnyFunction ? Parameters<T> : never): T extends AnyFunction ? ReturnType<T> : T;
|
|
134
|
+
/**
|
|
135
|
+
* Solid's `on` helper, but always defers and returns a provided initial value when if does instead of `undefined`.
|
|
136
|
+
*
|
|
137
|
+
* @param deps
|
|
138
|
+
* @param fn
|
|
139
|
+
* @param initialValue
|
|
140
|
+
*/
|
|
141
|
+
declare function defer<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: (input: S, prevInput: S, prev: undefined | NoInfer<Prev>) => Next, initialValue: Next): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
142
|
+
declare function defer<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: (input: S, prevInput: S, prev: undefined | NoInfer<Prev>) => Next, initialValue?: undefined): EffectFunction<undefined | NoInfer<Next>>;
|
|
133
143
|
/**
|
|
134
144
|
* Get entries of an object
|
|
135
145
|
*/
|
|
@@ -141,7 +151,7 @@ declare const keys: <T extends object>(object: T) => (keyof T)[];
|
|
|
141
151
|
/**
|
|
142
152
|
* Solid's `onCleanup` that is registered only if there is a root.
|
|
143
153
|
*/
|
|
144
|
-
declare const
|
|
154
|
+
declare const tryOnCleanup: typeof onCleanup;
|
|
145
155
|
declare const createCallbackStack: <A0 = void, A1 = void, A2 = void, A3 = void>() => {
|
|
146
156
|
push: (...callbacks: ((arg0: A0, arg1: A1, arg2: A2, arg3: A3) => void)[]) => void;
|
|
147
157
|
execute: (arg0: A0, arg1: A1, arg2: A2, arg3: A3) => void;
|
|
@@ -153,19 +163,10 @@ declare const createCallbackStack: <A0 = void, A1 = void, A2 = void, A3 = void>(
|
|
|
153
163
|
* @returns `fn`
|
|
154
164
|
*/
|
|
155
165
|
declare function createMicrotask<A extends any[] | []>(fn: (...a: A) => void): (...a: A) => void;
|
|
156
|
-
|
|
157
|
-
declare function createProxy<T extends Record<string | symbol, any>>(traps: {
|
|
158
|
-
get: <K extends keyof T>(key: K) => T[K];
|
|
159
|
-
set: <K extends keyof T>(key: K, value: T[K]) => void;
|
|
160
|
-
}): T;
|
|
161
|
-
declare function createProxy<T extends Record<string | symbol, any>>(traps: {
|
|
162
|
-
get: <K extends keyof T>(key: K) => T[K];
|
|
163
|
-
set?: undefined;
|
|
164
|
-
}): Readonly<T>;
|
|
165
|
-
declare type StaticStoreSetter<T extends Readonly<AnyStatic>> = {
|
|
166
|
+
type StaticStoreSetter<T extends Readonly<AnyStatic>> = {
|
|
166
167
|
(setter: (prev: T) => Partial<T>): T;
|
|
167
168
|
(state: Partial<T>): T;
|
|
168
|
-
<K extends keyof T>(key: K, state:
|
|
169
|
+
<K extends keyof T>(key: K, state: SetterParam<T[K]>): T;
|
|
169
170
|
};
|
|
170
171
|
/**
|
|
171
172
|
* A shallowly wrapped reactive store object. It behaves similarly to the createStore, but with limited features to keep it simple. Designed to be used for reactive objects with static keys, but dynamic values, like reactive Event State, location, etc.
|
|
@@ -185,6 +186,5 @@ declare function createStaticStore<T extends Readonly<AnyStatic>>(init: T): [acc
|
|
|
185
186
|
* @param handleRemoved called once for every removed from array
|
|
186
187
|
*/
|
|
187
188
|
declare function handleDiffArray<T>(current: readonly T[], prev: readonly T[], handleAdded: (item: T) => void, handleRemoved: (item: T) => void): void;
|
|
188
|
-
declare const forEachEntry: <T>(obj: Record<string, T>, fn: (key: string, value: T) => void) => void;
|
|
189
189
|
|
|
190
|
-
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys,
|
|
190
|
+
export { AccessReturnTypes, AnyClass, AnyFunction, AnyObject, AnyStatic, DeepPartialAny, Directive, ExtractIfPossible, Falsy, FalsyValue, ItemsOf, ItemsOfMany, Many, MaybeAccessor, MaybeAccessorValue, Modify, ModifyDeep, NonIterable, Noop, OnAccessEffectFunction, Position, PrimitiveValue, RequiredKeys, SetterParam, Simplify, StaticStoreSetter, Tail, Truthy, UnboxLazy, UnionToIntersection, Values, access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEV, getOwner, onCleanup, createSignal,
|
|
1
|
+
import { DEV, untrack, getOwner, onCleanup, createSignal, batch } from 'solid-js';
|
|
2
2
|
import { isServer as isServer$1 } from 'solid-js/web';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
@@ -33,9 +33,31 @@ var asAccessor = (v) => typeof v === "function" ? v : () => v;
|
|
|
33
33
|
function accessWith(valueOrFn, ...args) {
|
|
34
34
|
return typeof valueOrFn === "function" ? valueOrFn(...args) : valueOrFn;
|
|
35
35
|
}
|
|
36
|
+
function defer(deps, fn, initialValue) {
|
|
37
|
+
const isArray = Array.isArray(deps);
|
|
38
|
+
let prevInput;
|
|
39
|
+
let shouldDefer = true;
|
|
40
|
+
return (prevValue) => {
|
|
41
|
+
let input;
|
|
42
|
+
if (isArray) {
|
|
43
|
+
input = Array(deps.length);
|
|
44
|
+
for (let i = 0; i < deps.length; i++)
|
|
45
|
+
input[i] = deps[i]();
|
|
46
|
+
} else
|
|
47
|
+
input = deps();
|
|
48
|
+
if (shouldDefer) {
|
|
49
|
+
shouldDefer = false;
|
|
50
|
+
prevInput = input;
|
|
51
|
+
return initialValue;
|
|
52
|
+
}
|
|
53
|
+
const result = untrack(() => fn(input, prevInput, prevValue));
|
|
54
|
+
prevInput = input;
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
36
58
|
var entries = Object.entries;
|
|
37
59
|
var keys = Object.keys;
|
|
38
|
-
var
|
|
60
|
+
var tryOnCleanup = (fn) => getOwner() ? onCleanup(fn) : fn;
|
|
39
61
|
var createCallbackStack = () => {
|
|
40
62
|
let stack = [];
|
|
41
63
|
const clear = () => stack = [];
|
|
@@ -56,19 +78,6 @@ function createMicrotask(fn) {
|
|
|
56
78
|
queueMicrotask(() => --calls === 0 && fn(...args));
|
|
57
79
|
};
|
|
58
80
|
}
|
|
59
|
-
function createProxy(traps) {
|
|
60
|
-
return new Proxy(
|
|
61
|
-
{},
|
|
62
|
-
{
|
|
63
|
-
get: (_, k) => traps.get(k),
|
|
64
|
-
set: (_, k, v) => {
|
|
65
|
-
var _a;
|
|
66
|
-
(_a = traps.set) == null ? void 0 : _a.call(traps, k, v);
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
81
|
function createStaticStore(init) {
|
|
73
82
|
const copy = { ...init };
|
|
74
83
|
const store = {};
|
|
@@ -142,6 +151,5 @@ function handleDiffArray(current, prev, handleAdded, handleRemoved) {
|
|
|
142
151
|
handleAdded(currEl);
|
|
143
152
|
}
|
|
144
153
|
}
|
|
145
|
-
var forEachEntry = (obj, fn) => Object.entries(obj).forEach(([key, value]) => fn(key, value));
|
|
146
154
|
|
|
147
|
-
export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask,
|
|
155
|
+
export { access, accessArray, accessWith, arrayEquals, asAccessor, asArray, chain, clamp, compare, createCallbackStack, createMicrotask, createStaticStore, defer, entries, handleDiffArray, isClient, isDev, isObject, isProd, isServer, keys, noop, ofClass, tryOnCleanup, withAccess };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solid-primitives/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A bunch of reactive utility types and functions, for building primitives with Solid.js",
|
|
5
5
|
"author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"main": "./dist/index.cjs",
|
|
22
22
|
"module": "./dist/index.js",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
|
+
"browser": {},
|
|
24
25
|
"exports": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
28
29
|
},
|
|
29
|
-
"import": "./dist/index.js",
|
|
30
30
|
"require": "./dist/index.cjs"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
@@ -35,18 +35,10 @@
|
|
|
35
35
|
"solid",
|
|
36
36
|
"primitives"
|
|
37
37
|
],
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"jsdom": "^20.0.0",
|
|
40
|
-
"prettier": "^2.7.1",
|
|
41
|
-
"solid-js": "^1.6.0",
|
|
42
|
-
"tslib": "^2.4.0",
|
|
43
|
-
"tsup": "^6.2.3",
|
|
44
|
-
"vitest": "^0.24.1"
|
|
45
|
-
},
|
|
46
|
-
"browser": {},
|
|
47
38
|
"peerDependencies": {
|
|
48
39
|
"solid-js": "^1.6.0"
|
|
49
40
|
},
|
|
41
|
+
"typesVersions": {},
|
|
50
42
|
"scripts": {
|
|
51
43
|
"build": "jiti ../../scripts/build.ts",
|
|
52
44
|
"test": "vitest -c ../../configs/vitest.config.ts",
|