@motionscript/core 0.1.0-alpha.8 → 0.1.0
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 +25 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -49
- package/README.md +91 -91
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- 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.js.map +1 -1
- package/dist/attributes/audio/effects/chain.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/effects/index.js.map +1 -1
- package/dist/attributes/audio/effects/registry.js.map +1 -1
- package/dist/attributes/audio/effects/union.js.map +1 -1
- package/dist/attributes/audio/ramp.js.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.js.map +1 -1
- package/dist/attributes/index.js.map +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/space3d.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.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- 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.js.map +1 -1
- 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.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
- 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.d.ts +2 -2
- 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.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
- 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.d.ts +2 -2
- 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.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 +2 -2
- 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.js.map +1 -1
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.js.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 +20 -5
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- 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.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- 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.js.map +1 -1
- 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.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.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.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.js.map +1 -1
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- 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.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/language.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.js.map +1 -1
- 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.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
- package/dist/browser/chunks/chunk-CCGVIR4F.js +3 -0
- package/dist/browser/chunks/chunk-CCGVIR4F.js.map +7 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js +13 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js.map +7 -0
- package/dist/browser/chunks/chunk-WZSI3GSK.js +6 -0
- package/dist/browser/chunks/chunk-WZSI3GSK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/experimental.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.js.map +1 -1
- package/dist/components/builtins/geometry/composite.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/providers/providers.js.map +1 -1
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +9 -9
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.js.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/clip-of.js.map +1 -1
- package/dist/components/factory/commands-for.js.map +1 -1
- package/dist/components/factory/component-audio.js.map +1 -1
- package/dist/components/factory/component2d.js.map +1 -1
- package/dist/components/factory/component3d.js.map +1 -1
- package/dist/components/factory/factory.js.map +1 -1
- package/dist/components/factory/timeline.js.map +1 -1
- package/dist/components/factory/type-def.js.map +1 -1
- package/dist/components/factory/types.js.map +1 -1
- package/dist/components/factory/views.d.ts.map +1 -1
- package/dist/components/factory/views.js +41 -1
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/modules/aim.js.map +1 -1
- package/dist/components/modules/corners.js.map +1 -1
- package/dist/components/modules/flow.js.map +1 -1
- package/dist/components/modules/material.js.map +1 -1
- package/dist/components/modules/paint.js.map +1 -1
- package/dist/components/modules/shapes.js.map +1 -1
- package/dist/components/modules/text-layout.js.map +1 -1
- package/dist/components/modules/text-style.d.ts +1 -1
- package/dist/components/modules/text-style.js.map +1 -1
- package/dist/components/modules/three-entries.js.map +1 -1
- package/dist/components/modules/view3d.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.js.map +1 -1
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.js.map +1 -1
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/index.js.map +1 -1
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/components/trees/index.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.d.ts +3 -4
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
- package/dist/components/trees/node/node-reactive.js +13 -10
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +8 -0
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +17 -0
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.js.map +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.js.map +1 -1
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/missing-node.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.js.map +1 -1
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +6 -0
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +18 -1
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +26 -6
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.js.map +1 -1
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- 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.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.js.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.js.map +1 -1
- 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.js.map +1 -1
- package/dist/props/host.d.ts +5 -0
- package/dist/props/host.d.ts.map +1 -1
- package/dist/props/host.js +3 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/layout.d.ts +29 -0
- package/dist/props/layout.d.ts.map +1 -0
- package/dist/props/layout.js +84 -0
- package/dist/props/layout.js.map +1 -0
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.js.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/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.js.map +1 -1
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.js.map +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.js.map +1 -1
- package/dist/render/render-issue.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.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.js.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.js.map +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.js.map +1 -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.js.map +1 -1
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.js.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.js.map +1 -1
- 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.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.js.map +1 -1
- 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.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.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 +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +0 -113
- package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/chain.js +0 -104
- package/dist/attributes/audio/filters/chain.js.map +0 -1
- package/dist/attributes/audio/filters/curve.d.ts +0 -152
- package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
- package/dist/attributes/audio/filters/curve.js +0 -250
- package/dist/attributes/audio/filters/curve.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
- package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.js +0 -11
- package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
- package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.js +0 -6
- package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
- package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
- package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.js +0 -6
- package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
- package/dist/attributes/audio/filters/index.d.ts +0 -22
- package/dist/attributes/audio/filters/index.d.ts.map +0 -1
- package/dist/attributes/audio/filters/index.js +0 -8
- package/dist/attributes/audio/filters/index.js.map +0 -1
- package/dist/attributes/audio/filters/registry.d.ts +0 -36
- package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
- package/dist/attributes/audio/filters/registry.js +0 -82
- package/dist/attributes/audio/filters/registry.js.map +0 -1
- package/dist/attributes/audio/filters/union.d.ts +0 -18
- package/dist/attributes/audio/filters/union.d.ts.map +0 -1
- package/dist/attributes/audio/filters/union.js +0 -28
- package/dist/attributes/audio/filters/union.js.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
- package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.js +0 -0
- package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
- package/dist/browser/chunks/chunk-AOT33LMS.js +0 -13
- package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
- package/dist/browser/chunks/chunk-GKM6UZJR.js +0 -6
- package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
- package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
- package/dist/browser/chunks/chunk-ZRPZPWZU.js +0 -3
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
- package/dist/component/api.d.ts +0 -508
- package/dist/component/api.d.ts.map +0 -1
- package/dist/component/api.js +0 -4
- package/dist/component/api.js.map +0 -1
- package/dist/component/builtins/audio.d.ts +0 -26
- package/dist/component/builtins/audio.d.ts.map +0 -1
- package/dist/component/builtins/audio.js +0 -41
- package/dist/component/builtins/audio.js.map +0 -1
- package/dist/component/builtins/canvas3d.d.ts +0 -98
- package/dist/component/builtins/canvas3d.d.ts.map +0 -1
- package/dist/component/builtins/canvas3d.js +0 -21
- package/dist/component/builtins/canvas3d.js.map +0 -1
- package/dist/component/builtins/composite.d.ts +0 -56
- package/dist/component/builtins/composite.d.ts.map +0 -1
- package/dist/component/builtins/composite.js +0 -25
- package/dist/component/builtins/composite.js.map +0 -1
- package/dist/component/builtins/geometry.d.ts +0 -505
- package/dist/component/builtins/geometry.d.ts.map +0 -1
- package/dist/component/builtins/geometry.js +0 -107
- package/dist/component/builtins/geometry.js.map +0 -1
- package/dist/component/builtins/layout.d.ts +0 -88
- package/dist/component/builtins/layout.d.ts.map +0 -1
- package/dist/component/builtins/layout.js +0 -84
- package/dist/component/builtins/layout.js.map +0 -1
- package/dist/component/builtins/media.d.ts +0 -95
- package/dist/component/builtins/media.d.ts.map +0 -1
- package/dist/component/builtins/media.js +0 -149
- package/dist/component/builtins/media.js.map +0 -1
- package/dist/component/builtins/providers.d.ts +0 -23
- package/dist/component/builtins/providers.d.ts.map +0 -1
- package/dist/component/builtins/providers.js +0 -30
- package/dist/component/builtins/providers.js.map +0 -1
- package/dist/component/builtins/text.d.ts +0 -193
- package/dist/component/builtins/text.d.ts.map +0 -1
- package/dist/component/builtins/text.js +0 -113
- package/dist/component/builtins/text.js.map +0 -1
- package/dist/component/builtins/three.d.ts +0 -1085
- package/dist/component/builtins/three.d.ts.map +0 -1
- package/dist/component/builtins/three.js +0 -265
- package/dist/component/builtins/three.js.map +0 -1
- package/dist/component/clip-of.d.ts +0 -5
- package/dist/component/clip-of.d.ts.map +0 -1
- package/dist/component/clip-of.js +0 -33
- package/dist/component/clip-of.js.map +0 -1
- package/dist/component/commands-for.d.ts +0 -19
- package/dist/component/commands-for.d.ts.map +0 -1
- package/dist/component/commands-for.js +0 -5
- package/dist/component/commands-for.js.map +0 -1
- package/dist/component/component-audio.d.ts +0 -9
- package/dist/component/component-audio.d.ts.map +0 -1
- package/dist/component/component-audio.js +0 -18
- package/dist/component/component-audio.js.map +0 -1
- package/dist/component/component2d.d.ts +0 -9
- package/dist/component/component2d.d.ts.map +0 -1
- package/dist/component/component2d.js +0 -239
- package/dist/component/component2d.js.map +0 -1
- package/dist/component/component3d.d.ts +0 -9
- package/dist/component/component3d.d.ts.map +0 -1
- package/dist/component/component3d.js +0 -99
- package/dist/component/component3d.js.map +0 -1
- package/dist/component/factory.d.ts +0 -63
- package/dist/component/factory.d.ts.map +0 -1
- package/dist/component/factory.js +0 -313
- package/dist/component/factory.js.map +0 -1
- package/dist/component/modules/aim.d.ts +0 -30
- package/dist/component/modules/aim.d.ts.map +0 -1
- package/dist/component/modules/aim.js +0 -39
- package/dist/component/modules/aim.js.map +0 -1
- package/dist/component/modules/corners.d.ts +0 -13
- package/dist/component/modules/corners.d.ts.map +0 -1
- package/dist/component/modules/corners.js +0 -12
- package/dist/component/modules/corners.js.map +0 -1
- package/dist/component/modules/flow.d.ts +0 -26
- package/dist/component/modules/flow.d.ts.map +0 -1
- package/dist/component/modules/flow.js +0 -55
- package/dist/component/modules/flow.js.map +0 -1
- package/dist/component/modules/material.d.ts +0 -40
- package/dist/component/modules/material.d.ts.map +0 -1
- package/dist/component/modules/material.js +0 -75
- package/dist/component/modules/material.js.map +0 -1
- package/dist/component/modules/paint.d.ts +0 -71
- package/dist/component/modules/paint.d.ts.map +0 -1
- package/dist/component/modules/paint.js +0 -106
- package/dist/component/modules/paint.js.map +0 -1
- package/dist/component/modules/shapes.d.ts +0 -31
- package/dist/component/modules/shapes.d.ts.map +0 -1
- package/dist/component/modules/shapes.js +0 -43
- package/dist/component/modules/shapes.js.map +0 -1
- package/dist/component/modules/text-layout.d.ts +0 -26
- package/dist/component/modules/text-layout.d.ts.map +0 -1
- package/dist/component/modules/text-layout.js +0 -57
- package/dist/component/modules/text-layout.js.map +0 -1
- package/dist/component/modules/text-style.d.ts +0 -48
- package/dist/component/modules/text-style.d.ts.map +0 -1
- package/dist/component/modules/text-style.js +0 -63
- package/dist/component/modules/text-style.js.map +0 -1
- package/dist/component/modules/three-entries.d.ts +0 -23
- package/dist/component/modules/three-entries.d.ts.map +0 -1
- package/dist/component/modules/three-entries.js +0 -41
- package/dist/component/modules/three-entries.js.map +0 -1
- package/dist/component/modules/view3d.d.ts +0 -55
- package/dist/component/modules/view3d.d.ts.map +0 -1
- package/dist/component/modules/view3d.js +0 -160
- package/dist/component/modules/view3d.js.map +0 -1
- package/dist/component/timeline.d.ts +0 -22
- package/dist/component/timeline.d.ts.map +0 -1
- package/dist/component/timeline.js +0 -128
- package/dist/component/timeline.js.map +0 -1
- package/dist/component/type-def.d.ts +0 -26
- package/dist/component/type-def.d.ts.map +0 -1
- package/dist/component/type-def.js +0 -16
- package/dist/component/type-def.js.map +0 -1
- package/dist/component/types.d.ts +0 -91
- package/dist/component/types.d.ts.map +0 -1
- package/dist/component/types.js +0 -88
- package/dist/component/types.js.map +0 -1
- package/dist/component/views.d.ts +0 -121
- package/dist/component/views.d.ts.map +0 -1
- package/dist/component/views.js +0 -413
- package/dist/component/views.js.map +0 -1
- package/dist/document/withdraw.d.ts +0 -28
- package/dist/document/withdraw.d.ts.map +0 -1
- package/dist/document/withdraw.js +0 -61
- package/dist/document/withdraw.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
- package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-dev-runtime.js +0 -3
- package/dist/jsx/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx/jsx-runtime.d.ts +0 -27
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -26
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
- package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
- package/dist/nodes/2d/node-lifecycle.js +0 -264
- package/dist/nodes/2d/node-lifecycle.js.map +0 -1
- package/dist/nodes/2d/node-motion.d.ts +0 -56
- package/dist/nodes/2d/node-motion.d.ts.map +0 -1
- package/dist/nodes/2d/node-motion.js +0 -86
- package/dist/nodes/2d/node-motion.js.map +0 -1
- package/dist/nodes/2d/node-render.d.ts +0 -44
- package/dist/nodes/2d/node-render.d.ts.map +0 -1
- package/dist/nodes/2d/node-render.js +0 -80
- package/dist/nodes/2d/node-render.js.map +0 -1
- package/dist/nodes/2d/node-space.d.ts +0 -63
- package/dist/nodes/2d/node-space.d.ts.map +0 -1
- package/dist/nodes/2d/node-space.js +0 -131
- package/dist/nodes/2d/node-space.js.map +0 -1
- package/dist/nodes/2d/node-transform.d.ts +0 -55
- package/dist/nodes/2d/node-transform.d.ts.map +0 -1
- package/dist/nodes/2d/node-transform.js +0 -73
- package/dist/nodes/2d/node-transform.js.map +0 -1
- package/dist/nodes/2d/node2d.d.ts +0 -1111
- package/dist/nodes/2d/node2d.d.ts.map +0 -1
- package/dist/nodes/2d/node2d.js +0 -1665
- package/dist/nodes/2d/node2d.js.map +0 -1
- package/dist/nodes/2d/paint-node.d.ts +0 -142
- package/dist/nodes/2d/paint-node.d.ts.map +0 -1
- package/dist/nodes/2d/paint-node.js +0 -232
- package/dist/nodes/2d/paint-node.js.map +0 -1
- package/dist/nodes/audio/audio-bus.d.ts +0 -28
- package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
- package/dist/nodes/audio/audio-bus.js +0 -33
- package/dist/nodes/audio/audio-bus.js.map +0 -1
- package/dist/nodes/audio/index.d.ts +0 -4
- package/dist/nodes/audio/index.d.ts.map +0 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +0 -1
- package/dist/nodes/audio/node-audio.d.ts +0 -107
- package/dist/nodes/audio/node-audio.d.ts.map +0 -1
- package/dist/nodes/audio/node-audio.js +0 -179
- package/dist/nodes/audio/node-audio.js.map +0 -1
- package/dist/nodes/audio/sound-node.d.ts +0 -41
- package/dist/nodes/audio/sound-node.d.ts.map +0 -1
- package/dist/nodes/audio/sound-node.js +0 -71
- package/dist/nodes/audio/sound-node.js.map +0 -1
- package/dist/nodes/geometry/boolean-node.d.ts +0 -28
- package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
- package/dist/nodes/geometry/boolean-node.js +0 -81
- package/dist/nodes/geometry/boolean-node.js.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
- package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.js +0 -181
- package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
- package/dist/nodes/geometry/box-path-node.d.ts +0 -89
- package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/box-path-node.js +0 -116
- package/dist/nodes/geometry/box-path-node.js.map +0 -1
- package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
- package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
- package/dist/nodes/geometry/ellipse-node.js +0 -45
- package/dist/nodes/geometry/ellipse-node.js.map +0 -1
- package/dist/nodes/geometry/group-bounds.d.ts +0 -56
- package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
- package/dist/nodes/geometry/group-bounds.js +0 -87
- package/dist/nodes/geometry/group-bounds.js.map +0 -1
- package/dist/nodes/geometry/mask-node.d.ts +0 -33
- package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
- package/dist/nodes/geometry/mask-node.js +0 -66
- package/dist/nodes/geometry/mask-node.js.map +0 -1
- package/dist/nodes/geometry/path-node.d.ts +0 -26
- package/dist/nodes/geometry/path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/path-node.js +0 -58
- package/dist/nodes/geometry/path-node.js.map +0 -1
- package/dist/nodes/geometry/polygon-node.d.ts +0 -26
- package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygon-node.js +0 -47
- package/dist/nodes/geometry/polygon-node.js.map +0 -1
- package/dist/nodes/geometry/polygram-node.d.ts +0 -33
- package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygram-node.js +0 -52
- package/dist/nodes/geometry/polygram-node.js.map +0 -1
- package/dist/nodes/geometry/rect-node.d.ts +0 -38
- package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
- package/dist/nodes/geometry/rect-node.js +0 -56
- package/dist/nodes/geometry/rect-node.js.map +0 -1
- package/dist/nodes/geometry/shape-node.d.ts +0 -71
- package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-node.js +0 -140
- package/dist/nodes/geometry/shape-node.js.map +0 -1
- package/dist/nodes/geometry/shape-outline.d.ts +0 -93
- package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-outline.js +0 -470
- package/dist/nodes/geometry/shape-outline.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -53
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -35
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/layout/camera-node.d.ts +0 -80
- package/dist/nodes/layout/camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/camera-node.js +0 -153
- package/dist/nodes/layout/camera-node.js.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
- package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.js +0 -118
- package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
- package/dist/nodes/layout/rotated-box.d.ts +0 -20
- package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
- package/dist/nodes/layout/rotated-box.js +0 -76
- package/dist/nodes/layout/rotated-box.js.map +0 -1
- package/dist/nodes/media/video-node.d.ts +0 -229
- package/dist/nodes/media/video-node.d.ts.map +0 -1
- package/dist/nodes/media/video-node.js +0 -350
- package/dist/nodes/media/video-node.js.map +0 -1
- package/dist/nodes/node/declare-paints.d.ts +0 -19
- package/dist/nodes/node/declare-paints.d.ts.map +0 -1
- package/dist/nodes/node/declare-paints.js +0 -27
- package/dist/nodes/node/declare-paints.js.map +0 -1
- package/dist/nodes/node/node-editor-state.d.ts +0 -53
- package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
- package/dist/nodes/node/node-editor-state.js +0 -23
- package/dist/nodes/node/node-editor-state.js.map +0 -1
- package/dist/nodes/node/node-reactive.d.ts +0 -89
- package/dist/nodes/node/node-reactive.d.ts.map +0 -1
- package/dist/nodes/node/node-reactive.js +0 -135
- package/dist/nodes/node/node-reactive.js.map +0 -1
- package/dist/nodes/node/node-time.d.ts +0 -39
- package/dist/nodes/node/node-time.d.ts.map +0 -1
- package/dist/nodes/node/node-time.js +0 -14
- package/dist/nodes/node/node-time.js.map +0 -1
- package/dist/nodes/node/node-walk.d.ts +0 -46
- package/dist/nodes/node/node-walk.d.ts.map +0 -1
- package/dist/nodes/node/node-walk.js +0 -74
- package/dist/nodes/node/node-walk.js.map +0 -1
- package/dist/nodes/node/node.d.ts +0 -445
- package/dist/nodes/node/node.d.ts.map +0 -1
- package/dist/nodes/node/node.js +0 -745
- package/dist/nodes/node/node.js.map +0 -1
- package/dist/nodes/node/text-defaults.d.ts +0 -32
- package/dist/nodes/node/text-defaults.d.ts.map +0 -1
- package/dist/nodes/node/text-defaults.js +0 -37
- package/dist/nodes/node/text-defaults.js.map +0 -1
- package/dist/nodes/root/canvas2d-node.d.ts +0 -163
- package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/root/canvas2d-node.js +0 -264
- package/dist/nodes/root/canvas2d-node.js.map +0 -1
- package/dist/nodes/root/provider-node.d.ts +0 -47
- package/dist/nodes/root/provider-node.d.ts.map +0 -1
- package/dist/nodes/root/provider-node.js +0 -63
- package/dist/nodes/root/provider-node.js.map +0 -1
- package/dist/nodes/root/theme-provider-node.d.ts +0 -29
- package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/root/theme-provider-node.js +0 -43
- package/dist/nodes/root/theme-provider-node.js.map +0 -1
- package/dist/nodes/text/default-text-style-node.d.ts +0 -103
- package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
- package/dist/nodes/text/default-text-style-node.js +0 -146
- package/dist/nodes/text/default-text-style-node.js.map +0 -1
- package/dist/nodes/text/number-format.d.ts +0 -66
- package/dist/nodes/text/number-format.d.ts.map +0 -1
- package/dist/nodes/text/number-format.js +0 -227
- package/dist/nodes/text/number-format.js.map +0 -1
- package/dist/nodes/text/number-node.d.ts +0 -94
- package/dist/nodes/text/number-node.d.ts.map +0 -1
- package/dist/nodes/text/number-node.js +0 -86
- package/dist/nodes/text/number-node.js.map +0 -1
- package/dist/nodes/text/number-pattern.d.ts +0 -51
- package/dist/nodes/text/number-pattern.d.ts.map +0 -1
- package/dist/nodes/text/number-pattern.js +0 -77
- package/dist/nodes/text/number-pattern.js.map +0 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -68
- package/dist/nodes/text/richtext-node.d.ts.map +0 -1
- package/dist/nodes/text/richtext-node.js +0 -78
- package/dist/nodes/text/richtext-node.js.map +0 -1
- package/dist/nodes/text/text-base.d.ts +0 -118
- package/dist/nodes/text/text-base.d.ts.map +0 -1
- package/dist/nodes/text/text-base.js +0 -153
- package/dist/nodes/text/text-base.js.map +0 -1
- package/dist/nodes/text/text-layout.d.ts +0 -87
- package/dist/nodes/text/text-layout.d.ts.map +0 -1
- package/dist/nodes/text/text-layout.js +0 -368
- package/dist/nodes/text/text-layout.js.map +0 -1
- package/dist/nodes/text/text-node.d.ts +0 -84
- package/dist/nodes/text/text-node.d.ts.map +0 -1
- package/dist/nodes/text/text-node.js +0 -188
- package/dist/nodes/text/text-node.js.map +0 -1
- package/dist/nodes/text/text-selection.d.ts +0 -125
- package/dist/nodes/text/text-selection.d.ts.map +0 -1
- package/dist/nodes/text/text-selection.js +0 -209
- package/dist/nodes/text/text-selection.js.map +0 -1
- package/dist/nodes/three/camera-nodes.d.ts +0 -109
- package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
- package/dist/nodes/three/camera-nodes.js +0 -112
- package/dist/nodes/three/camera-nodes.js.map +0 -1
- package/dist/nodes/three/canvas3d-node.d.ts +0 -295
- package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
- package/dist/nodes/three/canvas3d-node.js +0 -486
- package/dist/nodes/three/canvas3d-node.js.map +0 -1
- package/dist/nodes/three/drawable-nodes.d.ts +0 -173
- package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
- package/dist/nodes/three/drawable-nodes.js +0 -284
- package/dist/nodes/three/drawable-nodes.js.map +0 -1
- package/dist/nodes/three/environment-nodes.d.ts +0 -106
- package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
- package/dist/nodes/three/environment-nodes.js +0 -134
- package/dist/nodes/three/environment-nodes.js.map +0 -1
- package/dist/nodes/three/geometry-nodes.d.ts +0 -197
- package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
- package/dist/nodes/three/geometry-nodes.js +0 -322
- package/dist/nodes/three/geometry-nodes.js.map +0 -1
- package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
- package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
- package/dist/nodes/three/grid-geometry3d.js +0 -114
- package/dist/nodes/three/grid-geometry3d.js.map +0 -1
- package/dist/nodes/three/group3d.d.ts +0 -23
- package/dist/nodes/three/group3d.d.ts.map +0 -1
- package/dist/nodes/three/group3d.js +0 -21
- package/dist/nodes/three/group3d.js.map +0 -1
- package/dist/nodes/three/light-nodes.d.ts +0 -120
- package/dist/nodes/three/light-nodes.d.ts.map +0 -1
- package/dist/nodes/three/light-nodes.js +0 -173
- package/dist/nodes/three/light-nodes.js.map +0 -1
- package/dist/nodes/three/mesh3d.d.ts +0 -117
- package/dist/nodes/three/mesh3d.d.ts.map +0 -1
- package/dist/nodes/three/mesh3d.js +0 -147
- package/dist/nodes/three/mesh3d.js.map +0 -1
- package/dist/nodes/three/node3d.d.ts +0 -230
- package/dist/nodes/three/node3d.d.ts.map +0 -1
- package/dist/nodes/three/node3d.js +0 -337
- package/dist/nodes/three/node3d.js.map +0 -1
- package/dist/render/descriptors/latex.d.ts +0 -6
- package/dist/render/descriptors/latex.d.ts.map +0 -1
- package/dist/render/descriptors/latex.js +0 -2
- package/dist/render/descriptors/latex.js.map +0 -1
- package/dist/tween/seekable.d.ts +0 -81
- package/dist/tween/seekable.d.ts.map +0 -1
- package/dist/tween/seekable.js +0 -137
- package/dist/tween/seekable.js.map +0 -1
package/dist/experimental.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEjE,kFAAkF;AAClF,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AACxC,oEAAoE;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;AAC9C,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AACxC,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AACxC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC;AAC5B,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAQlC,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAA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AA2B,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * @deprecated A duplicate of the stable authoring surface, kept until the next\n * major: import from `@motionscript/sdk` (or `@motionscript/core/sdk`), where\n * `TextStyle` is `Typeface` and `Corners` is `Shapes.corners` / `Shapes.rect`.\n */\nimport { component2d as _component2d } from \"@/components/factory/component2d\";\nimport { componentAudio as _componentAudio } from \"@/components/factory/component-audio\";\nimport { component3d as _component3d } from \"@/components/factory/component3d\";\nimport { commandsFor as _commandsFor } from \"@/components/factory/commands-for\";\nimport { Types as _Types } from \"@/components/factory/types\";\nimport { provides as _provides } from \"@/components/factory/api\";\n\n// Re-export statements cannot carry `@deprecated`, so the values are re-declared.\n/** @deprecated Import `component2d` from `@motionscript/sdk`. */\nexport const component2d = _component2d;\n/** @deprecated Import `componentAudio` from `@motionscript/sdk`. */\nexport const componentAudio = _componentAudio;\n/** @deprecated Import `component3d` from `@motionscript/sdk`. */\nexport const component3d = _component3d;\n/** @deprecated Import `commandsFor` from `@motionscript/sdk`. */\nexport const commandsFor = _commandsFor;\n/** @deprecated Import `Types` from `@motionscript/sdk`. */\nexport const Types = _Types;\n/** @deprecated Import `provides` from `@motionscript/sdk`. */\nexport const provides = _provides;\n\nexport type { Attribute, EntryOptions, NumberOptions, TextOptions } from \"@/components/factory/types\";\nexport type {\n Box2DState, BoxAudioState, CallProps, ChildView, Children2D, Component, Element, Entry, InOf, Inputs, Loader,\n Measurer, MergePaint, NodeOf, NodeView, OutOf, Piece, Placement2D, Provided, RenderContext2D, SoundOptions, StateSpec,\n Timeline, Type, Values, Writes, Merge, BuiltNode, CallProps3D, Placement3DProps, RenderContext3D, Transform3DState, Handle, LayoutBox, NodeFrame,\n} from \"@/components/factory/api\";\nexport * as Paint from \"@/components/modules/paint\";\nexport * as Flow from \"@/components/modules/flow\";\nexport * as Corners from \"@/components/modules/corners\";\nexport * as Shapes from \"@/components/modules/shapes\";\nexport * as Aim from \"@/components/modules/aim\";\nexport * as TextStyle from \"@/components/modules/text-style\";\nexport * as TextLayout from \"@/components/modules/text-layout\";\nexport * as Material from \"@/components/modules/material\";\nexport * as View3D from \"@/components/modules/view3d\";\n"]}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AAEzB,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './attributes';\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AAEzB,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './attributes';\nexport * from './components/trees';\nexport * from './components/builtins/geometry/geometry';\nexport * from './components/builtins/geometry/composite';\nexport * from './components/builtins/layout/layout';\nexport * from './components/builtins/text/text';\nexport * from './components/builtins/providers/providers';\nexport * from './components/builtins/audio/audio';\nexport * from './components/builtins/media/media';\nexport * from './components/builtins/three/three';\nexport * from './components/builtins/three/canvas3d';\nexport * from './project';\nexport * from './document';\nexport * from './render';\nexport * from './render3d';\nexport * from './runtime';\nexport * from './platform';\nexport * from './assets';\nexport * from './util'\nexport * from './tween';\nexport * from './props';\nexport * from './layout';\n\nexport * from './renamed-scene-names';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bounds.js","sourceRoot":"","sources":["../../src/layout/bounds.ts"],"names":[],"mappings":"","sourcesContent":["import { Size2D } from \"@/attributes/layout/size\";\
|
|
1
|
+
{"version":3,"file":"bounds.js","sourceRoot":"","sources":["../../src/layout/bounds.ts"],"names":[],"mappings":"","sourcesContent":["import { Size2D } from \"@/attributes/layout/size\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\n\n/**\n * An axis-aligned box as an origin plus a size — `{ x, y, width, height }` in\n * pixels. The general shape for \"a rectangle somewhere\", used for a node's\n * laid-out cell, for the extent of what it draws ({@link Node2D._localBounds}),\n * and anywhere else a positioned box is passed around.\n *\n * What `x`/`y` mean is **not** part of the type: the layout engine's rects are\n * canvas (y-down) and relative to the parent, while a node's own content bounds\n * are y-up and relative to its centre. Each site documents its own space, the\n * same way {@link Vector2} is shared across both conventions.\n */\nexport type BoxBounds = Size2D & Vector2;\n\n/** Axis-aligned bounding box expressed as min/max corners rather than origin + size. */\nexport type Extents = {\n minX: number;\n minY: number;\n maxX: number;\n maxY: number;\n};"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../src/layout/constraints.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal Optional upper bounds on a node's rendered size, in pixels. */\
|
|
1
|
+
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../src/layout/constraints.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal Optional upper bounds on a node's rendered size, in pixels. */\nexport interface SizeConstraints {\n maxWidth?: number;\n maxHeight?: number;\n}"]}
|
package/dist/layout/flex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flex.js","sourceRoot":"","sources":["../../src/layout/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAOrC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAIrC;;;GAGG;AACH,MAAM,UAAU,UAAU,CACtB,KAA4B,EAC5B,UAAmB,EACnB,GAAY,EACZ,KAAgB,EAChB,QAAsC;IAEtC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC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,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { clamp } from \"@/util/clamp\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MeasureContext2D } from \"@/render/measure-context\";\r\nimport type { BoxBounds } from \"./bounds\";\r\nimport type { SizeConstraints } from \"./constraints\";\r\nimport type { FlowLine, FlowMeasure, FlowSpace, GapSize, LayoutItem } from \"./types\";\r\nimport { measureItem } from \"./item\";\r\n\r\ntype RunMeasure = Pick<FlowMeasure, \"sizes\" | \"lines\" | \"gapScales\" | \"hug\">;\r\n\r\n/**\r\n * Measures an unwrapped run, as one line: fixed items first, then `fill` items\r\n * share what is left of the main axis by `flex`.\r\n */\r\nexport function measureRun(\r\n items: readonly LayoutItem[],\r\n horizontal: boolean,\r\n gap: GapSize,\r\n space: FlowSpace,\r\n measurer: MeasureContext2D | undefined,\r\n): RunMeasure {\r\n const main = horizontal ? \"width\" : \"height\";\r\n const cross = horizontal ? \"height\" : \"width\";\r\n const hugsMain = (horizontal ? space.hugWidth : space.hugHeight) === true;\r\n const hugsCross = (horizontal ? space.hugHeight : space.hugWidth) === true;\r\n const bounded: SizeConstraints = { maxWidth: space.width, maxHeight: space.height };\r\n\r\n const n = items.length;\r\n const sizes: Size2D[] = new Array(n);\r\n const gapScales = items.map((item) => sanitizeGapScale(item.gapScale));\r\n // Weighted rather than a flat `n - 1`, so an item collapsing mid insert/remove\r\n // gives back exactly one gap wherever it sits. All weights 1 is `gap * (n - 1)`.\r\n const totalGap = gap === \"auto\" ? 0 : gap * Math.max(0, gapScales.reduce((sum, w) => sum + w, 0) - 1);\r\n\r\n // Fixed-main items first. On a hugging cross axis, `fill`-cross items wait:\r\n // what they fill is the deepest of these.\r\n let fixedMain = 0;\r\n let deepest = 0;\r\n for (let i = 0; i < n; i++) {\r\n if (items[i][main] === \"fill\" || (hugsCross && items[i][cross] === \"fill\")) continue;\r\n sizes[i] = measureItem(items[i], bounded, measurer);\r\n fixedMain += sizes[i][main];\r\n if (sizes[i][cross] > deepest) deepest = sizes[i][cross];\r\n }\r\n const fillCross = hugsCross ? deepest : space[cross];\r\n if (hugsCross) {\r\n for (let i = 0; i < n; i++) {\r\n if (items[i][main] === \"fill\" || items[i][cross] !== \"fill\") continue;\r\n const size = measureItem(items[i], bounded, measurer);\r\n sizes[i] = withCross(size, fillCross, horizontal);\r\n fixedMain += size[main];\r\n }\r\n }\r\n\r\n const free = Math.max(0, space[main] - totalGap - fixedMain);\r\n let flexSum = 0;\r\n for (const item of items) if (item[main] === \"fill\") flexSum += sanitizeFlex(item.flex);\r\n\r\n for (let i = 0; i < n; i++) {\r\n const item = items[i];\r\n if (item[main] !== \"fill\") continue;\r\n let share: number;\r\n let size: Size2D;\r\n if (hugsMain) {\r\n size = measureFillOnHugAxis(item, horizontal, space, measurer);\r\n share = size[main];\r\n } else {\r\n share = flexSum > 0 ? free * sanitizeFlex(item.flex) / flexSum : 0;\r\n size = measureItem(item, horizontal\r\n ? { maxWidth: share, maxHeight: space.height }\r\n : { maxWidth: space.width, maxHeight: share }, measurer);\r\n }\r\n const depth = item[cross] === \"fill\" ? fillCross : size[cross];\r\n sizes[i] = horizontal ? { width: share, height: depth } : { width: depth, height: share };\r\n }\r\n\r\n let extent = totalGap;\r\n let depth = 0;\r\n for (const size of sizes) {\r\n extent += size[main];\r\n if (size[cross] > depth) depth = size[cross];\r\n }\r\n return {\r\n sizes,\r\n lines: n > 0 ? [{ start: 0, end: n, cross: depth }] : [],\r\n gapScales,\r\n hug: horizontal ? { width: extent, height: depth } : { width: depth, height: extent },\r\n };\r\n}\r\n\r\n/**\r\n * A `fill`-main item on a main axis the container hugs. There is nothing to\r\n * share on such an axis — Figma disallows `fill` there — so the item measures\r\n * unconstrained along it, like a hug item. A bare `fill` leaf echoes that back as\r\n * Infinity, which would take the container's hug size with it; it collapses to 0\r\n * instead. Shared by {@link measureRun} and {@link measureWrap}, so a run hugs to\r\n * the same size whether or not it wraps.\r\n */\r\nfunction measureFillOnHugAxis(\r\n item: LayoutItem,\r\n horizontal: boolean,\r\n space: FlowSpace,\r\n measurer: MeasureContext2D | undefined,\r\n): Size2D {\r\n const size = measureItem(item, horizontal\r\n ? { maxWidth: Infinity, maxHeight: space.height }\r\n : { maxWidth: space.width, maxHeight: Infinity }, measurer);\r\n const main = horizontal ? \"width\" : \"height\";\r\n return Number.isFinite(size[main]) ? size : { ...size, [main]: 0 };\r\n}\r\n\r\n/**\r\n * Measures a wrapped run: every item at its natural size, broken greedily into\r\n * lines that fit the main axis. Two rules differ from {@link measureRun}, both\r\n * Figma's:\r\n *\r\n * - **A hugging main axis does not wrap** — there is nothing to break against.\r\n * - **`fill` on the main axis is not divided.** Which line an item lands on is\r\n * what this pass decides, so it measures to the whole main axis and takes a\r\n * line to itself. (On a hugging main axis there is no line to break and no\r\n * extent to fill, so it measures as {@link measureRun} measures it.)\r\n * Cross-axis `fill` stretches to its own line rather than the whole stack, the\r\n * only reading that survives a reflow.\r\n */\r\nexport function measureWrap(\r\n items: readonly LayoutItem[],\r\n horizontal: boolean,\r\n gap: GapSize,\r\n crossGap: number,\r\n space: FlowSpace,\r\n measurer: MeasureContext2D | undefined,\r\n): RunMeasure {\r\n const main = horizontal ? \"width\" : \"height\";\r\n const cross = horizontal ? \"height\" : \"width\";\r\n const hugsMain = (horizontal ? space.hugWidth : space.hugHeight) === true;\r\n const limit = hugsMain ? Infinity : space[main];\r\n // Flat, not gapScale-weighted: placement spaces the lines this breaks, and a\r\n // weighting across a break would put the two out of step. An animated insert\r\n // in a wrapped run slides instead of collapsing its gap.\r\n const step = gap === \"auto\" ? 0 : gap;\r\n const bounded: SizeConstraints = { maxWidth: space.width, maxHeight: space.height };\r\n // A `fill` item on a hugging main axis measures as it does unwrapped (see\r\n // `measureFillOnHugAxis`): the full extent is what a *bounded* axis offers it,\r\n // and a hugging one offers none.\r\n const sizes = items.map((item) => hugsMain && item[main] === \"fill\"\r\n ? measureFillOnHugAxis(item, horizontal, space, measurer)\r\n : measureItem(item, bounded, measurer));\r\n\r\n const lines: FlowLine[] = [];\r\n let widest = 0;\r\n let stack = 0;\r\n let start = 0;\r\n while (start < sizes.length) {\r\n // A line always takes at least one item, so an over-long one overflows its\r\n // own line rather than being pushed onto an empty one forever.\r\n let end = start + 1;\r\n let extent = sizes[start][main];\r\n while (end < sizes.length && extent + step + sizes[end][main] <= limit) {\r\n extent += step + sizes[end][main];\r\n end++;\r\n }\r\n // A line's thickness is its deepest item, not counting the ones that fill\r\n // the cross axis — what they fill is the answer being computed.\r\n let depth = 0;\r\n for (let i = start; i < end; i++) {\r\n if (items[i][cross] !== \"fill\" && sizes[i][cross] > depth) depth = sizes[i][cross];\r\n }\r\n for (let i = start; i < end; i++) {\r\n if (items[i][cross] === \"fill\") sizes[i] = withCross(sizes[i], depth, horizontal);\r\n }\r\n lines.push({ start, end, cross: depth });\r\n if (extent > widest) widest = extent;\r\n stack += depth;\r\n start = end;\r\n }\r\n stack += crossGap * Math.max(0, lines.length - 1);\r\n return {\r\n sizes,\r\n lines,\r\n gapScales: sizes.map(() => 1),\r\n hug: horizontal ? { width: widest, height: stack } : { width: stack, height: widest },\r\n };\r\n}\r\n\r\n/**\r\n * Places a run's lines in the content box, centre-relative and y-up. Positions\r\n * are worked out in reading order — from the main axis's start edge (left, or\r\n * top) and the cross axis's (top, or left) — and converted once, at the end.\r\n */\r\nexport function placeRun(\r\n sizes: readonly Size2D[],\r\n lines: readonly FlowLine[],\r\n gapScales: readonly number[],\r\n horizontal: boolean,\r\n gap: GapSize,\r\n crossGap: number,\r\n align: Vector2,\r\n inner: Size2D,\r\n): BoxBounds[] {\r\n const main = horizontal ? \"width\" : \"height\";\r\n const cross = horizontal ? \"height\" : \"width\";\r\n // `align` is y-up and a run reads top-down, so y's fraction is flipped.\r\n const mainFraction = horizontal ? (1 + align.x) / 2 : (1 - align.y) / 2;\r\n const crossFraction = horizontal ? (1 - align.y) / 2 : (1 + align.x) / 2;\r\n\r\n let stack = crossGap * Math.max(0, lines.length - 1);\r\n for (const line of lines) stack += line.cross;\r\n let lineStart = crossFraction * (inner[cross] - stack);\r\n\r\n const boxes: BoxBounds[] = new Array(sizes.length);\r\n for (const line of lines) {\r\n const count = line.end - line.start;\r\n let extent = 0;\r\n let weight = 0;\r\n for (let i = line.start; i < line.end; i++) {\r\n extent += sizes[i][main];\r\n weight += gapScales[i];\r\n }\r\n\r\n let gapAfter: (i: number) => number;\r\n let lead = 0;\r\n if (gap === \"auto\") {\r\n // Spread within each line, so a short last line is as loose as the full ones.\r\n const spread = count > 1 ? Math.max(0, inner[main] - extent) / (count - 1) : 0;\r\n gapAfter = () => spread;\r\n extent += spread * (count - 1);\r\n } else {\r\n // A boundary takes the mean of its neighbours' weights, so the run spans\r\n // `gap * (Σweight − 1)` — what measureRun reserved. That leaves half a gap\r\n // over for a collapsing first item, which hangs before the visible run so\r\n // the content edge holds still at any alignment.\r\n const weightAt = (i: number): number => (i < line.end ? gapScales[i] : 1);\r\n gapAfter = (i) => gap * (gapScales[i] + weightAt(i + 1)) / 2;\r\n extent += gap * Math.max(0, weight - 1);\r\n lead = gap * (1 - gapScales[line.start]) / 2;\r\n }\r\n\r\n let at = mainFraction * (inner[main] - extent) - lead;\r\n for (let i = line.start; i < line.end; i++) {\r\n const size = sizes[i];\r\n const across = lineStart + crossFraction * (line.cross - size[cross]);\r\n boxes[i] = fromReadingOrder(horizontal ? at : across, horizontal ? across : at, size, inner);\r\n at += size[main] + gapAfter(i);\r\n }\r\n lineStart += line.cross + crossGap;\r\n }\r\n return boxes;\r\n}\r\n\r\n// From a top-left corner in the content box (y-down) to the content box's centre, y-up.\r\nfunction fromReadingOrder(left: number, top: number, size: Size2D, inner: Size2D): BoxBounds {\r\n return {\r\n x: left + size.width / 2 - inner.width / 2,\r\n y: inner.height / 2 - top - size.height / 2,\r\n width: size.width,\r\n height: size.height,\r\n };\r\n}\r\n\r\nfunction withCross(size: Size2D, depth: number, horizontal: boolean): Size2D {\r\n return horizontal ? { width: size.width, height: depth } : { width: depth, height: size.height };\r\n}\r\n\r\nfunction sanitizeFlex(value: number | undefined): number {\r\n if (value == null) return 1;\r\n return Number.isFinite(value) && value >= 0 ? value : 1;\r\n}\r\n\r\n// Clamped so an eased tween overshooting 0 ↔ 1 can't push a gap negative or past full.\r\nfunction sanitizeGapScale(value: number | undefined): number {\r\n if (value == null) return 1;\r\n return Number.isFinite(value) ? clamp(value, 0, 1) : 1;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flex.js","sourceRoot":"","sources":["../../src/layout/flex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAOrC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAIrC;;;GAGG;AACH,MAAM,UAAU,UAAU,CACtB,KAA4B,EAC5B,UAAmB,EACnB,GAAY,EACZ,KAAgB,EAChB,QAAsC;IAEtC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,QAAQ,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IAC1E,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAC3E,MAAM,OAAO,GAAoB,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC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AAC,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC;QAC1C,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC;QAC3C,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC;AACN,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa,EAAE,UAAmB;IAC/D,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AACrG,CAAC;AAED,SAAS,YAAY,CAAC,KAAyB;IAC3C,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,uFAAuF;AACvF,SAAS,gBAAgB,CAAC,KAAyB;IAC/C,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { clamp } from \"@/util/clamp\";\nimport type { Size2D } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { BoxBounds } from \"./bounds\";\nimport type { SizeConstraints } from \"./constraints\";\nimport type { FlowLine, FlowMeasure, FlowSpace, GapSize, LayoutItem } from \"./types\";\nimport { measureItem } from \"./item\";\n\ntype RunMeasure = Pick<FlowMeasure, \"sizes\" | \"lines\" | \"gapScales\" | \"hug\">;\n\n/**\n * Measures an unwrapped run, as one line: fixed items first, then `fill` items\n * share what is left of the main axis by `flex`.\n */\nexport function measureRun(\n items: readonly LayoutItem[],\n horizontal: boolean,\n gap: GapSize,\n space: FlowSpace,\n measurer: MeasureContext2D | undefined,\n): RunMeasure {\n const main = horizontal ? \"width\" : \"height\";\n const cross = horizontal ? \"height\" : \"width\";\n const hugsMain = (horizontal ? space.hugWidth : space.hugHeight) === true;\n const hugsCross = (horizontal ? space.hugHeight : space.hugWidth) === true;\n const bounded: SizeConstraints = { maxWidth: space.width, maxHeight: space.height };\n\n const n = items.length;\n const sizes: Size2D[] = new Array(n);\n const gapScales = items.map((item) => sanitizeGapScale(item.gapScale));\n // Weighted rather than a flat `n - 1`, so an item collapsing mid insert/remove\n // gives back exactly one gap wherever it sits. All weights 1 is `gap * (n - 1)`.\n const totalGap = gap === \"auto\" ? 0 : gap * Math.max(0, gapScales.reduce((sum, w) => sum + w, 0) - 1);\n\n // Fixed-main items first. On a hugging cross axis, `fill`-cross items wait:\n // what they fill is the deepest of these.\n let fixedMain = 0;\n let deepest = 0;\n for (let i = 0; i < n; i++) {\n if (items[i][main] === \"fill\" || (hugsCross && items[i][cross] === \"fill\")) continue;\n sizes[i] = measureItem(items[i], bounded, measurer);\n fixedMain += sizes[i][main];\n if (sizes[i][cross] > deepest) deepest = sizes[i][cross];\n }\n const fillCross = hugsCross ? deepest : space[cross];\n if (hugsCross) {\n for (let i = 0; i < n; i++) {\n if (items[i][main] === \"fill\" || items[i][cross] !== \"fill\") continue;\n const size = measureItem(items[i], bounded, measurer);\n sizes[i] = withCross(size, fillCross, horizontal);\n fixedMain += size[main];\n }\n }\n\n const free = Math.max(0, space[main] - totalGap - fixedMain);\n let flexSum = 0;\n for (const item of items) if (item[main] === \"fill\") flexSum += sanitizeFlex(item.flex);\n\n for (let i = 0; i < n; i++) {\n const item = items[i];\n if (item[main] !== \"fill\") continue;\n let share: number;\n let size: Size2D;\n if (hugsMain) {\n size = measureFillOnHugAxis(item, horizontal, space, measurer);\n share = size[main];\n } else {\n share = flexSum > 0 ? free * sanitizeFlex(item.flex) / flexSum : 0;\n size = measureItem(item, horizontal\n ? { maxWidth: share, maxHeight: space.height }\n : { maxWidth: space.width, maxHeight: share }, measurer);\n }\n const depth = item[cross] === \"fill\" ? fillCross : size[cross];\n sizes[i] = horizontal ? { width: share, height: depth } : { width: depth, height: share };\n }\n\n let extent = totalGap;\n let depth = 0;\n for (const size of sizes) {\n extent += size[main];\n if (size[cross] > depth) depth = size[cross];\n }\n return {\n sizes,\n lines: n > 0 ? [{ start: 0, end: n, cross: depth }] : [],\n gapScales,\n hug: horizontal ? { width: extent, height: depth } : { width: depth, height: extent },\n };\n}\n\n/**\n * A `fill`-main item on a main axis the container hugs. There is nothing to\n * share on such an axis — Figma disallows `fill` there — so the item measures\n * unconstrained along it, like a hug item. A bare `fill` leaf echoes that back as\n * Infinity, which would take the container's hug size with it; it collapses to 0\n * instead. Shared by {@link measureRun} and {@link measureWrap}, so a run hugs to\n * the same size whether or not it wraps.\n */\nfunction measureFillOnHugAxis(\n item: LayoutItem,\n horizontal: boolean,\n space: FlowSpace,\n measurer: MeasureContext2D | undefined,\n): Size2D {\n const size = measureItem(item, horizontal\n ? { maxWidth: Infinity, maxHeight: space.height }\n : { maxWidth: space.width, maxHeight: Infinity }, measurer);\n const main = horizontal ? \"width\" : \"height\";\n return Number.isFinite(size[main]) ? size : { ...size, [main]: 0 };\n}\n\n/**\n * Measures a wrapped run: every item at its natural size, broken greedily into\n * lines that fit the main axis. Two rules differ from {@link measureRun}, both\n * Figma's:\n *\n * - **A hugging main axis does not wrap** — there is nothing to break against.\n * - **`fill` on the main axis is not divided.** Which line an item lands on is\n * what this pass decides, so it measures to the whole main axis and takes a\n * line to itself. (On a hugging main axis there is no line to break and no\n * extent to fill, so it measures as {@link measureRun} measures it.)\n * Cross-axis `fill` stretches to its own line rather than the whole stack, the\n * only reading that survives a reflow.\n */\nexport function measureWrap(\n items: readonly LayoutItem[],\n horizontal: boolean,\n gap: GapSize,\n crossGap: number,\n space: FlowSpace,\n measurer: MeasureContext2D | undefined,\n): RunMeasure {\n const main = horizontal ? \"width\" : \"height\";\n const cross = horizontal ? \"height\" : \"width\";\n const hugsMain = (horizontal ? space.hugWidth : space.hugHeight) === true;\n const limit = hugsMain ? Infinity : space[main];\n // Flat, not gapScale-weighted: placement spaces the lines this breaks, and a\n // weighting across a break would put the two out of step. An animated insert\n // in a wrapped run slides instead of collapsing its gap.\n const step = gap === \"auto\" ? 0 : gap;\n const bounded: SizeConstraints = { maxWidth: space.width, maxHeight: space.height };\n // A `fill` item on a hugging main axis measures as it does unwrapped (see\n // `measureFillOnHugAxis`): the full extent is what a *bounded* axis offers it,\n // and a hugging one offers none.\n const sizes = items.map((item) => hugsMain && item[main] === \"fill\"\n ? measureFillOnHugAxis(item, horizontal, space, measurer)\n : measureItem(item, bounded, measurer));\n\n const lines: FlowLine[] = [];\n let widest = 0;\n let stack = 0;\n let start = 0;\n while (start < sizes.length) {\n // A line always takes at least one item, so an over-long one overflows its\n // own line rather than being pushed onto an empty one forever.\n let end = start + 1;\n let extent = sizes[start][main];\n while (end < sizes.length && extent + step + sizes[end][main] <= limit) {\n extent += step + sizes[end][main];\n end++;\n }\n // A line's thickness is its deepest item, not counting the ones that fill\n // the cross axis — what they fill is the answer being computed.\n let depth = 0;\n for (let i = start; i < end; i++) {\n if (items[i][cross] !== \"fill\" && sizes[i][cross] > depth) depth = sizes[i][cross];\n }\n for (let i = start; i < end; i++) {\n if (items[i][cross] === \"fill\") sizes[i] = withCross(sizes[i], depth, horizontal);\n }\n lines.push({ start, end, cross: depth });\n if (extent > widest) widest = extent;\n stack += depth;\n start = end;\n }\n stack += crossGap * Math.max(0, lines.length - 1);\n return {\n sizes,\n lines,\n gapScales: sizes.map(() => 1),\n hug: horizontal ? { width: widest, height: stack } : { width: stack, height: widest },\n };\n}\n\n/**\n * Places a run's lines in the content box, centre-relative and y-up. Positions\n * are worked out in reading order — from the main axis's start edge (left, or\n * top) and the cross axis's (top, or left) — and converted once, at the end.\n */\nexport function placeRun(\n sizes: readonly Size2D[],\n lines: readonly FlowLine[],\n gapScales: readonly number[],\n horizontal: boolean,\n gap: GapSize,\n crossGap: number,\n align: Vector2,\n inner: Size2D,\n): BoxBounds[] {\n const main = horizontal ? \"width\" : \"height\";\n const cross = horizontal ? \"height\" : \"width\";\n // `align` is y-up and a run reads top-down, so y's fraction is flipped.\n const mainFraction = horizontal ? (1 + align.x) / 2 : (1 - align.y) / 2;\n const crossFraction = horizontal ? (1 - align.y) / 2 : (1 + align.x) / 2;\n\n let stack = crossGap * Math.max(0, lines.length - 1);\n for (const line of lines) stack += line.cross;\n let lineStart = crossFraction * (inner[cross] - stack);\n\n const boxes: BoxBounds[] = new Array(sizes.length);\n for (const line of lines) {\n const count = line.end - line.start;\n let extent = 0;\n let weight = 0;\n for (let i = line.start; i < line.end; i++) {\n extent += sizes[i][main];\n weight += gapScales[i];\n }\n\n let gapAfter: (i: number) => number;\n let lead = 0;\n if (gap === \"auto\") {\n // Spread within each line, so a short last line is as loose as the full ones.\n const spread = count > 1 ? Math.max(0, inner[main] - extent) / (count - 1) : 0;\n gapAfter = () => spread;\n extent += spread * (count - 1);\n } else {\n // A boundary takes the mean of its neighbours' weights, so the run spans\n // `gap * (Σweight − 1)` — what measureRun reserved. That leaves half a gap\n // over for a collapsing first item, which hangs before the visible run so\n // the content edge holds still at any alignment.\n const weightAt = (i: number): number => (i < line.end ? gapScales[i] : 1);\n gapAfter = (i) => gap * (gapScales[i] + weightAt(i + 1)) / 2;\n extent += gap * Math.max(0, weight - 1);\n lead = gap * (1 - gapScales[line.start]) / 2;\n }\n\n let at = mainFraction * (inner[main] - extent) - lead;\n for (let i = line.start; i < line.end; i++) {\n const size = sizes[i];\n const across = lineStart + crossFraction * (line.cross - size[cross]);\n boxes[i] = fromReadingOrder(horizontal ? at : across, horizontal ? across : at, size, inner);\n at += size[main] + gapAfter(i);\n }\n lineStart += line.cross + crossGap;\n }\n return boxes;\n}\n\n// From a top-left corner in the content box (y-down) to the content box's centre, y-up.\nfunction fromReadingOrder(left: number, top: number, size: Size2D, inner: Size2D): BoxBounds {\n return {\n x: left + size.width / 2 - inner.width / 2,\n y: inner.height / 2 - top - size.height / 2,\n width: size.width,\n height: size.height,\n };\n}\n\nfunction withCross(size: Size2D, depth: number, horizontal: boolean): Size2D {\n return horizontal ? { width: size.width, height: depth } : { width: depth, height: size.height };\n}\n\nfunction sanitizeFlex(value: number | undefined): number {\n if (value == null) return 1;\n return Number.isFinite(value) && value >= 0 ? value : 1;\n}\n\n// Clamped so an eased tween overshooting 0 ↔ 1 can't push a gap negative or past full.\nfunction sanitizeGapScale(value: number | undefined): number {\n if (value == null) return 1;\n return Number.isFinite(value) ? clamp(value, 0, 1) : 1;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freeform.js","sourceRoot":"","sources":["../../src/layout/freeform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAC3B,KAA4B,EAC5B,KAAgB,EAChB,QAAsC;IAEtC,MAAM,WAAW,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACvE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;YAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACnD,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;YAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwB,EAAE,KAAa,EAAE,KAAc;IACjF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACtD,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QACxD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\
|
|
1
|
+
{"version":3,"file":"freeform.js","sourceRoot":"","sources":["../../src/layout/freeform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAC3B,KAA4B,EAC5B,KAAgB,EAChB,QAAsC;IAEtC,MAAM,WAAW,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACvE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK;YAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACnD,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM;YAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAwB,EAAE,KAAa,EAAE,KAAc;IACjF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACxB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACtD,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QACxD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { BoxBounds } from \"./bounds\";\nimport type { FlowSpace, LayoutItem } from \"./types\";\nimport { measureItem } from \"./item\";\n\n/** Every item measured against the whole content box; the content is the largest of them. */\nexport function measureFreeform(\n items: readonly LayoutItem[],\n space: FlowSpace,\n measurer: MeasureContext2D | undefined,\n): { sizes: Size2D[]; hug: Size2D } {\n const constraints = { maxWidth: space.width, maxHeight: space.height };\n const sizes: Size2D[] = [];\n const hug = { width: 0, height: 0 };\n for (const item of items) {\n const size = measureItem(item, constraints, measurer);\n sizes.push(size);\n if (size.width > hug.width) hug.width = size.width;\n if (size.height > hug.height) hug.height = size.height;\n }\n return { sizes, hug };\n}\n\n/**\n * Each item aligned in the content box, centre-relative and y-up. Slack is\n * clamped at 0, so an item larger than the box stays centred on it.\n */\nexport function placeFreeform(sizes: readonly Size2D[], inner: Size2D, align: Vector2): BoxBounds[] {\n return sizes.map((size) => ({\n x: align.x * Math.max(0, inner.width - size.width) / 2,\n y: align.y * Math.max(0, inner.height - size.height) / 2,\n width: size.width,\n height: size.height,\n }));\n}\n"]}
|
package/dist/layout/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/layout/grid.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACvB,KAA4B,EAC5B,OAAe,EACf,SAAiB,EACjB,MAAc,EACd,KAAgB,EAChB,QAAsC;IAEtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3E,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3C,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;QACjC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,GAAG,IAAI,OAAO,CAAC;IACnB,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,iFAAiF;AACjF,uCAAuC;AACvC,SAAS,IAAI,CAAC,IAAc,EAAE,GAAW,EAAE,OAAe,EAAE,MAAc,EAAE,GAAW;IACnF,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QAC3C,OAAO;IACX,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,IAAI,KAAK,GAAG,CAAC;QAAE,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;AACtC,CAAC;AAED,SAAS,IAAI,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW;IACnD,OAAO,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,WAAW,CAAC,IAAuB,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAClF,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { MeasureContext2D } from \"@/render/measure-context\";\r\nimport type { BoxBounds } from \"./bounds\";\r\nimport type { SizeConstraints } from \"./constraints\";\r\nimport type { FlowSpace, LayoutItem } from \"./types\";\r\nimport { measureItem } from \"./item\";\r\n\r\n/**\r\n * Measures a grid: `columns` equal tracks across the width, and rows sized to\r\n * their content — or, when the height is bounded, divided equally so a\r\n * `fill`-height item has a share to fill. Each item's cell comes back from the\r\n * content box's top-left, y-down.\r\n */\r\nexport function measureGrid(\r\n items: readonly LayoutItem[],\r\n columns: number,\r\n columnGap: number,\r\n rowGap: number,\r\n space: FlowSpace,\r\n measurer: MeasureContext2D | undefined,\r\n): { sizes: Size2D[]; cells: BoxBounds[]; hug: Size2D } {\r\n const count = Math.max(1, Math.round(columns));\r\n const track = Math.max(0, (space.width - columnGap * (count - 1)) / count);\r\n const placements = autoPlace(items, count);\r\n const rowCount = placements.reduce((max, p) => Math.max(max, p.row + p.rowSpan), 0);\r\n\r\n const bounded = space.hugHeight !== true && rowCount > 0;\r\n const equalRow = bounded ? Math.max(0, (space.height - rowGap * (rowCount - 1)) / rowCount) : 0;\r\n const rows = new Array<number>(rowCount).fill(equalRow);\r\n\r\n const sizes = items.map((item, i) => {\r\n const p = placements[i];\r\n const width = span(track, p.colSpan, columnGap);\r\n const constraints: SizeConstraints = bounded\r\n ? { maxWidth: width, maxHeight: span(equalRow, p.rowSpan, rowGap) }\r\n : { maxWidth: width };\r\n const size = measureItem(item, constraints, measurer);\r\n // Bounded rows are already equal, and content may not grow one past its share.\r\n if (!bounded) grow(rows, p.row, p.rowSpan, size.height, rowGap);\r\n return size;\r\n });\r\n\r\n const tops: number[] = [];\r\n let top = 0;\r\n for (const height of rows) {\r\n tops.push(top);\r\n top += height + rowGap;\r\n }\r\n const cells = placements.map((p) => ({\r\n x: p.col * (track + columnGap),\r\n y: tops[p.row] ?? 0,\r\n width: span(track, p.colSpan, columnGap),\r\n height: spannedRows(rows, p.row, p.rowSpan, rowGap),\r\n }));\r\n const height = rows.reduce((sum, h) => sum + h, 0) + rowGap * Math.max(0, rowCount - 1);\r\n return { sizes, cells, hug: { width: space.width, height } };\r\n}\r\n\r\n/** Each item's cell, clamped to the content box, centre-relative and y-up. */\r\nexport function placeGrid(cells: readonly BoxBounds[], inner: Size2D): BoxBounds[] {\r\n return cells.map((cell) => ({\r\n x: cell.x + cell.width / 2 - inner.width / 2,\r\n y: inner.height / 2 - cell.y - cell.height / 2,\r\n width: Math.min(cell.width, inner.width),\r\n height: Math.min(cell.height, inner.height),\r\n }));\r\n}\r\n\r\n// Left to right, wrapping when a span would overflow the columns. An item with\r\n// both `column` and `row` is placed there, 1-based, and left out of the flow.\r\nfunction autoPlace(items: readonly LayoutItem[], columns: number) {\r\n const placements: { col: number; row: number; colSpan: number; rowSpan: number }[] = [];\r\n const taken: boolean[][] = [];\r\n const isFree = (row: number, col: number, colSpan: number, rowSpan: number): boolean => {\r\n for (let r = 0; r < rowSpan; r++) {\r\n for (let c = 0; c < colSpan; c++) {\r\n if (taken[row + r]?.[col + c]) return false;\r\n }\r\n }\r\n return true;\r\n };\r\n const take = (row: number, col: number, colSpan: number, rowSpan: number): void => {\r\n for (let r = 0; r < rowSpan; r++) {\r\n taken[row + r] ??= [];\r\n for (let c = 0; c < colSpan; c++) taken[row + r][col + c] = true;\r\n }\r\n };\r\n\r\n let row = 0;\r\n let col = 0;\r\n for (const item of items) {\r\n const colSpan = Math.min(item.colSpan ?? 1, columns);\r\n const rowSpan = item.rowSpan ?? 1;\r\n if (item.column !== undefined && item.row !== undefined) {\r\n take(item.row - 1, item.column - 1, colSpan, rowSpan);\r\n placements.push({ col: item.column - 1, row: item.row - 1, colSpan, rowSpan });\r\n continue;\r\n }\r\n for (;;) {\r\n if (col + colSpan > columns) {\r\n row++;\r\n col = 0;\r\n }\r\n if (isFree(row, col, colSpan, rowSpan)) break;\r\n col++;\r\n }\r\n take(row, col, colSpan, rowSpan);\r\n placements.push({ col, row, colSpan, rowSpan });\r\n col += colSpan;\r\n }\r\n return placements;\r\n}\r\n\r\n// Content-sized rows grow to fit an item; a spanning item puts whatever its rows\r\n// are short of into the first of them.\r\nfunction grow(rows: number[], row: number, rowSpan: number, height: number, gap: number): void {\r\n if (rowSpan === 1) {\r\n if (height > rows[row]) rows[row] = height;\r\n return;\r\n }\r\n const short = height - spannedRows(rows, row, rowSpan, gap);\r\n if (short > 0) rows[row] += short;\r\n}\r\n\r\nfunction span(track: number, count: number, gap: number): number {\r\n return track * count + gap * (count - 1);\r\n}\r\n\r\nfunction spannedRows(rows: readonly number[], from: number, count: number, gap: number): number {\r\n let height = gap * (count - 1);\r\n for (let r = from; r < from + count; r++) height += rows[r] ?? 0;\r\n return height;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/layout/grid.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACvB,KAA4B,EAC5B,OAAe,EACf,SAAiB,EACjB,MAAc,EACd,KAAgB,EAChB,QAAsC;IAEtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3E,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpF,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,QAAQ,GAAG,CAAC,CA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AW;IACnF,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QAC3C,OAAO;IACX,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC5D,IAAI,KAAK,GAAG,CAAC;QAAE,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;AACtC,CAAC;AAED,SAAS,IAAI,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW;IACnD,OAAO,KAAK,GAAG,KAAK,GAAG,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,WAAW,CAAC,IAAuB,EAAE,IAAY,EAAE,KAAa,EAAE,GAAW;IAClF,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { BoxBounds } from \"./bounds\";\nimport type { SizeConstraints } from \"./constraints\";\nimport type { FlowSpace, LayoutItem } from \"./types\";\nimport { measureItem } from \"./item\";\n\n/**\n * Measures a grid: `columns` equal tracks across the width, and rows sized to\n * their content — or, when the height is bounded, divided equally so a\n * `fill`-height item has a share to fill. Each item's cell comes back from the\n * content box's top-left, y-down.\n */\nexport function measureGrid(\n items: readonly LayoutItem[],\n columns: number,\n columnGap: number,\n rowGap: number,\n space: FlowSpace,\n measurer: MeasureContext2D | undefined,\n): { sizes: Size2D[]; cells: BoxBounds[]; hug: Size2D } {\n const count = Math.max(1, Math.round(columns));\n const track = Math.max(0, (space.width - columnGap * (count - 1)) / count);\n const placements = autoPlace(items, count);\n const rowCount = placements.reduce((max, p) => Math.max(max, p.row + p.rowSpan), 0);\n\n const bounded = space.hugHeight !== true && rowCount > 0;\n const equalRow = bounded ? Math.max(0, (space.height - rowGap * (rowCount - 1)) / rowCount) : 0;\n const rows = new Array<number>(rowCount).fill(equalRow);\n\n const sizes = items.map((item, i) => {\n const p = placements[i];\n const width = span(track, p.colSpan, columnGap);\n const constraints: SizeConstraints = bounded\n ? { maxWidth: width, maxHeight: span(equalRow, p.rowSpan, rowGap) }\n : { maxWidth: width };\n const size = measureItem(item, constraints, measurer);\n // Bounded rows are already equal, and content may not grow one past its share.\n if (!bounded) grow(rows, p.row, p.rowSpan, size.height, rowGap);\n return size;\n });\n\n const tops: number[] = [];\n let top = 0;\n for (const height of rows) {\n tops.push(top);\n top += height + rowGap;\n }\n const cells = placements.map((p) => ({\n x: p.col * (track + columnGap),\n y: tops[p.row] ?? 0,\n width: span(track, p.colSpan, columnGap),\n height: spannedRows(rows, p.row, p.rowSpan, rowGap),\n }));\n const height = rows.reduce((sum, h) => sum + h, 0) + rowGap * Math.max(0, rowCount - 1);\n return { sizes, cells, hug: { width: space.width, height } };\n}\n\n/** Each item's cell, clamped to the content box, centre-relative and y-up. */\nexport function placeGrid(cells: readonly BoxBounds[], inner: Size2D): BoxBounds[] {\n return cells.map((cell) => ({\n x: cell.x + cell.width / 2 - inner.width / 2,\n y: inner.height / 2 - cell.y - cell.height / 2,\n width: Math.min(cell.width, inner.width),\n height: Math.min(cell.height, inner.height),\n }));\n}\n\n// Left to right, wrapping when a span would overflow the columns. An item with\n// both `column` and `row` is placed there, 1-based, and left out of the flow.\nfunction autoPlace(items: readonly LayoutItem[], columns: number) {\n const placements: { col: number; row: number; colSpan: number; rowSpan: number }[] = [];\n const taken: boolean[][] = [];\n const isFree = (row: number, col: number, colSpan: number, rowSpan: number): boolean => {\n for (let r = 0; r < rowSpan; r++) {\n for (let c = 0; c < colSpan; c++) {\n if (taken[row + r]?.[col + c]) return false;\n }\n }\n return true;\n };\n const take = (row: number, col: number, colSpan: number, rowSpan: number): void => {\n for (let r = 0; r < rowSpan; r++) {\n taken[row + r] ??= [];\n for (let c = 0; c < colSpan; c++) taken[row + r][col + c] = true;\n }\n };\n\n let row = 0;\n let col = 0;\n for (const item of items) {\n const colSpan = Math.min(item.colSpan ?? 1, columns);\n const rowSpan = item.rowSpan ?? 1;\n if (item.column !== undefined && item.row !== undefined) {\n take(item.row - 1, item.column - 1, colSpan, rowSpan);\n placements.push({ col: item.column - 1, row: item.row - 1, colSpan, rowSpan });\n continue;\n }\n for (;;) {\n if (col + colSpan > columns) {\n row++;\n col = 0;\n }\n if (isFree(row, col, colSpan, rowSpan)) break;\n col++;\n }\n take(row, col, colSpan, rowSpan);\n placements.push({ col, row, colSpan, rowSpan });\n col += colSpan;\n }\n return placements;\n}\n\n// Content-sized rows grow to fit an item; a spanning item puts whatever its rows\n// are short of into the first of them.\nfunction grow(rows: number[], row: number, rowSpan: number, height: number, gap: number): void {\n if (rowSpan === 1) {\n if (height > rows[row]) rows[row] = height;\n return;\n }\n const short = height - spannedRows(rows, row, rowSpan, gap);\n if (short > 0) rows[row] += short;\n}\n\nfunction span(track: number, count: number, gap: number): number {\n return track * count + gap * (count - 1);\n}\n\nfunction spannedRows(rows: readonly number[], from: number, count: number, gap: number): number {\n let height = gap * (count - 1);\n for (let r = from; r < from + count; r++) height += rows[r] ?? 0;\n return height;\n}\n"]}
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC","sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC","sourcesContent":["/**\n * Layout.\n *\n * One value — {@link flowOps} — arranges items by the `flow` vocabulary: a node's\n * children, or anything a node lays out itself. It replaced `measureFlex`,\n * `layoutFlex`, their wrapped twins, `measureGrid`/`layoutGrid`,\n * `layoutFlowChildren` and the `FlowLayout` engine, which between them placed\n * freeform four times and a run twice.\n */\nexport { flowOps } from \"./ops\";\nexport type * from \"./types\";\nexport * from \"./bounds\";\nexport * from \"./constraints\";\n"]}
|
package/dist/layout/item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../src/layout/item.ts"],"names":[],"mappings":"AAKA,sFAAsF;AACtF,MAAM,UAAU,WAAW,CACvB,IAAgB,EAChB,WAA4B,EAC5B,QAAsC;IAEtC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAChE,CAAC;IACD,OAAO;QACH,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;QACjD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC;KACvD,CAAC;AACN,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB,EAAE,SAA6B;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Size2D, SizeInput } from \"@/attributes/layout/size\";\
|
|
1
|
+
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../src/layout/item.ts"],"names":[],"mappings":"AAKA,sFAAsF;AACtF,MAAM,UAAU,WAAW,CACvB,IAAgB,EAChB,WAA4B,EAC5B,QAAsC;IAEtC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAChE,CAAC;IACD,OAAO;QACH,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC;QACjD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC;KACvD,CAAC;AACN,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB,EAAE,SAA6B;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Size2D, SizeInput } from \"@/attributes/layout/size\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { SizeConstraints } from \"./constraints\";\nimport type { LayoutItem } from \"./types\";\n\n/** An item's size under `constraints` — through its own `measure` when it has one. */\nexport function measureItem(\n item: LayoutItem,\n constraints: SizeConstraints,\n measurer: MeasureContext2D | undefined,\n): Size2D {\n if (item.measure) {\n const size = item.measure(constraints, measurer);\n return { width: size.width ?? 0, height: size.height ?? 0 };\n }\n return {\n width: extentOf(item.width, constraints.maxWidth),\n height: extentOf(item.height, constraints.maxHeight),\n };\n}\n\nfunction extentOf(input: SizeInput, available: number | undefined): number {\n if (typeof input === \"number\") return input;\n return input === \"fill\" ? available ?? 0 : 0;\n}\n"]}
|
package/dist/layout/ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/layout/ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAA+B,MAAM,0BAA0B,CAAC;AAIrF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AA4ChD,MAAM,MAAM,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAEvC,SAAS,OAAO,CACZ,QAAsB,EAAE,KAAmB,EAAE,GAAW,EAAE,QAA2B;IAErF,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACrG,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,CA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tree, and for anything a\r\n * node lays out itself, like a row of `Graphics2D` shapes inside `renderSelf`.\r\n *\r\n * It takes plain data and returns boxes, and writes to nothing it is handed: a\r\n * node keeps its own measure between passes. Its `resolve`/`lerp` pair is the\r\n * `flow` prop's, which is how a tween between two modes lives in the prop's value\r\n * and a seek that restores the prop restores the blend with it.\r\n *\r\n * Boxes are centred on the content box and y-up — the space `Graphics2D` draws\r\n * in. `Node2D` converts once, where it hands a box to a child.\r\n *\r\n * Each method is the module function of the same name.\r\n */\r\nimport { alignmentOps } from \"@/attributes/layout/alignment\";\r\nimport { insetsOps, type InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport { sizeInputOps, type Size2D, type SizeInput } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\nimport type { MeasureContext2D } from \"@/render/measure-context\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\nimport type { BoxBounds } from \"./bounds\";\r\nimport type { SizeConstraints } from \"./constraints\";\r\nimport { measureRun, measureWrap, placeRun } from \"./flex\";\r\nimport { measureFreeform, placeFreeform } from \"./freeform\";\r\nimport { measureGrid, placeGrid } from \"./grid\";\r\nimport type { FlowMeasure, FlowMode, FlowResolved, FlowSettings, FlowSpace, LayoutItem } from \"./types\";\r\n\r\n/** The `flow` attribute's operations beyond `resolve`/`lerp`. */\r\nexport interface FlowOps {\r\n // ── Arranging ──────────────────────────────────────────────────────────\r\n /**\r\n * Lay `items` out in a box of `box`'s size, inset by `settings.padding`.\r\n * Boxes come back centred on `box` and y-up. Pass a `measurer` when an item\r\n * measures text.\r\n */\r\n arrange<I extends LayoutItem>(\r\n settings: FlowSettings, items: readonly I[], box: Size2D, measurer?: MeasureContext2D,\r\n ): BoxBounds[];\r\n /** The first half of `arrange`: each item's size, and the extent a hugging container wraps. */\r\n measure<I extends LayoutItem>(\r\n settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer?: MeasureContext2D,\r\n ): FlowMeasure<I>;\r\n /** The second half: each item's box in a content box of `inner`'s size. */\r\n place(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[];\r\n /** Whether `measure` still holds for a content box of `inner`'s size. */\r\n reusable(measure: FlowMeasure, inner: Size2D): boolean;\r\n /**\r\n * Where `settings` would put one more item of `size` in a content box of\r\n * `inner`'s size, centred and y-up like `place`; `null` when they arrange\r\n * their items in a run or a grid, where the slot depends on the others.\r\n */\r\n freeSlot(settings: FlowSettings, inner: Size2D, size: Size2D): BoxBounds | null;\r\n\r\n // ── Sizing a container ─────────────────────────────────────────────────\r\n /** The content box a `width` × `height` container measures its items in. */\r\n contentBox(\r\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved,\r\n ): FlowSpace;\r\n /** The container's own size, given the `hug` extent its items came to. */\r\n size(\r\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved, hug: Size2D,\r\n ): Size2D;\r\n\r\n // ── Diagnostics ────────────────────────────────────────────────────────\r\n /** What is wrong with a run laid out in a box of `box`'s size, or `null`. */\r\n collapsedRun(measure: FlowMeasure, box: Size2D): string | null;\r\n}\r\n\r\nconst CENTRE: Vector2 = { x: 0, y: 0 };\r\n\r\nfunction arrange<I extends LayoutItem>(\r\n settings: FlowSettings, items: readonly I[], box: Size2D, measurer?: MeasureContext2D,\r\n): BoxBounds[] {\r\n const inner = insetsOps.insetBounds(box.width, box.height, insetsOps.resolve(settings.padding ?? 0));\r\n const boxes = place(measure(settings, items, inner, measurer), settings, inner);\r\n // `insetBounds` offsets the content box y-down; the boxes are y-up.\r\n return boxes.map((b) => ({ x: b.x + inner.x, y: b.y - inner.y, width: b.width, height: b.height }));\r\n}\r\n\r\nfunction measure<I extends LayoutItem>(\r\n settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer?: MeasureContext2D,\r\n): FlowMeasure<I> {\r\n const flow = settings.flow ?? \"freeform\";\r\n if (typeof flow === \"string\") return measureMode(flow, settings, items, space, measurer);\r\n const from = measureMode(flow.from, settings, items, space, measurer);\r\n const to = measureMode(flow.to, settings, items, space, measurer);\r\n return { ...to, hug: lerpSize(from.hug, to.hug, flow.t), from, t: flow.t };\r\n}\r\n\r\nfunction place(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[] {\r\n const to = placeMode(measure, settings, inner);\r\n const from = measure.from;\r\n if (!from) return to;\r\n const fromBoxes = placeMode(from, settings, inner);\r\n const t = measure.t ?? 1;\r\n return to.map((box, i) => ({\r\n x: lerpNumber(fromBoxes[i].x, box.x, t),\r\n y: lerpNumber(fromBoxes[i].y, box.y, t),\r\n width: lerpNumber(fromBoxes[i].width, box.width, t),\r\n height: lerpNumber(fromBoxes[i].height, box.height, t),\r\n }));\r\n}\r\n\r\n// Yoga's rule: reuse on an axis laid out at the size it was measured in, or — on\r\n// an axis that hugs — at exactly what it hugged. Anything else, a parent laid this\r\n// out at a size it did not measure it for, and the measure is stale.\r\nfunction reusable(measure: FlowMeasure, inner: Size2D): boolean {\r\n const { space, hug } = measure;\r\n return fits(inner.width, space.width, space.hugWidth, hug.width)\r\n && fits(inner.height, space.height, space.hugHeight, hug.height);\r\n}\r\n\r\nfunction contentBox(\r\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved,\r\n): FlowSpace {\r\n const width = outerFor(sizing.width, constraints.maxWidth);\r\n const height = outerFor(sizing.height, constraints.maxHeight);\r\n const inner = insetsOps.insetBounds(width, height, padding);\r\n return {\r\n width: inner.width,\r\n height: inner.height,\r\n hugWidth: sizing.width === \"hug\",\r\n hugHeight: sizing.height === \"hug\",\r\n };\r\n}\r\n\r\nfunction size(\r\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved, hug: Size2D,\r\n): Size2D {\r\n const hugged = insetsOps.outsetSize(hug.width, hug.height, padding);\r\n return {\r\n width: sizing.width === \"hug\" ? hugged.width : outerFor(sizing.width, constraints.maxWidth),\r\n height: sizing.height === \"hug\" ? hugged.height : outerFor(sizing.height, constraints.maxHeight),\r\n };\r\n}\r\n\r\n/**\r\n * A run laid out in a box of length 0 on its main axis, with items that have a\r\n * size. Always a bug, and a quiet one: a run is placed from the box's centre, so\r\n * its first item's leading edge lands on the centre and everything after follows —\r\n * content displaced by half a box it does not visibly have, which reads as \"the\r\n * scene loaded at 0,0\" rather than as a layout fault. A box holding only collapsed\r\n * items is legitimately empty: an animated insert or remove mid-flight.\r\n */\r\nfunction collapsedRun(measure: FlowMeasure, box: Size2D): string | null {\r\n if (measure.mode !== \"horizontal\" && measure.mode !== \"vertical\") return null;\r\n if ((measure.mode === \"horizontal\" ? box.width : box.height) > 0) return null;\r\n const sized = measure.sizes.filter((s) => s.width > 0 || s.height > 0).length;\r\n if (sized === 0) return null;\r\n return `is laying out ${sized} sized child${sized === 1 ? \"\" : \"ren\"} in a run of length 0 `\r\n + `(${box.width}×${box.height}, ${measure.mode}). `\r\n + `They will be positioned from its centre rather than its leading edge.`;\r\n}\r\n\r\n// A `from` that is itself a blend — a tween built mid-blend — starts from where it was heading.\r\nfunction lerp(from: FlowResolved, to: FlowResolved, t: number): FlowResolved {\r\n const a = typeof from === \"string\" ? from : from.to;\r\n const b = typeof to === \"string\" ? to : to.to;\r\n return t >= 1 || a === b ? b : { from: a, to: b, t };\r\n}\r\n\r\nfunction measureMode<I extends LayoutItem>(\r\n mode: FlowMode, settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer: MeasureContext2D | undefined,\r\n): FlowMeasure<I> {\r\n if (mode === \"freeform\") return { mode, items, space, ...measureFreeform(items, space, measurer) };\r\n if (mode === \"grid\") {\r\n const grid = measureGrid(items, settings.columns ?? 1, mainGap(settings), crossGap(settings), space, measurer);\r\n return { mode, items, space, ...grid };\r\n }\r\n const horizontal = mode === \"horizontal\";\r\n const run = settings.wrap\r\n ? measureWrap(items, horizontal, settings.gap ?? 0, crossGap(settings), space, measurer)\r\n : measureRun(items, horizontal, settings.gap ?? 0, space, measurer);\r\n return { mode, items, space, ...run };\r\n}\r\n\r\nfunction placeMode(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[] {\r\n if (measure.mode === \"grid\") return placeGrid(measure.cells ?? [], inner);\r\n const align = alignOf(settings);\r\n if (measure.mode === \"freeform\") return placeFreeform(measure.sizes, inner, align);\r\n return placeRun(\r\n measure.sizes, measure.lines ?? [], measure.gapScales ?? [], measure.mode === \"horizontal\",\r\n settings.gap ?? 0, crossGap(settings), align, inner,\r\n );\r\n}\r\n\r\nfunction freeSlot(settings: FlowSettings, inner: Size2D, size: Size2D): BoxBounds | null {\r\n if ((settings.flow ?? \"freeform\") !== \"freeform\") return null;\r\n return placeFreeform([size], inner, alignOf(settings))[0];\r\n}\r\n\r\n// A container stores `align` resolved, so only a named key needs resolving here.\r\nfunction alignOf(settings: FlowSettings): Vector2 {\r\n const align = settings.align;\r\n if (align === undefined) return CENTRE;\r\n return typeof align === \"string\" ? alignmentOps.resolve(align) : align;\r\n}\r\n\r\nfunction mainGap(settings: FlowSettings): number {\r\n const gap = settings.gap ?? 0;\r\n return gap === \"auto\" ? 0 : gap;\r\n}\r\n\r\nfunction crossGap(settings: FlowSettings): number {\r\n return settings.crossGap ?? mainGap(settings);\r\n}\r\n\r\n// A hugging axis measures its items against all the room it could have.\r\nfunction outerFor(input: SizeInput, max: number | undefined): number {\r\n const available = max ?? 0;\r\n return input === \"hug\" ? available : sizeInputOps.resolveLayout(input, available, 0);\r\n}\r\n\r\nfunction lerpSize(from: Size2D, to: Size2D, t: number): Size2D {\r\n return { width: lerpNumber(from.width, to.width, t), height: lerpNumber(from.height, to.height, t) };\r\n}\r\n\r\nfunction fits(laid: number, measured: number, hugs: boolean | undefined, hugged: number): boolean {\r\n return near(laid, measured) || (hugs === true && near(laid, hugged));\r\n}\r\n\r\nfunction near(a: number, b: number): boolean {\r\n if (a === b) return true;\r\n if (!Number.isFinite(a) || !Number.isFinite(b)) return false;\r\n return Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(b));\r\n}\r\n\r\nexport const flowOps: AttributeOps<FlowMode, FlowResolved> & FlowOps = {\r\n resolve: (value) => value,\r\n lerp,\r\n\r\n arrange,\r\n measure,\r\n place,\r\n reusable,\r\n freeSlot,\r\n\r\n contentBox,\r\n size,\r\n\r\n collapsedRun,\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/layout/ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAuB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAA+B,MAAM,0BAA0B,CAAC;AAIrF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AA4ChD,MAAM,MAAM,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAEvC,SAAS,OAAO,CACZ,QAAsB,EAAE,KAAmB,EAAE,GAAW,EAAE,QAA2B;IAErF,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACrG,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,CA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, and for anything a\n * node lays out itself, like a row of `Graphics2D` shapes inside `renderSelf`.\n *\n * It takes plain data and returns boxes, and writes to nothing it is handed: a\n * node keeps its own measure between passes. Its `resolve`/`lerp` pair is the\n * `flow` prop's, which is how a tween between two modes lives in the prop's value\n * and a seek that restores the prop restores the blend with it.\n *\n * Boxes are centred on the content box and y-up — the space `Graphics2D` draws\n * in. `Node2D` converts once, where it hands a box to a child.\n *\n * Each method is the module function of the same name.\n */\nimport { alignmentOps } from \"@/attributes/layout/alignment\";\nimport { insetsOps, type InsetsResolved } from \"@/attributes/layout/insets\";\nimport { sizeInputOps, type Size2D, type SizeInput } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport { lerpNumber } from \"@/tween/lerp\";\nimport type { BoxBounds } from \"./bounds\";\nimport type { SizeConstraints } from \"./constraints\";\nimport { measureRun, measureWrap, placeRun } from \"./flex\";\nimport { measureFreeform, placeFreeform } from \"./freeform\";\nimport { measureGrid, placeGrid } from \"./grid\";\nimport type { FlowMeasure, FlowMode, FlowResolved, FlowSettings, FlowSpace, LayoutItem } from \"./types\";\n\n/** The `flow` attribute's operations beyond `resolve`/`lerp`. */\nexport interface FlowOps {\n // ── Arranging ──────────────────────────────────────────────────────────\n /**\n * Lay `items` out in a box of `box`'s size, inset by `settings.padding`.\n * Boxes come back centred on `box` and y-up. Pass a `measurer` when an item\n * measures text.\n */\n arrange<I extends LayoutItem>(\n settings: FlowSettings, items: readonly I[], box: Size2D, measurer?: MeasureContext2D,\n ): BoxBounds[];\n /** The first half of `arrange`: each item's size, and the extent a hugging container wraps. */\n measure<I extends LayoutItem>(\n settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer?: MeasureContext2D,\n ): FlowMeasure<I>;\n /** The second half: each item's box in a content box of `inner`'s size. */\n place(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[];\n /** Whether `measure` still holds for a content box of `inner`'s size. */\n reusable(measure: FlowMeasure, inner: Size2D): boolean;\n /**\n * Where `settings` would put one more item of `size` in a content box of\n * `inner`'s size, centred and y-up like `place`; `null` when they arrange\n * their items in a run or a grid, where the slot depends on the others.\n */\n freeSlot(settings: FlowSettings, inner: Size2D, size: Size2D): BoxBounds | null;\n\n // ── Sizing a container ─────────────────────────────────────────────────\n /** The content box a `width` × `height` container measures its items in. */\n contentBox(\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved,\n ): FlowSpace;\n /** The container's own size, given the `hug` extent its items came to. */\n size(\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved, hug: Size2D,\n ): Size2D;\n\n // ── Diagnostics ────────────────────────────────────────────────────────\n /** What is wrong with a run laid out in a box of `box`'s size, or `null`. */\n collapsedRun(measure: FlowMeasure, box: Size2D): string | null;\n}\n\nconst CENTRE: Vector2 = { x: 0, y: 0 };\n\nfunction arrange<I extends LayoutItem>(\n settings: FlowSettings, items: readonly I[], box: Size2D, measurer?: MeasureContext2D,\n): BoxBounds[] {\n const inner = insetsOps.insetBounds(box.width, box.height, insetsOps.resolve(settings.padding ?? 0));\n const boxes = place(measure(settings, items, inner, measurer), settings, inner);\n // `insetBounds` offsets the content box y-down; the boxes are y-up.\n return boxes.map((b) => ({ x: b.x + inner.x, y: b.y - inner.y, width: b.width, height: b.height }));\n}\n\nfunction measure<I extends LayoutItem>(\n settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer?: MeasureContext2D,\n): FlowMeasure<I> {\n const flow = settings.flow ?? \"freeform\";\n if (typeof flow === \"string\") return measureMode(flow, settings, items, space, measurer);\n const from = measureMode(flow.from, settings, items, space, measurer);\n const to = measureMode(flow.to, settings, items, space, measurer);\n return { ...to, hug: lerpSize(from.hug, to.hug, flow.t), from, t: flow.t };\n}\n\nfunction place(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[] {\n const to = placeMode(measure, settings, inner);\n const from = measure.from;\n if (!from) return to;\n const fromBoxes = placeMode(from, settings, inner);\n const t = measure.t ?? 1;\n return to.map((box, i) => ({\n x: lerpNumber(fromBoxes[i].x, box.x, t),\n y: lerpNumber(fromBoxes[i].y, box.y, t),\n width: lerpNumber(fromBoxes[i].width, box.width, t),\n height: lerpNumber(fromBoxes[i].height, box.height, t),\n }));\n}\n\n// Yoga's rule: reuse on an axis laid out at the size it was measured in, or — on\n// an axis that hugs — at exactly what it hugged. Anything else, a parent laid this\n// out at a size it did not measure it for, and the measure is stale.\nfunction reusable(measure: FlowMeasure, inner: Size2D): boolean {\n const { space, hug } = measure;\n return fits(inner.width, space.width, space.hugWidth, hug.width)\n && fits(inner.height, space.height, space.hugHeight, hug.height);\n}\n\nfunction contentBox(\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved,\n): FlowSpace {\n const width = outerFor(sizing.width, constraints.maxWidth);\n const height = outerFor(sizing.height, constraints.maxHeight);\n const inner = insetsOps.insetBounds(width, height, padding);\n return {\n width: inner.width,\n height: inner.height,\n hugWidth: sizing.width === \"hug\",\n hugHeight: sizing.height === \"hug\",\n };\n}\n\nfunction size(\n sizing: Pick<LayoutItem, \"width\" | \"height\">, constraints: SizeConstraints, padding: InsetsResolved, hug: Size2D,\n): Size2D {\n const hugged = insetsOps.outsetSize(hug.width, hug.height, padding);\n return {\n width: sizing.width === \"hug\" ? hugged.width : outerFor(sizing.width, constraints.maxWidth),\n height: sizing.height === \"hug\" ? hugged.height : outerFor(sizing.height, constraints.maxHeight),\n };\n}\n\n/**\n * A run laid out in a box of length 0 on its main axis, with items that have a\n * size. Always a bug, and a quiet one: a run is placed from the box's centre, so\n * its first item's leading edge lands on the centre and everything after follows —\n * content displaced by half a box it does not visibly have, which reads as \"the\n * scene loaded at 0,0\" rather than as a layout fault. A box holding only collapsed\n * items is legitimately empty: an animated insert or remove mid-flight.\n */\nfunction collapsedRun(measure: FlowMeasure, box: Size2D): string | null {\n if (measure.mode !== \"horizontal\" && measure.mode !== \"vertical\") return null;\n if ((measure.mode === \"horizontal\" ? box.width : box.height) > 0) return null;\n const sized = measure.sizes.filter((s) => s.width > 0 || s.height > 0).length;\n if (sized === 0) return null;\n return `is laying out ${sized} sized child${sized === 1 ? \"\" : \"ren\"} in a run of length 0 `\n + `(${box.width}×${box.height}, ${measure.mode}). `\n + `They will be positioned from its centre rather than its leading edge.`;\n}\n\n// A `from` that is itself a blend — a tween built mid-blend — starts from where it was heading.\nfunction lerp(from: FlowResolved, to: FlowResolved, t: number): FlowResolved {\n const a = typeof from === \"string\" ? from : from.to;\n const b = typeof to === \"string\" ? to : to.to;\n return t >= 1 || a === b ? b : { from: a, to: b, t };\n}\n\nfunction measureMode<I extends LayoutItem>(\n mode: FlowMode, settings: FlowSettings, items: readonly I[], space: FlowSpace, measurer: MeasureContext2D | undefined,\n): FlowMeasure<I> {\n if (mode === \"freeform\") return { mode, items, space, ...measureFreeform(items, space, measurer) };\n if (mode === \"grid\") {\n const grid = measureGrid(items, settings.columns ?? 1, mainGap(settings), crossGap(settings), space, measurer);\n return { mode, items, space, ...grid };\n }\n const horizontal = mode === \"horizontal\";\n const run = settings.wrap\n ? measureWrap(items, horizontal, settings.gap ?? 0, crossGap(settings), space, measurer)\n : measureRun(items, horizontal, settings.gap ?? 0, space, measurer);\n return { mode, items, space, ...run };\n}\n\nfunction placeMode(measure: FlowMeasure, settings: FlowSettings, inner: Size2D): BoxBounds[] {\n if (measure.mode === \"grid\") return placeGrid(measure.cells ?? [], inner);\n const align = alignOf(settings);\n if (measure.mode === \"freeform\") return placeFreeform(measure.sizes, inner, align);\n return placeRun(\n measure.sizes, measure.lines ?? [], measure.gapScales ?? [], measure.mode === \"horizontal\",\n settings.gap ?? 0, crossGap(settings), align, inner,\n );\n}\n\nfunction freeSlot(settings: FlowSettings, inner: Size2D, size: Size2D): BoxBounds | null {\n if ((settings.flow ?? \"freeform\") !== \"freeform\") return null;\n return placeFreeform([size], inner, alignOf(settings))[0];\n}\n\n// A container stores `align` resolved, so only a named key needs resolving here.\nfunction alignOf(settings: FlowSettings): Vector2 {\n const align = settings.align;\n if (align === undefined) return CENTRE;\n return typeof align === \"string\" ? alignmentOps.resolve(align) : align;\n}\n\nfunction mainGap(settings: FlowSettings): number {\n const gap = settings.gap ?? 0;\n return gap === \"auto\" ? 0 : gap;\n}\n\nfunction crossGap(settings: FlowSettings): number {\n return settings.crossGap ?? mainGap(settings);\n}\n\n// A hugging axis measures its items against all the room it could have.\nfunction outerFor(input: SizeInput, max: number | undefined): number {\n const available = max ?? 0;\n return input === \"hug\" ? available : sizeInputOps.resolveLayout(input, available, 0);\n}\n\nfunction lerpSize(from: Size2D, to: Size2D, t: number): Size2D {\n return { width: lerpNumber(from.width, to.width, t), height: lerpNumber(from.height, to.height, t) };\n}\n\nfunction fits(laid: number, measured: number, hugs: boolean | undefined, hugged: number): boolean {\n return near(laid, measured) || (hugs === true && near(laid, hugged));\n}\n\nfunction near(a: number, b: number): boolean {\n if (a === b) return true;\n if (!Number.isFinite(a) || !Number.isFinite(b)) return false;\n return Math.abs(a - b) <= 1e-6 * Math.max(1, Math.abs(a), Math.abs(b));\n}\n\nexport const flowOps: AttributeOps<FlowMode, FlowResolved> & FlowOps = {\n resolve: (value) => value,\n lerp,\n\n arrange,\n measure,\n place,\n reusable,\n freeSlot,\n\n contentBox,\n size,\n\n collapsedRun,\n};\n"]}
|
package/dist/layout/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { Insets } from \"@/attributes/layout/insets\";\nimport type { Size2D, SizeInput } from \"@/attributes/layout/size\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { BoxBounds } from \"./bounds\";\nimport type { SizeConstraints } from \"./constraints\";\n\n/**\n * How a container arranges the items that take part in its layout:\n *\n * - `'freeform'` — items overlap, each aligned in the padded content box by\n * `align` and offset from there by its own `x`/`y`.\n * - `'horizontal'` — a run left-to-right.\n * - `'vertical'` — a run top-to-bottom.\n * - `'grid'` — N equal columns, rows sized to their content (or divided equally\n * when the container's height is bounded). Items place themselves with\n * `column`/`row` and span with `colSpan`/`rowSpan`; anything unplaced is\n * auto-flowed left-to-right.\n *\n * A run also answers `wrap` — \"and break onto a new line when you run out of\n * room\" — which is a property of the run rather than a fourth direction.\n */\nexport type FlowMode = \"horizontal\" | \"vertical\" | \"freeform\" | \"grid\";\n\n/** Spacing between items, or `\"auto\"` to spread the free space evenly between them. */\nexport type GapSize = number | \"auto\";\n\n/**\n * What a `flow` prop holds: a mode, or — mid-tween between two — both and how far\n * along. The blend lives in the value so that restoring the prop restores it.\n */\nexport type FlowResolved = FlowMode | { from: FlowMode; to: FlowMode; t: number };\n\n/** A container's author-facing layout props. */\nexport interface FlowProps {\n /**\n * Layout mode for children: a run (`horizontal` / `vertical`), overlapping\n * `freeform`, or a `grid` of N equal columns.\n */\n flow: FlowMode;\n /** Spacing between children along the layout's main axis. */\n gap: GapSize;\n /**\n * Break a `horizontal`/`vertical` run onto new lines once it runs out of\n * main-axis room. It needs a bounded main axis to break against, so an axis\n * set to `'hug'` stays one line.\n */\n wrap: boolean;\n /**\n * Spacing on the **cross** axis: between wrapped lines, and between a grid's\n * rows. Omitted, it follows `gap` — \"wrap this row\" almost never means \"and\n * stack the lines flush against each other\".\n */\n crossGap: number;\n /** Number of equal columns when `flow` is `'grid'`. At least 1. */\n columns: number;\n /**\n * Where children sit in the content box: a named position (`'center'`,\n * `'topLeft'`, …) or a per-axis `Vector2` (x: -1 left … +1 right, y: -1\n * bottom … +1 top).\n */\n align: Alignment;\n}\n\n/**\n * What `flowOps` arranges by: the {@link FlowProps} vocabulary, every field\n * optional and defaulting as the prop does. A shape's state or a `Canvas2D` is one\n * as it stands.\n */\nexport interface FlowSettings {\n readonly flow?: FlowResolved;\n readonly gap?: GapSize;\n readonly wrap?: boolean;\n readonly crossGap?: number;\n readonly columns?: number;\n readonly align?: Alignment;\n /** Read by `flowOps.arrange` only; a node insets its own content box. */\n readonly padding?: Insets;\n}\n\n/** One thing a flow arranges — a `Node2D` as it stands, or a plain `{ width, height }`. */\nexport interface LayoutItem {\n readonly width: SizeInput;\n readonly height: SizeInput;\n /** Share of a run's free space among its `fill` items. Default 1. */\n readonly flex?: number;\n /** Fraction of a full gap this item opens on each side, `[0, 1]`. Default 1. */\n readonly gapScale?: number;\n /** 1-based grid column; with `row`, places the item explicitly. */\n readonly column?: number;\n readonly row?: number;\n readonly colSpan?: number;\n readonly rowSpan?: number;\n /**\n * The item's own size under `constraints`. Without one, a number is the size,\n * `'fill'` takes what is offered and `'hug'` is 0.\n */\n measure?(constraints: SizeConstraints, measurer?: MeasureContext2D): Partial<Size2D>;\n}\n\n/** The content box a flow measures in, and which of its axes hug their content. */\nexport interface FlowSpace {\n readonly width: number;\n readonly height: number;\n readonly hugWidth?: boolean;\n readonly hugHeight?: boolean;\n}\n\n/** One line of a `horizontal`/`vertical` run: items `[start, end)`. */\nexport interface FlowLine {\n readonly start: number;\n readonly end: number;\n /** The line's thickness — its deepest item — on the cross axis. */\n readonly cross: number;\n}\n\n/**\n * One measure pass: what `flowOps.place` needs to position the items, and the\n * extent a hugging container wraps.\n */\nexport interface FlowMeasure<I extends LayoutItem = LayoutItem> {\n readonly mode: FlowMode;\n readonly items: readonly I[];\n readonly sizes: readonly Size2D[];\n readonly hug: Size2D;\n /** The content box this was measured in — see `flowOps.reusable`. */\n readonly space: FlowSpace;\n /** Runs: the lines, and each item's clamped `gapScale` (all 1 when wrapped). */\n readonly lines?: readonly FlowLine[];\n readonly gapScales?: readonly number[];\n /** Grid: each item's cell, from the content box's top-left, y-down. */\n readonly cells?: readonly BoxBounds[];\n /** A blend between two modes: the measure of the mode being left, and how far along. */\n readonly from?: FlowMeasure<I>;\n readonly t?: number;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-sink.js","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IA8BD;;;OAGG;IACH,QAAQ,CAAC,KAAc,IAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAc,IAAS,CAAC;IAElC,OAAO;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { AudioRequest } from \"@/attributes/audio/request\";\
|
|
1
|
+
{"version":3,"file":"audio-sink.js","sourceRoot":"","sources":["../../src/platform/audio-sink.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAS;IAC3B;;;;;;;;OAQG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IA8BD;;;OAGG;IACH,QAAQ,CAAC,KAAc,IAAS,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAc,IAAS,CAAC;IAElC,OAAO;QACH,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { AudioRequest } from \"@/attributes/audio/request\";\n\n\n/**\n * Stackable audio player driven by the AssetManager.\n *\n * The AssetManager decides which audio data is needed within the current\n * look-ahead window and pushes it in via {@link append}; the device caches the\n * decoded form, schedules the matching {@link AudioRequest}s via\n * {@link schedule}, and drives playback through {@link syncTo} on each tick.\n */\nexport abstract class AudioSink {\n /**\n * Whether pushing the audio working set to this device does anything at all.\n *\n * False for a sink that discards everything — an export, whose audio is mixed\n * offline in a single pass at the end. `AssetManager.syncAudio` runs on every\n * frame and rebuilds a `Set`, a per-request id string and a sorted signature\n * each time; against such a device every one of those calls lands on a no-op,\n * so the work is skipped rather than done and thrown away.\n */\n get schedulesAudio(): boolean {\n return true;\n }\n\n /** True if decoded data for `src` is already cached on the device. */\n abstract has(src: string): boolean;\n\n /**\n * Decode and stack `data` under `src`. Idempotent — repeat calls for an\n * already-cached `src` are no-ops.\n */\n abstract append(src: string, data: ArrayBuffer): Promise<void>;\n\n /** Drop cached audio data (and any active sources) for srcs not in `keep`. */\n abstract retain(keep: ReadonlySet<string>): void;\n\n /**\n * Set the working set of audio requests for the current look-ahead window.\n * Requests no longer present are stopped; new ones become eligible for\n * playback via {@link syncTo} as soon as their data is appended.\n */\n abstract schedule(requests: readonly AudioRequest[]): void;\n\n /**\n * Start/stop scheduled sources to match `clipTime`. Called every tick.\n * Sources whose data has not yet been appended are skipped until it is.\n */\n abstract syncTo(clipTime: number): void;\n\n abstract play(time: number, speed: number, reverse: boolean): void | Promise<void>;\n abstract stop(): void;\n\n /**\n * Mute or unmute all output. Default is a no-op for devices that produce no\n * sound (e.g. export/noop sinks).\n */\n setMuted(muted: boolean): void {}\n\n /**\n * Set the linear gain applied to all output, on top of each request's own\n * `volume`. Independent of {@link setMuted} — unmuting restores this level\n * rather than resetting to 1, so a host can hold a volume slider and a mute\n * button without the two clobbering each other.\n *\n * Default is a no-op, as for {@link setMuted}.\n */\n setVolume(volume: number): void {}\n\n dispose(): void {\n this.stop();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.js","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"","sourcesContent":["import { AssetManifest } from \"@/assets/manifest\";\
|
|
1
|
+
{"version":3,"file":"exporter.js","sourceRoot":"","sources":["../../src/platform/exporter.ts"],"names":[],"mappings":"","sourcesContent":["import { AssetManifest } from \"@/assets/manifest\";\nimport type { ProjectDocument } from \"@/document/project\";\nimport type { Registry } from \"@/document/registry\";\nimport type { FrameSpec } from \"@/runtime/frame-time\";\nimport type { RenderIssue } from \"@/render/render-issue\";\n\n/**\n * Encoding settings, passed through to whatever the platform's exporter uses.\n *\n * Deliberately `unknown`-shaped rather than a union of every codec option each\n * backend might take: `core` has no opinion about encoders.\n */\nexport type EncodeOptions = Record<string, unknown>;\n\n/** A run of project frames: `start` included, `end` not. */\nexport interface FrameRange {\n start: number;\n end: number;\n}\n\n/** What an {@link Exporter} needs to encode a timeline. */\nexport interface ExportVideoRequest {\n /** The project, its fps and viewport resolved — see `Session.document`. Carries its theme. */\n project: ProjectDocument;\n /** The vocabulary its clips compile against: the opening engine's. */\n registry: Registry;\n /** Resolution multiplier on the viewport. Default 1. */\n scale?: number;\n manifest?: AssetManifest;\n includeAudio?: boolean;\n /**\n * Encode only these frames, as a file of their own that starts at 0. It is\n * always silent: a range is one segment of a split export, whose audio is\n * mixed once over the whole timeline.\n */\n frames?: FrameRange;\n /** Progress through the export, in `[0, 1]`. */\n onProgress?: (progress: number) => void;\n signal?: AbortSignal;\n /**\n * What the renderer drew but not as the document says, once per kind,\n * feature and node. A lost GPU device fails the export with a\n * `RenderBackendError` instead.\n */\n onIssue?: (issue: RenderIssue) => void;\n encode?: EncodeOptions;\n}\n\n/** What an {@link Exporter} needs to encode one frame. */\nexport interface ExportStillRequest {\n project: ProjectDocument;\n registry: Registry;\n frame: FrameSpec;\n scale?: number;\n manifest?: AssetManifest;\n format?: \"png\" | \"jpeg\";\n quality?: number;\n signal?: AbortSignal;\n /**\n * What the renderer drew but not as the document says, once per kind,\n * feature and node. A lost GPU device fails the export with a\n * `RenderBackendError` instead.\n */\n onIssue?: (issue: RenderIssue) => void;\n}\n\nexport interface ExportedStill {\n bytes: Uint8Array;\n /** The frame actually captured — the request clamped into range. */\n frame: number;\n totalFrames: number;\n}\n\n/**\n * How a `Session` turns itself into bytes.\n *\n * A **port**: `core` declares it, a platform implements it, and the dependency\n * runs platform → core like every other seam here — which is what lets\n * `Session.export()` exist in `core` without importing anything that encodes.\n */\nexport interface Exporter {\n exportVideo(request: ExportVideoRequest): Promise<Uint8Array | void>;\n exportStill(request: ExportStillRequest): Promise<ExportedStill>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/** @internal */ export { Ticker } from './ticker';\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACvF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/** @internal */ export { Ticker } from './ticker';\n/** @internal */ export { AudioSink } from './audio-sink';\n/** @internal */ export { StorageAdapter, type DecodePolicy } from './storage-adapter';\n/** @internal */ export { SteppedClock } from './stepped-clock';\nexport type {\n Exporter,\n ExportVideoRequest,\n ExportStillRequest,\n ExportedStill,\n EncodeOptions,\n FrameRange,\n} from './exporter';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepped-clock.js","sourceRoot":"","sources":["../../src/platform/stepped-clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IACpC,IAAI,CAAC,CAAS;QACV,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Ticker } from \"./ticker\";\
|
|
1
|
+
{"version":3,"file":"stepped-clock.js","sourceRoot":"","sources":["../../src/platform/stepped-clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IACpC,IAAI,CAAC,CAAS;QACV,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Ticker } from \"./ticker\";\n\n/**\n * A clock with no wall clock behind it: the playhead is wherever it was last put.\n *\n * What a headless session runs on. `PlaybackController` needs *a* clock to seek\n * against, but an export has no realtime to sync to — and must not have one,\n * because a wall-clock export drifts. So the platform reports `null` from\n * `createTicker` to say \"no realtime transport here\", and a session stands\n * this in so everything that is not transport — seeking, node picking, reading a\n * node's box, drawing a frame — works exactly as it does in a browser.\n *\n * `play()` is deliberately not overridden into a no-op: nothing reaches it,\n * because a session with no realtime clock exposes `playback === null` and there\n * is no other route to it.\n *\n * @internal\n */\nexport class SteppedClock extends Ticker {\n seek(t: number): void {\n this.setCurrentTime(t);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-adapter.js","sourceRoot":"","sources":["../../src/platform/storage-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAkBtD,MAAM,OAAgB,cAAc;IACtB,OAAO,CAAe;IACtB,QAAQ,CAAS;IAC3B,YAAY,OAAqB,EAAE,QAAgB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CA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CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC7D,OAAO;YACH,UAAU,EAAE,UAAU,IAAI,GAAG;YAC7B,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU;SACnD,CAAC;IACN,CAAC;IAiCD,6EAA6E;IAE7E;;;;;;;OAOG;IACH,KAAK,CAAC,gBAAgB;QAClB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,eAAe,CAAC,MAAoB;QAChC,mDAAmD;IACvD,CAAC;IAED,qEAAqE;IACrE,eAAe;QACX,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,gGAAgG;IAChG,iBAAiB;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,kBAAkB;QACpB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,kBAAkB;QACd,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,mBAAmB;QACrB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAgB;QACvB,gDAAgD;IACpD,CAAC;IAED,6EAA6E;IAE7E,OAAO;QACH,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import { AssetCatalog } from \"@/assets/catalog\";\r\nimport { AssetNotLoadedError } from \"@/assets/errors\";\r\nimport { AssetRecord } from \"@/assets/record\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * How an adapter picks the resolution to decode media at, and how strict it is\r\n * about what it cannot load.\r\n *\r\n * `\"exact\"` — export, stills, screenshots: the level follows the current draw\r\n * alone, so a frame is the same pixels whatever was drawn before it on a reused\r\n * adapter, and a font family the manifest cannot describe is refused rather\r\n * than shaped against the fallback face. `\"interactive\"` — preview: reuse\r\n * whatever resident level is already good enough, and upgrade in the\r\n * background; an undescribed family draws in the fallback face until a manifest\r\n * describes it.\r\n */\r\nexport type DecodePolicy = \"exact\" | \"interactive\";\r\n\r\nexport abstract class StorageAdapter {\r\n protected catalog: AssetCatalog;\r\n protected viewport: Size2D;\r\n constructor(catalog: AssetCatalog, viewport: Size2D) {\r\n this.catalog = catalog;\r\n this.viewport = viewport;\r\n }\r\n\r\n /**\r\n * Point the adapter at a different asset catalog, keeping every decode it has\r\n * already cached.\r\n *\r\n * Safe because the catalog supplies *metadata* (durations, intrinsic sizes)\r\n * while the caches are keyed by source URL: a src the new catalog drops leaves\r\n * an orphaned decode, and a src it adds simply isn't cached yet. Neither is a\r\n * correctness problem, which is what lets a long-lived renderer take an\r\n * updated manifest without paying to re-decode everything still in use.\r\n *\r\n * The viewport has no such setter; a host that changes output size rebuilds\r\n * the adapter.\r\n */\r\n setCatalog(catalog: AssetCatalog): void {\r\n this.catalog = catalog;\r\n }\r\n /**\r\n * Every asset src whose loadXxx is currently in flight, mapped to its\r\n * pending promise. The render path awaits these to guarantee no draw\r\n * happens while a load is still resolving. Cleared on completion.\r\n */\r\n protected inFlightLoads = new Map<string, Promise<void>>();\r\n /** Keys of assets that have been fully loaded and are ready to use. */\r\n protected cachedAssets = new Set<string>();\r\n\r\n // ─── Asset loading dispatch ───────────────────────────────────────────────\r\n\r\n /** Whether `key` has finished loading and is usable now. */\r\n isLoaded(key: string): boolean {\r\n return this.cachedAssets.has(key);\r\n }\r\n\r\n async loadAsset(key: string, value: AssetRecord): Promise<void> {\r\n const existing = this.inFlightLoads.get(key);\r\n if (existing) return existing;\r\n if (this.cachedAssets.has(key)) return;\r\n\r\n const job = this.runLoad(key, value);\r\n this.inFlightLoads.set(key, job);\r\n try {\r\n await job;\r\n } finally {\r\n this.inFlightLoads.delete(key);\r\n }\r\n }\r\n\r\n private async runLoad(key: string, value: AssetRecord): Promise<void> {\r\n let loaded = true;\r\n switch (value.type) {\r\n case 'image':\r\n await this.loadImage(key);\r\n break;\r\n case 'video':\r\n await this.loadVideo(key, value.startFrame, value.endFrame, value.trimStart, value.trimEnd);\r\n break;\r\n case 'font': {\r\n const { fontFamily, fontWeight } = this.parseFontKey(key);\r\n loaded = await this.loadFont(key, fontFamily, fontWeight);\r\n if (!loaded && this.getDecodePolicy() === \"exact\") {\r\n throw new AssetNotLoadedError(\r\n \"font\",\r\n fontFamily,\r\n `The manifest has no font entry for \"${fontFamily}\", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`,\r\n );\r\n }\r\n break;\r\n }\r\n case 'audio':\r\n // Audio files are loaded on-demand via fetchAudioData / syncAudio, not through loadAsset.\r\n break;\r\n case 'loader':\r\n // Loaders are opaque callbacks run directly by the AssetManager and\r\n // never dispatched through the storage adapter.\r\n throw new Error(\"Loader records must not be routed through StorageAdapter.loadAsset\");\r\n default: {\r\n const _exhaustive: never = value;\r\n throw new Error(`Unsupported asset type: ${(_exhaustive as AssetRecord).type}`);\r\n }\r\n }\r\n\r\n // Only a load that actually happened is cached. This matters for exactly\r\n // one case: a font family the manifest cannot describe. Caching it anyway\r\n // marked the family handled for the life of this adapter, so a manifest\r\n // that *later* described it — which is what installing a typeface does,\r\n // folded into the live manifest without rebuilding the controller — could\r\n // never load it, and the text stayed in the fallback face until something\r\n // else tore the adapter down.\r\n if (loaded) this.cachedAssets.add(key);\r\n }\r\n\r\n // ─── Font key parsing ─────────────────────────────────────────────────────\r\n\r\n protected parseFontKey(key: string): { fontFamily: string; fontWeight: number } {\r\n const [fontFamily, weightStr] = key.split('@');\r\n const fontWeight = weightStr ? parseInt(weightStr, 10) : 400;\r\n return {\r\n fontFamily: fontFamily || key,\r\n fontWeight: isNaN(fontWeight) ? 400 : fontWeight,\r\n };\r\n }\r\n\r\n // ─── Abstract load methods ────────────────────────────────────────────────\r\n\r\n /** Decode resolution follows the draw, so a load names only the source. */\r\n abstract loadImage(src: string): Promise<void>;\r\n abstract loadVideo(\r\n src: string,\r\n startFrame: number,\r\n endFrame: number,\r\n trimStart: number,\r\n trimEnd?: number,\r\n ): Promise<void>;\r\n abstract loadAudio(\r\n src: string,\r\n startFrame: number,\r\n endFrame: number,\r\n trimStart: number,\r\n trimEnd?: number,\r\n ): Promise<void>;\r\n abstract fetchAudioData(src: string): Promise<ArrayBuffer>;\r\n /**\r\n * Register every face of `fontFamily` the catalog describes.\r\n *\r\n * Returns whether the family was actually loaded. `false` means the manifest\r\n * has no entry for it. Not an error while previewing (an undescribed family\r\n * shapes against the platform fallback, which is what a system font name\r\n * does), but a blocking caller refuses it — see {@link DecodePolicy} — and\r\n * it must not be remembered as handled either way: see the note in\r\n * {@link runLoad}.\r\n */\r\n abstract loadFont(src: string, fontFamily: string, fontWeight: number): Promise<boolean>;\r\n\r\n // ─── Frame warming ────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Decode any exact media frames the most recent render asked for but couldn't\r\n * satisfy synchronously (e.g. a video frame at a freshly-seeked timestamp),\r\n * and report whether there were any. A blocking caller (seek / screenshot /\r\n * export) renders once, awaits this, and re-renders while it returns true so\r\n * the frame is accurate even on a cold jump. Defaults to a no-op for adapters\r\n * with no time-varying media.\r\n */\r\n async warmPendingVideo(): Promise<boolean> {\r\n return false;\r\n }\r\n\r\n setDecodePolicy(policy: DecodePolicy): void {\r\n // no-op for adapters that decode at one resolution\r\n }\r\n\r\n /** Read back so a caller that borrows the adapter can restore it. */\r\n getDecodePolicy(): DecodePolicy {\r\n return \"interactive\";\r\n }\r\n\r\n /** Whether the most recent render left decodes that {@link warmPendingDecodes} would settle. */\r\n hasPendingDecodes(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Settle what the last render could not draw acceptably under the current\r\n * policy — video frames, every exact image level under `\"exact\"`, a source\r\n * drawn with nothing resident under `\"interactive\"` — and report whether there\r\n * was any. See `renderSettled`.\r\n *\r\n * Defaults to {@link warmPendingVideo} so an adapter written against it keeps\r\n * working; that alias goes away after one release.\r\n */\r\n async warmPendingDecodes(): Promise<boolean> {\r\n return this.warmPendingVideo();\r\n }\r\n\r\n /**\r\n * Whether an `\"interactive\"` decode is on its way that would draw the last\r\n * render sharper. Not something a paint waits for: a preview shows what is\r\n * resident and repaints when {@link warmPendingUpgrades} reports a landing.\r\n */\r\n hasPendingUpgrades(): boolean {\r\n return false;\r\n }\r\n\r\n /** Await the upgrades {@link hasPendingUpgrades} reports; whether one landed. */\r\n async warmPendingUpgrades(): Promise<boolean> {\r\n return false;\r\n }\r\n\r\n /**\r\n * Notify the adapter whether playback is live. Time-varying media (video) uses\r\n * this to prefetch ahead only while playing and to quiesce on pause, so a\r\n * paused timeline doesn't drain a backlog of stale decodes. No-op by default.\r\n */\r\n setPlaying(playing: boolean): void {\r\n // no-op for adapters with no time-varying media\r\n }\r\n\r\n // ─── Lifecycle ────────────────────────────────────────────────────────────\r\n\r\n dispose(): void {\r\n this.inFlightLoads.clear();\r\n this.cachedAssets.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"storage-adapter.js","sourceRoot":"","sources":["../../src/platform/storage-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAkBtD,MAAM,OAAgB,cAAc;IACtB,OAAO,CAAe;IACtB,QAAQ,CAAS;IAC3B,YAAY,OAAqB,EAAE,QAAgB;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,OAAqB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IACD;;;;OAIG;IACO,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC3D,uEAAuE;IAC7D,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,6EAA6E;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AgB;QAClB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,eAAe,CAAC,MAAoB;QAChC,mDAAmD;IACvD,CAAC;IAED,qEAAqE;IACrE,eAAe;QACX,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,gGAAgG;IAChG,iBAAiB;QACb,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,kBAAkB;QACpB,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,kBAAkB;QACd,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,iFAAiF;IACjF,KAAK,CAAC,mBAAmB;QACrB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAgB;QACvB,gDAAgD;IACpD,CAAC;IAED,6EAA6E;IAE7E,OAAO;QACH,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import { AssetCatalog } from \"@/assets/catalog\";\nimport { AssetNotLoadedError } from \"@/assets/errors\";\nimport { AssetRecord } from \"@/assets/record\";\nimport { Size2D } from \"@/attributes/layout/size\";\n\n/**\n * How an adapter picks the resolution to decode media at, and how strict it is\n * about what it cannot load.\n *\n * `\"exact\"` — export, stills, screenshots: the level follows the current draw\n * alone, so a frame is the same pixels whatever was drawn before it on a reused\n * adapter, and a font family the manifest cannot describe is refused rather\n * than shaped against the fallback face. `\"interactive\"` — preview: reuse\n * whatever resident level is already good enough, and upgrade in the\n * background; an undescribed family draws in the fallback face until a manifest\n * describes it.\n */\nexport type DecodePolicy = \"exact\" | \"interactive\";\n\nexport abstract class StorageAdapter {\n protected catalog: AssetCatalog;\n protected viewport: Size2D;\n constructor(catalog: AssetCatalog, viewport: Size2D) {\n this.catalog = catalog;\n this.viewport = viewport;\n }\n\n /**\n * Point the adapter at a different asset catalog, keeping every decode it has\n * already cached.\n *\n * Safe because the catalog supplies *metadata* (durations, intrinsic sizes)\n * while the caches are keyed by source URL: a src the new catalog drops leaves\n * an orphaned decode, and a src it adds simply isn't cached yet. Neither is a\n * correctness problem, which is what lets a long-lived renderer take an\n * updated manifest without paying to re-decode everything still in use.\n *\n * The viewport has no such setter; a host that changes output size rebuilds\n * the adapter.\n */\n setCatalog(catalog: AssetCatalog): void {\n this.catalog = catalog;\n }\n /**\n * Every asset src whose loadXxx is currently in flight, mapped to its\n * pending promise. The render path awaits these to guarantee no draw\n * happens while a load is still resolving. Cleared on completion.\n */\n protected inFlightLoads = new Map<string, Promise<void>>();\n /** Keys of assets that have been fully loaded and are ready to use. */\n protected cachedAssets = new Set<string>();\n\n // ─── Asset loading dispatch ───────────────────────────────────────────────\n\n /** Whether `key` has finished loading and is usable now. */\n isLoaded(key: string): boolean {\n return this.cachedAssets.has(key);\n }\n\n async loadAsset(key: string, value: AssetRecord): Promise<void> {\n const existing = this.inFlightLoads.get(key);\n if (existing) return existing;\n if (this.cachedAssets.has(key)) return;\n\n const job = this.runLoad(key, value);\n this.inFlightLoads.set(key, job);\n try {\n await job;\n } finally {\n this.inFlightLoads.delete(key);\n }\n }\n\n private async runLoad(key: string, value: AssetRecord): Promise<void> {\n let loaded = true;\n switch (value.type) {\n case 'image':\n await this.loadImage(key);\n break;\n case 'video':\n await this.loadVideo(key, value.startFrame, value.endFrame, value.trimStart, value.trimEnd);\n break;\n case 'font': {\n const { fontFamily, fontWeight } = this.parseFontKey(key);\n loaded = await this.loadFont(key, fontFamily, fontWeight);\n if (!loaded && this.getDecodePolicy() === \"exact\") {\n throw new AssetNotLoadedError(\n \"font\",\n fontFamily,\n `The manifest has no font entry for \"${fontFamily}\", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`,\n );\n }\n break;\n }\n case 'audio':\n // Audio files are loaded on-demand via fetchAudioData / syncAudio, not through loadAsset.\n break;\n case 'loader':\n // Loaders are opaque callbacks run directly by the AssetManager and\n // never dispatched through the storage adapter.\n throw new Error(\"Loader records must not be routed through StorageAdapter.loadAsset\");\n default: {\n const _exhaustive: never = value;\n throw new Error(`Unsupported asset type: ${(_exhaustive as AssetRecord).type}`);\n }\n }\n\n // Only a load that actually happened is cached. This matters for exactly\n // one case: a font family the manifest cannot describe. Caching it anyway\n // marked the family handled for the life of this adapter, so a manifest\n // that *later* described it — which is what installing a typeface does,\n // folded into the live manifest without rebuilding the controller — could\n // never load it, and the text stayed in the fallback face until something\n // else tore the adapter down.\n if (loaded) this.cachedAssets.add(key);\n }\n\n // ─── Font key parsing ─────────────────────────────────────────────────────\n\n protected parseFontKey(key: string): { fontFamily: string; fontWeight: number } {\n const [fontFamily, weightStr] = key.split('@');\n const fontWeight = weightStr ? parseInt(weightStr, 10) : 400;\n return {\n fontFamily: fontFamily || key,\n fontWeight: isNaN(fontWeight) ? 400 : fontWeight,\n };\n }\n\n // ─── Abstract load methods ────────────────────────────────────────────────\n\n /** Decode resolution follows the draw, so a load names only the source. */\n abstract loadImage(src: string): Promise<void>;\n abstract loadVideo(\n src: string,\n startFrame: number,\n endFrame: number,\n trimStart: number,\n trimEnd?: number,\n ): Promise<void>;\n abstract loadAudio(\n src: string,\n startFrame: number,\n endFrame: number,\n trimStart: number,\n trimEnd?: number,\n ): Promise<void>;\n abstract fetchAudioData(src: string): Promise<ArrayBuffer>;\n /**\n * Register every face of `fontFamily` the catalog describes.\n *\n * Returns whether the family was actually loaded. `false` means the manifest\n * has no entry for it. Not an error while previewing (an undescribed family\n * shapes against the platform fallback, which is what a system font name\n * does), but a blocking caller refuses it — see {@link DecodePolicy} — and\n * it must not be remembered as handled either way: see the note in\n * {@link runLoad}.\n */\n abstract loadFont(src: string, fontFamily: string, fontWeight: number): Promise<boolean>;\n\n // ─── Frame warming ────────────────────────────────────────────────────────\n\n /**\n * Decode any exact media frames the most recent render asked for but couldn't\n * satisfy synchronously (e.g. a video frame at a freshly-seeked timestamp),\n * and report whether there were any. A blocking caller (seek / screenshot /\n * export) renders once, awaits this, and re-renders while it returns true so\n * the frame is accurate even on a cold jump. Defaults to a no-op for adapters\n * with no time-varying media.\n */\n async warmPendingVideo(): Promise<boolean> {\n return false;\n }\n\n setDecodePolicy(policy: DecodePolicy): void {\n // no-op for adapters that decode at one resolution\n }\n\n /** Read back so a caller that borrows the adapter can restore it. */\n getDecodePolicy(): DecodePolicy {\n return \"interactive\";\n }\n\n /** Whether the most recent render left decodes that {@link warmPendingDecodes} would settle. */\n hasPendingDecodes(): boolean {\n return false;\n }\n\n /**\n * Settle what the last render could not draw acceptably under the current\n * policy — video frames, every exact image level under `\"exact\"`, a source\n * drawn with nothing resident under `\"interactive\"` — and report whether there\n * was any. See `renderSettled`.\n *\n * Defaults to {@link warmPendingVideo} so an adapter written against it keeps\n * working; that alias goes away after one release.\n */\n async warmPendingDecodes(): Promise<boolean> {\n return this.warmPendingVideo();\n }\n\n /**\n * Whether an `\"interactive\"` decode is on its way that would draw the last\n * render sharper. Not something a paint waits for: a preview shows what is\n * resident and repaints when {@link warmPendingUpgrades} reports a landing.\n */\n hasPendingUpgrades(): boolean {\n return false;\n }\n\n /** Await the upgrades {@link hasPendingUpgrades} reports; whether one landed. */\n async warmPendingUpgrades(): Promise<boolean> {\n return false;\n }\n\n /**\n * Notify the adapter whether playback is live. Time-varying media (video) uses\n * this to prefetch ahead only while playing and to quiesce on pause, so a\n * paused timeline doesn't drain a backlog of stale decodes. No-op by default.\n */\n setPlaying(playing: boolean): void {\n // no-op for adapters with no time-varying media\n }\n\n // ─── Lifecycle ────────────────────────────────────────────────────────────\n\n dispose(): void {\n this.inFlightLoads.clear();\n this.cachedAssets.clear();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticker.js","sourceRoot":"","sources":["../../src/platform/ticker.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,MAAM;IAChB,UAAU,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,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,cAAc;YAAE,EAAE,EAAE,CAAC;IAC/C,CAAC;IAKS,aAAa,GAAmB,EAAE,CAAC;IACnC,aAAa,GAAmB,EAAE,CAAC;IACnC,cAAc,GAAmB,EAAE,CAAC;IACpC,aAAa,GAAmB,EAAE,CAAC;IAE7C,6FAA6F;IAC7F,OAAO;QACH,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,QAAoB;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACJ","sourcesContent":["/** Called every animation frame with the current playhead time (seconds). Must return a Promise so the clock can await all renderers before advancing. */\
|
|
1
|
+
{"version":3,"file":"ticker.js","sourceRoot":"","sources":["../../src/platform/ticker.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,MAAM;IAChB,UAAU,GAAY,KAAK,CAAC;IAC5B,YAAY,GAAW,CAAC,CAAC;IACvB,SAAS,GAAW,CAAC,CAAC;IAEhC,IAAI,SAAS;QACT,OAAO,IAAI,CA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AKS,aAAa,GAAmB,EAAE,CAAC;IACnC,aAAa,GAAmB,EAAE,CAAC;IACnC,cAAc,GAAmB,EAAE,CAAC;IACpC,aAAa,GAAmB,EAAE,CAAC;IAE7C,6FAA6F;IAC7F,OAAO;QACH,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,QAAoB;QACxB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,QAAsB;QACzB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACJ","sourcesContent":["/** Called every animation frame with the current playhead time (seconds). Must return a Promise so the clock can await all renderers before advancing. */\nexport type TickCallback = (time: number) => Promise<void>;\n\n/** Fired when playback starts. Receives the time at which playback began, the playback speed multiplier, and whether playback is reversed. */\nexport type PlayCallback = (time: number, speed: number, reverse: boolean) => void;\n\n/**\n * Fired when the playhead reaches a new frame.\n *\n * Once per frame, not once per animation frame — see\n * {@link Ticker.setCurrentTime}. A subclass advancing its clock faster than\n * the project's frame rate (which every rAF-driven one does on a high-refresh\n * display) keeps the extra positions to itself.\n */\nexport type TimeCallback = (time: number) => void;\n\n/**\n * Platform-agnostic base class for driving animation playback.\n *\n * Subclasses implement the actual frame loop (e.g. requestAnimationFrame in the\n * browser, a setInterval loop in Node) and call `setCurrentTime` / `tick` each\n * frame. `Ticker` owns the subscriber lists and the shared playback state\n * so that renderers and UI controls can coordinate without knowing about each\n * other.\n *\n * Lifecycle:\n * 1. Set total duration with `setDuration`.\n * 2. Register listeners via `onTick` / `onPlay` / `onPause` / `onTime`.\n * 3. Call `play`, `pause`, or `seek` to control playback.\n * 4. Call `dispose` when the clock is no longer needed to prevent leaks.\n *\n * `play`, `pause` and `seek` take effect before they return, so any order of them\n * in one turn leaves the clock where the last one put it. A time listener or tick\n * callback may `seek` (a host looping wraps to the start when it hears the end), and\n * a subclass must read the end of a run again afterwards. At the end of a run it\n * reports a final tick and pauses.\n */\nexport abstract class Ticker {\n private _isPlaying: boolean = false;\n private _currentTime: number = 0;\n protected _duration: number = 0;\n\n get isPlaying(): boolean {\n return this._isPlaying;\n }\n\n /** Current playhead position in seconds. */\n get currentTime(): number {\n return this._currentTime;\n }\n\n /** Total animation duration in seconds. */\n get duration(): number {\n return this._duration;\n }\n\n setDuration(duration: number): void {\n this._duration = duration;\n }\n\n /**\n * Updates the playhead and notifies time listeners. No-ops if the time hasn't\n * changed.\n *\n * `notify` exists because the two halves of that sentence want different\n * rates. The playhead itself has to be exact — `pause` and `play` anchor\n * their elapsed-time maths on it, so it is advanced on every frame of the\n * subclass's loop — while a *listener* is a host drawing a timecode or\n * seeking a renderer, and neither can do anything with a position that has\n * not reached the next frame yet.\n *\n * Passing `false` therefore keeps the clock exact and the subscribers quiet.\n * A subclass that knows its frame rate uses it to fire {@link onTime} once\n * per frame rather than once per animation frame; on a 144Hz display those\n * are not the same number, and the difference was landing on hosts as a React\n * render per refresh to drive a 60fps render.\n */\n protected setCurrentTime(t: number, notify: boolean = true): void {\n if (this._currentTime === t) return;\n this._currentTime = t;\n if (!notify) return;\n for (const cb of this.timeCallbacks) cb(t);\n }\n\n protected setPlaying(playing: boolean): void {\n this._isPlaying = playing;\n }\n\n /** Starts playback at the given speed and direction, notifying all play listeners. */\n play(speed: number, reverse: boolean): void {\n this._isPlaying = true;\n for (const cb of this.playCallbacks) cb(this._currentTime, speed, reverse);\n }\n\n /** Awaits all tick callbacks in parallel. Subclasses call this once per frame after updating `currentTime`. */\n protected async tick(): Promise<void> {\n await Promise.all(this.tickCallbacks.map(c => c(this._currentTime)));\n }\n\n /** Pauses playback and notifies all pause listeners. */\n pause(): void {\n this._isPlaying = false;\n for (const cb of this.pauseCallbacks) cb();\n }\n\n /** Moves the playhead to `t` (seconds). Subclasses decide whether this also triggers a tick. */\n abstract seek(t: number): void;\n\n protected tickCallbacks: TickCallback[] = [];\n protected playCallbacks: PlayCallback[] = [];\n protected pauseCallbacks: (() => void)[] = [];\n protected timeCallbacks: TimeCallback[] = [];\n\n /** Clears all registered callbacks. Call when tearing down a scene to avoid memory leaks. */\n dispose() {\n this.tickCallbacks.length = 0;\n this.playCallbacks.length = 0;\n this.pauseCallbacks.length = 0;\n this.timeCallbacks.length = 0;\n }\n\n onTick(callback: TickCallback) {\n this.tickCallbacks.push(callback);\n }\n\n onPlay(callback: PlayCallback) {\n this.playCallbacks.push(callback);\n }\n\n onPause(callback: () => void) {\n this.pauseCallbacks.push(callback);\n }\n\n onTime(callback: TimeCallback) {\n this.timeCallbacks.push(callback);\n }\n}\n"]}
|