@motionscript/core 0.1.0-alpha.7 → 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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -48
- package/README.md +91 -91
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +7 -5
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +73 -0
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/chain.js +67 -0
- package/dist/attributes/audio/effects/chain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/echo.js +2 -2
- package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/gain.js +2 -2
- package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/highpass.js +2 -2
- package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/lowpass.js +2 -2
- package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/tremolo.js +2 -2
- package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
- package/dist/attributes/audio/effects/index.d.ts +12 -0
- package/dist/attributes/audio/effects/index.d.ts.map +1 -0
- package/dist/attributes/audio/effects/index.js +4 -0
- package/dist/attributes/audio/effects/index.js.map +1 -0
- package/dist/attributes/audio/effects/registry.d.ts +36 -0
- package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
- package/dist/attributes/audio/effects/registry.js +80 -0
- package/dist/attributes/audio/effects/registry.js.map +1 -0
- package/dist/attributes/audio/effects/union.d.ts +14 -0
- package/dist/attributes/audio/effects/union.d.ts.map +1 -0
- package/dist/attributes/audio/effects/union.js +24 -0
- package/dist/attributes/audio/effects/union.js.map +1 -0
- package/dist/attributes/audio/ramp.d.ts +103 -0
- package/dist/attributes/audio/ramp.d.ts.map +1 -0
- package/dist/attributes/audio/ramp.js +246 -0
- package/dist/attributes/audio/ramp.js.map +1 -0
- package/dist/attributes/audio/request.d.ts +24 -13
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +4 -3
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +21 -13
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +42 -28
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +15 -12
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -10
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.d.ts +33 -0
- package/dist/attributes/audio/transition.d.ts.map +1 -0
- package/dist/attributes/audio/transition.js +48 -0
- package/dist/attributes/audio/transition.js.map +1 -0
- package/dist/attributes/index.d.ts +4 -3
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +4 -7
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +7 -7
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +6 -6
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +1 -2
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +96 -409
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +93 -283
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
- package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
- package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js +13 -5
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
- package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +26 -23
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +26 -20
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +17 -14
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js +28 -22
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
- package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js +74 -72
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
- package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js +21 -18
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js +15 -10
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
- package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js +20 -16
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
- package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
- package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js +18 -17
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
- package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
- package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +42 -26
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js +19 -16
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
- package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
- package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
- package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js +26 -23
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +4 -2
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +11 -0
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +113 -102
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.d.ts +229 -0
- package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
- package/dist/attributes/shape/effects/spec.js +178 -0
- package/dist/attributes/shape/effects/spec.js.map +1 -0
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.d.ts +7 -9
- package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
- package/dist/attributes/shape/fill/chain.js +9 -11
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +20 -14
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.d.ts +1 -1
- package/dist/attributes/shape/fill/index.d.ts.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +1 -2
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +1 -2
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +2 -6
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -5
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +1 -1
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +2 -3
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.d.ts +2 -0
- package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/index.js +2 -0
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +26 -0
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/language.js +20 -0
- package/dist/attributes/shape/shaders/language.js.map +1 -0
- package/dist/attributes/shape/shaders/pack.d.ts +25 -11
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +9 -4
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -6
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
- package/dist/browser/chunks/chunk-7DB6BI27.js +6 -0
- package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
- package/dist/browser/chunks/chunk-IX53IFBD.js +13 -0
- package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
- package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
- package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/experimental.js.map +4 -4
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.d.ts +14 -5
- package/dist/components/builtins/audio/audio.d.ts.map +1 -1
- package/dist/components/builtins/audio/audio.js +10 -13
- package/dist/components/builtins/audio/audio.js.map +1 -1
- package/dist/components/builtins/geometry/composite.d.ts +3 -3
- package/dist/components/builtins/geometry/composite.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- package/dist/components/builtins/media/media.d.ts +7 -7
- package/dist/components/builtins/media/media.d.ts.map +1 -1
- package/dist/components/builtins/media/media.js +4 -10
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/providers/providers.js.map +1 -1
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +9 -9
- package/dist/components/builtins/text/text.d.ts.map +1 -1
- package/dist/components/builtins/text/text.js +3 -0
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.js.map +1 -1
- package/dist/components/factory/api.d.ts +38 -11
- package/dist/components/factory/api.d.ts.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/clip-of.js.map +1 -1
- package/dist/components/factory/commands-for.js.map +1 -1
- package/dist/components/factory/component-audio.js.map +1 -1
- package/dist/components/factory/component2d.js.map +1 -1
- package/dist/components/factory/component3d.d.ts.map +1 -1
- package/dist/components/factory/component3d.js +11 -3
- package/dist/components/factory/component3d.js.map +1 -1
- package/dist/components/factory/factory.d.ts +3 -0
- package/dist/components/factory/factory.d.ts.map +1 -1
- package/dist/components/factory/factory.js +39 -5
- package/dist/components/factory/factory.js.map +1 -1
- package/dist/components/factory/timeline.js.map +1 -1
- package/dist/components/factory/type-def.js.map +1 -1
- package/dist/components/factory/types.js.map +1 -1
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/modules/aim.js.map +1 -1
- package/dist/components/modules/corners.js.map +1 -1
- package/dist/components/modules/flow.js.map +1 -1
- package/dist/components/modules/material.js.map +1 -1
- package/dist/components/modules/paint.js.map +1 -1
- package/dist/components/modules/shapes.js.map +1 -1
- package/dist/components/modules/text-layout.js.map +1 -1
- package/dist/components/modules/text-style.js.map +1 -1
- package/dist/components/modules/three-entries.js.map +1 -1
- package/dist/components/modules/view3d.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.js.map +1 -1
- package/dist/components/trees/2d/node-render.d.ts +1 -1
- package/dist/components/trees/2d/node-render.js +1 -1
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.js.map +1 -1
- package/dist/components/trees/2d/node2d.d.ts +1 -1
- package/dist/components/trees/2d/node2d.js +1 -1
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/index.js.map +1 -1
- package/dist/components/trees/audio/node-audio.d.ts +16 -9
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
- package/dist/components/trees/audio/node-audio.js +15 -11
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/components/trees/index.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +12 -2
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +34 -6
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +8 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +4 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +70 -0
- package/dist/document/migrate.d.ts.map +1 -0
- package/dist/document/migrate.js +202 -0
- package/dist/document/migrate.js.map +1 -0
- package/dist/document/missing-node.d.ts +27 -0
- package/dist/document/missing-node.d.ts.map +1 -0
- package/dist/document/missing-node.js +48 -0
- package/dist/document/missing-node.js.map +1 -0
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +4 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +2 -1
- package/dist/document/placement.d.ts.map +1 -1
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.d.ts +2 -0
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js +1 -0
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.d.ts +51 -0
- package/dist/document/prop-evolution.d.ts.map +1 -0
- package/dist/document/prop-evolution.js +83 -0
- package/dist/document/prop-evolution.js.map +1 -0
- package/dist/document/registry.d.ts +16 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +30 -4
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +2 -0
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +5 -5
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.d.ts +4 -0
- package/dist/document/timeline-patch.d.ts.map +1 -1
- package/dist/document/timeline-patch.js +28 -3
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +45 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +172 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +14 -28
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +17 -5
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +158 -21
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.d.ts +28 -0
- package/dist/document/vocabulary.d.ts.map +1 -0
- package/dist/document/vocabulary.js +42 -0
- package/dist/document/vocabulary.js.map +1 -0
- package/dist/experimental.d.ts +68 -8
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +22 -8
- package/dist/experimental.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -0
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +1 -1
- package/dist/renamed-scene-names.d.ts.map +1 -1
- package/dist/renamed-scene-names.js +1 -1
- package/dist/renamed-scene-names.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +9 -0
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/render-issue.d.ts +39 -0
- package/dist/render/render-issue.d.ts.map +1 -0
- package/dist/render/render-issue.js +29 -0
- package/dist/render/render-issue.js.map +1 -0
- package/dist/render/surface.d.ts +2 -2
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +54 -5
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js +2 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +10 -0
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +7 -0
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +3 -1
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +4 -0
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +17 -2
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -3
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.js.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +14 -4
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +7 -3
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +11 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +8 -6
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +10 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +7 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +1 -0
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +2 -0
- package/dist/tween/ease/describe.d.ts.map +1 -1
- package/dist/tween/ease/describe.js +4 -0
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.d.ts +31 -0
- package/dist/tween/ease/spec.d.ts.map +1 -0
- package/dist/tween/ease/spec.js +51 -0
- package/dist/tween/ease/spec.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.d.ts +1 -0
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +1 -0
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +2 -2
- package/dist/attributes/audio/filters/chain.d.ts +0 -113
- package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/chain.js +0 -104
- package/dist/attributes/audio/filters/chain.js.map +0 -1
- package/dist/attributes/audio/filters/curve.d.ts +0 -152
- package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
- package/dist/attributes/audio/filters/curve.js +0 -250
- package/dist/attributes/audio/filters/curve.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
- package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
- package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
- package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.js +0 -6
- package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
- package/dist/attributes/audio/filters/index.d.ts +0 -22
- package/dist/attributes/audio/filters/index.d.ts.map +0 -1
- package/dist/attributes/audio/filters/index.js +0 -8
- package/dist/attributes/audio/filters/index.js.map +0 -1
- package/dist/attributes/audio/filters/registry.d.ts +0 -36
- package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
- package/dist/attributes/audio/filters/registry.js +0 -82
- package/dist/attributes/audio/filters/registry.js.map +0 -1
- package/dist/attributes/audio/filters/union.d.ts +0 -18
- package/dist/attributes/audio/filters/union.d.ts.map +0 -1
- package/dist/attributes/audio/filters/union.js +0 -28
- package/dist/attributes/audio/filters/union.js.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
- package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.js +0 -0
- package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
- package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
- package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
- package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
- package/dist/component/api.d.ts +0 -508
- package/dist/component/api.d.ts.map +0 -1
- package/dist/component/api.js +0 -4
- package/dist/component/api.js.map +0 -1
- package/dist/component/builtins/audio.d.ts +0 -26
- package/dist/component/builtins/audio.d.ts.map +0 -1
- package/dist/component/builtins/audio.js +0 -41
- package/dist/component/builtins/audio.js.map +0 -1
- package/dist/component/builtins/canvas3d.d.ts +0 -98
- package/dist/component/builtins/canvas3d.d.ts.map +0 -1
- package/dist/component/builtins/canvas3d.js +0 -21
- package/dist/component/builtins/canvas3d.js.map +0 -1
- package/dist/component/builtins/composite.d.ts +0 -56
- package/dist/component/builtins/composite.d.ts.map +0 -1
- package/dist/component/builtins/composite.js +0 -25
- package/dist/component/builtins/composite.js.map +0 -1
- package/dist/component/builtins/geometry.d.ts +0 -505
- package/dist/component/builtins/geometry.d.ts.map +0 -1
- package/dist/component/builtins/geometry.js +0 -107
- package/dist/component/builtins/geometry.js.map +0 -1
- package/dist/component/builtins/layout.d.ts +0 -88
- package/dist/component/builtins/layout.d.ts.map +0 -1
- package/dist/component/builtins/layout.js +0 -84
- package/dist/component/builtins/layout.js.map +0 -1
- package/dist/component/builtins/media.d.ts +0 -95
- package/dist/component/builtins/media.d.ts.map +0 -1
- package/dist/component/builtins/media.js +0 -149
- package/dist/component/builtins/media.js.map +0 -1
- package/dist/component/builtins/providers.d.ts +0 -23
- package/dist/component/builtins/providers.d.ts.map +0 -1
- package/dist/component/builtins/providers.js +0 -30
- package/dist/component/builtins/providers.js.map +0 -1
- package/dist/component/builtins/text.d.ts +0 -193
- package/dist/component/builtins/text.d.ts.map +0 -1
- package/dist/component/builtins/text.js +0 -113
- package/dist/component/builtins/text.js.map +0 -1
- package/dist/component/builtins/three.d.ts +0 -1085
- package/dist/component/builtins/three.d.ts.map +0 -1
- package/dist/component/builtins/three.js +0 -265
- package/dist/component/builtins/three.js.map +0 -1
- package/dist/component/clip-of.d.ts +0 -5
- package/dist/component/clip-of.d.ts.map +0 -1
- package/dist/component/clip-of.js +0 -33
- package/dist/component/clip-of.js.map +0 -1
- package/dist/component/commands-for.d.ts +0 -19
- package/dist/component/commands-for.d.ts.map +0 -1
- package/dist/component/commands-for.js +0 -5
- package/dist/component/commands-for.js.map +0 -1
- package/dist/component/component-audio.d.ts +0 -9
- package/dist/component/component-audio.d.ts.map +0 -1
- package/dist/component/component-audio.js +0 -18
- package/dist/component/component-audio.js.map +0 -1
- package/dist/component/component2d.d.ts +0 -9
- package/dist/component/component2d.d.ts.map +0 -1
- package/dist/component/component2d.js +0 -239
- package/dist/component/component2d.js.map +0 -1
- package/dist/component/component3d.d.ts +0 -9
- package/dist/component/component3d.d.ts.map +0 -1
- package/dist/component/component3d.js +0 -99
- package/dist/component/component3d.js.map +0 -1
- package/dist/component/factory.d.ts +0 -63
- package/dist/component/factory.d.ts.map +0 -1
- package/dist/component/factory.js +0 -313
- package/dist/component/factory.js.map +0 -1
- package/dist/component/modules/aim.d.ts +0 -30
- package/dist/component/modules/aim.d.ts.map +0 -1
- package/dist/component/modules/aim.js +0 -39
- package/dist/component/modules/aim.js.map +0 -1
- package/dist/component/modules/corners.d.ts +0 -13
- package/dist/component/modules/corners.d.ts.map +0 -1
- package/dist/component/modules/corners.js +0 -12
- package/dist/component/modules/corners.js.map +0 -1
- package/dist/component/modules/flow.d.ts +0 -26
- package/dist/component/modules/flow.d.ts.map +0 -1
- package/dist/component/modules/flow.js +0 -55
- package/dist/component/modules/flow.js.map +0 -1
- package/dist/component/modules/material.d.ts +0 -40
- package/dist/component/modules/material.d.ts.map +0 -1
- package/dist/component/modules/material.js +0 -75
- package/dist/component/modules/material.js.map +0 -1
- package/dist/component/modules/paint.d.ts +0 -71
- package/dist/component/modules/paint.d.ts.map +0 -1
- package/dist/component/modules/paint.js +0 -106
- package/dist/component/modules/paint.js.map +0 -1
- package/dist/component/modules/shapes.d.ts +0 -31
- package/dist/component/modules/shapes.d.ts.map +0 -1
- package/dist/component/modules/shapes.js +0 -43
- package/dist/component/modules/shapes.js.map +0 -1
- package/dist/component/modules/text-layout.d.ts +0 -26
- package/dist/component/modules/text-layout.d.ts.map +0 -1
- package/dist/component/modules/text-layout.js +0 -57
- package/dist/component/modules/text-layout.js.map +0 -1
- package/dist/component/modules/text-style.d.ts +0 -48
- package/dist/component/modules/text-style.d.ts.map +0 -1
- package/dist/component/modules/text-style.js +0 -63
- package/dist/component/modules/text-style.js.map +0 -1
- package/dist/component/modules/three-entries.d.ts +0 -23
- package/dist/component/modules/three-entries.d.ts.map +0 -1
- package/dist/component/modules/three-entries.js +0 -41
- package/dist/component/modules/three-entries.js.map +0 -1
- package/dist/component/modules/view3d.d.ts +0 -55
- package/dist/component/modules/view3d.d.ts.map +0 -1
- package/dist/component/modules/view3d.js +0 -160
- package/dist/component/modules/view3d.js.map +0 -1
- package/dist/component/timeline.d.ts +0 -22
- package/dist/component/timeline.d.ts.map +0 -1
- package/dist/component/timeline.js +0 -128
- package/dist/component/timeline.js.map +0 -1
- package/dist/component/type-def.d.ts +0 -26
- package/dist/component/type-def.d.ts.map +0 -1
- package/dist/component/type-def.js +0 -16
- package/dist/component/type-def.js.map +0 -1
- package/dist/component/types.d.ts +0 -91
- package/dist/component/types.d.ts.map +0 -1
- package/dist/component/types.js +0 -88
- package/dist/component/types.js.map +0 -1
- package/dist/component/views.d.ts +0 -121
- package/dist/component/views.d.ts.map +0 -1
- package/dist/component/views.js +0 -413
- package/dist/component/views.js.map +0 -1
- package/dist/document/withdraw.d.ts +0 -28
- package/dist/document/withdraw.d.ts.map +0 -1
- package/dist/document/withdraw.js +0 -61
- package/dist/document/withdraw.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
- package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-dev-runtime.js +0 -3
- package/dist/jsx/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx/jsx-runtime.d.ts +0 -27
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -26
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
- package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
- package/dist/nodes/2d/node-lifecycle.js +0 -264
- package/dist/nodes/2d/node-lifecycle.js.map +0 -1
- package/dist/nodes/2d/node-motion.d.ts +0 -56
- package/dist/nodes/2d/node-motion.d.ts.map +0 -1
- package/dist/nodes/2d/node-motion.js +0 -86
- package/dist/nodes/2d/node-motion.js.map +0 -1
- package/dist/nodes/2d/node-render.d.ts +0 -44
- package/dist/nodes/2d/node-render.d.ts.map +0 -1
- package/dist/nodes/2d/node-render.js +0 -80
- package/dist/nodes/2d/node-render.js.map +0 -1
- package/dist/nodes/2d/node-space.d.ts +0 -63
- package/dist/nodes/2d/node-space.d.ts.map +0 -1
- package/dist/nodes/2d/node-space.js +0 -131
- package/dist/nodes/2d/node-space.js.map +0 -1
- package/dist/nodes/2d/node-transform.d.ts +0 -55
- package/dist/nodes/2d/node-transform.d.ts.map +0 -1
- package/dist/nodes/2d/node-transform.js +0 -73
- package/dist/nodes/2d/node-transform.js.map +0 -1
- package/dist/nodes/2d/node2d.d.ts +0 -1111
- package/dist/nodes/2d/node2d.d.ts.map +0 -1
- package/dist/nodes/2d/node2d.js +0 -1665
- package/dist/nodes/2d/node2d.js.map +0 -1
- package/dist/nodes/2d/paint-node.d.ts +0 -142
- package/dist/nodes/2d/paint-node.d.ts.map +0 -1
- package/dist/nodes/2d/paint-node.js +0 -232
- package/dist/nodes/2d/paint-node.js.map +0 -1
- package/dist/nodes/audio/audio-bus.d.ts +0 -28
- package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
- package/dist/nodes/audio/audio-bus.js +0 -33
- package/dist/nodes/audio/audio-bus.js.map +0 -1
- package/dist/nodes/audio/index.d.ts +0 -4
- package/dist/nodes/audio/index.d.ts.map +0 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +0 -1
- package/dist/nodes/audio/node-audio.d.ts +0 -107
- package/dist/nodes/audio/node-audio.d.ts.map +0 -1
- package/dist/nodes/audio/node-audio.js +0 -179
- package/dist/nodes/audio/node-audio.js.map +0 -1
- package/dist/nodes/audio/sound-node.d.ts +0 -41
- package/dist/nodes/audio/sound-node.d.ts.map +0 -1
- package/dist/nodes/audio/sound-node.js +0 -71
- package/dist/nodes/audio/sound-node.js.map +0 -1
- package/dist/nodes/geometry/boolean-node.d.ts +0 -28
- package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
- package/dist/nodes/geometry/boolean-node.js +0 -81
- package/dist/nodes/geometry/boolean-node.js.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
- package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.js +0 -181
- package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
- package/dist/nodes/geometry/box-path-node.d.ts +0 -89
- package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/box-path-node.js +0 -116
- package/dist/nodes/geometry/box-path-node.js.map +0 -1
- package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
- package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
- package/dist/nodes/geometry/ellipse-node.js +0 -45
- package/dist/nodes/geometry/ellipse-node.js.map +0 -1
- package/dist/nodes/geometry/group-bounds.d.ts +0 -56
- package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
- package/dist/nodes/geometry/group-bounds.js +0 -87
- package/dist/nodes/geometry/group-bounds.js.map +0 -1
- package/dist/nodes/geometry/mask-node.d.ts +0 -33
- package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
- package/dist/nodes/geometry/mask-node.js +0 -66
- package/dist/nodes/geometry/mask-node.js.map +0 -1
- package/dist/nodes/geometry/path-node.d.ts +0 -26
- package/dist/nodes/geometry/path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/path-node.js +0 -58
- package/dist/nodes/geometry/path-node.js.map +0 -1
- package/dist/nodes/geometry/polygon-node.d.ts +0 -26
- package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygon-node.js +0 -47
- package/dist/nodes/geometry/polygon-node.js.map +0 -1
- package/dist/nodes/geometry/polygram-node.d.ts +0 -33
- package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygram-node.js +0 -52
- package/dist/nodes/geometry/polygram-node.js.map +0 -1
- package/dist/nodes/geometry/rect-node.d.ts +0 -38
- package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
- package/dist/nodes/geometry/rect-node.js +0 -56
- package/dist/nodes/geometry/rect-node.js.map +0 -1
- package/dist/nodes/geometry/shape-node.d.ts +0 -71
- package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-node.js +0 -140
- package/dist/nodes/geometry/shape-node.js.map +0 -1
- package/dist/nodes/geometry/shape-outline.d.ts +0 -93
- package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-outline.js +0 -470
- package/dist/nodes/geometry/shape-outline.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -53
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -35
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/layout/camera-node.d.ts +0 -80
- package/dist/nodes/layout/camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/camera-node.js +0 -153
- package/dist/nodes/layout/camera-node.js.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
- package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.js +0 -118
- package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
- package/dist/nodes/layout/rotated-box.d.ts +0 -20
- package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
- package/dist/nodes/layout/rotated-box.js +0 -76
- package/dist/nodes/layout/rotated-box.js.map +0 -1
- package/dist/nodes/media/video-node.d.ts +0 -229
- package/dist/nodes/media/video-node.d.ts.map +0 -1
- package/dist/nodes/media/video-node.js +0 -350
- package/dist/nodes/media/video-node.js.map +0 -1
- package/dist/nodes/node/declare-paints.d.ts +0 -19
- package/dist/nodes/node/declare-paints.d.ts.map +0 -1
- package/dist/nodes/node/declare-paints.js +0 -27
- package/dist/nodes/node/declare-paints.js.map +0 -1
- package/dist/nodes/node/node-editor-state.d.ts +0 -53
- package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
- package/dist/nodes/node/node-editor-state.js +0 -23
- package/dist/nodes/node/node-editor-state.js.map +0 -1
- package/dist/nodes/node/node-reactive.d.ts +0 -89
- package/dist/nodes/node/node-reactive.d.ts.map +0 -1
- package/dist/nodes/node/node-reactive.js +0 -135
- package/dist/nodes/node/node-reactive.js.map +0 -1
- package/dist/nodes/node/node-time.d.ts +0 -39
- package/dist/nodes/node/node-time.d.ts.map +0 -1
- package/dist/nodes/node/node-time.js +0 -14
- package/dist/nodes/node/node-time.js.map +0 -1
- package/dist/nodes/node/node-walk.d.ts +0 -46
- package/dist/nodes/node/node-walk.d.ts.map +0 -1
- package/dist/nodes/node/node-walk.js +0 -74
- package/dist/nodes/node/node-walk.js.map +0 -1
- package/dist/nodes/node/node.d.ts +0 -445
- package/dist/nodes/node/node.d.ts.map +0 -1
- package/dist/nodes/node/node.js +0 -745
- package/dist/nodes/node/node.js.map +0 -1
- package/dist/nodes/node/text-defaults.d.ts +0 -32
- package/dist/nodes/node/text-defaults.d.ts.map +0 -1
- package/dist/nodes/node/text-defaults.js +0 -37
- package/dist/nodes/node/text-defaults.js.map +0 -1
- package/dist/nodes/root/canvas2d-node.d.ts +0 -163
- package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/root/canvas2d-node.js +0 -264
- package/dist/nodes/root/canvas2d-node.js.map +0 -1
- package/dist/nodes/root/provider-node.d.ts +0 -47
- package/dist/nodes/root/provider-node.d.ts.map +0 -1
- package/dist/nodes/root/provider-node.js +0 -63
- package/dist/nodes/root/provider-node.js.map +0 -1
- package/dist/nodes/root/theme-provider-node.d.ts +0 -29
- package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/root/theme-provider-node.js +0 -43
- package/dist/nodes/root/theme-provider-node.js.map +0 -1
- package/dist/nodes/text/default-text-style-node.d.ts +0 -103
- package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
- package/dist/nodes/text/default-text-style-node.js +0 -146
- package/dist/nodes/text/default-text-style-node.js.map +0 -1
- package/dist/nodes/text/number-format.d.ts +0 -66
- package/dist/nodes/text/number-format.d.ts.map +0 -1
- package/dist/nodes/text/number-format.js +0 -227
- package/dist/nodes/text/number-format.js.map +0 -1
- package/dist/nodes/text/number-node.d.ts +0 -94
- package/dist/nodes/text/number-node.d.ts.map +0 -1
- package/dist/nodes/text/number-node.js +0 -86
- package/dist/nodes/text/number-node.js.map +0 -1
- package/dist/nodes/text/number-pattern.d.ts +0 -51
- package/dist/nodes/text/number-pattern.d.ts.map +0 -1
- package/dist/nodes/text/number-pattern.js +0 -77
- package/dist/nodes/text/number-pattern.js.map +0 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -68
- package/dist/nodes/text/richtext-node.d.ts.map +0 -1
- package/dist/nodes/text/richtext-node.js +0 -78
- package/dist/nodes/text/richtext-node.js.map +0 -1
- package/dist/nodes/text/text-base.d.ts +0 -118
- package/dist/nodes/text/text-base.d.ts.map +0 -1
- package/dist/nodes/text/text-base.js +0 -153
- package/dist/nodes/text/text-base.js.map +0 -1
- package/dist/nodes/text/text-layout.d.ts +0 -87
- package/dist/nodes/text/text-layout.d.ts.map +0 -1
- package/dist/nodes/text/text-layout.js +0 -368
- package/dist/nodes/text/text-layout.js.map +0 -1
- package/dist/nodes/text/text-node.d.ts +0 -84
- package/dist/nodes/text/text-node.d.ts.map +0 -1
- package/dist/nodes/text/text-node.js +0 -188
- package/dist/nodes/text/text-node.js.map +0 -1
- package/dist/nodes/text/text-selection.d.ts +0 -125
- package/dist/nodes/text/text-selection.d.ts.map +0 -1
- package/dist/nodes/text/text-selection.js +0 -209
- package/dist/nodes/text/text-selection.js.map +0 -1
- package/dist/nodes/three/camera-nodes.d.ts +0 -109
- package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
- package/dist/nodes/three/camera-nodes.js +0 -112
- package/dist/nodes/three/camera-nodes.js.map +0 -1
- package/dist/nodes/three/canvas3d-node.d.ts +0 -295
- package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
- package/dist/nodes/three/canvas3d-node.js +0 -486
- package/dist/nodes/three/canvas3d-node.js.map +0 -1
- package/dist/nodes/three/drawable-nodes.d.ts +0 -173
- package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
- package/dist/nodes/three/drawable-nodes.js +0 -284
- package/dist/nodes/three/drawable-nodes.js.map +0 -1
- package/dist/nodes/three/environment-nodes.d.ts +0 -106
- package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
- package/dist/nodes/three/environment-nodes.js +0 -134
- package/dist/nodes/three/environment-nodes.js.map +0 -1
- package/dist/nodes/three/geometry-nodes.d.ts +0 -197
- package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
- package/dist/nodes/three/geometry-nodes.js +0 -322
- package/dist/nodes/three/geometry-nodes.js.map +0 -1
- package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
- package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
- package/dist/nodes/three/grid-geometry3d.js +0 -114
- package/dist/nodes/three/grid-geometry3d.js.map +0 -1
- package/dist/nodes/three/group3d.d.ts +0 -23
- package/dist/nodes/three/group3d.d.ts.map +0 -1
- package/dist/nodes/three/group3d.js +0 -21
- package/dist/nodes/three/group3d.js.map +0 -1
- package/dist/nodes/three/light-nodes.d.ts +0 -120
- package/dist/nodes/three/light-nodes.d.ts.map +0 -1
- package/dist/nodes/three/light-nodes.js +0 -173
- package/dist/nodes/three/light-nodes.js.map +0 -1
- package/dist/nodes/three/mesh3d.d.ts +0 -117
- package/dist/nodes/three/mesh3d.d.ts.map +0 -1
- package/dist/nodes/three/mesh3d.js +0 -147
- package/dist/nodes/three/mesh3d.js.map +0 -1
- package/dist/nodes/three/node3d.d.ts +0 -230
- package/dist/nodes/three/node3d.d.ts.map +0 -1
- package/dist/nodes/three/node3d.js +0 -337
- package/dist/nodes/three/node3d.js.map +0 -1
- package/dist/render/descriptors/latex.d.ts +0 -6
- package/dist/render/descriptors/latex.d.ts.map +0 -1
- package/dist/render/descriptors/latex.js +0 -2
- package/dist/render/descriptors/latex.js.map +0 -1
- package/dist/tween/seekable.d.ts +0 -81
- package/dist/tween/seekable.d.ts.map +0 -1
- package/dist/tween/seekable.js +0 -137
- package/dist/tween/seekable.js.map +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a render issue is about:
|
|
3
|
+
*
|
|
4
|
+
* - `missing`: a feature the backend does not draw (`feature` names it).
|
|
5
|
+
* - `shader`: a user shader that does not compile, or one that is not WGSL (an SkSL shader from an old document).
|
|
6
|
+
* - `params`: a shader's uniforms and its `struct Params` disagree (a value with no member, a member with no value).
|
|
7
|
+
* - `gpu`: a WebGPU validation or out-of-memory error.
|
|
8
|
+
* - `device-lost`: the GPU device was lost; the backend is drawing on a new one.
|
|
9
|
+
* - `crashed`: the backend itself failed and draws nothing more on this page.
|
|
10
|
+
*/
|
|
11
|
+
export type RenderIssueKind = "missing" | "shader" | "params" | "gpu" | "device-lost" | "crashed";
|
|
12
|
+
/** Something a frame drew without throwing but not as the document says. */
|
|
13
|
+
export interface RenderIssue {
|
|
14
|
+
kind: RenderIssueKind;
|
|
15
|
+
message: string;
|
|
16
|
+
/** What is affected, as the backend names it (`blend:color-dodge`, `text:path`, `fill:shader`). */
|
|
17
|
+
feature?: string;
|
|
18
|
+
/** The node it was found on, when the backend knows. */
|
|
19
|
+
nodeId?: string;
|
|
20
|
+
}
|
|
21
|
+
/** A backend's issue as a typed one; a bare string is the shader message backends reported before issues were typed. */
|
|
22
|
+
export declare function toRenderIssue(issue: RenderIssue | string): RenderIssue;
|
|
23
|
+
/** One key per kind, feature and node: what an issue list is deduplicated by. */
|
|
24
|
+
export declare function renderIssueKey(issue: RenderIssue): string;
|
|
25
|
+
/**
|
|
26
|
+
* The backend lost what it draws with while a render was under way, so the
|
|
27
|
+
* frames already drawn cannot be trusted. Thrown by exports and stills on a
|
|
28
|
+
* `device-lost` or `crashed` issue; `retryable` says whether the same render
|
|
29
|
+
* can simply run again (the backend recovered on a new device).
|
|
30
|
+
*/
|
|
31
|
+
export declare class RenderBackendError extends Error {
|
|
32
|
+
readonly issue: RenderIssue;
|
|
33
|
+
readonly name = "RenderBackendError";
|
|
34
|
+
readonly retryable: boolean;
|
|
35
|
+
constructor(issue: RenderIssue);
|
|
36
|
+
}
|
|
37
|
+
/** Whether an issue means the frames drawn around it are not to be trusted. */
|
|
38
|
+
export declare function isFatalRenderIssue(issue: RenderIssue): boolean;
|
|
39
|
+
//# sourceMappingURL=render-issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-issue.d.ts","sourceRoot":"","sources":["../../src/render/render-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,aAAa,GAAG,SAAS,CAAC;AAElG,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wHAAwH;AACxH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,WAAW,CAEtE;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAI7B,QAAQ,CAAC,KAAK,EAAE,WAAW;IAHvC,SAAkB,IAAI,wBAAwB;IAC9C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;gBAEP,KAAK,EAAE,WAAW;CAI1C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE9D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A backend's issue as a typed one; a bare string is the shader message backends reported before issues were typed. */
|
|
2
|
+
export function toRenderIssue(issue) {
|
|
3
|
+
return typeof issue === "string" ? { kind: "shader", message: issue } : issue;
|
|
4
|
+
}
|
|
5
|
+
/** One key per kind, feature and node: what an issue list is deduplicated by. */
|
|
6
|
+
export function renderIssueKey(issue) {
|
|
7
|
+
return `${issue.kind}|${issue.feature ?? ""}|${issue.nodeId ?? ""}|${issue.feature ? "" : issue.message}`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The backend lost what it draws with while a render was under way, so the
|
|
11
|
+
* frames already drawn cannot be trusted. Thrown by exports and stills on a
|
|
12
|
+
* `device-lost` or `crashed` issue; `retryable` says whether the same render
|
|
13
|
+
* can simply run again (the backend recovered on a new device).
|
|
14
|
+
*/
|
|
15
|
+
export class RenderBackendError extends Error {
|
|
16
|
+
issue;
|
|
17
|
+
name = "RenderBackendError";
|
|
18
|
+
retryable;
|
|
19
|
+
constructor(issue) {
|
|
20
|
+
super(issue.message);
|
|
21
|
+
this.issue = issue;
|
|
22
|
+
this.retryable = issue.kind === "device-lost";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Whether an issue means the frames drawn around it are not to be trusted. */
|
|
26
|
+
export function isFatalRenderIssue(issue) {
|
|
27
|
+
return issue.kind === "device-lost" || issue.kind === "crashed";
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=render-issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-issue.js","sourceRoot":"","sources":["../../src/render/render-issue.ts"],"names":[],"mappings":"AAsBA,wHAAwH;AACxH,MAAM,UAAU,aAAa,CAAC,KAA2B;IACrD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAClF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,KAAkB;IAC7C,OAAO,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AAC9G,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAIpB;IAHH,IAAI,GAAG,oBAAoB,CAAC;IACrC,SAAS,CAAU;IAE5B,YAAqB,KAAkB;QACnC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QADJ,UAAK,GAAL,KAAK,CAAa;QAEnC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC;IAClD,CAAC;CACJ;AAED,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAAC,KAAkB;IACjD,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AACpE,CAAC","sourcesContent":["/**\n * What a render issue is about:\n *\n * - `missing`: a feature the backend does not draw (`feature` names it).\n * - `shader`: a user shader that does not compile, or one that is not WGSL (an SkSL shader from an old document).\n * - `params`: a shader's uniforms and its `struct Params` disagree (a value with no member, a member with no value).\n * - `gpu`: a WebGPU validation or out-of-memory error.\n * - `device-lost`: the GPU device was lost; the backend is drawing on a new one.\n * - `crashed`: the backend itself failed and draws nothing more on this page.\n */\nexport type RenderIssueKind = \"missing\" | \"shader\" | \"params\" | \"gpu\" | \"device-lost\" | \"crashed\";\n\n/** Something a frame drew without throwing but not as the document says. */\nexport interface RenderIssue {\n kind: RenderIssueKind;\n message: string;\n /** What is affected, as the backend names it (`blend:color-dodge`, `text:path`, `fill:shader`). */\n feature?: string;\n /** The node it was found on, when the backend knows. */\n nodeId?: string;\n}\n\n/** A backend's issue as a typed one; a bare string is the shader message backends reported before issues were typed. */\nexport function toRenderIssue(issue: RenderIssue | string): RenderIssue {\n return typeof issue === \"string\" ? { kind: \"shader\", message: issue } : issue;\n}\n\n/** One key per kind, feature and node: what an issue list is deduplicated by. */\nexport function renderIssueKey(issue: RenderIssue): string {\n return `${issue.kind}|${issue.feature ?? \"\"}|${issue.nodeId ?? \"\"}|${issue.feature ? \"\" : issue.message}`;\n}\n\n/**\n * The backend lost what it draws with while a render was under way, so the\n * frames already drawn cannot be trusted. Thrown by exports and stills on a\n * `device-lost` or `crashed` issue; `retryable` says whether the same render\n * can simply run again (the backend recovered on a new device).\n */\nexport class RenderBackendError extends Error {\n override readonly name = \"RenderBackendError\";\n readonly retryable: boolean;\n\n constructor(readonly issue: RenderIssue) {\n super(issue.message);\n this.retryable = issue.kind === \"device-lost\";\n }\n}\n\n/** Whether an issue means the frames drawn around it are not to be trusted. */\nexport function isFatalRenderIssue(issue: RenderIssue): boolean {\n return issue.kind === \"device-lost\" || issue.kind === \"crashed\";\n}\n"]}
|
package/dist/render/surface.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import { Size2D } from "../attributes/layout/size.js";
|
|
|
11
11
|
* with `lib: ["ES2022"]` and no DOM, deliberately, so this layer cannot name a
|
|
12
12
|
* canvas — and it does not need to: a browser backend takes a canvas, a headless
|
|
13
13
|
* one takes a size. Each narrows the argument at its own `mount`, where the
|
|
14
|
-
* relevant types exist.
|
|
15
|
-
*
|
|
14
|
+
* relevant types exist. A backend's context satisfies this structurally, so it
|
|
15
|
+
* never imports it.
|
|
16
16
|
*/
|
|
17
17
|
export interface RenderSurface {
|
|
18
18
|
mount(target: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/render/surface.ts"],"names":[],"mappings":"","sourcesContent":["import { Size2D } from \"@/attributes/layout/size\";\
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/render/surface.ts"],"names":[],"mappings":"","sourcesContent":["import { Size2D } from \"@/attributes/layout/size\";\n\n/**\n * The host-facing half of a render context: where pixels land, and how the\n * preview frames them.\n *\n * Split out from `CanvasRenderContext2D` because a *node* never touches any of\n * it — a node draws, and the host decides what it is drawing into. A `Session`\n * owns one of these; a node is handed a `RenderContext2D`.\n *\n * **`mount` takes `unknown`, not `HTMLCanvasElement`.** `packages/core` compiles\n * with `lib: [\"ES2022\"]` and no DOM, deliberately, so this layer cannot name a\n * canvas — and it does not need to: a browser backend takes a canvas, a headless\n * one takes a size. Each narrows the argument at its own `mount`, where the\n * relevant types exist. A backend's context satisfies this structurally, so it\n * never imports it.\n */\nexport interface RenderSurface {\n mount(target: unknown): void;\n unmount(): void;\n /** Device pixels per viewport unit. Rasterization, not zoom — see {@link view}. */\n pixelRatio: number;\n /** Preview pan/zoom over the frame. Costs a repaint, never a surface rebuild. */\n view: { zoom: number; x: number; y: number };\n /** The frame's own size when the surface is a window onto it, else `null`. */\n frame: Size2D | null;\n clipToFrame: boolean;\n /**\n * What the frame's backdrop is painted with. `\"transparent\"` lets whatever\n * is behind the canvas show through where nothing was drawn.\n */\n frameBackground: \"black\" | \"transparent\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-defaults.js","sourceRoot":"","sources":["../../src/render/text-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AASrF;;;;;GAKG;AACH,MAAM,SAAS,GAAG;IACd,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe;CAC1B,CAAC;AAE/C,2EAA2E;AAC3E,MAAM,mBAAmB,GAAG;IACxB,YAAY,EAAE,WAAW;CACiB,CA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AI,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,SAAS;QACzC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import { EMPTY_TEXT_STYLE, TEXT_SHAPING_KEYS, textOps } from \"@/attributes/text/ops\";\nimport type { ResolvedTextSpan, TextShapingKey, TextStyle } from \"@/attributes/text/types\";\nimport { Graphics2D, type GraphicsOp, type GraphicsShapeOp } from \"./graphics2d\";\n\n/** The recorded `text` op, state and all. */\ntype TextOp = Extract<GraphicsShapeOp, { kind: \"text\" }>;\n/** The recorded `richText` op, state and all. */\ntype RichTextOp = Extract<GraphicsShapeOp, { kind: \"richText\" }>;\n\n/**\n * The span-level half of {@link TEXT_SHAPING_KEYS}. A `richText` op carries its\n * typography per span rather than on the shape, so a default has to be filled in\n * span by span — except `lineHeight`/`textAlign`, which lay the block out as a\n * whole and so live on the op itself.\n */\nconst SPAN_KEYS = [\n 'fontFamily', 'fontSize', 'fontWeight', 'fontStyle', 'letterSpacing',\n] as const satisfies readonly TextShapingKey[];\n\n/** The `richText` op's own layout keys — the ones that aren't per-span. */\nconst RICHTEXT_BLOCK_KEYS = [\n 'lineHeight', 'textAlign',\n] as const satisfies readonly TextShapingKey[];\n\n/**\n * `graphics` with `style` filled into every `text`/`richText` op that left a\n * shaping field unset — the drawn-text half of `<DefaultTextStyle>`.\n *\n * A `Text` node inherits defaults through the context channel, once, at bind\n * time (`applyTextDefaults`); a raw `Graphics2D` has no node to bind, so it\n * inherits here instead, at draw time, from the scope it is drawn in. Called\n * from `RenderContext2D.draw`, so a custom node's `ctx.draw(...)`, an offscreen\n * rasterization and the precomp pass's asset walk all see the same resolved op\n * list — which is what makes an inherited font actually *load* rather than\n * merely be asked for.\n *\n * A key counts as unset only when it is `undefined`: an op that names a value\n * always wins, exactly as an author-set prop beats an inherited one on a node.\n * Returns `graphics` itself when nothing changes, which is the common case (the\n * scene sets no defaults, or every op already names its own).\n */\nexport function applyGraphicsTextDefaults(graphics: Graphics2D, style: TextStyle): Graphics2D {\n // Not gated on `style` alone any more: an op naming a `variant` has\n // something to inherit even in a scope that sets nothing, so the walk has to\n // happen either way. The lazy copy below is what keeps that cheap.\n const ambient = hasShapingDefaults(style) ? style : EMPTY_TEXT_STYLE;\n\n const ops = graphics.ops();\n let next: GraphicsOp[] | null = null;\n for (let i = 0; i < ops.length; i++) {\n const op = ops[i];\n if (op.kind !== \"text\" && op.kind !== \"richText\") continue;\n const effective = effectiveStyle(op.state.variant, ambient);\n if (!hasShapingDefaults(effective)) continue;\n const patched = op.kind === \"text\"\n ? patchText(op, effective)\n : patchRichText(op, effective);\n if (!patched) continue;\n // Copy lazily: an op list with nothing to fill in keeps its identity, so\n // a fully-specified Text node allocates nothing on the way through.\n if (!next) next = ops.slice();\n next[i] = patched;\n }\n return next ? graphics._withOps(next) : graphics;\n}\n\n/**\n * The defaults one op inherits: its `variant`'s preset laid over the enclosing\n * scope's.\n *\n * That order is the node ladder one level down — an explicit value beats a\n * variant beats an inherited `<DefaultTextStyle>` — and it is why the merge is\n * here rather than in the caller: the ambient scope is per *subtree* while a\n * variant is per *op*, so they cannot be flattened before the walk.\n */\nfunction effectiveStyle(variant: string | undefined, ambient: TextStyle): TextStyle {\n return textOps.mergeStyle(ambient, variant ? textOps.preset(variant) : undefined);\n}\n\n/** Does `style` set anything a drawn text op could inherit? */\nfunction hasShapingDefaults(style: TextStyle): boolean {\n for (const key of TEXT_SHAPING_KEYS) {\n if (style[key] !== undefined) return true;\n }\n return false;\n}\n\nfunction patchText(op: TextOp, style: TextStyle): TextOp | null {\n const state = fillUnset(op.state, style, TEXT_SHAPING_KEYS);\n return state ? { kind: \"text\", state: state as TextOp[\"state\"] } : null;\n}\n\nfunction patchRichText(op: RichTextOp, style: TextStyle): RichTextOp | null {\n let state = fillUnset(op.state, style, RICHTEXT_BLOCK_KEYS);\n const spans = patchSpans(op.state.spans, style);\n if (spans) state = { ...(state ?? op.state), spans };\n return state ? { kind: \"richText\", state: state as RichTextOp[\"state\"] } : null;\n}\n\n/** The spans with defaults filled in, or `null` when none needed any. */\nfunction patchSpans(\n spans: ResolvedTextSpan[] | undefined,\n style: TextStyle,\n): ResolvedTextSpan[] | null {\n if (!spans || spans.length === 0) return null;\n // A span has no autofit mode — it is a run inside a block, sized by the\n // block — so an inherited `'autofit'` is skipped rather than written through\n // as a bad number.\n const spanStyle = style.fontSize === \"autofit\" ? { ...style, fontSize: undefined } : style;\n let next: ResolvedTextSpan[] | null = null;\n for (let i = 0; i < spans.length; i++) {\n const patched = fillUnset(spans[i], spanStyle, SPAN_KEYS);\n if (patched) (next ??= spans.slice())[i] = patched as unknown as ResolvedTextSpan;\n }\n return next;\n}\n\n/** A copy of `target` with each of `keys` it leaves `undefined` taken from `style`, or `null` when none needed filling. */\nfunction fillUnset(target: object, style: TextStyle, keys: readonly TextShapingKey[]): Record<string, unknown> | null {\n const current = target as Record<string, unknown>;\n let out: Record<string, unknown> | null = null;\n for (const key of keys) {\n if (current[key] !== undefined) continue;\n const value = style[key];\n if (value === undefined) continue;\n (out ??= { ...current })[key] = value;\n }\n return out;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-layout.js","sourceRoot":"","sources":["../../src/render/text-layout.ts"],"names":[],"mappings":"AAoDA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAuB;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAcD;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC5C,OAAO,OAAQ,KAAgC,EAAE,eAAe,KAAK,UAAU;QAC3E,CAAC,CAAC,KAAwB;QAC1B,CAAC,CAAC,IAAI,CAAC;AACf,CAAC","sourcesContent":["import type { TextState } from \"./descriptors/text\";\
|
|
1
|
+
{"version":3,"file":"text-layout.js","sourceRoot":"","sources":["../../src/render/text-layout.ts"],"names":[],"mappings":"AAoDA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAuB;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAcD;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC5C,OAAO,OAAQ,KAAgC,EAAE,eAAe,KAAK,UAAU;QAC3E,CAAC,CAAC,KAAwB;QAC1B,CAAC,CAAC,IAAI,CAAC;AACf,CAAC","sourcesContent":["import type { TextState } from \"./descriptors/text\";\n\n/**\n * Where a laid-out run of text put its characters — the measurement an editor\n * needs in order to draw its own caret and selection over rendered glyphs.\n *\n * **Space.** Block-local canvas pixels: origin at the centre of the text block,\n * **y down**, before the node's own transform. That is exactly the space the\n * backend shapes into when handed origin `(0, 0)`, so a caret at x = 0 sits on\n * the block's centre line and nothing here has to know where the node is.\n * {@link nodeTextLayout} is what lifts it into viewport space.\n *\n * **Why carets rather than glyph boxes.** A text cursor lives *between*\n * characters, so a run of n characters has n + 1 positions — and the two extra\n * facts an editor needs (where the run starts, where it ends) are precisely the\n * ones a list of glyph boxes leaves implicit. Reporting the slots directly also\n * means the host never has to reason about advance widths, kerning or trailing\n * whitespace to place a cursor.\n */\n\n/** One laid-out line of a text block. */\nexport interface TextBlockLine {\n /**\n * Character range this line covers, `[start, end)`, as offsets into the\n * block's whole string. A hard line break is *not* part of either line.\n */\n start: number;\n end: number;\n /** Top and bottom of the line box, block-local. */\n top: number;\n bottom: number;\n /**\n * The x of every caret slot on this line, block-local, in offset order:\n * `carets[i]` is the slot at character `start + i`, so there are\n * `end - start + 1` of them — one before each character plus one after the\n * last. Ordered left-to-right; bidirectional text is not modelled in v1.\n */\n carets: number[];\n}\n\n/**\n * A shaped text block: its lines, and the size the shaping produced.\n *\n * `width`/`height` are the block's own extent, which is what a hugging node\n * measures to — not the box it may have been aligned within.\n */\nexport interface TextBlockLayout {\n lines: TextBlockLine[];\n width: number;\n height: number;\n}\n\n/**\n * The caret slot count implied by a layout — i.e. one past the last character.\n *\n * Lines exclude their line break, so summing their slots would count the breaks\n * twice and lose the final position; this reads it off the last line instead.\n */\nexport function caretCount(layout: TextBlockLayout): number {\n const last = layout.lines[layout.lines.length - 1];\n return last ? last.end + 1 : 1;\n}\n\n/**\n * Something that can report where a shaped text block put its characters.\n *\n * Narrower than {@link RenderContext2D}, which is the only real implementation:\n * `nodeTextLayout` needs exactly this one call, and typing it against the whole\n * render context would make a caret measurement look like it required a\n * renderer. It does not — it requires a shaper.\n */\nexport interface TextBlockSource {\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;\n}\n\n/**\n * Narrow `value` to a {@link TextBlockSource}, or `null` when it cannot report\n * glyph positions.\n *\n * A capability check rather than a cast, because it really is one: a\n * {@link MeasureContext2D} answers how *wide* text comes out, which every backend can\n * do, while reporting where each character *landed* needs a shaper that keeps\n * its line boxes. A host handed a measurer that has no such shaper should get\n * \"no caret model here\", not a crash.\n */\nexport function asTextBlockSource(value: unknown): TextBlockSource | null {\n return typeof (value as TextBlockSource | null)?.layoutTextBlock === \"function\"\n ? value as TextBlockSource\n : null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounds3d.js","sourceRoot":"","sources":["../../src/render3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port { resolveVector3, type Vector3 } from \"./vector3\";\r\n\r\n/**\r\n * Axis-aligned bounds for the 3D descriptors — the \"how big is it, and where\" an\r\n * editor needs in order to put a box round a mesh it did not build.\r\n *\r\n * **Analytic, not sampled.** Every primitive's extent falls straight out of its\r\n * parameters, so this is a table of formulas rather than a walk over vertices,\r\n * and it costs nothing to ask per pointer move. The defaults each one falls back\r\n * to are *three's* defaults, not invented here, because a descriptor that omits\r\n * `radius` renders at three's 1 and a box drawn round a different number would\r\n * be a box in the wrong place — see the note on each.\r\n *\r\n * **Conservative where it is not exact.** A partial sweep (`thetaLength` on a\r\n * sphere, `arc` on a torus) is bounded by the full figure rather than by the\r\n * wedge actually drawn: the exact answer is an arc-endpoint problem per shape\r\n * per axis, and the cost of getting it wrong is a selection box that *cuts\r\n * through* the mesh, where the cost of over-reporting is one that sits a little\r\n * loose. Over-reporting is the safe direction, and it is the direction taken\r\n * everywhere here.\r\n *\r\n * **`null` means \"no answer\", not \"empty\".** Three descriptors genuinely cannot\r\n * be measured without something this package does not have: a loaded model file,\r\n * a rasterized path, or a user callback that may read the frame clock. A caller\r\n * that gets `null` draws no box, which is the honest outcome — a wrong box is\r\n * worse than none.\r\n */\r\n\r\n/** An axis-aligned box. `min` is corner-wise minimum, not a point on the mesh. */\r\nexport interface Box3 {\r\n min: Vector3;\r\n max: Vector3;\r\n}\r\n\r\n/** @internal A box centred on the origin with the given half-extents. */\r\nexport function centeredBox3(hx: number, hy: number, hz: number): Box3 {\r\n return { min: { x: -hx, y: -hy, z: -hz }, max: { x: hx, y: hy, z: hz } };\r\n}\r\n\r\n/** @internal The union of two boxes; either may be `null`. */\r\nexport function unionBox3(a: Box3 | null, b: Box3 | null): Box3 | null {\r\n if (!a) return b;\r\n if (!b) return a;\r\n return {\r\n min: { x: Math.min(a.min.x, b.min.x), y: Math.min(a.min.y, b.min.y), z: Math.min(a.min.z, b.min.z) },\r\n max: { x: Math.max(a.max.x, b.max.x), y: Math.max(a.max.y, b.max.y), z: Math.max(a.max.z, b.max.z) },\r\n };\r\n}\r\n\r\n/** @internal The box's eight corners, in no particular order. */\r\nexport function corners3(box: Box3): Vector3[] {\r\n const { min, max } = box;\r\n return [\r\n { x: min.x, y: min.y, z: min.z },\r\n { x: max.x, y: min.y, z: min.z },\r\n { x: min.x, y: max.y, z: min.z },\r\n { x: max.x, y: max.y, z: min.z },\r\n { x: min.x, y: min.y, z: max.z },\r\n { x: max.x, y: min.y, z: max.z },\r\n { x: min.x, y: max.y, z: max.z },\r\n { x: max.x, y: max.y, z: max.z },\r\n ];\r\n}\r\n\r\n/**\r\n * `box` mapped through `m` and re-bounded — the AABB of the transformed AABB.\r\n *\r\n * Not the AABB of the transformed *mesh*: a rotated box's corner-bounds are\r\n * larger than the shape inside them. That slack is the price of not carrying\r\n * vertex data around, and it errs in the safe direction (see the module note).\r\n */\r\n/** @internal */\r\nexport function transformBox3(box: Box3, m: Matrix4): Box3 {\r\n let minX = Infinity, minY = Infinity, minZ = Infinity;\r\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\r\n for (const corner of corners3(box)) {\r\n const p = applyMatrix4(m, corner);\r\n if (p.x < minX) minX = p.x;\r\n if (p.y < minY) minY = p.y;\r\n if (p.z < minZ) minZ = p.z;\r\n if (p.x > maxX) maxX = p.x;\r\n if (p.y > maxY) maxY = p.y;\r\n if (p.z > maxZ) maxZ = p.z;\r\n }\r\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\r\n}\r\n\r\n/**\r\n * The local-space bounds of a geometry descriptor, or `null` when it cannot be\r\n * measured from the descriptor alone. See the module note for both halves of\r\n * that sentence.\r\n */\r\nexport function geometryBounds3D(geometry: Geometry3D | undefined): Box3 | null {\r\n if (!geometry) return null;\r\n\r\n switch (geometry.type) {\r\n // three centres a box on its origin; the defaults are 1 on every axis.\r\n case \"box\":\r\n return centeredBox3(\r\n (geometry.width ?? 1) / 2,\r\n (geometry.height ?? 1) / 2,\r\n (geometry.depth ?? 1) / 2,\r\n );\r\n\r\n // Full sphere even for a wedge — see the module note on partial sweeps.\r\n case \"sphere\":\r\n return centeredBox3(geometry.radius ?? 1, geometry.radius ?? 1, geometry.radius ?? 1);\r\n\r\n // Flat in XY, facing +Z. Zero depth is correct rather than degenerate:\r\n // the projected box of a plane seen edge-on genuinely is a line.\r\n case \"plane\":\r\n return centeredBox3((geometry.width ?? 1) / 2, (geometry.height ?? 1) / 2, 0);\r\n\r\n // A cone is a cylinder with one radius zeroed, and three models it as its\r\n // own type — so the two share nothing here but the shape of the answer.\r\n case \"cylinder\": {\r\n const [top, bottom] = cylinderRadii(geometry.radius);\r\n const radius = Math.max(top, bottom);\r\n return centeredBox3(radius, (geometry.height ?? 1) / 2, radius);\r\n }\r\n case \"cone\": {\r\n const radius = geometry.radius ?? 1;\r\n return centeredBox3(radius, (geometry.height ?? 1) / 2, radius);\r\n }\r\n\r\n // The ring lies in XY and the tube swells it in Z by its own radius.\r\n case \"torus\": {\r\n const radius = geometry.radius ?? 1;\r\n const tube = geometry.thickness ?? 0.4;\r\n return centeredBox3(radius + tube, radius + tube, tube);\r\n }\r\n\r\n // three's knot curve is `radius * (2 + cos(qu/p)) / 2` in XY and\r\n // `radius * sin(qu/p) / 2` in Z, so it reaches 1.5·radius across and\r\n // 0.5·radius deep before the tube is added.\r\n case \"torusKnot\": {\r\n const radius = geometry.radius ?? 1;\r\n const tube = geometry.thickness ?? 0.4;\r\n return centeredBox3(radius * 1.5 + tube, radius * 1.5 + tube, radius * 0.5 + tube);\r\n }\r\n\r\n case \"circle\":\r\n return centeredBox3(geometry.radius ?? 1, geometry.radius ?? 1, 0);\r\n\r\n case \"ring\": {\r\n const outer = geometry.radius ?? 1;\r\n return centeredBox3(outer, outer, 0);\r\n }\r\n\r\n // `height` is the straight mid-section only, so the caps add a radius at\r\n // each end — the one place three's naming would mislead a reader here. Its\r\n // default radius is 0.5, not three's 1: the renderer builds core's default,\r\n // so a box drawn round three's would be twice too wide.\r\n case \"capsule\": {\r\n const radius = geometry.radius ?? 0.5;\r\n return centeredBox3(radius, (geometry.height ?? 1) / 2 + radius, radius);\r\n }\r\n\r\n // Every platonic solid is inscribed in its radius, so the sphere bounds\r\n // it — loosely for a tetrahedron, exactly for a subdivided icosahedron.\r\n case \"polyhedron\": {\r\n const radius = geometry.radius ?? 1;\r\n return centeredBox3(radius, radius, radius);\r\n }\r\n\r\n // A profile revolved about Y: the widest |x| becomes the radius in both\r\n // ground axes, and the profile's own y range carries straight over.\r\n case \"lathe\": {\r\n let radius = 0;\r\n let minY = Infinity;\r\n let maxY = -Infinity;\r\n for (const point of geometry.points) {\r\n const p = resolveVector3(point);\r\n radius = Math.max(radius, Math.abs(p.x));\r\n minY = Math.min(minY, p.y);\r\n maxY = Math.max(maxY, p.y);\r\n }\r\n if (!Number.isFinite(minY)) return null;\r\n return { min: { x: -radius, y: minY, z: -radius }, max: { x: radius, y: maxY, z: radius } };\r\n }\r\n\r\n // The path's own extent, swollen by the tube radius on every axis. The\r\n // curve bulges outside its control points, so this is a lower bound made\r\n // safe by the radius rather than an exact one.\r\n case \"tube\": {\r\n const points = geometry.points.map((point) => resolveVector3(point));\r\n const box = pointsBounds3(points);\r\n if (!box) return null;\r\n return expandBox3(box, geometry.radius ?? 1);\r\n }\r\n\r\n // Raw vertex data — the one case that is a walk, because there is nothing\r\n // else to read it off.\r\n case \"buffer\":\r\n return positionBounds3(geometry.position);\r\n\r\n // A derived geometry has its source's extent: an outline of a shape is\r\n // the same size as the shape.\r\n case \"edges\":\r\n case \"wireframe\":\r\n return geometryBounds3D(geometry.source);\r\n\r\n // Three that need what this package hasn't got: a rasterized 2D path, a\r\n // callback that may read the clock, and a file off the network.\r\n case \"extrude\":\r\n case \"parametric\":\r\n case \"modelGeometry\":\r\n default:\r\n return null;\r\n }\r\n}\r\n\r\n/** Bounds of a point list, or `null` when it is empty. */\r\nfunction pointsBounds3(points: readonly Vector3[]): Box3 | null {\r\n if (points.length === 0) return null;\r\n let minX = Infinity, minY = Infinity, minZ = Infinity;\r\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\r\n for (const p of points) {\r\n if (p.x < minX) minX = p.x;\r\n if (p.y < minY) minY = p.y;\r\n if (p.z < minZ) minZ = p.z;\r\n if (p.x > maxX) maxX = p.x;\r\n if (p.y > maxY) maxY = p.y;\r\n if (p.z > maxZ) maxZ = p.z;\r\n }\r\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\r\n}\r\n\r\n/** Bounds of a flat `[x, y, z, …]` position buffer. */\r\nfunction positionBounds3(position: ArrayLike<number>): Box3 | null {\r\n if (position.length < 3) return null;\r\n let minX = Infinity, minY = Infinity, minZ = Infinity;\r\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\r\n for (let i = 0; i + 2 < position.length; i += 3) {\r\n const x = position[i], y = position[i + 1], z = position[i + 2];\r\n if (x < minX) minX = x;\r\n if (y < minY) minY = y;\r\n if (z < minZ) minZ = z;\r\n if (x > maxX) maxX = x;\r\n if (y > maxY) maxY = y;\r\n if (z > maxZ) maxZ = z;\r\n }\r\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\r\n}\r\n\r\n/** `box` grown by `by` on every axis. */\r\nfunction expandBox3(box: Box3, by: number): Box3 {\r\n return {\r\n min: { x: box.min.x - by, y: box.min.y - by, z: box.min.z - by },\r\n max: { x: box.max.x + by, y: box.max.y + by, z: box.max.z + by },\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bounds3d.js","sourceRoot":"","sources":["../../src/render3d/bounds3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAgB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,cAAc,EAAgB,MAAM,WAAW,CAAC;AAkCzD,yEAAyE;AACzE,MAAM,UAAU,YAAY,CAAC,EAAU,EAAE,EA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AAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;AACtF,CAAC;AAED,yCAAyC;AACzC,SAAS,UAAU,CAAC,GAAS,EAAE,EAAU;IACrC,OAAO;QACH,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAChE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;KACnE,CAAC;AACN,CAAC","sourcesContent":["import { cylinderRadii, type Geometry3D } from \"./geometry\";\nimport { applyMatrix4, type Matrix4 } from \"./matrix4\";\nimport { resolveVector3, type Vector3 } from \"./vector3\";\n\n/**\n * Axis-aligned bounds for the 3D descriptors — the \"how big is it, and where\" an\n * editor needs in order to put a box round a mesh it did not build.\n *\n * **Analytic, not sampled.** Every primitive's extent falls straight out of its\n * parameters, so this is a table of formulas rather than a walk over vertices,\n * and it costs nothing to ask per pointer move. The defaults each one falls back\n * to are *three's* defaults, not invented here, because a descriptor that omits\n * `radius` renders at three's 1 and a box drawn round a different number would\n * be a box in the wrong place — see the note on each.\n *\n * **Conservative where it is not exact.** A partial sweep (`thetaLength` on a\n * sphere, `arc` on a torus) is bounded by the full figure rather than by the\n * wedge actually drawn: the exact answer is an arc-endpoint problem per shape\n * per axis, and the cost of getting it wrong is a selection box that *cuts\n * through* the mesh, where the cost of over-reporting is one that sits a little\n * loose. Over-reporting is the safe direction, and it is the direction taken\n * everywhere here.\n *\n * **`null` means \"no answer\", not \"empty\".** Three descriptors genuinely cannot\n * be measured without something this package does not have: a loaded model file,\n * a rasterized path, or a user callback that may read the frame clock. A caller\n * that gets `null` draws no box, which is the honest outcome — a wrong box is\n * worse than none.\n */\n\n/** An axis-aligned box. `min` is corner-wise minimum, not a point on the mesh. */\nexport interface Box3 {\n min: Vector3;\n max: Vector3;\n}\n\n/** @internal A box centred on the origin with the given half-extents. */\nexport function centeredBox3(hx: number, hy: number, hz: number): Box3 {\n return { min: { x: -hx, y: -hy, z: -hz }, max: { x: hx, y: hy, z: hz } };\n}\n\n/** @internal The union of two boxes; either may be `null`. */\nexport function unionBox3(a: Box3 | null, b: Box3 | null): Box3 | null {\n if (!a) return b;\n if (!b) return a;\n return {\n min: { x: Math.min(a.min.x, b.min.x), y: Math.min(a.min.y, b.min.y), z: Math.min(a.min.z, b.min.z) },\n max: { x: Math.max(a.max.x, b.max.x), y: Math.max(a.max.y, b.max.y), z: Math.max(a.max.z, b.max.z) },\n };\n}\n\n/** @internal The box's eight corners, in no particular order. */\nexport function corners3(box: Box3): Vector3[] {\n const { min, max } = box;\n return [\n { x: min.x, y: min.y, z: min.z },\n { x: max.x, y: min.y, z: min.z },\n { x: min.x, y: max.y, z: min.z },\n { x: max.x, y: max.y, z: min.z },\n { x: min.x, y: min.y, z: max.z },\n { x: max.x, y: min.y, z: max.z },\n { x: min.x, y: max.y, z: max.z },\n { x: max.x, y: max.y, z: max.z },\n ];\n}\n\n/**\n * `box` mapped through `m` and re-bounded — the AABB of the transformed AABB.\n *\n * Not the AABB of the transformed *mesh*: a rotated box's corner-bounds are\n * larger than the shape inside them. That slack is the price of not carrying\n * vertex data around, and it errs in the safe direction (see the module note).\n */\n/** @internal */\nexport function transformBox3(box: Box3, m: Matrix4): Box3 {\n let minX = Infinity, minY = Infinity, minZ = Infinity;\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\n for (const corner of corners3(box)) {\n const p = applyMatrix4(m, corner);\n if (p.x < minX) minX = p.x;\n if (p.y < minY) minY = p.y;\n if (p.z < minZ) minZ = p.z;\n if (p.x > maxX) maxX = p.x;\n if (p.y > maxY) maxY = p.y;\n if (p.z > maxZ) maxZ = p.z;\n }\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\n}\n\n/**\n * The local-space bounds of a geometry descriptor, or `null` when it cannot be\n * measured from the descriptor alone. See the module note for both halves of\n * that sentence.\n */\nexport function geometryBounds3D(geometry: Geometry3D | undefined): Box3 | null {\n if (!geometry) return null;\n\n switch (geometry.type) {\n // three centres a box on its origin; the defaults are 1 on every axis.\n case \"box\":\n return centeredBox3(\n (geometry.width ?? 1) / 2,\n (geometry.height ?? 1) / 2,\n (geometry.depth ?? 1) / 2,\n );\n\n // Full sphere even for a wedge — see the module note on partial sweeps.\n case \"sphere\":\n return centeredBox3(geometry.radius ?? 1, geometry.radius ?? 1, geometry.radius ?? 1);\n\n // Flat in XY, facing +Z. Zero depth is correct rather than degenerate:\n // the projected box of a plane seen edge-on genuinely is a line.\n case \"plane\":\n return centeredBox3((geometry.width ?? 1) / 2, (geometry.height ?? 1) / 2, 0);\n\n // A cone is a cylinder with one radius zeroed, and three models it as its\n // own type — so the two share nothing here but the shape of the answer.\n case \"cylinder\": {\n const [top, bottom] = cylinderRadii(geometry.radius);\n const radius = Math.max(top, bottom);\n return centeredBox3(radius, (geometry.height ?? 1) / 2, radius);\n }\n case \"cone\": {\n const radius = geometry.radius ?? 1;\n return centeredBox3(radius, (geometry.height ?? 1) / 2, radius);\n }\n\n // The ring lies in XY and the tube swells it in Z by its own radius.\n case \"torus\": {\n const radius = geometry.radius ?? 1;\n const tube = geometry.thickness ?? 0.4;\n return centeredBox3(radius + tube, radius + tube, tube);\n }\n\n // three's knot curve is `radius * (2 + cos(qu/p)) / 2` in XY and\n // `radius * sin(qu/p) / 2` in Z, so it reaches 1.5·radius across and\n // 0.5·radius deep before the tube is added.\n case \"torusKnot\": {\n const radius = geometry.radius ?? 1;\n const tube = geometry.thickness ?? 0.4;\n return centeredBox3(radius * 1.5 + tube, radius * 1.5 + tube, radius * 0.5 + tube);\n }\n\n case \"circle\":\n return centeredBox3(geometry.radius ?? 1, geometry.radius ?? 1, 0);\n\n case \"ring\": {\n const outer = geometry.radius ?? 1;\n return centeredBox3(outer, outer, 0);\n }\n\n // `height` is the straight mid-section only, so the caps add a radius at\n // each end — the one place three's naming would mislead a reader here. Its\n // default radius is 0.5, not three's 1: the renderer builds core's default,\n // so a box drawn round three's would be twice too wide.\n case \"capsule\": {\n const radius = geometry.radius ?? 0.5;\n return centeredBox3(radius, (geometry.height ?? 1) / 2 + radius, radius);\n }\n\n // Every platonic solid is inscribed in its radius, so the sphere bounds\n // it — loosely for a tetrahedron, exactly for a subdivided icosahedron.\n case \"polyhedron\": {\n const radius = geometry.radius ?? 1;\n return centeredBox3(radius, radius, radius);\n }\n\n // A profile revolved about Y: the widest |x| becomes the radius in both\n // ground axes, and the profile's own y range carries straight over.\n case \"lathe\": {\n let radius = 0;\n let minY = Infinity;\n let maxY = -Infinity;\n for (const point of geometry.points) {\n const p = resolveVector3(point);\n radius = Math.max(radius, Math.abs(p.x));\n minY = Math.min(minY, p.y);\n maxY = Math.max(maxY, p.y);\n }\n if (!Number.isFinite(minY)) return null;\n return { min: { x: -radius, y: minY, z: -radius }, max: { x: radius, y: maxY, z: radius } };\n }\n\n // The path's own extent, swollen by the tube radius on every axis. The\n // curve bulges outside its control points, so this is a lower bound made\n // safe by the radius rather than an exact one.\n case \"tube\": {\n const points = geometry.points.map((point) => resolveVector3(point));\n const box = pointsBounds3(points);\n if (!box) return null;\n return expandBox3(box, geometry.radius ?? 1);\n }\n\n // Raw vertex data — the one case that is a walk, because there is nothing\n // else to read it off.\n case \"buffer\":\n return positionBounds3(geometry.position);\n\n // A derived geometry has its source's extent: an outline of a shape is\n // the same size as the shape.\n case \"edges\":\n case \"wireframe\":\n return geometryBounds3D(geometry.source);\n\n // Three that need what this package hasn't got: a rasterized 2D path, a\n // callback that may read the clock, and a file off the network.\n case \"extrude\":\n case \"parametric\":\n case \"modelGeometry\":\n default:\n return null;\n }\n}\n\n/** Bounds of a point list, or `null` when it is empty. */\nfunction pointsBounds3(points: readonly Vector3[]): Box3 | null {\n if (points.length === 0) return null;\n let minX = Infinity, minY = Infinity, minZ = Infinity;\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\n for (const p of points) {\n if (p.x < minX) minX = p.x;\n if (p.y < minY) minY = p.y;\n if (p.z < minZ) minZ = p.z;\n if (p.x > maxX) maxX = p.x;\n if (p.y > maxY) maxY = p.y;\n if (p.z > maxZ) maxZ = p.z;\n }\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\n}\n\n/** Bounds of a flat `[x, y, z, …]` position buffer. */\nfunction positionBounds3(position: ArrayLike<number>): Box3 | null {\n if (position.length < 3) return null;\n let minX = Infinity, minY = Infinity, minZ = Infinity;\n let maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity;\n for (let i = 0; i + 2 < position.length; i += 3) {\n const x = position[i], y = position[i + 1], z = position[i + 2];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (z < minZ) minZ = z;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n if (z > maxZ) maxZ = z;\n }\n return { min: { x: minX, y: minY, z: minZ }, max: { x: maxX, y: maxY, z: maxZ } };\n}\n\n/** `box` grown by `by` on every axis. */\nfunction expandBox3(box: Box3, by: number): Box3 {\n return {\n min: { x: box.min.x - by, y: box.min.y - by, z: box.min.z - by },\n max: { x: box.max.x + by, y: box.max.y + by, z: box.max.z + by },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../src/render3d/builders.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,GAAG,EAAE,CAAC,CAA2B,EAAiB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5E,MAAM,EAAE,CAAC,CAA8B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACxF,KAAK,EAAE,CAAC,CAA6B,EAAmB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IACpF,QAAQ,EAAE,CAAC,CAAgC,EAAsB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC;IAChG,IAAI,EAAE,CAAC,CAA4B,EAAkB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAChF,KAAK,EAAE,CAAC,CAA6B,EAAmB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IACpF,SAAS,EAAE,CAAC,CAAiC,EAAuB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;IACpG,MAAM,EAAE,CAAC,CAA8B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACxF,IAAI,EAAE,CAAC,CAA4B,EAAkB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC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AAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACnD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,EAAE,CACL,MAAuB,EACvB,CAAkF,EAClE,EAAE,CAAC,CAAC;QACpB,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,GAAG,CAAC;QACJ,MAAM;KACT,CAAC;CACI,CAAC","sourcesContent":["import type {\r\n BoxGeometry3D, BufferGeometry3D, CapsuleGeometry3D, CircleGeometry3D,\r\n ConeGeometry3D, CylinderGeometry3D, EdgesGeometry3D, ExtrudeGeometry3D,\r\n Geometry3D, LatheGeometry3D, ModelGeometry3D, ParametricGeometry3D,\r\n PlaneGeometry3D, PolyhedronGeometry3D, RingGeometry3D, SphereGeometry3D,\r\n TorusGeometry3D, TorusKnotGeometry3D, TubeGeometry3D, WireframeGeometry3D,\r\n} from \"./geometry\";\r\nimport type {\r\n BasicMaterial3D, DepthMaterial3D, LambertMaterial3D, LineBasicMaterial3D,\r\n LineDashedMaterial3D, MatcapMaterial3D, NormalMaterial3D, PhongMaterial3D,\r\n PhysicalMaterial3D, PointsMaterial3D, ShaderMaterial3D, ShadowMaterial3D,\r\n SpriteMaterial3D, StandardMaterial3D, ToonMaterial3D,\r\n} from \"./material\";\r\nimport type { DataTexture3D, ImageTexture3D, SurfaceSource3D, SurfaceTexture3D, TextureOptions3D } from \"./texture\";\r\n\r\n/** A descriptor's own params, with the `type` discriminant removed. */\r\ntype ParamsOf<T> = Omit<T, \"type\">;\r\n\r\n/**\r\n * Geometry descriptors.\r\n *\r\n * These are plain values, so hoist one out of the builder and share it across\r\n * meshes — the renderer dedupes by identity, so a shared geometry is uploaded to\r\n * the GPU once no matter how many meshes reference it.\r\n *\r\n * const brick = Geo.box({ width: 1, height: 0.5, depth: 0.5 });\r\n * g.mesh(brick, red, { position: [0, 0, 0] })\r\n * .mesh(brick, red, { position: [1, 0, 0] }); // same GPU buffer\r\n */\r\nexport const Geo = {\r\n box: (o?: ParamsOf<BoxGeometry3D>): BoxGeometry3D => ({ type: \"box\", ...o }),\r\n sphere: (o?: ParamsOf<SphereGeometry3D>): SphereGeometry3D => ({ type: \"sphere\", ...o }),\r\n plane: (o?: ParamsOf<PlaneGeometry3D>): PlaneGeometry3D => ({ type: \"plane\", ...o }),\r\n cylinder: (o?: ParamsOf<CylinderGeometry3D>): CylinderGeometry3D => ({ type: \"cylinder\", ...o }),\r\n cone: (o?: ParamsOf<ConeGeometry3D>): ConeGeometry3D => ({ type: \"cone\", ...o }),\r\n torus: (o?: ParamsOf<TorusGeometry3D>): TorusGeometry3D => ({ type: \"torus\", ...o }),\r\n torusKnot: (o?: ParamsOf<TorusKnotGeometry3D>): TorusKnotGeometry3D => ({ type: \"torusKnot\", ...o }),\r\n circle: (o?: ParamsOf<CircleGeometry3D>): CircleGeometry3D => ({ type: \"circle\", ...o }),\r\n ring: (o?: ParamsOf<RingGeometry3D>): RingGeometry3D => ({ type: \"ring\", ...o }),\r\n capsule: (o?: ParamsOf<CapsuleGeometry3D>): CapsuleGeometry3D => ({ type: \"capsule\", ...o }),\r\n\r\n tetrahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\r\n ({ type: \"polyhedron\", shape: \"tetrahedron\", ...o }),\r\n octahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\r\n ({ type: \"polyhedron\", shape: \"octahedron\", ...o }),\r\n icosahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\r\n ({ type: \"polyhedron\", shape: \"icosahedron\", ...o }),\r\n dodecahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\r\n ({ type: \"polyhedron\", shape: \"dodecahedron\", ...o }),\r\n\r\n extrude: (o: ParamsOf<ExtrudeGeometry3D>): ExtrudeGeometry3D => ({ type: \"extrude\", ...o }),\r\n lathe: (o: ParamsOf<LatheGeometry3D>): LatheGeometry3D => ({ type: \"lathe\", ...o }),\r\n tube: (o: ParamsOf<TubeGeometry3D>): TubeGeometry3D => ({ type: \"tube\", ...o }),\r\n\r\n /** Raw vertex buffers — any mesh you can compute. */\r\n buffer: (o: ParamsOf<BufferGeometry3D>): BufferGeometry3D => ({ type: \"buffer\", ...o }),\r\n /** A surface sampled over a `[0,1]²` grid. Sugar over {@link Geo.buffer}. */\r\n parametric: (o: ParamsOf<ParametricGeometry3D>): ParametricGeometry3D => ({ type: \"parametric\", ...o }),\r\n\r\n /** The hard edges of another geometry — a clean outline, no triangulation diagonals. */\r\n edges: (source: Geometry3D, o?: Omit<ParamsOf<EdgesGeometry3D>, \"source\">): EdgesGeometry3D =>\r\n ({ type: \"edges\", source, ...o }),\r\n /** Every triangle edge of another geometry. */\r\n wireframe: (source: Geometry3D): WireframeGeometry3D => ({ type: \"wireframe\", source }),\r\n\r\n model: (src: string, o?: Omit<ParamsOf<ModelGeometry3D>, \"src\">): ModelGeometry3D =>\r\n ({ type: \"modelGeometry\", src, ...o }),\r\n} as const;\r\n\r\n/**\r\n * Material descriptors.\r\n *\r\n * Like geometries these are shareable values — one hoisted material across many\r\n * meshes compiles one shader program instead of N.\r\n *\r\n * Reach for {@link Mat.standard} by default; {@link Mat.physical} only when a\r\n * surface actually needs clearcoat, transmission, sheen or iridescence, since\r\n * those cost more per pixel. {@link Mat.shader} is the full-control escape hatch.\r\n */\r\nexport const Mat = {\r\n basic: (o?: ParamsOf<BasicMaterial3D>): BasicMaterial3D => ({ type: \"basic\", ...o }),\r\n standard: (o?: ParamsOf<StandardMaterial3D>): StandardMaterial3D => ({ type: \"standard\", ...o }),\r\n physical: (o?: ParamsOf<PhysicalMaterial3D>): PhysicalMaterial3D => ({ type: \"physical\", ...o }),\r\n phong: (o?: ParamsOf<PhongMaterial3D>): PhongMaterial3D => ({ type: \"phong\", ...o }),\r\n lambert: (o?: ParamsOf<LambertMaterial3D>): LambertMaterial3D => ({ type: \"lambert\", ...o }),\r\n toon: (o?: ParamsOf<ToonMaterial3D>): ToonMaterial3D => ({ type: \"toon\", ...o }),\r\n normal: (o?: ParamsOf<NormalMaterial3D>): NormalMaterial3D => ({ type: \"normal\", ...o }),\r\n depth: (o?: ParamsOf<DepthMaterial3D>): DepthMaterial3D => ({ type: \"depth\", ...o }),\r\n matcap: (o?: ParamsOf<MatcapMaterial3D>): MatcapMaterial3D => ({ type: \"matcap\", ...o }),\r\n points: (o?: ParamsOf<PointsMaterial3D>): PointsMaterial3D => ({ type: \"points\", ...o }),\r\n lineBasic: (o?: ParamsOf<LineBasicMaterial3D>): LineBasicMaterial3D => ({ type: \"lineBasic\", ...o }),\r\n lineDashed: (o?: ParamsOf<LineDashedMaterial3D>): LineDashedMaterial3D => ({ type: \"lineDashed\", ...o }),\r\n sprite: (o?: ParamsOf<SpriteMaterial3D>): SpriteMaterial3D => ({ type: \"sprite\", ...o }),\r\n shadow: (o?: ParamsOf<ShadowMaterial3D>): ShadowMaterial3D => ({ type: \"shadow\", ...o }),\r\n /** Raw GLSL. Uniform *values* are free to animate; source changes recompile. */\r\n shader: (o: ParamsOf<ShaderMaterial3D>): ShaderMaterial3D => ({ type: \"shader\", ...o }),\r\n} as const;\r\n\r\n/**\r\n * Texture descriptors.\r\n *\r\n * {@link Tex.image} takes a manifest path and is loaded through core's ordinary\r\n * image pipeline, so the pixels are resident before the frame that needs them\r\n * draws. A bare string works anywhere a texture is expected, so `Tex.image` is\r\n * only needed when passing sampler options.\r\n */\r\nexport const Tex = {\r\n image: (src: string, o?: TextureOptions3D): ImageTexture3D => ({ src, ...o }),\r\n /** A texture from raw RGBA8888 bytes — gradient ramps, noise, LUTs. */\r\n data: (\r\n data: ArrayLike<number>,\r\n width: number,\r\n height: number,\r\n o?: TextureOptions3D & { revision?: number },\r\n ): DataTexture3D => ({ data, width, height, ...o }),\r\n /**\r\n * A texture painted from Motion Script's own 2D output — the bridge from 2D\r\n * onto 3D geometry.\r\n *\r\n * `source` is a **value**: a built `Graphics2D` command list, or a `Node2D`\r\n * subtree for anything needing real layout, shaped `Text` or a loaded\r\n * `Image`. Both are passed directly; there is no name to match and nothing\r\n * has to be mounted anywhere in particular.\r\n *\r\n * const scope = new Graphics2D().line({ points: trace(phase()) }).stroke(…);\r\n * g3.plane({ fill: scope }); // sized for you\r\n *\r\n * const stats = new Rect({ flow: \"vertical\", padding: 48, children: [Text({ text: \"CPU\" })] });\r\n * g3.plane({ fill: Tex.surface(stats, { width: 1024, height: 640 }) });\r\n *\r\n * `width`/`height` are the buffer's resolution and default to 512. A source\r\n * handed straight to `fill` gets exactly this treatment with those defaults,\r\n * so the builder is only needed to pin a resolution or a sampler option.\r\n * **Hoist the source** rather than rebuilding it each frame — see\r\n * {@link SurfaceTexture3D}.\r\n */\r\n surface: (\r\n source: SurfaceSource3D,\r\n o?: TextureOptions3D & { width?: number; height?: number; maxPixelRatio?: number },\r\n ): SurfaceTexture3D => ({\r\n width: 512,\r\n height: 512,\r\n ...o,\r\n source,\r\n }),\r\n} as const;\r\n"]}
|
|
1
|
+
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../../src/render3d/builders.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,GAAG,EAAE,CAAC,CAA2B,EAAiB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5E,MAAM,EAAE,CAAC,CAA8B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACxF,KAAK,EAAE,CAAC,CAA6B,EAAmB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IACpF,QAAQ,EAAE,CAAC,CAAgC,EAAsB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU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E,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACxF,MAAM,EAAE,CAAC,CAA8B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IACxF,gFAAgF;IAChF,MAAM,EAAE,CAAC,CAA6B,EAAoB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;CACjF,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,KAAK,EAAE,CAAC,GAAW,EAAE,CAAoB,EAAkB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAC7E,uEAAuE;IACvE,IAAI,EAAE,CACF,IAAuB,EACvB,KAAa,EACb,MAAc,EACd,CAA4C,EAC/B,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACnD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,EAAE,CACL,MAAuB,EACvB,CAAkF,EAClE,EAAE,CAAC,CAAC;QACpB,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,GAAG,CAAC;QACJ,MAAM;KACT,CAAC;CACI,CAAC","sourcesContent":["import type {\n BoxGeometry3D, BufferGeometry3D, CapsuleGeometry3D, CircleGeometry3D,\n ConeGeometry3D, CylinderGeometry3D, EdgesGeometry3D, ExtrudeGeometry3D,\n Geometry3D, LatheGeometry3D, ModelGeometry3D, ParametricGeometry3D,\n PlaneGeometry3D, PolyhedronGeometry3D, RingGeometry3D, SphereGeometry3D,\n TorusGeometry3D, TorusKnotGeometry3D, TubeGeometry3D, WireframeGeometry3D,\n} from \"./geometry\";\nimport type {\n BasicMaterial3D, DepthMaterial3D, LambertMaterial3D, LineBasicMaterial3D,\n LineDashedMaterial3D, MatcapMaterial3D, NormalMaterial3D, PhongMaterial3D,\n PhysicalMaterial3D, PointsMaterial3D, ShaderMaterial3D, ShadowMaterial3D,\n SpriteMaterial3D, StandardMaterial3D, ToonMaterial3D,\n} from \"./material\";\nimport type { DataTexture3D, ImageTexture3D, SurfaceSource3D, SurfaceTexture3D, TextureOptions3D } from \"./texture\";\n\n/** A descriptor's own params, with the `type` discriminant removed. */\ntype ParamsOf<T> = Omit<T, \"type\">;\n\n/**\n * Geometry descriptors.\n *\n * These are plain values, so hoist one out of the builder and share it across\n * meshes — the renderer dedupes by identity, so a shared geometry is uploaded to\n * the GPU once no matter how many meshes reference it.\n *\n * const brick = Geo.box({ width: 1, height: 0.5, depth: 0.5 });\n * g.mesh(brick, red, { position: [0, 0, 0] })\n * .mesh(brick, red, { position: [1, 0, 0] }); // same GPU buffer\n */\nexport const Geo = {\n box: (o?: ParamsOf<BoxGeometry3D>): BoxGeometry3D => ({ type: \"box\", ...o }),\n sphere: (o?: ParamsOf<SphereGeometry3D>): SphereGeometry3D => ({ type: \"sphere\", ...o }),\n plane: (o?: ParamsOf<PlaneGeometry3D>): PlaneGeometry3D => ({ type: \"plane\", ...o }),\n cylinder: (o?: ParamsOf<CylinderGeometry3D>): CylinderGeometry3D => ({ type: \"cylinder\", ...o }),\n cone: (o?: ParamsOf<ConeGeometry3D>): ConeGeometry3D => ({ type: \"cone\", ...o }),\n torus: (o?: ParamsOf<TorusGeometry3D>): TorusGeometry3D => ({ type: \"torus\", ...o }),\n torusKnot: (o?: ParamsOf<TorusKnotGeometry3D>): TorusKnotGeometry3D => ({ type: \"torusKnot\", ...o }),\n circle: (o?: ParamsOf<CircleGeometry3D>): CircleGeometry3D => ({ type: \"circle\", ...o }),\n ring: (o?: ParamsOf<RingGeometry3D>): RingGeometry3D => ({ type: \"ring\", ...o }),\n capsule: (o?: ParamsOf<CapsuleGeometry3D>): CapsuleGeometry3D => ({ type: \"capsule\", ...o }),\n\n tetrahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\n ({ type: \"polyhedron\", shape: \"tetrahedron\", ...o }),\n octahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\n ({ type: \"polyhedron\", shape: \"octahedron\", ...o }),\n icosahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\n ({ type: \"polyhedron\", shape: \"icosahedron\", ...o }),\n dodecahedron: (o?: Omit<ParamsOf<PolyhedronGeometry3D>, \"shape\">): PolyhedronGeometry3D =>\n ({ type: \"polyhedron\", shape: \"dodecahedron\", ...o }),\n\n extrude: (o: ParamsOf<ExtrudeGeometry3D>): ExtrudeGeometry3D => ({ type: \"extrude\", ...o }),\n lathe: (o: ParamsOf<LatheGeometry3D>): LatheGeometry3D => ({ type: \"lathe\", ...o }),\n tube: (o: ParamsOf<TubeGeometry3D>): TubeGeometry3D => ({ type: \"tube\", ...o }),\n\n /** Raw vertex buffers — any mesh you can compute. */\n buffer: (o: ParamsOf<BufferGeometry3D>): BufferGeometry3D => ({ type: \"buffer\", ...o }),\n /** A surface sampled over a `[0,1]²` grid. Sugar over {@link Geo.buffer}. */\n parametric: (o: ParamsOf<ParametricGeometry3D>): ParametricGeometry3D => ({ type: \"parametric\", ...o }),\n\n /** The hard edges of another geometry — a clean outline, no triangulation diagonals. */\n edges: (source: Geometry3D, o?: Omit<ParamsOf<EdgesGeometry3D>, \"source\">): EdgesGeometry3D =>\n ({ type: \"edges\", source, ...o }),\n /** Every triangle edge of another geometry. */\n wireframe: (source: Geometry3D): WireframeGeometry3D => ({ type: \"wireframe\", source }),\n\n model: (src: string, o?: Omit<ParamsOf<ModelGeometry3D>, \"src\">): ModelGeometry3D =>\n ({ type: \"modelGeometry\", src, ...o }),\n} as const;\n\n/**\n * Material descriptors.\n *\n * Like geometries these are shareable values — one hoisted material across many\n * meshes compiles one shader program instead of N.\n *\n * Reach for {@link Mat.standard} by default; {@link Mat.physical} only when a\n * surface actually needs clearcoat, transmission, sheen or iridescence, since\n * those cost more per pixel. {@link Mat.shader} is the full-control escape hatch.\n */\nexport const Mat = {\n basic: (o?: ParamsOf<BasicMaterial3D>): BasicMaterial3D => ({ type: \"basic\", ...o }),\n standard: (o?: ParamsOf<StandardMaterial3D>): StandardMaterial3D => ({ type: \"standard\", ...o }),\n physical: (o?: ParamsOf<PhysicalMaterial3D>): PhysicalMaterial3D => ({ type: \"physical\", ...o }),\n phong: (o?: ParamsOf<PhongMaterial3D>): PhongMaterial3D => ({ type: \"phong\", ...o }),\n lambert: (o?: ParamsOf<LambertMaterial3D>): LambertMaterial3D => ({ type: \"lambert\", ...o }),\n toon: (o?: ParamsOf<ToonMaterial3D>): ToonMaterial3D => ({ type: \"toon\", ...o }),\n normal: (o?: ParamsOf<NormalMaterial3D>): NormalMaterial3D => ({ type: \"normal\", ...o }),\n depth: (o?: ParamsOf<DepthMaterial3D>): DepthMaterial3D => ({ type: \"depth\", ...o }),\n matcap: (o?: ParamsOf<MatcapMaterial3D>): MatcapMaterial3D => ({ type: \"matcap\", ...o }),\n points: (o?: ParamsOf<PointsMaterial3D>): PointsMaterial3D => ({ type: \"points\", ...o }),\n lineBasic: (o?: ParamsOf<LineBasicMaterial3D>): LineBasicMaterial3D => ({ type: \"lineBasic\", ...o }),\n lineDashed: (o?: ParamsOf<LineDashedMaterial3D>): LineDashedMaterial3D => ({ type: \"lineDashed\", ...o }),\n sprite: (o?: ParamsOf<SpriteMaterial3D>): SpriteMaterial3D => ({ type: \"sprite\", ...o }),\n shadow: (o?: ParamsOf<ShadowMaterial3D>): ShadowMaterial3D => ({ type: \"shadow\", ...o }),\n /** Raw GLSL. Uniform *values* are free to animate; source changes recompile. */\n shader: (o: ParamsOf<ShaderMaterial3D>): ShaderMaterial3D => ({ type: \"shader\", ...o }),\n} as const;\n\n/**\n * Texture descriptors.\n *\n * {@link Tex.image} takes a manifest path and is loaded through core's ordinary\n * image pipeline, so the pixels are resident before the frame that needs them\n * draws. A bare string works anywhere a texture is expected, so `Tex.image` is\n * only needed when passing sampler options.\n */\nexport const Tex = {\n image: (src: string, o?: TextureOptions3D): ImageTexture3D => ({ src, ...o }),\n /** A texture from raw RGBA8888 bytes — gradient ramps, noise, LUTs. */\n data: (\n data: ArrayLike<number>,\n width: number,\n height: number,\n o?: TextureOptions3D & { revision?: number },\n ): DataTexture3D => ({ data, width, height, ...o }),\n /**\n * A texture painted from Motion Script's own 2D output — the bridge from 2D\n * onto 3D geometry.\n *\n * `source` is a **value**: a built `Graphics2D` command list, or a `Node2D`\n * subtree for anything needing real layout, shaped `Text` or a loaded\n * `Image`. Both are passed directly; there is no name to match and nothing\n * has to be mounted anywhere in particular.\n *\n * const scope = new Graphics2D().line({ points: trace(phase()) }).stroke(…);\n * g3.plane({ fill: scope }); // sized for you\n *\n * const stats = new Rect({ flow: \"vertical\", padding: 48, children: [Text({ text: \"CPU\" })] });\n * g3.plane({ fill: Tex.surface(stats, { width: 1024, height: 640 }) });\n *\n * `width`/`height` are the buffer's resolution and default to 512. A source\n * handed straight to `fill` gets exactly this treatment with those defaults,\n * so the builder is only needed to pin a resolution or a sampler option.\n * **Hoist the source** rather than rebuilding it each frame — see\n * {@link SurfaceTexture3D}.\n */\n surface: (\n source: SurfaceSource3D,\n o?: TextureOptions3D & { width?: number; height?: number; maxPixelRatio?: number },\n ): SurfaceTexture3D => ({\n width: 512,\n height: 512,\n ...o,\n source,\n }),\n} as const;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/render3d/camera.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAmC,MAAM,WAAW,CAAC;AAuE5E;;;;;;;;GAQG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAW,CAAC;AAEvF,MAAM,UAAU,e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M,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,UAAU;YAC5C,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,QAAQ;YAC5C,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,UAAU;SAC/C;QACD,MAAM,EAAE,MAAM;KACjB,CAAC;AACN,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY;IACnD,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC","sourcesContent":["import type { Passthrough3D } from \"./geometry\";\
|
|
1
|
+
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/render3d/camera.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAmC,MAAM,WAAW,CAAC;AAuE5E;;;;;;;;GAQG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAW,CAAC;AAEvF,MAAM,UAAU,eAAe,CAAC,MAAoB;IAChD,OAAO,MAAM,CAAC,KAAK,KAAK,SAAS;WAC1B,MAAM,CAAC,SAAS,KAAK,SAAS;WAC9B,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC;AACzC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAoB;IAIvD,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IAElD,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,uEAAuE;QACvE,yEA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AK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC","sourcesContent":["import type { Passthrough3D } from \"./geometry\";\nimport type { Transform3D } from \"./transform\";\nimport { resolveVector3, type Vector3, type Vector3Input } from \"./vector3\";\n\n/**\n * What every camera has, whatever it projects with.\n *\n * A camera can be placed two ways and they are not redundant. The\n * {@link Transform3D} half — `position` plus `lookAt` — is right when the shot is\n * pinned to something, and it is what a camera inside a moving rig uses. The\n * polar half — {@link target}, {@link orbit}, {@link elevation},\n * {@link distance} — is right when the shot is *about* the subject, which is\n * most of the time, and it is the only one of the two that animates cleanly:\n *\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4 });\n *\n * Writing that same move through `position` means composing sines by hand every\n * frame, which is what every scene did before this existed.\n *\n * Setting any polar field derives `position` and `lookAt`, so the two halves are\n * never in force at once. See {@link resolveCameraPlacement}.\n */\nexport interface CameraCommon3D extends Transform3D, Passthrough3D {\n /** The point the camera looks at, and orbits around. Default origin. */\n target?: Vector3Input;\n /** Azimuth around {@link target}, in **degrees**. 0 looks down −Z. */\n orbit?: number;\n /** Angle above the horizon, in **degrees**. Clamped just short of vertical. */\n elevation?: number;\n /** Distance from {@link target}. */\n distance?: number;\n\n /**\n * Near and far clip planes.\n *\n * Both are derived from the scene's own bounds when omitted, which is right\n * far more often than any constant: too near a `far` clips the back of the\n * scene, too far a `near` destroys depth precision. Set them only to override.\n */\n near?: number;\n far?: number;\n /** Zoom factor applied on top of the projection. */\n zoom?: number;\n}\n\n/**\n * A perspective camera — converging rays, so distant things shrink. What you want\n * unless you specifically need the flat look of an orthographic projection.\n */\nexport interface PerspectiveCameraData3D extends CameraCommon3D {\n type: \"perspective\";\n /** Vertical field of view in **degrees**. Default 50. */\n fov?: number;\n}\n\n/**\n * An orthographic camera — parallel rays, so size is independent of distance.\n * For isometric views, technical diagrams and 2.5D layouts.\n *\n * {@link frustumHeight} sets the visible world height and derives the width from\n * the node's aspect ratio. An asymmetric frustum is a `params` override rather\n * than four more fields, because four explicit edges is a projection-matrix\n * feature rather than a framing one.\n */\nexport interface OrthographicCameraData3D extends CameraCommon3D {\n type: \"orthographic\";\n /** Visible world-space height; width follows the node's aspect. Default 10. */\n frustumHeight?: number;\n}\n\n/** Every camera a scene can be viewed through. Discriminated on `type`. */\nexport type CameraData3D = PerspectiveCameraData3D | OrthographicCameraData3D;\n\n/**\n * True when the camera is placed polar-ly.\n *\n * `target` is deliberately not part of this. It answers \"what am I looking at\",\n * which is meaningful on its own — it is `lookAt` under a name that reads right\n * beside `orbit` — and only becomes a *placement* once one of the three fields\n * that orbit around it is set. Including it here would make every camera polar\n * the moment it named a subject, silently discarding its `position`.\n */\n/** What an unset polar field of an orbiting camera reads as. */\nexport const ORBIT_CAMERA_DEFAULTS = { orbit: 0, elevation: 0, distance: 10 } as const;\n\nexport function isOrbitCamera3D(camera: CameraData3D): boolean {\n return camera.orbit !== undefined\n || camera.elevation !== undefined\n || camera.distance !== undefined;\n}\n\n/**\n * A camera's effective position and aim.\n *\n * One definition, shared by the renderer and by the editor's picking geometry —\n * two places computing \"where is the camera\" from the same descriptor is two\n * chances to disagree about what the author sees, and a gizmo drawn against a\n * camera nobody renders is worse than no gizmo.\n *\n * The polar fields win over `position`/`lookAt` when any of them is set, so the\n * two placements can never both be half-applied.\n */\nexport function resolveCameraPlacement(camera: CameraData3D): {\n position: Vector3;\n lookAt: Vector3 | undefined;\n} {\n const target = resolveVector3(camera.target ?? 0);\n\n if (!isOrbitCamera3D(camera)) {\n // `target` is the subject either way, so a camera placed by `position`\n // still aims at it — which is what makes `target` one idea rather than a\n // polar-only field with `lookAt` as its non-polar twin.\n const aim = camera.lookAt ?? camera.target;\n return {\n position: resolveVector3(camera.position ?? 0),\n lookAt: aim === undefined ? undefined : resolveVector3(aim),\n };\n }\n\n const distance = camera.distance ?? ORBIT_CAMERA_DEFAULTS.distance;\n const azimuth = ((camera.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit) * Math.PI) / 180;\n // Just short of the pole: at exactly ±90° the view direction is parallel to\n // the up vector and the look-at basis is undefined, which reads as the shot\n // snapping to an arbitrary roll on the frame it crosses.\n const elevation = (clamp(camera.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation, -89.9, 89.9) * Math.PI) / 180;\n\n const horizontal = Math.cos(elevation) * distance;\n\n return {\n position: {\n x: target.x + Math.sin(azimuth) * horizontal,\n y: target.y + Math.sin(elevation) * distance,\n z: target.z + Math.cos(azimuth) * horizontal,\n },\n lookAt: target,\n };\n}\n\nfunction clamp(value: number, low: number, high: number): number {\n return value < low ? low : value > high ? high : value;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill3d.js","sourceRoot":"","sources":["../../src/render3d/fill3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,iFAAiF;AACjF,qEAAqE;AACrE,8EAA8E;AAC9E,uDAAuD;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAgC9B,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CACzB,IAAwB,EACxB,UAAyB,EAAE;IAE3B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAEnD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,0EAA0E;QAC1E,0EAA0E;QAC1E,uEAAuE;QACvE,8CAA8C;QAC9C,OAAO,kBAAkB,CAAC,IAAI,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C,GAAG,CAAC;AACrG,CAAC","sourcesContent":["import { type Color, type NormalizedColor, parseColor } from \"@/attributes/shape/fill/color/parser\";\r\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\r\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\r\n// A value import, unlike the type-only ones in `texture.ts`: building the rect a\r\n// fill chain is painted into needs the recorder itself. Safe because\r\n// `render/graphics2d` reaches only the *effects* chain at runtime, never back\r\n// into `render3d` — see the note on `SurfaceSource3D`.\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { looksLikeAssetPath } from \"./texture\";\r\nimport type { SurfaceSource3D, Texture3D } from \"./texture\";\r\n\r\nexport { looksLikeAssetPath };\r\n\r\n/**\r\n * What a surface is made of.\r\n *\r\n * The same value a 2D `fill` takes, so a mesh and a rect are described with one\r\n * vocabulary: a colour, a gradient, an image, a video, a noise field, a whole\r\n * stack of blended layers — and, because a `Node2D` subtree and a built\r\n * `Graphics2D` are fills too, any 2D content at all.\r\n *\r\n * This is the 3D counterpart of Spline's material *stack*, built on the fill\r\n * chain that already exists rather than on a second set of layer types. What it\r\n * replaces is a flat `color` plus five separate texture slots (`map`,\r\n * `emissiveMap`, `alphaMap`, `envMap`, `lightMap`), each of which was a fill\r\n * wearing a different name.\r\n */\r\nexport type Fill3D = Color | Fill | Texture3D | SurfaceSource3D;\r\n\r\n/** What a {@link Fill3D} contributes to a material descriptor. */\r\nexport interface ResolvedFill3D {\r\n color?: Color;\r\n map?: Texture3D;\r\n}\r\n\r\n/** Sizing for the buffer a rich fill is rasterized into. */\r\nexport interface Fill3DOptions {\r\n /** Default 512. */\r\n width?: number;\r\n /** Default 512. */\r\n height?: number;\r\n}\r\n\r\nconst DEFAULT_SIZE = 512;\r\n\r\n/**\r\n * Resolve a {@link Fill3D} into the material fields it describes.\r\n *\r\n * Three outcomes, and which one applies is decided by what the fill *is* rather\r\n * than by an author picking a slot:\r\n *\r\n * - **A colour** stays a colour. `fill=\"tomato\"` writes `material.color`, costs\r\n * nothing, and is by far the common case — so it must not be the one that\r\n * allocates a texture.\r\n * - **A texture** (an asset path, or any `Texture3D` descriptor) becomes `map`.\r\n * - **Anything richer** — a gradient, a layer stack, a `Node2D` subtree, a built\r\n * `Graphics2D`, a nested `Scene3D` — is painted into an offscreen buffer and\r\n * bound as `map`, through exactly the `Tex.surface` machinery that already\r\n * existed for putting 2D content on geometry.\r\n *\r\n * That last arm is what makes the 2D and 3D fill vocabularies genuinely one\r\n * thing: `Fills.canvas3D(scene)` inside a chain renders 3D into a layer of a\r\n * material on a mesh, with no new code path, because the 2D fill renderer was\r\n * already able to do it.\r\n */\r\nexport function resolveFill3D(\r\n fill: Fill3D | undefined,\r\n options: Fill3DOptions = {},\r\n): ResolvedFill3D {\r\n if (fill === undefined || fill === null) return {};\r\n\r\n if (typeof fill === \"string\") {\r\n // A bare string is ambiguous between a colour and an asset path, and both\r\n // are things authors write. Resolved the way the material handler already\r\n // resolved a `color` that looked like a file — so this is the existing\r\n // rule moved somewhere it can be stated once.\r\n return looksLikeAssetPath(fill) ? { map: fill } : { color: fill };\r\n }\r\n\r\n if (Array.isArray(fill)) {\r\n // A `Color` is also an array — of numbers. A fill chain is an array of\r\n // layers, which are strings or objects.\r\n if (fill.every((entry) => typeof entry === \"number\")) {\r\n return { color: fill as unknown as Color };\r\n }\r\n return { map: rasterized(fill as Fill, options) };\r\n }\r\n\r\n if (typeof fill === \"object\") {\r\n if (isSurfaceSourceValue(fill)) return { map: surfaceFor(fill as SurfaceSource3D, options) };\r\n if (isTextureDescriptor(fill)) return { map: fill as Texture3D };\r\n if (isSolidLayer(fill)) return { color: (fill as { color: Color }).color };\r\n }\r\n\r\n return { map: rasterized(fill as Fill, options) };\r\n}\r\n\r\n/**\r\n * A surface texture painting `source` directly.\r\n *\r\n * Identity comes from the source object, which the `Tex.surface` contract already\r\n * requires to be hoisted — so nothing has to be written by hand and a source that\r\n * goes out of scope stops being cached.\r\n */\r\nfunction surfaceFor(source: SurfaceSource3D, options: Fill3DOptions): Texture3D {\r\n return {\r\n source,\r\n width: options.width ?? DEFAULT_SIZE,\r\n height: options.height ?? DEFAULT_SIZE,\r\n };\r\n}\r\n\r\n/**\r\n * A surface texture painting a fill chain into a rect that fills the buffer.\r\n *\r\n * Marked `static` and given a derived identity, because a fill chain describes\r\n * the *same* pixels every frame unless one of its own values moved. Without both\r\n * of those a gradient on a cube would re-rasterize a 512² offscreen buffer and\r\n * re-upload it sixty times a second to produce an identical image — which is\r\n * exactly the trap that makes \"just render it to a texture\" a bad idea in\r\n * general, and is worth the small amount of bookkeeping to avoid.\r\n *\r\n * A chain holding something genuinely live (a video layer, a `Fills.canvas3D`) is\r\n * still re-rasterized: those carry object identity, which `fillIdentity` folds in\r\n * and which changes when the content does.\r\n */\r\nfunction rasterized(fill: Fill, options: Fill3DOptions): Texture3D {\r\n const width = options.width ?? DEFAULT_SIZE;\r\n const height = options.height ?? DEFAULT_SIZE;\r\n return {\r\n source: new Graphics2D().rect({ width, height }).fill(fill),\r\n width,\r\n height,\r\n static: true,\r\n identity: `fill:${fillIdentity(fill)}:${width}x${height}`,\r\n };\r\n}\r\n\r\n/** True for a `Texture3D` descriptor object (not a source value). */\r\nfunction isTextureDescriptor(value: object): boolean {\r\n return \"src\" in value || \"data\" in value || (\"source\" in value && \"width\" in value);\r\n}\r\n\r\n/**\r\n * True for a value that is 2D content to be painted, rather than a descriptor.\r\n *\r\n * Structural, like `resolveSurfaceSource`, and for the same reason: an\r\n * `instanceof` here would need value imports of `Node2D` and close a real module\r\n * cycle. A `Scene3D` also exposes `ops()`, so it is excluded explicitly — it is a\r\n * fill *layer* (`Fills.canvas3D`) rather than a 2D source, and routing it through\r\n * the chain arm is what gets it composited with the rest of the stack.\r\n */\r\nfunction isSurfaceSourceValue(value: object): boolean {\r\n const bag = value as Record<string, unknown>;\r\n if (typeof bag.cameraDescriptor === \"function\") return false;\r\n if (typeof bag.ops === \"function\") return true;\r\n return typeof bag.id === \"string\" && typeof bag.attach === \"function\";\r\n}\r\n\r\n/** True for a single solid-colour fill layer, which needs no texture. */\r\nfunction isSolidLayer(value: object): boolean {\r\n const bag = value as Record<string, unknown>;\r\n if (bag.type !== \"solid\" || bag.color === undefined) return false;\r\n // Anything beyond the colour — a per-layer opacity, a blend mode, a\r\n // reference space — is a composite the colour slot cannot express.\r\n return bag.opacity === undefined && bag.blend === undefined && bag.space === undefined;\r\n}\r\n\r\n/**\r\n * Interpolate two fills.\r\n *\r\n * Colours interpolate — that is the overwhelmingly common tween and it must not\r\n * snap. Anything else holds the start value and swaps at the end, because there\r\n * is no meaningful halfway between a gradient and a photograph; cross-fading two\r\n * surfaces is a *stack* (`fill={[a, b]}` with the second layer's opacity tweened),\r\n * which is how it is expressed in 2D too.\r\n *\r\n * The colour test is deliberately cheap and allocation-free: resolving a rich\r\n * fill builds a `Graphics2D` and a texture descriptor, and doing that twice per\r\n * frame for a tween that is going to snap anyway would be pure waste.\r\n */\r\nexport function lerpFill3D(from: Fill3D, to: Fill3D, t: number): Fill3D {\r\n const start = asPlainColor(from);\r\n const end = asPlainColor(to);\r\n if (start !== null && end !== null) {\r\n return lerpColor(normalize(start), normalize(end), t) as unknown as Fill3D;\r\n }\r\n return t < 1 ? from : to;\r\n}\r\n\r\n/** The colour a fill *is*, or `null` when it is anything richer. No allocation. */\r\nfunction asPlainColor(fill: Fill3D | undefined): Color | null {\r\n if (fill === undefined || fill === null) return null;\r\n if (typeof fill === \"string\") return looksLikeAssetPath(fill) ? null : fill;\r\n if (Array.isArray(fill)) {\r\n return fill.every((entry) => typeof entry === \"number\") ? (fill as unknown as Color) : null;\r\n }\r\n if (typeof fill === \"object\" && isSolidLayer(fill)) return (fill as { color: Color }).color;\r\n return null;\r\n}\r\n\r\nfunction normalize(color: Color): NormalizedColor {\r\n return Array.isArray(color) ? (color as NormalizedColor) : parseColor(color);\r\n}\r\n\r\nconst objectIds = new WeakMap<object, string>();\r\nlet objectCounter = 0;\r\n\r\n/**\r\n * A stable key for a fill value.\r\n *\r\n * Plain data is walked and sorted; anything with a prototype of its own — a\r\n * `Scene3D`, a `Graphics2D`, a video source — is keyed by object identity, which\r\n * is both cheaper than serialising it and the honest answer, since two different\r\n * instances describe two different things whatever their fields say. A\r\n * `FillChain` is unwrapped to its list first, so building one inline still\r\n * produces the same key for the same layers.\r\n */\r\nfunction fillIdentity(value: unknown): string {\r\n if (value === null || typeof value !== \"object\") return String(value);\r\n if (Array.isArray(value)) return `[${value.map(fillIdentity).join(\",\")}]`;\r\n\r\n const list = (value as { list?: unknown }).list;\r\n if (Array.isArray(list)) return fillIdentity(list);\r\n\r\n const prototype = Object.getPrototypeOf(value);\r\n if (prototype !== Object.prototype && prototype !== null) {\r\n let id = objectIds.get(value);\r\n if (id === undefined) {\r\n id = `@${objectCounter++}`;\r\n objectIds.set(value, id);\r\n }\r\n return id;\r\n }\r\n\r\n const bag = value as Record<string, unknown>;\r\n return `{${Object.keys(bag).sort().map((key) => `${key}:${fillIdentity(bag[key])}`).join(\",\")}}`;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"fill3d.js","sourceRoot":"","sources":["../../src/render3d/fill3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,iFAAiF;AACjF,qEAAqE;AACrE,8EAA8E;AAC9E,uDAAuD;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAgC9B,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CACzB,IAAwB,EACxB,UAAyB,EAAE;IAE3B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;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AC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACrG,CAAC","sourcesContent":["import { type Color, type NormalizedColor, parseColor } from \"@/attributes/shape/fill/color/parser\";\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\n// A value import, unlike the type-only ones in `texture.ts`: building the rect a\n// fill chain is painted into needs the recorder itself. Safe because\n// `render/graphics2d` reaches only the *effects* chain at runtime, never back\n// into `render3d` — see the note on `SurfaceSource3D`.\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { looksLikeAssetPath } from \"./texture\";\nimport type { SurfaceSource3D, Texture3D } from \"./texture\";\n\nexport { looksLikeAssetPath };\n\n/**\n * What a surface is made of.\n *\n * The same value a 2D `fill` takes, so a mesh and a rect are described with one\n * vocabulary: a colour, a gradient, an image, a video, a noise field, a whole\n * stack of blended layers — and, because a `Node2D` subtree and a built\n * `Graphics2D` are fills too, any 2D content at all.\n *\n * This is the 3D counterpart of Spline's material *stack*, built on the fill\n * chain that already exists rather than on a second set of layer types. What it\n * replaces is a flat `color` plus five separate texture slots (`map`,\n * `emissiveMap`, `alphaMap`, `envMap`, `lightMap`), each of which was a fill\n * wearing a different name.\n */\nexport type Fill3D = Color | Fill | Texture3D | SurfaceSource3D;\n\n/** What a {@link Fill3D} contributes to a material descriptor. */\nexport interface ResolvedFill3D {\n color?: Color;\n map?: Texture3D;\n}\n\n/** Sizing for the buffer a rich fill is rasterized into. */\nexport interface Fill3DOptions {\n /** Default 512. */\n width?: number;\n /** Default 512. */\n height?: number;\n}\n\nconst DEFAULT_SIZE = 512;\n\n/**\n * Resolve a {@link Fill3D} into the material fields it describes.\n *\n * Three outcomes, and which one applies is decided by what the fill *is* rather\n * than by an author picking a slot:\n *\n * - **A colour** stays a colour. `fill=\"tomato\"` writes `material.color`, costs\n * nothing, and is by far the common case — so it must not be the one that\n * allocates a texture.\n * - **A texture** (an asset path, or any `Texture3D` descriptor) becomes `map`.\n * - **Anything richer** — a gradient, a layer stack, a `Node2D` subtree, a built\n * `Graphics2D`, a nested `Scene3D` — is painted into an offscreen buffer and\n * bound as `map`, through exactly the `Tex.surface` machinery that already\n * existed for putting 2D content on geometry.\n *\n * That last arm is what makes the 2D and 3D fill vocabularies genuinely one\n * thing: `Fills.canvas3D(scene)` inside a chain renders 3D into a layer of a\n * material on a mesh, with no new code path, because the 2D fill renderer was\n * already able to do it.\n */\nexport function resolveFill3D(\n fill: Fill3D | undefined,\n options: Fill3DOptions = {},\n): ResolvedFill3D {\n if (fill === undefined || fill === null) return {};\n\n if (typeof fill === \"string\") {\n // A bare string is ambiguous between a colour and an asset path, and both\n // are things authors write. Resolved the way the material handler already\n // resolved a `color` that looked like a file — so this is the existing\n // rule moved somewhere it can be stated once.\n return looksLikeAssetPath(fill) ? { map: fill } : { color: fill };\n }\n\n if (Array.isArray(fill)) {\n // A `Color` is also an array — of numbers. A fill chain is an array of\n // layers, which are strings or objects.\n if (fill.every((entry) => typeof entry === \"number\")) {\n return { color: fill as unknown as Color };\n }\n return { map: rasterized(fill as Fill, options) };\n }\n\n if (typeof fill === \"object\") {\n if (isSurfaceSourceValue(fill)) return { map: surfaceFor(fill as SurfaceSource3D, options) };\n if (isTextureDescriptor(fill)) return { map: fill as Texture3D };\n if (isSolidLayer(fill)) return { color: (fill as { color: Color }).color };\n }\n\n return { map: rasterized(fill as Fill, options) };\n}\n\n/**\n * A surface texture painting `source` directly.\n *\n * Identity comes from the source object, which the `Tex.surface` contract already\n * requires to be hoisted — so nothing has to be written by hand and a source that\n * goes out of scope stops being cached.\n */\nfunction surfaceFor(source: SurfaceSource3D, options: Fill3DOptions): Texture3D {\n return {\n source,\n width: options.width ?? DEFAULT_SIZE,\n height: options.height ?? DEFAULT_SIZE,\n };\n}\n\n/**\n * A surface texture painting a fill chain into a rect that fills the buffer.\n *\n * Marked `static` and given a derived identity, because a fill chain describes\n * the *same* pixels every frame unless one of its own values moved. Without both\n * of those a gradient on a cube would re-rasterize a 512² offscreen buffer and\n * re-upload it sixty times a second to produce an identical image — which is\n * exactly the trap that makes \"just render it to a texture\" a bad idea in\n * general, and is worth the small amount of bookkeeping to avoid.\n *\n * A chain holding something genuinely live (a video layer, a `Fills.canvas3D`) is\n * still re-rasterized: those carry object identity, which `fillIdentity` folds in\n * and which changes when the content does.\n */\nfunction rasterized(fill: Fill, options: Fill3DOptions): Texture3D {\n const width = options.width ?? DEFAULT_SIZE;\n const height = options.height ?? DEFAULT_SIZE;\n return {\n source: new Graphics2D().rect({ width, height }).fill(fill),\n width,\n height,\n static: true,\n identity: `fill:${fillIdentity(fill)}:${width}x${height}`,\n };\n}\n\n/** True for a `Texture3D` descriptor object (not a source value). */\nfunction isTextureDescriptor(value: object): boolean {\n return \"src\" in value || \"data\" in value || (\"source\" in value && \"width\" in value);\n}\n\n/**\n * True for a value that is 2D content to be painted, rather than a descriptor.\n *\n * Structural, like `resolveSurfaceSource`, and for the same reason: an\n * `instanceof` here would need value imports of `Node2D` and close a real module\n * cycle. A `Scene3D` also exposes `ops()`, so it is excluded explicitly — it is a\n * fill *layer* (`Fills.canvas3D`) rather than a 2D source, and routing it through\n * the chain arm is what gets it composited with the rest of the stack.\n */\nfunction isSurfaceSourceValue(value: object): boolean {\n const bag = value as Record<string, unknown>;\n if (typeof bag.cameraDescriptor === \"function\") return false;\n if (typeof bag.ops === \"function\") return true;\n return typeof bag.id === \"string\" && typeof bag.attach === \"function\";\n}\n\n/** True for a single solid-colour fill layer, which needs no texture. */\nfunction isSolidLayer(value: object): boolean {\n const bag = value as Record<string, unknown>;\n if (bag.type !== \"solid\" || bag.color === undefined) return false;\n // Anything beyond the colour — a per-layer opacity, a blend mode, a\n // reference space — is a composite the colour slot cannot express.\n return bag.opacity === undefined && bag.blend === undefined && bag.space === undefined;\n}\n\n/**\n * Interpolate two fills.\n *\n * Colours interpolate — that is the overwhelmingly common tween and it must not\n * snap. Anything else holds the start value and swaps at the end, because there\n * is no meaningful halfway between a gradient and a photograph; cross-fading two\n * surfaces is a *stack* (`fill={[a, b]}` with the second layer's opacity tweened),\n * which is how it is expressed in 2D too.\n *\n * The colour test is deliberately cheap and allocation-free: resolving a rich\n * fill builds a `Graphics2D` and a texture descriptor, and doing that twice per\n * frame for a tween that is going to snap anyway would be pure waste.\n */\nexport function lerpFill3D(from: Fill3D, to: Fill3D, t: number): Fill3D {\n const start = asPlainColor(from);\n const end = asPlainColor(to);\n if (start !== null && end !== null) {\n return lerpColor(normalize(start), normalize(end), t) as unknown as Fill3D;\n }\n return t < 1 ? from : to;\n}\n\n/** The colour a fill *is*, or `null` when it is anything richer. No allocation. */\nfunction asPlainColor(fill: Fill3D | undefined): Color | null {\n if (fill === undefined || fill === null) return null;\n if (typeof fill === \"string\") return looksLikeAssetPath(fill) ? null : fill;\n if (Array.isArray(fill)) {\n return fill.every((entry) => typeof entry === \"number\") ? (fill as unknown as Color) : null;\n }\n if (typeof fill === \"object\" && isSolidLayer(fill)) return (fill as { color: Color }).color;\n return null;\n}\n\nfunction normalize(color: Color): NormalizedColor {\n return Array.isArray(color) ? (color as NormalizedColor) : parseColor(color);\n}\n\nconst objectIds = new WeakMap<object, string>();\nlet objectCounter = 0;\n\n/**\n * A stable key for a fill value.\n *\n * Plain data is walked and sorted; anything with a prototype of its own — a\n * `Scene3D`, a `Graphics2D`, a video source — is keyed by object identity, which\n * is both cheaper than serialising it and the honest answer, since two different\n * instances describe two different things whatever their fields say. A\n * `FillChain` is unwrapped to its list first, so building one inline still\n * produces the same key for the same layers.\n */\nfunction fillIdentity(value: unknown): string {\n if (value === null || typeof value !== \"object\") return String(value);\n if (Array.isArray(value)) return `[${value.map(fillIdentity).join(\",\")}]`;\n\n const list = (value as { list?: unknown }).list;\n if (Array.isArray(list)) return fillIdentity(list);\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n let id = objectIds.get(value);\n if (id === undefined) {\n id = `@${objectCounter++}`;\n objectIds.set(value, id);\n }\n return id;\n }\n\n const bag = value as Record<string, unknown>;\n return `{${Object.keys(bag).sort().map((key) => `${key}:${fillIdentity(bag[key])}`).join(\",\")}}`;\n}\n"]}
|