arckode-ui 0.2.1 → 0.2.3
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 +116 -0
- package/dist/cli/index.d.ts +16 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/compiler/analyzer.d.ts +11 -0
- package/dist/compiler/analyzer.d.ts.map +1 -0
- package/dist/compiler/parser.d.ts +21 -0
- package/dist/compiler/parser.d.ts.map +1 -0
- package/dist/compiler/template-compiler.d.ts +20 -0
- package/dist/compiler/template-compiler.d.ts.map +1 -0
- package/dist/compiler/vite-plugin.d.ts +14 -0
- package/dist/compiler/vite-plugin.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/router/router.d.ts +44 -0
- package/dist/router/router.d.ts.map +1 -0
- package/dist/runtime/define-component.d.ts +43 -0
- package/dist/runtime/define-component.d.ts.map +1 -0
- package/dist/runtime/h.d.ts +9 -0
- package/dist/runtime/h.d.ts.map +1 -0
- package/dist/runtime/renderer.d.ts +4 -0
- package/dist/runtime/renderer.d.ts.map +1 -0
- package/dist/runtime/signals.d.ts +16 -0
- package/dist/runtime/signals.d.ts.map +1 -0
- package/dist/services/create-service.d.ts +29 -0
- package/dist/services/create-service.d.ts.map +1 -0
- package/dist/store/define-store.d.ts +22 -0
- package/dist/store/define-store.d.ts.map +1 -0
- package/package.json +8 -6
- package/skills/SKILL.md +39 -13
- package/skills/components/SKILL.md +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
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.3] — 2026-05-23
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Skills**: eliminada ambigüedad en el patrón de store. El patrón DEFAULT es ahora
|
|
11
|
+
signals al top-level del módulo (más limpio, sin traps). `useStore()` dentro de
|
|
12
|
+
callbacks queda como fallback explícito solo para cross-store dependency.
|
|
13
|
+
- **Skills**: eliminada ambigüedad en comunicación hijo→padre. `emit + @event` es el
|
|
14
|
+
DEFAULT explícito. Callback como prop tiene criterio concreto: solo para primitivos
|
|
15
|
+
genéricos (Button, Input) sin semántica de negocio.
|
|
16
|
+
- Versión en `§14` del SKILL principal actualizada de `v0.1.1` a `v0.2.2`.
|
|
17
|
+
- Mismas correcciones aplicadas en `skills/SKILL.md` y `skills/components/SKILL.md`
|
|
18
|
+
(los sub-skills distribuidos con el paquete npm).
|
|
19
|
+
|
|
20
|
+
## [0.2.2] — 2026-05-23
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- **🔴 CRÍTICO**: el paquete ahora incluye archivos `.d.ts`. En `0.2.1` el `package.json`
|
|
24
|
+
declaraba `"types": "./dist/index.d.ts"` pero el archivo no existía — los consumidores
|
|
25
|
+
TypeScript recibían `any` en todos los imports. Se agregó `vite-plugin-dts` al build.
|
|
26
|
+
- `package.json.exports["./vite"].types` ahora apunta al path real
|
|
27
|
+
`./dist/compiler/vite-plugin.d.ts` (antes apuntaba a un archivo inexistente).
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- `.gitlab-ci.yml`: pipeline con stages `install → check → build`. Falla el push si:
|
|
31
|
+
tests rojos, type-check con errores, build no genera todos los artefactos, shebang del
|
|
32
|
+
CLI ausente o no ejecutable, examples con errores del analyzer.
|
|
33
|
+
- `tools/analyze-examples.ts`: corre el analyzer sobre todos los `.ark` de `examples/`
|
|
34
|
+
y falla con exit 1 si hay errores. Usado por CI.
|
|
35
|
+
- `CHANGELOG.md`: este archivo. Documenta cambios formalmente.
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- SKILL global + `skills/components/SKILL.md`: documentación explícita del trap del
|
|
39
|
+
store con `useStore()` auto-referencia y el patrón seguro alternativo (declarar el
|
|
40
|
+
useStore primero a nivel módulo y usarlo en getters/actions).
|
|
41
|
+
|
|
42
|
+
## [0.2.1] — 2026-05-22
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- `CLAUDE.md.example`: template que los consumidores copian a la raíz de su proyecto.
|
|
46
|
+
Activa el SKILL automáticamente para Claude Code / OpenCode / Cursor con un solo
|
|
47
|
+
comando: `cp node_modules/arckode-ui/CLAUDE.md.example ./CLAUDE.md`.
|
|
48
|
+
- `BENCHMARK.md`: resultados del test ciego de predictabilidad con Claude Sonnet.
|
|
49
|
+
10 prompts × 2 variantes. Resultado: Sin SKILL 30% / Con SKILL 100%.
|
|
50
|
+
- `tools/benchmark.ts` y `tools/prompts.ts`: script reproducible del benchmark
|
|
51
|
+
(requiere `ANTHROPIC_API_KEY`).
|
|
52
|
+
- `tools/README.md`: instrucciones de uso del benchmark.
|
|
53
|
+
- README con badge del benchmark y sección "Activar el SKILL para tu IA".
|
|
54
|
+
|
|
55
|
+
## [0.2.0] — 2026-05-22
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
- **PROTOCOLO OBLIGATORIO** en el SKILL principal con PASO 1 → 4
|
|
59
|
+
(identificar alcance → verificar reglas → generar → verificar resultado).
|
|
60
|
+
- **16 REGLAS INMUTABLES numeradas** (`REGLA #1` a `REGLA #16`), referenciables
|
|
61
|
+
desde los anti-patterns y el output del analyzer.
|
|
62
|
+
- **Árboles de decisión** "Si te piden X, hacé Y" para 7 escenarios típicos:
|
|
63
|
+
crear componente, agregar estado, comunicar componentes, renderizar lista,
|
|
64
|
+
hacer fetch, modificar componente, resolver error del analyzer.
|
|
65
|
+
- **Checklist post-código** con comandos exactos.
|
|
66
|
+
- 6 sub-skills temáticos en `skills/` distribuidos con el paquete npm:
|
|
67
|
+
`runtime`, `compiler`, `analyzer`, `cli`, `components`, `testing`.
|
|
68
|
+
- `CLAUDE.md` del repo reescrito con 10 REGLAS INMUTABLES para desarrolladores
|
|
69
|
+
del framework + protocolo de release de 5 pasos + checklist pre-release.
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- README actualizado para reflejar el nivel de predictabilidad apuntado.
|
|
73
|
+
|
|
74
|
+
## [0.1.1] — 2026-05-22
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
- **🔴 CRÍTICO**: `package.json.bin` corregido a `dist/cli.js` (sin `./`).
|
|
78
|
+
npm rechazaba silenciosamente el campo `bin` con prefix `./` y eliminaba la entry —
|
|
79
|
+
resultado: `npx arckode-ui ark` no funcionaba en `0.1.0`. Verificable con `npm pack`.
|
|
80
|
+
|
|
81
|
+
## [0.1.0] — 2026-05-22
|
|
82
|
+
|
|
83
|
+
### Added — initial release
|
|
84
|
+
|
|
85
|
+
- **Runtime**: `signal`, `computed`, `watch`, `effect`, `defineComponent`,
|
|
86
|
+
lifecycle hooks (`onMount`, `onUnmount`, `onUpdate`), `h`, `mount`, `mountComponent`.
|
|
87
|
+
- **APIs**: `defineStore` (estado global con persist), `createService` (HTTP wrapper
|
|
88
|
+
con timeout y type safety), router client-side (`createRouter`, `navigate`,
|
|
89
|
+
`useRoute`, `getCurrentPath`).
|
|
90
|
+
- **Compiler**: parser `.ark`, template-compiler con `v-if/v-else/v-else-if`, `v-for`,
|
|
91
|
+
`v-show`, `<slot />`, componentes PascalCase, modificadores de teclado, interpolación.
|
|
92
|
+
- **Vite plugin**: `arkcodeUi()` desde subpath `arckode-ui/vite`.
|
|
93
|
+
- **Analyzer estático**: 16 reglas detectando anti-patterns y violations estructurales,
|
|
94
|
+
cada una con campo `fix` que sugiere la corrección concreta. Bloquea builds de
|
|
95
|
+
producción si hay errors.
|
|
96
|
+
- **CLI**: `ark new`, `ark generate {component, page, store, service, layout}`,
|
|
97
|
+
`ark analyze`, `ark routes`.
|
|
98
|
+
- **Comunicación hijo→padre**: emit con `@event` handlers funcional (dispatch
|
|
99
|
+
como CustomEvent sin prefijo, wrapper del child registra listeners `onX`).
|
|
100
|
+
- 314 tests pasando.
|
|
101
|
+
- 2 ejemplos completos: `kitchen-sink` (demo de features) y `tasks` (app real
|
|
102
|
+
con sidebar, modal, form, validación, search con debounce).
|
|
103
|
+
|
|
104
|
+
### Known issues at release
|
|
105
|
+
- `package.json.bin` con sintaxis inválida que npm removía silenciosamente —
|
|
106
|
+
arreglado en `0.1.1`.
|
|
107
|
+
- TypeScript declarations no se generaban (`vite-plugin-dts` faltaba) —
|
|
108
|
+
arreglado en `0.2.2`.
|
|
109
|
+
|
|
110
|
+
[Unreleased]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.3...HEAD
|
|
111
|
+
[0.2.3]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.2...v0.2.3
|
|
112
|
+
[0.2.2]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.1...v0.2.2
|
|
113
|
+
[0.2.1]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.2.0...v0.2.1
|
|
114
|
+
[0.2.0]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.1.1...v0.2.0
|
|
115
|
+
[0.1.1]: https://gitlab.com/underworf/arckode-ui/-/compare/v0.1.0...v0.1.1
|
|
116
|
+
[0.1.0]: https://gitlab.com/underworf/arckode-ui/-/tags/v0.1.0
|
|
@@ -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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,MAAM,EAAE,CAAA;AAEnC,KAAK,UAAU,CAAC,CAAC,SAAS,YAAY,IAAI;KACvC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GACzC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAC3B,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS;CAC5C,CAAA;AAED,KAAK,aAAa,CAAC,CAAC,SAAS,QAAQ,IACnC,CAAC,SAAS,iBAAiB,GAAG,MAAM,GACpC,CAAC,SAAS,iBAAiB,GAAG,MAAM,GACpC,CAAC,SAAS,kBAA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AAC,CAAA;CACjC;AA2ED,wBAAgB,eAAe,CAC7B,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAwD5C;AAMD,KAAK,aAAa,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAM/C,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EAAE,EACtB,OAAO,EAAE,aAAa,EAAE,EACxB,MAAM,EAAE,aAAa,EAAE,GACtB,IAAI,CAIN;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAE/C;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAEjD;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAEhD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface VNode {
|
|
2
|
+
tag: string | object | null;
|
|
3
|
+
props: 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,MAAM,EACd,IAAI,EAAE,OAAO,EAC7B,OAAO,EAAE,MAAM;CAKlB;AAED,MAAM,WAAW,cAAc;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AAC,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,EAA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CAAC,EACzD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,IAC/C,MAAM,aAAa,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.
|
|
3
|
+
"version": "0.2.3",
|
|
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
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./vite": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"types": "./dist/compiler/vite-plugin.d.ts",
|
|
35
|
+
"import": "./dist/vite.js"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"skills",
|
|
46
46
|
"README.md",
|
|
47
47
|
"LICENSE",
|
|
48
|
-
"CLAUDE.md.example"
|
|
48
|
+
"CLAUDE.md.example",
|
|
49
|
+
"CHANGELOG.md"
|
|
49
50
|
],
|
|
50
51
|
"scripts": {
|
|
51
52
|
"build": "vite build && chmod +x dist/cli.js",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"happy-dom": "^20.9.0",
|
|
65
66
|
"typescript": "^5.4.0",
|
|
66
67
|
"vite": "^5.4.0",
|
|
68
|
+
"vite-plugin-dts": "^5.0.1",
|
|
67
69
|
"vitest": "^2.0.0"
|
|
68
70
|
}
|
|
69
71
|
}
|
package/skills/SKILL.md
CHANGED
|
@@ -625,32 +625,60 @@ export default defineComponent({
|
|
|
625
625
|
|
|
626
626
|
## 7. STORE — estado global compartido
|
|
627
627
|
|
|
628
|
+
### DEFAULT — signals declarados fuera del defineStore
|
|
629
|
+
|
|
630
|
+
Usar SIEMPRE este patrón. Los signals viven al top-level del módulo y se pasan al store.
|
|
631
|
+
Es TS-friendly, testeable, y no tiene traps de auto-referencia.
|
|
632
|
+
|
|
628
633
|
```typescript
|
|
629
634
|
// stores/user.store.ts
|
|
630
635
|
import { defineStore, signal, computed } from 'arckode-ui'
|
|
631
636
|
|
|
632
637
|
interface UserDTO { id: string; name: string }
|
|
633
638
|
|
|
639
|
+
// signals al top-level — accesibles directamente en getters/actions sin llamar useStore()
|
|
640
|
+
const current = signal<UserDTO | null>(null)
|
|
641
|
+
const loading = signal(false)
|
|
642
|
+
const isLoggedIn = computed(() => current.value !== null)
|
|
643
|
+
|
|
634
644
|
export const useUserStore = defineStore('user', {
|
|
635
|
-
state:
|
|
636
|
-
|
|
637
|
-
loading: signal(false),
|
|
638
|
-
},
|
|
639
|
-
getters: {
|
|
640
|
-
isLoggedIn: computed(() => useUserStore().state.current.value !== null),
|
|
641
|
-
},
|
|
645
|
+
state: { current, loading },
|
|
646
|
+
getters: { isLoggedIn },
|
|
642
647
|
actions: {
|
|
643
648
|
async login(email: string, password: string) {
|
|
644
|
-
|
|
645
|
-
store.state.loading.value = true
|
|
649
|
+
loading.value = true
|
|
646
650
|
// ...
|
|
647
651
|
},
|
|
648
|
-
logout() {
|
|
652
|
+
logout() { current.value = null },
|
|
649
653
|
},
|
|
650
654
|
})
|
|
651
655
|
```
|
|
652
656
|
|
|
653
|
-
|
|
657
|
+
### SI EL DEFAULT FALLA — `useStore()` dentro de getters/actions
|
|
658
|
+
|
|
659
|
+
Cuándo usarlo: cuando un getter/action necesita acceder al state de OTRO store
|
|
660
|
+
(cross-store dependency). Llamar `useOtroStore()` dentro del callback, nunca en la definición.
|
|
661
|
+
|
|
662
|
+
```typescript
|
|
663
|
+
// ✅ cross-store: OK dentro del callback
|
|
664
|
+
actions: {
|
|
665
|
+
syncWithCart() {
|
|
666
|
+
const cart = useCartStore() // ← dentro del callback, no en la definición
|
|
667
|
+
current.value = cart.state.owner.value
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
⚠ **NUNCA** llamar `useStore()` fuera de un callback (nivel raíz del objeto state/getters/actions).
|
|
673
|
+
```typescript
|
|
674
|
+
// ❌ MAL: useStore() en la definición del state — crash, registry vacío
|
|
675
|
+
export const useStore = defineStore('x', {
|
|
676
|
+
state: { ref: useStore().state.something },
|
|
677
|
+
})
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
### Uso en componente
|
|
681
|
+
|
|
654
682
|
```typescript
|
|
655
683
|
const userStore = useUserStore()
|
|
656
684
|
return {
|
|
@@ -660,8 +688,6 @@ return {
|
|
|
660
688
|
}
|
|
661
689
|
```
|
|
662
690
|
|
|
663
|
-
**Patrón clave:** dentro de getters/actions, llamar `useUserStore()` para acceder al state. Es feo pero es la API real verificada en tests.
|
|
664
|
-
|
|
665
691
|
---
|
|
666
692
|
|
|
667
693
|
## 8. SERVICE — HTTP
|
|
@@ -122,7 +122,8 @@ Detalles:
|
|
|
122
122
|
- El nombre del evento debe estar en `emits: []` (sino warning runtime)
|
|
123
123
|
- Eventos en kebab-case obligatorio
|
|
124
124
|
|
|
125
|
-
**
|
|
125
|
+
**SI EL DEFAULT FALLA — callback como prop:** usar solo cuando el hijo es un primitivo genérico
|
|
126
|
+
(Button, Input) que no tiene semántica de negocio y el padre necesita pasarle una función directamente.
|
|
126
127
|
```html
|
|
127
128
|
<TaskForm :onSubmit="actions.handleCreate" :onCancel="actions.closeModal" />
|
|
128
129
|
```
|