@revideo/2d 0.2.1 → 0.2.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.
- package/lib/code/CodeCursor.d.ts +74 -74
- package/lib/code/CodeCursor.js +286 -352
- package/lib/code/CodeDiffer.d.ts +16 -21
- package/lib/code/CodeDiffer.js +41 -39
- package/lib/code/CodeFragment.d.ts +8 -16
- package/lib/code/CodeFragment.js +36 -36
- package/lib/code/CodeHighlighter.d.ts +59 -59
- package/lib/code/CodeHighlighter.js +1 -1
- package/lib/code/CodeMetrics.d.ts +8 -12
- package/lib/code/CodeMetrics.js +24 -26
- package/lib/code/CodeRange.d.ts +5 -21
- package/lib/code/CodeRange.js +124 -131
- package/lib/code/CodeScope.d.ts +8 -18
- package/lib/code/CodeScope.js +61 -59
- package/lib/code/CodeSelection.d.ts +4 -9
- package/lib/code/CodeSelection.js +8 -8
- package/lib/code/CodeSignal.d.ts +47 -74
- package/lib/code/CodeSignal.js +189 -206
- package/lib/code/CodeTokenizer.d.ts +1 -1
- package/lib/code/CodeTokenizer.js +41 -41
- package/lib/code/DefaultHighlightStyle.d.ts +2 -2
- package/lib/code/DefaultHighlightStyle.js +96 -96
- package/lib/code/LezerHighlighter.d.ts +19 -21
- package/lib/code/LezerHighlighter.js +101 -101
- package/lib/code/diff.d.ts +9 -12
- package/lib/code/diff.js +205 -218
- package/lib/code/extractRange.d.ts +4 -7
- package/lib/code/extractRange.js +71 -79
- package/lib/code/index.d.ts +1 -1
- package/lib/code/index.js +1 -1
- package/lib/components/Audio.d.ts +11 -11
- package/lib/components/Audio.js +109 -115
- package/lib/components/Bezier.d.ts +18 -18
- package/lib/components/Bezier.js +75 -86
- package/lib/components/Circle.d.ts +90 -95
- package/lib/components/Circle.js +74 -85
- package/lib/components/Code.d.ts +211 -244
- package/lib/components/Code.js +269 -317
- package/lib/components/CodeBlock.d.ts +67 -109
- package/lib/components/CodeBlock.js +373 -414
- package/lib/components/CubicBezier.d.ts +36 -36
- package/lib/components/CubicBezier.js +49 -52
- package/lib/components/Curve.d.ts +198 -208
- package/lib/components/Curve.js +269 -270
- package/lib/components/Grid.d.ts +42 -47
- package/lib/components/Grid.js +56 -63
- package/lib/components/Icon.d.ts +50 -55
- package/lib/components/Icon.js +50 -58
- package/lib/components/Img.d.ts +79 -86
- package/lib/components/Img.js +181 -193
- package/lib/components/Knot.d.ts +78 -97
- package/lib/components/Knot.js +60 -81
- package/lib/components/Latex.d.ts +12 -12
- package/lib/components/Latex.js +65 -77
- package/lib/components/Layout.d.ts +413 -455
- package/lib/components/Layout.js +681 -666
- package/lib/components/Line.d.ts +49 -61
- package/lib/components/Line.js +193 -216
- package/lib/components/Media.d.ts +35 -35
- package/lib/components/Media.js +134 -135
- package/lib/components/Node.d.ts +830 -875
- package/lib/components/Node.js +1314 -1383
- package/lib/components/Path.d.ts +14 -35
- package/lib/components/Path.js +89 -100
- package/lib/components/Polygon.d.ts +55 -60
- package/lib/components/Polygon.js +66 -71
- package/lib/components/QuadBezier.d.ts +29 -29
- package/lib/components/QuadBezier.js +45 -50
- package/lib/components/Ray.d.ts +28 -28
- package/lib/components/Ray.js +64 -71
- package/lib/components/Rect.d.ts +108 -115
- package/lib/components/Rect.js +72 -78
- package/lib/components/SVG.d.ts +139 -165
- package/lib/components/SVG.js +541 -609
- package/lib/components/Shape.d.ts +35 -44
- package/lib/components/Shape.js +127 -112
- package/lib/components/Spline.d.ts +40 -46
- package/lib/components/Spline.js +175 -190
- package/lib/components/Txt.d.ts +44 -55
- package/lib/components/Txt.js +155 -156
- package/lib/components/TxtLeaf.d.ts +16 -20
- package/lib/components/TxtLeaf.js +158 -177
- package/lib/components/Video.d.ts +41 -41
- package/lib/components/Video.js +135 -138
- package/lib/components/View2D.d.ts +21 -21
- package/lib/components/View2D.js +85 -98
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/types.d.ts +9 -22
- package/lib/components/types.js +1 -1
- package/lib/curves/ArcSegment.d.ts +24 -36
- package/lib/curves/ArcSegment.js +94 -145
- package/lib/curves/CircleSegment.d.ts +16 -26
- package/lib/curves/CircleSegment.js +49 -56
- package/lib/curves/CubicBezierSegment.d.ts +13 -18
- package/lib/curves/CubicBezierSegment.js +46 -79
- package/lib/curves/CurveDrawingInfo.d.ts +9 -9
- package/lib/curves/CurveDrawingInfo.js +1 -1
- package/lib/curves/CurvePoint.d.ts +13 -13
- package/lib/curves/CurvePoint.js +1 -1
- package/lib/curves/CurveProfile.d.ts +5 -5
- package/lib/curves/CurveProfile.js +1 -1
- package/lib/curves/KnotInfo.d.ts +8 -8
- package/lib/curves/KnotInfo.js +1 -1
- package/lib/curves/LineSegment.d.ts +14 -19
- package/lib/curves/LineSegment.js +42 -42
- package/lib/curves/Polynomial.d.ts +110 -110
- package/lib/curves/Polynomial.js +239 -249
- package/lib/curves/Polynomial2D.d.ts +20 -20
- package/lib/curves/Polynomial2D.js +42 -46
- package/lib/curves/PolynomialSegment.d.ts +37 -42
- package/lib/curves/PolynomialSegment.js +81 -83
- package/lib/curves/QuadBezierSegment.d.ts +12 -12
- package/lib/curves/QuadBezierSegment.js +41 -71
- package/lib/curves/Segment.d.ts +7 -12
- package/lib/curves/Segment.js +3 -2
- package/lib/curves/UniformPolynomialCurveSampler.d.ts +34 -34
- package/lib/curves/UniformPolynomialCurveSampler.js +62 -68
- package/lib/curves/createCurveProfileLerp.d.ts +6 -17
- package/lib/curves/createCurveProfileLerp.js +208 -211
- package/lib/curves/getBezierSplineProfile.d.ts +4 -8
- package/lib/curves/getBezierSplineProfile.js +101 -145
- package/lib/curves/getCircleProfile.d.ts +4 -10
- package/lib/curves/getCircleProfile.js +40 -72
- package/lib/curves/getPathProfile.d.ts +2 -2
- package/lib/curves/getPathProfile.js +112 -135
- package/lib/curves/getPointAtDistance.d.ts +4 -7
- package/lib/curves/getPointAtDistance.js +12 -12
- package/lib/curves/getPolylineProfile.d.ts +4 -8
- package/lib/curves/getPolylineProfile.js +54 -67
- package/lib/curves/getRectProfile.d.ts +4 -9
- package/lib/curves/getRectProfile.js +52 -117
- package/lib/curves/index.d.ts +1 -1
- package/lib/curves/index.js +1 -1
- package/lib/decorators/canvasStyleSignal.d.ts +3 -3
- package/lib/decorators/canvasStyleSignal.js +10 -10
- package/lib/decorators/colorSignal.d.ts +1 -1
- package/lib/decorators/colorSignal.js +7 -7
- package/lib/decorators/compound.d.ts +2 -4
- package/lib/decorators/compound.js +23 -43
- package/lib/decorators/computed.d.ts +1 -1
- package/lib/decorators/computed.js +9 -9
- package/lib/decorators/defaultStyle.d.ts +2 -5
- package/lib/decorators/defaultStyle.js +11 -11
- package/lib/decorators/filtersSignal.d.ts +8 -28
- package/lib/decorators/filtersSignal.js +64 -87
- package/lib/decorators/index.d.ts +1 -1
- package/lib/decorators/index.js +1 -1
- package/lib/decorators/initializers.d.ts +2 -5
- package/lib/decorators/initializers.js +19 -18
- package/lib/decorators/nodeName.d.ts +1 -1
- package/lib/decorators/nodeName.js +4 -4
- package/lib/decorators/signal.d.ts +20 -40
- package/lib/decorators/signal.js +104 -113
- package/lib/decorators/spacingSignal.d.ts +1 -1
- package/lib/decorators/spacingSignal.js +13 -13
- package/lib/decorators/vector2Signal.d.ts +7 -13
- package/lib/decorators/vector2Signal.js +13 -15
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/jsx-dev-runtime.d.ts +3 -3
- package/lib/jsx-dev-runtime.js +3 -3
- package/lib/jsx-runtime.d.ts +9 -19
- package/lib/jsx-runtime.js +18 -18
- package/lib/partials/Filter.d.ts +16 -24
- package/lib/partials/Filter.js +69 -69
- package/lib/partials/Gradient.d.ts +24 -30
- package/lib/partials/Gradient.js +58 -69
- package/lib/partials/Pattern.d.ts +9 -14
- package/lib/partials/Pattern.js +24 -30
- package/lib/partials/ShaderConfig.d.ts +74 -81
- package/lib/partials/ShaderConfig.js +23 -22
- package/lib/partials/index.d.ts +1 -1
- package/lib/partials/index.js +1 -1
- package/lib/partials/types.d.ts +6 -19
- package/lib/partials/types.js +1 -1
- package/lib/scenes/Scene2D.d.ts +23 -42
- package/lib/scenes/Scene2D.js +151 -161
- package/lib/scenes/index.d.ts +1 -1
- package/lib/scenes/index.js +1 -1
- package/lib/scenes/makeScene2D.d.ts +5 -7
- package/lib/scenes/makeScene2D.js +10 -10
- package/lib/scenes/useScene2D.d.ts +2 -2
- package/lib/scenes/useScene2D.js +3 -3
- package/lib/utils/CanvasUtils.d.ts +21 -93
- package/lib/utils/CanvasUtils.js +105 -186
- package/lib/utils/diff.d.ts +18 -25
- package/lib/utils/diff.js +87 -84
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/is.d.ts +2 -4
- package/lib/utils/is.js +2 -2
- package/lib/utils/makeSignalExtensions.d.ts +4 -11
- package/lib/utils/makeSignalExtensions.js +17 -17
- package/package.json +4 -4
- package/lib/components/AudioTest.d.ts +0 -99
- package/lib/components/AudioTest.d.ts.map +0 -1
- package/lib/components/AudioTest.js +0 -281
package/lib/components/Grid.d.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
SignalValue,
|
|
4
|
-
SimpleSignal,
|
|
5
|
-
Vector2Signal,
|
|
6
|
-
} from '@revideo/core';
|
|
7
|
-
import {Shape, ShapeProps} from './Shape';
|
|
1
|
+
import { PossibleVector2, SignalValue, SimpleSignal, Vector2Signal } from '@revideo/core';
|
|
2
|
+
import { Shape, ShapeProps } from './Shape';
|
|
8
3
|
export interface GridProps extends ShapeProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
/**
|
|
5
|
+
* {@inheritDoc Grid.spacing}
|
|
6
|
+
*/
|
|
7
|
+
spacing?: SignalValue<PossibleVector2>;
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc Grid.start}
|
|
10
|
+
*/
|
|
11
|
+
start?: SignalValue<number>;
|
|
12
|
+
/**
|
|
13
|
+
* {@inheritDoc Grid.end}
|
|
14
|
+
*/
|
|
15
|
+
end?: SignalValue<number>;
|
|
21
16
|
}
|
|
22
17
|
/**
|
|
23
18
|
* A node for drawing a two-dimensional grid.
|
|
@@ -49,32 +44,32 @@ export interface GridProps extends ShapeProps {
|
|
|
49
44
|
* ```
|
|
50
45
|
*/
|
|
51
46
|
export declare class Grid extends Shape {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The spacing between the grid lines.
|
|
49
|
+
*/
|
|
50
|
+
readonly spacing: Vector2Signal<this>;
|
|
51
|
+
/**
|
|
52
|
+
* The percentage that should be clipped from the beginning of each grid line.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* The portion of each grid line that comes before the given percentage will
|
|
56
|
+
* be made invisible.
|
|
57
|
+
*
|
|
58
|
+
* This property is useful for animating the grid appearing on-screen.
|
|
59
|
+
*/
|
|
60
|
+
readonly start: SimpleSignal<number, this>;
|
|
61
|
+
/**
|
|
62
|
+
* The percentage that should be clipped from the end of each grid line.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* The portion of each grid line that comes after the given percentage will
|
|
66
|
+
* be made invisible.
|
|
67
|
+
*
|
|
68
|
+
* This property is useful for animating the grid appearing on-screen.
|
|
69
|
+
*/
|
|
70
|
+
readonly end: SimpleSignal<number, this>;
|
|
71
|
+
constructor(props: GridProps);
|
|
72
|
+
protected drawShape(context: CanvasRenderingContext2D): void;
|
|
73
|
+
private mapPoints;
|
|
79
74
|
}
|
|
80
|
-
//# sourceMappingURL=Grid.d.ts.map
|
|
75
|
+
//# sourceMappingURL=Grid.d.ts.map
|
package/lib/components/Grid.js
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
r =
|
|
6
|
-
c < 3
|
|
7
|
-
? target
|
|
8
|
-
: desc === null
|
|
9
|
-
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
|
10
|
-
: desc,
|
|
11
|
-
d;
|
|
12
|
-
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
13
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else
|
|
15
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
16
|
-
if ((d = decorators[i]))
|
|
17
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
|
|
20
|
-
import {map} from '@revideo/core';
|
|
21
|
-
import {initial, nodeName, signal, vector2Signal} from '../decorators';
|
|
22
|
-
import {Shape} from './Shape';
|
|
6
|
+
};
|
|
7
|
+
import { map, } from '@revideo/core';
|
|
8
|
+
import { initial, nodeName, signal, vector2Signal } from '../decorators';
|
|
9
|
+
import { Shape } from './Shape';
|
|
23
10
|
/**
|
|
24
11
|
* A node for drawing a two-dimensional grid.
|
|
25
12
|
*
|
|
@@ -50,49 +37,55 @@ import {Shape} from './Shape';
|
|
|
50
37
|
* ```
|
|
51
38
|
*/
|
|
52
39
|
let Grid = class Grid extends Shape {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
drawShape(context) {
|
|
57
|
-
context.save();
|
|
58
|
-
this.applyStyle(context);
|
|
59
|
-
this.drawRipple(context);
|
|
60
|
-
const spacing = this.spacing();
|
|
61
|
-
const size = this.computedSize().scale(0.5);
|
|
62
|
-
const steps = size.div(spacing).floored;
|
|
63
|
-
for (let x = -steps.x; x <= steps.x; x++) {
|
|
64
|
-
const [from, to] = this.mapPoints(-size.height, size.height);
|
|
65
|
-
context.beginPath();
|
|
66
|
-
context.moveTo(spacing.x * x, from);
|
|
67
|
-
context.lineTo(spacing.x * x, to);
|
|
68
|
-
context.stroke();
|
|
40
|
+
constructor(props) {
|
|
41
|
+
super(props);
|
|
69
42
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
drawShape(context) {
|
|
44
|
+
context.save();
|
|
45
|
+
this.applyStyle(context);
|
|
46
|
+
this.drawRipple(context);
|
|
47
|
+
const spacing = this.spacing();
|
|
48
|
+
const size = this.computedSize().scale(0.5);
|
|
49
|
+
const steps = size.div(spacing).floored;
|
|
50
|
+
for (let x = -steps.x; x <= steps.x; x++) {
|
|
51
|
+
const [from, to] = this.mapPoints(-size.height, size.height);
|
|
52
|
+
context.beginPath();
|
|
53
|
+
context.moveTo(spacing.x * x, from);
|
|
54
|
+
context.lineTo(spacing.x * x, to);
|
|
55
|
+
context.stroke();
|
|
56
|
+
}
|
|
57
|
+
for (let y = -steps.y; y <= steps.y; y++) {
|
|
58
|
+
const [from, to] = this.mapPoints(-size.width, size.width);
|
|
59
|
+
context.beginPath();
|
|
60
|
+
context.moveTo(from, spacing.y * y);
|
|
61
|
+
context.lineTo(to, spacing.y * y);
|
|
62
|
+
context.stroke();
|
|
63
|
+
}
|
|
64
|
+
context.restore();
|
|
76
65
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
mapPoints(start, end) {
|
|
67
|
+
let from = map(start, end, this.start());
|
|
68
|
+
let to = map(start, end, this.end());
|
|
69
|
+
if (to < from) {
|
|
70
|
+
[from, to] = [to, from];
|
|
71
|
+
}
|
|
72
|
+
return [from, to];
|
|
84
73
|
}
|
|
85
|
-
return [from, to];
|
|
86
|
-
}
|
|
87
74
|
};
|
|
88
|
-
__decorate(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
75
|
+
__decorate([
|
|
76
|
+
initial(80),
|
|
77
|
+
vector2Signal('spacing')
|
|
78
|
+
], Grid.prototype, "spacing", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
initial(0),
|
|
81
|
+
signal()
|
|
82
|
+
], Grid.prototype, "start", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
initial(1),
|
|
85
|
+
signal()
|
|
86
|
+
], Grid.prototype, "end", void 0);
|
|
87
|
+
Grid = __decorate([
|
|
88
|
+
nodeName('Grid')
|
|
89
|
+
], Grid);
|
|
90
|
+
export { Grid };
|
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3JpZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY29tcG9uZW50cy9HcmlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLE9BQU8sRUFLTCxHQU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FLEdBQUcsRUFBRSxJQUFJLENBQUMsS0FBSyxFQUFFLENBQUMsQ0FBQztRQUN6QyxJQUFJLEVBQUUsR0FBRyxHQUFHLENBQUMsS0FBSyxFQUFFLEdBQUcsRUFBRSxJQUFJLENBQUMsR0FBRyxFQUFFLENBQUMsQ0FBQztRQUVyQyxJQUFJLEVBQUUsR0FBRyxJQUFJLEVBQUUsQ0FBQztZQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxHQUFHLENBQUMsRUFBRSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzFCLENBQUM7UUFFRCxPQUFPLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxDQUFDO0lBQ3BCLENBQUM7Q0FDRixDQUFBO0FBeEV5QjtJQUZ2QixPQUFPLENBQUMsRUFBRSxDQUFDO0lBQ1gsYUFBYSxDQUFDLFNBQVMsQ0FBQztxQ0FDNEI7QUFhN0I7SUFGdkIsT0FBTyxDQUFDLENBQUMsQ0FBQztJQUNWLE1BQU0sRUFBRTttQ0FDaUQ7QUFhbEM7SUFGdkIsT0FBTyxDQUFDLENBQUMsQ0FBQztJQUNWLE1BQU0sRUFBRTtpQ0FDK0M7QUFoQzdDLElBQUk7SUFEaEIsUUFBUSxDQUFDLE1BQU0sQ0FBQztHQUNKLElBQUksQ0E4RWhCIn0=
|
package/lib/components/Icon.d.ts
CHANGED
|
@@ -1,63 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
PossibleColor,
|
|
4
|
-
SignalValue,
|
|
5
|
-
SimpleSignal,
|
|
6
|
-
} from '@revideo/core';
|
|
7
|
-
import {Img, ImgProps} from './Img';
|
|
1
|
+
import { ColorSignal, PossibleColor, SignalValue, SimpleSignal } from '@revideo/core';
|
|
2
|
+
import { Img, ImgProps } from './Img';
|
|
8
3
|
export interface IconProps extends ImgProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
/**
|
|
5
|
+
* {@inheritDoc Icon.icon}
|
|
6
|
+
*/
|
|
7
|
+
icon: SignalValue<string>;
|
|
8
|
+
/**
|
|
9
|
+
* {@inheritDoc Icon.color}
|
|
10
|
+
*/
|
|
11
|
+
color?: SignalValue<PossibleColor>;
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
19
14
|
* An Icon Component that provides easy access to over 150k icons.
|
|
20
15
|
* See https://icones.js.org/collection/all for all available Icons.
|
|
21
16
|
*/
|
|
22
17
|
export declare class Icon extends Img {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The identifier of the icon.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* You can find identifiers on [Icônes](https://icones.js.org).
|
|
23
|
+
* They can look like this:
|
|
24
|
+
* * `mdi:language-typescript`
|
|
25
|
+
* * `ph:anchor-simple-bold`
|
|
26
|
+
* * `ph:activity-bold`
|
|
27
|
+
*/
|
|
28
|
+
icon: SimpleSignal<string, this>;
|
|
29
|
+
/**
|
|
30
|
+
* The color of the icon
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Provide the color in one of the following formats:
|
|
34
|
+
* * named color like `red`, `darkgray`, …
|
|
35
|
+
* * hexadecimal string with # like `#bada55`, `#141414`
|
|
36
|
+
* Value can be either RGB or RGBA: `#bada55`, `#bada55aa` (latter is partially transparent)
|
|
37
|
+
* The shorthand version (e.g. `#abc` for `#aabbcc` is also possible.)
|
|
38
|
+
*
|
|
39
|
+
* @defaultValue 'white'
|
|
40
|
+
*/
|
|
41
|
+
color: ColorSignal<this>;
|
|
42
|
+
constructor(props: IconProps);
|
|
43
|
+
/**
|
|
44
|
+
* Create the URL that will be used as the Image source
|
|
45
|
+
* @returns Address to Iconify API for the requested Icon.
|
|
46
|
+
*/
|
|
47
|
+
protected svgUrl(): string;
|
|
48
|
+
/**
|
|
49
|
+
* overrides `Image.src` getter
|
|
50
|
+
*/
|
|
51
|
+
protected getSrc(): string;
|
|
52
|
+
/**
|
|
53
|
+
* overrides `Image.src` setter to warn the user that the value
|
|
54
|
+
* is not used
|
|
55
|
+
*/
|
|
56
|
+
protected setSrc(src: string | null): void;
|
|
62
57
|
}
|
|
63
|
-
//# sourceMappingURL=Icon.d.ts.map
|
|
58
|
+
//# sourceMappingURL=Icon.d.ts.map
|
package/lib/components/Icon.js
CHANGED
|
@@ -1,66 +1,58 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
r =
|
|
6
|
-
c < 3
|
|
7
|
-
? target
|
|
8
|
-
: desc === null
|
|
9
|
-
? (desc = Object.getOwnPropertyDescriptor(target, key))
|
|
10
|
-
: desc,
|
|
11
|
-
d;
|
|
12
|
-
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
13
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
14
|
-
else
|
|
15
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
16
|
-
if ((d = decorators[i]))
|
|
17
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
-
|
|
20
|
-
import {useLogger} from '@revideo/core';
|
|
21
|
-
import {colorSignal, computed, initial, signal} from '../decorators';
|
|
22
|
-
import {Img} from './Img';
|
|
6
|
+
};
|
|
7
|
+
import { useLogger, } from '@revideo/core';
|
|
8
|
+
import { colorSignal, computed, initial, signal } from '../decorators';
|
|
9
|
+
import { Img } from './Img';
|
|
23
10
|
/**
|
|
24
11
|
* An Icon Component that provides easy access to over 150k icons.
|
|
25
12
|
* See https://icones.js.org/collection/all for all available Icons.
|
|
26
13
|
*/
|
|
27
14
|
export class Icon extends Img {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super({
|
|
17
|
+
...props,
|
|
18
|
+
src: null,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create the URL that will be used as the Image source
|
|
23
|
+
* @returns Address to Iconify API for the requested Icon.
|
|
24
|
+
*/
|
|
25
|
+
svgUrl() {
|
|
26
|
+
const iconPathSegment = this.icon().replace(':', '/');
|
|
27
|
+
const encodedColorValue = encodeURIComponent(this.color().hex());
|
|
28
|
+
// Iconify API is documented here: https://docs.iconify.design/api/svg.html#color
|
|
29
|
+
return `https://api.iconify.design/${iconPathSegment}.svg?color=${encodedColorValue}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* overrides `Image.src` getter
|
|
33
|
+
*/
|
|
34
|
+
getSrc() {
|
|
35
|
+
return this.svgUrl();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* overrides `Image.src` setter to warn the user that the value
|
|
39
|
+
* is not used
|
|
40
|
+
*/
|
|
41
|
+
setSrc(src) {
|
|
42
|
+
if (src === null) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
useLogger().warn("The Icon Component does not accept setting the `src`. If you need access to `src`, use '<Img/>` instead.");
|
|
57
46
|
}
|
|
58
|
-
useLogger().warn(
|
|
59
|
-
"The Icon Component does not accept setting the `src`. If you need access to `src`, use '<Img/>` instead.",
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
47
|
}
|
|
63
|
-
__decorate([
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
__decorate([
|
|
49
|
+
signal()
|
|
50
|
+
], Icon.prototype, "icon", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
initial('white'),
|
|
53
|
+
colorSignal()
|
|
54
|
+
], Icon.prototype, "color", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
computed()
|
|
57
|
+
], Icon.prototype, "svgUrl", null);
|
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSWNvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY29tcG9uZW50cy9JY29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLE9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M7QUFnQmpDO0lBRmQsT0FBTyxDQUFDLE9BQU8sQ0FBQztJQUNoQixXQUFXLEVBQUU7bUNBQzBCO0FBYzlCO0lBRFQsUUFBUSxFQUFFO2tDQU1WIn0=
|
package/lib/components/Img.d.ts
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
SerializedVector2,
|
|
5
|
-
SignalValue,
|
|
6
|
-
SimpleSignal,
|
|
7
|
-
Vector2,
|
|
8
|
-
} from '@revideo/core';
|
|
9
|
-
import {DesiredLength} from '../partials';
|
|
10
|
-
import {Rect, RectProps} from './Rect';
|
|
1
|
+
import { Color, PossibleVector2, SerializedVector2, SignalValue, SimpleSignal, Vector2 } from '@revideo/core';
|
|
2
|
+
import { DesiredLength } from '../partials';
|
|
3
|
+
import { Rect, RectProps } from './Rect';
|
|
11
4
|
export interface ImgProps extends RectProps {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc Img.src}
|
|
7
|
+
*/
|
|
8
|
+
src?: SignalValue<string | null>;
|
|
9
|
+
/**
|
|
10
|
+
* {@inheritDoc Img.alpha}
|
|
11
|
+
*/
|
|
12
|
+
alpha?: SignalValue<number>;
|
|
13
|
+
/**
|
|
14
|
+
* {@inheritDoc Img.smoothing}
|
|
15
|
+
*/
|
|
16
|
+
smoothing?: SignalValue<boolean>;
|
|
24
17
|
}
|
|
25
18
|
/**
|
|
26
19
|
* A node for displaying images.
|
|
@@ -56,68 +49,68 @@ export interface ImgProps extends RectProps {
|
|
|
56
49
|
* ```
|
|
57
50
|
*/
|
|
58
51
|
export declare class Img extends Rect {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
52
|
+
private static pool;
|
|
53
|
+
/**
|
|
54
|
+
* The source of this image.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* Using a local image:
|
|
58
|
+
* ```tsx
|
|
59
|
+
* import image from './example.png';
|
|
60
|
+
* // ...
|
|
61
|
+
* view.add(<Img src={image} />)
|
|
62
|
+
* ```
|
|
63
|
+
* Loading an image from the internet:
|
|
64
|
+
* ```tsx
|
|
65
|
+
* view.add(<Img src="https://example.com/image.png" />)
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
readonly src: SimpleSignal<string, this>;
|
|
69
|
+
/**
|
|
70
|
+
* The alpha value of this image.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Unlike opacity, the alpha value affects only the image itself, leaving the
|
|
74
|
+
* fill, stroke, and children intact.
|
|
75
|
+
*/
|
|
76
|
+
readonly alpha: SimpleSignal<number, this>;
|
|
77
|
+
/**
|
|
78
|
+
* Whether the image should be smoothed.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* When disabled, the image will be scaled using the nearest neighbor
|
|
82
|
+
* interpolation with no smoothing. The resulting image will appear pixelated.
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue true
|
|
85
|
+
*/
|
|
86
|
+
readonly smoothing: SimpleSignal<boolean, this>;
|
|
87
|
+
constructor(props: ImgProps);
|
|
88
|
+
protected desiredSize(): SerializedVector2<DesiredLength>;
|
|
89
|
+
protected image(): HTMLImageElement;
|
|
90
|
+
protected imageCanvas(): CanvasRenderingContext2D;
|
|
91
|
+
protected filledImageCanvas(): CanvasRenderingContext2D;
|
|
92
|
+
protected draw(context: CanvasRenderingContext2D): void;
|
|
93
|
+
protected applyFlex(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get color of the image at the given position.
|
|
96
|
+
*
|
|
97
|
+
* @param position - The position in local space at which to sample the color.
|
|
98
|
+
*/
|
|
99
|
+
getColorAtPoint(position: PossibleVector2): Color;
|
|
100
|
+
/**
|
|
101
|
+
* The natural size of this image.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* The natural size is the size of the source image unaffected by the size
|
|
105
|
+
* and scale properties.
|
|
106
|
+
*/
|
|
107
|
+
naturalSize(): Vector2;
|
|
108
|
+
/**
|
|
109
|
+
* Get color of the image at the given pixel.
|
|
110
|
+
*
|
|
111
|
+
* @param position - The pixel's position.
|
|
112
|
+
*/
|
|
113
|
+
getPixelColor(position: PossibleVector2): Color;
|
|
114
|
+
protected collectAsyncResources(): void;
|
|
122
115
|
}
|
|
123
|
-
//# sourceMappingURL=Img.d.ts.map
|
|
116
|
+
//# sourceMappingURL=Img.d.ts.map
|