@lightningjs/blits 2.0.0-beta.9 → 2.0.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 +26 -0
- package/index.d.ts +60 -30
- package/package.json +5 -6
- package/scripts/lint.js +17 -0
- package/scripts/prepublishOnly.js +2 -2
- package/scripts/prepush.js +4 -6
- package/src/application.js +1 -1
- package/src/components/Circle.js +0 -2
- package/src/components/FPScounter.js +0 -2
- package/src/components/RouterView.js +1 -3
- package/src/components/Sprite.js +0 -2
- package/src/constants.js +17 -8
- package/src/engine.js +17 -0
- package/src/engines/L3/element.js +4 -7
- package/src/engines/L3/fontLoader.js +18 -1
- package/src/engines/L3/index.js +17 -0
- package/src/engines/L3/shaderLoader.js +17 -0
- package/src/engines/index.js +17 -0
- package/src/helpers/fetchJson.js +4 -6
- package/src/lib/lifecycle.js +2 -2
- package/src/lib/reactivityguard/computedprops.js +46 -15
- package/src/lib/symbols.js +17 -0
- package/src/lib/utils.js +17 -0
- package/src/plugin.js +17 -0
- package/src/plugins/storage/localCookie.js +4 -6
- package/vite/inject-dev-config.js +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.0.1
|
|
4
|
+
|
|
5
|
+
_23 mar 2026_
|
|
6
|
+
|
|
7
|
+
- Fixed issue with height dimension of router view
|
|
8
|
+
- Fixed issue with array or rounded corners not being reactive
|
|
9
|
+
- Fixed issue with font not being mapped correctly when using `png` in the font config
|
|
10
|
+
- Removed obselete key config
|
|
11
|
+
- Fixed reactivity guard in computed props to handle deep nested references more safely
|
|
12
|
+
|
|
13
|
+
## v2.0.0
|
|
14
|
+
|
|
15
|
+
_20 mar 2026_
|
|
16
|
+
|
|
17
|
+
**Blits v2 as part of the Lightning 3.1 release**
|
|
18
|
+
|
|
19
|
+
- Upgraded to Lightning renderer v3
|
|
20
|
+
- Prefixed built-in variables with `$` (i.e. `hasFocus` => `$hasFocus`)
|
|
21
|
+
- Changed array based props to object based props
|
|
22
|
+
- Removed several deprecated methods and variables (`focus`, `select`, `trigger`, `wordwrap`, `width`, `height`)
|
|
23
|
+
- Removed `effects` attribute and replaced for `border`, `rounded` and `shadow`
|
|
24
|
+
- Changed handling of props with the same name as know Element attributes
|
|
25
|
+
- Removed MSDF font generator as a blits dependency
|
|
26
|
+
- Updated key mapping to rely only on `keyCode`
|
|
27
|
+
|
|
28
|
+
|
|
3
29
|
## v1.51.0
|
|
4
30
|
|
|
5
31
|
_04 mar 2026_
|
package/index.d.ts
CHANGED
|
@@ -401,9 +401,9 @@ declare module '@lightningjs/blits' {
|
|
|
401
401
|
readonly $hasFocus: boolean,
|
|
402
402
|
|
|
403
403
|
/**
|
|
404
|
-
* Parent component instance. Undefined for the root Application component
|
|
404
|
+
* Parent component instance. Undefined for the root Application component (destroyed case not modeled).
|
|
405
405
|
*/
|
|
406
|
-
readonly $parent: ComponentBase |
|
|
406
|
+
readonly $parent: ComponentBase | undefined,
|
|
407
407
|
|
|
408
408
|
/**
|
|
409
409
|
* Indicates whether the component currently is hovered
|
|
@@ -544,6 +544,20 @@ declare module '@lightningjs/blits' {
|
|
|
544
544
|
}) => void
|
|
545
545
|
}
|
|
546
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Context type for the root Application: no parent.
|
|
549
|
+
*/
|
|
550
|
+
export interface ApplicationBase extends Omit<ComponentBase, '$parent'> {
|
|
551
|
+
readonly $parent: undefined
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Context type for Components (Blits.Component): always has a parent when mounted. Destroyed case is not modeled.
|
|
556
|
+
*/
|
|
557
|
+
export interface ChildComponentBase extends Omit<ComponentBase, '$parent'> {
|
|
558
|
+
readonly $parent: ComponentBase
|
|
559
|
+
}
|
|
560
|
+
|
|
547
561
|
/**
|
|
548
562
|
* Prop object
|
|
549
563
|
*/
|
|
@@ -587,7 +601,14 @@ declare module '@lightningjs/blits' {
|
|
|
587
601
|
S,
|
|
588
602
|
M,
|
|
589
603
|
C
|
|
590
|
-
> = ThisType<Readonly<InferProps<P>> & S & M & Readonly<C> &
|
|
604
|
+
> = ThisType<Readonly<InferProps<P>> & S & M & Readonly<C> & ChildComponentBase>
|
|
605
|
+
|
|
606
|
+
export type ApplicationContext<
|
|
607
|
+
P extends Record<string, any>,
|
|
608
|
+
S,
|
|
609
|
+
M,
|
|
610
|
+
C
|
|
611
|
+
> = ThisType<Readonly<InferProps<P>> & S & M & Readonly<C> & ApplicationBase>
|
|
591
612
|
|
|
592
613
|
export interface ComponentConfig<P extends Props = {}, S, M, C, W> {
|
|
593
614
|
components?: {
|
|
@@ -645,7 +666,7 @@ declare module '@lightningjs/blits' {
|
|
|
645
666
|
* }
|
|
646
667
|
* ```
|
|
647
668
|
*/
|
|
648
|
-
state?: (this: InferProps<P
|
|
669
|
+
state?: (this: Readonly<InferProps<P>> & ChildComponentBase) => S;
|
|
649
670
|
/**
|
|
650
671
|
* Methods for abstracting more complex business logic into separate function
|
|
651
672
|
*/
|
|
@@ -716,32 +737,41 @@ declare module '@lightningjs/blits' {
|
|
|
716
737
|
backNavigation?: boolean
|
|
717
738
|
}
|
|
718
739
|
|
|
719
|
-
export type ApplicationConfig<P extends Props, S, M, C, W> =
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
740
|
+
export type ApplicationConfig<P extends Props, S, M, C, W> = Omit<
|
|
741
|
+
ComponentConfig<P, S, M, C, W>,
|
|
742
|
+
'hooks' | 'methods' | 'input' | 'computed' | 'watch' | 'state'
|
|
743
|
+
> & {
|
|
744
|
+
hooks?: Hooks & ApplicationContext<P, S, M, C>
|
|
745
|
+
methods?: M & ApplicationContext<P, S, M, C>
|
|
746
|
+
input?: Input & ApplicationContext<P, S, M, C>
|
|
747
|
+
computed?: C & ApplicationContext<P, S, M, C>
|
|
748
|
+
watch?: W & ApplicationContext<P, S, M, C>
|
|
749
|
+
state?: (this: Readonly<InferProps<P>> & ApplicationBase) => S
|
|
750
|
+
} & (
|
|
751
|
+
| {
|
|
752
|
+
/**
|
|
753
|
+
* Router Configuration
|
|
754
|
+
*/
|
|
755
|
+
router?: RouterConfig<P, S, M, C>
|
|
756
|
+
routes?: never
|
|
757
|
+
}
|
|
758
|
+
| {
|
|
759
|
+
router?: never
|
|
760
|
+
/**
|
|
761
|
+
* Routes definition
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
*
|
|
765
|
+
* ```js
|
|
766
|
+
* routes: [
|
|
767
|
+
* { path: '/', component: Home },
|
|
768
|
+
* { path: '/details', component: Details },
|
|
769
|
+
* { path: '/account', component: Account },
|
|
770
|
+
* ]
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
routes?: Route[]
|
|
774
|
+
}
|
|
745
775
|
)
|
|
746
776
|
|
|
747
777
|
export interface Transition {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightningjs/blits",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Blits: The Lightning 3 App Development Framework",
|
|
5
5
|
"bin": "bin/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -33,10 +33,9 @@
|
|
|
33
33
|
"./components": "./src/components/FPScounter.js"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"test": "c8
|
|
37
|
-
"test:
|
|
38
|
-
"test:run": "node -r global-jsdom/register
|
|
39
|
-
"test:run:failures": "node -r global-jsdom/register ./node_modules/.bin/tape '{,!(node_modules|packages)/**/}*.test.js' | tap-filter test-fail | tap-diff",
|
|
36
|
+
"test": "c8 npm run test:run | tap-diff",
|
|
37
|
+
"test:run": "node -r global-jsdom/register node_modules/tape/bin/tape \"scripts/**/*.test.js\" \"src/**/*.test.js\"",
|
|
38
|
+
"test:run:failures": "node -r global-jsdom/register node_modules/tape/bin/tape \"scripts/**/*.test.js\" \"src/**/*.test.js\" | tap-filter test-fail | tap-diff",
|
|
40
39
|
"lint": "node scripts/lint.js",
|
|
41
40
|
"lint:fix": "node scripts/lint.js fix",
|
|
42
41
|
"prepublishOnly": "node scripts/prepublishOnly.js",
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
"tape": "^5.5.0"
|
|
77
76
|
},
|
|
78
77
|
"dependencies": {
|
|
79
|
-
"@lightningjs/renderer": "3.0.0
|
|
78
|
+
"@lightningjs/renderer": "^3.0.0",
|
|
80
79
|
"magic-string": "^0.30.21"
|
|
81
80
|
},
|
|
82
81
|
"repository": {
|
package/scripts/lint.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
1
18
|
import fg from 'fast-glob'
|
|
2
19
|
import { resolve } from 'path'
|
|
3
20
|
import { fileURLToPath } from 'url'
|
|
@@ -62,8 +62,8 @@ function processFile(filePath) {
|
|
|
62
62
|
const newSource = typeof result === 'object' && result.code ? result.code : result
|
|
63
63
|
fs.writeFileSync(filePath, newSource)
|
|
64
64
|
|
|
65
|
-
// only format the file if it was changed
|
|
66
|
-
if (source !== newSource) {
|
|
65
|
+
// only format the file if it was changed (compiler returns undefined for non-Blits files)
|
|
66
|
+
if (newSource !== undefined && source !== newSource) {
|
|
67
67
|
formatFileWithESLint(filePath)
|
|
68
68
|
}
|
|
69
69
|
}
|
package/scripts/prepush.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2023 Comcast
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2
|
+
* Copyright 2025 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
4
|
* you may not use this file except in compliance with the License.
|
|
9
5
|
* You may obtain a copy of the License at
|
|
10
6
|
*
|
|
@@ -15,6 +11,8 @@
|
|
|
15
11
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
12
|
* See the License for the specific language governing permissions and
|
|
17
13
|
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import { execSync } from 'child_process'
|
package/src/application.js
CHANGED
|
@@ -78,7 +78,7 @@ const Application = (config) => {
|
|
|
78
78
|
keyDownHandler = async (e) => {
|
|
79
79
|
const currentTime = performance.now()
|
|
80
80
|
|
|
81
|
-
const key = keyMap[e.
|
|
81
|
+
const key = keyMap[e.keyCode] || e.keyCode
|
|
82
82
|
const sameKey = lastInputKey === key
|
|
83
83
|
lastInputKey = key
|
|
84
84
|
// execute immediately when no throttle is specified or event is internal (bubbled up by focus manager)
|
package/src/components/Circle.js
CHANGED
|
@@ -36,9 +36,7 @@ export default () =>
|
|
|
36
36
|
'parent',
|
|
37
37
|
'rotation',
|
|
38
38
|
'w',
|
|
39
|
-
'width',
|
|
40
39
|
'h',
|
|
41
|
-
'height',
|
|
42
40
|
'x',
|
|
43
41
|
'y',
|
|
44
42
|
'z',
|
|
@@ -96,7 +94,7 @@ export default () =>
|
|
|
96
94
|
)
|
|
97
95
|
|
|
98
96
|
elementConfigs[0]['w'] = parent.node.w * (100 / 100)
|
|
99
|
-
elementConfigs[0]['
|
|
97
|
+
elementConfigs[0]['h'] = parent.node.h * (100 / 100)
|
|
100
98
|
elms[0].populate(elementConfigs[0])
|
|
101
99
|
|
|
102
100
|
if (inSlot === true) {
|
package/src/components/Sprite.js
CHANGED
package/src/constants.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
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
|
+
|
|
1
18
|
export const DEFAULT_HOLD_TIMEOUT_MS = 50
|
|
2
19
|
|
|
3
20
|
export const DEFAULT_KEYMAP = {
|
|
4
|
-
ArrowLeft: 'left',
|
|
5
|
-
ArrowRight: 'right',
|
|
6
|
-
ArrowUp: 'up',
|
|
7
|
-
ArrowDown: 'down',
|
|
8
|
-
Enter: 'enter',
|
|
9
|
-
' ': 'space',
|
|
10
|
-
Backspace: 'back',
|
|
11
|
-
Escape: 'escape',
|
|
12
21
|
37: 'left',
|
|
13
22
|
39: 'right',
|
|
14
23
|
38: 'up',
|
package/src/engine.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
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
|
+
|
|
1
18
|
export { L3 as default } from './engines/index.js'
|
|
@@ -222,9 +222,6 @@ const propsTransformer = {
|
|
|
222
222
|
this.element.component[symbols.holder].set('w', parsed)
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
|
-
set width(v) {
|
|
226
|
-
this.w = v
|
|
227
|
-
},
|
|
228
225
|
set h(v) {
|
|
229
226
|
const parsed = parsePercentage.call(this, v, 'h')
|
|
230
227
|
this.props['h'] = parsed
|
|
@@ -236,9 +233,6 @@ const propsTransformer = {
|
|
|
236
233
|
this.element.component[symbols.holder].set('h', parsed)
|
|
237
234
|
}
|
|
238
235
|
},
|
|
239
|
-
set height(v) {
|
|
240
|
-
this.h = v
|
|
241
|
-
},
|
|
242
236
|
set x(v) {
|
|
243
237
|
this.props['x'] = parsePercentage.call(this, v, 'w')
|
|
244
238
|
},
|
|
@@ -368,7 +362,10 @@ const propsTransformer = {
|
|
|
368
362
|
set rounded(v) {
|
|
369
363
|
this.props['rounded'] = v
|
|
370
364
|
if (this.element.node !== undefined && this.elementShader === true) {
|
|
371
|
-
if (
|
|
365
|
+
if (
|
|
366
|
+
Array.isArray(v) === false &&
|
|
367
|
+
(typeof v === 'object' || (isObjectString(v) === true && (v = parseToObject(v))))
|
|
368
|
+
) {
|
|
372
369
|
this.element.node.props['shader'].props = v
|
|
373
370
|
} else {
|
|
374
371
|
if (isArrayString(v) === true) {
|
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
import Settings from '../../settings.js'
|
|
2
19
|
import { renderer } from './launch.js'
|
|
3
20
|
|
|
@@ -19,7 +36,7 @@ export default () => {
|
|
|
19
36
|
if (type === 'sdf') {
|
|
20
37
|
stage.loadFont('sdf', {
|
|
21
38
|
fontFamily: font.family,
|
|
22
|
-
atlasUrl: font.
|
|
39
|
+
atlasUrl: font.png || (font.file && font.file.replace(/\.[^.]+$/, `.${font.type}.png`)),
|
|
23
40
|
atlasDataUrl:
|
|
24
41
|
font.json || (font.file && font.file.replace(/\.[^.]+$/, `.${font.type}.json`)),
|
|
25
42
|
})
|
package/src/engines/L3/index.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
import Element from './element.js'
|
|
2
19
|
import Launch from './launch.js'
|
|
3
20
|
|
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
import Settings from '../../settings.js'
|
|
2
19
|
import { renderer } from './launch.js'
|
|
3
20
|
import * as webglShaders from '@lightningjs/renderer/webgl/shaders'
|
package/src/engines/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
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
|
+
|
|
1
18
|
export { default as L3 } from './L3/index.js'
|
package/src/helpers/fetchJson.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2020 Metrological
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2
|
+
* Copyright 2024 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
4
|
* you may not use this file except in compliance with the License.
|
|
9
5
|
* You may obtain a copy of the License at
|
|
10
6
|
*
|
|
@@ -15,6 +11,8 @@
|
|
|
15
11
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
12
|
* See the License for the specific language governing permissions and
|
|
17
13
|
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
export default (file) => {
|
package/src/lib/lifecycle.js
CHANGED
|
@@ -31,8 +31,8 @@ const states = [
|
|
|
31
31
|
'ready', // fired when component instantiated, reactivity setup done and template spawned
|
|
32
32
|
'focus', // fired when receiving focus (can occur multiple times)
|
|
33
33
|
'unfocus', // fired when losing focus (can occur multiple times)
|
|
34
|
-
'hover', // fired when
|
|
35
|
-
'unhover', // fired when
|
|
34
|
+
'hover', // fired when pointer enters the component (mouse support only; can occur multiple times)
|
|
35
|
+
'unhover', // fired when pointer leaves the component (mouse support only; can occur multiple times)
|
|
36
36
|
'destroy', // fired when component is destroyed and removed
|
|
37
37
|
'attach', // fired when entering the viewport margin and attached to the render tree
|
|
38
38
|
'detach', // fired when leaving the viewport margin and detached from the render tree
|
|
@@ -196,14 +196,19 @@ export default (code) => {
|
|
|
196
196
|
// Skip if already modified
|
|
197
197
|
if (
|
|
198
198
|
prop.body.includes(commentText.trim()) ||
|
|
199
|
-
Array.from(thisRefs).some((ref) =>
|
|
199
|
+
Array.from(thisRefs).some((ref) => {
|
|
200
|
+
if (prop.body.startsWith(ref)) return true
|
|
201
|
+
// stripped && guard: body starts with the first segment, e.g. 'this.media &&'
|
|
202
|
+
const firstSegEnd = ref.indexOf('.', 5)
|
|
203
|
+
return firstSegEnd !== -1 && prop.body.startsWith(ref.substring(0, firstSegEnd))
|
|
204
|
+
})
|
|
200
205
|
) {
|
|
201
206
|
continue
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
// reactivity code
|
|
205
210
|
const refCode = Array.from(thisRefs)
|
|
206
|
-
.map((ref) => `${ref};`)
|
|
211
|
+
.map((ref) => `${toSafeRef(ref)};`)
|
|
207
212
|
.join(' ')
|
|
208
213
|
|
|
209
214
|
// replacement with the same whitespace
|
|
@@ -290,27 +295,53 @@ export default (code) => {
|
|
|
290
295
|
return null
|
|
291
296
|
}
|
|
292
297
|
|
|
298
|
+
const toSafeRef = (ref) => {
|
|
299
|
+
// Converts 'this.a.b.c' to 'this.a && this.a.b && this.a.b.c'
|
|
300
|
+
const normalized = ref.replace(/\?\./g, '.')
|
|
301
|
+
const segments = normalized.split('.')
|
|
302
|
+
if (segments.length <= 2) return normalized
|
|
303
|
+
const parts = []
|
|
304
|
+
for (let i = 2; i <= segments.length; i++) {
|
|
305
|
+
parts.push(segments.slice(0, i).join('.'))
|
|
306
|
+
}
|
|
307
|
+
return parts.join(' && ')
|
|
308
|
+
}
|
|
309
|
+
|
|
293
310
|
const extractThisReferences = (funcBody) => {
|
|
294
311
|
const thisRefs = new Set()
|
|
295
312
|
|
|
296
|
-
//
|
|
297
|
-
const refRegex = /this
|
|
313
|
+
// Match full property chains, including optional chaining
|
|
314
|
+
const refRegex = /this(?:\.[$\w]+|\?\.[$\w]+)+/g
|
|
298
315
|
let refMatch
|
|
299
316
|
|
|
300
317
|
while ((refMatch = refRegex.exec(funcBody)) !== null) {
|
|
301
318
|
const fullRef = refMatch[0]
|
|
302
319
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
320
|
+
const segmentRegex = /(\??\.)([$\w]+)/g
|
|
321
|
+
let segMatch
|
|
322
|
+
let lastValidRef = 'this'
|
|
323
|
+
|
|
324
|
+
while ((segMatch = segmentRegex.exec(fullRef.substring(4))) !== null) {
|
|
325
|
+
const candidate = 'this' + fullRef.substring(4, 4 + segMatch.index + segMatch[0].length)
|
|
326
|
+
const afterCandidate = funcBody.substring(refMatch.index + candidate.length)
|
|
327
|
+
if (afterCandidate.match(/^\s*\(/)) {
|
|
328
|
+
break
|
|
329
|
+
}
|
|
330
|
+
lastValidRef = candidate
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (lastValidRef !== 'this') {
|
|
334
|
+
thisRefs.add(lastValidRef)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Remove shorter prefixes when a longer chain already covers them
|
|
339
|
+
for (const ref of [...thisRefs]) {
|
|
340
|
+
for (const other of thisRefs) {
|
|
341
|
+
if (other !== ref && other.startsWith(ref + '.')) {
|
|
342
|
+
thisRefs.delete(ref)
|
|
343
|
+
break
|
|
344
|
+
}
|
|
314
345
|
}
|
|
315
346
|
}
|
|
316
347
|
|
package/src/lib/symbols.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
/**
|
|
2
19
|
* Symbol registry for internal framework properties and generated code.
|
|
3
20
|
*
|
package/src/lib/utils.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
/**
|
|
2
19
|
* A mapping of common screen resolution names to their scale factors relative to 1080p (Full HD).
|
|
3
20
|
*
|
package/src/plugin.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
import log from './plugins/log.js'
|
|
2
19
|
|
|
3
20
|
export const plugins = {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2019 Metrological
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the License);
|
|
2
|
+
* Copyright 2025 Comcast Cable Communications Management, LLC
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
4
|
* you may not use this file except in compliance with the License.
|
|
9
5
|
* You may obtain a copy of the License at
|
|
10
6
|
*
|
|
@@ -15,6 +11,8 @@
|
|
|
15
11
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
12
|
* See the License for the specific language governing permissions and
|
|
17
13
|
* limitations under the License.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
// LocalStorage and Cookie storage library
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
1
18
|
export default function injectDevFlag() {
|
|
2
19
|
return {
|
|
3
20
|
name: 'inject-dev-config',
|