@motionscript/core 0.1.0-alpha.0 → 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 +282 -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 +93 -11
- 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 +32 -4
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +9 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +11 -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.d.ts +1 -0
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +1 -0
- 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 +17 -6
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +26 -14
- 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.d.ts +9 -1
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +12 -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 +3 -3
- 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.d.ts.map +1 -1
- package/dist/document/command-traits.js +17 -3
- 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 +34 -16
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +51 -12
- 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 +188 -32
- 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.d.ts +3 -2
- package/dist/nodes/audio/node-audio.d.ts.map +1 -1
- package/dist/nodes/audio/node-audio.js +8 -5
- 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 +2 -2
- 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 +5 -3
- 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 +10 -3
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.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 +5 -5
- 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.d.ts +2 -2
- package/dist/render3d/resources.js +2 -2
- 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.d.ts +2 -2
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +8 -2
- 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 +33 -3
- 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 +27 -22
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +23 -9
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +12 -4
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +10 -22
- 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 +12 -1
- package/dist/tween/seekable.d.ts.map +1 -1
- package/dist/tween/seekable.js +15 -0
- 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-P3XQCHDW.js +0 -16
- package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
- package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
- package/dist/browser/chunks/chunk-VJQMKHGQ.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,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AAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;SACxG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC;SAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvC,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\nimport type { FontStyle } from \"@/attributes/text/types\";\nimport type { Text } from \"./text-node\";\n\n/**\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\n *\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\n * selection that never touches its size reports the number that block is\n * actually shaped at rather than a second, different guess.\n */\nexport const AUTOFIT_PROBE_SIZE = 100;\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\n\n/** A half-open character range `[start, end)` of a Text node's string. */\nexport interface TextRange {\n start: number;\n end: number;\n}\n\n/**\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\n * before tweening (mirroring how {@link Text} resolves its own paint).\n *\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\n * anyway: what a selection is for is styling a run differently from its\n * neighbours, and a model that can change a word's weight but not its face is\n * one an editor has to work around rather than with. They switch at the end of a\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\n * the same reason a blend mode does: there is no half-way between two typefaces,\n * and inventing one would be a frame of text set in neither.\n */\nexport interface TextSelectionProps {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: Fill;\n stroke: Stroke;\n}\n\n/**\n * Live, resolved override state for a selection, read by the Text node each\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\n * meaning \"inherit the node's paint\".\n */\nexport interface SelectionOverrides {\n opacity: number;\n x: number;\n y: number;\n scale: number;\n rotation: number;\n fontFamily: string;\n fontSize: number;\n fontStyle: FontStyle;\n fontWeight: number;\n letterSpacing: number;\n fill: FillResolved[] | null;\n stroke: StrokeResolved[] | null;\n}\n\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\n\n/**\n * A sub-range of a {@link Text} node's glyphs that can be animated\n * independently. Returned by the node's selector methods (`find`, `match`,\n * `line`, `word`, `words`, `slice`, `filter`).\n *\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\n * plugs straight into the existing `Command` / `parallel` / `sequence`\n * machinery — each tween writes resolved values into {@link overrides}, which\n * the node reads when splitting its text into rendered pieces.\n *\n * @example\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\n */\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\n readonly node: Text;\n readonly ranges: TextRange[];\n\n /**\n * Current resolved overrides for this selection. Numeric fields default to\n * the node's current values (so a partial tween starts from the node's\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\n */\n readonly overrides: SelectionOverrides;\n\n constructor(node: Text, ranges: TextRange[]) {\n this.node = node;\n this.ranges = normalizeRanges(ranges, node.text.length);\n this.overrides = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n rotation: 0,\n fontFamily: node.fontFamily,\n // `'autofit'` is a *box* decision - the size the whole block settles\n // on - so it is not a per-run value at all. A selection on an autofit\n // node starts from the probe size the segmented layout shapes with,\n // and overriding it there is what \"this word, two sizes up\" means.\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\n fontStyle: node.fontStyle,\n fontWeight: node.fontWeight,\n letterSpacing: node.letterSpacing,\n fill: null,\n stroke: null,\n };\n node._registerSelection(this);\n }\n\n /** True when this selection has no overrides differing from the node default. */\n get isIdentity(): boolean {\n const o = this.overrides;\n const nodeSize = typeof this.node.fontSize === \"number\"\n ? this.node.fontSize\n : AUTOFIT_PROBE_SIZE;\n return (\n o.opacity === 1 &&\n o.x === 0 &&\n o.y === 0 &&\n o.scale === 1 &&\n o.rotation === 0 &&\n o.fontFamily === this.node.fontFamily &&\n o.fontSize === nodeSize &&\n o.fontStyle === this.node.fontStyle &&\n o.fontWeight === this.node.fontWeight &&\n o.letterSpacing === this.node.letterSpacing &&\n o.fill === null &&\n o.stroke === null\n );\n }\n\n /**\n * Write overrides straight onto the selection - no tween, no command.\n *\n * `to()` is the animation door and this is the *styling* one: an editor that\n * paints one word red is stating what the run **is**, not scheduling it, and\n * a zero-length `to()` would say the same thing while also landing a step on\n * the node's timeline for something that never moves. Paints are resolved\n * here exactly as `to()` resolves them, so a run styled this way and a run\n * tweened to the same value hold identical resolved arrays.\n *\n * Returns `this`, so a range and its style read as one expression.\n */\n set(props: Partial<TextSelectionProps>): this {\n const o = this.overrides;\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\n const value = props[key];\n if (value === undefined) continue;\n if (key === \"fill\") {\n o.fill = fillOps.resolve(value as Fill);\n } else if (key === \"stroke\") {\n o.stroke = strokeOps.resolve(value as Stroke);\n } else if (DISCRETE_KEYS.has(key)) {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\n } else if (typeof value === \"number\") {\n (o[key as \"opacity\"] as number) = value;\n }\n }\n return this;\n }\n\n @command()\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\n args: CommandArgs<D> & { duration: number },\n ): Command<TextSelectionProps> {\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\n }\n\n /**\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\n * directly; `fill`/`stroke` resolve their target once and lerp via the\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\n */\n _prepareStep(\n to: Partial<TextSelectionProps>,\n duration: number,\n easing?: EasingFunction,\n ): TweenStepper {\n const o = this.overrides;\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\n const customLerps: Array<(t: number) => void> = [];\n\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\n const target = to[key];\n if (target === undefined) continue;\n\n if (key === 'fill') {\n const from = o.fill ?? (this.node.fill as FillResolved[]);\n const resolved = fillOps.resolve(target as Fill);\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\n } else if (key === 'stroke') {\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\n const resolved = strokeOps.resolve(target as Stroke);\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\n } else if (DISCRETE_KEYS.has(key)) {\n // No half-way between two faces: hold the old one until the step\n // completes, then switch. `apply(1)` runs on the seek and the\n // advance paths alike, so a scrub past the end lands on it too.\n const next = target as string;\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\n customLerps.push((t) => {\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\n });\n } else if (typeof target === 'number') {\n const k = key as keyof SelectionOverrides;\n numeric.push({ key: k, from: o[k] as number, to: target });\n }\n }\n\n const apply = (t: number): void => {\n const easedT = easing ? easing(t) : t;\n for (const n of numeric) {\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\n }\n for (const fn of customLerps) fn(easedT);\n };\n\n let elapsed = 0;\n return {\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\n advance: (dt: number): boolean => {\n elapsed += dt;\n if (elapsed < duration) {\n apply(elapsed / duration);\n return false;\n }\n apply(1);\n return true;\n },\n };\n }\n}\n\n/**\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\n * that touch or overlap so each glyph is covered once per selection. The\n * relative order selections were *created* in is preserved across selections by\n * the node's registry, not here.\n */\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\n const clamped = ranges\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\n .filter(r => r.end > r.start)\n .sort((a, b) => a.start - b.start);\n\n const merged: TextRange[] = [];\n for (const r of clamped) {\n const last = merged[merged.length - 1];\n if (last && r.start <= last.end) {\n last.end = Math.max(last.end, r.end);\n } else {\n merged.push({ ...r });\n }\n }\n return merged;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"text-selection.js","sourceRoot":"","sources":["../../../src/nodes/text/text-selection.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAA0B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C;SACxG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC;SAC5B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAEvC,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACvC,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { EasingFunction } from \"@/tween/ease/type\";\r\nimport { TweenStepper } from \"@/tween/stepper\";\r\nimport { toCommand, type AnimationTarget } from \"@/tween/to-command\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport { Stroke, StrokeResolved, strokeOps } from \"@/attributes/shape/stroke/stroke\";\r\nimport type { FontStyle } from \"@/attributes/text/types\";\r\nimport type { Text } from \"./text-node\";\r\n\r\n/**\r\n * The size a selection's `fontSize` starts from on an `'autofit'` node.\r\n *\r\n * The same 100 the segmented layout probes with (`layoutTextSegments`), so a\r\n * selection that never touches its size reports the number that block is\r\n * actually shaped at rather than a second, different guess.\r\n */\r\nexport const AUTOFIT_PROBE_SIZE = 100;\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\n\r\n/** A half-open character range `[start, end)` of a Text node's string. */\r\nexport interface TextRange {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/**\r\n * Properties a {@link TextSelection} can animate. Transform/opacity/font fields\r\n * are numeric; `fill`/`stroke` accept any author-facing paint and are resolved\r\n * before tweening (mirroring how {@link Text} resolves its own paint).\r\n *\r\n * `fontFamily` and `fontStyle` are the two that cannot tween, and they are here\r\n * anyway: what a selection is for is styling a run differently from its\r\n * neighbours, and a model that can change a word's weight but not its face is\r\n * one an editor has to work around rather than with. They switch at the end of a\r\n * step rather than interpolating - see {@link TextSelection._prepareStep} - for\r\n * the same reason a blend mode does: there is no half-way between two typefaces,\r\n * and inventing one would be a frame of text set in neither.\r\n */\r\nexport interface TextSelectionProps {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: Fill;\r\n stroke: Stroke;\r\n}\r\n\r\n/**\r\n * Live, resolved override state for a selection, read by the Text node each\r\n * frame to build per-piece segments. `fill`/`stroke` are `null` until set,\r\n * meaning \"inherit the node's paint\".\r\n */\r\nexport interface SelectionOverrides {\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n fontFamily: string;\r\n fontSize: number;\r\n fontStyle: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n fill: FillResolved[] | null;\r\n stroke: StrokeResolved[] | null;\r\n}\r\n\r\n/** The {@link SelectionOverrides} keys that hold a string rather than a number. */\r\nconst DISCRETE_KEYS = new Set<keyof TextSelectionProps>([\"fontFamily\", \"fontStyle\"]);\r\n\r\n/**\r\n * A sub-range of a {@link Text} node's glyphs that can be animated\r\n * independently. Returned by the node's selector methods (`find`, `match`,\r\n * `line`, `word`, `words`, `slice`, `filter`).\r\n *\r\n * Implements {@link AnimationTarget} so `selection.to({ ... }, duration)`\r\n * plugs straight into the existing `Command` / `parallel` / `sequence`\r\n * machinery — each tween writes resolved values into {@link overrides}, which\r\n * the node reads when splitting its text into rendered pieces.\r\n *\r\n * @example\r\n * textRef().find(\"hello\").to({ opacity: 0.5, y: -10 }, 1);\r\n */\r\nexport class TextSelection implements AnimationTarget<TextSelectionProps> {\r\n readonly node: Text;\r\n readonly ranges: TextRange[];\r\n\r\n /**\r\n * Current resolved overrides for this selection. Numeric fields default to\r\n * the node's current values (so a partial tween starts from the node's\r\n * style); `fill`/`stroke` start as `null` (inherit) until tweened.\r\n */\r\n readonly overrides: SelectionOverrides;\r\n\r\n constructor(node: Text, ranges: TextRange[]) {\r\n this.node = node;\r\n this.ranges = normalizeRanges(ranges, node.text.length);\r\n this.overrides = {\r\n opacity: 1,\r\n x: 0,\r\n y: 0,\r\n scale: 1,\r\n rotation: 0,\r\n fontFamily: node.fontFamily,\r\n // `'autofit'` is a *box* decision - the size the whole block settles\r\n // on - so it is not a per-run value at all. A selection on an autofit\r\n // node starts from the probe size the segmented layout shapes with,\r\n // and overriding it there is what \"this word, two sizes up\" means.\r\n fontSize: typeof node.fontSize === \"number\" ? node.fontSize : AUTOFIT_PROBE_SIZE,\r\n fontStyle: node.fontStyle,\r\n fontWeight: node.fontWeight,\r\n letterSpacing: node.letterSpacing,\r\n fill: null,\r\n stroke: null,\r\n };\r\n node._registerSelection(this);\r\n }\r\n\r\n /** True when this selection has no overrides differing from the node default. */\r\n get isIdentity(): boolean {\r\n const o = this.overrides;\r\n const nodeSize = typeof this.node.fontSize === \"number\"\r\n ? this.node.fontSize\r\n : AUTOFIT_PROBE_SIZE;\r\n return (\r\n o.opacity === 1 &&\r\n o.x === 0 &&\r\n o.y === 0 &&\r\n o.scale === 1 &&\r\n o.rotation === 0 &&\r\n o.fontFamily === this.node.fontFamily &&\r\n o.fontSize === nodeSize &&\r\n o.fontStyle === this.node.fontStyle &&\r\n o.fontWeight === this.node.fontWeight &&\r\n o.letterSpacing === this.node.letterSpacing &&\r\n o.fill === null &&\r\n o.stroke === null\r\n );\r\n }\r\n\r\n /**\r\n * Write overrides straight onto the selection - no tween, no command.\r\n *\r\n * `to()` is the animation door and this is the *styling* one: an editor that\r\n * paints one word red is stating what the run **is**, not scheduling it, and\r\n * a zero-length `to()` would say the same thing while also landing a step on\r\n * the node's timeline for something that never moves. Paints are resolved\r\n * here exactly as `to()` resolves them, so a run styled this way and a run\r\n * tweened to the same value hold identical resolved arrays.\r\n *\r\n * Returns `this`, so a range and its style read as one expression.\r\n */\r\n set(props: Partial<TextSelectionProps>): this {\r\n const o = this.overrides;\r\n for (const key of Object.keys(props) as Array<keyof TextSelectionProps>) {\r\n const value = props[key];\r\n if (value === undefined) continue;\r\n if (key === \"fill\") {\r\n o.fill = fillOps.resolve(value as Fill);\r\n } else if (key === \"stroke\") {\r\n o.stroke = strokeOps.resolve(value as Stroke);\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = value as string;\r\n } else if (typeof value === \"number\") {\r\n (o[key as \"opacity\"] as number) = value;\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n @command()\r\n to<D extends Partial<TextSelectionProps> = Partial<TextSelectionProps>>(\r\n args: CommandArgs<D> & { duration: number },\r\n ): Command<TextSelectionProps> {\r\n return toCommand<TextSelectionProps>(this, args.data ?? {}, args.duration, args.easing);\r\n }\r\n\r\n /**\r\n * Resolve one `to()` step into a flat {@link TweenStepper}. Numeric props\r\n * (opacity/x/y/scale/rotation/fontWeight/letterSpacing) interpolate\r\n * directly; `fill`/`stroke` resolve their target once and lerp via the\r\n * shared fill/stroke array lerps — mirroring {@link Node2D._prepareStep}.\r\n */\r\n _prepareStep(\r\n to: Partial<TextSelectionProps>,\r\n duration: number,\r\n easing?: EasingFunction,\r\n ): TweenStepper {\r\n const o = this.overrides;\r\n const numeric: Array<{ key: keyof SelectionOverrides; from: number; to: number }> = [];\r\n const customLerps: Array<(t: number) => void> = [];\r\n\r\n for (const key of Object.keys(to) as Array<keyof TextSelectionProps>) {\r\n const target = to[key];\r\n if (target === undefined) continue;\r\n\r\n if (key === 'fill') {\r\n const from = o.fill ?? (this.node.fill as FillResolved[]);\r\n const resolved = fillOps.resolve(target as Fill);\r\n customLerps.push((t) => { o.fill = fillOps.lerp(from, resolved, t); });\r\n } else if (key === 'stroke') {\r\n const from = o.stroke ?? (this.node.stroke as StrokeResolved[]);\r\n const resolved = strokeOps.resolve(target as Stroke);\r\n customLerps.push((t) => { o.stroke = strokeOps.lerp(from, resolved, t); });\r\n } else if (DISCRETE_KEYS.has(key)) {\r\n // No half-way between two faces: hold the old one until the step\r\n // completes, then switch. `apply(1)` runs on the seek and the\r\n // advance paths alike, so a scrub past the end lands on it too.\r\n const next = target as string;\r\n const previous = o[key as \"fontFamily\" | \"fontStyle\"];\r\n customLerps.push((t) => {\r\n (o[key as \"fontFamily\" | \"fontStyle\"] as string) = t >= 1 ? next : previous;\r\n });\r\n } else if (typeof target === 'number') {\r\n const k = key as keyof SelectionOverrides;\r\n numeric.push({ key: k, from: o[k] as number, to: target });\r\n }\r\n }\r\n\r\n const apply = (t: number): void => {\r\n const easedT = easing ? easing(t) : t;\r\n for (const n of numeric) {\r\n (o[n.key] as number) = n.from + (n.to - n.from) * easedT;\r\n }\r\n for (const fn of customLerps) fn(easedT);\r\n };\r\n\r\n let elapsed = 0;\r\n return {\r\n seek: (e: number) => apply(duration > 0 ? Math.min(e / duration, 1) : 1),\r\n advance: (dt: number): boolean => {\r\n elapsed += dt;\r\n if (elapsed < duration) {\r\n apply(elapsed / duration);\r\n return false;\r\n }\r\n apply(1);\r\n return true;\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Clamp ranges to `[0, length]`, drop empties, sort by start, and merge any\r\n * that touch or overlap so each glyph is covered once per selection. The\r\n * relative order selections were *created* in is preserved across selections by\r\n * the node's registry, not here.\r\n */\r\nexport function normalizeRanges(ranges: TextRange[], length: number): TextRange[] {\r\n const clamped = ranges\r\n .map(r => ({ start: Math.max(0, Math.min(r.start, length)), end: Math.max(0, Math.min(r.end, length)) }))\r\n .filter(r => r.end > r.start)\r\n .sort((a, b) => a.start - b.start);\r\n\r\n const merged: TextRange[] = [];\r\n for (const r of clamped) {\r\n const last = merged[merged.length - 1];\r\n if (last && r.start <= last.end) {\r\n last.end = Math.max(last.end, r.end);\r\n } else {\r\n merged.push({ ...r });\r\n }\r\n }\r\n return merged;\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Transform3D } from "../../render3d/transform.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type CameraData3D } from "../../render3d/camera.js";
|
|
3
|
+
import type { Command, CommandArgs } from "../../tween/command.js";
|
|
3
4
|
import type { RenderContext3D } from "../../render3d/render-context3d.js";
|
|
4
5
|
import type { Vector3Input } from "../../render3d/vector3.js";
|
|
5
6
|
import { Node3D, type Node3DProps } from "./node3d.js";
|
|
@@ -20,8 +21,7 @@ import { Node3D, type Node3DProps } from "./node3d.js";
|
|
|
20
21
|
* around the thing it is looking at, which is what a camera move almost always
|
|
21
22
|
* *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair
|
|
22
23
|
* recomputed every frame in a prop binding — which is exactly what every scene
|
|
23
|
-
* did before this existed
|
|
24
|
-
* independently reinvented `orbit`/`elevation`/`zoom` props to avoid.
|
|
24
|
+
* did before this existed.
|
|
25
25
|
*
|
|
26
26
|
* `position` and `lookAt` still work and are right for a shot pinned to
|
|
27
27
|
* something; setting any polar field takes over, so the two can never be half
|
|
@@ -73,6 +73,24 @@ export declare class Camera3D<P extends Camera3DProps = Camera3DProps> extends N
|
|
|
73
73
|
near: number | undefined;
|
|
74
74
|
far: number | undefined;
|
|
75
75
|
zoom: number | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Swing round {@link target}, and pull back or in, whichever are given. A
|
|
78
|
+
* camera not yet placed by its polar fields starts from what an unset one
|
|
79
|
+
* reads as.
|
|
80
|
+
*/
|
|
81
|
+
orbitTo(args: CommandArgs<{
|
|
82
|
+
orbit?: number;
|
|
83
|
+
elevation?: number;
|
|
84
|
+
distance?: number;
|
|
85
|
+
}> & {
|
|
86
|
+
duration: number;
|
|
87
|
+
}): Command<P>;
|
|
88
|
+
/** Turn to look at another point: animates {@link target}. */
|
|
89
|
+
lookTo(args: CommandArgs<{
|
|
90
|
+
target: Vector3Input;
|
|
91
|
+
}> & {
|
|
92
|
+
duration: number;
|
|
93
|
+
}): Command<P>;
|
|
76
94
|
/**
|
|
77
95
|
* A camera's group stays identity; the camera places itself.
|
|
78
96
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-nodes.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"camera-nodes.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAC9C,qDAAqD;IACrD,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;IACjC,qDAAqD;IACrD,K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AAW,CAAC;QAAE,MAAM,EAAE,YAAY,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAItF;;;;;;;;OAQG;cACgB,cAAc,IAAI,WAAW;IAIhD,SAAS,CAAC,WAAW,IAAI,YAAY;IASrC,4FAA4F;IACnF,aAAa,IAAI,IAAI;cAEX,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CAG5D"}
|
|
@@ -5,12 +5,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { property } from "../../attributes/properties/decorator.js";
|
|
8
|
+
import { optionalVector3Property } from "../../attributes/properties/typed.js";
|
|
9
|
+
import { ORBIT_CAMERA_DEFAULTS } from "../../render3d/camera.js";
|
|
10
|
+
import { command } from "../../tween/command-decorator.js";
|
|
8
11
|
import { Node3D } from "./node3d.js";
|
|
9
12
|
const CAMERA_KEYS = [
|
|
10
13
|
"target", "orbit", "elevation", "distance",
|
|
11
14
|
"fov", "frustumHeight", "near", "far", "zoom",
|
|
12
15
|
];
|
|
13
16
|
export class Camera3D extends Node3D {
|
|
17
|
+
/**
|
|
18
|
+
* Swing round {@link target}, and pull back or in, whichever are given. A
|
|
19
|
+
* camera not yet placed by its polar fields starts from what an unset one
|
|
20
|
+
* reads as.
|
|
21
|
+
*/
|
|
22
|
+
orbitTo(args) {
|
|
23
|
+
const to = args.data ?? {};
|
|
24
|
+
const from = {
|
|
25
|
+
orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,
|
|
26
|
+
elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,
|
|
27
|
+
distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,
|
|
28
|
+
};
|
|
29
|
+
return this.command((t) => {
|
|
30
|
+
const out = {};
|
|
31
|
+
for (const key of ["orbit", "elevation", "distance"]) {
|
|
32
|
+
const end = to[key];
|
|
33
|
+
if (end !== undefined)
|
|
34
|
+
out[key] = from[key] + (end - from[key]) * t;
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}, args.duration, args.easing);
|
|
38
|
+
}
|
|
39
|
+
/** Turn to look at another point: animates {@link target}. */
|
|
40
|
+
lookTo(args) {
|
|
41
|
+
return this.to({ data: args.data, duration: args.duration, easing: args.easing });
|
|
42
|
+
}
|
|
14
43
|
/**
|
|
15
44
|
* A camera's group stays identity; the camera places itself.
|
|
16
45
|
*
|
|
@@ -42,7 +71,7 @@ __decorate([
|
|
|
42
71
|
property({ default: "perspective" })
|
|
43
72
|
], Camera3D.prototype, "type", void 0);
|
|
44
73
|
__decorate([
|
|
45
|
-
|
|
74
|
+
optionalVector3Property("origin")
|
|
46
75
|
], Camera3D.prototype, "target", void 0);
|
|
47
76
|
__decorate([
|
|
48
77
|
property({ default: undefined })
|
|
@@ -68,4 +97,16 @@ __decorate([
|
|
|
68
97
|
__decorate([
|
|
69
98
|
property({ default: undefined })
|
|
70
99
|
], Camera3D.prototype, "zoom", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
command({
|
|
102
|
+
args: [
|
|
103
|
+
{ key: "orbit", kind: "number", step: 1, unit: "°" },
|
|
104
|
+
{ key: "elevation", kind: "number", min: -89, max: 89, step: 1, unit: "°" },
|
|
105
|
+
{ key: "distance", kind: "number", min: 0.01, step: 0.1 },
|
|
106
|
+
],
|
|
107
|
+
})
|
|
108
|
+
], Camera3D.prototype, "orbitTo", null);
|
|
109
|
+
__decorate([
|
|
110
|
+
command({ args: ["target"] })
|
|
111
|
+
], Camera3D.prototype, "lookTo", null);
|
|
71
112
|
//# sourceMappingURL=camera-nodes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,Q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AAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;+CAA2C;AAClC;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC;AACzB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;qCAAiC;AACxB;IAAzC,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;sCAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport type { Transform3D } from \"@/render3d/transform\";\nimport type { CameraData3D } from \"@/render3d/camera\";\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\nimport type { Vector3Input } from \"@/render3d/vector3\";\nimport { Node3D, type Node3DProps } from \"./node3d\";\n\n/**\n * The camera — where the scene is viewed from.\n *\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\n * one; there is no second class, because a perspective and an orthographic\n * camera are one object with a projection setting, which is how every editor\n * presents it and how a scene switching between them has to be written.\n *\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\n *\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\n *\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\n * around the thing it is looking at, which is what a camera move almost always\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\n * recomputed every frame in a prop binding — which is exactly what every scene\n * did before this existed, and what the template's own `Graph3D` node\n * independently reinvented `orbit`/`elevation`/`zoom` props to avoid.\n *\n * `position` and `lookAt` still work and are right for a shot pinned to\n * something; setting any polar field takes over, so the two can never be half\n * applied. Either way the camera is a node, so parenting it to a moving\n * `Group3D` carries the shot with the rig.\n *\n * ── What is derived ───────────────────────────────────────────────────────────\n * `near`/`far` come from the scene's own bounds unless you set them, and the\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\n * documentation said \"don't set this\", and setting it stretched the render.\n * An asymmetric orthographic frustum is a `params` override rather than four\n * more fields.\n *\n * A scene with no camera gets a sensible default framing. A scene that declares\n * more than one keeps the last, since there is only ever one view.\n */\nexport interface Camera3DProps extends Node3DProps {\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\n type: CameraData3D[\"type\"];\n /**\n * The point the camera looks at, and orbits around.\n *\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\n * together with any of the three below it is also the centre they turn about.\n */\n target: Vector3Input | undefined;\n /** Azimuth around {@link target}, in **degrees**. */\n orbit: number | undefined;\n /** Angle above the horizon, in **degrees**. */\n elevation: number | undefined;\n /** Distance from {@link target}. */\n distance: number | undefined;\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\n fov: number | undefined;\n /** Orthographic only: visible world height. Default 10. */\n frustumHeight: number | undefined;\n near: number | undefined;\n far: number | undefined;\n zoom: number | undefined;\n}\n\nconst CAMERA_KEYS = [\n \"target\", \"orbit\", \"elevation\", \"distance\",\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\n] as const;\n\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\n\n @property({ default: undefined }) declare target: Vector3Input | undefined;\n @property({ default: undefined }) declare orbit: number | undefined;\n @property({ default: undefined }) declare elevation: number | undefined;\n @property({ default: undefined }) declare distance: number | undefined;\n\n @property({ default: undefined }) declare fov: number | undefined;\n @property({ default: undefined }) declare frustumHeight: number | undefined;\n @property({ default: undefined }) declare near: number | undefined;\n @property({ default: undefined }) declare far: number | undefined;\n @property({ default: undefined }) declare zoom: number | undefined;\n\n /**\n * A camera's group stays identity; the camera places itself.\n *\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\n * camera sitting inside a group that carried its placement would face exactly\n * backwards. Putting the placement on the descriptor hands it to the camera\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\n * is still parent-relative, so a camera inside a moving rig is carried by it.\n */\n protected override groupTransform(): Transform3D {\n return {};\n }\n\n protected buildCamera(): CameraData3D {\n const out: Record<string, unknown> = { type: this.type };\n for (const key of CAMERA_KEYS) {\n const value = (this as unknown as Record<string, unknown>)[key];\n if (value !== undefined) out[key] = value;\n }\n return out as unknown as CameraData3D;\n }\n\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\n override declareAssets(): void { }\n\n protected override renderSelf(ctx: RenderContext3D): void {\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"camera-nodes.js","sourceRoot":"","sources":["../../../src/nodes/three/camera-nodes.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AA6DpD,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU;IAC1C,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CACvC,CAAC;AAEX,MAAM,OAAO,QAAkD,SAAQ,MAAS;IAc5E;;;;OAIG;IAQH,OAAO,CACH,IAAmG;QAEnG,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG;YACT,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,qBAAqB,CAAC,KAAK;YAChD,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,qBAAqB,CAAC,SAAS;YAC5D,QAAQ,EAAE,IAA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G,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;SAC5D;KACJ,CAAC;uCAkBD;AAID;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;sCAG7B","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { optionalVector3Property } from \"@/attributes/properties/typed\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport { ORBIT_CAMERA_DEFAULTS, type CameraData3D } from \"@/render3d/camera\";\r\nimport type { Command, CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport type { RenderContext3D } from \"@/render3d/render-context3d\";\r\nimport type { Vector3Input } from \"@/render3d/vector3\";\r\nimport { Node3D, type Node3DProps } from \"./node3d\";\r\n\r\n/**\r\n * The camera — where the scene is viewed from.\r\n *\r\n * **One node, two projections.** `<Camera3D type=\"orthographic\">` is the flat\r\n * one; there is no second class, because a perspective and an orthographic\r\n * camera are one object with a projection setting, which is how every editor\r\n * presents it and how a scene switching between them has to be written.\r\n *\r\n * <Camera3D target={[0, 0.2, 0]} orbit={-18} elevation={12} distance={13} fov={42} />\r\n *\r\n * cam().to({ data: { orbit: 160, elevation: 30 }, duration: 4, easing: easeInOut(\"quad\") });\r\n *\r\n * ── Orbit, not trigonometry ───────────────────────────────────────────────────\r\n * `target`/`orbit`/`elevation`/`distance` place the camera in polar coordinates\r\n * around the thing it is looking at, which is what a camera move almost always\r\n * *is*. Written through `position` the same move is a `Math.sin`/`Math.cos` pair\r\n * recomputed every frame in a prop binding — which is exactly what every scene\r\n * did before this existed.\r\n *\r\n * `position` and `lookAt` still work and are right for a shot pinned to\r\n * something; setting any polar field takes over, so the two can never be half\r\n * applied. Either way the camera is a node, so parenting it to a moving\r\n * `Group3D` carries the shot with the rig.\r\n *\r\n * ── What is derived ───────────────────────────────────────────────────────────\r\n * `near`/`far` come from the scene's own bounds unless you set them, and the\r\n * aspect ratio always tracks the viewport's layout box — it was a prop whose\r\n * documentation said \"don't set this\", and setting it stretched the render.\r\n * An asymmetric orthographic frustum is a `params` override rather than four\r\n * more fields.\r\n *\r\n * A scene with no camera gets a sensible default framing. A scene that declares\r\n * more than one keeps the last, since there is only ever one view.\r\n */\r\nexport interface Camera3DProps extends Node3DProps {\r\n /** `\"perspective\"` (default) or `\"orthographic\"`. */\r\n type: CameraData3D[\"type\"];\r\n /**\r\n * The point the camera looks at, and orbits around.\r\n *\r\n * On its own it is `lookAt` under a name that reads right beside `orbit`;\r\n * together with any of the three below it is also the centre they turn about.\r\n */\r\n target: Vector3Input | undefined;\r\n /** Azimuth around {@link target}, in **degrees**. */\r\n orbit: number | undefined;\r\n /** Angle above the horizon, in **degrees**. */\r\n elevation: number | undefined;\r\n /** Distance from {@link target}. */\r\n distance: number | undefined;\r\n /** Perspective only: vertical field of view in **degrees**. Default 50. */\r\n fov: number | undefined;\r\n /** Orthographic only: visible world height. Default 10. */\r\n frustumHeight: number | undefined;\r\n near: number | undefined;\r\n far: number | undefined;\r\n zoom: number | undefined;\r\n}\r\n\r\nconst CAMERA_KEYS = [\r\n \"target\", \"orbit\", \"elevation\", \"distance\",\r\n \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\",\r\n] as const;\r\n\r\nexport class Camera3D<P extends Camera3DProps = Camera3DProps> extends Node3D<P> {\r\n @property({ default: \"perspective\" }) declare type: CameraData3D[\"type\"];\r\n\r\n @optionalVector3Property(\"origin\") declare target: Vector3Input | undefined;\r\n @property({ default: undefined }) declare orbit: number | undefined;\r\n @property({ default: undefined }) declare elevation: number | undefined;\r\n @property({ default: undefined }) declare distance: number | undefined;\r\n\r\n @property({ default: undefined }) declare fov: number | undefined;\r\n @property({ default: undefined }) declare frustumHeight: number | undefined;\r\n @property({ default: undefined }) declare near: number | undefined;\r\n @property({ default: undefined }) declare far: number | undefined;\r\n @property({ default: undefined }) declare zoom: number | undefined;\r\n\r\n /**\r\n * Swing round {@link target}, and pull back or in, whichever are given. A\r\n * camera not yet placed by its polar fields starts from what an unset one\r\n * reads as.\r\n */\r\n @command({\r\n args: [\r\n { key: \"orbit\", kind: \"number\", step: 1, unit: \"°\" },\r\n { key: \"elevation\", kind: \"number\", min: -89, max: 89, step: 1, unit: \"°\" },\r\n { key: \"distance\", kind: \"number\", min: 0.01, step: 0.1 },\r\n ],\r\n })\r\n orbitTo(\r\n args: CommandArgs<{ orbit?: number; elevation?: number; distance?: number }> & { duration: number },\r\n ): Command<P> {\r\n const to = args.data ?? {};\r\n const from = {\r\n orbit: this.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,\r\n elevation: this.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,\r\n distance: this.distance ?? ORBIT_CAMERA_DEFAULTS.distance,\r\n };\r\n return this.command<P>((t) => {\r\n const out: Record<string, number> = {};\r\n for (const key of [\"orbit\", \"elevation\", \"distance\"] as const) {\r\n const end = to[key];\r\n if (end !== undefined) out[key] = from[key] + (end - from[key]) * t;\r\n }\r\n return out as Partial<P>;\r\n }, args.duration, args.easing);\r\n }\r\n\r\n /** Turn to look at another point: animates {@link target}. */\r\n @command({ args: [\"target\"] })\r\n lookTo(args: CommandArgs<{ target: Vector3Input }> & { duration: number }): Command<P> {\r\n return this.to({ data: args.data as Partial<P>, duration: args.duration, easing: args.easing });\r\n }\r\n\r\n /**\r\n * A camera's group stays identity; the camera places itself.\r\n *\r\n * three aims a camera's **-Z** at `lookAt` and a plain group's **+Z**, so a\r\n * camera sitting inside a group that carried its placement would face exactly\r\n * backwards. Putting the placement on the descriptor hands it to the camera\r\n * object itself, where `Object3D.lookAt` uses the camera convention — and it\r\n * is still parent-relative, so a camera inside a moving rig is carried by it.\r\n */\r\n protected override groupTransform(): Transform3D {\r\n return {};\r\n }\r\n\r\n protected buildCamera(): CameraData3D {\r\n const out: Record<string, unknown> = { type: this.type };\r\n for (const key of CAMERA_KEYS) {\r\n const value = (this as unknown as Record<string, unknown>)[key];\r\n if (value !== undefined) out[key] = value;\r\n }\r\n return out as unknown as CameraData3D;\r\n }\r\n\r\n /** Loads nothing — and recording `renderSelf` would make every orbit tween a dependency. */\r\n override declareAssets(): void { }\r\n\r\n protected override renderSelf(ctx: RenderContext3D): void {\r\n ctx.camera({ ...this.transform3D(), ...this.buildCamera() } as CameraData3D);\r\n }\r\n}\r\n"]}
|
|
@@ -2,10 +2,11 @@ import { RenderContext2D } from "../../render/render-context2d.js";
|
|
|
2
2
|
import { Scene3D } from "../../render3d/scene3d.js";
|
|
3
3
|
import { type PostEffect3D, type Shadows3D, type ToneMapping3D } from "../../render3d/scene-settings.js";
|
|
4
4
|
import type { Color } from "../../attributes/shape/fill/color/parser.js";
|
|
5
|
+
import type { Command, CommandArgs } from "../../tween/command.js";
|
|
5
6
|
import type { AssetScope } from "../../assets/scope.js";
|
|
6
7
|
import { Rect, RectProps } from "../geometry/rect-node.js";
|
|
7
8
|
import { Node, NodeConfig } from "../../nodes/node/node.js";
|
|
8
|
-
import { Node3D } from "./node3d.js";
|
|
9
|
+
import { Node3D, type ChildSpace3D } from "./node3d.js";
|
|
9
10
|
export interface Canvas3DProps extends RectProps {
|
|
10
11
|
/**
|
|
11
12
|
* Ceiling on the 3D buffer's device-pixel ratio. Default 2.
|
|
@@ -35,6 +36,10 @@ export interface Canvas3DProps extends RectProps {
|
|
|
35
36
|
* blur and the rest of the 2D `effects` chain already run over the composited
|
|
36
37
|
* result. What is here is what genuinely needs the depth buffer, object ids,
|
|
37
38
|
* or HDR radiance before tone mapping.
|
|
39
|
+
*
|
|
40
|
+
* **Inert today**: the chain is recorded on the scene and no pass is applied,
|
|
41
|
+
* so a viewport with `post` renders exactly like one without (the first one
|
|
42
|
+
* set warns in development). Use the viewport's 2D `effects` instead.
|
|
38
43
|
*/
|
|
39
44
|
post: PostEffect3D | readonly PostEffect3D[];
|
|
40
45
|
/**
|
|
@@ -42,8 +47,7 @@ export interface Canvas3DProps extends RectProps {
|
|
|
42
47
|
*
|
|
43
48
|
* A host that renders a **timeline** needs a camera a `to` command can tween
|
|
44
49
|
* and a scrub can reproduce exactly, and a drag-to-orbit gesture that writes
|
|
45
|
-
* the same values the timeline reads.
|
|
46
|
-
* this vocabulary for the same reason. Only read when the scene contains no
|
|
50
|
+
* the same values the timeline reads. Only read when the scene contains no
|
|
47
51
|
* camera of its own, so a `<Camera3D>` child still wins.
|
|
48
52
|
*/
|
|
49
53
|
/** Camera orbit about the vertical axis, in **degrees**. Animate this to spin. */
|
|
@@ -92,7 +96,7 @@ export interface Canvas3DProps extends RectProps {
|
|
|
92
96
|
* make that impossible is for there to be nothing to keep in step: see
|
|
93
97
|
* {@link Canvas3DView.fadeColor}.
|
|
94
98
|
*
|
|
95
|
-
* The same rule
|
|
99
|
+
* The same rule the engine applies to fog with no colour of its own, one
|
|
96
100
|
* layer down (`Canvas3D.buildScene3D`), and for the same reason.
|
|
97
101
|
*/
|
|
98
102
|
gridFadeColor: Color;
|
|
@@ -162,7 +166,7 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
|
|
|
162
166
|
* Each default is applied only when the walk left that slot empty, so a
|
|
163
167
|
* `PerspectiveCamera3D` or an `AmbientLight3D` placed as a child wins over the
|
|
164
168
|
* node's own props rather than being silently overwritten by them — which is
|
|
165
|
-
* the behaviour that lets this class stop being special the day
|
|
169
|
+
* the behaviour that lets this class stop being special the day an editor
|
|
166
170
|
* offers those as node types.
|
|
167
171
|
*/
|
|
168
172
|
/**
|
|
@@ -189,7 +193,7 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
|
|
|
189
193
|
* leaves {@link Canvas3DProps.gridFadeColor} standing, rather than
|
|
190
194
|
* inventing black.
|
|
191
195
|
*
|
|
192
|
-
* Restated here rather than imported because
|
|
196
|
+
* Restated here rather than imported because the engine's own copy (used
|
|
193
197
|
* for fog, in `Canvas3D.buildScene3D`) is a module-private function. The
|
|
194
198
|
* duplication is small and deliberate — the alternative was a second control
|
|
195
199
|
* the author had to keep in step with the fill, which is exactly what this
|
|
@@ -204,6 +208,18 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
|
|
|
204
208
|
exposure: number | undefined;
|
|
205
209
|
post: PostEffect3D | readonly PostEffect3D[] | undefined;
|
|
206
210
|
constructor(props?: NodeConfig<Canvas3D<P>, P>);
|
|
211
|
+
/**
|
|
212
|
+
* Swing the default camera round the scene and pull it back or in,
|
|
213
|
+
* whichever are given. `zoom` is its distance, as the prop is. A scene with
|
|
214
|
+
* a `Camera3D` of its own is framed by that camera's `orbitTo` instead.
|
|
215
|
+
*/
|
|
216
|
+
orbitTo(args: CommandArgs<{
|
|
217
|
+
orbit?: number;
|
|
218
|
+
elevation?: number;
|
|
219
|
+
zoom?: number;
|
|
220
|
+
}> & {
|
|
221
|
+
duration: number;
|
|
222
|
+
}): Command<P>;
|
|
207
223
|
/**
|
|
208
224
|
* Accept both dimensions — the only node that does.
|
|
209
225
|
*
|
|
@@ -211,6 +227,13 @@ export declare class Canvas3D<P extends Canvas3DProps = Canvas3DProps> extends R
|
|
|
211
227
|
* (see {@link Node.acceptsChild}); here it is the entire point.
|
|
212
228
|
*/
|
|
213
229
|
protected acceptsChild(child: Node): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* The coordinates its 3D children's `x`/`y`/`z` are in, or `null` (the
|
|
232
|
+
* default) when they are the scene's own. A viewport that is a graph answers
|
|
233
|
+
* with the graph's units. See {@link ChildSpace3D}.
|
|
234
|
+
*/
|
|
235
|
+
/** @internal */
|
|
236
|
+
_spaceOf(_child: Node3D | null): ChildSpace3D | null;
|
|
214
237
|
/** This node's children that describe the 3D scene. */
|
|
215
238
|
get children3D(): Node3D[];
|
|
216
239
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas3d-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/three/canvas3d-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,E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AU,IAAI,MAAM,EAAE,CAEzB;IAED;;;;;OAKG;cACgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI;IAKrE;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,YAAY,IAAI,OAAO;IAqHjC;;;;;;;;;;;;;OAaG;IACH,gBAAgB;IAChB,QAAQ,IAAI,OAAO;IAInB;;;OAGG;IACM,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAQhD;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;cAQP,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;CA0B5D"}
|
|
@@ -14,6 +14,7 @@ import { cameraOrbit, lerpColor3D, resolveColor3D } from "../../attributes/rende
|
|
|
14
14
|
import { gridGeometry3D } from "./grid-geometry3d.js";
|
|
15
15
|
import { Fills, resolveChainFill } from "../../attributes/shape/fill/chain.js";
|
|
16
16
|
import { property } from "../../attributes/properties/decorator.js";
|
|
17
|
+
import { command } from "../../tween/command-decorator.js";
|
|
17
18
|
import { declare3DResources } from "../../render3d/tracking.js";
|
|
18
19
|
import { Rect } from "../geometry/rect-node.js";
|
|
19
20
|
import { Node3D } from "./node3d.js";
|
|
@@ -66,7 +67,7 @@ export class Canvas3D extends Rect {
|
|
|
66
67
|
* Each default is applied only when the walk left that slot empty, so a
|
|
67
68
|
* `PerspectiveCamera3D` or an `AmbientLight3D` placed as a child wins over the
|
|
68
69
|
* node's own props rather than being silently overwritten by them — which is
|
|
69
|
-
* the behaviour that lets this class stop being special the day
|
|
70
|
+
* the behaviour that lets this class stop being special the day an editor
|
|
70
71
|
* offers those as node types.
|
|
71
72
|
*/
|
|
72
73
|
/**
|
|
@@ -93,7 +94,7 @@ export class Canvas3D extends Rect {
|
|
|
93
94
|
* leaves {@link Canvas3DProps.gridFadeColor} standing, rather than
|
|
94
95
|
* inventing black.
|
|
95
96
|
*
|
|
96
|
-
* Restated here rather than imported because
|
|
97
|
+
* Restated here rather than imported because the engine's own copy (used
|
|
97
98
|
* for fog, in `Canvas3D.buildScene3D`) is a module-private function. The
|
|
98
99
|
* duplication is small and deliberate — the alternative was a second control
|
|
99
100
|
* the author had to keep in step with the fill, which is exactly what this
|
|
@@ -141,6 +142,18 @@ export class Canvas3D extends Rect {
|
|
|
141
142
|
constructor(props) {
|
|
142
143
|
super((props ?? {}));
|
|
143
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Swing the default camera round the scene and pull it back or in,
|
|
147
|
+
* whichever are given. `zoom` is its distance, as the prop is. A scene with
|
|
148
|
+
* a `Camera3D` of its own is framed by that camera's `orbitTo` instead.
|
|
149
|
+
*/
|
|
150
|
+
orbitTo(args) {
|
|
151
|
+
const data = {};
|
|
152
|
+
for (const [key, value] of Object.entries(args.data ?? {}))
|
|
153
|
+
if (value !== undefined)
|
|
154
|
+
data[key] = value;
|
|
155
|
+
return this.to({ data: data, duration: args.duration, easing: args.easing });
|
|
156
|
+
}
|
|
144
157
|
/**
|
|
145
158
|
* Accept both dimensions — the only node that does.
|
|
146
159
|
*
|
|
@@ -150,6 +163,15 @@ export class Canvas3D extends Rect {
|
|
|
150
163
|
acceptsChild(child) {
|
|
151
164
|
return true;
|
|
152
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* The coordinates its 3D children's `x`/`y`/`z` are in, or `null` (the
|
|
168
|
+
* default) when they are the scene's own. A viewport that is a graph answers
|
|
169
|
+
* with the graph's units. See {@link ChildSpace3D}.
|
|
170
|
+
*/
|
|
171
|
+
/** @internal */
|
|
172
|
+
_spaceOf(_child) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
153
175
|
/** This node's children that describe the 3D scene. */
|
|
154
176
|
get children3D() {
|
|
155
177
|
return this._allChildren.filter((c) => c instanceof Node3D);
|
|
@@ -227,6 +249,17 @@ export class Canvas3D extends Rect {
|
|
|
227
249
|
},
|
|
228
250
|
}));
|
|
229
251
|
}
|
|
252
|
+
// A viewport holding only 2D children (a HUD) has nothing to frame or to
|
|
253
|
+
// light. Without this the default camera and rig made every scene
|
|
254
|
+
// non-empty, so `renderSelf` ran a full 3D pass and created the WebGL
|
|
255
|
+
// context to paint nothing. A subclass overriding `buildScene3D` is
|
|
256
|
+
// exempt: it adds its own content after `super` returns and relies on the
|
|
257
|
+
// rig being there.
|
|
258
|
+
if (this.buildScene3D === Canvas3D.prototype.buildScene3D &&
|
|
259
|
+
scene.isEmpty() &&
|
|
260
|
+
!this._children.some((child) => child instanceof Node3D)) {
|
|
261
|
+
return scene;
|
|
262
|
+
}
|
|
230
263
|
if (scene.cameraDescriptor() === null) {
|
|
231
264
|
// Polar placement is the camera's own vocabulary now, so the viewport's
|
|
232
265
|
// orbit/elevation/zoom pass straight through instead of being converted to
|
|
@@ -416,6 +449,15 @@ __decorate([
|
|
|
416
449
|
__decorate([
|
|
417
450
|
property({ default: undefined })
|
|
418
451
|
], Canvas3D.prototype, "post", void 0);
|
|
452
|
+
__decorate([
|
|
453
|
+
command({
|
|
454
|
+
args: [
|
|
455
|
+
{ key: "orbit", kind: "number", step: 1, unit: "°" },
|
|
456
|
+
{ key: "elevation", kind: "number", min: -89, max: 89, step: 1, unit: "°" },
|
|
457
|
+
{ key: "zoom", kind: "number", min: 0.01, step: 0.1 },
|
|
458
|
+
],
|
|
459
|
+
})
|
|
460
|
+
], Canvas3D.prototype, "orbitTo", null);
|
|
419
461
|
/**
|
|
420
462
|
* The colour a fill chain reads as, for anything that has to match it.
|
|
421
463
|
*
|