eleva 1.2.16-beta → 1.2.17-beta
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 +2 -2
- package/dist/eleva.cjs.js +32 -31
- package/dist/eleva.cjs.js.map +1 -1
- package/dist/eleva.d.ts +9 -9
- package/dist/eleva.esm.js +32 -31
- package/dist/eleva.esm.js.map +1 -1
- package/dist/eleva.umd.js +32 -31
- package/dist/eleva.umd.js.map +1 -1
- package/dist/eleva.umd.min.js +2 -2
- package/dist/eleva.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core/Eleva.js +23 -20
- package/src/modules/Renderer.js +14 -9
- package/types/core/Eleva.d.ts +9 -9
- package/types/core/Eleva.d.ts.map +1 -1
- package/types/modules/Renderer.d.ts.map +1 -1
package/src/modules/Renderer.js
CHANGED
|
@@ -81,6 +81,12 @@ export class Renderer {
|
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
if (oldNode && !newNode) {
|
|
84
|
+
if (
|
|
85
|
+
oldNode.nodeName === "STYLE" &&
|
|
86
|
+
oldNode.hasAttribute("data-e-style")
|
|
87
|
+
) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
84
90
|
oldParent.removeChild(oldNode);
|
|
85
91
|
continue;
|
|
86
92
|
}
|
|
@@ -127,16 +133,8 @@ export class Renderer {
|
|
|
127
133
|
const oldAttrs = oldEl.attributes;
|
|
128
134
|
const newAttrs = newEl.attributes;
|
|
129
135
|
|
|
130
|
-
// Remove old attributes
|
|
131
|
-
for (const { name } of oldAttrs) {
|
|
132
|
-
if (!newEl.hasAttribute(name)) {
|
|
133
|
-
oldEl.removeAttribute(name);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
136
|
// Update/add new attributes
|
|
138
|
-
for (const
|
|
139
|
-
const { name, value } = attr;
|
|
137
|
+
for (const { name, value } of newAttrs) {
|
|
140
138
|
if (name.startsWith("@")) continue;
|
|
141
139
|
|
|
142
140
|
if (oldEl.getAttribute(name) === value) continue;
|
|
@@ -172,5 +170,12 @@ export class Renderer {
|
|
|
172
170
|
}
|
|
173
171
|
}
|
|
174
172
|
}
|
|
173
|
+
|
|
174
|
+
// Remove old attributes
|
|
175
|
+
for (const { name } of oldAttrs) {
|
|
176
|
+
if (!newEl.hasAttribute(name)) {
|
|
177
|
+
oldEl.removeAttribute(name);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
175
180
|
}
|
|
176
181
|
}
|
package/types/core/Eleva.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @typedef {Object} ComponentDefinition
|
|
3
3
|
* @property {function(Object<string, any>): (Object<string, any>|Promise<Object<string, any>>)} [setup]
|
|
4
4
|
* Optional setup function that initializes the component's state and returns reactive data
|
|
5
|
-
* @property {function(Object<string, any>): string|Promise<string
|
|
5
|
+
* @property {(function(Object<string, any>): string|Promise<string>|string)} template
|
|
6
6
|
* Required function that defines the component's HTML structure
|
|
7
|
-
* @property {function(Object<string, any>): string} [style]
|
|
8
|
-
* Optional function that provides component-scoped CSS styles
|
|
7
|
+
* @property {(function(Object<string, any>): string)|string} [style]
|
|
8
|
+
* Optional function or string that provides component-scoped CSS styles
|
|
9
9
|
* @property {Object<string, ComponentDefinition>} [children]
|
|
10
10
|
* Optional object defining nested child components
|
|
11
11
|
*/
|
|
@@ -98,7 +98,7 @@ export class Eleva {
|
|
|
98
98
|
* @example
|
|
99
99
|
* app.component("myButton", {
|
|
100
100
|
* template: (ctx) => `<button>${ctx.props.text}</button>`,
|
|
101
|
-
* style:
|
|
101
|
+
* style: `button { color: blue; }`
|
|
102
102
|
* });
|
|
103
103
|
*/
|
|
104
104
|
public component(name: string, definition: ComponentDefinition): Eleva;
|
|
@@ -151,7 +151,7 @@ export class Eleva {
|
|
|
151
151
|
* @private
|
|
152
152
|
* @param {HTMLElement} container - The container element where styles should be injected.
|
|
153
153
|
* @param {string} compName - The component name used to identify the style element.
|
|
154
|
-
* @param {function(Object<string, any>): string}
|
|
154
|
+
* @param {(function(Object<string, any>): string)|string} styleDef - The component's style definition (function or string).
|
|
155
155
|
* @param {Object<string, any>} context - The current component context for style interpolation.
|
|
156
156
|
* @returns {void}
|
|
157
157
|
*/
|
|
@@ -207,13 +207,13 @@ export type ComponentDefinition = {
|
|
|
207
207
|
/**
|
|
208
208
|
* Required function that defines the component's HTML structure
|
|
209
209
|
*/
|
|
210
|
-
template: (arg0: {
|
|
210
|
+
template: ((arg0: {
|
|
211
211
|
[x: string]: any;
|
|
212
|
-
}) => string | Promise<string
|
|
212
|
+
}) => string | Promise<string> | string);
|
|
213
213
|
/**
|
|
214
|
-
* Optional function that provides component-scoped CSS styles
|
|
214
|
+
* Optional function or string that provides component-scoped CSS styles
|
|
215
215
|
*/
|
|
216
|
-
style?: ((arg0: {
|
|
216
|
+
style?: string | ((arg0: {
|
|
217
217
|
[x: string]: any;
|
|
218
218
|
}) => string) | undefined;
|
|
219
219
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Eleva.d.ts","sourceRoot":"","sources":["../../src/core/Eleva.js"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AACH;IACE;;;;;;;OAOG;IACH,kBAJW,MAAM;;OA8BhB;IAzBC,0EAA0E;IAC1E,oBAAgB;IAChB,yFAAyF;IACzF;;MAAoB;IACpB,oFAAoF;IACpF,wBAA4B;IAC5B,+FAA+F;IAC/F,6BAAoB;IACpB,wFAAwF;IACxF,0BAA8B;IAE9B,gGAAgG;IAChG,oBAA4B;IAC5B,2FAA2F;IAC3F,iBAAyB;IACzB,gFAAgF;IAChF,wBAMC;IACD,oFAAoF;IACpF,mBAAuB;IAGzB;;;;;;;;;;;OAWG;IACH,mBANW,WAAW;;QAET,KAAK,CASjB;IAED;;;;;;;;;;;;;;OAcG;IACH,uBAVW,MAAM,cACN,mBAAmB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AG,MAAM,GAAC,OAAO,CAAC,MAAM,CAAC,GAAC,MAAM,CAAC;;;;;;UAE9B,MAAM;;;;;;;;;;;;aAQtC,CAAS,IAAK,EAAL,KAAK,EAAE,IAAmB,EAAnB;YAAO,MAAM,GAAE,GAAG;KAAC,KAAG,IAAI;;;;UAE1C,MAAM;;;;;;eAMN,WAAW;;;;;;;;;;aAIX,MAAY,IAAI;;wBA7BN,uBAAuB;uBADxB,sBAAsB;yBAEpB,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../src/modules/Renderer.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;IAMI,+EAA+E;IAC/E,uBAAmD;IAGrD;;;;;;;;;;OAUG;IACH,2BALW,WAAW,WACX,MAAM,GACJ,IAAI,CAmBhB;IAED;;;;;;;;;OASG;IACH,
|
|
1
|
+
{"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../src/modules/Renderer.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;IAMI,+EAA+E;IAC/E,uBAAmD;IAGrD;;;;;;;;;;OAUG;IACH,2BALW,WAAW,WACX,MAAM,GACJ,IAAI,CAmBhB;IAED;;;;;;;;;OASG;IACH,cAyDC;IAED;;;;;;;;OAQG;IACH,0BAgDC;CACF"}
|