tutuca 0.9.62 → 0.9.64
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 +446 -432
- package/dist/tutuca-dev.js +566 -551
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.js +566 -551
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.js +566 -551
- package/dist/tutuca.min.js +2 -2
- package/package.json +1 -1
package/dist/tutuca-cli.js
CHANGED
|
@@ -4674,7 +4674,12 @@ class ValParser {
|
|
|
4674
4674
|
const newS = px.frame.macroVars?.[name];
|
|
4675
4675
|
if (newS !== undefined) {
|
|
4676
4676
|
const tokens = tokenizeValue(newS.trim());
|
|
4677
|
-
|
|
4677
|
+
if (tokens.length !== 1)
|
|
4678
|
+
return null;
|
|
4679
|
+
const val = this.parseToken(tokens[0], px);
|
|
4680
|
+
if (val instanceof ConstVal)
|
|
4681
|
+
val.fromMacroVar = true;
|
|
4682
|
+
return val;
|
|
4678
4683
|
}
|
|
4679
4684
|
px.onParseIssue("bad-value", { role: "macro-var", name, value: s });
|
|
4680
4685
|
return null;
|
|
@@ -4924,7 +4929,7 @@ var init_value = __esm(() => {
|
|
|
4924
4929
|
toLiteralSource() {
|
|
4925
4930
|
let out = "";
|
|
4926
4931
|
for (const v of this.vals) {
|
|
4927
|
-
if (!(v instanceof ConstVal))
|
|
4932
|
+
if (!(v instanceof ConstVal) || v.fromMacroVar)
|
|
4928
4933
|
return null;
|
|
4929
4934
|
out += v.val;
|
|
4930
4935
|
}
|
|
@@ -4940,9 +4945,10 @@ var init_value = __esm(() => {
|
|
|
4940
4945
|
}
|
|
4941
4946
|
let lo = 0;
|
|
4942
4947
|
let hi = vals.length;
|
|
4943
|
-
|
|
4948
|
+
const isTrimmable = (v) => v instanceof ConstVal && v.val === "" && !v.fromMacroVar;
|
|
4949
|
+
while (lo < hi && isTrimmable(vals[lo]))
|
|
4944
4950
|
lo++;
|
|
4945
|
-
while (hi > lo && vals[hi - 1]
|
|
4951
|
+
while (hi > lo && isTrimmable(vals[hi - 1]))
|
|
4946
4952
|
hi--;
|
|
4947
4953
|
return new StrTplVal(lo === 0 && hi === vals.length ? vals : vals.slice(lo, hi));
|
|
4948
4954
|
}
|
|
@@ -5344,6 +5350,331 @@ var init_attribute = __esm(() => {
|
|
|
5344
5350
|
};
|
|
5345
5351
|
});
|
|
5346
5352
|
|
|
5353
|
+
// src/vdom.js
|
|
5354
|
+
function applyProperties(node, props, previous) {
|
|
5355
|
+
const namespaced = isNamespaced(node);
|
|
5356
|
+
for (const propName in props) {
|
|
5357
|
+
const propValue = props[propName];
|
|
5358
|
+
if (propValue === undefined)
|
|
5359
|
+
removeProperty(node, propName, previous);
|
|
5360
|
+
else if (propName === "dangerouslySetInnerHTML")
|
|
5361
|
+
node.innerHTML = propValue.__html ?? "";
|
|
5362
|
+
else if (propName === "className")
|
|
5363
|
+
node.setAttribute("class", propValue);
|
|
5364
|
+
else if (namespaced || isHtmlAttribute(propName))
|
|
5365
|
+
node.setAttribute(propName, propValue);
|
|
5366
|
+
else
|
|
5367
|
+
node[propName] = propValue;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
function removeProperty(node, propName, previous) {
|
|
5371
|
+
const previousValue = previous[propName];
|
|
5372
|
+
if (propName === "dangerouslySetInnerHTML")
|
|
5373
|
+
node.replaceChildren();
|
|
5374
|
+
else if (propName === "className")
|
|
5375
|
+
node.removeAttribute("class");
|
|
5376
|
+
else if (propName === "htmlFor")
|
|
5377
|
+
node.removeAttribute("for");
|
|
5378
|
+
else if (isNamespaced(node) || typeof previousValue === "string" || isHtmlAttribute(propName))
|
|
5379
|
+
node.removeAttribute(propName);
|
|
5380
|
+
else
|
|
5381
|
+
node[propName] = null;
|
|
5382
|
+
}
|
|
5383
|
+
|
|
5384
|
+
class VBase {
|
|
5385
|
+
}
|
|
5386
|
+
function childsEqual(a, b) {
|
|
5387
|
+
if (a === b)
|
|
5388
|
+
return true;
|
|
5389
|
+
for (let i = 0;i < a.length; i++)
|
|
5390
|
+
if (!a[i].isEqualTo(b[i]))
|
|
5391
|
+
return false;
|
|
5392
|
+
return true;
|
|
5393
|
+
}
|
|
5394
|
+
function appendChildNodes(parent, childs, opts) {
|
|
5395
|
+
for (const child of childs)
|
|
5396
|
+
parent.appendChild(child.toDom(opts));
|
|
5397
|
+
}
|
|
5398
|
+
function addChild(normalizedChildren, child) {
|
|
5399
|
+
if (child == null)
|
|
5400
|
+
return;
|
|
5401
|
+
if (isIterable(child)) {
|
|
5402
|
+
for (const c of child)
|
|
5403
|
+
addChild(normalizedChildren, c);
|
|
5404
|
+
} else if (child instanceof VBase) {
|
|
5405
|
+
if (child instanceof VFragment)
|
|
5406
|
+
normalizedChildren.push(...child.childs);
|
|
5407
|
+
else
|
|
5408
|
+
normalizedChildren.push(child);
|
|
5409
|
+
} else
|
|
5410
|
+
normalizedChildren.push(new VText(child));
|
|
5411
|
+
}
|
|
5412
|
+
function diffProps(a, b) {
|
|
5413
|
+
if (a === b)
|
|
5414
|
+
return null;
|
|
5415
|
+
let diff = null;
|
|
5416
|
+
for (const aKey in a) {
|
|
5417
|
+
if (!Object.hasOwn(b, aKey)) {
|
|
5418
|
+
diff ??= {};
|
|
5419
|
+
diff[aKey] = undefined;
|
|
5420
|
+
} else if (a[aKey] !== b[aKey]) {
|
|
5421
|
+
diff ??= {};
|
|
5422
|
+
diff[aKey] = b[aKey];
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
for (const bKey in b) {
|
|
5426
|
+
if (!Object.hasOwn(a, bKey)) {
|
|
5427
|
+
diff ??= {};
|
|
5428
|
+
diff[bKey] = b[bKey];
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
return diff;
|
|
5432
|
+
}
|
|
5433
|
+
function morphNode(domNode, source, target, opts) {
|
|
5434
|
+
if (source === target || source.isEqualTo(target))
|
|
5435
|
+
return domNode;
|
|
5436
|
+
const type = source.nodeType;
|
|
5437
|
+
if (type === target.nodeType) {
|
|
5438
|
+
if (type === 3 || type === 8) {
|
|
5439
|
+
domNode.data = target.text;
|
|
5440
|
+
return domNode;
|
|
5441
|
+
}
|
|
5442
|
+
if (type === 1 && source.isSameKind(target)) {
|
|
5443
|
+
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
5444
|
+
const isSelect = source.tag === "SELECT";
|
|
5445
|
+
if (propsDiff) {
|
|
5446
|
+
if (isSelect && "value" in propsDiff) {
|
|
5447
|
+
const { value: _v, ...rest } = propsDiff;
|
|
5448
|
+
applyProperties(domNode, rest, source.attrs);
|
|
5449
|
+
} else
|
|
5450
|
+
applyProperties(domNode, propsDiff, source.attrs);
|
|
5451
|
+
}
|
|
5452
|
+
if (!target.attrs.dangerouslySetInnerHTML)
|
|
5453
|
+
morphChildren(domNode, source.childs, target.childs, opts);
|
|
5454
|
+
if (isSelect && target.attrs.value !== undefined)
|
|
5455
|
+
applyProperties(domNode, { value: target.attrs.value }, source.attrs);
|
|
5456
|
+
return domNode;
|
|
5457
|
+
}
|
|
5458
|
+
if (type === 11) {
|
|
5459
|
+
morphChildren(domNode, source.childs, target.childs, opts);
|
|
5460
|
+
return domNode;
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
const newNode = target.toDom(opts);
|
|
5464
|
+
domNode.parentNode?.replaceChild(newNode, domNode);
|
|
5465
|
+
return newNode;
|
|
5466
|
+
}
|
|
5467
|
+
function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
5468
|
+
if (oldChilds.length === 0) {
|
|
5469
|
+
appendChildNodes(parentDom, newChilds, opts);
|
|
5470
|
+
return;
|
|
5471
|
+
}
|
|
5472
|
+
if (newChilds.length === 0) {
|
|
5473
|
+
parentDom.replaceChildren();
|
|
5474
|
+
return;
|
|
5475
|
+
}
|
|
5476
|
+
if (oldChilds.length === newChilds.length) {
|
|
5477
|
+
let hasKey = false;
|
|
5478
|
+
for (let i = 0;i < oldChilds.length; i++) {
|
|
5479
|
+
if (getKey(oldChilds[i]) != null || getKey(newChilds[i]) != null) {
|
|
5480
|
+
hasKey = true;
|
|
5481
|
+
break;
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5484
|
+
if (!hasKey) {
|
|
5485
|
+
let dom = parentDom.firstChild;
|
|
5486
|
+
for (let i = 0;i < oldChilds.length; i++) {
|
|
5487
|
+
const next = dom.nextSibling;
|
|
5488
|
+
morphNode(dom, oldChilds[i], newChilds[i], opts);
|
|
5489
|
+
dom = next;
|
|
5490
|
+
}
|
|
5491
|
+
return;
|
|
5492
|
+
}
|
|
5493
|
+
}
|
|
5494
|
+
const domNodes = Array.from(parentDom.childNodes);
|
|
5495
|
+
const oldKeyMap = Object.create(null);
|
|
5496
|
+
for (let i = 0;i < oldChilds.length; i++) {
|
|
5497
|
+
const key = getKey(oldChilds[i]);
|
|
5498
|
+
if (key != null)
|
|
5499
|
+
oldKeyMap[key] = i;
|
|
5500
|
+
}
|
|
5501
|
+
const used = new Uint8Array(oldChilds.length);
|
|
5502
|
+
let unkeyedCursor = 0;
|
|
5503
|
+
for (let j = 0;j < newChilds.length; j++) {
|
|
5504
|
+
const newChild = newChilds[j];
|
|
5505
|
+
const newKey = getKey(newChild);
|
|
5506
|
+
let oldIdx = -1;
|
|
5507
|
+
if (newKey != null) {
|
|
5508
|
+
if (newKey in oldKeyMap && !used[oldKeyMap[newKey]])
|
|
5509
|
+
oldIdx = oldKeyMap[newKey];
|
|
5510
|
+
} else {
|
|
5511
|
+
while (unkeyedCursor < oldChilds.length) {
|
|
5512
|
+
if (!used[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
|
|
5513
|
+
oldIdx = unkeyedCursor++;
|
|
5514
|
+
break;
|
|
5515
|
+
}
|
|
5516
|
+
unkeyedCursor++;
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
if (oldIdx >= 0) {
|
|
5520
|
+
used[oldIdx] = 1;
|
|
5521
|
+
const newDom = morphNode(domNodes[oldIdx], oldChilds[oldIdx], newChild, opts);
|
|
5522
|
+
const ref = parentDom.childNodes[j] ?? null;
|
|
5523
|
+
if (newDom !== ref)
|
|
5524
|
+
parentDom.insertBefore(newDom, ref);
|
|
5525
|
+
} else {
|
|
5526
|
+
const ref = parentDom.childNodes[j] ?? null;
|
|
5527
|
+
parentDom.insertBefore(newChild.toDom(opts), ref);
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
for (let i = oldChilds.length - 1;i >= 0; i--)
|
|
5531
|
+
if (!used[i] && domNodes[i].parentNode === parentDom)
|
|
5532
|
+
parentDom.removeChild(domNodes[i]);
|
|
5533
|
+
}
|
|
5534
|
+
function render(vnode, container, options, prev) {
|
|
5535
|
+
const isFragment = vnode instanceof VFragment;
|
|
5536
|
+
if (prev && prev.vnode instanceof VFragment === isFragment) {
|
|
5537
|
+
const oldDom = isFragment ? container : prev.dom;
|
|
5538
|
+
const newDom = morphNode(oldDom, prev.vnode, vnode, options);
|
|
5539
|
+
return { vnode, dom: isFragment ? container : newDom };
|
|
5540
|
+
}
|
|
5541
|
+
const domNode = vnode.toDom(options);
|
|
5542
|
+
container.replaceChildren(domNode);
|
|
5543
|
+
return { vnode, dom: isFragment ? container : domNode };
|
|
5544
|
+
}
|
|
5545
|
+
function h(tagName, properties, children, namespace) {
|
|
5546
|
+
const props = {};
|
|
5547
|
+
let key;
|
|
5548
|
+
if (properties) {
|
|
5549
|
+
for (const propName in properties) {
|
|
5550
|
+
const propVal = properties[propName];
|
|
5551
|
+
switch (propName) {
|
|
5552
|
+
case "key":
|
|
5553
|
+
key = propVal;
|
|
5554
|
+
break;
|
|
5555
|
+
case "namespace":
|
|
5556
|
+
namespace = namespace ?? propVal;
|
|
5557
|
+
break;
|
|
5558
|
+
case "class":
|
|
5559
|
+
props.className = propVal;
|
|
5560
|
+
break;
|
|
5561
|
+
case "for":
|
|
5562
|
+
props.htmlFor = propVal;
|
|
5563
|
+
break;
|
|
5564
|
+
default:
|
|
5565
|
+
props[propName] = isHtmlAttribute(propName) ? String(propVal) : propVal;
|
|
5566
|
+
}
|
|
5567
|
+
}
|
|
5568
|
+
}
|
|
5569
|
+
const c = tagName.charCodeAt(0);
|
|
5570
|
+
const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
5571
|
+
const normalizedChildren = [];
|
|
5572
|
+
addChild(normalizedChildren, children);
|
|
5573
|
+
return new VNode2(tag, props, normalizedChildren, key, namespace);
|
|
5574
|
+
}
|
|
5575
|
+
var isHtmlAttribute = (propName) => propName[4] === "-" && (propName[0] === "d" || propName[0] === "a"), HTML_NS = "http://www.w3.org/1999/xhtml", isNamespaced = (node) => {
|
|
5576
|
+
const ns = node.namespaceURI;
|
|
5577
|
+
return ns !== null && ns !== HTML_NS;
|
|
5578
|
+
}, getKey = (child) => child instanceof VNode2 ? child.key : undefined, isIterable = (obj) => obj != null && typeof obj !== "string" && typeof obj[Symbol.iterator] === "function", VText, VComment, VFragment, VNode2;
|
|
5579
|
+
var init_vdom = __esm(() => {
|
|
5580
|
+
VText = class VText extends VBase {
|
|
5581
|
+
constructor(text) {
|
|
5582
|
+
super();
|
|
5583
|
+
this.text = String(text);
|
|
5584
|
+
}
|
|
5585
|
+
get nodeType() {
|
|
5586
|
+
return 3;
|
|
5587
|
+
}
|
|
5588
|
+
isEqualTo(other) {
|
|
5589
|
+
return other instanceof VText && this.text === other.text;
|
|
5590
|
+
}
|
|
5591
|
+
toDom(opts) {
|
|
5592
|
+
return opts.document.createTextNode(this.text);
|
|
5593
|
+
}
|
|
5594
|
+
};
|
|
5595
|
+
VComment = class VComment extends VBase {
|
|
5596
|
+
constructor(text) {
|
|
5597
|
+
super();
|
|
5598
|
+
this.text = text;
|
|
5599
|
+
}
|
|
5600
|
+
get nodeType() {
|
|
5601
|
+
return 8;
|
|
5602
|
+
}
|
|
5603
|
+
isEqualTo(other) {
|
|
5604
|
+
return other instanceof VComment && this.text === other.text;
|
|
5605
|
+
}
|
|
5606
|
+
toDom(opts) {
|
|
5607
|
+
return opts.document.createComment(this.text);
|
|
5608
|
+
}
|
|
5609
|
+
};
|
|
5610
|
+
VFragment = class VFragment extends VBase {
|
|
5611
|
+
constructor(childs) {
|
|
5612
|
+
super();
|
|
5613
|
+
this.childs = [];
|
|
5614
|
+
addChild(this.childs, childs);
|
|
5615
|
+
}
|
|
5616
|
+
get nodeType() {
|
|
5617
|
+
return 11;
|
|
5618
|
+
}
|
|
5619
|
+
isEqualTo(other) {
|
|
5620
|
+
if (!(other instanceof VFragment) || this.childs.length !== other.childs.length)
|
|
5621
|
+
return false;
|
|
5622
|
+
return childsEqual(this.childs, other.childs);
|
|
5623
|
+
}
|
|
5624
|
+
toDom(opts) {
|
|
5625
|
+
const fragment = opts.document.createDocumentFragment();
|
|
5626
|
+
appendChildNodes(fragment, this.childs, opts);
|
|
5627
|
+
return fragment;
|
|
5628
|
+
}
|
|
5629
|
+
};
|
|
5630
|
+
VNode2 = class VNode2 extends VBase {
|
|
5631
|
+
constructor(tag, attrs, childs, key, namespace) {
|
|
5632
|
+
super();
|
|
5633
|
+
this.tag = tag;
|
|
5634
|
+
this.attrs = attrs ?? {};
|
|
5635
|
+
this.childs = childs ?? [];
|
|
5636
|
+
this.key = key != null ? String(key) : undefined;
|
|
5637
|
+
this.namespace = typeof namespace === "string" ? namespace : null;
|
|
5638
|
+
}
|
|
5639
|
+
get nodeType() {
|
|
5640
|
+
return 1;
|
|
5641
|
+
}
|
|
5642
|
+
isSameKind(other) {
|
|
5643
|
+
return this.tag === other.tag && this.namespace === other.namespace && this.key === other.key;
|
|
5644
|
+
}
|
|
5645
|
+
isEqualTo(other) {
|
|
5646
|
+
if (this === other)
|
|
5647
|
+
return true;
|
|
5648
|
+
if (!(other instanceof VNode2) || !this.isSameKind(other) || this.childs.length !== other.childs.length) {
|
|
5649
|
+
return false;
|
|
5650
|
+
}
|
|
5651
|
+
if (this.attrs !== other.attrs) {
|
|
5652
|
+
for (const key in this.attrs)
|
|
5653
|
+
if (this.attrs[key] !== other.attrs[key])
|
|
5654
|
+
return false;
|
|
5655
|
+
for (const key in other.attrs)
|
|
5656
|
+
if (!Object.hasOwn(this.attrs, key))
|
|
5657
|
+
return false;
|
|
5658
|
+
}
|
|
5659
|
+
return childsEqual(this.childs, other.childs);
|
|
5660
|
+
}
|
|
5661
|
+
toDom(opts) {
|
|
5662
|
+
const doc = opts.document;
|
|
5663
|
+
const node = this.namespace === null ? doc.createElement(this.tag) : doc.createElementNS(this.namespace, this.tag);
|
|
5664
|
+
if (this.tag === "SELECT" && "value" in this.attrs) {
|
|
5665
|
+
const { value, ...rest } = this.attrs;
|
|
5666
|
+
applyProperties(node, rest, {});
|
|
5667
|
+
appendChildNodes(node, this.childs, opts);
|
|
5668
|
+
applyProperties(node, { value }, {});
|
|
5669
|
+
} else {
|
|
5670
|
+
applyProperties(node, this.attrs, {});
|
|
5671
|
+
appendChildNodes(node, this.childs, opts);
|
|
5672
|
+
}
|
|
5673
|
+
return node;
|
|
5674
|
+
}
|
|
5675
|
+
};
|
|
5676
|
+
});
|
|
5677
|
+
|
|
5347
5678
|
// src/anode.js
|
|
5348
5679
|
function resolveDynProducer(comp, dynName) {
|
|
5349
5680
|
const dyn = comp?.dynamic?.[dynName];
|
|
@@ -5655,6 +5986,7 @@ var init_anode = __esm(() => {
|
|
|
5655
5986
|
init_attribute();
|
|
5656
5987
|
init_path();
|
|
5657
5988
|
init_value();
|
|
5989
|
+
init_vdom();
|
|
5658
5990
|
TextNode = class TextNode extends BaseNode {
|
|
5659
5991
|
constructor(val) {
|
|
5660
5992
|
super();
|
|
@@ -5705,16 +6037,17 @@ var init_anode = __esm(() => {
|
|
|
5705
6037
|
}
|
|
5706
6038
|
};
|
|
5707
6039
|
DomNode = class DomNode extends ChildsNode {
|
|
5708
|
-
constructor(tagName, attrs, childs) {
|
|
6040
|
+
constructor(tagName, attrs, childs, namespace = null) {
|
|
5709
6041
|
super(childs);
|
|
5710
6042
|
this.tagName = tagName;
|
|
5711
6043
|
this.attrs = attrs;
|
|
6044
|
+
this.namespace = namespace;
|
|
5712
6045
|
}
|
|
5713
6046
|
render(stack, rx) {
|
|
5714
6047
|
const childNodes = new Array(this.childs.length);
|
|
5715
6048
|
for (let i = 0;i < childNodes.length; i++)
|
|
5716
6049
|
childNodes[i] = this.childs[i]?.render?.(stack, rx) ?? null;
|
|
5717
|
-
return rx.renderTag(this.tagName, this.attrs.eval(stack), childNodes);
|
|
6050
|
+
return rx.renderTag(this.tagName, this.attrs.eval(stack), childNodes, this.namespace);
|
|
5718
6051
|
}
|
|
5719
6052
|
setDataAttr(key, val) {
|
|
5720
6053
|
this.attrs.setDataAttr(key, val);
|
|
@@ -5792,7 +6125,9 @@ var init_anode = __esm(() => {
|
|
|
5792
6125
|
if (textChild)
|
|
5793
6126
|
childs.unshift(new RenderTextNode(null, textChild));
|
|
5794
6127
|
const domChilds = tag !== "PRE" ? condenseChildsWhites(childs) : childs;
|
|
5795
|
-
|
|
6128
|
+
const ns = node.namespaceURI;
|
|
6129
|
+
const namespace = ns && ns !== HTML_NS ? ns : null;
|
|
6130
|
+
return wrap(new DomNode(tag, nAttrs, domChilds, namespace), px, wrappers);
|
|
5796
6131
|
}
|
|
5797
6132
|
return new CommentNode(`Error: InvalidTagName ${tag}`);
|
|
5798
6133
|
} finally {
|
|
@@ -13337,455 +13672,134 @@ var init_transactor = __esm(() => {
|
|
|
13337
13672
|
this._dispatchPath = null;
|
|
13338
13673
|
}
|
|
13339
13674
|
get dispatchPath() {
|
|
13340
|
-
this._dispatchPath ??= this.path.compact();
|
|
13341
|
-
return this._dispatchPath;
|
|
13342
|
-
}
|
|
13343
|
-
buildRootStack(root, comps) {
|
|
13344
|
-
return Stack2.root(comps, root, this);
|
|
13345
|
-
}
|
|
13346
|
-
getHandlerAndArgs(root, _instance, comps) {
|
|
13347
|
-
const stack = this.buildStack(root, comps);
|
|
13348
|
-
const [handler, args] = this.handler.getHandlerAndArgs(stack, this);
|
|
13349
|
-
const path = this.dispatchPath;
|
|
13350
|
-
let dispatcher;
|
|
13351
|
-
for (let i = 0;i < args.length; i++) {
|
|
13352
|
-
if (args[i]?.toHandlerArg) {
|
|
13353
|
-
dispatcher ??= new Dispatcher(path, this.transactor, this);
|
|
13354
|
-
args[i] = args[i].toHandlerArg(dispatcher);
|
|
13355
|
-
}
|
|
13356
|
-
}
|
|
13357
|
-
args.push(new EventContext(path, this.transactor, this));
|
|
13358
|
-
return [handler, args];
|
|
13359
|
-
}
|
|
13360
|
-
lookupName(name) {
|
|
13361
|
-
const { e } = this;
|
|
13362
|
-
switch (name) {
|
|
13363
|
-
case "value":
|
|
13364
|
-
return getValue(e);
|
|
13365
|
-
case "valueAsInt":
|
|
13366
|
-
return toNullIfNaN(parseInt(getValue(e), 10));
|
|
13367
|
-
case "valueAsFloat":
|
|
13368
|
-
return toNullIfNaN(parseFloat(getValue(e)));
|
|
13369
|
-
case "target":
|
|
13370
|
-
return e.target;
|
|
13371
|
-
case "event":
|
|
13372
|
-
return e;
|
|
13373
|
-
case "isAlt":
|
|
13374
|
-
return e.altKey;
|
|
13375
|
-
case "isShift":
|
|
13376
|
-
return e.shiftKey;
|
|
13377
|
-
case "isCtrl":
|
|
13378
|
-
case "isCmd":
|
|
13379
|
-
return isMac2 && e.metaKey || e.ctrlKey;
|
|
13380
|
-
case "key":
|
|
13381
|
-
return e.key;
|
|
13382
|
-
case "keyCode":
|
|
13383
|
-
return e.keyCode;
|
|
13384
|
-
case "isUpKey":
|
|
13385
|
-
return e.key === "ArrowUp";
|
|
13386
|
-
case "isDownKey":
|
|
13387
|
-
return e.key === "ArrowDown";
|
|
13388
|
-
case "isSend":
|
|
13389
|
-
return e.key === "Enter";
|
|
13390
|
-
case "isCancel":
|
|
13391
|
-
return e.key === "Escape";
|
|
13392
|
-
case "isTabKey":
|
|
13393
|
-
return e.key === "Tab";
|
|
13394
|
-
case "ctx":
|
|
13395
|
-
return new EventContext(this.dispatchPath, this.transactor, this);
|
|
13396
|
-
case "dragInfo":
|
|
13397
|
-
return this.dragInfo;
|
|
13398
|
-
}
|
|
13399
|
-
return null;
|
|
13400
|
-
}
|
|
13401
|
-
};
|
|
13402
|
-
NameArgsTransaction = class NameArgsTransaction extends Transaction {
|
|
13403
|
-
constructor(path, transactor, name, args, parentTransaction, opts = {}) {
|
|
13404
|
-
super(path, transactor, parentTransaction);
|
|
13405
|
-
this.name = name;
|
|
13406
|
-
this.args = args;
|
|
13407
|
-
this.opts = opts;
|
|
13408
|
-
this.targetPath = path;
|
|
13409
|
-
}
|
|
13410
|
-
handlerProp = null;
|
|
13411
|
-
getHandlerForName(comp) {
|
|
13412
|
-
const handlers = comp?.[this.handlerProp];
|
|
13413
|
-
return handlers?.[this.name] ?? handlers?.$unknown ?? nullHandler;
|
|
13414
|
-
}
|
|
13415
|
-
getHandlerAndArgs(_root, instance, comps) {
|
|
13416
|
-
const handler = this.getHandlerForName(comps.getCompFor(instance));
|
|
13417
|
-
return [handler, [...this.args, new EventContext(this.path, this.transactor, this)]];
|
|
13418
|
-
}
|
|
13419
|
-
};
|
|
13420
|
-
ResponseEvent = class ResponseEvent extends NameArgsTransaction {
|
|
13421
|
-
handlerProp = "response";
|
|
13422
|
-
};
|
|
13423
|
-
SendEvent = class SendEvent extends NameArgsTransaction {
|
|
13424
|
-
handlerProp = "receive";
|
|
13425
|
-
run(rootVal, comps) {
|
|
13426
|
-
return this.opts.skipSelf ? rootVal : this.updateRootValue(rootVal, comps);
|
|
13427
|
-
}
|
|
13428
|
-
afterTransaction() {
|
|
13429
|
-
const { path, name, args, opts, targetPath } = this;
|
|
13430
|
-
if (opts.bubbles && path.steps.length > 0)
|
|
13431
|
-
this.transactor.pushBubble(path.popStep(), name, args, opts, this, targetPath);
|
|
13432
|
-
}
|
|
13433
|
-
};
|
|
13434
|
-
BubbleEvent = class BubbleEvent extends SendEvent {
|
|
13435
|
-
handlerProp = "bubble";
|
|
13436
|
-
constructor(path, transactor, name, args, parent, opts, targetPath) {
|
|
13437
|
-
super(path, transactor, name, args, parent, opts);
|
|
13438
|
-
this.targetPath = targetPath ?? path;
|
|
13439
|
-
}
|
|
13440
|
-
stopPropagation() {
|
|
13441
|
-
this.opts.bubbles = false;
|
|
13442
|
-
}
|
|
13443
|
-
};
|
|
13444
|
-
EventContext = class EventContext extends Dispatcher {
|
|
13445
|
-
get name() {
|
|
13446
|
-
return this.parent?.name ?? null;
|
|
13447
|
-
}
|
|
13448
|
-
get targetPath() {
|
|
13449
|
-
return this.parent.targetPath;
|
|
13450
|
-
}
|
|
13451
|
-
stopPropagation() {
|
|
13452
|
-
return this.parent.stopPropagation();
|
|
13453
|
-
}
|
|
13454
|
-
};
|
|
13455
|
-
PathChanges = class PathChanges extends PathBuilder {
|
|
13456
|
-
constructor(dispatcher) {
|
|
13457
|
-
super();
|
|
13458
|
-
this.dispatcher = dispatcher;
|
|
13459
|
-
}
|
|
13460
|
-
send(name, args, opts) {
|
|
13461
|
-
return this.dispatcher.sendAtPath(this.buildPath(), name, args, opts);
|
|
13462
|
-
}
|
|
13463
|
-
bubble(name, args, opts) {
|
|
13464
|
-
return this.send(name, args, { skipSelf: true, bubbles: true, ...opts });
|
|
13465
|
-
}
|
|
13466
|
-
buildPath() {
|
|
13467
|
-
return this.dispatcher.path.concat(this.pathChanges);
|
|
13468
|
-
}
|
|
13469
|
-
};
|
|
13470
|
-
});
|
|
13471
|
-
|
|
13472
|
-
// src/vdom.js
|
|
13473
|
-
function applyProperties(node, props, previous) {
|
|
13474
|
-
for (const propName in props) {
|
|
13475
|
-
const propValue = props[propName];
|
|
13476
|
-
if (propValue === undefined)
|
|
13477
|
-
removeProperty(node, propName, previous);
|
|
13478
|
-
else if (isHtmlAttribute(propName))
|
|
13479
|
-
node.setAttribute(propName, propValue);
|
|
13480
|
-
else if (propName === "dangerouslySetInnerHTML")
|
|
13481
|
-
node.innerHTML = propValue.__html ?? "";
|
|
13482
|
-
else if (propName === "className")
|
|
13483
|
-
node.setAttribute("class", propValue);
|
|
13484
|
-
else
|
|
13485
|
-
node[propName] = propValue;
|
|
13486
|
-
}
|
|
13487
|
-
}
|
|
13488
|
-
function removeProperty(node, propName, previous) {
|
|
13489
|
-
const previousValue = previous[propName];
|
|
13490
|
-
if (propName === "dangerouslySetInnerHTML")
|
|
13491
|
-
node.replaceChildren();
|
|
13492
|
-
else if (propName === "className")
|
|
13493
|
-
node.removeAttribute("class");
|
|
13494
|
-
else if (propName === "htmlFor")
|
|
13495
|
-
node.removeAttribute("for");
|
|
13496
|
-
else if (typeof previousValue === "string" || isHtmlAttribute(propName))
|
|
13497
|
-
node.removeAttribute(propName);
|
|
13498
|
-
else
|
|
13499
|
-
node[propName] = null;
|
|
13500
|
-
}
|
|
13501
|
-
|
|
13502
|
-
class VBase {
|
|
13503
|
-
}
|
|
13504
|
-
function childsEqual(a, b) {
|
|
13505
|
-
if (a === b)
|
|
13506
|
-
return true;
|
|
13507
|
-
for (let i = 0;i < a.length; i++)
|
|
13508
|
-
if (!a[i].isEqualTo(b[i]))
|
|
13509
|
-
return false;
|
|
13510
|
-
return true;
|
|
13511
|
-
}
|
|
13512
|
-
function appendChildNodes(parent, childs, opts) {
|
|
13513
|
-
for (const child of childs)
|
|
13514
|
-
parent.appendChild(child.toDom(opts));
|
|
13515
|
-
}
|
|
13516
|
-
function addChild(normalizedChildren, child) {
|
|
13517
|
-
if (child == null)
|
|
13518
|
-
return;
|
|
13519
|
-
if (isIterable(child)) {
|
|
13520
|
-
for (const c of child)
|
|
13521
|
-
addChild(normalizedChildren, c);
|
|
13522
|
-
} else if (child instanceof VBase) {
|
|
13523
|
-
if (child instanceof VFragment)
|
|
13524
|
-
normalizedChildren.push(...child.childs);
|
|
13525
|
-
else
|
|
13526
|
-
normalizedChildren.push(child);
|
|
13527
|
-
} else
|
|
13528
|
-
normalizedChildren.push(new VText(child));
|
|
13529
|
-
}
|
|
13530
|
-
function diffProps(a, b) {
|
|
13531
|
-
if (a === b)
|
|
13532
|
-
return null;
|
|
13533
|
-
let diff = null;
|
|
13534
|
-
for (const aKey in a) {
|
|
13535
|
-
if (!Object.hasOwn(b, aKey)) {
|
|
13536
|
-
diff ??= {};
|
|
13537
|
-
diff[aKey] = undefined;
|
|
13538
|
-
} else if (a[aKey] !== b[aKey]) {
|
|
13539
|
-
diff ??= {};
|
|
13540
|
-
diff[aKey] = b[aKey];
|
|
13541
|
-
}
|
|
13542
|
-
}
|
|
13543
|
-
for (const bKey in b) {
|
|
13544
|
-
if (!Object.hasOwn(a, bKey)) {
|
|
13545
|
-
diff ??= {};
|
|
13546
|
-
diff[bKey] = b[bKey];
|
|
13547
|
-
}
|
|
13548
|
-
}
|
|
13549
|
-
return diff;
|
|
13550
|
-
}
|
|
13551
|
-
function morphNode(domNode, source, target, opts) {
|
|
13552
|
-
if (source === target || source.isEqualTo(target))
|
|
13553
|
-
return domNode;
|
|
13554
|
-
const type3 = source.nodeType;
|
|
13555
|
-
if (type3 === target.nodeType) {
|
|
13556
|
-
if (type3 === 3 || type3 === 8) {
|
|
13557
|
-
domNode.data = target.text;
|
|
13558
|
-
return domNode;
|
|
13559
|
-
}
|
|
13560
|
-
if (type3 === 1 && source.isSameKind(target)) {
|
|
13561
|
-
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
13562
|
-
const isSelect = source.tag === "SELECT";
|
|
13563
|
-
if (propsDiff) {
|
|
13564
|
-
if (isSelect && "value" in propsDiff) {
|
|
13565
|
-
const { value: _v, ...rest } = propsDiff;
|
|
13566
|
-
applyProperties(domNode, rest, source.attrs);
|
|
13567
|
-
} else
|
|
13568
|
-
applyProperties(domNode, propsDiff, source.attrs);
|
|
13569
|
-
}
|
|
13570
|
-
if (!target.attrs.dangerouslySetInnerHTML)
|
|
13571
|
-
morphChildren(domNode, source.childs, target.childs, opts);
|
|
13572
|
-
if (isSelect && target.attrs.value !== undefined)
|
|
13573
|
-
applyProperties(domNode, { value: target.attrs.value }, source.attrs);
|
|
13574
|
-
return domNode;
|
|
13575
|
-
}
|
|
13576
|
-
if (type3 === 11) {
|
|
13577
|
-
morphChildren(domNode, source.childs, target.childs, opts);
|
|
13578
|
-
return domNode;
|
|
13579
|
-
}
|
|
13580
|
-
}
|
|
13581
|
-
const newNode = target.toDom(opts);
|
|
13582
|
-
domNode.parentNode?.replaceChild(newNode, domNode);
|
|
13583
|
-
return newNode;
|
|
13584
|
-
}
|
|
13585
|
-
function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
13586
|
-
if (oldChilds.length === 0) {
|
|
13587
|
-
appendChildNodes(parentDom, newChilds, opts);
|
|
13588
|
-
return;
|
|
13589
|
-
}
|
|
13590
|
-
if (newChilds.length === 0) {
|
|
13591
|
-
parentDom.replaceChildren();
|
|
13592
|
-
return;
|
|
13593
|
-
}
|
|
13594
|
-
if (oldChilds.length === newChilds.length) {
|
|
13595
|
-
let hasKey = false;
|
|
13596
|
-
for (let i = 0;i < oldChilds.length; i++) {
|
|
13597
|
-
if (getKey(oldChilds[i]) != null || getKey(newChilds[i]) != null) {
|
|
13598
|
-
hasKey = true;
|
|
13599
|
-
break;
|
|
13600
|
-
}
|
|
13675
|
+
this._dispatchPath ??= this.path.compact();
|
|
13676
|
+
return this._dispatchPath;
|
|
13601
13677
|
}
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
for (let i = 0;i < oldChilds.length; i++) {
|
|
13605
|
-
const next = dom.nextSibling;
|
|
13606
|
-
morphNode(dom, oldChilds[i], newChilds[i], opts);
|
|
13607
|
-
dom = next;
|
|
13608
|
-
}
|
|
13609
|
-
return;
|
|
13678
|
+
buildRootStack(root, comps) {
|
|
13679
|
+
return Stack2.root(comps, root, this);
|
|
13610
13680
|
}
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
let unkeyedCursor = 0;
|
|
13621
|
-
for (let j = 0;j < newChilds.length; j++) {
|
|
13622
|
-
const newChild = newChilds[j];
|
|
13623
|
-
const newKey = getKey(newChild);
|
|
13624
|
-
let oldIdx = -1;
|
|
13625
|
-
if (newKey != null) {
|
|
13626
|
-
if (newKey in oldKeyMap && !used2[oldKeyMap[newKey]])
|
|
13627
|
-
oldIdx = oldKeyMap[newKey];
|
|
13628
|
-
} else {
|
|
13629
|
-
while (unkeyedCursor < oldChilds.length) {
|
|
13630
|
-
if (!used2[unkeyedCursor] && getKey(oldChilds[unkeyedCursor]) == null) {
|
|
13631
|
-
oldIdx = unkeyedCursor++;
|
|
13632
|
-
break;
|
|
13681
|
+
getHandlerAndArgs(root, _instance, comps) {
|
|
13682
|
+
const stack = this.buildStack(root, comps);
|
|
13683
|
+
const [handler, args] = this.handler.getHandlerAndArgs(stack, this);
|
|
13684
|
+
const path = this.dispatchPath;
|
|
13685
|
+
let dispatcher;
|
|
13686
|
+
for (let i = 0;i < args.length; i++) {
|
|
13687
|
+
if (args[i]?.toHandlerArg) {
|
|
13688
|
+
dispatcher ??= new Dispatcher(path, this.transactor, this);
|
|
13689
|
+
args[i] = args[i].toHandlerArg(dispatcher);
|
|
13633
13690
|
}
|
|
13634
|
-
unkeyedCursor++;
|
|
13635
13691
|
}
|
|
13692
|
+
args.push(new EventContext(path, this.transactor, this));
|
|
13693
|
+
return [handler, args];
|
|
13636
13694
|
}
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
return { vnode, dom: isFragment ? container : newDom };
|
|
13658
|
-
}
|
|
13659
|
-
const domNode = vnode.toDom(options);
|
|
13660
|
-
container.replaceChildren(domNode);
|
|
13661
|
-
return { vnode, dom: isFragment ? container : domNode };
|
|
13662
|
-
}
|
|
13663
|
-
function h(tagName, properties, children) {
|
|
13664
|
-
const c = tagName.charCodeAt(0);
|
|
13665
|
-
const tag = c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
13666
|
-
const props = {};
|
|
13667
|
-
let key, namespace;
|
|
13668
|
-
if (properties) {
|
|
13669
|
-
for (const propName in properties) {
|
|
13670
|
-
const propVal = properties[propName];
|
|
13671
|
-
switch (propName) {
|
|
13695
|
+
lookupName(name) {
|
|
13696
|
+
const { e } = this;
|
|
13697
|
+
switch (name) {
|
|
13698
|
+
case "value":
|
|
13699
|
+
return getValue(e);
|
|
13700
|
+
case "valueAsInt":
|
|
13701
|
+
return toNullIfNaN(parseInt(getValue(e), 10));
|
|
13702
|
+
case "valueAsFloat":
|
|
13703
|
+
return toNullIfNaN(parseFloat(getValue(e)));
|
|
13704
|
+
case "target":
|
|
13705
|
+
return e.target;
|
|
13706
|
+
case "event":
|
|
13707
|
+
return e;
|
|
13708
|
+
case "isAlt":
|
|
13709
|
+
return e.altKey;
|
|
13710
|
+
case "isShift":
|
|
13711
|
+
return e.shiftKey;
|
|
13712
|
+
case "isCtrl":
|
|
13713
|
+
case "isCmd":
|
|
13714
|
+
return isMac2 && e.metaKey || e.ctrlKey;
|
|
13672
13715
|
case "key":
|
|
13673
|
-
key
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
case "
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13716
|
+
return e.key;
|
|
13717
|
+
case "keyCode":
|
|
13718
|
+
return e.keyCode;
|
|
13719
|
+
case "isUpKey":
|
|
13720
|
+
return e.key === "ArrowUp";
|
|
13721
|
+
case "isDownKey":
|
|
13722
|
+
return e.key === "ArrowDown";
|
|
13723
|
+
case "isSend":
|
|
13724
|
+
return e.key === "Enter";
|
|
13725
|
+
case "isCancel":
|
|
13726
|
+
return e.key === "Escape";
|
|
13727
|
+
case "isTabKey":
|
|
13728
|
+
return e.key === "Tab";
|
|
13729
|
+
case "ctx":
|
|
13730
|
+
return new EventContext(this.dispatchPath, this.transactor, this);
|
|
13731
|
+
case "dragInfo":
|
|
13732
|
+
return this.dragInfo;
|
|
13686
13733
|
}
|
|
13734
|
+
return null;
|
|
13687
13735
|
}
|
|
13688
|
-
}
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
constructor(text) {
|
|
13697
|
-
super();
|
|
13698
|
-
this.text = String(text);
|
|
13699
|
-
}
|
|
13700
|
-
get nodeType() {
|
|
13701
|
-
return 3;
|
|
13736
|
+
};
|
|
13737
|
+
NameArgsTransaction = class NameArgsTransaction extends Transaction {
|
|
13738
|
+
constructor(path, transactor, name, args, parentTransaction, opts = {}) {
|
|
13739
|
+
super(path, transactor, parentTransaction);
|
|
13740
|
+
this.name = name;
|
|
13741
|
+
this.args = args;
|
|
13742
|
+
this.opts = opts;
|
|
13743
|
+
this.targetPath = path;
|
|
13702
13744
|
}
|
|
13703
|
-
|
|
13704
|
-
|
|
13745
|
+
handlerProp = null;
|
|
13746
|
+
getHandlerForName(comp) {
|
|
13747
|
+
const handlers = comp?.[this.handlerProp];
|
|
13748
|
+
return handlers?.[this.name] ?? handlers?.$unknown ?? nullHandler;
|
|
13705
13749
|
}
|
|
13706
|
-
|
|
13707
|
-
|
|
13750
|
+
getHandlerAndArgs(_root, instance, comps) {
|
|
13751
|
+
const handler = this.getHandlerForName(comps.getCompFor(instance));
|
|
13752
|
+
return [handler, [...this.args, new EventContext(this.path, this.transactor, this)]];
|
|
13708
13753
|
}
|
|
13709
13754
|
};
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13755
|
+
ResponseEvent = class ResponseEvent extends NameArgsTransaction {
|
|
13756
|
+
handlerProp = "response";
|
|
13757
|
+
};
|
|
13758
|
+
SendEvent = class SendEvent extends NameArgsTransaction {
|
|
13759
|
+
handlerProp = "receive";
|
|
13760
|
+
run(rootVal, comps) {
|
|
13761
|
+
return this.opts.skipSelf ? rootVal : this.updateRootValue(rootVal, comps);
|
|
13714
13762
|
}
|
|
13715
|
-
|
|
13716
|
-
|
|
13763
|
+
afterTransaction() {
|
|
13764
|
+
const { path, name, args, opts, targetPath } = this;
|
|
13765
|
+
if (opts.bubbles && path.steps.length > 0)
|
|
13766
|
+
this.transactor.pushBubble(path.popStep(), name, args, opts, this, targetPath);
|
|
13717
13767
|
}
|
|
13718
|
-
|
|
13719
|
-
|
|
13768
|
+
};
|
|
13769
|
+
BubbleEvent = class BubbleEvent extends SendEvent {
|
|
13770
|
+
handlerProp = "bubble";
|
|
13771
|
+
constructor(path, transactor, name, args, parent, opts, targetPath) {
|
|
13772
|
+
super(path, transactor, name, args, parent, opts);
|
|
13773
|
+
this.targetPath = targetPath ?? path;
|
|
13720
13774
|
}
|
|
13721
|
-
|
|
13722
|
-
|
|
13775
|
+
stopPropagation() {
|
|
13776
|
+
this.opts.bubbles = false;
|
|
13723
13777
|
}
|
|
13724
13778
|
};
|
|
13725
|
-
|
|
13726
|
-
|
|
13727
|
-
|
|
13728
|
-
this.childs = [];
|
|
13729
|
-
addChild(this.childs, childs);
|
|
13730
|
-
}
|
|
13731
|
-
get nodeType() {
|
|
13732
|
-
return 11;
|
|
13779
|
+
EventContext = class EventContext extends Dispatcher {
|
|
13780
|
+
get name() {
|
|
13781
|
+
return this.parent?.name ?? null;
|
|
13733
13782
|
}
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
return false;
|
|
13737
|
-
return childsEqual(this.childs, other.childs);
|
|
13783
|
+
get targetPath() {
|
|
13784
|
+
return this.parent.targetPath;
|
|
13738
13785
|
}
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
appendChildNodes(fragment, this.childs, opts);
|
|
13742
|
-
return fragment;
|
|
13786
|
+
stopPropagation() {
|
|
13787
|
+
return this.parent.stopPropagation();
|
|
13743
13788
|
}
|
|
13744
13789
|
};
|
|
13745
|
-
|
|
13746
|
-
constructor(
|
|
13790
|
+
PathChanges = class PathChanges extends PathBuilder {
|
|
13791
|
+
constructor(dispatcher) {
|
|
13747
13792
|
super();
|
|
13748
|
-
this.
|
|
13749
|
-
this.attrs = attrs ?? {};
|
|
13750
|
-
this.childs = childs ?? [];
|
|
13751
|
-
this.key = key != null ? String(key) : undefined;
|
|
13752
|
-
this.namespace = typeof namespace === "string" ? namespace : null;
|
|
13753
|
-
}
|
|
13754
|
-
get nodeType() {
|
|
13755
|
-
return 1;
|
|
13793
|
+
this.dispatcher = dispatcher;
|
|
13756
13794
|
}
|
|
13757
|
-
|
|
13758
|
-
return this.
|
|
13795
|
+
send(name, args, opts) {
|
|
13796
|
+
return this.dispatcher.sendAtPath(this.buildPath(), name, args, opts);
|
|
13759
13797
|
}
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
return true;
|
|
13763
|
-
if (!(other instanceof VNode2) || !this.isSameKind(other) || this.childs.length !== other.childs.length) {
|
|
13764
|
-
return false;
|
|
13765
|
-
}
|
|
13766
|
-
if (this.attrs !== other.attrs) {
|
|
13767
|
-
for (const key in this.attrs)
|
|
13768
|
-
if (this.attrs[key] !== other.attrs[key])
|
|
13769
|
-
return false;
|
|
13770
|
-
for (const key in other.attrs)
|
|
13771
|
-
if (!Object.hasOwn(this.attrs, key))
|
|
13772
|
-
return false;
|
|
13773
|
-
}
|
|
13774
|
-
return childsEqual(this.childs, other.childs);
|
|
13798
|
+
bubble(name, args, opts) {
|
|
13799
|
+
return this.send(name, args, { skipSelf: true, bubbles: true, ...opts });
|
|
13775
13800
|
}
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
const node = this.namespace === null ? doc.createElement(this.tag) : doc.createElementNS(this.namespace, this.tag);
|
|
13779
|
-
if (this.tag === "SELECT" && "value" in this.attrs) {
|
|
13780
|
-
const { value, ...rest } = this.attrs;
|
|
13781
|
-
applyProperties(node, rest, {});
|
|
13782
|
-
appendChildNodes(node, this.childs, opts);
|
|
13783
|
-
applyProperties(node, { value }, {});
|
|
13784
|
-
} else {
|
|
13785
|
-
applyProperties(node, this.attrs, {});
|
|
13786
|
-
appendChildNodes(node, this.childs, opts);
|
|
13787
|
-
}
|
|
13788
|
-
return node;
|
|
13801
|
+
buildPath() {
|
|
13802
|
+
return this.dispatcher.path.concat(this.pathChanges);
|
|
13789
13803
|
}
|
|
13790
13804
|
};
|
|
13791
13805
|
});
|
|
@@ -13896,7 +13910,7 @@ class App {
|
|
|
13896
13910
|
const txnPath = path.compact().toTransactionPath();
|
|
13897
13911
|
const value = txnPath.lookup(rootValue);
|
|
13898
13912
|
const dragType = e.target.dataset.dragtype ?? "?";
|
|
13899
|
-
const stack =
|
|
13913
|
+
const stack = path.toTransactionPath().buildStack(this.makeStack(rootValue));
|
|
13900
13914
|
this.dragInfo = new DragInfo(txnPath, stack, e, value, dragType, e.target);
|
|
13901
13915
|
} else if (type3 === "drop") {
|
|
13902
13916
|
e.preventDefault();
|