tutuca 0.9.110 → 0.9.112
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/tutuca-cli.js +148 -74
- package/dist/tutuca-dev.ext.js +11 -5
- package/dist/tutuca-dev.js +11 -5
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.ext.js +11 -5
- package/dist/tutuca-extra.js +11 -5
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.ext.js +11 -5
- package/dist/tutuca.js +11 -5
- package/dist/tutuca.min.js +2 -2
- package/package.json +2 -2
- package/skill/tutuca/testing.md +8 -2
- package/skill/tutuca-source/tutuca.ext.js +11 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tutuca",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.112",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SPA framework with immutable state and virtual DOM; dependency-free browser bundle",
|
|
6
6
|
"main": "./dist/tutuca.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"sync-docs-storybook": "bun scripts/sync-docs-storybook.js",
|
|
35
35
|
"build-skill": "bun scripts/build-skill.js",
|
|
36
36
|
"clean-skill": "rm -rf skill",
|
|
37
|
-
"test": "bun test test/*.test.js",
|
|
37
|
+
"test": "bun run dist && bun run dist-ext && bun test test/*.test.js",
|
|
38
38
|
"test-watch": "bun test --watch test/*.test.js",
|
|
39
39
|
"format": "bunx @biomejs/biome format --write",
|
|
40
40
|
"lint": "bunx @biomejs/biome lint",
|
package/skill/tutuca/testing.md
CHANGED
|
@@ -157,8 +157,10 @@ you want to test them as a pipeline: filter + loop-data + enrichment
|
|
|
157
157
|
together produce a list of bindings the view sees. Use
|
|
158
158
|
`collectIterBindings` for that — a functional implementation only ships
|
|
159
159
|
in the dev build (`tutuca/dev`); the core `tutuca` build exports a no-op
|
|
160
|
-
stub
|
|
161
|
-
|
|
160
|
+
stub that returns `[]`. Both commands that run `getTests()` in the
|
|
161
|
+
terminal — `tutuca test` and `tutuca storybook` (including `--dry-run`) —
|
|
162
|
+
redirect the bare `tutuca` import to the dev build automatically, as does
|
|
163
|
+
the browser storybook's import map. So test modules can import it as below:
|
|
162
164
|
|
|
163
165
|
```js
|
|
164
166
|
import { collectIterBindings } from "tutuca";
|
|
@@ -180,6 +182,10 @@ const r = collectIterBindings(MyComp, c, c.items, {
|
|
|
180
182
|
- The `compInstance` is `this` for every handler. Pass
|
|
181
183
|
`MyComp.make({ field: ... })` so handlers that read `this.field` see
|
|
182
184
|
the value you want.
|
|
185
|
+
- The redirect uses Node's `module.register`, which is how the `tutuca`
|
|
186
|
+
bin runs. Under a Bun-driven CLI it degrades to the no-op stub — if you
|
|
187
|
+
see `collectIterBindings` return `[]`, import it from `tutuca/dev`
|
|
188
|
+
explicitly.
|
|
183
189
|
|
|
184
190
|
Example:
|
|
185
191
|
|
|
@@ -540,7 +540,6 @@ var PREDICATES = {
|
|
|
540
540
|
|
|
541
541
|
class ValParser {
|
|
542
542
|
constructor() {
|
|
543
|
-
this.bindValIt = new BindVal("it");
|
|
544
543
|
this.nullConstVal = new ConstVal(null);
|
|
545
544
|
}
|
|
546
545
|
const(v) {
|
|
@@ -2086,7 +2085,7 @@ function parseXOp(attrs, childs, opIdx, px) {
|
|
|
2086
2085
|
node = px.addNodeIf(RenderNode, parseXOpVal(name, value, px, vp.parseComponent), as);
|
|
2087
2086
|
break;
|
|
2088
2087
|
case "render-it":
|
|
2089
|
-
node = px.
|
|
2088
|
+
node = px.addNode(RenderItNode, as);
|
|
2090
2089
|
break;
|
|
2091
2090
|
case "render-each":
|
|
2092
2091
|
node = parseRenderEach(px, value, as, attrs);
|
|
@@ -2269,7 +2268,7 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
2269
2268
|
const seqVal = parseXOpVal("render-each", value, px, vp.parseSequence);
|
|
2270
2269
|
if (seqVal === null)
|
|
2271
2270
|
return null;
|
|
2272
|
-
const renderIt = px.
|
|
2271
|
+
const renderIt = px.addNode(RenderItNode, as);
|
|
2273
2272
|
const attrParser = getAttrParser(px);
|
|
2274
2273
|
const eachAttr = attrParser.eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
2275
2274
|
const when = attrs.getNamedItem("@when") ?? attrs.getNamedItem("when");
|
|
@@ -2469,6 +2468,12 @@ class ParseContext {
|
|
|
2469
2468
|
}
|
|
2470
2469
|
return null;
|
|
2471
2470
|
}
|
|
2471
|
+
addNode(Class, extra) {
|
|
2472
|
+
const nodeId = this.nodes.length;
|
|
2473
|
+
const node = new Class(nodeId, null, extra);
|
|
2474
|
+
this.nodes.push(node);
|
|
2475
|
+
return node;
|
|
2476
|
+
}
|
|
2472
2477
|
registerEvents() {
|
|
2473
2478
|
const id = this.events.length;
|
|
2474
2479
|
const events = new NodeEvents(id);
|
|
@@ -2900,7 +2905,7 @@ class Stack {
|
|
|
2900
2905
|
return new Stack(comps, it, binds, newDynBinds, views, viewsId, ctx);
|
|
2901
2906
|
}
|
|
2902
2907
|
static root(comps, it, ctx) {
|
|
2903
|
-
const binds = [new BindFrame(it, {
|
|
2908
|
+
const binds = [new BindFrame(it, {}, true), null];
|
|
2904
2909
|
const dynBinds = [new ObjectFrame({}), null];
|
|
2905
2910
|
const views = ["main", null];
|
|
2906
2911
|
return new Stack(comps, it, binds, dynBinds, views, "", ctx)._pushProvides();
|
|
@@ -3532,6 +3537,7 @@ class App {
|
|
|
3532
3537
|
this._compiled = false;
|
|
3533
3538
|
this._renderOpts = { document: rootNode.ownerDocument };
|
|
3534
3539
|
this._renderState = null;
|
|
3540
|
+
this.rootViewName = null;
|
|
3535
3541
|
}
|
|
3536
3542
|
get state() {
|
|
3537
3543
|
return this.transactor.state;
|
|
@@ -3643,7 +3649,7 @@ class App {
|
|
|
3643
3649
|
const root = this.state.val;
|
|
3644
3650
|
const stack = this.makeStack(root);
|
|
3645
3651
|
const { renderer, rootNode, _renderOpts, _renderState } = this;
|
|
3646
|
-
const newState = render(renderer.renderRoot(stack, root), rootNode, _renderOpts, _renderState);
|
|
3652
|
+
const newState = render(renderer.renderRoot(stack, root, this.rootViewName), rootNode, _renderOpts, _renderState);
|
|
3647
3653
|
this._renderState = newState;
|
|
3648
3654
|
return newState.dom;
|
|
3649
3655
|
}
|