solid-js 1.7.0-beta.0 → 1.7.0-beta.2

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/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.7.0-beta.0",
4
+ "version": "1.7.0-beta.2",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -259,7 +259,8 @@
259
259
  "performance"
260
260
  ],
261
261
  "dependencies": {
262
- "csstype": "^3.1.0"
262
+ "csstype": "^3.1.0",
263
+ "seroval": "^0.5.0"
263
264
  },
264
265
  "scripts": {
265
266
  "build": "npm-run-all -nl build:*",
@@ -312,11 +312,8 @@ const $ROOT = Symbol("store-root");
312
312
  function applyState(target, parent, property, merge, key) {
313
313
  const previous = parent[property];
314
314
  if (target === previous) return;
315
- if (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key]) {
316
- if (target !== previous) {
317
- if (property === $ROOT) return target;
318
- setProperty(parent, property, target);
319
- }
315
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key])) {
316
+ setProperty(parent, property, target);
320
317
  return;
321
318
  }
322
319
  if (Array.isArray(target)) {
package/store/dist/dev.js CHANGED
@@ -310,11 +310,8 @@ const $ROOT = Symbol("store-root");
310
310
  function applyState(target, parent, property, merge, key) {
311
311
  const previous = parent[property];
312
312
  if (target === previous) return;
313
- if (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key]) {
314
- if (target !== previous) {
315
- if (property === $ROOT) return target;
316
- setProperty(parent, property, target);
317
- }
313
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key])) {
314
+ setProperty(parent, property, target);
318
315
  return;
319
316
  }
320
317
  if (Array.isArray(target)) {
@@ -296,11 +296,8 @@ const $ROOT = Symbol("store-root");
296
296
  function applyState(target, parent, property, merge, key) {
297
297
  const previous = parent[property];
298
298
  if (target === previous) return;
299
- if (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key]) {
300
- if (target !== previous) {
301
- if (property === $ROOT) return target;
302
- setProperty(parent, property, target);
303
- }
299
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key])) {
300
+ setProperty(parent, property, target);
304
301
  return;
305
302
  }
306
303
  if (Array.isArray(target)) {
@@ -294,11 +294,8 @@ const $ROOT = Symbol("store-root");
294
294
  function applyState(target, parent, property, merge, key) {
295
295
  const previous = parent[property];
296
296
  if (target === previous) return;
297
- if (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key]) {
298
- if (target !== previous) {
299
- if (property === $ROOT) return target;
300
- setProperty(parent, property, target);
301
- }
297
+ if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || key && target[key] !== previous[key])) {
298
+ setProperty(parent, property, target);
302
299
  return;
303
300
  }
304
301
  if (Array.isArray(target)) {
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { $DEVCOMP, $PROXY, $TRACK, batch, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js";
1
+ export { $DEVCOMP, $PROXY, $TRACK, batch, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, catchError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js";
2
2
  export type { Accessor, AccessorArray, ChildrenReturn, Context, EffectFunction, EffectOptions, InitializedResource, InitializedResourceOptions, InitializedResourceReturn, MemoOptions, NoInfer, OnEffectFunction, OnOptions, Owner, Resource, ResourceActions, ResourceFetcher, ResourceFetcherInfo, ResourceOptions, ResourceReturn, ResourceSource, ReturnTypes, Setter, Signal, SignalOptions } from "./reactive/signal.js";
3
3
  export * from "./reactive/observable.js";
4
4
  export * from "./reactive/scheduler.js";
package/types/jsx.d.ts CHANGED
@@ -799,6 +799,7 @@ export namespace JSX {
799
799
  checked?: boolean;
800
800
  crossorigin?: HTMLCrossorigin;
801
801
  disabled?: boolean;
802
+ enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
802
803
  form?: string;
803
804
  formaction?: string;
804
805
  formenctype?: HTMLFormEncType;
@@ -1215,6 +1216,7 @@ export namespace JSX {
1215
1216
  mask?: string;
1216
1217
  opacity?: number | string | "inherit";
1217
1218
  overflow?: "visible" | "hidden" | "scroll" | "auto" | "inherit";
1219
+ pathLength?: string | number;
1218
1220
  "pointer-events"?:
1219
1221
  | "bounding-box"
1220
1222
  | "visiblePainted"
@@ -1297,6 +1299,7 @@ export namespace JSX {
1297
1299
  gradientUnits?: SVGUnits;
1298
1300
  gradientTransform?: string;
1299
1301
  spreadMethod?: "pad" | "reflect" | "repeat";
1302
+ href?: string
1300
1303
  }
1301
1304
  interface GraphicsElementSVGAttributes<T>
1302
1305
  extends CoreSVGAttributes<T>,
@@ -1336,6 +1339,7 @@ export namespace JSX {
1336
1339
  | "stroke-dashoffset"
1337
1340
  | "stroke-opacity"
1338
1341
  | "shape-rendering"
1342
+ | "pathLength"
1339
1343
  > {}
1340
1344
  interface TextContentElementSVGAttributes<T>
1341
1345
  extends CoreSVGAttributes<T>,
@@ -1,4 +1,27 @@
1
1
  import { Accessor } from "./signal.js";
2
+ /**
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2017 Adam Haile
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ */
2
25
  /**
3
26
  * reactively transforms an array with a callback function - underlying helper for the `<For>` control flow
4
27
  *
@@ -1,3 +1,26 @@
1
+ /**
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2017 Adam Haile
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ */
1
24
  import { requestCallback } from "./scheduler.js";
2
25
  import type { JSX } from "../jsx.js";
3
26
  import type { FlowComponent } from "../render/index.js";
@@ -418,6 +441,17 @@ export declare function onMount(fn: () => void): void;
418
441
  */
419
442
  export declare function onCleanup<T extends () => any>(fn: T): T;
420
443
  /**
444
+ * catchError - run an effect whenever an error is thrown within the context of the child scopes
445
+ * @param fn boundary for the error
446
+ * @param handler an error handler that receives the error
447
+ *
448
+ * * If the error is thrown again inside the error handler, it will trigger the next available parent handler
449
+ *
450
+ * @description https://www.solidjs.com/docs/latest/api#catcherror
451
+ */
452
+ export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
453
+ /**
454
+ * @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
421
455
  * onError - run an effect whenever an error is thrown within the context of the child scopes
422
456
  * @param fn an error handler that receives the error
423
457
  *
@@ -452,7 +486,8 @@ export declare function useTransition(): Transition;
452
486
  export declare function resumeEffects(e: Computation<any>[]): void;
453
487
  export interface DevComponent<T> extends Memo<unknown> {
454
488
  props: T;
455
- componentName: string;
489
+ name: string;
490
+ component: (props: T) => unknown;
456
491
  }
457
492
  export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
458
493
  export declare function registerGraph(value: SourceMapValue): void;
@@ -36,21 +36,22 @@ export declare function Index<T extends readonly any[], U extends JSX.Element>(p
36
36
  fallback?: JSX.Element;
37
37
  children: (item: Accessor<T[number]>, index: number) => U;
38
38
  }): JSX.Element;
39
+ type RequiredParameter<T> = T extends () => unknown ? never : T;
39
40
  /**
40
41
  * Conditionally render its children or an optional fallback component
41
42
  * @description https://www.solidjs.com/docs/latest/api#show
42
43
  */
43
- export declare function Show<T>(props: {
44
+ export declare function Show<T, TRenderFunction extends (item: Accessor<NonNullable<T>>) => JSX.Element>(props: {
44
45
  when: T | undefined | null | false;
45
- keyed: true;
46
+ keyed?: false;
46
47
  fallback?: JSX.Element;
47
- children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
48
+ children: JSX.Element | RequiredParameter<TRenderFunction>;
48
49
  }): JSX.Element;
49
- export declare function Show<T>(props: {
50
+ export declare function Show<T, TRenderFunction extends (item: NonNullable<T>) => JSX.Element>(props: {
50
51
  when: T | undefined | null | false;
51
- keyed?: false;
52
+ keyed: true;
52
53
  fallback?: JSX.Element;
53
- children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
54
+ children: JSX.Element | RequiredParameter<TRenderFunction>;
54
55
  }): JSX.Element;
55
56
  /**
56
57
  * switches between content based on mutually exclusive conditions
@@ -73,7 +74,7 @@ export declare function Switch(props: {
73
74
  export type MatchProps<T> = {
74
75
  when: T | undefined | null | false;
75
76
  keyed?: boolean;
76
- children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
77
+ children: JSX.Element | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => JSX.Element);
77
78
  };
78
79
  /**
79
80
  * selects a content based on condition when inside a `<Switch>` control flow
@@ -84,15 +85,15 @@ export type MatchProps<T> = {
84
85
  * ```
85
86
  * @description https://www.solidjs.com/docs/latest/api#switchmatch
86
87
  */
87
- export declare function Match<T>(props: {
88
+ export declare function Match<T, TRenderFunction extends (item: Accessor<NonNullable<T>>) => JSX.Element>(props: {
88
89
  when: T | undefined | null | false;
89
- keyed: true;
90
- children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
90
+ keyed?: false;
91
+ children: JSX.Element | RequiredParameter<TRenderFunction>;
91
92
  }): JSX.Element;
92
- export declare function Match<T>(props: {
93
+ export declare function Match<T, TRenderFunction extends (item: NonNullable<T>) => JSX.Element>(props: {
93
94
  when: T | undefined | null | false;
94
- keyed?: false;
95
- children: JSX.Element;
95
+ keyed: true;
96
+ children: JSX.Element | RequiredParameter<TRenderFunction>;
96
97
  }): JSX.Element;
97
98
  export declare function resetErrorBoundaries(): void;
98
99
  /**
@@ -114,3 +115,4 @@ export declare function ErrorBoundary(props: {
114
115
  fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
115
116
  children: JSX.Element;
116
117
  }): JSX.Element;
118
+ export {};
@@ -6,13 +6,15 @@ export declare const DEV: undefined;
6
6
  export type Accessor<T> = () => T;
7
7
  export type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
8
8
  export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
9
- export declare const BRANCH: unique symbol;
10
9
  export declare function castError(err: unknown): Error;
11
10
  export declare let Owner: Owner | null;
12
11
  interface Owner {
13
12
  owner: Owner | null;
14
13
  context: any | null;
14
+ owned: Owner[] | null;
15
+ cleanups: (() => void)[] | null;
15
16
  }
17
+ export declare function createOwner(): Owner;
16
18
  export declare function createRoot<T>(fn: (dispose: () => void) => T, detachedOwner?: typeof Owner): T;
17
19
  export declare function createSignal<T>(value: T, options?: {
18
20
  equals?: false | ((prev: T, next: T) => boolean);
@@ -32,9 +34,11 @@ export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: A
32
34
  }): (prev?: U) => U | undefined;
33
35
  export declare function onMount(fn: () => void): void;
34
36
  export declare function onCleanup(fn: () => void): () => void;
35
- export declare function cleanNode(node: {
36
- cleanups?: Function[] | null;
37
- }): void;
37
+ export declare function cleanNode(node: Owner): void;
38
+ export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
39
+ /**
40
+ * @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
41
+ */
38
42
  export declare function onError(fn: (err: Error) => void): void;
39
43
  export declare function getListener(): null;
40
44
  export interface Context<T> {
@@ -1,4 +1,4 @@
1
- import { Setter, Signal } from "./reactive.js";
1
+ import { Accessor, Setter, Signal } from "./reactive.js";
2
2
  import type { JSX } from "../jsx.js";
3
3
  export type Component<P = {}> = (props: P) => JSX.Element;
4
4
  export type VoidProps<P = {}> = P & {
@@ -47,11 +47,15 @@ export declare function Index<T>(props: {
47
47
  fallback?: string;
48
48
  children: (item: () => T, index: number) => string;
49
49
  }): string | any[] | undefined;
50
+ /**
51
+ * Conditionally render its children or an optional fallback component
52
+ * @description https://www.solidjs.com/docs/latest/api#show
53
+ */
50
54
  export declare function Show<T>(props: {
51
55
  when: T | undefined | null | false;
52
56
  keyed?: boolean;
53
57
  fallback?: string;
54
- children: string | ((item: NonNullable<T>) => string);
58
+ children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
55
59
  }): string;
56
60
  export declare function Switch(props: {
57
61
  fallback?: string;
@@ -60,7 +64,7 @@ export declare function Switch(props: {
60
64
  type MatchProps<T> = {
61
65
  when: T | false;
62
66
  keyed?: boolean;
63
- children: string | ((item: T) => string);
67
+ children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
64
68
  };
65
69
  export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
66
70
  export declare function resetErrorBoundaries(): void;
package/web/dist/dev.cjs CHANGED
@@ -11,12 +11,33 @@ const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
11
11
  });
12
12
  const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
13
13
  class: "className",
14
- formnovalidate: "formNoValidate",
15
- ismap: "isMap",
16
- nomodule: "noModule",
17
- playsinline: "playsInline",
18
- readonly: "readOnly"
14
+ formnovalidate: {
15
+ $: "formNoValidate",
16
+ BUTTON: 1,
17
+ INPUT: 1
18
+ },
19
+ ismap: {
20
+ $: "isMap",
21
+ IMG: 1
22
+ },
23
+ nomodule: {
24
+ $: "noModule",
25
+ SCRIPT: 1
26
+ },
27
+ playsinline: {
28
+ $: "playsInline",
29
+ VIDEO: 1
30
+ },
31
+ readonly: {
32
+ $: "readOnly",
33
+ INPUT: 1,
34
+ TEXTAREA: 1
35
+ }
19
36
  });
37
+ function getPropAlias(prop, tagName) {
38
+ const a = PropAliases[prop];
39
+ return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
40
+ }
20
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"]);
21
42
  const SVGElements = /*#__PURE__*/new Set([
22
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",
@@ -98,13 +119,14 @@ function render(code, element, init, options = {}) {
98
119
  element.textContent = "";
99
120
  };
100
121
  }
101
- function template(html, check, isSVG) {
102
- const t = document.createElement("template");
103
- t.innerHTML = html;
104
- if (check && t.innerHTML.split("<").length - 1 !== check) throw `The browser resolved template HTML does not match JSX input:\n${t.innerHTML}\n\n${html}. Is your HTML properly formed?`;
105
- let node = t.content.firstChild;
106
- if (isSVG) node = node.firstChild;
107
- return node;
122
+ function template(html, isSVG, isCE) {
123
+ let node;
124
+ const create = () => {
125
+ const t = document.createElement("template");
126
+ t.innerHTML = html;
127
+ return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
128
+ };
129
+ return isCE ? () => (node || (node = create())).cloneNode(true) : () => solidJs.untrack(() => document.importNode(node || (node = create()), true));
108
130
  }
109
131
  function delegateEvents(eventNames, document = window.document) {
110
132
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
@@ -249,7 +271,7 @@ function getNextElement(template) {
249
271
  if (!solidJs.sharedConfig.context || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
250
272
  if (solidJs.sharedConfig.context) console.warn("Unable to find DOM nodes for hydration key:", key);
251
273
  if (!template) throw new Error("Unrecoverable Hydration Mismatch. No template for key: " + key);
252
- return template.cloneNode(true);
274
+ return template();
253
275
  }
254
276
  if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
255
277
  solidJs.sharedConfig.registry.delete(key);
@@ -304,7 +326,7 @@ function toggleClassKey(node, key, value) {
304
326
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
305
327
  }
306
328
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
307
- let isCE, isProp, isChildProp;
329
+ let isCE, isProp, isChildProp, propAlias, forceProp;
308
330
  if (prop === "style") return style(node, value, prev);
309
331
  if (prop === "classList") return classList(node, value, prev);
310
332
  if (value === prev) return prev;
@@ -329,8 +351,14 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
329
351
  addEventListener(node, name, value, delegate);
330
352
  delegate && delegateEvents([name]);
331
353
  }
332
- } else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
333
- if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[PropAliases[prop] || prop] = value;
354
+ } else if (prop.slice(0, 5) === "attr:") {
355
+ setAttribute(node, prop.slice(5), value);
356
+ } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
357
+ if (forceProp) {
358
+ prop = prop.slice(5);
359
+ isProp = true;
360
+ }
361
+ if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
334
362
  } else {
335
363
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
336
364
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
@@ -352,17 +380,7 @@ function eventHandler(e) {
352
380
  return node || document;
353
381
  }
354
382
  });
355
- if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
356
- solidJs.sharedConfig.done = true;
357
- document.querySelectorAll("[id^=pl-]").forEach(elem => {
358
- while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
359
- let x = elem.nextSibling;
360
- elem.remove();
361
- elem = x;
362
- }
363
- elem && elem.remove();
364
- });
365
- }
383
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) solidJs.sharedConfig.done = _$HY.done = true;
366
384
  while (node) {
367
385
  const handler = node[key];
368
386
  if (handler && !node.disabled) {
@@ -374,7 +392,15 @@ function eventHandler(e) {
374
392
  }
375
393
  }
376
394
  function insertExpression(parent, value, current, marker, unwrapArray) {
377
- if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
395
+ if (solidJs.sharedConfig.context) {
396
+ !current && (current = [...parent.childNodes]);
397
+ let cleaned = [];
398
+ for (let i = 0; i < current.length; i++) {
399
+ const node = current[i];
400
+ if (node.nodeType === 8 && node.data === "!") node.remove();else cleaned.push(node);
401
+ }
402
+ current = cleaned;
403
+ }
378
404
  while (typeof current === "function") current = current();
379
405
  if (value === current) return current;
380
406
  const t = typeof value,
@@ -460,7 +486,8 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
460
486
  }
461
487
  } else {
462
488
  const value = String(item);
463
- if (prev && prev.nodeType === 3 && prev.data === value) {
489
+ if (prev && prev.nodeType === 3) {
490
+ prev.data = value;
464
491
  normalized.push(prev);
465
492
  } else normalized.push(document.createTextNode(value));
466
493
  }
@@ -529,6 +556,7 @@ function escape(html) {}
529
556
  function ssrSpread(props, isSVG, skipChildren) {}
530
557
 
531
558
  const isServer = false;
559
+ const isDev = true;
532
560
  const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
533
561
  function createElement(tagName, isSVG = false) {
534
562
  return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
@@ -542,37 +570,41 @@ function Portal(props) {
542
570
  useShadow
543
571
  } = props,
544
572
  marker = document.createTextNode(""),
545
- mount = props.mount || document.body;
573
+ mount = () => props.mount || document.body,
574
+ content = solidJs.createMemo(renderPortal());
546
575
  function renderPortal() {
547
576
  if (solidJs.sharedConfig.context) {
548
577
  const [s, set] = solidJs.createSignal(false);
549
- queueMicrotask(() => set(true));
578
+ solidJs.onMount(() => set(true));
550
579
  return () => s() && props.children;
551
580
  } else return () => props.children;
552
581
  }
553
- if (mount instanceof HTMLHeadElement) {
554
- const [clean, setClean] = solidJs.createSignal(false);
555
- const cleanup = () => setClean(true);
556
- solidJs.createRoot(dispose => insert(mount, () => !clean() ? renderPortal()() : dispose(), null));
557
- solidJs.onCleanup(() => {
558
- if (solidJs.sharedConfig.context) queueMicrotask(cleanup);else cleanup();
559
- });
560
- } else {
561
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
562
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
563
- mode: "open"
564
- }) : container;
565
- Object.defineProperty(container, "_$host", {
566
- get() {
567
- return marker.parentNode;
568
- },
569
- configurable: true
570
- });
571
- insert(renderRoot, renderPortal());
572
- mount.appendChild(container);
573
- props.ref && props.ref(container);
574
- solidJs.onCleanup(() => mount.removeChild(container));
575
- }
582
+ solidJs.createRenderEffect(() => {
583
+ const el = mount();
584
+ if (el instanceof HTMLHeadElement) {
585
+ const [clean, setClean] = solidJs.createSignal(false);
586
+ const cleanup = () => setClean(true);
587
+ solidJs.createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
588
+ solidJs.onCleanup(() => {
589
+ if (solidJs.sharedConfig.context) queueMicrotask(cleanup);else cleanup();
590
+ });
591
+ } else {
592
+ const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
593
+ renderRoot = useShadow && container.attachShadow ? container.attachShadow({
594
+ mode: "open"
595
+ }) : container;
596
+ Object.defineProperty(container, "_$host", {
597
+ get() {
598
+ return marker.parentNode;
599
+ },
600
+ configurable: true
601
+ });
602
+ insert(renderRoot, content);
603
+ el.appendChild(container);
604
+ props.ref && props.ref(container);
605
+ solidJs.onCleanup(() => el.removeChild(container));
606
+ }
607
+ });
576
608
  return marker;
577
609
  }
578
610
  function Dynamic(props) {
@@ -661,7 +693,6 @@ exports.Hydration = Hydration;
661
693
  exports.HydrationScript = voidFn;
662
694
  exports.NoHydration = NoHydration;
663
695
  exports.Portal = Portal;
664
- exports.PropAliases = PropAliases;
665
696
  exports.Properties = Properties;
666
697
  exports.SVGElements = SVGElements;
667
698
  exports.SVGNamespace = SVGNamespace;
@@ -679,9 +710,11 @@ exports.getHydrationKey = getHydrationKey;
679
710
  exports.getNextElement = getNextElement;
680
711
  exports.getNextMarker = getNextMarker;
681
712
  exports.getNextMatch = getNextMatch;
713
+ exports.getPropAlias = getPropAlias;
682
714
  exports.hydrate = hydrate;
683
715
  exports.innerHTML = innerHTML;
684
716
  exports.insert = insert;
717
+ exports.isDev = isDev;
685
718
  exports.isServer = isServer;
686
719
  exports.render = render;
687
720
  exports.renderToStream = renderToStream;