@lightningjs/blits 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/boilerplate/package.json +1 -1
- package/package.json +1 -1
- package/src/element.js +10 -1
- package/src/lib/codegenerator/generator.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
3
|
+
# v0.5.4
|
|
4
|
+
|
|
5
|
+
_5 dec 2023_
|
|
6
|
+
|
|
7
|
+
- Fixed issue with Components and Elements not always being cleaned up in forloop
|
|
8
|
+
- Added support for nested children inside a forloop on an Element
|
|
9
|
+
|
|
10
|
+
# v0.5.3
|
|
11
|
+
|
|
12
|
+
_4 dec 2023_
|
|
13
|
+
|
|
14
|
+
- Added transition `start` and tranition `end` callbacks
|
|
15
|
+
|
|
2
16
|
# v0.5.2
|
|
3
17
|
|
|
4
18
|
_30 nov 2023_
|
package/boilerplate/package.json
CHANGED
package/package.json
CHANGED
package/src/element.js
CHANGED
|
@@ -284,9 +284,17 @@ const Element = {
|
|
|
284
284
|
v: props[prop],
|
|
285
285
|
f,
|
|
286
286
|
timeout: setTimeout(() => {
|
|
287
|
+
value.start &&
|
|
288
|
+
typeof value.start === 'function' &&
|
|
289
|
+
value.start.call(this.component, this, prop, props[prop])
|
|
287
290
|
f.start()
|
|
288
291
|
.waitUntilStopped()
|
|
289
292
|
.then(() => delete this.scheduledTransitions[prop])
|
|
293
|
+
.then(() => {
|
|
294
|
+
value.end &&
|
|
295
|
+
typeof value.end === 'function' &&
|
|
296
|
+
value.end.call(this.component, this, prop, props[prop])
|
|
297
|
+
})
|
|
290
298
|
.then(resolve)
|
|
291
299
|
}, value.delay || 0),
|
|
292
300
|
}
|
|
@@ -295,11 +303,12 @@ const Element = {
|
|
|
295
303
|
},
|
|
296
304
|
}
|
|
297
305
|
|
|
298
|
-
export default (config) =>
|
|
306
|
+
export default (config, component) =>
|
|
299
307
|
Object.assign(Object.create(Element), {
|
|
300
308
|
node: null,
|
|
301
309
|
setProperties: [],
|
|
302
310
|
scheduledTransitions: {},
|
|
303
311
|
initData: {},
|
|
304
312
|
config,
|
|
313
|
+
component,
|
|
305
314
|
})
|
|
@@ -56,7 +56,7 @@ const generateElementCode = function (
|
|
|
56
56
|
|
|
57
57
|
renderCode.push(`
|
|
58
58
|
if(!${elm}) {
|
|
59
|
-
${elm} = this.element({componentId: component[Symbol.for('id')], parent: parent || 'root'})
|
|
59
|
+
${elm} = this.element({componentId: component[Symbol.for('id')], parent: parent || 'root'}, component)
|
|
60
60
|
}
|
|
61
61
|
const elementConfig${counter} = {}
|
|
62
62
|
`)
|
|
@@ -106,7 +106,7 @@ const generateElementCode = function (
|
|
|
106
106
|
`)
|
|
107
107
|
|
|
108
108
|
if (children) {
|
|
109
|
-
generateCode.call(this, { children },
|
|
109
|
+
generateCode.call(this, { children }, `${elm}`, options)
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -181,7 +181,6 @@ const generateComponentCode = function (
|
|
|
181
181
|
}
|
|
182
182
|
`)
|
|
183
183
|
|
|
184
|
-
counter++
|
|
185
184
|
if (children) {
|
|
186
185
|
generateElementCode.call(this, { children }, false, { ...options })
|
|
187
186
|
}
|
|
@@ -217,6 +216,7 @@ const generateForLoopCode = function (templateObject, parent) {
|
|
|
217
216
|
const keys = []
|
|
218
217
|
for(let __index = 0; __index < collection.length; __index++) {
|
|
219
218
|
parent = ${parent}
|
|
219
|
+
if(!component.key) keys.length = 0
|
|
220
220
|
const scope = Object.assign(component, {
|
|
221
221
|
key: Math.random(),
|
|
222
222
|
${index}: __index,
|
|
@@ -264,7 +264,7 @@ const generateForLoopCode = function (templateObject, parent) {
|
|
|
264
264
|
this.effectsCode.push(ctx.renderCode.join('\n'))
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
const generateCode = function (templateObject, parent = false) {
|
|
267
|
+
const generateCode = function (templateObject, parent = false, options = {}) {
|
|
268
268
|
templateObject.children &&
|
|
269
269
|
templateObject.children.forEach((childTemplateObject) => {
|
|
270
270
|
counter++
|
|
@@ -273,9 +273,9 @@ const generateCode = function (templateObject, parent = false) {
|
|
|
273
273
|
generateForLoopCode.call(this, childTemplateObject, parent)
|
|
274
274
|
} else {
|
|
275
275
|
if (childTemplateObject.type === 'Element' || childTemplateObject.type === 'Slot') {
|
|
276
|
-
generateElementCode.call(this, childTemplateObject, parent)
|
|
276
|
+
generateElementCode.call(this, childTemplateObject, parent, options)
|
|
277
277
|
} else {
|
|
278
|
-
generateComponentCode.call(this, childTemplateObject, parent)
|
|
278
|
+
generateComponentCode.call(this, childTemplateObject, parent, options)
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
})
|