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/dist/tutuca-cli.js
CHANGED
|
@@ -4727,7 +4727,6 @@ function sizeOf(v) {
|
|
|
4727
4727
|
|
|
4728
4728
|
class ValParser {
|
|
4729
4729
|
constructor() {
|
|
4730
|
-
this.bindValIt = new BindVal("it");
|
|
4731
4730
|
this.nullConstVal = new ConstVal(null);
|
|
4732
4731
|
}
|
|
4733
4732
|
const(v) {
|
|
@@ -6108,7 +6107,7 @@ function parseXOp(attrs, childs, opIdx, px) {
|
|
|
6108
6107
|
node = px.addNodeIf(RenderNode, parseXOpVal(name, value, px, vp.parseComponent), as);
|
|
6109
6108
|
break;
|
|
6110
6109
|
case "render-it":
|
|
6111
|
-
node = px.
|
|
6110
|
+
node = px.addNode(RenderItNode, as);
|
|
6112
6111
|
break;
|
|
6113
6112
|
case "render-each":
|
|
6114
6113
|
node = parseRenderEach(px, value, as, attrs);
|
|
@@ -6201,7 +6200,7 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
6201
6200
|
const seqVal = parseXOpVal("render-each", value, px, vp.parseSequence);
|
|
6202
6201
|
if (seqVal === null)
|
|
6203
6202
|
return null;
|
|
6204
|
-
const renderIt = px.
|
|
6203
|
+
const renderIt = px.addNode(RenderItNode, as);
|
|
6205
6204
|
const attrParser = getAttrParser(px);
|
|
6206
6205
|
const eachAttr = attrParser.eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
6207
6206
|
const when = attrs.getNamedItem("@when") ?? attrs.getNamedItem("when");
|
|
@@ -6288,6 +6287,12 @@ class ParseContext {
|
|
|
6288
6287
|
}
|
|
6289
6288
|
return null;
|
|
6290
6289
|
}
|
|
6290
|
+
addNode(Class, extra) {
|
|
6291
|
+
const nodeId = this.nodes.length;
|
|
6292
|
+
const node = new Class(nodeId, null, extra);
|
|
6293
|
+
this.nodes.push(node);
|
|
6294
|
+
return node;
|
|
6295
|
+
}
|
|
6291
6296
|
registerEvents() {
|
|
6292
6297
|
const id = this.events.length;
|
|
6293
6298
|
const events = new NodeEvents(id);
|
|
@@ -14456,16 +14461,23 @@ class Example {
|
|
|
14456
14461
|
value,
|
|
14457
14462
|
view = "main",
|
|
14458
14463
|
componentName = null,
|
|
14459
|
-
|
|
14464
|
+
requestHandlers = null,
|
|
14465
|
+
requestHandlerNames = [],
|
|
14466
|
+
on = null
|
|
14460
14467
|
}) {
|
|
14461
14468
|
this.title = title;
|
|
14462
14469
|
this.description = description;
|
|
14463
14470
|
this.value = value;
|
|
14464
14471
|
this.view = view;
|
|
14465
14472
|
this.componentName = componentName;
|
|
14473
|
+
this.requestHandlers = requestHandlers;
|
|
14466
14474
|
this.requestHandlerNames = requestHandlerNames;
|
|
14475
|
+
this.on = on;
|
|
14467
14476
|
}
|
|
14468
14477
|
}
|
|
14478
|
+
function isPlainObject2(v) {
|
|
14479
|
+
return v != null && typeof v === "object" && !Array.isArray(v);
|
|
14480
|
+
}
|
|
14469
14481
|
function resolveComponentName(value, components) {
|
|
14470
14482
|
for (const comp of components) {
|
|
14471
14483
|
if (value instanceof comp.Class)
|
|
@@ -14512,13 +14524,29 @@ function parseExample(raw, index, components, parentPath) {
|
|
|
14512
14524
|
if (rh != null && (typeof rh !== "object" || Array.isArray(rh))) {
|
|
14513
14525
|
throw shapeError(`example at ${where} "requestHandlers" must be an object of functions`, where);
|
|
14514
14526
|
}
|
|
14527
|
+
const on = raw.on;
|
|
14528
|
+
if (on != null) {
|
|
14529
|
+
if (!isPlainObject2(on)) {
|
|
14530
|
+
throw shapeError(`example at ${where} "on" must be an object of lifecycle phases (${PHASE_NAMES.join(", ")})`, where);
|
|
14531
|
+
}
|
|
14532
|
+
for (const key in on) {
|
|
14533
|
+
if (!PHASE_NAMES.includes(key)) {
|
|
14534
|
+
throw shapeError(`example at ${where} has unknown lifecycle phase "on.${key}"; expected one of ${PHASE_NAMES.join(", ")}`, where);
|
|
14535
|
+
}
|
|
14536
|
+
if (!isPlainObject2(on[key])) {
|
|
14537
|
+
throw shapeError(`example at ${where} "on.${key}" must be an object of actions (send, bubble, request, input, do)`, where);
|
|
14538
|
+
}
|
|
14539
|
+
}
|
|
14540
|
+
}
|
|
14515
14541
|
return new Example({
|
|
14516
14542
|
title: raw.title ?? `Example ${index + 1}`,
|
|
14517
14543
|
description: raw.description ?? null,
|
|
14518
14544
|
value: raw.value,
|
|
14519
14545
|
view: raw.view ?? "main",
|
|
14520
14546
|
componentName: resolveComponentName(raw.value, components),
|
|
14521
|
-
|
|
14547
|
+
requestHandlers: rh ?? null,
|
|
14548
|
+
requestHandlerNames: rh ? Object.keys(rh) : [],
|
|
14549
|
+
on: on ?? null
|
|
14522
14550
|
});
|
|
14523
14551
|
}
|
|
14524
14552
|
function parseSection(raw, components, where) {
|
|
@@ -14612,7 +14640,10 @@ function findComponentNameConflicts(entries) {
|
|
|
14612
14640
|
}
|
|
14613
14641
|
return conflicts.sort((a, b) => a.name.localeCompare(b.name));
|
|
14614
14642
|
}
|
|
14615
|
-
var EXAMPLES_SHAPE_MISMATCH = "EXAMPLES_SHAPE_MISMATCH";
|
|
14643
|
+
var EXAMPLES_SHAPE_MISMATCH = "EXAMPLES_SHAPE_MISMATCH", PHASE_NAMES;
|
|
14644
|
+
var init_module = __esm(() => {
|
|
14645
|
+
PHASE_NAMES = ["init", "resume", "suspend"];
|
|
14646
|
+
});
|
|
14616
14647
|
|
|
14617
14648
|
// tools/core/results.js
|
|
14618
14649
|
class ModuleInfo {
|
|
@@ -14784,7 +14815,9 @@ function describeModule(mod, { path = null } = {}) {
|
|
|
14784
14815
|
}
|
|
14785
14816
|
return new ModuleInfo({ path, present, counts, warnings });
|
|
14786
14817
|
}
|
|
14787
|
-
var init_describe = () => {
|
|
14818
|
+
var init_describe = __esm(() => {
|
|
14819
|
+
init_module();
|
|
14820
|
+
});
|
|
14788
14821
|
|
|
14789
14822
|
// tools/core/docs.js
|
|
14790
14823
|
function getSignature(name, fn) {
|
|
@@ -15191,7 +15224,7 @@ class Stack2 {
|
|
|
15191
15224
|
return new Stack2(comps, it, binds, newDynBinds, views, viewsId, ctx);
|
|
15192
15225
|
}
|
|
15193
15226
|
static root(comps, it, ctx) {
|
|
15194
|
-
const binds = [new BindFrame(it, {
|
|
15227
|
+
const binds = [new BindFrame(it, {}, true), null];
|
|
15195
15228
|
const dynBinds = [new ObjectFrame({}), null];
|
|
15196
15229
|
const views = ["main", null];
|
|
15197
15230
|
return new Stack2(comps, it, binds, dynBinds, views, "", ctx)._pushProvides();
|
|
@@ -15822,6 +15855,7 @@ class App {
|
|
|
15822
15855
|
this._compiled = false;
|
|
15823
15856
|
this._renderOpts = { document: rootNode.ownerDocument };
|
|
15824
15857
|
this._renderState = null;
|
|
15858
|
+
this.rootViewName = null;
|
|
15825
15859
|
}
|
|
15826
15860
|
get state() {
|
|
15827
15861
|
return this.transactor.state;
|
|
@@ -15933,7 +15967,7 @@ class App {
|
|
|
15933
15967
|
const root = this.state.val;
|
|
15934
15968
|
const stack = this.makeStack(root);
|
|
15935
15969
|
const { renderer, rootNode, _renderOpts, _renderState } = this;
|
|
15936
|
-
const newState = render(renderer.renderRoot(stack, root), rootNode, _renderOpts, _renderState);
|
|
15970
|
+
const newState = render(renderer.renderRoot(stack, root, this.rootViewName), rootNode, _renderOpts, _renderState);
|
|
15937
15971
|
this._renderState = newState;
|
|
15938
15972
|
return newState.dom;
|
|
15939
15973
|
}
|
|
@@ -16072,12 +16106,71 @@ var init_app = __esm(() => {
|
|
|
16072
16106
|
_evs = "dragstart dragover dragend touchstart touchmove touchend touchcancel".split(" ");
|
|
16073
16107
|
});
|
|
16074
16108
|
|
|
16109
|
+
// src/on.js
|
|
16110
|
+
function phaseOps(phase) {
|
|
16111
|
+
const ops = [];
|
|
16112
|
+
for (const type3 of OP_KINDS)
|
|
16113
|
+
for (const a of phase[type3] ?? [])
|
|
16114
|
+
ops.push({ type: type3, ...a });
|
|
16115
|
+
for (const a of phase.do ?? [])
|
|
16116
|
+
ops.push(a);
|
|
16117
|
+
return ops;
|
|
16118
|
+
}
|
|
16119
|
+
function resolveArgs(args, self) {
|
|
16120
|
+
return typeof args === "function" ? args(self) ?? [] : args ?? [];
|
|
16121
|
+
}
|
|
16122
|
+
function phaseHasBubble(phase) {
|
|
16123
|
+
if (!phase)
|
|
16124
|
+
return false;
|
|
16125
|
+
if (phase.bubble?.length)
|
|
16126
|
+
return true;
|
|
16127
|
+
return (phase.do ?? []).some((op) => op.type === "bubble");
|
|
16128
|
+
}
|
|
16129
|
+
function dispatchPhase(dispatcher, targetPath, phase, self) {
|
|
16130
|
+
if (!phase)
|
|
16131
|
+
return;
|
|
16132
|
+
for (const op of phaseOps(phase)) {
|
|
16133
|
+
const args = resolveArgs(op.args, self);
|
|
16134
|
+
switch (op.type) {
|
|
16135
|
+
case "send":
|
|
16136
|
+
dispatcher.sendAtPath(targetPath, op.name, args, op.opts);
|
|
16137
|
+
break;
|
|
16138
|
+
case "bubble":
|
|
16139
|
+
dispatcher.sendAtPath(targetPath, op.name, args, {
|
|
16140
|
+
skipSelf: true,
|
|
16141
|
+
bubbles: true,
|
|
16142
|
+
...op.opts
|
|
16143
|
+
});
|
|
16144
|
+
break;
|
|
16145
|
+
case "request":
|
|
16146
|
+
dispatcher.requestAtPath(targetPath, op.name, args, op.opts);
|
|
16147
|
+
break;
|
|
16148
|
+
case "input":
|
|
16149
|
+
dispatcher.inputAtPath(targetPath, op.name, args, op.opts);
|
|
16150
|
+
break;
|
|
16151
|
+
}
|
|
16152
|
+
}
|
|
16153
|
+
}
|
|
16154
|
+
var OP_KINDS;
|
|
16155
|
+
var init_on = __esm(() => {
|
|
16156
|
+
OP_KINDS = ["send", "bubble", "request", "input"];
|
|
16157
|
+
});
|
|
16158
|
+
|
|
16075
16159
|
// src/util/render.js
|
|
16076
16160
|
function reindexComponents(comps) {
|
|
16077
16161
|
for (let i = 0;i < comps.length; i++) {
|
|
16078
16162
|
comps[i].id = i;
|
|
16079
16163
|
}
|
|
16080
16164
|
}
|
|
16165
|
+
function serializeContainer(container) {
|
|
16166
|
+
for (const input of container.querySelectorAll("input")) {
|
|
16167
|
+
if (input.value)
|
|
16168
|
+
input.setAttribute("value", input.value);
|
|
16169
|
+
if (input.checked)
|
|
16170
|
+
input.setAttribute("checked", "");
|
|
16171
|
+
}
|
|
16172
|
+
return container.innerHTML;
|
|
16173
|
+
}
|
|
16081
16174
|
function renderToHTMLNode(document2, components, macros, rootState, ParseContext2, opts = { noCache: true }) {
|
|
16082
16175
|
const container = document2.createElement("div");
|
|
16083
16176
|
document2.body.appendChild(container);
|
|
@@ -16088,14 +16181,11 @@ function renderToHTMLNode(document2, components, macros, rootState, ParseContext
|
|
|
16088
16181
|
const scope = app.registerComponents(components);
|
|
16089
16182
|
if (macros)
|
|
16090
16183
|
scope.registerMacros(macros);
|
|
16184
|
+
if (opts.requestHandlers)
|
|
16185
|
+
scope.registerRequestHandlers(opts.requestHandlers);
|
|
16186
|
+
app.rootViewName = opts.view ?? null;
|
|
16091
16187
|
app.transactor.state.set(rootState);
|
|
16092
16188
|
app.start(opts);
|
|
16093
|
-
for (const input of container.querySelectorAll("input")) {
|
|
16094
|
-
if (input.value)
|
|
16095
|
-
input.setAttribute("value", input.value);
|
|
16096
|
-
if (input.checked)
|
|
16097
|
-
input.setAttribute("checked", "");
|
|
16098
|
-
}
|
|
16099
16189
|
return {
|
|
16100
16190
|
container,
|
|
16101
16191
|
app,
|
|
@@ -16105,20 +16195,44 @@ function renderToHTMLNode(document2, components, macros, rootState, ParseContext
|
|
|
16105
16195
|
}
|
|
16106
16196
|
};
|
|
16107
16197
|
}
|
|
16108
|
-
function
|
|
16109
|
-
const { container, cleanup } = renderToHTMLNode(document2, components, macros, rootState, ParseContext2);
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16198
|
+
async function renderToHTMLDriven(document2, components, macros, rootState, ParseContext2, { phase = null, requestHandlers = null, view = null, warn = console.warn } = {}) {
|
|
16199
|
+
const { container, app, cleanup } = renderToHTMLNode(document2, components, macros, rootState, ParseContext2, { noCache: true, requestHandlers, view });
|
|
16200
|
+
try {
|
|
16201
|
+
if (phase) {
|
|
16202
|
+
if (phaseHasBubble(phase))
|
|
16203
|
+
warn("render: a `bubble` action is a no-op here — the example's value is the render root, so there is no ancestor to receive it. Use send/request/input to drive a preset state.");
|
|
16204
|
+
dispatchPhase(rootDispatcher(app.transactor), new Path([]), phase, app.state.val);
|
|
16205
|
+
await app.transactor.settle();
|
|
16206
|
+
}
|
|
16207
|
+
return serializeContainer(container);
|
|
16208
|
+
} finally {
|
|
16209
|
+
cleanup();
|
|
16210
|
+
}
|
|
16113
16211
|
}
|
|
16114
16212
|
var init_render = __esm(() => {
|
|
16115
16213
|
init_app();
|
|
16116
16214
|
init_components();
|
|
16215
|
+
init_on();
|
|
16216
|
+
init_path();
|
|
16117
16217
|
init_renderer();
|
|
16218
|
+
init_transactor();
|
|
16118
16219
|
});
|
|
16119
16220
|
|
|
16120
16221
|
// tools/core/render.js
|
|
16121
|
-
function
|
|
16222
|
+
function checkView2(value, components, viewName) {
|
|
16223
|
+
if (viewName === "main")
|
|
16224
|
+
return null;
|
|
16225
|
+
const comp = components.find((c) => value instanceof c.Class);
|
|
16226
|
+
if (!comp || comp.views[viewName])
|
|
16227
|
+
return null;
|
|
16228
|
+
const known = Object.keys(comp.views).sort().join(", ");
|
|
16229
|
+
return new Error(`view "${viewName}" is not defined on ${comp.name} (has: ${known})`);
|
|
16230
|
+
}
|
|
16231
|
+
function handlersFor(normalized, example) {
|
|
16232
|
+
const merged = { ...normalized.requestHandlers ?? {}, ...example.requestHandlers ?? {} };
|
|
16233
|
+
return Object.keys(merged).length > 0 ? merged : null;
|
|
16234
|
+
}
|
|
16235
|
+
async function renderExamples(normalized, env, { name = null, title = null, view = null } = {}) {
|
|
16122
16236
|
const sections = [];
|
|
16123
16237
|
for (const section of normalized.sections) {
|
|
16124
16238
|
const items = [];
|
|
@@ -16132,7 +16246,14 @@ function renderExamples(normalized, env, { name = null, title = null, view = nul
|
|
|
16132
16246
|
let html = "";
|
|
16133
16247
|
let error = null;
|
|
16134
16248
|
try {
|
|
16135
|
-
|
|
16249
|
+
const bad = checkView2(example.value, normalized.components, viewName);
|
|
16250
|
+
if (bad)
|
|
16251
|
+
throw bad;
|
|
16252
|
+
html = await renderToHTMLDriven(env.document, normalized.components, normalized.macros, example.value, env.ParseContext, {
|
|
16253
|
+
phase: example.on?.init ?? null,
|
|
16254
|
+
requestHandlers: handlersFor(normalized, example),
|
|
16255
|
+
view: viewName
|
|
16256
|
+
});
|
|
16136
16257
|
} catch (e) {
|
|
16137
16258
|
error = { message: e.message, stack: e.stack };
|
|
16138
16259
|
}
|
|
@@ -16159,56 +16280,6 @@ var init_render2 = __esm(() => {
|
|
|
16159
16280
|
init_render();
|
|
16160
16281
|
});
|
|
16161
16282
|
|
|
16162
|
-
// src/on.js
|
|
16163
|
-
function phaseOps(phase) {
|
|
16164
|
-
const ops = [];
|
|
16165
|
-
for (const type3 of OP_KINDS)
|
|
16166
|
-
for (const a of phase[type3] ?? [])
|
|
16167
|
-
ops.push({ type: type3, ...a });
|
|
16168
|
-
for (const a of phase.do ?? [])
|
|
16169
|
-
ops.push(a);
|
|
16170
|
-
return ops;
|
|
16171
|
-
}
|
|
16172
|
-
function resolveArgs(args, self) {
|
|
16173
|
-
return typeof args === "function" ? args(self) ?? [] : args ?? [];
|
|
16174
|
-
}
|
|
16175
|
-
function phaseHasBubble(phase) {
|
|
16176
|
-
if (!phase)
|
|
16177
|
-
return false;
|
|
16178
|
-
if (phase.bubble?.length)
|
|
16179
|
-
return true;
|
|
16180
|
-
return (phase.do ?? []).some((op) => op.type === "bubble");
|
|
16181
|
-
}
|
|
16182
|
-
function dispatchPhase(dispatcher, targetPath, phase, self) {
|
|
16183
|
-
if (!phase)
|
|
16184
|
-
return;
|
|
16185
|
-
for (const op of phaseOps(phase)) {
|
|
16186
|
-
const args = resolveArgs(op.args, self);
|
|
16187
|
-
switch (op.type) {
|
|
16188
|
-
case "send":
|
|
16189
|
-
dispatcher.sendAtPath(targetPath, op.name, args, op.opts);
|
|
16190
|
-
break;
|
|
16191
|
-
case "bubble":
|
|
16192
|
-
dispatcher.sendAtPath(targetPath, op.name, args, {
|
|
16193
|
-
skipSelf: true,
|
|
16194
|
-
bubbles: true,
|
|
16195
|
-
...op.opts
|
|
16196
|
-
});
|
|
16197
|
-
break;
|
|
16198
|
-
case "request":
|
|
16199
|
-
dispatcher.requestAtPath(targetPath, op.name, args, op.opts);
|
|
16200
|
-
break;
|
|
16201
|
-
case "input":
|
|
16202
|
-
dispatcher.inputAtPath(targetPath, op.name, args, op.opts);
|
|
16203
|
-
break;
|
|
16204
|
-
}
|
|
16205
|
-
}
|
|
16206
|
-
}
|
|
16207
|
-
var OP_KINDS;
|
|
16208
|
-
var init_on = __esm(() => {
|
|
16209
|
-
OP_KINDS = ["send", "bubble", "request", "input"];
|
|
16210
|
-
});
|
|
16211
|
-
|
|
16212
16283
|
// tools/core/tests.js
|
|
16213
16284
|
class Describe {
|
|
16214
16285
|
constructor({ title, componentName = null, parent = null }) {
|
|
@@ -17689,6 +17760,7 @@ async function run5(argv, opts = {}) {
|
|
|
17689
17760
|
var describe5 = "Serve a storybook for the project's co-located *.dev.js modules (auto-discovered).", BOOTSTRAP_URL = "/__tutuca_storybook__.js", DIST_PREFIX = "/__tutuca__/", MARGAUI_PREFIX = "/__margaui__/", MIME, MARGAUI_CDN = "https://cdn.jsdelivr.net/npm/margaui/+esm", MARGAUI_THEME = "https://marianoguerra.github.io/margaui/themes/theme.css";
|
|
17690
17761
|
var init_storybook = __esm(() => {
|
|
17691
17762
|
init_chai2();
|
|
17763
|
+
init_module();
|
|
17692
17764
|
init_test();
|
|
17693
17765
|
init_env2();
|
|
17694
17766
|
init_errors();
|
|
@@ -17867,6 +17939,7 @@ import { statSync as statSync2 } from "node:fs";
|
|
|
17867
17939
|
import { parseArgs as parseArgs4 } from "node:util";
|
|
17868
17940
|
|
|
17869
17941
|
// tools/cli/load.js
|
|
17942
|
+
init_module();
|
|
17870
17943
|
import { existsSync as existsSync4 } from "node:fs";
|
|
17871
17944
|
import { resolve as resolve6 } from "node:path";
|
|
17872
17945
|
async function loadAndNormalize(modulePath) {
|
|
@@ -18016,6 +18089,7 @@ function extractGlobals(argv) {
|
|
|
18016
18089
|
function dispatchKnownCommands() {
|
|
18017
18090
|
return [...Object.keys(COMMANDS), ...Object.keys(NO_MODULE_COMMANDS)];
|
|
18018
18091
|
}
|
|
18092
|
+
var DEV_BUILD_COMMANDS = new Set(["test", "storybook"]);
|
|
18019
18093
|
async function main() {
|
|
18020
18094
|
const { opts, rest } = extractGlobals(process.argv.slice(2));
|
|
18021
18095
|
if (rest.length === 0) {
|
|
@@ -18023,6 +18097,8 @@ async function main() {
|
|
|
18023
18097
|
return;
|
|
18024
18098
|
}
|
|
18025
18099
|
const command = rest[0];
|
|
18100
|
+
if (DEV_BUILD_COMMANDS.has(command))
|
|
18101
|
+
installDevBuildResolveHook();
|
|
18026
18102
|
if (NO_MODULE_COMMANDS[command]) {
|
|
18027
18103
|
const commandArgs2 = rest.slice(1);
|
|
18028
18104
|
const args = opts.help ? [...commandArgs2, "--help"] : commandArgs2;
|
|
@@ -18056,8 +18132,6 @@ async function main() {
|
|
|
18056
18132
|
opts.module = rest[1];
|
|
18057
18133
|
commandArgs = rest.slice(2);
|
|
18058
18134
|
}
|
|
18059
|
-
if (command === "test")
|
|
18060
|
-
installDevBuildResolveHook();
|
|
18061
18135
|
try {
|
|
18062
18136
|
await runCommand(cmd, commandArgs, opts);
|
|
18063
18137
|
} catch (e) {
|
package/dist/tutuca-dev.ext.js
CHANGED
|
@@ -637,7 +637,6 @@ var PREDICATES = {
|
|
|
637
637
|
|
|
638
638
|
class ValParser {
|
|
639
639
|
constructor() {
|
|
640
|
-
this.bindValIt = new BindVal("it");
|
|
641
640
|
this.nullConstVal = new ConstVal(null);
|
|
642
641
|
}
|
|
643
642
|
const(v) {
|
|
@@ -2183,7 +2182,7 @@ function parseXOp(attrs, childs, opIdx, px) {
|
|
|
2183
2182
|
node = px.addNodeIf(RenderNode, parseXOpVal(name, value, px, vp.parseComponent), as);
|
|
2184
2183
|
break;
|
|
2185
2184
|
case "render-it":
|
|
2186
|
-
node = px.
|
|
2185
|
+
node = px.addNode(RenderItNode, as);
|
|
2187
2186
|
break;
|
|
2188
2187
|
case "render-each":
|
|
2189
2188
|
node = parseRenderEach(px, value, as, attrs);
|
|
@@ -2366,7 +2365,7 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
2366
2365
|
const seqVal = parseXOpVal("render-each", value, px, vp.parseSequence);
|
|
2367
2366
|
if (seqVal === null)
|
|
2368
2367
|
return null;
|
|
2369
|
-
const renderIt = px.
|
|
2368
|
+
const renderIt = px.addNode(RenderItNode, as);
|
|
2370
2369
|
const attrParser = getAttrParser(px);
|
|
2371
2370
|
const eachAttr = attrParser.eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
2372
2371
|
const when = attrs.getNamedItem("@when") ?? attrs.getNamedItem("when");
|
|
@@ -2566,6 +2565,12 @@ class ParseContext {
|
|
|
2566
2565
|
}
|
|
2567
2566
|
return null;
|
|
2568
2567
|
}
|
|
2568
|
+
addNode(Class, extra) {
|
|
2569
|
+
const nodeId = this.nodes.length;
|
|
2570
|
+
const node = new Class(nodeId, null, extra);
|
|
2571
|
+
this.nodes.push(node);
|
|
2572
|
+
return node;
|
|
2573
|
+
}
|
|
2569
2574
|
registerEvents() {
|
|
2570
2575
|
const id = this.events.length;
|
|
2571
2576
|
const events = new NodeEvents(id);
|
|
@@ -6297,7 +6302,7 @@ class Stack {
|
|
|
6297
6302
|
return new Stack(comps, it, binds, newDynBinds, views, viewsId, ctx);
|
|
6298
6303
|
}
|
|
6299
6304
|
static root(comps, it, ctx) {
|
|
6300
|
-
const binds = [new BindFrame(it, {
|
|
6305
|
+
const binds = [new BindFrame(it, {}, true), null];
|
|
6301
6306
|
const dynBinds = [new ObjectFrame({}), null];
|
|
6302
6307
|
const views = ["main", null];
|
|
6303
6308
|
return new Stack(comps, it, binds, dynBinds, views, "", ctx)._pushProvides();
|
|
@@ -7645,6 +7650,7 @@ class App {
|
|
|
7645
7650
|
this._compiled = false;
|
|
7646
7651
|
this._renderOpts = { document: rootNode.ownerDocument };
|
|
7647
7652
|
this._renderState = null;
|
|
7653
|
+
this.rootViewName = null;
|
|
7648
7654
|
}
|
|
7649
7655
|
get state() {
|
|
7650
7656
|
return this.transactor.state;
|
|
@@ -7756,7 +7762,7 @@ class App {
|
|
|
7756
7762
|
const root = this.state.val;
|
|
7757
7763
|
const stack = this.makeStack(root);
|
|
7758
7764
|
const { renderer, rootNode, _renderOpts, _renderState } = this;
|
|
7759
|
-
const newState = render(renderer.renderRoot(stack, root), rootNode, _renderOpts, _renderState);
|
|
7765
|
+
const newState = render(renderer.renderRoot(stack, root, this.rootViewName), rootNode, _renderOpts, _renderState);
|
|
7760
7766
|
this._renderState = newState;
|
|
7761
7767
|
return newState.dom;
|
|
7762
7768
|
}
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -8289,7 +8289,6 @@ var PREDICATES = {
|
|
|
8289
8289
|
|
|
8290
8290
|
class ValParser {
|
|
8291
8291
|
constructor() {
|
|
8292
|
-
this.bindValIt = new BindVal("it");
|
|
8293
8292
|
this.nullConstVal = new ConstVal(null);
|
|
8294
8293
|
}
|
|
8295
8294
|
const(v) {
|
|
@@ -9832,7 +9831,7 @@ function parseXOp(attrs, childs, opIdx, px) {
|
|
|
9832
9831
|
node = px.addNodeIf(RenderNode, parseXOpVal(name, value, px, vp.parseComponent), as);
|
|
9833
9832
|
break;
|
|
9834
9833
|
case "render-it":
|
|
9835
|
-
node = px.
|
|
9834
|
+
node = px.addNode(RenderItNode, as);
|
|
9836
9835
|
break;
|
|
9837
9836
|
case "render-each":
|
|
9838
9837
|
node = parseRenderEach(px, value, as, attrs);
|
|
@@ -10015,7 +10014,7 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
10015
10014
|
const seqVal = parseXOpVal("render-each", value, px, vp.parseSequence);
|
|
10016
10015
|
if (seqVal === null)
|
|
10017
10016
|
return null;
|
|
10018
|
-
const renderIt = px.
|
|
10017
|
+
const renderIt = px.addNode(RenderItNode, as);
|
|
10019
10018
|
const attrParser = getAttrParser(px);
|
|
10020
10019
|
const eachAttr = attrParser.eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
10021
10020
|
const when = attrs.getNamedItem("@when") ?? attrs.getNamedItem("when");
|
|
@@ -10215,6 +10214,12 @@ class ParseContext {
|
|
|
10215
10214
|
}
|
|
10216
10215
|
return null;
|
|
10217
10216
|
}
|
|
10217
|
+
addNode(Class, extra) {
|
|
10218
|
+
const nodeId = this.nodes.length;
|
|
10219
|
+
const node = new Class(nodeId, null, extra);
|
|
10220
|
+
this.nodes.push(node);
|
|
10221
|
+
return node;
|
|
10222
|
+
}
|
|
10218
10223
|
registerEvents() {
|
|
10219
10224
|
const id = this.events.length;
|
|
10220
10225
|
const events2 = new NodeEvents(id);
|
|
@@ -13946,7 +13951,7 @@ class Stack2 {
|
|
|
13946
13951
|
return new Stack2(comps, it, binds, newDynBinds, views, viewsId, ctx);
|
|
13947
13952
|
}
|
|
13948
13953
|
static root(comps, it, ctx) {
|
|
13949
|
-
const binds = [new BindFrame(it, {
|
|
13954
|
+
const binds = [new BindFrame(it, {}, true), null];
|
|
13950
13955
|
const dynBinds = [new ObjectFrame({}), null];
|
|
13951
13956
|
const views = ["main", null];
|
|
13952
13957
|
return new Stack2(comps, it, binds, dynBinds, views, "", ctx)._pushProvides();
|
|
@@ -15294,6 +15299,7 @@ class App {
|
|
|
15294
15299
|
this._compiled = false;
|
|
15295
15300
|
this._renderOpts = { document: rootNode.ownerDocument };
|
|
15296
15301
|
this._renderState = null;
|
|
15302
|
+
this.rootViewName = null;
|
|
15297
15303
|
}
|
|
15298
15304
|
get state() {
|
|
15299
15305
|
return this.transactor.state;
|
|
@@ -15405,7 +15411,7 @@ class App {
|
|
|
15405
15411
|
const root = this.state.val;
|
|
15406
15412
|
const stack = this.makeStack(root);
|
|
15407
15413
|
const { renderer, rootNode, _renderOpts, _renderState } = this;
|
|
15408
|
-
const newState = render(renderer.renderRoot(stack, root), rootNode, _renderOpts, _renderState);
|
|
15414
|
+
const newState = render(renderer.renderRoot(stack, root, this.rootViewName), rootNode, _renderOpts, _renderState);
|
|
15409
15415
|
this._renderState = newState;
|
|
15410
15416
|
return newState.dom;
|
|
15411
15417
|
}
|