@lightningjs/blits 0.9.8 → 0.9.9

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/docs/transitions_animations/transitions.md +3 -3
  3. package/package.json +2 -2
  4. package/src/application.d.ts +10 -10
  5. package/src/component/base/announcer.js +27 -0
  6. package/src/component/base/events.js +37 -0
  7. package/src/component/base/index.js +29 -0
  8. package/src/component/base/log.js +27 -0
  9. package/src/component/base/methods.js +136 -0
  10. package/src/component/base/router.js +40 -0
  11. package/src/component/base/timeouts_intervals.js +92 -0
  12. package/src/component/base/utils.js +29 -0
  13. package/src/{lib → component}/setup/computed.js +3 -3
  14. package/src/component/setup/index.js +61 -0
  15. package/src/{lib → component}/setup/input.js +4 -4
  16. package/src/{lib → component}/setup/methods.js +3 -3
  17. package/src/{lib → component}/setup/props.js +3 -3
  18. package/src/{lib → component}/setup/routes.js +3 -3
  19. package/src/{lib → component}/setup/state.js +13 -6
  20. package/src/{lib → component}/setup/watch.js +5 -5
  21. package/src/component.d.ts +157 -38
  22. package/src/component.js +145 -154
  23. package/src/components/Circle.js +5 -5
  24. package/src/components/FPScounter.js +57 -89
  25. package/src/components/Image.js +2 -2
  26. package/src/components/RouterView.js +1 -1
  27. package/src/components/Sprite.js +5 -5
  28. package/src/components/Sprite.orig.js +2 -2
  29. package/src/components/Text.js +11 -11
  30. package/src/components/index.js +32 -0
  31. package/src/components/index.orig.js +32 -0
  32. package/src/engines/L3/element.js +41 -35
  33. package/src/engines/L3/launch.js +1 -1
  34. package/src/lib/codegenerator/generator.js +7 -6
  35. package/src/lib/setup/base.js +0 -288
  36. /package/src/{lib → component}/setup/props.test.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.9.9
4
+
5
+ _22 may 2024_
6
+
7
+ - Added support for `rtt`-attribute (Render To Texture)
8
+ - Refactored Component for efficiency and readability
9
+ - Improved type definitions
10
+ - Fixed error when no settings object is supplied to Launch method
11
+ - Fixed issue with `parent` variable being set on the global window object
12
+ - Improved code of firing transitions
13
+ - Bumped renderer to version 0.8.4
14
+
3
15
  ## v0.9.8
4
16
 
5
17
  _25 apr 2024_
@@ -10,7 +10,7 @@ We did learn how to _reactively_ changes values and trigger rerenders based on t
10
10
  ```js
11
11
  export default Blits('Gold', {
12
12
  template: `
13
- <Element color="gold" w="100" h="100" :x="$x" :y=:"$y" />
13
+ <Element color="gold" w="100" h="100" :x="$x" :y="$y" />
14
14
  `,
15
15
  state() {
16
16
  return {
@@ -35,7 +35,7 @@ Blits offers an easy and intuitive way to apply transitions. All you need to do
35
35
  ```js
36
36
  export default Blits('Gold', {
37
37
  template: `
38
- <Element color="gold" w="100" h="100" :x.transition="$x" :y.transition=:"$y" />
38
+ <Element color="gold" w="100" h="100" :x.transition="$x" :y.transition="$y" />
39
39
  `,
40
40
  state() {
41
41
  return {
@@ -74,7 +74,7 @@ Furthermore, you can specify:
74
74
  ```xml
75
75
  <Element color="gold" w="100" h="100"
76
76
  :x.transition="{value: $x, duration: 300, easing: 'ease-in-back', delay: 400}"
77
- :y.transition=:"{value: $x, duration: 300, easing: 'cubic-bezier(1,-0.64,0.39,1.44)'}">
77
+ :y.transition="{value: $x, duration: 300, easing: 'cubic-bezier(1,-0.64,0.39,1.44)'}">
78
78
  </Element>
79
79
  ```
80
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -45,7 +45,7 @@
45
45
  "tape": "^5.5.0"
46
46
  },
47
47
  "dependencies": {
48
- "@lightningjs/renderer": "^0.8.3",
48
+ "@lightningjs/renderer": "^0.8.4",
49
49
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0",
50
50
  "execa": "^8.0.1",
51
51
  "kolorist": "^1.8.0",
@@ -16,7 +16,7 @@
16
16
  * SPDX-License-Identifier: Apache-2.0
17
17
  */
18
18
 
19
- import {default as Component, ComponentInstance} from './component'
19
+ import {default as Component} from './component'
20
20
 
21
21
  declare namespace Application {
22
22
 
@@ -84,10 +84,6 @@ declare namespace Application {
84
84
  politeness?: 'off' | 'polite' | 'assertive'
85
85
  }
86
86
 
87
- function Application(
88
- config: Application.ApplicationConfig
89
- ) : Application.ApplicationInstance
90
-
91
87
  type RequireAtLeastOne<T> = {
92
88
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>
93
89
  }[keyof T]
@@ -104,7 +100,7 @@ declare namespace Application {
104
100
  /**
105
101
  * Component to load when activating the route
106
102
  */
107
- component: typeof ComponentInstance,
103
+ component: Component,
108
104
  /**
109
105
  * Transition configuration for the route
110
106
  */
@@ -142,9 +138,9 @@ declare namespace Application {
142
138
  }
143
139
  }
144
140
 
145
- export interface ApplicationInstance extends ComponentInstance {}
141
+ export interface ApplicationInstance extends Component.ComponentInstance {}
146
142
 
147
- export interface ApplicationConfig extends Component.ComponentConfig {
143
+ export interface ApplicationConfig<Props extends string, S, M> extends Component.ComponentConfig<Props, S, M> {
148
144
  /**
149
145
  * Routes definition
150
146
  *
@@ -167,8 +163,12 @@ declare namespace Application {
167
163
  *
168
164
  * Root App component
169
165
  */
170
- declare function Application(
171
- config: Application.ApplicationConfig
166
+ declare function Application<
167
+ Props extends string,
168
+ S extends Component.State,
169
+ M extends Component.Methods
170
+ >(
171
+ config: Application.ApplicationConfig<Props, S, M>
172
172
  ) : Application.ApplicationInstance
173
173
 
174
174
  export default Application;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import Announcer from '../../announcer/announcer.js'
19
+
20
+ export default {
21
+ $announcer: {
22
+ value: Announcer,
23
+ writable: false,
24
+ enumerable: true,
25
+ configurable: false,
26
+ },
27
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import eventListeners from '../../lib/eventListeners'
19
+
20
+ export default {
21
+ $emit: {
22
+ value: function (event, params) {
23
+ eventListeners.executeListeners(event, params)
24
+ },
25
+ writable: false,
26
+ enumerable: true,
27
+ configurable: false,
28
+ },
29
+ $listen: {
30
+ value: function (event, callback) {
31
+ eventListeners.registerListener(this, event, callback)
32
+ },
33
+ writable: false,
34
+ enumerable: true,
35
+ configurable: false,
36
+ },
37
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import methods from './methods.js'
19
+ import scheduling from './timeouts_intervals.js'
20
+ import events from './events.js'
21
+ import log from './log.js'
22
+ import router from './router.js'
23
+ import announcer from './announcer.js'
24
+ import utils from './utils.js'
25
+
26
+ export default Object.defineProperties(
27
+ {},
28
+ { ...methods, ...scheduling, ...events, ...log, ...router, ...announcer, ...utils }
29
+ )
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import log from '../../lib/log.js'
19
+
20
+ export default {
21
+ $log: {
22
+ value: log('App'),
23
+ writable: false,
24
+ enumerable: false,
25
+ configurable: false,
26
+ },
27
+ }
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import symbols from '../../lib/symbols.js'
19
+ import Focus from '../../focus.js'
20
+ import eventListeners from '../../lib/eventListeners.js'
21
+ import { trigger } from '../../lib/reactivity/effect.js'
22
+ import { Log } from '../../lib/log.js'
23
+
24
+ export default {
25
+ focus: {
26
+ value: function (e) {
27
+ this[symbols.state].hasFocus = true
28
+ Focus.set(this, e)
29
+ },
30
+ writable: false,
31
+ enumerable: true,
32
+ configurable: false,
33
+ },
34
+ unfocus: {
35
+ value: function () {
36
+ this[symbols.state].hasFocus = false
37
+ this.lifecycle.state = 'unfocus'
38
+ },
39
+ writable: false,
40
+ enumerable: true,
41
+ configurable: false,
42
+ },
43
+ destroy: {
44
+ value: function () {
45
+ this.lifecycle.state = 'destroy'
46
+ this.$clearTimeouts()
47
+ this.$clearIntervals()
48
+ eventListeners.removeListeners(this)
49
+ deleteChildren(this[symbols.children])
50
+ Log.debug(`Destroyed component ${this.componentId}`)
51
+ },
52
+ writable: false,
53
+ enumerable: true,
54
+ configurable: false,
55
+ },
56
+ select: {
57
+ value: function (ref) {
58
+ let selected = null
59
+ this[symbols.children].forEach((child) => {
60
+ if (Array.isArray(child)) {
61
+ child.forEach((c) => {
62
+ if (c['ref'] === ref) selected = c
63
+ })
64
+ } else if (Object.getPrototypeOf(child) === Object.prototype) {
65
+ Object.keys(child).forEach((k) => {
66
+ if (child[k]['ref'] === ref) selected = child[k]
67
+ })
68
+ } else {
69
+ if (child['ref'] === ref) selected = child
70
+ }
71
+ })
72
+ return selected
73
+ },
74
+ writable: false,
75
+ enumerable: true,
76
+ configurable: false,
77
+ },
78
+ trigger: {
79
+ value: function (key) {
80
+ // trigger with force set to true
81
+ trigger(this[symbols.originalState], key, true)
82
+ },
83
+ writable: false,
84
+ enumerable: true,
85
+ configurable: false,
86
+ },
87
+ $trigger: {
88
+ value: function (key) {
89
+ Log.warn('this.$trigger is deprecated, use this.trigger instead')
90
+ return this.trigger(key)
91
+ },
92
+ writable: false,
93
+ enumerable: true,
94
+ configurable: false,
95
+ },
96
+ shader: {
97
+ value: function (type, args) {
98
+ const target = type
99
+ return {
100
+ type: target,
101
+ props: args,
102
+ }
103
+ // const shaders = renderer.driver.stage.shManager.getRegisteredEffects()
104
+
105
+ // if (target in shaders) {
106
+ // return {
107
+ // type: target,
108
+ // props: args,
109
+ // }
110
+ // } else {
111
+ // Log.error(`Shader ${type} not found`)
112
+ // }
113
+ },
114
+ writable: false,
115
+ enumerable: true,
116
+ configurable: false,
117
+ },
118
+ }
119
+
120
+ const deleteChildren = function (children) {
121
+ for (let i = 0; i < children.length; i++) {
122
+ if (!children[i]) return
123
+ // call destroy when method is available on child
124
+ if (children[i].destroy && typeof children[i].destroy === 'function') {
125
+ children[i].destroy()
126
+ }
127
+ // recursively call deleteChildren when it's an object of items (happens when using a forloop construct)
128
+ else if (Object.getPrototypeOf(children[i]) === Object.prototype) {
129
+ deleteChildren(Object.values(children[i]))
130
+ }
131
+
132
+ children[i] = null
133
+ }
134
+
135
+ children.length = 0
136
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import symbols from '../../lib/symbols.js'
19
+ import { to, currentRoute, navigating, back } from '../../router/router.js'
20
+
21
+ export default {
22
+ $router: {
23
+ value: {
24
+ to,
25
+ back,
26
+ get currentRoute() {
27
+ return currentRoute
28
+ },
29
+ get routes() {
30
+ return this[symbols.routes]
31
+ },
32
+ get navigating() {
33
+ return navigating
34
+ },
35
+ },
36
+ writable: false,
37
+ enumerable: true,
38
+ configurable: false,
39
+ },
40
+ }
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import symbols from '../../lib/symbols.js'
19
+
20
+ export default {
21
+ $setTimeout: {
22
+ value: function (fn, ms, ...params) {
23
+ const timeoutId = setTimeout(
24
+ () => {
25
+ this[symbols.timeouts] = this[symbols.timeouts].filter((id) => id !== timeoutId)
26
+ fn.apply(null, params)
27
+ },
28
+ ms,
29
+ params
30
+ )
31
+ this[symbols.timeouts].push(timeoutId)
32
+ return timeoutId
33
+ },
34
+ writable: false,
35
+ enumerable: true,
36
+ configurable: false,
37
+ },
38
+ $clearTimeout: {
39
+ value: function (timeoutId) {
40
+ if (this[symbols.timeouts].indexOf(timeoutId) > -1) {
41
+ this[symbols.timeouts] = this[symbols.timeouts].filter((id) => id !== timeoutId)
42
+ clearTimeout(timeoutId)
43
+ }
44
+ },
45
+ writable: false,
46
+ enumerable: true,
47
+ configurable: false,
48
+ },
49
+ $clearTimeouts: {
50
+ value: function () {
51
+ for (let i = 0; i < this[symbols.timeouts].length; i++) {
52
+ clearTimeout(this[symbols.timeouts][i])
53
+ }
54
+ this[symbols.timeouts] = []
55
+ },
56
+ writable: false,
57
+ enumerable: true,
58
+ configurable: false,
59
+ },
60
+ $setInterval: {
61
+ value: function (fn, ms, ...params) {
62
+ const intervalId = setInterval(() => fn.apply(null, params), ms, params)
63
+ this[symbols.intervals].push(intervalId)
64
+ return intervalId
65
+ },
66
+ writable: false,
67
+ enumerable: true,
68
+ configurable: false,
69
+ },
70
+ $clearInterval: {
71
+ value: function (intervalId) {
72
+ if (this[symbols.intervals].indexOf(intervalId) > -1) {
73
+ this[symbols.intervals] = this[symbols.intervals].filter((id) => id !== intervalId)
74
+ clearInterval(intervalId)
75
+ }
76
+ },
77
+ writable: false,
78
+ enumerable: true,
79
+ configurable: false,
80
+ },
81
+ $clearIntervals: {
82
+ value: function () {
83
+ for (let i = 0; i < this[symbols.intervals].length; i++) {
84
+ clearInterval(this[symbols.intervals][i])
85
+ }
86
+ this[symbols.intervals] = []
87
+ },
88
+ writable: false,
89
+ enumerable: true,
90
+ configurable: false,
91
+ },
92
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import symbols from '../../lib/symbols'
19
+
20
+ import { renderer } from '../../launch.js'
21
+
22
+ export default {
23
+ [symbols.renderer]: {
24
+ value: () => renderer,
25
+ writable: false,
26
+ enumerable: true,
27
+ configurable: false,
28
+ },
29
+ }
@@ -15,9 +15,9 @@
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */
17
17
 
18
- import { Log } from '../log.js'
18
+ import { Log } from '../../lib/log.js'
19
19
 
20
- import symbols from '../symbols.js'
20
+ import symbols from '../../lib/symbols.js'
21
21
 
22
22
  export default (component, computeds) => {
23
23
  component[symbols.computedKeys] = []
@@ -38,7 +38,7 @@ export default (component, computeds) => {
38
38
  Log.warn(`${computed} is not a function`)
39
39
  }
40
40
  component[symbols.computedKeys].push(computed)
41
- Object.defineProperty(component.prototype, computed, {
41
+ Object.defineProperty(component, computed, {
42
42
  get() {
43
43
  return computeds[computed].apply(this)
44
44
  },
@@ -0,0 +1,61 @@
1
+ /*
2
+ * Copyright 2024 Comcast Cable Communications Management, LLC
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ *
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+
18
+ import setupProps from './props.js'
19
+ import setupMethods from './methods.js'
20
+ import setupState from './state.js'
21
+ import setupComputed from './computed.js'
22
+ import setupInput from './input.js'
23
+ import setupRoutes from './routes.js'
24
+ import setupWatch from './watch.js'
25
+
26
+ import { registerHooks } from '../../lib/hooks.js'
27
+
28
+ import symbols from '../../lib/symbols.js'
29
+
30
+ let counter = 0
31
+
32
+ export default function (component, config) {
33
+ component[symbols.identifier] = ++counter
34
+
35
+ // setup hooks
36
+ registerHooks(config.hooks, component[symbols.identifier])
37
+
38
+ // setup props
39
+ // if (config.props) // because of the default props like id - might change this
40
+ setupProps(component, config.props)
41
+
42
+ // // setup methods
43
+ if (config.methods) setupMethods(component, config.methods)
44
+
45
+ // // setup state
46
+ setupState(component, config.state)
47
+
48
+ // // setup computed
49
+ if (config.computed) setupComputed(component, config.computed)
50
+
51
+ // // setup watchers
52
+ if (config.watch) setupWatch(component, config.watch)
53
+
54
+ // // setup routes
55
+ if (config.routes) setupRoutes(component, config.routes)
56
+
57
+ // // setup input
58
+ if (config.input) setupInput(component, config.input)
59
+
60
+ return component
61
+ }
@@ -15,16 +15,16 @@
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */
17
17
 
18
- import { Log } from '../log.js'
18
+ import { Log } from '../../lib/log.js'
19
19
 
20
- import symbols from '../symbols.js'
20
+ import symbols from '../../lib/symbols.js'
21
21
 
22
22
  export default (component, input) => {
23
- component.prototype[symbols.inputEvents] = []
23
+ component[symbols.inputEvents] = []
24
24
  Object.keys(input).forEach((key) => {
25
25
  if (typeof input[key] !== 'function') {
26
26
  Log.warn(`${input[key]} is not a function`)
27
27
  }
28
- component.prototype[symbols.inputEvents][key] = input[key]
28
+ component[symbols.inputEvents][key] = input[key]
29
29
  })
30
30
  }
@@ -15,9 +15,9 @@
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */
17
17
 
18
- import { Log } from '../log.js'
18
+ import { Log } from '../../lib/log.js'
19
19
 
20
- import symbols from '../symbols.js'
20
+ import symbols from '../../lib/symbols.js'
21
21
 
22
22
  export default (component, methods) => {
23
23
  component[symbols.methodKeys] = []
@@ -31,7 +31,7 @@ export default (component, methods) => {
31
31
  Log.warn(`${method} is not a function`)
32
32
  }
33
33
  component[symbols.methodKeys].push(method)
34
- component.prototype[method] = methods[method]
34
+ component[method] = methods[method]
35
35
  }
36
36
  }
37
37
  }