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.
- package/.github/dependabot.yml +6 -0
- package/.github/scripts/update-changelog.js +72 -0
- package/.github/workflows/dependabot-changelog.yml +57 -0
- package/.github/workflows/nodejs.yml +6 -2
- package/.github/workflows/shipjs-trigger.yml +2 -1
- package/.husky/pre-commit +1 -1
- package/AGENTS.md +106 -0
- package/CHANGELOG.md +46 -0
- package/CONTRIBUTING.md +5 -5
- package/README.md +8 -7
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/base.css +224 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/block-navigation.js +87 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/favicon.png +0 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/index.html +161 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/prettify.css +1 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/prettify.js +2 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/sort-arrow-sprite.png +0 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/sorter.js +196 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/custom-array.ts.html +214 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/base.ts.html +481 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/brightness.ts.html +214 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/channels.ts.html +235 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/chroma-key.ts.html +331 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/contrast.ts.html +211 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/elliptical-mask.ts.html +310 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/gaussian-blur.ts.html +796 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/grayscale.ts.html +187 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/index.html +311 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/index.ts.html +154 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/pixelate.ts.html +259 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/shader.ts.html +1774 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/stack.ts.html +358 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/transform.ts.html +685 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/effect/visual.ts.html +148 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/etro.ts.html +163 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/event.ts.html +691 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/index.html +176 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/index.ts.html +109 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/audio-source.ts.html +835 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/audio.ts.html +241 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/base.ts.html +826 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/image.ts.html +181 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/index.html +236 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/index.ts.html +124 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/text.ts.html +658 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/video.ts.html +211 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/visual-source.ts.html +721 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/layer/visual.ts.html +760 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/effects.ts.html +163 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/index.html +161 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/index.ts.html +88 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/layers.ts.html +163 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/movie/movie.ts.html +3037 -0
- package/coverage/Chrome Headless 148.0.0.0 (Mac OS 10.15.7)/html/src/util.ts.html +1765 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/base.css +224 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/block-navigation.js +87 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/favicon.png +0 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/index.html +161 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/prettify.css +1 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/prettify.js +2 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/sort-arrow-sprite.png +0 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/sorter.js +196 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/custom-array.ts.html +214 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/base.ts.html +481 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/brightness.ts.html +214 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/channels.ts.html +235 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/chroma-key.ts.html +331 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/contrast.ts.html +211 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/elliptical-mask.ts.html +310 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/gaussian-blur.ts.html +796 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/grayscale.ts.html +187 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/index.html +311 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/index.ts.html +154 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/pixelate.ts.html +259 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/shader.ts.html +1774 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/stack.ts.html +358 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/transform.ts.html +685 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/effect/visual.ts.html +148 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/etro.ts.html +163 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/event.ts.html +691 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/index.html +176 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/index.ts.html +109 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/audio-source.ts.html +835 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/audio.ts.html +241 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/base.ts.html +826 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/image.ts.html +181 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/index.html +236 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/index.ts.html +124 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/text.ts.html +658 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/video.ts.html +211 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/visual-source.ts.html +721 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/layer/visual.ts.html +760 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/effects.ts.html +163 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/index.html +161 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/index.ts.html +88 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/layers.ts.html +163 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/movie/movie.ts.html +3037 -0
- package/coverage/Firefox 151.0 (Mac OS 10.15)/html/src/util.ts.html +1765 -0
- package/dist/custom-array.d.ts +10 -10
- package/dist/effect/base.d.ts +61 -60
- package/dist/effect/brightness.d.ts +16 -16
- package/dist/effect/channels.d.ts +23 -23
- package/dist/effect/chroma-key.d.ts +23 -23
- package/dist/effect/contrast.d.ts +15 -15
- package/dist/effect/elliptical-mask.d.ts +31 -31
- package/dist/effect/gaussian-blur.d.ts +60 -60
- package/dist/effect/grayscale.d.ts +7 -7
- package/dist/effect/index.d.ts +16 -16
- package/dist/effect/pixelate.d.ts +18 -18
- package/dist/effect/shader.d.ts +109 -109
- package/dist/effect/stack.d.ts +27 -27
- package/dist/effect/transform.d.ts +73 -73
- package/dist/effect/visual.d.ts +17 -17
- package/dist/etro-cjs.js +3601 -3556
- package/dist/etro-iife.js +3602 -3557
- package/dist/etro.d.ts +7 -7
- package/dist/event.d.ts +40 -40
- package/dist/index.d.ts +6 -6
- package/dist/layer/audio-source.d.ts +28 -28
- package/dist/layer/audio.d.ts +27 -27
- package/dist/layer/base.d.ts +129 -128
- package/dist/layer/image.d.ts +20 -20
- package/dist/layer/index.d.ts +11 -11
- package/dist/layer/text.d.ts +78 -78
- package/dist/layer/video.d.ts +23 -23
- package/dist/layer/visual-source.d.ts +47 -47
- package/dist/layer/visual.d.ts +62 -62
- package/dist/movie/effects.d.ts +6 -6
- package/dist/movie/index.d.ts +1 -1
- package/dist/movie/layers.d.ts +6 -6
- package/dist/movie/movie.d.ts +280 -277
- package/dist/object.d.ts +19 -19
- package/dist/util.d.ts +128 -121
- package/karma.conf.js +70 -3
- package/package.json +14 -17
- package/ship.config.js +9 -11
- package/src/effect/base.ts +16 -0
- package/src/effect/shader.ts +1 -1
- package/src/layer/base.ts +19 -1
- package/src/movie/movie.ts +123 -8
- package/src/util.ts +116 -3
- package/tsconfig.json +3 -2
- package/.husky/commit-msg +0 -4
- package/.husky/prepare-commit-msg +0 -11
- 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
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
119
|
-
* @
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
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
|
-
"@
|
|
14
|
-
"@
|
|
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.
|
|
18
|
-
"@typescript-eslint/parser": "^5.
|
|
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
|
-
"
|
|
36
|
-
"karma": "^
|
|
32
|
+
"karma": "^6.4.4",
|
|
33
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
37
34
|
"karma-firefox-launcher": "^2.1.2",
|
|
38
|
-
"karma-jasmine": "^
|
|
35
|
+
"karma-jasmine": "^5.1.0",
|
|
39
36
|
"karma-super-dots-reporter": "^0.2.0",
|
|
40
|
-
"karma-typescript": "^5.5.
|
|
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": "^
|
|
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.
|
|
44
|
+
"rollup-plugin-typescript2": "^0.37.0",
|
|
48
45
|
"rollup-plugin-uglify-es": "^0.0.1",
|
|
49
|
-
"shipjs": "^0.
|
|
50
|
-
"typedoc": "^0.
|
|
51
|
-
"typescript": "^
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 {
|
package/src/effect/base.ts
CHANGED
|
@@ -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)
|
package/src/effect/shader.ts
CHANGED
|
@@ -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)
|