@lightningjs/blits 0.7.4 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ # v0.8.0
4
+
5
+ _1 mar 2024_
6
+
7
+ - Added `this.$clearIntervals()` and `this.$clearTimeouts()` methods that clear all intervals and timers set on a certain component
8
+ - **Breaking change:** Renamed the key `function` to `easing` in the transitions object used to specify a custom easing functio (deprecation notice added)
9
+
3
10
  # v0.7.4
4
11
 
5
12
  _28 feb 2024_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -35,7 +35,7 @@ declare namespace Application {
35
35
  /**
36
36
  * Easing function to apply to the transition
37
37
  */
38
- function?: string,
38
+ easing?: string,
39
39
  /**
40
40
  * Delay before the transition starts in milliseconds
41
41
  */
package/src/element.js CHANGED
@@ -21,6 +21,21 @@ import colors from './lib/colors/colors.js'
21
21
  import { Log } from './lib/log.js'
22
22
  import symbols from './lib/symbols.js'
23
23
 
24
+ const deprecationMsg = `
25
+ ----------------------------------------------------------------------------------------------------
26
+ Deprecation notice:
27
+ ----------------------------------------------------------------------------------------------------
28
+
29
+ The property for defining a transition easing function has been renamed from "function" to "easing".
30
+
31
+ Please update your code like the example below to keep your custom easing function.
32
+
33
+ Before: <Element :y.transition=“{v: $y, function: ‘ease-in-out’}” />
34
+
35
+ After: <Element :y.transition=“{v: $y, easing: ‘ease-in-out’}” />
36
+
37
+ `
38
+
24
39
  const isTransition = (value) => {
25
40
  return typeof value === 'object' && 'transition' in value
26
41
  }
@@ -307,7 +322,9 @@ const Element = {
307
322
  easing:
308
323
  typeof transition === 'object'
309
324
  ? 'function' in transition
310
- ? transition.function
325
+ ? Log.warn(deprecationMsg)
326
+ : 'easing' in transition
327
+ ? transition.easing
311
328
  : 'ease'
312
329
  : 'ease',
313
330
  delay: typeof transition === 'object' ? ('delay' in transition ? transition.delay : 0) : 0,
@@ -62,12 +62,8 @@ export default (component, name) => {
62
62
  destroy: {
63
63
  value: function () {
64
64
  this.lifecycle.state = 'destroy'
65
- for (let i = 0; i < this[symbols.timeouts].length; i++) {
66
- clearTimeout(this[symbols.timeouts][i])
67
- }
68
- for (let i = 0; i < this[symbols.intervals].length; i++) {
69
- clearInterval(this[symbols.intervals][i])
70
- }
65
+ this.$clearTimeouts()
66
+ this.$clearIntervals()
71
67
  eventListeners.removeListeners(this)
72
68
  deleteChildren(this[symbols.children])
73
69
  Log.debug(`Destroyed component ${this.componentId}`)
@@ -176,6 +172,17 @@ export default (component, name) => {
176
172
  enumerable: true,
177
173
  configurable: false,
178
174
  },
175
+ $clearTimeouts: {
176
+ value: function () {
177
+ for (let i = 0; i < this[symbols.timeouts].length; i++) {
178
+ clearTimeout(this[symbols.timeouts][i])
179
+ }
180
+ this[symbols.timeouts] = []
181
+ },
182
+ writable: false,
183
+ enumerable: true,
184
+ configurable: false,
185
+ },
179
186
  $setInterval: {
180
187
  value: function (fn, ms, ...params) {
181
188
  const intervalId = setInterval(() => fn.apply(null, params), ms, params)
@@ -197,6 +204,17 @@ export default (component, name) => {
197
204
  enumerable: true,
198
205
  configurable: false,
199
206
  },
207
+ $clearIntervals: {
208
+ value: function () {
209
+ for (let i = 0; i < this[symbols.intervals].length; i++) {
210
+ clearInterval(this[symbols.intervals][i])
211
+ }
212
+ this[symbols.intervals] = []
213
+ },
214
+ writable: false,
215
+ enumerable: true,
216
+ configurable: false,
217
+ },
200
218
  $emit: {
201
219
  value: function (event, params) {
202
220
  eventListeners.executeListeners(event, params)