etro 0.12.1 → 0.14.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.
Files changed (145) hide show
  1. package/.github/dependabot.yml +6 -0
  2. package/.github/scripts/update-changelog.js +72 -0
  3. package/.github/workflows/dependabot-changelog.yml +57 -0
  4. package/.github/workflows/nodejs.yml +6 -2
  5. package/.github/workflows/shipjs-trigger.yml +2 -1
  6. package/.husky/pre-commit +1 -1
  7. package/AGENTS.md +106 -0
  8. package/CHANGELOG.md +46 -0
  9. package/CONTRIBUTING.md +5 -5
  10. package/README.md +8 -7
  11. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/base.css +224 -0
  12. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/block-navigation.js +87 -0
  13. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/favicon.png +0 -0
  14. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/index.html +161 -0
  15. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/prettify.css +1 -0
  16. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/prettify.js +2 -0
  17. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/sort-arrow-sprite.png +0 -0
  18. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/sorter.js +196 -0
  19. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/custom-array.ts.html +214 -0
  20. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/base.ts.html +481 -0
  21. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/brightness.ts.html +214 -0
  22. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/channels.ts.html +235 -0
  23. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/chroma-key.ts.html +331 -0
  24. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/contrast.ts.html +211 -0
  25. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/elliptical-mask.ts.html +310 -0
  26. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/gaussian-blur.ts.html +796 -0
  27. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/grayscale.ts.html +187 -0
  28. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/index.html +311 -0
  29. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/index.ts.html +154 -0
  30. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/pixelate.ts.html +259 -0
  31. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/shader.ts.html +1774 -0
  32. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/stack.ts.html +358 -0
  33. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/transform.ts.html +685 -0
  34. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/visual.ts.html +148 -0
  35. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/etro.ts.html +163 -0
  36. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/event.ts.html +691 -0
  37. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/index.html +176 -0
  38. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/index.ts.html +109 -0
  39. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/audio-source.ts.html +835 -0
  40. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/audio.ts.html +241 -0
  41. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/base.ts.html +826 -0
  42. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/image.ts.html +181 -0
  43. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/index.html +236 -0
  44. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/index.ts.html +124 -0
  45. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/text.ts.html +658 -0
  46. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/video.ts.html +211 -0
  47. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/visual-source.ts.html +721 -0
  48. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/visual.ts.html +760 -0
  49. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/effects.ts.html +163 -0
  50. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/index.html +161 -0
  51. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/index.ts.html +88 -0
  52. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/layers.ts.html +163 -0
  53. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/movie.ts.html +3037 -0
  54. package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/util.ts.html +1765 -0
  55. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/base.css +224 -0
  56. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/block-navigation.js +87 -0
  57. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/favicon.png +0 -0
  58. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/index.html +161 -0
  59. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/prettify.css +1 -0
  60. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/prettify.js +2 -0
  61. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/sort-arrow-sprite.png +0 -0
  62. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/sorter.js +196 -0
  63. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/custom-array.ts.html +214 -0
  64. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/base.ts.html +481 -0
  65. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/brightness.ts.html +214 -0
  66. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/channels.ts.html +235 -0
  67. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/chroma-key.ts.html +331 -0
  68. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/contrast.ts.html +211 -0
  69. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/elliptical-mask.ts.html +310 -0
  70. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/gaussian-blur.ts.html +796 -0
  71. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/grayscale.ts.html +187 -0
  72. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/index.html +311 -0
  73. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/index.ts.html +154 -0
  74. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/pixelate.ts.html +259 -0
  75. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/shader.ts.html +1774 -0
  76. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/stack.ts.html +358 -0
  77. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/transform.ts.html +685 -0
  78. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/visual.ts.html +148 -0
  79. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/etro.ts.html +163 -0
  80. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/event.ts.html +691 -0
  81. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/index.html +176 -0
  82. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/index.ts.html +109 -0
  83. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/audio-source.ts.html +835 -0
  84. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/audio.ts.html +241 -0
  85. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/base.ts.html +826 -0
  86. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/image.ts.html +181 -0
  87. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/index.html +236 -0
  88. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/index.ts.html +124 -0
  89. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/text.ts.html +658 -0
  90. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/video.ts.html +211 -0
  91. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/visual-source.ts.html +721 -0
  92. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/visual.ts.html +760 -0
  93. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/effects.ts.html +163 -0
  94. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/index.html +161 -0
  95. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/index.ts.html +88 -0
  96. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/layers.ts.html +163 -0
  97. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/movie.ts.html +3037 -0
  98. package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/util.ts.html +1765 -0
  99. package/dist/custom-array.d.ts +10 -10
  100. package/dist/effect/base.d.ts +61 -60
  101. package/dist/effect/brightness.d.ts +16 -16
  102. package/dist/effect/channels.d.ts +23 -23
  103. package/dist/effect/chroma-key.d.ts +23 -23
  104. package/dist/effect/contrast.d.ts +15 -15
  105. package/dist/effect/elliptical-mask.d.ts +31 -31
  106. package/dist/effect/gaussian-blur.d.ts +60 -60
  107. package/dist/effect/grayscale.d.ts +7 -7
  108. package/dist/effect/index.d.ts +16 -16
  109. package/dist/effect/pixelate.d.ts +18 -18
  110. package/dist/effect/shader.d.ts +109 -109
  111. package/dist/effect/stack.d.ts +27 -27
  112. package/dist/effect/transform.d.ts +73 -73
  113. package/dist/effect/visual.d.ts +17 -17
  114. package/dist/etro-cjs.js +3601 -3556
  115. package/dist/etro-iife.js +3602 -3557
  116. package/dist/etro.d.ts +7 -7
  117. package/dist/event.d.ts +40 -40
  118. package/dist/index.d.ts +6 -6
  119. package/dist/layer/audio-source.d.ts +28 -28
  120. package/dist/layer/audio.d.ts +27 -27
  121. package/dist/layer/base.d.ts +129 -128
  122. package/dist/layer/image.d.ts +20 -20
  123. package/dist/layer/index.d.ts +11 -11
  124. package/dist/layer/text.d.ts +78 -78
  125. package/dist/layer/video.d.ts +23 -23
  126. package/dist/layer/visual-source.d.ts +47 -47
  127. package/dist/layer/visual.d.ts +62 -62
  128. package/dist/movie/effects.d.ts +6 -6
  129. package/dist/movie/index.d.ts +1 -1
  130. package/dist/movie/layers.d.ts +6 -6
  131. package/dist/movie/movie.d.ts +280 -277
  132. package/dist/object.d.ts +19 -19
  133. package/dist/util.d.ts +128 -121
  134. package/karma.conf.js +70 -3
  135. package/package.json +14 -17
  136. package/ship.config.js +9 -11
  137. package/src/effect/base.ts +16 -0
  138. package/src/effect/shader.ts +1 -1
  139. package/src/layer/base.ts +19 -1
  140. package/src/movie/movie.ts +123 -8
  141. package/src/util.ts +116 -3
  142. package/tsconfig.json +3 -2
  143. package/.husky/commit-msg +0 -4
  144. package/.husky/prepare-commit-msg +0 -11
  145. package/commitlint.config.ts +0 -39
package/dist/util.d.ts CHANGED
@@ -1,121 +1,128 @@
1
- /**
2
- * @module util
3
- */
4
- import EtroObject from './object';
5
- import { Movie } from './movie';
6
- /**
7
- * Merges `options` with `defaultOptions`, and then copies the properties with
8
- * the keys in `defaultOptions` from the merged object to `destObj`.
9
- *
10
- * @deprecated Each option should be copied individually, and the default value
11
- * should be set in the constructor. See
12
- * {@link https://github.com/etro-js/etro/issues/131} for more info.
13
- *
14
- * @return
15
- */
16
- export declare function applyOptions(options: object, destObj: EtroObject): void;
17
- export declare function clearCachedValues(movie: Movie): void;
18
- /**
19
- * A keyframe set.
20
- *
21
- * Usage:
22
- * ```js
23
- new etro.KeyFrame([time1, value1, interpolation1], [time2, value2])`
24
- * ```
25
- * TypeScript users need to specify the type of the value as a type parameter.
26
- */
27
- export declare class KeyFrame<T> {
28
- value: unknown[][];
29
- /** Keys to interpolate, or all keys if undefined */
30
- interpolationKeys: string[];
31
- constructor(...value: (number | T)[][]);
32
- withKeys(keys: string[]): KeyFrame<T>;
33
- evaluate(time: number): T;
34
- }
35
- /** A dynamic property. Supports simple values, keyframes and functions */
36
- export declare type Dynamic<T> = T | KeyFrame<T> | ((element: EtroObject, time: number) => T);
37
- /**
38
- * Computes a property.
39
- *
40
- * @param element - the etro object to which the property belongs to
41
- * @param path - the dot-separated path to a property on `element`
42
- * @param time - time to calculate keyframes for, if necessary
43
- *
44
- * Note that only values used in keyframes that are numbers or objects
45
- * (including arrays) are interpolated. All other values are taken sequentially
46
- * with no interpolation. JavaScript will convert parsed colors, if created
47
- * correctly, to their string representations when assigned to a
48
- * CanvasRenderingContext2D property.
49
- */
50
- export declare function val(element: EtroObject, path: string, time: number): any;
51
- export declare function linearInterp(x1: number | object, x2: number | object, t: number, objectKeys?: string[]): number | object;
52
- export declare function cosineInterp(x1: number | object, x2: number | object, t: number, objectKeys?: string[]): number | object;
53
- /**
54
- * An RGBA color, for proper interpolation and shader effects
55
- */
56
- export declare class Color {
57
- r: number;
58
- g: number;
59
- b: number;
60
- a: number;
61
- /**
62
- * @param r
63
- * @param g
64
- * @param b
65
- * @param a
66
- */
67
- constructor(r: number, g: number, b: number, a?: number);
68
- /**
69
- * Converts to a CSS color
70
- */
71
- toString(): string;
72
- }
73
- /**
74
- * Converts a CSS color string to a {@link Color} object representation.
75
- * @param str
76
- * @return the parsed color
77
- */
78
- export declare function parseColor(str: string): Color;
79
- /**
80
- * A font, for proper interpolation
81
- */
82
- export declare class Font {
83
- size: number;
84
- sizeUnit: string;
85
- family: string;
86
- style: string;
87
- variant: string;
88
- weight: string;
89
- stretch: string;
90
- lineHeight: string;
91
- /**
92
- * @param size
93
- * @param family
94
- * @param sizeUnit
95
- */
96
- constructor(size: number, sizeUnit: string, family: string, style?: string, variant?: string, weight?: string, stretch?: string, lineHeight?: string);
97
- /**
98
- * Converts to CSS font syntax
99
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font
100
- */
101
- toString(): string;
102
- }
103
- /**
104
- * Converts a CSS font string to a {@link Font} object
105
- * representation.
106
- * @param str
107
- * @return the parsed font
108
- */
109
- export declare function parseFont(str: string): Font;
110
- /**
111
- * @param mapper
112
- * @param canvas
113
- * @param ctx
114
- * @param x
115
- * @param y
116
- * @param width
117
- * @param height
118
- * @param flush
119
- * @deprecated Use {@link effect.Shader} instead
120
- */
121
- export declare function mapPixels(mapper: (pixels: Uint8ClampedArray, i: number) => void, canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, flush?: boolean): void;
1
+ /**
2
+ * @module util
3
+ */
4
+ import EtroObject from './object';
5
+ import { Movie } from './movie';
6
+ /**
7
+ * Merges `options` with `defaultOptions`, and then copies the properties with
8
+ * the keys in `defaultOptions` from the merged object to `destObj`.
9
+ *
10
+ * @deprecated Each option should be copied individually, and the default value
11
+ * should be set in the constructor. See
12
+ * {@link https://github.com/etro-js/etro/issues/131} for more info.
13
+ *
14
+ * @return
15
+ */
16
+ export declare function applyOptions(options: object, destObj: EtroObject): void;
17
+ export declare function clearCachedValues(movie: Movie): void;
18
+ type Interpolate = <U = number | object>(startValue: U, endValue: U, percentProgress: number, interpolationKeys: string[]) => U;
19
+ /**
20
+ * A keyframe set.
21
+ *
22
+ * Usage:
23
+ * ```js
24
+ new etro.KeyFrame([time1, value1, interpolation1], [time2, value2])`
25
+ * ```
26
+ * TypeScript users need to specify the type of the value as a type parameter.
27
+ */
28
+ export declare class KeyFrame<T> {
29
+ value: (number | T | Interpolate)[][];
30
+ /** Keys to interpolate, or all keys if undefined */
31
+ interpolationKeys: string[];
32
+ constructor(...value: (number | T)[][]);
33
+ withKeys(keys: string[]): KeyFrame<T>;
34
+ toJSON(): object;
35
+ evaluate(time: number): T;
36
+ }
37
+ /** A dynamic property. Supports simple values, keyframes and functions */
38
+ export type Dynamic<T> = T | KeyFrame<T> | ((element: EtroObject, time: number) => T);
39
+ /**
40
+ * Computes a property.
41
+ *
42
+ * @param element - the etro object to which the property belongs to
43
+ * @param path - the dot-separated path to a property on `element`
44
+ * @param time - time to calculate keyframes for, if necessary
45
+ *
46
+ * Note that only values used in keyframes that are numbers or objects
47
+ * (including arrays) are interpolated. All other values are taken sequentially
48
+ * with no interpolation. JavaScript will convert parsed colors, if created
49
+ * correctly, to their string representations when assigned to a
50
+ * CanvasRenderingContext2D property.
51
+ */
52
+ export declare function val(element: EtroObject, path: string, time: number): any;
53
+ export declare function linearInterp(x1: number | object, x2: number | object, t: number, objectKeys?: string[]): number | object;
54
+ export declare function cosineInterp(x1: number | object, x2: number | object, t: number, objectKeys?: string[]): number | object;
55
+ /**
56
+ * An RGBA color, for proper interpolation and shader effects
57
+ */
58
+ export declare class Color {
59
+ r: number;
60
+ g: number;
61
+ b: number;
62
+ a: number;
63
+ /**
64
+ * @param r
65
+ * @param g
66
+ * @param b
67
+ * @param a
68
+ */
69
+ constructor(r: number, g: number, b: number, a?: number);
70
+ /**
71
+ * Converts to a CSS color
72
+ */
73
+ toString(): string;
74
+ toJSON(): object;
75
+ }
76
+ /**
77
+ * Converts a CSS color string to a {@link Color} object representation.
78
+ * @param str
79
+ * @return the parsed color
80
+ */
81
+ export declare function parseColor(str: string): Color;
82
+ /**
83
+ * A font, for proper interpolation
84
+ */
85
+ export declare class Font {
86
+ size: number;
87
+ sizeUnit: string;
88
+ family: string;
89
+ style: string;
90
+ variant: string;
91
+ weight: string;
92
+ stretch: string;
93
+ lineHeight: string;
94
+ /**
95
+ * @param size
96
+ * @param family
97
+ * @param sizeUnit
98
+ */
99
+ constructor(size: number, sizeUnit: string, family: string, style?: string, variant?: string, weight?: string, stretch?: string, lineHeight?: string);
100
+ /**
101
+ * Converts to CSS font syntax
102
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font
103
+ */
104
+ toString(): string;
105
+ toJSON(): object;
106
+ }
107
+ /**
108
+ * Converts a CSS font string to a {@link Font} object
109
+ * representation.
110
+ * @param str
111
+ * @return the parsed font
112
+ */
113
+ export declare function parseFont(str: string): Font;
114
+ /**
115
+ * @param mapper
116
+ * @param canvas
117
+ * @param ctx
118
+ * @param x
119
+ * @param y
120
+ * @param width
121
+ * @param height
122
+ * @param flush
123
+ * @deprecated Use {@link effect.Shader} instead
124
+ */
125
+ export declare function mapPixels(mapper: (pixels: Uint8ClampedArray, i: number) => void, canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, flush?: boolean): void;
126
+ export declare function serializeProperty(val: any): any;
127
+ export declare function deserializeProperty(val: any): any;
128
+ export {};
package/karma.conf.js CHANGED
@@ -1,7 +1,40 @@
1
1
  // Karma configuration
2
2
  // Generated on Thu Sep 19 2019 02:05:06 GMT-0400 (Eastern Daylight Time)
3
3
 
4
- process.env.CHROME_BIN = require('puppeteer').executablePath()
4
+ const { BrowserFinder } = require('@agent-infra/browser-finder')
5
+
6
+ const finder = new BrowserFinder()
7
+
8
+ // Detect which browsers are installed locally. Honor an explicit *_BIN
9
+ // override if one is already set, otherwise ask the finder to locate it.
10
+ function locateBrowser (type, envVar) {
11
+ if (process.env[envVar]) {
12
+ return process.env[envVar]
13
+ }
14
+ try {
15
+ return finder.findBrowser(type).path
16
+ } catch (e) {
17
+ return undefined
18
+ }
19
+ }
20
+
21
+ const browsers = []
22
+
23
+ const chromeBin = locateBrowser('chrome', 'CHROME_BIN')
24
+ if (chromeBin) {
25
+ process.env.CHROME_BIN = chromeBin
26
+ browsers.push('ChromeHeadlessWebGL')
27
+ }
28
+
29
+ const firefoxBin = locateBrowser('firefox', 'FIREFOX_BIN')
30
+ if (firefoxBin) {
31
+ process.env.FIREFOX_BIN = firefoxBin
32
+ browsers.push('FirefoxHeadless')
33
+ }
34
+
35
+ if (browsers.length === 0) {
36
+ throw new Error('No supported browsers (Chrome or Firefox) found locally. Install one or set CHROME_BIN / FIREFOX_BIN.')
37
+ }
5
38
 
6
39
  // Make sure TEST_SUITE is set
7
40
  if (!process.env.TEST_SUITE) {
@@ -56,7 +89,8 @@ module.exports = function (config) {
56
89
 
57
90
  // start these browsers
58
91
  // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
59
- browsers: ['FirefoxHeadless'],
92
+ // Only the browsers detected as installed locally.
93
+ browsers,
60
94
 
61
95
  customLaunchers: {
62
96
  'FirefoxHeadless': {
@@ -64,8 +98,28 @@ module.exports = function (config) {
64
98
  flags: ['-headless'],
65
99
  prefs: {
66
100
  'network.proxy.type': 0,
67
- 'media.autoplay.default': 0 // Allow all autoplay
101
+ 'media.autoplay.default': 0, // Allow all autoplay
102
+ // Mute the speaker output only. The Web Audio graph still runs, so
103
+ // analyser-based assertions stay valid. Applies to karma's throwaway
104
+ // temp profile, so it won't affect a normal Firefox install.
105
+ 'media.volume_scale': '0.0',
106
+ // Force WebGL on under software rendering (e.g. llvmpipe in CI),
107
+ // which Firefox would otherwise blocklist for lacking a GPU.
108
+ 'webgl.force-enabled': true,
109
+ 'webgl.disabled': false,
110
+ 'webgl.disable-fail-if-major-performance-caveat': true
68
111
  }
112
+ },
113
+ 'ChromeHeadlessWebGL': {
114
+ base: 'ChromeHeadless',
115
+ flags: [
116
+ '--use-gl=angle',
117
+ '--use-angle=swiftshader',
118
+ '--no-sandbox',
119
+ '--autoplay-policy=no-user-gesture-required',
120
+ // Mute the speaker output only; the Web Audio graph still runs.
121
+ '--mute-audio'
122
+ ]
69
123
  }
70
124
  },
71
125
 
@@ -87,5 +141,18 @@ module.exports = function (config) {
87
141
  // Concurrency level
88
142
  // how many browser should be started simultaneous
89
143
  concurrency: Infinity,
144
+
145
+ karmaTypescriptConfig: {
146
+ compilerOptions: {
147
+ // Avoid type-checking third-party declaration packages in browser tests.
148
+ skipLibCheck: true
149
+ },
150
+ bundlerOptions: {
151
+ // Resemblejs only references the `canvas` dependency in the node
152
+ // runtime. Since the tests are run in a browser, we need to exclude it
153
+ // from the bundle to prevent false errors.
154
+ exclude: ['canvas']
155
+ }
156
+ }
90
157
  })
91
158
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "etro",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "An extendable video-editing framework for the browser",
5
5
  "main": "dist/etro-cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,13 +10,11 @@
10
10
  "test": "spec"
11
11
  },
12
12
  "devDependencies": {
13
- "@commitlint/cli": "^17.6.6",
14
- "@commitlint/format": "^17.4.4",
15
- "@rollup/plugin-eslint": "^8.0.2",
13
+ "@agent-infra/browser-finder": "^0.2.2",
14
+ "@rollup/plugin-eslint": "^9.2.0",
16
15
  "@types/jest": "^29.0.0",
17
- "@typescript-eslint/eslint-plugin": "^5.30.7",
18
- "@typescript-eslint/parser": "^5.30.7",
19
- "canvas": "^2.11.2",
16
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
17
+ "@typescript-eslint/parser": "^5.62.0",
20
18
  "cross-env": "^7.0.3",
21
19
  "docdash": "^1.1.1",
22
20
  "ecstatic": ">=4.1.3",
@@ -28,27 +26,26 @@
28
26
  "eslint-plugin-promise": "^6.0.0",
29
27
  "eslint-plugin-standard": "^5.0.0",
30
28
  "ev": "0.0.7",
31
- "gitmoji-cli": "^9.0.0",
32
29
  "http-server": "^14.1.1",
33
30
  "husky": "^8.0.3",
34
31
  "jasmine": "^3.4.0",
35
- "jasmine-ts": "^0.4.0",
36
- "karma": "^6.1.1",
32
+ "karma": "^6.4.4",
33
+ "karma-chrome-launcher": "^3.2.0",
37
34
  "karma-firefox-launcher": "^2.1.2",
38
- "karma-jasmine": "^2.0.1",
35
+ "karma-jasmine": "^5.1.0",
39
36
  "karma-super-dots-reporter": "^0.2.0",
40
- "karma-typescript": "^5.5.3",
37
+ "karma-typescript": "^5.5.4",
41
38
  "keep-a-changelog": "^0.10.4",
42
39
  "puppeteer": "^2.0.0",
43
40
  "resemblejs": "^4.1.0",
44
- "rollup": "^1.19.4",
41
+ "rollup": "^4.61.1",
45
42
  "rollup-plugin-cleaner": "^1.0.0",
46
43
  "rollup-plugin-node-resolve": "^5.2.0",
47
- "rollup-plugin-typescript2": "^0.29.0",
44
+ "rollup-plugin-typescript2": "^0.37.0",
48
45
  "rollup-plugin-uglify-es": "^0.0.1",
49
- "shipjs": "^0.26.3",
50
- "typedoc": "^0.23.8",
51
- "typescript": "^4.7.4"
46
+ "shipjs": "^0.28.3",
47
+ "typedoc": "^0.28.19",
48
+ "typescript": "^5.0.4"
52
49
  },
53
50
  "scripts": {
54
51
  "build": "rollup -c",
package/ship.config.js CHANGED
@@ -25,17 +25,15 @@ module.exports = {
25
25
  const newChangelog = parsed.toString()
26
26
  fs.writeFileSync(changelogFile, newChangelog, 'utf8')
27
27
  },
28
- releases: [
29
- {
30
- extractChangelog: ({ version, dir }) => {
31
- const changelogFile = `${dir}/CHANGELOG.md`
32
- const changelog = fs.readFileSync(changelogFile, 'utf8')
33
- const parsed = parser(changelog)
34
- const release = parsed.findRelease(version)
35
- return `${release.toString()}\n${release.getCompareLink()}`
36
- },
37
- }
38
- ]
28
+ releases: {
29
+ extractChangelog: ({ version, dir }) => {
30
+ const changelogFile = `${dir}/CHANGELOG.md`
31
+ const changelog = fs.readFileSync(changelogFile, 'utf8')
32
+ const parsed = parser(changelog)
33
+ const release = parsed.findRelease(version)
34
+ return `${release.toString()}\n${release.getCompareLink()}`
35
+ },
36
+ }
39
37
  }
40
38
 
41
39
  class Changelog {
@@ -1,6 +1,7 @@
1
1
  import { Movie } from '../movie'
2
2
  import { Base as BaseLayer } from '../layer/index'
3
3
  import BaseObject from '../object'
4
+ import { serializeProperty } from '../util'
4
5
 
5
6
  /**
6
7
  * @deprecated All visual effects now inherit from `Visual` instead
@@ -108,6 +109,21 @@ export class Base implements BaseObject {
108
109
  getDefaultOptions (): Record<string, unknown> {
109
110
  return {}
110
111
  }
112
+
113
+ toJSON (): object {
114
+ const json: any = { type: `effect.${this.constructor.name}` }
115
+ const exclude = ['type', 'publicExcludes', 'propertyFilters', 'movie', 'ready', 'parent', 'currentTime', ...this.publicExcludes]
116
+ for (const key in this) {
117
+ if (key.startsWith('_') || exclude.indexOf(key) !== -1 || typeof (this as any)[key] === 'function') {
118
+ continue
119
+ }
120
+ json[key] = serializeProperty((this as any)[key])
121
+ }
122
+ if ((this as any).effects && (this as any).effects.length > 0) {
123
+ json.effects = (this as any).effects.map((e: any) => e.toJSON())
124
+ }
125
+ return json
126
+ }
111
127
  }
112
128
  // id for events (independent of instance, but easy to access when on prototype
113
129
  // chain)
@@ -163,8 +163,8 @@ export class Shader extends Visual {
163
163
  private _initAttribs () {
164
164
  const gl = this._gl
165
165
  this._attribLocations = {
166
+ vertexPosition: gl.getAttribLocation(this._program, 'a_VertexPosition'),
166
167
  textureCoord: gl.getAttribLocation(this._program, 'a_TextureCoord')
167
- // a_VertexPosition ?? somehow it works without it though...
168
168
  }
169
169
  }
170
170
 
package/src/layer/base.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import EtroObject from '../object'
2
- import { applyOptions } from '../util'
2
+ import { applyOptions, serializeProperty } from '../util'
3
3
  import { Movie } from '../movie'
4
4
 
5
5
  interface BaseOptions {
@@ -219,6 +219,24 @@ class Base implements EtroObject {
219
219
  duration: undefined // required
220
220
  }
221
221
  }
222
+
223
+ toJSON (): object {
224
+ const json: any = { type: `layer.${this.constructor.name}` }
225
+ const exclude = ['type', 'publicExcludes', 'propertyFilters', 'movie', 'ready', 'parent', 'currentTime', 'effects', ...this.publicExcludes]
226
+ for (const key in this) {
227
+ if (key.startsWith('_') || exclude.indexOf(key) !== -1 || typeof (this as any)[key] === 'function') {
228
+ continue
229
+ }
230
+ json[key] = serializeProperty((this as any)[key])
231
+ }
232
+ json.startTime = this.startTime
233
+ json.duration = this.duration
234
+
235
+ if ((this as any).effects && (this as any).effects.length > 0) {
236
+ json.effects = (this as any).effects.map((e: any) => e.toJSON())
237
+ }
238
+ return json
239
+ }
222
240
  }
223
241
  // id for events (independent of instance, but easy to access when on prototype
224
242
  // chain)