chispa 0.3.0 → 0.4.0

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/README.md CHANGED
@@ -1,14 +1,34 @@
1
- # chispa
1
+ # Chispa
2
2
 
3
- **Chispa** es un framework de interfaz de usuario (UI) totalmente declarativo y reactivo para construir aplicaciones web modernas. Se centra en la simplicidad, el rendimiento y una gestión del estado intuitiva mediante señales (signals).
3
+ Un motor UI reactivo y extremadamente minimalista.
4
+
5
+ Chispa no es un framework dogmático: es un motor ligero que expone reactividad mínima sobre DOM real, pensado para integrarse, incrustarse y usarse desde herramientas y entornos donde las capas pesadas sobran.
6
+
7
+ **Principio**: la función del componente se ejecuta una vez; el resto es flujo de datos (signals → DOM).
8
+
9
+ **¿Para quién es chispa?**
10
+
11
+ - Ideal para desarrolladores que necesitan control directo del DOM y baja complejidad mental.
12
+ - Perfecto para IDEs, plugins, paneles embebidos, dashboards y UIs que requieren integración con código legado.
13
+
14
+ **¿Para qué NO es chispa?**
15
+
16
+ - No pretende (de momento) sustituir un framework de aplicación completo (SSR complejo, abstracciones de estado a gran escala).
17
+
18
+ ## Diferenciadores
19
+
20
+ - **HTML real**: plantillas HTML importadas, sin JSX ni transformaciones mágicas.
21
+ - **JS/TS real**: funciones de componente normales (se ejecutan una vez) y señales explícitas.
22
+ - **Bindings directos signal → DOM**: actualizaciones precisas sin VDOM ni heurísticas.
23
+ - **Motor embebible**: sin lifecycle complejo ni arquitectura impuesta; fácil de integrar y depurar.
4
24
 
5
25
  ## Características
6
26
 
7
- - ⚡ **Reactividad Fina**: Basado en Signals para actualizaciones precisas y eficientes del DOM.
8
- - 🧩 **Componentes Funcionales**: Crea componentes reutilizables con funciones simples.
9
- - 📄 **Plantillas HTML**: Separa la lógica de la vista importando archivos HTML directamente.
10
- - 🛠️ **Integración con Vite**: Incluye un plugin de Vite para una experiencia de desarrollo fluida.
11
- - 📦 **Ligero**: Sin dependencias pesadas en tiempo de ejecución.
27
+ - ⚡ **Reactividad Fina**: Basado en Signals para actualizaciones precisas y eficientes del DOM.
28
+ - 🧩 **Componentes Funcionales**: Crea componentes reutilizables con funciones simples.
29
+ - 📄 **Plantillas HTML**: Separa la lógica de la vista importando archivos HTML directamente.
30
+ - 🛠️ **Integración con Vite**: Incluye un plugin de Vite para una experiencia de desarrollo fluida.
31
+ - 📦 **Ligero**: Sin dependencias pesadas en tiempo de ejecución.
12
32
 
13
33
  ## Instalación
14
34
 
@@ -87,7 +107,7 @@ appendChild(document.body, MyComponent());
87
107
 
88
108
  ### Reactividad
89
109
 
90
- - **`signal(initialValue)`**: Crea una señal reactiva.
110
+ - **`signal(initialValue)`**: Crea una señal reactiva.
91
111
 
92
112
  ```typescript
93
113
  const count = signal(0);
@@ -95,15 +115,15 @@ appendChild(document.body, MyComponent());
95
115
  count.set(5); // Establecer valor
96
116
  ```
97
117
 
98
- - **`computed(() => ...)`**: Crea una señal derivada que se actualiza automáticamente cuando sus dependencias cambian.
118
+ - **`computed(() => ...)`**: Crea una señal derivada que se actualiza automáticamente cuando sus dependencias cambian.
99
119
  ```typescript
100
120
  const double = computed(() => count.get() * 2);
101
121
  ```
102
122
 
103
123
  ### Componentes
104
124
 
105
- - **`component<Props>((props) => ...)`**: Define un nuevo componente.
106
- - **`appendChild(parent, child)`**: Función auxiliar para montar componentes en el DOM.
125
+ - **`component<Props>((props) => ...)`**: Define un nuevo componente.
126
+ - **`appendChild(parent, child)`**: Función auxiliar para montar componentes en el DOM.
107
127
 
108
128
  ## Licencia
109
129
 
package/dist/index.d.ts CHANGED
@@ -1,24 +1,55 @@
1
+ type ChispaReactive<T> = T | Signal<T> | (() => T);
2
+ type ChispaNode = string | number | Node | null;
3
+ type ChispaContent = ChispaNode | ChispaNode[] | Component | Component[] | ComponentList;
4
+ type ChispaContentReactive = ChispaReactive<ChispaContent>;
5
+ type ChispaClasses = Record<string, ChispaReactive<boolean>>;
6
+ type ChispaCSSPropertiesStrings = {
7
+ [K in keyof CSSStyleDeclaration]?: ChispaReactive<string>;
8
+ };
9
+ type AllowSignals<T> = {
10
+ [K in keyof T]: T[K] | Signal<T[K]>;
11
+ };
12
+ type ChispaNodeBuilderBaseProps<T> = AllowSignals<Omit<Partial<T>, 'style' | 'dataset'>>;
13
+ interface INodeBuilderAdditionalProps<T, TNodes> {
14
+ addClass?: string;
15
+ classes?: ChispaClasses;
16
+ nodes?: TNodes;
17
+ inner?: ChispaContentReactive;
18
+ style?: ChispaCSSPropertiesStrings;
19
+ dataset?: Record<string, string>;
20
+ _ref?: (node: T) => void | {
21
+ current: T | null;
22
+ };
23
+ }
24
+ type ChispaNodeBuilderProps<T, TNodes> = ChispaNodeBuilderBaseProps<T> & INodeBuilderAdditionalProps<T, TNodes>;
25
+ declare function getValidProps(props: any): any;
26
+ declare function getItem<T>(template: T, items: any, itemName: keyof T): any;
27
+ declare function setAttributes(node: Element, attributes: Record<string, string>): void;
28
+ declare function setProps<T extends Element>(node: T, props: any): void;
29
+ declare function appendChild(node: Element | DocumentFragment, child: ChispaContentReactive): void;
30
+
1
31
  type Dict = Record<string, any>;
2
- type ComponentFactory<TProps extends Dict> = (props: TProps) => Node | null;
32
+ type ComponentFactory<TProps extends Dict> = (props: TProps) => ChispaContent;
3
33
  declare class Component<TProps extends Dict = any> {
4
34
  private readonly factoryFn;
5
35
  readonly key: any;
6
36
  readonly props: TProps | null;
7
- onUnmount: (() => void) | null;
8
37
  nodes: Node[] | null;
9
38
  private container;
10
39
  private anchor;
11
- disposables: IDisposable[];
40
+ private disposables;
12
41
  silent: boolean;
13
42
  constructor(factoryFn: ComponentFactory<TProps>, key?: any, props?: TProps | null);
14
43
  mount(container: Node, anchor?: Node | null): void;
15
44
  reanchor(anchor: Node | null): void;
16
45
  private insertNodes;
46
+ addDisposable(disposable: IDisposable): void;
17
47
  unmount(): void;
18
48
  }
19
49
  declare function component(factory: ComponentFactory<any>): (props?: any) => Component;
20
50
  declare function component<TProps extends Dict>(factory: ComponentFactory<TProps>): (props: TProps) => Component<TProps>;
21
- type ItemFactoryFn<T, TProps = any> = (item: Signal<T>, index: Signal<number>, list: WritableSignal<T[]>, props?: TProps) => Node;
51
+ declare function onUnmount(unmountFn: () => void): void;
52
+ type ItemFactoryFn<T, TProps = any> = (item: Signal<T>, index: Signal<number>, list: WritableSignal<T[]>, props?: TProps) => ChispaContent;
22
53
  type KeyFn<T> = (item: T, index: number) => any;
23
54
  declare class ComponentList<TItem = any, TProps extends Dict = any> {
24
55
  private readonly itemFactoryFn;
@@ -53,6 +84,7 @@ declare class ComponentList<TItem = any, TProps extends Dict = any> {
53
84
  */
54
85
  private synchronizeComponents;
55
86
  mount(container: Node, anchor?: Node | null): void;
87
+ addDisposable(disposable: IDisposable): void;
56
88
  unmount(): void;
57
89
  }
58
90
  declare function componentList<TItem>(itemFactoryFn: ItemFactoryFn<TItem, any>, keyFn: KeyFn<TItem>): (listSignal: WritableSignal<TItem[]>, props?: any) => ComponentList<TItem>;
@@ -120,36 +152,6 @@ declare function isSignal(value: any): value is Signal<any>;
120
152
  declare function signal<T>(initialValue: T): WritableSignal<T>;
121
153
  declare function computed<T>(fn: () => T): Signal<T>;
122
154
 
123
- type ChispaReactive<T> = T | Signal<T> | (() => T);
124
- type ChispaNode = string | number | Node | null;
125
- type ChispaContent = ChispaNode | ChispaNode[] | Component | ComponentList;
126
- type ChispaContentReactive = ChispaReactive<ChispaContent>;
127
- type ChispaClasses = Record<string, ChispaReactive<boolean>>;
128
- type ChispaCSSPropertiesStrings = {
129
- [K in keyof CSSStyleDeclaration]?: ChispaReactive<string>;
130
- };
131
- type AllowSignals<T> = {
132
- [K in keyof T]: T[K] | Signal<T[K]>;
133
- };
134
- type ChispaNodeBuilderBaseProps<T> = AllowSignals<Omit<Partial<T>, 'style' | 'dataset'>>;
135
- interface INodeBuilderAdditionalProps<T, TNodes> {
136
- addClass?: string;
137
- classes?: ChispaClasses;
138
- nodes?: TNodes;
139
- inner?: ChispaContentReactive;
140
- style?: ChispaCSSPropertiesStrings;
141
- dataset?: Record<string, string>;
142
- _ref?: (node: T) => void | {
143
- current: T | null;
144
- };
145
- }
146
- type ChispaNodeBuilderProps<T, TNodes> = ChispaNodeBuilderBaseProps<T> & INodeBuilderAdditionalProps<T, TNodes>;
147
- declare function getValidProps(props: any): any;
148
- declare function getItem<T>(template: T, items: any, itemName: keyof T): any;
149
- declare function setAttributes(node: Element, attributes: Record<string, string>): void;
150
- declare function setProps<T extends Element>(node: T, props: any): void;
151
- declare function appendChild(node: Element | DocumentFragment, child: ChispaContentReactive): void;
152
-
153
155
  interface ControlledInputOptions {
154
156
  /**
155
157
  * Optional function to transform the value before setting it to the signal.
@@ -169,6 +171,7 @@ interface Route {
169
171
  component: (props?: any) => Component<any>;
170
172
  }
171
173
  declare function navigate(to: string, replace?: boolean): void;
174
+ declare function pathMatches(path: string): Signal<boolean>;
172
175
  declare const Router: (props: {
173
176
  routes: Route[];
174
177
  }) => Component<{
@@ -182,4 +185,4 @@ interface LinkProps {
182
185
  }
183
186
  declare const Link: (props: LinkProps) => Component<LinkProps>;
184
187
 
185
- export { type ChispaContent, type ChispaContentReactive, type ChispaNodeBuilderProps, Link, type LinkProps, type Route, Router, Signal, WritableSignal, appendChild, bindControlledInput, component, componentList, computed, getItem, getValidProps, globalContext, isSignal, navigate, setAttributes, setProps, signal };
188
+ export { type ChispaContent, type ChispaContentReactive, type ChispaNodeBuilderProps, Link, type LinkProps, type Route, Router, Signal, WritableSignal, appendChild, bindControlledInput, component, componentList, computed, getItem, getValidProps, globalContext, isSignal, navigate, onUnmount, pathMatches, setAttributes, setProps, signal };
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ var Reactivity = class {
76
76
  this.action = action;
77
77
  const currentComponent = globalContext.getCurrentComponent();
78
78
  if (currentComponent) {
79
- currentComponent.disposables.push(this);
79
+ currentComponent.addDisposable(this);
80
80
  } else {
81
81
  console.warn("Creating a Reactivity outside of a component");
82
82
  }
@@ -211,7 +211,6 @@ var Component = class {
211
211
  this.key = key;
212
212
  this.props = props;
213
213
  }
214
- onUnmount = null;
215
214
  nodes = null;
216
215
  container = null;
217
216
  anchor = null;
@@ -251,12 +250,11 @@ var Component = class {
251
250
  }
252
251
  }
253
252
  }
253
+ addDisposable(disposable) {
254
+ this.disposables.push(disposable);
255
+ }
254
256
  unmount() {
255
257
  if (!this.silent) console.log("Unmounting Component", this);
256
- if (this.onUnmount) {
257
- this.onUnmount();
258
- this.onUnmount = null;
259
- }
260
258
  if (this.nodes) {
261
259
  this.nodes.forEach((node) => {
262
260
  if (node && node.parentNode) {
@@ -278,6 +276,16 @@ function component(factory) {
278
276
  return new Component(factory, null, props);
279
277
  };
280
278
  }
279
+ function onUnmount(unmountFn) {
280
+ const currentComponent = globalContext.getCurrentComponent();
281
+ if (currentComponent) {
282
+ currentComponent.addDisposable({
283
+ dispose: unmountFn
284
+ });
285
+ } else {
286
+ throw new Error("onUnmount must be called within a component context");
287
+ }
288
+ }
281
289
  var ComponentList = class {
282
290
  constructor(itemFactoryFn, keyFn, itemsSignal, props = null) {
283
291
  this.itemFactoryFn = itemFactoryFn;
@@ -386,6 +394,9 @@ var ComponentList = class {
386
394
  });
387
395
  globalContext.popComponentStack();
388
396
  }
397
+ addDisposable(disposable) {
398
+ this.disposables.push(disposable);
399
+ }
389
400
  unmount() {
390
401
  this.clear();
391
402
  this.container = null;
@@ -532,6 +543,15 @@ function appendChild(node, child) {
532
543
  }
533
544
  node.appendChild(child instanceof Node ? child : document.createTextNode(child.toString()));
534
545
  }
546
+ function isStaticArrayOfComponents(arr) {
547
+ if (!Array.isArray(arr)) return false;
548
+ for (const item of arr) {
549
+ if (!(item instanceof Component)) {
550
+ return false;
551
+ }
552
+ }
553
+ return true;
554
+ }
535
555
  function processSignalChild(node, child) {
536
556
  const anchor = document.createTextNode("");
537
557
  node.appendChild(anchor);
@@ -546,7 +566,9 @@ function processSignalChild(node, child) {
546
566
  return;
547
567
  }
548
568
  let component2;
549
- if (ch instanceof Component || ch instanceof ComponentList) {
569
+ if (isStaticArrayOfComponents(ch)) {
570
+ throw new Error("Static array of components not supported in signal children. Use ComponentList instead.");
571
+ } else if (ch instanceof Component || ch instanceof ComponentList) {
550
572
  ch.mount(node, anchor);
551
573
  component2 = ch;
552
574
  } else {
@@ -632,6 +654,12 @@ function navigate(to, replace = false) {
632
654
  }
633
655
  currentPath.set(to);
634
656
  }
657
+ function pathMatches(path) {
658
+ return computed(() => {
659
+ const current = currentPath.get();
660
+ return match(path, current) !== null;
661
+ });
662
+ }
635
663
  function match(routePath, currentPath2) {
636
664
  if (routePath === "*") return {};
637
665
  const routeParts = routePath.split("/").filter(Boolean);
@@ -693,6 +721,8 @@ export {
693
721
  globalContext,
694
722
  isSignal,
695
723
  navigate,
724
+ onUnmount,
725
+ pathMatches,
696
726
  setAttributes,
697
727
  setProps,
698
728
  signal
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/context.ts","../src/signals.ts","../src/components.ts","../src/builder.ts","../src/controlled-input.ts","../src/router.ts"],"sourcesContent":["import { Component, ComponentList } from './components';\nimport { Signal } from './signals';\n\ntype ExecutionKind = 'createComponent' | 'computed' | 'addReactivity';\n\nexport interface IDisposable {\n\tdispose: () => void;\n}\n\nclass AppContext {\n\tprivate reactivityContextStack: Reactivity[] = [];\n\n\tprivate refreshTimeout: any = 0;\n\n\t//private contexts = new Set<RenderContext>();\n\n\tprivate dirtyReactivities = new Set<Reactivity>();\n\n\tprivate executionStack: ExecutionKind[] = [];\n\n\tprivate componentStack: (Component | ComponentList)[] = [];\n\n\tpushComponentStack(cmp: Component | ComponentList) {\n\t\tthis.componentStack.push(cmp);\n\t}\n\n\tpopComponentStack() {\n\t\tthis.componentStack.pop();\n\t}\n\n\tgetCurrentComponent() {\n\t\tif (this.componentStack.length === 0) {\n\t\t\t//console.warn('No current component');\n\t\t\treturn null;\n\t\t}\n\t\treturn this.componentStack[this.componentStack.length - 1];\n\t}\n\n\tsetCurrentReactivityContext(context: Reactivity) {\n\t\tthis.reactivityContextStack.push(context);\n\t\t//this.contexts.add(context);\n\t}\n\n\trestorePreviousReactivityContext() {\n\t\tthis.reactivityContextStack.pop();\n\t}\n\n\tgetCurrentRenderContext() {\n\t\tif (this.reactivityContextStack.length === 0) {\n\t\t\t//console.warn('No current render context');\n\t\t\treturn null;\n\t\t}\n\t\treturn this.reactivityContextStack[this.reactivityContextStack.length - 1];\n\t}\n\n\tscheduleRefresh() {\n\t\tif (this.refreshTimeout) {\n\t\t\tclearTimeout(this.refreshTimeout);\n\t\t}\n\t\tthis.refreshTimeout = setTimeout(() => {\n\t\t\tconst dirtyContexts = Array.from(this.dirtyReactivities);\n\t\t\tdirtyContexts.forEach((ctx) => ctx.process());\n\t\t}, 0);\n\t}\n\n\taddReactivity(executor: () => void) {\n\t\tconst ctx = new Reactivity(executor);\n\t\tglobalContext.pushExecutionStack('addReactivity');\n\t\tctx.exec();\n\t\tglobalContext.popExecutionStack();\n\t\treturn ctx;\n\t}\n\n\tcreateRoot(component: () => Component, mountPoint: HTMLElement) {\n\t\tthis.dirtyReactivities.clear();\n\t\tmountPoint.innerHTML = '';\n\t\tconst cmp = component();\n\t\tcmp.mount(mountPoint, null);\n\t}\n\n\tcanReadSignal() {\n\t\tconst length = this.executionStack.length;\n\t\tif (length === 0) return true;\n\t\tconst current = this.executionStack[length - 1];\n\t\treturn current !== 'createComponent';\n\t}\n\n\tpushExecutionStack(type: ExecutionKind) {\n\t\tthis.executionStack.push(type);\n\t}\n\n\tpopExecutionStack() {\n\t\tthis.executionStack.pop();\n\t}\n\n\taddDirtyContext(ctx: Reactivity) {\n\t\tthis.dirtyReactivities.add(ctx);\n\t}\n\n\tremoveDirtyContext(ctx: Reactivity) {\n\t\tthis.dirtyReactivities.delete(ctx);\n\t}\n}\n\nexport class Reactivity implements IDisposable {\n\tprivate dirty: boolean = false;\n\n\tprivate signals = new Set<Signal<any>>();\n\n\tconstructor(private readonly action: () => void) {\n\t\tconst currentComponent = globalContext.getCurrentComponent();\n\t\tif (currentComponent) {\n\t\t\tcurrentComponent.disposables.push(this);\n\t\t} else {\n\t\t\tconsole.warn('Creating a Reactivity outside of a component');\n\t\t}\n\t}\n\n\tmarkDirty() {\n\t\t// Mark the context as dirty (needing re-render)\n\t\t//console.log('marking context as dirty');\n\t\tthis.dirty = true;\n\t\tglobalContext.addDirtyContext(this);\n\t\tglobalContext.scheduleRefresh();\n\t}\n\n\taddSignal(signal: Signal<any>) {\n\t\tthis.signals.add(signal);\n\t}\n\n\tremoveSignal(signal: Signal<any>) {\n\t\tthis.signals.delete(signal);\n\t}\n\n\tprocess() {\n\t\tif (!this.dirty) return;\n\t\tthis.exec();\n\t\t//console.log('re-render cycle completed');\n\t\tthis.dirty = false;\n\t\tglobalContext.removeDirtyContext(this);\n\t}\n\n\texec() {\n\t\tthis.signals.forEach((s) => s.removeContext(this));\n\t\tthis.signals.clear();\n\t\tglobalContext.setCurrentReactivityContext(this);\n\t\tthis.action();\n\t\tglobalContext.restorePreviousReactivityContext();\n\t}\n\n\tdispose() {\n\t\tthis.signals.forEach((s) => s.removeContext(this));\n\t\tthis.signals.clear();\n\t\tthis.dirty = false;\n\t\tglobalContext.removeDirtyContext(this);\n\t}\n}\n\nexport const globalContext = new AppContext();\n","import { globalContext, Reactivity } from './context';\n\ntype WithSignals<T> = { [K in keyof T]: Signal<T[K]> };\n\nabstract class Signal<T> {\n\tprotected abstract value: T;\n\n\tprotected contexts: Set<Reactivity> = new Set();\n\n\tconstructor() {}\n\n\tget() {\n\t\tif (!globalContext.canReadSignal()) {\n\t\t\tthrow new Error('Cannot read a signal value during component creation. Did you mean to use a computed signal instead?');\n\t\t}\n\t\t//context.current.register(this);\n\t\tconst ctx = globalContext.getCurrentRenderContext();\n\t\tif (ctx) {\n\t\t\tthis.contexts.add(ctx);\n\t\t\tctx.addSignal(this);\n\t\t}\n\t\treturn this.value;\n\t}\n\n\tpublic readonly computed = new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, prop) => {\n\t\t\t\treturn computed(() => this.get()[prop as keyof T]);\n\t\t\t},\n\t\t}\n\t) as WithSignals<T>;\n\n\tremoveContext(ctx: Reactivity) {\n\t\tthis.contexts.delete(ctx);\n\t}\n\n\tdispose() {\n\t\tconsole.log('disposing signal', this);\n\t\tthis.contexts.forEach((ctx) => {\n\t\t\tctx.removeSignal(this);\n\t\t});\n\t\tthis.contexts.clear();\n\t}\n}\n\nclass WritableSignal<T> extends Signal<T> {\n\tprotected override value: T;\n\n\tpublic readonly initialValue: T;\n\n\tconstructor(initialValue: T) {\n\t\tsuper();\n\t\tthis.initialValue = initialValue;\n\t\tthis.value = initialValue;\n\t}\n\n\tset(newValue: T) {\n\t\tthis.value = newValue;\n\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t}\n\n\tupdate(updater: (value: T) => T) {\n\t\tthis.value = updater(this.value);\n\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t}\n}\n\nclass ComputedSignal<T> extends Signal<T> {\n\tprotected override value: T;\n\n\tprivate computeFn: () => T;\n\n\tconstructor(computeFn: () => T) {\n\t\tsuper();\n\t\tglobalContext.pushExecutionStack('computed');\n\t\tthis.value = computeFn();\n\t\tglobalContext.popExecutionStack();\n\t\tthis.computeFn = computeFn;\n\t}\n\n\trecompute() {\n\t\tconst newValue = this.computeFn();\n\t\tif (newValue !== this.value) {\n\t\t\tthis.value = newValue;\n\t\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t\t}\n\t}\n}\n\nexport function isSignal(value: any): value is Signal<any> {\n\treturn value instanceof Signal;\n}\n\nexport function signal<T>(initialValue: T) {\n\tconst sig = new WritableSignal(initialValue);\n\n\t// // Creamos una función que se usará como callable\n\t// const fn = (() => sig.get()) as any;\n\n\t// // Copiamos todas las propiedades y métodos de la instancia a la función\n\t// Object.setPrototypeOf(fn, sig.constructor.prototype);\n\n\t// // Copiamos las propiedades de instancia\n\t// Object.assign(fn, this);\n\n\t// // Retornamos la función como si fuera la instancia\n\t// return fn as WritableSignal<T> & (() => T);\n\n\treturn sig;\n}\n\nexport function computed<T>(fn: () => T) {\n\tlet sig: ComputedSignal<T>;\n\tconst ctx = new Reactivity(() => {\n\t\tsig.recompute();\n\t});\n\tglobalContext.setCurrentReactivityContext(ctx);\n\tsig = new ComputedSignal(fn);\n\tglobalContext.restorePreviousReactivityContext();\n\n\treturn sig as Signal<T>;\n}\n\nexport type { Signal, WritableSignal };\n","import { globalContext, IDisposable } from './context';\nimport { computed, Signal, WritableSignal } from './signals';\n\nexport type Dict = Record<string, any>;\nexport type ComponentFactory<TProps extends Dict> = (props: TProps) => Node | null;\n\nexport class Component<TProps extends Dict = any> {\n\tpublic onUnmount: (() => void) | null = null;\n\n\tpublic nodes: Node[] | null = null;\n\n\tprivate container: Node | null = null;\n\n\tprivate anchor: Node | null = null;\n\n\tpublic disposables: IDisposable[] = [];\n\n\tpublic silent = true;\n\n\tconstructor(\n\t\tprivate readonly factoryFn: ComponentFactory<TProps>,\n\t\tpublic readonly key: any = null,\n\t\tpublic readonly props: TProps | null = null\n\t) {}\n\n\tmount(container: Node, anchor: Node | null = null) {\n\t\tif (!this.silent) console.log('Mounting Component', this);\n\n\t\tthis.container = container;\n\t\tthis.anchor = anchor;\n\t\tglobalContext.pushExecutionStack('createComponent');\n\t\tglobalContext.pushComponentStack(this);\n\t\tconst node = this.factoryFn ? (this.factoryFn as any)(this.props) : null;\n\t\tglobalContext.popComponentStack();\n\t\tglobalContext.popExecutionStack();\n\t\t// if node is fragment, convert to array of nodes\n\t\tif (node) {\n\t\t\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\t\t\tthis.nodes = Array.from(node.childNodes);\n\t\t\t} else {\n\t\t\t\tthis.nodes = [node];\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodes = null;\n\t\t}\n\t\tthis.insertNodes();\n\t}\n\n\treanchor(anchor: Node | null) {\n\t\tthis.anchor = anchor;\n\n\t\t//console.log('reanchoring', this.nodes, ' before anchor', this.anchor);\n\t\tthis.insertNodes();\n\t}\n\n\tprivate insertNodes() {\n\t\tif (!this.container || !this.nodes) return;\n\t\t// Insertar en la nueva posición\n\t\tfor (const node of this.nodes) {\n\t\t\tif (this.anchor) {\n\t\t\t\tthis.container.insertBefore(node, this.anchor);\n\t\t\t} else {\n\t\t\t\tthis.container.appendChild(node);\n\t\t\t}\n\t\t}\n\t}\n\n\tunmount() {\n\t\tif (!this.silent) console.log('Unmounting Component', this);\n\t\tif (this.onUnmount) {\n\t\t\tthis.onUnmount();\n\t\t\tthis.onUnmount = null;\n\t\t}\n\t\tif (this.nodes) {\n\t\t\tthis.nodes.forEach((node) => {\n\t\t\t\tif (node && node.parentNode) {\n\t\t\t\t\tnode.parentNode.removeChild(node);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tthis.disposables.forEach((d) => {\n\t\t\td.dispose();\n\t\t});\n\t\tthis.disposables = [];\n\t\tthis.nodes = null;\n\t\tthis.container = null;\n\t\tthis.anchor = null;\n\t}\n}\n\n// Definimos overloads para component\nexport function component(factory: ComponentFactory<any>): (props?: any) => Component;\nexport function component<TProps extends Dict>(factory: ComponentFactory<TProps>): (props: TProps) => Component<TProps>;\n\nexport function component<TProps extends Dict = any>(factory: ComponentFactory<TProps>) {\n\treturn (props?: TProps) => {\n\t\treturn new Component(factory, null, props);\n\t};\n}\n\ntype ItemFactoryFn<T, TProps = any> = (item: Signal<T>, index: Signal<number>, list: WritableSignal<T[]>, props?: TProps) => Node;\ntype KeyFn<T> = (item: T, index: number) => any;\n\nexport class ComponentList<TItem = any, TProps extends Dict = any> {\n\tprivate readonly components: Map<string, Component<TProps>>;\n\tprivate container: Node | null = null; // Contenedor donde se montan los nodos\n\tprivate anchor: Node | null = null; // Nodes must be inserted before this node\n\tprivate currentKeys: any[] = [];\n\tpublic disposables: any[] = [];\n\n\tconstructor(\n\t\tprivate readonly itemFactoryFn: ItemFactoryFn<TItem, TProps>,\n\t\tprivate readonly keyFn: KeyFn<TItem>,\n\t\tprivate readonly itemsSignal: WritableSignal<TItem[]>,\n\t\tprivate readonly props: TProps | null = null\n\t) {\n\t\tthis.components = new Map();\n\t}\n\n\t/**\n\t * Obtiene todos los componentes\n\t */\n\tprivate getAllComponents(): Component[] {\n\t\treturn Array.from(this.components.values());\n\t}\n\n\t/**\n\t * Limpia todos los componentes\n\t */\n\tprivate clear(): void {\n\t\tArray.from(this.components.values()).forEach((component) => {\n\t\t\tthis.removeComponent(component);\n\t\t});\n\t}\n\n\t/**\n\t * Elimina un componente completo\n\t */\n\tprivate removeComponent(component: Component) {\n\t\tcomponent.unmount();\n\t\tif (component.key) {\n\t\t\tthis.components.delete(component.key);\n\t\t}\n\t}\n\n\t/**\n\t * Crea un nuevo componente\n\t */\n\tprivate createNewComponent(key: any): Component {\n\t\tconst factory = (props?: TProps) => {\n\t\t\tconst item = computed(() => this.itemsSignal.get().find((v, index) => this.keyFn(v, index) === key)!);\n\t\t\tconst index = computed(() => this.itemsSignal.get().findIndex((v, index) => this.keyFn(v, index) === key));\n\t\t\treturn this.itemFactoryFn ? this.itemFactoryFn(item, index, this.itemsSignal, props) : null;\n\t\t};\n\n\t\tconst component = new Component(factory, key, this.props);\n\t\tthis.components.set(key, component);\n\n\t\treturn component;\n\t}\n\n\tprivate getTargetAnchor(items: TItem[], index: number): Node | null {\n\t\tconst nextItem = index + 1 < items.length ? items[index + 1] : null;\n\t\tconst nextComp = nextItem ? this.components.get(this.keyFn(nextItem, index + 1)) : null;\n\t\tif (nextComp && nextComp.nodes) {\n\t\t\treturn nextComp.nodes[0];\n\t\t} else {\n\t\t\t// Es el último componente, debería insertarse antes del anchor original\n\t\t\treturn this.anchor;\n\t\t}\n\t}\n\n\t/**\n\t * Función principal que sincroniza los componentes DOM con un array de keys\n\t */\n\tprivate synchronizeComponents(): void {\n\t\tconst existingComponents = this.getAllComponents();\n\n\t\t// Identificar qué componentes eliminar (los que no están en keys)\n\t\tconst items = this.itemsSignal.get();\n\t\tconst keys = items.map((item, index) => this.keyFn(item, index));\n\t\tconst componentsToRemove = existingComponents.filter((component) => component.key && !keys.includes(component.key));\n\t\tcomponentsToRemove.forEach((component) => this.removeComponent(component));\n\n\t\tthis.currentKeys = this.currentKeys.filter((key) => keys.includes(key));\n\t\t//console.log('Current keys:', this.currentKeys, 'Target keys:', keys);\n\n\t\tif (!this.container) {\n\t\t\tconsole.warn('Container is null in synchronizeComponents');\n\t\t\treturn;\n\t\t}\n\t\t// Procesar cada key en el orden deseado\n\t\tconst container = this.container;\n\n\t\titems.forEach((item, index) => {\n\t\t\tconst targetKey = this.keyFn(item, index);\n\t\t\tconst currentKey = this.currentKeys[index];\n\t\t\tif (targetKey === currentKey) {\n\t\t\t\t// La key no ha cambiado de posición, no hacer nada\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst existingComponent = this.components.get(targetKey);\n\n\t\t\tif (existingComponent) {\n\t\t\t\tconst prevComp = this.components.get(currentKey);\n\t\t\t\tif (!prevComp || !prevComp.nodes) {\n\t\t\t\t\tconsole.warn('Previous component or its nodes not found for key', currentKey);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\texistingComponent.reanchor(prevComp.nodes[0]);\n\t\t\t\t// Reordenar el array de keys actuales\n\t\t\t\tthis.currentKeys = this.currentKeys.filter((k) => k !== targetKey);\n\t\t\t\tthis.currentKeys.splice(index, 0, targetKey);\n\t\t\t} else {\n\t\t\t\t// El componente no existe, crearlo\n\t\t\t\tconst targetAnchor = this.getTargetAnchor(items, index);\n\t\t\t\tconst newComponent = this.createNewComponent(targetKey);\n\t\t\t\tnewComponent.mount(container, targetAnchor);\n\t\t\t\tthis.currentKeys.splice(index, 0, targetKey);\n\t\t\t}\n\t\t});\n\t}\n\n\tmount(container: Node, anchor: Node | null = null) {\n\t\t//console.log('Mounting ComponentList');\n\t\tthis.container = container;\n\t\tthis.anchor = anchor;\n\n\t\tglobalContext.pushComponentStack(this);\n\t\tglobalContext.addReactivity(() => {\n\t\t\tthis.synchronizeComponents();\n\t\t});\n\t\tglobalContext.popComponentStack();\n\t}\n\n\tunmount() {\n\t\t//console.log('Unmounting ComponentList');\n\t\tthis.clear();\n\t\tthis.container = null!;\n\t\tthis.anchor = null!;\n\t\tthis.disposables.forEach((d) => {\n\t\t\td.dispose();\n\t\t});\n\t}\n}\n\n// Definimos overloads para componentList\nexport function componentList<TItem>(\n\titemFactoryFn: ItemFactoryFn<TItem, any>,\n\tkeyFn: KeyFn<TItem>\n): (listSignal: WritableSignal<TItem[]>, props?: any) => ComponentList<TItem>;\nexport function componentList<TItem, TProps extends Dict>(\n\titemFactoryFn: ItemFactoryFn<TItem, TProps>,\n\tkeyFn: KeyFn<TItem>\n): (listSignal: WritableSignal<TItem[]>, props: TProps) => ComponentList<TItem, TProps>;\n\nexport function componentList<TItem, TProps extends Dict = any>(itemFactoryFn: ItemFactoryFn<TItem, TProps>, keyFn: KeyFn<TItem>) {\n\treturn (listSignal: WritableSignal<TItem[]>, props?: TProps) => {\n\t\tconst list = new ComponentList(itemFactoryFn, keyFn, listSignal, props);\n\t\treturn list;\n\t};\n}\n","import { Component, ComponentList } from './components';\nimport { globalContext } from './context';\nimport { computed, isSignal, type Signal } from './signals';\n\nexport type ChispaReactive<T> = T | Signal<T> | (() => T);\nexport type ChispaNode = string | number | Node | null;\nexport type ChispaContent = ChispaNode | ChispaNode[] | Component | ComponentList;\nexport type ChispaContentReactive = ChispaReactive<ChispaContent>;\nexport type ChispaClasses = Record<string, ChispaReactive<boolean>>;\nexport type ChispaCSSPropertiesStrings = {\n\t[K in keyof CSSStyleDeclaration]?: ChispaReactive<string>;\n};\n\ntype AllowSignals<T> = { [K in keyof T]: T[K] | Signal<T[K]> };\n\ntype ChispaNodeBuilderBaseProps<T> = AllowSignals<Omit<Partial<T>, 'style' | 'dataset'>>;\ninterface INodeBuilderAdditionalProps<T, TNodes> {\n\taddClass?: string;\n\tclasses?: ChispaClasses;\n\tnodes?: TNodes;\n\tinner?: ChispaContentReactive;\n\tstyle?: ChispaCSSPropertiesStrings;\n\tdataset?: Record<string, string>;\n\t_ref?: (node: T) => void | { current: T | null };\n}\nexport type ChispaNodeBuilderProps<T, TNodes> = ChispaNodeBuilderBaseProps<T> & INodeBuilderAdditionalProps<T, TNodes>;\n\nconst forbiddenProps = ['addClass', 'nodes', 'inner', '_ref'];\n\nexport function getValidProps(props: any) {\n\tconst finalProps: any = {};\n\n\tfor (const propName in props) {\n\t\tif (forbiddenProps.indexOf(propName) === -1) {\n\t\t\tfinalProps[propName] = props[propName];\n\t\t}\n\t}\n\n\tif (props._ref !== undefined) {\n\t\t//finalProps.ref = props._ref;\n\t}\n\n\treturn finalProps;\n}\n\nexport function getItem<T>(template: T, items: any, itemName: keyof T) {\n\tif (!items || !items[itemName]) {\n\t\treturn null;\n\t}\n\n\tconst item = items[itemName];\n\n\tif (item.constructor && item.constructor.name === 'Object' && !(item instanceof Element)) {\n\t\tconst Comp = template[itemName] as (props: any) => Element;\n\t\tconst itemProps = item;\n\n\t\treturn Comp(itemProps);\n\t} else {\n\t\treturn item;\n\t}\n}\n\nexport function setAttributes(node: Element, attributes: Record<string, string>) {\n\tfor (const attr in attributes) {\n\t\tconst attrValue = attributes[attr].trim();\n\t\tif (!attrValue) continue;\n\t\t//console.log('setting attr', attr, attrValue )\n\t\tnode.setAttribute(attr, attrValue);\n\t}\n}\n\nexport function setProps<T extends Element>(node: T, props: any) {\n\tif (node instanceof HTMLElement) {\n\t\tif (props.style !== undefined) {\n\t\t\tconst style = props.style;\n\t\t\tfor (const styleKey in style) {\n\t\t\t\tif (typeof style[styleKey] === 'function') {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.style[styleKey as any] = style[styleKey]();\n\t\t\t\t\t});\n\t\t\t\t} else if (isSignal(style[styleKey])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.style[styleKey as any] = style[styleKey].get();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tnode.style[styleKey as any] = style[styleKey];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.style;\n\t\t}\n\n\t\tif (props.classes !== undefined) {\n\t\t\tconst classes = props.classes;\n\t\t\tfor (const className in classes) {\n\t\t\t\tif (typeof classes[className] === 'function') {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tif (classes[className]()) {\n\t\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else if (isSignal(classes[className])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tif (classes[className].get()) {\n\t\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tif (classes[className]) {\n\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.classes;\n\t\t}\n\n\t\tif (props.dataset !== undefined) {\n\t\t\tconst dataset = props.dataset;\n\t\t\tfor (const datasetKey in dataset) {\n\t\t\t\tif (isSignal(dataset[datasetKey])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.dataset[datasetKey] = dataset[datasetKey].get();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tnode.dataset[datasetKey] = dataset[datasetKey];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.dataset;\n\t\t}\n\t}\n\n\tfor (const prop in props) {\n\t\tconst propValue = props[prop];\n\t\t//console.log('setting prop', prop, propValue )\n\t\tif (isSignal(propValue)) {\n\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t(node as any)[prop] = propValue.get();\n\t\t\t});\n\t\t} else if (propValue === undefined) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\t(node as any)[prop] = propValue;\n\t\t}\n\t}\n}\n\nexport function appendChild(node: Element | DocumentFragment, child: ChispaContentReactive) {\n\tif (child === null) return;\n\tif (typeof child === 'function') {\n\t\tprocessSignalChild(node, computed(child));\n\t\treturn;\n\t}\n\tif (isSignal(child)) {\n\t\tprocessSignalChild(node, child);\n\t\treturn;\n\t}\n\tif (child instanceof Component || child instanceof ComponentList) {\n\t\tchild.mount(node, null);\n\t\treturn;\n\t}\n\tif (Array.isArray(child)) {\n\t\tchild.forEach((ch) => {\n\t\t\tappendChild(node, ch);\n\t\t});\n\t\treturn;\n\t}\n\tnode.appendChild(child instanceof Node ? child : document.createTextNode(child.toString()));\n}\n\nfunction processSignalChild(node: Element | DocumentFragment, child: Signal<ChispaNode | Component<any> | ComponentList<any> | ChispaNode[]>) {\n\tconst anchor = document.createTextNode('');\n\tnode.appendChild(anchor);\n\tlet prevValue: Component | ComponentList | null = null;\n\n\tglobalContext.addReactivity(() => {\n\t\t//console.log('Signal child changed', child);\n\t\tconst ch = child.get();\n\t\tif (prevValue) {\n\t\t\tprevValue.unmount();\n\t\t}\n\t\tif (ch === null) {\n\t\t\tprevValue = null;\n\t\t\treturn;\n\t\t}\n\n\t\tlet component: Component | ComponentList;\n\t\tif (ch instanceof Component || ch instanceof ComponentList) {\n\t\t\tch.mount(node, anchor);\n\t\t\tcomponent = ch;\n\t\t} else {\n\t\t\tconst wrCmp = new Component(() => toNode(ch));\n\t\t\t//wrCmp.silent = true;\n\t\t\twrCmp.mount(node, anchor);\n\t\t\tcomponent = wrCmp;\n\t\t}\n\t\tprevValue = component;\n\t});\n}\n\nfunction toNode(n: ChispaNode | ChispaNode[]): Node | null {\n\tif (Array.isArray(n)) {\n\t\tconst frag = document.createDocumentFragment();\n\t\tconst nodes = n.map((c) => toNode(c)).filter((n) => n !== null);\n\t\tfrag.append(...nodes);\n\t\treturn frag;\n\t} else if (n instanceof Node) {\n\t\treturn n;\n\t} else if (typeof n === 'string' || typeof n === 'number') {\n\t\treturn document.createTextNode(n.toString());\n\t} else {\n\t\treturn null;\n\t\t//throw new Error('Invalid node type');\n\t}\n}\n","import { globalContext } from './context';\nimport { WritableSignal } from './signals';\n\nexport interface ControlledInputOptions {\n\t/**\n\t * Optional function to transform the value before setting it to the signal.\n\t * Useful for enforcing uppercase, removing invalid characters, etc.\n\t */\n\ttransform?: (value: string) => string;\n\n\t/**\n\t * Optional function to validate the value.\n\t * If it returns false, the change is rejected and the previous value is restored.\n\t */\n\tvalidate?: (value: string) => boolean;\n}\n\nexport function bindControlledInput(element: HTMLInputElement | HTMLTextAreaElement, signal: WritableSignal<string>, options: ControlledInputOptions = {}) {\n\tconst { transform, validate } = options;\n\n\t// Initialize value\n\telement.value = signal.initialValue;\n\n\t// Handle input events\n\tconst handleInput = (e: Event) => {\n\t\tconst target = e.target as HTMLInputElement;\n\t\tlet newValue = target.value;\n\t\tconst originalValue = signal.get();\n\n\t\t// Save cursor position\n\t\tconst selectionStart = target.selectionStart;\n\t\tconst selectionEnd = target.selectionEnd;\n\n\t\t// Apply transformation if provided\n\t\tif (transform) {\n\t\t\tnewValue = transform(newValue);\n\t\t}\n\n\t\t// Apply validation if provided\n\t\tif (validate && !validate(newValue)) {\n\t\t\t// If invalid, revert to original value\n\t\t\tnewValue = originalValue;\n\t\t}\n\n\t\t// Update signal\n\t\tif (newValue !== originalValue) {\n\t\t\tsignal.set(newValue);\n\t\t}\n\n\t\t// Force update DOM if it doesn't match the new value (e.g. transformed or rejected)\n\t\tif (target.value !== newValue) {\n\t\t\tconst lengthDiff = target.value.length - newValue.length;\n\t\t\ttarget.value = newValue;\n\n\t\t\t// Restore cursor\n\t\t\tif (selectionStart !== null && selectionEnd !== null) {\n\t\t\t\t// Restore to the saved position.\n\t\t\t\t// Adjust for length difference to keep cursor relative to the content\n\t\t\t\tconst newStart = Math.max(0, selectionStart - lengthDiff);\n\t\t\t\tconst newEnd = Math.max(0, selectionEnd - lengthDiff);\n\t\t\t\ttarget.setSelectionRange(newStart, newEnd);\n\t\t\t}\n\t\t}\n\t};\n\n\telement.addEventListener('input', handleInput);\n\n\t// Subscribe to signal changes to update the input if it changes externally\n\tglobalContext.addReactivity(() => {\n\t\tconst newValue = signal.get();\n\t\t// Only update if the value is actually different to avoid cursor jumping\n\t\tif (element.value !== newValue) {\n\t\t\telement.value = newValue;\n\t\t}\n\t});\n\n\t// Return a cleanup function\n\treturn () => {\n\t\telement.removeEventListener('input', handleInput);\n\t};\n}\n","import { signal, computed, Signal } from './signals';\nimport { component, Component, Dict } from './components';\nimport { appendChild, setProps } from './builder';\n\nexport interface Route {\n\tpath: string;\n\tcomponent: (props?: any) => Component<any>;\n}\n\nconst currentPath = signal(typeof window !== 'undefined' ? window.location.pathname : '/');\n\nif (typeof window !== 'undefined') {\n\twindow.addEventListener('popstate', () => {\n\t\tcurrentPath.set(window.location.pathname);\n\t});\n}\n\nexport function navigate(to: string, replace = false) {\n\tif (typeof window === 'undefined') {\n\t\tcurrentPath.set(to);\n\t\treturn;\n\t}\n\tif (replace) {\n\t\twindow.history.replaceState({}, '', to);\n\t} else {\n\t\twindow.history.pushState({}, '', to);\n\t}\n\tcurrentPath.set(to);\n}\n\nfunction match(routePath: string, currentPath: string): Dict | null {\n\tif (routePath === '*') return {};\n\tconst routeParts = routePath.split('/').filter(Boolean);\n\tconst currentParts = currentPath.split('/').filter(Boolean);\n\tif (routeParts.length !== currentParts.length) return null;\n\tconst params: Dict = {};\n\tfor (let i = 0; i < routeParts.length; i++) {\n\t\tif (routeParts[i].startsWith(':')) {\n\t\t\tparams[routeParts[i].substring(1)] = currentParts[i];\n\t\t} else if (routeParts[i] !== currentParts[i]) {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn params;\n}\n\nexport const Router = component<{ routes: Route[] }>((props) => {\n\tconst container = document.createElement('div');\n\tcontainer.style.display = 'contents';\n\tconst activeRoute = computed(() => {\n\t\tconst path = currentPath.get();\n\t\tfor (const route of props.routes) {\n\t\t\tconst params = match(route.path, path);\n\t\t\tif (params) {\n\t\t\t\treturn route.component(params);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t});\n\tappendChild(container, activeRoute);\n\treturn container;\n});\n\nexport interface LinkProps {\n\tto: string;\n\tclass?: string | Signal<string> | (() => string);\n\tinner?: any;\n\t[key: string]: any;\n}\n\nexport const Link = component<LinkProps>((props) => {\n\tconst { to, inner, ...rest } = props;\n\tconst a = document.createElement('a');\n\ta.href = to;\n\n\ta.addEventListener('click', (e) => {\n\t\tif (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.defaultPrevented || e.button !== 0) {\n\t\t\treturn;\n\t\t}\n\t\te.preventDefault();\n\t\tnavigate(to);\n\t});\n\n\tif (inner) {\n\t\tappendChild(a, inner);\n\t}\n\n\tsetProps(a, rest);\n\n\treturn a;\n});\n"],"mappings":";AASA,IAAM,aAAN,MAAiB;AAAA,EACR,yBAAuC,CAAC;AAAA,EAExC,iBAAsB;AAAA;AAAA,EAItB,oBAAoB,oBAAI,IAAgB;AAAA,EAExC,iBAAkC,CAAC;AAAA,EAEnC,iBAAgD,CAAC;AAAA,EAEzD,mBAAmB,KAAgC;AAClD,SAAK,eAAe,KAAK,GAAG;AAAA,EAC7B;AAAA,EAEA,oBAAoB;AACnB,SAAK,eAAe,IAAI;AAAA,EACzB;AAAA,EAEA,sBAAsB;AACrB,QAAI,KAAK,eAAe,WAAW,GAAG;AAErC,aAAO;AAAA,IACR;AACA,WAAO,KAAK,eAAe,KAAK,eAAe,SAAS,CAAC;AAAA,EAC1D;AAAA,EAEA,4BAA4B,SAAqB;AAChD,SAAK,uBAAuB,KAAK,OAAO;AAAA,EAEzC;AAAA,EAEA,mCAAmC;AAClC,SAAK,uBAAuB,IAAI;AAAA,EACjC;AAAA,EAEA,0BAA0B;AACzB,QAAI,KAAK,uBAAuB,WAAW,GAAG;AAE7C,aAAO;AAAA,IACR;AACA,WAAO,KAAK,uBA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CAAC;AACtB,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC3C,QAAI,WAAW,CAAC,EAAE,WAAW,GAAG,GAAG;AAClC,aAAO,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,aAAa,CAAC;AAAA,IACpD,WAAW,WAAW,CAAC,MAAM,aAAa,CAAC,GAAG;AAC7C,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;AAEO,IAAM,SAAS,UAA+B,CAAC,UAAU;AAC/D,QAAM,YAAY,SAAS,cAAc,KAAK;AAC9C,YAAU,MAAM,UAAU;AAC1B,QAAM,cAAc,SAAS,MAAM;AAClC,UAAM,OAAO,YAAY,IAAI;AAC7B,eAAW,SAAS,MAAM,QAAQ;AACjC,YAAM,SAAS,MAAM,MAAM,MAAM,IAAI;AACrC,UAAI,QAAQ;AACX,eAAO,MAAM,UAAU,MAAM;AAAA,MAC9B;AAAA,IACD;AACA,WAAO;AAAA,EACR,CAAC;AACD,cAAY,WAAW,WAAW;AAClC,SAAO;AACR,CAAC;AASM,IAAM,OAAO,UAAqB,CAAC,UAAU;AACnD,QAAM,EAAE,IAAI,OAAO,GAAG,KAAK,IAAI;AAC/B,QAAM,IAAI,SAAS,cAAc,GAAG;AACpC,IAAE,OAAO;AAET,IAAE,iBAAiB,SAAS,CAAC,MAAM;AAClC,QAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,GAAG;AAC7F;AAAA,IACD;AACA,MAAE,eAAe;AACjB,aAAS,EAAE;AAAA,EACZ,CAAC;AAED,MAAI,OAAO;AACV,gBAAY,GAAG,KAAK;AAAA,EACrB;AAEA,WAAS,GAAG,IAAI;AAEhB,SAAO;AACR,CAAC;","names":["component","signal","component","index","component","n","signal","currentPath"]}
1
+ {"version":3,"sources":["../src/context.ts","../src/signals.ts","../src/components.ts","../src/builder.ts","../src/controlled-input.ts","../src/router.ts"],"sourcesContent":["import { Component, ComponentList } from './components';\nimport { Signal } from './signals';\n\ntype ExecutionKind = 'createComponent' | 'computed' | 'addReactivity';\n\nexport interface IDisposable {\n\tdispose: () => void;\n}\n\nclass AppContext {\n\tprivate reactivityContextStack: Reactivity[] = [];\n\n\tprivate refreshTimeout: any = 0;\n\n\t//private contexts = new Set<RenderContext>();\n\n\tprivate dirtyReactivities = new Set<Reactivity>();\n\n\tprivate executionStack: ExecutionKind[] = [];\n\n\tprivate componentStack: (Component | ComponentList)[] = [];\n\n\tpushComponentStack(cmp: Component | ComponentList) {\n\t\tthis.componentStack.push(cmp);\n\t}\n\n\tpopComponentStack() {\n\t\tthis.componentStack.pop();\n\t}\n\n\tgetCurrentComponent() {\n\t\tif (this.componentStack.length === 0) {\n\t\t\t//console.warn('No current component');\n\t\t\treturn null;\n\t\t}\n\t\treturn this.componentStack[this.componentStack.length - 1];\n\t}\n\n\tsetCurrentReactivityContext(context: Reactivity) {\n\t\tthis.reactivityContextStack.push(context);\n\t\t//this.contexts.add(context);\n\t}\n\n\trestorePreviousReactivityContext() {\n\t\tthis.reactivityContextStack.pop();\n\t}\n\n\tgetCurrentRenderContext() {\n\t\tif (this.reactivityContextStack.length === 0) {\n\t\t\t//console.warn('No current render context');\n\t\t\treturn null;\n\t\t}\n\t\treturn this.reactivityContextStack[this.reactivityContextStack.length - 1];\n\t}\n\n\tscheduleRefresh() {\n\t\tif (this.refreshTimeout) {\n\t\t\tclearTimeout(this.refreshTimeout);\n\t\t}\n\t\tthis.refreshTimeout = setTimeout(() => {\n\t\t\tconst dirtyContexts = Array.from(this.dirtyReactivities);\n\t\t\tdirtyContexts.forEach((ctx) => ctx.process());\n\t\t}, 0);\n\t}\n\n\taddReactivity(executor: () => void) {\n\t\tconst ctx = new Reactivity(executor);\n\t\tglobalContext.pushExecutionStack('addReactivity');\n\t\tctx.exec();\n\t\tglobalContext.popExecutionStack();\n\t\treturn ctx;\n\t}\n\n\tcreateRoot(component: () => Component, mountPoint: HTMLElement) {\n\t\tthis.dirtyReactivities.clear();\n\t\tmountPoint.innerHTML = '';\n\t\tconst cmp = component();\n\t\tcmp.mount(mountPoint, null);\n\t}\n\n\tcanReadSignal() {\n\t\tconst length = this.executionStack.length;\n\t\tif (length === 0) return true;\n\t\tconst current = this.executionStack[length - 1];\n\t\treturn current !== 'createComponent';\n\t}\n\n\tpushExecutionStack(type: ExecutionKind) {\n\t\tthis.executionStack.push(type);\n\t}\n\n\tpopExecutionStack() {\n\t\tthis.executionStack.pop();\n\t}\n\n\taddDirtyContext(ctx: Reactivity) {\n\t\tthis.dirtyReactivities.add(ctx);\n\t}\n\n\tremoveDirtyContext(ctx: Reactivity) {\n\t\tthis.dirtyReactivities.delete(ctx);\n\t}\n}\n\nexport class Reactivity implements IDisposable {\n\tprivate dirty: boolean = false;\n\n\tprivate signals = new Set<Signal<any>>();\n\n\tconstructor(private readonly action: () => void) {\n\t\tconst currentComponent = globalContext.getCurrentComponent();\n\t\tif (currentComponent) {\n\t\t\tcurrentComponent.addDisposable(this);\n\t\t} else {\n\t\t\tconsole.warn('Creating a Reactivity outside of a component');\n\t\t}\n\t}\n\n\tmarkDirty() {\n\t\t// Mark the context as dirty (needing re-render)\n\t\t//console.log('marking context as dirty');\n\t\tthis.dirty = true;\n\t\tglobalContext.addDirtyContext(this);\n\t\tglobalContext.scheduleRefresh();\n\t}\n\n\taddSignal(signal: Signal<any>) {\n\t\tthis.signals.add(signal);\n\t}\n\n\tremoveSignal(signal: Signal<any>) {\n\t\tthis.signals.delete(signal);\n\t}\n\n\tprocess() {\n\t\tif (!this.dirty) return;\n\t\tthis.exec();\n\t\t//console.log('re-render cycle completed');\n\t\tthis.dirty = false;\n\t\tglobalContext.removeDirtyContext(this);\n\t}\n\n\texec() {\n\t\tthis.signals.forEach((s) => s.removeContext(this));\n\t\tthis.signals.clear();\n\t\tglobalContext.setCurrentReactivityContext(this);\n\t\tthis.action();\n\t\tglobalContext.restorePreviousReactivityContext();\n\t}\n\n\tdispose() {\n\t\tthis.signals.forEach((s) => s.removeContext(this));\n\t\tthis.signals.clear();\n\t\tthis.dirty = false;\n\t\tglobalContext.removeDirtyContext(this);\n\t}\n}\n\nexport const globalContext = new AppContext();\n","import { globalContext, Reactivity } from './context';\n\ntype WithSignals<T> = { [K in keyof T]: Signal<T[K]> };\n\nabstract class Signal<T> {\n\tprotected abstract value: T;\n\n\tprotected contexts: Set<Reactivity> = new Set();\n\n\tconstructor() {}\n\n\tget() {\n\t\tif (!globalContext.canReadSignal()) {\n\t\t\tthrow new Error('Cannot read a signal value during component creation. Did you mean to use a computed signal instead?');\n\t\t}\n\t\t//context.current.register(this);\n\t\tconst ctx = globalContext.getCurrentRenderContext();\n\t\tif (ctx) {\n\t\t\tthis.contexts.add(ctx);\n\t\t\tctx.addSignal(this);\n\t\t}\n\t\treturn this.value;\n\t}\n\n\tpublic readonly computed = new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, prop) => {\n\t\t\t\treturn computed(() => this.get()[prop as keyof T]);\n\t\t\t},\n\t\t}\n\t) as WithSignals<T>;\n\n\tremoveContext(ctx: Reactivity) {\n\t\tthis.contexts.delete(ctx);\n\t}\n\n\tdispose() {\n\t\tconsole.log('disposing signal', this);\n\t\tthis.contexts.forEach((ctx) => {\n\t\t\tctx.removeSignal(this);\n\t\t});\n\t\tthis.contexts.clear();\n\t}\n}\n\nclass WritableSignal<T> extends Signal<T> {\n\tprotected override value: T;\n\n\tpublic readonly initialValue: T;\n\n\tconstructor(initialValue: T) {\n\t\tsuper();\n\t\tthis.initialValue = initialValue;\n\t\tthis.value = initialValue;\n\t}\n\n\tset(newValue: T) {\n\t\tthis.value = newValue;\n\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t}\n\n\tupdate(updater: (value: T) => T) {\n\t\tthis.value = updater(this.value);\n\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t}\n}\n\nclass ComputedSignal<T> extends Signal<T> {\n\tprotected override value: T;\n\n\tprivate computeFn: () => T;\n\n\tconstructor(computeFn: () => T) {\n\t\tsuper();\n\t\tglobalContext.pushExecutionStack('computed');\n\t\tthis.value = computeFn();\n\t\tglobalContext.popExecutionStack();\n\t\tthis.computeFn = computeFn;\n\t}\n\n\trecompute() {\n\t\tconst newValue = this.computeFn();\n\t\tif (newValue !== this.value) {\n\t\t\tthis.value = newValue;\n\t\t\tthis.contexts.forEach((ctx) => ctx.markDirty());\n\t\t}\n\t}\n}\n\nexport function isSignal(value: any): value is Signal<any> {\n\treturn value instanceof Signal;\n}\n\nexport function signal<T>(initialValue: T) {\n\tconst sig = new WritableSignal(initialValue);\n\n\t// // Creamos una función que se usará como callable\n\t// const fn = (() => sig.get()) as any;\n\n\t// // Copiamos todas las propiedades y métodos de la instancia a la función\n\t// Object.setPrototypeOf(fn, sig.constructor.prototype);\n\n\t// // Copiamos las propiedades de instancia\n\t// Object.assign(fn, this);\n\n\t// // Retornamos la función como si fuera la instancia\n\t// return fn as WritableSignal<T> & (() => T);\n\n\treturn sig;\n}\n\nexport function computed<T>(fn: () => T) {\n\tlet sig: ComputedSignal<T>;\n\tconst ctx = new Reactivity(() => {\n\t\tsig.recompute();\n\t});\n\tglobalContext.setCurrentReactivityContext(ctx);\n\tsig = new ComputedSignal(fn);\n\tglobalContext.restorePreviousReactivityContext();\n\n\treturn sig as Signal<T>;\n}\n\nexport type { Signal, WritableSignal };\n","import { ChispaContent } from './builder';\nimport { globalContext, IDisposable } from './context';\nimport { computed, Signal, WritableSignal } from './signals';\n\nexport type Dict = Record<string, any>;\nexport type ComponentFactory<TProps extends Dict> = (props: TProps) => ChispaContent;\n\nexport class Component<TProps extends Dict = any> {\n\tpublic nodes: Node[] | null = null;\n\n\tprivate container: Node | null = null;\n\n\tprivate anchor: Node | null = null;\n\n\tprivate disposables: IDisposable[] = [];\n\n\tpublic silent = true;\n\n\tconstructor(\n\t\tprivate readonly factoryFn: ComponentFactory<TProps>,\n\t\tpublic readonly key: any = null,\n\t\tpublic readonly props: TProps | null = null\n\t) {}\n\n\tmount(container: Node, anchor: Node | null = null) {\n\t\tif (!this.silent) console.log('Mounting Component', this);\n\n\t\tthis.container = container;\n\t\tthis.anchor = anchor;\n\t\tglobalContext.pushExecutionStack('createComponent');\n\t\tglobalContext.pushComponentStack(this);\n\t\tconst node = this.factoryFn ? (this.factoryFn as any)(this.props) : null;\n\t\tglobalContext.popComponentStack();\n\t\tglobalContext.popExecutionStack();\n\t\t// if node is fragment, convert to array of nodes\n\t\tif (node) {\n\t\t\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\t\t\tthis.nodes = Array.from(node.childNodes);\n\t\t\t} else {\n\t\t\t\tthis.nodes = [node];\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodes = null;\n\t\t}\n\t\tthis.insertNodes();\n\t}\n\n\treanchor(anchor: Node | null) {\n\t\tthis.anchor = anchor;\n\n\t\t//console.log('reanchoring', this.nodes, ' before anchor', this.anchor);\n\t\tthis.insertNodes();\n\t}\n\n\tprivate insertNodes() {\n\t\tif (!this.container || !this.nodes) return;\n\t\t// Insertar en la nueva posición\n\t\tfor (const node of this.nodes) {\n\t\t\tif (this.anchor) {\n\t\t\t\tthis.container.insertBefore(node, this.anchor);\n\t\t\t} else {\n\t\t\t\tthis.container.appendChild(node);\n\t\t\t}\n\t\t}\n\t}\n\n\taddDisposable(disposable: IDisposable) {\n\t\tthis.disposables.push(disposable);\n\t}\n\n\tunmount() {\n\t\tif (!this.silent) console.log('Unmounting Component', this);\n\n\t\tif (this.nodes) {\n\t\t\tthis.nodes.forEach((node) => {\n\t\t\t\tif (node && node.parentNode) {\n\t\t\t\t\tnode.parentNode.removeChild(node);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tthis.disposables.forEach((d) => {\n\t\t\td.dispose();\n\t\t});\n\t\tthis.disposables = [];\n\t\tthis.nodes = null;\n\t\tthis.container = null;\n\t\tthis.anchor = null;\n\t}\n}\n\n// Definimos overloads para component\nexport function component(factory: ComponentFactory<any>): (props?: any) => Component;\nexport function component<TProps extends Dict>(factory: ComponentFactory<TProps>): (props: TProps) => Component<TProps>;\n\nexport function component<TProps extends Dict = any>(factory: ComponentFactory<TProps>) {\n\treturn (props?: TProps) => {\n\t\treturn new Component(factory, null, props);\n\t};\n}\n\nexport function onUnmount(unmountFn: () => void) {\n\tconst currentComponent = globalContext.getCurrentComponent();\n\tif (currentComponent) {\n\t\tcurrentComponent.addDisposable({\n\t\t\tdispose: unmountFn,\n\t\t});\n\t} else {\n\t\tthrow new Error('onUnmount must be called within a component context');\n\t}\n}\n\ntype ItemFactoryFn<T, TProps = any> = (item: Signal<T>, index: Signal<number>, list: WritableSignal<T[]>, props?: TProps) => ChispaContent;\ntype KeyFn<T> = (item: T, index: number) => any;\n\nexport class ComponentList<TItem = any, TProps extends Dict = any> {\n\tprivate readonly components: Map<string, Component<TProps>>;\n\tprivate container: Node | null = null; // Contenedor donde se montan los nodos\n\tprivate anchor: Node | null = null; // Nodes must be inserted before this node\n\tprivate currentKeys: any[] = [];\n\tpublic disposables: any[] = [];\n\n\tconstructor(\n\t\tprivate readonly itemFactoryFn: ItemFactoryFn<TItem, TProps>,\n\t\tprivate readonly keyFn: KeyFn<TItem>,\n\t\tprivate readonly itemsSignal: WritableSignal<TItem[]>,\n\t\tprivate readonly props: TProps | null = null\n\t) {\n\t\tthis.components = new Map();\n\t}\n\n\t/**\n\t * Obtiene todos los componentes\n\t */\n\tprivate getAllComponents(): Component[] {\n\t\treturn Array.from(this.components.values());\n\t}\n\n\t/**\n\t * Limpia todos los componentes\n\t */\n\tprivate clear(): void {\n\t\tArray.from(this.components.values()).forEach((component) => {\n\t\t\tthis.removeComponent(component);\n\t\t});\n\t}\n\n\t/**\n\t * Elimina un componente completo\n\t */\n\tprivate removeComponent(component: Component) {\n\t\tcomponent.unmount();\n\t\tif (component.key) {\n\t\t\tthis.components.delete(component.key);\n\t\t}\n\t}\n\n\t/**\n\t * Crea un nuevo componente\n\t */\n\tprivate createNewComponent(key: any): Component {\n\t\tconst factory = (props?: TProps) => {\n\t\t\tconst item = computed(() => this.itemsSignal.get().find((v, index) => this.keyFn(v, index) === key)!);\n\t\t\tconst index = computed(() => this.itemsSignal.get().findIndex((v, index) => this.keyFn(v, index) === key));\n\t\t\treturn this.itemFactoryFn ? this.itemFactoryFn(item, index, this.itemsSignal, props) : null;\n\t\t};\n\n\t\tconst component = new Component(factory, key, this.props);\n\t\tthis.components.set(key, component);\n\n\t\treturn component;\n\t}\n\n\tprivate getTargetAnchor(items: TItem[], index: number): Node | null {\n\t\tconst nextItem = index + 1 < items.length ? items[index + 1] : null;\n\t\tconst nextComp = nextItem ? this.components.get(this.keyFn(nextItem, index + 1)) : null;\n\t\tif (nextComp && nextComp.nodes) {\n\t\t\treturn nextComp.nodes[0];\n\t\t} else {\n\t\t\t// Es el último componente, debería insertarse antes del anchor original\n\t\t\treturn this.anchor;\n\t\t}\n\t}\n\n\t/**\n\t * Función principal que sincroniza los componentes DOM con un array de keys\n\t */\n\tprivate synchronizeComponents(): void {\n\t\tconst existingComponents = this.getAllComponents();\n\n\t\t// Identificar qué componentes eliminar (los que no están en keys)\n\t\tconst items = this.itemsSignal.get();\n\t\tconst keys = items.map((item, index) => this.keyFn(item, index));\n\t\tconst componentsToRemove = existingComponents.filter((component) => component.key && !keys.includes(component.key));\n\t\tcomponentsToRemove.forEach((component) => this.removeComponent(component));\n\n\t\tthis.currentKeys = this.currentKeys.filter((key) => keys.includes(key));\n\t\t//console.log('Current keys:', this.currentKeys, 'Target keys:', keys);\n\n\t\tif (!this.container) {\n\t\t\tconsole.warn('Container is null in synchronizeComponents');\n\t\t\treturn;\n\t\t}\n\t\t// Procesar cada key en el orden deseado\n\t\tconst container = this.container;\n\n\t\titems.forEach((item, index) => {\n\t\t\tconst targetKey = this.keyFn(item, index);\n\t\t\tconst currentKey = this.currentKeys[index];\n\t\t\tif (targetKey === currentKey) {\n\t\t\t\t// La key no ha cambiado de posición, no hacer nada\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst existingComponent = this.components.get(targetKey);\n\n\t\t\tif (existingComponent) {\n\t\t\t\tconst prevComp = this.components.get(currentKey);\n\t\t\t\tif (!prevComp || !prevComp.nodes) {\n\t\t\t\t\tconsole.warn('Previous component or its nodes not found for key', currentKey);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\texistingComponent.reanchor(prevComp.nodes[0]);\n\t\t\t\t// Reordenar el array de keys actuales\n\t\t\t\tthis.currentKeys = this.currentKeys.filter((k) => k !== targetKey);\n\t\t\t\tthis.currentKeys.splice(index, 0, targetKey);\n\t\t\t} else {\n\t\t\t\t// El componente no existe, crearlo\n\t\t\t\tconst targetAnchor = this.getTargetAnchor(items, index);\n\t\t\t\tconst newComponent = this.createNewComponent(targetKey);\n\t\t\t\tnewComponent.mount(container, targetAnchor);\n\t\t\t\tthis.currentKeys.splice(index, 0, targetKey);\n\t\t\t}\n\t\t});\n\t}\n\n\tmount(container: Node, anchor: Node | null = null) {\n\t\t//console.log('Mounting ComponentList');\n\t\tthis.container = container;\n\t\tthis.anchor = anchor;\n\n\t\tglobalContext.pushComponentStack(this);\n\t\tglobalContext.addReactivity(() => {\n\t\t\tthis.synchronizeComponents();\n\t\t});\n\t\tglobalContext.popComponentStack();\n\t}\n\n\taddDisposable(disposable: IDisposable) {\n\t\tthis.disposables.push(disposable);\n\t}\n\n\tunmount() {\n\t\t//console.log('Unmounting ComponentList');\n\t\tthis.clear();\n\t\tthis.container = null!;\n\t\tthis.anchor = null!;\n\t\tthis.disposables.forEach((d) => {\n\t\t\td.dispose();\n\t\t});\n\t}\n}\n\n// Definimos overloads para componentList\nexport function componentList<TItem>(\n\titemFactoryFn: ItemFactoryFn<TItem, any>,\n\tkeyFn: KeyFn<TItem>\n): (listSignal: WritableSignal<TItem[]>, props?: any) => ComponentList<TItem>;\nexport function componentList<TItem, TProps extends Dict>(\n\titemFactoryFn: ItemFactoryFn<TItem, TProps>,\n\tkeyFn: KeyFn<TItem>\n): (listSignal: WritableSignal<TItem[]>, props: TProps) => ComponentList<TItem, TProps>;\n\nexport function componentList<TItem, TProps extends Dict = any>(itemFactoryFn: ItemFactoryFn<TItem, TProps>, keyFn: KeyFn<TItem>) {\n\treturn (listSignal: WritableSignal<TItem[]>, props?: TProps) => {\n\t\tconst list = new ComponentList(itemFactoryFn, keyFn, listSignal, props);\n\t\treturn list;\n\t};\n}\n","import { Component, ComponentList } from './components';\nimport { globalContext } from './context';\nimport { computed, isSignal, type Signal } from './signals';\n\nexport type ChispaReactive<T> = T | Signal<T> | (() => T);\nexport type ChispaNode = string | number | Node | null;\nexport type ChispaContent = ChispaNode | ChispaNode[] | Component | Component[] | ComponentList;\nexport type ChispaContentReactive = ChispaReactive<ChispaContent>;\nexport type ChispaClasses = Record<string, ChispaReactive<boolean>>;\nexport type ChispaCSSPropertiesStrings = {\n\t[K in keyof CSSStyleDeclaration]?: ChispaReactive<string>;\n};\n\ntype AllowSignals<T> = { [K in keyof T]: T[K] | Signal<T[K]> };\n\ntype ChispaNodeBuilderBaseProps<T> = AllowSignals<Omit<Partial<T>, 'style' | 'dataset'>>;\ninterface INodeBuilderAdditionalProps<T, TNodes> {\n\taddClass?: string;\n\tclasses?: ChispaClasses;\n\tnodes?: TNodes;\n\tinner?: ChispaContentReactive;\n\tstyle?: ChispaCSSPropertiesStrings;\n\tdataset?: Record<string, string>;\n\t_ref?: (node: T) => void | { current: T | null };\n}\nexport type ChispaNodeBuilderProps<T, TNodes> = ChispaNodeBuilderBaseProps<T> & INodeBuilderAdditionalProps<T, TNodes>;\n\nconst forbiddenProps = ['addClass', 'nodes', 'inner', '_ref'];\n\nexport function getValidProps(props: any) {\n\tconst finalProps: any = {};\n\n\tfor (const propName in props) {\n\t\tif (forbiddenProps.indexOf(propName) === -1) {\n\t\t\tfinalProps[propName] = props[propName];\n\t\t}\n\t}\n\n\tif (props._ref !== undefined) {\n\t\t//finalProps.ref = props._ref;\n\t}\n\n\treturn finalProps;\n}\n\nexport function getItem<T>(template: T, items: any, itemName: keyof T) {\n\tif (!items || !items[itemName]) {\n\t\treturn null;\n\t}\n\n\tconst item = items[itemName];\n\n\tif (item.constructor && item.constructor.name === 'Object' && !(item instanceof Element)) {\n\t\tconst Comp = template[itemName] as (props: any) => Element;\n\t\tconst itemProps = item;\n\n\t\treturn Comp(itemProps);\n\t} else {\n\t\treturn item;\n\t}\n}\n\nexport function setAttributes(node: Element, attributes: Record<string, string>) {\n\tfor (const attr in attributes) {\n\t\tconst attrValue = attributes[attr].trim();\n\t\tif (!attrValue) continue;\n\t\t//console.log('setting attr', attr, attrValue )\n\t\tnode.setAttribute(attr, attrValue);\n\t}\n}\n\nexport function setProps<T extends Element>(node: T, props: any) {\n\tif (node instanceof HTMLElement) {\n\t\tif (props.style !== undefined) {\n\t\t\tconst style = props.style;\n\t\t\tfor (const styleKey in style) {\n\t\t\t\tif (typeof style[styleKey] === 'function') {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.style[styleKey as any] = style[styleKey]();\n\t\t\t\t\t});\n\t\t\t\t} else if (isSignal(style[styleKey])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.style[styleKey as any] = style[styleKey].get();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tnode.style[styleKey as any] = style[styleKey];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.style;\n\t\t}\n\n\t\tif (props.classes !== undefined) {\n\t\t\tconst classes = props.classes;\n\t\t\tfor (const className in classes) {\n\t\t\t\tif (typeof classes[className] === 'function') {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tif (classes[className]()) {\n\t\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else if (isSignal(classes[className])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tif (classes[className].get()) {\n\t\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tif (classes[className]) {\n\t\t\t\t\t\tnode.classList.add(className);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.classList.remove(className);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.classes;\n\t\t}\n\n\t\tif (props.dataset !== undefined) {\n\t\t\tconst dataset = props.dataset;\n\t\t\tfor (const datasetKey in dataset) {\n\t\t\t\tif (isSignal(dataset[datasetKey])) {\n\t\t\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t\t\tnode.dataset[datasetKey] = dataset[datasetKey].get();\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tnode.dataset[datasetKey] = dataset[datasetKey];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete props.dataset;\n\t\t}\n\t}\n\n\tfor (const prop in props) {\n\t\tconst propValue = props[prop];\n\t\t//console.log('setting prop', prop, propValue )\n\t\tif (isSignal(propValue)) {\n\t\t\tglobalContext.addReactivity(() => {\n\t\t\t\t(node as any)[prop] = propValue.get();\n\t\t\t});\n\t\t} else if (propValue === undefined) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\t(node as any)[prop] = propValue;\n\t\t}\n\t}\n}\n\nexport function appendChild(node: Element | DocumentFragment, child: ChispaContentReactive) {\n\tif (child === null) return;\n\tif (typeof child === 'function') {\n\t\tprocessSignalChild(node, computed(child));\n\t\treturn;\n\t}\n\tif (isSignal(child)) {\n\t\tprocessSignalChild(node, child);\n\t\treturn;\n\t}\n\tif (child instanceof Component || child instanceof ComponentList) {\n\t\tchild.mount(node, null);\n\t\treturn;\n\t}\n\tif (Array.isArray(child)) {\n\t\tchild.forEach((ch) => {\n\t\t\tappendChild(node, ch);\n\t\t});\n\t\treturn;\n\t}\n\tnode.appendChild(child instanceof Node ? child : document.createTextNode(child.toString()));\n}\n\nfunction isStaticArrayOfComponents(arr: ChispaContent): arr is Component[] {\n\tif (!Array.isArray(arr)) return false;\n\tfor (const item of arr) {\n\t\tif (!(item instanceof Component)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nfunction processSignalChild(node: Element | DocumentFragment, child: Signal<ChispaContent>) {\n\tconst anchor = document.createTextNode('');\n\tnode.appendChild(anchor);\n\tlet prevValue: Component | ComponentList | null = null;\n\n\tglobalContext.addReactivity(() => {\n\t\t//console.log('Signal child changed', child);\n\t\tconst ch = child.get();\n\t\tif (prevValue) {\n\t\t\tprevValue.unmount();\n\t\t}\n\t\tif (ch === null) {\n\t\t\tprevValue = null;\n\t\t\treturn;\n\t\t}\n\n\t\tlet component: Component | ComponentList;\n\t\tif (isStaticArrayOfComponents(ch)) {\n\t\t\tthrow new Error('Static array of components not supported in signal children. Use ComponentList instead.');\n\t\t} else if (ch instanceof Component || ch instanceof ComponentList) {\n\t\t\tch.mount(node, anchor);\n\t\t\tcomponent = ch;\n\t\t} else {\n\t\t\tconst wrCmp = new Component(() => toNode(ch));\n\t\t\t//wrCmp.silent = true;\n\t\t\twrCmp.mount(node, anchor);\n\t\t\tcomponent = wrCmp;\n\t\t}\n\t\tprevValue = component;\n\t});\n}\n\nfunction toNode(n: ChispaNode | ChispaNode[]): Node | null {\n\tif (Array.isArray(n)) {\n\t\tconst frag = document.createDocumentFragment();\n\t\tconst nodes = n.map((c) => toNode(c)).filter((n) => n !== null);\n\t\tfrag.append(...nodes);\n\t\treturn frag;\n\t} else if (n instanceof Node) {\n\t\treturn n;\n\t} else if (typeof n === 'string' || typeof n === 'number') {\n\t\treturn document.createTextNode(n.toString());\n\t} else {\n\t\treturn null;\n\t\t//throw new Error('Invalid node type');\n\t}\n}\n","import { globalContext } from './context';\nimport { WritableSignal } from './signals';\n\nexport interface ControlledInputOptions {\n\t/**\n\t * Optional function to transform the value before setting it to the signal.\n\t * Useful for enforcing uppercase, removing invalid characters, etc.\n\t */\n\ttransform?: (value: string) => string;\n\n\t/**\n\t * Optional function to validate the value.\n\t * If it returns false, the change is rejected and the previous value is restored.\n\t */\n\tvalidate?: (value: string) => boolean;\n}\n\nexport function bindControlledInput(element: HTMLInputElement | HTMLTextAreaElement, signal: WritableSignal<string>, options: ControlledInputOptions = {}) {\n\tconst { transform, validate } = options;\n\n\t// Initialize value\n\telement.value = signal.initialValue;\n\n\t// Handle input events\n\tconst handleInput = (e: Event) => {\n\t\tconst target = e.target as HTMLInputElement;\n\t\tlet newValue = target.value;\n\t\tconst originalValue = signal.get();\n\n\t\t// Save cursor position\n\t\tconst selectionStart = target.selectionStart;\n\t\tconst selectionEnd = target.selectionEnd;\n\n\t\t// Apply transformation if provided\n\t\tif (transform) {\n\t\t\tnewValue = transform(newValue);\n\t\t}\n\n\t\t// Apply validation if provided\n\t\tif (validate && !validate(newValue)) {\n\t\t\t// If invalid, revert to original value\n\t\t\tnewValue = originalValue;\n\t\t}\n\n\t\t// Update signal\n\t\tif (newValue !== originalValue) {\n\t\t\tsignal.set(newValue);\n\t\t}\n\n\t\t// Force update DOM if it doesn't match the new value (e.g. transformed or rejected)\n\t\tif (target.value !== newValue) {\n\t\t\tconst lengthDiff = target.value.length - newValue.length;\n\t\t\ttarget.value = newValue;\n\n\t\t\t// Restore cursor\n\t\t\tif (selectionStart !== null && selectionEnd !== null) {\n\t\t\t\t// Restore to the saved position.\n\t\t\t\t// Adjust for length difference to keep cursor relative to the content\n\t\t\t\tconst newStart = Math.max(0, selectionStart - lengthDiff);\n\t\t\t\tconst newEnd = Math.max(0, selectionEnd - lengthDiff);\n\t\t\t\ttarget.setSelectionRange(newStart, newEnd);\n\t\t\t}\n\t\t}\n\t};\n\n\telement.addEventListener('input', handleInput);\n\n\t// Subscribe to signal changes to update the input if it changes externally\n\tglobalContext.addReactivity(() => {\n\t\tconst newValue = signal.get();\n\t\t// Only update if the value is actually different to avoid cursor jumping\n\t\tif (element.value !== newValue) {\n\t\t\telement.value = newValue;\n\t\t}\n\t});\n\n\t// Return a cleanup function\n\treturn () => {\n\t\telement.removeEventListener('input', handleInput);\n\t};\n}\n","import { signal, computed, Signal } from './signals';\nimport { component, Component, Dict } from './components';\nimport { appendChild, setProps } from './builder';\n\nexport interface Route {\n\tpath: string;\n\tcomponent: (props?: any) => Component<any>;\n}\n\nconst currentPath = signal(typeof window !== 'undefined' ? window.location.pathname : '/');\n\nif (typeof window !== 'undefined') {\n\twindow.addEventListener('popstate', () => {\n\t\tcurrentPath.set(window.location.pathname);\n\t});\n}\n\nexport function navigate(to: string, replace = false) {\n\tif (typeof window === 'undefined') {\n\t\tcurrentPath.set(to);\n\t\treturn;\n\t}\n\tif (replace) {\n\t\twindow.history.replaceState({}, '', to);\n\t} else {\n\t\twindow.history.pushState({}, '', to);\n\t}\n\tcurrentPath.set(to);\n}\n\nexport function pathMatches(path: string): Signal<boolean> {\n\treturn computed(() => {\n\t\tconst current = currentPath.get();\n\t\treturn match(path, current) !== null;\n\t});\n}\n\nfunction match(routePath: string, currentPath: string): Dict | null {\n\tif (routePath === '*') return {};\n\tconst routeParts = routePath.split('/').filter(Boolean);\n\tconst currentParts = currentPath.split('/').filter(Boolean);\n\tif (routeParts.length !== currentParts.length) return null;\n\tconst params: Dict = {};\n\tfor (let i = 0; i < routeParts.length; i++) {\n\t\tif (routeParts[i].startsWith(':')) {\n\t\t\tparams[routeParts[i].substring(1)] = currentParts[i];\n\t\t} else if (routeParts[i] !== currentParts[i]) {\n\t\t\treturn null;\n\t\t}\n\t}\n\treturn params;\n}\n\nexport const Router = component<{ routes: Route[] }>((props) => {\n\tconst container = document.createElement('div');\n\tcontainer.style.display = 'contents';\n\tconst activeRoute = computed(() => {\n\t\tconst path = currentPath.get();\n\t\tfor (const route of props.routes) {\n\t\t\tconst params = match(route.path, path);\n\t\t\tif (params) {\n\t\t\t\treturn route.component(params);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t});\n\tappendChild(container, activeRoute);\n\treturn container;\n});\n\nexport interface LinkProps {\n\tto: string;\n\tclass?: string | Signal<string> | (() => string);\n\tinner?: any;\n\t[key: string]: any;\n}\n\nexport const Link = component<LinkProps>((props) => {\n\tconst { to, inner, ...rest } = props;\n\tconst a = document.createElement('a');\n\ta.href = to;\n\n\ta.addEventListener('click', (e) => {\n\t\tif (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.defaultPrevented || e.button !== 0) {\n\t\t\treturn;\n\t\t}\n\t\te.preventDefault();\n\t\tnavigate(to);\n\t});\n\n\tif (inner) {\n\t\tappendChild(a, inner);\n\t}\n\n\tsetProps(a, rest);\n\n\treturn a;\n});\n"],"mappings":";AASA,IAAM,aAAN,MAAiB;AAAA,EACR,yBAAuC,CAAC;AAAA,EAExC,iBAAsB;AAAA;AAAA,EAItB,oBAAoB,oBAAI,IAAgB;AAAA,EAExC,iBAAkC,CAAC;AAAA,EAEnC,iBAAgD,CAAC;AAAA,EAEzD,mBAAmB,KAAgC;AAClD,SAAK,eAAe,KAAK,GAAG;AAAA,EAC7B;AAAA,EAEA,oBAAoB;AACnB,SAAK,eAAe,IAAI;AAAA,EACzB;AAAA,EAEA,sBAAsB;AACrB,QAAI,KAAK,eAAe,WAAW,GAAG;AAErC,aAAO;AAAA,IACR;AACA,WAAO,KAAK,eAAe,KAAK,eAAe,SAAS,CAAC;AAAA,EAC1D;AAAA,EAEA,4BAA4B,SAAqB;AAChD,SAAK,uBAAuB,KAAK,OAAO;AAAA,EAEzC;AAAA,EAEA,mCAAmC;AAClC,SAAK,uBAAuB,IAAI;AAAA,EACjC;AAAA,EAEA,0BAA0B;AACzB,QAAI,KAAK,uBAAuB,WAAW,GAAG;AAE7C,aAAO;AAAA,IACR;AACA,WAAO,KAAK,uBAAuB,KAAK,uBAAuB,SAAS,CAAC;AAAA,EAC1E;AAAA,EAEA,kBAAkB;AACjB,QAAI,KAAK,gBAAgB;AACxB,mBAAa,KAAK,cAAc;AAAA,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OAAO,GAAG,KAAK,IAAI;AAC/B,QAAM,IAAI,SAAS,cAAc,GAAG;AACpC,IAAE,OAAO;AAET,IAAE,iBAAiB,SAAS,CAAC,MAAM;AAClC,QAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,GAAG;AAC7F;AAAA,IACD;AACA,MAAE,eAAe;AACjB,aAAS,EAAE;AAAA,EACZ,CAAC;AAED,MAAI,OAAO;AACV,gBAAY,GAAG,KAAK;AAAA,EACrB;AAEA,WAAS,GAAG,IAAI;AAEhB,SAAO;AACR,CAAC;","names":["component","signal","component","index","component","n","signal","currentPath"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chispa",
3
- "version": "0.3.0",
4
- "description": "A fully declarative UI reactive framework for building web applications.",
3
+ "version": "0.4.0",
4
+ "description": "A fully declarative UI reactive engine for building web applications.",
5
5
  "author": "José Carlos HR <joecarlhr@gmail.com>",
6
6
  "license": "MIT",
7
7
  "type": "module",