@uniflowed/router 0.0.0-alpha.28 → 0.0.0-alpha.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/internal/payload-rows.js +3 -2
- package/internal/payload.js +17 -1
- package/package.json +3 -3
package/internal/payload-rows.js
CHANGED
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
PAYLOAD_ROW_ATTRIBUTE,
|
|
58
58
|
PayloadRowError,
|
|
59
59
|
PayloadValueError,
|
|
60
|
+
payloadRowId,
|
|
60
61
|
parseRowMessage,
|
|
61
62
|
} from "./payload.js";
|
|
62
63
|
|
|
@@ -149,8 +150,8 @@ export function createPayloadReader(
|
|
|
149
150
|
if (attribute == null) {
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
152
|
-
const id =
|
|
153
|
-
if (
|
|
153
|
+
const id = payloadRowId(attribute);
|
|
154
|
+
if (id == null) {
|
|
154
155
|
return;
|
|
155
156
|
}
|
|
156
157
|
const slot = slots.get(id);
|
package/internal/payload.js
CHANGED
|
@@ -580,6 +580,19 @@ function decodeReference(value: string, path: string, resolve: RowResolver): mix
|
|
|
580
580
|
return resolve(id);
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
/**
|
|
584
|
+
* The row id carried by a streamed row element, or `null` when the attribute
|
|
585
|
+
* is not one.
|
|
586
|
+
*
|
|
587
|
+
* This is the same grammar as the `$P<n>` reference without the `$P` tag:
|
|
588
|
+
* digits only, in range. The browser reads row elements from a live document,
|
|
589
|
+
* so accepting `Number.parseInt`'s looser spellings would let `1x` satisfy the
|
|
590
|
+
* row the model named as `$P1`.
|
|
591
|
+
*/
|
|
592
|
+
export function payloadRowId(value: string): number | null {
|
|
593
|
+
return parsePayloadRowId(value);
|
|
594
|
+
}
|
|
595
|
+
|
|
583
596
|
/**
|
|
584
597
|
* The row a reference names, or `null` when the string is not one.
|
|
585
598
|
*
|
|
@@ -591,7 +604,10 @@ function rowId(value: string): number | null {
|
|
|
591
604
|
if (!value.startsWith(REFERENCE_PREFIX + ROW_TAG)) {
|
|
592
605
|
return null;
|
|
593
606
|
}
|
|
594
|
-
|
|
607
|
+
return parsePayloadRowId(value.slice(2));
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function parsePayloadRowId(digits: string): number | null {
|
|
595
611
|
if (digits.length === 0 || digits.length > 3) {
|
|
596
612
|
return null;
|
|
597
613
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniflowed/router",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.29",
|
|
4
4
|
"description": "The file-system router for Flow React applications: matching, layouts, loaders, navigation, server rendering and hydration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react-dom": ">=19"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@uniflowed/hooks": "0.0.0-alpha.
|
|
38
|
-
"@uniflowed/server": "0.0.0-alpha.
|
|
37
|
+
"@uniflowed/hooks": "0.0.0-alpha.29",
|
|
38
|
+
"@uniflowed/server": "0.0.0-alpha.29"
|
|
39
39
|
}
|
|
40
40
|
}
|