tutuca 0.9.45 → 0.9.47
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 +106 -39
- package/dist/tutuca-dev.js +110 -40
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.js +110 -40
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.js +108 -38
- package/dist/tutuca.min.js +2 -2
- package/package.json +1 -1
- package/skill/tutuca/advanced.md +15 -0
- package/skill/tutuca/cli.md +1 -1
- package/skill/tutuca/core.md +67 -9
package/dist/tutuca-cli.js
CHANGED
|
@@ -3813,8 +3813,9 @@ class Step {
|
|
|
3813
3813
|
setValue(root, _v) {
|
|
3814
3814
|
return root;
|
|
3815
3815
|
}
|
|
3816
|
-
|
|
3817
|
-
|
|
3816
|
+
enterFrame(stack, _prev, next) {
|
|
3817
|
+
return stack.enter(next, {}, true);
|
|
3818
|
+
}
|
|
3818
3819
|
}
|
|
3819
3820
|
|
|
3820
3821
|
class Path {
|
|
@@ -3853,16 +3854,15 @@ class Path {
|
|
|
3853
3854
|
return newVal;
|
|
3854
3855
|
}
|
|
3855
3856
|
buildStack(stack) {
|
|
3856
|
-
|
|
3857
|
-
let curVal = root;
|
|
3857
|
+
let prev = stack.it;
|
|
3858
3858
|
for (const step of this.steps) {
|
|
3859
|
-
|
|
3860
|
-
if (
|
|
3861
|
-
console.warn(
|
|
3859
|
+
const next = step.lookup(prev, NONE);
|
|
3860
|
+
if (next === NONE) {
|
|
3861
|
+
console.warn("bad PathItem", { root: stack.it, step, path: this });
|
|
3862
3862
|
return null;
|
|
3863
3863
|
}
|
|
3864
|
-
step.
|
|
3865
|
-
|
|
3864
|
+
stack = step.enterFrame(stack, prev, next);
|
|
3865
|
+
prev = next;
|
|
3866
3866
|
}
|
|
3867
3867
|
return stack;
|
|
3868
3868
|
}
|
|
@@ -3927,14 +3927,48 @@ function findHandlers(comp, eventIds, vid, eventName) {
|
|
|
3927
3927
|
}
|
|
3928
3928
|
return null;
|
|
3929
3929
|
}
|
|
3930
|
+
|
|
3931
|
+
class StepCtx {
|
|
3932
|
+
constructor(comp, nodeIds, idx, vid) {
|
|
3933
|
+
this.comp = comp;
|
|
3934
|
+
this.nodeIds = nodeIds;
|
|
3935
|
+
this.idx = idx;
|
|
3936
|
+
this.vid = vid;
|
|
3937
|
+
}
|
|
3938
|
+
get meta() {
|
|
3939
|
+
return this.nodeIds[this.idx];
|
|
3940
|
+
}
|
|
3941
|
+
get key() {
|
|
3942
|
+
const m = this.meta;
|
|
3943
|
+
return m.si !== undefined ? +m.si : m.sk;
|
|
3944
|
+
}
|
|
3945
|
+
get hasKey() {
|
|
3946
|
+
const m = this.meta;
|
|
3947
|
+
return m.si !== undefined || m.sk !== undefined;
|
|
3948
|
+
}
|
|
3949
|
+
next() {
|
|
3950
|
+
return this.idx + 1 < this.nodeIds.length ? new StepCtx(this.comp, this.nodeIds, this.idx + 1, this.vid) : null;
|
|
3951
|
+
}
|
|
3952
|
+
resolveNode() {
|
|
3953
|
+
return this.comp.getNodeForId(+this.meta.nid, this.vid);
|
|
3954
|
+
}
|
|
3955
|
+
applyKey(pi) {
|
|
3956
|
+
if (pi === null)
|
|
3957
|
+
return null;
|
|
3958
|
+
const m = this.meta;
|
|
3959
|
+
if (m.si !== undefined)
|
|
3960
|
+
return pi.withIndex(+m.si);
|
|
3961
|
+
if (m.sk !== undefined)
|
|
3962
|
+
return pi.withKey(m.sk);
|
|
3963
|
+
return pi;
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3930
3966
|
function resolvePathStep(comp, nodeIds, vid) {
|
|
3931
3967
|
for (let i = 0;i < nodeIds.length; i++) {
|
|
3932
|
-
const
|
|
3933
|
-
const
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
if (pi !== null)
|
|
3937
|
-
return si !== undefined ? pi.withIndex(+si) : sk ? pi.withKey(sk) : pi;
|
|
3968
|
+
const ctx = new StepCtx(comp, nodeIds, i, vid);
|
|
3969
|
+
const step = ctx.resolveNode().toPathStep(ctx);
|
|
3970
|
+
if (step !== null)
|
|
3971
|
+
return step;
|
|
3938
3972
|
}
|
|
3939
3973
|
return null;
|
|
3940
3974
|
}
|
|
@@ -3957,8 +3991,9 @@ class PathBuilder {
|
|
|
3957
3991
|
return this.add(new SeqKeyStep(name, key));
|
|
3958
3992
|
}
|
|
3959
3993
|
}
|
|
3960
|
-
var BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep,
|
|
3994
|
+
var NONE, BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO;
|
|
3961
3995
|
var init_path = __esm(() => {
|
|
3996
|
+
NONE = Symbol("NONE");
|
|
3962
3997
|
BindStep = class BindStep extends Step {
|
|
3963
3998
|
constructor(binds) {
|
|
3964
3999
|
super();
|
|
@@ -3970,16 +4005,15 @@ var init_path = __esm(() => {
|
|
|
3970
4005
|
setValue(_root, v) {
|
|
3971
4006
|
return v;
|
|
3972
4007
|
}
|
|
4008
|
+
enterFrame(stack, _prev, next) {
|
|
4009
|
+
return stack.enter(next, { ...this.binds }, false);
|
|
4010
|
+
}
|
|
3973
4011
|
withIndex(i) {
|
|
3974
4012
|
return new BindStep({ ...this.binds, key: i });
|
|
3975
4013
|
}
|
|
3976
4014
|
withKey(key) {
|
|
3977
4015
|
return new BindStep({ ...this.binds, key });
|
|
3978
4016
|
}
|
|
3979
|
-
updateBinds(_v, o) {
|
|
3980
|
-
Object.assign(o, this.binds);
|
|
3981
|
-
}
|
|
3982
|
-
isFrame = false;
|
|
3983
4017
|
};
|
|
3984
4018
|
FieldStep = class FieldStep extends Step {
|
|
3985
4019
|
constructor(field) {
|
|
@@ -4012,15 +4046,14 @@ var init_path = __esm(() => {
|
|
|
4012
4046
|
setValue(root, v) {
|
|
4013
4047
|
return root.set(this.field, root.get(this.field).set(this.key, v));
|
|
4014
4048
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4049
|
+
enterFrame(stack, _prev, next) {
|
|
4050
|
+
return stack.enter(next, { key: this.key }, true);
|
|
4017
4051
|
}
|
|
4018
4052
|
};
|
|
4019
4053
|
SeqKeyStep = class SeqKeyStep extends FieldSeqStep {
|
|
4020
4054
|
};
|
|
4021
4055
|
SeqIndexStep = class SeqIndexStep extends FieldSeqStep {
|
|
4022
4056
|
};
|
|
4023
|
-
NONE = Symbol("NONE");
|
|
4024
4057
|
SeqAccessStep = class SeqAccessStep extends Step {
|
|
4025
4058
|
constructor(seqField, keyField) {
|
|
4026
4059
|
super();
|
|
@@ -4037,8 +4070,40 @@ var init_path = __esm(() => {
|
|
|
4037
4070
|
const key = root?.get(this.keyField, NONE);
|
|
4038
4071
|
return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
|
|
4039
4072
|
}
|
|
4040
|
-
|
|
4041
|
-
|
|
4073
|
+
};
|
|
4074
|
+
EachBindStep = class EachBindStep extends Step {
|
|
4075
|
+
constructor(seqVal, key) {
|
|
4076
|
+
super();
|
|
4077
|
+
this.seqVal = seqVal;
|
|
4078
|
+
this.key = key;
|
|
4079
|
+
}
|
|
4080
|
+
lookup(v, _dval) {
|
|
4081
|
+
return v;
|
|
4082
|
+
}
|
|
4083
|
+
setValue(_root, v) {
|
|
4084
|
+
return v;
|
|
4085
|
+
}
|
|
4086
|
+
enterFrame(stack, _prev, next) {
|
|
4087
|
+
const item = this.seqVal.eval(stack)?.get(this.key, null);
|
|
4088
|
+
return stack.enter(next, { key: this.key, value: item }, false);
|
|
4089
|
+
}
|
|
4090
|
+
};
|
|
4091
|
+
EachRenderItStep = class EachRenderItStep extends Step {
|
|
4092
|
+
constructor(seqField, key) {
|
|
4093
|
+
super();
|
|
4094
|
+
this.seqField = seqField;
|
|
4095
|
+
this.key = key;
|
|
4096
|
+
}
|
|
4097
|
+
lookup(v, dval = null) {
|
|
4098
|
+
const seq = v?.get(this.seqField, null);
|
|
4099
|
+
return seq?.get ? seq.get(this.key, dval) : dval;
|
|
4100
|
+
}
|
|
4101
|
+
setValue(root, v) {
|
|
4102
|
+
const seq = root?.get(this.seqField, null);
|
|
4103
|
+
return seq ? root.set(this.seqField, seq.set(this.key, v)) : root;
|
|
4104
|
+
}
|
|
4105
|
+
enterFrame(stack, _prev, next) {
|
|
4106
|
+
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
4042
4107
|
}
|
|
4043
4108
|
};
|
|
4044
4109
|
EMPTY_META = {};
|
|
@@ -5048,8 +5113,8 @@ var init_anode = __esm(() => {
|
|
|
5048
5113
|
this.nodeId = nodeId;
|
|
5049
5114
|
this.val = val;
|
|
5050
5115
|
}
|
|
5051
|
-
|
|
5052
|
-
return this.val
|
|
5116
|
+
toPathStep(ctx) {
|
|
5117
|
+
return ctx.applyKey(this.val?.toPathItem?.() ?? null);
|
|
5053
5118
|
}
|
|
5054
5119
|
static parse(html, px) {
|
|
5055
5120
|
const nodes = px.parseHTML(html);
|
|
@@ -5163,7 +5228,15 @@ var init_anode = __esm(() => {
|
|
|
5163
5228
|
const newStack = stack.enter(stack.it, {}, true);
|
|
5164
5229
|
return rx.renderIt(newStack, this.nodeId, "", this.viewId);
|
|
5165
5230
|
}
|
|
5166
|
-
|
|
5231
|
+
toPathStep(ctx) {
|
|
5232
|
+
const next = ctx.next();
|
|
5233
|
+
if (next === null)
|
|
5234
|
+
return null;
|
|
5235
|
+
const nextNode = next.resolveNode();
|
|
5236
|
+
if (nextNode instanceof EachNode && next.hasKey)
|
|
5237
|
+
return new EachRenderItStep(nextNode.val.name, next.key);
|
|
5238
|
+
return null;
|
|
5239
|
+
}
|
|
5167
5240
|
};
|
|
5168
5241
|
RenderEachNode = class RenderEachNode extends RenderViewId {
|
|
5169
5242
|
constructor(nodeId, val, viewId) {
|
|
@@ -5250,7 +5323,7 @@ var init_anode = __esm(() => {
|
|
|
5250
5323
|
const binds = this.val.eval(stack)?.call(stack.it) ?? {};
|
|
5251
5324
|
return this.node.render(stack.enter(stack.it, binds, false), rx);
|
|
5252
5325
|
}
|
|
5253
|
-
|
|
5326
|
+
toPathStep(_ctx) {
|
|
5254
5327
|
return new BindStep({});
|
|
5255
5328
|
}
|
|
5256
5329
|
wrapNode(node) {
|
|
@@ -5267,8 +5340,8 @@ var init_anode = __esm(() => {
|
|
|
5267
5340
|
render(stack, rx) {
|
|
5268
5341
|
return rx.renderEachWhen(stack, this.iterInfo, this.node, this.nodeId);
|
|
5269
5342
|
}
|
|
5270
|
-
|
|
5271
|
-
return new
|
|
5343
|
+
toPathStep(ctx) {
|
|
5344
|
+
return ctx.hasKey ? new EachBindStep(this.val, ctx.key) : null;
|
|
5272
5345
|
}
|
|
5273
5346
|
static register = true;
|
|
5274
5347
|
};
|
|
@@ -8161,11 +8234,6 @@ class Stack {
|
|
|
8161
8234
|
_enrichOnEnter() {
|
|
8162
8235
|
return this.withDynamicBinds(this.comps.getOnEnterFor(this.it).call(this.it));
|
|
8163
8236
|
}
|
|
8164
|
-
upToFrameBinds() {
|
|
8165
|
-
const { comps, binds, dynBinds, views, viewsId, ctx } = this;
|
|
8166
|
-
const [head, tail] = binds;
|
|
8167
|
-
return head.isFrame ? this : new Stack(comps, tail[0].it, tail, dynBinds, views, viewsId, ctx);
|
|
8168
|
-
}
|
|
8169
8237
|
static root(comps, it, ctx) {
|
|
8170
8238
|
const binds = [new BindFrame(it, { it }, true), null];
|
|
8171
8239
|
const dynBinds = [new ObjectFrame({}), null];
|
|
@@ -8355,8 +8423,7 @@ class Transaction {
|
|
|
8355
8423
|
return Stack.root(comps, root);
|
|
8356
8424
|
}
|
|
8357
8425
|
buildStack(root, comps) {
|
|
8358
|
-
|
|
8359
|
-
return stack ? stack.upToFrameBinds() : null;
|
|
8426
|
+
return this.path.buildStack(this.buildRootStack(root, comps));
|
|
8360
8427
|
}
|
|
8361
8428
|
callHandler(root, instance, comps) {
|
|
8362
8429
|
const [handler, args] = this.getHandlerAndArgs(root, instance, comps);
|
|
@@ -13506,8 +13573,8 @@ class Renderer {
|
|
|
13506
13573
|
renderEachWhen(stack, iterInfo, view, nid) {
|
|
13507
13574
|
const { seq, filter, loopWith, enricher } = iterInfo.eval(stack);
|
|
13508
13575
|
const r = [];
|
|
13509
|
-
const iterData = loopWith.call(stack.it, seq);
|
|
13510
13576
|
const it = stack.it;
|
|
13577
|
+
const iterData = loopWith.call(it, seq);
|
|
13511
13578
|
this.getSeqInfo(seq)(seq, (key, value, attrName) => {
|
|
13512
13579
|
if (filter.call(it, key, value, iterData)) {
|
|
13513
13580
|
const cachePath = enricher ? [it, value] : [value];
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -3294,6 +3294,8 @@ function use(fn) {
|
|
|
3294
3294
|
__name(use, "use");
|
|
3295
3295
|
|
|
3296
3296
|
// src/path.js
|
|
3297
|
+
var NONE = Symbol("NONE");
|
|
3298
|
+
|
|
3297
3299
|
class Step {
|
|
3298
3300
|
lookup(_v, dval = null) {
|
|
3299
3301
|
return dval;
|
|
@@ -3301,8 +3303,9 @@ class Step {
|
|
|
3301
3303
|
setValue(root, _v) {
|
|
3302
3304
|
return root;
|
|
3303
3305
|
}
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
+
enterFrame(stack, _prev, next) {
|
|
3307
|
+
return stack.enter(next, {}, true);
|
|
3308
|
+
}
|
|
3306
3309
|
}
|
|
3307
3310
|
|
|
3308
3311
|
class BindStep extends Step {
|
|
@@ -3316,16 +3319,15 @@ class BindStep extends Step {
|
|
|
3316
3319
|
setValue(_root, v) {
|
|
3317
3320
|
return v;
|
|
3318
3321
|
}
|
|
3322
|
+
enterFrame(stack, _prev, next) {
|
|
3323
|
+
return stack.enter(next, { ...this.binds }, false);
|
|
3324
|
+
}
|
|
3319
3325
|
withIndex(i) {
|
|
3320
3326
|
return new BindStep({ ...this.binds, key: i });
|
|
3321
3327
|
}
|
|
3322
3328
|
withKey(key) {
|
|
3323
3329
|
return new BindStep({ ...this.binds, key });
|
|
3324
3330
|
}
|
|
3325
|
-
updateBinds(_v, o) {
|
|
3326
|
-
Object.assign(o, this.binds);
|
|
3327
|
-
}
|
|
3328
|
-
isFrame = false;
|
|
3329
3331
|
}
|
|
3330
3332
|
|
|
3331
3333
|
class FieldStep extends Step {
|
|
@@ -3360,8 +3362,8 @@ class FieldSeqStep extends Step {
|
|
|
3360
3362
|
setValue(root, v) {
|
|
3361
3363
|
return root.set(this.field, root.get(this.field).set(this.key, v));
|
|
3362
3364
|
}
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
+
enterFrame(stack, _prev, next) {
|
|
3366
|
+
return stack.enter(next, { key: this.key }, true);
|
|
3365
3367
|
}
|
|
3366
3368
|
}
|
|
3367
3369
|
|
|
@@ -3370,7 +3372,6 @@ class SeqKeyStep extends FieldSeqStep {
|
|
|
3370
3372
|
|
|
3371
3373
|
class SeqIndexStep extends FieldSeqStep {
|
|
3372
3374
|
}
|
|
3373
|
-
var NONE = Symbol("NONE");
|
|
3374
3375
|
|
|
3375
3376
|
class SeqAccessStep extends Step {
|
|
3376
3377
|
constructor(seqField, keyField) {
|
|
@@ -3388,8 +3389,42 @@ class SeqAccessStep extends Step {
|
|
|
3388
3389
|
const key = root?.get(this.keyField, NONE);
|
|
3389
3390
|
return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
|
|
3390
3391
|
}
|
|
3391
|
-
|
|
3392
|
-
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
class EachBindStep extends Step {
|
|
3395
|
+
constructor(seqVal, key) {
|
|
3396
|
+
super();
|
|
3397
|
+
this.seqVal = seqVal;
|
|
3398
|
+
this.key = key;
|
|
3399
|
+
}
|
|
3400
|
+
lookup(v, _dval) {
|
|
3401
|
+
return v;
|
|
3402
|
+
}
|
|
3403
|
+
setValue(_root, v) {
|
|
3404
|
+
return v;
|
|
3405
|
+
}
|
|
3406
|
+
enterFrame(stack, _prev, next) {
|
|
3407
|
+
const item = this.seqVal.eval(stack)?.get(this.key, null);
|
|
3408
|
+
return stack.enter(next, { key: this.key, value: item }, false);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
class EachRenderItStep extends Step {
|
|
3413
|
+
constructor(seqField, key) {
|
|
3414
|
+
super();
|
|
3415
|
+
this.seqField = seqField;
|
|
3416
|
+
this.key = key;
|
|
3417
|
+
}
|
|
3418
|
+
lookup(v, dval = null) {
|
|
3419
|
+
const seq = v?.get(this.seqField, null);
|
|
3420
|
+
return seq?.get ? seq.get(this.key, dval) : dval;
|
|
3421
|
+
}
|
|
3422
|
+
setValue(root, v) {
|
|
3423
|
+
const seq = root?.get(this.seqField, null);
|
|
3424
|
+
return seq ? root.set(this.seqField, seq.set(this.key, v)) : root;
|
|
3425
|
+
}
|
|
3426
|
+
enterFrame(stack, _prev, next) {
|
|
3427
|
+
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
3393
3428
|
}
|
|
3394
3429
|
}
|
|
3395
3430
|
|
|
@@ -3429,16 +3464,15 @@ class Path {
|
|
|
3429
3464
|
return newVal;
|
|
3430
3465
|
}
|
|
3431
3466
|
buildStack(stack) {
|
|
3432
|
-
|
|
3433
|
-
let curVal = root;
|
|
3467
|
+
let prev = stack.it;
|
|
3434
3468
|
for (const step of this.steps) {
|
|
3435
|
-
|
|
3436
|
-
if (
|
|
3437
|
-
console.warn(
|
|
3469
|
+
const next = step.lookup(prev, NONE);
|
|
3470
|
+
if (next === NONE) {
|
|
3471
|
+
console.warn("bad PathItem", { root: stack.it, step, path: this });
|
|
3438
3472
|
return null;
|
|
3439
3473
|
}
|
|
3440
|
-
step.
|
|
3441
|
-
|
|
3474
|
+
stack = step.enterFrame(stack, prev, next);
|
|
3475
|
+
prev = next;
|
|
3442
3476
|
}
|
|
3443
3477
|
return stack;
|
|
3444
3478
|
}
|
|
@@ -3504,14 +3538,48 @@ function findHandlers(comp, eventIds, vid, eventName) {
|
|
|
3504
3538
|
}
|
|
3505
3539
|
return null;
|
|
3506
3540
|
}
|
|
3541
|
+
|
|
3542
|
+
class StepCtx {
|
|
3543
|
+
constructor(comp, nodeIds, idx, vid) {
|
|
3544
|
+
this.comp = comp;
|
|
3545
|
+
this.nodeIds = nodeIds;
|
|
3546
|
+
this.idx = idx;
|
|
3547
|
+
this.vid = vid;
|
|
3548
|
+
}
|
|
3549
|
+
get meta() {
|
|
3550
|
+
return this.nodeIds[this.idx];
|
|
3551
|
+
}
|
|
3552
|
+
get key() {
|
|
3553
|
+
const m = this.meta;
|
|
3554
|
+
return m.si !== undefined ? +m.si : m.sk;
|
|
3555
|
+
}
|
|
3556
|
+
get hasKey() {
|
|
3557
|
+
const m = this.meta;
|
|
3558
|
+
return m.si !== undefined || m.sk !== undefined;
|
|
3559
|
+
}
|
|
3560
|
+
next() {
|
|
3561
|
+
return this.idx + 1 < this.nodeIds.length ? new StepCtx(this.comp, this.nodeIds, this.idx + 1, this.vid) : null;
|
|
3562
|
+
}
|
|
3563
|
+
resolveNode() {
|
|
3564
|
+
return this.comp.getNodeForId(+this.meta.nid, this.vid);
|
|
3565
|
+
}
|
|
3566
|
+
applyKey(pi) {
|
|
3567
|
+
if (pi === null)
|
|
3568
|
+
return null;
|
|
3569
|
+
const m = this.meta;
|
|
3570
|
+
if (m.si !== undefined)
|
|
3571
|
+
return pi.withIndex(+m.si);
|
|
3572
|
+
if (m.sk !== undefined)
|
|
3573
|
+
return pi.withKey(m.sk);
|
|
3574
|
+
return pi;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3507
3577
|
function resolvePathStep(comp, nodeIds, vid) {
|
|
3508
3578
|
for (let i = 0;i < nodeIds.length; i++) {
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
if (pi !== null)
|
|
3514
|
-
return si !== undefined ? pi.withIndex(+si) : sk ? pi.withKey(sk) : pi;
|
|
3579
|
+
const ctx = new StepCtx(comp, nodeIds, i, vid);
|
|
3580
|
+
const step = ctx.resolveNode().toPathStep(ctx);
|
|
3581
|
+
if (step !== null)
|
|
3582
|
+
return step;
|
|
3515
3583
|
}
|
|
3516
3584
|
return null;
|
|
3517
3585
|
}
|
|
@@ -4311,8 +4379,8 @@ class ANode extends BaseNode {
|
|
|
4311
4379
|
this.nodeId = nodeId;
|
|
4312
4380
|
this.val = val;
|
|
4313
4381
|
}
|
|
4314
|
-
|
|
4315
|
-
return this.val
|
|
4382
|
+
toPathStep(ctx) {
|
|
4383
|
+
return ctx.applyKey(this.val?.toPathItem?.() ?? null);
|
|
4316
4384
|
}
|
|
4317
4385
|
static parse(html, px) {
|
|
4318
4386
|
const nodes = px.parseHTML(html);
|
|
@@ -4530,7 +4598,15 @@ class RenderItNode extends RenderViewId {
|
|
|
4530
4598
|
const newStack = stack.enter(stack.it, {}, true);
|
|
4531
4599
|
return rx.renderIt(newStack, this.nodeId, "", this.viewId);
|
|
4532
4600
|
}
|
|
4533
|
-
|
|
4601
|
+
toPathStep(ctx) {
|
|
4602
|
+
const next = ctx.next();
|
|
4603
|
+
if (next === null)
|
|
4604
|
+
return null;
|
|
4605
|
+
const nextNode = next.resolveNode();
|
|
4606
|
+
if (nextNode instanceof EachNode && next.hasKey)
|
|
4607
|
+
return new EachRenderItStep(nextNode.val.name, next.key);
|
|
4608
|
+
return null;
|
|
4609
|
+
}
|
|
4534
4610
|
}
|
|
4535
4611
|
|
|
4536
4612
|
class RenderEachNode extends RenderViewId {
|
|
@@ -4626,7 +4702,7 @@ class ScopeNode extends WrapperNode {
|
|
|
4626
4702
|
const binds = this.val.eval(stack)?.call(stack.it) ?? {};
|
|
4627
4703
|
return this.node.render(stack.enter(stack.it, binds, false), rx);
|
|
4628
4704
|
}
|
|
4629
|
-
|
|
4705
|
+
toPathStep(_ctx) {
|
|
4630
4706
|
return new BindStep({});
|
|
4631
4707
|
}
|
|
4632
4708
|
wrapNode(node) {
|
|
@@ -4644,8 +4720,8 @@ class EachNode extends WrapperNode {
|
|
|
4644
4720
|
render(stack, rx) {
|
|
4645
4721
|
return rx.renderEachWhen(stack, this.iterInfo, this.node, this.nodeId);
|
|
4646
4722
|
}
|
|
4647
|
-
|
|
4648
|
-
return new
|
|
4723
|
+
toPathStep(ctx) {
|
|
4724
|
+
return ctx.hasKey ? new EachBindStep(this.val, ctx.key) : null;
|
|
4649
4725
|
}
|
|
4650
4726
|
static register = true;
|
|
4651
4727
|
}
|
|
@@ -8473,11 +8549,6 @@ class Stack {
|
|
|
8473
8549
|
_enrichOnEnter() {
|
|
8474
8550
|
return this.withDynamicBinds(this.comps.getOnEnterFor(this.it).call(this.it));
|
|
8475
8551
|
}
|
|
8476
|
-
upToFrameBinds() {
|
|
8477
|
-
const { comps, binds, dynBinds, views, viewsId, ctx } = this;
|
|
8478
|
-
const [head, tail] = binds;
|
|
8479
|
-
return head.isFrame ? this : new Stack(comps, tail[0].it, tail, dynBinds, views, viewsId, ctx);
|
|
8480
|
-
}
|
|
8481
8552
|
static root(comps, it, ctx) {
|
|
8482
8553
|
const binds = [new BindFrame(it, { it }, true), null];
|
|
8483
8554
|
const dynBinds = [new ObjectFrame({}), null];
|
|
@@ -8662,8 +8733,7 @@ class Transaction {
|
|
|
8662
8733
|
return Stack.root(comps, root);
|
|
8663
8734
|
}
|
|
8664
8735
|
buildStack(root, comps) {
|
|
8665
|
-
|
|
8666
|
-
return stack ? stack.upToFrameBinds() : null;
|
|
8736
|
+
return this.path.buildStack(this.buildRootStack(root, comps));
|
|
8667
8737
|
}
|
|
8668
8738
|
callHandler(root, instance, comps) {
|
|
8669
8739
|
const [handler, args] = this.getHandlerAndArgs(root, instance, comps);
|
|
@@ -14401,8 +14471,8 @@ class Renderer {
|
|
|
14401
14471
|
renderEachWhen(stack, iterInfo, view, nid) {
|
|
14402
14472
|
const { seq, filter, loopWith, enricher } = iterInfo.eval(stack);
|
|
14403
14473
|
const r = [];
|
|
14404
|
-
const iterData = loopWith.call(stack.it, seq);
|
|
14405
14474
|
const it = stack.it;
|
|
14475
|
+
const iterData = loopWith.call(it, seq);
|
|
14406
14476
|
this.getSeqInfo(seq)(seq, (key, value, attrName) => {
|
|
14407
14477
|
if (filter.call(it, key, value, iterData)) {
|
|
14408
14478
|
const cachePath = enricher ? [it, value] : [value];
|
|
@@ -14566,10 +14636,10 @@ async function compileClassesToStyle(app, compileClasses, styleId = "margaui-css
|
|
|
14566
14636
|
injectCss(styleId, css2);
|
|
14567
14637
|
return t2 - t1;
|
|
14568
14638
|
}
|
|
14569
|
-
async function compileClassesToStyleText(app, compileClasses,
|
|
14639
|
+
async function compileClassesToStyleText(app, compileClasses, Ctx = ParseCtxClassSetCollector) {
|
|
14570
14640
|
app.ParseContext = Ctx;
|
|
14571
14641
|
app.compile();
|
|
14572
|
-
const classes = new Set
|
|
14642
|
+
const classes = new Set;
|
|
14573
14643
|
for (const Comp of app.comps.byId.values()) {
|
|
14574
14644
|
for (const key in Comp.views) {
|
|
14575
14645
|
const view = Comp.views[key];
|