@lightningjs/blits 1.30.1 → 1.30.2
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/.editorconfig +7 -7
- package/.eslintignore +1 -1
- package/.eslintrc.cjs +65 -65
- package/.github/workflows/comment-lint-results.yml +124 -124
- package/.github/workflows/comment-test-results.yml +108 -108
- package/.github/workflows/deploy-docs.yml +27 -27
- package/.github/workflows/run-blits-tests.yml +141 -141
- package/.github/workflows/run-lint.yml +127 -127
- package/.husky/pre-commit +1 -1
- package/.vscode/extensions.json +7 -7
- package/.vscode/settings.json +9 -9
- package/CHANGELOG.md +1019 -1012
- package/COPYING +1 -0
- package/LICENSE +202 -202
- package/NOTICE +12 -12
- package/README.md +33 -33
- package/bin/index.js +8 -8
- package/blits.d.ts +6 -6
- package/docs/README.md +19 -19
- package/docs/_sidebar.md +37 -37
- package/docs/built-in/directives.md +50 -50
- package/docs/built-in/for-loop.md +203 -203
- package/docs/built-in/layout.md +168 -168
- package/docs/components/component_state.md +90 -90
- package/docs/components/computed_properties.md +45 -45
- package/docs/components/lifecycle_events.md +42 -42
- package/docs/components/methods.md +45 -45
- package/docs/components/props.md +56 -56
- package/docs/components/user_input.md +186 -186
- package/docs/components/utility_methods.md +320 -320
- package/docs/components/watchers.md +34 -34
- package/docs/essentials/application_root.md +19 -19
- package/docs/essentials/components.md +68 -68
- package/docs/essentials/displaying_images.md +67 -67
- package/docs/essentials/displaying_text.md +135 -135
- package/docs/essentials/element_attributes.md +195 -195
- package/docs/essentials/settings.md +117 -117
- package/docs/essentials/template_syntax.md +83 -83
- package/docs/getting_started/file_structure.md +58 -58
- package/docs/getting_started/getting_started.md +45 -45
- package/docs/getting_started/intro.md +20 -20
- package/docs/index.html +47 -47
- package/docs/performance/lazy-loading.md +161 -161
- package/docs/plugins/global_app_state.md +98 -98
- package/docs/plugins/language.md +172 -172
- package/docs/plugins/text-to-speech-announcer.md +119 -119
- package/docs/plugins/theme.md +176 -176
- package/docs/router/basics.md +175 -175
- package/docs/router/hooks.md +70 -70
- package/docs/router/transitions.md +146 -146
- package/docs/sidebar.json +171 -171
- package/docs/transitions_animations/transitions.md +150 -150
- package/index.d.ts +1099 -1099
- package/index.js +28 -28
- package/jsconfig.json +12 -12
- package/package.json +56 -56
- package/public/assets/fps_sprite.base64.js +1 -1
- package/scripts/postpublish.js +59 -59
- package/scripts/prepublishOnly.js +84 -84
- package/scripts/prepush.js +78 -78
- package/src/announcer/announcer.js +162 -162
- package/src/announcer/speechSynthesis.js +107 -107
- package/src/application.js +100 -100
- package/src/component/base/announcer.js +27 -27
- package/src/component/base/events.js +69 -69
- package/src/component/base/index.js +33 -33
- package/src/component/base/methods.js +244 -244
- package/src/component/base/router.js +41 -41
- package/src/component/base/timeouts_intervals.js +99 -99
- package/src/component/base/utils.js +72 -72
- package/src/component/setup/computed.js +48 -48
- package/src/component/setup/index.js +62 -62
- package/src/component/setup/input.js +30 -30
- package/src/component/setup/methods.js +37 -37
- package/src/component/setup/props.js +62 -62
- package/src/component/setup/props.test.js +238 -238
- package/src/component/setup/routes.js +42 -42
- package/src/component/setup/state.js +59 -59
- package/src/component/setup/watch.js +35 -35
- package/src/component.js +437 -437
- package/src/component.test.js +388 -388
- package/src/components/Circle.js +73 -73
- package/src/components/Circle.orig.js +31 -31
- package/src/components/FPScounter.js +1510 -1510
- package/src/components/FPScounter.orig.js +121 -121
- package/src/components/RouterView.js +81 -81
- package/src/components/RouterView.orig.js +54 -54
- package/src/components/Sprite.js +94 -94
- package/src/components/Sprite.orig.js +58 -58
- package/src/components/index.js +28 -28
- package/src/components/index.orig.js +28 -28
- package/src/constants.js +21 -21
- package/src/engine.js +1 -1
- package/src/engines/L3/element.js +744 -744
- package/src/engines/L3/element.test.js +579 -579
- package/src/engines/L3/fontLoader.js +38 -38
- package/src/engines/L3/index.js +7 -7
- package/src/engines/L3/launch.js +123 -123
- package/src/engines/L3/shaderLoader.js +12 -12
- package/src/engines/index.js +1 -1
- package/src/focus.js +90 -90
- package/src/helpers/deepEqualArray.js +50 -50
- package/src/helpers/deepEqualArray.test.js +127 -127
- package/src/helpers/fetchJson.js +34 -34
- package/src/helpers/sequence.js +26 -26
- package/src/launch.js +123 -123
- package/src/lib/blitsfileconverter/blitsfileconverter.js +52 -52
- package/src/lib/codegenerator/generator.js +788 -788
- package/src/lib/codegenerator/generator.test.js +3801 -3801
- package/src/lib/colors/colors.js +92 -92
- package/src/lib/colors/colors.test.js +290 -290
- package/src/lib/colors/htmlColors.js +168 -168
- package/src/lib/componentId.js +49 -49
- package/src/lib/componentId.test.js +84 -84
- package/src/lib/eventListeners.js +123 -123
- package/src/lib/eventListeners.test.js +236 -236
- package/src/lib/hooks.js +59 -59
- package/src/lib/lifecycle.js +85 -85
- package/src/lib/log.js +117 -117
- package/src/lib/precompiler/precompiler.js +73 -73
- package/src/lib/reactivity/effect.js +93 -93
- package/src/lib/reactivity/effect.test.js +35 -35
- package/src/lib/reactivity/reactive.js +208 -208
- package/src/lib/reactivity/reactive.test.js +27 -27
- package/src/lib/reactivityguard/computedprops.js +218 -218
- package/src/lib/symbols.js +108 -108
- package/src/lib/templateparser/parser.js +386 -386
- package/src/lib/templateparser/parser.test.js +1411 -1411
- package/src/lib/utils.js +27 -27
- package/src/plugin.js +27 -27
- package/src/plugins/appstate.js +26 -26
- package/src/plugins/index.js +20 -20
- package/src/plugins/language.js +152 -152
- package/src/plugins/log.js +25 -25
- package/src/plugins/theme.js +94 -94
- package/src/router/router.js +514 -514
- package/src/router/router.test.js +473 -473
- package/src/router/transitions/fadeIn.js +27 -27
- package/src/router/transitions/fadeInOut.js +33 -33
- package/src/router/transitions/index.js +21 -21
- package/src/router/transitions/slideIn.js +28 -28
- package/src/router/transitions/slideInOut.js +33 -33
- package/src/settings.js +40 -40
- package/vite/blitsFileConverter.js +67 -67
- package/vite/index.js +28 -28
- package/vite/msdfGenerator.js +269 -269
- package/vite/preCompiler.js +42 -42
- package/vite/reactivityGuard.js +45 -45
- package/vscode/data/template-attributes.json +589 -589
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
# Template syntax
|
|
2
|
-
|
|
3
|
-
Blits uses an easy-to-read _XML-style_ template syntax. The syntax is inspired by frameworks like VueJS, so if you are familiar with Vue, you will probably recognize certain concepts.
|
|
4
|
-
|
|
5
|
-
The `template` key in the _Component configuration object_ is used to specify a string with this XML-like template structure. Templates can often span multiple lines. In those cases, it's advisable to use `template literals` (enclosed by backticks).
|
|
6
|
-
|
|
7
|
-
Similar to HTML, you can use arguments and nested tags. Self-closing tags and HTML-style comments are also supported in Blits templates.
|
|
8
|
-
|
|
9
|
-
The default tag that can be used in templates is the `<Element>` tag. The Element tag corresponds to a node in the Lightning 3 renderer.
|
|
10
|
-
|
|
11
|
-
For each element, there is a set of predefined render properties, such as `x`, `y`, `w`, `color` that define how the element looks and where it is positioned. Detailed information on all the attributes supported by the `<Element>` tag can be found [here](./element_attributes.md).
|
|
12
|
-
|
|
13
|
-
Now let's consider the following template example:
|
|
14
|
-
|
|
15
|
-
```xml
|
|
16
|
-
<Element x="20" y="20">
|
|
17
|
-
<Element w="100" h="100" x="360" color="#0891b2" />
|
|
18
|
-
<Element w="$width" h="$height" color="$color" />
|
|
19
|
-
<Element :w="$changingWidth" :h="Math.floor($height / 5)" :color="$highlight" />
|
|
20
|
-
</Element>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Hardcoded arguments
|
|
24
|
-
|
|
25
|
-
In the template above, you'll observe certain arguments with hardcoded values (i.e. `w="100"` and `color="#0891b2"`).
|
|
26
|
-
You can use hardcoded arguments to configure the parts of your template that you know will never change.
|
|
27
|
-
|
|
28
|
-
## Dynamic arguments
|
|
29
|
-
|
|
30
|
-
Additionally, some arguments contain a value prefixed with a dollar sign (`$`). These are so called _dynamic_ arguments.
|
|
31
|
-
|
|
32
|
-
The `$`-sign used in a template refers to a (state) variable on the Component. And when the template renders, it automatically populates
|
|
33
|
-
these arguments with dynamic values based on the initial state of your Component.
|
|
34
|
-
|
|
35
|
-
It's important to realize that dynamic arguments are only set _once_. Changing a value used in a dynamic argument, won't be reflected
|
|
36
|
-
on screen. For that you will need to use _reactive_ arguments.
|
|
37
|
-
|
|
38
|
-
## Reactive arguments
|
|
39
|
-
|
|
40
|
-
If you look at the template example above you'll notice that certain arguments are prefixed with a colon sign (`:`). Prefixing an argument
|
|
41
|
-
with a colon makes it not only dynamic but also _reactive_.
|
|
42
|
-
|
|
43
|
-
Reactive arguments are set with the initial state value when your component first renders, exactly as a dynamic argument does.
|
|
44
|
-
|
|
45
|
-
The difference is that a _re-render_ of (a portion of) the template will be triggered whenever the referenced value in your Component's internal state changes.
|
|
46
|
-
|
|
47
|
-
This concept of _reactive data binding_ eliminates the need for manual template patching and allows for a declarative way of programming.
|
|
48
|
-
|
|
49
|
-
Reactive arguments also support _interpolation_. This enables the use of simple JavaScript instructions, such as ternary conditions or basic String and Math manipulations, right inside your template arguments.
|
|
50
|
-
|
|
51
|
-
For more complex logic, it's recommended to abstract this into a [Component method](../components/methods.md) or a [Computed property](../components/computed_properties.md).
|
|
52
|
-
|
|
53
|
-
# Abstracting template portions to custom components
|
|
54
|
-
|
|
55
|
-
As your template grows in complexity, you may want to organize your codebase with custom components, abstracting a complex template into smaller, reusable pieces.
|
|
56
|
-
|
|
57
|
-
When you've abstracted a portion of a template into a separate component, a _Menu_ component for example, you'll first need to `import` the file that contains the Menu component.
|
|
58
|
-
|
|
59
|
-
Next, you have to _register_ the imported custom component. The `components`-key in the _configuration object_ is used for this.
|
|
60
|
-
|
|
61
|
-
The `components` key is an _object literal_, where the value is the reference to the custom Blits component and the key will correspond with the _tag_ that can be used in the template to insert the component.
|
|
62
|
-
|
|
63
|
-
Once this is done, the tag (`<Menu>` for example) is available for use in your component's template. You can use the component tag as many times as you want. For each tag, a new Component instance will be created.
|
|
64
|
-
|
|
65
|
-
The example below shows how to use a custom `Menu` and `Button` (aliased to `MyButton`) component inside a template.
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
import Menu from './components/menu.js'
|
|
69
|
-
import Button from './components/button.js'
|
|
70
|
-
|
|
71
|
-
export default Blits.Component('MyComponent', {
|
|
72
|
-
components: {
|
|
73
|
-
Menu, // makes <Menu /> available for use in the template
|
|
74
|
-
MyButton: Button, // makes Button available as <MyButton /> in the template
|
|
75
|
-
},
|
|
76
|
-
template: `
|
|
77
|
-
<Element>
|
|
78
|
-
<Menu />
|
|
79
|
-
<MyButton />
|
|
80
|
-
</Element>
|
|
81
|
-
`
|
|
82
|
-
})
|
|
83
|
-
```
|
|
1
|
+
# Template syntax
|
|
2
|
+
|
|
3
|
+
Blits uses an easy-to-read _XML-style_ template syntax. The syntax is inspired by frameworks like VueJS, so if you are familiar with Vue, you will probably recognize certain concepts.
|
|
4
|
+
|
|
5
|
+
The `template` key in the _Component configuration object_ is used to specify a string with this XML-like template structure. Templates can often span multiple lines. In those cases, it's advisable to use `template literals` (enclosed by backticks).
|
|
6
|
+
|
|
7
|
+
Similar to HTML, you can use arguments and nested tags. Self-closing tags and HTML-style comments are also supported in Blits templates.
|
|
8
|
+
|
|
9
|
+
The default tag that can be used in templates is the `<Element>` tag. The Element tag corresponds to a node in the Lightning 3 renderer.
|
|
10
|
+
|
|
11
|
+
For each element, there is a set of predefined render properties, such as `x`, `y`, `w`, `color` that define how the element looks and where it is positioned. Detailed information on all the attributes supported by the `<Element>` tag can be found [here](./element_attributes.md).
|
|
12
|
+
|
|
13
|
+
Now let's consider the following template example:
|
|
14
|
+
|
|
15
|
+
```xml
|
|
16
|
+
<Element x="20" y="20">
|
|
17
|
+
<Element w="100" h="100" x="360" color="#0891b2" />
|
|
18
|
+
<Element w="$width" h="$height" color="$color" />
|
|
19
|
+
<Element :w="$changingWidth" :h="Math.floor($height / 5)" :color="$highlight" />
|
|
20
|
+
</Element>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Hardcoded arguments
|
|
24
|
+
|
|
25
|
+
In the template above, you'll observe certain arguments with hardcoded values (i.e. `w="100"` and `color="#0891b2"`).
|
|
26
|
+
You can use hardcoded arguments to configure the parts of your template that you know will never change.
|
|
27
|
+
|
|
28
|
+
## Dynamic arguments
|
|
29
|
+
|
|
30
|
+
Additionally, some arguments contain a value prefixed with a dollar sign (`$`). These are so called _dynamic_ arguments.
|
|
31
|
+
|
|
32
|
+
The `$`-sign used in a template refers to a (state) variable on the Component. And when the template renders, it automatically populates
|
|
33
|
+
these arguments with dynamic values based on the initial state of your Component.
|
|
34
|
+
|
|
35
|
+
It's important to realize that dynamic arguments are only set _once_. Changing a value used in a dynamic argument, won't be reflected
|
|
36
|
+
on screen. For that you will need to use _reactive_ arguments.
|
|
37
|
+
|
|
38
|
+
## Reactive arguments
|
|
39
|
+
|
|
40
|
+
If you look at the template example above you'll notice that certain arguments are prefixed with a colon sign (`:`). Prefixing an argument
|
|
41
|
+
with a colon makes it not only dynamic but also _reactive_.
|
|
42
|
+
|
|
43
|
+
Reactive arguments are set with the initial state value when your component first renders, exactly as a dynamic argument does.
|
|
44
|
+
|
|
45
|
+
The difference is that a _re-render_ of (a portion of) the template will be triggered whenever the referenced value in your Component's internal state changes.
|
|
46
|
+
|
|
47
|
+
This concept of _reactive data binding_ eliminates the need for manual template patching and allows for a declarative way of programming.
|
|
48
|
+
|
|
49
|
+
Reactive arguments also support _interpolation_. This enables the use of simple JavaScript instructions, such as ternary conditions or basic String and Math manipulations, right inside your template arguments.
|
|
50
|
+
|
|
51
|
+
For more complex logic, it's recommended to abstract this into a [Component method](../components/methods.md) or a [Computed property](../components/computed_properties.md).
|
|
52
|
+
|
|
53
|
+
# Abstracting template portions to custom components
|
|
54
|
+
|
|
55
|
+
As your template grows in complexity, you may want to organize your codebase with custom components, abstracting a complex template into smaller, reusable pieces.
|
|
56
|
+
|
|
57
|
+
When you've abstracted a portion of a template into a separate component, a _Menu_ component for example, you'll first need to `import` the file that contains the Menu component.
|
|
58
|
+
|
|
59
|
+
Next, you have to _register_ the imported custom component. The `components`-key in the _configuration object_ is used for this.
|
|
60
|
+
|
|
61
|
+
The `components` key is an _object literal_, where the value is the reference to the custom Blits component and the key will correspond with the _tag_ that can be used in the template to insert the component.
|
|
62
|
+
|
|
63
|
+
Once this is done, the tag (`<Menu>` for example) is available for use in your component's template. You can use the component tag as many times as you want. For each tag, a new Component instance will be created.
|
|
64
|
+
|
|
65
|
+
The example below shows how to use a custom `Menu` and `Button` (aliased to `MyButton`) component inside a template.
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import Menu from './components/menu.js'
|
|
69
|
+
import Button from './components/button.js'
|
|
70
|
+
|
|
71
|
+
export default Blits.Component('MyComponent', {
|
|
72
|
+
components: {
|
|
73
|
+
Menu, // makes <Menu /> available for use in the template
|
|
74
|
+
MyButton: Button, // makes Button available as <MyButton /> in the template
|
|
75
|
+
},
|
|
76
|
+
template: `
|
|
77
|
+
<Element>
|
|
78
|
+
<Menu />
|
|
79
|
+
<MyButton />
|
|
80
|
+
</Element>
|
|
81
|
+
`
|
|
82
|
+
})
|
|
83
|
+
```
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
# File structure
|
|
2
|
-
|
|
3
|
-
Once you have created a new Blits App using the boilerplate described in the [Getting started](getting_started.md), you should have a project with all the basics you need.
|
|
4
|
-
|
|
5
|
-
Let's review the basic file structure, and take a closer look at the important ones.
|
|
6
|
-
|
|
7
|
-
## package.json
|
|
8
|
-
|
|
9
|
-
In the root of your newly created app, you will obviously find a `package.json` with all the necessary (dev) dependencies.
|
|
10
|
-
|
|
11
|
-
In order to build a Blits based Lightning 3 app, all you need is `@lightningjs/blits` as a dependency. Blits will take care of hooking up the Lightning 3 renderer for you behind the scenes.
|
|
12
|
-
|
|
13
|
-
Feel free to install and import any custom library that your App may need. But always be mindful of the size and impact an external dependency may have - especially when developing for low powered devices (as is often the case with Lightning apps).
|
|
14
|
-
|
|
15
|
-
## index.html
|
|
16
|
-
|
|
17
|
-
You will also find an `index.html` at the root of your project. This is where the browser will be pointed to, in order to launch your Blits App.
|
|
18
|
-
|
|
19
|
-
If you inspect the source you will see some minimal HTML. The essential parts of the HTML are the `<div>` where the canvas will be injected into, and the `<script>`-tag that points to the `index.js` of the App.
|
|
20
|
-
|
|
21
|
-
## public
|
|
22
|
-
|
|
23
|
-
There is also a `public` folder in your project. This folder is used for storing public assets, such as App images and fonts.
|
|
24
|
-
|
|
25
|
-
During development, your assets are loaded directly from this folder. And if you run a production build, the entire `public` folder is copied over to the distributable version.
|
|
26
|
-
|
|
27
|
-
## src
|
|
28
|
-
|
|
29
|
-
The `src`-folder is where all your custom App code lives.
|
|
30
|
-
|
|
31
|
-
### index.js
|
|
32
|
-
|
|
33
|
-
`src/index.js` is the entry point of your App. This file imports the Blits `Launch`-method which initializes the App.
|
|
34
|
-
|
|
35
|
-
The `Blits.Launch()`-method accepts 3 parameters:
|
|
36
|
-
|
|
37
|
-
1) `app` - the root application component
|
|
38
|
-
2) `target` - the HTML target to append the canvas to. This can either be an `id` of an HTML element in `index.html`, or you can pass a reference to HTML element itself
|
|
39
|
-
3) `settings` - an `object` with settings
|
|
40
|
-
|
|
41
|
-
### App.js
|
|
42
|
-
|
|
43
|
-
`src/App.js` is the default file where the root application component lives. It's expected to export a `Blits.Application()`-instance, which is the base component of your App.
|
|
44
|
-
|
|
45
|
-
## components and pages folder
|
|
46
|
-
|
|
47
|
-
The rest of your App can be built out using components. You are free to organize your components as you wish, but we recommend using a separate file for each component and placing them in the `src/components`-folder.
|
|
48
|
-
|
|
49
|
-
The convention is to start the component file name with a capital letter, matching the name of the component (e.g. `src/components/Loader.js` or `src/components/MenuItem.js`).
|
|
50
|
-
|
|
51
|
-
Feel free to further organize and possibly nest your Component files to your own preferences.
|
|
52
|
-
|
|
53
|
-
Pages in your App are technically just Blits components as well. But to keep things clear, we often place them in a separate `pages`-folder alongside the `components`-folder (e.g. `src/pages/Home.js` and `src/pages/Details.js`)
|
|
54
|
-
|
|
55
|
-
### Custom code
|
|
56
|
-
|
|
57
|
-
If your App needs libraries for specific (business) logic that can be shared across components (such as API calls) you can place them anywhere in your `src` folder. For example in a folder named `src/lib` or `src/api`.
|
|
58
|
-
|
|
1
|
+
# File structure
|
|
2
|
+
|
|
3
|
+
Once you have created a new Blits App using the boilerplate described in the [Getting started](getting_started.md), you should have a project with all the basics you need.
|
|
4
|
+
|
|
5
|
+
Let's review the basic file structure, and take a closer look at the important ones.
|
|
6
|
+
|
|
7
|
+
## package.json
|
|
8
|
+
|
|
9
|
+
In the root of your newly created app, you will obviously find a `package.json` with all the necessary (dev) dependencies.
|
|
10
|
+
|
|
11
|
+
In order to build a Blits based Lightning 3 app, all you need is `@lightningjs/blits` as a dependency. Blits will take care of hooking up the Lightning 3 renderer for you behind the scenes.
|
|
12
|
+
|
|
13
|
+
Feel free to install and import any custom library that your App may need. But always be mindful of the size and impact an external dependency may have - especially when developing for low powered devices (as is often the case with Lightning apps).
|
|
14
|
+
|
|
15
|
+
## index.html
|
|
16
|
+
|
|
17
|
+
You will also find an `index.html` at the root of your project. This is where the browser will be pointed to, in order to launch your Blits App.
|
|
18
|
+
|
|
19
|
+
If you inspect the source you will see some minimal HTML. The essential parts of the HTML are the `<div>` where the canvas will be injected into, and the `<script>`-tag that points to the `index.js` of the App.
|
|
20
|
+
|
|
21
|
+
## public
|
|
22
|
+
|
|
23
|
+
There is also a `public` folder in your project. This folder is used for storing public assets, such as App images and fonts.
|
|
24
|
+
|
|
25
|
+
During development, your assets are loaded directly from this folder. And if you run a production build, the entire `public` folder is copied over to the distributable version.
|
|
26
|
+
|
|
27
|
+
## src
|
|
28
|
+
|
|
29
|
+
The `src`-folder is where all your custom App code lives.
|
|
30
|
+
|
|
31
|
+
### index.js
|
|
32
|
+
|
|
33
|
+
`src/index.js` is the entry point of your App. This file imports the Blits `Launch`-method which initializes the App.
|
|
34
|
+
|
|
35
|
+
The `Blits.Launch()`-method accepts 3 parameters:
|
|
36
|
+
|
|
37
|
+
1) `app` - the root application component
|
|
38
|
+
2) `target` - the HTML target to append the canvas to. This can either be an `id` of an HTML element in `index.html`, or you can pass a reference to HTML element itself
|
|
39
|
+
3) `settings` - an `object` with settings
|
|
40
|
+
|
|
41
|
+
### App.js
|
|
42
|
+
|
|
43
|
+
`src/App.js` is the default file where the root application component lives. It's expected to export a `Blits.Application()`-instance, which is the base component of your App.
|
|
44
|
+
|
|
45
|
+
## components and pages folder
|
|
46
|
+
|
|
47
|
+
The rest of your App can be built out using components. You are free to organize your components as you wish, but we recommend using a separate file for each component and placing them in the `src/components`-folder.
|
|
48
|
+
|
|
49
|
+
The convention is to start the component file name with a capital letter, matching the name of the component (e.g. `src/components/Loader.js` or `src/components/MenuItem.js`).
|
|
50
|
+
|
|
51
|
+
Feel free to further organize and possibly nest your Component files to your own preferences.
|
|
52
|
+
|
|
53
|
+
Pages in your App are technically just Blits components as well. But to keep things clear, we often place them in a separate `pages`-folder alongside the `components`-folder (e.g. `src/pages/Home.js` and `src/pages/Details.js`)
|
|
54
|
+
|
|
55
|
+
### Custom code
|
|
56
|
+
|
|
57
|
+
If your App needs libraries for specific (business) logic that can be shared across components (such as API calls) you can place them anywhere in your `src` folder. For example in a folder named `src/lib` or `src/api`.
|
|
58
|
+
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# Getting Started
|
|
2
|
-
|
|
3
|
-
To get started with Blits, follow these simple steps to set up your development environment and create your first Lightning 3 App.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
1. Open your terminal or command prompt.
|
|
8
|
-
|
|
9
|
-
2. Run the following command to start a new Blits Lightning 3 App project:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm create @lightningjs/app
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
You will be guided through a short series of questions to generate a new project with all the boilerplate code you need to start building your own Lightning 3 App.
|
|
16
|
-
|
|
17
|
-
3. Navigate to the newly created project directory and install the project dependencies:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
cd my_blits_app
|
|
21
|
-
npm install
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Running Your App
|
|
25
|
-
|
|
26
|
-
4. After installing the dependencies, you can start your development server by running:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm run dev
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
This command will create an application bundle and launch a development server using Vite.
|
|
33
|
-
|
|
34
|
-
Once the server is up and running, open your web browser and navigate to the URL displayed in the console. Congratulations! You now have your brand new Blits Lightning 3 App up and running.
|
|
35
|
-
|
|
36
|
-
## Coding environment
|
|
37
|
-
|
|
38
|
-
You can use any code editor of your preference to further develop your Blits App.
|
|
39
|
-
|
|
40
|
-
We recommend using VS code, since we have a dedicated [VS code extension for Blits](https://marketplace.visualstudio.com/items?itemName=LightningJS.lightning-blits) that provides better syntax highlighting, code completion, error
|
|
41
|
-
checking, and other features to make working with Blits easier.
|
|
42
|
-
|
|
43
|
-
## Next steps
|
|
44
|
-
|
|
45
|
-
You are now ready to dive into the world of App development using Blits. In the following sections, we will explore the core concepts and guide you through building your TV applications step by step.
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
To get started with Blits, follow these simple steps to set up your development environment and create your first Lightning 3 App.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Open your terminal or command prompt.
|
|
8
|
+
|
|
9
|
+
2. Run the following command to start a new Blits Lightning 3 App project:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm create @lightningjs/app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You will be guided through a short series of questions to generate a new project with all the boilerplate code you need to start building your own Lightning 3 App.
|
|
16
|
+
|
|
17
|
+
3. Navigate to the newly created project directory and install the project dependencies:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd my_blits_app
|
|
21
|
+
npm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Running Your App
|
|
25
|
+
|
|
26
|
+
4. After installing the dependencies, you can start your development server by running:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This command will create an application bundle and launch a development server using Vite.
|
|
33
|
+
|
|
34
|
+
Once the server is up and running, open your web browser and navigate to the URL displayed in the console. Congratulations! You now have your brand new Blits Lightning 3 App up and running.
|
|
35
|
+
|
|
36
|
+
## Coding environment
|
|
37
|
+
|
|
38
|
+
You can use any code editor of your preference to further develop your Blits App.
|
|
39
|
+
|
|
40
|
+
We recommend using VS code, since we have a dedicated [VS code extension for Blits](https://marketplace.visualstudio.com/items?itemName=LightningJS.lightning-blits) that provides better syntax highlighting, code completion, error
|
|
41
|
+
checking, and other features to make working with Blits easier.
|
|
42
|
+
|
|
43
|
+
## Next steps
|
|
44
|
+
|
|
45
|
+
You are now ready to dive into the world of App development using Blits. In the following sections, we will explore the core concepts and guide you through building your TV applications step by step.
|
|
@@ -1,20 +1,20 @@
|
|
|
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 team is based in the Netherlands). It means _flashy_ and it's often used 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 🙂
|
|
20
|
-
|
|
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 team is based in the Netherlands). It means _flashy_ and it's often used 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 🙂
|
|
20
|
+
|
package/docs/index.html
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<title>Blits Lightning App Development Framework</title>
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
7
|
-
<meta name="description" content="Description">
|
|
8
|
-
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
9
|
-
<!--link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css"-->
|
|
10
|
-
<link
|
|
11
|
-
rel="stylesheet"
|
|
12
|
-
href="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"
|
|
13
|
-
title="docsify-darklight-theme"
|
|
14
|
-
type="text/css"
|
|
15
|
-
/>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<div id="app"></div>
|
|
19
|
-
<script>
|
|
20
|
-
window.$docsify = {
|
|
21
|
-
name: 'Blits <br />L3 App Development Framework',
|
|
22
|
-
repo: 'https://github.com/lightning-js/blits/',
|
|
23
|
-
loadSidebar: true,
|
|
24
|
-
relativePath: true,
|
|
25
|
-
auto2top: true,
|
|
26
|
-
search: {
|
|
27
|
-
maxAge: 24*60*60*1000, // one day
|
|
28
|
-
paths: 'auto',
|
|
29
|
-
placeholder: 'Type to search',
|
|
30
|
-
noData: 'No Results!',
|
|
31
|
-
depth: 6,
|
|
32
|
-
},
|
|
33
|
-
darklightTheme: {
|
|
34
|
-
defaultTheme : 'dark',
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
</script>
|
|
39
|
-
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
|
40
|
-
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
|
|
41
|
-
<script
|
|
42
|
-
src="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/index.min.js"
|
|
43
|
-
type="text/javascript">
|
|
44
|
-
</script>
|
|
45
|
-
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
|
|
46
|
-
</body>
|
|
47
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Blits Lightning App Development Framework</title>
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
7
|
+
<meta name="description" content="Description">
|
|
8
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
9
|
+
<!--link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css"-->
|
|
10
|
+
<link
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
href="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"
|
|
13
|
+
title="docsify-darklight-theme"
|
|
14
|
+
type="text/css"
|
|
15
|
+
/>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
<script>
|
|
20
|
+
window.$docsify = {
|
|
21
|
+
name: 'Blits <br />L3 App Development Framework',
|
|
22
|
+
repo: 'https://github.com/lightning-js/blits/',
|
|
23
|
+
loadSidebar: true,
|
|
24
|
+
relativePath: true,
|
|
25
|
+
auto2top: true,
|
|
26
|
+
search: {
|
|
27
|
+
maxAge: 24*60*60*1000, // one day
|
|
28
|
+
paths: 'auto',
|
|
29
|
+
placeholder: 'Type to search',
|
|
30
|
+
noData: 'No Results!',
|
|
31
|
+
depth: 6,
|
|
32
|
+
},
|
|
33
|
+
darklightTheme: {
|
|
34
|
+
defaultTheme : 'dark',
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0"></script>
|
|
41
|
+
<script
|
|
42
|
+
src="//cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/index.min.js"
|
|
43
|
+
type="text/javascript">
|
|
44
|
+
</script>
|
|
45
|
+
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|