@revideo/2d 0.10.1 → 0.10.3
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/editor/editor/NodeInspectorConfig.d.ts +1 -1
- package/editor/editor/NodeInspectorConfig.d.ts.map +1 -1
- package/editor/editor/PreviewOverlayConfig.d.ts +1 -1
- package/editor/editor/PreviewOverlayConfig.d.ts.map +1 -1
- package/editor/editor/Provider.d.ts +3 -3
- package/editor/editor/Provider.d.ts.map +1 -1
- package/editor/editor/SceneGraphTabConfig.d.ts +1 -1
- package/editor/editor/SceneGraphTabConfig.d.ts.map +1 -1
- package/editor/editor/icons/IconMap.d.ts +1 -1
- package/editor/editor/icons/IconMap.d.ts.map +1 -1
- package/editor/editor/tree/NodeElement.d.ts +1 -1
- package/editor/editor/tree/NodeElement.d.ts.map +1 -1
- package/editor/editor/tree/TreeElement.d.ts +3 -3
- package/editor/editor/tree/TreeElement.d.ts.map +1 -1
- package/editor/editor/tree/TreeRoot.d.ts +1 -1
- package/editor/editor/tree/TreeRoot.d.ts.map +1 -1
- package/editor/editor/tsconfig.build.tsbuildinfo +1 -1
- package/editor/index.js +3 -2
- package/editor/index.js.map +1 -1
- package/lib/code/CodeCursor.d.ts +2 -2
- package/lib/code/CodeCursor.d.ts.map +1 -1
- package/lib/code/CodeCursor.js +2 -2
- package/lib/code/CodeDiffer.d.ts +2 -2
- package/lib/code/CodeDiffer.d.ts.map +1 -1
- package/lib/code/CodeDiffer.js +1 -1
- package/lib/code/CodeFragment.d.ts +1 -1
- package/lib/code/CodeFragment.d.ts.map +1 -1
- package/lib/code/CodeFragment.js +1 -1
- package/lib/code/CodeScope.d.ts +2 -2
- package/lib/code/CodeScope.d.ts.map +1 -1
- package/lib/code/CodeScope.js +1 -1
- package/lib/code/CodeSelection.d.ts +1 -1
- package/lib/code/CodeSelection.d.ts.map +1 -1
- package/lib/code/CodeSelection.js +2 -2
- package/lib/code/CodeSignal.d.ts +5 -4
- package/lib/code/CodeSignal.d.ts.map +1 -1
- package/lib/code/CodeSignal.js +2 -6
- package/lib/code/LezerHighlighter.d.ts +3 -3
- package/lib/code/LezerHighlighter.d.ts.map +1 -1
- package/lib/code/extractRange.d.ts +2 -2
- package/lib/code/extractRange.d.ts.map +1 -1
- package/lib/code/extractRange.js +1 -1
- package/lib/components/Audio.d.ts +2 -1
- package/lib/components/Audio.d.ts.map +1 -1
- package/lib/components/Audio.js +1 -1
- package/lib/components/Bezier.d.ts +5 -4
- package/lib/components/Bezier.d.ts.map +1 -1
- package/lib/components/Bezier.js +4 -3
- package/lib/components/Circle.d.ts +6 -4
- package/lib/components/Circle.d.ts.map +1 -1
- package/lib/components/Circle.js +2 -2
- package/lib/components/Code.d.ts +6 -4
- package/lib/components/Code.d.ts.map +1 -1
- package/lib/components/Code.js +1 -1
- package/lib/components/CodeBlock.d.ts +6 -4
- package/lib/components/CodeBlock.d.ts.map +1 -1
- package/lib/components/CodeBlock.js +2 -2
- package/lib/components/CubicBezier.d.ts +5 -4
- package/lib/components/CubicBezier.d.ts.map +1 -1
- package/lib/components/CubicBezier.js +1 -1
- package/lib/components/Curve.d.ts +8 -6
- package/lib/components/Curve.d.ts.map +1 -1
- package/lib/components/Curve.js +2 -2
- package/lib/components/Grid.d.ts +3 -2
- package/lib/components/Grid.d.ts.map +1 -1
- package/lib/components/Grid.js +2 -2
- package/lib/components/Icon.d.ts +3 -2
- package/lib/components/Icon.d.ts.map +1 -1
- package/lib/components/Icon.js +2 -2
- package/lib/components/Img.d.ts +5 -3
- package/lib/components/Img.d.ts.map +1 -1
- package/lib/components/Img.js +1 -1
- package/lib/components/Knot.d.ts +4 -3
- package/lib/components/Knot.d.ts.map +1 -1
- package/lib/components/Knot.js +4 -4
- package/lib/components/Latex.d.ts +4 -3
- package/lib/components/Latex.d.ts.map +1 -1
- package/lib/components/Latex.js +2 -2
- package/lib/components/Layout.d.ts +6 -4
- package/lib/components/Layout.d.ts.map +1 -1
- package/lib/components/Layout.js +11 -10
- package/lib/components/Line.d.ts +5 -3
- package/lib/components/Line.d.ts.map +1 -1
- package/lib/components/Line.js +6 -4
- package/lib/components/Media.d.ts +3 -2
- package/lib/components/Media.d.ts.map +1 -1
- package/lib/components/Media.js +1 -1
- package/lib/components/Node.d.ts +7 -6
- package/lib/components/Node.d.ts.map +1 -1
- package/lib/components/Node.js +10 -10
- package/lib/components/Path.d.ts +5 -3
- package/lib/components/Path.d.ts.map +1 -1
- package/lib/components/Path.js +4 -3
- package/lib/components/Polygon.d.ts +6 -4
- package/lib/components/Polygon.d.ts.map +1 -1
- package/lib/components/Polygon.js +2 -2
- package/lib/components/QuadBezier.d.ts +5 -4
- package/lib/components/QuadBezier.d.ts.map +1 -1
- package/lib/components/QuadBezier.js +1 -1
- package/lib/components/Ray.d.ts +5 -3
- package/lib/components/Ray.d.ts.map +1 -1
- package/lib/components/Ray.js +6 -5
- package/lib/components/Rect.d.ts +5 -3
- package/lib/components/Rect.d.ts.map +1 -1
- package/lib/components/Rect.js +2 -2
- package/lib/components/Rive.d.ts +3 -2
- package/lib/components/Rive.d.ts.map +1 -1
- package/lib/components/Rive.js +1 -1
- package/lib/components/SVG.d.ts +7 -4
- package/lib/components/SVG.d.ts.map +1 -1
- package/lib/components/SVG.js +1 -1
- package/lib/components/Shape.d.ts +5 -4
- package/lib/components/Shape.d.ts.map +1 -1
- package/lib/components/Shape.js +2 -2
- package/lib/components/Spline.d.ts +6 -4
- package/lib/components/Spline.d.ts.map +1 -1
- package/lib/components/Spline.js +5 -4
- package/lib/components/Txt.d.ts +7 -5
- package/lib/components/Txt.d.ts.map +1 -1
- package/lib/components/Txt.js +6 -3
- package/lib/components/TxtLeaf.d.ts +6 -4
- package/lib/components/TxtLeaf.d.ts.map +1 -1
- package/lib/components/TxtLeaf.js +19 -4
- package/lib/components/Video.d.ts +4 -3
- package/lib/components/Video.d.ts.map +1 -1
- package/lib/components/Video.js +4 -3
- package/lib/components/View2D.d.ts +4 -2
- package/lib/components/View2D.d.ts.map +1 -1
- package/lib/components/View2D.js +1 -1
- package/lib/curves/ArcSegment.d.ts +1 -1
- package/lib/curves/ArcSegment.d.ts.map +1 -1
- package/lib/curves/ArcSegment.js +10 -14
- package/lib/curves/CircleSegment.d.ts +1 -1
- package/lib/curves/CircleSegment.d.ts.map +1 -1
- package/lib/curves/CurveDrawingInfo.d.ts +1 -1
- package/lib/curves/CurveDrawingInfo.d.ts.map +1 -1
- package/lib/curves/CurveProfile.d.ts +1 -1
- package/lib/curves/CurveProfile.d.ts.map +1 -1
- package/lib/curves/KnotInfo.d.ts +1 -1
- package/lib/curves/KnotInfo.d.ts.map +1 -1
- package/lib/curves/LineSegment.d.ts +2 -2
- package/lib/curves/LineSegment.d.ts.map +1 -1
- package/lib/curves/PolynomialSegment.d.ts +3 -3
- package/lib/curves/PolynomialSegment.d.ts.map +1 -1
- package/lib/curves/PolynomialSegment.js +3 -2
- package/lib/curves/Segment.d.ts +2 -2
- package/lib/curves/Segment.d.ts.map +1 -1
- package/lib/curves/UniformPolynomialCurveSampler.d.ts +2 -2
- package/lib/curves/UniformPolynomialCurveSampler.d.ts.map +1 -1
- package/lib/curves/UniformPolynomialCurveSampler.js +1 -1
- package/lib/curves/createCurveProfileLerp.d.ts +1 -1
- package/lib/curves/createCurveProfileLerp.d.ts.map +1 -1
- package/lib/curves/getBezierSplineProfile.d.ts +2 -2
- package/lib/curves/getBezierSplineProfile.d.ts.map +1 -1
- package/lib/curves/getCircleProfile.d.ts +1 -1
- package/lib/curves/getCircleProfile.d.ts.map +1 -1
- package/lib/curves/getPathProfile.d.ts +1 -1
- package/lib/curves/getPathProfile.d.ts.map +1 -1
- package/lib/curves/getPathProfile.js +1 -1
- package/lib/curves/getPointAtDistance.d.ts +2 -2
- package/lib/curves/getPointAtDistance.d.ts.map +1 -1
- package/lib/curves/getPolylineProfile.d.ts +2 -2
- package/lib/curves/getPolylineProfile.d.ts.map +1 -1
- package/lib/curves/getPolylineProfile.js +1 -1
- package/lib/curves/getRectProfile.d.ts +2 -2
- package/lib/curves/getRectProfile.d.ts.map +1 -1
- package/lib/curves/getRectProfile.js +1 -1
- package/lib/decorators/canvasStyleSignal.d.ts +1 -1
- package/lib/decorators/canvasStyleSignal.d.ts.map +1 -1
- package/lib/decorators/canvasStyleSignal.js +1 -1
- package/lib/decorators/filtersSignal.d.ts +4 -2
- package/lib/decorators/filtersSignal.d.ts.map +1 -1
- package/lib/decorators/filtersSignal.js +1 -1
- package/lib/decorators/signal.d.ts +1 -1
- package/lib/decorators/signal.d.ts.map +1 -1
- package/lib/decorators/signal.js +2 -2
- package/lib/decorators/vector2Signal.d.ts +2 -1
- package/lib/decorators/vector2Signal.d.ts.map +1 -1
- package/lib/decorators/vector2Signal.js +1 -1
- package/lib/jsx-runtime.d.ts +1 -1
- package/lib/jsx-runtime.d.ts.map +1 -1
- package/lib/jsx-runtime.js +2 -2
- package/lib/partials/Filter.d.ts +1 -1
- package/lib/partials/Filter.d.ts.map +1 -1
- package/lib/partials/Filter.js +2 -2
- package/lib/partials/Gradient.d.ts +1 -1
- package/lib/partials/Gradient.d.ts.map +1 -1
- package/lib/partials/Gradient.js +2 -2
- package/lib/partials/Pattern.d.ts +1 -1
- package/lib/partials/Pattern.d.ts.map +1 -1
- package/lib/partials/ShaderConfig.d.ts +2 -2
- package/lib/partials/ShaderConfig.d.ts.map +1 -1
- package/lib/partials/ShaderConfig.js +2 -2
- package/lib/partials/types.d.ts +1 -1
- package/lib/partials/types.d.ts.map +1 -1
- package/lib/scenes/Scene2D.d.ts +4 -2
- package/lib/scenes/Scene2D.d.ts.map +1 -1
- package/lib/scenes/Scene2D.js +3 -3
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/CanvasUtils.d.ts +5 -3
- package/lib/utils/CanvasUtils.d.ts.map +1 -1
- package/lib/utils/CanvasUtils.js +1 -1
- package/lib/utils/makeSignalExtensions.d.ts +2 -2
- package/lib/utils/makeSignalExtensions.d.ts.map +1 -1
- package/lib/utils/makeSignalExtensions.js +1 -1
- package/lib/utils/video/parser/parser.d.ts.map +1 -1
- package/lib/utils/video/parser/parser.js +1 -1
- package/lib/utils/video/parser/sampler.d.ts +1 -1
- package/lib/utils/video/parser/sampler.d.ts.map +1 -1
- package/lib/utils/video/parser/segment.d.ts +1 -1
- package/lib/utils/video/parser/segment.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/editor/NodeInspectorConfig.tsx +1 -1
- package/src/editor/PreviewOverlayConfig.tsx +6 -5
- package/src/editor/Provider.tsx +5 -9
- package/src/editor/SceneGraphTabConfig.tsx +1 -2
- package/src/editor/icons/IconMap.ts +1 -1
- package/src/editor/tree/NodeElement.tsx +2 -1
- package/src/editor/tree/TreeElement.tsx +3 -3
- package/src/editor/tree/TreeRoot.tsx +1 -1
- package/src/lib/code/CodeCursor.ts +10 -14
- package/src/lib/code/CodeDiffer.ts +3 -2
- package/src/lib/code/CodeFragment.ts +2 -1
- package/src/lib/code/CodeScope.ts +3 -2
- package/src/lib/code/CodeSelection.ts +2 -6
- package/src/lib/code/CodeSignal.ts +10 -18
- package/src/lib/code/LezerHighlighter.ts +3 -3
- package/src/lib/code/extractRange.ts +3 -2
- package/src/lib/components/Audio.ts +2 -1
- package/src/lib/components/Bezier.ts +7 -5
- package/src/lib/components/Circle.ts +7 -10
- package/src/lib/components/Code.ts +17 -12
- package/src/lib/components/CodeBlock.ts +8 -13
- package/src/lib/components/CubicBezier.ts +5 -4
- package/src/lib/components/Curve.ts +8 -8
- package/src/lib/components/Grid.ts +4 -3
- package/src/lib/components/Icon.ts +4 -3
- package/src/lib/components/Img.ts +9 -6
- package/src/lib/components/Knot.ts +7 -6
- package/src/lib/components/Latex.ts +5 -8
- package/src/lib/components/Layout.ts +28 -18
- package/src/lib/components/Line.ts +16 -9
- package/src/lib/components/Media.ts +3 -3
- package/src/lib/components/Node.ts +23 -15
- package/src/lib/components/Path.ts +12 -7
- package/src/lib/components/Polygon.ts +7 -10
- package/src/lib/components/QuadBezier.ts +5 -4
- package/src/lib/components/Ray.ts +10 -6
- package/src/lib/components/Rect.ts +5 -4
- package/src/lib/components/Rive.ts +6 -3
- package/src/lib/components/SVG.ts +20 -11
- package/src/lib/components/Shape.ts +6 -9
- package/src/lib/components/Spline.ts +14 -13
- package/src/lib/components/Txt.ts +9 -9
- package/src/lib/components/TxtLeaf.ts +24 -11
- package/src/lib/components/Video.ts +7 -11
- package/src/lib/components/View2D.ts +4 -2
- package/src/lib/components/__tests__/generatorTest.ts +3 -2
- package/src/lib/components/__tests__/mockScene2D.ts +2 -3
- package/src/lib/curves/ArcSegment.ts +25 -15
- package/src/lib/curves/CircleSegment.ts +1 -1
- package/src/lib/curves/CurveDrawingInfo.ts +1 -1
- package/src/lib/curves/CurveProfile.ts +1 -1
- package/src/lib/curves/KnotInfo.ts +1 -1
- package/src/lib/curves/LineSegment.ts +2 -2
- package/src/lib/curves/PolynomialSegment.ts +4 -4
- package/src/lib/curves/Segment.ts +2 -2
- package/src/lib/curves/UniformPolynomialCurveSampler.ts +4 -3
- package/src/lib/curves/createCurveProfileLerp.ts +1 -1
- package/src/lib/curves/getBezierSplineProfile.ts +3 -3
- package/src/lib/curves/getCircleProfile.ts +2 -2
- package/src/lib/curves/getPathProfile.ts +4 -3
- package/src/lib/curves/getPointAtDistance.ts +2 -2
- package/src/lib/curves/getPolylineProfile.ts +3 -2
- package/src/lib/curves/getRectProfile.ts +4 -3
- package/src/lib/decorators/canvasStyleSignal.ts +2 -1
- package/src/lib/decorators/defaultStyle.ts +1 -1
- package/src/lib/decorators/filtersSignal.ts +6 -3
- package/src/lib/decorators/signal.test.ts +2 -1
- package/src/lib/decorators/signal.ts +2 -5
- package/src/lib/decorators/vector2Signal.ts +2 -1
- package/src/lib/jsx-runtime.ts +2 -1
- package/src/lib/partials/Filter.ts +2 -7
- package/src/lib/partials/Gradient.ts +2 -3
- package/src/lib/partials/Pattern.ts +1 -1
- package/src/lib/partials/ShaderConfig.ts +3 -8
- package/src/lib/partials/types.ts +1 -1
- package/src/lib/scenes/Scene2D.ts +10 -5
- package/src/lib/utils/CanvasUtils.ts +4 -2
- package/src/lib/utils/makeSignalExtensions.ts +3 -2
- package/src/lib/utils/video/parser/parser.ts +2 -1
- package/src/lib/utils/video/parser/sampler.ts +1 -1
- package/src/lib/utils/video/parser/segment.ts +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import type {BBox, SignalValue, SimpleSignal} from '@revideo/core';
|
|
1
2
|
import {
|
|
2
|
-
BBox,
|
|
3
|
-
SignalValue,
|
|
4
|
-
SimpleSignal,
|
|
5
3
|
createSignal,
|
|
6
4
|
easeOutExpo,
|
|
7
5
|
linear,
|
|
@@ -9,13 +7,12 @@ import {
|
|
|
9
7
|
threadable,
|
|
10
8
|
} from '@revideo/core';
|
|
11
9
|
import {computed, initial, nodeName, signal} from '../decorators';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from '../decorators/canvasStyleSignal';
|
|
16
|
-
import {PossibleCanvasStyle} from '../partials';
|
|
10
|
+
import type {CanvasStyleSignal} from '../decorators/canvasStyleSignal';
|
|
11
|
+
import {canvasStyleSignal} from '../decorators/canvasStyleSignal';
|
|
12
|
+
import type {PossibleCanvasStyle} from '../partials';
|
|
17
13
|
import {resolveCanvasStyle} from '../utils';
|
|
18
|
-
import {
|
|
14
|
+
import type {LayoutProps} from './Layout';
|
|
15
|
+
import {Layout} from './Layout';
|
|
19
16
|
|
|
20
17
|
export interface ShapeProps extends LayoutProps {
|
|
21
18
|
fill?: SignalValue<PossibleCanvasStyle>;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BBox,
|
|
1
|
+
import type {
|
|
3
2
|
PossibleVector2,
|
|
4
3
|
SerializedVector2,
|
|
5
4
|
SignalValue,
|
|
6
5
|
SimpleSignal,
|
|
6
|
+
} from '@revideo/core';
|
|
7
|
+
import {
|
|
8
|
+
BBox,
|
|
7
9
|
Vector2,
|
|
10
|
+
transformVectorAsPoint,
|
|
8
11
|
unwrap,
|
|
9
12
|
useLogger,
|
|
10
13
|
} from '@revideo/core';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
KnotInfo,
|
|
15
|
-
getBezierSplineProfile,
|
|
16
|
-
} from '../curves';
|
|
17
|
-
import {PolynomialSegment} from '../curves/PolynomialSegment';
|
|
14
|
+
import type {CurveProfile, KnotInfo} from '../curves';
|
|
15
|
+
import {CubicBezierSegment, getBezierSplineProfile} from '../curves';
|
|
16
|
+
import type {PolynomialSegment} from '../curves/PolynomialSegment';
|
|
18
17
|
import {computed, initial, signal} from '../decorators';
|
|
19
|
-
import {DesiredLength} from '../partials';
|
|
18
|
+
import type {DesiredLength} from '../partials';
|
|
20
19
|
import {
|
|
21
20
|
arc,
|
|
22
21
|
bezierCurveTo,
|
|
@@ -26,9 +25,10 @@ import {
|
|
|
26
25
|
moveTo,
|
|
27
26
|
quadraticCurveTo,
|
|
28
27
|
} from '../utils';
|
|
29
|
-
import {
|
|
28
|
+
import type {CurveProps} from './Curve';
|
|
29
|
+
import {Curve} from './Curve';
|
|
30
30
|
import {Knot} from './Knot';
|
|
31
|
-
import {Node} from './Node';
|
|
31
|
+
import type {Node} from './Node';
|
|
32
32
|
|
|
33
33
|
const splineWithInsufficientKnots = `
|
|
34
34
|
The spline won't be visible unless you specify at least two knots:
|
|
@@ -237,7 +237,8 @@ export class Spline extends Curve {
|
|
|
237
237
|
) {
|
|
238
238
|
const size = this.computedSize();
|
|
239
239
|
const box = this.childrenBBox().transformCorners(matrix);
|
|
240
|
-
const
|
|
240
|
+
const offsetVector = size.mul(this.offset()).scale(0.5);
|
|
241
|
+
const offset = transformVectorAsPoint(offsetVector, matrix);
|
|
241
242
|
const segments = this.profile().segments as PolynomialSegment[];
|
|
242
243
|
|
|
243
244
|
context.lineWidth = 1;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT,
|
|
1
|
+
import type {
|
|
3
2
|
InterpolationFunction,
|
|
4
3
|
SignalValue,
|
|
5
4
|
SimpleSignal,
|
|
6
5
|
ThreadGenerator,
|
|
7
6
|
TimingFunction,
|
|
8
|
-
all,
|
|
9
|
-
capitalize,
|
|
10
|
-
threadable,
|
|
11
7
|
} from '@revideo/core';
|
|
8
|
+
import {DEFAULT, all, capitalize, threadable} from '@revideo/core';
|
|
12
9
|
import {computed, initial, nodeName, signal} from '../decorators';
|
|
13
10
|
import {is} from '../utils';
|
|
14
|
-
import {Node} from './Node';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
11
|
+
import type {Node} from './Node';
|
|
12
|
+
import type {ShapeProps} from './Shape';
|
|
13
|
+
import {Shape} from './Shape';
|
|
14
|
+
import {TXT_TYPE, TxtLeaf} from './TxtLeaf';
|
|
15
|
+
import type {ComponentChildren} from './types';
|
|
18
16
|
|
|
19
17
|
type TxtChildren = string | Node | (string | Node)[];
|
|
20
18
|
type AnyTxt = Txt | TxtLeaf;
|
|
@@ -26,6 +24,8 @@ export interface TxtProps extends ShapeProps {
|
|
|
26
24
|
|
|
27
25
|
@nodeName('Txt')
|
|
28
26
|
export class Txt extends Shape {
|
|
27
|
+
public readonly [TXT_TYPE] = true;
|
|
28
|
+
|
|
29
29
|
/**
|
|
30
30
|
* Create a bold text node.
|
|
31
31
|
*
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
SignalValue,
|
|
4
|
-
SimpleSignal,
|
|
5
|
-
capitalize,
|
|
6
|
-
lazy,
|
|
7
|
-
textLerp,
|
|
8
|
-
} from '@revideo/core';
|
|
1
|
+
import type {SignalValue, SimpleSignal} from '@revideo/core';
|
|
2
|
+
import {BBox, capitalize, lazy, textLerp} from '@revideo/core';
|
|
9
3
|
import {
|
|
10
4
|
computed,
|
|
11
5
|
initial,
|
|
@@ -13,14 +7,16 @@ import {
|
|
|
13
7
|
nodeName,
|
|
14
8
|
signal,
|
|
15
9
|
} from '../decorators';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
10
|
+
import type {ShapeProps} from './Shape';
|
|
11
|
+
import {Shape} from './Shape';
|
|
18
12
|
|
|
19
13
|
export interface TxtLeafProps extends ShapeProps {
|
|
20
14
|
children?: string;
|
|
21
15
|
text?: SignalValue<string>;
|
|
22
16
|
}
|
|
23
17
|
|
|
18
|
+
export const TXT_TYPE = Symbol('Txt');
|
|
19
|
+
|
|
24
20
|
@nodeName('TxtLeaf')
|
|
25
21
|
export class TxtLeaf extends Shape {
|
|
26
22
|
@lazy(() => {
|
|
@@ -49,7 +45,15 @@ export class TxtLeaf extends Shape {
|
|
|
49
45
|
@computed()
|
|
50
46
|
protected parentTxt() {
|
|
51
47
|
const parent = this.parent();
|
|
52
|
-
|
|
48
|
+
if (!parent) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!(TXT_TYPE in parent)) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return parent;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
protected override async draw(context: CanvasRenderingContext2D) {
|
|
@@ -171,6 +175,15 @@ export class TxtLeaf extends Shape {
|
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Overwrite all getters for signal values to return the parent value if it
|
|
180
|
+
* exists.
|
|
181
|
+
*
|
|
182
|
+
* The getters on the TxtLeaf class are used by the `@signal` decorators and
|
|
183
|
+
* are not used by the class or its consumers directly.
|
|
184
|
+
*
|
|
185
|
+
* Check out 2d/src/lib/utils/makeSignalExtensions.ts if this is confusing.
|
|
186
|
+
*/
|
|
174
187
|
[
|
|
175
188
|
'fill',
|
|
176
189
|
'stroke',
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
DependencyContext,
|
|
4
|
-
PlaybackState,
|
|
5
|
-
SerializedVector2,
|
|
6
|
-
SignalValue,
|
|
7
|
-
SimpleSignal,
|
|
8
|
-
} from '@revideo/core';
|
|
1
|
+
import type {SerializedVector2, SignalValue, SimpleSignal} from '@revideo/core';
|
|
2
|
+
import {BBox, DependencyContext, PlaybackState} from '@revideo/core';
|
|
9
3
|
import Hls from 'hls.js';
|
|
10
4
|
import {computed, initial, nodeName, signal} from '../decorators';
|
|
11
|
-
import {DesiredLength} from '../partials';
|
|
5
|
+
import type {DesiredLength} from '../partials';
|
|
12
6
|
import {drawImage} from '../utils';
|
|
13
7
|
import {ImageCommunication} from '../utils/video/ffmpeg-client';
|
|
14
8
|
import {dropExtractor, getFrame} from '../utils/video/mp4-parser-manager';
|
|
15
|
-
import {
|
|
9
|
+
import type {MediaProps} from './Media';
|
|
10
|
+
import {Media} from './Media';
|
|
16
11
|
|
|
17
12
|
export interface VideoProps extends MediaProps {
|
|
18
13
|
/**
|
|
@@ -118,7 +113,8 @@ export class Video extends Media {
|
|
|
118
113
|
video = document.createElement('video');
|
|
119
114
|
video.crossOrigin = 'anonymous';
|
|
120
115
|
|
|
121
|
-
|
|
116
|
+
const parsedSrc = new URL(src);
|
|
117
|
+
if (parsedSrc.pathname.endsWith('.m3u8')) {
|
|
122
118
|
const hls = new Hls();
|
|
123
119
|
hls.loadSource(src);
|
|
124
120
|
hls.attachMedia(video);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {SimpleSignal} from '@revideo/core';
|
|
2
|
+
import {PlaybackState, lazy} from '@revideo/core';
|
|
2
3
|
import {initial, signal} from '../decorators';
|
|
3
4
|
import {nodeName} from '../decorators/nodeName';
|
|
4
5
|
import {useScene2D} from '../scenes/useScene2D';
|
|
5
6
|
import type {Node} from './Node';
|
|
6
|
-
import {
|
|
7
|
+
import type {RectProps} from './Rect';
|
|
8
|
+
import {Rect} from './Rect';
|
|
7
9
|
|
|
8
10
|
export interface View2DProps extends RectProps {
|
|
9
11
|
assetHash: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {ThreadGeneratorFactory
|
|
1
|
+
import type {ThreadGeneratorFactory} from '@revideo/core';
|
|
2
|
+
import {threads} from '@revideo/core';
|
|
2
3
|
import {useScene2D} from '../../scenes';
|
|
3
|
-
import {View2D} from '../View2D';
|
|
4
|
+
import type {View2D} from '../View2D';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Turn a generator factory into a test function.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type {FullSceneDescription, ThreadGeneratorFactory} from '@revideo/core';
|
|
1
2
|
import {
|
|
2
|
-
FullSceneDescription,
|
|
3
3
|
PlaybackManager,
|
|
4
4
|
PlaybackStatus,
|
|
5
|
-
ThreadGeneratorFactory,
|
|
6
5
|
Vector2,
|
|
7
6
|
endPlayback,
|
|
8
7
|
endScene,
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
} from '@revideo/core';
|
|
12
11
|
import {afterAll, beforeAll, beforeEach} from 'vitest';
|
|
13
12
|
import {Scene2D, makeScene2D} from '../../scenes';
|
|
14
|
-
import {View2D} from '../View2D';
|
|
13
|
+
import type {View2D} from '../View2D';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Set up the test environment to support creating nodes.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BBox,
|
|
3
|
+
DEG2RAD,
|
|
4
|
+
Matrix2D,
|
|
5
|
+
Vector2,
|
|
6
|
+
lazy,
|
|
7
|
+
transformVector,
|
|
8
|
+
} from '@revideo/core';
|
|
2
9
|
import {View2D} from '../components/View2D';
|
|
3
|
-
import {CurvePoint} from './CurvePoint';
|
|
10
|
+
import type {CurvePoint} from './CurvePoint';
|
|
4
11
|
import {Segment} from './Segment';
|
|
5
12
|
|
|
6
13
|
export class ArcSegment extends Segment {
|
|
@@ -34,10 +41,12 @@ export class ArcSegment extends Segment {
|
|
|
34
41
|
this.xAxisRotation = this.xAxisRotationDegree * DEG2RAD;
|
|
35
42
|
this.radius = new Vector2(Math.abs(radius.x), Math.abs(radius.y));
|
|
36
43
|
|
|
37
|
-
const
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
.
|
|
44
|
+
const rotationMatrix =
|
|
45
|
+
Matrix2D.fromRotation(-xAxisRotationDegree).domMatrix;
|
|
46
|
+
const pAccent = transformVector(
|
|
47
|
+
startPoint.sub(endPoint).div(2),
|
|
48
|
+
rotationMatrix,
|
|
49
|
+
);
|
|
41
50
|
|
|
42
51
|
const L =
|
|
43
52
|
(pAccent.x * pAccent.x) / (radius.x * radius.x) +
|
|
@@ -63,9 +72,8 @@ export class ArcSegment extends Segment {
|
|
|
63
72
|
|
|
64
73
|
this.xAxisRotationMatrix =
|
|
65
74
|
Matrix2D.fromRotation(xAxisRotationDegree).domMatrix;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.add(startPoint.add(endPoint).div(2));
|
|
75
|
+
const rotatedCAccent = transformVector(cAccent, this.xAxisRotationMatrix);
|
|
76
|
+
this.center = rotatedCAccent.add(startPoint.add(endPoint).div(2));
|
|
69
77
|
|
|
70
78
|
const q = pAccent.sub(cAccent).div(radius);
|
|
71
79
|
const s = pAccent.scale(-1).sub(cAccent).div(radius);
|
|
@@ -89,17 +97,19 @@ export class ArcSegment extends Segment {
|
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
public getAnglePosition(angle: number) {
|
|
92
|
-
|
|
93
|
-
.mul(Vector2.fromRadians(angle))
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
const rotatedVector = transformVector(
|
|
101
|
+
this.radius.mul(Vector2.fromRadians(angle)),
|
|
102
|
+
this.xAxisRotationMatrix,
|
|
103
|
+
);
|
|
104
|
+
return rotatedVector.add(this.center);
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
public getAngleDerivative(angle: number) {
|
|
99
|
-
|
|
108
|
+
const derivative = new Vector2(
|
|
100
109
|
-this.radius.x * Math.sin(angle),
|
|
101
110
|
this.radius.y * Math.cos(angle),
|
|
102
|
-
)
|
|
111
|
+
);
|
|
112
|
+
return transformVector(derivative, this.xAxisRotationMatrix);
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
public draw(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {Vector2} from '@revideo/core';
|
|
1
|
+
import type {Vector2} from '@revideo/core';
|
|
2
2
|
import {lineTo, moveTo} from '../utils';
|
|
3
|
-
import {CurvePoint} from './CurvePoint';
|
|
3
|
+
import type {CurvePoint} from './CurvePoint';
|
|
4
4
|
import {Segment} from './Segment';
|
|
5
5
|
|
|
6
6
|
export class LineSegment extends Segment {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {BBox, Vector2} from '@revideo/core';
|
|
1
|
+
import {transformVectorAsPoint, type BBox, type Vector2} from '@revideo/core';
|
|
2
2
|
import {moveTo} from '../utils';
|
|
3
|
-
import {CurvePoint} from './CurvePoint';
|
|
4
|
-
import {Polynomial2D} from './Polynomial2D';
|
|
3
|
+
import type {CurvePoint} from './CurvePoint';
|
|
4
|
+
import type {Polynomial2D} from './Polynomial2D';
|
|
5
5
|
import {Segment} from './Segment';
|
|
6
6
|
import {UniformPolynomialCurveSampler} from './UniformPolynomialCurveSampler';
|
|
7
7
|
|
|
@@ -61,7 +61,7 @@ export abstract class PolynomialSegment extends Segment {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
public transformPoints(matrix: DOMMatrix): Vector2[] {
|
|
64
|
-
return this.points.map(point => point
|
|
64
|
+
return this.points.map(point => transformVectorAsPoint(point, matrix));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {Vector2
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type {Vector2} from '@revideo/core';
|
|
2
|
+
import {clamp, remap} from '@revideo/core';
|
|
3
|
+
import type {CurvePoint} from './CurvePoint';
|
|
4
|
+
import type {PolynomialSegment} from './PolynomialSegment';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Class to uniformly sample points on a given polynomial curve.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Vector2} from '@revideo/core';
|
|
2
|
-
import {CurveProfile} from './CurveProfile';
|
|
2
|
+
import type {CurveProfile} from './CurveProfile';
|
|
3
3
|
import {LineSegment} from './LineSegment';
|
|
4
4
|
import {getPointAtDistance} from './getPointAtDistance';
|
|
5
5
|
import {getPolylineProfile} from './getPolylineProfile';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Vector2, clamp} from '@revideo/core';
|
|
2
2
|
import {CubicBezierSegment} from './CubicBezierSegment';
|
|
3
|
-
import {CurveProfile} from './CurveProfile';
|
|
4
|
-
import {KnotInfo} from './KnotInfo';
|
|
5
|
-
import {PolynomialSegment} from './PolynomialSegment';
|
|
3
|
+
import type {CurveProfile} from './CurveProfile';
|
|
4
|
+
import type {KnotInfo} from './KnotInfo';
|
|
5
|
+
import type {PolynomialSegment} from './PolynomialSegment';
|
|
6
6
|
import {QuadBezierSegment} from './QuadBezierSegment';
|
|
7
7
|
|
|
8
8
|
function isCubicSegment(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {Vector2} from '@revideo/core';
|
|
2
2
|
import {ArcSegment} from './ArcSegment';
|
|
3
|
-
import {CurveProfile} from './CurveProfile';
|
|
3
|
+
import type {CurveProfile} from './CurveProfile';
|
|
4
4
|
import {LineSegment} from './LineSegment';
|
|
5
|
-
import {Segment} from './Segment';
|
|
5
|
+
import type {Segment} from './Segment';
|
|
6
6
|
|
|
7
7
|
export function getCircleProfile(
|
|
8
8
|
size: Vector2,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {Vector2, clamp} from '@revideo/core';
|
|
2
|
-
import
|
|
2
|
+
import type {PathCommand} from 'parse-svg-path';
|
|
3
|
+
import parse from 'parse-svg-path';
|
|
3
4
|
import {ArcSegment} from './ArcSegment';
|
|
4
5
|
import {CubicBezierSegment} from './CubicBezierSegment';
|
|
5
|
-
import {CurveProfile} from './CurveProfile';
|
|
6
|
+
import type {CurveProfile} from './CurveProfile';
|
|
6
7
|
import {LineSegment} from './LineSegment';
|
|
7
8
|
import {QuadBezierSegment} from './QuadBezierSegment';
|
|
8
|
-
import {Segment} from './Segment';
|
|
9
|
+
import type {Segment} from './Segment';
|
|
9
10
|
|
|
10
11
|
function addSegmentToProfile(profile: CurveProfile, segment: Segment) {
|
|
11
12
|
profile.segments.push(segment);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Vector2, clamp} from '@revideo/core';
|
|
2
|
-
import {CurvePoint} from './CurvePoint';
|
|
3
|
-
import {CurveProfile} from './CurveProfile';
|
|
2
|
+
import type {CurvePoint} from './CurvePoint';
|
|
3
|
+
import type {CurveProfile} from './CurveProfile';
|
|
4
4
|
|
|
5
5
|
export function getPointAtDistance(
|
|
6
6
|
profile: CurveProfile,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {Vector2
|
|
1
|
+
import type {Vector2} from '@revideo/core';
|
|
2
|
+
import {clamp} from '@revideo/core';
|
|
2
3
|
import {CircleSegment} from './CircleSegment';
|
|
3
|
-
import {CurveProfile} from './CurveProfile';
|
|
4
|
+
import type {CurveProfile} from './CurveProfile';
|
|
4
5
|
import {LineSegment} from './LineSegment';
|
|
5
6
|
|
|
6
7
|
export function getPolylineProfile(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {BBox, Spacing
|
|
1
|
+
import type {BBox, Spacing} from '@revideo/core';
|
|
2
|
+
import {Vector2} from '@revideo/core';
|
|
2
3
|
import {adjustRectRadius} from '../utils';
|
|
3
4
|
import {CircleSegment} from './CircleSegment';
|
|
4
5
|
import {CubicBezierSegment} from './CubicBezierSegment';
|
|
5
|
-
import {CurveProfile} from './CurveProfile';
|
|
6
|
+
import type {CurveProfile} from './CurveProfile';
|
|
6
7
|
import {LineSegment} from './LineSegment';
|
|
7
|
-
import {Segment} from './Segment';
|
|
8
|
+
import type {Segment} from './Segment';
|
|
8
9
|
|
|
9
10
|
export function getRectProfile(
|
|
10
11
|
rect: BBox,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {Signal} from '@revideo/core';
|
|
2
|
+
import {Color} from '@revideo/core';
|
|
2
3
|
import type {CanvasStyle, PossibleCanvasStyle} from '../partials';
|
|
3
4
|
import {canvasStyleParser} from '../utils';
|
|
4
5
|
import {initial, interpolation, parser, signal} from './signal';
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Signal,
|
|
3
|
-
SignalContext,
|
|
4
3
|
SignalValue,
|
|
5
4
|
SimpleSignal,
|
|
6
5
|
ThreadGenerator,
|
|
7
6
|
TimingFunction,
|
|
7
|
+
} from '@revideo/core';
|
|
8
|
+
import {
|
|
9
|
+
SignalContext,
|
|
8
10
|
all,
|
|
9
11
|
deepLerp,
|
|
10
12
|
easeInOutCubic,
|
|
11
13
|
unwrap,
|
|
12
14
|
} from '@revideo/core';
|
|
13
|
-
import {
|
|
15
|
+
import type {FilterName} from '../partials';
|
|
16
|
+
import {FILTERS, Filter} from '../partials';
|
|
14
17
|
import {addInitializer} from './initializers';
|
|
15
18
|
import {getPropertyMetaOrCreate} from './signal';
|
|
16
19
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {SimpleSignal} from '@revideo/core';
|
|
2
|
+
import {DEFAULT} from '@revideo/core';
|
|
2
3
|
import {beforeEach, describe, expect, test, vi} from 'vitest';
|
|
3
4
|
import {initial, initializeSignals, parser, signal} from './signal';
|
|
4
5
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
capitalize,
|
|
3
|
-
deepLerp,
|
|
1
|
+
import type {
|
|
4
2
|
InterpolationFunction,
|
|
5
|
-
SignalContext,
|
|
6
3
|
SignalValue,
|
|
7
4
|
TimingFunction,
|
|
8
|
-
useLogger,
|
|
9
5
|
} from '@revideo/core';
|
|
6
|
+
import {capitalize, deepLerp, SignalContext, useLogger} from '@revideo/core';
|
|
10
7
|
import {makeSignalExtensions} from '../utils/makeSignalExtensions';
|
|
11
8
|
import {addInitializer, initialize} from './initializers';
|
|
12
9
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {PossibleVector2, Signal
|
|
1
|
+
import type {PossibleVector2, Signal} from '@revideo/core';
|
|
2
|
+
import {Vector2} from '@revideo/core';
|
|
2
3
|
import type {Length} from '../partials';
|
|
3
4
|
import {compound} from './compound';
|
|
4
5
|
import {wrapper} from './signal';
|
package/src/lib/jsx-runtime.ts
CHANGED
|
@@ -21,7 +21,8 @@ function isClassComponent(
|
|
|
21
21
|
return !!fn.prototype?.isClass;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const Fragment =
|
|
24
|
+
export const Fragment: FunctionComponent = ({children}) => children;
|
|
25
|
+
|
|
25
26
|
export function jsx(
|
|
26
27
|
type: NodeConstructor | FunctionComponent | typeof Fragment,
|
|
27
28
|
config: JSXProps,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
map,
|
|
4
|
-
SignalValue,
|
|
5
|
-
SimpleSignal,
|
|
6
|
-
transformScalar,
|
|
7
|
-
} from '@revideo/core';
|
|
1
|
+
import type {SignalValue, SimpleSignal} from '@revideo/core';
|
|
2
|
+
import {createSignal, map, transformScalar} from '@revideo/core';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* All possible CSS filter names.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Color,
|
|
1
|
+
import type {
|
|
3
2
|
PossibleColor,
|
|
4
3
|
PossibleVector2,
|
|
5
4
|
SignalValue,
|
|
6
5
|
SimpleSignal,
|
|
7
6
|
Vector2Signal,
|
|
8
|
-
unwrap,
|
|
9
7
|
} from '@revideo/core';
|
|
8
|
+
import {Color, unwrap} from '@revideo/core';
|
|
10
9
|
import {computed} from '../decorators/computed';
|
|
11
10
|
import {initial, initializeSignals, signal} from '../decorators/signal';
|
|
12
11
|
import {vector2Signal} from '../decorators/vector2Signal';
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useLogger,
|
|
5
|
-
useScene,
|
|
6
|
-
WebGLConvertible,
|
|
7
|
-
} from '@revideo/core';
|
|
8
|
-
import {Node} from '../components';
|
|
1
|
+
import type {SignalValue, WebGLConvertible} from '@revideo/core';
|
|
2
|
+
import {experimentalLog, useLogger, useScene} from '@revideo/core';
|
|
3
|
+
import type {Node} from '../components';
|
|
9
4
|
|
|
10
5
|
/**
|
|
11
6
|
* Describes a shader program used to apply effects to nodes.
|