@lightningjs/blits 0.5.1 → 0.5.2

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,4 +1,10 @@
1
1
  # Changelog
2
+ # v0.5.2
3
+
4
+ _30 nov 2023_
5
+
6
+ - Fixed issue in code generator leading to creation unnecessary child nodes
7
+ - Added focus handler to router view (that passes focus to the current active page)
2
8
 
3
9
  # v0.5.1
4
10
 
@@ -9,7 +9,7 @@
9
9
  "lint": "eslint '**/*.js'",
10
10
  "lint:fix": "eslint '**/*.js' --fix",
11
11
  "build": "vite build",
12
- "dev": "vite dev"
12
+ "dev": "vite dev --host"
13
13
  },
14
14
  "lint-staged": {
15
15
  "*.js": [
@@ -31,6 +31,6 @@
31
31
  "vite": "^4.0.4"
32
32
  },
33
33
  "dependencies": {
34
- "@lightningjs/blits": "^0.5.1"
34
+ "@lightningjs/blits": "^0.5.2"
35
35
  }
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.cjs",
6
6
  "exports": {
@@ -25,6 +25,11 @@ export default () =>
25
25
  template: `
26
26
  <Element w="100%" height="100%"></Element>
27
27
  `,
28
+ state() {
29
+ return {
30
+ activeView: null,
31
+ }
32
+ },
28
33
  hooks: {
29
34
  ready() {
30
35
  handler = () => Router.navigate.apply(this)
@@ -34,5 +39,8 @@ export default () =>
34
39
  destroy() {
35
40
  window.removeEventListener('hashchange', handler, false)
36
41
  },
42
+ focus() {
43
+ this.activeView && this.activeView.focus()
44
+ },
37
45
  },
38
46
  })
@@ -182,7 +182,9 @@ const generateComponentCode = function (
182
182
  `)
183
183
 
184
184
  counter++
185
- generateElementCode.call(this, { children }, false, { ...options })
185
+ if (children) {
186
+ generateElementCode.call(this, { children }, false, { ...options })
187
+ }
186
188
  }
187
189
 
188
190
  const generateForLoopCode = function (templateObject, parent) {
@@ -123,6 +123,7 @@ export const navigate = async function () {
123
123
 
124
124
  // focus the new view
125
125
  focus ? Focus.set(focus) : view.focus()
126
+ this.activeView = this[symbols.children][this[symbols.children].length - 1]
126
127
  } else {
127
128
  Log.error(`Route ${hash} not found`)
128
129
  }