@lightningjs/blits 1.35.3 → 1.35.5

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.35.5
4
+
5
+ _06 Aug 2025_
6
+
7
+ - Fixed timing routerview causing focus to be passed to previous page
8
+
9
+
10
+ ## v1.35.4
11
+
12
+ _03 Aug 2025_
13
+
14
+ - Changed order of `focus`-hook and `hasFocus` variable to distinguish between focus and refocus
15
+ - Updated focus related documentation
16
+
3
17
  ## v1.35.3
4
18
 
5
19
  _31 Jul 2025_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.35.3",
3
+ "version": "1.35.5",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -18,6 +18,7 @@
18
18
  import Component from '../component.js'
19
19
  import Router from '../router/router.js'
20
20
  import symbols from '../lib/symbols.js'
21
+ import Focus from '../focus.js'
21
22
 
22
23
  let hashchangeHandler = null
23
24
 
@@ -93,7 +94,9 @@ export default () =>
93
94
  window.removeEventListener('hashchange', hashchangeHandler, false)
94
95
  },
95
96
  focus() {
96
- this.activeView && this.activeView.$focus()
97
+ if (this.activeView && Focus.get() === this) {
98
+ this.activeView.$focus()
99
+ }
97
100
  },
98
101
  },
99
102
  input: {
@@ -77,12 +77,13 @@ export default {
77
77
  this.previous = this.current
78
78
  this.current = v
79
79
  if (v === 'refocus') return
80
- if (v === 'focus') this.component[symbols.state].hasFocus = true
81
- if (v === 'unfocus') this.component[symbols.state].hasFocus = false
82
80
  // emit 'private' hook
83
81
  privateEmit(v, this.component[symbols.identifier], this.component)
84
82
  // emit 'public' hook
85
83
  emit(v, this.component[symbols.identifier], this.component)
84
+ // update the built-in hasFocus state variable
85
+ if (v === 'focus') this.component[symbols.state].hasFocus = true
86
+ if (v === 'unfocus') this.component[symbols.state].hasFocus = false
86
87
  }
87
88
  },
88
89
  }
@@ -337,6 +337,9 @@ export const navigate = async function () {
337
337
  // keep reference to the previous focus for storing in cache
338
338
  previousFocus = Focus.get()
339
339
 
340
+ const children = this[symbols.children]
341
+ this.activeView = children[children.length - 1]
342
+
340
343
  // set focus to the view that we're routing to
341
344
  focus ? focus.$focus() : /** @type {BlitsComponent} */ (view).$focus()
342
345
 
@@ -380,8 +383,6 @@ export const navigate = async function () {
380
383
  await setOrAnimate(holder, route.transition.in, shouldAnimate)
381
384
  }
382
385
  }
383
- const children = this[symbols.children]
384
- this.activeView = children[children.length - 1]
385
386
  } else {
386
387
  Log.error(`Route ${hash} not found`)
387
388
  const routerHooks = this.parent[symbols.routerHooks]