eleva 1.1.0-alpha → 1.2.0-alpha

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.
@@ -1,13 +1,25 @@
1
1
  /**
2
+ * Defines the structure and behavior of a component.
2
3
  * @typedef {Object} ComponentDefinition
3
4
  * @property {function(Object<string, any>): (Object<string, any>|Promise<Object<string, any>>)} [setup]
4
- * A setup function that initializes the component state and returns an object or a promise that resolves to an object.
5
+ * Optional setup function that initializes the component's reactive state and lifecycle.
6
+ * Receives props and context as an argument and should return an object containing the component's state.
7
+ * Can return either a synchronous object or a Promise that resolves to an object for async initialization.
8
+ *
5
9
  * @property {function(Object<string, any>): string} template
6
- * A function that returns the HTML template string for the component.
10
+ * Required function that defines the component's HTML structure.
11
+ * Receives the merged context (props + setup data) and must return an HTML template string.
12
+ * Supports dynamic expressions using {{ }} syntax for reactive data binding.
13
+ *
7
14
  * @property {function(Object<string, any>): string} [style]
8
- * An optional function that returns scoped CSS styles as a string.
15
+ * Optional function that defines component-scoped CSS styles.
16
+ * Receives the merged context and returns a CSS string that will be automatically scoped to the component.
17
+ * Styles are injected into the component's container and only affect elements within it.
18
+ *
9
19
  * @property {Object<string, ComponentDefinition>} [children]
10
- * An optional mapping of CSS selectors to child component definitions.
20
+ * Optional object that defines nested child components.
21
+ * Keys are CSS selectors that match elements in the template where child components should be mounted.
22
+ * Values are ComponentDefinition objects that define the structure and behavior of each child component.
11
23
  */
12
24
  /**
13
25
  * @class 🧩 Eleva
@@ -24,24 +36,26 @@ export class Eleva {
24
36
  constructor(name: string, config?: {
25
37
  [x: string]: any;
26
38
  });
27
- /** @type {string} */
39
+ /** @type {string} The unique identifier name for this Eleva instance */
28
40
  name: string;
29
- /** @type {Object<string, any>} */
41
+ /** @type {Object<string, any>} Optional configuration object for the Eleva instance */
30
42
  config: {
31
43
  [x: string]: any;
32
44
  };
33
- /** @type {Object<string, ComponentDefinition>} */
45
+ /** @type {Object<string, ComponentDefinition>} Object storing registered component definitions by name */
34
46
  _components: {
35
47
  [x: string]: ComponentDefinition;
36
48
  };
37
- /** @type {Array<Object>} */
38
- _plugins: Array<Object>;
39
- /** @private */
49
+ /** @private {Array<Object>} Collection of installed plugin instances */
50
+ private _plugins;
51
+ /** @private {string[]} Array of lifecycle hook names supported by the component */
40
52
  private _lifecycleHooks;
41
- /** @private {boolean} */
53
+ /** @private {boolean} Flag indicating if component is currently mounted */
42
54
  private _isMounted;
43
- emitter: Emitter;
44
- renderer: Renderer;
55
+ /** @private {Emitter} Instance of the event emitter for handling component events */
56
+ private emitter;
57
+ /** @private {Renderer} Instance of the renderer for handling DOM updates and patching */
58
+ private renderer;
45
59
  /**
46
60
  * Integrates a plugin with the Eleva framework.
47
61
  *
@@ -107,9 +121,14 @@ export class Eleva {
107
121
  */
108
122
  private _mountChildren;
109
123
  }
124
+ /**
125
+ * Defines the structure and behavior of a component.
126
+ */
110
127
  export type ComponentDefinition = {
111
128
  /**
112
- * A setup function that initializes the component state and returns an object or a promise that resolves to an object.
129
+ * Optional setup function that initializes the component's reactive state and lifecycle.
130
+ * Receives props and context as an argument and should return an object containing the component's state.
131
+ * Can return either a synchronous object or a Promise that resolves to an object for async initialization.
113
132
  */
114
133
  setup?: ((arg0: {
115
134
  [x: string]: any;
@@ -119,24 +138,28 @@ export type ComponentDefinition = {
119
138
  [x: string]: any;
120
139
  }>)) | undefined;
121
140
  /**
122
- * A function that returns the HTML template string for the component.
141
+ * Required function that defines the component's HTML structure.
142
+ * Receives the merged context (props + setup data) and must return an HTML template string.
143
+ * Supports dynamic expressions using {{ }} syntax for reactive data binding.
123
144
  */
124
145
  template: (arg0: {
125
146
  [x: string]: any;
126
147
  }) => string;
127
148
  /**
128
- * An optional function that returns scoped CSS styles as a string.
149
+ * Optional function that defines component-scoped CSS styles.
150
+ * Receives the merged context and returns a CSS string that will be automatically scoped to the component.
151
+ * Styles are injected into the component's container and only affect elements within it.
129
152
  */
130
153
  style?: ((arg0: {
131
154
  [x: string]: any;
132
155
  }) => string) | undefined;
133
156
  /**
134
- * An optional mapping of CSS selectors to child component definitions.
157
+ * Optional object that defines nested child components.
158
+ * Keys are CSS selectors that match elements in the template where child components should be mounted.
159
+ * Values are ComponentDefinition objects that define the structure and behavior of each child component.
135
160
  */
136
161
  children?: {
137
162
  [x: string]: ComponentDefinition;
138
163
  } | undefined;
139
164
  };
140
- import { Emitter } from "../modules/Emitter.js";
141
- import { Renderer } from "../modules/Renderer.js";
142
165
  //# sourceMappingURL=Eleva.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Eleva.d.ts","sourceRoot":"","sources":["../../src/core/Eleva.js"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH;IACE;;;;;OAKG;IACH,kBAHW,MAAM;;OAwBhB;IApBC,qBAAqB;IACrB,MADW,MAAM,CACD;IAChB,kCAAkC;IAClC;;MAAoB;IACpB,kDAAkD;IAClD;;MAAqB;IACrB,4BAA4B;IAC5B,UADW,KAAK,CAAC,MAAM,CAAC,CACN;IAClB,eAAe;IACf,wBAMC;IACD,yBAAyB;IACzB,mBAAuB;IACvB,iBAA4B;IAC5B,mBAA8B;IAGhC;;;;;;OAMG;IACH,YAJW,MAAM;;QAEJ,KAAK,CAQjB;IAED;;;;;;OAMG;IACH,gBAJW,MAAM,cACN,mBAAmB,GACjB,KAAK,CAKjB;IAED;;;;;;;;OAQG;IACH,iBANW,WAAW,YACX,MAAM,GAAC,mBAAmB;;QAExB,MAAM,GAAC,OAAO,CAAC,MAAM,CAAC,CA2FlC;IAED;;;;;OAKG;IACH,+BAKC;IAED;;;;;;OAMG;IACH,uBAaC;IAED;;;;;;;;OAQG;IACH,sBAYC;IAED;;;;;;;OAOG;IACH,uBAgBC;CACF;;;;;;;UA9P4C,CAAC;YAAO,MAAM,GAAE,GAAG;KAAC,GAAC,OAAO,CAAC;YAAO,MAAM,GAAE,GAAG;KAAC,CAAC,CAAC;;;;cAEjF,CAAS,IAAmB,EAAnB;YAAO,MAAM,GAAE,GAAG;KAAC,KAAG,MAAM;;;;;;UAEN,MAAM;;;;;;;;wBAT3B,uBAAuB;yBACtB,wBAAwB"}
1
+ {"version":3,"file":"Eleva.d.ts","sourceRoot":"","sources":["../../src/core/Eleva.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;GAIG;AACH;IACE;;;;;OAKG;IACH,kBAHW,MAAM;;OA0BhB;IAtBC,wEAAwE;IACxE,MADW,MAAM,CACD;IAChB,uFAAuF;IACvF;;MAAoB;IACpB,0GAA0G;IAC1G;;MAAqB;IACrB,wEAAwE;IACxE,iBAAkB;IAClB,mFAAmF;IACnF,wBAMC;IACD,2EAA2E;IAC3E,mBAAuB;IACvB,qFAAqF;IACrF,gBAA4B;IAC5B,yFAAyF;IACzF,iBAA8B;IAGhC;;;;;;OAMG;IACH,YAJW,MAAM;;QAEJ,KAAK,CAQjB;IAED;;;;;;OAMG;IACH,gBAJW,MAAM,cACN,mBAAmB,GACjB,KAAK,CAKjB;IAED;;;;;;;;OAQG;IACH,iBANW,WAAW,YACX,MAAM,GAAC,mBAAmB;;QAExB,MAAM,GAAC,OAAO,CAAC,MAAM,CAAC,CAgHlC;IAED;;;;;OAKG;IACH,+BAKC;IAED;;;;;;OAMG;IACH,uBAaC;IAED;;;;;;;;OAQG;IACH,sBAYC;IAED;;;;;;;OAOG;IACH,uBAgBC;CACF;;;;;;;;;;;;UAhS4C,CAAC;YAAO,MAAM,GAAE,GAAG;KAAC,GAAC,OAAO,CAAC;YAAO,MAAM,GAAE,GAAG;KAAC,CAAC,CAAC;;;;;;cAKjF,CAAS,IAAmB,EAAnB;YAAO,MAAM,GAAE,GAAG;KAAC,KAAG,MAAM;;;;;;;;UAKN,MAAM"}
@@ -5,7 +5,7 @@
5
5
  * to communicate through custom events.
6
6
  */
7
7
  export class Emitter {
8
- /** @type {Object.<string, Function[]>} */
8
+ /** @type {Object.<string, Function[]>} Storage for event handlers mapped by event name */
9
9
  events: {
10
10
  [x: string]: Function[];
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Emitter.d.ts","sourceRoot":"","sources":["../../src/modules/Emitter.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;IAKI,0CAA0C;IAC1C;;MAAgB;IAGlB;;;;;OAKG;IACH,UAHW,MAAM,WACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAG,IAAI,QAIhC;IAED;;;;;OAKG;IACH,WAHW,MAAM,WACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAG,IAAI,QAMhC;IAED;;;;;OAKG;IACH,YAHW,MAAM,WACH,GAAG,EAAA,QAIhB;CACF"}
1
+ {"version":3,"file":"Emitter.d.ts","sourceRoot":"","sources":["../../src/modules/Emitter.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;IAKI,0FAA0F;IAC1F;;MAAgB;IAGlB;;;;;OAKG;IACH,UAHW,MAAM,WACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAG,IAAI,QAIhC;IAED;;;;;OAKG;IACH,WAHW,MAAM,WACN,IAAS,IAAM,EAAH,GAAG,EAAA,KAAG,IAAI,QAMhC;IAED;;;;;OAKG;IACH,YAHW,MAAM,WACH,GAAG,EAAA,QAIhB;CACF"}
@@ -11,8 +11,10 @@ export class Signal {
11
11
  * @param {*} value - The initial value of the signal.
12
12
  */
13
13
  constructor(value: any);
14
- _value: any;
15
- _watchers: Set<any>;
14
+ /** @private {*} Internal storage for the signal's current value */
15
+ private _value;
16
+ /** @private {Set<function>} Collection of callback functions to be notified when value changes */
17
+ private _watchers;
16
18
  /**
17
19
  * Sets a new value for the signal and notifies all registered watchers if the value has changed.
18
20
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../src/modules/Signal.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;IACE;;;;OAIG;IACH,mBAFW,GAAC,EAKX;IAFC,YAAmB;IACnB,oBAA0B;IAY5B;;;;OAIG;IACH,kBAFW,GAAC,EAOX;IAnBD;;;;OAIG;IACH,aAFa,GAAC,CAIb;IAcD;;;;;OAKG;IACH,UAHW,CAAS,IAAG,EAAH,GAAG,KAAG,IAAI,GACjB,MAAY,OAAO,CAK/B;CACF"}
1
+ {"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../src/modules/Signal.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH;IACE;;;;OAIG;IACH,mBAFW,GAAC,EAOX;IAJC,mEAAmE;IACnE,eAAmB;IACnB,kGAAkG;IAClG,kBAA0B;IAY5B;;;;OAIG;IACH,kBAFW,GAAC,EAOX;IAnBD;;;;OAIG;IACH,aAFa,GAAC,CAIb;IAcD;;;;;OAKG;IACH,UAHW,CAAS,IAAG,EAAH,GAAG,KAAG,IAAI,GACjB,MAAY,OAAO,CAK/B;CACF"}