@lightningjs/blits 1.10.1 → 1.11.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.
@@ -0,0 +1,27 @@
1
+ name: Trigger Website Docs Update
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ paths:
7
+ - 'docs/**'
8
+
9
+ jobs:
10
+ trigger:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Trigger Deployment
14
+ timeout-minutes: 5
15
+ run: |
16
+ response=$(curl -X POST -w "%{http_code}" -s -o /dev/null \
17
+ --max-time 30 \
18
+ --connect-timeout 10 \
19
+ --retry 2 \
20
+ --retry-delay 5 \
21
+ ${{ secrets.WEBSITE_DEPLOY_URL }})
22
+ if [ "$response" -eq 200 ]; then
23
+ echo "Deployment triggered successfully"
24
+ else
25
+ echo "Failed to trigger deployment. Status code: $response"
26
+ exit 1
27
+ fi
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.11.0
4
+
5
+ _19 nov 2024_
6
+
7
+ - Added support for splitting up translation file per language
8
+ - Added hasFocus property to ComponentBase type
9
+ - Fixed issue with alpha during router transitions
10
+
11
+
3
12
  ## v1.10.1
4
13
 
5
14
  _15 nov 2024_
@@ -7,6 +16,7 @@ _15 nov 2024_
7
16
  - Upgraded to renderer 2.7.1
8
17
  - Added documentation on Router
9
18
 
19
+
10
20
  ## v1.10.0
11
21
 
12
22
  _8 nov 2024_
package/docs/_sidebar.md CHANGED
@@ -27,6 +27,7 @@
27
27
  - Router
28
28
  - [Basics](/router/basics.md)
29
29
  - [Hooks](/router/hooks.md)
30
+ - [Transitions](/router/transitions.md)
30
31
  - Plugins
31
32
  - [Text-to-Speech / Announcer](/plugins/text-to-speech-announcer.md)
32
33
  - [Language](/plugins/language.md)
package/docs/sidebar.json CHANGED
@@ -118,6 +118,10 @@
118
118
  {
119
119
  "text": "Hooks",
120
120
  "link": "/router/hooks"
121
+ },
122
+ {
123
+ "text": "Transitions",
124
+ "link": "/router/transitions"
121
125
  }
122
126
  ]
123
127
  },
package/index.d.ts CHANGED
@@ -149,6 +149,11 @@ declare module '@lightningjs/blits' {
149
149
  }
150
150
 
151
151
  export type ComponentBase = {
152
+ /**
153
+ * Check if a component has focus
154
+ */
155
+ hasFocus: boolean,
156
+
152
157
  /**
153
158
  * Listen to events emitted by other components
154
159
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.10.1",
3
+ "version": "1.11.0",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -37,22 +37,45 @@ export default {
37
37
  )
38
38
 
39
39
  const setLanguage = (language) => {
40
- // define the dictionary
41
- dictionary = translations[language] || {}
42
- // set the current language in the reactive state
43
- state.language = language
44
-
45
- // warnings
46
- if (Object.keys(translations).length === 0) {
47
- Log.warn(
48
- 'No translations loaded. Please load a file with translations or specify a translations object manually'
49
- )
50
- }
51
- if (language in translations === false) {
52
- Log.warn(`Language ${language} not available in the loaded translations`)
40
+ const warningMsg =
41
+ Object.keys(translations).length === 0
42
+ ? 'No translations loaded. Please load a file with translations or specify a translations object manually'
43
+ : language in translations === false
44
+ ? `Language ${language} not available in the loaded translations`
45
+ : false
46
+ if (warningMsg) {
47
+ Log.warn(warningMsg)
48
+ // set the current language in the reactive state
49
+ state.language = language
50
+ } else {
51
+ setDict(language).then(() => {
52
+ state.language = language
53
+ })
53
54
  }
54
55
  }
55
56
 
57
+ const setDict = (language) => {
58
+ return new Promise((resolve) => {
59
+ const translationObj = translations[language]
60
+ if (typeof translationObj === 'object') {
61
+ dictionary = translationObj
62
+ resolve()
63
+ } else if (typeof translationObj === 'string') {
64
+ fetchJson(translationObj)
65
+ .then((result) => {
66
+ // save the translations for this language (to prevent loading twice)
67
+ translations[language] = result
68
+ // define the dictionary
69
+ dictionary = result
70
+ resolve()
71
+ })
72
+ .catch((e) => {
73
+ Log.error(e)
74
+ })
75
+ }
76
+ })
77
+ }
78
+
56
79
  const loadLanguageFile = (filePath) => {
57
80
  return fetchJson(filePath)
58
81
  .then((result) => {
@@ -65,8 +88,9 @@ export default {
65
88
 
66
89
  const setTranslations = (translationsObject) => {
67
90
  translations = translationsObject
68
- dictionary = translations[state.language] || {}
69
- state.loaded++
91
+ setDict(state.language).then(() => {
92
+ state.loaded++
93
+ })
70
94
  }
71
95
 
72
96
  if ('file' in options) {
@@ -168,6 +168,25 @@ export const navigate = async function () {
168
168
  }
169
169
  } else {
170
170
  holder = view[symbols.holder]
171
+
172
+ // Check, whether cached view holder's alpha prop is exists in transition or not
173
+ let hasAlphaProp = false
174
+ if (route.transition.before) {
175
+ if (Array.isArray(route.transition.before)) {
176
+ for (let i = 0; i < route.transition.before.length; i++) {
177
+ if (route.transition.before[i].prop === 'alpha') {
178
+ hasAlphaProp = true
179
+ break
180
+ }
181
+ }
182
+ } else if (route.transition.before.prop === 'alpha') {
183
+ hasAlphaProp = true
184
+ }
185
+ }
186
+ // set holder alpha when alpha prop is not exists in route transition
187
+ if (hasAlphaProp === false) {
188
+ holder.set('alpha', 1)
189
+ }
171
190
  }
172
191
 
173
192
  this[symbols.children].push(view)