solid-js 1.4.0-beta.6 → 1.4.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/dev.cjs +1 -2
- package/dist/dev.js +1 -2
- package/dist/solid.cjs +1 -2
- package/dist/solid.js +1 -2
- package/package.json +2 -2
- package/types/reactive/signal.d.ts +19 -10
- package/types/render/component.d.ts +16 -10
package/dist/dev.cjs
CHANGED
|
@@ -441,8 +441,7 @@ function untrack(fn) {
|
|
|
441
441
|
Listener = listener;
|
|
442
442
|
return result;
|
|
443
443
|
}
|
|
444
|
-
function on(deps, fn,
|
|
445
|
-
options) {
|
|
444
|
+
function on(deps, fn, options) {
|
|
446
445
|
const isArray = Array.isArray(deps);
|
|
447
446
|
let prevInput;
|
|
448
447
|
let defer = options && options.defer;
|
package/dist/dev.js
CHANGED
|
@@ -437,8 +437,7 @@ function untrack(fn) {
|
|
|
437
437
|
Listener = listener;
|
|
438
438
|
return result;
|
|
439
439
|
}
|
|
440
|
-
function on(deps, fn,
|
|
441
|
-
options) {
|
|
440
|
+
function on(deps, fn, options) {
|
|
442
441
|
const isArray = Array.isArray(deps);
|
|
443
442
|
let prevInput;
|
|
444
443
|
let defer = options && options.defer;
|
package/dist/solid.cjs
CHANGED
|
@@ -438,8 +438,7 @@ function untrack(fn) {
|
|
|
438
438
|
Listener = listener;
|
|
439
439
|
return result;
|
|
440
440
|
}
|
|
441
|
-
function on(deps, fn,
|
|
442
|
-
options) {
|
|
441
|
+
function on(deps, fn, options) {
|
|
443
442
|
const isArray = Array.isArray(deps);
|
|
444
443
|
let prevInput;
|
|
445
444
|
let defer = options && options.defer;
|
package/dist/solid.js
CHANGED
|
@@ -434,8 +434,7 @@ function untrack(fn) {
|
|
|
434
434
|
Listener = listener;
|
|
435
435
|
return result;
|
|
436
436
|
}
|
|
437
|
-
function on(deps, fn,
|
|
438
|
-
options) {
|
|
437
|
+
function on(deps, fn, options) {
|
|
439
438
|
const isArray = Array.isArray(deps);
|
|
440
439
|
let prevInput;
|
|
441
440
|
let defer = options && options.defer;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.4.0
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
"compiler",
|
|
152
152
|
"performance"
|
|
153
153
|
],
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "6c9e976c002d3ae327ff509213a091ce79f7582a"
|
|
155
155
|
}
|
|
@@ -72,7 +72,7 @@ export declare type RootFunction<T> = (dispose: () => void) => T;
|
|
|
72
72
|
*/
|
|
73
73
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: Owner): T;
|
|
74
74
|
export declare type Accessor<T> = () => T;
|
|
75
|
-
export declare type Setter<T> = (undefined extends T ? () => undefined : {}) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
|
|
75
|
+
export declare type Setter<T> = (undefined extends T ? () => undefined : {}) & (<U extends T>(value: (prev: T) => U) => U) & (<U extends T>(value: Exclude<U, Function>) => U) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
|
|
76
76
|
export declare type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
77
77
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
78
78
|
internal?: boolean;
|
|
@@ -314,21 +314,25 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
314
314
|
* @description https://www.solidjs.com/docs/latest/api#untrack
|
|
315
315
|
*/
|
|
316
316
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
/** @deprecated */
|
|
318
|
+
export declare type ReturnTypes<T> = T extends readonly Accessor<unknown>[] ? {
|
|
319
|
+
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
320
|
+
} : T extends Accessor<infer I> ? I : never;
|
|
321
|
+
export declare type AccessorArray<T> = [...Extract<{
|
|
322
|
+
[K in keyof T]: Accessor<T[K]>;
|
|
323
|
+
}, readonly unknown[]>];
|
|
324
|
+
export declare type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (input: S, prevInput: S | undefined, prev: Prev) => Next;
|
|
321
325
|
export interface OnOptions {
|
|
322
326
|
defer?: boolean;
|
|
323
327
|
}
|
|
324
328
|
/**
|
|
325
329
|
* on - make dependencies of a computation explicit
|
|
326
330
|
* ```typescript
|
|
327
|
-
* export function on<
|
|
328
|
-
* deps:
|
|
329
|
-
* fn: (input:
|
|
331
|
+
* export function on<S, U>(
|
|
332
|
+
* deps: Accessor<S> | AccessorArray<S>,
|
|
333
|
+
* fn: (input: S, prevInput: S | undefined, prevValue: U | undefined) => U,
|
|
330
334
|
* options?: { defer?: boolean } = {}
|
|
331
|
-
* ): (prevValue
|
|
335
|
+
* ): (prevValue: U | undefined) => U;
|
|
332
336
|
* ```
|
|
333
337
|
* @param deps list of reactive dependencies or a single reactive dependency
|
|
334
338
|
* @param fn computation on input; the current previous content(s) of input and the previous value are given as arguments and it returns a new value
|
|
@@ -347,7 +351,12 @@ export interface OnOptions {
|
|
|
347
351
|
*
|
|
348
352
|
* @description https://www.solidjs.com/docs/latest/api#on
|
|
349
353
|
*/
|
|
350
|
-
export declare function on<S extends
|
|
354
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options?: OnOptions & {
|
|
355
|
+
defer?: false;
|
|
356
|
+
}): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
357
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options: OnOptions & {
|
|
358
|
+
defer: true;
|
|
359
|
+
}): EffectFunction<undefined | NoInfer<Next>>;
|
|
351
360
|
/**
|
|
352
361
|
* onMount - run an effect only after initial render on mount
|
|
353
362
|
* @param fn an effect that should run only once on mount
|
|
@@ -66,17 +66,23 @@ export declare type ComponentProps<T extends keyof JSX.IntrinsicElements | Compo
|
|
|
66
66
|
*/
|
|
67
67
|
export declare type Ref<T> = T | ((val: T) => void);
|
|
68
68
|
export declare function createComponent<T>(Comp: Component<T>, props: T): JSX.Element;
|
|
69
|
+
declare type Simplify<T> = T extends object ? {
|
|
70
|
+
[K in keyof T]: T[K];
|
|
71
|
+
} : T;
|
|
69
72
|
declare type UnboxLazy<T> = T extends () => infer U ? U : T;
|
|
70
|
-
declare type
|
|
71
|
-
[
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
declare type RequiredKeys<T> = keyof {
|
|
74
|
+
[K in keyof T as T extends {
|
|
75
|
+
[_ in K]: unknown;
|
|
76
|
+
} ? K : never]: 0;
|
|
77
|
+
};
|
|
78
|
+
declare type Override<T, U> = {
|
|
79
|
+
[K in keyof Omit<T, RequiredKeys<U>>]: T[K] | Exclude<U[K & keyof U], undefined>;
|
|
80
|
+
} & {
|
|
81
|
+
[K in keyof Omit<U, Exclude<keyof T, RequiredKeys<U>>>]: Exclude<U[K], undefined> | (undefined extends U[K] ? (K extends keyof T ? T[K] : undefined) : never);
|
|
82
|
+
};
|
|
83
|
+
export declare type MergeProps<T extends unknown[], Curr = {}> = T extends [infer Next, ...infer Rest] ? MergeProps<Rest, Next extends object ? (Next extends Function ? Curr : Override<Curr, UnboxLazy<Next>>) : Curr> : Simplify<Curr>;
|
|
84
|
+
export declare function mergeProps<T extends [unknown, ...unknown[]]>(...sources: T): MergeProps<T>;
|
|
85
|
+
export declare type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
|
|
80
86
|
...{
|
|
81
87
|
[P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> : K[P];
|
|
82
88
|
},
|