@reckona/mreact-router 0.0.194 → 0.0.195
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/client.d.ts.map +1 -1
- package/dist/client.js +106 -10
- package/dist/client.js.map +1 -1
- package/package.json +11 -11
- package/src/client.ts +106 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.195",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -111,20 +111,20 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@typescript/typescript6": "^6.0.2",
|
|
113
113
|
"esbuild": ">=0.28.1 <0.29",
|
|
114
|
-
"@reckona/mreact": "0.0.
|
|
115
|
-
"@reckona/mreact
|
|
116
|
-
"@reckona/mreact-
|
|
117
|
-
"@reckona/mreact-
|
|
118
|
-
"@reckona/mreact-
|
|
119
|
-
"@reckona/mreact-
|
|
120
|
-
"@reckona/mreact-
|
|
121
|
-
"@reckona/mreact-server": "0.0.
|
|
122
|
-
"@reckona/mreact-
|
|
114
|
+
"@reckona/mreact-compat": "0.0.195",
|
|
115
|
+
"@reckona/mreact": "0.0.195",
|
|
116
|
+
"@reckona/mreact-compiler": "0.0.195",
|
|
117
|
+
"@reckona/mreact-devtools": "0.0.195",
|
|
118
|
+
"@reckona/mreact-query": "0.0.195",
|
|
119
|
+
"@reckona/mreact-reactive-core": "0.0.195",
|
|
120
|
+
"@reckona/mreact-shared": "0.0.195",
|
|
121
|
+
"@reckona/mreact-server": "0.0.195",
|
|
122
|
+
"@reckona/mreact-reactive-dom": "0.0.195"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"vite": ">=8.1.4 <9"
|
|
126
126
|
},
|
|
127
127
|
"optionalDependencies": {
|
|
128
|
-
"@reckona/mreact-router-native": "0.0.
|
|
128
|
+
"@reckona/mreact-router-native": "0.0.195"
|
|
129
129
|
}
|
|
130
130
|
}
|
package/src/client.ts
CHANGED
|
@@ -4150,13 +4150,15 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4150
4150
|
return false;
|
|
4151
4151
|
}
|
|
4152
4152
|
|
|
4153
|
-
|
|
4153
|
+
let hydrated = false;
|
|
4154
4154
|
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4155
|
+
while (true) {
|
|
4156
|
+
const placeholder = marker.querySelector("template[data-mreact-client-boundary]");
|
|
4157
|
+
|
|
4158
|
+
if (placeholder === null) {
|
|
4159
|
+
return hydrated;
|
|
4160
|
+
}
|
|
4158
4161
|
|
|
4159
|
-
for (const placeholder of placeholders) {
|
|
4160
4162
|
const name = placeholder.getAttribute("data-mreact-client-boundary");
|
|
4161
4163
|
const entry = name === null ? undefined : components.get(name);
|
|
4162
4164
|
const component = typeof entry === "function" ? entry : entry?.component;
|
|
@@ -4190,6 +4192,7 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4190
4192
|
const root = __mreactCompatCreateRoot(container);
|
|
4191
4193
|
container.__mreactCompatRoot = root;
|
|
4192
4194
|
root.render(__mreactCompatCreateElement(component, props));
|
|
4195
|
+
hydrated = true;
|
|
4193
4196
|
continue;
|
|
4194
4197
|
}
|
|
4195
4198
|
|
|
@@ -4197,9 +4200,8 @@ function __mreactHydrateClientBoundaries(marker, references, components) {
|
|
|
4197
4200
|
|
|
4198
4201
|
placeholder.replaceWith(node);
|
|
4199
4202
|
propsElement?.remove();
|
|
4203
|
+
hydrated = true;
|
|
4200
4204
|
}
|
|
4201
|
-
|
|
4202
|
-
return true;
|
|
4203
4205
|
}
|
|
4204
4206
|
|
|
4205
4207
|
function __mreactClientBoundaryParentContainer(placeholder, propsElement) {
|
|
@@ -4276,6 +4278,8 @@ function __mreactClientBoundaryPropsElement(placeholder, name) {
|
|
|
4276
4278
|
}
|
|
4277
4279
|
|
|
4278
4280
|
function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
4281
|
+
const componentFallback =
|
|
4282
|
+
placeholder.getAttribute("data-mreact-client-boundary-fallback") === "component";
|
|
4279
4283
|
const nodes = [];
|
|
4280
4284
|
let next = placeholder.nextSibling;
|
|
4281
4285
|
|
|
@@ -4292,6 +4296,13 @@ function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
|
4292
4296
|
nodes.push(current);
|
|
4293
4297
|
}
|
|
4294
4298
|
|
|
4299
|
+
if (componentFallback) {
|
|
4300
|
+
return __mreactExtractClientBoundaryChildren(
|
|
4301
|
+
nodes,
|
|
4302
|
+
placeholder.getAttribute("data-mreact-client-boundary"),
|
|
4303
|
+
);
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4295
4306
|
if (nodes.length === 0) {
|
|
4296
4307
|
return undefined;
|
|
4297
4308
|
}
|
|
@@ -4299,6 +4310,80 @@ function __mreactClientBoundaryFallbackChildren(placeholder, propsElement) {
|
|
|
4299
4310
|
return nodes.length === 1 ? nodes[0] : nodes;
|
|
4300
4311
|
}
|
|
4301
4312
|
|
|
4313
|
+
function __mreactExtractClientBoundaryChildren(nodes, name) {
|
|
4314
|
+
const startMarker = "mreact-client-boundary-children-start";
|
|
4315
|
+
const endMarker = "mreact-client-boundary-children-end";
|
|
4316
|
+
const archive = nodes.find(
|
|
4317
|
+
(node) =>
|
|
4318
|
+
node.nodeType === Node.ELEMENT_NODE &&
|
|
4319
|
+
node.tagName === "TEMPLATE" &&
|
|
4320
|
+
node.getAttribute("data-mreact-client-boundary-children") === name,
|
|
4321
|
+
);
|
|
4322
|
+
|
|
4323
|
+
const roots = archive === undefined ? nodes : Array.from(archive.content.childNodes);
|
|
4324
|
+
const markers = [];
|
|
4325
|
+
const visit = (node) => {
|
|
4326
|
+
if (
|
|
4327
|
+
node.nodeType === Node.COMMENT_NODE &&
|
|
4328
|
+
(node.nodeValue === startMarker || node.nodeValue === endMarker)
|
|
4329
|
+
) {
|
|
4330
|
+
markers.push(node);
|
|
4331
|
+
}
|
|
4332
|
+
|
|
4333
|
+
for (const child of Array.from(node.childNodes ?? [])) {
|
|
4334
|
+
visit(child);
|
|
4335
|
+
}
|
|
4336
|
+
};
|
|
4337
|
+
|
|
4338
|
+
for (const root of roots) {
|
|
4339
|
+
visit(root);
|
|
4340
|
+
}
|
|
4341
|
+
|
|
4342
|
+
let start;
|
|
4343
|
+
let depth = 0;
|
|
4344
|
+
|
|
4345
|
+
for (const marker of markers) {
|
|
4346
|
+
if (marker.nodeValue === startMarker) {
|
|
4347
|
+
if (depth === 0) {
|
|
4348
|
+
start = marker;
|
|
4349
|
+
}
|
|
4350
|
+
depth += 1;
|
|
4351
|
+
continue;
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
if (depth === 0 || start === undefined) {
|
|
4355
|
+
continue;
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
depth -= 1;
|
|
4359
|
+
|
|
4360
|
+
if (depth !== 0) {
|
|
4361
|
+
continue;
|
|
4362
|
+
}
|
|
4363
|
+
|
|
4364
|
+
if (start.parentNode !== marker.parentNode) {
|
|
4365
|
+
start = undefined;
|
|
4366
|
+
continue;
|
|
4367
|
+
}
|
|
4368
|
+
|
|
4369
|
+
const children = [];
|
|
4370
|
+
let current = start.nextSibling;
|
|
4371
|
+
|
|
4372
|
+
while (current !== null && current !== marker) {
|
|
4373
|
+
const next = current.nextSibling;
|
|
4374
|
+
current.remove();
|
|
4375
|
+
children.push(current);
|
|
4376
|
+
current = next;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
start.remove();
|
|
4380
|
+
marker.remove();
|
|
4381
|
+
return children.length === 0 ? "" : children.length === 1 ? children[0] : children;
|
|
4382
|
+
}
|
|
4383
|
+
|
|
4384
|
+
return undefined;
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4302
4387
|
function __mreactResumeRoute(marker, nextNode) {
|
|
4303
4388
|
if (nextNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
4304
4389
|
marker.replaceChildren(nextNode);
|
|
@@ -4314,12 +4399,23 @@ function __mreactResumeRoute(marker, nextNode) {
|
|
|
4314
4399
|
|
|
4315
4400
|
__mreactResumeNode(current, nextNode);
|
|
4316
4401
|
|
|
4317
|
-
|
|
4402
|
+
const active = current.parentNode === marker
|
|
4403
|
+
? current
|
|
4404
|
+
: nextNode.parentNode === marker
|
|
4405
|
+
? nextNode
|
|
4406
|
+
: null;
|
|
4407
|
+
|
|
4408
|
+
if (active === null) {
|
|
4318
4409
|
return;
|
|
4319
4410
|
}
|
|
4320
4411
|
|
|
4321
|
-
|
|
4322
|
-
|
|
4412
|
+
for (const child of Array.from(marker.childNodes)) {
|
|
4413
|
+
if (child === active) {
|
|
4414
|
+
continue;
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
__mreactUnmountCompatBoundaries(child);
|
|
4418
|
+
child.remove();
|
|
4323
4419
|
}
|
|
4324
4420
|
}
|
|
4325
4421
|
|