@twick/2d 0.14.18 → 0.14.19

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 (536) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +4 -4
  3. package/src/editor/NodeInspectorConfig.tsx +76 -76
  4. package/src/editor/PreviewOverlayConfig.tsx +67 -67
  5. package/src/editor/Provider.tsx +93 -93
  6. package/src/editor/SceneGraphTabConfig.tsx +81 -81
  7. package/src/editor/icons/CircleIcon.tsx +7 -7
  8. package/src/editor/icons/CodeBlockIcon.tsx +8 -8
  9. package/src/editor/icons/CurveIcon.tsx +7 -7
  10. package/src/editor/icons/GridIcon.tsx +7 -7
  11. package/src/editor/icons/IconMap.ts +35 -35
  12. package/src/editor/icons/ImgIcon.tsx +8 -8
  13. package/src/editor/icons/LayoutIcon.tsx +9 -9
  14. package/src/editor/icons/LineIcon.tsx +7 -7
  15. package/src/editor/icons/NodeIcon.tsx +7 -7
  16. package/src/editor/icons/RayIcon.tsx +7 -7
  17. package/src/editor/icons/RectIcon.tsx +7 -7
  18. package/src/editor/icons/ShapeIcon.tsx +7 -7
  19. package/src/editor/icons/TxtIcon.tsx +8 -8
  20. package/src/editor/icons/VideoIcon.tsx +7 -7
  21. package/src/editor/icons/View2DIcon.tsx +10 -10
  22. package/src/editor/index.ts +17 -17
  23. package/src/editor/tree/DetachedRoot.tsx +23 -23
  24. package/src/editor/tree/NodeElement.tsx +74 -74
  25. package/src/editor/tree/TreeElement.tsx +72 -72
  26. package/src/editor/tree/TreeRoot.tsx +10 -10
  27. package/src/editor/tree/ViewRoot.tsx +20 -20
  28. package/src/editor/tree/index.module.scss +38 -38
  29. package/src/editor/tree/index.ts +3 -3
  30. package/src/editor/tsconfig.build.json +5 -5
  31. package/src/editor/tsconfig.json +12 -12
  32. package/src/editor/tsdoc.json +4 -4
  33. package/src/editor/vite-env.d.ts +1 -1
  34. package/src/lib/code/CodeCursor.ts +445 -445
  35. package/src/lib/code/CodeDiffer.ts +78 -78
  36. package/src/lib/code/CodeFragment.ts +97 -97
  37. package/src/lib/code/CodeHighlighter.ts +75 -75
  38. package/src/lib/code/CodeMetrics.ts +47 -47
  39. package/src/lib/code/CodeRange.test.ts +74 -74
  40. package/src/lib/code/CodeRange.ts +216 -216
  41. package/src/lib/code/CodeScope.ts +101 -101
  42. package/src/lib/code/CodeSelection.ts +24 -24
  43. package/src/lib/code/CodeSignal.ts +327 -327
  44. package/src/lib/code/CodeTokenizer.ts +54 -54
  45. package/src/lib/code/DefaultHighlightStyle.ts +98 -98
  46. package/src/lib/code/LezerHighlighter.ts +113 -113
  47. package/src/lib/code/diff.test.ts +311 -311
  48. package/src/lib/code/diff.ts +319 -319
  49. package/src/lib/code/extractRange.ts +126 -126
  50. package/src/lib/code/index.ts +13 -13
  51. package/src/lib/components/Audio.ts +168 -168
  52. package/src/lib/components/Bezier.ts +105 -105
  53. package/src/lib/components/Circle.ts +266 -266
  54. package/src/lib/components/Code.ts +526 -526
  55. package/src/lib/components/CodeBlock.ts +576 -576
  56. package/src/lib/components/CubicBezier.ts +112 -112
  57. package/src/lib/components/Curve.ts +455 -455
  58. package/src/lib/components/Grid.ts +135 -135
  59. package/src/lib/components/Icon.ts +96 -96
  60. package/src/lib/components/Img.ts +319 -319
  61. package/src/lib/components/Knot.ts +157 -157
  62. package/src/lib/components/Latex.ts +122 -122
  63. package/src/lib/components/Layout.ts +1092 -1092
  64. package/src/lib/components/Line.ts +429 -429
  65. package/src/lib/components/Media.ts +576 -576
  66. package/src/lib/components/Node.ts +1940 -1940
  67. package/src/lib/components/Path.ts +137 -137
  68. package/src/lib/components/Polygon.ts +171 -171
  69. package/src/lib/components/QuadBezier.ts +100 -100
  70. package/src/lib/components/Ray.ts +125 -125
  71. package/src/lib/components/Rect.ts +187 -187
  72. package/src/lib/components/Rive.ts +156 -156
  73. package/src/lib/components/SVG.ts +797 -797
  74. package/src/lib/components/Shape.ts +143 -143
  75. package/src/lib/components/Spline.ts +344 -344
  76. package/src/lib/components/Txt.test.tsx +81 -81
  77. package/src/lib/components/Txt.ts +203 -203
  78. package/src/lib/components/TxtLeaf.ts +205 -205
  79. package/src/lib/components/Video.ts +461 -461
  80. package/src/lib/components/View2D.ts +98 -98
  81. package/src/lib/components/__tests__/children.test.tsx +142 -142
  82. package/src/lib/components/__tests__/clone.test.tsx +126 -126
  83. package/src/lib/components/__tests__/generatorTest.ts +28 -28
  84. package/src/lib/components/__tests__/mockScene2D.ts +45 -45
  85. package/src/lib/components/__tests__/query.test.tsx +122 -122
  86. package/src/lib/components/__tests__/state.test.tsx +60 -60
  87. package/src/lib/components/index.ts +28 -28
  88. package/src/lib/components/types.ts +35 -35
  89. package/src/lib/curves/ArcSegment.ts +159 -159
  90. package/src/lib/curves/CircleSegment.ts +77 -77
  91. package/src/lib/curves/CubicBezierSegment.ts +78 -78
  92. package/src/lib/curves/CurveDrawingInfo.ts +11 -11
  93. package/src/lib/curves/CurvePoint.ts +15 -15
  94. package/src/lib/curves/CurveProfile.ts +7 -7
  95. package/src/lib/curves/KnotInfo.ts +10 -10
  96. package/src/lib/curves/LineSegment.ts +62 -62
  97. package/src/lib/curves/Polynomial.ts +355 -355
  98. package/src/lib/curves/Polynomial2D.ts +62 -62
  99. package/src/lib/curves/PolynomialSegment.ts +124 -124
  100. package/src/lib/curves/QuadBezierSegment.ts +64 -64
  101. package/src/lib/curves/Segment.ts +17 -17
  102. package/src/lib/curves/UniformPolynomialCurveSampler.ts +94 -94
  103. package/src/lib/curves/createCurveProfileLerp.ts +471 -471
  104. package/src/lib/curves/getBezierSplineProfile.ts +223 -223
  105. package/src/lib/curves/getCircleProfile.ts +86 -86
  106. package/src/lib/curves/getPathProfile.ts +178 -178
  107. package/src/lib/curves/getPointAtDistance.ts +21 -21
  108. package/src/lib/curves/getPolylineProfile.test.ts +21 -21
  109. package/src/lib/curves/getPolylineProfile.ts +89 -89
  110. package/src/lib/curves/getRectProfile.ts +139 -139
  111. package/src/lib/curves/index.ts +16 -16
  112. package/src/lib/decorators/canvasStyleSignal.ts +16 -16
  113. package/src/lib/decorators/colorSignal.ts +9 -9
  114. package/src/lib/decorators/compound.ts +72 -72
  115. package/src/lib/decorators/computed.ts +18 -18
  116. package/src/lib/decorators/defaultStyle.ts +18 -18
  117. package/src/lib/decorators/filtersSignal.ts +136 -136
  118. package/src/lib/decorators/index.ts +10 -10
  119. package/src/lib/decorators/initializers.ts +32 -32
  120. package/src/lib/decorators/nodeName.ts +13 -13
  121. package/src/lib/decorators/signal.test.ts +90 -90
  122. package/src/lib/decorators/signal.ts +345 -345
  123. package/src/lib/decorators/spacingSignal.ts +15 -15
  124. package/src/lib/decorators/vector2Signal.ts +30 -30
  125. package/src/lib/globals.d.ts +2 -2
  126. package/src/lib/index.ts +8 -8
  127. package/src/lib/jsx-dev-runtime.ts +2 -2
  128. package/src/lib/jsx-runtime.ts +46 -46
  129. package/src/lib/parse-svg-path.d.ts +14 -14
  130. package/src/lib/partials/Filter.ts +180 -180
  131. package/src/lib/partials/Gradient.ts +102 -102
  132. package/src/lib/partials/Pattern.ts +34 -34
  133. package/src/lib/partials/ShaderConfig.ts +117 -117
  134. package/src/lib/partials/index.ts +4 -4
  135. package/src/lib/partials/types.ts +58 -58
  136. package/src/lib/scenes/Scene2D.ts +242 -242
  137. package/src/lib/scenes/index.ts +3 -3
  138. package/src/lib/scenes/makeScene2D.ts +16 -16
  139. package/src/lib/scenes/useScene2D.ts +6 -6
  140. package/src/lib/tsconfig.build.json +5 -5
  141. package/src/lib/tsconfig.json +10 -10
  142. package/src/lib/tsdoc.json +4 -4
  143. package/src/lib/utils/CanvasUtils.ts +306 -306
  144. package/src/lib/utils/diff.test.ts +453 -453
  145. package/src/lib/utils/diff.ts +148 -148
  146. package/src/lib/utils/index.ts +2 -2
  147. package/src/lib/utils/is.ts +11 -11
  148. package/src/lib/utils/makeSignalExtensions.ts +30 -30
  149. package/src/lib/utils/video/declarations.d.ts +1 -1
  150. package/src/lib/utils/video/ffmpeg-client.ts +50 -50
  151. package/src/lib/utils/video/mp4-parser-manager.ts +72 -72
  152. package/src/lib/utils/video/parser/index.ts +1 -1
  153. package/src/lib/utils/video/parser/parser.ts +257 -257
  154. package/src/lib/utils/video/parser/sampler.ts +72 -72
  155. package/src/lib/utils/video/parser/segment.ts +302 -302
  156. package/src/lib/utils/video/parser/sink.ts +29 -29
  157. package/src/lib/utils/video/parser/utils.ts +31 -31
  158. package/src/tsconfig.base.json +19 -19
  159. package/src/tsconfig.build.json +8 -8
  160. package/src/tsconfig.json +5 -5
  161. package/tsconfig.project.json +7 -7
  162. package/editor/editor/NodeInspectorConfig.d.ts +0 -3
  163. package/editor/editor/NodeInspectorConfig.d.ts.map +0 -1
  164. package/editor/editor/PreviewOverlayConfig.d.ts +0 -3
  165. package/editor/editor/PreviewOverlayConfig.d.ts.map +0 -1
  166. package/editor/editor/Provider.d.ts +0 -17
  167. package/editor/editor/Provider.d.ts.map +0 -1
  168. package/editor/editor/SceneGraphTabConfig.d.ts +0 -3
  169. package/editor/editor/SceneGraphTabConfig.d.ts.map +0 -1
  170. package/editor/editor/icons/CircleIcon.d.ts +0 -2
  171. package/editor/editor/icons/CircleIcon.d.ts.map +0 -1
  172. package/editor/editor/icons/CodeBlockIcon.d.ts +0 -2
  173. package/editor/editor/icons/CodeBlockIcon.d.ts.map +0 -1
  174. package/editor/editor/icons/CurveIcon.d.ts +0 -2
  175. package/editor/editor/icons/CurveIcon.d.ts.map +0 -1
  176. package/editor/editor/icons/GridIcon.d.ts +0 -2
  177. package/editor/editor/icons/GridIcon.d.ts.map +0 -1
  178. package/editor/editor/icons/IconMap.d.ts +0 -3
  179. package/editor/editor/icons/IconMap.d.ts.map +0 -1
  180. package/editor/editor/icons/ImgIcon.d.ts +0 -2
  181. package/editor/editor/icons/ImgIcon.d.ts.map +0 -1
  182. package/editor/editor/icons/LayoutIcon.d.ts +0 -2
  183. package/editor/editor/icons/LayoutIcon.d.ts.map +0 -1
  184. package/editor/editor/icons/LineIcon.d.ts +0 -2
  185. package/editor/editor/icons/LineIcon.d.ts.map +0 -1
  186. package/editor/editor/icons/NodeIcon.d.ts +0 -2
  187. package/editor/editor/icons/NodeIcon.d.ts.map +0 -1
  188. package/editor/editor/icons/RayIcon.d.ts +0 -2
  189. package/editor/editor/icons/RayIcon.d.ts.map +0 -1
  190. package/editor/editor/icons/RectIcon.d.ts +0 -2
  191. package/editor/editor/icons/RectIcon.d.ts.map +0 -1
  192. package/editor/editor/icons/ShapeIcon.d.ts +0 -2
  193. package/editor/editor/icons/ShapeIcon.d.ts.map +0 -1
  194. package/editor/editor/icons/TxtIcon.d.ts +0 -2
  195. package/editor/editor/icons/TxtIcon.d.ts.map +0 -1
  196. package/editor/editor/icons/VideoIcon.d.ts +0 -2
  197. package/editor/editor/icons/VideoIcon.d.ts.map +0 -1
  198. package/editor/editor/icons/View2DIcon.d.ts +0 -2
  199. package/editor/editor/icons/View2DIcon.d.ts.map +0 -1
  200. package/editor/editor/index.d.ts +0 -4
  201. package/editor/editor/index.d.ts.map +0 -1
  202. package/editor/editor/tree/DetachedRoot.d.ts +0 -2
  203. package/editor/editor/tree/DetachedRoot.d.ts.map +0 -1
  204. package/editor/editor/tree/NodeElement.d.ts +0 -8
  205. package/editor/editor/tree/NodeElement.d.ts.map +0 -1
  206. package/editor/editor/tree/TreeElement.d.ts +0 -15
  207. package/editor/editor/tree/TreeElement.d.ts.map +0 -1
  208. package/editor/editor/tree/TreeRoot.d.ts +0 -3
  209. package/editor/editor/tree/TreeRoot.d.ts.map +0 -1
  210. package/editor/editor/tree/ViewRoot.d.ts +0 -2
  211. package/editor/editor/tree/ViewRoot.d.ts.map +0 -1
  212. package/editor/editor/tree/index.d.ts +0 -4
  213. package/editor/editor/tree/index.d.ts.map +0 -1
  214. package/editor/editor/tsconfig.build.tsbuildinfo +0 -1
  215. package/editor/index.css +0 -33
  216. package/editor/index.js +0 -341
  217. package/editor/index.js.map +0 -1
  218. package/lib/code/CodeCursor.d.ts +0 -83
  219. package/lib/code/CodeCursor.d.ts.map +0 -1
  220. package/lib/code/CodeCursor.js +0 -306
  221. package/lib/code/CodeDiffer.d.ts +0 -28
  222. package/lib/code/CodeDiffer.d.ts.map +0 -1
  223. package/lib/code/CodeDiffer.js +0 -51
  224. package/lib/code/CodeFragment.d.ts +0 -42
  225. package/lib/code/CodeFragment.d.ts.map +0 -1
  226. package/lib/code/CodeFragment.js +0 -72
  227. package/lib/code/CodeHighlighter.d.ts +0 -71
  228. package/lib/code/CodeHighlighter.d.ts.map +0 -1
  229. package/lib/code/CodeHighlighter.js +0 -2
  230. package/lib/code/CodeMetrics.d.ts +0 -11
  231. package/lib/code/CodeMetrics.d.ts.map +0 -1
  232. package/lib/code/CodeMetrics.js +0 -29
  233. package/lib/code/CodeRange.d.ts +0 -41
  234. package/lib/code/CodeRange.d.ts.map +0 -1
  235. package/lib/code/CodeRange.js +0 -179
  236. package/lib/code/CodeScope.d.ts +0 -16
  237. package/lib/code/CodeScope.d.ts.map +0 -1
  238. package/lib/code/CodeScope.js +0 -72
  239. package/lib/code/CodeSelection.d.ts +0 -6
  240. package/lib/code/CodeSelection.d.ts.map +0 -1
  241. package/lib/code/CodeSelection.js +0 -13
  242. package/lib/code/CodeSignal.d.ts +0 -60
  243. package/lib/code/CodeSignal.d.ts.map +0 -1
  244. package/lib/code/CodeSignal.js +0 -194
  245. package/lib/code/CodeTokenizer.d.ts +0 -8
  246. package/lib/code/CodeTokenizer.d.ts.map +0 -1
  247. package/lib/code/CodeTokenizer.js +0 -50
  248. package/lib/code/DefaultHighlightStyle.d.ts +0 -3
  249. package/lib/code/DefaultHighlightStyle.d.ts.map +0 -1
  250. package/lib/code/DefaultHighlightStyle.js +0 -98
  251. package/lib/code/LezerHighlighter.d.ts +0 -22
  252. package/lib/code/LezerHighlighter.d.ts.map +0 -1
  253. package/lib/code/LezerHighlighter.js +0 -89
  254. package/lib/code/diff.d.ts +0 -31
  255. package/lib/code/diff.d.ts.map +0 -1
  256. package/lib/code/diff.js +0 -236
  257. package/lib/code/extractRange.d.ts +0 -17
  258. package/lib/code/extractRange.d.ts.map +0 -1
  259. package/lib/code/extractRange.js +0 -102
  260. package/lib/code/index.d.ts +0 -14
  261. package/lib/code/index.d.ts.map +0 -1
  262. package/lib/code/index.js +0 -14
  263. package/lib/components/Audio.d.ts +0 -14
  264. package/lib/components/Audio.d.ts.map +0 -1
  265. package/lib/components/Audio.js +0 -148
  266. package/lib/components/Bezier.d.ts +0 -23
  267. package/lib/components/Bezier.d.ts.map +0 -1
  268. package/lib/components/Bezier.js +0 -81
  269. package/lib/components/Circle.d.ts +0 -193
  270. package/lib/components/Circle.d.ts.map +0 -1
  271. package/lib/components/Circle.js +0 -178
  272. package/lib/components/Code.d.ts +0 -231
  273. package/lib/components/Code.d.ts.map +0 -1
  274. package/lib/components/Code.js +0 -325
  275. package/lib/components/CodeBlock.d.ts +0 -133
  276. package/lib/components/CodeBlock.d.ts.map +0 -1
  277. package/lib/components/CodeBlock.js +0 -461
  278. package/lib/components/CubicBezier.d.ts +0 -70
  279. package/lib/components/CubicBezier.d.ts.map +0 -1
  280. package/lib/components/CubicBezier.js +0 -81
  281. package/lib/components/Curve.d.ts +0 -204
  282. package/lib/components/Curve.d.ts.map +0 -1
  283. package/lib/components/Curve.js +0 -284
  284. package/lib/components/Grid.d.ts +0 -76
  285. package/lib/components/Grid.d.ts.map +0 -1
  286. package/lib/components/Grid.js +0 -91
  287. package/lib/components/Icon.d.ts +0 -59
  288. package/lib/components/Icon.d.ts.map +0 -1
  289. package/lib/components/Icon.js +0 -58
  290. package/lib/components/Img.d.ts +0 -118
  291. package/lib/components/Img.d.ts.map +0 -1
  292. package/lib/components/Img.js +0 -245
  293. package/lib/components/Knot.d.ts +0 -90
  294. package/lib/components/Knot.d.ts.map +0 -1
  295. package/lib/components/Knot.js +0 -68
  296. package/lib/components/Latex.d.ts +0 -39
  297. package/lib/components/Latex.d.ts.map +0 -1
  298. package/lib/components/Latex.js +0 -101
  299. package/lib/components/Layout.d.ts +0 -419
  300. package/lib/components/Layout.d.ts.map +0 -1
  301. package/lib/components/Layout.js +0 -706
  302. package/lib/components/Line.d.ts +0 -160
  303. package/lib/components/Line.d.ts.map +0 -1
  304. package/lib/components/Line.js +0 -346
  305. package/lib/components/Media.d.ts +0 -70
  306. package/lib/components/Media.d.ts.map +0 -1
  307. package/lib/components/Media.js +0 -493
  308. package/lib/components/Node.d.ts +0 -836
  309. package/lib/components/Node.d.ts.map +0 -1
  310. package/lib/components/Node.js +0 -1317
  311. package/lib/components/Path.d.ts +0 -20
  312. package/lib/components/Path.d.ts.map +0 -1
  313. package/lib/components/Path.js +0 -97
  314. package/lib/components/Polygon.d.ts +0 -113
  315. package/lib/components/Polygon.d.ts.map +0 -1
  316. package/lib/components/Polygon.js +0 -123
  317. package/lib/components/QuadBezier.d.ts +0 -62
  318. package/lib/components/QuadBezier.d.ts.map +0 -1
  319. package/lib/components/QuadBezier.js +0 -76
  320. package/lib/components/Ray.d.ts +0 -62
  321. package/lib/components/Ray.d.ts.map +0 -1
  322. package/lib/components/Ray.js +0 -96
  323. package/lib/components/Rect.d.ts +0 -114
  324. package/lib/components/Rect.d.ts.map +0 -1
  325. package/lib/components/Rect.js +0 -76
  326. package/lib/components/Rive.d.ts +0 -22
  327. package/lib/components/Rive.d.ts.map +0 -1
  328. package/lib/components/Rive.js +0 -117
  329. package/lib/components/SVG.d.ts +0 -178
  330. package/lib/components/SVG.d.ts.map +0 -1
  331. package/lib/components/SVG.js +0 -577
  332. package/lib/components/Shape.d.ts +0 -40
  333. package/lib/components/Shape.d.ts.map +0 -1
  334. package/lib/components/Shape.js +0 -134
  335. package/lib/components/Spline.d.ts +0 -89
  336. package/lib/components/Spline.d.ts.map +0 -1
  337. package/lib/components/Spline.js +0 -256
  338. package/lib/components/Txt.d.ts +0 -53
  339. package/lib/components/Txt.d.ts.map +0 -1
  340. package/lib/components/Txt.js +0 -173
  341. package/lib/components/TxtLeaf.d.ts +0 -21
  342. package/lib/components/TxtLeaf.d.ts.map +0 -1
  343. package/lib/components/TxtLeaf.js +0 -181
  344. package/lib/components/Video.d.ts +0 -69
  345. package/lib/components/Video.d.ts.map +0 -1
  346. package/lib/components/Video.js +0 -342
  347. package/lib/components/View2D.d.ts +0 -28
  348. package/lib/components/View2D.d.ts.map +0 -1
  349. package/lib/components/View2D.js +0 -93
  350. package/lib/components/index.d.ts +0 -29
  351. package/lib/components/index.d.ts.map +0 -1
  352. package/lib/components/index.js +0 -29
  353. package/lib/components/types.d.ts +0 -17
  354. package/lib/components/types.d.ts.map +0 -1
  355. package/lib/components/types.js +0 -2
  356. package/lib/curves/ArcSegment.d.ts +0 -26
  357. package/lib/curves/ArcSegment.d.ts.map +0 -1
  358. package/lib/curves/ArcSegment.js +0 -97
  359. package/lib/curves/CircleSegment.d.ts +0 -18
  360. package/lib/curves/CircleSegment.d.ts.map +0 -1
  361. package/lib/curves/CircleSegment.js +0 -52
  362. package/lib/curves/CubicBezierSegment.d.ts +0 -18
  363. package/lib/curves/CubicBezierSegment.d.ts.map +0 -1
  364. package/lib/curves/CubicBezierSegment.js +0 -55
  365. package/lib/curves/CurveDrawingInfo.d.ts +0 -11
  366. package/lib/curves/CurveDrawingInfo.d.ts.map +0 -1
  367. package/lib/curves/CurveDrawingInfo.js +0 -2
  368. package/lib/curves/CurvePoint.d.ts +0 -15
  369. package/lib/curves/CurvePoint.d.ts.map +0 -1
  370. package/lib/curves/CurvePoint.js +0 -2
  371. package/lib/curves/CurveProfile.d.ts +0 -7
  372. package/lib/curves/CurveProfile.d.ts.map +0 -1
  373. package/lib/curves/CurveProfile.js +0 -2
  374. package/lib/curves/KnotInfo.d.ts +0 -12
  375. package/lib/curves/KnotInfo.d.ts.map +0 -1
  376. package/lib/curves/KnotInfo.js +0 -2
  377. package/lib/curves/LineSegment.d.ts +0 -16
  378. package/lib/curves/LineSegment.d.ts.map +0 -1
  379. package/lib/curves/LineSegment.js +0 -45
  380. package/lib/curves/Polynomial.d.ts +0 -118
  381. package/lib/curves/Polynomial.d.ts.map +0 -1
  382. package/lib/curves/Polynomial.js +0 -259
  383. package/lib/curves/Polynomial2D.d.ts +0 -22
  384. package/lib/curves/Polynomial2D.d.ts.map +0 -1
  385. package/lib/curves/Polynomial2D.js +0 -45
  386. package/lib/curves/PolynomialSegment.d.ts +0 -39
  387. package/lib/curves/PolynomialSegment.d.ts.map +0 -1
  388. package/lib/curves/PolynomialSegment.js +0 -86
  389. package/lib/curves/QuadBezierSegment.d.ts +0 -17
  390. package/lib/curves/QuadBezierSegment.d.ts.map +0 -1
  391. package/lib/curves/QuadBezierSegment.js +0 -49
  392. package/lib/curves/Segment.d.ts +0 -9
  393. package/lib/curves/Segment.d.ts.map +0 -1
  394. package/lib/curves/Segment.js +0 -3
  395. package/lib/curves/UniformPolynomialCurveSampler.d.ts +0 -43
  396. package/lib/curves/UniformPolynomialCurveSampler.d.ts.map +0 -1
  397. package/lib/curves/UniformPolynomialCurveSampler.js +0 -73
  398. package/lib/curves/createCurveProfileLerp.d.ts +0 -32
  399. package/lib/curves/createCurveProfileLerp.d.ts.map +0 -1
  400. package/lib/curves/createCurveProfileLerp.js +0 -351
  401. package/lib/curves/getBezierSplineProfile.d.ts +0 -12
  402. package/lib/curves/getBezierSplineProfile.d.ts.map +0 -1
  403. package/lib/curves/getBezierSplineProfile.js +0 -137
  404. package/lib/curves/getCircleProfile.d.ts +0 -4
  405. package/lib/curves/getCircleProfile.d.ts.map +0 -1
  406. package/lib/curves/getCircleProfile.js +0 -44
  407. package/lib/curves/getPathProfile.d.ts +0 -3
  408. package/lib/curves/getPathProfile.d.ts.map +0 -1
  409. package/lib/curves/getPathProfile.js +0 -128
  410. package/lib/curves/getPointAtDistance.d.ts +0 -4
  411. package/lib/curves/getPointAtDistance.d.ts.map +0 -1
  412. package/lib/curves/getPointAtDistance.js +0 -15
  413. package/lib/curves/getPolylineProfile.d.ts +0 -4
  414. package/lib/curves/getPolylineProfile.d.ts.map +0 -1
  415. package/lib/curves/getPolylineProfile.js +0 -58
  416. package/lib/curves/getRectProfile.d.ts +0 -4
  417. package/lib/curves/getRectProfile.d.ts.map +0 -1
  418. package/lib/curves/getRectProfile.js +0 -57
  419. package/lib/curves/index.d.ts +0 -17
  420. package/lib/curves/index.d.ts.map +0 -1
  421. package/lib/curves/index.js +0 -17
  422. package/lib/decorators/canvasStyleSignal.d.ts +0 -5
  423. package/lib/decorators/canvasStyleSignal.d.ts.map +0 -1
  424. package/lib/decorators/canvasStyleSignal.js +0 -12
  425. package/lib/decorators/colorSignal.d.ts +0 -2
  426. package/lib/decorators/colorSignal.d.ts.map +0 -1
  427. package/lib/decorators/colorSignal.js +0 -9
  428. package/lib/decorators/compound.d.ts +0 -26
  429. package/lib/decorators/compound.d.ts.map +0 -1
  430. package/lib/decorators/compound.js +0 -49
  431. package/lib/decorators/computed.d.ts +0 -9
  432. package/lib/decorators/computed.d.ts.map +0 -1
  433. package/lib/decorators/computed.js +0 -18
  434. package/lib/decorators/defaultStyle.d.ts +0 -2
  435. package/lib/decorators/defaultStyle.d.ts.map +0 -1
  436. package/lib/decorators/defaultStyle.js +0 -14
  437. package/lib/decorators/filtersSignal.d.ts +0 -13
  438. package/lib/decorators/filtersSignal.d.ts.map +0 -1
  439. package/lib/decorators/filtersSignal.js +0 -73
  440. package/lib/decorators/index.d.ts +0 -11
  441. package/lib/decorators/index.d.ts.map +0 -1
  442. package/lib/decorators/index.js +0 -11
  443. package/lib/decorators/initializers.d.ts +0 -4
  444. package/lib/decorators/initializers.d.ts.map +0 -1
  445. package/lib/decorators/initializers.js +0 -27
  446. package/lib/decorators/nodeName.d.ts +0 -9
  447. package/lib/decorators/nodeName.d.ts.map +0 -1
  448. package/lib/decorators/nodeName.js +0 -13
  449. package/lib/decorators/signal.d.ts +0 -183
  450. package/lib/decorators/signal.d.ts.map +0 -1
  451. package/lib/decorators/signal.js +0 -285
  452. package/lib/decorators/spacingSignal.d.ts +0 -2
  453. package/lib/decorators/spacingSignal.d.ts.map +0 -1
  454. package/lib/decorators/spacingSignal.js +0 -15
  455. package/lib/decorators/vector2Signal.d.ts +0 -9
  456. package/lib/decorators/vector2Signal.d.ts.map +0 -1
  457. package/lib/decorators/vector2Signal.js +0 -15
  458. package/lib/index.d.ts +0 -9
  459. package/lib/index.d.ts.map +0 -1
  460. package/lib/index.js +0 -9
  461. package/lib/jsx-dev-runtime.d.ts +0 -3
  462. package/lib/jsx-dev-runtime.d.ts.map +0 -1
  463. package/lib/jsx-dev-runtime.js +0 -3
  464. package/lib/jsx-runtime.d.ts +0 -12
  465. package/lib/jsx-runtime.d.ts.map +0 -1
  466. package/lib/jsx-runtime.js +0 -23
  467. package/lib/partials/Filter.d.ts +0 -82
  468. package/lib/partials/Filter.d.ts.map +0 -1
  469. package/lib/partials/Filter.js +0 -135
  470. package/lib/partials/Gradient.d.ts +0 -31
  471. package/lib/partials/Gradient.d.ts.map +0 -1
  472. package/lib/partials/Gradient.js +0 -63
  473. package/lib/partials/Pattern.d.ts +0 -13
  474. package/lib/partials/Pattern.d.ts.map +0 -1
  475. package/lib/partials/Pattern.js +0 -27
  476. package/lib/partials/ShaderConfig.d.ts +0 -81
  477. package/lib/partials/ShaderConfig.d.ts.map +0 -1
  478. package/lib/partials/ShaderConfig.js +0 -25
  479. package/lib/partials/index.d.ts +0 -5
  480. package/lib/partials/index.d.ts.map +0 -1
  481. package/lib/partials/index.js +0 -5
  482. package/lib/partials/types.d.ts +0 -35
  483. package/lib/partials/types.d.ts.map +0 -1
  484. package/lib/partials/types.js +0 -2
  485. package/lib/scenes/Scene2D.d.ts +0 -29
  486. package/lib/scenes/Scene2D.d.ts.map +0 -1
  487. package/lib/scenes/Scene2D.js +0 -180
  488. package/lib/scenes/index.d.ts +0 -4
  489. package/lib/scenes/index.d.ts.map +0 -1
  490. package/lib/scenes/index.js +0 -4
  491. package/lib/scenes/makeScene2D.d.ts +0 -5
  492. package/lib/scenes/makeScene2D.d.ts.map +0 -1
  493. package/lib/scenes/makeScene2D.js +0 -11
  494. package/lib/scenes/useScene2D.d.ts +0 -3
  495. package/lib/scenes/useScene2D.d.ts.map +0 -1
  496. package/lib/scenes/useScene2D.js +0 -5
  497. package/lib/tsconfig.build.tsbuildinfo +0 -1
  498. package/lib/utils/CanvasUtils.d.ts +0 -23
  499. package/lib/utils/CanvasUtils.d.ts.map +0 -1
  500. package/lib/utils/CanvasUtils.js +0 -138
  501. package/lib/utils/diff.d.ts +0 -31
  502. package/lib/utils/diff.d.ts.map +0 -1
  503. package/lib/utils/diff.js +0 -97
  504. package/lib/utils/index.d.ts +0 -3
  505. package/lib/utils/index.d.ts.map +0 -1
  506. package/lib/utils/index.js +0 -3
  507. package/lib/utils/is.d.ts +0 -8
  508. package/lib/utils/is.d.ts.map +0 -1
  509. package/lib/utils/is.js +0 -10
  510. package/lib/utils/makeSignalExtensions.d.ts +0 -4
  511. package/lib/utils/makeSignalExtensions.d.ts.map +0 -1
  512. package/lib/utils/makeSignalExtensions.js +0 -20
  513. package/lib/utils/video/ffmpeg-client.d.ts +0 -5
  514. package/lib/utils/video/ffmpeg-client.d.ts.map +0 -1
  515. package/lib/utils/video/ffmpeg-client.js +0 -32
  516. package/lib/utils/video/mp4-parser-manager.d.ts +0 -3
  517. package/lib/utils/video/mp4-parser-manager.d.ts.map +0 -1
  518. package/lib/utils/video/mp4-parser-manager.js +0 -55
  519. package/lib/utils/video/parser/index.d.ts +0 -2
  520. package/lib/utils/video/parser/index.d.ts.map +0 -1
  521. package/lib/utils/video/parser/index.js +0 -2
  522. package/lib/utils/video/parser/parser.d.ts +0 -21
  523. package/lib/utils/video/parser/parser.d.ts.map +0 -1
  524. package/lib/utils/video/parser/parser.js +0 -168
  525. package/lib/utils/video/parser/sampler.d.ts +0 -16
  526. package/lib/utils/video/parser/sampler.d.ts.map +0 -1
  527. package/lib/utils/video/parser/sampler.js +0 -56
  528. package/lib/utils/video/parser/segment.d.ts +0 -48
  529. package/lib/utils/video/parser/segment.d.ts.map +0 -1
  530. package/lib/utils/video/parser/segment.js +0 -239
  531. package/lib/utils/video/parser/sink.d.ts +0 -9
  532. package/lib/utils/video/parser/sink.d.ts.map +0 -1
  533. package/lib/utils/video/parser/sink.js +0 -22
  534. package/lib/utils/video/parser/utils.d.ts +0 -10
  535. package/lib/utils/video/parser/utils.d.ts.map +0 -1
  536. package/lib/utils/video/parser/utils.js +0 -22
@@ -1,204 +0,0 @@
1
- import type { BBox, SerializedVector2, SignalValue, SimpleSignal } from '@twick/core';
2
- import { Vector2 } from '@twick/core';
3
- import type { CurveDrawingInfo } from '../curves/CurveDrawingInfo';
4
- import type { CurvePoint } from '../curves/CurvePoint';
5
- import type { CurveProfile } from '../curves/CurveProfile';
6
- import type { DesiredLength } from '../partials';
7
- import type { ShapeProps } from './Shape';
8
- import { Shape } from './Shape';
9
- export interface CurveProps extends ShapeProps {
10
- /**
11
- * {@inheritDoc Curve.closed}
12
- */
13
- closed?: SignalValue<boolean>;
14
- /**
15
- * {@inheritDoc Curve.start}
16
- */
17
- start?: SignalValue<number>;
18
- /**
19
- * {@inheritDoc Curve.startOffset}
20
- */
21
- startOffset?: SignalValue<number>;
22
- /**
23
- * {@inheritDoc Curve.startArrow}
24
- */
25
- startArrow?: SignalValue<boolean>;
26
- /**
27
- * {@inheritDoc Curve.end}
28
- */
29
- end?: SignalValue<number>;
30
- /**
31
- * {@inheritDoc Curve.endOffset}
32
- */
33
- endOffset?: SignalValue<number>;
34
- /**
35
- * {@inheritDoc Curve.endArrow}
36
- */
37
- endArrow?: SignalValue<boolean>;
38
- /**
39
- * {@inheritDoc Curve.arrowSize}
40
- */
41
- arrowSize?: SignalValue<number>;
42
- }
43
- export declare abstract class Curve extends Shape {
44
- /**
45
- * Whether the curve should be closed.
46
- *
47
- * @remarks
48
- * Closed curves have their start and end points connected.
49
- */
50
- readonly closed: SimpleSignal<boolean, this>;
51
- /**
52
- * A percentage from the start before which the curve should be clipped.
53
- *
54
- * @remarks
55
- * The portion of the curve that comes before the given percentage will be
56
- * made invisible.
57
- *
58
- * This property is usefully for animating the curve appearing on the screen.
59
- * The value of `0` means the very start of the curve (accounting for the
60
- * {@link startOffset}) while `1` means the very end (accounting for the
61
- * {@link endOffset}).
62
- */
63
- readonly start: SimpleSignal<number, this>;
64
- /**
65
- * The offset in pixels from the start of the curve.
66
- *
67
- * @remarks
68
- * This property lets you specify where along the defined curve the actual
69
- * visible portion starts. For example, setting it to `20` will make the first
70
- * 20 pixels of the curve invisible.
71
- *
72
- * This property is useful for trimming the curve using a fixed distance.
73
- * If you want to animate the curve appearing on the screen, use {@link start}
74
- * instead.
75
- */
76
- readonly startOffset: SimpleSignal<number, this>;
77
- /**
78
- * Whether to display an arrow at the start of the visible curve.
79
- *
80
- * @remarks
81
- * Use {@link arrowSize} to control the size of the arrow.
82
- */
83
- readonly startArrow: SimpleSignal<boolean, this>;
84
- /**
85
- * A percentage from the start after which the curve should be clipped.
86
- *
87
- * @remarks
88
- * The portion of the curve that comes after the given percentage will be
89
- * made invisible.
90
- *
91
- * This property is usefully for animating the curve appearing on the screen.
92
- * The value of `0` means the very start of the curve (accounting for the
93
- * {@link startOffset}) while `1` means the very end (accounting for the
94
- * {@link endOffset}).
95
- */
96
- readonly end: SimpleSignal<number, this>;
97
- /**
98
- * The offset in pixels from the end of the curve.
99
- *
100
- * @remarks
101
- * This property lets you specify where along the defined curve the actual
102
- * visible portion ends. For example, setting it to `20` will make the last
103
- * 20 pixels of the curve invisible.
104
- *
105
- * This property is useful for trimming the curve using a fixed distance.
106
- * If you want to animate the curve appearing on the screen, use {@link end}
107
- * instead.
108
- */
109
- readonly endOffset: SimpleSignal<number, this>;
110
- /**
111
- * Whether to display an arrow at the end of the visible curve.
112
- *
113
- * @remarks
114
- * Use {@link arrowSize} to control the size of the arrow.
115
- */
116
- readonly endArrow: SimpleSignal<boolean, this>;
117
- /**
118
- * Controls the size of the end and start arrows.
119
- *
120
- * @remarks
121
- * To make the arrows visible make sure to enable {@link startArrow} and/or
122
- * {@link endArrow}.
123
- */
124
- readonly arrowSize: SimpleSignal<number, this>;
125
- protected canHaveSubpath: boolean;
126
- protected desiredSize(): SerializedVector2<DesiredLength>;
127
- constructor(props: CurveProps);
128
- protected abstract childrenBBox(): BBox;
129
- abstract profile(): CurveProfile;
130
- /**
131
- * Convert a percentage along the curve to a distance.
132
- *
133
- * @remarks
134
- * The returned distance is given in relation to the full curve, not
135
- * accounting for {@link startOffset} and {@link endOffset}.
136
- *
137
- * @param value - The percentage along the curve.
138
- */
139
- percentageToDistance(value: number): number;
140
- /**
141
- * Convert a distance along the curve to a percentage.
142
- *
143
- * @remarks
144
- * The distance should be given in relation to the full curve, not
145
- * accounting for {@link startOffset} and {@link endOffset}.
146
- *
147
- * @param value - The distance along the curve.
148
- */
149
- distanceToPercentage(value: number): number;
150
- /**
151
- * The base arc length of this curve.
152
- *
153
- * @remarks
154
- * This is the entire length of this curve, not accounting for
155
- * {@link startOffset | the offsets}.
156
- */
157
- baseArcLength(): number;
158
- /**
159
- * The offset arc length of this curve.
160
- *
161
- * @remarks
162
- * This is the length of the curve that accounts for
163
- * {@link startOffset | the offsets}.
164
- */
165
- offsetArcLength(): number;
166
- /**
167
- * The visible arc length of this curve.
168
- *
169
- * @remarks
170
- * This arc length accounts for both the offset and the {@link start} and
171
- * {@link end} properties.
172
- */
173
- arcLength(): number;
174
- /**
175
- * The percentage of the curve that's currently visible.
176
- *
177
- * @remarks
178
- * The returned value is the ratio between the visible length (as defined by
179
- * {@link start} and {@link end}) and the offset length of the curve.
180
- */
181
- completion(): number;
182
- protected processSubpath(_path: Path2D, _startPoint: Vector2 | null, _endPoint: Vector2 | null): void;
183
- protected curveDrawingInfo(): CurveDrawingInfo;
184
- protected getPointAtDistance(value: number): CurvePoint;
185
- getPointAtPercentage(value: number): CurvePoint;
186
- protected getComputedLayout(): BBox;
187
- protected offsetComputedLayout(box: BBox): BBox;
188
- protected getPath(): Path2D;
189
- protected getCacheBBox(): BBox;
190
- protected lineWidthCoefficient(): number;
191
- /**
192
- * Check if the path requires a profile.
193
- *
194
- * @remarks
195
- * The profile is only required if certain features are used. Otherwise, the
196
- * profile generation can be skipped, and the curve can be drawn directly
197
- * using the 2D context.
198
- */
199
- protected requiresProfile(): boolean;
200
- protected drawShape(context: CanvasRenderingContext2D): void;
201
- private drawArrows;
202
- private drawArrow;
203
- }
204
- //# sourceMappingURL=Curve.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Curve.d.ts","sourceRoot":"","sources":["../../src/lib/components/Curve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,OAAO,EAAQ,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC;;OAEG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IA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;;OAMG;IACI,eAAe;IAOtB;;;;;;OAMG;IAEI,SAAS;IAIhB;;;;;;OAMG;IACI,UAAU,IAAI,MAAM;IAI3B,SAAS,CAAC,cAAc,CAEtB,KAAK,EAAE,MAAM,EAEb,WAAW,EAAE,OAAO,GAAG,IAAI,EAE3B,SAAS,EAAE,OAAO,GAAG,IAAI;IAM3B,SAAS,CAAC,gBAAgB,IAAI,gBAAgB;IA6F9C,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAIhD,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;cAInC,iBAAiB,IAAI,IAAI;IAI5C,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI;cAK5B,OAAO,IAAI,MAAM;cAIjB,YAAY,IAAI,IAAI;IAWvC,SAAS,CAAC,oBAAoB,IAAI,MAAM;IAIxC;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,IAAI,OAAO;cAWjB,SAAS,CAAC,OAAO,EAAE,wBAAwB;IAO9D,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,SAAS;CAelB"}
@@ -1,284 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Vector2, clamp } from '@twick/core';
8
- import { getPointAtDistance } from '../curves/getPointAtDistance';
9
- import { computed, initial, nodeName, signal } from '../decorators';
10
- import { lineTo, moveTo, resolveCanvasStyle } from '../utils';
11
- import { Shape } from './Shape';
12
- let Curve = class Curve extends Shape {
13
- desiredSize() {
14
- return this.childrenBBox().size;
15
- }
16
- constructor(props) {
17
- super(props);
18
- this.canHaveSubpath = false;
19
- }
20
- /**
21
- * Convert a percentage along the curve to a distance.
22
- *
23
- * @remarks
24
- * The returned distance is given in relation to the full curve, not
25
- * accounting for {@link startOffset} and {@link endOffset}.
26
- *
27
- * @param value - The percentage along the curve.
28
- */
29
- percentageToDistance(value) {
30
- return clamp(0, this.baseArcLength(), this.startOffset() + this.offsetArcLength() * value);
31
- }
32
- /**
33
- * Convert a distance along the curve to a percentage.
34
- *
35
- * @remarks
36
- * The distance should be given in relation to the full curve, not
37
- * accounting for {@link startOffset} and {@link endOffset}.
38
- *
39
- * @param value - The distance along the curve.
40
- */
41
- distanceToPercentage(value) {
42
- return (value - this.startOffset()) / this.offsetArcLength();
43
- }
44
- /**
45
- * The base arc length of this curve.
46
- *
47
- * @remarks
48
- * This is the entire length of this curve, not accounting for
49
- * {@link startOffset | the offsets}.
50
- */
51
- baseArcLength() {
52
- return this.profile().arcLength;
53
- }
54
- /**
55
- * The offset arc length of this curve.
56
- *
57
- * @remarks
58
- * This is the length of the curve that accounts for
59
- * {@link startOffset | the offsets}.
60
- */
61
- offsetArcLength() {
62
- const startOffset = this.startOffset();
63
- const endOffset = this.endOffset();
64
- const baseLength = this.baseArcLength();
65
- return clamp(0, baseLength, baseLength - startOffset - endOffset);
66
- }
67
- /**
68
- * The visible arc length of this curve.
69
- *
70
- * @remarks
71
- * This arc length accounts for both the offset and the {@link start} and
72
- * {@link end} properties.
73
- */
74
- arcLength() {
75
- return this.offsetArcLength() * Math.abs(this.start() - this.end());
76
- }
77
- /**
78
- * The percentage of the curve that's currently visible.
79
- *
80
- * @remarks
81
- * The returned value is the ratio between the visible length (as defined by
82
- * {@link start} and {@link end}) and the offset length of the curve.
83
- */
84
- completion() {
85
- return Math.abs(this.start() - this.end());
86
- }
87
- processSubpath(
88
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
89
- _path,
90
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
- _startPoint,
92
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
- _endPoint) {
94
- // do nothing
95
- }
96
- curveDrawingInfo() {
97
- const path = new Path2D();
98
- let subpath = new Path2D();
99
- const profile = this.profile();
100
- let start = this.percentageToDistance(this.start());
101
- let end = this.percentageToDistance(this.end());
102
- if (start > end) {
103
- [start, end] = [end, start];
104
- }
105
- const distance = end - start;
106
- const arrowSize = Math.min(distance / 2, this.arrowSize());
107
- if (this.startArrow()) {
108
- start += arrowSize / 2;
109
- }
110
- if (this.endArrow()) {
111
- end -= arrowSize / 2;
112
- }
113
- let length = 0;
114
- let startPoint = null;
115
- let startTangent = null;
116
- let endPoint = null;
117
- let endTangent = null;
118
- for (const segment of profile.segments) {
119
- const previousLength = length;
120
- length += segment.arcLength;
121
- if (length < start) {
122
- continue;
123
- }
124
- const relativeStart = (start - previousLength) / segment.arcLength;
125
- const relativeEnd = (end - previousLength) / segment.arcLength;
126
- const clampedStart = clamp(0, 1, relativeStart);
127
- const clampedEnd = clamp(0, 1, relativeEnd);
128
- if (this.canHaveSubpath &&
129
- endPoint &&
130
- !segment.getPoint(0).position.equals(endPoint)) {
131
- path.addPath(subpath);
132
- this.processSubpath(subpath, startPoint, endPoint);
133
- subpath = new Path2D();
134
- startPoint = null;
135
- }
136
- const [startCurvePoint, endCurvePoint] = segment.draw(subpath, clampedStart, clampedEnd, startPoint === null);
137
- if (startPoint === null) {
138
- startPoint = startCurvePoint.position;
139
- startTangent = startCurvePoint.normal.flipped.perpendicular;
140
- }
141
- endPoint = endCurvePoint.position;
142
- endTangent = endCurvePoint.normal.flipped.perpendicular;
143
- if (length > end) {
144
- break;
145
- }
146
- }
147
- if (this.closed() &&
148
- this.start.isInitial() &&
149
- this.end.isInitial() &&
150
- this.startOffset.isInitial() &&
151
- this.endOffset.isInitial()) {
152
- subpath.closePath();
153
- }
154
- this.processSubpath(subpath, startPoint, endPoint);
155
- path.addPath(subpath);
156
- return {
157
- startPoint: startPoint ?? Vector2.zero,
158
- startTangent: startTangent ?? Vector2.right,
159
- endPoint: endPoint ?? Vector2.zero,
160
- endTangent: endTangent ?? Vector2.right,
161
- arrowSize,
162
- path,
163
- startOffset: start,
164
- };
165
- }
166
- getPointAtDistance(value) {
167
- return getPointAtDistance(this.profile(), value + this.startOffset());
168
- }
169
- getPointAtPercentage(value) {
170
- return getPointAtDistance(this.profile(), this.percentageToDistance(value));
171
- }
172
- getComputedLayout() {
173
- return this.offsetComputedLayout(super.getComputedLayout());
174
- }
175
- offsetComputedLayout(box) {
176
- box.position = box.position.sub(this.childrenBBox().center);
177
- return box;
178
- }
179
- getPath() {
180
- return this.curveDrawingInfo().path;
181
- }
182
- getCacheBBox() {
183
- const box = this.childrenBBox();
184
- const arrowSize = this.startArrow() || this.endArrow() ? this.arrowSize() : 0;
185
- const lineWidth = this.lineWidth();
186
- const coefficient = this.lineWidthCoefficient();
187
- return box.expand(Math.max(0, arrowSize, lineWidth * coefficient));
188
- }
189
- lineWidthCoefficient() {
190
- return this.lineCap() === 'square' ? 0.5 * 1.4143 : 0.5;
191
- }
192
- /**
193
- * Check if the path requires a profile.
194
- *
195
- * @remarks
196
- * The profile is only required if certain features are used. Otherwise, the
197
- * profile generation can be skipped, and the curve can be drawn directly
198
- * using the 2D context.
199
- */
200
- requiresProfile() {
201
- return (!this.start.isInitial() ||
202
- !this.startOffset.isInitial() ||
203
- !this.startArrow.isInitial() ||
204
- !this.end.isInitial() ||
205
- !this.endOffset.isInitial() ||
206
- !this.endArrow.isInitial());
207
- }
208
- drawShape(context) {
209
- super.drawShape(context);
210
- if (this.startArrow() || this.endArrow()) {
211
- this.drawArrows(context);
212
- }
213
- }
214
- drawArrows(context) {
215
- const { startPoint, startTangent, endPoint, endTangent, arrowSize } = this.curveDrawingInfo();
216
- if (arrowSize < 0.001) {
217
- return;
218
- }
219
- context.save();
220
- context.beginPath();
221
- if (this.endArrow()) {
222
- this.drawArrow(context, endPoint, endTangent.flipped, arrowSize);
223
- }
224
- if (this.startArrow()) {
225
- this.drawArrow(context, startPoint, startTangent, arrowSize);
226
- }
227
- context.fillStyle = resolveCanvasStyle(this.stroke(), context);
228
- context.closePath();
229
- context.fill();
230
- context.restore();
231
- }
232
- drawArrow(context, center, tangent, arrowSize) {
233
- const normal = tangent.perpendicular;
234
- const origin = center.add(tangent.scale(-arrowSize / 2));
235
- moveTo(context, origin);
236
- lineTo(context, origin.add(tangent.add(normal).scale(arrowSize)));
237
- lineTo(context, origin.add(tangent.sub(normal).scale(arrowSize)));
238
- lineTo(context, origin);
239
- context.closePath();
240
- }
241
- };
242
- __decorate([
243
- initial(false),
244
- signal()
245
- ], Curve.prototype, "closed", void 0);
246
- __decorate([
247
- initial(0),
248
- signal()
249
- ], Curve.prototype, "start", void 0);
250
- __decorate([
251
- initial(0),
252
- signal()
253
- ], Curve.prototype, "startOffset", void 0);
254
- __decorate([
255
- initial(false),
256
- signal()
257
- ], Curve.prototype, "startArrow", void 0);
258
- __decorate([
259
- initial(1),
260
- signal()
261
- ], Curve.prototype, "end", void 0);
262
- __decorate([
263
- initial(0),
264
- signal()
265
- ], Curve.prototype, "endOffset", void 0);
266
- __decorate([
267
- initial(false),
268
- signal()
269
- ], Curve.prototype, "endArrow", void 0);
270
- __decorate([
271
- initial(24),
272
- signal()
273
- ], Curve.prototype, "arrowSize", void 0);
274
- __decorate([
275
- computed()
276
- ], Curve.prototype, "arcLength", null);
277
- __decorate([
278
- computed()
279
- ], Curve.prototype, "curveDrawingInfo", null);
280
- Curve = __decorate([
281
- nodeName('Curve')
282
- ], Curve);
283
- export { Curve };
284
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ3VydmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2NvbXBvbmVudHMvQ3VydmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBTUEsT0FBTyxFQ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kLE1BQU0sRUFBRTt5Q0FDdUQ7QUFnQnhDO0lBRnZCLE9BQU8sQ0FBQyxDQUFDLENBQUM7SUFDVixNQUFNLEVBQUU7a0NBQytDO0FBZ0JoQztJQUZ2QixPQUFPLENBQUMsQ0FBQyxDQUFDO0lBQ1YsTUFBTSxFQUFFO3dDQUNxRDtBQVV0QztJQUZ2QixPQUFPLENBQUMsS0FBSyxDQUFDO0lBQ2QsTUFBTSxFQUFFO3VDQUNxRDtBQVd0QztJQUZ2QixPQUFPLENBQUMsRUFBRSxDQUFDO0lBQ1gsTUFBTSxFQUFFO3dDQUNxRDtBQStFdkQ7SUFETixRQUFRLEVBQUU7c0NBR1Y7QUF5QlM7SUFEVCxRQUFRLEVBQUU7NkNBNEZWO0FBN1NtQixLQUFLO0lBRDFCLFFBQVEsQ0FBQyxPQUFPLENBQUM7R0FDSSxLQUFLLENBaVoxQiJ9
@@ -1,76 +0,0 @@
1
- import type { PossibleVector2, SignalValue, SimpleSignal, Vector2Signal } from '@twick/core';
2
- import type { ShapeProps } from './Shape';
3
- import { Shape } from './Shape';
4
- export interface GridProps extends ShapeProps {
5
- /**
6
- * {@inheritDoc Grid.spacing}
7
- */
8
- spacing?: SignalValue<PossibleVector2>;
9
- /**
10
- * {@inheritDoc Grid.start}
11
- */
12
- start?: SignalValue<number>;
13
- /**
14
- * {@inheritDoc Grid.end}
15
- */
16
- end?: SignalValue<number>;
17
- }
18
- /**
19
- * A node for drawing a two-dimensional grid.
20
- *
21
- * @preview
22
- * ```tsx editor
23
- * import {Grid, makeScene2D} from '@twick/2d';
24
- * import {all, createRef} from '@twick/core';
25
- *
26
- * export default makeScene2D(function* (view) {
27
- * const grid = createRef<Grid>();
28
- *
29
- * view.add(
30
- * <Grid
31
- * ref={grid}
32
- * width={'100%'}
33
- * height={'100%'}
34
- * stroke={'#666'}
35
- * start={0}
36
- * end={1}
37
- * />,
38
- * );
39
- *
40
- * yield* all(
41
- * grid().end(0.5, 1).to(1, 1).wait(1),
42
- * grid().start(0.5, 1).to(0, 1).wait(1),
43
- * );
44
- * });
45
- * ```
46
- */
47
- export declare class Grid extends Shape {
48
- /**
49
- * The spacing between the grid lines.
50
- */
51
- readonly spacing: Vector2Signal<this>;
52
- /**
53
- * The percentage that should be clipped from the beginning of each grid line.
54
- *
55
- * @remarks
56
- * The portion of each grid line that comes before the given percentage will
57
- * be made invisible.
58
- *
59
- * This property is useful for animating the grid appearing on-screen.
60
- */
61
- readonly start: SimpleSignal<number, this>;
62
- /**
63
- * The percentage that should be clipped from the end of each grid line.
64
- *
65
- * @remarks
66
- * The portion of each grid line that comes after the given percentage will
67
- * be made invisible.
68
- *
69
- * This property is useful for animating the grid appearing on-screen.
70
- */
71
- readonly end: SimpleSignal<number, this>;
72
- constructor(props: GridProps);
73
- protected drawShape(context: CanvasRenderingContext2D): void;
74
- private mapPoints;
75
- }
76
- //# sourceMappingURL=Grid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/lib/components/Grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B;;OAEG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,IAAK,SAAQ,KAAK;IAC7B;;OAEG;IACH,SAEwB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAErD;;;;;;;;OAQG;IACH,SAEwB,KAAK,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAE1D;;;;;;;;OAQG;IACH,SAEwB,GAAG,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAErC,KAAK,EAAE,SAAS;cAIhB,SAAS,CAAC,OAAO,EAAE,wBAAwB;IA8B9D,OAAO,CAAC,SAAS;CAUlB"}
@@ -1,91 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { map } from '@twick/core';
8
- import { initial, nodeName, signal, vector2Signal } from '../decorators';
9
- import { Shape } from './Shape';
10
- /**
11
- * A node for drawing a two-dimensional grid.
12
- *
13
- * @preview
14
- * ```tsx editor
15
- * import {Grid, makeScene2D} from '@twick/2d';
16
- * import {all, createRef} from '@twick/core';
17
- *
18
- * export default makeScene2D(function* (view) {
19
- * const grid = createRef<Grid>();
20
- *
21
- * view.add(
22
- * <Grid
23
- * ref={grid}
24
- * width={'100%'}
25
- * height={'100%'}
26
- * stroke={'#666'}
27
- * start={0}
28
- * end={1}
29
- * />,
30
- * );
31
- *
32
- * yield* all(
33
- * grid().end(0.5, 1).to(1, 1).wait(1),
34
- * grid().start(0.5, 1).to(0, 1).wait(1),
35
- * );
36
- * });
37
- * ```
38
- */
39
- let Grid = class Grid extends Shape {
40
- constructor(props) {
41
- super(props);
42
- }
43
- drawShape(context) {
44
- context.save();
45
- this.applyStyle(context);
46
- this.drawRipple(context);
47
- const spacing = this.spacing();
48
- const size = this.computedSize().scale(0.5);
49
- const steps = size.div(spacing).floored;
50
- for (let x = -steps.x; x <= steps.x; x++) {
51
- const [from, to] = this.mapPoints(-size.height, size.height);
52
- context.beginPath();
53
- context.moveTo(spacing.x * x, from);
54
- context.lineTo(spacing.x * x, to);
55
- context.stroke();
56
- }
57
- for (let y = -steps.y; y <= steps.y; y++) {
58
- const [from, to] = this.mapPoints(-size.width, size.width);
59
- context.beginPath();
60
- context.moveTo(from, spacing.y * y);
61
- context.lineTo(to, spacing.y * y);
62
- context.stroke();
63
- }
64
- context.restore();
65
- }
66
- mapPoints(start, end) {
67
- let from = map(start, end, this.start());
68
- let to = map(start, end, this.end());
69
- if (to < from) {
70
- [from, to] = [to, from];
71
- }
72
- return [from, to];
73
- }
74
- };
75
- __decorate([
76
- initial(80),
77
- vector2Signal('spacing')
78
- ], Grid.prototype, "spacing", void 0);
79
- __decorate([
80
- initial(0),
81
- signal()
82
- ], Grid.prototype, "start", void 0);
83
- __decorate([
84
- initial(1),
85
- signal()
86
- ], Grid.prototype, "end", void 0);
87
- Grid = __decorate([
88
- nodeName('Grid')
89
- ], Grid);
90
- export { Grid };
91
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3JpZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvY29tcG9uZW50cy9HcmlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQU1BLE9BQU8sRUFBQyxHQUFHLEVBQUMsTUFBTSxhQUFhLENBQUM7QUFDaEMsT0FBTyxFQUFDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLGFBQWEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUV2RSxPQUFPLEVBQUMsS0FBSyxFQUFDLE1BQU0sU0FBUyxDQUFDO0FBaUI5Qjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7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