@revideo/2d 0.4.7-two.1024 → 0.4.8-alpha.1032

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 (170) hide show
  1. package/editor/editor/tsconfig.build.tsbuildinfo +1 -1
  2. package/editor/index.js +151 -380
  3. package/editor/index.js.map +1 -1
  4. package/lib/code/CodeCursor.d.ts +74 -74
  5. package/lib/code/CodeDiffer.d.ts +16 -21
  6. package/lib/code/CodeDiffer.js +41 -39
  7. package/lib/code/CodeFragment.d.ts +8 -16
  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 +8 -12
  12. package/lib/code/CodeMetrics.js +24 -26
  13. package/lib/code/CodeRange.d.ts +5 -21
  14. package/lib/code/CodeRange.js +124 -131
  15. package/lib/code/CodeScope.d.ts +8 -18
  16. package/lib/code/CodeSelection.d.ts +4 -9
  17. package/lib/code/CodeSelection.js +8 -8
  18. package/lib/code/CodeSignal.d.ts +47 -74
  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 +19 -21
  24. package/lib/code/diff.d.ts +9 -12
  25. package/lib/code/diff.js +205 -218
  26. package/lib/code/extractRange.d.ts +4 -7
  27. package/lib/code/extractRange.js +71 -79
  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 +90 -95
  33. package/lib/components/Code.d.ts +211 -244
  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 +198 -208
  37. package/lib/components/Grid.d.ts +42 -47
  38. package/lib/components/Icon.d.ts +50 -55
  39. package/lib/components/Img.d.ts +79 -86
  40. package/lib/components/Knot.d.ts +78 -97
  41. package/lib/components/Latex.d.ts +12 -12
  42. package/lib/components/Layout.d.ts +413 -455
  43. package/lib/components/Line.d.ts +49 -61
  44. package/lib/components/Media.d.ts +37 -37
  45. package/lib/components/Node.d.ts +1 -1
  46. package/lib/components/Path.d.ts +1 -1
  47. package/lib/components/Polygon.d.ts +55 -60
  48. package/lib/components/QuadBezier.d.ts +29 -29
  49. package/lib/components/Ray.d.ts +28 -28
  50. package/lib/components/Rect.d.ts +108 -115
  51. package/lib/components/SVG.d.ts +1 -1
  52. package/lib/components/Shape.d.ts +1 -1
  53. package/lib/components/Spline.d.ts +40 -46
  54. package/lib/components/Txt.d.ts +44 -55
  55. package/lib/components/TxtLeaf.d.ts +16 -20
  56. package/lib/components/Video.d.ts +1 -0
  57. package/lib/components/Video.d.ts.map +1 -1
  58. package/lib/components/Video.js +9 -3
  59. package/lib/components/View2D.d.ts +22 -22
  60. package/lib/components/index.d.ts +2 -1
  61. package/lib/components/index.d.ts.map +1 -1
  62. package/lib/components/index.js +2 -1
  63. package/lib/components/types.d.ts +9 -22
  64. package/lib/curves/ArcSegment.d.ts +24 -36
  65. package/lib/curves/CircleSegment.d.ts +16 -26
  66. package/lib/curves/CubicBezierSegment.d.ts +13 -18
  67. package/lib/curves/CurveDrawingInfo.d.ts +9 -9
  68. package/lib/curves/CurvePoint.d.ts +13 -13
  69. package/lib/curves/CurveProfile.d.ts +5 -5
  70. package/lib/curves/CurveProfile.js +1 -1
  71. package/lib/curves/KnotInfo.d.ts +8 -8
  72. package/lib/curves/LineSegment.d.ts +14 -19
  73. package/lib/curves/Polynomial.d.ts +110 -110
  74. package/lib/curves/Polynomial2D.d.ts +20 -20
  75. package/lib/curves/PolynomialSegment.d.ts +37 -42
  76. package/lib/curves/QuadBezierSegment.d.ts +12 -12
  77. package/lib/curves/Segment.d.ts +7 -12
  78. package/lib/curves/UniformPolynomialCurveSampler.d.ts +34 -34
  79. package/lib/curves/createCurveProfileLerp.d.ts +6 -17
  80. package/lib/curves/getBezierSplineProfile.d.ts +4 -8
  81. package/lib/curves/getCircleProfile.d.ts +4 -10
  82. package/lib/curves/getPathProfile.d.ts +2 -2
  83. package/lib/curves/getPointAtDistance.d.ts +4 -7
  84. package/lib/curves/getPolylineProfile.d.ts +4 -8
  85. package/lib/curves/getRectProfile.d.ts +4 -9
  86. package/lib/curves/index.d.ts +1 -1
  87. package/lib/curves/index.js +1 -1
  88. package/lib/decorators/canvasStyleSignal.d.ts +3 -3
  89. package/lib/decorators/colorSignal.d.ts +1 -1
  90. package/lib/decorators/compound.d.ts +2 -4
  91. package/lib/decorators/computed.d.ts +1 -1
  92. package/lib/decorators/defaultStyle.d.ts +2 -5
  93. package/lib/decorators/filtersSignal.d.ts +8 -28
  94. package/lib/decorators/index.d.ts +1 -1
  95. package/lib/decorators/index.js +1 -1
  96. package/lib/decorators/initializers.d.ts +2 -5
  97. package/lib/decorators/initializers.js +19 -18
  98. package/lib/decorators/nodeName.d.ts +1 -1
  99. package/lib/decorators/nodeName.js +4 -4
  100. package/lib/decorators/signal.d.ts +20 -40
  101. package/lib/decorators/spacingSignal.d.ts +1 -1
  102. package/lib/decorators/vector2Signal.d.ts +7 -13
  103. package/lib/index.d.ts +1 -1
  104. package/lib/index.js +1 -1
  105. package/lib/jsx-dev-runtime.d.ts +3 -3
  106. package/lib/jsx-dev-runtime.js +3 -3
  107. package/lib/jsx-runtime.d.ts +9 -19
  108. package/lib/jsx-runtime.js +18 -18
  109. package/lib/partials/Filter.d.ts +16 -24
  110. package/lib/partials/Gradient.d.ts +24 -30
  111. package/lib/partials/Pattern.d.ts +9 -14
  112. package/lib/partials/ShaderConfig.d.ts +74 -81
  113. package/lib/partials/index.d.ts +1 -1
  114. package/lib/partials/index.js +1 -1
  115. package/lib/partials/types.d.ts +6 -19
  116. package/lib/scenes/Scene2D.d.ts +24 -42
  117. package/lib/scenes/Scene2D.d.ts.map +1 -1
  118. package/lib/scenes/Scene2D.js +10 -2
  119. package/lib/scenes/index.d.ts +1 -1
  120. package/lib/scenes/index.js +1 -1
  121. package/lib/scenes/makeScene2D.d.ts +5 -7
  122. package/lib/scenes/useScene2D.d.ts +2 -2
  123. package/lib/tsconfig.build.tsbuildinfo +1 -1
  124. package/lib/utils/diff.d.ts +18 -25
  125. package/lib/utils/diff.js +87 -84
  126. package/lib/utils/index.d.ts +1 -1
  127. package/lib/utils/index.js +1 -1
  128. package/lib/utils/is.d.ts +2 -4
  129. package/lib/utils/is.js +2 -2
  130. package/lib/utils/makeSignalExtensions.d.ts +4 -11
  131. package/lib/utils/video/mp4-parser-manager.d.ts +1 -0
  132. package/lib/utils/video/mp4-parser-manager.d.ts.map +1 -1
  133. package/lib/utils/video/mp4-parser-manager.js +21 -4
  134. package/lib/utils/video/parser/index.d.ts +2 -0
  135. package/lib/utils/video/parser/index.d.ts.map +1 -0
  136. package/lib/utils/video/parser/index.js +2 -0
  137. package/lib/utils/video/parser/parser.d.ts +21 -0
  138. package/lib/utils/video/parser/parser.d.ts.map +1 -0
  139. package/lib/utils/video/parser/parser.js +168 -0
  140. package/lib/utils/video/parser/sampler.d.ts +16 -0
  141. package/lib/utils/video/parser/sampler.d.ts.map +1 -0
  142. package/lib/utils/video/parser/sampler.js +56 -0
  143. package/lib/utils/video/parser/segment.d.ts +44 -0
  144. package/lib/utils/video/parser/segment.d.ts.map +1 -0
  145. package/lib/utils/video/parser/segment.js +195 -0
  146. package/lib/utils/video/parser/sink.d.ts +9 -0
  147. package/lib/utils/video/parser/sink.d.ts.map +1 -0
  148. package/lib/utils/video/parser/sink.js +22 -0
  149. package/lib/utils/video/parser/utils.d.ts +10 -0
  150. package/lib/utils/video/parser/utils.d.ts.map +1 -0
  151. package/lib/utils/video/parser/utils.js +22 -0
  152. package/package.json +4 -4
  153. package/src/lib/components/Video.ts +9 -2
  154. package/src/lib/components/index.ts +1 -0
  155. package/src/lib/scenes/Scene2D.ts +11 -1
  156. package/src/lib/utils/video/mp4-parser-manager.ts +24 -5
  157. package/src/lib/utils/video/parser/index.ts +1 -0
  158. package/src/lib/utils/video/parser/parser.ts +256 -0
  159. package/src/lib/utils/video/parser/sampler.ts +72 -0
  160. package/src/lib/utils/video/parser/segment.ts +252 -0
  161. package/src/lib/utils/video/parser/sink.ts +29 -0
  162. package/src/lib/utils/video/parser/utils.ts +31 -0
  163. package/lib/components/HlsVideo.d.ts +0 -62
  164. package/lib/components/HlsVideo.d.ts.map +0 -1
  165. package/lib/components/HlsVideo.js +0 -169
  166. package/lib/tsconfig.tsbuildinfo +0 -1
  167. package/lib/utils/video/mp4-parser.d.ts +0 -63
  168. package/lib/utils/video/mp4-parser.d.ts.map +0 -1
  169. package/lib/utils/video/mp4-parser.js +0 -264
  170. package/src/lib/utils/video/mp4-parser.ts +0 -340
package/editor/index.js CHANGED
@@ -1,11 +1,11 @@
1
+ import './index.css';
1
2
  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';
2
- import { signal, computed, useSignalEffect, useComputed, useSignal } from '@preact/signals';
3
3
  import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
4
+ import { signal, computed, useSignalEffect, useComputed, useSignal } from '@preact/signals';
4
5
  import { SceneRenderEvent, Vector2 } from '@revideo/core';
5
6
  import { createContext } from 'preact';
6
7
  import { useMemo, useContext, useRef, useEffect } from 'preact/hooks';
7
8
  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,73 +69,32 @@ 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) 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
- });
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)))] }));
135
94
  }
136
95
  const NodeInspectorConfig = {
137
- key: NodeInspectorKey,
138
- component: Component$1,
96
+ key: NodeInspectorKey,
97
+ component: Component$1,
139
98
  };
140
99
 
141
100
  function Component({ children }) {
@@ -178,184 +137,78 @@ const PreviewOverlayConfig = {
178
137
  };
179
138
 
180
139
  function CircleIcon() {
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
- });
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" }) }));
188
141
  }
189
142
 
190
143
  function CodeBlockIcon() {
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
- });
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" })] }));
203
145
  }
204
146
 
205
147
  function CurveIcon() {
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
- });
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" }) }));
213
149
  }
214
150
 
215
151
  function GridIcon() {
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
- });
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" }) }));
223
153
  }
224
154
 
225
155
  function ImgIcon() {
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
- });
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" })] }));
234
157
  }
235
158
 
236
159
  function LayoutIcon() {
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
- });
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" })] }));
248
161
  }
249
162
 
250
163
  function LineIcon() {
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
- });
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" }) }));
258
165
  }
259
166
 
260
167
  function NodeIcon() {
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
- });
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" }) }));
268
169
  }
269
170
 
270
171
  function RayIcon() {
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
- });
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" }) }));
278
173
  }
279
174
 
280
175
  function RectIcon() {
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
- });
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" }) }));
288
177
  }
289
178
 
290
179
  function ShapeIcon() {
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
- });
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" }) }));
298
181
  }
299
182
 
300
183
  function TxtIcon() {
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
- });
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" })] }));
311
185
  }
312
186
 
313
187
  function VideoIcon() {
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
- });
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" }) }));
321
189
  }
322
190
 
323
191
  function View2DIcon() {
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
- });
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" })] }));
340
193
  }
341
194
 
342
195
  /* eslint-disable @typescript-eslint/naming-convention */
343
196
  const IconMap = {
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,
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,
359
212
  };
360
213
 
361
214
  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}
@@ -363,206 +216,124 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
363
216
  var styles = {"root":"index-module_root__omEd0","label":"index-module_label__9BJvW","active":"index-module_active__KevXv","parent":"index-module_parent__5nc9I"};
364
217
 
365
218
  const DEPTH_VAR = '--depth';
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
- });
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 }))] }));
413
230
  }
414
231
 
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
- });
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 }))) }));
466
266
  }
467
267
 
468
- function TreeRoot({className, ...props}) {
469
- return jsx('div', {className: clsx(styles.root, className), ...props});
268
+ function TreeRoot({ className, ...props }) {
269
+ return jsx("div", { className: clsx(styles.root, className), ...props });
470
270
  }
471
271
 
472
272
  function DetachedRoot() {
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;
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;
489
279
  }
490
280
 
491
281
  function ViewRoot() {
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();
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
+ });
498
289
  });
499
- });
500
- return view.value
501
- ? jsx(TreeRoot, {children: jsx(NodeElement, {node: view.value})})
502
- : null;
290
+ return view.value ? (jsx(TreeRoot, { children: jsx(NodeElement, { node: view.value }) })) : null;
503
291
  }
504
292
 
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 => {
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 => {
514
300
  sidebar.set(tab);
515
301
  selectedKey.value = key;
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
- });
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, {}) }));
540
316
  }
541
317
  function PaneComponent() {
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
- });
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, {})] }));
551
322
  }
552
323
  const SceneGraphTabConfig = {
553
- name: 'scene-graph',
554
- tabComponent: TabComponent,
555
- paneComponent: PaneComponent,
324
+ name: 'scene-graph',
325
+ tabComponent: TabComponent,
326
+ paneComponent: PaneComponent,
556
327
  };
557
328
 
558
329
  var index = makeEditorPlugin(() => {
559
- return {
560
- name: '@revideo/2d',
561
- provider: Provider,
562
- previewOverlay: PreviewOverlayConfig,
563
- tabs: [SceneGraphTabConfig],
564
- inspectors: [NodeInspectorConfig],
565
- };
330
+ return {
331
+ name: '@revideo/2d',
332
+ provider: Provider,
333
+ previewOverlay: PreviewOverlayConfig,
334
+ tabs: [SceneGraphTabConfig],
335
+ inspectors: [NodeInspectorConfig],
336
+ };
566
337
  });
567
338
 
568
339
  export { index as default };