@motionscript/core 0.1.0-alpha.8 → 0.1.0-alpha.9

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 (791) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  105. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  106. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  107. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  119. package/dist/attributes/shape/fill/index.js.map +1 -1
  120. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  121. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  122. package/dist/attributes/shape/fill/registry.js.map +1 -1
  123. package/dist/attributes/shape/fill/union.js.map +1 -1
  124. package/dist/attributes/shape/filters/chain.js.map +1 -1
  125. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  126. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  134. package/dist/attributes/shape/filters/index.js.map +1 -1
  135. package/dist/attributes/shape/filters/registry.js.map +1 -1
  136. package/dist/attributes/shape/filters/union.js.map +1 -1
  137. package/dist/attributes/shape/path/anchors.js.map +1 -1
  138. package/dist/attributes/shape/path/bezier.js.map +1 -1
  139. package/dist/attributes/shape/path/index.js.map +1 -1
  140. package/dist/attributes/shape/path/measure.js.map +1 -1
  141. package/dist/attributes/shape/path/morph.js.map +1 -1
  142. package/dist/attributes/shape/path/ops.js.map +1 -1
  143. package/dist/attributes/shape/path/types.js.map +1 -1
  144. package/dist/attributes/shape/path/walk.js.map +1 -1
  145. package/dist/attributes/shape/shaders/index.js.map +1 -1
  146. package/dist/attributes/shape/shaders/language.js.map +1 -1
  147. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  148. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  149. package/dist/attributes/shape/shadow/index.js.map +1 -1
  150. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  151. package/dist/attributes/shape/stroke/index.js.map +1 -1
  152. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  153. package/dist/attributes/shared/operators.js.map +1 -1
  154. package/dist/attributes/text/index.js.map +1 -1
  155. package/dist/attributes/text/ops.js.map +1 -1
  156. package/dist/attributes/text/types.js.map +1 -1
  157. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  158. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  159. package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
  160. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  161. package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
  162. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  163. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  164. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  165. package/dist/browser/component.js +1 -1
  166. package/dist/browser/experimental.js +1 -1
  167. package/dist/browser/experimental.js.map +1 -1
  168. package/dist/browser/index.js +1 -1
  169. package/dist/browser/index.js.map +1 -1
  170. package/dist/browser/sdk.js +1 -1
  171. package/dist/component.js.map +1 -1
  172. package/dist/components/builtins/audio/audio.js.map +1 -1
  173. package/dist/components/builtins/geometry/composite.js.map +1 -1
  174. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  175. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  176. package/dist/components/builtins/layout/layout.js.map +1 -1
  177. package/dist/components/builtins/media/media.js.map +1 -1
  178. package/dist/components/builtins/providers/providers.js.map +1 -1
  179. package/dist/components/builtins/text/number-format.js.map +1 -1
  180. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  181. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  182. package/dist/components/builtins/text/text-layout.js.map +1 -1
  183. package/dist/components/builtins/text/text.d.ts +9 -9
  184. package/dist/components/builtins/text/text.js.map +1 -1
  185. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  186. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  187. package/dist/components/builtins/three/three.js.map +1 -1
  188. package/dist/components/factory/api.js.map +1 -1
  189. package/dist/components/factory/clip-of.js.map +1 -1
  190. package/dist/components/factory/commands-for.js.map +1 -1
  191. package/dist/components/factory/component-audio.js.map +1 -1
  192. package/dist/components/factory/component2d.js.map +1 -1
  193. package/dist/components/factory/component3d.js.map +1 -1
  194. package/dist/components/factory/factory.js.map +1 -1
  195. package/dist/components/factory/timeline.js.map +1 -1
  196. package/dist/components/factory/type-def.js.map +1 -1
  197. package/dist/components/factory/types.js.map +1 -1
  198. package/dist/components/factory/views.js.map +1 -1
  199. package/dist/components/modules/aim.js.map +1 -1
  200. package/dist/components/modules/corners.js.map +1 -1
  201. package/dist/components/modules/flow.js.map +1 -1
  202. package/dist/components/modules/material.js.map +1 -1
  203. package/dist/components/modules/paint.js.map +1 -1
  204. package/dist/components/modules/shapes.js.map +1 -1
  205. package/dist/components/modules/text-layout.js.map +1 -1
  206. package/dist/components/modules/text-style.d.ts +1 -1
  207. package/dist/components/modules/text-style.js.map +1 -1
  208. package/dist/components/modules/three-entries.js.map +1 -1
  209. package/dist/components/modules/view3d.js.map +1 -1
  210. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  211. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  212. package/dist/components/trees/2d/node-motion.js.map +1 -1
  213. package/dist/components/trees/2d/node-render.js.map +1 -1
  214. package/dist/components/trees/2d/node-space.js.map +1 -1
  215. package/dist/components/trees/2d/node-transform.js.map +1 -1
  216. package/dist/components/trees/2d/node2d.js.map +1 -1
  217. package/dist/components/trees/audio/index.js.map +1 -1
  218. package/dist/components/trees/audio/node-audio.js.map +1 -1
  219. package/dist/components/trees/index.js.map +1 -1
  220. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  221. package/dist/components/trees/node/node-reactive.js.map +1 -1
  222. package/dist/components/trees/node/node-time.js.map +1 -1
  223. package/dist/components/trees/node/node-walk.js.map +1 -1
  224. package/dist/components/trees/node/node.js.map +1 -1
  225. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  226. package/dist/components/trees/three/node3d.js.map +1 -1
  227. package/dist/document/audio.js.map +1 -1
  228. package/dist/document/builtins.js.map +1 -1
  229. package/dist/document/command-traits.js.map +1 -1
  230. package/dist/document/deny-globals.js.map +1 -1
  231. package/dist/document/diff.js.map +1 -1
  232. package/dist/document/doc-index.js.map +1 -1
  233. package/dist/document/expression/compile.js.map +1 -1
  234. package/dist/document/expression/index.js.map +1 -1
  235. package/dist/document/expression/ops.js.map +1 -1
  236. package/dist/document/expression/parse.js.map +1 -1
  237. package/dist/document/expression/refs.js.map +1 -1
  238. package/dist/document/expression/types.js.map +1 -1
  239. package/dist/document/expression/walk.js.map +1 -1
  240. package/dist/document/index.js.map +1 -1
  241. package/dist/document/migrate.js.map +1 -1
  242. package/dist/document/missing-node.js.map +1 -1
  243. package/dist/document/node-decorator.js.map +1 -1
  244. package/dist/document/node-descriptor.js.map +1 -1
  245. package/dist/document/placement.js.map +1 -1
  246. package/dist/document/project.js.map +1 -1
  247. package/dist/document/prop-evolution.js.map +1 -1
  248. package/dist/document/registry.js.map +1 -1
  249. package/dist/document/settled-index.js.map +1 -1
  250. package/dist/document/timeline-patch.js.map +1 -1
  251. package/dist/document/timeline.js.map +1 -1
  252. package/dist/document/types.js.map +1 -1
  253. package/dist/document/validate.js.map +1 -1
  254. package/dist/document/vocabulary.js.map +1 -1
  255. package/dist/experimental.d.ts.map +1 -1
  256. package/dist/experimental.js.map +1 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/layout/bounds.js.map +1 -1
  259. package/dist/layout/constraints.js.map +1 -1
  260. package/dist/layout/flex.js.map +1 -1
  261. package/dist/layout/freeform.js.map +1 -1
  262. package/dist/layout/grid.js.map +1 -1
  263. package/dist/layout/index.js.map +1 -1
  264. package/dist/layout/item.js.map +1 -1
  265. package/dist/layout/ops.js.map +1 -1
  266. package/dist/layout/types.js.map +1 -1
  267. package/dist/platform/audio-sink.js.map +1 -1
  268. package/dist/platform/exporter.js.map +1 -1
  269. package/dist/platform/index.js.map +1 -1
  270. package/dist/platform/stepped-clock.js.map +1 -1
  271. package/dist/platform/storage-adapter.js.map +1 -1
  272. package/dist/platform/ticker.js.map +1 -1
  273. package/dist/project/config.js.map +1 -1
  274. package/dist/project/index.js.map +1 -1
  275. package/dist/project/tree.js.map +1 -1
  276. package/dist/props/host.js.map +1 -1
  277. package/dist/props/index.js.map +1 -1
  278. package/dist/props/observer.js.map +1 -1
  279. package/dist/props/slot.js.map +1 -1
  280. package/dist/renamed-scene-names.js.map +1 -1
  281. package/dist/render/canvas-render-context2d.js.map +1 -1
  282. package/dist/render/clip-contains.js.map +1 -1
  283. package/dist/render/clip.js.map +1 -1
  284. package/dist/render/descriptors/ellipse.js.map +1 -1
  285. package/dist/render/descriptors/line.js.map +1 -1
  286. package/dist/render/descriptors/path-builder.js.map +1 -1
  287. package/dist/render/descriptors/path.js.map +1 -1
  288. package/dist/render/descriptors/polygon.js.map +1 -1
  289. package/dist/render/descriptors/polygram.js.map +1 -1
  290. package/dist/render/descriptors/rect.js.map +1 -1
  291. package/dist/render/descriptors/richtext.js.map +1 -1
  292. package/dist/render/descriptors/shape.js.map +1 -1
  293. package/dist/render/descriptors/text.js.map +1 -1
  294. package/dist/render/descriptors/transform.js.map +1 -1
  295. package/dist/render/graphics2d.js.map +1 -1
  296. package/dist/render/index.js.map +1 -1
  297. package/dist/render/measure-context.js.map +1 -1
  298. package/dist/render/null-render-context.js.map +1 -1
  299. package/dist/render/render-context2d.js.map +1 -1
  300. package/dist/render/render-issue.js.map +1 -1
  301. package/dist/render/surface.js.map +1 -1
  302. package/dist/render/text-defaults.js.map +1 -1
  303. package/dist/render/text-layout.js.map +1 -1
  304. package/dist/render3d/bounds3d.js.map +1 -1
  305. package/dist/render3d/builders.js.map +1 -1
  306. package/dist/render3d/camera.js.map +1 -1
  307. package/dist/render3d/fill3d.js.map +1 -1
  308. package/dist/render3d/geometry.js.map +1 -1
  309. package/dist/render3d/graphics3d.js.map +1 -1
  310. package/dist/render3d/index.js.map +1 -1
  311. package/dist/render3d/inert.js.map +1 -1
  312. package/dist/render3d/light.js.map +1 -1
  313. package/dist/render3d/material.js.map +1 -1
  314. package/dist/render3d/matrix4.js.map +1 -1
  315. package/dist/render3d/render-context3d.js.map +1 -1
  316. package/dist/render3d/resources.js.map +1 -1
  317. package/dist/render3d/rounded-box.js.map +1 -1
  318. package/dist/render3d/scene-settings.js.map +1 -1
  319. package/dist/render3d/scene3d.js.map +1 -1
  320. package/dist/render3d/segments.js.map +1 -1
  321. package/dist/render3d/texture.js.map +1 -1
  322. package/dist/render3d/tracking.js.map +1 -1
  323. package/dist/render3d/transform.js.map +1 -1
  324. package/dist/render3d/vector3.js.map +1 -1
  325. package/dist/render3d/walk.js.map +1 -1
  326. package/dist/runtime/asset-refine.js.map +1 -1
  327. package/dist/runtime/asset-timeline.js.map +1 -1
  328. package/dist/runtime/asset-update.js.map +1 -1
  329. package/dist/runtime/audio-index.js.map +1 -1
  330. package/dist/runtime/builtin-context.js.map +1 -1
  331. package/dist/runtime/clip-instance.js.map +1 -1
  332. package/dist/runtime/clip-store.js.map +1 -1
  333. package/dist/runtime/engine.js.map +1 -1
  334. package/dist/runtime/frame-time.js.map +1 -1
  335. package/dist/runtime/index.js.map +1 -1
  336. package/dist/runtime/node-picking.js.map +1 -1
  337. package/dist/runtime/node-picking3d.js.map +1 -1
  338. package/dist/runtime/placement.js.map +1 -1
  339. package/dist/runtime/playback-controller.js.map +1 -1
  340. package/dist/runtime/playback.js.map +1 -1
  341. package/dist/runtime/precompisition.js.map +1 -1
  342. package/dist/runtime/project-assets.js.map +1 -1
  343. package/dist/runtime/session.js.map +1 -1
  344. package/dist/runtime/settle.js.map +1 -1
  345. package/dist/runtime/state-evaluator.js.map +1 -1
  346. package/dist/runtime/text-geometry.js.map +1 -1
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/tween/command-decorator.js.map +1 -1
  349. package/dist/tween/command.js.map +1 -1
  350. package/dist/tween/ease/constants.js.map +1 -1
  351. package/dist/tween/ease/curve.js.map +1 -1
  352. package/dist/tween/ease/describe.js.map +1 -1
  353. package/dist/tween/ease/spec.js.map +1 -1
  354. package/dist/tween/ease/type.js.map +1 -1
  355. package/dist/tween/index.js.map +1 -1
  356. package/dist/tween/inert.js.map +1 -1
  357. package/dist/tween/lerp.js.map +1 -1
  358. package/dist/tween/loop.js.map +1 -1
  359. package/dist/tween/prepare.js.map +1 -1
  360. package/dist/tween/stepper.js.map +1 -1
  361. package/dist/tween/to-command.js.map +1 -1
  362. package/dist/util/clamp.js.map +1 -1
  363. package/dist/util/context.js.map +1 -1
  364. package/dist/util/csv.js.map +1 -1
  365. package/dist/util/generateList.js.map +1 -1
  366. package/dist/util/index.js.map +1 -1
  367. package/dist/util/metrics.js.map +1 -1
  368. package/dist/util/random.js.map +1 -1
  369. package/dist/util/reference.js.map +1 -1
  370. package/dist/util/scheduler.js.map +1 -1
  371. package/package.json +1 -1
  372. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  373. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  374. package/dist/attributes/audio/filters/chain.js +0 -104
  375. package/dist/attributes/audio/filters/chain.js.map +0 -1
  376. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  377. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  378. package/dist/attributes/audio/filters/curve.js +0 -250
  379. package/dist/attributes/audio/filters/curve.js.map +0 -1
  380. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  381. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  382. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  383. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  384. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  385. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  386. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  387. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  388. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  389. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  390. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  391. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  392. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  393. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  394. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  395. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  396. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  397. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  398. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  399. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  400. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  401. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  402. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  403. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  404. package/dist/attributes/audio/filters/index.d.ts +0 -22
  405. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  406. package/dist/attributes/audio/filters/index.js +0 -8
  407. package/dist/attributes/audio/filters/index.js.map +0 -1
  408. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  409. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  410. package/dist/attributes/audio/filters/registry.js +0 -82
  411. package/dist/attributes/audio/filters/registry.js.map +0 -1
  412. package/dist/attributes/audio/filters/union.d.ts +0 -18
  413. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  414. package/dist/attributes/audio/filters/union.js +0 -28
  415. package/dist/attributes/audio/filters/union.js.map +0 -1
  416. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  417. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  418. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  419. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  420. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  421. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  422. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  423. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  424. package/dist/component/api.d.ts +0 -508
  425. package/dist/component/api.d.ts.map +0 -1
  426. package/dist/component/api.js +0 -4
  427. package/dist/component/api.js.map +0 -1
  428. package/dist/component/builtins/audio.d.ts +0 -26
  429. package/dist/component/builtins/audio.d.ts.map +0 -1
  430. package/dist/component/builtins/audio.js +0 -41
  431. package/dist/component/builtins/audio.js.map +0 -1
  432. package/dist/component/builtins/canvas3d.d.ts +0 -98
  433. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  434. package/dist/component/builtins/canvas3d.js +0 -21
  435. package/dist/component/builtins/canvas3d.js.map +0 -1
  436. package/dist/component/builtins/composite.d.ts +0 -56
  437. package/dist/component/builtins/composite.d.ts.map +0 -1
  438. package/dist/component/builtins/composite.js +0 -25
  439. package/dist/component/builtins/composite.js.map +0 -1
  440. package/dist/component/builtins/geometry.d.ts +0 -505
  441. package/dist/component/builtins/geometry.d.ts.map +0 -1
  442. package/dist/component/builtins/geometry.js +0 -107
  443. package/dist/component/builtins/geometry.js.map +0 -1
  444. package/dist/component/builtins/layout.d.ts +0 -88
  445. package/dist/component/builtins/layout.d.ts.map +0 -1
  446. package/dist/component/builtins/layout.js +0 -84
  447. package/dist/component/builtins/layout.js.map +0 -1
  448. package/dist/component/builtins/media.d.ts +0 -95
  449. package/dist/component/builtins/media.d.ts.map +0 -1
  450. package/dist/component/builtins/media.js +0 -149
  451. package/dist/component/builtins/media.js.map +0 -1
  452. package/dist/component/builtins/providers.d.ts +0 -23
  453. package/dist/component/builtins/providers.d.ts.map +0 -1
  454. package/dist/component/builtins/providers.js +0 -30
  455. package/dist/component/builtins/providers.js.map +0 -1
  456. package/dist/component/builtins/text.d.ts +0 -193
  457. package/dist/component/builtins/text.d.ts.map +0 -1
  458. package/dist/component/builtins/text.js +0 -113
  459. package/dist/component/builtins/text.js.map +0 -1
  460. package/dist/component/builtins/three.d.ts +0 -1085
  461. package/dist/component/builtins/three.d.ts.map +0 -1
  462. package/dist/component/builtins/three.js +0 -265
  463. package/dist/component/builtins/three.js.map +0 -1
  464. package/dist/component/clip-of.d.ts +0 -5
  465. package/dist/component/clip-of.d.ts.map +0 -1
  466. package/dist/component/clip-of.js +0 -33
  467. package/dist/component/clip-of.js.map +0 -1
  468. package/dist/component/commands-for.d.ts +0 -19
  469. package/dist/component/commands-for.d.ts.map +0 -1
  470. package/dist/component/commands-for.js +0 -5
  471. package/dist/component/commands-for.js.map +0 -1
  472. package/dist/component/component-audio.d.ts +0 -9
  473. package/dist/component/component-audio.d.ts.map +0 -1
  474. package/dist/component/component-audio.js +0 -18
  475. package/dist/component/component-audio.js.map +0 -1
  476. package/dist/component/component2d.d.ts +0 -9
  477. package/dist/component/component2d.d.ts.map +0 -1
  478. package/dist/component/component2d.js +0 -239
  479. package/dist/component/component2d.js.map +0 -1
  480. package/dist/component/component3d.d.ts +0 -9
  481. package/dist/component/component3d.d.ts.map +0 -1
  482. package/dist/component/component3d.js +0 -99
  483. package/dist/component/component3d.js.map +0 -1
  484. package/dist/component/factory.d.ts +0 -63
  485. package/dist/component/factory.d.ts.map +0 -1
  486. package/dist/component/factory.js +0 -313
  487. package/dist/component/factory.js.map +0 -1
  488. package/dist/component/modules/aim.d.ts +0 -30
  489. package/dist/component/modules/aim.d.ts.map +0 -1
  490. package/dist/component/modules/aim.js +0 -39
  491. package/dist/component/modules/aim.js.map +0 -1
  492. package/dist/component/modules/corners.d.ts +0 -13
  493. package/dist/component/modules/corners.d.ts.map +0 -1
  494. package/dist/component/modules/corners.js +0 -12
  495. package/dist/component/modules/corners.js.map +0 -1
  496. package/dist/component/modules/flow.d.ts +0 -26
  497. package/dist/component/modules/flow.d.ts.map +0 -1
  498. package/dist/component/modules/flow.js +0 -55
  499. package/dist/component/modules/flow.js.map +0 -1
  500. package/dist/component/modules/material.d.ts +0 -40
  501. package/dist/component/modules/material.d.ts.map +0 -1
  502. package/dist/component/modules/material.js +0 -75
  503. package/dist/component/modules/material.js.map +0 -1
  504. package/dist/component/modules/paint.d.ts +0 -71
  505. package/dist/component/modules/paint.d.ts.map +0 -1
  506. package/dist/component/modules/paint.js +0 -106
  507. package/dist/component/modules/paint.js.map +0 -1
  508. package/dist/component/modules/shapes.d.ts +0 -31
  509. package/dist/component/modules/shapes.d.ts.map +0 -1
  510. package/dist/component/modules/shapes.js +0 -43
  511. package/dist/component/modules/shapes.js.map +0 -1
  512. package/dist/component/modules/text-layout.d.ts +0 -26
  513. package/dist/component/modules/text-layout.d.ts.map +0 -1
  514. package/dist/component/modules/text-layout.js +0 -57
  515. package/dist/component/modules/text-layout.js.map +0 -1
  516. package/dist/component/modules/text-style.d.ts +0 -48
  517. package/dist/component/modules/text-style.d.ts.map +0 -1
  518. package/dist/component/modules/text-style.js +0 -63
  519. package/dist/component/modules/text-style.js.map +0 -1
  520. package/dist/component/modules/three-entries.d.ts +0 -23
  521. package/dist/component/modules/three-entries.d.ts.map +0 -1
  522. package/dist/component/modules/three-entries.js +0 -41
  523. package/dist/component/modules/three-entries.js.map +0 -1
  524. package/dist/component/modules/view3d.d.ts +0 -55
  525. package/dist/component/modules/view3d.d.ts.map +0 -1
  526. package/dist/component/modules/view3d.js +0 -160
  527. package/dist/component/modules/view3d.js.map +0 -1
  528. package/dist/component/timeline.d.ts +0 -22
  529. package/dist/component/timeline.d.ts.map +0 -1
  530. package/dist/component/timeline.js +0 -128
  531. package/dist/component/timeline.js.map +0 -1
  532. package/dist/component/type-def.d.ts +0 -26
  533. package/dist/component/type-def.d.ts.map +0 -1
  534. package/dist/component/type-def.js +0 -16
  535. package/dist/component/type-def.js.map +0 -1
  536. package/dist/component/types.d.ts +0 -91
  537. package/dist/component/types.d.ts.map +0 -1
  538. package/dist/component/types.js +0 -88
  539. package/dist/component/types.js.map +0 -1
  540. package/dist/component/views.d.ts +0 -121
  541. package/dist/component/views.d.ts.map +0 -1
  542. package/dist/component/views.js +0 -413
  543. package/dist/component/views.js.map +0 -1
  544. package/dist/document/withdraw.d.ts +0 -28
  545. package/dist/document/withdraw.d.ts.map +0 -1
  546. package/dist/document/withdraw.js +0 -61
  547. package/dist/document/withdraw.js.map +0 -1
  548. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  549. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  550. package/dist/jsx/jsx-dev-runtime.js +0 -3
  551. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  552. package/dist/jsx/jsx-runtime.d.ts +0 -27
  553. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  554. package/dist/jsx/jsx-runtime.js +0 -26
  555. package/dist/jsx/jsx-runtime.js.map +0 -1
  556. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  557. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  558. package/dist/nodes/2d/node-lifecycle.js +0 -264
  559. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  560. package/dist/nodes/2d/node-motion.d.ts +0 -56
  561. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  562. package/dist/nodes/2d/node-motion.js +0 -86
  563. package/dist/nodes/2d/node-motion.js.map +0 -1
  564. package/dist/nodes/2d/node-render.d.ts +0 -44
  565. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  566. package/dist/nodes/2d/node-render.js +0 -80
  567. package/dist/nodes/2d/node-render.js.map +0 -1
  568. package/dist/nodes/2d/node-space.d.ts +0 -63
  569. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  570. package/dist/nodes/2d/node-space.js +0 -131
  571. package/dist/nodes/2d/node-space.js.map +0 -1
  572. package/dist/nodes/2d/node-transform.d.ts +0 -55
  573. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  574. package/dist/nodes/2d/node-transform.js +0 -73
  575. package/dist/nodes/2d/node-transform.js.map +0 -1
  576. package/dist/nodes/2d/node2d.d.ts +0 -1111
  577. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  578. package/dist/nodes/2d/node2d.js +0 -1665
  579. package/dist/nodes/2d/node2d.js.map +0 -1
  580. package/dist/nodes/2d/paint-node.d.ts +0 -142
  581. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  582. package/dist/nodes/2d/paint-node.js +0 -232
  583. package/dist/nodes/2d/paint-node.js.map +0 -1
  584. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  585. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  586. package/dist/nodes/audio/audio-bus.js +0 -33
  587. package/dist/nodes/audio/audio-bus.js.map +0 -1
  588. package/dist/nodes/audio/index.d.ts +0 -4
  589. package/dist/nodes/audio/index.d.ts.map +0 -1
  590. package/dist/nodes/audio/index.js +0 -2
  591. package/dist/nodes/audio/index.js.map +0 -1
  592. package/dist/nodes/audio/node-audio.d.ts +0 -107
  593. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  594. package/dist/nodes/audio/node-audio.js +0 -179
  595. package/dist/nodes/audio/node-audio.js.map +0 -1
  596. package/dist/nodes/audio/sound-node.d.ts +0 -41
  597. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  598. package/dist/nodes/audio/sound-node.js +0 -71
  599. package/dist/nodes/audio/sound-node.js.map +0 -1
  600. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  601. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  602. package/dist/nodes/geometry/boolean-node.js +0 -81
  603. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  604. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  605. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  606. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  607. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  608. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  609. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  610. package/dist/nodes/geometry/box-path-node.js +0 -116
  611. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  612. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  613. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  614. package/dist/nodes/geometry/ellipse-node.js +0 -45
  615. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  616. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  617. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  618. package/dist/nodes/geometry/group-bounds.js +0 -87
  619. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  620. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  621. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  622. package/dist/nodes/geometry/mask-node.js +0 -66
  623. package/dist/nodes/geometry/mask-node.js.map +0 -1
  624. package/dist/nodes/geometry/path-node.d.ts +0 -26
  625. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  626. package/dist/nodes/geometry/path-node.js +0 -58
  627. package/dist/nodes/geometry/path-node.js.map +0 -1
  628. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  629. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  630. package/dist/nodes/geometry/polygon-node.js +0 -47
  631. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  632. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  633. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  634. package/dist/nodes/geometry/polygram-node.js +0 -52
  635. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  636. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  637. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  638. package/dist/nodes/geometry/rect-node.js +0 -56
  639. package/dist/nodes/geometry/rect-node.js.map +0 -1
  640. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  641. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  642. package/dist/nodes/geometry/shape-node.js +0 -140
  643. package/dist/nodes/geometry/shape-node.js.map +0 -1
  644. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  645. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  646. package/dist/nodes/geometry/shape-outline.js +0 -470
  647. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  648. package/dist/nodes/index.d.ts +0 -53
  649. package/dist/nodes/index.d.ts.map +0 -1
  650. package/dist/nodes/index.js +0 -35
  651. package/dist/nodes/index.js.map +0 -1
  652. package/dist/nodes/layout/camera-node.d.ts +0 -80
  653. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  654. package/dist/nodes/layout/camera-node.js +0 -153
  655. package/dist/nodes/layout/camera-node.js.map +0 -1
  656. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  657. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  658. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  659. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  660. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  661. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  662. package/dist/nodes/layout/rotated-box.js +0 -76
  663. package/dist/nodes/layout/rotated-box.js.map +0 -1
  664. package/dist/nodes/media/video-node.d.ts +0 -229
  665. package/dist/nodes/media/video-node.d.ts.map +0 -1
  666. package/dist/nodes/media/video-node.js +0 -350
  667. package/dist/nodes/media/video-node.js.map +0 -1
  668. package/dist/nodes/node/declare-paints.d.ts +0 -19
  669. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  670. package/dist/nodes/node/declare-paints.js +0 -27
  671. package/dist/nodes/node/declare-paints.js.map +0 -1
  672. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  673. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  674. package/dist/nodes/node/node-editor-state.js +0 -23
  675. package/dist/nodes/node/node-editor-state.js.map +0 -1
  676. package/dist/nodes/node/node-reactive.d.ts +0 -89
  677. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  678. package/dist/nodes/node/node-reactive.js +0 -135
  679. package/dist/nodes/node/node-reactive.js.map +0 -1
  680. package/dist/nodes/node/node-time.d.ts +0 -39
  681. package/dist/nodes/node/node-time.d.ts.map +0 -1
  682. package/dist/nodes/node/node-time.js +0 -14
  683. package/dist/nodes/node/node-time.js.map +0 -1
  684. package/dist/nodes/node/node-walk.d.ts +0 -46
  685. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  686. package/dist/nodes/node/node-walk.js +0 -74
  687. package/dist/nodes/node/node-walk.js.map +0 -1
  688. package/dist/nodes/node/node.d.ts +0 -445
  689. package/dist/nodes/node/node.d.ts.map +0 -1
  690. package/dist/nodes/node/node.js +0 -745
  691. package/dist/nodes/node/node.js.map +0 -1
  692. package/dist/nodes/node/text-defaults.d.ts +0 -32
  693. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  694. package/dist/nodes/node/text-defaults.js +0 -37
  695. package/dist/nodes/node/text-defaults.js.map +0 -1
  696. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  697. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  698. package/dist/nodes/root/canvas2d-node.js +0 -264
  699. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  700. package/dist/nodes/root/provider-node.d.ts +0 -47
  701. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  702. package/dist/nodes/root/provider-node.js +0 -63
  703. package/dist/nodes/root/provider-node.js.map +0 -1
  704. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  705. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  706. package/dist/nodes/root/theme-provider-node.js +0 -43
  707. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  708. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  709. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  710. package/dist/nodes/text/default-text-style-node.js +0 -146
  711. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  712. package/dist/nodes/text/number-format.d.ts +0 -66
  713. package/dist/nodes/text/number-format.d.ts.map +0 -1
  714. package/dist/nodes/text/number-format.js +0 -227
  715. package/dist/nodes/text/number-format.js.map +0 -1
  716. package/dist/nodes/text/number-node.d.ts +0 -94
  717. package/dist/nodes/text/number-node.d.ts.map +0 -1
  718. package/dist/nodes/text/number-node.js +0 -86
  719. package/dist/nodes/text/number-node.js.map +0 -1
  720. package/dist/nodes/text/number-pattern.d.ts +0 -51
  721. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  722. package/dist/nodes/text/number-pattern.js +0 -77
  723. package/dist/nodes/text/number-pattern.js.map +0 -1
  724. package/dist/nodes/text/richtext-node.d.ts +0 -68
  725. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  726. package/dist/nodes/text/richtext-node.js +0 -78
  727. package/dist/nodes/text/richtext-node.js.map +0 -1
  728. package/dist/nodes/text/text-base.d.ts +0 -118
  729. package/dist/nodes/text/text-base.d.ts.map +0 -1
  730. package/dist/nodes/text/text-base.js +0 -153
  731. package/dist/nodes/text/text-base.js.map +0 -1
  732. package/dist/nodes/text/text-layout.d.ts +0 -87
  733. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  734. package/dist/nodes/text/text-layout.js +0 -368
  735. package/dist/nodes/text/text-layout.js.map +0 -1
  736. package/dist/nodes/text/text-node.d.ts +0 -84
  737. package/dist/nodes/text/text-node.d.ts.map +0 -1
  738. package/dist/nodes/text/text-node.js +0 -188
  739. package/dist/nodes/text/text-node.js.map +0 -1
  740. package/dist/nodes/text/text-selection.d.ts +0 -125
  741. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  742. package/dist/nodes/text/text-selection.js +0 -209
  743. package/dist/nodes/text/text-selection.js.map +0 -1
  744. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  745. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  746. package/dist/nodes/three/camera-nodes.js +0 -112
  747. package/dist/nodes/three/camera-nodes.js.map +0 -1
  748. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  749. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  750. package/dist/nodes/three/canvas3d-node.js +0 -486
  751. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  752. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  753. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  754. package/dist/nodes/three/drawable-nodes.js +0 -284
  755. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  756. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  757. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  758. package/dist/nodes/three/environment-nodes.js +0 -134
  759. package/dist/nodes/three/environment-nodes.js.map +0 -1
  760. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  761. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  762. package/dist/nodes/three/geometry-nodes.js +0 -322
  763. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  764. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  765. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  766. package/dist/nodes/three/grid-geometry3d.js +0 -114
  767. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  768. package/dist/nodes/three/group3d.d.ts +0 -23
  769. package/dist/nodes/three/group3d.d.ts.map +0 -1
  770. package/dist/nodes/three/group3d.js +0 -21
  771. package/dist/nodes/three/group3d.js.map +0 -1
  772. package/dist/nodes/three/light-nodes.d.ts +0 -120
  773. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  774. package/dist/nodes/three/light-nodes.js +0 -173
  775. package/dist/nodes/three/light-nodes.js.map +0 -1
  776. package/dist/nodes/three/mesh3d.d.ts +0 -117
  777. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  778. package/dist/nodes/three/mesh3d.js +0 -147
  779. package/dist/nodes/three/mesh3d.js.map +0 -1
  780. package/dist/nodes/three/node3d.d.ts +0 -230
  781. package/dist/nodes/three/node3d.d.ts.map +0 -1
  782. package/dist/nodes/three/node3d.js +0 -337
  783. package/dist/nodes/three/node3d.js.map +0 -1
  784. package/dist/render/descriptors/latex.d.ts +0 -6
  785. package/dist/render/descriptors/latex.d.ts.map +0 -1
  786. package/dist/render/descriptors/latex.js +0 -2
  787. package/dist/render/descriptors/latex.js.map +0 -1
  788. package/dist/tween/seekable.d.ts +0 -81
  789. package/dist/tween/seekable.d.ts.map +0 -1
  790. package/dist/tween/seekable.js +0 -137
  791. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,SAAS,OAAO,CAAC,OAAoB;IACjC,6EAA6E;IAC7E,8DAA8D;IAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAoB;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,UAAU,GAAa,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,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, the sampler, dashing\r\n * and trimming.\r\n *\r\n * Separate from the normal form because it is the expensive half of path\r\n * geometry and most callers never need it — bounding a path solves extrema in\r\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\r\n * flattening happens here, on demand.\r\n *\r\n * **One resolution.** There used to be three — 20 steps for\r\n * `length`, 32 for the trim segments, 50 for the sampler and the\r\n * dash walker — and `dash` combined two of them, scaling its dash\r\n * cycle against a length measured at 20 while walking the path at 50. Sharing\r\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\r\n * coincidence.\r\n */\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { distance } from \"./bezier\";\r\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\r\nimport type {\r\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\r\n} from \"./types\";\r\n\r\n/** Line segments each curve is flattened into. */\r\nexport const SAMPLE_STEPS = 50;\r\n\r\nfunction flatten(segment: PathSegment): Vector2[] {\r\n // A line is already a polyline. Skipping the loop matters: a polygon path is\r\n // all lines, and 50 collinear samples per edge is pure waste.\r\n if (segment.kind === \"line\") return [segment.from, segment.to];\r\n const points: Vector2[] = [segment.from];\r\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\r\n points.push(segment.to);\r\n return points;\r\n}\r\n\r\nexport function measureSegment(segment: PathSegment): SegmentMetric {\r\n const points = flatten(segment);\r\n const cumulative: number[] = [0];\r\n let total = 0;\r\n for (let i = 1; i < points.length; i++) {\r\n total += distance(points[i - 1], points[i]);\r\n cumulative.push(total);\r\n }\r\n return { segment, points, cumulative, length: total };\r\n}\r\n\r\nexport function measureContours(contours: PathContour[]): PathMetric {\r\n let total = 0;\r\n const measured = contours.map((contour) => {\r\n const metrics = contourSegments(contour).map(measureSegment);\r\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\r\n total += length;\r\n return { contour, metrics, length };\r\n });\r\n return { contours: measured, length: total };\r\n}\r\n\r\n/**\r\n * The parameter `t` at arc-length distance `d` into a segment.\r\n *\r\n * Read off the flattened table rather than binary-searched: the table is already\r\n * built, and a search that re-samples the curve on every probe cost 320 point\r\n * evaluations per query to answer the same question less consistently — its\r\n * answer disagreed with the sampler's, which read the same curve off a polyline.\r\n */\r\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\r\n const { cumulative, length } = metric;\r\n if (length <= 0) return 0;\r\n if (d <= 0) return 0;\r\n if (d >= length) return 1;\r\n\r\n let lo = 0;\r\n let hi = cumulative.length - 1;\r\n while (lo < hi - 1) {\r\n const mid = (lo + hi) >> 1;\r\n if (cumulative[mid] <= d) lo = mid;\r\n else hi = mid;\r\n }\r\n const span = cumulative[hi] - cumulative[lo];\r\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\r\n const steps = cumulative.length - 1;\r\n return (lo + within) / steps;\r\n}\r\n\r\nexport function length(d: PathData | null | undefined): number {\r\n return measureContours(contours(d)).length;\r\n}\r\n\r\n/**\r\n * Build a {@link PathSampler} from any {@link PathData}.\r\n *\r\n * The tangent is the chord of the flattened segment the distance lands in, not\r\n * the curve's analytic derivative. Less exact, and deliberately kept: every\r\n * glyph on every text-on-path is placed with it, so changing it is a visual\r\n * change that deserves its own commit rather than a side effect of this one.\r\n */\r\nexport function sampler(d: PathData): PathSampler {\r\n const metric = measureContours(contours(d));\r\n\r\n // One point list across every contour. The jump from one contour's end to the\r\n // next one's start carries no length — text does not flow across it, matching\r\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\r\n // in the table.\r\n const points: Vector2[] = [];\r\n const cumulative: number[] = [];\r\n let total = 0;\r\n for (const contourMetric of metric.contours) {\r\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\r\n points.push(first);\r\n cumulative.push(total);\r\n for (const segmentMetric of contourMetric.metrics) {\r\n for (let i = 1; i < segmentMetric.points.length; i++) {\r\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\r\n points.push(segmentMetric.points[i]);\r\n cumulative.push(total);\r\n }\r\n }\r\n }\r\n\r\n let cursor = 0; // last segment index used, for the monotonic fast path.\r\n\r\n const frameAt = (d: number): PathFrame | null => {\r\n if (total <= 0 || points.length < 2) return null;\r\n const target = Math.max(0, Math.min(total, d));\r\n\r\n // Reset the cursor if the caller stepped backwards.\r\n if (cumulative[cursor] > target) cursor = 0;\r\n // Advance to the step containing `target`, skipping the zero-length steps\r\n // that bridge contours so we land on real geometry.\r\n while (\r\n cursor < points.length - 2 &&\r\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\r\n ) {\r\n cursor++;\r\n }\r\n\r\n const a = points[cursor];\r\n const b = points[cursor + 1];\r\n const segStart = cumulative[cursor];\r\n const segLen = cumulative[cursor + 1] - segStart;\r\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\r\n\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const segDist = Math.hypot(dx, dy);\r\n // Degenerate step: fall back to the point with no meaningful tangent.\r\n const tx = segDist > 0 ? dx / segDist : 1;\r\n const ty = segDist > 0 ? dy / segDist : 0;\r\n\r\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\r\n };\r\n\r\n return { length: total, frameAt };\r\n}\r\n\r\n/** A contour's flattened polyline. */\r\nfunction contourPoints(metric: ContourMetric): Vector2[] {\r\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\r\n const points: Vector2[] = [first];\r\n for (const segment of metric.metrics) {\r\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\r\n }\r\n return points;\r\n}\r\n\r\n/**\r\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\r\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\r\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\r\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\r\n * a run a sliver long along the path, so the cap drawn on it has a direction —\r\n * including the dots an open subpath is fit to start and end on.\r\n */\r\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\r\n if (points.length < 2) return '';\r\n\r\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\r\n const sliver = cycle * 1e-4;\r\n const tolerance = cycle * 1e-9;\r\n const into = ((offset % cycle) + cycle) % cycle;\r\n let dashIndex = 0;\r\n let passed = 0;\r\n while (passed + scaledDash[dashIndex] <= into) {\r\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\r\n passed += scaledDash[dashIndex];\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n if (dashIndex === 0) break;\r\n }\r\n\r\n const parts: string[] = [];\r\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\r\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\r\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\r\n let last: { point: Vector2; x: number; y: number } | null = null;\r\n\r\n for (let i = 1; i < points.length; i++) {\r\n const p0 = points[i - 1];\r\n const p1 = points[i];\r\n const dx = p1.x - p0.x;\r\n const dy = p1.y - p0.y;\r\n const segLen = distance(p0, p1);\r\n\r\n if (segLen === 0) continue;\r\n last = { point: p1, x: dx / segLen, y: dy / segLen };\r\n\r\n let walked = 0;\r\n\r\n while (walked < segLen) {\r\n const available = segLen - walked;\r\n\r\n if (remaining >= available) {\r\n if (isOn) {\r\n if (needMove) {\r\n const t = walked / segLen;\r\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\r\n needMove = false;\r\n }\r\n parts.push(`L ${p1.x} ${p1.y}`);\r\n }\r\n remaining -= available;\r\n walked = segLen;\r\n\r\n if (remaining <= tolerance) {\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n } else {\r\n const endT = (walked + remaining) / segLen;\r\n const endX = p0.x + endT * dx;\r\n const endY = p0.y + endT * dy;\r\n\r\n if (isOn) {\r\n if (needMove) {\r\n const startT = walked / segLen;\r\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\r\n needMove = false;\r\n }\r\n const reach = remaining > 0 ? 0 : sliver / segLen;\r\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\r\n }\r\n\r\n walked += remaining;\r\n dashIndex = (dashIndex + 1) % scaledDash.length;\r\n isOn = !isOn;\r\n remaining = scaledDash[dashIndex];\r\n if (isOn) needMove = true;\r\n }\r\n }\r\n }\r\n\r\n if (!closed && isOn && remaining <= tolerance && last) {\r\n const { point, x, y } = last;\r\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\r\n }\r\n\r\n return parts.join(' ');\r\n}\r\n\r\n/**\r\n * How far `pattern` is stretched to fit one contour of a path `total` long —\r\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\r\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\r\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\r\n * pattern alternates across cycles, has no final gap to drop, and fits as\r\n * closed. `null` when there is nothing to fit.\r\n */\r\nexport function dashScale(\r\n pattern: number[],\r\n contour: { length: number; closed: boolean },\r\n total: number,\r\n): number | null {\r\n const cycle = pattern.reduce((a, b) => a + b, 0);\r\n if (cycle <= 0 || total <= 0) return null;\r\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\r\n const lastGap = pattern[pattern.length - 1];\r\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\r\n if (span > 0) return contour.length / span;\r\n }\r\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\r\n}\r\n\r\n/**\r\n * Converts path geometry into a dashed SVG path string, each contour fit by\r\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\r\n * dashes a stroke.\r\n *\r\n * @param d The path to dash.\r\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\r\n * @returns An SVG path `d` string containing only the visible dash segments,\r\n * or `''` when there is nothing to draw.\r\n */\r\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\r\n if (!dash || dash.length === 0) return '';\r\n\r\n const metric = measureContours(contours(d));\r\n const runs: string[] = [];\r\n for (const contour of metric.contours) {\r\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\r\n if (scale === null) return '';\r\n const run = dashSubpath(\r\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\r\n );\r\n if (run) runs.push(run);\r\n }\r\n return runs.join(' ');\r\n}\r\n\r\n/**\r\n * The portion of `d` between the normalized arc-length fractions `start` and\r\n * `end` (both 0..1), as a fresh command list.\r\n *\r\n * A full `0..1` range or an empty path is returned unchanged; an empty or\r\n * inverted range returns `[]`.\r\n */\r\nexport function trim(d: PathData, start: number, end: number): PathData {\r\n if (start === 0 && end === 1) return d;\r\n\r\n const s = Math.max(0, Math.min(1, start));\r\n const e = Math.max(s, Math.min(1, end));\r\n if (s === 0 && e === 1) return d;\r\n if (s >= e) return [];\r\n\r\n const metric = measureContours(contours(d));\r\n if (metric.length === 0) return d;\r\n\r\n const startDist = s * metric.length;\r\n const endDist = e * metric.length;\r\n\r\n const result: PathCommand[] = [];\r\n let accumulated = 0;\r\n\r\n for (const contour of metric.contours) {\r\n // Each contour opens its own `M`. Sharing one across all of them — which\r\n // is what a single flat segment list did — draws a line across the gap\r\n // between two contours that the source never had.\r\n let needsMove = true;\r\n\r\n for (const metricEntry of contour.metrics) {\r\n const { segment, length } = metricEntry;\r\n const segEnd = accumulated + length;\r\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\r\n accumulated = segEnd;\r\n continue;\r\n }\r\n\r\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\r\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\r\n\r\n if (needsMove) {\r\n const p = segmentPointAt(segment, t0);\r\n result.push({ type: \"M\", x: p.x, y: p.y });\r\n needsMove = false;\r\n }\r\n result.push(...segmentSplit(segment, t0, t1));\r\n accumulated = segEnd;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/measure.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKjF,kDAAkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,SAAS,OAAO,CAAC,OAAoB;IACjC,6EAA6E;IAC7E,8DAA8D;IAC9D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAC9F,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAoB;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,UAAU,GAAa,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,KAAK,IA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Q,EAAE,CAAC;QACpC,yEAAyE;QACzE,uEAAuE;QACvE,kDAAkD;QAClD,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,KAAK,MAAM,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACxC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;YACxC,MAAM,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;YACpC,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,IAAI,SAAS,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;gBAChE,WAAW,GAAG,MAAM,CAAC;gBACrB,SAAS;YACb,CAAC;YAED,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3F,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAElF,IAAI,SAAS,EAAE,CAAC;gBACZ,MAAM,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC3C,SAAS,GAAG,KAAK,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9C,WAAW,GAAG,MAAM,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Arc length, and everything measured in it: total length, the sampler, dashing\n * and trimming.\n *\n * Separate from the normal form because it is the expensive half of path\n * geometry and most callers never need it — bounding a path solves extrema in\n * closed form, and `Path.measure` / `Text.measure` run on every layout pass. So\n * flattening happens here, on demand.\n *\n * **One resolution.** There used to be three — 20 steps for\n * `length`, 32 for the trim segments, 50 for the sampler and the\n * dash walker — and `dash` combined two of them, scaling its dash\n * cycle against a length measured at 20 while walking the path at 50. Sharing\n * one number makes `length(d) === sampler(d).length` an invariant rather than a\n * coincidence.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance } from \"./bezier\";\nimport { contourSegments, contours, segmentPointAt, segmentSplit } from \"./walk\";\nimport type {\n ContourMetric, PathContour, PathFrame, PathMetric, PathSampler, PathSegment, SegmentMetric,\n} from \"./types\";\n\n/** Line segments each curve is flattened into. */\nexport const SAMPLE_STEPS = 50;\n\nfunction flatten(segment: PathSegment): Vector2[] {\n // A line is already a polyline. Skipping the loop matters: a polygon path is\n // all lines, and 50 collinear samples per edge is pure waste.\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points: Vector2[] = [segment.from];\n for (let i = 1; i < SAMPLE_STEPS; i++) points.push(segmentPointAt(segment, i / SAMPLE_STEPS));\n points.push(segment.to);\n return points;\n}\n\nexport function measureSegment(segment: PathSegment): SegmentMetric {\n const points = flatten(segment);\n const cumulative: number[] = [0];\n let total = 0;\n for (let i = 1; i < points.length; i++) {\n total += distance(points[i - 1], points[i]);\n cumulative.push(total);\n }\n return { segment, points, cumulative, length: total };\n}\n\nexport function measureContours(contours: PathContour[]): PathMetric {\n let total = 0;\n const measured = contours.map((contour) => {\n const metrics = contourSegments(contour).map(measureSegment);\n const length = metrics.reduce((sum, m) => sum + m.length, 0);\n total += length;\n return { contour, metrics, length };\n });\n return { contours: measured, length: total };\n}\n\n/**\n * The parameter `t` at arc-length distance `d` into a segment.\n *\n * Read off the flattened table rather than binary-searched: the table is already\n * built, and a search that re-samples the curve on every probe cost 320 point\n * evaluations per query to answer the same question less consistently — its\n * answer disagreed with the sampler's, which read the same curve off a polyline.\n */\nexport function paramAtDist(metric: SegmentMetric, d: number): number {\n const { cumulative, length } = metric;\n if (length <= 0) return 0;\n if (d <= 0) return 0;\n if (d >= length) return 1;\n\n let lo = 0;\n let hi = cumulative.length - 1;\n while (lo < hi - 1) {\n const mid = (lo + hi) >> 1;\n if (cumulative[mid] <= d) lo = mid;\n else hi = mid;\n }\n const span = cumulative[hi] - cumulative[lo];\n const within = span > 0 ? (d - cumulative[lo]) / span : 0;\n const steps = cumulative.length - 1;\n return (lo + within) / steps;\n}\n\nexport function length(d: PathData | null | undefined): number {\n return measureContours(contours(d)).length;\n}\n\n/**\n * Build a {@link PathSampler} from any {@link PathData}.\n *\n * The tangent is the chord of the flattened segment the distance lands in, not\n * the curve's analytic derivative. Less exact, and deliberately kept: every\n * glyph on every text-on-path is placed with it, so changing it is a visual\n * change that deserves its own commit rather than a side effect of this one.\n */\nexport function sampler(d: PathData): PathSampler {\n const metric = measureContours(contours(d));\n\n // One point list across every contour. The jump from one contour's end to the\n // next one's start carries no length — text does not flow across it, matching\n // SVG `textPath` — so it is recorded as a zero-length step rather than a gap\n // in the table.\n const points: Vector2[] = [];\n const cumulative: number[] = [];\n let total = 0;\n for (const contourMetric of metric.contours) {\n const first = contourMetric.metrics[0]?.segment.from ?? contourMetric.contour.start;\n points.push(first);\n cumulative.push(total);\n for (const segmentMetric of contourMetric.metrics) {\n for (let i = 1; i < segmentMetric.points.length; i++) {\n total += distance(segmentMetric.points[i - 1], segmentMetric.points[i]);\n points.push(segmentMetric.points[i]);\n cumulative.push(total);\n }\n }\n }\n\n let cursor = 0; // last segment index used, for the monotonic fast path.\n\n const frameAt = (d: number): PathFrame | null => {\n if (total <= 0 || points.length < 2) return null;\n const target = Math.max(0, Math.min(total, d));\n\n // Reset the cursor if the caller stepped backwards.\n if (cumulative[cursor] > target) cursor = 0;\n // Advance to the step containing `target`, skipping the zero-length steps\n // that bridge contours so we land on real geometry.\n while (\n cursor < points.length - 2 &&\n (cumulative[cursor + 1] < target || cumulative[cursor + 1] === cumulative[cursor])\n ) {\n cursor++;\n }\n\n const a = points[cursor];\n const b = points[cursor + 1];\n const segStart = cumulative[cursor];\n const segLen = cumulative[cursor + 1] - segStart;\n const t = segLen > 0 ? (target - segStart) / segLen : 0;\n\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const segDist = Math.hypot(dx, dy);\n // Degenerate step: fall back to the point with no meaningful tangent.\n const tx = segDist > 0 ? dx / segDist : 1;\n const ty = segDist > 0 ? dy / segDist : 0;\n\n return { x: a.x + dx * t, y: a.y + dy * t, tx, ty };\n };\n\n return { length: total, frameAt };\n}\n\n/** A contour's flattened polyline. */\nfunction contourPoints(metric: ContourMetric): Vector2[] {\n const first = metric.metrics[0]?.segment.from ?? metric.contour.start;\n const points: Vector2[] = [first];\n for (const segment of metric.metrics) {\n for (let i = 1; i < segment.points.length; i++) points.push(segment.points[i]);\n }\n return points;\n}\n\n/**\n * Walks a flattened subpath at constant speed, emitting `M`/`L` commands for the\n * \"on\" runs of the dash pattern. `scaledDash` alternates on/off lengths starting\n * with \"on\"; the index wraps so the pattern repeats along the whole subpath, and\n * `offset` is how far into it the subpath starts. A zero-length dash is a dot:\n * a run a sliver long along the path, so the cap drawn on it has a direction —\n * including the dots an open subpath is fit to start and end on.\n */\nfunction dashSubpath(points: Vector2[], scaledDash: number[], offset: number, closed: boolean): string {\n if (points.length < 2) return '';\n\n const cycle = scaledDash.reduce((a, b) => a + b, 0);\n const sliver = cycle * 1e-4;\n const tolerance = cycle * 1e-9;\n const into = ((offset % cycle) + cycle) % cycle;\n let dashIndex = 0;\n let passed = 0;\n while (passed + scaledDash[dashIndex] <= into) {\n if (scaledDash[dashIndex] === 0 && into - passed <= tolerance) break;\n passed += scaledDash[dashIndex];\n dashIndex = (dashIndex + 1) % scaledDash.length;\n if (dashIndex === 0) break;\n }\n\n const parts: string[] = [];\n let remaining = scaledDash[dashIndex] - (into - passed); // Distance left in the current dash segment.\n let isOn = dashIndex % 2 === 0; // Whether we're currently drawing (on) or skipping (off).\n let needMove = true; // Whether the next \"on\" run still needs an opening M.\n let last: { point: Vector2; x: number; y: number } | null = null;\n\n for (let i = 1; i < points.length; i++) {\n const p0 = points[i - 1];\n const p1 = points[i];\n const dx = p1.x - p0.x;\n const dy = p1.y - p0.y;\n const segLen = distance(p0, p1);\n\n if (segLen === 0) continue;\n last = { point: p1, x: dx / segLen, y: dy / segLen };\n\n let walked = 0;\n\n while (walked < segLen) {\n const available = segLen - walked;\n\n if (remaining >= available) {\n if (isOn) {\n if (needMove) {\n const t = walked / segLen;\n parts.push(`M ${p0.x + t * dx} ${p0.y + t * dy}`);\n needMove = false;\n }\n parts.push(`L ${p1.x} ${p1.y}`);\n }\n remaining -= available;\n walked = segLen;\n\n if (remaining <= tolerance) {\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n } else {\n const endT = (walked + remaining) / segLen;\n const endX = p0.x + endT * dx;\n const endY = p0.y + endT * dy;\n\n if (isOn) {\n if (needMove) {\n const startT = walked / segLen;\n parts.push(`M ${p0.x + startT * dx} ${p0.y + startT * dy}`);\n needMove = false;\n }\n const reach = remaining > 0 ? 0 : sliver / segLen;\n parts.push(`L ${endX + reach * dx} ${endY + reach * dy}`);\n }\n\n walked += remaining;\n dashIndex = (dashIndex + 1) % scaledDash.length;\n isOn = !isOn;\n remaining = scaledDash[dashIndex];\n if (isOn) needMove = true;\n }\n }\n }\n\n if (!closed && isOn && remaining <= tolerance && last) {\n const { point, x, y } = last;\n parts.push(`M ${point.x} ${point.y} L ${point.x - x * sliver} ${point.y - y * sliver}`);\n }\n\n return parts.join(' ');\n}\n\n/**\n * How far `pattern` is stretched to fit one contour of a path `total` long —\n * the renderer's rule as well as {@link dash}'s. A closed contour is fit with\n * the rest of the path, to whole cycles of `total`; an open one is fit alone to\n * whole cycles less the final gap, so it starts and ends on a dash. An odd\n * pattern alternates across cycles, has no final gap to drop, and fits as\n * closed. `null` when there is nothing to fit.\n */\nexport function dashScale(\n pattern: number[],\n contour: { length: number; closed: boolean },\n total: number,\n): number | null {\n const cycle = pattern.reduce((a, b) => a + b, 0);\n if (cycle <= 0 || total <= 0) return null;\n if (!contour.closed && contour.length > 0 && pattern.length % 2 === 0) {\n const lastGap = pattern[pattern.length - 1];\n const span = Math.max(1, Math.round((contour.length + lastGap) / cycle)) * cycle - lastGap;\n if (span > 0) return contour.length / span;\n }\n return total / (Math.max(1, Math.round(total / cycle)) * cycle);\n}\n\n/**\n * Converts path geometry into a dashed SVG path string, each contour fit by\n * {@link dashScale} and starting `offset` into the pattern, as the renderer\n * dashes a stroke.\n *\n * @param d The path to dash.\n * @param dash Alternating on/off lengths (e.g. `[4, 2]` = 4 on, 2 off).\n * @returns An SVG path `d` string containing only the visible dash segments,\n * or `''` when there is nothing to draw.\n */\nexport function dash(d: PathData | null | undefined, dash: number[], offset = 0): string {\n if (!dash || dash.length === 0) return '';\n\n const metric = measureContours(contours(d));\n const runs: string[] = [];\n for (const contour of metric.contours) {\n const scale = dashScale(dash, { length: contour.length, closed: contour.contour.closed }, metric.length);\n if (scale === null) return '';\n const run = dashSubpath(\n contourPoints(contour), dash.map(value => value * scale), offset * scale, contour.contour.closed,\n );\n if (run) runs.push(run);\n }\n return runs.join(' ');\n}\n\n/**\n * The portion of `d` between the normalized arc-length fractions `start` and\n * `end` (both 0..1), as a fresh command list.\n *\n * A full `0..1` range or an empty path is returned unchanged; an empty or\n * inverted range returns `[]`.\n */\nexport function trim(d: PathData, start: number, end: number): PathData {\n if (start === 0 && end === 1) return d;\n\n const s = Math.max(0, Math.min(1, start));\n const e = Math.max(s, Math.min(1, end));\n if (s === 0 && e === 1) return d;\n if (s >= e) return [];\n\n const metric = measureContours(contours(d));\n if (metric.length === 0) return d;\n\n const startDist = s * metric.length;\n const endDist = e * metric.length;\n\n const result: PathCommand[] = [];\n let accumulated = 0;\n\n for (const contour of metric.contours) {\n // Each contour opens its own `M`. Sharing one across all of them — which\n // is what a single flat segment list did — draws a line across the gap\n // between two contours that the source never had.\n let needsMove = true;\n\n for (const metricEntry of contour.metrics) {\n const { segment, length } = metricEntry;\n const segEnd = accumulated + length;\n if (length === 0 || segEnd <= startDist || accumulated >= endDist) {\n accumulated = segEnd;\n continue;\n }\n\n const t0 = accumulated < startDist ? paramAtDist(metricEntry, startDist - accumulated) : 0;\n const t1 = segEnd > endDist ? paramAtDist(metricEntry, endDist - accumulated) : 1;\n\n if (needsMove) {\n const p = segmentPointAt(segment, t0);\n result.push({ type: \"M\", x: p.x, y: p.y });\n needsMove = false;\n }\n result.push(...segmentSplit(segment, t0, t1));\n accumulated = segEnd;\n }\n }\n\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,CAA8B;IACjD,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,qEAAqE;QACrE,uEAAuE;QACvE,sEAAsE;QACtE,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,yEAAyE;QACzE,uEAAuE;QACvE,GAAG,CAAC,IAAI,CAAC;YACL,MAAM,EAAE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;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,EAAY,EAAE,CAAS;IACxD,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\r\n * Path morphing — smooth interpolation between two arbitrary path shapes.\r\n *\r\n * Lerping two SVG paths command-by-command only works when they happen to share\r\n * the same command structure; in general one path is a triangle and the other a\r\n * star with a different number of points, different command types, a different\r\n * start point, and the opposite winding. Naively pairing commands produces\r\n * kinks, self-intersections, and points that fly across the canvas.\r\n *\r\n * This module reshapes both paths into a common, directly-interpolatable form —\r\n * the same approach GSAP's MorphSVGPlugin uses:\r\n *\r\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\r\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\r\n * a subpath becomes a uniform chain of cubics described purely by anchor and\r\n * control points.\r\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\r\n * with degenerate, collapsed subpaths so every subpath has a partner),\r\n * equalizes the number of cubics in each pair by subdividing the coarser\r\n * subpath along its perimeter, and — for closed rings — rotates and optionally\r\n * reverses one ring so the two start at the same place and wind the same way.\r\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\r\n * interpolating every control point with {@link lerpVector2}.\r\n *\r\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\r\n * existing renderer draws unchanged.\r\n */\r\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { distance, cubicPoint } from \"./bezier\";\r\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\r\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\r\n\r\n/**\r\n * A path as cubic subpaths — one of the two boundaries where geometry is\r\n * deliberately flattened to a single curve type.\r\n *\r\n * A morph has to pair segments up and interpolate them, which needs both sides\r\n * speaking one language, so an arc becomes cubics here (and only here, and in\r\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\r\n * thing it got wrong that the shared walk does not is `Z`, which it marked\r\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\r\n * where SVG says two.\r\n */\r\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\r\n const out: CubicSubpath[] = [];\r\n for (const contour of contours(d)) {\r\n // A lone `M` has nothing to interpolate: it draws nothing and has no\r\n // first anchor to seed a partner from, so it is not a subpath here. It\r\n // stays in `contours`, where it still occupies a point of the bounds.\r\n const chain = contourSegments(contour).flatMap(segmentCubics);\r\n if (chain.length === 0) continue;\r\n // `contours` is memoized and shared, so hand out copies of its points: a\r\n // caller moving an anchor of the result must not move the cached path.\r\n out.push({\r\n cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),\r\n closed: contour.closed,\r\n });\r\n }\r\n return out;\r\n}\r\n\r\n/** First anchor of a subpath (the implicit `M` target). */\r\nfunction startPoint(cubics: Cubic[]): Vector2 {\r\n return cubics[0].p0;\r\n}\r\n\r\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\r\nfunction cubicLength(c: Cubic, steps = 8): number {\r\n let len = 0;\r\n let prev = c.p0;\r\n for (let i = 1; i <= steps; i++) {\r\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\r\n len += distance(prev, p);\r\n prev = p;\r\n }\r\n return len;\r\n}\r\n\r\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\r\nfunction centroid(cubics: Cubic[]): Vector2 {\r\n let x = 0, y = 0;\r\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\r\n return { x: x / cubics.length, y: y / cubics.length };\r\n}\r\n\r\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\r\n\r\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\r\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\r\n const a = lerpVector2(c.p0, c.c1, t);\r\n const b = lerpVector2(c.c1, c.c2, t);\r\n const d = lerpVector2(c.c2, c.p1, t);\r\n const e = lerpVector2(a, b, t);\r\n const f = lerpVector2(b, d, t);\r\n const g = lerpVector2(e, f, t);\r\n return [\r\n { p0: c.p0, c1: a, c2: e, p1: g },\r\n { p0: g, c1: f, c2: d, p1: c.p1 },\r\n ];\r\n}\r\n\r\n/**\r\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\r\n * Splits are spread across the longest segments first so the added anchor points\r\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\r\n * added point becomes a correspondence point with the other shape.\r\n */\r\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\r\n let work = cubics.slice();\r\n while (work.length < target) {\r\n // Find the longest cubic and split it in half.\r\n let longest = 0;\r\n let maxLen = -1;\r\n for (let i = 0; i < work.length; i++) {\r\n const len = cubicLength(work[i]);\r\n if (len > maxLen) { maxLen = len; longest = i; }\r\n }\r\n const [left, right] = splitCubic(work[longest], 0.5);\r\n work.splice(longest, 1, left, right);\r\n }\r\n return work;\r\n}\r\n\r\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\r\n\r\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\r\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\r\n const out: Cubic[] = [];\r\n for (let i = cubics.length - 1; i >= 0; i--) {\r\n const c = cubics[i];\r\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\r\n }\r\n return out;\r\n}\r\n\r\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\r\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\r\n if (offset === 0) return cubics.slice();\r\n return cubics.slice(offset).concat(cubics.slice(0, offset));\r\n}\r\n\r\n/** Sum of squared distances between paired anchor points — the alignment cost. */\r\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\r\n let cost = 0;\r\n for (let i = 0; i < a.length; i++) {\r\n const dx = a[i].p0.x - b[i].p0.x;\r\n const dy = a[i].p0.y - b[i].p0.y;\r\n cost += dx * dx + dy * dy;\r\n }\r\n return cost;\r\n}\r\n\r\n/**\r\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\r\n * every rotation offset, in both winding directions, and keeps whichever pairs the\r\n * anchor points with the least total travel. This is what lets two shapes whose\r\n * points are listed in any order — or that wind in opposite directions — morph\r\n * without spinning or folding through themselves.\r\n */\r\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\r\n const n = from.length;\r\n let best = to;\r\n let bestCost = Infinity;\r\n\r\n for (const candidate of [to, reverseCubics(to)]) {\r\n for (let offset = 0; offset < n; offset++) {\r\n const rotated = rotateCubics(candidate, offset);\r\n const cost = anchorCost(from, rotated);\r\n if (cost < bestCost) {\r\n bestCost = cost;\r\n best = rotated;\r\n }\r\n }\r\n }\r\n return best;\r\n}\r\n\r\n/**\r\n * For an open subpath, only the winding can be flipped (rotation would change the\r\n * shape). Pick the direction whose endpoints best match the `from` subpath.\r\n */\r\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\r\n const reversed = reverseCubics(to);\r\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\r\n}\r\n\r\n// --- Degenerate subpaths (for count mismatches) -----------------------------\r\n\r\n/**\r\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\r\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\r\n * point, which is how added or removed subpaths animate.\r\n */\r\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\r\n const cubics: Cubic[] = [];\r\n for (let i = 0; i < count; i++) {\r\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\r\n }\r\n return cubics;\r\n}\r\n\r\n// --- Subpath pairing --------------------------------------------------------\r\n\r\n/**\r\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\r\n * so morphing maps each shape onto its closest counterpart rather than by list\r\n * order. Leftover subpaths on either side are paired with a degenerate partner\r\n * collapsed at their own centroid, so they grow/shrink in place.\r\n */\r\nfunction pairSubpaths(\r\n fromSubs: CubicSubpath[],\r\n toSubs: CubicSubpath[],\r\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\r\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\r\n const toUsed = new Array(toSubs.length).fill(false);\r\n\r\n for (const f of fromSubs) {\r\n const fc = centroid(f.cubics);\r\n let bestIdx = -1;\r\n let bestDist = Infinity;\r\n for (let j = 0; j < toSubs.length; j++) {\r\n if (toUsed[j]) continue;\r\n const d = distance(fc, centroid(toSubs[j].cubics));\r\n if (d < bestDist) { bestDist = d; bestIdx = j; }\r\n }\r\n if (bestIdx >= 0) {\r\n toUsed[bestIdx] = true;\r\n pairs.push({ from: f, to: toSubs[bestIdx] });\r\n } else {\r\n // No `to` subpath left → collapse to this subpath's own centroid.\r\n pairs.push({\r\n from: f,\r\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\r\n });\r\n }\r\n }\r\n\r\n // Any unused `to` subpaths grow out of their own centroid.\r\n for (let j = 0; j < toSubs.length; j++) {\r\n if (toUsed[j]) continue;\r\n const t = toSubs[j];\r\n const tc = centroid(t.cubics);\r\n pairs.push({\r\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\r\n to: t,\r\n });\r\n }\r\n\r\n return pairs;\r\n}\r\n\r\n// --- Building the morph plan ------------------------------------------------\r\n\r\n/**\r\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\r\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\r\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\r\n */\r\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\r\n const fromSubs = cubics(from);\r\n const toSubs = cubics(to);\r\n\r\n // Both empty → nothing to morph.\r\n if (fromSubs.length === 0 && toSubs.length === 0) {\r\n return { pairs: [] };\r\n }\r\n\r\n // One side empty → collapse/grow the other against a point at its start.\r\n if (fromSubs.length === 0) {\r\n const seed = startPoint(toSubs[0].cubics);\r\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\r\n }\r\n if (toSubs.length === 0) {\r\n const seed = startPoint(fromSubs[0].cubics);\r\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\r\n }\r\n\r\n const subPairs = pairSubpaths(fromSubs, toSubs);\r\n\r\n const pairs = subPairs.map(({ from: f, to: t }) => {\r\n // Equalize cubic counts by subdividing the coarser side.\r\n const count = Math.max(f.cubics.length, t.cubics.length);\r\n const fromCubics = subdivideTo(f.cubics, count);\r\n let toCubics = subdivideTo(t.cubics, count);\r\n\r\n // Align the `to` side to the `from` side so points correspond and travel\r\n // the shortest path. Closed rings can rotate + reverse; open paths only\r\n // reverse (rotating an open path would tear it).\r\n const bothClosed = f.closed && t.closed;\r\n toCubics = bothClosed\r\n ? alignClosedRing(fromCubics, toCubics)\r\n : alignOpenSubpath(fromCubics, toCubics);\r\n\r\n return { from: fromCubics, to: toCubics, closed: bothClosed };\r\n });\r\n\r\n return { pairs };\r\n}\r\n\r\n// --- Sampling ---------------------------------------------------------------\r\n\r\n/** Interpolate a single cubic's four points. */\r\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\r\n return {\r\n p0: lerpVector2(from.p0, to.p0, t),\r\n c1: lerpVector2(from.c1, to.c1, t),\r\n c2: lerpVector2(from.c2, to.c2, t),\r\n p1: lerpVector2(from.p1, to.p1, t),\r\n };\r\n}\r\n\r\n/**\r\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\r\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\r\n * for closed subpaths.\r\n *\r\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\r\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\r\n * is tell the renderer the contour is closed, which is what makes the stroke join\r\n * cleanly at the seam instead of drawing two unjoined end caps there.\r\n */\r\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\r\n const out: PathCommand[] = [];\r\n for (const pair of plan.pairs) {\r\n const n = pair.from.length;\r\n if (n === 0) continue;\r\n const first = lerpCubic(pair.from[0], pair.to[0], t);\r\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\r\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\r\n for (let i = 1; i < n; i++) {\r\n const c = lerpCubic(pair.from[i], pair.to[i], t);\r\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\r\n }\r\n if (pair.closed) out.push({ type: \"Z\" });\r\n }\r\n return out;\r\n}\r\n\r\n// --- Public tween entry point ----------------------------------------------\r\n\r\n/**\r\n * The morph plan is built from a `(from, to)` pair, which is constant for the\r\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\r\n * per frame with that same pair, so we cache the most recent plan to avoid\r\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\r\n * A one-entry cache is enough: tweens run one at a time per property and call us\r\n * with monotonically advancing `t` against fixed endpoints.\r\n */\r\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\r\n\r\nfunction planFor(from: PathData, to: PathData): MorphPlan {\r\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\r\n return cachedPlan.plan;\r\n }\r\n const built = plan(commands(from), commands(to));\r\n cachedPlan = { from, to, plan: built };\r\n return built;\r\n}\r\n\r\n/**\r\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\r\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\r\n *\r\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\r\n * share structure, command count, subpath count, point order, or winding — the\r\n * shapes are reconciled into a common cubic correspondence first (see the module\r\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\r\n * start and end frames are pixel-exact; in between, a morphed command list is\r\n * produced.\r\n *\r\n * @param from Source path (the shape at `t = 0`).\r\n * @param to Target path (the shape at `t = 1`).\r\n * @param t Progress in `[0, 1]`.\r\n */\r\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\r\n if (t <= 0) return from;\r\n if (t >= 1) return to;\r\n return sample(planFor(from, to), t);\r\n}\r\n"]}
1
+ {"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,CAA8B;IACjD,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,qEAAqE;QACrE,uEAAuE;QACvE,sEAAsE;QACtE,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,yEAAyE;QACzE,uEAAuE;QACvE,GAAG,CAAC,IAAI,CAAC;YACL,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG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,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Path morphing — smooth interpolation between two arbitrary path shapes.\n *\n * Lerping two SVG paths command-by-command only works when they happen to share\n * the same command structure; in general one path is a triangle and the other a\n * star with a different number of points, different command types, a different\n * start point, and the opposite winding. Naively pairing commands produces\n * kinks, self-intersections, and points that fly across the canvas.\n *\n * This module reshapes both paths into a common, directly-interpolatable form —\n * the same approach GSAP's MorphSVGPlugin uses:\n *\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\n * a subpath becomes a uniform chain of cubics described purely by anchor and\n * control points.\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\n * with degenerate, collapsed subpaths so every subpath has a partner),\n * equalizes the number of cubics in each pair by subdividing the coarser\n * subpath along its perimeter, and — for closed rings — rotates and optionally\n * reverses one ring so the two start at the same place and wind the same way.\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\n * interpolating every control point with {@link lerpVector2}.\n *\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\n * existing renderer draws unchanged.\n */\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance, cubicPoint } from \"./bezier\";\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\n\n/**\n * A path as cubic subpaths — one of the two boundaries where geometry is\n * deliberately flattened to a single curve type.\n *\n * A morph has to pair segments up and interpolate them, which needs both sides\n * speaking one language, so an arc becomes cubics here (and only here, and in\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\n * thing it got wrong that the shared walk does not is `Z`, which it marked\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\n * where SVG says two.\n */\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\n const out: CubicSubpath[] = [];\n for (const contour of contours(d)) {\n // A lone `M` has nothing to interpolate: it draws nothing and has no\n // first anchor to seed a partner from, so it is not a subpath here. It\n // stays in `contours`, where it still occupies a point of the bounds.\n const chain = contourSegments(contour).flatMap(segmentCubics);\n if (chain.length === 0) continue;\n // `contours` is memoized and shared, so hand out copies of its points: a\n // caller moving an anchor of the result must not move the cached path.\n out.push({\n cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),\n closed: contour.closed,\n });\n }\n return out;\n}\n\n/** First anchor of a subpath (the implicit `M` target). */\nfunction startPoint(cubics: Cubic[]): Vector2 {\n return cubics[0].p0;\n}\n\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\nfunction cubicLength(c: Cubic, steps = 8): number {\n let len = 0;\n let prev = c.p0;\n for (let i = 1; i <= steps; i++) {\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\n len += distance(prev, p);\n prev = p;\n }\n return len;\n}\n\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\nfunction centroid(cubics: Cubic[]): Vector2 {\n let x = 0, y = 0;\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\n return { x: x / cubics.length, y: y / cubics.length };\n}\n\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\n\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\n const a = lerpVector2(c.p0, c.c1, t);\n const b = lerpVector2(c.c1, c.c2, t);\n const d = lerpVector2(c.c2, c.p1, t);\n const e = lerpVector2(a, b, t);\n const f = lerpVector2(b, d, t);\n const g = lerpVector2(e, f, t);\n return [\n { p0: c.p0, c1: a, c2: e, p1: g },\n { p0: g, c1: f, c2: d, p1: c.p1 },\n ];\n}\n\n/**\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\n * Splits are spread across the longest segments first so the added anchor points\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\n * added point becomes a correspondence point with the other shape.\n */\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\n let work = cubics.slice();\n while (work.length < target) {\n // Find the longest cubic and split it in half.\n let longest = 0;\n let maxLen = -1;\n for (let i = 0; i < work.length; i++) {\n const len = cubicLength(work[i]);\n if (len > maxLen) { maxLen = len; longest = i; }\n }\n const [left, right] = splitCubic(work[longest], 0.5);\n work.splice(longest, 1, left, right);\n }\n return work;\n}\n\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\n\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\n const out: Cubic[] = [];\n for (let i = cubics.length - 1; i >= 0; i--) {\n const c = cubics[i];\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\n }\n return out;\n}\n\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\n if (offset === 0) return cubics.slice();\n return cubics.slice(offset).concat(cubics.slice(0, offset));\n}\n\n/** Sum of squared distances between paired anchor points — the alignment cost. */\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\n let cost = 0;\n for (let i = 0; i < a.length; i++) {\n const dx = a[i].p0.x - b[i].p0.x;\n const dy = a[i].p0.y - b[i].p0.y;\n cost += dx * dx + dy * dy;\n }\n return cost;\n}\n\n/**\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\n * every rotation offset, in both winding directions, and keeps whichever pairs the\n * anchor points with the least total travel. This is what lets two shapes whose\n * points are listed in any order — or that wind in opposite directions — morph\n * without spinning or folding through themselves.\n */\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\n const n = from.length;\n let best = to;\n let bestCost = Infinity;\n\n for (const candidate of [to, reverseCubics(to)]) {\n for (let offset = 0; offset < n; offset++) {\n const rotated = rotateCubics(candidate, offset);\n const cost = anchorCost(from, rotated);\n if (cost < bestCost) {\n bestCost = cost;\n best = rotated;\n }\n }\n }\n return best;\n}\n\n/**\n * For an open subpath, only the winding can be flipped (rotation would change the\n * shape). Pick the direction whose endpoints best match the `from` subpath.\n */\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\n const reversed = reverseCubics(to);\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\n}\n\n// --- Degenerate subpaths (for count mismatches) -----------------------------\n\n/**\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\n * point, which is how added or removed subpaths animate.\n */\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\n const cubics: Cubic[] = [];\n for (let i = 0; i < count; i++) {\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\n }\n return cubics;\n}\n\n// --- Subpath pairing --------------------------------------------------------\n\n/**\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\n * so morphing maps each shape onto its closest counterpart rather than by list\n * order. Leftover subpaths on either side are paired with a degenerate partner\n * collapsed at their own centroid, so they grow/shrink in place.\n */\nfunction pairSubpaths(\n fromSubs: CubicSubpath[],\n toSubs: CubicSubpath[],\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\n const toUsed = new Array(toSubs.length).fill(false);\n\n for (const f of fromSubs) {\n const fc = centroid(f.cubics);\n let bestIdx = -1;\n let bestDist = Infinity;\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const d = distance(fc, centroid(toSubs[j].cubics));\n if (d < bestDist) { bestDist = d; bestIdx = j; }\n }\n if (bestIdx >= 0) {\n toUsed[bestIdx] = true;\n pairs.push({ from: f, to: toSubs[bestIdx] });\n } else {\n // No `to` subpath left → collapse to this subpath's own centroid.\n pairs.push({\n from: f,\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\n });\n }\n }\n\n // Any unused `to` subpaths grow out of their own centroid.\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const t = toSubs[j];\n const tc = centroid(t.cubics);\n pairs.push({\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\n to: t,\n });\n }\n\n return pairs;\n}\n\n// --- Building the morph plan ------------------------------------------------\n\n/**\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\n */\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\n const fromSubs = cubics(from);\n const toSubs = cubics(to);\n\n // Both empty → nothing to morph.\n if (fromSubs.length === 0 && toSubs.length === 0) {\n return { pairs: [] };\n }\n\n // One side empty → collapse/grow the other against a point at its start.\n if (fromSubs.length === 0) {\n const seed = startPoint(toSubs[0].cubics);\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\n }\n if (toSubs.length === 0) {\n const seed = startPoint(fromSubs[0].cubics);\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\n }\n\n const subPairs = pairSubpaths(fromSubs, toSubs);\n\n const pairs = subPairs.map(({ from: f, to: t }) => {\n // Equalize cubic counts by subdividing the coarser side.\n const count = Math.max(f.cubics.length, t.cubics.length);\n const fromCubics = subdivideTo(f.cubics, count);\n let toCubics = subdivideTo(t.cubics, count);\n\n // Align the `to` side to the `from` side so points correspond and travel\n // the shortest path. Closed rings can rotate + reverse; open paths only\n // reverse (rotating an open path would tear it).\n const bothClosed = f.closed && t.closed;\n toCubics = bothClosed\n ? alignClosedRing(fromCubics, toCubics)\n : alignOpenSubpath(fromCubics, toCubics);\n\n return { from: fromCubics, to: toCubics, closed: bothClosed };\n });\n\n return { pairs };\n}\n\n// --- Sampling ---------------------------------------------------------------\n\n/** Interpolate a single cubic's four points. */\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\n return {\n p0: lerpVector2(from.p0, to.p0, t),\n c1: lerpVector2(from.c1, to.c1, t),\n c2: lerpVector2(from.c2, to.c2, t),\n p1: lerpVector2(from.p1, to.p1, t),\n };\n}\n\n/**\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\n * for closed subpaths.\n *\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\n * is tell the renderer the contour is closed, which is what makes the stroke join\n * cleanly at the seam instead of drawing two unjoined end caps there.\n */\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\n const out: PathCommand[] = [];\n for (const pair of plan.pairs) {\n const n = pair.from.length;\n if (n === 0) continue;\n const first = lerpCubic(pair.from[0], pair.to[0], t);\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\n for (let i = 1; i < n; i++) {\n const c = lerpCubic(pair.from[i], pair.to[i], t);\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\n }\n if (pair.closed) out.push({ type: \"Z\" });\n }\n return out;\n}\n\n// --- Public tween entry point ----------------------------------------------\n\n/**\n * The morph plan is built from a `(from, to)` pair, which is constant for the\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\n * per frame with that same pair, so we cache the most recent plan to avoid\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\n * A one-entry cache is enough: tweens run one at a time per property and call us\n * with monotonically advancing `t` against fixed endpoints.\n */\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\n\nfunction planFor(from: PathData, to: PathData): MorphPlan {\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\n return cachedPlan.plan;\n }\n const built = plan(commands(from), commands(to));\n cachedPlan = { from, to, plan: built };\n return built;\n}\n\n/**\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\n *\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\n * share structure, command count, subpath count, point order, or winding — the\n * shapes are reconciled into a common cubic correspondence first (see the module\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\n * start and end frames are pixel-exact; in between, a morphed command list is\n * produced.\n *\n * @param from Source path (the shape at `t = 0`).\n * @param to Target path (the shape at `t = 1`).\n * @param t Progress in `[0, 1]`.\n */\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\n if (t <= 0) return from;\n if (t >= 1) return to;\n return sample(planFor(from, to), t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EACpE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GACrD,MAAM,WAAW,CAAC;AAoEnB,MAAM,CAAC,MAAM,OAAO,GAA+C;IAC/D,6DAA6D;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI;IAEJ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAEP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,IAAI;IACJ,IAAI;IACJ,SAAS;IAET,IAAI;IACJ,MAAM;IAEN,WAAW;IACX,cAAc;IACd,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,OAAO;IAEP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC","sourcesContent":["/**\r\n * Every path-geometry operation, on one object.\r\n *\r\n * `pathOps` was already the path attribute's `resolve`/`lerp` pair; it now\r\n * carries the rest, which is the repo's existing shape for an attribute whose\r\n * operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,\r\n * `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.\r\n * Every `Types.path` entry is untouched by the addition.\r\n *\r\n * Behind it is **one** pen walk. There were seven — one each in `bounds`,\r\n * `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model\r\n * — and they disagreed about where `Z` leaves the cursor, which control point an\r\n * `S`/`T` reflects, and what an arc is. The pipeline is now:\r\n *\r\n * PathData ── commands ──▶ PathCommand[] ── contours ──▶ PathContour[]\r\n * │\r\n * bounds · size · length · sampler · dash · trim ◀─────┤\r\n * cubics ── morph ◀──────────┤\r\n * anchors ── editing ◀────────┘\r\n *\r\n * `cubics` and `anchors` are the only two places geometry is flattened to a\r\n * single curve type, because a morph needs one segment kind to pair up and\r\n * nobody can drag an arc's handles. Everything that measures keeps the arc.\r\n *\r\n * Each method is the module function of the same name, so a call site and its\r\n * implementation are one grep apart.\r\n */\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\nimport { bounds, commands, contours, size } from \"./walk\";\r\nimport { dash, dashScale, length, sampler, trim } from \"./measure\";\r\nimport { cubics, lerp, plan, sample } from \"./morph\";\r\nimport {\r\n anchorBounds, anchorCommands, anchors, endFit, fitToBox, fromAnchors,\r\n isEmpty, map, normalize, pointOn, split, translate,\r\n} from \"./anchors\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { Extents } from \"@/layout/bounds\";\r\nimport { PathContour, CubicSubpath, VectorPath, PathSampler, MorphPlan, PathNormalization, PathAnchor } from \"./types\";\r\n\r\n\r\n/** The path attribute's operations beyond `resolve`/`lerp`. */\r\nexport interface PathOps {\r\n // ── Reading ────────────────────────────────────────────────────────────\r\n /** Parse. A `PathCommand[]` passes through by reference; nullish gives `[]`. */\r\n commands(d: PathData | null | undefined): PathCommand[];\r\n /** The normal form: absolute, shorthands expanded, grouped into contours. */\r\n contours(d: PathData | null | undefined): PathContour[];\r\n /** All-cubic form. Lossy for arcs — one of the two flattening boundaries. */\r\n cubics(d: PathData | null | undefined): CubicSubpath[];\r\n /** The editable anchor model. Lossy for arcs — the other boundary. */\r\n anchors(d: PathData | null | undefined): VectorPath;\r\n\r\n // ── Measuring ──────────────────────────────────────────────────────────\r\n /** Tight box: each segment's own extrema, not its control hull. */\r\n bounds(d: PathData | null | undefined): Extents | null;\r\n /** {@link bounds} as a size; `0 x 0` for an empty path. */\r\n size(d: PathData | null | undefined): { width: number; height: number };\r\n /** Total arc length. An arc is measured along the arc, not across its chord. */\r\n length(d: PathData | null | undefined): number;\r\n /** Point and unit tangent at a distance along the path. */\r\n sampler(d: PathData): PathSampler;\r\n\r\n // ── Rewriting ──────────────────────────────────────────────────────────\r\n /** The portion between two arc-length fractions. Works on strings. */\r\n trim(d: PathData, start: number, end: number): PathData;\r\n /** Only the \"on\" runs of a dash pattern, fit as the renderer fits it, as a `d` string. */\r\n dash(d: PathData | null | undefined, pattern: number[], offset?: number): string;\r\n /** How far a pattern is stretched to fit one contour of a path — see `dash`. */\r\n dashScale(pattern: number[], contour: { length: number; closed: boolean }, total: number): number | null;\r\n\r\n // ── Morphing ───────────────────────────────────────────────────────────\r\n /** A reusable correspondence between two paths. Expensive; `lerp` caches one. */\r\n plan(from: PathCommand[], to: PathCommand[]): MorphPlan;\r\n /** Sample a plan at `t`. Cheap. */\r\n sample(plan: MorphPlan, t: number): PathCommand[];\r\n\r\n // ── The anchor model ───────────────────────────────────────────────────\r\n /** Anchors back to a `d` string. Emits only `M`/`L`/`C`/`Z`. */\r\n fromAnchors(path: VectorPath): string;\r\n /** Anchors to commands, with a transform folded into the same pass. */\r\n anchorCommands(path: VectorPath, transform?: (p: Vector2) => Vector2): PathCommand[];\r\n /** Tight box of an anchor path. */\r\n anchorBounds(path: VectorPath): Extents | null;\r\n /** Every point and handle mapped. */\r\n map(path: VectorPath, fn: (p: Vector2) => Vector2): VectorPath;\r\n translate(path: VectorPath, delta: Vector2): VectorPath;\r\n /** The turn-and-scale about `start` carrying `end` onto `to` — a `map` fn. */\r\n endFit(start: Vector2, end: Vector2, to: Vector2): (p: Vector2) => Vector2;\r\n isEmpty(path: VectorPath): boolean;\r\n\r\n // ── The unit box ───────────────────────────────────────────────────────\r\n /** Re-quote against the geometry's own bounds. */\r\n normalize(path: VectorPath): PathNormalization;\r\n /** Re-quote against a stated box — the general form of {@link PathOps.normalize}. */\r\n fitToBox(path: VectorPath, box: Extents): PathNormalization;\r\n /** A point on the segment between two anchors, for hit-testing an insert. */\r\n pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2;\r\n /** De Casteljau split, so inserting an anchor does not move the curve. */\r\n split(from: PathAnchor, to: PathAnchor, t: number): { from: PathAnchor; middle: PathAnchor; to: PathAnchor };\r\n}\r\n\r\n\r\nexport const pathOps: AttributeOps<PathData, PathData> & PathOps = {\r\n // An SVG path string or command list needs no normalization.\r\n resolve: (value) => value,\r\n lerp,\r\n\r\n commands,\r\n contours,\r\n cubics,\r\n anchors,\r\n\r\n bounds,\r\n size,\r\n length,\r\n sampler,\r\n\r\n trim,\r\n dash,\r\n dashScale,\r\n\r\n plan,\r\n sample,\r\n\r\n fromAnchors,\r\n anchorCommands,\r\n anchorBounds,\r\n map,\r\n translate,\r\n endFit,\r\n isEmpty,\r\n\r\n normalize,\r\n fitToBox,\r\n pointOn,\r\n split,\r\n};\r\n"]}
1
+ {"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EACpE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GACrD,MAAM,WAAW,CAAC;AAoEnB,MAAM,CAAC,MAAM,OAAO,GAA+C;IAC/D,6DAA6D;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI;IAEJ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAEP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,IAAI;IACJ,IAAI;IACJ,SAAS;IAET,IAAI;IACJ,MAAM;IAEN,WAAW;IACX,cAAc;IACd,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,OAAO;IAEP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC","sourcesContent":["/**\n * Every path-geometry operation, on one object.\n *\n * `pathOps` was already the path attribute's `resolve`/`lerp` pair; it now\n * carries the rest, which is the repo's existing shape for an attribute whose\n * operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,\n * `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.\n * Every `Types.path` entry is untouched by the addition.\n *\n * Behind it is **one** pen walk. There were seven — one each in `bounds`,\n * `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model\n * — and they disagreed about where `Z` leaves the cursor, which control point an\n * `S`/`T` reflects, and what an arc is. The pipeline is now:\n *\n * PathData ── commands ──▶ PathCommand[] ── contours ──▶ PathContour[]\n * │\n * bounds · size · length · sampler · dash · trim ◀─────┤\n * cubics ── morph ◀──────────┤\n * anchors ── editing ◀────────┘\n *\n * `cubics` and `anchors` are the only two places geometry is flattened to a\n * single curve type, because a morph needs one segment kind to pair up and\n * nobody can drag an arc's handles. Everything that measures keeps the arc.\n *\n * Each method is the module function of the same name, so a call site and its\n * implementation are one grep apart.\n */\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\n\nimport { bounds, commands, contours, size } from \"./walk\";\nimport { dash, dashScale, length, sampler, trim } from \"./measure\";\nimport { cubics, lerp, plan, sample } from \"./morph\";\nimport {\n anchorBounds, anchorCommands, anchors, endFit, fitToBox, fromAnchors,\n isEmpty, map, normalize, pointOn, split, translate,\n} from \"./anchors\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { Extents } from \"@/layout/bounds\";\nimport { PathContour, CubicSubpath, VectorPath, PathSampler, MorphPlan, PathNormalization, PathAnchor } from \"./types\";\n\n\n/** The path attribute's operations beyond `resolve`/`lerp`. */\nexport interface PathOps {\n // ── Reading ────────────────────────────────────────────────────────────\n /** Parse. A `PathCommand[]` passes through by reference; nullish gives `[]`. */\n commands(d: PathData | null | undefined): PathCommand[];\n /** The normal form: absolute, shorthands expanded, grouped into contours. */\n contours(d: PathData | null | undefined): PathContour[];\n /** All-cubic form. Lossy for arcs — one of the two flattening boundaries. */\n cubics(d: PathData | null | undefined): CubicSubpath[];\n /** The editable anchor model. Lossy for arcs — the other boundary. */\n anchors(d: PathData | null | undefined): VectorPath;\n\n // ── Measuring ──────────────────────────────────────────────────────────\n /** Tight box: each segment's own extrema, not its control hull. */\n bounds(d: PathData | null | undefined): Extents | null;\n /** {@link bounds} as a size; `0 x 0` for an empty path. */\n size(d: PathData | null | undefined): { width: number; height: number };\n /** Total arc length. An arc is measured along the arc, not across its chord. */\n length(d: PathData | null | undefined): number;\n /** Point and unit tangent at a distance along the path. */\n sampler(d: PathData): PathSampler;\n\n // ── Rewriting ──────────────────────────────────────────────────────────\n /** The portion between two arc-length fractions. Works on strings. */\n trim(d: PathData, start: number, end: number): PathData;\n /** Only the \"on\" runs of a dash pattern, fit as the renderer fits it, as a `d` string. */\n dash(d: PathData | null | undefined, pattern: number[], offset?: number): string;\n /** How far a pattern is stretched to fit one contour of a path — see `dash`. */\n dashScale(pattern: number[], contour: { length: number; closed: boolean }, total: number): number | null;\n\n // ── Morphing ───────────────────────────────────────────────────────────\n /** A reusable correspondence between two paths. Expensive; `lerp` caches one. */\n plan(from: PathCommand[], to: PathCommand[]): MorphPlan;\n /** Sample a plan at `t`. Cheap. */\n sample(plan: MorphPlan, t: number): PathCommand[];\n\n // ── The anchor model ───────────────────────────────────────────────────\n /** Anchors back to a `d` string. Emits only `M`/`L`/`C`/`Z`. */\n fromAnchors(path: VectorPath): string;\n /** Anchors to commands, with a transform folded into the same pass. */\n anchorCommands(path: VectorPath, transform?: (p: Vector2) => Vector2): PathCommand[];\n /** Tight box of an anchor path. */\n anchorBounds(path: VectorPath): Extents | null;\n /** Every point and handle mapped. */\n map(path: VectorPath, fn: (p: Vector2) => Vector2): VectorPath;\n translate(path: VectorPath, delta: Vector2): VectorPath;\n /** The turn-and-scale about `start` carrying `end` onto `to` — a `map` fn. */\n endFit(start: Vector2, end: Vector2, to: Vector2): (p: Vector2) => Vector2;\n isEmpty(path: VectorPath): boolean;\n\n // ── The unit box ───────────────────────────────────────────────────────\n /** Re-quote against the geometry's own bounds. */\n normalize(path: VectorPath): PathNormalization;\n /** Re-quote against a stated box — the general form of {@link PathOps.normalize}. */\n fitToBox(path: VectorPath, box: Extents): PathNormalization;\n /** A point on the segment between two anchors, for hit-testing an insert. */\n pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2;\n /** De Casteljau split, so inserting an anchor does not move the curve. */\n split(from: PathAnchor, to: PathAnchor, t: number): { from: PathAnchor; middle: PathAnchor; to: PathAnchor };\n}\n\n\nexport const pathOps: AttributeOps<PathData, PathData> & PathOps = {\n // An SVG path string or command list needs no normalization.\n resolve: (value) => value,\n lerp,\n\n commands,\n contours,\n cubics,\n anchors,\n\n bounds,\n size,\n length,\n sampler,\n\n trim,\n dash,\n dashScale,\n\n plan,\n sample,\n\n fromAnchors,\n anchorCommands,\n anchorBounds,\n map,\n translate,\n endFit,\n isEmpty,\n\n normalize,\n fitToBox,\n pointOn,\n split,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/types.ts"],"names":[],"mappings":";AA0MA,8EAA8E","sourcesContent":["/**\r\n * Every type the path module names, in one place.\r\n *\r\n * The vocabulary is small and it is worth seeing all of it at once, because the\r\n * whole module is four representations and the conversions between them:\r\n *\r\n * PathData ─▶ PathCommand[] ─▶ PathContour[] ─┬─▶ CubicSubpath[] (morph)\r\n * a string as written the normal └─▶ VectorPath (editing)\r\n * or commands form\r\n */\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\n\r\n// ── Geometry ───────────────────────────────────────────────────────────────\r\n\r\n// `Extents` — the `{ minX, minY, maxX, maxY }` box — is `@/layout/bounds`'s,\r\n// not a second copy. A path's bounding box and a node's are the same idea, and\r\n// the two were already the same four fields under two names.\r\n\r\n/**\r\n * A single cubic Bézier: start anchor `p0`, controls `c1`/`c2`, end anchor `p1`.\r\n * The end anchor of one cubic is the start of the next within a subpath.\r\n */\r\nexport interface Cubic {\r\n p0: Vector2;\r\n c1: Vector2;\r\n c2: Vector2;\r\n p1: Vector2;\r\n}\r\n\r\n/** An SVG `A` command re-expressed as the ellipse arc it names. */\r\nexport interface ArcParams {\r\n cx: number;\r\n cy: number;\r\n /** Radii after the spec's \"scale up until the endpoints are reachable\" correction. */\r\n rx: number;\r\n ry: number;\r\n /** x-axis rotation, in **radians** (the command carries degrees). */\r\n phi: number;\r\n /** Start angle, and the signed sweep from it — `sweep`/`largeArc` already folded in. */\r\n theta1: number;\r\n dtheta: number;\r\n}\r\n\r\n// ── The normal form ────────────────────────────────────────────────────────\r\n\r\n/**\r\n * One piece of a contour, keeping its own kind.\r\n *\r\n * Normalizing everything to cubics would be simpler by one dimension and wrong\r\n * in a way that shows on screen: an arc is not a cubic, so `length`, `sampler`,\r\n * `dash` and `trim` would all inherit an approximation only *morph* and the\r\n * anchor model actually need.\r\n *\r\n * Plain data, not a bundle of closures: `contours` runs inside `measure()` on\r\n * every layout pass, and arc-length parameterization is the expensive part of\r\n * path geometry. Nothing here samples a curve — `Extents` come from\r\n * closed-form extrema, and arc length is a separate, lazy table.\r\n */\r\nexport type PathSegment =\r\n | { kind: \"line\"; from: Vector2; to: Vector2 }\r\n | { kind: \"quad\"; from: Vector2; c: Vector2; to: Vector2 }\r\n | { kind: \"cubic\"; from: Vector2; c1: Vector2; c2: Vector2; to: Vector2 }\r\n | {\r\n kind: \"arc\"; from: Vector2; to: Vector2;\r\n rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1;\r\n };\r\n\r\n/**\r\n * One connected run — everything between an `M` and the next one.\r\n *\r\n * `start` is carried separately because a contour can legitimately have no\r\n * segments: a lone `M` is a real thing to write, it occupies a point that bounds\r\n * must account for, and the anchor model round-trips it as a single anchor.\r\n *\r\n * The closing edge of a `closed` contour is **not** in `segments` — `closed`\r\n * carries it. Storing it would mean a zero-length segment whenever the geometry\r\n * already ends where it started, which is most of the time.\r\n */\r\nexport interface PathContour {\r\n start: Vector2;\r\n segments: PathSegment[];\r\n /** Whether the run ended with a `Z`. */\r\n closed: boolean;\r\n}\r\n\r\n// ── Arc-length measurement ─────────────────────────────────────────────────\r\n\r\nexport interface SegmentMetric {\r\n segment: PathSegment;\r\n /** The flattened polyline, `from` first and `to` last. */\r\n points: Vector2[];\r\n /** Length along the polyline at each point; the last entry is `length`. */\r\n cumulative: number[];\r\n length: number;\r\n}\r\n\r\nexport interface ContourMetric {\r\n contour: PathContour;\r\n /** Every segment, the closed contour's implied join included. */\r\n metrics: SegmentMetric[];\r\n length: number;\r\n}\r\n\r\nexport interface PathMetric {\r\n contours: ContourMetric[];\r\n length: number;\r\n}\r\n\r\n/** A point on the path with the unit tangent direction there. */\r\nexport interface PathFrame {\r\n x: number;\r\n y: number;\r\n /** Unit tangent (direction of travel along the path). */\r\n tx: number;\r\n ty: number;\r\n}\r\n\r\nexport interface PathSampler {\r\n /** Total arc length across all contours. */\r\n readonly length: number;\r\n /**\r\n * Point and unit tangent at arc-length distance `d` from the path start.\r\n * `d` is clamped to `[0, length]`. Returns `null` only for a degenerate\r\n * (zero-length) path. Keeps an internal cursor so repeated calls with\r\n * non-decreasing `d` are amortized O(1).\r\n */\r\n frameAt(d: number): PathFrame | null;\r\n}\r\n\r\n// ── Morphing ───────────────────────────────────────────────────────────────\r\n\r\n/** A connected run of cubics (one `M` followed by curves), optionally closed. */\r\nexport interface CubicSubpath {\r\n cubics: Cubic[];\r\n /** True for subpaths that ended with a `Z` — eligible for rotation/reversal. */\r\n closed: boolean;\r\n}\r\n\r\n/** A correspondence between two paths, pre-aligned so it can be sampled at any `t`. */\r\nexport interface MorphPlan {\r\n /** Subpath pairs; each pair has the same number of cubics on both sides. */\r\n pairs: Array<{\r\n from: Cubic[];\r\n to: Cubic[];\r\n /**\r\n * Whether the sampled subpath should be closed with a `Z`. A pair is\r\n * closed when both sides were closed rings — a closed shape morphing to\r\n * another closed shape stays closed, so the stroke forms a proper join\r\n * at the seam instead of leaving two unconnected free ends.\r\n */\r\n closed: boolean;\r\n }>;\r\n}\r\n\r\n// ── The editable anchor model ──────────────────────────────────────────────\r\n\r\n/**\r\n * One anchor on a subpath, with the two control points that shape the segments\r\n * meeting at it.\r\n *\r\n * Handles are **absolute** points in the same space as {@link PathAnchor.point},\r\n * not offsets from it. That is what an SVG cubic stores, so serializing is a\r\n * copy rather than an addition, and it is the space a canvas editor drags them\r\n * in — an offset model would convert twice per pointer event for no gain.\r\n *\r\n * `null` means \"no handle on this side\", which draws as a straight segment. A\r\n * corner point has both null; a smooth point has both, mirrored through the\r\n * anchor; an asymmetric point has both, pointing opposite ways at different\r\n * lengths. The model does not record which of the three a point *is* — that is\r\n * derived from the handles, so a file cannot claim to be smooth while holding\r\n * handles that aren't.\r\n */\r\nexport interface PathAnchor {\r\n point: Vector2;\r\n /** Control point for the segment **arriving** at this anchor. */\r\n inHandle: Vector2 | null;\r\n /** Control point for the segment **leaving** it. */\r\n outHandle: Vector2 | null;\r\n}\r\n\r\n/** A single contiguous run of anchors — one `M …` in the `d` string. */\r\nexport interface PathSubpath {\r\n anchors: PathAnchor[];\r\n /** Whether the last anchor joins back to the first (`Z`). */\r\n closed: boolean;\r\n}\r\n\r\n/** A whole path: zero or more subpaths. */\r\nexport type VectorPath = PathSubpath[];\r\n\r\n/** Scale and offset applied on each axis, as `pathOps.normalize` reports it. */\r\nexport interface PathNormalization {\r\n /** The path, remapped so its bounds are exactly the unit box. */\r\n path: VectorPath;\r\n /** How much wider the geometry became, as a multiple of the old box. */\r\n scaleX: number;\r\n scaleY: number;\r\n /** Where the old geometry's centre sat, in the *old* unit space. */\r\n centerX: number;\r\n centerY: number;\r\n}\r\n\r\n// ── The operation surface ──────────────────────────────────────────────────\r\n\r\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/types.ts"],"names":[],"mappings":";AA0MA,8EAA8E","sourcesContent":["/**\n * Every type the path module names, in one place.\n *\n * The vocabulary is small and it is worth seeing all of it at once, because the\n * whole module is four representations and the conversions between them:\n *\n * PathData ─▶ PathCommand[] ─▶ PathContour[] ─┬─▶ CubicSubpath[] (morph)\n * a string as written the normal └─▶ VectorPath (editing)\n * or commands form\n */\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\n\n// ── Geometry ───────────────────────────────────────────────────────────────\n\n// `Extents` — the `{ minX, minY, maxX, maxY }` box — is `@/layout/bounds`'s,\n// not a second copy. A path's bounding box and a node's are the same idea, and\n// the two were already the same four fields under two names.\n\n/**\n * A single cubic Bézier: start anchor `p0`, controls `c1`/`c2`, end anchor `p1`.\n * The end anchor of one cubic is the start of the next within a subpath.\n */\nexport interface Cubic {\n p0: Vector2;\n c1: Vector2;\n c2: Vector2;\n p1: Vector2;\n}\n\n/** An SVG `A` command re-expressed as the ellipse arc it names. */\nexport interface ArcParams {\n cx: number;\n cy: number;\n /** Radii after the spec's \"scale up until the endpoints are reachable\" correction. */\n rx: number;\n ry: number;\n /** x-axis rotation, in **radians** (the command carries degrees). */\n phi: number;\n /** Start angle, and the signed sweep from it — `sweep`/`largeArc` already folded in. */\n theta1: number;\n dtheta: number;\n}\n\n// ── The normal form ────────────────────────────────────────────────────────\n\n/**\n * One piece of a contour, keeping its own kind.\n *\n * Normalizing everything to cubics would be simpler by one dimension and wrong\n * in a way that shows on screen: an arc is not a cubic, so `length`, `sampler`,\n * `dash` and `trim` would all inherit an approximation only *morph* and the\n * anchor model actually need.\n *\n * Plain data, not a bundle of closures: `contours` runs inside `measure()` on\n * every layout pass, and arc-length parameterization is the expensive part of\n * path geometry. Nothing here samples a curve — `Extents` come from\n * closed-form extrema, and arc length is a separate, lazy table.\n */\nexport type PathSegment =\n | { kind: \"line\"; from: Vector2; to: Vector2 }\n | { kind: \"quad\"; from: Vector2; c: Vector2; to: Vector2 }\n | { kind: \"cubic\"; from: Vector2; c1: Vector2; c2: Vector2; to: Vector2 }\n | {\n kind: \"arc\"; from: Vector2; to: Vector2;\n rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1;\n };\n\n/**\n * One connected run — everything between an `M` and the next one.\n *\n * `start` is carried separately because a contour can legitimately have no\n * segments: a lone `M` is a real thing to write, it occupies a point that bounds\n * must account for, and the anchor model round-trips it as a single anchor.\n *\n * The closing edge of a `closed` contour is **not** in `segments` — `closed`\n * carries it. Storing it would mean a zero-length segment whenever the geometry\n * already ends where it started, which is most of the time.\n */\nexport interface PathContour {\n start: Vector2;\n segments: PathSegment[];\n /** Whether the run ended with a `Z`. */\n closed: boolean;\n}\n\n// ── Arc-length measurement ─────────────────────────────────────────────────\n\nexport interface SegmentMetric {\n segment: PathSegment;\n /** The flattened polyline, `from` first and `to` last. */\n points: Vector2[];\n /** Length along the polyline at each point; the last entry is `length`. */\n cumulative: number[];\n length: number;\n}\n\nexport interface ContourMetric {\n contour: PathContour;\n /** Every segment, the closed contour's implied join included. */\n metrics: SegmentMetric[];\n length: number;\n}\n\nexport interface PathMetric {\n contours: ContourMetric[];\n length: number;\n}\n\n/** A point on the path with the unit tangent direction there. */\nexport interface PathFrame {\n x: number;\n y: number;\n /** Unit tangent (direction of travel along the path). */\n tx: number;\n ty: number;\n}\n\nexport interface PathSampler {\n /** Total arc length across all contours. */\n readonly length: number;\n /**\n * Point and unit tangent at arc-length distance `d` from the path start.\n * `d` is clamped to `[0, length]`. Returns `null` only for a degenerate\n * (zero-length) path. Keeps an internal cursor so repeated calls with\n * non-decreasing `d` are amortized O(1).\n */\n frameAt(d: number): PathFrame | null;\n}\n\n// ── Morphing ───────────────────────────────────────────────────────────────\n\n/** A connected run of cubics (one `M` followed by curves), optionally closed. */\nexport interface CubicSubpath {\n cubics: Cubic[];\n /** True for subpaths that ended with a `Z` — eligible for rotation/reversal. */\n closed: boolean;\n}\n\n/** A correspondence between two paths, pre-aligned so it can be sampled at any `t`. */\nexport interface MorphPlan {\n /** Subpath pairs; each pair has the same number of cubics on both sides. */\n pairs: Array<{\n from: Cubic[];\n to: Cubic[];\n /**\n * Whether the sampled subpath should be closed with a `Z`. A pair is\n * closed when both sides were closed rings — a closed shape morphing to\n * another closed shape stays closed, so the stroke forms a proper join\n * at the seam instead of leaving two unconnected free ends.\n */\n closed: boolean;\n }>;\n}\n\n// ── The editable anchor model ──────────────────────────────────────────────\n\n/**\n * One anchor on a subpath, with the two control points that shape the segments\n * meeting at it.\n *\n * Handles are **absolute** points in the same space as {@link PathAnchor.point},\n * not offsets from it. That is what an SVG cubic stores, so serializing is a\n * copy rather than an addition, and it is the space a canvas editor drags them\n * in — an offset model would convert twice per pointer event for no gain.\n *\n * `null` means \"no handle on this side\", which draws as a straight segment. A\n * corner point has both null; a smooth point has both, mirrored through the\n * anchor; an asymmetric point has both, pointing opposite ways at different\n * lengths. The model does not record which of the three a point *is* — that is\n * derived from the handles, so a file cannot claim to be smooth while holding\n * handles that aren't.\n */\nexport interface PathAnchor {\n point: Vector2;\n /** Control point for the segment **arriving** at this anchor. */\n inHandle: Vector2 | null;\n /** Control point for the segment **leaving** it. */\n outHandle: Vector2 | null;\n}\n\n/** A single contiguous run of anchors — one `M …` in the `d` string. */\nexport interface PathSubpath {\n anchors: PathAnchor[];\n /** Whether the last anchor joins back to the first (`Z`). */\n closed: boolean;\n}\n\n/** A whole path: zero or more subpaths. */\nexport type VectorPath = PathSubpath[];\n\n/** Scale and offset applied on each axis, as `pathOps.normalize` reports it. */\nexport interface PathNormalization {\n /** The path, remapped so its bounds are exactly the unit box. */\n path: VectorPath;\n /** How much wider the geometry became, as a multiple of the old box. */\n scaleX: number;\n scaleY: number;\n /** Where the old geometry's centre sat, in the *old* unit space. */\n centerX: number;\n centerY: number;\n}\n\n// ── The operation surface ──────────────────────────────────────────────────\n\n"]}