@lightningjs/blits 1.3.0 → 1.3.1

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.3.1
4
+
5
+ _27 aug 2024_
6
+
7
+ - Moved `this.$log` functionality to a plugin, which delays the instantation and allows it to pick up launch settings (bug fix)
8
+
9
+
3
10
  ## v1.3.0
4
11
 
5
12
  _19 aug 2024_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -18,7 +18,6 @@
18
18
  import methods from './methods.js'
19
19
  import scheduling from './timeouts_intervals.js'
20
20
  import events from './events.js'
21
- import log from './log.js'
22
21
  import router from './router.js'
23
22
  import announcer from './announcer.js'
24
23
  import utils from './utils.js'
@@ -26,7 +25,7 @@ import symbols from '../../lib/symbols.js'
26
25
 
27
26
  export default Object.defineProperties(
28
27
  {
29
- [symbols['pluginsRegistered']]: false,
28
+ [symbols['launched']]: false,
30
29
  },
31
- { ...methods, ...scheduling, ...events, ...log, ...router, ...announcer, ...utils }
30
+ { ...methods, ...scheduling, ...events, ...router, ...announcer, ...utils }
32
31
  )
package/src/component.js CHANGED
@@ -199,8 +199,8 @@ const Component = (name = required('name'), config = required('config')) => {
199
199
  }
200
200
 
201
201
  const factory = (options = {}, parentEl, parentComponent, rootComponent) => {
202
- // Register user defined plugins once on the Base object
203
- if (Base[symbols['pluginsRegistered']] === false) {
202
+ if (Base[symbols['launched']] === false) {
203
+ // Register user defined plugins once on the Base object (after launch)
204
204
  Object.keys(plugins).forEach((pluginName) => {
205
205
  const prefixedPluginName = `$${pluginName}`
206
206
  if (prefixedPluginName in Base) {
@@ -219,7 +219,12 @@ const Component = (name = required('name'), config = required('config')) => {
219
219
  configurable: false,
220
220
  })
221
221
  })
222
- Base[symbols['pluginsRegistered']] = true
222
+
223
+ // register global components once
224
+ globalComponents = components()
225
+
226
+ // mark launched true
227
+ Base[symbols['launched']] = true
223
228
  }
224
229
 
225
230
  // setup the component once per component type, using Base as the prototype
@@ -234,11 +239,6 @@ const Component = (name = required('name'), config = required('config')) => {
234
239
  config.code = codegenerator.call(config, parser(config.template, name))
235
240
  }
236
241
 
237
- // register global components once
238
- if (!globalComponents) {
239
- globalComponents = components()
240
- }
241
-
242
242
  // create an instance of the component, using base as the prototype (which contains Base)
243
243
  return component.call(Object.create(base), options, parentEl, parentComponent, rootComponent)
244
244
  }
@@ -11,10 +11,10 @@ export default {
11
11
  init: Symbol('init'),
12
12
  inputEvents: Symbol('inputEvents'),
13
13
  intervals: Symbol('intervals'),
14
+ launched: Symbol('launched'),
14
15
  level: Symbol('level'),
15
16
  methodKeys: Symbol('methodKeys'),
16
17
  originalState: Symbol('originalState'),
17
- pluginsRegistered: Symbol('pluginsRegistered'),
18
18
  propKeys: Symbol('propKeys'),
19
19
  raw: Symbol('raw'),
20
20
  ready: Symbol('ready'),
package/src/plugin.js CHANGED
@@ -1,4 +1,9 @@
1
- export const plugins = {}
1
+ import log from './plugins/log'
2
+
3
+ export const plugins = {
4
+ // log plugin added by default
5
+ log,
6
+ }
2
7
 
3
8
  const registerPlugin = (plugin, nameOrOptions = '', options = {}) => {
4
9
  // map name and options depending on the arguments provided
@@ -15,13 +15,11 @@
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */
17
17
 
18
- import log from '../../lib/log.js'
18
+ import { default as log } from '../lib/log'
19
19
 
20
20
  export default {
21
- $log: {
22
- value: log('App'),
23
- writable: false,
24
- enumerable: true,
25
- configurable: false,
21
+ name: 'log',
22
+ plugin() {
23
+ return log('App')
26
24
  },
27
25
  }