arckode-ui 0.2.7 → 0.2.8

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/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelo
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.8] — 2026-05-23
8
+
9
+ ### Fixed
10
+ - **Template compiler — atributos con guiones**: atributos SVG (`stroke-width`, `stroke-linecap`),
11
+ `data-*` y `aria-*` se generaban sin comillas como clave JS, produciendo un syntax error en
12
+ esbuild (`Expected "}" but found "-"`). Fix: `jsKey()` en `attrToJs` detecta si el nombre
13
+ necesita comillas y las agrega — sólo afecta atributos que no son identificadores JS válidos.
14
+
7
15
  ## [0.2.7] — 2026-05-23
8
16
 
9
17
  ### Added
@@ -1 +1 @@
1
- {"version":3,"file":"template-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/template-compiler.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,QAAQ,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;CAC7B;AAiZD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BpD"}
1
+ {"version":3,"file":"template-compiler.d.ts","sourceRoot":"","sources":["../../src/compiler/template-compiler.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,QAAQ,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAA;CAC7B;AAsZD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BpD"}
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
- var y = Object.defineProperty;
2
- var C = (r, t, e) => t in r ? y(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var x = (r, t, e) => C(r, typeof t != "symbol" ? t + "" : t, e);
1
+ var C = Object.defineProperty;
2
+ var O = (r, t, e) => t in r ? C(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var x = (r, t, e) => O(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { transformWithEsbuild as b } from "vite";
5
5
  import { a as N, f as v } from "./analyzer-Ctnj3WTI.js";
6
6
  class h extends Error {
@@ -12,25 +12,25 @@ class h extends Error {
12
12
  }
13
13
  }
14
14
  const k = /<(template|script|style)((?:\s+[^>]*)??)>([\s\S]*?)<\/\1>/g;
15
- function O(r, t) {
15
+ function T(r, t) {
16
16
  let e = 1;
17
17
  for (let n = 0; n < t; n++)
18
18
  r[n] === `
19
19
  ` && e++;
20
20
  return e;
21
21
  }
22
- function T(r, t) {
22
+ function R(r, t) {
23
23
  const n = new RegExp(`${t}=["']([^"']*)["']`).exec(r);
24
24
  return n != null ? n[1] ?? null : null;
25
25
  }
26
- function R(r, t) {
26
+ function L(r, t) {
27
27
  return new RegExp(`(?:^|\\s)${t}(?:\\s|$|=)`).test(r);
28
28
  }
29
- function L(r) {
29
+ function j(r) {
30
30
  const t = [];
31
31
  let e;
32
32
  for (k.lastIndex = 0; (e = k.exec(r)) !== null; ) {
33
- const i = e[1], u = e[2] ?? "", d = e[3] ?? "", m = O(r, e.index);
33
+ const i = e[1], u = e[2] ?? "", d = e[3] ?? "", m = T(r, e.index);
34
34
  i !== void 0 && t.push({ tag: i, attrs: u, content: d, openLine: m });
35
35
  }
36
36
  const n = t.filter((i) => i.tag === "template"), s = t.filter((i) => i.tag === "script"), c = t.filter((i) => i.tag === "style");
@@ -61,7 +61,7 @@ function L(r) {
61
61
  "<script> must appear after <template>",
62
62
  o.openLine
63
63
  );
64
- const l = T(o.attrs, "lang");
64
+ const l = R(o.attrs, "lang");
65
65
  if (l !== "ts")
66
66
  throw new h(
67
67
  "MISSING_LANG_TS",
@@ -70,7 +70,7 @@ function L(r) {
70
70
  );
71
71
  let f;
72
72
  if (c.length > 0) {
73
- const i = c[0], u = R(i.attrs, "scoped");
73
+ const i = c[0], u = L(i.attrs, "scoped");
74
74
  f = { content: i.content, scoped: u };
75
75
  }
76
76
  return {
@@ -85,12 +85,12 @@ function L(r) {
85
85
  ...f !== void 0 ? { style: f } : {}
86
86
  };
87
87
  }
88
- const E = /(?:(@[\w.]+|:[a-zA-Z][\w-]*|v-else-if|v-if|v-for|v-show|v-else|[\w-]+)(?:="([^"]*)")?)/g;
89
- function j(r) {
88
+ const A = /(?:(@[\w.]+|:[a-zA-Z][\w-]*|v-else-if|v-if|v-for|v-show|v-else|[\w-]+)(?:="([^"]*)")?)/g;
89
+ function z(r) {
90
90
  const t = [];
91
- E.lastIndex = 0;
91
+ A.lastIndex = 0;
92
92
  let e;
93
- for (; (e = E.exec(r)) !== null; )
93
+ for (; (e = A.exec(r)) !== null; )
94
94
  t.push({ name: e[1] ?? "", value: e[2] ?? "", raw: e[0] });
95
95
  return t;
96
96
  }
@@ -131,7 +131,7 @@ function W(r) {
131
131
  } else {
132
132
  const d = {
133
133
  tag: p,
134
- attrs: j(f),
134
+ attrs: z(f),
135
135
  children: [],
136
136
  selfClosing: i
137
137
  };
@@ -145,7 +145,7 @@ function W(r) {
145
145
  return t;
146
146
  }
147
147
  const $ = /\{\{\s*([\s\S]+?)\s*\}\}/g;
148
- function z(r) {
148
+ function J(r) {
149
149
  return $.lastIndex = 0, $.test(r);
150
150
  }
151
151
  function M(r) {
@@ -169,36 +169,45 @@ const D = {
169
169
  delete: "Delete",
170
170
  backspace: "Backspace"
171
171
  };
172
- function J(r, t) {
172
+ function P(r, t) {
173
173
  const e = r.slice(1), [n, ...s] = e.split("."), p = `on${n.charAt(0).toUpperCase() + n.slice(1)}`;
174
174
  if (s.length === 0)
175
175
  return `${p}: ${t}`;
176
176
  const o = s[0].toLowerCase(), l = D[o] ?? o.charAt(0).toUpperCase() + o.slice(1);
177
177
  return `${p}: (e) => e.key === '${l}' && ${t}(e)`;
178
178
  }
179
- function P(r) {
180
- const { name: t, value: e } = r;
181
- return t.startsWith("@") ? J(t, e) : t.startsWith(":") ? `${t.slice(1)}: ${e}` : ["v-if", "v-for", "v-else", "v-else-if"].includes(t) ? null : t === "v-show" ? `style: { display: ${e} ? '' : 'none' }` : e === "" ? `${t}: true` : `${t}: ${JSON.stringify(e)}`;
179
+ function S(r) {
180
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r) ? r : JSON.stringify(r);
182
181
  }
183
182
  function V(r) {
183
+ const { name: t, value: e } = r;
184
+ if (t.startsWith("@"))
185
+ return P(t, e);
186
+ if (t.startsWith(":")) {
187
+ const n = t.slice(1);
188
+ return `${S(n)}: ${e}`;
189
+ }
190
+ return ["v-if", "v-for", "v-else", "v-else-if"].includes(t) ? null : t === "v-show" ? `style: { display: ${e} ? '' : 'none' }` : e === "" ? `${S(t)}: true` : `${S(t)}: ${JSON.stringify(e)}`;
191
+ }
192
+ function G(r) {
184
193
  const t = r;
185
- return z(t) ? `h('span', null, ${M(t)})` : /^\s+$/.test(t) ? "" : JSON.stringify(t);
194
+ return J(t) ? `h('span', null, ${M(t)})` : /^\s+$/.test(t) ? "" : JSON.stringify(t);
186
195
  }
187
196
  function w(r) {
188
197
  const t = r.attrs.find((f) => f.name === "v-for");
189
198
  if (r.tag === "slot")
190
199
  return "(props.__slot_default ? props.__slot_default() : [])";
191
- const e = r.attrs.map(P).filter((f) => f !== null && f !== ""), n = e.length === 0 ? "null" : `{ ${e.join(", ")} }`, s = A(r.children);
200
+ const e = r.attrs.map(V).filter((f) => f !== null && f !== ""), n = e.length === 0 ? "null" : `{ ${e.join(", ")} }`, s = y(r.children);
192
201
  let l = `h(${[/^[A-Z]/.test(r.tag) ? r.tag : JSON.stringify(r.tag), n, ...s].join(", ")})`;
193
- return t !== void 0 && (l = G(t.value, l)), l;
202
+ return t !== void 0 && (l = Z(t.value, l)), l;
194
203
  }
195
- function A(r) {
204
+ function y(r) {
196
205
  const t = [];
197
206
  let e = 0;
198
207
  for (; e < r.length; ) {
199
208
  const n = r[e];
200
209
  if (n.kind === "text") {
201
- const o = V(n.text);
210
+ const o = G(n.text);
202
211
  o !== "" && t.push(o), e++;
203
212
  continue;
204
213
  }
@@ -232,7 +241,7 @@ function A(r) {
232
241
  }
233
242
  return t;
234
243
  }
235
- function G(r, t) {
244
+ function Z(r, t) {
236
245
  const e = /^\s*(?:\(([^)]+)\)|(\w+))\s+in\s+(.+?)\s*$/.exec(r);
237
246
  if (!e)
238
247
  return `(${r}).map((item) => ${t})`;
@@ -240,7 +249,7 @@ function G(r, t) {
240
249
  return `${e[3].trim()}.map((${n}) => ${t})`;
241
250
  }
242
251
  function F(r) {
243
- const t = W(r.trim()), e = A(t).filter((s) => s !== "");
252
+ const t = W(r.trim()), e = y(t).filter((s) => s !== "");
244
253
  let n;
245
254
  return e.length === 0 ? n = "null" : e.length === 1 ? n = e[0] : n = `[${e.join(", ")}]`, `function h(tag, props, ...children) {
246
255
  return { tag, props: props ?? {}, children: children.flat().filter(c => c != null) }
@@ -257,7 +266,7 @@ function U(r) {
257
266
  t = (t << 5) + t ^ r.charCodeAt(n), t = t | 0;
258
267
  return (t >>> 0).toString(36).padStart(6, "0").slice(-6);
259
268
  }
260
- function Z(r) {
269
+ function K(r) {
261
270
  const t = /export\s+default\s+(defineComponent\s*\([\s\S]*\))\s*;?\s*$/, e = r.trim(), n = t.exec(e);
262
271
  return n ? {
263
272
  preamble: e.slice(0, n.index).trim(),
@@ -267,8 +276,8 @@ function Z(r) {
267
276
  defineComponentExpr: null
268
277
  };
269
278
  }
270
- function K(r, t, e) {
271
- const s = F(t).replace(/export default function render/, "function render").replace(/function h\(tag, props, \.\.\.children\) \{\n return [^\n]+\n\}\n+/, "").trim(), { preamble: c, defineComponentExpr: p } = Z(r);
279
+ function B(r, t, e) {
280
+ const s = F(t).replace(/export default function render/, "function render").replace(/function h\(tag, props, \.\.\.children\) \{\n return [^\n]+\n\}\n+/, "").trim(), { preamble: c, defineComponentExpr: p } = K(r);
272
281
  return p ? [
273
282
  "import { defineComponent, h } from 'arckode-ui'",
274
283
  "",
@@ -298,7 +307,7 @@ function K(r, t, e) {
298
307
  ].join(`
299
308
  `);
300
309
  }
301
- function H(r = {}) {
310
+ function Q(r = {}) {
302
311
  let t = "development";
303
312
  return {
304
313
  name: "arckode-ui",
@@ -307,11 +316,11 @@ function H(r = {}) {
307
316
  t = e.mode;
308
317
  },
309
318
  transform(e, n) {
310
- var S, _;
319
+ var _, E;
311
320
  if (!n.endsWith(".ark")) return null;
312
321
  let s;
313
322
  try {
314
- s = L(e);
323
+ s = j(e);
315
324
  } catch (a) {
316
325
  if (a instanceof h) {
317
326
  const g = [
@@ -325,7 +334,7 @@ function H(r = {}) {
325
334
  }
326
335
  throw a;
327
336
  }
328
- const c = ((S = r.analyzer) == null ? void 0 : S.ignore) ?? [], p = ((_ = r.analyzer) == null ? void 0 : _.failOnWarnings) ?? !1, l = N(e).filter((a) => !c.includes(a.code)), f = l.filter((a) => a.severity === "error"), i = l.filter((a) => a.severity === "warning"), u = t === "production";
337
+ const c = ((_ = r.analyzer) == null ? void 0 : _.ignore) ?? [], p = ((E = r.analyzer) == null ? void 0 : E.failOnWarnings) ?? !1, l = N(e).filter((a) => !c.includes(a.code)), f = l.filter((a) => a.severity === "error"), i = l.filter((a) => a.severity === "warning"), u = t === "production";
329
338
  for (const a of i)
330
339
  console.warn(v(a, n, e));
331
340
  if (f.length > 0) {
@@ -352,7 +361,7 @@ ${a}`);
352
361
  ${a}`
353
362
  );
354
363
  }
355
- const d = U(n), m = K(s.script.content, s.template.content, d);
364
+ const d = U(n), m = B(s.script.content, s.template.content, d);
356
365
  return b(m, n + ".ts", {
357
366
  loader: "ts",
358
367
  target: "esnext"
@@ -361,6 +370,6 @@ ${a}`
361
370
  };
362
371
  }
363
372
  export {
364
- H as arkcodeUi,
373
+ Q as arkcodeUi,
365
374
  U as generateScopeId
366
375
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arckode-ui",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "description": "Frontend framework con .ark SFCs, signals, file-system router y analyzer estático con sugerencias concretas de fix. Diseñado para máxima predictibilidad de output de IA.",
6
6
  "keywords": [