arckode-ui 0.2.5 → 0.2.7

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,31 @@ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelo
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.7] — 2026-05-23
8
+
9
+ ### Added
10
+ - **`createRouterView(routes)`**: nueva función que retorna un `Component` que renderiza
11
+ reactivamente la página que coincide con la URL actual. Cuando se llama `navigateTo()`,
12
+ el renderer desmonta la página anterior y monta la nueva automáticamente.
13
+ Exportada desde el barrel como `createRouterView` + tipo `RouteWithComponent`.
14
+ Uso: `mount(createRouterView(routes), '#app')` o como variable en template de layout.
15
+ - **`RouteWithComponent`**: tipo exportado `{ path: string; component: Component }` para
16
+ definir las rutas con sus componentes importados.
17
+
18
+ ### Fixed
19
+ - **Renderer `sameType`**: dos VNodes de componentes distintos (tags diferentes) se trataban
20
+ como tipos incompatibles, lo que causaba que `patch()` saltara el `__arkUnmount()` del
21
+ componente saliente al navegar. Ahora todos los VNodes con tag de componente se clasifican
22
+ como mismo tipo, delegando la lógica de swap+cleanup al branch de componentes en `patch()`.
23
+
24
+ ## [0.2.6] — 2026-05-23
25
+
26
+ ### Fixed
27
+ - **🔴 BUG**: `ark analyze` procesaba archivos `.store.ts` y `.service.ts` como si fueran
28
+ componentes `.ark`, reportando `MISSING_TEMPLATE` y `MISSING_SCRIPT` en archivos TypeScript
29
+ puros. El scanner en `analyze-cmd.ts` tenía filtros erróneos: `entry.name.endsWith('.store.ts')`
30
+ y `entry.name.endsWith('.service.ts')`. Fix: el scanner solo escanea `.ark`.
31
+
7
32
  ## [0.2.5] — 2026-05-23
8
33
 
9
34
  ### Added
@@ -141,7 +166,8 @@ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelo
141
166
  - TypeScript declarations no se generaban (`vite-plugin-dts` faltaba) —
142
167
  arreglado en `0.2.2`.
143
168
 
144
- [Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.5...HEAD
169
+ [Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.6...HEAD
170
+ [0.2.6]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.5...v0.2.6
145
171
  [0.2.5]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.4...v0.2.5
146
172
  [0.2.4]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.3...v0.2.4
147
173
  [0.2.3]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.2...v0.2.3
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as a from "node:fs";
3
3
  import * as n from "node:path";
4
4
  import { a as C } from "./analyzer-Ctnj3WTI.js";
5
- import { s as j } from "./router-By0pj28e.js";
5
+ import { s as j } from "./router-De-LmzWd.js";
6
6
  const E = `import { defineConfig } from 'vite'
7
7
  import { arkcodeUi } from 'arckode-ui/vite'
8
8
 
@@ -342,10 +342,10 @@ function U(e) {
342
342
  function V(e, t) {
343
343
  return n.join(e, "src", "components", "features", `${t}.ark`);
344
344
  }
345
- function W(e, t) {
345
+ function M(e, t) {
346
346
  return n.join(e, "src", "pages", `${t}.ark`);
347
347
  }
348
- function M(e, t) {
348
+ function W(e, t) {
349
349
  return n.join(e, "src", "stores", `${t}.store.ts`);
350
350
  }
351
351
  function K(e, t) {
@@ -379,10 +379,10 @@ function Z(e, t, s = {}) {
379
379
  r = V(o, t), c = O(t);
380
380
  break;
381
381
  case "page":
382
- r = W(o, t), c = R(t);
382
+ r = M(o, t), c = R(t);
383
383
  break;
384
384
  case "store":
385
- r = M(o, t), c = G(t);
385
+ r = W(o, t), c = G(t);
386
386
  break;
387
387
  case "service": {
388
388
  r = K(o, t), c = z(t);
@@ -412,7 +412,7 @@ function y(e) {
412
412
  const t = [], s = a.readdirSync(e, { withFileTypes: !0 });
413
413
  for (const o of s) {
414
414
  const i = n.join(e, o.name);
415
- o.isDirectory() ? t.push(...y(i)) : o.isFile() && (o.name.endsWith(".ark") || o.name.endsWith(".store.ts") || o.name.endsWith(".service.ts")) && t.push(i);
415
+ o.isDirectory() ? t.push(...y(i)) : o.isFile() && o.name.endsWith(".ark") && t.push(i);
416
416
  }
417
417
  return t;
418
418
  }
package/dist/index.d.ts CHANGED
@@ -11,4 +11,6 @@ export { createService, ArkServiceError } from './services/create-service';
11
11
  export type { RequestOptions, ServiceContext, ServiceOptions, ServiceDefinition, ServiceInstance, } from './services/create-service';
12
12
  export { createRouter, navigate, navigateTo, useRoute, getCurrentPath, } from './router/router';
13
13
  export type { RouteDefinition, RouteRef, Router, RouteInfo, } from './router/router';
14
+ export { createRouterView } from './router/router-view';
15
+ export type { RouteWithComponent } from './router/router-view';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACnE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAEvE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC1F,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAC/B,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,aAAa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iB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAIlC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,cAAc,GACf,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,eAAe,EACf,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA"}
package/dist/index.js CHANGED
@@ -1,58 +1,58 @@
1
- import { e as D, d as J, w as M } from "./router-By0pj28e.js";
2
- import { c as ue, a as ie, g as fe, n as le, b as de, u as ye } from "./router-By0pj28e.js";
1
+ import { e as J, d as M, w as R, _ as W } from "./router-De-LmzWd.js";
2
+ import { c as le, a as de, g as me, n as ye, b as he, u as pe } from "./router-De-LmzWd.js";
3
3
  const S = typeof process < "u" ? process.env.NODE_ENV !== "production" : !0;
4
- function y(e) {
4
+ function m(e) {
5
5
  S && console.warn(`[arckode-ui] ${e}`);
6
6
  }
7
- function R(e, n, t) {
7
+ function B(e, n, t) {
8
8
  for (const [r, s] of Object.entries(e)) {
9
9
  const o = n[r];
10
10
  if (s.required === !0 && o === void 0) {
11
- y(`[${t}] Prop requerido "${r}" no fue proporcionado.`);
11
+ m(`[${t}] Prop requerido "${r}" no fue proporcionado.`);
12
12
  continue;
13
13
  }
14
14
  if (o === void 0) continue;
15
15
  const c = s.type;
16
- c === String && typeof o == "string" || c === Number && typeof o == "number" || c === Boolean && typeof o == "boolean" || c === Array && Array.isArray(o) || c === Function && typeof o == "function" || c === Object && typeof o == "object" && !Array.isArray(o) && o !== null || y(
16
+ c === String && typeof o == "string" || c === Number && typeof o == "number" || c === Boolean && typeof o == "boolean" || c === Array && Array.isArray(o) || c === Function && typeof o == "function" || c === Object && typeof o == "object" && !Array.isArray(o) && o !== null || m(
17
17
  `[${t}] Prop "${r}" recibió tipo incorrecto. Esperado: ${c.name}, recibido: ${typeof o}.`
18
18
  );
19
19
  }
20
20
  }
21
- function W(e, n, t) {
22
- e.includes(n) || y(
21
+ function F(e, n, t) {
22
+ e.includes(n) || m(
23
23
  `[${t}] emit("${n}") no está declarado en emits[]. Declarar antes de usar.`
24
24
  );
25
25
  }
26
- function F(e, n) {
26
+ function I(e, n) {
27
27
  if (typeof e != "object" || e === null) {
28
- y(`[${n}] setup() debe retornar un objeto { state, computed, actions }.`);
28
+ m(`[${n}] setup() debe retornar un objeto { state, computed, actions }.`);
29
29
  return;
30
30
  }
31
31
  const t = /* @__PURE__ */ new Set(["state", "computed", "actions"]), r = Object.keys(e);
32
32
  for (const s of r)
33
- t.has(s) || y(
33
+ t.has(s) || m(
34
34
  `[${n}] setup() retornó una key no permitida: "${s}". Solo se permiten: state, computed, actions.`
35
35
  );
36
36
  }
37
- function Y(e) {
37
+ function K(e) {
38
38
  if (S) {
39
- if (e.name || y('defineComponent() requiere el campo "name".'), e.emits)
39
+ if (e.name || m('defineComponent() requiere el campo "name".'), e.emits)
40
40
  for (const t of e.emits)
41
- (t !== t.toLowerCase() || /[A-Z]/.test(t)) && y(
41
+ (t !== t.toLowerCase() || /[A-Z]/.test(t)) && m(
42
42
  `[${e.name}] El evento "${t}" en emits[] debe ser kebab-case. Usar "${t.replace(/([A-Z])/g, "-$1").toLowerCase()}" en su lugar.`
43
43
  );
44
44
  if (e.props)
45
45
  for (const [t, r] of Object.entries(e.props))
46
- r.type || y(`[${e.name}] El prop "${t}" no tiene "type" definido.`);
46
+ r.type || m(`[${e.name}] El prop "${t}" no tiene "type" definido.`);
47
47
  }
48
48
  const n = (t, r) => {
49
- S && R(e.props ?? {}, t, e.name);
49
+ S && B(e.props ?? {}, t, e.name);
50
50
  const s = {
51
51
  emit(c, u) {
52
- S && W(e.emits ?? [], c, e.name), r.emit(c, u);
52
+ S && F(e.emits ?? [], c, e.name), r.emit(c, u);
53
53
  }
54
54
  }, o = e.setup(t, s);
55
- return S && F(o, e.name), o;
55
+ return S && I(o, e.name), o;
56
56
  };
57
57
  return {
58
58
  name: e.name,
@@ -62,43 +62,43 @@ function Y(e) {
62
62
  setup: n
63
63
  };
64
64
  }
65
- let j = [], w = [], x = [];
66
- function I(e, n, t) {
67
- j = e, w = n, x = t;
65
+ let x = [], A = [], O = [];
66
+ function Z(e, n, t) {
67
+ x = e, A = n, O = t;
68
68
  }
69
- function V(e) {
70
- j.push(e);
69
+ function ne(e) {
70
+ x.push(e);
71
71
  }
72
- function ee(e) {
73
- w.push(e);
72
+ function re(e) {
73
+ A.push(e);
74
74
  }
75
- function te(e) {
76
- x.push(e);
75
+ function oe(e) {
76
+ O.push(e);
77
77
  }
78
- function ne(e, n, ...t) {
78
+ function w(e, n, ...t) {
79
79
  return {
80
80
  tag: e,
81
81
  props: n ?? {},
82
- children: A(t)
82
+ children: P(t)
83
83
  };
84
84
  }
85
- function A(e) {
85
+ function P(e) {
86
86
  const n = [];
87
87
  for (const t of e)
88
- t == null || t === !1 || t === !0 || (Array.isArray(t) ? n.push(...A(t)) : typeof t == "number" ? n.push(String(t)) : n.push(t));
88
+ t == null || t === !1 || t === !0 || (Array.isArray(t) ? n.push(...P(t)) : typeof t == "number" ? n.push(String(t)) : n.push(t));
89
89
  return n;
90
90
  }
91
- function O(e) {
91
+ function E(e) {
92
92
  return typeof e == "object" && e !== null && typeof e.setup == "function";
93
93
  }
94
- function B(e, n) {
94
+ function G(e, n) {
95
95
  const t = Object.keys(e), r = Object.keys(n);
96
96
  if (t.length !== r.length) return !1;
97
97
  for (const s of t)
98
98
  if (e[s] !== n[s]) return !1;
99
99
  return !0;
100
100
  }
101
- function P(e, n) {
101
+ function U(e, n) {
102
102
  for (const [t, r] of Object.entries(n))
103
103
  if (t !== "key") {
104
104
  if (t.startsWith("on") && t.length > 2 && typeof r == "function") {
@@ -130,38 +130,38 @@ function g(e) {
130
130
  return document.createTextNode("");
131
131
  if (typeof e == "string" || typeof e == "number")
132
132
  return document.createTextNode(String(e));
133
- if (O(e.tag)) {
133
+ if (E(e.tag)) {
134
134
  const t = document.createElement("div");
135
135
  t.style.display = "contents";
136
- const r = J(e.children), s = {
136
+ const r = M(e.children), s = {
137
137
  ...e.props,
138
138
  __slot_default: () => r.value
139
139
  };
140
140
  for (const [c, u] of Object.entries(e.props))
141
141
  if (c.startsWith("on") && c.length > 2 && typeof u == "function") {
142
142
  const i = c.slice(2).toLowerCase();
143
- t.addEventListener(i, (m) => {
144
- const h = m.detail;
143
+ t.addEventListener(i, (y) => {
144
+ const h = y.detail;
145
145
  u(h);
146
146
  });
147
147
  }
148
- const o = H(e.tag, s, t, null);
148
+ const o = N(e.tag, s, t, null);
149
149
  return t.__arkUnmount = o, t.__arkSlot = r, t.__arkTag = e.tag, t.__arkStaticProps = { ...e.props }, t;
150
150
  }
151
151
  const n = document.createElement(e.tag);
152
- P(n, e.props);
152
+ U(n, e.props);
153
153
  for (const t of e.children)
154
154
  n.appendChild(g(t));
155
155
  return n;
156
156
  }
157
- function K(e, n) {
158
- return e == null ? n == null : n == null ? !1 : typeof e == "string" ? typeof n == "string" : typeof n == "string" ? !1 : e.tag === n.tag;
157
+ function X(e, n) {
158
+ return e == null ? n == null : n == null ? !1 : typeof e == "string" ? typeof n == "string" : typeof n == "string" ? !1 : E(e.tag) && E(n.tag) ? !0 : e.tag === n.tag;
159
159
  }
160
- function U(e, n, t) {
161
- var m, h, l, C, f, p;
162
- if (!K(n, t)) {
160
+ function H(e, n, t) {
161
+ var y, h, l, _, f, p;
162
+ if (!X(n, t)) {
163
163
  const a = g(t);
164
- return (m = e.parentNode) == null || m.replaceChild(a, e), a;
164
+ return (y = e.parentNode) == null || y.replaceChild(a, e), a;
165
165
  }
166
166
  if (typeof t == "string" || t === null || t === void 0) {
167
167
  const a = t == null ? "" : String(t);
@@ -170,87 +170,87 @@ function U(e, n, t) {
170
170
  const d = document.createTextNode(a);
171
171
  return (h = e.parentNode) == null || h.replaceChild(d, e), d;
172
172
  }
173
- if (O(t.tag)) {
174
- const a = e, d = t, k = a.__arkTag, E = d.tag;
175
- if (k === E && a.__arkSlot) {
173
+ if (E(t.tag)) {
174
+ const a = e, d = t, k = a.__arkTag, C = d.tag;
175
+ if (k === C && a.__arkSlot) {
176
176
  a.__arkSlot.value = d.children;
177
- const L = a.__arkStaticProps ?? {}, q = d.props;
178
- if (!B(L, q)) {
177
+ const q = a.__arkStaticProps ?? {}, D = d.props;
178
+ if (!G(q, D)) {
179
179
  (l = a.__arkUnmount) == null || l.call(a);
180
180
  const T = g(t);
181
- return (C = e.parentNode) == null || C.replaceChild(T, e), T;
181
+ return (_ = e.parentNode) == null || _.replaceChild(T, e), T;
182
182
  }
183
183
  return e;
184
184
  }
185
185
  (f = a.__arkUnmount) == null || f.call(a);
186
- const $ = g(t);
187
- return (p = e.parentNode) == null || p.replaceChild($, e), $;
186
+ const v = g(t);
187
+ return (p = e.parentNode) == null || p.replaceChild(v, e), v;
188
188
  }
189
189
  const r = e, s = (n == null ? void 0 : n.props) ?? {}, o = t.props;
190
190
  for (const [a, d] of Object.entries(s))
191
191
  a.startsWith("on") && a.length > 2 && typeof d == "function" && r.removeEventListener(a.slice(2).toLowerCase(), d);
192
192
  for (const a of Object.keys(s))
193
193
  !(a in o) && !a.startsWith("on") && r.removeAttribute(a);
194
- P(r, o);
194
+ U(r, o);
195
195
  const c = n.children, u = t.children, i = Math.max(c.length, u.length);
196
196
  for (let a = 0; a < i; a++) {
197
- const d = c[a], k = u[a], E = r.childNodes[a];
197
+ const d = c[a], k = u[a], C = r.childNodes[a];
198
198
  if (k === void 0) {
199
199
  for (; r.childNodes.length > a; )
200
200
  r.removeChild(r.childNodes[a]);
201
201
  break;
202
202
  }
203
- E === void 0 ? r.appendChild(g(k)) : U(E, d ?? null, k);
203
+ C === void 0 ? r.appendChild(g(k)) : H(C, d ?? null, k);
204
204
  }
205
205
  return r;
206
206
  }
207
- function re(e, n) {
207
+ function ce(e, n) {
208
208
  const t = document.querySelector(n);
209
209
  if (!t) throw new Error(`[arckode-ui] mount: "${n}" not found`);
210
- return H(e, {}, t, null);
210
+ return N(e, {}, t, null);
211
211
  }
212
- function H(e, n, t, r) {
212
+ function N(e, n, t, r) {
213
213
  const s = [], o = [];
214
- I(s, o, []);
214
+ Z(s, o, []);
215
215
  const u = r ?? ((f, p) => {
216
216
  t.dispatchEvent(
217
217
  new CustomEvent(f, { detail: p, bubbles: !0 })
218
218
  );
219
- }), i = e.setup(n, { emit: u }), m = e.__render;
220
- if (!m)
219
+ }), i = e.setup(n, { emit: u }), y = e.__render;
220
+ if (!y)
221
221
  return (typeof process > "u" || process.env.NODE_ENV !== "production") && console.warn(
222
222
  `[arckode-ui] ${e.name}: no __render. ¿Compilado por el Vite plugin?`
223
223
  ), () => {
224
224
  };
225
225
  let h = null, l = null;
226
- const C = D(() => {
227
- const f = m(
226
+ const _ = J(() => {
227
+ const f = y(
228
228
  n,
229
229
  i.state ?? {},
230
230
  i.computed ?? {},
231
231
  i.actions ?? {}
232
232
  );
233
- l === null ? (l = g(f), t.appendChild(l)) : l = U(l, h, f), h = f;
233
+ l === null ? (l = g(f), t.appendChild(l)) : l = H(l, h, f), h = f;
234
234
  });
235
235
  return queueMicrotask(() => {
236
236
  for (const f of s) f();
237
237
  }), () => {
238
238
  var f;
239
- C();
239
+ _();
240
240
  for (const p of o) p();
241
241
  l && ((f = l.parentNode) == null || f.removeChild(l));
242
242
  };
243
243
  }
244
- const _ = /* @__PURE__ */ new Map();
245
- function N(e) {
244
+ const $ = /* @__PURE__ */ new Map();
245
+ function L(e) {
246
246
  try {
247
247
  return e === "localStorage" ? typeof localStorage < "u" ? localStorage : null : typeof sessionStorage < "u" ? sessionStorage : null;
248
248
  } catch {
249
249
  return null;
250
250
  }
251
251
  }
252
- function Z(e, n) {
253
- const t = N(e.storage);
252
+ function z(e, n) {
253
+ const t = L(e.storage);
254
254
  if (t)
255
255
  try {
256
256
  const r = t.getItem(e.key);
@@ -261,8 +261,8 @@ function Z(e, n) {
261
261
  } catch {
262
262
  }
263
263
  }
264
- function G(e, n) {
265
- const t = N(e.storage);
264
+ function Q(e, n) {
265
+ const t = L(e.storage);
266
266
  if (t)
267
267
  try {
268
268
  const r = e.pick ?? Object.keys(n), s = {};
@@ -272,30 +272,30 @@ function G(e, n) {
272
272
  } catch {
273
273
  }
274
274
  }
275
- function X(e, n) {
276
- Z(e, n);
275
+ function Y(e, n) {
276
+ z(e, n);
277
277
  const t = e.pick ?? Object.keys(n);
278
278
  for (const r of t)
279
- r in n && M(n[r], () => {
280
- G(e, n);
279
+ r in n && R(n[r], () => {
280
+ Q(e, n);
281
281
  });
282
282
  }
283
- function oe(e, n) {
283
+ function se(e, n) {
284
284
  return (!e || e.trim() === "") && console.warn("[arckode-ui] defineStore: el id del store no puede estar vacío"), (!n.state || typeof n.state != "object" || Array.isArray(n.state)) && console.warn("[arckode-ui] defineStore: state debe ser un objeto de signals"), function() {
285
- if (_.has(e))
286
- return _.get(e);
285
+ if ($.has(e))
286
+ return $.get(e);
287
287
  const r = {
288
288
  state: n.state,
289
289
  actions: n.actions,
290
290
  getters: n.getters ?? {}
291
291
  };
292
- return n.persist && X(
292
+ return n.persist && Y(
293
293
  n.persist,
294
294
  n.state
295
- ), _.set(e, r), r;
295
+ ), $.set(e, r), r;
296
296
  };
297
297
  }
298
- class v extends Error {
298
+ class j extends Error {
299
299
  constructor(n, t, r) {
300
300
  super(r), this.status = n, this.body = t, this.name = "ArkServiceError";
301
301
  }
@@ -320,17 +320,17 @@ async function b(e, n, t) {
320
320
  }
321
321
  }
322
322
  if (!o.ok)
323
- throw new v(
323
+ throw new j(
324
324
  o.status,
325
325
  c,
326
326
  `HTTP ${o.status}`
327
327
  );
328
328
  return c;
329
329
  } catch (o) {
330
- throw clearTimeout(s), o instanceof v, o;
330
+ throw clearTimeout(s), o instanceof j, o;
331
331
  }
332
332
  }
333
- function z(e) {
333
+ function V(e) {
334
334
  const n = e.timeout ?? 5e3, t = e.headers ?? {};
335
335
  function r(s) {
336
336
  return { ...t, ...s };
@@ -405,30 +405,57 @@ function z(e) {
405
405
  }
406
406
  };
407
407
  }
408
- function ce(e, n) {
409
- const t = z(e), r = {};
408
+ function ae(e, n) {
409
+ const t = V(e), r = {};
410
410
  for (const s of Object.keys(n))
411
411
  r[s] = n[s].bind(t);
412
412
  return r;
413
413
  }
414
+ function ee(e, n) {
415
+ if (e === n) return !0;
416
+ if (e === "/") return n === "/";
417
+ const t = e.split("/").filter(Boolean), r = n.split("/").filter(Boolean);
418
+ if (t.length !== r.length) return !1;
419
+ for (let s = 0; s < t.length; s++) {
420
+ const o = t[s];
421
+ if (o === "*") return !0;
422
+ if (!o.startsWith(":") && o !== r[s])
423
+ return !1;
424
+ }
425
+ return !0;
426
+ }
427
+ function ue(e) {
428
+ const n = K({
429
+ name: "RouterView",
430
+ setup: () => ({ state: {}, computed: {}, actions: {} })
431
+ }), t = (r, s, o, c) => {
432
+ const u = W.value;
433
+ for (const i of e)
434
+ if (ee(i.path, u))
435
+ return w(i.component, {});
436
+ return w("div", {});
437
+ };
438
+ return n.__render = t, n;
439
+ }
414
440
  export {
415
- v as ArkServiceError,
416
- ue as computed,
417
- ie as createRouter,
418
- ce as createService,
419
- Y as defineComponent,
420
- oe as defineStore,
421
- D as effect,
422
- fe as getCurrentPath,
423
- ne as h,
424
- re as mount,
425
- H as mountComponent,
426
- le as navigate,
427
- de as navigateTo,
428
- V as onMount,
429
- ee as onUnmount,
430
- te as onUpdate,
431
- J as signal,
432
- ye as useRoute,
433
- M as watch
441
+ j as ArkServiceError,
442
+ le as computed,
443
+ de as createRouter,
444
+ ue as createRouterView,
445
+ ae as createService,
446
+ K as defineComponent,
447
+ se as defineStore,
448
+ J as effect,
449
+ me as getCurrentPath,
450
+ w as h,
451
+ ce as mount,
452
+ N as mountComponent,
453
+ ye as navigate,
454
+ he as navigateTo,
455
+ ne as onMount,
456
+ re as onUnmount,
457
+ oe as onUpdate,
458
+ M as signal,
459
+ pe as useRoute,
460
+ R as watch
434
461
  };
@@ -0,0 +1,25 @@
1
+ import { Component } from '../runtime/define-component';
2
+ export interface RouteWithComponent {
3
+ /** URL pattern — same format as RouteDefinition.path (e.g. '/users/:id') */
4
+ path: string;
5
+ /** The imported .ark component to render for this route */
6
+ component: Component;
7
+ }
8
+ /**
9
+ * Creates a RouterView component that reactively renders the page
10
+ * matched by the current URL path.
11
+ *
12
+ * Usage A — mount directly as app root:
13
+ * mount(createRouterView(routes), '#app')
14
+ *
15
+ * Usage B — as a variable in an .ark layout template:
16
+ * // in <script> (module level):
17
+ * const RouterView = createRouterView(routes)
18
+ * // in <template>:
19
+ * <RouterView />
20
+ *
21
+ * When navigateTo() is called, the matched component is swapped
22
+ * automatically — the renderer unmounts the old page and mounts the new one.
23
+ */
24
+ export declare function createRouterView(routes: RouteWithComponent[]): Component;
25
+ //# sourceMappingURL=router-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-view.d.ts","sourceRoot":"","sources":["../../src/router/router-view.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAK5D,MAAM,WAAW,kBAAkB;IACjC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,SAAS,EAAE,SAAS,CAAA;CACrB;AAsBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAqBxE"}
@@ -20,6 +20,8 @@ export interface Router {
20
20
  } | null;
21
21
  navigate(path: string): void;
22
22
  }
23
+ export declare const _pathSignal: import('..').Signal<string>;
24
+ export declare const _paramsSignal: import('..').Signal<Record<string, string>>;
23
25
  export declare function getCurrentPath(): string;
24
26
  /** Reset module state between tests. Not part of the public API. */
25
27
  export declare function _resetRouterState(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eA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AAM,EAAE,MAAM,CAAC,GAC9B,IAAI,CAeN;AAMD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,SAAS,CAMpC"}
@@ -217,6 +217,7 @@ function R() {
217
217
  };
218
218
  }
219
219
  export {
220
+ c as _,
220
221
  N as a,
221
222
  O as b,
222
223
  A as c,
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/runtime/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA6PnD,wBAAgB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,IAAI,CAIxE;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,WAAW,EACtB,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,GAC9D,MAAM,IAAI,CA4DZ"}
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/runtime/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAgQnD,wBAAgB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,IAAI,CAIxE;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,WAAW,EACtB,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,GAC9D,MAAM,IAAI,CA4DZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arckode-ui",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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": [