@solidjs/web 2.0.0-beta.20 → 2.0.0-beta.22
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 +34 -1
- package/dist/dev.js +31 -2
- package/dist/server.cjs +19 -1
- package/dist/server.js +16 -2
- package/dist/web.cjs +34 -1
- package/dist/web.js +31 -2
- package/package.json +3 -3
- package/server-functions/dist/client.cjs +144 -38
- package/server-functions/dist/client.js +136 -39
- package/server-functions/dist/server.cjs +127 -10
- package/server-functions/dist/server.js +119 -11
- package/types/client.d.ts +18 -0
- package/types/jsx.d.ts +17 -2
- package/types/response.d.ts +27 -1
- package/types/server-functions/client.d.ts +104 -19
- package/types/server-functions/server.d.ts +138 -15
- package/types/server-functions/shared.d.ts +200 -0
- package/types/server.d.ts +8 -0
- package/types-cjs/client.d.cts +18 -0
- package/types-cjs/jsx.d.cts +17 -2
- package/types-cjs/response.d.cts +27 -1
- package/types-cjs/server-functions/client.d.cts +104 -19
- package/types-cjs/server-functions/server.d.cts +138 -15
- package/types-cjs/server-functions/shared.d.cts +200 -0
- package/types-cjs/server.d.cts +8 -0
package/dist/dev.cjs
CHANGED
|
@@ -282,9 +282,24 @@ function setProperty(node, name, value) {
|
|
|
282
282
|
if (isHydrating(node)) return;
|
|
283
283
|
node[name] = value;
|
|
284
284
|
}
|
|
285
|
+
let claimHandlers = null;
|
|
286
|
+
function registerElementClaim(handler) {
|
|
287
|
+
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
288
|
+
return () => {
|
|
289
|
+
const index = claimHandlers.indexOf(handler);
|
|
290
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function claimElement(node) {
|
|
294
|
+
if (claimHandlers !== null) {
|
|
295
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
296
|
+
}
|
|
297
|
+
return node;
|
|
298
|
+
}
|
|
285
299
|
function setAttribute(node, name, value) {
|
|
286
300
|
if (isHydrating(node)) return;
|
|
287
301
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
302
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
288
303
|
}
|
|
289
304
|
function setAttributeNS(node, namespace, name, value) {
|
|
290
305
|
if (isHydrating(node)) return;
|
|
@@ -662,6 +677,13 @@ function hydrate$1(code, element, options = {}) {
|
|
|
662
677
|
}
|
|
663
678
|
};
|
|
664
679
|
solidJs.sharedConfig.registry = new Map();
|
|
680
|
+
if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
|
|
681
|
+
solidJs.sharedConfig.captureBoundaryScope = id => {
|
|
682
|
+
if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
|
|
683
|
+
registry: solidJs.sharedConfig.registry,
|
|
684
|
+
gather: solidJs.sharedConfig.gather
|
|
685
|
+
});
|
|
686
|
+
};
|
|
665
687
|
solidJs.sharedConfig.hydrating = true;
|
|
666
688
|
{
|
|
667
689
|
solidJs.sharedConfig.verifyHydration = () => {
|
|
@@ -1123,6 +1145,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1123
1145
|
function isResponseEnvelope(value) {
|
|
1124
1146
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1125
1147
|
}
|
|
1148
|
+
const HREF = Symbol.for("solid.Href");
|
|
1149
|
+
function isHref(value) {
|
|
1150
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1151
|
+
}
|
|
1126
1152
|
function initWithRevalidate(init) {
|
|
1127
1153
|
const {
|
|
1128
1154
|
revalidate,
|
|
@@ -1136,6 +1162,9 @@ function initWithRevalidate(init) {
|
|
|
1136
1162
|
};
|
|
1137
1163
|
}
|
|
1138
1164
|
function redirect(url, init = 302) {
|
|
1165
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1166
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1167
|
+
}
|
|
1139
1168
|
const {
|
|
1140
1169
|
responseInit,
|
|
1141
1170
|
headers
|
|
@@ -1145,7 +1174,7 @@ function redirect(url, init = 302) {
|
|
|
1145
1174
|
if (responseInit.status === undefined) {
|
|
1146
1175
|
responseInit.status = 302;
|
|
1147
1176
|
}
|
|
1148
|
-
headers.set("Location", url);
|
|
1177
|
+
headers.set("Location", String(url));
|
|
1149
1178
|
return new Response(null, {
|
|
1150
1179
|
...responseInit,
|
|
1151
1180
|
headers
|
|
@@ -1334,6 +1363,7 @@ exports.DOMElements = DOMElements;
|
|
|
1334
1363
|
exports.DOMWithState = DOMWithState;
|
|
1335
1364
|
exports.DelegatedEvents = DelegatedEvents;
|
|
1336
1365
|
exports.Dynamic = Dynamic;
|
|
1366
|
+
exports.HREF = HREF;
|
|
1337
1367
|
exports.HydrationScript = voidFn;
|
|
1338
1368
|
exports.MathMLElements = MathMLElements;
|
|
1339
1369
|
exports.Namespaces = Namespaces;
|
|
@@ -1347,6 +1377,7 @@ exports.acquireAsset = acquireAsset;
|
|
|
1347
1377
|
exports.addEvent = addEvent;
|
|
1348
1378
|
exports.applyRef = applyRef;
|
|
1349
1379
|
exports.assign = assign;
|
|
1380
|
+
exports.claimElement = claimElement;
|
|
1350
1381
|
exports.className = className;
|
|
1351
1382
|
exports.delegateEvents = delegateEvents;
|
|
1352
1383
|
exports.dynamic = dynamic;
|
|
@@ -1367,6 +1398,7 @@ exports.hydrate = hydrate;
|
|
|
1367
1398
|
exports.insert = insert;
|
|
1368
1399
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
1369
1400
|
exports.isDev = isDev;
|
|
1401
|
+
exports.isHref = isHref;
|
|
1370
1402
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1371
1403
|
exports.isServer = isServer;
|
|
1372
1404
|
exports.memo = memo;
|
|
@@ -1375,6 +1407,7 @@ exports.redirect = redirect;
|
|
|
1375
1407
|
exports.ref = ref;
|
|
1376
1408
|
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
1377
1409
|
exports.registerDelegatedRoot = registerDelegatedRoot;
|
|
1410
|
+
exports.registerElementClaim = registerElementClaim;
|
|
1378
1411
|
exports.reload = reload;
|
|
1379
1412
|
exports.render = render;
|
|
1380
1413
|
exports.renderToStream = renderToStream;
|
package/dist/dev.js
CHANGED
|
@@ -281,9 +281,24 @@ function setProperty(node, name, value) {
|
|
|
281
281
|
if (isHydrating(node)) return;
|
|
282
282
|
node[name] = value;
|
|
283
283
|
}
|
|
284
|
+
let claimHandlers = null;
|
|
285
|
+
function registerElementClaim(handler) {
|
|
286
|
+
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
287
|
+
return () => {
|
|
288
|
+
const index = claimHandlers.indexOf(handler);
|
|
289
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function claimElement(node) {
|
|
293
|
+
if (claimHandlers !== null) {
|
|
294
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
295
|
+
}
|
|
296
|
+
return node;
|
|
297
|
+
}
|
|
284
298
|
function setAttribute(node, name, value) {
|
|
285
299
|
if (isHydrating(node)) return;
|
|
286
300
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
301
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
287
302
|
}
|
|
288
303
|
function setAttributeNS(node, namespace, name, value) {
|
|
289
304
|
if (isHydrating(node)) return;
|
|
@@ -661,6 +676,13 @@ function hydrate$1(code, element, options = {}) {
|
|
|
661
676
|
}
|
|
662
677
|
};
|
|
663
678
|
sharedConfig.registry = new Map();
|
|
679
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
680
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
681
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
682
|
+
registry: sharedConfig.registry,
|
|
683
|
+
gather: sharedConfig.gather
|
|
684
|
+
});
|
|
685
|
+
};
|
|
664
686
|
sharedConfig.hydrating = true;
|
|
665
687
|
{
|
|
666
688
|
sharedConfig.verifyHydration = () => {
|
|
@@ -1122,6 +1144,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1122
1144
|
function isResponseEnvelope(value) {
|
|
1123
1145
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1124
1146
|
}
|
|
1147
|
+
const HREF = Symbol.for("solid.Href");
|
|
1148
|
+
function isHref(value) {
|
|
1149
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1150
|
+
}
|
|
1125
1151
|
function initWithRevalidate(init) {
|
|
1126
1152
|
const {
|
|
1127
1153
|
revalidate,
|
|
@@ -1135,6 +1161,9 @@ function initWithRevalidate(init) {
|
|
|
1135
1161
|
};
|
|
1136
1162
|
}
|
|
1137
1163
|
function redirect(url, init = 302) {
|
|
1164
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1165
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1166
|
+
}
|
|
1138
1167
|
const {
|
|
1139
1168
|
responseInit,
|
|
1140
1169
|
headers
|
|
@@ -1144,7 +1173,7 @@ function redirect(url, init = 302) {
|
|
|
1144
1173
|
if (responseInit.status === undefined) {
|
|
1145
1174
|
responseInit.status = 302;
|
|
1146
1175
|
}
|
|
1147
|
-
headers.set("Location", url);
|
|
1176
|
+
headers.set("Location", String(url));
|
|
1148
1177
|
return new Response(null, {
|
|
1149
1178
|
...responseInit,
|
|
1150
1179
|
headers
|
|
@@ -1275,4 +1304,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1275
1304
|
});
|
|
1276
1305
|
}
|
|
1277
1306
|
|
|
1278
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, 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, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, 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 };
|
package/dist/server.cjs
CHANGED
|
@@ -1272,6 +1272,13 @@ function getRequestEvent() {
|
|
|
1272
1272
|
function renderToStringAsync(code, options = {}) {
|
|
1273
1273
|
return new Promise(resolve => renderToStream(code, options).then(resolve));
|
|
1274
1274
|
}
|
|
1275
|
+
function registerElementClaim() {
|
|
1276
|
+
return noopCleanup;
|
|
1277
|
+
}
|
|
1278
|
+
function noopCleanup() {}
|
|
1279
|
+
function claimElement(node) {
|
|
1280
|
+
return node;
|
|
1281
|
+
}
|
|
1275
1282
|
function notSup() {
|
|
1276
1283
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1277
1284
|
}
|
|
@@ -1287,6 +1294,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1287
1294
|
function isResponseEnvelope(value) {
|
|
1288
1295
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1289
1296
|
}
|
|
1297
|
+
const HREF = Symbol.for("solid.Href");
|
|
1298
|
+
function isHref(value) {
|
|
1299
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1300
|
+
}
|
|
1290
1301
|
function initWithRevalidate(init) {
|
|
1291
1302
|
const {
|
|
1292
1303
|
revalidate,
|
|
@@ -1300,6 +1311,9 @@ function initWithRevalidate(init) {
|
|
|
1300
1311
|
};
|
|
1301
1312
|
}
|
|
1302
1313
|
function redirect(url, init = 302) {
|
|
1314
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1315
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1316
|
+
}
|
|
1303
1317
|
const {
|
|
1304
1318
|
responseInit,
|
|
1305
1319
|
headers
|
|
@@ -1309,7 +1323,7 @@ function redirect(url, init = 302) {
|
|
|
1309
1323
|
if (responseInit.status === undefined) {
|
|
1310
1324
|
responseInit.status = 302;
|
|
1311
1325
|
}
|
|
1312
|
-
headers.set("Location", url);
|
|
1326
|
+
headers.set("Location", String(url));
|
|
1313
1327
|
return new Response(null, {
|
|
1314
1328
|
...responseInit,
|
|
1315
1329
|
headers
|
|
@@ -1454,6 +1468,7 @@ exports.DOMElements = DOMElements;
|
|
|
1454
1468
|
exports.DOMWithState = DOMWithState;
|
|
1455
1469
|
exports.DelegatedEvents = DelegatedEvents;
|
|
1456
1470
|
exports.Dynamic = Dynamic;
|
|
1471
|
+
exports.HREF = HREF;
|
|
1457
1472
|
exports.HydrationScript = HydrationScript;
|
|
1458
1473
|
exports.MathMLElements = MathMLElements;
|
|
1459
1474
|
exports.Namespaces = Namespaces;
|
|
@@ -1467,6 +1482,7 @@ exports.acquireAsset = notSup;
|
|
|
1467
1482
|
exports.addEvent = notSup;
|
|
1468
1483
|
exports.applyRef = applyRef;
|
|
1469
1484
|
exports.assign = notSup;
|
|
1485
|
+
exports.claimElement = claimElement;
|
|
1470
1486
|
exports.className = notSup;
|
|
1471
1487
|
exports.delegateEvents = notSup;
|
|
1472
1488
|
exports.dynamic = dynamic;
|
|
@@ -1484,6 +1500,7 @@ exports.getRequestEvent = getRequestEvent;
|
|
|
1484
1500
|
exports.hydrate = notSup;
|
|
1485
1501
|
exports.insert = notSup;
|
|
1486
1502
|
exports.isDev = isDev;
|
|
1503
|
+
exports.isHref = isHref;
|
|
1487
1504
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1488
1505
|
exports.isServer = isServer;
|
|
1489
1506
|
exports.memo = memo;
|
|
@@ -1491,6 +1508,7 @@ exports.redirect = redirect;
|
|
|
1491
1508
|
exports.ref = notSup;
|
|
1492
1509
|
exports.registerDelegatedContainer = notSup;
|
|
1493
1510
|
exports.registerDelegatedRoot = notSup;
|
|
1511
|
+
exports.registerElementClaim = registerElementClaim;
|
|
1494
1512
|
exports.reload = reload;
|
|
1495
1513
|
exports.render = notSup;
|
|
1496
1514
|
exports.renderToStream = renderToStream;
|
package/dist/server.js
CHANGED
|
@@ -1271,6 +1271,13 @@ function getRequestEvent() {
|
|
|
1271
1271
|
function renderToStringAsync(code, options = {}) {
|
|
1272
1272
|
return new Promise(resolve => renderToStream(code, options).then(resolve));
|
|
1273
1273
|
}
|
|
1274
|
+
function registerElementClaim() {
|
|
1275
|
+
return noopCleanup;
|
|
1276
|
+
}
|
|
1277
|
+
function noopCleanup() {}
|
|
1278
|
+
function claimElement(node) {
|
|
1279
|
+
return node;
|
|
1280
|
+
}
|
|
1274
1281
|
function notSup() {
|
|
1275
1282
|
throw new Error("Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.");
|
|
1276
1283
|
}
|
|
@@ -1286,6 +1293,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1286
1293
|
function isResponseEnvelope(value) {
|
|
1287
1294
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1288
1295
|
}
|
|
1296
|
+
const HREF = Symbol.for("solid.Href");
|
|
1297
|
+
function isHref(value) {
|
|
1298
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1299
|
+
}
|
|
1289
1300
|
function initWithRevalidate(init) {
|
|
1290
1301
|
const {
|
|
1291
1302
|
revalidate,
|
|
@@ -1299,6 +1310,9 @@ function initWithRevalidate(init) {
|
|
|
1299
1310
|
};
|
|
1300
1311
|
}
|
|
1301
1312
|
function redirect(url, init = 302) {
|
|
1313
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1314
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1315
|
+
}
|
|
1302
1316
|
const {
|
|
1303
1317
|
responseInit,
|
|
1304
1318
|
headers
|
|
@@ -1308,7 +1322,7 @@ function redirect(url, init = 302) {
|
|
|
1308
1322
|
if (responseInit.status === undefined) {
|
|
1309
1323
|
responseInit.status = 302;
|
|
1310
1324
|
}
|
|
1311
|
-
headers.set("Location", url);
|
|
1325
|
+
headers.set("Location", String(url));
|
|
1312
1326
|
return new Response(null, {
|
|
1313
1327
|
...responseInit,
|
|
1314
1328
|
headers
|
|
@@ -1387,4 +1401,4 @@ function Portal(props) {
|
|
|
1387
1401
|
return undefined;
|
|
1388
1402
|
}
|
|
1389
1403
|
|
|
1390
|
-
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, notSup as getDelegatedRoot, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isResponseEnvelope, isServer, memo, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, 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 };
|
|
1404
|
+
export { Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, 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 };
|
package/dist/web.cjs
CHANGED
|
@@ -277,9 +277,24 @@ function setProperty(node, name, value) {
|
|
|
277
277
|
if (isHydrating(node)) return;
|
|
278
278
|
node[name] = value;
|
|
279
279
|
}
|
|
280
|
+
let claimHandlers = null;
|
|
281
|
+
function registerElementClaim(handler) {
|
|
282
|
+
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
283
|
+
return () => {
|
|
284
|
+
const index = claimHandlers.indexOf(handler);
|
|
285
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function claimElement(node) {
|
|
289
|
+
if (claimHandlers !== null) {
|
|
290
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
291
|
+
}
|
|
292
|
+
return node;
|
|
293
|
+
}
|
|
280
294
|
function setAttribute(node, name, value) {
|
|
281
295
|
if (isHydrating(node)) return;
|
|
282
296
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
297
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
283
298
|
}
|
|
284
299
|
function setAttributeNS(node, namespace, name, value) {
|
|
285
300
|
if (isHydrating(node)) return;
|
|
@@ -657,6 +672,13 @@ function hydrate$1(code, element, options = {}) {
|
|
|
657
672
|
}
|
|
658
673
|
};
|
|
659
674
|
solidJs.sharedConfig.registry = new Map();
|
|
675
|
+
if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
|
|
676
|
+
solidJs.sharedConfig.captureBoundaryScope = id => {
|
|
677
|
+
if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
|
|
678
|
+
registry: solidJs.sharedConfig.registry,
|
|
679
|
+
gather: solidJs.sharedConfig.gather
|
|
680
|
+
});
|
|
681
|
+
};
|
|
660
682
|
solidJs.sharedConfig.hydrating = true;
|
|
661
683
|
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
662
684
|
if (rootMapping && typeof rootMapping === "object") {
|
|
@@ -1066,6 +1088,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1066
1088
|
function isResponseEnvelope(value) {
|
|
1067
1089
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1068
1090
|
}
|
|
1091
|
+
const HREF = Symbol.for("solid.Href");
|
|
1092
|
+
function isHref(value) {
|
|
1093
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1094
|
+
}
|
|
1069
1095
|
function initWithRevalidate(init) {
|
|
1070
1096
|
const {
|
|
1071
1097
|
revalidate,
|
|
@@ -1079,6 +1105,9 @@ function initWithRevalidate(init) {
|
|
|
1079
1105
|
};
|
|
1080
1106
|
}
|
|
1081
1107
|
function redirect(url, init = 302) {
|
|
1108
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1109
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1110
|
+
}
|
|
1082
1111
|
const {
|
|
1083
1112
|
responseInit,
|
|
1084
1113
|
headers
|
|
@@ -1088,7 +1117,7 @@ function redirect(url, init = 302) {
|
|
|
1088
1117
|
if (responseInit.status === undefined) {
|
|
1089
1118
|
responseInit.status = 302;
|
|
1090
1119
|
}
|
|
1091
|
-
headers.set("Location", url);
|
|
1120
|
+
headers.set("Location", String(url));
|
|
1092
1121
|
return new Response(null, {
|
|
1093
1122
|
...responseInit,
|
|
1094
1123
|
headers
|
|
@@ -1272,6 +1301,7 @@ exports.DOMElements = DOMElements;
|
|
|
1272
1301
|
exports.DOMWithState = DOMWithState;
|
|
1273
1302
|
exports.DelegatedEvents = DelegatedEvents;
|
|
1274
1303
|
exports.Dynamic = Dynamic;
|
|
1304
|
+
exports.HREF = HREF;
|
|
1275
1305
|
exports.HydrationScript = voidFn;
|
|
1276
1306
|
exports.MathMLElements = MathMLElements;
|
|
1277
1307
|
exports.Namespaces = Namespaces;
|
|
@@ -1285,6 +1315,7 @@ exports.acquireAsset = acquireAsset;
|
|
|
1285
1315
|
exports.addEvent = addEvent;
|
|
1286
1316
|
exports.applyRef = applyRef;
|
|
1287
1317
|
exports.assign = assign;
|
|
1318
|
+
exports.claimElement = claimElement;
|
|
1288
1319
|
exports.className = className;
|
|
1289
1320
|
exports.delegateEvents = delegateEvents;
|
|
1290
1321
|
exports.dynamic = dynamic;
|
|
@@ -1305,6 +1336,7 @@ exports.hydrate = hydrate;
|
|
|
1305
1336
|
exports.insert = insert;
|
|
1306
1337
|
exports.installHydrationRuntime = installHydrationRuntime;
|
|
1307
1338
|
exports.isDev = isDev;
|
|
1339
|
+
exports.isHref = isHref;
|
|
1308
1340
|
exports.isResponseEnvelope = isResponseEnvelope;
|
|
1309
1341
|
exports.isServer = isServer;
|
|
1310
1342
|
exports.memo = memo;
|
|
@@ -1313,6 +1345,7 @@ exports.redirect = redirect;
|
|
|
1313
1345
|
exports.ref = ref;
|
|
1314
1346
|
exports.registerDelegatedContainer = registerDelegatedContainer;
|
|
1315
1347
|
exports.registerDelegatedRoot = registerDelegatedRoot;
|
|
1348
|
+
exports.registerElementClaim = registerElementClaim;
|
|
1316
1349
|
exports.reload = reload;
|
|
1317
1350
|
exports.render = render;
|
|
1318
1351
|
exports.renderToStream = renderToStream;
|
package/dist/web.js
CHANGED
|
@@ -276,9 +276,24 @@ function setProperty(node, name, value) {
|
|
|
276
276
|
if (isHydrating(node)) return;
|
|
277
277
|
node[name] = value;
|
|
278
278
|
}
|
|
279
|
+
let claimHandlers = null;
|
|
280
|
+
function registerElementClaim(handler) {
|
|
281
|
+
(claimHandlers || (claimHandlers = [])).push(handler);
|
|
282
|
+
return () => {
|
|
283
|
+
const index = claimHandlers.indexOf(handler);
|
|
284
|
+
index > -1 && claimHandlers.splice(index, 1);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function claimElement(node) {
|
|
288
|
+
if (claimHandlers !== null) {
|
|
289
|
+
for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
|
|
290
|
+
}
|
|
291
|
+
return node;
|
|
292
|
+
}
|
|
279
293
|
function setAttribute(node, name, value) {
|
|
280
294
|
if (isHydrating(node)) return;
|
|
281
295
|
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
296
|
+
if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
|
|
282
297
|
}
|
|
283
298
|
function setAttributeNS(node, namespace, name, value) {
|
|
284
299
|
if (isHydrating(node)) return;
|
|
@@ -656,6 +671,13 @@ function hydrate$1(code, element, options = {}) {
|
|
|
656
671
|
}
|
|
657
672
|
};
|
|
658
673
|
sharedConfig.registry = new Map();
|
|
674
|
+
if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
|
|
675
|
+
sharedConfig.captureBoundaryScope = id => {
|
|
676
|
+
if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
|
|
677
|
+
registry: sharedConfig.registry,
|
|
678
|
+
gather: sharedConfig.gather
|
|
679
|
+
});
|
|
680
|
+
};
|
|
659
681
|
sharedConfig.hydrating = true;
|
|
660
682
|
const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
|
|
661
683
|
if (rootMapping && typeof rootMapping === "object") {
|
|
@@ -1065,6 +1087,10 @@ ResponseEnvelope.prototype[ENVELOPE] = true;
|
|
|
1065
1087
|
function isResponseEnvelope(value) {
|
|
1066
1088
|
return !!(value && typeof value === "object" && value[ENVELOPE]);
|
|
1067
1089
|
}
|
|
1090
|
+
const HREF = Symbol.for("solid.Href");
|
|
1091
|
+
function isHref(value) {
|
|
1092
|
+
return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
|
|
1093
|
+
}
|
|
1068
1094
|
function initWithRevalidate(init) {
|
|
1069
1095
|
const {
|
|
1070
1096
|
revalidate,
|
|
@@ -1078,6 +1104,9 @@ function initWithRevalidate(init) {
|
|
|
1078
1104
|
};
|
|
1079
1105
|
}
|
|
1080
1106
|
function redirect(url, init = 302) {
|
|
1107
|
+
if (typeof url !== "string" && !isHref(url)) {
|
|
1108
|
+
throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
|
|
1109
|
+
}
|
|
1081
1110
|
const {
|
|
1082
1111
|
responseInit,
|
|
1083
1112
|
headers
|
|
@@ -1087,7 +1116,7 @@ function redirect(url, init = 302) {
|
|
|
1087
1116
|
if (responseInit.status === undefined) {
|
|
1088
1117
|
responseInit.status = 302;
|
|
1089
1118
|
}
|
|
1090
|
-
headers.set("Location", url);
|
|
1119
|
+
headers.set("Location", String(url));
|
|
1091
1120
|
return new Response(null, {
|
|
1092
1121
|
...responseInit,
|
|
1093
1122
|
headers
|
|
@@ -1213,4 +1242,4 @@ function createElement(tagName, is = undefined) {
|
|
|
1213
1242
|
});
|
|
1214
1243
|
}
|
|
1215
1244
|
|
|
1216
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, installHydrationRuntime, isDev, isResponseEnvelope, isServer, memo, mergeProps, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, 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 };
|
|
1245
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, ResponseEnvelope, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.22",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -224,10 +224,10 @@
|
|
|
224
224
|
"seroval-plugins": "~1.5.4"
|
|
225
225
|
},
|
|
226
226
|
"peerDependencies": {
|
|
227
|
-
"solid-js": "^2.0.0-beta.
|
|
227
|
+
"solid-js": "^2.0.0-beta.22"
|
|
228
228
|
},
|
|
229
229
|
"devDependencies": {
|
|
230
|
-
"solid-js": "2.0.0-beta.
|
|
230
|
+
"solid-js": "2.0.0-beta.22"
|
|
231
231
|
},
|
|
232
232
|
"scripts": {
|
|
233
233
|
"build": "npm-run-all -nl build:clean types:copy-jsx build:js",
|