fix(tooling): reconcile framework fixes in canonical WireJS checkout
This commit is contained in:
1 parent
a077515336
commit
65d63dfbe7
19 files changed
+312
-156
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
// Generated by scripts/build-editor-compiler.mjs. Do not edit directly.
|
||||
// WRN editor compiler source hash: 3d346a264807ba7b107584dc9a7b505b1d14057b2ad1aa85c5ea890f9b09c272
|
||||
// WRN editor compiler source hash: 89199942be0196a3d06ea3d30dff80d361253192108bd978b5b80d921195c59f
|
||||
// WRN editor compiler generator hash: f8c1094b47e695151205899de28cd63d574356d26ac49219c4a43db0f2391ef5
|
||||
// Generated with TypeScript: 6.0.3
|
||||
const __nodeRequire = require;
|
||||
@@ -1202,10 +1202,16 @@ function renderAttrs(attrs, csrId, reactive = null, dynamicExpressions) {
|
||||
if (expression &&
|
||||
exprRefsState(expression, reactive.runtimeStateNames) &&
|
||||
dynamicExpressions) {
|
||||
const marker = exprRefsState(expression, reactive.stateNames)
|
||||
? ` data-wrn-bind-${bindIndex++}="${attrEscape(JSON.stringify([attr.name, attr.value]))}"`
|
||||
: "";
|
||||
if (isHtmlBooleanAttribute(attr.name)) {
|
||||
dynamicExpressions.push(`\${(${expression}) ? ${JSON.stringify(` ${attr.name}`)} : ""}`);
|
||||
return `\x00WRNEACH${dynamicExpressions.length - 1}\x00${marker}`;
|
||||
}
|
||||
dynamicExpressions.push(`\${__wrnexusPropAttr(${expression})}`);
|
||||
const sentinel = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
const marker = JSON.stringify([attr.name, attr.value]);
|
||||
return ` ${attr.name}="${sentinel}" data-wrn-bind-${bindIndex++}="${attrEscape(marker)}"`;
|
||||
return ` ${attr.name}="${sentinel}"${marker}`;
|
||||
}
|
||||
const initial = reactiveAttrValue(attr.value, reactive);
|
||||
if (initial === null)
|
||||
@@ -1253,17 +1259,20 @@ function evalStateSeeds(states) {
|
||||
*/
|
||||
function substituteReactiveText(raw, reactive, dynamicExpressions) {
|
||||
const text = substituteTMarkers(raw);
|
||||
if (!reactive || reactive.stateNames.size === 0)
|
||||
if (!reactive)
|
||||
return text;
|
||||
return text.replace(/\{([^{}]+)\}/g, (whole, inner) => {
|
||||
const expr = inner.trim();
|
||||
if (expr.startsWith("t:") || !exprRefsState(expr, reactive.stateNames))
|
||||
const clientReactive = exprRefsState(expr, reactive.stateNames);
|
||||
if (expr.startsWith("t:"))
|
||||
return whole;
|
||||
if (exprRefsState(expr, reactive.runtimeStateNames) && dynamicExpressions) {
|
||||
dynamicExpressions.push(`\${__wrnexusEscapeHtml(${expr})}`);
|
||||
const sentinel = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
return `<span data-text="${attrEscape(expr)}">${sentinel}</span>`;
|
||||
return clientReactive ? `<span data-text="${attrEscape(expr)}">${sentinel}</span>` : sentinel;
|
||||
}
|
||||
if (!clientReactive)
|
||||
return whole;
|
||||
let value;
|
||||
try {
|
||||
value = new Function("with(this){return (" + expr + ");}").call(reactive.scope);
|
||||
@@ -1339,6 +1348,18 @@ function renderLoopBody(node, locals = []) {
|
||||
if (attr.boolean) {
|
||||
return escLit(` ${name}`);
|
||||
}
|
||||
// Native boolean attributes inside #if/#each must use presence semantics,
|
||||
// just like attributes on the page root. disabled="false" still disables
|
||||
// an HTML input. Component props retain their serialized boolean value.
|
||||
if (!componentTag &&
|
||||
!node.attrs.some((a) => a.name === "data-component") &&
|
||||
isHtmlBooleanAttribute(name)) {
|
||||
const expression = wholeAttributeExpression(attr.value);
|
||||
if (expression)
|
||||
return "${(" + expression + ") ? " + JSON.stringify(` ${name}`) + ' : ""}';
|
||||
if (attr.value === "false")
|
||||
return "";
|
||||
}
|
||||
return escLit(` ${name}="`) + bakeLoopAttr(attr.value, componentTag) + escLit(`"`);
|
||||
})
|
||||
.join("");
|
||||
@@ -1458,6 +1479,16 @@ function renderNode(node, ssrBindings, csrBindings, apiBindings, loops, reactive
|
||||
// templateEscape, swapped for its real `${…}` code after escaping.
|
||||
if (node.type === "each" || node.type === "if") {
|
||||
loops.push(node.type === "each" ? compileEachExpr(node) : compileIfExpr(node));
|
||||
const conditions = node.type === "each"
|
||||
? [node.list]
|
||||
: node.branches.flatMap((branch) => (branch.cond ? [branch.cond] : []));
|
||||
// Server-only loader values are not serialized into browser state. Their
|
||||
// controls must not be re-evaluated by a surrounding component's hydration.
|
||||
if (reactive &&
|
||||
conditions.some((condition) => exprRefsState(condition, reactive.runtimeStateNames)) &&
|
||||
!conditions.some((condition) => exprRefsState(condition, reactive.stateNames))) {
|
||||
return `\x00WRNEACH${loops.length - 1}\x00`;
|
||||
}
|
||||
const definition = node.type === "each"
|
||||
? {
|
||||
list: node.list,
|
||||
@@ -1621,7 +1652,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
||||
const wholeExpression = wholeAttributeExpression(attr.value);
|
||||
const compiledValue = wholeExpression
|
||||
? `\${__wrnProp(${ctx.resolveExpr(wholeExpression)})}`
|
||||
: compileAttrValue(attr.value, ctx);
|
||||
: compileAttrValue(attr.value, ctx, attr.name === "pattern");
|
||||
const rendered = ` ${attr.name}="${compiledValue}"`;
|
||||
if (!attr.value.includes("{") ||
|
||||
(!exprRefsState(attr.value, ctx.stateNames) && !exprRefsState(attr.value, ctx.propNames))) {
|
||||
@@ -2250,7 +2281,7 @@ function generateInner(ast) {
|
||||
.map((load) => load.name),
|
||||
];
|
||||
const runtimeStateNames = runtimeComputedNames(orderedStates, orderedComputed, runtimeRoots);
|
||||
const reactive = reactiveNames.length > 0
|
||||
const reactive = reactiveNames.length > 0 || runtimeStateNames.size > 0
|
||||
? { stateNames: new Set(reactiveNames), runtimeStateNames, scope: seedScope }
|
||||
: null;
|
||||
const loops = [];
|
||||
@@ -2739,7 +2770,7 @@ function compileText(raw, ctx) {
|
||||
return out + escLit(raw.slice(last));
|
||||
}
|
||||
/** Compile an attribute value; `{expr}` is baked server-side (loop vars stay literal). */
|
||||
function compileAttrValue(raw, ctx) {
|
||||
function compileAttrValue(raw, ctx, regexPattern = false) {
|
||||
if (!raw.includes("{"))
|
||||
return escLit(attrEscape(raw));
|
||||
let out = "";
|
||||
@@ -2749,7 +2780,10 @@ function compileAttrValue(raw, ctx) {
|
||||
while ((m = INTERP_RE.exec(raw))) {
|
||||
out += escLit(attrEscape(raw.slice(last, m.index)));
|
||||
const expr = m[1].trim();
|
||||
if (ctx.loopVars && exprRefsState(expr, ctx.loopVars)) {
|
||||
if (regexPattern && /^\d+(?:,\d*)?$/.test(expr)) {
|
||||
out += escLit(attrEscape(m[0])); // Regex quantifiers are not template expressions.
|
||||
}
|
||||
else if (ctx.loopVars && exprRefsState(expr, ctx.loopVars)) {
|
||||
out += escLit(`{${expr}}`); // hydrated per-item by the list renderer
|
||||
}
|
||||
else {
|
||||
@@ -3047,7 +3081,7 @@ function renderComponentNode(node, ctx) {
|
||||
}
|
||||
const compiledValue = isExplicitComponentMount && wholeExpression
|
||||
? `\${__wrnProp(${elementContext.resolveExpr(wholeExpression)})}`
|
||||
: compileAttrValue(a.value, elementContext);
|
||||
: compileAttrValue(a.value, elementContext, a.name === "pattern");
|
||||
/*
|
||||
* A constraint attribute whose value is only known at render time (a
|
||||
* component prop defaulting to "") must be decided at render time, so
|
||||
@@ -3528,7 +3562,7 @@ function __wrnProp(v) {
|
||||
const value = v !== null && typeof v === "object" ? JSON.stringify(v) : String(v == null ? "" : v);
|
||||
return __wrnAttr(value);
|
||||
}
|
||||
function renderPageComponentAttr(attr, dynamicExpressions, _reactive) {
|
||||
function renderPageComponentAttr(attr, dynamicExpressions, reactive) {
|
||||
if (attr.event) {
|
||||
return ` ${componentEventAttribute(attr.name)}="${attrEscape(attr.value)}"`;
|
||||
}
|
||||
@@ -3541,6 +3575,11 @@ function renderPageComponentAttr(attr, dynamicExpressions, _reactive) {
|
||||
}
|
||||
dynamicExpressions.push(`\${__wrnexusPropAttr(${expression})}`);
|
||||
const marker = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
if (reactive &&
|
||||
exprRefsState(expression, reactive.runtimeStateNames) &&
|
||||
!exprRefsState(expression, reactive.stateNames)) {
|
||||
return ` ${attr.name}="${marker}"`;
|
||||
}
|
||||
// The mount disappears during SSR. Preserve every dynamic component prop
|
||||
// as a parent-owned binding; server-only expressions simply fail closed in
|
||||
// the browser, while page state can continue driving the mounted child.
|
||||
@@ -6229,7 +6268,7 @@ function expandStructuredStateDeclarations(lines, unit) {
|
||||
});
|
||||
}
|
||||
function formatStructuredPropDeclaration(value, unit, depth, printWidth) {
|
||||
const match = /^([A-Za-z_$][\w$]*\??\s*(?::\s*[^=]+?)?\s*=\s*)([\[{][\s\S]*)$/.exec(value);
|
||||
const match = /^([A-Za-z_$][\w$]*\??\s*(?::\s*[^=]+?)?\s*=\s*)([[{][\s\S]*)$/.exec(value);
|
||||
if (!match)
|
||||
return null;
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// WRN editor extension source hash: d07c535bd69332e90f207cbc254aae06982b40dd863fbc8de63fb386ecf31f50
|
||||
// WRN editor extension source hash: fd585db47099c8b781bf49e4ce7c86146bad583f781d0aa93196eb200a95b20f
|
||||
// WRN editor extension generator hash: 456d1d614e44e5fb1f19b784176c09cf2ade9b64ef73a17934c2698150b62728
|
||||
"use strict";
|
||||
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
||||
@@ -10089,7 +10089,7 @@ var require_commonjs = __commonJS(function(exports2) {
|
||||
// editors/vscode/node_modules/brace-expansion/dist/commonjs/index.js
|
||||
var require_commonjs2 = __commonJS(function(exports2) {
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = undefined;
|
||||
exports2.EXPANSION_MAX = undefined;
|
||||
exports2.expand = expand;
|
||||
var balanced_match_1 = require_commonjs();
|
||||
var escSlash = "\x00SLASH" + Math.random() + "\x00";
|
||||
@@ -10108,7 +10108,6 @@ var require_commonjs2 = __commonJS(function(exports2) {
|
||||
var commaPattern = /\\,/g;
|
||||
var periodPattern = /\\\./g;
|
||||
exports2.EXPANSION_MAX = 1e5;
|
||||
exports2.EXPANSION_MAX_LENGTH = 4000000;
|
||||
function numeric(str) {
|
||||
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
||||
}
|
||||
@@ -10142,11 +10141,11 @@ var require_commonjs2 = __commonJS(function(exports2) {
|
||||
if (!str) {
|
||||
return [];
|
||||
}
|
||||
const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH } = options;
|
||||
const { max = exports2.EXPANSION_MAX } = options;
|
||||
if (str.slice(0, 2) === "{}") {
|
||||
str = "\\{\\}" + str.slice(2);
|
||||
}
|
||||
return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
|
||||
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
||||
}
|
||||
function embrace(str) {
|
||||
return "{" + str + "}";
|
||||
@@ -10160,87 +10159,20 @@ var require_commonjs2 = __commonJS(function(exports2) {
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
function combine(acc, pre, values, max, maxLength, dropEmpties) {
|
||||
const out = [];
|
||||
let length = 0;
|
||||
for (let a = 0;a < acc.length; a++) {
|
||||
for (let v = 0;v < values.length; v++) {
|
||||
if (out.length >= max)
|
||||
return out;
|
||||
const expansion = acc[a] + pre + values[v];
|
||||
if (dropEmpties && !expansion)
|
||||
continue;
|
||||
if (length + expansion.length > maxLength)
|
||||
return out;
|
||||
out.push(expansion);
|
||||
length += expansion.length;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function expandSequence(body, isAlphaSequence, max, maxLength) {
|
||||
const n = body.split(/\.\./);
|
||||
const N = [];
|
||||
if (n[0] === undefined || n[1] === undefined) {
|
||||
return N;
|
||||
}
|
||||
const x = numeric(n[0]);
|
||||
const y = numeric(n[1]);
|
||||
const width = Math.max(n[0].length, n[1].length);
|
||||
let incr = n.length === 3 && n[2] !== undefined ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
||||
let test = lte;
|
||||
const reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
const pad = n.some(isPadded);
|
||||
let length = 0;
|
||||
for (let i = x;test(i, y) && N.length < max; i += incr) {
|
||||
let c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === "\\") {
|
||||
c = "";
|
||||
}
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
const need = width - c.length;
|
||||
if (need > 0) {
|
||||
const z = new Array(need + 1).join("0");
|
||||
if (i < 0) {
|
||||
c = "-" + z + c.slice(1);
|
||||
} else {
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (length + c.length > maxLength)
|
||||
break;
|
||||
N.push(c);
|
||||
length += c.length;
|
||||
}
|
||||
return N;
|
||||
}
|
||||
function expand_(str, max, maxLength, isTop) {
|
||||
let acc = [""];
|
||||
let dropEmpties = false;
|
||||
let firstGroup = true;
|
||||
function expand_(str, max, isTop) {
|
||||
const expansions = [];
|
||||
for (;; ) {
|
||||
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
||||
if (!m) {
|
||||
return combine(acc, str, [""], max, maxLength, dropEmpties);
|
||||
}
|
||||
if (!m)
|
||||
return [str];
|
||||
const pre = m.pre;
|
||||
if (/\$$/.test(pre)) {
|
||||
acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
|
||||
firstGroup = false;
|
||||
if (!m.post.length)
|
||||
break;
|
||||
str = m.post;
|
||||
continue;
|
||||
if (/\$$/.test(m.pre)) {
|
||||
const post2 = m.post.length ? expand_(m.post, max, false) : [""];
|
||||
for (let k = 0;k < post2.length && k < max; k++) {
|
||||
const expansion = pre + "{" + m.body + "}" + post2[k];
|
||||
expansions.push(expansion);
|
||||
}
|
||||
return expansions;
|
||||
}
|
||||
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
@@ -10252,56 +10184,74 @@ var require_commonjs2 = __commonJS(function(exports2) {
|
||||
isTop = true;
|
||||
continue;
|
||||
}
|
||||
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
|
||||
return [str];
|
||||
}
|
||||
if (firstGroup) {
|
||||
dropEmpties = isTop && !isSequence;
|
||||
firstGroup = false;
|
||||
}
|
||||
let values;
|
||||
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
||||
let n;
|
||||
if (isSequence) {
|
||||
values = expandSequence(m.body, isAlphaSequence, max, maxLength);
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
let n = parseCommaParts(m.body);
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1 && n[0] !== undefined) {
|
||||
n = expand_(n[0], max, maxLength, false).map(embrace);
|
||||
n = expand_(n[0], max, false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
||||
if (!m.post.length)
|
||||
break;
|
||||
str = m.post;
|
||||
continue;
|
||||
return post.map((p) => m.pre + n[0] + p);
|
||||
}
|
||||
}
|
||||
let dropsEmpties = dropEmpties && !m.post.length && !pre;
|
||||
for (let d = 0;dropsEmpties && d < acc.length; d++) {
|
||||
if (acc[d]) {
|
||||
dropsEmpties = false;
|
||||
}
|
||||
}
|
||||
let N;
|
||||
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
||||
const x = numeric(n[0]);
|
||||
const y = numeric(n[1]);
|
||||
const width = Math.max(n[0].length, n[1].length);
|
||||
let incr = n.length === 3 && n[2] !== undefined ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
||||
let test = lte;
|
||||
const reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
values = [];
|
||||
let valuesLength = 0;
|
||||
outer:
|
||||
for (let j = 0;j < n.length; j++) {
|
||||
const expanded = expand_(n[j], max, maxLength, false);
|
||||
for (let k = 0;k < expanded.length; k++) {
|
||||
const v = expanded[k];
|
||||
if (dropsEmpties && !v)
|
||||
continue;
|
||||
if (values.length >= max || valuesLength + v.length > maxLength) {
|
||||
break outer;
|
||||
const pad = n.some(isPadded);
|
||||
N = [];
|
||||
for (let i = x;test(i, y) && N.length < max; i += incr) {
|
||||
let c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === "\\") {
|
||||
c = "";
|
||||
}
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
const need = width - c.length;
|
||||
if (need > 0) {
|
||||
const z = new Array(need + 1).join("0");
|
||||
if (i < 0) {
|
||||
c = "-" + z + c.slice(1);
|
||||
} else {
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
values.push(v);
|
||||
valuesLength += v.length;
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = [];
|
||||
for (let j = 0;j < n.length; j++) {
|
||||
N.push.apply(N, expand_(n[j], max, false));
|
||||
}
|
||||
}
|
||||
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
|
||||
if (!m.post.length)
|
||||
break;
|
||||
str = m.post;
|
||||
for (let j = 0;j < N.length; j++) {
|
||||
for (let k = 0;k < post.length && expansions.length < max; k++) {
|
||||
const expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion) {
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
}
|
||||
return expansions;
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13933,7 +13883,7 @@ var require_configuration = __commonJS(function(exports2) {
|
||||
exports2.SyncConfigurationFeature = SyncConfigurationFeature;
|
||||
});
|
||||
|
||||
// editors/vscode/node_modules/vscode-languageserver-textdocument/lib/umd/main.js
|
||||
// editors/vscode/node_modules/vscode-languageclient/node_modules/vscode-languageserver-textdocument/lib/umd/main.js
|
||||
var require_main2 = __commonJS(function(exports2, module2) {
|
||||
var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) {
|
||||
if (pack || arguments.length === 2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// WRN editor language server source hash: 5258b3e76cec47df752d4bb886fbd57a3f3c4af9ca9b6b2bf6742c8d78025ff1
|
||||
// WRN editor language server source hash: d192eefe86b41eaa54eb48a69202842dbeb8ec4ee4e962c912b288820a65b162
|
||||
// WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72
|
||||
// @bun @bun-cjs
|
||||
(function(exports, require, module, __filename, __dirname) {var __create = Object.create;
|
||||
@@ -170723,7 +170723,7 @@ function expandStructuredStateDeclarations(lines, unit) {
|
||||
});
|
||||
}
|
||||
function formatStructuredPropDeclaration(value, unit, depth, printWidth) {
|
||||
const match = /^([A-Za-z_$][\w$]*\??\s*(?::\s*[^=]+?)?\s*=\s*)([\[{][\s\S]*)$/.exec(value);
|
||||
const match = /^([A-Za-z_$][\w$]*\??\s*(?::\s*[^=]+?)?\s*=\s*)([[{][\s\S]*)$/.exec(value);
|
||||
if (!match)
|
||||
return null;
|
||||
try {
|
||||
@@ -173217,12 +173217,13 @@ ${sharedAliases}`);
|
||||
append(`declare const ${name}: typeof ${runtimeNamespace(runtime)}.${name};`);
|
||||
}
|
||||
let bindingIndex = 0;
|
||||
append("type __WrnEventElement<Tag extends string> = Tag extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[Tag] : Tag extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Tag] : HTMLElement;");
|
||||
const reservedProps = new Set(ast.props.map((prop) => prop.name).filter((name) => !safeBindingName(name)));
|
||||
const appendViewBindings = (nodes, locals) => {
|
||||
for (const node of nodes) {
|
||||
if (node.type === "element") {
|
||||
for (const attr of node.attrs) {
|
||||
const expressions = attr.event ? [attr.value] : extractInterpolations(attr.value).map((segment) => segment.expression);
|
||||
const expressions = attr.event ? [attr.value] : extractInterpolations(attr.value).filter((segment) => !/^t:[^{}]+$/.test(segment.expression)).map((segment) => segment.expression);
|
||||
for (const expression of expressions) {
|
||||
if (!expression.trim())
|
||||
continue;
|
||||
@@ -173230,10 +173231,10 @@ ${sharedAliases}`);
|
||||
...[...locals].map((name) => `declare const ${name}: any;`),
|
||||
...attr.event ? [
|
||||
"declare const payload: any;",
|
||||
"declare const event: Event & { target: HTMLElement };"
|
||||
`declare const event: Event & { target: HTMLElement; currentTarget: __WrnEventElement<${JSON.stringify(node.tag)}> };`
|
||||
] : []
|
||||
].join(" ");
|
||||
append(`namespace __wrn_view_${bindingIndex++} { ${declarations} void (${safeViewExpression(expression, reservedProps)}); }`, attr.value);
|
||||
append(`namespace __wrn_view_${bindingIndex++} { ${declarations} ${attr.event ? `void (() => { ${safeViewExpression(expression, reservedProps)} });` : `void (${safeViewExpression(expression, reservedProps)});`} }`, attr.value);
|
||||
}
|
||||
}
|
||||
appendViewBindings(node.children, locals);
|
||||
|
||||
Reference in new issue
Block a user