@revideo/2d 0.10.0 → 0.10.1-alpha.1114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/editor/editor/NodeInspectorConfig.d.ts +1 -1
  2. package/editor/editor/NodeInspectorConfig.d.ts.map +1 -1
  3. package/editor/editor/PreviewOverlayConfig.d.ts +1 -1
  4. package/editor/editor/PreviewOverlayConfig.d.ts.map +1 -1
  5. package/editor/editor/Provider.d.ts +3 -3
  6. package/editor/editor/Provider.d.ts.map +1 -1
  7. package/editor/editor/SceneGraphTabConfig.d.ts +1 -1
  8. package/editor/editor/SceneGraphTabConfig.d.ts.map +1 -1
  9. package/editor/editor/icons/IconMap.d.ts +1 -1
  10. package/editor/editor/icons/IconMap.d.ts.map +1 -1
  11. package/editor/editor/tree/NodeElement.d.ts +1 -1
  12. package/editor/editor/tree/NodeElement.d.ts.map +1 -1
  13. package/editor/editor/tree/TreeElement.d.ts +3 -3
  14. package/editor/editor/tree/TreeElement.d.ts.map +1 -1
  15. package/editor/editor/tree/TreeRoot.d.ts +1 -1
  16. package/editor/editor/tree/TreeRoot.d.ts.map +1 -1
  17. package/editor/editor/tsconfig.build.tsbuildinfo +1 -1
  18. package/editor/index.js +3 -2
  19. package/editor/index.js.map +1 -1
  20. package/lib/code/CodeCursor.d.ts +2 -2
  21. package/lib/code/CodeCursor.d.ts.map +1 -1
  22. package/lib/code/CodeCursor.js +2 -2
  23. package/lib/code/CodeDiffer.d.ts +2 -2
  24. package/lib/code/CodeDiffer.d.ts.map +1 -1
  25. package/lib/code/CodeDiffer.js +1 -1
  26. package/lib/code/CodeFragment.d.ts +1 -1
  27. package/lib/code/CodeFragment.d.ts.map +1 -1
  28. package/lib/code/CodeFragment.js +1 -1
  29. package/lib/code/CodeScope.d.ts +2 -2
  30. package/lib/code/CodeScope.d.ts.map +1 -1
  31. package/lib/code/CodeScope.js +1 -1
  32. package/lib/code/CodeSelection.d.ts +1 -1
  33. package/lib/code/CodeSelection.d.ts.map +1 -1
  34. package/lib/code/CodeSelection.js +2 -2
  35. package/lib/code/CodeSignal.d.ts +5 -4
  36. package/lib/code/CodeSignal.d.ts.map +1 -1
  37. package/lib/code/CodeSignal.js +2 -6
  38. package/lib/code/LezerHighlighter.d.ts +3 -3
  39. package/lib/code/LezerHighlighter.d.ts.map +1 -1
  40. package/lib/code/extractRange.d.ts +2 -2
  41. package/lib/code/extractRange.d.ts.map +1 -1
  42. package/lib/code/extractRange.js +1 -1
  43. package/lib/components/Audio.d.ts +2 -1
  44. package/lib/components/Audio.d.ts.map +1 -1
  45. package/lib/components/Audio.js +1 -1
  46. package/lib/components/Bezier.d.ts +5 -4
  47. package/lib/components/Bezier.d.ts.map +1 -1
  48. package/lib/components/Bezier.js +4 -3
  49. package/lib/components/Circle.d.ts +6 -4
  50. package/lib/components/Circle.d.ts.map +1 -1
  51. package/lib/components/Circle.js +2 -2
  52. package/lib/components/Code.d.ts +6 -4
  53. package/lib/components/Code.d.ts.map +1 -1
  54. package/lib/components/Code.js +1 -1
  55. package/lib/components/CodeBlock.d.ts +6 -4
  56. package/lib/components/CodeBlock.d.ts.map +1 -1
  57. package/lib/components/CodeBlock.js +2 -2
  58. package/lib/components/CubicBezier.d.ts +5 -4
  59. package/lib/components/CubicBezier.d.ts.map +1 -1
  60. package/lib/components/CubicBezier.js +1 -1
  61. package/lib/components/Curve.d.ts +8 -6
  62. package/lib/components/Curve.d.ts.map +1 -1
  63. package/lib/components/Curve.js +2 -2
  64. package/lib/components/Grid.d.ts +3 -2
  65. package/lib/components/Grid.d.ts.map +1 -1
  66. package/lib/components/Grid.js +2 -2
  67. package/lib/components/Icon.d.ts +3 -2
  68. package/lib/components/Icon.d.ts.map +1 -1
  69. package/lib/components/Icon.js +2 -2
  70. package/lib/components/Img.d.ts +5 -3
  71. package/lib/components/Img.d.ts.map +1 -1
  72. package/lib/components/Img.js +1 -1
  73. package/lib/components/Knot.d.ts +4 -3
  74. package/lib/components/Knot.d.ts.map +1 -1
  75. package/lib/components/Knot.js +4 -4
  76. package/lib/components/Latex.d.ts +4 -3
  77. package/lib/components/Latex.d.ts.map +1 -1
  78. package/lib/components/Latex.js +2 -2
  79. package/lib/components/Layout.d.ts +6 -4
  80. package/lib/components/Layout.d.ts.map +1 -1
  81. package/lib/components/Layout.js +11 -10
  82. package/lib/components/Line.d.ts +5 -3
  83. package/lib/components/Line.d.ts.map +1 -1
  84. package/lib/components/Line.js +6 -4
  85. package/lib/components/Media.d.ts +3 -2
  86. package/lib/components/Media.d.ts.map +1 -1
  87. package/lib/components/Media.js +1 -1
  88. package/lib/components/Node.d.ts +7 -6
  89. package/lib/components/Node.d.ts.map +1 -1
  90. package/lib/components/Node.js +10 -10
  91. package/lib/components/Path.d.ts +5 -3
  92. package/lib/components/Path.d.ts.map +1 -1
  93. package/lib/components/Path.js +4 -3
  94. package/lib/components/Polygon.d.ts +6 -4
  95. package/lib/components/Polygon.d.ts.map +1 -1
  96. package/lib/components/Polygon.js +2 -2
  97. package/lib/components/QuadBezier.d.ts +5 -4
  98. package/lib/components/QuadBezier.d.ts.map +1 -1
  99. package/lib/components/QuadBezier.js +1 -1
  100. package/lib/components/Ray.d.ts +5 -3
  101. package/lib/components/Ray.d.ts.map +1 -1
  102. package/lib/components/Ray.js +6 -5
  103. package/lib/components/Rect.d.ts +5 -3
  104. package/lib/components/Rect.d.ts.map +1 -1
  105. package/lib/components/Rect.js +2 -2
  106. package/lib/components/Rive.d.ts +3 -2
  107. package/lib/components/Rive.d.ts.map +1 -1
  108. package/lib/components/Rive.js +1 -1
  109. package/lib/components/SVG.d.ts +7 -4
  110. package/lib/components/SVG.d.ts.map +1 -1
  111. package/lib/components/SVG.js +1 -1
  112. package/lib/components/Shape.d.ts +5 -4
  113. package/lib/components/Shape.d.ts.map +1 -1
  114. package/lib/components/Shape.js +2 -2
  115. package/lib/components/Spline.d.ts +6 -4
  116. package/lib/components/Spline.d.ts.map +1 -1
  117. package/lib/components/Spline.js +5 -4
  118. package/lib/components/Txt.d.ts +5 -4
  119. package/lib/components/Txt.d.ts.map +1 -1
  120. package/lib/components/Txt.js +2 -2
  121. package/lib/components/TxtLeaf.d.ts +5 -4
  122. package/lib/components/TxtLeaf.d.ts.map +1 -1
  123. package/lib/components/TxtLeaf.js +12 -4
  124. package/lib/components/Video.d.ts +4 -3
  125. package/lib/components/Video.d.ts.map +1 -1
  126. package/lib/components/Video.js +2 -2
  127. package/lib/components/View2D.d.ts +4 -2
  128. package/lib/components/View2D.d.ts.map +1 -1
  129. package/lib/components/View2D.js +1 -1
  130. package/lib/curves/ArcSegment.d.ts +1 -1
  131. package/lib/curves/ArcSegment.d.ts.map +1 -1
  132. package/lib/curves/ArcSegment.js +10 -14
  133. package/lib/curves/CircleSegment.d.ts +1 -1
  134. package/lib/curves/CircleSegment.d.ts.map +1 -1
  135. package/lib/curves/CurveDrawingInfo.d.ts +1 -1
  136. package/lib/curves/CurveDrawingInfo.d.ts.map +1 -1
  137. package/lib/curves/CurveProfile.d.ts +1 -1
  138. package/lib/curves/CurveProfile.d.ts.map +1 -1
  139. package/lib/curves/KnotInfo.d.ts +1 -1
  140. package/lib/curves/KnotInfo.d.ts.map +1 -1
  141. package/lib/curves/LineSegment.d.ts +2 -2
  142. package/lib/curves/LineSegment.d.ts.map +1 -1
  143. package/lib/curves/PolynomialSegment.d.ts +3 -3
  144. package/lib/curves/PolynomialSegment.d.ts.map +1 -1
  145. package/lib/curves/PolynomialSegment.js +3 -2
  146. package/lib/curves/Segment.d.ts +2 -2
  147. package/lib/curves/Segment.d.ts.map +1 -1
  148. package/lib/curves/UniformPolynomialCurveSampler.d.ts +2 -2
  149. package/lib/curves/UniformPolynomialCurveSampler.d.ts.map +1 -1
  150. package/lib/curves/UniformPolynomialCurveSampler.js +1 -1
  151. package/lib/curves/createCurveProfileLerp.d.ts +1 -1
  152. package/lib/curves/createCurveProfileLerp.d.ts.map +1 -1
  153. package/lib/curves/getBezierSplineProfile.d.ts +2 -2
  154. package/lib/curves/getBezierSplineProfile.d.ts.map +1 -1
  155. package/lib/curves/getCircleProfile.d.ts +1 -1
  156. package/lib/curves/getCircleProfile.d.ts.map +1 -1
  157. package/lib/curves/getPathProfile.d.ts +1 -1
  158. package/lib/curves/getPathProfile.d.ts.map +1 -1
  159. package/lib/curves/getPathProfile.js +1 -1
  160. package/lib/curves/getPointAtDistance.d.ts +2 -2
  161. package/lib/curves/getPointAtDistance.d.ts.map +1 -1
  162. package/lib/curves/getPolylineProfile.d.ts +2 -2
  163. package/lib/curves/getPolylineProfile.d.ts.map +1 -1
  164. package/lib/curves/getPolylineProfile.js +1 -1
  165. package/lib/curves/getRectProfile.d.ts +2 -2
  166. package/lib/curves/getRectProfile.d.ts.map +1 -1
  167. package/lib/curves/getRectProfile.js +1 -1
  168. package/lib/decorators/canvasStyleSignal.d.ts +1 -1
  169. package/lib/decorators/canvasStyleSignal.d.ts.map +1 -1
  170. package/lib/decorators/canvasStyleSignal.js +1 -1
  171. package/lib/decorators/filtersSignal.d.ts +4 -2
  172. package/lib/decorators/filtersSignal.d.ts.map +1 -1
  173. package/lib/decorators/filtersSignal.js +1 -1
  174. package/lib/decorators/signal.d.ts +1 -1
  175. package/lib/decorators/signal.d.ts.map +1 -1
  176. package/lib/decorators/signal.js +2 -2
  177. package/lib/decorators/vector2Signal.d.ts +2 -1
  178. package/lib/decorators/vector2Signal.d.ts.map +1 -1
  179. package/lib/decorators/vector2Signal.js +1 -1
  180. package/lib/partials/Filter.d.ts +1 -1
  181. package/lib/partials/Filter.d.ts.map +1 -1
  182. package/lib/partials/Filter.js +2 -2
  183. package/lib/partials/Gradient.d.ts +1 -1
  184. package/lib/partials/Gradient.d.ts.map +1 -1
  185. package/lib/partials/Gradient.js +2 -2
  186. package/lib/partials/Pattern.d.ts +1 -1
  187. package/lib/partials/Pattern.d.ts.map +1 -1
  188. package/lib/partials/ShaderConfig.d.ts +2 -2
  189. package/lib/partials/ShaderConfig.d.ts.map +1 -1
  190. package/lib/partials/ShaderConfig.js +2 -2
  191. package/lib/partials/types.d.ts +1 -1
  192. package/lib/partials/types.d.ts.map +1 -1
  193. package/lib/scenes/Scene2D.d.ts +4 -2
  194. package/lib/scenes/Scene2D.d.ts.map +1 -1
  195. package/lib/scenes/Scene2D.js +3 -3
  196. package/lib/tsconfig.build.tsbuildinfo +1 -1
  197. package/lib/utils/CanvasUtils.d.ts +5 -3
  198. package/lib/utils/CanvasUtils.d.ts.map +1 -1
  199. package/lib/utils/CanvasUtils.js +1 -1
  200. package/lib/utils/makeSignalExtensions.d.ts +2 -2
  201. package/lib/utils/makeSignalExtensions.d.ts.map +1 -1
  202. package/lib/utils/makeSignalExtensions.js +1 -1
  203. package/lib/utils/video/parser/parser.d.ts.map +1 -1
  204. package/lib/utils/video/parser/parser.js +1 -1
  205. package/lib/utils/video/parser/sampler.d.ts +1 -1
  206. package/lib/utils/video/parser/sampler.d.ts.map +1 -1
  207. package/lib/utils/video/parser/segment.d.ts +1 -1
  208. package/lib/utils/video/parser/segment.d.ts.map +1 -1
  209. package/package.json +4 -4
  210. package/src/editor/NodeInspectorConfig.tsx +1 -1
  211. package/src/editor/PreviewOverlayConfig.tsx +6 -5
  212. package/src/editor/Provider.tsx +5 -9
  213. package/src/editor/SceneGraphTabConfig.tsx +1 -2
  214. package/src/editor/icons/IconMap.ts +1 -1
  215. package/src/editor/tree/NodeElement.tsx +2 -1
  216. package/src/editor/tree/TreeElement.tsx +3 -3
  217. package/src/editor/tree/TreeRoot.tsx +1 -1
  218. package/src/lib/code/CodeCursor.ts +10 -14
  219. package/src/lib/code/CodeDiffer.ts +3 -2
  220. package/src/lib/code/CodeFragment.ts +2 -1
  221. package/src/lib/code/CodeScope.ts +3 -2
  222. package/src/lib/code/CodeSelection.ts +2 -6
  223. package/src/lib/code/CodeSignal.ts +10 -18
  224. package/src/lib/code/LezerHighlighter.ts +3 -3
  225. package/src/lib/code/extractRange.ts +3 -2
  226. package/src/lib/components/Audio.ts +2 -1
  227. package/src/lib/components/Bezier.ts +7 -5
  228. package/src/lib/components/Circle.ts +7 -10
  229. package/src/lib/components/Code.ts +17 -12
  230. package/src/lib/components/CodeBlock.ts +8 -13
  231. package/src/lib/components/CubicBezier.ts +5 -4
  232. package/src/lib/components/Curve.ts +8 -8
  233. package/src/lib/components/Grid.ts +4 -3
  234. package/src/lib/components/Icon.ts +4 -3
  235. package/src/lib/components/Img.ts +9 -6
  236. package/src/lib/components/Knot.ts +7 -6
  237. package/src/lib/components/Latex.ts +5 -8
  238. package/src/lib/components/Layout.ts +28 -18
  239. package/src/lib/components/Line.ts +16 -9
  240. package/src/lib/components/Media.ts +3 -3
  241. package/src/lib/components/Node.ts +23 -15
  242. package/src/lib/components/Path.ts +12 -7
  243. package/src/lib/components/Polygon.ts +7 -10
  244. package/src/lib/components/QuadBezier.ts +5 -4
  245. package/src/lib/components/Ray.ts +10 -6
  246. package/src/lib/components/Rect.ts +5 -4
  247. package/src/lib/components/Rive.ts +6 -3
  248. package/src/lib/components/SVG.ts +20 -11
  249. package/src/lib/components/Shape.ts +6 -9
  250. package/src/lib/components/Spline.ts +14 -13
  251. package/src/lib/components/Txt.ts +6 -8
  252. package/src/lib/components/TxtLeaf.ts +14 -11
  253. package/src/lib/components/Video.ts +5 -10
  254. package/src/lib/components/View2D.ts +4 -2
  255. package/src/lib/components/__tests__/generatorTest.ts +3 -2
  256. package/src/lib/components/__tests__/mockScene2D.ts +2 -3
  257. package/src/lib/curves/ArcSegment.ts +25 -15
  258. package/src/lib/curves/CircleSegment.ts +1 -1
  259. package/src/lib/curves/CurveDrawingInfo.ts +1 -1
  260. package/src/lib/curves/CurveProfile.ts +1 -1
  261. package/src/lib/curves/KnotInfo.ts +1 -1
  262. package/src/lib/curves/LineSegment.ts +2 -2
  263. package/src/lib/curves/PolynomialSegment.ts +4 -4
  264. package/src/lib/curves/Segment.ts +2 -2
  265. package/src/lib/curves/UniformPolynomialCurveSampler.ts +4 -3
  266. package/src/lib/curves/createCurveProfileLerp.ts +1 -1
  267. package/src/lib/curves/getBezierSplineProfile.ts +3 -3
  268. package/src/lib/curves/getCircleProfile.ts +2 -2
  269. package/src/lib/curves/getPathProfile.ts +4 -3
  270. package/src/lib/curves/getPointAtDistance.ts +2 -2
  271. package/src/lib/curves/getPolylineProfile.ts +3 -2
  272. package/src/lib/curves/getRectProfile.ts +4 -3
  273. package/src/lib/decorators/canvasStyleSignal.ts +2 -1
  274. package/src/lib/decorators/defaultStyle.ts +1 -1
  275. package/src/lib/decorators/filtersSignal.ts +6 -3
  276. package/src/lib/decorators/signal.test.ts +2 -1
  277. package/src/lib/decorators/signal.ts +2 -5
  278. package/src/lib/decorators/vector2Signal.ts +2 -1
  279. package/src/lib/partials/Filter.ts +2 -7
  280. package/src/lib/partials/Gradient.ts +2 -3
  281. package/src/lib/partials/Pattern.ts +1 -1
  282. package/src/lib/partials/ShaderConfig.ts +3 -8
  283. package/src/lib/partials/types.ts +1 -1
  284. package/src/lib/scenes/Scene2D.ts +10 -5
  285. package/src/lib/utils/CanvasUtils.ts +4 -2
  286. package/src/lib/utils/makeSignalExtensions.ts +3 -2
  287. package/src/lib/utils/video/parser/parser.ts +2 -1
  288. package/src/lib/utils/video/parser/sampler.ts +1 -1
  289. 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
- CanvasStyleSignal,
14
- canvasStyleSignal,
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 {Layout, LayoutProps} from './Layout';
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
- CubicBezierSegment,
13
- CurveProfile,
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 {Curve, CurveProps} from './Curve';
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 offset = size.mul(this.offset()).scale(0.5).transformAsPoint(matrix);
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 {Shape, ShapeProps} from './Shape';
11
+ import type {Node} from './Node';
12
+ import type {ShapeProps} from './Shape';
13
+ import {Shape} from './Shape';
16
14
  import {TxtLeaf} from './TxtLeaf';
17
- import {ComponentChildren} from './types';
15
+ import type {ComponentChildren} from './types';
18
16
 
19
17
  type TxtChildren = string | Node | (string | Node)[];
20
18
  type AnyTxt = Txt | TxtLeaf;
@@ -1,11 +1,5 @@
1
- import {
2
- BBox,
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,8 +7,8 @@ import {
13
7
  nodeName,
14
8
  signal,
15
9
  } from '../decorators';
16
- import {Shape, ShapeProps} from './Shape';
17
- import {Txt} from './Txt';
10
+ import type {ShapeProps} from './Shape';
11
+ import {Shape} from './Shape';
18
12
 
19
13
  export interface TxtLeafProps extends ShapeProps {
20
14
  children?: string;
@@ -49,7 +43,7 @@ export class TxtLeaf extends Shape {
49
43
  @computed()
50
44
  protected parentTxt() {
51
45
  const parent = this.parent();
52
- return parent instanceof Txt ? parent : null;
46
+ return parent?.constructor.name === 'Txt' ? parent : null;
53
47
  }
54
48
 
55
49
  protected override async draw(context: CanvasRenderingContext2D) {
@@ -171,6 +165,15 @@ export class TxtLeaf extends Shape {
171
165
  }
172
166
  }
173
167
 
168
+ /**
169
+ * Overwrite all getters for signal values to return the parent value if it
170
+ * exists.
171
+ *
172
+ * The getters on the TxtLeaf class are used by the `@signal` decorators and
173
+ * are not used by the class or its consumers directly.
174
+ *
175
+ * Check out 2d/src/lib/utils/makeSignalExtensions.ts if this is confusing.
176
+ */
174
177
  [
175
178
  'fill',
176
179
  'stroke',
@@ -1,18 +1,13 @@
1
- import {
2
- BBox,
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 {Media, MediaProps} from './Media';
9
+ import type {MediaProps} from './Media';
10
+ import {Media} from './Media';
16
11
 
17
12
  export interface VideoProps extends MediaProps {
18
13
  /**
@@ -1,9 +1,11 @@
1
- import {PlaybackState, SimpleSignal, lazy} from '@revideo/core';
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 {Rect, RectProps} from './Rect';
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, threads} from '@revideo/core';
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 {BBox, DEG2RAD, Matrix2D, Vector2, lazy} from '@revideo/core';
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 pAccent = startPoint
38
- .sub(endPoint)
39
- .div(2)
40
- .transform(Matrix2D.fromRotation(-xAxisRotationDegree).domMatrix);
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
- this.center = cAccent
67
- .transform(this.xAxisRotationMatrix)
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
- return this.radius
93
- .mul(Vector2.fromRadians(angle))
94
- .transform(this.xAxisRotationMatrix)
95
- .add(this.center);
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
- return new Vector2(
108
+ const derivative = new Vector2(
100
109
  -this.radius.x * Math.sin(angle),
101
110
  this.radius.y * Math.cos(angle),
102
- ).transform(this.xAxisRotationMatrix);
111
+ );
112
+ return transformVector(derivative, this.xAxisRotationMatrix);
103
113
  }
104
114
 
105
115
  public draw(
@@ -1,5 +1,5 @@
1
1
  import {Vector2, clamp} from '@revideo/core';
2
- import {CurvePoint} from './CurvePoint';
2
+ import type {CurvePoint} from './CurvePoint';
3
3
  import {Segment} from './Segment';
4
4
 
5
5
  export class CircleSegment extends Segment {
@@ -1,4 +1,4 @@
1
- import {Vector2} from '@revideo/core';
1
+ import type {Vector2} from '@revideo/core';
2
2
 
3
3
  export interface CurveDrawingInfo {
4
4
  path: Path2D;
@@ -1,4 +1,4 @@
1
- import {Segment} from './Segment';
1
+ import type {Segment} from './Segment';
2
2
 
3
3
  export interface CurveProfile {
4
4
  arcLength: number;
@@ -1,4 +1,4 @@
1
- import {Vector2} from '@revideo/core';
1
+ import type {Vector2} from '@revideo/core';
2
2
 
3
3
  export type KnotAutoHandles = {start: number; end: number};
4
4
 
@@ -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.transformAsPoint(matrix));
64
+ return this.points.map(point => transformVectorAsPoint(point, matrix));
65
65
  }
66
66
 
67
67
  /**
@@ -1,5 +1,5 @@
1
- import {Vector2} from '@revideo/core';
2
- import {CurvePoint} from './CurvePoint';
1
+ import type {Vector2} from '@revideo/core';
2
+ import type {CurvePoint} from './CurvePoint';
3
3
 
4
4
  export abstract class Segment {
5
5
  public abstract readonly points: Vector2[];
@@ -1,6 +1,7 @@
1
- import {Vector2, clamp, remap} from '@revideo/core';
2
- import {CurvePoint} from './CurvePoint';
3
- import {PolynomialSegment} from './PolynomialSegment';
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 parse, {PathCommand} from 'parse-svg-path';
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, clamp} from '@revideo/core';
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, Vector2} from '@revideo/core';
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 {Color, Signal} from '@revideo/core';
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,5 +1,5 @@
1
1
  import {capitalize} from '@revideo/core';
2
- import {Layout} from '../components';
2
+ import type {Layout} from '../components';
3
3
 
4
4
  export function defaultStyle<T>(
5
5
  styleName: string,
@@ -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 {FILTERS, Filter, FilterName} from '../partials';
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 {DEFAULT, SimpleSignal} from '@revideo/core';
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, Vector2} from '@revideo/core';
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';
@@ -1,10 +1,5 @@
1
- import {
2
- createSignal,
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,4 +1,4 @@
1
- import {SimpleSignal} from '@revideo/core';
1
+ import type {SimpleSignal} from '@revideo/core';
2
2
  import {computed} from '../decorators/computed';
3
3
  import {initial, initializeSignals, signal} from '../decorators/signal';
4
4
 
@@ -1,11 +1,6 @@
1
- import {
2
- experimentalLog,
3
- SignalValue,
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.
@@ -1,4 +1,4 @@
1
- import {Color, PossibleColor} from '@revideo/core';
1
+ import type {Color, PossibleColor} from '@revideo/core';
2
2
  import type {Gradient} from './Gradient';
3
3
  import type {Pattern} from './Pattern';
4
4
 
@@ -1,17 +1,21 @@
1
- import {
1
+ import type {
2
2
  AssetInfo,
3
3
  FullSceneDescription,
4
- GeneratorScene,
5
4
  Inspectable,
6
5
  InspectedAttributes,
7
6
  InspectedElement,
8
7
  Scene,
9
- SceneRenderEvent,
10
8
  ThreadGeneratorFactory,
9
+ } from '@revideo/core';
10
+ import {
11
+ GeneratorScene,
12
+ SceneRenderEvent,
11
13
  Vector2,
14
+ transformVectorAsPoint,
12
15
  useLogger,
13
16
  } from '@revideo/core';
14
- import {Audio, Media, Node, Video, View2D} from '../components';
17
+ import type {Node} from '../components';
18
+ import {Audio, Media, Video, View2D} from '../components';
15
19
 
16
20
  export class Scene2D extends GeneratorScene<View2D> implements Inspectable {
17
21
  private view: View2D | null = null;
@@ -122,7 +126,8 @@ export class Scene2D extends GeneratorScene<View2D> implements Inspectable {
122
126
  }
123
127
 
124
128
  public transformMousePosition(x: number, y: number): Vector2 | null {
125
- return new Vector2(x, y).transformAsPoint(
129
+ return transformVectorAsPoint(
130
+ new Vector2(x, y),
126
131
  this.getView().localToParent().inverse(),
127
132
  );
128
133
  }
@@ -1,5 +1,7 @@
1
- import {BBox, Color, Spacing, Vector2} from '@revideo/core';
2
- import {CanvasStyle, Gradient, Pattern, PossibleCanvasStyle} from '../partials';
1
+ import type {BBox, Spacing} from '@revideo/core';
2
+ import {Color, Vector2} from '@revideo/core';
3
+ import type {CanvasStyle, PossibleCanvasStyle} from '../partials';
4
+ import {Gradient, Pattern} from '../partials';
3
5
 
4
6
  export function canvasStyleParser(style: PossibleCanvasStyle) {
5
7
  if (style === null) {