@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (746) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +79 -4
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +17 -2
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js.map +1 -1
  45. package/dist/attributes/audio/schedule.d.ts +4 -2
  46. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  47. package/dist/attributes/audio/schedule.js +15 -8
  48. package/dist/attributes/audio/schedule.js.map +1 -1
  49. package/dist/attributes/audio/sound.d.ts +4 -2
  50. package/dist/attributes/audio/sound.d.ts.map +1 -1
  51. package/dist/attributes/audio/sound.js +8 -4
  52. package/dist/attributes/audio/sound.js.map +1 -1
  53. package/dist/attributes/index.js.map +1 -1
  54. package/dist/attributes/layout/alignment.js +1 -1
  55. package/dist/attributes/layout/alignment.js.map +1 -1
  56. package/dist/attributes/layout/index.js.map +1 -1
  57. package/dist/attributes/layout/insets.js.map +1 -1
  58. package/dist/attributes/layout/matrix2d.js.map +1 -1
  59. package/dist/attributes/layout/size.js.map +1 -1
  60. package/dist/attributes/layout/transform3d.js.map +1 -1
  61. package/dist/attributes/layout/vector2.js.map +1 -1
  62. package/dist/attributes/layout/world-transform.js.map +1 -1
  63. package/dist/attributes/mask/boolean.js.map +1 -1
  64. package/dist/attributes/mask/mask.js.map +1 -1
  65. package/dist/attributes/properties/decorator.d.ts +3 -1
  66. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  67. package/dist/attributes/properties/decorator.js.map +1 -1
  68. package/dist/attributes/properties/inputs.js.map +1 -1
  69. package/dist/attributes/properties/typed.d.ts +9 -2
  70. package/dist/attributes/properties/typed.d.ts.map +1 -1
  71. package/dist/attributes/properties/typed.js +15 -1
  72. package/dist/attributes/properties/typed.js.map +1 -1
  73. package/dist/attributes/render3d/orbit.d.ts +8 -8
  74. package/dist/attributes/render3d/orbit.js +7 -7
  75. package/dist/attributes/render3d/orbit.js.map +1 -1
  76. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  77. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  78. package/dist/attributes/shape/corners/corners.js.map +1 -1
  79. package/dist/attributes/shape/corners/index.js.map +1 -1
  80. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  81. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  82. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  83. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  84. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  85. package/dist/attributes/shape/effects/chain.js +16 -88
  86. package/dist/attributes/shape/effects/chain.js.map +1 -1
  87. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  96. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  98. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  105. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  110. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  114. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  128. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  136. package/dist/attributes/shape/effects/index.d.ts +2 -6
  137. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  138. package/dist/attributes/shape/effects/index.js.map +1 -1
  139. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  140. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/registry.js +44 -10
  142. package/dist/attributes/shape/effects/registry.js.map +1 -1
  143. package/dist/attributes/shape/effects/union.d.ts +2 -6
  144. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/union.js.map +1 -1
  146. package/dist/attributes/shape/fill/blend.js.map +1 -1
  147. package/dist/attributes/shape/fill/chain.js.map +1 -1
  148. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  149. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  150. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  151. package/dist/attributes/shape/fill/color/parser.js +81 -44
  152. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  153. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  154. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  155. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  156. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  157. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  158. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  159. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  160. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  161. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  162. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  165. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  166. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  169. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  170. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  172. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  174. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  176. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  177. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  180. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  181. package/dist/attributes/shape/fill/index.js.map +1 -1
  182. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  183. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  184. package/dist/attributes/shape/fill/registry.js.map +1 -1
  185. package/dist/attributes/shape/fill/union.js.map +1 -1
  186. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  187. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  188. package/dist/attributes/shape/filters/chain.js +1 -13
  189. package/dist/attributes/shape/filters/chain.js.map +1 -1
  190. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  191. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  192. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  193. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  194. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  195. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  196. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  197. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  199. package/dist/attributes/shape/filters/index.d.ts +1 -1
  200. package/dist/attributes/shape/filters/index.js.map +1 -1
  201. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  202. package/dist/attributes/shape/filters/registry.js +3 -3
  203. package/dist/attributes/shape/filters/registry.js.map +1 -1
  204. package/dist/attributes/shape/filters/union.d.ts +6 -7
  205. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  206. package/dist/attributes/shape/filters/union.js.map +1 -1
  207. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  208. package/dist/attributes/shape/path/anchors.js +12 -5
  209. package/dist/attributes/shape/path/anchors.js.map +1 -1
  210. package/dist/attributes/shape/path/bezier.js.map +1 -1
  211. package/dist/attributes/shape/path/index.js.map +1 -1
  212. package/dist/attributes/shape/path/measure.js.map +1 -1
  213. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  214. package/dist/attributes/shape/path/morph.js +16 -4
  215. package/dist/attributes/shape/path/morph.js.map +1 -1
  216. package/dist/attributes/shape/path/ops.js.map +1 -1
  217. package/dist/attributes/shape/path/types.js.map +1 -1
  218. package/dist/attributes/shape/path/walk.js.map +1 -1
  219. package/dist/attributes/shape/shaders/index.js.map +1 -1
  220. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  221. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  222. package/dist/attributes/shape/shadow/index.js.map +1 -1
  223. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  224. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  225. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  226. package/dist/attributes/shape/stroke/index.js +1 -1
  227. package/dist/attributes/shape/stroke/index.js.map +1 -1
  228. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  229. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  230. package/dist/attributes/shape/stroke/stroke.js +22 -2
  231. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  232. package/dist/attributes/shared/operators.js.map +1 -1
  233. package/dist/attributes/text/index.js.map +1 -1
  234. package/dist/attributes/text/ops.d.ts +6 -0
  235. package/dist/attributes/text/ops.d.ts.map +1 -1
  236. package/dist/attributes/text/ops.js +1 -0
  237. package/dist/attributes/text/ops.js.map +1 -1
  238. package/dist/attributes/text/types.js.map +1 -1
  239. package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
  240. package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
  241. package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
  242. package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
  243. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  244. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  245. package/dist/browser/component.js +1 -1
  246. package/dist/browser/component.js.map +1 -1
  247. package/dist/browser/index.js +1 -1
  248. package/dist/browser/index.js.map +4 -4
  249. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  250. package/dist/browser/jsx-jsx-runtime.js +1 -1
  251. package/dist/browser/manifest.json +3 -2
  252. package/dist/browser/sdk.js +1 -1
  253. package/dist/component.js.map +1 -1
  254. package/dist/document/audio.d.ts +1 -1
  255. package/dist/document/audio.js +4 -4
  256. package/dist/document/audio.js.map +1 -1
  257. package/dist/document/builtins.d.ts.map +1 -1
  258. package/dist/document/builtins.js +8 -14
  259. package/dist/document/builtins.js.map +1 -1
  260. package/dist/document/command-traits.d.ts +1 -1
  261. package/dist/document/command-traits.js +13 -1
  262. package/dist/document/command-traits.js.map +1 -1
  263. package/dist/document/deny-globals.js.map +1 -1
  264. package/dist/document/diff.js.map +1 -1
  265. package/dist/document/doc-index.d.ts +2 -2
  266. package/dist/document/doc-index.d.ts.map +1 -1
  267. package/dist/document/doc-index.js.map +1 -1
  268. package/dist/document/expression/compile.d.ts.map +1 -1
  269. package/dist/document/expression/compile.js +8 -5
  270. package/dist/document/expression/compile.js.map +1 -1
  271. package/dist/document/expression/index.js.map +1 -1
  272. package/dist/document/expression/ops.js +1 -1
  273. package/dist/document/expression/ops.js.map +1 -1
  274. package/dist/document/expression/parse.d.ts.map +1 -1
  275. package/dist/document/expression/parse.js +15 -6
  276. package/dist/document/expression/parse.js.map +1 -1
  277. package/dist/document/expression/refs.d.ts +1 -1
  278. package/dist/document/expression/refs.js +1 -1
  279. package/dist/document/expression/refs.js.map +1 -1
  280. package/dist/document/expression/types.js.map +1 -1
  281. package/dist/document/expression/walk.d.ts.map +1 -1
  282. package/dist/document/expression/walk.js +2 -1
  283. package/dist/document/expression/walk.js.map +1 -1
  284. package/dist/document/index.d.ts +2 -0
  285. package/dist/document/index.d.ts.map +1 -1
  286. package/dist/document/index.js +2 -0
  287. package/dist/document/index.js.map +1 -1
  288. package/dist/document/node-decorator.js.map +1 -1
  289. package/dist/document/node-descriptor.d.ts +19 -0
  290. package/dist/document/node-descriptor.d.ts.map +1 -1
  291. package/dist/document/node-descriptor.js.map +1 -1
  292. package/dist/document/placement.d.ts +70 -0
  293. package/dist/document/placement.d.ts.map +1 -0
  294. package/dist/document/placement.js +83 -0
  295. package/dist/document/placement.js.map +1 -0
  296. package/dist/document/project.d.ts +2 -2
  297. package/dist/document/project.d.ts.map +1 -1
  298. package/dist/document/project.js.map +1 -1
  299. package/dist/document/registry.d.ts +17 -0
  300. package/dist/document/registry.d.ts.map +1 -1
  301. package/dist/document/registry.js +29 -2
  302. package/dist/document/registry.js.map +1 -1
  303. package/dist/document/timeline-patch.js.map +1 -1
  304. package/dist/document/timeline.d.ts +73 -18
  305. package/dist/document/timeline.d.ts.map +1 -1
  306. package/dist/document/timeline.js +192 -40
  307. package/dist/document/timeline.js.map +1 -1
  308. package/dist/document/types.d.ts +12 -12
  309. package/dist/document/types.d.ts.map +1 -1
  310. package/dist/document/types.js +2 -2
  311. package/dist/document/types.js.map +1 -1
  312. package/dist/document/validate.d.ts +2 -2
  313. package/dist/document/validate.d.ts.map +1 -1
  314. package/dist/document/validate.js +37 -31
  315. package/dist/document/validate.js.map +1 -1
  316. package/dist/document/withdraw.d.ts +28 -0
  317. package/dist/document/withdraw.d.ts.map +1 -0
  318. package/dist/document/withdraw.js +61 -0
  319. package/dist/document/withdraw.js.map +1 -0
  320. package/dist/index.d.ts +1 -0
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +1 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  325. package/dist/jsx/jsx-runtime.d.ts +9 -1
  326. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  327. package/dist/jsx/jsx-runtime.js +13 -3
  328. package/dist/jsx/jsx-runtime.js.map +1 -1
  329. package/dist/layout/bounds.d.ts +0 -1
  330. package/dist/layout/bounds.d.ts.map +1 -1
  331. package/dist/layout/bounds.js.map +1 -1
  332. package/dist/layout/constraints.js.map +1 -1
  333. package/dist/layout/flex.d.ts +4 -2
  334. package/dist/layout/flex.d.ts.map +1 -1
  335. package/dist/layout/flex.js +27 -11
  336. package/dist/layout/flex.js.map +1 -1
  337. package/dist/layout/freeform.js.map +1 -1
  338. package/dist/layout/grid.js.map +1 -1
  339. package/dist/layout/index.js.map +1 -1
  340. package/dist/layout/item.js.map +1 -1
  341. package/dist/layout/ops.d.ts +6 -0
  342. package/dist/layout/ops.d.ts.map +1 -1
  343. package/dist/layout/ops.js +6 -0
  344. package/dist/layout/ops.js.map +1 -1
  345. package/dist/layout/types.js.map +1 -1
  346. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  347. package/dist/nodes/2d/node-motion.js.map +1 -1
  348. package/dist/nodes/2d/node-render.d.ts +3 -3
  349. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  350. package/dist/nodes/2d/node-render.js.map +1 -1
  351. package/dist/nodes/2d/node-transform.js.map +1 -1
  352. package/dist/nodes/2d/node2d.d.ts +115 -3
  353. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  354. package/dist/nodes/2d/node2d.js +180 -28
  355. package/dist/nodes/2d/node2d.js.map +1 -1
  356. package/dist/nodes/2d/paint-node.d.ts +27 -0
  357. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  358. package/dist/nodes/2d/paint-node.js +42 -0
  359. package/dist/nodes/2d/paint-node.js.map +1 -1
  360. package/dist/nodes/audio/audio-bus.js.map +1 -1
  361. package/dist/nodes/audio/index.js.map +1 -1
  362. package/dist/nodes/audio/node-audio.js.map +1 -1
  363. package/dist/nodes/audio/sound-node.d.ts +2 -2
  364. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  365. package/dist/nodes/audio/sound-node.js +1 -1
  366. package/dist/nodes/audio/sound-node.js.map +1 -1
  367. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  368. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  369. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  370. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  371. package/dist/nodes/geometry/box-path-node.js +2 -2
  372. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  373. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  374. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  375. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  376. package/dist/nodes/geometry/group-bounds.js +1 -2
  377. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  378. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  379. package/dist/nodes/geometry/path-node.js +6 -0
  380. package/dist/nodes/geometry/path-node.js.map +1 -1
  381. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  382. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  383. package/dist/nodes/geometry/rect-node.js.map +1 -1
  384. package/dist/nodes/geometry/shape-node.js.map +1 -1
  385. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  386. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  387. package/dist/nodes/geometry/shape-outline.js +2 -13
  388. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  389. package/dist/nodes/index.d.ts +3 -8
  390. package/dist/nodes/index.d.ts.map +1 -1
  391. package/dist/nodes/index.js +3 -8
  392. package/dist/nodes/index.js.map +1 -1
  393. package/dist/nodes/layout/camera-node.d.ts +9 -0
  394. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  395. package/dist/nodes/layout/camera-node.js +38 -3
  396. package/dist/nodes/layout/camera-node.js.map +1 -1
  397. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  398. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  399. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  400. package/dist/nodes/layout/rotated-box.js.map +1 -1
  401. package/dist/nodes/media/video-node.d.ts.map +1 -1
  402. package/dist/nodes/media/video-node.js +2 -0
  403. package/dist/nodes/media/video-node.js.map +1 -1
  404. package/dist/nodes/node/declare-paints.js.map +1 -1
  405. package/dist/nodes/node/node-editor-state.js.map +1 -1
  406. package/dist/nodes/node/node-reactive.js.map +1 -1
  407. package/dist/nodes/node/node-time.d.ts +3 -3
  408. package/dist/nodes/node/node-time.d.ts.map +1 -1
  409. package/dist/nodes/node/node-time.js +1 -1
  410. package/dist/nodes/node/node-time.js.map +1 -1
  411. package/dist/nodes/node/node-walk.js.map +1 -1
  412. package/dist/nodes/node/node.d.ts +5 -3
  413. package/dist/nodes/node/node.d.ts.map +1 -1
  414. package/dist/nodes/node/node.js +44 -19
  415. package/dist/nodes/node/node.js.map +1 -1
  416. package/dist/nodes/node/text-defaults.d.ts +10 -12
  417. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  418. package/dist/nodes/node/text-defaults.js +10 -12
  419. package/dist/nodes/node/text-defaults.js.map +1 -1
  420. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
  421. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  422. package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
  423. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  424. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  425. package/dist/nodes/root/provider-node.js.map +1 -0
  426. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  427. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  428. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  429. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  430. package/dist/nodes/text/default-text-style-node.js +10 -4
  431. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  432. package/dist/nodes/text/number-format.d.ts +1 -1
  433. package/dist/nodes/text/number-format.js +1 -1
  434. package/dist/nodes/text/number-format.js.map +1 -1
  435. package/dist/nodes/text/number-node.js.map +1 -1
  436. package/dist/nodes/text/number-pattern.js.map +1 -1
  437. package/dist/nodes/text/richtext-node.js +1 -1
  438. package/dist/nodes/text/richtext-node.js.map +1 -1
  439. package/dist/nodes/text/text-base.d.ts.map +1 -1
  440. package/dist/nodes/text/text-base.js +1 -1
  441. package/dist/nodes/text/text-base.js.map +1 -1
  442. package/dist/nodes/text/text-node.js.map +1 -1
  443. package/dist/nodes/text/text-selection.js.map +1 -1
  444. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  445. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  446. package/dist/nodes/three/camera-nodes.js +42 -1
  447. package/dist/nodes/three/camera-nodes.js.map +1 -1
  448. package/dist/nodes/three/canvas3d-node.d.ts +29 -6
  449. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  450. package/dist/nodes/three/canvas3d-node.js +44 -2
  451. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  452. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  453. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  454. package/dist/nodes/three/drawable-nodes.js +43 -13
  455. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  456. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  457. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  458. package/dist/nodes/three/environment-nodes.js.map +1 -1
  459. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  460. package/dist/nodes/three/geometry-nodes.js +2 -2
  461. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  462. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  463. package/dist/nodes/three/group3d.js.map +1 -1
  464. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  465. package/dist/nodes/three/light-nodes.js +3 -3
  466. package/dist/nodes/three/light-nodes.js.map +1 -1
  467. package/dist/nodes/three/mesh3d.js.map +1 -1
  468. package/dist/nodes/three/node3d.d.ts +48 -0
  469. package/dist/nodes/three/node3d.d.ts.map +1 -1
  470. package/dist/nodes/three/node3d.js +53 -3
  471. package/dist/nodes/three/node3d.js.map +1 -1
  472. package/dist/platform/audio-sink.d.ts +2 -2
  473. package/dist/platform/audio-sink.d.ts.map +1 -1
  474. package/dist/platform/audio-sink.js.map +1 -1
  475. package/dist/platform/exporter.d.ts +13 -8
  476. package/dist/platform/exporter.d.ts.map +1 -1
  477. package/dist/platform/exporter.js.map +1 -1
  478. package/dist/platform/index.d.ts +1 -1
  479. package/dist/platform/index.d.ts.map +1 -1
  480. package/dist/platform/index.js.map +1 -1
  481. package/dist/platform/stepped-clock.js.map +1 -1
  482. package/dist/platform/storage-adapter.d.ts +12 -6
  483. package/dist/platform/storage-adapter.d.ts.map +1 -1
  484. package/dist/platform/storage-adapter.js +4 -0
  485. package/dist/platform/storage-adapter.js.map +1 -1
  486. package/dist/platform/ticker.d.ts +6 -0
  487. package/dist/platform/ticker.d.ts.map +1 -1
  488. package/dist/platform/ticker.js +6 -0
  489. package/dist/platform/ticker.js.map +1 -1
  490. package/dist/project/config.js.map +1 -1
  491. package/dist/project/index.js.map +1 -1
  492. package/dist/project/tree.d.ts +3 -3
  493. package/dist/project/tree.d.ts.map +1 -1
  494. package/dist/project/tree.js.map +1 -1
  495. package/dist/props/host.js.map +1 -1
  496. package/dist/props/index.js.map +1 -1
  497. package/dist/props/observer.js.map +1 -1
  498. package/dist/props/slot.js.map +1 -1
  499. package/dist/renamed-scene-names.d.ts +17 -0
  500. package/dist/renamed-scene-names.d.ts.map +1 -0
  501. package/dist/renamed-scene-names.js +9 -0
  502. package/dist/renamed-scene-names.js.map +1 -0
  503. package/dist/render/canvas-render-context2d.d.ts +2 -2
  504. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  505. package/dist/render/canvas-render-context2d.js.map +1 -1
  506. package/dist/render/clip-contains.js.map +1 -1
  507. package/dist/render/clip.js.map +1 -1
  508. package/dist/render/descriptors/ellipse.js.map +1 -1
  509. package/dist/render/descriptors/latex.js.map +1 -1
  510. package/dist/render/descriptors/line.js.map +1 -1
  511. package/dist/render/descriptors/path-builder.js.map +1 -1
  512. package/dist/render/descriptors/path.js.map +1 -1
  513. package/dist/render/descriptors/polygon.js.map +1 -1
  514. package/dist/render/descriptors/polygram.js.map +1 -1
  515. package/dist/render/descriptors/rect.js.map +1 -1
  516. package/dist/render/descriptors/richtext.js.map +1 -1
  517. package/dist/render/descriptors/shape.d.ts +12 -0
  518. package/dist/render/descriptors/shape.d.ts.map +1 -1
  519. package/dist/render/descriptors/shape.js.map +1 -1
  520. package/dist/render/descriptors/text.d.ts +2 -2
  521. package/dist/render/descriptors/text.js +2 -2
  522. package/dist/render/descriptors/text.js.map +1 -1
  523. package/dist/render/descriptors/transform.d.ts +2 -2
  524. package/dist/render/descriptors/transform.d.ts.map +1 -1
  525. package/dist/render/descriptors/transform.js.map +1 -1
  526. package/dist/render/graphics2d.d.ts +3 -3
  527. package/dist/render/graphics2d.d.ts.map +1 -1
  528. package/dist/render/graphics2d.js +1 -1
  529. package/dist/render/graphics2d.js.map +1 -1
  530. package/dist/render/index.js.map +1 -1
  531. package/dist/render/measure-context.js.map +1 -1
  532. package/dist/render/null-render-context.js.map +1 -1
  533. package/dist/render/render-context2d.d.ts +2 -2
  534. package/dist/render/render-context2d.d.ts.map +1 -1
  535. package/dist/render/render-context2d.js.map +1 -1
  536. package/dist/render/surface.js.map +1 -1
  537. package/dist/render/text-defaults.js.map +1 -1
  538. package/dist/render/text-layout.js.map +1 -1
  539. package/dist/render3d/bounds3d.d.ts.map +1 -1
  540. package/dist/render3d/bounds3d.js +4 -2
  541. package/dist/render3d/bounds3d.js.map +1 -1
  542. package/dist/render3d/builders.js.map +1 -1
  543. package/dist/render3d/camera.d.ts +6 -0
  544. package/dist/render3d/camera.d.ts.map +1 -1
  545. package/dist/render3d/camera.js +5 -3
  546. package/dist/render3d/camera.js.map +1 -1
  547. package/dist/render3d/fill3d.d.ts +2 -9
  548. package/dist/render3d/fill3d.d.ts.map +1 -1
  549. package/dist/render3d/fill3d.js +2 -13
  550. package/dist/render3d/fill3d.js.map +1 -1
  551. package/dist/render3d/geometry.d.ts +8 -1
  552. package/dist/render3d/geometry.d.ts.map +1 -1
  553. package/dist/render3d/geometry.js.map +1 -1
  554. package/dist/render3d/graphics3d.d.ts +8 -4
  555. package/dist/render3d/graphics3d.d.ts.map +1 -1
  556. package/dist/render3d/graphics3d.js +18 -10
  557. package/dist/render3d/graphics3d.js.map +1 -1
  558. package/dist/render3d/index.d.ts +1 -1
  559. package/dist/render3d/index.js +1 -1
  560. package/dist/render3d/index.js.map +1 -1
  561. package/dist/render3d/inert.d.ts +14 -0
  562. package/dist/render3d/inert.d.ts.map +1 -0
  563. package/dist/render3d/inert.js +62 -0
  564. package/dist/render3d/inert.js.map +1 -0
  565. package/dist/render3d/light.js.map +1 -1
  566. package/dist/render3d/material.d.ts +10 -5
  567. package/dist/render3d/material.d.ts.map +1 -1
  568. package/dist/render3d/material.js.map +1 -1
  569. package/dist/render3d/matrix4.js.map +1 -1
  570. package/dist/render3d/render-context3d.js.map +1 -1
  571. package/dist/render3d/resources.js.map +1 -1
  572. package/dist/render3d/rounded-box.js.map +1 -1
  573. package/dist/render3d/scene-settings.d.ts +23 -4
  574. package/dist/render3d/scene-settings.d.ts.map +1 -1
  575. package/dist/render3d/scene-settings.js.map +1 -1
  576. package/dist/render3d/scene3d.d.ts +11 -0
  577. package/dist/render3d/scene3d.d.ts.map +1 -1
  578. package/dist/render3d/scene3d.js +39 -6
  579. package/dist/render3d/scene3d.js.map +1 -1
  580. package/dist/render3d/segments.js.map +1 -1
  581. package/dist/render3d/texture.d.ts +9 -0
  582. package/dist/render3d/texture.d.ts.map +1 -1
  583. package/dist/render3d/texture.js +13 -0
  584. package/dist/render3d/texture.js.map +1 -1
  585. package/dist/render3d/tracking.js.map +1 -1
  586. package/dist/render3d/transform.d.ts +1 -1
  587. package/dist/render3d/transform.js.map +1 -1
  588. package/dist/render3d/vector3.d.ts +18 -1
  589. package/dist/render3d/vector3.d.ts.map +1 -1
  590. package/dist/render3d/vector3.js +27 -0
  591. package/dist/render3d/vector3.js.map +1 -1
  592. package/dist/render3d/walk.d.ts +1 -1
  593. package/dist/render3d/walk.d.ts.map +1 -1
  594. package/dist/render3d/walk.js +5 -1
  595. package/dist/render3d/walk.js.map +1 -1
  596. package/dist/runtime/asset-refine.js.map +1 -1
  597. package/dist/runtime/asset-timeline.js.map +1 -1
  598. package/dist/runtime/asset-update.js.map +1 -1
  599. package/dist/runtime/audio-index.js.map +1 -1
  600. package/dist/runtime/builtin-context.js.map +1 -1
  601. package/dist/runtime/clip-instance.d.ts +5 -3
  602. package/dist/runtime/clip-instance.d.ts.map +1 -1
  603. package/dist/runtime/clip-instance.js +10 -6
  604. package/dist/runtime/clip-instance.js.map +1 -1
  605. package/dist/runtime/clip-store.d.ts +9 -0
  606. package/dist/runtime/clip-store.d.ts.map +1 -1
  607. package/dist/runtime/clip-store.js +19 -0
  608. package/dist/runtime/clip-store.js.map +1 -1
  609. package/dist/runtime/engine.d.ts +5 -0
  610. package/dist/runtime/engine.d.ts.map +1 -1
  611. package/dist/runtime/engine.js +2 -0
  612. package/dist/runtime/engine.js.map +1 -1
  613. package/dist/runtime/frame-time.d.ts +31 -0
  614. package/dist/runtime/frame-time.d.ts.map +1 -0
  615. package/dist/runtime/frame-time.js +29 -0
  616. package/dist/runtime/frame-time.js.map +1 -0
  617. package/dist/runtime/index.d.ts +1 -0
  618. package/dist/runtime/index.d.ts.map +1 -1
  619. package/dist/runtime/index.js +1 -0
  620. package/dist/runtime/index.js.map +1 -1
  621. package/dist/runtime/node-picking.d.ts +44 -3
  622. package/dist/runtime/node-picking.d.ts.map +1 -1
  623. package/dist/runtime/node-picking.js +118 -3
  624. package/dist/runtime/node-picking.js.map +1 -1
  625. package/dist/runtime/node-picking3d.d.ts +2 -1
  626. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  627. package/dist/runtime/node-picking3d.js +5 -2
  628. package/dist/runtime/node-picking3d.js.map +1 -1
  629. package/dist/runtime/placement.d.ts.map +1 -1
  630. package/dist/runtime/placement.js +4 -5
  631. package/dist/runtime/placement.js.map +1 -1
  632. package/dist/runtime/playback-controller.d.ts +31 -2
  633. package/dist/runtime/playback-controller.d.ts.map +1 -1
  634. package/dist/runtime/playback-controller.js +63 -6
  635. package/dist/runtime/playback-controller.js.map +1 -1
  636. package/dist/runtime/playback.js.map +1 -1
  637. package/dist/runtime/precompisition.js.map +1 -1
  638. package/dist/runtime/project-assets.js.map +1 -1
  639. package/dist/runtime/session.d.ts +9 -7
  640. package/dist/runtime/session.d.ts.map +1 -1
  641. package/dist/runtime/session.js +12 -4
  642. package/dist/runtime/session.js.map +1 -1
  643. package/dist/runtime/settle.js.map +1 -1
  644. package/dist/runtime/state-evaluator.d.ts +1 -1
  645. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  646. package/dist/runtime/state-evaluator.js +4 -3
  647. package/dist/runtime/state-evaluator.js.map +1 -1
  648. package/dist/runtime/text-geometry.js.map +1 -1
  649. package/dist/sdk/index.d.ts +19 -15
  650. package/dist/sdk/index.d.ts.map +1 -1
  651. package/dist/sdk/index.js +11 -6
  652. package/dist/sdk/index.js.map +1 -1
  653. package/dist/tween/command-decorator.d.ts +2 -0
  654. package/dist/tween/command-decorator.d.ts.map +1 -1
  655. package/dist/tween/command-decorator.js.map +1 -1
  656. package/dist/tween/command.js.map +1 -1
  657. package/dist/tween/ease/constants.d.ts.map +1 -1
  658. package/dist/tween/ease/constants.js +8 -5
  659. package/dist/tween/ease/constants.js.map +1 -1
  660. package/dist/tween/ease/curve.d.ts.map +1 -1
  661. package/dist/tween/ease/curve.js +4 -3
  662. package/dist/tween/ease/curve.js.map +1 -1
  663. package/dist/tween/ease/describe.d.ts +15 -0
  664. package/dist/tween/ease/describe.d.ts.map +1 -0
  665. package/dist/tween/ease/describe.js +37 -0
  666. package/dist/tween/ease/describe.js.map +1 -0
  667. package/dist/tween/ease/type.js.map +1 -1
  668. package/dist/tween/index.js.map +1 -1
  669. package/dist/tween/inert.js.map +1 -1
  670. package/dist/tween/lerp.js.map +1 -1
  671. package/dist/tween/loop.js.map +1 -1
  672. package/dist/tween/prepare.d.ts +3 -3
  673. package/dist/tween/prepare.js +3 -3
  674. package/dist/tween/prepare.js.map +1 -1
  675. package/dist/tween/seekable.d.ts +1 -1
  676. package/dist/tween/seekable.js.map +1 -1
  677. package/dist/tween/stepper.js.map +1 -1
  678. package/dist/tween/to-command.js.map +1 -1
  679. package/dist/util/clamp.js.map +1 -1
  680. package/dist/util/context.js.map +1 -1
  681. package/dist/util/csv.js.map +1 -1
  682. package/dist/util/generateList.js.map +1 -1
  683. package/dist/util/index.js.map +1 -1
  684. package/dist/util/metrics.d.ts +1 -1
  685. package/dist/util/metrics.js +1 -1
  686. package/dist/util/metrics.js.map +1 -1
  687. package/dist/util/random.js.map +1 -1
  688. package/dist/util/reference.js.map +1 -1
  689. package/dist/util/scheduler.js.map +1 -1
  690. package/package.json +2 -1
  691. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  692. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  693. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  694. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  695. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  696. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  697. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  698. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  699. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  700. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  701. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  702. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  703. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  704. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  705. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  706. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  707. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  708. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  709. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  710. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  711. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  712. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  713. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  714. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  715. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  716. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  717. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  718. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  719. package/dist/nodes/geometry/grid-lines.js +0 -128
  720. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  721. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  722. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  723. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  724. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  725. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  726. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  727. package/dist/nodes/geometry/line-grid-node.js +0 -127
  728. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  729. package/dist/nodes/geometry/line-node.d.ts +0 -58
  730. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  731. package/dist/nodes/geometry/line-node.js +0 -123
  732. package/dist/nodes/geometry/line-node.js.map +0 -1
  733. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  734. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  735. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  736. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  737. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  738. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  739. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  740. package/dist/nodes/scene/provider-node.js.map +0 -1
  741. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  742. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  743. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  744. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  745. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  746. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -365,7 +365,7 @@ __decorate([
365
365
  property()
366
366
  ], TextBase.prototype, "fontFamily", void 0);
367
367
  __decorate([
368
- property({ default: 48 })
368
+ property({ default: 48, tween: textOps.lerpFontSize })
369
369
  ], TextBase.prototype, "fontSize", void 0);
370
370
  __decorate([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QAAQ;IAE/B,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrC,IAAI,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI,QAAQ;QAAE,OAAO,CAAC,CAAC;IAEzH,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC;QACpG,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACd,KAAK,GAAG,CAAC,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;YAC/B,KAAK,IAAI,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACJ,KAAK,EAAE,CAAC;YACR,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import type { FontStyle, ResolvedTextRun, TextAlign, TextCase, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\nimport { textOps } from \"@/attributes/text/ops\";\nimport { PaintNode, PaintProps } from \"@/nodes/2d/paint-node\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { ContextMap } from \"@/util/context\";\nimport { SizeConstraints } from \"@/layout/constraints\";\nimport { MeasureContext2D } from \"@/render/measure-context\";\nimport { Size2D } from \"@/attributes/layout/size\";\nimport { RenderContext2D } from \"@/render/render-context2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { TextSegment, TextState } from \"@/render/descriptors/text\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\nimport { PathData } from \"@/render/descriptors/path\";\nimport { pathOps } from \"@/attributes/shape/path/ops\";\nimport { AUTOFIT_PROBE_SIZE, type TextSelection } from \"./text-selection\";\nimport { applyTextDefaults } from \"./default-text-style-node\";\n\n\n/** The fields a string is shaped and set by, shared by every node that draws glyphs. */\nexport interface TextBaseProps extends PaintProps {\n fontSize: number | 'autofit';\n fontFamily: string;\n fontWeight: number;\n fontStyle: FontStyle;\n letterSpacing: number;\n lineHeight: number;\n textAlign: TextAlign;\n verticalAlign: VerticalAlign;\n textDecoration: TextDecoration;\n textCase: TextCase;\n minFontSize: number;\n /**\n * Name of a typography preset from `theme.typography` (e.g. `\"header\"`).\n * Supplies any text-style prop (fontSize, fontWeight, …) not set explicitly\n * here. An explicit prop always wins over the preset; the preset wins over an\n * inherited `<DefaultTextStyle>`.\n */\n variant: string;\n}\n\n\n/**\n * **A node whose box is the box of some shaped glyphs.**\n *\n * Everything about setting a string in a face — the shaping props, the\n * cascade that fills them in, measuring the block, declaring the fonts it needs\n * and drawing it — and nothing about *where the string comes from*, which is\n * {@link displayText}'s and is the only thing its subclasses disagree about.\n * {@link Text} is handed one and lets an author edit it; {@link NumberNode}\n * derives one from a number and a format.\n *\n * That seam is the reason this class exists rather than `NumberNode extends\n * Text`. A figure is not a string: `append`, `prepend`, `find`, `word`,\n * `wrap` and the `text` prop itself are all operations on copy somebody typed,\n * and a number inheriting them offered an editor a Content field over a value it\n * could not write to and a \"Append Text\" command over a quantity. What the two\n * genuinely share is glyphs, and that is what is here.\n *\n * **Not `Intl`, anywhere below this.** A scene is a picture with a fixed layout;\n * see {@link NumberNode} for the argument.\n */\nexport abstract class TextBase<P extends TextBaseProps = TextBaseProps> extends PaintNode<P> {\n\n /**\n * The family this text is set in. **No default** — it comes from the cascade\n * in `applyTextDefaults`: what the author passed, else a `variant` preset,\n * else the nearest enclosing `<DefaultTextStyle>`, else the theme's `default`\n * typography preset.\n *\n * A literal default here would sit *under* all four and quietly win whenever\n * every one of them was silent, which is precisely the case worth hearing\n * about: text set in a face nobody chose is text whose font was never\n * declared and so never loaded. Left unset, the renderer says so instead —\n * see `requireFontFamily`.\n */\n @property() declare readonly fontFamily: string;\n @property({ default: 48 }) declare readonly fontSize: number | 'autofit';\n @property({ default: 400 }) declare readonly fontWeight: number;\n @property({ default: 'normal' }) declare readonly fontStyle: FontStyle;\n @property({ default: 0 }) declare readonly letterSpacing: number;\n @property({ default: 1.2 }) declare readonly lineHeight: number;\n @property({ default: 'center' }) declare readonly textAlign: TextAlign;\n @property({ default: 'center', kind: 'enum', options: ['top', 'center', 'bottom'] satisfies VerticalAlign[] })\n declare readonly verticalAlign: VerticalAlign;\n @property({ default: 'none', kind: 'enum', options: ['none', 'underline', 'line-through'] satisfies TextDecoration[] })\n declare readonly textDecoration: TextDecoration;\n @property({ default: 'none', kind: 'enum', options: ['none', 'upper', 'lower', 'title'] satisfies TextCase[] })\n declare readonly textCase: TextCase;\n @property({ default: 12 }) declare readonly minFontSize: number;\n @property({ default: undefined }) declare readonly variant?: string;\n\n /**\n * The string this node draws, this frame.\n *\n * Read fresh everywhere below rather than cached into a prop, so a subclass\n * deriving it from other props — a figure from its value and its format —\n * reformats and redraws without owning a binding of its own.\n */\n abstract displayText(): string;\n\n /** Whether long lines break — a single-line figure never does. */\n protected get wrapsText(): boolean { return false; }\n\n /** The path the glyphs ride, for a type that offers text-on-path. */\n protected get glyphPath(): PathData | null { return null; }\n\n /**\n * Live per-range style overrides — {@link Text}'s selections. A derived\n * string has no ranges anyone could have selected, so the base answers with\n * none and {@link buildSegments} keeps only the reveal window.\n */\n protected styledRuns(): readonly TextSelection[] { return []; }\n\n /** Stretches a document styles apart from the node — {@link Text}'s `runs`. */\n protected styleRuns(): readonly ResolvedTextRun[] { return []; }\n\n // Inherit text-style defaults from the nearest ancestor <DefaultTextStyle>\n // for any style prop the author didn't set. This is context-value application\n // (structure is fixed — a glyph node has no children), so it belongs in\n // resolveContext, which runs once after the tree + context exist. Writing\n // through _writeProp applies each field's own mapper (e.g. `fill`'s color\n // resolver) once.\n protected override resolveContext(ctx: ContextMap): void {\n applyTextDefaults(this, this._props as Record<string, unknown> | undefined);\n }\n\n // Glyphs don't hug/fill based on children (there are none) — they hug their\n // own glyph box by default, filling only when the box has to be resolved\n // externally: `autofit` measures glyphs against the allotted box.\n protected override applyDefaultSize(props?: NodeConfig<any, P>): void {\n const autofit = props?.fontSize === 'autofit';\n this.applyProp(\"height\", props?.height ?? (autofit ? \"fill\" : \"hug\"));\n this.applyProp(\"width\", props?.width ?? (autofit ? \"fill\" : \"hug\"));\n }\n\n measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D> {\n // Text-on-path: the visual extent is the path's bounding box, not a text\n // line box. Size the node to the path (node-local coords, like Path).\n const glyphPath = this.glyphPath;\n if (glyphPath != null) {\n const { width, height } = pathOps.size(glyphPath);\n const wm = this.width;\n const hm = this.height;\n return {\n width: typeof wm === \"number\" ? wm : wm === \"hug\" ? width : (constraints.maxWidth ?? width),\n height: typeof hm === \"number\" ? hm : hm === \"hug\" ? height : (constraints.maxHeight ?? height),\n };\n }\n\n const measureFontSize = this.fontSize === 'autofit' ? 16 : this.fontSize;\n const paragraphs = this._casedText().split(\"\\n\");\n\n // A styled run changes the box, which is why measuring cannot read the\n // node's five font fields and stop there: one word set two sizes up makes\n // the line taller and the block wider, and a node that hugs its glyphs\n // would hug a box measured for text nobody is looking at. So when\n // selections are live the intrinsic size is summed across the *pieces*,\n // each in its own style - see {@link measureStyledLines}.\n const styled = this.buildSegments();\n const lineStyles = styled === null\n ? null\n : measureStyledLines(styled, {\n fontFamily: this.fontFamily,\n fontSize: measureFontSize,\n fontStyle: this.fontStyle,\n fontWeight: this.fontWeight,\n letterSpacing: this.letterSpacing,\n });\n\n const lineH = measureFontSize * this.lineHeight;\n const intrinsicW = lineStyles\n ? Math.max(...lineStyles.map(line => line.runs.reduce(\n (w, run) => w + scope.measureText(run.text, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width,\n 0,\n )))\n : Math.max(...paragraphs.map(l => scope.measureText(l, measureFontSize, this.fontFamily, this.fontWeight, this.letterSpacing, this.fontStyle).width));\n\n const wm = this.width;\n const hm = this.height;\n\n const resolvedW = typeof wm === \"number\"\n ? wm\n : wm === \"hug\"\n ? intrinsicW\n : constraints.maxWidth ?? 0;\n\n // When wrap is on and the box has a finite width narrower than the text,\n // height needs to account for the extra lines produced by wrapping.\n const wraps = this.wrapsText && resolvedW > 0;\n // Each line is as tall as its tallest run, so raising one word's size\n // opens the leading around it rather than letting it overprint the line\n // above.\n const lineSizes = lineStyles === null\n ? null\n : wraps\n ? wrappedLineSizes(lineStyles, resolvedW, scope)\n : lineStyles.map(line => Math.max(...line.runs.map(run => run.fontSize)));\n const intrinsicH = lineSizes\n ? lineSizes.reduce((h, size) => h + size * this.lineHeight, 0)\n : (wraps\n ? paragraphs.reduce((n, p) => n + countWrappedLines(p, resolvedW, measureFontSize, this.fontFamily, this.fontWeight, scope, this.letterSpacing, this.fontStyle), 0)\n : paragraphs.length) * lineH;\n\n // \"fill\" still reports the intrinsic wrapped height when measuring —\n // it's layout (not measure) that stretches a fill child to its final\n // box. This lets a hug ancestor see the text's real content height\n // instead of an arbitrary borrowed constraint.\n const resolvedH = typeof hm === \"number\"\n ? hm\n : intrinsicH;\n\n return { width: resolvedW, height: resolvedH };\n }\n\n /**\n * Split the string into contiguous pieces at every style boundary, resolving\n * each piece's effective overrides per the overlap rule: later-created\n * selections win for transform/paint/font; opacity multiplies across all\n * selections covering the piece. Also folds in the Write On reveal window\n * (see below). Returns null when neither is active, so rendering keeps its\n * single-op path.\n *\n * Text-on-path has no pieces in v1 — the string is laid along the path as\n * one run — so a node with a path is answered `null` before anything else.\n */\n protected buildSegments(): TextSegment[] | null {\n if (this.glyphPath != null) return null;\n const active = this.styledRuns().filter(s => s.ranges.length > 0 && !s.isIdentity);\n const runs = this.styleRuns().filter(r => r.end > r.start);\n const text = this._casedText();\n if (text.length === 0) return null;\n\n // Write On: `start`/`end` are PaintNode's outline-trim fractions\n // everywhere else, but a glyph has no path to trim geometrically — this\n // CanvasKit build can't get glyph outlines at all (see\n // drawTextUnionStroke in the skia-render stroke handler). Glyph nodes\n // reinterpret the same pair as a character-reveal window instead:\n // opacity over a character range rather than a geometric trim.\n const hasReveal = this.start > 0 || this.end < 1;\n // The fast path survives both: a node with no live selection and no\n // reveal window renders as one string, exactly as it did before either\n // existed.\n if (active.length === 0 && runs.length === 0 && !hasReveal) return null;\n\n // Rounded to the nearest whole character — a hard cut, not a fade. Write\n // On reveals one character at a time, the way DaVinci's does; a fractional\n // in-between character read as an opinionated flourish nobody asked for.\n const revealStart = Math.round(this.start * text.length);\n const revealEnd = Math.round(this.end * text.length);\n\n // The size every piece starts from. `'autofit'` settles on a size the\n // *block* is measured into, which no single piece can be asked for, so\n // the segmented path shapes at the same probe size a selection's\n // `fontSize` override starts from - one number, stated in one place.\n const nodeFontSize = typeof this.fontSize === \"number\"\n ? this.fontSize\n : AUTOFIT_PROBE_SIZE;\n\n // Boundaries at every range edge so each piece is covered uniformly.\n const cuts = new Set<number>([0, text.length]);\n for (const run of runs) { cuts.add(run.start); cuts.add(run.end); }\n for (const sel of active) {\n for (const r of sel.ranges) { cuts.add(r.start); cuts.add(r.end); }\n }\n if (hasReveal) {\n cuts.add(revealStart);\n cuts.add(revealEnd);\n }\n const points = [...cuts].filter(c => c >= 0 && c <= text.length).sort((a, b) => a - b);\n\n const segments: TextSegment[] = [];\n for (let i = 0; i < points.length - 1; i++) {\n const start = points[i];\n const end = points[i + 1];\n if (end <= start) continue;\n\n const seg: TextSegment = {\n text: text.slice(start, end),\n // Every shaping field is stated, not left for the renderer to\n // fill in: a piece whose family or size differs from the node's\n // is the point of the model, and a segment that says nothing\n // about one of them would be a piece the paragraph builder\n // styles from the node while the caret measures from the\n // segment. See {@link TextSegment}.\n fontFamily: this.fontFamily,\n fontSize: nodeFontSize,\n fontStyle: this.fontStyle,\n fontWeight: this.fontWeight,\n letterSpacing: this.letterSpacing,\n textDecoration: this.textDecoration,\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n rotation: 0,\n // Default to the node's paint; selections override below. Each\n // segment is self-contained so the renderer draws runs eagerly.\n fill: this.fill as FillResolved[],\n stroke: this.stroke as StrokeResolved[],\n };\n\n // The document's styling first, so a selection animates *from* it.\n for (const run of runs) {\n if (start < run.start || end > run.end) continue;\n if (run.fontFamily !== undefined) seg.fontFamily = run.fontFamily;\n if (run.fontSize !== undefined) seg.fontSize = run.fontSize;\n if (run.fontStyle !== undefined) seg.fontStyle = run.fontStyle;\n if (run.fontWeight !== undefined) seg.fontWeight = run.fontWeight;\n if (run.letterSpacing !== undefined) seg.letterSpacing = run.letterSpacing;\n if (run.textDecoration !== undefined) seg.textDecoration = run.textDecoration;\n if (run.fill !== undefined) seg.fill = run.fill;\n if (run.stroke !== undefined) seg.stroke = run.stroke;\n }\n\n // Apply in creation order: opacity multiplies, others last-wins. A\n // shaping field a selection still holds at the node's own value is\n // one it never touched, and must not undo a run's.\n for (const sel of active) {\n if (!sel.ranges.some(r => start >= r.start && end <= r.end)) continue;\n const o = sel.overrides;\n seg.opacity *= o.opacity;\n seg.x = o.x;\n seg.y = o.y;\n seg.scale = o.scale;\n seg.rotation = o.rotation;\n if (o.fontFamily !== this.fontFamily) seg.fontFamily = o.fontFamily;\n if (o.fontSize !== nodeFontSize) seg.fontSize = o.fontSize;\n if (o.fontStyle !== this.fontStyle) seg.fontStyle = o.fontStyle;\n if (o.fontWeight !== this.fontWeight) seg.fontWeight = o.fontWeight;\n if (o.letterSpacing !== this.letterSpacing) seg.letterSpacing = o.letterSpacing;\n if (o.fill !== null) seg.fill = o.fill;\n if (o.stroke !== null) seg.stroke = o.stroke;\n }\n\n if (hasReveal && !(start >= revealStart && end <= revealEnd)) {\n seg.opacity = 0;\n }\n\n segments.push(seg);\n }\n return segments;\n }\n\n /**\n * The node's own face and paint, plus whatever a selection puts on part of the\n * string. Naming a family here is what lets it load *before* layout, rather\n * than being discovered by measuring text against the fallback face.\n */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n // Nothing may name a family at all, and the renderer then shapes with\n // whatever is registered; an `undefined` key is not a font to load.\n if (this.fontFamily) assets.font(this.fontFamily, this.fontWeight);\n for (const segment of this.buildSegments() ?? []) {\n const family = segment.fontFamily ?? this.fontFamily;\n if (family) assets.font(family, segment.fontWeight);\n assets.fill(segment.fill ?? []);\n for (const stroke of segment.stroke ?? []) assets.fill(stroke.fill);\n }\n }\n\n /**\n * The descriptor this node draws itself as, at the current frame.\n *\n * `@internal` — split out of {@link textOpGraphics} so `node-picking`'s\n * caret geometry can be measured from *the same* state that gets painted.\n * Deriving the two separately is how a caret ends up half a pixel — or, once\n * `'autofit'` or wrapping is in play, half a line — away from its glyph.\n */\n /** @internal */\n _textState(): Partial<TextState> {\n return {\n text: this._casedText(),\n fontSize: this.fontSize,\n fontFamily: this.fontFamily,\n fontWeight: this.fontWeight,\n fontStyle: this.fontStyle,\n letterSpacing: this.letterSpacing,\n lineHeight: this.lineHeight,\n textAlign: this.textAlign,\n verticalAlign: this.verticalAlign,\n textDecoration: this.textDecoration,\n wrap: this.wrapsText,\n minFontSize: this.minFontSize,\n width: this.layoutBounds?.width ?? 0,\n height: this.layoutBounds?.height ?? 0,\n // Text-on-path and selection segments are mutually exclusive in v1:\n // `buildSegments` answers null while a path is set, and the single\n // string is laid out along it instead.\n segments: this.buildSegments() ?? undefined,\n path: this.glyphPath,\n };\n }\n\n // The bare text op as a Graphics2D (no paint), plus whether selection segments\n // are active. Glyphs have no single fillable silhouette path, so the generic\n // PaintNode.shapeGraphics() stays null and these nodes drive their own stroke\n // pass off this builder instead.\n private textOpGraphics(): { g: Graphics2D; segments: boolean } {\n const state = this._textState();\n return { g: new Graphics2D().text(state), segments: state.segments != null };\n }\n\n protected override renderSelf(ctx: RenderContext2D): void {\n const { g, segments } = this.textOpGraphics();\n g.shadow(this.shadow);\n // With segments the renderer paints each run eagerly with the segment's\n // own fill/stroke (so per-selection overrides apply), so the node-level\n // fill/stroke ops are omitted to avoid double-painting. Text-on-path uses\n // the normal deferred path, so its node-level fill applies here; its stroke\n // is deferred to renderStroke.\n if (!segments) {\n g.fill(this.fill);\n }\n ctx.draw(g);\n }\n\n // The stroke only applies to the non-segment / text-on-path case; the\n // segmented branch paints its own fill/stroke per run in renderSelf.\n protected override renderStroke(ctx: RenderContext2D): void {\n const stroke = this.stroke as StrokeResolved[];\n if (stroke.length === 0) return;\n const { g, segments } = this.textOpGraphics();\n if (segments) return;\n ctx.draw(g.stroke(stroke));\n }\n\n private _casedText(): string {\n return textOps.applyCase(this.displayText(), this.textCase);\n }\n}\n\n/**\n * One shaped piece of a line, as {@link TextBase.measure} needs it: its text and\n * the five fields a measurement is taken against.\n */\ninterface StyledRun {\n text: string;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n}\n\n/**\n * Split `segments` into lines at every `\\n`, resolving each piece against\n * `fallback` for the fields it leaves unstated.\n *\n * A segment can span a line break - the cuts are made at *selection* edges, and\n * a selection over two lines is one range - so the break has to be found inside\n * the piece rather than between pieces. The newline itself joins neither line,\n * which is what makes an empty line come back as a run of `\"\"` (in the node's\n * own style) rather than disappearing from the count.\n */\nfunction measureStyledLines(\n segments: TextSegment[],\n fallback: Omit<StyledRun, \"text\">,\n): { runs: StyledRun[] }[] {\n const lines: { runs: StyledRun[] }[] = [{ runs: [] }];\n for (const segment of segments) {\n const style: Omit<StyledRun, \"text\"> = {\n fontFamily: segment.fontFamily ?? fallback.fontFamily,\n fontSize: segment.fontSize ?? fallback.fontSize,\n fontStyle: segment.fontStyle ?? fallback.fontStyle,\n fontWeight: segment.fontWeight,\n letterSpacing: segment.letterSpacing,\n };\n const parts = segment.text.split(\"\\n\");\n for (let i = 0; i < parts.length; i++) {\n if (i > 0) lines.push({ runs: [] });\n lines[lines.length - 1].runs.push({ text: parts[i], ...style });\n }\n }\n // A line the loop above never wrote a run onto still has to be measured\n // against something, and the node's own style is the only honest answer.\n for (const line of lines) {\n if (line.runs.length === 0) line.runs.push({ ...fallback, text: \"\" });\n }\n return lines;\n}\n\n/**\n * The size each line of `lines` is set at once wrapped to `maxWidth`: the\n * greedy whitespace break {@link countWrappedLines} makes, but with every piece\n * measured in its own style. A word split across two styles is still one word.\n */\nfunction wrappedLineSizes(\n lines: { runs: StyledRun[] }[],\n maxWidth: number,\n scope: MeasureContext2D,\n): number[] {\n const sizes: number[] = [];\n for (const line of lines) {\n const tokens: { width: number; size: number; space: boolean }[] = [];\n for (const run of line.runs) {\n for (const part of run.text.split(/(\\s+)/)) {\n if (part.length === 0) continue;\n const space = /^\\s+$/.test(part);\n const width = scope.measureText(part, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width;\n const last = tokens[tokens.length - 1];\n if (last && !last.space && !space) {\n last.width += width;\n last.size = Math.max(last.size, run.fontSize);\n } else {\n tokens.push({ width, size: run.fontSize, space });\n }\n }\n }\n if (tokens.length === 0) {\n sizes.push(Math.max(...line.runs.map(run => run.fontSize)));\n continue;\n }\n let lineW = tokens[0].width;\n let size = tokens[0].size;\n for (const token of tokens.slice(1)) {\n if (lineW + token.width <= maxWidth) {\n lineW += token.width;\n size = Math.max(size, token.size);\n } else {\n sizes.push(size);\n lineW = token.space ? 0 : token.width;\n size = token.space ? 0 : token.size;\n }\n }\n sizes.push(size > 0 ? size : Math.max(...line.runs.map(run => run.fontSize)));\n }\n return sizes;\n}\n\nfunction countWrappedLines(\n paragraph: string,\n maxWidth: number,\n fontSize: number,\n fontFamily: string,\n fontWeight: number,\n scope: MeasureContext2D,\n letterSpacing: number = 0,\n fontStyle: FontStyle = 'normal',\n): number {\n if (paragraph.length === 0) return 1;\n if (scope.measureText(paragraph, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width <= maxWidth) return 1;\n\n const words = paragraph.split(/(\\s+)/).filter(s => s.length > 0);\n let lines = 1;\n let lineW = 0;\n for (const word of words) {\n const w = scope.measureText(word, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width;\n if (lineW === 0) {\n lineW = w;\n } else if (lineW + w <= maxWidth) {\n lineW += w;\n } else {\n lines++;\n lineW = /^\\s+$/.test(word) ? 0 : w;\n }\n }\n return lines;\n}\n"]}
1
+ {"version":3,"file":"text-base.js","sourceRoot":"","sources":["../../../src/nodes/text/text-base.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAc,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAO7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AA0B9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAgB,QAAkD,SAAQ,SAAY;IAyCxF,kEAAkE;IAClE,IAAc,SAAS,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IAEpD,qEAAqE;IACrE,IAAc,SAAS,KAAsB,OAAO,IAAI,CAAC,CAAC,CAAC;IAE3D;;;;OAIG;IACO,UAAU,KAA+B,OAAO,EAA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;QACd,CAAC;aAAM,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;YAC/B,KAAK,IAAI,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACJ,KAAK,EAAE,CAAC;YACR,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import type { FontStyle, ResolvedTextRun, TextAlign, TextCase, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\r\nimport { textOps } from \"@/attributes/text/ops\";\r\nimport { PaintNode, PaintProps } from \"@/nodes/2d/paint-node\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { ContextMap } from \"@/util/context\";\r\nimport { SizeConstraints } from \"@/layout/constraints\";\r\nimport { MeasureContext2D } from \"@/render/measure-context\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\nimport { RenderContext2D } from \"@/render/render-context2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { TextSegment, TextState } from \"@/render/descriptors/text\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"@/render/descriptors/path\";\r\nimport { pathOps } from \"@/attributes/shape/path/ops\";\r\nimport { AUTOFIT_PROBE_SIZE, type TextSelection } from \"./text-selection\";\r\nimport { applyTextDefaults } from \"./default-text-style-node\";\r\n\r\n\r\n/** The fields a string is shaped and set by, shared by every node that draws glyphs. */\r\nexport interface TextBaseProps extends PaintProps {\r\n fontSize: number | 'autofit';\r\n fontFamily: string;\r\n fontWeight: number;\r\n fontStyle: FontStyle;\r\n letterSpacing: number;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n verticalAlign: VerticalAlign;\r\n textDecoration: TextDecoration;\r\n textCase: TextCase;\r\n minFontSize: number;\r\n /**\r\n * Name of a typography preset from `theme.typography` (e.g. `\"header\"`).\r\n * Supplies any text-style prop (fontSize, fontWeight, …) not set explicitly\r\n * here. An explicit prop always wins over the preset; the preset wins over an\r\n * inherited `<DefaultTextStyle>`.\r\n */\r\n variant: string;\r\n}\r\n\r\n\r\n/**\r\n * **A node whose box is the box of some shaped glyphs.**\r\n *\r\n * Everything about setting a string in a face — the shaping props, the\r\n * cascade that fills them in, measuring the block, declaring the fonts it needs\r\n * and drawing it — and nothing about *where the string comes from*, which is\r\n * {@link displayText}'s and is the only thing its subclasses disagree about.\r\n * {@link Text} is handed one and lets an author edit it; {@link NumberNode}\r\n * derives one from a number and a format.\r\n *\r\n * That seam is the reason this class exists rather than `NumberNode extends\r\n * Text`. A figure is not a string: `append`, `prepend`, `find`, `word`,\r\n * `wrap` and the `text` prop itself are all operations on copy somebody typed,\r\n * and a number inheriting them offered an editor a Content field over a value it\r\n * could not write to and a \"Append Text\" command over a quantity. What the two\r\n * genuinely share is glyphs, and that is what is here.\r\n *\r\n * **Not `Intl`, anywhere below this.** A scene is a picture with a fixed layout;\r\n * see {@link NumberNode} for the argument.\r\n */\r\nexport abstract class TextBase<P extends TextBaseProps = TextBaseProps> extends PaintNode<P> {\r\n\r\n /**\r\n * The family this text is set in. **No default** — it comes from the cascade\r\n * in `applyTextDefaults`: what the author passed, else a `variant` preset,\r\n * else the nearest enclosing `<DefaultTextStyle>`, else the theme's `default`\r\n * typography preset.\r\n *\r\n * A literal default here would sit *under* all four and quietly win whenever\r\n * every one of them was silent, which is precisely the case worth hearing\r\n * about: text set in a face nobody chose is text whose font was never\r\n * declared and so never loaded. Left unset, the renderer says so instead —\r\n * see `requireFontFamily`.\r\n */\r\n @property() declare readonly fontFamily: string;\r\n // `'autofit'` is a mode, not a magnitude: the shared rule steps it at the\r\n // midpoint, where the numeric cell tween would compute `'autofit' + …` = NaN.\r\n @property({ default: 48, tween: textOps.lerpFontSize }) declare readonly fontSize: number | 'autofit';\r\n @property({ default: 400 }) declare readonly fontWeight: number;\r\n @property({ default: 'normal' }) declare readonly fontStyle: FontStyle;\r\n @property({ default: 0 }) declare readonly letterSpacing: number;\r\n @property({ default: 1.2 }) declare readonly lineHeight: number;\r\n @property({ default: 'center' }) declare readonly textAlign: TextAlign;\r\n @property({ default: 'center', kind: 'enum', options: ['top', 'center', 'bottom'] satisfies VerticalAlign[] })\r\n declare readonly verticalAlign: VerticalAlign;\r\n @property({ default: 'none', kind: 'enum', options: ['none', 'underline', 'line-through'] satisfies TextDecoration[] })\r\n declare readonly textDecoration: TextDecoration;\r\n @property({ default: 'none', kind: 'enum', options: ['none', 'upper', 'lower', 'title'] satisfies TextCase[] })\r\n declare readonly textCase: TextCase;\r\n @property({ default: 12 }) declare readonly minFontSize: number;\r\n @property({ default: undefined }) declare readonly variant?: string;\r\n\r\n /**\r\n * The string this node draws, this frame.\r\n *\r\n * Read fresh everywhere below rather than cached into a prop, so a subclass\r\n * deriving it from other props — a figure from its value and its format —\r\n * reformats and redraws without owning a binding of its own.\r\n */\r\n abstract displayText(): string;\r\n\r\n /** Whether long lines break — a single-line figure never does. */\r\n protected get wrapsText(): boolean { return false; }\r\n\r\n /** The path the glyphs ride, for a type that offers text-on-path. */\r\n protected get glyphPath(): PathData | null { return null; }\r\n\r\n /**\r\n * Live per-range style overrides — {@link Text}'s selections. A derived\r\n * string has no ranges anyone could have selected, so the base answers with\r\n * none and {@link buildSegments} keeps only the reveal window.\r\n */\r\n protected styledRuns(): readonly TextSelection[] { return []; }\r\n\r\n /** Stretches a document styles apart from the node — {@link Text}'s `runs`. */\r\n protected styleRuns(): readonly ResolvedTextRun[] { return []; }\r\n\r\n // Inherit text-style defaults from the nearest ancestor <DefaultTextStyle>\r\n // for any style prop the author didn't set. This is context-value application\r\n // (structure is fixed — a glyph node has no children), so it belongs in\r\n // resolveContext, which runs once after the tree + context exist. Writing\r\n // through _writeProp applies each field's own mapper (e.g. `fill`'s color\r\n // resolver) once.\r\n protected override resolveContext(ctx: ContextMap): void {\r\n applyTextDefaults(this, this._props as Record<string, unknown> | undefined);\r\n }\r\n\r\n // Glyphs don't hug/fill based on children (there are none) — they hug their\r\n // own glyph box by default, filling only when the box has to be resolved\r\n // externally: `autofit` measures glyphs against the allotted box.\r\n protected override applyDefaultSize(props?: NodeConfig<any, P>): void {\r\n const autofit = props?.fontSize === 'autofit';\r\n this.applyProp(\"height\", props?.height ?? (autofit ? \"fill\" : \"hug\"));\r\n this.applyProp(\"width\", props?.width ?? (autofit ? \"fill\" : \"hug\"));\r\n }\r\n\r\n measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D> {\r\n // Text-on-path: the visual extent is the path's bounding box, not a text\r\n // line box. Size the node to the path (node-local coords, like Path).\r\n const glyphPath = this.glyphPath;\r\n if (glyphPath != null) {\r\n const { width, height } = pathOps.size(glyphPath);\r\n const wm = this.width;\r\n const hm = this.height;\r\n return {\r\n width: typeof wm === \"number\" ? wm : wm === \"hug\" ? width : (constraints.maxWidth ?? width),\r\n height: typeof hm === \"number\" ? hm : hm === \"hug\" ? height : (constraints.maxHeight ?? height),\r\n };\r\n }\r\n\r\n const measureFontSize = this.fontSize === 'autofit' ? 16 : this.fontSize;\r\n const paragraphs = this._casedText().split(\"\\n\");\r\n\r\n // A styled run changes the box, which is why measuring cannot read the\r\n // node's five font fields and stop there: one word set two sizes up makes\r\n // the line taller and the block wider, and a node that hugs its glyphs\r\n // would hug a box measured for text nobody is looking at. So when\r\n // selections are live the intrinsic size is summed across the *pieces*,\r\n // each in its own style - see {@link measureStyledLines}.\r\n const styled = this.buildSegments();\r\n const lineStyles = styled === null\r\n ? null\r\n : measureStyledLines(styled, {\r\n fontFamily: this.fontFamily,\r\n fontSize: measureFontSize,\r\n fontStyle: this.fontStyle,\r\n fontWeight: this.fontWeight,\r\n letterSpacing: this.letterSpacing,\r\n });\r\n\r\n const lineH = measureFontSize * this.lineHeight;\r\n const intrinsicW = lineStyles\r\n ? Math.max(...lineStyles.map(line => line.runs.reduce(\r\n (w, run) => w + scope.measureText(run.text, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width,\r\n 0,\r\n )))\r\n : Math.max(...paragraphs.map(l => scope.measureText(l, measureFontSize, this.fontFamily, this.fontWeight, this.letterSpacing, this.fontStyle).width));\r\n\r\n const wm = this.width;\r\n const hm = this.height;\r\n\r\n const resolvedW = typeof wm === \"number\"\r\n ? wm\r\n : wm === \"hug\"\r\n ? intrinsicW\r\n : constraints.maxWidth ?? 0;\r\n\r\n // When wrap is on and the box has a finite width narrower than the text,\r\n // height needs to account for the extra lines produced by wrapping.\r\n const wraps = this.wrapsText && resolvedW > 0;\r\n // Each line is as tall as its tallest run, so raising one word's size\r\n // opens the leading around it rather than letting it overprint the line\r\n // above.\r\n const lineSizes = lineStyles === null\r\n ? null\r\n : wraps\r\n ? wrappedLineSizes(lineStyles, resolvedW, scope)\r\n : lineStyles.map(line => Math.max(...line.runs.map(run => run.fontSize)));\r\n const intrinsicH = lineSizes\r\n ? lineSizes.reduce((h, size) => h + size * this.lineHeight, 0)\r\n : (wraps\r\n ? paragraphs.reduce((n, p) => n + countWrappedLines(p, resolvedW, measureFontSize, this.fontFamily, this.fontWeight, scope, this.letterSpacing, this.fontStyle), 0)\r\n : paragraphs.length) * lineH;\r\n\r\n // \"fill\" still reports the intrinsic wrapped height when measuring —\r\n // it's layout (not measure) that stretches a fill child to its final\r\n // box. This lets a hug ancestor see the text's real content height\r\n // instead of an arbitrary borrowed constraint.\r\n const resolvedH = typeof hm === \"number\"\r\n ? hm\r\n : intrinsicH;\r\n\r\n return { width: resolvedW, height: resolvedH };\r\n }\r\n\r\n /**\r\n * Split the string into contiguous pieces at every style boundary, resolving\r\n * each piece's effective overrides per the overlap rule: later-created\r\n * selections win for transform/paint/font; opacity multiplies across all\r\n * selections covering the piece. Also folds in the Write On reveal window\r\n * (see below). Returns null when neither is active, so rendering keeps its\r\n * single-op path.\r\n *\r\n * Text-on-path has no pieces in v1 — the string is laid along the path as\r\n * one run — so a node with a path is answered `null` before anything else.\r\n */\r\n protected buildSegments(): TextSegment[] | null {\r\n if (this.glyphPath != null) return null;\r\n const active = this.styledRuns().filter(s => s.ranges.length > 0 && !s.isIdentity);\r\n const runs = this.styleRuns().filter(r => r.end > r.start);\r\n const text = this._casedText();\r\n if (text.length === 0) return null;\r\n\r\n // Write On: `start`/`end` are PaintNode's outline-trim fractions\r\n // everywhere else, but a glyph has no path to trim geometrically — this\r\n // CanvasKit build can't get glyph outlines at all (see\r\n // drawTextUnionStroke in the skia-render stroke handler). Glyph nodes\r\n // reinterpret the same pair as a character-reveal window instead:\r\n // opacity over a character range rather than a geometric trim.\r\n const hasReveal = this.start > 0 || this.end < 1;\r\n // The fast path survives both: a node with no live selection and no\r\n // reveal window renders as one string, exactly as it did before either\r\n // existed.\r\n if (active.length === 0 && runs.length === 0 && !hasReveal) return null;\r\n\r\n // Rounded to the nearest whole character — a hard cut, not a fade. Write\r\n // On reveals one character at a time, the way DaVinci's does; a fractional\r\n // in-between character read as an opinionated flourish nobody asked for.\r\n const revealStart = Math.round(this.start * text.length);\r\n const revealEnd = Math.round(this.end * text.length);\r\n\r\n // The size every piece starts from. `'autofit'` settles on a size the\r\n // *block* is measured into, which no single piece can be asked for, so\r\n // the segmented path shapes at the same probe size a selection's\r\n // `fontSize` override starts from - one number, stated in one place.\r\n const nodeFontSize = typeof this.fontSize === \"number\"\r\n ? this.fontSize\r\n : AUTOFIT_PROBE_SIZE;\r\n\r\n // Boundaries at every range edge so each piece is covered uniformly.\r\n const cuts = new Set<number>([0, text.length]);\r\n for (const run of runs) { cuts.add(run.start); cuts.add(run.end); }\r\n for (const sel of active) {\r\n for (const r of sel.ranges) { cuts.add(r.start); cuts.add(r.end); }\r\n }\r\n if (hasReveal) {\r\n cuts.add(revealStart);\r\n cuts.add(revealEnd);\r\n }\r\n const points = [...cuts].filter(c => c >= 0 && c <= text.length).sort((a, b) => a - b);\r\n\r\n const segments: TextSegment[] = [];\r\n for (let i = 0; i < points.length - 1; i++) {\r\n const start = points[i];\r\n const end = points[i + 1];\r\n if (end <= start) continue;\r\n\r\n const seg: TextSegment = {\r\n text: text.slice(start, end),\r\n // Every shaping field is stated, not left for the renderer to\r\n // fill in: a piece whose family or size differs from the node's\r\n // is the point of the model, and a segment that says nothing\r\n // about one of them would be a piece the paragraph builder\r\n // styles from the node while the caret measures from the\r\n // segment. See {@link TextSegment}.\r\n fontFamily: this.fontFamily,\r\n fontSize: nodeFontSize,\r\n fontStyle: this.fontStyle,\r\n fontWeight: this.fontWeight,\r\n letterSpacing: this.letterSpacing,\r\n textDecoration: this.textDecoration,\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n scale: 1,\r\n rotation: 0,\r\n // Default to the node's paint; selections override below. Each\r\n // segment is self-contained so the renderer draws runs eagerly.\r\n fill: this.fill as FillResolved[],\r\n stroke: this.stroke as StrokeResolved[],\r\n };\r\n\r\n // The document's styling first, so a selection animates *from* it.\r\n for (const run of runs) {\r\n if (start < run.start || end > run.end) continue;\r\n if (run.fontFamily !== undefined) seg.fontFamily = run.fontFamily;\r\n if (run.fontSize !== undefined) seg.fontSize = run.fontSize;\r\n if (run.fontStyle !== undefined) seg.fontStyle = run.fontStyle;\r\n if (run.fontWeight !== undefined) seg.fontWeight = run.fontWeight;\r\n if (run.letterSpacing !== undefined) seg.letterSpacing = run.letterSpacing;\r\n if (run.textDecoration !== undefined) seg.textDecoration = run.textDecoration;\r\n if (run.fill !== undefined) seg.fill = run.fill;\r\n if (run.stroke !== undefined) seg.stroke = run.stroke;\r\n }\r\n\r\n // Apply in creation order: opacity multiplies, others last-wins. A\r\n // shaping field a selection still holds at the node's own value is\r\n // one it never touched, and must not undo a run's.\r\n for (const sel of active) {\r\n if (!sel.ranges.some(r => start >= r.start && end <= r.end)) continue;\r\n const o = sel.overrides;\r\n seg.opacity *= o.opacity;\r\n seg.x = o.x;\r\n seg.y = o.y;\r\n seg.scale = o.scale;\r\n seg.rotation = o.rotation;\r\n if (o.fontFamily !== this.fontFamily) seg.fontFamily = o.fontFamily;\r\n if (o.fontSize !== nodeFontSize) seg.fontSize = o.fontSize;\r\n if (o.fontStyle !== this.fontStyle) seg.fontStyle = o.fontStyle;\r\n if (o.fontWeight !== this.fontWeight) seg.fontWeight = o.fontWeight;\r\n if (o.letterSpacing !== this.letterSpacing) seg.letterSpacing = o.letterSpacing;\r\n if (o.fill !== null) seg.fill = o.fill;\r\n if (o.stroke !== null) seg.stroke = o.stroke;\r\n }\r\n\r\n if (hasReveal && !(start >= revealStart && end <= revealEnd)) {\r\n seg.opacity = 0;\r\n }\r\n\r\n segments.push(seg);\r\n }\r\n return segments;\r\n }\r\n\r\n /**\r\n * The node's own face and paint, plus whatever a selection puts on part of the\r\n * string. Naming a family here is what lets it load *before* layout, rather\r\n * than being discovered by measuring text against the fallback face.\r\n */\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n // Nothing may name a family at all, and the renderer then shapes with\r\n // whatever is registered; an `undefined` key is not a font to load.\r\n if (this.fontFamily) assets.font(this.fontFamily, this.fontWeight);\r\n for (const segment of this.buildSegments() ?? []) {\r\n const family = segment.fontFamily ?? this.fontFamily;\r\n if (family) assets.font(family, segment.fontWeight);\r\n assets.fill(segment.fill ?? []);\r\n for (const stroke of segment.stroke ?? []) assets.fill(stroke.fill);\r\n }\r\n }\r\n\r\n /**\r\n * The descriptor this node draws itself as, at the current frame.\r\n *\r\n * `@internal` — split out of {@link textOpGraphics} so `node-picking`'s\r\n * caret geometry can be measured from *the same* state that gets painted.\r\n * Deriving the two separately is how a caret ends up half a pixel — or, once\r\n * `'autofit'` or wrapping is in play, half a line — away from its glyph.\r\n */\r\n /** @internal */\r\n _textState(): Partial<TextState> {\r\n return {\r\n text: this._casedText(),\r\n fontSize: this.fontSize,\r\n fontFamily: this.fontFamily,\r\n fontWeight: this.fontWeight,\r\n fontStyle: this.fontStyle,\r\n letterSpacing: this.letterSpacing,\r\n lineHeight: this.lineHeight,\r\n textAlign: this.textAlign,\r\n verticalAlign: this.verticalAlign,\r\n textDecoration: this.textDecoration,\r\n wrap: this.wrapsText,\r\n minFontSize: this.minFontSize,\r\n width: this.layoutBounds?.width ?? 0,\r\n height: this.layoutBounds?.height ?? 0,\r\n // Text-on-path and selection segments are mutually exclusive in v1:\r\n // `buildSegments` answers null while a path is set, and the single\r\n // string is laid out along it instead.\r\n segments: this.buildSegments() ?? undefined,\r\n path: this.glyphPath,\r\n };\r\n }\r\n\r\n // The bare text op as a Graphics2D (no paint), plus whether selection segments\r\n // are active. Glyphs have no single fillable silhouette path, so the generic\r\n // PaintNode.shapeGraphics() stays null and these nodes drive their own stroke\r\n // pass off this builder instead.\r\n private textOpGraphics(): { g: Graphics2D; segments: boolean } {\r\n const state = this._textState();\r\n return { g: new Graphics2D().text(state), segments: state.segments != null };\r\n }\r\n\r\n protected override renderSelf(ctx: RenderContext2D): void {\r\n const { g, segments } = this.textOpGraphics();\r\n g.shadow(this.shadow);\r\n // With segments the renderer paints each run eagerly with the segment's\r\n // own fill/stroke (so per-selection overrides apply), so the node-level\r\n // fill/stroke ops are omitted to avoid double-painting. Text-on-path uses\r\n // the normal deferred path, so its node-level fill applies here; its stroke\r\n // is deferred to renderStroke.\r\n if (!segments) {\r\n g.fill(this.fill);\r\n }\r\n ctx.draw(g);\r\n }\r\n\r\n // The stroke only applies to the non-segment / text-on-path case; the\r\n // segmented branch paints its own fill/stroke per run in renderSelf.\r\n protected override renderStroke(ctx: RenderContext2D): void {\r\n const stroke = this.stroke as StrokeResolved[];\r\n if (stroke.length === 0) return;\r\n const { g, segments } = this.textOpGraphics();\r\n if (segments) return;\r\n ctx.draw(g.stroke(stroke));\r\n }\r\n\r\n private _casedText(): string {\r\n return textOps.applyCase(this.displayText(), this.textCase);\r\n }\r\n}\r\n\r\n/**\r\n * One shaped piece of a line, as {@link TextBase.measure} needs it: its text and\r\n * the five fields a measurement is taken against.\r\n */\r\ninterface StyledRun {\r\n text: string;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n}\r\n\r\n/**\r\n * Split `segments` into lines at every `\\n`, resolving each piece against\r\n * `fallback` for the fields it leaves unstated.\r\n *\r\n * A segment can span a line break - the cuts are made at *selection* edges, and\r\n * a selection over two lines is one range - so the break has to be found inside\r\n * the piece rather than between pieces. The newline itself joins neither line,\r\n * which is what makes an empty line come back as a run of `\"\"` (in the node's\r\n * own style) rather than disappearing from the count.\r\n */\r\nfunction measureStyledLines(\r\n segments: TextSegment[],\r\n fallback: Omit<StyledRun, \"text\">,\r\n): { runs: StyledRun[] }[] {\r\n const lines: { runs: StyledRun[] }[] = [{ runs: [] }];\r\n for (const segment of segments) {\r\n const style: Omit<StyledRun, \"text\"> = {\r\n fontFamily: segment.fontFamily ?? fallback.fontFamily,\r\n fontSize: segment.fontSize ?? fallback.fontSize,\r\n fontStyle: segment.fontStyle ?? fallback.fontStyle,\r\n fontWeight: segment.fontWeight,\r\n letterSpacing: segment.letterSpacing,\r\n };\r\n const parts = segment.text.split(\"\\n\");\r\n for (let i = 0; i < parts.length; i++) {\r\n if (i > 0) lines.push({ runs: [] });\r\n lines[lines.length - 1].runs.push({ text: parts[i], ...style });\r\n }\r\n }\r\n // A line the loop above never wrote a run onto still has to be measured\r\n // against something, and the node's own style is the only honest answer.\r\n for (const line of lines) {\r\n if (line.runs.length === 0) line.runs.push({ ...fallback, text: \"\" });\r\n }\r\n return lines;\r\n}\r\n\r\n/**\r\n * The size each line of `lines` is set at once wrapped to `maxWidth`: the\r\n * greedy whitespace break {@link countWrappedLines} makes, but with every piece\r\n * measured in its own style. A word split across two styles is still one word.\r\n */\r\nfunction wrappedLineSizes(\r\n lines: { runs: StyledRun[] }[],\r\n maxWidth: number,\r\n scope: MeasureContext2D,\r\n): number[] {\r\n const sizes: number[] = [];\r\n for (const line of lines) {\r\n const tokens: { width: number; size: number; space: boolean }[] = [];\r\n for (const run of line.runs) {\r\n for (const part of run.text.split(/(\\s+)/)) {\r\n if (part.length === 0) continue;\r\n const space = /^\\s+$/.test(part);\r\n const width = scope.measureText(part, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width;\r\n const last = tokens[tokens.length - 1];\r\n if (last && !last.space && !space) {\r\n last.width += width;\r\n last.size = Math.max(last.size, run.fontSize);\r\n } else {\r\n tokens.push({ width, size: run.fontSize, space });\r\n }\r\n }\r\n }\r\n if (tokens.length === 0) {\r\n sizes.push(Math.max(...line.runs.map(run => run.fontSize)));\r\n continue;\r\n }\r\n let lineW = tokens[0].width;\r\n let size = tokens[0].size;\r\n for (const token of tokens.slice(1)) {\r\n if (lineW + token.width <= maxWidth) {\r\n lineW += token.width;\r\n size = Math.max(size, token.size);\r\n } else {\r\n sizes.push(size);\r\n lineW = token.space ? 0 : token.width;\r\n size = token.space ? 0 : token.size;\r\n }\r\n }\r\n sizes.push(size > 0 ? size : Math.max(...line.runs.map(run => run.fontSize)));\r\n }\r\n return sizes;\r\n}\r\n\r\nfunction countWrappedLines(\r\n paragraph: string,\r\n maxWidth: number,\r\n fontSize: number,\r\n fontFamily: string,\r\n fontWeight: number,\r\n scope: MeasureContext2D,\r\n letterSpacing: number = 0,\r\n fontStyle: FontStyle = 'normal',\r\n): number {\r\n if (paragraph.length === 0) return 1;\r\n if (scope.measureText(paragraph, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width <= maxWidth) return 1;\r\n\r\n const words = paragraph.split(/(\\s+)/).filter(s => s.length > 0);\r\n let lines = 1;\r\n let lineW = 0;\r\n for (const word of words) {\r\n const w = scope.measureText(word, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width;\r\n if (lineW === 0) {\r\n lineW = w;\r\n } else if (lineW + w <= maxWidth) {\r\n lineW += w;\r\n } else {\r\n lines++;\r\n lineW = /^\\s+$/.test(word) ? 0 : w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E,UAAU,EAAE,KAAK,EAAE,CAAC;kCAC7B;AAoCzC;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;kCAIhF;AAGD;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;mCAIhF","sourcesContent":["import { textProperty } from \"@/attributes/properties/typed\";\nimport type { ResolvedTextRun, TextRun } from \"@/attributes/text/types\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { strokeOps } from \"@/attributes/shape/stroke/stroke\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { PathData } from \"@/render/descriptors/path\";\nimport { PathBuilder } from \"@/render/descriptors/path-builder\";\nimport { TextRange, TextSelection } from \"./text-selection\";\nimport { TextBase, TextBaseProps } from \"./text-base\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\n\nexport interface TextProps extends TextBaseProps {\n text: string;\n /** Wrap onto more lines once the text runs out of width. */\n wrap: boolean;\n /**\n * Wrap the text around a path (text-on-path). Accepts the same value shapes\n * as the {@link Path} node's `d`: an SVG path string, a `PathCommand[]`, or a\n * {@link PathBuilder}. When set, `wrap` and multi-line (`\\n`) are ignored\n * (single line), and text selections are not applied.\n */\n path: PathData | PathBuilder;\n /**\n * Stretches of `text` styled apart from the node — see {@link TextRun}.\n * Where two overlap the later one wins; offsets past the end of the string\n * style nothing. Ignored on a `path`, like selections.\n */\n runs: TextRun[];\n}\n\n/** Coerce the loosely-typed `path` input into stored {@link PathData} (or null). */\nfunction resolveTextPath(value: PathData | PathBuilder | null | undefined): PathData | null {\n if (value == null) return null;\n return value instanceof PathBuilder ? value.toCommands() : value;\n}\n\nfunction resolveTextRuns(value: TextRun[] | null | undefined): ResolvedTextRun[] {\n if (!Array.isArray(value)) return [];\n return value.map(({ fill, stroke, ...run }) => ({\n ...run,\n ...(fill === undefined ? {} : { fill: fillOps.resolve(fill) }),\n ...(stroke === undefined ? {} : { stroke: strokeOps.resolve(stroke) }),\n }));\n}\n\n\n/**\n * Copy somebody typed, set in a face.\n *\n * The shaping, measuring and drawing are {@link TextBase}'s, shared with every\n * other node that puts glyphs on the canvas. What is here is what belongs to a\n * string an *author owns*: the string itself, whether its lines break, the path\n * it can be wrapped around, the two commands that add to it, and the selection\n * API that styles part of it.\n */\nexport class Text extends TextBase<TextProps> {\n\n @textProperty() declare readonly text: string;\n @property({ default: false }) declare readonly wrap: boolean;\n @property({ default: null, mapper: resolveTextPath })\n declare readonly path: PathData | null;\n @property({ default: [], mapper: resolveTextRuns, animatable: false })\n declare readonly runs: ResolvedTextRun[];\n\n constructor(props: NodeConfig<Text, TextProps>) {\n super(props);\n }\n\n override displayText(): string {\n return this.text;\n }\n\n protected override get wrapsText(): boolean {\n return this.wrap;\n }\n\n protected override get glyphPath(): PathData | null {\n return this.path;\n }\n\n protected override styledRuns(): readonly TextSelection[] {\n return this._selections;\n }\n\n protected override styleRuns(): readonly ResolvedTextRun[] {\n return this.runs;\n }\n\n // Text fills rather than hugs on the axis something else has to settle:\n // `autofit` measures glyphs against the allotted box (the base's rule), and\n // `wrap` needs a width to break lines against.\n protected override applyDefaultSize(props?: NodeConfig<Text, TextProps>): void {\n const autofit = props?.fontSize === 'autofit';\n this.applyProp(\"height\", props?.height ?? (autofit ? \"fill\" : \"hug\"));\n this.applyProp(\"width\", props?.width ?? (autofit || props?.wrap ? \"fill\" : \"hug\"));\n }\n\n @command({ args: [{ key: \"text\", kind: \"text\", default: \"\", multiline: true }] })\n append(args: CommandArgs<{ text: string }> & { duration: number }): Command<TextProps> {\n const text = (args.data as { text: string }).text;\n return this.to({ data: { text: this.text + text }, duration: args.duration, easing: args.easing });\n }\n\n @command({ args: [{ key: \"text\", kind: \"text\", default: \"\", multiline: true }] })\n prepend(args: CommandArgs<{ text: string }> & { duration: number }): Command<TextProps> {\n const text = (args.data as { text: string }).text;\n return this.to({ data: { text: text + this.text }, duration: args.duration, easing: args.easing });\n }\n\n // ---- Text selection ---------------------------------------------------\n\n /** Live selections in creation order. Later ones win on overlapping glyphs. */\n private _selections: TextSelection[] = [];\n\n /** @internal Called by {@link TextSelection} on construction. */\n _registerSelection(selection: TextSelection): void {\n this._selections.push(selection);\n }\n\n /**\n * Select an occurrence of `text`. By default the first occurrence; pass\n * `{ index }` to target the nth (0-based).\n *\n * @example title().find(\"hello\").to({ opacity: 0.5 }, 1);\n */\n find(text: string, opts?: { index?: number }): TextSelection {\n const source = this.text;\n const ranges: TextRange[] = [];\n if (text.length > 0) {\n let from = 0;\n let i: number;\n while ((i = source.indexOf(text, from)) !== -1) {\n ranges.push({ start: i, end: i + text.length });\n from = i + text.length;\n }\n }\n const index = opts?.index ?? 0;\n const picked = ranges[index] ? [ranges[index]] : [];\n return new TextSelection(this, picked);\n }\n\n /** Select every match of `regex`. A non-global regex matches once. */\n match(regex: RegExp): TextSelection {\n const flags = regex.flags.includes(\"g\") ? regex.flags : regex.flags + \"g\";\n const re = new RegExp(regex.source, flags);\n const ranges: TextRange[] = [];\n let m: RegExpExecArray | null;\n while ((m = re.exec(this.text)) !== null) {\n if (m[0].length === 0) { re.lastIndex++; continue; }\n ranges.push({ start: m.index, end: m.index + m[0].length });\n }\n return new TextSelection(this, ranges);\n }\n\n /** Select the nth `\\n`-delimited line (0-based), excluding the newline. */\n line(n: number): TextSelection {\n const lines = this.text.split(\"\\n\");\n let cursor = 0;\n for (let i = 0; i < lines.length; i++) {\n const len = lines[i].length;\n if (i === n) return new TextSelection(this, [{ start: cursor, end: cursor + len }]);\n cursor += len + 1; // + the consumed \"\\n\"\n }\n return new TextSelection(this, []);\n }\n\n /** Select every whitespace-delimited word. */\n words(): TextSelection {\n return new TextSelection(this, this._wordRanges());\n }\n\n /** Select the nth whitespace-delimited word (0-based). */\n word(n: number): TextSelection {\n const r = this._wordRanges()[n];\n return new TextSelection(this, r ? [r] : []);\n }\n\n /** Select the raw character range `[start, end)`. */\n slice(start: number, end: number): TextSelection {\n return new TextSelection(this, [{ start, end }]);\n }\n\n /** Select characters for which `predicate` returns true; adjacent hits merge. */\n filter(predicate: (char: string, index: number) => boolean): TextSelection {\n const ranges: TextRange[] = [];\n let runStart = -1;\n for (let i = 0; i < this.text.length; i++) {\n if (predicate(this.text[i], i)) {\n if (runStart === -1) runStart = i;\n } else if (runStart !== -1) {\n ranges.push({ start: runStart, end: i });\n runStart = -1;\n }\n }\n if (runStart !== -1) ranges.push({ start: runStart, end: this.text.length });\n return new TextSelection(this, ranges);\n }\n\n private _wordRanges(): TextRange[] {\n const ranges: TextRange[] = [];\n const re = /\\S+/g;\n let m: RegExpExecArray | null;\n while ((m = re.exec(this.text)) !== null) {\n ranges.push({ start: m.index, end: m.index + m[0].length });\n }\n return ranges;\n }\n}\n"]}
1
+ {"version":3,"file":"text-node.js","sourceRoot":"","sources":["../../../src/nodes/text/text-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAa,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAsBpD,oFAAoF;AACpF,SAAS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,MAAM,EAAE,GAAG,MAAM,CAAC;QAClB,IAAI,CAAyB,CAAC;QAC9B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAtJoC;IAAhC,YAAY,EAAE;kCAA+B;AACC;IAA9C,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;kCAAgC;AAE5C;IADhB,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;kCACd;AAEtB;IADhB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;kCAC7B;AAoCzC;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;kCAIhF;AAGD;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;mCAIhF","sourcesContent":["import { textProperty } from \"@/attributes/properties/typed\";\r\nimport type { ResolvedTextRun, TextRun } from \"@/attributes/text/types\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { strokeOps } from \"@/attributes/shape/stroke/stroke\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { PathData } from \"@/render/descriptors/path\";\r\nimport { PathBuilder } from \"@/render/descriptors/path-builder\";\r\nimport { TextRange, TextSelection } from \"./text-selection\";\r\nimport { TextBase, TextBaseProps } from \"./text-base\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\n\r\nexport interface TextProps extends TextBaseProps {\r\n text: string;\r\n /** Wrap onto more lines once the text runs out of width. */\r\n wrap: boolean;\r\n /**\r\n * Wrap the text around a path (text-on-path). Accepts the same value shapes\r\n * as the {@link Path} node's `d`: an SVG path string, a `PathCommand[]`, or a\r\n * {@link PathBuilder}. When set, `wrap` and multi-line (`\\n`) are ignored\r\n * (single line), and text selections are not applied.\r\n */\r\n path: PathData | PathBuilder;\r\n /**\r\n * Stretches of `text` styled apart from the node — see {@link TextRun}.\r\n * Where two overlap the later one wins; offsets past the end of the string\r\n * style nothing. Ignored on a `path`, like selections.\r\n */\r\n runs: TextRun[];\r\n}\r\n\r\n/** Coerce the loosely-typed `path` input into stored {@link PathData} (or null). */\r\nfunction resolveTextPath(value: PathData | PathBuilder | null | undefined): PathData | null {\r\n if (value == null) return null;\r\n return value instanceof PathBuilder ? value.toCommands() : value;\r\n}\r\n\r\nfunction resolveTextRuns(value: TextRun[] | null | undefined): ResolvedTextRun[] {\r\n if (!Array.isArray(value)) return [];\r\n return value.map(({ fill, stroke, ...run }) => ({\r\n ...run,\r\n ...(fill === undefined ? {} : { fill: fillOps.resolve(fill) }),\r\n ...(stroke === undefined ? {} : { stroke: strokeOps.resolve(stroke) }),\r\n }));\r\n}\r\n\r\n\r\n/**\r\n * Copy somebody typed, set in a face.\r\n *\r\n * The shaping, measuring and drawing are {@link TextBase}'s, shared with every\r\n * other node that puts glyphs on the canvas. What is here is what belongs to a\r\n * string an *author owns*: the string itself, whether its lines break, the path\r\n * it can be wrapped around, the two commands that add to it, and the selection\r\n * API that styles part of it.\r\n */\r\nexport class Text extends TextBase<TextProps> {\r\n\r\n @textProperty() declare readonly text: string;\r\n @property({ default: false }) declare readonly wrap: boolean;\r\n @property({ default: null, mapper: resolveTextPath })\r\n declare readonly path: PathData | null;\r\n @property({ default: [], mapper: resolveTextRuns, animatable: false })\r\n declare readonly runs: ResolvedTextRun[];\r\n\r\n constructor(props: NodeConfig<Text, TextProps>) {\r\n super(props);\r\n }\r\n\r\n override displayText(): string {\r\n return this.text;\r\n }\r\n\r\n protected override get wrapsText(): boolean {\r\n return this.wrap;\r\n }\r\n\r\n protected override get glyphPath(): PathData | null {\r\n return this.path;\r\n }\r\n\r\n protected override styledRuns(): readonly TextSelection[] {\r\n return this._selections;\r\n }\r\n\r\n protected override styleRuns(): readonly ResolvedTextRun[] {\r\n return this.runs;\r\n }\r\n\r\n // Text fills rather than hugs on the axis something else has to settle:\r\n // `autofit` measures glyphs against the allotted box (the base's rule), and\r\n // `wrap` needs a width to break lines against.\r\n protected override applyDefaultSize(props?: NodeConfig<Text, TextProps>): void {\r\n const autofit = props?.fontSize === 'autofit';\r\n this.applyProp(\"height\", props?.height ?? (autofit ? \"fill\" : \"hug\"));\r\n this.applyProp(\"width\", props?.width ?? (autofit || props?.wrap ? \"fill\" : \"hug\"));\r\n }\r\n\r\n @command({ args: [{ key: \"text\", kind: \"text\", default: \"\", multiline: true }] })\r\n append(args: CommandArgs<{ text: string }> & { duration: number }): Command<TextProps> {\r\n const text = (args.data as { text: string }).text;\r\n return this.to({ data: { text: this.text + text }, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n @command({ args: [{ key: \"text\", kind: \"text\", default: \"\", multiline: true }] })\r\n prepend(args: CommandArgs<{ text: string }> & { duration: number }): Command<TextProps> {\r\n const text = (args.data as { text: string }).text;\r\n return this.to({ data: { text: text + this.text }, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n // ---- Text selection ---------------------------------------------------\r\n\r\n /** Live selections in creation order. Later ones win on overlapping glyphs. */\r\n private _selections: TextSelection[] = [];\r\n\r\n /** @internal Called by {@link TextSelection} on construction. */\r\n _registerSelection(selection: TextSelection): void {\r\n this._selections.push(selection);\r\n }\r\n\r\n /**\r\n * Select an occurrence of `text`. By default the first occurrence; pass\r\n * `{ index }` to target the nth (0-based).\r\n *\r\n * @example title().find(\"hello\").to({ opacity: 0.5 }, 1);\r\n */\r\n find(text: string, opts?: { index?: number }): TextSelection {\r\n const source = this.text;\r\n const ranges: TextRange[] = [];\r\n if (text.length > 0) {\r\n let from = 0;\r\n let i: number;\r\n while ((i = source.indexOf(text, from)) !== -1) {\r\n ranges.push({ start: i, end: i + text.length });\r\n from = i + text.length;\r\n }\r\n }\r\n const index = opts?.index ?? 0;\r\n const picked = ranges[index] ? [ranges[index]] : [];\r\n return new TextSelection(this, picked);\r\n }\r\n\r\n /** Select every match of `regex`. A non-global regex matches once. */\r\n match(regex: RegExp): TextSelection {\r\n const flags = regex.flags.includes(\"g\") ? regex.flags : regex.flags + \"g\";\r\n const re = new RegExp(regex.source, flags);\r\n const ranges: TextRange[] = [];\r\n let m: RegExpExecArray | null;\r\n while ((m = re.exec(this.text)) !== null) {\r\n if (m[0].length === 0) { re.lastIndex++; continue; }\r\n ranges.push({ start: m.index, end: m.index + m[0].length });\r\n }\r\n return new TextSelection(this, ranges);\r\n }\r\n\r\n /** Select the nth `\\n`-delimited line (0-based), excluding the newline. */\r\n line(n: number): TextSelection {\r\n const lines = this.text.split(\"\\n\");\r\n let cursor = 0;\r\n for (let i = 0; i < lines.length; i++) {\r\n const len = lines[i].length;\r\n if (i === n) return new TextSelection(this, [{ start: cursor, end: cursor + len }]);\r\n cursor += len + 1; // + the consumed \"\\n\"\r\n }\r\n return new TextSelection(this, []);\r\n }\r\n\r\n /** Select every whitespace-delimited word. */\r\n words(): TextSelection {\r\n return new TextSelection(this, this._wordRanges());\r\n }\r\n\r\n /** Select the nth whitespace-delimited word (0-based). */\r\n word(n: number): TextSelection {\r\n const r = this._wordRanges()[n];\r\n return new TextSelection(this, r ? [r] : []);\r\n }\r\n\r\n /** Select the raw character range `[start, end)`. */\r\n slice(start: number, end: number): TextSelection {\r\n return new TextSelection(this, [{ start, end }]);\r\n }\r\n\r\n /** Select characters for which `predicate` returns true; adjacent hits merge. */\r\n filter(predicate: (char: string, index: number) => boolean): TextSelection {\r\n const ranges: TextRange[] = [];\r\n let runStart = -1;\r\n for (let i = 0; i < this.text.length; i++) {\r\n if (predicate(this.text[i], i)) {\r\n if (runStart === -1) runStart = i;\r\n } else if (runStart !== -1) {\r\n ranges.push({ start: runStart, end: i });\r\n runStart = -1;\r\n }\r\n }\r\n if (runStart !== -1) ranges.push({ start: runStart, end: this.text.length });\r\n return new TextSelection(this, ranges);\r\n }\r\n\r\n private _wordRanges(): TextRange[] {\r\n const ranges: TextRange[] = [];\r\n const re = /\\S+/g;\r\n let m: RegExpExecArray | null;\r\n while ((m = re.exec(this.text)) !== null) {\r\n ranges.push({ start: m.index, end: m.index + m[0].length });\r\n }\r\n return ranges;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA0B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIrF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAwDpD,mFAAmF;AACnF,MAAM,aAAa,GAAG,IAAI,GAAG,CAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACb,IAAI,CAAO;IACX,MAAM,CAAc;IAE7B;;;;OAIG;IACM,SAAS,CA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CAAC;QACvC,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\nimport type { FontStyle } from \"@/attributes/text/types\";\nimport type { Text } from \"./text-node\";\n\n/**\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\n *\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\n * selection that never touches its size reports the number that block is\n * actually shaped at rather than a second, different guess.\n */\nexport const AUTOFIT_PROBE_SIZE = 100;\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\n/** A half-open character range `[start, end)` of a Text node's string. */\nexport interface TextRange {\n start: number;\n end: number;\n}\n\n/**\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\n * before tweening (mirroring how {@link Text} resolves its own paint).\n *\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\n * anyway: what a selection is for is styling a run differently from its\n * neighbours, and a model that can change a word's weight but not its face is\n * one an editor has to work around rather than with. They switch at the end of a\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\n * the same reason a blend mode does: there is no half-way between two typefaces,\n * and inventing one would be a frame of text set in neither.\n */\nexport interface TextSelectionProps {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: Fill;\n stroke: Stroke;\n}\n\n/**\n * Live, resolved override state for a selection, read by the Text node each\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\n * meaning \"inherit the node's paint\".\n */\nexport interface SelectionOverrides {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: FillResolved[] | null;\n stroke: StrokeResolved[] | null;\n}\n\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\n\n/**\n * A sub-range of a {@link Text} node's glyphs that can be animated\n * independently. Returned by the node's selector methods (`find`, `match`,\n * `line`, `word`, `words`, `slice`, `filter`).\n *\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\n * plugs straight into the existing `Command` / `parallel` / `sequence`\n * machinery — each tween writes resolved values into {@link overrides}, which\n * the node reads when splitting its text into rendered pieces.\n *\n * @example\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\n */\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\n readonly node: Text;\n readonly ranges: TextRange[];\n\n /**\n * Current resolved overrides for this selection. Numeric fields default to\n * the node's current values (so a partial tween starts from the node's\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\n */\n readonly overrides: SelectionOverrides;\n\n constructor(node: Text, ranges: TextRange[]) {\n this.node = node;\n this.ranges = normalizeRanges(ranges, node.text.length);\n this.overrides = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n rotation: 0,\n fontFamily: node.fontFamily,\n // `'autofit'` is a *box* decision - the size the whole block settles\n // on - so it is not a per-run value at all. A selection on an autofit\n // node starts from the probe size the segmented layout shapes with,\n // and overriding it there is what \"this word, two sizes up\" means.\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\n fontStyle: node.fontStyle,\n fontWeight: node.fontWeight,\n letterSpacing: node.letterSpacing,\n fill: null,\n stroke: null,\n };\n node._registerSelection(this);\n }\n\n /** True when this selection has no overrides differing from the node default. */\n get isIdentity(): boolean {\n const o = this.overrides;\n const nodeSize = typeof this.node.fontSize === \"number\"\n ? this.node.fontSize\n : AUTOFIT_PROBE_SIZE;\n return (\n o.opacity === 1 &&\n o.x === 0 &&\n o.y === 0 &&\n o.scale === 1 &&\n o.rotation === 0 &&\n o.fontFamily === this.node.fontFamily &&\n o.fontSize === nodeSize &&\n o.fontStyle === this.node.fontStyle &&\n o.fontWeight === this.node.fontWeight &&\n o.letterSpacing === this.node.letterSpacing &&\n o.fill === null &&\n o.stroke === null\n );\n }\n\n /**\n * Write overrides straight onto the selection - no tween, no command.\n *\n * `to()` is the animation door and this is the *styling* one: an editor that\n * paints one word red is stating what the run **is**, not scheduling it, and\n * a zero-length `to()` would say the same thing while also landing a step on\n * the node's timeline for something that never moves. Paints are resolved\n * here exactly as `to()` resolves them, so a run styled this way and a run\n * tweened to the same value hold identical resolved arrays.\n *\n * Returns `this`, so a range and its style read as one expression.\n */\n set(props: Partial<TextSelectionProps>): this {\n const o = this.overrides;\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\n const value = props[key];\n if (value === undefined) continue;\n if (key === \"fill\") {\n o.fill = fillOps.resolve(value as Fill);\n } else if (key === \"stroke\") {\n o.stroke = strokeOps.resolve(value as Stroke);\n } else if (DISCRETE_KEYS.has(key)) {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\n } else if (typeof value === \"number\") {\n (o[key as \"opacity\"] as number) = value;\n }\n }\n return this;\n }\n\n @command()\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\n args: CommandArgs<D> & { duration: number },\n ): Command<TextSelectionProps> {\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\n }\n\n /**\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\n * directly; `fill`/`stroke` resolve their target once and lerp via the\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\n */\n _prepareStep(\n to: Partial<TextSelectionProps>,\n duration: number,\n easing?: EasingFunction,\n ): TweenStepper {\n const o = this.overrides;\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\n const customLerps: Array<(t: number) => void> = [];\n\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\n const target = to[key];\n if (target === undefined) continue;\n\n if (key === 'fill') {\n const from = o.fill ?? (this.node.fill as FillResolved[]);\n const resolved = fillOps.resolve(target as Fill);\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\n } else if (key === 'stroke') {\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\n const resolved = strokeOps.resolve(target as Stroke);\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\n } else if (DISCRETE_KEYS.has(key)) {\n // No half-way between two faces: hold the old one until the step\n // completes, then switch. `apply(1)` runs on the seek and the\n // advance paths alike, so a scrub past the end lands on it too.\n const next = target as string;\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\n customLerps.push((t) => {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\n });\n } else if (typeof target === 'number') {\n const k = key as keyof SelectionOverrides;\n numeric.push({ key: k, from: o[k] as number, to: target });\n }\n }\n\n const apply = (t: number): void => {\n const easedT = easing ? easing(t) : t;\n for (const n of numeric) {\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\n }\n for (const fn of customLerps) fn(easedT);\n };\n\n let elapsed = 0;\n return {\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\n advance: (dt: number): boolean => {\n elapsed += dt;\n if (elapsed < duration) {\n apply(elapsed / duration);\n return false;\n }\n apply(1);\n return true;\n },\n };\n }\n}\n\n/**\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\n * that touch or overlap so each glyph is covered once per selection. The\n * relative order selections were *created* in is preserved across selections by\n * the node's registry, not here.\n */\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\n const clamped = ranges\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\n .filter(r => r.end > r.start)\n .sort((a, b) => a.start - b.start);\n\n const merged: TextRange[] = [];\n for (const r of clamped) {\n const last = merged[merged.length - 1];\n if (last && r.start <= last.end) {\n last.end = Math.max(last.end, r.end);\n } else {\n merged.push({ ...r });\n }\n }\n return merged;\n}\n"]}
1
+ {"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA0B,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIrF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAwDpD,mFAAmF;AACnF,MAAM,aAAa,GAAG,IAAI,GAAG,CAA2B,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACb,IAAI,CAAO;IACX,MAAM,CAAc;IAE7B;;;;OAIG;IACM,SAAS,CAAqB;IAEvC,YAAY,IAAU,EAAE,MAAmB;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,eA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AG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { FontStyle } from \"@/attributes/text/types\";\r\nimport type { Text } from \"./text-node\";\r\n\r\n/**\r\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\r\n *\r\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\r\n * selection that never touches its size reports the number that block is\r\n * actually shaped at rather than a second, different guess.\r\n */\r\nexport const AUTOFIT_PROBE_SIZE = 100;\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\n/** A half-open character range `[start, end)` of a Text node's string. */\r\nexport interface TextRange {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/**\r\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\r\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\r\n * before tweening (mirroring how {@link Text} resolves its own paint).\r\n *\r\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\r\n * anyway: what a selection is for is styling a run differently from its\r\n * neighbours, and a model that can change a word's weight but not its face is\r\n * one an editor has to work around rather than with. They switch at the end of a\r\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\r\n * the same reason a blend mode does: there is no half-way between two typefaces,\r\n * and inventing one would be a frame of text set in neither.\r\n */\r\nexport interface TextSelectionProps {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: Fill;\r\n stroke: Stroke;\r\n}\r\n\r\n/**\r\n * Live, resolved override state for a selection, read by the Text node each\r\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\r\n * meaning \"inherit the node's paint\".\r\n */\r\nexport interface SelectionOverrides {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: FillResolved[] | null;\r\n stroke: StrokeResolved[] | null;\r\n}\r\n\r\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\r\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\r\n\r\n/**\r\n * A sub-range of a {@link Text} node's glyphs that can be animated\r\n * independently. Returned by the node's selector methods (`find`, `match`,\r\n * `line`, `word`, `words`, `slice`, `filter`).\r\n *\r\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\r\n * plugs straight into the existing `Command` / `parallel` / `sequence`\r\n * machinery — each tween writes resolved values into {@link overrides}, which\r\n * the node reads when splitting its text into rendered pieces.\r\n *\r\n * @example\r\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\r\n */\r\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\r\n readonly node: Text;\r\n readonly ranges: TextRange[];\r\n\r\n /**\r\n * Current resolved overrides for this selection. Numeric fields default to\r\n * the node's current values (so a partial tween starts from the node's\r\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\r\n */\r\n readonly overrides: SelectionOverrides;\r\n\r\n constructor(node: Text, ranges: TextRange[]) {\r\n this.node = node;\r\n this.ranges = normalizeRanges(ranges, node.text.length);\r\n this.overrides = {\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n scale: 1,\r\n rotation: 0,\r\n fontFamily: node.fontFamily,\r\n // `'autofit'` is a *box* decision - the size the whole block settles\r\n // on - so it is not a per-run value at all. A selection on an autofit\r\n // node starts from the probe size the segmented layout shapes with,\r\n // and overriding it there is what \"this word, two sizes up\" means.\r\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\r\n fontStyle: node.fontStyle,\r\n fontWeight: node.fontWeight,\r\n letterSpacing: node.letterSpacing,\r\n fill: null,\r\n stroke: null,\r\n };\r\n node._registerSelection(this);\r\n }\r\n\r\n /** True when this selection has no overrides differing from the node default. */\r\n get isIdentity(): boolean {\r\n const o = this.overrides;\r\n const nodeSize = typeof this.node.fontSize === \"number\"\r\n ? this.node.fontSize\r\n : AUTOFIT_PROBE_SIZE;\r\n return (\r\n o.opacity === 1 &&\r\n o.x === 0 &&\r\n o.y === 0 &&\r\n o.scale === 1 &&\r\n o.rotation === 0 &&\r\n o.fontFamily === this.node.fontFamily &&\r\n o.fontSize === nodeSize &&\r\n o.fontStyle === this.node.fontStyle &&\r\n o.fontWeight === this.node.fontWeight &&\r\n o.letterSpacing === this.node.letterSpacing &&\r\n o.fill === null &&\r\n o.stroke === null\r\n );\r\n }\r\n\r\n /**\r\n * Write overrides straight onto the selection - no tween, no command.\r\n *\r\n * `to()` is the animation door and this is the *styling* one: an editor that\r\n * paints one word red is stating what the run **is**, not scheduling it, and\r\n * a zero-length `to()` would say the same thing while also landing a step on\r\n * the node's timeline for something that never moves. Paints are resolved\r\n * here exactly as `to()` resolves them, so a run styled this way and a run\r\n * tweened to the same value hold identical resolved arrays.\r\n *\r\n * Returns `this`, so a range and its style read as one expression.\r\n */\r\n set(props: Partial<TextSelectionProps>): this {\r\n const o = this.overrides;\r\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\r\n const value = props[key];\r\n if (value === undefined) continue;\r\n if (key === \"fill\") {\r\n o.fill = fillOps.resolve(value as Fill);\r\n } else if (key === \"stroke\") {\r\n o.stroke = strokeOps.resolve(value as Stroke);\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\r\n } else if (typeof value === \"number\") {\r\n (o[key as \"opacity\"] as number) = value;\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n @command()\r\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\r\n args: CommandArgs<D> & { duration: number },\r\n ): Command<TextSelectionProps> {\r\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\r\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\r\n * directly; `fill`/`stroke` resolve their target once and lerp via the\r\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\r\n */\r\n _prepareStep(\r\n to: Partial<TextSelectionProps>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n ): TweenStepper {\r\n const o = this.overrides;\r\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\r\n const customLerps: Array<(t: number) => void> = [];\r\n\r\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\r\n const target = to[key];\r\n if (target === undefined) continue;\r\n\r\n if (key === 'fill') {\r\n const from = o.fill ?? (this.node.fill as FillResolved[]);\r\n const resolved = fillOps.resolve(target as Fill);\r\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\r\n } else if (key === 'stroke') {\r\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\r\n const resolved = strokeOps.resolve(target as Stroke);\r\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n // No half-way between two faces: hold the old one until the step\r\n // completes, then switch. `apply(1)` runs on the seek and the\r\n // advance paths alike, so a scrub past the end lands on it too.\r\n const next = target as string;\r\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\r\n customLerps.push((t) => {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\r\n });\r\n } else if (typeof target === 'number') {\r\n const k = key as keyof SelectionOverrides;\r\n numeric.push({ key: k, from: o[k] as number, to: target });\r\n }\r\n }\r\n\r\n const apply = (t: number): void => {\r\n const easedT = easing ? easing(t) : t;\r\n for (const n of numeric) {\r\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\r\n }\r\n for (const fn of customLerps) fn(easedT);\r\n };\r\n\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n if (elapsed < duration) {\r\n apply(elapsed / duration);\r\n return false;\r\n }\r\n apply(1);\r\n return true;\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\r\n * that touch or overlap so each glyph is covered once per selection. The\r\n * relative order selections were *created* in is preserved across selections by\r\n * the node's registry, not here.\r\n */\r\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\r\n const clamped = ranges\r\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\r\n .filter(r => r.end > r.start)\r\n .sort((a, b) => a.start - b.start);\r\n\r\n const merged: TextRange[] = [];\r\n for (const r of clamped) {\r\n const last = merged[merged.length - 1];\r\n if (last && r.start <= last.end) {\r\n last.end = Math.max(last.end, r.end);\r\n } else {\r\n merged.push({ ...r });\r\n }\r\n }\r\n return merged;\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import type { Transform3D } from "../../render3d/transform.js";
2
- import type { CameraData3D } from "../../render3d/camera.js";
2
+ import { type CameraData3D } from "../../render3d/camera.js";
3
+ import type { Command, CommandArgs } from "../../tween/command.js";
3
4
  import type { RenderContext3D } from "../../render3d/render-context3d.js";
4
5
  import type { Vector3Input } from "../../render3d/vector3.js";
5
6
  import { Node3D, type Node3DProps } from "./node3d.js";
@@ -20,8 +21,7 @@ import { Node3D, type Node3DProps } from "./node3d.js";
20
21
  * around the thing it is looking at, which is what a camera move almost always
21
22
  * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair
22
23
  * recomputed every frame in a prop binding — which is exactly what every scene
23
- * did before this existed, and what the template's own `Graph3D` node
24
- * independently reinvented `orbit`/`elevation`/`zoom` props to avoid.
24
+ * did before this existed.
25
25
  *
26
26
  * `position` and `lookAt` still work and are right for a shot pinned to
27
27
  * something; setting any polar field takes over, so the two can never be half
@@ -73,6 +73,24 @@ export declare class Camera3D<P extends Camera3DProps = Camera3DProps> extends N
73
73
  near: number | undefined;
74
74
  far: number | undefined;
75
75
  zoom: number | undefined;
76
+ /**
77
+ * Swing round {@link target}, and pull back or in, whichever are given. A
78
+ * camera not yet placed by its polar fields starts from what an unset one
79
+ * reads as.
80
+ */
81
+ orbitTo(args: CommandArgs<{
82
+ orbit?: number;
83
+ elevation?: number;
84
+ distance?: number;
85
+ }> & {
86
+ duration: number;
87
+ }): Command<P>;
88
+ /** Turn to look at another point: animates {@link target}. */
89
+ lookTo(args: CommandArgs<{
90
+ target: Vector3Input;
91
+ }> & {
92
+ duration: number;
93
+ }): Command<P>;
76
94
  /**
77
95
  * A camera's group stays identity; the camera places itself.
78
96
  *
@@ -1 +1 @@
1
- {"version":3,"file":"camera-nodes.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { property } from "../../attributes/properties/decorator.js";
8
+ import { optionalVector3Property } from "../../attributes/properties/typed.js";
9
+ import { ORBIT_CAMERA_DEFAULTS } from "../../render3d/camera.js";
10
+ import { command } from "../../tween/command-decorator.js";
8
11
  import { Node3D } from "./node3d.js";
9
12
  const CAMERA_KEYS = [
10
13
  "target", "orbit", "elevation", "distance",
11
14
  "fov", "frustumHeight", "near", "far", "zoom",
12
15
  ];
13
16
  export class Camera3D extends Node3D {
17
+ /**
18
+ * Swing round {@link target}, and pull back or in, whichever are given. A
19
+ * camera not yet placed by its polar fields starts from what an unset one
20
+ * reads as.
21
+ */
22
+ orbitTo(args) {
23
+ const to = args.data ?? {};
24
+ const from = {
25
+ orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,
26
+ elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,
27
+ distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,
28
+ };
29
+ return this.command((t) => {
30
+ const out = {};
31
+ for (const key of ["orbit", "elevation", "distance"]) {
32
+ const end = to[key];
33
+ if (end !== undefined)
34
+ out[key] = from[key] + (end - from[key]) * t;
35
+ }
36
+ return out;
37
+ }, args.duration, args.easing);
38
+ }
39
+ /** Turn to look at another point: animates {@link target}. */
40
+ lookTo(args) {
41
+ return this.to({ data: args.data, duration: args.duration, easing: args.easing });
42
+ }
14
43
  /**
15
44
  * A camera's group stays identity; the camera places itself.
16
45
  *
@@ -42,7 +71,7 @@ __decorate([
42
71
  property({ default: "perspective" })
43
72
  ], Camera3D.prototype, "type", void 0);
44
73
  __decorate([
45
- property({ default: undefined })
74
+ optionalVector3Property("origin")
46
75
  ], Camera3D.prototype, "target", void 0);
47
76
  __decorate([
48
77
  property({ default: undefined })
@@ -68,4 +97,16 @@ __decorate([
68
97
  __decorate([
69
98
  property({ default: undefined })
70
99
  ], Camera3D.prototype, "zoom", void 0);
100
+ __decorate([
101
+ command({
102
+ args: [
103
+ { key: "orbit", kind: "number", step: 1, unit: "°" },
104
+ { key: "elevation", kind: "number", min: -89, max: 89, step: 1, unit: "°" },
105
+ { key: "distance", kind: "number", min: 0.01, step: 0.1 },
106
+ ],
107
+ })
108
+ ], Camera3D.prototype, "orbitTo", null);
109
+ __decorate([
110
+ command({ args: ["target"] })
111
+ ], Camera3D.prototype, "lookTo", null);
71
112
  //# sourceMappingURL=camera-nodes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAK7D,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AA8DpD,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU;IAC1C,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CACvC,CAAC;AAEX,MAAM,OAAO,QAAkD,SAAQ,MAAS;IAc5E;;;;;;;;OAQG;IACgB,cAAc;QAC7B,OAAO,EAAE,CAAC;IACd,CAAC;IAES,WAAW;QACjB,MAAM,GAAG,GAA4B,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACzD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC5B,MAAM,KAAK,GAAI,IAA2C,CAAC,GAAG,CAAC,CAAC;YAChE,IAAI,KAAK,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC9C,CAAC;QACD,OAAO,GAA8B,CAAC;IAC1C,CAAC;IAED,4FAA4F;IACnF,aAAa,KAAW,CAAC;IAEf,UAAU,CAAC,GAAoB;QAC9C,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,EAAkB,CAAC,CAAC;IACjF,CAAC;CACJ;AAzCiD;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;sCAAoC;AAE/B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;wCAA0C;AACjC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;uCAAmC;AAC1B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;2CAAuC;AAC9B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;0CAAsC;AAE7B;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;+CAA2C;AAClC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC;AACzB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport type { Transform3D } from \"@/render3d/transform\";\nimport type { CameraData3D } from \"@/render3d/camera\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport type { Vector3Input } from \"@/render3d/vector3\";\nimport { Node3D, type Node3DProps } from \"./node3d\";\n\n/**\n * The camera — where the scene is viewed from.\n *\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\n * one; there is no second class, because a perspective and an orthographic\n * camera are one object with a projection setting, which is how every editor\n * presents it and how a scene switching between them has to be written.\n *\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\n *\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\n *\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\n * around the thing it is looking at, which is what a camera move almost always\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\n * recomputed every frame in a prop binding — which is exactly what every scene\n * did before this existed, and what the template's own `Graph3D` node\n * independently reinvented `orbit`/`elevation`/`zoom` props to avoid.\n *\n * `position` and `lookAt` still work and are right for a shot pinned to\n * something; setting any polar field takes over, so the two can never be half\n * applied. Either way the camera is a node, so parenting it to a moving\n * `Group3D` carries the shot with the rig.\n *\n * ── What is derived ───────────────────────────────────────────────────────────\n * `near`/`far` come from the scene's own bounds unless you set them, and the\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\n * documentation said \"don't set this\", and setting it stretched the render.\n * An asymmetric orthographic frustum is a `params` override rather than four\n * more fields.\n *\n * A scene with no camera gets a sensible default framing. A scene that declares\n * more than one keeps the last, since there is only ever one view.\n */\nexport interface Camera3DProps extends Node3DProps {\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\n type: CameraData3D[\"type\"];\n /**\n * The point the camera looks at, and orbits around.\n *\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\n * together with any of the three below it is also the centre they turn about.\n */\n target: Vector3Input | undefined;\n /** Azimuth around {@link target}, in **degrees**. */\n orbit: number | undefined;\n /** Angle above the horizon, in **degrees**. */\n elevation: number | undefined;\n /** Distance from {@link target}. */\n distance: number | undefined;\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\n fov: number | undefined;\n /** Orthographic only: visible world height. Default 10. */\n frustumHeight: number | undefined;\n near: number | undefined;\n far: number | undefined;\n zoom: number | undefined;\n}\n\nconst CAMERA_KEYS = [\n \"target\", \"orbit\", \"elevation\", \"distance\",\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\n] as const;\n\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\n\n @property({ default: undefined }) declare target: Vector3Input | undefined;\n @property({ default: undefined }) declare orbit: number | undefined;\n @property({ default: undefined }) declare elevation: number | undefined;\n @property({ default: undefined }) declare distance: number | undefined;\n\n @property({ default: undefined }) declare fov: number | undefined;\n @property({ default: undefined }) declare frustumHeight: number | undefined;\n @property({ default: undefined }) declare near: number | undefined;\n @property({ default: undefined }) declare far: number | undefined;\n @property({ default: undefined }) declare zoom: number | undefined;\n\n /**\n * A camera's group stays identity; the camera places itself.\n *\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\n * camera sitting inside a group that carried its placement would face exactly\n * backwards. Putting the placement on the descriptor hands it to the camera\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\n * is still parent-relative, so a camera inside a moving rig is carried by it.\n */\n protected override groupTransform(): Transform3D {\n return {};\n }\n\n protected buildCamera(): CameraData3D {\n const out: Record<string, unknown> = { type: this.type };\n for (const key of CAMERA_KEYS) {\n const value = (this as unknown as Record<string, unknown>)[key];\n if (value !== undefined) out[key] = value;\n }\n return out as unknown as CameraData3D;\n }\n\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\n override declareAssets(): void { }\n\n protected override renderSelf(ctx: RenderContext3D): void {\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\n }\n}\n"]}
1
+ {"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AA6DpD,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,OAAO,EAAE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SAAS,EAAE,CAAC;sCAAkC;AAcnE;IAPC,OAAO,CAAC;QACL,IAAI,EAAE;YACF,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE;YACpD,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE;YAC3E,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;SAC5D;KACJ,CAAC;uCAkBD;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;sCAG7B","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property } from \"@/attributes/properties/typed\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport { ORBIT_CAMERA_DEFAULTS, type CameraData3D } from \"@/render3d/camera\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport type { Vector3Input } from \"@/render3d/vector3\";\r\nimport { Node3D, type Node3DProps } from \"./node3d\";\r\n\r\n/**\r\n * The camera — where the scene is viewed from.\r\n *\r\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\r\n * one; there is no second class, because a perspective and an orthographic\r\n * camera are one object with a projection setting, which is how every editor\r\n * presents it and how a scene switching between them has to be written.\r\n *\r\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\r\n *\r\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\r\n *\r\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\r\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\r\n * around the thing it is looking at, which is what a camera move almost always\r\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\r\n * recomputed every frame in a prop binding — which is exactly what every scene\r\n * did before this existed.\r\n *\r\n * `position` and `lookAt` still work and are right for a shot pinned to\r\n * something; setting any polar field takes over, so the two can never be half\r\n * applied. Either way the camera is a node, so parenting it to a moving\r\n * `Group3D` carries the shot with the rig.\r\n *\r\n * ── What is derived ───────────────────────────────────────────────────────────\r\n * `near`/`far` come from the scene's own bounds unless you set them, and the\r\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\r\n * documentation said \"don't set this\", and setting it stretched the render.\r\n * An asymmetric orthographic frustum is a `params` override rather than four\r\n * more fields.\r\n *\r\n * A scene with no camera gets a sensible default framing. A scene that declares\r\n * more than one keeps the last, since there is only ever one view.\r\n */\r\nexport interface Camera3DProps extends Node3DProps {\r\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\r\n type: CameraData3D[\"type\"];\r\n /**\r\n * The point the camera looks at, and orbits around.\r\n *\r\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\r\n * together with any of the three below it is also the centre they turn about.\r\n */\r\n target: Vector3Input | undefined;\r\n /** Azimuth around {@link target}, in **degrees**. */\r\n orbit: number | undefined;\r\n /** Angle above the horizon, in **degrees**. */\r\n elevation: number | undefined;\r\n /** Distance from {@link target}. */\r\n distance: number | undefined;\r\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\r\n fov: number | undefined;\r\n /** Orthographic only: visible world height. Default 10. */\r\n frustumHeight: number | undefined;\r\n near: number | undefined;\r\n far: number | undefined;\r\n zoom: number | undefined;\r\n}\r\n\r\nconst CAMERA_KEYS = [\r\n \"target\", \"orbit\", \"elevation\", \"distance\",\r\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\r\n] as const;\r\n\r\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\r\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\r\n\r\n @optionalVector3Property(\"origin\") declare target: Vector3Input | undefined;\r\n @property({ default: undefined }) declare orbit: number | undefined;\r\n @property({ default: undefined }) declare elevation: number | undefined;\r\n @property({ default: undefined }) declare distance: number | undefined;\r\n\r\n @property({ default: undefined }) declare fov: number | undefined;\r\n @property({ default: undefined }) declare frustumHeight: number | undefined;\r\n @property({ default: undefined }) declare near: number | undefined;\r\n @property({ default: undefined }) declare far: number | undefined;\r\n @property({ default: undefined }) declare zoom: number | undefined;\r\n\r\n /**\r\n * Swing round {@link target}, and pull back or in, whichever are given. A\r\n * camera not yet placed by its polar fields starts from what an unset one\r\n * reads as.\r\n */\r\n @command({\r\n args: [\r\n { key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" },\r\n { key: \"elevation\", kind: \"number\", min: -89, max: 89, step: 1, unit: \"°\" },\r\n { key: \"distance\", kind: \"number\", min: 0.01, step: 0.1 },\r\n ],\r\n })\r\n orbitTo(\r\n args: CommandArgs<{ orbit?: number; elevation?: number; distance?: number }> & { duration: number },\r\n ): Command<P> {\r\n const to = args.data ?? {};\r\n const from = {\r\n orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,\r\n elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,\r\n distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,\r\n };\r\n return this.command<P>((t) => {\r\n const out: Record<string, number> = {};\r\n for (const key of [\"orbit\", \"elevation\", \"distance\"] as const) {\r\n const end = to[key];\r\n if (end !== undefined) out[key] = from[key] + (end - from[key]) * t;\r\n }\r\n return out as Partial<P>;\r\n }, args.duration, args.easing);\r\n }\r\n\r\n /** Turn to look at another point: animates {@link target}. */\r\n @command({ args: [\"target\"] })\r\n lookTo(args: CommandArgs<{ target: Vector3Input }> & { duration: number }): Command<P> {\r\n return this.to({ data: args.data as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * A camera's group stays identity; the camera places itself.\r\n *\r\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\r\n * camera sitting inside a group that carried its placement would face exactly\r\n * backwards. Putting the placement on the descriptor hands it to the camera\r\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\r\n * is still parent-relative, so a camera inside a moving rig is carried by it.\r\n */\r\n protected override groupTransform(): Transform3D {\r\n return {};\r\n }\r\n\r\n protected buildCamera(): CameraData3D {\r\n const out: Record<string, unknown> = { type: this.type };\r\n for (const key of CAMERA_KEYS) {\r\n const value = (this as unknown as Record<string, unknown>)[key];\r\n if (value !== undefined) out[key] = value;\r\n }\r\n return out as unknown as CameraData3D;\r\n }\r\n\r\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\r\n override declareAssets(): void { }\r\n\r\n protected override renderSelf(ctx: RenderContext3D): void {\r\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\r\n }\r\n}\r\n"]}