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

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 (904) hide show
  1. package/CHANGELOG.md +247 -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-2RIYH36X.js +3 -0
  240. package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
  241. package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
  242. package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
  243. package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
  244. package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
  245. package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
  246. package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
  247. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  248. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  249. package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
  250. package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
  251. package/dist/browser/component.js +1 -1
  252. package/dist/browser/component.js.map +4 -4
  253. package/dist/browser/experimental.js +2 -0
  254. package/dist/browser/experimental.js.map +7 -0
  255. package/dist/browser/index.js +1 -1
  256. package/dist/browser/index.js.map +4 -4
  257. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  258. package/dist/browser/jsx-jsx-runtime.js +1 -1
  259. package/dist/browser/manifest.json +4 -2
  260. package/dist/browser/sdk.js +1 -1
  261. package/dist/component/api.d.ts +508 -0
  262. package/dist/component/api.d.ts.map +1 -0
  263. package/dist/component/api.js +4 -0
  264. package/dist/component/api.js.map +1 -0
  265. package/dist/component/builtins/audio.d.ts +26 -0
  266. package/dist/component/builtins/audio.d.ts.map +1 -0
  267. package/dist/component/builtins/audio.js +41 -0
  268. package/dist/component/builtins/audio.js.map +1 -0
  269. package/dist/component/builtins/canvas3d.d.ts +98 -0
  270. package/dist/component/builtins/canvas3d.d.ts.map +1 -0
  271. package/dist/component/builtins/canvas3d.js +21 -0
  272. package/dist/component/builtins/canvas3d.js.map +1 -0
  273. package/dist/component/builtins/composite.d.ts +56 -0
  274. package/dist/component/builtins/composite.d.ts.map +1 -0
  275. package/dist/component/builtins/composite.js +25 -0
  276. package/dist/component/builtins/composite.js.map +1 -0
  277. package/dist/component/builtins/geometry.d.ts +505 -0
  278. package/dist/component/builtins/geometry.d.ts.map +1 -0
  279. package/dist/component/builtins/geometry.js +107 -0
  280. package/dist/component/builtins/geometry.js.map +1 -0
  281. package/dist/component/builtins/layout.d.ts +88 -0
  282. package/dist/component/builtins/layout.d.ts.map +1 -0
  283. package/dist/component/builtins/layout.js +84 -0
  284. package/dist/component/builtins/layout.js.map +1 -0
  285. package/dist/component/builtins/media.d.ts +95 -0
  286. package/dist/component/builtins/media.d.ts.map +1 -0
  287. package/dist/component/builtins/media.js +149 -0
  288. package/dist/component/builtins/media.js.map +1 -0
  289. package/dist/component/builtins/providers.d.ts +23 -0
  290. package/dist/component/builtins/providers.d.ts.map +1 -0
  291. package/dist/component/builtins/providers.js +30 -0
  292. package/dist/component/builtins/providers.js.map +1 -0
  293. package/dist/component/builtins/text.d.ts +193 -0
  294. package/dist/component/builtins/text.d.ts.map +1 -0
  295. package/dist/component/builtins/text.js +113 -0
  296. package/dist/component/builtins/text.js.map +1 -0
  297. package/dist/component/builtins/three.d.ts +1085 -0
  298. package/dist/component/builtins/three.d.ts.map +1 -0
  299. package/dist/component/builtins/three.js +265 -0
  300. package/dist/component/builtins/three.js.map +1 -0
  301. package/dist/component/clip-of.d.ts +5 -0
  302. package/dist/component/clip-of.d.ts.map +1 -0
  303. package/dist/component/clip-of.js +33 -0
  304. package/dist/component/clip-of.js.map +1 -0
  305. package/dist/component/commands-for.d.ts +19 -0
  306. package/dist/component/commands-for.d.ts.map +1 -0
  307. package/dist/component/commands-for.js +5 -0
  308. package/dist/component/commands-for.js.map +1 -0
  309. package/dist/component/component-audio.d.ts +9 -0
  310. package/dist/component/component-audio.d.ts.map +1 -0
  311. package/dist/component/component-audio.js +18 -0
  312. package/dist/component/component-audio.js.map +1 -0
  313. package/dist/component/component2d.d.ts +9 -0
  314. package/dist/component/component2d.d.ts.map +1 -0
  315. package/dist/component/component2d.js +239 -0
  316. package/dist/component/component2d.js.map +1 -0
  317. package/dist/component/component3d.d.ts +9 -0
  318. package/dist/component/component3d.d.ts.map +1 -0
  319. package/dist/component/component3d.js +99 -0
  320. package/dist/component/component3d.js.map +1 -0
  321. package/dist/component/factory.d.ts +63 -0
  322. package/dist/component/factory.d.ts.map +1 -0
  323. package/dist/component/factory.js +313 -0
  324. package/dist/component/factory.js.map +1 -0
  325. package/dist/component/modules/aim.d.ts +30 -0
  326. package/dist/component/modules/aim.d.ts.map +1 -0
  327. package/dist/component/modules/aim.js +39 -0
  328. package/dist/component/modules/aim.js.map +1 -0
  329. package/dist/component/modules/corners.d.ts +13 -0
  330. package/dist/component/modules/corners.d.ts.map +1 -0
  331. package/dist/component/modules/corners.js +12 -0
  332. package/dist/component/modules/corners.js.map +1 -0
  333. package/dist/component/modules/flow.d.ts +26 -0
  334. package/dist/component/modules/flow.d.ts.map +1 -0
  335. package/dist/component/modules/flow.js +55 -0
  336. package/dist/component/modules/flow.js.map +1 -0
  337. package/dist/component/modules/material.d.ts +40 -0
  338. package/dist/component/modules/material.d.ts.map +1 -0
  339. package/dist/component/modules/material.js +75 -0
  340. package/dist/component/modules/material.js.map +1 -0
  341. package/dist/component/modules/paint.d.ts +71 -0
  342. package/dist/component/modules/paint.d.ts.map +1 -0
  343. package/dist/component/modules/paint.js +106 -0
  344. package/dist/component/modules/paint.js.map +1 -0
  345. package/dist/component/modules/shapes.d.ts +31 -0
  346. package/dist/component/modules/shapes.d.ts.map +1 -0
  347. package/dist/component/modules/shapes.js +43 -0
  348. package/dist/component/modules/shapes.js.map +1 -0
  349. package/dist/component/modules/text-layout.d.ts +26 -0
  350. package/dist/component/modules/text-layout.d.ts.map +1 -0
  351. package/dist/component/modules/text-layout.js +57 -0
  352. package/dist/component/modules/text-layout.js.map +1 -0
  353. package/dist/component/modules/text-style.d.ts +48 -0
  354. package/dist/component/modules/text-style.d.ts.map +1 -0
  355. package/dist/component/modules/text-style.js +63 -0
  356. package/dist/component/modules/text-style.js.map +1 -0
  357. package/dist/component/modules/three-entries.d.ts +23 -0
  358. package/dist/component/modules/three-entries.d.ts.map +1 -0
  359. package/dist/component/modules/three-entries.js +41 -0
  360. package/dist/component/modules/three-entries.js.map +1 -0
  361. package/dist/component/modules/view3d.d.ts +55 -0
  362. package/dist/component/modules/view3d.d.ts.map +1 -0
  363. package/dist/component/modules/view3d.js +160 -0
  364. package/dist/component/modules/view3d.js.map +1 -0
  365. package/dist/component/timeline.d.ts +22 -0
  366. package/dist/component/timeline.d.ts.map +1 -0
  367. package/dist/component/timeline.js +128 -0
  368. package/dist/component/timeline.js.map +1 -0
  369. package/dist/component/type-def.d.ts +26 -0
  370. package/dist/component/type-def.d.ts.map +1 -0
  371. package/dist/component/type-def.js +16 -0
  372. package/dist/component/type-def.js.map +1 -0
  373. package/dist/component/types.d.ts +91 -0
  374. package/dist/component/types.d.ts.map +1 -0
  375. package/dist/component/types.js +88 -0
  376. package/dist/component/types.js.map +1 -0
  377. package/dist/component/views.d.ts +121 -0
  378. package/dist/component/views.d.ts.map +1 -0
  379. package/dist/component/views.js +413 -0
  380. package/dist/component/views.js.map +1 -0
  381. package/dist/component.d.ts +4 -5
  382. package/dist/component.d.ts.map +1 -1
  383. package/dist/component.js +3 -5
  384. package/dist/component.js.map +1 -1
  385. package/dist/document/audio.d.ts +10 -2
  386. package/dist/document/audio.d.ts.map +1 -1
  387. package/dist/document/audio.js +45 -4
  388. package/dist/document/audio.js.map +1 -1
  389. package/dist/document/builtins.d.ts.map +1 -1
  390. package/dist/document/builtins.js +15 -39
  391. package/dist/document/builtins.js.map +1 -1
  392. package/dist/document/command-traits.d.ts +1 -1
  393. package/dist/document/command-traits.js +16 -1
  394. package/dist/document/command-traits.js.map +1 -1
  395. package/dist/document/deny-globals.js.map +1 -1
  396. package/dist/document/diff.d.ts.map +1 -1
  397. package/dist/document/diff.js +3 -3
  398. package/dist/document/diff.js.map +1 -1
  399. package/dist/document/doc-index.d.ts +2 -2
  400. package/dist/document/doc-index.d.ts.map +1 -1
  401. package/dist/document/doc-index.js +3 -3
  402. package/dist/document/doc-index.js.map +1 -1
  403. package/dist/document/expression/compile.d.ts.map +1 -1
  404. package/dist/document/expression/compile.js +8 -5
  405. package/dist/document/expression/compile.js.map +1 -1
  406. package/dist/document/expression/index.js.map +1 -1
  407. package/dist/document/expression/ops.js +1 -1
  408. package/dist/document/expression/ops.js.map +1 -1
  409. package/dist/document/expression/parse.d.ts.map +1 -1
  410. package/dist/document/expression/parse.js +15 -6
  411. package/dist/document/expression/parse.js.map +1 -1
  412. package/dist/document/expression/refs.d.ts +1 -1
  413. package/dist/document/expression/refs.js +1 -1
  414. package/dist/document/expression/refs.js.map +1 -1
  415. package/dist/document/expression/types.js.map +1 -1
  416. package/dist/document/expression/walk.d.ts.map +1 -1
  417. package/dist/document/expression/walk.js +2 -1
  418. package/dist/document/expression/walk.js.map +1 -1
  419. package/dist/document/index.d.ts +2 -0
  420. package/dist/document/index.d.ts.map +1 -1
  421. package/dist/document/index.js +2 -0
  422. package/dist/document/index.js.map +1 -1
  423. package/dist/document/node-decorator.js.map +1 -1
  424. package/dist/document/node-descriptor.d.ts +25 -0
  425. package/dist/document/node-descriptor.d.ts.map +1 -1
  426. package/dist/document/node-descriptor.js.map +1 -1
  427. package/dist/document/placement.d.ts +70 -0
  428. package/dist/document/placement.d.ts.map +1 -0
  429. package/dist/document/placement.js +83 -0
  430. package/dist/document/placement.js.map +1 -0
  431. package/dist/document/project.d.ts +2 -2
  432. package/dist/document/project.d.ts.map +1 -1
  433. package/dist/document/project.js.map +1 -1
  434. package/dist/document/registry.d.ts +23 -11
  435. package/dist/document/registry.d.ts.map +1 -1
  436. package/dist/document/registry.js +46 -19
  437. package/dist/document/registry.js.map +1 -1
  438. package/dist/document/settled-index.d.ts +49 -0
  439. package/dist/document/settled-index.d.ts.map +1 -0
  440. package/dist/document/settled-index.js +247 -0
  441. package/dist/document/settled-index.js.map +1 -0
  442. package/dist/document/timeline-patch.js.map +1 -1
  443. package/dist/document/timeline.d.ts +100 -19
  444. package/dist/document/timeline.d.ts.map +1 -1
  445. package/dist/document/timeline.js +290 -42
  446. package/dist/document/timeline.js.map +1 -1
  447. package/dist/document/types.d.ts +12 -12
  448. package/dist/document/types.d.ts.map +1 -1
  449. package/dist/document/types.js +2 -2
  450. package/dist/document/types.js.map +1 -1
  451. package/dist/document/validate.d.ts +2 -2
  452. package/dist/document/validate.d.ts.map +1 -1
  453. package/dist/document/validate.js +37 -31
  454. package/dist/document/validate.js.map +1 -1
  455. package/dist/document/withdraw.d.ts +28 -0
  456. package/dist/document/withdraw.d.ts.map +1 -0
  457. package/dist/document/withdraw.js +61 -0
  458. package/dist/document/withdraw.js.map +1 -0
  459. package/dist/experimental.d.ts +22 -0
  460. package/dist/experimental.d.ts.map +1 -0
  461. package/dist/experimental.js +20 -0
  462. package/dist/experimental.js.map +1 -0
  463. package/dist/index.d.ts +10 -0
  464. package/dist/index.d.ts.map +1 -1
  465. package/dist/index.js +10 -0
  466. package/dist/index.js.map +1 -1
  467. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  468. package/dist/jsx/jsx-runtime.d.ts +9 -1
  469. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  470. package/dist/jsx/jsx-runtime.js +13 -3
  471. package/dist/jsx/jsx-runtime.js.map +1 -1
  472. package/dist/layout/bounds.d.ts +0 -1
  473. package/dist/layout/bounds.d.ts.map +1 -1
  474. package/dist/layout/bounds.js.map +1 -1
  475. package/dist/layout/constraints.js.map +1 -1
  476. package/dist/layout/flex.d.ts +4 -2
  477. package/dist/layout/flex.d.ts.map +1 -1
  478. package/dist/layout/flex.js +27 -11
  479. package/dist/layout/flex.js.map +1 -1
  480. package/dist/layout/freeform.js.map +1 -1
  481. package/dist/layout/grid.js.map +1 -1
  482. package/dist/layout/index.js.map +1 -1
  483. package/dist/layout/item.js.map +1 -1
  484. package/dist/layout/ops.d.ts +6 -0
  485. package/dist/layout/ops.d.ts.map +1 -1
  486. package/dist/layout/ops.js +6 -0
  487. package/dist/layout/ops.js.map +1 -1
  488. package/dist/layout/types.js.map +1 -1
  489. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  490. package/dist/nodes/2d/node-motion.js.map +1 -1
  491. package/dist/nodes/2d/node-render.d.ts +3 -3
  492. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  493. package/dist/nodes/2d/node-render.js.map +1 -1
  494. package/dist/nodes/2d/node-transform.js.map +1 -1
  495. package/dist/nodes/2d/node2d.d.ts +115 -3
  496. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  497. package/dist/nodes/2d/node2d.js +180 -28
  498. package/dist/nodes/2d/node2d.js.map +1 -1
  499. package/dist/nodes/2d/paint-node.d.ts +27 -0
  500. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  501. package/dist/nodes/2d/paint-node.js +42 -0
  502. package/dist/nodes/2d/paint-node.js.map +1 -1
  503. package/dist/nodes/audio/audio-bus.js.map +1 -1
  504. package/dist/nodes/audio/index.d.ts +2 -2
  505. package/dist/nodes/audio/index.d.ts.map +1 -1
  506. package/dist/nodes/audio/index.js +0 -2
  507. package/dist/nodes/audio/index.js.map +1 -1
  508. package/dist/nodes/audio/node-audio.js.map +1 -1
  509. package/dist/nodes/audio/sound-node.d.ts +4 -3
  510. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  511. package/dist/nodes/audio/sound-node.js +4 -1
  512. package/dist/nodes/audio/sound-node.js.map +1 -1
  513. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  514. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  515. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  516. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  517. package/dist/nodes/geometry/box-path-node.js +2 -2
  518. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  519. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  520. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  521. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  522. package/dist/nodes/geometry/group-bounds.js +1 -2
  523. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  524. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  525. package/dist/nodes/geometry/path-node.js +6 -0
  526. package/dist/nodes/geometry/path-node.js.map +1 -1
  527. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  528. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  529. package/dist/nodes/geometry/rect-node.js.map +1 -1
  530. package/dist/nodes/geometry/shape-node.js.map +1 -1
  531. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  532. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  533. package/dist/nodes/geometry/shape-outline.js +2 -13
  534. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  535. package/dist/nodes/index.d.ts +40 -33
  536. package/dist/nodes/index.d.ts.map +1 -1
  537. package/dist/nodes/index.js +17 -36
  538. package/dist/nodes/index.js.map +1 -1
  539. package/dist/nodes/layout/camera-node.d.ts +9 -0
  540. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  541. package/dist/nodes/layout/camera-node.js +38 -3
  542. package/dist/nodes/layout/camera-node.js.map +1 -1
  543. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  544. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  545. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  546. package/dist/nodes/layout/rotated-box.js.map +1 -1
  547. package/dist/nodes/media/video-node.d.ts.map +1 -1
  548. package/dist/nodes/media/video-node.js +2 -0
  549. package/dist/nodes/media/video-node.js.map +1 -1
  550. package/dist/nodes/node/declare-paints.js.map +1 -1
  551. package/dist/nodes/node/node-editor-state.js.map +1 -1
  552. package/dist/nodes/node/node-reactive.js.map +1 -1
  553. package/dist/nodes/node/node-time.d.ts +3 -3
  554. package/dist/nodes/node/node-time.d.ts.map +1 -1
  555. package/dist/nodes/node/node-time.js +1 -1
  556. package/dist/nodes/node/node-time.js.map +1 -1
  557. package/dist/nodes/node/node-walk.js.map +1 -1
  558. package/dist/nodes/node/node.d.ts +12 -4
  559. package/dist/nodes/node/node.d.ts.map +1 -1
  560. package/dist/nodes/node/node.js +67 -27
  561. package/dist/nodes/node/node.js.map +1 -1
  562. package/dist/nodes/node/text-defaults.d.ts +10 -12
  563. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  564. package/dist/nodes/node/text-defaults.js +10 -12
  565. package/dist/nodes/node/text-defaults.js.map +1 -1
  566. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
  567. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  568. package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
  569. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  570. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  571. package/dist/nodes/root/provider-node.js.map +1 -0
  572. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  573. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  574. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  575. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  576. package/dist/nodes/text/default-text-style-node.js +10 -4
  577. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  578. package/dist/nodes/text/number-format.d.ts +1 -1
  579. package/dist/nodes/text/number-format.js +1 -1
  580. package/dist/nodes/text/number-format.js.map +1 -1
  581. package/dist/nodes/text/number-node.js.map +1 -1
  582. package/dist/nodes/text/number-pattern.js.map +1 -1
  583. package/dist/nodes/text/richtext-node.d.ts +0 -5
  584. package/dist/nodes/text/richtext-node.d.ts.map +1 -1
  585. package/dist/nodes/text/richtext-node.js +6 -72
  586. package/dist/nodes/text/richtext-node.js.map +1 -1
  587. package/dist/nodes/text/text-base.d.ts +5 -22
  588. package/dist/nodes/text/text-base.d.ts.map +1 -1
  589. package/dist/nodes/text/text-base.js +13 -364
  590. package/dist/nodes/text/text-base.js.map +1 -1
  591. package/dist/nodes/text/text-layout.d.ts +87 -0
  592. package/dist/nodes/text/text-layout.d.ts.map +1 -0
  593. package/dist/nodes/text/text-layout.js +368 -0
  594. package/dist/nodes/text/text-layout.js.map +1 -0
  595. package/dist/nodes/text/text-node.js.map +1 -1
  596. package/dist/nodes/text/text-selection.js.map +1 -1
  597. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  598. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  599. package/dist/nodes/three/camera-nodes.js +42 -1
  600. package/dist/nodes/three/camera-nodes.js.map +1 -1
  601. package/dist/nodes/three/canvas3d-node.d.ts +32 -7
  602. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  603. package/dist/nodes/three/canvas3d-node.js +50 -2
  604. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  605. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  606. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  607. package/dist/nodes/three/drawable-nodes.js +43 -13
  608. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  609. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  610. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  611. package/dist/nodes/three/environment-nodes.js.map +1 -1
  612. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  613. package/dist/nodes/three/geometry-nodes.js +2 -2
  614. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  615. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  616. package/dist/nodes/three/group3d.js.map +1 -1
  617. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  618. package/dist/nodes/three/light-nodes.js +3 -3
  619. package/dist/nodes/three/light-nodes.js.map +1 -1
  620. package/dist/nodes/three/mesh3d.js.map +1 -1
  621. package/dist/nodes/three/node3d.d.ts +48 -0
  622. package/dist/nodes/three/node3d.d.ts.map +1 -1
  623. package/dist/nodes/three/node3d.js +53 -3
  624. package/dist/nodes/three/node3d.js.map +1 -1
  625. package/dist/platform/audio-sink.d.ts +2 -2
  626. package/dist/platform/audio-sink.d.ts.map +1 -1
  627. package/dist/platform/audio-sink.js.map +1 -1
  628. package/dist/platform/exporter.d.ts +13 -8
  629. package/dist/platform/exporter.d.ts.map +1 -1
  630. package/dist/platform/exporter.js.map +1 -1
  631. package/dist/platform/index.d.ts +1 -1
  632. package/dist/platform/index.d.ts.map +1 -1
  633. package/dist/platform/index.js.map +1 -1
  634. package/dist/platform/stepped-clock.js.map +1 -1
  635. package/dist/platform/storage-adapter.d.ts +12 -6
  636. package/dist/platform/storage-adapter.d.ts.map +1 -1
  637. package/dist/platform/storage-adapter.js +4 -0
  638. package/dist/platform/storage-adapter.js.map +1 -1
  639. package/dist/platform/ticker.d.ts +6 -0
  640. package/dist/platform/ticker.d.ts.map +1 -1
  641. package/dist/platform/ticker.js +6 -0
  642. package/dist/platform/ticker.js.map +1 -1
  643. package/dist/project/config.js.map +1 -1
  644. package/dist/project/index.js.map +1 -1
  645. package/dist/project/tree.d.ts +3 -3
  646. package/dist/project/tree.d.ts.map +1 -1
  647. package/dist/project/tree.js.map +1 -1
  648. package/dist/props/host.js.map +1 -1
  649. package/dist/props/index.js.map +1 -1
  650. package/dist/props/observer.js.map +1 -1
  651. package/dist/props/slot.js.map +1 -1
  652. package/dist/renamed-scene-names.d.ts +17 -0
  653. package/dist/renamed-scene-names.d.ts.map +1 -0
  654. package/dist/renamed-scene-names.js +9 -0
  655. package/dist/renamed-scene-names.js.map +1 -0
  656. package/dist/render/canvas-render-context2d.d.ts +2 -2
  657. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  658. package/dist/render/canvas-render-context2d.js.map +1 -1
  659. package/dist/render/clip-contains.js.map +1 -1
  660. package/dist/render/clip.js.map +1 -1
  661. package/dist/render/descriptors/ellipse.js.map +1 -1
  662. package/dist/render/descriptors/latex.js.map +1 -1
  663. package/dist/render/descriptors/line.js.map +1 -1
  664. package/dist/render/descriptors/path-builder.js.map +1 -1
  665. package/dist/render/descriptors/path.js.map +1 -1
  666. package/dist/render/descriptors/polygon.js.map +1 -1
  667. package/dist/render/descriptors/polygram.js.map +1 -1
  668. package/dist/render/descriptors/rect.js.map +1 -1
  669. package/dist/render/descriptors/richtext.js.map +1 -1
  670. package/dist/render/descriptors/shape.d.ts +12 -0
  671. package/dist/render/descriptors/shape.d.ts.map +1 -1
  672. package/dist/render/descriptors/shape.js.map +1 -1
  673. package/dist/render/descriptors/text.d.ts +2 -2
  674. package/dist/render/descriptors/text.js +2 -2
  675. package/dist/render/descriptors/text.js.map +1 -1
  676. package/dist/render/descriptors/transform.d.ts +2 -2
  677. package/dist/render/descriptors/transform.d.ts.map +1 -1
  678. package/dist/render/descriptors/transform.js.map +1 -1
  679. package/dist/render/graphics2d.d.ts +3 -3
  680. package/dist/render/graphics2d.d.ts.map +1 -1
  681. package/dist/render/graphics2d.js +1 -1
  682. package/dist/render/graphics2d.js.map +1 -1
  683. package/dist/render/index.js.map +1 -1
  684. package/dist/render/measure-context.js.map +1 -1
  685. package/dist/render/null-render-context.js.map +1 -1
  686. package/dist/render/render-context2d.d.ts +2 -2
  687. package/dist/render/render-context2d.d.ts.map +1 -1
  688. package/dist/render/render-context2d.js.map +1 -1
  689. package/dist/render/surface.js.map +1 -1
  690. package/dist/render/text-defaults.js.map +1 -1
  691. package/dist/render/text-layout.js.map +1 -1
  692. package/dist/render3d/bounds3d.d.ts.map +1 -1
  693. package/dist/render3d/bounds3d.js +4 -2
  694. package/dist/render3d/bounds3d.js.map +1 -1
  695. package/dist/render3d/builders.js.map +1 -1
  696. package/dist/render3d/camera.d.ts +6 -0
  697. package/dist/render3d/camera.d.ts.map +1 -1
  698. package/dist/render3d/camera.js +5 -3
  699. package/dist/render3d/camera.js.map +1 -1
  700. package/dist/render3d/fill3d.d.ts +2 -9
  701. package/dist/render3d/fill3d.d.ts.map +1 -1
  702. package/dist/render3d/fill3d.js +2 -13
  703. package/dist/render3d/fill3d.js.map +1 -1
  704. package/dist/render3d/geometry.d.ts +8 -1
  705. package/dist/render3d/geometry.d.ts.map +1 -1
  706. package/dist/render3d/geometry.js.map +1 -1
  707. package/dist/render3d/graphics3d.d.ts +8 -4
  708. package/dist/render3d/graphics3d.d.ts.map +1 -1
  709. package/dist/render3d/graphics3d.js +18 -10
  710. package/dist/render3d/graphics3d.js.map +1 -1
  711. package/dist/render3d/index.d.ts +1 -1
  712. package/dist/render3d/index.js +1 -1
  713. package/dist/render3d/index.js.map +1 -1
  714. package/dist/render3d/inert.d.ts +14 -0
  715. package/dist/render3d/inert.d.ts.map +1 -0
  716. package/dist/render3d/inert.js +62 -0
  717. package/dist/render3d/inert.js.map +1 -0
  718. package/dist/render3d/light.js.map +1 -1
  719. package/dist/render3d/material.d.ts +10 -5
  720. package/dist/render3d/material.d.ts.map +1 -1
  721. package/dist/render3d/material.js.map +1 -1
  722. package/dist/render3d/matrix4.js.map +1 -1
  723. package/dist/render3d/render-context3d.js.map +1 -1
  724. package/dist/render3d/resources.js.map +1 -1
  725. package/dist/render3d/rounded-box.js.map +1 -1
  726. package/dist/render3d/scene-settings.d.ts +23 -4
  727. package/dist/render3d/scene-settings.d.ts.map +1 -1
  728. package/dist/render3d/scene-settings.js.map +1 -1
  729. package/dist/render3d/scene3d.d.ts +11 -0
  730. package/dist/render3d/scene3d.d.ts.map +1 -1
  731. package/dist/render3d/scene3d.js +39 -6
  732. package/dist/render3d/scene3d.js.map +1 -1
  733. package/dist/render3d/segments.js.map +1 -1
  734. package/dist/render3d/texture.d.ts +9 -0
  735. package/dist/render3d/texture.d.ts.map +1 -1
  736. package/dist/render3d/texture.js +13 -0
  737. package/dist/render3d/texture.js.map +1 -1
  738. package/dist/render3d/tracking.js.map +1 -1
  739. package/dist/render3d/transform.d.ts +1 -1
  740. package/dist/render3d/transform.js.map +1 -1
  741. package/dist/render3d/vector3.d.ts +18 -1
  742. package/dist/render3d/vector3.d.ts.map +1 -1
  743. package/dist/render3d/vector3.js +27 -0
  744. package/dist/render3d/vector3.js.map +1 -1
  745. package/dist/render3d/walk.d.ts +1 -1
  746. package/dist/render3d/walk.d.ts.map +1 -1
  747. package/dist/render3d/walk.js +5 -1
  748. package/dist/render3d/walk.js.map +1 -1
  749. package/dist/runtime/asset-refine.js.map +1 -1
  750. package/dist/runtime/asset-timeline.js.map +1 -1
  751. package/dist/runtime/asset-update.js.map +1 -1
  752. package/dist/runtime/audio-index.js.map +1 -1
  753. package/dist/runtime/builtin-context.js.map +1 -1
  754. package/dist/runtime/clip-instance.d.ts +9 -4
  755. package/dist/runtime/clip-instance.d.ts.map +1 -1
  756. package/dist/runtime/clip-instance.js +27 -9
  757. package/dist/runtime/clip-instance.js.map +1 -1
  758. package/dist/runtime/clip-store.d.ts +18 -0
  759. package/dist/runtime/clip-store.d.ts.map +1 -1
  760. package/dist/runtime/clip-store.js +97 -0
  761. package/dist/runtime/clip-store.js.map +1 -1
  762. package/dist/runtime/engine.d.ts +5 -0
  763. package/dist/runtime/engine.d.ts.map +1 -1
  764. package/dist/runtime/engine.js +2 -0
  765. package/dist/runtime/engine.js.map +1 -1
  766. package/dist/runtime/frame-time.d.ts +31 -0
  767. package/dist/runtime/frame-time.d.ts.map +1 -0
  768. package/dist/runtime/frame-time.js +29 -0
  769. package/dist/runtime/frame-time.js.map +1 -0
  770. package/dist/runtime/index.d.ts +1 -0
  771. package/dist/runtime/index.d.ts.map +1 -1
  772. package/dist/runtime/index.js +1 -0
  773. package/dist/runtime/index.js.map +1 -1
  774. package/dist/runtime/node-picking.d.ts +44 -3
  775. package/dist/runtime/node-picking.d.ts.map +1 -1
  776. package/dist/runtime/node-picking.js +124 -10
  777. package/dist/runtime/node-picking.js.map +1 -1
  778. package/dist/runtime/node-picking3d.d.ts +13 -5
  779. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  780. package/dist/runtime/node-picking3d.js +10 -2
  781. package/dist/runtime/node-picking3d.js.map +1 -1
  782. package/dist/runtime/placement.d.ts.map +1 -1
  783. package/dist/runtime/placement.js +4 -5
  784. package/dist/runtime/placement.js.map +1 -1
  785. package/dist/runtime/playback-controller.d.ts +31 -2
  786. package/dist/runtime/playback-controller.d.ts.map +1 -1
  787. package/dist/runtime/playback-controller.js +63 -6
  788. package/dist/runtime/playback-controller.js.map +1 -1
  789. package/dist/runtime/playback.js.map +1 -1
  790. package/dist/runtime/precompisition.js.map +1 -1
  791. package/dist/runtime/project-assets.js.map +1 -1
  792. package/dist/runtime/session.d.ts +9 -7
  793. package/dist/runtime/session.d.ts.map +1 -1
  794. package/dist/runtime/session.js +12 -4
  795. package/dist/runtime/session.js.map +1 -1
  796. package/dist/runtime/settle.js.map +1 -1
  797. package/dist/runtime/state-evaluator.d.ts +1 -1
  798. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  799. package/dist/runtime/state-evaluator.js +4 -3
  800. package/dist/runtime/state-evaluator.js.map +1 -1
  801. package/dist/runtime/text-geometry.d.ts.map +1 -1
  802. package/dist/runtime/text-geometry.js +7 -3
  803. package/dist/runtime/text-geometry.js.map +1 -1
  804. package/dist/sdk/index.d.ts +50 -25
  805. package/dist/sdk/index.d.ts.map +1 -1
  806. package/dist/sdk/index.js +52 -42
  807. package/dist/sdk/index.js.map +1 -1
  808. package/dist/tween/command-decorator.d.ts +2 -0
  809. package/dist/tween/command-decorator.d.ts.map +1 -1
  810. package/dist/tween/command-decorator.js.map +1 -1
  811. package/dist/tween/command.d.ts +12 -0
  812. package/dist/tween/command.d.ts.map +1 -1
  813. package/dist/tween/command.js +14 -0
  814. package/dist/tween/command.js.map +1 -1
  815. package/dist/tween/ease/constants.d.ts.map +1 -1
  816. package/dist/tween/ease/constants.js +8 -5
  817. package/dist/tween/ease/constants.js.map +1 -1
  818. package/dist/tween/ease/curve.d.ts.map +1 -1
  819. package/dist/tween/ease/curve.js +4 -3
  820. package/dist/tween/ease/curve.js.map +1 -1
  821. package/dist/tween/ease/describe.d.ts +15 -0
  822. package/dist/tween/ease/describe.d.ts.map +1 -0
  823. package/dist/tween/ease/describe.js +37 -0
  824. package/dist/tween/ease/describe.js.map +1 -0
  825. package/dist/tween/ease/type.js.map +1 -1
  826. package/dist/tween/index.js.map +1 -1
  827. package/dist/tween/inert.js.map +1 -1
  828. package/dist/tween/lerp.js.map +1 -1
  829. package/dist/tween/loop.js.map +1 -1
  830. package/dist/tween/prepare.d.ts +3 -3
  831. package/dist/tween/prepare.js +3 -3
  832. package/dist/tween/prepare.js.map +1 -1
  833. package/dist/tween/seekable.d.ts +1 -1
  834. package/dist/tween/seekable.js.map +1 -1
  835. package/dist/tween/stepper.js.map +1 -1
  836. package/dist/tween/to-command.js.map +1 -1
  837. package/dist/util/clamp.js.map +1 -1
  838. package/dist/util/context.js.map +1 -1
  839. package/dist/util/csv.js.map +1 -1
  840. package/dist/util/generateList.js.map +1 -1
  841. package/dist/util/index.js.map +1 -1
  842. package/dist/util/metrics.d.ts +1 -1
  843. package/dist/util/metrics.js +1 -1
  844. package/dist/util/metrics.js.map +1 -1
  845. package/dist/util/random.js.map +1 -1
  846. package/dist/util/reference.js.map +1 -1
  847. package/dist/util/scheduler.js.map +1 -1
  848. package/package.json +7 -1
  849. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  850. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  851. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  852. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  853. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  854. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  855. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  856. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  857. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  858. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  859. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  860. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  861. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  862. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  863. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  864. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  865. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  866. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  867. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  868. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  869. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  870. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  871. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  872. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  873. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  874. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  875. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  876. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  877. package/dist/nodes/geometry/grid-lines.js +0 -128
  878. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  879. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  880. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  881. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  882. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  883. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  884. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  885. package/dist/nodes/geometry/line-grid-node.js +0 -127
  886. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  887. package/dist/nodes/geometry/line-node.d.ts +0 -58
  888. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  889. package/dist/nodes/geometry/line-node.js +0 -123
  890. package/dist/nodes/geometry/line-node.js.map +0 -1
  891. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  892. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  893. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  894. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  895. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  896. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  897. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  898. package/dist/nodes/scene/provider-node.js.map +0 -1
  899. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  900. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  901. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  902. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  903. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  904. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -8,8 +8,7 @@ import { textOps } from "../../attributes/text/ops.js";
8
8
  import { PaintNode } from "../../nodes/2d/paint-node.js";
9
9
  import { property } from "../../attributes/properties/decorator.js";
10
10
  import { Graphics2D } from "../../render/graphics2d.js";
11
- import { pathOps } from "../../attributes/shape/path/ops.js";
12
- import { AUTOFIT_PROBE_SIZE } from "./text-selection.js";
11
+ import { declareGlyphAssets, measureGlyphs, textSegments, textState } from "./text-layout.js";
13
12
  import { applyTextDefaults } from "./default-text-style-node.js";
14
13
  /**
15
14
  * **A node whose box is the box of some shaped glyphs.**
@@ -62,268 +61,25 @@ export class TextBase extends PaintNode {
62
61
  this.applyProp("width", props?.width ?? (autofit ? "fill" : "hug"));
63
62
  }
64
63
  measure(constraints, scope) {
65
- // Text-on-path: the visual extent is the path's bounding box, not a text
66
- // line box. Size the node to the path (node-local coords, like Path).
67
- const glyphPath = this.glyphPath;
68
- if (glyphPath != null) {
69
- const { width, height } = pathOps.size(glyphPath);
70
- const wm = this.width;
71
- const hm = this.height;
72
- return {
73
- width: typeof wm === "number" ? wm : wm === "hug" ? width : (constraints.maxWidth ?? width),
74
- height: typeof hm === "number" ? hm : hm === "hug" ? height : (constraints.maxHeight ?? height),
75
- };
76
- }
77
- const measureFontSize = this.fontSize === 'autofit' ? 16 : this.fontSize;
78
- const paragraphs = this._casedText().split("\n");
79
- // A styled run changes the box, which is why measuring cannot read the
80
- // node's five font fields and stop there: one word set two sizes up makes
81
- // the line taller and the block wider, and a node that hugs its glyphs
82
- // would hug a box measured for text nobody is looking at. So when
83
- // selections are live the intrinsic size is summed across the *pieces*,
84
- // each in its own style - see {@link measureStyledLines}.
85
- const styled = this.buildSegments();
86
- const lineStyles = styled === null
87
- ? null
88
- : measureStyledLines(styled, {
89
- fontFamily: this.fontFamily,
90
- fontSize: measureFontSize,
91
- fontStyle: this.fontStyle,
92
- fontWeight: this.fontWeight,
93
- letterSpacing: this.letterSpacing,
94
- });
95
- const lineH = measureFontSize * this.lineHeight;
96
- const intrinsicW = lineStyles
97
- ? Math.max(...lineStyles.map(line => line.runs.reduce((w, run) => w + scope.measureText(run.text, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width, 0)))
98
- : Math.max(...paragraphs.map(l => scope.measureText(l, measureFontSize, this.fontFamily, this.fontWeight, this.letterSpacing, this.fontStyle).width));
99
- const wm = this.width;
100
- const hm = this.height;
101
- const resolvedW = typeof wm === "number"
102
- ? wm
103
- : wm === "hug"
104
- ? intrinsicW
105
- : constraints.maxWidth ?? 0;
106
- // When wrap is on and the box has a finite width narrower than the text,
107
- // height needs to account for the extra lines produced by wrapping.
108
- const wraps = this.wrapsText && resolvedW > 0;
109
- // Each line is as tall as its tallest run, so raising one word's size
110
- // opens the leading around it rather than letting it overprint the line
111
- // above.
112
- const lineSizes = lineStyles === null
113
- ? null
114
- : wraps
115
- ? wrappedLineSizes(lineStyles, resolvedW, scope)
116
- : lineStyles.map(line => Math.max(...line.runs.map(run => run.fontSize)));
117
- const intrinsicH = lineSizes
118
- ? lineSizes.reduce((h, size) => h + size * this.lineHeight, 0)
119
- : (wraps
120
- ? paragraphs.reduce((n, p) => n + countWrappedLines(p, resolvedW, measureFontSize, this.fontFamily, this.fontWeight, scope, this.letterSpacing, this.fontStyle), 0)
121
- : paragraphs.length) * lineH;
122
- // "fill" still reports the intrinsic wrapped height when measuring —
123
- // it's layout (not measure) that stretches a fill child to its final
124
- // box. This lets a hug ancestor see the text's real content height
125
- // instead of an arbitrary borrowed constraint.
126
- const resolvedH = typeof hm === "number"
127
- ? hm
128
- : intrinsicH;
129
- return { width: resolvedW, height: resolvedH };
64
+ return measureGlyphs(this, this._source(), constraints, scope);
130
65
  }
131
- /**
132
- * Split the string into contiguous pieces at every style boundary, resolving
133
- * each piece's effective overrides per the overlap rule: later-created
134
- * selections win for transform/paint/font; opacity multiplies across all
135
- * selections covering the piece. Also folds in the Write On reveal window
136
- * (see below). Returns null when neither is active, so rendering keeps its
137
- * single-op path.
138
- *
139
- * Text-on-path has no pieces in v1 — the string is laid along the path as
140
- * one run — so a node with a path is answered `null` before anything else.
141
- */
66
+ /** The string cut at every style boundary — see {@link textSegments}. */
142
67
  buildSegments() {
143
- if (this.glyphPath != null)
144
- return null;
145
- const active = this.styledRuns().filter(s => s.ranges.length > 0 && !s.isIdentity);
146
- const runs = this.styleRuns().filter(r => r.end > r.start);
147
- const text = this._casedText();
148
- if (text.length === 0)
149
- return null;
150
- // Write On: `start`/`end` are PaintNode's outline-trim fractions
151
- // everywhere else, but a glyph has no path to trim geometrically — this
152
- // CanvasKit build can't get glyph outlines at all (see
153
- // drawTextUnionStroke in the skia-render stroke handler). Glyph nodes
154
- // reinterpret the same pair as a character-reveal window instead:
155
- // opacity over a character range rather than a geometric trim.
156
- const hasReveal = this.start > 0 || this.end < 1;
157
- // The fast path survives both: a node with no live selection and no
158
- // reveal window renders as one string, exactly as it did before either
159
- // existed.
160
- if (active.length === 0 && runs.length === 0 && !hasReveal)
161
- return null;
162
- // Rounded to the nearest whole character — a hard cut, not a fade. Write
163
- // On reveals one character at a time, the way DaVinci's does; a fractional
164
- // in-between character read as an opinionated flourish nobody asked for.
165
- const revealStart = Math.round(this.start * text.length);
166
- const revealEnd = Math.round(this.end * text.length);
167
- // The size every piece starts from. `'autofit'` settles on a size the
168
- // *block* is measured into, which no single piece can be asked for, so
169
- // the segmented path shapes at the same probe size a selection's
170
- // `fontSize` override starts from - one number, stated in one place.
171
- const nodeFontSize = typeof this.fontSize === "number"
172
- ? this.fontSize
173
- : AUTOFIT_PROBE_SIZE;
174
- // Boundaries at every range edge so each piece is covered uniformly.
175
- const cuts = new Set([0, text.length]);
176
- for (const run of runs) {
177
- cuts.add(run.start);
178
- cuts.add(run.end);
179
- }
180
- for (const sel of active) {
181
- for (const r of sel.ranges) {
182
- cuts.add(r.start);
183
- cuts.add(r.end);
184
- }
185
- }
186
- if (hasReveal) {
187
- cuts.add(revealStart);
188
- cuts.add(revealEnd);
189
- }
190
- const points = [...cuts].filter(c => c >= 0 && c <= text.length).sort((a, b) => a - b);
191
- const segments = [];
192
- for (let i = 0; i < points.length - 1; i++) {
193
- const start = points[i];
194
- const end = points[i + 1];
195
- if (end <= start)
196
- continue;
197
- const seg = {
198
- text: text.slice(start, end),
199
- // Every shaping field is stated, not left for the renderer to
200
- // fill in: a piece whose family or size differs from the node's
201
- // is the point of the model, and a segment that says nothing
202
- // about one of them would be a piece the paragraph builder
203
- // styles from the node while the caret measures from the
204
- // segment. See {@link TextSegment}.
205
- fontFamily: this.fontFamily,
206
- fontSize: nodeFontSize,
207
- fontStyle: this.fontStyle,
208
- fontWeight: this.fontWeight,
209
- letterSpacing: this.letterSpacing,
210
- textDecoration: this.textDecoration,
211
- opacity: 1,
212
- x: 0,
213
- y: 0,
214
- scale: 1,
215
- rotation: 0,
216
- // Default to the node's paint; selections override below. Each
217
- // segment is self-contained so the renderer draws runs eagerly.
218
- fill: this.fill,
219
- stroke: this.stroke,
220
- };
221
- // The document's styling first, so a selection animates *from* it.
222
- for (const run of runs) {
223
- if (start < run.start || end > run.end)
224
- continue;
225
- if (run.fontFamily !== undefined)
226
- seg.fontFamily = run.fontFamily;
227
- if (run.fontSize !== undefined)
228
- seg.fontSize = run.fontSize;
229
- if (run.fontStyle !== undefined)
230
- seg.fontStyle = run.fontStyle;
231
- if (run.fontWeight !== undefined)
232
- seg.fontWeight = run.fontWeight;
233
- if (run.letterSpacing !== undefined)
234
- seg.letterSpacing = run.letterSpacing;
235
- if (run.textDecoration !== undefined)
236
- seg.textDecoration = run.textDecoration;
237
- if (run.fill !== undefined)
238
- seg.fill = run.fill;
239
- if (run.stroke !== undefined)
240
- seg.stroke = run.stroke;
241
- }
242
- // Apply in creation order: opacity multiplies, others last-wins. A
243
- // shaping field a selection still holds at the node's own value is
244
- // one it never touched, and must not undo a run's.
245
- for (const sel of active) {
246
- if (!sel.ranges.some(r => start >= r.start && end <= r.end))
247
- continue;
248
- const o = sel.overrides;
249
- seg.opacity *= o.opacity;
250
- seg.x = o.x;
251
- seg.y = o.y;
252
- seg.scale = o.scale;
253
- seg.rotation = o.rotation;
254
- if (o.fontFamily !== this.fontFamily)
255
- seg.fontFamily = o.fontFamily;
256
- if (o.fontSize !== nodeFontSize)
257
- seg.fontSize = o.fontSize;
258
- if (o.fontStyle !== this.fontStyle)
259
- seg.fontStyle = o.fontStyle;
260
- if (o.fontWeight !== this.fontWeight)
261
- seg.fontWeight = o.fontWeight;
262
- if (o.letterSpacing !== this.letterSpacing)
263
- seg.letterSpacing = o.letterSpacing;
264
- if (o.fill !== null)
265
- seg.fill = o.fill;
266
- if (o.stroke !== null)
267
- seg.stroke = o.stroke;
268
- }
269
- if (hasReveal && !(start >= revealStart && end <= revealEnd)) {
270
- seg.opacity = 0;
271
- }
272
- segments.push(seg);
273
- }
274
- return segments;
68
+ return textSegments(this, this._source());
275
69
  }
276
- /**
277
- * The node's own face and paint, plus whatever a selection puts on part of the
278
- * string. Naming a family here is what lets it load *before* layout, rather
279
- * than being discovered by measuring text against the fallback face.
280
- */
281
70
  declareAssets(assets) {
282
71
  super.declareAssets(assets);
283
- // Nothing may name a family at all, and the renderer then shapes with
284
- // whatever is registered; an `undefined` key is not a font to load.
285
- if (this.fontFamily)
286
- assets.font(this.fontFamily, this.fontWeight);
287
- for (const segment of this.buildSegments() ?? []) {
288
- const family = segment.fontFamily ?? this.fontFamily;
289
- if (family)
290
- assets.font(family, segment.fontWeight);
291
- assets.fill(segment.fill ?? []);
292
- for (const stroke of segment.stroke ?? [])
293
- assets.fill(stroke.fill);
294
- }
72
+ declareGlyphAssets(this, this._source(), assets);
295
73
  }
296
74
  /**
297
75
  * The descriptor this node draws itself as, at the current frame.
298
76
  *
299
- * `@internal` — split out of {@link textOpGraphics} so `node-picking`'s
300
- * caret geometry can be measured from *the same* state that gets painted.
301
- * Deriving the two separately is how a caret ends up half a pixel — or, once
302
- * `'autofit'` or wrapping is in play, half a line — away from its glyph.
77
+ * `@internal` — split out so `node-picking`'s caret geometry is measured
78
+ * from the same state that gets painted.
303
79
  */
304
80
  /** @internal */
305
81
  _textState() {
306
- return {
307
- text: this._casedText(),
308
- fontSize: this.fontSize,
309
- fontFamily: this.fontFamily,
310
- fontWeight: this.fontWeight,
311
- fontStyle: this.fontStyle,
312
- letterSpacing: this.letterSpacing,
313
- lineHeight: this.lineHeight,
314
- textAlign: this.textAlign,
315
- verticalAlign: this.verticalAlign,
316
- textDecoration: this.textDecoration,
317
- wrap: this.wrapsText,
318
- minFontSize: this.minFontSize,
319
- width: this.layoutBounds?.width ?? 0,
320
- height: this.layoutBounds?.height ?? 0,
321
- // Text-on-path and selection segments are mutually exclusive in v1:
322
- // `buildSegments` answers null while a path is set, and the single
323
- // string is laid out along it instead.
324
- segments: this.buildSegments() ?? undefined,
325
- path: this.glyphPath,
326
- };
82
+ return textState(this, this._source(), this.layoutBounds);
327
83
  }
328
84
  // The bare text op as a Graphics2D (no paint), plus whether selection segments
329
85
  // are active. Glyphs have no single fillable silhouette path, so the generic
@@ -336,11 +92,8 @@ export class TextBase extends PaintNode {
336
92
  renderSelf(ctx) {
337
93
  const { g, segments } = this.textOpGraphics();
338
94
  g.shadow(this.shadow);
339
- // With segments the renderer paints each run eagerly with the segment's
340
- // own fill/stroke (so per-selection overrides apply), so the node-level
341
- // fill/stroke ops are omitted to avoid double-painting. Text-on-path uses
342
- // the normal deferred path, so its node-level fill applies here; its stroke
343
- // is deferred to renderStroke.
95
+ // With segments the renderer paints each run with its own fill/stroke, so
96
+ // the node-level paint is omitted to avoid double-painting.
344
97
  if (!segments) {
345
98
  g.fill(this.fill);
346
99
  }
@@ -357,15 +110,15 @@ export class TextBase extends PaintNode {
357
110
  return;
358
111
  ctx.draw(g.stroke(stroke));
359
112
  }
360
- _casedText() {
361
- return textOps.applyCase(this.displayText(), this.textCase);
113
+ _source() {
114
+ return { text: this.displayText(), wraps: this.wrapsText, glyphPath: this.glyphPath, selections: this.styledRuns(), runs: this.styleRuns() };
362
115
  }
363
116
  }
364
117
  __decorate([
365
118
  property()
366
119
  ], TextBase.prototype, "fontFamily", void 0);
367
120
  __decorate([
368
- property({ default: 48 })
121
+ property({ default: 48, tween: textOps.lerpFontSize })
369
122
  ], TextBase.prototype, "fontSize", void 0);
370
123
  __decorate([
371
124
  property({ default: 400 })
@@ -397,108 +150,4 @@ __decorate([
397
150
  __decorate([
398
151
  property({ default: undefined })
399
152
  ], TextBase.prototype, "variant", void 0);
400
- /**
401
- * Split `segments` into lines at every `\n`, resolving each piece against
402
- * `fallback` for the fields it leaves unstated.
403
- *
404
- * A segment can span a line break - the cuts are made at *selection* edges, and
405
- * a selection over two lines is one range - so the break has to be found inside
406
- * the piece rather than between pieces. The newline itself joins neither line,
407
- * which is what makes an empty line come back as a run of `""` (in the node's
408
- * own style) rather than disappearing from the count.
409
- */
410
- function measureStyledLines(segments, fallback) {
411
- const lines = [{ runs: [] }];
412
- for (const segment of segments) {
413
- const style = {
414
- fontFamily: segment.fontFamily ?? fallback.fontFamily,
415
- fontSize: segment.fontSize ?? fallback.fontSize,
416
- fontStyle: segment.fontStyle ?? fallback.fontStyle,
417
- fontWeight: segment.fontWeight,
418
- letterSpacing: segment.letterSpacing,
419
- };
420
- const parts = segment.text.split("\n");
421
- for (let i = 0; i < parts.length; i++) {
422
- if (i > 0)
423
- lines.push({ runs: [] });
424
- lines[lines.length - 1].runs.push({ text: parts[i], ...style });
425
- }
426
- }
427
- // A line the loop above never wrote a run onto still has to be measured
428
- // against something, and the node's own style is the only honest answer.
429
- for (const line of lines) {
430
- if (line.runs.length === 0)
431
- line.runs.push({ ...fallback, text: "" });
432
- }
433
- return lines;
434
- }
435
- /**
436
- * The size each line of `lines` is set at once wrapped to `maxWidth`: the
437
- * greedy whitespace break {@link countWrappedLines} makes, but with every piece
438
- * measured in its own style. A word split across two styles is still one word.
439
- */
440
- function wrappedLineSizes(lines, maxWidth, scope) {
441
- const sizes = [];
442
- for (const line of lines) {
443
- const tokens = [];
444
- for (const run of line.runs) {
445
- for (const part of run.text.split(/(\s+)/)) {
446
- if (part.length === 0)
447
- continue;
448
- const space = /^\s+$/.test(part);
449
- const width = scope.measureText(part, run.fontSize, run.fontFamily, run.fontWeight, run.letterSpacing, run.fontStyle).width;
450
- const last = tokens[tokens.length - 1];
451
- if (last && !last.space && !space) {
452
- last.width += width;
453
- last.size = Math.max(last.size, run.fontSize);
454
- }
455
- else {
456
- tokens.push({ width, size: run.fontSize, space });
457
- }
458
- }
459
- }
460
- if (tokens.length === 0) {
461
- sizes.push(Math.max(...line.runs.map(run => run.fontSize)));
462
- continue;
463
- }
464
- let lineW = tokens[0].width;
465
- let size = tokens[0].size;
466
- for (const token of tokens.slice(1)) {
467
- if (lineW + token.width <= maxWidth) {
468
- lineW += token.width;
469
- size = Math.max(size, token.size);
470
- }
471
- else {
472
- sizes.push(size);
473
- lineW = token.space ? 0 : token.width;
474
- size = token.space ? 0 : token.size;
475
- }
476
- }
477
- sizes.push(size > 0 ? size : Math.max(...line.runs.map(run => run.fontSize)));
478
- }
479
- return sizes;
480
- }
481
- function countWrappedLines(paragraph, maxWidth, fontSize, fontFamily, fontWeight, scope, letterSpacing = 0, fontStyle = 'normal') {
482
- if (paragraph.length === 0)
483
- return 1;
484
- if (scope.measureText(paragraph, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width <= maxWidth)
485
- return 1;
486
- const words = paragraph.split(/(\s+)/).filter(s => s.length > 0);
487
- let lines = 1;
488
- let lineW = 0;
489
- for (const word of words) {
490
- const w = scope.measureText(word, fontSize, fontFamily, fontWeight, letterSpacing, fontStyle).width;
491
- if (lineW === 0) {
492
- lineW = w;
493
- }
494
- else if (lineW + w <= maxWidth) {
495
- lineW += w;
496
- }
497
- else {
498
- lines++;
499
- lineW = /^\s+$/.test(word) ? 0 : w;
500
- }
501
- }
502
- return lines;
503
- }
504
153
  //# sourceMappingURL=text-base.js.map
@@ -1 +1 @@
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;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C,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,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,eAAe,CAAC;AAC5G,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,EAAE,CAAC,CAAC,CAAC;IAE/D,+EAA+E;IACrE,SAAS,KAAiC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEhE,2EAA2E;IAC3E,8EAA8E;IAC9E,wEAAwE;IACxE,0EAA0E;IAC1E,0EAA0E;IAC1E,kBAAkB;IACC,cAAc,CAAC,GAAe;QAC7C,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,MAA6C,CAAC,CAAC;IAChF,CAAC;IAED,4EAA4E;IAC5E,yEAAyE;IACzE,kEAAkE;IAC/C,gBAAgB,CAAC,KAA0B;QAC1D,MAAM,OAAO,GAAG,KAAK,EAAE,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C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;+CAAwC;AACpB;IAA5C,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;4CAAqC;AACd;IAAjD,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;2CAAuC;AAEtD;IADhB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAA2B,EAAE,CAAC;+CAChE;AAE7B;IADhB,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAA4B,EAAE,CAAC;gDACvE;AAE/B;IADhB,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAsB,EAAE,CAAC;0CAC3E;AACQ;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;6CAAsC;AACb;IAAlD,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;yCAAmC","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 type { AssetScope } from \"@/assets/scope\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"@/render/descriptors/path\";\r\nimport type { TextSelection } from \"./text-selection\";\r\nimport { declareGlyphAssets, measureGlyphs, textSegments, textState, type TextSource } from \"./text-layout\";\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 return measureGlyphs(this, this._source(), constraints, scope);\r\n }\r\n\r\n /** The string cut at every style boundary — see {@link textSegments}. */\r\n protected buildSegments(): TextSegment[] | null {\r\n return textSegments(this, this._source());\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n declareGlyphAssets(this, this._source(), assets);\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 so `node-picking`'s caret geometry is measured\r\n * from the same state that gets painted.\r\n */\r\n /** @internal */\r\n _textState(): Partial<TextState> {\r\n return textState(this, this._source(), this.layoutBounds);\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 with its own fill/stroke, so\r\n // the node-level paint is omitted to avoid double-painting.\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 _source(): TextSource {\r\n return { text: this.displayText(), wraps: this.wrapsText, glyphPath: this.glyphPath, selections: this.styledRuns(), runs: this.styleRuns() };\r\n }\r\n}\r\n"]}
@@ -0,0 +1,87 @@
1
+ import type { AssetScope } from "../../assets/scope.js";
2
+ import type { Size2D, SizeInput } from "../../attributes/layout/size.js";
3
+ import type { FontStyle, ResolvedTextRun, ResolvedTextSpan, TextAlign, TextCase, TextDecoration, TextSpan, VerticalAlign } from "../../attributes/text/types.js";
4
+ import type { RichTextState } from "../../render/descriptors/richtext.js";
5
+ import type { SizeConstraints } from "../../layout/constraints.js";
6
+ import type { PathData } from "../../render/descriptors/path.js";
7
+ import type { TextSegment, TextState } from "../../render/descriptors/text.js";
8
+ import type { MeasureContext2D } from "../../render/measure-context.js";
9
+ import { type TextSelection } from "./text-selection.js";
10
+ /**
11
+ * Setting a string in a face: measuring the block, cutting it into styled
12
+ * pieces, and the descriptor it draws as. Plain functions over resolved values,
13
+ * shared by `TextBase` and the components' `TextLayout` module, so a glyph node
14
+ * shapes one way whichever it is.
15
+ */
16
+ /** The shaping fields a glyph node reads, resolved. */
17
+ export interface TextValues {
18
+ readonly fontFamily: string;
19
+ readonly fontSize: number | "autofit";
20
+ readonly fontWeight: number;
21
+ readonly fontStyle: FontStyle;
22
+ readonly letterSpacing: number;
23
+ readonly lineHeight: number;
24
+ readonly textAlign: TextAlign;
25
+ readonly verticalAlign: VerticalAlign;
26
+ readonly textDecoration: TextDecoration;
27
+ readonly textCase: TextCase;
28
+ readonly minFontSize: number;
29
+ readonly fill: unknown;
30
+ readonly stroke: unknown;
31
+ readonly start: number;
32
+ readonly end: number;
33
+ readonly width: SizeInput;
34
+ readonly height: SizeInput;
35
+ }
36
+ /** Where the string comes from, and what styles parts of it. */
37
+ export interface TextSource {
38
+ readonly text: string;
39
+ readonly wraps: boolean;
40
+ /** The path the glyphs ride, for text-on-path. */
41
+ readonly glyphPath: PathData | null;
42
+ /** Live per-range overrides: `Text`'s selections. */
43
+ readonly selections: readonly TextSelection[];
44
+ /** Stretches a document styles apart from the node: `Text`'s `runs`. */
45
+ readonly runs: readonly ResolvedTextRun[];
46
+ }
47
+ export declare function casedText(s: TextValues, src: TextSource): string;
48
+ /** The block's size: hugged to its glyphs, filled across, and its own height even when it fills, so a hugging ancestor sees its content. */
49
+ export declare function measureGlyphs(s: TextValues, src: TextSource, constraints: SizeConstraints, scope: MeasureContext2D): Size2D;
50
+ /**
51
+ * The string cut at every style boundary, each piece's overrides resolved by the
52
+ * overlap rule: later selections win for transform, paint and font; opacity
53
+ * multiplies. Also folds in the Write On reveal window. `null` when neither is
54
+ * active, so rendering keeps its single-op path; and always `null` on a path,
55
+ * where the string is laid along it as one run.
56
+ */
57
+ export declare function textSegments(s: TextValues, src: TextSource): TextSegment[] | null;
58
+ /** The descriptor the block draws as, in a box of `size`. Picking's caret geometry reads the same one. */
59
+ export declare function textState(s: TextValues, src: TextSource, size: Size2D | undefined): Partial<TextState>;
60
+ /**
61
+ * The node's own face, plus whatever a piece sets in another, and the pieces'
62
+ * paints. Naming a family here is what lets it load before layout, rather than
63
+ * being discovered by measuring against the fallback face.
64
+ */
65
+ export declare function declareGlyphAssets(s: TextValues, src: TextSource, assets: Pick<AssetScope, "font" | "fill">): void;
66
+ /** What a rich-text node reads: spans, and the face they inherit from. */
67
+ export interface RichValues {
68
+ readonly spans: readonly TextSpan[];
69
+ readonly fontFamily: string;
70
+ readonly fontSize: number;
71
+ readonly fontWeight: number;
72
+ readonly fontStyle: FontStyle;
73
+ readonly letterSpacing: number;
74
+ readonly lineHeight: number;
75
+ readonly textAlign: TextAlign;
76
+ readonly fill: unknown;
77
+ readonly stroke: unknown;
78
+ readonly width: SizeInput;
79
+ readonly height: SizeInput;
80
+ }
81
+ /** Every span flattened to a run, each field it leaves unset taken from the node. */
82
+ export declare function richRuns(s: RichValues): ResolvedTextSpan[];
83
+ /** Lines broken only at `\n`, each as tall as its tallest run; an empty node keeps one line of its own size. */
84
+ export declare function measureRich(s: RichValues, constraints: SizeConstraints, scope: MeasureContext2D): Size2D;
85
+ export declare function richState(s: RichValues, size: Size2D | undefined): Partial<RichTextState>;
86
+ export declare function declareRichAssets(s: RichValues, assets: Pick<AssetScope, "font" | "fill">): void;
87
+ //# sourceMappingURL=text-layout.d.ts.map