solid-js 1.9.3 → 2.0.0-experimental.0

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.
Files changed (76) hide show
  1. package/dist/dev.cjs +213 -1603
  2. package/dist/dev.js +159 -1749
  3. package/dist/server.cjs +88 -11
  4. package/dist/server.js +91 -11
  5. package/dist/solid.cjs +196 -1558
  6. package/dist/solid.js +139 -1682
  7. package/package.json +8 -154
  8. package/types/{render → client}/component.d.ts +0 -61
  9. package/types/client/core.d.ts +75 -0
  10. package/types/client/flow.d.ts +114 -0
  11. package/types/{render → client}/hydration.d.ts +0 -2
  12. package/types/{reactive → client}/observable.d.ts +1 -1
  13. package/types/index.d.ts +44 -55
  14. package/types/jsx.d.ts +1944 -174
  15. package/types/server/index.d.ts +1 -1
  16. package/types/server/reactive.d.ts +6 -1
  17. package/types/server/store.d.ts +6 -0
  18. package/h/dist/h.cjs +0 -115
  19. package/h/dist/h.js +0 -144
  20. package/h/jsx-dev-runtime/package.json +0 -8
  21. package/h/jsx-runtime/dist/jsx.cjs +0 -15
  22. package/h/jsx-runtime/dist/jsx.js +0 -10
  23. package/h/jsx-runtime/package.json +0 -8
  24. package/h/jsx-runtime/types/index.d.ts +0 -14
  25. package/h/jsx-runtime/types/jsx.d.ts +0 -2276
  26. package/h/package.json +0 -8
  27. package/h/types/hyperscript.d.ts +0 -20
  28. package/h/types/index.d.ts +0 -3
  29. package/html/dist/html.cjs +0 -583
  30. package/html/dist/html.js +0 -706
  31. package/html/package.json +0 -8
  32. package/html/types/index.d.ts +0 -3
  33. package/html/types/lit.d.ts +0 -60
  34. package/store/dist/dev.cjs +0 -454
  35. package/store/dist/dev.js +0 -525
  36. package/store/dist/server.cjs +0 -126
  37. package/store/dist/server.js +0 -126
  38. package/store/dist/store.cjs +0 -434
  39. package/store/dist/store.js +0 -499
  40. package/store/package.json +0 -46
  41. package/store/types/index.d.ts +0 -26
  42. package/store/types/modifiers.d.ts +0 -9
  43. package/store/types/mutable.d.ts +0 -8
  44. package/store/types/server.d.ts +0 -37
  45. package/store/types/store.d.ts +0 -263
  46. package/types/reactive/array.d.ts +0 -52
  47. package/types/reactive/scheduler.d.ts +0 -13
  48. package/types/reactive/signal.d.ts +0 -664
  49. package/types/render/Suspense.d.ts +0 -26
  50. package/types/render/flow.d.ts +0 -130
  51. package/types/render/index.d.ts +0 -4
  52. package/universal/dist/dev.cjs +0 -243
  53. package/universal/dist/dev.js +0 -257
  54. package/universal/dist/universal.cjs +0 -243
  55. package/universal/dist/universal.js +0 -257
  56. package/universal/package.json +0 -20
  57. package/universal/types/index.d.ts +0 -4
  58. package/universal/types/universal.d.ts +0 -29
  59. package/web/dist/dev.cjs +0 -804
  60. package/web/dist/dev.js +0 -1241
  61. package/web/dist/server.cjs +0 -793
  62. package/web/dist/server.js +0 -1214
  63. package/web/dist/web.cjs +0 -793
  64. package/web/dist/web.js +0 -1220
  65. package/web/package.json +0 -46
  66. package/web/storage/dist/storage.cjs +0 -12
  67. package/web/storage/dist/storage.js +0 -10
  68. package/web/storage/package.json +0 -15
  69. package/web/storage/types/index.d.ts +0 -2
  70. package/web/storage/types/index.js +0 -13
  71. package/web/types/client.d.ts +0 -79
  72. package/web/types/core.d.ts +0 -10
  73. package/web/types/index.d.ts +0 -54
  74. package/web/types/jsx.d.ts +0 -1
  75. package/web/types/server-mock.d.ts +0 -80
  76. package/web/types/server.d.ts +0 -177
package/web/dist/web.cjs DELETED
@@ -1,793 +0,0 @@
1
- 'use strict';
2
-
3
- var solidJs = require('solid-js');
4
-
5
- const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
6
- const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
7
- const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
8
- const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
9
- className: "class",
10
- htmlFor: "for"
11
- });
12
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
13
- class: "className",
14
- formnovalidate: {
15
- $: "formNoValidate",
16
- BUTTON: 1,
17
- INPUT: 1
18
- },
19
- ismap: {
20
- $: "isMap",
21
- IMG: 1
22
- },
23
- nomodule: {
24
- $: "noModule",
25
- SCRIPT: 1
26
- },
27
- playsinline: {
28
- $: "playsInline",
29
- VIDEO: 1
30
- },
31
- readonly: {
32
- $: "readOnly",
33
- INPUT: 1,
34
- TEXTAREA: 1
35
- }
36
- });
37
- function getPropAlias(prop, tagName) {
38
- const a = PropAliases[prop];
39
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
40
- }
41
- const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
42
- const SVGElements = /*#__PURE__*/new Set([
43
- "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",
44
- "set", "stop",
45
- "svg", "switch", "symbol", "text", "textPath",
46
- "tref", "tspan", "use", "view", "vkern"]);
47
- const SVGNamespace = {
48
- xlink: "http://www.w3.org/1999/xlink",
49
- xml: "http://www.w3.org/XML/1998/namespace"
50
- };
51
- const DOMElements = /*#__PURE__*/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", "h1", "h2", "h3", "h4", "h5", "h6"]);
52
-
53
- function reconcileArrays(parentNode, a, b) {
54
- let bLength = b.length,
55
- aEnd = a.length,
56
- bEnd = bLength,
57
- aStart = 0,
58
- bStart = 0,
59
- after = a[aEnd - 1].nextSibling,
60
- map = null;
61
- while (aStart < aEnd || bStart < bEnd) {
62
- if (a[aStart] === b[bStart]) {
63
- aStart++;
64
- bStart++;
65
- continue;
66
- }
67
- while (a[aEnd - 1] === b[bEnd - 1]) {
68
- aEnd--;
69
- bEnd--;
70
- }
71
- if (aEnd === aStart) {
72
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
73
- while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
74
- } else if (bEnd === bStart) {
75
- while (aStart < aEnd) {
76
- if (!map || !map.has(a[aStart])) a[aStart].remove();
77
- aStart++;
78
- }
79
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
80
- const node = a[--aEnd].nextSibling;
81
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
82
- parentNode.insertBefore(b[--bEnd], node);
83
- a[aEnd] = b[bEnd];
84
- } else {
85
- if (!map) {
86
- map = new Map();
87
- let i = bStart;
88
- while (i < bEnd) map.set(b[i], i++);
89
- }
90
- const index = map.get(a[aStart]);
91
- if (index != null) {
92
- if (bStart < index && index < bEnd) {
93
- let i = aStart,
94
- sequence = 1,
95
- t;
96
- while (++i < aEnd && i < bEnd) {
97
- if ((t = map.get(a[i])) == null || t !== index + sequence) break;
98
- sequence++;
99
- }
100
- if (sequence > index - bStart) {
101
- const node = a[aStart];
102
- while (bStart < index) parentNode.insertBefore(b[bStart++], node);
103
- } else parentNode.replaceChild(b[bStart++], a[aStart++]);
104
- } else aStart++;
105
- } else a[aStart++].remove();
106
- }
107
- }
108
- }
109
-
110
- const $$EVENTS = "_$DX_DELEGATE";
111
- function render(code, element, init, options = {}) {
112
- let disposer;
113
- solidJs.createRoot(dispose => {
114
- disposer = dispose;
115
- element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
116
- }, options.owner);
117
- return () => {
118
- disposer();
119
- element.textContent = "";
120
- };
121
- }
122
- function template(html, isImportNode, isSVG) {
123
- let node;
124
- const create = () => {
125
- const t = document.createElement("template");
126
- t.innerHTML = html;
127
- return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
128
- };
129
- const fn = isImportNode ? () => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
130
- fn.cloneNode = fn;
131
- return fn;
132
- }
133
- function delegateEvents(eventNames, document = window.document) {
134
- const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
135
- for (let i = 0, l = eventNames.length; i < l; i++) {
136
- const name = eventNames[i];
137
- if (!e.has(name)) {
138
- e.add(name);
139
- document.addEventListener(name, eventHandler);
140
- }
141
- }
142
- }
143
- function clearDelegatedEvents(document = window.document) {
144
- if (document[$$EVENTS]) {
145
- for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
146
- delete document[$$EVENTS];
147
- }
148
- }
149
- function setProperty(node, name, value) {
150
- if (isHydrating(node)) return;
151
- node[name] = value;
152
- }
153
- function setAttribute(node, name, value) {
154
- if (isHydrating(node)) return;
155
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
156
- }
157
- function setAttributeNS(node, namespace, name, value) {
158
- if (isHydrating(node)) return;
159
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
160
- }
161
- function setBoolAttribute(node, name, value) {
162
- if (isHydrating(node)) return;
163
- value ? node.setAttribute(name, "") : node.removeAttribute(name);
164
- }
165
- function className(node, value) {
166
- if (isHydrating(node)) return;
167
- if (value == null) node.removeAttribute("class");else node.className = value;
168
- }
169
- function addEventListener(node, name, handler, delegate) {
170
- if (delegate) {
171
- if (Array.isArray(handler)) {
172
- node[`$$${name}`] = handler[0];
173
- node[`$$${name}Data`] = handler[1];
174
- } else node[`$$${name}`] = handler;
175
- } else if (Array.isArray(handler)) {
176
- const handlerFn = handler[0];
177
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
178
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
179
- }
180
- function classList(node, value, prev = {}) {
181
- const classKeys = Object.keys(value || {}),
182
- prevKeys = Object.keys(prev);
183
- let i, len;
184
- for (i = 0, len = prevKeys.length; i < len; i++) {
185
- const key = prevKeys[i];
186
- if (!key || key === "undefined" || value[key]) continue;
187
- toggleClassKey(node, key, false);
188
- delete prev[key];
189
- }
190
- for (i = 0, len = classKeys.length; i < len; i++) {
191
- const key = classKeys[i],
192
- classValue = !!value[key];
193
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
194
- toggleClassKey(node, key, true);
195
- prev[key] = classValue;
196
- }
197
- return prev;
198
- }
199
- function style(node, value, prev) {
200
- if (!value) return prev ? setAttribute(node, "style") : value;
201
- const nodeStyle = node.style;
202
- if (typeof value === "string") return nodeStyle.cssText = value;
203
- typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
204
- prev || (prev = {});
205
- value || (value = {});
206
- let v, s;
207
- for (s in prev) {
208
- value[s] == null && nodeStyle.removeProperty(s);
209
- delete prev[s];
210
- }
211
- for (s in value) {
212
- v = value[s];
213
- if (v !== prev[s]) {
214
- nodeStyle.setProperty(s, v);
215
- prev[s] = v;
216
- }
217
- }
218
- return prev;
219
- }
220
- function spread(node, props = {}, isSVG, skipChildren) {
221
- const prevProps = {};
222
- if (!skipChildren) {
223
- solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
224
- }
225
- solidJs.createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
226
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
227
- return prevProps;
228
- }
229
- function dynamicProperty(props, key) {
230
- const src = props[key];
231
- Object.defineProperty(props, key, {
232
- get() {
233
- return src();
234
- },
235
- enumerable: true
236
- });
237
- return props;
238
- }
239
- function use(fn, element, arg) {
240
- return solidJs.untrack(() => fn(element, arg));
241
- }
242
- function insert(parent, accessor, marker, initial) {
243
- if (marker !== undefined && !initial) initial = [];
244
- if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
245
- solidJs.createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
246
- }
247
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
248
- props || (props = {});
249
- for (const prop in prevProps) {
250
- if (!(prop in props)) {
251
- if (prop === "children") continue;
252
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
253
- }
254
- }
255
- for (const prop in props) {
256
- if (prop === "children") {
257
- if (!skipChildren) insertExpression(node, props.children);
258
- continue;
259
- }
260
- const value = props[prop];
261
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
262
- }
263
- }
264
- function hydrate$1(code, element, options = {}) {
265
- if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
266
- solidJs.sharedConfig.completed = globalThis._$HY.completed;
267
- solidJs.sharedConfig.events = globalThis._$HY.events;
268
- solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
269
- solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
270
- solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
271
- solidJs.sharedConfig.registry = new Map();
272
- solidJs.sharedConfig.context = {
273
- id: options.renderId || "",
274
- count: 0
275
- };
276
- try {
277
- gatherHydratable(element, options.renderId);
278
- return render(code, element, [...element.childNodes], options);
279
- } finally {
280
- solidJs.sharedConfig.context = null;
281
- }
282
- }
283
- function getNextElement(template) {
284
- let node,
285
- key,
286
- hydrating = isHydrating();
287
- if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
288
- return template();
289
- }
290
- if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
291
- solidJs.sharedConfig.registry.delete(key);
292
- return node;
293
- }
294
- function getNextMatch(el, nodeName) {
295
- while (el && el.localName !== nodeName) el = el.nextSibling;
296
- return el;
297
- }
298
- function getNextMarker(start) {
299
- let end = start,
300
- count = 0,
301
- current = [];
302
- if (isHydrating(start)) {
303
- while (end) {
304
- if (end.nodeType === 8) {
305
- const v = end.nodeValue;
306
- if (v === "$") count++;else if (v === "/") {
307
- if (count === 0) return [end, current];
308
- count--;
309
- }
310
- }
311
- current.push(end);
312
- end = end.nextSibling;
313
- }
314
- }
315
- return [end, current];
316
- }
317
- function runHydrationEvents() {
318
- if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
319
- queueMicrotask(() => {
320
- const {
321
- completed,
322
- events
323
- } = solidJs.sharedConfig;
324
- if (!events) return;
325
- events.queued = false;
326
- while (events.length) {
327
- const [el, e] = events[0];
328
- if (!completed.has(el)) return;
329
- events.shift();
330
- eventHandler(e);
331
- }
332
- if (solidJs.sharedConfig.done) {
333
- solidJs.sharedConfig.events = _$HY.events = null;
334
- solidJs.sharedConfig.completed = _$HY.completed = null;
335
- }
336
- });
337
- solidJs.sharedConfig.events.queued = true;
338
- }
339
- }
340
- function isHydrating(node) {
341
- return !!solidJs.sharedConfig.context && !solidJs.sharedConfig.done && (!node || node.isConnected);
342
- }
343
- function toPropertyName(name) {
344
- return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
345
- }
346
- function toggleClassKey(node, key, value) {
347
- const classNames = key.trim().split(/\s+/);
348
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
349
- }
350
- function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
351
- let isCE, isProp, isChildProp, propAlias, forceProp;
352
- if (prop === "style") return style(node, value, prev);
353
- if (prop === "classList") return classList(node, value, prev);
354
- if (value === prev) return prev;
355
- if (prop === "ref") {
356
- if (!skipRef) value(node);
357
- } else if (prop.slice(0, 3) === "on:") {
358
- const e = prop.slice(3);
359
- prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
360
- value && node.addEventListener(e, value, typeof value !== "function" && value);
361
- } else if (prop.slice(0, 10) === "oncapture:") {
362
- const e = prop.slice(10);
363
- prev && node.removeEventListener(e, prev, true);
364
- value && node.addEventListener(e, value, true);
365
- } else if (prop.slice(0, 2) === "on") {
366
- const name = prop.slice(2).toLowerCase();
367
- const delegate = DelegatedEvents.has(name);
368
- if (!delegate && prev) {
369
- const h = Array.isArray(prev) ? prev[0] : prev;
370
- node.removeEventListener(name, h);
371
- }
372
- if (delegate || value) {
373
- addEventListener(node, name, value, delegate);
374
- delegate && delegateEvents([name]);
375
- }
376
- } else if (prop.slice(0, 5) === "attr:") {
377
- setAttribute(node, prop.slice(5), value);
378
- } else if (prop.slice(0, 5) === "bool:") {
379
- setBoolAttribute(node, prop.slice(5), value);
380
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || 'is' in props)) {
381
- if (forceProp) {
382
- prop = prop.slice(5);
383
- isProp = true;
384
- } else if (isHydrating(node)) return value;
385
- if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
386
- } else {
387
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
388
- if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
389
- }
390
- return value;
391
- }
392
- function eventHandler(e) {
393
- if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
394
- if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
395
- }
396
- let node = e.target;
397
- const key = `$$${e.type}`;
398
- const oriTarget = e.target;
399
- const oriCurrentTarget = e.currentTarget;
400
- const retarget = value => Object.defineProperty(e, "target", {
401
- configurable: true,
402
- value
403
- });
404
- const handleNode = () => {
405
- const handler = node[key];
406
- if (handler && !node.disabled) {
407
- const data = node[`${key}Data`];
408
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
409
- if (e.cancelBubble) return;
410
- }
411
- node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
412
- return true;
413
- };
414
- const walkUpTree = () => {
415
- while (handleNode() && (node = node._$host || node.parentNode || node.host));
416
- };
417
- Object.defineProperty(e, "currentTarget", {
418
- configurable: true,
419
- get() {
420
- return node || document;
421
- }
422
- });
423
- if (solidJs.sharedConfig.registry && !solidJs.sharedConfig.done) solidJs.sharedConfig.done = _$HY.done = true;
424
- if (e.composedPath) {
425
- const path = e.composedPath();
426
- retarget(path[0]);
427
- for (let i = 0; i < path.length - 2; i++) {
428
- node = path[i];
429
- if (!handleNode()) break;
430
- if (node._$host) {
431
- node = node._$host;
432
- walkUpTree();
433
- break;
434
- }
435
- if (node.parentNode === oriCurrentTarget) {
436
- break;
437
- }
438
- }
439
- }
440
- else walkUpTree();
441
- retarget(oriTarget);
442
- }
443
- function insertExpression(parent, value, current, marker, unwrapArray) {
444
- const hydrating = isHydrating(parent);
445
- if (hydrating) {
446
- !current && (current = [...parent.childNodes]);
447
- let cleaned = [];
448
- for (let i = 0; i < current.length; i++) {
449
- const node = current[i];
450
- if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();else cleaned.push(node);
451
- }
452
- current = cleaned;
453
- }
454
- while (typeof current === "function") current = current();
455
- if (value === current) return current;
456
- const t = typeof value,
457
- multi = marker !== undefined;
458
- parent = multi && current[0] && current[0].parentNode || parent;
459
- if (t === "string" || t === "number") {
460
- if (hydrating) return current;
461
- if (t === "number") {
462
- value = value.toString();
463
- if (value === current) return current;
464
- }
465
- if (multi) {
466
- let node = current[0];
467
- if (node && node.nodeType === 3) {
468
- node.data !== value && (node.data = value);
469
- } else node = document.createTextNode(value);
470
- current = cleanChildren(parent, current, marker, node);
471
- } else {
472
- if (current !== "" && typeof current === "string") {
473
- current = parent.firstChild.data = value;
474
- } else current = parent.textContent = value;
475
- }
476
- } else if (value == null || t === "boolean") {
477
- if (hydrating) return current;
478
- current = cleanChildren(parent, current, marker);
479
- } else if (t === "function") {
480
- solidJs.createRenderEffect(() => {
481
- let v = value();
482
- while (typeof v === "function") v = v();
483
- current = insertExpression(parent, v, current, marker);
484
- });
485
- return () => current;
486
- } else if (Array.isArray(value)) {
487
- const array = [];
488
- const currentArray = current && Array.isArray(current);
489
- if (normalizeIncomingArray(array, value, current, unwrapArray)) {
490
- solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
491
- return () => current;
492
- }
493
- if (hydrating) {
494
- if (!array.length) return current;
495
- if (marker === undefined) return current = [...parent.childNodes];
496
- let node = array[0];
497
- if (node.parentNode !== parent) return current;
498
- const nodes = [node];
499
- while ((node = node.nextSibling) !== marker) nodes.push(node);
500
- return current = nodes;
501
- }
502
- if (array.length === 0) {
503
- current = cleanChildren(parent, current, marker);
504
- if (multi) return current;
505
- } else if (currentArray) {
506
- if (current.length === 0) {
507
- appendNodes(parent, array, marker);
508
- } else reconcileArrays(parent, current, array);
509
- } else {
510
- current && cleanChildren(parent);
511
- appendNodes(parent, array);
512
- }
513
- current = array;
514
- } else if (value.nodeType) {
515
- if (hydrating && value.parentNode) return current = multi ? [value] : value;
516
- if (Array.isArray(current)) {
517
- if (multi) return current = cleanChildren(parent, current, marker, value);
518
- cleanChildren(parent, current, null, value);
519
- } else if (current == null || current === "" || !parent.firstChild) {
520
- parent.appendChild(value);
521
- } else parent.replaceChild(value, parent.firstChild);
522
- current = value;
523
- } else ;
524
- return current;
525
- }
526
- function normalizeIncomingArray(normalized, array, current, unwrap) {
527
- let dynamic = false;
528
- for (let i = 0, len = array.length; i < len; i++) {
529
- let item = array[i],
530
- prev = current && current[normalized.length],
531
- t;
532
- if (item == null || item === true || item === false) ; else if ((t = typeof item) === "object" && item.nodeType) {
533
- normalized.push(item);
534
- } else if (Array.isArray(item)) {
535
- dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
536
- } else if (t === "function") {
537
- if (unwrap) {
538
- while (typeof item === "function") item = item();
539
- dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
540
- } else {
541
- normalized.push(item);
542
- dynamic = true;
543
- }
544
- } else {
545
- const value = String(item);
546
- if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);else normalized.push(document.createTextNode(value));
547
- }
548
- }
549
- return dynamic;
550
- }
551
- function appendNodes(parent, array, marker = null) {
552
- for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
553
- }
554
- function cleanChildren(parent, current, marker, replacement) {
555
- if (marker === undefined) return parent.textContent = "";
556
- const node = replacement || document.createTextNode("");
557
- if (current.length) {
558
- let inserted = false;
559
- for (let i = current.length - 1; i >= 0; i--) {
560
- const el = current[i];
561
- if (node !== el) {
562
- const isParent = el.parentNode === parent;
563
- if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
564
- } else inserted = true;
565
- }
566
- } else parent.insertBefore(node, marker);
567
- return [node];
568
- }
569
- function gatherHydratable(element, root) {
570
- const templates = element.querySelectorAll(`*[data-hk]`);
571
- for (let i = 0; i < templates.length; i++) {
572
- const node = templates[i];
573
- const key = node.getAttribute("data-hk");
574
- if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
575
- }
576
- }
577
- function getHydrationKey() {
578
- return solidJs.sharedConfig.getNextContextId();
579
- }
580
- function NoHydration(props) {
581
- return solidJs.sharedConfig.context ? undefined : props.children;
582
- }
583
- function Hydration(props) {
584
- return props.children;
585
- }
586
- const voidFn = () => undefined;
587
- const RequestContext = Symbol();
588
- function innerHTML(parent, content) {
589
- !solidJs.sharedConfig.context && (parent.innerHTML = content);
590
- }
591
-
592
- function throwInBrowser(func) {
593
- const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
594
- console.error(err);
595
- }
596
- function renderToString(fn, options) {
597
- throwInBrowser(renderToString);
598
- }
599
- function renderToStringAsync(fn, options) {
600
- throwInBrowser(renderToStringAsync);
601
- }
602
- function renderToStream(fn, options) {
603
- throwInBrowser(renderToStream);
604
- }
605
- function ssr(template, ...nodes) {}
606
- function ssrElement(name, props, children, needsId) {}
607
- function ssrClassList(value) {}
608
- function ssrStyle(value) {}
609
- function ssrAttribute(key, value) {}
610
- function ssrHydrationKey() {}
611
- function resolveSSRNode(node) {}
612
- function escape(html) {}
613
- function ssrSpread(props, isSVG, skipChildren) {}
614
-
615
- const isServer = false;
616
- const isDev = false;
617
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
618
- function createElement(tagName, isSVG = false) {
619
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
620
- }
621
- const hydrate = (...args) => {
622
- solidJs.enableHydration();
623
- return hydrate$1(...args);
624
- };
625
- function Portal(props) {
626
- const {
627
- useShadow
628
- } = props,
629
- marker = document.createTextNode(""),
630
- mount = () => props.mount || document.body,
631
- owner = solidJs.getOwner();
632
- let content;
633
- let hydrating = !!solidJs.sharedConfig.context;
634
- solidJs.createEffect(() => {
635
- if (hydrating) solidJs.getOwner().user = hydrating = false;
636
- content || (content = solidJs.runWithOwner(owner, () => solidJs.createMemo(() => props.children)));
637
- const el = mount();
638
- if (el instanceof HTMLHeadElement) {
639
- const [clean, setClean] = solidJs.createSignal(false);
640
- const cleanup = () => setClean(true);
641
- solidJs.createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
642
- solidJs.onCleanup(cleanup);
643
- } else {
644
- const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
645
- renderRoot = useShadow && container.attachShadow ? container.attachShadow({
646
- mode: "open"
647
- }) : container;
648
- Object.defineProperty(container, "_$host", {
649
- get() {
650
- return marker.parentNode;
651
- },
652
- configurable: true
653
- });
654
- insert(renderRoot, content);
655
- el.appendChild(container);
656
- props.ref && props.ref(container);
657
- solidJs.onCleanup(() => el.removeChild(container));
658
- }
659
- }, undefined, {
660
- render: !hydrating
661
- });
662
- return marker;
663
- }
664
- function Dynamic(props) {
665
- const [p, others] = solidJs.splitProps(props, ["component"]);
666
- const cached = solidJs.createMemo(() => p.component);
667
- return solidJs.createMemo(() => {
668
- const component = cached();
669
- switch (typeof component) {
670
- case "function":
671
- return solidJs.untrack(() => component(others));
672
- case "string":
673
- const isSvg = SVGElements.has(component);
674
- const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
675
- spread(el, others, isSvg);
676
- return el;
677
- }
678
- });
679
- }
680
-
681
- Object.defineProperty(exports, "ErrorBoundary", {
682
- enumerable: true,
683
- get: function () { return solidJs.ErrorBoundary; }
684
- });
685
- Object.defineProperty(exports, "For", {
686
- enumerable: true,
687
- get: function () { return solidJs.For; }
688
- });
689
- Object.defineProperty(exports, "Index", {
690
- enumerable: true,
691
- get: function () { return solidJs.Index; }
692
- });
693
- Object.defineProperty(exports, "Match", {
694
- enumerable: true,
695
- get: function () { return solidJs.Match; }
696
- });
697
- Object.defineProperty(exports, "Show", {
698
- enumerable: true,
699
- get: function () { return solidJs.Show; }
700
- });
701
- Object.defineProperty(exports, "Suspense", {
702
- enumerable: true,
703
- get: function () { return solidJs.Suspense; }
704
- });
705
- Object.defineProperty(exports, "SuspenseList", {
706
- enumerable: true,
707
- get: function () { return solidJs.SuspenseList; }
708
- });
709
- Object.defineProperty(exports, "Switch", {
710
- enumerable: true,
711
- get: function () { return solidJs.Switch; }
712
- });
713
- Object.defineProperty(exports, "createComponent", {
714
- enumerable: true,
715
- get: function () { return solidJs.createComponent; }
716
- });
717
- Object.defineProperty(exports, "effect", {
718
- enumerable: true,
719
- get: function () { return solidJs.createRenderEffect; }
720
- });
721
- Object.defineProperty(exports, "getOwner", {
722
- enumerable: true,
723
- get: function () { return solidJs.getOwner; }
724
- });
725
- Object.defineProperty(exports, "memo", {
726
- enumerable: true,
727
- get: function () { return solidJs.createMemo; }
728
- });
729
- Object.defineProperty(exports, "mergeProps", {
730
- enumerable: true,
731
- get: function () { return solidJs.mergeProps; }
732
- });
733
- Object.defineProperty(exports, "untrack", {
734
- enumerable: true,
735
- get: function () { return solidJs.untrack; }
736
- });
737
- exports.Aliases = Aliases;
738
- exports.Assets = voidFn;
739
- exports.ChildProperties = ChildProperties;
740
- exports.DOMElements = DOMElements;
741
- exports.DelegatedEvents = DelegatedEvents;
742
- exports.Dynamic = Dynamic;
743
- exports.Hydration = Hydration;
744
- exports.HydrationScript = voidFn;
745
- exports.NoHydration = NoHydration;
746
- exports.Portal = Portal;
747
- exports.Properties = Properties;
748
- exports.RequestContext = RequestContext;
749
- exports.SVGElements = SVGElements;
750
- exports.SVGNamespace = SVGNamespace;
751
- exports.addEventListener = addEventListener;
752
- exports.assign = assign;
753
- exports.classList = classList;
754
- exports.className = className;
755
- exports.clearDelegatedEvents = clearDelegatedEvents;
756
- exports.delegateEvents = delegateEvents;
757
- exports.dynamicProperty = dynamicProperty;
758
- exports.escape = escape;
759
- exports.generateHydrationScript = voidFn;
760
- exports.getAssets = voidFn;
761
- exports.getHydrationKey = getHydrationKey;
762
- exports.getNextElement = getNextElement;
763
- exports.getNextMarker = getNextMarker;
764
- exports.getNextMatch = getNextMatch;
765
- exports.getPropAlias = getPropAlias;
766
- exports.getRequestEvent = voidFn;
767
- exports.hydrate = hydrate;
768
- exports.innerHTML = innerHTML;
769
- exports.insert = insert;
770
- exports.isDev = isDev;
771
- exports.isServer = isServer;
772
- exports.render = render;
773
- exports.renderToStream = renderToStream;
774
- exports.renderToString = renderToString;
775
- exports.renderToStringAsync = renderToStringAsync;
776
- exports.resolveSSRNode = resolveSSRNode;
777
- exports.runHydrationEvents = runHydrationEvents;
778
- exports.setAttribute = setAttribute;
779
- exports.setAttributeNS = setAttributeNS;
780
- exports.setBoolAttribute = setBoolAttribute;
781
- exports.setProperty = setProperty;
782
- exports.spread = spread;
783
- exports.ssr = ssr;
784
- exports.ssrAttribute = ssrAttribute;
785
- exports.ssrClassList = ssrClassList;
786
- exports.ssrElement = ssrElement;
787
- exports.ssrHydrationKey = ssrHydrationKey;
788
- exports.ssrSpread = ssrSpread;
789
- exports.ssrStyle = ssrStyle;
790
- exports.style = style;
791
- exports.template = template;
792
- exports.use = use;
793
- exports.useAssets = voidFn;