@motionscript/core 0.1.0-alpha.7 → 0.1.0-alpha.8
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 +6 -0
- package/NOTICE +15 -14
- package/README.md +4 -4
- 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/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/effects/implementations/echo.js +11 -0
- 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/effects/implementations/gain.js +6 -0
- 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/effects/implementations/highpass.js +10 -0
- 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/effects/implementations/lowpass.js +10 -0
- 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/effects/implementations/tremolo.js +10 -0
- 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/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.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/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/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/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/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/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/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/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/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/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/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/browser/chunks/chunk-AOT33LMS.js +13 -0
- package/dist/browser/chunks/chunk-AOT33LMS.js.map +7 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js +6 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js.map +7 -0
- 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/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/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/text/text.d.ts +12 -12
- 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/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/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/modules/text-style.d.ts +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/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/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/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/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-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/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/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/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/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/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/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +54 -5
- package/dist/render3d/graphics3d.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/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/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/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/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/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/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/package.json +2 -2
- package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
- package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/components/factory/api.ts"],"names":[],"mappings":"AAgRA,MAAM,UAAU,QAAQ,CAAI,OAAmB,EAAE,KAAQ;IACrD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/**\r\n * The types of the component factories — the same shapes\r\n * `experiments/component-syntax/src/api.ts` proves, trimmed to the 2D tree\r\n * for this first runtime slice.\r\n */\r\nimport type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { InsetsProps, InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport type { Size2D, SizeInput } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { Effect } from \"@/attributes/shape/effects/chain\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { NodeBlendMode } from \"@/attributes/shape/fill/blend\";\r\nimport type { BoxBounds } from \"@/layout/bounds\";\r\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\r\nimport type { CameraScope, ChildPlane, Node2D, Node2DProps } from \"@/components/trees/2d/node2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport type { TextStyle } from \"@/attributes/text/types\";\r\nimport type { AudioFilter } from \"@/attributes/audio/filters/chain\";\r\nimport type { Param } from \"@/attributes/audio/filters/curve\";\r\nimport type { AudioFilterItem } from \"@/attributes/audio/filters/union\";\r\nimport type { Context } from \"@/util/context\";\r\nimport type { RefTarget } from \"@/util/reference\";\r\nimport type { Command } from \"@/tween/command\";\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TypeDef } from \"@/components/factory/type-def\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\nimport type { ChildSpace3D, Node3D } from \"@/components/trees/three/node3d\";\r\nimport type { CameraData3D } from \"@/render3d/camera\";\r\nimport type { Graphics3D } from \"@/render3d/graphics3d\";\r\nimport type { Scene3D } from \"@/render3d/scene3d\";\r\nimport type { LightData3D } from \"@/render3d/light\";\r\nimport type { EnvironmentData3D, FogData3D } from \"@/render3d/scene-settings\";\r\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\r\nimport type { Euler3, EulerOrder, Quaternion, Vector3, Vector3Input } from \"@/render3d/vector3\";\r\n\r\n// =============================================================\r\n// State entries\r\n// =============================================================\r\n\r\ndeclare const typeBrand: unique symbol;\r\n\r\n/** A state entry's whole definition: what it accepts, what it resolves to, whether it is private. */\r\nexport interface Type<In, Out = In, Private extends boolean = false> {\r\n readonly [typeBrand]?: { readonly in: In; readonly out: Out; readonly private: Private };\r\n /** @internal The runtime half: default, mapper, tween, meaning. */\r\n readonly _def: TypeDef;\r\n}\r\n\r\nexport type AnyType = Type<any, any, boolean>;\r\n/** What a `state` field may hold: a Type, or a plain number, string or boolean default. */\r\nexport type Entry = AnyType | number | string | boolean;\r\nexport type StateSpec = { readonly [key: string]: Entry };\r\n\r\ntype TypeOf<E> =\r\n E extends AnyType ? E\r\n : E extends number ? Type<number>\r\n : E extends string ? Type<string>\r\n : E extends boolean ? Type<boolean>\r\n : never;\r\nexport type InOf<E> = TypeOf<E> extends Type<infer I, any, any> ? I : never;\r\nexport type OutOf<E> = TypeOf<E> extends Type<any, infer O, any> ? O : never;\r\ntype IsPrivate<E> = TypeOf<E> extends Type<any, any, infer P> ? P : false;\r\ntype IsReadOnly<E> = [InOf<E>] extends [never] ? true : false;\r\n\r\n/** The resolved, typed values a field reads. */\r\nexport type Values<S> = { readonly [K in keyof S]: OutOf<S[K]> };\r\n/** What a call or document may set: public entries, loose form, or a binding. */\r\nexport type Inputs<S> = {\r\n [K in keyof S as IsPrivate<S[K]> extends true ? never : IsReadOnly<S[K]> extends true ? never : K]?:\r\n InOf<S[K]> | (() => InOf<S[K]>);\r\n};\r\n/** What a command may write: any entry, public or private, loose form. */\r\nexport type Writes<S> = {\r\n [K in keyof S as IsReadOnly<S[K]> extends true ? never : K]?: InOf<S[K]>;\r\n};\r\n\r\n// =============================================================\r\n// Built-in 2D placement\r\n// =============================================================\r\n\r\nexport interface Box2DState {\r\n readonly x: Type<number>;\r\n readonly y: Type<number>;\r\n readonly width: Type<SizeInput>;\r\n readonly height: Type<SizeInput>;\r\n readonly rotation: Type<number>;\r\n readonly scale: Type<number>;\r\n readonly opacity: Type<number>;\r\n readonly pivot: Type<Alignment, Vector2>;\r\n readonly padding: Type<InsetsProps, InsetsResolved>;\r\n readonly effects: Type<Effect, NodeEffect[]>;\r\n readonly blend: Type<NodeBlendMode>;\r\n readonly clip: Type<boolean>;\r\n readonly flex: Type<number>;\r\n readonly rotationX: Type<number>;\r\n readonly rotationY: Type<number>;\r\n readonly depth: Type<number>;\r\n readonly perspective: Type<number>;\r\n}\r\n\r\n/** What every audio component has: its level, its place in the stereo field, and its own effects. */\r\nexport interface BoxAudioState {\r\n readonly volume: Type<Param>;\r\n readonly pan: Type<Param>;\r\n readonly mute: Type<boolean>;\r\n readonly filters: Type<AudioFilter, AudioFilterItem[]>;\r\n}\r\n\r\ntype BuiltIn2DCommand = \"moveTo\" | \"fadeTo\" | \"rotateTo\" | \"scaleTo\" | \"layoutTo\" | \"effectTo\" | \"pulse\" | \"wiggle\" | \"to\" | \"set\";\r\n\r\ntype Merge<P, S> = Omit<P, keyof S> & S;\r\n\r\n// =============================================================\r\n// Elements, components and child views\r\n// =============================================================\r\n\r\ndeclare const elementBrand: unique symbol;\r\n\r\n/** What calling a component returns. In this slice, the built node itself. */\r\nexport interface Element<out K extends string = string, out S = unknown, out C = unknown> {\r\n readonly [elementBrand]?: { readonly key: K; readonly state: S; readonly commands: C };\r\n}\r\n\r\ntype AnyComponent = Component<string, any, any, any, any, any>;\r\n/** A whole tree, in `allowedChildren`: any component of it. */\r\ntype TreeName = \"2d\" | \"3d\" | \"audio\";\r\ntype Allowed = readonly (AnyComponent | TreeName)[] | null;\r\n\r\ntype ElementOf<A> =\r\n A extends null | undefined ? Element<string, Box2DState, {}>\r\n : A extends readonly [] ? never\r\n : A extends readonly (infer M)[] ? (M extends Component<infer K, infer S, infer C, any, any, any> ? Element<K, S, C> : M extends TreeName ? Element : never)\r\n : never;\r\n\r\n/** Any node, in the nested and falsy forms a class's `children` took: what a component allowing whole trees accepts. */\r\ntype ChildrenOfTrees = Element | Node | false | null | undefined | readonly ChildrenOfTrees[];\r\n\r\n/** Any 2D node, in the nested and falsy forms a class's `children` took: what a component allowing anything accepts. */\r\nexport type Children2D = Element | Node2D | false | null | undefined | readonly Children2D[];\r\n\r\ntype ChildrenProp<A> = [ElementOf<A>] extends [never]\r\n ? { readonly children?: never }\r\n : A extends null | undefined ? { readonly children?: Children2D }\r\n : A extends readonly TreeName[] ? { readonly children?: ChildrenOfTrees }\r\n : { readonly children?: readonly ElementOf<A>[] };\r\n\r\n/** Built-in placement a 2D node takes beyond its entries: alignment keys (`center`, `topLeft`…), `transform3D`, `flex`. */\r\ntype Placement2DProps<S> = PropInputs<Omit<Node2DProps, keyof S | \"children\">>;\r\n\r\n/**\r\n * What every call takes beside its entries: an id, a document key, and a\r\n * `ref` the node `R` is handed to while it is built, before its props apply.\r\n * A ref of a supertype of `R` is taken too (see {@link RefTarget}).\r\n */\r\ninterface CallMetadata<R> {\r\n readonly id?: string;\r\n readonly key?: string;\r\n readonly ref?: RefTarget<R>;\r\n}\r\n\r\nexport type CallProps<S, A, R = Node2D> = Inputs<S> & Placement2DProps<S> & ChildrenProp<A> & CallMetadata<R>;\r\n\r\n/** The node class generated from a spec: what a registry or an engine is handed. */\r\nexport type NodeClass<S, A, N extends Node = Node2D, P = CallProps<S, A>> = new (props?: P) => N;\r\n\r\n/** What a component of a non-2D tree is called with: its entries, children of its tree, an id. */\r\nexport type TreeCallProps<S, R = Node> = Inputs<S> & CallMetadata<R> & {\r\n readonly children?: readonly (Element | Node)[];\r\n};\r\n\r\n/** The node a component of state `S` and commands `C` builds on `N`: what `new` returns and a `ref` is handed. */\r\nexport type BuiltNode<S, C, N extends Node = Node2D> = NodeValues<S, N> & CommandMethods<C, N>;\r\n\r\nexport interface Component<K extends string, S, C, A, N extends Node = Node2D, P = CallProps<S, A, BuiltNode<S, C, N>>> {\r\n (props?: P): Element<K, S, C>;\r\n /** Builds the same node as a call, typed as the node: for engine code written against a class. */\r\n new (props?: P): BuiltNode<S, C, N>;\r\n readonly key: K;\r\n /** The generated node class: hand it to an engine (`nodes: [Gauge.node]`) or a registry. */\r\n readonly node: NodeClass<S, A, N, P>;\r\n /** Narrows a child view: `children.filter(BarSeries.is)`. */\r\n is(child: ChildView<any>): child is ChildView<Element<K, S, C>>;\r\n}\r\n\r\n/**\r\n * The node a component builds, as engine code and tests holding one see it: the\r\n * node, and each entry's resolved value. Authoring code works with `Element`.\r\n */\r\nexport type NodeOf<C> = C extends Component<any, infer S, infer M, any, infer N, any> ? BuiltNode<S, M, N> : never;\r\n/** A command, called on the node as a class's `command` method is. */\r\nexport type CommandMethods<C, N extends Node = Node2D> = {\r\n [K in Exclude<keyof C, keyof N>]: (args?: { readonly data?: unknown; readonly duration?: number; readonly easing?: EasingFunction }) => Command<Record<string, unknown>>;\r\n};\r\nexport type NodeValues<S, N extends Node = Node2D> =\r\n (N extends Node2D ? Node2D<Node2DProps & EntryProps<S>> : N) & { -readonly [E in Exclude<keyof S, keyof N>]: OutOf<S[E]> };\r\n/** Each entry's loose form, as `set` and `to` take it. */\r\ntype EntryProps<S> = { [E in Exclude<keyof S, keyof Node2DProps>]: InOf<S[E]> };\r\n\r\ntype StateOfElement<E> = E extends Element<any, infer S, any> ? S : never;\r\ntype CommandsOfElement<E> = E extends Element<any, any, infer C>\r\n ? unknown extends C ? string : (keyof C & string) | BuiltIn2DCommand\r\n : never;\r\n\r\n/** A child, as a parent's fields see it. */\r\nexport interface ChildView<out E extends Element = Element> {\r\n readonly id: string;\r\n readonly key: E extends Element<infer K> ? K : string;\r\n readonly state: Values<StateOfElement<E>>;\r\n /** Its size, measured against the room this pass gives it; outside a pass (in a command), the size it was last laid out at. */\r\n readonly size: Size2D;\r\n /** Its own children, as it hands them to its fields: how a command reaches parts nested inside a child. */\r\n readonly children: readonly ChildView[];\r\n measure(max: Max): Size2D;\r\n to(targets: Writes<StateOfElement<E>>): Piece;\r\n run(name: CommandsOfElement<E>, args?: object): Piece;\r\n}\r\n\r\n// =============================================================\r\n// What the engine hands each field\r\n// =============================================================\r\n\r\nexport interface Max {\r\n readonly width?: number;\r\n readonly height?: number;\r\n}\r\n\r\nexport interface FontSpec {\r\n readonly fontFamily: string;\r\n readonly fontSize: number;\r\n readonly fontWeight?: number;\r\n readonly letterSpacing?: number;\r\n}\r\n\r\nexport interface Measurer {\r\n readonly max: Max;\r\n /** The node's clock: a size that changes with time (a spin, a flow) reads it here. */\r\n readonly time: Clock;\r\n text(text: string, font: FontSpec): Size2D;\r\n}\r\n\r\nexport interface Clock {\r\n readonly total: number;\r\n readonly elapsed: number;\r\n}\r\n\r\n/** What `load` declares: everything that must be in before the node is measured or drawn. */\r\nexport interface Loader {\r\n font(family: string, weight?: number | string): void;\r\n image(src: string): void;\r\n video(src: string, trim?: { readonly start?: number; readonly end?: number }): void;\r\n /**\r\n * Async setup. `before: \"layout\"` holds measuring too (a font engine, MathJax); the default holds only the frame.\r\n * A function `load` resolves to frees what it loaded when the asset's window is evicted.\r\n */\r\n task(key: string, load: () => Promise<unknown>, options?: { readonly before?: \"layout\" | \"render\" }): void;\r\n /** A paint the component works out itself (a run's fill); paint entries load themselves. */\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n}\r\n\r\n/** A value a component hands its subtree under a context, which `Types.*({ inherit })` entries read. */\r\nexport interface Provided<T = unknown> {\r\n readonly context: Context<T>;\r\n readonly value: T;\r\n}\r\n\r\nexport function provides<T>(context: Context<T>, value: T): Provided<T> {\r\n return { context, value };\r\n}\r\n\r\nexport interface RenderContext2D {\r\n readonly size: Size2D;\r\n readonly time: Clock;\r\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void;\r\n /** Draws your children here. */\r\n children(): void;\r\n /** Your first child is the stencil; the rest draw through it. */\r\n mask(options: MaskOptions): void;\r\n /** Your children become one shape by `op`, painted with `paint`. */\r\n merge(op: BooleanOperation, paint: MergePaint): void;\r\n /** Your children through a camera viewing your box. */\r\n camera(scope: CameraScope): void;\r\n /** Your children standing in one 2.5D space seen by `camera`, drawn far to near. */\r\n space(camera: SpaceCamera): void;\r\n /**\r\n * Your 3D children rendered into a new scene, for a fill (`Fills.canvas3D`) or\r\n * more drawing. Picking projects through the same scene.\r\n */\r\n scene3D(): Scene3D;\r\n /** Run `body` with `style` the default for text drawn in it; `null` refuses the inherited style. */\r\n textStyle(style: TextStyle | null, body: () => void): void;\r\n /** Run `body` with what it draws confined to `shape`'s outline. */\r\n clip(shape: Graphics2D, body: () => void): void;\r\n /**\r\n * Run `body` as your own paint: standing in a 2.5D space, only what lies in\r\n * front of the lens shows, as a class's own paint does. `Paint.draw` does this\r\n * for the paint it draws; a component drawing with `draw` wraps it here.\r\n */\r\n inFront(body: () => void): void;\r\n /** Whether an ancestor already stands you in a 2.5D space, so a space of your own would nest in it. */\r\n readonly inSpace: boolean;\r\n /** Your nearest ancestor that `component` built, read-only, or `null` when none is above you. */\r\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null;\r\n}\r\n\r\n/** Another node as a component reads it: its id, its resolved state and the size it was laid out at. */\r\nexport interface NodeView<out E extends Element = Element> {\r\n readonly id: string;\r\n readonly key: E extends Element<infer K> ? K : string;\r\n /** As its own fields read it: a reference entry of its own is a view of that node from where it stands. */\r\n readonly state: Values<StateOfElement<E>>;\r\n readonly size: Size2D;\r\n /** Where it stands in the reader's own frame (y up from the reader's centre): offset, turn and scale. */\r\n readonly frame: NodeFrame;\r\n}\r\n\r\nexport interface NodeFrame {\r\n readonly x: number;\r\n readonly y: number;\r\n readonly rotation: number;\r\n readonly scale: number;\r\n}\r\n\r\n/** What a merged shape is painted with: a shape's resolved paint entries. */\r\nexport interface MergePaint {\r\n readonly fill: FillResolved[];\r\n readonly stroke: StrokeResolved[];\r\n readonly shadow: ShadowResolved[];\r\n readonly overlay?: FillResolved[];\r\n}\r\n\r\n/** Where a 2D child goes: a box centred on (x, y) from your centre, y up, plus an optional slot transform. */\r\nexport interface Placement2D {\r\n readonly x: number;\r\n readonly y: number;\r\n readonly width: number;\r\n readonly height: number;\r\n readonly rotation?: number;\r\n readonly scale?: number;\r\n readonly opacity?: number;\r\n readonly depth?: number;\r\n readonly rotationX?: number;\r\n readonly rotationY?: number;\r\n /** What the child's own `x`/`y` mean in your units (a graph's): read wherever its position is, by paint, picking and a host's drag. */\r\n readonly plane?: ChildPlane;\r\n}\r\n\r\n/** Your content box, as `layout` is handed it, and the node's clock for a layout that moves with time. */\r\nexport interface LayoutBox extends BoxBounds {\r\n readonly time: Clock;\r\n}\r\n\r\n/** A point an editor can drag to set an entry: where it sits in your frame (y up from your centre), and the value dropping it there gives. */\r\nexport interface Handle<V> {\r\n at(state: V, size: Size2D): Vector2 | null;\r\n /** Where it was dropped, as the entry's value; by default the point itself. */\r\n value?(at: Vector2, state: V, size: Size2D): Vector2;\r\n}\r\n\r\n// =============================================================\r\n// Commands\r\n// =============================================================\r\n\r\ndeclare const pieceBrand: unique symbol;\r\n/** A timed piece of a command. */\r\nexport interface Piece {\r\n readonly [pieceBrand]?: true;\r\n /** @internal */\r\n readonly _piece: PieceData;\r\n}\r\n\r\n/** @internal */\r\nexport type PieceData =\r\n | { readonly kind: \"tween\"; readonly targets: Record<string, unknown> }\r\n | { readonly kind: \"animate\"; readonly frame: (t: number) => Record<string, unknown>; readonly eased: boolean }\r\n | { readonly kind: \"wait\"; readonly seconds: number }\r\n | { readonly kind: \"sound\"; readonly src: string; readonly options: SoundOptions }\r\n | { readonly kind: \"together\" | \"sequence\"; readonly pieces: readonly Piece[] }\r\n | { readonly kind: \"stagger\"; readonly pieces: readonly Piece[]; readonly overlap: number }\r\n | { readonly kind: \"child\"; readonly node: object; readonly targets: Record<string, unknown> }\r\n | { readonly kind: \"run\"; readonly node: object; readonly name: string; readonly args: object | undefined };\r\n\r\n/** How a sound plays: today's `AudioClip` fields, and the bus it feeds when its node isn't one. */\r\nexport interface SoundOptions {\r\n readonly trimStart?: number;\r\n readonly trimEnd?: number;\r\n readonly loop?: boolean;\r\n readonly volume?: number;\r\n readonly filters?: AudioFilter;\r\n /** Missing from the catalog, it is skipped rather than an error. */\r\n readonly optional?: boolean;\r\n /** The id of the bus it feeds. A sound node feeds the buses it sits in. */\r\n readonly bus?: string;\r\n /** Ends with its source rather than staying open: a picture's sound, which stops when the picture does. */\r\n readonly closed?: boolean;\r\n}\r\n\r\nexport interface Timeline<A = {}, S = {}> {\r\n readonly args: A;\r\n readonly duration: number;\r\n readonly easing: EasingFunction | undefined;\r\n /** The node this command acts on, read-only: its id (a seed), its size. */\r\n readonly node: NodeView;\r\n tween(targets: Writes<S>): Piece;\r\n /** `frame` at each point of the command; `eased: false` hands it linear progress, to ease per part with `ease`. */\r\n animate(frame: (t: number) => Writes<S>, options?: { readonly eased?: boolean }): Piece;\r\n /** The command's easing at `t`. */\r\n ease(t: number): number;\r\n /** `src` plays from here: cut when the command ends, or to its own end when the command has no length. */\r\n sound(src: string, options?: SoundOptions): Piece;\r\n wait(seconds: number): Piece;\r\n together(pieces: readonly Piece[]): Piece;\r\n sequence(pieces: readonly Piece[]): Piece;\r\n stagger(pieces: readonly Piece[], options?: { readonly overlap?: number }): Piece;\r\n}\r\n\r\ntype Kids = readonly ChildView<any>[];\r\n\r\nexport type CommandEntry<A, S, V, K> =\r\n // The names as written, so a module's command fits any state holding those entries.\r\n | (A extends readonly unknown[] ? { readonly args: A & readonly (keyof Writes<S> & string)[]; readonly run?: undefined; readonly easing?: EasingFunction } : never)\r\n | ((timeline: Timeline<{}, S>, state: V, children: K) => Piece)\r\n // `easing`: what the command eases by when its row gives none.\r\n | (A extends readonly unknown[] ? never : { readonly args: A; run(timeline: Timeline<Values<A>, S>, state: V, children: K): Piece; readonly easing?: EasingFunction });\r\n\r\nexport type CommandsSpec<C, S, V, K> = { [N in keyof C]: CommandEntry<C[N], S, V, K> };\r\n\r\n// =============================================================\r\n// The 2D factory's fields\r\n// =============================================================\r\n\r\nexport type FieldState<All, A> = Values<All> & { readonly children: readonly ChildView<ElementOf<A>>[] };\r\nexport type BuilderState<All, A> = Values<All> & { readonly children: readonly ElementOf<A>[] };\r\ntype OwnKids<A, B> = readonly ChildView<[B] extends [never] ? ElementOf<A> : Extract<B, Element>>[];\r\n\r\n/**\r\n * New defaults for entries, own or built in. A function is a binding: handed the\r\n * live state, and `given`, what the call or document row set when the node was\r\n * built (which never changes), for a default derived from those.\r\n */\r\nexport type Defaults<All, A> = {\r\n readonly [E in keyof All]?: InOf<All[E]> | ((state: FieldState<All, A>, given: Readonly<Record<string, unknown>>) => InOf<All[E]>);\r\n};\r\n\r\nexport interface Spec2D<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, OwnKids<A, B>>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n /** What the subtree inherits: the nearest provider's value for each context, `inherited` reading what's above. */\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n readonly measure?: (measurer: Measurer, state: FieldState<All, A>, children: OwnKids<A, B>) => Size2D;\r\n readonly layout?: (box: LayoutBox, state: FieldState<All, A>, children: OwnKids<A, B>) => readonly Placement2D[];\r\n /** What a child not added yet would take its `x`/`y` in: where a host drops or pastes one. Layout's `plane` answers for the rest. */\r\n readonly plane?: (box: LayoutBox, state: FieldState<All, A>) => ChildPlane | null;\r\n /** Points an editor can drag, by the entry each sets. */\r\n readonly handles?: { readonly [entry: string]: Handle<FieldState<All, A>> };\r\n /** Your bounds when they are not your box (a mark's ink): what selection and picking take. */\r\n readonly bounds?: (size: Size2D, state: FieldState<All, A>) => BoxBounds;\r\n readonly render?: (ctx: RenderContext2D, state: FieldState<All, A>) => void;\r\n /** The coordinates your 3D children's `x`, `y`, `z` are in (a graph's units), for a viewport over them. */\r\n readonly space?: (state: FieldState<All, A>) => ChildSpace3D | null;\r\n}\r\n\r\n/** A sound, or a bus mixing what is in it. It has no box and draws nothing: sound comes from its commands. */\r\nexport interface SpecAudio<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, Kids>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n}\r\n\r\n// =============================================================\r\n// The 3D tree\r\n// =============================================================\r\n\r\n/** What every 3D component has: its place, turn and scale, and how the scene shows it. */\r\nexport interface Transform3DState {\r\n readonly x: Type<number>;\r\n readonly y: Type<number>;\r\n readonly z: Type<number>;\r\n readonly rotationX: Type<number>;\r\n readonly rotationY: Type<number>;\r\n readonly rotationZ: Type<number>;\r\n readonly rotationOrder: Type<EulerOrder>;\r\n readonly quaternion: Type<Quaternion>;\r\n readonly scaleX: Type<number>;\r\n readonly scaleY: Type<number>;\r\n readonly scaleZ: Type<number>;\r\n readonly lookAt: Type<Vector3Input | undefined, Vector3 | undefined>;\r\n readonly visible: Type<boolean>;\r\n readonly shadow: Type<Shadow3D>;\r\n readonly renderOrder: Type<number>;\r\n}\r\n\r\n/** A 3D call's vector forms of the axes: `position: [x, y, z]`, `rotation`, `scale` (one number scales all three). */\r\nexport interface Placement3DProps {\r\n readonly position?: Vector3Input | (() => Vector3Input);\r\n readonly rotation?: Vector3Input | Euler3 | (() => Vector3Input | Euler3);\r\n readonly scale?: Vector3Input | (() => Vector3Input);\r\n}\r\n\r\nexport type CallProps3D<S, R = Node3D> = TreeCallProps<S, R> & Placement3DProps;\r\n\r\n/** What a 3D `render` draws into: today's scene calls, with a camera standing where its node stands. */\r\nexport interface RenderContext3D {\r\n readonly time: Clock;\r\n draw(graphics: Graphics3D | null | undefined): void;\r\n light(light: LightData3D, transform?: Transform3D): void;\r\n /** The scene's camera, placed by this node's transform. A node that stands one is no group: its children stay in its parent's space. */\r\n camera(camera: CameraData3D): void;\r\n fog(fog: FogData3D | Color | null): void;\r\n environment(environment: EnvironmentData3D | null): void;\r\n}\r\n\r\nexport interface Spec3D<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, Kids>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n readonly render?: (ctx: RenderContext3D, state: FieldState<All, A>) => void;\r\n /** The coordinates your 3D children's `x`, `y`, `z` are in (a graph's units): where each lands in yours. */\r\n readonly space?: (state: FieldState<All, A>) => ChildSpace3D | null;\r\n}\r\n\r\nexport type { Merge, Kids, Allowed, AnyComponent };\r\n"]}
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/components/factory/api.ts"],"names":[],"mappings":"AA+QA,MAAM,UAAU,QAAQ,CAAI,OAAmB,EAAE,KAAQ;IACrD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/** The types of the component factories. */\r\nimport type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { InsetsProps, InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport type { Size2D, SizeInput } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { Effect } from \"@/attributes/shape/effects/chain\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { NodeBlendMode } from \"@/attributes/shape/fill/blend\";\r\nimport type { BoxBounds } from \"@/layout/bounds\";\r\nimport type { PropInputs } from \"@/attributes/properties/inputs\";\r\nimport type { CameraScope, ChildPlane, Node2D, Node2DProps } from \"@/components/trees/2d/node2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport type { TextStyle } from \"@/attributes/text/types\";\r\nimport type { AudioEffectsInput } from \"@/attributes/audio/effects/chain\";\r\nimport type { Param } from \"@/attributes/audio/ramp\";\r\nimport type { AudioTransition } from \"@/attributes/audio/transition\";\r\nimport type { AudioEffect } from \"@/attributes/audio/effects/union\";\r\nimport type { Context } from \"@/util/context\";\r\nimport type { RefTarget } from \"@/util/reference\";\r\nimport type { Command } from \"@/tween/command\";\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TypeDef } from \"@/components/factory/type-def\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\nimport type { ChildSpace3D, Node3D } from \"@/components/trees/three/node3d\";\r\nimport type { CameraData3D } from \"@/render3d/camera\";\r\nimport type { Graphics3D } from \"@/render3d/graphics3d\";\r\nimport type { Scene3D } from \"@/render3d/scene3d\";\r\nimport type { LightData3D } from \"@/render3d/light\";\r\nimport type { EnvironmentData3D, FogData3D } from \"@/render3d/scene-settings\";\r\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\r\nimport type { Euler3, EulerOrder, Quaternion, Vector3, Vector3Input } from \"@/render3d/vector3\";\r\n\r\n// =============================================================\r\n// State entries\r\n// =============================================================\r\n\r\ndeclare const typeBrand: unique symbol;\r\n\r\n/** A state entry's whole definition: what it accepts, what it resolves to, whether it is private. */\r\nexport interface Type<In, Out = In, Private extends boolean = false> {\r\n readonly [typeBrand]?: { readonly in: In; readonly out: Out; readonly private: Private };\r\n /** @internal The runtime half: default, mapper, tween, meaning. */\r\n readonly _def: TypeDef;\r\n}\r\n\r\nexport type AnyType = Type<any, any, boolean>;\r\n/** What a `state` field may hold: a Type, or a plain number, string or boolean default. */\r\nexport type Entry = AnyType | number | string | boolean;\r\nexport type StateSpec = { readonly [key: string]: Entry };\r\n\r\ntype TypeOf<E> =\r\n E extends AnyType ? E\r\n : E extends number ? Type<number>\r\n : E extends string ? Type<string>\r\n : E extends boolean ? Type<boolean>\r\n : never;\r\nexport type InOf<E> = TypeOf<E> extends Type<infer I, any, any> ? I : never;\r\nexport type OutOf<E> = TypeOf<E> extends Type<any, infer O, any> ? O : never;\r\ntype IsPrivate<E> = TypeOf<E> extends Type<any, any, infer P> ? P : false;\r\ntype IsReadOnly<E> = [InOf<E>] extends [never] ? true : false;\r\n\r\n/** The resolved, typed values a field reads. */\r\nexport type Values<S> = { readonly [K in keyof S]: OutOf<S[K]> };\r\n/** What a call or document may set: public entries, loose form, or a binding. */\r\nexport type Inputs<S> = {\r\n [K in keyof S as IsPrivate<S[K]> extends true ? never : IsReadOnly<S[K]> extends true ? never : K]?:\r\n InOf<S[K]> | (() => InOf<S[K]>);\r\n};\r\n/** What a command may write: any entry, public or private, loose form. */\r\nexport type Writes<S> = {\r\n [K in keyof S as IsReadOnly<S[K]> extends true ? never : K]?: InOf<S[K]>;\r\n};\r\n\r\n// =============================================================\r\n// Built-in 2D placement\r\n// =============================================================\r\n\r\nexport interface Box2DState {\r\n readonly x: Type<number>;\r\n readonly y: Type<number>;\r\n readonly width: Type<SizeInput>;\r\n readonly height: Type<SizeInput>;\r\n readonly rotation: Type<number>;\r\n readonly scale: Type<number>;\r\n readonly opacity: Type<number>;\r\n readonly pivot: Type<Alignment, Vector2>;\r\n readonly padding: Type<InsetsProps, InsetsResolved>;\r\n readonly effects: Type<Effect, NodeEffect[]>;\r\n readonly blend: Type<NodeBlendMode>;\r\n readonly clip: Type<boolean>;\r\n readonly flex: Type<number>;\r\n readonly rotationX: Type<number>;\r\n readonly rotationY: Type<number>;\r\n readonly depth: Type<number>;\r\n readonly perspective: Type<number>;\r\n}\r\n\r\n/** What every audio component has: its level, its place in the stereo field, and its own effects. */\r\nexport interface BoxAudioState {\r\n readonly volume: Type<Param>;\r\n readonly pan: Type<Param>;\r\n readonly mute: Type<boolean>;\r\n readonly effects: Type<AudioEffectsInput, AudioEffect[]>;\r\n readonly transitionIn: Type<AudioTransition | undefined>;\r\n readonly transitionOut: Type<AudioTransition | undefined>;\r\n}\r\n\r\ntype BuiltIn2DCommand = \"moveTo\" | \"fadeTo\" | \"rotateTo\" | \"scaleTo\" | \"layoutTo\" | \"effectTo\" | \"pulse\" | \"wiggle\" | \"to\" | \"set\";\r\n\r\ntype Merge<P, S> = Omit<P, keyof S> & S;\r\n\r\n// =============================================================\r\n// Elements, components and child views\r\n// =============================================================\r\n\r\ndeclare const elementBrand: unique symbol;\r\n\r\n/** What calling a component returns. In this slice, the built node itself. */\r\nexport interface Element<out K extends string = string, out S = unknown, out C = unknown> {\r\n readonly [elementBrand]?: { readonly key: K; readonly state: S; readonly commands: C };\r\n}\r\n\r\ntype AnyComponent = Component<string, any, any, any, any, any>;\r\n/** A whole tree, in `allowedChildren`: any component of it. */\r\ntype TreeName = \"2d\" | \"3d\" | \"audio\";\r\ntype Allowed = readonly (AnyComponent | TreeName)[] | null;\r\n\r\ntype ElementOf<A> =\r\n A extends null | undefined ? Element<string, Box2DState, {}>\r\n : A extends readonly [] ? never\r\n : A extends readonly (infer M)[] ? (M extends Component<infer K, infer S, infer C, any, any, any> ? Element<K, S, C> : M extends TreeName ? Element : never)\r\n : never;\r\n\r\n/** Any node, in the nested and falsy forms a class's `children` took: what a component allowing whole trees accepts. */\r\ntype ChildrenOfTrees = Element | Node | false | null | undefined | readonly ChildrenOfTrees[];\r\n\r\n/** Any 2D node, in the nested and falsy forms a class's `children` took: what a component allowing anything accepts. */\r\nexport type Children2D = Element | Node2D | false | null | undefined | readonly Children2D[];\r\n\r\ntype ChildrenProp<A> = [ElementOf<A>] extends [never]\r\n ? { readonly children?: never }\r\n : A extends null | undefined ? { readonly children?: Children2D }\r\n : A extends readonly TreeName[] ? { readonly children?: ChildrenOfTrees }\r\n : { readonly children?: readonly ElementOf<A>[] };\r\n\r\n/** Built-in placement a 2D node takes beyond its entries: alignment keys (`center`, `topLeft`…), `transform3D`, `flex`. */\r\ntype Placement2DProps<S> = PropInputs<Omit<Node2DProps, keyof S | \"children\">>;\r\n\r\n/**\r\n * What every call takes beside its entries: an id, a document key, and a\r\n * `ref` the node `R` is handed to while it is built, before its props apply.\r\n * A ref of a supertype of `R` is taken too (see {@link RefTarget}).\r\n */\r\ninterface CallMetadata<R> {\r\n readonly id?: string;\r\n readonly key?: string;\r\n readonly ref?: RefTarget<R>;\r\n}\r\n\r\nexport type CallProps<S, A, R = Node2D> = Inputs<S> & Placement2DProps<S> & ChildrenProp<A> & CallMetadata<R>;\r\n\r\n/** The node class generated from a spec: what a registry or an engine is handed. */\r\nexport type NodeClass<S, A, N extends Node = Node2D, P = CallProps<S, A>> = new (props?: P) => N;\r\n\r\n/** What a component of a non-2D tree is called with: its entries, children of its tree, an id. */\r\nexport type TreeCallProps<S, R = Node> = Inputs<S> & CallMetadata<R> & {\r\n readonly children?: readonly (Element | Node)[];\r\n};\r\n\r\n/** The node a component of state `S` and commands `C` builds on `N`: what `new` returns and a `ref` is handed. */\r\nexport type BuiltNode<S, C, N extends Node = Node2D> = NodeValues<S, N> & CommandMethods<C, N>;\r\n\r\nexport interface Component<K extends string, S, C, A, N extends Node = Node2D, P = CallProps<S, A, BuiltNode<S, C, N>>> {\r\n (props?: P): Element<K, S, C>;\r\n /** Builds the same node as a call, typed as the node: for engine code written against a class. */\r\n new (props?: P): BuiltNode<S, C, N>;\r\n readonly key: K;\r\n /** The generated node class: hand it to an engine (`nodes: [Gauge.node]`) or a registry. */\r\n readonly node: NodeClass<S, A, N, P>;\r\n /** Narrows a child view: `children.filter(BarSeries.is)`. */\r\n is(child: ChildView<any>): child is ChildView<Element<K, S, C>>;\r\n}\r\n\r\n/**\r\n * The node a component builds, as engine code and tests holding one see it: the\r\n * node, and each entry's resolved value. Authoring code works with `Element`.\r\n */\r\nexport type NodeOf<C> = C extends Component<any, infer S, infer M, any, infer N, any> ? BuiltNode<S, M, N> : never;\r\n/** A command, called on the node as a class's `command` method is. */\r\nexport type CommandMethods<C, N extends Node = Node2D> = {\r\n [K in Exclude<keyof C, keyof N>]: (args?: { readonly data?: unknown; readonly duration?: number; readonly easing?: EasingFunction }) => Command<Record<string, unknown>>;\r\n};\r\nexport type NodeValues<S, N extends Node = Node2D> =\r\n (N extends Node2D ? Node2D<Node2DProps & EntryProps<S>> : N) & { -readonly [E in Exclude<keyof S, keyof N>]: OutOf<S[E]> };\r\n/** Each entry's loose form, as `set` and `to` take it. */\r\ntype EntryProps<S> = { [E in Exclude<keyof S, keyof Node2DProps>]: InOf<S[E]> };\r\n\r\ntype StateOfElement<E> = E extends Element<any, infer S, any> ? S : never;\r\ntype CommandsOfElement<E> = E extends Element<any, any, infer C>\r\n ? unknown extends C ? string : (keyof C & string) | BuiltIn2DCommand\r\n : never;\r\n\r\n/** A child, as a parent's fields see it. */\r\nexport interface ChildView<out E extends Element = Element> {\r\n readonly id: string;\r\n readonly key: E extends Element<infer K> ? K : string;\r\n readonly state: Values<StateOfElement<E>>;\r\n /** Its size, measured against the room this pass gives it; outside a pass (in a command), the size it was last laid out at. */\r\n readonly size: Size2D;\r\n /** Its own children, as it hands them to its fields: how a command reaches parts nested inside a child. */\r\n readonly children: readonly ChildView[];\r\n measure(max: Max): Size2D;\r\n to(targets: Writes<StateOfElement<E>>): Piece;\r\n run(name: CommandsOfElement<E>, args?: object): Piece;\r\n}\r\n\r\n// =============================================================\r\n// What the engine hands each field\r\n// =============================================================\r\n\r\nexport interface Max {\r\n readonly width?: number;\r\n readonly height?: number;\r\n}\r\n\r\nexport interface FontSpec {\r\n readonly fontFamily: string;\r\n readonly fontSize: number;\r\n readonly fontWeight?: number;\r\n readonly letterSpacing?: number;\r\n}\r\n\r\nexport interface Measurer {\r\n readonly max: Max;\r\n /** The node's clock: a size that changes with time (a spin, a flow) reads it here. */\r\n readonly time: Clock;\r\n text(text: string, font: FontSpec): Size2D;\r\n}\r\n\r\nexport interface Clock {\r\n readonly total: number;\r\n readonly elapsed: number;\r\n}\r\n\r\n/** What `load` declares: everything that must be in before the node is measured or drawn. */\r\nexport interface Loader {\r\n font(family: string, weight?: number | string): void;\r\n image(src: string): void;\r\n video(src: string, trim?: { readonly start?: number; readonly end?: number }): void;\r\n /**\r\n * Async setup. `before: \"layout\"` holds measuring too (a font engine, MathJax); the default holds only the frame.\r\n * A function `load` resolves to frees what it loaded when the asset's window is evicted.\r\n */\r\n task(key: string, load: () => Promise<unknown>, options?: { readonly before?: \"layout\" | \"render\" }): void;\r\n /** A paint the component works out itself (a run's fill); paint entries load themselves. */\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n}\r\n\r\n/** A value a component hands its subtree under a context, which `Types.*({ inherit })` entries read. */\r\nexport interface Provided<T = unknown> {\r\n readonly context: Context<T>;\r\n readonly value: T;\r\n}\r\n\r\nexport function provides<T>(context: Context<T>, value: T): Provided<T> {\r\n return { context, value };\r\n}\r\n\r\nexport interface RenderContext2D {\r\n readonly size: Size2D;\r\n readonly time: Clock;\r\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void;\r\n /** Draws your children here. */\r\n children(): void;\r\n /** Your first child is the stencil; the rest draw through it. */\r\n mask(options: MaskOptions): void;\r\n /** Your children become one shape by `op`, painted with `paint`. */\r\n merge(op: BooleanOperation, paint: MergePaint): void;\r\n /** Your children through a camera viewing your box. */\r\n camera(scope: CameraScope): void;\r\n /** Your children standing in one 2.5D space seen by `camera`, drawn far to near. */\r\n space(camera: SpaceCamera): void;\r\n /**\r\n * Your 3D children rendered into a new scene, for a fill (`Fills.canvas3D`) or\r\n * more drawing. Picking projects through the same scene.\r\n */\r\n scene3D(): Scene3D;\r\n /** Run `body` with `style` the default for text drawn in it; `null` refuses the inherited style. */\r\n textStyle(style: TextStyle | null, body: () => void): void;\r\n /** Run `body` with what it draws confined to `shape`'s outline. */\r\n clip(shape: Graphics2D, body: () => void): void;\r\n /**\r\n * Run `body` as your own paint: standing in a 2.5D space, only what lies in\r\n * front of the lens shows, as a class's own paint does. `Paint.draw` does this\r\n * for the paint it draws; a component drawing with `draw` wraps it here.\r\n */\r\n inFront(body: () => void): void;\r\n /** Whether an ancestor already stands you in a 2.5D space, so a space of your own would nest in it. */\r\n readonly inSpace: boolean;\r\n /** Your nearest ancestor that `component` built, read-only, or `null` when none is above you. */\r\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null;\r\n}\r\n\r\n/** Another node as a component reads it: its id, its resolved state and the size it was laid out at. */\r\nexport interface NodeView<out E extends Element = Element> {\r\n readonly id: string;\r\n readonly key: E extends Element<infer K> ? K : string;\r\n /** As its own fields read it: a reference entry of its own is a view of that node from where it stands. */\r\n readonly state: Values<StateOfElement<E>>;\r\n readonly size: Size2D;\r\n /** Where it stands in the reader's own frame (y up from the reader's centre): offset, turn and scale. */\r\n readonly frame: NodeFrame;\r\n}\r\n\r\nexport interface NodeFrame {\r\n readonly x: number;\r\n readonly y: number;\r\n readonly rotation: number;\r\n readonly scale: number;\r\n}\r\n\r\n/** What a merged shape is painted with: a shape's resolved paint entries. */\r\nexport interface MergePaint {\r\n readonly fill: FillResolved[];\r\n readonly stroke: StrokeResolved[];\r\n readonly shadow: ShadowResolved[];\r\n readonly overlay?: FillResolved[];\r\n}\r\n\r\n/** Where a 2D child goes: a box centred on (x, y) from your centre, y up, plus an optional slot transform. */\r\nexport interface Placement2D {\r\n readonly x: number;\r\n readonly y: number;\r\n readonly width: number;\r\n readonly height: number;\r\n readonly rotation?: number;\r\n readonly scale?: number;\r\n readonly opacity?: number;\r\n readonly depth?: number;\r\n readonly rotationX?: number;\r\n readonly rotationY?: number;\r\n /** What the child's own `x`/`y` mean in your units (a graph's): read wherever its position is, by paint, picking and a host's drag. */\r\n readonly plane?: ChildPlane;\r\n}\r\n\r\n/** Your content box, as `layout` is handed it, and the node's clock for a layout that moves with time. */\r\nexport interface LayoutBox extends BoxBounds {\r\n readonly time: Clock;\r\n}\r\n\r\n/** A point an editor can drag to set an entry: where it sits in your frame (y up from your centre), and the value dropping it there gives. */\r\nexport interface Handle<V> {\r\n at(state: V, size: Size2D): Vector2 | null;\r\n /** Where it was dropped, as the entry's value; by default the point itself. */\r\n value?(at: Vector2, state: V, size: Size2D): Vector2;\r\n}\r\n\r\n// =============================================================\r\n// Commands\r\n// =============================================================\r\n\r\ndeclare const pieceBrand: unique symbol;\r\n/** A timed piece of a command. */\r\nexport interface Piece {\r\n readonly [pieceBrand]?: true;\r\n /** @internal */\r\n readonly _piece: PieceData;\r\n}\r\n\r\n/** @internal */\r\nexport type PieceData =\r\n | { readonly kind: \"tween\"; readonly targets: Record<string, unknown> }\r\n | { readonly kind: \"animate\"; readonly frame: (t: number) => Record<string, unknown>; readonly eased: boolean }\r\n | { readonly kind: \"wait\"; readonly seconds: number }\r\n | { readonly kind: \"sound\"; readonly src: string; readonly options: SoundOptions }\r\n | { readonly kind: \"together\" | \"sequence\"; readonly pieces: readonly Piece[] }\r\n | { readonly kind: \"stagger\"; readonly pieces: readonly Piece[]; readonly overlap: number }\r\n | { readonly kind: \"child\"; readonly node: object; readonly targets: Record<string, unknown> }\r\n | { readonly kind: \"run\"; readonly node: object; readonly name: string; readonly args: object | undefined };\r\n\r\n/** How a sound plays: today's `AudioClip` fields, and the bus it feeds when its node isn't one. */\r\nexport interface SoundOptions {\r\n readonly trimStart?: number;\r\n readonly trimEnd?: number;\r\n readonly loop?: boolean;\r\n readonly volume?: Param;\r\n readonly speed?: Param;\r\n readonly effects?: AudioEffectsInput;\r\n readonly transitionIn?: AudioTransition;\r\n readonly transitionOut?: AudioTransition;\r\n /** Missing from the catalog, it is skipped rather than an error. */\r\n readonly optional?: boolean;\r\n /** The id of the bus it feeds. A sound node feeds the buses it sits in. */\r\n readonly bus?: string;\r\n /** Ends with its source rather than staying open: a picture's sound, which stops when the picture does. */\r\n readonly closed?: boolean;\r\n}\r\n\r\nexport interface Timeline<A = {}, S = {}> {\r\n readonly args: A;\r\n readonly duration: number;\r\n readonly easing: EasingFunction | undefined;\r\n /** The node this command acts on, read-only: its id (a seed), its size. */\r\n readonly node: NodeView;\r\n tween(targets: Writes<S>): Piece;\r\n /** `frame` at each point of the command; `eased: false` hands it linear progress, to ease per part with `ease`. */\r\n animate(frame: (t: number) => Writes<S>, options?: { readonly eased?: boolean }): Piece;\r\n /** The command's easing at `t`. */\r\n ease(t: number): number;\r\n /** `src` plays from here: cut when the command ends, or to its own end when the command has no length. */\r\n sound(src: string, options?: SoundOptions): Piece;\r\n wait(seconds: number): Piece;\r\n together(pieces: readonly Piece[]): Piece;\r\n sequence(pieces: readonly Piece[]): Piece;\r\n stagger(pieces: readonly Piece[], options?: { readonly overlap?: number }): Piece;\r\n}\r\n\r\ntype Kids = readonly ChildView<any>[];\r\n\r\nexport type CommandEntry<A, S, V, K> =\r\n // The names as written, so a module's command fits any state holding those entries.\r\n | (A extends readonly unknown[] ? { readonly args: A & readonly (keyof Writes<S> & string)[]; readonly run?: undefined; readonly easing?: EasingFunction; readonly entrance?: boolean } : never)\r\n | ((timeline: Timeline<{}, S>, state: V, children: K) => Piece)\r\n // `easing`: what the command eases by when its row gives none. `entrance`:\r\n // the timeline holds its first frame ahead of it (`CommandMeta.entrance`).\r\n | (A extends readonly unknown[] ? never : { readonly args: A; run(timeline: Timeline<Values<A>, S>, state: V, children: K): Piece; readonly easing?: EasingFunction; readonly entrance?: boolean });\r\n\r\nexport type CommandsSpec<C, S, V, K> = { [N in keyof C]: CommandEntry<C[N], S, V, K> };\r\n\r\n// =============================================================\r\n// The 2D factory's fields\r\n// =============================================================\r\n\r\nexport type FieldState<All, A> = Values<All> & { readonly children: readonly ChildView<ElementOf<A>>[] };\r\nexport type BuilderState<All, A> = Values<All> & { readonly children: readonly ElementOf<A>[] };\r\ntype OwnKids<A, B> = readonly ChildView<[B] extends [never] ? ElementOf<A> : Extract<B, Element>>[];\r\n\r\n/**\r\n * New defaults for entries, own or built in. A function is a binding: handed the\r\n * live state, and `given`, what the call or document row set when the node was\r\n * built (which never changes), for a default derived from those.\r\n */\r\nexport type Defaults<All, A> = {\r\n readonly [E in keyof All]?: InOf<All[E]> | ((state: FieldState<All, A>, given: Readonly<Record<string, unknown>>) => InOf<All[E]>);\r\n};\r\n\r\nexport interface Spec2D<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n /** Old prop keys a stored row may still carry → the entry each became. */\r\n readonly renamed?: Readonly<Record<string, string>>;\r\n /** Entries that still work but should no longer be set: why, and what to use instead. */\r\n readonly deprecated?: Readonly<Record<string, string>>;\r\n /** Value hooks by entry, or by an old key in `renamed` to convert only what was stored under it (`migrateNodeProps`). */\r\n readonly migrate?: Readonly<Record<string, (value: unknown) => unknown>>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, OwnKids<A, B>>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n /** What the subtree inherits: the nearest provider's value for each context, `inherited` reading what's above. */\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n readonly measure?: (measurer: Measurer, state: FieldState<All, A>, children: OwnKids<A, B>) => Size2D;\r\n readonly layout?: (box: LayoutBox, state: FieldState<All, A>, children: OwnKids<A, B>) => readonly Placement2D[];\r\n /** What a child not added yet would take its `x`/`y` in: where a host drops or pastes one. Layout's `plane` answers for the rest. */\r\n readonly plane?: (box: LayoutBox, state: FieldState<All, A>) => ChildPlane | null;\r\n /** Points an editor can drag, by the entry each sets. */\r\n readonly handles?: { readonly [entry: string]: Handle<FieldState<All, A>> };\r\n /** Your bounds when they are not your box (a mark's ink): what selection and picking take. */\r\n readonly bounds?: (size: Size2D, state: FieldState<All, A>) => BoxBounds;\r\n readonly render?: (ctx: RenderContext2D, state: FieldState<All, A>) => void;\r\n /** The coordinates your 3D children's `x`, `y`, `z` are in (a graph's units), for a viewport over them. */\r\n readonly space?: (state: FieldState<All, A>) => ChildSpace3D | null;\r\n}\r\n\r\n/** A sound, or a bus mixing what is in it. It has no box and draws nothing: sound comes from its commands. */\r\nexport interface SpecAudio<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n /** Old prop keys a stored row may still carry → the entry each became. */\r\n readonly renamed?: Readonly<Record<string, string>>;\r\n /** Entries that still work but should no longer be set: why, and what to use instead. */\r\n readonly deprecated?: Readonly<Record<string, string>>;\r\n /** Value hooks by entry, or by an old key in `renamed` to convert only what was stored under it (`migrateNodeProps`). */\r\n readonly migrate?: Readonly<Record<string, (value: unknown) => unknown>>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, Kids>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n}\r\n\r\n// =============================================================\r\n// The 3D tree\r\n// =============================================================\r\n\r\n/** What every 3D component has: its place, turn and scale, and how the scene shows it. */\r\nexport interface Transform3DState {\r\n readonly x: Type<number>;\r\n readonly y: Type<number>;\r\n readonly z: Type<number>;\r\n readonly rotationX: Type<number>;\r\n readonly rotationY: Type<number>;\r\n readonly rotationZ: Type<number>;\r\n readonly rotationOrder: Type<EulerOrder>;\r\n readonly quaternion: Type<Quaternion>;\r\n readonly scaleX: Type<number>;\r\n readonly scaleY: Type<number>;\r\n readonly scaleZ: Type<number>;\r\n readonly lookAt: Type<Vector3Input | undefined, Vector3 | undefined>;\r\n readonly visible: Type<boolean>;\r\n readonly shadow: Type<Shadow3D>;\r\n readonly renderOrder: Type<number>;\r\n}\r\n\r\n/** A 3D call's vector forms of the axes: `position: [x, y, z]`, `rotation`, `scale` (one number scales all three). */\r\nexport interface Placement3DProps {\r\n readonly position?: Vector3Input | (() => Vector3Input);\r\n readonly rotation?: Vector3Input | Euler3 | (() => Vector3Input | Euler3);\r\n readonly scale?: Vector3Input | (() => Vector3Input);\r\n}\r\n\r\nexport type CallProps3D<S, R = Node3D> = TreeCallProps<S, R> & Placement3DProps;\r\n\r\n/** What a 3D `render` draws into: today's scene calls, with a camera standing where its node stands. */\r\nexport interface RenderContext3D {\r\n readonly time: Clock;\r\n /**\r\n * `render` runs only so what it draws loads, and nothing is shown: only the\r\n * materials, models and environment count, so geometry built from data may be skipped.\r\n */\r\n readonly declaring: boolean;\r\n draw(graphics: Graphics3D | null | undefined): void;\r\n light(light: LightData3D, transform?: Transform3D): void;\r\n /** The scene's camera, placed by this node's transform. A node that stands one is no group: its children stay in its parent's space. */\r\n camera(camera: CameraData3D): void;\r\n fog(fog: FogData3D | Color | null): void;\r\n environment(environment: EnvironmentData3D | null): void;\r\n}\r\n\r\nexport interface Spec3D<K extends string, All, S, C, A, B> {\r\n readonly key: K;\r\n readonly state?: S;\r\n readonly defaults?: Defaults<All, A>;\r\n /** Old prop keys a stored row may still carry → the entry each became. */\r\n readonly renamed?: Readonly<Record<string, string>>;\r\n /** Entries that still work but should no longer be set: why, and what to use instead. */\r\n readonly deprecated?: Readonly<Record<string, string>>;\r\n /** Value hooks by entry, or by an old key in `renamed` to convert only what was stored under it (`migrateNodeProps`). */\r\n readonly migrate?: Readonly<Record<string, (value: unknown) => unknown>>;\r\n readonly allowedChildren?: A;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. A row elsewhere fails its build. */\r\n readonly allowedParents?: readonly AnyComponent[];\r\n readonly children?: (state: BuilderState<All, A>) => readonly B[];\r\n readonly commands?: CommandsSpec<C, All, FieldState<All, A>, Kids>;\r\n readonly load?: (loader: Loader, state: FieldState<All, A>) => void;\r\n readonly provide?: (state: FieldState<All, A>, inherited: <T>(context: Context<T>) => T) => readonly Provided[];\r\n readonly render?: (ctx: RenderContext3D, state: FieldState<All, A>) => void;\r\n /** The coordinates your 3D children's `x`, `y`, `z` are in (a graph's units): where each lands in yours. */\r\n readonly space?: (state: FieldState<All, A>) => ChildSpace3D | null;\r\n}\r\n\r\nexport type { Merge, Kids, Allowed, AnyComponent };\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component3d.d.ts","sourceRoot":"","sources":["../../../src/components/factory/component3d.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAqB,MAAM,iCAAiC,CAAC;AAQ5E,OAAO,KAAK,EACR,OAAO,EAAE,SAAS,EAAE,WAAW,EAAoB,SAAS,EAAE,OAAO,EAAE,KAAK,EAAmB,MAAM,EAAE,SAAS,EAAE,gBAAgB,EACrI,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"component3d.d.ts","sourceRoot":"","sources":["../../../src/components/factory/component3d.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAqB,MAAM,iCAAiC,CAAC;AAQ5E,OAAO,KAAK,EACR,OAAO,EAAE,SAAS,EAAE,WAAW,EAAoB,SAAS,EAAE,OAAO,EAAE,KAAK,EAAmB,MAAM,EAAE,SAAS,EAAE,gBAAgB,EACrI,MAAM,0BAA0B,CAAC;AAiDlC;;;;GAIG;AACH,wBAAgB,WAAW,CACvB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,EAAE,EAC9B,KAAK,CAAC,CAAC,GAAG,EAAE,EACZ,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI,EAC9B,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACjC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAqE5M"}
|
|
@@ -11,6 +11,7 @@ class RenderContext3DImpl {
|
|
|
11
11
|
/** Set when `render` asks for a camera: such a node is no group, and stands its camera instead. */
|
|
12
12
|
camera3D = false;
|
|
13
13
|
environment3D = null;
|
|
14
|
+
declaring = false;
|
|
14
15
|
constructor(host) {
|
|
15
16
|
this.host = host;
|
|
16
17
|
}
|
|
@@ -80,9 +81,16 @@ export function component3d(spec) {
|
|
|
80
81
|
}
|
|
81
82
|
/** What `render` draws loads itself: its textures and models, and an environment map it sets. */
|
|
82
83
|
declareAssets(assets) {
|
|
83
|
-
this._ctx3d
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const c = this._ctx3d;
|
|
85
|
+
c.environment3D = null;
|
|
86
|
+
c.declaring = true;
|
|
87
|
+
try {
|
|
88
|
+
super.declareAssets(assets);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
c.declaring = false;
|
|
92
|
+
}
|
|
93
|
+
declareEnvironment(c.environment3D, assets);
|
|
86
94
|
}
|
|
87
95
|
_commandChildren() {
|
|
88
96
|
return this.children.filter((c) => c instanceof Node3D).map(childView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component3d.js","sourceRoot":"","sources":["../../../src/components/factory/component3d.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAqB,MAAM,iCAAiC,CAAC;AAM5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKzD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAiB,MAAM,8BAA8B,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAErE,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAA+B,CAAC,EAAE,GAAG,CAAC,CAAC;AAQ/E,wGAAwG;AACxG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"@/assets/scope\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\nimport { getNodeDescriptor } from \"@/document/node-decorator\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { Node3D, type ChildSpace3D } from \"@/components/trees/three/node3d\";\r\nimport type { CameraData3D } from \"@/render3d/camera\";\r\nimport type { Graphics3D } from \"@/render3d/graphics3d\";\r\nimport type { LightData3D } from \"@/render3d/light\";\r\nimport type { RenderContext3D as SceneTarget } from \"@/render3d/render-context3d\";\r\nimport type { EnvironmentData3D, FogData3D } from \"@/render3d/scene-settings\";\r\nimport { declareEnvironment } from \"@/render3d/tracking\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport type {\r\n Allowed, BuiltNode, CallProps3D, ChildView, Clock, Component, Element, Merge, RenderContext3D, Spec3D, StateSpec, Transform3DState,\r\n} from \"@/components/factory/api\";\r\nimport { componentBase, finishComponent, lowering, type CoreSpec } from \"@/components/factory/factory\";\r\nimport { childView, setKeyLookup } from \"@/components/factory/views\";\r\n\r\nsetKeyLookup((n) => getNodeDescriptor(n.constructor as new () => object)?.key);\r\n\r\ntype AnySpec = Spec3D<string, any, any, any, any, any>;\r\n\r\ninterface Host3D extends Node3D {\r\n _ownTransform(): Transform3D;\r\n}\r\n\r\n/** What a 3D `render` draws into: the scene being built, with a camera placed where its node stands. */\r\nclass RenderContext3DImpl implements RenderContext3D {\r\n target: SceneTarget | null = null;\r\n /** Set when `render` asks for a camera: such a node is no group, and stands its camera instead. */\r\n camera3D = false;\r\n environment3D: EnvironmentData3D | null = null;\r\n declaring = false;\r\n\r\n constructor(readonly host: Host3D) { }\r\n\r\n get time(): Clock {\r\n return this.host.time;\r\n }\r\n\r\n draw(graphics: Graphics3D | null | undefined): void {\r\n if (graphics) this.target?.draw(graphics);\r\n }\r\n\r\n light(light: LightData3D, transform?: Transform3D): void {\r\n this.target?.light(light, transform);\r\n }\r\n\r\n camera(camera: CameraData3D): void {\r\n this.camera3D = true;\r\n this.target?.camera({ ...this.host._ownTransform(), ...camera } as CameraData3D);\r\n }\r\n\r\n fog(fog: FogData3D | Color | null): void {\r\n this.target?.fog(fog);\r\n }\r\n\r\n environment(environment: EnvironmentData3D | null): void {\r\n this.environment3D = environment;\r\n this.target?.environment(environment);\r\n }\r\n}\r\n\r\n/**\r\n * A 3D component: placed by its transform, drawn with `Graphics3D`, lights and\r\n * cameras. Lowers onto a generated `Node3D` subclass; its children render\r\n * after it, in its space.\r\n */\r\nexport function component3d<\r\n const K extends string,\r\n const S extends StateSpec = {},\r\n const C = {},\r\n const A extends Allowed = null,\r\n const B extends Element = never,\r\n>(spec: Spec3D<K, Merge<Transform3DState, S>, S, C, A, B>): Component<K, Merge<Transform3DState, S>, C, A, Node3D, CallProps3D<Merge<Transform3DState, S>, BuiltNode<Merge<Transform3DState, S>, C, Node3D>>> {\r\n const s = spec as unknown as AnySpec;\r\n const l = lowering(s as unknown as CoreSpec, Node3D);\r\n\r\n class Generated extends componentBase(Node3D, l) implements Host3D {\r\n declare _ctx3d: RenderContext3DImpl;\r\n declare _isCamera: boolean | undefined;\r\n\r\n constructor(props?: Record<string, unknown>) {\r\n super(props);\r\n this._ctx3d = new RenderContext3DImpl(this);\r\n }\r\n\r\n protected override renderSelf(ctx: SceneTarget): void {\r\n if (!s.render) return;\r\n const c = this._ctx3d;\r\n c.target = ctx;\r\n try {\r\n s.render(c, this._view as never);\r\n } finally {\r\n c.target = null;\r\n }\r\n }\r\n\r\n /** A node that stands a camera places the camera, not a group: its children stay in the parent's space. */\r\n protected override groupTransform(): Transform3D {\r\n return this._rendersCamera() ? {} : super.groupTransform();\r\n }\r\n\r\n _rendersCamera(): boolean {\r\n if (this._isCamera === undefined) {\r\n const c = this._ctx3d;\r\n c.camera3D = false;\r\n if (s.render) s.render(c, this._view as never);\r\n this._isCamera = c.camera3D;\r\n }\r\n return this._isCamera;\r\n }\r\n\r\n _ownTransform(): Transform3D {\r\n return this.transform3D();\r\n }\r\n\r\n /** What `render` draws loads itself: its textures and models, and an environment map it sets. */\r\n override declareAssets(assets: AssetScope): void {\r\n const c = this._ctx3d;\r\n c.environment3D = null;\r\n c.declaring = true;\r\n try {\r\n super.declareAssets(assets);\r\n } finally {\r\n c.declaring = false;\r\n }\r\n declareEnvironment(c.environment3D, assets);\r\n }\r\n\r\n override _commandChildren(): readonly ChildView[] {\r\n return (this.children as Node[]).filter((c) => c instanceof Node3D).map(childView);\r\n }\r\n }\r\n\r\n if (s.space) {\r\n const space = s.space;\r\n (Generated.prototype as unknown as { _spaceOf: (child: Node3D | null) => ChildSpace3D | null })._spaceOf = function (this: Generated) {\r\n return space(this._view as never);\r\n };\r\n }\r\n\r\n return finishComponent(Generated, l) as never;\r\n}\r\n"]}
|
|
@@ -14,6 +14,9 @@ export interface CoreSpec {
|
|
|
14
14
|
readonly key: string;
|
|
15
15
|
readonly state?: StateSpec;
|
|
16
16
|
readonly defaults?: Record<string, unknown>;
|
|
17
|
+
readonly renamed?: Readonly<Record<string, string>>;
|
|
18
|
+
readonly deprecated?: Readonly<Record<string, string>>;
|
|
19
|
+
readonly migrate?: Readonly<Record<string, (value: unknown) => unknown>>;
|
|
17
20
|
readonly commands?: Record<string, unknown>;
|
|
18
21
|
readonly children?: (state: never) => unknown;
|
|
19
22
|
readonly provide?: (state: never, inherited: <T>(context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/components/factory/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/components/factory/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAMjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAKzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAA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iHAAiH;AACjH,wBAAgB,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,aAAa,CAAC,CAyG5H;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAiFrG;AA4BD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAAG,MAAM,CAW9G"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPropertyMeta, property } from "../../attributes/properties/decorator.js";
|
|
2
2
|
import { node } from "../../document/node-decorator.js";
|
|
3
|
+
import { declarePropEvolution } from "../../document/prop-evolution.js";
|
|
3
4
|
import { settling } from "../../tween/command.js";
|
|
4
5
|
import { command } from "../../tween/command-decorator.js";
|
|
5
6
|
import { commandOf, makeTimeline } from "../../components/factory/timeline.js";
|
|
@@ -19,6 +20,7 @@ export function lowering(spec, Base, ownsDefault = new Set()) {
|
|
|
19
20
|
else if (!builtIn.has(key))
|
|
20
21
|
throw new TypeError(`${spec.key}: "defaults.${key}" names no entry.`);
|
|
21
22
|
}
|
|
23
|
+
checkEvolution(spec, (key) => entries.has(key) || builtIn.has(key));
|
|
22
24
|
// A reference entry holds an id; its fields read a view of the node it names.
|
|
23
25
|
const references = new Set([...entries].filter(([, def]) => def.editor.kind === "nodeRef").map(([key]) => key));
|
|
24
26
|
return { spec, entries, defaults, builtIn, view: stateViewPrototype([...builtIn.keys(), ...entries.keys()], references), ownsDefault };
|
|
@@ -52,10 +54,20 @@ export function componentBase(Base, l) {
|
|
|
52
54
|
if (s.children) {
|
|
53
55
|
// Live, like the field state, so a binding the builder writes reads the node as it changes.
|
|
54
56
|
const builderState = stateView(l.view, this);
|
|
55
|
-
|
|
57
|
+
const authored = [given ?? []].flat(Infinity).filter(Boolean);
|
|
58
|
+
if (s.allowedChildren != null)
|
|
59
|
+
for (const child of authored)
|
|
60
|
+
this.assertAcceptsChild(child);
|
|
61
|
+
Object.defineProperty(builderState, "children", { value: authored });
|
|
56
62
|
const built = [s.children(builderState)].flat(Infinity).filter(Boolean);
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
this._assembling = true;
|
|
64
|
+
try {
|
|
65
|
+
for (const part of built)
|
|
66
|
+
this.add(part);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
this._assembling = false;
|
|
70
|
+
}
|
|
59
71
|
this._built = built.length;
|
|
60
72
|
}
|
|
61
73
|
}
|
|
@@ -98,7 +110,7 @@ export function componentBase(Base, l) {
|
|
|
98
110
|
}
|
|
99
111
|
acceptsChild(child) {
|
|
100
112
|
const allowed = s.allowedChildren;
|
|
101
|
-
if (allowed === undefined || allowed === null)
|
|
113
|
+
if (allowed === undefined || allowed === null || (this._assembling && allowed.length === 0))
|
|
102
114
|
return super.acceptsChild(child);
|
|
103
115
|
return allowed.some((rule) => matches(child, rule));
|
|
104
116
|
}
|
|
@@ -166,6 +178,7 @@ export function finishComponent(Generated, l) {
|
|
|
166
178
|
// Commands have their own namespace: a key a node already uses (`remove`, `to`) publishes through another method name.
|
|
167
179
|
const method = key in base ? `_command_${key}` : key;
|
|
168
180
|
let args;
|
|
181
|
+
const entrance = typeof entry === "object" && entry.entrance === true;
|
|
169
182
|
if (typeof entry === "function") {
|
|
170
183
|
proto[method] = function (cmd = {}) {
|
|
171
184
|
const duration = cmd.duration ?? 0;
|
|
@@ -208,11 +221,32 @@ export function finishComponent(Generated, l) {
|
|
|
208
221
|
};
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
|
-
command({ key, ...(args ? { args } : {}) })(proto, method);
|
|
224
|
+
command({ key, ...(args ? { args } : {}), ...(entrance ? { entrance } : {}) })(proto, method);
|
|
225
|
+
}
|
|
226
|
+
if (s.renamed || s.deprecated || s.migrate) {
|
|
227
|
+
declarePropEvolution(Generated, { renamed: s.renamed ?? {}, deprecated: s.deprecated ?? {}, migrate: s.migrate ?? {} });
|
|
212
228
|
}
|
|
213
229
|
node({ key: s.key })(Generated);
|
|
214
230
|
return componentValue(s.key, Generated);
|
|
215
231
|
}
|
|
232
|
+
/** A rename lands on an entry from a key that is none; a deprecation and a hook name what is there to evolve. */
|
|
233
|
+
function checkEvolution(spec, isEntry) {
|
|
234
|
+
for (const [from, to] of Object.entries(spec.renamed ?? {})) {
|
|
235
|
+
if (isEntry(from))
|
|
236
|
+
throw new TypeError(`${spec.key}: "renamed.${from}" is still an entry; a renamed key must be gone.`);
|
|
237
|
+
if (!isEntry(to))
|
|
238
|
+
throw new TypeError(`${spec.key}: "renamed.${from}" names "${to}", which is no entry.`);
|
|
239
|
+
}
|
|
240
|
+
for (const key of Object.keys(spec.deprecated ?? {})) {
|
|
241
|
+
if (!isEntry(key))
|
|
242
|
+
throw new TypeError(`${spec.key}: "deprecated.${key}" names no entry.`);
|
|
243
|
+
}
|
|
244
|
+
for (const key of Object.keys(spec.migrate ?? {})) {
|
|
245
|
+
if (!isEntry(key) && !Object.hasOwn(spec.renamed ?? {}, key)) {
|
|
246
|
+
throw new TypeError(`${spec.key}: "migrate.${key}" names neither an entry nor a renamed key.`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
216
250
|
/** Remove the generated override of `name`, wherever between the class and its base it sits. */
|
|
217
251
|
function deleteUpTo(proto, name) {
|
|
218
252
|
for (let at = proto; at; at = Object.getPrototypeOf(at)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/components/factory/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,QA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I,EAAE,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC5H,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;KACtC,CAAC;AACN,CAAC","sourcesContent":["import type { Disposer } from \"@/assets/record\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { getPropertyMeta, property, type PropertyMeta } from \"@/attributes/properties/decorator\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { node } from \"@/document/node-decorator\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { settling, type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command, type CommandArg } from \"@/tween/command-decorator\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { ContextMap } from \"@/util/context\";\r\nimport type { ChildView, Loader, Provided, StateSpec } from \"@/components/factory/api\";\r\nimport { commandOf, makeTimeline } from \"@/components/factory/timeline\";\r\nimport { defOf, isTypeLike, type TypeDef } from \"@/components/factory/type-def\";\r\nimport { nodeOfView, nodeView, snapshot, stateView, stateViewPrototype, type ViewShape } from \"@/components/factory/views\";\r\n\r\n/**\r\n * What every factory does, whatever tree it builds for: declare the state on a\r\n * generated subclass of the tree's base, publish the commands, run the\r\n * `children` builder, provide and inherit context, and declare assets. Each\r\n * factory adds only its own tree's hooks on top.\r\n */\r\n\r\n/** The fields every factory takes. */\r\nexport interface CoreSpec {\r\n readonly key: string;\r\n readonly state?: StateSpec;\r\n readonly defaults?: Record<string, unknown>;\r\n readonly commands?: Record<string, unknown>;\r\n readonly children?: (state: never) => unknown;\r\n readonly provide?: (state: never, inherited: <T>(context: { readonly id: symbol; readonly defaultValue: T }) => T) => readonly Provided[];\r\n readonly load?: (loader: Loader, state: never) => void;\r\n /** `[]` takes none; `null` (the default) anything of its tree; components, or `\"2d\"`/`\"3d\"`/`\"audio\"`, only those. */\r\n readonly allowedChildren?: readonly unknown[] | null;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. */\r\n readonly allowedParents?: readonly unknown[];\r\n}\r\n\r\n/** A spec, resolved against the base it lowers onto. */\r\nexport interface Lowering {\r\n readonly spec: CoreSpec;\r\n readonly entries: Map<string, TypeDef>;\r\n readonly defaults: Record<string, unknown>;\r\n readonly builtIn: ReadonlyMap<string, PropertyMeta>;\r\n readonly view: ViewShape;\r\n /** Built-in entries whose default a factory applies itself (a 2D size), not by redeclaring the property. */\r\n readonly ownsDefault: ReadonlySet<string>;\r\n}\r\n\r\ntype NodeBase = abstract new (...args: any[]) => Node;\r\n\r\nexport function lowering(spec: CoreSpec, Base: NodeBase, ownsDefault: ReadonlySet<string> = new Set()): Lowering {\r\n const builtIn = new Map(getPropertyMeta(Object.create(Base.prototype as object)).map((m) => [m.key, m]));\r\n const entries = new Map<string, TypeDef>(Object.entries(spec.state ?? {}).map(([k, e]) => [k, defOf(e)]));\r\n const defaults = (spec.defaults ?? {}) as Record<string, unknown>;\r\n // A default for an own entry is that entry's default; for a built-in one, a redeclaration.\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (typeof value === \"function\") continue;\r\n const own = entries.get(key);\r\n if (own) entries.set(key, { ...own, default: value });\r\n else if (!builtIn.has(key)) throw new TypeError(`${spec.key}: \"defaults.${key}\" names no entry.`);\r\n }\r\n // A reference entry holds an id; its fields read a view of the node it names.\r\n const references = new Set([...entries].filter(([, def]) => def.editor.kind === \"nodeRef\").map(([key]) => key));\r\n return { spec, entries, defaults, builtIn, view: stateViewPrototype([...builtIn.keys(), ...entries.keys()], references), ownsDefault };\r\n}\r\n\r\nexport function factoryDefault(def: TypeDef): unknown {\r\n return typeof def.default === \"function\" ? (def.default as () => unknown)() : def.default;\r\n}\r\n\r\n/** The members every generated node has, whatever its tree. */\r\nexport interface ComponentNode extends Node {\r\n _view: object;\r\n /** How many nodes the `children` builder made. */\r\n _built: number;\r\n _commandChildren(): readonly ChildView[];\r\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\r\n}\r\n\r\n/** The base every tree's generated class extends: `Base` with the spec's state, context, assets and children. */\r\nexport function componentBase<T extends NodeBase>(Base: T, l: Lowering): T & (abstract new (...args: any[]) => ComponentNode) {\r\n const { spec: s, entries, defaults } = l;\r\n\r\n abstract class Componentized extends (Base as unknown as abstract new (...args: any[]) => Node) implements Partial<ComponentNode> {\r\n declare _view: object;\r\n declare _built: number;\r\n declare _provided: { parent: ContextMap; values: readonly Provided[]; map: ContextMap } | undefined;\r\n\r\n constructor(...args: any[]) {\r\n const props = args[0] as Record<string, unknown> | undefined;\r\n const given = s.children ? props?.children : undefined;\r\n super(s.children && props ? { ...props, children: undefined } : props);\r\n this._view = stateView(l.view, this);\r\n this._built = 0;\r\n\r\n for (const [key, def] of entries) {\r\n if (def.private) this.applyProp(key, factoryDefault(def), { mapper: def.mapper, tween: def.tween });\r\n else if (typeof def.default === \"function\" && props?.[key] === undefined) this._writeProp(key, factoryDefault(def));\r\n }\r\n let built: Readonly<Record<string, unknown>> | undefined;\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (typeof value === \"function\" && props?.[key] === undefined) {\r\n const asBuilt = (built ??= Object.freeze({ ...props }));\r\n this._writeProp(key, () => (value as (state: object, given: object) => unknown)(this._view, asBuilt));\r\n }\r\n }\r\n\r\n if (s.children) {\r\n // Live, like the field state, so a binding the builder writes reads the node as it changes.\r\n const builderState = stateView(l.view, this);\r\n Object.defineProperty(builderState, \"children\", { value: [given ?? []].flat(Infinity).filter(Boolean) });\r\n const built = [s.children(builderState as never)].flat(Infinity).filter(Boolean) as Node[];\r\n for (const part of built) this.add(part);\r\n this._built = built.length;\r\n }\r\n }\r\n\r\n /** Each entry the author left unset that inherits takes what its ancestors provide, once, on first attach. */\r\n protected override resolveContext(ctx: ContextMap): void {\r\n super.resolveContext(ctx);\r\n const given = (this._props ?? {}) as Record<string, unknown>;\r\n const self = this as unknown as Record<string, unknown>;\r\n for (const [key, def] of entries) {\r\n if (!def.inherit || given[key] !== undefined) continue;\r\n const value = def.inherit((context) => ctx.get(context), given);\r\n if (value !== undefined) self[key] = value;\r\n }\r\n }\r\n\r\n protected override provideContext(parent: ContextMap): ContextMap {\r\n if (!s.provide) return super.provideContext(parent);\r\n const provided = s.provide(this._view as never, (context) => parent.get(context as never));\r\n // The same map while nothing changed, so the subtree isn't re-bound every attach.\r\n const memo = this._provided;\r\n if (memo && memo.parent === parent && memo.values.length === provided.length\r\n && memo.values.every((p, i) => p.context === provided[i].context && p.value === provided[i].value)) return memo.map;\r\n let map = parent;\r\n for (const { context, value } of provided) if (map.get(context) !== value) map = map.with(context, value);\r\n this._provided = { parent, values: provided, map };\r\n return map;\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n const self = this as unknown as Record<string, unknown>;\r\n for (const [key, def] of entries) declareEntry(assets, def.editor.kind ?? \"\", self[key]);\r\n if (s.load) s.load(loaderOf(assets), this._view as never);\r\n }\r\n\r\n protected override acceptsChild(child: Node): boolean {\r\n const allowed = s.allowedChildren;\r\n if (allowed === undefined || allowed === null) return super.acceptsChild(child);\r\n return allowed.some((rule) => matches(child, rule));\r\n }\r\n\r\n protected override _childRule(): string {\r\n const allowed = s.allowedChildren;\r\n if (!allowed) return super._childRule();\r\n return allowed.length === 0 ? \"It takes no children.\" : `It takes only ${namesOf(allowed)}.`;\r\n }\r\n\r\n override _parentRefusal(parent: Node): string | null {\r\n const allowed = s.allowedParents;\r\n if (!allowed || allowed.some((rule) => matches(parent, rule))) return null;\r\n return `${this.className} goes only inside ${namesOf(allowed)}, not ${parent.className}.`;\r\n }\r\n\r\n /** The children a command's builders see: none, unless the tree says which. */\r\n _commandChildren(): readonly ChildView[] {\r\n return [];\r\n }\r\n\r\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown) {\r\n return this.command(frame, duration, easing as EasingFunction | undefined);\r\n }\r\n }\r\n return Componentized as unknown as T & (abstract new (...args: any[]) => ComponentNode);\r\n}\r\n\r\ntype CommandFn = (timeline: unknown, state: unknown, children: unknown) => never;\r\n\r\n/**\r\n * Declare the state and commands on the generated class, register its key, and\r\n * hand back the component value.\r\n */\r\nexport function finishComponent(Generated: abstract new (...args: any[]) => Node, l: Lowering): object {\r\n const { spec: s, entries, defaults, builtIn } = l;\r\n Object.defineProperty(Generated, \"name\", { value: pascal(s.key) });\r\n const proto = Generated.prototype as unknown as Record<string, unknown>;\r\n // A node is a context provider by overriding these: only one that provides, or inherits, keeps them.\r\n if (!s.provide) deleteUpTo(proto, \"provideContext\");\r\n if (![...entries.values()].some((def) => def.inherit)) deleteUpTo(proto, \"resolveContext\");\r\n if (s.allowedChildren === undefined || s.allowedChildren === null) {\r\n deleteUpTo(proto, \"acceptsChild\");\r\n deleteUpTo(proto, \"_childRule\");\r\n }\r\n if (!s.allowedParents) deleteUpTo(proto, \"_parentRefusal\");\r\n const allowed = s.allowedChildren;\r\n if (allowed) {\r\n const trees = [...new Set(allowed.map((rule) => (typeof rule === \"string\"\r\n ? rule\r\n : (Object.create((rule as { node: { prototype: object } }).node.prototype) as Node).dimension)))];\r\n Object.defineProperty(proto, \"_childTrees\", { get: () => trees, configurable: true });\r\n }\r\n\r\n for (const [key, def] of entries) {\r\n if (def.private) continue;\r\n property({ default: typeof def.default === \"function\" ? undefined : def.default, mapper: def.mapper, tween: def.tween, ...def.editor })(proto, key);\r\n }\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (entries.has(key) || l.ownsDefault.has(key) || typeof value === \"function\") continue;\r\n const inherited = builtIn.get(key)!;\r\n property({ default: value, mapper: inherited.options?.mapper, tween: inherited.options?.tween, ...inherited.editor })(proto, key);\r\n }\r\n\r\n const base = Object.getPrototypeOf(Object.getPrototypeOf(proto)) as object;\r\n for (const [key, entry] of Object.entries(s.commands ?? {})) {\r\n // Commands have their own namespace: a key a node already uses (`remove`, `to`) publishes through another method name.\r\n const method = key in base ? `_command_${key}` : key;\r\n let args: CommandArg[] | undefined;\r\n if (typeof entry === \"function\") {\r\n proto[method] = function (this: ComponentNode, cmd: CommandArgs & { duration?: number } = {}): Command<Record<string, unknown>> {\r\n const duration = cmd.duration ?? 0;\r\n const timeline = makeTimeline({}, duration, cmd.easing, nodeView(this, this));\r\n const piece = (entry as CommandFn)(timeline, snapshot(this._view), this._commandChildren());\r\n return commandOf(this as never, piece, duration, cmd.easing);\r\n };\r\n } else {\r\n const { args: declared, run, easing: ownEasing } = entry as { args: readonly string[] | StateSpec; run?: CommandFn; easing?: EasingFunction };\r\n if (Array.isArray(declared)) {\r\n const names = declared as readonly string[];\r\n for (const name of names) {\r\n if (!entries.has(name) && !builtIn.has(name)) throw new TypeError(`${s.key}.${key}: args names \"${name}\", which is no entry.`);\r\n }\r\n // Each arg is its entry: what a host shows for it is what the entry means.\r\n args = names.map((name) => ({ key: name, ...(entries.get(name)?.editor ?? builtIn.get(name)?.editor ?? {}) }));\r\n proto[method] = function (this: Node, cmd: CommandArgs & { duration?: number } = {}) {\r\n const data = argsRecord(cmd.data, names);\r\n const stated: Record<string, unknown> = {};\r\n for (const name of names) if (data[name] !== undefined) stated[name] = data[name];\r\n return settling(this.to({ data: stated as never, duration: cmd.duration ?? 0, easing: cmd.easing ?? ownEasing }));\r\n };\r\n } else {\r\n const own = declared as StateSpec;\r\n args = Object.entries(own).map(([k, e]) => {\r\n const def = defOf(e);\r\n return { key: k, default: isTypeLike(e) ? factoryDefault(def) : e, ...def.editor };\r\n });\r\n proto[method] = function (this: ComponentNode, cmd: CommandArgs & { duration?: number } = {}) {\r\n const duration = cmd.duration ?? 0;\r\n const easing = cmd.easing ?? ownEasing;\r\n const timeline = makeTimeline(resolveArgs(own, cmd.data), duration, easing, nodeView(this, this));\r\n const piece = run!(timeline, snapshot(this._view), this._commandChildren());\r\n return commandOf(this as never, piece, duration, easing);\r\n };\r\n }\r\n }\r\n command({ key, ...(args ? { args } : {}) })(proto, method);\r\n }\r\n\r\n node({ key: s.key })(Generated as never);\r\n return componentValue(s.key, Generated as unknown as new (props?: Record<string, unknown>) => object);\r\n}\r\n\r\n/** Remove the generated override of `name`, wherever between the class and its base it sits. */\r\nfunction deleteUpTo(proto: Record<string, unknown>, name: string): void {\r\n for (let at: Record<string, unknown> | null = proto; at; at = Object.getPrototypeOf(at) as Record<string, unknown> | null) {\r\n if (Object.prototype.hasOwnProperty.call(at, name)) {\r\n delete at[name];\r\n return;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * What a factory hands back: call it (`Rect({...})`) or `new` it, either way a\r\n * node of the generated class, which is also what `instanceof` tests.\r\n */\r\nexport function componentValue(key: string, Generated: new (props?: Record<string, unknown>) => object): object {\r\n const make = function (props?: object) {\r\n return new Generated(props as Record<string, unknown>);\r\n };\r\n make.prototype = Generated.prototype;\r\n Object.defineProperty(make, \"name\", { value: Generated.name });\r\n return Object.assign(make, {\r\n key,\r\n node: Generated,\r\n is: (child: unknown) => nodeOfView(child as never) instanceof Generated,\r\n });\r\n}\r\n\r\nfunction pascal(key: string): string {\r\n return key.replace(/(^|[-_ ])(\\w)/g, (_, _sep, c: string) => c.toUpperCase());\r\n}\r\n\r\n/** Whether `node` is of `rule`: a component, or a whole tree by name. */\r\nfunction matches(node: Node, rule: unknown): boolean {\r\n return typeof rule === \"string\"\r\n ? node.dimension === rule\r\n : node instanceof (rule as { node: abstract new (...args: never[]) => unknown }).node;\r\n}\r\n\r\nfunction namesOf(rules: readonly unknown[]): string {\r\n const names = rules.map((rule) => (typeof rule === \"string\" ? `any ${rule.toUpperCase()} node` : (rule as { node: { name: string } }).node.name));\r\n return names.length === 1 ? names[0] : `${names.slice(0, -1).join(\", \")} or ${names.at(-1)}`;\r\n}\r\n\r\n/** One document arg: the bare value from a paint command, or the args record from the registry. */\r\nfunction argsRecord(data: unknown, names: readonly string[]): Record<string, unknown> {\r\n if (names.length === 1) {\r\n const plain = typeof data === \"object\" && data !== null && !Array.isArray(data) && Object.getPrototypeOf(data) === Object.prototype;\r\n if (!(plain && names[0] in (data as object))) return { [names[0]]: data };\r\n }\r\n return (data ?? {}) as Record<string, unknown>;\r\n}\r\n\r\nfunction resolveArgs(spec: StateSpec, data: unknown): Record<string, unknown> {\r\n const given = (data ?? {}) as Record<string, unknown>;\r\n const out: Record<string, unknown> = {};\r\n for (const key in spec) {\r\n const def = defOf(spec[key]);\r\n const value = given[key] === undefined ? factoryDefault(def) : given[key];\r\n out[key] = def.mapper ? def.mapper(value) : value;\r\n }\r\n return out;\r\n}\r\n\r\nfunction declareEntry(assets: AssetScope, kind: string, value: unknown): void {\r\n if (value === undefined || value === null || value === \"\") return;\r\n switch (kind) {\r\n case \"fills\": return assets.fill(value as FillResolved[]);\r\n case \"strokes\": for (const stroke of value as StrokeResolved[]) assets.fill(stroke.fill); return;\r\n case \"shadows\": for (const shadow of value as ShadowResolved[]) assets.fill(shadow.fill); return;\r\n case \"image\": return assets.image(value as string);\r\n case \"video\": return assets.video(value as string);\r\n case \"font\": return assets.font(value as string);\r\n }\r\n}\r\n\r\n/** One wrapper per load function: the scope warns when a key's second declaration hands it a different one. */\r\nconst tasks = new WeakMap<() => Promise<unknown>, () => Promise<void | Disposer>>();\r\n\r\nfunction taskOf(load: () => Promise<unknown>): () => Promise<void | Disposer> {\r\n let task = tasks.get(load);\r\n if (!task) {\r\n task = async () => {\r\n const loaded = await load();\r\n return typeof loaded === \"function\" ? (loaded as Disposer) : undefined;\r\n };\r\n tasks.set(load, task);\r\n }\r\n return task;\r\n}\r\n\r\nfunction loaderOf(assets: AssetScope): Loader {\r\n return {\r\n font: (family, weight) => assets.font(family, weight),\r\n image: (src) => assets.image(src),\r\n video: (src, trim) => assets.video(src, trim),\r\n task: (key, load, options) => assets.loader(key, taskOf(load), { gate: options?.before === \"layout\" ? \"layout\" : \"render\" }),\r\n fill: (fills) => assets.fill(fills),\r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;KACtC,CAAC;AACN,CAAC","sourcesContent":["import type { Disposer } from \"@/assets/record\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { getPropertyMeta, property, type PropertyMeta } from \"@/attributes/properties/decorator\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { node } from \"@/document/node-decorator\";\r\nimport { declarePropEvolution } from \"@/document/prop-evolution\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { settling, type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command, type CommandArg } from \"@/tween/command-decorator\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { ContextMap } from \"@/util/context\";\r\nimport type { ChildView, Loader, Provided, StateSpec } from \"@/components/factory/api\";\r\nimport { commandOf, makeTimeline } from \"@/components/factory/timeline\";\r\nimport { defOf, isTypeLike, type TypeDef } from \"@/components/factory/type-def\";\r\nimport { nodeOfView, nodeView, snapshot, stateView, stateViewPrototype, type ViewShape } from \"@/components/factory/views\";\r\n\r\n/**\r\n * What every factory does, whatever tree it builds for: declare the state on a\r\n * generated subclass of the tree's base, publish the commands, run the\r\n * `children` builder, provide and inherit context, and declare assets. Each\r\n * factory adds only its own tree's hooks on top.\r\n */\r\n\r\n/** The fields every factory takes. */\r\nexport interface CoreSpec {\r\n readonly key: string;\r\n readonly state?: StateSpec;\r\n readonly defaults?: Record<string, unknown>;\r\n readonly renamed?: Readonly<Record<string, string>>;\r\n readonly deprecated?: Readonly<Record<string, string>>;\r\n readonly migrate?: Readonly<Record<string, (value: unknown) => unknown>>;\r\n readonly commands?: Record<string, unknown>;\r\n readonly children?: (state: never) => unknown;\r\n readonly provide?: (state: never, inherited: <T>(context: { readonly id: symbol; readonly defaultValue: T }) => T) => readonly Provided[];\r\n readonly load?: (loader: Loader, state: never) => void;\r\n /** `[]` takes none; `null` (the default) anything of its tree; components, or `\"2d\"`/`\"3d\"`/`\"audio\"`, only those. */\r\n readonly allowedChildren?: readonly unknown[] | null;\r\n /** The components it goes only inside; unsaid, wherever its tree allows. */\r\n readonly allowedParents?: readonly unknown[];\r\n}\r\n\r\n/** A spec, resolved against the base it lowers onto. */\r\nexport interface Lowering {\r\n readonly spec: CoreSpec;\r\n readonly entries: Map<string, TypeDef>;\r\n readonly defaults: Record<string, unknown>;\r\n readonly builtIn: ReadonlyMap<string, PropertyMeta>;\r\n readonly view: ViewShape;\r\n /** Built-in entries whose default a factory applies itself (a 2D size), not by redeclaring the property. */\r\n readonly ownsDefault: ReadonlySet<string>;\r\n}\r\n\r\ntype NodeBase = abstract new (...args: any[]) => Node;\r\n\r\nexport function lowering(spec: CoreSpec, Base: NodeBase, ownsDefault: ReadonlySet<string> = new Set()): Lowering {\r\n const builtIn = new Map(getPropertyMeta(Object.create(Base.prototype as object)).map((m) => [m.key, m]));\r\n const entries = new Map<string, TypeDef>(Object.entries(spec.state ?? {}).map(([k, e]) => [k, defOf(e)]));\r\n const defaults = (spec.defaults ?? {}) as Record<string, unknown>;\r\n // A default for an own entry is that entry's default; for a built-in one, a redeclaration.\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (typeof value === \"function\") continue;\r\n const own = entries.get(key);\r\n if (own) entries.set(key, { ...own, default: value });\r\n else if (!builtIn.has(key)) throw new TypeError(`${spec.key}: \"defaults.${key}\" names no entry.`);\r\n }\r\n checkEvolution(spec, (key) => entries.has(key) || builtIn.has(key));\r\n // A reference entry holds an id; its fields read a view of the node it names.\r\n const references = new Set([...entries].filter(([, def]) => def.editor.kind === \"nodeRef\").map(([key]) => key));\r\n return { spec, entries, defaults, builtIn, view: stateViewPrototype([...builtIn.keys(), ...entries.keys()], references), ownsDefault };\r\n}\r\n\r\nexport function factoryDefault(def: TypeDef): unknown {\r\n return typeof def.default === \"function\" ? (def.default as () => unknown)() : def.default;\r\n}\r\n\r\n/** The members every generated node has, whatever its tree. */\r\nexport interface ComponentNode extends Node {\r\n _view: object;\r\n /** How many nodes the `children` builder made. */\r\n _built: number;\r\n _commandChildren(): readonly ChildView[];\r\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\r\n}\r\n\r\n/** The base every tree's generated class extends: `Base` with the spec's state, context, assets and children. */\r\nexport function componentBase<T extends NodeBase>(Base: T, l: Lowering): T & (abstract new (...args: any[]) => ComponentNode) {\r\n const { spec: s, entries, defaults } = l;\r\n\r\n abstract class Componentized extends (Base as unknown as abstract new (...args: any[]) => Node) implements Partial<ComponentNode> {\r\n declare _view: object;\r\n declare _built: number;\r\n declare _assembling: boolean;\r\n declare _provided: { parent: ContextMap; values: readonly Provided[]; map: ContextMap } | undefined;\r\n\r\n constructor(...args: any[]) {\r\n const props = args[0] as Record<string, unknown> | undefined;\r\n const given = s.children ? props?.children : undefined;\r\n super(s.children && props ? { ...props, children: undefined } : props);\r\n this._view = stateView(l.view, this);\r\n this._built = 0;\r\n\r\n for (const [key, def] of entries) {\r\n if (def.private) this.applyProp(key, factoryDefault(def), { mapper: def.mapper, tween: def.tween });\r\n else if (typeof def.default === \"function\" && props?.[key] === undefined) this._writeProp(key, factoryDefault(def));\r\n }\r\n let built: Readonly<Record<string, unknown>> | undefined;\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (typeof value === \"function\" && props?.[key] === undefined) {\r\n const asBuilt = (built ??= Object.freeze({ ...props }));\r\n this._writeProp(key, () => (value as (state: object, given: object) => unknown)(this._view, asBuilt));\r\n }\r\n }\r\n\r\n if (s.children) {\r\n // Live, like the field state, so a binding the builder writes reads the node as it changes.\r\n const builderState = stateView(l.view, this);\r\n const authored = [given ?? []].flat(Infinity).filter(Boolean);\r\n if (s.allowedChildren != null) for (const child of authored) this.assertAcceptsChild(child as Node);\r\n Object.defineProperty(builderState, \"children\", { value: authored });\r\n const built = [s.children(builderState as never)].flat(Infinity).filter(Boolean) as Node[];\r\n this._assembling = true;\r\n try {\r\n for (const part of built) this.add(part);\r\n } finally {\r\n this._assembling = false;\r\n }\r\n this._built = built.length;\r\n }\r\n }\r\n\r\n /** Each entry the author left unset that inherits takes what its ancestors provide, once, on first attach. */\r\n protected override resolveContext(ctx: ContextMap): void {\r\n super.resolveContext(ctx);\r\n const given = (this._props ?? {}) as Record<string, unknown>;\r\n const self = this as unknown as Record<string, unknown>;\r\n for (const [key, def] of entries) {\r\n if (!def.inherit || given[key] !== undefined) continue;\r\n const value = def.inherit((context) => ctx.get(context), given);\r\n if (value !== undefined) self[key] = value;\r\n }\r\n }\r\n\r\n protected override provideContext(parent: ContextMap): ContextMap {\r\n if (!s.provide) return super.provideContext(parent);\r\n const provided = s.provide(this._view as never, (context) => parent.get(context as never));\r\n // The same map while nothing changed, so the subtree isn't re-bound every attach.\r\n const memo = this._provided;\r\n if (memo && memo.parent === parent && memo.values.length === provided.length\r\n && memo.values.every((p, i) => p.context === provided[i].context && p.value === provided[i].value)) return memo.map;\r\n let map = parent;\r\n for (const { context, value } of provided) if (map.get(context) !== value) map = map.with(context, value);\r\n this._provided = { parent, values: provided, map };\r\n return map;\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n const self = this as unknown as Record<string, unknown>;\r\n for (const [key, def] of entries) declareEntry(assets, def.editor.kind ?? \"\", self[key]);\r\n if (s.load) s.load(loaderOf(assets), this._view as never);\r\n }\r\n\r\n protected override acceptsChild(child: Node): boolean {\r\n const allowed = s.allowedChildren;\r\n if (allowed === undefined || allowed === null || (this._assembling && allowed.length === 0)) return super.acceptsChild(child);\r\n return allowed.some((rule) => matches(child, rule));\r\n }\r\n\r\n protected override _childRule(): string {\r\n const allowed = s.allowedChildren;\r\n if (!allowed) return super._childRule();\r\n return allowed.length === 0 ? \"It takes no children.\" : `It takes only ${namesOf(allowed)}.`;\r\n }\r\n\r\n override _parentRefusal(parent: Node): string | null {\r\n const allowed = s.allowedParents;\r\n if (!allowed || allowed.some((rule) => matches(parent, rule))) return null;\r\n return `${this.className} goes only inside ${namesOf(allowed)}, not ${parent.className}.`;\r\n }\r\n\r\n /** The children a command's builders see: none, unless the tree says which. */\r\n _commandChildren(): readonly ChildView[] {\r\n return [];\r\n }\r\n\r\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown) {\r\n return this.command(frame, duration, easing as EasingFunction | undefined);\r\n }\r\n }\r\n return Componentized as unknown as T & (abstract new (...args: any[]) => ComponentNode);\r\n}\r\n\r\ntype CommandFn = (timeline: unknown, state: unknown, children: unknown) => never;\r\n\r\n/**\r\n * Declare the state and commands on the generated class, register its key, and\r\n * hand back the component value.\r\n */\r\nexport function finishComponent(Generated: abstract new (...args: any[]) => Node, l: Lowering): object {\r\n const { spec: s, entries, defaults, builtIn } = l;\r\n Object.defineProperty(Generated, \"name\", { value: pascal(s.key) });\r\n const proto = Generated.prototype as unknown as Record<string, unknown>;\r\n // A node is a context provider by overriding these: only one that provides, or inherits, keeps them.\r\n if (!s.provide) deleteUpTo(proto, \"provideContext\");\r\n if (![...entries.values()].some((def) => def.inherit)) deleteUpTo(proto, \"resolveContext\");\r\n if (s.allowedChildren === undefined || s.allowedChildren === null) {\r\n deleteUpTo(proto, \"acceptsChild\");\r\n deleteUpTo(proto, \"_childRule\");\r\n }\r\n if (!s.allowedParents) deleteUpTo(proto, \"_parentRefusal\");\r\n const allowed = s.allowedChildren;\r\n if (allowed) {\r\n const trees = [...new Set(allowed.map((rule) => (typeof rule === \"string\"\r\n ? rule\r\n : (Object.create((rule as { node: { prototype: object } }).node.prototype) as Node).dimension)))];\r\n Object.defineProperty(proto, \"_childTrees\", { get: () => trees, configurable: true });\r\n }\r\n\r\n for (const [key, def] of entries) {\r\n if (def.private) continue;\r\n property({ default: typeof def.default === \"function\" ? undefined : def.default, mapper: def.mapper, tween: def.tween, ...def.editor })(proto, key);\r\n }\r\n for (const [key, value] of Object.entries(defaults)) {\r\n if (entries.has(key) || l.ownsDefault.has(key) || typeof value === \"function\") continue;\r\n const inherited = builtIn.get(key)!;\r\n property({ default: value, mapper: inherited.options?.mapper, tween: inherited.options?.tween, ...inherited.editor })(proto, key);\r\n }\r\n\r\n const base = Object.getPrototypeOf(Object.getPrototypeOf(proto)) as object;\r\n for (const [key, entry] of Object.entries(s.commands ?? {})) {\r\n // Commands have their own namespace: a key a node already uses (`remove`, `to`) publishes through another method name.\r\n const method = key in base ? `_command_${key}` : key;\r\n let args: CommandArg[] | undefined;\r\n const entrance = typeof entry === \"object\" && (entry as { entrance?: boolean }).entrance === true;\r\n if (typeof entry === \"function\") {\r\n proto[method] = function (this: ComponentNode, cmd: CommandArgs & { duration?: number } = {}): Command<Record<string, unknown>> {\r\n const duration = cmd.duration ?? 0;\r\n const timeline = makeTimeline({}, duration, cmd.easing, nodeView(this, this));\r\n const piece = (entry as CommandFn)(timeline, snapshot(this._view), this._commandChildren());\r\n return commandOf(this as never, piece, duration, cmd.easing);\r\n };\r\n } else {\r\n const { args: declared, run, easing: ownEasing } = entry as { args: readonly string[] | StateSpec; run?: CommandFn; easing?: EasingFunction };\r\n if (Array.isArray(declared)) {\r\n const names = declared as readonly string[];\r\n for (const name of names) {\r\n if (!entries.has(name) && !builtIn.has(name)) throw new TypeError(`${s.key}.${key}: args names \"${name}\", which is no entry.`);\r\n }\r\n // Each arg is its entry: what a host shows for it is what the entry means.\r\n args = names.map((name) => ({ key: name, ...(entries.get(name)?.editor ?? builtIn.get(name)?.editor ?? {}) }));\r\n proto[method] = function (this: Node, cmd: CommandArgs & { duration?: number } = {}) {\r\n const data = argsRecord(cmd.data, names);\r\n const stated: Record<string, unknown> = {};\r\n for (const name of names) if (data[name] !== undefined) stated[name] = data[name];\r\n return settling(this.to({ data: stated as never, duration: cmd.duration ?? 0, easing: cmd.easing ?? ownEasing }));\r\n };\r\n } else {\r\n const own = declared as StateSpec;\r\n args = Object.entries(own).map(([k, e]) => {\r\n const def = defOf(e);\r\n return { key: k, default: isTypeLike(e) ? factoryDefault(def) : e, ...def.editor };\r\n });\r\n proto[method] = function (this: ComponentNode, cmd: CommandArgs & { duration?: number } = {}) {\r\n const duration = cmd.duration ?? 0;\r\n const easing = cmd.easing ?? ownEasing;\r\n const timeline = makeTimeline(resolveArgs(own, cmd.data), duration, easing, nodeView(this, this));\r\n const piece = run!(timeline, snapshot(this._view), this._commandChildren());\r\n return commandOf(this as never, piece, duration, easing);\r\n };\r\n }\r\n }\r\n command({ key, ...(args ? { args } : {}), ...(entrance ? { entrance } : {}) })(proto, method);\r\n }\r\n\r\n if (s.renamed || s.deprecated || s.migrate) {\r\n declarePropEvolution(Generated, { renamed: s.renamed ?? {}, deprecated: s.deprecated ?? {}, migrate: s.migrate ?? {} });\r\n }\r\n node({ key: s.key })(Generated as never);\r\n return componentValue(s.key, Generated as unknown as new (props?: Record<string, unknown>) => object);\r\n}\r\n\r\n/** A rename lands on an entry from a key that is none; a deprecation and a hook name what is there to evolve. */\r\nfunction checkEvolution(spec: CoreSpec, isEntry: (key: string) => boolean): void {\r\n for (const [from, to] of Object.entries(spec.renamed ?? {})) {\r\n if (isEntry(from)) throw new TypeError(`${spec.key}: \"renamed.${from}\" is still an entry; a renamed key must be gone.`);\r\n if (!isEntry(to)) throw new TypeError(`${spec.key}: \"renamed.${from}\" names \"${to}\", which is no entry.`);\r\n }\r\n for (const key of Object.keys(spec.deprecated ?? {})) {\r\n if (!isEntry(key)) throw new TypeError(`${spec.key}: \"deprecated.${key}\" names no entry.`);\r\n }\r\n for (const key of Object.keys(spec.migrate ?? {})) {\r\n if (!isEntry(key) && !Object.hasOwn(spec.renamed ?? {}, key)) {\r\n throw new TypeError(`${spec.key}: \"migrate.${key}\" names neither an entry nor a renamed key.`);\r\n }\r\n }\r\n}\r\n\r\n/** Remove the generated override of `name`, wherever between the class and its base it sits. */\r\nfunction deleteUpTo(proto: Record<string, unknown>, name: string): void {\r\n for (let at: Record<string, unknown> | null = proto; at; at = Object.getPrototypeOf(at) as Record<string, unknown> | null) {\r\n if (Object.prototype.hasOwnProperty.call(at, name)) {\r\n delete at[name];\r\n return;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * What a factory hands back: call it (`Rect({...})`) or `new` it, either way a\r\n * node of the generated class, which is also what `instanceof` tests.\r\n */\r\nexport function componentValue(key: string, Generated: new (props?: Record<string, unknown>) => object): object {\r\n const make = function (props?: object) {\r\n return new Generated(props as Record<string, unknown>);\r\n };\r\n make.prototype = Generated.prototype;\r\n Object.defineProperty(make, \"name\", { value: Generated.name });\r\n return Object.assign(make, {\r\n key,\r\n node: Generated,\r\n is: (child: unknown) => nodeOfView(child as never) instanceof Generated,\r\n });\r\n}\r\n\r\nfunction pascal(key: string): string {\r\n return key.replace(/(^|[-_ ])(\\w)/g, (_, _sep, c: string) => c.toUpperCase());\r\n}\r\n\r\n/** Whether `node` is of `rule`: a component, or a whole tree by name. */\r\nfunction matches(node: Node, rule: unknown): boolean {\r\n return typeof rule === \"string\"\r\n ? node.dimension === rule\r\n : node instanceof (rule as { node: abstract new (...args: never[]) => unknown }).node;\r\n}\r\n\r\nfunction namesOf(rules: readonly unknown[]): string {\r\n const names = rules.map((rule) => (typeof rule === \"string\" ? `any ${rule.toUpperCase()} node` : (rule as { node: { name: string } }).node.name));\r\n return names.length === 1 ? names[0] : `${names.slice(0, -1).join(\", \")} or ${names.at(-1)}`;\r\n}\r\n\r\n/** One document arg: the bare value from a paint command, or the args record from the registry. */\r\nfunction argsRecord(data: unknown, names: readonly string[]): Record<string, unknown> {\r\n if (names.length === 1) {\r\n const plain = typeof data === \"object\" && data !== null && !Array.isArray(data) && Object.getPrototypeOf(data) === Object.prototype;\r\n if (!(plain && names[0] in (data as object))) return { [names[0]]: data };\r\n }\r\n return (data ?? {}) as Record<string, unknown>;\r\n}\r\n\r\nfunction resolveArgs(spec: StateSpec, data: unknown): Record<string, unknown> {\r\n const given = (data ?? {}) as Record<string, unknown>;\r\n const out: Record<string, unknown> = {};\r\n for (const key in spec) {\r\n const def = defOf(spec[key]);\r\n const value = given[key] === undefined ? factoryDefault(def) : given[key];\r\n out[key] = def.mapper ? def.mapper(value) : value;\r\n }\r\n return out;\r\n}\r\n\r\nfunction declareEntry(assets: AssetScope, kind: string, value: unknown): void {\r\n if (value === undefined || value === null || value === \"\") return;\r\n switch (kind) {\r\n case \"fills\": return assets.fill(value as FillResolved[]);\r\n case \"strokes\": for (const stroke of value as StrokeResolved[]) assets.fill(stroke.fill); return;\r\n case \"shadows\": for (const shadow of value as ShadowResolved[]) assets.fill(shadow.fill); return;\r\n case \"image\": return assets.image(value as string);\r\n case \"video\": return assets.video(value as string);\r\n case \"font\": return assets.font(value as string);\r\n }\r\n}\r\n\r\n/** One wrapper per load function: the scope warns when a key's second declaration hands it a different one. */\r\nconst tasks = new WeakMap<() => Promise<unknown>, () => Promise<void | Disposer>>();\r\n\r\nfunction taskOf(load: () => Promise<unknown>): () => Promise<void | Disposer> {\r\n let task = tasks.get(load);\r\n if (!task) {\r\n task = async () => {\r\n const loaded = await load();\r\n return typeof loaded === \"function\" ? (loaded as Disposer) : undefined;\r\n };\r\n tasks.set(load, task);\r\n }\r\n return task;\r\n}\r\n\r\nfunction loaderOf(assets: AssetScope): Loader {\r\n return {\r\n font: (family, weight) => assets.font(family, weight),\r\n image: (src) => assets.image(src),\r\n video: (src, trim) => assets.video(src, trim),\r\n task: (key, load, options) => assets.loader(key, taskOf(load), { gate: options?.before === \"layout\" ? \"layout\" : \"render\" }),\r\n fill: (fills) => assets.fill(fills),\r\n };\r\n}\r\n"]}
|
|
@@ -16,7 +16,7 @@ export declare const state: {
|
|
|
16
16
|
letterSpacing: import("../../components/factory/api.js").Type<number, number, false>;
|
|
17
17
|
lineHeight: import("../../components/factory/api.js").Type<number, number, false>;
|
|
18
18
|
textAlign: import("../../components/factory/api.js").Type<TextAlign, TextAlign, false>;
|
|
19
|
-
verticalAlign: import("../../components/factory/api.js").Type<"
|
|
19
|
+
verticalAlign: import("../../components/factory/api.js").Type<"center" | "top" | "bottom", "center" | "top" | "bottom", false>;
|
|
20
20
|
textDecoration: import("../../components/factory/api.js").Type<"none" | "underline" | "line-through", "none" | "underline" | "line-through", false>;
|
|
21
21
|
textCase: import("../../components/factory/api.js").Type<"none" | "upper" | "lower" | "title", "none" | "upper" | "lower" | "title", false>;
|
|
22
22
|
minFontSize: import("../../components/factory/api.js").Type<number, number, false>;
|
|
@@ -18,7 +18,7 @@ import { NodeEffect } from "../../../attributes/shape/effects/union.js";
|
|
|
18
18
|
export declare function computeSpaceRects(parentRect: BoxBounds | undefined, thisRect: BoxBounds, x: number, y: number): SpaceRects;
|
|
19
19
|
/**
|
|
20
20
|
* Apply backdrop effects (any `mode:"backdrop"` effect — blur, grayscale, …;
|
|
21
|
-
* plus magnify and backdrop
|
|
21
|
+
* plus magnify and backdrop shader) beneath the node, clipped to its silhouette,
|
|
22
22
|
* before the node's own content is drawn — so what's underneath is
|
|
23
23
|
* filtered/warped while the node's own edges stay sharp. A no-op when there are
|
|
24
24
|
* no backdrop effects or no silhouette `clip` to confine them to.
|
|
@@ -29,7 +29,7 @@ export function computeSpaceRects(parentRect, thisRect, x, y) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Apply backdrop effects (any `mode:"backdrop"` effect — blur, grayscale, …;
|
|
32
|
-
* plus magnify and backdrop
|
|
32
|
+
* plus magnify and backdrop shader) beneath the node, clipped to its silhouette,
|
|
33
33
|
* before the node's own content is drawn — so what's underneath is
|
|
34
34
|
* filtered/warped while the node's own edges stay sharp. A no-op when there are
|
|
35
35
|
* no backdrop effects or no silhouette `clip` to confine them to.
|