tutuca 0.9.57 → 0.9.58
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 +52 -40
- package/dist/tutuca-dev.js +58 -53
- package/dist/tutuca-dev.min.js +3 -3
- package/dist/tutuca-extra.js +58 -53
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca.js +58 -53
- package/dist/tutuca.min.js +3 -3
- package/package.json +1 -1
package/dist/tutuca-cli.js
CHANGED
|
@@ -3864,6 +3864,9 @@ class Step {
|
|
|
3864
3864
|
enterFrame(stack, _prev, next) {
|
|
3865
3865
|
return stack.enter(next, {}, true);
|
|
3866
3866
|
}
|
|
3867
|
+
toAbstractPathStep() {
|
|
3868
|
+
return this;
|
|
3869
|
+
}
|
|
3867
3870
|
}
|
|
3868
3871
|
|
|
3869
3872
|
class Path {
|
|
@@ -3876,6 +3879,15 @@ class Path {
|
|
|
3876
3879
|
popStep() {
|
|
3877
3880
|
return new Path(this.steps.slice(0, -1));
|
|
3878
3881
|
}
|
|
3882
|
+
compact() {
|
|
3883
|
+
const out = [];
|
|
3884
|
+
for (const step of this.steps) {
|
|
3885
|
+
const s = step.toAbstractPathStep();
|
|
3886
|
+
if (s !== null)
|
|
3887
|
+
out.push(s);
|
|
3888
|
+
}
|
|
3889
|
+
return new Path(out);
|
|
3890
|
+
}
|
|
3879
3891
|
lookup(v, dval = null) {
|
|
3880
3892
|
let curVal = v;
|
|
3881
3893
|
for (const step of this.steps) {
|
|
@@ -3928,7 +3940,7 @@ class Path {
|
|
|
3928
3940
|
if (eid !== undefined)
|
|
3929
3941
|
eventIds.push(eid);
|
|
3930
3942
|
if (cid !== undefined) {
|
|
3931
|
-
const comp = comps.getComponentForId(+cid
|
|
3943
|
+
const comp = comps.getComponentForId(+cid);
|
|
3932
3944
|
if (isLeafComponent) {
|
|
3933
3945
|
handlers = findHandlers(comp, eventIds, vid, eventName);
|
|
3934
3946
|
if (handlers === null && stopOnNoEvent)
|
|
@@ -4033,13 +4045,13 @@ class PathBuilder {
|
|
|
4033
4045
|
return this.add(new FieldStep(name));
|
|
4034
4046
|
}
|
|
4035
4047
|
index(name, index) {
|
|
4036
|
-
return this.add(new
|
|
4048
|
+
return this.add(new SeqStep(name, index));
|
|
4037
4049
|
}
|
|
4038
4050
|
key(name, key) {
|
|
4039
|
-
return this.add(new
|
|
4051
|
+
return this.add(new SeqStep(name, key));
|
|
4040
4052
|
}
|
|
4041
4053
|
}
|
|
4042
|
-
var NONE, BindStep, FieldStep,
|
|
4054
|
+
var NONE, BindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO;
|
|
4043
4055
|
var init_path = __esm(() => {
|
|
4044
4056
|
NONE = Symbol("NONE");
|
|
4045
4057
|
BindStep = class BindStep extends Step {
|
|
@@ -4062,6 +4074,9 @@ var init_path = __esm(() => {
|
|
|
4062
4074
|
withKey(key) {
|
|
4063
4075
|
return new BindStep({ ...this.binds, key });
|
|
4064
4076
|
}
|
|
4077
|
+
toAbstractPathStep() {
|
|
4078
|
+
return null;
|
|
4079
|
+
}
|
|
4065
4080
|
};
|
|
4066
4081
|
FieldStep = class FieldStep extends Step {
|
|
4067
4082
|
constructor(field) {
|
|
@@ -4075,13 +4090,13 @@ var init_path = __esm(() => {
|
|
|
4075
4090
|
return root.set(this.field, v);
|
|
4076
4091
|
}
|
|
4077
4092
|
withIndex(i) {
|
|
4078
|
-
return new
|
|
4093
|
+
return new SeqStep(this.field, i);
|
|
4079
4094
|
}
|
|
4080
4095
|
withKey(k) {
|
|
4081
|
-
return new
|
|
4096
|
+
return new SeqStep(this.field, k);
|
|
4082
4097
|
}
|
|
4083
4098
|
};
|
|
4084
|
-
|
|
4099
|
+
SeqStep = class SeqStep extends Step {
|
|
4085
4100
|
constructor(field, key) {
|
|
4086
4101
|
super();
|
|
4087
4102
|
this.field = field;
|
|
@@ -4092,16 +4107,13 @@ var init_path = __esm(() => {
|
|
|
4092
4107
|
return o?.get ? o.get(this.key, dval) : dval;
|
|
4093
4108
|
}
|
|
4094
4109
|
setValue(root, v) {
|
|
4095
|
-
|
|
4110
|
+
const seq = root?.get(this.field, null);
|
|
4111
|
+
return seq ? root.set(this.field, seq.set(this.key, v)) : root;
|
|
4096
4112
|
}
|
|
4097
4113
|
enterFrame(stack, _prev, next) {
|
|
4098
4114
|
return stack.enter(next, { key: this.key }, true);
|
|
4099
4115
|
}
|
|
4100
4116
|
};
|
|
4101
|
-
SeqKeyStep = class SeqKeyStep extends FieldSeqStep {
|
|
4102
|
-
};
|
|
4103
|
-
SeqIndexStep = class SeqIndexStep extends FieldSeqStep {
|
|
4104
|
-
};
|
|
4105
4117
|
SeqAccessStep = class SeqAccessStep extends Step {
|
|
4106
4118
|
constructor(seqField, keyField) {
|
|
4107
4119
|
super();
|
|
@@ -4135,24 +4147,17 @@ var init_path = __esm(() => {
|
|
|
4135
4147
|
const item = this.seqVal.eval(stack)?.get(this.key, null);
|
|
4136
4148
|
return stack.enter(next, { key: this.key, value: item }, false);
|
|
4137
4149
|
}
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
constructor(seqField, key) {
|
|
4141
|
-
super();
|
|
4142
|
-
this.seqField = seqField;
|
|
4143
|
-
this.key = key;
|
|
4144
|
-
}
|
|
4145
|
-
lookup(v, dval = null) {
|
|
4146
|
-
const seq = v?.get(this.seqField, null);
|
|
4147
|
-
return seq?.get ? seq.get(this.key, dval) : dval;
|
|
4148
|
-
}
|
|
4149
|
-
setValue(root, v) {
|
|
4150
|
-
const seq = root?.get(this.seqField, null);
|
|
4151
|
-
return seq ? root.set(this.seqField, seq.set(this.key, v)) : root;
|
|
4150
|
+
toAbstractPathStep() {
|
|
4151
|
+
return null;
|
|
4152
4152
|
}
|
|
4153
|
+
};
|
|
4154
|
+
EachRenderItStep = class EachRenderItStep extends SeqStep {
|
|
4153
4155
|
enterFrame(stack, _prev, next) {
|
|
4154
4156
|
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
4155
4157
|
}
|
|
4158
|
+
toAbstractPathStep() {
|
|
4159
|
+
return new SeqStep(this.field, this.key);
|
|
4160
|
+
}
|
|
4156
4161
|
};
|
|
4157
4162
|
EMPTY_META = {};
|
|
4158
4163
|
NO_EVENT_INFO = [null, null];
|
|
@@ -4473,7 +4478,7 @@ var init_value = __esm(() => {
|
|
|
4473
4478
|
}
|
|
4474
4479
|
eval(stack) {
|
|
4475
4480
|
const key = this.keyVal.eval(stack);
|
|
4476
|
-
return this.seqVal.eval(stack)
|
|
4481
|
+
return this.seqVal.eval(stack)?.get(key, null);
|
|
4477
4482
|
}
|
|
4478
4483
|
toString() {
|
|
4479
4484
|
return `${this.seqVal}[${this.keyVal}]`;
|
|
@@ -8519,9 +8524,9 @@ class Transactor {
|
|
|
8519
8524
|
pushSend(path, name, args = [], opts = {}, parent = null) {
|
|
8520
8525
|
this.pushTransaction(new SendEvent(path, this, name, args, parent, opts));
|
|
8521
8526
|
}
|
|
8522
|
-
pushBubble(path, name, args = [], opts = {}, parent = null) {
|
|
8527
|
+
pushBubble(path, name, args = [], opts = {}, parent = null, targetPath = null) {
|
|
8523
8528
|
const newOpts = opts.skipSelf ? { ...opts, skipSelf: false } : opts;
|
|
8524
|
-
this.pushTransaction(new BubbleEvent(path, this, name, args, parent, newOpts));
|
|
8529
|
+
this.pushTransaction(new BubbleEvent(path, this, name, args, parent, newOpts, targetPath));
|
|
8525
8530
|
}
|
|
8526
8531
|
async pushRequest(path, name, args = [], opts = {}, parent = null) {
|
|
8527
8532
|
const curRoot = this.state.val;
|
|
@@ -8620,8 +8625,7 @@ function getValue(e) {
|
|
|
8620
8625
|
}
|
|
8621
8626
|
|
|
8622
8627
|
class Task {
|
|
8623
|
-
constructor(
|
|
8624
|
-
this.info = info;
|
|
8628
|
+
constructor() {
|
|
8625
8629
|
this.deps = [];
|
|
8626
8630
|
this.val = this.resolve = this.reject = null;
|
|
8627
8631
|
this.promise = new Promise((res, rej) => {
|
|
@@ -8693,14 +8697,15 @@ var init_transactor = __esm(() => {
|
|
|
8693
8697
|
getHandlerAndArgs(root, _instance, comps) {
|
|
8694
8698
|
const stack = this.buildStack(root, comps);
|
|
8695
8699
|
const [handler, args] = this.handler.getHandlerAndArgs(stack, this);
|
|
8700
|
+
const path = this.path.compact();
|
|
8696
8701
|
let dispatcher;
|
|
8697
8702
|
for (let i = 0;i < args.length; i++) {
|
|
8698
8703
|
if (args[i]?.toHandlerArg) {
|
|
8699
|
-
dispatcher ??= new Dispatcher(
|
|
8704
|
+
dispatcher ??= new Dispatcher(path, this.transactor, this);
|
|
8700
8705
|
args[i] = args[i].toHandlerArg(dispatcher);
|
|
8701
8706
|
}
|
|
8702
8707
|
}
|
|
8703
|
-
args.push(new EventContext(
|
|
8708
|
+
args.push(new EventContext(path, this.transactor, this));
|
|
8704
8709
|
return [handler, args];
|
|
8705
8710
|
}
|
|
8706
8711
|
lookupName(name) {
|
|
@@ -8751,6 +8756,7 @@ var init_transactor = __esm(() => {
|
|
|
8751
8756
|
this.name = name;
|
|
8752
8757
|
this.args = args;
|
|
8753
8758
|
this.opts = opts;
|
|
8759
|
+
this.targetPath = path;
|
|
8754
8760
|
}
|
|
8755
8761
|
handlerProp = null;
|
|
8756
8762
|
getHandlerForName(comp) {
|
|
@@ -8771,13 +8777,17 @@ var init_transactor = __esm(() => {
|
|
|
8771
8777
|
return this.opts.skipSelf ? rootVal : this.updateRootValue(rootVal, comps);
|
|
8772
8778
|
}
|
|
8773
8779
|
afterTransaction() {
|
|
8774
|
-
const { path, name, args, opts } = this;
|
|
8780
|
+
const { path, name, args, opts, targetPath } = this;
|
|
8775
8781
|
if (opts.bubbles && path.steps.length > 0)
|
|
8776
|
-
this.transactor.pushBubble(path.popStep(), name, args, opts, this);
|
|
8782
|
+
this.transactor.pushBubble(path.popStep(), name, args, opts, this, targetPath);
|
|
8777
8783
|
}
|
|
8778
8784
|
};
|
|
8779
8785
|
BubbleEvent = class BubbleEvent extends SendEvent {
|
|
8780
8786
|
handlerProp = "bubble";
|
|
8787
|
+
constructor(path, transactor, name, args, parent, opts, targetPath) {
|
|
8788
|
+
super(path, transactor, name, args, parent, opts);
|
|
8789
|
+
this.targetPath = targetPath ?? path;
|
|
8790
|
+
}
|
|
8781
8791
|
stopPropagation() {
|
|
8782
8792
|
this.opts.bubbles = false;
|
|
8783
8793
|
}
|
|
@@ -8786,6 +8796,9 @@ var init_transactor = __esm(() => {
|
|
|
8786
8796
|
get name() {
|
|
8787
8797
|
return this.parent?.name ?? null;
|
|
8788
8798
|
}
|
|
8799
|
+
get targetPath() {
|
|
8800
|
+
return this.parent.targetPath;
|
|
8801
|
+
}
|
|
8789
8802
|
stopPropagation() {
|
|
8790
8803
|
return this.parent.stopPropagation();
|
|
8791
8804
|
}
|
|
@@ -9199,7 +9212,7 @@ class App {
|
|
|
9199
9212
|
if (!_touch.active) {
|
|
9200
9213
|
const dx = clientX - _touch.startX;
|
|
9201
9214
|
const dy = clientY - _touch.startY;
|
|
9202
|
-
if (dx * dx + dy * dy <
|
|
9215
|
+
if (dx * dx + dy * dy < 100)
|
|
9203
9216
|
return;
|
|
9204
9217
|
_touch.active = true;
|
|
9205
9218
|
e.preventDefault();
|
|
@@ -9376,7 +9389,7 @@ class DragInfo {
|
|
|
9376
9389
|
return this.stack.lookupBind(name);
|
|
9377
9390
|
}
|
|
9378
9391
|
}
|
|
9379
|
-
var _evs,
|
|
9392
|
+
var _evs, NOOP = () => {}, listenerOpts = (name) => name === "touchmove" ? { passive: false } : undefined;
|
|
9380
9393
|
var init_app = __esm(() => {
|
|
9381
9394
|
init_components();
|
|
9382
9395
|
init_path();
|
|
@@ -9384,7 +9397,6 @@ var init_app = __esm(() => {
|
|
|
9384
9397
|
init_transactor();
|
|
9385
9398
|
init_vdom();
|
|
9386
9399
|
_evs = "dragstart dragover dragend touchstart touchmove touchend touchcancel".split(" ");
|
|
9387
|
-
TOUCH_DRAG_THRESHOLD_SQ = TOUCH_DRAG_THRESHOLD_PX * TOUCH_DRAG_THRESHOLD_PX;
|
|
9388
9400
|
});
|
|
9389
9401
|
|
|
9390
9402
|
// deps/immutable.js
|
|
@@ -13709,7 +13721,7 @@ class Renderer {
|
|
|
13709
13721
|
}
|
|
13710
13722
|
renderRoot(stack, val, viewName = null) {
|
|
13711
13723
|
const comp = this.comps.getCompFor(val);
|
|
13712
|
-
const nid = comp
|
|
13724
|
+
const nid = comp?.getView(viewName).anode.nodeId ?? null;
|
|
13713
13725
|
return comp ? this._rValComp(stack, val, comp, nid, "ROOT", viewName) : null;
|
|
13714
13726
|
}
|
|
13715
13727
|
renderIt(stack, nodeId, key, viewName) {
|
|
@@ -13717,7 +13729,7 @@ class Renderer {
|
|
|
13717
13729
|
return comp ? this._rValComp(stack, stack.it, comp, nodeId, key, viewName) : null;
|
|
13718
13730
|
}
|
|
13719
13731
|
_rValComp(stack, val, comp, nid, key, viewName) {
|
|
13720
|
-
const cacheKey = `${viewName ?? stack.viewsId ?? ""}
|
|
13732
|
+
const cacheKey = `${viewName ?? stack.viewsId ?? ""}-${nid}-${key}`;
|
|
13721
13733
|
const cachePath = [val];
|
|
13722
13734
|
stack._pushDynBindValuesToArray(cachePath, comp.dynamic);
|
|
13723
13735
|
const cachedNode = this.cache.get(cachePath, cacheKey);
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -3306,6 +3306,9 @@ class Step {
|
|
|
3306
3306
|
enterFrame(stack, _prev, next) {
|
|
3307
3307
|
return stack.enter(next, {}, true);
|
|
3308
3308
|
}
|
|
3309
|
+
toAbstractPathStep() {
|
|
3310
|
+
return this;
|
|
3311
|
+
}
|
|
3309
3312
|
}
|
|
3310
3313
|
|
|
3311
3314
|
class BindStep extends Step {
|
|
@@ -3328,6 +3331,9 @@ class BindStep extends Step {
|
|
|
3328
3331
|
withKey(key) {
|
|
3329
3332
|
return new BindStep({ ...this.binds, key });
|
|
3330
3333
|
}
|
|
3334
|
+
toAbstractPathStep() {
|
|
3335
|
+
return null;
|
|
3336
|
+
}
|
|
3331
3337
|
}
|
|
3332
3338
|
|
|
3333
3339
|
class FieldStep extends Step {
|
|
@@ -3342,14 +3348,14 @@ class FieldStep extends Step {
|
|
|
3342
3348
|
return root.set(this.field, v);
|
|
3343
3349
|
}
|
|
3344
3350
|
withIndex(i) {
|
|
3345
|
-
return new
|
|
3351
|
+
return new SeqStep(this.field, i);
|
|
3346
3352
|
}
|
|
3347
3353
|
withKey(k) {
|
|
3348
|
-
return new
|
|
3354
|
+
return new SeqStep(this.field, k);
|
|
3349
3355
|
}
|
|
3350
3356
|
}
|
|
3351
3357
|
|
|
3352
|
-
class
|
|
3358
|
+
class SeqStep extends Step {
|
|
3353
3359
|
constructor(field, key) {
|
|
3354
3360
|
super();
|
|
3355
3361
|
this.field = field;
|
|
@@ -3360,19 +3366,14 @@ class FieldSeqStep extends Step {
|
|
|
3360
3366
|
return o?.get ? o.get(this.key, dval) : dval;
|
|
3361
3367
|
}
|
|
3362
3368
|
setValue(root, v) {
|
|
3363
|
-
|
|
3369
|
+
const seq = root?.get(this.field, null);
|
|
3370
|
+
return seq ? root.set(this.field, seq.set(this.key, v)) : root;
|
|
3364
3371
|
}
|
|
3365
3372
|
enterFrame(stack, _prev, next) {
|
|
3366
3373
|
return stack.enter(next, { key: this.key }, true);
|
|
3367
3374
|
}
|
|
3368
3375
|
}
|
|
3369
3376
|
|
|
3370
|
-
class SeqKeyStep extends FieldSeqStep {
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
class SeqIndexStep extends FieldSeqStep {
|
|
3374
|
-
}
|
|
3375
|
-
|
|
3376
3377
|
class SeqAccessStep extends Step {
|
|
3377
3378
|
constructor(seqField, keyField) {
|
|
3378
3379
|
super();
|
|
@@ -3407,25 +3408,18 @@ class EachBindStep extends Step {
|
|
|
3407
3408
|
const item = this.seqVal.eval(stack)?.get(this.key, null);
|
|
3408
3409
|
return stack.enter(next, { key: this.key, value: item }, false);
|
|
3409
3410
|
}
|
|
3411
|
+
toAbstractPathStep() {
|
|
3412
|
+
return null;
|
|
3413
|
+
}
|
|
3410
3414
|
}
|
|
3411
3415
|
|
|
3412
|
-
class EachRenderItStep extends
|
|
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
|
-
}
|
|
3416
|
+
class EachRenderItStep extends SeqStep {
|
|
3426
3417
|
enterFrame(stack, _prev, next) {
|
|
3427
3418
|
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
3428
3419
|
}
|
|
3420
|
+
toAbstractPathStep() {
|
|
3421
|
+
return new SeqStep(this.field, this.key);
|
|
3422
|
+
}
|
|
3429
3423
|
}
|
|
3430
3424
|
|
|
3431
3425
|
class Path {
|
|
@@ -3438,6 +3432,15 @@ class Path {
|
|
|
3438
3432
|
popStep() {
|
|
3439
3433
|
return new Path(this.steps.slice(0, -1));
|
|
3440
3434
|
}
|
|
3435
|
+
compact() {
|
|
3436
|
+
const out = [];
|
|
3437
|
+
for (const step of this.steps) {
|
|
3438
|
+
const s = step.toAbstractPathStep();
|
|
3439
|
+
if (s !== null)
|
|
3440
|
+
out.push(s);
|
|
3441
|
+
}
|
|
3442
|
+
return new Path(out);
|
|
3443
|
+
}
|
|
3441
3444
|
lookup(v, dval = null) {
|
|
3442
3445
|
let curVal = v;
|
|
3443
3446
|
for (const step of this.steps) {
|
|
@@ -3490,7 +3493,7 @@ class Path {
|
|
|
3490
3493
|
if (eid !== undefined)
|
|
3491
3494
|
eventIds.push(eid);
|
|
3492
3495
|
if (cid !== undefined) {
|
|
3493
|
-
const comp = comps.getComponentForId(+cid
|
|
3496
|
+
const comp = comps.getComponentForId(+cid);
|
|
3494
3497
|
if (isLeafComponent) {
|
|
3495
3498
|
handlers = findHandlers(comp, eventIds, vid, eventName);
|
|
3496
3499
|
if (handlers === null && stopOnNoEvent)
|
|
@@ -3597,10 +3600,10 @@ class PathBuilder {
|
|
|
3597
3600
|
return this.add(new FieldStep(name));
|
|
3598
3601
|
}
|
|
3599
3602
|
index(name, index) {
|
|
3600
|
-
return this.add(new
|
|
3603
|
+
return this.add(new SeqStep(name, index));
|
|
3601
3604
|
}
|
|
3602
3605
|
key(name, key) {
|
|
3603
|
-
return this.add(new
|
|
3606
|
+
return this.add(new SeqStep(name, key));
|
|
3604
3607
|
}
|
|
3605
3608
|
}
|
|
3606
3609
|
|
|
@@ -3917,7 +3920,7 @@ class SeqAccessVal extends RenderVal {
|
|
|
3917
3920
|
}
|
|
3918
3921
|
eval(stack) {
|
|
3919
3922
|
const key = this.keyVal.eval(stack);
|
|
3920
|
-
return this.seqVal.eval(stack)
|
|
3923
|
+
return this.seqVal.eval(stack)?.get(key, null);
|
|
3921
3924
|
}
|
|
3922
3925
|
toString() {
|
|
3923
3926
|
return `${this.seqVal}[${this.keyVal}]`;
|
|
@@ -8645,6 +8648,8 @@ class Component {
|
|
|
8645
8648
|
this.extra[key] = o[key];
|
|
8646
8649
|
}
|
|
8647
8650
|
compile(ParseContext2) {
|
|
8651
|
+
for (const name in this.views)
|
|
8652
|
+
this.views[name].compile(new ParseContext2, this.scope, this.id);
|
|
8648
8653
|
for (const key in this._rawDynamic) {
|
|
8649
8654
|
const dinfo = this._rawDynamic[key];
|
|
8650
8655
|
if (isString(dinfo)) {
|
|
@@ -8657,8 +8662,6 @@ class Component {
|
|
|
8657
8662
|
this.dynamic[key] = new DynamicAlias(key, val, compName, dynName);
|
|
8658
8663
|
}
|
|
8659
8664
|
}
|
|
8660
|
-
for (const name in this.views)
|
|
8661
|
-
this.views[name].compile(new ParseContext2, this.scope, this.id);
|
|
8662
8665
|
}
|
|
8663
8666
|
make(args, opts) {
|
|
8664
8667
|
return this.Class.make(args, opts);
|
|
@@ -8857,9 +8860,9 @@ class Transactor {
|
|
|
8857
8860
|
pushSend(path, name, args = [], opts = {}, parent = null) {
|
|
8858
8861
|
this.pushTransaction(new SendEvent(path, this, name, args, parent, opts));
|
|
8859
8862
|
}
|
|
8860
|
-
pushBubble(path, name, args = [], opts = {}, parent = null) {
|
|
8863
|
+
pushBubble(path, name, args = [], opts = {}, parent = null, targetPath = null) {
|
|
8861
8864
|
const newOpts = opts.skipSelf ? { ...opts, skipSelf: false } : opts;
|
|
8862
|
-
this.pushTransaction(new BubbleEvent(path, this, name, args, parent, newOpts));
|
|
8865
|
+
this.pushTransaction(new BubbleEvent(path, this, name, args, parent, newOpts, targetPath));
|
|
8863
8866
|
}
|
|
8864
8867
|
async pushRequest(path, name, args = [], opts = {}, parent = null) {
|
|
8865
8868
|
const curRoot = this.state.val;
|
|
@@ -8972,14 +8975,15 @@ class InputEvent extends Transaction {
|
|
|
8972
8975
|
getHandlerAndArgs(root, _instance, comps) {
|
|
8973
8976
|
const stack = this.buildStack(root, comps);
|
|
8974
8977
|
const [handler, args] = this.handler.getHandlerAndArgs(stack, this);
|
|
8978
|
+
const path = this.path.compact();
|
|
8975
8979
|
let dispatcher;
|
|
8976
8980
|
for (let i = 0;i < args.length; i++) {
|
|
8977
8981
|
if (args[i]?.toHandlerArg) {
|
|
8978
|
-
dispatcher ??= new Dispatcher(
|
|
8982
|
+
dispatcher ??= new Dispatcher(path, this.transactor, this);
|
|
8979
8983
|
args[i] = args[i].toHandlerArg(dispatcher);
|
|
8980
8984
|
}
|
|
8981
8985
|
}
|
|
8982
|
-
args.push(new EventContext(
|
|
8986
|
+
args.push(new EventContext(path, this.transactor, this));
|
|
8983
8987
|
return [handler, args];
|
|
8984
8988
|
}
|
|
8985
8989
|
lookupName(name) {
|
|
@@ -9031,6 +9035,7 @@ class NameArgsTransaction extends Transaction {
|
|
|
9031
9035
|
this.name = name;
|
|
9032
9036
|
this.args = args;
|
|
9033
9037
|
this.opts = opts;
|
|
9038
|
+
this.targetPath = path;
|
|
9034
9039
|
}
|
|
9035
9040
|
handlerProp = null;
|
|
9036
9041
|
getHandlerForName(comp) {
|
|
@@ -9053,22 +9058,25 @@ class SendEvent extends NameArgsTransaction {
|
|
|
9053
9058
|
return this.opts.skipSelf ? rootVal : this.updateRootValue(rootVal, comps);
|
|
9054
9059
|
}
|
|
9055
9060
|
afterTransaction() {
|
|
9056
|
-
const { path, name, args, opts } = this;
|
|
9061
|
+
const { path, name, args, opts, targetPath } = this;
|
|
9057
9062
|
if (opts.bubbles && path.steps.length > 0)
|
|
9058
|
-
this.transactor.pushBubble(path.popStep(), name, args, opts, this);
|
|
9063
|
+
this.transactor.pushBubble(path.popStep(), name, args, opts, this, targetPath);
|
|
9059
9064
|
}
|
|
9060
9065
|
}
|
|
9061
9066
|
|
|
9062
9067
|
class BubbleEvent extends SendEvent {
|
|
9063
9068
|
handlerProp = "bubble";
|
|
9069
|
+
constructor(path, transactor, name, args, parent, opts, targetPath) {
|
|
9070
|
+
super(path, transactor, name, args, parent, opts);
|
|
9071
|
+
this.targetPath = targetPath ?? path;
|
|
9072
|
+
}
|
|
9064
9073
|
stopPropagation() {
|
|
9065
9074
|
this.opts.bubbles = false;
|
|
9066
9075
|
}
|
|
9067
9076
|
}
|
|
9068
9077
|
|
|
9069
9078
|
class Task {
|
|
9070
|
-
constructor(
|
|
9071
|
-
this.info = info;
|
|
9079
|
+
constructor() {
|
|
9072
9080
|
this.deps = [];
|
|
9073
9081
|
this.val = this.resolve = this.reject = null;
|
|
9074
9082
|
this.promise = new Promise((res, rej) => {
|
|
@@ -9127,6 +9135,9 @@ class EventContext extends Dispatcher {
|
|
|
9127
9135
|
get name() {
|
|
9128
9136
|
return this.parent?.name ?? null;
|
|
9129
9137
|
}
|
|
9138
|
+
get targetPath() {
|
|
9139
|
+
return this.parent.targetPath;
|
|
9140
|
+
}
|
|
9130
9141
|
stopPropagation() {
|
|
9131
9142
|
return this.parent.stopPropagation();
|
|
9132
9143
|
}
|
|
@@ -9546,7 +9557,7 @@ class App {
|
|
|
9546
9557
|
if (!_touch.active) {
|
|
9547
9558
|
const dx = clientX - _touch.startX;
|
|
9548
9559
|
const dy = clientY - _touch.startY;
|
|
9549
|
-
if (dx * dx + dy * dy <
|
|
9560
|
+
if (dx * dx + dy * dy < 100)
|
|
9550
9561
|
return;
|
|
9551
9562
|
_touch.active = true;
|
|
9552
9563
|
e.preventDefault();
|
|
@@ -9677,8 +9688,6 @@ function injectCss(nodeId, style, styleTarget = document.head) {
|
|
|
9677
9688
|
styleNode.innerHTML = style;
|
|
9678
9689
|
styleTarget.appendChild(styleNode);
|
|
9679
9690
|
}
|
|
9680
|
-
var TOUCH_DRAG_THRESHOLD_PX = 10;
|
|
9681
|
-
var TOUCH_DRAG_THRESHOLD_SQ = TOUCH_DRAG_THRESHOLD_PX * TOUCH_DRAG_THRESHOLD_PX;
|
|
9682
9691
|
var NOOP = () => {};
|
|
9683
9692
|
function findTouch(e, id) {
|
|
9684
9693
|
for (const t of e.changedTouches)
|
|
@@ -14427,11 +14436,10 @@ class ClassBuilder {
|
|
|
14427
14436
|
const field = fields[key];
|
|
14428
14437
|
if (compFields.has(key))
|
|
14429
14438
|
args[key] = mkCompField(field, opts.scope, inArgs[key]);
|
|
14430
|
-
else if (field === undefined)
|
|
14439
|
+
else if (field === undefined)
|
|
14431
14440
|
console.warn("extra argument to constructor:", name, key, inArgs);
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
args[key] = field.coerceOrDefault(inArgs[key]);
|
|
14441
|
+
else
|
|
14442
|
+
args[key] = field.coerceOrDefault(inArgs[key]);
|
|
14435
14443
|
}
|
|
14436
14444
|
for (const key of compFields)
|
|
14437
14445
|
if (args[key] === undefined)
|
|
@@ -14456,15 +14464,12 @@ class ClassBuilder {
|
|
|
14456
14464
|
return Class;
|
|
14457
14465
|
}
|
|
14458
14466
|
methods(proto) {
|
|
14459
|
-
|
|
14467
|
+
for (const k in proto)
|
|
14468
|
+
this._methods[k] = proto[k];
|
|
14460
14469
|
}
|
|
14461
14470
|
statics(proto) {
|
|
14462
|
-
return this._mergeProto(this._statics, proto, "static");
|
|
14463
|
-
}
|
|
14464
|
-
_mergeProto(target, proto, _name) {
|
|
14465
14471
|
for (const k in proto)
|
|
14466
|
-
|
|
14467
|
-
return this;
|
|
14472
|
+
this._statics[k] = proto[k];
|
|
14468
14473
|
}
|
|
14469
14474
|
addField(name, dval, FieldCls) {
|
|
14470
14475
|
const field = new FieldCls(name, dval);
|
|
@@ -14635,7 +14640,7 @@ class Renderer {
|
|
|
14635
14640
|
}
|
|
14636
14641
|
renderRoot(stack, val, viewName = null) {
|
|
14637
14642
|
const comp = this.comps.getCompFor(val);
|
|
14638
|
-
const nid = comp
|
|
14643
|
+
const nid = comp?.getView(viewName).anode.nodeId ?? null;
|
|
14639
14644
|
return comp ? this._rValComp(stack, val, comp, nid, "ROOT", viewName) : null;
|
|
14640
14645
|
}
|
|
14641
14646
|
renderIt(stack, nodeId, key, viewName) {
|
|
@@ -14643,7 +14648,7 @@ class Renderer {
|
|
|
14643
14648
|
return comp ? this._rValComp(stack, stack.it, comp, nodeId, key, viewName) : null;
|
|
14644
14649
|
}
|
|
14645
14650
|
_rValComp(stack, val, comp, nid, key, viewName) {
|
|
14646
|
-
const cacheKey = `${viewName ?? stack.viewsId ?? ""}
|
|
14651
|
+
const cacheKey = `${viewName ?? stack.viewsId ?? ""}-${nid}-${key}`;
|
|
14647
14652
|
const cachePath = [val];
|
|
14648
14653
|
stack._pushDynBindValuesToArray(cachePath, comp.dynamic);
|
|
14649
14654
|
const cachedNode = this.cache.get(cachePath, cacheKey);
|