@lightningjs/blits 0.6.6 → 0.6.8
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 +16 -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 +6 -2
- package/src/component.js +12 -0
- package/src/components/Text.js +7 -0
- package/src/element.js +7 -1
- package/src/launch.d.ts +9 -1
- package/src/launch.js +4 -0
- package/src/lib/setup/base.js +21 -18
- package/src/lib/symbols.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v0.6.8
|
|
4
|
+
|
|
5
|
+
_29 jan 2024_
|
|
6
|
+
|
|
7
|
+
- Reverted fix (initially) empty for-loops
|
|
8
|
+
|
|
9
|
+
# v0.6.7
|
|
10
|
+
|
|
11
|
+
_26 jan 2024_
|
|
12
|
+
|
|
13
|
+
- Added `this.$clearInterval` and `this.$clearTimeout` helper functions to Component
|
|
14
|
+
- Updated Lightning renderer to version _0.7.0_
|
|
15
|
+
- Added `lineheight` and `textoverflow` attributes to `<Text />`-component
|
|
16
|
+
- Added setting for specifying maximum number of web workers to spawn (`webWorkersLimit`)
|
|
17
|
+
- Added fix for issue with setting up reactivity for (initially) empty for-loops
|
|
18
|
+
|
|
3
19
|
# v0.6.6
|
|
4
20
|
|
|
5
21
|
_24 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.8",
|
|
4
4
|
"description": "Blits: The Lightning 3 App Development Framework",
|
|
5
5
|
"bin": "bin/index.cjs",
|
|
6
6
|
"exports": {
|
|
@@ -42,7 +42,11 @@
|
|
|
42
42
|
"tape": "^5.5.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lightningjs/renderer": "^0.
|
|
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
|
}
|
package/src/component.js
CHANGED
|
@@ -146,6 +146,18 @@ const Component = (name = required('name'), config = required('config')) => {
|
|
|
146
146
|
enumerable: false,
|
|
147
147
|
configurable: false,
|
|
148
148
|
},
|
|
149
|
+
[symbols.timeouts]: {
|
|
150
|
+
value: [],
|
|
151
|
+
writable: true,
|
|
152
|
+
enumerable: false,
|
|
153
|
+
configurable: false,
|
|
154
|
+
},
|
|
155
|
+
[symbols.intervals]: {
|
|
156
|
+
value: [],
|
|
157
|
+
writable: true,
|
|
158
|
+
enumerable: false,
|
|
159
|
+
configurable: false,
|
|
160
|
+
},
|
|
149
161
|
})
|
|
150
162
|
|
|
151
163
|
Object.defineProperty(this, symbols.originalState, {
|
package/src/components/Text.js
CHANGED
|
@@ -30,11 +30,13 @@ export default () =>
|
|
|
30
30
|
:style="$style"
|
|
31
31
|
:weight="$weight"
|
|
32
32
|
letterSpacing="$letterspacing"
|
|
33
|
+
lineHeight="$_lineheight"
|
|
33
34
|
stretch="$stretch"
|
|
34
35
|
contain="$_contain"
|
|
35
36
|
:wordWrap="$wordwrap"
|
|
36
37
|
:maxLines="$maxlines"
|
|
37
38
|
:textAlign="$align"
|
|
39
|
+
:overflowSuffix="$textoverflow"
|
|
38
40
|
@loaded="$@loaded"
|
|
39
41
|
@error="$@error"
|
|
40
42
|
/>`,
|
|
@@ -57,9 +59,11 @@ export default () =>
|
|
|
57
59
|
'align',
|
|
58
60
|
'wordwrap',
|
|
59
61
|
'maxlines',
|
|
62
|
+
'lineheight',
|
|
60
63
|
'contain',
|
|
61
64
|
'@loaded',
|
|
62
65
|
'@error',
|
|
66
|
+
'textoverflow',
|
|
63
67
|
],
|
|
64
68
|
computed: {
|
|
65
69
|
_contain() {
|
|
@@ -68,5 +72,8 @@ export default () =>
|
|
|
68
72
|
(this.wordwrap && this.maxlines ? 'both' : this.wordwrap ? 'width' : 'none')
|
|
69
73
|
)
|
|
70
74
|
},
|
|
75
|
+
_lineheight() {
|
|
76
|
+
return this.lineheight !== undefined ? this.lineheight : this.size
|
|
77
|
+
},
|
|
71
78
|
},
|
|
72
79
|
})
|
package/src/element.js
CHANGED
|
@@ -201,11 +201,17 @@ const Props = {
|
|
|
201
201
|
this._props.contain = v
|
|
202
202
|
},
|
|
203
203
|
set maxLines(v) {
|
|
204
|
-
this.height = v * this.element.node.
|
|
204
|
+
this.height = v * this.element.node.lineHeight
|
|
205
|
+
},
|
|
206
|
+
set overflowSuffix(v) {
|
|
207
|
+
this._props.overflowSuffix = v === false ? ' ' : v === true ? undefined : v
|
|
205
208
|
},
|
|
206
209
|
set letterSpacing(v) {
|
|
207
210
|
this._props.letterSpacing = v
|
|
208
211
|
},
|
|
212
|
+
set lineHeight(v) {
|
|
213
|
+
this._props.lineHeight = v
|
|
214
|
+
},
|
|
209
215
|
set textAlign(v) {
|
|
210
216
|
this._props.textAlign = v
|
|
211
217
|
},
|
package/src/launch.d.ts
CHANGED
|
@@ -144,7 +144,15 @@ export interface Settings {
|
|
|
144
144
|
*
|
|
145
145
|
* Defaults to 1 if not specified
|
|
146
146
|
*/
|
|
147
|
-
pixelRatio?: number
|
|
147
|
+
pixelRatio?: number,
|
|
148
|
+
/**
|
|
149
|
+
* Maximum number of web workers to spin up simultaneously for offloading functionality such
|
|
150
|
+
* as image loading to separate threads (when supported by the browser)
|
|
151
|
+
*
|
|
152
|
+
* If not specified defaults to the number of logical processers available as reported by
|
|
153
|
+
* `navigator.hardwareConcurrency` (or 2 if `navigator.hardwareConcurrency` is not supported)
|
|
154
|
+
*/
|
|
155
|
+
webWorkersLimit?: number
|
|
148
156
|
}
|
|
149
157
|
|
|
150
158
|
/**
|
package/src/launch.js
CHANGED
|
@@ -46,6 +46,10 @@ export default (App, target, settings) => {
|
|
|
46
46
|
screenResolutions[settings.screenResolution] ||
|
|
47
47
|
screenResolutions[window.innerHeight] ||
|
|
48
48
|
1,
|
|
49
|
+
numImageWorkers:
|
|
50
|
+
'webWorkersLimit' in settings
|
|
51
|
+
? settings.webWorkersLimit
|
|
52
|
+
: window.navigator.hardwareConcurrency || 2,
|
|
49
53
|
},
|
|
50
54
|
target,
|
|
51
55
|
driver
|
package/src/lib/setup/base.js
CHANGED
|
@@ -140,17 +140,11 @@ export default (component) => {
|
|
|
140
140
|
enumerable: false,
|
|
141
141
|
configurable: false,
|
|
142
142
|
},
|
|
143
|
-
[symbols.timeouts]: {
|
|
144
|
-
value: [],
|
|
145
|
-
writable: false,
|
|
146
|
-
enumerable: false,
|
|
147
|
-
configurable: false,
|
|
148
|
-
},
|
|
149
143
|
$setTimeout: {
|
|
150
144
|
value: function (fn, ms, ...params) {
|
|
151
145
|
const timeoutId = setTimeout(
|
|
152
146
|
() => {
|
|
153
|
-
this[symbols.
|
|
147
|
+
this[symbols.timeouts] = this[symbols.timeouts].filter((id) => id !== timeoutId)
|
|
154
148
|
fn.apply(null, params)
|
|
155
149
|
},
|
|
156
150
|
ms,
|
|
@@ -163,22 +157,20 @@ export default (component) => {
|
|
|
163
157
|
enumerable: true,
|
|
164
158
|
configurable: false,
|
|
165
159
|
},
|
|
166
|
-
|
|
167
|
-
value:
|
|
160
|
+
$clearTimeout: {
|
|
161
|
+
value: function (timeoutId) {
|
|
162
|
+
if (this[symbols.timeouts].indexOf(timeoutId) > -1) {
|
|
163
|
+
this[symbols.timeouts] = this[symbols.timeouts].filter((id) => id !== timeoutId)
|
|
164
|
+
clearTimeout(timeoutId)
|
|
165
|
+
}
|
|
166
|
+
},
|
|
168
167
|
writable: false,
|
|
169
|
-
enumerable:
|
|
168
|
+
enumerable: true,
|
|
170
169
|
configurable: false,
|
|
171
170
|
},
|
|
172
171
|
$setInterval: {
|
|
173
172
|
value: function (fn, ms, ...params) {
|
|
174
|
-
const intervalId = setInterval(
|
|
175
|
-
() => {
|
|
176
|
-
this[symbols._intervals] = this[symbols.intervals].filter((id) => id !== intervalId)
|
|
177
|
-
fn.apply(null, params)
|
|
178
|
-
},
|
|
179
|
-
ms,
|
|
180
|
-
params
|
|
181
|
-
)
|
|
173
|
+
const intervalId = setInterval(() => fn.apply(null, params), ms, params)
|
|
182
174
|
this[symbols.intervals].push(intervalId)
|
|
183
175
|
return intervalId
|
|
184
176
|
},
|
|
@@ -186,6 +178,17 @@ export default (component) => {
|
|
|
186
178
|
enumerable: true,
|
|
187
179
|
configurable: false,
|
|
188
180
|
},
|
|
181
|
+
$clearInterval: {
|
|
182
|
+
value: function (intervalId) {
|
|
183
|
+
if (this[symbols.intervals].indexOf(intervalId) > -1) {
|
|
184
|
+
this[symbols.intervals] = this[symbols.intervals].filter((id) => id !== intervalId)
|
|
185
|
+
clearInterval(intervalId)
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
writable: false,
|
|
189
|
+
enumerable: true,
|
|
190
|
+
configurable: false,
|
|
191
|
+
},
|
|
189
192
|
$emit: {
|
|
190
193
|
value: function (event, params) {
|
|
191
194
|
eventListeners.executeListeners(event, params)
|
package/src/lib/symbols.js
CHANGED
|
@@ -7,7 +7,6 @@ export default {
|
|
|
7
7
|
init: Symbol('init'),
|
|
8
8
|
inputEvents: Symbol('inputEvents'),
|
|
9
9
|
intervals: Symbol('intervals'),
|
|
10
|
-
_intervals: Symbol('_intervals'),
|
|
11
10
|
level: Symbol('level'),
|
|
12
11
|
methodKeys: Symbol('methodKeys'),
|
|
13
12
|
originalState: Symbol('originalState'),
|
|
@@ -20,7 +19,6 @@ export default {
|
|
|
20
19
|
stateKeys: Symbol('stateKeys'),
|
|
21
20
|
textnode: Symbol('textnode'),
|
|
22
21
|
timeouts: Symbol('timeouts'),
|
|
23
|
-
_timeouts: Symbol('_timeouts'),
|
|
24
22
|
type: Symbol('type'),
|
|
25
23
|
watchers: Symbol('watchers'),
|
|
26
24
|
watchKeys: Symbol('watchKeys'),
|