solid-js 1.6.8 → 1.6.10

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.
@@ -13,8 +13,12 @@ declare global {
13
13
  var _$afterCreateRoot: ((root: Owner) => void) | undefined;
14
14
  }
15
15
  export declare type ComputationState = 0 | 1 | 2;
16
- export interface SignalState<T> {
17
- value?: T;
16
+ export interface SourceMapValue {
17
+ value: unknown;
18
+ graph?: Owner;
19
+ }
20
+ export interface SignalState<T> extends SourceMapValue {
21
+ value: T;
18
22
  observers: Computation<any>[] | null;
19
23
  observerSlots: number[] | null;
20
24
  tValue?: T;
@@ -26,9 +30,7 @@ export interface Owner {
26
30
  cleanups: (() => void)[] | null;
27
31
  owner: Owner | null;
28
32
  context: any | null;
29
- sourceMap?: Record<string, {
30
- value: unknown;
31
- }>;
33
+ sourceMap?: Record<string, SourceMapValue>;
32
34
  name?: string;
33
35
  componentName?: string;
34
36
  }
@@ -175,6 +177,7 @@ export declare function createEffect<Next, Init = Next>(fn: EffectFunction<Init
175
177
  */
176
178
  export declare function createReaction(onInvalidate: () => void, options?: EffectOptions): (tracking: () => void) => void;
177
179
  export interface Memo<Prev, Next = Prev> extends SignalState<Next>, Computation<Next> {
180
+ value: Next;
178
181
  tOwned?: Computation<Prev | Next, Next>[];
179
182
  }
180
183
  export interface MemoOptions<T> extends EffectOptions {
@@ -409,9 +412,11 @@ export declare function onMount(fn: () => void): void;
409
412
  * onCleanup - run an effect once before the reactive scope is disposed
410
413
  * @param fn an effect that should run only once on cleanup
411
414
  *
415
+ * @returns the same {@link fn} function that was passed in
416
+ *
412
417
  * @description https://www.solidjs.com/docs/latest/api#oncleanup
413
418
  */
414
- export declare function onCleanup(fn: () => void): () => void;
419
+ export declare function onCleanup<T extends () => any>(fn: T): T;
415
420
  /**
416
421
  * onError - run an effect whenever an error is thrown within the context of the child scopes
417
422
  * @param fn an error handler that receives the error
@@ -451,9 +456,7 @@ export interface DevComponent<T> extends Memo<JSX.Element> {
451
456
  }
452
457
  export declare function devComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
453
458
  export declare function hashValue(v: any): string;
454
- export declare function registerGraph(name: string, value: {
455
- value: unknown;
456
- }): string;
459
+ export declare function registerGraph(name: string, value: SourceMapValue): string;
457
460
  interface GraphRecord {
458
461
  [k: string]: GraphRecord | unknown;
459
462
  }
@@ -2,7 +2,7 @@ import type { JSX } from "../jsx.js";
2
2
  /**
3
3
  * **[experimental]** controls the order in which suspended content is rendered
4
4
  *
5
- * @description https://www.solidjs.com/docs/latest/api#%3Csuspenselist%3E-(experimental)
5
+ * @description https://www.solidjs.com/docs/latest/api#suspenselist-experimental
6
6
  */
7
7
  export declare function SuspenseList(props: {
8
8
  children: JSX.Element;
@@ -18,7 +18,7 @@ export declare function SuspenseList(props: {
18
18
  * <AsyncComponent />
19
19
  * </Suspense>
20
20
  * ```
21
- * @description https://www.solidjs.com/docs/latest/api#%3Csuspense%3E
21
+ * @description https://www.solidjs.com/docs/latest/api#suspense
22
22
  */
23
23
  export declare function Suspense(props: {
24
24
  fallback?: JSX.Element;
@@ -11,7 +11,7 @@ import type { JSX } from "../jsx.js";
11
11
  * ```
12
12
  * If you have a list with fixed indices and changing values, consider using `<Index>` instead.
13
13
  *
14
- * @description https://www.solidjs.com/docs/latest/api#%3Cfor%3E
14
+ * @description https://www.solidjs.com/docs/latest/api#for
15
15
  */
16
16
  export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
17
17
  each: T | undefined | null | false;
@@ -29,7 +29,7 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
29
29
  * ```
30
30
  * If you have a list with changing indices, better use `<For>`.
31
31
  *
32
- * @description https://www.solidjs.com/docs/latest/api#%3Cindex%3E
32
+ * @description https://www.solidjs.com/docs/latest/api#index
33
33
  */
34
34
  export declare function Index<T extends readonly any[], U extends JSX.Element>(props: {
35
35
  each: T | undefined | null | false;
@@ -38,7 +38,7 @@ export declare function Index<T extends readonly any[], U extends JSX.Element>(p
38
38
  }): Accessor<U[]>;
39
39
  /**
40
40
  * Conditionally render its children or an optional fallback component
41
- * @description https://www.solidjs.com/docs/latest/api#%3Cshow%3E
41
+ * @description https://www.solidjs.com/docs/latest/api#show
42
42
  */
43
43
  export declare function Show<T>(props: {
44
44
  when: T | undefined | null | false;
@@ -64,7 +64,7 @@ export declare function Show<T>(props: {
64
64
  * </Match>
65
65
  * </Switch>
66
66
  * ```
67
- * @description https://www.solidjs.com/docs/latest/api#%3Cswitch%3E%2F%3Cmatch%3E
67
+ * @description https://www.solidjs.com/docs/latest/api#switchmatch
68
68
  */
69
69
  export declare function Switch(props: {
70
70
  fallback?: JSX.Element;
@@ -82,7 +82,7 @@ export declare type MatchProps<T> = {
82
82
  * <Content/>
83
83
  * </Match>
84
84
  * ```
85
- * @description https://www.solidjs.com/docs/latest/api#%3Cswitch%3E%2F%3Cmatch%3E
85
+ * @description https://www.solidjs.com/docs/latest/api#switchmatch
86
86
  */
87
87
  export declare function Match<T>(props: {
88
88
  when: T | undefined | null | false;
@@ -108,7 +108,7 @@ export declare function resetErrorBoundaries(): void;
108
108
  * ```
109
109
  * Errors thrown from the fallback can be caught by a parent ErrorBoundary
110
110
  *
111
- * @description https://www.solidjs.com/docs/latest/api#%3Cerrorboundary%3E
111
+ * @description https://www.solidjs.com/docs/latest/api#errorboundary
112
112
  */
113
113
  export declare function ErrorBoundary(props: {
114
114
  fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
@@ -23,7 +23,7 @@ function createRenderer$1({
23
23
  while (typeof current === "function") current = current();
24
24
  if (value === current) return current;
25
25
  const t = typeof value,
26
- multi = marker !== undefined;
26
+ multi = marker !== undefined;
27
27
  if (t === "string" || t === "number") {
28
28
  if (t === "number") value = value.toString();
29
29
  if (multi) {
@@ -85,7 +85,7 @@ function createRenderer$1({
85
85
  let dynamic = false;
86
86
  for (let i = 0, len = array.length; i < len; i++) {
87
87
  let item = array[i],
88
- t;
88
+ t;
89
89
  if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
90
90
  dynamic = normalizeIncomingArray(normalized, item) || dynamic;
91
91
  } else if ((t = typeof item) === "string" || t === "number") {
@@ -104,12 +104,12 @@ function createRenderer$1({
104
104
  }
105
105
  function reconcileArrays(parentNode, a, b) {
106
106
  let bLength = b.length,
107
- aEnd = a.length,
108
- bEnd = bLength,
109
- aStart = 0,
110
- bStart = 0,
111
- after = getNextSibling(a[aEnd - 1]),
112
- map = null;
107
+ aEnd = a.length,
108
+ bEnd = bLength,
109
+ aStart = 0,
110
+ bStart = 0,
111
+ after = getNextSibling(a[aEnd - 1]),
112
+ map = null;
113
113
  while (aStart < aEnd || bStart < bEnd) {
114
114
  if (a[aStart] === b[bStart]) {
115
115
  aStart++;
@@ -143,8 +143,8 @@ function createRenderer$1({
143
143
  if (index != null) {
144
144
  if (bStart < index && index < bEnd) {
145
145
  let i = aStart,
146
- sequence = 1,
147
- t;
146
+ sequence = 1,
147
+ t;
148
148
  while (++i < aEnd && i < bEnd) {
149
149
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
150
150
  sequence++;
@@ -21,7 +21,7 @@ function createRenderer$1({
21
21
  while (typeof current === "function") current = current();
22
22
  if (value === current) return current;
23
23
  const t = typeof value,
24
- multi = marker !== undefined;
24
+ multi = marker !== undefined;
25
25
  if (t === "string" || t === "number") {
26
26
  if (t === "number") value = value.toString();
27
27
  if (multi) {
@@ -83,7 +83,7 @@ function createRenderer$1({
83
83
  let dynamic = false;
84
84
  for (let i = 0, len = array.length; i < len; i++) {
85
85
  let item = array[i],
86
- t;
86
+ t;
87
87
  if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
88
88
  dynamic = normalizeIncomingArray(normalized, item) || dynamic;
89
89
  } else if ((t = typeof item) === "string" || t === "number") {
@@ -102,12 +102,12 @@ function createRenderer$1({
102
102
  }
103
103
  function reconcileArrays(parentNode, a, b) {
104
104
  let bLength = b.length,
105
- aEnd = a.length,
106
- bEnd = bLength,
107
- aStart = 0,
108
- bStart = 0,
109
- after = getNextSibling(a[aEnd - 1]),
110
- map = null;
105
+ aEnd = a.length,
106
+ bEnd = bLength,
107
+ aStart = 0,
108
+ bStart = 0,
109
+ after = getNextSibling(a[aEnd - 1]),
110
+ map = null;
111
111
  while (aStart < aEnd || bStart < bEnd) {
112
112
  if (a[aStart] === b[bStart]) {
113
113
  aStart++;
@@ -141,8 +141,8 @@ function createRenderer$1({
141
141
  if (index != null) {
142
142
  if (bStart < index && index < bEnd) {
143
143
  let i = aStart,
144
- sequence = 1,
145
- t;
144
+ sequence = 1,
145
+ t;
146
146
  while (++i < aEnd && i < bEnd) {
147
147
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
148
148
  sequence++;
@@ -23,7 +23,7 @@ function createRenderer$1({
23
23
  while (typeof current === "function") current = current();
24
24
  if (value === current) return current;
25
25
  const t = typeof value,
26
- multi = marker !== undefined;
26
+ multi = marker !== undefined;
27
27
  if (t === "string" || t === "number") {
28
28
  if (t === "number") value = value.toString();
29
29
  if (multi) {
@@ -85,7 +85,7 @@ function createRenderer$1({
85
85
  let dynamic = false;
86
86
  for (let i = 0, len = array.length; i < len; i++) {
87
87
  let item = array[i],
88
- t;
88
+ t;
89
89
  if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
90
90
  dynamic = normalizeIncomingArray(normalized, item) || dynamic;
91
91
  } else if ((t = typeof item) === "string" || t === "number") {
@@ -104,12 +104,12 @@ function createRenderer$1({
104
104
  }
105
105
  function reconcileArrays(parentNode, a, b) {
106
106
  let bLength = b.length,
107
- aEnd = a.length,
108
- bEnd = bLength,
109
- aStart = 0,
110
- bStart = 0,
111
- after = getNextSibling(a[aEnd - 1]),
112
- map = null;
107
+ aEnd = a.length,
108
+ bEnd = bLength,
109
+ aStart = 0,
110
+ bStart = 0,
111
+ after = getNextSibling(a[aEnd - 1]),
112
+ map = null;
113
113
  while (aStart < aEnd || bStart < bEnd) {
114
114
  if (a[aStart] === b[bStart]) {
115
115
  aStart++;
@@ -143,8 +143,8 @@ function createRenderer$1({
143
143
  if (index != null) {
144
144
  if (bStart < index && index < bEnd) {
145
145
  let i = aStart,
146
- sequence = 1,
147
- t;
146
+ sequence = 1,
147
+ t;
148
148
  while (++i < aEnd && i < bEnd) {
149
149
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
150
150
  sequence++;
@@ -21,7 +21,7 @@ function createRenderer$1({
21
21
  while (typeof current === "function") current = current();
22
22
  if (value === current) return current;
23
23
  const t = typeof value,
24
- multi = marker !== undefined;
24
+ multi = marker !== undefined;
25
25
  if (t === "string" || t === "number") {
26
26
  if (t === "number") value = value.toString();
27
27
  if (multi) {
@@ -83,7 +83,7 @@ function createRenderer$1({
83
83
  let dynamic = false;
84
84
  for (let i = 0, len = array.length; i < len; i++) {
85
85
  let item = array[i],
86
- t;
86
+ t;
87
87
  if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
88
88
  dynamic = normalizeIncomingArray(normalized, item) || dynamic;
89
89
  } else if ((t = typeof item) === "string" || t === "number") {
@@ -102,12 +102,12 @@ function createRenderer$1({
102
102
  }
103
103
  function reconcileArrays(parentNode, a, b) {
104
104
  let bLength = b.length,
105
- aEnd = a.length,
106
- bEnd = bLength,
107
- aStart = 0,
108
- bStart = 0,
109
- after = getNextSibling(a[aEnd - 1]),
110
- map = null;
105
+ aEnd = a.length,
106
+ bEnd = bLength,
107
+ aStart = 0,
108
+ bStart = 0,
109
+ after = getNextSibling(a[aEnd - 1]),
110
+ map = null;
111
111
  while (aStart < aEnd || bStart < bEnd) {
112
112
  if (a[aStart] === b[bStart]) {
113
113
  aStart++;
@@ -141,8 +141,8 @@ function createRenderer$1({
141
141
  if (index != null) {
142
142
  if (bStart < index && index < bEnd) {
143
143
  let i = aStart,
144
- sequence = 1,
145
- t;
144
+ sequence = 1,
145
+ t;
146
146
  while (++i < aEnd && i < bEnd) {
147
147
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
148
148
  sequence++;
package/web/dist/dev.cjs CHANGED
@@ -31,12 +31,12 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
31
31
 
32
32
  function reconcileArrays(parentNode, a, b) {
33
33
  let bLength = b.length,
34
- aEnd = a.length,
35
- bEnd = bLength,
36
- aStart = 0,
37
- bStart = 0,
38
- after = a[aEnd - 1].nextSibling,
39
- map = null;
34
+ aEnd = a.length,
35
+ bEnd = bLength,
36
+ aStart = 0,
37
+ bStart = 0,
38
+ after = a[aEnd - 1].nextSibling,
39
+ map = null;
40
40
  while (aStart < aEnd || bStart < bEnd) {
41
41
  if (a[aStart] === b[bStart]) {
42
42
  aStart++;
@@ -70,8 +70,8 @@ function reconcileArrays(parentNode, a, b) {
70
70
  if (index != null) {
71
71
  if (bStart < index && index < bEnd) {
72
72
  let i = aStart,
73
- sequence = 1,
74
- t;
73
+ sequence = 1,
74
+ t;
75
75
  while (++i < aEnd && i < bEnd) {
76
76
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
77
77
  sequence++;
@@ -144,7 +144,7 @@ function addEventListener(node, name, handler, delegate) {
144
144
  }
145
145
  function classList(node, value, prev = {}) {
146
146
  const classKeys = Object.keys(value || {}),
147
- prevKeys = Object.keys(prev);
147
+ prevKeys = Object.keys(prev);
148
148
  let i, len;
149
149
  for (i = 0, len = prevKeys.length; i < len; i++) {
150
150
  const key = prevKeys[i];
@@ -154,7 +154,7 @@ function classList(node, value, prev = {}) {
154
154
  }
155
155
  for (i = 0, len = classKeys.length; i < len; i++) {
156
156
  const key = classKeys[i],
157
- classValue = !!value[key];
157
+ classValue = !!value[key];
158
158
  if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
159
159
  toggleClassKey(node, key, true);
160
160
  prev[key] = classValue;
@@ -261,8 +261,8 @@ function getNextMatch(el, nodeName) {
261
261
  }
262
262
  function getNextMarker(start) {
263
263
  let end = start,
264
- count = 0,
265
- current = [];
264
+ count = 0,
265
+ current = [];
266
266
  if (solidJs.sharedConfig.context) {
267
267
  while (end) {
268
268
  if (end.nodeType === 8) {
@@ -354,7 +354,14 @@ function eventHandler(e) {
354
354
  });
355
355
  if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
356
356
  solidJs.sharedConfig.done = true;
357
- document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
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
+ });
358
365
  }
359
366
  while (node) {
360
367
  const handler = node[key];
@@ -371,7 +378,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
371
378
  while (typeof current === "function") current = current();
372
379
  if (value === current) return current;
373
380
  const t = typeof value,
374
- multi = marker !== undefined;
381
+ multi = marker !== undefined;
375
382
  parent = multi && current[0] && current[0].parentNode || parent;
376
383
  if (t === "string" || t === "number") {
377
384
  if (solidJs.sharedConfig.context) return current;
@@ -438,7 +445,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
438
445
  let dynamic = false;
439
446
  for (let i = 0, len = array.length; i < len; i++) {
440
447
  let item = array[i],
441
- prev = current && current[i];
448
+ prev = current && current[i];
442
449
  if (item instanceof Node) {
443
450
  normalized.push(item);
444
451
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
@@ -532,10 +539,10 @@ const hydrate = (...args) => {
532
539
  };
533
540
  function Portal(props) {
534
541
  const {
535
- useShadow
536
- } = props,
537
- marker = document.createTextNode(""),
538
- mount = props.mount || document.body;
542
+ useShadow
543
+ } = props,
544
+ marker = document.createTextNode(""),
545
+ mount = props.mount || document.body;
539
546
  function renderPortal() {
540
547
  if (solidJs.sharedConfig.context) {
541
548
  const [s, set] = solidJs.createSignal(false);
@@ -552,9 +559,9 @@ function Portal(props) {
552
559
  });
553
560
  } else {
554
561
  const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
555
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
556
- mode: "open"
557
- }) : container;
562
+ renderRoot = useShadow && container.attachShadow ? container.attachShadow({
563
+ mode: "open"
564
+ }) : container;
558
565
  Object.defineProperty(container, "_$host", {
559
566
  get() {
560
567
  return marker.parentNode;
package/web/dist/dev.js CHANGED
@@ -30,12 +30,12 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
30
30
 
31
31
  function reconcileArrays(parentNode, a, b) {
32
32
  let bLength = b.length,
33
- aEnd = a.length,
34
- bEnd = bLength,
35
- aStart = 0,
36
- bStart = 0,
37
- after = a[aEnd - 1].nextSibling,
38
- map = null;
33
+ aEnd = a.length,
34
+ bEnd = bLength,
35
+ aStart = 0,
36
+ bStart = 0,
37
+ after = a[aEnd - 1].nextSibling,
38
+ map = null;
39
39
  while (aStart < aEnd || bStart < bEnd) {
40
40
  if (a[aStart] === b[bStart]) {
41
41
  aStart++;
@@ -69,8 +69,8 @@ function reconcileArrays(parentNode, a, b) {
69
69
  if (index != null) {
70
70
  if (bStart < index && index < bEnd) {
71
71
  let i = aStart,
72
- sequence = 1,
73
- t;
72
+ sequence = 1,
73
+ t;
74
74
  while (++i < aEnd && i < bEnd) {
75
75
  if ((t = map.get(a[i])) == null || t !== index + sequence) break;
76
76
  sequence++;
@@ -143,7 +143,7 @@ function addEventListener(node, name, handler, delegate) {
143
143
  }
144
144
  function classList(node, value, prev = {}) {
145
145
  const classKeys = Object.keys(value || {}),
146
- prevKeys = Object.keys(prev);
146
+ prevKeys = Object.keys(prev);
147
147
  let i, len;
148
148
  for (i = 0, len = prevKeys.length; i < len; i++) {
149
149
  const key = prevKeys[i];
@@ -153,7 +153,7 @@ function classList(node, value, prev = {}) {
153
153
  }
154
154
  for (i = 0, len = classKeys.length; i < len; i++) {
155
155
  const key = classKeys[i],
156
- classValue = !!value[key];
156
+ classValue = !!value[key];
157
157
  if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
158
158
  toggleClassKey(node, key, true);
159
159
  prev[key] = classValue;
@@ -260,8 +260,8 @@ function getNextMatch(el, nodeName) {
260
260
  }
261
261
  function getNextMarker(start) {
262
262
  let end = start,
263
- count = 0,
264
- current = [];
263
+ count = 0,
264
+ current = [];
265
265
  if (sharedConfig.context) {
266
266
  while (end) {
267
267
  if (end.nodeType === 8) {
@@ -353,7 +353,14 @@ function eventHandler(e) {
353
353
  });
354
354
  if (sharedConfig.registry && !sharedConfig.done) {
355
355
  sharedConfig.done = true;
356
- document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
356
+ document.querySelectorAll("[id^=pl-]").forEach(elem => {
357
+ while (elem && elem.nodeType !== 8 && elem.nodeValue !== "pl-" + e) {
358
+ let x = elem.nextSibling;
359
+ elem.remove();
360
+ elem = x;
361
+ }
362
+ elem && elem.remove();
363
+ });
357
364
  }
358
365
  while (node) {
359
366
  const handler = node[key];
@@ -370,7 +377,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
370
377
  while (typeof current === "function") current = current();
371
378
  if (value === current) return current;
372
379
  const t = typeof value,
373
- multi = marker !== undefined;
380
+ multi = marker !== undefined;
374
381
  parent = multi && current[0] && current[0].parentNode || parent;
375
382
  if (t === "string" || t === "number") {
376
383
  if (sharedConfig.context) return current;
@@ -437,7 +444,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
437
444
  let dynamic = false;
438
445
  for (let i = 0, len = array.length; i < len; i++) {
439
446
  let item = array[i],
440
- prev = current && current[i];
447
+ prev = current && current[i];
441
448
  if (item instanceof Node) {
442
449
  normalized.push(item);
443
450
  } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
@@ -531,10 +538,10 @@ const hydrate = (...args) => {
531
538
  };
532
539
  function Portal(props) {
533
540
  const {
534
- useShadow
535
- } = props,
536
- marker = document.createTextNode(""),
537
- mount = props.mount || document.body;
541
+ useShadow
542
+ } = props,
543
+ marker = document.createTextNode(""),
544
+ mount = props.mount || document.body;
538
545
  function renderPortal() {
539
546
  if (sharedConfig.context) {
540
547
  const [s, set] = createSignal(false);
@@ -551,9 +558,9 @@ function Portal(props) {
551
558
  });
552
559
  } else {
553
560
  const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
554
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
555
- mode: "open"
556
- }) : container;
561
+ renderRoot = useShadow && container.attachShadow ? container.attachShadow({
562
+ mode: "open"
563
+ }) : container;
557
564
  Object.defineProperty(container, "_$host", {
558
565
  get() {
559
566
  return marker.parentNode;
@@ -261,7 +261,7 @@ function toRefParam(index) {
261
261
  return ref;
262
262
  }
263
263
 
264
- const REPLACE_SCRIPT = `function $df(e,t,d,l){d=document.getElementById(e),(l=document.getElementById("pl-"+e))&&l.replaceWith(...d.childNodes),d.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
264
+ const REPLACE_SCRIPT = `function $df(e,t,n,o,d){if(n=document.getElementById(e),o=document.getElementById("pl-"+e)){for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)d=o.nextSibling,o.remove(),o=d;o.replaceWith(n.content)}n.remove(),_$HY.set(e,t),_$HY.fe(e)}`;
265
265
  function renderToString(code, options = {}) {
266
266
  let scripts = "";
267
267
  solidJs.sharedConfig.context = {
@@ -392,7 +392,7 @@ function renderToStream(code, options = {}) {
392
392
  Promise.resolve().then(() => html = replacePlaceholder(html, key, value !== undefined ? value : ""));
393
393
  error && pushTask(serializeSet(dedupe, key, error, serializeError));
394
394
  } else {
395
- buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div>`);
395
+ buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
396
396
  pushTask(`${keys.length ? keys.map(k => `_$HY.unset("${k}")`).join(";") + ";" : ""}$df("${key}"${error ? "," + serializeError(error) : ""})${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
397
397
  scriptFlushed = true;
398
398
  }
@@ -495,10 +495,10 @@ function ssr(t, ...nodes) {
495
495
  function ssrClassList(value) {
496
496
  if (!value) return "";
497
497
  let classKeys = Object.keys(value),
498
- result = "";
498
+ result = "";
499
499
  for (let i = 0, len = classKeys.length; i < len; i++) {
500
500
  const key = classKeys[i],
501
- classValue = !!value[key];
501
+ classValue = !!value[key];
502
502
  if (!key || key === "undefined" || !classValue) continue;
503
503
  i && (result += " ");
504
504
  result += key;
@@ -579,7 +579,7 @@ function escape(s, attr) {
579
579
  let iAmp = s.indexOf("&");
580
580
  if (iDelim < 0 && iAmp < 0) return s;
581
581
  let left = 0,
582
- out = "";
582
+ out = "";
583
583
  while (iDelim >= 0 && iAmp >= 0) {
584
584
  if (iDelim < iAmp) {
585
585
  if (left < iDelim) out += s.substring(left, iDelim);
@@ -643,7 +643,8 @@ function generateHydrationScript({
643
643
  function Hydration(props) {
644
644
  if (!solidJs.sharedConfig.context.noHydrate) return props.children;
645
645
  const context = solidJs.sharedConfig.context;
646
- solidJs.sharedConfig.context = { ...context,
646
+ solidJs.sharedConfig.context = {
647
+ ...context,
647
648
  count: 0,
648
649
  id: `${context.id}${context.count++}-`,
649
650
  noHydrate: false
@@ -701,21 +702,12 @@ function serializeSet(registry, key, value, serializer = stringify) {
701
702
  return `_$HY.set("${key}", ${serializer(value)})`;
702
703
  }
703
704
  function replacePlaceholder(html, key, value) {
704
- const nextRegex = /(<[/]?span[^>]*>)/g;
705
- const marker = `<span id="pl-${key}">`;
705
+ const marker = `<template id="pl-${key}">`;
706
+ const close = `<!pl-${key}>`;
706
707
  const first = html.indexOf(marker);
707
708
  if (first === -1) return html;
708
- nextRegex.lastIndex = first + marker.length;
709
- let match;
710
- let open = 0,
711
- close = 0;
712
- while (match = nextRegex.exec(html)) {
713
- if (match[0][1] === "/") {
714
- close++;
715
- if (close > open) break;
716
- } else open++;
717
- }
718
- return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
709
+ const last = html.indexOf(close, first + marker.length);
710
+ return html.slice(0, first) + value + html.slice(last + close.length);
719
711
  }
720
712
  function Assets(props) {
721
713
  useAssets(() => props.children);
@@ -794,7 +786,7 @@ function delegateEvents() {}
794
786
  function Dynamic(props) {
795
787
  const [p, others] = solidJs.splitProps(props, ["component"]);
796
788
  const comp = p.component,
797
- t = typeof comp;
789
+ t = typeof comp;
798
790
  if (comp) {
799
791
  if (t === "function") return comp(others);else if (t === "string") {
800
792
  return ssrElement(comp, others, undefined, true);