@lightningjs/blits 0.9.3 → 0.9.4

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ # v0.9.4
4
+
5
+ _28 mar 2024_
6
+
7
+ - Upgraded Lightning renderer to v0.8.0
8
+ - Fixed issue with reactivity in a forloop when initial array is empty
9
+ - Introduced new `gpuMemoryLimit` launch setting
10
+
11
+
3
12
  # v0.9.3
4
13
 
5
14
  _25 mar 2024_
@@ -2,3 +2,9 @@
2
2
 
3
3
  ## Utilities
4
4
 
5
+ - focus()
6
+ - $router()
7
+ - select()
8
+ - parent
9
+ - Log
10
+ - setTimeout
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
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.7.6",
48
+ "@lightningjs/renderer": "^0.8.0",
49
49
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0",
50
50
  "execa": "^8.0.1",
51
51
  "kolorist": "^1.8.0",
@@ -59,6 +59,9 @@ You can remove the option from your \`src/index.js\`-file. And you can safely re
59
59
  clearColor: (settings.canvasColor && colors.normalize(settings.canvasColor)) || 0x00000000,
60
60
  enableInspector: settings.inspector || false,
61
61
  boundsMargin: settings.viewportMargin || 0,
62
+ // gpu memory limit, converted from mb to bytes - defaults to 200mb
63
+ txMemByteThreshold:
64
+ 'gpuMemoryLimit' in settings ? settings.gpuMemoryLimit * 1024 * 1024 : 200 * 1024 * 1024,
62
65
  },
63
66
  target,
64
67
  driver
package/src/launch.d.ts CHANGED
@@ -206,7 +206,17 @@ export interface Settings {
206
206
  *
207
207
  * Defaults to `0`
208
208
  */
209
- viewportMargin?: number | [number, number, number, number]
209
+ viewportMargin?: number | [number, number, number, number],
210
+ /**
211
+ * Threshold in `Megabytes` after which all the textures that are currently not visible
212
+ * within the configured viewport margin will be be freed and cleaned up
213
+ *
214
+ * When passed `0` the threshold is disabled and textures will not be actively freed
215
+ * and cleaned up
216
+ *
217
+ * Defaults to `200` (mb)
218
+ */
219
+ gpuMemoryLimit?: number
210
220
  }
211
221
 
212
222
  /**
@@ -219,6 +219,17 @@ const generateForLoopCode = function (templateObject, parent) {
219
219
  }
220
220
 
221
221
  const forCounter = counter
222
+
223
+ // reference all reactive attributes (except those referencing the iterator item),
224
+ // to ensure that reactivity is registered, even when the initial array is empty
225
+ Object.keys(templateObject).forEach((k) => {
226
+ if (isReactiveKey(k) && templateObject[k].indexOf('$' + item) === -1) {
227
+ ctx.renderCode.push(`
228
+ void ${interpolate(templateObject[k], 'component.')}
229
+ `)
230
+ }
231
+ })
232
+
222
233
  ctx.renderCode.push(`
223
234
  const collection = ${cast(result[2], ':for')} || []
224
235
  const keys = []
@@ -25,7 +25,7 @@ export default (component, computeds) => {
25
25
  for (let computed in computeds) {
26
26
  // test for reserved keys?
27
27
  if (component[symbols.stateKeys] && component[symbols.stateKeys].indexOf(computed) > -1) {
28
- Log.error(`${computed} already exists as a prop`)
28
+ Log.error(`${computed} already exists as a state variable`)
29
29
  } else if (component[symbols.propKeys] && component[symbols.propKeys].indexOf(computed) > -1) {
30
30
  Log.error(`${computed} already exists as a prop`)
31
31
  } else if (