solid-js 1.3.14 → 1.3.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 CHANGED
@@ -388,7 +388,7 @@ function createSelector(source, fn = equalFn, options) {
388
388
  const subs = new Map();
389
389
  const node = createComputation(p => {
390
390
  const v = source();
391
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
391
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
392
392
  const l = subs.get(key);
393
393
  for (const c of l.values()) {
394
394
  c.state = STALE;
@@ -448,8 +448,8 @@ options) {
448
448
  return prevValue => {
449
449
  let input;
450
450
  if (isArray) {
451
- input = [];
452
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
451
+ input = Array(deps.length);
452
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
453
453
  } else input = deps();
454
454
  if (defer) {
455
455
  defer = false;
@@ -880,6 +880,7 @@ function runUserEffects(queue) {
880
880
  const e = queue[i];
881
881
  if (!e.user) runTop(e);else queue[userLength++] = e;
882
882
  }
883
+ if (sharedConfig.context) setHydrateContext();
883
884
  const resume = queue.length;
884
885
  for (i = 0; i < userLength; i++) runTop(queue[i]);
885
886
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
@@ -1532,7 +1533,7 @@ function Suspense(props) {
1532
1533
  });
1533
1534
  flicker = s;
1534
1535
  p.then(err => {
1535
- if (error = err) return set();
1536
+ if ((error = err) || sharedConfig.done) return set();
1536
1537
  sharedConfig.gather(key);
1537
1538
  setHydrateContext(ctx);
1538
1539
  set();
package/dist/dev.js CHANGED
@@ -384,7 +384,7 @@ function createSelector(source, fn = equalFn, options) {
384
384
  const subs = new Map();
385
385
  const node = createComputation(p => {
386
386
  const v = source();
387
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
387
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
388
388
  const l = subs.get(key);
389
389
  for (const c of l.values()) {
390
390
  c.state = STALE;
@@ -444,8 +444,8 @@ options) {
444
444
  return prevValue => {
445
445
  let input;
446
446
  if (isArray) {
447
- input = [];
448
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
447
+ input = Array(deps.length);
448
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
449
449
  } else input = deps();
450
450
  if (defer) {
451
451
  defer = false;
@@ -876,6 +876,7 @@ function runUserEffects(queue) {
876
876
  const e = queue[i];
877
877
  if (!e.user) runTop(e);else queue[userLength++] = e;
878
878
  }
879
+ if (sharedConfig.context) setHydrateContext();
879
880
  const resume = queue.length;
880
881
  for (i = 0; i < userLength; i++) runTop(queue[i]);
881
882
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
@@ -1528,7 +1529,7 @@ function Suspense(props) {
1528
1529
  });
1529
1530
  flicker = s;
1530
1531
  p.then(err => {
1531
- if (error = err) return set();
1532
+ if ((error = err) || sharedConfig.done) return set();
1532
1533
  sharedConfig.gather(key);
1533
1534
  setHydrateContext(ctx);
1534
1535
  set();
package/dist/server.cjs CHANGED
@@ -221,7 +221,11 @@ function resolveSSRNode(node) {
221
221
  const t = typeof node;
222
222
  if (t === "string") return node;
223
223
  if (node == null || t === "boolean") return "";
224
- if (Array.isArray(node)) return node.map(resolveSSRNode).join("");
224
+ if (Array.isArray(node)) {
225
+ let mapped = "";
226
+ for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
227
+ return mapped;
228
+ }
225
229
  if (t === "object") return resolveSSRNode(node.t);
226
230
  if (t === "function") return resolveSSRNode(node());
227
231
  return String(node);
@@ -279,13 +283,11 @@ function simpleMap(props, wrap) {
279
283
  len = list.length,
280
284
  fn = props.children;
281
285
  if (len) {
282
- let mapped = "";
283
- for (let i = 0; i < len; i++) mapped += resolveSSRNode(wrap(fn, list[i], i));
284
- return {
285
- t: mapped
286
- };
286
+ let mapped = Array(len);
287
+ for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
288
+ return mapped;
287
289
  }
288
- return props.fallback || "";
290
+ return props.fallback;
289
291
  }
290
292
  function For(props) {
291
293
  return simpleMap(props, (fn, item, i) => fn(item, () => i));
@@ -508,7 +510,7 @@ function Suspense(props) {
508
510
  if (ctx.streaming) {
509
511
  setHydrateContext(undefined);
510
512
  const res = {
511
- t: `<span id="pl${id}">${resolveSSRNode(props.fallback)}</span>`
513
+ t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
512
514
  };
513
515
  setHydrateContext(ctx);
514
516
  return res;
package/dist/server.js CHANGED
@@ -217,7 +217,11 @@ function resolveSSRNode(node) {
217
217
  const t = typeof node;
218
218
  if (t === "string") return node;
219
219
  if (node == null || t === "boolean") return "";
220
- if (Array.isArray(node)) return node.map(resolveSSRNode).join("");
220
+ if (Array.isArray(node)) {
221
+ let mapped = "";
222
+ for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
223
+ return mapped;
224
+ }
221
225
  if (t === "object") return resolveSSRNode(node.t);
222
226
  if (t === "function") return resolveSSRNode(node());
223
227
  return String(node);
@@ -275,13 +279,11 @@ function simpleMap(props, wrap) {
275
279
  len = list.length,
276
280
  fn = props.children;
277
281
  if (len) {
278
- let mapped = "";
279
- for (let i = 0; i < len; i++) mapped += resolveSSRNode(wrap(fn, list[i], i));
280
- return {
281
- t: mapped
282
- };
282
+ let mapped = Array(len);
283
+ for (let i = 0; i < len; i++) mapped[i] = wrap(fn, list[i], i);
284
+ return mapped;
283
285
  }
284
- return props.fallback || "";
286
+ return props.fallback;
285
287
  }
286
288
  function For(props) {
287
289
  return simpleMap(props, (fn, item, i) => fn(item, () => i));
@@ -504,7 +506,7 @@ function Suspense(props) {
504
506
  if (ctx.streaming) {
505
507
  setHydrateContext(undefined);
506
508
  const res = {
507
- t: `<span id="pl${id}">${resolveSSRNode(props.fallback)}</span>`
509
+ t: `<span id="pl-${id}">${resolveSSRNode(props.fallback)}</span>`
508
510
  };
509
511
  setHydrateContext(ctx);
510
512
  return res;
package/dist/solid.cjs CHANGED
@@ -385,7 +385,7 @@ function createSelector(source, fn = equalFn, options) {
385
385
  const subs = new Map();
386
386
  const node = createComputation(p => {
387
387
  const v = source();
388
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
388
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
389
389
  const l = subs.get(key);
390
390
  for (const c of l.values()) {
391
391
  c.state = STALE;
@@ -445,8 +445,8 @@ options) {
445
445
  return prevValue => {
446
446
  let input;
447
447
  if (isArray) {
448
- input = [];
449
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
448
+ input = Array(deps.length);
449
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
450
450
  } else input = deps();
451
451
  if (defer) {
452
452
  defer = false;
@@ -822,6 +822,7 @@ function runUserEffects(queue) {
822
822
  const e = queue[i];
823
823
  if (!e.user) runTop(e);else queue[userLength++] = e;
824
824
  }
825
+ if (sharedConfig.context) setHydrateContext();
825
826
  const resume = queue.length;
826
827
  for (i = 0; i < userLength; i++) runTop(queue[i]);
827
828
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
@@ -1447,7 +1448,7 @@ function Suspense(props) {
1447
1448
  });
1448
1449
  flicker = s;
1449
1450
  p.then(err => {
1450
- if (error = err) return set();
1451
+ if ((error = err) || sharedConfig.done) return set();
1451
1452
  sharedConfig.gather(key);
1452
1453
  setHydrateContext(ctx);
1453
1454
  set();
package/dist/solid.js CHANGED
@@ -381,7 +381,7 @@ function createSelector(source, fn = equalFn, options) {
381
381
  const subs = new Map();
382
382
  const node = createComputation(p => {
383
383
  const v = source();
384
- for (const key of subs.keys()) if (fn(key, v) !== (p !== undefined && fn(key, p))) {
384
+ for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) {
385
385
  const l = subs.get(key);
386
386
  for (const c of l.values()) {
387
387
  c.state = STALE;
@@ -441,8 +441,8 @@ options) {
441
441
  return prevValue => {
442
442
  let input;
443
443
  if (isArray) {
444
- input = [];
445
- for (let i = 0; i < deps.length; i++) input.push(deps[i]());
444
+ input = Array(deps.length);
445
+ for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
446
446
  } else input = deps();
447
447
  if (defer) {
448
448
  defer = false;
@@ -818,6 +818,7 @@ function runUserEffects(queue) {
818
818
  const e = queue[i];
819
819
  if (!e.user) runTop(e);else queue[userLength++] = e;
820
820
  }
821
+ if (sharedConfig.context) setHydrateContext();
821
822
  const resume = queue.length;
822
823
  for (i = 0; i < userLength; i++) runTop(queue[i]);
823
824
  for (i = resume; i < queue.length; i++) runTop(queue[i]);
@@ -1443,7 +1444,7 @@ function Suspense(props) {
1443
1444
  });
1444
1445
  flicker = s;
1445
1446
  p.then(err => {
1446
- if (error = err) return set();
1447
+ if ((error = err) || sharedConfig.done) return set();
1447
1448
  sharedConfig.gather(key);
1448
1449
  setHydrateContext(ctx);
1449
1450
  set();
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.3.14",
4
+ "version": "1.3.17",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "9a41feafea10717e785c603eadb96c6133cd2988"
147
+ "gitHead": "88ce357264a4966d38d143143a3efe8a394e57c0"
148
148
  }
package/types/jsx.d.ts CHANGED
@@ -23,7 +23,9 @@ export namespace JSX {
23
23
  interface ElementClass {
24
24
  // empty, libs can define requirements downstream
25
25
  }
26
- type LibraryManagedAttributes<Component, Props> = Props;
26
+ interface ElementAttributesProperty {
27
+ // empty, libs can define requirements downstream
28
+ }
27
29
  interface ElementChildrenAttribute {
28
30
  children: {};
29
31
  }
@@ -1997,6 +1999,7 @@ export namespace JSX {
1997
1999
  | "treegrid"
1998
2000
  | "treeitem";
1999
2001
  autocapitalize?: HTMLAutocapitalize;
2002
+ slot?: string;
2000
2003
  color?: string;
2001
2004
  itemprop?: string;
2002
2005
  itemscope?: boolean;
@@ -201,7 +201,7 @@ export interface Resource<T> extends Accessor<T> {
201
201
  }
202
202
  export declare type ResourceActions<T> = {
203
203
  mutate: Setter<T>;
204
- refetch: (info?: unknown) => void;
204
+ refetch: (info?: unknown) => T | Promise<T> | undefined | null;
205
205
  };
206
206
  export declare type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
207
207
  export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
@@ -10,6 +10,7 @@ declare type SharedConfig = {
10
10
  load?: (id: string) => Promise<any> | undefined;
11
11
  gather?: (key: string) => void;
12
12
  registry?: Map<string, Element>;
13
+ done?: boolean;
13
14
  };
14
15
  export declare const sharedConfig: SharedConfig;
15
16
  export declare function setHydrateContext(context?: HydrationContext): void;
@@ -32,16 +32,12 @@ export declare function For<T>(props: {
32
32
  each: T[];
33
33
  fallback?: string;
34
34
  children: (item: T, index: () => number) => string;
35
- }): string | {
36
- t: string;
37
- };
35
+ }): string | any[] | undefined;
38
36
  export declare function Index<T>(props: {
39
37
  each: T[];
40
38
  fallback?: string;
41
39
  children: (item: () => T, index: number) => string;
42
- }): string | {
43
- t: string;
44
- };
40
+ }): string | any[] | undefined;
45
41
  export declare function Show<T>(props: {
46
42
  when: T | false;
47
43
  fallback?: string;
package/web/dist/dev.cjs CHANGED
@@ -29,6 +29,7 @@ const SVGNamespace = {
29
29
  xlink: "http://www.w3.org/1999/xlink",
30
30
  xml: "http://www.w3.org/XML/1998/namespace"
31
31
  };
32
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
32
33
 
33
34
  function memo(fn, equals) {
34
35
  return solidJs.createMemo(fn, undefined, !equals ? {
@@ -337,6 +338,10 @@ function eventHandler(e) {
337
338
  return node || document;
338
339
  }
339
340
  });
341
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
342
+ solidJs.sharedConfig.done = true;
343
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
344
+ }
340
345
  while (node !== null) {
341
346
  const handler = node[key];
342
347
  if (handler && !node.disabled) {
@@ -621,6 +626,7 @@ Object.defineProperty(exports, 'mergeProps', {
621
626
  exports.Aliases = Aliases;
622
627
  exports.Assets = Assets;
623
628
  exports.ChildProperties = ChildProperties;
629
+ exports.DOMElements = DOMElements;
624
630
  exports.DelegatedEvents = DelegatedEvents;
625
631
  exports.Dynamic = Dynamic;
626
632
  exports.HydrationScript = Assets;
package/web/dist/dev.js CHANGED
@@ -26,6 +26,7 @@ const SVGNamespace = {
26
26
  xlink: "http://www.w3.org/1999/xlink",
27
27
  xml: "http://www.w3.org/XML/1998/namespace"
28
28
  };
29
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
29
30
 
30
31
  function memo(fn, equals) {
31
32
  return createMemo(fn, undefined, !equals ? {
@@ -334,6 +335,10 @@ function eventHandler(e) {
334
335
  return node || document;
335
336
  }
336
337
  });
338
+ if (sharedConfig.registry && !sharedConfig.done) {
339
+ sharedConfig.done = true;
340
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
341
+ }
337
342
  while (node !== null) {
338
343
  const handler = node[key];
339
344
  if (handler && !node.disabled) {
@@ -567,4 +572,4 @@ function Dynamic(props) {
567
572
  });
568
573
  }
569
574
 
570
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
575
+ export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -232,7 +232,7 @@ function stringifyString(str) {
232
232
  return result;
233
233
  }
234
234
 
235
- const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
235
+ 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||null)}`;
236
236
  const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
237
237
  function renderToString(code, options = {}) {
238
238
  let scripts = "";
@@ -499,6 +499,7 @@ function ssrSpread(props, isSVG, skipChildren) {
499
499
  if (typeof props === "function") props = props();
500
500
  const keys = Object.keys(props);
501
501
  let result = "";
502
+ let classResolved;
502
503
  for (let i = 0; i < keys.length; i++) {
503
504
  const prop = keys[i];
504
505
  if (prop === "children") {
@@ -508,8 +509,11 @@ function ssrSpread(props, isSVG, skipChildren) {
508
509
  const value = props[prop];
509
510
  if (prop === "style") {
510
511
  result += `style="${ssrStyle(value)}"`;
511
- } else if (prop === "classList") {
512
- result += `class="${ssrClassList(value)}"`;
512
+ } else if (prop === "class" || prop === "className" || prop === "classList") {
513
+ if (classResolved) continue;
514
+ let n;
515
+ result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
516
+ classResolved = true;
513
517
  } else if (BooleanAttributes.has(prop)) {
514
518
  if (value) result += prop;else continue;
515
519
  } else if (prop === "ref" || prop.slice(0, 2) === "on") {
@@ -574,7 +578,11 @@ function resolveSSRNode(node) {
574
578
  const t = typeof node;
575
579
  if (t === "string") return node;
576
580
  if (node == null || t === "boolean") return "";
577
- if (Array.isArray(node)) return node.map(resolveSSRNode).join("");
581
+ if (Array.isArray(node)) {
582
+ let mapped = "";
583
+ for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
584
+ return mapped;
585
+ }
578
586
  if (t === "object") return resolveSSRNode(node.t);
579
587
  if (t === "function") return resolveSSRNode(node());
580
588
  return String(node);
@@ -675,7 +683,7 @@ function Dynamic(props) {
675
683
  if (comp) {
676
684
  if (t === "function") return comp(others);else if (t === "string") {
677
685
  const [local, sOthers] = solidJs.splitProps(others, ["children"]);
678
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
686
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
679
687
  }
680
688
  }
681
689
  }
@@ -229,7 +229,7 @@ function stringifyString(str) {
229
229
  return result;
230
230
  }
231
231
 
232
- const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
232
+ 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||null)}`;
233
233
  const FRAGMENT_REPLACE = /<!\[([\d-]+)\]>/;
234
234
  function renderToString(code, options = {}) {
235
235
  let scripts = "";
@@ -496,6 +496,7 @@ function ssrSpread(props, isSVG, skipChildren) {
496
496
  if (typeof props === "function") props = props();
497
497
  const keys = Object.keys(props);
498
498
  let result = "";
499
+ let classResolved;
499
500
  for (let i = 0; i < keys.length; i++) {
500
501
  const prop = keys[i];
501
502
  if (prop === "children") {
@@ -505,8 +506,11 @@ function ssrSpread(props, isSVG, skipChildren) {
505
506
  const value = props[prop];
506
507
  if (prop === "style") {
507
508
  result += `style="${ssrStyle(value)}"`;
508
- } else if (prop === "classList") {
509
- result += `class="${ssrClassList(value)}"`;
509
+ } else if (prop === "class" || prop === "className" || prop === "classList") {
510
+ if (classResolved) continue;
511
+ let n;
512
+ result += `class="${(n = props.class) ? n + " " : ""}${(n = props.className) ? n + " " : ""}${ssrClassList(props.classList)}"`;
513
+ classResolved = true;
510
514
  } else if (BooleanAttributes.has(prop)) {
511
515
  if (value) result += prop;else continue;
512
516
  } else if (prop === "ref" || prop.slice(0, 2) === "on") {
@@ -571,7 +575,11 @@ function resolveSSRNode(node) {
571
575
  const t = typeof node;
572
576
  if (t === "string") return node;
573
577
  if (node == null || t === "boolean") return "";
574
- if (Array.isArray(node)) return node.map(resolveSSRNode).join("");
578
+ if (Array.isArray(node)) {
579
+ let mapped = "";
580
+ for (let i = 0, len = node.length; i < len; i++) mapped += resolveSSRNode(node[i]);
581
+ return mapped;
582
+ }
575
583
  if (t === "object") return resolveSSRNode(node.t);
576
584
  if (t === "function") return resolveSSRNode(node());
577
585
  return String(node);
@@ -672,7 +680,7 @@ function Dynamic(props) {
672
680
  if (comp) {
673
681
  if (t === "function") return comp(others);else if (t === "string") {
674
682
  const [local, sOthers] = splitProps(others, ["children"]);
675
- return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), local.children || "");
683
+ return ssr([`<${comp}`, ' ', ">", `</${comp}>`], ssrHydrationKey(), ssrSpread(sOthers), escape(local.children || ""));
676
684
  }
677
685
  }
678
686
  }
package/web/dist/web.cjs CHANGED
@@ -29,6 +29,7 @@ const SVGNamespace = {
29
29
  xlink: "http://www.w3.org/1999/xlink",
30
30
  xml: "http://www.w3.org/XML/1998/namespace"
31
31
  };
32
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
32
33
 
33
34
  function memo(fn, equals) {
34
35
  return solidJs.createMemo(fn, undefined, !equals ? {
@@ -336,6 +337,10 @@ function eventHandler(e) {
336
337
  return node || document;
337
338
  }
338
339
  });
340
+ if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) {
341
+ solidJs.sharedConfig.done = true;
342
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
343
+ }
339
344
  while (node !== null) {
340
345
  const handler = node[key];
341
346
  if (handler && !node.disabled) {
@@ -617,6 +622,7 @@ Object.defineProperty(exports, 'mergeProps', {
617
622
  exports.Aliases = Aliases;
618
623
  exports.Assets = Assets;
619
624
  exports.ChildProperties = ChildProperties;
625
+ exports.DOMElements = DOMElements;
620
626
  exports.DelegatedEvents = DelegatedEvents;
621
627
  exports.Dynamic = Dynamic;
622
628
  exports.HydrationScript = Assets;
package/web/dist/web.js CHANGED
@@ -26,6 +26,7 @@ const SVGNamespace = {
26
26
  xlink: "http://www.w3.org/1999/xlink",
27
27
  xml: "http://www.w3.org/XML/1998/namespace"
28
28
  };
29
+ const DOMElements = new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]);
29
30
 
30
31
  function memo(fn, equals) {
31
32
  return createMemo(fn, undefined, !equals ? {
@@ -333,6 +334,10 @@ function eventHandler(e) {
333
334
  return node || document;
334
335
  }
335
336
  });
337
+ if (sharedConfig.registry && !sharedConfig.done) {
338
+ sharedConfig.done = true;
339
+ document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove());
340
+ }
336
341
  while (node !== null) {
337
342
  const handler = node[key];
338
343
  if (handler && !node.disabled) {
@@ -563,4 +568,4 @@ function Dynamic(props) {
563
568
  });
564
569
  }
565
570
 
566
- export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
571
+ export { Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
@@ -4,6 +4,7 @@ export const PropAliases: Record<string, string>;
4
4
  export const Properties: Set<string>;
5
5
  export const ChildProperties: Set<string>;
6
6
  export const DelegatedEvents: Set<string>;
7
+ export const DOMElements: Set<string>;
7
8
  export const SVGElements: Set<string>;
8
9
  export const SVGNamespace: Record<string, string>;
9
10