doxum 0.1.18 → 0.1.19
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 +24 -0
- package/dist/advanced-BYZCjNWL.js +680 -0
- package/dist/advanced-BYZCjNWL.js.map +1 -0
- package/dist/{advanced-c0F3gpLG.d.ts → advanced-C2fpjbK3.d.ts} +35 -2
- package/dist/advanced-CMMNk49G.cjs +763 -0
- package/dist/advanced-CMMNk49G.cjs.map +1 -0
- package/dist/{advanced-GTwIWcn6.d.cts → advanced-DlOYk1vi.d.cts} +35 -2
- package/dist/advanced.cjs +1 -1
- package/dist/advanced.d.cts +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/advanced.js +1 -1
- package/dist/index.cjs +477 -567
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +437 -527
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/doxum-runtime/references/projections.en.md +24 -0
- package/skills/doxum-runtime/references/projections.zh-CN.md +22 -0
- package/dist/advanced-DgRnyRAc.js +0 -233
- package/dist/advanced-DgRnyRAc.js.map +0 -1
- package/dist/advanced-Dgu8-bPS.cjs +0 -274
- package/dist/advanced-Dgu8-bPS.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -279,6 +279,24 @@ import { incremental } from 'doxum/advanced';
|
|
|
279
279
|
const doubled = incremental.collection([tasks], ({ sources, output }) => {
|
|
280
280
|
for (const [id, task] of sources[0]) output.set(id, task.value * 2);
|
|
281
281
|
});
|
|
282
|
+
|
|
283
|
+
const render = incremental.group(
|
|
284
|
+
[tasks],
|
|
285
|
+
define => ({
|
|
286
|
+
node: {
|
|
287
|
+
shell: define.collection<string, { readonly title: string }>(),
|
|
288
|
+
content: define.collection<string, string>(),
|
|
289
|
+
},
|
|
290
|
+
labels: define.collection<string, string>(),
|
|
291
|
+
}),
|
|
292
|
+
({ sources, outputs }) => {
|
|
293
|
+
for (const [id, task] of sources[0]) {
|
|
294
|
+
outputs.node.shell.set(id, { title: task.title });
|
|
295
|
+
outputs.node.content.set(id, task.title);
|
|
296
|
+
outputs.labels.set(id, task.title);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
);
|
|
282
300
|
```
|
|
283
301
|
|
|
284
302
|
Incremental processors receive a dependency-aligned `changes` tuple. Collection
|
|
@@ -286,6 +304,12 @@ entries carry `added`/`updated`/`removed` transitions with complete
|
|
|
286
304
|
`before`/`after` values, so a processor can patch indexes without rescanning the
|
|
287
305
|
collection; scalar dependencies use `undefined` and the initial collection build
|
|
288
306
|
reports `{ kind: 'reset' }`.
|
|
307
|
+
`incremental.group` runs one processor for several named keyed collection outputs.
|
|
308
|
+
Its static nested namespace is only API organization: every leaf is an ordinary
|
|
309
|
+
`Projection`, all leaves publish atomically in one causal settle, and downstream
|
|
310
|
+
processors depend directly on those leaves. A group materializes as a whole when
|
|
311
|
+
any leaf is first read; split groups when outputs do not share computation or
|
|
312
|
+
atomicity requirements. There is no output event bus or per-output runtime.
|
|
289
313
|
|
|
290
314
|
In React, `useProjection(projection)` reads a value and
|
|
291
315
|
`useProjection(projection, selector, equality?)` tracks keyed reads such as
|