@kudzujs/core 0.9.0 → 0.9.1
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/README.md +1 -1
- package/RELEASES.md +25 -0
- package/framework/core.mjs +4 -2
- package/framework/list-runtime.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Kudzu compiles ordinary React-shaped TypeScript and TSX into complete static HTM
|
|
|
14
14
|
|
|
15
15
|
> Experimental `0.9.x`: the compiler API and supported TSX surface may change.
|
|
16
16
|
|
|
17
|
-
**Latest release: 0.9.
|
|
17
|
+
**Latest release: 0.9.1 - Positional primitive lists.** JSON-safe primitive values now render in position-keyed collections while property-keyed rows retain their plain-object boundary. Read the [release notes](./RELEASES.md#091---positional-primitive-lists), open the [release page](https://github.com/kudzujs/kudzu/releases/tag/v0.9.1), or follow the [architecture packet](./docs/next-architecture/README.md).
|
|
18
18
|
|
|
19
19
|
- [Documentation](https://kudzujs.cloud/docs)
|
|
20
20
|
- [Installation guide](https://kudzujs.cloud/docs#install)
|
package/RELEASES.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Kudzu Releases
|
|
2
2
|
|
|
3
|
+
## 0.9.1 - Positional primitive lists
|
|
4
|
+
|
|
5
|
+
Kudzu 0.9.1 allows JSON-safe primitive values in lists keyed by their authored
|
|
6
|
+
position while retaining the plain-object requirement for property-keyed rows.
|
|
7
|
+
|
|
8
|
+
### Changed in 0.9.1
|
|
9
|
+
|
|
10
|
+
- Build and browser list validation now accept primitive positional rows.
|
|
11
|
+
- Compact object-row serialization ignores primitive arrays instead of treating
|
|
12
|
+
their values as object records.
|
|
13
|
+
- Lupin-derived fixtures prove realtime rooms, lobby and private-room entry,
|
|
14
|
+
stopwatch ownership, chat and spectator replacement, Canvas/RAF input,
|
|
15
|
+
IME handling, panic shortcuts, and exact cleanup without a game runtime.
|
|
16
|
+
|
|
17
|
+
### Validation
|
|
18
|
+
|
|
19
|
+
- Static sibling routes remain complete HTML with zero JavaScript.
|
|
20
|
+
- `npm run check`, `npm test`, and `npm run test:package` pass with 253 tests.
|
|
21
|
+
|
|
22
|
+
### Upgrade
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install @kudzujs/core@^0.9.1
|
|
26
|
+
```
|
|
27
|
+
|
|
3
28
|
## 0.9.0 - Semantic compression
|
|
4
29
|
|
|
5
30
|
Kudzu 0.9.0 consolidates evidence-backed React migration shapes onto the existing signal, handler, effect, component-ownership, and keyed-list semantics without adding React, hydration, a VDOM, or a retained browser component tree.
|
package/framework/core.mjs
CHANGED
|
@@ -319,7 +319,7 @@ export function list(items, keyField, render, ownerField, selector = [], indexed
|
|
|
319
319
|
for (const [index, item] of values.entries()) {
|
|
320
320
|
const key = keyField === null ? index : item?.[keyField]
|
|
321
321
|
if (!validListKey(key)) throw new Error(`Keyed list key "${keyField}" must be a string or finite number`)
|
|
322
|
-
assertListItem(item)
|
|
322
|
+
assertListItem(item, keyField === null)
|
|
323
323
|
assertListValue(item, new Set())
|
|
324
324
|
const token = `${typeof key}:${key}`
|
|
325
325
|
if (keys.has(token)) throw new Error(`Duplicate keyed list key: ${String(key)}`)
|
|
@@ -360,7 +360,8 @@ function validListKey(key) {
|
|
|
360
360
|
return typeof key === "string" || typeof key === "number" && Number.isFinite(key)
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
function assertListItem(item) {
|
|
363
|
+
function assertListItem(item, allowPrimitive = false) {
|
|
364
|
+
if (allowPrimitive && (item === null || typeof item !== "object")) return
|
|
364
365
|
const prototype = item && typeof item === "object" ? Object.getPrototypeOf(item) : undefined
|
|
365
366
|
if (!item || Array.isArray(item) || prototype !== Object.prototype) throw new Error("Keyed list items must be ordinary plain objects")
|
|
366
367
|
}
|
|
@@ -1103,6 +1104,7 @@ function escapeJsonAttribute(value) {
|
|
|
1103
1104
|
|
|
1104
1105
|
function compactListState(value) {
|
|
1105
1106
|
if (!Array.isArray(value) || !value.length) return undefined
|
|
1107
|
+
if (!value[0] || typeof value[0] !== "object" || Array.isArray(value[0]) || Object.getPrototypeOf(value[0]) !== Object.prototype) return undefined
|
|
1106
1108
|
const fields = Object.keys(value[0])
|
|
1107
1109
|
if (!fields.length || !value.every(item => Object.keys(item).length === fields.length && fields.every(field => Object.hasOwn(item, field)))) return undefined
|
|
1108
1110
|
return [fields, value.map(item => fields.map(field => item[field]))]
|
|
@@ -170,7 +170,7 @@ function updateList(list) {
|
|
|
170
170
|
for (const [index, item] of items.entries()) {
|
|
171
171
|
const key = list.descriptor.key === null ? index : item?.[list.descriptor.key]
|
|
172
172
|
if (!validListKey(key)) throw new Error(`Keyed list key "${list.descriptor.key}" must be a string or finite number`)
|
|
173
|
-
assertListItem(item)
|
|
173
|
+
assertListItem(item, list.descriptor.key === null)
|
|
174
174
|
const seededValue = __KUDZU_LIST_SEEDS__ ? list.seedFields && seededListValue(item, list.seedFields, list.valueSeed, !referenceOnly) : undefined
|
|
175
175
|
if (seededValue === undefined) assertListValue(item, seen, true)
|
|
176
176
|
const token = keyToken(key)
|
|
@@ -1155,7 +1155,8 @@ function validListKey(key) {
|
|
|
1155
1155
|
return typeof key === "string" || typeof key === "number" && Number.isFinite(key)
|
|
1156
1156
|
}
|
|
1157
1157
|
|
|
1158
|
-
function assertListItem(item) {
|
|
1158
|
+
function assertListItem(item, allowPrimitive = false) {
|
|
1159
|
+
if (allowPrimitive && (item === null || typeof item !== "object")) return
|
|
1159
1160
|
const prototype = item && typeof item === "object" ? Object.getPrototypeOf(item) : undefined
|
|
1160
1161
|
if (!item || Array.isArray(item) || prototype !== Object.prototype) throw new Error("Keyed list items must be ordinary plain objects")
|
|
1161
1162
|
}
|