@lightningjs/blits 0.9.5 → 0.9.6

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,13 +1,20 @@
1
1
  # Changelog
2
2
 
3
- # v0.9.5
3
+ ## v0.9.6
4
+
5
+ _4 apr 2024_
6
+
7
+ - Added before hook to router
8
+ - Upgraded Lightning renderer to v0.8.2
9
+
10
+ ## v0.9.5
4
11
 
5
12
  _29 mar 2024_
6
13
 
7
14
  - Fixed cancelling of scheduled / running transitions when starting a new transition on the same prop (broke in v0.7.1).
8
15
  - Added viewport relates lifecycle hooks
9
16
 
10
- # v0.9.4
17
+ ## v0.9.4
11
18
 
12
19
  _28 mar 2024_
13
20
 
@@ -16,7 +23,7 @@ _28 mar 2024_
16
23
  - Introduced new `gpuMemoryLimit` launch setting
17
24
 
18
25
 
19
- # v0.9.3
26
+ ## v0.9.3
20
27
 
21
28
  _25 mar 2024_
22
29
 
@@ -28,7 +35,7 @@ _21 mar 2024_
28
35
 
29
36
  - Fixed issue with updates not triggering during array operation
30
37
 
31
- # v0.9.1
38
+ ## v0.9.1
32
39
 
33
40
  _21 mar 2024_
34
41
 
@@ -38,7 +45,7 @@ _21 mar 2024_
38
45
  - Introduced `viewportMargin` setting
39
46
  - Added `undefined`-check for props sent to renderer
40
47
 
41
- # v0.9.0
48
+ ## v0.9.0
42
49
 
43
50
  _18 mar 2024_
44
51
 
@@ -48,7 +55,7 @@ _18 mar 2024_
48
55
  - Refactored font loading, removed the need for temporary `src/fontLoader.js` file
49
56
  - Replaced using component name with unique identifier for registering and emitting hooks
50
57
 
51
- # v0.8.1
58
+ ## v0.8.1
52
59
 
53
60
  _9 mar 2024_
54
61
 
@@ -57,20 +64,20 @@ _9 mar 2024_
57
64
  - Removed explicit destroy of child nodes, as the renderer now takes care of this
58
65
  - Re-added support for clipping
59
66
 
60
- # v0.8.0
67
+ ## v0.8.0
61
68
 
62
69
  _1 mar 2024_
63
70
 
64
71
  - Added `this.$clearIntervals()` and `this.$clearTimeouts()` methods that clear all intervals and timers set on a certain component
65
72
  - **Breaking change:** Renamed the key `function` to `easing` in the transitions object used to specify a custom easing functio (deprecation notice added)
66
73
 
67
- # v0.7.4
74
+ ## v0.7.4
68
75
 
69
76
  _28 feb 2024_
70
77
 
71
78
  - Fixed dependency for on the fly MSDF font generation
72
79
 
73
- # v0.7.3
80
+ ## v0.7.3
74
81
 
75
82
  _28 feb 2024_
76
83
 
@@ -81,14 +88,14 @@ _28 feb 2024_
81
88
  - Added support for pre-compilation for files with more than 1 Blits component
82
89
  - Fixed transitions on scale attribute when passed an object with `x` and `y` values
83
90
 
84
- # v0.7.2
91
+ ## v0.7.2
85
92
 
86
93
  _23 feb 2024_
87
94
 
88
95
  - Added small fix to support for (re)assigning an array used in a for-loop
89
96
  - Added option to enable the Lightning inspector in launch setting (`inspector: true/false`)
90
97
 
91
- # v0.7.1
98
+ ## v0.7.1
92
99
 
93
100
  _22 feb 2024_
94
101
 
@@ -101,7 +108,7 @@ _22 feb 2024_
101
108
  - Added preliminary support for frameTick hook
102
109
  - Upgraded to latest version of the renderer (0.7.4)
103
110
 
104
- # v0.7.0
111
+ ## v0.7.0
105
112
 
106
113
  _20 feb 2024_
107
114
 
@@ -110,7 +117,7 @@ _20 feb 2024_
110
117
  - Added functionality to pass extra data / props when navigating to a new route ( _breaking change_ in signature of `router.to()` method - previously: `router.to(path, options)`, now: `router.to(path, data, options)`)
111
118
  - Added configuration option to set the canvas color (aka clear color)
112
119
 
113
- # v0.6.13
120
+ ## v0.6.13
114
121
 
115
122
  _16 feb 2024_
116
123
 
@@ -120,7 +127,7 @@ _16 feb 2024_
120
127
  - Fixed logic to not unfoces a parent when it passes focus to a child
121
128
  - Removed temporary fix for renderer issue [#123](https://github.com/lightning-js/renderer/issues/123)
122
129
 
123
- # v0.6.12
130
+ ## v0.6.12
124
131
 
125
132
  _9 feb 2024_
126
133
 
@@ -128,7 +135,7 @@ _9 feb 2024_
128
135
  - Fixed issue with `.gitignore` in app create flow
129
136
  - Added support for dynamic route parts in the router (i.e `/tv/:series/episodes/:episode`)
130
137
 
131
- # v0.6.11
138
+ ## v0.6.11
132
139
 
133
140
  _7 feb 2024_
134
141
 
@@ -136,7 +143,7 @@ _7 feb 2024_
136
143
  - Removed setting focus to AppComponent on back key press in RouterView
137
144
  - Fixed broken app create flow caused by missing dev dependencies in npx command (temporary fix)
138
145
 
139
- # v0.6.10
146
+ ## v0.6.10
140
147
 
141
148
  _2 feb 2024_
142
149
 
@@ -145,20 +152,20 @@ _2 feb 2024_
145
152
  - Updated flow to create a new App project with an interactive prompt of questions (`npx @lightningjs/blits@latest`)
146
153
  - Upgraded to latest version of the Lightning 3 renderer (0.7.1)
147
154
 
148
- # v0.6.9
155
+ ## v0.6.9
149
156
 
150
157
  _31 jan 2024_
151
158
 
152
159
  - Fixed single quote escaping for all browsers (removing sometimes unsupported negative lookahead)
153
160
  - Fixed issue with focus when navigating back to a page that is kept in history
154
161
 
155
- # v0.6.8
162
+ ## v0.6.8
156
163
 
157
164
  _29 jan 2024_
158
165
 
159
166
  - Reverted fix (initially) empty for-loops
160
167
 
161
- # v0.6.7
168
+ ## v0.6.7
162
169
 
163
170
  _26 jan 2024_
164
171
 
@@ -168,7 +175,7 @@ _26 jan 2024_
168
175
  - Added setting for specifying maximum number of web workers to spawn (`webWorkersLimit`)
169
176
  - Added fix for issue with setting up reactivity for (initially) empty for-loops
170
177
 
171
- # v0.6.6
178
+ ## v0.6.6
172
179
 
173
180
  _24 jan 2024_
174
181
 
@@ -176,54 +183,54 @@ _24 jan 2024_
176
183
  - Fixed issue with setting mount, pivot and scale values to zero (0) in object literal with x and y key
177
184
  - Added automatic mapping of ref string to each item in a for-loop
178
185
 
179
- # v0.6.5
186
+ ## v0.6.5
180
187
 
181
188
  _16 jan 2024_
182
189
 
183
190
  - Added `path` to boilerplate vite.config.js for deployments in a sub folder
184
191
  - Improved error handling in the template parser, with more contextual error messages
185
192
 
186
- # v0.6.4
193
+ ## v0.6.4
187
194
 
188
195
  _15 jan 2024_
189
196
 
190
197
  - Added fix for sprites not working on certain devices
191
198
 
192
- # v0.6.3
199
+ ## v0.6.3
193
200
 
194
201
  _12 jan 2024_
195
202
 
196
203
  - Removed prepending protocol and host from sprite image
197
204
 
198
205
 
199
- # v0.6.2
206
+ ## v0.6.2
200
207
 
201
208
  _12 jan 2024_
202
209
 
203
210
  - Fixed issue with Sprites not working correctly due to missing background color
204
211
 
205
- # v0.6.1
212
+ ## v0.6.1
206
213
 
207
214
  _8 jan 2024_
208
215
 
209
216
  - Fixed issue with using single quotes as Text content
210
217
  - Added first Text-to-Speech / Announcer functionality
211
218
 
212
- # v0.6.0
219
+ ## v0.6.0
213
220
 
214
221
  _4 jan 2024_
215
222
 
216
223
  - Added pre-compilation functionality to improve performance. Requires an update to the `vite.config.js` to enable. Read more details in this [blog post](https://lightningjs.io/blogs/blitsPreCompilation.html)
217
224
  - Added `defaultFont` to the Launch settings
218
225
 
219
- # v0.5.10
226
+ ## v0.5.10
220
227
 
221
228
  _3 jan 2024_
222
229
 
223
230
  - Updated and improved documentation
224
231
  - Added `screenResolution` and `pixelRatio` options to settings
225
232
 
226
- # v0.5.9
233
+ ## v0.5.9
227
234
 
228
235
  _21 dec 2023_
229
236
 
@@ -234,13 +241,13 @@ _21 dec 2023_
234
241
  - Added functionality to override route options during navigation
235
242
  - Upgraded to latest version of the renderer (0.6.1) which contains a fix for animations not finishing correctly
236
243
 
237
- # v0.5.8
244
+ ## v0.5.8
238
245
 
239
246
  _15 dec 2023_
240
247
 
241
248
  - Internal refactor of the `Element`
242
249
 
243
- # v0.5.7
250
+ ## v0.5.7
244
251
 
245
252
  _13 dec 2023_
246
253
 
@@ -248,39 +255,39 @@ _13 dec 2023_
248
255
  - Linked effects directly to the available shaders exposed by the L3 renderer (starting 0.6.0)
249
256
  - Added setting `reactivityMode` to control whether `Proxy` (default) or `defineProperty` is used to trigger reactive side effects
250
257
 
251
- # v0.5.6
258
+ ## v0.5.6
252
259
 
253
260
  _11 dec 2023_
254
261
 
255
262
  - Upgraded to version 0.6.0 of the Lightning 3 renderer
256
263
 
257
- # v0.5.5
264
+ ## v0.5.5
258
265
 
259
266
  _5 dec 2023_
260
267
 
261
268
  - Fixed regression in Slots functionality caused by forloop cleanup fix in 0.5.4
262
269
 
263
- # v0.5.4
270
+ ## v0.5.4
264
271
 
265
272
  _5 dec 2023_
266
273
 
267
274
  - Fixed issue with Components and Elements not always being cleaned up in forloop
268
275
  - Added support for nested children inside a forloop on an Element
269
276
 
270
- # v0.5.3
277
+ ## v0.5.3
271
278
 
272
279
  _4 dec 2023_
273
280
 
274
281
  - Added transition `start` and tranition `end` callbacks
275
282
 
276
- # v0.5.2
283
+ ## v0.5.2
277
284
 
278
285
  _30 nov 2023_
279
286
 
280
287
  - Fixed issue in code generator leading to creation unnecessary child nodes
281
288
  - Added focus handler to router view (that passes focus to the current active page)
282
289
 
283
- # v0.5.1
290
+ ## v0.5.1
284
291
 
285
292
  _29 nov 2023_
286
293
 
@@ -288,20 +295,20 @@ _29 nov 2023_
288
295
  - Added fastforward of transitions on the same property
289
296
  - Added functionality to skip focus change on key hold
290
297
 
291
- # v0.5.0
298
+ ## v0.5.0
292
299
 
293
300
  _23 nov 2023_
294
301
 
295
302
  - Introduced `wordwrap` and `maxlines` attributes on the Text-component, replacing the previous `w` and `h` attributes (breaking change!)
296
303
 
297
- # v0.4.2
304
+ ## v0.4.2
298
305
 
299
306
  _22 nov 2023_
300
307
 
301
308
  - Improved parser and added more template validation (i.e. one single root element in a template)
302
309
  - Fixed typo in documentation
303
310
 
304
- # v0.4.1
311
+ ## v0.4.1
305
312
 
306
313
  _13 nov 2023_
307
314
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
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.8.0",
48
+ "@lightningjs/renderer": "^0.8.2",
49
49
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0",
50
50
  "execa": "^8.0.1",
51
51
  "kolorist": "^1.8.0",
@@ -1,3 +1,4 @@
1
+
1
2
  /*
2
3
  * Copyright 2023 Comcast Cable Communications Management, LLC
3
4
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -91,6 +92,10 @@ declare namespace Application {
91
92
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>
92
93
  }[keyof T]
93
94
 
95
+ interface RouteHooks {
96
+ before?: (to: Route, from: Route) => string | Route;
97
+ }
98
+
94
99
  type Route = {
95
100
  /**
96
101
  * URI path for the route
@@ -115,6 +120,26 @@ declare namespace Application {
115
120
  * politeness level
116
121
  */
117
122
  announce?: String | RouteAnnounce
123
+ /**
124
+ * Register hooks for the route
125
+ */
126
+ hooks?: RouteHooks
127
+ /**
128
+ * Route path parameters
129
+ */
130
+ readonly params?: {
131
+ [key: string]: string | number
132
+ }
133
+ /**
134
+ * Allows for attaching custom data to a route, either hardcoded in the
135
+ * route definition or asigned to the route object in a before hook
136
+ *
137
+ * Will be merged with the route params and navigation data and passed as
138
+ * props into the route component
139
+ */
140
+ data?: {
141
+ [key: string]: any
142
+ }
118
143
  }
119
144
 
120
145
  export interface ApplicationInstance extends ComponentInstance {}
@@ -19,38 +19,35 @@ import Component from '../component.js'
19
19
 
20
20
  export default () =>
21
21
  Component('Circle', {
22
- /* eslint-disable no-unused-vars */
23
- code: {
24
- render: function anonymous(parent, component, context) {
25
- const elms = []
22
+ /* eslint-disable no-unused-vars */
23
+ code: { render: function anonymous(parent,component,context
24
+ ) {
25
+ const elms = []
26
26
 
27
- if (!elms[0]) {
28
- elms[0] = this.element({ parent: parent || 'root' }, component)
29
- }
30
- const elementConfig0 = {}
27
+ if(!elms[0]) {
28
+ elms[0] = this.element({parent: parent || 'root'}, component)
29
+ }
30
+ const elementConfig0 = {}
31
+
31
32
 
32
- if (!elms[0].nodeId) {
33
- elms[0].populate(elementConfig0)
34
- }
35
-
36
- return elms
37
- },
38
- effects: [
39
- function anonymous(component, elms, context) {
40
- elms[0].set('color', component.color)
41
- },
42
- function anonymous(component, elms, context) {
43
- elms[0].set('w', component.size)
44
- },
45
- function anonymous(component, elms, context) {
46
- elms[0].set('h', component.size)
47
- },
48
- function anonymous(component, elms, context) {
49
- elms[0].set('effects', [component.shader('radius', { radius: component.radius })])
50
- },
51
- ],
52
- context: {},
53
- },
33
+ if(!elms[0].nodeId) {
34
+ elms[0].populate(elementConfig0)
35
+ }
36
+
37
+ return elms
38
+ }, effects: [function anonymous(component,elms,context
39
+ ) {
40
+ elms[0].set('color', component.color)
41
+ },function anonymous(component,elms,context
42
+ ) {
43
+ elms[0].set('w', component.size)
44
+ },function anonymous(component,elms,context
45
+ ) {
46
+ elms[0].set('h', component.size)
47
+ },function anonymous(component,elms,context
48
+ ) {
49
+ elms[0].set('effects', [component.shader('radius', {radius: component.radius})])
50
+ }], context: {}},
54
51
  props: [{ key: 'size', default: 40 }, 'color'],
55
52
  computed: {
56
53
  radius() {
@@ -19,9 +19,35 @@ import Component from '../component.js'
19
19
 
20
20
  export default () =>
21
21
  Component('Circle', {
22
- template: `
23
- <Element :color="$color" :w="$size" :h="$size" :effects="[$shader('radius', {radius: $radius})]"></Element>
24
- `,
22
+ /* eslint-disable no-unused-vars */
23
+ code: { render: function anonymous(parent,component,context
24
+ ) {
25
+ const elms = []
26
+
27
+ if(!elms[0]) {
28
+ elms[0] = this.element({parent: parent || 'root'}, component)
29
+ }
30
+ const elementConfig0 = {}
31
+
32
+
33
+ if(!elms[0].nodeId) {
34
+ elms[0].populate(elementConfig0)
35
+ }
36
+
37
+ return elms
38
+ }, effects: [function anonymous(component,elms,context
39
+ ) {
40
+ elms[0].set('color', component.color)
41
+ },function anonymous(component,elms,context
42
+ ) {
43
+ elms[0].set('w', component.size)
44
+ },function anonymous(component,elms,context
45
+ ) {
46
+ elms[0].set('h', component.size)
47
+ },function anonymous(component,elms,context
48
+ ) {
49
+ elms[0].set('effects', [component.shader('radius', {radius: component.radius})])
50
+ }], context: {}},
25
51
  props: [{ key: 'size', default: 40 }, 'color'],
26
52
  computed: {
27
53
  radius() {