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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (791) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -49
  4. package/README.md +91 -91
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.js.map +1 -1
  7. package/dist/assets/errors.js.map +1 -1
  8. package/dist/assets/index.js.map +1 -1
  9. package/dist/assets/manager.js.map +1 -1
  10. package/dist/assets/manifest.js.map +1 -1
  11. package/dist/assets/record.js.map +1 -1
  12. package/dist/assets/scope.js.map +1 -1
  13. package/dist/attributes/audio/effects/chain.js.map +1 -1
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
  15. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
  16. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
  17. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
  18. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
  19. package/dist/attributes/audio/effects/index.js.map +1 -1
  20. package/dist/attributes/audio/effects/registry.js.map +1 -1
  21. package/dist/attributes/audio/effects/union.js.map +1 -1
  22. package/dist/attributes/audio/ramp.js.map +1 -1
  23. package/dist/attributes/audio/request.js.map +1 -1
  24. package/dist/attributes/audio/schedule.js.map +1 -1
  25. package/dist/attributes/audio/sound.js.map +1 -1
  26. package/dist/attributes/audio/transition.js.map +1 -1
  27. package/dist/attributes/index.js.map +1 -1
  28. package/dist/attributes/layout/alignment.js.map +1 -1
  29. package/dist/attributes/layout/index.js.map +1 -1
  30. package/dist/attributes/layout/insets.js.map +1 -1
  31. package/dist/attributes/layout/matrix2d.js.map +1 -1
  32. package/dist/attributes/layout/size.js.map +1 -1
  33. package/dist/attributes/layout/space3d.js.map +1 -1
  34. package/dist/attributes/layout/transform3d.js.map +1 -1
  35. package/dist/attributes/layout/vector2.js.map +1 -1
  36. package/dist/attributes/layout/world-transform.js.map +1 -1
  37. package/dist/attributes/mask/boolean.js.map +1 -1
  38. package/dist/attributes/mask/mask.js.map +1 -1
  39. package/dist/attributes/properties/decorator.js.map +1 -1
  40. package/dist/attributes/properties/inputs.js.map +1 -1
  41. package/dist/attributes/properties/typed.js.map +1 -1
  42. package/dist/attributes/render3d/orbit.js.map +1 -1
  43. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  44. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  45. package/dist/attributes/shape/corners/corners.js.map +1 -1
  46. package/dist/attributes/shape/corners/index.js.map +1 -1
  47. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  48. package/dist/attributes/shape/effects/chain.js.map +1 -1
  49. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  50. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  51. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  52. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  53. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  54. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  55. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  56. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  57. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  58. package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
  59. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  60. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  61. package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
  62. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  63. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  64. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  65. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  66. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  67. package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
  68. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  69. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  70. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  71. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  72. package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
  73. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  74. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  75. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  76. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  77. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  78. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  79. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  80. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  81. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  82. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  83. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  84. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  86. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
  88. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  96. package/dist/attributes/shape/effects/index.js.map +1 -1
  97. package/dist/attributes/shape/effects/registry.js.map +1 -1
  98. package/dist/attributes/shape/effects/spec.js.map +1 -1
  99. package/dist/attributes/shape/effects/union.js.map +1 -1
  100. package/dist/attributes/shape/fill/blend.js.map +1 -1
  101. package/dist/attributes/shape/fill/chain.js.map +1 -1
  102. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  103. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  104. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  105. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
  106. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  107. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  108. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  109. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  110. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  111. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  112. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  113. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  114. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  115. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  116. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  117. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  118. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  119. package/dist/attributes/shape/fill/index.js.map +1 -1
  120. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  121. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  122. package/dist/attributes/shape/fill/registry.js.map +1 -1
  123. package/dist/attributes/shape/fill/union.js.map +1 -1
  124. package/dist/attributes/shape/filters/chain.js.map +1 -1
  125. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  126. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  127. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  128. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  129. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  130. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  131. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  132. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  133. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  134. package/dist/attributes/shape/filters/index.js.map +1 -1
  135. package/dist/attributes/shape/filters/registry.js.map +1 -1
  136. package/dist/attributes/shape/filters/union.js.map +1 -1
  137. package/dist/attributes/shape/path/anchors.js.map +1 -1
  138. package/dist/attributes/shape/path/bezier.js.map +1 -1
  139. package/dist/attributes/shape/path/index.js.map +1 -1
  140. package/dist/attributes/shape/path/measure.js.map +1 -1
  141. package/dist/attributes/shape/path/morph.js.map +1 -1
  142. package/dist/attributes/shape/path/ops.js.map +1 -1
  143. package/dist/attributes/shape/path/types.js.map +1 -1
  144. package/dist/attributes/shape/path/walk.js.map +1 -1
  145. package/dist/attributes/shape/shaders/index.js.map +1 -1
  146. package/dist/attributes/shape/shaders/language.js.map +1 -1
  147. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  148. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  149. package/dist/attributes/shape/shadow/index.js.map +1 -1
  150. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  151. package/dist/attributes/shape/stroke/index.js.map +1 -1
  152. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  153. package/dist/attributes/shared/operators.js.map +1 -1
  154. package/dist/attributes/text/index.js.map +1 -1
  155. package/dist/attributes/text/ops.js.map +1 -1
  156. package/dist/attributes/text/types.js.map +1 -1
  157. package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
  158. package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
  159. package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
  160. package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
  161. package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
  162. package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
  163. package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
  164. package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
  165. package/dist/browser/component.js +1 -1
  166. package/dist/browser/experimental.js +1 -1
  167. package/dist/browser/experimental.js.map +1 -1
  168. package/dist/browser/index.js +1 -1
  169. package/dist/browser/index.js.map +1 -1
  170. package/dist/browser/sdk.js +1 -1
  171. package/dist/component.js.map +1 -1
  172. package/dist/components/builtins/audio/audio.js.map +1 -1
  173. package/dist/components/builtins/geometry/composite.js.map +1 -1
  174. package/dist/components/builtins/geometry/geometry.js.map +1 -1
  175. package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
  176. package/dist/components/builtins/layout/layout.js.map +1 -1
  177. package/dist/components/builtins/media/media.js.map +1 -1
  178. package/dist/components/builtins/providers/providers.js.map +1 -1
  179. package/dist/components/builtins/text/number-format.js.map +1 -1
  180. package/dist/components/builtins/text/number-pattern.js.map +1 -1
  181. package/dist/components/builtins/text/text-defaults.js.map +1 -1
  182. package/dist/components/builtins/text/text-layout.js.map +1 -1
  183. package/dist/components/builtins/text/text.d.ts +9 -9
  184. package/dist/components/builtins/text/text.js.map +1 -1
  185. package/dist/components/builtins/three/canvas3d.js.map +1 -1
  186. package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
  187. package/dist/components/builtins/three/three.js.map +1 -1
  188. package/dist/components/factory/api.js.map +1 -1
  189. package/dist/components/factory/clip-of.js.map +1 -1
  190. package/dist/components/factory/commands-for.js.map +1 -1
  191. package/dist/components/factory/component-audio.js.map +1 -1
  192. package/dist/components/factory/component2d.js.map +1 -1
  193. package/dist/components/factory/component3d.js.map +1 -1
  194. package/dist/components/factory/factory.js.map +1 -1
  195. package/dist/components/factory/timeline.js.map +1 -1
  196. package/dist/components/factory/type-def.js.map +1 -1
  197. package/dist/components/factory/types.js.map +1 -1
  198. package/dist/components/factory/views.js.map +1 -1
  199. package/dist/components/modules/aim.js.map +1 -1
  200. package/dist/components/modules/corners.js.map +1 -1
  201. package/dist/components/modules/flow.js.map +1 -1
  202. package/dist/components/modules/material.js.map +1 -1
  203. package/dist/components/modules/paint.js.map +1 -1
  204. package/dist/components/modules/shapes.js.map +1 -1
  205. package/dist/components/modules/text-layout.js.map +1 -1
  206. package/dist/components/modules/text-style.d.ts +1 -1
  207. package/dist/components/modules/text-style.js.map +1 -1
  208. package/dist/components/modules/three-entries.js.map +1 -1
  209. package/dist/components/modules/view3d.js.map +1 -1
  210. package/dist/components/trees/2d/group-bounds.js.map +1 -1
  211. package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
  212. package/dist/components/trees/2d/node-motion.js.map +1 -1
  213. package/dist/components/trees/2d/node-render.js.map +1 -1
  214. package/dist/components/trees/2d/node-space.js.map +1 -1
  215. package/dist/components/trees/2d/node-transform.js.map +1 -1
  216. package/dist/components/trees/2d/node2d.js.map +1 -1
  217. package/dist/components/trees/audio/index.js.map +1 -1
  218. package/dist/components/trees/audio/node-audio.js.map +1 -1
  219. package/dist/components/trees/index.js.map +1 -1
  220. package/dist/components/trees/node/node-editor-state.js.map +1 -1
  221. package/dist/components/trees/node/node-reactive.js.map +1 -1
  222. package/dist/components/trees/node/node-time.js.map +1 -1
  223. package/dist/components/trees/node/node-walk.js.map +1 -1
  224. package/dist/components/trees/node/node.js.map +1 -1
  225. package/dist/components/trees/root/canvas2d-node.js.map +1 -1
  226. package/dist/components/trees/three/node3d.js.map +1 -1
  227. package/dist/document/audio.js.map +1 -1
  228. package/dist/document/builtins.js.map +1 -1
  229. package/dist/document/command-traits.js.map +1 -1
  230. package/dist/document/deny-globals.js.map +1 -1
  231. package/dist/document/diff.js.map +1 -1
  232. package/dist/document/doc-index.js.map +1 -1
  233. package/dist/document/expression/compile.js.map +1 -1
  234. package/dist/document/expression/index.js.map +1 -1
  235. package/dist/document/expression/ops.js.map +1 -1
  236. package/dist/document/expression/parse.js.map +1 -1
  237. package/dist/document/expression/refs.js.map +1 -1
  238. package/dist/document/expression/types.js.map +1 -1
  239. package/dist/document/expression/walk.js.map +1 -1
  240. package/dist/document/index.js.map +1 -1
  241. package/dist/document/migrate.js.map +1 -1
  242. package/dist/document/missing-node.js.map +1 -1
  243. package/dist/document/node-decorator.js.map +1 -1
  244. package/dist/document/node-descriptor.js.map +1 -1
  245. package/dist/document/placement.js.map +1 -1
  246. package/dist/document/project.js.map +1 -1
  247. package/dist/document/prop-evolution.js.map +1 -1
  248. package/dist/document/registry.js.map +1 -1
  249. package/dist/document/settled-index.js.map +1 -1
  250. package/dist/document/timeline-patch.js.map +1 -1
  251. package/dist/document/timeline.js.map +1 -1
  252. package/dist/document/types.js.map +1 -1
  253. package/dist/document/validate.js.map +1 -1
  254. package/dist/document/vocabulary.js.map +1 -1
  255. package/dist/experimental.d.ts.map +1 -1
  256. package/dist/experimental.js.map +1 -1
  257. package/dist/index.js.map +1 -1
  258. package/dist/layout/bounds.js.map +1 -1
  259. package/dist/layout/constraints.js.map +1 -1
  260. package/dist/layout/flex.js.map +1 -1
  261. package/dist/layout/freeform.js.map +1 -1
  262. package/dist/layout/grid.js.map +1 -1
  263. package/dist/layout/index.js.map +1 -1
  264. package/dist/layout/item.js.map +1 -1
  265. package/dist/layout/ops.js.map +1 -1
  266. package/dist/layout/types.js.map +1 -1
  267. package/dist/platform/audio-sink.js.map +1 -1
  268. package/dist/platform/exporter.js.map +1 -1
  269. package/dist/platform/index.js.map +1 -1
  270. package/dist/platform/stepped-clock.js.map +1 -1
  271. package/dist/platform/storage-adapter.js.map +1 -1
  272. package/dist/platform/ticker.js.map +1 -1
  273. package/dist/project/config.js.map +1 -1
  274. package/dist/project/index.js.map +1 -1
  275. package/dist/project/tree.js.map +1 -1
  276. package/dist/props/host.js.map +1 -1
  277. package/dist/props/index.js.map +1 -1
  278. package/dist/props/observer.js.map +1 -1
  279. package/dist/props/slot.js.map +1 -1
  280. package/dist/renamed-scene-names.js.map +1 -1
  281. package/dist/render/canvas-render-context2d.js.map +1 -1
  282. package/dist/render/clip-contains.js.map +1 -1
  283. package/dist/render/clip.js.map +1 -1
  284. package/dist/render/descriptors/ellipse.js.map +1 -1
  285. package/dist/render/descriptors/line.js.map +1 -1
  286. package/dist/render/descriptors/path-builder.js.map +1 -1
  287. package/dist/render/descriptors/path.js.map +1 -1
  288. package/dist/render/descriptors/polygon.js.map +1 -1
  289. package/dist/render/descriptors/polygram.js.map +1 -1
  290. package/dist/render/descriptors/rect.js.map +1 -1
  291. package/dist/render/descriptors/richtext.js.map +1 -1
  292. package/dist/render/descriptors/shape.js.map +1 -1
  293. package/dist/render/descriptors/text.js.map +1 -1
  294. package/dist/render/descriptors/transform.js.map +1 -1
  295. package/dist/render/graphics2d.js.map +1 -1
  296. package/dist/render/index.js.map +1 -1
  297. package/dist/render/measure-context.js.map +1 -1
  298. package/dist/render/null-render-context.js.map +1 -1
  299. package/dist/render/render-context2d.js.map +1 -1
  300. package/dist/render/render-issue.js.map +1 -1
  301. package/dist/render/surface.js.map +1 -1
  302. package/dist/render/text-defaults.js.map +1 -1
  303. package/dist/render/text-layout.js.map +1 -1
  304. package/dist/render3d/bounds3d.js.map +1 -1
  305. package/dist/render3d/builders.js.map +1 -1
  306. package/dist/render3d/camera.js.map +1 -1
  307. package/dist/render3d/fill3d.js.map +1 -1
  308. package/dist/render3d/geometry.js.map +1 -1
  309. package/dist/render3d/graphics3d.js.map +1 -1
  310. package/dist/render3d/index.js.map +1 -1
  311. package/dist/render3d/inert.js.map +1 -1
  312. package/dist/render3d/light.js.map +1 -1
  313. package/dist/render3d/material.js.map +1 -1
  314. package/dist/render3d/matrix4.js.map +1 -1
  315. package/dist/render3d/render-context3d.js.map +1 -1
  316. package/dist/render3d/resources.js.map +1 -1
  317. package/dist/render3d/rounded-box.js.map +1 -1
  318. package/dist/render3d/scene-settings.js.map +1 -1
  319. package/dist/render3d/scene3d.js.map +1 -1
  320. package/dist/render3d/segments.js.map +1 -1
  321. package/dist/render3d/texture.js.map +1 -1
  322. package/dist/render3d/tracking.js.map +1 -1
  323. package/dist/render3d/transform.js.map +1 -1
  324. package/dist/render3d/vector3.js.map +1 -1
  325. package/dist/render3d/walk.js.map +1 -1
  326. package/dist/runtime/asset-refine.js.map +1 -1
  327. package/dist/runtime/asset-timeline.js.map +1 -1
  328. package/dist/runtime/asset-update.js.map +1 -1
  329. package/dist/runtime/audio-index.js.map +1 -1
  330. package/dist/runtime/builtin-context.js.map +1 -1
  331. package/dist/runtime/clip-instance.js.map +1 -1
  332. package/dist/runtime/clip-store.js.map +1 -1
  333. package/dist/runtime/engine.js.map +1 -1
  334. package/dist/runtime/frame-time.js.map +1 -1
  335. package/dist/runtime/index.js.map +1 -1
  336. package/dist/runtime/node-picking.js.map +1 -1
  337. package/dist/runtime/node-picking3d.js.map +1 -1
  338. package/dist/runtime/placement.js.map +1 -1
  339. package/dist/runtime/playback-controller.js.map +1 -1
  340. package/dist/runtime/playback.js.map +1 -1
  341. package/dist/runtime/precompisition.js.map +1 -1
  342. package/dist/runtime/project-assets.js.map +1 -1
  343. package/dist/runtime/session.js.map +1 -1
  344. package/dist/runtime/settle.js.map +1 -1
  345. package/dist/runtime/state-evaluator.js.map +1 -1
  346. package/dist/runtime/text-geometry.js.map +1 -1
  347. package/dist/sdk/index.js.map +1 -1
  348. package/dist/tween/command-decorator.js.map +1 -1
  349. package/dist/tween/command.js.map +1 -1
  350. package/dist/tween/ease/constants.js.map +1 -1
  351. package/dist/tween/ease/curve.js.map +1 -1
  352. package/dist/tween/ease/describe.js.map +1 -1
  353. package/dist/tween/ease/spec.js.map +1 -1
  354. package/dist/tween/ease/type.js.map +1 -1
  355. package/dist/tween/index.js.map +1 -1
  356. package/dist/tween/inert.js.map +1 -1
  357. package/dist/tween/lerp.js.map +1 -1
  358. package/dist/tween/loop.js.map +1 -1
  359. package/dist/tween/prepare.js.map +1 -1
  360. package/dist/tween/stepper.js.map +1 -1
  361. package/dist/tween/to-command.js.map +1 -1
  362. package/dist/util/clamp.js.map +1 -1
  363. package/dist/util/context.js.map +1 -1
  364. package/dist/util/csv.js.map +1 -1
  365. package/dist/util/generateList.js.map +1 -1
  366. package/dist/util/index.js.map +1 -1
  367. package/dist/util/metrics.js.map +1 -1
  368. package/dist/util/random.js.map +1 -1
  369. package/dist/util/reference.js.map +1 -1
  370. package/dist/util/scheduler.js.map +1 -1
  371. package/package.json +1 -1
  372. package/dist/attributes/audio/filters/chain.d.ts +0 -113
  373. package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
  374. package/dist/attributes/audio/filters/chain.js +0 -104
  375. package/dist/attributes/audio/filters/chain.js.map +0 -1
  376. package/dist/attributes/audio/filters/curve.d.ts +0 -152
  377. package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
  378. package/dist/attributes/audio/filters/curve.js +0 -250
  379. package/dist/attributes/audio/filters/curve.js.map +0 -1
  380. package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
  381. package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
  382. package/dist/attributes/audio/filters/implementations/echo.js +0 -11
  383. package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
  384. package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
  385. package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
  386. package/dist/attributes/audio/filters/implementations/gain.js +0 -6
  387. package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
  388. package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
  389. package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
  390. package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
  391. package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
  392. package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
  393. package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
  394. package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
  395. package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
  396. package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
  397. package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
  398. package/dist/attributes/audio/filters/implementations/speed.js +0 -6
  399. package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
  400. package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
  401. package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
  402. package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
  403. package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
  404. package/dist/attributes/audio/filters/index.d.ts +0 -22
  405. package/dist/attributes/audio/filters/index.d.ts.map +0 -1
  406. package/dist/attributes/audio/filters/index.js +0 -8
  407. package/dist/attributes/audio/filters/index.js.map +0 -1
  408. package/dist/attributes/audio/filters/registry.d.ts +0 -36
  409. package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
  410. package/dist/attributes/audio/filters/registry.js +0 -82
  411. package/dist/attributes/audio/filters/registry.js.map +0 -1
  412. package/dist/attributes/audio/filters/union.d.ts +0 -18
  413. package/dist/attributes/audio/filters/union.d.ts.map +0 -1
  414. package/dist/attributes/audio/filters/union.js +0 -28
  415. package/dist/attributes/audio/filters/union.js.map +0 -1
  416. package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
  417. package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
  418. package/dist/attributes/shape/sksl-uniforms.js +0 -0
  419. package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
  420. package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
  421. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
  422. package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
  423. package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
  424. package/dist/component/api.d.ts +0 -508
  425. package/dist/component/api.d.ts.map +0 -1
  426. package/dist/component/api.js +0 -4
  427. package/dist/component/api.js.map +0 -1
  428. package/dist/component/builtins/audio.d.ts +0 -26
  429. package/dist/component/builtins/audio.d.ts.map +0 -1
  430. package/dist/component/builtins/audio.js +0 -41
  431. package/dist/component/builtins/audio.js.map +0 -1
  432. package/dist/component/builtins/canvas3d.d.ts +0 -98
  433. package/dist/component/builtins/canvas3d.d.ts.map +0 -1
  434. package/dist/component/builtins/canvas3d.js +0 -21
  435. package/dist/component/builtins/canvas3d.js.map +0 -1
  436. package/dist/component/builtins/composite.d.ts +0 -56
  437. package/dist/component/builtins/composite.d.ts.map +0 -1
  438. package/dist/component/builtins/composite.js +0 -25
  439. package/dist/component/builtins/composite.js.map +0 -1
  440. package/dist/component/builtins/geometry.d.ts +0 -505
  441. package/dist/component/builtins/geometry.d.ts.map +0 -1
  442. package/dist/component/builtins/geometry.js +0 -107
  443. package/dist/component/builtins/geometry.js.map +0 -1
  444. package/dist/component/builtins/layout.d.ts +0 -88
  445. package/dist/component/builtins/layout.d.ts.map +0 -1
  446. package/dist/component/builtins/layout.js +0 -84
  447. package/dist/component/builtins/layout.js.map +0 -1
  448. package/dist/component/builtins/media.d.ts +0 -95
  449. package/dist/component/builtins/media.d.ts.map +0 -1
  450. package/dist/component/builtins/media.js +0 -149
  451. package/dist/component/builtins/media.js.map +0 -1
  452. package/dist/component/builtins/providers.d.ts +0 -23
  453. package/dist/component/builtins/providers.d.ts.map +0 -1
  454. package/dist/component/builtins/providers.js +0 -30
  455. package/dist/component/builtins/providers.js.map +0 -1
  456. package/dist/component/builtins/text.d.ts +0 -193
  457. package/dist/component/builtins/text.d.ts.map +0 -1
  458. package/dist/component/builtins/text.js +0 -113
  459. package/dist/component/builtins/text.js.map +0 -1
  460. package/dist/component/builtins/three.d.ts +0 -1085
  461. package/dist/component/builtins/three.d.ts.map +0 -1
  462. package/dist/component/builtins/three.js +0 -265
  463. package/dist/component/builtins/three.js.map +0 -1
  464. package/dist/component/clip-of.d.ts +0 -5
  465. package/dist/component/clip-of.d.ts.map +0 -1
  466. package/dist/component/clip-of.js +0 -33
  467. package/dist/component/clip-of.js.map +0 -1
  468. package/dist/component/commands-for.d.ts +0 -19
  469. package/dist/component/commands-for.d.ts.map +0 -1
  470. package/dist/component/commands-for.js +0 -5
  471. package/dist/component/commands-for.js.map +0 -1
  472. package/dist/component/component-audio.d.ts +0 -9
  473. package/dist/component/component-audio.d.ts.map +0 -1
  474. package/dist/component/component-audio.js +0 -18
  475. package/dist/component/component-audio.js.map +0 -1
  476. package/dist/component/component2d.d.ts +0 -9
  477. package/dist/component/component2d.d.ts.map +0 -1
  478. package/dist/component/component2d.js +0 -239
  479. package/dist/component/component2d.js.map +0 -1
  480. package/dist/component/component3d.d.ts +0 -9
  481. package/dist/component/component3d.d.ts.map +0 -1
  482. package/dist/component/component3d.js +0 -99
  483. package/dist/component/component3d.js.map +0 -1
  484. package/dist/component/factory.d.ts +0 -63
  485. package/dist/component/factory.d.ts.map +0 -1
  486. package/dist/component/factory.js +0 -313
  487. package/dist/component/factory.js.map +0 -1
  488. package/dist/component/modules/aim.d.ts +0 -30
  489. package/dist/component/modules/aim.d.ts.map +0 -1
  490. package/dist/component/modules/aim.js +0 -39
  491. package/dist/component/modules/aim.js.map +0 -1
  492. package/dist/component/modules/corners.d.ts +0 -13
  493. package/dist/component/modules/corners.d.ts.map +0 -1
  494. package/dist/component/modules/corners.js +0 -12
  495. package/dist/component/modules/corners.js.map +0 -1
  496. package/dist/component/modules/flow.d.ts +0 -26
  497. package/dist/component/modules/flow.d.ts.map +0 -1
  498. package/dist/component/modules/flow.js +0 -55
  499. package/dist/component/modules/flow.js.map +0 -1
  500. package/dist/component/modules/material.d.ts +0 -40
  501. package/dist/component/modules/material.d.ts.map +0 -1
  502. package/dist/component/modules/material.js +0 -75
  503. package/dist/component/modules/material.js.map +0 -1
  504. package/dist/component/modules/paint.d.ts +0 -71
  505. package/dist/component/modules/paint.d.ts.map +0 -1
  506. package/dist/component/modules/paint.js +0 -106
  507. package/dist/component/modules/paint.js.map +0 -1
  508. package/dist/component/modules/shapes.d.ts +0 -31
  509. package/dist/component/modules/shapes.d.ts.map +0 -1
  510. package/dist/component/modules/shapes.js +0 -43
  511. package/dist/component/modules/shapes.js.map +0 -1
  512. package/dist/component/modules/text-layout.d.ts +0 -26
  513. package/dist/component/modules/text-layout.d.ts.map +0 -1
  514. package/dist/component/modules/text-layout.js +0 -57
  515. package/dist/component/modules/text-layout.js.map +0 -1
  516. package/dist/component/modules/text-style.d.ts +0 -48
  517. package/dist/component/modules/text-style.d.ts.map +0 -1
  518. package/dist/component/modules/text-style.js +0 -63
  519. package/dist/component/modules/text-style.js.map +0 -1
  520. package/dist/component/modules/three-entries.d.ts +0 -23
  521. package/dist/component/modules/three-entries.d.ts.map +0 -1
  522. package/dist/component/modules/three-entries.js +0 -41
  523. package/dist/component/modules/three-entries.js.map +0 -1
  524. package/dist/component/modules/view3d.d.ts +0 -55
  525. package/dist/component/modules/view3d.d.ts.map +0 -1
  526. package/dist/component/modules/view3d.js +0 -160
  527. package/dist/component/modules/view3d.js.map +0 -1
  528. package/dist/component/timeline.d.ts +0 -22
  529. package/dist/component/timeline.d.ts.map +0 -1
  530. package/dist/component/timeline.js +0 -128
  531. package/dist/component/timeline.js.map +0 -1
  532. package/dist/component/type-def.d.ts +0 -26
  533. package/dist/component/type-def.d.ts.map +0 -1
  534. package/dist/component/type-def.js +0 -16
  535. package/dist/component/type-def.js.map +0 -1
  536. package/dist/component/types.d.ts +0 -91
  537. package/dist/component/types.d.ts.map +0 -1
  538. package/dist/component/types.js +0 -88
  539. package/dist/component/types.js.map +0 -1
  540. package/dist/component/views.d.ts +0 -121
  541. package/dist/component/views.d.ts.map +0 -1
  542. package/dist/component/views.js +0 -413
  543. package/dist/component/views.js.map +0 -1
  544. package/dist/document/withdraw.d.ts +0 -28
  545. package/dist/document/withdraw.d.ts.map +0 -1
  546. package/dist/document/withdraw.js +0 -61
  547. package/dist/document/withdraw.js.map +0 -1
  548. package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
  549. package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
  550. package/dist/jsx/jsx-dev-runtime.js +0 -3
  551. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  552. package/dist/jsx/jsx-runtime.d.ts +0 -27
  553. package/dist/jsx/jsx-runtime.d.ts.map +0 -1
  554. package/dist/jsx/jsx-runtime.js +0 -26
  555. package/dist/jsx/jsx-runtime.js.map +0 -1
  556. package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
  557. package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
  558. package/dist/nodes/2d/node-lifecycle.js +0 -264
  559. package/dist/nodes/2d/node-lifecycle.js.map +0 -1
  560. package/dist/nodes/2d/node-motion.d.ts +0 -56
  561. package/dist/nodes/2d/node-motion.d.ts.map +0 -1
  562. package/dist/nodes/2d/node-motion.js +0 -86
  563. package/dist/nodes/2d/node-motion.js.map +0 -1
  564. package/dist/nodes/2d/node-render.d.ts +0 -44
  565. package/dist/nodes/2d/node-render.d.ts.map +0 -1
  566. package/dist/nodes/2d/node-render.js +0 -80
  567. package/dist/nodes/2d/node-render.js.map +0 -1
  568. package/dist/nodes/2d/node-space.d.ts +0 -63
  569. package/dist/nodes/2d/node-space.d.ts.map +0 -1
  570. package/dist/nodes/2d/node-space.js +0 -131
  571. package/dist/nodes/2d/node-space.js.map +0 -1
  572. package/dist/nodes/2d/node-transform.d.ts +0 -55
  573. package/dist/nodes/2d/node-transform.d.ts.map +0 -1
  574. package/dist/nodes/2d/node-transform.js +0 -73
  575. package/dist/nodes/2d/node-transform.js.map +0 -1
  576. package/dist/nodes/2d/node2d.d.ts +0 -1111
  577. package/dist/nodes/2d/node2d.d.ts.map +0 -1
  578. package/dist/nodes/2d/node2d.js +0 -1665
  579. package/dist/nodes/2d/node2d.js.map +0 -1
  580. package/dist/nodes/2d/paint-node.d.ts +0 -142
  581. package/dist/nodes/2d/paint-node.d.ts.map +0 -1
  582. package/dist/nodes/2d/paint-node.js +0 -232
  583. package/dist/nodes/2d/paint-node.js.map +0 -1
  584. package/dist/nodes/audio/audio-bus.d.ts +0 -28
  585. package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
  586. package/dist/nodes/audio/audio-bus.js +0 -33
  587. package/dist/nodes/audio/audio-bus.js.map +0 -1
  588. package/dist/nodes/audio/index.d.ts +0 -4
  589. package/dist/nodes/audio/index.d.ts.map +0 -1
  590. package/dist/nodes/audio/index.js +0 -2
  591. package/dist/nodes/audio/index.js.map +0 -1
  592. package/dist/nodes/audio/node-audio.d.ts +0 -107
  593. package/dist/nodes/audio/node-audio.d.ts.map +0 -1
  594. package/dist/nodes/audio/node-audio.js +0 -179
  595. package/dist/nodes/audio/node-audio.js.map +0 -1
  596. package/dist/nodes/audio/sound-node.d.ts +0 -41
  597. package/dist/nodes/audio/sound-node.d.ts.map +0 -1
  598. package/dist/nodes/audio/sound-node.js +0 -71
  599. package/dist/nodes/audio/sound-node.js.map +0 -1
  600. package/dist/nodes/geometry/boolean-node.d.ts +0 -28
  601. package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
  602. package/dist/nodes/geometry/boolean-node.js +0 -81
  603. package/dist/nodes/geometry/boolean-node.js.map +0 -1
  604. package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
  605. package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
  606. package/dist/nodes/geometry/bounds-shape-node.js +0 -181
  607. package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
  608. package/dist/nodes/geometry/box-path-node.d.ts +0 -89
  609. package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
  610. package/dist/nodes/geometry/box-path-node.js +0 -116
  611. package/dist/nodes/geometry/box-path-node.js.map +0 -1
  612. package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
  613. package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
  614. package/dist/nodes/geometry/ellipse-node.js +0 -45
  615. package/dist/nodes/geometry/ellipse-node.js.map +0 -1
  616. package/dist/nodes/geometry/group-bounds.d.ts +0 -56
  617. package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
  618. package/dist/nodes/geometry/group-bounds.js +0 -87
  619. package/dist/nodes/geometry/group-bounds.js.map +0 -1
  620. package/dist/nodes/geometry/mask-node.d.ts +0 -33
  621. package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
  622. package/dist/nodes/geometry/mask-node.js +0 -66
  623. package/dist/nodes/geometry/mask-node.js.map +0 -1
  624. package/dist/nodes/geometry/path-node.d.ts +0 -26
  625. package/dist/nodes/geometry/path-node.d.ts.map +0 -1
  626. package/dist/nodes/geometry/path-node.js +0 -58
  627. package/dist/nodes/geometry/path-node.js.map +0 -1
  628. package/dist/nodes/geometry/polygon-node.d.ts +0 -26
  629. package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
  630. package/dist/nodes/geometry/polygon-node.js +0 -47
  631. package/dist/nodes/geometry/polygon-node.js.map +0 -1
  632. package/dist/nodes/geometry/polygram-node.d.ts +0 -33
  633. package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
  634. package/dist/nodes/geometry/polygram-node.js +0 -52
  635. package/dist/nodes/geometry/polygram-node.js.map +0 -1
  636. package/dist/nodes/geometry/rect-node.d.ts +0 -38
  637. package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
  638. package/dist/nodes/geometry/rect-node.js +0 -56
  639. package/dist/nodes/geometry/rect-node.js.map +0 -1
  640. package/dist/nodes/geometry/shape-node.d.ts +0 -71
  641. package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
  642. package/dist/nodes/geometry/shape-node.js +0 -140
  643. package/dist/nodes/geometry/shape-node.js.map +0 -1
  644. package/dist/nodes/geometry/shape-outline.d.ts +0 -93
  645. package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
  646. package/dist/nodes/geometry/shape-outline.js +0 -470
  647. package/dist/nodes/geometry/shape-outline.js.map +0 -1
  648. package/dist/nodes/index.d.ts +0 -53
  649. package/dist/nodes/index.d.ts.map +0 -1
  650. package/dist/nodes/index.js +0 -35
  651. package/dist/nodes/index.js.map +0 -1
  652. package/dist/nodes/layout/camera-node.d.ts +0 -80
  653. package/dist/nodes/layout/camera-node.d.ts.map +0 -1
  654. package/dist/nodes/layout/camera-node.js +0 -153
  655. package/dist/nodes/layout/camera-node.js.map +0 -1
  656. package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
  657. package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
  658. package/dist/nodes/layout/orbit-camera-node.js +0 -118
  659. package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
  660. package/dist/nodes/layout/rotated-box.d.ts +0 -20
  661. package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
  662. package/dist/nodes/layout/rotated-box.js +0 -76
  663. package/dist/nodes/layout/rotated-box.js.map +0 -1
  664. package/dist/nodes/media/video-node.d.ts +0 -229
  665. package/dist/nodes/media/video-node.d.ts.map +0 -1
  666. package/dist/nodes/media/video-node.js +0 -350
  667. package/dist/nodes/media/video-node.js.map +0 -1
  668. package/dist/nodes/node/declare-paints.d.ts +0 -19
  669. package/dist/nodes/node/declare-paints.d.ts.map +0 -1
  670. package/dist/nodes/node/declare-paints.js +0 -27
  671. package/dist/nodes/node/declare-paints.js.map +0 -1
  672. package/dist/nodes/node/node-editor-state.d.ts +0 -53
  673. package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
  674. package/dist/nodes/node/node-editor-state.js +0 -23
  675. package/dist/nodes/node/node-editor-state.js.map +0 -1
  676. package/dist/nodes/node/node-reactive.d.ts +0 -89
  677. package/dist/nodes/node/node-reactive.d.ts.map +0 -1
  678. package/dist/nodes/node/node-reactive.js +0 -135
  679. package/dist/nodes/node/node-reactive.js.map +0 -1
  680. package/dist/nodes/node/node-time.d.ts +0 -39
  681. package/dist/nodes/node/node-time.d.ts.map +0 -1
  682. package/dist/nodes/node/node-time.js +0 -14
  683. package/dist/nodes/node/node-time.js.map +0 -1
  684. package/dist/nodes/node/node-walk.d.ts +0 -46
  685. package/dist/nodes/node/node-walk.d.ts.map +0 -1
  686. package/dist/nodes/node/node-walk.js +0 -74
  687. package/dist/nodes/node/node-walk.js.map +0 -1
  688. package/dist/nodes/node/node.d.ts +0 -445
  689. package/dist/nodes/node/node.d.ts.map +0 -1
  690. package/dist/nodes/node/node.js +0 -745
  691. package/dist/nodes/node/node.js.map +0 -1
  692. package/dist/nodes/node/text-defaults.d.ts +0 -32
  693. package/dist/nodes/node/text-defaults.d.ts.map +0 -1
  694. package/dist/nodes/node/text-defaults.js +0 -37
  695. package/dist/nodes/node/text-defaults.js.map +0 -1
  696. package/dist/nodes/root/canvas2d-node.d.ts +0 -163
  697. package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
  698. package/dist/nodes/root/canvas2d-node.js +0 -264
  699. package/dist/nodes/root/canvas2d-node.js.map +0 -1
  700. package/dist/nodes/root/provider-node.d.ts +0 -47
  701. package/dist/nodes/root/provider-node.d.ts.map +0 -1
  702. package/dist/nodes/root/provider-node.js +0 -63
  703. package/dist/nodes/root/provider-node.js.map +0 -1
  704. package/dist/nodes/root/theme-provider-node.d.ts +0 -29
  705. package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
  706. package/dist/nodes/root/theme-provider-node.js +0 -43
  707. package/dist/nodes/root/theme-provider-node.js.map +0 -1
  708. package/dist/nodes/text/default-text-style-node.d.ts +0 -103
  709. package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
  710. package/dist/nodes/text/default-text-style-node.js +0 -146
  711. package/dist/nodes/text/default-text-style-node.js.map +0 -1
  712. package/dist/nodes/text/number-format.d.ts +0 -66
  713. package/dist/nodes/text/number-format.d.ts.map +0 -1
  714. package/dist/nodes/text/number-format.js +0 -227
  715. package/dist/nodes/text/number-format.js.map +0 -1
  716. package/dist/nodes/text/number-node.d.ts +0 -94
  717. package/dist/nodes/text/number-node.d.ts.map +0 -1
  718. package/dist/nodes/text/number-node.js +0 -86
  719. package/dist/nodes/text/number-node.js.map +0 -1
  720. package/dist/nodes/text/number-pattern.d.ts +0 -51
  721. package/dist/nodes/text/number-pattern.d.ts.map +0 -1
  722. package/dist/nodes/text/number-pattern.js +0 -77
  723. package/dist/nodes/text/number-pattern.js.map +0 -1
  724. package/dist/nodes/text/richtext-node.d.ts +0 -68
  725. package/dist/nodes/text/richtext-node.d.ts.map +0 -1
  726. package/dist/nodes/text/richtext-node.js +0 -78
  727. package/dist/nodes/text/richtext-node.js.map +0 -1
  728. package/dist/nodes/text/text-base.d.ts +0 -118
  729. package/dist/nodes/text/text-base.d.ts.map +0 -1
  730. package/dist/nodes/text/text-base.js +0 -153
  731. package/dist/nodes/text/text-base.js.map +0 -1
  732. package/dist/nodes/text/text-layout.d.ts +0 -87
  733. package/dist/nodes/text/text-layout.d.ts.map +0 -1
  734. package/dist/nodes/text/text-layout.js +0 -368
  735. package/dist/nodes/text/text-layout.js.map +0 -1
  736. package/dist/nodes/text/text-node.d.ts +0 -84
  737. package/dist/nodes/text/text-node.d.ts.map +0 -1
  738. package/dist/nodes/text/text-node.js +0 -188
  739. package/dist/nodes/text/text-node.js.map +0 -1
  740. package/dist/nodes/text/text-selection.d.ts +0 -125
  741. package/dist/nodes/text/text-selection.d.ts.map +0 -1
  742. package/dist/nodes/text/text-selection.js +0 -209
  743. package/dist/nodes/text/text-selection.js.map +0 -1
  744. package/dist/nodes/three/camera-nodes.d.ts +0 -109
  745. package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
  746. package/dist/nodes/three/camera-nodes.js +0 -112
  747. package/dist/nodes/three/camera-nodes.js.map +0 -1
  748. package/dist/nodes/three/canvas3d-node.d.ts +0 -295
  749. package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
  750. package/dist/nodes/three/canvas3d-node.js +0 -486
  751. package/dist/nodes/three/canvas3d-node.js.map +0 -1
  752. package/dist/nodes/three/drawable-nodes.d.ts +0 -173
  753. package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
  754. package/dist/nodes/three/drawable-nodes.js +0 -284
  755. package/dist/nodes/three/drawable-nodes.js.map +0 -1
  756. package/dist/nodes/three/environment-nodes.d.ts +0 -106
  757. package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
  758. package/dist/nodes/three/environment-nodes.js +0 -134
  759. package/dist/nodes/three/environment-nodes.js.map +0 -1
  760. package/dist/nodes/three/geometry-nodes.d.ts +0 -197
  761. package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
  762. package/dist/nodes/three/geometry-nodes.js +0 -322
  763. package/dist/nodes/three/geometry-nodes.js.map +0 -1
  764. package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
  765. package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
  766. package/dist/nodes/three/grid-geometry3d.js +0 -114
  767. package/dist/nodes/three/grid-geometry3d.js.map +0 -1
  768. package/dist/nodes/three/group3d.d.ts +0 -23
  769. package/dist/nodes/three/group3d.d.ts.map +0 -1
  770. package/dist/nodes/three/group3d.js +0 -21
  771. package/dist/nodes/three/group3d.js.map +0 -1
  772. package/dist/nodes/three/light-nodes.d.ts +0 -120
  773. package/dist/nodes/three/light-nodes.d.ts.map +0 -1
  774. package/dist/nodes/three/light-nodes.js +0 -173
  775. package/dist/nodes/three/light-nodes.js.map +0 -1
  776. package/dist/nodes/three/mesh3d.d.ts +0 -117
  777. package/dist/nodes/three/mesh3d.d.ts.map +0 -1
  778. package/dist/nodes/three/mesh3d.js +0 -147
  779. package/dist/nodes/three/mesh3d.js.map +0 -1
  780. package/dist/nodes/three/node3d.d.ts +0 -230
  781. package/dist/nodes/three/node3d.d.ts.map +0 -1
  782. package/dist/nodes/three/node3d.js +0 -337
  783. package/dist/nodes/three/node3d.js.map +0 -1
  784. package/dist/render/descriptors/latex.d.ts +0 -6
  785. package/dist/render/descriptors/latex.d.ts.map +0 -1
  786. package/dist/render/descriptors/latex.js +0 -2
  787. package/dist/render/descriptors/latex.js.map +0 -1
  788. package/dist/tween/seekable.d.ts +0 -81
  789. package/dist/tween/seekable.d.ts.map +0 -1
  790. package/dist/tween/seekable.js +0 -137
  791. package/dist/tween/seekable.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"views.js","sourceRoot":"","sources":["../../../src/components/factory/views.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAetD,gHAAgH;AAChH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAwB5C,IAAI,IAAI,GAAgB,IAAI,CAAC;AAE7B,MAAM,UAAU,QAAQ,CAAI,IAAY,EAAE,KAAuB,EAAE,IAAS,EAAE,GAAY;IACtF,MAAM,KAAK,GAAG,IAAI,CAAC;IACnB,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAC/C,IAAI,CAAC;QACD,OAAO,GAAG,EAAE,CAAC;IACjB,CAAC;YAAS,CAAC;QACP,IAAI,GAAG,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAU,CAAC;AAEtC,0GAA0G;AAC1G,MAAM,UAAU,WAAW,CAAC,IAAY;IACpC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,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;YACjD,IAAI,EAAE,YAAY,SAAS,CAAC,IAAI;gBAAE,OAAO,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAA0C,CAAC;QAC9G,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2FAA2F;IAC3F,OAAO,CAAC,IAAgB;QACpB,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;YACP,OAAO;QACX,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC;YACD,IAAI,EAAE,CAAC;QACX,CAAC;gBAAS,CAAC;YACP,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAED,uFAAuF;AACvF,MAAM,UAAU,GAAiB,IAAI,iBAAiB,EAAE,CAAC;AAEzD,MAAM,UAAU,WAAW,CAAC,GAAoB;IAC5C,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAiB,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,iEAAiE,CAAC,CAAC;IAChI,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { SizeConstraints } from \"@/layout/constraints\";\r\nimport type { Node2D, CameraScope } from \"@/components/trees/2d/node2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { MeasureContext2D } from \"@/render/measure-context\";\r\nimport type { RenderPass2D } from \"@/render/render-context2d\";\r\nimport type { Clip } from \"@/render/clip\";\r\nimport { NullRenderContext } from \"@/render/null-render-context\";\r\nimport { Graphics2D as GraphicsClass } from \"@/render/graphics2d\";\r\nimport { frameIn, Node2D as Node2DClass } from \"@/components/trees/2d/node2d\";\r\nimport { Node3D } from \"@/components/trees/three/node3d\";\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { ChildBoundsMode } from \"@/components/trees/2d/group-bounds\";\r\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport type { TextStyle } from \"@/attributes/text/types\";\r\nimport type { MergePaint, ChildView, Clock, Component, Element, FontSpec, Max, Measurer, NodeFrame, NodeView, Piece, RenderContext2D } from \"@/components/factory/api\";\r\nimport { clipOf } from \"@/components/factory/clip-of\";\r\n\r\n/**\r\n * What a render did with its children beyond drawing them: composited them\r\n * (the ink bounds that leaves), looked at them through a camera, or stood them\r\n * in a 2.5D space. Picking and the space machinery read it between frames.\r\n */\r\nexport interface Composite {\r\n readonly bounds?: ChildBoundsMode;\r\n readonly camera?: CameraScope;\r\n readonly space?: SpaceCamera;\r\n /** The scene its 3D children were rendered into: what picking projects through. */\r\n readonly scene?: Scene3D;\r\n}\r\n\r\n/** The node a view stands for: how the engine's own modules (`Paint`, `Flow`) reach past the public surface. */\r\nexport const NODE = Symbol(\"componentNode\");\r\n\r\n/** What a generated node exposes to its views and modules. Never part of the authoring surface. */\r\nexport interface ComponentHost extends Node2D {\r\n _renderOwnChildren(pass: RenderPass2D): void;\r\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\r\n _lastShape: Graphics2D | null;\r\n /** The composite its last render or probe declared; `undefined` before either. */\r\n _record: Composite | null | undefined;\r\n}\r\n\r\n// ---- the pass in progress -------------------------------------------------\r\n\r\n/**\r\n * Measure and layout run synchronously, one node at a time, so the node being\r\n * laid out and its measurer are a single slot rather than state on every view.\r\n */\r\ninterface Pass {\r\n readonly node: Node2D;\r\n readonly scope: MeasureContext2D;\r\n readonly room: Max;\r\n readonly sizes: Map<Node2D, Size2D>;\r\n}\r\n\r\nlet pass: Pass | null = null;\r\n\r\nexport function withPass<T>(node: Node2D, scope: MeasureContext2D, room: Max, run: () => T): T {\r\n const outer = pass;\r\n pass = { node, scope, room, sizes: new Map() };\r\n try {\r\n return run();\r\n } finally {\r\n pass = outer;\r\n }\r\n}\r\n\r\nconst decided = new WeakSet<Node2D>();\r\n\r\n/** An engine module sized this node itself in this measure: its factory reports the size as it stands. */\r\nexport function markDecided(node: Node2D): void {\r\n decided.add(node);\r\n}\r\n\r\nexport function takeDecided(node: Node2D): boolean {\r\n return decided.delete(node);\r\n}\r\n\r\nexport function currentPass(): Pass {\r\n if (!pass) throw new Error(\"A component's measure or layout helper ran outside a measure or layout pass.\");\r\n return pass;\r\n}\r\n\r\nfunction measureChild(node: Node2D, max: Max): Size2D {\r\n const p = currentPass();\r\n const constraints: SizeConstraints = { maxWidth: max.width, maxHeight: max.height };\r\n const measured = node.measure(constraints, p.scope);\r\n const size = { width: measured.width ?? 0, height: measured.height ?? 0 };\r\n p.sizes.set(node, size);\r\n return size;\r\n}\r\n\r\n// ---- child views ------------------------------------------------------------\r\n\r\nconst childViews = new WeakMap<Node2D, ChildViewImpl>();\r\n\r\n/** A child as its parent's fields see it. One per child node, reused every frame. */\r\nclass ChildViewImpl implements ChildView {\r\n readonly [NODE]: Node2D;\r\n readonly state: never;\r\n\r\n constructor(node: Node2D) {\r\n this[NODE] = node;\r\n // The node's own accessors are its resolved values; a proxy keeps a parent from writing through them.\r\n this.state = new Proxy(node, {\r\n set: () => { throw new TypeError(\"A child's state is read-only to its parent; animate it with a command.\"); },\r\n }) as never;\r\n }\r\n\r\n get id(): string { return this[NODE].id; }\r\n get key(): never { return (keyOf(this[NODE]) ?? this[NODE].className) as never; }\r\n\r\n get size(): Size2D {\r\n // Outside a pass (a command being built), the size it was last laid out at, as a command's own node reports.\r\n if (!pass) {\r\n const box = this[NODE].layoutBounds;\r\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\r\n }\r\n return pass.sizes.get(this[NODE]) ?? measureChild(this[NODE], pass.room);\r\n }\r\n\r\n get children(): readonly ChildView[] {\r\n const node = this[NODE] as Node2D & { _commandChildren?(): readonly ChildView[] };\r\n return node._commandChildren ? node._commandChildren() : node.children.map(childView);\r\n }\r\n\r\n measure(max: Max): Size2D {\r\n return measureChild(this[NODE], max);\r\n }\r\n\r\n to(targets: object): Piece {\r\n return { _piece: { kind: \"child\", node: this[NODE], targets: targets as Record<string, unknown> } };\r\n }\r\n\r\n run(name: string, args?: object): Piece {\r\n return { _piece: { kind: \"run\", node: this[NODE], name, args } };\r\n }\r\n}\r\n\r\nexport function childView(node: Node2D | Node): ChildView {\r\n let view = childViews.get(node as Node2D);\r\n if (!view) childViews.set(node as Node2D, view = new ChildViewImpl(node as Node2D));\r\n return view as unknown as ChildView;\r\n}\r\n\r\nexport function nodeOfView(view: ChildView<any>): Node2D {\r\n return (view as unknown as ChildViewImpl)[NODE];\r\n}\r\n\r\nconst nodeViews = new WeakMap<Node, WeakMap<Node, NodeViewImpl>>();\r\n\r\nconst NO_FRAME: NodeFrame = { x: 0, y: 0, rotation: 0, scale: 1 };\r\n\r\n/** A node outside a component's own children (an ancestor, a referenced node), as one reader's fields read it. */\r\nclass NodeViewImpl implements NodeView {\r\n readonly [NODE]: Node;\r\n readonly state: never;\r\n\r\n constructor(node: Node, readonly reader: Node) {\r\n this[NODE] = node;\r\n // A component's state as its own fields read it: a reference of its own is a view from where it stands.\r\n // Anything else it has (a 2D node's cardinal points) reads off the node.\r\n const fields = (node as { _view?: object })._view ?? node;\r\n this.state = new Proxy(fields, {\r\n get: (target, key) => {\r\n // Its constructor is the node's: what a host asks to tell what kind of node it reads.\r\n if (key === \"constructor\") return node.constructor;\r\n if (key in target) return Reflect.get(target, key);\r\n const value = Reflect.get(node, key) as unknown;\r\n // A method of the node runs on the node, not on this read-only view.\r\n return typeof value === \"function\" ? (value as (...args: unknown[]) => unknown).bind(node) : value;\r\n },\r\n set: () => { throw new TypeError(\"Another node's state is read-only to a component; animate it with a command.\"); },\r\n }) as never;\r\n }\r\n\r\n get id(): string { return this[NODE].id; }\r\n get key(): never { return (keyOf(this[NODE] as Node2D) ?? this[NODE].className) as never; }\r\n\r\n get size(): Size2D {\r\n const node = this[NODE];\r\n const box = node instanceof Node2DClass ? node.layoutBounds : undefined;\r\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\r\n }\r\n\r\n get frame(): NodeFrame {\r\n const node = this[NODE];\r\n return node instanceof Node2DClass && this.reader instanceof Node2DClass ? frameIn(this.reader, node) : NO_FRAME;\r\n }\r\n}\r\n\r\n/** `node` as `reader` sees it. One view per pair. */\r\nexport function nodeView(node: Node, reader: Node): NodeView {\r\n let byReader = nodeViews.get(node);\r\n if (!byReader) nodeViews.set(node, byReader = new WeakMap());\r\n let view = byReader.get(reader);\r\n if (!view) byReader.set(reader, view = new NodeViewImpl(node, reader));\r\n return view;\r\n}\r\n\r\nexport function nodeOfNodeView(view: NodeView): Node {\r\n return (view as unknown as NodeViewImpl)[NODE];\r\n}\r\n\r\nconst found = new WeakMap<Node, Map<string, Node>>();\r\n\r\n/** The node with `id` in `reader`'s scene, as `reader` sees it, or `null`. Remembered per reader while it stays in the scene. */\r\nexport function referenced(reader: Node, id: unknown): NodeView | null {\r\n if (typeof id !== \"string\" || id === \"\") return null;\r\n let known = found.get(reader);\r\n let node = known?.get(id);\r\n if (!node || node.id !== id || rootOf(node) !== rootOf(reader)) {\r\n node = findIn(rootOf(reader), id) ?? undefined;\r\n if (!node) {\r\n known?.delete(id);\r\n return null;\r\n }\r\n if (!known) found.set(reader, known = new Map());\r\n known.set(id, node);\r\n }\r\n return nodeView(node, reader);\r\n}\r\n\r\nfunction rootOf(node: Node): Node {\r\n let at = node;\r\n while (at.parent) at = at.parent;\r\n return at;\r\n}\r\n\r\nfunction findIn(at: Node, id: string): Node | null {\r\n if (at.id === id) return at;\r\n for (const child of at._allChildren) {\r\n const hit = findIn(child, id);\r\n if (hit) return hit;\r\n }\r\n return null;\r\n}\r\n\r\nlet keyOf: (node: Node2D) => string | undefined = () => undefined;\r\n/** Set by the factory module, which owns the node descriptors. */\r\nexport function setKeyLookup(lookup: (node: Node2D) => string | undefined): void {\r\n keyOf = lookup;\r\n}\r\n\r\n// ---- state views ------------------------------------------------------------\r\n\r\n/**\r\n * One prototype of getters per component, so a node's `state` is a single\r\n * object made once: every read goes straight to the node's own slot, and a\r\n * frame allocates nothing to hand its fields their values.\r\n */\r\nexport interface ViewShape {\r\n readonly proto: object;\r\n /** Own, so `{ ...state }` copies every entry; the getters themselves are shared. */\r\n readonly entries: PropertyDescriptorMap;\r\n}\r\n\r\nexport function stateViewPrototype(keys: readonly string[], references: ReadonlySet<string> = new Set()): ViewShape {\r\n const entries: PropertyDescriptorMap = {};\r\n for (const key of keys) {\r\n entries[key] = references.has(key)\r\n ? { get(this: { [NODE]: Node }) { return referenced(this[NODE], (this[NODE] as unknown as Record<string, unknown>)[key]); }, enumerable: true }\r\n : { get(this: { [NODE]: object }) { return (this[NODE] as Record<string, unknown>)[key]; }, enumerable: true };\r\n }\r\n const proto = {};\r\n // The children of the node's own tree, as its commands see them too.\r\n Object.defineProperty(proto, \"children\", {\r\n get(this: { [NODE]: { _commandChildren(): readonly ChildView[] } }) { return this[NODE]._commandChildren(); },\r\n enumerable: false,\r\n });\r\n return { proto, entries };\r\n}\r\n\r\nexport function stateView(shape: ViewShape, node: object): object {\r\n const view = Object.create(shape.proto) as { [NODE]: object };\r\n Object.defineProperties(view, shape.entries);\r\n view[NODE] = node;\r\n return view;\r\n}\r\n\r\n/** A command's `state`: where it starts, so a frame function reading it never sees its own writes. */\r\nexport function snapshot(view: object): Record<string, unknown> {\r\n const out: Record<string, unknown> = {};\r\n for (const key in view) out[key] = (view as Record<string, unknown>)[key];\r\n return out;\r\n}\r\n\r\n// ---- measurer and render context --------------------------------------------\r\n\r\nexport class MeasurerImpl implements Measurer {\r\n max: Max = {};\r\n scope: MeasureContext2D | null = null;\r\n\r\n constructor(readonly host: Node) { }\r\n\r\n get time(): Clock {\r\n return this.host.time;\r\n }\r\n\r\n text(text: string, font: FontSpec): Size2D {\r\n if (!this.scope) throw new Error(\"measurer.text was called outside measure.\");\r\n return this.scope.measureText(text, font.fontSize, font.fontFamily, font.fontWeight, font.letterSpacing);\r\n }\r\n}\r\n\r\n/** Reused every frame: `pass` and `cut` are rewritten before each render. */\r\nexport class RenderContextImpl implements RenderContext2D {\r\n pass: RenderPass2D | null = null;\r\n /** The near-plane cut a 2.5D space puts in front of this node's own paint. */\r\n cut: Clip | null = null;\r\n\r\n /**\r\n * `probing`: `render` runs only to find the shape it paints (for clip and\r\n * picking outside a frame), so nothing is drawn and no child is visited.\r\n */\r\n constructor(readonly host: ComponentHost, readonly probing = false) { }\r\n\r\n get size(): Size2D {\r\n const box = this.host.layoutBounds;\r\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\r\n }\r\n\r\n get time(): Clock {\r\n return this.host.time;\r\n }\r\n\r\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void {\r\n if (!graphics || this.probing) return;\r\n const out = this.target();\r\n if (Array.isArray(graphics)) for (const g of graphics) out.draw(g);\r\n else out.draw(graphics as Graphics2D);\r\n }\r\n\r\n children(): void {\r\n if (this.probing) return;\r\n // Drawn plainly, so a space or composite the last frame declared no longer holds for them.\r\n if (!this.composite) this.host._record = null;\r\n this.host._renderOwnChildren(this.target());\r\n }\r\n\r\n /** What this render has declared so far. Its host's record follows at once, so the children it draws see it. */\r\n composite: Composite | null = null;\r\n\r\n private _declare(composite: Composite): void {\r\n this.composite = { ...this.composite, ...composite };\r\n if (!this.probing) this.host._record = this.composite;\r\n }\r\n\r\n mask(options: MaskOptions): void {\r\n this._declare({ bounds: \"first\" });\r\n if (this.probing) return;\r\n const out = this.target();\r\n const [stencil, ...content] = this.host.children;\r\n if (!stencil) return;\r\n if (content.length === 0) {\r\n stencil.render(out);\r\n return;\r\n }\r\n out.beginMask({ mode: options.mode, inverted: options.inverted });\r\n stencil.render(out);\r\n out.applyMask();\r\n for (const child of content) child.render(out);\r\n out.endMask();\r\n }\r\n\r\n merge(op: BooleanOperation, paint: MergePaint): void {\r\n this._declare({ bounds: op === \"subtract\" ? \"first\" : op === \"intersect\" ? \"intersect\" : \"union\" });\r\n if (this.probing) return;\r\n const out = this.target();\r\n out.beginBoolean(op);\r\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\r\n out.endBoolean();\r\n // A drawing with no shape of its own paints the merged outline.\r\n out.draw(new GraphicsClass().shadow(paint.shadow).fill(paint.fill));\r\n if (paint.overlay && (paint.overlay as unknown[]).length > 0) out.draw(new GraphicsClass().fill(paint.overlay));\r\n out.draw(new GraphicsClass().stroke(paint.stroke));\r\n }\r\n\r\n /** Your children, through a camera viewing your box: aimed at `lookAt`, zoomed, turned by `heading`. */\r\n camera(scope: CameraScope): void {\r\n this._declare({ camera: scope });\r\n if (this.probing) return;\r\n const out = this.target();\r\n const rect = this.host.layoutBounds;\r\n out.beginCamera({ x: rect?.x ?? 0, y: -(rect?.y ?? 0), width: rect?.width ?? 0, height: rect?.height ?? 0 }, scope.lookAt, scope.zoom, scope.heading);\r\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\r\n out.endCamera();\r\n }\r\n\r\n /** Your 3D children, rendered in order into a new scene. */\r\n scene3D(): Scene3D {\r\n const scene = new Scene3D();\r\n for (const child of this.host._allChildren) if (child instanceof Node3D) child.render(scene);\r\n this._declare({ scene });\r\n return scene;\r\n }\r\n\r\n /** Your children, standing in one 2.5D space seen by `camera`, drawn far to near. */\r\n space(camera: SpaceCamera): void {\r\n this._declare({ space: camera });\r\n if (!this.probing) this.host._renderOwnChildren(this.target());\r\n }\r\n\r\n textStyle(style: TextStyle | null, body: () => void): void {\r\n if (this.probing) return body();\r\n const out = this.target();\r\n out.pushTextStyle(style);\r\n try {\r\n body();\r\n } finally {\r\n out.popTextStyle();\r\n }\r\n }\r\n\r\n clip(shape: Graphics2D, body: () => void): void {\r\n if (this.probing) return body();\r\n const outline = clipOf(shape);\r\n // No outline is no clip, as a node with no `clipSelf` confines nothing.\r\n if (outline.isEmpty()) return body();\r\n const out = this.target();\r\n out.beginClip(outline);\r\n try {\r\n body();\r\n } finally {\r\n out.endClip();\r\n }\r\n }\r\n\r\n /** An ancestor stands this node in a space: one opens it, and nothing between them flattens. */\r\n get inSpace(): boolean {\r\n for (let at = this.host.parent; at; at = at.parent) {\r\n if (!(at instanceof Node2DClass)) return false;\r\n if (at._spaceCamera()) return true;\r\n if (!at._rendersChildrenInSpace()) return false;\r\n }\r\n return false;\r\n }\r\n\r\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null {\r\n for (let at = this.host.parent; at; at = at.parent) {\r\n if (at instanceof component.node) return nodeView(at, this.host) as unknown as NodeView<Element<K, S, C>>;\r\n }\r\n return null;\r\n }\r\n\r\n /** Paint `body` in front of the space's near plane, as `Node2D` does for its own paint. */\r\n inFront(body: () => void): void {\r\n if (this.probing) return;\r\n const out = this.target();\r\n if (!this.cut) {\r\n body();\r\n return;\r\n }\r\n out.beginClip(this.cut);\r\n try {\r\n body();\r\n } finally {\r\n out.endClip();\r\n }\r\n }\r\n\r\n target(): RenderPass2D {\r\n if (this.probing) return PROBE_PASS;\r\n if (!this.pass) throw new Error(\"A component's render context was used outside render.\");\r\n return this.pass;\r\n }\r\n}\r\n\r\n/** Where a probe's scoped calls (a clip, a camera) land: a pass that draws nothing. */\r\nconst PROBE_PASS: RenderPass2D = new NullRenderContext();\r\n\r\nexport function internalsOf(ctx: RenderContext2D): RenderContextImpl {\r\n if (!(ctx instanceof RenderContextImpl)) throw new TypeError(\"Paint.draw takes the render context its render field was given.\");\r\n return ctx;\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,OAAO,CAAC,IAAgB;QACpB,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACZ,IAAI,EAAE,CAAC;YACP,OAAO;QACX,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC;YACD,IAAI,EAAE,CAAC;QACX,CAAC;gBAAS,CAAC;YACP,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAED,uFAAuF;AACvF,MAAM,UAAU,GAAiB,IAAI,iBAAiB,EAAE,CAAC;AAEzD,MAAM,UAAU,WAAW,CAAC,GAAoB;IAC5C,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAiB,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,iEAAiE,CAAC,CAAC;IAChI,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { SizeConstraints } from \"@/layout/constraints\";\nimport type { Node2D, CameraScope } from \"@/components/trees/2d/node2d\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { Graphics2D } from \"@/render/graphics2d\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { RenderPass2D } from \"@/render/render-context2d\";\nimport type { Clip } from \"@/render/clip\";\nimport { NullRenderContext } from \"@/render/null-render-context\";\nimport { Graphics2D as GraphicsClass } from \"@/render/graphics2d\";\nimport { frameIn, Node2D as Node2DClass } from \"@/components/trees/2d/node2d\";\nimport { Node3D } from \"@/components/trees/three/node3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\nimport type { ChildBoundsMode } from \"@/components/trees/2d/group-bounds\";\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\nimport type { TextStyle } from \"@/attributes/text/types\";\nimport type { MergePaint, ChildView, Clock, Component, Element, FontSpec, Max, Measurer, NodeFrame, NodeView, Piece, RenderContext2D } from \"@/components/factory/api\";\nimport { clipOf } from \"@/components/factory/clip-of\";\n\n/**\n * What a render did with its children beyond drawing them: composited them\n * (the ink bounds that leaves), looked at them through a camera, or stood them\n * in a 2.5D space. Picking and the space machinery read it between frames.\n */\nexport interface Composite {\n readonly bounds?: ChildBoundsMode;\n readonly camera?: CameraScope;\n readonly space?: SpaceCamera;\n /** The scene its 3D children were rendered into: what picking projects through. */\n readonly scene?: Scene3D;\n}\n\n/** The node a view stands for: how the engine's own modules (`Paint`, `Flow`) reach past the public surface. */\nexport const NODE = Symbol(\"componentNode\");\n\n/** What a generated node exposes to its views and modules. Never part of the authoring surface. */\nexport interface ComponentHost extends Node2D {\n _renderOwnChildren(pass: RenderPass2D): void;\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\n _lastShape: Graphics2D | null;\n /** The composite its last render or probe declared; `undefined` before either. */\n _record: Composite | null | undefined;\n}\n\n// ---- the pass in progress -------------------------------------------------\n\n/**\n * Measure and layout run synchronously, one node at a time, so the node being\n * laid out and its measurer are a single slot rather than state on every view.\n */\ninterface Pass {\n readonly node: Node2D;\n readonly scope: MeasureContext2D;\n readonly room: Max;\n readonly sizes: Map<Node2D, Size2D>;\n}\n\nlet pass: Pass | null = null;\n\nexport function withPass<T>(node: Node2D, scope: MeasureContext2D, room: Max, run: () => T): T {\n const outer = pass;\n pass = { node, scope, room, sizes: new Map() };\n try {\n return run();\n } finally {\n pass = outer;\n }\n}\n\nconst decided = new WeakSet<Node2D>();\n\n/** An engine module sized this node itself in this measure: its factory reports the size as it stands. */\nexport function markDecided(node: Node2D): void {\n decided.add(node);\n}\n\nexport function takeDecided(node: Node2D): boolean {\n return decided.delete(node);\n}\n\nexport function currentPass(): Pass {\n if (!pass) throw new Error(\"A component's measure or layout helper ran outside a measure or layout pass.\");\n return pass;\n}\n\nfunction measureChild(node: Node2D, max: Max): Size2D {\n const p = currentPass();\n const constraints: SizeConstraints = { maxWidth: max.width, maxHeight: max.height };\n const measured = node.measure(constraints, p.scope);\n const size = { width: measured.width ?? 0, height: measured.height ?? 0 };\n p.sizes.set(node, size);\n return size;\n}\n\n// ---- child views ------------------------------------------------------------\n\nconst childViews = new WeakMap<Node2D, ChildViewImpl>();\n\n/** A child as its parent's fields see it. One per child node, reused every frame. */\nclass ChildViewImpl implements ChildView {\n readonly [NODE]: Node2D;\n readonly state: never;\n\n constructor(node: Node2D) {\n this[NODE] = node;\n // The node's own accessors are its resolved values; a proxy keeps a parent from writing through them.\n this.state = new Proxy(node, {\n set: () => { throw new TypeError(\"A child's state is read-only to its parent; animate it with a command.\"); },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE]) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n // Outside a pass (a command being built), the size it was last laid out at, as a command's own node reports.\n if (!pass) {\n const box = this[NODE].layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n return pass.sizes.get(this[NODE]) ?? measureChild(this[NODE], pass.room);\n }\n\n get children(): readonly ChildView[] {\n const node = this[NODE] as Node2D & { _commandChildren?(): readonly ChildView[] };\n return node._commandChildren ? node._commandChildren() : node.children.map(childView);\n }\n\n measure(max: Max): Size2D {\n return measureChild(this[NODE], max);\n }\n\n to(targets: object): Piece {\n return { _piece: { kind: \"child\", node: this[NODE], targets: targets as Record<string, unknown> } };\n }\n\n run(name: string, args?: object): Piece {\n return { _piece: { kind: \"run\", node: this[NODE], name, args } };\n }\n}\n\nexport function childView(node: Node2D | Node): ChildView {\n let view = childViews.get(node as Node2D);\n if (!view) childViews.set(node as Node2D, view = new ChildViewImpl(node as Node2D));\n return view as unknown as ChildView;\n}\n\nexport function nodeOfView(view: ChildView<any>): Node2D {\n return (view as unknown as ChildViewImpl)[NODE];\n}\n\nconst nodeViews = new WeakMap<Node, WeakMap<Node, NodeViewImpl>>();\n\nconst NO_FRAME: NodeFrame = { x: 0, y: 0, rotation: 0, scale: 1 };\n\n/** A node outside a component's own children (an ancestor, a referenced node), as one reader's fields read it. */\nclass NodeViewImpl implements NodeView {\n readonly [NODE]: Node;\n readonly state: never;\n\n constructor(node: Node, readonly reader: Node) {\n this[NODE] = node;\n // A component's state as its own fields read it: a reference of its own is a view from where it stands.\n // Anything else it has (a 2D node's cardinal points) reads off the node.\n const fields = (node as { _view?: object })._view ?? node;\n this.state = new Proxy(fields, {\n get: (target, key) => {\n // Its constructor is the node's: what a host asks to tell what kind of node it reads.\n if (key === \"constructor\") return node.constructor;\n if (key in target) return Reflect.get(target, key);\n const value = Reflect.get(node, key) as unknown;\n // A method of the node runs on the node, not on this read-only view.\n return typeof value === \"function\" ? (value as (...args: unknown[]) => unknown).bind(node) : value;\n },\n set: () => { throw new TypeError(\"Another node's state is read-only to a component; animate it with a command.\"); },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE] as Node2D) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n const node = this[NODE];\n const box = node instanceof Node2DClass ? node.layoutBounds : undefined;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get frame(): NodeFrame {\n const node = this[NODE];\n return node instanceof Node2DClass && this.reader instanceof Node2DClass ? frameIn(this.reader, node) : NO_FRAME;\n }\n}\n\n/** `node` as `reader` sees it. One view per pair. */\nexport function nodeView(node: Node, reader: Node): NodeView {\n let byReader = nodeViews.get(node);\n if (!byReader) nodeViews.set(node, byReader = new WeakMap());\n let view = byReader.get(reader);\n if (!view) byReader.set(reader, view = new NodeViewImpl(node, reader));\n return view;\n}\n\nexport function nodeOfNodeView(view: NodeView): Node {\n return (view as unknown as NodeViewImpl)[NODE];\n}\n\nconst found = new WeakMap<Node, Map<string, Node>>();\n\n/** The node with `id` in `reader`'s scene, as `reader` sees it, or `null`. Remembered per reader while it stays in the scene. */\nexport function referenced(reader: Node, id: unknown): NodeView | null {\n if (typeof id !== \"string\" || id === \"\") return null;\n let known = found.get(reader);\n let node = known?.get(id);\n if (!node || node.id !== id || rootOf(node) !== rootOf(reader)) {\n node = findIn(rootOf(reader), id) ?? undefined;\n if (!node) {\n known?.delete(id);\n return null;\n }\n if (!known) found.set(reader, known = new Map());\n known.set(id, node);\n }\n return nodeView(node, reader);\n}\n\nfunction rootOf(node: Node): Node {\n let at = node;\n while (at.parent) at = at.parent;\n return at;\n}\n\nfunction findIn(at: Node, id: string): Node | null {\n if (at.id === id) return at;\n for (const child of at._allChildren) {\n const hit = findIn(child, id);\n if (hit) return hit;\n }\n return null;\n}\n\nlet keyOf: (node: Node2D) => string | undefined = () => undefined;\n/** Set by the factory module, which owns the node descriptors. */\nexport function setKeyLookup(lookup: (node: Node2D) => string | undefined): void {\n keyOf = lookup;\n}\n\n// ---- state views ------------------------------------------------------------\n\n/**\n * One prototype of getters per component, so a node's `state` is a single\n * object made once: every read goes straight to the node's own slot, and a\n * frame allocates nothing to hand its fields their values.\n */\nexport interface ViewShape {\n readonly proto: object;\n /** Own, so `{ ...state }` copies every entry; the getters themselves are shared. */\n readonly entries: PropertyDescriptorMap;\n}\n\nexport function stateViewPrototype(keys: readonly string[], references: ReadonlySet<string> = new Set()): ViewShape {\n const entries: PropertyDescriptorMap = {};\n for (const key of keys) {\n entries[key] = references.has(key)\n ? { get(this: { [NODE]: Node }) { return referenced(this[NODE], (this[NODE] as unknown as Record<string, unknown>)[key]); }, enumerable: true }\n : { get(this: { [NODE]: object }) { return (this[NODE] as Record<string, unknown>)[key]; }, enumerable: true };\n }\n const proto = {};\n // The children of the node's own tree, as its commands see them too.\n Object.defineProperty(proto, \"children\", {\n get(this: { [NODE]: { _commandChildren(): readonly ChildView[] } }) { return this[NODE]._commandChildren(); },\n enumerable: false,\n });\n return { proto, entries };\n}\n\nexport function stateView(shape: ViewShape, node: object): object {\n const view = Object.create(shape.proto) as { [NODE]: object };\n Object.defineProperties(view, shape.entries);\n view[NODE] = node;\n return view;\n}\n\n/** A command's `state`: where it starts, so a frame function reading it never sees its own writes. */\nexport function snapshot(view: object): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key in view) out[key] = (view as Record<string, unknown>)[key];\n return out;\n}\n\n// ---- measurer and render context --------------------------------------------\n\nexport class MeasurerImpl implements Measurer {\n max: Max = {};\n scope: MeasureContext2D | null = null;\n\n constructor(readonly host: Node) { }\n\n get time(): Clock {\n return this.host.time;\n }\n\n text(text: string, font: FontSpec): Size2D {\n if (!this.scope) throw new Error(\"measurer.text was called outside measure.\");\n return this.scope.measureText(text, font.fontSize, font.fontFamily, font.fontWeight, font.letterSpacing);\n }\n}\n\n/** Reused every frame: `pass` and `cut` are rewritten before each render. */\nexport class RenderContextImpl implements RenderContext2D {\n pass: RenderPass2D | null = null;\n /** The near-plane cut a 2.5D space puts in front of this node's own paint. */\n cut: Clip | null = null;\n\n /**\n * `probing`: `render` runs only to find the shape it paints (for clip and\n * picking outside a frame), so nothing is drawn and no child is visited.\n */\n constructor(readonly host: ComponentHost, readonly probing = false) { }\n\n get size(): Size2D {\n const box = this.host.layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get time(): Clock {\n return this.host.time;\n }\n\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void {\n if (!graphics || this.probing) return;\n const out = this.target();\n if (Array.isArray(graphics)) for (const g of graphics) out.draw(g);\n else out.draw(graphics as Graphics2D);\n }\n\n children(): void {\n if (this.probing) return;\n // Drawn plainly, so a space or composite the last frame declared no longer holds for them.\n if (!this.composite) this.host._record = null;\n this.host._renderOwnChildren(this.target());\n }\n\n /** What this render has declared so far. Its host's record follows at once, so the children it draws see it. */\n composite: Composite | null = null;\n\n private _declare(composite: Composite): void {\n this.composite = { ...this.composite, ...composite };\n if (!this.probing) this.host._record = this.composite;\n }\n\n mask(options: MaskOptions): void {\n this._declare({ bounds: \"first\" });\n if (this.probing) return;\n const out = this.target();\n const [stencil, ...content] = this.host.children;\n if (!stencil) return;\n if (content.length === 0) {\n stencil.render(out);\n return;\n }\n out.beginMask({ mode: options.mode, inverted: options.inverted });\n stencil.render(out);\n out.applyMask();\n for (const child of content) child.render(out);\n out.endMask();\n }\n\n merge(op: BooleanOperation, paint: MergePaint): void {\n this._declare({ bounds: op === \"subtract\" ? \"first\" : op === \"intersect\" ? \"intersect\" : \"union\" });\n if (this.probing) return;\n const out = this.target();\n out.beginBoolean(op);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endBoolean();\n // A drawing with no shape of its own paints the merged outline.\n out.draw(new GraphicsClass().shadow(paint.shadow).fill(paint.fill));\n if (paint.overlay && (paint.overlay as unknown[]).length > 0) out.draw(new GraphicsClass().fill(paint.overlay));\n out.draw(new GraphicsClass().stroke(paint.stroke));\n }\n\n /** Your children, through a camera viewing your box: aimed at `lookAt`, zoomed, turned by `heading`. */\n camera(scope: CameraScope): void {\n this._declare({ camera: scope });\n if (this.probing) return;\n const out = this.target();\n const rect = this.host.layoutBounds;\n out.beginCamera({ x: rect?.x ?? 0, y: -(rect?.y ?? 0), width: rect?.width ?? 0, height: rect?.height ?? 0 }, scope.lookAt, scope.zoom, scope.heading);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endCamera();\n }\n\n /** Your 3D children, rendered in order into a new scene. */\n scene3D(): Scene3D {\n const scene = new Scene3D();\n for (const child of this.host._allChildren) if (child instanceof Node3D) child.render(scene);\n this._declare({ scene });\n return scene;\n }\n\n /** Your children, standing in one 2.5D space seen by `camera`, drawn far to near. */\n space(camera: SpaceCamera): void {\n this._declare({ space: camera });\n if (!this.probing) this.host._renderOwnChildren(this.target());\n }\n\n textStyle(style: TextStyle | null, body: () => void): void {\n if (this.probing) return body();\n const out = this.target();\n out.pushTextStyle(style);\n try {\n body();\n } finally {\n out.popTextStyle();\n }\n }\n\n clip(shape: Graphics2D, body: () => void): void {\n if (this.probing) return body();\n const outline = clipOf(shape);\n // No outline is no clip, as a node with no `clipSelf` confines nothing.\n if (outline.isEmpty()) return body();\n const out = this.target();\n out.beginClip(outline);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n /** An ancestor stands this node in a space: one opens it, and nothing between them flattens. */\n get inSpace(): boolean {\n for (let at = this.host.parent; at; at = at.parent) {\n if (!(at instanceof Node2DClass)) return false;\n if (at._spaceCamera()) return true;\n if (!at._rendersChildrenInSpace()) return false;\n }\n return false;\n }\n\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null {\n for (let at = this.host.parent; at; at = at.parent) {\n if (at instanceof component.node) return nodeView(at, this.host) as unknown as NodeView<Element<K, S, C>>;\n }\n return null;\n }\n\n /** Paint `body` in front of the space's near plane, as `Node2D` does for its own paint. */\n inFront(body: () => void): void {\n if (this.probing) return;\n const out = this.target();\n if (!this.cut) {\n body();\n return;\n }\n out.beginClip(this.cut);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n target(): RenderPass2D {\n if (this.probing) return PROBE_PASS;\n if (!this.pass) throw new Error(\"A component's render context was used outside render.\");\n return this.pass;\n }\n}\n\n/** Where a probe's scoped calls (a clip, a camera) land: a pass that draws nothing. */\nconst PROBE_PASS: RenderPass2D = new NullRenderContext();\n\nexport function internalsOf(ctx: RenderContext2D): RenderContextImpl {\n if (!(ctx instanceof RenderContextImpl)) throw new TypeError(\"Paint.draw takes the render context its render field was given.\");\n return ctx;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"aim.js","sourceRoot":"","sources":["../../../src/components/modules/aim.ts"],"names":[],"mappings":"A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AAE,CAAW;IACjD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IAC7B,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,IAAI,YAAY,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IACvF,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IACxB,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,MAAM,CAAC,GAAoB,EAAE,CAAW;IACpD,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,MAAM,CAAC,IAAU,EAAE,QAAc;IACtC,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM;QAAE,IAAI,EAAE,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;IAChF,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { lerpVector2, type Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Node2D } from \"@/components/trees/2d/node2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { RenderContext2D, Values } from \"@/components/factory/api\";\r\nimport { commandsFor } from \"@/components/factory/commands-for\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport { internalsOf, nodeOfNodeView } from \"@/components/factory/views\";\r\n\r\n/** Where a 2D camera looks: a point, a zoom and a heading, or a node below it to follow. */\r\nexport const state = {\r\n zoom: Types.number(1, { min: 0.01, step: 0.1, unit: \"×\" }),\r\n lookAt: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2, kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" } } }),\r\n heading: Types.number(0, { step: 1, unit: \"°\" }),\r\n follow: Types.nodeRef(),\r\n};\r\n\r\nexport const commands = commandsFor(state, {\r\n zoomTo: { args: [\"zoom\"] },\r\n panTo: { args: [\"lookAt\"] },\r\n headingTo: { args: [\"heading\"] },\r\n});\r\n\r\ntype AimState = Values<typeof state>;\r\n\r\n/** The point the camera centres on: `lookAt`, offset from the followed node when there is one below it. */\r\nexport function aim(ctx: RenderContext2D, s: AimState): Vector2 {\r\n const target = s.follow;\r\n if (!target) return s.lookAt;\r\n const node = nodeOfNodeView(target);\r\n if (!(node instanceof Node2D) || !within(node, internalsOf(ctx).host)) return s.lookAt;\r\n const at = target.frame;\r\n return { x: at.x + s.lookAt.x, y: at.y + s.lookAt.y };\r\n}\r\n\r\n/** The children, through this camera. */\r\nexport function camera(ctx: RenderContext2D, s: AimState): void {\r\n ctx.camera({ lookAt: aim(ctx, s), zoom: s.zoom, heading: s.heading });\r\n}\r\n\r\nfunction within(node: Node, ancestor: Node): boolean {\r\n for (let at = node.parent; at; at = at.parent) if (at === ancestor) return true;\r\n return false;\r\n}\r\n"]}
1
+ {"version":3,"file":"aim.js","sourceRoot":"","sources":["../../../src/components/modules/aim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,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pC,IAAI,CAAC,CAAC,IAAI,YAAY,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IACvF,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IACxB,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,MAAM,CAAC,GAAoB,EAAE,CAAW;IACpD,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,MAAM,CAAC,IAAU,EAAE,QAAc;IACtC,KAAK,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM;QAAE,IAAI,EAAE,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;IAChF,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { lerpVector2, type Vector2 } from \"@/attributes/layout/vector2\";\nimport { Node2D } from \"@/components/trees/2d/node2d\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { RenderContext2D, Values } from \"@/components/factory/api\";\nimport { commandsFor } from \"@/components/factory/commands-for\";\nimport { Types } from \"@/components/factory/types\";\nimport { internalsOf, nodeOfNodeView } from \"@/components/factory/views\";\n\n/** Where a 2D camera looks: a point, a zoom and a heading, or a node below it to follow. */\nexport const state = {\n zoom: Types.number(1, { min: 0.01, step: 0.1, unit: \"×\" }),\n lookAt: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2, kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" } } }),\n heading: Types.number(0, { step: 1, unit: \"°\" }),\n follow: Types.nodeRef(),\n};\n\nexport const commands = commandsFor(state, {\n zoomTo: { args: [\"zoom\"] },\n panTo: { args: [\"lookAt\"] },\n headingTo: { args: [\"heading\"] },\n});\n\ntype AimState = Values<typeof state>;\n\n/** The point the camera centres on: `lookAt`, offset from the followed node when there is one below it. */\nexport function aim(ctx: RenderContext2D, s: AimState): Vector2 {\n const target = s.follow;\n if (!target) return s.lookAt;\n const node = nodeOfNodeView(target);\n if (!(node instanceof Node2D) || !within(node, internalsOf(ctx).host)) return s.lookAt;\n const at = target.frame;\n return { x: at.x + s.lookAt.x, y: at.y + s.lookAt.y };\n}\n\n/** The children, through this camera. */\nexport function camera(ctx: RenderContext2D, s: AimState): void {\n ctx.camera({ lookAt: aim(ctx, s), zoom: s.zoom, heading: s.heading });\n}\n\nfunction within(node: Node, ancestor: Node): boolean {\n for (let at = node.parent; at; at = at.parent) if (at === ancestor) return true;\n return false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"corners.js","sourceRoot":"","sources":["../../../src/components/modules/corners.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAkB,MAAM,4BAA4B,CAAC;AAEnE,6HAA6H;AAC7H,MAAM,CAAC,MAAM,KAAK,GAAsI;IACpJ,YAAY,EAAE,KAAK,CAAC,YAAY;IAChC,WAAW,EAAE,KAAK,CAAC,WAAW;CACjC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,CAAuB;IACtD,OAAO,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACvI,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { CornerRadiusResolved, RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport type { CornerStyleResolved, RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { Values } from \"@/components/factory/api\";\r\nimport { Types, type Attribute } from \"@/components/factory/types\";\r\n\r\n// Typed out so the declarations name what the corners take by their own modules: a kit's emit reaches those through the sdk.\r\nexport const state: { cornerRadius: Attribute<RectCornerRadius, CornerRadiusResolved>; cornerStyle: Attribute<RectCornerStyle, CornerStyleResolved> } = {\r\n cornerRadius: Types.cornerRadius,\r\n cornerStyle: Types.cornerStyle,\r\n};\r\n\r\n/** A rectangle the size of the box, with these corners. */\r\nexport function rect(size: Size2D, s: Values<typeof state>): Graphics2D {\r\n return new Graphics2D().rect({ width: size.width, height: size.height, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle });\r\n}\r\n"]}
1
+ {"version":3,"file":"corners.js","sourceRoot":"","sources":["../../../src/components/modules/corners.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAkB,MAAM,4BAA4B,CAAC;AAEnE,6HAA6H;AAC7H,MAAM,CAAC,MAAM,KAAK,GAAsI;IACpJ,YAAY,EAAE,KAAK,CAAC,YAAY;IAChC,WAAW,EAAE,KAAK,CAAC,WAAW;CACjC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,CAAuB;IACtD,OAAO,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACvI,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { CornerRadiusResolved, RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport type { CornerStyleResolved, RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport type { Values } from \"@/components/factory/api\";\nimport { Types, type Attribute } from \"@/components/factory/types\";\n\n// Typed out so the declarations name what the corners take by their own modules: a kit's emit reaches those through the sdk.\nexport const state: { cornerRadius: Attribute<RectCornerRadius, CornerRadiusResolved>; cornerStyle: Attribute<RectCornerStyle, CornerStyleResolved> } = {\n cornerRadius: Types.cornerRadius,\n cornerStyle: Types.cornerStyle,\n};\n\n/** A rectangle the size of the box, with these corners. */\nexport function rect(size: Size2D, s: Values<typeof state>): Graphics2D {\n return new Graphics2D().rect({ width: size.width, height: size.height, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flow.js","sourceRoot":"","sources":["../../../src/components/modules/flow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,OAAO,EAAE,KAAK,EAAkB,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAErE,sEAAsE;AACtE,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAyB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC9E,GAAG,EAAE,KAAK,CAAC,MAAM,CAAU,CAAC,CAAC;IAC7B,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,KAAK,CAAC,MAAM,CAA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CAAiB,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YAC3D,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,KAAK,KAAK;SACvG,EAAE,KAAK,CAAC,CAAC;IACd,gGAAgG;IAChG,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAiB,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM;KACvE,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport { insetsOps } from \"@/attributes/layout/insets\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { BoxBounds } from \"@/layout/bounds\";\r\nimport { flowOps } from \"@/layout/ops\";\r\nimport type { FlowMeasure, FlowMode, FlowResolved, FlowSettings, GapSize } from \"@/layout/types\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\nimport type { ChildView, Measurer, Placement2D, Values } from \"@/components/factory/api\";\r\nimport { Types, type Attribute } from \"@/components/factory/types\";\r\nimport { currentPass, nodeOfView } from \"@/components/factory/views\";\r\n\r\n/** The Rect layout engine: freeform, runs, wrapped runs and grids. */\r\nexport const state = {\r\n flow: Types.custom<FlowMode, FlowResolved>(\"freeform\", { lerp: flowOps.lerp }),\r\n gap: Types.custom<GapSize>(0),\r\n wrap: false,\r\n crossGap: Types.custom<number | undefined>(undefined),\r\n columns: Types.number(1),\r\n // Typed out so the declarations name Alignment by its own module: a kit's emit reaches it through the sdk.\r\n align: Types.alignment as Attribute<Alignment, Vector2>,\r\n};\r\n\r\nexport type FlowState = Values<typeof state> & {\r\n readonly padding: InsetsResolved;\r\n readonly width: import(\"@/attributes/layout/size\").SizeInput;\r\n readonly height: import(\"@/attributes/layout/size\").SizeInput;\r\n};\r\n\r\nconst NO_CONTENT: Size2D = { width: 0, height: 0 };\r\n\r\n/** The measure a container took, kept for its layout in the same pass (as `Node2D` keeps its own). */\r\nconst pending = new WeakMap<Node2D, FlowMeasure<Node2D>>();\r\n\r\nfunction padded(s: FlowState, inset: InsetsResolved | undefined): InsetsResolved {\r\n const p = s.padding;\r\n if (!inset) return p;\r\n return { left: p.left + inset.left, right: p.right + inset.right, top: p.top + inset.top, bottom: p.bottom + inset.bottom };\r\n}\r\n\r\n/** `inset` is room the children must clear beyond `padding`: a stroke, say. */\r\nexport function measure(measurer: Measurer, s: FlowState, children: readonly ChildView<any>[], inset?: InsetsResolved): Size2D {\r\n const { node, scope } = currentPass();\r\n const padding = padded(s, inset);\r\n const constraints = { maxWidth: measurer.max.width, maxHeight: measurer.max.height };\r\n if (children.length === 0) {\r\n pending.delete(node);\r\n return flowOps.size(s, constraints, padding, NO_CONTENT);\r\n }\r\n const space = flowOps.contentBox(s, constraints, padding);\r\n const measured = flowOps.measure(s as FlowSettings, children.map(nodeOfView), space, scope);\r\n pending.set(node, measured);\r\n return flowOps.size(s, constraints, padding, measured.hug);\r\n}\r\n\r\nexport function layout(box: BoxBounds, s: FlowState, children: readonly ChildView<any>[], inset?: InsetsResolved): readonly Placement2D[] {\r\n const { node, scope } = currentPass();\r\n const kept = pending.get(node);\r\n pending.delete(node);\r\n const inner = insetsOps.insetBounds(box.width, box.height, padded(s, inset));\r\n // Where a child that is not here yet would land: a host dropping one in asks.\r\n node._childSpace = { settings: { flow: s.flow, align: s.align }, inner };\r\n if (children.length === 0) return [];\r\n const measured = kept && flowOps.reusable(kept, inner)\r\n ? kept\r\n : flowOps.measure(s as FlowSettings, children.map(nodeOfView), {\r\n width: inner.width, height: inner.height, hugWidth: s.width === \"hug\", hugHeight: s.height === \"hug\",\r\n }, scope);\r\n // `place` answers y-up from the content box's centre; a placement is y-up from the component's.\r\n return flowOps.place(measured, s as FlowSettings, inner).map((b) => ({\r\n x: inner.x + b.x, y: b.y - inner.y, width: b.width, height: b.height,\r\n }));\r\n}\r\n"]}
1
+ {"version":3,"file":"flow.js","sourceRoot":"","sources":["../../../src/components/modules/flow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,OAAO,EAAE,KAAK,EAAkB,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAErE,sEAAsE;AACtE,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAyB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC9E,GAAG,EAAE,KAAK,CAAC,MAAM,CAAU,CAAC,CAAC;IAC7B,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAqB,SAAS,CAAC;IACrD,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACxB,2GAA2G;IAC3G,KAAK,EAAE,KAAK,CAAC,SAA0C;CAC1D,CAAC;AAQF,MAAM,UAAU,GAAW,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEnD,sGAAsG;AACtG,MAAM,OAAO,GAAG,IAAI,OAAO,EAA+B,CAAC;AAE3D,SAAS,MAAM,CAAC,CAAY,EAAE,KAAiC;IAC3D,MAA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AAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM;KACvE,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { InsetsResolved } from \"@/attributes/layout/insets\";\nimport { insetsOps } from \"@/attributes/layout/insets\";\nimport type { Size2D } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { BoxBounds } from \"@/layout/bounds\";\nimport { flowOps } from \"@/layout/ops\";\nimport type { FlowMeasure, FlowMode, FlowResolved, FlowSettings, GapSize } from \"@/layout/types\";\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\nimport type { ChildView, Measurer, Placement2D, Values } from \"@/components/factory/api\";\nimport { Types, type Attribute } from \"@/components/factory/types\";\nimport { currentPass, nodeOfView } from \"@/components/factory/views\";\n\n/** The Rect layout engine: freeform, runs, wrapped runs and grids. */\nexport const state = {\n flow: Types.custom<FlowMode, FlowResolved>(\"freeform\", { lerp: flowOps.lerp }),\n gap: Types.custom<GapSize>(0),\n wrap: false,\n crossGap: Types.custom<number | undefined>(undefined),\n columns: Types.number(1),\n // Typed out so the declarations name Alignment by its own module: a kit's emit reaches it through the sdk.\n align: Types.alignment as Attribute<Alignment, Vector2>,\n};\n\nexport type FlowState = Values<typeof state> & {\n readonly padding: InsetsResolved;\n readonly width: import(\"@/attributes/layout/size\").SizeInput;\n readonly height: import(\"@/attributes/layout/size\").SizeInput;\n};\n\nconst NO_CONTENT: Size2D = { width: 0, height: 0 };\n\n/** The measure a container took, kept for its layout in the same pass (as `Node2D` keeps its own). */\nconst pending = new WeakMap<Node2D, FlowMeasure<Node2D>>();\n\nfunction padded(s: FlowState, inset: InsetsResolved | undefined): InsetsResolved {\n const p = s.padding;\n if (!inset) return p;\n return { left: p.left + inset.left, right: p.right + inset.right, top: p.top + inset.top, bottom: p.bottom + inset.bottom };\n}\n\n/** `inset` is room the children must clear beyond `padding`: a stroke, say. */\nexport function measure(measurer: Measurer, s: FlowState, children: readonly ChildView<any>[], inset?: InsetsResolved): Size2D {\n const { node, scope } = currentPass();\n const padding = padded(s, inset);\n const constraints = { maxWidth: measurer.max.width, maxHeight: measurer.max.height };\n if (children.length === 0) {\n pending.delete(node);\n return flowOps.size(s, constraints, padding, NO_CONTENT);\n }\n const space = flowOps.contentBox(s, constraints, padding);\n const measured = flowOps.measure(s as FlowSettings, children.map(nodeOfView), space, scope);\n pending.set(node, measured);\n return flowOps.size(s, constraints, padding, measured.hug);\n}\n\nexport function layout(box: BoxBounds, s: FlowState, children: readonly ChildView<any>[], inset?: InsetsResolved): readonly Placement2D[] {\n const { node, scope } = currentPass();\n const kept = pending.get(node);\n pending.delete(node);\n const inner = insetsOps.insetBounds(box.width, box.height, padded(s, inset));\n // Where a child that is not here yet would land: a host dropping one in asks.\n node._childSpace = { settings: { flow: s.flow, align: s.align }, inner };\n if (children.length === 0) return [];\n const measured = kept && flowOps.reusable(kept, inner)\n ? kept\n : flowOps.measure(s as FlowSettings, children.map(nodeOfView), {\n width: inner.width, height: inner.height, hugWidth: s.width === \"hug\", hugHeight: s.height === \"hug\",\n }, scope);\n // `place` answers y-up from the content box's centre; a placement is y-up from the component's.\n return flowOps.place(measured, s as FlowSettings, inner).map((b) => ({\n x: inner.x + b.x, y: b.y - inner.y, width: b.width, height: b.height,\n }));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"material.js","sourceRoot":"","sources":["../../../src/components/modules/material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAA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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAe,CAAC;IAC5G,MAAM,QAAQ,GAA4B,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC7D,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1D,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;QAAE,QAAQ,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,WAAW;QAAE,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChF,OAAO,QAAiC,CAAC;AAC7C,CAAC","sourcesContent":["import { lerpFill3D, resolveFill3D, type Fill3D } from \"@/render3d/fill3d\";\r\nimport type { Geometry3D } from \"@/render3d/geometry\";\r\nimport { Graphics3D, resolveMaterialShorthand3D, type MaterialShorthand3D } from \"@/render3d/graphics3d\";\r\nimport type { Material3D, Shading3D } from \"@/render3d/material\";\r\nimport type { Texture3D } from \"@/render3d/texture\";\r\nimport type { Blend3D, Faces3D } from \"@/render3d/transform\";\r\nimport type { Values } from \"@/components/factory/api\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport { optional, optionalColor } from \"@/components/modules/three-entries\";\r\n\r\n/** `Mesh3D`'s surface: a material, or the shorthand entries one is built from. */\r\nexport const state = {\r\n material: optional<Material3D | readonly Material3D[]>(),\r\n fill: Types.custom<Fill3D>(\"white\", { lerp: lerpFill3D }),\r\n opacity: optional<number>(),\r\n roughness: optional<number>(),\r\n metalness: optional<number>(),\r\n emission: optionalColor(),\r\n emissionStrength: optional<number>(),\r\n normalMap: optional<Texture3D>(),\r\n roughnessMap: optional<Texture3D>(),\r\n metalnessMap: optional<Texture3D>(),\r\n aoMap: optional<Texture3D>(),\r\n alphaMap: optional<Texture3D>(),\r\n envMapIntensity: optional<number>(),\r\n wireframe: optional<boolean>(),\r\n shading: optional<Shading3D>(),\r\n faces: optional<Faces3D>(),\r\n vertexColors: optional<boolean>(),\r\n blend: optional<Blend3D>(),\r\n unlit: Types.custom(false),\r\n};\r\n\r\ntype MaterialState = Values<typeof state>;\r\n\r\nconst SHORTHAND_KEYS = [\r\n \"opacity\", \"roughness\", \"metalness\",\r\n \"emission\", \"emissionStrength\", \"normalMap\", \"roughnessMap\",\r\n \"metalnessMap\", \"aoMap\", \"alphaMap\", \"envMapIntensity\", \"wireframe\",\r\n \"shading\", \"faces\", \"vertexColors\", \"blend\",\r\n] as const;\r\n\r\n/** The entries that are set, as a material shorthand. */\r\nexport function shorthand(s: MaterialState): MaterialShorthand3D {\r\n const out: Record<string, unknown> = {};\r\n if (s.material !== undefined) out.material = s.material;\r\n if (s.fill !== undefined) out.fill = s.fill;\r\n for (const key of SHORTHAND_KEYS) if (s[key] !== undefined) out[key] = s[key];\r\n if (s.unlit) out.unlit = true;\r\n return out as MaterialShorthand3D;\r\n}\r\n\r\n/** `geometry` with this surface; nothing without one. */\r\nexport function mesh(s: MaterialState, geometry: Geometry3D | undefined): Graphics3D {\r\n const g3 = new Graphics3D();\r\n if (geometry) g3.mesh(geometry, resolveMaterialShorthand3D(shorthand(s)));\r\n return g3;\r\n}\r\n\r\n/** The one material instanced copies share: the first, when the shorthand resolves to several. */\r\nexport function single(s: MaterialState): Material3D {\r\n const resolved = resolveMaterialShorthand3D(shorthand(s));\r\n return (Array.isArray(resolved) ? resolved[0] : resolved) as Material3D;\r\n}\r\n\r\nconst POINTS_KEYS = [\"opacity\", \"alphaMap\", \"blend\", \"vertexColors\"] as const;\r\n\r\n/** A points material: the given one, or the fill's colour and map with what a point cloud reads. */\r\nexport function points(s: MaterialState): Material3D {\r\n if (s.material !== undefined) return (Array.isArray(s.material) ? s.material[0] : s.material) as Material3D;\r\n const material: Record<string, unknown> = { type: \"points\" };\r\n const fill = resolveFill3D(s.fill);\r\n if (fill.color !== undefined) material.color = fill.color;\r\n if (fill.map !== undefined) material.map = fill.map;\r\n for (const key of POINTS_KEYS) if (s[key] !== undefined) material[key] = s[key];\r\n return material as unknown as Material3D;\r\n}\r\n"]}
1
+ {"version":3,"file":"material.js","sourceRoot":"","sources":["../../../src/components/modules/material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAA4B,MAAM,uBAAuB,CAAC;AAKzG,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAE7E,kFAAkF;AAClF,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,QAAQ,EAAE,QAAQ,EAAsC;IACxD,IAAI,EAAE,KAAK,CAAC,MAAM,CAAS,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACzD,OAAO,EAAE,QAAQ,EAAU;IAC3B,SAAS,EAAE,QAAQ,EAAU;IAC7B,SAAS,EAAE,QAAQ,EAAU;IAC7B,QAAQ,EAAE,aAAa,EAAE;IACzB,gBAAgB,EAAE,QAAQ,EAAU;IACpC,SAAS,EAAE,QAAQ,EAAa;IAChC,YAAY,EAAE,QAAQ,EAAa;IACnC,YAAY,EAAE,QAAQ,EAAa;IACnC,KAAK,EAAE,QAAQ,EAAa;IAC5B,QAAQ,EAAE,QAAQ,EAAa;IAC/B,eAAe,EAAE,QAAQ,EAAU;IACnC,SAAS,EAAE,QAAQ,EAAW;IAC9B,OAAO,EAAE,QAAQ,EAAa;IAC9B,KAAK,EAAE,QAAQ,EAAW;IAC1B,YAAY,EAAE,QAAQ,E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0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAe,CAAC;AAC5E,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,CAAU,CAAC;AAE9E,oGAAoG;AACpG,MAAM,UAAU,MAAM,CAAC,CAAgB;IACnC,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAe,CAAC;IAC5G,MAAM,QAAQ,GAA4B,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC7D,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1D,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;QAAE,QAAQ,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,WAAW;QAAE,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChF,OAAO,QAAiC,CAAC;AAC7C,CAAC","sourcesContent":["import { lerpFill3D, resolveFill3D, type Fill3D } from \"@/render3d/fill3d\";\nimport type { Geometry3D } from \"@/render3d/geometry\";\nimport { Graphics3D, resolveMaterialShorthand3D, type MaterialShorthand3D } from \"@/render3d/graphics3d\";\nimport type { Material3D, Shading3D } from \"@/render3d/material\";\nimport type { Texture3D } from \"@/render3d/texture\";\nimport type { Blend3D, Faces3D } from \"@/render3d/transform\";\nimport type { Values } from \"@/components/factory/api\";\nimport { Types } from \"@/components/factory/types\";\nimport { optional, optionalColor } from \"@/components/modules/three-entries\";\n\n/** `Mesh3D`'s surface: a material, or the shorthand entries one is built from. */\nexport const state = {\n material: optional<Material3D | readonly Material3D[]>(),\n fill: Types.custom<Fill3D>(\"white\", { lerp: lerpFill3D }),\n opacity: optional<number>(),\n roughness: optional<number>(),\n metalness: optional<number>(),\n emission: optionalColor(),\n emissionStrength: optional<number>(),\n normalMap: optional<Texture3D>(),\n roughnessMap: optional<Texture3D>(),\n metalnessMap: optional<Texture3D>(),\n aoMap: optional<Texture3D>(),\n alphaMap: optional<Texture3D>(),\n envMapIntensity: optional<number>(),\n wireframe: optional<boolean>(),\n shading: optional<Shading3D>(),\n faces: optional<Faces3D>(),\n vertexColors: optional<boolean>(),\n blend: optional<Blend3D>(),\n unlit: Types.custom(false),\n};\n\ntype MaterialState = Values<typeof state>;\n\nconst SHORTHAND_KEYS = [\n \"opacity\", \"roughness\", \"metalness\",\n \"emission\", \"emissionStrength\", \"normalMap\", \"roughnessMap\",\n \"metalnessMap\", \"aoMap\", \"alphaMap\", \"envMapIntensity\", \"wireframe\",\n \"shading\", \"faces\", \"vertexColors\", \"blend\",\n] as const;\n\n/** The entries that are set, as a material shorthand. */\nexport function shorthand(s: MaterialState): MaterialShorthand3D {\n const out: Record<string, unknown> = {};\n if (s.material !== undefined) out.material = s.material;\n if (s.fill !== undefined) out.fill = s.fill;\n for (const key of SHORTHAND_KEYS) if (s[key] !== undefined) out[key] = s[key];\n if (s.unlit) out.unlit = true;\n return out as MaterialShorthand3D;\n}\n\n/** `geometry` with this surface; nothing without one. */\nexport function mesh(s: MaterialState, geometry: Geometry3D | undefined): Graphics3D {\n const g3 = new Graphics3D();\n if (geometry) g3.mesh(geometry, resolveMaterialShorthand3D(shorthand(s)));\n return g3;\n}\n\n/** The one material instanced copies share: the first, when the shorthand resolves to several. */\nexport function single(s: MaterialState): Material3D {\n const resolved = resolveMaterialShorthand3D(shorthand(s));\n return (Array.isArray(resolved) ? resolved[0] : resolved) as Material3D;\n}\n\nconst POINTS_KEYS = [\"opacity\", \"alphaMap\", \"blend\", \"vertexColors\"] as const;\n\n/** A points material: the given one, or the fill's colour and map with what a point cloud reads. */\nexport function points(s: MaterialState): Material3D {\n if (s.material !== undefined) return (Array.isArray(s.material) ? s.material[0] : s.material) as Material3D;\n const material: Record<string, unknown> = { type: \"points\" };\n const fill = resolveFill3D(s.fill);\n if (fill.color !== undefined) material.color = fill.color;\n if (fill.map !== undefined) material.map = fill.map;\n for (const key of POINTS_KEYS) if (s[key] !== undefined) material[key] = s[key];\n return material as unknown as Material3D;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"paint.js","sourceRoot":"","sources":["../../../src/components/modules/paint.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAW,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,OAAO,EAAE,KAAK,CAAC,IAAI;IACnB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC;IACh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,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { GraphicsOp, Graphics2D } from \"@/render/graphics2d\";\r\nimport type { RenderContext2D, Values } from \"@/components/factory/api\";\r\nimport { clipOf } from \"@/components/factory/clip-of\";\r\nimport { commandsFor } from \"@/components/factory/commands-for\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport { internalsOf } from \"@/components/factory/views\";\r\n\r\nconst FRACTION = { min: 0, max: 1, step: 0.01, scale: 100, unit: \"%\" } as const;\r\n\r\n/** Fill, stroke and shadow for anything with a shape, and the commands that move them. */\r\nexport const state = {\r\n fill: Types.fill,\r\n stroke: Types.stroke,\r\n shadow: Types.shadow,\r\n overlay: Types.fill,\r\n start: Types.number(0, FRACTION),\r\n end: Types.number(1, FRACTION),\r\n};\r\n\r\nexport const commands = commandsFor(state, {\r\n fillTo: { args: [\"fill\"] },\r\n strokeTo: { args: [\"stroke\"] },\r\n shadowTo: { args: [\"shadow\"] },\r\n overlayTo: { args: [\"overlay\"] },\r\n progressTo: { args: [\"start\", \"end\"] },\r\n /** A stretch of the outline travels along it, and leaves it as it was. */\r\n flash: {\r\n args: { portion: Types.number(0.25, { ...FRACTION, min: 0.01 }) },\r\n run: (timeline, s) => {\r\n const rest = { start: s.start, end: s.end };\r\n const portion = Math.min(1, Math.max(0.01, timeline.args.portion));\r\n return timeline.animate((t) => {\r\n if (t <= 0 || t >= 1) return rest;\r\n const head = t * (1 + portion);\r\n return { start: Math.max(0, head - portion), end: Math.min(1, head) };\r\n });\r\n },\r\n },\r\n});\r\n\r\n/** What `draw` reads; a component that spreads `Paint.state` without `overlay` passes as it is. */\r\nexport type PaintState = Omit<Values<typeof state>, \"overlay\"> & { readonly overlay?: readonly FillResolved[]; readonly clip: boolean };\r\n\r\nexport interface DrawOptions {\r\n /** Paint with this instead of `state.fill` (a video frame under it, a 3D scene over it). */\r\n readonly fill?: Fill;\r\n /** Draw the children some other way (through a camera, in a space). Default: `ctx.children()`. */\r\n readonly children?: () => void;\r\n /**\r\n * What `clip` confines the children to and picking tests, when it isn't the\r\n * shape drawn: a path's box, or `null` for none (then picking takes the box).\r\n */\r\n readonly clipShape?: Graphics2D | null;\r\n /** Draw the overlay some other way (masked by a picture), from the trimmed shape. Default: the shape filled with `overlay`. */\r\n readonly overlay?: (base: Graphics2D) => Graphics2D | null;\r\n}\r\n\r\nconst TRIMMED = new Set<GraphicsOp[\"kind\"]>([\"rect\", \"ellipse\", \"path\", \"line\", \"polygon\", \"polygram\"]);\r\n\r\nfunction trimmed(shape: Graphics2D, start: number, end: number): Graphics2D {\r\n return shape._withOps(shape.ops().map((op) => (TRIMMED.has(op.kind)\r\n ? { ...op, state: { ...(op as { state: object }).state, start, end } } as GraphicsOp\r\n : op)));\r\n}\r\n\r\n/** A fresh copy to paint: a `Graphics2D` records into itself, and each paint needs the bare shape. */\r\nfunction copy(shape: Graphics2D): Graphics2D {\r\n return shape._withOps([...shape.ops()]);\r\n}\r\n\r\n/** A shadow is cast by the stroke when nothing visible fills the shape. */\r\nfunction castsShadowFromStroke(state: PaintState): boolean {\r\n if ((state.shadow as ShadowResolved[]).length === 0) return false;\r\n return !(state.fill as FillResolved[]).some((layer) => (layer.opacity ?? 1) > 0);\r\n}\r\n\r\n/**\r\n * Shadow and fill, then the children (clipped to the shape when `clip` is set),\r\n * then overlay and stroke, all trimmed by `start`/`end`: the paint order every\r\n * shape has, in one function.\r\n */\r\nexport function draw(ctx: RenderContext2D, s: PaintState, shape: Graphics2D | null, options: DrawOptions = {}): void {\r\n const c = internalsOf(ctx);\r\n const out = c.target();\r\n const confining = options.clipShape === undefined ? shape : options.clipShape;\r\n c.host._lastShape = confining;\r\n if (c.probing) {\r\n // Children drawn some other way may declare a camera or a space: the probe needs to see that.\r\n options.children?.();\r\n return;\r\n }\r\n const base = shape ? trimmed(shape, s.start, s.end) : null;\r\n\r\n c.inFront(() => {\r\n if (base) out.draw(copy(base).shadow(s.shadow).fill(options.fill ?? s.fill));\r\n });\r\n\r\n const outline = s.clip && confining ? clipOf(confining) : null;\r\n const clipped = outline !== null && !outline.isEmpty();\r\n if (clipped) out.beginClip(outline);\r\n if (options.children) options.children();\r\n else ctx.children();\r\n if (clipped) out.endClip();\r\n\r\n c.inFront(() => {\r\n if (!base) return;\r\n if (s.overlay && s.overlay.length > 0) {\r\n const overlay = options.overlay ? options.overlay(copy(base)) : copy(base).fill(s.overlay as FillResolved[]);\r\n if (overlay) out.draw(overlay);\r\n }\r\n const stroke = s.stroke as StrokeResolved[];\r\n if (stroke.length === 0) return;\r\n out.draw(castsShadowFromStroke(s) ? copy(base).shadow(s.shadow).stroke(stroke) : copy(base).stroke(stroke));\r\n });\r\n}\r\n\r\n/** How far the stroke reaches inside the shape, so children clear it. The widest stroke wins, not the sum. */\r\nexport function inset(s: Values<typeof state>): InsetsResolved {\r\n let extra = 0;\r\n for (const stroke of s.stroke as StrokeResolved[]) {\r\n const intrusion = stroke.weight * (1 - stroke.align) / 2;\r\n if (intrusion > extra) extra = intrusion;\r\n }\r\n return { left: extra, right: extra, top: extra, bottom: extra };\r\n}\r\n"]}
1
+ {"version":3,"file":"paint.js","sourceRoot":"","sources":["../../../src/components/modules/paint.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,QAA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CAAC,CAAC;IAChH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,KAAK,CAAC,CAAuB;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC,MAA0B,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,SAAS,GAAG,KAAK;YAAE,KAAK,GAAG,SAAS,CAAC;IAC7C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { InsetsResolved } from \"@/attributes/layout/insets\";\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\nimport type { GraphicsOp, Graphics2D } from \"@/render/graphics2d\";\nimport type { RenderContext2D, Values } from \"@/components/factory/api\";\nimport { clipOf } from \"@/components/factory/clip-of\";\nimport { commandsFor } from \"@/components/factory/commands-for\";\nimport { Types } from \"@/components/factory/types\";\nimport { internalsOf } from \"@/components/factory/views\";\n\nconst FRACTION = { min: 0, max: 1, step: 0.01, scale: 100, unit: \"%\" } as const;\n\n/** Fill, stroke and shadow for anything with a shape, and the commands that move them. */\nexport const state = {\n fill: Types.fill,\n stroke: Types.stroke,\n shadow: Types.shadow,\n overlay: Types.fill,\n start: Types.number(0, FRACTION),\n end: Types.number(1, FRACTION),\n};\n\nexport const commands = commandsFor(state, {\n fillTo: { args: [\"fill\"] },\n strokeTo: { args: [\"stroke\"] },\n shadowTo: { args: [\"shadow\"] },\n overlayTo: { args: [\"overlay\"] },\n progressTo: { args: [\"start\", \"end\"] },\n /** A stretch of the outline travels along it, and leaves it as it was. */\n flash: {\n args: { portion: Types.number(0.25, { ...FRACTION, min: 0.01 }) },\n run: (timeline, s) => {\n const rest = { start: s.start, end: s.end };\n const portion = Math.min(1, Math.max(0.01, timeline.args.portion));\n return timeline.animate((t) => {\n if (t <= 0 || t >= 1) return rest;\n const head = t * (1 + portion);\n return { start: Math.max(0, head - portion), end: Math.min(1, head) };\n });\n },\n },\n});\n\n/** What `draw` reads; a component that spreads `Paint.state` without `overlay` passes as it is. */\nexport type PaintState = Omit<Values<typeof state>, \"overlay\"> & { readonly overlay?: readonly FillResolved[]; readonly clip: boolean };\n\nexport interface DrawOptions {\n /** Paint with this instead of `state.fill` (a video frame under it, a 3D scene over it). */\n readonly fill?: Fill;\n /** Draw the children some other way (through a camera, in a space). Default: `ctx.children()`. */\n readonly children?: () => void;\n /**\n * What `clip` confines the children to and picking tests, when it isn't the\n * shape drawn: a path's box, or `null` for none (then picking takes the box).\n */\n readonly clipShape?: Graphics2D | null;\n /** Draw the overlay some other way (masked by a picture), from the trimmed shape. Default: the shape filled with `overlay`. */\n readonly overlay?: (base: Graphics2D) => Graphics2D | null;\n}\n\nconst TRIMMED = new Set<GraphicsOp[\"kind\"]>([\"rect\", \"ellipse\", \"path\", \"line\", \"polygon\", \"polygram\"]);\n\nfunction trimmed(shape: Graphics2D, start: number, end: number): Graphics2D {\n return shape._withOps(shape.ops().map((op) => (TRIMMED.has(op.kind)\n ? { ...op, state: { ...(op as { state: object }).state, start, end } } as GraphicsOp\n : op)));\n}\n\n/** A fresh copy to paint: a `Graphics2D` records into itself, and each paint needs the bare shape. */\nfunction copy(shape: Graphics2D): Graphics2D {\n return shape._withOps([...shape.ops()]);\n}\n\n/** A shadow is cast by the stroke when nothing visible fills the shape. */\nfunction castsShadowFromStroke(state: PaintState): boolean {\n if ((state.shadow as ShadowResolved[]).length === 0) return false;\n return !(state.fill as FillResolved[]).some((layer) => (layer.opacity ?? 1) > 0);\n}\n\n/**\n * Shadow and fill, then the children (clipped to the shape when `clip` is set),\n * then overlay and stroke, all trimmed by `start`/`end`: the paint order every\n * shape has, in one function.\n */\nexport function draw(ctx: RenderContext2D, s: PaintState, shape: Graphics2D | null, options: DrawOptions = {}): void {\n const c = internalsOf(ctx);\n const out = c.target();\n const confining = options.clipShape === undefined ? shape : options.clipShape;\n c.host._lastShape = confining;\n if (c.probing) {\n // Children drawn some other way may declare a camera or a space: the probe needs to see that.\n options.children?.();\n return;\n }\n const base = shape ? trimmed(shape, s.start, s.end) : null;\n\n c.inFront(() => {\n if (base) out.draw(copy(base).shadow(s.shadow).fill(options.fill ?? s.fill));\n });\n\n const outline = s.clip && confining ? clipOf(confining) : null;\n const clipped = outline !== null && !outline.isEmpty();\n if (clipped) out.beginClip(outline);\n if (options.children) options.children();\n else ctx.children();\n if (clipped) out.endClip();\n\n c.inFront(() => {\n if (!base) return;\n if (s.overlay && s.overlay.length > 0) {\n const overlay = options.overlay ? options.overlay(copy(base)) : copy(base).fill(s.overlay as FillResolved[]);\n if (overlay) out.draw(overlay);\n }\n const stroke = s.stroke as StrokeResolved[];\n if (stroke.length === 0) return;\n out.draw(castsShadowFromStroke(s) ? copy(base).shadow(s.shadow).stroke(stroke) : copy(base).stroke(stroke));\n });\n}\n\n/** How far the stroke reaches inside the shape, so children clear it. The widest stroke wins, not the sum. */\nexport function inset(s: Values<typeof state>): InsetsResolved {\n let extra = 0;\n for (const stroke of s.stroke as StrokeResolved[]) {\n const intrusion = stroke.weight * (1 - stroke.align) / 2;\n if (intrusion > extra) extra = intrusion;\n }\n return { left: extra, right: extra, top: extra, bottom: extra };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"shapes.js","sourceRoot":"","sources":["../../../src/components/modules/shapes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAmD,MAAM,8CAA8C,CAAC;A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AAC;QACzB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzH,YAAY,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;KAC/C,CAAC,CAAC;AACP,CAAC;AAED,qFAAqF;AACrF,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { pathOps } from \"@/attributes/shape/path/ops\";\r\nimport { shapeOutlinePixels, type ShapeOutlineKind, type ShapeOutlineOptions } from \"@/components/builtins/geometry/shape-outline\";\r\nimport type { PathData } from \"@/render/descriptors/path\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\n\r\n/** Each outline a built-in shape paints, from its box and its own entries. `Paint.draw` trims and paints it. */\r\n\r\nexport function ellipse(size: Size2D, s: { readonly startAngle: number; readonly sweep: number; readonly ratio: number }): Graphics2D {\r\n return new Graphics2D().ellipse({ width: size.width, height: size.height, startAngle: s.startAngle, sweep: s.sweep, ratio: s.ratio });\r\n}\r\n\r\nexport interface PolygonShape {\r\n readonly sides: number;\r\n readonly cornerRadius: number;\r\n readonly cornerStyle: CornerStyle;\r\n}\r\n\r\nexport function polygon(size: Size2D, s: PolygonShape): Graphics2D {\r\n return new Graphics2D().polygon({ width: size.width, height: size.height, sides: s.sides, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle });\r\n}\r\n\r\nexport function polygram(size: Size2D, s: PolygonShape & { readonly ratio: number }): Graphics2D {\r\n return new Graphics2D().polygram({\r\n width: size.width, height: size.height, sides: s.sides, ratio: s.ratio, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle,\r\n });\r\n}\r\n\r\n/** The box, as a shape: what a path clips its children to. */\r\nexport function box(size: Size2D): Graphics2D {\r\n return new Graphics2D().rect({ x: 0, y: 0, width: size.width, height: size.height });\r\n}\r\n\r\n/** Path data in the unit space of the box (y up), drawn at the box's size. */\r\nexport function unitPath(size: Size2D, data: PathData): Graphics2D {\r\n const { width: w, height: h } = size;\r\n return new Graphics2D().path({\r\n data: pathOps.anchorCommands(pathOps.anchors(data), (p) => ({ x: p.x * w, y: -p.y * h })),\r\n centerBounds: [-w / 2, -h / 2, w / 2, h / 2],\r\n });\r\n}\r\n\r\n/** Path data at face value, centred on its own bounds. */\r\nexport function facePath(data: PathData): Graphics2D {\r\n const b = pathOps.bounds(data);\r\n return new Graphics2D().path({ data, centerBounds: b ? [b.minX, b.minY, b.maxX, b.maxY] : undefined });\r\n}\r\n\r\n/** A named outline (triangle, star, …) fitted to the box. */\r\nexport function outline(kind: ShapeOutlineKind, size: Size2D, options: Omit<ShapeOutlineOptions, \"width\" | \"height\">): Graphics2D {\r\n const { width: w, height: h } = size;\r\n return new Graphics2D().path({\r\n data: pathOps.anchorCommands(shapeOutlinePixels(kind, { ...options, width: w, height: h }), (p) => ({ x: p.x, y: -p.y })),\r\n centerBounds: [-w / 2, -h / 2, w / 2, h / 2],\r\n });\r\n}\r\n\r\n/** A rect's corners, to spread in (`...Shapes.corners`), and the rect they round. */\r\nexport { state as corners, rect } from \"@/components/modules/corners\";\r\n"]}
1
+ {"version":3,"file":"shapes.js","sourceRoot":"","sources":["../../../src/components/modules/shapes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAmD,MAAM,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E,CAAC,IAAI,CAAC;QACzB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACzH,YAAY,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;KAC/C,CAAC,CAAC;AACP,CAAC;AAED,qFAAqF;AACrF,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { pathOps } from \"@/attributes/shape/path/ops\";\nimport { shapeOutlinePixels, type ShapeOutlineKind, type ShapeOutlineOptions } from \"@/components/builtins/geometry/shape-outline\";\nimport type { PathData } from \"@/render/descriptors/path\";\nimport { Graphics2D } from \"@/render/graphics2d\";\n\n/** Each outline a built-in shape paints, from its box and its own entries. `Paint.draw` trims and paints it. */\n\nexport function ellipse(size: Size2D, s: { readonly startAngle: number; readonly sweep: number; readonly ratio: number }): Graphics2D {\n return new Graphics2D().ellipse({ width: size.width, height: size.height, startAngle: s.startAngle, sweep: s.sweep, ratio: s.ratio });\n}\n\nexport interface PolygonShape {\n readonly sides: number;\n readonly cornerRadius: number;\n readonly cornerStyle: CornerStyle;\n}\n\nexport function polygon(size: Size2D, s: PolygonShape): Graphics2D {\n return new Graphics2D().polygon({ width: size.width, height: size.height, sides: s.sides, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle });\n}\n\nexport function polygram(size: Size2D, s: PolygonShape & { readonly ratio: number }): Graphics2D {\n return new Graphics2D().polygram({\n width: size.width, height: size.height, sides: s.sides, ratio: s.ratio, cornerRadius: s.cornerRadius, cornerStyle: s.cornerStyle,\n });\n}\n\n/** The box, as a shape: what a path clips its children to. */\nexport function box(size: Size2D): Graphics2D {\n return new Graphics2D().rect({ x: 0, y: 0, width: size.width, height: size.height });\n}\n\n/** Path data in the unit space of the box (y up), drawn at the box's size. */\nexport function unitPath(size: Size2D, data: PathData): Graphics2D {\n const { width: w, height: h } = size;\n return new Graphics2D().path({\n data: pathOps.anchorCommands(pathOps.anchors(data), (p) => ({ x: p.x * w, y: -p.y * h })),\n centerBounds: [-w / 2, -h / 2, w / 2, h / 2],\n });\n}\n\n/** Path data at face value, centred on its own bounds. */\nexport function facePath(data: PathData): Graphics2D {\n const b = pathOps.bounds(data);\n return new Graphics2D().path({ data, centerBounds: b ? [b.minX, b.minY, b.maxX, b.maxY] : undefined });\n}\n\n/** A named outline (triangle, star, …) fitted to the box. */\nexport function outline(kind: ShapeOutlineKind, size: Size2D, options: Omit<ShapeOutlineOptions, \"width\" | \"height\">): Graphics2D {\n const { width: w, height: h } = size;\n return new Graphics2D().path({\n data: pathOps.anchorCommands(shapeOutlinePixels(kind, { ...options, width: w, height: h }), (p) => ({ x: p.x, y: -p.y })),\n centerBounds: [-w / 2, -h / 2, w / 2, h / 2],\n });\n}\n\n/** A rect's corners, to spread in (`...Shapes.corners`), and the rect they round. */\nexport { state as corners, rect } from \"@/components/modules/corners\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"text-layout.js","sourceRoot":"","sources":["../../../src/components/modules/text-layout.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,GAE1F,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,WAAW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O;IACtB,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,GAAG,CAAC,QAAQ,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,CAAa;IACtD,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\nimport {\r\n declareGlyphAssets, declareRichAssets, measureGlyphs, measureRich, richState, textState,\r\n type RichValues, type TextSource, type TextValues,\r\n} from \"@/components/builtins/text/text-layout\";\r\nimport type { TextState } from \"@/render/descriptors/text\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { Loader, Measurer, RenderContext2D } from \"@/components/factory/api\";\r\nimport { currentPass, internalsOf, markDecided } from \"@/components/factory/views\";\r\n\r\n/**\r\n * Glyphs: measured, drawn and loaded by the shared functions in `components/builtins/text/text-layout.ts`.\r\n * `source` is where the string comes from: a `text` entry, a formatted number.\r\n */\r\n\r\nexport type { TextSource, TextValues, RichValues };\r\n\r\ntype Painted = { readonly shadow: unknown; readonly fill: unknown; readonly stroke: unknown };\r\n\r\n/** The block's own size, which a filling text still reports, so a hugging ancestor sees its content. */\r\nexport function measure(measurer: Measurer, s: TextValues, source: TextSource): Size2D {\r\n const { node, scope } = currentPass();\r\n markDecided(node);\r\n return measureGlyphs(s, source, { maxWidth: measurer.max.width, maxHeight: measurer.max.height }, scope);\r\n}\r\n\r\nconst drawn = new WeakMap<Node2D, { readonly s: TextValues; readonly source: TextSource }>();\r\n\r\n/** The glyphs, shadow and fill, then the children, then the stroke. A styled piece paints itself, so the node's own paint steps aside. */\r\nexport function draw(ctx: RenderContext2D, s: TextValues & Painted, source: TextSource): void {\r\n const c = internalsOf(ctx);\r\n drawn.set(c.host, { s, source });\r\n if (c.probing) return;\r\n const out = c.target();\r\n const state = textState(s, source, c.host.layoutBounds);\r\n const segmented = state.segments != null;\r\n c.inFront(() => {\r\n const g = new Graphics2D().text(state).shadow(s.shadow as ShadowResolved[]);\r\n if (!segmented) g.fill(s.fill as never);\r\n out.draw(g);\r\n });\r\n ctx.children();\r\n c.inFront(() => {\r\n const stroke = s.stroke as StrokeResolved[];\r\n if (stroke.length === 0 || segmented) return;\r\n out.draw(new Graphics2D().text(state).stroke(stroke));\r\n });\r\n}\r\n\r\nexport function load(loader: Loader, s: TextValues, source: TextSource): void {\r\n declareGlyphAssets(s, source, loader);\r\n}\r\n\r\n/** What a node drew its glyphs as, for a host's caret geometry. `null` for a node that draws none. */\r\nexport function textStateOf(node: Node2D): Partial<TextState> | null {\r\n const last = drawn.get(node);\r\n return last ? textState(last.s, last.source, node.layoutBounds) : null;\r\n}\r\n\r\nexport function measureRichText(measurer: Measurer, s: RichValues): Size2D {\r\n const { scope } = currentPass();\r\n return measureRich(s, { maxWidth: measurer.max.width, maxHeight: measurer.max.height }, scope);\r\n}\r\n\r\nexport function drawRichText(ctx: RenderContext2D, s: RichValues): void {\r\n const c = internalsOf(ctx);\r\n if (c.probing) return;\r\n const out = c.target();\r\n c.inFront(() => out.draw(new Graphics2D().richText(richState(s, c.host.layoutBounds))));\r\n ctx.children();\r\n}\r\n\r\nexport function loadRichText(loader: Loader, s: RichValues): void {\r\n declareRichAssets(s, loader);\r\n}\r\n"]}
1
+ {"version":3,"file":"text-layout.js","sourceRoot":"","sources":["../../../src/components/modules/text-layout.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,kBAAkB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AAE,KAAK,CAAC,CAAC;AACnG,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAoB,EAAE,CAAa;IAC5D,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,CAAC,OAAO;QAAE,OAAO;IACtB,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACxF,GAAG,CAAC,QAAQ,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,CAAa;IACtD,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\nimport {\n declareGlyphAssets, declareRichAssets, measureGlyphs, measureRich, richState, textState,\n type RichValues, type TextSource, type TextValues,\n} from \"@/components/builtins/text/text-layout\";\nimport type { TextState } from \"@/render/descriptors/text\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport type { Loader, Measurer, RenderContext2D } from \"@/components/factory/api\";\nimport { currentPass, internalsOf, markDecided } from \"@/components/factory/views\";\n\n/**\n * Glyphs: measured, drawn and loaded by the shared functions in `components/builtins/text/text-layout.ts`.\n * `source` is where the string comes from: a `text` entry, a formatted number.\n */\n\nexport type { TextSource, TextValues, RichValues };\n\ntype Painted = { readonly shadow: unknown; readonly fill: unknown; readonly stroke: unknown };\n\n/** The block's own size, which a filling text still reports, so a hugging ancestor sees its content. */\nexport function measure(measurer: Measurer, s: TextValues, source: TextSource): Size2D {\n const { node, scope } = currentPass();\n markDecided(node);\n return measureGlyphs(s, source, { maxWidth: measurer.max.width, maxHeight: measurer.max.height }, scope);\n}\n\nconst drawn = new WeakMap<Node2D, { readonly s: TextValues; readonly source: TextSource }>();\n\n/** The glyphs, shadow and fill, then the children, then the stroke. A styled piece paints itself, so the node's own paint steps aside. */\nexport function draw(ctx: RenderContext2D, s: TextValues & Painted, source: TextSource): void {\n const c = internalsOf(ctx);\n drawn.set(c.host, { s, source });\n if (c.probing) return;\n const out = c.target();\n const state = textState(s, source, c.host.layoutBounds);\n const segmented = state.segments != null;\n c.inFront(() => {\n const g = new Graphics2D().text(state).shadow(s.shadow as ShadowResolved[]);\n if (!segmented) g.fill(s.fill as never);\n out.draw(g);\n });\n ctx.children();\n c.inFront(() => {\n const stroke = s.stroke as StrokeResolved[];\n if (stroke.length === 0 || segmented) return;\n out.draw(new Graphics2D().text(state).stroke(stroke));\n });\n}\n\nexport function load(loader: Loader, s: TextValues, source: TextSource): void {\n declareGlyphAssets(s, source, loader);\n}\n\n/** What a node drew its glyphs as, for a host's caret geometry. `null` for a node that draws none. */\nexport function textStateOf(node: Node2D): Partial<TextState> | null {\n const last = drawn.get(node);\n return last ? textState(last.s, last.source, node.layoutBounds) : null;\n}\n\nexport function measureRichText(measurer: Measurer, s: RichValues): Size2D {\n const { scope } = currentPass();\n return measureRich(s, { maxWidth: measurer.max.width, maxHeight: measurer.max.height }, scope);\n}\n\nexport function drawRichText(ctx: RenderContext2D, s: RichValues): void {\n const c = internalsOf(ctx);\n if (c.probing) return;\n const out = c.target();\n c.inFront(() => out.draw(new Graphics2D().richText(richState(s, c.host.layoutBounds))));\n ctx.children();\n}\n\nexport function loadRichText(loader: Loader, s: RichValues): void {\n declareRichAssets(s, loader);\n}\n"]}
@@ -16,7 +16,7 @@ export declare const state: {
16
16
  letterSpacing: import("../../components/factory/api.js").Type<number, number, false>;
17
17
  lineHeight: import("../../components/factory/api.js").Type<number, number, false>;
18
18
  textAlign: import("../../components/factory/api.js").Type<TextAlign, TextAlign, false>;
19
- verticalAlign: import("../../components/factory/api.js").Type<"center" | "top" | "bottom", "center" | "top" | "bottom", false>;
19
+ verticalAlign: import("../../components/factory/api.js").Type<"top" | "bottom" | "center", "top" | "bottom" | "center", false>;
20
20
  textDecoration: import("../../components/factory/api.js").Type<"none" | "underline" | "line-through", "none" | "underline" | "line-through", false>;
21
21
  textCase: import("../../components/factory/api.js").Type<"none" | "upper" | "lower" | "title", "none" | "upper" | "lower" | "title", false>;
22
22
  minFontSize: import("../../components/factory/api.js").Type<number, number, false>;
@@ -1 +1 @@
1
- {"version":3,"file":"text-style.js","sourceRoot":"","sources":["../../../src/components/modules/text-style.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAA8B,MAAM,0BAA0B,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;GAIG;AAEH,SAAS,OAAO,CAAC,GAA2B,EAAE,KAAwC;IAClF,MAAM,OAAO,GAAG,KAAK,CAAC,OAA6B,CAAC;IACpD,OAAO,OAAO,CAAC,UAAU,CACrB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAClE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAChD,CAAC;AACN,CAAC;AAED,yHAAyH;AACzH,MAAM,UAAU,OAAO,CAAC,GAAoB,EAAE,UAA0C,EAAE;IACtF,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAA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AAM,EAAE,KAAK,CAAC,MAAM,CAAqB,SAAS,CAAC;CACtD,CAAC;AAEF,uFAAuF;AACvF,MAAM,UAAU,OAAO,CAAC,CAA0B,EAAE,SAA+E;IAC/H,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAc,CAAC,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,OAAO,CAAC,CAA0B;IAC9C,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,CAAc,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\r\nimport { textOps } from \"@/attributes/text/ops\";\r\nimport type { FontStyle, TextAlign, TextStyle } from \"@/attributes/text/types\";\r\nimport { TextStyleToken } from \"@/runtime/builtin-context\";\r\nimport { provides, type Provided, type Values } from \"@/components/factory/api\";\r\nimport type { Inherit } from \"@/components/factory/type-def\";\r\nimport { Types } from \"@/components/factory/types\";\r\n\r\n/**\r\n * The face text is set in, each field taken, when the author leaves it unset,\r\n * from the cascade: the theme's `default` typography, under the nearest\r\n * provider's style, under the node's own `variant` preset.\r\n */\r\n\r\nfunction cascade(use: Parameters<Inherit>[0], given: Readonly<Record<string, unknown>>): TextStyle {\r\n const variant = given.variant as string | undefined;\r\n return textOps.mergeStyle(\r\n textOps.mergeStyle(textOps.preset(\"default\"), use(TextStyleToken)),\r\n variant ? textOps.preset(variant) : undefined,\r\n );\r\n}\r\n\r\n/** What `key` inherits. `autofit: false` refuses an inherited `'autofit'` size, for a node that can't fit to its box. */\r\nexport function inherit(key: keyof TextStyle, options: { readonly autofit?: boolean } = {}): Inherit {\r\n return (use, given) => {\r\n const value = cascade(use, given)[key];\r\n return key === \"fontSize\" && value === \"autofit\" && options.autofit === false ? undefined : value;\r\n };\r\n}\r\n\r\nexport const state = {\r\n // No default: a face nobody chose is one never declared and never loaded, so the renderer says so.\r\n fontFamily: Types.custom<string>(undefined as unknown as string, { inherit: inherit(\"fontFamily\") }),\r\n fontSize: Types.custom<number | \"autofit\">(48, {\r\n lerp: (a, b, t) => textOps.lerpFontSize(a, b, t) as number | \"autofit\",\r\n inherit: inherit(\"fontSize\"),\r\n }),\r\n fontWeight: Types.number(400, { inherit: inherit(\"fontWeight\") }),\r\n fontStyle: Types.custom<FontStyle>(\"normal\", { inherit: inherit(\"fontStyle\") }),\r\n letterSpacing: Types.number(0, { inherit: inherit(\"letterSpacing\") }),\r\n lineHeight: Types.number(1.2, { inherit: inherit(\"lineHeight\") }),\r\n textAlign: Types.custom<TextAlign>(\"center\", { inherit: inherit(\"textAlign\") }),\r\n verticalAlign: Types.oneOf([\"top\", \"center\", \"bottom\"], { default: \"center\" }),\r\n textDecoration: Types.oneOf([\"none\", \"underline\", \"line-through\"]),\r\n textCase: Types.oneOf([\"none\", \"upper\", \"lower\", \"title\"]),\r\n minFontSize: Types.number(12),\r\n variant: Types.custom<string | undefined>(undefined),\r\n fill: Types.fill(undefined, { inherit: inherit(\"fill\") }),\r\n stroke: Types.stroke(undefined, { inherit: inherit(\"stroke\") }),\r\n shadow: Types.shadow(undefined, { inherit: inherit(\"shadow\") }),\r\n};\r\n\r\n/** The style a provider sets: each field left unset is inherited from above. */\r\nexport const provided = {\r\n fontFamily: Types.custom<string | undefined>(undefined),\r\n fontSize: Types.custom<number | \"autofit\" | undefined>(undefined),\r\n fontWeight: Types.custom<number | undefined>(undefined),\r\n fontStyle: Types.custom<FontStyle | undefined>(undefined),\r\n letterSpacing: Types.custom<number | undefined>(undefined),\r\n lineHeight: Types.custom<number | undefined>(undefined),\r\n textAlign: Types.custom<TextAlign | undefined>(undefined),\r\n fill: Types.custom<Fill | undefined>(undefined),\r\n stroke: Types.custom<Stroke | undefined>(undefined),\r\n shadow: Types.custom<Shadow | undefined>(undefined),\r\n};\r\n\r\n/** The subtree's style: the inherited one with this provider's fields laid over it. */\r\nexport function provide(s: Values<typeof provided>, inherited: <T>(context: { readonly id: symbol; readonly defaultValue: T }) => T): readonly Provided[] {\r\n return [provides(TextStyleToken, textOps.mergeStyle(inherited(TextStyleToken), s as TextStyle))];\r\n}\r\n\r\n/** This provider's own fields, as the default for text drawn under it. */\r\nexport function current(s: Values<typeof provided>): TextStyle {\r\n return textOps.mergeStyle({}, s as TextStyle);\r\n}\r\n"]}
1
+ {"version":3,"file":"text-style.js","sourceRoot":"","sources":["../../../src/components/modules/text-style.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAA8B,MAAM,0BAA0B,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;GAIG;AAEH,SAAS,OAAO,CAAC,GAA2B,EAAE,KAAwC;IAClF,MAAM,OAAO,GAAG,KAAK,CAAC,OAA6B,CAAC;IACpD,OAAO,OAAO,CAAC,UAAU,CACrB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAClE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAChD,CAAC;AACN,CAAC;AAED,yHAAyH;AACzH,MAAM,UAAU,OAAO,CAAC,GAAoB,EAAE,UAA0C,EAAE;IACtF,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,GAAG,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,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AACvF,MAAM,UAAU,OAAO,CAAC,CAA0B,EAAE,SAA+E;IAC/H,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAc,CAAC,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,OAAO,CAAC,CAA0B;IAC9C,OAAO,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,CAAc,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { Shadow } from \"@/attributes/shape/shadow/shadow\";\nimport type { Stroke } from \"@/attributes/shape/stroke/stroke\";\nimport { textOps } from \"@/attributes/text/ops\";\nimport type { FontStyle, TextAlign, TextStyle } from \"@/attributes/text/types\";\nimport { TextStyleToken } from \"@/runtime/builtin-context\";\nimport { provides, type Provided, type Values } from \"@/components/factory/api\";\nimport type { Inherit } from \"@/components/factory/type-def\";\nimport { Types } from \"@/components/factory/types\";\n\n/**\n * The face text is set in, each field taken, when the author leaves it unset,\n * from the cascade: the theme's `default` typography, under the nearest\n * provider's style, under the node's own `variant` preset.\n */\n\nfunction cascade(use: Parameters<Inherit>[0], given: Readonly<Record<string, unknown>>): TextStyle {\n const variant = given.variant as string | undefined;\n return textOps.mergeStyle(\n textOps.mergeStyle(textOps.preset(\"default\"), use(TextStyleToken)),\n variant ? textOps.preset(variant) : undefined,\n );\n}\n\n/** What `key` inherits. `autofit: false` refuses an inherited `'autofit'` size, for a node that can't fit to its box. */\nexport function inherit(key: keyof TextStyle, options: { readonly autofit?: boolean } = {}): Inherit {\n return (use, given) => {\n const value = cascade(use, given)[key];\n return key === \"fontSize\" && value === \"autofit\" && options.autofit === false ? undefined : value;\n };\n}\n\nexport const state = {\n // No default: a face nobody chose is one never declared and never loaded, so the renderer says so.\n fontFamily: Types.custom<string>(undefined as unknown as string, { inherit: inherit(\"fontFamily\") }),\n fontSize: Types.custom<number | \"autofit\">(48, {\n lerp: (a, b, t) => textOps.lerpFontSize(a, b, t) as number | \"autofit\",\n inherit: inherit(\"fontSize\"),\n }),\n fontWeight: Types.number(400, { inherit: inherit(\"fontWeight\") }),\n fontStyle: Types.custom<FontStyle>(\"normal\", { inherit: inherit(\"fontStyle\") }),\n letterSpacing: Types.number(0, { inherit: inherit(\"letterSpacing\") }),\n lineHeight: Types.number(1.2, { inherit: inherit(\"lineHeight\") }),\n textAlign: Types.custom<TextAlign>(\"center\", { inherit: inherit(\"textAlign\") }),\n verticalAlign: Types.oneOf([\"top\", \"center\", \"bottom\"], { default: \"center\" }),\n textDecoration: Types.oneOf([\"none\", \"underline\", \"line-through\"]),\n textCase: Types.oneOf([\"none\", \"upper\", \"lower\", \"title\"]),\n minFontSize: Types.number(12),\n variant: Types.custom<string | undefined>(undefined),\n fill: Types.fill(undefined, { inherit: inherit(\"fill\") }),\n stroke: Types.stroke(undefined, { inherit: inherit(\"stroke\") }),\n shadow: Types.shadow(undefined, { inherit: inherit(\"shadow\") }),\n};\n\n/** The style a provider sets: each field left unset is inherited from above. */\nexport const provided = {\n fontFamily: Types.custom<string | undefined>(undefined),\n fontSize: Types.custom<number | \"autofit\" | undefined>(undefined),\n fontWeight: Types.custom<number | undefined>(undefined),\n fontStyle: Types.custom<FontStyle | undefined>(undefined),\n letterSpacing: Types.custom<number | undefined>(undefined),\n lineHeight: Types.custom<number | undefined>(undefined),\n textAlign: Types.custom<TextAlign | undefined>(undefined),\n fill: Types.custom<Fill | undefined>(undefined),\n stroke: Types.custom<Stroke | undefined>(undefined),\n shadow: Types.custom<Shadow | undefined>(undefined),\n};\n\n/** The subtree's style: the inherited one with this provider's fields laid over it. */\nexport function provide(s: Values<typeof provided>, inherited: <T>(context: { readonly id: symbol; readonly defaultValue: T }) => T): readonly Provided[] {\n return [provides(TextStyleToken, textOps.mergeStyle(inherited(TextStyleToken), s as TextStyle))];\n}\n\n/** This provider's own fields, as the default for text drawn under it. */\nexport function current(s: Values<typeof provided>): TextStyle {\n return textOps.mergeStyle({}, s as TextStyle);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"three-entries.js","sourceRoot":"","sources":["../../../src/components/modules/three-entries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAmC,MAAM,oBAAoB,CAAC;AAElH,OAAO,EAAE,KAAK,EAAqB,MAAM,4BAA4B,CAAC;AAEtE,qGAAqG;AAErG,MAAM,UAAU,QAAQ;IACpB,OAAO,KAAK,CAAC,MAAM,CAAgB,SAAS,CAAC,CAAC;AAClD,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAA8B,KAAQ;IAChE,OAAO,KAAK,CAAC,MAAM,CAA4C,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAA6B,CAAC;AACxI,CAAC;AASD,MAAM,UAAU,aAAa;IACzB,OAAO,KAAK,CAAC,MAAM,CAAiD,SAAS,EAAE;QAC3E,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,QAAQ,CAAC,IAAsH;QACrI,IAAI,EAAE,OAAO;KAChB,CAAC,CAAC;AACP,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,KAAwB;IACpD,OAAO,KAAK,CAAC,MAAM,CAAgD,SAAS,EAAE;QAC1E,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC;QAC9D,IAAI,EAAE,SAAS;KAClB,CAAC,CAAC;AACP,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAI,CAAS,EAAE,IAAuB;IACzD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAI,CAA6B,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,GAAQ,CAAC;AACpB,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,MAAM,CAAI,IAAY,EAAE,CAAS,EAAE,IAAuB;IACtE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAS,CAAC,EAAE,IAAI,CAAC,EAAO,CAAC;AACtD,CAAC","sourcesContent":["import type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\r\nimport { colorOps } from \"@/attributes/shape/fill/lerp\";\r\nimport { lerpOptionalVector3, resolveOptionalVector3, type Vector3, type Vector3Input } from \"@/render3d/vector3\";\r\nimport type { Type } from \"@/components/factory/api\";\r\nimport { Types, type EntryOptions } from \"@/components/factory/types\";\r\n\r\n/** The 3D tree's entries that start unset: the renderer's own default applies until one is given. */\r\n\r\nexport function optional<T>(): Type<T | undefined> {\r\n return Types.custom<T | undefined>(undefined);\r\n}\r\n\r\n/** A number, unset until given, with a number's hints. */\r\nexport function optionalNumber<const H extends NumberHints>(hints: H): Type<number | undefined> {\r\n return Types.custom<number | undefined, number | undefined, H>(undefined, { kind: \"number\", ...hints }) as Type<number | undefined>;\r\n}\r\n\r\ninterface NumberHints extends EntryOptions {\r\n readonly min?: number;\r\n readonly max?: number;\r\n readonly step?: number;\r\n readonly unit?: string;\r\n}\r\n\r\nexport function optionalColor(): Type<Color | undefined, NormalizedColor | undefined> {\r\n return Types.custom<Color | undefined, NormalizedColor | undefined>(undefined, {\r\n resolve: (v) => (v === undefined ? undefined : colorOps.resolve(v)),\r\n lerp: colorOps.lerp as (from: NormalizedColor | undefined, to: NormalizedColor | undefined, t: number) => NormalizedColor | undefined,\r\n kind: \"color\",\r\n });\r\n}\r\n\r\n/** A point, unset until given: tweening from unset starts at the origin, or snaps. */\r\nexport function optionalVector3(unset: \"origin\" | \"snap\"): Type<Vector3Input | undefined, Vector3 | undefined> {\r\n return Types.custom<Vector3Input | undefined, Vector3 | undefined>(undefined, {\r\n resolve: resolveOptionalVector3,\r\n lerp: (from, to, t) => lerpOptionalVector3(from, to, t, unset),\r\n kind: \"vector3\",\r\n });\r\n}\r\n\r\n/** Each of `keys` the state has set: what a scene descriptor takes. */\r\nexport function defined<T>(s: object, keys: readonly string[]): T {\r\n const out: Record<string, unknown> = {};\r\n for (const key of keys) {\r\n const value = (s as Record<string, unknown>)[key];\r\n if (value !== undefined) out[key] = value;\r\n }\r\n return out as T;\r\n}\r\n\r\n/** `{ type, ...defined(s, keys) }`. */\r\nexport function stated<T>(type: string, s: object, keys: readonly string[]): T {\r\n return { type, ...defined<object>(s, keys) } as T;\r\n}\r\n"]}
1
+ {"version":3,"file":"three-entries.js","sourceRoot":"","sources":["../../../src/components/modules/three-entries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAmC,MAAM,oBAAoB,CAAC;AAElH,OAAO,EAAE,KAAK,EAAqB,MAAM,4BAA4B,CAAC;AAEtE,qGAAqG;AAErG,MAAM,UAAU,QAAQ;IACpB,OAAO,KAAK,CAAC,MAAM,CAAgB,SAAS,CAAC,CAAC;AAClD,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAA8B,KAAQ;IAChE,OAAO,KAAK,CAAC,MAAM,CAA4C,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAA6B,CAAC;AACxI,CAAC;AASD,MAAM,UAAU,aAAa;IACzB,OAAO,KAAK,CAAC,MAAM,CAAiD,SAAS,EAAE;QAC3E,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,EAAE,QAAQ,CAAC,IAAsH;QACrI,IAAI,EAAE,OAAO;KAChB,CAAC,CAAC;AACP,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,KAAwB;IACpD,OAAO,KAAK,CAAC,MAAM,CAAgD,SAAS,EAAE;QAC1E,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC;QAC9D,IAAI,EAAE,SAAS;KAClB,CAAC,CAAC;AACP,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAI,CAAS,EAAE,IAAuB;IACzD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAI,CAA6B,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,GAAQ,CAAC;AACpB,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,MAAM,CAAI,IAAY,EAAE,CAAS,EAAE,IAAuB;IACtE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAS,CAAC,EAAE,IAAI,CAAC,EAAO,CAAC;AACtD,CAAC","sourcesContent":["import type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\nimport { colorOps } from \"@/attributes/shape/fill/lerp\";\nimport { lerpOptionalVector3, resolveOptionalVector3, type Vector3, type Vector3Input } from \"@/render3d/vector3\";\nimport type { Type } from \"@/components/factory/api\";\nimport { Types, type EntryOptions } from \"@/components/factory/types\";\n\n/** The 3D tree's entries that start unset: the renderer's own default applies until one is given. */\n\nexport function optional<T>(): Type<T | undefined> {\n return Types.custom<T | undefined>(undefined);\n}\n\n/** A number, unset until given, with a number's hints. */\nexport function optionalNumber<const H extends NumberHints>(hints: H): Type<number | undefined> {\n return Types.custom<number | undefined, number | undefined, H>(undefined, { kind: \"number\", ...hints }) as Type<number | undefined>;\n}\n\ninterface NumberHints extends EntryOptions {\n readonly min?: number;\n readonly max?: number;\n readonly step?: number;\n readonly unit?: string;\n}\n\nexport function optionalColor(): Type<Color | undefined, NormalizedColor | undefined> {\n return Types.custom<Color | undefined, NormalizedColor | undefined>(undefined, {\n resolve: (v) => (v === undefined ? undefined : colorOps.resolve(v)),\n lerp: colorOps.lerp as (from: NormalizedColor | undefined, to: NormalizedColor | undefined, t: number) => NormalizedColor | undefined,\n kind: \"color\",\n });\n}\n\n/** A point, unset until given: tweening from unset starts at the origin, or snaps. */\nexport function optionalVector3(unset: \"origin\" | \"snap\"): Type<Vector3Input | undefined, Vector3 | undefined> {\n return Types.custom<Vector3Input | undefined, Vector3 | undefined>(undefined, {\n resolve: resolveOptionalVector3,\n lerp: (from, to, t) => lerpOptionalVector3(from, to, t, unset),\n kind: \"vector3\",\n });\n}\n\n/** Each of `keys` the state has set: what a scene descriptor takes. */\nexport function defined<T>(s: object, keys: readonly string[]): T {\n const out: Record<string, unknown> = {};\n for (const key of keys) {\n const value = (s as Record<string, unknown>)[key];\n if (value !== undefined) out[key] = value;\n }\n return out as T;\n}\n\n/** `{ type, ...defined(s, keys) }`. */\nexport function stated<T>(type: string, s: object, keys: readonly string[]): T {\n return { type, ...defined<object>(s, keys) } as T;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"view3d.js","sourceRoot":"","sources":["../../../src/components/modules/view3d.ts"],"names":[],"mappings":"AACA,OAAO,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C,QAAQ;KACnB,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,IAAI,EAAE,GAAG,KAAK,GAAG;QAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC,QAAQ,CAAC;AACzB,CAAC;AAED,yFAAyF;AACzF,SAAS,SAAS,CAAC,CAAY;IAC3B,KAAK,MAAM,KAAK,IAAI,CAAC,CAAC,IAAyE,EAAE,CAAC;QAC9F,IAAI,KAAK,EAAE,IAAI,KAAK,OAAO;YAAE,SAAS;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;YAAE,OAAO,KAAc,CAAC;IAC3E,CAAC;IACD,OAAO,CAAC,CAAC,aAAa,CAAC;AAC3B,CAAC;AAED,SAAS,SAAS,CAAC,IAA6B;IAC5C,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,IAAK,KAA2B,CAAC,IAAI,KAAK,OAAO;YAAE,OAAQ,KAAqC,CAAC,KAAK,CAAC;IACpH,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import type { LoaderFn } from \"@/assets/record\";\r\nimport { cameraOrbit, lerpColor3D, resolveColor3D } from \"@/attributes/render3d/orbit\";\r\nimport type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\r\nimport { Fills } from \"@/attributes/shape/fill/chain\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { gridGeometry3D, type Grid3DOptions } from \"@/components/builtins/three/grid-geometry3d\";\r\nimport type { BufferGeometry3D } from \"@/render3d/geometry\";\r\nimport { Graphics3D } from \"@/render3d/graphics3d\";\r\nimport { warmCanvas3D } from \"@/render3d/resources\";\r\nimport { resolveShadows3D, type PostEffect3D, type Shadows3D, type ToneMapping3D } from \"@/render3d/scene-settings\";\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\nimport type { Canvas3DFillResolved } from \"@/attributes/shape/fill/implementations/canvas3d\";\r\nimport { isSurfaceTexture3D, resolveSurfaceSource } from \"@/render3d/texture\";\r\nimport { forEachTexture3D } from \"@/render3d/walk\";\r\nimport type { Loader, RenderContext2D, Type, Values } from \"@/components/factory/api\";\r\nimport { Types } from \"@/components/factory/types\";\r\nimport { internalsOf } from \"@/components/factory/views\";\r\nimport * as Corners from \"@/components/modules/corners\";\r\nimport * as Paint from \"@/components/modules/paint\";\r\nimport { optional } from \"@/components/modules/three-entries\";\r\n\r\n/**\r\n * A viewport onto its 3D children: the default camera and light rig a scene\r\n * gets when it has none of its own, the floor grid, and the render settings.\r\n */\r\n\r\nfunction color3D(initial: Color): Type<Color, NormalizedColor> {\r\n return Types.custom<Color, NormalizedColor>(initial, { resolve: resolveColor3D, lerp: lerpColor3D });\r\n}\r\n\r\nexport const state = {\r\n orbit: Types.number(35, { step: 1, unit: \"°\" }),\r\n elevation: Types.number(20, { min: -89, max: 89, step: 1, unit: \"°\" }),\r\n zoom: Types.number(12, { min: 0.01, step: 0.1 }),\r\n fov: Types.custom(45),\r\n ambientIntensity: Types.custom(0.45),\r\n ambientColor: color3D(\"#ffffff\"),\r\n keyIntensity: Types.custom(2.4),\r\n keyColor: color3D(\"#ffffff\"),\r\n showGrid: Types.custom(false),\r\n gridSize: Types.custom(40),\r\n gridDivisions: Types.custom(40),\r\n gridMajorEvery: Types.custom(5),\r\n gridColor: color3D(\"#26292f\"),\r\n gridMajorColor: color3D(\"#363a42\"),\r\n showAxes: Types.custom(false),\r\n axisXColor: color3D(\"#c8404f\"),\r\n axisZColor: color3D(\"#2f6fd0\"),\r\n gridFade: Types.custom(0.55),\r\n gridFadeColor: color3D(\"#0b0d12\"),\r\n maxPixelRatio: Types.custom(2),\r\n antialias: Types.custom(true),\r\n shadows: Types.custom<Shadows3D>(false),\r\n tone: optional<ToneMapping3D>(),\r\n exposure: optional<number>(),\r\n post: optional<PostEffect3D | readonly PostEffect3D[]>(),\r\n};\r\n\r\nexport const commands = {\r\n /** Swing the default camera: only the angles given move. */\r\n orbitTo: { args: [\"orbit\", \"elevation\", \"zoom\"] as const },\r\n};\r\n\r\ntype ViewState = Values<typeof state> & { readonly fill: FillResolved[] };\r\n\r\nconst loadThreeRuntime: LoaderFn = async () => {\r\n await warmCanvas3D();\r\n};\r\n\r\n/**\r\n * The 3D runtime, warmed before the first frame, and whatever `extend` draws:\r\n * pass the `extend` your render hands {@link draw}, so its textures, models and\r\n * surfaces load before a frame needs them, as a 3D child's own drawing does.\r\n */\r\nexport function load(loader: Loader, extend?: (scene: Scene3D) => void): void {\r\n loader.task(\"three:runtime\", loadThreeRuntime);\r\n if (!extend) return;\r\n const scene = new Scene3D();\r\n extend(scene);\r\n const fill: Canvas3DFillResolved = { type: \"canvas3D\", scene };\r\n loader.fill(fill);\r\n}\r\n\r\nconst grids = new WeakMap<object, { readonly key: string; readonly geometry: BufferGeometry3D }>();\r\n\r\n/**\r\n * Your 3D children's scene with this view's settings, its grid, and the default\r\n * camera and lights where the scene has none; `extend` draws more into it last.\r\n * `null` when there is nothing to show.\r\n */\r\nexport function scene(ctx: RenderContext2D, s: ViewState, extend?: (scene: Scene3D) => void): Scene3D | null {\r\n const scene = ctx.scene3D();\r\n const hasChildren = scene.ops().length > 0;\r\n const shadows = resolveShadows3D(s.shadows);\r\n if (shadows) scene.shadows(shadows);\r\n if (s.tone !== undefined || s.exposure !== undefined) scene.tone({ mapping: s.tone, exposure: s.exposure });\r\n if (s.post !== undefined) scene.post(s.post);\r\n const fog = scene.fogDescriptor();\r\n if (fog && fog.color === undefined) {\r\n const base = baseColor(s.fill);\r\n if (base !== undefined) scene.fog({ ...fog, color: base });\r\n }\r\n if (s.showGrid) {\r\n scene.draw(new Graphics3D().line({\r\n geometry: gridOf(internalsOf(ctx).host, s),\r\n segments: true,\r\n material: { type: \"lineBasic\", vertexColors: true, toneMapped: false },\r\n }));\r\n }\r\n if (!extend && scene.isEmpty() && !hasChildren) return null;\r\n if (scene.cameraDescriptor() === null) {\r\n scene.perspective({ fov: s.fov, orbit: cameraOrbit(s.orbit), elevation: s.elevation, distance: s.zoom });\r\n }\r\n if (!scene.ops().some((op) => op.kind === \"light\")) {\r\n scene\r\n .light({ type: \"ambient\", intensity: s.ambientIntensity, color: s.ambientColor })\r\n .light({ type: \"directional\", intensity: s.keyIntensity, color: s.keyColor }, { position: [4, 6, 3] })\r\n .light({ type: \"directional\", intensity: s.keyIntensity * 0.35, color: s.keyColor }, { position: [-5, -2, -4] });\r\n }\r\n extend?.(scene);\r\n return scene.isEmpty() ? null : scene;\r\n}\r\n\r\n/** The box painted, with the scene as its top fill layer. */\r\nexport function draw(ctx: RenderContext2D, s: ViewState & Parameters<typeof Paint.draw>[1] & Values<typeof Corners.state>, extend?: (scene: Scene3D) => void): void {\r\n const built = scene(ctx, s, extend);\r\n const internals = internalsOf(ctx);\r\n if (built && !internals.probing) {\r\n built.assertBalanced();\r\n // A surface texture draws a detached 2D node: it renders in this node's scope.\r\n const host = internals.host as unknown as { attachDetached(node: object): void };\r\n forEachTexture3D(built, (texture) => {\r\n if (!isSurfaceTexture3D(texture)) return;\r\n const source = resolveSurfaceSource(texture.source);\r\n if (source.kind === \"node\") host.attachDetached(source.node);\r\n });\r\n }\r\n const fill = built ? [...s.fill, ...Fills.canvas3D(built, { maxPixelRatio: s.maxPixelRatio, antialias: s.antialias })] : s.fill;\r\n Paint.draw(ctx, s, Corners.rect(ctx.size, s), { fill: fill as never });\r\n}\r\n\r\nfunction gridOf(host: object, s: ViewState): BufferGeometry3D {\r\n const options: Grid3DOptions = {\r\n size: s.gridSize,\r\n divisions: Math.max(1, Math.round(s.gridDivisions)),\r\n majorEvery: Math.max(1, Math.round(s.gridMajorEvery)),\r\n minorColor: s.gridColor,\r\n majorColor: s.gridMajorColor,\r\n axisXColor: s.axisXColor,\r\n axisZColor: s.axisZColor,\r\n showAxes: s.showAxes,\r\n fadeTo: fadeColor(s),\r\n fade: s.gridFade,\r\n };\r\n const key = JSON.stringify(options);\r\n let kept = grids.get(host);\r\n if (kept?.key !== key) grids.set(host, kept = { key, geometry: gridGeometry3D(options) });\r\n return kept.geometry;\r\n}\r\n\r\n/** The grid fades into the first visible solid fill, so it melts into the background. */\r\nfunction fadeColor(s: ViewState): Color {\r\n for (const layer of s.fill as unknown as readonly ({ type?: string; color?: unknown } | null)[]) {\r\n if (layer?.type !== \"solid\") continue;\r\n const color = layer.color;\r\n if (typeof color === \"string\") return color;\r\n if (Array.isArray(color) && (color[3] ?? 1) > 0) return color as Color;\r\n }\r\n return s.gridFadeColor;\r\n}\r\n\r\nfunction baseColor(fill: readonly FillResolved[]): Color | undefined {\r\n for (const layer of fill) {\r\n if (layer && (layer as { type?: string }).type === \"solid\") return (layer as unknown as { color: Color }).color;\r\n }\r\n return undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"view3d.js","sourceRoot":"","sources":["../../../src/components/modules/view3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAsB,MAAM,6CAA6C,CAAC;AAEjG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAg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OAAO,CAAC,EAAE,CAAC,CAAC;IAC1F,OAAO,IAAI,CAAC,QAAQ,CAAC;AACzB,CAAC;AAED,yFAAyF;AACzF,SAAS,SAAS,CAAC,CAAY;IAC3B,KAAK,MAAM,KAAK,IAAI,CAAC,CAAC,IAAyE,EAAE,CAAC;QAC9F,IAAI,KAAK,EAAE,IAAI,KAAK,OAAO;YAAE,SAAS;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;YAAE,OAAO,KAAc,CAAC;IAC3E,CAAC;IACD,OAAO,CAAC,CAAC,aAAa,CAAC;AAC3B,CAAC;AAED,SAAS,SAAS,CAAC,IAA6B;IAC5C,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,IAAK,KAA2B,CAAC,IAAI,KAAK,OAAO;YAAE,OAAQ,KAAqC,CAAC,KAAK,CAAC;IACpH,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import type { LoaderFn } from \"@/assets/record\";\nimport { cameraOrbit, lerpColor3D, resolveColor3D } from \"@/attributes/render3d/orbit\";\nimport type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\nimport { Fills } from \"@/attributes/shape/fill/chain\";\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { gridGeometry3D, type Grid3DOptions } from \"@/components/builtins/three/grid-geometry3d\";\nimport type { BufferGeometry3D } from \"@/render3d/geometry\";\nimport { Graphics3D } from \"@/render3d/graphics3d\";\nimport { warmCanvas3D } from \"@/render3d/resources\";\nimport { resolveShadows3D, type PostEffect3D, type Shadows3D, type ToneMapping3D } from \"@/render3d/scene-settings\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport type { Canvas3DFillResolved } from \"@/attributes/shape/fill/implementations/canvas3d\";\nimport { isSurfaceTexture3D, resolveSurfaceSource } from \"@/render3d/texture\";\nimport { forEachTexture3D } from \"@/render3d/walk\";\nimport type { Loader, RenderContext2D, Type, Values } from \"@/components/factory/api\";\nimport { Types } from \"@/components/factory/types\";\nimport { internalsOf } from \"@/components/factory/views\";\nimport * as Corners from \"@/components/modules/corners\";\nimport * as Paint from \"@/components/modules/paint\";\nimport { optional } from \"@/components/modules/three-entries\";\n\n/**\n * A viewport onto its 3D children: the default camera and light rig a scene\n * gets when it has none of its own, the floor grid, and the render settings.\n */\n\nfunction color3D(initial: Color): Type<Color, NormalizedColor> {\n return Types.custom<Color, NormalizedColor>(initial, { resolve: resolveColor3D, lerp: lerpColor3D });\n}\n\nexport const state = {\n orbit: Types.number(35, { step: 1, unit: \"°\" }),\n elevation: Types.number(20, { min: -89, max: 89, step: 1, unit: \"°\" }),\n zoom: Types.number(12, { min: 0.01, step: 0.1 }),\n fov: Types.custom(45),\n ambientIntensity: Types.custom(0.45),\n ambientColor: color3D(\"#ffffff\"),\n keyIntensity: Types.custom(2.4),\n keyColor: color3D(\"#ffffff\"),\n showGrid: Types.custom(false),\n gridSize: Types.custom(40),\n gridDivisions: Types.custom(40),\n gridMajorEvery: Types.custom(5),\n gridColor: color3D(\"#26292f\"),\n gridMajorColor: color3D(\"#363a42\"),\n showAxes: Types.custom(false),\n axisXColor: color3D(\"#c8404f\"),\n axisZColor: color3D(\"#2f6fd0\"),\n gridFade: Types.custom(0.55),\n gridFadeColor: color3D(\"#0b0d12\"),\n maxPixelRatio: Types.custom(2),\n antialias: Types.custom(true),\n shadows: Types.custom<Shadows3D>(false),\n tone: optional<ToneMapping3D>(),\n exposure: optional<number>(),\n post: optional<PostEffect3D | readonly PostEffect3D[]>(),\n};\n\nexport const commands = {\n /** Swing the default camera: only the angles given move. */\n orbitTo: { args: [\"orbit\", \"elevation\", \"zoom\"] as const },\n};\n\ntype ViewState = Values<typeof state> & { readonly fill: FillResolved[] };\n\nconst loadThreeRuntime: LoaderFn = async () => {\n await warmCanvas3D();\n};\n\n/**\n * The 3D runtime, warmed before the first frame, and whatever `extend` draws:\n * pass the `extend` your render hands {@link draw}, so its textures, models and\n * surfaces load before a frame needs them, as a 3D child's own drawing does.\n */\nexport function load(loader: Loader, extend?: (scene: Scene3D) => void): void {\n loader.task(\"three:runtime\", loadThreeRuntime);\n if (!extend) return;\n const scene = new Scene3D();\n extend(scene);\n const fill: Canvas3DFillResolved = { type: \"canvas3D\", scene };\n loader.fill(fill);\n}\n\nconst grids = new WeakMap<object, { readonly key: string; readonly geometry: BufferGeometry3D }>();\n\n/**\n * Your 3D children's scene with this view's settings, its grid, and the default\n * camera and lights where the scene has none; `extend` draws more into it last.\n * `null` when there is nothing to show.\n */\nexport function scene(ctx: RenderContext2D, s: ViewState, extend?: (scene: Scene3D) => void): Scene3D | null {\n const scene = ctx.scene3D();\n const hasChildren = scene.ops().length > 0;\n const shadows = resolveShadows3D(s.shadows);\n if (shadows) scene.shadows(shadows);\n if (s.tone !== undefined || s.exposure !== undefined) scene.tone({ mapping: s.tone, exposure: s.exposure });\n if (s.post !== undefined) scene.post(s.post);\n const fog = scene.fogDescriptor();\n if (fog && fog.color === undefined) {\n const base = baseColor(s.fill);\n if (base !== undefined) scene.fog({ ...fog, color: base });\n }\n if (s.showGrid) {\n scene.draw(new Graphics3D().line({\n geometry: gridOf(internalsOf(ctx).host, s),\n segments: true,\n material: { type: \"lineBasic\", vertexColors: true, toneMapped: false },\n }));\n }\n if (!extend && scene.isEmpty() && !hasChildren) return null;\n if (scene.cameraDescriptor() === null) {\n scene.perspective({ fov: s.fov, orbit: cameraOrbit(s.orbit), elevation: s.elevation, distance: s.zoom });\n }\n if (!scene.ops().some((op) => op.kind === \"light\")) {\n scene\n .light({ type: \"ambient\", intensity: s.ambientIntensity, color: s.ambientColor })\n .light({ type: \"directional\", intensity: s.keyIntensity, color: s.keyColor }, { position: [4, 6, 3] })\n .light({ type: \"directional\", intensity: s.keyIntensity * 0.35, color: s.keyColor }, { position: [-5, -2, -4] });\n }\n extend?.(scene);\n return scene.isEmpty() ? null : scene;\n}\n\n/** The box painted, with the scene as its top fill layer. */\nexport function draw(ctx: RenderContext2D, s: ViewState & Parameters<typeof Paint.draw>[1] & Values<typeof Corners.state>, extend?: (scene: Scene3D) => void): void {\n const built = scene(ctx, s, extend);\n const internals = internalsOf(ctx);\n if (built && !internals.probing) {\n built.assertBalanced();\n // A surface texture draws a detached 2D node: it renders in this node's scope.\n const host = internals.host as unknown as { attachDetached(node: object): void };\n forEachTexture3D(built, (texture) => {\n if (!isSurfaceTexture3D(texture)) return;\n const source = resolveSurfaceSource(texture.source);\n if (source.kind === \"node\") host.attachDetached(source.node);\n });\n }\n const fill = built ? [...s.fill, ...Fills.canvas3D(built, { maxPixelRatio: s.maxPixelRatio, antialias: s.antialias })] : s.fill;\n Paint.draw(ctx, s, Corners.rect(ctx.size, s), { fill: fill as never });\n}\n\nfunction gridOf(host: object, s: ViewState): BufferGeometry3D {\n const options: Grid3DOptions = {\n size: s.gridSize,\n divisions: Math.max(1, Math.round(s.gridDivisions)),\n majorEvery: Math.max(1, Math.round(s.gridMajorEvery)),\n minorColor: s.gridColor,\n majorColor: s.gridMajorColor,\n axisXColor: s.axisXColor,\n axisZColor: s.axisZColor,\n showAxes: s.showAxes,\n fadeTo: fadeColor(s),\n fade: s.gridFade,\n };\n const key = JSON.stringify(options);\n let kept = grids.get(host);\n if (kept?.key !== key) grids.set(host, kept = { key, geometry: gridGeometry3D(options) });\n return kept.geometry;\n}\n\n/** The grid fades into the first visible solid fill, so it melts into the background. */\nfunction fadeColor(s: ViewState): Color {\n for (const layer of s.fill as unknown as readonly ({ type?: string; color?: unknown } | null)[]) {\n if (layer?.type !== \"solid\") continue;\n const color = layer.color;\n if (typeof color === \"string\") return color;\n if (Array.isArray(color) && (color[3] ?? 1) > 0) return color as Color;\n }\n return s.gridFadeColor;\n}\n\nfunction baseColor(fill: readonly FillResolved[]): Color | undefined {\n for (const layer of fill) {\n if (layer && (layer as { type?: string }).type === \"solid\") return (layer as unknown as { color: Color }).color;\n }\n return undefined;\n}\n"]}