tutuca 0.9.67 → 0.9.68
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 +74 -23
- package/dist/tutuca-dev.ext.js +76 -21
- package/dist/tutuca-dev.js +76 -21
- package/dist/tutuca-dev.min.js +1 -1
- package/dist/tutuca-extra.ext.js +76 -21
- package/dist/tutuca-extra.js +76 -21
- package/dist/tutuca-extra.min.js +1 -1
- package/dist/tutuca.ext.js +76 -21
- package/dist/tutuca.js +76 -21
- package/dist/tutuca.min.js +1 -1
- package/package.json +1 -1
- package/skill/tutuca-source/tutuca.ext.js +76 -21
package/dist/tutuca.ext.js
CHANGED
|
@@ -1173,10 +1173,18 @@ class RequestHandler {
|
|
|
1173
1173
|
|
|
1174
1174
|
// src/vdom.js
|
|
1175
1175
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
1176
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1177
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
1176
1178
|
var isNamespaced = (node) => {
|
|
1177
1179
|
const ns = node.namespaceURI;
|
|
1178
1180
|
return ns !== null && ns !== HTML_NS;
|
|
1179
1181
|
};
|
|
1182
|
+
var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
|
|
1183
|
+
var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
|
|
1184
|
+
function childOpts(vnode, ns, opts) {
|
|
1185
|
+
const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
|
|
1186
|
+
return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
|
|
1187
|
+
}
|
|
1180
1188
|
var NEVER_ASSIGN = new Set([
|
|
1181
1189
|
"width",
|
|
1182
1190
|
"height",
|
|
@@ -1190,7 +1198,7 @@ var NEVER_ASSIGN = new Set([
|
|
|
1190
1198
|
"role",
|
|
1191
1199
|
"popover"
|
|
1192
1200
|
]);
|
|
1193
|
-
function applyProperties(node, props
|
|
1201
|
+
function applyProperties(node, props) {
|
|
1194
1202
|
const namespaced = isNamespaced(node);
|
|
1195
1203
|
for (const name in props)
|
|
1196
1204
|
setProp(node, name, props[name], namespaced);
|
|
@@ -1199,8 +1207,11 @@ function setProp(node, name, value, namespaced) {
|
|
|
1199
1207
|
if (name === "dangerouslySetInnerHTML") {
|
|
1200
1208
|
if (value === undefined)
|
|
1201
1209
|
node.replaceChildren();
|
|
1202
|
-
else
|
|
1203
|
-
|
|
1210
|
+
else {
|
|
1211
|
+
const html = value.__html ?? "";
|
|
1212
|
+
if (html !== node.innerHTML)
|
|
1213
|
+
node.innerHTML = html;
|
|
1214
|
+
}
|
|
1204
1215
|
return;
|
|
1205
1216
|
}
|
|
1206
1217
|
if (typeof value === "function")
|
|
@@ -1216,6 +1227,13 @@ function setProp(node, name, value, namespaced) {
|
|
|
1216
1227
|
else
|
|
1217
1228
|
node.setAttribute(name, value);
|
|
1218
1229
|
}
|
|
1230
|
+
function applyValueLast(node, value) {
|
|
1231
|
+
if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
|
|
1232
|
+
node.removeAttribute("value");
|
|
1233
|
+
} else {
|
|
1234
|
+
setProp(node, "value", value, isNamespaced(node));
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1219
1237
|
|
|
1220
1238
|
class VBase {
|
|
1221
1239
|
}
|
|
@@ -1334,15 +1352,23 @@ class VNode extends VBase {
|
|
|
1334
1352
|
}
|
|
1335
1353
|
toDom(opts) {
|
|
1336
1354
|
const doc = opts.document;
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1355
|
+
const ns = effectiveNs(this, opts);
|
|
1356
|
+
const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
|
|
1357
|
+
const attrs = this.attrs;
|
|
1358
|
+
const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
|
|
1359
|
+
const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
|
|
1360
|
+
const cOpts = childOpts(this, ns, opts);
|
|
1361
|
+
if ("value" in attrs || "checked" in attrs) {
|
|
1362
|
+
const { value, checked, ...rest } = attrs;
|
|
1363
|
+
applyProperties(node, rest);
|
|
1364
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
1365
|
+
if (value !== undefined)
|
|
1366
|
+
applyValueLast(node, value);
|
|
1367
|
+
if (checked !== undefined)
|
|
1368
|
+
setProp(node, "checked", checked, false);
|
|
1343
1369
|
} else {
|
|
1344
|
-
applyProperties(node,
|
|
1345
|
-
appendChildNodes(node, this.childs,
|
|
1370
|
+
applyProperties(node, attrs);
|
|
1371
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
1346
1372
|
}
|
|
1347
1373
|
return node;
|
|
1348
1374
|
}
|
|
@@ -1379,18 +1405,37 @@ function morphNode(domNode, source, target, opts) {
|
|
|
1379
1405
|
}
|
|
1380
1406
|
if (type === 1 && source.isSameKind(target)) {
|
|
1381
1407
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
1382
|
-
|
|
1408
|
+
let pendingValue;
|
|
1409
|
+
let pendingChecked;
|
|
1410
|
+
let applyValue = false;
|
|
1411
|
+
let applyChecked = false;
|
|
1383
1412
|
if (propsDiff) {
|
|
1384
|
-
if (
|
|
1385
|
-
const { value
|
|
1386
|
-
applyProperties(domNode, rest
|
|
1413
|
+
if ("value" in propsDiff || "checked" in propsDiff) {
|
|
1414
|
+
const { value, checked, ...rest } = propsDiff;
|
|
1415
|
+
applyProperties(domNode, rest);
|
|
1416
|
+
if ("value" in propsDiff) {
|
|
1417
|
+
pendingValue = value;
|
|
1418
|
+
applyValue = true;
|
|
1419
|
+
}
|
|
1420
|
+
if ("checked" in propsDiff) {
|
|
1421
|
+
pendingChecked = checked;
|
|
1422
|
+
applyChecked = true;
|
|
1423
|
+
}
|
|
1387
1424
|
} else
|
|
1388
|
-
applyProperties(domNode, propsDiff
|
|
1425
|
+
applyProperties(domNode, propsDiff);
|
|
1426
|
+
}
|
|
1427
|
+
if (!target.attrs.dangerouslySetInnerHTML) {
|
|
1428
|
+
const ns = effectiveNs(target, opts);
|
|
1429
|
+
morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
|
|
1389
1430
|
}
|
|
1390
|
-
if (!target.attrs.
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1431
|
+
if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
|
|
1432
|
+
pendingValue = target.attrs.value;
|
|
1433
|
+
applyValue = true;
|
|
1434
|
+
}
|
|
1435
|
+
if (applyValue)
|
|
1436
|
+
applyValueLast(domNode, pendingValue);
|
|
1437
|
+
if (applyChecked)
|
|
1438
|
+
setProp(domNode, "checked", pendingChecked, false);
|
|
1394
1439
|
return domNode;
|
|
1395
1440
|
}
|
|
1396
1441
|
if (type === 11) {
|
|
@@ -1494,8 +1539,18 @@ function h(tagName, properties, children, namespace) {
|
|
|
1494
1539
|
props[propName] = propVal;
|
|
1495
1540
|
}
|
|
1496
1541
|
}
|
|
1542
|
+
if (namespace == null) {
|
|
1543
|
+
const lower = tagName.toLowerCase();
|
|
1544
|
+
if (lower === "svg") {
|
|
1545
|
+
namespace = SVG_NS;
|
|
1546
|
+
tagName = "svg";
|
|
1547
|
+
} else if (lower === "math") {
|
|
1548
|
+
namespace = MATH_NS;
|
|
1549
|
+
tagName = "math";
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1497
1552
|
const c = tagName.charCodeAt(0);
|
|
1498
|
-
const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
1553
|
+
const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
|
|
1499
1554
|
const normalizedChildren = [];
|
|
1500
1555
|
addChild(normalizedChildren, children);
|
|
1501
1556
|
return new VNode(tag, props, normalizedChildren, key, namespace);
|
package/dist/tutuca.js
CHANGED
|
@@ -5546,10 +5546,18 @@ class RequestHandler {
|
|
|
5546
5546
|
|
|
5547
5547
|
// src/vdom.js
|
|
5548
5548
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
5549
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
5550
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
5549
5551
|
var isNamespaced = (node) => {
|
|
5550
5552
|
const ns = node.namespaceURI;
|
|
5551
5553
|
return ns !== null && ns !== HTML_NS;
|
|
5552
5554
|
};
|
|
5555
|
+
var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
|
|
5556
|
+
var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
|
|
5557
|
+
function childOpts(vnode, ns, opts) {
|
|
5558
|
+
const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
|
|
5559
|
+
return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
|
|
5560
|
+
}
|
|
5553
5561
|
var NEVER_ASSIGN = new Set([
|
|
5554
5562
|
"width",
|
|
5555
5563
|
"height",
|
|
@@ -5563,7 +5571,7 @@ var NEVER_ASSIGN = new Set([
|
|
|
5563
5571
|
"role",
|
|
5564
5572
|
"popover"
|
|
5565
5573
|
]);
|
|
5566
|
-
function applyProperties(node, props
|
|
5574
|
+
function applyProperties(node, props) {
|
|
5567
5575
|
const namespaced = isNamespaced(node);
|
|
5568
5576
|
for (const name in props)
|
|
5569
5577
|
setProp2(node, name, props[name], namespaced);
|
|
@@ -5572,8 +5580,11 @@ function setProp2(node, name, value, namespaced) {
|
|
|
5572
5580
|
if (name === "dangerouslySetInnerHTML") {
|
|
5573
5581
|
if (value === undefined)
|
|
5574
5582
|
node.replaceChildren();
|
|
5575
|
-
else
|
|
5576
|
-
|
|
5583
|
+
else {
|
|
5584
|
+
const html = value.__html ?? "";
|
|
5585
|
+
if (html !== node.innerHTML)
|
|
5586
|
+
node.innerHTML = html;
|
|
5587
|
+
}
|
|
5577
5588
|
return;
|
|
5578
5589
|
}
|
|
5579
5590
|
if (typeof value === "function")
|
|
@@ -5589,6 +5600,13 @@ function setProp2(node, name, value, namespaced) {
|
|
|
5589
5600
|
else
|
|
5590
5601
|
node.setAttribute(name, value);
|
|
5591
5602
|
}
|
|
5603
|
+
function applyValueLast(node, value) {
|
|
5604
|
+
if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
|
|
5605
|
+
node.removeAttribute("value");
|
|
5606
|
+
} else {
|
|
5607
|
+
setProp2(node, "value", value, isNamespaced(node));
|
|
5608
|
+
}
|
|
5609
|
+
}
|
|
5592
5610
|
|
|
5593
5611
|
class VBase {
|
|
5594
5612
|
}
|
|
@@ -5707,15 +5725,23 @@ class VNode2 extends VBase {
|
|
|
5707
5725
|
}
|
|
5708
5726
|
toDom(opts) {
|
|
5709
5727
|
const doc = opts.document;
|
|
5710
|
-
const
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5728
|
+
const ns = effectiveNs(this, opts);
|
|
5729
|
+
const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
|
|
5730
|
+
const attrs = this.attrs;
|
|
5731
|
+
const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
|
|
5732
|
+
const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
|
|
5733
|
+
const cOpts = childOpts(this, ns, opts);
|
|
5734
|
+
if ("value" in attrs || "checked" in attrs) {
|
|
5735
|
+
const { value, checked, ...rest } = attrs;
|
|
5736
|
+
applyProperties(node, rest);
|
|
5737
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
5738
|
+
if (value !== undefined)
|
|
5739
|
+
applyValueLast(node, value);
|
|
5740
|
+
if (checked !== undefined)
|
|
5741
|
+
setProp2(node, "checked", checked, false);
|
|
5716
5742
|
} else {
|
|
5717
|
-
applyProperties(node,
|
|
5718
|
-
appendChildNodes(node, this.childs,
|
|
5743
|
+
applyProperties(node, attrs);
|
|
5744
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
5719
5745
|
}
|
|
5720
5746
|
return node;
|
|
5721
5747
|
}
|
|
@@ -5752,18 +5778,37 @@ function morphNode(domNode, source, target, opts) {
|
|
|
5752
5778
|
}
|
|
5753
5779
|
if (type === 1 && source.isSameKind(target)) {
|
|
5754
5780
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
5755
|
-
|
|
5781
|
+
let pendingValue;
|
|
5782
|
+
let pendingChecked;
|
|
5783
|
+
let applyValue = false;
|
|
5784
|
+
let applyChecked = false;
|
|
5756
5785
|
if (propsDiff) {
|
|
5757
|
-
if (
|
|
5758
|
-
const { value
|
|
5759
|
-
applyProperties(domNode, rest
|
|
5786
|
+
if ("value" in propsDiff || "checked" in propsDiff) {
|
|
5787
|
+
const { value, checked, ...rest } = propsDiff;
|
|
5788
|
+
applyProperties(domNode, rest);
|
|
5789
|
+
if ("value" in propsDiff) {
|
|
5790
|
+
pendingValue = value;
|
|
5791
|
+
applyValue = true;
|
|
5792
|
+
}
|
|
5793
|
+
if ("checked" in propsDiff) {
|
|
5794
|
+
pendingChecked = checked;
|
|
5795
|
+
applyChecked = true;
|
|
5796
|
+
}
|
|
5760
5797
|
} else
|
|
5761
|
-
applyProperties(domNode, propsDiff
|
|
5798
|
+
applyProperties(domNode, propsDiff);
|
|
5799
|
+
}
|
|
5800
|
+
if (!target.attrs.dangerouslySetInnerHTML) {
|
|
5801
|
+
const ns = effectiveNs(target, opts);
|
|
5802
|
+
morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
|
|
5762
5803
|
}
|
|
5763
|
-
if (!target.attrs.
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5804
|
+
if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
|
|
5805
|
+
pendingValue = target.attrs.value;
|
|
5806
|
+
applyValue = true;
|
|
5807
|
+
}
|
|
5808
|
+
if (applyValue)
|
|
5809
|
+
applyValueLast(domNode, pendingValue);
|
|
5810
|
+
if (applyChecked)
|
|
5811
|
+
setProp2(domNode, "checked", pendingChecked, false);
|
|
5767
5812
|
return domNode;
|
|
5768
5813
|
}
|
|
5769
5814
|
if (type === 11) {
|
|
@@ -5867,8 +5912,18 @@ function h(tagName, properties, children, namespace) {
|
|
|
5867
5912
|
props[propName] = propVal;
|
|
5868
5913
|
}
|
|
5869
5914
|
}
|
|
5915
|
+
if (namespace == null) {
|
|
5916
|
+
const lower = tagName.toLowerCase();
|
|
5917
|
+
if (lower === "svg") {
|
|
5918
|
+
namespace = SVG_NS;
|
|
5919
|
+
tagName = "svg";
|
|
5920
|
+
} else if (lower === "math") {
|
|
5921
|
+
namespace = MATH_NS;
|
|
5922
|
+
tagName = "math";
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5870
5925
|
const c = tagName.charCodeAt(0);
|
|
5871
|
-
const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
5926
|
+
const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
|
|
5872
5927
|
const normalizedChildren = [];
|
|
5873
5928
|
addChild(normalizedChildren, children);
|
|
5874
5929
|
return new VNode2(tag, props, normalizedChildren, key, namespace);
|