tutuca 0.9.45 → 0.9.46
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 +77 -31
- package/dist/tutuca-dev.js +81 -32
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.js +81 -32
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.js +79 -30
- 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
|
}
|
|
@@ -3929,12 +3929,27 @@ function findHandlers(comp, eventIds, vid, eventName) {
|
|
|
3929
3929
|
}
|
|
3930
3930
|
function resolvePathStep(comp, nodeIds, vid) {
|
|
3931
3931
|
for (let i = 0;i < nodeIds.length; i++) {
|
|
3932
|
-
const
|
|
3933
|
-
const
|
|
3934
|
-
const
|
|
3935
|
-
|
|
3932
|
+
const meta = nodeIds[i];
|
|
3933
|
+
const node = comp.getNodeForId(+meta.nid, vid);
|
|
3934
|
+
const key = meta.si !== undefined ? +meta.si : meta.sk;
|
|
3935
|
+
if (node.pathInNext) {
|
|
3936
|
+
const next = nodeIds[i + 1];
|
|
3937
|
+
if (!next)
|
|
3938
|
+
continue;
|
|
3939
|
+
const nextNode = comp.getNodeForId(+next.nid, vid);
|
|
3940
|
+
const nKey = next.si !== undefined ? +next.si : next.sk;
|
|
3941
|
+
if (nextNode.toPathItemRenderIt && nKey !== undefined)
|
|
3942
|
+
return nextNode.toPathItemRenderIt(nKey);
|
|
3943
|
+
const pi2 = nextNode.val.toPathItem();
|
|
3944
|
+
if (pi2 !== null)
|
|
3945
|
+
return next.si !== undefined ? pi2.withIndex(nKey) : next.sk ? pi2.withKey(nKey) : pi2;
|
|
3946
|
+
continue;
|
|
3947
|
+
}
|
|
3948
|
+
if (key !== undefined && node.toPathItemEachBind)
|
|
3949
|
+
return node.toPathItemEachBind(key);
|
|
3950
|
+
const pi = node.toPathItem();
|
|
3936
3951
|
if (pi !== null)
|
|
3937
|
-
return si !== undefined ? pi.withIndex(+si) : sk ? pi.withKey(sk) : pi;
|
|
3952
|
+
return meta.si !== undefined ? pi.withIndex(+meta.si) : meta.sk ? pi.withKey(meta.sk) : pi;
|
|
3938
3953
|
}
|
|
3939
3954
|
return null;
|
|
3940
3955
|
}
|
|
@@ -3957,8 +3972,9 @@ class PathBuilder {
|
|
|
3957
3972
|
return this.add(new SeqKeyStep(name, key));
|
|
3958
3973
|
}
|
|
3959
3974
|
}
|
|
3960
|
-
var BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep,
|
|
3975
|
+
var NONE, BindStep, FieldStep, FieldSeqStep, SeqKeyStep, SeqIndexStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO;
|
|
3961
3976
|
var init_path = __esm(() => {
|
|
3977
|
+
NONE = Symbol("NONE");
|
|
3962
3978
|
BindStep = class BindStep extends Step {
|
|
3963
3979
|
constructor(binds) {
|
|
3964
3980
|
super();
|
|
@@ -3970,16 +3986,15 @@ var init_path = __esm(() => {
|
|
|
3970
3986
|
setValue(_root, v) {
|
|
3971
3987
|
return v;
|
|
3972
3988
|
}
|
|
3989
|
+
enterFrame(stack, _prev, next) {
|
|
3990
|
+
return stack.enter(next, { ...this.binds }, false);
|
|
3991
|
+
}
|
|
3973
3992
|
withIndex(i) {
|
|
3974
3993
|
return new BindStep({ ...this.binds, key: i });
|
|
3975
3994
|
}
|
|
3976
3995
|
withKey(key) {
|
|
3977
3996
|
return new BindStep({ ...this.binds, key });
|
|
3978
3997
|
}
|
|
3979
|
-
updateBinds(_v, o) {
|
|
3980
|
-
Object.assign(o, this.binds);
|
|
3981
|
-
}
|
|
3982
|
-
isFrame = false;
|
|
3983
3998
|
};
|
|
3984
3999
|
FieldStep = class FieldStep extends Step {
|
|
3985
4000
|
constructor(field) {
|
|
@@ -4012,15 +4027,14 @@ var init_path = __esm(() => {
|
|
|
4012
4027
|
setValue(root, v) {
|
|
4013
4028
|
return root.set(this.field, root.get(this.field).set(this.key, v));
|
|
4014
4029
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4030
|
+
enterFrame(stack, _prev, next) {
|
|
4031
|
+
return stack.enter(next, { key: this.key }, true);
|
|
4017
4032
|
}
|
|
4018
4033
|
};
|
|
4019
4034
|
SeqKeyStep = class SeqKeyStep extends FieldSeqStep {
|
|
4020
4035
|
};
|
|
4021
4036
|
SeqIndexStep = class SeqIndexStep extends FieldSeqStep {
|
|
4022
4037
|
};
|
|
4023
|
-
NONE = Symbol("NONE");
|
|
4024
4038
|
SeqAccessStep = class SeqAccessStep extends Step {
|
|
4025
4039
|
constructor(seqField, keyField) {
|
|
4026
4040
|
super();
|
|
@@ -4037,8 +4051,40 @@ var init_path = __esm(() => {
|
|
|
4037
4051
|
const key = root?.get(this.keyField, NONE);
|
|
4038
4052
|
return seq === NONE || key === NONE ? root : root.set(this.seqField, seq.set(key, v));
|
|
4039
4053
|
}
|
|
4040
|
-
|
|
4041
|
-
|
|
4054
|
+
};
|
|
4055
|
+
EachBindStep = class EachBindStep extends Step {
|
|
4056
|
+
constructor(seqVal, key) {
|
|
4057
|
+
super();
|
|
4058
|
+
this.seqVal = seqVal;
|
|
4059
|
+
this.key = key;
|
|
4060
|
+
}
|
|
4061
|
+
lookup(v, _dval) {
|
|
4062
|
+
return v;
|
|
4063
|
+
}
|
|
4064
|
+
setValue(_root, v) {
|
|
4065
|
+
return v;
|
|
4066
|
+
}
|
|
4067
|
+
enterFrame(stack, _prev, next) {
|
|
4068
|
+
const item = this.seqVal.eval(stack)?.get(this.key, null);
|
|
4069
|
+
return stack.enter(next, { key: this.key, value: item }, false);
|
|
4070
|
+
}
|
|
4071
|
+
};
|
|
4072
|
+
EachRenderItStep = class EachRenderItStep extends Step {
|
|
4073
|
+
constructor(seqField, key) {
|
|
4074
|
+
super();
|
|
4075
|
+
this.seqField = seqField;
|
|
4076
|
+
this.key = key;
|
|
4077
|
+
}
|
|
4078
|
+
lookup(v, dval = null) {
|
|
4079
|
+
const seq = v?.get(this.seqField, null);
|
|
4080
|
+
return seq?.get ? seq.get(this.key, dval) : dval;
|
|
4081
|
+
}
|
|
4082
|
+
setValue(root, v) {
|
|
4083
|
+
const seq = root?.get(this.seqField, null);
|
|
4084
|
+
return seq ? root.set(this.seqField, seq.set(this.key, v)) : root;
|
|
4085
|
+
}
|
|
4086
|
+
enterFrame(stack, _prev, next) {
|
|
4087
|
+
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
4042
4088
|
}
|
|
4043
4089
|
};
|
|
4044
4090
|
EMPTY_META = {};
|
|
@@ -5270,6 +5316,12 @@ var init_anode = __esm(() => {
|
|
|
5270
5316
|
toPathItem() {
|
|
5271
5317
|
return new BindStep({});
|
|
5272
5318
|
}
|
|
5319
|
+
toPathItemRenderIt(key) {
|
|
5320
|
+
return new EachRenderItStep(this.val.name, key);
|
|
5321
|
+
}
|
|
5322
|
+
toPathItemEachBind(key) {
|
|
5323
|
+
return new EachBindStep(this.val, key);
|
|
5324
|
+
}
|
|
5273
5325
|
static register = true;
|
|
5274
5326
|
};
|
|
5275
5327
|
X_OP_CONSUMED = {
|
|
@@ -8161,11 +8213,6 @@ class Stack {
|
|
|
8161
8213
|
_enrichOnEnter() {
|
|
8162
8214
|
return this.withDynamicBinds(this.comps.getOnEnterFor(this.it).call(this.it));
|
|
8163
8215
|
}
|
|
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
8216
|
static root(comps, it, ctx) {
|
|
8170
8217
|
const binds = [new BindFrame(it, { it }, true), null];
|
|
8171
8218
|
const dynBinds = [new ObjectFrame({}), null];
|
|
@@ -8355,8 +8402,7 @@ class Transaction {
|
|
|
8355
8402
|
return Stack.root(comps, root);
|
|
8356
8403
|
}
|
|
8357
8404
|
buildStack(root, comps) {
|
|
8358
|
-
|
|
8359
|
-
return stack ? stack.upToFrameBinds() : null;
|
|
8405
|
+
return this.path.buildStack(this.buildRootStack(root, comps));
|
|
8360
8406
|
}
|
|
8361
8407
|
callHandler(root, instance, comps) {
|
|
8362
8408
|
const [handler, args] = this.getHandlerAndArgs(root, instance, comps);
|
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
|
}
|
|
@@ -3506,12 +3540,27 @@ function findHandlers(comp, eventIds, vid, eventName) {
|
|
|
3506
3540
|
}
|
|
3507
3541
|
function resolvePathStep(comp, nodeIds, vid) {
|
|
3508
3542
|
for (let i = 0;i < nodeIds.length; i++) {
|
|
3509
|
-
const
|
|
3510
|
-
const
|
|
3511
|
-
const
|
|
3512
|
-
|
|
3543
|
+
const meta = nodeIds[i];
|
|
3544
|
+
const node = comp.getNodeForId(+meta.nid, vid);
|
|
3545
|
+
const key = meta.si !== undefined ? +meta.si : meta.sk;
|
|
3546
|
+
if (node.pathInNext) {
|
|
3547
|
+
const next = nodeIds[i + 1];
|
|
3548
|
+
if (!next)
|
|
3549
|
+
continue;
|
|
3550
|
+
const nextNode = comp.getNodeForId(+next.nid, vid);
|
|
3551
|
+
const nKey = next.si !== undefined ? +next.si : next.sk;
|
|
3552
|
+
if (nextNode.toPathItemRenderIt && nKey !== undefined)
|
|
3553
|
+
return nextNode.toPathItemRenderIt(nKey);
|
|
3554
|
+
const pi2 = nextNode.val.toPathItem();
|
|
3555
|
+
if (pi2 !== null)
|
|
3556
|
+
return next.si !== undefined ? pi2.withIndex(nKey) : next.sk ? pi2.withKey(nKey) : pi2;
|
|
3557
|
+
continue;
|
|
3558
|
+
}
|
|
3559
|
+
if (key !== undefined && node.toPathItemEachBind)
|
|
3560
|
+
return node.toPathItemEachBind(key);
|
|
3561
|
+
const pi = node.toPathItem();
|
|
3513
3562
|
if (pi !== null)
|
|
3514
|
-
return si !== undefined ? pi.withIndex(+si) : sk ? pi.withKey(sk) : pi;
|
|
3563
|
+
return meta.si !== undefined ? pi.withIndex(+meta.si) : meta.sk ? pi.withKey(meta.sk) : pi;
|
|
3515
3564
|
}
|
|
3516
3565
|
return null;
|
|
3517
3566
|
}
|
|
@@ -4647,6 +4696,12 @@ class EachNode extends WrapperNode {
|
|
|
4647
4696
|
toPathItem() {
|
|
4648
4697
|
return new BindStep({});
|
|
4649
4698
|
}
|
|
4699
|
+
toPathItemRenderIt(key) {
|
|
4700
|
+
return new EachRenderItStep(this.val.name, key);
|
|
4701
|
+
}
|
|
4702
|
+
toPathItemEachBind(key) {
|
|
4703
|
+
return new EachBindStep(this.val, key);
|
|
4704
|
+
}
|
|
4650
4705
|
static register = true;
|
|
4651
4706
|
}
|
|
4652
4707
|
|
|
@@ -8473,11 +8528,6 @@ class Stack {
|
|
|
8473
8528
|
_enrichOnEnter() {
|
|
8474
8529
|
return this.withDynamicBinds(this.comps.getOnEnterFor(this.it).call(this.it));
|
|
8475
8530
|
}
|
|
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
8531
|
static root(comps, it, ctx) {
|
|
8482
8532
|
const binds = [new BindFrame(it, { it }, true), null];
|
|
8483
8533
|
const dynBinds = [new ObjectFrame({}), null];
|
|
@@ -8662,8 +8712,7 @@ class Transaction {
|
|
|
8662
8712
|
return Stack.root(comps, root);
|
|
8663
8713
|
}
|
|
8664
8714
|
buildStack(root, comps) {
|
|
8665
|
-
|
|
8666
|
-
return stack ? stack.upToFrameBinds() : null;
|
|
8715
|
+
return this.path.buildStack(this.buildRootStack(root, comps));
|
|
8667
8716
|
}
|
|
8668
8717
|
callHandler(root, instance, comps) {
|
|
8669
8718
|
const [handler, args] = this.getHandlerAndArgs(root, instance, comps);
|
|
@@ -14566,10 +14615,10 @@ async function compileClassesToStyle(app, compileClasses, styleId = "margaui-css
|
|
|
14566
14615
|
injectCss(styleId, css2);
|
|
14567
14616
|
return t2 - t1;
|
|
14568
14617
|
}
|
|
14569
|
-
async function compileClassesToStyleText(app, compileClasses,
|
|
14618
|
+
async function compileClassesToStyleText(app, compileClasses, Ctx = ParseCtxClassSetCollector) {
|
|
14570
14619
|
app.ParseContext = Ctx;
|
|
14571
14620
|
app.compile();
|
|
14572
|
-
const classes = new Set
|
|
14621
|
+
const classes = new Set;
|
|
14573
14622
|
for (const Comp of app.comps.byId.values()) {
|
|
14574
14623
|
for (const key in Comp.views) {
|
|
14575
14624
|
const view = Comp.views[key];
|