@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +220 -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-FUZVFT3W.js +18 -0
- package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.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/component.js +1 -1
- package/dist/browser/component.js.map +1 -1
- 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 +3 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +1 -1
- package/dist/document/audio.js +4 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +8 -14
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +13 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- 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 +19 -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 +17 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +29 -2
- package/dist/document/registry.js.map +1 -1
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +73 -18
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +192 -40
- 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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -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.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +2 -2
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +1 -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 +3 -8
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +3 -8
- 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 +5 -3
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +44 -19
- 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 +2 -2
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +2 -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.js +1 -1
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +1 -1
- package/dist/nodes/text/text-base.js.map +1 -1
- 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 +29 -6
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +44 -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 +5 -3
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +10 -6
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +9 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +19 -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 +118 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -1
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +5 -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.js.map +1 -1
- package/dist/sdk/index.d.ts +19 -15
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +11 -6
- 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.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 +2 -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 +0 -0
|
@@ -3,6 +3,7 @@ import type { RenderContext3D } from "../../render3d/render-context3d.js";
|
|
|
3
3
|
import type { AssetScope } from "../../assets/scope.js";
|
|
4
4
|
import type { Shadow3D, Transform3D } from "../../render3d/transform.js";
|
|
5
5
|
import { Node, type NodeConfig, type NodeDimension, type NodeProps } from "../../nodes/node/node.js";
|
|
6
|
+
import type { Command, CommandArgs } from "../../tween/command.js";
|
|
6
7
|
import type { EasingFunction } from "../../tween/ease/type.js";
|
|
7
8
|
import type { TweenStepper } from "../../tween/stepper.js";
|
|
8
9
|
export interface Node3DProps extends NodeProps {
|
|
@@ -48,6 +49,22 @@ export interface Node3DProps extends NodeProps {
|
|
|
48
49
|
/** Draw-order override, for tuning transparent sorting. */
|
|
49
50
|
renderOrder: number;
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* A 3D parent's own coordinates for where its children sit: the units of a
|
|
54
|
+
* graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its
|
|
55
|
+
* size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or
|
|
56
|
+
* `Canvas3D._spaceOf` for a child of the viewport itself).
|
|
57
|
+
*/
|
|
58
|
+
export interface ChildSpace3D {
|
|
59
|
+
/** A child's `x`/`y`/`z` as a point in the parent's local space. */
|
|
60
|
+
toLocal(x: number, y: number, z: number): Vector3;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The coordinates `node`'s parent places it by, or `null` when they are the
|
|
64
|
+
* parent's local space. The parent may be a 3D node or the viewport holding it.
|
|
65
|
+
*/
|
|
66
|
+
/** @internal */
|
|
67
|
+
export declare function parentSpaceOf(node: Node3D): ChildSpace3D | null;
|
|
51
68
|
/**
|
|
52
69
|
* A thing in 3D space — the root of the 3D scene graph.
|
|
53
70
|
*
|
|
@@ -109,6 +126,31 @@ export declare class Node3D<P extends Node3DProps = Node3DProps> extends Node<P>
|
|
|
109
126
|
shadow: Shadow3D;
|
|
110
127
|
renderOrder: number;
|
|
111
128
|
constructor(props?: NodeConfig<any, P>);
|
|
129
|
+
/** Animate the position, whichever axes are given; the rest stay where they are. */
|
|
130
|
+
moveTo(args: CommandArgs<{
|
|
131
|
+
x?: number;
|
|
132
|
+
y?: number;
|
|
133
|
+
z?: number;
|
|
134
|
+
}> & {
|
|
135
|
+
duration: number;
|
|
136
|
+
}): Command<P>;
|
|
137
|
+
/** Animate the Euler rotation, in degrees, whichever axes are given. */
|
|
138
|
+
rotateTo(args: CommandArgs<{
|
|
139
|
+
rotationX?: number;
|
|
140
|
+
rotationY?: number;
|
|
141
|
+
rotationZ?: number;
|
|
142
|
+
}> & {
|
|
143
|
+
duration: number;
|
|
144
|
+
}): Command<P>;
|
|
145
|
+
/** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */
|
|
146
|
+
scaleTo(args: CommandArgs<{
|
|
147
|
+
scale?: number;
|
|
148
|
+
scaleX?: number;
|
|
149
|
+
scaleY?: number;
|
|
150
|
+
scaleZ?: number;
|
|
151
|
+
}> & {
|
|
152
|
+
duration: number;
|
|
153
|
+
}): Command<P>;
|
|
112
154
|
/** This node's position, composed from the axis props. */
|
|
113
155
|
get position(): Vector3;
|
|
114
156
|
set position(value: Vector3Input);
|
|
@@ -147,6 +189,12 @@ export declare class Node3D<P extends Node3DProps = Node3DProps> extends Node<P>
|
|
|
147
189
|
* make `rotation` silently do nothing.
|
|
148
190
|
*/
|
|
149
191
|
protected transform3D(): Transform3D;
|
|
192
|
+
/**
|
|
193
|
+
* The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when
|
|
194
|
+
* they are this node's local space. A `null` child is one not here yet.
|
|
195
|
+
*/
|
|
196
|
+
/** @internal */
|
|
197
|
+
_spaceOf(_child: Node3D | null): ChildSpace3D | null;
|
|
150
198
|
/**
|
|
151
199
|
* The transform that goes on this node's *group* — the scope its children
|
|
152
200
|
* nest inside. Defaults to this node's own placement, which is right for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node3d.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/node3d.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EACjF,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC1C,0EAA0E;IAC1E,QAAQ,EAAE,YAAY,CAAC;IACvB,wEAAwE;IACxE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAA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AAE,MAAM,CAAC,EAAE,cAAc,GAAG,YAAY;IAI9F;;;;;;;;;OASG;IACH,SAAS,CAAC,WAAW,IAAI,WAAW;IAiBpC;;;OAGG;IACH,gBAAgB;IAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI;IAIpD;;;;;;;;OAQG;IACH,SAAS,CAAC,cAAc,IAAI,WAAW;IAIvC;;;;;OAKG;IACH,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAEhD;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAmBlC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;CAM1C"}
|
|
@@ -5,11 +5,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { property } from "../../attributes/properties/decorator.js";
|
|
8
|
-
import { quaternionProperty } from "../../attributes/properties/typed.js";
|
|
8
|
+
import { optionalVector3Property, quaternionProperty } from "../../attributes/properties/typed.js";
|
|
9
9
|
import { resolveVector3, } from "../../render3d/vector3.js";
|
|
10
10
|
import { Scene3D } from "../../render3d/scene3d.js";
|
|
11
11
|
import { declare3DResources } from "../../render3d/tracking.js";
|
|
12
12
|
import { Node } from "../../nodes/node/node.js";
|
|
13
|
+
import { command } from "../../tween/command-decorator.js";
|
|
14
|
+
/**
|
|
15
|
+
* The coordinates `node`'s parent places it by, or `null` when they are the
|
|
16
|
+
* parent's local space. The parent may be a 3D node or the viewport holding it.
|
|
17
|
+
*/
|
|
18
|
+
/** @internal */
|
|
19
|
+
export function parentSpaceOf(node) {
|
|
20
|
+
const parent = node.parent;
|
|
21
|
+
return typeof parent?._spaceOf === "function" ? parent._spaceOf(node) : null;
|
|
22
|
+
}
|
|
13
23
|
/** The three axis props each vector prop distributes into, in order. */
|
|
14
24
|
const VECTOR_SUGAR = {
|
|
15
25
|
position: ["x", "y", "z"],
|
|
@@ -68,6 +78,18 @@ export class Node3D extends Node {
|
|
|
68
78
|
this.initProps(distributeVectors(props));
|
|
69
79
|
this.adoptChildrenProp(props);
|
|
70
80
|
}
|
|
81
|
+
/** Animate the position, whichever axes are given; the rest stay where they are. */
|
|
82
|
+
moveTo(args) {
|
|
83
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
84
|
+
}
|
|
85
|
+
/** Animate the Euler rotation, in degrees, whichever axes are given. */
|
|
86
|
+
rotateTo(args) {
|
|
87
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
88
|
+
}
|
|
89
|
+
/** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */
|
|
90
|
+
scaleTo(args) {
|
|
91
|
+
return this.to({ data: stated(args.data), duration: args.duration, easing: args.easing });
|
|
92
|
+
}
|
|
71
93
|
/** This node's position, composed from the axis props. */
|
|
72
94
|
get position() {
|
|
73
95
|
return { x: this.x, y: this.y, z: this.z };
|
|
@@ -122,8 +144,9 @@ export class Node3D extends Node {
|
|
|
122
144
|
transform3D() {
|
|
123
145
|
const quaternion = this.quaternion;
|
|
124
146
|
const identityQuaternion = quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;
|
|
147
|
+
const space = parentSpaceOf(this);
|
|
125
148
|
return {
|
|
126
|
-
position: this.position,
|
|
149
|
+
position: space ? space.toLocal(this.x, this.y, this.z) : this.position,
|
|
127
150
|
rotation: this.rotation,
|
|
128
151
|
quaternion: identityQuaternion ? undefined : quaternion,
|
|
129
152
|
scale: this.scale,
|
|
@@ -133,6 +156,14 @@ export class Node3D extends Node {
|
|
|
133
156
|
renderOrder: this.renderOrder,
|
|
134
157
|
};
|
|
135
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when
|
|
161
|
+
* they are this node's local space. A `null` child is one not here yet.
|
|
162
|
+
*/
|
|
163
|
+
/** @internal */
|
|
164
|
+
_spaceOf(_child) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
136
167
|
/**
|
|
137
168
|
* The transform that goes on this node's *group* — the scope its children
|
|
138
169
|
* nest inside. Defaults to this node's own placement, which is right for
|
|
@@ -225,7 +256,7 @@ __decorate([
|
|
|
225
256
|
property({ default: 1 })
|
|
226
257
|
], Node3D.prototype, "scaleZ", void 0);
|
|
227
258
|
__decorate([
|
|
228
|
-
|
|
259
|
+
optionalVector3Property("snap")
|
|
229
260
|
], Node3D.prototype, "lookAt", void 0);
|
|
230
261
|
__decorate([
|
|
231
262
|
property({ default: true })
|
|
@@ -236,6 +267,17 @@ __decorate([
|
|
|
236
267
|
__decorate([
|
|
237
268
|
property({ default: 0 })
|
|
238
269
|
], Node3D.prototype, "renderOrder", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
command({ args: ["x", "y", "z"] })
|
|
272
|
+
], Node3D.prototype, "moveTo", null);
|
|
273
|
+
__decorate([
|
|
274
|
+
command({ args: ["rotationX", "rotationY", "rotationZ"] })
|
|
275
|
+
], Node3D.prototype, "rotateTo", null);
|
|
276
|
+
__decorate([
|
|
277
|
+
command({
|
|
278
|
+
args: [{ key: "scale", kind: "number", min: 0, step: 0.05, unit: "×" }, "scaleX", "scaleY", "scaleZ"],
|
|
279
|
+
})
|
|
280
|
+
], Node3D.prototype, "scaleTo", null);
|
|
239
281
|
/**
|
|
240
282
|
* Expand `position`/`rotation`/`scale` in a prop bag into their axis props.
|
|
241
283
|
*
|
|
@@ -281,6 +323,14 @@ function distributeVectors(props) {
|
|
|
281
323
|
}
|
|
282
324
|
return out ?? props;
|
|
283
325
|
}
|
|
326
|
+
/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */
|
|
327
|
+
function stated(data) {
|
|
328
|
+
const out = {};
|
|
329
|
+
for (const key in data)
|
|
330
|
+
if (data[key] !== undefined)
|
|
331
|
+
out[key] = data[key];
|
|
332
|
+
return out;
|
|
333
|
+
}
|
|
284
334
|
function componentOf(vector, index) {
|
|
285
335
|
return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;
|
|
286
336
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../src/nodes/three/node3d.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACH,cAAc,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAuD,MAAM,mBAAmB,CAAC;AAgD9F,wEAAwE;AACxE,MAAM,YAAY,GAAgE;IAC9E,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC;IACjD,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAO,MAA4C,SAAQ,IAAO;IACpE,IAAI,SAAS,KAAoB,OAAO,IAAI,CAAC,CAAC,CAAC;IAsB/C,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,wEAAwE;QACxE,oEAAoE;QACpE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAuB,CAAC,CAAC;QAC/D,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,0DAA0D;IAC1D,IAAI,QAAQ;QACR,OAAO,EAAE,CAAC,EA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AI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,wDAAwD;QACxD,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACrB,MAAM,KAAK,GAAI,KAAgB,CAAC,KAAK,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS;gBAAE,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC;QAC1F,CAAC;IACL,CAAC;IAED,OAAQ,GAAS,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { quaternionProperty } from \"@/attributes/properties/typed\";\nimport {\n resolveVector3,\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\n} from \"@/render3d/vector3\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport { declare3DResources } from \"@/render3d/tracking\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/nodes/node/node\";\nimport type { EasingFunction } from \"@/tween/ease/type\";\nimport type { TweenStepper } from \"@/tween/stepper\";\n\nexport interface Node3DProps extends NodeProps {\n /** Position in the parent's local space. A scalar sets all three axes. */\n position: Vector3Input;\n /** Position on one axis. The same names 2D uses, one dimension over. */\n x: number;\n y: number;\n z: number;\n /**\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\n * {@link quaternion} is set.\n */\n rotation: Vector3Input | Euler3;\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\n rotationOrder: EulerOrder;\n /**\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\n * tumbles where Euler interpolation would gimbal.\n */\n quaternion: Quaternion;\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\n scale: Vector3Input;\n scaleX: number;\n scaleY: number;\n scaleZ: number;\n /**\n * World-space point to orient toward, applied after {@link position}. Wins\n * over both {@link rotation} and {@link quaternion}.\n */\n lookAt: Vector3Input | undefined;\n /** Hide without removing — the cached renderer object stays alive. */\n visible: boolean;\n /**\n * Shadow participation. Default `true`, so turning shadows on for the scene\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\n */\n shadow: Shadow3D;\n /** Draw-order override, for tuning transparent sorting. */\n renderOrder: number;\n}\n\n/** The three axis props each vector prop distributes into, in order. */\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\n position: [\"x\", \"y\", \"z\"],\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\n};\n\n/**\n * A thing in 3D space — the root of the 3D scene graph.\n *\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\n * {@link Node}. What differs is the only thing that genuinely differs between the\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\n * node's whole placement is its transform.\n *\n * <Canvas3D>\n * <Camera3D orbit={30} elevation={18} distance={6} />\n * <AmbientLight3D intensity={0.4} />\n * <Group3D ref={rig}>\n * <Box3D width={2} cornerRadius={0.15} fill=\"tomato\" />\n * </Group3D>\n * </Canvas3D>\n *\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\n *\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\n * distributed into those three, the way `Node2D` already distributes `size` into\n * `width`/`height` — so both spellings tween identically and there is one source\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\n * single vector prop it would have had nothing to interpolate on the other two\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\n * did not mean to change.\n *\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\n * nothing (see {@link Node.acceptsChild}).\n *\n * To write your own, override {@link renderSelf} and hand a `Graphics3D` to the\n * context — the exact shape of a custom 2D node's `renderSelf`:\n *\n * class Blob3D extends Node3D {\n * protected override renderSelf(ctx: RenderContext3D): void {\n * ctx.draw(new Graphics3D().sphere({ radius: 1, fill: \"red\" }));\n * }\n * }\n */\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\n get dimension(): NodeDimension { return \"3d\"; }\n\n @property({ default: 0 }) declare x: number;\n @property({ default: 0 }) declare y: number;\n @property({ default: 0 }) declare z: number;\n\n @property({ default: 0 }) declare rotationX: number;\n @property({ default: 0 }) declare rotationY: number;\n @property({ default: 0 }) declare rotationZ: number;\n @property({ default: \"XYZ\" }) declare rotationOrder: EulerOrder;\n\n @quaternionProperty() declare quaternion: Quaternion;\n\n @property({ default: 1 }) declare scaleX: number;\n @property({ default: 1 }) declare scaleY: number;\n @property({ default: 1 }) declare scaleZ: number;\n\n @property({ default: undefined }) declare lookAt: Vector3Input | undefined;\n @property({ default: true }) declare visible: boolean;\n @property({ default: true }) declare shadow: Shadow3D;\n @property({ default: 0 }) declare renderOrder: number;\n\n constructor(props?: NodeConfig<any, P>) {\n super(props);\n // Distributed before `initProps`, which only ever applies keys that are\n // registered props — a `position` left in the bag would be dropped.\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\n this.adoptChildrenProp(props);\n }\n\n /** This node's position, composed from the axis props. */\n get position(): Vector3 {\n return { x: this.x, y: this.y, z: this.z };\n }\n set position(value: Vector3Input) {\n this.set({ position: value } as never);\n }\n\n /** This node's Euler rotation in degrees, composed from the axis props. */\n get rotation(): Euler3 {\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\n }\n set rotation(value: Vector3Input | Euler3) {\n this.set({ rotation: value } as never);\n }\n\n /** This node's scale, composed from the axis props. */\n get scale(): Vector3 {\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\n }\n set scale(value: Vector3Input) {\n this.set({ scale: value } as never);\n }\n\n /**\n * Distribute the vector sugar into axis props, then write as usual.\n *\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\n * `position` has no slot of its own, so it has to become three writes\n * before the generic loop runs. An explicitly stated axis in the same call\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\n * it reads like.\n */\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\n super.set(distributeVectors(props) as typeof props);\n }\n\n /**\n * The tween half of the same rule. Expanded here rather than in the command\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\n * steppers — one interpolating path, whichever way it was written.\n */\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\n }\n\n /**\n * This node's placement, as the renderer's own vocabulary.\n *\n * Sampled fresh every frame from the prop slots, so a tween moves the object\n * without anything here caching state between frames.\n *\n * `quaternion` is only emitted when it has been set away from identity: it\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\n * make `rotation` silently do nothing.\n */\n protected transform3D(): Transform3D {\n const quaternion = this.quaternion as unknown as Quaternion;\n const identityQuaternion =\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\n return {\n position: this.position,\n rotation: this.rotation,\n quaternion: identityQuaternion ? undefined : quaternion,\n scale: this.scale,\n lookAt: this.lookAt,\n visible: this.visible,\n shadow: this.shadow,\n renderOrder: this.renderOrder,\n };\n }\n\n /**\n * The transform that goes on this node's *group* — the scope its children\n * nest inside. Defaults to this node's own placement, which is right for\n * everything that lives at its own origin.\n *\n * A camera overrides it to identity and places itself instead: three aims a\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\n * placement on its group would point the shot backwards.\n */\n protected groupTransform(): Transform3D {\n return this.transform3D();\n }\n\n /**\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\n * this node's transform.\n */\n protected renderSelf(ctx: RenderContext3D): void { }\n\n /**\n * Record this node and its subtree into `ctx`.\n *\n * An invisible node still opens its scope: `visible: false` is a renderer-side\n * flag on a live object rather than a removal, which is what lets a node be\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\n * walk here would instead sweep the whole subtree out of the cache.\n */\n render(ctx: RenderContext3D): void {\n // The editor's flag folds into `visible` rather than adding a second one:\n // the 3D side already has exactly this concept, honoured by the picking\n // walk, and two flags meaning \"do not show this\" would be two places to\n // ask. Still opens its scope — see the note above on why an invisible\n // node keeps its cached renderer object.\n if (this.hidden) {\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\n ctx.end();\n return;\n }\n ctx.begin({ id: this.id, transform: this.groupTransform() });\n this.renderSelf(ctx);\n for (const child of this._children) {\n if (child instanceof Node3D) child.render(ctx);\n }\n ctx.end();\n }\n\n /**\n * What {@link renderSelf} records, never {@link render}: the placement lives on\n * the group scope, so moving a node does not change what it declares.\n */\n declareAssets(assets: AssetScope): void {\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\n const scene = new Scene3D();\n this.renderSelf(scene);\n declare3DResources(scene, assets);\n }\n}\n\n/**\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\n *\n * Returns the bag untouched when it names none of them, so the common write path\n * allocates nothing. A **binding** expands into three bindings that each resolve\n * the vector and take one component — so `position={() => lift()}` stays a\n * binding, and one thunk driving all three axes is still read once per axis per\n * frame rather than being frozen at bind time.\n */\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\n if (!props) return props;\n\n let out: Record<string, unknown> | undefined;\n\n for (const key in VECTOR_SUGAR) {\n const value = (props as Record<string, unknown>)[key];\n if (value === undefined) continue;\n\n out ??= { ...(props as Record<string, unknown>) };\n delete out[key];\n\n const axes = VECTOR_SUGAR[key];\n\n if (typeof value === \"function\") {\n const read = value as () => Vector3Input;\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] !== undefined) continue;\n out[axis] = () => componentOf(resolveVector3(read()), i);\n }\n continue;\n }\n\n const vector = resolveVector3(value as Vector3Input);\n for (let i = 0; i < 3; i++) {\n const axis = axes[i];\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\n }\n\n // `order` rides on an Euler and has nowhere else to go.\n if (key === \"rotation\") {\n const order = (value as Euler3).order;\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\n }\n }\n\n return (out as T) ?? props;\n}\n\nfunction componentOf(vector: Vector3, index: number): number {\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node3d.js","sourceRoot":"","sources":["../../../src/nodes/three/node3d.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACH,cAAc,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OA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C;QAED,MAAM,MAAM,GAAG,cAAc,CAAC,KAAqB,CAAC,CAAC;QACrD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;QAED,wDAAwD;QACxD,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACrB,MAAM,KAAK,GAAI,KAAgB,CAAC,KAAK,CAAC;YACtC,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,aAAa,KAAK,SAAS;gBAAE,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC;QAC1F,CAAC;IACL,CAAC;IAED,OAAQ,GAAS,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,2FAA2F;AAC3F,SAAS,MAAM,CAAmB,IAAmB;IACjD,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,IAAI;QAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,GAAG,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,MAAe,EAAE,KAAa;IAC/C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property, quaternionProperty } from \"@/attributes/properties/typed\";\r\nimport {\r\n resolveVector3,\r\n type Euler3, type EulerOrder, type Quaternion, type Vector3, type Vector3Input,\r\n} from \"@/render3d/vector3\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\nimport { declare3DResources } from \"@/render3d/tracking\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport type { Shadow3D, Transform3D } from \"@/render3d/transform\";\r\nimport { Node, type NodeConfig, type NodeDimension, type NodeProps } from \"@/nodes/node/node\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\nimport type { TweenStepper } from \"@/tween/stepper\";\r\n\r\nexport interface Node3DProps extends NodeProps {\r\n /** Position in the parent's local space. A scalar sets all three axes. */\r\n position: Vector3Input;\r\n /** Position on one axis. The same names 2D uses, one dimension over. */\r\n x: number;\r\n y: number;\r\n z: number;\r\n /**\r\n * Euler rotation in **degrees**, matching 2D `rotation`. Ignored when\r\n * {@link quaternion} is set.\r\n */\r\n rotation: Vector3Input | Euler3;\r\n /** Rotation about one axis, in **degrees**. Same names as 2D's. */\r\n rotationX: number;\r\n rotationY: number;\r\n rotationZ: number;\r\n /** The order the Euler axes are applied in. Default `\"XYZ\"`. */\r\n rotationOrder: EulerOrder;\r\n /**\r\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it for\r\n * tumbles where Euler interpolation would gimbal.\r\n */\r\n quaternion: Quaternion;\r\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\r\n scale: Vector3Input;\r\n scaleX: number;\r\n scaleY: number;\r\n scaleZ: number;\r\n /**\r\n * World-space point to orient toward, applied after {@link position}. Wins\r\n * over both {@link rotation} and {@link quaternion}.\r\n */\r\n lookAt: Vector3Input | undefined;\r\n /** Hide without removing — the cached renderer object stays alive. */\r\n visible: boolean;\r\n /**\r\n * Shadow participation. Default `true`, so turning shadows on for the scene\r\n * turns them on. Pass `false` to opt out, or `\"cast\"`/`\"receive\"` for one half.\r\n */\r\n shadow: Shadow3D;\r\n /** Draw-order override, for tuning transparent sorting. */\r\n renderOrder: number;\r\n}\r\n\r\n/**\r\n * A 3D parent's own coordinates for where its children sit: the units of a\r\n * graph, say. Position only, as a `ChildPlane` is in 2D: a child keeps its\r\n * size, turn and scale. Answered by the parent ({@link Node3D._spaceOf}, or\r\n * `Canvas3D._spaceOf` for a child of the viewport itself).\r\n */\r\nexport interface ChildSpace3D {\r\n /** A child's `x`/`y`/`z` as a point in the parent's local space. */\r\n toLocal(x: number, y: number, z: number): Vector3;\r\n}\r\n\r\n/** A parent that may place its 3D children in coordinates of its own: a `Node3D`, or a 3D viewport. */\r\ninterface SpaceHolder3D {\r\n _spaceOf(child: Node3D | null): ChildSpace3D | null;\r\n}\r\n\r\n/**\r\n * The coordinates `node`'s parent places it by, or `null` when they are the\r\n * parent's local space. The parent may be a 3D node or the viewport holding it.\r\n */\r\n/** @internal */\r\nexport function parentSpaceOf(node: Node3D): ChildSpace3D | null {\r\n const parent = node.parent as Partial<SpaceHolder3D> | null;\r\n return typeof parent?._spaceOf === \"function\" ? parent._spaceOf(node) : null;\r\n}\r\n\r\n/** The three axis props each vector prop distributes into, in order. */\r\nconst VECTOR_SUGAR: Readonly<Record<string, readonly [string, string, string]>> = {\r\n position: [\"x\", \"y\", \"z\"],\r\n rotation: [\"rotationX\", \"rotationY\", \"rotationZ\"],\r\n scale: [\"scaleX\", \"scaleY\", \"scaleZ\"],\r\n};\r\n\r\n/**\r\n * A thing in 3D space — the root of the 3D scene graph.\r\n *\r\n * The sibling of {@link Node2D}: same tree, same props, same `to()`/`set()`/\r\n * `save()`/`restore()`, same refs, context and per-node clock, all inherited from\r\n * {@link Node}. What differs is the only thing that genuinely differs between the\r\n * two — how a node is placed and how it draws. There is no `width`, no `padding`,\r\n * no anchor and no flex here, because none of them mean anything for a mesh; a 3D\r\n * node's whole placement is its transform.\r\n *\r\n * <Canvas3D>\r\n * <Camera3D orbit={30} elevation={18} distance={6} />\r\n * <AmbientLight3D intensity={0.4} />\r\n * <Group3D ref={rig}>\r\n * <Box3D width={2} cornerRadius={0.15} fill=\"tomato\" />\r\n * </Group3D>\r\n * </Canvas3D>\r\n *\r\n * rig().to({ data: { rotationY: 360, y: 1 }, duration: 2 });\r\n *\r\n * ── Axes are scalars, and vectors are sugar over them ─────────────────────────\r\n * `x`, `y`, `z`, `rotationX/Y/Z` and `scaleX/Y/Z` are the real props, and they\r\n * are named exactly what 2D names them. `position`, `rotation` and `scale` are\r\n * distributed into those three, the way `Node2D` already distributes `size` into\r\n * `width`/`height` — so both spellings tween identically and there is one source\r\n * of truth for where a node is. That is what makes `to({ y: 3 })` work: with a\r\n * single vector prop it would have had nothing to interpolate on the other two\r\n * axes, which is exactly the trap that made every 3D scene restate coordinates it\r\n * did not mean to change.\r\n *\r\n * A `Node3D` only ever lives under a `Canvas3D` — the one node that holds both\r\n * dimensions. Parenting one to a `Rect` throws rather than silently drawing\r\n * nothing (see {@link Node.acceptsChild}).\r\n *\r\n * To write your own, override {@link renderSelf} and hand a `Graphics3D` to the\r\n * context — the exact shape of a custom 2D node's `renderSelf`:\r\n *\r\n * class Blob3D extends Node3D {\r\n * protected override renderSelf(ctx: RenderContext3D): void {\r\n * ctx.draw(new Graphics3D().sphere({ radius: 1, fill: \"red\" }));\r\n * }\r\n * }\r\n */\r\nexport class Node3D<P extends Node3DProps = Node3DProps> extends Node<P> {\r\n get dimension(): NodeDimension { return \"3d\"; }\r\n\r\n @property({ default: 0 }) declare x: number;\r\n @property({ default: 0 }) declare y: number;\r\n @property({ default: 0 }) declare z: number;\r\n\r\n @property({ default: 0 }) declare rotationX: number;\r\n @property({ default: 0 }) declare rotationY: number;\r\n @property({ default: 0 }) declare rotationZ: number;\r\n @property({ default: \"XYZ\" }) declare rotationOrder: EulerOrder;\r\n\r\n @quaternionProperty() declare quaternion: Quaternion;\r\n\r\n @property({ default: 1 }) declare scaleX: number;\r\n @property({ default: 1 }) declare scaleY: number;\r\n @property({ default: 1 }) declare scaleZ: number;\r\n\r\n @optionalVector3Property(\"snap\") declare lookAt: Vector3Input | undefined;\r\n @property({ default: true }) declare visible: boolean;\r\n @property({ default: true }) declare shadow: Shadow3D;\r\n @property({ default: 0 }) declare renderOrder: number;\r\n\r\n constructor(props?: NodeConfig<any, P>) {\r\n super(props);\r\n // Distributed before `initProps`, which only ever applies keys that are\r\n // registered props — a `position` left in the bag would be dropped.\r\n this.initProps(distributeVectors(props) as NodeConfig<any, P>);\r\n this.adoptChildrenProp(props);\r\n }\r\n\r\n /** Animate the position, whichever axes are given; the rest stay where they are. */\r\n @command({ args: [\"x\", \"y\", \"z\"] })\r\n moveTo(args: CommandArgs<{ x?: number; y?: number; z?: number }> & { duration: number }): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the Euler rotation, in degrees, whichever axes are given. */\r\n @command({ args: [\"rotationX\", \"rotationY\", \"rotationZ\"] })\r\n rotateTo(\r\n args: CommandArgs<{ rotationX?: number; rotationY?: number; rotationZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the scale: `scale` on every axis, and any axis given beside it on that one. */\r\n @command({\r\n args: [{ key: \"scale\", kind: \"number\", min: 0, step: 0.05, unit: \"×\" }, \"scaleX\", \"scaleY\", \"scaleZ\"],\r\n })\r\n scaleTo(\r\n args: CommandArgs<{ scale?: number; scaleX?: number; scaleY?: number; scaleZ?: number }> & { duration: number },\r\n ): Command<P> {\r\n return this.to({ data: stated(args.data) as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** This node's position, composed from the axis props. */\r\n get position(): Vector3 {\r\n return { x: this.x, y: this.y, z: this.z };\r\n }\r\n set position(value: Vector3Input) {\r\n this.set({ position: value } as never);\r\n }\r\n\r\n /** This node's Euler rotation in degrees, composed from the axis props. */\r\n get rotation(): Euler3 {\r\n return { x: this.rotationX, y: this.rotationY, z: this.rotationZ, order: this.rotationOrder };\r\n }\r\n set rotation(value: Vector3Input | Euler3) {\r\n this.set({ rotation: value } as never);\r\n }\r\n\r\n /** This node's scale, composed from the axis props. */\r\n get scale(): Vector3 {\r\n return { x: this.scaleX, y: this.scaleY, z: this.scaleZ };\r\n }\r\n set scale(value: Vector3Input) {\r\n this.set({ scale: value } as never);\r\n }\r\n\r\n /**\r\n * Distribute the vector sugar into axis props, then write as usual.\r\n *\r\n * Same shape as `Node2D.set`'s handling of `size`, and for the same reason:\r\n * `position` has no slot of its own, so it has to become three writes\r\n * before the generic loop runs. An explicitly stated axis in the same call\r\n * wins over the vector, which is what lets `{ position: p, y: 0 }` mean what\r\n * it reads like.\r\n */\r\n override set(props: { [K in keyof P]?: P[K] | (() => P[K]) }): void {\r\n super.set(distributeVectors(props) as typeof props);\r\n }\r\n\r\n /**\r\n * The tween half of the same rule. Expanded here rather than in the command\r\n * so `to({ position: [...] })` and `to({ x, y, z })` produce identical\r\n * steppers — one interpolating path, whichever way it was written.\r\n */\r\n override _prepareStep(to: Partial<P>, duration: number, easing?: EasingFunction): TweenStepper {\r\n return super._prepareStep(distributeVectors(to) as Partial<P>, duration, easing);\r\n }\r\n\r\n /**\r\n * This node's placement, as the renderer's own vocabulary.\r\n *\r\n * Sampled fresh every frame from the prop slots, so a tween moves the object\r\n * without anything here caching state between frames.\r\n *\r\n * `quaternion` is only emitted when it has been set away from identity: it\r\n * wins over `rotation` in a {@link Transform3D}, so always sending it would\r\n * make `rotation` silently do nothing.\r\n */\r\n protected transform3D(): Transform3D {\r\n const quaternion = this.quaternion as unknown as Quaternion;\r\n const identityQuaternion =\r\n quaternion.x === 0 && quaternion.y === 0 && quaternion.z === 0 && quaternion.w === 1;\r\n const space = parentSpaceOf(this);\r\n return {\r\n position: space ? space.toLocal(this.x, this.y, this.z) : this.position,\r\n rotation: this.rotation,\r\n quaternion: identityQuaternion ? undefined : quaternion,\r\n scale: this.scale,\r\n lookAt: this.lookAt,\r\n visible: this.visible,\r\n shadow: this.shadow,\r\n renderOrder: this.renderOrder,\r\n };\r\n }\r\n\r\n /**\r\n * The coordinates `child`'s `x`/`y`/`z` are in, or `null` (the default) when\r\n * they are this node's local space. A `null` child is one not here yet.\r\n */\r\n /** @internal */\r\n _spaceOf(_child: Node3D | null): ChildSpace3D | null {\r\n return null;\r\n }\r\n\r\n /**\r\n * The transform that goes on this node's *group* — the scope its children\r\n * nest inside. Defaults to this node's own placement, which is right for\r\n * everything that lives at its own origin.\r\n *\r\n * A camera overrides it to identity and places itself instead: three aims a\r\n * camera's -Z at `lookAt` but a plain group's +Z, so hanging a camera's\r\n * placement on its group would point the shot backwards.\r\n */\r\n protected groupTransform(): Transform3D {\r\n return this.transform3D();\r\n }\r\n\r\n /**\r\n * Draw this node's own contribution to the scene — a `ctx.draw(graphics3D)`\r\n * for something with geometry, a `ctx.light(...)` for a light, nothing at all\r\n * for a plain {@link Group3D}. Children are recorded after it, nested inside\r\n * this node's transform.\r\n */\r\n protected renderSelf(ctx: RenderContext3D): void { }\r\n\r\n /**\r\n * Record this node and its subtree into `ctx`.\r\n *\r\n * An invisible node still opens its scope: `visible: false` is a renderer-side\r\n * flag on a live object rather than a removal, which is what lets a node be\r\n * hidden and shown again without its GPU resources being rebuilt. Skipping the\r\n * walk here would instead sweep the whole subtree out of the cache.\r\n */\r\n render(ctx: RenderContext3D): void {\r\n // The editor's flag folds into `visible` rather than adding a second one:\r\n // the 3D side already has exactly this concept, honoured by the picking\r\n // walk, and two flags meaning \"do not show this\" would be two places to\r\n // ask. Still opens its scope — see the note above on why an invisible\r\n // node keeps its cached renderer object.\r\n if (this.hidden) {\r\n ctx.begin({ id: this.id, transform: { ...this.groupTransform(), visible: false } });\r\n ctx.end();\r\n return;\r\n }\r\n ctx.begin({ id: this.id, transform: this.groupTransform() });\r\n this.renderSelf(ctx);\r\n for (const child of this._children) {\r\n if (child instanceof Node3D) child.render(ctx);\r\n }\r\n ctx.end();\r\n }\r\n\r\n /**\r\n * What {@link renderSelf} records, never {@link render}: the placement lives on\r\n * the group scope, so moving a node does not change what it declares.\r\n */\r\n declareAssets(assets: AssetScope): void {\r\n if (this.renderSelf === Node3D.prototype.renderSelf) return;\r\n const scene = new Scene3D();\r\n this.renderSelf(scene);\r\n declare3DResources(scene, assets);\r\n }\r\n}\r\n\r\n/**\r\n * Expand `position`/`rotation`/`scale` in a prop bag into their axis props.\r\n *\r\n * Returns the bag untouched when it names none of them, so the common write path\r\n * allocates nothing. A **binding** expands into three bindings that each resolve\r\n * the vector and take one component — so `position={() => lift()}` stays a\r\n * binding, and one thunk driving all three axes is still read once per axis per\r\n * frame rather than being frozen at bind time.\r\n */\r\nfunction distributeVectors<T extends object>(props: T | undefined): T | undefined {\r\n if (!props) return props;\r\n\r\n let out: Record<string, unknown> | undefined;\r\n\r\n for (const key in VECTOR_SUGAR) {\r\n const value = (props as Record<string, unknown>)[key];\r\n if (value === undefined) continue;\r\n\r\n out ??= { ...(props as Record<string, unknown>) };\r\n delete out[key];\r\n\r\n const axes = VECTOR_SUGAR[key];\r\n\r\n if (typeof value === \"function\") {\r\n const read = value as () => Vector3Input;\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] !== undefined) continue;\r\n out[axis] = () => componentOf(resolveVector3(read()), i);\r\n }\r\n continue;\r\n }\r\n\r\n const vector = resolveVector3(value as Vector3Input);\r\n for (let i = 0; i < 3; i++) {\r\n const axis = axes[i];\r\n if (out[axis] === undefined) out[axis] = componentOf(vector, i);\r\n }\r\n\r\n // `order` rides on an Euler and has nowhere else to go.\r\n if (key === \"rotation\") {\r\n const order = (value as Euler3).order;\r\n if (order !== undefined && out.rotationOrder === undefined) out.rotationOrder = order;\r\n }\r\n }\r\n\r\n return (out as T) ?? props;\r\n}\r\n\r\n/** `data` without the keys left unstated, so a tween never aims an axis at `undefined`. */\r\nfunction stated<T extends object>(data: T | undefined): Partial<T> {\r\n const out: Partial<T> = {};\r\n for (const key in data) if (data[key] !== undefined) out[key] = data[key];\r\n return out;\r\n}\r\n\r\nfunction componentOf(vector: Vector3, index: number): number {\r\n return index === 0 ? vector.x : index === 1 ? vector.y : vector.z;\r\n}\r\n"]}
|
|
@@ -34,10 +34,10 @@ export declare abstract class AudioSink {
|
|
|
34
34
|
*/
|
|
35
35
|
abstract schedule(requests: readonly AudioRequest[]): void;
|
|
36
36
|
/**
|
|
37
|
-
* Start/stop scheduled sources to match `
|
|
37
|
+
* Start/stop scheduled sources to match `clipTime`. Called every tick.
|
|
38
38
|
* Sources whose data has not yet been appended are skipped until it is.
|
|
39
39
|
*/
|
|
40
|
-
abstract syncTo(
|
|
40
|
+
abstract syncTo(clipTime: number): void;
|
|
41
41
|
abstract play(time: number, speed: number, reverse: boolean): void | Promise<void>;
|
|
42
42
|
abstract stop(): void;
|
|
43
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-sink.d.ts","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D;;;;;;;GAOG;AACH,8BAAsB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAElC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9D,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;IAEhD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI;IAE1D;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"audio-sink.d.ts","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D;;;;;;;GAOG;AACH,8BAAsB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAElC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9D,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;IAEhD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI;IAE1D;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEvC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAClF,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAE9B;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAE/B,OAAO,IAAI,IAAI;CAGlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-sink.js","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IA8BD;;;OAGG;IACH,QAAQ,CAAC,KAAc,IAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAc,IAAS,CAAC;IAElC,OAAO;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { AudioRequest } from \"@/attributes/audio/request\";\n\n\n/**\n * Stackable audio player driven by the AssetManager.\n *\n * The AssetManager decides which audio data is needed within the current\n * look-ahead window and pushes it in via {@link append}; the device caches the\n * decoded form, schedules the matching {@link AudioRequest}s via\n * {@link schedule}, and drives playback through {@link syncTo} on each tick.\n */\nexport abstract class AudioSink {\n /**\n * Whether pushing the audio working set to this device does anything at all.\n *\n * False for a sink that discards everything — an export, whose audio is mixed\n * offline in a single pass at the end. `AssetManager.syncAudio` runs on every\n * frame and rebuilds a `Set`, a per-request id string and a sorted signature\n * each time; against such a device every one of those calls lands on a no-op,\n * so the work is skipped rather than done and thrown away.\n */\n get schedulesAudio(): boolean {\n return true;\n }\n\n /** True if decoded data for `src` is already cached on the device. */\n abstract has(src: string): boolean;\n\n /**\n * Decode and stack `data` under `src`. Idempotent — repeat calls for an\n * already-cached `src` are no-ops.\n */\n abstract append(src: string, data: ArrayBuffer): Promise<void>;\n\n /** Drop cached audio data (and any active sources) for srcs not in `keep`. */\n abstract retain(keep: ReadonlySet<string>): void;\n\n /**\n * Set the working set of audio requests for the current look-ahead window.\n * Requests no longer present are stopped; new ones become eligible for\n * playback via {@link syncTo} as soon as their data is appended.\n */\n abstract schedule(requests: readonly AudioRequest[]): void;\n\n /**\n * Start/stop scheduled sources to match `
|
|
1
|
+
{"version":3,"file":"audio-sink.js","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IA8BD;;;OAGG;IACH,QAAQ,CAAC,KAAc,IAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAc,IAAS,CAAC;IAElC,OAAO;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { AudioRequest } from \"@/attributes/audio/request\";\r\n\r\n\r\n/**\r\n * Stackable audio player driven by the AssetManager.\r\n *\r\n * The AssetManager decides which audio data is needed within the current\r\n * look-ahead window and pushes it in via {@link append}; the device caches the\r\n * decoded form, schedules the matching {@link AudioRequest}s via\r\n * {@link schedule}, and drives playback through {@link syncTo} on each tick.\r\n */\r\nexport abstract class AudioSink {\r\n /**\r\n * Whether pushing the audio working set to this device does anything at all.\r\n *\r\n * False for a sink that discards everything — an export, whose audio is mixed\r\n * offline in a single pass at the end. `AssetManager.syncAudio` runs on every\r\n * frame and rebuilds a `Set`, a per-request id string and a sorted signature\r\n * each time; against such a device every one of those calls lands on a no-op,\r\n * so the work is skipped rather than done and thrown away.\r\n */\r\n get schedulesAudio(): boolean {\r\n return true;\r\n }\r\n\r\n /** True if decoded data for `src` is already cached on the device. */\r\n abstract has(src: string): boolean;\r\n\r\n /**\r\n * Decode and stack `data` under `src`. Idempotent — repeat calls for an\r\n * already-cached `src` are no-ops.\r\n */\r\n abstract append(src: string, data: ArrayBuffer): Promise<void>;\r\n\r\n /** Drop cached audio data (and any active sources) for srcs not in `keep`. */\r\n abstract retain(keep: ReadonlySet<string>): void;\r\n\r\n /**\r\n * Set the working set of audio requests for the current look-ahead window.\r\n * Requests no longer present are stopped; new ones become eligible for\r\n * playback via {@link syncTo} as soon as their data is appended.\r\n */\r\n abstract schedule(requests: readonly AudioRequest[]): void;\r\n\r\n /**\r\n * Start/stop scheduled sources to match `clipTime`. Called every tick.\r\n * Sources whose data has not yet been appended are skipped until it is.\r\n */\r\n abstract syncTo(clipTime: number): void;\r\n\r\n abstract play(time: number, speed: number, reverse: boolean): void | Promise<void>;\r\n abstract stop(): void;\r\n\r\n /**\r\n * Mute or unmute all output. Default is a no-op for devices that produce no\r\n * sound (e.g. export/noop sinks).\r\n */\r\n setMuted(muted: boolean): void {}\r\n\r\n /**\r\n * Set the linear gain applied to all output, on top of each request's own\r\n * `volume`. Independent of {@link setMuted} — unmuting restores this level\r\n * rather than resetting to 1, so a host can hold a volume slider and a mute\r\n * button without the two clobbering each other.\r\n *\r\n * Default is a no-op, as for {@link setMuted}.\r\n */\r\n setVolume(volume: number): void {}\r\n\r\n dispose(): void {\r\n this.stop();\r\n }\r\n}\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AssetManifest } from "../assets/manifest.js";
|
|
2
2
|
import type { ProjectDocument } from "../document/project.js";
|
|
3
3
|
import type { Registry } from "../document/registry.js";
|
|
4
|
+
import type { FrameSpec } from "../runtime/frame-time.js";
|
|
4
5
|
/**
|
|
5
6
|
* Encoding settings, passed through to whatever the platform's exporter uses.
|
|
6
7
|
*
|
|
@@ -8,6 +9,11 @@ import type { Registry } from "../document/registry.js";
|
|
|
8
9
|
* backend might take: `core` has no opinion about encoders.
|
|
9
10
|
*/
|
|
10
11
|
export type EncodeOptions = Record<string, unknown>;
|
|
12
|
+
/** A run of project frames: `start` included, `end` not. */
|
|
13
|
+
export interface FrameRange {
|
|
14
|
+
start: number;
|
|
15
|
+
end: number;
|
|
16
|
+
}
|
|
11
17
|
/** What an {@link Exporter} needs to encode a timeline. */
|
|
12
18
|
export interface ExportVideoRequest {
|
|
13
19
|
/** The project, its fps and viewport resolved — see `Session.document`. Carries its theme. */
|
|
@@ -18,6 +24,12 @@ export interface ExportVideoRequest {
|
|
|
18
24
|
scale?: number;
|
|
19
25
|
manifest?: AssetManifest;
|
|
20
26
|
includeAudio?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Encode only these frames, as a file of their own that starts at 0. It is
|
|
29
|
+
* always silent: a range is one segment of a split export, whose audio is
|
|
30
|
+
* mixed once over the whole timeline.
|
|
31
|
+
*/
|
|
32
|
+
frames?: FrameRange;
|
|
21
33
|
/** Progress through the export, in `[0, 1]`. */
|
|
22
34
|
onProgress?: (progress: number) => void;
|
|
23
35
|
signal?: AbortSignal;
|
|
@@ -27,14 +39,7 @@ export interface ExportVideoRequest {
|
|
|
27
39
|
export interface ExportStillRequest {
|
|
28
40
|
project: ProjectDocument;
|
|
29
41
|
registry: Registry;
|
|
30
|
-
frame:
|
|
31
|
-
kind: "frame";
|
|
32
|
-
frame: number;
|
|
33
|
-
} | {
|
|
34
|
-
kind: "first";
|
|
35
|
-
} | {
|
|
36
|
-
kind: "last";
|
|
37
|
-
};
|
|
42
|
+
frame: FrameSpec;
|
|
38
43
|
scale?: number;
|
|
39
44
|
manifest?: AssetManifest;
|
|
40
45
|
format?: "png" | "jpeg";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;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","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"","sourcesContent":["import { AssetManifest } from \"@/assets/manifest\";\nimport type { ProjectDocument } from \"@/document/project\";\nimport type { Registry } from \"@/document/registry\";\n\n/**\n * Encoding settings, passed through to whatever the platform's exporter uses.\n *\n * Deliberately `unknown`-shaped rather than a union of every codec option each\n * backend might take: `core` has no opinion about encoders.\n */\nexport type EncodeOptions = Record<string, unknown>;\n\n/** What an {@link Exporter} needs to encode a timeline. */\nexport interface ExportVideoRequest {\n /** The project, its fps and viewport resolved — see `Session.document`. Carries its theme. */\n project: ProjectDocument;\n /** The vocabulary its clips compile against: the opening engine's. */\n registry: Registry;\n /** Resolution multiplier on the viewport. Default 1. */\n scale?: number;\n manifest?: AssetManifest;\n includeAudio?: boolean;\n /** Progress through the export, in `[0, 1]`. */\n onProgress?: (progress: number) => void;\n signal?: AbortSignal;\n encode?: EncodeOptions;\n}\n\n/** What an {@link Exporter} needs to encode one frame. */\nexport interface ExportStillRequest {\n project: ProjectDocument;\n registry: Registry;\n frame:
|
|
1
|
+
{"version":3,"file":"exporter.js","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"","sourcesContent":["import { AssetManifest } from \"@/assets/manifest\";\r\nimport type { ProjectDocument } from \"@/document/project\";\r\nimport type { Registry } from \"@/document/registry\";\r\nimport type { FrameSpec } from \"@/runtime/frame-time\";\r\n\r\n/**\r\n * Encoding settings, passed through to whatever the platform's exporter uses.\r\n *\r\n * Deliberately `unknown`-shaped rather than a union of every codec option each\r\n * backend might take: `core` has no opinion about encoders.\r\n */\r\nexport type EncodeOptions = Record<string, unknown>;\r\n\r\n/** A run of project frames: `start` included, `end` not. */\r\nexport interface FrameRange {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/** What an {@link Exporter} needs to encode a timeline. */\r\nexport interface ExportVideoRequest {\r\n /** The project, its fps and viewport resolved — see `Session.document`. Carries its theme. */\r\n project: ProjectDocument;\r\n /** The vocabulary its clips compile against: the opening engine's. */\r\n registry: Registry;\r\n /** Resolution multiplier on the viewport. Default 1. */\r\n scale?: number;\r\n manifest?: AssetManifest;\r\n includeAudio?: boolean;\r\n /**\r\n * Encode only these frames, as a file of their own that starts at 0. It is\r\n * always silent: a range is one segment of a split export, whose audio is\r\n * mixed once over the whole timeline.\r\n */\r\n frames?: FrameRange;\r\n /** Progress through the export, in `[0, 1]`. */\r\n onProgress?: (progress: number) => void;\r\n signal?: AbortSignal;\r\n encode?: EncodeOptions;\r\n}\r\n\r\n/** What an {@link Exporter} needs to encode one frame. */\r\nexport interface ExportStillRequest {\r\n project: ProjectDocument;\r\n registry: Registry;\r\n frame: FrameSpec;\r\n scale?: number;\r\n manifest?: AssetManifest;\r\n format?: \"png\" | \"jpeg\";\r\n quality?: number;\r\n signal?: AbortSignal;\r\n}\r\n\r\nexport interface ExportedStill {\r\n bytes: Uint8Array;\r\n /** The frame actually captured — the request clamped into range. */\r\n frame: number;\r\n totalFrames: number;\r\n}\r\n\r\n/**\r\n * How a `Session` turns itself into bytes.\r\n *\r\n * A **port**: `core` declares it, a platform implements it, and the dependency\r\n * runs platform → core like every other seam here — which is what lets\r\n * `Session.export()` exist in `core` without importing anything that encodes.\r\n */\r\nexport interface Exporter {\r\n exportVideo(request: ExportVideoRequest): Promise<Uint8Array | void>;\r\n exportStill(request: ExportStillRequest): Promise<ExportedStill>;\r\n}\r\n"]}
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
/** @internal */ export { AudioSink } from './audio-sink.js';
|
|
3
3
|
/** @internal */ export { StorageAdapter, type DecodePolicy } from './storage-adapter.js';
|
|
4
4
|
/** @internal */ export { SteppedClock } from './stepped-clock.js';
|
|
5
|
-
export type { Exporter, ExportVideoRequest, ExportStillRequest, ExportedStill, EncodeOptions, } from './exporter.js';
|
|
5
|
+
export type { Exporter, ExportVideoRequest, ExportStillRequest, ExportedStill, EncodeOptions, FrameRange, } from './exporter.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,YAAY,EACR,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,YAAY,EACR,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,UAAU,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/** @internal */ export { Ticker } from './ticker';\n/** @internal */ export { AudioSink } from './audio-sink';\n/** @internal */ export { StorageAdapter, type DecodePolicy } from './storage-adapter';\n/** @internal */ export { SteppedClock } from './stepped-clock';\nexport type {\n Exporter,\n ExportVideoRequest,\n ExportStillRequest,\n ExportedStill,\n EncodeOptions,\n} from './exporter';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/** @internal */ export { Ticker } from './ticker';\r\n/** @internal */ export { AudioSink } from './audio-sink';\r\n/** @internal */ export { StorageAdapter, type DecodePolicy } from './storage-adapter';\r\n/** @internal */ export { SteppedClock } from './stepped-clock';\r\nexport type {\r\n Exporter,\r\n ExportVideoRequest,\r\n ExportStillRequest,\r\n ExportedStill,\r\n EncodeOptions,\r\n FrameRange,\r\n} from './exporter';\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepped-clock.js","sourceRoot":"","sources":["../../src/platform/stepped-clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IACpC,IAAI,CAAC,CAAS;QACV,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Ticker } from \"./ticker\";\n\n/**\n * A clock with no wall clock behind it: the playhead is wherever it was last put.\n *\n * What a headless session runs on. `PlaybackController` needs *a* clock to seek\n * against, but an export has no realtime to sync to — and must not have one,\n * because a wall-clock export drifts. So the platform reports `null` from\n * `createTicker` to say \"no realtime transport here\", and a session stands\n * this in so everything that is not transport — seeking, node picking, reading a\n * node's box, drawing a frame — works exactly as it does in a browser.\n *\n * `play()` is deliberately not overridden into a no-op: nothing reaches it,\n * because a session with no realtime clock exposes `playback === null` and there\n * is no other route to it.\n *\n * @internal\n */\nexport class SteppedClock extends Ticker {\n seek(t: number): void {\n this.setCurrentTime(t);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stepped-clock.js","sourceRoot":"","sources":["../../src/platform/stepped-clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IACpC,IAAI,CAAC,CAAS;QACV,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Ticker } from \"./ticker\";\r\n\r\n/**\r\n * A clock with no wall clock behind it: the playhead is wherever it was last put.\r\n *\r\n * What a headless session runs on. `PlaybackController` needs *a* clock to seek\r\n * against, but an export has no realtime to sync to — and must not have one,\r\n * because a wall-clock export drifts. So the platform reports `null` from\r\n * `createTicker` to say \"no realtime transport here\", and a session stands\r\n * this in so everything that is not transport — seeking, node picking, reading a\r\n * node's box, drawing a frame — works exactly as it does in a browser.\r\n *\r\n * `play()` is deliberately not overridden into a no-op: nothing reaches it,\r\n * because a session with no realtime clock exposes `playback === null` and there\r\n * is no other route to it.\r\n *\r\n * @internal\r\n */\r\nexport class SteppedClock extends Ticker {\r\n seek(t: number): void {\r\n this.setCurrentTime(t);\r\n }\r\n}\r\n"]}
|
|
@@ -2,12 +2,16 @@ import { AssetCatalog } from "../assets/catalog.js";
|
|
|
2
2
|
import { AssetRecord } from "../assets/record.js";
|
|
3
3
|
import { Size2D } from "../attributes/layout/size.js";
|
|
4
4
|
/**
|
|
5
|
-
* How an adapter picks the resolution to decode media at
|
|
5
|
+
* How an adapter picks the resolution to decode media at, and how strict it is
|
|
6
|
+
* about what it cannot load.
|
|
6
7
|
*
|
|
7
8
|
* `"exact"` — export, stills, screenshots: the level follows the current draw
|
|
8
9
|
* alone, so a frame is the same pixels whatever was drawn before it on a reused
|
|
9
|
-
* adapter
|
|
10
|
-
*
|
|
10
|
+
* adapter, and a font family the manifest cannot describe is refused rather
|
|
11
|
+
* than shaped against the fallback face. `"interactive"` — preview: reuse
|
|
12
|
+
* whatever resident level is already good enough, and upgrade in the
|
|
13
|
+
* background; an undescribed family draws in the fallback face until a manifest
|
|
14
|
+
* describes it.
|
|
11
15
|
*/
|
|
12
16
|
export type DecodePolicy = "exact" | "interactive";
|
|
13
17
|
export declare abstract class StorageAdapter {
|
|
@@ -53,9 +57,11 @@ export declare abstract class StorageAdapter {
|
|
|
53
57
|
* Register every face of `fontFamily` the catalog describes.
|
|
54
58
|
*
|
|
55
59
|
* Returns whether the family was actually loaded. `false` means the manifest
|
|
56
|
-
* has no entry for it
|
|
57
|
-
* the platform fallback, which is what a system font name
|
|
58
|
-
*
|
|
60
|
+
* has no entry for it. Not an error while previewing (an undescribed family
|
|
61
|
+
* shapes against the platform fallback, which is what a system font name
|
|
62
|
+
* does), but a blocking caller refuses it — see {@link DecodePolicy} — and
|
|
63
|
+
* it must not be remembered as handled either way: see the note in
|
|
64
|
+
* {@link runLoad}.
|
|
59
65
|
*/
|
|
60
66
|
abstract loadFont(src: string, fontFamily: string, fontWeight: number): Promise<boolean>;
|
|
61
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../../src/platform/storage-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"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EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAChB,QAAQ,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1D;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxF;;;;;;;OAOG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI1C,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAI3C,qEAAqE;IACrE,eAAe,IAAI,YAAY;IAI/B,gGAAgG;IAChG,iBAAiB,IAAI,OAAO;IAI5B;;;;;;;;OAQG;IACG,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI5C;;;;OAIG;IACH,kBAAkB,IAAI,OAAO;IAI7B,iFAAiF;IAC3E,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAI7C;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAMlC,OAAO,IAAI,IAAI;CAIlB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssetNotLoadedError } from "../assets/errors.js";
|
|
1
2
|
export class StorageAdapter {
|
|
2
3
|
catalog;
|
|
3
4
|
viewport;
|
|
@@ -61,6 +62,9 @@ export class StorageAdapter {
|
|
|
61
62
|
case 'font': {
|
|
62
63
|
const { fontFamily, fontWeight } = this.parseFontKey(key);
|
|
63
64
|
loaded = await this.loadFont(key, fontFamily, fontWeight);
|
|
65
|
+
if (!loaded && this.getDecodePolicy() === "exact") {
|
|
66
|
+
throw new AssetNotLoadedError("font", fontFamily, `The manifest has no font entry for "${fontFamily}", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`);
|
|
67
|
+
}
|
|
64
68
|
break;
|
|
65
69
|
}
|
|
66
70
|
case 'audio':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-adapter.js","sourceRoot":"","sources":["../../src/platform/storage-adapter.ts"],"names":[],"mappings":"AAcA,MAAM,OAAgB,cAAc;IACtB,OAAO,CAAe;IACtB,QAAQ,CAAS;IAC3B,YAAY,OAAqB,EAAE,QAAgB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAqB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IACD;;;;OAIG;IACO,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC3D,uEAAuE;IAC7D,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,6EAA6E;IAE7E,4DAA4D;IAC5D,QAAQ,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAW,EAAE,KAAkB;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC9B,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC;YACD,MAAM,GAAG,CAAC;QACd,CAAC;gBAAS,CAAC;Y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IAED,6EAA6E;IAEnE,YAAY,CAAC,GAAW;QAC9B,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7D,OAAO;YACH,UAAU,EAAE,UAAU,IAAI,GAAG;YAC7B,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU;SACnD,CAAC;IACN,CAAC;IA+BD,6EAA6E;IAE7E;;;;;;;OAOG;IACH,KAAK,CAAC,gBAAgB;QAClB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,eAAe,CAAC,MAAoB;QAChC,mDAAmD;IACvD,CAAC;IAED,qEAAqE;IACrE,eAAe;QACX,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,gGAAgG;IAChG,iBAAiB;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,kBAAkB;QACpB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,kBAAkB;QACd,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,mBAAmB;QACrB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAgB;QACvB,gDAAgD;IACpD,CAAC;IAED,6EAA6E;IAE7E,OAAO;QACH,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import { AssetCatalog } from \"@/assets/catalog\";\nimport { AssetRecord } from \"@/assets/record\";\nimport { Size2D } from \"@/attributes/layout/size\";\n\n/**\n * How an adapter picks the resolution to decode media at.\n *\n * `\"exact\"` — export, stills, screenshots: the level follows the current draw\n * alone, so a frame is the same pixels whatever was drawn before it on a reused\n * adapter. `\"interactive\"` — preview: reuse whatever resident level is already\n * good enough, and upgrade in the background.\n */\nexport type DecodePolicy = \"exact\" | \"interactive\";\n\nexport abstract class StorageAdapter {\n protected catalog: AssetCatalog;\n protected viewport: Size2D;\n constructor(catalog: AssetCatalog, viewport: Size2D) {\n this.catalog = catalog;\n this.viewport = viewport;\n }\n\n /**\n * Point the adapter at a different asset catalog, keeping every decode it has\n * already cached.\n *\n * Safe because the catalog supplies *metadata* (durations, intrinsic sizes)\n * while the caches are keyed by source URL: a src the new catalog drops leaves\n * an orphaned decode, and a src it adds simply isn't cached yet. Neither is a\n * correctness problem, which is what lets a long-lived renderer take an\n * updated manifest without paying to re-decode everything still in use.\n *\n * The viewport has no such setter; a host that changes output size rebuilds\n * the adapter.\n */\n setCatalog(catalog: AssetCatalog): void {\n this.catalog = catalog;\n }\n /**\n * Every asset src whose loadXxx is currently in flight, mapped to its\n * pending promise. The render path awaits these to guarantee no draw\n * happens while a load is still resolving. Cleared on completion.\n */\n protected inFlightLoads = new Map<string, Promise<void>>();\n /** Keys of assets that have been fully loaded and are ready to use. */\n protected cachedAssets = new Set<string>();\n\n // ─── Asset loading dispatch ───────────────────────────────────────────────\n\n /** Whether `key` has finished loading and is usable now. */\n isLoaded(key: string): boolean {\n return this.cachedAssets.has(key);\n }\n\n async loadAsset(key: string, value: AssetRecord): Promise<void> {\n const existing = this.inFlightLoads.get(key);\n if (existing) return existing;\n if (this.cachedAssets.has(key)) return;\n\n const job = this.runLoad(key, value);\n this.inFlightLoads.set(key, job);\n try {\n await job;\n } finally {\n this.inFlightLoads.delete(key);\n }\n }\n\n private async runLoad(key: string, value: AssetRecord): Promise<void> {\n let loaded = true;\n switch (value.type) {\n case 'image':\n await this.loadImage(key);\n break;\n case 'video':\n await this.loadVideo(key, value.startFrame, value.endFrame, value.trimStart, value.trimEnd);\n break;\n case 'font': {\n const { fontFamily, fontWeight } = this.parseFontKey(key);\n loaded = await this.loadFont(key, fontFamily, fontWeight);\n break;\n }\n case 'audio':\n // Audio files are loaded on-demand via fetchAudioData / syncAudio, not through loadAsset.\n break;\n case 'loader':\n // Loaders are opaque callbacks run directly by the AssetManager and\n // never dispatched through the storage adapter.\n throw new Error(\"Loader records must not be routed through StorageAdapter.loadAsset\");\n default: {\n const _exhaustive: never = value;\n throw new Error(`Unsupported asset type: ${(_exhaustive as AssetRecord).type}`);\n }\n }\n\n // Only a load that actually happened is cached. This matters for exactly\n // one case: a font family the manifest cannot describe. Caching it anyway\n // marked the family handled for the life of this adapter, so a manifest\n // that *later* described it — which is what installing a typeface does,\n // folded into the live manifest without rebuilding the controller — could\n // never load it, and the text stayed in the fallback face until something\n // else tore the adapter down.\n if (loaded) this.cachedAssets.add(key);\n }\n\n // ─── Font key parsing ─────────────────────────────────────────────────────\n\n protected parseFontKey(key: string): { fontFamily: string; fontWeight: number } {\n const [fontFamily, weightStr] = key.split('@');\n const fontWeight = weightStr ? parseInt(weightStr, 10) : 400;\n return {\n fontFamily: fontFamily || key,\n fontWeight: isNaN(fontWeight) ? 400 : fontWeight,\n };\n }\n\n // ─── Abstract load methods ────────────────────────────────────────────────\n\n /** Decode resolution follows the draw, so a load names only the source. */\n abstract loadImage(src: string): Promise<void>;\n abstract loadVideo(\n src: string,\n startFrame: number,\n endFrame: number,\n trimStart: number,\n trimEnd?: number,\n ): Promise<void>;\n abstract loadAudio(\n src: string,\n startFrame: number,\n endFrame: number,\n trimStart: number,\n trimEnd?: number,\n ): Promise<void>;\n abstract fetchAudioData(src: string): Promise<ArrayBuffer>;\n /**\n * Register every face of `fontFamily` the catalog describes.\n *\n * Returns whether the family was actually loaded. `false` means the manifest\n * has no entry for it — not an error (an undescribed family shapes against\n * the platform fallback, which is what a system font name does), but it must\n * not be remembered as handled: see the note in {@link runLoad}.\n */\n abstract loadFont(src: string, fontFamily: string, fontWeight: number): Promise<boolean>;\n\n // ─── Frame warming ────────────────────────────────────────────────────────\n\n /**\n * Decode any exact media frames the most recent render asked for but couldn't\n * satisfy synchronously (e.g. a video frame at a freshly-seeked timestamp),\n * and report whether there were any. A blocking caller (seek / screenshot /\n * export) renders once, awaits this, and re-renders while it returns true so\n * the frame is accurate even on a cold jump. Defaults to a no-op for adapters\n * with no time-varying media.\n */\n async warmPendingVideo(): Promise<boolean> {\n return false;\n }\n\n setDecodePolicy(policy: DecodePolicy): void {\n // no-op for adapters that decode at one resolution\n }\n\n /** Read back so a caller that borrows the adapter can restore it. */\n getDecodePolicy(): DecodePolicy {\n return \"interactive\";\n }\n\n /** Whether the most recent render left decodes that {@link warmPendingDecodes} would settle. */\n hasPendingDecodes(): boolean {\n return false;\n }\n\n /**\n * Settle what the last render could not draw acceptably under the current\n * policy — video frames, every exact image level under `\"exact\"`, a source\n * drawn with nothing resident under `\"interactive\"` — and report whether there\n * was any. See `renderSettled`.\n *\n * Defaults to {@link warmPendingVideo} so an adapter written against it keeps\n * working; that alias goes away after one release.\n */\n async warmPendingDecodes(): Promise<boolean> {\n return this.warmPendingVideo();\n }\n\n /**\n * Whether an `\"interactive\"` decode is on its way that would draw the last\n * render sharper. Not something a paint waits for: a preview shows what is\n * resident and repaints when {@link warmPendingUpgrades} reports a landing.\n */\n hasPendingUpgrades(): boolean {\n return false;\n }\n\n /** Await the upgrades {@link hasPendingUpgrades} reports; whether one landed. */\n async warmPendingUpgrades(): Promise<boolean> {\n return false;\n }\n\n /**\n * Notify the adapter whether playback is live. Time-varying media (video) uses\n * this to prefetch ahead only while playing and to quiesce on pause, so a\n * paused timeline doesn't drain a backlog of stale decodes. No-op by default.\n */\n setPlaying(playing: boolean): void {\n // no-op for adapters with no time-varying media\n }\n\n // ─── Lifecycle ────────────────────────────────────────────────────────────\n\n dispose(): void {\n this.inFlightLoads.clear();\n this.cachedAssets.clear();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"storage-adapter.js","sourceRo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\nimport { AssetNotLoadedError } from \"@/assets/errors\";\r\nimport { AssetRecord } from \"@/assets/record\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * How an adapter picks the resolution to decode media at, and how strict it is\r\n * about what it cannot load.\r\n *\r\n * `\"exact\"` — export, stills, screenshots: the level follows the current draw\r\n * alone, so a frame is the same pixels whatever was drawn before it on a reused\r\n * adapter, and a font family the manifest cannot describe is refused rather\r\n * than shaped against the fallback face. `\"interactive\"` — preview: reuse\r\n * whatever resident level is already good enough, and upgrade in the\r\n * background; an undescribed family draws in the fallback face until a manifest\r\n * describes it.\r\n */\r\nexport type DecodePolicy = \"exact\" | \"interactive\";\r\n\r\nexport abstract class StorageAdapter {\r\n protected catalog: AssetCatalog;\r\n protected viewport: Size2D;\r\n constructor(catalog: AssetCatalog, viewport: Size2D) {\r\n this.catalog = catalog;\r\n this.viewport = viewport;\r\n }\r\n\r\n /**\r\n * Point the adapter at a different asset catalog, keeping every decode it has\r\n * already cached.\r\n *\r\n * Safe because the catalog supplies *metadata* (durations, intrinsic sizes)\r\n * while the caches are keyed by source URL: a src the new catalog drops leaves\r\n * an orphaned decode, and a src it adds simply isn't cached yet. Neither is a\r\n * correctness problem, which is what lets a long-lived renderer take an\r\n * updated manifest without paying to re-decode everything still in use.\r\n *\r\n * The viewport has no such setter; a host that changes output size rebuilds\r\n * the adapter.\r\n */\r\n setCatalog(catalog: AssetCatalog): void {\r\n this.catalog = catalog;\r\n }\r\n /**\r\n * Every asset src whose loadXxx is currently in flight, mapped to its\r\n * pending promise. The render path awaits these to guarantee no draw\r\n * happens while a load is still resolving. Cleared on completion.\r\n */\r\n protected inFlightLoads = new Map<string, Promise<void>>();\r\n /** Keys of assets that have been fully loaded and are ready to use. */\r\n protected cachedAssets = new Set<string>();\r\n\r\n // ─── Asset loading dispatch ───────────────────────────────────────────────\r\n\r\n /** Whether `key` has finished loading and is usable now. */\r\n isLoaded(key: string): boolean {\r\n return this.cachedAssets.has(key);\r\n }\r\n\r\n async loadAsset(key: string, value: AssetRecord): Promise<void> {\r\n const existing = this.inFlightLoads.get(key);\r\n if (existing) return existing;\r\n if (this.cachedAssets.has(key)) return;\r\n\r\n const job = this.runLoad(key, value);\r\n this.inFlightLoads.set(key, job);\r\n try {\r\n await job;\r\n } finally {\r\n this.inFlightLoads.delete(key);\r\n }\r\n }\r\n\r\n private async runLoad(key: string, value: AssetRecord): Promise<void> {\r\n let loaded = true;\r\n switch (value.type) {\r\n case 'image':\r\n await this.loadImage(key);\r\n break;\r\n case 'video':\r\n await this.loadVideo(key, value.startFrame, value.endFrame, value.trimStart, value.trimEnd);\r\n break;\r\n case 'font': {\r\n const { fontFamily, fontWeight } = this.parseFontKey(key);\r\n loaded = await this.loadFont(key, fontFamily, fontWeight);\r\n if (!loaded && this.getDecodePolicy() === \"exact\") {\r\n throw new AssetNotLoadedError(\r\n \"font\",\r\n fontFamily,\r\n `The manifest has no font entry for \"${fontFamily}\", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`,\r\n );\r\n }\r\n break;\r\n }\r\n case 'audio':\r\n // Audio files are loaded on-demand via fetchAudioData / syncAudio, not through loadAsset.\r\n break;\r\n case 'loader':\r\n // Loaders are opaque callbacks run directly by the AssetManager and\r\n // never dispatched through the storage adapter.\r\n throw new Error(\"Loader records must not be routed through StorageAdapter.loadAsset\");\r\n default: {\r\n const _exhaustive: never = value;\r\n throw new Error(`Unsupported asset type: ${(_exhaustive as AssetRecord).type}`);\r\n }\r\n }\r\n\r\n // Only a load that actually happened is cached. This matters for exactly\r\n // one case: a font family the manifest cannot describe. Caching it anyway\r\n // marked the family handled for the life of this adapter, so a manifest\r\n // that *later* described it — which is what installing a typeface does,\r\n // folded into the live manifest without rebuilding the controller — could\r\n // never load it, and the text stayed in the fallback face until something\r\n // else tore the adapter down.\r\n if (loaded) this.cachedAssets.add(key);\r\n }\r\n\r\n // ─── Font key parsing ─────────────────────────────────────────────────────\r\n\r\n protected parseFontKey(key: string): { fontFamily: string; fontWeight: number } {\r\n const [fontFamily, weightStr] = key.split('@');\r\n const fontWeight = weightStr ? parseInt(weightStr, 10) : 400;\r\n return {\r\n fontFamily: fontFamily || key,\r\n fontWeight: isNaN(fontWeight) ? 400 : fontWeight,\r\n };\r\n }\r\n\r\n // ─── Abstract load methods ────────────────────────────────────────────────\r\n\r\n /** Decode resolution follows the draw, so a load names only the source. */\r\n abstract loadImage(src: string): Promise<void>;\r\n abstract loadVideo(\r\n src: string,\r\n startFrame: number,\r\n endFrame: number,\r\n trimStart: number,\r\n trimEnd?: number,\r\n ): Promise<void>;\r\n abstract loadAudio(\r\n src: string,\r\n startFrame: number,\r\n endFrame: number,\r\n trimStart: number,\r\n trimEnd?: number,\r\n ): Promise<void>;\r\n abstract fetchAudioData(src: string): Promise<ArrayBuffer>;\r\n /**\r\n * Register every face of `fontFamily` the catalog describes.\r\n *\r\n * Returns whether the family was actually loaded. `false` means the manifest\r\n * has no entry for it. Not an error while previewing (an undescribed family\r\n * shapes against the platform fallback, which is what a system font name\r\n * does), but a blocking caller refuses it — see {@link DecodePolicy} — and\r\n * it must not be remembered as handled either way: see the note in\r\n * {@link runLoad}.\r\n */\r\n abstract loadFont(src: string, fontFamily: string, fontWeight: number): Promise<boolean>;\r\n\r\n // ─── Frame warming ────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Decode any exact media frames the most recent render asked for but couldn't\r\n * satisfy synchronously (e.g. a video frame at a freshly-seeked timestamp),\r\n * and report whether there were any. A blocking caller (seek / screenshot /\r\n * export) renders once, awaits this, and re-renders while it returns true so\r\n * the frame is accurate even on a cold jump. Defaults to a no-op for adapters\r\n * with no time-varying media.\r\n */\r\n async warmPendingVideo(): Promise<boolean> {\r\n return false;\r\n }\r\n\r\n setDecodePolicy(policy: DecodePolicy): void {\r\n // no-op for adapters that decode at one resolution\r\n }\r\n\r\n /** Read back so a caller that borrows the adapter can restore it. */\r\n getDecodePolicy(): DecodePolicy {\r\n return \"interactive\";\r\n }\r\n\r\n /** Whether the most recent render left decodes that {@link warmPendingDecodes} would settle. */\r\n hasPendingDecodes(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Settle what the last render could not draw acceptably under the current\r\n * policy — video frames, every exact image level under `\"exact\"`, a source\r\n * drawn with nothing resident under `\"interactive\"` — and report whether there\r\n * was any. See `renderSettled`.\r\n *\r\n * Defaults to {@link warmPendingVideo} so an adapter written against it keeps\r\n * working; that alias goes away after one release.\r\n */\r\n async warmPendingDecodes(): Promise<boolean> {\r\n return this.warmPendingVideo();\r\n }\r\n\r\n /**\r\n * Whether an `\"interactive\"` decode is on its way that would draw the last\r\n * render sharper. Not something a paint waits for: a preview shows what is\r\n * resident and repaints when {@link warmPendingUpgrades} reports a landing.\r\n */\r\n hasPendingUpgrades(): boolean {\r\n return false;\r\n }\r\n\r\n /** Await the upgrades {@link hasPendingUpgrades} reports; whether one landed. */\r\n async warmPendingUpgrades(): Promise<boolean> {\r\n return false;\r\n }\r\n\r\n /**\r\n * Notify the adapter whether playback is live. Time-varying media (video) uses\r\n * this to prefetch ahead only while playing and to quiesce on pause, so a\r\n * paused timeline doesn't drain a backlog of stale decodes. No-op by default.\r\n */\r\n setPlaying(playing: boolean): void {\r\n // no-op for adapters with no time-varying media\r\n }\r\n\r\n // ─── Lifecycle ────────────────────────────────────────────────────────────\r\n\r\n dispose(): void {\r\n this.inFlightLoads.clear();\r\n this.cachedAssets.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -25,6 +25,12 @@ export type TimeCallback = (time: number) => void;
|
|
|
25
25
|
* 2. Register listeners via `onTick` / `onPlay` / `onPause` / `onTime`.
|
|
26
26
|
* 3. Call `play`, `pause`, or `seek` to control playback.
|
|
27
27
|
* 4. Call `dispose` when the clock is no longer needed to prevent leaks.
|
|
28
|
+
*
|
|
29
|
+
* `play`, `pause` and `seek` take effect before they return, so any order of them
|
|
30
|
+
* in one turn leaves the clock where the last one put it. A time listener or tick
|
|
31
|
+
* callback may `seek` (a host looping wraps to the start when it hears the end), and
|
|
32
|
+
* a subclass must read the end of a run again afterwards. At the end of a run it
|
|
33
|
+
* reports a final tick and pauses.
|
|
28
34
|
*/
|
|
29
35
|
export declare abstract class Ticker {
|
|
30
36
|
private _isPlaying;
|