@solidjs/web 2.0.0-beta.13 → 2.0.0-beta.14

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createEffect, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
3
3
 
4
4
  const DOMWithState = {
@@ -30,6 +30,7 @@ const DOMWithState = {
30
30
  }
31
31
  };
32
32
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
33
+ const $$SLOT = /*#__PURE__*/Symbol("slot");
33
34
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
34
35
  const SVGElements = /*#__PURE__*/new Set([
35
36
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
@@ -63,14 +64,18 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
63
64
  } : transparentOptions);
64
65
  const memo = fn => createMemo(() => fn(), syncOptions);
65
66
 
66
- function reconcileArrays(parentNode, a, b) {
67
+ function reconcileArrays(parentNode, a, b, marker) {
67
68
  let bLength = b.length,
68
69
  aEnd = a.length,
69
70
  bEnd = bLength,
70
71
  aStart = 0,
71
72
  bStart = 0,
72
- after = a[aEnd - 1].nextSibling,
73
- map = null;
73
+ tail = a[aEnd - 1],
74
+ tailTag = tail[$$SLOT],
75
+ after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
76
+ map = null,
77
+ anchor,
78
+ anchorTag;
74
79
  while (aStart < aEnd || bStart < bEnd) {
75
80
  if (a[aStart] === b[bStart]) {
76
81
  aStart++;
@@ -82,20 +87,43 @@ function reconcileArrays(parentNode, a, b) {
82
87
  bEnd--;
83
88
  }
84
89
  if (aEnd === aStart) {
85
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
86
- while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
90
+ let node;
91
+ if (bEnd < bLength) {
92
+ if (bStart) {
93
+ const prev = b[bStart - 1];
94
+ const prevTag = prev[$$SLOT];
95
+ node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
96
+ } else node = b[bEnd - bStart];
97
+ } else node = after;
98
+ while (bStart < bEnd) {
99
+ const n = b[bStart++];
100
+ parentNode.insertBefore(n, node);
101
+ if (marker) n[$$SLOT] = marker;
102
+ }
87
103
  } else if (bEnd === bStart) {
88
104
  while (aStart < aEnd) {
89
- if (!map || !map.has(a[aStart])) a[aStart].remove();
90
- aStart++;
105
+ const n = a[aStart++];
106
+ if (!map || !map.has(n)) {
107
+ const tag = n[$$SLOT];
108
+ if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
109
+ }
110
+ }
111
+ } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
112
+ if (marker) {
113
+ do {
114
+ const n = a[--aEnd];
115
+ parentNode.insertBefore(n, anchor);
116
+ n[$$SLOT] = marker;
117
+ bStart++;
118
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
119
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
120
+ } else {
121
+ do {
122
+ parentNode.insertBefore(a[--aEnd], anchor);
123
+ bStart++;
124
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
125
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
91
126
  }
92
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
93
- const anchor = a[aStart];
94
- do {
95
- parentNode.insertBefore(a[--aEnd], anchor);
96
- bStart++;
97
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
98
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
99
127
  } else {
100
128
  if (!map) {
101
129
  map = new Map();
@@ -113,36 +141,66 @@ function reconcileArrays(parentNode, a, b) {
113
141
  sequence++;
114
142
  }
115
143
  if (sequence > index - bStart) {
116
- const node = a[aStart];
117
- while (bStart < index) parentNode.insertBefore(b[bStart++], node);
118
- } else parentNode.replaceChild(b[bStart++], a[aStart++]);
144
+ const head = a[aStart];
145
+ const headTag = head[$$SLOT];
146
+ const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
147
+ while (bStart < index) {
148
+ const n = b[bStart++];
149
+ parentNode.insertBefore(n, node);
150
+ if (marker) n[$$SLOT] = marker;
151
+ }
152
+ } else {
153
+ const oldNode = a[aStart++];
154
+ const newNode = b[bStart++];
155
+ const oldTag = oldNode[$$SLOT];
156
+ if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
157
+ parentNode.replaceChild(newNode, oldNode);
158
+ } else {
159
+ parentNode.insertBefore(newNode, after);
160
+ }
161
+ if (marker) newNode[$$SLOT] = marker;
162
+ }
119
163
  } else aStart++;
120
- } else a[aStart++].remove();
164
+ } else {
165
+ const n = a[aStart++];
166
+ const nTag = n[$$SLOT];
167
+ if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
168
+ }
121
169
  }
122
170
  }
123
171
  }
124
172
 
125
- const $$EVENTS = "_$DX_DELEGATE";
173
+ const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
126
174
  const INNER_OWNED = {};
175
+ const delegatedEvents = new Set();
176
+ const delegatedContainers = new Map();
127
177
  function render$1(code, element, init, options = {}) {
128
178
  if (!element) {
129
179
  throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
130
180
  }
131
181
  let disposer;
132
- createRoot(dispose => {
133
- disposer = dispose;
134
- if (element === document) {
135
- const tree = code();
136
- effect(() => flatten(tree), () => {});
137
- } else {
138
- const tree = code();
139
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
140
- }
141
- }, {
142
- id: options.renderId
143
- });
182
+ registerDelegatedRoot(element);
183
+ try {
184
+ createRoot(dispose => {
185
+ disposer = dispose;
186
+ if (element === document) {
187
+ const tree = code();
188
+ effect(() => flatten(tree), () => {});
189
+ } else {
190
+ const tree = code();
191
+ insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
192
+ }
193
+ }, {
194
+ id: options.renderId
195
+ });
196
+ } catch (err) {
197
+ if (disposer) disposer();
198
+ unregisterDelegatedRoot(element);
199
+ throw err;
200
+ }
144
201
  return () => {
145
202
  disposer();
203
+ unregisterDelegatedRoot(element);
146
204
  element.textContent = "";
147
205
  };
148
206
  }
@@ -158,20 +216,66 @@ function template(html, flag) {
158
216
  fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
159
217
  return fn;
160
218
  }
161
- function delegateEvents(eventNames, document = window.document) {
162
- const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
219
+ function delegateEvents(eventNames) {
163
220
  for (let i = 0, l = eventNames.length; i < l; i++) {
164
221
  const name = eventNames[i];
165
- if (!e.has(name)) {
166
- e.add(name);
167
- document.addEventListener(name, eventHandler);
222
+ if (!delegatedEvents.has(name)) {
223
+ delegatedEvents.add(name);
224
+ delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
168
225
  }
169
226
  }
170
227
  }
171
- function clearDelegatedEvents(document = window.document) {
172
- if (document[$$EVENTS]) {
173
- for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
174
- delete document[$$EVENTS];
228
+ function registerDelegatedRoot(root) {
229
+ const state = registerDelegatedContainer(root, root);
230
+ if (state) state.roots = (state.roots || 0) + 1;
231
+ }
232
+ function unregisterDelegatedRoot(root) {
233
+ const state = delegatedContainers.get(root);
234
+ if (state) state.roots > 1 ? state.roots-- : delete state.roots;
235
+ unregisterDelegatedContainer(root, root);
236
+ }
237
+ function registerDelegatedContainer(container, owner = container) {
238
+ if (!container || !owner) return;
239
+ let state = delegatedContainers.get(container);
240
+ if (!state) delegatedContainers.set(container, state = {
241
+ owners: new Map(),
242
+ handlers: new Map()
243
+ });
244
+ state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
245
+ delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
246
+ return state;
247
+ }
248
+ function unregisterDelegatedContainer(container, owner = container) {
249
+ const state = delegatedContainers.get(container);
250
+ if (!state) return;
251
+ const count = state.owners.get(owner);
252
+ if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
253
+ if (state.owners.size) return;
254
+ state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
255
+ delegatedContainers.delete(container);
256
+ }
257
+ function attachDelegatedEvent(name, container, state) {
258
+ if (state.handlers.has(name)) return;
259
+ const handler = e => eventHandler(e, container, state);
260
+ state.handlers.set(name, handler);
261
+ container.addEventListener(name, handler);
262
+ }
263
+ function getDelegatedRoot(node) {
264
+ while (node) {
265
+ if (delegatedContainers.get(node)?.roots) return node;
266
+ node = node._$host || node.parentNode || node.host;
267
+ }
268
+ }
269
+ function findOwner(target, state) {
270
+ let node = target;
271
+ let distance = 0;
272
+ while (node) {
273
+ if (state.owners.has(node)) return {
274
+ owner: node,
275
+ distance
276
+ };
277
+ distance++;
278
+ node = node._$host || node.parentNode || node.host;
175
279
  }
176
280
  }
177
281
  function setProperty(node, name, value) {
@@ -216,7 +320,7 @@ function className(node, value, prev) {
216
320
  node.classList.add(key);
217
321
  }
218
322
  }
219
- function addEventListener(node, name, handler, delegate) {
323
+ function addEvent(node, name, handler, delegate) {
220
324
  if (delegate) {
221
325
  if (Array.isArray(handler)) {
222
326
  node[`$$${name}`] = handler[0];
@@ -518,7 +622,17 @@ function runHydrationEvents() {
518
622
  const [el, e] = events[0];
519
623
  if (!completed.has(el)) return;
520
624
  events.shift();
521
- eventHandler(e);
625
+ let match;
626
+ for (const [container, state] of delegatedContainers) {
627
+ if (!state.handlers.has(e.type)) continue;
628
+ const entry = findOwner(e.target, state);
629
+ if (entry && (!match || entry.distance < match.distance)) match = {
630
+ container,
631
+ state,
632
+ distance: entry.distance
633
+ };
634
+ }
635
+ if (match) eventHandler(e, match.container, match.state);
522
636
  }
523
637
  if (sharedConfig.done) {
524
638
  sharedConfig.events = _$HY.events = null;
@@ -573,7 +687,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
573
687
  node.removeEventListener(name, h);
574
688
  }
575
689
  if (delegate || value) {
576
- addEventListener(node, name, value, delegate);
690
+ addEvent(node, name, value, delegate);
577
691
  delegate && delegateEvents([name]);
578
692
  }
579
693
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
@@ -585,14 +699,18 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
585
699
  }
586
700
  return value;
587
701
  }
588
- function eventHandler(e) {
702
+ function eventHandler(e, container, state) {
589
703
  if (sharedConfig.registry && sharedConfig.events) {
590
704
  if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
591
705
  }
706
+ if (e[$$EVENT_OWNER]) return;
707
+ const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
708
+ if (state && !owner) return;
709
+ e[$$EVENT_OWNER] = owner || true;
592
710
  let node = e.target;
593
711
  const key = `$$${e.type}`;
594
712
  const oriTarget = e.target;
595
- const oriCurrentTarget = e.currentTarget;
713
+ const boundary = owner || container || e.currentTarget;
596
714
  const retarget = value => Object.defineProperty(e, "target", {
597
715
  configurable: true,
598
716
  value
@@ -608,29 +726,34 @@ function eventHandler(e) {
608
726
  return true;
609
727
  };
610
728
  const walkUpTree = () => {
611
- while (handleNode() && (node = node._$host || node.parentNode || node.host));
729
+ while (handleNode()) {
730
+ if (node === boundary || node.parentNode === boundary) break;
731
+ node = node._$host || node.parentNode || node.host;
732
+ }
612
733
  };
613
734
  Object.defineProperty(e, "currentTarget", {
614
735
  configurable: true,
615
736
  get() {
616
- return node || document;
737
+ return node || boundary || document;
617
738
  }
618
739
  });
619
740
  if (e.composedPath) {
620
741
  const path = e.composedPath();
621
- retarget(path[0]);
622
- for (let i = 0; i < path.length - 2; i++) {
623
- node = path[i];
624
- if (!handleNode()) break;
625
- if (node._$host) {
626
- node = node._$host;
627
- walkUpTree();
628
- break;
629
- }
630
- if (node.parentNode === oriCurrentTarget) {
631
- break;
742
+ if (path.length) {
743
+ retarget(path[0]);
744
+ for (let i = 0; i < path.length; i++) {
745
+ node = path[i];
746
+ if (!handleNode()) break;
747
+ if (node._$host) {
748
+ node = node._$host;
749
+ walkUpTree();
750
+ break;
751
+ }
752
+ if (node === boundary || node.parentNode === boundary) {
753
+ break;
754
+ }
632
755
  }
633
- }
756
+ } else walkUpTree();
634
757
  }
635
758
  else walkUpTree();
636
759
  retarget(oriTarget);
@@ -650,9 +773,14 @@ function insertExpression(parent, value, current, marker) {
650
773
  } else if (value.nodeType) {
651
774
  if (Array.isArray(current)) {
652
775
  cleanChildren(parent, current, multi ? marker : null, value);
653
- } else if (current === undefined || !parent.firstChild) {
776
+ } else if (current && current.nodeType) {
777
+ current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
778
+ } else if (current && parent.firstChild) {
779
+ parent.replaceChild(value, parent.firstChild);
780
+ } else {
654
781
  parent.appendChild(value);
655
- } else parent.replaceChild(value, parent.firstChild);
782
+ }
783
+ if (marker) value[$$SLOT] = marker;
656
784
  } else if (Array.isArray(value)) {
657
785
  const currentArray = current && Array.isArray(current);
658
786
  if (value.length === 0) {
@@ -660,7 +788,7 @@ function insertExpression(parent, value, current, marker) {
660
788
  } else if (currentArray) {
661
789
  if (current.length === 0) {
662
790
  appendNodes(parent, value, marker);
663
- } else reconcileArrays(parent, current, value);
791
+ } else reconcileArrays(parent, current, value, marker);
664
792
  } else {
665
793
  current && cleanChildren(parent);
666
794
  appendNodes(parent, value);
@@ -685,7 +813,11 @@ function normalize(value, current, multi, doNotUnwrap) {
685
813
  return value;
686
814
  }
687
815
  function appendNodes(parent, array, marker = null) {
688
- for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
816
+ for (let i = 0, len = array.length; i < len; i++) {
817
+ const n = array[i];
818
+ parent.insertBefore(n, marker);
819
+ if (marker) n[$$SLOT] = marker;
820
+ }
689
821
  }
690
822
  function cleanChildren(parent, current, marker, replacement) {
691
823
  if (marker === undefined) return parent.textContent = "";
@@ -694,11 +826,13 @@ function cleanChildren(parent, current, marker, replacement) {
694
826
  for (let i = current.length - 1; i >= 0; i--) {
695
827
  const el = current[i];
696
828
  if (replacement !== el) {
697
- const isParent = el.parentNode === parent;
698
- if (replacement && !inserted && !i) isParent ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else isParent && el.remove();
829
+ const tag = el[$$SLOT];
830
+ const owns = el.parentNode === parent && (!tag || tag === marker);
831
+ if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
699
832
  } else inserted = true;
700
833
  }
701
834
  } else if (replacement) parent.insertBefore(replacement, marker);
835
+ if (replacement && marker) replacement[$$SLOT] = marker;
702
836
  }
703
837
  function gatherHydratable(element, root) {
704
838
  const templates = element.querySelectorAll(`*[_hk]`);
@@ -762,8 +896,8 @@ function Portal(props) {
762
896
  const treeMarker = document.createTextNode(""),
763
897
  startMarker = document.createTextNode(""),
764
898
  endMarker = document.createTextNode(""),
765
- mount = () => createElementProxy(props.mount || document.body, treeMarker);
766
- let content = createMemo(() => [startMarker, props.children]);
899
+ mount = () => createElementProxy(props.mount || document.body, treeMarker),
900
+ content = createMemo(() => [startMarker, props.children]);
767
901
  createRenderEffect(() => [mount(), content()], ([m, c]) => {
768
902
  m.appendChild(endMarker);
769
903
  insert(m, c, endMarker);
@@ -776,6 +910,12 @@ function Portal(props) {
776
910
  }
777
911
  };
778
912
  });
913
+ createEffect(mount, m => {
914
+ const ownerRoot = getDelegatedRoot(treeMarker);
915
+ if (!ownerRoot || ownerRoot.contains(m)) return;
916
+ registerDelegatedContainer(m, ownerRoot);
917
+ return () => unregisterDelegatedContainer(m, ownerRoot);
918
+ });
779
919
  return treeMarker;
780
920
  }
781
921
  function dynamic(source) {
@@ -826,4 +966,4 @@ function createElementProxy(el, marker) {
826
966
  });
827
967
  }
828
968
 
829
- export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEventListener, applyRef, assign, className, clearDelegatedEvents, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };
969
+ export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
package/dist/server.cjs CHANGED
@@ -4,6 +4,34 @@ var solidJs = require('solid-js');
4
4
  var seroval = require('seroval');
5
5
  var web = require('seroval-plugins/web');
6
6
 
7
+ const DOMWithState = {
8
+ INPUT: {
9
+ value: 1,
10
+ defaultValue: 2,
11
+ checked: 1,
12
+ defaultChecked: 2
13
+ },
14
+ SELECT: {
15
+ value: 1
16
+ },
17
+ OPTION: {
18
+ value: 1,
19
+ selected: 1,
20
+ defaultSelected: 2
21
+ },
22
+ TEXTAREA: {
23
+ value: 1,
24
+ defaultValue: 2
25
+ },
26
+ VIDEO: {
27
+ muted: 1,
28
+ defaultMuted: 2
29
+ },
30
+ AUDIO: {
31
+ muted: 1,
32
+ defaultMuted: 2
33
+ }
34
+ };
7
35
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
8
36
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
9
37
  const SVGElements = /*#__PURE__*/new Set([
@@ -952,6 +980,9 @@ function getAssets() {
952
980
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
953
981
  return out;
954
982
  }
983
+ function Assets(props) {
984
+ useAssets(() => props.children);
985
+ }
955
986
  function generateHydrationScript({
956
987
  eventNames = ["click", "input"],
957
988
  nonce
@@ -1228,8 +1259,10 @@ Object.defineProperty(exports, "untrack", {
1228
1259
  enumerable: true,
1229
1260
  get: function () { return solidJs.untrack; }
1230
1261
  });
1262
+ exports.Assets = Assets;
1231
1263
  exports.ChildProperties = ChildProperties;
1232
1264
  exports.DOMElements = DOMElements;
1265
+ exports.DOMWithState = DOMWithState;
1233
1266
  exports.DelegatedEvents = DelegatedEvents;
1234
1267
  exports.Dynamic = Dynamic;
1235
1268
  exports.HydrationScript = HydrationScript;
@@ -1240,7 +1273,7 @@ exports.RawTextElements = RawTextElements;
1240
1273
  exports.RequestContext = RequestContext;
1241
1274
  exports.SVGElements = SVGElements;
1242
1275
  exports.VoidElements = VoidElements;
1243
- exports.addEventListener = notSup;
1276
+ exports.addEvent = notSup;
1244
1277
  exports.applyRef = applyRef;
1245
1278
  exports.assign = notSup;
1246
1279
  exports.className = notSup;
@@ -1251,6 +1284,7 @@ exports.effect = effect;
1251
1284
  exports.escape = escape;
1252
1285
  exports.generateHydrationScript = generateHydrationScript;
1253
1286
  exports.getAssets = getAssets;
1287
+ exports.getDelegatedRoot = notSup;
1254
1288
  exports.getHydrationKey = getHydrationKey;
1255
1289
  exports.getNextElement = notSup;
1256
1290
  exports.getNextMarker = notSup;
@@ -1262,6 +1296,9 @@ exports.isDev = isDev;
1262
1296
  exports.isServer = isServer;
1263
1297
  exports.memo = memo;
1264
1298
  exports.mergeProps = mergeProps;
1299
+ exports.ref = notSup;
1300
+ exports.registerDelegatedContainer = notSup;
1301
+ exports.registerDelegatedRoot = notSup;
1265
1302
  exports.render = notSup;
1266
1303
  exports.renderToStream = renderToStream;
1267
1304
  exports.renderToString = renderToString;
@@ -1270,6 +1307,7 @@ exports.runHydrationEvents = notSup;
1270
1307
  exports.setAttribute = notSup;
1271
1308
  exports.setAttributeNS = notSup;
1272
1309
  exports.setProperty = notSup;
1310
+ exports.setStyleProperty = notSup;
1273
1311
  exports.spread = notSup;
1274
1312
  exports.ssr = ssr;
1275
1313
  exports.ssrAttribute = ssrAttribute;
@@ -1281,4 +1319,6 @@ exports.ssrStyle = ssrStyle;
1281
1319
  exports.ssrStyleProperty = ssrStyleProperty;
1282
1320
  exports.style = notSup;
1283
1321
  exports.template = notSup;
1322
+ exports.unregisterDelegatedContainer = notSup;
1323
+ exports.unregisterDelegatedRoot = notSup;
1284
1324
  exports.useAssets = useAssets;
package/dist/server.js CHANGED
@@ -3,6 +3,34 @@ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, S
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
 
6
+ const DOMWithState = {
7
+ INPUT: {
8
+ value: 1,
9
+ defaultValue: 2,
10
+ checked: 1,
11
+ defaultChecked: 2
12
+ },
13
+ SELECT: {
14
+ value: 1
15
+ },
16
+ OPTION: {
17
+ value: 1,
18
+ selected: 1,
19
+ defaultSelected: 2
20
+ },
21
+ TEXTAREA: {
22
+ value: 1,
23
+ defaultValue: 2
24
+ },
25
+ VIDEO: {
26
+ muted: 1,
27
+ defaultMuted: 2
28
+ },
29
+ AUDIO: {
30
+ muted: 1,
31
+ defaultMuted: 2
32
+ }
33
+ };
6
34
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
7
35
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
8
36
  const SVGElements = /*#__PURE__*/new Set([
@@ -951,6 +979,9 @@ function getAssets() {
951
979
  for (let i = 0, len = assets.length; i < len; i++) out += assets[i]();
952
980
  return out;
953
981
  }
982
+ function Assets(props) {
983
+ useAssets(() => props.children);
984
+ }
954
985
  function generateHydrationScript({
955
986
  eventNames = ["click", "input"],
956
987
  nonce
@@ -1175,4 +1206,4 @@ function Portal(props) {
1175
1206
  throw new Error("Portal is not supported on the server");
1176
1207
  }
1177
1208
 
1178
- export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, 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, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
1209
+ export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as addEvent, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useAssets };