@lightningjs/blits 1.32.1 → 1.33.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/CHANGELOG.md +10 -0
- package/index.d.ts +9 -0
- package/package.json +1 -1
- package/src/component/base/methods.js +5 -0
- package/src/component/setup/routes.js +9 -12
- package/src/component.js +12 -10
- package/src/components/Circle.js +30 -8
- package/src/components/FPScounter.js +643 -493
- package/src/components/RouterView.js +28 -6
- package/src/components/Sprite.js +30 -8
- package/src/engines/L3/launch.js +3 -2
- package/src/launch.js +1 -0
- package/src/lib/codegenerator/generator.js +84 -40
- package/src/lib/log.js +6 -6
- package/src/lib/symbols.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
_08 Jul 2025_
|
|
4
|
+
|
|
5
|
+
## v1.33.0
|
|
6
|
+
|
|
7
|
+
- Added dereferencing of previousFocus pointer to ensure memory cleanup
|
|
8
|
+
- Improved cleanup of components (via explicit dereference of closure scope)
|
|
9
|
+
- Optimized time function in logger
|
|
10
|
+
- Optimized initial registration of routes
|
|
11
|
+
- Added `maxFPS` launch setting
|
|
12
|
+
|
|
3
13
|
_04 Jul 2025_
|
|
4
14
|
|
|
5
15
|
## v1.32.1
|
package/index.d.ts
CHANGED
|
@@ -1015,6 +1015,15 @@ declare module '@lightningjs/blits' {
|
|
|
1015
1015
|
* @default false
|
|
1016
1016
|
*/
|
|
1017
1017
|
announcer?: boolean
|
|
1018
|
+
/**
|
|
1019
|
+
* Maximum FPS at which the App will be rendered
|
|
1020
|
+
*
|
|
1021
|
+
* Lowering the maximum FPS value can improve the overall experience on lower end devices.
|
|
1022
|
+
* Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering.
|
|
1023
|
+
*
|
|
1024
|
+
* Defaults to `0` which means no maximum
|
|
1025
|
+
*/
|
|
1026
|
+
maxFPS?: number
|
|
1018
1027
|
}
|
|
1019
1028
|
|
|
1020
1029
|
interface State {
|
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ export default {
|
|
|
40
40
|
* @this {import('../../component').BlitsComponent}
|
|
41
41
|
*/
|
|
42
42
|
value: function (e) {
|
|
43
|
+
if (this.eol === true) return
|
|
43
44
|
this[symbols.state].hasFocus = true
|
|
44
45
|
Focus.set(this, e)
|
|
45
46
|
},
|
|
@@ -103,11 +104,15 @@ export default {
|
|
|
103
104
|
delete this.componentId
|
|
104
105
|
delete this[symbols.id]
|
|
105
106
|
delete this.ref
|
|
107
|
+
delete this[symbols.state].hasFocus
|
|
106
108
|
|
|
107
109
|
this[symbols.holder].destroy()
|
|
108
110
|
this[symbols.holder] = null
|
|
109
111
|
delete this[symbols.holder]
|
|
110
112
|
|
|
113
|
+
this[symbols.cleanup]()
|
|
114
|
+
delete this[symbols.cleanup]
|
|
115
|
+
|
|
111
116
|
Log.debug(`Destroyed component ${this.componentId}`)
|
|
112
117
|
},
|
|
113
118
|
writable: false,
|
|
@@ -24,19 +24,16 @@ export default (component, data) => {
|
|
|
24
24
|
routes = data.routes
|
|
25
25
|
}
|
|
26
26
|
component[symbols.routes] = []
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
|
|
28
|
+
const l = routes.length
|
|
29
|
+
for (let i = 0; i < l; i++) {
|
|
30
|
+
component[symbols.routes][i] = routes[i]
|
|
31
|
+
// merge default route options with route specific options
|
|
32
|
+
component[symbols.routes][i].options = {
|
|
31
33
|
...{
|
|
32
|
-
|
|
33
|
-
options: {
|
|
34
|
-
...{
|
|
35
|
-
inHistory: true,
|
|
36
|
-
},
|
|
37
|
-
...routes[key].options,
|
|
38
|
-
},
|
|
34
|
+
inHistory: true,
|
|
39
35
|
},
|
|
36
|
+
...routes[i].options,
|
|
40
37
|
}
|
|
41
|
-
}
|
|
38
|
+
}
|
|
42
39
|
}
|
package/src/component.js
CHANGED
|
@@ -243,16 +243,18 @@ const Component = (name = required('name'), config = required('config')) => {
|
|
|
243
243
|
|
|
244
244
|
// execute the render code that constructs the initial state of the component
|
|
245
245
|
// and store the children result (a flat map of elements and components)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
246
|
+
const { elms, cleanup } = config.code.render.apply(stage, [
|
|
247
|
+
parentEl,
|
|
248
|
+
this,
|
|
249
|
+
config,
|
|
250
|
+
globalComponents,
|
|
251
|
+
effect,
|
|
252
|
+
getRaw,
|
|
253
|
+
Log,
|
|
254
|
+
]) || { elms: [], cleanup: () => {} }
|
|
255
|
+
|
|
256
|
+
this[symbols.children] = elms
|
|
257
|
+
this[symbols.cleanup] = cleanup
|
|
256
258
|
|
|
257
259
|
// create a reference to the wrapper element of the component (i.e. the root Element of the component)
|
|
258
260
|
this[symbols.wrapper] = this[symbols.children][0]
|
package/src/components/Circle.js
CHANGED
|
@@ -23,30 +23,52 @@ export default () =>
|
|
|
23
23
|
code: {
|
|
24
24
|
render: function anonymous(parent, component, context, components, effect, getRaw, Log) {
|
|
25
25
|
const elms = []
|
|
26
|
+
const elementConfigs = []
|
|
27
|
+
const forloops = []
|
|
28
|
+
const props = []
|
|
29
|
+
const created = []
|
|
30
|
+
const skips = []
|
|
26
31
|
let componentType
|
|
27
|
-
|
|
32
|
+
let rootComponent = component
|
|
28
33
|
let propData
|
|
29
34
|
let slotComponent
|
|
30
35
|
let inSlot = false
|
|
31
36
|
let slotChildCounter = 0
|
|
32
|
-
|
|
37
|
+
let cmps = []
|
|
38
|
+
elementConfigs[0] = {}
|
|
33
39
|
|
|
34
40
|
elms[0] = this.element(
|
|
35
41
|
{ parent: parent || 'root' },
|
|
36
42
|
inSlot === true ? slotComponent : component
|
|
37
43
|
)
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
elms[0].populate(
|
|
45
|
+
elementConfigs[0]['color'] = component.color
|
|
46
|
+
elementConfigs[0]['w'] = component.size
|
|
47
|
+
elementConfigs[0]['h'] = component.size
|
|
48
|
+
elementConfigs[0]['effects'] = [component.shader('radius', { radius: component.radius })]
|
|
49
|
+
elms[0].populate(elementConfigs[0])
|
|
44
50
|
|
|
45
51
|
if (inSlot === true) {
|
|
46
52
|
slotChildCounter -= 1
|
|
47
53
|
}
|
|
48
54
|
|
|
49
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
elms,
|
|
57
|
+
cleanup: () => {
|
|
58
|
+
rootComponent = null
|
|
59
|
+
propData = null
|
|
60
|
+
slotComponent = null
|
|
61
|
+
component = null
|
|
62
|
+
parent = null
|
|
63
|
+
cmps.length = 0
|
|
64
|
+
elms.length = 0
|
|
65
|
+
components.length = 0
|
|
66
|
+
elementConfigs.length = 0
|
|
67
|
+
forloops.length = 0
|
|
68
|
+
props.length = 0
|
|
69
|
+
skips.length = 0
|
|
70
|
+
},
|
|
71
|
+
}
|
|
50
72
|
},
|
|
51
73
|
effects: [
|
|
52
74
|
function anonymous(component, elms, context, components, rootComponent, effect) {
|