arckode-ui 0.2.0 → 0.2.2

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 ADDED
@@ -0,0 +1,102 @@
1
+ # Changelog
2
+
3
+ Cambios entre versiones publicadas. Sigue [keepachangelog](https://keepachangelog.com/) y [semver](https://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.2] — 2026-05-23
8
+
9
+ ### Fixed
10
+ - **🔴 CRÍTICO**: el paquete ahora incluye archivos `.d.ts`. En `0.2.1` el `package.json`
11
+ declaraba `"types": "./dist/index.d.ts"` pero el archivo no existía — los consumidores
12
+ TypeScript recibían `any` en todos los imports. Se agregó `vite-plugin-dts` al build.
13
+ - `package.json.exports["./vite"].types` ahora apunta al path real
14
+ `./dist/compiler/vite-plugin.d.ts` (antes apuntaba a un archivo inexistente).
15
+
16
+ ### Added
17
+ - `.gitlab-ci.yml`: pipeline con stages `install → check → build`. Falla el push si:
18
+ tests rojos, type-check con errores, build no genera todos los artefactos, shebang del
19
+ CLI ausente o no ejecutable, examples con errores del analyzer.
20
+ - `tools/analyze-examples.ts`: corre el analyzer sobre todos los `.ark` de `examples/`
21
+ y falla con exit 1 si hay errores. Usado por CI.
22
+ - `CHANGELOG.md`: este archivo. Documenta cambios formalmente.
23
+
24
+ ### Changed
25
+ - SKILL global + `skills/components/SKILL.md`: documentación explícita del trap del
26
+ store con `useStore()` auto-referencia y el patrón seguro alternativo (declarar el
27
+ useStore primero a nivel módulo y usarlo en getters/actions).
28
+
29
+ ## [0.2.1] — 2026-05-22
30
+
31
+ ### Added
32
+ - `CLAUDE.md.example`: template que los consumidores copian a la raíz de su proyecto.
33
+ Activa el SKILL automáticamente para Claude Code / OpenCode / Cursor con un solo
34
+ comando: `cp node_modules/arckode-ui/CLAUDE.md.example ./CLAUDE.md`.
35
+ - `BENCHMARK.md`: resultados del test ciego de predictabilidad con Claude Sonnet.
36
+ 10 prompts × 2 variantes. Resultado: Sin SKILL 30% / Con SKILL 100%.
37
+ - `tools/benchmark.ts` y `tools/prompts.ts`: script reproducible del benchmark
38
+ (requiere `ANTHROPIC_API_KEY`).
39
+ - `tools/README.md`: instrucciones de uso del benchmark.
40
+ - README con badge del benchmark y sección "Activar el SKILL para tu IA".
41
+
42
+ ## [0.2.0] — 2026-05-22
43
+
44
+ ### Added
45
+ - **PROTOCOLO OBLIGATORIO** en el SKILL principal con PASO 1 → 4
46
+ (identificar alcance → verificar reglas → generar → verificar resultado).
47
+ - **16 REGLAS INMUTABLES numeradas** (`REGLA #1` a `REGLA #16`), referenciables
48
+ desde los anti-patterns y el output del analyzer.
49
+ - **Árboles de decisión** "Si te piden X, hacé Y" para 7 escenarios típicos:
50
+ crear componente, agregar estado, comunicar componentes, renderizar lista,
51
+ hacer fetch, modificar componente, resolver error del analyzer.
52
+ - **Checklist post-código** con comandos exactos.
53
+ - 6 sub-skills temáticos en `skills/` distribuidos con el paquete npm:
54
+ `runtime`, `compiler`, `analyzer`, `cli`, `components`, `testing`.
55
+ - `CLAUDE.md` del repo reescrito con 10 REGLAS INMUTABLES para desarrolladores
56
+ del framework + protocolo de release de 5 pasos + checklist pre-release.
57
+
58
+ ### Changed
59
+ - README actualizado para reflejar el nivel de predictabilidad apuntado.
60
+
61
+ ## [0.1.1] — 2026-05-22
62
+
63
+ ### Fixed
64
+ - **🔴 CRÍTICO**: `package.json.bin` corregido a `dist/cli.js` (sin `./`).
65
+ npm rechazaba silenciosamente el campo `bin` con prefix `./` y eliminaba la entry —
66
+ resultado: `npx arckode-ui ark` no funcionaba en `0.1.0`. Verificable con `npm pack`.
67
+
68
+ ## [0.1.0] — 2026-05-22
69
+
70
+ ### Added — initial release
71
+
72
+ - **Runtime**: `signal`, `computed`, `watch`, `effect`, `defineComponent`,
73
+ lifecycle hooks (`onMount`, `onUnmount`, `onUpdate`), `h`, `mount`, `mountComponent`.
74
+ - **APIs**: `defineStore` (estado global con persist), `createService` (HTTP wrapper
75
+ con timeout y type safety), router client-side (`createRouter`, `navigate`,
76
+ `useRoute`, `getCurrentPath`).
77
+ - **Compiler**: parser `.ark`, template-compiler con `v-if/v-else/v-else-if`, `v-for`,
78
+ `v-show`, `<slot />`, componentes PascalCase, modificadores de teclado, interpolación.
79
+ - **Vite plugin**: `arkcodeUi()` desde subpath `arckode-ui/vite`.
80
+ - **Analyzer estático**: 16 reglas detectando anti-patterns y violations estructurales,
81
+ cada una con campo `fix` que sugiere la corrección concreta. Bloquea builds de
82
+ producción si hay errors.
83
+ - **CLI**: `ark new`, `ark generate {component, page, store, service, layout}`,
84
+ `ark analyze`, `ark routes`.
85
+ - **Comunicación hijo→padre**: emit con `@event` handlers funcional (dispatch
86
+ como CustomEvent sin prefijo, wrapper del child registra listeners `onX`).
87
+ - 314 tests pasando.
88
+ - 2 ejemplos completos: `kitchen-sink` (demo de features) y `tasks` (app real
89
+ con sidebar, modal, form, validación, search con debounce).
90
+
91
+ ### Known issues at release
92
+ - `package.json.bin` con sintaxis inválida que npm removía silenciosamente —
93
+ arreglado en `0.1.1`.
94
+ - TypeScript declarations no se generaban (`vite-plugin-dts` faltaba) —
95
+ arreglado en `0.2.2`.
96
+
97
+ [Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.2...HEAD
98
+ [0.2.2]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.1...v0.2.2
99
+ [0.2.1]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.0...v0.2.1
100
+ [0.2.0]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.1.1...v0.2.0
101
+ [0.1.1]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.1.0...v0.1.1
102
+ [0.1.0]: https://gitlab.com/underworf/arckode-ui/-/tags/v0.1.0
@@ -0,0 +1,123 @@
1
+ # CLAUDE.md — proyecto que usa Arckode UI
2
+
3
+ > Copiá este archivo a la raíz de tu proyecto (renómbralo a `CLAUDE.md`).
4
+ > Claude Code / OpenCode lo cargan automáticamente cuando trabajan en el proyecto.
5
+
6
+ ## Skill obligatoria — leer ANTES de escribir código
7
+
8
+ Arckode UI distribuye un SKILL con PROTOCOLO de 4 pasos y 16 REGLAS INMUTABLES.
9
+ **Antes de crear/modificar cualquier `.ark` file, leer:**
10
+
11
+ ```
12
+ ./node_modules/arckode-ui/skills/SKILL.md
13
+ ```
14
+
15
+ Sub-skills específicos por área:
16
+
17
+ | Contexto | Sub-skill |
18
+ |----------|-----------|
19
+ | Escribir un `.ark`, patrones de UI (modal, form, lista) | `./node_modules/arckode-ui/skills/components/SKILL.md` |
20
+ | Signals, computed, watch, comunicación padre↔hijo | `./node_modules/arckode-ui/skills/runtime/SKILL.md` |
21
+ | Agregar regla nueva al analyzer | `./node_modules/arckode-ui/skills/analyzer/SKILL.md` |
22
+ | CLI `ark` y generators | `./node_modules/arckode-ui/skills/cli/SKILL.md` |
23
+ | Tests con vitest + happy-dom | `./node_modules/arckode-ui/skills/testing/SKILL.md` |
24
+ | Compiler interno (avanzado) | `./node_modules/arckode-ui/skills/compiler/SKILL.md` |
25
+
26
+ ## Las 16 REGLAS INMUTABLES — referencia rápida
27
+
28
+ | # | Regla | Detecta |
29
+ |---|-------|---------|
30
+ | 1 | Toda prop DEBE tener `type` (clase nativa) | `PROP_MISSING_TYPE` |
31
+ | 2 | `emits` siempre kebab-case | `EMIT_CAMELCASE` |
32
+ | 3 | `setup()` retorna SOLO `state`, `computed`, `actions` | `SETUP_UNKNOWN_RETURN_KEY` |
33
+ | 4 | Handlers SIEMPRE `actions.xxx` | `HANDLER_NOT_IN_ACTIONS` |
34
+ | 5 | `v-for` colección siempre namespaced | `VFOR_NOT_NAMESPACED` |
35
+ | 6 | `v-if` con acceso namespaced (con `.`) | `VIF_NOT_NAMESPACED` |
36
+ | 7 | NO existe `v-model` — input controlado explícito | — |
37
+ | 8 | NO existe `ref()` ni `reactive()` — solo `signal()` | `REF_REACTIVE_USAGE` |
38
+ | 9 | NO existe `provide`/`inject` — usar `defineStore` | `PROVIDE_INJECT_USAGE` |
39
+ | 10 | `fetch()` PROHIBIDO en componente — usar `createService` | `DIRECT_FETCH_IN_COMPONENT` |
40
+ | 11 | NO lógica en directivas (`++`, ternarios) | `LOGIC_IN_TEMPLATE` |
41
+ | 12 | Actions como `function`, no arrow | `ARROW_FUNCTION_ACTION` |
42
+ | 13 | Componentes hijos PascalCase + import explícito | — |
43
+ | 14 | `mount(component, selector)` toma string | — |
44
+ | 15 | Imports SOLO de `'arckode-ui'` o `'arckode-ui/vite'` | — |
45
+ | 16 | Orden recomendado del `setup()` | — (convención) |
46
+
47
+ Detalle completo y ejemplos en `./node_modules/arckode-ui/skills/SKILL.md`.
48
+
49
+ ## PROTOCOLO antes de codear
50
+
51
+ ```
52
+ PASO 1 — IDENTIFICAR ALCANCE
53
+ ¿1 componente nuevo? ¿modificar existente? ¿estado global? ¿servicio HTTP?
54
+
55
+ PASO 2 — VERIFICAR REGLAS (las 16 de arriba)
56
+
57
+ PASO 3 — GENERAR
58
+ Si es componente nuevo: copiar PLANTILLA CANÓNICA del SKILL §5
59
+
60
+ PASO 4 — VERIFICAR (NO asumir que funciona)
61
+ npx ark analyze → 0 errors
62
+ Probar en navegador
63
+ ```
64
+
65
+ ## Comandos del proyecto
66
+
67
+ ```bash
68
+ # Generar archivos con plantillas válidas garantizadas
69
+ npx ark generate component <PascalCase>
70
+ npx ark generate page <name>
71
+ npx ark generate store <camelCase>
72
+ npx ark generate service <PascalCase>
73
+ npx ark generate layout <name>
74
+
75
+ # Análisis
76
+ npx ark analyze # 0 errors antes de declarar listo
77
+ npx ark routes # listar rutas del file-system router
78
+
79
+ # Dev / build
80
+ bun dev
81
+ bun build
82
+ ```
83
+
84
+ ## Anti-patterns más comunes (cada uno viola una regla)
85
+
86
+ ```typescript
87
+ // ❌ REGLA #4
88
+ @click="handleClick" → @click="actions.handleClick"
89
+
90
+ // ❌ REGLA #5
91
+ v-for="item in items" → v-for="item in state.items.value"
92
+
93
+ // ❌ REGLA #7
94
+ <input v-model="state.name"/> → :value + @input explícito
95
+
96
+ // ❌ REGLA #8
97
+ const x = ref(0) → signal(0)
98
+
99
+ // ❌ REGLA #11
100
+ @click="state.count.value++" → @click="actions.increment"
101
+ :class="x.value ? 'a' : 'b'" → mover a computed
102
+ ```
103
+
104
+ ## Cuando el analyzer reporta un error
105
+
106
+ Cada violation incluye campo `Fix:` con sugerencia concreta. **Leerlo y aplicarlo literal:**
107
+
108
+ ```
109
+ [arckode-ui] UserCard.ark:5
110
+ HANDLER_NOT_IN_ACTIONS: El handler "handleClick" no está namespaced.
111
+ > 5 | <button @click="handleClick">
112
+ Fix: Reemplazar "handleClick" por "actions.handleClick" y asegurarse de
113
+ que la función esté declarada en setup() y exportada en el return.actions.
114
+ ```
115
+
116
+ ## Benchmark de predictabilidad
117
+
118
+ Test ciego (10 prompts × 2 variantes con Claude Sonnet):
119
+ - **Sin SKILL:** 30% outputs válidos
120
+ - **Con SKILL:** 100% outputs válidos
121
+
122
+ Por eso vale la pena cargar el SKILL antes de generar código.
123
+ Detalle en https://gitlab.com/underworf/arckode-ui/-/blob/main/BENCHMARK.md
package/README.md CHANGED
@@ -1,10 +1,31 @@
1
1
  # Arckode UI
2
2
 
3
- Framework frontend con archivos `.ark` (Single File Components), reactividad por signals, compiler propio (Vite plugin), router file-system y analyzer estático.
3
+ Framework frontend con archivos `.ark` (Single File Components), reactividad por signals, compiler propio (Vite plugin), router file-system y analyzer estático con sugerencias concretas de fix.
4
4
 
5
5
  > **Diseñado para máxima predictibilidad de output de IA.** Hay un solo camino correcto para cada problema. Para cada violation detectada, el analyzer sugiere el fix concreto.
6
6
 
7
- **Versión:** 0.1.0 desarrollo activo
7
+ **Predictabilidad medida (benchmark ciego con Claude Sonnet, 10 prompts):**
8
+ **Sin SKILL: 30% outputs válidos · Con SKILL: 100%.** Ver [BENCHMARK.md](./BENCHMARK.md).
9
+
10
+ **Versión:** 0.2.1 — desarrollo activo
11
+
12
+ ---
13
+
14
+ ## Activar el SKILL para tu IA (Claude/OpenCode)
15
+
16
+ Después de instalar el paquete, copiá el `CLAUDE.md.example` a la raíz de tu proyecto:
17
+
18
+ ```bash
19
+ cp node_modules/arckode-ui/CLAUDE.md.example ./CLAUDE.md
20
+ ```
21
+
22
+ Eso hace que cualquier IA (Claude Code, OpenCode, Cursor) cargue automáticamente:
23
+ - El PROTOCOLO de 4 pasos antes de codear
24
+ - Las 16 reglas inmutables que el analyzer enforza
25
+ - Las plantillas canónicas
26
+ - Los 6 sub-skills temáticos (runtime, compiler, analyzer, cli, components, testing)
27
+
28
+ Sin este archivo, la IA improvisa. Con este archivo, **9 de cada 10 outputs pasan el analyzer al primer intento**.
8
29
 
9
30
  ---
10
31
 
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ark — Arckode UI CLI
3
+ *
4
+ * NOTA: el shebang `#!/usr/bin/env node` se inyecta vía vite.config.ts banner
5
+ * solo en el output dist/cli.js. No ponerlo acá — esbuild lo rechaza como JS inválido.
6
+ *
7
+ * Usage:
8
+ * ark new <nombre>
9
+ * ark generate <tipo> <nombre> (alias: ark g)
10
+ * ark analyze [--json]
11
+ * ark routes
12
+ * ark dev [--port 3000] [--host]
13
+ * ark build [--mode production|staging]
14
+ */
15
+ export declare function main(argv?: string[]): void;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgJH,wBAAgB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,IAAI,CAwCjE"}
@@ -0,0 +1,11 @@
1
+ export interface Violation {
2
+ code: string;
3
+ severity: 'error' | 'warning';
4
+ line: number;
5
+ message: string;
6
+ /** Sugerencia concreta de cómo arreglar la violación. Solo presente cuando el fix es determinístico. */
7
+ fix?: string;
8
+ }
9
+ export declare function analyze(source: string, _filePath: string): Violation[];
10
+ export declare function formatViolation(v: Violation, filePath: string, source: string): string;
11
+ //# sourceMappingURL=analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/compiler/analyzer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,wGAAwG;IACxG,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAgoBD,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,CAsDtE;AAMD,wBAAgB,eAAe,CAC7B,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CAcR"}
@@ -0,0 +1,21 @@
1
+ export interface ArkSections {
2
+ template: {
3
+ content: string;
4
+ start: number;
5
+ };
6
+ script: {
7
+ content: string;
8
+ lang: string;
9
+ };
10
+ style?: {
11
+ content: string;
12
+ scoped: boolean;
13
+ };
14
+ }
15
+ export declare class ArkParseError extends Error {
16
+ readonly code: string;
17
+ readonly line: number;
18
+ constructor(code: string, message: string, line: number);
19
+ }
20
+ export declare function parseArkFile(source: string): ArkSections;
21
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/compiler/parser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5C,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;CAC7C;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAOxD;AAiCD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CA4FxD"}
@@ -0,0 +1,20 @@
1
+ export interface VNode {
2
+ tag: string | object | null;
3
+ props: Record<string, unknown>;
4
+ children: (VNode | string)[];
5
+ }
6
+ /**
7
+ * Compiles an HTML template string into a render function string.
8
+ *
9
+ * The returned string, when eval'd or imported as a module, produces a
10
+ * function with signature:
11
+ *
12
+ * function render(props, state, computed, actions): VNode
13
+ *
14
+ * @param html - Raw HTML template (the content of <template>...</template>)
15
+ * @returns A self-contained JavaScript module string with:
16
+ * - the `h()` helper
17
+ * - the `render` function as default export
18
+ */
19
+ export declare function compileTemplate(html: string): string;
20
+ //# sourceMappingURL=template-compiler.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,14 @@
1
+ import { Plugin } from 'vite';
2
+ export interface ArkcodeUiOptions {
3
+ analyzer?: {
4
+ failOnWarnings?: boolean;
5
+ ignore?: string[];
6
+ };
7
+ }
8
+ /**
9
+ * Generates a deterministic 6-char alphanumeric scope ID from a file path.
10
+ * Used for scoped CSS: data-ark-{scopeId}
11
+ */
12
+ export declare function generateScopeId(filePath: string): string;
13
+ export declare function arkcodeUi(options?: ArkcodeUiOptions): Plugin;
14
+ //# sourceMappingURL=vite-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../src/compiler/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAA;AAUlD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE;QACT,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAClB,CAAA;CACF;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWxD;AAqGD,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAuFhE"}
@@ -0,0 +1,14 @@
1
+ export { signal, computed, watch, effect } from './runtime/signals';
2
+ export type { Signal, ComputedSignal, StopFn } from './runtime/signals';
3
+ export { defineComponent, onMount, onUnmount, onUpdate } from './runtime/define-component';
4
+ export type { ComponentOptions, Component, PropDefinition, PropsOptions, EmitsOptions, SetupContext, SetupReturn, } from './runtime/define-component';
5
+ export { h } from './runtime/h';
6
+ export type { VNode } from './runtime/h';
7
+ export { mount, mountComponent } from './runtime/renderer';
8
+ export { defineStore } from './store/define-store';
9
+ export type { PersistOptions, StoreOptions, StoreInstance, UseStoreFn, } from './store/define-store';
10
+ export { createService, ArkServiceError } from './services/create-service';
11
+ export type { RequestOptions, ServiceContext, ServiceOptions, ServiceDefinition, ServiceInstance, } from './services/create-service';
12
+ export { createRouter, navigate, useRoute, getCurrentPath, } from './router/router';
13
+ export type { RouteDefinition, RouteRef, Router, RouteInfo, } from './router/router';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,44 @@
1
+ export interface RouteDefinition {
2
+ /** URL path, e.g. '/users/:id' */
3
+ path: string;
4
+ /** Relative file path, e.g. 'src/pages/users/[id].ark' */
5
+ filePath: string;
6
+ /** Dynamic param names extracted from the path, e.g. ['id'] */
7
+ params: string[];
8
+ /** true when the file is _layout.ark */
9
+ isLayout: boolean;
10
+ /** true when the file is _error.ark */
11
+ isError: boolean;
12
+ /** filePath of the _layout.ark that wraps this route, if any */
13
+ layoutPath?: string;
14
+ }
15
+ export type RouteRef = RouteDefinition;
16
+ export interface Router {
17
+ match(path: string): {
18
+ route: RouteDefinition;
19
+ params: Record<string, string>;
20
+ } | null;
21
+ navigate(path: string): void;
22
+ }
23
+ export declare function getCurrentPath(): string;
24
+ /**
25
+ * Scan a pages directory and return RouteDefinition[] for every .ark file found.
26
+ */
27
+ export declare function scanPages(pagesDir: string): RouteDefinition[];
28
+ export declare function createRouter(routes: RouteDefinition[]): Router;
29
+ /**
30
+ * Typed navigate. Builds the URL from a RouteRef + param values.
31
+ */
32
+ export declare function navigate(routeDef: RouteRef, params?: Record<string, string>): void;
33
+ export interface RouteInfo {
34
+ params: Record<string, string>;
35
+ query: Record<string, string>;
36
+ path: string;
37
+ }
38
+ /**
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).
42
+ */
43
+ export declare function useRoute(): RouteInfo;
44
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,43 @@
1
+ import { Signal, ComputedSignal } from './signals';
2
+ type PropType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor | FunctionConstructor;
3
+ export interface PropDefinition {
4
+ type: PropType;
5
+ required?: boolean;
6
+ default?: unknown;
7
+ }
8
+ export type PropsOptions = Record<string, PropDefinition>;
9
+ export type EmitsOptions = string[];
10
+ type InferProps<P extends PropsOptions> = {
11
+ [K in keyof P]: P[K]['required'] extends true ? InferPropType<P[K]['type']> : InferPropType<P[K]['type']> | undefined;
12
+ };
13
+ type InferPropType<T extends PropType> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends FunctionConstructor ? (...args: unknown[]) => unknown : unknown;
14
+ export interface SetupContext<E extends EmitsOptions> {
15
+ emit: (event: E[number], payload?: unknown) => void;
16
+ }
17
+ export interface SetupReturn {
18
+ state?: Record<string, Signal<unknown>>;
19
+ computed?: Record<string, ComputedSignal<unknown>>;
20
+ actions?: Record<string, (...args: unknown[]) => unknown>;
21
+ }
22
+ export interface ComponentOptions<P extends PropsOptions = PropsOptions, E extends EmitsOptions = EmitsOptions> {
23
+ name: string;
24
+ props?: P;
25
+ emits?: E;
26
+ meta?: Record<string, unknown>;
27
+ setup(props: InferProps<P>, ctx: SetupContext<E>): SetupReturn;
28
+ }
29
+ export interface Component {
30
+ name: string;
31
+ props: PropsOptions;
32
+ emits: EmitsOptions;
33
+ meta: Record<string, unknown>;
34
+ setup: ComponentOptions['setup'];
35
+ }
36
+ export declare function defineComponent<P extends PropsOptions = PropsOptions, E extends EmitsOptions = EmitsOptions>(options: ComponentOptions<P, E>): Component;
37
+ type LifecycleHook = () => void | Promise<void>;
38
+ export declare function _setCurrentHookArrays(mount: LifecycleHook[], unmount: LifecycleHook[], update: LifecycleHook[]): void;
39
+ export declare function onMount(fn: LifecycleHook): void;
40
+ export declare function onUnmount(fn: LifecycleHook): void;
41
+ export declare function onUpdate(fn: LifecycleHook): void;
42
+ export {};
43
+ //# sourceMappingURL=define-component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-component.d.ts","sourceRoot":"","sources":["../../src/runtime/define-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEvD,KAAK,QAAQ,GACT,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,CAAA;AAEvB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO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: Record<string, unknown>;
4
+ children: (VNode | string)[];
5
+ }
6
+ type Child = VNode | string | number | boolean | null | undefined | Child[];
7
+ export declare function h(tag: string | object | null, props: Record<string, unknown> | null, ...children: Child[]): VNode;
8
+ export {};
9
+ //# sourceMappingURL=h.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../../src/runtime/h.ts"],"names":[],"mappings":"AAAA,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;AAED,KAAK,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,EAAE,CAAA;AAE3E,wBAAgB,CAAC,CACf,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACrC,GAAG,QAAQ,EAAE,KAAK,EAAE,GACnB,KAAK,CAMP"}
@@ -0,0 +1,4 @@
1
+ import { Component } from './define-component';
2
+ export declare function mount(component: Component, selector: string): () => void;
3
+ export declare function mountComponent(component: Component, props: Record<string, unknown>, container: HTMLElement, parentEmit: ((event: string, payload?: unknown) => void) | null): () => void;
4
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,16 @@
1
+ export interface Signal<T> {
2
+ get value(): T;
3
+ set value(v: T);
4
+ readonly peek: T;
5
+ }
6
+ export interface ComputedSignal<T> {
7
+ readonly value: T;
8
+ }
9
+ export type StopFn = () => void;
10
+ export declare function signal<T>(initialValue: T): Signal<T>;
11
+ export declare function computed<T>(getter: () => T): ComputedSignal<T>;
12
+ export declare function effect(fn: () => void): StopFn;
13
+ export declare function watch<T>(source: Signal<T> | ComputedSignal<T>, callback: (newValue: T, oldValue: T) => void, options?: {
14
+ immediate?: boolean;
15
+ }): StopFn;
16
+ //# sourceMappingURL=signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/runtime/signals.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,IAAI,KAAK,IAAI,CAAC,CAAA;IACd,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAC;IACf,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CACjB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAClB;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,IAAI,CAAA;AAE/B,wBAAgB,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAmBpD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CA4B9D;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,CAmB7C;AAED,wBAAgB,KAAK,CAAC,CAAC,EACrB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,IAAI,EAC5C,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,MAAM,CA2BR"}
@@ -0,0 +1,29 @@
1
+ export declare class ArkServiceError extends Error {
2
+ readonly status: number;
3
+ readonly body: unknown;
4
+ constructor(status: number, body: unknown, message: string);
5
+ }
6
+ export interface RequestOptions {
7
+ headers?: Record<string, string>;
8
+ timeout?: number;
9
+ }
10
+ export interface ServiceContext {
11
+ get<T>(path: string, options?: RequestOptions): Promise<T>;
12
+ post<T>(path: string, body: unknown, options?: RequestOptions): Promise<T>;
13
+ put<T>(path: string, body: unknown, options?: RequestOptions): Promise<T>;
14
+ patch<T>(path: string, body: unknown, options?: RequestOptions): Promise<T>;
15
+ delete<T>(path: string, options?: RequestOptions): Promise<T>;
16
+ }
17
+ export interface ServiceOptions {
18
+ baseUrl: string;
19
+ timeout?: number;
20
+ headers?: Record<string, string>;
21
+ }
22
+ export type ServiceDefinition = {
23
+ [key: string]: (this: ServiceContext, ...args: any[]) => Promise<unknown>;
24
+ };
25
+ export type ServiceInstance<T extends ServiceDefinition> = {
26
+ [K in keyof T]: T[K];
27
+ };
28
+ export declare function createService<T extends ServiceDefinition>(options: ServiceOptions, definition: T): ServiceInstance<T>;
29
+ //# sourceMappingURL=create-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-service.d.ts","sourceRoot":"","sources":["../../src/services/create-service.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,OAAO;gBADb,MAAM,EAAE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Ae,CAAC,CAAC,SAAS,iBAAiB,IAAI;KACxD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,CAAA;AAqJD,wBAAgB,aAAa,CAAC,CAAC,SAAS,iBAAiB,EACvD,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,CAAC,GACZ,eAAe,CAAC,CAAC,CAAC,CASpB"}
@@ -0,0 +1,22 @@
1
+ import { Signal, ComputedSignal } from '../runtime/signals';
2
+ export type { Signal, ComputedSignal };
3
+ export interface PersistOptions {
4
+ storage: 'localStorage' | 'sessionStorage';
5
+ key: string;
6
+ pick?: string[];
7
+ }
8
+ export interface StoreOptions<S extends Record<string, Signal<unknown>>, A extends Record<string, (...args: unknown[]) => unknown>, G extends Record<string, ComputedSignal<unknown>> = Record<string, never>> {
9
+ state: S;
10
+ actions: A;
11
+ getters?: G;
12
+ persist?: PersistOptions;
13
+ }
14
+ export interface StoreInstance<S extends Record<string, Signal<unknown>>, A extends Record<string, (...args: unknown[]) => unknown>, G extends Record<string, ComputedSignal<unknown>>> {
15
+ state: S;
16
+ actions: A;
17
+ getters: G;
18
+ }
19
+ export type UseStoreFn<S extends Record<string, Signal<unknown>>, A extends Record<string, (...args: unknown[]) => unknown>, G extends Record<string, ComputedSignal<unknown>>> = () => StoreInstance<S, A, G>;
20
+ export declare function defineStore<S extends Record<string, Signal<unknown>>, A extends Record<string, (...args: unknown[]) => unknown>, G extends Record<string, ComputedSignal<unknown>> = Record<string, never>>(id: string, options: StoreOptions<S, A, G>): UseStoreFn<S, A, G>;
21
+ export declare function _clearRegistry(): void;
22
+ //# sourceMappingURL=define-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-store.d.ts","sourceRoot":"","sources":["../../src/store/define-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEhE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA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a,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAsFhC,wBAAgB,WAAW,CACzB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,EACzC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,EACzD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEzE,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC7B,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAqCrB;AAGD,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arckode-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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": [
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "exports": {
29
29
  ".": {
30
- "import": "./dist/index.js",
31
- "types": "./dist/index.d.ts"
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
32
  },
33
33
  "./vite": {
34
- "import": "./dist/vite.js",
35
- "types": "./dist/vite.d.ts"
34
+ "types": "./dist/compiler/vite-plugin.d.ts",
35
+ "import": "./dist/vite.js"
36
36
  }
37
37
  },
38
38
  "main": "./dist/index.js",
@@ -44,7 +44,9 @@
44
44
  "dist",
45
45
  "skills",
46
46
  "README.md",
47
- "LICENSE"
47
+ "LICENSE",
48
+ "CLAUDE.md.example",
49
+ "CHANGELOG.md"
48
50
  ],
49
51
  "scripts": {
50
52
  "build": "vite build && chmod +x dist/cli.js",
@@ -58,10 +60,12 @@
58
60
  "vite": ">=5.0.0"
59
61
  },
60
62
  "devDependencies": {
63
+ "@anthropic-ai/sdk": "^0.98.0",
61
64
  "@types/bun": "latest",
62
65
  "happy-dom": "^20.9.0",
63
66
  "typescript": "^5.4.0",
64
67
  "vite": "^5.4.0",
68
+ "vite-plugin-dts": "^5.0.1",
65
69
  "vitest": "^2.0.0"
66
70
  }
67
71
  }
package/skills/SKILL.md CHANGED
@@ -650,6 +650,55 @@ export const useUserStore = defineStore('user', {
650
650
  })
651
651
  ```
652
652
 
653
+ ### ⚠ Trap conocido del store — `useStore()` dentro de getters/actions
654
+
655
+ El patrón `useUserStore()` dentro de getters/actions FUNCIONA porque cuando esos
656
+ callbacks se ejecutan, el registry del store YA tiene la instancia registrada.
657
+ Pero hay dos cosas a saber:
658
+
659
+ 1. **NO lo llames durante la DEFINICIÓN del objeto** — solo dentro del callback.
660
+ Si lo llamás afuera, el registry todavía no tiene la instancia y devuelve `undefined`
661
+ o tira error.
662
+
663
+ ```typescript
664
+ // ❌ MAL: useStore() en evaluación del valor del state
665
+ export const useStore = defineStore('x', {
666
+ state: {
667
+ current: useStore().getters.somethingElse, // ← infinite loop / crash
668
+ },
669
+ })
670
+
671
+ // ✅ BIEN: useStore() solo dentro del callback (computed/function)
672
+ export const useStore = defineStore('x', {
673
+ state: { current: signal(null) },
674
+ getters: {
675
+ label: computed(() => useStore().state.current.value ?? 'anonymous'),
676
+ },
677
+ })
678
+ ```
679
+
680
+ 2. **Pattern alternativo más limpio**: declarar los signals fuera del defineStore
681
+ y referenciarlos directo. Evita el `useStore()` en absoluto:
682
+
683
+ ```typescript
684
+ // signals al top-level del módulo
685
+ const current = signal<UserDTO | null>(null)
686
+ const loading = signal(false)
687
+ const isLoggedIn = computed(() => current.value !== null)
688
+
689
+ export const useUserStore = defineStore('user', {
690
+ state: { current, loading },
691
+ getters: { isLoggedIn },
692
+ actions: {
693
+ async login(...) { loading.value = true; /* ... */ },
694
+ logout() { current.value = null },
695
+ },
696
+ })
697
+ ```
698
+
699
+ Esta forma es más TS-friendly (no requiere casts dentro de callbacks), más
700
+ testeable (los signals son inspeccionables sin invocar el store) y más legible.
701
+
653
702
  Uso en componente:
654
703
  ```typescript
655
704
  const userStore = useUserStore()