@lightningjs/blits 0.9.9 → 1.0.0

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 (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/boilerplate/common/public/fonts/Lato-Regular.ttf +0 -0
  3. package/boilerplate/common/public/fonts/Raleway-ExtraBold.ttf +0 -0
  4. package/docs/essentials/displaying_text.md +1 -1
  5. package/package.json +3 -4
  6. package/src/component/base/events.js +1 -1
  7. package/src/component/base/utils.js +34 -1
  8. package/src/component/setup/props.js +3 -1
  9. package/src/component/setup/props.test.js +51 -19
  10. package/src/component.d.ts +2 -1
  11. package/src/component.js +20 -13
  12. package/src/components/Circle.js +13 -12
  13. package/src/components/FPScounter.js +413 -465
  14. package/src/components/Image.js +7 -9
  15. package/src/components/Layout.js +49 -0
  16. package/src/components/Layout.orig.js +34 -0
  17. package/src/components/RouterView.js +6 -10
  18. package/src/components/Sprite.js +10 -12
  19. package/src/components/index.js +2 -2
  20. package/src/components/index.orig.js +2 -2
  21. package/src/engine.js +1 -1
  22. package/src/engines/L3/element.js +193 -180
  23. package/src/engines/L3/element.test.js +170 -0
  24. package/src/engines/L3/fontLoader.js +20 -7
  25. package/src/engines/L3/index.js +2 -2
  26. package/src/engines/L3/launch.js +7 -13
  27. package/src/engines/L3/shaderLoader.js +12 -0
  28. package/src/engines/index.js +1 -1
  29. package/src/launch.d.ts +19 -2
  30. package/src/lib/codegenerator/generator.js +214 -77
  31. package/src/lib/codegenerator/generator.test.js +657 -942
  32. package/src/lib/colors/colors.js +59 -46
  33. package/src/lib/precompiler/precompiler.js +2 -1
  34. package/src/lib/reactivity/effect.js +10 -13
  35. package/src/lib/reactivity/reactive.js +24 -14
  36. package/src/lib/symbols.js +1 -0
  37. package/src/router/router.js +17 -3
  38. package/vite/msdfGenerator.js +52 -53
  39. package/boilerplate/common/public/fonts/Lato-Regular.msdf.json +0 -5383
  40. package/boilerplate/common/public/fonts/Lato-Regular.msdf.png +0 -0
  41. package/boilerplate/common/public/fonts/Raleway-ExtraBold.msdf.json +0 -10838
  42. package/boilerplate/common/public/fonts/Raleway-ExtraBold.msdf.png +0 -0
  43. package/boilerplate/js/default/src/renderer.js +0 -4
  44. package/src/components/Text.js +0 -119
  45. package/src/components/Text.orig.js +0 -81
@@ -1,4 +0,0 @@
1
- // @ts-ignore
2
- import renderer from '@lightningjs/blits/renderer'
3
-
4
- renderer()
@@ -1,119 +0,0 @@
1
- /*
2
- * Copyright 2023 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 Component from '../component.js'
19
- import Settings from '../settings.js'
20
-
21
- export default () =>
22
- Component('Text', {
23
- /* eslint-disable no-unused-vars */
24
- code: {
25
- render: function anonymous(parent, component, context, components) {
26
- const elms = []
27
-
28
- if (!elms[0]) {
29
- elms[0] = this.element({ parent: parent || 'root' }, component)
30
- }
31
- const elementConfig0 = {}
32
-
33
- elementConfig0['__textnode'] = true
34
- elementConfig0['fontFamily'] = component.font
35
- elementConfig0['letterSpacing'] = component.letterspacing
36
- elementConfig0['lineHeight'] = component._lineheight
37
- elementConfig0['stretch'] = component.stretch
38
- elementConfig0['contain'] = component._contain
39
- elementConfig0['@loaded'] = component['@loaded'] && component['@loaded'].bind(component)
40
- elementConfig0['@error'] = component['@error'] && component['@error'].bind(component)
41
-
42
- if (!elms[0].nodeId) {
43
- elms[0].populate(elementConfig0)
44
- }
45
-
46
- return elms
47
- },
48
- effects: [
49
- function anonymous(component, elms, context, components) {
50
- elms[0].set('text', component.content)
51
- },
52
- function anonymous(component, elms, context, components) {
53
- elms[0].set('fontSize', component.size)
54
- },
55
- function anonymous(component, elms, context, components) {
56
- elms[0].set('color', component.color)
57
- },
58
- function anonymous(component, elms, context, components) {
59
- elms[0].set('style', component.style)
60
- },
61
- function anonymous(component, elms, context, components) {
62
- elms[0].set('weight', component.weight)
63
- },
64
- function anonymous(component, elms, context, components) {
65
- elms[0].set('wordWrap', component.wordwrap)
66
- },
67
- function anonymous(component, elms, context, components) {
68
- elms[0].set('maxLines', component.maxlines)
69
- },
70
- function anonymous(component, elms, context, components) {
71
- elms[0].set('h', component.maxheight)
72
- },
73
- function anonymous(component, elms, context, components) {
74
- elms[0].set('textAlign', component.align)
75
- },
76
- function anonymous(component, elms, context, components) {
77
- elms[0].set('overflowSuffix', component.textoverflow)
78
- },
79
- ],
80
- context: {},
81
- },
82
- props: [
83
- 'content',
84
- {
85
- key: 'font',
86
- default: Settings.get('defaultFont', 'lato'),
87
- },
88
- {
89
- key: 'size',
90
- cast: Number,
91
- default: 32,
92
- },
93
- 'style',
94
- 'color',
95
- 'weight',
96
- 'letterspacing',
97
- 'stretch',
98
- 'align',
99
- 'wordwrap',
100
- 'maxlines',
101
- 'maxheight',
102
- 'lineheight',
103
- 'contain',
104
- '@loaded',
105
- '@error',
106
- 'textoverflow',
107
- ],
108
- computed: {
109
- _contain() {
110
- return (
111
- this.contain ||
112
- (this.maxheight && this.wordwrap ? 'both' : this.wordwrap ? 'width' : 'none')
113
- )
114
- },
115
- _lineheight() {
116
- return this.lineheight !== undefined ? this.lineheight : this.size
117
- },
118
- },
119
- })
@@ -1,81 +0,0 @@
1
- /*
2
- * Copyright 2023 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 Component from '../component.js'
19
- import Settings from '../settings.js'
20
-
21
- export default () =>
22
- Component('Text', {
23
- template: `
24
- <Element
25
- __textnode="true"
26
- :text="$content"
27
- fontFamily="$font"
28
- :fontSize="$size"
29
- :color="$color"
30
- :style="$style"
31
- :weight="$weight"
32
- letterSpacing="$letterspacing"
33
- lineHeight="$_lineheight"
34
- stretch="$stretch"
35
- contain="$_contain"
36
- :wordWrap="$wordwrap"
37
- :maxLines="$maxlines"
38
- :h="$maxheight"
39
- :textAlign="$align"
40
- :overflowSuffix="$textoverflow"
41
- @loaded="$@loaded"
42
- @error="$@error"
43
- />`,
44
- props: [
45
- 'content',
46
- {
47
- key: 'font',
48
- default: Settings.get('defaultFont', 'lato'),
49
- },
50
- {
51
- key: 'size',
52
- cast: Number,
53
- default: 32,
54
- },
55
- 'style',
56
- 'color',
57
- 'weight',
58
- 'letterspacing',
59
- 'stretch',
60
- 'align',
61
- 'wordwrap',
62
- 'maxlines',
63
- 'maxheight',
64
- 'lineheight',
65
- 'contain',
66
- '@loaded',
67
- '@error',
68
- 'textoverflow',
69
- ],
70
- computed: {
71
- _contain() {
72
- return (
73
- this.contain ||
74
- (this.maxheight && this.wordwrap ? 'both' : this.wordwrap ? 'width' : 'none')
75
- )
76
- },
77
- _lineheight() {
78
- return this.lineheight !== undefined ? this.lineheight : this.size
79
- },
80
- },
81
- })