arckode-ui 0.2.4 → 0.2.6

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,34 @@ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelo
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.6] — 2026-05-23
8
+
9
+ ### Fixed
10
+ - **🔴 BUG**: `ark analyze` procesaba archivos `.store.ts` y `.service.ts` como si fueran
11
+ componentes `.ark`, reportando `MISSING_TEMPLATE` y `MISSING_SCRIPT` en archivos TypeScript
12
+ puros. El scanner en `analyze-cmd.ts` tenía filtros erróneos: `entry.name.endsWith('.store.ts')`
13
+ y `entry.name.endsWith('.service.ts')`. Fix: el scanner solo escanea `.ark`.
14
+
15
+ ## [0.2.5] — 2026-05-23
16
+
17
+ ### Added
18
+ - **`navigateTo(path: string)`**: nueva API de navegación por string exportada del barrel.
19
+ Caso DEFAULT para el 99% de la navegación en app code — no requiere importar la `RouteDefinition`.
20
+ - **Router reactivo**: `useRoute().params` ahora lee señales reactivas (`_paramsSignal`).
21
+ Siempre llamar dentro de `computed()` para reactividad. Antes retornaba `{}` hardcodeado.
22
+ - **`_resetRouterState()`**: helper para reset de estado entre tests (no es API pública).
23
+ - **Browser back/forward**: `createRouter()` registra un listener `popstate` para que el botón
24
+ atrás/adelante del browser actualice `_pathSignal` y `_paramsSignal`.
25
+
26
+ ### Fixed
27
+ - `useRoute().params` siempre retornaba `{}`. Ahora se extrae del match al navegar.
28
+ - Múltiples llamadas a `createRouter()` limpiaban el listener anterior sin deregister.
29
+ Ahora se hace `removeEventListener` antes de agregar el nuevo.
30
+
31
+ ### Changed
32
+ - `createRouter()` almacena referencia global (`_globalRouter`) para que `navigateTo()`
33
+ pueda hacer match y extraer params sin tener acceso al router instance.
34
+
7
35
  ## [0.2.4] — 2026-05-23
8
36
 
9
37
  ### Fixed
@@ -121,7 +149,9 @@ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelo
121
149
  - TypeScript declarations no se generaban (`vite-plugin-dts` faltaba) —
122
150
  arreglado en `0.2.2`.
123
151
 
124
- [Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.4...HEAD
152
+ [Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.6...HEAD
153
+ [0.2.6]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.5...v0.2.6
154
+ [0.2.5]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.4...v0.2.5
125
155
  [0.2.4]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.3...v0.2.4
126
156
  [0.2.3]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.2...v0.2.3
127
157
  [0.2.2]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.1...v0.2.2
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-DhUDyb8s.js";
5
+ import { s as j } from "./router-By0pj28e.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
@@ -9,6 +9,6 @@ export { defineStore } from './store/define-store';
9
9
  export type { PersistOptions, StoreOptions, StoreInstance, UseStoreFn, } from './store/define-store';
10
10
  export { createService, ArkServiceError } from './services/create-service';
11
11
  export type { RequestOptions, ServiceContext, ServiceOptions, ServiceDefinition, ServiceInstance, } from './services/create-service';
12
- export { createRouter, navigate, useRoute, getCurrentPath, } from './router/router';
12
+ export { createRouter, navigate, navigateTo, useRoute, getCurrentPath, } from './router/router';
13
13
  export type { RouteDefinition, RouteRef, Router, RouteInfo, } from './router/router';
14
14
  //# 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,EACb,UAAU,GACX,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC1E,YAAY,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAIlC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,eAAe,EACf,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,iBAAiB,CAAA"}
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,EACb,UAAU,GACX,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC1E,YAAY,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,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"}
package/dist/index.js CHANGED
@@ -1,132 +1,58 @@
1
- import { c as le, g as de, n as ye, u as me } from "./router-DhUDyb8s.js";
2
- let y = null;
3
- function j(e) {
4
- y !== null && e.add(y);
5
- }
6
- function O(e) {
7
- for (const n of new Set(e))
8
- n();
9
- }
10
- function R(e) {
11
- let n = e;
12
- const t = /* @__PURE__ */ new Set();
13
- return {
14
- get value() {
15
- return j(t), n;
16
- },
17
- set value(r) {
18
- Object.is(r, n) || (n = r, O(t));
19
- },
20
- get peek() {
21
- return n;
22
- }
23
- };
24
- }
25
- function ee(e) {
26
- let n, t = !0;
27
- const r = /* @__PURE__ */ new Set();
28
- function u() {
29
- t = !0, O(r);
30
- }
31
- return {
32
- get value() {
33
- if (j(r), t) {
34
- const o = y;
35
- y = u;
36
- try {
37
- n = e();
38
- } finally {
39
- y = o;
40
- }
41
- t = !1;
42
- }
43
- return n;
44
- }
45
- };
46
- }
47
- function W(e) {
48
- let n = !1;
49
- function t() {
50
- if (n) return;
51
- const r = y;
52
- y = t;
53
- try {
54
- e();
55
- } finally {
56
- y = r;
57
- }
58
- }
59
- return t(), () => {
60
- n = !0;
61
- };
62
- }
63
- function F(e, n, t) {
64
- let r = !1, u;
65
- function o() {
66
- if (r) return;
67
- const a = e.value;
68
- queueMicrotask(() => {
69
- r || (n(a, u), u = a);
70
- });
71
- }
72
- const c = y;
73
- return y = o, u = e.value, y = c, (t == null ? void 0 : t.immediate) === !0 && n(u, u), () => {
74
- r = !0;
75
- };
76
- }
77
- const _ = typeof process < "u" ? process.env.NODE_ENV !== "production" : !0;
78
- function m(e) {
79
- _ && console.warn(`[arckode-ui] ${e}`);
80
- }
81
- function I(e, n, t) {
82
- for (const [r, u] of Object.entries(e)) {
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";
3
+ const S = typeof process < "u" ? process.env.NODE_ENV !== "production" : !0;
4
+ function y(e) {
5
+ S && console.warn(`[arckode-ui] ${e}`);
6
+ }
7
+ function R(e, n, t) {
8
+ for (const [r, s] of Object.entries(e)) {
83
9
  const o = n[r];
84
- if (u.required === !0 && o === void 0) {
85
- m(`[${t}] Prop requerido "${r}" no fue proporcionado.`);
10
+ if (s.required === !0 && o === void 0) {
11
+ y(`[${t}] Prop requerido "${r}" no fue proporcionado.`);
86
12
  continue;
87
13
  }
88
14
  if (o === void 0) continue;
89
- const c = u.type;
90
- 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(
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(
91
17
  `[${t}] Prop "${r}" recibió tipo incorrecto. Esperado: ${c.name}, recibido: ${typeof o}.`
92
18
  );
93
19
  }
94
20
  }
95
- function B(e, n, t) {
96
- e.includes(n) || m(
21
+ function W(e, n, t) {
22
+ e.includes(n) || y(
97
23
  `[${t}] emit("${n}") no está declarado en emits[]. Declarar antes de usar.`
98
24
  );
99
25
  }
100
- function K(e, n) {
26
+ function F(e, n) {
101
27
  if (typeof e != "object" || e === null) {
102
- m(`[${n}] setup() debe retornar un objeto { state, computed, actions }.`);
28
+ y(`[${n}] setup() debe retornar un objeto { state, computed, actions }.`);
103
29
  return;
104
30
  }
105
31
  const t = /* @__PURE__ */ new Set(["state", "computed", "actions"]), r = Object.keys(e);
106
- for (const u of r)
107
- t.has(u) || m(
108
- `[${n}] setup() retornó una key no permitida: "${u}". Solo se permiten: state, computed, actions.`
32
+ for (const s of r)
33
+ t.has(s) || y(
34
+ `[${n}] setup() retornó una key no permitida: "${s}". Solo se permiten: state, computed, actions.`
109
35
  );
110
36
  }
111
- function te(e) {
112
- if (_) {
113
- if (e.name || m('defineComponent() requiere el campo "name".'), e.emits)
37
+ function Y(e) {
38
+ if (S) {
39
+ if (e.name || y('defineComponent() requiere el campo "name".'), e.emits)
114
40
  for (const t of e.emits)
115
- (t !== t.toLowerCase() || /[A-Z]/.test(t)) && m(
41
+ (t !== t.toLowerCase() || /[A-Z]/.test(t)) && y(
116
42
  `[${e.name}] El evento "${t}" en emits[] debe ser kebab-case. Usar "${t.replace(/([A-Z])/g, "-$1").toLowerCase()}" en su lugar.`
117
43
  );
118
44
  if (e.props)
119
45
  for (const [t, r] of Object.entries(e.props))
120
- r.type || m(`[${e.name}] El prop "${t}" no tiene "type" definido.`);
46
+ r.type || y(`[${e.name}] El prop "${t}" no tiene "type" definido.`);
121
47
  }
122
48
  const n = (t, r) => {
123
- _ && I(e.props ?? {}, t, e.name);
124
- const u = {
125
- emit(c, a) {
126
- _ && B(e.emits ?? [], c, e.name), r.emit(c, a);
49
+ S && R(e.props ?? {}, t, e.name);
50
+ const s = {
51
+ emit(c, u) {
52
+ S && W(e.emits ?? [], c, e.name), r.emit(c, u);
127
53
  }
128
- }, o = e.setup(t, u);
129
- return _ && K(o, e.name), o;
54
+ }, o = e.setup(t, s);
55
+ return S && F(o, e.name), o;
130
56
  };
131
57
  return {
132
58
  name: e.name,
@@ -136,48 +62,48 @@ function te(e) {
136
62
  setup: n
137
63
  };
138
64
  }
139
- let x = [], A = [], P = [];
140
- function Z(e, n, t) {
141
- x = e, A = n, P = t;
65
+ let j = [], w = [], x = [];
66
+ function I(e, n, t) {
67
+ j = e, w = n, x = t;
142
68
  }
143
- function ne(e) {
144
- x.push(e);
69
+ function V(e) {
70
+ j.push(e);
145
71
  }
146
- function re(e) {
147
- A.push(e);
72
+ function ee(e) {
73
+ w.push(e);
148
74
  }
149
- function oe(e) {
150
- P.push(e);
75
+ function te(e) {
76
+ x.push(e);
151
77
  }
152
- function ce(e, n, ...t) {
78
+ function ne(e, n, ...t) {
153
79
  return {
154
80
  tag: e,
155
81
  props: n ?? {},
156
- children: U(t)
82
+ children: A(t)
157
83
  };
158
84
  }
159
- function U(e) {
85
+ function A(e) {
160
86
  const n = [];
161
87
  for (const t of e)
162
- t == null || t === !1 || t === !0 || (Array.isArray(t) ? n.push(...U(t)) : typeof t == "number" ? n.push(String(t)) : n.push(t));
88
+ t == null || t === !1 || t === !0 || (Array.isArray(t) ? n.push(...A(t)) : typeof t == "number" ? n.push(String(t)) : n.push(t));
163
89
  return n;
164
90
  }
165
- function H(e) {
91
+ function O(e) {
166
92
  return typeof e == "object" && e !== null && typeof e.setup == "function";
167
93
  }
168
- function G(e, n) {
94
+ function B(e, n) {
169
95
  const t = Object.keys(e), r = Object.keys(n);
170
96
  if (t.length !== r.length) return !1;
171
- for (const u of t)
172
- if (e[u] !== n[u]) return !1;
97
+ for (const s of t)
98
+ if (e[s] !== n[s]) return !1;
173
99
  return !0;
174
100
  }
175
- function N(e, n) {
101
+ function P(e, n) {
176
102
  for (const [t, r] of Object.entries(n))
177
103
  if (t !== "key") {
178
104
  if (t.startsWith("on") && t.length > 2 && typeof r == "function") {
179
- const u = t.slice(2).toLowerCase();
180
- e.addEventListener(u, r);
105
+ const s = t.slice(2).toLowerCase();
106
+ e.addEventListener(s, r);
181
107
  continue;
182
108
  }
183
109
  if (t === "class") {
@@ -199,189 +125,189 @@ function N(e, n) {
199
125
  r === !1 || r === null || r === void 0 ? e.removeAttribute(t) : e.setAttribute(t, String(r));
200
126
  }
201
127
  }
202
- function k(e) {
128
+ function g(e) {
203
129
  if (e == null)
204
130
  return document.createTextNode("");
205
131
  if (typeof e == "string" || typeof e == "number")
206
132
  return document.createTextNode(String(e));
207
- if (H(e.tag)) {
133
+ if (O(e.tag)) {
208
134
  const t = document.createElement("div");
209
135
  t.style.display = "contents";
210
- const r = R(e.children), u = {
136
+ const r = J(e.children), s = {
211
137
  ...e.props,
212
138
  __slot_default: () => r.value
213
139
  };
214
- for (const [c, a] of Object.entries(e.props))
215
- if (c.startsWith("on") && c.length > 2 && typeof a == "function") {
140
+ for (const [c, u] of Object.entries(e.props))
141
+ if (c.startsWith("on") && c.length > 2 && typeof u == "function") {
216
142
  const i = c.slice(2).toLowerCase();
217
- t.addEventListener(i, (h) => {
218
- const p = h.detail;
219
- a(p);
143
+ t.addEventListener(i, (m) => {
144
+ const h = m.detail;
145
+ u(h);
220
146
  });
221
147
  }
222
- const o = D(e.tag, u, t, null);
148
+ const o = H(e.tag, s, t, null);
223
149
  return t.__arkUnmount = o, t.__arkSlot = r, t.__arkTag = e.tag, t.__arkStaticProps = { ...e.props }, t;
224
150
  }
225
151
  const n = document.createElement(e.tag);
226
- N(n, e.props);
152
+ P(n, e.props);
227
153
  for (const t of e.children)
228
- n.appendChild(k(t));
154
+ n.appendChild(g(t));
229
155
  return n;
230
156
  }
231
- function X(e, n) {
157
+ function K(e, n) {
232
158
  return e == null ? n == null : n == null ? !1 : typeof e == "string" ? typeof n == "string" : typeof n == "string" ? !1 : e.tag === n.tag;
233
159
  }
234
- function L(e, n, t) {
235
- var h, p, l, v, f, g;
236
- if (!X(n, t)) {
237
- const s = k(t);
238
- return (h = e.parentNode) == null || h.replaceChild(s, e), s;
160
+ function U(e, n, t) {
161
+ var m, h, l, C, f, p;
162
+ if (!K(n, t)) {
163
+ const a = g(t);
164
+ return (m = e.parentNode) == null || m.replaceChild(a, e), a;
239
165
  }
240
166
  if (typeof t == "string" || t === null || t === void 0) {
241
- const s = t == null ? "" : String(t);
167
+ const a = t == null ? "" : String(t);
242
168
  if (e.nodeType === Node.TEXT_NODE)
243
- return e.textContent !== s && (e.textContent = s), e;
244
- const d = document.createTextNode(s);
245
- return (p = e.parentNode) == null || p.replaceChild(d, e), d;
169
+ return e.textContent !== a && (e.textContent = a), e;
170
+ const d = document.createTextNode(a);
171
+ return (h = e.parentNode) == null || h.replaceChild(d, e), d;
246
172
  }
247
- if (H(t.tag)) {
248
- const s = e, d = t, b = s.__arkTag, C = d.tag;
249
- if (b === C && s.__arkSlot) {
250
- s.__arkSlot.value = d.children;
251
- const J = s.__arkStaticProps ?? {}, M = d.props;
252
- if (!G(J, M)) {
253
- (l = s.__arkUnmount) == null || l.call(s);
254
- const w = k(t);
255
- return (v = e.parentNode) == null || v.replaceChild(w, e), w;
173
+ if (O(t.tag)) {
174
+ const a = e, d = t, k = a.__arkTag, E = d.tag;
175
+ if (k === E && a.__arkSlot) {
176
+ a.__arkSlot.value = d.children;
177
+ const L = a.__arkStaticProps ?? {}, q = d.props;
178
+ if (!B(L, q)) {
179
+ (l = a.__arkUnmount) == null || l.call(a);
180
+ const T = g(t);
181
+ return (C = e.parentNode) == null || C.replaceChild(T, e), T;
256
182
  }
257
183
  return e;
258
184
  }
259
- (f = s.__arkUnmount) == null || f.call(s);
260
- const $ = k(t);
261
- return (g = e.parentNode) == null || g.replaceChild($, e), $;
185
+ (f = a.__arkUnmount) == null || f.call(a);
186
+ const $ = g(t);
187
+ return (p = e.parentNode) == null || p.replaceChild($, e), $;
262
188
  }
263
- const r = e, u = (n == null ? void 0 : n.props) ?? {}, o = t.props;
264
- for (const [s, d] of Object.entries(u))
265
- s.startsWith("on") && s.length > 2 && typeof d == "function" && r.removeEventListener(s.slice(2).toLowerCase(), d);
266
- for (const s of Object.keys(u))
267
- !(s in o) && !s.startsWith("on") && r.removeAttribute(s);
268
- N(r, o);
269
- const c = n.children, a = t.children, i = Math.max(c.length, a.length);
270
- for (let s = 0; s < i; s++) {
271
- const d = c[s], b = a[s], C = r.childNodes[s];
272
- if (b === void 0) {
273
- for (; r.childNodes.length > s; )
274
- r.removeChild(r.childNodes[s]);
189
+ const r = e, s = (n == null ? void 0 : n.props) ?? {}, o = t.props;
190
+ for (const [a, d] of Object.entries(s))
191
+ a.startsWith("on") && a.length > 2 && typeof d == "function" && r.removeEventListener(a.slice(2).toLowerCase(), d);
192
+ for (const a of Object.keys(s))
193
+ !(a in o) && !a.startsWith("on") && r.removeAttribute(a);
194
+ P(r, o);
195
+ const c = n.children, u = t.children, i = Math.max(c.length, u.length);
196
+ for (let a = 0; a < i; a++) {
197
+ const d = c[a], k = u[a], E = r.childNodes[a];
198
+ if (k === void 0) {
199
+ for (; r.childNodes.length > a; )
200
+ r.removeChild(r.childNodes[a]);
275
201
  break;
276
202
  }
277
- C === void 0 ? r.appendChild(k(b)) : L(C, d ?? null, b);
203
+ E === void 0 ? r.appendChild(g(k)) : U(E, d ?? null, k);
278
204
  }
279
205
  return r;
280
206
  }
281
- function ue(e, n) {
207
+ function re(e, n) {
282
208
  const t = document.querySelector(n);
283
209
  if (!t) throw new Error(`[arckode-ui] mount: "${n}" not found`);
284
- return D(e, {}, t, null);
210
+ return H(e, {}, t, null);
285
211
  }
286
- function D(e, n, t, r) {
287
- const u = [], o = [];
288
- Z(u, o, []);
289
- const a = r ?? ((f, g) => {
212
+ function H(e, n, t, r) {
213
+ const s = [], o = [];
214
+ I(s, o, []);
215
+ const u = r ?? ((f, p) => {
290
216
  t.dispatchEvent(
291
- new CustomEvent(f, { detail: g, bubbles: !0 })
217
+ new CustomEvent(f, { detail: p, bubbles: !0 })
292
218
  );
293
- }), i = e.setup(n, { emit: a }), h = e.__render;
294
- if (!h)
219
+ }), i = e.setup(n, { emit: u }), m = e.__render;
220
+ if (!m)
295
221
  return (typeof process > "u" || process.env.NODE_ENV !== "production") && console.warn(
296
222
  `[arckode-ui] ${e.name}: no __render. ¿Compilado por el Vite plugin?`
297
223
  ), () => {
298
224
  };
299
- let p = null, l = null;
300
- const v = W(() => {
301
- const f = h(
225
+ let h = null, l = null;
226
+ const C = D(() => {
227
+ const f = m(
302
228
  n,
303
229
  i.state ?? {},
304
230
  i.computed ?? {},
305
231
  i.actions ?? {}
306
232
  );
307
- l === null ? (l = k(f), t.appendChild(l)) : l = L(l, p, f), p = f;
233
+ l === null ? (l = g(f), t.appendChild(l)) : l = U(l, h, f), h = f;
308
234
  });
309
235
  return queueMicrotask(() => {
310
- for (const f of u) f();
236
+ for (const f of s) f();
311
237
  }), () => {
312
238
  var f;
313
- v();
314
- for (const g of o) g();
239
+ C();
240
+ for (const p of o) p();
315
241
  l && ((f = l.parentNode) == null || f.removeChild(l));
316
242
  };
317
243
  }
318
- const E = /* @__PURE__ */ new Map();
319
- function q(e) {
244
+ const _ = /* @__PURE__ */ new Map();
245
+ function N(e) {
320
246
  try {
321
247
  return e === "localStorage" ? typeof localStorage < "u" ? localStorage : null : typeof sessionStorage < "u" ? sessionStorage : null;
322
248
  } catch {
323
249
  return null;
324
250
  }
325
251
  }
326
- function z(e, n) {
327
- const t = q(e.storage);
252
+ function Z(e, n) {
253
+ const t = N(e.storage);
328
254
  if (t)
329
255
  try {
330
256
  const r = t.getItem(e.key);
331
257
  if (!r) return;
332
- const u = JSON.parse(r), o = e.pick ?? Object.keys(n);
258
+ const s = JSON.parse(r), o = e.pick ?? Object.keys(n);
333
259
  for (const c of o)
334
- c in u && c in n && (n[c].value = u[c]);
260
+ c in s && c in n && (n[c].value = s[c]);
335
261
  } catch {
336
262
  }
337
263
  }
338
- function Q(e, n) {
339
- const t = q(e.storage);
264
+ function G(e, n) {
265
+ const t = N(e.storage);
340
266
  if (t)
341
267
  try {
342
- const r = e.pick ?? Object.keys(n), u = {};
268
+ const r = e.pick ?? Object.keys(n), s = {};
343
269
  for (const o of r)
344
- o in n && (u[o] = n[o].peek);
345
- t.setItem(e.key, JSON.stringify(u));
270
+ o in n && (s[o] = n[o].peek);
271
+ t.setItem(e.key, JSON.stringify(s));
346
272
  } catch {
347
273
  }
348
274
  }
349
- function Y(e, n) {
350
- z(e, n);
275
+ function X(e, n) {
276
+ Z(e, n);
351
277
  const t = e.pick ?? Object.keys(n);
352
278
  for (const r of t)
353
- r in n && F(n[r], () => {
354
- Q(e, n);
279
+ r in n && M(n[r], () => {
280
+ G(e, n);
355
281
  });
356
282
  }
357
- function se(e, n) {
283
+ function oe(e, n) {
358
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() {
359
- if (E.has(e))
360
- return E.get(e);
285
+ if (_.has(e))
286
+ return _.get(e);
361
287
  const r = {
362
288
  state: n.state,
363
289
  actions: n.actions,
364
290
  getters: n.getters ?? {}
365
291
  };
366
- return n.persist && Y(
292
+ return n.persist && X(
367
293
  n.persist,
368
294
  n.state
369
- ), E.set(e, r), r;
295
+ ), _.set(e, r), r;
370
296
  };
371
297
  }
372
- class T extends Error {
298
+ class v extends Error {
373
299
  constructor(n, t, r) {
374
300
  super(r), this.status = n, this.body = t, this.name = "ArkServiceError";
375
301
  }
376
302
  }
377
- async function S(e, n, t) {
378
- const r = new AbortController(), u = setTimeout(() => r.abort(), t);
303
+ async function b(e, n, t) {
304
+ const r = new AbortController(), s = setTimeout(() => r.abort(), t);
379
305
  try {
380
306
  const o = await fetch(e, {
381
307
  ...n,
382
308
  signal: r.signal
383
309
  });
384
- clearTimeout(u);
310
+ clearTimeout(s);
385
311
  let c;
386
312
  if ((o.headers.get("content-type") ?? "").includes("application/json"))
387
313
  c = await o.json();
@@ -394,37 +320,37 @@ async function S(e, n, t) {
394
320
  }
395
321
  }
396
322
  if (!o.ok)
397
- throw new T(
323
+ throw new v(
398
324
  o.status,
399
325
  c,
400
326
  `HTTP ${o.status}`
401
327
  );
402
328
  return c;
403
329
  } catch (o) {
404
- throw clearTimeout(u), o instanceof T, o;
330
+ throw clearTimeout(s), o instanceof v, o;
405
331
  }
406
332
  }
407
- function V(e) {
333
+ function z(e) {
408
334
  const n = e.timeout ?? 5e3, t = e.headers ?? {};
409
- function r(u) {
410
- return { ...t, ...u };
335
+ function r(s) {
336
+ return { ...t, ...s };
411
337
  }
412
338
  return {
413
- async get(u, o) {
414
- const c = `${e.baseUrl}${u}`, a = (o == null ? void 0 : o.timeout) ?? n;
415
- return S(
339
+ async get(s, o) {
340
+ const c = `${e.baseUrl}${s}`, u = (o == null ? void 0 : o.timeout) ?? n;
341
+ return b(
416
342
  c,
417
343
  {
418
344
  method: "GET",
419
345
  headers: r(o == null ? void 0 : o.headers)
420
346
  },
421
- a
347
+ u
422
348
  );
423
349
  },
424
- async post(u, o, c) {
425
- const a = `${e.baseUrl}${u}`, i = (c == null ? void 0 : c.timeout) ?? n;
426
- return S(
427
- a,
350
+ async post(s, o, c) {
351
+ const u = `${e.baseUrl}${s}`, i = (c == null ? void 0 : c.timeout) ?? n;
352
+ return b(
353
+ u,
428
354
  {
429
355
  method: "POST",
430
356
  headers: {
@@ -436,10 +362,10 @@ function V(e) {
436
362
  i
437
363
  );
438
364
  },
439
- async put(u, o, c) {
440
- const a = `${e.baseUrl}${u}`, i = (c == null ? void 0 : c.timeout) ?? n;
441
- return S(
442
- a,
365
+ async put(s, o, c) {
366
+ const u = `${e.baseUrl}${s}`, i = (c == null ? void 0 : c.timeout) ?? n;
367
+ return b(
368
+ u,
443
369
  {
444
370
  method: "PUT",
445
371
  headers: {
@@ -451,10 +377,10 @@ function V(e) {
451
377
  i
452
378
  );
453
379
  },
454
- async patch(u, o, c) {
455
- const a = `${e.baseUrl}${u}`, i = (c == null ? void 0 : c.timeout) ?? n;
456
- return S(
457
- a,
380
+ async patch(s, o, c) {
381
+ const u = `${e.baseUrl}${s}`, i = (c == null ? void 0 : c.timeout) ?? n;
382
+ return b(
383
+ u,
458
384
  {
459
385
  method: "PATCH",
460
386
  headers: {
@@ -466,42 +392,43 @@ function V(e) {
466
392
  i
467
393
  );
468
394
  },
469
- async delete(u, o) {
470
- const c = `${e.baseUrl}${u}`, a = (o == null ? void 0 : o.timeout) ?? n;
471
- return S(
395
+ async delete(s, o) {
396
+ const c = `${e.baseUrl}${s}`, u = (o == null ? void 0 : o.timeout) ?? n;
397
+ return b(
472
398
  c,
473
399
  {
474
400
  method: "DELETE",
475
401
  headers: r(o == null ? void 0 : o.headers)
476
402
  },
477
- a
403
+ u
478
404
  );
479
405
  }
480
406
  };
481
407
  }
482
- function ae(e, n) {
483
- const t = V(e), r = {};
484
- for (const u of Object.keys(n))
485
- r[u] = n[u].bind(t);
408
+ function ce(e, n) {
409
+ const t = z(e), r = {};
410
+ for (const s of Object.keys(n))
411
+ r[s] = n[s].bind(t);
486
412
  return r;
487
413
  }
488
414
  export {
489
- T as ArkServiceError,
490
- ee as computed,
491
- le as createRouter,
492
- ae as createService,
493
- te as defineComponent,
494
- se as defineStore,
495
- W as effect,
496
- de as getCurrentPath,
497
- ce as h,
498
- ue as mount,
499
- D as mountComponent,
500
- ye as navigate,
501
- ne as onMount,
502
- re as onUnmount,
503
- oe as onUpdate,
504
- R as signal,
505
- me as useRoute,
506
- F as watch
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
507
434
  };
@@ -21,11 +21,18 @@ export interface Router {
21
21
  navigate(path: string): void;
22
22
  }
23
23
  export declare function getCurrentPath(): string;
24
+ /** Reset module state between tests. Not part of the public API. */
25
+ export declare function _resetRouterState(): void;
24
26
  /**
25
27
  * Scan a pages directory and return RouteDefinition[] for every .ark file found.
26
28
  */
27
29
  export declare function scanPages(pagesDir: string): RouteDefinition[];
28
30
  export declare function createRouter(routes: RouteDefinition[]): Router;
31
+ /**
32
+ * Navigate to a plain URL string. Use this for most navigation in app code.
33
+ * For typed navigation with route definitions, use navigate(routeDef, params).
34
+ */
35
+ export declare function navigateTo(urlPath: string): void;
29
36
  /**
30
37
  * Typed navigate. Builds the URL from a RouteRef + param values.
31
38
  */
@@ -36,9 +43,9 @@ export interface RouteInfo {
36
43
  path: string;
37
44
  }
38
45
  /**
39
- * Returns current route info.
40
- * params are extracted from the URL if a Router instance is available globally.
41
- * query is parsed from window.location.search (or '' in Node.js).
46
+ * Returns current route info — reactive when called inside computed().
47
+ * params: extracted from the URL by the router (e.g. { id: '42' } for /users/:id).
48
+ * Always call inside computed() for reactivity: computed(() => useRoute().params.id)
42
49
  */
43
50
  export declare function useRoute(): RouteInfo;
44
51
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAA;IACjB,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,IAAI,CAAA;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AASD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAqHD;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CA0D7D;AAgED,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAyB9D;AAMD;;GAEG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,IAAI,CAcN;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,CAiBpC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAChB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAA;IACjB,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,eAAe,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,IAAI,CAAA;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAoBD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,oEAAoE;AACpE,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC;AAqHD;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CA0D7D;AAgED,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CA4C9D;AAMD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMhD;AAMD;;GAEG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,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"}
@@ -0,0 +1,230 @@
1
+ import * as k from "node:fs";
2
+ import * as j from "node:path";
3
+ let u = null;
4
+ function P(e) {
5
+ u !== null && e.add(u);
6
+ }
7
+ function S(e) {
8
+ for (const n of new Set(e))
9
+ n();
10
+ }
11
+ function _(e) {
12
+ let n = e;
13
+ const t = /* @__PURE__ */ new Set();
14
+ return {
15
+ get value() {
16
+ return P(t), n;
17
+ },
18
+ set value(s) {
19
+ Object.is(s, n) || (n = s, S(t));
20
+ },
21
+ get peek() {
22
+ return n;
23
+ }
24
+ };
25
+ }
26
+ function A(e) {
27
+ let n, t = !0;
28
+ const s = /* @__PURE__ */ new Set();
29
+ function i() {
30
+ t = !0, S(s);
31
+ }
32
+ return {
33
+ get value() {
34
+ if (P(s), t) {
35
+ const a = u;
36
+ u = i;
37
+ try {
38
+ n = e();
39
+ } finally {
40
+ u = a;
41
+ }
42
+ t = !1;
43
+ }
44
+ return n;
45
+ }
46
+ };
47
+ }
48
+ function D(e) {
49
+ let n = !1;
50
+ function t() {
51
+ if (n) return;
52
+ const s = u;
53
+ u = t;
54
+ try {
55
+ e();
56
+ } finally {
57
+ u = s;
58
+ }
59
+ }
60
+ return t(), () => {
61
+ n = !0;
62
+ };
63
+ }
64
+ function q(e, n, t) {
65
+ let s = !1, i;
66
+ function a() {
67
+ if (s) return;
68
+ const o = e.value;
69
+ queueMicrotask(() => {
70
+ s || (n(o, i), i = o);
71
+ });
72
+ }
73
+ const r = u;
74
+ return u = a, i = e.value, u = r, (t == null ? void 0 : t.immediate) === !0 && n(i, i), () => {
75
+ s = !0;
76
+ };
77
+ }
78
+ const c = _(typeof window < "u" ? window.location.pathname : "/"), p = _({});
79
+ let f = null, w = null;
80
+ function $() {
81
+ const e = {};
82
+ return typeof window < "u" && new URLSearchParams(window.location.search).forEach((n, t) => {
83
+ e[t] = n;
84
+ }), e;
85
+ }
86
+ function F() {
87
+ return c.value;
88
+ }
89
+ function E(e) {
90
+ return e.startsWith("(") && e.endsWith(")") ? "" : e.startsWith("[...") && e.endsWith("]") ? "*" : e.startsWith("[") && e.endsWith("]") ? `:${e.slice(1, -1)}` : e === "index" ? "" : e;
91
+ }
92
+ function L(e) {
93
+ const n = [];
94
+ for (const t of e.split("/"))
95
+ t.startsWith(":") && n.push(t.slice(1));
96
+ return n;
97
+ }
98
+ function T(e) {
99
+ const t = e.replace(/\.ark$/, "").split("/"), s = [];
100
+ for (const r of t) {
101
+ const o = E(r);
102
+ s.push(o);
103
+ }
104
+ const i = s.filter((r) => r !== "");
105
+ if (i.length === 0)
106
+ return "/";
107
+ if (i.includes("*")) {
108
+ const r = i.slice(0, i.indexOf("*"));
109
+ return r.length > 0 ? `/${r.join("/")}/*` : "/*";
110
+ }
111
+ return `/${i.join("/")}`;
112
+ }
113
+ function x(e, n) {
114
+ const t = [], s = k.readdirSync(e, { withFileTypes: !0 });
115
+ for (const i of s) {
116
+ const a = j.join(e, i.name), r = n ? `${n}/${i.name}` : i.name;
117
+ i.isDirectory() ? t.push(...x(a, r)) : i.isFile() && i.name.endsWith(".ark") && t.push(r);
118
+ }
119
+ return t;
120
+ }
121
+ function M(e) {
122
+ const n = x(e, ""), t = [], s = [];
123
+ for (const i of n)
124
+ if ((i.split("/").pop() ?? "") === "_layout.ark") {
125
+ const r = i.split("/").slice(0, -1).join("/");
126
+ s.push({ prefix: r, filePath: i });
127
+ }
128
+ for (const i of n) {
129
+ const a = i.split("/"), r = a[a.length - 1] ?? "", o = r === "_layout.ark", l = r === "_error.ark", d = T(i), W = L(d);
130
+ let v;
131
+ if (!o) {
132
+ const m = a.slice(0, -1).join("/");
133
+ let y = "", g;
134
+ for (const h of s)
135
+ (h.prefix === m || m.startsWith(h.prefix === "" ? "" : `${h.prefix}/`)) && h.prefix.length >= y.length && (y = h.prefix, g = h.filePath);
136
+ v = g;
137
+ }
138
+ t.push({
139
+ path: d,
140
+ filePath: i,
141
+ params: W,
142
+ isLayout: o,
143
+ isError: l,
144
+ ...v !== void 0 ? { layoutPath: v } : {}
145
+ });
146
+ }
147
+ return t;
148
+ }
149
+ function C(e, n) {
150
+ const t = e.split("/").filter(Boolean), s = n.split("/").filter(Boolean), i = {};
151
+ if (t.length > 0 && t[t.length - 1] === "*") {
152
+ const r = t.slice(0, -1);
153
+ if (s.length < r.length) return null;
154
+ for (let o = 0; o < r.length; o++) {
155
+ const l = r[o], d = s[o];
156
+ if (l.startsWith(":"))
157
+ i[l.slice(1)] = d;
158
+ else if (l !== d)
159
+ return null;
160
+ }
161
+ return i["*"] = s.slice(r.length).join("/"), i;
162
+ }
163
+ if (t.length !== s.length) return null;
164
+ for (let r = 0; r < t.length; r++) {
165
+ const o = t[r], l = s[r];
166
+ if (o.startsWith(":"))
167
+ i[o.slice(1)] = l;
168
+ else if (o !== l)
169
+ return null;
170
+ }
171
+ return e === "/" && n !== "/" ? null : i;
172
+ }
173
+ function N(e) {
174
+ const n = e.filter((r) => !r.isLayout && !r.isError);
175
+ function t(r) {
176
+ for (const o of n) {
177
+ const l = C(o.path, r);
178
+ if (l !== null)
179
+ return { route: o, params: l };
180
+ }
181
+ return null;
182
+ }
183
+ function s(r) {
184
+ c.value = r;
185
+ const o = t(r);
186
+ p.value = (o == null ? void 0 : o.params) ?? {}, typeof window < "u" && window.history.pushState(null, "", r);
187
+ }
188
+ const i = { match: t, navigate: s };
189
+ f = i;
190
+ const a = t(c.value);
191
+ return a && (p.value = a.params), typeof window < "u" && (w && window.removeEventListener("popstate", w), w = () => {
192
+ const r = window.location.pathname;
193
+ c.value = r;
194
+ const o = t(r);
195
+ p.value = (o == null ? void 0 : o.params) ?? {};
196
+ }, window.addEventListener("popstate", w)), i;
197
+ }
198
+ function O(e) {
199
+ var n;
200
+ c.value = e, p.value = ((n = f == null ? void 0 : f.match(e)) == null ? void 0 : n.params) ?? {}, typeof window < "u" && window.history.pushState(null, "", e);
201
+ }
202
+ function B(e, n) {
203
+ var s;
204
+ let t = e.path;
205
+ if (n)
206
+ for (const [i, a] of Object.entries(n))
207
+ t = t.replace(`:${i}`, a);
208
+ c.value = t, p.value = ((s = f == null ? void 0 : f.match(t)) == null ? void 0 : s.params) ?? n ?? {}, typeof window < "u" && window.history.pushState(null, "", t);
209
+ }
210
+ function R() {
211
+ return {
212
+ params: { ...p.value },
213
+ // reactive read — signals tracked by computed()
214
+ query: $(),
215
+ path: c.value
216
+ // reactive read
217
+ };
218
+ }
219
+ export {
220
+ N as a,
221
+ O as b,
222
+ A as c,
223
+ _ as d,
224
+ D as e,
225
+ F as g,
226
+ B as n,
227
+ M as s,
228
+ R as u,
229
+ q as w
230
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arckode-ui",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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": [
@@ -1,129 +0,0 @@
1
- import * as g from "node:fs";
2
- import * as y from "node:path";
3
- let u = typeof window < "u" ? window.location.pathname : "/";
4
- function j() {
5
- return u;
6
- }
7
- function x(n) {
8
- return n.startsWith("(") && n.endsWith(")") ? "" : n.startsWith("[...") && n.endsWith("]") ? "*" : n.startsWith("[") && n.endsWith("]") ? `:${n.slice(1, -1)}` : n === "index" ? "" : n;
9
- }
10
- function W(n) {
11
- const r = [];
12
- for (const e of n.split("/"))
13
- e.startsWith(":") && r.push(e.slice(1));
14
- return r;
15
- }
16
- function v(n) {
17
- const e = n.replace(/\.ark$/, "").split("/"), o = [];
18
- for (const s of e) {
19
- const i = x(s);
20
- o.push(i);
21
- }
22
- const t = o.filter((s) => s !== "");
23
- if (t.length === 0)
24
- return "/";
25
- if (t.includes("*")) {
26
- const s = t.slice(0, t.indexOf("*"));
27
- return s.length > 0 ? `/${s.join("/")}/*` : "/*";
28
- }
29
- return `/${t.join("/")}`;
30
- }
31
- function w(n, r) {
32
- const e = [], o = g.readdirSync(n, { withFileTypes: !0 });
33
- for (const t of o) {
34
- const a = y.join(n, t.name), s = r ? `${r}/${t.name}` : t.name;
35
- t.isDirectory() ? e.push(...w(a, s)) : t.isFile() && t.name.endsWith(".ark") && e.push(s);
36
- }
37
- return e;
38
- }
39
- function k(n) {
40
- const r = w(n, ""), e = [], o = [];
41
- for (const t of r)
42
- if ((t.split("/").pop() ?? "") === "_layout.ark") {
43
- const s = t.split("/").slice(0, -1).join("/");
44
- o.push({ prefix: s, filePath: t });
45
- }
46
- for (const t of r) {
47
- const a = t.split("/"), s = a[a.length - 1] ?? "", i = s === "_layout.ark", l = s === "_error.ark", f = v(t), m = W(f);
48
- let h;
49
- if (!i) {
50
- const p = a.slice(0, -1).join("/");
51
- let d = "", P;
52
- for (const c of o)
53
- (c.prefix === p || p.startsWith(c.prefix === "" ? "" : `${c.prefix}/`)) && c.prefix.length >= d.length && (d = c.prefix, P = c.filePath);
54
- h = P;
55
- }
56
- e.push({
57
- path: f,
58
- filePath: t,
59
- params: m,
60
- isLayout: i,
61
- isError: l,
62
- ...h !== void 0 ? { layoutPath: h } : {}
63
- });
64
- }
65
- return e;
66
- }
67
- function S(n, r) {
68
- const e = n.split("/").filter(Boolean), o = r.split("/").filter(Boolean), t = {};
69
- if (e.length > 0 && e[e.length - 1] === "*") {
70
- const s = e.slice(0, -1);
71
- if (o.length < s.length) return null;
72
- for (let i = 0; i < s.length; i++) {
73
- const l = s[i], f = o[i];
74
- if (l.startsWith(":"))
75
- t[l.slice(1)] = f;
76
- else if (l !== f)
77
- return null;
78
- }
79
- return t["*"] = o.slice(s.length).join("/"), t;
80
- }
81
- if (e.length !== o.length) return null;
82
- for (let s = 0; s < e.length; s++) {
83
- const i = e[s], l = o[s];
84
- if (i.startsWith(":"))
85
- t[i.slice(1)] = l;
86
- else if (i !== l)
87
- return null;
88
- }
89
- return n === "/" && r !== "/" ? null : t;
90
- }
91
- function _(n) {
92
- const r = n.filter((t) => !t.isLayout && !t.isError);
93
- function e(t) {
94
- for (const a of r) {
95
- const s = S(a.path, t);
96
- if (s !== null)
97
- return { route: a, params: s };
98
- }
99
- return null;
100
- }
101
- function o(t) {
102
- u = t, typeof window < "u" && window.history.pushState(null, "", t);
103
- }
104
- return { match: e, navigate: o };
105
- }
106
- function C(n, r) {
107
- let e = n.path;
108
- if (r)
109
- for (const [o, t] of Object.entries(r))
110
- e = e.replace(`:${o}`, t);
111
- u = e, typeof window < "u" && window.history.pushState(null, "", e);
112
- }
113
- function E() {
114
- const n = u, r = {};
115
- return typeof window < "u" && new URLSearchParams(window.location.search).forEach((o, t) => {
116
- r[t] = o;
117
- }), {
118
- params: {},
119
- query: r,
120
- path: n
121
- };
122
- }
123
- export {
124
- _ as c,
125
- j as g,
126
- C as n,
127
- k as s,
128
- E as u
129
- };