tutuca 0.9.67 → 0.9.69
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 +120 -70
- package/dist/tutuca-dev.ext.js +121 -66
- package/dist/tutuca-dev.js +121 -66
- package/dist/tutuca-dev.min.js +1 -1
- package/dist/tutuca-extra.ext.js +120 -65
- package/dist/tutuca-extra.js +120 -65
- package/dist/tutuca-extra.min.js +1 -1
- package/dist/tutuca.ext.js +120 -65
- package/dist/tutuca.js +120 -65
- package/dist/tutuca.min.js +1 -1
- package/package.json +1 -1
- package/skill/tutuca/core.md +47 -105
- package/skill/tutuca/testing.md +8 -1
- package/skill/tutuca-source/tutuca.ext.js +120 -65
package/dist/tutuca-extra.ext.js
CHANGED
|
@@ -1284,10 +1284,18 @@ class RequestHandler {
|
|
|
1284
1284
|
|
|
1285
1285
|
// src/vdom.js
|
|
1286
1286
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
1287
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1288
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
1287
1289
|
var isNamespaced = (node) => {
|
|
1288
1290
|
const ns = node.namespaceURI;
|
|
1289
1291
|
return ns !== null && ns !== HTML_NS;
|
|
1290
1292
|
};
|
|
1293
|
+
var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
|
|
1294
|
+
var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
|
|
1295
|
+
function childOpts(vnode, ns, opts) {
|
|
1296
|
+
const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
|
|
1297
|
+
return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
|
|
1298
|
+
}
|
|
1291
1299
|
var NEVER_ASSIGN = new Set([
|
|
1292
1300
|
"width",
|
|
1293
1301
|
"height",
|
|
@@ -1301,7 +1309,7 @@ var NEVER_ASSIGN = new Set([
|
|
|
1301
1309
|
"role",
|
|
1302
1310
|
"popover"
|
|
1303
1311
|
]);
|
|
1304
|
-
function applyProperties(node, props
|
|
1312
|
+
function applyProperties(node, props) {
|
|
1305
1313
|
const namespaced = isNamespaced(node);
|
|
1306
1314
|
for (const name in props)
|
|
1307
1315
|
setProp(node, name, props[name], namespaced);
|
|
@@ -1310,8 +1318,11 @@ function setProp(node, name, value, namespaced) {
|
|
|
1310
1318
|
if (name === "dangerouslySetInnerHTML") {
|
|
1311
1319
|
if (value === undefined)
|
|
1312
1320
|
node.replaceChildren();
|
|
1313
|
-
else
|
|
1314
|
-
|
|
1321
|
+
else {
|
|
1322
|
+
const html = value.__html ?? "";
|
|
1323
|
+
if (html !== node.innerHTML)
|
|
1324
|
+
node.innerHTML = html;
|
|
1325
|
+
}
|
|
1315
1326
|
return;
|
|
1316
1327
|
}
|
|
1317
1328
|
if (typeof value === "function")
|
|
@@ -1327,6 +1338,13 @@ function setProp(node, name, value, namespaced) {
|
|
|
1327
1338
|
else
|
|
1328
1339
|
node.setAttribute(name, value);
|
|
1329
1340
|
}
|
|
1341
|
+
function applyValueLast(node, value) {
|
|
1342
|
+
if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
|
|
1343
|
+
node.removeAttribute("value");
|
|
1344
|
+
} else {
|
|
1345
|
+
setProp(node, "value", value, isNamespaced(node));
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1330
1348
|
|
|
1331
1349
|
class VBase {
|
|
1332
1350
|
}
|
|
@@ -1445,15 +1463,23 @@ class VNode extends VBase {
|
|
|
1445
1463
|
}
|
|
1446
1464
|
toDom(opts) {
|
|
1447
1465
|
const doc = opts.document;
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1466
|
+
const ns = effectiveNs(this, opts);
|
|
1467
|
+
const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
|
|
1468
|
+
const attrs = this.attrs;
|
|
1469
|
+
const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
|
|
1470
|
+
const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
|
|
1471
|
+
const cOpts = childOpts(this, ns, opts);
|
|
1472
|
+
if ("value" in attrs || "checked" in attrs) {
|
|
1473
|
+
const { value, checked, ...rest } = attrs;
|
|
1474
|
+
applyProperties(node, rest);
|
|
1475
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
1476
|
+
if (value !== undefined)
|
|
1477
|
+
applyValueLast(node, value);
|
|
1478
|
+
if (checked !== undefined)
|
|
1479
|
+
setProp(node, "checked", checked, false);
|
|
1454
1480
|
} else {
|
|
1455
|
-
applyProperties(node,
|
|
1456
|
-
appendChildNodes(node, this.childs,
|
|
1481
|
+
applyProperties(node, attrs);
|
|
1482
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
1457
1483
|
}
|
|
1458
1484
|
return node;
|
|
1459
1485
|
}
|
|
@@ -1490,18 +1516,37 @@ function morphNode(domNode, source, target, opts) {
|
|
|
1490
1516
|
}
|
|
1491
1517
|
if (type === 1 && source.isSameKind(target)) {
|
|
1492
1518
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
1493
|
-
|
|
1519
|
+
let pendingValue;
|
|
1520
|
+
let pendingChecked;
|
|
1521
|
+
let applyValue = false;
|
|
1522
|
+
let applyChecked = false;
|
|
1494
1523
|
if (propsDiff) {
|
|
1495
|
-
if (
|
|
1496
|
-
const { value
|
|
1497
|
-
applyProperties(domNode, rest
|
|
1524
|
+
if ("value" in propsDiff || "checked" in propsDiff) {
|
|
1525
|
+
const { value, checked, ...rest } = propsDiff;
|
|
1526
|
+
applyProperties(domNode, rest);
|
|
1527
|
+
if ("value" in propsDiff) {
|
|
1528
|
+
pendingValue = value;
|
|
1529
|
+
applyValue = true;
|
|
1530
|
+
}
|
|
1531
|
+
if ("checked" in propsDiff) {
|
|
1532
|
+
pendingChecked = checked;
|
|
1533
|
+
applyChecked = true;
|
|
1534
|
+
}
|
|
1498
1535
|
} else
|
|
1499
|
-
applyProperties(domNode, propsDiff
|
|
1536
|
+
applyProperties(domNode, propsDiff);
|
|
1537
|
+
}
|
|
1538
|
+
if (!target.attrs.dangerouslySetInnerHTML) {
|
|
1539
|
+
const ns = effectiveNs(target, opts);
|
|
1540
|
+
morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
|
|
1500
1541
|
}
|
|
1501
|
-
if (!target.attrs.
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1542
|
+
if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
|
|
1543
|
+
pendingValue = target.attrs.value;
|
|
1544
|
+
applyValue = true;
|
|
1545
|
+
}
|
|
1546
|
+
if (applyValue)
|
|
1547
|
+
applyValueLast(domNode, pendingValue);
|
|
1548
|
+
if (applyChecked)
|
|
1549
|
+
setProp(domNode, "checked", pendingChecked, false);
|
|
1505
1550
|
return domNode;
|
|
1506
1551
|
}
|
|
1507
1552
|
if (type === 11) {
|
|
@@ -1605,8 +1650,18 @@ function h(tagName, properties, children, namespace) {
|
|
|
1605
1650
|
props[propName] = propVal;
|
|
1606
1651
|
}
|
|
1607
1652
|
}
|
|
1653
|
+
if (namespace == null) {
|
|
1654
|
+
const lower = tagName.toLowerCase();
|
|
1655
|
+
if (lower === "svg") {
|
|
1656
|
+
namespace = SVG_NS;
|
|
1657
|
+
tagName = "svg";
|
|
1658
|
+
} else if (lower === "math") {
|
|
1659
|
+
namespace = MATH_NS;
|
|
1660
|
+
tagName = "math";
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1608
1663
|
const c = tagName.charCodeAt(0);
|
|
1609
|
-
const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
1664
|
+
const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
|
|
1610
1665
|
const normalizedChildren = [];
|
|
1611
1666
|
addChild(normalizedChildren, children);
|
|
1612
1667
|
return new VNode(tag, props, normalizedChildren, key, namespace);
|
|
@@ -1858,16 +1913,16 @@ function parseXOpVal(opName, value, px, parserFn) {
|
|
|
1858
1913
|
return val;
|
|
1859
1914
|
}
|
|
1860
1915
|
function processXExtras(node, attrs, opName, startIdx, px) {
|
|
1861
|
-
const consumed =
|
|
1862
|
-
const wrappable = X_OP_WRAPPABLE.has(opName);
|
|
1916
|
+
const { consumed, wrappable } = X_OPS[opName];
|
|
1863
1917
|
const wrappers = [];
|
|
1864
1918
|
for (let i = startIdx;i < attrs.length; i++) {
|
|
1865
1919
|
const a = attrs[i];
|
|
1866
1920
|
const aName = a.name;
|
|
1867
1921
|
if (consumed.has(aName))
|
|
1868
1922
|
continue;
|
|
1869
|
-
|
|
1870
|
-
|
|
1923
|
+
const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
|
|
1924
|
+
if (wrapper) {
|
|
1925
|
+
wrappers.push([wrapper, vp.parseBool(a.value, px)]);
|
|
1871
1926
|
continue;
|
|
1872
1927
|
}
|
|
1873
1928
|
const issueInfo = { op: opName, name: aName, value: a.value };
|
|
@@ -1959,6 +2014,12 @@ class RenderViewId extends ANode {
|
|
|
1959
2014
|
}
|
|
1960
2015
|
setDataAttr(_key, _val) {}
|
|
1961
2016
|
}
|
|
2017
|
+
function dynRenderStep(comp, name, key) {
|
|
2018
|
+
const p = resolveDynProducer(comp, name);
|
|
2019
|
+
if (!p)
|
|
2020
|
+
return null;
|
|
2021
|
+
return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
|
|
2022
|
+
}
|
|
1962
2023
|
|
|
1963
2024
|
class RenderNode extends RenderViewId {
|
|
1964
2025
|
render(stack, rx) {
|
|
@@ -1966,10 +2027,8 @@ class RenderNode extends RenderViewId {
|
|
|
1966
2027
|
return rx.renderIt(newStack, this, "", this.viewId);
|
|
1967
2028
|
}
|
|
1968
2029
|
toPathStep(ctx) {
|
|
1969
|
-
if (this.val instanceof DynVal)
|
|
1970
|
-
|
|
1971
|
-
return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
|
|
1972
|
-
}
|
|
2030
|
+
if (this.val instanceof DynVal)
|
|
2031
|
+
return dynRenderStep(ctx.comp, this.val.name);
|
|
1973
2032
|
return super.toPathStep(ctx);
|
|
1974
2033
|
}
|
|
1975
2034
|
}
|
|
@@ -1985,10 +2044,8 @@ class RenderItNode extends RenderViewId {
|
|
|
1985
2044
|
return null;
|
|
1986
2045
|
const nextNode = next.resolveNode();
|
|
1987
2046
|
if (nextNode instanceof EachNode && next.hasKey) {
|
|
1988
|
-
if (nextNode.val instanceof DynVal)
|
|
1989
|
-
|
|
1990
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
|
|
1991
|
-
}
|
|
2047
|
+
if (nextNode.val instanceof DynVal)
|
|
2048
|
+
return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
|
|
1992
2049
|
return new EachRenderItStep(nextNode.val.name, next.key);
|
|
1993
2050
|
}
|
|
1994
2051
|
return null;
|
|
@@ -2004,12 +2061,8 @@ class RenderEachNode extends RenderViewId {
|
|
|
2004
2061
|
return rx.renderEach(stack, this.iterInfo, this, this.viewId);
|
|
2005
2062
|
}
|
|
2006
2063
|
toPathStep(ctx) {
|
|
2007
|
-
if (this.val instanceof DynVal)
|
|
2008
|
-
|
|
2009
|
-
return null;
|
|
2010
|
-
const p = resolveDynProducer(ctx.comp, this.val.name);
|
|
2011
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
|
|
2012
|
-
}
|
|
2064
|
+
if (this.val instanceof DynVal)
|
|
2065
|
+
return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
|
|
2013
2066
|
return super.toPathStep(ctx);
|
|
2014
2067
|
}
|
|
2015
2068
|
static parse(px, vp2, s, as, attrs) {
|
|
@@ -2139,17 +2192,18 @@ class IterInfo {
|
|
|
2139
2192
|
}
|
|
2140
2193
|
var filterAlwaysTrue = (_v, _k, _seq) => true;
|
|
2141
2194
|
var nullLoopWith = (seq) => ({ iterData: { seq } });
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2195
|
+
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
2196
|
+
return { consumed: new Set(consumed), wrappable, wrapper };
|
|
2197
|
+
}
|
|
2198
|
+
var X_OPS = {
|
|
2199
|
+
slot: xOp(),
|
|
2200
|
+
text: xOp([], { wrappable: true }),
|
|
2201
|
+
render: xOp(["as"], { wrappable: true }),
|
|
2202
|
+
"render-it": xOp(["as"], { wrappable: true }),
|
|
2203
|
+
"render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
|
|
2204
|
+
show: xOp([], { wrapper: ShowNode }),
|
|
2205
|
+
hide: xOp([], { wrapper: HideNode })
|
|
2150
2206
|
};
|
|
2151
|
-
var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
|
|
2152
|
-
var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
|
|
2153
2207
|
var WRAPPER_NODES = {
|
|
2154
2208
|
slot: SlotNode,
|
|
2155
2209
|
show: ShowNode,
|
|
@@ -2237,29 +2291,30 @@ var isBlockDomNode = (n) => {
|
|
|
2237
2291
|
const node = n instanceof FragmentNode ? n.childs[0] : n;
|
|
2238
2292
|
return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
|
|
2239
2293
|
};
|
|
2294
|
+
var isEmptyText = (c) => c instanceof TextNode && c.val === "";
|
|
2295
|
+
function trimEdgeWhite(node) {
|
|
2296
|
+
if (!node.isWhiteSpace?.())
|
|
2297
|
+
return false;
|
|
2298
|
+
node.condenseWhiteSpace();
|
|
2299
|
+
return true;
|
|
2300
|
+
}
|
|
2240
2301
|
function condenseChildsWhites(childs) {
|
|
2241
2302
|
if (childs.length === 0)
|
|
2242
2303
|
return childs;
|
|
2243
|
-
let changed = false;
|
|
2244
|
-
if (childs[0].isWhiteSpace?.()) {
|
|
2245
|
-
childs[0].condenseWhiteSpace();
|
|
2246
|
-
changed = true;
|
|
2247
|
-
}
|
|
2248
2304
|
const last = childs.length - 1;
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
}
|
|
2305
|
+
let emptied = trimEdgeWhite(childs[0]);
|
|
2306
|
+
if (last > 0 && trimEdgeWhite(childs[last]))
|
|
2307
|
+
emptied = true;
|
|
2253
2308
|
for (let i = 1;i < last; i++) {
|
|
2254
2309
|
const cur = childs[i];
|
|
2255
|
-
if (cur.isWhiteSpace?.() && cur.hasNewLine())
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2310
|
+
if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
|
|
2311
|
+
continue;
|
|
2312
|
+
const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
|
|
2313
|
+
cur.condenseWhiteSpace(bothBlock ? "" : " ");
|
|
2314
|
+
if (bothBlock)
|
|
2315
|
+
emptied = true;
|
|
2261
2316
|
}
|
|
2262
|
-
return
|
|
2317
|
+
return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
|
|
2263
2318
|
}
|
|
2264
2319
|
|
|
2265
2320
|
class View {
|
package/dist/tutuca-extra.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);
|
|
@@ -6120,16 +6175,16 @@ function parseXOpVal(opName, value, px, parserFn) {
|
|
|
6120
6175
|
return val;
|
|
6121
6176
|
}
|
|
6122
6177
|
function processXExtras(node, attrs, opName, startIdx, px) {
|
|
6123
|
-
const consumed =
|
|
6124
|
-
const wrappable = X_OP_WRAPPABLE.has(opName);
|
|
6178
|
+
const { consumed, wrappable } = X_OPS[opName];
|
|
6125
6179
|
const wrappers = [];
|
|
6126
6180
|
for (let i = startIdx;i < attrs.length; i++) {
|
|
6127
6181
|
const a = attrs[i];
|
|
6128
6182
|
const aName = a.name;
|
|
6129
6183
|
if (consumed.has(aName))
|
|
6130
6184
|
continue;
|
|
6131
|
-
|
|
6132
|
-
|
|
6185
|
+
const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
|
|
6186
|
+
if (wrapper) {
|
|
6187
|
+
wrappers.push([wrapper, vp.parseBool(a.value, px)]);
|
|
6133
6188
|
continue;
|
|
6134
6189
|
}
|
|
6135
6190
|
const issueInfo = { op: opName, name: aName, value: a.value };
|
|
@@ -6221,6 +6276,12 @@ class RenderViewId extends ANode {
|
|
|
6221
6276
|
}
|
|
6222
6277
|
setDataAttr(_key, _val) {}
|
|
6223
6278
|
}
|
|
6279
|
+
function dynRenderStep(comp, name, key) {
|
|
6280
|
+
const p = resolveDynProducer(comp, name);
|
|
6281
|
+
if (!p)
|
|
6282
|
+
return null;
|
|
6283
|
+
return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
|
|
6284
|
+
}
|
|
6224
6285
|
|
|
6225
6286
|
class RenderNode extends RenderViewId {
|
|
6226
6287
|
render(stack, rx) {
|
|
@@ -6228,10 +6289,8 @@ class RenderNode extends RenderViewId {
|
|
|
6228
6289
|
return rx.renderIt(newStack, this, "", this.viewId);
|
|
6229
6290
|
}
|
|
6230
6291
|
toPathStep(ctx) {
|
|
6231
|
-
if (this.val instanceof DynVal)
|
|
6232
|
-
|
|
6233
|
-
return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
|
|
6234
|
-
}
|
|
6292
|
+
if (this.val instanceof DynVal)
|
|
6293
|
+
return dynRenderStep(ctx.comp, this.val.name);
|
|
6235
6294
|
return super.toPathStep(ctx);
|
|
6236
6295
|
}
|
|
6237
6296
|
}
|
|
@@ -6247,10 +6306,8 @@ class RenderItNode extends RenderViewId {
|
|
|
6247
6306
|
return null;
|
|
6248
6307
|
const nextNode = next.resolveNode();
|
|
6249
6308
|
if (nextNode instanceof EachNode && next.hasKey) {
|
|
6250
|
-
if (nextNode.val instanceof DynVal)
|
|
6251
|
-
|
|
6252
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
|
|
6253
|
-
}
|
|
6309
|
+
if (nextNode.val instanceof DynVal)
|
|
6310
|
+
return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
|
|
6254
6311
|
return new EachRenderItStep(nextNode.val.name, next.key);
|
|
6255
6312
|
}
|
|
6256
6313
|
return null;
|
|
@@ -6266,12 +6323,8 @@ class RenderEachNode extends RenderViewId {
|
|
|
6266
6323
|
return rx.renderEach(stack, this.iterInfo, this, this.viewId);
|
|
6267
6324
|
}
|
|
6268
6325
|
toPathStep(ctx) {
|
|
6269
|
-
if (this.val instanceof DynVal)
|
|
6270
|
-
|
|
6271
|
-
return null;
|
|
6272
|
-
const p = resolveDynProducer(ctx.comp, this.val.name);
|
|
6273
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
|
|
6274
|
-
}
|
|
6326
|
+
if (this.val instanceof DynVal)
|
|
6327
|
+
return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
|
|
6275
6328
|
return super.toPathStep(ctx);
|
|
6276
6329
|
}
|
|
6277
6330
|
static parse(px, vp2, s, as, attrs) {
|
|
@@ -6401,17 +6454,18 @@ class IterInfo {
|
|
|
6401
6454
|
}
|
|
6402
6455
|
var filterAlwaysTrue = (_v, _k, _seq) => true;
|
|
6403
6456
|
var nullLoopWith = (seq) => ({ iterData: { seq } });
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6457
|
+
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
6458
|
+
return { consumed: new Set(consumed), wrappable, wrapper };
|
|
6459
|
+
}
|
|
6460
|
+
var X_OPS = {
|
|
6461
|
+
slot: xOp(),
|
|
6462
|
+
text: xOp([], { wrappable: true }),
|
|
6463
|
+
render: xOp(["as"], { wrappable: true }),
|
|
6464
|
+
"render-it": xOp(["as"], { wrappable: true }),
|
|
6465
|
+
"render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
|
|
6466
|
+
show: xOp([], { wrapper: ShowNode }),
|
|
6467
|
+
hide: xOp([], { wrapper: HideNode })
|
|
6412
6468
|
};
|
|
6413
|
-
var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
|
|
6414
|
-
var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
|
|
6415
6469
|
var WRAPPER_NODES = {
|
|
6416
6470
|
slot: SlotNode,
|
|
6417
6471
|
show: ShowNode,
|
|
@@ -6499,29 +6553,30 @@ var isBlockDomNode = (n) => {
|
|
|
6499
6553
|
const node = n instanceof FragmentNode ? n.childs[0] : n;
|
|
6500
6554
|
return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
|
|
6501
6555
|
};
|
|
6556
|
+
var isEmptyText = (c) => c instanceof TextNode && c.val === "";
|
|
6557
|
+
function trimEdgeWhite(node) {
|
|
6558
|
+
if (!node.isWhiteSpace?.())
|
|
6559
|
+
return false;
|
|
6560
|
+
node.condenseWhiteSpace();
|
|
6561
|
+
return true;
|
|
6562
|
+
}
|
|
6502
6563
|
function condenseChildsWhites(childs) {
|
|
6503
6564
|
if (childs.length === 0)
|
|
6504
6565
|
return childs;
|
|
6505
|
-
let changed = false;
|
|
6506
|
-
if (childs[0].isWhiteSpace?.()) {
|
|
6507
|
-
childs[0].condenseWhiteSpace();
|
|
6508
|
-
changed = true;
|
|
6509
|
-
}
|
|
6510
6566
|
const last = childs.length - 1;
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
}
|
|
6567
|
+
let emptied = trimEdgeWhite(childs[0]);
|
|
6568
|
+
if (last > 0 && trimEdgeWhite(childs[last]))
|
|
6569
|
+
emptied = true;
|
|
6515
6570
|
for (let i = 1;i < last; i++) {
|
|
6516
6571
|
const cur = childs[i];
|
|
6517
|
-
if (cur.isWhiteSpace?.() && cur.hasNewLine())
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6572
|
+
if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
|
|
6573
|
+
continue;
|
|
6574
|
+
const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
|
|
6575
|
+
cur.condenseWhiteSpace(bothBlock ? "" : " ");
|
|
6576
|
+
if (bothBlock)
|
|
6577
|
+
emptied = true;
|
|
6523
6578
|
}
|
|
6524
|
-
return
|
|
6579
|
+
return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
|
|
6525
6580
|
}
|
|
6526
6581
|
|
|
6527
6582
|
class View {
|