@lightningjs/blits 0.6.7 → 0.6.9
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 +1 -1
- package/docs/introduction.md +19 -0
- package/docs/sidebar.json +64 -0
- package/docs/template_syntax.md +1 -1
- package/package.json +5 -1
- package/src/lib/codegenerator/generator.js +6 -6
- package/src/router/router.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v0.6.9
|
|
4
|
+
|
|
5
|
+
_31 jan 2024_
|
|
6
|
+
|
|
7
|
+
- Fixed single quote escaping for all browsers (removing sometimes unsupported negative lookahead)
|
|
8
|
+
- Fixed issue with focus when navigating back to a page that is kept in history
|
|
9
|
+
|
|
10
|
+
# v0.6.8
|
|
11
|
+
|
|
12
|
+
_29 jan 2024_
|
|
13
|
+
|
|
14
|
+
- Reverted fix (initially) empty for-loops
|
|
15
|
+
|
|
3
16
|
# v0.6.7
|
|
4
17
|
|
|
5
18
|
_26 jan 2024_
|
package/boilerplate/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Blits - Lightning 3 App Development Framework
|
|
2
|
+
|
|
3
|
+
With Blits, the App Development Framework for Lightning 3, it becomes a breeze to build great Lightning 3 applications.
|
|
4
|
+
|
|
5
|
+
Blits is built on top of the Lightning 3 Renderer and aims to provide a **great developer experience**, making it fun and easy to build your apps!
|
|
6
|
+
|
|
7
|
+
Built from the ground up by the LightningJS team, we're offering a **Complete App framework**, full of features to speed up development, while keeping it **lightweight** with a focus on **performance**.
|
|
8
|
+
|
|
9
|
+
The Blits framework uses a **readable** XML-style template syntax and comes with built-in reactivity.
|
|
10
|
+
|
|
11
|
+
## Why Blits?
|
|
12
|
+
|
|
13
|
+
You may be wondering where the name Blits comes from?
|
|
14
|
+
|
|
15
|
+
Firstly, it's short, memorable and just has a nice ring to it.
|
|
16
|
+
|
|
17
|
+
"Blits" is a Dutch word (a significant portion of the Lightning Open Source teams is based in the Netherlands). It means _flashy_ and it's often used to for things that are _great_ or _cool_.
|
|
18
|
+
|
|
19
|
+
Finally it's a nerdy reference to the computer term "Bit Blits" commonly used in graphics processing, for rapidly moving a block of data into memory - quite similar to what Lightning is doing
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"text": "Getting Started",
|
|
4
|
+
"items": [
|
|
5
|
+
{
|
|
6
|
+
"text": "Introduction",
|
|
7
|
+
"link": "/introduction"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"text": "Setup",
|
|
11
|
+
"link": "/getting_started"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"text": "Basics",
|
|
17
|
+
"items": [
|
|
18
|
+
{
|
|
19
|
+
"text": "Components",
|
|
20
|
+
"link": "/components"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"text": "Template Syntax",
|
|
24
|
+
"link": "/template_syntax"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"text": "Component State",
|
|
28
|
+
"link": "/component_state"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"text": "Hooks",
|
|
32
|
+
"link": "/lifecycle_events"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"text": "Props",
|
|
36
|
+
"link": "/props"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"text": "User Input",
|
|
40
|
+
"link": "/user_input"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"text": "Computed Props",
|
|
44
|
+
"link": "/computed_properties"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"text": "Watchers",
|
|
48
|
+
"link": "/watchers"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"text": "Styling",
|
|
52
|
+
"link": "/element_attributes"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"text": "Images",
|
|
56
|
+
"link": "/displaying_images"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"text": "Text-to-Speech",
|
|
60
|
+
"link": "/text-to-speech-announcer"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
package/docs/template_syntax.md
CHANGED
|
@@ -8,7 +8,7 @@ The _template_ key in the Componentn configuration object holds a string with an
|
|
|
8
8
|
|
|
9
9
|
You can use different tags in your templates. And similar to HTML you can use arguments and nested tags. Self-closing tags and HTML-style comments are also supported.
|
|
10
10
|
|
|
11
|
-
The default tag within a template is the `<Element>` tag, which corresponds to a node in the Lightning 3 renderer. For each element, you can define a set of predefined render properties, such as `x`, `y`, `w`, `color`, and more. Detailed information regarding the attributes supported by the
|
|
11
|
+
The default tag within a template is the `<Element>` tag, which corresponds to a node in the Lightning 3 renderer. For each element, you can define a set of predefined render properties, such as `x`, `y`, `w`, `color`, and more. Detailed information regarding the attributes supported by the `<Element>` tag can be found [here](./element_attributes.md).
|
|
12
12
|
|
|
13
13
|
Consider the following template example:
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightningjs/blits",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Blits: The Lightning 3 App Development Framework",
|
|
5
5
|
"bin": "bin/index.cjs",
|
|
6
6
|
"exports": {
|
|
@@ -44,5 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@lightningjs/renderer": "^0.7.0",
|
|
46
46
|
"@lightningjs/vite-plugin-import-chunk-url": "^0.3.0"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/lightning-js/blits.git"
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -215,10 +215,6 @@ const generateForLoopCode = function (templateObject, parent) {
|
|
|
215
215
|
ctx.renderCode.push(`
|
|
216
216
|
const collection = ${cast(result[2], ':for')}
|
|
217
217
|
const keys = []
|
|
218
|
-
// if array is empty push an empty object to properly set up reactivity
|
|
219
|
-
if(collection.length === 0) {
|
|
220
|
-
collection.push({})
|
|
221
|
-
}
|
|
222
218
|
for(let __index = 0; __index < collection.length; __index++) {
|
|
223
219
|
parent = ${parent}
|
|
224
220
|
if(!component.key) keys.length = 0
|
|
@@ -330,8 +326,12 @@ const cast = (val = '', key = false, component = 'component.') => {
|
|
|
330
326
|
if (val.startsWith('$')) {
|
|
331
327
|
castedValue = `${component}${val.replace('$', '')}`
|
|
332
328
|
} else {
|
|
333
|
-
// unescaped single quotes must be escaped
|
|
334
|
-
|
|
329
|
+
// unescaped single quotes must be escaped while preserving escaped backslashes
|
|
330
|
+
const escapedVal = val
|
|
331
|
+
.replace(/\\\\/g, '__DOUBLE_BACKSLASH__')
|
|
332
|
+
.replace(/(^|[^\\])'/g, "$1\\'")
|
|
333
|
+
.replace(/__DOUBLE_BACKSLASH__/g, '\\\\')
|
|
334
|
+
castedValue = `'${parseInlineContent(escapedVal, component)}'`
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
// numeric
|
package/src/router/router.js
CHANGED
|
@@ -30,6 +30,7 @@ const cacheMap = new WeakMap()
|
|
|
30
30
|
const history = []
|
|
31
31
|
let overrideOptions = {}
|
|
32
32
|
let navigatingBack = false
|
|
33
|
+
let previousFocus
|
|
33
34
|
|
|
34
35
|
export const getHash = () => {
|
|
35
36
|
return (document.location.hash || '/').replace(/^#/, '')
|
|
@@ -97,6 +98,12 @@ export const navigate = async function () {
|
|
|
97
98
|
|
|
98
99
|
this[symbols.children].push(view)
|
|
99
100
|
|
|
101
|
+
// keep reference to the previous focus for storing in cache
|
|
102
|
+
previousFocus = Focus.get()
|
|
103
|
+
|
|
104
|
+
// set focus to the view that we're routing to
|
|
105
|
+
focus ? Focus.set(focus) : Focus.set(view)
|
|
106
|
+
|
|
100
107
|
// apply before settings to holder element
|
|
101
108
|
if (route.transition.before) {
|
|
102
109
|
if (Array.isArray(route.transition.before)) {
|
|
@@ -143,8 +150,6 @@ export const navigate = async function () {
|
|
|
143
150
|
Announcer.speak(route.announce.message, route.announce.politeness)
|
|
144
151
|
}
|
|
145
152
|
|
|
146
|
-
// focus the new view
|
|
147
|
-
focus ? Focus.set(focus) : view.focus()
|
|
148
153
|
this.activeView = this[symbols.children][this[symbols.children].length - 1]
|
|
149
154
|
} else {
|
|
150
155
|
Log.error(`Route ${hash} not found`)
|
|
@@ -172,7 +177,7 @@ const removeView = async (route, view, transition) => {
|
|
|
172
177
|
|
|
173
178
|
// cache the page when it's as 'keepAlive' instead of destroying
|
|
174
179
|
if (route.options && route.options.keepAlive === true) {
|
|
175
|
-
cacheMap.set(route, { view: view, focus:
|
|
180
|
+
cacheMap.set(route, { view: view, focus: previousFocus })
|
|
176
181
|
} else {
|
|
177
182
|
// remove and cleanup
|
|
178
183
|
for (let i = 0; i < view[symbols.children].length - 1; i++) {
|