@solidjs/web 2.0.0-experimental.15 → 2.0.0-experimental.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.cjs CHANGED
@@ -19,6 +19,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
19
19
  "webview",
20
20
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
21
21
 
22
+ const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
23
+ transparent: true
24
+ });
22
25
  const memo = fn => solidJs.createMemo(() => fn());
23
26
 
24
27
  function reconcileArrays(parentNode, a, b) {
@@ -97,13 +100,15 @@ function render(code, element, init, options = {}) {
97
100
  }
98
101
  function template(html, isImportNode, isSVG, isMathML) {
99
102
  let node;
100
- const create = () => {
101
- if (isHydrating()) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
103
+ const create = bypassGuard => {
104
+ if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
102
105
  const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
103
106
  t.innerHTML = html;
104
107
  return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
105
108
  };
106
- return isImportNode ? () => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
109
+ const fn = isImportNode ? bypassGuard => solidJs.untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
110
+ fn._html = html;
111
+ return fn;
107
112
  }
108
113
  function delegateEvents(eventNames, document = window.document) {
109
114
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
@@ -176,7 +181,7 @@ function addEventListener(node, name, handler, delegate) {
176
181
  }
177
182
  function style(node, value, prev) {
178
183
  if (!value) {
179
- prev ? setAttribute(node, "style") : value;
184
+ if (prev) setAttribute(node, "style");
180
185
  return;
181
186
  }
182
187
  const nodeStyle = node.style;
@@ -198,13 +203,16 @@ function setStyleProperty(node, name, value) {
198
203
  function spread(node, props = {}, isSVG, skipChildren) {
199
204
  const prevProps = {};
200
205
  if (!skipChildren) {
201
- solidJs.createRenderEffect(() => normalize(props.children, prevProps.children), value => {
206
+ effect(() => normalize(props.children, prevProps.children), value => {
202
207
  insertExpression(node, value, prevProps.children);
203
208
  prevProps.children = value;
204
209
  });
205
210
  }
206
- solidJs.createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
207
- solidJs.createRenderEffect(() => {
211
+ effect(() => {
212
+ const r = props.ref;
213
+ (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
214
+ }, () => {});
215
+ effect(() => {
208
216
  const newProps = {};
209
217
  for (const prop in props) {
210
218
  if (prop === "children" || prop === "ref") continue;
@@ -224,8 +232,12 @@ function dynamicProperty(props, key) {
224
232
  });
225
233
  return props;
226
234
  }
227
- function use(fn, element, arg) {
228
- solidJs.untrack(() => fn(element, arg));
235
+ function applyRef(r, element) {
236
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
237
+ }
238
+ function ref(fn, element) {
239
+ const resolved = solidJs.untrack(fn);
240
+ solidJs.runWithOwner(null, () => applyRef(resolved, element));
229
241
  }
230
242
  function insert(parent, accessor, marker, initial) {
231
243
  const multi = marker !== undefined;
@@ -241,7 +253,7 @@ function insert(parent, accessor, marker, initial) {
241
253
  accessor = normalize(accessor, initial, multi, true);
242
254
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
243
255
  }
244
- solidJs.createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
256
+ effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
245
257
  }
246
258
  function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
247
259
  props || (props = {});
@@ -288,6 +300,14 @@ function hydrate$1(code, element, options = {}) {
288
300
  };
289
301
  solidJs.sharedConfig.registry = new Map();
290
302
  solidJs.sharedConfig.hydrating = true;
303
+ {
304
+ solidJs.sharedConfig.verifyHydration = () => {
305
+ if (solidJs.sharedConfig.registry && solidJs.sharedConfig.registry.size) {
306
+ const orphaned = [...solidJs.sharedConfig.registry.values()];
307
+ console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
308
+ }
309
+ };
310
+ }
291
311
  try {
292
312
  gatherHydratable(element, options.renderId);
293
313
  return render(code, element, [...element.childNodes], options);
@@ -300,10 +320,16 @@ function getNextElement(template) {
300
320
  key,
301
321
  hydrating = isHydrating();
302
322
  if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
303
- if (hydrating) {
304
- throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${template ? template().outerHTML : ""}`);
323
+ if (!template) {
324
+ throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
325
+ }
326
+ return template(true);
327
+ }
328
+ if (template && template._html) {
329
+ const expected = template._html.match(/^<(\w+)/)?.[1];
330
+ if (expected && node.localName !== expected) {
331
+ console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
305
332
  }
306
- return template();
307
333
  }
308
334
  if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
309
335
  solidJs.sharedConfig.registry.delete(key);
@@ -332,6 +358,49 @@ function getNextMarker(start) {
332
358
  }
333
359
  return [end, current];
334
360
  }
361
+ function getFirstChild(node, expectedTag) {
362
+ const child = node.firstChild;
363
+ if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
364
+ const isMissing = !child || child.nodeType !== 1;
365
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
366
+ }
367
+ return child;
368
+ }
369
+ function getNextSibling(node, expectedTag) {
370
+ const sibling = node.nextSibling;
371
+ if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
372
+ const parent = node.parentElement;
373
+ const isMissing = !sibling || sibling.nodeType !== 1;
374
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
375
+ }
376
+ return sibling;
377
+ }
378
+ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
379
+ const children = [];
380
+ let child = parent.firstChild;
381
+ while (child) {
382
+ if (child.nodeType === 1) children.push(child);
383
+ child = child.nextSibling;
384
+ }
385
+ const pTag = parent.localName;
386
+ if (isMissing) {
387
+ const tags = children.map(c => `<${c.localName}>`).join("");
388
+ return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
389
+ }
390
+ const idx = children.indexOf(mismatchChild);
391
+ let start = 0,
392
+ end = children.length;
393
+ let prefix = "",
394
+ suffix = "";
395
+ if (children.length > 6) {
396
+ start = Math.max(0, idx - 2);
397
+ end = Math.min(children.length, idx + 3);
398
+ if (start > 0) prefix = "...";
399
+ if (end < children.length) suffix = "...";
400
+ }
401
+ const tags = children.slice(start, end).map(c => c === mismatchChild ? `<${c.localName} \u2190 expected ${expectedTag}>` : `<${c.localName}>`).join("");
402
+ return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
403
+ }
335
404
  function runHydrationEvents() {
336
405
  if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
337
406
  queueMicrotask(() => {
@@ -382,7 +451,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
382
451
  if (prop === "class") return className(node, value, isSVG, prev), value;
383
452
  if (value === prev) return prev;
384
453
  if (prop === "ref") {
385
- if (!skipRef) value(node);
454
+ if (!skipRef && value) ref(() => value, node);
386
455
  } else if (prop.slice(0, 3) === "on:") {
387
456
  const e = prop.slice(3);
388
457
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
@@ -664,10 +733,6 @@ Object.defineProperty(exports, "createComponent", {
664
733
  enumerable: true,
665
734
  get: function () { return solidJs.createComponent; }
666
735
  });
667
- Object.defineProperty(exports, "effect", {
668
- enumerable: true,
669
- get: function () { return solidJs.createRenderEffect; }
670
- });
671
736
  Object.defineProperty(exports, "getOwner", {
672
737
  enumerable: true,
673
738
  get: function () { return solidJs.getOwner; }
@@ -694,25 +759,30 @@ exports.RequestContext = RequestContext;
694
759
  exports.SVGElements = SVGElements;
695
760
  exports.SVGNamespace = SVGNamespace;
696
761
  exports.addEventListener = addEventListener;
762
+ exports.applyRef = applyRef;
697
763
  exports.assign = assign;
698
764
  exports.className = className;
699
765
  exports.clearDelegatedEvents = clearDelegatedEvents;
700
766
  exports.createDynamic = createDynamic;
701
767
  exports.delegateEvents = delegateEvents;
702
768
  exports.dynamicProperty = dynamicProperty;
769
+ exports.effect = effect;
703
770
  exports.escape = escape;
704
771
  exports.generateHydrationScript = voidFn;
705
772
  exports.getAssets = voidFn;
773
+ exports.getFirstChild = getFirstChild;
706
774
  exports.getHydrationKey = getHydrationKey;
707
775
  exports.getNextElement = getNextElement;
708
776
  exports.getNextMarker = getNextMarker;
709
777
  exports.getNextMatch = getNextMatch;
778
+ exports.getNextSibling = getNextSibling;
710
779
  exports.getRequestEvent = voidFn;
711
780
  exports.hydrate = hydrate;
712
781
  exports.insert = insert;
713
782
  exports.isDev = isDev;
714
783
  exports.isServer = isServer;
715
784
  exports.memo = memo;
785
+ exports.ref = ref;
716
786
  exports.render = render;
717
787
  exports.renderToStream = renderToStream;
718
788
  exports.renderToString = renderToString;
@@ -732,5 +802,4 @@ exports.ssrHydrationKey = ssrHydrationKey;
732
802
  exports.ssrStyle = ssrStyle;
733
803
  exports.style = style;
734
804
  exports.template = template;
735
- exports.use = use;
736
805
  exports.useAssets = voidFn;
package/dist/dev.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createMemo, sharedConfig, createRenderEffect, createRoot, flatten, untrack, omit, $DEVCOMP, enableHydration } from 'solid-js';
2
- export { Errored, For, Loading, Match, Show, Switch, createComponent, createRenderEffect as effect, getOwner, merge as mergeProps, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, createRoot, flatten, omit, $DEVCOMP, enableHydration } from 'solid-js';
2
+ export { Errored, For, Loading, Match, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const Properties = /*#__PURE__*/new Set([
5
5
  "value", "checked", "selected", "muted"]);
@@ -18,6 +18,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
18
18
  "webview",
19
19
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
20
20
 
21
+ const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
22
+ transparent: true
23
+ });
21
24
  const memo = fn => createMemo(() => fn());
22
25
 
23
26
  function reconcileArrays(parentNode, a, b) {
@@ -96,13 +99,15 @@ function render(code, element, init, options = {}) {
96
99
  }
97
100
  function template(html, isImportNode, isSVG, isMathML) {
98
101
  let node;
99
- const create = () => {
100
- if (isHydrating()) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
102
+ const create = bypassGuard => {
103
+ if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
101
104
  const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
102
105
  t.innerHTML = html;
103
106
  return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
104
107
  };
105
- return isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
108
+ const fn = isImportNode ? bypassGuard => untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
109
+ fn._html = html;
110
+ return fn;
106
111
  }
107
112
  function delegateEvents(eventNames, document = window.document) {
108
113
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
@@ -175,7 +180,7 @@ function addEventListener(node, name, handler, delegate) {
175
180
  }
176
181
  function style(node, value, prev) {
177
182
  if (!value) {
178
- prev ? setAttribute(node, "style") : value;
183
+ if (prev) setAttribute(node, "style");
179
184
  return;
180
185
  }
181
186
  const nodeStyle = node.style;
@@ -197,13 +202,16 @@ function setStyleProperty(node, name, value) {
197
202
  function spread(node, props = {}, isSVG, skipChildren) {
198
203
  const prevProps = {};
199
204
  if (!skipChildren) {
200
- createRenderEffect(() => normalize(props.children, prevProps.children), value => {
205
+ effect(() => normalize(props.children, prevProps.children), value => {
201
206
  insertExpression(node, value, prevProps.children);
202
207
  prevProps.children = value;
203
208
  });
204
209
  }
205
- createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
206
- createRenderEffect(() => {
210
+ effect(() => {
211
+ const r = props.ref;
212
+ (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
213
+ }, () => {});
214
+ effect(() => {
207
215
  const newProps = {};
208
216
  for (const prop in props) {
209
217
  if (prop === "children" || prop === "ref") continue;
@@ -223,8 +231,12 @@ function dynamicProperty(props, key) {
223
231
  });
224
232
  return props;
225
233
  }
226
- function use(fn, element, arg) {
227
- untrack(() => fn(element, arg));
234
+ function applyRef(r, element) {
235
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
236
+ }
237
+ function ref(fn, element) {
238
+ const resolved = untrack(fn);
239
+ runWithOwner(null, () => applyRef(resolved, element));
228
240
  }
229
241
  function insert(parent, accessor, marker, initial) {
230
242
  const multi = marker !== undefined;
@@ -240,7 +252,7 @@ function insert(parent, accessor, marker, initial) {
240
252
  accessor = normalize(accessor, initial, multi, true);
241
253
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
242
254
  }
243
- createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
255
+ effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
244
256
  }
245
257
  function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
246
258
  props || (props = {});
@@ -287,6 +299,14 @@ function hydrate$1(code, element, options = {}) {
287
299
  };
288
300
  sharedConfig.registry = new Map();
289
301
  sharedConfig.hydrating = true;
302
+ {
303
+ sharedConfig.verifyHydration = () => {
304
+ if (sharedConfig.registry && sharedConfig.registry.size) {
305
+ const orphaned = [...sharedConfig.registry.values()];
306
+ console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
307
+ }
308
+ };
309
+ }
290
310
  try {
291
311
  gatherHydratable(element, options.renderId);
292
312
  return render(code, element, [...element.childNodes], options);
@@ -299,10 +319,16 @@ function getNextElement(template) {
299
319
  key,
300
320
  hydrating = isHydrating();
301
321
  if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
302
- if (hydrating) {
303
- throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${template ? template().outerHTML : ""}`);
322
+ if (!template) {
323
+ throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
324
+ }
325
+ return template(true);
326
+ }
327
+ if (template && template._html) {
328
+ const expected = template._html.match(/^<(\w+)/)?.[1];
329
+ if (expected && node.localName !== expected) {
330
+ console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
304
331
  }
305
- return template();
306
332
  }
307
333
  if (sharedConfig.completed) sharedConfig.completed.add(node);
308
334
  sharedConfig.registry.delete(key);
@@ -331,6 +357,49 @@ function getNextMarker(start) {
331
357
  }
332
358
  return [end, current];
333
359
  }
360
+ function getFirstChild(node, expectedTag) {
361
+ const child = node.firstChild;
362
+ if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
363
+ const isMissing = !child || child.nodeType !== 1;
364
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
365
+ }
366
+ return child;
367
+ }
368
+ function getNextSibling(node, expectedTag) {
369
+ const sibling = node.nextSibling;
370
+ if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
371
+ const parent = node.parentElement;
372
+ const isMissing = !sibling || sibling.nodeType !== 1;
373
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
374
+ }
375
+ return sibling;
376
+ }
377
+ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
378
+ const children = [];
379
+ let child = parent.firstChild;
380
+ while (child) {
381
+ if (child.nodeType === 1) children.push(child);
382
+ child = child.nextSibling;
383
+ }
384
+ const pTag = parent.localName;
385
+ if (isMissing) {
386
+ const tags = children.map(c => `<${c.localName}>`).join("");
387
+ return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
388
+ }
389
+ const idx = children.indexOf(mismatchChild);
390
+ let start = 0,
391
+ end = children.length;
392
+ let prefix = "",
393
+ suffix = "";
394
+ if (children.length > 6) {
395
+ start = Math.max(0, idx - 2);
396
+ end = Math.min(children.length, idx + 3);
397
+ if (start > 0) prefix = "...";
398
+ if (end < children.length) suffix = "...";
399
+ }
400
+ const tags = children.slice(start, end).map(c => c === mismatchChild ? `<${c.localName} \u2190 expected ${expectedTag}>` : `<${c.localName}>`).join("");
401
+ return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
402
+ }
334
403
  function runHydrationEvents() {
335
404
  if (sharedConfig.events && !sharedConfig.events.queued) {
336
405
  queueMicrotask(() => {
@@ -381,7 +450,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
381
450
  if (prop === "class") return className(node, value, isSVG, prev), value;
382
451
  if (value === prev) return prev;
383
452
  if (prop === "ref") {
384
- if (!skipRef) value(node);
453
+ if (!skipRef && value) ref(() => value, node);
385
454
  } else if (prop.slice(0, 3) === "on:") {
386
455
  const e = prop.slice(3);
387
456
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
@@ -635,4 +704,4 @@ function Dynamic(props) {
635
704
  return createDynamic(() => props.component, others);
636
705
  }
637
706
 
638
- export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };
707
+ export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, applyRef, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };
package/dist/server.cjs CHANGED
@@ -21,6 +21,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
21
21
  "webview",
22
22
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
23
23
 
24
+ const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
25
+ transparent: true
26
+ });
24
27
  const memo = fn => solidJs.createMemo(() => fn());
25
28
 
26
29
  const ES2017FLAG = seroval.Feature.AggregateError
@@ -645,6 +648,9 @@ function getHydrationKey() {
645
648
  const hydrate = solidJs.sharedConfig.context;
646
649
  return hydrate && !hydrate.noHydrate && solidJs.sharedConfig.getNextContextId();
647
650
  }
651
+ function applyRef(r, element) {
652
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
653
+ }
648
654
  function useAssets(fn) {
649
655
  solidJs.sharedConfig.context.assets.push(() => resolveSSRSync(escape(fn())));
650
656
  }
@@ -835,7 +841,7 @@ function resolveSSRSync(node) {
835
841
  }
836
842
  const RequestContext = Symbol();
837
843
  function getRequestEvent() {
838
- return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.log("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
844
+ return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || solidJs.sharedConfig.context && solidJs.sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
839
845
  }
840
846
  function renderToStringAsync(code, options = {}) {
841
847
  return new Promise(resolve => renderToStream(code, options).then(resolve));
@@ -847,13 +853,18 @@ function notSup() {
847
853
  const isServer = true;
848
854
  const isDev = false;
849
855
  function createDynamic(component, props) {
850
- const comp = component(),
851
- t = typeof comp;
852
- if (comp) {
853
- if (t === "function") return comp(props);else if (t === "string") {
854
- return ssrElement(comp, props, undefined, true);
856
+ const o = solidJs.getOwner();
857
+ if (o?.id != null) solidJs.getNextChildId(o);
858
+ const memoOwner = solidJs.createOwner();
859
+ return solidJs.runWithOwner(memoOwner, () => {
860
+ const comp = component(),
861
+ t = typeof comp;
862
+ if (comp) {
863
+ if (t === "function") return comp(props);else if (t === "string") {
864
+ return ssrElement(comp, props, undefined, true);
865
+ }
855
866
  }
856
- }
867
+ });
857
868
  }
858
869
  function Dynamic(props) {
859
870
  const others = solidJs.omit(props, "component");
@@ -895,10 +906,6 @@ Object.defineProperty(exports, "createComponent", {
895
906
  enumerable: true,
896
907
  get: function () { return solidJs.createComponent; }
897
908
  });
898
- Object.defineProperty(exports, "effect", {
899
- enumerable: true,
900
- get: function () { return solidJs.createRenderEffect; }
901
- });
902
909
  Object.defineProperty(exports, "getOwner", {
903
910
  enumerable: true,
904
911
  get: function () { return solidJs.getOwner; }
@@ -924,11 +931,13 @@ exports.RequestContext = RequestContext;
924
931
  exports.SVGElements = SVGElements;
925
932
  exports.SVGNamespace = SVGNamespace;
926
933
  exports.addEventListener = notSup;
934
+ exports.applyRef = applyRef;
927
935
  exports.assign = notSup;
928
936
  exports.className = notSup;
929
937
  exports.createDynamic = createDynamic;
930
938
  exports.delegateEvents = notSup;
931
939
  exports.dynamicProperty = notSup;
940
+ exports.effect = effect;
932
941
  exports.escape = escape;
933
942
  exports.generateHydrationScript = generateHydrationScript;
934
943
  exports.getAssets = getAssets;
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createMemo, sharedConfig, createRoot, ssrHandleError, omit } from 'solid-js';
2
- export { Errored, For, Loading, Match, Repeat, Show, Switch, createComponent, createRenderEffect as effect, getOwner, ssrRunInScope, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
2
+ export { Errored, For, Loading, Match, Repeat, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
3
3
  import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
4
4
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
5
5
 
@@ -20,6 +20,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
20
20
  "webview",
21
21
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
22
22
 
23
+ const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
24
+ transparent: true
25
+ });
23
26
  const memo = fn => createMemo(() => fn());
24
27
 
25
28
  const ES2017FLAG = Feature.AggregateError
@@ -644,6 +647,9 @@ function getHydrationKey() {
644
647
  const hydrate = sharedConfig.context;
645
648
  return hydrate && !hydrate.noHydrate && sharedConfig.getNextContextId();
646
649
  }
650
+ function applyRef(r, element) {
651
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
652
+ }
647
653
  function useAssets(fn) {
648
654
  sharedConfig.context.assets.push(() => resolveSSRSync(escape(fn())));
649
655
  }
@@ -834,7 +840,7 @@ function resolveSSRSync(node) {
834
840
  }
835
841
  const RequestContext = Symbol();
836
842
  function getRequestEvent() {
837
- return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.log("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
843
+ return globalThis[RequestContext] ? globalThis[RequestContext].getStore() || sharedConfig.context && sharedConfig.context.event || console.warn("RequestEvent is missing. This is most likely due to accessing `getRequestEvent` non-managed async scope in a partially polyfilled environment. Try moving it above all `await` calls.") : undefined;
838
844
  }
839
845
  function renderToStringAsync(code, options = {}) {
840
846
  return new Promise(resolve => renderToStream(code, options).then(resolve));
@@ -846,13 +852,18 @@ function notSup() {
846
852
  const isServer = true;
847
853
  const isDev = false;
848
854
  function createDynamic(component, props) {
849
- const comp = component(),
850
- t = typeof comp;
851
- if (comp) {
852
- if (t === "function") return comp(props);else if (t === "string") {
853
- return ssrElement(comp, props, undefined, true);
855
+ const o = getOwner();
856
+ if (o?.id != null) getNextChildId(o);
857
+ const memoOwner = createOwner();
858
+ return runWithOwner(memoOwner, () => {
859
+ const comp = component(),
860
+ t = typeof comp;
861
+ if (comp) {
862
+ if (t === "function") return comp(props);else if (t === "string") {
863
+ return ssrElement(comp, props, undefined, true);
864
+ }
854
865
  }
855
- }
866
+ });
856
867
  }
857
868
  function Dynamic(props) {
858
869
  const others = omit(props, "component");
@@ -862,4 +873,4 @@ function Portal(props) {
862
873
  throw new Error("Portal is not supported on the server");
863
874
  }
864
875
 
865
- export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
876
+ export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, notSup as addEventListener, applyRef, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
package/dist/web.cjs CHANGED
@@ -19,6 +19,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
19
19
  "webview",
20
20
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
21
21
 
22
+ const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
23
+ transparent: true
24
+ });
22
25
  const memo = fn => solidJs.createMemo(() => fn());
23
26
 
24
27
  function reconcileArrays(parentNode, a, b) {
@@ -94,12 +97,13 @@ function render(code, element, init, options = {}) {
94
97
  }
95
98
  function template(html, isImportNode, isSVG, isMathML) {
96
99
  let node;
97
- const create = () => {
100
+ const create = bypassGuard => {
98
101
  const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
99
102
  t.innerHTML = html;
100
103
  return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
101
104
  };
102
- return isImportNode ? () => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
105
+ const fn = isImportNode ? bypassGuard => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : bypassGuard => (node || (node = create())).cloneNode(true);
106
+ return fn;
103
107
  }
104
108
  function delegateEvents(eventNames, document = window.document) {
105
109
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
@@ -172,7 +176,7 @@ function addEventListener(node, name, handler, delegate) {
172
176
  }
173
177
  function style(node, value, prev) {
174
178
  if (!value) {
175
- prev ? setAttribute(node, "style") : value;
179
+ if (prev) setAttribute(node, "style");
176
180
  return;
177
181
  }
178
182
  const nodeStyle = node.style;
@@ -194,13 +198,16 @@ function setStyleProperty(node, name, value) {
194
198
  function spread(node, props = {}, isSVG, skipChildren) {
195
199
  const prevProps = {};
196
200
  if (!skipChildren) {
197
- solidJs.createRenderEffect(() => normalize(props.children, prevProps.children), value => {
201
+ effect(() => normalize(props.children, prevProps.children), value => {
198
202
  insertExpression(node, value, prevProps.children);
199
203
  prevProps.children = value;
200
204
  });
201
205
  }
202
- solidJs.createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
203
- solidJs.createRenderEffect(() => {
206
+ effect(() => {
207
+ const r = props.ref;
208
+ (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
209
+ }, () => {});
210
+ effect(() => {
204
211
  const newProps = {};
205
212
  for (const prop in props) {
206
213
  if (prop === "children" || prop === "ref") continue;
@@ -220,8 +227,12 @@ function dynamicProperty(props, key) {
220
227
  });
221
228
  return props;
222
229
  }
223
- function use(fn, element, arg) {
224
- solidJs.untrack(() => fn(element, arg));
230
+ function applyRef(r, element) {
231
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
232
+ }
233
+ function ref(fn, element) {
234
+ const resolved = solidJs.untrack(fn);
235
+ solidJs.runWithOwner(null, () => applyRef(resolved, element));
225
236
  }
226
237
  function insert(parent, accessor, marker, initial) {
227
238
  const multi = marker !== undefined;
@@ -237,7 +248,7 @@ function insert(parent, accessor, marker, initial) {
237
248
  accessor = normalize(accessor, initial, multi, true);
238
249
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
239
250
  }
240
- solidJs.createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
251
+ effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
241
252
  }
242
253
  function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
243
254
  props || (props = {});
@@ -296,7 +307,10 @@ function getNextElement(template) {
296
307
  key,
297
308
  hydrating = isHydrating();
298
309
  if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
299
- return template();
310
+ if (!template) {
311
+ throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
312
+ }
313
+ return template(true);
300
314
  }
301
315
  if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
302
316
  solidJs.sharedConfig.registry.delete(key);
@@ -325,6 +339,14 @@ function getNextMarker(start) {
325
339
  }
326
340
  return [end, current];
327
341
  }
342
+ function getFirstChild(node, expectedTag) {
343
+ const child = node.firstChild;
344
+ return child;
345
+ }
346
+ function getNextSibling(node, expectedTag) {
347
+ const sibling = node.nextSibling;
348
+ return sibling;
349
+ }
328
350
  function runHydrationEvents() {
329
351
  if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
330
352
  queueMicrotask(() => {
@@ -375,7 +397,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
375
397
  if (prop === "class") return className(node, value, isSVG, prev), value;
376
398
  if (value === prev) return prev;
377
399
  if (prop === "ref") {
378
- if (!skipRef) value(node);
400
+ if (!skipRef && value) ref(() => value, node);
379
401
  } else if (prop.slice(0, 3) === "on:") {
380
402
  const e = prop.slice(3);
381
403
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
@@ -654,10 +676,6 @@ Object.defineProperty(exports, "createComponent", {
654
676
  enumerable: true,
655
677
  get: function () { return solidJs.createComponent; }
656
678
  });
657
- Object.defineProperty(exports, "effect", {
658
- enumerable: true,
659
- get: function () { return solidJs.createRenderEffect; }
660
- });
661
679
  Object.defineProperty(exports, "getOwner", {
662
680
  enumerable: true,
663
681
  get: function () { return solidJs.getOwner; }
@@ -684,25 +702,30 @@ exports.RequestContext = RequestContext;
684
702
  exports.SVGElements = SVGElements;
685
703
  exports.SVGNamespace = SVGNamespace;
686
704
  exports.addEventListener = addEventListener;
705
+ exports.applyRef = applyRef;
687
706
  exports.assign = assign;
688
707
  exports.className = className;
689
708
  exports.clearDelegatedEvents = clearDelegatedEvents;
690
709
  exports.createDynamic = createDynamic;
691
710
  exports.delegateEvents = delegateEvents;
692
711
  exports.dynamicProperty = dynamicProperty;
712
+ exports.effect = effect;
693
713
  exports.escape = escape;
694
714
  exports.generateHydrationScript = voidFn;
695
715
  exports.getAssets = voidFn;
716
+ exports.getFirstChild = getFirstChild;
696
717
  exports.getHydrationKey = getHydrationKey;
697
718
  exports.getNextElement = getNextElement;
698
719
  exports.getNextMarker = getNextMarker;
699
720
  exports.getNextMatch = getNextMatch;
721
+ exports.getNextSibling = getNextSibling;
700
722
  exports.getRequestEvent = voidFn;
701
723
  exports.hydrate = hydrate;
702
724
  exports.insert = insert;
703
725
  exports.isDev = isDev;
704
726
  exports.isServer = isServer;
705
727
  exports.memo = memo;
728
+ exports.ref = ref;
706
729
  exports.render = render;
707
730
  exports.renderToStream = renderToStream;
708
731
  exports.renderToString = renderToString;
@@ -722,5 +745,4 @@ exports.ssrHydrationKey = ssrHydrationKey;
722
745
  exports.ssrStyle = ssrStyle;
723
746
  exports.style = style;
724
747
  exports.template = template;
725
- exports.use = use;
726
748
  exports.useAssets = voidFn;
package/dist/web.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createMemo, sharedConfig, createRenderEffect, createRoot, flatten, untrack, omit, enableHydration } from 'solid-js';
2
- export { Errored, For, Loading, Match, Show, Switch, createComponent, createRenderEffect as effect, getOwner, merge as mergeProps, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, createRoot, flatten, omit, enableHydration } from 'solid-js';
2
+ export { Errored, For, Loading, Match, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const Properties = /*#__PURE__*/new Set([
5
5
  "value", "checked", "selected", "muted"]);
@@ -18,6 +18,9 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
18
18
  "webview",
19
19
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
20
20
 
21
+ const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
22
+ transparent: true
23
+ });
21
24
  const memo = fn => createMemo(() => fn());
22
25
 
23
26
  function reconcileArrays(parentNode, a, b) {
@@ -93,12 +96,13 @@ function render(code, element, init, options = {}) {
93
96
  }
94
97
  function template(html, isImportNode, isSVG, isMathML) {
95
98
  let node;
96
- const create = () => {
99
+ const create = bypassGuard => {
97
100
  const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
98
101
  t.innerHTML = html;
99
102
  return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
100
103
  };
101
- return isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
104
+ const fn = isImportNode ? bypassGuard => untrack(() => document.importNode(node || (node = create()), true)) : bypassGuard => (node || (node = create())).cloneNode(true);
105
+ return fn;
102
106
  }
103
107
  function delegateEvents(eventNames, document = window.document) {
104
108
  const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
@@ -171,7 +175,7 @@ function addEventListener(node, name, handler, delegate) {
171
175
  }
172
176
  function style(node, value, prev) {
173
177
  if (!value) {
174
- prev ? setAttribute(node, "style") : value;
178
+ if (prev) setAttribute(node, "style");
175
179
  return;
176
180
  }
177
181
  const nodeStyle = node.style;
@@ -193,13 +197,16 @@ function setStyleProperty(node, name, value) {
193
197
  function spread(node, props = {}, isSVG, skipChildren) {
194
198
  const prevProps = {};
195
199
  if (!skipChildren) {
196
- createRenderEffect(() => normalize(props.children, prevProps.children), value => {
200
+ effect(() => normalize(props.children, prevProps.children), value => {
197
201
  insertExpression(node, value, prevProps.children);
198
202
  prevProps.children = value;
199
203
  });
200
204
  }
201
- createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
202
- createRenderEffect(() => {
205
+ effect(() => {
206
+ const r = props.ref;
207
+ (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
208
+ }, () => {});
209
+ effect(() => {
203
210
  const newProps = {};
204
211
  for (const prop in props) {
205
212
  if (prop === "children" || prop === "ref") continue;
@@ -219,8 +226,12 @@ function dynamicProperty(props, key) {
219
226
  });
220
227
  return props;
221
228
  }
222
- function use(fn, element, arg) {
223
- untrack(() => fn(element, arg));
229
+ function applyRef(r, element) {
230
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
231
+ }
232
+ function ref(fn, element) {
233
+ const resolved = untrack(fn);
234
+ runWithOwner(null, () => applyRef(resolved, element));
224
235
  }
225
236
  function insert(parent, accessor, marker, initial) {
226
237
  const multi = marker !== undefined;
@@ -236,7 +247,7 @@ function insert(parent, accessor, marker, initial) {
236
247
  accessor = normalize(accessor, initial, multi, true);
237
248
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
238
249
  }
239
- createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
250
+ effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
240
251
  }
241
252
  function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
242
253
  props || (props = {});
@@ -295,7 +306,10 @@ function getNextElement(template) {
295
306
  key,
296
307
  hydrating = isHydrating();
297
308
  if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
298
- return template();
309
+ if (!template) {
310
+ throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
311
+ }
312
+ return template(true);
299
313
  }
300
314
  if (sharedConfig.completed) sharedConfig.completed.add(node);
301
315
  sharedConfig.registry.delete(key);
@@ -324,6 +338,14 @@ function getNextMarker(start) {
324
338
  }
325
339
  return [end, current];
326
340
  }
341
+ function getFirstChild(node, expectedTag) {
342
+ const child = node.firstChild;
343
+ return child;
344
+ }
345
+ function getNextSibling(node, expectedTag) {
346
+ const sibling = node.nextSibling;
347
+ return sibling;
348
+ }
327
349
  function runHydrationEvents() {
328
350
  if (sharedConfig.events && !sharedConfig.events.queued) {
329
351
  queueMicrotask(() => {
@@ -374,7 +396,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
374
396
  if (prop === "class") return className(node, value, isSVG, prev), value;
375
397
  if (value === prev) return prev;
376
398
  if (prop === "ref") {
377
- if (!skipRef) value(node);
399
+ if (!skipRef && value) ref(() => value, node);
378
400
  } else if (prop.slice(0, 3) === "on:") {
379
401
  const e = prop.slice(3);
380
402
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
@@ -625,4 +647,4 @@ function Dynamic(props) {
625
647
  return createDynamic(() => props.component, others);
626
648
  }
627
649
 
628
- export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };
650
+ export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, applyRef, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/web",
3
3
  "description": "Solid's web runtime for the browser and the server",
4
- "version": "2.0.0-experimental.15",
4
+ "version": "2.0.0-experimental.16",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -75,10 +75,10 @@
75
75
  "seroval-plugins": "^1.1.0"
76
76
  },
77
77
  "peerDependencies": {
78
- "solid-js": "^2.0.0-experimental.15"
78
+ "solid-js": "^2.0.0-experimental.16"
79
79
  },
80
80
  "devDependencies": {
81
- "solid-js": "2.0.0-experimental.15"
81
+ "solid-js": "2.0.0-experimental.16"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "npm-run-all -nl build:*",
@@ -90,7 +90,7 @@
90
90
  "types:web": "tsc --project ./tsconfig.build.json",
91
91
  "types:copy-web": "ncp ../../node_modules/dom-expressions/src/client.d.ts ./types/client.d.ts && ncp ../../node_modules/dom-expressions/src/server.d.ts ./types/server.d.ts",
92
92
  "types:web-storage": "tsc --project ./storage/tsconfig.build.json",
93
- "test": "vitest run && vitest run --config vite.config.server.mjs",
93
+ "test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
94
94
  "test:server": "vitest run --config vite.config.server.mjs",
95
95
  "coverage": "vitest run --coverage",
96
96
  "test-types": "tsc --project tsconfig.test.json"
package/types/client.d.ts CHANGED
@@ -62,7 +62,8 @@ export function style(
62
62
  export function getOwner(): unknown;
63
63
  export function mergeProps(...sources: unknown[]): unknown;
64
64
  export function dynamicProperty(props: unknown, key: string): unknown;
65
- export function use<Arg, Ret>(fn: (node: Element, arg: Arg) => Ret, node: Element, arg?: Arg): Ret
65
+ export function applyRef(r: ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
66
+ export function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
66
67
 
67
68
  export function hydrate(
68
69
  fn: () => JSX.Element,
package/types/core.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrRunInScope } from "solid-js";
1
+ export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrRunInScope } from "solid-js";
2
+ export declare const effect: (fn: any, effectFn: any, initial: any) => void;
2
3
  export declare const memo: (fn: any) => import("solid-js").Accessor<any>;
package/types/server.d.ts CHANGED
@@ -62,6 +62,7 @@ export function ssrAttribute(key: string, value: any): string;
62
62
  export function ssrHydrationKey(): string;
63
63
  export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
64
64
  export function escape(s: any, attr?: boolean): any;
65
+ export function applyRef(r: ((element: any) => void) | ((element: any) => void)[], element: any): void;
65
66
  export function useAssets(fn: () => JSX.Element): void;
66
67
  export function getAssets(): string;
67
68
  export function getHydrationKey(): string | undefined;