refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
|
||||
## 0.2.11
|
||||
|
||||
- Fixed `.wrn` files falling back to Plain Text when a legacy `wire` file
|
||||
- Fixed `.wrn` files falling back to Plain Text when a legacy `wrn` file
|
||||
association is present.
|
||||
- Fixed false root-declaration errors when files begin with `//` comments.
|
||||
- Fixed false unclosed-string errors when `//` comments contain apostrophes or
|
||||
|
||||
@@ -785,7 +785,7 @@ Recommended VS Code configuration:
|
||||
## Troubleshooting language detection
|
||||
|
||||
Files ending in `.wrn` should show `WRNexus` in the VS Code status bar. If an
|
||||
older workspace setting maps `*.wrn` to the legacy `wire` language ID, replace
|
||||
older workspace setting maps `*.wrn` to the legacy `wrn` language ID, replace
|
||||
it with:
|
||||
|
||||
```json
|
||||
@@ -795,7 +795,7 @@ it with:
|
||||
```
|
||||
|
||||
Then run **Developer: Reload Window**. The extension also repairs open `.wrn`
|
||||
documents that VS Code classified as Plain Text or as the legacy `wire`
|
||||
documents that VS Code classified as Plain Text or as the legacy `wrn`
|
||||
language.
|
||||
|
||||
## Privacy
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
"keywords": [
|
||||
"wrnexus",
|
||||
"wrn",
|
||||
"wire",
|
||||
"wirejs",
|
||||
"wrn",
|
||||
"wrnexus",
|
||||
"language support",
|
||||
"formatter",
|
||||
"diagnostics",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
// Generated by scripts/build-editor-compiler.mjs. Do not edit directly.
|
||||
// WRN editor compiler source hash: 196a514b18fb6e31fdd8f4ca667a76b0b62cab547af33725ba78564d70bbc01b
|
||||
// WRN editor compiler source hash: 55b8301cff11aaee86a6692d86801e583eae0764af059dc10fdd83c047f4891b
|
||||
// WRN editor compiler generator hash: c71e7fe4258c97b73b384ff14b321f0cf0b30cc2ed0322f5f84b04e757159b18
|
||||
// Generated with TypeScript: 5.9.3
|
||||
const __nodeRequire = require;
|
||||
@@ -1172,7 +1172,7 @@ function compileIfExpr(node) {
|
||||
}
|
||||
/**
|
||||
* Collect every server-control expression in a view (recursively): `{#each}` list
|
||||
* expressions and `{#if}` conditions. Used to wire up raw SSR data consts.
|
||||
* expressions and `{#if}` conditions. Used to wrn up raw SSR data consts.
|
||||
*/
|
||||
function collectControlExprs(nodes, out = []) {
|
||||
for (const node of nodes) {
|
||||
@@ -1330,7 +1330,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
||||
.map((attr) => {
|
||||
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(attr.name);
|
||||
if (spread) {
|
||||
return `\${__wireSpreadAttrs(${ctx.resolveExpr(spread[1])})}`;
|
||||
return `\${__wrnSpreadAttrs(${ctx.resolveExpr(spread[1])})}`;
|
||||
}
|
||||
if (attr.event) {
|
||||
return (escLit(` ${componentEventAttribute(attr.name)}="`) +
|
||||
@@ -1342,7 +1342,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
||||
}
|
||||
const wholeExpression = wholeAttributeExpression(attr.value);
|
||||
const compiledValue = wholeExpression
|
||||
? `\${__wireProp(${ctx.resolveExpr(wholeExpression)})}`
|
||||
? `\${__wrnProp(${ctx.resolveExpr(wholeExpression)})}`
|
||||
: compileAttrValue(attr.value, ctx);
|
||||
const rendered = ` ${attr.name}="${compiledValue}"`;
|
||||
if (!attr.value.includes("{") ||
|
||||
@@ -1363,7 +1363,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
||||
: { ...ctx, forwardRestAttrs: false };
|
||||
const inner = node.children.map((child) => renderComponentNode(child, childCtx)).join("");
|
||||
return (`<div data-component="${attrEscape(node.tag)}"` +
|
||||
`${ctx.forwardRestAttrs ? "${__wireSpreadAttrs(__attrs)}" : ""}` +
|
||||
`${ctx.forwardRestAttrs ? "${__wrnSpreadAttrs(__attrs)}" : ""}` +
|
||||
`${attrs}>${inner}</div>`);
|
||||
}
|
||||
function ssrMarker(bindings, binding) {
|
||||
@@ -2291,7 +2291,7 @@ function viewHasRestAttributeSpread(nodes) {
|
||||
/**
|
||||
* Compile a text node. Interpolations that reference state stay as client
|
||||
* mustaches (`{expr}`, hydrated by the reactive runtime); interpolations of
|
||||
* props/constants are baked server-side (`${__wireHtml(expr)}`), so static
|
||||
* props/constants are baked server-side (`${__wrnHtml(expr)}`), so static
|
||||
* components render correct HTML with zero JavaScript.
|
||||
*/
|
||||
function compileText(raw, ctx) {
|
||||
@@ -2312,7 +2312,7 @@ function compileText(raw, ctx) {
|
||||
out += escLit(`{${expr}}`);
|
||||
}
|
||||
else if (expr === "content") {
|
||||
out += `\${__wireRaw(${ctx.resolveExpr(expr)})}`;
|
||||
out += `\${__wrnRaw(${ctx.resolveExpr(expr)})}`;
|
||||
}
|
||||
else if (exprRefsComponentReactiveValue(expr, ctx)) {
|
||||
// State interpolation: bake the initial value AND keep it reactive via a
|
||||
@@ -2320,11 +2320,11 @@ function compileText(raw, ctx) {
|
||||
// updates it in place. `count` → `<span data-text="count">0</span>`.
|
||||
out +=
|
||||
escLit(`<span data-text="${attrEscape(expr)}">`) +
|
||||
`\${__wireHtml(${ctx.resolveExpr(expr)})}` +
|
||||
`\${__wrnHtml(${ctx.resolveExpr(expr)})}` +
|
||||
escLit(`</span>`);
|
||||
}
|
||||
else {
|
||||
out += `\${__wireHtml(${ctx.resolveExpr(expr)})}`;
|
||||
out += `\${__wrnHtml(${ctx.resolveExpr(expr)})}`;
|
||||
}
|
||||
last = m.index + m[0].length;
|
||||
}
|
||||
@@ -2345,7 +2345,7 @@ function compileAttrValue(raw, ctx) {
|
||||
out += escLit(`{${expr}}`); // hydrated per-item by the list renderer
|
||||
}
|
||||
else {
|
||||
out += `\${__wireAttr(${ctx.resolveExpr(expr)})}`;
|
||||
out += `\${__wrnAttr(${ctx.resolveExpr(expr)})}`;
|
||||
}
|
||||
last = m.index + m[0].length;
|
||||
}
|
||||
@@ -2497,7 +2497,7 @@ function renderComponentNode(node, ctx) {
|
||||
.map((a) => {
|
||||
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(a.name);
|
||||
if (spread) {
|
||||
return `\${__wireSpreadAttrs(${elementContext.resolveExpr(spread[1])})}`;
|
||||
return `\${__wrnSpreadAttrs(${elementContext.resolveExpr(spread[1])})}`;
|
||||
}
|
||||
if (a.event) {
|
||||
return ` ${eventAttribute(a.name)}="${escLit(attrEscape(a.value))}"`;
|
||||
@@ -2520,7 +2520,7 @@ function renderComponentNode(node, ctx) {
|
||||
: "";
|
||||
/*
|
||||
* A boolean attribute whose expression names a loop variable cannot
|
||||
* be resolved on the server: __wireBooleanAttr runs at render time,
|
||||
* be resolved on the server: __wrnBooleanAttr runs at render time,
|
||||
* where `row` or `item` simply does not exist, and the emitted
|
||||
* module blew up. Leave the attribute off the server output and let
|
||||
* the client bind set it -- the runtime toggles boolean attributes
|
||||
@@ -2530,7 +2530,7 @@ function renderComponentNode(node, ctx) {
|
||||
if (referencesLoopVariable) {
|
||||
return ` data-wrn-bind-${bindIndex++}="${escLit(attrEscape(JSON.stringify([a.name, a.value])))}"`;
|
||||
}
|
||||
return `\${__wireBooleanAttr(${JSON.stringify(a.name)}, ${elementContext.resolveExpr(expression)})}${marker}`;
|
||||
return `\${__wrnBooleanAttr(${JSON.stringify(a.name)}, ${elementContext.resolveExpr(expression)})}${marker}`;
|
||||
}
|
||||
if (a.value === "false")
|
||||
return "";
|
||||
@@ -2553,7 +2553,7 @@ function renderComponentNode(node, ctx) {
|
||||
return ` data-show="${escLit(attrEscape(wholeExpression))}"`;
|
||||
}
|
||||
const compiledValue = isExplicitComponentMount && wholeExpression
|
||||
? `\${__wireProp(${elementContext.resolveExpr(wholeExpression)})}`
|
||||
? `\${__wrnProp(${elementContext.resolveExpr(wholeExpression)})}`
|
||||
: compileAttrValue(a.value, elementContext);
|
||||
const rendered = ` ${a.name}="${compiledValue}"`;
|
||||
const referencesState = exprRefsComponentReactiveValue(a.value, ctx);
|
||||
@@ -2608,7 +2608,7 @@ function renderComponentNode(node, ctx) {
|
||||
.join("");
|
||||
const loopLocalsAttribute = serverLoopLocalsAttribute(ctx);
|
||||
const allAttrs = `${loopLocalsAttribute}` +
|
||||
`${ctx.forwardRestAttrs ? "${__wireSpreadAttrs(__attrs)}" : ""}` +
|
||||
`${ctx.forwardRestAttrs ? "${__wrnSpreadAttrs(__attrs)}" : ""}` +
|
||||
`${ctx.eventNames?.length ? ` data-wrn-events="${attrEscape(ctx.eventNames.join(","))}"` : ""}` +
|
||||
`${classAttribute}` +
|
||||
`${classReactiveBinding}` +
|
||||
@@ -2843,7 +2843,7 @@ function __restProps(
|
||||
);
|
||||
}
|
||||
|
||||
function __wireHtml(v: unknown): string {
|
||||
function __wrnHtml(v: unknown): string {
|
||||
return String(v == null ? "" : v).replace(
|
||||
/[&<>]/g,
|
||||
(c) =>
|
||||
@@ -2855,7 +2855,7 @@ function __wireHtml(v: unknown): string {
|
||||
);
|
||||
}
|
||||
|
||||
function __wireAttr(v: unknown): string {
|
||||
function __wrnAttr(v: unknown): string {
|
||||
return String(v == null ? "" : v).replace(
|
||||
/[&<>"]/g,
|
||||
(c) =>
|
||||
@@ -2869,7 +2869,7 @@ function __wireAttr(v: unknown): string {
|
||||
);
|
||||
}
|
||||
|
||||
function __wireBooleanAttr(name: string, value: unknown): string {
|
||||
function __wrnBooleanAttr(name: string, value: unknown): string {
|
||||
return value === true ||
|
||||
value === "true" ||
|
||||
value === "" ||
|
||||
@@ -2880,7 +2880,7 @@ function __wireBooleanAttr(name: string, value: unknown): string {
|
||||
: "";
|
||||
}
|
||||
|
||||
function __wireSpreadAttrs(value: unknown): string {
|
||||
function __wrnSpreadAttrs(value: unknown): string {
|
||||
if (value === null || typeof value !== "object" || Array.isArray(value)) return "";
|
||||
|
||||
const booleanAttributes = new Set(${JSON.stringify([...HTML_BOOLEAN_ATTRIBUTES])});
|
||||
@@ -2905,27 +2905,27 @@ function __wireSpreadAttrs(value: unknown): string {
|
||||
}
|
||||
|
||||
if (booleanAttributes.has(lowerName)) {
|
||||
attributes.push(__wireBooleanAttr(name, raw));
|
||||
attributes.push(__wrnBooleanAttr(name, raw));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (raw === false || raw === null || raw === undefined) continue;
|
||||
attributes.push(" " + name + '="' + __wireAttr(raw) + '"');
|
||||
attributes.push(" " + name + '="' + __wrnAttr(raw) + '"');
|
||||
}
|
||||
|
||||
return attributes.join("");
|
||||
}
|
||||
|
||||
function __wireProp(v: unknown): string {
|
||||
function __wrnProp(v: unknown): string {
|
||||
const value =
|
||||
v !== null && typeof v === "object"
|
||||
? JSON.stringify(v)
|
||||
: String(v == null ? "" : v);
|
||||
|
||||
return __wireAttr(value);
|
||||
return __wrnAttr(value);
|
||||
}
|
||||
|
||||
function __wireRaw(v: unknown): string {
|
||||
function __wrnRaw(v: unknown): string {
|
||||
return String(v == null ? "" : v);
|
||||
}`);
|
||||
if (hasServerEach) {
|
||||
@@ -2996,22 +2996,22 @@ function __wireRaw(v: unknown): string {
|
||||
out.push(`export default { name: ${JSON.stringify(ast.name)}, kind: ${JSON.stringify(ast.kind)}, render };`);
|
||||
return out.join("\n\n") + "\n";
|
||||
}
|
||||
function __wireRaw(v) {
|
||||
function __wrnRaw(v) {
|
||||
return String(v == null ? "" : v);
|
||||
}
|
||||
function wholeAttributeExpression(value) {
|
||||
const match = /^\s*\{([\s\S]+)\}\s*$/.exec(value);
|
||||
return match?.[1]?.trim() || null;
|
||||
}
|
||||
function __wireHtml(v) {
|
||||
function __wrnHtml(v) {
|
||||
return String(v == null ? "" : v).replace(/[&<>]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : ">");
|
||||
}
|
||||
function __wireAttr(v) {
|
||||
function __wrnAttr(v) {
|
||||
return String(v == null ? "" : v).replace(/[&<>"]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : """);
|
||||
}
|
||||
function __wireProp(v) {
|
||||
function __wrnProp(v) {
|
||||
const value = v !== null && typeof v === "object" ? JSON.stringify(v) : String(v == null ? "" : v);
|
||||
return __wireAttr(value);
|
||||
return __wrnAttr(value);
|
||||
}
|
||||
function renderPageComponentAttr(attr, dynamicExpressions) {
|
||||
if (attr.event) {
|
||||
@@ -3163,8 +3163,8 @@ function resolveWrnImports(declarations, importer, options) {
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DependencyGraph = exports.createCompilationCache = exports.compilationKey = exports.runtimeTypeOf = exports.inferredRuntimeType = exports.eraseFunctionTypes = exports.LexError = exports.Lexer = exports.NativeCompileError = exports.generateNative = exports.runtimeCapabilities = exports.analyzeRuntimeImports = exports.optimizeAst = exports.analyzeRuntimeRequirements = exports.analyzeOptimizations = exports.createWrnSourceMap = exports.resolveWrnImports = exports.resolveWrnImport = exports.createComponentContract = exports.generateStoreModule = exports.generateStoreBrowserModule = exports.generateDeclarations = exports.rpcManifest = exports.generateServerFunctionsModule = exports.generateBrowserModule = exports.generateTargets = exports.generate = exports.ParseError = exports.parse = exports.formatDiagnostic = exports.diagnosticFromError = exports.diagnose = exports.assertValidAst = exports.formatWrn = void 0;
|
||||
exports.compileNativeWireFile = compileNativeWireFile;
|
||||
exports.compileWireFile = compileWireFile;
|
||||
exports.compileNativeWrnFile = compileNativeWrnFile;
|
||||
exports.compileWrnFile = compileWrnFile;
|
||||
exports.compile = compile;
|
||||
const syntax_1 = require("@wrnexus/syntax");
|
||||
var syntax_2 = require("@wrnexus/syntax");
|
||||
@@ -3217,7 +3217,7 @@ Object.defineProperty(exports, "eraseFunctionTypes", { enumerable: true, get: fu
|
||||
Object.defineProperty(exports, "inferredRuntimeType", { enumerable: true, get: function () { return syntax_5.inferredRuntimeType; } });
|
||||
Object.defineProperty(exports, "runtimeTypeOf", { enumerable: true, get: function () { return syntax_5.runtimeTypeOf; } });
|
||||
/** Compile `.wrn` source into an Expo Router React Native screen. */
|
||||
function compileNativeWireFile(source) {
|
||||
function compileNativeWrnFile(source) {
|
||||
const ast = (0, syntax_1.parse)(source);
|
||||
(0, syntax_1.assertValidAst)(ast);
|
||||
return (0, native_codegen_ts_1.generateNative)(ast);
|
||||
@@ -3226,7 +3226,7 @@ function compileNativeWireFile(source) {
|
||||
* Compile `.wrn` source into TypeScript source. Errors include a stable code,
|
||||
* source location, code frame, and actionable hint whenever available.
|
||||
*/
|
||||
function compileWireFile(source, filePath = "<inline .wrn>") {
|
||||
function compileWrnFile(source, filePath = "<inline .wrn>") {
|
||||
try {
|
||||
const ast = (0, syntax_1.parse)(source);
|
||||
(0, syntax_1.assertValidAst)(ast, { file: filePath, accessibility: true });
|
||||
@@ -3829,7 +3829,7 @@ function __diagnostic(code, message, details) {
|
||||
}
|
||||
function __csrfToken() {
|
||||
if (typeof document === "undefined") return undefined;
|
||||
const match = /(?:^|;\\s*)wire-csrf=([^;]+)/.exec(document.cookie || "");
|
||||
const match = /(?:^|;\\s*)wrn-csrf=([^;]+)/.exec(document.cookie || "");
|
||||
return match ? decodeURIComponent(match[1]) : undefined;
|
||||
}
|
||||
async function __callServerFunction(storeName, functionName, args, options) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// WRN editor extension source hash: b455291b3d69fabfba7d10889ff628f90579432d07cd871f9e39c336e6c8851f
|
||||
// WRN editor extension source hash: 1f978c42851411e8a985eb6c865b706e52f6063f067c3245946b4f55bc1a7d11
|
||||
// WRN editor extension generator hash: 456d1d614e44e5fb1f19b784176c09cf2ade9b64ef73a17934c2698150b62728
|
||||
"use strict";
|
||||
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
||||
@@ -22710,7 +22710,7 @@ var client;
|
||||
async function recoverWrnLanguage(document) {
|
||||
if (!document.fileName.toLowerCase().endsWith(".wrn"))
|
||||
return;
|
||||
if (!["plaintext", "wire"].includes(document.languageId))
|
||||
if (!["plaintext", "wrn"].includes(document.languageId))
|
||||
return;
|
||||
try {
|
||||
await vscode.languages.setTextDocumentLanguage(document, WRN_LANGUAGE_ID);
|
||||
|
||||
@@ -12,7 +12,7 @@ let client;
|
||||
/** @param {vscode.TextDocument} document */
|
||||
async function recoverWrnLanguage(document) {
|
||||
if (!document.fileName.toLowerCase().endsWith(".wrn")) return;
|
||||
if (!["plaintext", "wire"].includes(document.languageId)) return;
|
||||
if (!["plaintext", "wrn"].includes(document.languageId)) return;
|
||||
try {
|
||||
await vscode.languages.setTextDocumentLanguage(document, WRN_LANGUAGE_ID);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// WRN editor language server source hash: da83a5e1dbf90523ee0fe9a0d232182b0a78d025f3be8d07c324728d1cdcc17c
|
||||
// WRN editor language server source hash: 13b4b0b80a52f1e883211f1b5193ad6ab28c582f526f0a28747ebf71307bbc0d
|
||||
// WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72
|
||||
// @bun @bun-cjs
|
||||
(function(exports, require, module, __filename, __dirname) {var __create = Object.create;
|
||||
@@ -172362,7 +172362,7 @@ var import_node_path3 = require("node:path");
|
||||
var SKIPPED_DIRECTORIES = new Set([
|
||||
".git",
|
||||
".wrnexus",
|
||||
".wirefw",
|
||||
".wrnfw",
|
||||
"build",
|
||||
"coverage",
|
||||
"dist",
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "Wire attributes",
|
||||
"name": "WrNexus attributes",
|
||||
"scopeName": "wrn.attributes.injection",
|
||||
"injectionSelector": "L:meta.tag -comment -string",
|
||||
"patterns": [{ "include": "#wire-event" }, { "include": "#wire-directive" }],
|
||||
"patterns": [{ "include": "#wrn-event" }, { "include": "#wrn-directive" }],
|
||||
"repository": {
|
||||
"wire-event": {
|
||||
"wrn-event": {
|
||||
"match": "(@)([A-Za-z][A-Za-z0-9_-]*)",
|
||||
"captures": {
|
||||
"1": { "name": "punctuation.definition.keyword.wrn" },
|
||||
"2": { "name": "entity.other.attribute-name.wrn.event" }
|
||||
}
|
||||
},
|
||||
"wire-directive": {
|
||||
"match": "\\b(data-(?:component|scope|for|text|show|slot|on-[A-Za-z0-9_-]+|wire-[A-Za-z0-9_-]+|wrnexus-[A-Za-z0-9_-]+))\\b",
|
||||
"wrn-directive": {
|
||||
"match": "\\b(data-(?:component|scope|for|text|show|slot|on-[A-Za-z0-9_-]+|wrn-[A-Za-z0-9_-]+|wrnexus-[A-Za-z0-9_-]+))\\b",
|
||||
"name": "entity.other.attribute-name.wrn.directive"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@
|
||||
"include": "#interpolation"
|
||||
},
|
||||
{
|
||||
"include": "#wire-event"
|
||||
"include": "#wrn-event"
|
||||
},
|
||||
{
|
||||
"include": "#conditional-class"
|
||||
@@ -666,7 +666,7 @@
|
||||
],
|
||||
"applyEndPatternLast": true
|
||||
},
|
||||
"wire-event": {
|
||||
"wrn-event": {
|
||||
"match": "(@)(?:(window|document)(:))?([A-Za-z][A-Za-z0-9_-]*)(\\s*=)",
|
||||
"captures": {
|
||||
"1": {
|
||||
|
||||
@@ -88,7 +88,7 @@ component ThemeToggle {
|
||||
label = "Toggle theme"
|
||||
class = ""
|
||||
}
|
||||
view { <button class="{class}" data-wire-theme-toggle><slot>{label}</slot></button> }
|
||||
view { <button class="{class}" data-wrn-theme-toggle><slot>{label}</slot></button> }
|
||||
}`;
|
||||
|
||||
const diagnostics = validateBalancedCharacters(mockDocument(source), source);
|
||||
|
||||
@@ -95,9 +95,9 @@ test("formats public event declarations as individual props members", () => {
|
||||
test("keeps long inline-closing tags idempotent after multiline expansion", () => {
|
||||
const source = `component Status {
|
||||
view {
|
||||
<section class="overflow-hidden rounded-3xl border border-[var(--wire-color-border,#e2e8f0)] bg-[var(--wire-color-surface,#ffffff)]">
|
||||
<span class="inline-flex items-center gap-2 rounded-full bg-[var(--wire-color-surface-2,#f8fafc)] px-3 py-1.5 text-xs font-semibold">
|
||||
<span class="h-2 w-2 animate-pulse rounded-full bg-[var(--wire-color-primary,#059669)]"></span>Loading
|
||||
<section class="overflow-hidden rounded-3xl border border-[var(--wrn-color-border,#e2e8f0)] bg-[var(--wrn-color-surface,#ffffff)]">
|
||||
<span class="inline-flex items-center gap-2 rounded-full bg-[var(--wrn-color-surface-2,#f8fafc)] px-3 py-1.5 text-xs font-semibold">
|
||||
<span class="h-2 w-2 animate-pulse rounded-full bg-[var(--wrn-color-primary,#059669)]"></span>Loading
|
||||
</span>
|
||||
</section>
|
||||
}
|
||||
@@ -205,7 +205,7 @@ test("expands inline if blocks around HTML", () => {
|
||||
const source = `component Button {
|
||||
view {
|
||||
<button>
|
||||
{#if loading}<span class="wire-spinner wire-spinner--inline" aria-hidden="true"></span>{/if}
|
||||
{#if loading}<span class="wrn-spinner wrn-spinner--inline" aria-hidden="true"></span>{/if}
|
||||
{#if icon}<span class="{icon}"></span>{:else}<span>Fallback</span>{/if}
|
||||
</button>
|
||||
}
|
||||
@@ -217,7 +217,7 @@ test("expands inline if blocks around HTML", () => {
|
||||
<button>
|
||||
{#if loading}
|
||||
<span
|
||||
class="wire-spinner wire-spinner--inline"
|
||||
class="wrn-spinner wrn-spinner--inline"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
|
||||
@@ -33,7 +33,7 @@ for (const rel of [
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Grammar wires up the right scope + embedded languages.
|
||||
// 2. Grammar connects up the right scope + embedded languages.
|
||||
const grammar = JSON.parse(readFileSync(join(root, "syntaxes/wrn.tmLanguage.json"), "utf8"));
|
||||
grammar.scopeName === "source.wrn" ? ok("grammar scopeName") : bad("grammar scopeName");
|
||||
|
||||
@@ -121,7 +121,7 @@ try {
|
||||
try {
|
||||
const compiler = require(join(root, "src/compiler.cjs"));
|
||||
const good = `page Home {\n view { <h1>Hi</h1> }\n}`;
|
||||
compiler.compileWireFile(good);
|
||||
compiler.compileWrnFile(good);
|
||||
ok("compiler accepts valid .wrn");
|
||||
|
||||
const structuredProps = `page FooterExample {
|
||||
@@ -140,13 +140,13 @@ try {
|
||||
/>
|
||||
}
|
||||
}`;
|
||||
compiler.compileWireFile(structuredProps);
|
||||
compiler.compileWrnFile(structuredProps);
|
||||
ok("compiler accepts native structured state and unquoted prop expressions");
|
||||
|
||||
const badSrc = `page Home {\n view { <h1>Hi</h2> }\n}`;
|
||||
let threw = false;
|
||||
try {
|
||||
compiler.compileWireFile(badSrc);
|
||||
compiler.compileWrnFile(badSrc);
|
||||
} catch (e) {
|
||||
threw = true;
|
||||
/offset\s+\d+|end of input/.test(e.message)
|
||||
|
||||
Reference in New Issue
Block a user