@solidjs/web 2.0.0-beta.6 → 2.0.0-beta.8
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 +133 -63
- package/dist/dev.js +131 -65
- package/dist/server.cjs +94 -85
- package/dist/server.js +94 -85
- package/dist/web.cjs +123 -57
- package/dist/web.js +121 -59
- package/package.json +72 -30
- package/storage/package.json +8 -3
- package/storage/types/src/index.d.ts +22 -8
- package/storage/types-cjs/index.d.cts +2 -0
- package/storage/types-cjs/package.json +3 -0
- package/storage/types-cjs/src/client.d.cts +1 -0
- package/storage/types-cjs/src/index.d.cts +60 -0
- package/storage/types-cjs/src/server-mock.d.cts +72 -0
- package/storage/types-cjs/storage/src/index.d.cts +2 -0
- package/types/client.d.ts +27 -12
- package/types/core.d.ts +1 -1
- package/types/index.d.ts +22 -8
- package/types/server.d.ts +30 -13
- package/types-cjs/client.d.cts +102 -0
- package/types-cjs/core.d.cts +3 -0
- package/types-cjs/index.d.cts +60 -0
- package/types-cjs/jsx.d.cts +1 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server-mock.d.cts +72 -0
- package/types-cjs/server.d.cts +172 -0
package/dist/web.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, enableHydration } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, enableHydration, flush } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
3
|
import { createMemo } from '@solidjs/signals';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
7
7
|
value: 1,
|
|
8
|
-
defaultValue:
|
|
8
|
+
defaultValue: 2,
|
|
9
9
|
checked: 1,
|
|
10
|
-
defaultChecked:
|
|
10
|
+
defaultChecked: 2
|
|
11
11
|
},
|
|
12
12
|
SELECT: {
|
|
13
13
|
value: 1
|
|
@@ -15,26 +15,21 @@ const DOMWithState = {
|
|
|
15
15
|
OPTION: {
|
|
16
16
|
value: 1,
|
|
17
17
|
selected: 1,
|
|
18
|
-
defaultSelected:
|
|
18
|
+
defaultSelected: 2
|
|
19
19
|
},
|
|
20
20
|
TEXTAREA: {
|
|
21
21
|
value: 1,
|
|
22
|
-
defaultValue:
|
|
22
|
+
defaultValue: 2
|
|
23
23
|
},
|
|
24
24
|
VIDEO: {
|
|
25
25
|
muted: 1,
|
|
26
|
-
defaultMuted:
|
|
26
|
+
defaultMuted: 2
|
|
27
27
|
},
|
|
28
28
|
AUDIO: {
|
|
29
29
|
muted: 1,
|
|
30
|
-
defaultMuted:
|
|
30
|
+
defaultMuted: 2
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
for (const tagName in DOMWithState) {
|
|
34
|
-
for (const propName in DOMWithState[tagName]) {
|
|
35
|
-
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
39
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"]);
|
|
40
35
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -53,10 +48,14 @@ const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta"
|
|
|
53
48
|
"webview",
|
|
54
49
|
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
55
50
|
|
|
56
|
-
const
|
|
51
|
+
const transparentOptions = {
|
|
57
52
|
transparent: true
|
|
58
|
-
}
|
|
59
|
-
const
|
|
53
|
+
};
|
|
54
|
+
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
55
|
+
transparent: true,
|
|
56
|
+
...options
|
|
57
|
+
} : transparentOptions);
|
|
58
|
+
const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), {
|
|
60
59
|
transparent: true
|
|
61
60
|
}) : createMemo$1(() => fn());
|
|
62
61
|
|
|
@@ -119,16 +118,17 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
119
118
|
|
|
120
119
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
121
120
|
function render$1(code, element, init, options = {}) {
|
|
121
|
+
const renderRoot = getChildRoot(element);
|
|
122
122
|
let disposer;
|
|
123
123
|
createRoot(dispose => {
|
|
124
124
|
disposer = dispose;
|
|
125
|
-
element === document ? flatten(code) : insert(element, code(),
|
|
125
|
+
element === document ? flatten(code) : insert(element, code(), renderRoot.firstChild ? null : undefined, init);
|
|
126
126
|
}, {
|
|
127
127
|
id: options.renderId
|
|
128
128
|
});
|
|
129
129
|
return () => {
|
|
130
130
|
disposer();
|
|
131
|
-
|
|
131
|
+
renderRoot.textContent = "";
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
function create(html, bypassGuard, flag) {
|
|
@@ -265,11 +265,12 @@ function ref(fn, element) {
|
|
|
265
265
|
const resolved = untrack(fn);
|
|
266
266
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
267
267
|
}
|
|
268
|
-
function insert(parent, accessor, marker, initial) {
|
|
268
|
+
function insert(parent, accessor, marker, initial, options) {
|
|
269
|
+
const childRoot = getChildRoot(parent);
|
|
269
270
|
const multi = marker !== undefined;
|
|
270
271
|
if (multi && !initial) initial = [];
|
|
271
272
|
if (isHydrating(parent)) {
|
|
272
|
-
if (!multi && initial === undefined && parent) initial = [...
|
|
273
|
+
if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes];
|
|
273
274
|
if (Array.isArray(initial)) {
|
|
274
275
|
let j = 0;
|
|
275
276
|
for (let i = 0; i < initial.length; i++) {
|
|
@@ -285,10 +286,10 @@ function insert(parent, accessor, marker, initial) {
|
|
|
285
286
|
accessor = memo(accessor, true);
|
|
286
287
|
if (multi && initial.length === 0) {
|
|
287
288
|
const placeholder = document.createTextNode("");
|
|
288
|
-
|
|
289
|
+
childRoot.insertBefore(placeholder, marker);
|
|
289
290
|
initial = [placeholder];
|
|
290
291
|
}
|
|
291
|
-
effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker),
|
|
292
|
+
effect((prev = initial) => normalize(accessor, prev, multi), (value, current = initial) => insertExpression(parent, value, current, marker), options);
|
|
292
293
|
}
|
|
293
294
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
294
295
|
const nodeName = node.nodeName;
|
|
@@ -307,8 +308,24 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
|
307
308
|
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
308
309
|
}
|
|
309
310
|
}
|
|
311
|
+
function loadModuleAssets(mapping) {
|
|
312
|
+
const hy = globalThis._$HY;
|
|
313
|
+
if (!hy) return;
|
|
314
|
+
const pending = [];
|
|
315
|
+
for (const moduleUrl in mapping) {
|
|
316
|
+
if (hy.modules[moduleUrl]) continue;
|
|
317
|
+
const entryUrl = mapping[moduleUrl];
|
|
318
|
+
if (!hy.loading[moduleUrl]) {
|
|
319
|
+
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
320
|
+
hy.modules[moduleUrl] = mod;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
pending.push(hy.loading[moduleUrl]);
|
|
324
|
+
}
|
|
325
|
+
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
326
|
+
}
|
|
310
327
|
function hydrate$1(code, element, options = {}) {
|
|
311
|
-
if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
|
|
328
|
+
if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options);
|
|
312
329
|
options.renderId ||= "";
|
|
313
330
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
314
331
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -317,6 +334,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
317
334
|
sharedConfig.load = id => globalThis._$HY.r[id];
|
|
318
335
|
sharedConfig.has = id => id in globalThis._$HY.r;
|
|
319
336
|
sharedConfig.gather = root => gatherHydratable(element, root);
|
|
337
|
+
sharedConfig.loadModuleAssets = loadModuleAssets;
|
|
320
338
|
sharedConfig.cleanupFragment = id => {
|
|
321
339
|
const tpl = document.getElementById("pl-" + id);
|
|
322
340
|
if (tpl) {
|
|
@@ -335,9 +353,27 @@ function hydrate$1(code, element, options = {}) {
|
|
|
335
353
|
};
|
|
336
354
|
sharedConfig.registry = new Map();
|
|
337
355
|
sharedConfig.hydrating = true;
|
|
356
|
+
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
357
|
+
if (rootMapping && typeof rootMapping === "object") {
|
|
358
|
+
const p = loadModuleAssets(rootMapping);
|
|
359
|
+
if (p) {
|
|
360
|
+
gatherHydratable(element, options.renderId);
|
|
361
|
+
let disposer;
|
|
362
|
+
p.then(() => {
|
|
363
|
+
try {
|
|
364
|
+
disposer = render$1(code, element, [...getChildRoot(element).childNodes], options);
|
|
365
|
+
} finally {
|
|
366
|
+
sharedConfig.hydrating = false;
|
|
367
|
+
}
|
|
368
|
+
}, () => {
|
|
369
|
+
sharedConfig.hydrating = false;
|
|
370
|
+
});
|
|
371
|
+
return () => disposer && disposer();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
338
374
|
try {
|
|
339
375
|
gatherHydratable(element, options.renderId);
|
|
340
|
-
return render$1(code, element, [...element.childNodes], options);
|
|
376
|
+
return render$1(code, element, [...getChildRoot(element).childNodes], options);
|
|
341
377
|
} finally {
|
|
342
378
|
sharedConfig.hydrating = false;
|
|
343
379
|
}
|
|
@@ -380,7 +416,7 @@ function getNextMarker(start) {
|
|
|
380
416
|
return [end, current];
|
|
381
417
|
}
|
|
382
418
|
function getFirstChild(node, expectedTag) {
|
|
383
|
-
const child = node.firstChild;
|
|
419
|
+
const child = getChildRoot(node).firstChild;
|
|
384
420
|
return child;
|
|
385
421
|
}
|
|
386
422
|
function getNextSibling(node, expectedTag) {
|
|
@@ -413,6 +449,9 @@ function runHydrationEvents() {
|
|
|
413
449
|
function isHydrating(node) {
|
|
414
450
|
return sharedConfig.hydrating && (!node || node.isConnected);
|
|
415
451
|
}
|
|
452
|
+
function getChildRoot(node) {
|
|
453
|
+
return node && node.localName === "template" ? node.content : node;
|
|
454
|
+
}
|
|
416
455
|
function toggleClassKey(node, key, value) {
|
|
417
456
|
const classNames = key.trim().split(/\s+/);
|
|
418
457
|
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
@@ -434,7 +473,7 @@ function flattenClassList(list, result) {
|
|
|
434
473
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
435
474
|
if (prop === "style") return style(node, value, prev), value;
|
|
436
475
|
if (prop === "class") return className(node, value, prev), value;
|
|
437
|
-
if (value === prev &&
|
|
476
|
+
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
438
477
|
if (prop === "ref") {
|
|
439
478
|
if (!skipRef && value) ref(() => value, node);
|
|
440
479
|
return value;
|
|
@@ -517,21 +556,22 @@ function eventHandler(e) {
|
|
|
517
556
|
function insertExpression(parent, value, current, marker) {
|
|
518
557
|
if (isHydrating(parent)) return;
|
|
519
558
|
if (value === current) return;
|
|
559
|
+
const childRoot = getChildRoot(parent);
|
|
520
560
|
const t = typeof value,
|
|
521
561
|
multi = marker !== undefined;
|
|
522
562
|
if (t === "string" || t === "number") {
|
|
523
563
|
const tc = typeof current;
|
|
524
564
|
if (tc === "string" || tc === "number") {
|
|
525
|
-
|
|
526
|
-
} else
|
|
565
|
+
childRoot.firstChild.data = value;
|
|
566
|
+
} else childRoot.textContent = value;
|
|
527
567
|
} else if (value === undefined) {
|
|
528
568
|
cleanChildren(parent, current, marker);
|
|
529
569
|
} else if (value.nodeType) {
|
|
530
570
|
if (Array.isArray(current)) {
|
|
531
571
|
cleanChildren(parent, current, multi ? marker : null, value);
|
|
532
|
-
} else if (current === undefined || !
|
|
533
|
-
|
|
534
|
-
} else
|
|
572
|
+
} else if (current === undefined || !childRoot.firstChild) {
|
|
573
|
+
childRoot.appendChild(value);
|
|
574
|
+
} else childRoot.replaceChild(value, childRoot.firstChild);
|
|
535
575
|
} else if (Array.isArray(value)) {
|
|
536
576
|
const currentArray = current && Array.isArray(current);
|
|
537
577
|
if (value.length === 0) {
|
|
@@ -539,7 +579,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
539
579
|
} else if (currentArray) {
|
|
540
580
|
if (current.length === 0) {
|
|
541
581
|
appendNodes(parent, value, marker);
|
|
542
|
-
} else reconcileArrays(
|
|
582
|
+
} else reconcileArrays(childRoot, current, value);
|
|
543
583
|
} else {
|
|
544
584
|
current && cleanChildren(parent);
|
|
545
585
|
appendNodes(parent, value);
|
|
@@ -564,9 +604,11 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
564
604
|
return value;
|
|
565
605
|
}
|
|
566
606
|
function appendNodes(parent, array, marker = null) {
|
|
607
|
+
parent = getChildRoot(parent);
|
|
567
608
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
568
609
|
}
|
|
569
610
|
function cleanChildren(parent, current, marker, replacement) {
|
|
611
|
+
parent = getChildRoot(parent);
|
|
570
612
|
if (marker === undefined) return parent.textContent = "";
|
|
571
613
|
if (current.length) {
|
|
572
614
|
let inserted = false;
|
|
@@ -615,17 +657,33 @@ function ssrHydrationKey() {}
|
|
|
615
657
|
function resolveSSRNode(node) {}
|
|
616
658
|
function escape(html) {}
|
|
617
659
|
|
|
618
|
-
function render(...args) {
|
|
619
|
-
const result = render$1(...args);
|
|
620
|
-
return result;
|
|
621
|
-
}
|
|
622
660
|
const isServer = false;
|
|
623
661
|
const isDev = false;
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
662
|
+
function render(code, element, init, options = {}) {
|
|
663
|
+
const renderRoot = element.localName === "template" ? element.content : element;
|
|
664
|
+
let disposer;
|
|
665
|
+
createRoot(dispose => {
|
|
666
|
+
disposer = dispose;
|
|
667
|
+
if (element === document) {
|
|
668
|
+
flatten(code);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const marker = renderRoot.firstChild ? null : undefined;
|
|
672
|
+
try {
|
|
673
|
+
const tree = code();
|
|
674
|
+
insert(element, () => tree, marker, init, {
|
|
675
|
+
schedule: true
|
|
676
|
+
});
|
|
677
|
+
} finally {
|
|
678
|
+
}
|
|
679
|
+
}, {
|
|
680
|
+
id: options.renderId
|
|
628
681
|
});
|
|
682
|
+
flush();
|
|
683
|
+
return () => {
|
|
684
|
+
disposer();
|
|
685
|
+
renderRoot.textContent = "";
|
|
686
|
+
};
|
|
629
687
|
}
|
|
630
688
|
const hydrate = (...args) => {
|
|
631
689
|
enableHydration();
|
|
@@ -651,6 +709,29 @@ function Portal(props) {
|
|
|
651
709
|
});
|
|
652
710
|
return treeMarker;
|
|
653
711
|
}
|
|
712
|
+
function createDynamic(component, props) {
|
|
713
|
+
const cached = createMemo$1(component);
|
|
714
|
+
return createMemo$1(() => {
|
|
715
|
+
const component = cached();
|
|
716
|
+
switch (typeof component) {
|
|
717
|
+
case "function":
|
|
718
|
+
return untrack(() => component(props));
|
|
719
|
+
case "string":
|
|
720
|
+
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
|
|
721
|
+
spread(el, props);
|
|
722
|
+
return el;
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
function Dynamic(props) {
|
|
727
|
+
const others = omit(props, "component");
|
|
728
|
+
return createDynamic(() => props.component, others);
|
|
729
|
+
}
|
|
730
|
+
function createElement(tagName, is = undefined) {
|
|
731
|
+
return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
|
|
732
|
+
is
|
|
733
|
+
});
|
|
734
|
+
}
|
|
654
735
|
function createElementProxy(el, marker) {
|
|
655
736
|
return new Proxy(el, {
|
|
656
737
|
get(target, prop) {
|
|
@@ -668,24 +749,5 @@ function createElementProxy(el, marker) {
|
|
|
668
749
|
}
|
|
669
750
|
});
|
|
670
751
|
}
|
|
671
|
-
function createDynamic(component, props) {
|
|
672
|
-
const cached = createMemo$1(component);
|
|
673
|
-
return createMemo$1(() => {
|
|
674
|
-
const component = cached();
|
|
675
|
-
switch (typeof component) {
|
|
676
|
-
case "function":
|
|
677
|
-
return untrack(() => component(props));
|
|
678
|
-
case "string":
|
|
679
|
-
const isSvg = SVGElements.has(component);
|
|
680
|
-
const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
|
|
681
|
-
spread(el, props, isSvg);
|
|
682
|
-
return el;
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
function Dynamic(props) {
|
|
687
|
-
const others = omit(props, "component");
|
|
688
|
-
return createDynamic(() => props.component, others);
|
|
689
|
-
}
|
|
690
752
|
|
|
691
753
|
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, 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-beta.
|
|
4
|
+
"version": "2.0.0-beta.8",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -21,53 +21,94 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
23
|
"types",
|
|
24
|
+
"types-cjs",
|
|
24
25
|
"package.json",
|
|
25
26
|
"storage/dist",
|
|
26
27
|
"storage/types",
|
|
28
|
+
"storage/types-cjs",
|
|
27
29
|
"storage/package.json"
|
|
28
30
|
],
|
|
29
31
|
"exports": {
|
|
30
32
|
".": {
|
|
31
33
|
"worker": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./types/index.d.ts",
|
|
36
|
+
"default": "./dist/server.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./types-cjs/index.d.cts",
|
|
40
|
+
"default": "./dist/server.cjs"
|
|
41
|
+
}
|
|
35
42
|
},
|
|
36
43
|
"browser": {
|
|
37
44
|
"development": {
|
|
45
|
+
"import": {
|
|
46
|
+
"types": "./types/index.d.ts",
|
|
47
|
+
"default": "./dist/dev.js"
|
|
48
|
+
},
|
|
49
|
+
"require": {
|
|
50
|
+
"types": "./types-cjs/index.d.cts",
|
|
51
|
+
"default": "./dist/dev.cjs"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"import": {
|
|
38
55
|
"types": "./types/index.d.ts",
|
|
39
|
-
"
|
|
40
|
-
"require": "./dist/dev.cjs"
|
|
56
|
+
"default": "./dist/web.js"
|
|
41
57
|
},
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./types-cjs/index.d.cts",
|
|
60
|
+
"default": "./dist/web.cjs"
|
|
61
|
+
}
|
|
45
62
|
},
|
|
46
63
|
"deno": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./types/index.d.ts",
|
|
66
|
+
"default": "./dist/server.js"
|
|
67
|
+
},
|
|
68
|
+
"require": {
|
|
69
|
+
"types": "./types-cjs/index.d.cts",
|
|
70
|
+
"default": "./dist/server.cjs"
|
|
71
|
+
}
|
|
50
72
|
},
|
|
51
73
|
"node": {
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
"import": {
|
|
75
|
+
"types": "./types/index.d.ts",
|
|
76
|
+
"default": "./dist/server.js"
|
|
77
|
+
},
|
|
78
|
+
"require": {
|
|
79
|
+
"types": "./types-cjs/index.d.cts",
|
|
80
|
+
"default": "./dist/server.cjs"
|
|
81
|
+
}
|
|
55
82
|
},
|
|
56
83
|
"development": {
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./types/index.d.ts",
|
|
86
|
+
"default": "./dist/dev.js"
|
|
87
|
+
},
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./types-cjs/index.d.cts",
|
|
90
|
+
"default": "./dist/dev.cjs"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"import": {
|
|
57
94
|
"types": "./types/index.d.ts",
|
|
58
|
-
"
|
|
59
|
-
"require": "./dist/dev.cjs"
|
|
95
|
+
"default": "./dist/web.js"
|
|
60
96
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
97
|
+
"require": {
|
|
98
|
+
"types": "./types-cjs/index.d.cts",
|
|
99
|
+
"default": "./dist/web.cjs"
|
|
100
|
+
}
|
|
64
101
|
},
|
|
65
102
|
"./storage": {
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
103
|
+
"import": {
|
|
104
|
+
"types": "./storage/types/index.d.ts",
|
|
105
|
+
"default": "./storage/dist/storage.js"
|
|
106
|
+
},
|
|
107
|
+
"require": {
|
|
108
|
+
"types": "./storage/types-cjs/index.d.cts",
|
|
109
|
+
"default": "./storage/dist/storage.cjs"
|
|
110
|
+
}
|
|
69
111
|
},
|
|
70
|
-
"./dist/*": "./dist/*",
|
|
71
112
|
"./types/*": "./types/*"
|
|
72
113
|
},
|
|
73
114
|
"dependencies": {
|
|
@@ -75,23 +116,24 @@
|
|
|
75
116
|
"seroval-plugins": "^1.1.0"
|
|
76
117
|
},
|
|
77
118
|
"peerDependencies": {
|
|
78
|
-
"@solidjs/signals": "^0.
|
|
79
|
-
"solid-js": "^2.0.0-beta.
|
|
119
|
+
"@solidjs/signals": "^2.0.0-beta.8",
|
|
120
|
+
"solid-js": "^2.0.0-beta.8"
|
|
80
121
|
},
|
|
81
122
|
"devDependencies": {
|
|
82
|
-
"@solidjs/signals": "
|
|
83
|
-
"solid-js": "2.0.0-beta.
|
|
123
|
+
"@solidjs/signals": "2.0.0-beta.8",
|
|
124
|
+
"solid-js": "2.0.0-beta.8"
|
|
84
125
|
},
|
|
85
126
|
"scripts": {
|
|
86
127
|
"build": "npm-run-all -nl build:*",
|
|
87
128
|
"build:clean": "rimraf dist/",
|
|
88
129
|
"build:js": "rollup -c",
|
|
89
130
|
"link": "symlink-dir . node_modules/@solidjs/web",
|
|
90
|
-
"types": "npm-run-all -nl types
|
|
91
|
-
"types:clean": "rimraf types/",
|
|
131
|
+
"types": "npm-run-all -nl types:clean types:web types:copy-web types:web-storage types:cjs",
|
|
132
|
+
"types:clean": "rimraf types/ types-cjs/ storage/types-cjs/",
|
|
92
133
|
"types:web": "tsc --project ./tsconfig.build.json",
|
|
93
134
|
"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",
|
|
94
135
|
"types:web-storage": "tsc --project ./storage/tsconfig.build.json",
|
|
136
|
+
"types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs ./storage/types ./storage/types-cjs",
|
|
95
137
|
"test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
|
|
96
138
|
"test:server": "vitest run --config vite.config.server.mjs",
|
|
97
139
|
"coverage": "vitest run --coverage",
|
package/storage/package.json
CHANGED
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./types/index.d.ts",
|
|
12
|
+
"default": "./dist/storage.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./types-cjs/index.d.cts",
|
|
16
|
+
"default": "./dist/storage.cjs"
|
|
17
|
+
}
|
|
13
18
|
}
|
|
14
19
|
}
|
|
15
20
|
}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import { hydrate as hydrateCore
|
|
1
|
+
import { hydrate as hydrateCore } from "./client.js";
|
|
2
2
|
import { JSX, ComponentProps, ValidComponent } from "solid-js";
|
|
3
3
|
export * from "./client.js";
|
|
4
|
-
export declare function render(...args: Parameters<typeof renderCore>): ReturnType<typeof renderCore>;
|
|
5
|
-
export { For, Show, Switch, Match, Errored, Loading, Reveal, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
6
4
|
export * from "./server-mock.js";
|
|
5
|
+
export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
7
6
|
export declare const isServer: boolean;
|
|
8
7
|
export declare const isDev: boolean;
|
|
8
|
+
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
9
|
+
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
10
|
+
[K in keyof P]: P[K];
|
|
11
|
+
} & {
|
|
12
|
+
component: T | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Renders a component tree into a DOM element and returns a dispose function.
|
|
16
|
+
*
|
|
17
|
+
* The top-level insert runs with `schedule: true` so its initial DOM attach
|
|
18
|
+
* goes through the effect queue rather than executing inline. This lets the
|
|
19
|
+
* mount participate in transitions: if an uncaught async read surfaces during
|
|
20
|
+
* the initial render (no `Loading` ancestor absorbs it), the mount is held by
|
|
21
|
+
* the transition and attaches atomically once all pending settles. On the
|
|
22
|
+
* no-async happy path the tail `flush()` drains the queued callback so the
|
|
23
|
+
* attach is synchronous by the time `render()` returns.
|
|
24
|
+
*/
|
|
25
|
+
export declare function render(code: () => JSX.Element, element: MountableElement, init?: unknown, options?: {
|
|
26
|
+
renderId?: string;
|
|
27
|
+
}): () => void;
|
|
9
28
|
export declare const hydrate: typeof hydrateCore;
|
|
10
29
|
/**
|
|
11
30
|
* Renders components somewhere else in the DOM
|
|
@@ -18,11 +37,6 @@ export declare function Portal<T extends boolean = false, S extends boolean = fa
|
|
|
18
37
|
mount?: Element;
|
|
19
38
|
children: JSX.Element;
|
|
20
39
|
}): Text;
|
|
21
|
-
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
22
|
-
[K in keyof P]: P[K];
|
|
23
|
-
} & {
|
|
24
|
-
component: T | undefined;
|
|
25
|
-
};
|
|
26
40
|
/**
|
|
27
41
|
* Renders an arbitrary component or element with the given props
|
|
28
42
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "dom-expressions/src/client.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { hydrate as hydrateCore } from "./client.cjs";
|
|
2
|
+
import { JSX, ComponentProps, ValidComponent } from "solid-js";
|
|
3
|
+
export * from "./client.cjs";
|
|
4
|
+
export * from "./server-mock.cjs";
|
|
5
|
+
export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
6
|
+
export declare const isServer: boolean;
|
|
7
|
+
export declare const isDev: boolean;
|
|
8
|
+
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
9
|
+
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
10
|
+
[K in keyof P]: P[K];
|
|
11
|
+
} & {
|
|
12
|
+
component: T | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Renders a component tree into a DOM element and returns a dispose function.
|
|
16
|
+
*
|
|
17
|
+
* The top-level insert runs with `schedule: true` so its initial DOM attach
|
|
18
|
+
* goes through the effect queue rather than executing inline. This lets the
|
|
19
|
+
* mount participate in transitions: if an uncaught async read surfaces during
|
|
20
|
+
* the initial render (no `Loading` ancestor absorbs it), the mount is held by
|
|
21
|
+
* the transition and attaches atomically once all pending settles. On the
|
|
22
|
+
* no-async happy path the tail `flush()` drains the queued callback so the
|
|
23
|
+
* attach is synchronous by the time `render()` returns.
|
|
24
|
+
*/
|
|
25
|
+
export declare function render(code: () => JSX.Element, element: MountableElement, init?: unknown, options?: {
|
|
26
|
+
renderId?: string;
|
|
27
|
+
}): () => void;
|
|
28
|
+
export declare const hydrate: typeof hydrateCore;
|
|
29
|
+
/**
|
|
30
|
+
* Renders components somewhere else in the DOM
|
|
31
|
+
*
|
|
32
|
+
* Useful for inserting modals and tooltips outside of an cropping layout. If no mount point is given, the portal is inserted in document.body; it is wrapped in a `<div>` unless the target is document.head or `isSVG` is true. setting `useShadow` to true places the element in a shadow root to isolate styles.
|
|
33
|
+
*
|
|
34
|
+
* @description https://docs.solidjs.com/reference/components/portal
|
|
35
|
+
*/
|
|
36
|
+
export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
|
|
37
|
+
mount?: Element;
|
|
38
|
+
children: JSX.Element;
|
|
39
|
+
}): Text;
|
|
40
|
+
/**
|
|
41
|
+
* Renders an arbitrary component or element with the given props
|
|
42
|
+
*
|
|
43
|
+
* This is a lower level version of the `Dynamic` component, useful for
|
|
44
|
+
* performance optimizations in libraries. Do not use this unless you know
|
|
45
|
+
* what you are doing.
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const element = () => multiline() ? 'textarea' : 'input';
|
|
48
|
+
* createDynamic(element, { value: value() });
|
|
49
|
+
* ```
|
|
50
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
51
|
+
*/
|
|
52
|
+
export declare function createDynamic<T extends ValidComponent>(component: () => T | undefined, props: ComponentProps<T>): JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* Renders an arbitrary custom or native component and passes the other props
|
|
55
|
+
* ```typescript
|
|
56
|
+
* <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
|
|
57
|
+
* ```
|
|
58
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
59
|
+
*/
|
|
60
|
+
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|