@pairdraw/core 0.19.2 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/providers.d.ts +6 -0
- package/dist/ai/providers.d.ts.map +1 -1
- package/dist/ai/providers.js.map +1 -1
- package/dist/cache/resource.d.ts +8 -1
- package/dist/cache/resource.d.ts.map +1 -1
- package/dist/cache/resource.js +18 -0
- package/dist/cache/resource.js.map +1 -1
- package/dist/canvas/effects.d.ts +6 -4
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +37 -34
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +12 -8
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/images/adjustments.d.ts +18 -0
- package/dist/canvas/images/adjustments.d.ts.map +1 -0
- package/dist/canvas/images/adjustments.js +184 -0
- package/dist/canvas/images/adjustments.js.map +1 -0
- package/dist/canvas/images/sampling.d.ts +13 -0
- package/dist/canvas/images/sampling.d.ts.map +1 -0
- package/dist/canvas/images/sampling.js +49 -0
- package/dist/canvas/images/sampling.js.map +1 -0
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/masks.d.ts +1 -1
- package/dist/canvas/masks.d.ts.map +1 -1
- package/dist/canvas/masks.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +15 -0
- package/dist/canvas/noise/render.d.ts.map +1 -0
- package/dist/canvas/noise/render.js +56 -0
- package/dist/canvas/noise/render.js.map +1 -0
- package/dist/canvas/noise/shader.d.ts +46 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +166 -0
- package/dist/canvas/noise/shader.js.map +1 -0
- package/dist/canvas/noise/table.d.ts +13 -0
- package/dist/canvas/noise/table.d.ts.map +1 -0
- package/dist/canvas/noise/table.js +408 -0
- package/dist/canvas/noise/table.js.map +1 -0
- package/dist/canvas/noise/tile.d.ts +22 -0
- package/dist/canvas/noise/tile.d.ts.map +1 -0
- package/dist/canvas/noise/tile.js +74 -0
- package/dist/canvas/noise/tile.js.map +1 -0
- package/dist/canvas/outline-stroke.js +1 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +31 -71
- package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/colors.d.ts +20 -5
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +48 -42
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/document-surface.d.ts +25 -0
- package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
- package/dist/canvas/renderer/document-surface.js +46 -0
- package/dist/canvas/renderer/document-surface.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +6 -4
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +10 -3
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -0
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +36 -3
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/play-scenes.d.ts +13 -0
- package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
- package/dist/canvas/renderer/play-scenes.js +40 -0
- package/dist/canvas/renderer/play-scenes.js.map +1 -0
- package/dist/canvas/renderer/retained-backing.d.ts.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +2 -1
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
- package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/cache.js +32 -1
- package/dist/canvas/renderer/tiles/cache.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +18 -1
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/index.d.ts +2 -2
- package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -3
- package/dist/canvas/renderer/types.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
- package/dist/canvas/renderer/visual-bounds.js +1 -1
- package/dist/canvas/renderer.d.ts +42 -4
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +57 -5
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +45 -12
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +2 -1
- package/dist/canvas/shaders/effect.js.map +1 -1
- package/dist/canvas/shadows/shape.d.ts.map +1 -1
- package/dist/canvas/shadows/shape.js +4 -2
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +4 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/decorations.d.ts +2 -2
- package/dist/canvas/text/decorations.d.ts.map +1 -1
- package/dist/canvas/text/decorations.js +5 -5
- package/dist/canvas/text/decorations.js.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +2 -2
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -5
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -1
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +4 -4
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +101 -0
- package/dist/canvas/texture.js.map +1 -0
- package/dist/clipboard.js +16 -5
- package/dist/clipboard.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/design-memory/check.d.ts +90 -0
- package/dist/design-memory/check.d.ts.map +1 -0
- package/dist/design-memory/check.js +281 -0
- package/dist/design-memory/check.js.map +1 -0
- package/dist/design-memory/describe.d.ts +37 -0
- package/dist/design-memory/describe.d.ts.map +1 -0
- package/dist/design-memory/describe.js +52 -0
- package/dist/design-memory/describe.js.map +1 -0
- package/dist/design-memory/distil.d.ts +22 -0
- package/dist/design-memory/distil.d.ts.map +1 -0
- package/dist/design-memory/distil.js +54 -0
- package/dist/design-memory/distil.js.map +1 -0
- package/dist/design-memory/document.d.ts +12 -0
- package/dist/design-memory/document.d.ts.map +1 -0
- package/dist/design-memory/document.js +64 -0
- package/dist/design-memory/document.js.map +1 -0
- package/dist/design-memory/guard.d.ts +48 -0
- package/dist/design-memory/guard.d.ts.map +1 -0
- package/dist/design-memory/guard.js +105 -0
- package/dist/design-memory/guard.js.map +1 -0
- package/dist/design-memory/index.d.ts +9 -0
- package/dist/design-memory/index.js +9 -0
- package/dist/design-memory/refusal.d.ts +32 -0
- package/dist/design-memory/refusal.d.ts.map +1 -0
- package/dist/design-memory/refusal.js +68 -0
- package/dist/design-memory/refusal.js.map +1 -0
- package/dist/design-memory/rules.d.ts +63 -0
- package/dist/design-memory/rules.d.ts.map +1 -0
- package/dist/design-memory/rules.js +224 -0
- package/dist/design-memory/rules.js.map +1 -0
- package/dist/design-memory/values.d.ts +28 -0
- package/dist/design-memory/values.d.ts.map +1 -0
- package/dist/design-memory/values.js +160 -0
- package/dist/design-memory/values.js.map +1 -0
- package/dist/editor/alignment.js +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/clipboard/assets.d.ts.map +1 -1
- package/dist/editor/clipboard/assets.js +3 -3
- package/dist/editor/clipboard/assets.js.map +1 -1
- package/dist/editor/clipboard/component-matches.d.ts +13 -0
- package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
- package/dist/editor/clipboard/component-matches.js +50 -0
- package/dist/editor/clipboard/component-matches.js.map +1 -0
- package/dist/editor/clipboard/dependencies.d.ts +7 -0
- package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
- package/dist/editor/clipboard/dependencies.js +5 -0
- package/dist/editor/clipboard/dependencies.js.map +1 -1
- package/dist/editor/clipboard/export.d.ts.map +1 -1
- package/dist/editor/clipboard/export.js +16 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/placement.d.ts +1 -1
- package/dist/editor/clipboard/placement.js +1 -1
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +48 -19
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +22 -1
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -3
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/connectors/attach.js +1 -1
- package/dist/editor/create.d.ts +26 -2
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +16 -60
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/design-memory.d.ts +11 -0
- package/dist/editor/design-memory.d.ts.map +1 -0
- package/dist/editor/design-memory.js +40 -0
- package/dist/editor/design-memory.js.map +1 -0
- package/dist/editor/design-tokens.d.ts +4 -0
- package/dist/editor/design-tokens.d.ts.map +1 -1
- package/dist/editor/design-tokens.js +30 -1
- package/dist/editor/design-tokens.js.map +1 -1
- package/dist/editor/document-colors.d.ts +23 -0
- package/dist/editor/document-colors.d.ts.map +1 -0
- package/dist/editor/document-colors.js +53 -0
- package/dist/editor/document-colors.js.map +1 -0
- package/dist/editor/eyedropper.d.ts +47 -0
- package/dist/editor/eyedropper.d.ts.map +1 -0
- package/dist/editor/eyedropper.js +171 -0
- package/dist/editor/eyedropper.js.map +1 -0
- package/dist/editor/fonts.d.ts +9 -0
- package/dist/editor/fonts.d.ts.map +1 -0
- package/dist/editor/fonts.js +14 -0
- package/dist/editor/fonts.js.map +1 -0
- package/dist/editor/history/atomic-tool.d.ts +9 -2
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +9 -2
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/history/capture.d.ts +13 -0
- package/dist/editor/history/capture.d.ts.map +1 -0
- package/dist/editor/history/capture.js +28 -0
- package/dist/editor/history/capture.js.map +1 -0
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +2 -22
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts +7 -0
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +4 -2
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/subtree.d.ts +9 -0
- package/dist/editor/history/subtree.d.ts.map +1 -1
- package/dist/editor/history/subtree.js +12 -2
- package/dist/editor/history/subtree.js.map +1 -1
- package/dist/editor/index.d.ts +4 -2
- package/dist/editor/index.js +4 -2
- package/dist/editor/pages.d.ts +7 -5
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +35 -25
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts +3 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +1 -1
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +4 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/render-requests.d.ts +18 -0
- package/dist/editor/render-requests.d.ts.map +1 -0
- package/dist/editor/render-requests.js +76 -0
- package/dist/editor/render-requests.js.map +1 -0
- package/dist/editor/scale/rescale.d.ts +1 -1
- package/dist/editor/selection/overlays.d.ts.map +1 -1
- package/dist/editor/selection/overlays.js +1 -1
- package/dist/editor/selection/overlays.js.map +1 -1
- package/dist/editor/selection/read.d.ts +4 -0
- package/dist/editor/selection.d.ts +5 -0
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pencil.js +1 -1
- package/dist/editor/structure/state.d.ts.map +1 -1
- package/dist/editor/structure/state.js +2 -2
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +2 -2
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/tool-registry.d.ts.map +1 -1
- package/dist/editor/tool-registry.js +2 -1
- package/dist/editor/tool-registry.js.map +1 -1
- package/dist/editor/types.d.ts +5 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.js +3 -3
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/variations/create.d.ts +28 -0
- package/dist/editor/variations/create.d.ts.map +1 -0
- package/dist/editor/variations/create.js +176 -0
- package/dist/editor/variations/create.js.map +1 -0
- package/dist/editor/variations/pick.d.ts +16 -0
- package/dist/editor/variations/pick.d.ts.map +1 -0
- package/dist/editor/variations/pick.js +23 -0
- package/dist/editor/variations/pick.js.map +1 -0
- package/dist/editor/variations.d.ts +28 -0
- package/dist/editor/variations.d.ts.map +1 -0
- package/dist/editor/variations.js +88 -0
- package/dist/editor/variations.js.map +1 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
- package/dist/figma-api/accessors/reactions.js +4 -1
- package/dist/figma-api/accessors/reactions.js.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -0
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
- package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
- package/dist/figma-api/accessors/text/opentype.js +28 -0
- package/dist/figma-api/accessors/text/opentype.js.map +1 -0
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +33 -0
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/effects.d.ts +79 -3
- package/dist/figma-api/effects.d.ts.map +1 -1
- package/dist/figma-api/effects.js +150 -9
- package/dist/figma-api/effects.js.map +1 -1
- package/dist/figma-api/fresh-read.d.ts +15 -0
- package/dist/figma-api/fresh-read.d.ts.map +1 -0
- package/dist/figma-api/fresh-read.js +54 -0
- package/dist/figma-api/fresh-read.js.map +1 -0
- package/dist/figma-api/graph-ref.d.ts +9 -0
- package/dist/figma-api/graph-ref.d.ts.map +1 -0
- package/dist/figma-api/graph-ref.js +14 -0
- package/dist/figma-api/graph-ref.js.map +1 -0
- package/dist/figma-api/index.d.ts +11 -1
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +16 -4
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +13 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +196 -4
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/paints.d.ts +3 -3
- package/dist/figma-api/paints.d.ts.map +1 -1
- package/dist/figma-api/paints.js +14 -4
- package/dist/figma-api/paints.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +3 -3
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +7 -3
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +1 -1
- package/dist/figma-api/pending-sync.d.ts.map +1 -1
- package/dist/figma-api/pending-sync.js +3 -1
- package/dist/figma-api/pending-sync.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +2 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +59 -15
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +160 -32
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/surface.d.ts +6 -3
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +6 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/figma-api/variables/index.d.ts.map +1 -1
- package/dist/figma-api/variables/index.js +2 -2
- package/dist/figma-api/variables/index.js.map +1 -1
- package/dist/geometry/figma.d.ts +1 -1
- package/dist/geometry/image-crop.d.ts +1 -1
- package/dist/geometry/image-crop.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/io/formats/boolean-path.d.ts +19 -0
- package/dist/io/formats/boolean-path.d.ts.map +1 -0
- package/dist/io/formats/boolean-path.js +47 -0
- package/dist/io/formats/boolean-path.js.map +1 -0
- package/dist/io/formats/design-tokens/css/known.js +1 -1
- package/dist/io/formats/design-tokens/css/known.js.map +1 -1
- package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
- package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/read.js +11 -5
- package/dist/io/formats/design-tokens/css/read.js.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.js +17 -4
- package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
- package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
- package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/values.js +24 -8
- package/dist/io/formats/design-tokens/css/values.js.map +1 -1
- package/dist/io/formats/design-tokens/decode.d.ts +7 -6
- package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/decode.js +14 -13
- package/dist/io/formats/design-tokens/decode.js.map +1 -1
- package/dist/io/formats/design-tokens/export.js +3 -3
- package/dist/io/formats/design-tokens/export.js.map +1 -1
- package/dist/io/formats/design-tokens/index.d.ts +4 -1
- package/dist/io/formats/design-tokens/index.js +4 -1
- package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
- package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -3
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +9 -9
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/project.d.ts +17 -2
- package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/project.js +29 -8
- package/dist/io/formats/design-tokens/project.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +4 -4
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +7 -7
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
- package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/apply.js +73 -0
- package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.js +391 -0
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.js +35 -0
- package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
- package/dist/io/formats/design-tokens/values.d.ts +10 -5
- package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/values.js +13 -7
- package/dist/io/formats/design-tokens/values.js.map +1 -1
- package/dist/io/formats/drawio/edges.d.ts +7 -1
- package/dist/io/formats/drawio/edges.d.ts.map +1 -1
- package/dist/io/formats/drawio/edges.js +54 -1
- package/dist/io/formats/drawio/edges.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +19 -2
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.js +1 -0
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/drawio/warnings.js +2 -2
- package/dist/io/formats/drawio/warnings.js.map +1 -1
- package/dist/io/formats/fig/export/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/index.js +15 -3
- package/dist/io/formats/fig/export/index.js.map +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +7 -1
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts +7 -2
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +12 -13
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +9 -7
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
- package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
- package/dist/io/formats/html/import.d.ts.map +1 -1
- package/dist/io/formats/html/import.js +3 -1
- package/dist/io/formats/html/import.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +2 -2
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +6 -4
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +4 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/layers.js +2 -2
- package/dist/io/formats/mermaid/layers.js.map +1 -1
- package/dist/io/formats/pdf/document.d.ts +3 -1
- package/dist/io/formats/pdf/document.d.ts.map +1 -1
- package/dist/io/formats/pdf/document.js +6 -3
- package/dist/io/formats/pdf/document.js.map +1 -1
- package/dist/io/formats/pdf/export.d.ts.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -0
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +4 -4
- package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
- package/dist/io/formats/pdf/prepare.js +2 -2
- package/dist/io/formats/pdf/prepare.js.map +1 -1
- package/dist/io/formats/pen/imports.d.ts +4 -1
- package/dist/io/formats/pen/imports.d.ts.map +1 -1
- package/dist/io/formats/pen/imports.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +35 -5
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/export.js +1 -1
- package/dist/io/formats/pptx/geometry.d.ts +1 -1
- package/dist/io/formats/pptx/style.js +1 -1
- package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
- package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
- package/dist/io/formats/raster/adjusted-images.js +118 -0
- package/dist/io/formats/raster/adjusted-images.js.map +1 -0
- package/dist/io/formats/raster/headless.d.ts +11 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +4 -4
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/pixels.d.ts +7 -1
- package/dist/io/formats/raster/pixels.d.ts.map +1 -1
- package/dist/io/formats/raster/pixels.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +13 -4
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +10 -8
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +13 -64
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.d.ts +16 -0
- package/dist/io/formats/svg/effects.d.ts.map +1 -0
- package/dist/io/formats/svg/effects.js +126 -0
- package/dist/io/formats/svg/effects.js.map +1 -0
- package/dist/io/formats/svg/export.d.ts +11 -2
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +177 -37
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +30 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +48 -0
- package/dist/io/formats/svg/filter.js.map +1 -0
- package/dist/io/formats/svg/grain.d.ts +26 -0
- package/dist/io/formats/svg/grain.d.ts.map +1 -0
- package/dist/io/formats/svg/grain.js +298 -0
- package/dist/io/formats/svg/grain.js.map +1 -0
- package/dist/io/formats/svg/import.d.ts +4 -2
- package/dist/io/formats/svg/import.d.ts.map +1 -1
- package/dist/io/formats/svg/import.js +2 -1
- package/dist/io/formats/svg/import.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +1 -2
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +8 -8
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.js +1 -1
- package/dist/io/formats/svg/text/layout.d.ts +5 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +8 -5
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/composite.d.ts +18 -0
- package/dist/io/formats/video/composite.d.ts.map +1 -0
- package/dist/io/formats/video/composite.js +79 -0
- package/dist/io/formats/video/composite.js.map +1 -0
- package/dist/io/formats/video/formats.d.ts +29 -0
- package/dist/io/formats/video/formats.d.ts.map +1 -0
- package/dist/io/formats/video/formats.js +43 -0
- package/dist/io/formats/video/formats.js.map +1 -0
- package/dist/io/formats/video/gif.d.ts +13 -0
- package/dist/io/formats/video/gif.d.ts.map +1 -0
- package/dist/io/formats/video/gif.js +56 -0
- package/dist/io/formats/video/gif.js.map +1 -0
- package/dist/io/formats/video/index.d.ts +9 -0
- package/dist/io/formats/video/index.js +9 -0
- package/dist/io/formats/video/plan.d.ts +64 -0
- package/dist/io/formats/video/plan.d.ts.map +1 -0
- package/dist/io/formats/video/plan.js +90 -0
- package/dist/io/formats/video/plan.js.map +1 -0
- package/dist/io/formats/video/record.d.ts +36 -0
- package/dist/io/formats/video/record.d.ts.map +1 -0
- package/dist/io/formats/video/record.js +154 -0
- package/dist/io/formats/video/record.js.map +1 -0
- package/dist/io/formats/video/sink.d.ts +29 -0
- package/dist/io/formats/video/sink.d.ts.map +1 -0
- package/dist/io/formats/video/sink.js +16 -0
- package/dist/io/formats/video/sink.js.map +1 -0
- package/dist/io/formats/video/size.d.ts +19 -0
- package/dist/io/formats/video/size.d.ts.map +1 -0
- package/dist/io/formats/video/size.js +26 -0
- package/dist/io/formats/video/size.js.map +1 -0
- package/dist/io/formats/video/webcodecs.d.ts +18 -0
- package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
- package/dist/io/formats/video/webcodecs.js +74 -0
- package/dist/io/formats/video/webcodecs.js.map +1 -0
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +41 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +1 -1
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +20 -5
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/kiwi/fig/session/options.d.ts +3 -0
- package/dist/kiwi/fig/session/options.d.ts.map +1 -1
- package/dist/kiwi/fig/session/options.js +4 -0
- package/dist/kiwi/fig/session/options.js.map +1 -1
- package/dist/layout/auto-layout-handles.d.ts +66 -0
- package/dist/layout/auto-layout-handles.d.ts.map +1 -0
- package/dist/layout/auto-layout-handles.js +291 -0
- package/dist/layout/auto-layout-handles.js.map +1 -0
- package/dist/layout/yoga-helpers.d.ts +2 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +7 -1
- package/dist/layout/yoga-helpers.js.map +1 -1
- package/dist/layout.d.ts +3 -2
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +26 -2
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +10 -4
- package/dist/lint/fixes.js.map +1 -1
- package/dist/lint/index.d.ts +3 -2
- package/dist/lint/index.js +2 -1
- package/dist/lint/linter.d.ts +12 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +112 -10
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/presets.d.ts.map +1 -1
- package/dist/lint/presets.js +2 -0
- package/dist/lint/presets.js.map +1 -1
- package/dist/lint/rules/design-memory.d.ts +15 -0
- package/dist/lint/rules/design-memory.d.ts.map +1 -0
- package/dist/lint/rules/design-memory.js +90 -0
- package/dist/lint/rules/design-memory.js.map +1 -0
- package/dist/lint/rules/index.d.ts +6 -5
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lint/rules/index.js +6 -2
- package/dist/lint/rules/index.js.map +1 -1
- package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
- package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
- package/dist/lint/rules/no-unbound-token-values.js +79 -0
- package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
- package/dist/lint/types.d.ts +25 -2
- package/dist/lint/types.d.ts.map +1 -1
- package/dist/node/video.d.ts +12 -0
- package/dist/node/video.d.ts.map +1 -0
- package/dist/node/video.js +206 -0
- package/dist/node/video.js.map +1 -0
- package/dist/pairdraw-api/comments.d.ts +4 -1
- package/dist/pairdraw-api/comments.d.ts.map +1 -1
- package/dist/pairdraw-api/comments.js +5 -0
- package/dist/pairdraw-api/comments.js.map +1 -1
- package/dist/pairdraw-api/design-memory.d.ts +19 -0
- package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
- package/dist/pairdraw-api/design-memory.js +39 -0
- package/dist/pairdraw-api/design-memory.js.map +1 -0
- package/dist/pairdraw-api/index.d.ts +48 -4
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +59 -6
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +13 -2
- package/dist/pairdraw-api/nodes.d.ts.map +1 -1
- package/dist/pairdraw-api/nodes.js +28 -1
- package/dist/pairdraw-api/nodes.js.map +1 -1
- package/dist/pairdraw-api/variations.d.ts +48 -0
- package/dist/pairdraw-api/variations.d.ts.map +1 -0
- package/dist/pairdraw-api/variations.js +76 -0
- package/dist/pairdraw-api/variations.js.map +1 -0
- package/dist/prototype/easing.d.ts +13 -0
- package/dist/prototype/easing.d.ts.map +1 -0
- package/dist/prototype/easing.js +36 -0
- package/dist/prototype/easing.js.map +1 -0
- package/dist/prototype/frames.d.ts +10 -0
- package/dist/prototype/frames.d.ts.map +1 -0
- package/dist/prototype/frames.js +12 -0
- package/dist/prototype/frames.js.map +1 -0
- package/dist/prototype/hit.d.ts +17 -0
- package/dist/prototype/hit.d.ts.map +1 -0
- package/dist/prototype/hit.js +45 -0
- package/dist/prototype/hit.js.map +1 -0
- package/dist/prototype/index.d.ts +14 -0
- package/dist/prototype/index.js +14 -0
- package/dist/prototype/pointer.d.ts +63 -0
- package/dist/prototype/pointer.d.ts.map +1 -0
- package/dist/prototype/pointer.js +104 -0
- package/dist/prototype/pointer.js.map +1 -0
- package/dist/prototype/reactions.d.ts +45 -0
- package/dist/prototype/reactions.d.ts.map +1 -0
- package/dist/prototype/reactions.js +122 -0
- package/dist/prototype/reactions.js.map +1 -0
- package/dist/prototype/scene.d.ts +35 -0
- package/dist/prototype/scene.d.ts.map +1 -0
- package/dist/prototype/scene.js +86 -0
- package/dist/prototype/scene.js.map +1 -0
- package/dist/prototype/scenes.d.ts +81 -0
- package/dist/prototype/scenes.d.ts.map +1 -0
- package/dist/prototype/scenes.js +175 -0
- package/dist/prototype/scenes.js.map +1 -0
- package/dist/prototype/scroll.d.ts +48 -0
- package/dist/prototype/scroll.d.ts.map +1 -0
- package/dist/prototype/scroll.js +159 -0
- package/dist/prototype/scroll.js.map +1 -0
- package/dist/prototype/session.d.ts +71 -0
- package/dist/prototype/session.d.ts.map +1 -0
- package/dist/prototype/session.js +135 -0
- package/dist/prototype/session.js.map +1 -0
- package/dist/prototype/smart-animate/animation.d.ts +34 -0
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
- package/dist/prototype/smart-animate/animation.js +212 -0
- package/dist/prototype/smart-animate/animation.js.map +1 -0
- package/dist/prototype/smart-animate/match.d.ts +24 -0
- package/dist/prototype/smart-animate/match.d.ts.map +1 -0
- package/dist/prototype/smart-animate/match.js +72 -0
- package/dist/prototype/smart-animate/match.js.map +1 -0
- package/dist/prototype/snapshot.d.ts +19 -0
- package/dist/prototype/snapshot.d.ts.map +1 -0
- package/dist/prototype/snapshot.js +56 -0
- package/dist/prototype/snapshot.js.map +1 -0
- package/dist/prototype/timeline.d.ts +132 -0
- package/dist/prototype/timeline.d.ts.map +1 -0
- package/dist/prototype/timeline.js +260 -0
- package/dist/prototype/timeline.js.map +1 -0
- package/dist/rpc/analyze-commands.js +1 -1
- package/dist/rpc/read-commands.d.ts +2 -2
- package/dist/rpc/read-commands.js +2 -2
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/rpc/variables-command.js +2 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/font/features.d.ts +9 -0
- package/dist/text/font/features.d.ts.map +1 -0
- package/dist/text/font/features.js +27 -0
- package/dist/text/font/features.js.map +1 -0
- package/dist/text/font/manager.d.ts +12 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +60 -1
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/provider.d.ts +15 -0
- package/dist/text/font/provider.d.ts.map +1 -0
- package/dist/text/font/provider.js +18 -0
- package/dist/text/font/provider.js.map +1 -0
- package/dist/text/font/readiness.d.ts +32 -0
- package/dist/text/font/readiness.d.ts.map +1 -0
- package/dist/text/font/{status.js → readiness.js} +8 -4
- package/dist/text/font/readiness.js.map +1 -0
- package/dist/text/index.d.ts +12 -9
- package/dist/text/index.js +6 -3
- package/dist/text/prepare.d.ts +9 -4
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +9 -4
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/replace-fonts.d.ts +41 -0
- package/dist/text/replace-fonts.d.ts.map +1 -0
- package/dist/text/replace-fonts.js +121 -0
- package/dist/text/replace-fonts.js.map +1 -0
- package/dist/tools/analyze/colors.js +1 -1
- package/dist/tools/analyze/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +192 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze/responsive/widths.d.ts +27 -0
- package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/widths.js +49 -0
- package/dist/tools/analyze/responsive/widths.js.map +1 -0
- package/dist/tools/analyze.d.ts +3 -1
- package/dist/tools/analyze.js +3 -1
- package/dist/tools/codegen/token-sync.d.ts +7 -0
- package/dist/tools/codegen/token-sync.d.ts.map +1 -0
- package/dist/tools/codegen/token-sync.js +85 -0
- package/dist/tools/codegen/token-sync.js.map +1 -0
- package/dist/tools/codegen/tokens.d.ts +1 -1
- package/dist/tools/codegen/tokens.d.ts.map +1 -1
- package/dist/tools/codegen/tokens.js +2 -2
- package/dist/tools/codegen/tokens.js.map +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +2 -2
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/component-catalog.d.ts.map +1 -1
- package/dist/tools/component-catalog.js +5 -3
- package/dist/tools/component-catalog.js.map +1 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +4 -0
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +2 -3
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +2 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +1 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/svg.js +5 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +2 -2
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/css/shorthand.d.ts +20 -0
- package/dist/tools/css/shorthand.d.ts.map +1 -0
- package/dist/tools/css/shorthand.js +54 -0
- package/dist/tools/css/shorthand.js.map +1 -0
- package/dist/tools/describe/index.js +2 -2
- package/dist/tools/describe/index.js.map +1 -1
- package/dist/tools/describe/issues.js +1 -1
- package/dist/tools/design-memory.d.ts +8 -0
- package/dist/tools/design-memory.d.ts.map +1 -0
- package/dist/tools/design-memory.js +68 -0
- package/dist/tools/design-memory.js.map +1 -0
- package/dist/tools/html-host.d.ts.map +1 -1
- package/dist/tools/html-host.js +5 -3
- package/dist/tools/html-host.js.map +1 -1
- package/dist/tools/image-ai/apply.d.ts.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -3
- package/dist/tools/image-ai/apply.js.map +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +2 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/image-ai/service.d.ts.map +1 -1
- package/dist/tools/image-ai/service.js +5 -3
- package/dist/tools/image-ai/service.js.map +1 -1
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.js +3 -1
- package/dist/tools/modify/effects.js +1 -1
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/fonts.d.ts +6 -0
- package/dist/tools/modify/fonts.d.ts.map +1 -0
- package/dist/tools/modify/fonts.js +27 -0
- package/dist/tools/modify/fonts.js.map +1 -0
- package/dist/tools/modify/geometry.d.ts.map +1 -1
- package/dist/tools/modify/geometry.js +14 -3
- package/dist/tools/modify/geometry.js.map +1 -1
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +35 -8
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +10 -10
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +56 -4
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +2 -2
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +29 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts +10 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +34 -3
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/prompts/codegen.js +1 -1
- package/dist/tools/prompts/codegen.js.map +1 -1
- package/dist/tools/read/css.d.ts +14 -0
- package/dist/tools/read/css.d.ts.map +1 -0
- package/dist/tools/read/css.js +306 -0
- package/dist/tools/read/css.js.map +1 -0
- package/dist/tools/read/fonts.d.ts.map +1 -1
- package/dist/tools/read/fonts.js +17 -2
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.js +1 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/reactions.js +1 -1
- package/dist/tools/read/reactions.js.map +1 -1
- package/dist/tools/read/space.d.ts +3 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +4 -5
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.d.ts.map +1 -1
- package/dist/tools/registry/core.js +5 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +16 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +24 -6
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +10 -6
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script/host.d.ts.map +1 -1
- package/dist/tools/script/host.js +5 -3
- package/dist/tools/script/host.js.map +1 -1
- package/dist/tools/stock-photo.js +1 -0
- package/dist/tools/stock-photo.js.map +1 -1
- package/dist/tools/structure/basic.d.ts.map +1 -1
- package/dist/tools/structure/basic.js +1 -0
- package/dist/tools/structure/basic.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +8 -1
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/structure/hierarchy.d.ts.map +1 -1
- package/dist/tools/structure/hierarchy.js +4 -0
- package/dist/tools/structure/hierarchy.js.map +1 -1
- package/dist/tools/structure/variations.d.ts +8 -0
- package/dist/tools/structure/variations.d.ts.map +1 -0
- package/dist/tools/structure/variations.js +106 -0
- package/dist/tools/structure/variations.js.map +1 -0
- package/dist/tools/structure.d.ts +2 -1
- package/dist/tools/structure.js +2 -1
- package/dist/tools/styles/types.d.ts +2 -4
- package/dist/tools/styles/types.d.ts.map +1 -1
- package/dist/tools/styles/types.js.map +1 -1
- package/dist/tools/variables/collections.js +1 -1
- package/dist/tools/variables/collections.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -4
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/boolean.d.ts.map +1 -1
- package/dist/tools/vector/boolean.js +4 -0
- package/dist/tools/vector/boolean.js.map +1 -1
- package/dist/tools/vector/vectorize.d.ts.map +1 -1
- package/dist/tools/vector/vectorize.js +7 -4
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/vector/video.d.ts +6 -0
- package/dist/tools/vector/video.d.ts.map +1 -0
- package/dist/tools/vector/video.js +133 -0
- package/dist/tools/vector/video.js.map +1 -0
- package/dist/tools/vector.d.ts +2 -1
- package/dist/tools/vector.js +2 -1
- package/dist/tools/video-host.d.ts +12 -0
- package/dist/tools/video-host.d.ts.map +1 -0
- package/dist/tools/video-host.js +21 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
- package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/gradients.js +5 -5
- package/dist/vector/vectorize/svg/gradients.js.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.js +13 -12
- package/dist/vector/vectorize/svg/to-vectors.js.map +1 -1
- package/package.json +31 -9
- package/src/ai/providers.ts +2 -0
- package/src/cache/resource.ts +24 -1
- package/src/canvas/effects.ts +47 -50
- package/src/canvas/fills.ts +19 -15
- package/src/canvas/images/adjustments.ts +203 -0
- package/src/canvas/images/sampling.ts +88 -0
- package/src/canvas/index.ts +1 -0
- package/src/canvas/masks.ts +1 -1
- package/src/canvas/noise/render.ts +75 -0
- package/src/canvas/noise/shader.ts +169 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +95 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/renderer/colors.ts +76 -50
- package/src/canvas/renderer/document-surface.ts +53 -0
- package/src/canvas/renderer/fonts.ts +6 -4
- package/src/canvas/renderer/lifecycle.ts +10 -4
- package/src/canvas/renderer/methods.ts +1 -0
- package/src/canvas/renderer/pipeline.ts +40 -4
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/retained-backing.ts +2 -1
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
- package/src/canvas/renderer/types.ts +18 -2
- package/src/canvas/renderer.ts +76 -14
- package/src/canvas/scene.ts +69 -12
- package/src/canvas/shaders/effect.ts +2 -1
- package/src/canvas/shadows/shape.ts +4 -2
- package/src/canvas/shadows.ts +5 -2
- package/src/canvas/text/decorations.ts +15 -5
- package/src/canvas/text/index.ts +9 -1
- package/src/canvas/text/paragraph/index.ts +16 -6
- package/src/canvas/text/renderer.ts +2 -1
- package/src/canvas/text/shape.ts +4 -4
- package/src/canvas/texture.ts +137 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-memory/check.ts +376 -0
- package/src/design-memory/describe.ts +77 -0
- package/src/design-memory/distil.ts +69 -0
- package/src/design-memory/document.ts +80 -0
- package/src/design-memory/guard.ts +157 -0
- package/src/design-memory/index.ts +8 -0
- package/src/design-memory/refusal.ts +90 -0
- package/src/design-memory/rules.ts +274 -0
- package/src/design-memory/values.ts +179 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/clipboard/assets.ts +6 -2
- package/src/editor/clipboard/component-matches.ts +65 -0
- package/src/editor/clipboard/dependencies.ts +22 -1
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/clipboard.ts +74 -20
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/components/properties.ts +3 -2
- package/src/editor/create.ts +25 -69
- package/src/editor/design-memory.ts +39 -0
- package/src/editor/design-tokens.ts +41 -2
- package/src/editor/document-colors.ts +65 -0
- package/src/editor/eyedropper.ts +208 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +32 -3
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +11 -1
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/structure/state.ts +2 -1
- package/src/editor/text.ts +2 -1
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +4 -0
- package/src/editor/variables.ts +3 -3
- package/src/editor/variations/create.ts +235 -0
- package/src/editor/variations/pick.ts +35 -0
- package/src/editor/variations.ts +110 -0
- package/src/figma-api/accessors/reactions.ts +11 -1
- package/src/figma-api/accessors/text/index.ts +7 -0
- package/src/figma-api/accessors/text/opentype.ts +33 -0
- package/src/figma-api/accessors/visual.ts +55 -2
- package/src/figma-api/compatibility.ts +5 -2
- package/src/figma-api/effects.ts +143 -5
- package/src/figma-api/fresh-read.ts +57 -0
- package/src/figma-api/graph-ref.ts +13 -0
- package/src/figma-api/index.ts +22 -4
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/pending-layout.ts +7 -3
- package/src/figma-api/pending-sync.ts +4 -1
- package/src/figma-api/proxy.ts +8 -2
- package/src/figma-api/reactions.ts +212 -33
- package/src/figma-api/surface.ts +6 -2
- package/src/figma-api/variables/index.ts +5 -4
- package/src/global.d.ts +26 -0
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/css/known.ts +1 -1
- package/src/io/formats/design-tokens/css/read.ts +20 -7
- package/src/io/formats/design-tokens/css/sync.ts +9 -4
- package/src/io/formats/design-tokens/css/values.ts +37 -9
- package/src/io/formats/design-tokens/decode.ts +17 -12
- package/src/io/formats/design-tokens/export.ts +3 -3
- package/src/io/formats/design-tokens/index.ts +21 -0
- package/src/io/formats/design-tokens/plan/changes.ts +4 -1
- package/src/io/formats/design-tokens/plan/index.ts +6 -5
- package/src/io/formats/design-tokens/plan/styles.ts +37 -10
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +20 -9
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +589 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/design-tokens/values.ts +15 -8
- package/src/io/formats/drawio/edges.ts +65 -0
- package/src/io/formats/drawio/export.ts +37 -14
- package/src/io/formats/drawio/index.ts +2 -0
- package/src/io/formats/drawio/warnings.ts +2 -2
- package/src/io/formats/fig/export/index.ts +36 -3
- package/src/io/formats/fig/export/patch/index.ts +12 -1
- package/src/io/formats/fig/export/setup.ts +25 -15
- package/src/io/formats/fig/export/variables.ts +17 -6
- package/src/io/formats/fig/thumbnail-page.ts +4 -4
- package/src/io/formats/html/import.ts +9 -1
- package/src/io/formats/html/index.ts +14 -7
- package/src/io/formats/html/vectors.ts +9 -2
- package/src/io/formats/mermaid/layers.ts +2 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/export.ts +1 -0
- package/src/io/formats/pdf/prepare.ts +6 -6
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +41 -7
- package/src/io/formats/raster/adjusted-images.ts +125 -0
- package/src/io/formats/raster/headless.ts +3 -3
- package/src/io/formats/raster/index.ts +6 -1
- package/src/io/formats/raster/pixels.ts +7 -0
- package/src/io/formats/raster/render.ts +24 -5
- package/src/io/formats/svg/defs.ts +24 -80
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +295 -49
- package/src/io/formats/svg/filter.ts +57 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/import.ts +6 -3
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/export.ts +10 -8
- package/src/io/formats/svg/text/layout.ts +15 -5
- package/src/io/formats/video/composite.ts +79 -0
- package/src/io/formats/video/formats.ts +77 -0
- package/src/io/formats/video/gif.ts +65 -0
- package/src/io/formats/video/index.ts +30 -0
- package/src/io/formats/video/plan.ts +116 -0
- package/src/io/formats/video/record.ts +227 -0
- package/src/io/formats/video/sink.ts +32 -0
- package/src/io/formats/video/size.ts +25 -0
- package/src/io/formats/video/webcodecs.ts +89 -0
- package/src/io/formats.ts +66 -11
- package/src/io/subgraph.ts +4 -1
- package/src/io/types.ts +29 -10
- package/src/kiwi/fig/session/options.ts +4 -1
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/yoga-helpers.ts +8 -0
- package/src/layout.ts +49 -1
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +108 -11
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/types.ts +32 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/comments.ts +6 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +88 -9
- package/src/pairdraw-api/nodes.ts +38 -0
- package/src/pairdraw-api/variations.ts +109 -0
- package/src/prototype/easing.ts +37 -0
- package/src/prototype/frames.ts +9 -0
- package/src/prototype/hit.ts +70 -0
- package/src/prototype/index.ts +69 -0
- package/src/prototype/pointer.ts +146 -0
- package/src/prototype/reactions.ts +178 -0
- package/src/prototype/scene.ts +116 -0
- package/src/prototype/scenes.ts +256 -0
- package/src/prototype/scroll.ts +190 -0
- package/src/prototype/session.ts +188 -0
- package/src/prototype/smart-animate/animation.ts +267 -0
- package/src/prototype/smart-animate/match.ts +85 -0
- package/src/prototype/snapshot.ts +60 -0
- package/src/prototype/timeline.ts +400 -0
- package/src/rpc/read-commands.ts +4 -4
- package/src/rpc/variables-command.ts +2 -2
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +79 -1
- package/src/text/font/provider.ts +26 -0
- package/src/text/font/{status.ts → readiness.ts} +13 -9
- package/src/text/index.ts +4 -1
- package/src/text/prepare.ts +9 -4
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +257 -0
- package/src/tools/analyze/responsive/widths.ts +63 -0
- package/src/tools/analyze.ts +4 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen/tokens.ts +4 -2
- package/src/tools/codegen.ts +1 -0
- package/src/tools/comments.ts +6 -4
- package/src/tools/component-catalog.ts +5 -3
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -3
- package/src/tools/create/icons.ts +2 -1
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +5 -1
- package/src/tools/create/vector.ts +2 -2
- package/src/tools/css/shorthand.ts +64 -0
- package/src/tools/describe/index.ts +2 -8
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/html-host.ts +5 -3
- package/src/tools/image-ai/apply.ts +0 -2
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/image-ai/service.ts +5 -3
- package/src/tools/index.ts +3 -0
- package/src/tools/modify/effects.ts +1 -1
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/geometry.ts +16 -3
- package/src/tools/modify/layout.ts +47 -13
- package/src/tools/modify/matching.ts +14 -11
- package/src/tools/modify/paint.ts +85 -5
- package/src/tools/modify/reactions.ts +16 -8
- package/src/tools/modify/text.ts +56 -15
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/prompts/codegen.md +2 -1
- package/src/tools/read/css.ts +365 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/reactions.ts +3 -2
- package/src/tools/read/space.ts +3 -4
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/core.ts +5 -2
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +42 -9
- package/src/tools/script/host.ts +6 -3
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +12 -1
- package/src/tools/structure/hierarchy.ts +4 -0
- package/src/tools/structure/variations.ts +118 -0
- package/src/tools/structure.ts +2 -0
- package/src/tools/styles/types.ts +3 -4
- package/src/tools/variables/collections.ts +1 -1
- package/src/tools/variables/values.ts +16 -5
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/vectorize.ts +11 -4
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +20 -0
- package/src/vector/vectorize/svg/gradients.ts +8 -5
- package/src/vector/vectorize/svg/to-vectors.ts +48 -14
- package/dist/text/font/status.d.ts +0 -28
- package/dist/text/font/status.d.ts.map +0 -1
- package/dist/text/font/status.js.map +0 -1
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PrototypeAction,
|
|
3
|
+
PrototypeEasingType,
|
|
4
|
+
PrototypeOverlayPositionType,
|
|
5
|
+
PrototypeTransitionType,
|
|
6
|
+
SceneGraph,
|
|
7
|
+
SceneNode
|
|
8
|
+
} from '@pairdraw/scene-graph'
|
|
9
|
+
|
|
10
|
+
import { easingAt } from './easing'
|
|
11
|
+
import {
|
|
12
|
+
primaryAction,
|
|
13
|
+
shownFrame,
|
|
14
|
+
startSession,
|
|
15
|
+
step,
|
|
16
|
+
timeoutReactions,
|
|
17
|
+
topFrameOf,
|
|
18
|
+
type PlaySession
|
|
19
|
+
} from './session'
|
|
20
|
+
|
|
21
|
+
/** A scripted click: the layer clicked, and when, in milliseconds from the start of play. */
|
|
22
|
+
export interface TimelineClick {
|
|
23
|
+
atMs: number
|
|
24
|
+
nodeId: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TimelineOptions {
|
|
28
|
+
/** The top-level frame play starts from. */
|
|
29
|
+
startFrameId: string
|
|
30
|
+
/** Clicks to run as play goes, in time order. */
|
|
31
|
+
clicks?: readonly TimelineClick[]
|
|
32
|
+
/** Where the timeline stops when the flow goes on longer. */
|
|
33
|
+
maxMs: number
|
|
34
|
+
/** How long the last frame stays once nothing else happens. */
|
|
35
|
+
tailMs: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A stretch of play that moves from one screen to the next over a transition's own length. */
|
|
39
|
+
interface TimelineTransition {
|
|
40
|
+
from: PlaySession
|
|
41
|
+
to: PlaySession
|
|
42
|
+
startMs: number
|
|
43
|
+
endMs: number
|
|
44
|
+
/** The transition's own length, which keeps its pace when a later step cuts it short. */
|
|
45
|
+
fadeMs: number
|
|
46
|
+
easing?: PrototypeEasingType
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A stretch of play: one screen held still, a crossfade from one screen to the next, or a Smart
|
|
51
|
+
* animate between them.
|
|
52
|
+
*/
|
|
53
|
+
export type TimelineSegment =
|
|
54
|
+
| { kind: 'hold'; session: PlaySession; startMs: number; endMs: number }
|
|
55
|
+
| ({ kind: 'dissolve' } & TimelineTransition)
|
|
56
|
+
| ({ kind: 'smart' } & TimelineTransition)
|
|
57
|
+
|
|
58
|
+
/** A Smart animate stretch of a timeline. */
|
|
59
|
+
export type TimelineSmartSegment = Extract<TimelineSegment, { kind: 'smart' }>
|
|
60
|
+
|
|
61
|
+
/** One step play took: when, the frame it shows afterwards, what started it, and how it moved. */
|
|
62
|
+
export interface TimelineStep {
|
|
63
|
+
atMs: number
|
|
64
|
+
frameId: string
|
|
65
|
+
trigger: 'AFTER_TIMEOUT' | 'ON_CLICK'
|
|
66
|
+
transition: PrototypeTransitionType
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface Timeline {
|
|
70
|
+
segments: TimelineSegment[]
|
|
71
|
+
durationMs: number
|
|
72
|
+
/** Clicks the walk never ran: past the cap, or on a layer whose hit runs no reaction. */
|
|
73
|
+
skippedClicks: TimelineClick[]
|
|
74
|
+
/** Play came back to the screen it started on, so the clip repeats seamlessly. */
|
|
75
|
+
loops: boolean
|
|
76
|
+
/** The flow went on past `maxMs`, where the timeline stops. */
|
|
77
|
+
truncated: boolean
|
|
78
|
+
steps: TimelineStep[]
|
|
79
|
+
/** Where each overlay frame play opened sits over the screen, from the action that opened it. */
|
|
80
|
+
overlayPositions: Record<string, PrototypeOverlayPositionType>
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* What a timeline shows at a moment: one screen, two mid-crossfade with `mix` of the second, or a
|
|
85
|
+
* Smart animate `progress` of the way through its time, which its animation eases.
|
|
86
|
+
*/
|
|
87
|
+
export type TimelineFrame =
|
|
88
|
+
| { session: PlaySession }
|
|
89
|
+
| { from: PlaySession; to: PlaySession; mix: number }
|
|
90
|
+
| { smart: TimelineSmartSegment; progress: number }
|
|
91
|
+
|
|
92
|
+
/** Why a flow cannot be played: the start frame has nothing to follow, or anything else. */
|
|
93
|
+
export type TimelineErrorReason = 'nothing-to-follow' | 'invalid'
|
|
94
|
+
|
|
95
|
+
/** A flow that cannot be played as asked, with a message naming the frame or click at fault. */
|
|
96
|
+
export class TimelineError extends Error {
|
|
97
|
+
override name = 'TimelineError'
|
|
98
|
+
constructor(
|
|
99
|
+
message: string,
|
|
100
|
+
readonly reason: TimelineErrorReason = 'invalid'
|
|
101
|
+
) {
|
|
102
|
+
super(message)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Steps a timeline may take before it is refused, which stops cycles that take no time. */
|
|
107
|
+
const MAX_TIMELINE_STEPS = 10_000
|
|
108
|
+
|
|
109
|
+
/** How long an action's transition runs, in milliseconds; a cut takes none. */
|
|
110
|
+
export function transitionMs(action: PrototypeAction): number {
|
|
111
|
+
if (action.type !== 'NODE' || action.transition.type === 'INSTANT') return 0
|
|
112
|
+
return Math.max(0, action.transition.duration * 1000)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** How play shows a step: a cut, a crossfade, or Smart animate. */
|
|
116
|
+
export type PlayAnimation = 'cut' | 'dissolve' | 'smart'
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* How play animates `action` from `session`: a cut when it takes no time; Smart animate for a
|
|
120
|
+
* Smart animate Change to, or a navigation between screens while no overlay is open, as Figma
|
|
121
|
+
* has no Smart animate for overlays; a crossfade otherwise.
|
|
122
|
+
*/
|
|
123
|
+
export function animationFor(session: PlaySession, action: PrototypeAction): PlayAnimation {
|
|
124
|
+
if (transitionMs(action) === 0 || action.type !== 'NODE') return 'cut'
|
|
125
|
+
if (action.transition.type !== 'SMART_ANIMATE') return 'dissolve'
|
|
126
|
+
if (action.navigation === 'CHANGE_TO') return 'smart'
|
|
127
|
+
return action.navigation === 'NAVIGATE' && session.overlays.length === 0 ? 'smart' : 'dissolve'
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The curve a dissolve fades along, CSS `ease-out`, which Figma's dissolve uses by default: the
|
|
132
|
+
* x and y of its two cubic Bézier control points. The player draws its crossfade with
|
|
133
|
+
* `DISSOLVE_EASING_CSS` and a recording samples `dissolveEasing`, so both fade alike.
|
|
134
|
+
*/
|
|
135
|
+
export const DISSOLVE_EASING = { x1: 0, y1: 0, x2: 0.58, y2: 1 } as const
|
|
136
|
+
|
|
137
|
+
/** `DISSOLVE_EASING` as a CSS timing function. */
|
|
138
|
+
export const DISSOLVE_EASING_CSS = `cubic-bezier(${DISSOLVE_EASING.x1}, ${DISSOLVE_EASING.y1}, ${DISSOLVE_EASING.x2}, ${DISSOLVE_EASING.y2})`
|
|
139
|
+
|
|
140
|
+
/** The share of the new screen a dissolve shows at `progress` of the way, along `DISSOLVE_EASING`. */
|
|
141
|
+
export function dissolveEasing(progress: number): number {
|
|
142
|
+
return easingAt('EASE_OUT', progress)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* What play draws, as a key two sessions share when they look alike: the base frame and its
|
|
147
|
+
* overlays. History only matters to Back. State that changes what a frame shows extends it here,
|
|
148
|
+
* and the recorder's screen cache follows.
|
|
149
|
+
*/
|
|
150
|
+
export function sessionDrawKey(session: PlaySession): string {
|
|
151
|
+
return [session.frameId, ...session.overlays].join(' ')
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function nameOf(graph: SceneGraph, id: string): string {
|
|
155
|
+
return graph.getNode(id)?.name ?? id
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function seconds(ms: number): string {
|
|
159
|
+
return `${(ms / 1000).toFixed(2)} s`
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Whether `node` sits in `frameId`, or is that frame. */
|
|
163
|
+
function isInside(graph: SceneGraph, node: SceneNode, frameId: string): boolean {
|
|
164
|
+
let current: SceneNode | undefined = node
|
|
165
|
+
while (current) {
|
|
166
|
+
if (current.id === frameId) return true
|
|
167
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
168
|
+
}
|
|
169
|
+
return false
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The action a click on `nodeId` runs, as a click on the canvas resolves one: the layer or its
|
|
174
|
+
* nearest ancestor inside the shown frame with an `ON_CLICK` reaction. Throws when the layer is not
|
|
175
|
+
* on the shown frame; null when nothing there reacts to a click.
|
|
176
|
+
*/
|
|
177
|
+
function clickAction(
|
|
178
|
+
graph: SceneGraph,
|
|
179
|
+
session: PlaySession,
|
|
180
|
+
click: TimelineClick,
|
|
181
|
+
index: number
|
|
182
|
+
): PrototypeAction | null {
|
|
183
|
+
const shown = shownFrame(session)
|
|
184
|
+
const node = graph.getNode(click.nodeId)
|
|
185
|
+
if (!node || !isInside(graph, node, shown)) {
|
|
186
|
+
throw new TimelineError(
|
|
187
|
+
`click ${index + 1}: '${node?.name ?? click.nodeId}' is not on the shown frame '${nameOf(graph, shown)}' at ${seconds(click.atMs)}`
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
let current: SceneNode | undefined = node
|
|
191
|
+
while (current) {
|
|
192
|
+
const reaction = current.prototypeReactions.find(
|
|
193
|
+
(candidate) => candidate.trigger.type === 'ON_CLICK'
|
|
194
|
+
)
|
|
195
|
+
const action = reaction ? primaryAction(reaction) : null
|
|
196
|
+
if (action) return action
|
|
197
|
+
if (current.id === shown) return null
|
|
198
|
+
current = current.parentId ? graph.getNode(current.parentId) : undefined
|
|
199
|
+
}
|
|
200
|
+
return null
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface ArmedTimer {
|
|
204
|
+
atMs: number
|
|
205
|
+
action: PrototypeAction
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** The shown frame's After delay reactions, each due `delay` after the frame finished entering. */
|
|
209
|
+
function armTimers(graph: SceneGraph, session: PlaySession, readyMs: number): ArmedTimer[] {
|
|
210
|
+
return timeoutReactions(graph, session)
|
|
211
|
+
.map(({ action, delayMs }) => ({ atMs: readyMs + delayMs, action }))
|
|
212
|
+
.toSorted((a, b) => a.atMs - b.atMs)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Play at its start frame, which must be a top-level frame with something to follow. */
|
|
216
|
+
function startWalk(graph: SceneGraph, options: TimelineOptions): { walk: Walk; start: SceneNode } {
|
|
217
|
+
const start = graph.getNode(options.startFrameId)
|
|
218
|
+
if (!start || topFrameOf(graph, start)?.id !== start.id) {
|
|
219
|
+
throw new TimelineError(`'${start?.name ?? options.startFrameId}' is not a top-level frame`)
|
|
220
|
+
}
|
|
221
|
+
const session = startSession(start.id)
|
|
222
|
+
const walk: Walk = {
|
|
223
|
+
graph,
|
|
224
|
+
session,
|
|
225
|
+
readyMs: 0,
|
|
226
|
+
timers: armTimers(graph, session, 0),
|
|
227
|
+
clicks: (options.clicks ?? []).toSorted((a, b) => a.atMs - b.atMs),
|
|
228
|
+
clickIndex: 0,
|
|
229
|
+
skippedClicks: [],
|
|
230
|
+
segments: [],
|
|
231
|
+
steps: [],
|
|
232
|
+
overlayPositions: {}
|
|
233
|
+
}
|
|
234
|
+
if (walk.timers.length === 0 && walk.clicks.length === 0) {
|
|
235
|
+
throw new TimelineError(
|
|
236
|
+
`'${start.name}' has no After delay interaction to follow`,
|
|
237
|
+
'nothing-to-follow'
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
return { walk, start }
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Play in progress on the virtual clock: what is shown, since when, and what is due next. */
|
|
244
|
+
interface Walk {
|
|
245
|
+
graph: SceneGraph
|
|
246
|
+
session: PlaySession
|
|
247
|
+
/** When the shown screen finished entering; its After delays count from here. */
|
|
248
|
+
readyMs: number
|
|
249
|
+
timers: ArmedTimer[]
|
|
250
|
+
clicks: TimelineClick[]
|
|
251
|
+
clickIndex: number
|
|
252
|
+
skippedClicks: TimelineClick[]
|
|
253
|
+
segments: TimelineSegment[]
|
|
254
|
+
steps: TimelineStep[]
|
|
255
|
+
overlayPositions: Record<string, PrototypeOverlayPositionType>
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface WalkEvent {
|
|
259
|
+
atMs: number
|
|
260
|
+
action: PrototypeAction | null
|
|
261
|
+
trigger: TimelineStep['trigger']
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Holds the shown screen from when it finished entering until `endMs`. */
|
|
265
|
+
function hold(walk: Walk, endMs: number): void {
|
|
266
|
+
if (endMs > walk.readyMs) {
|
|
267
|
+
walk.segments.push({ kind: 'hold', session: walk.session, startMs: walk.readyMs, endMs })
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** The earliest due timer or click, taken off its queue; null when nothing else will happen. */
|
|
272
|
+
function takeNextEvent(walk: Walk): WalkEvent | null {
|
|
273
|
+
const timer = walk.timers.at(0)
|
|
274
|
+
const click = walk.clicks.at(walk.clickIndex)
|
|
275
|
+
if (timer && (!click || timer.atMs <= click.atMs)) {
|
|
276
|
+
walk.timers = walk.timers.slice(1)
|
|
277
|
+
return { atMs: timer.atMs, action: timer.action, trigger: 'AFTER_TIMEOUT' }
|
|
278
|
+
}
|
|
279
|
+
if (!click) return null
|
|
280
|
+
const action = clickAction(walk.graph, walk.session, click, walk.clickIndex)
|
|
281
|
+
walk.clickIndex += 1
|
|
282
|
+
if (!action) walk.skippedClicks.push(click)
|
|
283
|
+
return { atMs: click.atMs, action, trigger: 'ON_CLICK' }
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** The earliest event's time without taking it, or infinity when nothing else will happen. */
|
|
287
|
+
function nextEventAt(walk: Walk): number {
|
|
288
|
+
const timerAt = walk.timers.at(0)?.atMs ?? Number.POSITIVE_INFINITY
|
|
289
|
+
const clickAt = walk.clicks.at(walk.clickIndex)?.atMs ?? Number.POSITIVE_INFINITY
|
|
290
|
+
return Math.min(timerAt, clickAt)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Runs `action` at `atMs`, recording the hold before it, its crossfade, and the step. */
|
|
294
|
+
function advance(walk: Walk, event: WalkEvent & { action: PrototypeAction }, next: PlaySession) {
|
|
295
|
+
const { atMs, action } = event
|
|
296
|
+
// A step while a transition still runs cuts it short where it is.
|
|
297
|
+
const running = walk.segments.at(-1)
|
|
298
|
+
if (running && running.kind !== 'hold' && running.endMs > atMs) running.endMs = atMs
|
|
299
|
+
hold(walk, atMs)
|
|
300
|
+
const durationMs = transitionMs(action)
|
|
301
|
+
const animation = animationFor(walk.session, action)
|
|
302
|
+
if (animation !== 'cut') {
|
|
303
|
+
walk.segments.push({
|
|
304
|
+
kind: animation === 'smart' ? 'smart' : 'dissolve',
|
|
305
|
+
from: walk.session,
|
|
306
|
+
to: next,
|
|
307
|
+
startMs: atMs,
|
|
308
|
+
endMs: atMs + durationMs,
|
|
309
|
+
fadeMs: durationMs,
|
|
310
|
+
...(action.type === 'NODE' && action.transition.easing
|
|
311
|
+
? { easing: action.transition.easing }
|
|
312
|
+
: {})
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
walk.steps.push({
|
|
316
|
+
atMs,
|
|
317
|
+
frameId: shownFrame(next),
|
|
318
|
+
trigger: event.trigger,
|
|
319
|
+
transition: durationMs > 0 && action.type === 'NODE' ? action.transition.type : 'INSTANT'
|
|
320
|
+
})
|
|
321
|
+
if (action.type === 'NODE' && action.navigation === 'OVERLAY' && action.nodeId) {
|
|
322
|
+
walk.overlayPositions[action.nodeId] = action.overlayPosition
|
|
323
|
+
}
|
|
324
|
+
walk.session = next
|
|
325
|
+
walk.readyMs = atMs + durationMs
|
|
326
|
+
walk.timers = armTimers(walk.graph, next, walk.readyMs)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function finish(walk: Walk, durationMs: number, end: 'ends' | 'loops' | 'truncated'): Timeline {
|
|
330
|
+
return {
|
|
331
|
+
segments: walk.segments,
|
|
332
|
+
durationMs,
|
|
333
|
+
loops: end === 'loops',
|
|
334
|
+
truncated: end === 'truncated',
|
|
335
|
+
steps: walk.steps,
|
|
336
|
+
overlayPositions: walk.overlayPositions,
|
|
337
|
+
skippedClicks: [...walk.skippedClicks, ...walk.clicks.slice(walk.clickIndex)]
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Plays a prototype on a virtual clock, from `startFrameId`, following its After delay
|
|
343
|
+
* reactions and the scripted clicks as the player would, without waiting for real time. Each delay
|
|
344
|
+
* counts from when the transition into its frame ends, as in Figma. The walk stops when play
|
|
345
|
+
* returns to the screen it started on (`loops`), when nothing else will happen (the last screen is
|
|
346
|
+
* held `tailMs`), or at `maxMs` (`truncated`).
|
|
347
|
+
*/
|
|
348
|
+
export function planTimeline(graph: SceneGraph, options: TimelineOptions): Timeline {
|
|
349
|
+
const { walk, start } = startWalk(graph, options)
|
|
350
|
+
const startKey = sessionDrawKey(walk.session)
|
|
351
|
+
|
|
352
|
+
for (let taken = 0; taken <= MAX_TIMELINE_STEPS; taken++) {
|
|
353
|
+
const dueAt = nextEventAt(walk)
|
|
354
|
+
if (dueAt >= options.maxMs) {
|
|
355
|
+
const endMs = Math.min(walk.readyMs + options.tailMs, options.maxMs)
|
|
356
|
+
// More is due past the cap, or the cap falls before the last transition has ended.
|
|
357
|
+
const truncated = dueAt !== Number.POSITIVE_INFINITY || walk.readyMs > options.maxMs
|
|
358
|
+
hold(walk, truncated ? options.maxMs : endMs)
|
|
359
|
+
// With no time left to hold it, the last screen still ends the timeline.
|
|
360
|
+
if (!truncated && endMs <= walk.readyMs) {
|
|
361
|
+
walk.segments.push({
|
|
362
|
+
kind: 'hold',
|
|
363
|
+
session: walk.session,
|
|
364
|
+
startMs: walk.readyMs,
|
|
365
|
+
endMs: walk.readyMs
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
return truncated ? finish(walk, options.maxMs, 'truncated') : finish(walk, endMs, 'ends')
|
|
369
|
+
}
|
|
370
|
+
const event = takeNextEvent(walk)
|
|
371
|
+
const action = event?.action
|
|
372
|
+
if (!event || !action) continue
|
|
373
|
+
const next = step(graph, walk.session, action)
|
|
374
|
+
if (next === walk.session) continue
|
|
375
|
+
advance(walk, { ...event, action }, next)
|
|
376
|
+
|
|
377
|
+
if (sessionDrawKey(next) === startKey && walk.clickIndex >= walk.clicks.length) {
|
|
378
|
+
if (walk.readyMs === 0) {
|
|
379
|
+
throw new TimelineError(`The flow loops back to '${start.name}' at once`)
|
|
380
|
+
}
|
|
381
|
+
if (walk.readyMs > options.maxMs) return finish(walk, options.maxMs, 'truncated')
|
|
382
|
+
return finish(walk, walk.readyMs, 'loops')
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
throw new TimelineError(`The flow takes more than ${MAX_TIMELINE_STEPS} steps`)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** What the timeline shows at `atMs`; past its end, the last screen it shows. */
|
|
389
|
+
export function frameAt(timeline: Timeline, atMs: number): TimelineFrame {
|
|
390
|
+
for (const segment of timeline.segments) {
|
|
391
|
+
if (atMs >= segment.endMs) continue
|
|
392
|
+
if (segment.kind === 'hold') return { session: segment.session }
|
|
393
|
+
const progress = (atMs - segment.startMs) / segment.fadeMs
|
|
394
|
+
if (segment.kind === 'smart') return { smart: segment, progress }
|
|
395
|
+
return { from: segment.from, to: segment.to, mix: easingAt(segment.easing, progress) }
|
|
396
|
+
}
|
|
397
|
+
const last = timeline.segments.at(-1)
|
|
398
|
+
if (!last) throw new TimelineError('The timeline is empty')
|
|
399
|
+
return { session: last.kind === 'hold' ? last.session : last.to }
|
|
400
|
+
}
|
package/src/rpc/read-commands.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { BooleanOperation, MaskType, SceneGraph, SceneNode } from '@pairdra
|
|
|
4
4
|
|
|
5
5
|
import { shapeDetailFields } from '#core/figma-api/shape-details'
|
|
6
6
|
import { ELLIPSIS } from '#core/text/ellipsis'
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
7
|
+
import type { FontReadiness } from '#core/text/font/readiness'
|
|
8
|
+
import { resolveFontReadiness } from '#core/text/prepare'
|
|
9
9
|
import { queryByXPath } from '#core/xpath'
|
|
10
10
|
|
|
11
11
|
import type { RPCCommand } from './types'
|
|
@@ -104,11 +104,11 @@ export const infoCommand: RPCCommand<void, InfoResult> = {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
export const fontStatusCommand: RPCCommand<void,
|
|
107
|
+
export const fontStatusCommand: RPCCommand<void, FontReadiness> = {
|
|
108
108
|
name: 'font-status',
|
|
109
109
|
execute: async (graph) => {
|
|
110
110
|
const pageIds = graph.getPages().map((page) => page.id)
|
|
111
|
-
return
|
|
111
|
+
return resolveFontReadiness(graph, pageIds.length > 0 ? pageIds : [graph.rootId])
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -63,7 +63,7 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
63
63
|
|
|
64
64
|
const result: VariablesResult = { collections: [], totalVariables: 0, totalCollections: 0 }
|
|
65
65
|
|
|
66
|
-
for (const coll of graph.
|
|
66
|
+
for (const coll of graph.getLiveCollections()) {
|
|
67
67
|
if (collFilter && !coll.name.toLowerCase().includes(collFilter)) continue
|
|
68
68
|
|
|
69
69
|
const collVars = graph
|
|
@@ -120,7 +120,7 @@ async function designTokenFiles(graph: SceneGraph): Promise<TokensResult> {
|
|
|
120
120
|
const { files, issues } = exportDesignTokens(graph)
|
|
121
121
|
return {
|
|
122
122
|
css: '',
|
|
123
|
-
tokenCount: graph.
|
|
123
|
+
tokenCount: graph.getLiveVariables().length,
|
|
124
124
|
issues: issues.map(designTokenIssueMessage),
|
|
125
125
|
files
|
|
126
126
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { uniq } from 'es-toolkit/array'
|
|
2
|
+
|
|
3
|
+
import { fontTableView } from './variation'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The OpenType feature tags a font's GSUB table lists, in the table's own order, or `null` for a
|
|
7
|
+
* font without one. The panel offers a feature only when the font actually has it, as Figma does.
|
|
8
|
+
*/
|
|
9
|
+
export function fontFeatureTags(data: ArrayBuffer): string[] | null {
|
|
10
|
+
const gsub = fontTableView(data, 'GSUB')
|
|
11
|
+
if (!gsub || gsub.byteLength < 14) return null
|
|
12
|
+
// GSUB header: version (4), ScriptList offset (2), FeatureList offset (2), LookupList offset (2);
|
|
13
|
+
// version 1.1 adds a FeatureVariations offset (4). The FeatureList offset is at byte 6 either way.
|
|
14
|
+
const featureListOffset = gsub.getUint16(6)
|
|
15
|
+
if (featureListOffset + 2 > gsub.byteLength) return null
|
|
16
|
+
const count = gsub.getUint16(featureListOffset)
|
|
17
|
+
const tags: string[] = []
|
|
18
|
+
for (let index = 0; index < count; index++) {
|
|
19
|
+
// Each FeatureRecord: a 4-byte tag and a 2-byte offset to its feature table.
|
|
20
|
+
const record = featureListOffset + 2 + index * 6
|
|
21
|
+
if (record + 4 > gsub.byteLength) break
|
|
22
|
+
let tag = ''
|
|
23
|
+
for (let c = 0; c < 4; c++) tag += String.fromCharCode(gsub.getUint8(record + c))
|
|
24
|
+
tags.push(tag.toUpperCase())
|
|
25
|
+
}
|
|
26
|
+
return uniq(tags)
|
|
27
|
+
}
|
package/src/text/font/manager.ts
CHANGED
|
@@ -4,6 +4,11 @@ import type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'
|
|
|
4
4
|
import { uniq } from 'es-toolkit'
|
|
5
5
|
|
|
6
6
|
import type { FontVariation, SceneGraph } from '@pairdraw/scene-graph'
|
|
7
|
+
import {
|
|
8
|
+
GENERIC_FONT_FAMILIES_BY_CLASS,
|
|
9
|
+
genericFontFamilyClass,
|
|
10
|
+
isGenericFontFamily
|
|
11
|
+
} from '@pairdraw/scene-graph/css'
|
|
7
12
|
import {
|
|
8
13
|
faceLoadKey,
|
|
9
14
|
namesWeight,
|
|
@@ -28,6 +33,7 @@ import {
|
|
|
28
33
|
fontFaceRenderFamily,
|
|
29
34
|
type FamilyFace
|
|
30
35
|
} from '#core/text/font/faces'
|
|
36
|
+
import { fontFeatureTags } from '#core/text/font/features'
|
|
31
37
|
import { loadHarfBuzz } from '#core/text/font/harfbuzz'
|
|
32
38
|
import { LocalFonts } from '#core/text/font/local'
|
|
33
39
|
import { sameFontFile, SharedReads, withHarfBuzz } from '#core/text/font/reads'
|
|
@@ -55,6 +61,33 @@ import type { WebFontFetch, WebFontProviderId } from '#core/text/web-font/resolv
|
|
|
55
61
|
|
|
56
62
|
export type { BundledFontLocator } from '#core/text/font/bundled'
|
|
57
63
|
|
|
64
|
+
/**
|
|
65
|
+
* How long a web-font fetch may run before the page falls back to an installed or bundled face.
|
|
66
|
+
* A provider that never answers must not block page preparation.
|
|
67
|
+
*/
|
|
68
|
+
const WEB_FONT_FETCH_TIMEOUT_MS = 10_000
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* `load`, bounded by `ms` and cancelled as soon as `signal` aborts, so a provider that never
|
|
72
|
+
* answers cannot block page preparation. The timer clears when the load settles.
|
|
73
|
+
*/
|
|
74
|
+
async function fetchWithin<T>(
|
|
75
|
+
load: (signal: AbortSignal) => Promise<T>,
|
|
76
|
+
signal: AbortSignal | undefined,
|
|
77
|
+
ms: number
|
|
78
|
+
): Promise<T> {
|
|
79
|
+
const bounded = new AbortController()
|
|
80
|
+
const forward = () => bounded.abort(signal?.reason)
|
|
81
|
+
signal?.addEventListener('abort', forward, { once: true })
|
|
82
|
+
const timer = setTimeout(() => bounded.abort(new Error('Web font fetch timed out')), ms)
|
|
83
|
+
try {
|
|
84
|
+
return await load(bounded.signal)
|
|
85
|
+
} finally {
|
|
86
|
+
clearTimeout(timer)
|
|
87
|
+
signal?.removeEventListener('abort', forward)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
58
91
|
export class FontManager {
|
|
59
92
|
private loadedFamilies = new Map<string, ArrayBuffer>()
|
|
60
93
|
/** The families `loadedFamilies` has a face of, so asking needs no scan of its keys. */
|
|
@@ -82,6 +115,7 @@ export class FontManager {
|
|
|
82
115
|
ArrayBuffer,
|
|
83
116
|
{ axes: FontAxis[]; instances: NamedInstance[] } | null
|
|
84
117
|
>()
|
|
118
|
+
private featureTags = new WeakMap<ArrayBuffer, string[] | null>()
|
|
85
119
|
private blockedNodeIds = new Set<string>()
|
|
86
120
|
private fontProvider: TypefaceFontProvider | null = null
|
|
87
121
|
private fontProviders = new Set<TypefaceFontProvider>()
|
|
@@ -440,7 +474,12 @@ export class FontManager {
|
|
|
440
474
|
)
|
|
441
475
|
const normalized = normalizeFontFamily(family)
|
|
442
476
|
const families = normalized === family ? [family] : [family, normalized]
|
|
443
|
-
const resolved = await
|
|
477
|
+
const resolved = await fetchWithin(
|
|
478
|
+
(boundedSignal) =>
|
|
479
|
+
this.webFonts.fetchFont(families, style, requestedCharacters, boundedSignal),
|
|
480
|
+
signal,
|
|
481
|
+
WEB_FONT_FETCH_TIMEOUT_MS
|
|
482
|
+
)
|
|
444
483
|
if (!resolved || resolved.buffers.length === 0) return null
|
|
445
484
|
const primary = resolved.buffers[0]
|
|
446
485
|
// Providers serve faces by weight; a named face comes only from a variable file that has it.
|
|
@@ -477,6 +516,9 @@ export class FontManager {
|
|
|
477
516
|
signal?: AbortSignal
|
|
478
517
|
): Promise<ArrayBuffer | null> {
|
|
479
518
|
signal?.throwIfAborted()
|
|
519
|
+
// A CSS generic keyword is never a bundled, installed, or served face: it draws a face of the
|
|
520
|
+
// class it names, from the host or the bundle, rather than fetching a name no provider serves.
|
|
521
|
+
if (isGenericFontFamily(family)) return this.loadGenericFont(family, style)
|
|
480
522
|
const loaded = this.loadedData(family, style)
|
|
481
523
|
if (loaded) {
|
|
482
524
|
this.registerFontInCanvasKit(family, loaded)
|
|
@@ -496,6 +538,22 @@ export class FontManager {
|
|
|
496
538
|
)
|
|
497
539
|
}
|
|
498
540
|
|
|
541
|
+
/**
|
|
542
|
+
* A CSS generic keyword draws a face of the class it names: the first concrete family the host
|
|
543
|
+
* has, else a bundled one. Its bytes register under the keyword, so the text keeps its name.
|
|
544
|
+
*/
|
|
545
|
+
private async loadGenericFont(keyword: string, style: string): Promise<ArrayBuffer | null> {
|
|
546
|
+
const kind = genericFontFamilyClass(keyword)
|
|
547
|
+
if (!kind) return null
|
|
548
|
+
for (const candidate of GENERIC_FONT_FAMILIES_BY_CLASS[kind]) {
|
|
549
|
+
const installed = await this.loadInstalledFont(candidate, style)
|
|
550
|
+
if (installed) return this.registerAndCache(keyword, style, installed, 'local')
|
|
551
|
+
const bundled = await this.loadBundledFont(candidate, style)
|
|
552
|
+
if (bundled) return this.registerAndCache(keyword, style, bundled, 'bundled')
|
|
553
|
+
}
|
|
554
|
+
return null
|
|
555
|
+
}
|
|
556
|
+
|
|
499
557
|
/**
|
|
500
558
|
* `data`, or a web font fetched again with `characters` when it came from the web without them,
|
|
501
559
|
* as a provider cuts a font down to the text it is asked for.
|
|
@@ -608,6 +666,26 @@ export class FontManager {
|
|
|
608
666
|
return loaded ? other : undefined
|
|
609
667
|
}
|
|
610
668
|
|
|
669
|
+
/**
|
|
670
|
+
* The OpenType feature tags a family's loaded font has, from its GSUB feature list: `undefined`
|
|
671
|
+
* when no face of the family is loaded, `null` when its font has no GSUB table, else the tags
|
|
672
|
+
* (empty when the table lists none). The panel offers a feature only when the font has it.
|
|
673
|
+
*/
|
|
674
|
+
familyFeatures(family: string): string[] | null | undefined {
|
|
675
|
+
let loaded = false
|
|
676
|
+
for (const [key, data] of this.loadedFamilies) {
|
|
677
|
+
if (!key.startsWith(`${family}|`)) continue
|
|
678
|
+
loaded = true
|
|
679
|
+
let tags = this.featureTags.get(data)
|
|
680
|
+
if (tags === undefined) {
|
|
681
|
+
tags = fontFeatureTags(data)
|
|
682
|
+
this.featureTags.set(data, tags)
|
|
683
|
+
}
|
|
684
|
+
if (tags !== null) return tags
|
|
685
|
+
}
|
|
686
|
+
return loaded ? null : undefined
|
|
687
|
+
}
|
|
688
|
+
|
|
611
689
|
/** Axis coordinates for `style` when the loaded face is a variable font, otherwise `null`. */
|
|
612
690
|
namedInstanceVariations(family: string, style: string): FontVariation[] | null {
|
|
613
691
|
const data = this.loadedData(family, style)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'
|
|
2
|
+
|
|
3
|
+
import { fontManager } from './manager'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A share of the font provider `canvasKit` draws from. Every renderer and shaper holds one for as
|
|
7
|
+
* long as it reads text, so a face registered by one is shaped by all of them, and the last share
|
|
8
|
+
* given back deletes the provider. Releasing twice is safe and does nothing the second time.
|
|
9
|
+
*/
|
|
10
|
+
export interface FontProviderLease {
|
|
11
|
+
readonly provider: TypefaceFontProvider
|
|
12
|
+
release(): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function leaseFontProvider(canvasKit: CanvasKit): FontProviderLease {
|
|
16
|
+
const provider = fontManager.acquireProvider(canvasKit)
|
|
17
|
+
let held = true
|
|
18
|
+
return {
|
|
19
|
+
provider,
|
|
20
|
+
release() {
|
|
21
|
+
if (!held) return
|
|
22
|
+
held = false
|
|
23
|
+
fontManager.releaseProvider(provider)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -5,15 +5,15 @@ import { fontManager, type FontManager } from '#core/text/font/manager'
|
|
|
5
5
|
import { collectNamedNodeFontFaces } from '#core/text/font/names'
|
|
6
6
|
import type { FontLoadedSource, FontUnavailableReason } from '#core/text/font/sources'
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type FontReadinessStatus = 'available' | 'substituted' | 'unresolved'
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface FontFaceReadiness {
|
|
11
11
|
family: string
|
|
12
12
|
/** The style the font manager loads the face as. */
|
|
13
13
|
style: string
|
|
14
14
|
/** The face's name, as its text names it ("Book", "Semi Bold"). */
|
|
15
15
|
name: string
|
|
16
|
-
status:
|
|
16
|
+
status: FontReadinessStatus
|
|
17
17
|
source: FontLoadedSource | null
|
|
18
18
|
substituteFamily: string | null
|
|
19
19
|
/** Why the requested face could not be loaded, when the host reported a reason. */
|
|
@@ -22,10 +22,10 @@ export interface DocumentFontFaceStatus {
|
|
|
22
22
|
nodeNames: string[]
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export interface
|
|
25
|
+
export interface FontReadiness {
|
|
26
26
|
faithful: boolean
|
|
27
|
-
faces:
|
|
28
|
-
issues:
|
|
27
|
+
faces: FontFaceReadiness[]
|
|
28
|
+
issues: FontFaceReadiness[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
interface MutableFontFaceUse {
|
|
@@ -72,7 +72,7 @@ function collectFaceUses(graph: SceneGraph, rootIds: readonly string[]): Mutable
|
|
|
72
72
|
return [...uses.values()]
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function faceStatus(use: MutableFontFaceUse, manager: FontManager):
|
|
75
|
+
function faceStatus(use: MutableFontFaceUse, manager: FontManager): FontFaceReadiness {
|
|
76
76
|
const exactSource = manager.loadedFontSource(use.family, use.style)
|
|
77
77
|
if (exactSource) {
|
|
78
78
|
return {
|
|
@@ -116,11 +116,15 @@ function faceStatus(use: MutableFontFaceUse, manager: FontManager): DocumentFont
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
/**
|
|
120
|
+
* What the fonts loaded now can draw: a face reads `unresolved` until something loads it, so a
|
|
121
|
+
* caller that needs the truth for a document asks {@link resolveFontReadiness} instead.
|
|
122
|
+
*/
|
|
123
|
+
export function readFontReadiness(
|
|
120
124
|
graph: SceneGraph,
|
|
121
125
|
rootIds: string | readonly string[],
|
|
122
126
|
manager: FontManager = fontManager
|
|
123
|
-
):
|
|
127
|
+
): FontReadiness {
|
|
124
128
|
const roots = typeof rootIds === 'string' ? [rootIds] : rootIds
|
|
125
129
|
const faces = collectFaceUses(graph, roots)
|
|
126
130
|
.map((use) => faceStatus(use, manager))
|