@twick/2d 0.11.0

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 (537) hide show
  1. package/LICENSE +21 -0
  2. package/editor/editor/NodeInspectorConfig.d.ts +3 -0
  3. package/editor/editor/NodeInspectorConfig.d.ts.map +1 -0
  4. package/editor/editor/PreviewOverlayConfig.d.ts +3 -0
  5. package/editor/editor/PreviewOverlayConfig.d.ts.map +1 -0
  6. package/editor/editor/Provider.d.ts +17 -0
  7. package/editor/editor/Provider.d.ts.map +1 -0
  8. package/editor/editor/SceneGraphTabConfig.d.ts +3 -0
  9. package/editor/editor/SceneGraphTabConfig.d.ts.map +1 -0
  10. package/editor/editor/icons/CircleIcon.d.ts +2 -0
  11. package/editor/editor/icons/CircleIcon.d.ts.map +1 -0
  12. package/editor/editor/icons/CodeBlockIcon.d.ts +2 -0
  13. package/editor/editor/icons/CodeBlockIcon.d.ts.map +1 -0
  14. package/editor/editor/icons/CurveIcon.d.ts +2 -0
  15. package/editor/editor/icons/CurveIcon.d.ts.map +1 -0
  16. package/editor/editor/icons/GridIcon.d.ts +2 -0
  17. package/editor/editor/icons/GridIcon.d.ts.map +1 -0
  18. package/editor/editor/icons/IconMap.d.ts +3 -0
  19. package/editor/editor/icons/IconMap.d.ts.map +1 -0
  20. package/editor/editor/icons/ImgIcon.d.ts +2 -0
  21. package/editor/editor/icons/ImgIcon.d.ts.map +1 -0
  22. package/editor/editor/icons/LayoutIcon.d.ts +2 -0
  23. package/editor/editor/icons/LayoutIcon.d.ts.map +1 -0
  24. package/editor/editor/icons/LineIcon.d.ts +2 -0
  25. package/editor/editor/icons/LineIcon.d.ts.map +1 -0
  26. package/editor/editor/icons/NodeIcon.d.ts +2 -0
  27. package/editor/editor/icons/NodeIcon.d.ts.map +1 -0
  28. package/editor/editor/icons/RayIcon.d.ts +2 -0
  29. package/editor/editor/icons/RayIcon.d.ts.map +1 -0
  30. package/editor/editor/icons/RectIcon.d.ts +2 -0
  31. package/editor/editor/icons/RectIcon.d.ts.map +1 -0
  32. package/editor/editor/icons/ShapeIcon.d.ts +2 -0
  33. package/editor/editor/icons/ShapeIcon.d.ts.map +1 -0
  34. package/editor/editor/icons/TxtIcon.d.ts +2 -0
  35. package/editor/editor/icons/TxtIcon.d.ts.map +1 -0
  36. package/editor/editor/icons/VideoIcon.d.ts +2 -0
  37. package/editor/editor/icons/VideoIcon.d.ts.map +1 -0
  38. package/editor/editor/icons/View2DIcon.d.ts +2 -0
  39. package/editor/editor/icons/View2DIcon.d.ts.map +1 -0
  40. package/editor/editor/index.d.ts +4 -0
  41. package/editor/editor/index.d.ts.map +1 -0
  42. package/editor/editor/tree/DetachedRoot.d.ts +2 -0
  43. package/editor/editor/tree/DetachedRoot.d.ts.map +1 -0
  44. package/editor/editor/tree/NodeElement.d.ts +8 -0
  45. package/editor/editor/tree/NodeElement.d.ts.map +1 -0
  46. package/editor/editor/tree/TreeElement.d.ts +15 -0
  47. package/editor/editor/tree/TreeElement.d.ts.map +1 -0
  48. package/editor/editor/tree/TreeRoot.d.ts +3 -0
  49. package/editor/editor/tree/TreeRoot.d.ts.map +1 -0
  50. package/editor/editor/tree/ViewRoot.d.ts +2 -0
  51. package/editor/editor/tree/ViewRoot.d.ts.map +1 -0
  52. package/editor/editor/tree/index.d.ts +4 -0
  53. package/editor/editor/tree/index.d.ts.map +1 -0
  54. package/editor/editor/tsconfig.build.tsbuildinfo +1 -0
  55. package/editor/index.css +33 -0
  56. package/editor/index.js +341 -0
  57. package/editor/index.js.map +1 -0
  58. package/lib/code/CodeCursor.d.ts +83 -0
  59. package/lib/code/CodeCursor.d.ts.map +1 -0
  60. package/lib/code/CodeCursor.js +306 -0
  61. package/lib/code/CodeDiffer.d.ts +28 -0
  62. package/lib/code/CodeDiffer.d.ts.map +1 -0
  63. package/lib/code/CodeDiffer.js +51 -0
  64. package/lib/code/CodeFragment.d.ts +42 -0
  65. package/lib/code/CodeFragment.d.ts.map +1 -0
  66. package/lib/code/CodeFragment.js +72 -0
  67. package/lib/code/CodeHighlighter.d.ts +71 -0
  68. package/lib/code/CodeHighlighter.d.ts.map +1 -0
  69. package/lib/code/CodeHighlighter.js +2 -0
  70. package/lib/code/CodeMetrics.d.ts +11 -0
  71. package/lib/code/CodeMetrics.d.ts.map +1 -0
  72. package/lib/code/CodeMetrics.js +29 -0
  73. package/lib/code/CodeRange.d.ts +41 -0
  74. package/lib/code/CodeRange.d.ts.map +1 -0
  75. package/lib/code/CodeRange.js +179 -0
  76. package/lib/code/CodeScope.d.ts +16 -0
  77. package/lib/code/CodeScope.d.ts.map +1 -0
  78. package/lib/code/CodeScope.js +72 -0
  79. package/lib/code/CodeSelection.d.ts +6 -0
  80. package/lib/code/CodeSelection.d.ts.map +1 -0
  81. package/lib/code/CodeSelection.js +13 -0
  82. package/lib/code/CodeSignal.d.ts +60 -0
  83. package/lib/code/CodeSignal.d.ts.map +1 -0
  84. package/lib/code/CodeSignal.js +194 -0
  85. package/lib/code/CodeTokenizer.d.ts +8 -0
  86. package/lib/code/CodeTokenizer.d.ts.map +1 -0
  87. package/lib/code/CodeTokenizer.js +50 -0
  88. package/lib/code/DefaultHighlightStyle.d.ts +3 -0
  89. package/lib/code/DefaultHighlightStyle.d.ts.map +1 -0
  90. package/lib/code/DefaultHighlightStyle.js +98 -0
  91. package/lib/code/LezerHighlighter.d.ts +22 -0
  92. package/lib/code/LezerHighlighter.d.ts.map +1 -0
  93. package/lib/code/LezerHighlighter.js +89 -0
  94. package/lib/code/diff.d.ts +31 -0
  95. package/lib/code/diff.d.ts.map +1 -0
  96. package/lib/code/diff.js +236 -0
  97. package/lib/code/extractRange.d.ts +17 -0
  98. package/lib/code/extractRange.d.ts.map +1 -0
  99. package/lib/code/extractRange.js +102 -0
  100. package/lib/code/index.d.ts +14 -0
  101. package/lib/code/index.d.ts.map +1 -0
  102. package/lib/code/index.js +14 -0
  103. package/lib/components/Audio.d.ts +14 -0
  104. package/lib/components/Audio.d.ts.map +1 -0
  105. package/lib/components/Audio.js +118 -0
  106. package/lib/components/Bezier.d.ts +23 -0
  107. package/lib/components/Bezier.d.ts.map +1 -0
  108. package/lib/components/Bezier.js +81 -0
  109. package/lib/components/Circle.d.ts +193 -0
  110. package/lib/components/Circle.d.ts.map +1 -0
  111. package/lib/components/Circle.js +178 -0
  112. package/lib/components/Code.d.ts +231 -0
  113. package/lib/components/Code.d.ts.map +1 -0
  114. package/lib/components/Code.js +325 -0
  115. package/lib/components/CodeBlock.d.ts +133 -0
  116. package/lib/components/CodeBlock.d.ts.map +1 -0
  117. package/lib/components/CodeBlock.js +461 -0
  118. package/lib/components/CubicBezier.d.ts +70 -0
  119. package/lib/components/CubicBezier.d.ts.map +1 -0
  120. package/lib/components/CubicBezier.js +81 -0
  121. package/lib/components/Curve.d.ts +204 -0
  122. package/lib/components/Curve.d.ts.map +1 -0
  123. package/lib/components/Curve.js +284 -0
  124. package/lib/components/Grid.d.ts +76 -0
  125. package/lib/components/Grid.d.ts.map +1 -0
  126. package/lib/components/Grid.js +91 -0
  127. package/lib/components/Icon.d.ts +59 -0
  128. package/lib/components/Icon.d.ts.map +1 -0
  129. package/lib/components/Icon.js +58 -0
  130. package/lib/components/Img.d.ts +118 -0
  131. package/lib/components/Img.d.ts.map +1 -0
  132. package/lib/components/Img.js +245 -0
  133. package/lib/components/Knot.d.ts +90 -0
  134. package/lib/components/Knot.d.ts.map +1 -0
  135. package/lib/components/Knot.js +68 -0
  136. package/lib/components/Latex.d.ts +39 -0
  137. package/lib/components/Latex.d.ts.map +1 -0
  138. package/lib/components/Latex.js +101 -0
  139. package/lib/components/Layout.d.ts +419 -0
  140. package/lib/components/Layout.d.ts.map +1 -0
  141. package/lib/components/Layout.js +706 -0
  142. package/lib/components/Line.d.ts +160 -0
  143. package/lib/components/Line.d.ts.map +1 -0
  144. package/lib/components/Line.js +346 -0
  145. package/lib/components/Media.d.ts +65 -0
  146. package/lib/components/Media.d.ts.map +1 -0
  147. package/lib/components/Media.js +303 -0
  148. package/lib/components/Node.d.ts +836 -0
  149. package/lib/components/Node.d.ts.map +1 -0
  150. package/lib/components/Node.js +1317 -0
  151. package/lib/components/Path.d.ts +20 -0
  152. package/lib/components/Path.d.ts.map +1 -0
  153. package/lib/components/Path.js +97 -0
  154. package/lib/components/Polygon.d.ts +113 -0
  155. package/lib/components/Polygon.d.ts.map +1 -0
  156. package/lib/components/Polygon.js +123 -0
  157. package/lib/components/QuadBezier.d.ts +62 -0
  158. package/lib/components/QuadBezier.d.ts.map +1 -0
  159. package/lib/components/QuadBezier.js +76 -0
  160. package/lib/components/Ray.d.ts +62 -0
  161. package/lib/components/Ray.d.ts.map +1 -0
  162. package/lib/components/Ray.js +96 -0
  163. package/lib/components/Rect.d.ts +114 -0
  164. package/lib/components/Rect.d.ts.map +1 -0
  165. package/lib/components/Rect.js +76 -0
  166. package/lib/components/Rive.d.ts +22 -0
  167. package/lib/components/Rive.d.ts.map +1 -0
  168. package/lib/components/Rive.js +117 -0
  169. package/lib/components/SVG.d.ts +178 -0
  170. package/lib/components/SVG.d.ts.map +1 -0
  171. package/lib/components/SVG.js +577 -0
  172. package/lib/components/Shape.d.ts +40 -0
  173. package/lib/components/Shape.d.ts.map +1 -0
  174. package/lib/components/Shape.js +134 -0
  175. package/lib/components/Spline.d.ts +89 -0
  176. package/lib/components/Spline.d.ts.map +1 -0
  177. package/lib/components/Spline.js +256 -0
  178. package/lib/components/Txt.d.ts +53 -0
  179. package/lib/components/Txt.d.ts.map +1 -0
  180. package/lib/components/Txt.js +173 -0
  181. package/lib/components/TxtLeaf.d.ts +21 -0
  182. package/lib/components/TxtLeaf.d.ts.map +1 -0
  183. package/lib/components/TxtLeaf.js +181 -0
  184. package/lib/components/Video.d.ts +69 -0
  185. package/lib/components/Video.d.ts.map +1 -0
  186. package/lib/components/Video.js +283 -0
  187. package/lib/components/View2D.d.ts +28 -0
  188. package/lib/components/View2D.d.ts.map +1 -0
  189. package/lib/components/View2D.js +93 -0
  190. package/lib/components/index.d.ts +29 -0
  191. package/lib/components/index.d.ts.map +1 -0
  192. package/lib/components/index.js +29 -0
  193. package/lib/components/types.d.ts +17 -0
  194. package/lib/components/types.d.ts.map +1 -0
  195. package/lib/components/types.js +2 -0
  196. package/lib/curves/ArcSegment.d.ts +26 -0
  197. package/lib/curves/ArcSegment.d.ts.map +1 -0
  198. package/lib/curves/ArcSegment.js +97 -0
  199. package/lib/curves/CircleSegment.d.ts +18 -0
  200. package/lib/curves/CircleSegment.d.ts.map +1 -0
  201. package/lib/curves/CircleSegment.js +52 -0
  202. package/lib/curves/CubicBezierSegment.d.ts +18 -0
  203. package/lib/curves/CubicBezierSegment.d.ts.map +1 -0
  204. package/lib/curves/CubicBezierSegment.js +55 -0
  205. package/lib/curves/CurveDrawingInfo.d.ts +11 -0
  206. package/lib/curves/CurveDrawingInfo.d.ts.map +1 -0
  207. package/lib/curves/CurveDrawingInfo.js +2 -0
  208. package/lib/curves/CurvePoint.d.ts +15 -0
  209. package/lib/curves/CurvePoint.d.ts.map +1 -0
  210. package/lib/curves/CurvePoint.js +2 -0
  211. package/lib/curves/CurveProfile.d.ts +7 -0
  212. package/lib/curves/CurveProfile.d.ts.map +1 -0
  213. package/lib/curves/CurveProfile.js +2 -0
  214. package/lib/curves/KnotInfo.d.ts +12 -0
  215. package/lib/curves/KnotInfo.d.ts.map +1 -0
  216. package/lib/curves/KnotInfo.js +2 -0
  217. package/lib/curves/LineSegment.d.ts +16 -0
  218. package/lib/curves/LineSegment.d.ts.map +1 -0
  219. package/lib/curves/LineSegment.js +45 -0
  220. package/lib/curves/Polynomial.d.ts +118 -0
  221. package/lib/curves/Polynomial.d.ts.map +1 -0
  222. package/lib/curves/Polynomial.js +259 -0
  223. package/lib/curves/Polynomial2D.d.ts +22 -0
  224. package/lib/curves/Polynomial2D.d.ts.map +1 -0
  225. package/lib/curves/Polynomial2D.js +45 -0
  226. package/lib/curves/PolynomialSegment.d.ts +39 -0
  227. package/lib/curves/PolynomialSegment.d.ts.map +1 -0
  228. package/lib/curves/PolynomialSegment.js +86 -0
  229. package/lib/curves/QuadBezierSegment.d.ts +17 -0
  230. package/lib/curves/QuadBezierSegment.d.ts.map +1 -0
  231. package/lib/curves/QuadBezierSegment.js +49 -0
  232. package/lib/curves/Segment.d.ts +9 -0
  233. package/lib/curves/Segment.d.ts.map +1 -0
  234. package/lib/curves/Segment.js +3 -0
  235. package/lib/curves/UniformPolynomialCurveSampler.d.ts +43 -0
  236. package/lib/curves/UniformPolynomialCurveSampler.d.ts.map +1 -0
  237. package/lib/curves/UniformPolynomialCurveSampler.js +73 -0
  238. package/lib/curves/createCurveProfileLerp.d.ts +32 -0
  239. package/lib/curves/createCurveProfileLerp.d.ts.map +1 -0
  240. package/lib/curves/createCurveProfileLerp.js +351 -0
  241. package/lib/curves/getBezierSplineProfile.d.ts +12 -0
  242. package/lib/curves/getBezierSplineProfile.d.ts.map +1 -0
  243. package/lib/curves/getBezierSplineProfile.js +137 -0
  244. package/lib/curves/getCircleProfile.d.ts +4 -0
  245. package/lib/curves/getCircleProfile.d.ts.map +1 -0
  246. package/lib/curves/getCircleProfile.js +44 -0
  247. package/lib/curves/getPathProfile.d.ts +3 -0
  248. package/lib/curves/getPathProfile.d.ts.map +1 -0
  249. package/lib/curves/getPathProfile.js +128 -0
  250. package/lib/curves/getPointAtDistance.d.ts +4 -0
  251. package/lib/curves/getPointAtDistance.d.ts.map +1 -0
  252. package/lib/curves/getPointAtDistance.js +15 -0
  253. package/lib/curves/getPolylineProfile.d.ts +4 -0
  254. package/lib/curves/getPolylineProfile.d.ts.map +1 -0
  255. package/lib/curves/getPolylineProfile.js +58 -0
  256. package/lib/curves/getRectProfile.d.ts +4 -0
  257. package/lib/curves/getRectProfile.d.ts.map +1 -0
  258. package/lib/curves/getRectProfile.js +57 -0
  259. package/lib/curves/index.d.ts +17 -0
  260. package/lib/curves/index.d.ts.map +1 -0
  261. package/lib/curves/index.js +17 -0
  262. package/lib/decorators/canvasStyleSignal.d.ts +5 -0
  263. package/lib/decorators/canvasStyleSignal.d.ts.map +1 -0
  264. package/lib/decorators/canvasStyleSignal.js +12 -0
  265. package/lib/decorators/colorSignal.d.ts +2 -0
  266. package/lib/decorators/colorSignal.d.ts.map +1 -0
  267. package/lib/decorators/colorSignal.js +9 -0
  268. package/lib/decorators/compound.d.ts +26 -0
  269. package/lib/decorators/compound.d.ts.map +1 -0
  270. package/lib/decorators/compound.js +49 -0
  271. package/lib/decorators/computed.d.ts +9 -0
  272. package/lib/decorators/computed.d.ts.map +1 -0
  273. package/lib/decorators/computed.js +18 -0
  274. package/lib/decorators/defaultStyle.d.ts +2 -0
  275. package/lib/decorators/defaultStyle.d.ts.map +1 -0
  276. package/lib/decorators/defaultStyle.js +14 -0
  277. package/lib/decorators/filtersSignal.d.ts +13 -0
  278. package/lib/decorators/filtersSignal.d.ts.map +1 -0
  279. package/lib/decorators/filtersSignal.js +73 -0
  280. package/lib/decorators/index.d.ts +11 -0
  281. package/lib/decorators/index.d.ts.map +1 -0
  282. package/lib/decorators/index.js +11 -0
  283. package/lib/decorators/initializers.d.ts +4 -0
  284. package/lib/decorators/initializers.d.ts.map +1 -0
  285. package/lib/decorators/initializers.js +27 -0
  286. package/lib/decorators/nodeName.d.ts +9 -0
  287. package/lib/decorators/nodeName.d.ts.map +1 -0
  288. package/lib/decorators/nodeName.js +13 -0
  289. package/lib/decorators/signal.d.ts +183 -0
  290. package/lib/decorators/signal.d.ts.map +1 -0
  291. package/lib/decorators/signal.js +285 -0
  292. package/lib/decorators/spacingSignal.d.ts +2 -0
  293. package/lib/decorators/spacingSignal.d.ts.map +1 -0
  294. package/lib/decorators/spacingSignal.js +15 -0
  295. package/lib/decorators/vector2Signal.d.ts +9 -0
  296. package/lib/decorators/vector2Signal.d.ts.map +1 -0
  297. package/lib/decorators/vector2Signal.js +15 -0
  298. package/lib/index.d.ts +9 -0
  299. package/lib/index.d.ts.map +1 -0
  300. package/lib/index.js +9 -0
  301. package/lib/jsx-dev-runtime.d.ts +3 -0
  302. package/lib/jsx-dev-runtime.d.ts.map +1 -0
  303. package/lib/jsx-dev-runtime.js +3 -0
  304. package/lib/jsx-runtime.d.ts +12 -0
  305. package/lib/jsx-runtime.d.ts.map +1 -0
  306. package/lib/jsx-runtime.js +23 -0
  307. package/lib/partials/Filter.d.ts +82 -0
  308. package/lib/partials/Filter.d.ts.map +1 -0
  309. package/lib/partials/Filter.js +135 -0
  310. package/lib/partials/Gradient.d.ts +31 -0
  311. package/lib/partials/Gradient.d.ts.map +1 -0
  312. package/lib/partials/Gradient.js +63 -0
  313. package/lib/partials/Pattern.d.ts +13 -0
  314. package/lib/partials/Pattern.d.ts.map +1 -0
  315. package/lib/partials/Pattern.js +27 -0
  316. package/lib/partials/ShaderConfig.d.ts +81 -0
  317. package/lib/partials/ShaderConfig.d.ts.map +1 -0
  318. package/lib/partials/ShaderConfig.js +25 -0
  319. package/lib/partials/index.d.ts +5 -0
  320. package/lib/partials/index.d.ts.map +1 -0
  321. package/lib/partials/index.js +5 -0
  322. package/lib/partials/types.d.ts +35 -0
  323. package/lib/partials/types.d.ts.map +1 -0
  324. package/lib/partials/types.js +2 -0
  325. package/lib/scenes/Scene2D.d.ts +29 -0
  326. package/lib/scenes/Scene2D.d.ts.map +1 -0
  327. package/lib/scenes/Scene2D.js +180 -0
  328. package/lib/scenes/index.d.ts +4 -0
  329. package/lib/scenes/index.d.ts.map +1 -0
  330. package/lib/scenes/index.js +4 -0
  331. package/lib/scenes/makeScene2D.d.ts +5 -0
  332. package/lib/scenes/makeScene2D.d.ts.map +1 -0
  333. package/lib/scenes/makeScene2D.js +11 -0
  334. package/lib/scenes/useScene2D.d.ts +3 -0
  335. package/lib/scenes/useScene2D.d.ts.map +1 -0
  336. package/lib/scenes/useScene2D.js +5 -0
  337. package/lib/tsconfig.build.tsbuildinfo +1 -0
  338. package/lib/utils/CanvasUtils.d.ts +23 -0
  339. package/lib/utils/CanvasUtils.d.ts.map +1 -0
  340. package/lib/utils/CanvasUtils.js +138 -0
  341. package/lib/utils/diff.d.ts +31 -0
  342. package/lib/utils/diff.d.ts.map +1 -0
  343. package/lib/utils/diff.js +97 -0
  344. package/lib/utils/index.d.ts +3 -0
  345. package/lib/utils/index.d.ts.map +1 -0
  346. package/lib/utils/index.js +3 -0
  347. package/lib/utils/is.d.ts +8 -0
  348. package/lib/utils/is.d.ts.map +1 -0
  349. package/lib/utils/is.js +10 -0
  350. package/lib/utils/makeSignalExtensions.d.ts +4 -0
  351. package/lib/utils/makeSignalExtensions.d.ts.map +1 -0
  352. package/lib/utils/makeSignalExtensions.js +20 -0
  353. package/lib/utils/video/ffmpeg-client.d.ts +5 -0
  354. package/lib/utils/video/ffmpeg-client.d.ts.map +1 -0
  355. package/lib/utils/video/ffmpeg-client.js +32 -0
  356. package/lib/utils/video/mp4-parser-manager.d.ts +3 -0
  357. package/lib/utils/video/mp4-parser-manager.d.ts.map +1 -0
  358. package/lib/utils/video/mp4-parser-manager.js +55 -0
  359. package/lib/utils/video/parser/index.d.ts +2 -0
  360. package/lib/utils/video/parser/index.d.ts.map +1 -0
  361. package/lib/utils/video/parser/index.js +2 -0
  362. package/lib/utils/video/parser/parser.d.ts +21 -0
  363. package/lib/utils/video/parser/parser.d.ts.map +1 -0
  364. package/lib/utils/video/parser/parser.js +168 -0
  365. package/lib/utils/video/parser/sampler.d.ts +16 -0
  366. package/lib/utils/video/parser/sampler.d.ts.map +1 -0
  367. package/lib/utils/video/parser/sampler.js +56 -0
  368. package/lib/utils/video/parser/segment.d.ts +48 -0
  369. package/lib/utils/video/parser/segment.d.ts.map +1 -0
  370. package/lib/utils/video/parser/segment.js +239 -0
  371. package/lib/utils/video/parser/sink.d.ts +9 -0
  372. package/lib/utils/video/parser/sink.d.ts.map +1 -0
  373. package/lib/utils/video/parser/sink.js +22 -0
  374. package/lib/utils/video/parser/utils.d.ts +10 -0
  375. package/lib/utils/video/parser/utils.d.ts.map +1 -0
  376. package/lib/utils/video/parser/utils.js +22 -0
  377. package/package.json +53 -0
  378. package/src/editor/NodeInspectorConfig.tsx +76 -0
  379. package/src/editor/PreviewOverlayConfig.tsx +67 -0
  380. package/src/editor/Provider.tsx +93 -0
  381. package/src/editor/SceneGraphTabConfig.tsx +81 -0
  382. package/src/editor/icons/CircleIcon.tsx +7 -0
  383. package/src/editor/icons/CodeBlockIcon.tsx +8 -0
  384. package/src/editor/icons/CurveIcon.tsx +7 -0
  385. package/src/editor/icons/GridIcon.tsx +7 -0
  386. package/src/editor/icons/IconMap.ts +35 -0
  387. package/src/editor/icons/ImgIcon.tsx +8 -0
  388. package/src/editor/icons/LayoutIcon.tsx +9 -0
  389. package/src/editor/icons/LineIcon.tsx +7 -0
  390. package/src/editor/icons/NodeIcon.tsx +7 -0
  391. package/src/editor/icons/RayIcon.tsx +7 -0
  392. package/src/editor/icons/RectIcon.tsx +7 -0
  393. package/src/editor/icons/ShapeIcon.tsx +7 -0
  394. package/src/editor/icons/TxtIcon.tsx +8 -0
  395. package/src/editor/icons/VideoIcon.tsx +7 -0
  396. package/src/editor/icons/View2DIcon.tsx +10 -0
  397. package/src/editor/index.css +0 -0
  398. package/src/editor/index.ts +17 -0
  399. package/src/editor/tree/DetachedRoot.tsx +23 -0
  400. package/src/editor/tree/NodeElement.tsx +74 -0
  401. package/src/editor/tree/TreeElement.tsx +72 -0
  402. package/src/editor/tree/TreeRoot.tsx +10 -0
  403. package/src/editor/tree/ViewRoot.tsx +20 -0
  404. package/src/editor/tree/index.module.scss +38 -0
  405. package/src/editor/tree/index.ts +3 -0
  406. package/src/editor/tsconfig.build.json +5 -0
  407. package/src/editor/tsconfig.json +12 -0
  408. package/src/editor/tsdoc.json +4 -0
  409. package/src/editor/vite-env.d.ts +1 -0
  410. package/src/lib/code/CodeCursor.ts +445 -0
  411. package/src/lib/code/CodeDiffer.ts +78 -0
  412. package/src/lib/code/CodeFragment.ts +97 -0
  413. package/src/lib/code/CodeHighlighter.ts +75 -0
  414. package/src/lib/code/CodeMetrics.ts +47 -0
  415. package/src/lib/code/CodeRange.test.ts +74 -0
  416. package/src/lib/code/CodeRange.ts +216 -0
  417. package/src/lib/code/CodeScope.ts +101 -0
  418. package/src/lib/code/CodeSelection.ts +24 -0
  419. package/src/lib/code/CodeSignal.ts +327 -0
  420. package/src/lib/code/CodeTokenizer.ts +54 -0
  421. package/src/lib/code/DefaultHighlightStyle.ts +98 -0
  422. package/src/lib/code/LezerHighlighter.ts +113 -0
  423. package/src/lib/code/diff.test.ts +311 -0
  424. package/src/lib/code/diff.ts +319 -0
  425. package/src/lib/code/extractRange.ts +126 -0
  426. package/src/lib/code/index.ts +13 -0
  427. package/src/lib/components/Audio.ts +131 -0
  428. package/src/lib/components/Bezier.ts +105 -0
  429. package/src/lib/components/Circle.ts +266 -0
  430. package/src/lib/components/Code.ts +526 -0
  431. package/src/lib/components/CodeBlock.ts +576 -0
  432. package/src/lib/components/CubicBezier.ts +112 -0
  433. package/src/lib/components/Curve.ts +455 -0
  434. package/src/lib/components/Grid.ts +135 -0
  435. package/src/lib/components/Icon.ts +96 -0
  436. package/src/lib/components/Img.ts +319 -0
  437. package/src/lib/components/Knot.ts +157 -0
  438. package/src/lib/components/Latex.ts +122 -0
  439. package/src/lib/components/Layout.ts +1092 -0
  440. package/src/lib/components/Line.ts +429 -0
  441. package/src/lib/components/Media.ts +379 -0
  442. package/src/lib/components/Node.ts +1940 -0
  443. package/src/lib/components/Path.ts +137 -0
  444. package/src/lib/components/Polygon.ts +171 -0
  445. package/src/lib/components/QuadBezier.ts +100 -0
  446. package/src/lib/components/Ray.ts +125 -0
  447. package/src/lib/components/Rect.ts +187 -0
  448. package/src/lib/components/Rive.ts +156 -0
  449. package/src/lib/components/SVG.ts +797 -0
  450. package/src/lib/components/Shape.ts +143 -0
  451. package/src/lib/components/Spline.ts +344 -0
  452. package/src/lib/components/Txt.test.tsx +81 -0
  453. package/src/lib/components/Txt.ts +203 -0
  454. package/src/lib/components/TxtLeaf.ts +205 -0
  455. package/src/lib/components/Video.ts +397 -0
  456. package/src/lib/components/View2D.ts +98 -0
  457. package/src/lib/components/__tests__/children.test.tsx +142 -0
  458. package/src/lib/components/__tests__/clone.test.tsx +126 -0
  459. package/src/lib/components/__tests__/generatorTest.ts +28 -0
  460. package/src/lib/components/__tests__/mockScene2D.ts +45 -0
  461. package/src/lib/components/__tests__/query.test.tsx +122 -0
  462. package/src/lib/components/__tests__/state.test.tsx +60 -0
  463. package/src/lib/components/index.ts +28 -0
  464. package/src/lib/components/types.ts +35 -0
  465. package/src/lib/curves/ArcSegment.ts +159 -0
  466. package/src/lib/curves/CircleSegment.ts +77 -0
  467. package/src/lib/curves/CubicBezierSegment.ts +78 -0
  468. package/src/lib/curves/CurveDrawingInfo.ts +11 -0
  469. package/src/lib/curves/CurvePoint.ts +15 -0
  470. package/src/lib/curves/CurveProfile.ts +7 -0
  471. package/src/lib/curves/KnotInfo.ts +10 -0
  472. package/src/lib/curves/LineSegment.ts +62 -0
  473. package/src/lib/curves/Polynomial.ts +355 -0
  474. package/src/lib/curves/Polynomial2D.ts +62 -0
  475. package/src/lib/curves/PolynomialSegment.ts +124 -0
  476. package/src/lib/curves/QuadBezierSegment.ts +64 -0
  477. package/src/lib/curves/Segment.ts +17 -0
  478. package/src/lib/curves/UniformPolynomialCurveSampler.ts +94 -0
  479. package/src/lib/curves/createCurveProfileLerp.ts +471 -0
  480. package/src/lib/curves/getBezierSplineProfile.ts +223 -0
  481. package/src/lib/curves/getCircleProfile.ts +86 -0
  482. package/src/lib/curves/getPathProfile.ts +178 -0
  483. package/src/lib/curves/getPointAtDistance.ts +21 -0
  484. package/src/lib/curves/getPolylineProfile.test.ts +21 -0
  485. package/src/lib/curves/getPolylineProfile.ts +89 -0
  486. package/src/lib/curves/getRectProfile.ts +139 -0
  487. package/src/lib/curves/index.ts +16 -0
  488. package/src/lib/decorators/canvasStyleSignal.ts +16 -0
  489. package/src/lib/decorators/colorSignal.ts +9 -0
  490. package/src/lib/decorators/compound.ts +72 -0
  491. package/src/lib/decorators/computed.ts +18 -0
  492. package/src/lib/decorators/defaultStyle.ts +18 -0
  493. package/src/lib/decorators/filtersSignal.ts +136 -0
  494. package/src/lib/decorators/index.ts +10 -0
  495. package/src/lib/decorators/initializers.ts +32 -0
  496. package/src/lib/decorators/nodeName.ts +13 -0
  497. package/src/lib/decorators/signal.test.ts +90 -0
  498. package/src/lib/decorators/signal.ts +345 -0
  499. package/src/lib/decorators/spacingSignal.ts +15 -0
  500. package/src/lib/decorators/vector2Signal.ts +30 -0
  501. package/src/lib/globals.d.ts +2 -0
  502. package/src/lib/index.ts +8 -0
  503. package/src/lib/jsx-dev-runtime.ts +2 -0
  504. package/src/lib/jsx-runtime.ts +46 -0
  505. package/src/lib/parse-svg-path.d.ts +14 -0
  506. package/src/lib/partials/Filter.ts +180 -0
  507. package/src/lib/partials/Gradient.ts +102 -0
  508. package/src/lib/partials/Pattern.ts +34 -0
  509. package/src/lib/partials/ShaderConfig.ts +117 -0
  510. package/src/lib/partials/index.ts +4 -0
  511. package/src/lib/partials/types.ts +58 -0
  512. package/src/lib/scenes/Scene2D.ts +242 -0
  513. package/src/lib/scenes/index.ts +3 -0
  514. package/src/lib/scenes/makeScene2D.ts +16 -0
  515. package/src/lib/scenes/useScene2D.ts +6 -0
  516. package/src/lib/tsconfig.build.json +5 -0
  517. package/src/lib/tsconfig.json +10 -0
  518. package/src/lib/tsdoc.json +4 -0
  519. package/src/lib/utils/CanvasUtils.ts +306 -0
  520. package/src/lib/utils/diff.test.ts +453 -0
  521. package/src/lib/utils/diff.ts +148 -0
  522. package/src/lib/utils/index.ts +2 -0
  523. package/src/lib/utils/is.ts +11 -0
  524. package/src/lib/utils/makeSignalExtensions.ts +30 -0
  525. package/src/lib/utils/video/declarations.d.ts +1 -0
  526. package/src/lib/utils/video/ffmpeg-client.ts +50 -0
  527. package/src/lib/utils/video/mp4-parser-manager.ts +72 -0
  528. package/src/lib/utils/video/parser/index.ts +1 -0
  529. package/src/lib/utils/video/parser/parser.ts +257 -0
  530. package/src/lib/utils/video/parser/sampler.ts +72 -0
  531. package/src/lib/utils/video/parser/segment.ts +302 -0
  532. package/src/lib/utils/video/parser/sink.ts +29 -0
  533. package/src/lib/utils/video/parser/utils.ts +31 -0
  534. package/src/tsconfig.base.json +19 -0
  535. package/src/tsconfig.build.json +8 -0
  536. package/src/tsconfig.json +5 -0
  537. package/tsconfig.project.json +7 -0
@@ -0,0 +1,341 @@
1
+ import './index.css';
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 '@twick/ui';
3
+ import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
4
+ import { signal, computed, useSignalEffect, useComputed, useSignal } from '@preact/signals';
5
+ import { SceneRenderEvent, Vector2, transformVectorAsPoint } from '@twick/core';
6
+ import { createContext } from 'preact';
7
+ import { useMemo, useContext, useRef, useEffect } from 'preact/hooks';
8
+ import { NODE_NAME } from '@twick/2d';
9
+
10
+ const PluginContext = createContext(null);
11
+ const NodeInspectorKey = '@twick/2d/node-inspector';
12
+ function usePluginState() {
13
+ return useContext(PluginContext);
14
+ }
15
+ function Provider({ children }) {
16
+ const { inspection } = useApplication();
17
+ const currentScene = useCurrentScene();
18
+ const state = useMemo(() => {
19
+ const scene = signal(currentScene);
20
+ const selectedKey = signal(null);
21
+ const afterRender = signal(0);
22
+ const hoveredKey = signal(null);
23
+ const openNodes = new Map();
24
+ const selectedChain = computed(() => {
25
+ const chain = new Set();
26
+ const key = selectedKey.value;
27
+ const selectedNode = scene.value?.getNode(key);
28
+ if (selectedNode) {
29
+ let node = selectedNode.parent() ?? null;
30
+ while (node) {
31
+ chain.add(node.key);
32
+ node = node.parent();
33
+ }
34
+ }
35
+ return chain;
36
+ });
37
+ return {
38
+ selectedKey,
39
+ hoveredKey,
40
+ afterRender,
41
+ openNodes,
42
+ selectedChain,
43
+ scene,
44
+ };
45
+ }, []);
46
+ state.scene.value = currentScene;
47
+ useSignalEffect(() => state.scene.value?.onRenderLifecycle.subscribe(([event]) => {
48
+ if (event === SceneRenderEvent.AfterRender) {
49
+ state.afterRender.value++;
50
+ }
51
+ }));
52
+ useSignalEffect(() => {
53
+ const { key, payload } = inspection.value;
54
+ if (key === NodeInspectorKey) {
55
+ state.selectedKey.value = payload;
56
+ }
57
+ });
58
+ useSignalEffect(() => {
59
+ const nodeKey = state.selectedKey.value;
60
+ const { key, payload } = inspection.peek();
61
+ if (key === NodeInspectorKey && !nodeKey) {
62
+ inspection.value = { key: '', payload: null };
63
+ }
64
+ else if (payload !== nodeKey) {
65
+ inspection.value = { key: NodeInspectorKey, payload: nodeKey };
66
+ }
67
+ });
68
+ return (jsx(PluginContext.Provider, { value: state, children: children }));
69
+ }
70
+
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)))] }));
94
+ }
95
+ const NodeInspectorConfig = {
96
+ key: NodeInspectorKey,
97
+ component: Component$1,
98
+ };
99
+
100
+ function Component({ children }) {
101
+ const state = useViewportContext();
102
+ const { scene, selectedKey } = usePluginState();
103
+ const matrix = useViewportMatrix();
104
+ return (jsx(OverlayWrapper, { onPointerDown: event => {
105
+ if (event.button !== MouseButton.Left || event.shiftKey)
106
+ return;
107
+ if (!scene.value)
108
+ return;
109
+ event.stopPropagation();
110
+ const diff = new Vector2(event.x - state.rect.x, event.y - state.rect.y);
111
+ const position = transformVectorAsPoint(diff, matrix.inverse());
112
+ selectedKey.value = scene.value.inspectPosition(position.x, position.y);
113
+ }, children: children }));
114
+ }
115
+ function drawHook() {
116
+ const { selectedKey, hoveredKey, afterRender, scene } = usePluginState();
117
+ selectedKey.value;
118
+ hoveredKey.value;
119
+ afterRender.value;
120
+ return (ctx, matrix) => {
121
+ const currentScene = scene.peek();
122
+ if (!currentScene)
123
+ return;
124
+ let node = currentScene.getNode(selectedKey.value);
125
+ if (node) {
126
+ currentScene.drawOverlay(node.key, matrix, ctx);
127
+ }
128
+ node = currentScene.getNode(hoveredKey.value);
129
+ if (node && hoveredKey.value !== selectedKey.value) {
130
+ ctx.globalAlpha = 0.5;
131
+ currentScene.drawOverlay(hoveredKey.value, matrix, ctx);
132
+ }
133
+ };
134
+ }
135
+ const PreviewOverlayConfig = {
136
+ drawHook,
137
+ component: Component,
138
+ };
139
+
140
+ function CircleIcon() {
141
+ 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" }) }));
142
+ }
143
+
144
+ function CodeBlockIcon() {
145
+ 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" })] }));
146
+ }
147
+
148
+ function CurveIcon() {
149
+ 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" }) }));
150
+ }
151
+
152
+ function GridIcon() {
153
+ 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" }) }));
154
+ }
155
+
156
+ function ImgIcon() {
157
+ 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" })] }));
158
+ }
159
+
160
+ function LayoutIcon() {
161
+ 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" })] }));
162
+ }
163
+
164
+ function LineIcon() {
165
+ 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" }) }));
166
+ }
167
+
168
+ function NodeIcon() {
169
+ 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" }) }));
170
+ }
171
+
172
+ function RayIcon() {
173
+ 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" }) }));
174
+ }
175
+
176
+ function RectIcon() {
177
+ 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" }) }));
178
+ }
179
+
180
+ function ShapeIcon() {
181
+ 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" }) }));
182
+ }
183
+
184
+ function TxtIcon() {
185
+ 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" })] }));
186
+ }
187
+
188
+ function VideoIcon() {
189
+ 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" }) }));
190
+ }
191
+
192
+ function View2DIcon() {
193
+ 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" })] }));
194
+ }
195
+
196
+ /* eslint-disable @typescript-eslint/naming-convention */
197
+ const IconMap = {
198
+ Circle: CircleIcon,
199
+ CodeBlock: CodeBlockIcon,
200
+ Curve: CurveIcon,
201
+ Grid: GridIcon,
202
+ Img: ImgIcon,
203
+ Layout: LayoutIcon,
204
+ Line: LineIcon,
205
+ Node: NodeIcon,
206
+ Ray: RayIcon,
207
+ Rect: RectIcon,
208
+ Shape: ShapeIcon,
209
+ Txt: TxtIcon,
210
+ TxtLeaf: TxtIcon,
211
+ Video: VideoIcon,
212
+ View2D: View2DIcon,
213
+ };
214
+
215
+ 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
+
217
+ var styles = {"root":"index-module_root__omEd0","label":"index-module_label__9BJvW","active":"index-module_active__KevXv","parent":"index-module_parent__5nc9I"};
218
+
219
+ const DEPTH_VAR = '--depth';
220
+ function TreeElement({ label, children, selected, depth = 0, open, icon, forwardRef, ...props }) {
221
+ const hasChildren = !!children;
222
+ return (jsxs(Fragment, { children: [jsxs("div", { ref: forwardRef, className: clsx(styles.label, selected && styles.active, hasChildren && styles.parent), onDblClick: () => {
223
+ if (hasChildren) {
224
+ open.value = !open.value;
225
+ }
226
+ }, ...props, style: { [DEPTH_VAR]: `${depth}` }, children: [hasChildren && (jsx(Toggle, { animated: false, open: open.value, onToggle: value => {
227
+ open.value = value;
228
+ }, onDblClick: e => {
229
+ e.stopPropagation();
230
+ } })), icon, label] }), hasChildren && (jsx(Collapse, { open: open.value, animated: false, children: children }))] }));
231
+ }
232
+
233
+ function NodeElement({ node, depth = 0 }) {
234
+ const { selectedKey, hoveredKey, openNodes, selectedChain, afterRender } = usePluginState();
235
+ const ref = useRef(null);
236
+ const open = useSignal(selectedChain.peek().has(node.key) || (openNodes.get(node.key) ?? false));
237
+ const nodeSignal = useSignal(node);
238
+ nodeSignal.value = node;
239
+ const children = useComputed(() => {
240
+ afterRender.value;
241
+ return nodeSignal.value.peekChildren();
242
+ });
243
+ useSignalEffect(() => {
244
+ open.value = openNodes.get(nodeSignal.value.key) ?? false;
245
+ });
246
+ useSignalEffect(() => {
247
+ const chain = selectedChain.value;
248
+ if (chain.has(nodeSignal.value.key)) {
249
+ open.value = true;
250
+ }
251
+ });
252
+ useSignalEffect(() => {
253
+ openNodes.set(nodeSignal.value.key, open.value);
254
+ });
255
+ useSignalEffect(() => {
256
+ const key = selectedKey.value;
257
+ if (node.key === key) {
258
+ ref.current?.scrollIntoView({ block: 'nearest', behavior: 'instant' });
259
+ }
260
+ });
261
+ const Icon = IconMap[node[NODE_NAME]] ?? IconMap.Node;
262
+ return (jsx(TreeElement, { forwardRef: ref, open: open, depth: depth, icon: jsx(Icon, {}), label: node.key, selected: selectedKey.value === node.key, onClick: event => {
263
+ selectedKey.value = node.key;
264
+ event.stopPropagation();
265
+ }, onPointerEnter: () => (hoveredKey.value = node.key), onPointerLeave: () => (hoveredKey.value = null), children: children.value.length > 0 &&
266
+ children.value.map(child => (jsx(NodeElement, { node: child, depth: depth + 1 }))) }));
267
+ }
268
+
269
+ function TreeRoot({ className, ...props }) {
270
+ return jsx("div", { className: clsx(styles.root, className), ...props });
271
+ }
272
+
273
+ function DetachedRoot() {
274
+ const { afterRender, scene } = usePluginState();
275
+ const open = useSignal(false);
276
+ const currentScene = scene.value;
277
+ const children = currentScene ? [...currentScene.getDetachedNodes()] : [];
278
+ afterRender.value;
279
+ 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;
280
+ }
281
+
282
+ function ViewRoot() {
283
+ const { scene } = usePluginState();
284
+ const view = useSignal(scene.value?.getView());
285
+ useSignalEffect(() => {
286
+ view.value = scene.value?.getView();
287
+ return scene.value?.onReset.subscribe(() => {
288
+ view.value = scene.value?.getView();
289
+ });
290
+ });
291
+ return view.value ? (jsx(TreeRoot, { children: jsx(NodeElement, { node: view.value }) })) : null;
292
+ }
293
+
294
+ function TabComponent({ tab }) {
295
+ const { sidebar } = usePanels();
296
+ const inspectorTab = useRef(null);
297
+ const reducedMotion = useReducedMotion();
298
+ const { selectedKey } = usePluginState();
299
+ const { logger } = useApplication();
300
+ useEffect(() => logger.onInspected.subscribe(key => {
301
+ sidebar.set(tab);
302
+ selectedKey.value = key;
303
+ }), [tab]);
304
+ useSignalEffect(() => {
305
+ if (selectedKey.value &&
306
+ sidebar.current.peek() !== tab &&
307
+ !reducedMotion &&
308
+ inspectorTab.current &&
309
+ inspectorTab.current.getAnimations().length < 2) {
310
+ inspectorTab.current.animate(emphasize(), { duration: 400 });
311
+ inspectorTab.current.animate([{ color: 'white' }, { color: '' }], {
312
+ duration: 800,
313
+ });
314
+ }
315
+ });
316
+ return (jsx(Tab, { forwardRef: inspectorTab, title: "Scene Graph", id: "scene-graph-tab", tab: tab, children: jsx(AccountTree, {}) }));
317
+ }
318
+ function PaneComponent() {
319
+ const { selectedKey } = usePluginState();
320
+ return (jsxs(Pane, { title: "Scene Graph", id: "scene-graph-pane", onClick: () => {
321
+ selectedKey.value = null;
322
+ }, children: [jsx(ViewRoot, {}), jsx(DetachedRoot, {})] }));
323
+ }
324
+ const SceneGraphTabConfig = {
325
+ name: 'scene-graph',
326
+ tabComponent: TabComponent,
327
+ paneComponent: PaneComponent,
328
+ };
329
+
330
+ var index = makeEditorPlugin(() => {
331
+ return {
332
+ name: '@twick/2d',
333
+ provider: Provider,
334
+ previewOverlay: PreviewOverlayConfig,
335
+ tabs: [SceneGraphTabConfig],
336
+ inspectors: [NodeInspectorConfig],
337
+ };
338
+ });
339
+
340
+ export { index as default };
341
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/editor/Provider.tsx","../src/editor/NodeInspectorConfig.tsx","../src/editor/PreviewOverlayConfig.tsx","../src/editor/icons/CircleIcon.tsx","../src/editor/icons/CodeBlockIcon.tsx","../src/editor/icons/CurveIcon.tsx","../src/editor/icons/GridIcon.tsx","../src/editor/icons/ImgIcon.tsx","../src/editor/icons/LayoutIcon.tsx","../src/editor/icons/LineIcon.tsx","../src/editor/icons/NodeIcon.tsx","../src/editor/icons/RayIcon.tsx","../src/editor/icons/RectIcon.tsx","../src/editor/icons/ShapeIcon.tsx","../src/editor/icons/TxtIcon.tsx","../src/editor/icons/VideoIcon.tsx","../src/editor/icons/View2DIcon.tsx","../src/editor/icons/IconMap.ts","../../../node_modules/clsx/dist/clsx.mjs","../src/editor/tree/TreeElement.tsx","../src/editor/tree/NodeElement.tsx","../src/editor/tree/TreeRoot.tsx","../src/editor/tree/DetachedRoot.tsx","../src/editor/tree/ViewRoot.tsx","../src/editor/SceneGraphTabConfig.tsx","../src/editor/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"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}export 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}export default clsx;",null,null,null,null,null,null,null],"names":["_jsx","Component","_jsxs","_Fragment"],"mappings":";;;;;;;;;AAkBA,MAAM,aAAa,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAEvD,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;SAE3C,cAAc,GAAA;AAC5B,IAAA,OAAO,UAAU,CAAC,aAAa,CAAE,CAAC;AACpC,CAAC;AAEe,SAAA,QAAQ,CAAC,EAAC,QAAQ,EAAiC,EAAA;AACjE,IAAA,MAAM,EAAC,UAAU,EAAC,GAAG,cAAc,EAAE,CAAC;AACtC,IAAA,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;AAEvC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,MAAK;AACzB,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,YAAuB,CAAC,CAAC;AAC9C,QAAA,MAAM,WAAW,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;AAChD,QAAA,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9B,QAAA,MAAM,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;AAC/C,QAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;AAC7C,QAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAK;AAClC,YAAA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;AAChC,YAAA,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC;YAC9B,MAAM,YAAY,GAAG,KA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AS,aAAa,GAAA;AACpB,IAAA,MAAM,EAAC,WAAW,EAAC,GAAG,cAAc,EAAE,CAAC;AAEvC,IAAA,QACEE,IAAA,CAAC,IAAI,EAAA,EACH,KAAK,EAAC,aAAa,EACnB,EAAE,EAAC,kBAAkB,EACrB,OAAO,EAAE,MAAK;AACZ,YAAA,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;SAC1B,EAAA,QAAA,EAAA,CAEDF,GAAC,CAAA,QAAQ,EAAG,EAAA,CAAA,EACZA,IAAC,YAAY,EAAA,EAAA,CAAG,CACX,EAAA,CAAA,EACP;AACJ,CAAC;AAEM,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,YAAY,EAAE,YAAY;AAC1B,IAAA,aAAa,EAAE,aAAa;CAC7B;;ACxED,YAAe,gBAAgB,CAAC,MAAK;IACnC,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,QAAQ,EAAE,QAAQ;AAClB,QAAA,cAAc,EAAE,oBAAoB;QACpC,IAAI,EAAE,CAAC,mBAAmB,CAAC;QAC3B,UAAU,EAAE,CAAC,mBAAmB,CAAC;KAClC,CAAC;AACJ,CAAC,CAAC;;;;","x_google_ignoreList":[18]}
@@ -0,0 +1,83 @@
1
+ import { Vector2 } from '@twick/core';
2
+ import type { Code } from '../components';
3
+ import type { CodeScope } from './CodeScope';
4
+ export interface CodeFragmentDrawingInfo {
5
+ text: string;
6
+ position: Vector2;
7
+ characterSize: Vector2;
8
+ cursor: Vector2;
9
+ fill: string;
10
+ time: number;
11
+ alpha: number;
12
+ }
13
+ /**
14
+ * A stateful class for recursively traversing a code scope.
15
+ *
16
+ * @internal
17
+ */
18
+ export declare class CodeCursor {
19
+ private readonly node;
20
+ cursor: Vector2;
21
+ beforeCursor: Vector2;
22
+ afterCursor: Vector2;
23
+ beforeIndex: number;
24
+ afterIndex: number;
25
+ private context;
26
+ private monoWidth;
27
+ private maxWidth;
28
+ private lineHeight;
29
+ private fallbackFill;
30
+ private caches;
31
+ private highlighter;
32
+ private selection;
33
+ private selectionProgress;
34
+ private globalProgress;
35
+ private fragmentDrawingInfo;
36
+ private fontHeight;
37
+ private verticalOffset;
38
+ constructor(node: Code);
39
+ /**
40
+ * Prepare the cursor for the next traversal.
41
+ *
42
+ * @param context - The context used to measure and draw the code.
43
+ */
44
+ setupMeasure(context: CanvasRenderingContext2D): void;
45
+ setupDraw(context: CanvasRenderingContext2D): void;
46
+ /**
47
+ * Measure the desired size of the code scope.
48
+ *
49
+ * @remarks
50
+ * The result can be retrieved with {@link getSize}.
51
+ *
52
+ * @param scope - The code scope to measure.
53
+ */
54
+ measureSize(scope: CodeScope): void;
55
+ /**
56
+ * Get the size measured by the cursor.
57
+ */
58
+ getSize(): {
59
+ x: number;
60
+ y: number;
61
+ };
62
+ /**
63
+ * Get the drawing information created by the cursor.
64
+ */
65
+ getDrawingInfo(): {
66
+ fragments: CodeFragmentDrawingInfo[];
67
+ verticalOffset: number;
68
+ fontHeight: number;
69
+ };
70
+ /**
71
+ * Draw the given code scope.
72
+ *
73
+ * @param scope - The code scope to draw.
74
+ */
75
+ drawScope(scope: CodeScope): void;
76
+ private drawToken;
77
+ private calculateWidth;
78
+ private calculateMaxWidth;
79
+ private currentProgress;
80
+ private processSelection;
81
+ private isSelected;
82
+ }
83
+ //# sourceMappingURL=CodeCursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeCursor.d.ts","sourceRoot":"","sources":["../../src/lib/code/CodeCursor.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AAMxC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAI3C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAA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