@motionscript/core 0.1.0-alpha.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (817) hide show
  1. package/CHANGELOG.md +25 -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.d.ts.map +1 -1
  105. package/dist/attributes/shape/fill/color/parser.js +20 -5
  106. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  107. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  119. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  120. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  121. package/dist/attributes/shape/fill/index.js.map +1 -1
  122. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  123. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  124. package/dist/attributes/shape/fill/registry.js.map +1 -1
  125. package/dist/attributes/shape/fill/union.js.map +1 -1
  126. package/dist/attributes/shape/filters/chain.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  134. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  135. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  136. package/dist/attributes/shape/filters/index.js.map +1 -1
  137. package/dist/attributes/shape/filters/registry.js.map +1 -1
  138. package/dist/attributes/shape/filters/union.js.map +1 -1
  139. package/dist/attributes/shape/path/anchors.js.map +1 -1
  140. package/dist/attributes/shape/path/bezier.js.map +1 -1
  141. package/dist/attributes/shape/path/index.js.map +1 -1
  142. package/dist/attributes/shape/path/measure.js.map +1 -1
  143. package/dist/attributes/shape/path/morph.js.map +1 -1
  144. package/dist/attributes/shape/path/ops.js.map +1 -1
  145. package/dist/attributes/shape/path/types.js.map +1 -1
  146. package/dist/attributes/shape/path/walk.js.map +1 -1
  147. package/dist/attributes/shape/shaders/index.js.map +1 -1
  148. package/dist/attributes/shape/shaders/language.js.map +1 -1
  149. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  150. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  151. package/dist/attributes/shape/shadow/index.js.map +1 -1
  152. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  153. package/dist/attributes/shape/stroke/index.js.map +1 -1
  154. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  155. package/dist/attributes/shared/operators.js.map +1 -1
  156. package/dist/attributes/text/index.js.map +1 -1
  157. package/dist/attributes/text/ops.js.map +1 -1
  158. package/dist/attributes/text/types.js.map +1 -1
  159. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  160. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  161. package/dist/browser/chunks/chunk-CCGVIR4F.js +3 -0
  162. package/dist/browser/chunks/chunk-CCGVIR4F.js.map +7 -0
  163. package/dist/browser/chunks/chunk-N4WSN5WY.js +13 -0
  164. package/dist/browser/chunks/chunk-N4WSN5WY.js.map +7 -0
  165. package/dist/browser/chunks/chunk-WZSI3GSK.js +6 -0
  166. package/dist/browser/chunks/chunk-WZSI3GSK.js.map +7 -0
  167. package/dist/browser/component.js +1 -1
  168. package/dist/browser/experimental.js +1 -1
  169. package/dist/browser/experimental.js.map +1 -1
  170. package/dist/browser/index.js +1 -1
  171. package/dist/browser/index.js.map +1 -1
  172. package/dist/browser/manifest.json +1 -1
  173. package/dist/browser/sdk.js +1 -1
  174. package/dist/component.js.map +1 -1
  175. package/dist/components/builtins/audio/audio.js.map +1 -1
  176. package/dist/components/builtins/geometry/composite.js.map +1 -1
  177. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  178. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  179. package/dist/components/builtins/layout/layout.js.map +1 -1
  180. package/dist/components/builtins/media/media.js.map +1 -1
  181. package/dist/components/builtins/providers/providers.js.map +1 -1
  182. package/dist/components/builtins/text/number-format.js.map +1 -1
  183. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  184. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  185. package/dist/components/builtins/text/text-layout.js.map +1 -1
  186. package/dist/components/builtins/text/text.d.ts +9 -9
  187. package/dist/components/builtins/text/text.js.map +1 -1
  188. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  189. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  190. package/dist/components/builtins/three/three.js.map +1 -1
  191. package/dist/components/factory/api.js.map +1 -1
  192. package/dist/components/factory/clip-of.js.map +1 -1
  193. package/dist/components/factory/commands-for.js.map +1 -1
  194. package/dist/components/factory/component-audio.js.map +1 -1
  195. package/dist/components/factory/component2d.js.map +1 -1
  196. package/dist/components/factory/component3d.js.map +1 -1
  197. package/dist/components/factory/factory.js.map +1 -1
  198. package/dist/components/factory/timeline.js.map +1 -1
  199. package/dist/components/factory/type-def.js.map +1 -1
  200. package/dist/components/factory/types.js.map +1 -1
  201. package/dist/components/factory/views.d.ts.map +1 -1
  202. package/dist/components/factory/views.js +41 -1
  203. package/dist/components/factory/views.js.map +1 -1
  204. package/dist/components/modules/aim.js.map +1 -1
  205. package/dist/components/modules/corners.js.map +1 -1
  206. package/dist/components/modules/flow.js.map +1 -1
  207. package/dist/components/modules/material.js.map +1 -1
  208. package/dist/components/modules/paint.js.map +1 -1
  209. package/dist/components/modules/shapes.js.map +1 -1
  210. package/dist/components/modules/text-layout.js.map +1 -1
  211. package/dist/components/modules/text-style.d.ts +1 -1
  212. package/dist/components/modules/text-style.js.map +1 -1
  213. package/dist/components/modules/three-entries.js.map +1 -1
  214. package/dist/components/modules/view3d.js.map +1 -1
  215. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  216. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  217. package/dist/components/trees/2d/node-motion.js.map +1 -1
  218. package/dist/components/trees/2d/node-render.js.map +1 -1
  219. package/dist/components/trees/2d/node-space.js.map +1 -1
  220. package/dist/components/trees/2d/node-transform.js.map +1 -1
  221. package/dist/components/trees/2d/node2d.js.map +1 -1
  222. package/dist/components/trees/audio/index.js.map +1 -1
  223. package/dist/components/trees/audio/node-audio.js.map +1 -1
  224. package/dist/components/trees/index.js.map +1 -1
  225. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  226. package/dist/components/trees/node/node-reactive.d.ts +3 -4
  227. package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
  228. package/dist/components/trees/node/node-reactive.js +13 -10
  229. package/dist/components/trees/node/node-reactive.js.map +1 -1
  230. package/dist/components/trees/node/node-time.js.map +1 -1
  231. package/dist/components/trees/node/node-walk.js.map +1 -1
  232. package/dist/components/trees/node/node.js.map +1 -1
  233. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  234. package/dist/components/trees/three/node3d.js.map +1 -1
  235. package/dist/document/audio.js.map +1 -1
  236. package/dist/document/builtins.js.map +1 -1
  237. package/dist/document/command-traits.d.ts +8 -0
  238. package/dist/document/command-traits.d.ts.map +1 -1
  239. package/dist/document/command-traits.js +17 -0
  240. package/dist/document/command-traits.js.map +1 -1
  241. package/dist/document/deny-globals.js.map +1 -1
  242. package/dist/document/diff.js.map +1 -1
  243. package/dist/document/doc-index.js.map +1 -1
  244. package/dist/document/expression/compile.js.map +1 -1
  245. package/dist/document/expression/index.js.map +1 -1
  246. package/dist/document/expression/ops.js.map +1 -1
  247. package/dist/document/expression/parse.js.map +1 -1
  248. package/dist/document/expression/refs.js.map +1 -1
  249. package/dist/document/expression/types.js.map +1 -1
  250. package/dist/document/expression/walk.js.map +1 -1
  251. package/dist/document/index.js.map +1 -1
  252. package/dist/document/migrate.js.map +1 -1
  253. package/dist/document/missing-node.js.map +1 -1
  254. package/dist/document/node-decorator.js.map +1 -1
  255. package/dist/document/node-descriptor.js.map +1 -1
  256. package/dist/document/placement.js.map +1 -1
  257. package/dist/document/project.js.map +1 -1
  258. package/dist/document/prop-evolution.js.map +1 -1
  259. package/dist/document/registry.js.map +1 -1
  260. package/dist/document/settled-index.d.ts +6 -0
  261. package/dist/document/settled-index.d.ts.map +1 -1
  262. package/dist/document/settled-index.js +18 -1
  263. package/dist/document/settled-index.js.map +1 -1
  264. package/dist/document/timeline-patch.js.map +1 -1
  265. package/dist/document/timeline.d.ts.map +1 -1
  266. package/dist/document/timeline.js +26 -6
  267. package/dist/document/timeline.js.map +1 -1
  268. package/dist/document/types.js.map +1 -1
  269. package/dist/document/validate.js.map +1 -1
  270. package/dist/document/vocabulary.js.map +1 -1
  271. package/dist/experimental.d.ts.map +1 -1
  272. package/dist/experimental.js.map +1 -1
  273. package/dist/index.js.map +1 -1
  274. package/dist/layout/bounds.js.map +1 -1
  275. package/dist/layout/constraints.js.map +1 -1
  276. package/dist/layout/flex.js.map +1 -1
  277. package/dist/layout/freeform.js.map +1 -1
  278. package/dist/layout/grid.js.map +1 -1
  279. package/dist/layout/index.js.map +1 -1
  280. package/dist/layout/item.js.map +1 -1
  281. package/dist/layout/ops.js.map +1 -1
  282. package/dist/layout/types.js.map +1 -1
  283. package/dist/platform/audio-sink.js.map +1 -1
  284. package/dist/platform/exporter.js.map +1 -1
  285. package/dist/platform/index.js.map +1 -1
  286. package/dist/platform/stepped-clock.js.map +1 -1
  287. package/dist/platform/storage-adapter.js.map +1 -1
  288. package/dist/platform/ticker.js.map +1 -1
  289. package/dist/project/config.js.map +1 -1
  290. package/dist/project/index.js.map +1 -1
  291. package/dist/project/tree.js.map +1 -1
  292. package/dist/props/host.d.ts +5 -0
  293. package/dist/props/host.d.ts.map +1 -1
  294. package/dist/props/host.js +3 -1
  295. package/dist/props/host.js.map +1 -1
  296. package/dist/props/index.js.map +1 -1
  297. package/dist/props/layout.d.ts +29 -0
  298. package/dist/props/layout.d.ts.map +1 -0
  299. package/dist/props/layout.js +84 -0
  300. package/dist/props/layout.js.map +1 -0
  301. package/dist/props/observer.js.map +1 -1
  302. package/dist/props/slot.js.map +1 -1
  303. package/dist/renamed-scene-names.js.map +1 -1
  304. package/dist/render/canvas-render-context2d.js.map +1 -1
  305. package/dist/render/clip-contains.js.map +1 -1
  306. package/dist/render/clip.js.map +1 -1
  307. package/dist/render/descriptors/ellipse.js.map +1 -1
  308. package/dist/render/descriptors/line.js.map +1 -1
  309. package/dist/render/descriptors/path-builder.js.map +1 -1
  310. package/dist/render/descriptors/path.js.map +1 -1
  311. package/dist/render/descriptors/polygon.js.map +1 -1
  312. package/dist/render/descriptors/polygram.js.map +1 -1
  313. package/dist/render/descriptors/rect.js.map +1 -1
  314. package/dist/render/descriptors/richtext.js.map +1 -1
  315. package/dist/render/descriptors/shape.js.map +1 -1
  316. package/dist/render/descriptors/text.js.map +1 -1
  317. package/dist/render/descriptors/transform.js.map +1 -1
  318. package/dist/render/graphics2d.js.map +1 -1
  319. package/dist/render/index.js.map +1 -1
  320. package/dist/render/measure-context.js.map +1 -1
  321. package/dist/render/null-render-context.js.map +1 -1
  322. package/dist/render/render-context2d.js.map +1 -1
  323. package/dist/render/render-issue.js.map +1 -1
  324. package/dist/render/surface.js.map +1 -1
  325. package/dist/render/text-defaults.js.map +1 -1
  326. package/dist/render/text-layout.js.map +1 -1
  327. package/dist/render3d/bounds3d.js.map +1 -1
  328. package/dist/render3d/builders.js.map +1 -1
  329. package/dist/render3d/camera.js.map +1 -1
  330. package/dist/render3d/fill3d.js.map +1 -1
  331. package/dist/render3d/geometry.js.map +1 -1
  332. package/dist/render3d/graphics3d.js.map +1 -1
  333. package/dist/render3d/index.js.map +1 -1
  334. package/dist/render3d/inert.js.map +1 -1
  335. package/dist/render3d/light.js.map +1 -1
  336. package/dist/render3d/material.js.map +1 -1
  337. package/dist/render3d/matrix4.js.map +1 -1
  338. package/dist/render3d/render-context3d.js.map +1 -1
  339. package/dist/render3d/resources.js.map +1 -1
  340. package/dist/render3d/rounded-box.js.map +1 -1
  341. package/dist/render3d/scene-settings.js.map +1 -1
  342. package/dist/render3d/scene3d.js.map +1 -1
  343. package/dist/render3d/segments.js.map +1 -1
  344. package/dist/render3d/texture.js.map +1 -1
  345. package/dist/render3d/tracking.js.map +1 -1
  346. package/dist/render3d/transform.js.map +1 -1
  347. package/dist/render3d/vector3.js.map +1 -1
  348. package/dist/render3d/walk.js.map +1 -1
  349. package/dist/runtime/asset-refine.js.map +1 -1
  350. package/dist/runtime/asset-timeline.js.map +1 -1
  351. package/dist/runtime/asset-update.js.map +1 -1
  352. package/dist/runtime/audio-index.js.map +1 -1
  353. package/dist/runtime/builtin-context.js.map +1 -1
  354. package/dist/runtime/clip-instance.js.map +1 -1
  355. package/dist/runtime/clip-store.js.map +1 -1
  356. package/dist/runtime/engine.js.map +1 -1
  357. package/dist/runtime/frame-time.js.map +1 -1
  358. package/dist/runtime/index.js.map +1 -1
  359. package/dist/runtime/node-picking.js.map +1 -1
  360. package/dist/runtime/node-picking3d.js.map +1 -1
  361. package/dist/runtime/placement.js.map +1 -1
  362. package/dist/runtime/playback-controller.js.map +1 -1
  363. package/dist/runtime/playback.js.map +1 -1
  364. package/dist/runtime/precompisition.js.map +1 -1
  365. package/dist/runtime/project-assets.js.map +1 -1
  366. package/dist/runtime/session.js.map +1 -1
  367. package/dist/runtime/settle.js.map +1 -1
  368. package/dist/runtime/state-evaluator.js.map +1 -1
  369. package/dist/runtime/text-geometry.js.map +1 -1
  370. package/dist/sdk/index.js.map +1 -1
  371. package/dist/tween/command-decorator.js.map +1 -1
  372. package/dist/tween/command.js.map +1 -1
  373. package/dist/tween/ease/constants.js.map +1 -1
  374. package/dist/tween/ease/curve.js.map +1 -1
  375. package/dist/tween/ease/describe.js.map +1 -1
  376. package/dist/tween/ease/spec.js.map +1 -1
  377. package/dist/tween/ease/type.js.map +1 -1
  378. package/dist/tween/index.js.map +1 -1
  379. package/dist/tween/inert.js.map +1 -1
  380. package/dist/tween/lerp.js.map +1 -1
  381. package/dist/tween/loop.js.map +1 -1
  382. package/dist/tween/prepare.js.map +1 -1
  383. package/dist/tween/stepper.js.map +1 -1
  384. package/dist/tween/to-command.js.map +1 -1
  385. package/dist/util/clamp.js.map +1 -1
  386. package/dist/util/context.js.map +1 -1
  387. package/dist/util/csv.js.map +1 -1
  388. package/dist/util/generateList.js.map +1 -1
  389. package/dist/util/index.js.map +1 -1
  390. package/dist/util/metrics.js.map +1 -1
  391. package/dist/util/random.js.map +1 -1
  392. package/dist/util/reference.js.map +1 -1
  393. package/dist/util/scheduler.js.map +1 -1
  394. package/package.json +1 -1
  395. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  396. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  397. package/dist/attributes/audio/filters/chain.js +0 -104
  398. package/dist/attributes/audio/filters/chain.js.map +0 -1
  399. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  400. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  401. package/dist/attributes/audio/filters/curve.js +0 -250
  402. package/dist/attributes/audio/filters/curve.js.map +0 -1
  403. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  404. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  405. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  406. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  407. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  408. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  409. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  410. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  411. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  412. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  413. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  414. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  415. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  416. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  417. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  418. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  419. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  420. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  421. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  422. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  423. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  424. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  425. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  426. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  427. package/dist/attributes/audio/filters/index.d.ts +0 -22
  428. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  429. package/dist/attributes/audio/filters/index.js +0 -8
  430. package/dist/attributes/audio/filters/index.js.map +0 -1
  431. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  432. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  433. package/dist/attributes/audio/filters/registry.js +0 -82
  434. package/dist/attributes/audio/filters/registry.js.map +0 -1
  435. package/dist/attributes/audio/filters/union.d.ts +0 -18
  436. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  437. package/dist/attributes/audio/filters/union.js +0 -28
  438. package/dist/attributes/audio/filters/union.js.map +0 -1
  439. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  440. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  441. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  442. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  443. package/dist/browser/chunks/chunk-AOT33LMS.js +0 -13
  444. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  445. package/dist/browser/chunks/chunk-GKM6UZJR.js +0 -6
  446. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  447. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  448. package/dist/browser/chunks/chunk-ZRPZPWZU.js +0 -3
  449. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  450. package/dist/component/api.d.ts +0 -508
  451. package/dist/component/api.d.ts.map +0 -1
  452. package/dist/component/api.js +0 -4
  453. package/dist/component/api.js.map +0 -1
  454. package/dist/component/builtins/audio.d.ts +0 -26
  455. package/dist/component/builtins/audio.d.ts.map +0 -1
  456. package/dist/component/builtins/audio.js +0 -41
  457. package/dist/component/builtins/audio.js.map +0 -1
  458. package/dist/component/builtins/canvas3d.d.ts +0 -98
  459. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  460. package/dist/component/builtins/canvas3d.js +0 -21
  461. package/dist/component/builtins/canvas3d.js.map +0 -1
  462. package/dist/component/builtins/composite.d.ts +0 -56
  463. package/dist/component/builtins/composite.d.ts.map +0 -1
  464. package/dist/component/builtins/composite.js +0 -25
  465. package/dist/component/builtins/composite.js.map +0 -1
  466. package/dist/component/builtins/geometry.d.ts +0 -505
  467. package/dist/component/builtins/geometry.d.ts.map +0 -1
  468. package/dist/component/builtins/geometry.js +0 -107
  469. package/dist/component/builtins/geometry.js.map +0 -1
  470. package/dist/component/builtins/layout.d.ts +0 -88
  471. package/dist/component/builtins/layout.d.ts.map +0 -1
  472. package/dist/component/builtins/layout.js +0 -84
  473. package/dist/component/builtins/layout.js.map +0 -1
  474. package/dist/component/builtins/media.d.ts +0 -95
  475. package/dist/component/builtins/media.d.ts.map +0 -1
  476. package/dist/component/builtins/media.js +0 -149
  477. package/dist/component/builtins/media.js.map +0 -1
  478. package/dist/component/builtins/providers.d.ts +0 -23
  479. package/dist/component/builtins/providers.d.ts.map +0 -1
  480. package/dist/component/builtins/providers.js +0 -30
  481. package/dist/component/builtins/providers.js.map +0 -1
  482. package/dist/component/builtins/text.d.ts +0 -193
  483. package/dist/component/builtins/text.d.ts.map +0 -1
  484. package/dist/component/builtins/text.js +0 -113
  485. package/dist/component/builtins/text.js.map +0 -1
  486. package/dist/component/builtins/three.d.ts +0 -1085
  487. package/dist/component/builtins/three.d.ts.map +0 -1
  488. package/dist/component/builtins/three.js +0 -265
  489. package/dist/component/builtins/three.js.map +0 -1
  490. package/dist/component/clip-of.d.ts +0 -5
  491. package/dist/component/clip-of.d.ts.map +0 -1
  492. package/dist/component/clip-of.js +0 -33
  493. package/dist/component/clip-of.js.map +0 -1
  494. package/dist/component/commands-for.d.ts +0 -19
  495. package/dist/component/commands-for.d.ts.map +0 -1
  496. package/dist/component/commands-for.js +0 -5
  497. package/dist/component/commands-for.js.map +0 -1
  498. package/dist/component/component-audio.d.ts +0 -9
  499. package/dist/component/component-audio.d.ts.map +0 -1
  500. package/dist/component/component-audio.js +0 -18
  501. package/dist/component/component-audio.js.map +0 -1
  502. package/dist/component/component2d.d.ts +0 -9
  503. package/dist/component/component2d.d.ts.map +0 -1
  504. package/dist/component/component2d.js +0 -239
  505. package/dist/component/component2d.js.map +0 -1
  506. package/dist/component/component3d.d.ts +0 -9
  507. package/dist/component/component3d.d.ts.map +0 -1
  508. package/dist/component/component3d.js +0 -99
  509. package/dist/component/component3d.js.map +0 -1
  510. package/dist/component/factory.d.ts +0 -63
  511. package/dist/component/factory.d.ts.map +0 -1
  512. package/dist/component/factory.js +0 -313
  513. package/dist/component/factory.js.map +0 -1
  514. package/dist/component/modules/aim.d.ts +0 -30
  515. package/dist/component/modules/aim.d.ts.map +0 -1
  516. package/dist/component/modules/aim.js +0 -39
  517. package/dist/component/modules/aim.js.map +0 -1
  518. package/dist/component/modules/corners.d.ts +0 -13
  519. package/dist/component/modules/corners.d.ts.map +0 -1
  520. package/dist/component/modules/corners.js +0 -12
  521. package/dist/component/modules/corners.js.map +0 -1
  522. package/dist/component/modules/flow.d.ts +0 -26
  523. package/dist/component/modules/flow.d.ts.map +0 -1
  524. package/dist/component/modules/flow.js +0 -55
  525. package/dist/component/modules/flow.js.map +0 -1
  526. package/dist/component/modules/material.d.ts +0 -40
  527. package/dist/component/modules/material.d.ts.map +0 -1
  528. package/dist/component/modules/material.js +0 -75
  529. package/dist/component/modules/material.js.map +0 -1
  530. package/dist/component/modules/paint.d.ts +0 -71
  531. package/dist/component/modules/paint.d.ts.map +0 -1
  532. package/dist/component/modules/paint.js +0 -106
  533. package/dist/component/modules/paint.js.map +0 -1
  534. package/dist/component/modules/shapes.d.ts +0 -31
  535. package/dist/component/modules/shapes.d.ts.map +0 -1
  536. package/dist/component/modules/shapes.js +0 -43
  537. package/dist/component/modules/shapes.js.map +0 -1
  538. package/dist/component/modules/text-layout.d.ts +0 -26
  539. package/dist/component/modules/text-layout.d.ts.map +0 -1
  540. package/dist/component/modules/text-layout.js +0 -57
  541. package/dist/component/modules/text-layout.js.map +0 -1
  542. package/dist/component/modules/text-style.d.ts +0 -48
  543. package/dist/component/modules/text-style.d.ts.map +0 -1
  544. package/dist/component/modules/text-style.js +0 -63
  545. package/dist/component/modules/text-style.js.map +0 -1
  546. package/dist/component/modules/three-entries.d.ts +0 -23
  547. package/dist/component/modules/three-entries.d.ts.map +0 -1
  548. package/dist/component/modules/three-entries.js +0 -41
  549. package/dist/component/modules/three-entries.js.map +0 -1
  550. package/dist/component/modules/view3d.d.ts +0 -55
  551. package/dist/component/modules/view3d.d.ts.map +0 -1
  552. package/dist/component/modules/view3d.js +0 -160
  553. package/dist/component/modules/view3d.js.map +0 -1
  554. package/dist/component/timeline.d.ts +0 -22
  555. package/dist/component/timeline.d.ts.map +0 -1
  556. package/dist/component/timeline.js +0 -128
  557. package/dist/component/timeline.js.map +0 -1
  558. package/dist/component/type-def.d.ts +0 -26
  559. package/dist/component/type-def.d.ts.map +0 -1
  560. package/dist/component/type-def.js +0 -16
  561. package/dist/component/type-def.js.map +0 -1
  562. package/dist/component/types.d.ts +0 -91
  563. package/dist/component/types.d.ts.map +0 -1
  564. package/dist/component/types.js +0 -88
  565. package/dist/component/types.js.map +0 -1
  566. package/dist/component/views.d.ts +0 -121
  567. package/dist/component/views.d.ts.map +0 -1
  568. package/dist/component/views.js +0 -413
  569. package/dist/component/views.js.map +0 -1
  570. package/dist/document/withdraw.d.ts +0 -28
  571. package/dist/document/withdraw.d.ts.map +0 -1
  572. package/dist/document/withdraw.js +0 -61
  573. package/dist/document/withdraw.js.map +0 -1
  574. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  575. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  576. package/dist/jsx/jsx-dev-runtime.js +0 -3
  577. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  578. package/dist/jsx/jsx-runtime.d.ts +0 -27
  579. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  580. package/dist/jsx/jsx-runtime.js +0 -26
  581. package/dist/jsx/jsx-runtime.js.map +0 -1
  582. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  583. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  584. package/dist/nodes/2d/node-lifecycle.js +0 -264
  585. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  586. package/dist/nodes/2d/node-motion.d.ts +0 -56
  587. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  588. package/dist/nodes/2d/node-motion.js +0 -86
  589. package/dist/nodes/2d/node-motion.js.map +0 -1
  590. package/dist/nodes/2d/node-render.d.ts +0 -44
  591. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  592. package/dist/nodes/2d/node-render.js +0 -80
  593. package/dist/nodes/2d/node-render.js.map +0 -1
  594. package/dist/nodes/2d/node-space.d.ts +0 -63
  595. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  596. package/dist/nodes/2d/node-space.js +0 -131
  597. package/dist/nodes/2d/node-space.js.map +0 -1
  598. package/dist/nodes/2d/node-transform.d.ts +0 -55
  599. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  600. package/dist/nodes/2d/node-transform.js +0 -73
  601. package/dist/nodes/2d/node-transform.js.map +0 -1
  602. package/dist/nodes/2d/node2d.d.ts +0 -1111
  603. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  604. package/dist/nodes/2d/node2d.js +0 -1665
  605. package/dist/nodes/2d/node2d.js.map +0 -1
  606. package/dist/nodes/2d/paint-node.d.ts +0 -142
  607. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  608. package/dist/nodes/2d/paint-node.js +0 -232
  609. package/dist/nodes/2d/paint-node.js.map +0 -1
  610. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  611. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  612. package/dist/nodes/audio/audio-bus.js +0 -33
  613. package/dist/nodes/audio/audio-bus.js.map +0 -1
  614. package/dist/nodes/audio/index.d.ts +0 -4
  615. package/dist/nodes/audio/index.d.ts.map +0 -1
  616. package/dist/nodes/audio/index.js +0 -2
  617. package/dist/nodes/audio/index.js.map +0 -1
  618. package/dist/nodes/audio/node-audio.d.ts +0 -107
  619. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  620. package/dist/nodes/audio/node-audio.js +0 -179
  621. package/dist/nodes/audio/node-audio.js.map +0 -1
  622. package/dist/nodes/audio/sound-node.d.ts +0 -41
  623. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  624. package/dist/nodes/audio/sound-node.js +0 -71
  625. package/dist/nodes/audio/sound-node.js.map +0 -1
  626. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  627. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  628. package/dist/nodes/geometry/boolean-node.js +0 -81
  629. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  630. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  631. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  632. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  633. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  634. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  635. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  636. package/dist/nodes/geometry/box-path-node.js +0 -116
  637. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  638. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  639. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  640. package/dist/nodes/geometry/ellipse-node.js +0 -45
  641. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  642. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  643. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  644. package/dist/nodes/geometry/group-bounds.js +0 -87
  645. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  646. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  647. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  648. package/dist/nodes/geometry/mask-node.js +0 -66
  649. package/dist/nodes/geometry/mask-node.js.map +0 -1
  650. package/dist/nodes/geometry/path-node.d.ts +0 -26
  651. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  652. package/dist/nodes/geometry/path-node.js +0 -58
  653. package/dist/nodes/geometry/path-node.js.map +0 -1
  654. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  655. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  656. package/dist/nodes/geometry/polygon-node.js +0 -47
  657. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  658. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  659. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  660. package/dist/nodes/geometry/polygram-node.js +0 -52
  661. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  662. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  663. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  664. package/dist/nodes/geometry/rect-node.js +0 -56
  665. package/dist/nodes/geometry/rect-node.js.map +0 -1
  666. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  667. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  668. package/dist/nodes/geometry/shape-node.js +0 -140
  669. package/dist/nodes/geometry/shape-node.js.map +0 -1
  670. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  671. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  672. package/dist/nodes/geometry/shape-outline.js +0 -470
  673. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  674. package/dist/nodes/index.d.ts +0 -53
  675. package/dist/nodes/index.d.ts.map +0 -1
  676. package/dist/nodes/index.js +0 -35
  677. package/dist/nodes/index.js.map +0 -1
  678. package/dist/nodes/layout/camera-node.d.ts +0 -80
  679. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  680. package/dist/nodes/layout/camera-node.js +0 -153
  681. package/dist/nodes/layout/camera-node.js.map +0 -1
  682. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  683. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  684. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  685. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  686. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  687. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  688. package/dist/nodes/layout/rotated-box.js +0 -76
  689. package/dist/nodes/layout/rotated-box.js.map +0 -1
  690. package/dist/nodes/media/video-node.d.ts +0 -229
  691. package/dist/nodes/media/video-node.d.ts.map +0 -1
  692. package/dist/nodes/media/video-node.js +0 -350
  693. package/dist/nodes/media/video-node.js.map +0 -1
  694. package/dist/nodes/node/declare-paints.d.ts +0 -19
  695. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  696. package/dist/nodes/node/declare-paints.js +0 -27
  697. package/dist/nodes/node/declare-paints.js.map +0 -1
  698. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  699. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  700. package/dist/nodes/node/node-editor-state.js +0 -23
  701. package/dist/nodes/node/node-editor-state.js.map +0 -1
  702. package/dist/nodes/node/node-reactive.d.ts +0 -89
  703. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  704. package/dist/nodes/node/node-reactive.js +0 -135
  705. package/dist/nodes/node/node-reactive.js.map +0 -1
  706. package/dist/nodes/node/node-time.d.ts +0 -39
  707. package/dist/nodes/node/node-time.d.ts.map +0 -1
  708. package/dist/nodes/node/node-time.js +0 -14
  709. package/dist/nodes/node/node-time.js.map +0 -1
  710. package/dist/nodes/node/node-walk.d.ts +0 -46
  711. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  712. package/dist/nodes/node/node-walk.js +0 -74
  713. package/dist/nodes/node/node-walk.js.map +0 -1
  714. package/dist/nodes/node/node.d.ts +0 -445
  715. package/dist/nodes/node/node.d.ts.map +0 -1
  716. package/dist/nodes/node/node.js +0 -745
  717. package/dist/nodes/node/node.js.map +0 -1
  718. package/dist/nodes/node/text-defaults.d.ts +0 -32
  719. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  720. package/dist/nodes/node/text-defaults.js +0 -37
  721. package/dist/nodes/node/text-defaults.js.map +0 -1
  722. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  723. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  724. package/dist/nodes/root/canvas2d-node.js +0 -264
  725. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  726. package/dist/nodes/root/provider-node.d.ts +0 -47
  727. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  728. package/dist/nodes/root/provider-node.js +0 -63
  729. package/dist/nodes/root/provider-node.js.map +0 -1
  730. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  731. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  732. package/dist/nodes/root/theme-provider-node.js +0 -43
  733. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  734. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  735. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  736. package/dist/nodes/text/default-text-style-node.js +0 -146
  737. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  738. package/dist/nodes/text/number-format.d.ts +0 -66
  739. package/dist/nodes/text/number-format.d.ts.map +0 -1
  740. package/dist/nodes/text/number-format.js +0 -227
  741. package/dist/nodes/text/number-format.js.map +0 -1
  742. package/dist/nodes/text/number-node.d.ts +0 -94
  743. package/dist/nodes/text/number-node.d.ts.map +0 -1
  744. package/dist/nodes/text/number-node.js +0 -86
  745. package/dist/nodes/text/number-node.js.map +0 -1
  746. package/dist/nodes/text/number-pattern.d.ts +0 -51
  747. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  748. package/dist/nodes/text/number-pattern.js +0 -77
  749. package/dist/nodes/text/number-pattern.js.map +0 -1
  750. package/dist/nodes/text/richtext-node.d.ts +0 -68
  751. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  752. package/dist/nodes/text/richtext-node.js +0 -78
  753. package/dist/nodes/text/richtext-node.js.map +0 -1
  754. package/dist/nodes/text/text-base.d.ts +0 -118
  755. package/dist/nodes/text/text-base.d.ts.map +0 -1
  756. package/dist/nodes/text/text-base.js +0 -153
  757. package/dist/nodes/text/text-base.js.map +0 -1
  758. package/dist/nodes/text/text-layout.d.ts +0 -87
  759. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  760. package/dist/nodes/text/text-layout.js +0 -368
  761. package/dist/nodes/text/text-layout.js.map +0 -1
  762. package/dist/nodes/text/text-node.d.ts +0 -84
  763. package/dist/nodes/text/text-node.d.ts.map +0 -1
  764. package/dist/nodes/text/text-node.js +0 -188
  765. package/dist/nodes/text/text-node.js.map +0 -1
  766. package/dist/nodes/text/text-selection.d.ts +0 -125
  767. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  768. package/dist/nodes/text/text-selection.js +0 -209
  769. package/dist/nodes/text/text-selection.js.map +0 -1
  770. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  771. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  772. package/dist/nodes/three/camera-nodes.js +0 -112
  773. package/dist/nodes/three/camera-nodes.js.map +0 -1
  774. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  775. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  776. package/dist/nodes/three/canvas3d-node.js +0 -486
  777. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  778. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  779. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  780. package/dist/nodes/three/drawable-nodes.js +0 -284
  781. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  782. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  783. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  784. package/dist/nodes/three/environment-nodes.js +0 -134
  785. package/dist/nodes/three/environment-nodes.js.map +0 -1
  786. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  787. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  788. package/dist/nodes/three/geometry-nodes.js +0 -322
  789. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  790. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  791. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  792. package/dist/nodes/three/grid-geometry3d.js +0 -114
  793. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  794. package/dist/nodes/three/group3d.d.ts +0 -23
  795. package/dist/nodes/three/group3d.d.ts.map +0 -1
  796. package/dist/nodes/three/group3d.js +0 -21
  797. package/dist/nodes/three/group3d.js.map +0 -1
  798. package/dist/nodes/three/light-nodes.d.ts +0 -120
  799. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  800. package/dist/nodes/three/light-nodes.js +0 -173
  801. package/dist/nodes/three/light-nodes.js.map +0 -1
  802. package/dist/nodes/three/mesh3d.d.ts +0 -117
  803. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  804. package/dist/nodes/three/mesh3d.js +0 -147
  805. package/dist/nodes/three/mesh3d.js.map +0 -1
  806. package/dist/nodes/three/node3d.d.ts +0 -230
  807. package/dist/nodes/three/node3d.d.ts.map +0 -1
  808. package/dist/nodes/three/node3d.js +0 -337
  809. package/dist/nodes/three/node3d.js.map +0 -1
  810. package/dist/render/descriptors/latex.d.ts +0 -6
  811. package/dist/render/descriptors/latex.d.ts.map +0 -1
  812. package/dist/render/descriptors/latex.js +0 -2
  813. package/dist/render/descriptors/latex.js.map +0 -1
  814. package/dist/tween/seekable.d.ts +0 -81
  815. package/dist/tween/seekable.d.ts.map +0 -1
  816. package/dist/tween/seekable.js +0 -137
  817. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shape-outline.js","sourceRoot":"","sources":["../../../../src/components/builtins/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAoCrD;;;;;;;;;GASG;AACH,MAAM,cAA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G,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE;SACxE,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAG,CAAA;QAC3B,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IACrC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\r\n * The silhouette of every shape type, as a {@link VectorPath}.\r\n *\r\n * One module, two callers with the same question asked at different scales:\r\n *\r\n * - The **shape node classes** (`nodes/shapes`) draw their outline every frame\r\n * from their laid-out box, so they ask in pixels.\r\n * - The **path editor** converts a shape into an editable Path node the moment\r\n * somebody moves one of its points, so it asks in the unit box the Path node\r\n * stores its geometry in (see `./vector-path`).\r\n *\r\n * Sharing the definition is what makes that conversion invisible: a triangle\r\n * that becomes a path is the *same* triangle, down to the rounding on its\r\n * corners, rather than a fresh approximation of one.\r\n *\r\n * ## Why these shapes exist at all\r\n *\r\n * The engine's `Polygon` inscribes its n-gon in the node's box — the vertices\r\n * sit on the box's inscribed ellipse — which is what makes a `sides` tween\r\n * smooth: every vertex count is the same circle sampled differently, so a\r\n * triangle morphing into a square doesn't lurch. The cost is that a triangle\r\n * *doesn't touch the bottom of its own bounds*, because the two base vertices\r\n * sit at 30° below the horizontal rather than on the ellipse's lowest point.\r\n * Figma's polygon does exactly the same thing for exactly the same reason.\r\n *\r\n * That is right for a shape you intend to animate and wrong for a shape you\r\n * intend to *be a triangle*. So the parametric `polygon`/`polygram` keep the\r\n * inscribed geometry, and the named shapes here are stretched to fill their box\r\n * — the vertices are computed on the circle exactly as before, then their\r\n * bounding box is mapped onto the node's. Same silhouette, no gap.\r\n *\r\n * Everything here works in **y-down** coordinates, the convention the stored\r\n * `d` string uses. The node classes flip once on the way to the renderer, whose\r\n * local space is y-up.\r\n */\r\n\r\nimport type { CornerRadiusResolved } from \"@/attributes/shape/corners/corner-radius\";\r\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { distance } from \"@/attributes/shape/path/bezier\"\r\nimport { pathOps } from \"@/attributes/shape/path/ops\"\r\nimport type { PathAnchor, PathSubpath, VectorPath } from \"@/attributes/shape/path/types\";\r\n\r\n/** The shape types this module can draw an outline for. */\r\nexport type ShapeOutlineKind =\r\n | \"rect\"\r\n | \"ellipse\"\r\n | \"polygon\"\r\n | \"polygram\"\r\n | \"triangle\"\r\n | \"rightTriangle\"\r\n | \"pentagon\"\r\n | \"hexagon\"\r\n | \"octagon\"\r\n | \"star\"\r\n\r\n/** Everything an outline can depend on. Unstated fields take the schema's default. */\r\nexport interface ShapeOutlineOptions {\r\n /** The node's box, in pixels. */\r\n width: number\r\n height: number\r\n /** Vertex/corner rounding, in pixels. Ignored by the shapes that have no corners. */\r\n cornerRadius?: number | CornerRadiusResolved\r\n cornerStyle?: CornerStyle\r\n /** Vertex count — `polygon`/`polygram`'s `sides`, `star`'s number of points. */\r\n sides?: number\r\n /**\r\n * The inner radius as a fraction of the outer one: a polygram's or star's\r\n * point depth, and an ellipse's donut hole.\r\n */\r\n ratio?: number\r\n /** The ellipse's arc, in degrees. */\r\n startAngle?: number\r\n sweep?: number\r\n}\r\n\r\n/**\r\n * The named shapes' vertex counts and how far they're turned from \"a vertex at\r\n * the top\".\r\n *\r\n * Pointy-top is the regular polygon's natural orientation and the one every icon\r\n * set draws a pentagon and a hexagon in. The octagon is the exception, and it is\r\n * not a matter of taste: an octagon with a vertex at the top reads as a rotated\r\n * stop sign, because a stop sign is the only octagon most people have ever\r\n * looked at and it has a flat top. Half a step turns it into that one.\r\n */\r\nconst NAMED_POLYGONS: Record<string, { sides: number; turn: number }> = {\r\n pentagon: { sides: 5, turn: 0 },\r\n hexagon: { sides: 6, turn: 0 },\r\n octagon: { sides: 8, turn: Math.PI / 8 },\r\n}\r\n\r\n/**\r\n * A star's default point depth: the classic five-pointed star, where the inner\r\n * vertices sit where the extended edges of a pentagram cross.\r\n *\r\n * Not the polygram node's 50%, and deliberately so. The parametric polygram\r\n * opens at a round number because it is a *control* you are expected to move;\r\n * this node exists for the person who wanted a star and got a geometry lesson,\r\n * so it opens on the star they were picturing.\r\n */\r\nexport const STAR_DEFAULT_RATIO = 0.382\r\n\r\n/** The default number of points on a Star node. */\r\nexport const STAR_DEFAULT_POINTS = 5\r\n\r\n/**\r\n * The shape's outline in **pixel** space: centred on the origin, spanning\r\n * `width` × `height`, y-down.\r\n *\r\n * Returns an empty path for a degenerate box, which draws nothing rather than\r\n * producing NaN coordinates the renderer would have to cope with.\r\n */\r\nexport function shapeOutlinePixels(\r\n kind: ShapeOutlineKind,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const { width, height } = options\r\n if (!(width > 0) || !(height > 0)) return []\r\n\r\n switch (kind) {\r\n case \"rect\":\r\n return [rectOutline(width, height, options)]\r\n case \"ellipse\":\r\n return ellipseOutline(width, height, options)\r\n case \"triangle\":\r\n return [\r\n polygonOutline(\r\n [\r\n { x: 0, y: -height / 2 },\r\n { x: width / 2, y: height / 2 },\r\n { x: -width / 2, y: height / 2 },\r\n ],\r\n options\r\n ),\r\n ]\r\n case \"rightTriangle\":\r\n return [\r\n polygonOutline(\r\n [\r\n { x: -width / 2, y: -height / 2 },\r\n { x: width / 2, y: height / 2 },\r\n { x: -width / 2, y: height / 2 },\r\n ],\r\n options\r\n ),\r\n ]\r\n case \"polygon\":\r\n // The parametric one: inscribed, *not* stretched — see the module note.\r\n return [\r\n polygonOutline(\r\n regularVertices(sidesOf(options, 5), 0, width / 2, height / 2),\r\n options\r\n ),\r\n ]\r\n case \"polygram\":\r\n return [\r\n polygonOutline(\r\n starVertices(\r\n sidesOf(options, 5),\r\n clamp01(options.ratio ?? 0.5),\r\n width / 2,\r\n height / 2\r\n ),\r\n options\r\n ),\r\n ]\r\n case \"star\":\r\n return [\r\n polygonOutline(\r\n fillBox(\r\n starVertices(\r\n sidesOf(options, STAR_DEFAULT_POINTS),\r\n clamp01(options.ratio ?? STAR_DEFAULT_RATIO),\r\n 1,\r\n 1\r\n ),\r\n width,\r\n height\r\n ),\r\n options\r\n ),\r\n ]\r\n default: {\r\n const named = NAMED_POLYGONS[kind]\r\n if (!named) return []\r\n return [\r\n polygonOutline(\r\n fillBox(regularVertices(named.sides, named.turn, 1, 1), width, height),\r\n options\r\n ),\r\n ]\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The same outline in the **unit box** a Path node stores — pixels divided by\r\n * the node's own size, so the geometry is a fraction of the box rather than a\r\n * count of pixels inside it.\r\n *\r\n * This is what a shape→path conversion writes. Dividing at the end rather than\r\n * computing in unit space throughout is what keeps a corner radius circular: a\r\n * 20px corner on a 400×200 node is 0.05 × 0.1 of the box, and only comes back\r\n * out round because the renderer multiplies by the same two numbers.\r\n */\r\nexport function shapeOutline(\r\n kind: ShapeOutlineKind,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const { width, height } = options\r\n const pixels = shapeOutlinePixels(kind, options)\r\n if (!(width > 0) || !(height > 0)) return pixels\r\n return pathOps.map(pixels, (p) => ({ x: p.x / width, y: p.y / height }))\r\n}\r\n\r\n/** Whether this module knows how to draw a type — i.e. whether it can be edited as a path. */\r\nexport function hasShapeOutline(kind: string): kind is ShapeOutlineKind {\r\n return OUTLINE_KINDS.has(kind)\r\n}\r\n\r\nconst OUTLINE_KINDS: ReadonlySet<string> = new Set<ShapeOutlineKind>([\r\n \"rect\",\r\n \"ellipse\",\r\n \"polygon\",\r\n \"polygram\",\r\n \"triangle\",\r\n \"rightTriangle\",\r\n \"pentagon\",\r\n \"hexagon\",\r\n \"octagon\",\r\n \"star\",\r\n])\r\n\r\n// ── Building blocks ────────────────────────────────────────────────────────\r\n\r\nfunction corner(point: Vector2): PathAnchor {\r\n return { point, inHandle: null, outHandle: null }\r\n}\r\n\r\nfunction sidesOf(options: ShapeOutlineOptions, fallback: number): number {\r\n return Math.max(3, Math.round(options.sides ?? fallback))\r\n}\r\n\r\nfunction clamp01(value: number): number {\r\n return Math.max(0, Math.min(1, value))\r\n}\r\n\r\n\r\n/**\r\n * The vertices of a regular n-gon on the ellipse `rx` × `ry`, starting at the\r\n * top and stepping clockwise — the same order and the same first vertex\r\n * The engine's own `polygonVertices` uses, so a converted `polygon` keeps its\r\n * points in the order the author has been looking at.\r\n *\r\n * `turn` rotates the whole figure; see {@link NAMED_POLYGONS}.\r\n */\r\nfunction regularVertices(\r\n sides: number,\r\n turn: number,\r\n rx: number,\r\n ry: number\r\n): Vector2[] {\r\n const step = (2 * Math.PI) / sides\r\n const out: Vector2[] = []\r\n for (let i = 0; i < sides; i++) {\r\n // −π/2 is straight up in y-down coordinates.\r\n const a = -Math.PI / 2 + turn + i * step\r\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) })\r\n }\r\n return out\r\n}\r\n\r\n/** Outer and inner vertices alternating — a star with `points` points. */\r\nfunction starVertices(\r\n points: number,\r\n ratio: number,\r\n rx: number,\r\n ry: number\r\n): Vector2[] {\r\n const step = Math.PI / points\r\n const out: Vector2[] = []\r\n for (let i = 0; i < points * 2; i++) {\r\n const a = -Math.PI / 2 + i * step\r\n const k = i % 2 === 0 ? 1 : ratio\r\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) })\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * Stretches a vertex ring so its bounding box *is* the node's box.\r\n *\r\n * The one line that separates a shape from its parametric sibling. Everything\r\n * before it is the inscribed figure; this maps that figure's own extent onto the\r\n * box, so the flat base of a triangle lands on the bottom edge and a pentagon's\r\n * two lower vertices land on the left and right ones.\r\n *\r\n * A ring with no extent on an axis (which no shape here produces, but a\r\n * `sides: 3` star with ratio 0 comes close) keeps that axis rather than dividing\r\n * by zero.\r\n */\r\nfunction fillBox(points: Vector2[], width: number, height: number): Vector2[] {\r\n if (points.length === 0) return points\r\n let minX = Infinity\r\n let minY = Infinity\r\n let maxX = -Infinity\r\n let maxY = -Infinity\r\n for (const p of points) {\r\n if (p.x < minX) minX = p.x\r\n if (p.x > maxX) maxX = p.x\r\n if (p.y < minY) minY = p.y\r\n if (p.y > maxY) maxY = p.y\r\n }\r\n const spanX = maxX - minX\r\n const spanY = maxY - minY\r\n const kx = spanX > 1e-9 ? width / spanX : 1\r\n const ky = spanY > 1e-9 ? height / spanY : 1\r\n const cx = (minX + maxX) / 2\r\n const cy = (minY + maxY) / 2\r\n return points.map((p) => ({ x: (p.x - cx) * kx, y: (p.y - cy) * ky }))\r\n}\r\n\r\n// ── Corners ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The cubic control-point offset that approximates a circular arc, as a\r\n * fraction of the distance from the tangent point to the corner.\r\n *\r\n * `k = (4/3)·tan(φ/4) / tan(φ/2)`, where φ is the arc's central angle. The\r\n * familiar 0.5523 is this at φ = 90°; a shallow corner needs less and a sharp\r\n * one needs more, which is why the constant can't simply be hard-coded — a\r\n * five-pointed star's inner vertices turn through nearly 180°, where 0.5523\r\n * would visibly flatten the curve.\r\n */\r\nfunction arcHandleRatio(sweep: number): number {\r\n const half = sweep / 2\r\n if (Math.abs(half) < 1e-6) return 0\r\n return ((4 / 3) * Math.tan(sweep / 4)) / Math.tan(half)\r\n}\r\n\r\n/**\r\n * A closed ring of vertices as a subpath, with each corner rounded or chamfered\r\n * by `cornerRadius`.\r\n *\r\n * The radius is clamped per corner to half of each adjacent edge, so a large\r\n * radius on a small shape rounds it as far as it can go instead of turning the\r\n * outline inside out. A radius of zero (or a `cornerStyle` of neither kind)\r\n * returns the plain polygon, which is the common case and costs nothing.\r\n */\r\nfunction polygonOutline(\r\n points: Vector2[],\r\n options: ShapeOutlineOptions\r\n): PathSubpath {\r\n const radius = uniformRadius(options.cornerRadius)\r\n if (points.length < 3 || radius <= 0) {\r\n return { anchors: points.map(corner), closed: true }\r\n }\r\n const style = options.cornerStyle ?? \"rounded\"\r\n\r\n const anchors: PathAnchor[] = []\r\n for (let i = 0; i < points.length; i++) {\r\n const c = points[i]\r\n const prev = points[(i - 1 + points.length) % points.length]\r\n const next = points[(i + 1) % points.length]\r\n\r\n const toPrev = direction(c, prev)\r\n const toNext = direction(c, next)\r\n if (!toPrev || !toNext) {\r\n anchors.push(corner(c))\r\n continue\r\n }\r\n\r\n // The interior angle at this vertex, and the arc that replaces it.\r\n const cosine = Math.max(-1, Math.min(1, toPrev.x * toNext.x + toPrev.y * toNext.y))\r\n const interior = Math.acos(cosine)\r\n // A vertex where the two edges double back on themselves has no corner to\r\n // round; leaving it sharp is the only honest answer.\r\n if (interior < 1e-6 || Math.PI - interior < 1e-6) {\r\n anchors.push(corner(c))\r\n continue\r\n }\r\n\r\n // How far back along each edge the arc starts. Never more than half the\r\n // edge, so two adjacent corners can't overlap.\r\n const tangent = Math.min(\r\n radius / Math.tan(interior / 2),\r\n distance(c, prev) / 2,\r\n distance(c, next) / 2\r\n )\r\n const a = { x: c.x + toPrev.x * tangent, y: c.y + toPrev.y * tangent }\r\n const b = { x: c.x + toNext.x * tangent, y: c.y + toNext.y * tangent }\r\n\r\n if (style === \"angled\") {\r\n // A chamfer: the same two tangent points, joined by a straight line.\r\n anchors.push(corner(a), corner(b))\r\n continue\r\n }\r\n\r\n const k = arcHandleRatio(Math.PI - interior)\r\n anchors.push(\r\n { point: a, inHandle: null, outHandle: { x: a.x + (c.x - a.x) * k, y: a.y + (c.y - a.y) * k } },\r\n { point: b, inHandle: { x: b.x + (c.x - b.x) * k, y: b.y + (c.y - b.y) * k }, outHandle: null }\r\n )\r\n }\r\n return { anchors, closed: true }\r\n}\r\n\r\n/** The unit vector from `from` towards `to`, or null when they coincide. */\r\nfunction direction(from: Vector2, to: Vector2): Vector2 | null {\r\n const dx = to.x - from.x\r\n const dy = to.y - from.y\r\n const len = Math.hypot(dx, dy)\r\n if (len < 1e-9) return null\r\n return { x: dx / len, y: dy / len }\r\n}\r\n\r\n\r\n/**\r\n * A single radius from whichever shape the value arrived in.\r\n *\r\n * A per-corner value only means anything on a rect, which builds its outline\r\n * corner by corner below; every other shape takes the smallest of the four, so\r\n * converting a rect with mixed corners into a polygon can't silently invent a\r\n * radius bigger than any the author set.\r\n */\r\nfunction uniformRadius(value: number | CornerRadiusResolved | undefined): number {\r\n if (value === undefined) return 0\r\n if (typeof value === \"number\") return Math.max(0, value)\r\n return Math.max(\r\n 0,\r\n Math.min(value.topLeft, value.topRight, value.bottomLeft, value.bottomRight)\r\n )\r\n}\r\n\r\n// ── Rect ───────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * A rectangle, with each corner carrying its own radius.\r\n *\r\n * Written out rather than routed through {@link polygonOutline} because a rect\r\n * is the one shape whose corners are *individually* set, and because its right\r\n * angles make the arc exact: the tangent length equals the radius and the handle\r\n * ratio is the familiar 0.5523, with no trigonometry involved.\r\n */\r\nfunction rectOutline(\r\n width: number,\r\n height: number,\r\n options: ShapeOutlineOptions\r\n): PathSubpath {\r\n const radii = perCornerRadii(options.cornerRadius, width, height)\r\n const style = options.cornerStyle ?? \"rounded\"\r\n const x = width / 2\r\n const y = height / 2\r\n const k = arcHandleRatio(Math.PI / 2)\r\n\r\n const anchors: PathAnchor[] = []\r\n /**\r\n * One corner, walking clockwise from the top-left: `at` is the sharp corner,\r\n * `from`/`to` the directions the outline arrives and leaves along.\r\n */\r\n const push = (\r\n at: Vector2,\r\n incoming: Vector2,\r\n outgoing: Vector2,\r\n r: number\r\n ) => {\r\n if (r <= 0) {\r\n anchors.push(corner(at))\r\n return\r\n }\r\n const a = { x: at.x - incoming.x * r, y: at.y - incoming.y * r }\r\n const b = { x: at.x + outgoing.x * r, y: at.y + outgoing.y * r }\r\n if (style === \"angled\") {\r\n anchors.push(corner(a), corner(b))\r\n return\r\n }\r\n anchors.push(\r\n { point: a, inHandle: null, outHandle: { x: a.x + (at.x - a.x) * k, y: a.y + (at.y - a.y) * k } },\r\n { point: b, inHandle: { x: b.x + (at.x - b.x) * k, y: b.y + (at.y - b.y) * k }, outHandle: null }\r\n )\r\n }\r\n\r\n const right = { x: 1, y: 0 }\r\n const down = { x: 0, y: 1 }\r\n const left = { x: -1, y: 0 }\r\n const up = { x: 0, y: -1 }\r\n // Clockwise, and the *incoming* direction is the one the walk is travelling\r\n // when it reaches the corner — not the edge it is about to leave along. The\r\n // loop closes back into the top-left from the bottom-left, so it arrives there\r\n // heading **up**; `down` put that corner's first anchor a radius *above* the\r\n // rectangle and drew the arc back into the box, which is the reversed top-left\r\n // corner you get on any rounded rect converted to a path.\r\n push({ x: -x, y: -y }, up, right, radii.topLeft)\r\n push({ x, y: -y }, right, down, radii.topRight)\r\n push({ x, y }, down, left, radii.bottomRight)\r\n push({ x: -x, y }, left, up, radii.bottomLeft)\r\n return { anchors, closed: true }\r\n}\r\n\r\n/** The four radii, clamped so opposite corners on an edge can't overlap. */\r\nfunction perCornerRadii(\r\n value: number | CornerRadiusResolved | undefined,\r\n width: number,\r\n height: number\r\n): CornerRadiusResolved {\r\n const raw: CornerRadiusResolved =\r\n value === undefined\r\n ? { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }\r\n : typeof value === \"number\"\r\n ? {\r\n topLeft: value,\r\n topRight: value,\r\n bottomLeft: value,\r\n bottomRight: value,\r\n }\r\n : value\r\n const cap = Math.min(width, height) / 2\r\n return {\r\n topLeft: Math.max(0, Math.min(raw.topLeft, cap)),\r\n topRight: Math.max(0, Math.min(raw.topRight, cap)),\r\n bottomLeft: Math.max(0, Math.min(raw.bottomLeft, cap)),\r\n bottomRight: Math.max(0, Math.min(raw.bottomRight, cap)),\r\n }\r\n}\r\n\r\n// ── Ellipse ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The ellipse family: a full oval, an arc (`sweep` under 360°), a ring\r\n * (`ratio` above 0), and the wedge the two make together.\r\n *\r\n * The arc is emitted as cubics rather than as an SVG `A` command, and that is\r\n * the whole reason this is worth writing out. A Path node's geometry is stored\r\n * as a fraction of its box and multiplied back by the box's *two* dimensions —\r\n * so an arc, whose parameters describe a circle rather than a set of points,\r\n * would come out of a non-uniform resize as a different curve rather than a\r\n * stretched one. Cubics survive that transform exactly.\r\n */\r\nfunction ellipseOutline(\r\n width: number,\r\n height: number,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const rx = width / 2\r\n const ry = height / 2\r\n const inner = clamp01(options.ratio ?? 0)\r\n const sweep = Math.max(0, Math.min(360, options.sweep ?? 360))\r\n if (sweep <= 0) return []\r\n\r\n // A full oval with no hole is the common case: one closed ring.\r\n const full = sweep >= 360\r\n // Degrees clockwise from twelve o'clock, matching the appearance schema's\r\n // `startAngle` — which is measured the way a clock face is, not the way\r\n // `Math.atan2` is.\r\n const from = ((options.startAngle ?? 0) - 90) * (Math.PI / 180)\r\n const to = from + sweep * (Math.PI / 180)\r\n\r\n if (full && inner <= 0) {\r\n return [{ anchors: arcAnchors(rx, ry, from, to, true), closed: true }]\r\n }\r\n if (full) {\r\n // A ring: two closed rings, the inner one wound the other way so the\r\n // even-odd fill leaves a hole.\r\n return [\r\n { anchors: arcAnchors(rx, ry, from, to, true), closed: true },\r\n { anchors: arcAnchors(rx * inner, ry * inner, to, from, true), closed: true },\r\n ]\r\n }\r\n\r\n // An arc, closed back on itself: out along the outer edge, back along the\r\n // inner one (or through the centre, when there is no hole).\r\n const outer = arcAnchors(rx, ry, from, to, false)\r\n const back =\r\n inner > 0\r\n ? arcAnchors(rx * inner, ry * inner, to, from, false)\r\n : [corner({ x: 0, y: 0 })]\r\n return [{ anchors: [...outer, ...back], closed: true }]\r\n}\r\n\r\n/**\r\n * An elliptical arc as a run of anchors, split into segments of at most 90° —\r\n * the span a single cubic approximates to within a fraction of a pixel.\r\n *\r\n * `whole` drops the duplicated final anchor, for the case where the arc closes\r\n * back on its own start.\r\n */\r\nfunction arcAnchors(\r\n rx: number,\r\n ry: number,\r\n from: number,\r\n to: number,\r\n whole: boolean\r\n): PathAnchor[] {\r\n const total = to - from\r\n const steps = Math.max(1, Math.ceil(Math.abs(total) / (Math.PI / 2)))\r\n const step = total / steps\r\n // The classic elliptical-arc approximation: each control point sits α along\r\n // the curve's own tangent, with α = (4/3)·tan(Δ/4) for a segment spanning Δ.\r\n // Signed with the step, so a clockwise arc bulges the right way.\r\n const alpha = (4 / 3) * Math.tan(step / 4)\r\n\r\n const anchors: PathAnchor[] = []\r\n for (let i = 0; i <= steps; i++) {\r\n const a = from + step * i\r\n const point = { x: rx * Math.cos(a), y: ry * Math.sin(a) }\r\n // d/da of the point — the arc's tangent at this angle.\r\n const tangent = { x: -rx * Math.sin(a), y: ry * Math.cos(a) }\r\n const offset = { x: tangent.x * alpha, y: tangent.y * alpha }\r\n anchors.push({\r\n point,\r\n inHandle:\r\n i === 0 ? null : { x: point.x - offset.x, y: point.y - offset.y },\r\n outHandle:\r\n i === steps ? null : { x: point.x + offset.x, y: point.y + offset.y },\r\n })\r\n }\r\n\r\n if (whole && anchors.length > 1) {\r\n // The arc came back to where it started; fold the duplicate into the first\r\n // anchor so the ring has one anchor per corner rather than two stacked.\r\n const last = anchors.pop()!\r\n anchors[0].inHandle = last.inHandle\r\n }\r\n return anchors\r\n}\r\n"]}
1
+ {"version":3,"file":"shape-outline.js","sourceRoot":"","sources":["../../../../src/components/builtins/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAoCrD;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAoD;IACtE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IAC/B,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,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,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAG,CAAA;QAC3B,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IACrC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * The silhouette of every shape type, as a {@link VectorPath}.\n *\n * One module, two callers with the same question asked at different scales:\n *\n * - The **shape node classes** (`nodes/shapes`) draw their outline every frame\n * from their laid-out box, so they ask in pixels.\n * - The **path editor** converts a shape into an editable Path node the moment\n * somebody moves one of its points, so it asks in the unit box the Path node\n * stores its geometry in (see `./vector-path`).\n *\n * Sharing the definition is what makes that conversion invisible: a triangle\n * that becomes a path is the *same* triangle, down to the rounding on its\n * corners, rather than a fresh approximation of one.\n *\n * ## Why these shapes exist at all\n *\n * The engine's `Polygon` inscribes its n-gon in the node's box — the vertices\n * sit on the box's inscribed ellipse — which is what makes a `sides` tween\n * smooth: every vertex count is the same circle sampled differently, so a\n * triangle morphing into a square doesn't lurch. The cost is that a triangle\n * *doesn't touch the bottom of its own bounds*, because the two base vertices\n * sit at 30° below the horizontal rather than on the ellipse's lowest point.\n * Figma's polygon does exactly the same thing for exactly the same reason.\n *\n * That is right for a shape you intend to animate and wrong for a shape you\n * intend to *be a triangle*. So the parametric `polygon`/`polygram` keep the\n * inscribed geometry, and the named shapes here are stretched to fill their box\n * — the vertices are computed on the circle exactly as before, then their\n * bounding box is mapped onto the node's. Same silhouette, no gap.\n *\n * Everything here works in **y-down** coordinates, the convention the stored\n * `d` string uses. The node classes flip once on the way to the renderer, whose\n * local space is y-up.\n */\n\nimport type { CornerRadiusResolved } from \"@/attributes/shape/corners/corner-radius\";\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { distance } from \"@/attributes/shape/path/bezier\"\nimport { pathOps } from \"@/attributes/shape/path/ops\"\nimport type { PathAnchor, PathSubpath, VectorPath } from \"@/attributes/shape/path/types\";\n\n/** The shape types this module can draw an outline for. */\nexport type ShapeOutlineKind =\n | \"rect\"\n | \"ellipse\"\n | \"polygon\"\n | \"polygram\"\n | \"triangle\"\n | \"rightTriangle\"\n | \"pentagon\"\n | \"hexagon\"\n | \"octagon\"\n | \"star\"\n\n/** Everything an outline can depend on. Unstated fields take the schema's default. */\nexport interface ShapeOutlineOptions {\n /** The node's box, in pixels. */\n width: number\n height: number\n /** Vertex/corner rounding, in pixels. Ignored by the shapes that have no corners. */\n cornerRadius?: number | CornerRadiusResolved\n cornerStyle?: CornerStyle\n /** Vertex count — `polygon`/`polygram`'s `sides`, `star`'s number of points. */\n sides?: number\n /**\n * The inner radius as a fraction of the outer one: a polygram's or star's\n * point depth, and an ellipse's donut hole.\n */\n ratio?: number\n /** The ellipse's arc, in degrees. */\n startAngle?: number\n sweep?: number\n}\n\n/**\n * The named shapes' vertex counts and how far they're turned from \"a vertex at\n * the top\".\n *\n * Pointy-top is the regular polygon's natural orientation and the one every icon\n * set draws a pentagon and a hexagon in. The octagon is the exception, and it is\n * not a matter of taste: an octagon with a vertex at the top reads as a rotated\n * stop sign, because a stop sign is the only octagon most people have ever\n * looked at and it has a flat top. Half a step turns it into that one.\n */\nconst NAMED_POLYGONS: Record<string, { sides: number; turn: number }> = {\n pentagon: { sides: 5, turn: 0 },\n hexagon: { sides: 6, turn: 0 },\n octagon: { sides: 8, turn: Math.PI / 8 },\n}\n\n/**\n * A star's default point depth: the classic five-pointed star, where the inner\n * vertices sit where the extended edges of a pentagram cross.\n *\n * Not the polygram node's 50%, and deliberately so. The parametric polygram\n * opens at a round number because it is a *control* you are expected to move;\n * this node exists for the person who wanted a star and got a geometry lesson,\n * so it opens on the star they were picturing.\n */\nexport const STAR_DEFAULT_RATIO = 0.382\n\n/** The default number of points on a Star node. */\nexport const STAR_DEFAULT_POINTS = 5\n\n/**\n * The shape's outline in **pixel** space: centred on the origin, spanning\n * `width` × `height`, y-down.\n *\n * Returns an empty path for a degenerate box, which draws nothing rather than\n * producing NaN coordinates the renderer would have to cope with.\n */\nexport function shapeOutlinePixels(\n kind: ShapeOutlineKind,\n options: ShapeOutlineOptions\n): VectorPath {\n const { width, height } = options\n if (!(width > 0) || !(height > 0)) return []\n\n switch (kind) {\n case \"rect\":\n return [rectOutline(width, height, options)]\n case \"ellipse\":\n return ellipseOutline(width, height, options)\n case \"triangle\":\n return [\n polygonOutline(\n [\n { x: 0, y: -height / 2 },\n { x: width / 2, y: height / 2 },\n { x: -width / 2, y: height / 2 },\n ],\n options\n ),\n ]\n case \"rightTriangle\":\n return [\n polygonOutline(\n [\n { x: -width / 2, y: -height / 2 },\n { x: width / 2, y: height / 2 },\n { x: -width / 2, y: height / 2 },\n ],\n options\n ),\n ]\n case \"polygon\":\n // The parametric one: inscribed, *not* stretched — see the module note.\n return [\n polygonOutline(\n regularVertices(sidesOf(options, 5), 0, width / 2, height / 2),\n options\n ),\n ]\n case \"polygram\":\n return [\n polygonOutline(\n starVertices(\n sidesOf(options, 5),\n clamp01(options.ratio ?? 0.5),\n width / 2,\n height / 2\n ),\n options\n ),\n ]\n case \"star\":\n return [\n polygonOutline(\n fillBox(\n starVertices(\n sidesOf(options, STAR_DEFAULT_POINTS),\n clamp01(options.ratio ?? STAR_DEFAULT_RATIO),\n 1,\n 1\n ),\n width,\n height\n ),\n options\n ),\n ]\n default: {\n const named = NAMED_POLYGONS[kind]\n if (!named) return []\n return [\n polygonOutline(\n fillBox(regularVertices(named.sides, named.turn, 1, 1), width, height),\n options\n ),\n ]\n }\n }\n}\n\n/**\n * The same outline in the **unit box** a Path node stores — pixels divided by\n * the node's own size, so the geometry is a fraction of the box rather than a\n * count of pixels inside it.\n *\n * This is what a shape→path conversion writes. Dividing at the end rather than\n * computing in unit space throughout is what keeps a corner radius circular: a\n * 20px corner on a 400×200 node is 0.05 × 0.1 of the box, and only comes back\n * out round because the renderer multiplies by the same two numbers.\n */\nexport function shapeOutline(\n kind: ShapeOutlineKind,\n options: ShapeOutlineOptions\n): VectorPath {\n const { width, height } = options\n const pixels = shapeOutlinePixels(kind, options)\n if (!(width > 0) || !(height > 0)) return pixels\n return pathOps.map(pixels, (p) => ({ x: p.x / width, y: p.y / height }))\n}\n\n/** Whether this module knows how to draw a type — i.e. whether it can be edited as a path. */\nexport function hasShapeOutline(kind: string): kind is ShapeOutlineKind {\n return OUTLINE_KINDS.has(kind)\n}\n\nconst OUTLINE_KINDS: ReadonlySet<string> = new Set<ShapeOutlineKind>([\n \"rect\",\n \"ellipse\",\n \"polygon\",\n \"polygram\",\n \"triangle\",\n \"rightTriangle\",\n \"pentagon\",\n \"hexagon\",\n \"octagon\",\n \"star\",\n])\n\n// ── Building blocks ────────────────────────────────────────────────────────\n\nfunction corner(point: Vector2): PathAnchor {\n return { point, inHandle: null, outHandle: null }\n}\n\nfunction sidesOf(options: ShapeOutlineOptions, fallback: number): number {\n return Math.max(3, Math.round(options.sides ?? fallback))\n}\n\nfunction clamp01(value: number): number {\n return Math.max(0, Math.min(1, value))\n}\n\n\n/**\n * The vertices of a regular n-gon on the ellipse `rx` × `ry`, starting at the\n * top and stepping clockwise — the same order and the same first vertex\n * The engine's own `polygonVertices` uses, so a converted `polygon` keeps its\n * points in the order the author has been looking at.\n *\n * `turn` rotates the whole figure; see {@link NAMED_POLYGONS}.\n */\nfunction regularVertices(\n sides: number,\n turn: number,\n rx: number,\n ry: number\n): Vector2[] {\n const step = (2 * Math.PI) / sides\n const out: Vector2[] = []\n for (let i = 0; i < sides; i++) {\n // −π/2 is straight up in y-down coordinates.\n const a = -Math.PI / 2 + turn + i * step\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) })\n }\n return out\n}\n\n/** Outer and inner vertices alternating — a star with `points` points. */\nfunction starVertices(\n points: number,\n ratio: number,\n rx: number,\n ry: number\n): Vector2[] {\n const step = Math.PI / points\n const out: Vector2[] = []\n for (let i = 0; i < points * 2; i++) {\n const a = -Math.PI / 2 + i * step\n const k = i % 2 === 0 ? 1 : ratio\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) })\n }\n return out\n}\n\n/**\n * Stretches a vertex ring so its bounding box *is* the node's box.\n *\n * The one line that separates a shape from its parametric sibling. Everything\n * before it is the inscribed figure; this maps that figure's own extent onto the\n * box, so the flat base of a triangle lands on the bottom edge and a pentagon's\n * two lower vertices land on the left and right ones.\n *\n * A ring with no extent on an axis (which no shape here produces, but a\n * `sides: 3` star with ratio 0 comes close) keeps that axis rather than dividing\n * by zero.\n */\nfunction fillBox(points: Vector2[], width: number, height: number): Vector2[] {\n if (points.length === 0) return points\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n for (const p of points) {\n if (p.x < minX) minX = p.x\n if (p.x > maxX) maxX = p.x\n if (p.y < minY) minY = p.y\n if (p.y > maxY) maxY = p.y\n }\n const spanX = maxX - minX\n const spanY = maxY - minY\n const kx = spanX > 1e-9 ? width / spanX : 1\n const ky = spanY > 1e-9 ? height / spanY : 1\n const cx = (minX + maxX) / 2\n const cy = (minY + maxY) / 2\n return points.map((p) => ({ x: (p.x - cx) * kx, y: (p.y - cy) * ky }))\n}\n\n// ── Corners ────────────────────────────────────────────────────────────────\n\n/**\n * The cubic control-point offset that approximates a circular arc, as a\n * fraction of the distance from the tangent point to the corner.\n *\n * `k = (4/3)·tan(φ/4) / tan(φ/2)`, where φ is the arc's central angle. The\n * familiar 0.5523 is this at φ = 90°; a shallow corner needs less and a sharp\n * one needs more, which is why the constant can't simply be hard-coded — a\n * five-pointed star's inner vertices turn through nearly 180°, where 0.5523\n * would visibly flatten the curve.\n */\nfunction arcHandleRatio(sweep: number): number {\n const half = sweep / 2\n if (Math.abs(half) < 1e-6) return 0\n return ((4 / 3) * Math.tan(sweep / 4)) / Math.tan(half)\n}\n\n/**\n * A closed ring of vertices as a subpath, with each corner rounded or chamfered\n * by `cornerRadius`.\n *\n * The radius is clamped per corner to half of each adjacent edge, so a large\n * radius on a small shape rounds it as far as it can go instead of turning the\n * outline inside out. A radius of zero (or a `cornerStyle` of neither kind)\n * returns the plain polygon, which is the common case and costs nothing.\n */\nfunction polygonOutline(\n points: Vector2[],\n options: ShapeOutlineOptions\n): PathSubpath {\n const radius = uniformRadius(options.cornerRadius)\n if (points.length < 3 || radius <= 0) {\n return { anchors: points.map(corner), closed: true }\n }\n const style = options.cornerStyle ?? \"rounded\"\n\n const anchors: PathAnchor[] = []\n for (let i = 0; i < points.length; i++) {\n const c = points[i]\n const prev = points[(i - 1 + points.length) % points.length]\n const next = points[(i + 1) % points.length]\n\n const toPrev = direction(c, prev)\n const toNext = direction(c, next)\n if (!toPrev || !toNext) {\n anchors.push(corner(c))\n continue\n }\n\n // The interior angle at this vertex, and the arc that replaces it.\n const cosine = Math.max(-1, Math.min(1, toPrev.x * toNext.x + toPrev.y * toNext.y))\n const interior = Math.acos(cosine)\n // A vertex where the two edges double back on themselves has no corner to\n // round; leaving it sharp is the only honest answer.\n if (interior < 1e-6 || Math.PI - interior < 1e-6) {\n anchors.push(corner(c))\n continue\n }\n\n // How far back along each edge the arc starts. Never more than half the\n // edge, so two adjacent corners can't overlap.\n const tangent = Math.min(\n radius / Math.tan(interior / 2),\n distance(c, prev) / 2,\n distance(c, next) / 2\n )\n const a = { x: c.x + toPrev.x * tangent, y: c.y + toPrev.y * tangent }\n const b = { x: c.x + toNext.x * tangent, y: c.y + toNext.y * tangent }\n\n if (style === \"angled\") {\n // A chamfer: the same two tangent points, joined by a straight line.\n anchors.push(corner(a), corner(b))\n continue\n }\n\n const k = arcHandleRatio(Math.PI - interior)\n anchors.push(\n { point: a, inHandle: null, outHandle: { x: a.x + (c.x - a.x) * k, y: a.y + (c.y - a.y) * k } },\n { point: b, inHandle: { x: b.x + (c.x - b.x) * k, y: b.y + (c.y - b.y) * k }, outHandle: null }\n )\n }\n return { anchors, closed: true }\n}\n\n/** The unit vector from `from` towards `to`, or null when they coincide. */\nfunction direction(from: Vector2, to: Vector2): Vector2 | null {\n const dx = to.x - from.x\n const dy = to.y - from.y\n const len = Math.hypot(dx, dy)\n if (len < 1e-9) return null\n return { x: dx / len, y: dy / len }\n}\n\n\n/**\n * A single radius from whichever shape the value arrived in.\n *\n * A per-corner value only means anything on a rect, which builds its outline\n * corner by corner below; every other shape takes the smallest of the four, so\n * converting a rect with mixed corners into a polygon can't silently invent a\n * radius bigger than any the author set.\n */\nfunction uniformRadius(value: number | CornerRadiusResolved | undefined): number {\n if (value === undefined) return 0\n if (typeof value === \"number\") return Math.max(0, value)\n return Math.max(\n 0,\n Math.min(value.topLeft, value.topRight, value.bottomLeft, value.bottomRight)\n )\n}\n\n// ── Rect ───────────────────────────────────────────────────────────────────\n\n/**\n * A rectangle, with each corner carrying its own radius.\n *\n * Written out rather than routed through {@link polygonOutline} because a rect\n * is the one shape whose corners are *individually* set, and because its right\n * angles make the arc exact: the tangent length equals the radius and the handle\n * ratio is the familiar 0.5523, with no trigonometry involved.\n */\nfunction rectOutline(\n width: number,\n height: number,\n options: ShapeOutlineOptions\n): PathSubpath {\n const radii = perCornerRadii(options.cornerRadius, width, height)\n const style = options.cornerStyle ?? \"rounded\"\n const x = width / 2\n const y = height / 2\n const k = arcHandleRatio(Math.PI / 2)\n\n const anchors: PathAnchor[] = []\n /**\n * One corner, walking clockwise from the top-left: `at` is the sharp corner,\n * `from`/`to` the directions the outline arrives and leaves along.\n */\n const push = (\n at: Vector2,\n incoming: Vector2,\n outgoing: Vector2,\n r: number\n ) => {\n if (r <= 0) {\n anchors.push(corner(at))\n return\n }\n const a = { x: at.x - incoming.x * r, y: at.y - incoming.y * r }\n const b = { x: at.x + outgoing.x * r, y: at.y + outgoing.y * r }\n if (style === \"angled\") {\n anchors.push(corner(a), corner(b))\n return\n }\n anchors.push(\n { point: a, inHandle: null, outHandle: { x: a.x + (at.x - a.x) * k, y: a.y + (at.y - a.y) * k } },\n { point: b, inHandle: { x: b.x + (at.x - b.x) * k, y: b.y + (at.y - b.y) * k }, outHandle: null }\n )\n }\n\n const right = { x: 1, y: 0 }\n const down = { x: 0, y: 1 }\n const left = { x: -1, y: 0 }\n const up = { x: 0, y: -1 }\n // Clockwise, and the *incoming* direction is the one the walk is travelling\n // when it reaches the corner — not the edge it is about to leave along. The\n // loop closes back into the top-left from the bottom-left, so it arrives there\n // heading **up**; `down` put that corner's first anchor a radius *above* the\n // rectangle and drew the arc back into the box, which is the reversed top-left\n // corner you get on any rounded rect converted to a path.\n push({ x: -x, y: -y }, up, right, radii.topLeft)\n push({ x, y: -y }, right, down, radii.topRight)\n push({ x, y }, down, left, radii.bottomRight)\n push({ x: -x, y }, left, up, radii.bottomLeft)\n return { anchors, closed: true }\n}\n\n/** The four radii, clamped so opposite corners on an edge can't overlap. */\nfunction perCornerRadii(\n value: number | CornerRadiusResolved | undefined,\n width: number,\n height: number\n): CornerRadiusResolved {\n const raw: CornerRadiusResolved =\n value === undefined\n ? { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }\n : typeof value === \"number\"\n ? {\n topLeft: value,\n topRight: value,\n bottomLeft: value,\n bottomRight: value,\n }\n : value\n const cap = Math.min(width, height) / 2\n return {\n topLeft: Math.max(0, Math.min(raw.topLeft, cap)),\n topRight: Math.max(0, Math.min(raw.topRight, cap)),\n bottomLeft: Math.max(0, Math.min(raw.bottomLeft, cap)),\n bottomRight: Math.max(0, Math.min(raw.bottomRight, cap)),\n }\n}\n\n// ── Ellipse ────────────────────────────────────────────────────────────────\n\n/**\n * The ellipse family: a full oval, an arc (`sweep` under 360°), a ring\n * (`ratio` above 0), and the wedge the two make together.\n *\n * The arc is emitted as cubics rather than as an SVG `A` command, and that is\n * the whole reason this is worth writing out. A Path node's geometry is stored\n * as a fraction of its box and multiplied back by the box's *two* dimensions —\n * so an arc, whose parameters describe a circle rather than a set of points,\n * would come out of a non-uniform resize as a different curve rather than a\n * stretched one. Cubics survive that transform exactly.\n */\nfunction ellipseOutline(\n width: number,\n height: number,\n options: ShapeOutlineOptions\n): VectorPath {\n const rx = width / 2\n const ry = height / 2\n const inner = clamp01(options.ratio ?? 0)\n const sweep = Math.max(0, Math.min(360, options.sweep ?? 360))\n if (sweep <= 0) return []\n\n // A full oval with no hole is the common case: one closed ring.\n const full = sweep >= 360\n // Degrees clockwise from twelve o'clock, matching the appearance schema's\n // `startAngle` — which is measured the way a clock face is, not the way\n // `Math.atan2` is.\n const from = ((options.startAngle ?? 0) - 90) * (Math.PI / 180)\n const to = from + sweep * (Math.PI / 180)\n\n if (full && inner <= 0) {\n return [{ anchors: arcAnchors(rx, ry, from, to, true), closed: true }]\n }\n if (full) {\n // A ring: two closed rings, the inner one wound the other way so the\n // even-odd fill leaves a hole.\n return [\n { anchors: arcAnchors(rx, ry, from, to, true), closed: true },\n { anchors: arcAnchors(rx * inner, ry * inner, to, from, true), closed: true },\n ]\n }\n\n // An arc, closed back on itself: out along the outer edge, back along the\n // inner one (or through the centre, when there is no hole).\n const outer = arcAnchors(rx, ry, from, to, false)\n const back =\n inner > 0\n ? arcAnchors(rx * inner, ry * inner, to, from, false)\n : [corner({ x: 0, y: 0 })]\n return [{ anchors: [...outer, ...back], closed: true }]\n}\n\n/**\n * An elliptical arc as a run of anchors, split into segments of at most 90° —\n * the span a single cubic approximates to within a fraction of a pixel.\n *\n * `whole` drops the duplicated final anchor, for the case where the arc closes\n * back on its own start.\n */\nfunction arcAnchors(\n rx: number,\n ry: number,\n from: number,\n to: number,\n whole: boolean\n): PathAnchor[] {\n const total = to - from\n const steps = Math.max(1, Math.ceil(Math.abs(total) / (Math.PI / 2)))\n const step = total / steps\n // The classic elliptical-arc approximation: each control point sits α along\n // the curve's own tangent, with α = (4/3)·tan(Δ/4) for a segment spanning Δ.\n // Signed with the step, so a clockwise arc bulges the right way.\n const alpha = (4 / 3) * Math.tan(step / 4)\n\n const anchors: PathAnchor[] = []\n for (let i = 0; i <= steps; i++) {\n const a = from + step * i\n const point = { x: rx * Math.cos(a), y: ry * Math.sin(a) }\n // d/da of the point — the arc's tangent at this angle.\n const tangent = { x: -rx * Math.sin(a), y: ry * Math.cos(a) }\n const offset = { x: tangent.x * alpha, y: tangent.y * alpha }\n anchors.push({\n point,\n inHandle:\n i === 0 ? null : { x: point.x - offset.x, y: point.y - offset.y },\n outHandle:\n i === steps ? null : { x: point.x + offset.x, y: point.y + offset.y },\n })\n }\n\n if (whole && anchors.length > 1) {\n // The arc came back to where it started; fold the duplicate into the first\n // anchor so the ring has one anchor per corner rather than two stacked.\n const last = anchors.pop()!\n anchors[0].inHandle = last.inHandle\n }\n return anchors\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/components/builtins/layout/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAOpD,kGAAkG;AAClG,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAC;IAC9B,GAAG,EAAE,QAAQ;IACb,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE;IACxE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE;IAChD,OAAO,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EA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,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC","sourcesContent":["import { lerpLookAt, type LookAt } from \"@/attributes/layout/space3d\";\r\nimport type { NodeOf } from \"@/components/factory/api\";\r\nimport { component2d } from \"@/components/factory/component2d\";\r\nimport { commandsFor } from \"@/components/factory/commands-for\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport * as Aim from \"@/components/modules/aim\";\r\nimport * as Corners from \"@/components/modules/corners\";\r\nimport * as Flow from \"@/components/modules/flow\";\r\nimport * as Paint from \"@/components/modules/paint\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport type { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport type { ShapeProps } from \"@/components/builtins/geometry/geometry\";\r\nimport type { Node2DProps } from \"@/components/trees/2d/node2d\";\r\n\r\n/** A framed viewport: painted like a rect, its children seen through a camera aimed inside it. */\r\nexport const Camera = component2d({\r\n key: \"camera\",\r\n state: { ...Paint.state, ...Flow.state, ...Aim.state, ...Corners.state },\r\n commands: { ...Paint.commands, ...Aim.commands },\r\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\r\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\r\n render: (ctx, state) => Paint.draw(ctx, state, Corners.rect(ctx.size, state), { children: () => Aim.camera(ctx, state) }),\r\n});\r\n\r\nconst orbit = {\r\n lookAt: Types.custom<LookAt>({ x: 0, y: 0 }, {\r\n lerp: lerpLookAt, kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } },\r\n }),\r\n zoom: Types.number(1, { min: 0.01, step: 0.1, unit: \"×\" }),\r\n heading: Types.number(0, { step: 1, unit: \"°\" }),\r\n orbit: Types.number(0, { step: 1, unit: \"°\" }),\r\n elevation: Types.number(0, { step: 1, unit: \"°\" }),\r\n dolly: Types.number(0, { step: 10 }),\r\n orbitSpeed: Types.number(0),\r\n};\r\n\r\n/** The stage's 2.5D camera for one subtree: its children stand in one space, orbited in depth. */\r\nexport const OrbitCamera = component2d({\r\n key: \"orbitCamera\",\r\n state: orbit,\r\n defaults: { width: \"hug\", height: \"hug\", perspective: 1000 },\r\n commands: commandsFor(orbit, {\r\n orbitTo: { args: [\"orbit\", \"elevation\"] },\r\n dollyTo: { args: [\"dolly\"] },\r\n zoomTo: { args: [\"zoom\"] },\r\n panTo: { args: [\"lookAt\"] },\r\n headingTo: { args: [\"heading\"] },\r\n }),\r\n render: (ctx, state) => ctx.space({\r\n perspective: state.perspective,\r\n orbit: state.orbit + state.orbitSpeed * ctx.time.total,\r\n elevation: state.elevation,\r\n dolly: state.dolly,\r\n lookAt: state.lookAt,\r\n zoom: state.zoom,\r\n heading: state.heading,\r\n viewportX: 0,\r\n viewportY: 0,\r\n }),\r\n});\r\n\r\n/** Its children laid out in a box turned by `angle`, and turned with it: the box it reports is the turned one's bounds. */\r\nexport const RotatedBox = component2d({\r\n key: \"rotated-box\",\r\n state: { angle: Types.number(-90) },\r\n defaults: { rotation: (state) => state.angle },\r\n measure: (measurer, state, children) => {\r\n const { cos, sin } = turn(state.angle);\r\n const { width: w, height: h } = measurer.max;\r\n const ortho = Math.abs(state.angle % 180) === 90;\r\n const room = w !== undefined && h !== undefined\r\n ? { width: w * cos + h * sin, height: w * sin + h * cos }\r\n : { width: ortho ? h : w, height: ortho ? w : h };\r\n let width = 0;\r\n let height = 0;\r\n for (const child of children) {\r\n const size = child.measure(room);\r\n width = Math.max(width, size.width);\r\n height = Math.max(height, size.height);\r\n }\r\n return { width: width * cos + height * sin, height: width * sin + height * cos };\r\n },\r\n layout: (box, state, children) => {\r\n const { cos, sin } = turn(state.angle);\r\n const turned = { x: 0, y: 0, width: box.width * cos + box.height * sin, height: box.width * sin + box.height * cos };\r\n return Flow.layout(turned, state as unknown as Flow.FlowState, children);\r\n },\r\n});\r\n\r\nfunction turn(angle: number): { cos: number; sin: number } {\r\n const rad = angle * (Math.PI / 180);\r\n return { cos: Math.abs(Math.cos(rad)), sin: Math.abs(Math.sin(rad)) };\r\n}\r\n\r\nexport type Camera = NodeOf<typeof Camera>;\r\nexport type OrbitCamera = NodeOf<typeof OrbitCamera>;\r\nexport type RotatedBox = NodeOf<typeof RotatedBox>;\r\n\r\n// What code building a camera or a rotated box names its props as.\r\n\r\nexport interface CameraProps extends ShapeProps {\r\n /** Magnification factor. Values > 1 zoom in; < 1 zoom out. */\r\n zoom: number;\r\n /**\r\n * World-space point that maps to the centre of the camera viewport — what\r\n * the camera is pointed at. Same name and meaning as\r\n * `Graphics3D.perspective({ lookAt })`, so a 2D and a 3D camera are aimed\r\n * with the same word.\r\n */\r\n lookAt: Vector2;\r\n /** Rotation of the camera view in degrees (clockwise). */\r\n heading: number;\r\n /**\r\n * A node of the camera's world to keep in view, by id: the camera is aimed\r\n * at its centre each frame, and {@link lookAt} becomes an offset from it.\r\n */\r\n follow: string;\r\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\r\n cornerRadius: RectCornerRadius;\r\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport interface OrbitCameraProps extends Node2DProps {\r\n /** The point the camera orbits and looks at; `z` puts it in depth, as a node's `depth` does. */\r\n lookAt: LookAt;\r\n /** Lens zoom, applied after the projection. Values > 1 zoom in. */\r\n zoom: number;\r\n /** Roll of the view in degrees, clockwise. */\r\n heading: number;\r\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera right. */\r\n orbit: number;\r\n /** Degrees above the layers. Positive looks down on them. */\r\n elevation: number;\r\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective. */\r\n dolly: number;\r\n /** Degrees per second the camera orbits on its own — a turntable. */\r\n orbitSpeed: number;\r\n}\r\n\r\n// Adjust this import path if needed\r\n\r\nexport interface RotatedBoxProps extends Node2DProps {\r\n /** \r\n * Visual rotation angle in degrees. Unlike standard `rotation`, \r\n * animating this ALSO dynamically calculates a new bounding box \r\n * for the flex/layout engine. \r\n */\r\n angle: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/components/builtins/layout/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAOpD,kGAAkG;AAClG,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAC;IAC9B,GAAG,EAAE,QAAQ;IACb,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE;IACxE,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE;IAChD,OAAO,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnG,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,QAA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G,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,KAAK,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC;IACrF,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACrH,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,KAAkC,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;CACJ,CAAC,CAAC;AAEH,SAAS,IAAI,CAAC,KAAa;IACvB,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC","sourcesContent":["import { lerpLookAt, type LookAt } from \"@/attributes/layout/space3d\";\nimport type { NodeOf } from \"@/components/factory/api\";\nimport { component2d } from \"@/components/factory/component2d\";\nimport { commandsFor } from \"@/components/factory/commands-for\";\nimport { Types } from \"@/components/factory/types\";\nimport * as Aim from \"@/components/modules/aim\";\nimport * as Corners from \"@/components/modules/corners\";\nimport * as Flow from \"@/components/modules/flow\";\nimport * as Paint from \"@/components/modules/paint\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport type { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport type { ShapeProps } from \"@/components/builtins/geometry/geometry\";\nimport type { Node2DProps } from \"@/components/trees/2d/node2d\";\n\n/** A framed viewport: painted like a rect, its children seen through a camera aimed inside it. */\nexport const Camera = component2d({\n key: \"camera\",\n state: { ...Paint.state, ...Flow.state, ...Aim.state, ...Corners.state },\n commands: { ...Paint.commands, ...Aim.commands },\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\n render: (ctx, state) => Paint.draw(ctx, state, Corners.rect(ctx.size, state), { children: () => Aim.camera(ctx, state) }),\n});\n\nconst orbit = {\n lookAt: Types.custom<LookAt>({ x: 0, y: 0 }, {\n lerp: lerpLookAt, kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } },\n }),\n zoom: Types.number(1, { min: 0.01, step: 0.1, unit: \"×\" }),\n heading: Types.number(0, { step: 1, unit: \"°\" }),\n orbit: Types.number(0, { step: 1, unit: \"°\" }),\n elevation: Types.number(0, { step: 1, unit: \"°\" }),\n dolly: Types.number(0, { step: 10 }),\n orbitSpeed: Types.number(0),\n};\n\n/** The stage's 2.5D camera for one subtree: its children stand in one space, orbited in depth. */\nexport const OrbitCamera = component2d({\n key: \"orbitCamera\",\n state: orbit,\n defaults: { width: \"hug\", height: \"hug\", perspective: 1000 },\n commands: commandsFor(orbit, {\n orbitTo: { args: [\"orbit\", \"elevation\"] },\n dollyTo: { args: [\"dolly\"] },\n zoomTo: { args: [\"zoom\"] },\n panTo: { args: [\"lookAt\"] },\n headingTo: { args: [\"heading\"] },\n }),\n render: (ctx, state) => ctx.space({\n perspective: state.perspective,\n orbit: state.orbit + state.orbitSpeed * ctx.time.total,\n elevation: state.elevation,\n dolly: state.dolly,\n lookAt: state.lookAt,\n zoom: state.zoom,\n heading: state.heading,\n viewportX: 0,\n viewportY: 0,\n }),\n});\n\n/** Its children laid out in a box turned by `angle`, and turned with it: the box it reports is the turned one's bounds. */\nexport const RotatedBox = component2d({\n key: \"rotated-box\",\n state: { angle: Types.number(-90) },\n defaults: { rotation: (state) => state.angle },\n measure: (measurer, state, children) => {\n const { cos, sin } = turn(state.angle);\n const { width: w, height: h } = measurer.max;\n const ortho = Math.abs(state.angle % 180) === 90;\n const room = w !== undefined && h !== undefined\n ? { width: w * cos + h * sin, height: w * sin + h * cos }\n : { width: ortho ? h : w, height: ortho ? w : h };\n let width = 0;\n let height = 0;\n for (const child of children) {\n const size = child.measure(room);\n width = Math.max(width, size.width);\n height = Math.max(height, size.height);\n }\n return { width: width * cos + height * sin, height: width * sin + height * cos };\n },\n layout: (box, state, children) => {\n const { cos, sin } = turn(state.angle);\n const turned = { x: 0, y: 0, width: box.width * cos + box.height * sin, height: box.width * sin + box.height * cos };\n return Flow.layout(turned, state as unknown as Flow.FlowState, children);\n },\n});\n\nfunction turn(angle: number): { cos: number; sin: number } {\n const rad = angle * (Math.PI / 180);\n return { cos: Math.abs(Math.cos(rad)), sin: Math.abs(Math.sin(rad)) };\n}\n\nexport type Camera = NodeOf<typeof Camera>;\nexport type OrbitCamera = NodeOf<typeof OrbitCamera>;\nexport type RotatedBox = NodeOf<typeof RotatedBox>;\n\n// What code building a camera or a rotated box names its props as.\n\nexport interface CameraProps extends ShapeProps {\n /** Magnification factor. Values > 1 zoom in; < 1 zoom out. */\n zoom: number;\n /**\n * World-space point that maps to the centre of the camera viewport — what\n * the camera is pointed at. Same name and meaning as\n * `Graphics3D.perspective({ lookAt })`, so a 2D and a 3D camera are aimed\n * with the same word.\n */\n lookAt: Vector2;\n /** Rotation of the camera view in degrees (clockwise). */\n heading: number;\n /**\n * A node of the camera's world to keep in view, by id: the camera is aimed\n * at its centre each frame, and {@link lookAt} becomes an offset from it.\n */\n follow: string;\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\n cornerRadius: RectCornerRadius;\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\n cornerStyle: RectCornerStyle;\n}\n\nexport interface OrbitCameraProps extends Node2DProps {\n /** The point the camera orbits and looks at; `z` puts it in depth, as a node's `depth` does. */\n lookAt: LookAt;\n /** Lens zoom, applied after the projection. Values > 1 zoom in. */\n zoom: number;\n /** Roll of the view in degrees, clockwise. */\n heading: number;\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera right. */\n orbit: number;\n /** Degrees above the layers. Positive looks down on them. */\n elevation: number;\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective. */\n dolly: number;\n /** Degrees per second the camera orbits on its own — a turntable. */\n orbitSpeed: number;\n}\n\n// Adjust this import path if needed\n\nexport interface RotatedBoxProps extends Node2DProps {\n /** \n * Visual rotation angle in degrees. Unlike standard `rotation`, \n * animating this ALSO dynamically calculates a new bounding box \n * for the flex/layout engine. \n */\n angle: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../../src/components/builtins/media/media.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,kCAAkC,CAAC;AAG/F,OAAO,EAAE,aAAa,EAA8C,MAAM,+CAA+C,CAAC;AAC1H,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAwB,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAkB,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC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C,CAAC,IAAI,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAU,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;gBACxH,CAAC,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;IACP,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { resolveAudioEffects, type AudioEffectsInput } from \"@/attributes/audio/effects/chain\";\r\nimport type { AudioEffect } from \"@/attributes/audio/effects/union\";\r\nimport type { ImageFit, ImageMatrix, ImageCrop } from \"@/attributes/shape/fill/implementations/image\";\r\nimport { sourceTimeFor, type VideoFillProp, type VideoFillResolved } from \"@/attributes/shape/fill/implementations/video\";\r\nimport { resolveFill, UNSET_MEDIA_FILL } from \"@/attributes/shape/fill/registry\";\r\nimport type { FillProp } from \"@/attributes/shape/fill/union\";\r\nimport { resolveChainAdjustments, type VideoAdjustment } from \"@/attributes/shape/filters/chain\";\r\nimport { lerpFilterArray, type AnyFilter } from \"@/attributes/shape/filters/registry\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { NodeOf, Values } from \"@/components/factory/api\";\r\nimport { component2d } from \"@/components/factory/component2d\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport * as Corners from \"@/components/modules/corners\";\r\nimport * as Flow from \"@/components/modules/flow\";\r\nimport * as Paint from \"@/components/modules/paint\";\r\nimport { internalsOf } from \"@/components/factory/views\";\r\nimport type { RectProps } from \"@/components/builtins/geometry/geometry\";\r\n\r\n/**\r\n * Video: a rect painted with a playing picture under its fill, and the\r\n * picture's sound. Its sound plays from `play`; a `video` row with no `play`\r\n * of its own gets one per segment, or one over its span while it plays.\r\n */\r\n\r\nconst video = {\r\n src: Types.custom<string | undefined>(undefined),\r\n fit: Types.custom<ImageFit | undefined>(undefined),\r\n crop: Types.insets,\r\n zoom: 1,\r\n anchor: Types.alignment,\r\n matrix: Types.custom<ImageMatrix | undefined>(undefined),\r\n filters: Types.custom<VideoAdjustment, AnyFilter[]>([] as never, {\r\n resolve: (v) => resolveChainAdjustments(v),\r\n lerp: lerpFilterArray,\r\n }),\r\n playing: true,\r\n timestamp: Types.custom<number | null | undefined>(undefined),\r\n trimStart: Types.custom<number | undefined>(undefined),\r\n trimEnd: Types.custom<number | undefined>(undefined),\r\n speed: Types.custom<number | undefined>(undefined),\r\n loop: Types.custom<\"forward\" | \"reverse\" | \"none\" | undefined>(undefined),\r\n duration: Types.custom<number | undefined>(undefined),\r\n volume: 1,\r\n muted: false,\r\n audioEffects: Types.custom<AudioEffectsInput, AudioEffect[]>([] as never, { resolve: (v) => resolveAudioEffects(v) }),\r\n bus: Types.custom<string | undefined>(undefined),\r\n segments: Types.custom<readonly VideoSegment[]>([]),\r\n};\r\n\r\ntype VideoState = Values<typeof video> & { readonly crop: InsetsResolved; readonly anchor: Alignment };\r\n\r\n/** Source seconds played by `elapsed` clip seconds into the segments, or `null` without any. */\r\nfunction playedAt(s: VideoState, elapsed: number): number | null {\r\n if (s.segments.length === 0) return null;\r\n let played = 0;\r\n for (const segment of s.segments) {\r\n if (elapsed <= segment.at) break;\r\n played += Math.min(elapsed - segment.at, segment.duration) * (segment.speed ?? s.speed ?? 1);\r\n }\r\n return played;\r\n}\r\n\r\nfunction scheduledTimestamp(s: VideoState, elapsed: number): number | undefined {\r\n const played = playedAt(s, elapsed);\r\n if (played === null) return undefined;\r\n const start = s.trimStart ?? 0;\r\n const first = s.segments[0];\r\n return sourceTimeFor(played + (first ? first.from - start : 0), start, s.trimEnd ?? Infinity, s.loop, s.duration);\r\n}\r\n\r\nconst pictures = new WeakMap<object, { readonly key: string; readonly fill: VideoFillResolved }>();\r\n\r\n/** The frame to paint, resolved once per change of what it depends on. */\r\nfunction pictureOf(host: object, s: VideoState, elapsed: number): VideoFillResolved | null {\r\n if (!s.src) {\r\n pictures.delete(host);\r\n return null;\r\n }\r\n const scheduled = scheduledTimestamp(s, elapsed);\r\n const crop = s.crop;\r\n const anchor = s.anchor as unknown as Vector2;\r\n const key = [\r\n s.src, s.fit ?? \"\", s.zoom, s.playing ? 1 : 0, crop.left, crop.right, crop.top, crop.bottom, anchor.x, anchor.y,\r\n s.timestamp ?? \"\", s.trimStart ?? \"\", s.trimEnd ?? \"\", s.speed ?? \"\", s.loop ?? \"\", s.duration ?? \"\", scheduled ?? \"\",\r\n ].join(\"|\");\r\n const kept = pictures.get(host);\r\n if (kept && kept.key === key) return kept.fill;\r\n const prop: VideoFillProp = {\r\n type: \"video\", src: s.src, fit: s.fit, crop: s.crop, zoom: s.zoom, anchor: s.anchor, matrix: s.matrix,\r\n filters: s.filters as never, playing: s.playing, timestamp: s.timestamp ?? scheduled,\r\n trimStart: s.trimStart, trimEnd: s.trimEnd, speed: s.speed, loop: s.loop, duration: s.duration,\r\n };\r\n const fill = resolveFill(prop as FillProp) as VideoFillResolved;\r\n pictures.set(host, { key, fill });\r\n return fill;\r\n}\r\n\r\nexport const Video = component2d({\r\n key: \"video\",\r\n state: { ...Paint.state, ...Flow.state, ...Corners.state, ...video },\r\n commands: {\r\n ...Paint.commands,\r\n /** Its sound: from `from` in the source for a segment, or as it plays. Cut when the command ends. */\r\n play: {\r\n args: {\r\n from: Types.custom<number | undefined>(undefined),\r\n volume: Types.custom<number | undefined>(undefined),\r\n speed: Types.custom<number | undefined>(undefined),\r\n },\r\n run: (timeline, state) => {\r\n const s = state as unknown as VideoState;\r\n const segment = timeline.args.from !== undefined;\r\n if (!s.src || s.muted || (!segment && !s.playing)) return timeline.together([]);\r\n const speed = timeline.args.speed ?? s.speed ?? 1;\r\n const loop = !segment && (s.loop ?? \"none\") !== \"none\";\r\n return timeline.sound(s.src, {\r\n volume: timeline.args.volume ?? s.volume,\r\n loop,\r\n trimStart: segment ? timeline.args.from : s.trimStart,\r\n trimEnd: s.trimEnd,\r\n speed,\r\n effects: s.audioEffects,\r\n bus: s.bus,\r\n optional: true,\r\n closed: !loop,\r\n });\r\n },\r\n },\r\n },\r\n load: (loader, state) => {\r\n if (!state.src) return;\r\n loader.fill(resolveFill({\r\n type: \"video\", src: state.src, filters: state.filters, trimStart: state.trimStart, trimEnd: state.trimEnd,\r\n } as unknown as FillProp));\r\n },\r\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\r\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\r\n render: (ctx, state) => {\r\n const s = state as unknown as VideoState & Values<typeof Paint.state> & Values<typeof Corners.state>;\r\n const picture = pictureOf(internalsOf(ctx).host, s, ctx.time.elapsed);\r\n const outline = { width: ctx.size.width, height: ctx.size.height, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle, start: s.start, end: s.end };\r\n Paint.draw(ctx, state, Corners.rect(ctx.size, state), {\r\n fill: [(picture ?? UNSET_MEDIA_FILL), ...state.fill] as never,\r\n // The overlay lies on the picture only, masked by it.\r\n overlay: () => (picture\r\n ? new Graphics2D().mask().rect(outline).fill([picture] as never).applyMask().rect(outline).fill(state.overlay).endMask()\r\n : null),\r\n });\r\n },\r\n});\r\n\r\nexport type Video = NodeOf<typeof Video>;\r\n\r\n// What code building a video names its props as, and the segments it plays.\r\n\r\nexport interface VideoProps extends RectProps {\r\n src?: string;\r\n /** How the (cropped) frame is scaled into the node's bounds. Default 'fill'. */\r\n fit?: ImageFit;\r\n /** Window onto the source frame, in fractions of its own size, applied before `fit`. */\r\n crop?: ImageCrop;\r\n /** Magnification on top of the fitted scale. `1` (default) is the fitted size. */\r\n zoom?: number;\r\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\r\n anchor?: Alignment;\r\n /** Raw frame→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\r\n matrix?: ImageMatrix;\r\n /** Visual filters applied to the rendered frame (blur, color, posterizeTime, echo, …). */\r\n filters?: VideoAdjustment;\r\n /** Whether playback advances with the node's clock (drives both picture and sound). Default true. */\r\n playing?: boolean;\r\n /**\r\n * Explicit source time to show, in seconds. Omit it (the default) and the\r\n * picture is timed from the moment this node appeared; set it to drive the\r\n * playhead yourself, and set it to `null` to hand the playhead back to the\r\n * clock (`set()` merges a partial, so `undefined` won't clear it).\r\n */\r\n timestamp?: number | null;\r\n trimStart?: number;\r\n trimEnd?: number;\r\n /** Playback-rate multiplier for both picture and audio. Default 1. */\r\n speed?: number;\r\n loop?: 'forward' | 'reverse' | 'none';\r\n /** Length of one loop cycle, in seconds. Defaults to the trimmed clip length. */\r\n duration?: number;\r\n /** Audio volume in [0, 1]. Default 1. */\r\n volume?: number;\r\n /** Silence the video's audio track without affecting the picture. Default false. */\r\n muted?: boolean;\r\n /** Audio effects applied to the video's sound track (gain, eq, echo, …). */\r\n audioEffects?: AudioEffectsInput;\r\n /**\r\n * The node id of an `AudioBus` in this clip to route the video's sound into.\r\n *\r\n * A `Video` is a `Node2D`, so it cannot be parented under a bus the way a\r\n * `SoundNode` is — its audio is welded to its picture, which has to stay in\r\n * the visual tree. Naming one instead is what lets a video's dialogue sit on\r\n * the same bus as everything else, so ducking the whole group is still one\r\n * edit — and it is the *same* id a `SoundNode` under that bus writes as its\r\n * `parentId`, rather than a second vocabulary for \"which bus\". An id matching\r\n * no bus routes straight to the master, the same as no bus at all.\r\n */\r\n bus?: string;\r\n /**\r\n * An explicit **playback schedule**: the stretches of this node's own clock\r\n * during which the clip advances, and where in the source each one starts.\r\n *\r\n * Omit it (the default) and playback is what it has always been — the clip\r\n * runs from the moment the node appears, at `speed`, until it or the node\r\n * runs out. Give it, and `playing`/`timestamp` are both superseded: the\r\n * picture takes its source time from whichever segment covers the current\r\n * `elapsed`, and the sound is scheduled one clip per segment.\r\n *\r\n * It exists because a **pause** cannot be expressed any other way. `playing:\r\n * false` holds the clip's *first* frame, because with playback derived\r\n * linearly from the clock there is nothing else it could hold; and the sound\r\n * runs on the node's own clock regardless, so a picture frozen by any means\r\n * would drift away from it. A schedule states the one thing both halves need\r\n * and neither could infer — that a paused stretch consumes no source — so\r\n * they cannot come apart.\r\n *\r\n * Still a pure function of the clock, which is the property everything else\r\n * here is built on: frame *N* is identical however the playhead reached it,\r\n * so a scrub, a playthrough and an export agree.\r\n */\r\n segments?: readonly VideoSegment[];\r\n\r\n}\r\n\r\n/**\r\n * One stretch of a {@link Video}'s own clock during which its source advances —\r\n * see {@link VideoProps.segments}.\r\n *\r\n * Trim and loop are applied *on top* of this, by the same code that applies them\r\n * to unscheduled playback, so a schedule says when the clip is running and the\r\n * clip's own props go on saying which part of the file it is running through.\r\n */\r\nexport interface VideoSegment {\r\n /** Second on the node's own clock (`NodeTime.elapsed`) this segment begins. */\r\n at: number;\r\n /** Source in-point for it, in seconds. */\r\n from: number;\r\n /**\r\n * How long it runs, in seconds of the node's clock.\r\n *\r\n * `Infinity` for a clip left running — the same open sentinel\r\n * `AudioRequest.endAt` uses — which resolves against the clip's length.\r\n */\r\n duration: number;\r\n /** Playback rate through it. Defaults to the node's own `speed`. */\r\n speed?: number;\r\n /** Linear gain for its sound. Defaults to the node's own `volume`. */\r\n volume?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../../../src/components/builtins/media/media.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,kCAAkC,CAAC;AAG/F,OAAO,EAAE,aAAa,EAA8C,MAAM,+CAA+C,CAAC;AAC1H,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,OAAO,EAAE,uBAAuB,EAAwB,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAkB,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA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,GAAG,EAAE,CAAC,CAAC,OAAO;gBACnB,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAU,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;gBACxH,CAAC,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;IACP,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { InsetsResolved } from \"@/attributes/layout/insets\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { resolveAudioEffects, type AudioEffectsInput } from \"@/attributes/audio/effects/chain\";\nimport type { AudioEffect } from \"@/attributes/audio/effects/union\";\nimport type { ImageFit, ImageMatrix, ImageCrop } from \"@/attributes/shape/fill/implementations/image\";\nimport { sourceTimeFor, type VideoFillProp, type VideoFillResolved } from \"@/attributes/shape/fill/implementations/video\";\nimport { resolveFill, UNSET_MEDIA_FILL } from \"@/attributes/shape/fill/registry\";\nimport type { FillProp } from \"@/attributes/shape/fill/union\";\nimport { resolveChainAdjustments, type VideoAdjustment } from \"@/attributes/shape/filters/chain\";\nimport { lerpFilterArray, type AnyFilter } from \"@/attributes/shape/filters/registry\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport type { NodeOf, Values } from \"@/components/factory/api\";\nimport { component2d } from \"@/components/factory/component2d\";\nimport { Types } from \"@/components/factory/types\";\nimport * as Corners from \"@/components/modules/corners\";\nimport * as Flow from \"@/components/modules/flow\";\nimport * as Paint from \"@/components/modules/paint\";\nimport { internalsOf } from \"@/components/factory/views\";\nimport type { RectProps } from \"@/components/builtins/geometry/geometry\";\n\n/**\n * Video: a rect painted with a playing picture under its fill, and the\n * picture's sound. Its sound plays from `play`; a `video` row with no `play`\n * of its own gets one per segment, or one over its span while it plays.\n */\n\nconst video = {\n src: Types.custom<string | undefined>(undefined),\n fit: Types.custom<ImageFit | undefined>(undefined),\n crop: Types.insets,\n zoom: 1,\n anchor: Types.alignment,\n matrix: Types.custom<ImageMatrix | undefined>(undefined),\n filters: Types.custom<VideoAdjustment, AnyFilter[]>([] as never, {\n resolve: (v) => resolveChainAdjustments(v),\n lerp: lerpFilterArray,\n }),\n playing: true,\n timestamp: Types.custom<number | null | undefined>(undefined),\n trimStart: Types.custom<number | undefined>(undefined),\n trimEnd: Types.custom<number | undefined>(undefined),\n speed: Types.custom<number | undefined>(undefined),\n loop: Types.custom<\"forward\" | \"reverse\" | \"none\" | undefined>(undefined),\n duration: Types.custom<number | undefined>(undefined),\n volume: 1,\n muted: false,\n audioEffects: Types.custom<AudioEffectsInput, AudioEffect[]>([] as never, { resolve: (v) => resolveAudioEffects(v) }),\n bus: Types.custom<string | undefined>(undefined),\n segments: Types.custom<readonly VideoSegment[]>([]),\n};\n\ntype VideoState = Values<typeof video> & { readonly crop: InsetsResolved; readonly anchor: Alignment };\n\n/** Source seconds played by `elapsed` clip seconds into the segments, or `null` without any. */\nfunction playedAt(s: VideoState, elapsed: number): number | null {\n if (s.segments.length === 0) return null;\n let played = 0;\n for (const segment of s.segments) {\n if (elapsed <= segment.at) break;\n played += Math.min(elapsed - segment.at, segment.duration) * (segment.speed ?? s.speed ?? 1);\n }\n return played;\n}\n\nfunction scheduledTimestamp(s: VideoState, elapsed: number): number | undefined {\n const played = playedAt(s, elapsed);\n if (played === null) return undefined;\n const start = s.trimStart ?? 0;\n const first = s.segments[0];\n return sourceTimeFor(played + (first ? first.from - start : 0), start, s.trimEnd ?? Infinity, s.loop, s.duration);\n}\n\nconst pictures = new WeakMap<object, { readonly key: string; readonly fill: VideoFillResolved }>();\n\n/** The frame to paint, resolved once per change of what it depends on. */\nfunction pictureOf(host: object, s: VideoState, elapsed: number): VideoFillResolved | null {\n if (!s.src) {\n pictures.delete(host);\n return null;\n }\n const scheduled = scheduledTimestamp(s, elapsed);\n const crop = s.crop;\n const anchor = s.anchor as unknown as Vector2;\n const key = [\n s.src, s.fit ?? \"\", s.zoom, s.playing ? 1 : 0, crop.left, crop.right, crop.top, crop.bottom, anchor.x, anchor.y,\n s.timestamp ?? \"\", s.trimStart ?? \"\", s.trimEnd ?? \"\", s.speed ?? \"\", s.loop ?? \"\", s.duration ?? \"\", scheduled ?? \"\",\n ].join(\"|\");\n const kept = pictures.get(host);\n if (kept && kept.key === key) return kept.fill;\n const prop: VideoFillProp = {\n type: \"video\", src: s.src, fit: s.fit, crop: s.crop, zoom: s.zoom, anchor: s.anchor, matrix: s.matrix,\n filters: s.filters as never, playing: s.playing, timestamp: s.timestamp ?? scheduled,\n trimStart: s.trimStart, trimEnd: s.trimEnd, speed: s.speed, loop: s.loop, duration: s.duration,\n };\n const fill = resolveFill(prop as FillProp) as VideoFillResolved;\n pictures.set(host, { key, fill });\n return fill;\n}\n\nexport const Video = component2d({\n key: \"video\",\n state: { ...Paint.state, ...Flow.state, ...Corners.state, ...video },\n commands: {\n ...Paint.commands,\n /** Its sound: from `from` in the source for a segment, or as it plays. Cut when the command ends. */\n play: {\n args: {\n from: Types.custom<number | undefined>(undefined),\n volume: Types.custom<number | undefined>(undefined),\n speed: Types.custom<number | undefined>(undefined),\n },\n run: (timeline, state) => {\n const s = state as unknown as VideoState;\n const segment = timeline.args.from !== undefined;\n if (!s.src || s.muted || (!segment && !s.playing)) return timeline.together([]);\n const speed = timeline.args.speed ?? s.speed ?? 1;\n const loop = !segment && (s.loop ?? \"none\") !== \"none\";\n return timeline.sound(s.src, {\n volume: timeline.args.volume ?? s.volume,\n loop,\n trimStart: segment ? timeline.args.from : s.trimStart,\n trimEnd: s.trimEnd,\n speed,\n effects: s.audioEffects,\n bus: s.bus,\n optional: true,\n closed: !loop,\n });\n },\n },\n },\n load: (loader, state) => {\n if (!state.src) return;\n loader.fill(resolveFill({\n type: \"video\", src: state.src, filters: state.filters, trimStart: state.trimStart, trimEnd: state.trimEnd,\n } as unknown as FillProp));\n },\n measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),\n layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),\n render: (ctx, state) => {\n const s = state as unknown as VideoState & Values<typeof Paint.state> & Values<typeof Corners.state>;\n const picture = pictureOf(internalsOf(ctx).host, s, ctx.time.elapsed);\n const outline = { width: ctx.size.width, height: ctx.size.height, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle, start: s.start, end: s.end };\n Paint.draw(ctx, state, Corners.rect(ctx.size, state), {\n fill: [(picture ?? UNSET_MEDIA_FILL), ...state.fill] as never,\n // The overlay lies on the picture only, masked by it.\n overlay: () => (picture\n ? new Graphics2D().mask().rect(outline).fill([picture] as never).applyMask().rect(outline).fill(state.overlay).endMask()\n : null),\n });\n },\n});\n\nexport type Video = NodeOf<typeof Video>;\n\n// What code building a video names its props as, and the segments it plays.\n\nexport interface VideoProps extends RectProps {\n src?: string;\n /** How the (cropped) frame is scaled into the node's bounds. Default 'fill'. */\n fit?: ImageFit;\n /** Window onto the source frame, in fractions of its own size, applied before `fit`. */\n crop?: ImageCrop;\n /** Magnification on top of the fitted scale. `1` (default) is the fitted size. */\n zoom?: number;\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\n anchor?: Alignment;\n /** Raw frame→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\n matrix?: ImageMatrix;\n /** Visual filters applied to the rendered frame (blur, color, posterizeTime, echo, …). */\n filters?: VideoAdjustment;\n /** Whether playback advances with the node's clock (drives both picture and sound). Default true. */\n playing?: boolean;\n /**\n * Explicit source time to show, in seconds. Omit it (the default) and the\n * picture is timed from the moment this node appeared; set it to drive the\n * playhead yourself, and set it to `null` to hand the playhead back to the\n * clock (`set()` merges a partial, so `undefined` won't clear it).\n */\n timestamp?: number | null;\n trimStart?: number;\n trimEnd?: number;\n /** Playback-rate multiplier for both picture and audio. Default 1. */\n speed?: number;\n loop?: 'forward' | 'reverse' | 'none';\n /** Length of one loop cycle, in seconds. Defaults to the trimmed clip length. */\n duration?: number;\n /** Audio volume in [0, 1]. Default 1. */\n volume?: number;\n /** Silence the video's audio track without affecting the picture. Default false. */\n muted?: boolean;\n /** Audio effects applied to the video's sound track (gain, eq, echo, …). */\n audioEffects?: AudioEffectsInput;\n /**\n * The node id of an `AudioBus` in this clip to route the video's sound into.\n *\n * A `Video` is a `Node2D`, so it cannot be parented under a bus the way a\n * `SoundNode` is — its audio is welded to its picture, which has to stay in\n * the visual tree. Naming one instead is what lets a video's dialogue sit on\n * the same bus as everything else, so ducking the whole group is still one\n * edit — and it is the *same* id a `SoundNode` under that bus writes as its\n * `parentId`, rather than a second vocabulary for \"which bus\". An id matching\n * no bus routes straight to the master, the same as no bus at all.\n */\n bus?: string;\n /**\n * An explicit **playback schedule**: the stretches of this node's own clock\n * during which the clip advances, and where in the source each one starts.\n *\n * Omit it (the default) and playback is what it has always been — the clip\n * runs from the moment the node appears, at `speed`, until it or the node\n * runs out. Give it, and `playing`/`timestamp` are both superseded: the\n * picture takes its source time from whichever segment covers the current\n * `elapsed`, and the sound is scheduled one clip per segment.\n *\n * It exists because a **pause** cannot be expressed any other way. `playing:\n * false` holds the clip's *first* frame, because with playback derived\n * linearly from the clock there is nothing else it could hold; and the sound\n * runs on the node's own clock regardless, so a picture frozen by any means\n * would drift away from it. A schedule states the one thing both halves need\n * and neither could infer — that a paused stretch consumes no source — so\n * they cannot come apart.\n *\n * Still a pure function of the clock, which is the property everything else\n * here is built on: frame *N* is identical however the playhead reached it,\n * so a scrub, a playthrough and an export agree.\n */\n segments?: readonly VideoSegment[];\n\n}\n\n/**\n * One stretch of a {@link Video}'s own clock during which its source advances —\n * see {@link VideoProps.segments}.\n *\n * Trim and loop are applied *on top* of this, by the same code that applies them\n * to unscheduled playback, so a schedule says when the clip is running and the\n * clip's own props go on saying which part of the file it is running through.\n */\nexport interface VideoSegment {\n /** Second on the node's own clock (`NodeTime.elapsed`) this segment begins. */\n at: number;\n /** Source in-point for it, in seconds. */\n from: number;\n /**\n * How long it runs, in seconds of the node's clock.\n *\n * `Infinity` for a clip left running — the same open sentinel\n * `AudioRequest.endAt` uses — which resolves against the clip's length.\n */\n duration: number;\n /** Playback rate through it. Defaults to the node's own `speed`. */\n speed?: number;\n /** Linear gain for its sound. Defaults to the node's own `volume`. */\n volume?: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../../src/components/builtins/providers/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAA8B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC;IAChC,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAA+B,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAU,SAAS,CAAC,EAAE;IAClH,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;CAC7I,CAAC,CAAC;AAEH,wFAAwF;AACxF,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;IACrC,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE;QACH,KAAK,EAAE,KAAK,CAAC,MAAM,CAAsC,SAAS,CAAC;QACnE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAsC,SAAS,CAAC;QAClE,IAAI,EAAE,KAAK,CAAC,MAAM,CAA8B,SAAS,CAAC;KAC7D;IACD,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAe,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,KAAK;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,GAAG,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9F,IAAI,KAAK,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1F,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACxE,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { DataToken, SeedToken, ThemeToken } from \"@/runtime/builtin-context\";\r\nimport type { Context } from \"@/util/context\";\r\nimport { provides, type NodeOf, type Provided } from \"@/components/factory/api\";\r\nimport { component2d } from \"@/components/factory/component2d\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport type { Node2DProps } from \"@/components/trees/2d/node2d\";\r\n\r\n/** Hands its subtree `value` under `context`, or the context's default when it has no value. */\r\nexport const Provider = component2d({\r\n key: \"provider\",\r\n state: { context: Types.custom<Context<unknown> | undefined>(undefined), value: Types.custom<unknown>(undefined) },\r\n provide: (state) => (state.context ? [provides(state.context, state.value !== undefined ? state.value : state.context.defaultValue)] : []),\r\n});\r\n\r\n/** Lays its theme and data over what it inherits, and seeds the randomness below it. */\r\nexport const ThemeProvider = component2d({\r\n key: \"theme-provider\",\r\n state: {\r\n theme: Types.custom<Record<string, unknown> | undefined>(undefined),\r\n data: Types.custom<Record<string, unknown> | undefined>(undefined),\r\n seed: Types.custom<string | number | undefined>(undefined),\r\n },\r\n provide: (state, inherited) => {\r\n const out: Provided[] = [];\r\n if (state.theme) out.push(provides(ThemeToken, { ...inherited(ThemeToken), ...state.theme }));\r\n if (state.data) out.push(provides(DataToken, { ...inherited(DataToken), ...state.data }));\r\n if (state.seed !== undefined) out.push(provides(SeedToken, state.seed));\r\n return out;\r\n },\r\n});\r\n\r\nexport type Provider = NodeOf<typeof Provider>;\r\nexport type ThemeProvider = NodeOf<typeof ThemeProvider>;\r\n\r\n// What code building a provider names its props as.\r\n\r\nexport interface ProviderProps<T> extends Node2DProps {\r\n /** The context token this provider supplies to its descendants. */\r\n context: Context<T>;\r\n /** The value to provide. Omitted → the token's default value. */\r\n value: T;\r\n}\r\n\r\nexport interface ThemeProviderProps extends Node2DProps {\r\n /** Named values (e.g. colors) merged onto any ancestor theme, read via\r\n * `node.useContext(ThemeToken)`. */\r\n theme: Record<string, unknown>;\r\n /** Arbitrary data merged onto any ancestor data bag, read via\r\n * `node.useContext(DataToken)`. */\r\n data: Record<string, unknown>;\r\n /** A default seed passed down the tree, read via `node.useContext(SeedToken)`. */\r\n seed: string | number;\r\n}\r\n"]}
1
+ {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../../../src/components/builtins/providers/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAA8B,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GA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AI,KAAK,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACxE,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import { DataToken, SeedToken, ThemeToken } from \"@/runtime/builtin-context\";\nimport type { Context } from \"@/util/context\";\nimport { provides, type NodeOf, type Provided } from \"@/components/factory/api\";\nimport { component2d } from \"@/components/factory/component2d\";\nimport { Types } from \"@/components/factory/types\";\nimport type { Node2DProps } from \"@/components/trees/2d/node2d\";\n\n/** Hands its subtree `value` under `context`, or the context's default when it has no value. */\nexport const Provider = component2d({\n key: \"provider\",\n state: { context: Types.custom<Context<unknown> | undefined>(undefined), value: Types.custom<unknown>(undefined) },\n provide: (state) => (state.context ? [provides(state.context, state.value !== undefined ? state.value : state.context.defaultValue)] : []),\n});\n\n/** Lays its theme and data over what it inherits, and seeds the randomness below it. */\nexport const ThemeProvider = component2d({\n key: \"theme-provider\",\n state: {\n theme: Types.custom<Record<string, unknown> | undefined>(undefined),\n data: Types.custom<Record<string, unknown> | undefined>(undefined),\n seed: Types.custom<string | number | undefined>(undefined),\n },\n provide: (state, inherited) => {\n const out: Provided[] = [];\n if (state.theme) out.push(provides(ThemeToken, { ...inherited(ThemeToken), ...state.theme }));\n if (state.data) out.push(provides(DataToken, { ...inherited(DataToken), ...state.data }));\n if (state.seed !== undefined) out.push(provides(SeedToken, state.seed));\n return out;\n },\n});\n\nexport type Provider = NodeOf<typeof Provider>;\nexport type ThemeProvider = NodeOf<typeof ThemeProvider>;\n\n// What code building a provider names its props as.\n\nexport interface ProviderProps<T> extends Node2DProps {\n /** The context token this provider supplies to its descendants. */\n context: Context<T>;\n /** The value to provide. Omitted → the token's default value. */\n value: T;\n}\n\nexport interface ThemeProviderProps extends Node2DProps {\n /** Named values (e.g. colors) merged onto any ancestor theme, read via\n * `node.useContext(ThemeToken)`. */\n theme: Record<string, unknown>;\n /** Arbitrary data merged onto any ancestor data bag, read via\n * `node.useContext(DataToken)`. */\n data: Record<string, unknown>;\n /** A default seed passed down the tree, read via `node.useContext(SeedToken)`. */\n seed: string | number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"number-format.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwD;IAClF,0EAA0E;IAC1E,4EAA4E;IAC5E,qEAAqE;IACrE,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,UAAU;CACpB,CAAA;AAiBD,8EAA8E;AAC9E,MAAM,cAAc,GAAkB;IACpC,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,KAAK;CACf,CAAA;AAED,iFAAiF;AACjF,SAAS,IAAI,CAAC,IAAY,EAAE,KAA4C;IACtE,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACf,MAAM,GAAG,CAAC,MAAM,CAAA;YAChB,SAAQ;QACV,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACnB,CAAC;AACH,CAAC;AAED,4CAA4C;AAC5C,SAAS,OAAO,CAAC,IAAY,EAAE,EAAU;IACvC,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACvB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM;YAAE,KAAK,G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KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAClF,MAAM,IAAI,GAAG,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACzD,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,MAAoC,EACpC,MAA0B;IAE1B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACpC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACzD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,eAAe,CAAC,KAAK,CAAA;AACpE,CAAC","sourcesContent":["/**\r\n * How a chart writes a number down.\r\n *\r\n * One formatter, driven by a **pattern**, and the named formats are patterns\r\n * too — `currency` is `$#,##0.00` and nothing more. That is the whole design:\r\n * a dropdown of four presets and a free-text pattern are otherwise two features\r\n * that drift, one of them gaining a thousands separator or a negative sign the\r\n * other never hears about. Here the preset *is* the custom case with the\r\n * pattern filled in, so there is one set of rules to get right.\r\n *\r\n * The grammar is the spreadsheet one, because that is where the numbers come\r\n * from and what an author already knows:\r\n *\r\n * | Pattern | 1234.5 | 0.07 |\r\n * | ------------ | --------- | ------ |\r\n * | `#,##0.##` | `1,234.5` | `0.07` |\r\n * | `0` | `1235` | `0` |\r\n * | `$#,##0.00` | `$1,234.50` | `$0.07` |\r\n * | `0.#%` | `123450%` | `7%` |\r\n * | `#,##0 kg` | `1,235 kg` | `0 kg` |\r\n *\r\n * - `0` is a digit that is always written, `#` one that is written only when\r\n * the number needs it. So `0.00` pads to two decimals and `0.##` trims.\r\n * - A `,` anywhere in the integer run turns grouping on; where it sits doesn't\r\n * matter, since `#,##0` and `#,###,##0` mean the same thing to everyone who\r\n * writes them.\r\n * - `%` scales by 100 as well as printing — that is what makes it a percent\r\n * rather than a suffix, and it is why `0.07` under `0.#%` is `7%`. A column\r\n * that is *already* in percent points wants `#,##0'%'`: quoted, so the sign\r\n * is printed and nothing is scaled.\r\n * - Anything else is literal, before the digits or after them. Quote it to be\r\n * sure — `'#'#,##0` prints a leading hash.\r\n *\r\n * Deliberately **not** `Intl.NumberFormat`. Its output is locale-dependent, and\r\n * a chart is a picture with a fixed layout: the same project rendering\r\n * `1,234.50` on the author's machine and `1.234,50` on the export box is a\r\n * silently different image, and the wider string can reflow an axis. What an\r\n * author wants here is the format they *typed*.\r\n */\r\n\r\n/** The named formats the inspector offers, plus the escape hatch. */\r\nexport type NumberFormatName = \"plain\" | \"number\" | \"currency\" | \"percent\" | \"custom\"\r\n\r\n/**\r\n * The pattern behind each named format.\r\n *\r\n * `plain` is the historic behaviour — integers bare, everything else to one\r\n * decimal — kept as the default so no existing chart re-labels itself. The rest\r\n * are the three formats a chart of money, counts or shares actually needs.\r\n */\r\nexport const NUMBER_PATTERNS: Record<Exclude<NumberFormatName, \"custom\">, string> = {\r\n // Ungrouped on purpose: this is what `formatMarker` did before there were\r\n // formats at all, and it is the default, so every chart already drawn keeps\r\n // the labels it has. Grouping is what the reader picks `number` for.\r\n plain: \"#.#\",\r\n number: \"#,##0.##\",\r\n currency: \"$#,##0.00\",\r\n percent: \"#,##0.#%\",\r\n}\r\n\r\n/** A pattern taken apart once, so formatting a tick is not a parse. */\r\ninterface ParsedPattern {\r\n prefix: string\r\n suffix: string\r\n grouped: boolean\r\n /** Digits always written left of the point — the count of `0`s there. */\r\n minInt: number\r\n /** Digits always written right of it. */\r\n minFrac: number\r\n /** The most that may be written right of it. */\r\n maxFrac: number\r\n /** Scale by 100 and print a `%`. */\r\n percent: boolean\r\n}\r\n\r\n/** What a pattern with no digits in it falls back to: the `plain` reading. */\r\nconst DEFAULT_PARSED: ParsedPattern = {\r\n prefix: \"\",\r\n suffix: \"\",\r\n grouped: false,\r\n minInt: 1,\r\n minFrac: 0,\r\n maxFrac: 1,\r\n percent: false,\r\n}\r\n\r\n/** Walk `text`, calling `visit` with each character and whether it is quoted. */\r\nfunction scan(text: string, visit: (ch: string, quoted: boolean) => void): void {\r\n let quoted = false\r\n for (const ch of text) {\r\n if (ch === \"'\") {\r\n quoted = !quoted\r\n continue\r\n }\r\n visit(ch, quoted)\r\n }\r\n}\r\n\r\n/** Does `text` hold `ch` outside quotes? */\r\nfunction hasBare(text: string, ch: string): boolean {\r\n let found = false\r\n scan(text, (c, quoted) => {\r\n if (c === ch && !quoted) found = true\r\n })\r\n return found\r\n}\r\n\r\n/** `text` with every unquoted `ch` dropped, quoting preserved. */\r\nfunction removeBare(text: string, ch: string): string {\r\n let out = \"\"\r\n let quoted = false\r\n for (const c of text) {\r\n if (c === \"'\") {\r\n quoted = !quoted\r\n out += c\r\n continue\r\n }\r\n if (c === ch && !quoted) continue\r\n out += c\r\n }\r\n return out\r\n}\r\n\r\n/** `text` with its quotes taken off — what actually gets printed. */\r\nfunction literal(text: string): string {\r\n let out = \"\"\r\n scan(text, (ch) => {\r\n out += ch\r\n })\r\n return out\r\n}\r\n\r\n/**\r\n * The `[start, end)` of the pattern's digit run — the first stretch of `#0,.`\r\n * outside quotes.\r\n *\r\n * Quote-aware, so `'#'#,##0` reads its leading hash as text and its run as the\r\n * three characters after it. Without that, a quoted `#` would be taken for the\r\n * number and the real digits for a suffix.\r\n */\r\nfunction digitRun(pattern: string): [number, number] | null {\r\n let quoted = false\r\n let start = -1\r\n for (let i = 0; i < pattern.length; i++) {\r\n const ch = pattern[i]\r\n if (ch === \"'\") {\r\n quoted = !quoted\r\n if (start >= 0) return [start, i]\r\n continue\r\n }\r\n const isDigit = !quoted && \"#0,.\".includes(ch)\r\n if (isDigit && start < 0) start = i\r\n else if (!isDigit && start >= 0) return [start, i]\r\n }\r\n return start < 0 ? null : [start, pattern.length]\r\n}\r\n\r\n/**\r\n * Split `pattern` into its literal edges and its digit run.\r\n *\r\n * Everything before the run is a prefix and everything after it a suffix, which\r\n * is what lets `$#,##0.00`, `#,##0 kg` and `€ #,##0` all work without the\r\n * language needing a quoting rule for the parts that are only ever text.\r\n */\r\nfunction parsePattern(pattern: string): ParsedPattern {\r\n const run = digitRun(pattern)\r\n if (!run) {\r\n // No digits at all is not a number format. Fall back rather than print the\r\n // literal for every tick, which would read as an axis of identical labels.\r\n return DEFAULT_PARSED\r\n }\r\n\r\n const digits = pattern.slice(run[0], run[1])\r\n const rawPrefix = pattern.slice(0, run[0])\r\n const rawSuffix = pattern.slice(run[1])\r\n\r\n // An **unquoted** `%` is the percent operator; a quoted one is a sign the\r\n // author wants printed over data that is already in percent points.\r\n const percent = hasBare(rawPrefix, \"%\") || hasBare(rawSuffix, \"%\")\r\n const prefix = literal(percent ? removeBare(rawPrefix, \"%\") : rawPrefix)\r\n const suffix = literal(percent ? removeBare(rawSuffix, \"%\") : rawSuffix)\r\n\r\n const point = digits.indexOf(\".\")\r\n const intPart = point < 0 ? digits : digits.slice(0, point)\r\n const fracPart = point < 0 ? \"\" : digits.slice(point + 1)\r\n\r\n const count = (s: string, ch: string) => s.split(ch).length - 1\r\n\r\n return {\r\n prefix,\r\n suffix: percent ? `${suffix}%` : suffix,\r\n grouped: intPart.includes(\",\"),\r\n minInt: Math.max(1, count(intPart, \"0\")),\r\n minFrac: count(fracPart, \"0\"),\r\n maxFrac: fracPart.length,\r\n percent,\r\n }\r\n}\r\n\r\n/** Parsed patterns are reused across every tick of every frame. */\r\nconst cache = new Map<string, ParsedPattern>()\r\n\r\nfunction parsed(pattern: string): ParsedPattern {\r\n const held = cache.get(pattern)\r\n if (held) return held\r\n const next = parsePattern(pattern)\r\n cache.set(pattern, next)\r\n return next\r\n}\r\n\r\n/** `1234567` → `1,234,567`. Only the integer run is grouped. */\r\nfunction group(digits: string): string {\r\n return digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\r\n}\r\n\r\n/**\r\n * `value` written the way `pattern` says.\r\n *\r\n * A non-finite value prints empty rather than `NaN`: a tick with no number\r\n * behind it is a tick that shouldn't caption itself, and `NaN` on an axis reads\r\n * as a broken chart rather than as missing data.\r\n */\r\nexport function formatNumber(value: number, pattern: string): string {\r\n if (!Number.isFinite(value)) return \"\"\r\n const p = parsed(pattern)\r\n\r\n const scaled = p.percent ? value * 100 : value\r\n const rounded = scaled.toFixed(p.maxFrac)\r\n // Rounding is what decides the sign, not the input: -0.001 at two decimals is\r\n // \"0.00\", and printing it as \"-0.00\" puts a minus sign on an axis's zero.\r\n const negative = rounded.startsWith(\"-\")\r\n const [rawInt = \"0\", rawFrac = \"\"] = (\r\n negative ? rounded.slice(1) : rounded\r\n ).split(\".\")\r\n\r\n const intDigits = rawInt.padStart(p.minInt, \"0\")\r\n // `#` trims, `0` pads: drop trailing zeros down to the required minimum.\r\n let frac = rawFrac\r\n while (frac.length > p.minFrac && frac.endsWith(\"0\")) frac = frac.slice(0, -1)\r\n\r\n const body = (p.grouped ? group(intDigits) : intDigits) + (frac ? `.${frac}` : \"\")\r\n const sign = negative && Number(rounded) !== 0 ? \"-\" : \"\"\r\n return `${sign}${p.prefix}${body}${p.suffix}`\r\n}\r\n\r\n/**\r\n * The pattern a `(format, custom)` pair names.\r\n *\r\n * A blank custom pattern falls back to the plain one rather than to the empty\r\n * string, so an axis switched to Custom is readable while it is being typed\r\n * into rather than a column of nothing.\r\n */\r\nexport function patternFor(\r\n format: NumberFormatName | undefined,\r\n custom: string | undefined\r\n): string {\r\n if (format === \"custom\") {\r\n const trimmed = custom?.trim() ?? \"\"\r\n return trimmed === \"\" ? NUMBER_PATTERNS.plain : trimmed\r\n }\r\n return NUMBER_PATTERNS[format ?? \"plain\"] ?? NUMBER_PATTERNS.plain\r\n}\r\n"]}
1
+ {"version":3,"file":"number-format.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwD;IAClF,0EAA0E;IAC1E,4EAA4E;IAC5E,qEAAqE;IACrE,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,UAAU;CACpB,CAAA;AAiBD,8EAA8E;AAC9E,MAAM,cAAc,GAAkB;IACpC,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,KAAK;CACf,CAAA;AAED,iFAAiF;AACjF,SAAS,IAAI,CAAC,IAAY,EAAE,KAA4C;IACtE,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACf,MAAM,GAAG,CAAC,MAAM,CAAA;YAChB,SAAQ;QACV,CAAC;QACD,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACnB,CAAC;AACH,CAAC;AAED,4CAA4C;AAC5C,SAAS,OAAO,CAAC,IAAY,EAAE,EAAU;IACvC,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QACvB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM;YAAE,KAAK,GAAG,IAAI,CAAA;IACvC,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC;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AC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAClF,MAAM,IAAI,GAAG,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACzD,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,MAAoC,EACpC,MAA0B;IAE1B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACpC,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IACzD,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,eAAe,CAAC,KAAK,CAAA;AACpE,CAAC","sourcesContent":["/**\n * How a chart writes a number down.\n *\n * One formatter, driven by a **pattern**, and the named formats are patterns\n * too — `currency` is `$#,##0.00` and nothing more. That is the whole design:\n * a dropdown of four presets and a free-text pattern are otherwise two features\n * that drift, one of them gaining a thousands separator or a negative sign the\n * other never hears about. Here the preset *is* the custom case with the\n * pattern filled in, so there is one set of rules to get right.\n *\n * The grammar is the spreadsheet one, because that is where the numbers come\n * from and what an author already knows:\n *\n * | Pattern | 1234.5 | 0.07 |\n * | ------------ | --------- | ------ |\n * | `#,##0.##` | `1,234.5` | `0.07` |\n * | `0` | `1235` | `0` |\n * | `$#,##0.00` | `$1,234.50` | `$0.07` |\n * | `0.#%` | `123450%` | `7%` |\n * | `#,##0 kg` | `1,235 kg` | `0 kg` |\n *\n * - `0` is a digit that is always written, `#` one that is written only when\n * the number needs it. So `0.00` pads to two decimals and `0.##` trims.\n * - A `,` anywhere in the integer run turns grouping on; where it sits doesn't\n * matter, since `#,##0` and `#,###,##0` mean the same thing to everyone who\n * writes them.\n * - `%` scales by 100 as well as printing — that is what makes it a percent\n * rather than a suffix, and it is why `0.07` under `0.#%` is `7%`. A column\n * that is *already* in percent points wants `#,##0'%'`: quoted, so the sign\n * is printed and nothing is scaled.\n * - Anything else is literal, before the digits or after them. Quote it to be\n * sure — `'#'#,##0` prints a leading hash.\n *\n * Deliberately **not** `Intl.NumberFormat`. Its output is locale-dependent, and\n * a chart is a picture with a fixed layout: the same project rendering\n * `1,234.50` on the author's machine and `1.234,50` on the export box is a\n * silently different image, and the wider string can reflow an axis. What an\n * author wants here is the format they *typed*.\n */\n\n/** The named formats the inspector offers, plus the escape hatch. */\nexport type NumberFormatName = \"plain\" | \"number\" | \"currency\" | \"percent\" | \"custom\"\n\n/**\n * The pattern behind each named format.\n *\n * `plain` is the historic behaviour — integers bare, everything else to one\n * decimal — kept as the default so no existing chart re-labels itself. The rest\n * are the three formats a chart of money, counts or shares actually needs.\n */\nexport const NUMBER_PATTERNS: Record<Exclude<NumberFormatName, \"custom\">, string> = {\n // Ungrouped on purpose: this is what `formatMarker` did before there were\n // formats at all, and it is the default, so every chart already drawn keeps\n // the labels it has. Grouping is what the reader picks `number` for.\n plain: \"#.#\",\n number: \"#,##0.##\",\n currency: \"$#,##0.00\",\n percent: \"#,##0.#%\",\n}\n\n/** A pattern taken apart once, so formatting a tick is not a parse. */\ninterface ParsedPattern {\n prefix: string\n suffix: string\n grouped: boolean\n /** Digits always written left of the point — the count of `0`s there. */\n minInt: number\n /** Digits always written right of it. */\n minFrac: number\n /** The most that may be written right of it. */\n maxFrac: number\n /** Scale by 100 and print a `%`. */\n percent: boolean\n}\n\n/** What a pattern with no digits in it falls back to: the `plain` reading. */\nconst DEFAULT_PARSED: ParsedPattern = {\n prefix: \"\",\n suffix: \"\",\n grouped: false,\n minInt: 1,\n minFrac: 0,\n maxFrac: 1,\n percent: false,\n}\n\n/** Walk `text`, calling `visit` with each character and whether it is quoted. */\nfunction scan(text: string, visit: (ch: string, quoted: boolean) => void): void {\n let quoted = false\n for (const ch of text) {\n if (ch === \"'\") {\n quoted = !quoted\n continue\n }\n visit(ch, quoted)\n }\n}\n\n/** Does `text` hold `ch` outside quotes? */\nfunction hasBare(text: string, ch: string): boolean {\n let found = false\n scan(text, (c, quoted) => {\n if (c === ch && !quoted) found = true\n })\n return found\n}\n\n/** `text` with every unquoted `ch` dropped, quoting preserved. */\nfunction removeBare(text: string, ch: string): string {\n let out = \"\"\n let quoted = false\n for (const c of text) {\n if (c === \"'\") {\n quoted = !quoted\n out += c\n continue\n }\n if (c === ch && !quoted) continue\n out += c\n }\n return out\n}\n\n/** `text` with its quotes taken off — what actually gets printed. */\nfunction literal(text: string): string {\n let out = \"\"\n scan(text, (ch) => {\n out += ch\n })\n return out\n}\n\n/**\n * The `[start, end)` of the pattern's digit run — the first stretch of `#0,.`\n * outside quotes.\n *\n * Quote-aware, so `'#'#,##0` reads its leading hash as text and its run as the\n * three characters after it. Without that, a quoted `#` would be taken for the\n * number and the real digits for a suffix.\n */\nfunction digitRun(pattern: string): [number, number] | null {\n let quoted = false\n let start = -1\n for (let i = 0; i < pattern.length; i++) {\n const ch = pattern[i]\n if (ch === \"'\") {\n quoted = !quoted\n if (start >= 0) return [start, i]\n continue\n }\n const isDigit = !quoted && \"#0,.\".includes(ch)\n if (isDigit && start < 0) start = i\n else if (!isDigit && start >= 0) return [start, i]\n }\n return start < 0 ? null : [start, pattern.length]\n}\n\n/**\n * Split `pattern` into its literal edges and its digit run.\n *\n * Everything before the run is a prefix and everything after it a suffix, which\n * is what lets `$#,##0.00`, `#,##0 kg` and `€ #,##0` all work without the\n * language needing a quoting rule for the parts that are only ever text.\n */\nfunction parsePattern(pattern: string): ParsedPattern {\n const run = digitRun(pattern)\n if (!run) {\n // No digits at all is not a number format. Fall back rather than print the\n // literal for every tick, which would read as an axis of identical labels.\n return DEFAULT_PARSED\n }\n\n const digits = pattern.slice(run[0], run[1])\n const rawPrefix = pattern.slice(0, run[0])\n const rawSuffix = pattern.slice(run[1])\n\n // An **unquoted** `%` is the percent operator; a quoted one is a sign the\n // author wants printed over data that is already in percent points.\n const percent = hasBare(rawPrefix, \"%\") || hasBare(rawSuffix, \"%\")\n const prefix = literal(percent ? removeBare(rawPrefix, \"%\") : rawPrefix)\n const suffix = literal(percent ? removeBare(rawSuffix, \"%\") : rawSuffix)\n\n const point = digits.indexOf(\".\")\n const intPart = point < 0 ? digits : digits.slice(0, point)\n const fracPart = point < 0 ? \"\" : digits.slice(point + 1)\n\n const count = (s: string, ch: string) => s.split(ch).length - 1\n\n return {\n prefix,\n suffix: percent ? `${suffix}%` : suffix,\n grouped: intPart.includes(\",\"),\n minInt: Math.max(1, count(intPart, \"0\")),\n minFrac: count(fracPart, \"0\"),\n maxFrac: fracPart.length,\n percent,\n }\n}\n\n/** Parsed patterns are reused across every tick of every frame. */\nconst cache = new Map<string, ParsedPattern>()\n\nfunction parsed(pattern: string): ParsedPattern {\n const held = cache.get(pattern)\n if (held) return held\n const next = parsePattern(pattern)\n cache.set(pattern, next)\n return next\n}\n\n/** `1234567` → `1,234,567`. Only the integer run is grouped. */\nfunction group(digits: string): string {\n return digits.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")\n}\n\n/**\n * `value` written the way `pattern` says.\n *\n * A non-finite value prints empty rather than `NaN`: a tick with no number\n * behind it is a tick that shouldn't caption itself, and `NaN` on an axis reads\n * as a broken chart rather than as missing data.\n */\nexport function formatNumber(value: number, pattern: string): string {\n if (!Number.isFinite(value)) return \"\"\n const p = parsed(pattern)\n\n const scaled = p.percent ? value * 100 : value\n const rounded = scaled.toFixed(p.maxFrac)\n // Rounding is what decides the sign, not the input: -0.001 at two decimals is\n // \"0.00\", and printing it as \"-0.00\" puts a minus sign on an axis's zero.\n const negative = rounded.startsWith(\"-\")\n const [rawInt = \"0\", rawFrac = \"\"] = (\n negative ? rounded.slice(1) : rounded\n ).split(\".\")\n\n const intDigits = rawInt.padStart(p.minInt, \"0\")\n // `#` trims, `0` pads: drop trailing zeros down to the required minimum.\n let frac = rawFrac\n while (frac.length > p.minFrac && frac.endsWith(\"0\")) frac = frac.slice(0, -1)\n\n const body = (p.grouped ? group(intDigits) : intDigits) + (frac ? `.${frac}` : \"\")\n const sign = negative && Number(rounded) !== 0 ? \"-\" : \"\"\n return `${sign}${p.prefix}${body}${p.suffix}`\n}\n\n/**\n * The pattern a `(format, custom)` pair names.\n *\n * A blank custom pattern falls back to the plain one rather than to the empty\n * string, so an axis switched to Custom is readable while it is being typed\n * into rather than a column of nothing.\n */\nexport function patternFor(\n format: NumberFormatName | undefined,\n custom: string | undefined\n): string {\n if (format === \"custom\") {\n const trimmed = custom?.trim() ?? \"\"\n return trimmed === \"\" ? NUMBER_PATTERNS.plain : trimmed\n }\n return NUMBER_PATTERNS[format ?? \"plain\"] ?? NUMBER_PATTERNS.plain\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"number-pattern.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,UAAU;IACV,SAAS;IACT,QAAQ;CACA,CAAA;AAIV,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAcrC;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA4B;IAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,mBAAmB,EACnB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAChD,CAAA;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,MAAM,IAAI,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAA;IAEpC,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,CAAA;IACnD,CAAC;IACD,6EAA6E;IAC7E,4EAA4E;IAC5E,0EAA0E;IAC1E,qDAAqD;IACrD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,GAAG,CAAA;IACnD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,MAAc;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAA;AAC7C,CAAC","sourcesContent":["/**\r\n * The Number node's format controls, resolved into the one pattern the app's\r\n * formatter takes.\r\n *\r\n * There is already exactly one answer in this package to \"how is a number\r\n * written down\" — `./number-format`, whose docblock has the grammar and\r\n * the argument for it. This module adds no second one. What it adds is the\r\n * *panel's* half: a figure on the canvas is set up by picking a format and\r\n * saying how many decimals, where a chart axis is set up by picking a preset,\r\n * and those two are the same statement typed differently.\r\n *\r\n * So the controls compose a pattern rather than being honoured beside one. A\r\n * Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through\r\n * the same parser and round the same way, which is the thing that would drift\r\n * if the node reached for `Intl.NumberFormat` instead.\r\n */\r\n\r\nimport { patternFor } from \"./number-format\";\r\n\r\n/**\r\n * How a Number node writes its figure.\r\n *\r\n * The chart's five minus `plain`, which exists there only to keep charts drawn\r\n * before there were formats labelling themselves the way they always have. A\r\n * node has no such history, and \"plain\" beside \"number\" is a distinction\r\n * nobody browsing a dropdown can make.\r\n */\r\nexport const NUMBER_NODE_FORMATS = [\r\n \"number\",\r\n \"currency\",\r\n \"percent\",\r\n \"custom\",\r\n] as const\r\n\r\nexport type NumberNodeFormat = (typeof NUMBER_NODE_FORMATS)[number]\r\n\r\n/** The most decimals the panel will let a figure carry. */\r\nexport const MAX_FRACTION_DIGITS = 10\r\n\r\n/** The Number node's format controls, as the class holds them. */\r\nexport interface NumberFormatOptions {\r\n /** How the figure is written — see {@link NumberNode.format}. */\r\n format: string\r\n /** The pattern typed by hand — read only when the format is `custom`. */\r\n customPattern: string\r\n fractionDigits: number\r\n grouped: boolean\r\n /** Printed before the figure when the format is `currency`. */\r\n currencySymbol: string\r\n}\r\n\r\n/**\r\n * The pattern `options` names.\r\n *\r\n * `custom` hands the typed pattern straight to {@link patternFor}, which is what\r\n * makes the escape hatch the *same* language the presets are written in rather\r\n * than a second one. Every other format is composed here, because the three\r\n * controls beside the dropdown — decimals, grouping, the symbol — are what a\r\n * preset would otherwise have to be duplicated for (`#,##0.00` and `#,##0.000`\r\n * and `0.00` and…).\r\n */\r\nexport function numberNodePattern(options: NumberFormatOptions): string {\r\n if (options.format === \"custom\") {\r\n return patternFor(\"custom\", options.customPattern)\r\n }\r\n\r\n const digits = Math.min(\r\n MAX_FRACTION_DIGITS,\r\n Math.max(0, Math.round(options.fractionDigits))\r\n )\r\n const integer = options.grouped ? \"#,##0\" : \"0\"\r\n const fraction = digits > 0 ? `.${\"0\".repeat(digits)}` : \"\"\r\n const body = `${integer}${fraction}`\r\n\r\n if (options.format === \"currency\") {\r\n return `${quoted(options.currencySymbol)}${body}`\r\n }\r\n // Bare, so the parser reads it as the percent *operator* and scales by 100 —\r\n // which is what makes a stored 0.42 read as \"42%\". A symbol an author wants\r\n // printed over data that is already in percent points is a custom pattern\r\n // with the sign quoted, exactly as it is on an axis.\r\n if (options.format === \"percent\") return `${body}%`\r\n return body\r\n}\r\n\r\n/**\r\n * `symbol` as a pattern literal.\r\n *\r\n * Quoted rather than concatenated, because the two most likely symbols after `$`\r\n * are `€` and `£` and the two after those are whatever an author types — and an\r\n * unquoted `#`, `0`, `,`, `.` or `%` in there would be read as part of the\r\n * number. The quote character itself is dropped rather than escaped: the grammar\r\n * has no escape for it, and a currency symbol containing an apostrophe is not a\r\n * thing anyone has.\r\n */\r\nfunction quoted(symbol: string): string {\r\n const literal = symbol.replaceAll(\"'\", \"\")\r\n return literal === \"\" ? \"\" : `'${literal}'`\r\n}\r\n"]}
1
+ {"version":3,"file":"number-pattern.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/number-pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,UAAU;IACV,SAAS;IACT,QAAQ;CACA,CAAA;AAIV,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAcrC;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA4B;IAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,mBAAmB,EACnB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAChD,CAAA;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3D,MAAM,IAAI,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAA;IAEpC,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,EAAE,CAAA;IACnD,CAAC;IACD,6EAA6E;IAC7E,4EAA4E;IAC5E,0EAA0E;IAC1E,qDAAqD;IACrD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,IAAI,GAAG,CAAA;IACnD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,MAAc;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAA;AAC7C,CAAC","sourcesContent":["/**\n * The Number node's format controls, resolved into the one pattern the app's\n * formatter takes.\n *\n * There is already exactly one answer in this package to \"how is a number\n * written down\" — `./number-format`, whose docblock has the grammar and\n * the argument for it. This module adds no second one. What it adds is the\n * *panel's* half: a figure on the canvas is set up by picking a format and\n * saying how many decimals, where a chart axis is set up by picking a preset,\n * and those two are the same statement typed differently.\n *\n * So the controls compose a pattern rather than being honoured beside one. A\n * Number node showing `$1,234.50` and an axis labelled `$#,##0.00` go through\n * the same parser and round the same way, which is the thing that would drift\n * if the node reached for `Intl.NumberFormat` instead.\n */\n\nimport { patternFor } from \"./number-format\";\n\n/**\n * How a Number node writes its figure.\n *\n * The chart's five minus `plain`, which exists there only to keep charts drawn\n * before there were formats labelling themselves the way they always have. A\n * node has no such history, and \"plain\" beside \"number\" is a distinction\n * nobody browsing a dropdown can make.\n */\nexport const NUMBER_NODE_FORMATS = [\n \"number\",\n \"currency\",\n \"percent\",\n \"custom\",\n] as const\n\nexport type NumberNodeFormat = (typeof NUMBER_NODE_FORMATS)[number]\n\n/** The most decimals the panel will let a figure carry. */\nexport const MAX_FRACTION_DIGITS = 10\n\n/** The Number node's format controls, as the class holds them. */\nexport interface NumberFormatOptions {\n /** How the figure is written — see {@link NumberNode.format}. */\n format: string\n /** The pattern typed by hand — read only when the format is `custom`. */\n customPattern: string\n fractionDigits: number\n grouped: boolean\n /** Printed before the figure when the format is `currency`. */\n currencySymbol: string\n}\n\n/**\n * The pattern `options` names.\n *\n * `custom` hands the typed pattern straight to {@link patternFor}, which is what\n * makes the escape hatch the *same* language the presets are written in rather\n * than a second one. Every other format is composed here, because the three\n * controls beside the dropdown — decimals, grouping, the symbol — are what a\n * preset would otherwise have to be duplicated for (`#,##0.00` and `#,##0.000`\n * and `0.00` and…).\n */\nexport function numberNodePattern(options: NumberFormatOptions): string {\n if (options.format === \"custom\") {\n return patternFor(\"custom\", options.customPattern)\n }\n\n const digits = Math.min(\n MAX_FRACTION_DIGITS,\n Math.max(0, Math.round(options.fractionDigits))\n )\n const integer = options.grouped ? \"#,##0\" : \"0\"\n const fraction = digits > 0 ? `.${\"0\".repeat(digits)}` : \"\"\n const body = `${integer}${fraction}`\n\n if (options.format === \"currency\") {\n return `${quoted(options.currencySymbol)}${body}`\n }\n // Bare, so the parser reads it as the percent *operator* and scales by 100 —\n // which is what makes a stored 0.42 read as \"42%\". A symbol an author wants\n // printed over data that is already in percent points is a custom pattern\n // with the sign quoted, exactly as it is on an axis.\n if (options.format === \"percent\") return `${body}%`\n return body\n}\n\n/**\n * `symbol` as a pattern literal.\n *\n * Quoted rather than concatenated, because the two most likely symbols after `$`\n * are `€` and `£` and the two after those are whatever an author types — and an\n * unquoted `#`, `0`, `,`, `.` or `%` in there would be read as part of the\n * number. The quote character itself is dropped rather than escaped: the grammar\n * has no escape for it, and a currency symbol containing an apostrophe is not a\n * thing anyone has.\n */\nfunction quoted(symbol: string): string {\n const literal = symbol.replaceAll(\"'\", \"\")\n return literal === \"\" ? \"\" : `'${literal}'`\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"text-defaults.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,IAAI,cAAc,GAAG,EAAE,CAAA;AAEvB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,cAAc,GAAG,MAAM,CAAA;AACzB,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["/**\r\n * The family a component's text falls back to when the document names none.\r\n *\r\n * A node that draws a caption of its own — a button's label, a window's title —\r\n * has to put *some* family on it, because the renderer's font provider holds\r\n * only what the manifest registered and a family called `\"\"` shapes against\r\n * nothing and paints no glyphs. Which family that is, though, is a fact about\r\n * the application: which fonts it vendored, which it licensed, what its UI is\r\n * set in. A component shipped as its own package cannot know it, and the engine\r\n * has no built-in family to offer in its place.\r\n *\r\n * So the answer is *supplied*, once, by the host application's composition\r\n * root, through {@link setHostTextFamily}. Until a host does, the answer is\r\n * `\"\"`, and a host that ships a typeface says so instead of every node learning\r\n * its name.\r\n *\r\n * This is deliberately **not** a prop. The prop is the node's own `fontFamily`,\r\n * which a host's props mapping can fill in from here when the author has left\r\n * it empty. What lives here is only the answer to \"empty means what?\", which is\r\n * one answer for the whole application rather than one per node.\r\n */\r\n\r\nlet fallbackFamily = \"\"\r\n\r\n/**\r\n * Declares the family this application's components fall back to.\r\n *\r\n * Called by the composition root before the first build. Left unset, components\r\n * fall back to `\"\"`, which paints no glyphs — a legible blank rather than a\r\n * silently wrong typeface, and the same bargain an unregistered node type makes.\r\n */\r\nexport function setHostTextFamily(family: string): void {\r\n fallbackFamily = family\r\n}\r\n\r\n/** The family to use where the document names none. */\r\nexport function hostTextFamily(): string {\r\n return fallbackFamily\r\n}\r\n"]}
1
+ {"version":3,"file":"text-defaults.js","sourceRoot":"","sources":["../../../../src/components/builtins/text/text-defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,IAAI,cAAc,GAAG,EAAE,CAAA;AAEvB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,cAAc,GAAG,MAAM,CAAA;AACzB,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["/**\n * The family a component's text falls back to when the document names none.\n *\n * A node that draws a caption of its own — a button's label, a window's title —\n * has to put *some* family on it, because the renderer's font provider holds\n * only what the manifest registered and a family called `\"\"` shapes against\n * nothing and paints no glyphs. Which family that is, though, is a fact about\n * the application: which fonts it vendored, which it licensed, what its UI is\n * set in. A component shipped as its own package cannot know it, and the engine\n * has no built-in family to offer in its place.\n *\n * So the answer is *supplied*, once, by the host application's composition\n * root, through {@link setHostTextFamily}. Until a host does, the answer is\n * `\"\"`, and a host that ships a typeface says so instead of every node learning\n * its name.\n *\n * This is deliberately **not** a prop. The prop is the node's own `fontFamily`,\n * which a host's props mapping can fill in from here when the author has left\n * it empty. What lives here is only the answer to \"empty means what?\", which is\n * one answer for the whole application rather than one per node.\n */\n\nlet fallbackFamily = \"\"\n\n/**\n * Declares the family this application's components fall back to.\n *\n * Called by the composition root before the first build. Left unset, components\n * fall back to `\"\"`, which paints no glyphs — a legible blank rather than a\n * silently wrong typeface, and the same bargain an unregistered node type makes.\n */\nexport function setHostTextFamily(family: string): void {\n fallbackFamily = family\n}\n\n/** The family to use where the document names none. */\nexport function hostTextFamily(): string {\n return fallbackFamily\n}\n"]}