@pairdraw/core 0.19.1 → 0.20.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/previews.d.ts +1 -1
- 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 +43 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +161 -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 +73 -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/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +2 -9
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +2 -0
- 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 +6 -0
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +0 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
- package/dist/canvas/renderer/overlay-pass.js +0 -1
- package/dist/canvas/renderer/overlay-pass.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +13 -2
- 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/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/types.d.ts +18 -4
- 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 +22 -3
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +29 -1
- 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 +41 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +100 -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/index.d.ts +2 -2
- package/dist/design-jsx/index.js +2 -2
- package/dist/design-jsx/renderer.d.ts +3 -2
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/design-jsx/renderer.js +2 -2
- package/dist/design-jsx/renderer.js.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/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.js +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/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +12 -4
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +2 -7
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/color-space.d.ts.map +1 -1
- package/dist/editor/color-space.js +33 -38
- package/dist/editor/color-space.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.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 +36 -8
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +26 -61
- 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 +168 -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 +6 -0
- 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 +6 -3
- 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/nudge.js +1 -1
- package/dist/editor/nudge.js.map +1 -1
- 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 +6 -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/container.d.ts +2 -0
- package/dist/editor/selection/container.d.ts.map +1 -1
- package/dist/editor/selection/container.js +17 -1
- package/dist/editor/selection/container.js.map +1 -1
- package/dist/editor/selection/navigation.js +7 -4
- package/dist/editor/selection/navigation.js.map +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 +6 -2
- package/dist/editor/selection.d.ts +9 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.d.ts.map +1 -1
- package/dist/editor/shapes/with-text.js +2 -5
- package/dist/editor/shapes/with-text.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +1 -1
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.d.ts +2 -3
- package/dist/editor/structure/boolean.d.ts.map +1 -1
- package/dist/editor/structure/boolean.js.map +1 -1
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +1 -3
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/outline-stroke.js +3 -3
- package/dist/editor/structure/outline-stroke.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +7 -14
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/structure.d.ts +1 -2
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +3 -3
- package/dist/editor/structure.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 +9 -2
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +57 -1
- 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.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +7 -1
- 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/fonts/loaded.d.ts +3 -1
- package/dist/figma-api/fonts/loaded.d.ts.map +1 -1
- package/dist/figma-api/fonts/loaded.js +8 -1
- package/dist/figma-api/fonts/loaded.js.map +1 -1
- package/dist/figma-api/index.d.ts +18 -0
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +19 -1
- 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/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +1 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +41 -13
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +113 -31
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/serialization.d.ts.map +1 -1
- package/dist/figma-api/serialization.js +2 -1
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/shape-details.d.ts +26 -0
- package/dist/figma-api/shape-details.d.ts.map +1 -0
- package/dist/figma-api/shape-details.js +28 -0
- package/dist/figma-api/shape-details.js.map +1 -0
- package/dist/figma-api/shape-with-text.js +2 -5
- package/dist/figma-api/shape-with-text.js.map +1 -1
- package/dist/figma-api/surface.d.ts +7 -4
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +7 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +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/icons/svg.js +1 -1
- package/dist/icons/svg.js.map +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/decode.js +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/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.map +1 -1
- 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/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.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +2 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +5 -0
- package/dist/io/formats/fig/export/patch/index.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/layers.d.ts +7 -4
- package/dist/io/formats/html/layers.d.ts.map +1 -1
- package/dist/io/formats/html/layers.js +4 -1
- package/dist/io/formats/html/layers.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 +3 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +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/dom.d.ts +6 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +9 -22
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -1
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +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 +31 -3
- 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/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.map +1 -1
- package/dist/io/formats/raster/render.js +4 -0
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +5 -6
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +4 -54
- 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 +7 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +224 -50
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +27 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +44 -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/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/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 +6 -3
- 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 +40 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/types.d.ts +19 -4
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +50 -12
- package/dist/layout/apply.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/derived.d.ts +7 -1
- package/dist/layout/derived.d.ts.map +1 -1
- package/dist/layout/derived.js +11 -1
- package/dist/layout/derived.js.map +1 -1
- package/dist/layout/grid.d.ts +7 -2
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +27 -9
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/mutations.d.ts +1 -0
- package/dist/layout/mutations.d.ts.map +1 -1
- package/dist/layout/mutations.js +10 -0
- package/dist/layout/mutations.js.map +1 -1
- package/dist/layout/strokes.d.ts +9 -1
- package/dist/layout/strokes.d.ts.map +1 -1
- package/dist/layout/strokes.js +12 -1
- package/dist/layout/strokes.js.map +1 -1
- package/dist/layout/yoga-helpers.d.ts +3 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +16 -2
- 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 +73 -39
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +9 -3
- 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 +13 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +123 -9
- 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/effect-style-required.js +1 -0
- package/dist/lint/rules/effect-style-required.js.map +1 -1
- 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/rules/text-style-required.js +1 -0
- package/dist/lint/rules/text-style-required.js.map +1 -1
- package/dist/lint/types.d.ts +32 -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/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 +45 -1
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +55 -2
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +12 -1
- 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/commands.d.ts +2 -2
- package/dist/rpc/index.d.ts +2 -2
- package/dist/rpc/read-commands.d.ts +18 -8
- package/dist/rpc/read-commands.d.ts.map +1 -1
- package/dist/rpc/read-commands.js +18 -9
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/text/font/faces.d.ts +12 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +15 -1
- package/dist/text/font/faces.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 +66 -12
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +11 -9
- package/dist/text/index.js +4 -2
- 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/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +203 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -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.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +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.js +3 -2
- 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 +2 -1
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +2 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.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/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -1
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -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/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +1 -0
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/paint.js +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +3 -3
- 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 +26 -5
- 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/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 +2 -1
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.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 -3
- package/dist/tools/read/space.js.map +1 -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 +3 -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 +18 -2
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +1 -1
- package/dist/tools/schema.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 +22 -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/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/path.d.ts.map +1 -1
- package/dist/tools/vector/path.js +39 -7
- package/dist/tools/vector/path.js.map +1 -1
- package/dist/tools/vector/vectorize.js +1 -0
- 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 +19 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
- package/dist/xpath.d.ts +3 -0
- package/dist/xpath.d.ts.map +1 -1
- package/dist/xpath.js +3 -1
- package/dist/xpath.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 +161 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +94 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +1 -12
- package/src/canvas/renderer/fonts.ts +2 -0
- package/src/canvas/renderer/lifecycle.ts +6 -0
- package/src/canvas/renderer/methods.ts +0 -9
- package/src/canvas/renderer/overlay-pass.ts +0 -1
- package/src/canvas/renderer/pipeline.ts +19 -2
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/types.ts +18 -3
- package/src/canvas/renderer.ts +40 -4
- package/src/canvas/scene.ts +65 -9
- package/src/canvas/texture.ts +136 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-jsx/index.ts +1 -1
- package/src/design-jsx/renderer.ts +1 -1
- 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/export.ts +24 -7
- package/src/editor/clipboard/snapshot.ts +21 -4
- package/src/editor/clipboard.ts +4 -14
- package/src/editor/color-space.ts +47 -38
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/create.ts +39 -71
- 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 +198 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +29 -1
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +16 -2
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/nudge.ts +1 -1
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +6 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/container.ts +24 -1
- package/src/editor/selection/navigation.ts +8 -6
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/shapes/with-text.ts +2 -5
- package/src/editor/structure/auto-layout-wrap.ts +1 -1
- package/src/editor/structure/boolean.ts +1 -3
- package/src/editor/structure/group/bounds.ts +1 -5
- package/src/editor/structure/outline-stroke.ts +3 -3
- package/src/editor/structure/reorder.ts +8 -14
- package/src/editor/structure/state.ts +1 -1
- package/src/editor/structure.ts +5 -8
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +8 -1
- package/src/editor/variables.ts +74 -2
- 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 +17 -1
- 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/fonts/loaded.ts +9 -0
- package/src/figma-api/index.ts +35 -0
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/proxy.ts +6 -1
- package/src/figma-api/reactions.ts +130 -32
- package/src/figma-api/serialization.ts +2 -1
- package/src/figma-api/shape-details.ts +50 -0
- package/src/figma-api/shape-with-text.ts +2 -5
- package/src/figma-api/surface.ts +7 -2
- package/src/global.d.ts +31 -0
- package/src/icons/svg.ts +3 -1
- package/src/io/formats/boolean-path.ts +60 -0
- 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/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +10 -2
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +587 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- 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 +5 -1
- package/src/io/formats/fig/export/patch/index.ts +8 -0
- 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/layers.ts +11 -2
- package/src/io/formats/html/vectors.ts +8 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pdf/dom.ts +10 -18
- package/src/io/formats/pdf/export.ts +1 -1
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +36 -5
- 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 +12 -1
- package/src/io/formats/svg/defs.ts +14 -73
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +371 -64
- package/src/io/formats/svg/filter.ts +47 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/layout.ts +13 -3
- 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 +59 -11
- package/src/io/types.ts +29 -10
- package/src/layout/apply.ts +87 -21
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout/derived.ts +14 -0
- package/src/layout/grid.ts +33 -9
- package/src/layout/mutations.ts +13 -1
- package/src/layout/strokes.ts +12 -0
- package/src/layout/yoga-helpers.ts +18 -1
- package/src/layout.ts +96 -49
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +124 -12
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/effect-style-required.ts +2 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/rules/text-style-required.ts +2 -0
- package/src/lint/types.ts +40 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +81 -0
- 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/index.ts +1 -0
- package/src/rpc/read-commands.ts +40 -23
- package/src/text/font/faces.ts +22 -0
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +88 -12
- package/src/text/index.ts +2 -0
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +264 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen.ts +1 -0
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -0
- package/src/tools/create/icons.ts +1 -0
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +1 -0
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/layout.ts +5 -0
- package/src/tools/modify/reactions.ts +15 -8
- package/src/tools/modify/text.ts +42 -5
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/nodes.ts +0 -1
- package/src/tools/read/space.ts +3 -2
- package/src/tools/registry/core.ts +3 -1
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +28 -4
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +34 -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/vector/boolean.ts +4 -0
- package/src/tools/vector/path.ts +30 -6
- package/src/tools/vector/vectorize.ts +1 -0
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +18 -0
- package/src/xpath.ts +6 -1
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { issuePath } from "./effects.js";
|
|
2
|
+
import { asInstanceEdit, sameReaction } from "../prototype/reactions.js";
|
|
3
|
+
import { PROTOTYPE_EASINGS } from "@pairdraw/scene-graph/constants";
|
|
2
4
|
import { generateId } from "@pairdraw/scene-graph";
|
|
3
5
|
import * as v from "valibot";
|
|
6
|
+
import { variantSetsAround } from "@pairdraw/scene-graph/components";
|
|
4
7
|
//#region src/figma-api/reactions.ts
|
|
5
8
|
/**
|
|
6
9
|
* Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the
|
|
7
|
-
* message it gets instead.
|
|
10
|
+
* message it gets instead.
|
|
8
11
|
*/
|
|
9
12
|
const UNSUPPORTED_TRIGGERS = {
|
|
10
13
|
ON_DRAG: true,
|
|
11
|
-
ON_HOVER: true,
|
|
12
|
-
ON_PRESS: true,
|
|
13
|
-
MOUSE_ENTER: true,
|
|
14
|
-
MOUSE_LEAVE: true,
|
|
15
14
|
MOUSE_UP: true,
|
|
16
15
|
MOUSE_DOWN: true,
|
|
17
16
|
ON_KEY_DOWN: true
|
|
@@ -33,14 +32,26 @@ const overlayPositionSchema = v.picklist([
|
|
|
33
32
|
"BOTTOM_CENTER",
|
|
34
33
|
"BOTTOM_RIGHT"
|
|
35
34
|
]);
|
|
35
|
+
/** Figma's easing presets, which play has; a spring or a custom curve is refused. */
|
|
36
|
+
const easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) });
|
|
36
37
|
const transitionSchema = v.strictObject({
|
|
37
|
-
type: v.picklist([
|
|
38
|
-
|
|
38
|
+
type: v.picklist([
|
|
39
|
+
"INSTANT",
|
|
40
|
+
"DISSOLVE",
|
|
41
|
+
"SMART_ANIMATE"
|
|
42
|
+
]),
|
|
43
|
+
duration: secondsSchema,
|
|
44
|
+
easing: v.optional(easingSchema)
|
|
39
45
|
});
|
|
40
46
|
const nodeActionSchema = v.strictObject({
|
|
41
47
|
type: v.literal("NODE"),
|
|
42
|
-
destinationId: v.pipe(v.string(), v.minLength(1), v.description("
|
|
43
|
-
navigation: v.picklist([
|
|
48
|
+
destinationId: v.pipe(v.string(), v.minLength(1), v.description("NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's top-level frame.")),
|
|
49
|
+
navigation: v.picklist([
|
|
50
|
+
"NAVIGATE",
|
|
51
|
+
"OVERLAY",
|
|
52
|
+
"CHANGE_TO",
|
|
53
|
+
"SCROLL_TO"
|
|
54
|
+
]),
|
|
44
55
|
transition: v.optional(transitionSchema, {
|
|
45
56
|
type: "INSTANT",
|
|
46
57
|
duration: 0
|
|
@@ -52,10 +63,22 @@ const actionSchema = v.variant("type", [
|
|
|
52
63
|
v.strictObject({ type: v.literal("BACK") }),
|
|
53
64
|
v.strictObject({ type: v.literal("CLOSE") })
|
|
54
65
|
]);
|
|
55
|
-
const triggerSchema = v.variant("type", [
|
|
56
|
-
type: v.
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
const triggerSchema = v.variant("type", [
|
|
67
|
+
v.strictObject({ type: v.picklist([
|
|
68
|
+
"ON_CLICK",
|
|
69
|
+
"ON_HOVER",
|
|
70
|
+
"ON_PRESS"
|
|
71
|
+
]) }),
|
|
72
|
+
v.strictObject({
|
|
73
|
+
type: v.literal("AFTER_TIMEOUT"),
|
|
74
|
+
timeout: secondsSchema
|
|
75
|
+
}),
|
|
76
|
+
v.strictObject({
|
|
77
|
+
type: v.picklist(["MOUSE_ENTER", "MOUSE_LEAVE"]),
|
|
78
|
+
delay: v.optional(secondsSchema, 0),
|
|
79
|
+
deprecatedVersion: v.optional(v.boolean())
|
|
80
|
+
})
|
|
81
|
+
]);
|
|
59
82
|
const reactionSchema = v.strictObject({
|
|
60
83
|
trigger: triggerSchema,
|
|
61
84
|
actions: v.pipe(v.array(actionSchema), v.minLength(1))
|
|
@@ -66,26 +89,51 @@ const figmaReactionsSchema = reactionsSchema;
|
|
|
66
89
|
/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */
|
|
67
90
|
function toFigmaReaction(reaction) {
|
|
68
91
|
return {
|
|
69
|
-
trigger: reaction.trigger
|
|
70
|
-
type: "AFTER_TIMEOUT",
|
|
71
|
-
timeout: reaction.trigger.delay
|
|
72
|
-
} : { type: "ON_CLICK" },
|
|
92
|
+
trigger: toFigmaTrigger(reaction.trigger),
|
|
73
93
|
actions: reaction.actions.map(toFigmaAction)
|
|
74
94
|
};
|
|
75
95
|
}
|
|
96
|
+
function toFigmaTrigger({ type, delay }) {
|
|
97
|
+
if (type === "AFTER_TIMEOUT") return {
|
|
98
|
+
type,
|
|
99
|
+
timeout: delay
|
|
100
|
+
};
|
|
101
|
+
if (type === "MOUSE_ENTER" || type === "MOUSE_LEAVE") return {
|
|
102
|
+
type,
|
|
103
|
+
delay
|
|
104
|
+
};
|
|
105
|
+
return { type };
|
|
106
|
+
}
|
|
76
107
|
function toFigmaAction(action) {
|
|
77
108
|
if (action.type !== "NODE") return { type: action.type };
|
|
78
109
|
return {
|
|
79
110
|
type: "NODE",
|
|
80
111
|
destinationId: action.nodeId ?? "",
|
|
81
112
|
navigation: action.navigation,
|
|
82
|
-
transition:
|
|
83
|
-
type: action.transition.type,
|
|
84
|
-
duration: action.transition.duration
|
|
85
|
-
},
|
|
113
|
+
transition: toFigmaTransition(action.transition),
|
|
86
114
|
overlayRelativePosition: action.overlayPosition
|
|
87
115
|
};
|
|
88
116
|
}
|
|
117
|
+
function toFigmaTransition({ type, duration, easing }) {
|
|
118
|
+
return easing ? {
|
|
119
|
+
type,
|
|
120
|
+
duration,
|
|
121
|
+
easing: { type: easing }
|
|
122
|
+
} : {
|
|
123
|
+
type,
|
|
124
|
+
duration
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function fromFigmaTransition({ type, duration, easing }) {
|
|
128
|
+
return easing ? {
|
|
129
|
+
type,
|
|
130
|
+
duration,
|
|
131
|
+
easing: easing.type
|
|
132
|
+
} : {
|
|
133
|
+
type,
|
|
134
|
+
duration
|
|
135
|
+
};
|
|
136
|
+
}
|
|
89
137
|
/**
|
|
90
138
|
* `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.
|
|
91
139
|
* Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,
|
|
@@ -101,36 +149,70 @@ function parseFigmaReactions(value, context) {
|
|
|
101
149
|
throw new Error(`Property "reactions" failed validation: ${issue.message} at ${issuePath(issue.path) || "reactions"}`);
|
|
102
150
|
}
|
|
103
151
|
return result.output.map((reaction, index) => {
|
|
104
|
-
|
|
152
|
+
const parsed = {
|
|
105
153
|
id: context.previous?.[index]?.id ?? generateId(),
|
|
106
154
|
trigger: toTrigger(reaction.trigger),
|
|
107
155
|
actions: reaction.actions.map((action) => toAction(action, context, index))
|
|
108
156
|
};
|
|
157
|
+
const held = context.previous?.[index];
|
|
158
|
+
if (held && sameReaction(held, parsed)) return parsed;
|
|
159
|
+
return asInstanceEdit(parsed, context.inherited ?? []);
|
|
109
160
|
});
|
|
110
161
|
}
|
|
111
162
|
function toTrigger(trigger) {
|
|
163
|
+
const type = trigger.type;
|
|
164
|
+
if (trigger.type === "AFTER_TIMEOUT") return {
|
|
165
|
+
type,
|
|
166
|
+
delay: trigger.timeout
|
|
167
|
+
};
|
|
112
168
|
return {
|
|
113
|
-
type
|
|
114
|
-
delay:
|
|
169
|
+
type,
|
|
170
|
+
delay: "delay" in trigger ? trigger.delay : 0
|
|
115
171
|
};
|
|
116
172
|
}
|
|
117
173
|
function toAction(action, context, reactionIndex) {
|
|
118
174
|
if (action.type !== "NODE") return { type: action.type };
|
|
119
|
-
assertDestination(action
|
|
175
|
+
assertDestination(action, context, reactionIndex);
|
|
120
176
|
return {
|
|
121
177
|
type: "NODE",
|
|
122
178
|
nodeId: action.destinationId,
|
|
123
179
|
navigation: action.navigation,
|
|
124
|
-
transition: action.transition,
|
|
180
|
+
transition: fromFigmaTransition(action.transition),
|
|
125
181
|
overlayPosition: action.navigation === "OVERLAY" ? action.overlayRelativePosition : "CENTER"
|
|
126
182
|
};
|
|
127
183
|
}
|
|
128
|
-
|
|
129
|
-
|
|
184
|
+
function failure(message) {
|
|
185
|
+
return /* @__PURE__ */ new Error(`Property "reactions" failed validation: ${message}`);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A destination play can show: a navigation's is a frame at the top of the layer's page, a Change
|
|
189
|
+
* to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's
|
|
190
|
+
* top-level frame.
|
|
191
|
+
*/
|
|
192
|
+
function assertDestination(action, context, index) {
|
|
193
|
+
const { destinationId, navigation } = action;
|
|
130
194
|
const destination = context.graph.getNode(destinationId);
|
|
131
195
|
const at = `reactions[${index}]`;
|
|
132
|
-
if (!destination) throw
|
|
133
|
-
if (
|
|
196
|
+
if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`);
|
|
197
|
+
if (navigation === "CHANGE_TO") return assertVariant(destination, context, at);
|
|
198
|
+
if (navigation === "SCROLL_TO") return assertScrollTarget(destination, context, at);
|
|
199
|
+
if (destination.type !== "FRAME" || destination.parentId !== context.pageId) throw failure(`${at} must navigate to a top-level frame on the same page, not ${destination.type} "${destination.name}"`);
|
|
200
|
+
}
|
|
201
|
+
function assertVariant(destination, context, at) {
|
|
202
|
+
const sets = variantSetsAround(context.graph, context.nodeId);
|
|
203
|
+
const nearest = sets.at(0);
|
|
204
|
+
if (!nearest) throw failure(`${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`);
|
|
205
|
+
const inSet = sets.some((set) => set.id === destination.parentId);
|
|
206
|
+
if (destination.type !== "COMPONENT" || !inSet) throw failure(`${at} must Change to a variant of ${nearest.name}, not ${destination.type} "${destination.name}"`);
|
|
207
|
+
}
|
|
208
|
+
/** The page's direct child a layer sits in, which play shows as one screen. */
|
|
209
|
+
function topLevelOf(graph, nodeId, pageId) {
|
|
210
|
+
return graph.closest(nodeId, (node) => node.parentId === pageId);
|
|
211
|
+
}
|
|
212
|
+
function assertScrollTarget(destination, context, at) {
|
|
213
|
+
const { graph, nodeId, pageId } = context;
|
|
214
|
+
const top = topLevelOf(graph, nodeId, pageId);
|
|
215
|
+
if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) throw failure(`${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} "${destination.name}"`);
|
|
134
216
|
}
|
|
135
217
|
/** Figma's first unsupported trigger or action kind in `value`, if it has one. */
|
|
136
218
|
function unsupportedKind(value) {
|
|
@@ -140,7 +222,7 @@ function unsupportedKind(value) {
|
|
|
140
222
|
const trigger = reaction.trigger;
|
|
141
223
|
if (trigger && typeof trigger === "object" && "type" in trigger) {
|
|
142
224
|
const type = trigger.type;
|
|
143
|
-
if (typeof type === "string" && type in UNSUPPORTED_TRIGGERS) return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`;
|
|
225
|
+
if (typeof type === "string" && type in UNSUPPORTED_TRIGGERS) return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`;
|
|
144
226
|
}
|
|
145
227
|
const actions = reaction.actions;
|
|
146
228
|
if (!Array.isArray(actions)) continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactions.js","names":[],"sources":["../../src/figma-api/reactions.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { generateId } from '@pairdraw/scene-graph'\nimport type {\n PrototypeAction,\n PrototypeNavigationType,\n PrototypeOverlayPositionType,\n PrototypeReaction,\n PrototypeTransitionType,\n PrototypeTriggerType,\n SceneGraph\n} from '@pairdraw/scene-graph'\n\nimport { issuePath } from '#core/figma-api/effects'\n\n/**\n * Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the\n * message it gets instead. Only a click and a timeout play.\n */\nconst UNSUPPORTED_TRIGGERS: Record<string, true> = {\n ON_DRAG: true,\n ON_HOVER: true,\n ON_PRESS: true,\n MOUSE_ENTER: true,\n MOUSE_LEAVE: true,\n MOUSE_UP: true,\n MOUSE_DOWN: true,\n ON_KEY_DOWN: true\n}\n\n/** Actions Figma's plugin API offers that a prototype in Pairdraw cannot run. */\nconst UNSUPPORTED_ACTIONS: Record<string, true> = {\n URL: true,\n SET_VARIABLE: true,\n CONDITIONAL: true,\n SET_VARIABLE_MODE: true\n}\n\n// No `v.finite()` action: the MCP tool contract turns this schema into JSON Schema, which\n// has no notion of infinities, and JSON numbers are always finite anyway.\nconst secondsSchema = v.pipe(v.number(), v.minValue(0))\n\nconst overlayPositionSchema = v.picklist([\n 'CENTER',\n 'TOP_LEFT',\n 'TOP_CENTER',\n 'TOP_RIGHT',\n 'BOTTOM_LEFT',\n 'BOTTOM_CENTER',\n 'BOTTOM_RIGHT'\n] satisfies PrototypeOverlayPositionType[])\n\nconst transitionSchema = v.strictObject({\n type: v.picklist(['INSTANT', 'DISSOLVE'] satisfies PrototypeTransitionType[]),\n duration: secondsSchema\n})\n\nconst nodeActionSchema = v.strictObject({\n type: v.literal('NODE'),\n destinationId: v.pipe(v.string(), v.minLength(1), v.description('Top-level frame on the page.')),\n navigation: v.picklist(['NAVIGATE', 'OVERLAY'] satisfies PrototypeNavigationType[]),\n transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),\n overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')\n})\n\nconst actionSchema = v.variant('type', [\n nodeActionSchema,\n v.strictObject({ type: v.literal('BACK') }),\n v.strictObject({ type: v.literal('CLOSE') })\n])\n\nconst triggerSchema = v.variant('type', [\n v.strictObject({ type: v.literal('ON_CLICK') }),\n v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema })\n])\n\nconst reactionSchema = v.strictObject({\n trigger: triggerSchema,\n actions: v.pipe(v.array(actionSchema), v.minLength(1))\n})\n\nconst reactionsSchema = v.array(reactionSchema)\n\n/** The plugin shape as a contract, for a tool that takes connections as arguments. */\nexport const figmaReactionsSchema = reactionsSchema\n\n/** A reaction as Figma's plugin API reads and writes it (`Reaction` in `@figma/plugin-typings`). */\nexport type FigmaReaction = v.InferOutput<typeof reactionSchema>\nexport type FigmaReactionTrigger = FigmaReaction['trigger']\nexport type FigmaReactionAction = FigmaReaction['actions'][number]\n\n/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */\nexport function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {\n const trigger: FigmaReactionTrigger =\n reaction.trigger.type === 'AFTER_TIMEOUT'\n ? { type: 'AFTER_TIMEOUT', timeout: reaction.trigger.delay }\n : { type: 'ON_CLICK' }\n return { trigger, actions: reaction.actions.map(toFigmaAction) }\n}\n\nfunction toFigmaAction(action: PrototypeAction): FigmaReactionAction {\n if (action.type !== 'NODE') return { type: action.type }\n return {\n type: 'NODE',\n destinationId: action.nodeId ?? '',\n navigation: action.navigation,\n transition: { type: action.transition.type, duration: action.transition.duration },\n overlayRelativePosition: action.overlayPosition\n }\n}\n\n/** The validation context: where the reactions live, and what they may point at. */\nexport interface ReactionContext {\n graph: SceneGraph\n /** The page the layer is on; a destination must be a top-level frame on it. */\n pageId: string\n /** The reactions the layer has now, whose ids this keeps by position. */\n previous?: readonly PrototypeReaction[]\n}\n\n/**\n * `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.\n * Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,\n * an action, transition, navigation or overlay spot outside the model, and a destination that\n * is not a top-level frame on the layer's page are refused rather than kept unplayable.\n */\nexport function parseFigmaReactions(value: unknown, context: ReactionContext): PrototypeReaction[] {\n const unsupported = unsupportedKind(value)\n if (unsupported) throw new Error(`Property \"reactions\" failed validation: ${unsupported}`)\n const result = v.safeParse(reactionsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"reactions\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'reactions'}`\n )\n }\n return result.output.map((reaction, index) => {\n const id = context.previous?.[index]?.id ?? generateId()\n return {\n id,\n trigger: toTrigger(reaction.trigger),\n actions: reaction.actions.map((action) => toAction(action, context, index))\n }\n })\n}\n\nfunction toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {\n const type: PrototypeTriggerType = trigger.type\n return { type, delay: trigger.type === 'AFTER_TIMEOUT' ? trigger.timeout : 0 }\n}\n\nfunction toAction(\n action: FigmaReactionAction,\n context: ReactionContext,\n reactionIndex: number\n): PrototypeAction {\n if (action.type !== 'NODE') return { type: action.type }\n assertDestination(action.destinationId, context, reactionIndex)\n return {\n type: 'NODE',\n nodeId: action.destinationId,\n navigation: action.navigation,\n transition: action.transition,\n // Only an overlay uses the spot; Figma keeps CENTER on a navigation.\n overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'\n }\n}\n\n/** A destination must be a frame at the top of the layer's page, as the play can only show one. */\nfunction assertDestination(destinationId: string, context: ReactionContext, index: number): void {\n const destination = context.graph.getNode(destinationId)\n const at = `reactions[${index}]`\n if (!destination) {\n throw new Error(\n `Property \"reactions\" failed validation: no layer ${destinationId} at ${at}.actions[0].destinationId`\n )\n }\n if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {\n throw new Error(\n `Property \"reactions\" failed validation: ${at} must navigate to a top-level frame on the same page, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** Figma's first unsupported trigger or action kind in `value`, if it has one. */\nfunction unsupportedKind(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n const reactions = value.filter(\n (reaction): reaction is Record<string, unknown> =>\n Boolean(reaction) && typeof reaction === 'object'\n )\n for (const reaction of reactions) {\n const trigger = reaction.trigger\n if (trigger && typeof trigger === 'object' && 'type' in trigger) {\n const type = trigger.type\n if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {\n return `a prototype starts from ON_CLICK or AFTER_TIMEOUT, not ${type}`\n }\n }\n const actions = reaction.actions\n if (!Array.isArray(actions)) continue\n for (const action of actions) {\n if (action && typeof action === 'object' && 'type' in action) {\n const type = action.type\n if (typeof type === 'string' && type in UNSUPPORTED_ACTIONS) {\n return `an action is NODE, BACK or CLOSE, not ${type}`\n }\n }\n }\n }\n return null\n}\n"],"mappings":";;;;;;;;AAmBA,MAAM,uBAA6C;CACjD,SAAS;CACT,UAAU;CACV,UAAU;CACV,aAAa;CACb,aAAa;CACb,UAAU;CACV,YAAY;CACZ,aAAa;AACf;;AAGA,MAAM,sBAA4C;CAChD,KAAK;CACL,cAAc;CACd,aAAa;CACb,mBAAmB;AACrB;AAIA,MAAM,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,CAAC;AAEtD,MAAM,wBAAwB,EAAE,SAAS;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAA0C;AAE1C,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,SAAS,CAAC,WAAW,UAAU,CAAqC;CAC5E,UAAU;AACZ,CAAC;AAED,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,QAAQ,MAAM;CACtB,eAAe,EAAE,KAAK,EAAE,OAAO,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K,IAAI,YAAY,KAAK,EAClJ;AAEJ;;AAGA,SAAS,gBAAgB,OAA+B;CACtD,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO;CAClC,MAAM,YAAY,MAAM,QACrB,aACC,QAAQ,QAAQ,KAAK,OAAO,aAAa,QAC7C;CACA,KAAK,MAAM,YAAY,WAAW;EAChC,MAAM,UAAU,SAAS;EACzB,IAAI,WAAW,OAAO,YAAY,YAAY,UAAU,SAAS;GAC/D,MAAM,OAAO,QAAQ;GACrB,IAAI,OAAO,SAAS,YAAY,QAAQ,sBACtC,OAAO,0DAA0D;EAErE;EACA,MAAM,UAAU,SAAS;EACzB,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;EAC7B,KAAK,MAAM,UAAU,SACnB,IAAI,UAAU,OAAO,WAAW,YAAY,UAAU,QAAQ;GAC5D,MAAM,OAAO,OAAO;GACpB,IAAI,OAAO,SAAS,YAAY,QAAQ,qBACtC,OAAO,yCAAyC;EAEpD;CAEJ;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"reactions.js","names":[],"sources":["../../src/figma-api/reactions.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport { generateId } from '@pairdraw/scene-graph'\nimport type {\n PrototypeAction,\n PrototypeNavigationType,\n PrototypeOverlayPositionType,\n PrototypeReaction,\n PrototypeTransition,\n PrototypeTransitionType,\n PrototypeTriggerType,\n SceneGraph,\n SceneNode\n} from '@pairdraw/scene-graph'\nimport { variantSetsAround } from '@pairdraw/scene-graph/components'\nimport { PROTOTYPE_EASINGS } from '@pairdraw/scene-graph/constants'\n\nimport { issuePath } from '#core/figma-api/effects'\nimport { asInstanceEdit, sameReaction } from '#core/prototype/reactions'\n\n/**\n * Triggers Figma's plugin API offers that a prototype in Pairdraw cannot start from, and the\n * message it gets instead.\n */\nconst UNSUPPORTED_TRIGGERS: Record<string, true> = {\n ON_DRAG: true,\n MOUSE_UP: true,\n MOUSE_DOWN: true,\n ON_KEY_DOWN: true\n}\n\n/** Actions Figma's plugin API offers that a prototype in Pairdraw cannot run. */\nconst UNSUPPORTED_ACTIONS: Record<string, true> = {\n URL: true,\n SET_VARIABLE: true,\n CONDITIONAL: true,\n SET_VARIABLE_MODE: true\n}\n\n// No `v.finite()` action: the MCP tool contract turns this schema into JSON Schema, which\n// has no notion of infinities, and JSON numbers are always finite anyway.\nconst secondsSchema = v.pipe(v.number(), v.minValue(0))\n\nconst overlayPositionSchema = v.picklist([\n 'CENTER',\n 'TOP_LEFT',\n 'TOP_CENTER',\n 'TOP_RIGHT',\n 'BOTTOM_LEFT',\n 'BOTTOM_CENTER',\n 'BOTTOM_RIGHT'\n] satisfies PrototypeOverlayPositionType[])\n\n/** Figma's easing presets, which play has; a spring or a custom curve is refused. */\nconst easingSchema = v.strictObject({ type: v.picklist(PROTOTYPE_EASINGS) })\n\nconst transitionSchema = v.strictObject({\n type: v.picklist(['INSTANT', 'DISSOLVE', 'SMART_ANIMATE'] satisfies PrototypeTransitionType[]),\n duration: secondsSchema,\n easing: v.optional(easingSchema)\n})\n\nconst nodeActionSchema = v.strictObject({\n type: v.literal('NODE'),\n destinationId: v.pipe(\n v.string(),\n v.minLength(1),\n v.description(\n 'NAVIGATE/OVERLAY: a top-level frame on the page; CHANGE_TO: a variant of the set the ' +\n \"layer is a variant of, an instance of, or inside; SCROLL_TO: a layer in the layer's \" +\n 'top-level frame.'\n )\n ),\n navigation: v.picklist([\n 'NAVIGATE',\n 'OVERLAY',\n 'CHANGE_TO',\n 'SCROLL_TO'\n ] satisfies PrototypeNavigationType[]),\n transition: v.optional(transitionSchema, { type: 'INSTANT', duration: 0 }),\n overlayRelativePosition: v.optional(overlayPositionSchema, 'CENTER')\n})\n\nconst actionSchema = v.variant('type', [\n nodeActionSchema,\n v.strictObject({ type: v.literal('BACK') }),\n v.strictObject({ type: v.literal('CLOSE') })\n])\n\nconst triggerSchema = v.variant('type', [\n v.strictObject({ type: v.picklist(['ON_CLICK', 'ON_HOVER', 'ON_PRESS']) }),\n v.strictObject({ type: v.literal('AFTER_TIMEOUT'), timeout: secondsSchema }),\n v.strictObject({\n type: v.picklist(['MOUSE_ENTER', 'MOUSE_LEAVE']),\n delay: v.optional(secondsSchema, 0),\n // Figma's plugin API reads it; play treats both versions alike.\n deprecatedVersion: v.optional(v.boolean())\n })\n])\n\nconst reactionSchema = v.strictObject({\n trigger: triggerSchema,\n actions: v.pipe(v.array(actionSchema), v.minLength(1))\n})\n\nconst reactionsSchema = v.array(reactionSchema)\n\n/** The plugin shape as a contract, for a tool that takes connections as arguments. */\nexport const figmaReactionsSchema = reactionsSchema\n\n/** A reaction as Figma's plugin API reads and writes it (`Reaction` in `@figma/plugin-typings`). */\nexport type FigmaReaction = v.InferOutput<typeof reactionSchema>\nexport type FigmaReactionTrigger = FigmaReaction['trigger']\nexport type FigmaReactionAction = FigmaReaction['actions'][number]\n\n/** `reaction` in the plugin shape: the trigger and every action, named as Figma names them. */\nexport function toFigmaReaction(reaction: PrototypeReaction): FigmaReaction {\n return { trigger: toFigmaTrigger(reaction.trigger), actions: reaction.actions.map(toFigmaAction) }\n}\n\nfunction toFigmaTrigger({ type, delay }: PrototypeReaction['trigger']): FigmaReactionTrigger {\n if (type === 'AFTER_TIMEOUT') return { type, timeout: delay }\n if (type === 'MOUSE_ENTER' || type === 'MOUSE_LEAVE') return { type, delay }\n return { type }\n}\n\nfunction toFigmaAction(action: PrototypeAction): FigmaReactionAction {\n if (action.type !== 'NODE') return { type: action.type }\n return {\n type: 'NODE',\n destinationId: action.nodeId ?? '',\n navigation: action.navigation,\n transition: toFigmaTransition(action.transition),\n overlayRelativePosition: action.overlayPosition\n }\n}\n\nfunction toFigmaTransition({\n type,\n duration,\n easing\n}: PrototypeTransition): v.InferOutput<typeof transitionSchema> {\n return easing ? { type, duration, easing: { type: easing } } : { type, duration }\n}\n\nfunction fromFigmaTransition({\n type,\n duration,\n easing\n}: v.InferOutput<typeof transitionSchema>): PrototypeTransition {\n return easing ? { type, duration, easing: easing.type } : { type, duration }\n}\n\n/** The validation context: where the reactions live, and what they may point at. */\nexport interface ReactionContext {\n graph: SceneGraph\n /** The layer the reactions are on, which a Change to or Scroll to destination must suit. */\n nodeId: string\n /** The page the layer is on; a navigation's destination must be a top-level frame on it. */\n pageId: string\n /** The reactions the layer has now, whose ids this keeps by position. */\n previous?: readonly PrototypeReaction[]\n /**\n * An instance's main component's reactions: a reaction kept under one of their ids that an\n * edit changed, from what the layer held at its place and from the main's, becomes the\n * instance's own, with an id of its own.\n */\n inherited?: readonly PrototypeReaction[]\n}\n\n/**\n * `value` as the layer's prototype reactions, or an error naming what Pairdraw cannot play.\n * Accepts Figma's plugin shape only: a trigger Figma offers but playback does not start from,\n * an action, transition, navigation or overlay spot outside the model, and a destination that\n * is not a top-level frame on the layer's page are refused rather than kept unplayable.\n */\nexport function parseFigmaReactions(value: unknown, context: ReactionContext): PrototypeReaction[] {\n const unsupported = unsupportedKind(value)\n if (unsupported) throw new Error(`Property \"reactions\" failed validation: ${unsupported}`)\n const result = v.safeParse(reactionsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"reactions\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'reactions'}`\n )\n }\n return result.output.map((reaction, index) => {\n const id = context.previous?.[index]?.id ?? generateId()\n const parsed: PrototypeReaction = {\n id,\n trigger: toTrigger(reaction.trigger),\n actions: reaction.actions.map((action) => toAction(action, context, index))\n }\n // One the layer already held unchanged stays as it was, a copy of the main's included, so\n // writing reactions back as read never re-ids a copy whose main was edited since.\n const held = context.previous?.[index]\n if (held && sameReaction(held, parsed)) return parsed\n return asInstanceEdit(parsed, context.inherited ?? [])\n })\n}\n\nfunction toTrigger(trigger: FigmaReactionTrigger): PrototypeReaction['trigger'] {\n const type: PrototypeTriggerType = trigger.type\n if (trigger.type === 'AFTER_TIMEOUT') return { type, delay: trigger.timeout }\n return { type, delay: 'delay' in trigger ? trigger.delay : 0 }\n}\n\nfunction toAction(\n action: FigmaReactionAction,\n context: ReactionContext,\n reactionIndex: number\n): PrototypeAction {\n if (action.type !== 'NODE') return { type: action.type }\n assertDestination(action, context, reactionIndex)\n return {\n type: 'NODE',\n nodeId: action.destinationId,\n navigation: action.navigation,\n transition: fromFigmaTransition(action.transition),\n // Only an overlay uses the spot; Figma keeps CENTER on a navigation.\n overlayPosition: action.navigation === 'OVERLAY' ? action.overlayRelativePosition : 'CENTER'\n }\n}\n\nfunction failure(message: string): Error {\n return new Error(`Property \"reactions\" failed validation: ${message}`)\n}\n\n/**\n * A destination play can show: a navigation's is a frame at the top of the layer's page, a Change\n * to's a variant of a set the layer belongs to, and a Scroll to's a layer in the layer's\n * top-level frame.\n */\nfunction assertDestination(\n action: v.InferOutput<typeof nodeActionSchema>,\n context: ReactionContext,\n index: number\n): void {\n const { destinationId, navigation } = action\n const destination = context.graph.getNode(destinationId)\n const at = `reactions[${index}]`\n if (!destination) throw failure(`no layer ${destinationId} at ${at}.actions[0].destinationId`)\n if (navigation === 'CHANGE_TO') return assertVariant(destination, context, at)\n if (navigation === 'SCROLL_TO') return assertScrollTarget(destination, context, at)\n if (destination.type !== 'FRAME' || destination.parentId !== context.pageId) {\n throw failure(\n `${at} must navigate to a top-level frame on the same page, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\nfunction assertVariant(destination: SceneNode, context: ReactionContext, at: string): void {\n const sets = variantSetsAround(context.graph, context.nodeId)\n const nearest = sets.at(0)\n if (!nearest) {\n throw failure(\n `${at}: only a variant, an instance of one, or a layer inside one can Change to another variant`\n )\n }\n const inSet = sets.some((set) => set.id === destination.parentId)\n if (destination.type !== 'COMPONENT' || !inSet) {\n throw failure(\n `${at} must Change to a variant of ${nearest.name}, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** The page's direct child a layer sits in, which play shows as one screen. */\nfunction topLevelOf(graph: SceneGraph, nodeId: string, pageId: string): SceneNode | undefined {\n return graph.closest(nodeId, (node) => node.parentId === pageId)\n}\n\nfunction assertScrollTarget(destination: SceneNode, context: ReactionContext, at: string): void {\n const { graph, nodeId, pageId } = context\n const top = topLevelOf(graph, nodeId, pageId)\n if (!top || destination.id === top.id || !graph.isDescendant(destination.id, top.id)) {\n throw failure(\n `${at} must Scroll to a layer inside the same top-level frame, not ${destination.type} \"${destination.name}\"`\n )\n }\n}\n\n/** Figma's first unsupported trigger or action kind in `value`, if it has one. */\nfunction unsupportedKind(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n const reactions = value.filter(\n (reaction): reaction is Record<string, unknown> =>\n Boolean(reaction) && typeof reaction === 'object'\n )\n for (const reaction of reactions) {\n const trigger = reaction.trigger\n if (trigger && typeof trigger === 'object' && 'type' in trigger) {\n const type = trigger.type\n if (typeof type === 'string' && type in UNSUPPORTED_TRIGGERS) {\n return `a prototype starts from ON_CLICK, ON_HOVER, ON_PRESS, MOUSE_ENTER, MOUSE_LEAVE or AFTER_TIMEOUT, not ${type}`\n }\n }\n const actions = reaction.actions\n if (!Array.isArray(actions)) continue\n for (const action of actions) {\n if (action && typeof action === 'object' && 'type' in action) {\n const type = action.type\n if (typeof type === 'string' && type in UNSUPPORTED_ACTIONS) {\n return `an action is NODE, BACK or CLOSE, not ${type}`\n }\n }\n }\n }\n return null\n}\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,uBAA6C;CACjD,SAAS;CACT,UAAU;CACV,YAAY;CACZ,aAAa;AACf;;AAGA,MAAM,sBAA4C;CAChD,KAAK;CACL,cAAc;CACd,aAAa;CACb,mBAAmB;AACrB;AAIA,MAAM,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,SAAS,CAAC,CAAC;AAEtD,MAAM,wBAAwB,EAAE,SAAS;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAA0C;;AAG1C,MAAM,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;AAE3E,MAAM,mBAAmB,EAAE,aAAa;CACtC,MAAM,EAAE,SAAS;EAAC;EAAW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AO;GACpB,IAAI,OAAO,SAAS,YAAY,QAAQ,qBACtC,OAAO,yCAAyC;EAEpD;CAEJ;CACA,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getWorldMatrix } from "@pairdraw/scene-graph/coordinate";
|
|
2
2
|
import { geometryBlobBounds, intersectVisualBounds, strokeOverflow, unionVisualBounds } from "@pairdraw/scene-graph/geometry";
|
|
3
|
-
import { textLinesReach } from "@pairdraw/scene-graph/text";
|
|
4
3
|
import Matrix from "@pairdraw/scene-graph/matrix";
|
|
4
|
+
import { textLinesReach } from "@pairdraw/scene-graph/text";
|
|
5
5
|
//#region src/figma-api/render-bounds.ts
|
|
6
6
|
const INTRINSIC_CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
7
7
|
"FRAME",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","names":[],"sources":["../../src/figma-api/serialization.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","names":[],"sources":["../../src/figma-api/serialization.ts"],"mappings":";;;iBAsCgB,gBACd,OAAO,YACP,KAAK,eACL,gBACA,mBACA,wBACC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { pluginChildren } from "./accessors/sticky.js";
|
|
2
2
|
import { figmaFills, figmaStrokes } from "./accessors/visual.js";
|
|
3
|
+
import { shapeDetailFields } from "./shape-details.js";
|
|
3
4
|
//#region src/figma-api/serialization.ts
|
|
4
5
|
function resolveBindings(graph, node) {
|
|
5
6
|
if (Object.keys(node.boundVariables).length === 0) return void 0;
|
|
@@ -49,7 +50,7 @@ function nodeProxyToJSON(graph, api, nodeId, maxDepth, currentDepth = 0) {
|
|
|
49
50
|
if (n.effects.length > 0) obj.effects = n.effects;
|
|
50
51
|
if (n.opacity !== 1) obj.opacity = n.opacity;
|
|
51
52
|
if (n.rotation !== 0) obj.rotation = api.wrapNode(nodeId).rotation;
|
|
52
|
-
|
|
53
|
+
Object.assign(obj, shapeDetailFields(n));
|
|
53
54
|
if (!n.visible) obj.visible = false;
|
|
54
55
|
if (n.text) obj.characters = n.text;
|
|
55
56
|
if (n.type === "TEXT") appendTextProps(obj, n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.js","names":[],"sources":["../../src/figma-api/serialization.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { pluginChildren } from './accessors/sticky'\nimport { figmaFills, figmaStrokes } from './accessors/visual'\nimport type { NodeProxyHost } from './proxy'\n\nfunction resolveBindings(graph: SceneGraph, node: SceneNode): Record<string, unknown> | undefined {\n const keys = Object.keys(node.boundVariables)\n if (keys.length === 0) return undefined\n const result: Record<string, unknown> = {}\n for (const [field, varId] of Object.entries(node.boundVariables)) {\n const variable = graph.variables.get(varId)\n result[field] = {\n variableId: varId,\n variableName: variable?.name ?? varId,\n resolvedValue: variable ? graph.resolveVariable(varId) : undefined\n }\n }\n return result\n}\n\nfunction appendTextProps(obj: Record<string, unknown>, n: SceneNode): void {\n obj.fontFamily = n.fontFamily\n obj.fontSize = n.fontSize\n obj.fontWeight = n.fontWeight\n obj.italic = n.italic\n obj.textAlignHorizontal = n.textAlignHorizontal\n obj.textAlignVertical = n.textAlignVertical\n obj.textAutoResize = n.textAutoResize\n obj.textDirection = n.textDirection\n if (n.lineHeight != null) obj.lineHeight = n.lineHeight\n if (n.letterSpacing.value !== 0) obj.letterSpacing = n.letterSpacing\n if (n.textCase !== 'ORIGINAL') obj.textCase = n.textCase\n if (n.textDecoration !== 'NONE') obj.textDecoration = n.textDecoration\n if (n.maxLines != null) obj.maxLines = n.maxLines\n}\n\nexport function nodeProxyToJSON(\n graph: SceneGraph,\n api: NodeProxyHost,\n nodeId: string,\n maxDepth?: number,\n currentDepth = 0\n): Record<string, unknown> {\n const n = graph.getNode(nodeId)\n if (!n) return { id: nodeId, removed: true }\n\n const obj: Record<string, unknown> = {\n id: n.id,\n type: n.type,\n name: n.name,\n x: n.x,\n y: n.y,\n width: n.width,\n height: n.height\n }\n if (n.fills.length > 0) obj.fills = figmaFills(n)\n if (n.strokes.length > 0) obj.strokes = figmaStrokes(n)\n if (n.effects.length > 0) obj.effects = n.effects\n if (n.opacity !== 1) obj.opacity = n.opacity\n // The angle `set_rotation` writes, as the Figma API reports it. The scene stores the turn in\n // the opposite direction and keeps floating-point noise, so read it through the proxy.\n if (n.rotation !== 0) obj.rotation = api.wrapNode(nodeId).rotation\n
|
|
1
|
+
{"version":3,"file":"serialization.js","names":[],"sources":["../../src/figma-api/serialization.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { pluginChildren } from './accessors/sticky'\nimport { figmaFills, figmaStrokes } from './accessors/visual'\nimport type { NodeProxyHost } from './proxy'\nimport { shapeDetailFields } from './shape-details'\n\nfunction resolveBindings(graph: SceneGraph, node: SceneNode): Record<string, unknown> | undefined {\n const keys = Object.keys(node.boundVariables)\n if (keys.length === 0) return undefined\n const result: Record<string, unknown> = {}\n for (const [field, varId] of Object.entries(node.boundVariables)) {\n const variable = graph.variables.get(varId)\n result[field] = {\n variableId: varId,\n variableName: variable?.name ?? varId,\n resolvedValue: variable ? graph.resolveVariable(varId) : undefined\n }\n }\n return result\n}\n\nfunction appendTextProps(obj: Record<string, unknown>, n: SceneNode): void {\n obj.fontFamily = n.fontFamily\n obj.fontSize = n.fontSize\n obj.fontWeight = n.fontWeight\n obj.italic = n.italic\n obj.textAlignHorizontal = n.textAlignHorizontal\n obj.textAlignVertical = n.textAlignVertical\n obj.textAutoResize = n.textAutoResize\n obj.textDirection = n.textDirection\n if (n.lineHeight != null) obj.lineHeight = n.lineHeight\n if (n.letterSpacing.value !== 0) obj.letterSpacing = n.letterSpacing\n if (n.textCase !== 'ORIGINAL') obj.textCase = n.textCase\n if (n.textDecoration !== 'NONE') obj.textDecoration = n.textDecoration\n if (n.maxLines != null) obj.maxLines = n.maxLines\n}\n\nexport function nodeProxyToJSON(\n graph: SceneGraph,\n api: NodeProxyHost,\n nodeId: string,\n maxDepth?: number,\n currentDepth = 0\n): Record<string, unknown> {\n const n = graph.getNode(nodeId)\n if (!n) return { id: nodeId, removed: true }\n\n const obj: Record<string, unknown> = {\n id: n.id,\n type: n.type,\n name: n.name,\n x: n.x,\n y: n.y,\n width: n.width,\n height: n.height\n }\n if (n.fills.length > 0) obj.fills = figmaFills(n)\n if (n.strokes.length > 0) obj.strokes = figmaStrokes(n)\n if (n.effects.length > 0) obj.effects = n.effects\n if (n.opacity !== 1) obj.opacity = n.opacity\n // The angle `set_rotation` writes, as the Figma API reports it. The scene stores the turn in\n // the opposite direction and keeps floating-point noise, so read it through the proxy.\n if (n.rotation !== 0) obj.rotation = api.wrapNode(nodeId).rotation\n Object.assign(obj, shapeDetailFields(n))\n if (!n.visible) obj.visible = false\n if (n.text) obj.characters = n.text\n if (n.type === 'TEXT') {\n appendTextProps(obj, n)\n }\n if (n.layoutMode !== 'NONE') {\n // An auto layout frame reports the insets and alignment a tool sets, so a caller can read back\n // what it wrote instead of measuring the result.\n const proxy = api.wrapNode(nodeId)\n obj.layoutMode = n.layoutMode\n obj.layoutDirection = n.layoutDirection\n obj.itemSpacing = n.itemSpacing\n obj.paddingTop = proxy.paddingTop\n obj.paddingRight = proxy.paddingRight\n obj.paddingBottom = proxy.paddingBottom\n obj.paddingLeft = proxy.paddingLeft\n obj.primaryAxisAlignItems = proxy.primaryAxisAlignItems\n obj.counterAxisAlignItems = proxy.counterAxisAlignItems\n obj.primaryAxisSizingMode = proxy.primaryAxisSizingMode\n obj.counterAxisSizingMode = proxy.counterAxisSizingMode\n }\n // Include variable bindings with resolved values\n const bindings = resolveBindings(graph, n)\n if (bindings) obj.boundVariables = bindings\n const children = pluginChildren(graph, nodeId)\n if (children.length > 0) {\n if (maxDepth !== undefined && currentDepth >= maxDepth) {\n obj.childCount = children.length\n } else {\n obj.children = children.map((child) =>\n api.wrapNode(child.id).toJSON(maxDepth, currentDepth + 1)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|
|
2
|
+
//#region src/figma-api/shape-details.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The shape details a node summary reports, under Figma's plugin-API names: the per-corner radii
|
|
5
|
+
* once the corners are drawn one by one and disagree, the mask flag and type while the layer masks,
|
|
6
|
+
* and a boolean layer's operation. A plain layer carries none of them.
|
|
7
|
+
*
|
|
8
|
+
* The per-corner fields are live only while `independentCorners` is set; otherwise the shape renders
|
|
9
|
+
* the uniform `cornerRadius` and any stored per-corner values are stale (a .fig import or a uniform
|
|
10
|
+
* radius-handle write leaves them), so they stay out. While the corners disagree the proxy reads
|
|
11
|
+
* `cornerRadius` as `mixed`, which JSON cannot hold, so the uniform field stays out too.
|
|
12
|
+
*/
|
|
13
|
+
interface ShapeDetailFields {
|
|
14
|
+
cornerRadius?: number;
|
|
15
|
+
topLeftRadius?: number;
|
|
16
|
+
topRightRadius?: number;
|
|
17
|
+
bottomRightRadius?: number;
|
|
18
|
+
bottomLeftRadius?: number;
|
|
19
|
+
isMask?: boolean;
|
|
20
|
+
maskType?: MaskType;
|
|
21
|
+
booleanOperation?: BooleanOperation;
|
|
22
|
+
}
|
|
23
|
+
declare function shapeDetailFields(node: SceneNode): ShapeDetailFields;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { ShapeDetailFields, shapeDetailFields };
|
|
26
|
+
//# sourceMappingURL=shape-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-details.d.ts","names":[],"sources":["../../src/figma-api/shape-details.ts"],"mappings":";;;;;;;;;;;;UAYiB;EACf;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX,mBAAmB;;iBAGL,kBAAkB,MAAM,YAAY"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/figma-api/shape-details.ts
|
|
2
|
+
function shapeDetailFields(node) {
|
|
3
|
+
const fields = {};
|
|
4
|
+
const corners = [
|
|
5
|
+
node.topLeftRadius,
|
|
6
|
+
node.topRightRadius,
|
|
7
|
+
node.bottomRightRadius,
|
|
8
|
+
node.bottomLeftRadius
|
|
9
|
+
];
|
|
10
|
+
const differ = node.independentCorners && corners.some((radius) => radius !== corners[0]);
|
|
11
|
+
const uniform = node.independentCorners ? corners[0] : node.cornerRadius;
|
|
12
|
+
if (differ) {
|
|
13
|
+
fields.topLeftRadius = node.topLeftRadius;
|
|
14
|
+
fields.topRightRadius = node.topRightRadius;
|
|
15
|
+
fields.bottomRightRadius = node.bottomRightRadius;
|
|
16
|
+
fields.bottomLeftRadius = node.bottomLeftRadius;
|
|
17
|
+
} else if (uniform > 0) fields.cornerRadius = uniform;
|
|
18
|
+
if (node.isMask) {
|
|
19
|
+
fields.isMask = true;
|
|
20
|
+
fields.maskType = node.maskType;
|
|
21
|
+
}
|
|
22
|
+
if (node.booleanOperation) fields.booleanOperation = node.booleanOperation;
|
|
23
|
+
return fields;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { shapeDetailFields };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=shape-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-details.js","names":[],"sources":["../../src/figma-api/shape-details.ts"],"sourcesContent":["import type { BooleanOperation, MaskType, SceneNode } from '@pairdraw/scene-graph'\n\n/**\n * The shape details a node summary reports, under Figma's plugin-API names: the per-corner radii\n * once the corners are drawn one by one and disagree, the mask flag and type while the layer masks,\n * and a boolean layer's operation. A plain layer carries none of them.\n *\n * The per-corner fields are live only while `independentCorners` is set; otherwise the shape renders\n * the uniform `cornerRadius` and any stored per-corner values are stale (a .fig import or a uniform\n * radius-handle write leaves them), so they stay out. While the corners disagree the proxy reads\n * `cornerRadius` as `mixed`, which JSON cannot hold, so the uniform field stays out too.\n */\nexport interface ShapeDetailFields {\n cornerRadius?: number\n topLeftRadius?: number\n topRightRadius?: number\n bottomRightRadius?: number\n bottomLeftRadius?: number\n isMask?: boolean\n maskType?: MaskType\n booleanOperation?: BooleanOperation\n}\n\nexport function shapeDetailFields(node: SceneNode): ShapeDetailFields {\n const fields: ShapeDetailFields = {}\n const corners = [\n node.topLeftRadius,\n node.topRightRadius,\n node.bottomRightRadius,\n node.bottomLeftRadius\n ]\n const differ = node.independentCorners && corners.some((radius) => radius !== corners[0])\n // Figma reads independent corners that agree as one radius, so the reported radius must come from\n // that agreement rather than the stale uniform field the corner edits leave behind.\n const uniform = node.independentCorners ? corners[0] : node.cornerRadius\n if (differ) {\n fields.topLeftRadius = node.topLeftRadius\n fields.topRightRadius = node.topRightRadius\n fields.bottomRightRadius = node.bottomRightRadius\n fields.bottomLeftRadius = node.bottomLeftRadius\n } else if (uniform > 0) {\n fields.cornerRadius = uniform\n }\n if (node.isMask) {\n fields.isMask = true\n fields.maskType = node.maskType\n }\n if (node.booleanOperation) fields.booleanOperation = node.booleanOperation\n return fields\n}\n"],"mappings":";AAuBA,SAAgB,kBAAkB,MAAoC;CACpE,MAAM,SAA4B,CAAC;CACnC,MAAM,UAAU;EACd,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;CACP;CACA,MAAM,SAAS,KAAK,sBAAsB,QAAQ,MAAM,WAAW,WAAW,QAAQ,EAAE;CAGxF,MAAM,UAAU,KAAK,qBAAqB,QAAQ,KAAK,KAAK;CAC5D,IAAI,QAAQ;EACV,OAAO,gBAAgB,KAAK;EAC5B,OAAO,iBAAiB,KAAK;EAC7B,OAAO,oBAAoB,KAAK;EAChC,OAAO,mBAAmB,KAAK;CACjC,OAAO,IAAI,UAAU,GACnB,OAAO,eAAe;CAExB,IAAI,KAAK,QAAQ;EACf,OAAO,SAAS;EAChB,OAAO,WAAW,KAAK;CACzB;CACA,IAAI,KAAK,kBAAkB,OAAO,mBAAmB,KAAK;CAC1D,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { newLayerDefaults } from "../editor/shapes/defaults.js";
|
|
2
2
|
import { graph, prepareFollowedFieldEdit, raw, updateNode } from "./accessor-utils.js";
|
|
3
3
|
import { SHAPE_WITH_TEXT_TYPES, isShapeWithTextType } from "@pairdraw/scene-graph/shape-with-text";
|
|
4
|
-
import { createShapeWithText,
|
|
4
|
+
import { createShapeWithText, shapeWithTextKindFields } from "@pairdraw/scene-graph/generated";
|
|
5
5
|
//#region src/figma-api/shape-with-text.ts
|
|
6
6
|
/** `value` as a kind for `node`, refused in the words Figma's plugin API refuses it with. */
|
|
7
7
|
function checkedShapeType(node, value) {
|
|
@@ -33,10 +33,7 @@ function installShapeWithTextAccessors(prototype, internals) {
|
|
|
33
33
|
const node = raw(this, internals);
|
|
34
34
|
const kind = checkedShapeType(node, value);
|
|
35
35
|
prepareFollowedFieldEdit(graph(this, internals), node, "shapeType", "shape-type");
|
|
36
|
-
updateNode(this, internals,
|
|
37
|
-
shapeWithTextType: kind,
|
|
38
|
-
...shapeWithTextFrameFields(kind, node.width, node.height)
|
|
39
|
-
});
|
|
36
|
+
updateNode(this, internals, shapeWithTextKindFields(node, kind));
|
|
40
37
|
}
|
|
41
38
|
} });
|
|
42
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/figma-api/shape-with-text.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { createShapeWithText,
|
|
1
|
+
{"version":3,"file":"shape-with-text.js","names":[],"sources":["../../src/figma-api/shape-with-text.ts"],"sourcesContent":["import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { createShapeWithText, shapeWithTextKindFields } from '@pairdraw/scene-graph/generated'\nimport {\n isShapeWithTextType,\n SHAPE_WITH_TEXT_TYPES,\n type ShapeWithTextType\n} from '@pairdraw/scene-graph/shape-with-text'\n\nimport type { InterfaceTheme } from '#core/constants'\nimport { newLayerDefaults } from '#core/editor/shapes/defaults'\n\nimport type { NodeProxyInternals, ProxyThis } from './accessor-utils'\nimport { graph, prepareFollowedFieldEdit, raw, updateNode } from './accessor-utils'\n\n/** `value` as a kind for `node`, refused in the words Figma's plugin API refuses it with. */\nfunction checkedShapeType(node: SceneNode, value: unknown): ShapeWithTextType {\n if (node.type !== 'SHAPE_WITH_TEXT') {\n throw new Error('in set_shapeType: Only a shape with text has a shape type')\n }\n if (!isShapeWithTextType(value)) {\n const expected = SHAPE_WITH_TEXT_TYPES.map((kind) => `'${kind}'`).join(' | ')\n throw new Error(\n `in set_shapeType: Property \"shapeType\" failed validation: Invalid enum value. Expected ${expected}, received '${String(value)}'`\n )\n }\n return value\n}\n\n/**\n * A new, empty shape with text on the API's current page, as FigJam's plugin API creates it: an\n * ellipse 176 px square, painted as the shape tool paints a new shape. Measured in FigJam.\n */\nexport function newShapeWithText(api: {\n graph: SceneGraph\n currentPageId: string\n theme: InterfaceTheme\n}): SceneNode {\n return createShapeWithText(api.graph, api.currentPageId, {\n ...newLayerDefaults('SHAPE_WITH_TEXT', api.theme),\n shapeWithTextType: 'ELLIPSE'\n })\n}\n\n/** `shapeType`, a shape with text's FigJam kind; other layers have none. */\nexport function installShapeWithTextAccessors(\n prototype: object,\n internals: NodeProxyInternals\n): void {\n Object.defineProperties(prototype, {\n shapeType: {\n get(this: ProxyThis): ShapeWithTextType | undefined {\n const node = raw(this, internals)\n return node.type === 'SHAPE_WITH_TEXT' ? node.shapeWithTextType : undefined\n },\n set(this: ProxyThis, value: unknown) {\n const node = raw(this, internals)\n const kind = checkedShapeType(node, value)\n prepareFollowedFieldEdit(graph(this, internals), node, 'shapeType', 'shape-type')\n // The new kind lays the label out in its own area, as FigJam's shape switcher does.\n updateNode(this, internals, shapeWithTextKindFields(node, kind))\n }\n }\n })\n}\n"],"mappings":";;;;;;AAeA,SAAS,iBAAiB,MAAiB,OAAmC;CAC5E,IAAI,KAAK,SAAS,mBAChB,MAAM,IAAI,MAAM,2DAA2D;CAE7E,IAAI,CAAC,oBAAoB,KAAK,GAAG;EAC/B,MAAM,WAAW,sBAAsB,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,KAAK;EAC5E,MAAM,IAAI,MACR,0FAA0F,SAAS,cAAc,OAAO,KAAK,EAAE,EACjI;CACF;CACA,OAAO;AACT;;;;;AAMA,SAAgB,iBAAiB,KAInB;CACZ,OAAO,oBAAoB,IAAI,OAAO,IAAI,eAAe;EACvD,GAAG,iBAAiB,mBAAmB,IAAI,KAAK;EAChD,mBAAmB;CACrB,CAAC;AACH;;AAGA,SAAgB,8BACd,WACA,WACM;CACN,OAAO,iBAAiB,WAAW,EACjC,WAAW;EACT,MAAoD;GAClD,MAAM,OAAO,IAAI,MAAM,SAAS;GAChC,OAAO,KAAK,SAAS,oBAAoB,KAAK,oBAAoB,KAAA;EACpE;EACA,IAAqB,OAAgB;GACnC,MAAM,OAAO,IAAI,MAAM,SAAS;GAChC,MAAM,OAAO,iBAAiB,MAAM,KAAK;GACzC,yBAAyB,MAAM,MAAM,SAAS,GAAG,MAAM,aAAa,YAAY;GAEhF,WAAW,MAAM,WAAW,wBAAwB,MAAM,IAAI,CAAC;EACjE;CACF,EACF,CAAC;AACH"}
|
|
@@ -5,14 +5,17 @@
|
|
|
5
5
|
* A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.
|
|
6
6
|
*/
|
|
7
7
|
/** Members a host or tool wires up on `figma`, which scripts do not write against. */
|
|
8
|
-
declare const FIGMA_API_HOST_MEMBERS: readonly ["graph", "wrapNode", "currentPageId", "groupFitOptions", "setRenderer", "theme", "exportImage", "icons", "rasterCodec", "changeBaseline"];
|
|
8
|
+
declare const FIGMA_API_HOST_MEMBERS: readonly ["graph", "wrapNode", "currentPageId", "groupFitOptions", "setRenderer", "theme", "exportImage", "exportGraphImage", "icons", "rasterCodec", "changeBaseline"];
|
|
9
9
|
/**
|
|
10
10
|
* Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do
|
|
11
11
|
* not implement every Figma node type; remove one when it matches.
|
|
12
12
|
*/
|
|
13
|
-
declare const FIGMA_API_INCOMPLETE_MEMBERS: readonly ["createComponentFromNode", "createPage", "currentPage", "getNodeById", "getNodeByIdAsync", "mixed", "root", "variables", "viewport"];
|
|
14
|
-
/**
|
|
15
|
-
|
|
13
|
+
declare const FIGMA_API_INCOMPLETE_MEMBERS: readonly ["createComponentFromNode", "createPage", "currentPage", "getNodeById", "getNodeByIdAsync", "mixed", "root", "ui", "variables", "viewport"];
|
|
14
|
+
/**
|
|
15
|
+
* Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node
|
|
16
|
+
* fields stored in `.fig` that the installed typings do not name.
|
|
17
|
+
*/
|
|
18
|
+
declare const SERIALIZATION_MEMBERS: readonly ["toJSON", "scrollBehavior"];
|
|
16
19
|
//#endregion
|
|
17
20
|
export { FIGMA_API_HOST_MEMBERS, FIGMA_API_INCOMPLETE_MEMBERS, SERIALIZATION_MEMBERS };
|
|
18
21
|
//# sourceMappingURL=surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","names":[],"sources":["../../src/figma-api/surface.ts"],"mappings":";;;;;;;cAOa;;;;;cAiBA
|
|
1
|
+
{"version":3,"file":"surface.d.ts","names":[],"sources":["../../src/figma-api/surface.ts"],"mappings":";;;;;;;cAOa;;;;;cAkBA;;;;;cAiBA"}
|
|
@@ -13,6 +13,7 @@ const FIGMA_API_HOST_MEMBERS = [
|
|
|
13
13
|
"setRenderer",
|
|
14
14
|
"theme",
|
|
15
15
|
"exportImage",
|
|
16
|
+
"exportGraphImage",
|
|
16
17
|
"icons",
|
|
17
18
|
"rasterCodec",
|
|
18
19
|
"changeBaseline"
|
|
@@ -29,11 +30,15 @@ const FIGMA_API_INCOMPLETE_MEMBERS = [
|
|
|
29
30
|
"getNodeByIdAsync",
|
|
30
31
|
"mixed",
|
|
31
32
|
"root",
|
|
33
|
+
"ui",
|
|
32
34
|
"variables",
|
|
33
35
|
"viewport"
|
|
34
36
|
];
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node
|
|
39
|
+
* fields stored in `.fig` that the installed typings do not name.
|
|
40
|
+
*/
|
|
41
|
+
const SERIALIZATION_MEMBERS = ["toJSON", "scrollBehavior"];
|
|
37
42
|
//#endregion
|
|
38
43
|
export { FIGMA_API_HOST_MEMBERS, FIGMA_API_INCOMPLETE_MEMBERS, SERIALIZATION_MEMBERS };
|
|
39
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","names":[],"sources":["../../src/figma-api/surface.ts"],"sourcesContent":["/**\n * What `figma` and its objects have beyond Figma's Plugin API. `compatibility.ts` checks the\n * types against these lists and `tests/figma-api/surface.test.ts` checks what scripts can reach.\n * A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.\n */\n\n/** Members a host or tool wires up on `figma`, which scripts do not write against. */\nexport const FIGMA_API_HOST_MEMBERS = [\n 'graph',\n 'wrapNode',\n 'currentPageId',\n 'groupFitOptions',\n 'setRenderer',\n 'theme',\n 'exportImage',\n 'icons',\n 'rasterCodec',\n 'changeBaseline'\n] as const\n\n/**\n * Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do\n * not implement every Figma node type; remove one when it matches.\n */\nexport const FIGMA_API_INCOMPLETE_MEMBERS = [\n 'createComponentFromNode',\n 'createPage',\n 'currentPage',\n 'getNodeById',\n 'getNodeByIdAsync',\n 'mixed',\n 'root',\n 'variables',\n 'viewport'\n] as const\n\n
|
|
1
|
+
{"version":3,"file":"surface.js","names":[],"sources":["../../src/figma-api/surface.ts"],"sourcesContent":["/**\n * What `figma` and its objects have beyond Figma's Plugin API. `compatibility.ts` checks the\n * types against these lists and `tests/figma-api/surface.test.ts` checks what scripts can reach.\n * A feature Figma has no API for goes on `pairdraw`, never on these lists; entries only leave.\n */\n\n/** Members a host or tool wires up on `figma`, which scripts do not write against. */\nexport const FIGMA_API_HOST_MEMBERS = [\n 'graph',\n 'wrapNode',\n 'currentPageId',\n 'groupFitOptions',\n 'setRenderer',\n 'theme',\n 'exportImage',\n 'exportGraphImage',\n 'icons',\n 'rasterCodec',\n 'changeBaseline'\n] as const\n\n/**\n * Members named as in Figma whose types do not match Figma's yet, mostly because node proxies do\n * not implement every Figma node type; remove one when it matches.\n */\nexport const FIGMA_API_INCOMPLETE_MEMBERS = [\n 'createComponentFromNode',\n 'createPage',\n 'currentPage',\n 'getNodeById',\n 'getNodeByIdAsync',\n 'mixed',\n 'root',\n 'ui',\n 'variables',\n 'viewport'\n] as const\n\n/**\n * Members hosts read or write beyond Figma's Plugin API: the `JSON.stringify` hook, and node\n * fields stored in `.fig` that the installed typings do not name.\n */\nexport const SERIALIZATION_MEMBERS = ['toJSON', 'scrollBehavior'] as const\n"],"mappings":";;;;;;;AAOA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAa,wBAAwB,CAAC,UAAU,gBAAgB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
2
1
|
import { Mat3 } from "@pairdraw/scene-graph/matrix";
|
|
2
|
+
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
3
3
|
//#region src/figma-api/transform.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A node's transform into its container's space, which Figma's plugin API reports as
|
package/dist/geometry/figma.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
2
1
|
import { Mat3 } from "@pairdraw/scene-graph/matrix";
|
|
2
|
+
import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
3
3
|
import { Vector } from "@pairdraw/scene-graph/primitives";
|
|
4
4
|
//#region src/geometry/figma.d.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HandlePosition } from "./transform-zones.js";
|
|
2
|
-
import { GradientTransform } from "@pairdraw/scene-graph";
|
|
3
2
|
import { Mat3 } from "@pairdraw/scene-graph/matrix";
|
|
3
|
+
import { GradientTransform } from "@pairdraw/scene-graph";
|
|
4
4
|
import { Rect, Vector } from "@pairdraw/scene-graph/primitives";
|
|
5
5
|
//#region src/geometry/image-crop.d.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computeBounds } from "@pairdraw/scene-graph/geometry";
|
|
2
|
-
import { clamp } from "es-toolkit";
|
|
3
2
|
import Matrix from "@pairdraw/scene-graph/matrix";
|
|
3
|
+
import { clamp } from "es-toolkit";
|
|
4
4
|
//#region src/geometry/image-crop.ts
|
|
5
5
|
/** Screen-pixel sizes of the crop handles. */
|
|
6
6
|
const IMAGE_CROP_HANDLE = {
|
package/dist/icons/svg.js
CHANGED
|
@@ -283,7 +283,7 @@ function scalePathInfos(pathInfos, scaleX, scaleY, offsetX = 0, offsetY = 0) {
|
|
|
283
283
|
if (path.transform && path.transform !== "none") transformedPath = transformedPath.transform(path.transform);
|
|
284
284
|
if (scaleX !== 1 || scaleY !== 1) transformedPath = transformedPath.scale(scaleX, scaleY);
|
|
285
285
|
if (offsetX !== 0 || offsetY !== 0) transformedPath = transformedPath.translate(offsetX, offsetY);
|
|
286
|
-
const scaledD = transformedPath.round(2).toString();
|
|
286
|
+
const scaledD = transformedPath.abs().unshort().unarc().round(2).toString();
|
|
287
287
|
const fill = normalizeSVGPaint(path.fill);
|
|
288
288
|
const stroke = normalizeSVGPaint(path.stroke);
|
|
289
289
|
return {
|