@lightningjs/blits 0.9.6 → 0.9.7

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,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.9.7
4
+
5
+ _15 apr 2024_
6
+
7
+ - Added support for direct assignment of an Array element and triggering reactivity
8
+ - Added support for .env in boilerplate
9
+ - Fixed issue with Blits component being wrapped in a Proxy when assigned to a state variable
10
+ - Fixed built-in `hasFocus`-state to also work for components that don't have state in their config object
11
+
3
12
  ## v0.9.6
4
13
 
5
14
  _4 apr 2024_
@@ -29,7 +38,7 @@ _25 mar 2024_
29
38
 
30
39
  - Added support for mount / pivot on Text elements and Sprites.
31
40
 
32
- # v0.9.2
41
+ ## v0.9.2
33
42
 
34
43
  _21 mar 2024_
35
44
 
@@ -32,7 +32,7 @@ module.exports = {
32
32
  },
33
33
  parserOptions: {
34
34
  parser: 'babel-eslint',
35
- ecmaVersion: 2018,
35
+ ecmaVersion: 2020,
36
36
  sourceType: 'module',
37
37
  },
38
38
  }
@@ -1,5 +1,8 @@
1
1
  .DS_Store
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+
2
6
  node_modules
3
7
  build
4
8
  dist
5
- env
@@ -0,0 +1,4 @@
1
+ # all environment variables need to prefixed with VITE_*
2
+ # to read, use import.meta.env.VITE_FOO
3
+
4
+ # VITE_FOO=bar
@@ -2,7 +2,7 @@ import Blits from '@lightningjs/blits'
2
2
 
3
3
  import Loader from '../components/Loader.js'
4
4
 
5
- export default Blits.Component('Loading', {
5
+ export default Blits.Component('Home', {
6
6
  components: {
7
7
  Loader,
8
8
  },
@@ -1,3 +1,5 @@
1
+ /// <reference types="vite/client" />
2
+
1
3
  import { defineConfig } from 'vite'
2
4
  import blitsVitePlugins from '@lightningjs/blits/vite'
3
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
package/src/component.js CHANGED
@@ -68,7 +68,7 @@ const Component = (name = required('name'), config = required('config')) => {
68
68
  if (config.methods) setupMethods(component, config.methods)
69
69
 
70
70
  // setup state
71
- if (config.state) setupState(component, config.state)
71
+ setupState(component, config.state)
72
72
 
73
73
  // setup computed
74
74
  if (config.computed) setupComputed(component, config.computed)
@@ -19,35 +19,38 @@ import Component from '../component.js'
19
19
 
20
20
  export default () =>
21
21
  Component('Circle', {
22
- /* eslint-disable no-unused-vars */
23
- code: { render: function anonymous(parent,component,context
24
- ) {
25
- const elms = []
22
+ /* eslint-disable no-unused-vars */
23
+ code: {
24
+ render: function anonymous(parent, component, context) {
25
+ const elms = []
26
26
 
27
- if(!elms[0]) {
28
- elms[0] = this.element({parent: parent || 'root'}, component)
29
- }
30
- const elementConfig0 = {}
31
-
27
+ if (!elms[0]) {
28
+ elms[0] = this.element({ parent: parent || 'root' }, component)
29
+ }
30
+ const elementConfig0 = {}
32
31
 
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: {}},
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
+ },
51
54
  props: [{ key: 'size', default: 40 }, 'color'],
52
55
  computed: {
53
56
  radius() {
@@ -19,35 +19,9 @@ import Component from '../component.js'
19
19
 
20
20
  export default () =>
21
21
  Component('Circle', {
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: {}},
22
+ template: `
23
+ <Element :color="$color" :w="$size" :h="$size" :effects="[$shader('radius', {radius: $radius})]"></Element>
24
+ `,
51
25
  props: [{ key: 'size', default: 40 }, 'color'],
52
26
  computed: {
53
27
  radius() {