@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- 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 +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +4 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +10 -2
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +45 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +15 -39
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +16 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +2 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +25 -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 +70 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +2 -2
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/registry.d.ts +23 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +46 -19
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +100 -19
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +290 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +12 -12
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +2 -2
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +37 -31
- package/dist/document/validate.js.map +1 -1
- package/dist/document/withdraw.d.ts +28 -0
- package/dist/document/withdraw.d.ts.map +1 -0
- package/dist/document/withdraw.js +61 -0
- package/dist/document/withdraw.js.map +1 -0
- package/dist/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +4 -3
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +4 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +40 -33
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +17 -36
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +12 -4
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +67 -27
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/node/text-defaults.d.ts +10 -12
- package/dist/nodes/node/text-defaults.d.ts.map +1 -1
- package/dist/nodes/node/text-defaults.js +10 -12
- package/dist/nodes/node/text-defaults.js.map +1 -1
- package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
- package/dist/nodes/root/canvas2d-node.js.map +1 -0
- package/dist/nodes/root/provider-node.d.ts.map +1 -0
- package/dist/nodes/root/provider-node.js.map +1 -0
- package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
- package/dist/nodes/root/theme-provider-node.js.map +1 -0
- package/dist/nodes/text/default-text-style-node.d.ts +5 -2
- package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
- package/dist/nodes/text/default-text-style-node.js +10 -4
- package/dist/nodes/text/default-text-style-node.js.map +1 -1
- package/dist/nodes/text/number-format.d.ts +1 -1
- package/dist/nodes/text/number-format.js +1 -1
- package/dist/nodes/text/number-format.js.map +1 -1
- package/dist/nodes/text/number-node.js.map +1 -1
- package/dist/nodes/text/number-pattern.js.map +1 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +6 -72
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +13 -364
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- package/dist/nodes/text/text-node.js.map +1 -1
- package/dist/nodes/text/text-selection.js.map +1 -1
- package/dist/nodes/three/camera-nodes.d.ts +21 -3
- package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
- package/dist/nodes/three/camera-nodes.js +42 -1
- package/dist/nodes/three/camera-nodes.js.map +1 -1
- package/dist/nodes/three/canvas3d-node.d.ts +32 -7
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +50 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +9 -4
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +27 -9
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +18 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +97 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +124 -10
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +13 -5
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +10 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +31 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +63 -6
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +9 -7
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +12 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +1 -1
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +50 -25
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +52 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +7 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +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AAS,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACK,UAAU,CAAC,KAAc;QAC7B,QAAQ,OAAO,KAAK,EAAE,CAAC;YACnB,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC;YAC/B,KAAK,QAAQ,CAAC,CAAC,OAAO,MAAM,CAAC;YAC7B,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC;YACjC,KAAK,QAAQ;gBACT,IAAI,KAAK,KAAK,IAAI;oBAAE,OAAO,SAAS,CAAC;gBACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;oBAClE,CAAC,CAAC,QAAQ;oBACV,CAAC,CAAC,QAAQ,CAAC;YACnB,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QAC9B,CAAC;IACL,CAAC;IAED,sFAAsF;IAC9E,aAAa,CAAC,IAAuC;QACzD,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5B,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/F,CAAC","sourcesContent":["import type { Node, NodeDimension } from \"@/nodes/node/node\";\nimport type { Command, CommandArgs } from \"@/tween/command\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport { getPropertyMeta, type PropertyEditor } from \"@/attributes/properties/decorator\";\nimport { getCommandMeta, type CommandArg, type CommandArgDescriptor } from \"@/tween/command-decorator\";\nimport {\n normalizeShaderPack,\n type EffectShader,\n type FillShader,\n type Shader,\n} from \"@/attributes/shape/shaders/pack\";\nimport { installBuiltins } from \"./builtins\";\nimport { DENIED_GLOBALS } from \"./deny-globals\";\nimport { getNodeDescriptor } from \"./node-decorator\";\nimport type { NodePropertyDescriptor, NodeTypeDescriptor } from \"./node-descriptor\";\nimport type { NodeSpec } from \"./types\";\n\n/**\n * The specifiers a dynamic node's `require()` resolves to the host's sdk\n * barrel (and, with `/jsx-runtime` appended, to its JSX runtime). The published\n * name comes first; the two after it are the package's earlier unscoped names,\n * kept so a script authored under either still compiles.\n */\nconst SDK_SPECIFIERS: readonly string[] = [\"@motionscript/sdk\", \"motionscript\", \"motion-script\"];\n\n/**\n * The **code** half of the document model, as one object an engine owns.\n *\n * A document names a node type, a command, a lerp and a shader with a string.\n * Something has to turn `\"rect\"` into a class and `\"fillTo\"` into an animation,\n * and that something is deliberately a registry rather than a table in the\n * database: node types are code — a class with `@property` declarations, a\n * `renderSelf`, and `@command()` methods — and code is versioned with the\n * library, not with the document.\n *\n * **It is an instance, not a module.** Every table here used to be a\n * module-scope `Map` behind a dozen free functions, which made a registration\n * a fact about the *process*: two engines in one process shared one vocabulary,\n * a decorated class was registered by the mere act of being imported, whichever\n * host loaded first won a contested key, and a test had to remember to call a\n * `clearRegistries()` that reached into three modules. A registry is now a value\n * with an owner — an `Engine`'s own, reached through `registerNode`/`registerShader`\n * rather than a public `registry` field — so what a document can name is a\n * property of the engine opening it, and two engines disagree about it freely.\n *\n * ```ts\n * const registry = new Registry({ nodes: [Blob], shaders: { swirl: SWIRL } });\n * registry.commandKeys(\"blob\"); // [\"fadeTo\", \"moveTo\", …, \"wobbleTo\"]\n * ```\n *\n * **Commands are per node type, and that is the point.** They used to share one\n * flat table with the node types, which made a command key a global claim: the\n * first package to register `reveal` owned the word, and a second node type\n * wanting it — with different arguments — could not have it. Nothing about a\n * command is global, though: it is a method on a class, dispatched against an\n * instance the document already names. Only the handful that must resolve\n * *without* a node — the variable-scoped ones and the generic prop writers — sit\n * in a table of their own.\n */\n\n/** Constructs a node from its authored props. Every built-in node class matches this. */\nexport type NodeConstructor = new (props?: Record<string, unknown>) => Node;\n\n/** Node types a registry makes available, by the key a document names them with. */\nexport type NodeTypeMap = Record<string, NodeConstructor>;\n\n/** Shader packs a registry makes available, by document key. A pack is plain JSON. */\nexport type ShaderPackMap = Record<string, unknown>;\n\n/**\n * Builds the {@link Command} a `CommandSpec` stands for.\n *\n * Called **once per compile**, in timeline order, with `target` already in the\n * state the previous command left it — that is what fixes the command's `from`\n * value and makes the returned `Command.at(t)` pure thereafter. See\n * `tween/command.ts` and `document/timeline.ts`.\n *\n * @param target The node the command acts on (the scene root for `targetId: null`).\n * @param args The spec's `args`, verbatim.\n * @param duration Seconds, already defaulted by the caller.\n * @param easing Resolved from the spec's `EaseSpec`, or `undefined`.\n */\nexport type CommandFactory = (\n target: Node,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n) => Command<Record<string, unknown>>;\n\n/**\n * The variable a variable command writes.\n *\n * A handle rather than the cell itself, so a command cannot subscribe to it,\n * rebind it, or hold it past the build that made it — the three ways a command\n * could stop being a pure function of `t`.\n */\nexport interface VariableTarget {\n /** The id an expression names with `[id]`. */\n readonly id: string;\n /** What it holds right now. */\n get(): unknown;\n set(value: unknown): void;\n /**\n * The lerp its `VariableSpec.lerp` resolved to. A command is free to use a\n * different one when its args ask for it — `variableTo` does.\n */\n readonly lerp: VariableLerp;\n}\n\n/**\n * Builds the {@link Command} a variable-scoped `CommandSpec` stands for.\n *\n * Same contract as {@link CommandFactory} — called once per compile, in timeline\n * order, against a variable already holding what its predecessors left — with a\n * {@link VariableTarget} in place of a node.\n */\nexport type VariableCommandFactory = (\n target: VariableTarget,\n args: Record<string, unknown>,\n duration: number,\n easing?: EasingFunction,\n) => Command<Record<string, unknown>>;\n\n/**\n * How a variable's value interpolates between two states.\n *\n * The same shape every `@property` tween already has, widened to `unknown`\n * because a variable's type is a fact of the document rather than of a class:\n * one holds a number, the next a colour string, the next a whole fill object.\n */\nexport type VariableLerp = (from: unknown, to: unknown, t: number) => unknown;\n\n/**\n * One command that resolves without a node.\n *\n * `scope` says which table `CommandSpec.targetId` is looked up in, and is what\n * lets a variable command reuse the same field a node command uses instead of\n * inventing a second one every host's timeline would then have to special-case.\n */\nexport type CommandTypeEntry =\n | {\n key: string;\n scope: \"node\";\n factory: CommandFactory;\n /**\n * Its leading parameters, as {@link NodeCommandEntry.args} describes a\n * node command's — declared by the paint commands, which read one key\n * each. Absent for `to`/`set`, whose args *are* the props diff.\n */\n args?: readonly CommandArgDescriptor[];\n /**\n * This command **writes props declaratively**, so an expression in its\n * args compiles to a binding rather than being passed through as a\n * string. `set` is the only built-in that does.\n *\n * A flag rather than a name check, because the distinction is real: `to`\n * tweens *towards* a value and a formula is not a value, so binding one\n * as a tween destination would interpolate towards `NaN` and look like a\n * renderer bug. A command opting in is saying its args reach `set()`.\n */\n binds?: boolean;\n }\n | {\n key: string;\n scope: \"variable\";\n factory: VariableCommandFactory;\n };\n\n/**\n * One node type's own command table.\n *\n * Built from the class's `@command()` methods — the **whole** prototype chain,\n * not just its own — because the table is per type. A `Card` extending `Rect`\n * answers to `fadeTo` for the same reason it answers to `.fadeTo()`: it has the\n * method. There is nothing here for two node types to collide over, so\n * inherited entries can simply be copied into each.\n */\nexport interface NodeTypeRecord {\n /** The document key, matching `NodeSpec.type`. */\n key: string;\n /** The class to construct. */\n ctor: NodeConstructor;\n /** Its commands, by the key a document names them with. */\n commands: ReadonlyMap<string, NodeCommandEntry>;\n /**\n * What the type declares about itself — see {@link NodeTypeDescriptor}.\n *\n * Always present, so a host reads one shape whether the type was registered\n * with a bare key, a full descriptor, or a decorated class.\n */\n descriptor: NodeTypeDescriptor;\n}\n\n/** One command on one node type. */\nexport interface NodeCommandEntry {\n /** The method to call. */\n method: string;\n /**\n * Its leading parameters, from `@command({ args })`, always as descriptors.\n *\n * A bare name normalises to `{ key, kind: \"unknown\" }`, so a host reads one\n * shape whether the method bothered to describe its arguments or not.\n */\n args: readonly CommandArgDescriptor[];\n}\n\n/**\n * How a registry compiles and links a node authored as a TS/JSX source\n * string, via {@link Registry.addNodeFromSource}.\n *\n * Entirely host-supplied — `core` has no compiler dependency and cannot\n * import the published `@motionscript/sdk` barrel itself (that package\n * depends on `core`, so the reverse direction would be circular).\n */\nexport interface DynamicNodeConfig {\n /**\n * What `require(\"@motionscript/sdk\")` resolves to inside a compiled\n * script — the host's own already-loaded sdk barrel instance. Must be the\n * same module instance the rest of the app uses, or `instanceof` silently\n * fails against it. The earlier unscoped specifiers, `\"motionscript\"` and\n * the dashed `\"motion-script\"`, resolve to the same object, so a node\n * script authored under either name keeps compiling unmodified.\n */\n sdk: Record<string, unknown>;\n /**\n * What `require(\"@motionscript/sdk/jsx-runtime\")` resolves to (also under\n * the legacy `motionscript/jsx-runtime` and `motion-script/jsx-runtime`\n * specifiers). Omit to reject a script that uses JSX outright.\n */\n jsxRuntime?: Record<string, unknown>;\n /**\n * Further modules a script may `require`, by exact specifier — what a\n * forked component imports beyond the sdk barrel:\n * `@motionscript/sdk/component`, its package's kit. Consulted after the\n * two above, so neither can be shadowed. Each value has to be the host's\n * own loaded instance, for the same `instanceof` reason as `sdk`.\n */\n modules?: Readonly<Record<string, unknown>>;\n /**\n * TS/JSX source → JS text (CommonJS). Host-injected, never bundled —\n * `core` has no compiler dependency of its own.\n */\n compile: (source: string) => Promise<string>;\n}\n\n/** What a registry is seeded with, on top of the builtin vocabulary. */\nexport interface RegistryOptions {\n /**\n * Custom node types — decorated classes, or explicit keys.\n *\n * An array reads each class's `@node()` declaration; a record names the key\n * outright, which is also an assertion that the two agree (a rename on\n * either side throws here rather than surfacing as an unknown type at\n * render).\n */\n nodes?: NodeTypeMap | readonly NodeConstructor[];\n /** Shader packs, by document key. Plain JSON — normalised on the way in. */\n shaders?: ShaderPackMap;\n /** Extra variable interpolations, on top of `number`/`vector2`/`vector3`/`color`/`step`. */\n lerps?: Record<string, VariableLerp>;\n /** Custom eases, referenced from a document as `{ kind: \"custom\", args: key }`. */\n eases?: Record<string, EasingFunction>;\n /** Enables {@link Registry.addNodeFromSource} — see {@link DynamicNodeConfig}. */\n dynamicNodes?: DynamicNodeConfig;\n /**\n * Leave out everything the library itself ships. Only useful to a test\n * asserting on the seeding, or a host building a deliberately tiny\n * vocabulary — a document naming `\"rect\"` will not compile without it.\n */\n builtins?: boolean;\n}\n\n/** See the module docblock. */\nexport class Registry {\n /** Ceiling, so an import cannot evict a workspace's own shaders by volume. */\n static readonly MAX_SHADERS = 512;\n\n constructor(options: RegistryOptions = {}) {\n this._dynamicNodes = options.dynamicNodes;\n if (options.builtins !== false) installBuiltins(this);\n if (Array.isArray(options.nodes)) {\n for (const ctor of options.nodes) this.addNode(ctor);\n } else {\n for (const [key, ctor] of Object.entries(options.nodes ?? {})) this.addNode(key, ctor);\n }\n for (const [key, lerp] of Object.entries(options.lerps ?? {})) this.addLerp(key, lerp);\n for (const [key, ease] of Object.entries(options.eases ?? {})) this.addEase(key, ease);\n for (const [key, pack] of Object.entries(options.shaders ?? {})) this.addShader(key, pack);\n }\n\n // ─── Node types ──────────────────────────────────────────────────────────\n\n /**\n * Register a node class, with its commands and whatever else it declares.\n *\n * Takes a decorated class on its own, or a bare key / full\n * {@link NodeTypeDescriptor} plus the class. The descriptor is the code half\n * of what a component package used to restate in a `manifest.json` —\n * carried, never interpreted, so a host has one place to ask and no second\n * file to disagree with the class.\n *\n * The commands come off the class, so `@command()` is the only place a\n * node's animations are written down. Nothing is constructed to read them:\n * `@command` records onto the prototype, so an object *over* the prototype\n * reaches the whole chain without running a constructor that may expect\n * props, build children, or touch a clock.\n *\n * Re-registering the same class under the same key is a no-op, so a hot\n * reload or a duplicated dependency is harmless. Re-registering a\n * *different* class throws: two classes answering to one key means a\n * document renders differently depending on registration order, which is not\n * a failure anyone would find by looking at the document.\n *\n * Pass `{ replace: true }` to opt out of that throw — the one case it's\n * wrong for is a node whose source has genuinely been edited and\n * recompiled (see {@link addNodeFromSource}), where re-registering under\n * the same key with a new class is the whole point. The default stays a\n * throw; this is deliberately not the common path.\n */\n addNode(ctor: NodeConstructor, options?: { replace?: boolean }): this;\n addNode(type: string | NodeTypeDescriptor, ctor: NodeConstructor, options?: { replace?: boolean }): this;\n addNode(\n type: string | NodeTypeDescriptor | NodeConstructor,\n ctorOrOptions?: NodeConstructor | { replace?: boolean },\n maybeOptions?: { replace?: boolean },\n ): this {\n const isTwoArgForm = typeof ctorOrOptions === \"function\";\n const cls = (isTwoArgForm ? ctorOrOptions : type) as NodeConstructor;\n const options = isTwoArgForm ? maybeOptions : ctorOrOptions as { replace?: boolean } | undefined;\n const declared = isTwoArgForm ? type as string | NodeTypeDescriptor : getNodeDescriptor(cls);\n if (declared === undefined) {\n throw new Error(\n `${cls.name || \"The class\"} carries no @node(...) declaration, so it has no ` +\n `document key. Decorate it, or register it explicitly: addNode(\"myKey\", TheClass).`,\n );\n }\n const descriptor: NodeTypeDescriptor = typeof declared === \"string\" ? { key: declared } : declared;\n const key = descriptor.key;\n\n const existing = this._nodes.get(key);\n if (existing) {\n if (existing.ctor === cls) return this;\n if (!options?.replace) {\n throw new Error(\n `Node type \"${key}\" is already registered to a different class ` +\n `(${existing.ctor.name} vs ${cls.name}). Keys must be unique — a document ` +\n `naming this type would otherwise resolve differently depending on registration order.`,\n );\n }\n }\n\n const commands = new Map<string, NodeCommandEntry>();\n for (const meta of getCommandMeta(Object.create(cls.prototype) as object)) {\n commands.set(meta.key, { method: meta.method, args: this._describeArgs(meta.args) });\n }\n\n this._nodes.set(key, {\n key,\n ctor: cls,\n commands,\n // Derived, never declared: see `NodeTypeDescriptor.properties`.\n descriptor: {\n ...descriptor,\n dimension: this._describeDimension(cls),\n properties: this._describeProperties(cls),\n },\n });\n return this;\n }\n\n /**\n * Compile a TS/JSX source string into a live node class and register it.\n *\n * The script must `export default` a class carrying `@node(...)` — that\n * decorator is what supplies the registry key, exactly as {@link addNode}\n * already reads it off a statically-imported class. There is no separate\n * `key` parameter: one way to name a dynamic node's key, not two that\n * could disagree.\n *\n * Requires `dynamicNodes` to have been passed to the constructor — see\n * {@link DynamicNodeConfig}. `core` never compiles anything itself; this\n * only calls the host-supplied `compile` and links its result.\n */\n async addNodeFromSource(source: string, options?: { replace?: boolean }): Promise<NodeConstructor> {\n if (!this._dynamicNodes) {\n throw new Error(\n \"addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.\",\n );\n }\n const js = await this._dynamicNodes.compile(source);\n const ctor = this._evalNodeModule(js);\n this.addNode(ctor, options);\n return ctor;\n }\n\n /** Everything registered under `key`, or `undefined`. */\n node(key: string): NodeTypeRecord | undefined {\n return this._nodes.get(key);\n }\n\n /** Whether a document naming `key` can be compiled against this registry. */\n hasNode(key: string): boolean {\n return this._nodes.has(key);\n }\n\n /** Every registered node key, for a host offering a palette. Sorted, so the order is stable. */\n nodeKeys(): string[] {\n return [...this._nodes.keys()].sort();\n }\n\n /** What `key` declares about itself, or `undefined` if it is not registered. */\n describe(key: string): NodeTypeDescriptor | undefined {\n return this._nodes.get(key)?.descriptor;\n }\n\n /**\n * Build a node from its spec. Throws on an unknown type.\n *\n * `props` overrides the spec's own, which is how the timeline keeps an\n * expression out of a constructor: an expression-bound prop is left out of\n * what is passed here and written afterwards with `set()`. Constructors read\n * their raw props to decide things like a default size, and a `() => number`\n * is not an answer to that question. The spec's `id` outranks both, so\n * {@link Node.id} is the document's own identity rather than a per-instance\n * UUID — without it a host could never resolve a node it addressed by id.\n *\n * `key` rides along the same way, and only when the row carries one:\n * `applyEditorStates` keys the whole editor-state record on {@link Node.key},\n * so a row whose key never reached the node is a node a host cannot hide or\n * lock — and overwriting one passed in `props` with an absent row-level key\n * would take that away from a caller who had it working.\n */\n instantiate(spec: NodeSpec, props?: Record<string, unknown>): Node {\n const record = this._nodes.get(spec.type);\n if (!record) {\n throw new Error(\n `Unknown node type \"${spec.type}\" (node ${spec.id}). ` +\n `This registry knows: ${this.nodeKeys().join(\", \") || \"nothing\"}.`,\n );\n }\n return new record.ctor({\n ...(props ?? spec.props),\n id: spec.id,\n ...(spec.key !== undefined && { key: spec.key }),\n });\n }\n\n // ─── Commands ────────────────────────────────────────────────────────────\n\n /**\n * Register a command that resolves **without** a node — see\n * {@link CommandTypeEntry}. Same uniqueness rule as {@link addNode}.\n */\n addCommand(\n key: string,\n factory: CommandFactory,\n options?: { binds?: boolean; args?: readonly CommandArg[] },\n ): this {\n if (this._claimed(key, factory)) return this;\n this._commands.set(key, {\n key,\n scope: \"node\",\n factory,\n ...(options?.args ? { args: this._describeArgs(options.args) } : {}),\n binds: options?.binds,\n });\n return this;\n }\n\n /**\n * Register a command that writes a **variable** rather than a node.\n *\n * The seam a host reaches for to add its own — a spring, a wiggle, a\n * sample-and-hold — without touching the timeline. `CommandSpec.targetId`\n * names the variable, and the {@link Command} that comes back must be a pure\n * function of `t` like any other.\n */\n addVariableCommand(key: string, factory: VariableCommandFactory): this {\n if (this._claimed(key, factory)) return this;\n this._commands.set(key, { key, scope: \"variable\", factory });\n return this;\n }\n\n /** The node-less command registered under `key`, or `undefined`. */\n command(key: string): CommandTypeEntry | undefined {\n return this._commands.get(key);\n }\n\n /**\n * A factory for `commandKey` on `nodeTypeKey`, or `undefined` if that type\n * does not publish it.\n *\n * Dispatches by **calling the named method**, never by testing the target\n * against a class: a forked component is a different class carrying the same\n * source, and an `instanceof` against the original is false for it.\n */\n nodeCommand(nodeTypeKey: string, commandKey: string): CommandFactory | undefined {\n const entry = this._nodes.get(nodeTypeKey)?.commands.get(commandKey);\n if (!entry) return undefined;\n return (target, args, duration, easing) => {\n const fn = (target as unknown as Record<string, unknown>)[entry.method];\n if (typeof fn !== \"function\") {\n throw new Error(\n `Command \"${commandKey}\" needs a \"${entry.method}\" method on ` +\n `${target.constructor.name}, which has none.`,\n );\n }\n const data: Record<string, unknown> = {};\n for (const arg of entry.args) data[arg.key] = args[arg.key];\n return (fn as (args: CommandArgs) => Command<Record<string, unknown>>)\n .call(target, { data, duration, easing });\n };\n }\n\n /**\n * Every command key available. With a node type, that type's own table;\n * without one, the node-less commands. Sorted, so the order is stable.\n */\n commandKeys(nodeTypeKey?: string): string[] {\n const keys = nodeTypeKey === undefined\n ? this._commands.keys()\n : this._nodes.get(nodeTypeKey)?.commands.keys() ?? [];\n return [...keys].sort();\n }\n\n // ─── Variable lerps ──────────────────────────────────────────────────────\n\n /**\n * Register an interpolation under a document key.\n *\n * The **code** half of a variable, exactly as a node class is the code half\n * of a node: `{\"lerp\": \"color\"}` in a document is a string, and something\n * has to turn it into the function that blends two colours. Same uniqueness\n * rule as {@link addNode}.\n */\n addLerp(key: string, lerp: VariableLerp): this {\n const existing = this._lerps.get(key);\n if (existing && existing !== lerp) {\n throw new Error(\n `Variable lerp \"${key}\" is already registered to a different function. Keys must be unique.`,\n );\n }\n this._lerps.set(key, lerp);\n return this;\n }\n\n /** The lerp registered under `key`, or `undefined`. */\n lerp(key: string): VariableLerp | undefined {\n return this._lerps.get(key);\n }\n\n /** Every registered lerp key. Sorted, so the order is stable. */\n lerpKeys(): string[] {\n return [...this._lerps.keys()].sort();\n }\n\n /**\n * The lerp a `VariableSpec` resolves to, defaulting from its value.\n *\n * A numeric variable with no declared lerp interpolates; anything else snaps\n * at the end. That is less a fallback than the only honest default —\n * guessing a structural lerp off one sample would blend two objects that\n * merely share an `x` key into something neither of them is.\n */\n requireLerp(key: string | undefined, value: unknown, where: string): VariableLerp {\n const resolved = key ?? (typeof value === \"number\" ? \"number\" : \"step\");\n const lerp = this._lerps.get(resolved);\n if (!lerp) {\n throw new Error(\n `Unknown variable lerp \"${resolved}\" (${where}). ` +\n `Registered: ${this.lerpKeys().join(\", \") || \"none\"}.`,\n );\n }\n return lerp;\n }\n\n // ─── Custom eases ────────────────────────────────────────────────────────\n\n /**\n * Register a custom ease under a document key, referenced as\n * `{ kind: \"custom\", args: key }`. Same uniqueness rule as {@link addNode}.\n */\n addEase(key: string, ease: EasingFunction): this {\n const existing = this._eases.get(key);\n if (existing && existing !== ease) {\n throw new Error(\n `Ease \"${key}\" is already registered to a different function. Keys must be unique.`,\n );\n }\n this._eases.set(key, ease);\n return this;\n }\n\n /** The ease registered under `key`, or `undefined`. */\n ease(key: string): EasingFunction | undefined {\n return this._eases.get(key);\n }\n\n /** Every registered ease key. Sorted, so the order is stable. */\n easeKeys(): string[] {\n return [...this._eases.keys()].sort();\n }\n\n // ─── Shaders ─────────────────────────────────────────────────────────────\n\n /**\n * Register a shader pack under a document key.\n *\n * The key is an argument rather than a field of the pack — the same shape\n * {@link addNode} has — so one file can be registered under whatever name a\n * project wants and stays portable between them. A pack's own `id`, when it\n * has one, is provenance.\n *\n * The pack is normalised on the way in, so what comes back out of\n * {@link shader} is always the current shape whatever the file looked like.\n * Re-registering an equal pack is a no-op — the common case is the *same\n * file* imported twice, which produces two structurally identical objects,\n * and throwing on that would make the uniqueness rule fire on the one case\n * it is meant to tolerate.\n *\n * Pass `{ replace: true }` to overwrite a key with a genuinely different\n * pack — the same opt-in `addNode` takes, for the same reason: a live-edited\n * shader re-registering under its existing key.\n */\n addShader(key: string, pack: unknown, options?: { replace?: boolean }): Shader {\n const normalized = normalizeShaderPack(pack);\n const existing = this._shaders.get(key);\n if (existing) {\n if (\n existing.scope === normalized.scope\n && existing.source === normalized.source\n && existing.name === normalized.name\n ) return existing;\n if (!options?.replace) {\n throw new Error(\n `Shader \"${key}\" is already registered to a different pack ` +\n `(\"${existing.name}\" vs \"${normalized.name}\"). Keys must be unique — a document ` +\n `naming this shader would otherwise resolve differently depending on registration order.`,\n );\n }\n } else if (this._shaders.size >= Registry.MAX_SHADERS) {\n throw new Error(\n `Cannot register shader \"${key}\": the ${Registry.MAX_SHADERS}-shader ceiling is reached.`,\n );\n }\n this._shaders.set(key, normalized);\n return normalized;\n }\n\n /** The pack registered under `key`, or `undefined`. */\n shader(key: string): Shader | undefined {\n return this._shaders.get(key);\n }\n\n /**\n * The pack registered under `key`, if it is a **fill** shader.\n *\n * The typed accessors are what actually deliver the compile error the union\n * promises: {@link shader} hands back `Shader`, and a call site that never\n * narrows could still pass an effect pack to `Fills.shader`.\n */\n fillShader(key: string): FillShader | undefined {\n const pack = this._shaders.get(key);\n return pack?.scope === \"fill\" ? pack : undefined;\n }\n\n /** The pack registered under `key`, if it is an **effect** shader. */\n effectShader(key: string): EffectShader | undefined {\n const pack = this._shaders.get(key);\n return pack?.scope === \"effect\" ? pack : undefined;\n }\n\n /** Every registered shader key, for a host offering a picker. Sorted. */\n shaderKeys(): string[] {\n return [...this._shaders.keys()].sort();\n }\n\n // ─── Internals ───────────────────────────────────────────────────────────\n\n private readonly _nodes = new Map<string, NodeTypeRecord>();\n private readonly _commands = new Map<string, CommandTypeEntry>();\n private readonly _lerps = new Map<string, VariableLerp>();\n private readonly _eases = new Map<string, EasingFunction>();\n private readonly _shaders = new Map<string, Shader>();\n private readonly _dynamicNodes?: DynamicNodeConfig;\n\n /**\n * Evaluates one compiled (CommonJS) dynamic-node module in the current\n * realm and returns its default export.\n *\n * `new Function` in-realm, never a blob module or a worker — see\n * {@link DynamicNodeConfig} and `deny-globals.ts` for why. `require()` is\n * locked to exactly `\"@motionscript/sdk\"`/`\"@motionscript/sdk/jsx-runtime\"`\n * (plus the earlier unscoped `\"motionscript\"` and `\"motion-script\"`\n * spellings, so a script written under either name still compiles) and\n * the host's `modules`, own keys only so `require(\"constructor\")` cannot\n * reach `Object`. No relative\n * imports, since a dynamic node is one script, not a package.\n */\n private _evalNodeModule(js: string): NodeConstructor {\n const { sdk, jsxRuntime, modules } = this._dynamicNodes!;\n const require = (specifier: string): unknown => {\n if (SDK_SPECIFIERS.includes(specifier)) return sdk;\n if (jsxRuntime && SDK_SPECIFIERS.some((name) => specifier === `${name}/jsx-runtime`)) {\n return jsxRuntime;\n }\n if (modules && Object.hasOwn(modules, specifier)) return modules[specifier];\n const available = [\n \"@motionscript/sdk\",\n ...(jsxRuntime ? [\"@motionscript/sdk/jsx-runtime\"] : []),\n ...Object.keys(modules ?? {}),\n ];\n throw new Error(\n `\"${specifier}\" isn't available to a custom node. It can require ` +\n `${available.map((s) => `\"${s}\"`).join(\", \")}; a host supplies more through \\`dynamicNodes.modules\\`.`,\n );\n };\n const mod = { exports: {} as Record<string, unknown> };\n // The script runs one function in from the parameters that deny the\n // globals, so its own top-level `const frames` shadows a denied name\n // instead of redeclaring a parameter. A body that closes that function\n // early is still inside the outer one, which denies the same names.\n const factory = new Function(\n \"exports\", \"require\", \"module\", ...DENIED_GLOBALS,\n `\"use strict\";\\nreturn function () {\\n${js}\\n};`,\n );\n factory(mod.exports, require, mod)();\n\n const ctor = mod.exports.default as NodeConstructor | undefined;\n if (typeof ctor !== \"function\" || getNodeDescriptor(ctor) === undefined) {\n throw new Error(\"This script must `export default` a class decorated with @node(...).\");\n }\n return ctor;\n }\n\n /** One key, one factory — see {@link addNode} for why. */\n private _claimed(key: string, factory: CommandFactory | VariableCommandFactory): boolean {\n const existing = this._commands.get(key);\n if (!existing) return false;\n if (existing.factory === factory) return true;\n throw new Error(\n `Command type \"${key}\" is already registered to a different factory. Keys must be unique.`,\n );\n }\n\n /**\n * A class's editable properties, read off its `@property` declarations.\n *\n * The whole prototype chain, so a `Card` extending `Rect` publishes the box\n * it inherits as well as what it adds — a host editing one edits every\n * control it actually has, without the subclass restating any of them.\n */\n private _describeProperties(ctor: NodeConstructor): Record<string, NodePropertyDescriptor> {\n const out: Record<string, NodePropertyDescriptor> = {};\n for (const meta of getPropertyMeta(Object.create(ctor.prototype) as object)) {\n const editor: PropertyEditor = meta.editor ?? {};\n out[meta.key] = {\n ...editor,\n kind: editor.kind ?? this._inferKind(meta.default),\n ...(meta.default !== undefined ? { default: meta.default } : {}),\n };\n }\n return out;\n }\n\n /**\n * A type's dimension, read off the prototype without constructing one.\n *\n * `Node.dimension` is a getter rather than a field for exactly this reason —\n * it answers from the prototype, before any field initializer has run.\n */\n private _describeDimension(ctor: NodeConstructor): NodeDimension | undefined {\n const dimension = (Object.create(ctor.prototype) as Node).dimension;\n return typeof dimension === \"string\" ? dimension : undefined;\n }\n\n /**\n * The control a value's own type implies. Only ever a fallback: a typed\n * decorator states its kind, and a plain `@property` may too.\n *\n * A function default is a *reactive binding*, not a value, so it says nothing\n * about the control; those declare their kind or take \"unknown\", which a host\n * draws as read-only rather than guessing.\n */\n private _inferKind(value: unknown): string {\n switch (typeof value) {\n case \"number\": return \"number\";\n case \"string\": return \"text\";\n case \"boolean\": return \"boolean\";\n case \"object\":\n if (value === null) return \"unknown\";\n return Array.isArray(value) && value.every(v => typeof v === \"number\")\n ? \"vector\"\n : \"object\";\n default: return \"unknown\";\n }\n }\n\n /** A command's arguments as descriptors, whichever shorthand they were written in. */\n private _describeArgs(args: readonly CommandArg[] | undefined): CommandArgDescriptor[] {\n return (args ?? []).map((arg) =>\n typeof arg === \"string\" ? { key: arg, kind: \"unknown\" } : { kind: \"unknown\", ...arg });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/document/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAuB,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,cAAc,EAA8C,MAAM,2BAA2B,CAAC;AACvG,OAAO,EACH,mBAAmB,GAItB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD;;;;;GAKG;AACH,MAAM,cAAc,GAAsB,CAAC,mBAAmB,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;AA4PjG,+BAA+B;AAC/B,MAAM,OAAO,QAAQ;IACjB,8EAA8E;IAC9E,MAAM,CAAU,WAAW,GAAG,GAAG,CAAC;IAElC,YAAY,UAA2B,EAAE;QACrC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;QAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK;YAAE,eAAe,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,KAAK,CAAC,OAAO,CAAC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,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5B,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;IAC/F,CAAC","sourcesContent":["import type { Node, NodeDimension } from \"@/nodes/node/node\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport { getPropertyMeta, type PropertyEditor } from \"@/attributes/properties/decorator\";\r\nimport { getCommandMeta, type CommandArg, type CommandArgDescriptor } from \"@/tween/command-decorator\";\r\nimport {\r\n normalizeShaderPack,\r\n type EffectShader,\r\n type FillShader,\r\n type Shader,\r\n} from \"@/attributes/shape/shaders/pack\";\r\nimport { installBuiltins } from \"./builtins\";\r\nimport { DENIED_GLOBALS } from \"./deny-globals\";\r\nimport { getNodeDescriptor } from \"./node-decorator\";\r\nimport type { NodePropertyDescriptor, NodeTypeDescriptor } from \"./node-descriptor\";\r\nimport type { NodeSpec } from \"./types\";\r\n\r\n/**\r\n * The specifiers a dynamic node's `require()` resolves to the host's sdk\r\n * barrel. The published\r\n * name comes first; the two after it are the package's earlier unscoped names,\r\n * kept so a script authored under either still compiles.\r\n */\r\nconst SDK_SPECIFIERS: readonly string[] = [\"@motionscript/sdk\", \"motionscript\", \"motion-script\"];\r\n\r\n/**\r\n * The **code** half of the document model, as one object an engine owns.\r\n *\r\n * A document names a node type, a command, a lerp and a shader with a string.\r\n * Something has to turn `\"rect\"` into a class and `\"fillTo\"` into an animation,\r\n * and that something is deliberately a registry rather than a table in the\r\n * database: node types are code — a class with `@property` declarations, a\r\n * `renderSelf`, and `@command()` methods — and code is versioned with the\r\n * library, not with the document.\r\n *\r\n * **It is an instance, not a module.** Every table here used to be a\r\n * module-scope `Map` behind a dozen free functions, which made a registration\r\n * a fact about the *process*: two engines in one process shared one vocabulary,\r\n * a decorated class was registered by the mere act of being imported, whichever\r\n * host loaded first won a contested key, and a test had to remember to call a\r\n * `clearRegistries()` that reached into three modules. A registry is now a value\r\n * with an owner — an `Engine`'s own, reached through `registerNode`/`registerShader`\r\n * rather than a public `registry` field — so what a document can name is a\r\n * property of the engine opening it, and two engines disagree about it freely.\r\n *\r\n * ```ts\r\n * const registry = new Registry({ nodes: [Blob], shaders: { swirl: SWIRL } });\r\n * registry.commandKeys(\"blob\"); // [\"fadeTo\", \"moveTo\", …, \"wobbleTo\"]\r\n * ```\r\n *\r\n * **Commands are per node type, and that is the point.** They used to share one\r\n * flat table with the node types, which made a command key a global claim: the\r\n * first package to register `reveal` owned the word, and a second node type\r\n * wanting it — with different arguments — could not have it. Nothing about a\r\n * command is global, though: it is a method on a class, dispatched against an\r\n * instance the document already names. Only the handful that must resolve\r\n * *without* a node — the variable-scoped ones and the generic prop writers — sit\r\n * in a table of their own.\r\n */\r\n\r\n/** Constructs a node from its authored props. Every built-in node class matches this. */\r\nexport type NodeConstructor = new (props?: Record<string, unknown>) => Node;\r\n\r\n/** Node types a registry makes available, by the key a document names them with. */\r\nexport type NodeTypeMap = Record<string, NodeConstructor>;\r\n\r\n/** Shader packs a registry makes available, by document key. A pack is plain JSON. */\r\nexport type ShaderPackMap = Record<string, unknown>;\r\n\r\n/**\r\n * Builds the {@link Command} a `CommandSpec` stands for.\r\n *\r\n * Called **once per compile**, in timeline order, with `target` already in the\r\n * state the previous command left it — that is what fixes the command's `from`\r\n * value and makes the returned `Command.at(t)` pure thereafter. See\r\n * `tween/command.ts` and `document/timeline.ts`.\r\n *\r\n * @param target The node the command acts on (the scene root for `targetId: null`).\r\n * @param args The spec's `args`, verbatim.\r\n * @param duration Seconds, already defaulted by the caller.\r\n * @param easing Resolved from the spec's `EaseSpec`, or `undefined`.\r\n */\r\nexport type CommandFactory = (\r\n target: Node,\r\n args: Record<string, unknown>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n) => Command<Record<string, unknown>>;\r\n\r\n/**\r\n * The variable a variable command writes.\r\n *\r\n * A handle rather than the cell itself, so a command cannot subscribe to it,\r\n * rebind it, or hold it past the build that made it — the three ways a command\r\n * could stop being a pure function of `t`.\r\n */\r\nexport interface VariableTarget {\r\n /** The id an expression names with `[id]`. */\r\n readonly id: string;\r\n /** What it holds right now. */\r\n get(): unknown;\r\n set(value: unknown): void;\r\n /**\r\n * The lerp its `VariableSpec.lerp` resolved to. A command is free to use a\r\n * different one when its args ask for it — `variableTo` does.\r\n */\r\n readonly lerp: VariableLerp;\r\n}\r\n\r\n/**\r\n * Builds the {@link Command} a variable-scoped `CommandSpec` stands for.\r\n *\r\n * Same contract as {@link CommandFactory} — called once per compile, in timeline\r\n * order, against a variable already holding what its predecessors left — with a\r\n * {@link VariableTarget} in place of a node.\r\n */\r\nexport type VariableCommandFactory = (\r\n target: VariableTarget,\r\n args: Record<string, unknown>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n) => Command<Record<string, unknown>>;\r\n\r\n/**\r\n * How a variable's value interpolates between two states.\r\n *\r\n * The same shape every `@property` tween already has, widened to `unknown`\r\n * because a variable's type is a fact of the document rather than of a class:\r\n * one holds a number, the next a colour string, the next a whole fill object.\r\n */\r\nexport type VariableLerp = (from: unknown, to: unknown, t: number) => unknown;\r\n\r\n/**\r\n * One command that resolves without a node.\r\n *\r\n * `scope` says which table `CommandSpec.targetId` is looked up in, and is what\r\n * lets a variable command reuse the same field a node command uses instead of\r\n * inventing a second one every host's timeline would then have to special-case.\r\n */\r\nexport type CommandTypeEntry =\r\n | {\r\n key: string;\r\n scope: \"node\";\r\n factory: CommandFactory;\r\n /**\r\n * Its leading parameters, as {@link NodeCommandEntry.args} describes a\r\n * node command's — declared by the paint commands, which read one key\r\n * each. Absent for `to`/`set`, whose args *are* the props diff.\r\n */\r\n args?: readonly CommandArgDescriptor[];\r\n /**\r\n * This command **writes props declaratively**, so an expression in its\r\n * args compiles to a binding rather than being passed through as a\r\n * string. `set` is the only built-in that does.\r\n *\r\n * A flag rather than a name check, because the distinction is real: `to`\r\n * tweens *towards* a value and a formula is not a value, so binding one\r\n * as a tween destination would interpolate towards `NaN` and look like a\r\n * renderer bug. A command opting in is saying its args reach `set()`.\r\n */\r\n binds?: boolean;\r\n /**\r\n * The method it runs on its target, where it runs one: the paint\r\n * commands call the node's own `fillTo`, `strokeTo`, …. A node type\r\n * without it, or one that withdrew it, does not take the command\r\n * ({@link Registry.takesCommand}).\r\n */\r\n method?: string;\r\n }\r\n | {\r\n key: string;\r\n scope: \"variable\";\r\n factory: VariableCommandFactory;\r\n };\r\n\r\n/**\r\n * One node type's own command table.\r\n *\r\n * Built from the class's `@command()` methods — the **whole** prototype chain,\r\n * not just its own — because the table is per type. A `Card` extending `Rect`\r\n * answers to `fadeTo` for the same reason it answers to `.fadeTo()`: it has the\r\n * method. There is nothing here for two node types to collide over, so\r\n * inherited entries can simply be copied into each.\r\n */\r\nexport interface NodeTypeRecord {\r\n /** The document key, matching `NodeSpec.type`. */\r\n key: string;\r\n /** The class to construct. */\r\n ctor: NodeConstructor;\r\n /** Its commands, by the key a document names them with. */\r\n commands: ReadonlyMap<string, NodeCommandEntry>;\r\n /** Commands it inherits and withdrew (`withdraw`): never offered, still dispatched for a stored document that names one. */\r\n withdrawn: ReadonlyMap<string, NodeCommandEntry>;\r\n /**\r\n * What the type declares about itself — see {@link NodeTypeDescriptor}.\r\n *\r\n * Always present, so a host reads one shape whether the type was registered\r\n * with a bare key, a full descriptor, or a decorated class.\r\n */\r\n descriptor: NodeTypeDescriptor;\r\n}\r\n\r\n/** One command on one node type. */\r\nexport interface NodeCommandEntry {\r\n /** The method to call. */\r\n method: string;\r\n /**\r\n * Its leading parameters, from `@command({ args })`, always as descriptors.\r\n *\r\n * A bare name normalises to `{ key, kind: \"unknown\" }`, so a host reads one\r\n * shape whether the method bothered to describe its arguments or not.\r\n */\r\n args: readonly CommandArgDescriptor[];\r\n}\r\n\r\n/**\r\n * How a registry compiles and links a node authored as a TS source string\r\n * that default-exports a component, via {@link Registry.addNodeFromSource}.\r\n *\r\n * Entirely host-supplied — `core` has no compiler dependency and cannot\r\n * import the published `@motionscript/sdk` barrel itself (that package\r\n * depends on `core`, so the reverse direction would be circular).\r\n */\r\nexport interface DynamicNodeConfig {\r\n /**\r\n * What `require(\"@motionscript/sdk\")` resolves to inside a compiled\r\n * script — the host's own already-loaded sdk barrel instance. Must be the\r\n * same module instance the rest of the app uses, or `instanceof` silently\r\n * fails against it. The earlier unscoped specifiers, `\"motionscript\"` and\r\n * the dashed `\"motion-script\"`, resolve to the same object, so a node\r\n * script authored under either name keeps compiling unmodified.\r\n */\r\n sdk: Record<string, unknown>;\r\n /**\r\n * Further modules a script may `require`, by exact specifier — what a\r\n * forked component imports beyond the sdk barrel:\r\n * `@motionscript/sdk/component`, its package's kit. Consulted after the\r\n * two above, so neither can be shadowed. Each value has to be the host's\r\n * own loaded instance, for the same `instanceof` reason as `sdk`.\r\n */\r\n modules?: Readonly<Record<string, unknown>>;\r\n /**\r\n * TS source → JS text (CommonJS). Host-injected, never bundled —\r\n * `core` has no compiler dependency of its own.\r\n */\r\n compile: (source: string) => Promise<string>;\r\n}\r\n\r\n/** What a registry is seeded with, on top of the builtin vocabulary. */\r\nexport interface RegistryOptions {\r\n /**\r\n * Custom node types — decorated classes, or explicit keys.\r\n *\r\n * An array reads each class's `@node()` declaration; a record names the key\r\n * outright, which is also an assertion that the two agree (a rename on\r\n * either side throws here rather than surfacing as an unknown type at\r\n * render).\r\n */\r\n nodes?: NodeTypeMap | readonly NodeConstructor[];\r\n /** Shader packs, by document key. Plain JSON — normalised on the way in. */\r\n shaders?: ShaderPackMap;\r\n /** Extra variable interpolations, on top of `number`/`vector2`/`vector3`/`color`/`step`. */\r\n lerps?: Record<string, VariableLerp>;\r\n /** Custom eases, referenced from a document as `{ kind: \"custom\", args: key }`. */\r\n eases?: Record<string, EasingFunction>;\r\n /** Enables {@link Registry.addNodeFromSource} — see {@link DynamicNodeConfig}. */\r\n dynamicNodes?: DynamicNodeConfig;\r\n /**\r\n * Leave out everything the library itself ships. Only useful to a test\r\n * asserting on the seeding, or a host building a deliberately tiny\r\n * vocabulary — a document naming `\"rect\"` will not compile without it.\r\n */\r\n builtins?: boolean;\r\n}\r\n\r\n/** See the module docblock. */\r\nexport class Registry {\r\n /** Ceiling, so an import cannot evict a workspace's own shaders by volume. */\r\n static readonly MAX_SHADERS = 512;\r\n\r\n constructor(options: RegistryOptions = {}) {\r\n this._dynamicNodes = options.dynamicNodes;\r\n if (options.builtins !== false) installBuiltins(this);\r\n if (Array.isArray(options.nodes)) {\r\n for (const ctor of options.nodes) this.addNode(ctor);\r\n } else {\r\n for (const [key, ctor] of Object.entries(options.nodes ?? {})) this.addNode(key, ctor);\r\n }\r\n for (const [key, lerp] of Object.entries(options.lerps ?? {})) this.addLerp(key, lerp);\r\n for (const [key, ease] of Object.entries(options.eases ?? {})) this.addEase(key, ease);\r\n for (const [key, pack] of Object.entries(options.shaders ?? {})) this.addShader(key, pack);\r\n }\r\n\r\n // ─── Node types ──────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a node class, with its commands and whatever else it declares.\r\n *\r\n * Takes a decorated class on its own, or a bare key / full\r\n * {@link NodeTypeDescriptor} plus the class. The descriptor is the code half\r\n * of what a component package used to restate in a `manifest.json` —\r\n * carried, never interpreted, so a host has one place to ask and no second\r\n * file to disagree with the class.\r\n *\r\n * The commands come off the class, so `@command()` is the only place a\r\n * node's animations are written down. Nothing is constructed to read them:\r\n * `@command` records onto the prototype, so an object *over* the prototype\r\n * reaches the whole chain without running a constructor that may expect\r\n * props, build children, or touch a clock.\r\n *\r\n * Re-registering the same class under the same key is a no-op, so a hot\r\n * reload or a duplicated dependency is harmless. Re-registering a\r\n * *different* class throws: two classes answering to one key means a\r\n * document renders differently depending on registration order, which is not\r\n * a failure anyone would find by looking at the document.\r\n *\r\n * Pass `{ replace: true }` to opt out of that throw — the one case it's\r\n * wrong for is a node whose source has genuinely been edited and\r\n * recompiled (see {@link addNodeFromSource}), where re-registering under\r\n * the same key with a new class is the whole point. The default stays a\r\n * throw; this is deliberately not the common path.\r\n */\r\n addNode(ctor: NodeConstructor, options?: { replace?: boolean }): this;\r\n addNode(type: string | NodeTypeDescriptor, ctor: NodeConstructor, options?: { replace?: boolean }): this;\r\n addNode(\r\n type: string | NodeTypeDescriptor | NodeConstructor,\r\n ctorOrOptions?: NodeConstructor | { replace?: boolean },\r\n maybeOptions?: { replace?: boolean },\r\n ): this {\r\n const isTwoArgForm = typeof ctorOrOptions === \"function\";\r\n // A component (`component2d(...)`) registers as the node class it generated.\r\n const given = (isTwoArgForm ? ctorOrOptions : type) as NodeConstructor & { node?: NodeConstructor };\r\n const cls = typeof given.node === \"function\" ? given.node : given;\r\n const options = isTwoArgForm ? maybeOptions : ctorOrOptions as { replace?: boolean } | undefined;\r\n const declared = isTwoArgForm ? type as string | NodeTypeDescriptor : getNodeDescriptor(cls);\r\n if (declared === undefined) {\r\n throw new Error(\r\n `${cls.name || \"The class\"} is no component, so it has no document key. ` +\r\n `Make it with component2d({ key }), or register it explicitly: addNode(\"myKey\", TheClass).`,\r\n );\r\n }\r\n const descriptor: NodeTypeDescriptor = typeof declared === \"string\" ? { key: declared } : declared;\r\n const key = descriptor.key;\r\n\r\n const existing = this._nodes.get(key);\r\n if (existing) {\r\n if (existing.ctor === cls) return this;\r\n if (!options?.replace) {\r\n throw new Error(\r\n `Node type \"${key}\" is already registered to a different class ` +\r\n `(${existing.ctor.name} vs ${cls.name}). Keys must be unique — a document ` +\r\n `naming this type would otherwise resolve differently depending on registration order.`,\r\n );\r\n }\r\n }\r\n\r\n const commands = new Map<string, NodeCommandEntry>();\r\n const withdrawn = new Map<string, NodeCommandEntry>();\r\n for (const meta of getCommandMeta(Object.create(cls.prototype) as object)) {\r\n (meta.withdrawn ? withdrawn : commands).set(meta.key, { method: meta.method, args: this._describeArgs(meta.args) });\r\n }\r\n\r\n this._nodes.set(key, {\r\n key,\r\n ctor: cls,\r\n commands,\r\n withdrawn,\r\n // Derived, never declared: see `NodeTypeDescriptor.properties`.\r\n descriptor: {\r\n ...descriptor,\r\n dimension: this._describeDimension(cls),\r\n holds: this._describeHolds(cls),\r\n properties: this._describeProperties(cls),\r\n },\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Compile a TS/JSX source string into a live node class and register it.\r\n *\r\n * The script must `export default` a class carrying `@node(...)` — that\r\n * decorator is what supplies the registry key, exactly as {@link addNode}\r\n * already reads it off a statically-imported class. There is no separate\r\n * `key` parameter: one way to name a dynamic node's key, not two that\r\n * could disagree.\r\n *\r\n * Requires `dynamicNodes` to have been passed to the constructor — see\r\n * {@link DynamicNodeConfig}. `core` never compiles anything itself; this\r\n * only calls the host-supplied `compile` and links its result.\r\n */\r\n async addNodeFromSource(source: string, options?: { replace?: boolean }): Promise<NodeConstructor> {\r\n if (!this._dynamicNodes) {\r\n throw new Error(\r\n \"addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.\",\r\n );\r\n }\r\n const js = await this._dynamicNodes.compile(source);\r\n const ctor = this._evalNodeModule(js);\r\n this.addNode(ctor, options);\r\n return ctor;\r\n }\r\n\r\n /** Everything registered under `key`, or `undefined`. */\r\n node(key: string): NodeTypeRecord | undefined {\r\n return this._nodes.get(key);\r\n }\r\n\r\n /** Whether a document naming `key` can be compiled against this registry. */\r\n hasNode(key: string): boolean {\r\n return this._nodes.has(key);\r\n }\r\n\r\n /** Every registered node key, for a host offering a palette. Sorted, so the order is stable. */\r\n nodeKeys(): string[] {\r\n return [...this._nodes.keys()].sort();\r\n }\r\n\r\n /** What `key` declares about itself, or `undefined` if it is not registered. */\r\n describe(key: string): NodeTypeDescriptor | undefined {\r\n return this._nodes.get(key)?.descriptor;\r\n }\r\n\r\n /**\r\n * Build a node from its spec. Throws on an unknown type.\r\n *\r\n * `props` overrides the spec's own, which is how the timeline keeps an\r\n * expression out of a constructor: an expression-bound prop is left out of\r\n * what is passed here and written afterwards with `set()`. Constructors read\r\n * their raw props to decide things like a default size, and a `() => number`\r\n * is not an answer to that question. The spec's `id` outranks both, so\r\n * {@link Node.id} is the document's own identity rather than a per-instance\r\n * UUID — without it a host could never resolve a node it addressed by id.\r\n *\r\n * `key` rides along the same way, and only when the row carries one:\r\n * `applyEditorStates` keys the whole editor-state record on {@link Node.key},\r\n * so a row whose key never reached the node is a node a host cannot hide or\r\n * lock — and overwriting one passed in `props` with an absent row-level key\r\n * would take that away from a caller who had it working.\r\n */\r\n instantiate(spec: NodeSpec, props?: Record<string, unknown>): Node {\r\n const record = this._nodes.get(spec.type);\r\n if (!record) {\r\n throw new Error(\r\n `Unknown node type \"${spec.type}\" (node ${spec.id}). ` +\r\n `This registry knows: ${this.nodeKeys().join(\", \") || \"nothing\"}.`,\r\n );\r\n }\r\n return new record.ctor({\r\n ...(props ?? spec.props),\r\n id: spec.id,\r\n ...(spec.key !== undefined && { key: spec.key }),\r\n });\r\n }\r\n\r\n // ─── Commands ────────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a command that resolves **without** a node — see\r\n * {@link CommandTypeEntry}. Same uniqueness rule as {@link addNode}.\r\n */\r\n addCommand(\r\n key: string,\r\n factory: CommandFactory,\r\n options?: { binds?: boolean; args?: readonly CommandArg[]; method?: string },\r\n ): this {\r\n if (this._claimed(key, factory)) return this;\r\n this._commands.set(key, {\r\n key,\r\n scope: \"node\",\r\n factory,\r\n ...(options?.args ? { args: this._describeArgs(options.args) } : {}),\r\n binds: options?.binds,\r\n ...(options?.method ? { method: options.method } : {}),\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a command that writes a **variable** rather than a node.\r\n *\r\n * The seam a host reaches for to add its own — a spring, a wiggle, a\r\n * sample-and-hold — without touching the timeline. `CommandSpec.targetId`\r\n * names the variable, and the {@link Command} that comes back must be a pure\r\n * function of `t` like any other.\r\n */\r\n addVariableCommand(key: string, factory: VariableCommandFactory): this {\r\n if (this._claimed(key, factory)) return this;\r\n this._commands.set(key, { key, scope: \"variable\", factory });\r\n return this;\r\n }\r\n\r\n /** The node-less command registered under `key`, or `undefined`. */\r\n command(key: string): CommandTypeEntry | undefined {\r\n return this._commands.get(key);\r\n }\r\n\r\n /**\r\n * A factory for `commandKey` on `nodeTypeKey`, or `undefined` if that type\r\n * does not publish it.\r\n *\r\n * Dispatches by **calling the named method**, never by testing the target\r\n * against a class: a forked component is a different class carrying the same\r\n * source, and an `instanceof` against the original is false for it.\r\n */\r\n nodeCommand(nodeTypeKey: string, commandKey: string): CommandFactory | undefined {\r\n const record = this._nodes.get(nodeTypeKey);\r\n const entry = record?.commands.get(commandKey) ?? record?.withdrawn.get(commandKey);\r\n if (!entry) return undefined;\r\n return (target, args, duration, easing) => {\r\n const fn = (target as unknown as Record<string, unknown>)[entry.method];\r\n if (typeof fn !== \"function\") {\r\n throw new Error(\r\n `Command \"${commandKey}\" needs a \"${entry.method}\" method on ` +\r\n `${target.constructor.name}, which has none.`,\r\n );\r\n }\r\n const data: Record<string, unknown> = {};\r\n for (const arg of entry.args) data[arg.key] = args[arg.key];\r\n return (fn as (args: CommandArgs) => Command<Record<string, unknown>>)\r\n .call(target, { data, duration, easing });\r\n };\r\n }\r\n\r\n /**\r\n * Whether a node of `nodeTypeKey` takes `commandKey`: one its own table\r\n * publishes, or a node-less one that acts on a node (`to`, `fillTo`) unless\r\n * the method it runs is one the type lacks or withdrew. What a host offers a\r\n * node is its table and the node-less commands it takes.\r\n */\r\n takesCommand(nodeTypeKey: string, commandKey: string): boolean {\r\n const record = this._nodes.get(nodeTypeKey);\r\n if (!record) return false;\r\n if (record.commands.has(commandKey)) return true;\r\n const global = this._commands.get(commandKey);\r\n if (global?.scope !== \"node\") return false;\r\n if (global.method === undefined) return true;\r\n if (record.withdrawn.has(global.method)) return false;\r\n return typeof (record.ctor.prototype as Record<string, unknown>)[global.method] === \"function\";\r\n }\r\n\r\n /**\r\n * Every command key available. With a node type, that type's own table;\r\n * without one, the node-less commands. Sorted, so the order is stable.\r\n */\r\n commandKeys(nodeTypeKey?: string): string[] {\r\n const keys = nodeTypeKey === undefined\r\n ? this._commands.keys()\r\n : this._nodes.get(nodeTypeKey)?.commands.keys() ?? [];\r\n return [...keys].sort();\r\n }\r\n\r\n // ─── Variable lerps ──────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register an interpolation under a document key.\r\n *\r\n * The **code** half of a variable, exactly as a node class is the code half\r\n * of a node: `{\"lerp\": \"color\"}` in a document is a string, and something\r\n * has to turn it into the function that blends two colours. Same uniqueness\r\n * rule as {@link addNode}.\r\n */\r\n addLerp(key: string, lerp: VariableLerp): this {\r\n const existing = this._lerps.get(key);\r\n if (existing && existing !== lerp) {\r\n throw new Error(\r\n `Variable lerp \"${key}\" is already registered to a different function. Keys must be unique.`,\r\n );\r\n }\r\n this._lerps.set(key, lerp);\r\n return this;\r\n }\r\n\r\n /** The lerp registered under `key`, or `undefined`. */\r\n lerp(key: string): VariableLerp | undefined {\r\n return this._lerps.get(key);\r\n }\r\n\r\n /** Every registered lerp key. Sorted, so the order is stable. */\r\n lerpKeys(): string[] {\r\n return [...this._lerps.keys()].sort();\r\n }\r\n\r\n /**\r\n * The lerp a `VariableSpec` resolves to, defaulting from its value.\r\n *\r\n * A numeric variable with no declared lerp interpolates; anything else snaps\r\n * at the end. That is less a fallback than the only honest default —\r\n * guessing a structural lerp off one sample would blend two objects that\r\n * merely share an `x` key into something neither of them is.\r\n */\r\n requireLerp(key: string | undefined, value: unknown, where: string): VariableLerp {\r\n const resolved = key ?? (typeof value === \"number\" ? \"number\" : \"step\");\r\n const lerp = this._lerps.get(resolved);\r\n if (!lerp) {\r\n throw new Error(\r\n `Unknown variable lerp \"${resolved}\" (${where}). ` +\r\n `Registered: ${this.lerpKeys().join(\", \") || \"none\"}.`,\r\n );\r\n }\r\n return lerp;\r\n }\r\n\r\n // ─── Custom eases ────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a custom ease under a document key, referenced as\r\n * `{ kind: \"custom\", args: key }`. Same uniqueness rule as {@link addNode}.\r\n */\r\n addEase(key: string, ease: EasingFunction): this {\r\n const existing = this._eases.get(key);\r\n if (existing && existing !== ease) {\r\n throw new Error(\r\n `Ease \"${key}\" is already registered to a different function. Keys must be unique.`,\r\n );\r\n }\r\n this._eases.set(key, ease);\r\n return this;\r\n }\r\n\r\n /** The ease registered under `key`, or `undefined`. */\r\n ease(key: string): EasingFunction | undefined {\r\n return this._eases.get(key);\r\n }\r\n\r\n /** Every registered ease key. Sorted, so the order is stable. */\r\n easeKeys(): string[] {\r\n return [...this._eases.keys()].sort();\r\n }\r\n\r\n // ─── Shaders ─────────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Register a shader pack under a document key.\r\n *\r\n * The key is an argument rather than a field of the pack — the same shape\r\n * {@link addNode} has — so one file can be registered under whatever name a\r\n * project wants and stays portable between them. A pack's own `id`, when it\r\n * has one, is provenance.\r\n *\r\n * The pack is normalised on the way in, so what comes back out of\r\n * {@link shader} is always the current shape whatever the file looked like.\r\n * Re-registering an equal pack is a no-op — the common case is the *same\r\n * file* imported twice, which produces two structurally identical objects,\r\n * and throwing on that would make the uniqueness rule fire on the one case\r\n * it is meant to tolerate.\r\n *\r\n * Pass `{ replace: true }` to overwrite a key with a genuinely different\r\n * pack — the same opt-in `addNode` takes, for the same reason: a live-edited\r\n * shader re-registering under its existing key.\r\n */\r\n addShader(key: string, pack: unknown, options?: { replace?: boolean }): Shader {\r\n const normalized = normalizeShaderPack(pack);\r\n const existing = this._shaders.get(key);\r\n if (existing) {\r\n if (\r\n existing.scope === normalized.scope\r\n && existing.source === normalized.source\r\n && existing.name === normalized.name\r\n ) return existing;\r\n if (!options?.replace) {\r\n throw new Error(\r\n `Shader \"${key}\" is already registered to a different pack ` +\r\n `(\"${existing.name}\" vs \"${normalized.name}\"). Keys must be unique — a document ` +\r\n `naming this shader would otherwise resolve differently depending on registration order.`,\r\n );\r\n }\r\n } else if (this._shaders.size >= Registry.MAX_SHADERS) {\r\n throw new Error(\r\n `Cannot register shader \"${key}\": the ${Registry.MAX_SHADERS}-shader ceiling is reached.`,\r\n );\r\n }\r\n this._shaders.set(key, normalized);\r\n return normalized;\r\n }\r\n\r\n /** The pack registered under `key`, or `undefined`. */\r\n shader(key: string): Shader | undefined {\r\n return this._shaders.get(key);\r\n }\r\n\r\n /**\r\n * The pack registered under `key`, if it is a **fill** shader.\r\n *\r\n * The typed accessors are what actually deliver the compile error the union\r\n * promises: {@link shader} hands back `Shader`, and a call site that never\r\n * narrows could still pass an effect pack to `Fills.shader`.\r\n */\r\n fillShader(key: string): FillShader | undefined {\r\n const pack = this._shaders.get(key);\r\n return pack?.scope === \"fill\" ? pack : undefined;\r\n }\r\n\r\n /** The pack registered under `key`, if it is an **effect** shader. */\r\n effectShader(key: string): EffectShader | undefined {\r\n const pack = this._shaders.get(key);\r\n return pack?.scope === \"effect\" ? pack : undefined;\r\n }\r\n\r\n /** Every registered shader key, for a host offering a picker. Sorted. */\r\n shaderKeys(): string[] {\r\n return [...this._shaders.keys()].sort();\r\n }\r\n\r\n // ─── Internals ───────────────────────────────────────────────────────────\r\n\r\n private readonly _nodes = new Map<string, NodeTypeRecord>();\r\n private readonly _commands = new Map<string, CommandTypeEntry>();\r\n private readonly _lerps = new Map<string, VariableLerp>();\r\n private readonly _eases = new Map<string, EasingFunction>();\r\n private readonly _shaders = new Map<string, Shader>();\r\n private readonly _dynamicNodes?: DynamicNodeConfig;\r\n\r\n /**\r\n * Evaluates one compiled (CommonJS) dynamic-node module in the current\r\n * realm and returns its default export.\r\n *\r\n * `new Function` in-realm, never a blob module or a worker — see\r\n * {@link DynamicNodeConfig} and `deny-globals.ts` for why. `require()` is\r\n * locked to exactly `\"@motionscript/sdk\"` (plus the earlier unscoped `\"motionscript\"` and `\"motion-script\"`\r\n * spellings, so a script written under either name still compiles) and\r\n * the host's `modules`, own keys only so `require(\"constructor\")` cannot\r\n * reach `Object`. No relative\r\n * imports, since a dynamic node is one script, not a package.\r\n */\r\n private _evalNodeModule(js: string): NodeConstructor {\r\n const { sdk, modules } = this._dynamicNodes!;\r\n const require = (specifier: string): unknown => {\r\n if (SDK_SPECIFIERS.includes(specifier)) return sdk;\r\n if (modules && Object.hasOwn(modules, specifier)) return modules[specifier];\r\n const available = [\"@motionscript/sdk\", ...Object.keys(modules ?? {})];\r\n throw new Error(\r\n `\"${specifier}\" isn't available to a custom node. It can require ` +\r\n `${available.map((s) => `\"${s}\"`).join(\", \")}; a host supplies more through \\`dynamicNodes.modules\\`.`,\r\n );\r\n };\r\n const mod = { exports: {} as Record<string, unknown> };\r\n // The script runs one function in from the parameters that deny the\r\n // globals, so its own top-level `const frames` shadows a denied name\r\n // instead of redeclaring a parameter. A body that closes that function\r\n // early is still inside the outer one, which denies the same names.\r\n const factory = new Function(\r\n \"exports\", \"require\", \"module\", ...DENIED_GLOBALS,\r\n `\"use strict\";\\nreturn function () {\\n${js}\\n};`,\r\n );\r\n factory(mod.exports, require, mod)();\r\n\r\n const ctor = mod.exports.default as (NodeConstructor & { node?: NodeConstructor }) | undefined;\r\n if (typeof ctor !== \"function\" || getNodeDescriptor(typeof ctor.node === \"function\" ? ctor.node : ctor) === undefined) {\r\n throw new Error(\"This script must `export default` a component: `component2d({ key: \\\"…\\\", … })`.\");\r\n }\r\n return ctor;\r\n }\r\n\r\n /** One key, one factory — see {@link addNode} for why. */\r\n private _claimed(key: string, factory: CommandFactory | VariableCommandFactory): boolean {\r\n const existing = this._commands.get(key);\r\n if (!existing) return false;\r\n if (existing.factory === factory) return true;\r\n throw new Error(\r\n `Command type \"${key}\" is already registered to a different factory. Keys must be unique.`,\r\n );\r\n }\r\n\r\n /**\r\n * A class's editable properties, read off its `@property` declarations.\r\n *\r\n * The whole prototype chain, so a `Card` extending `Rect` publishes the box\r\n * it inherits as well as what it adds — a host editing one edits every\r\n * control it actually has, without the subclass restating any of them.\r\n */\r\n private _describeProperties(ctor: NodeConstructor): Record<string, NodePropertyDescriptor> {\r\n const out: Record<string, NodePropertyDescriptor> = {};\r\n for (const meta of getPropertyMeta(Object.create(ctor.prototype) as object)) {\r\n if (meta.withdrawn) continue;\r\n const editor: PropertyEditor = meta.editor ?? {};\r\n out[meta.key] = {\r\n ...editor,\r\n kind: editor.kind ?? this._inferKind(meta.default),\r\n ...(meta.default !== undefined ? { default: meta.default } : {}),\r\n };\r\n }\r\n return out;\r\n }\r\n\r\n /**\r\n * A type's dimension, read off the prototype without constructing one.\r\n *\r\n * `Node.dimension` is a getter rather than a field for exactly this reason —\r\n * it answers from the prototype, before any field initializer has run.\r\n */\r\n private _describeDimension(ctor: NodeConstructor): NodeDimension | undefined {\r\n const dimension = (Object.create(ctor.prototype) as Node).dimension;\r\n return typeof dimension === \"string\" ? dimension : undefined;\r\n }\r\n\r\n /** The trees a type takes children from, off the prototype as its dimension is. */\r\n private _describeHolds(ctor: NodeConstructor): readonly NodeDimension[] | undefined {\r\n const trees = (Object.create(ctor.prototype) as Partial<Node>)._childTrees;\r\n return Array.isArray(trees) ? [...trees] : undefined;\r\n }\r\n\r\n /**\r\n * The control a value's own type implies. Only ever a fallback: a typed\r\n * decorator states its kind, and a plain `@property` may too.\r\n *\r\n * A function default is a *reactive binding*, not a value, so it says nothing\r\n * about the control; those declare their kind or take \"unknown\", which a host\r\n * draws as read-only rather than guessing.\r\n */\r\n private _inferKind(value: unknown): string {\r\n switch (typeof value) {\r\n case \"number\": return \"number\";\r\n case \"string\": return \"text\";\r\n case \"boolean\": return \"boolean\";\r\n case \"object\":\r\n if (value === null) return \"unknown\";\r\n return Array.isArray(value) && value.every(v => typeof v === \"number\")\r\n ? \"vector\"\r\n : \"object\";\r\n default: return \"unknown\";\r\n }\r\n }\r\n\r\n /** A command's arguments as descriptors, whichever shorthand they were written in. */\r\n private _describeArgs(args: readonly CommandArg[] | undefined): CommandArgDescriptor[] {\r\n return (args ?? []).map((arg) =>\r\n typeof arg === \"string\" ? { key: arg, kind: \"unknown\" } : { kind: \"unknown\", ...arg });\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { PropSlot } from "../props/slot.js";
|
|
2
|
+
import { type Command } from "../tween/command.js";
|
|
3
|
+
/** What the index reads of a placed command. */
|
|
4
|
+
export interface SettlePlaced {
|
|
5
|
+
readonly start: number;
|
|
6
|
+
readonly duration: number;
|
|
7
|
+
readonly command: Command<Record<string, unknown>>;
|
|
8
|
+
readonly writes: ReadonlySet<PropSlot<unknown>>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Evaluation that holds finished commands instead of running them.
|
|
12
|
+
*
|
|
13
|
+
* A timeline evaluates `t` by restoring baselines and running every command
|
|
14
|
+
* started by `t` in placement order, so the later one wins a slot both write.
|
|
15
|
+
* That costs every command placed so far, finished or not. A command marked
|
|
16
|
+
* {@link settling} leaves fixed end values, so once finished it is a stored
|
|
17
|
+
* write per slot: for each slot, only the latest-placed finished writer counts.
|
|
18
|
+
* A frame then costs a lookup per written slot plus the commands still running,
|
|
19
|
+
* and the length of the timeline drops out.
|
|
20
|
+
*
|
|
21
|
+
* Unmarked commands, and marked ones still running, are run as before, in
|
|
22
|
+
* placement order. After each, a slot it writes whose held writer was placed
|
|
23
|
+
* later gets that writer's value back: placement order still decides. This
|
|
24
|
+
* relies on what the timeline's restore already does, that a command writes
|
|
25
|
+
* nothing while running that it did not write while being built.
|
|
26
|
+
*/
|
|
27
|
+
export declare class SettledIndex {
|
|
28
|
+
private readonly _finish;
|
|
29
|
+
private readonly _tracks;
|
|
30
|
+
private readonly _replayed;
|
|
31
|
+
/** `null` when nothing is marked: the timeline runs everything, as before. */
|
|
32
|
+
static build(placed: readonly SettlePlaced[]): SettledIndex | null;
|
|
33
|
+
/** Whether the command at `index` is held once finished, rather than run on every evaluation. */
|
|
34
|
+
holds(index: number): boolean;
|
|
35
|
+
/** Bring what the placed commands write to `seconds`. Baselines must be restored first. */
|
|
36
|
+
evaluate(placed: readonly SettlePlaced[], seconds: number): void;
|
|
37
|
+
private constructor();
|
|
38
|
+
private readonly _held;
|
|
39
|
+
private readonly _from;
|
|
40
|
+
private readonly _width;
|
|
41
|
+
private readonly _bins;
|
|
42
|
+
private readonly _binStart;
|
|
43
|
+
private readonly _binItems;
|
|
44
|
+
private readonly _long;
|
|
45
|
+
private readonly _fixStart;
|
|
46
|
+
private readonly _fixTracks;
|
|
47
|
+
private _binOf;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=settled-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settled-index.d.ts","sourceRoot":"","sources":["../../src/document/settled-index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAExD,gDAAgD;AAChD,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,YAAY;IAqFjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAtF9B,8EAA8E;IAC9E,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,GAAG,IAAI;IA6BlE,iGAAiG;IACjG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI7B,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA8ChE,OAAO;IAgDP,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC,OAAO,CAAC,MAAM;CAIjB"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { clamp01 } from "../util/clamp.js";
|
|
2
|
+
import { observeSlots } from "../props/observer.js";
|
|
3
|
+
import { settles } from "../tween/command.js";
|
|
4
|
+
/**
|
|
5
|
+
* Evaluation that holds finished commands instead of running them.
|
|
6
|
+
*
|
|
7
|
+
* A timeline evaluates `t` by restoring baselines and running every command
|
|
8
|
+
* started by `t` in placement order, so the later one wins a slot both write.
|
|
9
|
+
* That costs every command placed so far, finished or not. A command marked
|
|
10
|
+
* {@link settling} leaves fixed end values, so once finished it is a stored
|
|
11
|
+
* write per slot: for each slot, only the latest-placed finished writer counts.
|
|
12
|
+
* A frame then costs a lookup per written slot plus the commands still running,
|
|
13
|
+
* and the length of the timeline drops out.
|
|
14
|
+
*
|
|
15
|
+
* Unmarked commands, and marked ones still running, are run as before, in
|
|
16
|
+
* placement order. After each, a slot it writes whose held writer was placed
|
|
17
|
+
* later gets that writer's value back: placement order still decides. This
|
|
18
|
+
* relies on what the timeline's restore already does, that a command writes
|
|
19
|
+
* nothing while running that it did not write while being built.
|
|
20
|
+
*/
|
|
21
|
+
export class SettledIndex {
|
|
22
|
+
_finish;
|
|
23
|
+
_tracks;
|
|
24
|
+
_replayed;
|
|
25
|
+
/** `null` when nothing is marked: the timeline runs everything, as before. */
|
|
26
|
+
static build(placed) {
|
|
27
|
+
const finish = new Float64Array(placed.length).fill(NaN);
|
|
28
|
+
const writers = new Map();
|
|
29
|
+
const replayed = [];
|
|
30
|
+
const running = [];
|
|
31
|
+
for (let i = 0; i < placed.length; i++) {
|
|
32
|
+
const p = placed[i];
|
|
33
|
+
const end = settles(p.command) ? finishTime(p.start, p.duration) : NaN;
|
|
34
|
+
if (Number.isNaN(end)) {
|
|
35
|
+
replayed.push(i);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
finish[i] = end;
|
|
39
|
+
if (end > p.start)
|
|
40
|
+
running.push(i);
|
|
41
|
+
// Only what `at(1)` writes is an end value; a slot written only while
|
|
42
|
+
// building is not held.
|
|
43
|
+
const written = new Set();
|
|
44
|
+
observeSlots({ read: () => { }, write: (slot) => written.add(slot) }, () => p.command.at(1));
|
|
45
|
+
for (const slot of written) {
|
|
46
|
+
const list = writers.get(slot);
|
|
47
|
+
const writer = { order: i, finish: end, end: slot.snapshot() };
|
|
48
|
+
if (list)
|
|
49
|
+
list.push(writer);
|
|
50
|
+
else
|
|
51
|
+
writers.set(slot, [writer]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (replayed.length === placed.length)
|
|
55
|
+
return null;
|
|
56
|
+
return new SettledIndex(placed, finish, [...writers].map(([slot, list]) => new Track(slot, list)), replayed, running);
|
|
57
|
+
}
|
|
58
|
+
/** Whether the command at `index` is held once finished, rather than run on every evaluation. */
|
|
59
|
+
holds(index) {
|
|
60
|
+
return !Number.isNaN(this._finish[index]);
|
|
61
|
+
}
|
|
62
|
+
/** Bring what the placed commands write to `seconds`. Baselines must be restored first. */
|
|
63
|
+
evaluate(placed, seconds) {
|
|
64
|
+
const tracks = this._tracks;
|
|
65
|
+
const held = this._held;
|
|
66
|
+
for (let k = 0; k < tracks.length; k++) {
|
|
67
|
+
const w = (held[k] = tracks[k].at(seconds));
|
|
68
|
+
if (w >= 0)
|
|
69
|
+
tracks[k].slot.restoreFrom(tracks[k].ends[w]);
|
|
70
|
+
}
|
|
71
|
+
// Three lists, each in placement order, merged.
|
|
72
|
+
const replayed = this._replayed;
|
|
73
|
+
const long = this._long;
|
|
74
|
+
const bin = this._binOf(seconds);
|
|
75
|
+
const binEnd = this._binStart[bin + 1];
|
|
76
|
+
let a = 0;
|
|
77
|
+
let b = this._binStart[bin];
|
|
78
|
+
let c = 0;
|
|
79
|
+
for (;;) {
|
|
80
|
+
const ia = a < replayed.length ? replayed[a] : NONE;
|
|
81
|
+
const ib = b < binEnd ? this._binItems[b] : NONE;
|
|
82
|
+
const ic = c < long.length ? long[c] : NONE;
|
|
83
|
+
let i;
|
|
84
|
+
if (ia < ib && ia < ic) {
|
|
85
|
+
i = ia;
|
|
86
|
+
a++;
|
|
87
|
+
}
|
|
88
|
+
else if (ib < ic) {
|
|
89
|
+
i = ib;
|
|
90
|
+
b++;
|
|
91
|
+
}
|
|
92
|
+
else if (ic !== NONE) {
|
|
93
|
+
i = ic;
|
|
94
|
+
c++;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
const p = placed[i];
|
|
100
|
+
// An unmarked finish is NaN, which no time reaches.
|
|
101
|
+
if (seconds < p.start || this._finish[i] <= seconds)
|
|
102
|
+
continue;
|
|
103
|
+
p.command.at(clamp01(p.duration > 0 ? (seconds - p.start) / p.duration : 1));
|
|
104
|
+
for (let f = this._fixStart[i]; f < this._fixStart[i + 1]; f++) {
|
|
105
|
+
const k = this._fixTracks[f];
|
|
106
|
+
const w = held[k];
|
|
107
|
+
if (w >= 0 && tracks[k].order[w] > i)
|
|
108
|
+
tracks[k].slot.restoreFrom(tracks[k].ends[w]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
constructor(placed, _finish, _tracks, _replayed, running) {
|
|
113
|
+
this._finish = _finish;
|
|
114
|
+
this._tracks = _tracks;
|
|
115
|
+
this._replayed = _replayed;
|
|
116
|
+
this._held = new Int32Array(_tracks.length);
|
|
117
|
+
// Marked commands that can be running, by the time bins their run overlaps.
|
|
118
|
+
// One spanning many bins is checked on every evaluation instead.
|
|
119
|
+
let from = Infinity;
|
|
120
|
+
let to = -Infinity;
|
|
121
|
+
for (const i of running) {
|
|
122
|
+
from = Math.min(from, placed[i].start);
|
|
123
|
+
to = Math.max(to, _finish[i]);
|
|
124
|
+
}
|
|
125
|
+
const bins = Math.max(1, Math.min(MAX_BINS, running.length));
|
|
126
|
+
this._from = Number.isFinite(from) ? from : 0;
|
|
127
|
+
this._width = to > from ? (to - from) / bins : 1;
|
|
128
|
+
this._bins = bins;
|
|
129
|
+
const items = Array.from({ length: bins }, () => []);
|
|
130
|
+
const long = [];
|
|
131
|
+
for (const i of running) {
|
|
132
|
+
const first = this._binOf(placed[i].start);
|
|
133
|
+
const last = this._binOf(_finish[i]);
|
|
134
|
+
if (last - first > MAX_SPAN)
|
|
135
|
+
long.push(i);
|
|
136
|
+
else
|
|
137
|
+
for (let bin = first; bin <= last; bin++)
|
|
138
|
+
items[bin].push(i);
|
|
139
|
+
}
|
|
140
|
+
this._long = long;
|
|
141
|
+
this._binStart = new Int32Array(bins + 1);
|
|
142
|
+
for (let bin = 0; bin < bins; bin++)
|
|
143
|
+
this._binStart[bin + 1] = this._binStart[bin] + items[bin].length;
|
|
144
|
+
this._binItems = Int32Array.from(items.flat());
|
|
145
|
+
// For every command, the tracks of the slots it writes.
|
|
146
|
+
const trackOf = new Map(_tracks.map((track, k) => [track.slot, k]));
|
|
147
|
+
const fixes = [];
|
|
148
|
+
this._fixStart = new Int32Array(placed.length + 1);
|
|
149
|
+
for (let i = 0; i < placed.length; i++) {
|
|
150
|
+
for (const slot of placed[i].writes) {
|
|
151
|
+
const k = trackOf.get(slot);
|
|
152
|
+
if (k !== undefined)
|
|
153
|
+
fixes.push(k);
|
|
154
|
+
}
|
|
155
|
+
this._fixStart[i + 1] = fixes.length;
|
|
156
|
+
}
|
|
157
|
+
this._fixTracks = Int32Array.from(fixes);
|
|
158
|
+
}
|
|
159
|
+
_held;
|
|
160
|
+
_from;
|
|
161
|
+
_width;
|
|
162
|
+
_bins;
|
|
163
|
+
_binStart;
|
|
164
|
+
_binItems;
|
|
165
|
+
_long;
|
|
166
|
+
_fixStart;
|
|
167
|
+
_fixTracks;
|
|
168
|
+
_binOf(seconds) {
|
|
169
|
+
const bin = Math.floor((seconds - this._from) / this._width);
|
|
170
|
+
return bin < 0 ? 0 : bin >= this._bins ? this._bins - 1 : bin;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const NONE = 0x7fffffff;
|
|
174
|
+
const MAX_BINS = 1024;
|
|
175
|
+
const MAX_SPAN = 32;
|
|
176
|
+
/** One written slot: its marked writers by finish time, and the latest-placed one finished by each. */
|
|
177
|
+
class Track {
|
|
178
|
+
slot;
|
|
179
|
+
finish;
|
|
180
|
+
order;
|
|
181
|
+
ends;
|
|
182
|
+
_best;
|
|
183
|
+
constructor(slot, writers) {
|
|
184
|
+
this.slot = slot;
|
|
185
|
+
writers.sort((x, y) => x.finish - y.finish || x.order - y.order);
|
|
186
|
+
this.finish = Float64Array.from(writers, (w) => w.finish);
|
|
187
|
+
this.order = Int32Array.from(writers, (w) => w.order);
|
|
188
|
+
this.ends = writers.map((w) => w.end);
|
|
189
|
+
this._best = new Int32Array(writers.length);
|
|
190
|
+
let best = 0;
|
|
191
|
+
for (let i = 0; i < writers.length; i++) {
|
|
192
|
+
if (this.order[i] > this.order[best])
|
|
193
|
+
best = i;
|
|
194
|
+
this._best[i] = best;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/** The writer whose end value the slot holds at `seconds`, or -1 when none has finished. */
|
|
198
|
+
at(seconds) {
|
|
199
|
+
let lo = 0;
|
|
200
|
+
let hi = this.finish.length;
|
|
201
|
+
while (lo < hi) {
|
|
202
|
+
const mid = (lo + hi) >>> 1;
|
|
203
|
+
if (this.finish[mid] <= seconds)
|
|
204
|
+
lo = mid + 1;
|
|
205
|
+
else
|
|
206
|
+
hi = mid;
|
|
207
|
+
}
|
|
208
|
+
return lo === 0 ? -1 : this._best[lo - 1];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The first time a command placed at `start` for `duration` runs at its end, by
|
|
213
|
+
* the timeline's own arithmetic, `(t - start) / duration >= 1`. `start + duration`
|
|
214
|
+
* can miss it by a rounding step either way. NaN when it can't be pinned down,
|
|
215
|
+
* which leaves the command to run every evaluation.
|
|
216
|
+
*/
|
|
217
|
+
function finishTime(start, duration) {
|
|
218
|
+
if (!(duration > 0))
|
|
219
|
+
return start;
|
|
220
|
+
const done = (t) => (t - start) / duration >= 1;
|
|
221
|
+
let t = start + duration;
|
|
222
|
+
if (!Number.isFinite(t))
|
|
223
|
+
return NaN;
|
|
224
|
+
for (let i = 0; !done(t); i++) {
|
|
225
|
+
if (i === 8)
|
|
226
|
+
return NaN;
|
|
227
|
+
t = step(t, true);
|
|
228
|
+
}
|
|
229
|
+
for (let i = 0; i < 8; i++) {
|
|
230
|
+
const down = step(t, false);
|
|
231
|
+
if (!done(down))
|
|
232
|
+
return t;
|
|
233
|
+
t = down;
|
|
234
|
+
}
|
|
235
|
+
return NaN;
|
|
236
|
+
}
|
|
237
|
+
const BITS = new Float64Array(1);
|
|
238
|
+
const INTS = new BigInt64Array(BITS.buffer);
|
|
239
|
+
/** The adjacent double above or below `x`. */
|
|
240
|
+
function step(x, up) {
|
|
241
|
+
if (x === 0)
|
|
242
|
+
return up ? Number.MIN_VALUE : -Number.MIN_VALUE;
|
|
243
|
+
BITS[0] = x;
|
|
244
|
+
INTS[0] += (x > 0) === up ? 1n : -1n;
|
|
245
|
+
return BITS[0];
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=settled-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settled-index.js","sourceRoot":"","sources":["../../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IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QAC1B,CAAC,GAAG,IAAI,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AACjC,MAAM,IAAI,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE5C,8CAA8C;AAC9C,SAAS,IAAI,CAAC,CAAS,EAAE,EAAW;IAChC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IAC9D,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACZ,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC","sourcesContent":["import { clamp01 } from \"@/util/clamp\";\r\nimport { observeSlots } from \"@/props/observer\";\r\nimport type { PropSlot, PropSnapshot } from \"@/props/slot\";\r\nimport { settles, type Command } from \"@/tween/command\";\r\n\r\n/** What the index reads of a placed command. */\r\nexport interface SettlePlaced {\r\n readonly start: number;\r\n readonly duration: number;\r\n readonly command: Command<Record<string, unknown>>;\r\n readonly writes: ReadonlySet<PropSlot<unknown>>;\r\n}\r\n\r\n/**\r\n * Evaluation that holds finished commands instead of running them.\r\n *\r\n * A timeline evaluates `t` by restoring baselines and running every command\r\n * started by `t` in placement order, so the later one wins a slot both write.\r\n * That costs every command placed so far, finished or not. A command marked\r\n * {@link settling} leaves fixed end values, so once finished it is a stored\r\n * write per slot: for each slot, only the latest-placed finished writer counts.\r\n * A frame then costs a lookup per written slot plus the commands still running,\r\n * and the length of the timeline drops out.\r\n *\r\n * Unmarked commands, and marked ones still running, are run as before, in\r\n * placement order. After each, a slot it writes whose held writer was placed\r\n * later gets that writer's value back: placement order still decides. This\r\n * relies on what the timeline's restore already does, that a command writes\r\n * nothing while running that it did not write while being built.\r\n */\r\nexport class SettledIndex {\r\n /** `null` when nothing is marked: the timeline runs everything, as before. */\r\n static build(placed: readonly SettlePlaced[]): SettledIndex | null {\r\n const finish = new Float64Array(placed.length).fill(NaN);\r\n const writers = new Map<PropSlot<unknown>, Writer[]>();\r\n const replayed: number[] = [];\r\n const running: number[] = [];\r\n for (let i = 0; i < placed.length; i++) {\r\n const p = placed[i];\r\n const end = settles(p.command) ? finishTime(p.start, p.duration) : NaN;\r\n if (Number.isNaN(end)) {\r\n replayed.push(i);\r\n continue;\r\n }\r\n finish[i] = end;\r\n if (end > p.start) running.push(i);\r\n // Only what `at(1)` writes is an end value; a slot written only while\r\n // building is not held.\r\n const written = new Set<PropSlot<unknown>>();\r\n observeSlots({ read: () => { }, write: (slot) => written.add(slot) }, () => p.command.at(1));\r\n for (const slot of written) {\r\n const list = writers.get(slot);\r\n const writer = { order: i, finish: end, end: slot.snapshot() };\r\n if (list) list.push(writer);\r\n else writers.set(slot, [writer]);\r\n }\r\n }\r\n if (replayed.length === placed.length) return null;\r\n return new SettledIndex(placed, finish, [...writers].map(([slot, list]) => new Track(slot, list)), replayed, running);\r\n }\r\n\r\n /** Whether the command at `index` is held once finished, rather than run on every evaluation. */\r\n holds(index: number): boolean {\r\n return !Number.isNaN(this._finish[index]);\r\n }\r\n\r\n /** Bring what the placed commands write to `seconds`. Baselines must be restored first. */\r\n evaluate(placed: readonly SettlePlaced[], seconds: number): void {\r\n const tracks = this._tracks;\r\n const held = this._held;\r\n for (let k = 0; k < tracks.length; k++) {\r\n const w = (held[k] = tracks[k].at(seconds));\r\n if (w >= 0) tracks[k].slot.restoreFrom(tracks[k].ends[w]);\r\n }\r\n\r\n // Three lists, each in placement order, merged.\r\n const replayed = this._replayed;\r\n const long = this._long;\r\n const bin = this._binOf(seconds);\r\n const binEnd = this._binStart[bin + 1];\r\n let a = 0;\r\n let b = this._binStart[bin];\r\n let c = 0;\r\n for (; ;) {\r\n const ia = a < replayed.length ? replayed[a] : NONE;\r\n const ib = b < binEnd ? this._binItems[b] : NONE;\r\n const ic = c < long.length ? long[c] : NONE;\r\n let i: number;\r\n if (ia < ib && ia < ic) {\r\n i = ia;\r\n a++;\r\n } else if (ib < ic) {\r\n i = ib;\r\n b++;\r\n } else if (ic !== NONE) {\r\n i = ic;\r\n c++;\r\n } else {\r\n break;\r\n }\r\n\r\n const p = placed[i];\r\n // An unmarked finish is NaN, which no time reaches.\r\n if (seconds < p.start || this._finish[i] <= seconds) continue;\r\n p.command.at(clamp01(p.duration > 0 ? (seconds - p.start) / p.duration : 1));\r\n for (let f = this._fixStart[i]; f < this._fixStart[i + 1]; f++) {\r\n const k = this._fixTracks[f];\r\n const w = held[k];\r\n if (w >= 0 && tracks[k].order[w] > i) tracks[k].slot.restoreFrom(tracks[k].ends[w]);\r\n }\r\n }\r\n }\r\n\r\n private constructor(\r\n placed: readonly SettlePlaced[],\r\n private readonly _finish: Float64Array,\r\n private readonly _tracks: readonly Track[],\r\n private readonly _replayed: readonly number[],\r\n running: readonly number[],\r\n ) {\r\n this._held = new Int32Array(_tracks.length);\r\n\r\n // Marked commands that can be running, by the time bins their run overlaps.\r\n // One spanning many bins is checked on every evaluation instead.\r\n let from = Infinity;\r\n let to = -Infinity;\r\n for (const i of running) {\r\n from = Math.min(from, placed[i].start);\r\n to = Math.max(to, _finish[i]);\r\n }\r\n const bins = Math.max(1, Math.min(MAX_BINS, running.length));\r\n this._from = Number.isFinite(from) ? from : 0;\r\n this._width = to > from ? (to - from) / bins : 1;\r\n this._bins = bins;\r\n const items: number[][] = Array.from({ length: bins }, () => []);\r\n const long: number[] = [];\r\n for (const i of running) {\r\n const first = this._binOf(placed[i].start);\r\n const last = this._binOf(_finish[i]);\r\n if (last - first > MAX_SPAN) long.push(i);\r\n else for (let bin = first; bin <= last; bin++) items[bin].push(i);\r\n }\r\n this._long = long;\r\n this._binStart = new Int32Array(bins + 1);\r\n for (let bin = 0; bin < bins; bin++) this._binStart[bin + 1] = this._binStart[bin] + items[bin].length;\r\n this._binItems = Int32Array.from(items.flat());\r\n\r\n // For every command, the tracks of the slots it writes.\r\n const trackOf = new Map<PropSlot<unknown>, number>(_tracks.map((track, k) => [track.slot, k]));\r\n const fixes: number[] = [];\r\n this._fixStart = new Int32Array(placed.length + 1);\r\n for (let i = 0; i < placed.length; i++) {\r\n for (const slot of placed[i].writes) {\r\n const k = trackOf.get(slot);\r\n if (k !== undefined) fixes.push(k);\r\n }\r\n this._fixStart[i + 1] = fixes.length;\r\n }\r\n this._fixTracks = Int32Array.from(fixes);\r\n }\r\n\r\n private readonly _held: Int32Array;\r\n private readonly _from: number;\r\n private readonly _width: number;\r\n private readonly _bins: number;\r\n private readonly _binStart: Int32Array;\r\n private readonly _binItems: Int32Array;\r\n private readonly _long: readonly number[];\r\n private readonly _fixStart: Int32Array;\r\n private readonly _fixTracks: Int32Array;\r\n\r\n private _binOf(seconds: number): number {\r\n const bin = Math.floor((seconds - this._from) / this._width);\r\n return bin < 0 ? 0 : bin >= this._bins ? this._bins - 1 : bin;\r\n }\r\n}\r\n\r\nconst NONE = 0x7fffffff;\r\nconst MAX_BINS = 1024;\r\nconst MAX_SPAN = 32;\r\n\r\ninterface Writer {\r\n order: number;\r\n finish: number;\r\n end: PropSnapshot<unknown>;\r\n}\r\n\r\n/** One written slot: its marked writers by finish time, and the latest-placed one finished by each. */\r\nclass Track {\r\n readonly finish: Float64Array;\r\n readonly order: Int32Array;\r\n readonly ends: PropSnapshot<unknown>[];\r\n private readonly _best: Int32Array;\r\n\r\n constructor(readonly slot: PropSlot<unknown>, writers: Writer[]) {\r\n writers.sort((x, y) => x.finish - y.finish || x.order - y.order);\r\n this.finish = Float64Array.from(writers, (w) => w.finish);\r\n this.order = Int32Array.from(writers, (w) => w.order);\r\n this.ends = writers.map((w) => w.end);\r\n this._best = new Int32Array(writers.length);\r\n let best = 0;\r\n for (let i = 0; i < writers.length; i++) {\r\n if (this.order[i] > this.order[best]) best = i;\r\n this._best[i] = best;\r\n }\r\n }\r\n\r\n /** The writer whose end value the slot holds at `seconds`, or -1 when none has finished. */\r\n at(seconds: number): number {\r\n let lo = 0;\r\n let hi = this.finish.length;\r\n while (lo < hi) {\r\n const mid = (lo + hi) >>> 1;\r\n if (this.finish[mid] <= seconds) lo = mid + 1;\r\n else hi = mid;\r\n }\r\n return lo === 0 ? -1 : this._best[lo - 1];\r\n }\r\n}\r\n\r\n/**\r\n * The first time a command placed at `start` for `duration` runs at its end, by\r\n * the timeline's own arithmetic, `(t - start) / duration >= 1`. `start + duration`\r\n * can miss it by a rounding step either way. NaN when it can't be pinned down,\r\n * which leaves the command to run every evaluation.\r\n */\r\nfunction finishTime(start: number, duration: number): number {\r\n if (!(duration > 0)) return start;\r\n const done = (t: number) => (t - start) / duration >= 1;\r\n let t = start + duration;\r\n if (!Number.isFinite(t)) return NaN;\r\n for (let i = 0; !done(t); i++) {\r\n if (i === 8) return NaN;\r\n t = step(t, true);\r\n }\r\n for (let i = 0; i < 8; i++) {\r\n const down = step(t, false);\r\n if (!done(down)) return t;\r\n t = down;\r\n }\r\n return NaN;\r\n}\r\n\r\nconst BITS = new Float64Array(1);\r\nconst INTS = new BigInt64Array(BITS.buffer);\r\n\r\n/** The adjacent double above or below `x`. */\r\nfunction step(x: number, up: boolean): number {\r\n if (x === 0) return up ? Number.MIN_VALUE : -Number.MIN_VALUE;\r\n BITS[0] = x;\r\n INTS[0] += (x > 0) === up ? 1n : -1n;\r\n return BITS[0];\r\n}\r\n"]}
|