@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +4 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +10 -2
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +45 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +15 -39
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +16 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +2 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +25 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +70 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +2 -2
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/registry.d.ts +23 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +46 -19
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +100 -19
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +290 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +12 -12
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +2 -2
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +37 -31
- package/dist/document/validate.js.map +1 -1
- package/dist/document/withdraw.d.ts +28 -0
- package/dist/document/withdraw.d.ts.map +1 -0
- package/dist/document/withdraw.js +61 -0
- package/dist/document/withdraw.js.map +1 -0
- package/dist/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +4 -3
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +4 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +40 -33
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +17 -36
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +12 -4
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +67 -27
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/node/text-defaults.d.ts +10 -12
- package/dist/nodes/node/text-defaults.d.ts.map +1 -1
- package/dist/nodes/node/text-defaults.js +10 -12
- package/dist/nodes/node/text-defaults.js.map +1 -1
- package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
- package/dist/nodes/root/canvas2d-node.js.map +1 -0
- package/dist/nodes/root/provider-node.d.ts.map +1 -0
- package/dist/nodes/root/provider-node.js.map +1 -0
- package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
- package/dist/nodes/root/theme-provider-node.js.map +1 -0
- package/dist/nodes/text/default-text-style-node.d.ts +5 -2
- package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
- package/dist/nodes/text/default-text-style-node.js +10 -4
- package/dist/nodes/text/default-text-style-node.js.map +1 -1
- package/dist/nodes/text/number-format.d.ts +1 -1
- package/dist/nodes/text/number-format.js +1 -1
- package/dist/nodes/text/number-format.js.map +1 -1
- package/dist/nodes/text/number-node.js.map +1 -1
- package/dist/nodes/text/number-pattern.js.map +1 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +6 -72
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +13 -364
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- package/dist/nodes/text/text-node.js.map +1 -1
- package/dist/nodes/text/text-selection.js.map +1 -1
- package/dist/nodes/three/camera-nodes.d.ts +21 -3
- package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
- package/dist/nodes/three/camera-nodes.js +42 -1
- package/dist/nodes/three/camera-nodes.js.map +1 -1
- package/dist/nodes/three/canvas3d-node.d.ts +32 -7
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +50 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +9 -4
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +27 -9
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +18 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +97 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +124 -10
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +13 -5
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +10 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +31 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +63 -6
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +9 -7
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +12 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +1 -1
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +50 -25
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +52 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +7 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from "../nodes/node/node.js";
|
|
2
|
-
import { Node2D } from "../nodes/2d/node2d.js";
|
|
2
|
+
import { Node2D, type NodeHandle } from "../nodes/2d/node2d.js";
|
|
3
3
|
import { Vector2 } from "../attributes/layout/vector2.js";
|
|
4
4
|
import { Matrix2D } from "../attributes/layout/matrix2d.js";
|
|
5
5
|
import { type Node3DFrame } from "./node-picking3d.js";
|
|
@@ -37,8 +37,8 @@ export interface NodeBox {
|
|
|
37
37
|
/**
|
|
38
38
|
* Size of the box before rotation/scale, in scene units — the node's layout
|
|
39
39
|
* size for everything whose drawing fills its cell, and the ink's own extent
|
|
40
|
-
* where the two differ (see {@link Node2D._localBounds}; a
|
|
41
|
-
*
|
|
40
|
+
* where the two differ (see {@link Node2D._localBounds}; a boolean group
|
|
41
|
+
* reports the extent of its children's ink, not its layout rect).
|
|
42
42
|
*/
|
|
43
43
|
width: number;
|
|
44
44
|
height: number;
|
|
@@ -90,8 +90,49 @@ export declare function renderMatrix(node: Node2D): Matrix2D;
|
|
|
90
90
|
* Two answers differ by exactly the change of `x`/`y` that carries the node from
|
|
91
91
|
* one point to the other — what a move handle needs once a node can sit in
|
|
92
92
|
* depth, where a screen delta is no longer a parent delta.
|
|
93
|
+
*
|
|
94
|
+
* Under a parent with coordinates of its own (`Node2D._planeOf`) the answer is
|
|
95
|
+
* in them, and is the `x`/`y` that centres the node on `point`.
|
|
93
96
|
*/
|
|
94
97
|
export declare function parentPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null;
|
|
98
|
+
/**
|
|
99
|
+
* Where `point` (viewport space) lands in the coordinates the node at `path`
|
|
100
|
+
* positions its children in ({@link Node2D._planeOf}): the `x`/`y` a child takes
|
|
101
|
+
* to be centred there, before it exists. `null` when that node's children are
|
|
102
|
+
* positioned in pixels, which is how a host tells the two apart.
|
|
103
|
+
*/
|
|
104
|
+
export declare function childPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null;
|
|
105
|
+
/**
|
|
106
|
+
* What keeps the node at `path` looking exactly as it does once it moves under
|
|
107
|
+
* the node at `parentPath`, as a design tool does: each of `offsets` (an
|
|
108
|
+
* `x`/`y` it takes under its parent now: its own, or where a move takes it)
|
|
109
|
+
* carried to the one that puts its centre at the same place there, and the
|
|
110
|
+
* `turn` to add to its rotation and the `scale` to multiply its scale by so
|
|
111
|
+
* the parents' own turn and scale, cameras included, are undone. `null` when
|
|
112
|
+
* that parent arranges its children in a run or a grid, sits inside the node,
|
|
113
|
+
* or either is not here.
|
|
114
|
+
*/
|
|
115
|
+
export declare function reparentPlacementAt(root: Node2D, path: string, parentPath: string, offsets: readonly Vector2[]): ReparentPlacement | null;
|
|
116
|
+
/** What {@link reparentPlacementAt} answers. */
|
|
117
|
+
export interface ReparentPlacement {
|
|
118
|
+
/** Each offset asked about, under the new parent. */
|
|
119
|
+
offsets: Vector2[];
|
|
120
|
+
/** Degrees (clockwise) to add to the node's rotation, and to where its turns end. */
|
|
121
|
+
turn: number;
|
|
122
|
+
/** The factor to multiply the node's scale by, and where its scalings end. */
|
|
123
|
+
scale: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The node at `path`'s {@link NodeHandle}s with `at` in viewport space, where the
|
|
127
|
+
* pixels put them; `null` when the path names no 2D node.
|
|
128
|
+
*/
|
|
129
|
+
export declare function nodeHandlesAt(root: Node2D, path: string): NodeHandle[] | null;
|
|
130
|
+
/**
|
|
131
|
+
* The value of `prop` that puts its handle on the node at `path` under `point`
|
|
132
|
+
* (viewport space), or `null` when there is no such handle or the point is off
|
|
133
|
+
* the node's plane.
|
|
134
|
+
*/
|
|
135
|
+
export declare function handleValueAt(root: Node2D, path: string, prop: string, point: Vector2): Vector2 | null;
|
|
95
136
|
/** Build the viewport-space box for `node` at the current frame. */
|
|
96
137
|
export declare function nodeBox(node: Node2D, path: string): NodeBox;
|
|
97
138
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-picking.d.ts","sourceRoot":"","sources":["../../src/runtime/node-picking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"node-picking.d.ts","sourceRoot":"","sources":["../../src/runtime/node-picking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAA2E,MAAM,8BAA8B,CAAC;AAKjI,OAAO,EAA+E,KAAK,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAClJ,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACpB,2FAA2F;IAC3F,EAAE,EAAE,MAAM,CAAC;IACX,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;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,GAAG,OAAO,GAAG,IAAI,CAoBpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAS9D;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,SAAS,OAAO,EAAE,EAChC,WAAW,EAAE,SAAS,OAAO,EAAE,GAChC,WAAW,GAAG,IAAI,CAgBpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,SAAI,GAAG,OAAO,GAAG,IAAI,CAEpF;AAwCD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAkB9F"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Node2D } from "../nodes/2d/node2d.js";
|
|
2
|
-
import { Canvas3D } from "../nodes/three/canvas3d-node.js";
|
|
3
2
|
import { multiply, invert, applyToPoint, cameraMatrix, translation, isProjective } from "../attributes/layout/matrix2d.js";
|
|
4
3
|
import { worldAnchors } from "../nodes/2d/node-transform.js";
|
|
5
4
|
import { spaceChildFrame, spaceChildOrder, spaceFrameForChildren, spaceFrameOf, spaceRootFrame } from "../nodes/2d/node-space.js";
|
|
6
5
|
import { multiplyAffine3, spaceScreenMatrix } from "../attributes/layout/space3d.js";
|
|
7
6
|
import { nodePath } from "../project/tree.js";
|
|
8
|
-
import { collectBoxes3D, pickNode3D, projectNode3D } from "./node-picking3d.js";
|
|
7
|
+
import { collectBoxes3D, isViewport3D, pickNode3D, projectNode3D } from "./node-picking3d.js";
|
|
9
8
|
/**
|
|
10
9
|
* The renderer's CTM at `node` — every ancestor's local matrix from the scene
|
|
11
10
|
* root down, with a camera scope inserted wherever an ancestor pushes one
|
|
@@ -61,6 +60,9 @@ function childrenMatrix(parent) {
|
|
|
61
60
|
* Two answers differ by exactly the change of `x`/`y` that carries the node from
|
|
62
61
|
* one point to the other — what a move handle needs once a node can sit in
|
|
63
62
|
* depth, where a screen delta is no longer a parent delta.
|
|
63
|
+
*
|
|
64
|
+
* Under a parent with coordinates of its own (`Node2D._planeOf`) the answer is
|
|
65
|
+
* in them, and is the `x`/`y` that centres the node on `point`.
|
|
64
66
|
*/
|
|
65
67
|
export function parentPlanePointAt(root, path, point) {
|
|
66
68
|
if (path === "")
|
|
@@ -76,7 +78,119 @@ export function parentPlanePointAt(root, path, point) {
|
|
|
76
78
|
const p = applyToPoint(inv, { x: point.x, y: -point.y });
|
|
77
79
|
if (behindCamera(m, p))
|
|
78
80
|
return null;
|
|
79
|
-
|
|
81
|
+
const plane = parent._planeOf(node);
|
|
82
|
+
if (!plane)
|
|
83
|
+
return { x: p.x, y: -p.y };
|
|
84
|
+
// A slot's frame is already centred on the node's box; the parent's is not.
|
|
85
|
+
const box = node._placement() ? null : node.layoutBounds;
|
|
86
|
+
return plane.toCoords(p.x - (box?.x ?? 0), (box?.y ?? 0) - p.y);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Where `point` (viewport space) lands in the coordinates the node at `path`
|
|
90
|
+
* positions its children in ({@link Node2D._planeOf}): the `x`/`y` a child takes
|
|
91
|
+
* to be centred there, before it exists. `null` when that node's children are
|
|
92
|
+
* positioned in pixels, which is how a host tells the two apart.
|
|
93
|
+
*/
|
|
94
|
+
export function childPlanePointAt(root, path, point) {
|
|
95
|
+
const parent = nodeAt(root, path);
|
|
96
|
+
if (!(parent instanceof Node2D))
|
|
97
|
+
return null;
|
|
98
|
+
const plane = parent._planeOf(null);
|
|
99
|
+
if (!plane)
|
|
100
|
+
return null;
|
|
101
|
+
const inv = invert(childrenMatrix(parent));
|
|
102
|
+
if (!inv)
|
|
103
|
+
return null;
|
|
104
|
+
const p = applyToPoint(inv, { x: point.x, y: -point.y });
|
|
105
|
+
return plane.toCoords(p.x, -p.y);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* What keeps the node at `path` looking exactly as it does once it moves under
|
|
109
|
+
* the node at `parentPath`, as a design tool does: each of `offsets` (an
|
|
110
|
+
* `x`/`y` it takes under its parent now: its own, or where a move takes it)
|
|
111
|
+
* carried to the one that puts its centre at the same place there, and the
|
|
112
|
+
* `turn` to add to its rotation and the `scale` to multiply its scale by so
|
|
113
|
+
* the parents' own turn and scale, cameras included, are undone. `null` when
|
|
114
|
+
* that parent arranges its children in a run or a grid, sits inside the node,
|
|
115
|
+
* or either is not here.
|
|
116
|
+
*/
|
|
117
|
+
export function reparentPlacementAt(root, path, parentPath, offsets) {
|
|
118
|
+
const node = nodeAt(root, path);
|
|
119
|
+
const to = nodeAt(root, parentPath);
|
|
120
|
+
const from = node instanceof Node2D ? node.parent : null;
|
|
121
|
+
if (!(node instanceof Node2D) || !(from instanceof Node2D) || !(to instanceof Node2D))
|
|
122
|
+
return null;
|
|
123
|
+
for (let at = to; at; at = at.parent)
|
|
124
|
+
if (at === node)
|
|
125
|
+
return null;
|
|
126
|
+
const box = node.layoutBounds;
|
|
127
|
+
const plane = to._planeOf(null);
|
|
128
|
+
const slot = plane ? null : to._slotFor({ width: box?.width ?? 0, height: box?.height ?? 0 });
|
|
129
|
+
if (!plane && !slot)
|
|
130
|
+
return null;
|
|
131
|
+
const along = movePlaneMatrix(node, from);
|
|
132
|
+
const back = invert(along);
|
|
133
|
+
const into = invert(childrenMatrix(to));
|
|
134
|
+
if (!back || !into)
|
|
135
|
+
return null;
|
|
136
|
+
const placed = node._placement();
|
|
137
|
+
const was = childFold(from);
|
|
138
|
+
const will = childFold(to);
|
|
139
|
+
const turn = was.rotation + (placed?.rotation ?? 0) - will.rotation;
|
|
140
|
+
const scale = will.scale === 0 ? 1 : (was.scale * (placed?.scale ?? 1)) / will.scale;
|
|
141
|
+
const shift = node._centreShift(node.rotation + turn, node.scale * scale);
|
|
142
|
+
// The plane the node's x/y move it on, where its centre is drawn now.
|
|
143
|
+
const here = applyToPoint(back, applyToPoint(renderMatrix(node), { x: 0, y: 0 }));
|
|
144
|
+
const own = from._planeOf(node);
|
|
145
|
+
const pixels = (offset) => (own ? { ...own.toOffset(offset.x, offset.y) } : offset);
|
|
146
|
+
const now = pixels({ x: node.x, y: node.y });
|
|
147
|
+
const moved = offsets.map((offset) => {
|
|
148
|
+
const o = pixels(offset);
|
|
149
|
+
const drawn = applyToPoint(along, { x: here.x + o.x - now.x, y: here.y - (o.y - now.y) });
|
|
150
|
+
const centre = applyToPoint(into, drawn);
|
|
151
|
+
const x = centre.x - shift.x;
|
|
152
|
+
const y = centre.y - shift.y;
|
|
153
|
+
return plane ? plane.toCoords(x, -y) : { x: x - slot.x, y: slot.y - y };
|
|
154
|
+
});
|
|
155
|
+
return { offsets: moved, turn, scale };
|
|
156
|
+
}
|
|
157
|
+
/** The rotation and scale a child of `parent` is drawn under: its fold, then the camera it opens. */
|
|
158
|
+
function childFold(parent) {
|
|
159
|
+
const folded = foldedTransform(parent);
|
|
160
|
+
const cam = parent._cameraScope();
|
|
161
|
+
return cam ? { rotation: folded.rotation - cam.heading, scale: folded.scale * cam.zoom } : folded;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The node at `path`'s {@link NodeHandle}s with `at` in viewport space, where the
|
|
165
|
+
* pixels put them; `null` when the path names no 2D node.
|
|
166
|
+
*/
|
|
167
|
+
export function nodeHandlesAt(root, path) {
|
|
168
|
+
const node = nodeAt(root, path);
|
|
169
|
+
if (!(node instanceof Node2D))
|
|
170
|
+
return null;
|
|
171
|
+
const m = renderMatrix(node);
|
|
172
|
+
return node._handles().map(({ prop, at }) => {
|
|
173
|
+
const p = applyToPoint(m, { x: at.x, y: -at.y });
|
|
174
|
+
return { prop, at: { x: p.x, y: -p.y } };
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The value of `prop` that puts its handle on the node at `path` under `point`
|
|
179
|
+
* (viewport space), or `null` when there is no such handle or the point is off
|
|
180
|
+
* the node's plane.
|
|
181
|
+
*/
|
|
182
|
+
export function handleValueAt(root, path, prop, point) {
|
|
183
|
+
const node = nodeAt(root, path);
|
|
184
|
+
if (!(node instanceof Node2D))
|
|
185
|
+
return null;
|
|
186
|
+
const m = renderMatrix(node);
|
|
187
|
+
const inv = invert(m);
|
|
188
|
+
if (!inv)
|
|
189
|
+
return null;
|
|
190
|
+
const p = applyToPoint(inv, { x: point.x, y: -point.y });
|
|
191
|
+
if (behindCamera(m, p))
|
|
192
|
+
return null;
|
|
193
|
+
return node._handleValue(prop, { x: p.x, y: -p.y });
|
|
80
194
|
}
|
|
81
195
|
/** The parent's frame at the node's depth, onto the screen: the plane its `x`/`y` slide it across. */
|
|
82
196
|
function movePlaneMatrix(node, parent) {
|
|
@@ -129,7 +243,7 @@ export function nodeBox(node, path) {
|
|
|
129
243
|
const b = node._localBounds();
|
|
130
244
|
// `worldAnchors` maps offsets centred on the matrix's origin, so shift the
|
|
131
245
|
// matrix onto the bounds' own centre first — that is what lets a node whose
|
|
132
|
-
// ink is off-centre
|
|
246
|
+
// ink is off-centre report a box that actually sits on the ink.
|
|
133
247
|
// The matrix is canvas y-down; the bounds are y-up, hence the sign on y.
|
|
134
248
|
const m = b.x === 0 && b.y === 0
|
|
135
249
|
? renderMatrix(node)
|
|
@@ -172,7 +286,7 @@ export function nodeBoxAt(root, path) {
|
|
|
172
286
|
let canvas = null;
|
|
173
287
|
const segments = path.split(".");
|
|
174
288
|
for (let i = 0; i < segments.length; i++) {
|
|
175
|
-
if (node
|
|
289
|
+
if (isViewport3D(node))
|
|
176
290
|
canvas = { node, path: prefixPath(segments, i) };
|
|
177
291
|
const next = node._allChildren[Number(segments[i])];
|
|
178
292
|
if (!next)
|
|
@@ -182,7 +296,7 @@ export function nodeBoxAt(root, path) {
|
|
|
182
296
|
if (node instanceof Node2D)
|
|
183
297
|
return nodeBox(node, path);
|
|
184
298
|
// A 3D node: ask the viewport that holds it. There is always one — a `Node3D`
|
|
185
|
-
// cannot be parented anywhere else (
|
|
299
|
+
// cannot be parented anywhere else (the engine throws rather than allowing
|
|
186
300
|
// it) — so a `null` here is a malformed tree rather than a missing case.
|
|
187
301
|
if (!canvas)
|
|
188
302
|
return null;
|
|
@@ -232,7 +346,7 @@ export function projectNode3DAt(root, path, parentPoints, localPoints) {
|
|
|
232
346
|
let canvas = null;
|
|
233
347
|
const segments = path.split(".");
|
|
234
348
|
for (let i = 0; i < segments.length; i++) {
|
|
235
|
-
if (node
|
|
349
|
+
if (isViewport3D(node))
|
|
236
350
|
canvas = { node, path: prefixPath(segments, i) };
|
|
237
351
|
const next = node._allChildren[Number(segments[i])];
|
|
238
352
|
if (!next)
|
|
@@ -299,7 +413,7 @@ function pickIn(node, path, point, tolerance, isRoot) {
|
|
|
299
413
|
// The 3D scene draws under the 2D children and over the canvas's own fill, so
|
|
300
414
|
// it is tested in that order too: a HUD label wins over the mesh behind it,
|
|
301
415
|
// and the mesh wins over the viewport it sits in.
|
|
302
|
-
if (node
|
|
416
|
+
if (isViewport3D(node) && inside) {
|
|
303
417
|
const hit = pickNode3D(node, canvas3DFrame(node, path), point, tolerance, path);
|
|
304
418
|
if (hit)
|
|
305
419
|
return hit;
|
|
@@ -335,7 +449,7 @@ export function collectBoxes(node, path, out, isRoot) {
|
|
|
335
449
|
// a marquee can leave it out without a second walk.
|
|
336
450
|
if (!isRoot && drawn === "all")
|
|
337
451
|
out.push(nodeBox(node, path));
|
|
338
|
-
if (node
|
|
452
|
+
if (isViewport3D(node)) {
|
|
339
453
|
for (const box of collectBoxes3D(node, canvas3DFrame(node, path), path))
|
|
340
454
|
out.push(box);
|
|
341
455
|
}
|
|
@@ -390,7 +504,7 @@ function paintOrder(node, children) {
|
|
|
390
504
|
* document, and the meshes reached through their own walk instead.
|
|
391
505
|
*/
|
|
392
506
|
function childSlots(node) {
|
|
393
|
-
if (!(node
|
|
507
|
+
if (!(isViewport3D(node)))
|
|
394
508
|
return node.children;
|
|
395
509
|
return node._allChildren.map((child) => (child instanceof Node2D ? child : null));
|
|
396
510
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-picking.js","sourceRoot":"","sources":["../../src/runtime/node-picking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAY,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9H,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAwC,MAAM,kBAAkB,CAAC;AA2DnH;;;;;;;;;;;;;;;;;GAiBG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EA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,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;AACxE,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,IAAY,EAAE,KAAc,EAAE,SAAiB;IAClE,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,CAAuB,8BAA8B;IAC5E,8EAA8E;IAC9E,4EAA4E;IAC5E,2EAA2E;IAC3E,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACzD,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { Node } from \"@/nodes/node/node\";\nimport { Node2D } from \"@/nodes/2d/node2d\";\nimport { Canvas3D } from \"@/nodes/three/canvas3d-node\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { Matrix2D, multiply, invert, applyToPoint, cameraMatrix, translation, isProjective } from \"@/attributes/layout/matrix2d\";\nimport { worldAnchors } from \"@/nodes/2d/node-transform\";\nimport { spaceChildFrame, spaceChildOrder, spaceFrameForChildren, spaceFrameOf, spaceRootFrame } from \"@/nodes/2d/node-space\";\nimport { multiplyAffine3, spaceScreenMatrix } from \"@/attributes/layout/space3d\";\nimport { nodePath } from \"@/project/tree\";\nimport { collectBoxes3D, pickNode3D, projectNode3D, type Canvas3DFrame, type Node3DFrame } from \"./node-picking3d\";\nimport type { Vector3 } from \"@/render3d/vector3\";\n\n/**\n * Pure geometry for editor-style direct manipulation: where a node's pixels\n * landed, and which node is under a point. No controller state, so it can be\n * exercised against hand-built node trees.\n *\n * **Space.** Everything here is in *viewport space*: origin at the viewport\n * centre, y-up, units = the viewport pixels the player was given. That is the\n * same space `Node2D.global` reports, plus the camera — see {@link renderMatrix}.\n */\n\n/**\n * A node's on-screen box at the current frame, in viewport space (origin at the\n * viewport centre, y-up).\n *\n * Unlike {@link Node2D.global} this folds in any active camera scope, so it\n * describes where the node's pixels actually landed — which is what an editor\n * overlay needs in order to draw a selection box over them.\n */\nexport interface NodeBox {\n /** Per-instance id — changes on every rebuild. Use {@link path} to key across rebuilds. */\n id: string;\n /** Structural path from the scene root (`\"\"` is the root); stable across rebuilds. */\n path: string;\n /** Node2D class name, e.g. `Rect`, `Text`. */\n type: string;\n /** Corners in draw order, viewport space. Rotated/scaled — not axis-aligned. */\n topLeft: Vector2;\n topRight: Vector2;\n bottomRight: Vector2;\n bottomLeft: Vector2;\n center: Vector2;\n /**\n * Size of the box before rotation/scale, in scene units — the node's layout\n * size for everything whose drawing fills its cell, and the ink's own extent\n * where the two differ (see {@link Node2D._localBounds}; a `Line` reports the\n * span of its `points`, not its layout rect).\n */\n width: number;\n height: number;\n /** Folded rotation (degrees clockwise) and uniform scale, camera included. */\n rotation: number;\n scale: number;\n /** Effective alpha; `0` means the node is present but invisible. */\n opacity: number;\n /**\n * The editor's padlock — see {@link NodeEditorState.locked}.\n *\n * Carried here rather than left for the host to look up, because the two\n * things that need it are a marquee sweep and a gizmo's handles, and both are\n * already holding the box. A locked node is never returned by\n * {@link pickNode}; it appears in {@link collectBoxes} so a host can still\n * outline one selected from its layer tree.\n */\n locked: boolean;\n}\n\n/**\n * The renderer's CTM at `node` — every ancestor's local matrix from the scene\n * root down, with a camera scope inserted wherever an ancestor pushes one\n * ({@link Node2D._cameraScope}; `Canvas2D`/`Camera` call `beginCamera` between\n * their own transform and their children's).\n *\n * A node inside a 2.5D space is placed by its frame instead — the whole\n * projection from its own plane to the space root's, built by the same\n * `node-space.ts` the renderer uses — so it is a homography, and `nodeBox`\n * reports the projected corners.\n *\n * Mirrors the render walk exactly, including the camera's `translate(rect.x,\n * -rect.y)` — if a box ever disagrees with the pixels, the divergence is here.\n *\n * `@internal`, and shared with `text-geometry.ts`: a caret drawn over a node has\n * to land in the same space as the box drawn around it, so both must come from\n * this one walk rather than two that agree by inspection.\n */\n/** @internal */\nexport function renderMatrix(node: Node2D): Matrix2D {\n const frame = spaceFrameOf(node);\n if (frame) return multiply(renderMatrix(frame.root), frame.screen);\n const parent = node.parent;\n return parent ? multiply(childrenMatrix(parent), node._localMatrix()) : node._localMatrix();\n}\n\n/**\n * The CTM `parent`'s children are placed under, before their own transform: its\n * render matrix, then whatever camera it opens. For a space root that is the\n * camera over its own plane; inside a space it is the parent's own frame, since\n * a child's place is measured in its parent's plane.\n */\nfunction childrenMatrix(parent: Node2D): Matrix2D {\n const m = renderMatrix(parent);\n const camera = parent._spaceCamera();\n if (camera) return multiply(m, spaceRootFrame(parent, camera).screen);\n const cam = parent._cameraScope();\n if (!cam) return m;\n const r = parent.layoutBounds;\n return multiply(m, cameraMatrix(r.x, -r.y, cam.lookAt, cam.zoom, cam.heading));\n}\n\n/**\n * Where `point` (viewport space) lands on the plane the node at `path` moves in\n * when its `x`/`y` change — its parent's, through any camera in between, pushed\n * out to the node's own `depth` in a space — in its parent's frame: centred on\n * the parent (on its slot, for a node a parent places — see `ChildPlacement`),\n * y-up. `null` when the path does not name a 2D node below the\n * root, or that plane cannot be reached at that point (edge-on, or the point is\n * behind the camera).\n *\n * Two answers differ by exactly the change of `x`/`y` that carries the node from\n * one point to the other — what a move handle needs once a node can sit in\n * depth, where a screen delta is no longer a parent delta.\n */\nexport function parentPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\n if (path === \"\") return null;\n const node = nodeAt(root, path);\n const parent = node instanceof Node2D ? node.parent : null;\n if (!(node instanceof Node2D) || !parent) return null;\n const m = movePlaneMatrix(node, parent);\n const inv = invert(m);\n if (!inv) return null;\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n if (behindCamera(m, p)) return null;\n return { x: p.x, y: -p.y };\n}\n\n/** The parent's frame at the node's depth, onto the screen: the plane its `x`/`y` slide it across. */\nfunction movePlaneMatrix(node: Node2D, parent: Node2D): Matrix2D {\n const frame = spaceFrameOf(node) ? spaceFrameForChildren(parent) : null;\n if (!frame) {\n // A slotted node's `x`/`y` move it within its slot, which may be turned.\n const slot = node._slotMatrix();\n return slot ? multiply(childrenMatrix(parent), slot) : childrenMatrix(parent);\n }\n const slot = node._slotAffine();\n const plane = slot ? multiplyAffine3(frame.view, slot) : frame.view;\n const atDepth = multiplyAffine3(plane, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, node.depth]);\n return multiply(renderMatrix(frame.root), spaceScreenMatrix(frame.camera, atDepth));\n}\n\n/**\n * Under a perspective the inverse also answers for the plane's reflection behind\n * the camera: a point there projects to the same pixel with a negative `w`, and\n * is not on screen at all.\n */\nfunction behindCamera(m: Matrix2D, local: Vector2): boolean {\n return isProjective(m) && (m.g ?? 0) * local.x + (m.h ?? 0) * local.y + (m.i ?? 1) <= 0;\n}\n\n/**\n * Folded rotation / scale / opacity from the scene root down to `node`, matching\n * the renderer's nested transforms and its pass-through alpha fold. The same\n * accumulation {@link Node2D.global} does, extended with the camera scopes: a\n * camera multiplies the scale by its `zoom` and adds `-heading` to the rotation\n * (the renderer applies `rotate(-heading)`).\n */\nfunction foldedTransform(node: Node2D): { rotation: number; scale: number; opacity: number } {\n let rotation = 0;\n let scale = 1;\n let opacity = 1;\n for (let n: Node2D | null = node; n; n = n.parent) {\n const slot = n._placement();\n rotation += n.rotation + (slot?.rotation ?? 0);\n scale *= n.scale * (slot?.scale ?? 1);\n opacity *= n.opacity * (slot?.opacity ?? 1);\n // Skip the node's own camera: it scopes its children, not itself.\n const cam = n !== node ? n._cameraScope() : null;\n if (cam) {\n rotation -= cam.heading;\n scale *= cam.zoom;\n }\n }\n return { rotation, scale, opacity };\n}\n\n/** Build the viewport-space box for `node` at the current frame. */\nexport function nodeBox(node: Node2D, path: string): NodeBox {\n const b = node._localBounds();\n // `worldAnchors` maps offsets centred on the matrix's origin, so shift the\n // matrix onto the bounds' own centre first — that is what lets a node whose\n // ink is off-centre (a Line) report a box that actually sits on the ink.\n // The matrix is canvas y-down; the bounds are y-up, hence the sign on y.\n const m = b.x === 0 && b.y === 0\n ? renderMatrix(node)\n : multiply(renderMatrix(node), translation(b.x, -b.y));\n const anchors = worldAnchors(m, b.width / 2, b.height / 2);\n const folded = foldedTransform(node);\n return {\n id: node.id,\n path,\n type: node.className,\n topLeft: anchors.topLeft,\n topRight: anchors.topRight,\n bottomRight: anchors.bottomRight,\n bottomLeft: anchors.bottomLeft,\n center: anchors.center,\n width: b.width,\n height: b.height,\n rotation: folded.rotation,\n scale: folded.scale,\n opacity: folded.opacity,\n locked: node.locked,\n };\n}\n\n/**\n * The box at a structural path, in either dimension, or `null` when the path\n * doesn't resolve.\n *\n * The one entry point that answers for a 3D node as well as a 2D one, which a\n * bare {@link nodeBox} cannot: a mesh is not a `Node2D` and has no box of its\n * own — what it has is a projection into the viewport that holds it, and finding\n * that viewport is part of resolving the path (see `node-picking3d.ts`).\n *\n * Walks {@link Node._allChildren}, so the paths it accepts are the ones every\n * other structural walk in the engine produces.\n */\nexport function nodeBoxAt(root: Node2D, path: string): NodeBox | null {\n if (path === \"\") return nodeBox(root, path);\n\n let node: Node = root;\n let canvas: { node: Canvas3D; path: string } | null = null;\n const segments = path.split(\".\");\n for (let i = 0; i < segments.length; i++) {\n if (node instanceof Canvas3D) canvas = { node, path: prefixPath(segments, i) };\n const next = node._allChildren[Number(segments[i])];\n if (!next) return null;\n node = next;\n }\n\n if (node instanceof Node2D) return nodeBox(node, path);\n // A 3D node: ask the viewport that holds it. There is always one — a `Node3D`\n // cannot be parented anywhere else (motion-script throws rather than allowing\n // it) — so a `null` here is a malformed tree rather than a missing case.\n if (!canvas) return null;\n const frame = canvas3DFrame(canvas.node, canvas.path);\n return collectBoxes3D(canvas.node, frame, canvas.path).find((box) => box.path === path) ?? null;\n}\n\n/**\n * The node at a structural path, in either dimension, or `null` when the path\n * doesn't resolve.\n *\n * The resolution half of {@link nodeBoxAt}, split out for callers that want the\n * node rather than its box — `PlaybackController.getNodePropsAt`, which reads a\n * node's own props in its own space. Walks {@link Node._allChildren}, so it\n * accepts the same paths every other structural walk in the engine produces.\n */\nexport function nodeAt(root: Node2D, path: string): Node | null {\n if (path === \"\") return root;\n let node: Node = root;\n for (const segment of path.split(\".\")) {\n const next = node._allChildren[Number(segment)];\n if (!next) return null;\n node = next;\n }\n return node;\n}\n\n/** The first `count` segments of a split path, rejoined. */\nfunction prefixPath(segments: readonly string[], count: number): string {\n return segments.slice(0, count).join(\".\");\n}\n\n/**\n * Project a handful of points around the `Node3D` at `path`, or `null` when\n * the path doesn't resolve to a 3D node — a gizmo's counterpart to\n * {@link nodeBoxAt}, for the one thing a box can't answer: where would an\n * arbitrary point *near* the node, not just its extent, land on screen. See\n * {@link Node3DFrame} for the two point sets and the space each is in.\n *\n * `null` for a 2D path too, unlike `nodeBoxAt` — a `Node2D` has no matrix a\n * caller would ask this for; {@link nodeBox} already answers everything a 2D\n * handle needs directly in viewport space.\n */\nexport function projectNode3DAt(\n root: Node2D,\n path: string,\n parentPoints: readonly Vector3[],\n localPoints: readonly Vector3[],\n): Node3DFrame | null {\n if (path === \"\") return null;\n\n let node: Node = root;\n let canvas: { node: Canvas3D; path: string } | null = null;\n const segments = path.split(\".\");\n for (let i = 0; i < segments.length; i++) {\n if (node instanceof Canvas3D) canvas = { node, path: prefixPath(segments, i) };\n const next = node._allChildren[Number(segments[i])];\n if (!next) return null;\n node = next;\n }\n\n if (node instanceof Node2D || !canvas) return null;\n const frame = canvas3DFrame(canvas.node, canvas.path);\n return projectNode3D(canvas.node, frame, canvas.path, path, parentPoints, localPoints);\n}\n\n/**\n * The topmost node whose hit region contains `point` (viewport space, y-up,\n * origin at the viewport centre), or `null`. Children paint over their parent and\n * later siblings over earlier ones, so the walk tests children last-to-first\n * before falling back to the node itself.\n *\n * Skips fully transparent nodes — a scene built with spawn delays keeps\n * not-yet-visible nodes in the tree at `opacity: 0`, and those must not be\n * selectable. A node that clips (or pushes a camera, which clips to its viewport)\n * confines its subtree: a point outside its box cannot hit anything inside it.\n * The scene root is never returned; it is the stage, not a selectable node.\n *\n * The hit region is {@link Node2D.hitTestSelf} — the rotated layout box by default,\n * narrowed to the declared outline for shapes. A click in the corner of a rect's\n * box selects it; a click in the empty notch of a star's box does not.\n *\n * `tolerance` is grab-slop in scene units, applied outward from the ink. A host\n * passes its zoom-corrected pixel slop so the grab area stays constant on screen.\n * It is what makes thin shapes reachable.\n *\n * Cost: {@link renderMatrix} walks to the root per node, making a pick O(depth²).\n * Scene trees here are shallow (tens of nodes, depth < 10), so this is fine at\n * pointer rate. If it ever matters, thread the parent's accumulated matrix down\n * through the walk instead of recomputing — a change confined to this file.\n */\nexport function pickNode(root: Node2D, point: Vector2, tolerance = 0): NodeBox | null {\n return pickIn(root, \"\", point, tolerance, true);\n}\n\nfunction pickIn(node: Node2D, path: string, point: Vector2, tolerance: number, isRoot: boolean): NodeBox | null {\n if (node.opacity === 0 || node.hidden) return null;\n const drawn = spaceVisibility(node, isRoot);\n if (drawn === \"none\") return null;\n\n const inside = drawn === \"all\" && containsPoint(node, point, tolerance);\n // A clipping node (or one that opens a camera viewport) gates its subtree —\n // unless it is drawing nothing of its own, when it clips nothing either.\n if (!inside && drawn === \"all\" && node._confinesChildren()) return null;\n\n // A `Canvas3D`'s children come in both dimensions, and its 2D ones are\n // indexed against the *whole* list — see {@link childSlots}.\n const children = childSlots(node);\n const order = paintOrder(node, children);\n for (let k = order.length - 1; k >= 0; k--) {\n const i = order[k];\n const slot = children[i];\n if (slot === null) continue;\n const hit = pickIn(slot, nodePath(path, i), point, tolerance, false);\n if (hit) return hit;\n }\n\n // The 3D scene draws under the 2D children and over the canvas's own fill, so\n // it is tested in that order too: a HUD label wins over the mesh behind it,\n // and the mesh wins over the viewport it sits in.\n if (node instanceof Canvas3D && inside) {\n const hit = pickNode3D(node, canvas3DFrame(node, path), point, tolerance, path);\n if (hit) return hit;\n }\n\n if (isRoot) return null;\n // A locked node declines to *be* the answer while still having gated its\n // subtree above — so a click inside a locked group lands on nothing rather\n // than falling through to whatever is behind the group.\n if (node.locked) return null;\n return inside ? nodeBox(node, path) : null;\n}\n\n/**\n * Collect every visible node's box in draw order (parents before children, so a\n * host can paint them in the order the renderer did). Skips `opacity: 0` nodes\n * and the scene root, matching {@link pickNode}.\n *\n * A `Canvas3D` also contributes a box per `Node3D` inside it, projected into its\n * plane — see `node-picking3d.ts`. They sit after the viewport's own box and\n * before its 2D children's, which is where the 3D pass is painted; among\n * themselves they are ordered **near camera first**, because a 3D scene has no\n * draw order of its own for them to be in.\n */\nexport function collectBoxes(node: Node2D, path: string, out: NodeBox[], isRoot: boolean): void {\n if (node.opacity === 0 || node.hidden) return;\n const drawn = spaceVisibility(node, isRoot);\n if (drawn === \"none\") return;\n // Locked nodes keep their box — a host still has to draw a selection outline\n // around one picked from its layer tree. What the box carries is the flag, so\n // a marquee can leave it out without a second walk.\n if (!isRoot && drawn === \"all\") out.push(nodeBox(node, path));\n\n if (node instanceof Canvas3D) {\n for (const box of collectBoxes3D(node, canvas3DFrame(node, path), path)) out.push(box);\n }\n\n const children = childSlots(node);\n for (const i of paintOrder(node, children)) {\n const slot = children[i];\n if (slot !== null) collectBoxes(slot, nodePath(path, i), out, false);\n }\n}\n\n/**\n * How much of `node` a space lets the renderer draw: `\"all\"` outside a space and\n * for a node facing the camera in front of it; `\"children\"` for one edge-on or\n * behind the lens, whose own paint is skipped while its children, placed by\n * frames of their own, are not; `\"none\"` for one the renderer skips outright — a\n * hidden back face, or a flattening node with nothing on screen.\n */\nfunction spaceVisibility(node: Node2D, isRoot: boolean): \"all\" | \"children\" | \"none\" {\n if (isRoot) return \"all\";\n const frame = spaceFrameOf(node);\n if (!frame) return \"all\";\n if (!node.backfaceVisible && frame.facesAway) return \"none\";\n if (frame.paints) return \"all\";\n return node._rendersChildrenInSpace() ? \"children\" : \"none\";\n}\n\n/**\n * The slots of `children` in the order the renderer paints them: authored\n * order, except among siblings in a space, which paint far to near.\n */\nfunction paintOrder(node: Node2D, children: readonly (Node2D | null)[]): number[] {\n const natural = children.map((_, i) => i);\n const frame = spaceFrameForChildren(node);\n if (!frame) return natural;\n const slots = natural.filter((i) => children[i] !== null);\n const frames = slots.map((i) => spaceChildFrame(frame, children[i]!));\n return spaceChildOrder(frames).map((k) => slots[k]);\n}\n\n/**\n * The node's children as **index slots**, with a `null` wherever the slot holds\n * something this walk doesn't descend into.\n *\n * Everywhere but a `Canvas3D` this is just `children`, and the array is returned\n * untouched. A `Canvas3D` is the one node holding both dimensions, and its\n * `Node2D.children` drops the meshes — which would renumber its HUD children and\n * hand every one of them the path of an earlier sibling. So its slots are taken\n * from the authored list with the 3D ones blanked out: same indices as the\n * document, and the meshes reached through their own walk instead.\n */\nfunction childSlots(node: Node2D): readonly (Node2D | null)[] {\n if (!(node instanceof Canvas3D)) return node.children;\n return node._allChildren.map((child) => (child instanceof Node2D ? child : null));\n}\n\n/** What the 3D walk needs to know about the viewport it is projecting into. */\nfunction canvas3DFrame(canvas: Canvas3D, path: string): Canvas3DFrame {\n return { box: nodeBox(canvas, path), matrix: renderMatrix(canvas) };\n}\n\n/** Map `point` into `node`'s local space and ask the node whether it was hit. */\nfunction containsPoint(node: Node2D, point: Vector2, tolerance: number): boolean {\n const m = renderMatrix(node);\n const inv = invert(m);\n if (!inv) return false; // zero scale — nothing to hit\n // The render matrix works in canvas (y-down) space; `worldAnchors` flips y in\n // and back out, so the inverse does the same to land in the node's centred,\n // y-up local frame — the space `hitTestSelf` and the clip descriptors use.\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\n if (behindCamera(m, p)) return false;\n return node._hitTestSelf({ x: p.x, y: -p.y }, tolerance);\n}\n"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ED,iFAAiF;AACjF,SAAS,aAAa,CAAC,IAAY,EAAE,KAAc,EAAE,SAAiB;IAClE,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,CAAuB,8BAA8B;IAC5E,8EAA8E;IAC9E,4EAA4E;IAC5E,2EAA2E;IAC3E,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACzD,IAAI,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { Node } from \"@/nodes/node/node\";\r\nimport { Node2D, type NodeHandle } from \"@/nodes/2d/node2d\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Matrix2D, multiply, invert, applyToPoint, cameraMatrix, translation, isProjective } from \"@/attributes/layout/matrix2d\";\r\nimport { worldAnchors } from \"@/nodes/2d/node-transform\";\r\nimport { spaceChildFrame, spaceChildOrder, spaceFrameForChildren, spaceFrameOf, spaceRootFrame } from \"@/nodes/2d/node-space\";\r\nimport { multiplyAffine3, spaceScreenMatrix } from \"@/attributes/layout/space3d\";\r\nimport { nodePath } from \"@/project/tree\";\r\nimport { collectBoxes3D, isViewport3D, pickNode3D, projectNode3D, type Canvas3DFrame, type Node3DFrame, type Viewport3D } from \"./node-picking3d\";\r\nimport type { Vector3 } from \"@/render3d/vector3\";\r\n\r\n/**\r\n * Pure geometry for editor-style direct manipulation: where a node's pixels\r\n * landed, and which node is under a point. No controller state, so it can be\r\n * exercised against hand-built node trees.\r\n *\r\n * **Space.** Everything here is in *viewport space*: origin at the viewport\r\n * centre, y-up, units = the viewport pixels the player was given. That is the\r\n * same space `Node2D.global` reports, plus the camera — see {@link renderMatrix}.\r\n */\r\n\r\n/**\r\n * A node's on-screen box at the current frame, in viewport space (origin at the\r\n * viewport centre, y-up).\r\n *\r\n * Unlike {@link Node2D.global} this folds in any active camera scope, so it\r\n * describes where the node's pixels actually landed — which is what an editor\r\n * overlay needs in order to draw a selection box over them.\r\n */\r\nexport interface NodeBox {\r\n /** Per-instance id — changes on every rebuild. Use {@link path} to key across rebuilds. */\r\n id: string;\r\n /** Structural path from the scene root (`\"\"` is the root); stable across rebuilds. */\r\n path: string;\r\n /** Node2D class name, e.g. `Rect`, `Text`. */\r\n type: string;\r\n /** Corners in draw order, viewport space. Rotated/scaled — not axis-aligned. */\r\n topLeft: Vector2;\r\n topRight: Vector2;\r\n bottomRight: Vector2;\r\n bottomLeft: Vector2;\r\n center: Vector2;\r\n /**\r\n * Size of the box before rotation/scale, in scene units — the node's layout\r\n * size for everything whose drawing fills its cell, and the ink's own extent\r\n * where the two differ (see {@link Node2D._localBounds}; a boolean group\r\n * reports the extent of its children's ink, not its layout rect).\r\n */\r\n width: number;\r\n height: number;\r\n /** Folded rotation (degrees clockwise) and uniform scale, camera included. */\r\n rotation: number;\r\n scale: number;\r\n /** Effective alpha; `0` means the node is present but invisible. */\r\n opacity: number;\r\n /**\r\n * The editor's padlock — see {@link NodeEditorState.locked}.\r\n *\r\n * Carried here rather than left for the host to look up, because the two\r\n * things that need it are a marquee sweep and a gizmo's handles, and both are\r\n * already holding the box. A locked node is never returned by\r\n * {@link pickNode}; it appears in {@link collectBoxes} so a host can still\r\n * outline one selected from its layer tree.\r\n */\r\n locked: boolean;\r\n}\r\n\r\n/**\r\n * The renderer's CTM at `node` — every ancestor's local matrix from the scene\r\n * root down, with a camera scope inserted wherever an ancestor pushes one\r\n * ({@link Node2D._cameraScope}; `Canvas2D`/`Camera` call `beginCamera` between\r\n * their own transform and their children's).\r\n *\r\n * A node inside a 2.5D space is placed by its frame instead — the whole\r\n * projection from its own plane to the space root's, built by the same\r\n * `node-space.ts` the renderer uses — so it is a homography, and `nodeBox`\r\n * reports the projected corners.\r\n *\r\n * Mirrors the render walk exactly, including the camera's `translate(rect.x,\r\n * -rect.y)` — if a box ever disagrees with the pixels, the divergence is here.\r\n *\r\n * `@internal`, and shared with `text-geometry.ts`: a caret drawn over a node has\r\n * to land in the same space as the box drawn around it, so both must come from\r\n * this one walk rather than two that agree by inspection.\r\n */\r\n/** @internal */\r\nexport function renderMatrix(node: Node2D): Matrix2D {\r\n const frame = spaceFrameOf(node);\r\n if (frame) return multiply(renderMatrix(frame.root), frame.screen);\r\n const parent = node.parent;\r\n return parent ? multiply(childrenMatrix(parent), node._localMatrix()) : node._localMatrix();\r\n}\r\n\r\n/**\r\n * The CTM `parent`'s children are placed under, before their own transform: its\r\n * render matrix, then whatever camera it opens. For a space root that is the\r\n * camera over its own plane; inside a space it is the parent's own frame, since\r\n * a child's place is measured in its parent's plane.\r\n */\r\nfunction childrenMatrix(parent: Node2D): Matrix2D {\r\n const m = renderMatrix(parent);\r\n const camera = parent._spaceCamera();\r\n if (camera) return multiply(m, spaceRootFrame(parent, camera).screen);\r\n const cam = parent._cameraScope();\r\n if (!cam) return m;\r\n const r = parent.layoutBounds;\r\n return multiply(m, cameraMatrix(r.x, -r.y, cam.lookAt, cam.zoom, cam.heading));\r\n}\r\n\r\n/**\r\n * Where `point` (viewport space) lands on the plane the node at `path` moves in\r\n * when its `x`/`y` change — its parent's, through any camera in between, pushed\r\n * out to the node's own `depth` in a space — in its parent's frame: centred on\r\n * the parent (on its slot, for a node a parent places — see `ChildPlacement`),\r\n * y-up. `null` when the path does not name a 2D node below the\r\n * root, or that plane cannot be reached at that point (edge-on, or the point is\r\n * behind the camera).\r\n *\r\n * Two answers differ by exactly the change of `x`/`y` that carries the node from\r\n * one point to the other — what a move handle needs once a node can sit in\r\n * depth, where a screen delta is no longer a parent delta.\r\n *\r\n * Under a parent with coordinates of its own (`Node2D._planeOf`) the answer is\r\n * in them, and is the `x`/`y` that centres the node on `point`.\r\n */\r\nexport function parentPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\r\n if (path === \"\") return null;\r\n const node = nodeAt(root, path);\r\n const parent = node instanceof Node2D ? node.parent : null;\r\n if (!(node instanceof Node2D) || !parent) return null;\r\n const m = movePlaneMatrix(node, parent);\r\n const inv = invert(m);\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return null;\r\n const plane = parent._planeOf(node);\r\n if (!plane) return { x: p.x, y: -p.y };\r\n // A slot's frame is already centred on the node's box; the parent's is not.\r\n const box = node._placement() ? null : node.layoutBounds;\r\n return plane.toCoords(p.x - (box?.x ?? 0), (box?.y ?? 0) - p.y);\r\n}\r\n\r\n/**\r\n * Where `point` (viewport space) lands in the coordinates the node at `path`\r\n * positions its children in ({@link Node2D._planeOf}): the `x`/`y` a child takes\r\n * to be centred there, before it exists. `null` when that node's children are\r\n * positioned in pixels, which is how a host tells the two apart.\r\n */\r\nexport function childPlanePointAt(root: Node2D, path: string, point: Vector2): Vector2 | null {\r\n const parent = nodeAt(root, path);\r\n if (!(parent instanceof Node2D)) return null;\r\n const plane = parent._planeOf(null);\r\n if (!plane) return null;\r\n const inv = invert(childrenMatrix(parent));\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n return plane.toCoords(p.x, -p.y);\r\n}\r\n\r\n/**\r\n * What keeps the node at `path` looking exactly as it does once it moves under\r\n * the node at `parentPath`, as a design tool does: each of `offsets` (an\r\n * `x`/`y` it takes under its parent now: its own, or where a move takes it)\r\n * carried to the one that puts its centre at the same place there, and the\r\n * `turn` to add to its rotation and the `scale` to multiply its scale by so\r\n * the parents' own turn and scale, cameras included, are undone. `null` when\r\n * that parent arranges its children in a run or a grid, sits inside the node,\r\n * or either is not here.\r\n */\r\nexport function reparentPlacementAt(\r\n root: Node2D, path: string, parentPath: string, offsets: readonly Vector2[],\r\n): ReparentPlacement | null {\r\n const node = nodeAt(root, path);\r\n const to = nodeAt(root, parentPath);\r\n const from = node instanceof Node2D ? node.parent : null;\r\n if (!(node instanceof Node2D) || !(from instanceof Node2D) || !(to instanceof Node2D)) return null;\r\n for (let at: Node | null = to; at; at = at.parent) if (at === node) return null;\r\n const box = node.layoutBounds;\r\n const plane = to._planeOf(null);\r\n const slot = plane ? null : to._slotFor({ width: box?.width ?? 0, height: box?.height ?? 0 });\r\n if (!plane && !slot) return null;\r\n const along = movePlaneMatrix(node, from);\r\n const back = invert(along);\r\n const into = invert(childrenMatrix(to));\r\n if (!back || !into) return null;\r\n\r\n const placed = node._placement();\r\n const was = childFold(from);\r\n const will = childFold(to);\r\n const turn = was.rotation + (placed?.rotation ?? 0) - will.rotation;\r\n const scale = will.scale === 0 ? 1 : (was.scale * (placed?.scale ?? 1)) / will.scale;\r\n const shift = node._centreShift(node.rotation + turn, node.scale * scale);\r\n\r\n // The plane the node's x/y move it on, where its centre is drawn now.\r\n const here = applyToPoint(back, applyToPoint(renderMatrix(node), { x: 0, y: 0 }));\r\n const own = from._planeOf(node);\r\n const pixels = (offset: Vector2): Vector2 => (own ? { ...own.toOffset(offset.x, offset.y) } : offset);\r\n const now = pixels({ x: node.x, y: node.y });\r\n const moved = offsets.map((offset) => {\r\n const o = pixels(offset);\r\n const drawn = applyToPoint(along, { x: here.x + o.x - now.x, y: here.y - (o.y - now.y) });\r\n const centre = applyToPoint(into, drawn);\r\n const x = centre.x - shift.x;\r\n const y = centre.y - shift.y;\r\n return plane ? plane.toCoords(x, -y) : { x: x - slot!.x, y: slot!.y - y };\r\n });\r\n return { offsets: moved, turn, scale };\r\n}\r\n\r\n/** What {@link reparentPlacementAt} answers. */\r\nexport interface ReparentPlacement {\r\n /** Each offset asked about, under the new parent. */\r\n offsets: Vector2[];\r\n /** Degrees (clockwise) to add to the node's rotation, and to where its turns end. */\r\n turn: number;\r\n /** The factor to multiply the node's scale by, and where its scalings end. */\r\n scale: number;\r\n}\r\n\r\n/** The rotation and scale a child of `parent` is drawn under: its fold, then the camera it opens. */\r\nfunction childFold(parent: Node2D): { rotation: number; scale: number } {\r\n const folded = foldedTransform(parent);\r\n const cam = parent._cameraScope();\r\n return cam ? { rotation: folded.rotation - cam.heading, scale: folded.scale * cam.zoom } : folded;\r\n}\r\n\r\n/**\r\n * The node at `path`'s {@link NodeHandle}s with `at` in viewport space, where the\r\n * pixels put them; `null` when the path names no 2D node.\r\n */\r\nexport function nodeHandlesAt(root: Node2D, path: string): NodeHandle[] | null {\r\n const node = nodeAt(root, path);\r\n if (!(node instanceof Node2D)) return null;\r\n const m = renderMatrix(node);\r\n return node._handles().map(({ prop, at }) => {\r\n const p = applyToPoint(m, { x: at.x, y: -at.y });\r\n return { prop, at: { x: p.x, y: -p.y } };\r\n });\r\n}\r\n\r\n/**\r\n * The value of `prop` that puts its handle on the node at `path` under `point`\r\n * (viewport space), or `null` when there is no such handle or the point is off\r\n * the node's plane.\r\n */\r\nexport function handleValueAt(root: Node2D, path: string, prop: string, point: Vector2): Vector2 | null {\r\n const node = nodeAt(root, path);\r\n if (!(node instanceof Node2D)) return null;\r\n const m = renderMatrix(node);\r\n const inv = invert(m);\r\n if (!inv) return null;\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return null;\r\n return node._handleValue(prop, { x: p.x, y: -p.y });\r\n}\r\n\r\n/** The parent's frame at the node's depth, onto the screen: the plane its `x`/`y` slide it across. */\r\nfunction movePlaneMatrix(node: Node2D, parent: Node2D): Matrix2D {\r\n const frame = spaceFrameOf(node) ? spaceFrameForChildren(parent) : null;\r\n if (!frame) {\r\n // A slotted node's `x`/`y` move it within its slot, which may be turned.\r\n const slot = node._slotMatrix();\r\n return slot ? multiply(childrenMatrix(parent), slot) : childrenMatrix(parent);\r\n }\r\n const slot = node._slotAffine();\r\n const plane = slot ? multiplyAffine3(frame.view, slot) : frame.view;\r\n const atDepth = multiplyAffine3(plane, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, node.depth]);\r\n return multiply(renderMatrix(frame.root), spaceScreenMatrix(frame.camera, atDepth));\r\n}\r\n\r\n/**\r\n * Under a perspective the inverse also answers for the plane's reflection behind\r\n * the camera: a point there projects to the same pixel with a negative `w`, and\r\n * is not on screen at all.\r\n */\r\nfunction behindCamera(m: Matrix2D, local: Vector2): boolean {\r\n return isProjective(m) && (m.g ?? 0) * local.x + (m.h ?? 0) * local.y + (m.i ?? 1) <= 0;\r\n}\r\n\r\n/**\r\n * Folded rotation / scale / opacity from the scene root down to `node`, matching\r\n * the renderer's nested transforms and its pass-through alpha fold. The same\r\n * accumulation {@link Node2D.global} does, extended with the camera scopes: a\r\n * camera multiplies the scale by its `zoom` and adds `-heading` to the rotation\r\n * (the renderer applies `rotate(-heading)`).\r\n */\r\nfunction foldedTransform(node: Node2D): { rotation: number; scale: number; opacity: number } {\r\n let rotation = 0;\r\n let scale = 1;\r\n let opacity = 1;\r\n for (let n: Node2D | null = node; n; n = n.parent) {\r\n const slot = n._placement();\r\n rotation += n.rotation + (slot?.rotation ?? 0);\r\n scale *= n.scale * (slot?.scale ?? 1);\r\n opacity *= n.opacity * (slot?.opacity ?? 1);\r\n // Skip the node's own camera: it scopes its children, not itself.\r\n const cam = n !== node ? n._cameraScope() : null;\r\n if (cam) {\r\n rotation -= cam.heading;\r\n scale *= cam.zoom;\r\n }\r\n }\r\n return { rotation, scale, opacity };\r\n}\r\n\r\n/** Build the viewport-space box for `node` at the current frame. */\r\nexport function nodeBox(node: Node2D, path: string): NodeBox {\r\n const b = node._localBounds();\r\n // `worldAnchors` maps offsets centred on the matrix's origin, so shift the\r\n // matrix onto the bounds' own centre first — that is what lets a node whose\r\n // ink is off-centre report a box that actually sits on the ink.\r\n // The matrix is canvas y-down; the bounds are y-up, hence the sign on y.\r\n const m = b.x === 0 && b.y === 0\r\n ? renderMatrix(node)\r\n : multiply(renderMatrix(node), translation(b.x, -b.y));\r\n const anchors = worldAnchors(m, b.width / 2, b.height / 2);\r\n const folded = foldedTransform(node);\r\n return {\r\n id: node.id,\r\n path,\r\n type: node.className,\r\n topLeft: anchors.topLeft,\r\n topRight: anchors.topRight,\r\n bottomRight: anchors.bottomRight,\r\n bottomLeft: anchors.bottomLeft,\r\n center: anchors.center,\r\n width: b.width,\r\n height: b.height,\r\n rotation: folded.rotation,\r\n scale: folded.scale,\r\n opacity: folded.opacity,\r\n locked: node.locked,\r\n };\r\n}\r\n\r\n/**\r\n * The box at a structural path, in either dimension, or `null` when the path\r\n * doesn't resolve.\r\n *\r\n * The one entry point that answers for a 3D node as well as a 2D one, which a\r\n * bare {@link nodeBox} cannot: a mesh is not a `Node2D` and has no box of its\r\n * own — what it has is a projection into the viewport that holds it, and finding\r\n * that viewport is part of resolving the path (see `node-picking3d.ts`).\r\n *\r\n * Walks {@link Node._allChildren}, so the paths it accepts are the ones every\r\n * other structural walk in the engine produces.\r\n */\r\nexport function nodeBoxAt(root: Node2D, path: string): NodeBox | null {\r\n if (path === \"\") return nodeBox(root, path);\r\n\r\n let node: Node = root;\r\n let canvas: { node: Viewport3D; path: string } | null = null;\r\n const segments = path.split(\".\");\r\n for (let i = 0; i < segments.length; i++) {\r\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\r\n const next = node._allChildren[Number(segments[i])];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n\r\n if (node instanceof Node2D) return nodeBox(node, path);\r\n // A 3D node: ask the viewport that holds it. There is always one — a `Node3D`\r\n // cannot be parented anywhere else (the engine throws rather than allowing\r\n // it) — so a `null` here is a malformed tree rather than a missing case.\r\n if (!canvas) return null;\r\n const frame = canvas3DFrame(canvas.node, canvas.path);\r\n return collectBoxes3D(canvas.node, frame, canvas.path).find((box) => box.path === path) ?? null;\r\n}\r\n\r\n/**\r\n * The node at a structural path, in either dimension, or `null` when the path\r\n * doesn't resolve.\r\n *\r\n * The resolution half of {@link nodeBoxAt}, split out for callers that want the\r\n * node rather than its box — `PlaybackController.getNodePropsAt`, which reads a\r\n * node's own props in its own space. Walks {@link Node._allChildren}, so it\r\n * accepts the same paths every other structural walk in the engine produces.\r\n */\r\nexport function nodeAt(root: Node2D, path: string): Node | null {\r\n if (path === \"\") return root;\r\n let node: Node = root;\r\n for (const segment of path.split(\".\")) {\r\n const next = node._allChildren[Number(segment)];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n return node;\r\n}\r\n\r\n/** The first `count` segments of a split path, rejoined. */\r\nfunction prefixPath(segments: readonly string[], count: number): string {\r\n return segments.slice(0, count).join(\".\");\r\n}\r\n\r\n/**\r\n * Project a handful of points around the `Node3D` at `path`, or `null` when\r\n * the path doesn't resolve to a 3D node — a gizmo's counterpart to\r\n * {@link nodeBoxAt}, for the one thing a box can't answer: where would an\r\n * arbitrary point *near* the node, not just its extent, land on screen. See\r\n * {@link Node3DFrame} for the two point sets and the space each is in.\r\n *\r\n * `null` for a 2D path too, unlike `nodeBoxAt` — a `Node2D` has no matrix a\r\n * caller would ask this for; {@link nodeBox} already answers everything a 2D\r\n * handle needs directly in viewport space.\r\n */\r\nexport function projectNode3DAt(\r\n root: Node2D,\r\n path: string,\r\n parentPoints: readonly Vector3[],\r\n localPoints: readonly Vector3[],\r\n): Node3DFrame | null {\r\n if (path === \"\") return null;\r\n\r\n let node: Node = root;\r\n let canvas: { node: Viewport3D; path: string } | null = null;\r\n const segments = path.split(\".\");\r\n for (let i = 0; i < segments.length; i++) {\r\n if (isViewport3D(node)) canvas = { node, path: prefixPath(segments, i) };\r\n const next = node._allChildren[Number(segments[i])];\r\n if (!next) return null;\r\n node = next;\r\n }\r\n\r\n if (node instanceof Node2D || !canvas) return null;\r\n const frame = canvas3DFrame(canvas.node, canvas.path);\r\n return projectNode3D(canvas.node, frame, canvas.path, path, parentPoints, localPoints);\r\n}\r\n\r\n/**\r\n * The topmost node whose hit region contains `point` (viewport space, y-up,\r\n * origin at the viewport centre), or `null`. Children paint over their parent and\r\n * later siblings over earlier ones, so the walk tests children last-to-first\r\n * before falling back to the node itself.\r\n *\r\n * Skips fully transparent nodes — a scene built with spawn delays keeps\r\n * not-yet-visible nodes in the tree at `opacity: 0`, and those must not be\r\n * selectable. A node that clips (or pushes a camera, which clips to its viewport)\r\n * confines its subtree: a point outside its box cannot hit anything inside it.\r\n * The scene root is never returned; it is the stage, not a selectable node.\r\n *\r\n * The hit region is {@link Node2D.hitTestSelf} — the rotated layout box by default,\r\n * narrowed to the declared outline for shapes. A click in the corner of a rect's\r\n * box selects it; a click in the empty notch of a star's box does not.\r\n *\r\n * `tolerance` is grab-slop in scene units, applied outward from the ink. A host\r\n * passes its zoom-corrected pixel slop so the grab area stays constant on screen.\r\n * It is what makes thin shapes reachable.\r\n *\r\n * Cost: {@link renderMatrix} walks to the root per node, making a pick O(depth²).\r\n * Scene trees here are shallow (tens of nodes, depth < 10), so this is fine at\r\n * pointer rate. If it ever matters, thread the parent's accumulated matrix down\r\n * through the walk instead of recomputing — a change confined to this file.\r\n */\r\nexport function pickNode(root: Node2D, point: Vector2, tolerance = 0): NodeBox | null {\r\n return pickIn(root, \"\", point, tolerance, true);\r\n}\r\n\r\nfunction pickIn(node: Node2D, path: string, point: Vector2, tolerance: number, isRoot: boolean): NodeBox | null {\r\n if (node.opacity === 0 || node.hidden) return null;\r\n const drawn = spaceVisibility(node, isRoot);\r\n if (drawn === \"none\") return null;\r\n\r\n const inside = drawn === \"all\" && containsPoint(node, point, tolerance);\r\n // A clipping node (or one that opens a camera viewport) gates its subtree —\r\n // unless it is drawing nothing of its own, when it clips nothing either.\r\n if (!inside && drawn === \"all\" && node._confinesChildren()) return null;\r\n\r\n // A `Canvas3D`'s children come in both dimensions, and its 2D ones are\r\n // indexed against the *whole* list — see {@link childSlots}.\r\n const children = childSlots(node);\r\n const order = paintOrder(node, children);\r\n for (let k = order.length - 1; k >= 0; k--) {\r\n const i = order[k];\r\n const slot = children[i];\r\n if (slot === null) continue;\r\n const hit = pickIn(slot, nodePath(path, i), point, tolerance, false);\r\n if (hit) return hit;\r\n }\r\n\r\n // The 3D scene draws under the 2D children and over the canvas's own fill, so\r\n // it is tested in that order too: a HUD label wins over the mesh behind it,\r\n // and the mesh wins over the viewport it sits in.\r\n if (isViewport3D(node) && inside) {\r\n const hit = pickNode3D(node, canvas3DFrame(node, path), point, tolerance, path);\r\n if (hit) return hit;\r\n }\r\n\r\n if (isRoot) return null;\r\n // A locked node declines to *be* the answer while still having gated its\r\n // subtree above — so a click inside a locked group lands on nothing rather\r\n // than falling through to whatever is behind the group.\r\n if (node.locked) return null;\r\n return inside ? nodeBox(node, path) : null;\r\n}\r\n\r\n/**\r\n * Collect every visible node's box in draw order (parents before children, so a\r\n * host can paint them in the order the renderer did). Skips `opacity: 0` nodes\r\n * and the scene root, matching {@link pickNode}.\r\n *\r\n * A `Canvas3D` also contributes a box per `Node3D` inside it, projected into its\r\n * plane — see `node-picking3d.ts`. They sit after the viewport's own box and\r\n * before its 2D children's, which is where the 3D pass is painted; among\r\n * themselves they are ordered **near camera first**, because a 3D scene has no\r\n * draw order of its own for them to be in.\r\n */\r\nexport function collectBoxes(node: Node2D, path: string, out: NodeBox[], isRoot: boolean): void {\r\n if (node.opacity === 0 || node.hidden) return;\r\n const drawn = spaceVisibility(node, isRoot);\r\n if (drawn === \"none\") return;\r\n // Locked nodes keep their box — a host still has to draw a selection outline\r\n // around one picked from its layer tree. What the box carries is the flag, so\r\n // a marquee can leave it out without a second walk.\r\n if (!isRoot && drawn === \"all\") out.push(nodeBox(node, path));\r\n\r\n if (isViewport3D(node)) {\r\n for (const box of collectBoxes3D(node, canvas3DFrame(node, path), path)) out.push(box);\r\n }\r\n\r\n const children = childSlots(node);\r\n for (const i of paintOrder(node, children)) {\r\n const slot = children[i];\r\n if (slot !== null) collectBoxes(slot, nodePath(path, i), out, false);\r\n }\r\n}\r\n\r\n/**\r\n * How much of `node` a space lets the renderer draw: `\"all\"` outside a space and\r\n * for a node facing the camera in front of it; `\"children\"` for one edge-on or\r\n * behind the lens, whose own paint is skipped while its children, placed by\r\n * frames of their own, are not; `\"none\"` for one the renderer skips outright — a\r\n * hidden back face, or a flattening node with nothing on screen.\r\n */\r\nfunction spaceVisibility(node: Node2D, isRoot: boolean): \"all\" | \"children\" | \"none\" {\r\n if (isRoot) return \"all\";\r\n const frame = spaceFrameOf(node);\r\n if (!frame) return \"all\";\r\n if (!node.backfaceVisible && frame.facesAway) return \"none\";\r\n if (frame.paints) return \"all\";\r\n return node._rendersChildrenInSpace() ? \"children\" : \"none\";\r\n}\r\n\r\n/**\r\n * The slots of `children` in the order the renderer paints them: authored\r\n * order, except among siblings in a space, which paint far to near.\r\n */\r\nfunction paintOrder(node: Node2D, children: readonly (Node2D | null)[]): number[] {\r\n const natural = children.map((_, i) => i);\r\n const frame = spaceFrameForChildren(node);\r\n if (!frame) return natural;\r\n const slots = natural.filter((i) => children[i] !== null);\r\n const frames = slots.map((i) => spaceChildFrame(frame, children[i]!));\r\n return spaceChildOrder(frames).map((k) => slots[k]);\r\n}\r\n\r\n/**\r\n * The node's children as **index slots**, with a `null` wherever the slot holds\r\n * something this walk doesn't descend into.\r\n *\r\n * Everywhere but a `Canvas3D` this is just `children`, and the array is returned\r\n * untouched. A `Canvas3D` is the one node holding both dimensions, and its\r\n * `Node2D.children` drops the meshes — which would renumber its HUD children and\r\n * hand every one of them the path of an earlier sibling. So its slots are taken\r\n * from the authored list with the 3D ones blanked out: same indices as the\r\n * document, and the meshes reached through their own walk instead.\r\n */\r\nfunction childSlots(node: Node2D): readonly (Node2D | null)[] {\r\n if (!(isViewport3D(node))) return node.children;\r\n return node._allChildren.map((child) => (child instanceof Node2D ? child : null));\r\n}\r\n\r\n/** What the 3D walk needs to know about the viewport it is projecting into. */\r\nfunction canvas3DFrame(canvas: Viewport3D, path: string): Canvas3DFrame {\r\n return { box: nodeBox(canvas, path), matrix: renderMatrix(canvas) };\r\n}\r\n\r\n/** Map `point` into `node`'s local space and ask the node whether it was hit. */\r\nfunction containsPoint(node: Node2D, point: Vector2, tolerance: number): boolean {\r\n const m = renderMatrix(node);\r\n const inv = invert(m);\r\n if (!inv) return false; // zero scale — nothing to hit\r\n // The render matrix works in canvas (y-down) space; `worldAnchors` flips y in\r\n // and back out, so the inverse does the same to land in the node's centred,\r\n // y-up local frame — the space `hitTestSelf` and the clip descriptors use.\r\n const p = applyToPoint(inv, { x: point.x, y: -point.y });\r\n if (behindCamera(m, p)) return false;\r\n return node._hitTestSelf({ x: p.x, y: -p.y }, tolerance);\r\n}\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Node2D } from "../nodes/2d/node2d.js";
|
|
2
2
|
import type { Vector2 } from "../attributes/layout/vector2.js";
|
|
3
3
|
import { type Matrix2D } from "../attributes/layout/matrix2d.js";
|
|
4
|
+
import type { Scene3D } from "../render3d/scene3d.js";
|
|
4
5
|
import type { Vector3 } from "../render3d/vector3.js";
|
|
5
6
|
import type { NodeBox } from "./node-picking.js";
|
|
6
7
|
/**
|
|
@@ -51,6 +52,12 @@ import type { NodeBox } from "./node-picking.js";
|
|
|
51
52
|
*/
|
|
52
53
|
/** What the 2D walk already knows about the canvas, handed down. */
|
|
53
54
|
/** @internal */
|
|
55
|
+
/** A 2D node over a 3D scene (a `Canvas3D`): its 3D children are picked through the scene it builds. */
|
|
56
|
+
export interface Viewport3D extends Node2D {
|
|
57
|
+
_isViewport3D(): boolean;
|
|
58
|
+
_scene3D(): Scene3D | null;
|
|
59
|
+
}
|
|
60
|
+
export declare function isViewport3D(node: unknown): node is Viewport3D;
|
|
54
61
|
export interface Canvas3DFrame {
|
|
55
62
|
/**
|
|
56
63
|
* The canvas's own box. Its folded `rotation`/`scale`/`opacity` carry to
|
|
@@ -76,7 +83,7 @@ export interface Canvas3DFrame {
|
|
|
76
83
|
* last of those.
|
|
77
84
|
*/
|
|
78
85
|
/** @internal */
|
|
79
|
-
export declare function collectBoxes3D(canvas:
|
|
86
|
+
export declare function collectBoxes3D(canvas: Viewport3D, frame: Canvas3DFrame, path: string): NodeBox[];
|
|
80
87
|
/**
|
|
81
88
|
* Where a handful of arbitrary points around one `Node3D` land on screen — the
|
|
82
89
|
* ingredient a box can't supply for a gizmo.
|
|
@@ -97,7 +104,8 @@ export interface Node3DFrame {
|
|
|
97
104
|
origin: Vector2 | null;
|
|
98
105
|
/**
|
|
99
106
|
* `parentPoints` transformed by the node's **parent's** world matrix, then
|
|
100
|
-
* projected
|
|
107
|
+
* projected, through the parent's own coordinates where it places its
|
|
108
|
+
* children by them. The frame `Node3DProps.position` is itself expressed in, so
|
|
101
109
|
* this is the space a move or scale handle belongs in: a point named
|
|
102
110
|
* `{ ...position, x: position.x + 1 }` projects to where nudging `x` by
|
|
103
111
|
* one unit would actually land, with no need to know whether "one unit"
|
|
@@ -123,7 +131,7 @@ export interface Node3DFrame {
|
|
|
123
131
|
* (`node-picking.ts`, one level up).
|
|
124
132
|
*/
|
|
125
133
|
/** @internal */
|
|
126
|
-
export declare function projectNode3D(canvas:
|
|
134
|
+
export declare function projectNode3D(canvas: Viewport3D, frame: Canvas3DFrame, canvasPath: string, targetPath: string, parentPoints: readonly Vector3[], localPoints: readonly Vector3[]): Node3DFrame | null;
|
|
127
135
|
/**
|
|
128
136
|
* The nearest 3D node in `canvas` whose box contains `point` (viewport space,
|
|
129
137
|
* y-up), or `null`.
|
|
@@ -134,5 +142,5 @@ export declare function projectNode3D(canvas: Canvas3D, frame: Canvas3DFrame, ca
|
|
|
134
142
|
* quoted it as.
|
|
135
143
|
*/
|
|
136
144
|
/** @internal */
|
|
137
|
-
export declare function pickNode3D(canvas:
|
|
145
|
+
export declare function pickNode3D(canvas: Viewport3D, frame: Canvas3DFrame, point: Vector2, tolerance: number, path: string): NodeBox | null;
|
|
138
146
|
//# sourceMappingURL=node-picking3d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-picking3d.d.ts","sourceRoot":"","sources":["../../src/runtime/node-picking3d.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"node-picking3d.d.ts","sourceRoot":"","sources":["../../src/runtime/node-picking3d.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,oBAAoB,CAAC;AAS7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,oEAAoE;AACpE,gBAAgB;AAChB,wGAAwG;AACxG,MAAM,WAAW,UAAW,SAAQ,MAAM;IACtC,aAAa,IAAI,OAAO,CAAC;IACzB,QAAQ,IAAI,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAE9D;AAED,MAAM,WAAW,aAAa;IAC1B;;;;;OAKG;IACH,GAAG,EAAE,OAAO,CAAC;IACb,gEAAgE;IAChE,MAAM,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAmBhG;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IACxB,4DAA4D;IAC5D,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB;;;;;;;;OAQG;IACH,YAAY,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IACjC;;;;;OAKG;IACH,WAAW,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;CACnC;AAID;;;;;;;;;GASG;AACH,gBAAgB;AAChB,wBAAgB,aAAa,CACzB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,SAAS,OAAO,EAAE,EAChC,WAAW,EAAE,SAAS,OAAO,EAAE,GAChC,WAAW,GAAG,IAAI,CAuBpB;AA4BD;;;;;;;;GAQG;AACH,gBAAgB;AAChB,wBAAgB,UAAU,CACtB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACb,OAAO,GAAG,IAAI,CAwBhB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { Node3D } from "../nodes/three/node3d.js";
|
|
1
|
+
import { Node3D, parentSpaceOf } from "../nodes/three/node3d.js";
|
|
2
2
|
import { applyToPoint, invert } from "../attributes/layout/matrix2d.js";
|
|
3
3
|
import { resolveCameraPlacement } from "../render3d/camera.js";
|
|
4
4
|
import { geometryBounds3D, transformBox3, unionBox3, centeredBox3, corners3, } from "../render3d/bounds3d.js";
|
|
5
5
|
import { applyMatrix4, identity4, invert4, lookAtRotation4, multiply4, orthographic4, perspective4, transformMatrix4, translation4, } from "../render3d/matrix4.js";
|
|
6
6
|
import { nodePath } from "../project/tree.js";
|
|
7
|
+
export function isViewport3D(node) {
|
|
8
|
+
return typeof node?._isViewport3D === "function" && node._isViewport3D();
|
|
9
|
+
}
|
|
7
10
|
/**
|
|
8
11
|
* Every 3D node's box inside `canvas`, **nearest camera first**.
|
|
9
12
|
*
|
|
@@ -64,9 +67,12 @@ export function projectNode3D(canvas, frame, canvasPath, targetPath, parentPoint
|
|
|
64
67
|
if (!own || !parent)
|
|
65
68
|
return null;
|
|
66
69
|
const project = (matrix, points) => points.map((point) => projectPoint3(matrix, point, projection, frame));
|
|
70
|
+
// A parent with coordinates of its own places the node by them, so that is the frame its position is in.
|
|
71
|
+
const space = parentSpaceOf(entry.node);
|
|
72
|
+
const placed = space ? parentPoints.map((point) => space.toLocal(point.x, point.y, point.z)) : parentPoints;
|
|
67
73
|
return {
|
|
68
74
|
origin: projectPoint3(own, ORIGIN_3D, projection, frame),
|
|
69
|
-
parentPoints: project(parent,
|
|
75
|
+
parentPoints: project(parent, placed),
|
|
70
76
|
localPoints: project(own, localPoints),
|
|
71
77
|
};
|
|
72
78
|
}
|
|
@@ -155,6 +161,8 @@ function canvas3DProjection(canvas) {
|
|
|
155
161
|
if (!(bounds.width > 0) || !(bounds.height > 0))
|
|
156
162
|
return null;
|
|
157
163
|
const scene = canvas._scene3D();
|
|
164
|
+
if (!scene)
|
|
165
|
+
return null;
|
|
158
166
|
const walked = walkScene3D(scene);
|
|
159
167
|
if (walked.boxes.size === 0)
|
|
160
168
|
return null;
|