@solidjs/web 2.0.0-beta.28 → 2.0.0-beta.29
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 +40 -2
- package/dist/dev.js +39 -4
- package/dist/server.cjs +90 -31
- package/dist/server.js +89 -33
- package/dist/web.cjs +40 -2
- package/dist/web.js +39 -4
- package/frames/dist/client.cjs +370 -209
- package/frames/dist/client.dev.cjs +370 -210
- package/frames/dist/client.dev.js +371 -211
- package/frames/dist/client.js +371 -210
- package/frames/dist/server.cjs +351 -69
- package/frames/dist/server.js +351 -70
- package/package.json +3 -3
- package/server-functions/dist/client.cjs +87 -3
- package/server-functions/dist/client.js +80 -4
- package/server-functions/dist/server.cjs +52 -17
- package/server-functions/dist/server.js +51 -17
- package/types/client.d.ts +15 -0
- package/types/core.d.ts +1 -1
- package/types/frames/client.d.ts +7 -5
- package/types/frames/frame-client.d.ts +17 -0
- package/types/frames/frame-sink.d.ts +29 -6
- package/types/frames/frame-transport.d.ts +76 -12
- package/types/frames/server.d.ts +1 -1
- package/types/index.d.ts +74 -0
- package/types/server-functions/client.d.ts +24 -0
- package/types/server-functions/server.d.ts +75 -16
- package/types/server-functions/shared.d.ts +9 -0
- package/types/server-mock.d.ts +6 -2
- package/types/server.d.ts +39 -1
- package/types-cjs/client.d.cts +15 -0
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/frames/client.d.cts +7 -5
- package/types-cjs/frames/frame-client.d.cts +17 -0
- package/types-cjs/frames/frame-sink.d.cts +29 -6
- package/types-cjs/frames/frame-transport.d.cts +76 -12
- package/types-cjs/frames/server.d.cts +1 -1
- package/types-cjs/index.d.cts +74 -0
- package/types-cjs/server-functions/client.d.cts +24 -0
- package/types-cjs/server-functions/server.d.cts +75 -16
- package/types-cjs/server-functions/shared.d.cts +9 -0
- package/types-cjs/server-mock.d.cts +6 -2
- package/types-cjs/server.d.cts +39 -1
package/dist/dev.cjs
CHANGED
|
@@ -885,7 +885,15 @@ function runHydrationEvents() {
|
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
887
|
function isHydrating(node) {
|
|
888
|
-
|
|
888
|
+
if (!solidJs.sharedConfig.hydrating) return false;
|
|
889
|
+
if (!node || node.isConnected) return true;
|
|
890
|
+
const roots = solidJs.sharedConfig.claimRoots;
|
|
891
|
+
if (roots) {
|
|
892
|
+
for (let i = 0; i < roots.length; i++) {
|
|
893
|
+
if (roots[i].contains(node)) return true;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return false;
|
|
889
897
|
}
|
|
890
898
|
function classListToObject(classList) {
|
|
891
899
|
if (Array.isArray(classList)) {
|
|
@@ -934,7 +942,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
934
942
|
}
|
|
935
943
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
936
944
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
937
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
945
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
946
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
938
947
|
} else {
|
|
939
948
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
940
949
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1331,6 +1340,32 @@ function createElement(tagName, is = undefined) {
|
|
|
1331
1340
|
is
|
|
1332
1341
|
});
|
|
1333
1342
|
}
|
|
1343
|
+
function loadClientOnly(fn, setComp) {
|
|
1344
|
+
fn().then(m => setComp(() => m.default));
|
|
1345
|
+
}
|
|
1346
|
+
function clientOnly(fn, options = {}) {
|
|
1347
|
+
const [comp, setComp] = solidJs.createSignal();
|
|
1348
|
+
let started = !options.lazy;
|
|
1349
|
+
started && loadClientOnly(fn, setComp);
|
|
1350
|
+
return props => {
|
|
1351
|
+
let Comp;
|
|
1352
|
+
let m;
|
|
1353
|
+
const rest = solidJs.omit(props, "fallback");
|
|
1354
|
+
if (!started) {
|
|
1355
|
+
started = true;
|
|
1356
|
+
loadClientOnly(fn, setComp);
|
|
1357
|
+
}
|
|
1358
|
+
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1359
|
+
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1360
|
+
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1361
|
+
solidJs.onSettled(() => {
|
|
1362
|
+
setMounted(true);
|
|
1363
|
+
});
|
|
1364
|
+
return gate;
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function httpStatus(_code, _text) {}
|
|
1368
|
+
function httpHeader(_name, _value, _options) {}
|
|
1334
1369
|
|
|
1335
1370
|
Object.defineProperty(exports, "Errored", {
|
|
1336
1371
|
enumerable: true,
|
|
@@ -1408,6 +1443,7 @@ exports.assign = assign;
|
|
|
1408
1443
|
exports.claimElement = claimElement;
|
|
1409
1444
|
exports.claimElementTree = claimElementTree;
|
|
1410
1445
|
exports.className = className;
|
|
1446
|
+
exports.clientOnly = clientOnly;
|
|
1411
1447
|
exports.delegateEvents = delegateEvents;
|
|
1412
1448
|
exports.dynamic = dynamic;
|
|
1413
1449
|
exports.dynamicProperty = dynamicProperty;
|
|
@@ -1423,6 +1459,8 @@ exports.getNextMarker = getNextMarker;
|
|
|
1423
1459
|
exports.getNextMatch = getNextMatch;
|
|
1424
1460
|
exports.getNextSibling = getNextSibling;
|
|
1425
1461
|
exports.getRequestEvent = voidFn;
|
|
1462
|
+
exports.httpHeader = httpHeader;
|
|
1463
|
+
exports.httpStatus = httpStatus;
|
|
1426
1464
|
exports.hydrate = hydrate;
|
|
1427
1465
|
exports.insert = insert;
|
|
1428
1466
|
exports.installHydrationRuntime = installHydrationRuntime;
|
package/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onSettled, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } 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 = {
|
|
@@ -884,7 +884,15 @@ function runHydrationEvents() {
|
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
function isHydrating(node) {
|
|
887
|
-
|
|
887
|
+
if (!sharedConfig.hydrating) return false;
|
|
888
|
+
if (!node || node.isConnected) return true;
|
|
889
|
+
const roots = sharedConfig.claimRoots;
|
|
890
|
+
if (roots) {
|
|
891
|
+
for (let i = 0; i < roots.length; i++) {
|
|
892
|
+
if (roots[i].contains(node)) return true;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return false;
|
|
888
896
|
}
|
|
889
897
|
function classListToObject(classList) {
|
|
890
898
|
if (Array.isArray(classList)) {
|
|
@@ -933,7 +941,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
933
941
|
}
|
|
934
942
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
935
943
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
936
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
944
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
945
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
937
946
|
} else {
|
|
938
947
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
939
948
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1330,5 +1339,31 @@ function createElement(tagName, is = undefined) {
|
|
|
1330
1339
|
is
|
|
1331
1340
|
});
|
|
1332
1341
|
}
|
|
1342
|
+
function loadClientOnly(fn, setComp) {
|
|
1343
|
+
fn().then(m => setComp(() => m.default));
|
|
1344
|
+
}
|
|
1345
|
+
function clientOnly(fn, options = {}) {
|
|
1346
|
+
const [comp, setComp] = createSignal();
|
|
1347
|
+
let started = !options.lazy;
|
|
1348
|
+
started && loadClientOnly(fn, setComp);
|
|
1349
|
+
return props => {
|
|
1350
|
+
let Comp;
|
|
1351
|
+
let m;
|
|
1352
|
+
const rest = omit(props, "fallback");
|
|
1353
|
+
if (!started) {
|
|
1354
|
+
started = true;
|
|
1355
|
+
loadClientOnly(fn, setComp);
|
|
1356
|
+
}
|
|
1357
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1358
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1359
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1360
|
+
onSettled(() => {
|
|
1361
|
+
setMounted(true);
|
|
1362
|
+
});
|
|
1363
|
+
return gate;
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function httpStatus(_code, _text) {}
|
|
1367
|
+
function httpHeader(_name, _value, _options) {}
|
|
1333
1368
|
|
|
1334
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1369
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clientOnly, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -679,6 +679,51 @@ function renderToStream(code, options = {}) {
|
|
|
679
679
|
drainTurn = 0;
|
|
680
680
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
681
681
|
};
|
|
682
|
+
let cachedReadable;
|
|
683
|
+
let consumer;
|
|
684
|
+
const claimConsumer = name => {
|
|
685
|
+
if (consumer && consumer !== name) {
|
|
686
|
+
throw new Error(`renderToStream result was already consumed via \`${consumer}\`; cannot also consume it via \`${name}\`. Use exactly one of \`pipe\`, \`pipeTo\`, or \`readable\`.`);
|
|
687
|
+
}
|
|
688
|
+
consumer = name;
|
|
689
|
+
};
|
|
690
|
+
const pipeToImpl = w => {
|
|
691
|
+
let resolve;
|
|
692
|
+
const p = new Promise(r => resolve = r);
|
|
693
|
+
function flush() {
|
|
694
|
+
allSettled(blockingPromises).then(() => {
|
|
695
|
+
scheduleFlush(() => {
|
|
696
|
+
doShell();
|
|
697
|
+
if (!shellCompleted) return flush();
|
|
698
|
+
const encoder = new TextEncoder();
|
|
699
|
+
const writer = w.getWriter();
|
|
700
|
+
let pendingWrites = Promise.resolve();
|
|
701
|
+
writable = {
|
|
702
|
+
end() {
|
|
703
|
+
pendingWrites.then(() => {
|
|
704
|
+
writer.releaseLock();
|
|
705
|
+
w.close().catch(() => {});
|
|
706
|
+
resolve();
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
buffer = {
|
|
711
|
+
write(payload) {
|
|
712
|
+
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(() => {});
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
buffer.write(tmp);
|
|
716
|
+
firstFlushed = true;
|
|
717
|
+
if (completed) {
|
|
718
|
+
dispose();
|
|
719
|
+
writable.end();
|
|
720
|
+
} else flushEnd();
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
flush();
|
|
725
|
+
return p;
|
|
726
|
+
};
|
|
682
727
|
return {
|
|
683
728
|
then(fn) {
|
|
684
729
|
function complete() {
|
|
@@ -703,6 +748,7 @@ function renderToStream(code, options = {}) {
|
|
|
703
748
|
flush();
|
|
704
749
|
},
|
|
705
750
|
pipe(w) {
|
|
751
|
+
claimConsumer("pipe");
|
|
706
752
|
function flush() {
|
|
707
753
|
allSettled(blockingPromises).then(() => {
|
|
708
754
|
scheduleFlush(() => {
|
|
@@ -721,38 +767,17 @@ function renderToStream(code, options = {}) {
|
|
|
721
767
|
flush();
|
|
722
768
|
},
|
|
723
769
|
pipeTo(w) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
writable = {
|
|
734
|
-
end() {
|
|
735
|
-
writer.releaseLock();
|
|
736
|
-
w.close().catch(() => {});
|
|
737
|
-
resolve();
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
buffer = {
|
|
741
|
-
write(payload) {
|
|
742
|
-
writer.write(encoder.encode(payload)).catch(() => {});
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
buffer.write(tmp);
|
|
746
|
-
firstFlushed = true;
|
|
747
|
-
if (completed) {
|
|
748
|
-
dispose();
|
|
749
|
-
writable.end();
|
|
750
|
-
} else flushEnd();
|
|
751
|
-
});
|
|
752
|
-
});
|
|
770
|
+
claimConsumer("pipeTo");
|
|
771
|
+
return pipeToImpl(w);
|
|
772
|
+
},
|
|
773
|
+
get readable() {
|
|
774
|
+
claimConsumer("readable");
|
|
775
|
+
if (!cachedReadable) {
|
|
776
|
+
const t = new TransformStream();
|
|
777
|
+
pipeToImpl(t.writable);
|
|
778
|
+
cachedReadable = t.readable;
|
|
753
779
|
}
|
|
754
|
-
|
|
755
|
-
return p;
|
|
780
|
+
return cachedReadable;
|
|
756
781
|
}
|
|
757
782
|
};
|
|
758
783
|
}
|
|
@@ -1443,6 +1468,37 @@ function Portal(props) {
|
|
|
1443
1468
|
if (o?.id != null) solidJs.getNextChildId(o);
|
|
1444
1469
|
return undefined;
|
|
1445
1470
|
}
|
|
1471
|
+
function clientOnly(_fn, _options = {}) {
|
|
1472
|
+
return props => solidJs.createMemo(() => props.fallback);
|
|
1473
|
+
}
|
|
1474
|
+
function httpStatus(code, text) {
|
|
1475
|
+
const event = getRequestEvent();
|
|
1476
|
+
const response = event && event.response;
|
|
1477
|
+
if (response && !response.committed) {
|
|
1478
|
+
const prevStatus = response.status;
|
|
1479
|
+
const prevStatusText = response.statusText;
|
|
1480
|
+
response.status = code;
|
|
1481
|
+
response.statusText = text;
|
|
1482
|
+
solidJs.onCleanup(() => {
|
|
1483
|
+
if (response.committed) return;
|
|
1484
|
+
response.status = prevStatus;
|
|
1485
|
+
response.statusText = prevStatusText;
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
function httpHeader(name, value, options) {
|
|
1490
|
+
const event = getRequestEvent();
|
|
1491
|
+
const response = event && event.response;
|
|
1492
|
+
if (response && !response.committed) {
|
|
1493
|
+
const headers = response.headers;
|
|
1494
|
+
const prev = headers.get(name);
|
|
1495
|
+
if (options && options.append) headers.append(name, value);else headers.set(name, value);
|
|
1496
|
+
solidJs.onCleanup(() => {
|
|
1497
|
+
if (response.committed) return;
|
|
1498
|
+
if (prev === null) headers.delete(name);else headers.set(name, prev);
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1446
1502
|
|
|
1447
1503
|
Object.defineProperty(exports, "Errored", {
|
|
1448
1504
|
enumerable: true,
|
|
@@ -1528,6 +1584,7 @@ exports.assign = notSup;
|
|
|
1528
1584
|
exports.claimElement = claimElement;
|
|
1529
1585
|
exports.claimElementTree = claimElementTree;
|
|
1530
1586
|
exports.className = notSup;
|
|
1587
|
+
exports.clientOnly = clientOnly;
|
|
1531
1588
|
exports.delegateEvents = notSup;
|
|
1532
1589
|
exports.dynamic = dynamic;
|
|
1533
1590
|
exports.dynamicProperty = notSup;
|
|
@@ -1541,6 +1598,8 @@ exports.getNextElement = notSup;
|
|
|
1541
1598
|
exports.getNextMarker = notSup;
|
|
1542
1599
|
exports.getNextMatch = notSup;
|
|
1543
1600
|
exports.getRequestEvent = getRequestEvent;
|
|
1601
|
+
exports.httpHeader = httpHeader;
|
|
1602
|
+
exports.httpStatus = httpStatus;
|
|
1544
1603
|
exports.hydrate = notSup;
|
|
1545
1604
|
exports.insert = notSup;
|
|
1546
1605
|
exports.isDev = isDev;
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, getOwner, runWithOwner, createComponent, omit, getNextChildId, onCleanup } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, ssrScope as scope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
@@ -678,6 +678,51 @@ function renderToStream(code, options = {}) {
|
|
|
678
678
|
drainTurn = 0;
|
|
679
679
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
680
680
|
};
|
|
681
|
+
let cachedReadable;
|
|
682
|
+
let consumer;
|
|
683
|
+
const claimConsumer = name => {
|
|
684
|
+
if (consumer && consumer !== name) {
|
|
685
|
+
throw new Error(`renderToStream result was already consumed via \`${consumer}\`; cannot also consume it via \`${name}\`. Use exactly one of \`pipe\`, \`pipeTo\`, or \`readable\`.`);
|
|
686
|
+
}
|
|
687
|
+
consumer = name;
|
|
688
|
+
};
|
|
689
|
+
const pipeToImpl = w => {
|
|
690
|
+
let resolve;
|
|
691
|
+
const p = new Promise(r => resolve = r);
|
|
692
|
+
function flush() {
|
|
693
|
+
allSettled(blockingPromises).then(() => {
|
|
694
|
+
scheduleFlush(() => {
|
|
695
|
+
doShell();
|
|
696
|
+
if (!shellCompleted) return flush();
|
|
697
|
+
const encoder = new TextEncoder();
|
|
698
|
+
const writer = w.getWriter();
|
|
699
|
+
let pendingWrites = Promise.resolve();
|
|
700
|
+
writable = {
|
|
701
|
+
end() {
|
|
702
|
+
pendingWrites.then(() => {
|
|
703
|
+
writer.releaseLock();
|
|
704
|
+
w.close().catch(() => {});
|
|
705
|
+
resolve();
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
buffer = {
|
|
710
|
+
write(payload) {
|
|
711
|
+
pendingWrites = pendingWrites.then(() => writer.write(encoder.encode(payload))).catch(() => {});
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
buffer.write(tmp);
|
|
715
|
+
firstFlushed = true;
|
|
716
|
+
if (completed) {
|
|
717
|
+
dispose();
|
|
718
|
+
writable.end();
|
|
719
|
+
} else flushEnd();
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
flush();
|
|
724
|
+
return p;
|
|
725
|
+
};
|
|
681
726
|
return {
|
|
682
727
|
then(fn) {
|
|
683
728
|
function complete() {
|
|
@@ -702,6 +747,7 @@ function renderToStream(code, options = {}) {
|
|
|
702
747
|
flush();
|
|
703
748
|
},
|
|
704
749
|
pipe(w) {
|
|
750
|
+
claimConsumer("pipe");
|
|
705
751
|
function flush() {
|
|
706
752
|
allSettled(blockingPromises).then(() => {
|
|
707
753
|
scheduleFlush(() => {
|
|
@@ -720,38 +766,17 @@ function renderToStream(code, options = {}) {
|
|
|
720
766
|
flush();
|
|
721
767
|
},
|
|
722
768
|
pipeTo(w) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
writable = {
|
|
733
|
-
end() {
|
|
734
|
-
writer.releaseLock();
|
|
735
|
-
w.close().catch(() => {});
|
|
736
|
-
resolve();
|
|
737
|
-
}
|
|
738
|
-
};
|
|
739
|
-
buffer = {
|
|
740
|
-
write(payload) {
|
|
741
|
-
writer.write(encoder.encode(payload)).catch(() => {});
|
|
742
|
-
}
|
|
743
|
-
};
|
|
744
|
-
buffer.write(tmp);
|
|
745
|
-
firstFlushed = true;
|
|
746
|
-
if (completed) {
|
|
747
|
-
dispose();
|
|
748
|
-
writable.end();
|
|
749
|
-
} else flushEnd();
|
|
750
|
-
});
|
|
751
|
-
});
|
|
769
|
+
claimConsumer("pipeTo");
|
|
770
|
+
return pipeToImpl(w);
|
|
771
|
+
},
|
|
772
|
+
get readable() {
|
|
773
|
+
claimConsumer("readable");
|
|
774
|
+
if (!cachedReadable) {
|
|
775
|
+
const t = new TransformStream();
|
|
776
|
+
pipeToImpl(t.writable);
|
|
777
|
+
cachedReadable = t.readable;
|
|
752
778
|
}
|
|
753
|
-
|
|
754
|
-
return p;
|
|
779
|
+
return cachedReadable;
|
|
755
780
|
}
|
|
756
781
|
};
|
|
757
782
|
}
|
|
@@ -1442,5 +1467,36 @@ function Portal(props) {
|
|
|
1442
1467
|
if (o?.id != null) getNextChildId(o);
|
|
1443
1468
|
return undefined;
|
|
1444
1469
|
}
|
|
1470
|
+
function clientOnly(_fn, _options = {}) {
|
|
1471
|
+
return props => createMemo(() => props.fallback);
|
|
1472
|
+
}
|
|
1473
|
+
function httpStatus(code, text) {
|
|
1474
|
+
const event = getRequestEvent();
|
|
1475
|
+
const response = event && event.response;
|
|
1476
|
+
if (response && !response.committed) {
|
|
1477
|
+
const prevStatus = response.status;
|
|
1478
|
+
const prevStatusText = response.statusText;
|
|
1479
|
+
response.status = code;
|
|
1480
|
+
response.statusText = text;
|
|
1481
|
+
onCleanup(() => {
|
|
1482
|
+
if (response.committed) return;
|
|
1483
|
+
response.status = prevStatus;
|
|
1484
|
+
response.statusText = prevStatusText;
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
function httpHeader(name, value, options) {
|
|
1489
|
+
const event = getRequestEvent();
|
|
1490
|
+
const response = event && event.response;
|
|
1491
|
+
if (response && !response.committed) {
|
|
1492
|
+
const headers = response.headers;
|
|
1493
|
+
const prev = headers.get(name);
|
|
1494
|
+
if (options && options.append) headers.append(name, value);else headers.set(name, value);
|
|
1495
|
+
onCleanup(() => {
|
|
1496
|
+
if (response.committed) return;
|
|
1497
|
+
if (prev === null) headers.delete(name);else headers.set(name, prev);
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1445
1501
|
|
|
1446
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, 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, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, 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 };
|
|
1502
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clientOnly, 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, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, renderToStringAsync, respond, 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 };
|
package/dist/web.cjs
CHANGED
|
@@ -828,7 +828,15 @@ function runHydrationEvents() {
|
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
function isHydrating(node) {
|
|
831
|
-
|
|
831
|
+
if (!solidJs.sharedConfig.hydrating) return false;
|
|
832
|
+
if (!node || node.isConnected) return true;
|
|
833
|
+
const roots = solidJs.sharedConfig.claimRoots;
|
|
834
|
+
if (roots) {
|
|
835
|
+
for (let i = 0; i < roots.length; i++) {
|
|
836
|
+
if (roots[i].contains(node)) return true;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return false;
|
|
832
840
|
}
|
|
833
841
|
function classListToObject(classList) {
|
|
834
842
|
if (Array.isArray(classList)) {
|
|
@@ -877,7 +885,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
877
885
|
}
|
|
878
886
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
879
887
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
880
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
888
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
889
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
881
890
|
} else {
|
|
882
891
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
883
892
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1269,6 +1278,32 @@ function createElement(tagName, is = undefined) {
|
|
|
1269
1278
|
is
|
|
1270
1279
|
});
|
|
1271
1280
|
}
|
|
1281
|
+
function loadClientOnly(fn, setComp) {
|
|
1282
|
+
fn().then(m => setComp(() => m.default));
|
|
1283
|
+
}
|
|
1284
|
+
function clientOnly(fn, options = {}) {
|
|
1285
|
+
const [comp, setComp] = solidJs.createSignal();
|
|
1286
|
+
let started = !options.lazy;
|
|
1287
|
+
started && loadClientOnly(fn, setComp);
|
|
1288
|
+
return props => {
|
|
1289
|
+
let Comp;
|
|
1290
|
+
let m;
|
|
1291
|
+
const rest = solidJs.omit(props, "fallback");
|
|
1292
|
+
if (!started) {
|
|
1293
|
+
started = true;
|
|
1294
|
+
loadClientOnly(fn, setComp);
|
|
1295
|
+
}
|
|
1296
|
+
if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
|
|
1297
|
+
const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
|
|
1298
|
+
const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1299
|
+
solidJs.onSettled(() => {
|
|
1300
|
+
setMounted(true);
|
|
1301
|
+
});
|
|
1302
|
+
return gate;
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
function httpStatus(_code, _text) {}
|
|
1306
|
+
function httpHeader(_name, _value, _options) {}
|
|
1272
1307
|
|
|
1273
1308
|
Object.defineProperty(exports, "Errored", {
|
|
1274
1309
|
enumerable: true,
|
|
@@ -1346,6 +1381,7 @@ exports.assign = assign;
|
|
|
1346
1381
|
exports.claimElement = claimElement;
|
|
1347
1382
|
exports.claimElementTree = claimElementTree;
|
|
1348
1383
|
exports.className = className;
|
|
1384
|
+
exports.clientOnly = clientOnly;
|
|
1349
1385
|
exports.delegateEvents = delegateEvents;
|
|
1350
1386
|
exports.dynamic = dynamic;
|
|
1351
1387
|
exports.dynamicProperty = dynamicProperty;
|
|
@@ -1361,6 +1397,8 @@ exports.getNextMarker = getNextMarker;
|
|
|
1361
1397
|
exports.getNextMatch = getNextMatch;
|
|
1362
1398
|
exports.getNextSibling = getNextSibling;
|
|
1363
1399
|
exports.getRequestEvent = voidFn;
|
|
1400
|
+
exports.httpHeader = httpHeader;
|
|
1401
|
+
exports.httpStatus = httpStatus;
|
|
1364
1402
|
exports.hydrate = hydrate;
|
|
1365
1403
|
exports.insert = insert;
|
|
1366
1404
|
exports.installHydrationRuntime = installHydrationRuntime;
|
package/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, enableHydration, flush, getOwner, createEffect } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, onSettled, enableHydration, flush, getOwner, createEffect } 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 = {
|
|
@@ -827,7 +827,15 @@ function runHydrationEvents() {
|
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
function isHydrating(node) {
|
|
830
|
-
|
|
830
|
+
if (!sharedConfig.hydrating) return false;
|
|
831
|
+
if (!node || node.isConnected) return true;
|
|
832
|
+
const roots = sharedConfig.claimRoots;
|
|
833
|
+
if (roots) {
|
|
834
|
+
for (let i = 0; i < roots.length; i++) {
|
|
835
|
+
if (roots[i].contains(node)) return true;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return false;
|
|
831
839
|
}
|
|
832
840
|
function classListToObject(classList) {
|
|
833
841
|
if (Array.isArray(classList)) {
|
|
@@ -876,7 +884,8 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
876
884
|
}
|
|
877
885
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
878
886
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
879
|
-
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else
|
|
887
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
|
|
888
|
+
node[prop] = value ?? "";else node[prop] = value;
|
|
880
889
|
} else {
|
|
881
890
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
882
891
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -1268,5 +1277,31 @@ function createElement(tagName, is = undefined) {
|
|
|
1268
1277
|
is
|
|
1269
1278
|
});
|
|
1270
1279
|
}
|
|
1280
|
+
function loadClientOnly(fn, setComp) {
|
|
1281
|
+
fn().then(m => setComp(() => m.default));
|
|
1282
|
+
}
|
|
1283
|
+
function clientOnly(fn, options = {}) {
|
|
1284
|
+
const [comp, setComp] = createSignal();
|
|
1285
|
+
let started = !options.lazy;
|
|
1286
|
+
started && loadClientOnly(fn, setComp);
|
|
1287
|
+
return props => {
|
|
1288
|
+
let Comp;
|
|
1289
|
+
let m;
|
|
1290
|
+
const rest = omit(props, "fallback");
|
|
1291
|
+
if (!started) {
|
|
1292
|
+
started = true;
|
|
1293
|
+
loadClientOnly(fn, setComp);
|
|
1294
|
+
}
|
|
1295
|
+
if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
|
|
1296
|
+
const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
|
|
1297
|
+
const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
|
|
1298
|
+
onSettled(() => {
|
|
1299
|
+
setMounted(true);
|
|
1300
|
+
});
|
|
1301
|
+
return gate;
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
function httpStatus(_code, _text) {}
|
|
1305
|
+
function httpHeader(_name, _value, _options) {}
|
|
1271
1306
|
|
|
1272
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1307
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clientOnly, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, respond, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|