solid-js 1.8.15 → 1.8.17
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/server.cjs +5 -1
- package/dist/server.js +5 -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 +14 -12
- package/web/dist/dev.js +16 -11
- package/web/dist/web.cjs +14 -12
- package/web/dist/web.js +16 -11
- package/web/types/index.d.ts +2 -2
package/dist/dev.cjs
CHANGED
package/dist/dev.js
CHANGED
package/dist/server.cjs
CHANGED
|
@@ -307,8 +307,12 @@ function resolveSSRNode(node) {
|
|
|
307
307
|
if (t === "string") return node;
|
|
308
308
|
if (node == null || t === "boolean") return "";
|
|
309
309
|
if (Array.isArray(node)) {
|
|
310
|
+
let prev = {};
|
|
310
311
|
let mapped = "";
|
|
311
|
-
for (let i = 0, len = node.length; i < len; i++)
|
|
312
|
+
for (let i = 0, len = node.length; i < len; i++) {
|
|
313
|
+
if (typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
314
|
+
mapped += resolveSSRNode(prev = node[i]);
|
|
315
|
+
}
|
|
312
316
|
return mapped;
|
|
313
317
|
}
|
|
314
318
|
if (t === "object") return node.t;
|
package/dist/server.js
CHANGED
|
@@ -316,8 +316,12 @@ function resolveSSRNode(node) {
|
|
|
316
316
|
if (t === "string") return node;
|
|
317
317
|
if (node == null || t === "boolean") return "";
|
|
318
318
|
if (Array.isArray(node)) {
|
|
319
|
+
let prev = {};
|
|
319
320
|
let mapped = "";
|
|
320
|
-
for (let i = 0, len = node.length; i < len; i++)
|
|
321
|
+
for (let i = 0, len = node.length; i < len; i++) {
|
|
322
|
+
if (typeof prev !== "object" && typeof node[i] !== "object") mapped += `<!--!$-->`;
|
|
323
|
+
mapped += resolveSSRNode((prev = node[i]));
|
|
324
|
+
}
|
|
321
325
|
return mapped;
|
|
322
326
|
}
|
|
323
327
|
if (t === "object") return node.t;
|
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.17",
|
|
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
|
@@ -40,7 +40,7 @@ function getPropAlias(prop, tagName) {
|
|
|
40
40
|
}
|
|
41
41
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
42
42
|
const SVGElements = /*#__PURE__*/new Set([
|
|
43
|
-
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
43
|
+
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
44
44
|
"set", "stop",
|
|
45
45
|
"svg", "switch", "symbol", "text", "textPath",
|
|
46
46
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
@@ -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) {
|
|
@@ -221,7 +222,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
221
222
|
if (!skipChildren) {
|
|
222
223
|
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
223
224
|
}
|
|
224
|
-
solidJs.createRenderEffect(() => props.ref
|
|
225
|
+
solidJs.createRenderEffect(() => typeof props.ref === "function" ? use(props.ref, node) : props.ref = node);
|
|
225
226
|
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
226
227
|
return prevProps;
|
|
227
228
|
}
|
|
@@ -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
|
@@ -153,6 +153,7 @@ const SVGElements = /*#__PURE__*/ new Set([
|
|
|
153
153
|
"feDiffuseLighting",
|
|
154
154
|
"feDisplacementMap",
|
|
155
155
|
"feDistantLight",
|
|
156
|
+
"feDropShadow",
|
|
156
157
|
"feFlood",
|
|
157
158
|
"feFuncA",
|
|
158
159
|
"feFuncB",
|
|
@@ -604,20 +605,21 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
604
605
|
}
|
|
605
606
|
}
|
|
606
607
|
function setProperty(node, name, value) {
|
|
607
|
-
|
|
608
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
609
|
+
node[name] = value;
|
|
608
610
|
}
|
|
609
611
|
function setAttribute(node, name, value) {
|
|
610
|
-
if (sharedConfig.context) return;
|
|
612
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
611
613
|
if (value == null) node.removeAttribute(name);
|
|
612
614
|
else node.setAttribute(name, value);
|
|
613
615
|
}
|
|
614
616
|
function setAttributeNS(node, namespace, name, value) {
|
|
615
|
-
if (sharedConfig.context) return;
|
|
617
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
616
618
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
617
619
|
else node.setAttributeNS(namespace, name, value);
|
|
618
620
|
}
|
|
619
621
|
function className(node, value) {
|
|
620
|
-
if (sharedConfig.context) return;
|
|
622
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
621
623
|
if (value == null) node.removeAttribute("class");
|
|
622
624
|
else node.className = value;
|
|
623
625
|
}
|
|
@@ -679,7 +681,9 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
679
681
|
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
680
682
|
);
|
|
681
683
|
}
|
|
682
|
-
createRenderEffect(() =>
|
|
684
|
+
createRenderEffect(() =>
|
|
685
|
+
typeof props.ref === "function" ? use(props.ref, node) : (props.ref = node)
|
|
686
|
+
);
|
|
683
687
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
684
688
|
return prevProps;
|
|
685
689
|
}
|
|
@@ -830,7 +834,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
830
834
|
if (forceProp) {
|
|
831
835
|
prop = prop.slice(5);
|
|
832
836
|
isProp = true;
|
|
833
|
-
} else if (sharedConfig.context) return value;
|
|
837
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
834
838
|
if (prop === "class" || prop === "className") className(node, value);
|
|
835
839
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
836
840
|
else node[propAlias || prop] = value;
|
|
@@ -868,7 +872,8 @@ function eventHandler(e) {
|
|
|
868
872
|
}
|
|
869
873
|
}
|
|
870
874
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
871
|
-
|
|
875
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
876
|
+
if (hydrating) {
|
|
872
877
|
!current && (current = [...parent.childNodes]);
|
|
873
878
|
let cleaned = [];
|
|
874
879
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -884,7 +889,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
884
889
|
multi = marker !== undefined;
|
|
885
890
|
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
886
891
|
if (t === "string" || t === "number") {
|
|
887
|
-
if (
|
|
892
|
+
if (hydrating) return current;
|
|
888
893
|
if (t === "number") value = value.toString();
|
|
889
894
|
if (multi) {
|
|
890
895
|
let node = current[0];
|
|
@@ -898,7 +903,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
898
903
|
} else current = parent.textContent = value;
|
|
899
904
|
}
|
|
900
905
|
} else if (value == null || t === "boolean") {
|
|
901
|
-
if (
|
|
906
|
+
if (hydrating) return current;
|
|
902
907
|
current = cleanChildren(parent, current, marker);
|
|
903
908
|
} else if (t === "function") {
|
|
904
909
|
createRenderEffect(() => {
|
|
@@ -914,7 +919,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
914
919
|
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
915
920
|
return () => current;
|
|
916
921
|
}
|
|
917
|
-
if (
|
|
922
|
+
if (hydrating) {
|
|
918
923
|
if (!array.length) return current;
|
|
919
924
|
if (marker === undefined) return [...parent.childNodes];
|
|
920
925
|
let node = array[0];
|
|
@@ -935,7 +940,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
935
940
|
}
|
|
936
941
|
current = array;
|
|
937
942
|
} else if (value.nodeType) {
|
|
938
|
-
if (
|
|
943
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
939
944
|
if (Array.isArray(current)) {
|
|
940
945
|
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
941
946
|
cleanChildren(parent, current, null, value);
|
package/web/dist/web.cjs
CHANGED
|
@@ -40,7 +40,7 @@ function getPropAlias(prop, tagName) {
|
|
|
40
40
|
}
|
|
41
41
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
42
42
|
const SVGElements = /*#__PURE__*/new Set([
|
|
43
|
-
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
43
|
+
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
44
44
|
"set", "stop",
|
|
45
45
|
"svg", "switch", "symbol", "text", "textPath",
|
|
46
46
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
@@ -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) {
|
|
@@ -217,7 +218,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
217
218
|
if (!skipChildren) {
|
|
218
219
|
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
219
220
|
}
|
|
220
|
-
solidJs.createRenderEffect(() => props.ref
|
|
221
|
+
solidJs.createRenderEffect(() => typeof props.ref === "function" ? use(props.ref, node) : props.ref = node);
|
|
221
222
|
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
222
223
|
return prevProps;
|
|
223
224
|
}
|
|
@@ -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
|
@@ -152,6 +152,7 @@ const SVGElements = /*#__PURE__*/ new Set([
|
|
|
152
152
|
"feDiffuseLighting",
|
|
153
153
|
"feDisplacementMap",
|
|
154
154
|
"feDistantLight",
|
|
155
|
+
"feDropShadow",
|
|
155
156
|
"feFlood",
|
|
156
157
|
"feFuncA",
|
|
157
158
|
"feFuncB",
|
|
@@ -594,20 +595,21 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
594
595
|
}
|
|
595
596
|
}
|
|
596
597
|
function setProperty(node, name, value) {
|
|
597
|
-
|
|
598
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
599
|
+
node[name] = value;
|
|
598
600
|
}
|
|
599
601
|
function setAttribute(node, name, value) {
|
|
600
|
-
if (sharedConfig.context) return;
|
|
602
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
601
603
|
if (value == null) node.removeAttribute(name);
|
|
602
604
|
else node.setAttribute(name, value);
|
|
603
605
|
}
|
|
604
606
|
function setAttributeNS(node, namespace, name, value) {
|
|
605
|
-
if (sharedConfig.context) return;
|
|
607
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
606
608
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
607
609
|
else node.setAttributeNS(namespace, name, value);
|
|
608
610
|
}
|
|
609
611
|
function className(node, value) {
|
|
610
|
-
if (sharedConfig.context) return;
|
|
612
|
+
if (!!sharedConfig.context && node.isConnected) return;
|
|
611
613
|
if (value == null) node.removeAttribute("class");
|
|
612
614
|
else node.className = value;
|
|
613
615
|
}
|
|
@@ -669,7 +671,9 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
669
671
|
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
670
672
|
);
|
|
671
673
|
}
|
|
672
|
-
createRenderEffect(() =>
|
|
674
|
+
createRenderEffect(() =>
|
|
675
|
+
typeof props.ref === "function" ? use(props.ref, node) : (props.ref = node)
|
|
676
|
+
);
|
|
673
677
|
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
674
678
|
return prevProps;
|
|
675
679
|
}
|
|
@@ -818,7 +822,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
818
822
|
if (forceProp) {
|
|
819
823
|
prop = prop.slice(5);
|
|
820
824
|
isProp = true;
|
|
821
|
-
} else if (sharedConfig.context) return value;
|
|
825
|
+
} else if (!!sharedConfig.context && node.isConnected) return value;
|
|
822
826
|
if (prop === "class" || prop === "className") className(node, value);
|
|
823
827
|
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
824
828
|
else node[propAlias || prop] = value;
|
|
@@ -856,7 +860,8 @@ function eventHandler(e) {
|
|
|
856
860
|
}
|
|
857
861
|
}
|
|
858
862
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
859
|
-
|
|
863
|
+
const hydrating = !!sharedConfig.context && parent.isConnected;
|
|
864
|
+
if (hydrating) {
|
|
860
865
|
!current && (current = [...parent.childNodes]);
|
|
861
866
|
let cleaned = [];
|
|
862
867
|
for (let i = 0; i < current.length; i++) {
|
|
@@ -872,7 +877,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
872
877
|
multi = marker !== undefined;
|
|
873
878
|
parent = (multi && current[0] && current[0].parentNode) || parent;
|
|
874
879
|
if (t === "string" || t === "number") {
|
|
875
|
-
if (
|
|
880
|
+
if (hydrating) return current;
|
|
876
881
|
if (t === "number") value = value.toString();
|
|
877
882
|
if (multi) {
|
|
878
883
|
let node = current[0];
|
|
@@ -886,7 +891,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
886
891
|
} else current = parent.textContent = value;
|
|
887
892
|
}
|
|
888
893
|
} else if (value == null || t === "boolean") {
|
|
889
|
-
if (
|
|
894
|
+
if (hydrating) return current;
|
|
890
895
|
current = cleanChildren(parent, current, marker);
|
|
891
896
|
} else if (t === "function") {
|
|
892
897
|
createRenderEffect(() => {
|
|
@@ -902,7 +907,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
902
907
|
createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
|
|
903
908
|
return () => current;
|
|
904
909
|
}
|
|
905
|
-
if (
|
|
910
|
+
if (hydrating) {
|
|
906
911
|
if (!array.length) return current;
|
|
907
912
|
if (marker === undefined) return [...parent.childNodes];
|
|
908
913
|
let node = array[0];
|
|
@@ -923,7 +928,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
923
928
|
}
|
|
924
929
|
current = array;
|
|
925
930
|
} else if (value.nodeType) {
|
|
926
|
-
if (
|
|
931
|
+
if (hydrating && value.parentNode) return (current = multi ? [value] : value);
|
|
927
932
|
if (Array.isArray(current)) {
|
|
928
933
|
if (multi) return (current = cleanChildren(parent, current, marker, value));
|
|
929
934
|
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
|
* ```
|