@lightningjs/blits 0.6.12 → 0.6.13

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,15 @@
1
1
  # Changelog
2
2
 
3
+ # v0.6.13
4
+
5
+ _16 feb 2024_
6
+
7
+ - Upgraded to 0.7.2 of the renderer
8
+ - Introduced new `maxheight` attribute (besided the existing `maxlines` attribute) for the `<Text />` component
9
+ - Fixed issue with order of lifecycle event emits
10
+ - Fixed logic to not unfoces a parent when it passes focus to a child
11
+ - Removed temporary fix for renderer issue [#123](https://github.com/lightning-js/renderer/issues/123)
12
+
3
13
  # v0.6.12
4
14
 
5
15
  _9 feb 2024_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -45,7 +45,7 @@
45
45
  "tape": "^5.5.0"
46
46
  },
47
47
  "dependencies": {
48
- "@lightningjs/renderer": "^0.7.1",
48
+ "@lightningjs/renderer": "^0.7.2",
49
49
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0",
50
50
  "execa": "^8.0.1",
51
51
  "kolorist": "^1.8.0",
package/src/component.js CHANGED
@@ -97,15 +97,13 @@ const Component = (name = required('name'), config = required('config')) => {
97
97
  },
98
98
  set state(v) {
99
99
  if (states.indexOf(v) > -1 && v !== this.current) {
100
- Log.debug(
101
- `Setting lifecycle state from ${this.previous} to ${v} for ${scope.componentId}`
102
- )
100
+ Log.debug(`Setting lifecycle state from ${this.current} to ${v} for ${scope.componentId}`)
103
101
  this.previous = this.current
102
+ this.current = v
104
103
  // emit 'private' hook
105
104
  privateEmit(v, name, scope)
106
105
  // emit 'public' hook
107
106
  emit(v, name, scope)
108
- this.current = v
109
107
  }
110
108
  },
111
109
  }
@@ -19,8 +19,6 @@ import Component from '../component.js'
19
19
  import { renderer } from '../launch.js'
20
20
  import fps_sprite from '../../public/assets/fps_sprite.base64.js'
21
21
 
22
- console.log(fps_sprite)
23
-
24
22
  export default () =>
25
23
  Component('FPScounter', {
26
24
  /* eslint-disable no-unused-vars */
@@ -19,8 +19,6 @@ import Component from '../component.js'
19
19
  import { renderer } from '../launch.js'
20
20
  import fps_sprite from '../../public/assets/fps_sprite.base64.js'
21
21
 
22
- console.log(fps_sprite)
23
-
24
22
  export default () =>
25
23
  Component('FPScounter', {
26
24
  template: `
@@ -67,6 +67,9 @@ export default () =>
67
67
  function anonymous(component, elms, context) {
68
68
  elms[0].set('maxLines', component.maxlines)
69
69
  },
70
+ function anonymous(component, elms, context) {
71
+ elms[0].set('h', component.maxheight)
72
+ },
70
73
  function anonymous(component, elms, context) {
71
74
  elms[0].set('textAlign', component.align)
72
75
  },
@@ -95,6 +98,7 @@ export default () =>
95
98
  'align',
96
99
  'wordwrap',
97
100
  'maxlines',
101
+ 'maxheight',
98
102
  'lineheight',
99
103
  'contain',
100
104
  '@loaded',
@@ -105,7 +109,7 @@ export default () =>
105
109
  _contain() {
106
110
  return (
107
111
  this.contain ||
108
- (this.wordwrap && this.maxlines ? 'both' : this.wordwrap ? 'width' : 'none')
112
+ (this.maxheight && this.wordwrap ? 'both' : this.wordwrap ? 'width' : 'none')
109
113
  )
110
114
  },
111
115
  _lineheight() {
@@ -35,6 +35,7 @@ export default () =>
35
35
  contain="$_contain"
36
36
  :wordWrap="$wordwrap"
37
37
  :maxLines="$maxlines"
38
+ :h="$maxheight"
38
39
  :textAlign="$align"
39
40
  :overflowSuffix="$textoverflow"
40
41
  @loaded="$@loaded"
@@ -59,6 +60,7 @@ export default () =>
59
60
  'align',
60
61
  'wordwrap',
61
62
  'maxlines',
63
+ 'maxheight',
62
64
  'lineheight',
63
65
  'contain',
64
66
  '@loaded',
@@ -69,7 +71,7 @@ export default () =>
69
71
  _contain() {
70
72
  return (
71
73
  this.contain ||
72
- (this.wordwrap && this.maxlines ? 'both' : this.wordwrap ? 'width' : 'none')
74
+ (this.maxheight && this.wordwrap ? 'both' : this.wordwrap ? 'width' : 'none')
73
75
  )
74
76
  },
75
77
  _lineheight() {
package/src/element.js CHANGED
@@ -51,8 +51,6 @@ const unpackTransition = (obj) => {
51
51
  return obj
52
52
  }
53
53
 
54
- let firstNode = false
55
-
56
54
  const Props = {
57
55
  set parent(v) {
58
56
  this._props.parent = v === 'root' ? renderer.root : v.node
@@ -201,7 +199,7 @@ const Props = {
201
199
  this._props.contain = v
202
200
  },
203
201
  set maxLines(v) {
204
- this.height = v * this.element.node.lineHeight
202
+ this._props.maxLines = v
205
203
  },
206
204
  set overflowSuffix(v) {
207
205
  this._props.overflowSuffix = v === false ? ' ' : v === true ? undefined : v
@@ -247,13 +245,6 @@ const Element = {
247
245
  this.props._set.has('src') || this.props._set.has('texture') ? 0xffffffff : 0
248
246
  }
249
247
 
250
- // temporary workaround for renderer issue https://github.com/lightning-js/renderer/issues/123
251
- if (!firstNode) {
252
- this.props._props.src =
253
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII='
254
- firstNode = true
255
- }
256
-
257
248
  this.node = props.__textnode
258
249
  ? renderer.createTextNode(this.props._props)
259
250
  : renderer.createNode(this.props._props)
package/src/focus.js CHANGED
@@ -35,7 +35,7 @@ export default {
35
35
  },
36
36
  set(component, event) {
37
37
  clearTimeout(setFocusTimeout)
38
- focusedComponent && focusedComponent.unfocus()
38
+ focusedComponent && focusedComponent !== component.parent && focusedComponent.unfocus()
39
39
  focusChain.reverse().forEach((cmp) => cmp.unfocus())
40
40
  if (component !== focusedComponent) {
41
41
  setFocusTimeout = setTimeout(