eleva 1.0.0-alpha → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +186 -137
- package/dist/eleva.cjs.js +978 -0
- package/dist/eleva.cjs.js.map +1 -0
- package/dist/eleva.d.ts +521 -79
- package/dist/eleva.esm.js +751 -265
- package/dist/eleva.esm.js.map +1 -1
- package/dist/eleva.umd.js +751 -265
- package/dist/eleva.umd.js.map +1 -1
- package/dist/eleva.umd.min.js +3 -0
- package/dist/eleva.umd.min.js.map +1 -0
- package/package.json +188 -62
- package/src/core/Eleva.js +388 -140
- package/src/modules/Emitter.js +64 -18
- package/src/modules/Renderer.js +257 -85
- package/src/modules/Signal.js +55 -13
- package/src/modules/TemplateEngine.js +45 -27
- package/types/core/Eleva.d.ts +317 -48
- package/types/core/Eleva.d.ts.map +1 -1
- package/types/modules/Emitter.d.ts +51 -19
- package/types/modules/Emitter.d.ts.map +1 -1
- package/types/modules/Renderer.d.ts +86 -12
- package/types/modules/Renderer.d.ts.map +1 -1
- package/types/modules/Signal.d.ts +48 -16
- package/types/modules/Signal.d.ts.map +1 -1
- package/types/modules/TemplateEngine.d.ts +38 -14
- package/types/modules/TemplateEngine.d.ts.map +1 -1
- package/dist/eleva.min.js +0 -2
- package/dist/eleva.min.js.map +0 -1
|
@@ -1,30 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🎨 Renderer
|
|
2
|
+
* @class 🎨 Renderer
|
|
3
|
+
* @classdesc A high-performance DOM renderer that implements an optimized direct DOM diffing algorithm.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Key features:
|
|
6
|
+
* - Single-pass diffing algorithm for efficient DOM updates
|
|
7
|
+
* - Key-based node reconciliation for optimal performance
|
|
8
|
+
* - Intelligent attribute handling for ARIA, data attributes, and boolean properties
|
|
9
|
+
* - Preservation of special Eleva-managed instances and style elements
|
|
10
|
+
* - Memory-efficient with reusable temporary containers
|
|
11
|
+
*
|
|
12
|
+
* The renderer is designed to minimize DOM operations while maintaining
|
|
13
|
+
* exact attribute synchronization and proper node identity preservation.
|
|
14
|
+
* It's particularly optimized for frequent updates and complex DOM structures.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const renderer = new Renderer();
|
|
18
|
+
* const container = document.getElementById("app");
|
|
19
|
+
* const newHtml = "<div>Updated content</div>";
|
|
20
|
+
* renderer.patchDOM(container, newHtml);
|
|
6
21
|
*/
|
|
7
22
|
export class Renderer {
|
|
8
23
|
/**
|
|
9
|
-
*
|
|
24
|
+
* A temporary container to hold the new HTML content while diffing.
|
|
25
|
+
* @private
|
|
26
|
+
* @type {HTMLElement}
|
|
27
|
+
*/
|
|
28
|
+
private _tempContainer;
|
|
29
|
+
/**
|
|
30
|
+
* Patches the DOM of the given container with the provided HTML string.
|
|
10
31
|
*
|
|
32
|
+
* @public
|
|
11
33
|
* @param {HTMLElement} container - The container element to patch.
|
|
12
|
-
* @param {string} newHtml - The new HTML
|
|
34
|
+
* @param {string} newHtml - The new HTML string.
|
|
35
|
+
* @returns {void}
|
|
36
|
+
* @throws {TypeError} If container is not an HTMLElement or newHtml is not a string.
|
|
37
|
+
* @throws {Error} If DOM patching fails.
|
|
13
38
|
*/
|
|
14
|
-
patchDOM(container: HTMLElement, newHtml: string): void;
|
|
39
|
+
public patchDOM(container: HTMLElement, newHtml: string): void;
|
|
15
40
|
/**
|
|
16
|
-
*
|
|
41
|
+
* Performs a diff between two DOM nodes and patches the old node to match the new node.
|
|
17
42
|
*
|
|
43
|
+
* @private
|
|
18
44
|
* @param {HTMLElement} oldParent - The original DOM element.
|
|
19
45
|
* @param {HTMLElement} newParent - The new DOM element.
|
|
46
|
+
* @returns {void}
|
|
47
|
+
*/
|
|
48
|
+
private _diff;
|
|
49
|
+
/**
|
|
50
|
+
* Patches a single node.
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
* @param {Node} oldNode - The original DOM node.
|
|
54
|
+
* @param {Node} newNode - The new DOM node.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
private _patchNode;
|
|
58
|
+
/**
|
|
59
|
+
* Removes a node from its parent.
|
|
60
|
+
*
|
|
61
|
+
* @private
|
|
62
|
+
* @param {HTMLElement} parent - The parent element containing the node to remove.
|
|
63
|
+
* @param {Node} node - The node to remove.
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
private _removeNode;
|
|
67
|
+
/**
|
|
68
|
+
* Updates the attributes of an element to match a new element's attributes.
|
|
69
|
+
*
|
|
70
|
+
* @private
|
|
71
|
+
* @param {HTMLElement} oldEl - The original element to update.
|
|
72
|
+
* @param {HTMLElement} newEl - The new element to update.
|
|
73
|
+
* @returns {void}
|
|
74
|
+
*/
|
|
75
|
+
private _updateAttributes;
|
|
76
|
+
/**
|
|
77
|
+
* Determines if two nodes are the same based on their type, name, and key attributes.
|
|
78
|
+
*
|
|
79
|
+
* @private
|
|
80
|
+
* @param {Node} oldNode - The first node to compare.
|
|
81
|
+
* @param {Node} newNode - The second node to compare.
|
|
82
|
+
* @returns {boolean} True if the nodes are considered the same, false otherwise.
|
|
83
|
+
*/
|
|
84
|
+
private _isSameNode;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a key map for the children of a parent node.
|
|
87
|
+
*
|
|
88
|
+
* @private
|
|
89
|
+
* @param {Array<Node>} children - The children of the parent node.
|
|
90
|
+
* @param {number} start - The start index of the children.
|
|
91
|
+
* @param {number} end - The end index of the children.
|
|
92
|
+
* @returns {Map<string, Node>} A key map for the children.
|
|
20
93
|
*/
|
|
21
|
-
|
|
94
|
+
private _createKeyMap;
|
|
22
95
|
/**
|
|
23
|
-
*
|
|
96
|
+
* Extracts the key attribute from a node if it exists.
|
|
24
97
|
*
|
|
25
|
-
* @
|
|
26
|
-
* @param {
|
|
98
|
+
* @private
|
|
99
|
+
* @param {Node} node - The node to extract the key from.
|
|
100
|
+
* @returns {string|null} The key attribute value or null if not found.
|
|
27
101
|
*/
|
|
28
|
-
|
|
102
|
+
private _getNodeKey;
|
|
29
103
|
}
|
|
30
104
|
//# sourceMappingURL=Renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../src/modules/Renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../src/modules/Renderer.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAMI;;;;OAIG;IACH,uBAAmD;IAGrD;;;;;;;;;OASG;IACH,2BANW,WAAW,WACX,MAAM,GACJ,IAAI,CAkBhB;IAED;;;;;;;OAOG;IACH,cAoDC;IAED;;;;;;;OAOG;IACH,mBAiBC;IAED;;;;;;;OAOG;IACH,oBAIC;IAED;;;;;;;OAOG;IACH,0BA8CC;IAED;;;;;;;OAOG;IACH,oBAoBC;IAED;;;;;;;;OAQG;IACH,sBAQC;IAED;;;;;;OAMG;IACH,oBAIC;CACF"}
|
|
@@ -1,36 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ⚡ Signal
|
|
2
|
+
* @class ⚡ Signal
|
|
3
|
+
* @classdesc A reactive data holder that enables fine-grained reactivity in the Eleva framework.
|
|
4
|
+
* Signals notify registered watchers when their value changes, enabling efficient DOM updates
|
|
5
|
+
* through targeted patching rather than full re-renders.
|
|
6
|
+
* Updates are batched using microtasks to prevent multiple synchronous notifications.
|
|
7
|
+
* The class is generic, allowing type-safe handling of any value type T.
|
|
3
8
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
9
|
+
* @example
|
|
10
|
+
* const count = new Signal(0);
|
|
11
|
+
* count.watch((value) => console.log(`Count changed to: ${value}`));
|
|
12
|
+
* count.value = 1; // Logs: "Count changed to: 1"
|
|
13
|
+
* @template T
|
|
6
14
|
*/
|
|
7
|
-
export class Signal {
|
|
15
|
+
export class Signal<T> {
|
|
8
16
|
/**
|
|
9
|
-
* Creates a new Signal instance.
|
|
17
|
+
* Creates a new Signal instance with the specified initial value.
|
|
10
18
|
*
|
|
11
|
-
* @
|
|
19
|
+
* @public
|
|
20
|
+
* @param {T} value - The initial value of the signal.
|
|
12
21
|
*/
|
|
13
|
-
constructor(value:
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
constructor(value: T);
|
|
23
|
+
/** @private {T} Internal storage for the signal's current value */
|
|
24
|
+
private _value;
|
|
25
|
+
/** @private {Set<(value: T) => void>} Collection of callback functions to be notified when value changes */
|
|
26
|
+
private _watchers;
|
|
27
|
+
/** @private {boolean} Flag to prevent multiple synchronous watcher notifications and batch updates into microtasks */
|
|
28
|
+
private _pending;
|
|
16
29
|
/**
|
|
17
30
|
* Sets a new value for the signal and notifies all registered watchers if the value has changed.
|
|
31
|
+
* The notification is batched using microtasks to prevent multiple synchronous updates.
|
|
18
32
|
*
|
|
19
|
-
* @
|
|
33
|
+
* @public
|
|
34
|
+
* @param {T} newVal - The new value to set.
|
|
35
|
+
* @returns {void}
|
|
20
36
|
*/
|
|
21
|
-
set value(newVal:
|
|
37
|
+
public set value(newVal: T);
|
|
22
38
|
/**
|
|
23
39
|
* Gets the current value of the signal.
|
|
24
40
|
*
|
|
25
|
-
* @
|
|
41
|
+
* @public
|
|
42
|
+
* @returns {T} The current value.
|
|
26
43
|
*/
|
|
27
|
-
get value():
|
|
44
|
+
public get value(): T;
|
|
28
45
|
/**
|
|
29
46
|
* Registers a watcher function that will be called whenever the signal's value changes.
|
|
47
|
+
* The watcher will receive the new value as its argument.
|
|
30
48
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @
|
|
49
|
+
* @public
|
|
50
|
+
* @param {(value: T) => void} fn - The callback function to invoke on value change.
|
|
51
|
+
* @returns {() => boolean} A function to unsubscribe the watcher.
|
|
52
|
+
* @example
|
|
53
|
+
* const unsubscribe = signal.watch((value) => console.log(value));
|
|
54
|
+
* // Later...
|
|
55
|
+
* unsubscribe(); // Stops watching for changes
|
|
33
56
|
*/
|
|
34
|
-
watch(fn:
|
|
57
|
+
public watch(fn: (value: T) => void): () => boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Notifies all registered watchers of a value change using microtask scheduling.
|
|
60
|
+
* Uses a pending flag to batch multiple synchronous updates into a single notification.
|
|
61
|
+
* All watcher callbacks receive the current value when executed.
|
|
62
|
+
*
|
|
63
|
+
* @private
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
private _notify;
|
|
35
67
|
}
|
|
36
68
|
//# sourceMappingURL=Signal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../src/modules/Signal.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"Signal.d.ts","sourceRoot":"","sources":["../../src/modules/Signal.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,oBAFa,CAAC;IAGZ;;;;;OAKG;IACH,mBAFW,CAAC,EASX;IANC,mEAAmE;IACnE,eAAmB;IACnB,4GAA4G;IAC5G,kBAA0B;IAC1B,sHAAsH;IACtH,iBAAqB;IAavB;;;;;;;OAOG;IACH,yBAHW,CAAC,EAQX;IAvBD;;;;;OAKG;IACH,oBAFa,CAAC,CAIb;IAiBD;;;;;;;;;;;OAWG;IACH,iBAPW,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAChB,MAAM,OAAO,CASzB;IAED;;;;;;;OAOG;IACH,gBASC;CACF"}
|
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🔒 TemplateEngine
|
|
2
|
+
* @class 🔒 TemplateEngine
|
|
3
|
+
* @classdesc A secure template engine that handles interpolation and dynamic attribute parsing.
|
|
4
|
+
* Provides a safe way to evaluate expressions in templates while preventing XSS attacks.
|
|
5
|
+
* All methods are static and can be called directly on the class.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
+
* @example
|
|
8
|
+
* const template = "Hello, {{name}}!";
|
|
9
|
+
* const data = { name: "World" };
|
|
10
|
+
* const result = TemplateEngine.parse(template, data); // Returns: "Hello, World!"
|
|
7
11
|
*/
|
|
8
12
|
export class TemplateEngine {
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
14
|
+
* @private {RegExp} Regular expression for matching template expressions in the format {{ expression }}
|
|
15
|
+
* @type {RegExp}
|
|
16
|
+
*/
|
|
17
|
+
private static expressionPattern;
|
|
18
|
+
/**
|
|
19
|
+
* Parses a template string, replacing expressions with their evaluated values.
|
|
20
|
+
* Expressions are evaluated in the provided data context.
|
|
11
21
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
22
|
+
* @public
|
|
23
|
+
* @static
|
|
24
|
+
* @param {string} template - The template string to parse.
|
|
25
|
+
* @param {Record<string, unknown>} data - The data context for evaluating expressions.
|
|
26
|
+
* @returns {string} The parsed template with expressions replaced by their values.
|
|
27
|
+
* @example
|
|
28
|
+
* const result = TemplateEngine.parse("{{user.name}} is {{user.age}} years old", {
|
|
29
|
+
* user: { name: "John", age: 30 }
|
|
30
|
+
* }); // Returns: "John is 30 years old"
|
|
15
31
|
*/
|
|
16
|
-
static parse(template: string, data:
|
|
32
|
+
public static parse(template: string, data: Record<string, unknown>): string;
|
|
17
33
|
/**
|
|
18
|
-
* Evaluates an expression
|
|
34
|
+
* Evaluates an expression in the context of the provided data object.
|
|
35
|
+
* Note: This does not provide a true sandbox and evaluated expressions may access global scope.
|
|
36
|
+
* The use of the `with` statement is necessary for expression evaluation but has security implications.
|
|
37
|
+
* Expressions should be carefully validated before evaluation.
|
|
19
38
|
*
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
39
|
+
* @public
|
|
40
|
+
* @static
|
|
41
|
+
* @param {string} expression - The expression to evaluate.
|
|
42
|
+
* @param {Record<string, unknown>} data - The data context for evaluation.
|
|
43
|
+
* @returns {unknown} The result of the evaluation, or an empty string if evaluation fails.
|
|
44
|
+
* @example
|
|
45
|
+
* const result = TemplateEngine.evaluate("user.name", { user: { name: "John" } }); // Returns: "John"
|
|
46
|
+
* const age = TemplateEngine.evaluate("user.age", { user: { age: 30 } }); // Returns: 30
|
|
23
47
|
*/
|
|
24
|
-
static evaluate(
|
|
48
|
+
public static evaluate(expression: string, data: Record<string, unknown>): unknown;
|
|
25
49
|
}
|
|
26
50
|
//# sourceMappingURL=TemplateEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEngine.d.ts","sourceRoot":"","sources":["../../src/modules/TemplateEngine.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"TemplateEngine.d.ts","sourceRoot":"","sources":["../../src/modules/TemplateEngine.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH;IACE;;;OAGG;IACH,iCAAkD;IAElD;;;;;;;;;;;;;OAaG;IACH,8BARW,MAAM,QACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrB,MAAM,CAWlB;IAED;;;;;;;;;;;;;;OAcG;IACH,mCAPW,MAAM,QACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrB,OAAO,CAYnB;CACF"}
|
package/dist/eleva.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Eleva=t()}(this,(function(){"use strict";class e{static parse(e,t){return e.replace(/\{\{\s*(.*?)\s*\}\}/g,((e,n)=>{const o=this.evaluate(n,t);return void 0===o?"":o}))}static evaluate(e,t){try{const n=Object.keys(t),o=n.map((e=>t[e])),s=new Function(...n,`return ${e}`)(...o);return void 0===s?"":s}catch(n){return console.error("Template evaluation error:",{expression:e,data:t,error:n.message}),""}}}class t{constructor(e){this._value=e,this._watchers=new Set}get value(){return this._value}set value(e){e!==this._value&&(this._value=e,this._watchers.forEach((t=>t(e))))}watch(e){return this._watchers.add(e),()=>this._watchers.delete(e)}}class n{constructor(){this.events={}}on(e,t){(this.events[e]||(this.events[e]=[])).push(t)}off(e,t){this.events[e]&&(this.events[e]=this.events[e].filter((e=>e!==t)))}emit(e,...t){(this.events[e]||[]).forEach((e=>e(...t)))}}class o{patchDOM(e,t){const n=document.createElement("div");n.innerHTML=t,this.diff(e,n)}diff(e,t){const n=Array.from(e.childNodes),o=Array.from(t.childNodes),s=Math.max(n.length,o.length);for(let t=0;t<s;t++){const s=n[t],r=o[t];if(s||!r)if(!s||r){if(s.nodeType===Node.ELEMENT_NODE&&r.nodeType===Node.ELEMENT_NODE){const t=s.getAttribute("key"),n=r.getAttribute("key");if((t||n)&&t!==n){e.replaceChild(r.cloneNode(!0),s);continue}}s.nodeType===r.nodeType&&s.nodeName===r.nodeName?s.nodeType!==Node.TEXT_NODE?s.nodeType===Node.ELEMENT_NODE&&(this.updateAttributes(s,r),this.diff(s,r)):s.nodeValue!==r.nodeValue&&(s.nodeValue=r.nodeValue):e.replaceChild(r.cloneNode(!0),s)}else e.removeChild(s);else e.appendChild(r.cloneNode(!0))}}updateAttributes(e,t){const n={value:"value",checked:"checked",selected:"selected",disabled:"disabled"};Array.from(e.attributes).forEach((n=>{n.name.startsWith("@")||t.hasAttribute(n.name)||e.removeAttribute(n.name)})),Array.from(t.attributes).forEach((t=>{t.name.startsWith("@")||e.getAttribute(t.name)!==t.value&&(e.setAttribute(t.name,t.value),n[t.name]?e[n[t.name]]=t.value:t.name in e&&(e[t.name]=t.value))}))}}return class{constructor(e,t={}){this.name=e,this.config=t,this._components={},this._plugins=[],this._lifecycleHooks=["onBeforeMount","onMount","onBeforeUpdate","onUpdate","onUnmount"],this._isMounted=!1,this.emitter=new n,this.renderer=new o}use(e,t={}){return"function"==typeof e.install&&e.install(this,t),this._plugins.push(e),this}component(e,t){return this._components[e]=t,this}mount(n,o,s={}){const r="string"==typeof n?document.querySelector(n):n;if(!r)throw new Error(`Container not found: ${n}`);const i=this._components[o];if(!i)throw new Error(`Component "${o}" not registered.`);const{setup:a,template:c,style:u,children:l}=i,h={props:s,emit:this.emitter.emit.bind(this.emitter),on:this.emitter.on.bind(this.emitter),signal:e=>new t(e),...this._prepareLifecycleHooks()},d=n=>{const s={...h,...n},i=[],a=[];this._isMounted?s.onBeforeUpdate&&s.onBeforeUpdate():s.onBeforeMount&&s.onBeforeMount();const d=()=>{const t=e.parse(c(s),s);this.renderer.patchDOM(r,t),this._processEvents(r,s),this._injectStyles(r,o,u,s),this._mountChildren(r,l,a),this._isMounted?s.onUpdate&&s.onUpdate():(s.onMount&&s.onMount(),this._isMounted=!0)};return Object.values(n).forEach((e=>{e instanceof t&&i.push(e.watch(d))})),d(),{container:r,data:s,unmount:()=>{i.forEach((e=>e())),a.forEach((e=>e.unmount())),s.onUnmount&&s.onUnmount(),r.innerHTML=""}}},f=a(h);if(f&&"function"==typeof f.then)return f.then((e=>d(e)));return d(f||{})}_prepareLifecycleHooks(){return this._lifecycleHooks.reduce(((e,t)=>(e[t]=()=>{},e)),{})}_processEvents(t,n){t.querySelectorAll("*").forEach((t=>{[...t.attributes].forEach((({name:o,value:s})=>{if(o.startsWith("@")){const r=o.slice(1),i=e.evaluate(s,n);"function"==typeof i&&(t.addEventListener(r,i),t.removeAttribute(o))}}))}))}_injectStyles(t,n,o,s){if(o){let r=t.querySelector(`style[data-eleva-style="${n}"]`);r||(r=document.createElement("style"),r.setAttribute("data-eleva-style",n),t.appendChild(r)),r.textContent=e.parse(o(s),s)}}_mountChildren(e,t,n){n.forEach((e=>e.unmount())),n.length=0,Object.keys(t||{}).forEach((t=>{e.querySelectorAll(t).forEach((e=>{const o={};[...e.attributes].forEach((({name:e,value:t})=>{e.startsWith("eleva-prop-")&&(o[e.slice(11)]=t)}));const s=this.mount(e,t,o);n.push(s)}))}))}}}));
|
|
2
|
-
//# sourceMappingURL=eleva.min.js.map
|
package/dist/eleva.min.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eleva.min.js","sources":["../src/modules/TemplateEngine.js","../src/modules/Signal.js","../src/modules/Emitter.js","../src/modules/Renderer.js","../src/core/Eleva.js"],"sourcesContent":["\"use strict\";\n\n/**\n * 🔒 TemplateEngine: Secure interpolation & dynamic attribute parsing.\n *\n * This class provides methods to parse template strings by replacing\n * interpolation expressions with dynamic data values and to evaluate expressions\n * within a given data context.\n */\nexport class TemplateEngine {\n /**\n * Parses a template string and replaces interpolation expressions with corresponding values.\n *\n * @param {string} template - The template string containing expressions in the format {{ expression }}.\n * @param {object} data - The data object to use for evaluating expressions.\n * @returns {string} The resulting string with evaluated values.\n */\n static parse(template, data) {\n return template.replace(/\\{\\{\\s*(.*?)\\s*\\}\\}/g, (_, expr) => {\n const value = this.evaluate(expr, data);\n return value === undefined ? \"\" : value;\n });\n }\n\n /**\n * Evaluates an expression using the provided data context.\n *\n * @param {string} expr - The JavaScript expression to evaluate.\n * @param {object} data - The data context for evaluating the expression.\n * @returns {*} The result of the evaluated expression, or an empty string if undefined or on error.\n */\n static evaluate(expr, data) {\n try {\n const keys = Object.keys(data);\n const values = keys.map((k) => data[k]);\n const result = new Function(...keys, `return ${expr}`)(...values);\n return result === undefined ? \"\" : result;\n } catch (error) {\n console.error(`Template evaluation error:`, {\n expression: expr,\n data,\n error: error.message,\n });\n return \"\";\n }\n }\n}\n","\"use strict\";\n\n/**\n * ⚡ Signal: Fine-grained reactivity.\n *\n * A reactive data holder that notifies registered watchers when its value changes,\n * allowing for fine-grained DOM patching rather than full re-renders.\n */\nexport class Signal {\n /**\n * Creates a new Signal instance.\n *\n * @param {*} value - The initial value of the signal.\n */\n constructor(value) {\n this._value = value;\n this._watchers = new Set();\n }\n\n /**\n * Gets the current value of the signal.\n *\n * @returns {*} The current value.\n */\n get value() {\n return this._value;\n }\n\n /**\n * Sets a new value for the signal and notifies all registered watchers if the value has changed.\n *\n * @param {*} newVal - The new value to set.\n */\n set value(newVal) {\n if (newVal !== this._value) {\n this._value = newVal;\n this._watchers.forEach((fn) => fn(newVal));\n }\n }\n\n /**\n * Registers a watcher function that will be called whenever the signal's value changes.\n *\n * @param {Function} fn - The callback function to invoke on value change.\n * @returns {Function} A function to unsubscribe the watcher.\n */\n watch(fn) {\n this._watchers.add(fn);\n return () => this._watchers.delete(fn);\n }\n}\n","\"use strict\";\n\n/**\n * 🎙️ Emitter: Robust inter-component communication with event bubbling.\n *\n * Implements a basic publish-subscribe pattern for event handling,\n * allowing components to communicate through custom events.\n */\nexport class Emitter {\n /**\n * Creates a new Emitter instance.\n */\n constructor() {\n /** @type {Object.<string, Function[]>} */\n this.events = {};\n }\n\n /**\n * Registers an event handler for the specified event.\n *\n * @param {string} event - The name of the event.\n * @param {Function} handler - The function to call when the event is emitted.\n */\n on(event, handler) {\n (this.events[event] || (this.events[event] = [])).push(handler);\n }\n\n /**\n * Removes a previously registered event handler.\n *\n * @param {string} event - The name of the event.\n * @param {Function} handler - The handler function to remove.\n */\n off(event, handler) {\n if (this.events[event]) {\n this.events[event] = this.events[event].filter((h) => h !== handler);\n }\n }\n\n /**\n * Emits an event, invoking all handlers registered for that event.\n *\n * @param {string} event - The event name.\n * @param {...*} args - Additional arguments to pass to the event handlers.\n */\n emit(event, ...args) {\n (this.events[event] || []).forEach((handler) => handler(...args));\n }\n}\n","\"use strict\";\n\n/**\n * 🎨 Renderer: Handles DOM patching, diffing, and attribute updates.\n *\n * Provides methods for efficient DOM updates by diffing the new and old DOM structures\n * and applying only the necessary changes.\n */\nexport class Renderer {\n /**\n * Patches the DOM of a container element with new HTML content.\n *\n * @param {HTMLElement} container - The container element to patch.\n * @param {string} newHtml - The new HTML content to apply.\n */\n patchDOM(container, newHtml) {\n const tempContainer = document.createElement(\"div\");\n tempContainer.innerHTML = newHtml;\n this.diff(container, tempContainer);\n }\n\n /**\n * Diffs two DOM trees (old and new) and applies updates to the old DOM.\n *\n * @param {HTMLElement} oldParent - The original DOM element.\n * @param {HTMLElement} newParent - The new DOM element.\n */\n diff(oldParent, newParent) {\n const oldNodes = Array.from(oldParent.childNodes);\n const newNodes = Array.from(newParent.childNodes);\n const max = Math.max(oldNodes.length, newNodes.length);\n for (let i = 0; i < max; i++) {\n const oldNode = oldNodes[i];\n const newNode = newNodes[i];\n\n // Append new nodes that don't exist in the old tree.\n if (!oldNode && newNode) {\n oldParent.appendChild(newNode.cloneNode(true));\n continue;\n }\n // Remove old nodes not present in the new tree.\n if (oldNode && !newNode) {\n oldParent.removeChild(oldNode);\n continue;\n }\n\n // For element nodes, compare keys if available.\n if (\n oldNode.nodeType === Node.ELEMENT_NODE &&\n newNode.nodeType === Node.ELEMENT_NODE\n ) {\n const oldKey = oldNode.getAttribute(\"key\");\n const newKey = newNode.getAttribute(\"key\");\n if (oldKey || newKey) {\n if (oldKey !== newKey) {\n oldParent.replaceChild(newNode.cloneNode(true), oldNode);\n continue;\n }\n }\n }\n\n // Replace nodes if types or tag names differ.\n if (\n oldNode.nodeType !== newNode.nodeType ||\n oldNode.nodeName !== newNode.nodeName\n ) {\n oldParent.replaceChild(newNode.cloneNode(true), oldNode);\n continue;\n }\n // For text nodes, update content if different.\n if (oldNode.nodeType === Node.TEXT_NODE) {\n if (oldNode.nodeValue !== newNode.nodeValue) {\n oldNode.nodeValue = newNode.nodeValue;\n }\n continue;\n }\n // For element nodes, update attributes and then diff children.\n if (oldNode.nodeType === Node.ELEMENT_NODE) {\n this.updateAttributes(oldNode, newNode);\n this.diff(oldNode, newNode);\n }\n }\n }\n\n /**\n * Updates the attributes of an element to match those of a new element.\n *\n * @param {HTMLElement} oldEl - The element to update.\n * @param {HTMLElement} newEl - The element providing the updated attributes.\n */\n updateAttributes(oldEl, newEl) {\n const attributeToPropertyMap = {\n value: \"value\",\n checked: \"checked\",\n selected: \"selected\",\n disabled: \"disabled\",\n };\n\n // Remove old attributes that no longer exist.\n Array.from(oldEl.attributes).forEach((attr) => {\n if (attr.name.startsWith(\"@\")) return;\n if (!newEl.hasAttribute(attr.name)) {\n oldEl.removeAttribute(attr.name);\n }\n });\n // Add or update attributes from newEl.\n Array.from(newEl.attributes).forEach((attr) => {\n if (attr.name.startsWith(\"@\")) return;\n if (oldEl.getAttribute(attr.name) !== attr.value) {\n oldEl.setAttribute(attr.name, attr.value);\n if (attributeToPropertyMap[attr.name]) {\n oldEl[attributeToPropertyMap[attr.name]] = attr.value;\n } else if (attr.name in oldEl) {\n oldEl[attr.name] = attr.value;\n }\n }\n });\n }\n}\n","\"use strict\";\n\nimport { TemplateEngine } from \"../modules/TemplateEngine.js\";\nimport { Signal } from \"../modules/Signal.js\";\nimport { Emitter } from \"../modules/Emitter.js\";\nimport { Renderer } from \"../modules/Renderer.js\";\n\n/**\n * 🧩 Eleva Core: Signal-based component runtime framework with lifecycle, scoped styles, and plugins.\n *\n * The Eleva class is the core of the framework. It manages component registration,\n * plugin integration, lifecycle hooks, event handling, and DOM rendering.\n */\nexport class Eleva {\n /**\n * Creates a new Eleva instance.\n *\n * @param {string} name - The name of the Eleva instance.\n * @param {object} [config={}] - Optional configuration for the instance.\n */\n constructor(name, config = {}) {\n this.name = name;\n this.config = config;\n this._components = {};\n this._plugins = [];\n this._lifecycleHooks = [\n \"onBeforeMount\",\n \"onMount\",\n \"onBeforeUpdate\",\n \"onUpdate\",\n \"onUnmount\",\n ];\n this._isMounted = false;\n this.emitter = new Emitter();\n this.renderer = new Renderer();\n }\n\n /**\n * Integrates a plugin with the Eleva framework.\n *\n * @param {object} [plugin] - The plugin object which should have an install function.\n * @param {object} [options={}] - Optional options to pass to the plugin.\n * @returns {Eleva} The Eleva instance (for chaining).\n */\n use(plugin, options = {}) {\n if (typeof plugin.install === \"function\") {\n plugin.install(this, options);\n }\n this._plugins.push(plugin);\n return this;\n }\n\n /**\n * Registers a component with the Eleva instance.\n *\n * @param {string} name - The name of the component.\n * @param {object} definition - The component definition including setup, template, style, and children.\n * @returns {Eleva} The Eleva instance (for chaining).\n */\n component(name, definition) {\n this._components[name] = definition;\n return this;\n }\n\n /**\n * Mounts a registered component to a DOM element.\n *\n * @param {string|HTMLElement} selectorOrElement - A CSS selector string or DOM element where the component will be mounted.\n * @param {string} compName - The name of the component to mount.\n * @param {object} [props={}] - Optional properties to pass to the component.\n * @returns {object|Promise<object>} An object representing the mounted component instance, or a Promise that resolves to it for asynchronous setups.\n * @throws Will throw an error if the container or component is not found.\n */\n mount(selectorOrElement, compName, props = {}) {\n const container =\n typeof selectorOrElement === \"string\"\n ? document.querySelector(selectorOrElement)\n : selectorOrElement;\n if (!container)\n throw new Error(`Container not found: ${selectorOrElement}`);\n\n const definition = this._components[compName];\n if (!definition) throw new Error(`Component \"${compName}\" not registered.`);\n\n const { setup, template, style, children } = definition;\n const context = {\n props,\n emit: this.emitter.emit.bind(this.emitter),\n on: this.emitter.on.bind(this.emitter),\n signal: (v) => new Signal(v),\n ...this._prepareLifecycleHooks(),\n };\n\n /**\n * Processes the mounting of the component.\n *\n * @param {object} data - Data returned from the component's setup function.\n * @returns {object} An object with the container, merged context data, and an unmount function.\n */\n const processMount = (data) => {\n const mergedContext = { ...context, ...data };\n const watcherUnsubscribers = [];\n const childInstances = [];\n\n if (!this._isMounted) {\n mergedContext.onBeforeMount && mergedContext.onBeforeMount();\n } else {\n mergedContext.onBeforeUpdate && mergedContext.onBeforeUpdate();\n }\n\n /**\n * Renders the component by parsing the template, patching the DOM,\n * processing events, injecting styles, and mounting child components.\n */\n const render = () => {\n const newHtml = TemplateEngine.parse(\n template(mergedContext),\n mergedContext\n );\n this.renderer.patchDOM(container, newHtml);\n this._processEvents(container, mergedContext);\n this._injectStyles(container, compName, style, mergedContext);\n this._mountChildren(container, children, childInstances);\n if (!this._isMounted) {\n mergedContext.onMount && mergedContext.onMount();\n this._isMounted = true;\n } else {\n mergedContext.onUpdate && mergedContext.onUpdate();\n }\n };\n\n Object.values(data).forEach((val) => {\n if (val instanceof Signal) watcherUnsubscribers.push(val.watch(render));\n });\n\n render();\n\n return {\n container,\n data: mergedContext,\n /**\n * Unmounts the component, cleaning up watchers, child components, and clearing the container.\n */\n unmount: () => {\n watcherUnsubscribers.forEach((fn) => fn());\n childInstances.forEach((child) => child.unmount());\n mergedContext.onUnmount && mergedContext.onUnmount();\n container.innerHTML = \"\";\n },\n };\n };\n\n // Handle asynchronous setup if needed.\n const setupResult = setup(context);\n if (setupResult && typeof setupResult.then === \"function\") {\n return setupResult.then((data) => processMount(data));\n } else {\n const data = setupResult || {};\n return processMount(data);\n }\n }\n\n /**\n * Prepares default no-operation lifecycle hook functions.\n *\n * @returns {object} An object with keys for lifecycle hooks mapped to empty functions.\n * @private\n */\n _prepareLifecycleHooks() {\n return this._lifecycleHooks.reduce((acc, hook) => {\n acc[hook] = () => {};\n return acc;\n }, {});\n }\n\n /**\n * Processes DOM elements for event binding based on attributes starting with \"@\".\n *\n * @param {HTMLElement} container - The container element in which to search for events.\n * @param {object} context - The current context containing event handler definitions.\n * @private\n */\n _processEvents(container, context) {\n container.querySelectorAll(\"*\").forEach((el) => {\n [...el.attributes].forEach(({ name, value }) => {\n if (name.startsWith(\"@\")) {\n const event = name.slice(1);\n const handler = TemplateEngine.evaluate(value, context);\n if (typeof handler === \"function\") {\n el.addEventListener(event, handler);\n el.removeAttribute(name);\n }\n }\n });\n });\n }\n\n /**\n * Injects scoped styles into the component's container.\n *\n * @param {HTMLElement} container - The container element.\n * @param {string} compName - The component name used to identify the style element.\n * @param {Function} styleFn - A function that returns CSS styles as a string.\n * @param {object} context - The current context for style interpolation.\n * @private\n */\n _injectStyles(container, compName, styleFn, context) {\n if (styleFn) {\n let styleEl = container.querySelector(\n `style[data-eleva-style=\"${compName}\"]`\n );\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.setAttribute(\"data-eleva-style\", compName);\n container.appendChild(styleEl);\n }\n styleEl.textContent = TemplateEngine.parse(styleFn(context), context);\n }\n }\n\n /**\n * Mounts child components within the parent component's container.\n *\n * @param {HTMLElement} container - The parent container element.\n * @param {object} children - An object mapping child component selectors to their definitions.\n * @param {Array} childInstances - An array to store the mounted child component instances.\n * @private\n */\n _mountChildren(container, children, childInstances) {\n childInstances.forEach((child) => child.unmount());\n childInstances.length = 0;\n\n Object.keys(children || {}).forEach((childName) => {\n container.querySelectorAll(childName).forEach((childEl) => {\n const props = {};\n [...childEl.attributes].forEach(({ name, value }) => {\n if (name.startsWith(\"eleva-prop-\")) {\n props[name.slice(\"eleva-prop-\".length)] = value;\n }\n });\n const instance = this.mount(childEl, childName, props);\n childInstances.push(instance);\n });\n });\n }\n}\n"],"names":["TemplateEngine","parse","template","data","replace","_","expr","value","this","evaluate","undefined","keys","Object","values","map","k","result","Function","error","console","expression","message","Signal","constructor","_value","_watchers","Set","newVal","forEach","fn","watch","add","delete","Emitter","events","on","event","handler","push","off","filter","h","emit","args","Renderer","patchDOM","container","newHtml","tempContainer","document","createElement","innerHTML","diff","oldParent","newParent","oldNodes","Array","from","childNodes","newNodes","max","Math","length","i","oldNode","newNode","nodeType","Node","ELEMENT_NODE","oldKey","getAttribute","newKey","replaceChild","cloneNode","nodeName","TEXT_NODE","updateAttributes","nodeValue","removeChild","appendChild","oldEl","newEl","attributeToPropertyMap","checked","selected","disabled","attributes","attr","name","startsWith","hasAttribute","removeAttribute","setAttribute","config","_components","_plugins","_lifecycleHooks","_isMounted","emitter","renderer","use","plugin","options","install","component","definition","mount","selectorOrElement","compName","props","querySelector","Error","setup","style","children","context","bind","signal","v","_prepareLifecycleHooks","processMount","mergedContext","watcherUnsubscribers","childInstances","onBeforeUpdate","onBeforeMount","render","_processEvents","_injectStyles","_mountChildren","onUpdate","onMount","val","unmount","child","onUnmount","setupResult","then","reduce","acc","hook","querySelectorAll","el","slice","addEventListener","styleFn","styleEl","textContent","childName","childEl","instance"],"mappings":"sOASO,MAAMA,EAQX,YAAOC,CAAMC,EAAUC,GACrB,OAAOD,EAASE,QAAQ,wBAAwB,CAACC,EAAGC,KACl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