@revideo/2d 0.4.7-alpha.1027 → 0.4.7-beta.1025

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 (164) hide show
  1. package/editor/editor/tsconfig.build.tsbuildinfo +1 -1
  2. package/editor/index.js +380 -151
  3. package/editor/index.js.map +1 -1
  4. package/lib/code/CodeCursor.d.ts +74 -74
  5. package/lib/code/CodeDiffer.d.ts +21 -16
  6. package/lib/code/CodeDiffer.js +39 -41
  7. package/lib/code/CodeFragment.d.ts +16 -8
  8. package/lib/code/CodeFragment.js +36 -36
  9. package/lib/code/CodeHighlighter.d.ts +59 -59
  10. package/lib/code/CodeHighlighter.js +1 -1
  11. package/lib/code/CodeMetrics.d.ts +12 -8
  12. package/lib/code/CodeMetrics.js +26 -24
  13. package/lib/code/CodeRange.d.ts +21 -5
  14. package/lib/code/CodeRange.js +131 -124
  15. package/lib/code/CodeScope.d.ts +18 -8
  16. package/lib/code/CodeSelection.d.ts +9 -4
  17. package/lib/code/CodeSelection.js +8 -8
  18. package/lib/code/CodeSignal.d.ts +74 -47
  19. package/lib/code/CodeTokenizer.d.ts +1 -1
  20. package/lib/code/CodeTokenizer.js +41 -41
  21. package/lib/code/DefaultHighlightStyle.d.ts +2 -2
  22. package/lib/code/DefaultHighlightStyle.js +96 -96
  23. package/lib/code/LezerHighlighter.d.ts +21 -19
  24. package/lib/code/diff.d.ts +12 -9
  25. package/lib/code/diff.js +218 -205
  26. package/lib/code/extractRange.d.ts +7 -4
  27. package/lib/code/extractRange.js +79 -71
  28. package/lib/code/index.d.ts +1 -1
  29. package/lib/code/index.js +1 -1
  30. package/lib/components/Audio.d.ts +11 -11
  31. package/lib/components/Bezier.d.ts +18 -18
  32. package/lib/components/Circle.d.ts +95 -90
  33. package/lib/components/Code.d.ts +244 -211
  34. package/lib/components/CodeBlock.d.ts +1 -1
  35. package/lib/components/CubicBezier.d.ts +36 -36
  36. package/lib/components/Curve.d.ts +208 -198
  37. package/lib/components/Grid.d.ts +47 -42
  38. package/lib/components/HlsVideo.d.ts +62 -0
  39. package/lib/components/HlsVideo.d.ts.map +1 -0
  40. package/lib/components/HlsVideo.js +169 -0
  41. package/lib/components/Icon.d.ts +55 -50
  42. package/lib/components/Img.d.ts +86 -79
  43. package/lib/components/Knot.d.ts +97 -78
  44. package/lib/components/Latex.d.ts +12 -12
  45. package/lib/components/Layout.d.ts +455 -413
  46. package/lib/components/Line.d.ts +61 -49
  47. package/lib/components/Media.d.ts +37 -37
  48. package/lib/components/Node.d.ts +1 -1
  49. package/lib/components/Path.d.ts +1 -1
  50. package/lib/components/Polygon.d.ts +60 -55
  51. package/lib/components/QuadBezier.d.ts +29 -29
  52. package/lib/components/Ray.d.ts +28 -28
  53. package/lib/components/Rect.d.ts +115 -108
  54. package/lib/components/SVG.d.ts +1 -1
  55. package/lib/components/Shape.d.ts +1 -1
  56. package/lib/components/Spline.d.ts +46 -40
  57. package/lib/components/Txt.d.ts +55 -44
  58. package/lib/components/TxtLeaf.d.ts +20 -16
  59. package/lib/components/Video.d.ts +0 -1
  60. package/lib/components/Video.d.ts.map +1 -1
  61. package/lib/components/Video.js +2 -7
  62. package/lib/components/View2D.d.ts +22 -22
  63. package/lib/components/index.d.ts +1 -1
  64. package/lib/components/types.d.ts +22 -9
  65. package/lib/curves/ArcSegment.d.ts +36 -24
  66. package/lib/curves/CircleSegment.d.ts +26 -16
  67. package/lib/curves/CubicBezierSegment.d.ts +18 -13
  68. package/lib/curves/CurveDrawingInfo.d.ts +9 -9
  69. package/lib/curves/CurvePoint.d.ts +13 -13
  70. package/lib/curves/CurveProfile.d.ts +5 -5
  71. package/lib/curves/CurveProfile.js +1 -1
  72. package/lib/curves/KnotInfo.d.ts +8 -8
  73. package/lib/curves/LineSegment.d.ts +19 -14
  74. package/lib/curves/Polynomial.d.ts +110 -110
  75. package/lib/curves/Polynomial2D.d.ts +20 -20
  76. package/lib/curves/PolynomialSegment.d.ts +42 -37
  77. package/lib/curves/QuadBezierSegment.d.ts +12 -12
  78. package/lib/curves/Segment.d.ts +12 -7
  79. package/lib/curves/UniformPolynomialCurveSampler.d.ts +34 -34
  80. package/lib/curves/createCurveProfileLerp.d.ts +17 -6
  81. package/lib/curves/getBezierSplineProfile.d.ts +8 -4
  82. package/lib/curves/getCircleProfile.d.ts +10 -4
  83. package/lib/curves/getPathProfile.d.ts +2 -2
  84. package/lib/curves/getPointAtDistance.d.ts +7 -4
  85. package/lib/curves/getPolylineProfile.d.ts +8 -4
  86. package/lib/curves/getRectProfile.d.ts +9 -4
  87. package/lib/curves/index.d.ts +1 -1
  88. package/lib/curves/index.js +1 -1
  89. package/lib/decorators/canvasStyleSignal.d.ts +3 -3
  90. package/lib/decorators/colorSignal.d.ts +1 -1
  91. package/lib/decorators/compound.d.ts +4 -2
  92. package/lib/decorators/computed.d.ts +1 -1
  93. package/lib/decorators/defaultStyle.d.ts +5 -2
  94. package/lib/decorators/filtersSignal.d.ts +28 -8
  95. package/lib/decorators/index.d.ts +1 -1
  96. package/lib/decorators/index.js +1 -1
  97. package/lib/decorators/initializers.d.ts +5 -2
  98. package/lib/decorators/initializers.js +18 -19
  99. package/lib/decorators/nodeName.d.ts +1 -1
  100. package/lib/decorators/nodeName.js +4 -4
  101. package/lib/decorators/signal.d.ts +40 -20
  102. package/lib/decorators/spacingSignal.d.ts +1 -1
  103. package/lib/decorators/vector2Signal.d.ts +13 -7
  104. package/lib/index.d.ts +1 -1
  105. package/lib/index.js +1 -1
  106. package/lib/jsx-dev-runtime.d.ts +3 -3
  107. package/lib/jsx-dev-runtime.js +3 -3
  108. package/lib/jsx-runtime.d.ts +19 -9
  109. package/lib/jsx-runtime.js +18 -18
  110. package/lib/partials/Filter.d.ts +24 -16
  111. package/lib/partials/Gradient.d.ts +30 -24
  112. package/lib/partials/Pattern.d.ts +14 -9
  113. package/lib/partials/ShaderConfig.d.ts +81 -74
  114. package/lib/partials/index.d.ts +1 -1
  115. package/lib/partials/index.js +1 -1
  116. package/lib/partials/types.d.ts +19 -6
  117. package/lib/scenes/Scene2D.d.ts +42 -23
  118. package/lib/scenes/index.d.ts +1 -1
  119. package/lib/scenes/index.js +1 -1
  120. package/lib/scenes/makeScene2D.d.ts +7 -5
  121. package/lib/scenes/useScene2D.d.ts +2 -2
  122. package/lib/tsconfig.build.tsbuildinfo +1 -1
  123. package/lib/tsconfig.tsbuildinfo +1 -0
  124. package/lib/utils/diff.d.ts +25 -18
  125. package/lib/utils/diff.js +84 -87
  126. package/lib/utils/index.d.ts +1 -1
  127. package/lib/utils/index.js +1 -1
  128. package/lib/utils/is.d.ts +4 -2
  129. package/lib/utils/is.js +2 -2
  130. package/lib/utils/makeSignalExtensions.d.ts +11 -4
  131. package/lib/utils/video/mp4-parser-manager.d.ts +0 -1
  132. package/lib/utils/video/mp4-parser-manager.d.ts.map +1 -1
  133. package/lib/utils/video/mp4-parser-manager.js +4 -21
  134. package/lib/utils/video/mp4-parser.d.ts +63 -0
  135. package/lib/utils/video/mp4-parser.d.ts.map +1 -0
  136. package/lib/utils/video/mp4-parser.js +264 -0
  137. package/package.json +4 -4
  138. package/src/lib/components/Video.ts +1 -7
  139. package/src/lib/utils/video/mp4-parser-manager.ts +5 -24
  140. package/src/lib/utils/video/mp4-parser.ts +340 -0
  141. package/lib/utils/video/parser/index.d.ts +0 -2
  142. package/lib/utils/video/parser/index.d.ts.map +0 -1
  143. package/lib/utils/video/parser/index.js +0 -2
  144. package/lib/utils/video/parser/parser.d.ts +0 -21
  145. package/lib/utils/video/parser/parser.d.ts.map +0 -1
  146. package/lib/utils/video/parser/parser.js +0 -165
  147. package/lib/utils/video/parser/sampler.d.ts +0 -16
  148. package/lib/utils/video/parser/sampler.d.ts.map +0 -1
  149. package/lib/utils/video/parser/sampler.js +0 -56
  150. package/lib/utils/video/parser/segment.d.ts +0 -43
  151. package/lib/utils/video/parser/segment.d.ts.map +0 -1
  152. package/lib/utils/video/parser/segment.js +0 -153
  153. package/lib/utils/video/parser/sink.d.ts +0 -9
  154. package/lib/utils/video/parser/sink.d.ts.map +0 -1
  155. package/lib/utils/video/parser/sink.js +0 -22
  156. package/lib/utils/video/parser/utils.d.ts +0 -10
  157. package/lib/utils/video/parser/utils.d.ts.map +0 -1
  158. package/lib/utils/video/parser/utils.js +0 -22
  159. package/src/lib/utils/video/parser/index.ts +0 -1
  160. package/src/lib/utils/video/parser/parser.ts +0 -253
  161. package/src/lib/utils/video/parser/sampler.ts +0 -72
  162. package/src/lib/utils/video/parser/segment.ts +0 -202
  163. package/src/lib/utils/video/parser/sink.ts +0 -29
  164. package/src/lib/utils/video/parser/utils.ts +0 -31
package/editor/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import './index.css';
2
1
  import { useApplication, useCurrentScene, Pane, Separator, Group, Label, Button, findAndOpenFirstUserFile, UnknownField, AutoField, useViewportContext, useViewportMatrix, OverlayWrapper, MouseButton, Toggle, Collapse, usePanels, useReducedMotion, emphasize, Tab, AccountTree, makeEditorPlugin } from '@revideo/ui';
3
- import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
4
2
  import { signal, computed, useSignalEffect, useComputed, useSignal } from '@preact/signals';
3
+ import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
5
4
  import { SceneRenderEvent, Vector2 } from '@revideo/core';
6
5
  import { createContext } from 'preact';
7
6
  import { useMemo, useContext, useRef, useEffect } from 'preact/hooks';
8
7
  import { NODE_NAME } from '@revideo/2d';
8
+ import './index.css';
9
9
 
10
10
  const PluginContext = createContext(null);
11
11
  const NodeInspectorKey = '@revideo/2d/node-inspector';
@@ -69,32 +69,73 @@ function Provider({ children }) {
69
69
  }
70
70
 
71
71
  function Component$1() {
72
- const { inspection } = useApplication();
73
- const { scene, afterRender } = usePluginState();
74
- const node = useComputed(() => {
75
- afterRender.value;
76
- const { payload } = inspection.value;
77
- return scene.value?.getNode(payload);
78
- });
79
- const attributes = useComputed(() => {
80
- afterRender.value;
81
- const currentNode = node.value;
82
- const attributes = [];
83
- if (currentNode) {
84
- for (const { key, meta, signal } of currentNode) {
85
- if (!meta.inspectable)
86
- continue;
87
- attributes.push([key, signal()]);
88
- }
89
- }
90
- return attributes;
91
- });
92
- const stack = node.value?.creationStack;
93
- return (jsxs(Pane, { title: "Node Inspector", id: "node-inspector-pane", children: [jsx(Separator, { size: 1 }), stack && (jsxs(Group, { children: [jsx(Label, {}), jsx(Button, { onClick: () => findAndOpenFirstUserFile(stack), main: true, children: "GO TO SOURCE" })] })), jsxs(Group, { children: [jsx(Label, { children: "key" }), jsx(UnknownField, { value: inspection.value.payload })] }), !node.value && (jsxs(Group, { children: [jsx(Label, {}), "Couldn't find the node. It may have been deleted or doesn't exist yet."] })), attributes.value.map(([key, value]) => (jsxs(Group, { children: [jsx(Label, { children: key }), jsx(AutoField, { value: value })] }, key)))] }));
72
+ const {inspection} = useApplication();
73
+ const {scene, afterRender} = usePluginState();
74
+ const node = useComputed(() => {
75
+ afterRender.value;
76
+ const {payload} = inspection.value;
77
+ return scene.value?.getNode(payload);
78
+ });
79
+ const attributes = useComputed(() => {
80
+ afterRender.value;
81
+ const currentNode = node.value;
82
+ const attributes = [];
83
+ if (currentNode) {
84
+ for (const {key, meta, signal} of currentNode) {
85
+ if (!meta.inspectable) continue;
86
+ attributes.push([key, signal()]);
87
+ }
88
+ }
89
+ return attributes;
90
+ });
91
+ const stack = node.value?.creationStack;
92
+ return jsxs(Pane, {
93
+ title: 'Node Inspector',
94
+ id: 'node-inspector-pane',
95
+ children: [
96
+ jsx(Separator, {size: 1}),
97
+ stack &&
98
+ jsxs(Group, {
99
+ children: [
100
+ jsx(Label, {}),
101
+ jsx(Button, {
102
+ onClick: () => findAndOpenFirstUserFile(stack),
103
+ main: true,
104
+ children: 'GO TO SOURCE',
105
+ }),
106
+ ],
107
+ }),
108
+ jsxs(Group, {
109
+ children: [
110
+ jsx(Label, {children: 'key'}),
111
+ jsx(UnknownField, {value: inspection.value.payload}),
112
+ ],
113
+ }),
114
+ !node.value &&
115
+ jsxs(Group, {
116
+ children: [
117
+ jsx(Label, {}),
118
+ "Couldn't find the node. It may have been deleted or doesn't exist yet.",
119
+ ],
120
+ }),
121
+ attributes.value.map(([key, value]) =>
122
+ jsxs(
123
+ Group,
124
+ {
125
+ children: [
126
+ jsx(Label, {children: key}),
127
+ jsx(AutoField, {value: value}),
128
+ ],
129
+ },
130
+ key,
131
+ ),
132
+ ),
133
+ ],
134
+ });
94
135
  }
95
136
  const NodeInspectorConfig = {
96
- key: NodeInspectorKey,
97
- component: Component$1,
137
+ key: NodeInspectorKey,
138
+ component: Component$1,
98
139
  };
99
140
 
100
141
  function Component({ children }) {
@@ -137,78 +178,184 @@ const PreviewOverlayConfig = {
137
178
  };
138
179
 
139
180
  function CircleIcon() {
140
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M10,5C12.76,5 15,7.24 15,10C15,12.76 12.76,15 10,15C7.24,15 5,12.76 5,10C5,7.24 7.24,5 10,5ZM10,7C8.344,7 7,8.344 7,10C7,11.656 8.344,13 10,13C11.656,13 13,11.656 13,10C13,8.344 11.656,7 10,7Z" }) }));
181
+ return jsx('svg', {
182
+ viewBox: '0 0 20 20',
183
+ fill: 'currentColor',
184
+ children: jsx('path', {
185
+ d: 'M10,5C12.76,5 15,7.24 15,10C15,12.76 12.76,15 10,15C7.24,15 5,12.76 5,10C5,7.24 7.24,5 10,5ZM10,7C8.344,7 7,8.344 7,10C7,11.656 8.344,13 10,13C11.656,13 13,11.656 13,10C13,8.344 11.656,7 10,7Z',
186
+ }),
187
+ });
141
188
  }
142
189
 
143
190
  function CodeBlockIcon() {
144
- return (jsxs("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: [jsx("path", { d: "M5,9L5,6.999C5,6.469 5.211,5.96 5.585,5.586C5.96,5.211 6.469,5 6.999,5L9,5L9,7L6.999,7L7,9L7,11L7,13L8.985,13L9,15L7,15C5.895,15 5,14.105 5,13L5,11L4,11L4,9L5,9Z" }), jsx("path", { d: "M15,11L15,13.001C15,13.531 14.789,14.04 14.415,14.414C14.04,14.789 13.531,15 13.001,15L11,15L11,13L13,13L13,11L13,9L13,7L11.015,7L11,5L13,5C14.105,5 15,5.895 15,7L15,9L16,9L16,11L15,11Z" })] }));
191
+ return jsxs('svg', {
192
+ viewBox: '0 0 20 20',
193
+ fill: 'currentColor',
194
+ children: [
195
+ jsx('path', {
196
+ d: 'M5,9L5,6.999C5,6.469 5.211,5.96 5.585,5.586C5.96,5.211 6.469,5 6.999,5L9,5L9,7L6.999,7L7,9L7,11L7,13L8.985,13L9,15L7,15C5.895,15 5,14.105 5,13L5,11L4,11L4,9L5,9Z',
197
+ }),
198
+ jsx('path', {
199
+ d: 'M15,11L15,13.001C15,13.531 14.789,14.04 14.415,14.414C14.04,14.789 13.531,15 13.001,15L11,15L11,13L13,13L13,11L13,9L13,7L11.015,7L11,5L13,5C14.105,5 15,5.895 15,7L15,9L16,9L16,11L15,11Z',
200
+ }),
201
+ ],
202
+ });
145
203
  }
146
204
 
147
205
  function CurveIcon() {
148
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M12.19,6.47L13.595,5.047C15.519,6.947 15.187,8.932 14.229,9.951C13.675,10.541 12.879,10.861 12.016,10.767C11.261,10.685 10.426,10.278 9.708,9.348C9.292,8.809 8.878,8.441 8.471,8.249C8.217,8.13 7.979,8.084 7.77,8.154C7.565,8.222 7.409,8.394 7.287,8.621C7.097,8.975 7.001,9.444 7,10.003C6.996,11.584 7.848,12.746 8.91,12.946C9.535,13.064 10.185,12.783 10.687,12.082L12.313,13.247C11,15.079 9.118,15.344 7.581,14.591C6.161,13.896 4.994,12.246 5,9.997C5.005,7.945 5.963,6.649 7.136,6.257C8.281,5.874 9.866,6.278 11.292,8.126C11.81,8.799 12.421,8.954 12.772,8.581C13.196,8.13 13.042,7.312 12.19,6.47Z" }) }));
206
+ return jsx('svg', {
207
+ viewBox: '0 0 20 20',
208
+ fill: 'currentColor',
209
+ children: jsx('path', {
210
+ d: 'M12.19,6.47L13.595,5.047C15.519,6.947 15.187,8.932 14.229,9.951C13.675,10.541 12.879,10.861 12.016,10.767C11.261,10.685 10.426,10.278 9.708,9.348C9.292,8.809 8.878,8.441 8.471,8.249C8.217,8.13 7.979,8.084 7.77,8.154C7.565,8.222 7.409,8.394 7.287,8.621C7.097,8.975 7.001,9.444 7,10.003C6.996,11.584 7.848,12.746 8.91,12.946C9.535,13.064 10.185,12.783 10.687,12.082L12.313,13.247C11,15.079 9.118,15.344 7.581,14.591C6.161,13.896 4.994,12.246 5,9.997C5.005,7.945 5.963,6.649 7.136,6.257C8.281,5.874 9.866,6.278 11.292,8.126C11.81,8.799 12.421,8.954 12.772,8.581C13.196,8.13 13.042,7.312 12.19,6.47Z',
211
+ }),
212
+ });
149
213
  }
150
214
 
151
215
  function GridIcon() {
152
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M6,8L4,8L4,6L6,6L6,4L8,4L8,6L12,6L12,4L14,4L14,6L16,6L16,8L14,8L14,12L16,12L16,14L14,14L14,16L12,16L12,14L8,14L8,16L6,16L6,14L4,14L4,12L6,12L6,8ZM8,12L12,12L12,8L8,8L8,12Z" }) }));
216
+ return jsx('svg', {
217
+ viewBox: '0 0 20 20',
218
+ fill: 'currentColor',
219
+ children: jsx('path', {
220
+ d: 'M6,8L4,8L4,6L6,6L6,4L8,4L8,6L12,6L12,4L14,4L14,6L16,6L16,8L14,8L14,12L16,12L16,14L14,14L14,16L12,16L12,14L8,14L8,16L6,16L6,14L4,14L4,12L6,12L6,8ZM8,12L12,12L12,8L8,8L8,12Z',
221
+ }),
222
+ });
153
223
  }
154
224
 
155
225
  function ImgIcon() {
156
- return (jsxs("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: [jsx("path", { d: "M5,15L15,15L15,10L13,8L8,13L5,10L5,15Z" }), jsx("circle", { cx: "8", cy: "7", r: "2" })] }));
226
+ return jsxs('svg', {
227
+ viewBox: '0 0 20 20',
228
+ fill: 'currentColor',
229
+ children: [
230
+ jsx('path', {d: 'M5,15L15,15L15,10L13,8L8,13L5,10L5,15Z'}),
231
+ jsx('circle', {cx: '8', cy: '7', r: '2'}),
232
+ ],
233
+ });
157
234
  }
158
235
 
159
236
  function LayoutIcon() {
160
- return (jsxs("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: [jsx("path", { d: "M14,5C14.552,5 15,5.448 15,6C15,7.916 15,12.084 15,14C15,14.552 14.552,15 14,15C12.815,15 11,15 11,15L11,5L14,5Z" }), jsx("path", { d: "M9,5L9,9L5,9L5,6C5,5.448 5.448,5 6,5L9,5Z" }), jsx("path", { d: "M9,11L9,15L6,15C5.448,15 5,14.552 5,14L5,11L9,11Z" })] }));
237
+ return jsxs('svg', {
238
+ viewBox: '0 0 20 20',
239
+ fill: 'currentColor',
240
+ children: [
241
+ jsx('path', {
242
+ d: 'M14,5C14.552,5 15,5.448 15,6C15,7.916 15,12.084 15,14C15,14.552 14.552,15 14,15C12.815,15 11,15 11,15L11,5L14,5Z',
243
+ }),
244
+ jsx('path', {d: 'M9,5L9,9L5,9L5,6C5,5.448 5.448,5 6,5L9,5Z'}),
245
+ jsx('path', {d: 'M9,11L9,15L6,15C5.448,15 5,14.552 5,14L5,11L9,11Z'}),
246
+ ],
247
+ });
161
248
  }
162
249
 
163
250
  function LineIcon() {
164
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M9.906,4.589L11.411,5.906L8.529,9.2L13.859,8.439C14.273,8.379 14.68,8.584 14.879,8.952C15.078,9.319 15.028,9.772 14.753,10.087L10.094,15.411L8.589,14.094L11.471,10.8L6.141,11.561C5.727,11.621 5.32,11.416 5.121,11.048C4.922,10.681 4.972,10.228 5.247,9.913L9.906,4.589Z" }) }));
251
+ return jsx('svg', {
252
+ viewBox: '0 0 20 20',
253
+ fill: 'currentColor',
254
+ children: jsx('path', {
255
+ d: 'M9.906,4.589L11.411,5.906L8.529,9.2L13.859,8.439C14.273,8.379 14.68,8.584 14.879,8.952C15.078,9.319 15.028,9.772 14.753,10.087L10.094,15.411L8.589,14.094L11.471,10.8L6.141,11.561C5.727,11.621 5.32,11.416 5.121,11.048C4.922,10.681 4.972,10.228 5.247,9.913L9.906,4.589Z',
256
+ }),
257
+ });
165
258
  }
166
259
 
167
260
  function NodeIcon() {
168
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M7,9L5,9L5,7L7,7L7,5L9,5L9,7L12,7L12,5L15,8L12,11L12,9L9,9L9,12L11,12L8,15L5,12L7,12L7,9Z" }) }));
261
+ return jsx('svg', {
262
+ viewBox: '0 0 20 20',
263
+ fill: 'currentColor',
264
+ children: jsx('path', {
265
+ d: 'M7,9L5,9L5,7L7,7L7,5L9,5L9,7L12,7L12,5L15,8L12,11L12,9L9,9L9,12L11,12L8,15L5,12L7,12L7,9Z',
266
+ }),
267
+ });
169
268
  }
170
269
 
171
270
  function RayIcon() {
172
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M12,9.414L6.707,14.707L5.293,13.293L10.586,8L8,8L8,6L13,6C13.552,6 14,6.448 14,7L14,12L12,12L12,9.414Z" }) }));
271
+ return jsx('svg', {
272
+ viewBox: '0 0 20 20',
273
+ fill: 'currentColor',
274
+ children: jsx('path', {
275
+ d: 'M12,9.414L6.707,14.707L5.293,13.293L10.586,8L8,8L8,6L13,6C13.552,6 14,6.448 14,7L14,12L12,12L12,9.414Z',
276
+ }),
277
+ });
173
278
  }
174
279
 
175
280
  function RectIcon() {
176
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M15,6L15,14C15,14.552 14.552,15 14,15L6,15C5.448,15 5,14.552 5,14L5,6C5,5.448 5.448,5 6,5L14,5C14.552,5 15,5.448 15,6ZM13,7L7,7L7,13L13,13L13,7Z" }) }));
281
+ return jsx('svg', {
282
+ viewBox: '0 0 20 20',
283
+ fill: 'currentColor',
284
+ children: jsx('path', {
285
+ d: 'M15,6L15,14C15,14.552 14.552,15 14,15L6,15C5.448,15 5,14.552 5,14L5,6C5,5.448 5.448,5 6,5L14,5C14.552,5 15,5.448 15,6ZM13,7L7,7L7,13L13,13L13,7Z',
286
+ }),
287
+ });
177
288
  }
178
289
 
179
290
  function ShapeIcon() {
180
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M11.746,10.93C12.637,12.664 11.973,14.504 10.611,15.244C9.692,15.743 8.385,15.804 6.94,14.829C5.555,13.893 4.689,12.16 4.544,10.388C4.395,8.572 5,6.752 6.399,5.701C8.069,4.445 10.793,4.271 12.765,4.921C14.324,5.436 15.374,6.473 15.495,7.691C15.651,9.262 14.613,10.061 13.26,10.5C12.847,10.634 12.41,10.735 12.02,10.841C11.936,10.864 11.838,10.897 11.746,10.93ZM7.601,7.299C6.737,7.949 6.445,9.103 6.537,10.224C6.633,11.389 7.149,12.556 8.06,13.171C8.696,13.601 9.251,13.706 9.656,13.486C10.207,13.187 10.315,12.395 9.886,11.701C9.48,11.044 9.513,10.523 9.68,10.122C9.835,9.75 10.164,9.417 10.678,9.187C11.243,8.935 12.157,8.8 12.908,8.503C13.216,8.381 13.542,8.264 13.505,7.888C13.485,7.691 13.359,7.53 13.197,7.384C12.928,7.143 12.558,6.959 12.138,6.821C10.736,6.358 8.789,6.406 7.601,7.299Z" }) }));
291
+ return jsx('svg', {
292
+ viewBox: '0 0 20 20',
293
+ fill: 'currentColor',
294
+ children: jsx('path', {
295
+ d: 'M11.746,10.93C12.637,12.664 11.973,14.504 10.611,15.244C9.692,15.743 8.385,15.804 6.94,14.829C5.555,13.893 4.689,12.16 4.544,10.388C4.395,8.572 5,6.752 6.399,5.701C8.069,4.445 10.793,4.271 12.765,4.921C14.324,5.436 15.374,6.473 15.495,7.691C15.651,9.262 14.613,10.061 13.26,10.5C12.847,10.634 12.41,10.735 12.02,10.841C11.936,10.864 11.838,10.897 11.746,10.93ZM7.601,7.299C6.737,7.949 6.445,9.103 6.537,10.224C6.633,11.389 7.149,12.556 8.06,13.171C8.696,13.601 9.251,13.706 9.656,13.486C10.207,13.187 10.315,12.395 9.886,11.701C9.48,11.044 9.513,10.523 9.68,10.122C9.835,9.75 10.164,9.417 10.678,9.187C11.243,8.935 12.157,8.8 12.908,8.503C13.216,8.381 13.542,8.264 13.505,7.888C13.485,7.691 13.359,7.53 13.197,7.384C12.928,7.143 12.558,6.959 12.138,6.821C10.736,6.358 8.789,6.406 7.601,7.299Z',
296
+ }),
297
+ });
181
298
  }
182
299
 
183
300
  function TxtIcon() {
184
- return (jsxs("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: [jsx("path", { d: "M9,13L9,6L11,6L11,13L12,13L12,15L8,15L8,13L9,13Z" }), jsx("path", { d: "M7,8L5,8L5,6C5,5.448 5.448,5 6,5L14,5C14.552,5 15,5.448 15,6L15,8L13,8L13,7L7,7L7,8Z" })] }));
301
+ return jsxs('svg', {
302
+ viewBox: '0 0 20 20',
303
+ fill: 'currentColor',
304
+ children: [
305
+ jsx('path', {d: 'M9,13L9,6L11,6L11,13L12,13L12,15L8,15L8,13L9,13Z'}),
306
+ jsx('path', {
307
+ d: 'M7,8L5,8L5,6C5,5.448 5.448,5 6,5L14,5C14.552,5 15,5.448 15,6L15,8L13,8L13,7L7,7L7,8Z',
308
+ }),
309
+ ],
310
+ });
185
311
  }
186
312
 
187
313
  function VideoIcon() {
188
- return (jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: jsx("path", { d: "M14,10.866L7.25,14.763C6.941,14.942 6.559,14.942 6.25,14.763C5.941,14.585 5.75,14.254 5.75,13.897L5.75,6.103C5.75,5.746 5.941,5.415 6.25,5.237C6.559,5.058 6.941,5.058 7.25,5.237L14,9.134C14.309,9.313 14.5,9.643 14.5,10C14.5,10.357 14.309,10.687 14,10.866ZM11.5,10L7.75,7.835L7.75,12.165L11.5,10Z" }) }));
314
+ return jsx('svg', {
315
+ viewBox: '0 0 20 20',
316
+ fill: 'currentColor',
317
+ children: jsx('path', {
318
+ d: 'M14,10.866L7.25,14.763C6.941,14.942 6.559,14.942 6.25,14.763C5.941,14.585 5.75,14.254 5.75,13.897L5.75,6.103C5.75,5.746 5.941,5.415 6.25,5.237C6.559,5.058 6.941,5.058 7.25,5.237L14,9.134C14.309,9.313 14.5,9.643 14.5,10C14.5,10.357 14.309,10.687 14,10.866ZM11.5,10L7.75,7.835L7.75,12.165L11.5,10Z',
319
+ }),
320
+ });
189
321
  }
190
322
 
191
323
  function View2DIcon() {
192
- return (jsxs("svg", { viewBox: "0 0 20 20", fill: "currentColor", children: [jsx("path", { d: "M9,5L9,7L7,7L7,9L5,9L5,6C5,5.448 5.448,5 6,5L9,5Z" }), jsx("path", { d: "M5,11L7,11L7,13L9,13L9,15L6,15C5.448,15 5,14.552 5,14L5,11Z" }), jsx("path", { d: "M11,15L11,13L13,13L13,11L15,11L15,14C15,14.552 14.552,15 14,15L11,15Z" }), jsx("path", { d: "M15,9L13,9L13,7L11,7L11,5L14,5C14.552,5 15,5.448 15,6L15,9Z" })] }));
324
+ return jsxs('svg', {
325
+ viewBox: '0 0 20 20',
326
+ fill: 'currentColor',
327
+ children: [
328
+ jsx('path', {d: 'M9,5L9,7L7,7L7,9L5,9L5,6C5,5.448 5.448,5 6,5L9,5Z'}),
329
+ jsx('path', {
330
+ d: 'M5,11L7,11L7,13L9,13L9,15L6,15C5.448,15 5,14.552 5,14L5,11Z',
331
+ }),
332
+ jsx('path', {
333
+ d: 'M11,15L11,13L13,13L13,11L15,11L15,14C15,14.552 14.552,15 14,15L11,15Z',
334
+ }),
335
+ jsx('path', {
336
+ d: 'M15,9L13,9L13,7L11,7L11,5L14,5C14.552,5 15,5.448 15,6L15,9Z',
337
+ }),
338
+ ],
339
+ });
193
340
  }
194
341
 
195
342
  /* eslint-disable @typescript-eslint/naming-convention */
196
343
  const IconMap = {
197
- Circle: CircleIcon,
198
- CodeBlock: CodeBlockIcon,
199
- Curve: CurveIcon,
200
- Grid: GridIcon,
201
- Img: ImgIcon,
202
- Layout: LayoutIcon,
203
- Line: LineIcon,
204
- Node: NodeIcon,
205
- Ray: RayIcon,
206
- Rect: RectIcon,
207
- Shape: ShapeIcon,
208
- Txt: TxtIcon,
209
- TxtLeaf: TxtIcon,
210
- Video: VideoIcon,
211
- View2D: View2DIcon,
344
+ Circle: CircleIcon,
345
+ CodeBlock: CodeBlockIcon,
346
+ Curve: CurveIcon,
347
+ Grid: GridIcon,
348
+ Img: ImgIcon,
349
+ Layout: LayoutIcon,
350
+ Line: LineIcon,
351
+ Node: NodeIcon,
352
+ Ray: RayIcon,
353
+ Rect: RectIcon,
354
+ Shape: ShapeIcon,
355
+ Txt: TxtIcon,
356
+ TxtLeaf: TxtIcon,
357
+ Video: VideoIcon,
358
+ View2D: View2DIcon,
212
359
  };
213
360
 
214
361
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
@@ -216,124 +363,206 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
216
363
  var styles = {"root":"index-module_root__omEd0","label":"index-module_label__9BJvW","active":"index-module_active__KevXv","parent":"index-module_parent__5nc9I"};
217
364
 
218
365
  const DEPTH_VAR = '--depth';
219
- function TreeElement({ label, children, selected, depth = 0, open, icon, forwardRef, ...props }) {
220
- const hasChildren = !!children;
221
- return (jsxs(Fragment, { children: [jsxs("div", { ref: forwardRef, className: clsx(styles.label, selected && styles.active, hasChildren && styles.parent), onDblClick: () => {
222
- if (hasChildren) {
223
- open.value = !open.value;
224
- }
225
- }, ...props, style: { [DEPTH_VAR]: `${depth}` }, children: [hasChildren && (jsx(Toggle, { animated: false, open: open.value, onToggle: value => {
226
- open.value = value;
227
- }, onDblClick: e => {
228
- e.stopPropagation();
229
- } })), icon, label] }), hasChildren && (jsx(Collapse, { open: open.value, animated: false, children: children }))] }));
366
+ function TreeElement({
367
+ label,
368
+ children,
369
+ selected,
370
+ depth = 0,
371
+ open,
372
+ icon,
373
+ forwardRef,
374
+ ...props
375
+ }) {
376
+ const hasChildren = !!children;
377
+ return jsxs(Fragment, {
378
+ children: [
379
+ jsxs('div', {
380
+ ref: forwardRef,
381
+ className: clsx(
382
+ styles.label,
383
+ selected && styles.active,
384
+ hasChildren && styles.parent,
385
+ ),
386
+ onDblClick: () => {
387
+ if (hasChildren) {
388
+ open.value = !open.value;
389
+ }
390
+ },
391
+ ...props,
392
+ style: {[DEPTH_VAR]: `${depth}`},
393
+ children: [
394
+ hasChildren &&
395
+ jsx(Toggle, {
396
+ animated: false,
397
+ open: open.value,
398
+ onToggle: value => {
399
+ open.value = value;
400
+ },
401
+ onDblClick: e => {
402
+ e.stopPropagation();
403
+ },
404
+ }),
405
+ icon,
406
+ label,
407
+ ],
408
+ }),
409
+ hasChildren &&
410
+ jsx(Collapse, {open: open.value, animated: false, children: children}),
411
+ ],
412
+ });
230
413
  }
231
414
 
232
- function NodeElement({ node, depth = 0 }) {
233
- const { selectedKey, hoveredKey, openNodes, selectedChain, afterRender } = usePluginState();
234
- const ref = useRef(null);
235
- const open = useSignal(selectedChain.peek().has(node.key) || (openNodes.get(node.key) ?? false));
236
- const nodeSignal = useSignal(node);
237
- nodeSignal.value = node;
238
- const children = useComputed(() => {
239
- afterRender.value;
240
- return nodeSignal.value.peekChildren();
241
- });
242
- useSignalEffect(() => {
243
- open.value = openNodes.get(nodeSignal.value.key) ?? false;
244
- });
245
- useSignalEffect(() => {
246
- const chain = selectedChain.value;
247
- if (chain.has(nodeSignal.value.key)) {
248
- open.value = true;
249
- }
250
- });
251
- useSignalEffect(() => {
252
- openNodes.set(nodeSignal.value.key, open.value);
253
- });
254
- useSignalEffect(() => {
255
- const key = selectedKey.value;
256
- if (node.key === key) {
257
- ref.current?.scrollIntoView({ block: 'nearest', behavior: 'instant' });
258
- }
259
- });
260
- const Icon = IconMap[node[NODE_NAME]] ?? IconMap.Node;
261
- return (jsx(TreeElement, { forwardRef: ref, open: open, depth: depth, icon: jsx(Icon, {}), label: node.key, selected: selectedKey.value === node.key, onClick: event => {
262
- selectedKey.value = node.key;
263
- event.stopPropagation();
264
- }, onPointerEnter: () => (hoveredKey.value = node.key), onPointerLeave: () => (hoveredKey.value = null), children: children.value.length > 0 &&
265
- children.value.map(child => (jsx(NodeElement, { node: child, depth: depth + 1 }))) }));
415
+ function NodeElement({node, depth = 0}) {
416
+ const {selectedKey, hoveredKey, openNodes, selectedChain, afterRender} =
417
+ usePluginState();
418
+ const ref = useRef(null);
419
+ const open = useSignal(
420
+ selectedChain.peek().has(node.key) || (openNodes.get(node.key) ?? false),
421
+ );
422
+ const nodeSignal = useSignal(node);
423
+ nodeSignal.value = node;
424
+ const children = useComputed(() => {
425
+ afterRender.value;
426
+ return nodeSignal.value.peekChildren();
427
+ });
428
+ useSignalEffect(() => {
429
+ open.value = openNodes.get(nodeSignal.value.key) ?? false;
430
+ });
431
+ useSignalEffect(() => {
432
+ const chain = selectedChain.value;
433
+ if (chain.has(nodeSignal.value.key)) {
434
+ open.value = true;
435
+ }
436
+ });
437
+ useSignalEffect(() => {
438
+ openNodes.set(nodeSignal.value.key, open.value);
439
+ });
440
+ useSignalEffect(() => {
441
+ const key = selectedKey.value;
442
+ if (node.key === key) {
443
+ ref.current?.scrollIntoView({block: 'nearest', behavior: 'instant'});
444
+ }
445
+ });
446
+ const Icon = IconMap[node[NODE_NAME]] ?? IconMap.Node;
447
+ return jsx(TreeElement, {
448
+ forwardRef: ref,
449
+ open: open,
450
+ depth: depth,
451
+ icon: jsx(Icon, {}),
452
+ label: node.key,
453
+ selected: selectedKey.value === node.key,
454
+ onClick: event => {
455
+ selectedKey.value = node.key;
456
+ event.stopPropagation();
457
+ },
458
+ onPointerEnter: () => (hoveredKey.value = node.key),
459
+ onPointerLeave: () => (hoveredKey.value = null),
460
+ children:
461
+ children.value.length > 0 &&
462
+ children.value.map(child =>
463
+ jsx(NodeElement, {node: child, depth: depth + 1}),
464
+ ),
465
+ });
266
466
  }
267
467
 
268
- function TreeRoot({ className, ...props }) {
269
- return jsx("div", { className: clsx(styles.root, className), ...props });
468
+ function TreeRoot({className, ...props}) {
469
+ return jsx('div', {className: clsx(styles.root, className), ...props});
270
470
  }
271
471
 
272
472
  function DetachedRoot() {
273
- const { afterRender, scene } = usePluginState();
274
- const open = useSignal(false);
275
- const currentScene = scene.value;
276
- const children = currentScene ? [...currentScene.getDetachedNodes()] : [];
277
- afterRender.value;
278
- return children.length > 0 ? (jsx(TreeRoot, { children: jsx(TreeElement, { open: open, label: "Detached nodes", children: children.map(child => (jsx(NodeElement, { node: child, depth: 1 }))) }) })) : null;
473
+ const {afterRender, scene} = usePluginState();
474
+ const open = useSignal(false);
475
+ const currentScene = scene.value;
476
+ const children = currentScene ? [...currentScene.getDetachedNodes()] : [];
477
+ afterRender.value;
478
+ return children.length > 0
479
+ ? jsx(TreeRoot, {
480
+ children: jsx(TreeElement, {
481
+ open: open,
482
+ label: 'Detached nodes',
483
+ children: children.map(child =>
484
+ jsx(NodeElement, {node: child, depth: 1}),
485
+ ),
486
+ }),
487
+ })
488
+ : null;
279
489
  }
280
490
 
281
491
  function ViewRoot() {
282
- const { scene } = usePluginState();
283
- const view = useSignal(scene.value?.getView());
284
- useSignalEffect(() => {
285
- view.value = scene.value?.getView();
286
- return scene.value?.onReset.subscribe(() => {
287
- view.value = scene.value?.getView();
288
- });
492
+ const {scene} = usePluginState();
493
+ const view = useSignal(scene.value?.getView());
494
+ useSignalEffect(() => {
495
+ view.value = scene.value?.getView();
496
+ return scene.value?.onReset.subscribe(() => {
497
+ view.value = scene.value?.getView();
289
498
  });
290
- return view.value ? (jsx(TreeRoot, { children: jsx(NodeElement, { node: view.value }) })) : null;
499
+ });
500
+ return view.value
501
+ ? jsx(TreeRoot, {children: jsx(NodeElement, {node: view.value})})
502
+ : null;
291
503
  }
292
504
 
293
- function TabComponent({ tab }) {
294
- const { sidebar } = usePanels();
295
- const inspectorTab = useRef(null);
296
- const reducedMotion = useReducedMotion();
297
- const { selectedKey } = usePluginState();
298
- const { logger } = useApplication();
299
- useEffect(() => logger.onInspected.subscribe(key => {
505
+ function TabComponent({tab}) {
506
+ const {sidebar} = usePanels();
507
+ const inspectorTab = useRef(null);
508
+ const reducedMotion = useReducedMotion();
509
+ const {selectedKey} = usePluginState();
510
+ const {logger} = useApplication();
511
+ useEffect(
512
+ () =>
513
+ logger.onInspected.subscribe(key => {
300
514
  sidebar.set(tab);
301
515
  selectedKey.value = key;
302
- }), [tab]);
303
- useSignalEffect(() => {
304
- if (selectedKey.value &&
305
- sidebar.current.peek() !== tab &&
306
- !reducedMotion &&
307
- inspectorTab.current &&
308
- inspectorTab.current.getAnimations().length < 2) {
309
- inspectorTab.current.animate(emphasize(), { duration: 400 });
310
- inspectorTab.current.animate([{ color: 'white' }, { color: '' }], {
311
- duration: 800,
312
- });
313
- }
314
- });
315
- return (jsx(Tab, { forwardRef: inspectorTab, title: "Scene Graph", id: "scene-graph-tab", tab: tab, children: jsx(AccountTree, {}) }));
516
+ }),
517
+ [tab],
518
+ );
519
+ useSignalEffect(() => {
520
+ if (
521
+ selectedKey.value &&
522
+ sidebar.current.peek() !== tab &&
523
+ !reducedMotion &&
524
+ inspectorTab.current &&
525
+ inspectorTab.current.getAnimations().length < 2
526
+ ) {
527
+ inspectorTab.current.animate(emphasize(), {duration: 400});
528
+ inspectorTab.current.animate([{color: 'white'}, {color: ''}], {
529
+ duration: 800,
530
+ });
531
+ }
532
+ });
533
+ return jsx(Tab, {
534
+ forwardRef: inspectorTab,
535
+ title: 'Scene Graph',
536
+ id: 'scene-graph-tab',
537
+ tab: tab,
538
+ children: jsx(AccountTree, {}),
539
+ });
316
540
  }
317
541
  function PaneComponent() {
318
- const { selectedKey } = usePluginState();
319
- return (jsxs(Pane, { title: "Scene Graph", id: "scene-graph-pane", onClick: () => {
320
- selectedKey.value = null;
321
- }, children: [jsx(ViewRoot, {}), jsx(DetachedRoot, {})] }));
542
+ const {selectedKey} = usePluginState();
543
+ return jsxs(Pane, {
544
+ title: 'Scene Graph',
545
+ id: 'scene-graph-pane',
546
+ onClick: () => {
547
+ selectedKey.value = null;
548
+ },
549
+ children: [jsx(ViewRoot, {}), jsx(DetachedRoot, {})],
550
+ });
322
551
  }
323
552
  const SceneGraphTabConfig = {
324
- name: 'scene-graph',
325
- tabComponent: TabComponent,
326
- paneComponent: PaneComponent,
553
+ name: 'scene-graph',
554
+ tabComponent: TabComponent,
555
+ paneComponent: PaneComponent,
327
556
  };
328
557
 
329
558
  var index = makeEditorPlugin(() => {
330
- return {
331
- name: '@revideo/2d',
332
- provider: Provider,
333
- previewOverlay: PreviewOverlayConfig,
334
- tabs: [SceneGraphTabConfig],
335
- inspectors: [NodeInspectorConfig],
336
- };
559
+ return {
560
+ name: '@revideo/2d',
561
+ provider: Provider,
562
+ previewOverlay: PreviewOverlayConfig,
563
+ tabs: [SceneGraphTabConfig],
564
+ inspectors: [NodeInspectorConfig],
565
+ };
337
566
  });
338
567
 
339
568
  export { index as default };