tutuca 0.9.66 → 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 +146 -63
- package/dist/tutuca-dev.ext.js +155 -65
- package/dist/tutuca-dev.js +143 -61
- package/dist/tutuca-dev.min.js +2 -2
- package/dist/tutuca-extra.ext.js +122 -61
- package/dist/tutuca-extra.js +120 -61
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca.ext.js +120 -61
- package/dist/tutuca.js +120 -61
- package/dist/tutuca.min.js +2 -2
- package/package.json +1 -1
- package/skill/tutuca/core.md +10 -2
- package/skill/tutuca/testing.md +3 -2
- package/skill/tutuca-source/SKILL.md +33 -0
- package/skill/tutuca-source/tutuca.ext.js +3883 -0
- package/skill/SKILL.md +0 -46
- package/skill/advanced.md +0 -146
- package/skill/cli.md +0 -117
- package/skill/core.md +0 -793
package/dist/tutuca-dev.js
CHANGED
|
@@ -8840,40 +8840,67 @@ class RequestHandler {
|
|
|
8840
8840
|
}
|
|
8841
8841
|
|
|
8842
8842
|
// src/vdom.js
|
|
8843
|
-
var isHtmlAttribute = (propName) => propName[4] === "-" && (propName[0] === "d" || propName[0] === "a");
|
|
8844
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";
|
|
8845
8846
|
var isNamespaced = (node) => {
|
|
8846
8847
|
const ns = node.namespaceURI;
|
|
8847
8848
|
return ns !== null && ns !== HTML_NS;
|
|
8848
8849
|
};
|
|
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
|
+
}
|
|
8856
|
+
var NEVER_ASSIGN = new Set([
|
|
8857
|
+
"width",
|
|
8858
|
+
"height",
|
|
8859
|
+
"href",
|
|
8860
|
+
"list",
|
|
8861
|
+
"form",
|
|
8862
|
+
"tabIndex",
|
|
8863
|
+
"download",
|
|
8864
|
+
"rowSpan",
|
|
8865
|
+
"colSpan",
|
|
8866
|
+
"role",
|
|
8867
|
+
"popover"
|
|
8868
|
+
]);
|
|
8869
|
+
function applyProperties(node, props) {
|
|
8850
8870
|
const namespaced = isNamespaced(node);
|
|
8851
|
-
for (const
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
node.
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
}
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
if (
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
node.removeAttribute(
|
|
8871
|
+
for (const name in props)
|
|
8872
|
+
setProp2(node, name, props[name], namespaced);
|
|
8873
|
+
}
|
|
8874
|
+
function setProp2(node, name, value, namespaced) {
|
|
8875
|
+
if (name === "dangerouslySetInnerHTML") {
|
|
8876
|
+
if (value === undefined)
|
|
8877
|
+
node.replaceChildren();
|
|
8878
|
+
else {
|
|
8879
|
+
const html = value.__html ?? "";
|
|
8880
|
+
if (html !== node.innerHTML)
|
|
8881
|
+
node.innerHTML = html;
|
|
8882
|
+
}
|
|
8883
|
+
return;
|
|
8884
|
+
}
|
|
8885
|
+
if (typeof value === "function")
|
|
8886
|
+
return;
|
|
8887
|
+
if (!namespaced && !NEVER_ASSIGN.has(name) && name in node) {
|
|
8888
|
+
try {
|
|
8889
|
+
node[name] = value == null ? "" : value;
|
|
8890
|
+
return;
|
|
8891
|
+
} catch {}
|
|
8892
|
+
}
|
|
8893
|
+
if (value == null || value === false && name[4] !== "-")
|
|
8894
|
+
node.removeAttribute(name);
|
|
8875
8895
|
else
|
|
8876
|
-
node
|
|
8896
|
+
node.setAttribute(name, value);
|
|
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
|
+
}
|
|
8877
8904
|
}
|
|
8878
8905
|
|
|
8879
8906
|
class VBase {
|
|
@@ -8993,15 +9020,23 @@ class VNode2 extends VBase {
|
|
|
8993
9020
|
}
|
|
8994
9021
|
toDom(opts) {
|
|
8995
9022
|
const doc = opts.document;
|
|
8996
|
-
const
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
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);
|
|
9002
9037
|
} else {
|
|
9003
|
-
applyProperties(node,
|
|
9004
|
-
appendChildNodes(node, this.childs,
|
|
9038
|
+
applyProperties(node, attrs);
|
|
9039
|
+
appendChildNodes(node, this.childs, cOpts);
|
|
9005
9040
|
}
|
|
9006
9041
|
return node;
|
|
9007
9042
|
}
|
|
@@ -9038,18 +9073,37 @@ function morphNode(domNode, source, target, opts) {
|
|
|
9038
9073
|
}
|
|
9039
9074
|
if (type3 === 1 && source.isSameKind(target)) {
|
|
9040
9075
|
const propsDiff = diffProps(source.attrs, target.attrs);
|
|
9041
|
-
|
|
9076
|
+
let pendingValue;
|
|
9077
|
+
let pendingChecked;
|
|
9078
|
+
let applyValue = false;
|
|
9079
|
+
let applyChecked = false;
|
|
9042
9080
|
if (propsDiff) {
|
|
9043
|
-
if (
|
|
9044
|
-
const { value
|
|
9045
|
-
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
|
+
}
|
|
9046
9092
|
} else
|
|
9047
|
-
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));
|
|
9098
|
+
}
|
|
9099
|
+
if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
|
|
9100
|
+
pendingValue = target.attrs.value;
|
|
9101
|
+
applyValue = true;
|
|
9048
9102
|
}
|
|
9049
|
-
if (
|
|
9050
|
-
|
|
9051
|
-
if (
|
|
9052
|
-
|
|
9103
|
+
if (applyValue)
|
|
9104
|
+
applyValueLast(domNode, pendingValue);
|
|
9105
|
+
if (applyChecked)
|
|
9106
|
+
setProp2(domNode, "checked", pendingChecked, false);
|
|
9053
9107
|
return domNode;
|
|
9054
9108
|
}
|
|
9055
9109
|
if (type3 === 11) {
|
|
@@ -9145,26 +9199,26 @@ function h(tagName, properties, children, namespace) {
|
|
|
9145
9199
|
if (properties) {
|
|
9146
9200
|
for (const propName in properties) {
|
|
9147
9201
|
const propVal = properties[propName];
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9202
|
+
if (propName === "key")
|
|
9203
|
+
key = propVal;
|
|
9204
|
+
else if (propName === "namespace")
|
|
9205
|
+
namespace = namespace ?? propVal;
|
|
9206
|
+
else
|
|
9207
|
+
props[propName] = propVal;
|
|
9208
|
+
}
|
|
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";
|
|
9164
9218
|
}
|
|
9165
9219
|
}
|
|
9166
9220
|
const c = tagName.charCodeAt(0);
|
|
9167
|
-
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;
|
|
9168
9222
|
const normalizedChildren = [];
|
|
9169
9223
|
addChild(normalizedChildren, children);
|
|
9170
9224
|
return new VNode2(tag, props, normalizedChildren, key, namespace);
|
|
@@ -12275,6 +12329,7 @@ var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
|
|
|
12275
12329
|
var REDUNDANT_TEMPLATE_STRING = "REDUNDANT_TEMPLATE_STRING";
|
|
12276
12330
|
var PLACEHOLDERLESS_TEMPLATE_STRING = "PLACEHOLDERLESS_TEMPLATE_STRING";
|
|
12277
12331
|
var UNKNOWN_COMPONENT_SPEC_KEY = "UNKNOWN_COMPONENT_SPEC_KEY";
|
|
12332
|
+
var COMP_FIELD_BAD_SHAPE = "COMP_FIELD_BAD_SHAPE";
|
|
12278
12333
|
var PARSE_ISSUE_KIND_TO_LINT_ID = {
|
|
12279
12334
|
"unknown-directive": UNKNOWN_DIRECTIVE,
|
|
12280
12335
|
"unknown-x-op": UNKNOWN_X_OP,
|
|
@@ -12359,6 +12414,7 @@ var UNSUPPORTED_EXPR_GUIDANCE = {
|
|
|
12359
12414
|
function checkComponent(Comp, lx = new LintContext, { wellKnownExtras = EMPTY_SET2 } = {}) {
|
|
12360
12415
|
return lx.push({ componentName: Comp.name }, () => {
|
|
12361
12416
|
checkUnknownSpecKeys(lx, Comp, wellKnownExtras);
|
|
12417
|
+
checkFieldDeclarations(lx, Comp);
|
|
12362
12418
|
const referencedAlters = new Set;
|
|
12363
12419
|
const referencedInputs = new Set;
|
|
12364
12420
|
const referencedDynamics = new Set;
|
|
@@ -12787,6 +12843,31 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
|
|
|
12787
12843
|
lx.warn(UNKNOWN_COMPONENT_SPEC_KEY, { key }, replaceNameSuggestion(key, candidates));
|
|
12788
12844
|
}
|
|
12789
12845
|
}
|
|
12846
|
+
function checkFieldDeclarations(lx, Comp) {
|
|
12847
|
+
const fields = Comp.Class?.getMetaClass?.().fields;
|
|
12848
|
+
if (!fields)
|
|
12849
|
+
return;
|
|
12850
|
+
for (const fieldName in fields) {
|
|
12851
|
+
const field = fields[fieldName];
|
|
12852
|
+
if (!Object.hasOwn(field, "args"))
|
|
12853
|
+
continue;
|
|
12854
|
+
if (typeof field.type !== "string") {
|
|
12855
|
+
lx.error(COMP_FIELD_BAD_SHAPE, {
|
|
12856
|
+
fieldName,
|
|
12857
|
+
kind: "component-not-string",
|
|
12858
|
+
got: typeof field.type,
|
|
12859
|
+
gotName: field.type?.name ?? null
|
|
12860
|
+
});
|
|
12861
|
+
}
|
|
12862
|
+
if (field.args == null || field.args.constructor !== Object) {
|
|
12863
|
+
lx.error(COMP_FIELD_BAD_SHAPE, {
|
|
12864
|
+
fieldName,
|
|
12865
|
+
kind: "args-not-object",
|
|
12866
|
+
got: field.args === null ? "null" : typeof field.args
|
|
12867
|
+
});
|
|
12868
|
+
}
|
|
12869
|
+
}
|
|
12870
|
+
}
|
|
12790
12871
|
function checkUnreferencedAlterHandlers(lx, Comp, referencedAlters) {
|
|
12791
12872
|
for (const name in Comp.alter) {
|
|
12792
12873
|
if (!referencedAlters.has(name)) {
|
|
@@ -15587,6 +15668,7 @@ export {
|
|
|
15587
15668
|
ComponentList,
|
|
15588
15669
|
ComponentDocs,
|
|
15589
15670
|
Collection,
|
|
15671
|
+
COMP_FIELD_BAD_SHAPE,
|
|
15590
15672
|
BAD_VALUE,
|
|
15591
15673
|
ALT_HANDLER_NOT_REFERENCED,
|
|
15592
15674
|
ALT_HANDLER_NOT_DEFINED
|