@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 +7 -0
- package/package.json +1 -1
- package/src/component/base/index.js +2 -3
- package/src/component.js +8 -8
- package/src/lib/symbols.js +1 -1
- package/src/plugin.js +6 -1
- package/src/{component/base → plugins}/log.js +4 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -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['
|
|
28
|
+
[symbols['launched']]: false,
|
|
30
29
|
},
|
|
31
|
-
{ ...methods, ...scheduling, ...events, ...
|
|
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
|
-
|
|
203
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/lib/symbols.js
CHANGED
|
@@ -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
|
-
|
|
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 '
|
|
18
|
+
import { default as log } from '../lib/log'
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: false,
|
|
21
|
+
name: 'log',
|
|
22
|
+
plugin() {
|
|
23
|
+
return log('App')
|
|
26
24
|
},
|
|
27
25
|
}
|