@lightningjs/blits 1.27.0 → 1.27.1

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ _15 apr 2025_
4
+
5
+ ## v1.27.1
6
+
7
+ - Fixed issue with global watcher on router state not being cleared out
8
+ - Minor performance updates
9
+ - Fixed issue with retrieving correct renderer version for logging
10
+ - Fixed issue with nested layouts not properly updating parent layout
11
+
3
12
  _11 apr 2025_
4
13
 
5
14
  ## v1.27.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -58,9 +58,10 @@ export default {
58
58
  eventListeners.removeListeners(this)
59
59
  deleteChildren(this[symbols.children])
60
60
  removeGlobalEffects(this[symbols.effects])
61
- Log.debug(`Destroyed component ${this.componentId}`)
62
61
  this[symbols.state] = {}
63
62
  this[symbols.props] = {}
63
+ this[symbols.effects].length = 0
64
+ Log.debug(`Destroyed component ${this.componentId}`)
64
65
  },
65
66
  writable: false,
66
67
  enumerable: true,
package/src/component.js CHANGED
@@ -195,13 +195,17 @@ const Component = (name = required('name'), config = required('config')) => {
195
195
 
196
196
  let old = this[key]
197
197
 
198
- effect((force = false) => {
198
+ const eff = (force = false) => {
199
199
  const newValue = target[key]
200
200
  if (old !== newValue || force === true) {
201
201
  this[symbols.watchers][watchKey].apply(this, [newValue, old])
202
202
  old = newValue
203
203
  }
204
- })
204
+ }
205
+
206
+ // store reference to the effect
207
+ this[symbols.effects].push(eff)
208
+ effect(eff)
205
209
  }
206
210
  }
207
211
 
@@ -128,6 +128,11 @@ const layoutFn = function (config) {
128
128
  if (config['@updated'] !== undefined) {
129
129
  config['@updated']({ w: this.node.width, h: this.node.height }, this)
130
130
  }
131
+
132
+ // trigger layout on parent if parent is a layout
133
+ if (this.config.parent && this.config.parent.props.__layout === true) {
134
+ this.config.parent.triggerLayout(this.config.parent.props)
135
+ }
131
136
  }
132
137
 
133
138
  const isTransition = (value) => {
package/src/launch.js CHANGED
@@ -19,17 +19,33 @@ import Settings from './settings.js'
19
19
  import { initLog, Log } from './lib/log.js'
20
20
  import engine from './engine.js'
21
21
  import blitsPackageInfo from '../package.json' assert { type: 'json' }
22
- import rendererPackageInfo from '../../renderer/package.json' assert { type: 'json' }
23
22
 
24
23
  export let renderer = {}
25
24
  export const stage = {}
26
25
 
26
+ async function rendererVersion() {
27
+ let rendererPackageInfo
28
+ try {
29
+ // Dynamically import the renderer package.json
30
+ rendererPackageInfo = await import('../../renderer/package.json')
31
+ if (rendererPackageInfo !== undefined) {
32
+ return rendererPackageInfo.version
33
+ }
34
+ } catch (e) {
35
+ // Fallback to renderer version in dependencies
36
+ return blitsPackageInfo.dependencies['@lightningjs/renderer']
37
+ }
38
+ }
39
+
27
40
  export default (App, target, settings) => {
28
41
  Settings.set(settings)
29
42
 
30
43
  initLog()
31
- Log.info('Blits Version ', blitsPackageInfo.version)
32
- Log.info('Renderer Version ', rendererPackageInfo.version)
44
+
45
+ rendererVersion().then((v) => {
46
+ Log.info('Blits Version ', blitsPackageInfo.version)
47
+ Log.info('Renderer Version ', v)
48
+ })
33
49
 
34
50
  stage.element = engine.Element
35
51
 
@@ -23,15 +23,20 @@ import { Log } from '../lib/log.js'
23
23
  import { stage } from '../launch.js'
24
24
  import Focus from '../focus.js'
25
25
  import Announcer from '../announcer/announcer.js'
26
+ import Settings from '../settings.js'
26
27
 
27
28
  export let currentRoute
28
- export const state = reactive({
29
- path: '',
30
- navigating: false,
31
- data: null,
32
- params: null,
33
- hash: '',
34
- })
29
+ export const state = reactive(
30
+ {
31
+ path: '',
32
+ navigating: false,
33
+ data: null,
34
+ params: null,
35
+ hash: '',
36
+ },
37
+ Settings.get('reactivityMode'),
38
+ true
39
+ )
35
40
 
36
41
  // Changed from WeakMap to Map to allow for caching of views by the url hash.
37
42
  // We are manually doing the cleanup of the cache when the route is not marked as keepAlive.