@lightningjs/blits 0.3.8 → 0.3.10

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.
@@ -31,6 +31,6 @@
31
31
  "vite": "^4.0.4"
32
32
  },
33
33
  "dependencies": {
34
- "@lightningjs/blits": "^0.3.7"
34
+ "@lightningjs/blits": "^0.3.10"
35
35
  }
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.cjs",
6
6
  "exports": {
@@ -39,7 +39,7 @@
39
39
  "tape": "^5.5.0"
40
40
  },
41
41
  "dependencies": {
42
- "@lightningjs/renderer": "^0.3.0",
42
+ "@lightningjs/renderer": "^0.3.6",
43
43
  "@lightningjs/vite-plugin-import-chunk-url": "^0.3.0"
44
44
  }
45
45
  }
@@ -141,12 +141,12 @@ declare namespace Component {
141
141
  /**
142
142
  * Set a timeout that is automatically cleaned upon component destroy
143
143
  */
144
- $setTimeout: (callback: (args: any) => void, ms?: number | undefined) => typeof setTimeout
144
+ $setTimeout: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setTimeout>
145
145
 
146
146
  /**
147
147
  * Set an interval that is automatically cleaned upon component destroy
148
148
  */
149
- $setInterval: (callback: (args: any) => void, ms?: number | undefined) => typeof setInterval
149
+ $setInterval: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setInterval>
150
150
 
151
151
  /**
152
152
  * Log to the console with prettier output and configurable debug levels in Settings
@@ -36,7 +36,7 @@ export default () =>
36
36
  : this.map[this.frame]
37
37
 
38
38
  if (this.spriteTexture && options) {
39
- return this.___renderer.makeTexture('SubTexture', {
39
+ return this.___renderer.createTexture('SubTexture', {
40
40
  texture: this.spriteTexture,
41
41
  x: options.x,
42
42
  y: options.y,
@@ -48,7 +48,7 @@ export default () =>
48
48
  },
49
49
  hooks: {
50
50
  ready() {
51
- this.spriteTexture = this.___renderer.makeTexture('ImageTexture', {
51
+ this.spriteTexture = this.___renderer.createTexture('ImageTexture', {
52
52
  src: `${window.location.protocol}//${window.location.host}/${this.image}`,
53
53
  })
54
54
  },
@@ -32,6 +32,7 @@ export default () =>
32
32
  stretch="$stretch"
33
33
  contain="$_contain"
34
34
  :w="$w"
35
+ :h="$h"
35
36
  :textAlign="$align"
36
37
  @loaded="$@loaded"
37
38
  @error="$@error"
@@ -54,6 +55,7 @@ export default () =>
54
55
  'stretch',
55
56
  'align',
56
57
  'w',
58
+ 'h',
57
59
  'contain',
58
60
  '@loaded',
59
61
  '@error',
@@ -63,7 +65,7 @@ export default () =>
63
65
  return this.slotcontent || this.content || ''
64
66
  },
65
67
  _contain() {
66
- return this.contain || (this.align ? 'width' : null)
68
+ return this.contain || (this.w && this.h ? 'both' : this.w ? 'width' : 'none')
67
69
  },
68
70
  },
69
71
  })
package/src/element.js CHANGED
@@ -123,7 +123,7 @@ const transformations = {
123
123
  }
124
124
  },
125
125
  effects(props) {
126
- props.shader = renderer.makeShader('DynamicShader', {
126
+ props.shader = renderer.createShader('DynamicShader', {
127
127
  effects: props.effects.map((eff) => {
128
128
  if (eff.props && eff.props.color) {
129
129
  eff.props.color = colors.normalize(eff.props.color)
@@ -28,7 +28,15 @@ const arrayMethods = [
28
28
  'splice',
29
29
  'unshift',
30
30
  ]
31
+
32
+ const proxyMap = new WeakMap()
33
+
31
34
  const reactiveProxy = (target) => {
35
+ const isProxy = proxyMap.get(target)
36
+ if (isProxy) {
37
+ return isProxy
38
+ }
39
+
32
40
  const handler = {
33
41
  get(target, key, receiver) {
34
42
  if (Array.isArray(target) && arrayMethods.includes(key)) {
@@ -36,11 +44,7 @@ const reactiveProxy = (target) => {
36
44
  }
37
45
  track(target, key)
38
46
 
39
- if (
40
- target[key] !== null &&
41
- typeof target[key] === 'object' &&
42
- Object.getPrototypeOf(target[key]) === Object.prototype
43
- ) {
47
+ if (target[key] !== null && typeof target[key] === 'object') {
44
48
  return reactiveProxy(target[key])
45
49
  }
46
50
 
@@ -65,7 +69,10 @@ const reactiveProxy = (target) => {
65
69
  return result
66
70
  },
67
71
  }
68
- return new Proxy(target, handler)
72
+
73
+ const proxy = new Proxy(target, handler)
74
+ proxyMap.set(target, proxy)
75
+ return proxy
69
76
  }
70
77
 
71
78
  const reactiveDefineProperty = (target) => {