etro 0.8.1 → 0.8.2

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,29 @@
1
+ name: Ship js trigger
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - closed
6
+ jobs:
7
+ build:
8
+ name: Release
9
+ runs-on: ubuntu-latest
10
+ if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ with:
14
+ fetch-depth: 0
15
+ ref: master
16
+ - uses: actions/setup-node@v1
17
+ with:
18
+ registry-url: "https://registry.npmjs.org"
19
+ - run: |
20
+ if [ -f "yarn.lock" ]; then
21
+ yarn install
22
+ else
23
+ npm install
24
+ fi
25
+ - run: npx shipjs trigger
26
+ env:
27
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+ NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
29
+ SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## [0.8.2] - 2021-07-08
9
+ ### Fixed
10
+ - `GaussianBlur` effect throwing a `TypeError` when applied to a movie or layer (the problem persisted).
11
+ - Ignore layers and effects removed with `delete`.
12
+
3
13
  ## [0.8.1] - 2021-04-20
4
14
  ### Fixed
5
15
  - `sourceStartTime` getting ignored on `'movie.seek'`.
@@ -143,12 +153,12 @@
143
153
  - Null or undefined layer dimensions default to the width or height of the movie.
144
154
  - Movie "end" event is now called "ended".
145
155
 
146
- ### Fixed
147
- - Bug with layer options
148
-
149
156
  ### Removed
150
157
  - Volume, speed and muted properties. These will most likely be added as separate audio effects in the future.
151
158
 
159
+ ### Fixed
160
+ - Bug with layer options
161
+
152
162
  ## [0.2.0] - 2018-10-14
153
163
  ### Added
154
164
  - Keyframes
@@ -158,7 +168,7 @@
158
168
  - Elliptical mask effect.
159
169
  - Many small improvements.
160
170
 
161
- ## [0.1.0] - 2018-10-06
171
+ ## 0.1.0 - 2018-10-06
162
172
  ### Added
163
173
  - Movies
164
174
  - Timeline
@@ -178,13 +188,12 @@
178
188
  - Gaussian blur
179
189
  - Transform
180
190
 
181
- [Unreleased]: https://github.com/etro-js/etro/compare/v0.8.1...HEAD
182
- [0.8.1]: https://github.com/etro-js/etro/compare/v0.8...v0.8.1
183
- [0.8.0]: https://github.com/etro-js/etro/compare/v0.7...v0.8
184
- [0.7.0]: https://github.com/etro-js/etro/compare/v0.6...v0.7
185
- [0.6.0]: https://github.com/etro-js/etro/compare/v0.5...v0.6
186
- [0.5.0]: https://github.com/etro-js/etro/compare/v0.4...v0.5
187
- [0.4.0]: https://github.com/etro-js/etro/compare/v0.3...v0.4
188
- [0.3.0]: https://github.com/etro-js/etro/compare/v0.2...v0.3
189
- [0.2.0]: https://github.com/etro-js/etro/compare/v0.1...v0.2
190
- [0.1.0]: https://github.com/etro-js/etro/releases/tag/v0.1
191
+ [0.8.2]: https://github.com/etro-js/etro/compare/v0.8.1...v0.8.2
192
+ [0.8.1]: https://github.com/etro-js/etro/compare/v0.8.0...v0.8.1
193
+ [0.8.0]: https://github.com/etro-js/etro/compare/v0.7.0...v0.8.0
194
+ [0.7.0]: https://github.com/etro-js/etro/compare/v0.6.0...v0.7.0
195
+ [0.6.0]: https://github.com/etro-js/etro/compare/v0.5.0...v0.6.0
196
+ [0.5.0]: https://github.com/etro-js/etro/compare/v0.4.0...v0.5.0
197
+ [0.4.0]: https://github.com/etro-js/etro/compare/v0.3.0...v0.4.0
198
+ [0.3.0]: https://github.com/etro-js/etro/compare/v0.2.0...v0.3.0
199
+ [0.2.0]: https://github.com/etro-js/etro/compare/v0.1.0...v0.2.0
package/dist/etro-cjs.js CHANGED
@@ -496,7 +496,7 @@ function watchPublic(target) {
496
496
  publish(proxy, target.type + ".change.modify", { property: getPath(receiver, prop), newValue: val });
497
497
  };
498
498
  var canWatch = function (receiver, prop) { return !prop.startsWith('_') &&
499
- (target.publicExcludes === undefined || !target.publicExcludes.includes(prop)); };
499
+ (receiver.publicExcludes === undefined || !receiver.publicExcludes.includes(prop)); };
500
500
  // The path to each child property (each is a unique proxy)
501
501
  var paths = new WeakMap();
502
502
  var handler = {
@@ -940,7 +940,7 @@ var Visual = /** @class */ (function (_super) {
940
940
  Visual.prototype._applyEffects = function () {
941
941
  for (var i = 0; i < this.effects.length; i++) {
942
942
  var effect = this.effects[i];
943
- if (effect.enabled)
943
+ if (effect && effect.enabled)
944
944
  // Pass relative time
945
945
  effect.apply(this, this.movie.currentTime - this.startTime);
946
946
  }
@@ -1902,20 +1902,22 @@ var Stack = /** @class */ (function (_super) {
1902
1902
  }
1903
1903
  Stack.prototype.attach = function (movie) {
1904
1904
  _super.prototype.attach.call(this, movie);
1905
- this.effects.forEach(function (effect) {
1905
+ this.effects.filter(function (effect) { return !!effect; }).forEach(function (effect) {
1906
1906
  effect.detach();
1907
1907
  effect.attach(movie);
1908
1908
  });
1909
1909
  };
1910
1910
  Stack.prototype.detach = function () {
1911
1911
  _super.prototype.detach.call(this);
1912
- this.effects.forEach(function (effect) {
1912
+ this.effects.filter(function (effect) { return !!effect; }).forEach(function (effect) {
1913
1913
  effect.detach();
1914
1914
  });
1915
1915
  };
1916
1916
  Stack.prototype.apply = function (target, reltime) {
1917
1917
  for (var i = 0; i < this.effects.length; i++) {
1918
1918
  var effect = this.effects[i];
1919
+ if (!effect)
1920
+ continue;
1919
1921
  effect.apply(target, reltime);
1920
1922
  }
1921
1923
  };
@@ -8967,11 +8969,12 @@ var Movie = /** @class */ (function () {
8967
8969
  Movie.prototype.pause = function () {
8968
8970
  this._paused = true;
8969
8971
  // Deactivate all layers
8970
- for (var i = 0; i < this.layers.length; i++) {
8971
- var layer = this.layers[i];
8972
- layer.stop();
8973
- layer.active = false;
8974
- }
8972
+ for (var i = 0; i < this.layers.length; i++)
8973
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
8974
+ var layer = this.layers[i];
8975
+ layer.stop();
8976
+ layer.active = false;
8977
+ }
8975
8978
  publish(this, 'movie.pause', {});
8976
8979
  return this;
8977
8980
  };
@@ -9020,15 +9023,16 @@ var Movie = /** @class */ (function () {
9020
9023
  if (!this.repeat || this.recording) {
9021
9024
  this._ended = true;
9022
9025
  // Deactivate all layers
9023
- for (var i = 0; i < this.layers.length; i++) {
9024
- var layer = this.layers[i];
9025
- // A layer that has been deleted before layers.length has been updated
9026
- // (see the layers proxy in the constructor).
9027
- if (!layer)
9028
- continue;
9029
- layer.stop();
9030
- layer.active = false;
9031
- }
9026
+ for (var i = 0; i < this.layers.length; i++)
9027
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
9028
+ var layer = this.layers[i];
9029
+ // A layer that has been deleted before layers.length has been updated
9030
+ // (see the layers proxy in the constructor).
9031
+ if (!layer)
9032
+ continue;
9033
+ layer.stop();
9034
+ layer.active = false;
9035
+ }
9032
9036
  }
9033
9037
  }
9034
9038
  // Stop playback or recording if done
@@ -9085,6 +9089,8 @@ var Movie = /** @class */ (function () {
9085
9089
  Movie.prototype._renderLayers = function () {
9086
9090
  var frameFullyLoaded = true;
9087
9091
  for (var i = 0; i < this.layers.length; i++) {
9092
+ if (!Object.prototype.hasOwnProperty.call(this.layers, i))
9093
+ continue;
9088
9094
  var layer = this.layers[i];
9089
9095
  // A layer that has been deleted before layers.length has been updated
9090
9096
  // (see the layers proxy in the constructor).
@@ -9151,7 +9157,8 @@ var Movie = /** @class */ (function () {
9151
9157
  */
9152
9158
  Movie.prototype._publishToLayers = function (type, event) {
9153
9159
  for (var i = 0; i < this.layers.length; i++)
9154
- publish(this.layers[i], type, event);
9160
+ if (Object.prototype.hasOwnProperty.call(this.layers, i))
9161
+ publish(this.layers[i], type, event);
9155
9162
  };
9156
9163
  Object.defineProperty(Movie.prototype, "rendering", {
9157
9164
  /**
package/dist/etro-iife.js CHANGED
@@ -497,7 +497,7 @@ var etro = (function () {
497
497
  publish(proxy, target.type + ".change.modify", { property: getPath(receiver, prop), newValue: val });
498
498
  };
499
499
  var canWatch = function (receiver, prop) { return !prop.startsWith('_') &&
500
- (target.publicExcludes === undefined || !target.publicExcludes.includes(prop)); };
500
+ (receiver.publicExcludes === undefined || !receiver.publicExcludes.includes(prop)); };
501
501
  // The path to each child property (each is a unique proxy)
502
502
  var paths = new WeakMap();
503
503
  var handler = {
@@ -941,7 +941,7 @@ var etro = (function () {
941
941
  Visual.prototype._applyEffects = function () {
942
942
  for (var i = 0; i < this.effects.length; i++) {
943
943
  var effect = this.effects[i];
944
- if (effect.enabled)
944
+ if (effect && effect.enabled)
945
945
  // Pass relative time
946
946
  effect.apply(this, this.movie.currentTime - this.startTime);
947
947
  }
@@ -1903,20 +1903,22 @@ var etro = (function () {
1903
1903
  }
1904
1904
  Stack.prototype.attach = function (movie) {
1905
1905
  _super.prototype.attach.call(this, movie);
1906
- this.effects.forEach(function (effect) {
1906
+ this.effects.filter(function (effect) { return !!effect; }).forEach(function (effect) {
1907
1907
  effect.detach();
1908
1908
  effect.attach(movie);
1909
1909
  });
1910
1910
  };
1911
1911
  Stack.prototype.detach = function () {
1912
1912
  _super.prototype.detach.call(this);
1913
- this.effects.forEach(function (effect) {
1913
+ this.effects.filter(function (effect) { return !!effect; }).forEach(function (effect) {
1914
1914
  effect.detach();
1915
1915
  });
1916
1916
  };
1917
1917
  Stack.prototype.apply = function (target, reltime) {
1918
1918
  for (var i = 0; i < this.effects.length; i++) {
1919
1919
  var effect = this.effects[i];
1920
+ if (!effect)
1921
+ continue;
1920
1922
  effect.apply(target, reltime);
1921
1923
  }
1922
1924
  };
@@ -8968,11 +8970,12 @@ var etro = (function () {
8968
8970
  Movie.prototype.pause = function () {
8969
8971
  this._paused = true;
8970
8972
  // Deactivate all layers
8971
- for (var i = 0; i < this.layers.length; i++) {
8972
- var layer = this.layers[i];
8973
- layer.stop();
8974
- layer.active = false;
8975
- }
8973
+ for (var i = 0; i < this.layers.length; i++)
8974
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
8975
+ var layer = this.layers[i];
8976
+ layer.stop();
8977
+ layer.active = false;
8978
+ }
8976
8979
  publish(this, 'movie.pause', {});
8977
8980
  return this;
8978
8981
  };
@@ -9021,15 +9024,16 @@ var etro = (function () {
9021
9024
  if (!this.repeat || this.recording) {
9022
9025
  this._ended = true;
9023
9026
  // Deactivate all layers
9024
- for (var i = 0; i < this.layers.length; i++) {
9025
- var layer = this.layers[i];
9026
- // A layer that has been deleted before layers.length has been updated
9027
- // (see the layers proxy in the constructor).
9028
- if (!layer)
9029
- continue;
9030
- layer.stop();
9031
- layer.active = false;
9032
- }
9027
+ for (var i = 0; i < this.layers.length; i++)
9028
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
9029
+ var layer = this.layers[i];
9030
+ // A layer that has been deleted before layers.length has been updated
9031
+ // (see the layers proxy in the constructor).
9032
+ if (!layer)
9033
+ continue;
9034
+ layer.stop();
9035
+ layer.active = false;
9036
+ }
9033
9037
  }
9034
9038
  }
9035
9039
  // Stop playback or recording if done
@@ -9086,6 +9090,8 @@ var etro = (function () {
9086
9090
  Movie.prototype._renderLayers = function () {
9087
9091
  var frameFullyLoaded = true;
9088
9092
  for (var i = 0; i < this.layers.length; i++) {
9093
+ if (!Object.prototype.hasOwnProperty.call(this.layers, i))
9094
+ continue;
9089
9095
  var layer = this.layers[i];
9090
9096
  // A layer that has been deleted before layers.length has been updated
9091
9097
  // (see the layers proxy in the constructor).
@@ -9152,7 +9158,8 @@ var etro = (function () {
9152
9158
  */
9153
9159
  Movie.prototype._publishToLayers = function (type, event) {
9154
9160
  for (var i = 0; i < this.layers.length; i++)
9155
- publish(this.layers[i], type, event);
9161
+ if (Object.prototype.hasOwnProperty.call(this.layers, i))
9162
+ publish(this.layers[i], type, event);
9156
9163
  };
9157
9164
  Object.defineProperty(Movie.prototype, "rendering", {
9158
9165
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etro",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "An extendable video-editing framework for the browser and Node",
5
5
  "browser": "dist/etro-cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,6 +36,7 @@
36
36
  "karma-jasmine": "^2.0.1",
37
37
  "karma-requirejs": "^1.1.0",
38
38
  "karma-super-dots-reporter": "^0.2.0",
39
+ "keep-a-changelog": "^0.10.4",
39
40
  "puppeteer": "^2.0.0",
40
41
  "resemblejs": "^3.2.5",
41
42
  "rollup": "^1.19.4",
@@ -44,6 +45,7 @@
44
45
  "rollup-plugin-node-resolve": "^5.2.0",
45
46
  "rollup-plugin-typescript2": "^0.29.0",
46
47
  "rollup-plugin-uglify-es": "^0.0.1",
48
+ "shipjs": "0.23.3",
47
49
  "typedoc": "^0.20.34",
48
50
  "typescript": "^4.1.3"
49
51
  },
@@ -57,7 +59,8 @@
57
59
  "lint:test": "eslint -c eslint.test-conf.js spec",
58
60
  "lint:examples": "eslint -c eslint.example-conf.js --ext .html examples",
59
61
  "start": "http-server",
60
- "test": "karma start"
62
+ "test": "karma start",
63
+ "release": "shipjs prepare"
61
64
  },
62
65
  "repository": {
63
66
  "type": "git",
package/ship.config.js ADDED
@@ -0,0 +1,80 @@
1
+ const { parser } = require('keep-a-changelog')
2
+ const fs = require('fs')
3
+ const semver = require('semver')
4
+
5
+ module.exports = {
6
+ updateChangelog: false,
7
+ formatCommitMessage: ({ version }) => `Release v${version}`,
8
+ formatPullRequestTitle: ({ version }) => `Release v${version}`,
9
+ getNextVersion: ({ currentVersion, dir }) => {
10
+ const changelog = new Changelog(`${dir}/CHANGELOG.md`)
11
+ return changelog.nextVersion(currentVersion)
12
+ },
13
+ versionUpdated: async ({ version, _releaseType, dir, _exec }) => {
14
+ const parsedVersion = semver.parse(version)
15
+ if (parsedVersion.prerelease.length)
16
+ return
17
+
18
+ // Release 'Unreleased' section in changelog
19
+ const changelogFile = `${dir}/CHANGELOG.md`
20
+ const oldChangelog = fs.readFileSync(changelogFile, 'utf8')
21
+ const parsed = parser(oldChangelog)
22
+ const release = parsed.findRelease() // get 'Unreleased' section
23
+ release.setVersion(version) // release
24
+ release.setDate(new Date()) // today
25
+ const newChangelog = parsed.toString()
26
+ fs.writeFileSync(changelogFile, newChangelog, 'utf8')
27
+ }
28
+ }
29
+
30
+ class Changelog {
31
+ constructor (path) {
32
+ const data = fs.readFileSync(path, 'utf8')
33
+ const lines = data.split(/\r?\n/)
34
+ const headings = []
35
+ let unreleased = false
36
+
37
+ this.releaseTag = 'latest'
38
+ lines.every((line) => {
39
+ if (line.startsWith('## [Unreleased]')) {
40
+ unreleased = true
41
+ const tagMatch = line.match(/## \[Unreleased\]\[(.*)\]/)
42
+ if (tagMatch)
43
+ this.releaseTag = tagMatch[1].trim()
44
+ } else if (line.startsWith('## ')) {
45
+ return false
46
+ }
47
+
48
+ if (unreleased)
49
+ if (line.startsWith('### ')) {
50
+ headings.push(line.match(/### (.*)/)[1].trim())
51
+ }
52
+
53
+ return true
54
+ })
55
+
56
+ if (headings.includes('Changed'))
57
+ this.releaseType = 'major'
58
+ else if (headings.includes('Added'))
59
+ this.releaseType = 'minor'
60
+ else
61
+ this.releaseType = 'patch'
62
+ }
63
+
64
+ nextVersion (version) {
65
+ const parsedVersion = semver.parse(version)
66
+
67
+ if (this.releaseTag !== 'latest')
68
+ if (parsedVersion.prerelease.length) {
69
+ parsedVersion.inc('prerelease', this.releaseTag)
70
+ } else {
71
+ parsedVersion.inc(this.releaseType)
72
+ parsedVersion.prerelease = [this.releaseTag, 0]
73
+ parsedVersion.format()
74
+ }
75
+ else
76
+ parsedVersion.inc(this.releaseType)
77
+
78
+ return parsedVersion.version
79
+ }
80
+ }
@@ -46,7 +46,7 @@ export class Stack extends Base {
46
46
 
47
47
  attach (movie: Movie): void {
48
48
  super.attach(movie)
49
- this.effects.forEach(effect => {
49
+ this.effects.filter(effect => !!effect).forEach(effect => {
50
50
  effect.detach()
51
51
  effect.attach(movie)
52
52
  })
@@ -54,7 +54,7 @@ export class Stack extends Base {
54
54
 
55
55
  detach (): void {
56
56
  super.detach()
57
- this.effects.forEach(effect => {
57
+ this.effects.filter(effect => !!effect).forEach(effect => {
58
58
  effect.detach()
59
59
  })
60
60
  }
@@ -62,6 +62,7 @@ export class Stack extends Base {
62
62
  apply (target: Movie | Visual, reltime: number): void {
63
63
  for (let i = 0; i < this.effects.length; i++) {
64
64
  const effect = this.effects[i]
65
+ if (!effect) continue
65
66
  effect.apply(target, reltime)
66
67
  }
67
68
  }
@@ -125,7 +125,7 @@ class Visual extends Base {
125
125
  _applyEffects (): void {
126
126
  for (let i = 0; i < this.effects.length; i++) {
127
127
  const effect = this.effects[i]
128
- if (effect.enabled)
128
+ if (effect && effect.enabled)
129
129
  // Pass relative time
130
130
  effect.apply(this, this.movie.currentTime - this.startTime)
131
131
  }
package/src/movie.ts CHANGED
@@ -324,11 +324,13 @@ export class Movie {
324
324
  pause (): Movie {
325
325
  this._paused = true
326
326
  // Deactivate all layers
327
- for (let i = 0; i < this.layers.length; i++) {
328
- const layer = this.layers[i]
329
- layer.stop()
330
- layer.active = false
331
- }
327
+ for (let i = 0; i < this.layers.length; i++)
328
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
329
+ const layer = this.layers[i]
330
+ layer.stop()
331
+ layer.active = false
332
+ }
333
+
332
334
  publish(this, 'movie.pause', {})
333
335
  return this
334
336
  }
@@ -380,16 +382,17 @@ export class Movie {
380
382
  if (!this.repeat || this.recording) {
381
383
  this._ended = true
382
384
  // Deactivate all layers
383
- for (let i = 0; i < this.layers.length; i++) {
384
- const layer = this.layers[i]
385
- // A layer that has been deleted before layers.length has been updated
386
- // (see the layers proxy in the constructor).
387
- if (!layer)
388
- continue
389
-
390
- layer.stop()
391
- layer.active = false
392
- }
385
+ for (let i = 0; i < this.layers.length; i++)
386
+ if (Object.prototype.hasOwnProperty.call(this.layers, i)) {
387
+ const layer = this.layers[i]
388
+ // A layer that has been deleted before layers.length has been updated
389
+ // (see the layers proxy in the constructor).
390
+ if (!layer)
391
+ continue
392
+
393
+ layer.stop()
394
+ layer.active = false
395
+ }
393
396
  }
394
397
  }
395
398
 
@@ -456,6 +459,8 @@ export class Movie {
456
459
  private _renderLayers () {
457
460
  let frameFullyLoaded = true
458
461
  for (let i = 0; i < this.layers.length; i++) {
462
+ if (!Object.prototype.hasOwnProperty.call(this.layers, i)) continue
463
+
459
464
  const layer = this.layers[i]
460
465
  // A layer that has been deleted before layers.length has been updated
461
466
  // (see the layers proxy in the constructor).
@@ -532,7 +537,8 @@ export class Movie {
532
537
  */
533
538
  private _publishToLayers (type, event) {
534
539
  for (let i = 0; i < this.layers.length; i++)
535
- publish(this.layers[i], type, event)
540
+ if (Object.prototype.hasOwnProperty.call(this.layers, i))
541
+ publish(this.layers[i], type, event)
536
542
  }
537
543
 
538
544
  /**
package/src/util.ts CHANGED
@@ -425,7 +425,7 @@ export function watchPublic (target: EtroObject): EtroObject {
425
425
  publish(proxy, `${target.type}.change.modify`, { property: getPath(receiver, prop), newValue: val })
426
426
  }
427
427
  const canWatch = (receiver, prop) => !prop.startsWith('_') &&
428
- (target.publicExcludes === undefined || !target.publicExcludes.includes(prop))
428
+ (receiver.publicExcludes === undefined || !receiver.publicExcludes.includes(prop))
429
429
 
430
430
  // The path to each child property (each is a unique proxy)
431
431
  const paths = new WeakMap()