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-dev.js
CHANGED
|
@@ -8841,10 +8841,18 @@ class RequestHandler {
|
|
|
8841
8841
|
|
|
8842
8842
|
// src/vdom.js
|
|
8843
8843
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
8844
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
8845
|
+
var MATH_NS = "http://www.w3.org/1998/Math/MathML";
|
|
8844
8846
|
var isNamespaced = (node) => {
|
|
8845
8847
|
const ns = node.namespaceURI;
|
|
8846
8848
|
return ns !== null && ns !== HTML_NS;
|
|
8847
8849
|
};
|
|
8850
|
+
var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
|
|
8851
|
+
var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
|
|
8852
|
+
function childOpts(vnode, ns, opts) {
|
|
8853
|
+
const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
|
|
8854
|
+
return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
|
|
8855
|
+
}
|
|
8848
8856
|
var NEVER_ASSIGN = new Set([
|
|
8849
8857
|
"width",
|
|
8850
8858
|
"height",
|
|
@@ -8858,7 +8866,7 @@ var NEVER_ASSIGN = new Set([
|
|
|
8858
8866
|
"role",
|
|
8859
8867
|
"popover"
|
|
8860
8868
|
]);
|
|
8861
|
-
function applyProperties(node, props
|
|
8869
|
+
function applyProperties(node, props) {
|
|
8862
8870
|
const namespaced = isNamespaced(node);
|
|
8863
8871
|
for (const name in props)
|
|
8864
8872
|
setProp2(node, name, props[name], namespaced);
|
|
@@ -8867,8 +8875,11 @@ function setProp2(node, name, value, namespaced) {
|
|
|
8867
8875
|
if (name === "dangerouslySetInnerHTML") {
|
|
8868
8876
|
if (value === undefined)
|
|
8869
8877
|
node.replaceChildren();
|
|
8870
|
-
else
|
|
8871
|
-
|
|
8878
|
+
else {
|
|
8879
|
+
const html = value.__html ?? "";
|
|
8880
|
+
if (html !== node.innerHTML)
|
|
8881
|
+
node.innerHTML = html;
|
|
8882
|
+
}
|
|
8872
8883
|
return;
|
|
8873
8884
|
}
|
|
8874
8885
|
if (typeof value === "function")
|
|
@@ -8884,6 +8895,13 @@ function setProp2(node, name, value, namespaced) {
|
|
|
8884
8895
|
else
|
|
8885
8896
|
node.setAttribute(name, value);
|
|
8886
8897
|
}
|
|
8898
|
+
function applyValueLast(node, value) {
|
|
8899
|
+
if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
|
|
8900
|
+
node.removeAttribute("value");
|
|
8901
|
+
} else {
|
|
8902
|
+
setProp2(node, "value", value, isNamespaced(node));
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8887
8905
|
|
|
8888
8906
|
class VBase {
|
|
8889
8907
|
}
|
|
@@ -9002,15 +9020,23 @@ class VNode2 extends VBase {
|
|
|
9002
9020
|
}
|
|
9003
9021
|
toDom(opts) {
|
|
9004
9022
|
const doc = opts.document;
|
|
9005
|
-
const
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9023
|
+
const ns = effectiveNs(this, opts);
|
|
9024
|
+
const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
|
|
9025
|
+
const attrs = this.attrs;
|
|
9026
|
+
const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
|
|
9027
|
+
const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
|
|
9028
|
+
const cOpts = childOpts(this, ns, opts);
|
|
9029
|
+
if ("value" in attrs || "checked" in attrs) {
|
|
9030
|
+
const { value, checked, ...rest } = attrs;
|
|
9031
|
+
applyProperties(node, rest);
|
|
9032
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
9033
|
+
if (value !== undefined)
|
|
9034
|
+
applyValueLast(node, value);
|
|
9035
|
+
if (checked !== undefined)
|
|
9036
|
+
setProp2(node, "checked", checked, false);
|
|
9011
9037
|
} else {
|
|
9012
|
-
applyProperties(node,
|
|
9013
|
-
appendChildNodes(node, this.childs,
|
|
9038
|
+
applyProperties(node, attrs);
|
|
9039
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
9014
9040
|
}
|
|
9015
9041
|
return node;
|
|
9016
9042
|
}
|
|
@@ -9047,18 +9073,37 @@ function morphNode(domNode, source, target, opts) {
|
|
|
9047
9073
|
}
|
|
9048
9074
|
if (type3 === 1 && source.isSameKind(target)) {
|
|
9049
9075
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
9050
|
-
|
|
9076
|
+
let pendingValue;
|
|
9077
|
+
let pendingChecked;
|
|
9078
|
+
let applyValue = false;
|
|
9079
|
+
let applyChecked = false;
|
|
9051
9080
|
if (propsDiff) {
|
|
9052
|
-
if (
|
|
9053
|
-
const { value
|
|
9054
|
-
applyProperties(domNode, rest
|
|
9081
|
+
if ("value" in propsDiff || "checked" in propsDiff) {
|
|
9082
|
+
const { value, checked, ...rest } = propsDiff;
|
|
9083
|
+
applyProperties(domNode, rest);
|
|
9084
|
+
if ("value" in propsDiff) {
|
|
9085
|
+
pendingValue = value;
|
|
9086
|
+
applyValue = true;
|
|
9087
|
+
}
|
|
9088
|
+
if ("checked" in propsDiff) {
|
|
9089
|
+
pendingChecked = checked;
|
|
9090
|
+
applyChecked = true;
|
|
9091
|
+
}
|
|
9055
9092
|
} else
|
|
9056
|
-
applyProperties(domNode, propsDiff
|
|
9093
|
+
applyProperties(domNode, propsDiff);
|
|
9094
|
+
}
|
|
9095
|
+
if (!target.attrs.dangerouslySetInnerHTML) {
|
|
9096
|
+
const ns = effectiveNs(target, opts);
|
|
9097
|
+
morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
|
|
9057
9098
|
}
|
|
9058
|
-
if (!target.attrs.
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9099
|
+
if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
|
|
9100
|
+
pendingValue = target.attrs.value;
|
|
9101
|
+
applyValue = true;
|
|
9102
|
+
}
|
|
9103
|
+
if (applyValue)
|
|
9104
|
+
applyValueLast(domNode, pendingValue);
|
|
9105
|
+
if (applyChecked)
|
|
9106
|
+
setProp2(domNode, "checked", pendingChecked, false);
|
|
9062
9107
|
return domNode;
|
|
9063
9108
|
}
|
|
9064
9109
|
if (type3 === 11) {
|
|
@@ -9162,8 +9207,18 @@ function h(tagName, properties, children, namespace) {
|
|
|
9162
9207
|
props[propName] = propVal;
|
|
9163
9208
|
}
|
|
9164
9209
|
}
|
|
9210
|
+
if (namespace == null) {
|
|
9211
|
+
const lower = tagName.toLowerCase();
|
|
9212
|
+
if (lower === "svg") {
|
|
9213
|
+
namespace = SVG_NS;
|
|
9214
|
+
tagName = "svg";
|
|
9215
|
+
} else if (lower === "math") {
|
|
9216
|
+
namespace = MATH_NS;
|
|
9217
|
+
tagName = "math";
|
|
9218
|
+
}
|
|
9219
|
+
}
|
|
9165
9220
|
const c = tagName.charCodeAt(0);
|
|
9166
|
-
const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
|
|
9221
|
+
const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
|
|
9167
9222
|
const normalizedChildren = [];
|
|
9168
9223
|
addChild(normalizedChildren, children);
|
|
9169
9224
|
return new VNode2(tag, props, normalizedChildren, key, namespace);
|
|
@@ -9415,16 +9470,16 @@ function parseXOpVal(opName, value, px, parserFn) {
|
|
|
9415
9470
|
return val;
|
|
9416
9471
|
}
|
|
9417
9472
|
function processXExtras(node, attrs, opName, startIdx, px) {
|
|
9418
|
-
const consumed =
|
|
9419
|
-
const wrappable = X_OP_WRAPPABLE.has(opName);
|
|
9473
|
+
const { consumed, wrappable } = X_OPS[opName];
|
|
9420
9474
|
const wrappers = [];
|
|
9421
9475
|
for (let i = startIdx;i < attrs.length; i++) {
|
|
9422
9476
|
const a = attrs[i];
|
|
9423
9477
|
const aName = a.name;
|
|
9424
9478
|
if (consumed.has(aName))
|
|
9425
9479
|
continue;
|
|
9426
|
-
|
|
9427
|
-
|
|
9480
|
+
const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
|
|
9481
|
+
if (wrapper) {
|
|
9482
|
+
wrappers.push([wrapper, vp.parseBool(a.value, px)]);
|
|
9428
9483
|
continue;
|
|
9429
9484
|
}
|
|
9430
9485
|
const issueInfo = { op: opName, name: aName, value: a.value };
|
|
@@ -9516,6 +9571,12 @@ class RenderViewId extends ANode {
|
|
|
9516
9571
|
}
|
|
9517
9572
|
setDataAttr(_key, _val) {}
|
|
9518
9573
|
}
|
|
9574
|
+
function dynRenderStep(comp, name, key) {
|
|
9575
|
+
const p = resolveDynProducer(comp, name);
|
|
9576
|
+
if (!p)
|
|
9577
|
+
return null;
|
|
9578
|
+
return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
|
|
9579
|
+
}
|
|
9519
9580
|
|
|
9520
9581
|
class RenderNode extends RenderViewId {
|
|
9521
9582
|
render(stack, rx) {
|
|
@@ -9523,10 +9584,8 @@ class RenderNode extends RenderViewId {
|
|
|
9523
9584
|
return rx.renderIt(newStack, this, "", this.viewId);
|
|
9524
9585
|
}
|
|
9525
9586
|
toPathStep(ctx) {
|
|
9526
|
-
if (this.val instanceof DynVal)
|
|
9527
|
-
|
|
9528
|
-
return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
|
|
9529
|
-
}
|
|
9587
|
+
if (this.val instanceof DynVal)
|
|
9588
|
+
return dynRenderStep(ctx.comp, this.val.name);
|
|
9530
9589
|
return super.toPathStep(ctx);
|
|
9531
9590
|
}
|
|
9532
9591
|
}
|
|
@@ -9542,10 +9601,8 @@ class RenderItNode extends RenderViewId {
|
|
|
9542
9601
|
return null;
|
|
9543
9602
|
const nextNode = next.resolveNode();
|
|
9544
9603
|
if (nextNode instanceof EachNode && next.hasKey) {
|
|
9545
|
-
if (nextNode.val instanceof DynVal)
|
|
9546
|
-
|
|
9547
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
|
|
9548
|
-
}
|
|
9604
|
+
if (nextNode.val instanceof DynVal)
|
|
9605
|
+
return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
|
|
9549
9606
|
return new EachRenderItStep(nextNode.val.name, next.key);
|
|
9550
9607
|
}
|
|
9551
9608
|
return null;
|
|
@@ -9561,12 +9618,8 @@ class RenderEachNode extends RenderViewId {
|
|
|
9561
9618
|
return rx.renderEach(stack, this.iterInfo, this, this.viewId);
|
|
9562
9619
|
}
|
|
9563
9620
|
toPathStep(ctx) {
|
|
9564
|
-
if (this.val instanceof DynVal)
|
|
9565
|
-
|
|
9566
|
-
return null;
|
|
9567
|
-
const p = resolveDynProducer(ctx.comp, this.val.name);
|
|
9568
|
-
return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
|
|
9569
|
-
}
|
|
9621
|
+
if (this.val instanceof DynVal)
|
|
9622
|
+
return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
|
|
9570
9623
|
return super.toPathStep(ctx);
|
|
9571
9624
|
}
|
|
9572
9625
|
static parse(px, vp2, s, as, attrs) {
|
|
@@ -9696,17 +9749,18 @@ class IterInfo {
|
|
|
9696
9749
|
}
|
|
9697
9750
|
var filterAlwaysTrue = (_v, _k, _seq) => true;
|
|
9698
9751
|
var nullLoopWith = (seq) => ({ iterData: { seq } });
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
}
|
|
9708
|
-
|
|
9709
|
-
|
|
9752
|
+
function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
|
|
9753
|
+
return { consumed: new Set(consumed), wrappable, wrapper };
|
|
9754
|
+
}
|
|
9755
|
+
var X_OPS = {
|
|
9756
|
+
slot: xOp(),
|
|
9757
|
+
text: xOp([], { wrappable: true }),
|
|
9758
|
+
render: xOp(["as"], { wrappable: true }),
|
|
9759
|
+
"render-it": xOp(["as"], { wrappable: true }),
|
|
9760
|
+
"render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
|
|
9761
|
+
show: xOp([], { wrapper: ShowNode }),
|
|
9762
|
+
hide: xOp([], { wrapper: HideNode })
|
|
9763
|
+
};
|
|
9710
9764
|
var WRAPPER_NODES = {
|
|
9711
9765
|
slot: SlotNode,
|
|
9712
9766
|
show: ShowNode,
|
|
@@ -9794,29 +9848,30 @@ var isBlockDomNode = (n) => {
|
|
|
9794
9848
|
const node = n instanceof FragmentNode ? n.childs[0] : n;
|
|
9795
9849
|
return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
|
|
9796
9850
|
};
|
|
9851
|
+
var isEmptyText = (c) => c instanceof TextNode && c.val === "";
|
|
9852
|
+
function trimEdgeWhite(node) {
|
|
9853
|
+
if (!node.isWhiteSpace?.())
|
|
9854
|
+
return false;
|
|
9855
|
+
node.condenseWhiteSpace();
|
|
9856
|
+
return true;
|
|
9857
|
+
}
|
|
9797
9858
|
function condenseChildsWhites(childs) {
|
|
9798
9859
|
if (childs.length === 0)
|
|
9799
9860
|
return childs;
|
|
9800
|
-
let changed = false;
|
|
9801
|
-
if (childs[0].isWhiteSpace?.()) {
|
|
9802
|
-
childs[0].condenseWhiteSpace();
|
|
9803
|
-
changed = true;
|
|
9804
|
-
}
|
|
9805
9861
|
const last = childs.length - 1;
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
}
|
|
9862
|
+
let emptied = trimEdgeWhite(childs[0]);
|
|
9863
|
+
if (last > 0 && trimEdgeWhite(childs[last]))
|
|
9864
|
+
emptied = true;
|
|
9810
9865
|
for (let i = 1;i < last; i++) {
|
|
9811
9866
|
const cur = childs[i];
|
|
9812
|
-
if (cur.isWhiteSpace?.() && cur.hasNewLine())
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9867
|
+
if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
|
|
9868
|
+
continue;
|
|
9869
|
+
const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
|
|
9870
|
+
cur.condenseWhiteSpace(bothBlock ? "" : " ");
|
|
9871
|
+
if (bothBlock)
|
|
9872
|
+
emptied = true;
|
|
9818
9873
|
}
|
|
9819
|
-
return
|
|
9874
|
+
return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
|
|
9820
9875
|
}
|
|
9821
9876
|
|
|
9822
9877
|
class View {
|