@motionscript/core 0.1.0-alpha.6 → 0.1.0-alpha.7
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 +28 -0
- package/README.md +2 -4
- package/dist/assets/errors.js +4 -5
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/scope.d.ts +1 -1
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +3 -18
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/index.d.ts +3 -5
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +2 -2
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +1 -1
- package/dist/attributes/layout/size.js +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +44 -11
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +37 -9
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.d.ts +1 -1
- package/dist/attributes/properties/inputs.js +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +19 -140
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +12 -108
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
- package/dist/attributes/shape/fill/color/parser.js +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -1
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +4 -3
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +1 -2
- package/dist/attributes/shape/path/ops.d.ts.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shared/operators.d.ts +2 -2
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/types.d.ts +2 -3
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-D4FSTPML.js +14 -0
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +7 -0
- package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
- package/dist/browser/chunks/{chunk-DHB4COFY.js.map → chunk-LKUYVFU3.js.map} +4 -4
- package/dist/browser/chunks/chunk-RTNATFWX.js +5 -0
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +7 -0
- package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +2 -4
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +10 -18
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +10 -17
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.d.ts +53 -0
- package/dist/components/builtins/audio/audio.d.ts.map +1 -0
- package/dist/components/builtins/audio/audio.js +41 -0
- package/dist/components/builtins/audio/audio.js.map +1 -0
- package/dist/components/builtins/geometry/composite.d.ts +93 -0
- package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
- package/dist/components/builtins/geometry/composite.js +25 -0
- package/dist/components/builtins/geometry/composite.js.map +1 -0
- package/dist/components/builtins/geometry/geometry.d.ts +921 -0
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
- package/dist/components/builtins/geometry/geometry.js +107 -0
- package/dist/components/builtins/geometry/geometry.js.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.js +470 -0
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
- package/dist/components/builtins/layout/layout.d.ts +186 -0
- package/dist/components/builtins/layout/layout.d.ts.map +1 -0
- package/dist/components/builtins/layout/layout.js +84 -0
- package/dist/components/builtins/layout/layout.js.map +1 -0
- package/dist/components/builtins/media/media.d.ts +240 -0
- package/dist/components/builtins/media/media.d.ts.map +1 -0
- package/dist/components/builtins/media/media.js +149 -0
- package/dist/components/builtins/media/media.js.map +1 -0
- package/dist/components/builtins/providers/providers.d.ts +47 -0
- package/dist/components/builtins/providers/providers.d.ts.map +1 -0
- package/dist/components/builtins/providers/providers.js +30 -0
- package/dist/components/builtins/providers/providers.js.map +1 -0
- package/dist/components/builtins/text/number-format.d.ts +66 -0
- package/dist/components/builtins/text/number-format.d.ts.map +1 -0
- package/dist/components/builtins/text/number-format.js +227 -0
- package/dist/components/builtins/text/number-format.js.map +1 -0
- package/dist/components/builtins/text/number-pattern.d.ts +51 -0
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
- package/dist/components/builtins/text/number-pattern.js +77 -0
- package/dist/components/builtins/text/number-pattern.js.map +1 -0
- package/dist/components/builtins/text/text-defaults.d.ts +32 -0
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
- package/dist/components/builtins/text/text-defaults.js +37 -0
- package/dist/components/builtins/text/text-defaults.js.map +1 -0
- package/dist/components/builtins/text/text-layout.d.ts +82 -0
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
- package/dist/components/builtins/text/text-layout.js +331 -0
- package/dist/components/builtins/text/text-layout.js.map +1 -0
- package/dist/components/builtins/text/text.d.ts +409 -0
- package/dist/components/builtins/text/text.d.ts.map +1 -0
- package/dist/components/builtins/text/text.js +113 -0
- package/dist/components/builtins/text/text.js.map +1 -0
- package/dist/components/builtins/three/canvas3d.d.ts +245 -0
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
- package/dist/components/builtins/three/canvas3d.js +21 -0
- package/dist/components/builtins/three/canvas3d.js.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.js +114 -0
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
- package/dist/components/builtins/three/three.d.ts +1889 -0
- package/dist/components/builtins/three/three.d.ts.map +1 -0
- package/dist/components/builtins/three/three.js +305 -0
- package/dist/components/builtins/three/three.js.map +1 -0
- package/dist/components/factory/api.d.ts +516 -0
- package/dist/components/factory/api.d.ts.map +1 -0
- package/dist/components/factory/api.js +4 -0
- package/dist/components/factory/api.js.map +1 -0
- package/dist/components/factory/clip-of.d.ts +5 -0
- package/dist/components/factory/clip-of.d.ts.map +1 -0
- package/dist/components/factory/clip-of.js +33 -0
- package/dist/components/factory/clip-of.js.map +1 -0
- package/dist/components/factory/commands-for.d.ts +19 -0
- package/dist/components/factory/commands-for.d.ts.map +1 -0
- package/dist/components/factory/commands-for.js +5 -0
- package/dist/components/factory/commands-for.js.map +1 -0
- package/dist/components/factory/component-audio.d.ts +9 -0
- package/dist/components/factory/component-audio.d.ts.map +1 -0
- package/dist/components/factory/component-audio.js +18 -0
- package/dist/components/factory/component-audio.js.map +1 -0
- package/dist/components/factory/component2d.d.ts +8 -0
- package/dist/components/factory/component2d.d.ts.map +1 -0
- package/dist/components/factory/component2d.js +240 -0
- package/dist/components/factory/component2d.js.map +1 -0
- package/dist/components/factory/component3d.d.ts +9 -0
- package/dist/components/factory/component3d.d.ts.map +1 -0
- package/dist/components/factory/component3d.js +99 -0
- package/dist/components/factory/component3d.js.map +1 -0
- package/dist/components/factory/factory.d.ts +63 -0
- package/dist/components/factory/factory.d.ts.map +1 -0
- package/dist/components/factory/factory.js +313 -0
- package/dist/components/factory/factory.js.map +1 -0
- package/dist/components/factory/timeline.d.ts +22 -0
- package/dist/components/factory/timeline.d.ts.map +1 -0
- package/dist/components/factory/timeline.js +128 -0
- package/dist/components/factory/timeline.js.map +1 -0
- package/dist/components/factory/type-def.d.ts +26 -0
- package/dist/components/factory/type-def.d.ts.map +1 -0
- package/dist/components/factory/type-def.js +16 -0
- package/dist/components/factory/type-def.js.map +1 -0
- package/dist/components/factory/types.d.ts +91 -0
- package/dist/components/factory/types.d.ts.map +1 -0
- package/dist/components/factory/types.js +88 -0
- package/dist/components/factory/types.js.map +1 -0
- package/dist/components/factory/views.d.ts +121 -0
- package/dist/components/factory/views.d.ts.map +1 -0
- package/dist/components/factory/views.js +413 -0
- package/dist/components/factory/views.js.map +1 -0
- package/dist/components/modules/aim.d.ts +30 -0
- package/dist/components/modules/aim.d.ts.map +1 -0
- package/dist/components/modules/aim.js +39 -0
- package/dist/components/modules/aim.js.map +1 -0
- package/dist/components/modules/corners.d.ts +13 -0
- package/dist/components/modules/corners.d.ts.map +1 -0
- package/dist/components/modules/corners.js +12 -0
- package/dist/components/modules/corners.js.map +1 -0
- package/dist/components/modules/flow.d.ts +26 -0
- package/dist/components/modules/flow.d.ts.map +1 -0
- package/dist/components/modules/flow.js +57 -0
- package/dist/components/modules/flow.js.map +1 -0
- package/dist/components/modules/material.d.ts +40 -0
- package/dist/components/modules/material.d.ts.map +1 -0
- package/dist/components/modules/material.js +75 -0
- package/dist/components/modules/material.js.map +1 -0
- package/dist/components/modules/paint.d.ts +71 -0
- package/dist/components/modules/paint.d.ts.map +1 -0
- package/dist/components/modules/paint.js +106 -0
- package/dist/components/modules/paint.js.map +1 -0
- package/dist/components/modules/shapes.d.ts +31 -0
- package/dist/components/modules/shapes.d.ts.map +1 -0
- package/dist/components/modules/shapes.js +43 -0
- package/dist/components/modules/shapes.js.map +1 -0
- package/dist/components/modules/text-layout.d.ts +26 -0
- package/dist/components/modules/text-layout.d.ts.map +1 -0
- package/dist/components/modules/text-layout.js +57 -0
- package/dist/components/modules/text-layout.js.map +1 -0
- package/dist/components/modules/text-style.d.ts +48 -0
- package/dist/components/modules/text-style.d.ts.map +1 -0
- package/dist/components/modules/text-style.js +63 -0
- package/dist/components/modules/text-style.js.map +1 -0
- package/dist/components/modules/three-entries.d.ts +23 -0
- package/dist/components/modules/three-entries.d.ts.map +1 -0
- package/dist/components/modules/three-entries.js +41 -0
- package/dist/components/modules/three-entries.js.map +1 -0
- package/dist/components/modules/view3d.d.ts +59 -0
- package/dist/components/modules/view3d.d.ts.map +1 -0
- package/dist/components/modules/view3d.js +171 -0
- package/dist/components/modules/view3d.js.map +1 -0
- package/dist/components/trees/2d/group-bounds.d.ts +56 -0
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
- package/dist/components/trees/2d/group-bounds.js +87 -0
- package/dist/components/trees/2d/group-bounds.js.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.js +264 -0
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
- package/dist/components/trees/2d/node-motion.d.ts +56 -0
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
- package/dist/components/trees/2d/node-motion.js +86 -0
- package/dist/components/trees/2d/node-motion.js.map +1 -0
- package/dist/components/trees/2d/node-render.d.ts +36 -0
- package/dist/components/trees/2d/node-render.d.ts.map +1 -0
- package/dist/components/trees/2d/node-render.js +67 -0
- package/dist/components/trees/2d/node-render.js.map +1 -0
- package/dist/components/trees/2d/node-space.d.ts +63 -0
- package/dist/components/trees/2d/node-space.d.ts.map +1 -0
- package/dist/components/trees/2d/node-space.js +131 -0
- package/dist/components/trees/2d/node-space.js.map +1 -0
- package/dist/components/trees/2d/node-transform.d.ts +55 -0
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
- package/dist/components/trees/2d/node-transform.js +73 -0
- package/dist/components/trees/2d/node-transform.js.map +1 -0
- package/dist/components/trees/2d/node2d.d.ts +1020 -0
- package/dist/components/trees/2d/node2d.d.ts.map +1 -0
- package/dist/components/trees/2d/node2d.js +1481 -0
- package/dist/components/trees/2d/node2d.js.map +1 -0
- package/dist/components/trees/audio/index.d.ts +2 -0
- package/dist/components/trees/audio/index.d.ts.map +1 -0
- package/dist/components/trees/audio/index.js +2 -0
- package/dist/components/trees/audio/index.js.map +1 -0
- package/dist/components/trees/audio/node-audio.d.ts +109 -0
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
- package/dist/components/trees/audio/node-audio.js +167 -0
- package/dist/components/trees/audio/node-audio.js.map +1 -0
- package/dist/components/trees/index.d.ts +10 -0
- package/dist/components/trees/index.d.ts.map +1 -0
- package/dist/components/trees/index.js +14 -0
- package/dist/components/trees/index.js.map +1 -0
- package/dist/components/trees/node/node-editor-state.d.ts +53 -0
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
- package/dist/components/trees/node/node-editor-state.js +23 -0
- package/dist/components/trees/node/node-editor-state.js.map +1 -0
- package/dist/components/trees/node/node-reactive.d.ts +89 -0
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
- package/dist/components/trees/node/node-reactive.js +135 -0
- package/dist/components/trees/node/node-reactive.js.map +1 -0
- package/dist/components/trees/node/node-time.d.ts +39 -0
- package/dist/components/trees/node/node-time.d.ts.map +1 -0
- package/dist/components/trees/node/node-time.js +14 -0
- package/dist/components/trees/node/node-time.js.map +1 -0
- package/dist/components/trees/node/node-walk.d.ts +46 -0
- package/dist/components/trees/node/node-walk.d.ts.map +1 -0
- package/dist/components/trees/node/node-walk.js +74 -0
- package/dist/components/trees/node/node-walk.js.map +1 -0
- package/dist/components/trees/node/node.d.ts +401 -0
- package/dist/components/trees/node/node.d.ts.map +1 -0
- package/dist/components/trees/node/node.js +680 -0
- package/dist/components/trees/node/node.js.map +1 -0
- package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
- package/dist/components/trees/root/canvas2d-node.js +216 -0
- package/dist/components/trees/root/canvas2d-node.js.map +1 -0
- package/dist/components/trees/three/node3d.d.ts +222 -0
- package/dist/components/trees/three/node3d.d.ts.map +1 -0
- package/dist/components/trees/three/node3d.js +289 -0
- package/dist/components/trees/three/node3d.js.map +1 -0
- package/dist/document/builtins.js +13 -13
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +2 -2
- package/dist/document/command-traits.js +1 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +2 -2
- package/dist/document/deny-globals.js +2 -2
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/expression/index.d.ts +1 -1
- package/dist/document/expression/index.js +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/index.d.ts +1 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +1 -2
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.d.ts +14 -10
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +14 -10
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +3 -3
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/registry.d.ts +23 -25
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +12 -18
- package/dist/document/registry.js.map +1 -1
- package/dist/document/timeline.d.ts +3 -3
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +2 -2
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +4 -4
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +1 -1
- package/dist/document/validate.js.map +1 -1
- package/dist/experimental.d.ts +19 -19
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +17 -17
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/layout/types.d.ts +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/props/host.d.ts +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/slot.d.ts +1 -1
- package/dist/props/slot.js +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/render/clip.d.ts +1 -1
- package/dist/render/clip.js +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +11 -5
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +7 -1
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render3d/builders.d.ts +1 -1
- package/dist/render3d/builders.js +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +13 -19
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +13 -19
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +1 -1
- package/dist/render3d/scene3d.js +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/texture.d.ts +2 -2
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/vector3.d.ts +2 -2
- package/dist/render3d/vector3.js +2 -2
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +1 -1
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-update.js +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -11
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -25
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +3 -3
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +4 -4
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +2 -3
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +17 -35
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +3 -3
- package/dist/runtime/engine.js +2 -2
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +2 -2
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +3 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -2
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +2 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +1 -1
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +2 -2
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +4 -5
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +43 -39
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +24 -25
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +7 -9
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +2 -2
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/index.d.ts +2 -1
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/loop.d.ts +1 -1
- package/dist/tween/loop.js +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/util/reference.d.ts +6 -6
- package/dist/util/reference.js.map +1 -1
- package/package.json +2 -10
- package/dist/browser/chunks/chunk-2RIYH36X.js +0 -3
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +0 -7
- package/dist/browser/chunks/chunk-DDJN3QII.js +0 -15
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +0 -7
- package/dist/browser/chunks/chunk-DHB4COFY.js +0 -2
- package/dist/browser/chunks/chunk-EJDPYDQI.js +0 -5
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +0 -7
- package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
- package/dist/browser/chunks/chunk-XAWE4EAK.js +0 -2
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +0 -7
- package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
- package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
- package/dist/browser/jsx-jsx-runtime.js +0 -2
- package/dist/browser/jsx-jsx-runtime.js.map +0 -7
package/dist/experimental.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The component factories
|
|
3
|
-
*
|
|
2
|
+
* The component factories and their modules: the same names the sdk exports,
|
|
3
|
+
* for code that wants only the authoring surface.
|
|
4
4
|
*/
|
|
5
|
-
export { component2d } from "./
|
|
6
|
-
export { componentAudio } from "./
|
|
7
|
-
export { component3d } from "./
|
|
8
|
-
export { commandsFor } from "./
|
|
9
|
-
export { Types } from "./
|
|
10
|
-
export { provides } from "./
|
|
11
|
-
export * as Paint from "./
|
|
12
|
-
export * as Flow from "./
|
|
13
|
-
export * as Corners from "./
|
|
14
|
-
export * as Shapes from "./
|
|
15
|
-
export * as Aim from "./
|
|
16
|
-
export * as TextStyle from "./
|
|
17
|
-
export * as TextLayout from "./
|
|
18
|
-
export * as Material from "./
|
|
19
|
-
export * as View3D from "./
|
|
5
|
+
export { component2d } from "./components/factory/component2d.js";
|
|
6
|
+
export { componentAudio } from "./components/factory/component-audio.js";
|
|
7
|
+
export { component3d } from "./components/factory/component3d.js";
|
|
8
|
+
export { commandsFor } from "./components/factory/commands-for.js";
|
|
9
|
+
export { Types } from "./components/factory/types.js";
|
|
10
|
+
export { provides } from "./components/factory/api.js";
|
|
11
|
+
export * as Paint from "./components/modules/paint.js";
|
|
12
|
+
export * as Flow from "./components/modules/flow.js";
|
|
13
|
+
export * as Corners from "./components/modules/corners.js";
|
|
14
|
+
export * as Shapes from "./components/modules/shapes.js";
|
|
15
|
+
export * as Aim from "./components/modules/aim.js";
|
|
16
|
+
export * as TextStyle from "./components/modules/text-style.js";
|
|
17
|
+
export * as TextLayout from "./components/modules/text-layout.js";
|
|
18
|
+
export * as Material from "./components/modules/material.js";
|
|
19
|
+
export * as View3D from "./components/modules/view3d.js";
|
|
20
20
|
//# sourceMappingURL=experimental.js.map
|
package/dist/experimental.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"experimental.js","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOpD,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,2BAA2B,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":["/**\r\n * The component factories and their modules: the same names the sdk exports,\r\n * for code that wants only the authoring surface.\r\n */\r\nexport { component2d } from \"@/components/factory/component2d\";\r\nexport { componentAudio } from \"@/components/factory/component-audio\";\r\nexport { component3d } from \"@/components/factory/component3d\";\r\nexport { commandsFor } from \"@/components/factory/commands-for\";\r\nexport { Types } from \"@/components/factory/types\";\r\nexport { provides } from \"@/components/factory/api\";\r\nexport type { Attribute, EntryOptions, NumberOptions, TextOptions } from \"@/components/factory/types\";\r\nexport type {\r\n Box2DState, BoxAudioState, CallProps, ChildView, Children2D, Component, Element, Entry, InOf, Inputs, Loader,\r\n Measurer, MergePaint, NodeOf, NodeView, OutOf, Piece, Placement2D, Provided, RenderContext2D, SoundOptions, StateSpec,\r\n Timeline, Type, Values, Writes, Merge, BuiltNode, CallProps3D, Placement3DProps, RenderContext3D, Transform3DState, Handle, LayoutBox, NodeFrame,\r\n} from \"@/components/factory/api\";\r\nexport * as Paint from \"@/components/modules/paint\";\r\nexport * as Flow from \"@/components/modules/flow\";\r\nexport * as Corners from \"@/components/modules/corners\";\r\nexport * as Shapes from \"@/components/modules/shapes\";\r\nexport * as Aim from \"@/components/modules/aim\";\r\nexport * as TextStyle from \"@/components/modules/text-style\";\r\nexport * as TextLayout from \"@/components/modules/text-layout\";\r\nexport * as Material from \"@/components/modules/material\";\r\nexport * as View3D from \"@/components/modules/view3d\";\r\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * from './attributes/index.js';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
2
|
+
export * from './components/trees/index.js';
|
|
3
|
+
export * from './components/builtins/geometry/geometry.js';
|
|
4
|
+
export * from './components/builtins/geometry/composite.js';
|
|
5
|
+
export * from './components/builtins/layout/layout.js';
|
|
6
|
+
export * from './components/builtins/text/text.js';
|
|
7
|
+
export * from './components/builtins/providers/providers.js';
|
|
8
|
+
export * from './components/builtins/audio/audio.js';
|
|
9
|
+
export * from './components/builtins/media/media.js';
|
|
10
|
+
export * from './components/builtins/three/three.js';
|
|
11
|
+
export * from './components/builtins/three/canvas3d.js';
|
|
12
12
|
export * from './project/index.js';
|
|
13
13
|
export * from './document/index.js';
|
|
14
14
|
export * from './render/index.js';
|
|
@@ -20,6 +20,5 @@ export * from './util/index.js';
|
|
|
20
20
|
export * from './tween/index.js';
|
|
21
21
|
export * from './props/index.js';
|
|
22
22
|
export * from './layout/index.js';
|
|
23
|
-
export * from './jsx/jsx-runtime.js';
|
|
24
23
|
export * from './renamed-scene-names.js';
|
|
25
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","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"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export * from './attributes/index.js';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
2
|
+
export * from './components/trees/index.js';
|
|
3
|
+
export * from './components/builtins/geometry/geometry.js';
|
|
4
|
+
export * from './components/builtins/geometry/composite.js';
|
|
5
|
+
export * from './components/builtins/layout/layout.js';
|
|
6
|
+
export * from './components/builtins/text/text.js';
|
|
7
|
+
export * from './components/builtins/providers/providers.js';
|
|
8
|
+
export * from './components/builtins/audio/audio.js';
|
|
9
|
+
export * from './components/builtins/media/media.js';
|
|
10
|
+
export * from './components/builtins/three/three.js';
|
|
11
|
+
export * from './components/builtins/three/canvas3d.js';
|
|
12
12
|
export * from './project/index.js';
|
|
13
13
|
export * from './document/index.js';
|
|
14
14
|
export * from './render/index.js';
|
|
@@ -20,6 +20,5 @@ export * from './util/index.js';
|
|
|
20
20
|
export * from './tween/index.js';
|
|
21
21
|
export * from './props/index.js';
|
|
22
22
|
export * from './layout/index.js';
|
|
23
|
-
export * from './jsx/jsx-runtime.js';
|
|
24
23
|
export * from './renamed-scene-names.js';
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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';\r\nexport * from './components/trees';\r\nexport * from './components/builtins/geometry/geometry';\r\nexport * from './components/builtins/geometry/composite';\r\nexport * from './components/builtins/layout/layout';\r\nexport * from './components/builtins/text/text';\r\nexport * from './components/builtins/providers/providers';\r\nexport * from './components/builtins/audio/audio';\r\nexport * from './components/builtins/media/media';\r\nexport * from './components/builtins/three/three';\r\nexport * from './components/builtins/three/canvas3d';\r\nexport * from './project';\r\nexport * from './document';\r\nexport * from './render';\r\nexport * from './render3d';\r\nexport * from './runtime';\r\nexport * from './platform';\r\nexport * from './assets';\r\nexport * from './util'\r\nexport * from './tween';\r\nexport * from './props';\r\nexport * from './layout';\r\n\r\nexport * from './renamed-scene-names';\r\n"]}
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface FlowProps {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* What `flowOps` arranges by: the {@link FlowProps} vocabulary, every field
|
|
66
|
-
* optional and defaulting as the prop does. A
|
|
66
|
+
* optional and defaulting as the prop does. A shape's state or a `Canvas2D` is one
|
|
67
67
|
* as it stands.
|
|
68
68
|
*/
|
|
69
69
|
export interface FlowSettings {
|
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\";\r\nimport type { Insets } from \"@/attributes/layout/insets\";\r\nimport type { Size2D, SizeInput } 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\n\r\n/**\r\n * How a container arranges the items that take part in its layout:\r\n *\r\n * - `'freeform'` — items overlap, each aligned in the padded content box by\r\n * `align` and offset from there by its own `x`/`y`.\r\n * - `'horizontal'` — a run left-to-right.\r\n * - `'vertical'` — a run top-to-bottom.\r\n * - `'grid'` — N equal columns, rows sized to their content (or divided equally\r\n * when the container's height is bounded). Items place themselves with\r\n * `column`/`row` and span with `colSpan`/`rowSpan`; anything unplaced is\r\n * auto-flowed left-to-right.\r\n *\r\n * A run also answers `wrap` — \"and break onto a new line when you run out of\r\n * room\" — which is a property of the run rather than a fourth direction.\r\n */\r\nexport type FlowMode = \"horizontal\" | \"vertical\" | \"freeform\" | \"grid\";\r\n\r\n/** Spacing between items, or `\"auto\"` to spread the free space evenly between them. */\r\nexport type GapSize = number | \"auto\";\r\n\r\n/**\r\n * What a `flow` prop holds: a mode, or — mid-tween between two — both and how far\r\n * along. The blend lives in the value so that restoring the prop restores it.\r\n */\r\nexport type FlowResolved = FlowMode | { from: FlowMode; to: FlowMode; t: number };\r\n\r\n/** A container's author-facing layout props. */\r\nexport interface FlowProps {\r\n /**\r\n * Layout mode for children: a run (`horizontal` / `vertical`), overlapping\r\n * `freeform`, or a `grid` of N equal columns.\r\n */\r\n flow: FlowMode;\r\n /** Spacing between children along the layout's main axis. */\r\n gap: GapSize;\r\n /**\r\n * Break a `horizontal`/`vertical` run onto new lines once it runs out of\r\n * main-axis room. It needs a bounded main axis to break against, so an axis\r\n * set to `'hug'` stays one line.\r\n */\r\n wrap: boolean;\r\n /**\r\n * Spacing on the **cross** axis: between wrapped lines, and between a grid's\r\n * rows. Omitted, it follows `gap` — \"wrap this row\" almost never means \"and\r\n * stack the lines flush against each other\".\r\n */\r\n crossGap: number;\r\n /** Number of equal columns when `flow` is `'grid'`. At least 1. */\r\n columns: number;\r\n /**\r\n * Where children sit in the content box: a named position (`'center'`,\r\n * `'topLeft'`, …) or a per-axis `Vector2` (x: -1 left … +1 right, y: -1\r\n * bottom … +1 top).\r\n */\r\n align: Alignment;\r\n}\r\n\r\n/**\r\n * What `flowOps` arranges by: the {@link FlowProps} vocabulary, every field\r\n * optional and defaulting as the prop does. A
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/layout/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { Insets } from \"@/attributes/layout/insets\";\r\nimport type { Size2D, SizeInput } 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\n\r\n/**\r\n * How a container arranges the items that take part in its layout:\r\n *\r\n * - `'freeform'` — items overlap, each aligned in the padded content box by\r\n * `align` and offset from there by its own `x`/`y`.\r\n * - `'horizontal'` — a run left-to-right.\r\n * - `'vertical'` — a run top-to-bottom.\r\n * - `'grid'` — N equal columns, rows sized to their content (or divided equally\r\n * when the container's height is bounded). Items place themselves with\r\n * `column`/`row` and span with `colSpan`/`rowSpan`; anything unplaced is\r\n * auto-flowed left-to-right.\r\n *\r\n * A run also answers `wrap` — \"and break onto a new line when you run out of\r\n * room\" — which is a property of the run rather than a fourth direction.\r\n */\r\nexport type FlowMode = \"horizontal\" | \"vertical\" | \"freeform\" | \"grid\";\r\n\r\n/** Spacing between items, or `\"auto\"` to spread the free space evenly between them. */\r\nexport type GapSize = number | \"auto\";\r\n\r\n/**\r\n * What a `flow` prop holds: a mode, or — mid-tween between two — both and how far\r\n * along. The blend lives in the value so that restoring the prop restores it.\r\n */\r\nexport type FlowResolved = FlowMode | { from: FlowMode; to: FlowMode; t: number };\r\n\r\n/** A container's author-facing layout props. */\r\nexport interface FlowProps {\r\n /**\r\n * Layout mode for children: a run (`horizontal` / `vertical`), overlapping\r\n * `freeform`, or a `grid` of N equal columns.\r\n */\r\n flow: FlowMode;\r\n /** Spacing between children along the layout's main axis. */\r\n gap: GapSize;\r\n /**\r\n * Break a `horizontal`/`vertical` run onto new lines once it runs out of\r\n * main-axis room. It needs a bounded main axis to break against, so an axis\r\n * set to `'hug'` stays one line.\r\n */\r\n wrap: boolean;\r\n /**\r\n * Spacing on the **cross** axis: between wrapped lines, and between a grid's\r\n * rows. Omitted, it follows `gap` — \"wrap this row\" almost never means \"and\r\n * stack the lines flush against each other\".\r\n */\r\n crossGap: number;\r\n /** Number of equal columns when `flow` is `'grid'`. At least 1. */\r\n columns: number;\r\n /**\r\n * Where children sit in the content box: a named position (`'center'`,\r\n * `'topLeft'`, …) or a per-axis `Vector2` (x: -1 left … +1 right, y: -1\r\n * bottom … +1 top).\r\n */\r\n align: Alignment;\r\n}\r\n\r\n/**\r\n * What `flowOps` arranges by: the {@link FlowProps} vocabulary, every field\r\n * optional and defaulting as the prop does. A shape's state or a `Canvas2D` is one\r\n * as it stands.\r\n */\r\nexport interface FlowSettings {\r\n readonly flow?: FlowResolved;\r\n readonly gap?: GapSize;\r\n readonly wrap?: boolean;\r\n readonly crossGap?: number;\r\n readonly columns?: number;\r\n readonly align?: Alignment;\r\n /** Read by `flowOps.arrange` only; a node insets its own content box. */\r\n readonly padding?: Insets;\r\n}\r\n\r\n/** One thing a flow arranges — a `Node2D` as it stands, or a plain `{ width, height }`. */\r\nexport interface LayoutItem {\r\n readonly width: SizeInput;\r\n readonly height: SizeInput;\r\n /** Share of a run's free space among its `fill` items. Default 1. */\r\n readonly flex?: number;\r\n /** Fraction of a full gap this item opens on each side, `[0, 1]`. Default 1. */\r\n readonly gapScale?: number;\r\n /** 1-based grid column; with `row`, places the item explicitly. */\r\n readonly column?: number;\r\n readonly row?: number;\r\n readonly colSpan?: number;\r\n readonly rowSpan?: number;\r\n /**\r\n * The item's own size under `constraints`. Without one, a number is the size,\r\n * `'fill'` takes what is offered and `'hug'` is 0.\r\n */\r\n measure?(constraints: SizeConstraints, measurer?: MeasureContext2D): Partial<Size2D>;\r\n}\r\n\r\n/** The content box a flow measures in, and which of its axes hug their content. */\r\nexport interface FlowSpace {\r\n readonly width: number;\r\n readonly height: number;\r\n readonly hugWidth?: boolean;\r\n readonly hugHeight?: boolean;\r\n}\r\n\r\n/** One line of a `horizontal`/`vertical` run: items `[start, end)`. */\r\nexport interface FlowLine {\r\n readonly start: number;\r\n readonly end: number;\r\n /** The line's thickness — its deepest item — on the cross axis. */\r\n readonly cross: number;\r\n}\r\n\r\n/**\r\n * One measure pass: what `flowOps.place` needs to position the items, and the\r\n * extent a hugging container wraps.\r\n */\r\nexport interface FlowMeasure<I extends LayoutItem = LayoutItem> {\r\n readonly mode: FlowMode;\r\n readonly items: readonly I[];\r\n readonly sizes: readonly Size2D[];\r\n readonly hug: Size2D;\r\n /** The content box this was measured in — see `flowOps.reusable`. */\r\n readonly space: FlowSpace;\r\n /** Runs: the lines, and each item's clamped `gapScale` (all 1 when wrapped). */\r\n readonly lines?: readonly FlowLine[];\r\n readonly gapScales?: readonly number[];\r\n /** Grid: each item's cell, from the content box's top-left, y-down. */\r\n readonly cells?: readonly BoxBounds[];\r\n /** A blend between two modes: the measure of the mode being left, and how far along. */\r\n readonly from?: FlowMeasure<I>;\r\n readonly t?: number;\r\n}\r\n"]}
|
package/dist/props/host.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PropSlot } from "./slot.js";
|
|
|
2
2
|
/** @internal */
|
|
3
3
|
export type TweenFn<T> = (from: T, to: T, t: number) => T;
|
|
4
4
|
/**
|
|
5
|
-
* The slots behind an object's
|
|
5
|
+
* The slots behind an object's `property`-declared fields, plus the per-field
|
|
6
6
|
* metadata `set()` and `to()` route through.
|
|
7
7
|
*
|
|
8
8
|
* One object rather than three loose maps on the host, because the host is a
|
package/dist/props/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/props/host.ts"],"names":[],"mappings":"AAgCA,gBAAgB;AAChB,MAAM,UAAU,WAAW,CAAC,GAAa,EAAE,IAAY;IACnD,OAAO,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,GAAa;IACrC,OAAO,GAAG,CAAC,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import { PropSlot } from \"./slot\";\r\n\r\n/** @internal */\r\nexport type TweenFn<T> = (from: T, to: T, t: number) => T;\r\n\r\n/**\r\n * The slots behind an object's
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/props/host.ts"],"names":[],"mappings":"AAgCA,gBAAgB;AAChB,MAAM,UAAU,WAAW,CAAC,GAAa,EAAE,IAAY;IACnD,OAAO,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,GAAa;IACrC,OAAO,GAAG,CAAC,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import { PropSlot } from \"./slot\";\r\n\r\n/** @internal */\r\nexport type TweenFn<T> = (from: T, to: T, t: number) => T;\r\n\r\n/**\r\n * The slots behind an object's `property`-declared fields, plus the per-field\r\n * metadata `set()` and `to()` route through.\r\n *\r\n * One object rather than three loose maps on the host, because the host is a\r\n * `Node` and every public field it carries is published API. Grouping them\r\n * means a node exposes one internal name instead of three, and gives the thing\r\n * a name a reader can look up.\r\n *\r\n * @internal\r\n */\r\nexport interface PropCells {\r\n /** Field → its live slot. Present for every registered prop. */\r\n slots: Map<string, PropSlot<any>>;\r\n /** Field → how it interpolates, for props a numeric lerp cannot cover. */\r\n tweens?: Map<string, TweenFn<any>>;\r\n /** Field → external prop value to internal slot value, for fields that need it. */\r\n mappers?: Map<string, (ext: any, prev?: any) => any>;\r\n}\r\n\r\n/** @internal */\r\nexport interface PropHost {\r\n /** See {@link PropCells}. Absent until the first prop is registered, and\r\n * cleared by `dispose()`. */\r\n __cells?: PropCells;\r\n}\r\n\r\n/** @internal */\r\nexport function getPropSlot(obj: PropHost, name: string): PropSlot<any> | undefined {\r\n return obj.__cells?.slots.get(name);\r\n}\r\n\r\n/** The host's slots, created on first use. @internal */\r\nexport function ensureCells(obj: PropHost): PropCells {\r\n return obj.__cells ??= { slots: new Map() };\r\n}\r\n"]}
|
package/dist/props/slot.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare let _observer: SlotObserver | null;
|
|
|
18
18
|
/** @internal Only this module can reassign the binding. Returns the observer it replaced. */
|
|
19
19
|
export declare function _setObserver(observer: SlotObserver | null): SlotObserver | null;
|
|
20
20
|
/**
|
|
21
|
-
* The storage behind one
|
|
21
|
+
* The storage behind one `property`: a plain value, or a thunk evaluated on
|
|
22
22
|
* every read.
|
|
23
23
|
*
|
|
24
24
|
* There is no dependency graph and nothing to invalidate. A bound slot
|
package/dist/props/slot.js
CHANGED
|
@@ -10,7 +10,7 @@ export function _setObserver(observer) {
|
|
|
10
10
|
return previous;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* The storage behind one
|
|
13
|
+
* The storage behind one `property`: a plain value, or a thunk evaluated on
|
|
14
14
|
* every read.
|
|
15
15
|
*
|
|
16
16
|
* There is no dependency graph and nothing to invalidate. A bound slot
|
package/dist/props/slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/props/slot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M,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,EAAW;QACZ,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,yDAAyD;IACzD,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,OAAO;QACtB,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC;IAC7B,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACnF,CAAC;IAED,WAAW,CAAC,IAAqB;QAC7B,IAAI,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,mFAAmF;IACnF,OAAO;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,SAAyB,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { SlotObserver } from \"./observer\";\r\n\r\n/**\r\n * A captured state of a {@link PropSlot}: the thunk it was bound to, or the\r\n * plain value it held. Produced by {@link PropSlot.snapshot} and consumed by\r\n * {@link PropSlot.restoreFrom}.\r\n */\r\n/** @internal */\r\nexport interface PropSnapshot<T> {\r\n value: T;\r\n /** Present only for a bound slot; restoring one re-binds rather than freezing it. */\r\n fn?: () => T;\r\n}\r\n\r\n/**\r\n * @internal The observer every slot reports to, or `null` — which is every frame of\r\n * playback, so the hot path pays one null check. Installed by `observeSlots`.\r\n */\r\nexport let _observer: SlotObserver | null = null;\r\n\r\n/** @internal Only this module can reassign the binding. Returns the observer it replaced. */\r\nexport function _setObserver(observer: SlotObserver | null): SlotObserver | null {\r\n const previous = _observer;\r\n _observer = observer;\r\n return previous;\r\n}\r\n\r\n/**\r\n * The storage behind one
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/props/slot.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,MAAM,CAAC,IAAI,SAAS,GAAwB,IAAI,CAAC;AAEjD,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,QAA6B;IACtD,MAAM,QAAQ,GAAG,SAAS,CAAC;IAC3B,SAAS,GAAG,QAAQ,CAAC;IACrB,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,QAAQ;IAQJ;IACA;IARL,MAAM,CAAI;IACV,GAAG,GAAqB,IAAI,CAAC;IAC7B,QAAQ,GAAG,KAAK,CAAC;IAEzB,iFAAiF;IACjF,YACI,OAAU,EACD,QAAwC,IAAI,EAC5C,QAAgB,EAAE;QADlB,UAAK,GAAL,KAAK,CAAuC;QAC5C,UAAK,GAAL,KAAK,CAAa;QAE3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,GAAG;QACC,sEAAsE;QACtE,0BAA0B;QAC1B,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,oEAAoE;QACpE,wEAAwE;QACxE,qEAAqE;QACrE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ;YAAE,O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E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,mFAAmF;IACnF,OAAO;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,SAAyB,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { SlotObserver } from \"./observer\";\r\n\r\n/**\r\n * A captured state of a {@link PropSlot}: the thunk it was bound to, or the\r\n * plain value it held. Produced by {@link PropSlot.snapshot} and consumed by\r\n * {@link PropSlot.restoreFrom}.\r\n */\r\n/** @internal */\r\nexport interface PropSnapshot<T> {\r\n value: T;\r\n /** Present only for a bound slot; restoring one re-binds rather than freezing it. */\r\n fn?: () => T;\r\n}\r\n\r\n/**\r\n * @internal The observer every slot reports to, or `null` — which is every frame of\r\n * playback, so the hot path pays one null check. Installed by `observeSlots`.\r\n */\r\nexport let _observer: SlotObserver | null = null;\r\n\r\n/** @internal Only this module can reassign the binding. Returns the observer it replaced. */\r\nexport function _setObserver(observer: SlotObserver | null): SlotObserver | null {\r\n const previous = _observer;\r\n _observer = observer;\r\n return previous;\r\n}\r\n\r\n/**\r\n * The storage behind one `property`: a plain value, or a thunk evaluated on\r\n * every read.\r\n *\r\n * There is no dependency graph and nothing to invalidate. A bound slot\r\n * recomputes when it is asked, which is what makes a document expression\r\n * (`\"=4[g]+3\"`), an author's `width={() => …}` and an alignment binding reading\r\n * a box written mid-layout all correct without anything declaring an edge. The\r\n * cache-and-invalidate version of this could only get the last one right by\r\n * observing the write, and paid for it everywhere: a `peek()`/`get()` split at\r\n * every write path, so a read taken inside whatever computation happened to be\r\n * running did not register an edge with no business existing.\r\n *\r\n * The bet is that recomputing is cheaper than tracking. Bindings here are\r\n * arithmetic over a handful of reads, and a frame's draw dwarfs all of them.\r\n */\r\nexport class PropSlot<T> {\r\n private _value: T;\r\n private _fn: (() => T) | null = null;\r\n private _running = false;\r\n\r\n /** `_host` and `_name` only label the slot for an observer — see `slotLabel`. */\r\n constructor(\r\n initial: T,\r\n readonly _host: { readonly id: string } | null = null,\r\n readonly _name: string = \"\",\r\n ) {\r\n this._value = initial;\r\n }\r\n\r\n get(): T {\r\n // Before the re-entrancy check, so a binding's own reads are recorded\r\n // under whatever read it.\r\n if (_observer !== null) _observer.read(this);\r\n // A binding that reads its own slot re-enters here mid-evaluation —\r\n // `bind(() => mapper(ext(), slot.get()))` is how a mapper is handed the\r\n // previous value. It gets the last settled one instead of recursing.\r\n if (!this._fn || this._running) return this._value;\r\n this._running = true;\r\n try {\r\n return (this._value = this._fn());\r\n } finally {\r\n this._running = false;\r\n }\r\n }\r\n\r\n set(value: T): void {\r\n if (_observer !== null) _observer.write(this);\r\n this._fn = null;\r\n this._value = value;\r\n }\r\n\r\n bind(fn: () => T): void {\r\n if (_observer !== null) _observer.write(this);\r\n this._fn = fn;\r\n }\r\n\r\n /** Freeze a bound slot at what it currently computes. */\r\n unbind(): void {\r\n if (!this._fn) return;\r\n if (_observer !== null) _observer.write(this);\r\n this._value = this.get();\r\n this._fn = null;\r\n }\r\n\r\n isBound(): boolean {\r\n return this._fn !== null;\r\n }\r\n\r\n snapshot(): PropSnapshot<T> {\r\n return this._fn ? { value: this.get(), fn: this._fn } : { value: this._value };\r\n }\r\n\r\n restoreFrom(snap: PropSnapshot<T>): void {\r\n if (snap.fn) this.bind(snap.fn);\r\n else this.set(snap.value);\r\n }\r\n\r\n /** Releases the bound closure and the value slot. The slot is inert after this. */\r\n dispose(): void {\r\n this._fn = null;\r\n this._value = undefined as unknown as T;\r\n }\r\n}\r\n"]}
|
package/dist/render/clip.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export type ClipOp = ClipShapeOp | {
|
|
|
55
55
|
* ...draw clipped content...
|
|
56
56
|
* ctx.endClip();
|
|
57
57
|
*
|
|
58
|
-
* A `Clip` carries no paint — it's purely the outline. It's what a
|
|
58
|
+
* A `Clip` carries no paint — it's purely the outline. It's what a shape
|
|
59
59
|
* returns from `clipSelf()` to describe both its `clip` boundary and the
|
|
60
60
|
* silhouette its backdrop effects (blur, magnify, …) are confined to, so a
|
|
61
61
|
* single definition drives every clip the node needs.
|
package/dist/render/clip.js
CHANGED
|
@@ -15,7 +15,7 @@ import { PathBuilder } from "./descriptors/path-builder.js";
|
|
|
15
15
|
* ...draw clipped content...
|
|
16
16
|
* ctx.endClip();
|
|
17
17
|
*
|
|
18
|
-
* A `Clip` carries no paint — it's purely the outline. It's what a
|
|
18
|
+
* A `Clip` carries no paint — it's purely the outline. It's what a shape
|
|
19
19
|
* returns from `clipSelf()` to describe both its `clip` boundary and the
|
|
20
20
|
* silhouette its backdrop effects (blur, magnify, …) are confined to, so a
|
|
21
21
|
* single definition drives every clip the node needs.
|
package/dist/render/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAuBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAI;IACL,IAAI,GAAa,EAAE,CAAC;IAE5B,4EAA4E;IAE5E,IAAI,CAAC,KAA+C;QAChD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAkD;QACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mFAAmF;IACnF,IAAI,CAAC,KAAuC;QACxC,MAAM,QAAQ,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,KAAyB;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAkD;QACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAmD;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E;;;;OAIG;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a
|
|
1
|
+
{"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,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;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a shape\r\n * returns from `clipSelf()` to describe both its `clip` boundary and the\r\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\r\n * single definition drives every clip the node needs.\r\n */\r\nexport class Clip {\r\n private _ops: ClipOp[] = [];\r\n\r\n // ─── Shapes ──────────────────────────────────────────────────────────────\r\n\r\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"rect\", state });\r\n return this;\r\n }\r\n\r\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"ellipse\", state });\r\n return this;\r\n }\r\n\r\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\r\n path(state: Partial<PathState> | PathBuilder): this {\r\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\r\n this._ops.push({ kind: \"path\", state: resolved });\r\n return this;\r\n }\r\n\r\n line(state: Partial<LineState>): this {\r\n this._ops.push({ kind: \"line\", state });\r\n return this;\r\n }\r\n\r\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygon\", state });\r\n return this;\r\n }\r\n\r\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygram\", state });\r\n return this;\r\n }\r\n\r\n // ─── Compositing ─────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Use the last-declared shape as a cutter: union the shapes before it and\r\n * subtract that last shape, punching a hole in the clip region. Mirrors\r\n * {@link Graphics2D.cut}.\r\n */\r\n cut(): this {\r\n this._ops.push({ kind: \"cut\" });\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\r\n ops(): readonly ClipOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** True when no shape op has been recorded — the clip region is empty. */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => op.kind !== \"cut\");\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its
|
|
1
|
+
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its property\r\n // mapper, and the renderer re-resolves idempotently.\r\n cornerRadius: RectCornerRadius;\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -4,18 +4,24 @@ import { StrokeResolved } from "../../attributes/shape/stroke/stroke.js";
|
|
|
4
4
|
import { PathData } from "./path.js";
|
|
5
5
|
import { ShapeAlignmentInput, ShapeState } from "./shape.js";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The size a segmented block's pieces shape at on an `'autofit'` node: the
|
|
8
|
+
* size the layout probes with, since no single piece can be asked for the
|
|
9
|
+
* size the block settles on.
|
|
10
|
+
*/
|
|
11
|
+
export declare const AUTOFIT_PROBE_SIZE = 100;
|
|
12
|
+
/**
|
|
13
|
+
* One contiguous piece of a Text node split at run boundaries. Pieces
|
|
8
14
|
* carry their effective shaping inputs (`text` plus the five font fields) and
|
|
9
15
|
* draw-time overrides applied per shaped run: `opacity` folded into the paint
|
|
10
16
|
* alpha, an optional `fill`/`stroke` override (falls back to the node's when
|
|
11
17
|
* omitted), and a transform applied about the run's centered position.
|
|
12
18
|
*
|
|
13
|
-
* Present only when a Text node has
|
|
14
|
-
* renders as a single string with no segments
|
|
19
|
+
* Present only when a Text node has styled runs or a reveal window; otherwise
|
|
20
|
+
* the node renders as a single string with no segments.
|
|
15
21
|
*
|
|
16
22
|
* **Every shaping field is stated, none inherited at draw time.** `fontFamily`,
|
|
17
23
|
* `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a
|
|
18
|
-
*
|
|
24
|
+
* run can change its *face* and not only its weight — which is
|
|
19
25
|
* what an editor built on this needs to offer per-character styling at all. The
|
|
20
26
|
* paragraph builder already takes all five per run (it is what `RichText` sets),
|
|
21
27
|
* so the cost of the three is a wider segment and nothing else.
|
|
@@ -88,7 +94,7 @@ export interface TextState extends ShapeState {
|
|
|
88
94
|
width: number;
|
|
89
95
|
height: number;
|
|
90
96
|
/**
|
|
91
|
-
* Per-piece overrides when the node has
|
|
97
|
+
* Per-piece overrides when the node has styled runs. When set,
|
|
92
98
|
* the renderer shapes these pieces together (one paragraph) and paints each
|
|
93
99
|
* shaped run with its piece's overrides instead of the node's single fill.
|
|
94
100
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EA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C;CAC1B;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAW5F;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,mBAAmB,GAAG,SAAS,CA+BlG"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from "./shape.js";
|
|
2
|
-
import { hostTextFamily } from "../../
|
|
2
|
+
import { hostTextFamily } from "../../components/builtins/text/text-defaults.js";
|
|
3
|
+
/**
|
|
4
|
+
* The size a segmented block's pieces shape at on an `'autofit'` node: the
|
|
5
|
+
* size the layout probes with, since no single piece can be asked for the
|
|
6
|
+
* size the block settles on.
|
|
7
|
+
*/
|
|
8
|
+
export const AUTOFIT_PROBE_SIZE = 100;
|
|
3
9
|
/**
|
|
4
10
|
* Whether `segment` only *styles* its characters — no transform of its own.
|
|
5
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AA8C5D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC;WAClC,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC;AACzD,CAAC;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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B,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,EAAE;QACnC,UAAU,EAAE,iBAAiB,CAAC,UAAU,CAAC;QACzC,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,CAAC;QAC5C,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;QACtC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,QAAQ;QACnD,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,MAAM;QACnD,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;QAC9B,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,EAAE;QACzC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KAChC,CAAC;AACN,CAAC","sourcesContent":["import type { FontStyle, TextAlign, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"./path\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nimport { hostTextFamily } from \"@/nodes/node/text-defaults\";\r\n\r\n/**\r\n * One contiguous piece of a Text node split at selection boundaries. Pieces\r\n * carry their effective shaping inputs (`text` plus the five font fields) and\r\n * draw-time overrides applied per shaped run: `opacity` folded into the paint\r\n * alpha, an optional `fill`/`stroke` override (falls back to the node's when\r\n * omitted), and a transform applied about the run's centered position.\r\n *\r\n * Present only when a Text node has active selections; otherwise the node\r\n * renders as a single string with no segments (unchanged behavior).\r\n *\r\n * **Every shaping field is stated, none inherited at draw time.** `fontFamily`,\r\n * `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a\r\n * selection can change the *face* of a run and not only its weight — which is\r\n * what an editor built on this needs to offer per-character styling at all. The\r\n * paragraph builder already takes all five per run (it is what `RichText` sets),\r\n * so the cost of the three is a wider segment and nothing else.\r\n *\r\n * They are optional only so an older caller's segments still lay out: absent\r\n * means \"the node's own\", resolved where the paragraph is built rather than\r\n * left for the renderer to guess.\r\n */\r\nexport interface TextSegment {\r\n text: string;\r\n /** Override family for this piece; falls back to the node's when undefined. */\r\n fontFamily?: string;\r\n /** Override size for this piece; falls back to the node's when undefined. */\r\n fontSize?: number;\r\n /** Override slant for this piece; falls back to the node's when undefined. */\r\n fontStyle?: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n /** Override decoration for this piece; falls back to the node's when undefined. */\r\n textDecoration?: TextDecoration;\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n /** Override fill for this piece; falls back to the node's fill when undefined. */\r\n fill?: FillResolved[];\r\n /** Override stroke for this piece; falls back to the node's stroke when undefined. */\r\n stroke?: StrokeResolved[];\r\n}\r\n\r\n/**\r\n * Whether `segment` only *styles* its characters — no transform of its own.\r\n *\r\n * The caret model can describe a segmented block exactly as long as this holds\r\n * of every piece: differently-styled runs are still one paragraph, laid out and\r\n * measured together, so Skia's own rects for each character are where the glyphs\r\n * are. A piece that is *moved*, turned or scaled about its own centre is not in\r\n * that paragraph's space any more, and a slot measured from it would point at\r\n * where the character would have been. See `textBlockLayout`, which is the one\r\n * caller and turns a false here into \"no caret model for this shape\".\r\n */\r\nexport function isStyleOnlySegment(segment: TextSegment): boolean {\r\n return segment.x === 0 && segment.y === 0\r\n && segment.scale === 1 && segment.rotation === 0;\r\n}\r\n\r\nexport interface TextState extends ShapeState {\r\n text: string;\r\n /**\r\n * A named typography preset to shape against — `theme.typography`'s key, the\r\n * same one a `Text` node's `variant` prop selects.\r\n *\r\n * A node reads its variant once, at bind; a drawn op has no bind step, so it\r\n * is resolved at draw alongside the inherited defaults (see\r\n * `applyGraphicsTextDefaults`). It sits *between* the two: above the\r\n * enclosing `<DefaultTextStyle>`, below anything the op states itself.\r\n *\r\n * Optional, and unresolved names are ignored rather than an error — a scene\r\n * that renames a preset should lose the styling, not fail to draw.\r\n */\r\n variant?: string;\r\n fontSize: number | 'autofit';\r\n fontFamily: string;\r\n fontWeight: number;\r\n fontStyle: FontStyle;\r\n letterSpacing: number;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n /** Where the block sits in a box taller or shorter than it; only a `height` gives it one. */\r\n verticalAlign: VerticalAlign;\r\n textDecoration: TextDecoration;\r\n wrap: boolean;\r\n minFontSize: number;\r\n width: number;\r\n height: number;\r\n /**\r\n * Per-piece overrides when the node has active text selections. When set,\r\n * the renderer shapes these pieces together (one paragraph) and paints each\r\n * shaped run with its piece's overrides instead of the node's single fill.\r\n */\r\n segments?: TextSegment[];\r\n /**\r\n * When set, the text is wrapped around this path (text-on-path) instead of\r\n * laid out as straight lines: each glyph is positioned and rotated to follow\r\n * the path, centered on its baseline, and glyphs past the path end are\r\n * clipped. Mutually exclusive with `segments` in v1.\r\n */\r\n path?: PathData | null;\r\n}\r\n\r\n\r\n/**\r\n * The family this text is set in — the last rung of the cascade, and the only\r\n * one that can refuse.\r\n *\r\n * It used to fall back to `\"Arial\"`, which is the wrong shape of answer for a\r\n * renderer whose whole job is that the picture is the one that was asked for:\r\n * substituting a face the *engine* picked produces text in a typeface the author\r\n * never chose, at metrics they never measured, in a frame that looks finished,\r\n * and hides a font that was never declared and so never loaded.\r\n *\r\n * What it falls back to instead is {@link hostTextFamily} — a face the\r\n * **application** named, once, at its composition root, out of the fonts it\r\n * actually vendors. That is a different bargain: a host that ships a typeface\r\n * registers it in every manifest, so a chart axis that nobody styled comes out\r\n * in it and paints glyphs, while the engine still refuses to invent a face of\r\n * its own. A host that declares nothing gets the error below, which is the right\r\n * answer for a headless render whose fonts all come from a manifest.\r\n *\r\n * By the time an op reaches here the whole ladder above has been walked — the op\r\n * or prop itself, a `variant` preset, the enclosing `<DefaultTextStyle>`, then\r\n * the theme's `default` typography preset — so this is only ever reached when\r\n * every one of them was silent. The message names them because \"no font family\"\r\n * is not actionable and \"set one on the text, on a DefaultTextStyle, or as the\r\n * theme's default preset\" is.\r\n *\r\n * Exported so the **measure** path enforces the same policy from the same\r\n * definition. Shaping a paragraph to measure it happens before any op is\r\n * validated, and Skia reads `.length` off every family name — so text with no\r\n * family used to die inside the wasm with `Cannot read properties of undefined`,\r\n * naming no scene, node or prop, while the identical case at draw time produced\r\n * the message above. One policy, two verdicts, and the useless one came first.\r\n */\r\nexport function requireFontFamily(descriptor: { fontFamily?: string; text?: string }): string {\r\n const family = descriptor.fontFamily;\r\n if (typeof family === \"string\" && family !== \"\") return family;\r\n const host = hostTextFamily();\r\n if (host !== \"\") return host;\r\n const text = descriptor.text ? ` drawing \"${descriptor.text.slice(0, 32)}\"` : \"\";\r\n throw new Error(\r\n `Text${text} has no fontFamily. Set one on the text itself, on an `\r\n + `enclosing <DefaultTextStyle>, or as the theme's \\`default\\` typography `\r\n + `preset — there is no fallback face.`,\r\n );\r\n}\r\n\r\nexport function withTextDescriptor(descriptor: Partial<TextState> & ShapeAlignmentInput): TextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n text: descriptor.text ?? \"\",\r\n fontSize: descriptor.fontSize ?? 48,\r\n fontFamily: requireFontFamily(descriptor),\r\n fontWeight: descriptor.fontWeight ?? 400,\r\n fontStyle: descriptor.fontStyle ?? 'normal',\r\n letterSpacing: descriptor.letterSpacing ?? 0,\r\n lineHeight: descriptor.lineHeight ?? 0,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n verticalAlign: descriptor.verticalAlign ?? 'center',\r\n textDecoration: descriptor.textDecoration ?? 'none',\r\n wrap: descriptor.wrap ?? false,\r\n minFontSize: descriptor.minFontSize ?? 12,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n segments: descriptor.segments,\r\n path: descriptor.path ?? null,\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/render/descriptors/text.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AA8CtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC;WAClC,OAAO,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC;AACzD,CAAC;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkD;IAChF,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;IACrC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IAC/D,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IA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AI,CAAC;QACtC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI,QAAQ;QACnD,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,MAAM;QACnD,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,KAAK;QAC9B,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,EAAE;QACzC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KAChC,CAAC;AACN,CAAC","sourcesContent":["import type { FontStyle, TextAlign, TextDecoration, VerticalAlign } from \"@/attributes/text/types\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\nimport { PathData } from \"./path\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nimport { hostTextFamily } from \"@/components/builtins/text/text-defaults\";\r\n\r\n/**\r\n * The size a segmented block's pieces shape at on an `'autofit'` node: the\r\n * size the layout probes with, since no single piece can be asked for the\r\n * size the block settles on.\r\n */\r\nexport const AUTOFIT_PROBE_SIZE = 100;\r\n\r\n/**\r\n * One contiguous piece of a Text node split at run boundaries. Pieces\r\n * carry their effective shaping inputs (`text` plus the five font fields) and\r\n * draw-time overrides applied per shaped run: `opacity` folded into the paint\r\n * alpha, an optional `fill`/`stroke` override (falls back to the node's when\r\n * omitted), and a transform applied about the run's centered position.\r\n *\r\n * Present only when a Text node has styled runs or a reveal window; otherwise\r\n * the node renders as a single string with no segments.\r\n *\r\n * **Every shaping field is stated, none inherited at draw time.** `fontFamily`,\r\n * `fontSize` and `fontStyle` joined `fontWeight` and `letterSpacing` here so a\r\n * run can change its *face* and not only its weight — which is\r\n * what an editor built on this needs to offer per-character styling at all. The\r\n * paragraph builder already takes all five per run (it is what `RichText` sets),\r\n * so the cost of the three is a wider segment and nothing else.\r\n *\r\n * They are optional only so an older caller's segments still lay out: absent\r\n * means \"the node's own\", resolved where the paragraph is built rather than\r\n * left for the renderer to guess.\r\n */\r\nexport interface TextSegment {\r\n text: string;\r\n /** Override family for this piece; falls back to the node's when undefined. */\r\n fontFamily?: string;\r\n /** Override size for this piece; falls back to the node's when undefined. */\r\n fontSize?: number;\r\n /** Override slant for this piece; falls back to the node's when undefined. */\r\n fontStyle?: FontStyle;\r\n fontWeight: number;\r\n letterSpacing: number;\r\n /** Override decoration for this piece; falls back to the node's when undefined. */\r\n textDecoration?: TextDecoration;\r\n opacity: number;\r\n x: number;\r\n y: number;\r\n scale: number;\r\n rotation: number;\r\n /** Override fill for this piece; falls back to the node's fill when undefined. */\r\n fill?: FillResolved[];\r\n /** Override stroke for this piece; falls back to the node's stroke when undefined. */\r\n stroke?: StrokeResolved[];\r\n}\r\n\r\n/**\r\n * Whether `segment` only *styles* its characters — no transform of its own.\r\n *\r\n * The caret model can describe a segmented block exactly as long as this holds\r\n * of every piece: differently-styled runs are still one paragraph, laid out and\r\n * measured together, so Skia's own rects for each character are where the glyphs\r\n * are. A piece that is *moved*, turned or scaled about its own centre is not in\r\n * that paragraph's space any more, and a slot measured from it would point at\r\n * where the character would have been. See `textBlockLayout`, which is the one\r\n * caller and turns a false here into \"no caret model for this shape\".\r\n */\r\nexport function isStyleOnlySegment(segment: TextSegment): boolean {\r\n return segment.x === 0 && segment.y === 0\r\n && segment.scale === 1 && segment.rotation === 0;\r\n}\r\n\r\nexport interface TextState extends ShapeState {\r\n text: string;\r\n /**\r\n * A named typography preset to shape against — `theme.typography`'s key, the\r\n * same one a `Text` node's `variant` prop selects.\r\n *\r\n * A node reads its variant once, at bind; a drawn op has no bind step, so it\r\n * is resolved at draw alongside the inherited defaults (see\r\n * `applyGraphicsTextDefaults`). It sits *between* the two: above the\r\n * enclosing `<DefaultTextStyle>`, below anything the op states itself.\r\n *\r\n * Optional, and unresolved names are ignored rather than an error — a scene\r\n * that renames a preset should lose the styling, not fail to draw.\r\n */\r\n variant?: string;\r\n fontSize: number | 'autofit';\r\n fontFamily: string;\r\n fontWeight: number;\r\n fontStyle: FontStyle;\r\n letterSpacing: number;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n /** Where the block sits in a box taller or shorter than it; only a `height` gives it one. */\r\n verticalAlign: VerticalAlign;\r\n textDecoration: TextDecoration;\r\n wrap: boolean;\r\n minFontSize: number;\r\n width: number;\r\n height: number;\r\n /**\r\n * Per-piece overrides when the node has styled runs. When set,\r\n * the renderer shapes these pieces together (one paragraph) and paints each\r\n * shaped run with its piece's overrides instead of the node's single fill.\r\n */\r\n segments?: TextSegment[];\r\n /**\r\n * When set, the text is wrapped around this path (text-on-path) instead of\r\n * laid out as straight lines: each glyph is positioned and rotated to follow\r\n * the path, centered on its baseline, and glyphs past the path end are\r\n * clipped. Mutually exclusive with `segments` in v1.\r\n */\r\n path?: PathData | null;\r\n}\r\n\r\n\r\n/**\r\n * The family this text is set in — the last rung of the cascade, and the only\r\n * one that can refuse.\r\n *\r\n * It used to fall back to `\"Arial\"`, which is the wrong shape of answer for a\r\n * renderer whose whole job is that the picture is the one that was asked for:\r\n * substituting a face the *engine* picked produces text in a typeface the author\r\n * never chose, at metrics they never measured, in a frame that looks finished,\r\n * and hides a font that was never declared and so never loaded.\r\n *\r\n * What it falls back to instead is {@link hostTextFamily} — a face the\r\n * **application** named, once, at its composition root, out of the fonts it\r\n * actually vendors. That is a different bargain: a host that ships a typeface\r\n * registers it in every manifest, so a chart axis that nobody styled comes out\r\n * in it and paints glyphs, while the engine still refuses to invent a face of\r\n * its own. A host that declares nothing gets the error below, which is the right\r\n * answer for a headless render whose fonts all come from a manifest.\r\n *\r\n * By the time an op reaches here the whole ladder above has been walked — the op\r\n * or prop itself, a `variant` preset, the enclosing `<DefaultTextStyle>`, then\r\n * the theme's `default` typography preset — so this is only ever reached when\r\n * every one of them was silent. The message names them because \"no font family\"\r\n * is not actionable and \"set one on the text, on a DefaultTextStyle, or as the\r\n * theme's default preset\" is.\r\n *\r\n * Exported so the **measure** path enforces the same policy from the same\r\n * definition. Shaping a paragraph to measure it happens before any op is\r\n * validated, and Skia reads `.length` off every family name — so text with no\r\n * family used to die inside the wasm with `Cannot read properties of undefined`,\r\n * naming no scene, node or prop, while the identical case at draw time produced\r\n * the message above. One policy, two verdicts, and the useless one came first.\r\n */\r\nexport function requireFontFamily(descriptor: { fontFamily?: string; text?: string }): string {\r\n const family = descriptor.fontFamily;\r\n if (typeof family === \"string\" && family !== \"\") return family;\r\n const host = hostTextFamily();\r\n if (host !== \"\") return host;\r\n const text = descriptor.text ? ` drawing \"${descriptor.text.slice(0, 32)}\"` : \"\";\r\n throw new Error(\r\n `Text${text} has no fontFamily. Set one on the text itself, on an `\r\n + `enclosing <DefaultTextStyle>, or as the theme's \\`default\\` typography `\r\n + `preset — there is no fallback face.`,\r\n );\r\n}\r\n\r\nexport function withTextDescriptor(descriptor: Partial<TextState> & ShapeAlignmentInput): TextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n text: descriptor.text ?? \"\",\r\n fontSize: descriptor.fontSize ?? 48,\r\n fontFamily: requireFontFamily(descriptor),\r\n fontWeight: descriptor.fontWeight ?? 400,\r\n fontStyle: descriptor.fontStyle ?? 'normal',\r\n letterSpacing: descriptor.letterSpacing ?? 0,\r\n lineHeight: descriptor.lineHeight ?? 0,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n verticalAlign: descriptor.verticalAlign ?? 'center',\r\n textDecoration: descriptor.textDecoration ?? 'none',\r\n wrap: descriptor.wrap ?? false,\r\n minFontSize: descriptor.minFontSize ?? 12,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n segments: descriptor.segments,\r\n path: descriptor.path ?? null,\r\n };\r\n}\r\n"]}
|
|
@@ -167,7 +167,7 @@ export interface RenderContext2D extends MeasureContext2D {
|
|
|
167
167
|
* Returns `null` when the backend cannot measure this — the default, so a
|
|
168
168
|
* backend that never needed glyph positions keeps working, and for cases no
|
|
169
169
|
* caret model fits: text-on-path (glyphs follow a curve, not a line box) and
|
|
170
|
-
* a block
|
|
170
|
+
* a block drawn in styled segments.
|
|
171
171
|
*/
|
|
172
172
|
layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;
|
|
173
173
|
/**
|
|
@@ -259,7 +259,7 @@ export interface RenderContext2D extends MeasureContext2D {
|
|
|
259
259
|
* True for anything that actually paints, since a fill with `space:'parent'`
|
|
260
260
|
* resolves against them. A context that only inspects *what* would be drawn
|
|
261
261
|
* never looks at them, and computing them costs an object allocation per node
|
|
262
|
-
* per frame. Nodes check this before doing that work; see `Node2D.
|
|
262
|
+
* per frame. Nodes check this before doing that work; see `Node2D.renderState`.
|
|
263
263
|
*/
|
|
264
264
|
readonly readsSpaceRects: boolean;
|
|
265
265
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-context2d.js","sourceRoot":"","sources":["../../src/render/render-context2d.ts"],"names":[],"mappings":"","sourcesContent":["import type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { MeasureContext2D } from \"./measure-context\";\r\nimport type { TextState } from \"./descriptors/text\";\r\nimport type { TextBlockLayout } from \"./text-layout\";\r\nimport type { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * Where an effect scope draws: `'foreground'` warps/filters the node's *own*\r\n * content (its fill, stroke and children), `'backdrop'` warps/filters the canvas\r\n * content already painted *beneath* the node (clipped to its silhouette). See\r\n * {@link RenderContext2D.beginEffects}.\r\n */\r\nexport type EffectTarget = \"foreground\" | \"backdrop\";\r\n\r\n/**\r\n * Pixels produced by {@link RenderContext2D.rasterize}: RGBA8888,\r\n * unpremultiplied, top-down (canvas row order). `width`/`height` are **device**\r\n * px, so they reflect the pixel ratio the renderer actually used rather than the\r\n * logical size that was asked for.\r\n */\r\nexport interface RasterizedSurface {\r\n pixels: Uint8Array;\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * A bounding box in the current node's local space (origin = the node's\r\n * layout-cell centre, the same space shapes are drawn in). `left/top` use the\r\n * canvas convention (y down).\r\n */\r\nexport interface SpaceRect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n}\r\n\r\n/**\r\n * Reference rects a fill can resolve against, supplied per-node at `begin()`.\r\n * `local` is derived from the drawn shapes themselves and `global` (the\r\n * viewport) is computed by the renderer from the surface size, so only the\r\n * parent frame is passed here.\r\n */\r\nexport interface SpaceRects {\r\n /** The parent node's content rect, in this node's local space. */\r\n parent?: SpaceRect;\r\n}\r\n\r\n/**\r\n * Per-node state supplied to {@link RenderContext2D.begin} for the duration of a\r\n * node's draw scope. Carries the node identity and gradient-space `rects` plus\r\n * the node's per-frame motion, sampled at render time. Motion-driven effects\r\n * (e.g. motion blur) read the current node's `velocity` from this state instead\r\n * of being authored with a fixed direction.\r\n *\r\n * Velocity fields are `0`/`{0,0}` when the motion is unknown — the first frame a\r\n * node renders, or after a time discontinuity (scrub/seek) where no trustworthy\r\n * delta exists.\r\n */\r\nexport interface NodeRenderState {\r\n /** Stable node identifier. */\r\n id: string;\r\n /** Parent / viewport rects in this node's local space. */\r\n rects: SpaceRects;\r\n /** How long this node has existed, in seconds (`NodeTime.elapsed`). */\r\n elapsed: number;\r\n /** The frame delta, in seconds, used to derive displacement from velocity. */\r\n dt: number;\r\n /** Translational velocity in px/sec, world space (y-down). `{0,0}` when unknown. */\r\n velocity: Vector2;\r\n /** Heading of `velocity` in degrees (`atan2(vy, vx)`). `0` when unknown. */\r\n direction: number;\r\n /** Magnitude of `velocity` in px/sec. `0` when unknown. */\r\n speed: number;\r\n /** Rotational velocity in degrees/sec. `0` when unknown. Reserved for radial motion blur. */\r\n angularVelocity: number;\r\n /** Scale velocity in scale-units/sec. `0` when unknown. Reserved for zoom motion blur. */\r\n scaleVelocity: number;\r\n}\r\n\r\n/**\r\n * The drawing surface a `Node2D` paints into — **the whole of what a node may\r\n * ask of a renderer, and nothing else.**\r\n *\r\n * Shapes are never declared directly on the context: they are built with a\r\n * {@link Graphics2D} command list and submitted via {@link draw}. Multiple\r\n * shapes chained on one `Graphics2D` before a paint call are combined into a\r\n * single surface and painted together:\r\n *\r\n * ctx.draw(new Graphics2D().ellipse(...).rect(...).fill(...)); // shared surface\r\n *\r\n * On top of that it carries text measurement — it extends {@link MeasureContext2D}, so\r\n * a node measures and draws through one object — and the higher-level scoping\r\n * operations: transforms, masks, clips, camera, boolean ops, effect scopes.\r\n * `begin(state)` / `end()` bracket each node's draw call so the context can\r\n * track which node is active.\r\n *\r\n * **An interface, with `CanvasRenderContext2D` as its one base class.** What a\r\n * node calls and what a *host* calls are different lists: `execute`,\r\n * `screenshot`, `unmount` and `dispose` drive a render pass and have no business\r\n * being reachable from inside one. Splitting them is what keeps this surface\r\n * the size it is. Every real backend still extends the class, which preserves\r\n * the `draw` to `drawGraphics` invariant that gives them all one implementation\r\n * of text-default resolution.\r\n *\r\n * `RenderContext3D` is its sibling, not its subclass: the two share no members,\r\n * because a 3D scene is described with lights, a camera and meshes rather than\r\n * with paths and paint.\r\n */\r\nexport interface RenderContext2D extends MeasureContext2D {\r\n measureText(\r\n text: string,\r\n fontSize: number,\r\n fontFamily: string,\r\n fontWeight?: number,\r\n letterSpacing?: number,\r\n fontStyle?: FontStyle,\r\n ): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Set text-style defaults for everything drawn until the matching\r\n * {@link popTextStyle} — the drawn-graphics half of `<DefaultTextStyle>`.\r\n *\r\n * `style` is **merged** onto the defaults already in effect, per key, so\r\n * nesting accumulates the way the node channel does: an outer scope's\r\n * `fontFamily` and an inner scope's `fontSize` both apply, and a key set by\r\n * both takes the inner value. Values are resolved (a tweened `fontSize`\r\n * arrives as this frame's number), not callbacks.\r\n *\r\n * Pass `null` to open a scope that inherits **nothing** — not the enclosing\r\n * defaults and not the project's `theme.typography.default`. That is for a\r\n * node whose text is its own vocabulary rather than the document's: `Code`\r\n * does it so a scene-wide serif face doesn't reflow a monospaced code block.\r\n *\r\n * Always pair with `popTextStyle()` in a `finally`; the stack is shared with\r\n * every sibling drawn afterwards.\r\n */\r\n pushTextStyle(style: TextStyle | null): void;\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void;\r\n\r\n /**\r\n * The text-style defaults in effect right now: the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open — the same preset a `Text` node falls back to, so a\r\n * drawn label and a node label agree on the project's base typography.\r\n */\r\n readonly defaultTextStyle: TextStyle;\r\n\r\n /**\r\n * Replay a built `Graphics2D` against this context.\r\n *\r\n * Resolves the ambient text defaults onto the op list before handing it to\r\n * the backend, which is what keeps the real renderer and the precomp asset\r\n * walk agreeing on which font an under-specified `text` op shapes with: a\r\n * family that one resolves and the other does not is a font that never loads\r\n * and glyphs that never paint.\r\n */\r\n draw(graphics: Graphics2D): void;\r\n\r\n /**\r\n * Lay `state` out the way it would be drawn and report where every character\r\n * landed — see {@link TextBlockLayout} for the space and the caret model.\r\n *\r\n * This is what makes on-canvas text editing possible: glyph positions live\r\n * in the backend's shaper, so a host drawing its own caret and selection has\r\n * no way to compute them, and anything it approximates in the DOM disagrees\r\n * with the render as soon as the font, the line height or the wrapping does.\r\n *\r\n * Takes the whole {@link TextState} rather than a handful of font fields\r\n * because the resolution a caret has to agree with lives in the backend:\r\n * `'autofit'` picks a size from the box, `wrap` turns the width into a wrap\r\n * limit, and `textAlign` places the lines within it. Handing over the same\r\n * descriptor that gets drawn is what keeps the two from drifting apart.\r\n *\r\n * Returns `null` when the backend cannot measure this — the default, so a\r\n * backend that never needed glyph positions keeps working, and for cases no\r\n * caret model fits: text-on-path (glyphs follow a curve, not a line box) and\r\n * a block with active selection segments.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;\r\n\r\n /**\r\n * Push a transform (position, rotation, scale, opacity, …) and return the\r\n * context so subsequent draw calls are issued in the transformed space. The\r\n * transform is popped when `end()` is called for the node that pushed it.\r\n */\r\n transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n /**\r\n * Open a boolean-path collection scope. Shapes drawn until `endBoolean()`\r\n * are gathered (fills/strokes suppressed) and combined with `op`. After\r\n * `endBoolean()` the merged path is left as the active surface, so a\r\n * paint-only `Graphics2D` (`new Graphics2D().fill(...).stroke(...)`)\r\n * submitted via `draw()` styles the combined result.\r\n */\r\n beginBoolean(op: BooleanOperation): void;\r\n endBoolean(): void;\r\n\r\n // Mask scope (imperative) — used by MaskGroup and other node-level callers\r\n // that manage the scope with explicit begin/apply/end:\r\n //\r\n // beginMask({ mode, inverted })\r\n // <render mask child> // child draws its own Graphics2D\r\n // applyMask()\r\n // <render content children> // children draw their own Graphics2D\r\n // endMask()\r\n //\r\n // The chain-friendly form lives on `Graphics2D` (`.mask().applyMask().endMask()`)\r\n // for inline use within a single `draw()`.\r\n //\r\n // For `vector` mode the mask child's path is collected and used as a\r\n // clipPath; fills/strokes are suppressed. For `alpha` and `luminance`\r\n // the mask is rendered into an offscreen layer and combined with content\r\n // via blend modes.\r\n beginMask(options?: MaskOptions): void;\r\n applyMask(): void;\r\n endMask(): void;\r\n\r\n /**\r\n * Push a clip region built from a {@link Clip} command list. The clip's\r\n * shapes are unioned (with `cut()`s subtracted) into a single path and\r\n * intersected with the active clip, so children are confined to that\r\n * compound outline — any silhouette, not just a rect or ellipse. Used both\r\n * for a node's `clip` boundary and to confine backdrop effects (blur,\r\n * magnify) to the node's exact shape. Paired with `endClip()`.\r\n */\r\n beginClip(clip: Clip): void;\r\n /** Pop the most-recently pushed clip region. */\r\n endClip(): void;\r\n\r\n /**\r\n * Open an effect scope over the node, applying `effects` to either the node's\r\n * own content or the content beneath it. Paired with {@link endEffects}.\r\n *\r\n * `target`:\r\n * - `'foreground'` — warps/filters the node's *own* drawing (its fill, stroke\r\n * and children captured between begin/end), like blur. Used for bulge and\r\n * foreground posterize.\r\n * - `'backdrop'` — warps/filters the canvas content already painted *beneath*\r\n * the node, clipped to the active silhouette clip, so the node's own edges\r\n * stay sharp (Figma-style). Used for backdrop-flagged filters (blur,\r\n * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop SkSL.\r\n *\r\n * The renderer decides per effect whether to compose it as an `ImageFilter`\r\n * or run it as a snapshot/redraw shader — callers never route by effect type.\r\n * `width`/`height` are the node's logical size, for size-relative effects\r\n * (e.g. pixelate) and shader lens boxes.\r\n */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void;\r\n endEffects(): void;\r\n\r\n /**\r\n * Draw `draw` into an offscreen buffer instead of onto the canvas, and hand\r\n * back its pixels. The buffer is `width` × `height` **logical** px with its\r\n * origin at the centre, matching the space a node draws in — so `draw` can be\r\n * an ordinary `render()` call on a node subtree and needs no special casing.\r\n *\r\n * This is what backs `Tex.surface`: `Canvas3D` rasterizes each of its 2D\r\n * sources through here, then hands the pixels to the 3D backend as a texture.\r\n * It runs *inside* the frame that consumes it, so a scrubbed frame is\r\n * identical to a played one.\r\n *\r\n * Returns `null` when the backend cannot rasterize offscreen — the material\r\n * then renders without that map. `pixelRatio` is a ceiling on the buffer's\r\n * device-pixel scale, not a guarantee; the renderer may clamp it.\r\n */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null;\r\n\r\n /**\r\n * Push a camera viewport. Clips to `viewport` (canvas-space, centred\r\n * coords) and applies the inverse camera transform so children render as\r\n * seen through the lens. `heading` rotates the world counter to the camera\r\n * angle. Paired with `endCamera()`.\r\n *\r\n * @param viewport Bounding rect of the camera node in canvas space.\r\n * @param lookAt World-space point the camera looks at.\r\n * @param zoom Uniform scale applied around `lookAt`.\r\n * @param heading Camera rotation in degrees.\r\n */\r\n beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n endCamera(): void;\r\n\r\n /**\r\n * Whether this context ever reads `NodeRenderState.rects`.\r\n *\r\n * True for anything that actually paints, since a fill with `space:'parent'`\r\n * resolves against them. A context that only inspects *what* would be drawn\r\n * never looks at them, and computing them costs an object allocation per node\r\n * per frame. Nodes check this before doing that work; see `Node2D.beforeRender`.\r\n */\r\n readonly readsSpaceRects: boolean;\r\n\r\n /**\r\n * Whether this context only cares about *visible* output.\r\n *\r\n * True for anything that paints: a subtree at zero opacity contributes no\r\n * pixels, so walking it produces draw calls the rasterizer will discard.\r\n *\r\n * A context that inspects rather than paints sets this `false`, and that is\r\n * the whole reason this is a capability rather than an unconditional check:\r\n * such a walk exists to discover which images, videos, fonts and effects a\r\n * frame *references* — regardless of whether they can be seen. An invisible\r\n * node's font still has to load, because it may fade in two frames later and\r\n * glyphs that were never registered never paint. Skipping it there is not an\r\n * optimisation, it is a missing asset.\r\n *\r\n * Same shape and same reasoning as {@link readsSpaceRects}: the context\r\n * declares what it needs, and nodes check before doing work that would be\r\n * thrown away. See `Node2D.render`.\r\n */\r\n readonly drawsVisibleOnly: boolean;\r\n\r\n}\r\n\r\n/**\r\n * A render *pass*: a {@link RenderContext2D} plus the per-node scope bracket the\r\n * walk opens around each node.\r\n *\r\n * Split off from the drawing surface because the two have different callers.\r\n * `begin`/`end` are `Node2D.render`'s, once per node, and they push onto a stack\r\n * every fill with `space:'parent'` and every motion-driven effect reads back\r\n * from. A custom node's `renderSelf` calling one would open a scope nothing\r\n * closes — and since `renderSelf` is handed a {@link RenderContext2D}, it now\r\n * cannot.\r\n *\r\n * Every backend implements this; a host driving a render pass holds one.\r\n *\r\n * @internal\r\n */\r\nexport interface RenderPass2D extends RenderContext2D {\r\n /**\r\n * Open a node draw scope. Must be paired with `end()`, also when the scope\r\n * throws. Pushes the node's id and {@link NodeRenderState} (gradient-space\r\n * rects + per-frame motion) for the duration of the scope.\r\n */\r\n begin(state: NodeRenderState): void;\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"render-context2d.js","sourceRoot":"","sources":["../../src/render/render-context2d.ts"],"names":[],"mappings":"","sourcesContent":["import type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { MeasureContext2D } from \"./measure-context\";\r\nimport type { TextState } from \"./descriptors/text\";\r\nimport type { TextBlockLayout } from \"./text-layout\";\r\nimport type { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\n\r\n/**\r\n * Where an effect scope draws: `'foreground'` warps/filters the node's *own*\r\n * content (its fill, stroke and children), `'backdrop'` warps/filters the canvas\r\n * content already painted *beneath* the node (clipped to its silhouette). See\r\n * {@link RenderContext2D.beginEffects}.\r\n */\r\nexport type EffectTarget = \"foreground\" | \"backdrop\";\r\n\r\n/**\r\n * Pixels produced by {@link RenderContext2D.rasterize}: RGBA8888,\r\n * unpremultiplied, top-down (canvas row order). `width`/`height` are **device**\r\n * px, so they reflect the pixel ratio the renderer actually used rather than the\r\n * logical size that was asked for.\r\n */\r\nexport interface RasterizedSurface {\r\n pixels: Uint8Array;\r\n width: number;\r\n height: number;\r\n}\r\n\r\n/**\r\n * A bounding box in the current node's local space (origin = the node's\r\n * layout-cell centre, the same space shapes are drawn in). `left/top` use the\r\n * canvas convention (y down).\r\n */\r\nexport interface SpaceRect {\r\n left: number;\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n}\r\n\r\n/**\r\n * Reference rects a fill can resolve against, supplied per-node at `begin()`.\r\n * `local` is derived from the drawn shapes themselves and `global` (the\r\n * viewport) is computed by the renderer from the surface size, so only the\r\n * parent frame is passed here.\r\n */\r\nexport interface SpaceRects {\r\n /** The parent node's content rect, in this node's local space. */\r\n parent?: SpaceRect;\r\n}\r\n\r\n/**\r\n * Per-node state supplied to {@link RenderContext2D.begin} for the duration of a\r\n * node's draw scope. Carries the node identity and gradient-space `rects` plus\r\n * the node's per-frame motion, sampled at render time. Motion-driven effects\r\n * (e.g. motion blur) read the current node's `velocity` from this state instead\r\n * of being authored with a fixed direction.\r\n *\r\n * Velocity fields are `0`/`{0,0}` when the motion is unknown — the first frame a\r\n * node renders, or after a time discontinuity (scrub/seek) where no trustworthy\r\n * delta exists.\r\n */\r\nexport interface NodeRenderState {\r\n /** Stable node identifier. */\r\n id: string;\r\n /** Parent / viewport rects in this node's local space. */\r\n rects: SpaceRects;\r\n /** How long this node has existed, in seconds (`NodeTime.elapsed`). */\r\n elapsed: number;\r\n /** The frame delta, in seconds, used to derive displacement from velocity. */\r\n dt: number;\r\n /** Translational velocity in px/sec, world space (y-down). `{0,0}` when unknown. */\r\n velocity: Vector2;\r\n /** Heading of `velocity` in degrees (`atan2(vy, vx)`). `0` when unknown. */\r\n direction: number;\r\n /** Magnitude of `velocity` in px/sec. `0` when unknown. */\r\n speed: number;\r\n /** Rotational velocity in degrees/sec. `0` when unknown. Reserved for radial motion blur. */\r\n angularVelocity: number;\r\n /** Scale velocity in scale-units/sec. `0` when unknown. Reserved for zoom motion blur. */\r\n scaleVelocity: number;\r\n}\r\n\r\n/**\r\n * The drawing surface a `Node2D` paints into — **the whole of what a node may\r\n * ask of a renderer, and nothing else.**\r\n *\r\n * Shapes are never declared directly on the context: they are built with a\r\n * {@link Graphics2D} command list and submitted via {@link draw}. Multiple\r\n * shapes chained on one `Graphics2D` before a paint call are combined into a\r\n * single surface and painted together:\r\n *\r\n * ctx.draw(new Graphics2D().ellipse(...).rect(...).fill(...)); // shared surface\r\n *\r\n * On top of that it carries text measurement — it extends {@link MeasureContext2D}, so\r\n * a node measures and draws through one object — and the higher-level scoping\r\n * operations: transforms, masks, clips, camera, boolean ops, effect scopes.\r\n * `begin(state)` / `end()` bracket each node's draw call so the context can\r\n * track which node is active.\r\n *\r\n * **An interface, with `CanvasRenderContext2D` as its one base class.** What a\r\n * node calls and what a *host* calls are different lists: `execute`,\r\n * `screenshot`, `unmount` and `dispose` drive a render pass and have no business\r\n * being reachable from inside one. Splitting them is what keeps this surface\r\n * the size it is. Every real backend still extends the class, which preserves\r\n * the `draw` to `drawGraphics` invariant that gives them all one implementation\r\n * of text-default resolution.\r\n *\r\n * `RenderContext3D` is its sibling, not its subclass: the two share no members,\r\n * because a 3D scene is described with lights, a camera and meshes rather than\r\n * with paths and paint.\r\n */\r\nexport interface RenderContext2D extends MeasureContext2D {\r\n measureText(\r\n text: string,\r\n fontSize: number,\r\n fontFamily: string,\r\n fontWeight?: number,\r\n letterSpacing?: number,\r\n fontStyle?: FontStyle,\r\n ): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Set text-style defaults for everything drawn until the matching\r\n * {@link popTextStyle} — the drawn-graphics half of `<DefaultTextStyle>`.\r\n *\r\n * `style` is **merged** onto the defaults already in effect, per key, so\r\n * nesting accumulates the way the node channel does: an outer scope's\r\n * `fontFamily` and an inner scope's `fontSize` both apply, and a key set by\r\n * both takes the inner value. Values are resolved (a tweened `fontSize`\r\n * arrives as this frame's number), not callbacks.\r\n *\r\n * Pass `null` to open a scope that inherits **nothing** — not the enclosing\r\n * defaults and not the project's `theme.typography.default`. That is for a\r\n * node whose text is its own vocabulary rather than the document's: `Code`\r\n * does it so a scene-wide serif face doesn't reflow a monospaced code block.\r\n *\r\n * Always pair with `popTextStyle()` in a `finally`; the stack is shared with\r\n * every sibling drawn afterwards.\r\n */\r\n pushTextStyle(style: TextStyle | null): void;\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void;\r\n\r\n /**\r\n * The text-style defaults in effect right now: the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open — the same preset a `Text` node falls back to, so a\r\n * drawn label and a node label agree on the project's base typography.\r\n */\r\n readonly defaultTextStyle: TextStyle;\r\n\r\n /**\r\n * Replay a built `Graphics2D` against this context.\r\n *\r\n * Resolves the ambient text defaults onto the op list before handing it to\r\n * the backend, which is what keeps the real renderer and the precomp asset\r\n * walk agreeing on which font an under-specified `text` op shapes with: a\r\n * family that one resolves and the other does not is a font that never loads\r\n * and glyphs that never paint.\r\n */\r\n draw(graphics: Graphics2D): void;\r\n\r\n /**\r\n * Lay `state` out the way it would be drawn and report where every character\r\n * landed — see {@link TextBlockLayout} for the space and the caret model.\r\n *\r\n * This is what makes on-canvas text editing possible: glyph positions live\r\n * in the backend's shaper, so a host drawing its own caret and selection has\r\n * no way to compute them, and anything it approximates in the DOM disagrees\r\n * with the render as soon as the font, the line height or the wrapping does.\r\n *\r\n * Takes the whole {@link TextState} rather than a handful of font fields\r\n * because the resolution a caret has to agree with lives in the backend:\r\n * `'autofit'` picks a size from the box, `wrap` turns the width into a wrap\r\n * limit, and `textAlign` places the lines within it. Handing over the same\r\n * descriptor that gets drawn is what keeps the two from drifting apart.\r\n *\r\n * Returns `null` when the backend cannot measure this — the default, so a\r\n * backend that never needed glyph positions keeps working, and for cases no\r\n * caret model fits: text-on-path (glyphs follow a curve, not a line box) and\r\n * a block drawn in styled segments.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null;\r\n\r\n /**\r\n * Push a transform (position, rotation, scale, opacity, …) and return the\r\n * context so subsequent draw calls are issued in the transformed space. The\r\n * transform is popped when `end()` is called for the node that pushed it.\r\n */\r\n transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n /**\r\n * Open a boolean-path collection scope. Shapes drawn until `endBoolean()`\r\n * are gathered (fills/strokes suppressed) and combined with `op`. After\r\n * `endBoolean()` the merged path is left as the active surface, so a\r\n * paint-only `Graphics2D` (`new Graphics2D().fill(...).stroke(...)`)\r\n * submitted via `draw()` styles the combined result.\r\n */\r\n beginBoolean(op: BooleanOperation): void;\r\n endBoolean(): void;\r\n\r\n // Mask scope (imperative) — used by MaskGroup and other node-level callers\r\n // that manage the scope with explicit begin/apply/end:\r\n //\r\n // beginMask({ mode, inverted })\r\n // <render mask child> // child draws its own Graphics2D\r\n // applyMask()\r\n // <render content children> // children draw their own Graphics2D\r\n // endMask()\r\n //\r\n // The chain-friendly form lives on `Graphics2D` (`.mask().applyMask().endMask()`)\r\n // for inline use within a single `draw()`.\r\n //\r\n // For `vector` mode the mask child's path is collected and used as a\r\n // clipPath; fills/strokes are suppressed. For `alpha` and `luminance`\r\n // the mask is rendered into an offscreen layer and combined with content\r\n // via blend modes.\r\n beginMask(options?: MaskOptions): void;\r\n applyMask(): void;\r\n endMask(): void;\r\n\r\n /**\r\n * Push a clip region built from a {@link Clip} command list. The clip's\r\n * shapes are unioned (with `cut()`s subtracted) into a single path and\r\n * intersected with the active clip, so children are confined to that\r\n * compound outline — any silhouette, not just a rect or ellipse. Used both\r\n * for a node's `clip` boundary and to confine backdrop effects (blur,\r\n * magnify) to the node's exact shape. Paired with `endClip()`.\r\n */\r\n beginClip(clip: Clip): void;\r\n /** Pop the most-recently pushed clip region. */\r\n endClip(): void;\r\n\r\n /**\r\n * Open an effect scope over the node, applying `effects` to either the node's\r\n * own content or the content beneath it. Paired with {@link endEffects}.\r\n *\r\n * `target`:\r\n * - `'foreground'` — warps/filters the node's *own* drawing (its fill, stroke\r\n * and children captured between begin/end), like blur. Used for bulge and\r\n * foreground posterize.\r\n * - `'backdrop'` — warps/filters the canvas content already painted *beneath*\r\n * the node, clipped to the active silhouette clip, so the node's own edges\r\n * stay sharp (Figma-style). Used for backdrop-flagged filters (blur,\r\n * grayscale, pixelate, …), magnify, backdrop posterize, and backdrop SkSL.\r\n *\r\n * The renderer decides per effect whether to compose it as an `ImageFilter`\r\n * or run it as a snapshot/redraw shader — callers never route by effect type.\r\n * `width`/`height` are the node's logical size, for size-relative effects\r\n * (e.g. pixelate) and shader lens boxes.\r\n */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void;\r\n endEffects(): void;\r\n\r\n /**\r\n * Draw `draw` into an offscreen buffer instead of onto the canvas, and hand\r\n * back its pixels. The buffer is `width` × `height` **logical** px with its\r\n * origin at the centre, matching the space a node draws in — so `draw` can be\r\n * an ordinary `render()` call on a node subtree and needs no special casing.\r\n *\r\n * This is what backs `Tex.surface`: `Canvas3D` rasterizes each of its 2D\r\n * sources through here, then hands the pixels to the 3D backend as a texture.\r\n * It runs *inside* the frame that consumes it, so a scrubbed frame is\r\n * identical to a played one.\r\n *\r\n * Returns `null` when the backend cannot rasterize offscreen — the material\r\n * then renders without that map. `pixelRatio` is a ceiling on the buffer's\r\n * device-pixel scale, not a guarantee; the renderer may clamp it.\r\n */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null;\r\n\r\n /**\r\n * Push a camera viewport. Clips to `viewport` (canvas-space, centred\r\n * coords) and applies the inverse camera transform so children render as\r\n * seen through the lens. `heading` rotates the world counter to the camera\r\n * angle. Paired with `endCamera()`.\r\n *\r\n * @param viewport Bounding rect of the camera node in canvas space.\r\n * @param lookAt World-space point the camera looks at.\r\n * @param zoom Uniform scale applied around `lookAt`.\r\n * @param heading Camera rotation in degrees.\r\n */\r\n beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n endCamera(): void;\r\n\r\n /**\r\n * Whether this context ever reads `NodeRenderState.rects`.\r\n *\r\n * True for anything that actually paints, since a fill with `space:'parent'`\r\n * resolves against them. A context that only inspects *what* would be drawn\r\n * never looks at them, and computing them costs an object allocation per node\r\n * per frame. Nodes check this before doing that work; see `Node2D.renderState`.\r\n */\r\n readonly readsSpaceRects: boolean;\r\n\r\n /**\r\n * Whether this context only cares about *visible* output.\r\n *\r\n * True for anything that paints: a subtree at zero opacity contributes no\r\n * pixels, so walking it produces draw calls the rasterizer will discard.\r\n *\r\n * A context that inspects rather than paints sets this `false`, and that is\r\n * the whole reason this is a capability rather than an unconditional check:\r\n * such a walk exists to discover which images, videos, fonts and effects a\r\n * frame *references* — regardless of whether they can be seen. An invisible\r\n * node's font still has to load, because it may fade in two frames later and\r\n * glyphs that were never registered never paint. Skipping it there is not an\r\n * optimisation, it is a missing asset.\r\n *\r\n * Same shape and same reasoning as {@link readsSpaceRects}: the context\r\n * declares what it needs, and nodes check before doing work that would be\r\n * thrown away. See `Node2D.render`.\r\n */\r\n readonly drawsVisibleOnly: boolean;\r\n\r\n}\r\n\r\n/**\r\n * A render *pass*: a {@link RenderContext2D} plus the per-node scope bracket the\r\n * walk opens around each node.\r\n *\r\n * Split off from the drawing surface because the two have different callers.\r\n * `begin`/`end` are `Node2D.render`'s, once per node, and they push onto a stack\r\n * every fill with `space:'parent'` and every motion-driven effect reads back\r\n * from. A custom node's `renderSelf` calling one would open a scope nothing\r\n * closes — and since `renderSelf` is handed a {@link RenderContext2D}, it now\r\n * cannot.\r\n *\r\n * Every backend implements this; a host driving a render pass holds one.\r\n *\r\n * @internal\r\n */\r\nexport interface RenderPass2D extends RenderContext2D {\r\n /**\r\n * Open a node draw scope. Must be paired with `end()`, also when the scope\r\n * throws. Pushes the node's id and {@link NodeRenderState} (gradient-space\r\n * rects + per-frame motion) for the duration of the scope.\r\n */\r\n begin(state: NodeRenderState): void;\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void;\r\n}\r\n"]}
|
|
@@ -96,7 +96,7 @@ export declare const Tex: {
|
|
|
96
96
|
* const scope = new Graphics2D().line({ points: trace(phase()) }).stroke(…);
|
|
97
97
|
* g3.plane({ fill: scope }); // sized for you
|
|
98
98
|
*
|
|
99
|
-
* const stats =
|
|
99
|
+
* const stats = new Rect({ flow: "vertical", padding: 48, children: [Text({ text: "CPU" })] });
|
|
100
100
|
* g3.plane({ fill: Tex.surface(stats, { width: 1024, height: 640 }) });
|
|
101
101
|
*
|
|
102
102
|
* `width`/`height` are the buffer's resolution and default to 512. A source
|