solid-js 1.8.15 → 1.8.16
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 -1
- package/dist/dev.js +1 -1
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +1 -1
- package/package.json +2 -2
- package/store/types/store.d.ts +1 -1
- package/types/reactive/array.d.ts +2 -2
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +6 -5
- package/types/render/Suspense.d.ts +2 -2
- package/types/render/flow.d.ts +4 -4
- package/web/dist/dev.cjs +12 -10
- package/web/dist/dev.js +12 -10
- package/web/dist/web.cjs +12 -10
- package/web/dist/web.js +12 -10
- package/web/types/index.d.ts +2 -2
package/dist/dev.cjs
CHANGED
package/dist/dev.js
CHANGED
package/dist/solid.cjs
CHANGED
package/dist/solid.js
CHANGED
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.8.
|
|
4
|
+
"version": "1.8.16",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
],
|
|
220
220
|
"dependencies": {
|
|
221
221
|
"csstype": "^3.1.0",
|
|
222
|
-
"seroval": "^1.0.
|
|
222
|
+
"seroval": "^1.0.4",
|
|
223
223
|
"seroval-plugins": "^1.0.3"
|
|
224
224
|
},
|
|
225
225
|
"scripts": {
|
package/store/types/store.d.ts
CHANGED
|
@@ -241,7 +241,7 @@ export interface SetStoreFunction<T> {
|
|
|
241
241
|
): void;
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
244
|
+
* Creates a reactive store that can be read through a proxy object and written with a setter function
|
|
245
245
|
*
|
|
246
246
|
* @description https://www.solidjs.com/docs/latest/api#createstore
|
|
247
247
|
*/
|
|
@@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
23
23
|
SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Reactively transforms an array with a callback function - underlying helper for the `<For>` control flow
|
|
27
27
|
*
|
|
28
28
|
* similar to `Array.prototype.map`, but gets the index as accessor, transforms only values that changed and returns an accessor and reactively tracks changes to the list.
|
|
29
29
|
*
|
|
@@ -37,7 +37,7 @@ export declare function mapArray<T, U>(
|
|
|
37
37
|
}
|
|
38
38
|
): () => U[];
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Reactively maps arrays by index instead of value - underlying helper for the `<Index>` control flow
|
|
41
41
|
*
|
|
42
42
|
* similar to `Array.prototype.map`, but gets the value as an accessor, transforms only changed items of the original arrays anew and returns an accessor.
|
|
43
43
|
*
|
|
@@ -18,7 +18,7 @@ export type ObservableObserver<T> =
|
|
|
18
18
|
complete?: (v: boolean) => void;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Creates a simple observable from a signal's accessor to be used with the `from` operator of observable libraries like e.g. rxjs
|
|
22
22
|
* ```typescript
|
|
23
23
|
* import { from } from "rxjs";
|
|
24
24
|
* const [s, set] = createSignal(0);
|
|
@@ -471,7 +471,7 @@ export interface OnOptions {
|
|
|
471
471
|
defer?: boolean;
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
474
|
-
*
|
|
474
|
+
* Makes dependencies of a computation explicit
|
|
475
475
|
* ```typescript
|
|
476
476
|
* export function on<S, U>(
|
|
477
477
|
* deps: Accessor<S> | AccessorArray<S>,
|
|
@@ -513,14 +513,14 @@ export declare function on<S, Next extends Prev, Prev = Next>(
|
|
|
513
513
|
}
|
|
514
514
|
): EffectFunction<undefined | NoInfer<Next>>;
|
|
515
515
|
/**
|
|
516
|
-
*
|
|
516
|
+
* Runs an effect only after initial render on mount
|
|
517
517
|
* @param fn an effect that should run only once on mount
|
|
518
518
|
*
|
|
519
519
|
* @description https://www.solidjs.com/docs/latest/api#onmount
|
|
520
520
|
*/
|
|
521
521
|
export declare function onMount(fn: () => void): void;
|
|
522
522
|
/**
|
|
523
|
-
*
|
|
523
|
+
* Runs an effect once before the reactive scope is disposed
|
|
524
524
|
* @param fn an effect that should run only once on cleanup
|
|
525
525
|
*
|
|
526
526
|
* @returns the same {@link fn} function that was passed in
|
|
@@ -529,7 +529,7 @@ export declare function onMount(fn: () => void): void;
|
|
|
529
529
|
*/
|
|
530
530
|
export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
531
531
|
/**
|
|
532
|
-
*
|
|
532
|
+
* Runs an effect whenever an error is thrown within the context of the child scopes
|
|
533
533
|
* @param fn boundary for the error
|
|
534
534
|
* @param handler an error handler that receives the error
|
|
535
535
|
*
|
|
@@ -545,6 +545,7 @@ export declare function enableScheduling(scheduler?: typeof requestCallback): vo
|
|
|
545
545
|
/**
|
|
546
546
|
* ```typescript
|
|
547
547
|
* export function startTransition(fn: () => void) => Promise<void>
|
|
548
|
+
* ```
|
|
548
549
|
*
|
|
549
550
|
* @description https://www.solidjs.com/docs/latest/api#usetransition
|
|
550
551
|
*/
|
|
@@ -602,7 +603,7 @@ export declare function createContext<T>(
|
|
|
602
603
|
): Context<T | undefined>;
|
|
603
604
|
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
604
605
|
/**
|
|
605
|
-
*
|
|
606
|
+
* Uses a context to receive a scoped state from a parent's Context.Provider
|
|
606
607
|
*
|
|
607
608
|
* @param context Context object made by `createContext`
|
|
608
609
|
* @returns the current or `defaultValue`, if present
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JSX } from "../jsx.js";
|
|
2
2
|
/**
|
|
3
|
-
* **[experimental]**
|
|
3
|
+
* **[experimental]** Controls the order in which suspended content is rendered
|
|
4
4
|
*
|
|
5
5
|
* @description https://www.solidjs.com/docs/latest/api#suspenselist-experimental
|
|
6
6
|
*/
|
|
@@ -10,7 +10,7 @@ export declare function SuspenseList(props: {
|
|
|
10
10
|
tail?: "collapsed" | "hidden";
|
|
11
11
|
}): JSX.Element;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
14
14
|
* ```typescript
|
|
15
15
|
* const AsyncComponent = lazy(() => import('./component'));
|
|
16
16
|
*
|
package/types/render/flow.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accessor } from "../reactive/signal.js";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Creates a list elements from a list
|
|
5
5
|
*
|
|
6
6
|
* it receives a map function as its child that receives a list element and an accessor with the index and returns a JSX-Element; if the list is empty, an optional fallback is returned:
|
|
7
7
|
* ```typescript
|
|
@@ -60,7 +60,7 @@ export declare function Show<
|
|
|
60
60
|
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
61
61
|
}): JSX.Element;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Switches between content based on mutually exclusive conditions
|
|
64
64
|
* ```typescript
|
|
65
65
|
* <Switch fallback={<FourOhFour />}>
|
|
66
66
|
* <Match when={state.route === 'home'}>
|
|
@@ -83,7 +83,7 @@ export type MatchProps<T> = {
|
|
|
83
83
|
children: JSX.Element | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => JSX.Element);
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
87
87
|
* ```typescript
|
|
88
88
|
* <Match when={condition()}>
|
|
89
89
|
* <Content/>
|
|
@@ -109,7 +109,7 @@ export declare function Match<
|
|
|
109
109
|
}): JSX.Element;
|
|
110
110
|
export declare function resetErrorBoundaries(): void;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Catches uncaught errors inside components and renders a fallback content
|
|
113
113
|
*
|
|
114
114
|
* Also supports a callback form that passes the error and a reset function:
|
|
115
115
|
* ```typescript
|
package/web/dist/dev.cjs
CHANGED
|
@@ -151,18 +151,19 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
function setProperty(node, name, value) {
|
|
154
|
-
|
|
154
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
155
|
+
node[name] = value;
|
|
155
156
|
}
|
|
156
157
|
function setAttribute(node, name, value) {
|
|
157
|
-
if (solidJs.sharedConfig.context) return;
|
|
158
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
158
159
|
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
159
160
|
}
|
|
160
161
|
function setAttributeNS(node, namespace, name, value) {
|
|
161
|
-
if (solidJs.sharedConfig.context) return;
|
|
162
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
162
163
|
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
163
164
|
}
|
|
164
165
|
function className(node, value) {
|
|
165
|
-
if (solidJs.sharedConfig.context) return;
|
|
166
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
166
167
|
if (value == null) node.removeAttribute("class");else node.className = value;
|
|
167
168
|
}
|
|
168
169
|
function addEventListener(node, name, handler, delegate) {
|
|
@@ -366,7 +367,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
366
367
|
if (forceProp) {
|
|
367
368
|
prop = prop.slice(5);
|
|
368
369
|
isProp = true;
|
|
369
|
-
} else if (solidJs.sharedConfig.context) return value;
|
|
370
|
+
} else if (!!solidJs.sharedConfig.context && node.isConnected) return value;
|
|
370
371
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
371
372
|
} else {
|
|
372
373
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -401,7 +402,8 @@ function eventHandler(e) {
|
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
404
|
-
|
|
405
|
+
const hydrating = !!solidJs.sharedConfig.context && parent.isConnected;
|
|
406
|
+
if (hydrating) {
|
|
405
407
|
!current && (current = [...parent.childNodes]);
|
|
406
408
|
let cleaned = [];
|
|
407
409
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -416,7 +418,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
416
418
|
multi = marker !== undefined;
|
|
417
419
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
418
420
|
if (t === "string" || t === "number") {
|
|
419
|
-
if (
|
|
421
|
+
if (hydrating) return current;
|
|
420
422
|
if (t === "number") value = value.toString();
|
|
421
423
|
if (multi) {
|
|
422
424
|
let node = current[0];
|
|
@@ -430,7 +432,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
430
432
|
} else current = parent.textContent = value;
|
|
431
433
|
}
|
|
432
434
|
} else if (value == null || t === "boolean") {
|
|
433
|
-
if (
|
|
435
|
+
if (hydrating) return current;
|
|
434
436
|
current = cleanChildren(parent, current, marker);
|
|
435
437
|
} else if (t === "function") {
|
|
436
438
|
solidJs.createRenderEffect(() => {
|
|
@@ -446,7 +448,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
446
448
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
447
449
|
return () => current;
|
|
448
450
|
}
|
|
449
|
-
if (
|
|
451
|
+
if (hydrating) {
|
|
450
452
|
if (!array.length) return current;
|
|
451
453
|
if (marker === undefined) return [...parent.childNodes];
|
|
452
454
|
let node = array[0];
|
|
@@ -467,7 +469,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
467
469
|
}
|
|
468
470
|
current = array;
|
|
469
471
|
} else if (value.nodeType) {
|
|
470
|
-
if (
|
|
472
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
471
473
|
if (Array.isArray(current)) {
|
|
472
474
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
473
475
|
cleanChildren(parent, current, null, value);
|
package/web/dist/dev.js
CHANGED
|
@@ -604,20 +604,21 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
function setProperty(node, name, value) {
|
|
607
|
-
|
|
607
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
608
|
+
node[name] = value;
|
|
608
609
|
}
|
|
609
610
|
function setAttribute(node, name, value) {
|
|
610
|
-
if (sharedConfig.context) return;
|
|
611
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
611
612
|
if (value == null) node.removeAttribute(name);
|
|
612
613
|
else node.setAttribute(name, value);
|
|
613
614
|
}
|
|
614
615
|
function setAttributeNS(node, namespace, name, value) {
|
|
615
|
-
if (sharedConfig.context) return;
|
|
616
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
616
617
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
617
618
|
else node.setAttributeNS(namespace, name, value);
|
|
618
619
|
}
|
|
619
620
|
function className(node, value) {
|
|
620
|
-
if (sharedConfig.context) return;
|
|
621
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
621
622
|
if (value == null) node.removeAttribute("class");
|
|
622
623
|
else node.className = value;
|
|
623
624
|
}
|
|
@@ -830,7 +831,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
830
831
|
if (forceProp) {
|
|
831
832
|
prop = prop.slice(5);
|
|
832
833
|
isProp = true;
|
|
833
|
-
} else if (sharedConfig.context) return value;
|
|
834
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
834
835
|
if (prop === "class" || prop === "className") className(node, value);
|
|
835
836
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
836
837
|
else node[propAlias || prop] = value;
|
|
@@ -868,7 +869,8 @@ function eventHandler(e) {
|
|
|
868
869
|
}
|
|
869
870
|
}
|
|
870
871
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
871
|
-
|
|
872
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
873
|
+
if (hydrating) {
|
|
872
874
|
!current && (current = [...parent.childNodes]);
|
|
873
875
|
let cleaned = [];
|
|
874
876
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -884,7 +886,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
884
886
|
multi = marker !== undefined;
|
|
885
887
|
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
886
888
|
if (t === "string" || t === "number") {
|
|
887
|
-
if (
|
|
889
|
+
if (hydrating) return current;
|
|
888
890
|
if (t === "number") value = value.toString();
|
|
889
891
|
if (multi) {
|
|
890
892
|
let node = current[0];
|
|
@@ -898,7 +900,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
898
900
|
} else current = parent.textContent = value;
|
|
899
901
|
}
|
|
900
902
|
} else if (value == null || t === "boolean") {
|
|
901
|
-
if (
|
|
903
|
+
if (hydrating) return current;
|
|
902
904
|
current = cleanChildren(parent, current, marker);
|
|
903
905
|
} else if (t === "function") {
|
|
904
906
|
createRenderEffect(() => {
|
|
@@ -914,7 +916,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
914
916
|
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
915
917
|
return () => current;
|
|
916
918
|
}
|
|
917
|
-
if (
|
|
919
|
+
if (hydrating) {
|
|
918
920
|
if (!array.length) return current;
|
|
919
921
|
if (marker === undefined) return [...parent.childNodes];
|
|
920
922
|
let node = array[0];
|
|
@@ -935,7 +937,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
935
937
|
}
|
|
936
938
|
current = array;
|
|
937
939
|
} else if (value.nodeType) {
|
|
938
|
-
if (
|
|
940
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
939
941
|
if (Array.isArray(current)) {
|
|
940
942
|
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
941
943
|
cleanChildren(parent, current, null, value);
|
package/web/dist/web.cjs
CHANGED
|
@@ -147,18 +147,19 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
function setProperty(node, name, value) {
|
|
150
|
-
|
|
150
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
151
|
+
node[name] = value;
|
|
151
152
|
}
|
|
152
153
|
function setAttribute(node, name, value) {
|
|
153
|
-
if (solidJs.sharedConfig.context) return;
|
|
154
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
154
155
|
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
155
156
|
}
|
|
156
157
|
function setAttributeNS(node, namespace, name, value) {
|
|
157
|
-
if (solidJs.sharedConfig.context) return;
|
|
158
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
158
159
|
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
159
160
|
}
|
|
160
161
|
function className(node, value) {
|
|
161
|
-
if (solidJs.sharedConfig.context) return;
|
|
162
|
+
if (!!solidJs.sharedConfig.context && node.isConnected) return;
|
|
162
163
|
if (value == null) node.removeAttribute("class");else node.className = value;
|
|
163
164
|
}
|
|
164
165
|
function addEventListener(node, name, handler, delegate) {
|
|
@@ -361,7 +362,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
361
362
|
if (forceProp) {
|
|
362
363
|
prop = prop.slice(5);
|
|
363
364
|
isProp = true;
|
|
364
|
-
} else if (solidJs.sharedConfig.context) return value;
|
|
365
|
+
} else if (!!solidJs.sharedConfig.context && node.isConnected) return value;
|
|
365
366
|
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
366
367
|
} else {
|
|
367
368
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -396,7 +397,8 @@ function eventHandler(e) {
|
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
399
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
399
|
-
|
|
400
|
+
const hydrating = !!solidJs.sharedConfig.context && parent.isConnected;
|
|
401
|
+
if (hydrating) {
|
|
400
402
|
!current && (current = [...parent.childNodes]);
|
|
401
403
|
let cleaned = [];
|
|
402
404
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -411,7 +413,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
411
413
|
multi = marker !== undefined;
|
|
412
414
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
413
415
|
if (t === "string" || t === "number") {
|
|
414
|
-
if (
|
|
416
|
+
if (hydrating) return current;
|
|
415
417
|
if (t === "number") value = value.toString();
|
|
416
418
|
if (multi) {
|
|
417
419
|
let node = current[0];
|
|
@@ -425,7 +427,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
425
427
|
} else current = parent.textContent = value;
|
|
426
428
|
}
|
|
427
429
|
} else if (value == null || t === "boolean") {
|
|
428
|
-
if (
|
|
430
|
+
if (hydrating) return current;
|
|
429
431
|
current = cleanChildren(parent, current, marker);
|
|
430
432
|
} else if (t === "function") {
|
|
431
433
|
solidJs.createRenderEffect(() => {
|
|
@@ -441,7 +443,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
441
443
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
442
444
|
return () => current;
|
|
443
445
|
}
|
|
444
|
-
if (
|
|
446
|
+
if (hydrating) {
|
|
445
447
|
if (!array.length) return current;
|
|
446
448
|
if (marker === undefined) return [...parent.childNodes];
|
|
447
449
|
let node = array[0];
|
|
@@ -462,7 +464,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
462
464
|
}
|
|
463
465
|
current = array;
|
|
464
466
|
} else if (value.nodeType) {
|
|
465
|
-
if (
|
|
467
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
466
468
|
if (Array.isArray(current)) {
|
|
467
469
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
468
470
|
cleanChildren(parent, current, null, value);
|
package/web/dist/web.js
CHANGED
|
@@ -594,20 +594,21 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
function setProperty(node, name, value) {
|
|
597
|
-
|
|
597
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
598
|
+
node[name] = value;
|
|
598
599
|
}
|
|
599
600
|
function setAttribute(node, name, value) {
|
|
600
|
-
if (sharedConfig.context) return;
|
|
601
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
601
602
|
if (value == null) node.removeAttribute(name);
|
|
602
603
|
else node.setAttribute(name, value);
|
|
603
604
|
}
|
|
604
605
|
function setAttributeNS(node, namespace, name, value) {
|
|
605
|
-
if (sharedConfig.context) return;
|
|
606
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
606
607
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
607
608
|
else node.setAttributeNS(namespace, name, value);
|
|
608
609
|
}
|
|
609
610
|
function className(node, value) {
|
|
610
|
-
if (sharedConfig.context) return;
|
|
611
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
611
612
|
if (value == null) node.removeAttribute("class");
|
|
612
613
|
else node.className = value;
|
|
613
614
|
}
|
|
@@ -818,7 +819,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
818
819
|
if (forceProp) {
|
|
819
820
|
prop = prop.slice(5);
|
|
820
821
|
isProp = true;
|
|
821
|
-
} else if (sharedConfig.context) return value;
|
|
822
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
822
823
|
if (prop === "class" || prop === "className") className(node, value);
|
|
823
824
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
824
825
|
else node[propAlias || prop] = value;
|
|
@@ -856,7 +857,8 @@ function eventHandler(e) {
|
|
|
856
857
|
}
|
|
857
858
|
}
|
|
858
859
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
859
|
-
|
|
860
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
861
|
+
if (hydrating) {
|
|
860
862
|
!current && (current = [...parent.childNodes]);
|
|
861
863
|
let cleaned = [];
|
|
862
864
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -872,7 +874,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
872
874
|
multi = marker !== undefined;
|
|
873
875
|
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
874
876
|
if (t === "string" || t === "number") {
|
|
875
|
-
if (
|
|
877
|
+
if (hydrating) return current;
|
|
876
878
|
if (t === "number") value = value.toString();
|
|
877
879
|
if (multi) {
|
|
878
880
|
let node = current[0];
|
|
@@ -886,7 +888,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
886
888
|
} else current = parent.textContent = value;
|
|
887
889
|
}
|
|
888
890
|
} else if (value == null || t === "boolean") {
|
|
889
|
-
if (
|
|
891
|
+
if (hydrating) return current;
|
|
890
892
|
current = cleanChildren(parent, current, marker);
|
|
891
893
|
} else if (t === "function") {
|
|
892
894
|
createRenderEffect(() => {
|
|
@@ -902,7 +904,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
902
904
|
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
903
905
|
return () => current;
|
|
904
906
|
}
|
|
905
|
-
if (
|
|
907
|
+
if (hydrating) {
|
|
906
908
|
if (!array.length) return current;
|
|
907
909
|
if (marker === undefined) return [...parent.childNodes];
|
|
908
910
|
let node = array[0];
|
|
@@ -923,7 +925,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
923
925
|
}
|
|
924
926
|
current = array;
|
|
925
927
|
} else if (value.nodeType) {
|
|
926
|
-
if (
|
|
928
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
927
929
|
if (Array.isArray(current)) {
|
|
928
930
|
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
929
931
|
cleanChildren(parent, current, null, value);
|
package/web/types/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const isServer: boolean;
|
|
|
17
17
|
export declare const isDev: boolean;
|
|
18
18
|
export declare const hydrate: typeof hydrateCore;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Renders components somewhere else in the DOM
|
|
21
21
|
*
|
|
22
22
|
* Useful for inserting modals and tooltips outside of an cropping layout. If no mount point is given, the portal is inserted in document.body; it is wrapped in a `<div>` unless the target is document.head or `isSVG` is true. setting `useShadow` to true places the element in a shadow root to isolate styles.
|
|
23
23
|
*
|
|
@@ -45,7 +45,7 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
45
45
|
component: T | undefined;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Renders an arbitrary custom or native component and passes the other props
|
|
49
49
|
* ```typescript
|
|
50
50
|
* <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
|
|
51
51
|
* ```
|