@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
package/dist/nodes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nodes/index.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,qEAAqE;AACrE,cAAc,iBAAiB,CAAC;AAEhC,6EAA6E;AAC7E,+CAA+C;AAC/C,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nodes/index.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,qEAAqE;AACrE,cAAc,iBAAiB,CAAC;AAEhC,6EAA6E;AAC7E,+CAA+C;AAC/C,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,WAAW;AACX,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AAEtC,SAAS;AACT,cAAc,sBAAsB,CAAC;AAErC,QAAQ;AACR,cAAc,oBAAoB,CAAC;AAEnC,uDAAuD;AACvD,cAAc,SAAS,CAAC;AAExB,KAAK;AACL,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC","sourcesContent":["\r\n\r\n// The two halves of the tree: the dimension-agnostic base, and its 2D side.\r\nexport * from \"./node/node\";\r\nexport * from \"./2d/node2d\";\r\n// The paint + child-layout tier the shapes and the text nodes share.\r\nexport * from \"./2d/paint-node\";\r\nexport type { NodeTime } from \"./node/node-time\";\r\n// The per-frame subtree traversals the runtime drives. Free functions rather\r\n// than node methods — see the module docblock.\r\n/** @internal */ export { primeMotionTree, sampleTree } from \"./node/node-walk\";\r\nexport { applyEditorStates } from \"./node/node-editor-state\";\r\n\r\nexport type { NodeEditorState, NodeEditorStates } from \"./node/node-editor-state\";\r\nexport * from \"./root/canvas2d-node\";\r\nexport * from \"./layout/camera-node\";\r\nexport * from \"./layout/orbit-camera-node\";\r\nexport * from \"./geometry/boolean-node\";\r\nexport * from \"./geometry/mask-node\";\r\nexport * from \"./root/provider-node\";\r\nexport * from \"./root/theme-provider-node\";\r\nexport * from \"./text/default-text-style-node\";\r\n\r\n// Geometry\r\nexport * from \"./geometry/shape-node\";\r\nexport * from \"./geometry/rect-node\";\r\nexport * from \"./geometry/ellipse-node\";\r\nexport * from \"./geometry/path-node\";\r\nexport * from \"./geometry/polygon-node\";\r\nexport * from \"./geometry/polygram-node\";\r\nexport * from \"./geometry/bounds-shape-node\";\r\nexport * from \"./geometry/box-path-node\";\r\n// The glyph tier `Text` and `NumberNode` share — see `text/text-base.ts`.\r\nexport * from \"./text/text-base\";\r\nexport * from \"./text/richtext-node\";\r\nexport * from \"./text/text-node\";\r\nexport * from \"./text/number-node\";\r\nexport * from \"./text/text-selection\";\r\n\r\n// Layout\r\nexport * from \"./layout/rotated-box\";\r\n\r\n// Media\r\nexport * from \"./media/video-node\";\r\n\r\n// Audio — the third tree: a bus groups, a sound plays.\r\nexport * from \"./audio\";\r\n\r\n// 3D\r\nexport * from \"./three/node3d\";\r\nexport * from \"./three/group3d\";\r\nexport * from \"./three/mesh3d\";\r\nexport * from \"./three/geometry-nodes\";\r\nexport * from \"./three/drawable-nodes\";\r\nexport * from \"./three/light-nodes\";\r\nexport * from \"./three/camera-nodes\";\r\nexport * from \"./three/environment-nodes\";\r\nexport * from \"./three/canvas3d-node\";\r\n"]}
|
|
@@ -19,6 +19,11 @@ export interface CameraProps extends ShapeProps {
|
|
|
19
19
|
lookAt: Vector2;
|
|
20
20
|
/** Rotation of the camera view in degrees (clockwise). */
|
|
21
21
|
heading: number;
|
|
22
|
+
/**
|
|
23
|
+
* A node of the camera's world to keep in view, by id: the camera is aimed
|
|
24
|
+
* at its centre each frame, and {@link lookAt} becomes an offset from it.
|
|
25
|
+
*/
|
|
26
|
+
follow: string;
|
|
22
27
|
/** Corner radius in pixels — uniform, per-corner, or per-axis. */
|
|
23
28
|
cornerRadius: RectCornerRadius;
|
|
24
29
|
/** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */
|
|
@@ -41,6 +46,7 @@ export declare class Camera extends ShapeNode<CameraProps> {
|
|
|
41
46
|
lookAt: Vector2;
|
|
42
47
|
/** View rotation in degrees (default: 0). */
|
|
43
48
|
heading: number;
|
|
49
|
+
follow: string;
|
|
44
50
|
cornerRadius: RectCornerRadius;
|
|
45
51
|
cornerStyle: RectCornerStyle;
|
|
46
52
|
constructor(props: NodeConfig<Camera, CameraProps>);
|
|
@@ -67,5 +73,8 @@ export declare class Camera extends ShapeNode<CameraProps> {
|
|
|
67
73
|
_cameraScope(): CameraScope;
|
|
68
74
|
_rendersChildrenInSpace(): boolean;
|
|
69
75
|
protected renderChildren(ctx: RenderPass2D): void;
|
|
76
|
+
private _followed;
|
|
77
|
+
/** The world point at the centre of the view: `lookAt`, measured from the followed node where there is one. */
|
|
78
|
+
private _aim;
|
|
70
79
|
}
|
|
71
80
|
//# sourceMappingURL=camera-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/layout/camera-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAU,WAAW,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"camera-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/layout/camera-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAU,WAAW,EAAE,UAAU,EAAW,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM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AAC,IAAI,EAAE,WAAW,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAI1F,mEAAmE;IAEnE,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;cAM3E,aAAa,IAAI,UAAU;cAW3B,QAAQ,IAAI,IAAI;IAwB1B,YAAY,IAAI,WAAW;IAK3B,uBAAuB,IAAI,OAAO;cAIxB,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI;IAmB1D,OAAO,CAAC,SAAS,CAAuB;IAExC,+GAA+G;IAC/G,OAAO,CAAC,IAAI;CAWf"}
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Node2D } from "../../nodes/2d/node2d.js";
|
|
7
|
+
import { Node2D, frameIn } from "../../nodes/2d/node2d.js";
|
|
8
8
|
import { Graphics2D } from "../../render/graphics2d.js";
|
|
9
9
|
import { Clip } from "../../render/clip.js";
|
|
10
10
|
import { lerpVector2 } from "../../attributes/layout/vector2.js";
|
|
@@ -72,7 +72,7 @@ export class Camera extends ShapeNode {
|
|
|
72
72
|
// the camera scope (and its viewport clip) is pushed on every frame even when
|
|
73
73
|
// the transform itself is the identity.
|
|
74
74
|
_cameraScope() {
|
|
75
|
-
return { lookAt: this.
|
|
75
|
+
return { lookAt: this._aim(), zoom: this.zoom, heading: this.heading };
|
|
76
76
|
}
|
|
77
77
|
// Its world is flat, seen through its own 2D camera, whatever space the card sits in.
|
|
78
78
|
_rendersChildrenInSpace() { return false; }
|
|
@@ -84,12 +84,28 @@ export class Camera extends ShapeNode {
|
|
|
84
84
|
const h = rect?.height ?? 0;
|
|
85
85
|
const cx = rect?.x ?? 0;
|
|
86
86
|
const cy = rect?.y ?? 0;
|
|
87
|
-
ctx.beginCamera({ x: cx, y: -cy, width: w, height: h }, this.
|
|
87
|
+
ctx.beginCamera({ x: cx, y: -cy, width: w, height: h }, this._aim(), this.zoom, this.heading);
|
|
88
88
|
for (const child of this._children)
|
|
89
89
|
if (child instanceof Node2D)
|
|
90
90
|
child.render(ctx);
|
|
91
91
|
ctx.endCamera();
|
|
92
92
|
}
|
|
93
|
+
_followed = null;
|
|
94
|
+
/** The world point at the centre of the view: `lookAt`, measured from the followed node where there is one. */
|
|
95
|
+
_aim() {
|
|
96
|
+
const id = this.follow;
|
|
97
|
+
if (id === "")
|
|
98
|
+
return this.lookAt;
|
|
99
|
+
// Looked up once and kept while it is still the node named and still under this camera.
|
|
100
|
+
let node = this._followed;
|
|
101
|
+
if (!node || node.id !== id || !within(node, this))
|
|
102
|
+
node = this._followed = findBelow(this, id);
|
|
103
|
+
if (!node)
|
|
104
|
+
return this.lookAt;
|
|
105
|
+
// A camera is applied when it renders, so the node's own frame does not move with the view it drives.
|
|
106
|
+
const at = frameIn(this, node);
|
|
107
|
+
return { x: at.x + this.lookAt.x, y: at.y + this.lookAt.y };
|
|
108
|
+
}
|
|
93
109
|
}
|
|
94
110
|
__decorate([
|
|
95
111
|
property({ default: 1 })
|
|
@@ -100,6 +116,9 @@ __decorate([
|
|
|
100
116
|
__decorate([
|
|
101
117
|
property({ default: 0 })
|
|
102
118
|
], Camera.prototype, "heading", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ default: "", kind: "nodeRef", animatable: false })
|
|
121
|
+
], Camera.prototype, "follow", void 0);
|
|
103
122
|
__decorate([
|
|
104
123
|
cornerRadiusProperty()
|
|
105
124
|
], Camera.prototype, "cornerRadius", void 0);
|
|
@@ -115,4 +134,20 @@ __decorate([
|
|
|
115
134
|
__decorate([
|
|
116
135
|
command({ args: [{ key: "heading", kind: "number", step: 1, unit: "°" }] })
|
|
117
136
|
], Camera.prototype, "headingTo", null);
|
|
137
|
+
function within(node, ancestor) {
|
|
138
|
+
for (let at = node.parent; at; at = at.parent)
|
|
139
|
+
if (at === ancestor)
|
|
140
|
+
return true;
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
function findBelow(at, id) {
|
|
144
|
+
for (const child of at._allChildren) {
|
|
145
|
+
if (child.id === id)
|
|
146
|
+
return child instanceof Node2D ? child : null;
|
|
147
|
+
const found = findBelow(child, id);
|
|
148
|
+
if (found)
|
|
149
|
+
return found;
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
118
153
|
//# sourceMappingURL=camera-node.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-node.js","sourceRoot":"","sources":["../../../src/nodes/layout/camera-node.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,MAAM,EAA4B,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,WAAW,EAAW,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAc,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAoBpD;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAO,SAAQ,SAAsB;IAc9C,YAAY,KAAsC;QAC9C,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;I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jC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;oCAAsB;AAEoB;IAAlE,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;sCAAyB;AAEjD;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;uCAAyB;AAG1C;IADP,oBAAoB,EAAE;4CACgB;AAE/B;IADP,mBAAmB,EAAE;2CACe;AAYrC;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;oCAGrF;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;mCAGrH;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;uCAG3E","sourcesContent":["import { RenderPass2D } from \"@/render/render-context2d\";\nimport { Node2D, CameraScope, NodeConfig } from \"@/nodes/2d/node2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\n\nimport { lerpVector2, Vector2 } from \"@/attributes/layout/vector2\";\nimport { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { cornerRadiusProperty, cornerStyleProperty } from \"@/attributes/properties/typed\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { ShapeNode, ShapeProps } from \"../geometry/shape-node\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\nexport interface CameraProps extends ShapeProps {\n /** Magnification factor. Values > 1 zoom in; < 1 zoom out. */\n zoom: number;\n /**\n * World-space point that maps to the centre of the camera viewport — what\n * the camera is pointed at. Same name and meaning as\n * `Graphics3D.perspective({ lookAt })`, so a 2D and a 3D camera are aimed\n * with the same word.\n */\n lookAt: Vector2;\n /** Rotation of the camera view in degrees (clockwise). */\n heading: number;\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\n cornerRadius: RectCornerRadius;\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\n cornerStyle: RectCornerStyle;\n}\n\n/**\n * Camera node — a card that holds its own little world. It draws itself like a\n * {@link Rect} (fill, stroke, shadow, corners), then renders its children\n * through a viewport transform defined by `zoom`, `centerOn`, and `heading`.\n * The camera's own layout rect is both the card and the viewport bounds; the\n * world is clipped to that rect so nothing spills outside the card.\n *\n * Unlike `Rect` it runs no flex/freeform layout — children are laid out freeform-style\n * (centered) and then viewed through the camera transform.\n */\nexport class Camera extends ShapeNode<CameraProps> {\n\n /** Magnification factor (default: 1). */\n @property({ default: 1 }) declare zoom: number;\n /** World-space point the viewport centres on (default: {x:0, y:0}). */\n @property({ default: { x: 0, y: 0 }, tween: lerpVector2 }) declare lookAt: Vector2;\n /** View rotation in degrees (default: 0). */\n @property({ default: 0 }) declare heading: number;\n\n @cornerRadiusProperty()\n declare cornerRadius: RectCornerRadius;\n @cornerStyleProperty()\n declare cornerStyle: RectCornerStyle;\n\n constructor(props: NodeConfig<Camera, CameraProps>) {\n super(props);\n }\n\n // ---- Camera motion helpers --------------------------------------------\n // Mirror the base Node2D `moveTo`/`rotateTo` family for the camera's own\n // viewport props (`zoom`, `lookAt`, `heading`).\n\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\n @command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] })\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<CameraProps> {\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. */\n @command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" } } }] })\n panTo(args: CommandArgs<{ lookAt: Vector2 }> & { duration: number }): Command<CameraProps> {\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the view rotation (`heading`), in degrees clockwise. */\n @command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] })\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<CameraProps> {\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\n }\n\n // ---- Drawing ----------------------------------------------------------\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n start: this.start,\n end: this.end,\n });\n }\n\n protected override clipSelf(): Clip {\n return new Clip().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n });\n }\n\n // ---- Layout -----------------------------------------------------------\n\n // No flex/freeform layout — the world (children) is freeform-laid-out (centered)\n // by the base Node2D.layout default, then viewed through the camera.\n\n // No custom measure — the base `Node2D.measure` hugs children stack-style on a\n // `\"hug\"` axis, which is exactly the camera's convention (its world is\n // centered inside the viewport box). So a bare `<Camera>` sizes itself to its\n // world, and an explicit `width`/`height`/`'fill'` still resolves as given.\n\n // ---- Rendering --------------------------------------------------------\n\n // Always non-null: unlike Canvas2D there is no at-rest fast path below, so\n // the camera scope (and its viewport clip) is pushed on every frame even when\n // the transform itself is the identity.\n override _cameraScope(): CameraScope {\n return { lookAt: this.lookAt, zoom: this.zoom, heading: this.heading };\n }\n\n // Its world is flat, seen through its own 2D camera, whatever space the card sits in.\n override _rendersChildrenInSpace(): boolean { return false; }\n\n // Render the world through the camera viewport transform instead of the\n // straight `renderChildren` ShapeNode uses for its content.\n protected override renderChildren(ctx: RenderPass2D): void {\n const rect = this.layoutBounds;\n const w = rect?.width ?? 0;\n const h = rect?.height ?? 0;\n const cx = rect?.x ?? 0;\n const cy = rect?.y ?? 0;\n\n ctx.beginCamera(\n { x: cx, y: -cy, width: w, height: h },\n this.lookAt,\n this.zoom,\n this.heading,\n );\n\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\n\n ctx.endCamera();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"camera-node.js","sourceRoot":"","sources":["../../../src/nodes/layout/camera-node.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,MAAM,EAA2B,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,WAAW,EAAW,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAc,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAyBpD;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAO,SAAQ,SAAsB;IAe9C,YAAY,KAAsC;QAC9C,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,0EAA0E;IAC1E,yEAAyE;IACzE,gD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render-context2d\";\r\nimport { Node2D, CameraScope, NodeConfig, frameIn } from \"@/nodes/2d/node2d\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\n\r\nimport { lerpVector2, Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { cornerRadiusProperty, cornerStyleProperty } from \"@/attributes/properties/typed\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { ShapeNode, ShapeProps } from \"../geometry/shape-node\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\nexport interface CameraProps extends ShapeProps {\r\n /** Magnification factor. Values > 1 zoom in; < 1 zoom out. */\r\n zoom: number;\r\n /**\r\n * World-space point that maps to the centre of the camera viewport — what\r\n * the camera is pointed at. Same name and meaning as\r\n * `Graphics3D.perspective({ lookAt })`, so a 2D and a 3D camera are aimed\r\n * with the same word.\r\n */\r\n lookAt: Vector2;\r\n /** Rotation of the camera view in degrees (clockwise). */\r\n heading: number;\r\n /**\r\n * A node of the camera's world to keep in view, by id: the camera is aimed\r\n * at its centre each frame, and {@link lookAt} becomes an offset from it.\r\n */\r\n follow: string;\r\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\r\n cornerRadius: RectCornerRadius;\r\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\n/**\r\n * Camera node — a card that holds its own little world. It draws itself like a\r\n * {@link Rect} (fill, stroke, shadow, corners), then renders its children\r\n * through a viewport transform defined by `zoom`, `centerOn`, and `heading`.\r\n * The camera's own layout rect is both the card and the viewport bounds; the\r\n * world is clipped to that rect so nothing spills outside the card.\r\n *\r\n * Unlike `Rect` it runs no flex/freeform layout — children are laid out freeform-style\r\n * (centered) and then viewed through the camera transform.\r\n */\r\nexport class Camera extends ShapeNode<CameraProps> {\r\n\r\n /** Magnification factor (default: 1). */\r\n @property({ default: 1 }) declare zoom: number;\r\n /** World-space point the viewport centres on (default: {x:0, y:0}). */\r\n @property({ default: { x: 0, y: 0 }, tween: lerpVector2 }) declare lookAt: Vector2;\r\n /** View rotation in degrees (default: 0). */\r\n @property({ default: 0 }) declare heading: number;\r\n @property({ default: \"\", kind: \"nodeRef\", animatable: false }) declare follow: string;\r\n\r\n @cornerRadiusProperty()\r\n declare cornerRadius: RectCornerRadius;\r\n @cornerStyleProperty()\r\n declare cornerStyle: RectCornerStyle;\r\n\r\n constructor(props: NodeConfig<Camera, CameraProps>) {\r\n super(props);\r\n }\r\n\r\n // ---- Camera motion helpers --------------------------------------------\r\n // Mirror the base Node2D `moveTo`/`rotateTo` family for the camera's own\r\n // viewport props (`zoom`, `lookAt`, `heading`).\r\n\r\n /** Animate `zoom`. Values > 1 zoom in; < 1 zoom out. */\r\n @command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] })\r\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<CameraProps> {\r\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Pan — animate `lookAt`, the world-space point mapped to the viewport center. */\r\n @command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" } } }] })\r\n panTo(args: CommandArgs<{ lookAt: Vector2 }> & { duration: number }): Command<CameraProps> {\r\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the view rotation (`heading`), in degrees clockwise. */\r\n @command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] })\r\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<CameraProps> {\r\n return this.to({ data: args.data as Partial<CameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n // ---- Drawing ----------------------------------------------------------\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n protected override clipSelf(): Clip {\r\n return new Clip().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n });\r\n }\r\n\r\n // ---- Layout -----------------------------------------------------------\r\n\r\n // No flex/freeform layout — the world (children) is freeform-laid-out (centered)\r\n // by the base Node2D.layout default, then viewed through the camera.\r\n\r\n // No custom measure — the base `Node2D.measure` hugs children stack-style on a\r\n // `\"hug\"` axis, which is exactly the camera's convention (its world is\r\n // centered inside the viewport box). So a bare `<Camera>` sizes itself to its\r\n // world, and an explicit `width`/`height`/`'fill'` still resolves as given.\r\n\r\n // ---- Rendering --------------------------------------------------------\r\n\r\n // Always non-null: unlike Canvas2D there is no at-rest fast path below, so\r\n // the camera scope (and its viewport clip) is pushed on every frame even when\r\n // the transform itself is the identity.\r\n override _cameraScope(): CameraScope {\r\n return { lookAt: this._aim(), zoom: this.zoom, heading: this.heading };\r\n }\r\n\r\n // Its world is flat, seen through its own 2D camera, whatever space the card sits in.\r\n override _rendersChildrenInSpace(): boolean { return false; }\r\n\r\n // Render the world through the camera viewport transform instead of the\r\n // straight `renderChildren` ShapeNode uses for its content.\r\n protected override renderChildren(ctx: RenderPass2D): void {\r\n const rect = this.layoutBounds;\r\n const w = rect?.width ?? 0;\r\n const h = rect?.height ?? 0;\r\n const cx = rect?.x ?? 0;\r\n const cy = rect?.y ?? 0;\r\n\r\n ctx.beginCamera(\r\n { x: cx, y: -cy, width: w, height: h },\r\n this._aim(),\r\n this.zoom,\r\n this.heading,\r\n );\r\n\r\n for (const child of this._children) if (child instanceof Node2D) child.render(ctx);\r\n\r\n ctx.endCamera();\r\n }\r\n\r\n private _followed: Node2D | null = null;\r\n\r\n /** The world point at the centre of the view: `lookAt`, measured from the followed node where there is one. */\r\n private _aim(): Vector2 {\r\n const id = this.follow;\r\n if (id === \"\") return this.lookAt;\r\n // Looked up once and kept while it is still the node named and still under this camera.\r\n let node = this._followed;\r\n if (!node || node.id !== id || !within(node, this)) node = this._followed = findBelow(this, id);\r\n if (!node) return this.lookAt;\r\n // A camera is applied when it renders, so the node's own frame does not move with the view it drives.\r\n const at = frameIn(this, node);\r\n return { x: at.x + this.lookAt.x, y: at.y + this.lookAt.y };\r\n }\r\n}\r\n\r\nfunction within(node: Node, ancestor: Node): boolean {\r\n for (let at = node.parent; at; at = at.parent) if (at === ancestor) return true;\r\n return false;\r\n}\r\n\r\nfunction findBelow(at: Node, id: string): Node2D | null {\r\n for (const child of at._allChildren) {\r\n if (child.id === id) return child instanceof Node2D ? child : null;\r\n const found = findBelow(child, id);\r\n if (found) return found;\r\n }\r\n return null;\r\n}\r\n"]}
|
|
@@ -24,7 +24,7 @@ export interface OrbitCameraProps extends Node2DProps {
|
|
|
24
24
|
* Its children are placed in one 3D frame — their `depth` and tilt become
|
|
25
25
|
* positions and turns in it, and they paint far to near — and seen through a
|
|
26
26
|
* camera that orbits, rises and dollies round {@link lookAt}, exactly as the
|
|
27
|
-
* stage's does with `space3D` on. Wrap a card stack, a logo or
|
|
27
|
+
* stage's does with `space3D` on. Wrap a card stack, a logo or an item grid in
|
|
28
28
|
* one to turn it in depth without turning the rest of the scene with it.
|
|
29
29
|
*
|
|
30
30
|
* `perspective` is the camera's distance from `lookAt` at `dolly: 0`, CSS's
|
|
@@ -18,7 +18,7 @@ const DEFAULT_PERSPECTIVE = 1000;
|
|
|
18
18
|
* Its children are placed in one 3D frame — their `depth` and tilt become
|
|
19
19
|
* positions and turns in it, and they paint far to near — and seen through a
|
|
20
20
|
* camera that orbits, rises and dollies round {@link lookAt}, exactly as the
|
|
21
|
-
* stage's does with `space3D` on. Wrap a card stack, a logo or
|
|
21
|
+
* stage's does with `space3D` on. Wrap a card stack, a logo or an item grid in
|
|
22
22
|
* one to turn it in depth without turning the rest of the scene with it.
|
|
23
23
|
*
|
|
24
24
|
* `perspective` is the camera's distance from `lookAt` at `dolly: 0`, CSS's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbit-camera-node.js","sourceRoot":"","sources":["../../../src/nodes/layout/orbit-camera-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAqC,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAiC,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAqB,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAmBpD,8GAA8G;AAC9G,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,WAAY,SAAQ,MAAwB;IASrD,YAAY,KAAiD;QACzD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,KAAK,EAAE,WAAW,KAAK,SAAS,IAAI,KAAK,EAAE,WAAW,KAAK,SAAS,EAAE,CAAC;YACvE,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAED,6CAA6C;IAE7C,OAAO,CAAC,IAAgF;QACpF,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAiC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,uEAAuE;IAEvE,OA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AAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0CAGnI;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;0CAG/D;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;yCAGrF;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;wCAG5I;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;4CAG3E","sourcesContent":["import { Node2D, type NodeConfig, type Node2DProps } from \"@/nodes/2d/node2d\";\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\nimport { sizeInputOps } from \"@/attributes/layout/size\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\nexport interface OrbitCameraProps extends Node2DProps {\n /** The point the camera orbits and looks at; `z` puts it in depth, as a node's `depth` does. */\n lookAt: LookAt;\n /** Lens zoom, applied after the projection. Values > 1 zoom in. */\n zoom: number;\n /** Roll of the view in degrees, clockwise. */\n heading: number;\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera right. */\n orbit: number;\n /** Degrees above the layers. Positive looks down on them. */\n elevation: number;\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective. */\n dolly: number;\n /** Degrees per second the camera orbits on its own — a turntable. */\n orbitSpeed: number;\n}\n\n/** The camera's distance when nothing states one: a gentle lens, where `0` would be no perspective at all. */\nconst DEFAULT_PERSPECTIVE = 1000;\n\n/**\n * The stage's 2.5D camera, for one part of a scene.\n *\n * Its children are placed in one 3D frame — their `depth` and tilt become\n * positions and turns in it, and they paint far to near — and seen through a\n * camera that orbits, rises and dollies round {@link lookAt}, exactly as the\n * stage's does with `space3D` on. Wrap a card stack, a logo or a layout grid in\n * one to turn it in depth without turning the rest of the scene with it.\n *\n * `perspective` is the camera's distance from `lookAt` at `dolly: 0`, CSS's\n * convention, so the focus plane draws 1:1. The node's own tilt and depth are\n * unused, as the stage's are in its space: they would turn the whole view as one\n * flat card.\n */\nexport class OrbitCamera extends Node2D<OrbitCameraProps> {\n @property({ default: { x: 0, y: 0 }, tween: lerpLookAt }) declare lookAt: LookAt;\n @property({ default: 1 }) declare zoom: number;\n @property({ default: 0 }) declare heading: number;\n @property({ default: 0 }) declare orbit: number;\n @property({ default: 0 }) declare elevation: number;\n @property({ default: 0 }) declare dolly: number;\n @property({ default: 0 }) declare orbitSpeed: number;\n\n constructor(props?: NodeConfig<OrbitCamera, OrbitCameraProps>) {\n super(props);\n if (props?.perspective === undefined && props?.transform3D === undefined) {\n this._writeProp(\"perspective\", DEFAULT_PERSPECTIVE);\n }\n }\n\n /** Swing the camera round {@link lookAt}. */\n @command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] })\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<OrbitCameraProps> {\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\n @command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] })\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<OrbitCameraProps> {\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Animate the lens `zoom`. */\n @command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] })\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<OrbitCameraProps> {\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Aim the camera at another point — `z` moves it in depth. */\n @command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] })\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<OrbitCameraProps> {\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\n }\n\n /** Roll the view, in degrees clockwise. */\n @command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] })\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<OrbitCameraProps> {\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\n }\n\n // A frame round what it holds: the base's rule would have one from a\n // document, whose children arrive after it, fill its parent instead.\n protected override applyDefaultSize(props?: NodeConfig<OrbitCamera, OrbitCameraProps>): void {\n if (!props || props.width === undefined) this.applyProp(\"width\", \"hug\", { tween: sizeInputOps.lerp });\n if (!props || props.height === undefined) this.applyProp(\"height\", \"hug\", { tween: sizeInputOps.lerp });\n }\n\n /** @internal */\n override _spaceCamera(): SpaceCamera {\n return {\n perspective: this.perspective,\n orbit: this.orbit + this.orbitSpeed * this._time.total,\n elevation: this.elevation,\n dolly: this.dolly,\n lookAt: this.lookAt,\n zoom: this.zoom,\n heading: this.heading,\n viewportX: 0,\n viewportY: 0,\n };\n }\n\n protected override _projection(): Projection3D {\n return NO_PROJECTION_3D;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"orbit-camera-node.js","sourceRoot":"","sources":["../../../src/nodes/layout/orbit-camera-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAqC,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAiC,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAqB,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAmBpD,8GAA8G;AAC9G,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,WAAY,SAAQ,MAAwB;IASrD,YAAY,KAAiD;QACzD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,KAAK,EAAE,WAAW,KAAK,SAAS,IAAI,KAAK,EAAE,WAAW,KAAK,SAAS,EAAE,CAAC;YACvE,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAED,6CAA6C;IAE7C,OAAO,CAAC,IAAgF;QACpF,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAiC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CA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,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0CAGnI;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;0CAG/D;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;yCAGrF;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;wCAG5I;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;4CAG3E","sourcesContent":["import { Node2D, type NodeConfig, type Node2DProps } from \"@/nodes/2d/node2d\";\r\nimport { lerpLookAt, type LookAt, type SpaceCamera } from \"@/attributes/layout/space3d\";\r\nimport { NO_PROJECTION_3D, type Projection3D } from \"@/attributes/layout/matrix2d\";\r\nimport { sizeInputOps } from \"@/attributes/layout/size\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\nexport interface OrbitCameraProps extends Node2DProps {\r\n /** The point the camera orbits and looks at; `z` puts it in depth, as a node's `depth` does. */\r\n lookAt: LookAt;\r\n /** Lens zoom, applied after the projection. Values > 1 zoom in. */\r\n zoom: number;\r\n /** Roll of the view in degrees, clockwise. */\r\n heading: number;\r\n /** Degrees about the vertical axis through {@link lookAt}. 0 is head-on; positive moves the camera right. */\r\n orbit: number;\r\n /** Degrees above the layers. Positive looks down on them. */\r\n elevation: number;\r\n /** Px the camera has moved in toward {@link lookAt}. Inert with no perspective. */\r\n dolly: number;\r\n /** Degrees per second the camera orbits on its own — a turntable. */\r\n orbitSpeed: number;\r\n}\r\n\r\n/** The camera's distance when nothing states one: a gentle lens, where `0` would be no perspective at all. */\r\nconst DEFAULT_PERSPECTIVE = 1000;\r\n\r\n/**\r\n * The stage's 2.5D camera, for one part of a scene.\r\n *\r\n * Its children are placed in one 3D frame — their `depth` and tilt become\r\n * positions and turns in it, and they paint far to near — and seen through a\r\n * camera that orbits, rises and dollies round {@link lookAt}, exactly as the\r\n * stage's does with `space3D` on. Wrap a card stack, a logo or an item grid in\r\n * one to turn it in depth without turning the rest of the scene with it.\r\n *\r\n * `perspective` is the camera's distance from `lookAt` at `dolly: 0`, CSS's\r\n * convention, so the focus plane draws 1:1. The node's own tilt and depth are\r\n * unused, as the stage's are in its space: they would turn the whole view as one\r\n * flat card.\r\n */\r\nexport class OrbitCamera extends Node2D<OrbitCameraProps> {\r\n @property({ default: { x: 0, y: 0 }, tween: lerpLookAt }) declare lookAt: LookAt;\r\n @property({ default: 1 }) declare zoom: number;\r\n @property({ default: 0 }) declare heading: number;\r\n @property({ default: 0 }) declare orbit: number;\r\n @property({ default: 0 }) declare elevation: number;\r\n @property({ default: 0 }) declare dolly: number;\r\n @property({ default: 0 }) declare orbitSpeed: number;\r\n\r\n constructor(props?: NodeConfig<OrbitCamera, OrbitCameraProps>) {\r\n super(props);\r\n if (props?.perspective === undefined && props?.transform3D === undefined) {\r\n this._writeProp(\"perspective\", DEFAULT_PERSPECTIVE);\r\n }\r\n }\r\n\r\n /** Swing the camera round {@link lookAt}. */\r\n @command({ args: [{ key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" }, { key: \"elevation\", kind: \"number\", step: 1, unit: \"°\" }] })\r\n orbitTo(args: CommandArgs<{ orbit?: number; elevation?: number }> & { duration: number }): Command<OrbitCameraProps> {\r\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Move the camera in toward {@link lookAt} (positive) or back out. */\r\n @command({ args: [{ key: \"dolly\", kind: \"number\", step: 10 }] })\r\n dollyTo(args: CommandArgs<{ dolly: number }> & { duration: number }): Command<OrbitCameraProps> {\r\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Animate the lens `zoom`. */\r\n @command({ args: [{ key: \"zoom\", kind: \"number\", min: 0.01, step: 0.1, unit: \"×\" }] })\r\n zoomTo(args: CommandArgs<{ zoom: number }> & { duration: number }): Command<OrbitCameraProps> {\r\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Aim the camera at another point — `z` moves it in depth. */\r\n @command({ args: [{ key: \"lookAt\", kind: \"vector2\", properties: { x: { kind: \"number\" }, y: { kind: \"number\" }, z: { kind: \"number\" } } }] })\r\n panTo(args: CommandArgs<{ lookAt: LookAt }> & { duration: number }): Command<OrbitCameraProps> {\r\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /** Roll the view, in degrees clockwise. */\r\n @command({ args: [{ key: \"heading\", kind: \"number\", step: 1, unit: \"°\" }] })\r\n headingTo(args: CommandArgs<{ heading: number }> & { duration: number }): Command<OrbitCameraProps> {\r\n return this.to({ data: args.data as Partial<OrbitCameraProps>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n // A frame round what it holds: the base's rule would have one from a\r\n // document, whose children arrive after it, fill its parent instead.\r\n protected override applyDefaultSize(props?: NodeConfig<OrbitCamera, OrbitCameraProps>): void {\r\n if (!props || props.width === undefined) this.applyProp(\"width\", \"hug\", { tween: sizeInputOps.lerp });\r\n if (!props || props.height === undefined) this.applyProp(\"height\", \"hug\", { tween: sizeInputOps.lerp });\r\n }\r\n\r\n /** @internal */\r\n override _spaceCamera(): SpaceCamera {\r\n return {\r\n perspective: this.perspective,\r\n orbit: this.orbit + this.orbitSpeed * this._time.total,\r\n elevation: this.elevation,\r\n dolly: this.dolly,\r\n lookAt: this.lookAt,\r\n zoom: this.zoom,\r\n heading: this.heading,\r\n viewportX: 0,\r\n viewportY: 0,\r\n };\r\n }\r\n\r\n protected override _projection(): Projection3D {\r\n return NO_PROJECTION_3D;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotated-box.js","sourceRoot":"","sources":["../../../src/nodes/layout/rotated-box.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAK7D,OAAO,EAAE,MAAM,EAA2B,MAAM,mBAAmB,CAAC;AAapE,MAAM,OAAO,UAAW,SAAQ,MAAuB;IAGnD,YAAY,KAA+C;QACvD,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,wFAAwF;QACxF,+EAA+E;QAC/E,mFAAmF;QACnF,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAEQ,OAAO,CAAC,WAA4B,EAAE,KAAuB;QAClE,IAAI,CAAC,WAAW,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QAEpD,0DAA0D;QAC1D,oFAAoF;QACpF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,G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AAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG;YAC3C,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG;SAC/C,CAAC;QAEF,6EAA6E;QAC7E,wFAAwF;QACxF,wDAAwD;QACxD,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ;AAzEuC;IAAnC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;yCAAuB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { SizeConstraints } from \"@/layout/constraints\";\nimport { BoxBounds } from \"@/layout/bounds\";\nimport { MeasureContext2D } from \"@/render/measure-context\";\nimport { Size2D } from \"@/attributes/layout/size\";\nimport { Node2D, NodeConfig, Node2DProps } from \"@/nodes/2d/node2d\";\n\n// Adjust this import path if needed\n\nexport interface RotatedBoxProps extends Node2DProps {\n /** \n * Visual rotation angle in degrees. Unlike standard `rotation`, \n * animating this ALSO dynamically calculates a new bounding box \n * for the flex/layout engine. \n */\n angle: number;\n}\n\nexport class RotatedBox extends Node2D<RotatedBoxProps> {\n @property({ default: -90 }) declare angle: number;\n\n constructor(props?: NodeConfig<RotatedBox, RotatedBoxProps>) {\n super(props);\n\n // Clever trick: Automatically bind the inherited visual `rotation` prop to our `angle`.\n // This ensures the engine's built-in `applyTransform` pass physically rotates \n // the canvas just like a normal Node2D, while we handle the layout box math below.\n this._writeProp('rotation', () => this.angle);\n }\n\n override measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D> {\n this.lastMeasure = { constraints, measurer: scope };\n\n // Calculate the projection scalars for the current angle.\n // Works perfectly for 90/-90, but also scales bounds smoothly for arbitrary angles.\n const rad = this.angle * (Math.PI / 180);\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n\n // 1. Map the parent constraints into the child's un-rotated coordinate space.\n // If orthogonal (90/-90), this cleanly swaps maxWidth and maxHeight.\n const isOrthogonal = Math.abs(this.angle % 180) === 90;\n const childConstraints: SizeConstraints = {\n maxWidth: (constraints.maxWidth !== undefined && constraints.maxHeight !== undefined)\n ? (constraints.maxWidth * cos + constraints.maxHeight * sin)\n : (isOrthogonal ? constraints.maxHeight : constraints.maxWidth),\n maxHeight: (constraints.maxWidth !== undefined && constraints.maxHeight !== undefined)\n ? (constraints.maxWidth * sin + constraints.maxHeight * cos)\n : (isOrthogonal ? constraints.maxWidth : constraints.maxHeight),\n };\n\n // 2. Measure all children stack-style against the rotated constraints\n let maxChildW = 0;\n let maxChildH = 0;\n\n for (const child of this.flowChildren()) {\n const size = child.measure(childConstraints, scope);\n if ((size.width ?? 0) > maxChildW) maxChildW = size.width ?? 0;\n if ((size.height ?? 0) > maxChildH) maxChildH = size.height ?? 0;\n }\n\n // 3. Project the child's intrinsic size back into our rotated layout bounding box.\n const rotatedW = maxChildW * cos + maxChildH * sin;\n const rotatedH = maxChildW * sin + maxChildH * cos;\n\n // Resolve against \"hug\" / \"fill\" / strict author sizes\n return {\n width: this.resolveSizeInput(this.width, constraints.maxWidth ?? 0, rotatedW),\n height: this.resolveSizeInput(this.height, constraints.maxHeight ?? 0, rotatedH),\n };\n }\n\n protected override layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void {\n const rad = this.angle * (Math.PI / 180);\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n\n // Project the allocated parent bounding box back into the child's un-rotated space.\n // If we are rotated 90 degrees, the child's width space is allocated our height, \n // and the child's height space is allocated our width.\n const childRect: BoxBounds = {\n x: rect.x,\n y: rect.y,\n width: rect.width * cos + rect.height * sin,\n height: rect.width * sin + rect.height * cos,\n };\n\n // Let the base Node2D class center the children inside this un-rotated rect.\n // When `applyTransform` executes the rotation, the child will visually pivot perfectly \n // inside the original `rect` space without overflowing.\n super.layoutChildren(childRect, scope);\n }\n}"]}
|
|
1
|
+
{"version":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AAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,IAAI,CAAC,EAAE,QAAQ,CAAC;SACnF,CAAC;IACN,CAAC;IAEkB,cAAc,CAAC,IAAe,EAAE,KAAuB;QACtE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAEpC,oFAAoF;QACpF,kFAAkF;QAClF,uDAAuD;QACvD,MAAM,SAAS,GAAc;YACzB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG;YAC3C,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG;SAC/C,CAAC;QAEF,6EAA6E;QAC7E,wFAAwF;QACxF,wDAAwD;QACxD,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ;AAzEuC;IAAnC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;yCAAuB","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { SizeConstraints } from \"@/layout/constraints\";\r\nimport { BoxBounds } from \"@/layout/bounds\";\r\nimport { MeasureContext2D } from \"@/render/measure-context\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\nimport { Node2D, NodeConfig, Node2DProps } from \"@/nodes/2d/node2d\";\r\n\r\n// Adjust this import path if needed\r\n\r\nexport interface RotatedBoxProps extends Node2DProps {\r\n /** \r\n * Visual rotation angle in degrees. Unlike standard `rotation`, \r\n * animating this ALSO dynamically calculates a new bounding box \r\n * for the flex/layout engine. \r\n */\r\n angle: number;\r\n}\r\n\r\nexport class RotatedBox extends Node2D<RotatedBoxProps> {\r\n @property({ default: -90 }) declare angle: number;\r\n\r\n constructor(props?: NodeConfig<RotatedBox, RotatedBoxProps>) {\r\n super(props);\r\n\r\n // Clever trick: Automatically bind the inherited visual `rotation` prop to our `angle`.\r\n // This ensures the engine's built-in `applyTransform` pass physically rotates \r\n // the canvas just like a normal Node2D, while we handle the layout box math below.\r\n this._writeProp('rotation', () => this.angle);\r\n }\r\n\r\n override measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D> {\r\n this.lastMeasure = { constraints, measurer: scope };\r\n\r\n // Calculate the projection scalars for the current angle.\r\n // Works perfectly for 90/-90, but also scales bounds smoothly for arbitrary angles.\r\n const rad = this.angle * (Math.PI / 180);\r\n const cos = Math.abs(Math.cos(rad));\r\n const sin = Math.abs(Math.sin(rad));\r\n\r\n // 1. Map the parent constraints into the child's un-rotated coordinate space.\r\n // If orthogonal (90/-90), this cleanly swaps maxWidth and maxHeight.\r\n const isOrthogonal = Math.abs(this.angle % 180) === 90;\r\n const childConstraints: SizeConstraints = {\r\n maxWidth: (constraints.maxWidth !== undefined && constraints.maxHeight !== undefined)\r\n ? (constraints.maxWidth * cos + constraints.maxHeight * sin)\r\n : (isOrthogonal ? constraints.maxHeight : constraints.maxWidth),\r\n maxHeight: (constraints.maxWidth !== undefined && constraints.maxHeight !== undefined)\r\n ? (constraints.maxWidth * sin + constraints.maxHeight * cos)\r\n : (isOrthogonal ? constraints.maxWidth : constraints.maxHeight),\r\n };\r\n\r\n // 2. Measure all children stack-style against the rotated constraints\r\n let maxChildW = 0;\r\n let maxChildH = 0;\r\n\r\n for (const child of this.flowChildren()) {\r\n const size = child.measure(childConstraints, scope);\r\n if ((size.width ?? 0) > maxChildW) maxChildW = size.width ?? 0;\r\n if ((size.height ?? 0) > maxChildH) maxChildH = size.height ?? 0;\r\n }\r\n\r\n // 3. Project the child's intrinsic size back into our rotated layout bounding box.\r\n const rotatedW = maxChildW * cos + maxChildH * sin;\r\n const rotatedH = maxChildW * sin + maxChildH * cos;\r\n\r\n // Resolve against \"hug\" / \"fill\" / strict author sizes\r\n return {\r\n width: this.resolveSizeInput(this.width, constraints.maxWidth ?? 0, rotatedW),\r\n height: this.resolveSizeInput(this.height, constraints.maxHeight ?? 0, rotatedH),\r\n };\r\n }\r\n\r\n protected override layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void {\r\n const rad = this.angle * (Math.PI / 180);\r\n const cos = Math.abs(Math.cos(rad));\r\n const sin = Math.abs(Math.sin(rad));\r\n\r\n // Project the allocated parent bounding box back into the child's un-rotated space.\r\n // If we are rotated 90 degrees, the child's width space is allocated our height, \r\n // and the child's height space is allocated our width.\r\n const childRect: BoxBounds = {\r\n x: rect.x,\r\n y: rect.y,\r\n width: rect.width * cos + rect.height * sin,\r\n height: rect.width * sin + rect.height * cos,\r\n };\r\n\r\n // Let the base Node2D class center the children inside this un-rotated rect.\r\n // When `applyTransform` executes the rotation, the child will visually pivot perfectly \r\n // inside the original `rect` space without overflowing.\r\n super.layoutChildren(childRect, scope);\r\n }\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/media/video-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAA2B,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AACjG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,SAAS;IAiCR,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAahD;;;;OAIG;IACM,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IA6C9C,iEAAiE;IACjE,OAAO,CAAC,aAAa;IAOrB,kDAAkD;IAClD,OAAO,CAAC,QAAQ;IAOhB;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;cAWE,aAAa,IAAI,UAAU;IAI9C;;;;;;;;;;;;;;;;OAgBG;cACgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;cAkBzC,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAgBjD,OAAO,IAAI,IAAI;CAK3B"}
|
|
@@ -179,6 +179,7 @@ export class Video extends Rect {
|
|
|
179
179
|
trimEnd: to,
|
|
180
180
|
filters: this._soundFilters(speed),
|
|
181
181
|
bus,
|
|
182
|
+
optional: true,
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
return;
|
|
@@ -197,6 +198,7 @@ export class Video extends Rect {
|
|
|
197
198
|
trimEnd: this.trimEnd ?? (loop ? undefined : audio.catalog.getMediaDuration(src)),
|
|
198
199
|
filters: this._soundFilters(this.speed ?? 1),
|
|
199
200
|
bus,
|
|
201
|
+
optional: true,
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
/** `speed` as a filter ahead of the node's own audio filters. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-node.js","sourceRoot":"","sources":["../../../src/nodes/media/video-node.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAmB,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAMtE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAoC,aAAa,EAAE,MAAM,+CA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A+C;AACtC;IAAnB,QAAQ,EAAE;uCAA2B;AAEJ;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;qCAAwB;AACX;IAArC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;oCAAwB;AAE7C;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;2CACd;AACC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;kCAAsB;AASpB;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;uCAA2C","sourcesContent":["import { RenderContext2D } from \"@/render/render-context2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { VideoAdjustment, resolveChainAdjustments } from \"@/attributes/shape/filters/chain\";\nimport { lerpFilterArray } from \"@/attributes/shape/filters/registry\";\nimport { MediaAdjustment, VideoOnlyAdjustment } from \"@/attributes/shape/filters/union\";\nimport { ImageCrop, ImageFit, ImageMatrix } from \"@/attributes/shape/fill/implementations/image\";\nimport { Alignment } from \"@/attributes/layout/alignment\";\nimport { InsetsResolved } from \"@/attributes/layout/insets\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { alignmentProperty, insetsProperty } from \"@/attributes/properties/typed\";\nimport { VideoFillProp, VideoFillResolved, sourceTimeFor } from \"@/attributes/shape/fill/implementations/video\";\nimport { Rect, RectProps } from \"../geometry/rect-node\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { resolveFill, UNSET_MEDIA_FILL } from \"@/attributes/shape/fill/registry\";\nimport { FillProp, FillResolved } from \"@/attributes/shape/fill/union\";\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\nimport type { AudioScope } from \"@/attributes/audio/schedule\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport { busPathTo, findBusById } from \"@/nodes/audio/node-audio\";\nimport { AudioFilterItem } from \"@/attributes/audio/filters/union\";\nimport { AudioFilter, resolveAudioFilters, AudioFilters } from \"@/attributes/audio/filters/chain\";\n\nexport interface VideoProps extends RectProps {\n src?: string;\n /** How the (cropped) frame is scaled into the node's bounds. Default 'fill'. */\n fit?: ImageFit;\n /** Window onto the source frame, in fractions of its own size, applied before `fit`. */\n crop?: ImageCrop;\n /** Magnification on top of the fitted scale. `1` (default) is the fitted size. */\n zoom?: number;\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\n anchor?: Alignment;\n /** Raw frame→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\n matrix?: ImageMatrix;\n /** Visual filters applied to the rendered frame (blur, color, posterizeTime, echo, …). */\n filters?: VideoAdjustment;\n /** Whether playback advances with the node's clock (drives both picture and sound). Default true. */\n playing?: boolean;\n /**\n * Explicit source time to show, in seconds. Omit it (the default) and the\n * picture is timed from the moment this node appeared; set it to drive the\n * playhead yourself, and set it to `null` to hand the playhead back to the\n * clock (`set()` merges a partial, so `undefined` won't clear it).\n */\n timestamp?: number | null;\n trimStart?: number;\n trimEnd?: number;\n /** Playback-rate multiplier for both picture and audio. Default 1. */\n speed?: number;\n loop?: 'forward' | 'reverse' | 'none';\n /** Length of one loop cycle, in seconds. Defaults to the trimmed clip length. */\n duration?: number;\n /** Audio volume in [0, 1]. Default 1. */\n volume?: number;\n /** Silence the video's audio track without affecting the picture. Default false. */\n muted?: boolean;\n /** Audio filters applied to the video's sound track (gain, eq, echo, …). */\n audioFilters?: AudioFilter;\n /**\n * The node id of an `AudioBus` in this clip to route the video's sound into.\n *\n * A `Video` is a `Node2D`, so it cannot be parented under a bus the way a\n * `SoundNode` is — its audio is welded to its picture, which has to stay in\n * the visual tree. Naming one instead is what lets a video's dialogue sit on\n * the same bus as everything else, so ducking the whole group is still one\n * edit — and it is the *same* id a `SoundNode` under that bus writes as its\n * `parentId`, rather than a second vocabulary for \"which bus\". An id matching\n * no bus routes straight to the master, the same as no bus at all.\n */\n bus?: string;\n /**\n * An explicit **playback schedule**: the stretches of this node's own clock\n * during which the clip advances, and where in the source each one starts.\n *\n * Omit it (the default) and playback is what it has always been — the clip\n * runs from the moment the node appears, at `speed`, until it or the node\n * runs out. Give it, and `playing`/`timestamp` are both superseded: the\n * picture takes its source time from whichever segment covers the current\n * `elapsed`, and the sound is scheduled one clip per segment.\n *\n * It exists because a **pause** cannot be expressed any other way. `playing:\n * false` holds the clip's *first* frame, because with playback derived\n * linearly from the clock there is nothing else it could hold; and the sound\n * runs on the node's own clock regardless, so a picture frozen by any means\n * would drift away from it. A schedule states the one thing both halves need\n * and neither could infer — that a paused stretch consumes no source — so\n * they cannot come apart.\n *\n * Still a pure function of the clock, which is the property everything else\n * here is built on: frame *N* is identical however the playhead reached it,\n * so a scrub, a playthrough and an export agree.\n */\n segments?: readonly VideoSegment[];\n\n}\n\n/**\n * One stretch of a {@link Video}'s own clock during which its source advances —\n * see {@link VideoProps.segments}.\n *\n * Trim and loop are applied *on top* of this, by the same code that applies them\n * to unscheduled playback, so a schedule says when the clip is running and the\n * clip's own props go on saying which part of the file it is running through.\n */\nexport interface VideoSegment {\n /** Second on the node's own clock (`NodeTime.elapsed`) this segment begins. */\n at: number;\n /** Source in-point for it, in seconds. */\n from: number;\n /**\n * How long it runs, in seconds of the node's clock.\n *\n * `Infinity` for a clip left running — the same open sentinel\n * `AudioRequest.endAt` uses — which resolves against the clip's length.\n */\n duration: number;\n /** Playback rate through it. Defaults to the node's own `speed`. */\n speed?: number;\n /** Linear gain for its sound. Defaults to the node's own `volume`. */\n volume?: number;\n}\n\n/**\n * A video. Layout and child positioning are inherited wholesale from\n * {@link Rect} — a Video lays out its children exactly like a Rect, just with a\n * *playing* video painted in place of the rect's fill. The\n * frame is drawn through a `video` fill, which resolves the source time to show\n * from this node's clock as it paints.\n *\n * It is the one media class left, and the reason it is a class where a still\n * picture is now just an `image` fill: a Video plays its own audio track,\n * declared as a clip of the same file trimmed/sped/looped to match the picture.\n * Set `muted` to drop the sound while keeping the picture; `playing: false`\n * freezes both.\n */\nexport class Video extends Rect<VideoProps> {\n\n @property() declare src?: string;\n @property() declare fit?: ImageFit;\n @insetsProperty() declare crop: ImageCrop;\n @property({ default: 1 }) declare zoom: number;\n @alignmentProperty() declare anchor: Alignment;\n @property() declare matrix?: ImageMatrix;\n @property({ default: [], tween: lerpFilterArray, mapper: resolveChainAdjustments })\n declare filters?: (MediaAdjustment | VideoOnlyAdjustment)[];\n\n @property({ default: true }) declare playing: boolean;\n @property() declare timestamp?: number | null;\n @property() declare trimStart?: number;\n @property() declare trimEnd?: number;\n @property() declare speed?: number;\n @property() declare loop?: 'forward' | 'reverse' | 'none';\n @property() declare duration?: number;\n\n @property({ default: 1 }) declare volume: number;\n @property({ default: false }) declare muted: boolean;\n @property({ default: [], mapper: resolveAudioFilters })\n declare audioFilters?: AudioFilterItem[];\n @property({ default: undefined }) declare bus?: string;\n\n /**\n * The playback schedule — see {@link VideoProps.segments}.\n *\n * Not tweenable, and not a mistake: there is no halfway between two\n * schedules. What moves over time is the playhead *within* one, which is\n * what the schedule describes.\n */\n @property({ default: [] }) declare segments: readonly VideoSegment[];\n\n /**\n * The `video` fill state `renderSelf` paints — so the picture reuses the\n * exact playback model authors get from `Fills.video(...)`, rather than\n * re-deriving timestamps here. The fill carries no timestamp of its own: it\n * resolves one as it paints, from this node's clock. Rebuilt from props when\n * the source or any playback knob changes (see {@link videoKey}).\n */\n private _video: VideoFillResolved | null = null;\n private _videoKey: string = \"\";\n\n constructor(props: NodeConfig<Video, VideoProps>) {\n super(props as NodeConfig<Rect, RectProps>);\n }\n\n /**\n * Seconds of source the schedule has consumed by `elapsed`, or `null` when\n * there is no schedule.\n *\n * The whole of what a schedule *means*: a playing stretch consumes its own\n * length times its rate, a paused one consumes nothing, and the answer is\n * accumulated from the front every time rather than remembered — which is\n * what keeps it identical at every seek. The lists here are short (one entry\n * per play command), and the walk stops at the first segment that has not\n * started, so this is cheaper than the cached fill it feeds.\n */\n private playedAt(elapsed: number): number | null {\n const segments = this.segments;\n if (!segments || segments.length === 0) return null;\n\n let played = 0;\n for (const segment of segments) {\n if (elapsed <= segment.at) break;\n const speed = segment.speed ?? this.speed ?? 1;\n // `Infinity` on the last segment resolves to \"everything left\",\n // which `Math.min` gives without a branch: the clip is clamped\n // against its own trim by `sourceTimeFor` a moment later.\n played += Math.min(elapsed - segment.at, segment.duration) * speed;\n }\n return played;\n }\n\n /**\n * The source time the schedule puts the picture at, or `undefined` to leave\n * the fill deriving one for itself.\n *\n * The offset each segment starts from is folded in as `from - trimStart`, so\n * a schedule whose first segment enters the clip part-way through does what\n * it says while trim and loop still mean what they mean. That is why this\n * hands back a source time rather than a `playStart`: an offset can express\n * \"start later\", and only an explicit time can express \"and stop here\".\n */\n private scheduledTimestamp(): number | undefined {\n const played = this.playedAt(this.time.elapsed);\n if (played === null) return undefined;\n const start = this.trimStart ?? 0;\n const first = this.segments[0];\n const entry = first ? first.from - start : 0;\n return sourceTimeFor(\n played + entry,\n start,\n this.trimEnd ?? Infinity,\n this.loop,\n this.duration,\n );\n }\n\n /** Identity of the props that define the video fill; a change rebuilds it. */\n private videoKey(): string {\n // `crop`/`anchor` read back resolved (an object), so they are flattened\n // here rather than stringified — a tweened crop changes every frame and\n // must invalidate the cached fill, or the picture would freeze mid-tween.\n const crop = this.crop as InsetsResolved;\n const anchor = this.anchor as unknown as Vector2;\n return [\n this.src ?? '', this.fit ?? '', this.zoom, this.playing ? 1 : 0,\n crop.left, crop.right, crop.top, crop.bottom, anchor.x, anchor.y,\n this.timestamp ?? '', this.trimStart ?? '', this.trimEnd ?? '',\n this.speed ?? '', this.loop ?? '', this.duration ?? '',\n // The schedule's answer changes every frame while the clip runs, so\n // it belongs in the key for the same reason a tweened crop does: a\n // fill cached across it would freeze the picture mid-playback.\n this.scheduledTimestamp() ?? '',\n ].join('|');\n }\n\n /** (Re)build the resolved video fill from current props. */\n private syncVideo(): void {\n if (!this.src) {\n this._video = null;\n this._videoKey = \"\";\n return;\n }\n const key = this.videoKey();\n if (key === this._videoKey && this._video) return;\n this._videoKey = key;\n const prop: VideoFillProp = {\n type: 'video',\n src: this.src,\n fit: this.fit,\n crop: this.crop,\n zoom: this.zoom,\n anchor: this.anchor,\n matrix: this.matrix,\n filters: this.filters,\n playing: this.playing,\n // A schedule supersedes both: what it resolves *is* the playhead,\n // and it already carries whether the clip is running. An authored\n // `timestamp` still wins over it, since that is the author driving\n // the playhead by hand and this is the document driving it by chain.\n timestamp: this.timestamp ?? this.scheduledTimestamp(),\n trimStart: this.trimStart,\n trimEnd: this.trimEnd,\n speed: this.speed,\n loop: this.loop,\n duration: this.duration,\n };\n this._video = resolveFill(prop as FillProp) as VideoFillResolved;\n }\n\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n if (!this.src) return;\n // Not `syncVideo()`: its timestamp reads the clock, and what loads never depends on the playhead.\n assets.fill(resolveFill({\n type: 'video',\n src: this.src,\n filters: this.filters,\n trimStart: this.trimStart,\n trimEnd: this.trimEnd,\n } as FillProp) as VideoFillResolved);\n }\n\n /**\n * The sound track: one clip, or one per segment when a schedule drives\n * playback — cut from the source where the picture reads, so a pause is\n * silent rather than sound running on under a frozen frame.\n */\n override declareAudio(audio: AudioScope): void {\n const src = this.src;\n if (!src || this.muted) return;\n const bus = this._busPath(audio);\n\n if (this.segments.length > 0) {\n const clipEnd = this.trimEnd ?? audio.catalog.getMediaDuration(src);\n for (const segment of this.segments) {\n const speed = segment.speed ?? this.speed ?? 1;\n const from = segment.from;\n const to = Math.min(clipEnd, from + segment.duration * speed);\n // A zero-length request is one the mixer schedules and immediately stops.\n if (!(to > from)) continue;\n audio.clip({\n src,\n // A segment's `at` is on the node's own clock, which starts as it enters.\n at: audio.span.start + segment.at,\n volume: segment.volume ?? this.volume,\n trimStart: from,\n trimEnd: to,\n filters: this._soundFilters(speed),\n bus,\n });\n }\n return;\n }\n\n // With a schedule `playing` says nothing; without one, paused is silent.\n if (!this.playing) return;\n const loop = (this.loop ?? 'none') !== 'none';\n audio.clip({\n src,\n volume: this.volume,\n loop,\n trimStart: this.trimStart,\n // Resolved against the video's own length, so an unlooped clip ends\n // with its picture rather than running on as an open bed.\n trimEnd: this.trimEnd ?? (loop ? undefined : audio.catalog.getMediaDuration(src)),\n filters: this._soundFilters(this.speed ?? 1),\n bus,\n });\n }\n\n /** `speed` as a filter ahead of the node's own audio filters. */\n private _soundFilters(speed: number): AudioFilterItem[] {\n const filters: AudioFilterItem[] = [];\n if (speed !== 1) filters.push(...resolveAudioFilters(AudioFilters.speed(speed)));\n filters.push(...this.audioFilters!);\n return filters;\n }\n\n /** The bus chain {@link VideoProps.bus} names. */\n private _busPath(audio: AudioScope): AudioBusStop[] | undefined {\n if (!this.bus) return undefined;\n const target = findBusById(this, this.bus);\n return target ? busPathTo(target, audio) : undefined;\n }\n\n\n /**\n * The node's box, as the rect state every pass declares.\n *\n * Split out of {@link shapeGraphics} because the overlay has to declare the\n * same rectangle **twice** inside one mask scope — once as the mask, once as\n * the content — and a `Graphics2D` is a list of ops rather than a shape that\n * can be restated.\n */\n private rectState() {\n return {\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n start: this.start,\n end: this.end,\n };\n }\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().rect(this.rectState());\n }\n\n /**\n * The overlay, **clipped to the picture's own alpha** rather than to the\n * node's box.\n *\n * {@link ShapeNode} fills the silhouette, which for a media node is its rect\n * — and on a cut-out PNG that is the wrong shape by a wide margin: a wash\n * meant to tint the subject floods the transparent surround, so the whole\n * box turns colour. Not a subtle error.\n *\n * So the picture is declared as an **alpha mask** and the overlay as the\n * content inside it. `MaskMode.alpha` is the mask machinery's default and is\n * exactly this operation, so the renderer had nothing new to learn.\n *\n * A media node with no source paints no overlay at all: there is nothing\n * drawn to lay anything over, and falling back to the box would reintroduce\n * the bug precisely where it is most visible.\n */\n protected override renderOverlay(ctx: RenderContext2D): void {\n const overlay = this.overlay as FillResolved[];\n if (overlay.length === 0) return;\n const picture = (this.syncVideo(), this._video);\n if (!picture) return;\n\n ctx.draw(\n new Graphics2D()\n .mask()\n .rect(this.rectState())\n .fill([picture as unknown as FillProp])\n .applyMask()\n .rect(this.rectState())\n .fill(overlay as unknown as FillProp[])\n .endMask(),\n );\n }\n\n protected override renderSelf(draw: RenderContext2D): void {\n this.syncVideo();\n // Paint the video fill first (so it sits behind any user-supplied `fill`\n // layers — a tint or vignette over the frame), styled as the rect's fill.\n // Stroke is deferred to renderStroke (drawn after children + overlay), so\n // an overlay texture lands over the video and under the frame.\n // No clip chosen: the same empty slot an image node draws, and the same\n // pattern. An *image* fill rather than a video\n // one, because what it paints is identical and one placeholder is one\n // thing to keep in step.\n const fills: FillProp[] = [(this._video ?? UNSET_MEDIA_FILL) as FillProp];\n fills.push(...(this.fill as unknown as FillProp[]));\n\n draw.draw(this.shapeGraphics().shadow(this.shadow).fill(fills));\n }\n\n override dispose(): void {\n this._video = null;\n this._videoKey = \"\";\n super.dispose();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"video-node.js","sourceRoot":"","sources":["../../../src/nodes/media/video-node.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAmB,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAMtE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAoC,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAChH,OAAO,EAAE,IAAI,EAAa,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAKjF,OAAO,EAAE,S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AAE,KAAK,EAAE,CAAC;oCAAwB;AAE7C;IADP,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;2CACd;AACC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;kCAAsB;AASpB;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;uCAA2C","sourcesContent":["import { RenderContext2D } from \"@/render/render-context2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { VideoAdjustment, resolveChainAdjustments } from \"@/attributes/shape/filters/chain\";\r\nimport { lerpFilterArray } from \"@/attributes/shape/filters/registry\";\r\nimport { MediaAdjustment, VideoOnlyAdjustment } from \"@/attributes/shape/filters/union\";\r\nimport { ImageCrop, ImageFit, ImageMatrix } from \"@/attributes/shape/fill/implementations/image\";\r\nimport { Alignment } from \"@/attributes/layout/alignment\";\r\nimport { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { alignmentProperty, insetsProperty } from \"@/attributes/properties/typed\";\r\nimport { VideoFillProp, VideoFillResolved, sourceTimeFor } from \"@/attributes/shape/fill/implementations/video\";\r\nimport { Rect, RectProps } from \"../geometry/rect-node\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { resolveFill, UNSET_MEDIA_FILL } from \"@/attributes/shape/fill/registry\";\r\nimport { FillProp, FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { AudioBusStop } from \"@/attributes/audio/request\";\r\nimport type { AudioScope } from \"@/attributes/audio/schedule\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\nimport { busPathTo, findBusById } from \"@/nodes/audio/node-audio\";\r\nimport { AudioFilterItem } from \"@/attributes/audio/filters/union\";\r\nimport { AudioFilter, resolveAudioFilters, AudioFilters } from \"@/attributes/audio/filters/chain\";\r\n\r\nexport interface VideoProps extends RectProps {\r\n src?: string;\r\n /** How the (cropped) frame is scaled into the node's bounds. Default 'fill'. */\r\n fit?: ImageFit;\r\n /** Window onto the source frame, in fractions of its own size, applied before `fit`. */\r\n crop?: ImageCrop;\r\n /** Magnification on top of the fitted scale. `1` (default) is the fitted size. */\r\n zoom?: number;\r\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\r\n anchor?: Alignment;\r\n /** Raw frame→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\r\n matrix?: ImageMatrix;\r\n /** Visual filters applied to the rendered frame (blur, color, posterizeTime, echo, …). */\r\n filters?: VideoAdjustment;\r\n /** Whether playback advances with the node's clock (drives both picture and sound). Default true. */\r\n playing?: boolean;\r\n /**\r\n * Explicit source time to show, in seconds. Omit it (the default) and the\r\n * picture is timed from the moment this node appeared; set it to drive the\r\n * playhead yourself, and set it to `null` to hand the playhead back to the\r\n * clock (`set()` merges a partial, so `undefined` won't clear it).\r\n */\r\n timestamp?: number | null;\r\n trimStart?: number;\r\n trimEnd?: number;\r\n /** Playback-rate multiplier for both picture and audio. Default 1. */\r\n speed?: number;\r\n loop?: 'forward' | 'reverse' | 'none';\r\n /** Length of one loop cycle, in seconds. Defaults to the trimmed clip length. */\r\n duration?: number;\r\n /** Audio volume in [0, 1]. Default 1. */\r\n volume?: number;\r\n /** Silence the video's audio track without affecting the picture. Default false. */\r\n muted?: boolean;\r\n /** Audio filters applied to the video's sound track (gain, eq, echo, …). */\r\n audioFilters?: AudioFilter;\r\n /**\r\n * The node id of an `AudioBus` in this clip to route the video's sound into.\r\n *\r\n * A `Video` is a `Node2D`, so it cannot be parented under a bus the way a\r\n * `SoundNode` is — its audio is welded to its picture, which has to stay in\r\n * the visual tree. Naming one instead is what lets a video's dialogue sit on\r\n * the same bus as everything else, so ducking the whole group is still one\r\n * edit — and it is the *same* id a `SoundNode` under that bus writes as its\r\n * `parentId`, rather than a second vocabulary for \"which bus\". An id matching\r\n * no bus routes straight to the master, the same as no bus at all.\r\n */\r\n bus?: string;\r\n /**\r\n * An explicit **playback schedule**: the stretches of this node's own clock\r\n * during which the clip advances, and where in the source each one starts.\r\n *\r\n * Omit it (the default) and playback is what it has always been — the clip\r\n * runs from the moment the node appears, at `speed`, until it or the node\r\n * runs out. Give it, and `playing`/`timestamp` are both superseded: the\r\n * picture takes its source time from whichever segment covers the current\r\n * `elapsed`, and the sound is scheduled one clip per segment.\r\n *\r\n * It exists because a **pause** cannot be expressed any other way. `playing:\r\n * false` holds the clip's *first* frame, because with playback derived\r\n * linearly from the clock there is nothing else it could hold; and the sound\r\n * runs on the node's own clock regardless, so a picture frozen by any means\r\n * would drift away from it. A schedule states the one thing both halves need\r\n * and neither could infer — that a paused stretch consumes no source — so\r\n * they cannot come apart.\r\n *\r\n * Still a pure function of the clock, which is the property everything else\r\n * here is built on: frame *N* is identical however the playhead reached it,\r\n * so a scrub, a playthrough and an export agree.\r\n */\r\n segments?: readonly VideoSegment[];\r\n\r\n}\r\n\r\n/**\r\n * One stretch of a {@link Video}'s own clock during which its source advances —\r\n * see {@link VideoProps.segments}.\r\n *\r\n * Trim and loop are applied *on top* of this, by the same code that applies them\r\n * to unscheduled playback, so a schedule says when the clip is running and the\r\n * clip's own props go on saying which part of the file it is running through.\r\n */\r\nexport interface VideoSegment {\r\n /** Second on the node's own clock (`NodeTime.elapsed`) this segment begins. */\r\n at: number;\r\n /** Source in-point for it, in seconds. */\r\n from: number;\r\n /**\r\n * How long it runs, in seconds of the node's clock.\r\n *\r\n * `Infinity` for a clip left running — the same open sentinel\r\n * `AudioRequest.endAt` uses — which resolves against the clip's length.\r\n */\r\n duration: number;\r\n /** Playback rate through it. Defaults to the node's own `speed`. */\r\n speed?: number;\r\n /** Linear gain for its sound. Defaults to the node's own `volume`. */\r\n volume?: number;\r\n}\r\n\r\n/**\r\n * A video. Layout and child positioning are inherited wholesale from\r\n * {@link Rect} — a Video lays out its children exactly like a Rect, just with a\r\n * *playing* video painted in place of the rect's fill. The\r\n * frame is drawn through a `video` fill, which resolves the source time to show\r\n * from this node's clock as it paints.\r\n *\r\n * It is the one media class left, and the reason it is a class where a still\r\n * picture is now just an `image` fill: a Video plays its own audio track,\r\n * declared as a clip of the same file trimmed/sped/looped to match the picture.\r\n * Set `muted` to drop the sound while keeping the picture; `playing: false`\r\n * freezes both.\r\n */\r\nexport class Video extends Rect<VideoProps> {\r\n\r\n @property() declare src?: string;\r\n @property() declare fit?: ImageFit;\r\n @insetsProperty() declare crop: ImageCrop;\r\n @property({ default: 1 }) declare zoom: number;\r\n @alignmentProperty() declare anchor: Alignment;\r\n @property() declare matrix?: ImageMatrix;\r\n @property({ default: [], tween: lerpFilterArray, mapper: resolveChainAdjustments })\r\n declare filters?: (MediaAdjustment | VideoOnlyAdjustment)[];\r\n\r\n @property({ default: true }) declare playing: boolean;\r\n @property() declare timestamp?: number | null;\r\n @property() declare trimStart?: number;\r\n @property() declare trimEnd?: number;\r\n @property() declare speed?: number;\r\n @property() declare loop?: 'forward' | 'reverse' | 'none';\r\n @property() declare duration?: number;\r\n\r\n @property({ default: 1 }) declare volume: number;\r\n @property({ default: false }) declare muted: boolean;\r\n @property({ default: [], mapper: resolveAudioFilters })\r\n declare audioFilters?: AudioFilterItem[];\r\n @property({ default: undefined }) declare bus?: string;\r\n\r\n /**\r\n * The playback schedule — see {@link VideoProps.segments}.\r\n *\r\n * Not tweenable, and not a mistake: there is no halfway between two\r\n * schedules. What moves over time is the playhead *within* one, which is\r\n * what the schedule describes.\r\n */\r\n @property({ default: [] }) declare segments: readonly VideoSegment[];\r\n\r\n /**\r\n * The `video` fill state `renderSelf` paints — so the picture reuses the\r\n * exact playback model authors get from `Fills.video(...)`, rather than\r\n * re-deriving timestamps here. The fill carries no timestamp of its own: it\r\n * resolves one as it paints, from this node's clock. Rebuilt from props when\r\n * the source or any playback knob changes (see {@link videoKey}).\r\n */\r\n private _video: VideoFillResolved | null = null;\r\n private _videoKey: string = \"\";\r\n\r\n constructor(props: NodeConfig<Video, VideoProps>) {\r\n super(props as NodeConfig<Rect, RectProps>);\r\n }\r\n\r\n /**\r\n * Seconds of source the schedule has consumed by `elapsed`, or `null` when\r\n * there is no schedule.\r\n *\r\n * The whole of what a schedule *means*: a playing stretch consumes its own\r\n * length times its rate, a paused one consumes nothing, and the answer is\r\n * accumulated from the front every time rather than remembered — which is\r\n * what keeps it identical at every seek. The lists here are short (one entry\r\n * per play command), and the walk stops at the first segment that has not\r\n * started, so this is cheaper than the cached fill it feeds.\r\n */\r\n private playedAt(elapsed: number): number | null {\r\n const segments = this.segments;\r\n if (!segments || segments.length === 0) return null;\r\n\r\n let played = 0;\r\n for (const segment of segments) {\r\n if (elapsed <= segment.at) break;\r\n const speed = segment.speed ?? this.speed ?? 1;\r\n // `Infinity` on the last segment resolves to \"everything left\",\r\n // which `Math.min` gives without a branch: the clip is clamped\r\n // against its own trim by `sourceTimeFor` a moment later.\r\n played += Math.min(elapsed - segment.at, segment.duration) * speed;\r\n }\r\n return played;\r\n }\r\n\r\n /**\r\n * The source time the schedule puts the picture at, or `undefined` to leave\r\n * the fill deriving one for itself.\r\n *\r\n * The offset each segment starts from is folded in as `from - trimStart`, so\r\n * a schedule whose first segment enters the clip part-way through does what\r\n * it says while trim and loop still mean what they mean. That is why this\r\n * hands back a source time rather than a `playStart`: an offset can express\r\n * \"start later\", and only an explicit time can express \"and stop here\".\r\n */\r\n private scheduledTimestamp(): number | undefined {\r\n const played = this.playedAt(this.time.elapsed);\r\n if (played === null) return undefined;\r\n const start = this.trimStart ?? 0;\r\n const first = this.segments[0];\r\n const entry = first ? first.from - start : 0;\r\n return sourceTimeFor(\r\n played + entry,\r\n start,\r\n this.trimEnd ?? Infinity,\r\n this.loop,\r\n this.duration,\r\n );\r\n }\r\n\r\n /** Identity of the props that define the video fill; a change rebuilds it. */\r\n private videoKey(): string {\r\n // `crop`/`anchor` read back resolved (an object), so they are flattened\r\n // here rather than stringified — a tweened crop changes every frame and\r\n // must invalidate the cached fill, or the picture would freeze mid-tween.\r\n const crop = this.crop as InsetsResolved;\r\n const anchor = this.anchor as unknown as Vector2;\r\n return [\r\n this.src ?? '', this.fit ?? '', this.zoom, this.playing ? 1 : 0,\r\n crop.left, crop.right, crop.top, crop.bottom, anchor.x, anchor.y,\r\n this.timestamp ?? '', this.trimStart ?? '', this.trimEnd ?? '',\r\n this.speed ?? '', this.loop ?? '', this.duration ?? '',\r\n // The schedule's answer changes every frame while the clip runs, so\r\n // it belongs in the key for the same reason a tweened crop does: a\r\n // fill cached across it would freeze the picture mid-playback.\r\n this.scheduledTimestamp() ?? '',\r\n ].join('|');\r\n }\r\n\r\n /** (Re)build the resolved video fill from current props. */\r\n private syncVideo(): void {\r\n if (!this.src) {\r\n this._video = null;\r\n this._videoKey = \"\";\r\n return;\r\n }\r\n const key = this.videoKey();\r\n if (key === this._videoKey && this._video) return;\r\n this._videoKey = key;\r\n const prop: VideoFillProp = {\r\n type: 'video',\r\n src: this.src,\r\n fit: this.fit,\r\n crop: this.crop,\r\n zoom: this.zoom,\r\n anchor: this.anchor,\r\n matrix: this.matrix,\r\n filters: this.filters,\r\n playing: this.playing,\r\n // A schedule supersedes both: what it resolves *is* the playhead,\r\n // and it already carries whether the clip is running. An authored\r\n // `timestamp` still wins over it, since that is the author driving\r\n // the playhead by hand and this is the document driving it by chain.\r\n timestamp: this.timestamp ?? this.scheduledTimestamp(),\r\n trimStart: this.trimStart,\r\n trimEnd: this.trimEnd,\r\n speed: this.speed,\r\n loop: this.loop,\r\n duration: this.duration,\r\n };\r\n this._video = resolveFill(prop as FillProp) as VideoFillResolved;\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n if (!this.src) return;\r\n // Not `syncVideo()`: its timestamp reads the clock, and what loads never depends on the playhead.\r\n assets.fill(resolveFill({\r\n type: 'video',\r\n src: this.src,\r\n filters: this.filters,\r\n trimStart: this.trimStart,\r\n trimEnd: this.trimEnd,\r\n } as FillProp) as VideoFillResolved);\r\n }\r\n\r\n /**\r\n * The sound track: one clip, or one per segment when a schedule drives\r\n * playback — cut from the source where the picture reads, so a pause is\r\n * silent rather than sound running on under a frozen frame.\r\n */\r\n override declareAudio(audio: AudioScope): void {\r\n const src = this.src;\r\n if (!src || this.muted) return;\r\n const bus = this._busPath(audio);\r\n\r\n if (this.segments.length > 0) {\r\n const clipEnd = this.trimEnd ?? audio.catalog.getMediaDuration(src);\r\n for (const segment of this.segments) {\r\n const speed = segment.speed ?? this.speed ?? 1;\r\n const from = segment.from;\r\n const to = Math.min(clipEnd, from + segment.duration * speed);\r\n // A zero-length request is one the mixer schedules and immediately stops.\r\n if (!(to > from)) continue;\r\n audio.clip({\r\n src,\r\n // A segment's `at` is on the node's own clock, which starts as it enters.\r\n at: audio.span.start + segment.at,\r\n volume: segment.volume ?? this.volume,\r\n trimStart: from,\r\n trimEnd: to,\r\n filters: this._soundFilters(speed),\r\n bus,\r\n optional: true,\r\n });\r\n }\r\n return;\r\n }\r\n\r\n // With a schedule `playing` says nothing; without one, paused is silent.\r\n if (!this.playing) return;\r\n const loop = (this.loop ?? 'none') !== 'none';\r\n audio.clip({\r\n src,\r\n volume: this.volume,\r\n loop,\r\n trimStart: this.trimStart,\r\n // Resolved against the video's own length, so an unlooped clip ends\r\n // with its picture rather than running on as an open bed.\r\n trimEnd: this.trimEnd ?? (loop ? undefined : audio.catalog.getMediaDuration(src)),\r\n filters: this._soundFilters(this.speed ?? 1),\r\n bus,\r\n optional: true,\r\n });\r\n }\r\n\r\n /** `speed` as a filter ahead of the node's own audio filters. */\r\n private _soundFilters(speed: number): AudioFilterItem[] {\r\n const filters: AudioFilterItem[] = [];\r\n if (speed !== 1) filters.push(...resolveAudioFilters(AudioFilters.speed(speed)));\r\n filters.push(...this.audioFilters!);\r\n return filters;\r\n }\r\n\r\n /** The bus chain {@link VideoProps.bus} names. */\r\n private _busPath(audio: AudioScope): AudioBusStop[] | undefined {\r\n if (!this.bus) return undefined;\r\n const target = findBusById(this, this.bus);\r\n return target ? busPathTo(target, audio) : undefined;\r\n }\r\n\r\n\r\n /**\r\n * The node's box, as the rect state every pass declares.\r\n *\r\n * Split out of {@link shapeGraphics} because the overlay has to declare the\r\n * same rectangle **twice** inside one mask scope — once as the mask, once as\r\n * the content — and a `Graphics2D` is a list of ops rather than a shape that\r\n * can be restated.\r\n */\r\n private rectState() {\r\n return {\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n start: this.start,\r\n end: this.end,\r\n };\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().rect(this.rectState());\r\n }\r\n\r\n /**\r\n * The overlay, **clipped to the picture's own alpha** rather than to the\r\n * node's box.\r\n *\r\n * {@link ShapeNode} fills the silhouette, which for a media node is its rect\r\n * — and on a cut-out PNG that is the wrong shape by a wide margin: a wash\r\n * meant to tint the subject floods the transparent surround, so the whole\r\n * box turns colour. Not a subtle error.\r\n *\r\n * So the picture is declared as an **alpha mask** and the overlay as the\r\n * content inside it. `MaskMode.alpha` is the mask machinery's default and is\r\n * exactly this operation, so the renderer had nothing new to learn.\r\n *\r\n * A media node with no source paints no overlay at all: there is nothing\r\n * drawn to lay anything over, and falling back to the box would reintroduce\r\n * the bug precisely where it is most visible.\r\n */\r\n protected override renderOverlay(ctx: RenderContext2D): void {\r\n const overlay = this.overlay as FillResolved[];\r\n if (overlay.length === 0) return;\r\n const picture = (this.syncVideo(), this._video);\r\n if (!picture) return;\r\n\r\n ctx.draw(\r\n new Graphics2D()\r\n .mask()\r\n .rect(this.rectState())\r\n .fill([picture as unknown as FillProp])\r\n .applyMask()\r\n .rect(this.rectState())\r\n .fill(overlay as unknown as FillProp[])\r\n .endMask(),\r\n );\r\n }\r\n\r\n protected override renderSelf(draw: RenderContext2D): void {\r\n this.syncVideo();\r\n // Paint the video fill first (so it sits behind any user-supplied `fill`\r\n // layers — a tint or vignette over the frame), styled as the rect's fill.\r\n // Stroke is deferred to renderStroke (drawn after children + overlay), so\r\n // an overlay texture lands over the video and under the frame.\r\n // No clip chosen: the same empty slot an image node draws, and the same\r\n // pattern. An *image* fill rather than a video\r\n // one, because what it paints is identical and one placeholder is one\r\n // thing to keep in step.\r\n const fills: FillProp[] = [(this._video ?? UNSET_MEDIA_FILL) as FillProp];\r\n fills.push(...(this.fill as unknown as FillProp[]));\r\n\r\n draw.draw(this.shapeGraphics().shadow(this.shadow).fill(fills));\r\n }\r\n\r\n override dispose(): void {\r\n this._video = null;\r\n this._videoKey = \"\";\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declare-paints.js","sourceRoot":"","sources":["../../../src/nodes/node/declare-paints.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAkB,EAAE,KAAmB;IACjF,MAAM,OAAO,GAAG,CAAC,OAA8C,EAAQ,EAAE;QACvE,KAAK,MAAM,MAAM,IAAI,OAAO,IAAI,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9D,CAAC,CAAA;IAED,4EAA4E;IAC5E,MAAM,IAAI,GAAG,IAKZ,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;IAC/B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAEhE,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,KAAK,IAAI,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1D,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,EAAE;QAAE,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9D,CAAC","sourcesContent":["import type { AssetScope } from \"@/assets/scope\"\nimport type { FillResolved } from \"@/attributes/shape/fill/union\"\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\"\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\"\n\n/** The paints a node computes rather than stores, which no convention can find. */\nexport interface ExtraPaints {\n fills?: readonly FillResolved[][]\n strokes?: readonly StrokeResolved[][]\n}\n\n/**\n * Declare the assets of a node's paint props.\n *\n * `PaintNode` does this for the slots it owns. The chart and diagram internals\n * extend `Node` directly — they draw a raw `Graphics` and want none of a shape's\n * clip or layout — and so inherit no such declaration while still carrying\n * `fill`/`stroke`/`shadow` props of their own; an undeclared asset there is an\n * `AssetNotLoadedError` the moment the renderer reaches for it.\n */\nexport function declarePaints(node: object, assets: AssetScope, extra?: ExtraPaints): void {\n const stroked = (strokes: readonly StrokeResolved[] | undefined): void => {\n for (const stroke of strokes ?? []) assets.fill(stroke.fill)\n }\n\n // Conventional prop names, each already resolved by its `@property` mapper.\n const held = node as {\n fill?: FillResolved[]\n overlay?: FillResolved[]\n stroke?: StrokeResolved[]\n shadow?: ShadowResolved[]\n }\n assets.fill(held.fill ?? [])\n assets.fill(held.overlay ?? [])\n stroked(held.stroke)\n for (const shadow of held.shadow ?? []) assets.fill(shadow.fill)\n\n for (const fills of extra?.fills ?? []) assets.fill(fills)\n for (const strokes of extra?.strokes ?? []) stroked(strokes)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"declare-paints.js","sourceRoot":"","sources":["../../../src/nodes/node/declare-paints.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAkB,EAAE,KAAmB;IACjF,MAAM,OAAO,GAAG,CAAC,OAA8C,EAAQ,EAAE;QACvE,KAAK,MAAM,MAAM,IAAI,OAAO,IAAI,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9D,CAAC,CAAA;IAED,4EAA4E;IAC5E,MAAM,IAAI,GAAG,IAKZ,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAA;IAC/B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAEhE,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,KAAK,IAAI,EAAE;QAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1D,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,EAAE;QAAE,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9D,CAAC","sourcesContent":["import type { AssetScope } from \"@/assets/scope\"\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\"\r\nimport type { ShadowResolved } from \"@/attributes/shape/shadow/shadow\"\r\nimport type { StrokeResolved } from \"@/attributes/shape/stroke/stroke\"\r\n\r\n/** The paints a node computes rather than stores, which no convention can find. */\r\nexport interface ExtraPaints {\r\n fills?: readonly FillResolved[][]\r\n strokes?: readonly StrokeResolved[][]\r\n}\r\n\r\n/**\r\n * Declare the assets of a node's paint props.\r\n *\r\n * `PaintNode` does this for the slots it owns. The chart and diagram internals\r\n * extend `Node` directly — they draw a raw `Graphics` and want none of a shape's\r\n * clip or layout — and so inherit no such declaration while still carrying\r\n * `fill`/`stroke`/`shadow` props of their own; an undeclared asset there is an\r\n * `AssetNotLoadedError` the moment the renderer reaches for it.\r\n */\r\nexport function declarePaints(node: object, assets: AssetScope, extra?: ExtraPaints): void {\r\n const stroked = (strokes: readonly StrokeResolved[] | undefined): void => {\r\n for (const stroke of strokes ?? []) assets.fill(stroke.fill)\r\n }\r\n\r\n // Conventional prop names, each already resolved by its `@property` mapper.\r\n const held = node as {\r\n fill?: FillResolved[]\r\n overlay?: FillResolved[]\r\n stroke?: StrokeResolved[]\r\n shadow?: ShadowResolved[]\r\n }\r\n assets.fill(held.fill ?? [])\r\n assets.fill(held.overlay ?? [])\r\n stroked(held.stroke)\r\n for (const shadow of held.shadow ?? []) assets.fill(shadow.fill)\r\n\r\n for (const fills of extra?.fills ?? []) assets.fill(fills)\r\n for (const strokes of extra?.strokes ?? []) stroked(strokes)\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-editor-state.js","sourceRoot":"","sources":["../../../src/nodes/node/node-editor-state.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAU,EAAE,MAAoC;IAC9E,MAAM,IAAI,GAAG,CAAC,IAAU,EAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { Node } from \"./node\";\n\n/**\n * What an editor says about one node, as against what the document says.\n *\n * Neither of these is a prop. They are not authored values, they do not tween,\n * they are not part of the scene's meaning — an exported frame is the same\n * whether or not the person who made it had a layer folded away. They are the\n * editor's view of the tree, so they arrive on the side and are applied over it.\n */\nexport interface NodeEditorState {\n /**\n * Hide the node and everything under it: no paint, no pick, and no layout\n * slot — a hidden child of a row gives up its cell and its gap, the way\n * `display: none` does rather than `visibility: hidden`.\n *\n * The node **stays in the tree**. Dropping it instead would renumber every\n * later sibling's structural path, which is what a host's boxes, its\n * lifespans and its picking are all keyed on.\n */\n hidden?: boolean;\n /**\n * Take the node out of reach of the pointer while leaving the picture\n * untouched — Figma's padlock.\n *\n * Not the opposite of {@link hidden} and not a weaker form of it. A locked\n * node still draws, still lays out, and still confines its children; what it\n * declines is being the *answer* to a pick. Its children stay pickable,\n * because locking a group is about the group.\n */\n locked?: boolean;\n}\n\n/**\n * Editor state for a whole tree, keyed by {@link Node.key}.\n *\n * A record rather than a list: the walk that applies it asks once per node, and\n * a host with a thousand-node scene should not pay a scan for each.\n */\nexport type NodeEditorStates = Record<string, NodeEditorState>;\n\n/**\n * Push `states` onto the tree under `root`.\n *\n * Resolved onto the nodes rather than consulted from them, so `render` and the\n * pick walk read a local field instead of probing a record they would first have\n * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which\n * is after the tree is built and before it is laid out — a node that appeared\n * this frame therefore gets its state on the same frame it appears.\n *\n * A node with no `key`, or a key the record does not mention, is reset rather\n * than left alone: the record is the whole truth about editor state, so a key\n * dropped from it is a node unhidden.\n */\nexport function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void {\n const walk = (node: Node): void => {\n const state = node.key !== undefined ? states?.[node.key] : undefined;\n node._setEditorState(state?.hidden === true, state?.locked === true);\n for (const child of node._allChildren) walk(child);\n };\n walk(root);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-editor-state.js","sourceRoot":"","sources":["../../../src/nodes/node/node-editor-state.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAU,EAAE,MAAoC;IAC9E,MAAM,IAAI,GAAG,CAAC,IAAU,EAAQ,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { Node } from \"./node\";\r\n\r\n/**\r\n * What an editor says about one node, as against what the document says.\r\n *\r\n * Neither of these is a prop. They are not authored values, they do not tween,\r\n * they are not part of the scene's meaning — an exported frame is the same\r\n * whether or not the person who made it had a layer folded away. They are the\r\n * editor's view of the tree, so they arrive on the side and are applied over it.\r\n */\r\nexport interface NodeEditorState {\r\n /**\r\n * Hide the node and everything under it: no paint, no pick, and no layout\r\n * slot — a hidden child of a row gives up its cell and its gap, the way\r\n * `display: none` does rather than `visibility: hidden`.\r\n *\r\n * The node **stays in the tree**. Dropping it instead would renumber every\r\n * later sibling's structural path, which is what a host's boxes, its\r\n * lifespans and its picking are all keyed on.\r\n */\r\n hidden?: boolean;\r\n /**\r\n * Take the node out of reach of the pointer while leaving the picture\r\n * untouched — Figma's padlock.\r\n *\r\n * Not the opposite of {@link hidden} and not a weaker form of it. A locked\r\n * node still draws, still lays out, and still confines its children; what it\r\n * declines is being the *answer* to a pick. Its children stay pickable,\r\n * because locking a group is about the group.\r\n */\r\n locked?: boolean;\r\n}\r\n\r\n/**\r\n * Editor state for a whole tree, keyed by {@link Node.key}.\r\n *\r\n * A record rather than a list: the walk that applies it asks once per node, and\r\n * a host with a thousand-node scene should not pay a scan for each.\r\n */\r\nexport type NodeEditorStates = Record<string, NodeEditorState>;\r\n\r\n/**\r\n * Push `states` onto the tree under `root`.\r\n *\r\n * Resolved onto the nodes rather than consulted from them, so `render` and the\r\n * pick walk read a local field instead of probing a record they would first have\r\n * to reach the scene to find. Called once per frame from `ClipInstance.attach`, which\r\n * is after the tree is built and before it is laid out — a node that appeared\r\n * this frame therefore gets its state on the same frame it appears.\r\n *\r\n * A node with no `key`, or a key the record does not mention, is reset rather\r\n * than left alone: the record is the whole truth about editor state, so a key\r\n * dropped from it is a node unhidden.\r\n */\r\nexport function applyEditorStates(root: Node, states: NodeEditorStates | undefined): void {\r\n const walk = (node: Node): void => {\r\n const state = node.key !== undefined ? states?.[node.key] : undefined;\r\n node._setEditorState(state?.hidden === true, state?.locked === true);\r\n for (const child of node._allChildren) walk(child);\r\n };\r\n walk(root);\r\n}\r\n"]}
|