tutuca 0.9.58 → 0.9.60
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 +32 -13
- package/dist/tutuca-dev.js +32 -13
- package/dist/tutuca-dev.min.js +3 -3
- package/dist/tutuca-extra.js +32 -13
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca.js +32 -13
- package/dist/tutuca.min.js +3 -3
- package/package.json +1 -1
package/dist/tutuca-cli.js
CHANGED
|
@@ -3928,6 +3928,7 @@ class Path {
|
|
|
3928
3928
|
}
|
|
3929
3929
|
static fromNodeAndEventName(node, eventName, rootNode, maxDepth, comps, stopOnNoEvent = true) {
|
|
3930
3930
|
const pathSteps = [];
|
|
3931
|
+
const bubbles = BUBBLING_EVENTS.has(eventName);
|
|
3931
3932
|
let depth = 0;
|
|
3932
3933
|
let eventIds = [];
|
|
3933
3934
|
let handlers = null;
|
|
@@ -3941,15 +3942,23 @@ class Path {
|
|
|
3941
3942
|
eventIds.push(eid);
|
|
3942
3943
|
if (cid !== undefined) {
|
|
3943
3944
|
const comp = comps.getComponentForId(+cid);
|
|
3944
|
-
|
|
3945
|
+
let pushStep = true;
|
|
3946
|
+
if (handlers === null && (isLeafComponent || bubbles)) {
|
|
3945
3947
|
handlers = findHandlers(comp, eventIds, vid, eventName);
|
|
3946
|
-
if (handlers === null
|
|
3947
|
-
|
|
3948
|
-
|
|
3948
|
+
if (handlers === null) {
|
|
3949
|
+
if (isLeafComponent && stopOnNoEvent && !bubbles)
|
|
3950
|
+
return NO_EVENT_INFO;
|
|
3951
|
+
} else if (!isLeafComponent) {
|
|
3952
|
+
pathSteps.length = 0;
|
|
3953
|
+
pushStep = false;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
isLeafComponent = false;
|
|
3957
|
+
if (pushStep) {
|
|
3958
|
+
const step = resolvePathStep(comp, nodeIds, vid);
|
|
3959
|
+
if (step)
|
|
3960
|
+
pathSteps.push(step);
|
|
3949
3961
|
}
|
|
3950
|
-
const step = resolvePathStep(comp, nodeIds, vid);
|
|
3951
|
-
if (step)
|
|
3952
|
-
pathSteps.push(step);
|
|
3953
3962
|
eventIds = [];
|
|
3954
3963
|
nodeIds = [];
|
|
3955
3964
|
}
|
|
@@ -4051,7 +4060,7 @@ class PathBuilder {
|
|
|
4051
4060
|
return this.add(new SeqStep(name, key));
|
|
4052
4061
|
}
|
|
4053
4062
|
}
|
|
4054
|
-
var NONE, BindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO;
|
|
4063
|
+
var NONE, BindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, EMPTY_META, NO_EVENT_INFO, BUBBLING_EVENTS;
|
|
4055
4064
|
var init_path = __esm(() => {
|
|
4056
4065
|
NONE = Symbol("NONE");
|
|
4057
4066
|
BindStep = class BindStep extends Step {
|
|
@@ -4161,6 +4170,7 @@ var init_path = __esm(() => {
|
|
|
4161
4170
|
};
|
|
4162
4171
|
EMPTY_META = {};
|
|
4163
4172
|
NO_EVENT_INFO = [null, null];
|
|
4173
|
+
BUBBLING_EVENTS = new Set(["drop"]);
|
|
4164
4174
|
});
|
|
4165
4175
|
|
|
4166
4176
|
// src/value.js
|
|
@@ -9176,7 +9186,7 @@ class App {
|
|
|
9176
9186
|
}
|
|
9177
9187
|
_dispatchEvent(e) {
|
|
9178
9188
|
const { type: type3 } = e;
|
|
9179
|
-
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend";
|
|
9189
|
+
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend" || type3 === "drop";
|
|
9180
9190
|
const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
|
|
9181
9191
|
const [path, handlers] = Path.fromEvent(e, root, maxDepth, comps, !isDrag);
|
|
9182
9192
|
if (isDrag)
|
|
@@ -9234,7 +9244,7 @@ class App {
|
|
|
9234
9244
|
}
|
|
9235
9245
|
_handleDragEvent(e, type3, path) {
|
|
9236
9246
|
if (type3 === "dragover") {
|
|
9237
|
-
const dropTarget = getClosestDropTarget(e.target, this.rootNode,
|
|
9247
|
+
const dropTarget = getClosestDropTarget(e.target, this.rootNode, Infinity);
|
|
9238
9248
|
if (dropTarget !== null) {
|
|
9239
9249
|
e.preventDefault();
|
|
9240
9250
|
this._cleanDragOverAttrs();
|
|
@@ -9248,6 +9258,9 @@ class App {
|
|
|
9248
9258
|
const dragType = e.target.dataset.dragtype ?? "?";
|
|
9249
9259
|
const stack = path.buildStack(this.makeStack(rootValue));
|
|
9250
9260
|
this.dragInfo = new DragInfo(path, stack, e, value, dragType, e.target);
|
|
9261
|
+
} else if (type3 === "drop") {
|
|
9262
|
+
e.preventDefault();
|
|
9263
|
+
this._cleanDragOverAttrs();
|
|
9251
9264
|
} else {
|
|
9252
9265
|
if (this.dragInfo !== null) {
|
|
9253
9266
|
delete this.dragInfo.node.dataset.dragging;
|
|
@@ -9285,16 +9298,22 @@ class App {
|
|
|
9285
9298
|
}
|
|
9286
9299
|
this._compiled = true;
|
|
9287
9300
|
}
|
|
9301
|
+
subscribeToEvents(eventNames) {
|
|
9302
|
+
for (const name of eventNames)
|
|
9303
|
+
this.rootNode.addEventListener(name, this, listenerOpts(name));
|
|
9304
|
+
}
|
|
9305
|
+
recompileStyles(opts) {
|
|
9306
|
+
injectCss("tutuca-app", this.comps.compileStyles(), opts?.head ?? document.head);
|
|
9307
|
+
}
|
|
9288
9308
|
start(opts) {
|
|
9289
9309
|
if (!this._compiled)
|
|
9290
9310
|
this.compile();
|
|
9291
|
-
|
|
9292
|
-
this.rootNode.addEventListener(name, this, listenerOpts(name));
|
|
9311
|
+
this.subscribeToEvents(this._eventNames);
|
|
9293
9312
|
this.onChange((info) => {
|
|
9294
9313
|
if (info.val !== info.old)
|
|
9295
9314
|
this.render();
|
|
9296
9315
|
});
|
|
9297
|
-
|
|
9316
|
+
this.recompileStyles(opts);
|
|
9298
9317
|
if (opts?.noCache)
|
|
9299
9318
|
this.renderer.setNullCache();
|
|
9300
9319
|
else
|
package/dist/tutuca-dev.js
CHANGED
|
@@ -3481,6 +3481,7 @@ class Path {
|
|
|
3481
3481
|
}
|
|
3482
3482
|
static fromNodeAndEventName(node, eventName, rootNode, maxDepth, comps, stopOnNoEvent = true) {
|
|
3483
3483
|
const pathSteps = [];
|
|
3484
|
+
const bubbles = BUBBLING_EVENTS.has(eventName);
|
|
3484
3485
|
let depth = 0;
|
|
3485
3486
|
let eventIds = [];
|
|
3486
3487
|
let handlers = null;
|
|
@@ -3494,15 +3495,23 @@ class Path {
|
|
|
3494
3495
|
eventIds.push(eid);
|
|
3495
3496
|
if (cid !== undefined) {
|
|
3496
3497
|
const comp = comps.getComponentForId(+cid);
|
|
3497
|
-
|
|
3498
|
+
let pushStep = true;
|
|
3499
|
+
if (handlers === null && (isLeafComponent || bubbles)) {
|
|
3498
3500
|
handlers = findHandlers(comp, eventIds, vid, eventName);
|
|
3499
|
-
if (handlers === null
|
|
3500
|
-
|
|
3501
|
-
|
|
3501
|
+
if (handlers === null) {
|
|
3502
|
+
if (isLeafComponent && stopOnNoEvent && !bubbles)
|
|
3503
|
+
return NO_EVENT_INFO;
|
|
3504
|
+
} else if (!isLeafComponent) {
|
|
3505
|
+
pathSteps.length = 0;
|
|
3506
|
+
pushStep = false;
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
isLeafComponent = false;
|
|
3510
|
+
if (pushStep) {
|
|
3511
|
+
const step = resolvePathStep(comp, nodeIds, vid);
|
|
3512
|
+
if (step)
|
|
3513
|
+
pathSteps.push(step);
|
|
3502
3514
|
}
|
|
3503
|
-
const step = resolvePathStep(comp, nodeIds, vid);
|
|
3504
|
-
if (step)
|
|
3505
|
-
pathSteps.push(step);
|
|
3506
3515
|
eventIds = [];
|
|
3507
3516
|
nodeIds = [];
|
|
3508
3517
|
}
|
|
@@ -3587,6 +3596,7 @@ function resolvePathStep(comp, nodeIds, vid) {
|
|
|
3587
3596
|
return null;
|
|
3588
3597
|
}
|
|
3589
3598
|
var NO_EVENT_INFO = [null, null];
|
|
3599
|
+
var BUBBLING_EVENTS = new Set(["drop"]);
|
|
3590
3600
|
|
|
3591
3601
|
class PathBuilder {
|
|
3592
3602
|
constructor() {
|
|
@@ -8664,7 +8674,7 @@ class Component {
|
|
|
8664
8674
|
}
|
|
8665
8675
|
}
|
|
8666
8676
|
make(args, opts) {
|
|
8667
|
-
return this.Class.make(args, opts);
|
|
8677
|
+
return this.Class.make(args, opts ?? { scope: this.scope });
|
|
8668
8678
|
}
|
|
8669
8679
|
getView(name) {
|
|
8670
8680
|
return this.views[name] ?? this.views.main;
|
|
@@ -9521,7 +9531,7 @@ class App {
|
|
|
9521
9531
|
}
|
|
9522
9532
|
_dispatchEvent(e) {
|
|
9523
9533
|
const { type: type3 } = e;
|
|
9524
|
-
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend";
|
|
9534
|
+
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend" || type3 === "drop";
|
|
9525
9535
|
const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
|
|
9526
9536
|
const [path, handlers] = Path.fromEvent(e, root, maxDepth, comps, !isDrag);
|
|
9527
9537
|
if (isDrag)
|
|
@@ -9579,7 +9589,7 @@ class App {
|
|
|
9579
9589
|
}
|
|
9580
9590
|
_handleDragEvent(e, type3, path) {
|
|
9581
9591
|
if (type3 === "dragover") {
|
|
9582
|
-
const dropTarget = getClosestDropTarget(e.target, this.rootNode,
|
|
9592
|
+
const dropTarget = getClosestDropTarget(e.target, this.rootNode, Infinity);
|
|
9583
9593
|
if (dropTarget !== null) {
|
|
9584
9594
|
e.preventDefault();
|
|
9585
9595
|
this._cleanDragOverAttrs();
|
|
@@ -9593,6 +9603,9 @@ class App {
|
|
|
9593
9603
|
const dragType = e.target.dataset.dragtype ?? "?";
|
|
9594
9604
|
const stack = path.buildStack(this.makeStack(rootValue));
|
|
9595
9605
|
this.dragInfo = new DragInfo(path, stack, e, value, dragType, e.target);
|
|
9606
|
+
} else if (type3 === "drop") {
|
|
9607
|
+
e.preventDefault();
|
|
9608
|
+
this._cleanDragOverAttrs();
|
|
9596
9609
|
} else {
|
|
9597
9610
|
if (this.dragInfo !== null) {
|
|
9598
9611
|
delete this.dragInfo.node.dataset.dragging;
|
|
@@ -9630,16 +9643,22 @@ class App {
|
|
|
9630
9643
|
}
|
|
9631
9644
|
this._compiled = true;
|
|
9632
9645
|
}
|
|
9646
|
+
subscribeToEvents(eventNames) {
|
|
9647
|
+
for (const name of eventNames)
|
|
9648
|
+
this.rootNode.addEventListener(name, this, listenerOpts(name));
|
|
9649
|
+
}
|
|
9650
|
+
recompileStyles(opts) {
|
|
9651
|
+
injectCss("tutuca-app", this.comps.compileStyles(), opts?.head ?? document.head);
|
|
9652
|
+
}
|
|
9633
9653
|
start(opts) {
|
|
9634
9654
|
if (!this._compiled)
|
|
9635
9655
|
this.compile();
|
|
9636
|
-
|
|
9637
|
-
this.rootNode.addEventListener(name, this, listenerOpts(name));
|
|
9656
|
+
this.subscribeToEvents(this._eventNames);
|
|
9638
9657
|
this.onChange((info) => {
|
|
9639
9658
|
if (info.val !== info.old)
|
|
9640
9659
|
this.render();
|
|
9641
9660
|
});
|
|
9642
|
-
|
|
9661
|
+
this.recompileStyles(opts);
|
|
9643
9662
|
if (opts?.noCache)
|
|
9644
9663
|
this.renderer.setNullCache();
|
|
9645
9664
|
else
|