@lightningjs/blits 0.5.1 → 0.5.3
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 +13 -0
- package/boilerplate/package.json +2 -2
- package/package.json +1 -1
- package/src/components/RouterView.js +8 -0
- package/src/element.js +10 -1
- package/src/lib/codegenerator/generator.js +4 -2
- package/src/router/router.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v0.5.3
|
|
4
|
+
|
|
5
|
+
_4 dec 2023_
|
|
6
|
+
|
|
7
|
+
- Added transition `start` and tranition `end` callbacks
|
|
8
|
+
|
|
9
|
+
# v0.5.2
|
|
10
|
+
|
|
11
|
+
_30 nov 2023_
|
|
12
|
+
|
|
13
|
+
- Fixed issue in code generator leading to creation unnecessary child nodes
|
|
14
|
+
- Added focus handler to router view (that passes focus to the current active page)
|
|
15
|
+
|
|
3
16
|
# v0.5.1
|
|
4
17
|
|
|
5
18
|
_29 nov 2023_
|
package/boilerplate/package.json
CHANGED
|
@@ -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.
|
|
34
|
+
"@lightningjs/blits": "^0.5.3"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -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
|
})
|
package/src/element.js
CHANGED
|
@@ -284,9 +284,17 @@ const Element = {
|
|
|
284
284
|
v: props[prop],
|
|
285
285
|
f,
|
|
286
286
|
timeout: setTimeout(() => {
|
|
287
|
+
value.start &&
|
|
288
|
+
typeof value.start === 'function' &&
|
|
289
|
+
value.start.call(this.component, this, prop, props[prop])
|
|
287
290
|
f.start()
|
|
288
291
|
.waitUntilStopped()
|
|
289
292
|
.then(() => delete this.scheduledTransitions[prop])
|
|
293
|
+
.then(() => {
|
|
294
|
+
value.end &&
|
|
295
|
+
typeof value.end === 'function' &&
|
|
296
|
+
value.end.call(this.component, this, prop, props[prop])
|
|
297
|
+
})
|
|
290
298
|
.then(resolve)
|
|
291
299
|
}, value.delay || 0),
|
|
292
300
|
}
|
|
@@ -295,11 +303,12 @@ const Element = {
|
|
|
295
303
|
},
|
|
296
304
|
}
|
|
297
305
|
|
|
298
|
-
export default (config) =>
|
|
306
|
+
export default (config, component) =>
|
|
299
307
|
Object.assign(Object.create(Element), {
|
|
300
308
|
node: null,
|
|
301
309
|
setProperties: [],
|
|
302
310
|
scheduledTransitions: {},
|
|
303
311
|
initData: {},
|
|
304
312
|
config,
|
|
313
|
+
component,
|
|
305
314
|
})
|
|
@@ -56,7 +56,7 @@ const generateElementCode = function (
|
|
|
56
56
|
|
|
57
57
|
renderCode.push(`
|
|
58
58
|
if(!${elm}) {
|
|
59
|
-
${elm} = this.element({componentId: component[Symbol.for('id')], parent: parent || 'root'})
|
|
59
|
+
${elm} = this.element({componentId: component[Symbol.for('id')], parent: parent || 'root'}, component)
|
|
60
60
|
}
|
|
61
61
|
const elementConfig${counter} = {}
|
|
62
62
|
`)
|
|
@@ -182,7 +182,9 @@ const generateComponentCode = function (
|
|
|
182
182
|
`)
|
|
183
183
|
|
|
184
184
|
counter++
|
|
185
|
-
|
|
185
|
+
if (children) {
|
|
186
|
+
generateElementCode.call(this, { children }, false, { ...options })
|
|
187
|
+
}
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
const generateForLoopCode = function (templateObject, parent) {
|
package/src/router/router.js
CHANGED
|
@@ -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
|
}
|