@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
|
@@ -5,9 +5,24 @@ import { getTextStyle } from "../text/style.js";
|
|
|
5
5
|
import { graph, raw, strokeOwner, updateNode } from "../accessor-utils.js";
|
|
6
6
|
import { finiteNumber } from "../finite.js";
|
|
7
7
|
import { paintBindings, setPaintBindings } from "../variables/bindings.js";
|
|
8
|
+
import { OVERFLOW_DIRECTIONS, SCROLL_BEHAVIORS } from "@pairdraw/scene-graph/constants";
|
|
8
9
|
import { independentCornerChanges } from "@pairdraw/scene-graph/variables";
|
|
9
10
|
import { newStrokeGeometry } from "@pairdraw/scene-graph/node-defaults";
|
|
10
11
|
//#region src/figma-api/accessors/visual.ts
|
|
12
|
+
/** `value` as a frame's overflow scrolling, refused in the words Figma's plugin API uses. */
|
|
13
|
+
function checkedOverflowDirection(value) {
|
|
14
|
+
const direction = OVERFLOW_DIRECTIONS.find((candidate) => candidate === value);
|
|
15
|
+
if (direction) return direction;
|
|
16
|
+
const expected = OVERFLOW_DIRECTIONS.map((candidate) => `'${candidate}'`).join(" | ");
|
|
17
|
+
throw new Error(`in set_overflowDirection: Property "overflowDirection" failed validation: Invalid enum value. Expected ${expected}, received '${String(value)}'`);
|
|
18
|
+
}
|
|
19
|
+
/** `value` as a layer's scroll behavior, refused in the words Figma's plugin API uses. */
|
|
20
|
+
function checkedScrollBehavior(value) {
|
|
21
|
+
const behavior = SCROLL_BEHAVIORS.find((candidate) => candidate === value);
|
|
22
|
+
if (behavior) return behavior;
|
|
23
|
+
const expected = SCROLL_BEHAVIORS.map((candidate) => `'${candidate}'`).join(" | ");
|
|
24
|
+
throw new Error(`in set_scrollBehavior: Property "scrollBehavior" failed validation: Invalid enum value. Expected ${expected}, received '${String(value)}'`);
|
|
25
|
+
}
|
|
11
26
|
function styleReference(internals, field, mixed) {
|
|
12
27
|
return {
|
|
13
28
|
get() {
|
|
@@ -130,6 +145,24 @@ function installVisualNodeProxyAccessors(prototype, internals, mixed) {
|
|
|
130
145
|
updateNode(this, internals, { clipsContent: value });
|
|
131
146
|
}
|
|
132
147
|
},
|
|
148
|
+
overflowDirection: {
|
|
149
|
+
get() {
|
|
150
|
+
return raw(this, internals).overflowDirection;
|
|
151
|
+
},
|
|
152
|
+
set(value) {
|
|
153
|
+
const node = raw(this, internals);
|
|
154
|
+
if (node.type !== "FRAME" && node.type !== "COMPONENT" && node.type !== "INSTANCE") throw new Error(`in set_overflowDirection: Only a frame, component or instance scrolls; ${node.type} "${node.name}" cannot`);
|
|
155
|
+
updateNode(this, internals, { overflowDirection: checkedOverflowDirection(value) });
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
scrollBehavior: {
|
|
159
|
+
get() {
|
|
160
|
+
return raw(this, internals).scrollBehavior;
|
|
161
|
+
},
|
|
162
|
+
set(value) {
|
|
163
|
+
updateNode(this, internals, { scrollBehavior: checkedScrollBehavior(value) });
|
|
164
|
+
}
|
|
165
|
+
},
|
|
133
166
|
cornerRadius: {
|
|
134
167
|
get() {
|
|
135
168
|
const node = raw(this, internals);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual.js","names":[],"sources":["../../../src/figma-api/accessors/visual.ts"],"sourcesContent":["import type { SceneNode, ShadowEffect, Stroke } from '@pairdraw/scene-graph'\nimport { newStrokeGeometry } from '@pairdraw/scene-graph/node-defaults'\nimport { independentCornerChanges } from '@pairdraw/scene-graph/variables'\n\nimport {\n graph,\n raw,\n strokeOwner,\n updateNode,\n type NodeProxyInternals,\n type ProxyThis\n} from '#core/figma-api/accessor-utils'\nimport { parseFigmaEffects, toFigmaEffect, type FigmaEffect } from '#core/figma-api/effects'\nimport { finiteNumber } from '#core/figma-api/finite'\nimport { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from '#core/figma-api/paints'\nimport { getTextStyle } from '#core/figma-api/text/style'\nimport { paintBindings, setPaintBindings } from '#core/figma-api/variables/bindings'\nimport { textStyleChanges } from '#core/text/character-style'\n\nfunction styleReference(\n internals: NodeProxyInternals,\n field: 'fillStyleId' | 'strokeStyleId' | 'effectStyleId' | 'gridStyleId',\n mixed: symbol\n): PropertyDescriptor {\n return {\n get(this: ProxyThis): string | symbol {\n const node = raw(this, internals)\n // Characters of a text can each use a fill style of their own.\n if (field === 'fillStyleId' && node.type === 'TEXT') {\n return getTextStyle(node, 'fillStyleId', mixed) as string | symbol\n }\n return node[field] ?? ''\n },\n set(this: ProxyThis, value: string) {\n const node = raw(this, internals)\n const changes = { [field]: value || null }\n updateNode(\n this,\n internals,\n field === 'fillStyleId' && node.type === 'TEXT' ? textStyleChanges(node, changes) : changes\n )\n }\n }\n}\n\n/**\n * `node`'s fills as Figma's plugin API reads them, each carrying the variable it is bound to. A\n * bound paint reads as it stores its color and opacity, which its variable writes into it when it\n * binds and whenever the color it gives the layer changes, as in Figma.\n */\nexport function figmaFills(node: SceneNode): FigmaPaint[] {\n const bound = paintBindings(node, 'fills')\n return node.fills.map((fill, index) => toFigmaPaint(fill, bound.get(index)))\n}\n\n/** `node`'s strokes as Figma's plugin API reads them, as {@link figmaFills} reads fills. */\nexport function figmaStrokes(node: SceneNode): FigmaPaint[] {\n const bound = paintBindings(node, 'strokes')\n return node.strokes.map((stroke, index) => toFigmaPaint(stroke, bound.get(index)))\n}\n\nexport function installVisualNodeProxyAccessors(\n prototype: object,\n internals: NodeProxyInternals,\n mixed: symbol\n): void {\n Object.defineProperties(prototype, {\n fills: {\n // Text reads mixed while its characters are filled differently, and setting it fills them all.\n get(this: ProxyThis): readonly FigmaPaint[] | symbol {\n const node = raw(this, internals)\n if (node.type !== 'TEXT') return Object.freeze(figmaFills(node))\n const fills = getTextStyle(node, 'fills', mixed)\n // Text styles read for scripts already give Figma's paints.\n return typeof fills === 'symbol' ? fills : Object.freeze(fills as FigmaPaint[])\n },\n set(this: ProxyThis, value: readonly FigmaPaint[]) {\n const node = raw(this, internals)\n const fills = parseFigmaPaints(value)\n updateNode(\n this,\n internals,\n node.type === 'TEXT' ? textStyleChanges(node, { fills }) : { fills }\n )\n setPaintBindings(graph(this, internals), raw(this, internals), 'fills', value)\n }\n },\n strokes: {\n get(this: ProxyThis): readonly FigmaPaint[] {\n const owner = raw(strokeOwner(this, internals), internals)\n return Object.freeze(figmaStrokes(owner))\n },\n // Figma paints carry no geometry; a stroke takes the node's weight and alignment, which\n // outlast its strokes.\n set(this: ProxyThis, value: readonly FigmaPaint[]) {\n const owner = strokeOwner(this, internals)\n const geometry = newStrokeGeometry(raw(owner, internals))\n const strokes = parseFigmaPaints(value, 'set_strokes', 'strokes').map((paint): Stroke => ({\n ...paint,\n weight: geometry.weight,\n align: geometry.align\n }))\n const kept = newStrokeGeometry({\n strokes,\n strokeWeight: geometry.weight,\n strokeAlign: geometry.align\n })\n updateNode(owner, internals, {\n strokes,\n strokeWeight: kept.weight,\n strokeAlign: kept.align\n })\n setPaintBindings(graph(this, internals), raw(owner, internals), 'strokes', value)\n }\n },\n effects: {\n get(this: ProxyThis): readonly FigmaEffect[] {\n // A shader effect has no Figma plugin-API form yet (`UNSUPPORTED_EFFECT_TYPES`).\n return Object.freeze(\n raw(this, internals)\n .effects.filter((effect): effect is ShadowEffect => effect.type !== 'SHADER')\n .map(toFigmaEffect)\n )\n },\n set(this: ProxyThis, value: readonly FigmaEffect[]) {\n updateNode(this, internals, { effects: parseFigmaEffects(value) })\n }\n },\n // Applied shared styles, as Figma exposes them; an assignment inside an instance is an override.\n fillStyleId: styleReference(internals, 'fillStyleId', mixed),\n strokeStyleId: styleReference(internals, 'strokeStyleId', mixed),\n effectStyleId: styleReference(internals, 'effectStyleId', mixed),\n gridStyleId: styleReference(internals, 'gridStyleId', mixed),\n opacity: {\n get(this: ProxyThis): number {\n return raw(this, internals).opacity\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, { opacity: finiteNumber(value, 'opacity') })\n }\n },\n visible: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).visible\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { visible: value })\n }\n },\n locked: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).locked\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { locked: value })\n }\n },\n blendMode: {\n get(this: ProxyThis): string {\n return raw(this, internals).blendMode\n },\n set(this: ProxyThis, value: string) {\n updateNode(this, internals, { blendMode: value as SceneNode['blendMode'] })\n }\n },\n clipsContent: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).clipsContent\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { clipsContent: value })\n }\n },\n cornerRadius: {\n get(this: ProxyThis): number | symbol {\n const node = raw(this, internals)\n if (!node.independentCorners) return node.cornerRadius\n // Corners set or bound one by one read as one radius while they agree, as in Figma.\n const { topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius } = node\n const agree = [topRightRadius, bottomLeftRadius, bottomRightRadius].every(\n (radius) => radius === topLeftRadius\n )\n return agree ? topLeftRadius : mixed\n },\n set(this: ProxyThis, value: unknown) {\n if (value === mixed) return\n const radius = finiteNumber(value, 'cornerRadius')\n updateNode(this, internals, {\n cornerRadius: radius,\n topLeftRadius: radius,\n topRightRadius: radius,\n bottomRightRadius: radius,\n bottomLeftRadius: radius,\n independentCorners: false\n })\n }\n },\n topLeftRadius: cornerAccessor(internals, 'topLeftRadius'),\n topRightRadius: cornerAccessor(internals, 'topRightRadius'),\n bottomLeftRadius: cornerAccessor(internals, 'bottomLeftRadius'),\n bottomRightRadius: cornerAccessor(internals, 'bottomRightRadius'),\n cornerSmoothing: {\n get(this: ProxyThis): number {\n return raw(this, internals).cornerSmoothing\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, { cornerSmoothing: finiteNumber(value, 'cornerSmoothing') })\n }\n }\n })\n}\n\nfunction cornerAccessor(\n internals: NodeProxyInternals,\n field: 'topLeftRadius' | 'topRightRadius' | 'bottomLeftRadius' | 'bottomRightRadius'\n): PropertyDescriptor {\n return {\n get(this: ProxyThis): number {\n return raw(this, internals)[field]\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, {\n ...independentCornerChanges(raw(this, internals)),\n [field]: finiteNumber(value, field)\n })\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAmBA,SAAS,eACP,WACA,OACA,OACoB;CACpB,OAAO;EACL,MAAsC;GACpC,MAAM,OAAO,IAAI,MAAM,SAAS;GAEhC,IAAI,UAAU,iBAAiB,KAAK,SAAS,QAC3C,OAAO,aAAa,MAAM,eAAe,KAAK;GAEhD,OAAO,KAAK,UAAU;EACxB;EACA,IAAqB,OAAe;GAClC,MAAM,OAAO,IAAI,MAAM,SAAS;GAChC,MAAM,UAAU,GAAG,QAAQ,SAAS,KAAK;GACzC,WACE,MACA,WACA,UAAU,iBAAiB,KAAK,SAAS,SAAS,iBAAiB,MAAM,OAAO,IAAI,OACtF;EACF;CACF;AACF;;;;;;AAOA,SAAgB,WAAW,MAA+B;CACxD,MAAM,QAAQ,cAAc,MAAM,OAAO;CACzC,OAAO,KAAK,MAAM,KAAK,MAAM,UAAU,aAAa,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC;AAC7E;;AAGA,SAAgB,aAAa,MAA+B;CAC1D,MAAM,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AC;GACrD;EACF;EACA,cAAc;GACZ,MAAsC;IACpC,MAAM,OAAO,IAAI,MAAM,SAAS;IAChC,IAAI,CAAC,KAAK,oBAAoB,OAAO,KAAK;IAE1C,MAAM,EAAE,eAAe,gBAAgB,kBAAkB,sBAAsB;IAI/E,OAHc;KAAC;KAAgB;KAAkB;IAAiB,CAAC,CAAC,OACjE,WAAW,WAAW,aAEd,IAAI,gBAAgB;GACjC;GACA,IAAqB,OAAgB;IACnC,IAAI,UAAU,OAAO;IACrB,MAAM,SAAS,aAAa,OAAO,cAAc;IACjD,WAAW,MAAM,WAAW;KAC1B,cAAc;KACd,eAAe;KACf,gBAAgB;KAChB,mBAAmB;KACnB,kBAAkB;KAClB,oBAAoB;IACtB,CAAC;GACH;EACF;EACA,eAAe,eAAe,WAAW,eAAe;EACxD,gBAAgB,eAAe,WAAW,gBAAgB;EAC1D,kBAAkB,eAAe,WAAW,kBAAkB;EAC9D,mBAAmB,eAAe,WAAW,mBAAmB;EAChE,iBAAiB;GACf,MAA6B;IAC3B,OAAO,IAAI,MAAM,SAAS,CAAC,CAAC;GAC9B;GACA,IAAqB,OAAgB;IACnC,WAAW,MAAM,WAAW,EAAE,iBAAiB,aAAa,OAAO,iBAAiB,EAAE,CAAC;GACzF;EACF;CACF,CAAC;AACH;AAEA,SAAS,eACP,WACA,OACoB;CACpB,OAAO;EACL,MAA6B;GAC3B,OAAO,IAAI,MAAM,SAAS,CAAC,CAAC;EAC9B;EACA,IAAqB,OAAgB;GACnC,WAAW,MAAM,WAAW;IAC1B,GAAG,yBAAyB,IAAI,MAAM,SAAS,CAAC;KAC/C,QAAQ,aAAa,OAAO,KAAK;GACpC,CAAC;EACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"visual.js","names":[],"sources":["../../../src/figma-api/accessors/visual.ts"],"sourcesContent":["import type {\n Effect,\n OverflowDirection,\n SceneNode,\n ScrollBehavior,\n ShaderEffect,\n Stroke\n} from '@pairdraw/scene-graph'\nimport { OVERFLOW_DIRECTIONS, SCROLL_BEHAVIORS } from '@pairdraw/scene-graph/constants'\nimport { newStrokeGeometry } from '@pairdraw/scene-graph/node-defaults'\nimport { independentCornerChanges } from '@pairdraw/scene-graph/variables'\n\nimport {\n graph,\n raw,\n strokeOwner,\n updateNode,\n type NodeProxyInternals,\n type ProxyThis\n} from '#core/figma-api/accessor-utils'\nimport { parseFigmaEffects, toFigmaEffect, type FigmaEffect } from '#core/figma-api/effects'\nimport { finiteNumber } from '#core/figma-api/finite'\nimport { parseFigmaPaints, toFigmaPaint, type FigmaPaint } from '#core/figma-api/paints'\nimport { getTextStyle } from '#core/figma-api/text/style'\nimport { paintBindings, setPaintBindings } from '#core/figma-api/variables/bindings'\nimport { textStyleChanges } from '#core/text/character-style'\n\n/** `value` as a frame's overflow scrolling, refused in the words Figma's plugin API uses. */\nfunction checkedOverflowDirection(value: unknown): OverflowDirection {\n const direction = OVERFLOW_DIRECTIONS.find((candidate) => candidate === value)\n if (direction) return direction\n const expected = OVERFLOW_DIRECTIONS.map((candidate) => `'${candidate}'`).join(' | ')\n throw new Error(\n `in set_overflowDirection: Property \"overflowDirection\" failed validation: Invalid enum value. Expected ${expected}, received '${String(value)}'`\n )\n}\n\n/** `value` as a layer's scroll behavior, refused in the words Figma's plugin API uses. */\nfunction checkedScrollBehavior(value: unknown): ScrollBehavior {\n const behavior = SCROLL_BEHAVIORS.find((candidate) => candidate === value)\n if (behavior) return behavior\n const expected = SCROLL_BEHAVIORS.map((candidate) => `'${candidate}'`).join(' | ')\n throw new Error(\n `in set_scrollBehavior: Property \"scrollBehavior\" failed validation: Invalid enum value. Expected ${expected}, received '${String(value)}'`\n )\n}\n\nfunction styleReference(\n internals: NodeProxyInternals,\n field: 'fillStyleId' | 'strokeStyleId' | 'effectStyleId' | 'gridStyleId',\n mixed: symbol\n): PropertyDescriptor {\n return {\n get(this: ProxyThis): string | symbol {\n const node = raw(this, internals)\n // Characters of a text can each use a fill style of their own.\n if (field === 'fillStyleId' && node.type === 'TEXT') {\n return getTextStyle(node, 'fillStyleId', mixed) as string | symbol\n }\n return node[field] ?? ''\n },\n set(this: ProxyThis, value: string) {\n const node = raw(this, internals)\n const changes = { [field]: value || null }\n updateNode(\n this,\n internals,\n field === 'fillStyleId' && node.type === 'TEXT' ? textStyleChanges(node, changes) : changes\n )\n }\n }\n}\n\n/**\n * `node`'s fills as Figma's plugin API reads them, each carrying the variable it is bound to. A\n * bound paint reads as it stores its color and opacity, which its variable writes into it when it\n * binds and whenever the color it gives the layer changes, as in Figma.\n */\nexport function figmaFills(node: SceneNode): FigmaPaint[] {\n const bound = paintBindings(node, 'fills')\n return node.fills.map((fill, index) => toFigmaPaint(fill, bound.get(index)))\n}\n\n/** `node`'s strokes as Figma's plugin API reads them, as {@link figmaFills} reads fills. */\nexport function figmaStrokes(node: SceneNode): FigmaPaint[] {\n const bound = paintBindings(node, 'strokes')\n return node.strokes.map((stroke, index) => toFigmaPaint(stroke, bound.get(index)))\n}\n\nexport function installVisualNodeProxyAccessors(\n prototype: object,\n internals: NodeProxyInternals,\n mixed: symbol\n): void {\n Object.defineProperties(prototype, {\n fills: {\n // Text reads mixed while its characters are filled differently, and setting it fills them all.\n get(this: ProxyThis): readonly FigmaPaint[] | symbol {\n const node = raw(this, internals)\n if (node.type !== 'TEXT') return Object.freeze(figmaFills(node))\n const fills = getTextStyle(node, 'fills', mixed)\n // Text styles read for scripts already give Figma's paints.\n return typeof fills === 'symbol' ? fills : Object.freeze(fills as FigmaPaint[])\n },\n set(this: ProxyThis, value: readonly FigmaPaint[]) {\n const node = raw(this, internals)\n const fills = parseFigmaPaints(value)\n updateNode(\n this,\n internals,\n node.type === 'TEXT' ? textStyleChanges(node, { fills }) : { fills }\n )\n setPaintBindings(graph(this, internals), raw(this, internals), 'fills', value)\n }\n },\n strokes: {\n get(this: ProxyThis): readonly FigmaPaint[] {\n const owner = raw(strokeOwner(this, internals), internals)\n return Object.freeze(figmaStrokes(owner))\n },\n // Figma paints carry no geometry; a stroke takes the node's weight and alignment, which\n // outlast its strokes.\n set(this: ProxyThis, value: readonly FigmaPaint[]) {\n const owner = strokeOwner(this, internals)\n const geometry = newStrokeGeometry(raw(owner, internals))\n const strokes = parseFigmaPaints(value, 'set_strokes', 'strokes').map((paint): Stroke => ({\n ...paint,\n weight: geometry.weight,\n align: geometry.align\n }))\n const kept = newStrokeGeometry({\n strokes,\n strokeWeight: geometry.weight,\n strokeAlign: geometry.align\n })\n updateNode(owner, internals, {\n strokes,\n strokeWeight: kept.weight,\n strokeAlign: kept.align\n })\n setPaintBindings(graph(this, internals), raw(owner, internals), 'strokes', value)\n }\n },\n effects: {\n get(this: ProxyThis): readonly FigmaEffect[] {\n // A shader effect has no Figma plugin-API form yet (`UNSUPPORTED_EFFECT_TYPES`).\n return Object.freeze(\n raw(this, internals)\n .effects.filter(\n (effect): effect is Exclude<Effect, ShaderEffect> => effect.type !== 'SHADER'\n )\n .map(toFigmaEffect)\n )\n },\n set(this: ProxyThis, value: readonly FigmaEffect[]) {\n updateNode(this, internals, { effects: parseFigmaEffects(value) })\n }\n },\n // Applied shared styles, as Figma exposes them; an assignment inside an instance is an override.\n fillStyleId: styleReference(internals, 'fillStyleId', mixed),\n strokeStyleId: styleReference(internals, 'strokeStyleId', mixed),\n effectStyleId: styleReference(internals, 'effectStyleId', mixed),\n gridStyleId: styleReference(internals, 'gridStyleId', mixed),\n opacity: {\n get(this: ProxyThis): number {\n return raw(this, internals).opacity\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, { opacity: finiteNumber(value, 'opacity') })\n }\n },\n visible: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).visible\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { visible: value })\n }\n },\n locked: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).locked\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { locked: value })\n }\n },\n blendMode: {\n get(this: ProxyThis): string {\n return raw(this, internals).blendMode\n },\n set(this: ProxyThis, value: string) {\n updateNode(this, internals, { blendMode: value as SceneNode['blendMode'] })\n }\n },\n clipsContent: {\n get(this: ProxyThis): boolean {\n return raw(this, internals).clipsContent\n },\n set(this: ProxyThis, value: boolean) {\n updateNode(this, internals, { clipsContent: value })\n }\n },\n overflowDirection: {\n get(this: ProxyThis): OverflowDirection {\n return raw(this, internals).overflowDirection\n },\n set(this: ProxyThis, value: unknown) {\n const node = raw(this, internals)\n // Only a frame-like layer scrolls in play, and only its record carries the field.\n if (node.type !== 'FRAME' && node.type !== 'COMPONENT' && node.type !== 'INSTANCE') {\n throw new Error(\n `in set_overflowDirection: Only a frame, component or instance scrolls; ${node.type} \"${node.name}\" cannot`\n )\n }\n updateNode(this, internals, { overflowDirection: checkedOverflowDirection(value) })\n }\n },\n scrollBehavior: {\n get(this: ProxyThis): ScrollBehavior {\n return raw(this, internals).scrollBehavior\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, { scrollBehavior: checkedScrollBehavior(value) })\n }\n },\n cornerRadius: {\n get(this: ProxyThis): number | symbol {\n const node = raw(this, internals)\n if (!node.independentCorners) return node.cornerRadius\n // Corners set or bound one by one read as one radius while they agree, as in Figma.\n const { topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius } = node\n const agree = [topRightRadius, bottomLeftRadius, bottomRightRadius].every(\n (radius) => radius === topLeftRadius\n )\n return agree ? topLeftRadius : mixed\n },\n set(this: ProxyThis, value: unknown) {\n if (value === mixed) return\n const radius = finiteNumber(value, 'cornerRadius')\n updateNode(this, internals, {\n cornerRadius: radius,\n topLeftRadius: radius,\n topRightRadius: radius,\n bottomRightRadius: radius,\n bottomLeftRadius: radius,\n independentCorners: false\n })\n }\n },\n topLeftRadius: cornerAccessor(internals, 'topLeftRadius'),\n topRightRadius: cornerAccessor(internals, 'topRightRadius'),\n bottomLeftRadius: cornerAccessor(internals, 'bottomLeftRadius'),\n bottomRightRadius: cornerAccessor(internals, 'bottomRightRadius'),\n cornerSmoothing: {\n get(this: ProxyThis): number {\n return raw(this, internals).cornerSmoothing\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, { cornerSmoothing: finiteNumber(value, 'cornerSmoothing') })\n }\n }\n })\n}\n\nfunction cornerAccessor(\n internals: NodeProxyInternals,\n field: 'topLeftRadius' | 'topRightRadius' | 'bottomLeftRadius' | 'bottomRightRadius'\n): PropertyDescriptor {\n return {\n get(this: ProxyThis): number {\n return raw(this, internals)[field]\n },\n set(this: ProxyThis, value: unknown) {\n updateNode(this, internals, {\n ...independentCornerChanges(raw(this, internals)),\n [field]: finiteNumber(value, field)\n })\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,SAAS,yBAAyB,OAAmC;CACnE,MAAM,YAAY,oBAAoB,MAAM,cAAc,cAAc,KAAK;CAC7E,IAAI,WAAW,OAAO;CACtB,MAAM,WAAW,oBAAoB,KAAK,cAAc,IAAI,UAAU,EAAE,CAAC,CAAC,KAAK,KAAK;CACpF,MAAM,IAAI,MACR,0GAA0G,SAAS,cAAc,OAAO,KAAK,EAAE,EACjJ;AACF;;AAGA,SAAS,sBAAsB,OAAgC;CAC7D,MAAM,WAAW,iBAAiB,MAAM,cAAc,cAAc,KAAK;CACzE,IAAI,UAAU,OAAO;CACrB,MAAM,WAAW,iBAAiB,KAAK,cAAc,IAAI,UAAU,EAAE,CAAC,CAAC,KAAK,KAAK;CACjF,MAAM,IAAI,MACR,oGAAoG,SAAS,cAAc,OAAO,KAAK,EAAE,EAC3I;AACF;AAEA,SAAS,eACP,WACA,OACA,OACoB;CACpB,OAAO;EACL,MAAsC;GACpC,MAAM,OAAO,IAAI,MAAM,SAAS;GAEhC,IAAI,UAAU,iBAAiB,KAAK,SAAS,QAC3C,OAAO,aAAa,MAAM,eAAe,KAAK;GAEhD,OAAO,KAAK,UAAU;EACxB;EACA,IAAqB,OAAe;GAClC,MAAM,OAAO,IAAI,MAAM,SAAS;GAChC,MAAM,UAAU,GAAG,QAAQ,SAAS,KAAK;GACzC,W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KAClB,oBAAoB;IACtB,CAAC;GACH;EACF;EACA,eAAe,eAAe,WAAW,eAAe;EACxD,gBAAgB,eAAe,WAAW,gBAAgB;EAC1D,kBAAkB,eAAe,WAAW,kBAAkB;EAC9D,mBAAmB,eAAe,WAAW,mBAAmB;EAChE,iBAAiB;GACf,MAA6B;IAC3B,OAAO,IAAI,MAAM,SAAS,CAAC,CAAC;GAC9B;GACA,IAAqB,OAAgB;IACnC,WAAW,MAAM,WAAW,EAAE,iBAAiB,aAAa,OAAO,iBAAiB,EAAE,CAAC;GACzF;EACF;CACF,CAAC;AACH;AAEA,SAAS,eACP,WACA,OACoB;CACpB,OAAO;EACL,MAA6B;GAC3B,OAAO,IAAI,MAAM,SAAS,CAAC,CAAC;EAC9B;EACA,IAAqB,OAAgB;GACnC,WAAW,MAAM,WAAW;IAC1B,GAAG,yBAAyB,IAAI,MAAM,SAAS,CAAC;KAC/C,QAAQ,aAAa,OAAO,KAAK;GACpC,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlendMode, Effect,
|
|
1
|
+
import { BlendMode, Effect, ShaderEffect } from "@pairdraw/scene-graph";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/figma-api/effects.d.ts
|
|
4
4
|
declare const BLEND_MODES: BlendMode[];
|
|
@@ -43,11 +43,87 @@ declare const effectSchema: v.VariantSchema<"type", [v.StrictObjectSchema<{
|
|
|
43
43
|
readonly visible: v.BooleanSchema<undefined>;
|
|
44
44
|
readonly blurType: v.OptionalSchema<v.LiteralSchema<"NORMAL", undefined>, "NORMAL">;
|
|
45
45
|
readonly boundVariables: v.OptionalSchema<v.StrictObjectSchema<{}, undefined>, undefined>;
|
|
46
|
+
}, undefined>, v.VariantSchema<"noiseType", [v.StrictObjectSchema<{
|
|
47
|
+
readonly noiseType: v.LiteralSchema<"MONOTONE", undefined>;
|
|
48
|
+
readonly type: v.LiteralSchema<"NOISE", undefined>;
|
|
49
|
+
readonly visible: v.BooleanSchema<undefined>;
|
|
50
|
+
readonly boundVariables: v.OptionalSchema<v.StrictObjectSchema<{}, undefined>, undefined>;
|
|
51
|
+
readonly noiseSize: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
52
|
+
readonly noiseSizeVector: v.OptionalSchema<v.StrictObjectSchema<{
|
|
53
|
+
readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
54
|
+
readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
55
|
+
}, undefined>, undefined>;
|
|
56
|
+
readonly color: v.StrictObjectSchema<{
|
|
57
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
58
|
+
readonly g: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
59
|
+
readonly b: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
60
|
+
readonly a: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
61
|
+
}, undefined>;
|
|
62
|
+
readonly density: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
63
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
64
|
+
readonly noiseType: v.LiteralSchema<"DUOTONE", undefined>;
|
|
65
|
+
readonly secondaryColor: v.StrictObjectSchema<{
|
|
66
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
67
|
+
readonly g: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
68
|
+
readonly b: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
69
|
+
readonly a: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
70
|
+
}, undefined>;
|
|
71
|
+
readonly type: v.LiteralSchema<"NOISE", undefined>;
|
|
72
|
+
readonly visible: v.BooleanSchema<undefined>;
|
|
73
|
+
readonly boundVariables: v.OptionalSchema<v.StrictObjectSchema<{}, undefined>, undefined>;
|
|
74
|
+
readonly noiseSize: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
75
|
+
readonly noiseSizeVector: v.OptionalSchema<v.StrictObjectSchema<{
|
|
76
|
+
readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
77
|
+
readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
78
|
+
}, undefined>, undefined>;
|
|
79
|
+
readonly color: v.StrictObjectSchema<{
|
|
80
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
81
|
+
readonly g: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
82
|
+
readonly b: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
83
|
+
readonly a: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
84
|
+
}, undefined>;
|
|
85
|
+
readonly density: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
86
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
87
|
+
readonly noiseType: v.LiteralSchema<"MULTITONE", undefined>;
|
|
88
|
+
readonly opacity: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
89
|
+
readonly type: v.LiteralSchema<"NOISE", undefined>;
|
|
90
|
+
readonly visible: v.BooleanSchema<undefined>;
|
|
91
|
+
readonly boundVariables: v.OptionalSchema<v.StrictObjectSchema<{}, undefined>, undefined>;
|
|
92
|
+
readonly noiseSize: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
93
|
+
readonly noiseSizeVector: v.OptionalSchema<v.StrictObjectSchema<{
|
|
94
|
+
readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
95
|
+
readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
96
|
+
}, undefined>, undefined>;
|
|
97
|
+
readonly color: v.StrictObjectSchema<{
|
|
98
|
+
readonly r: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
99
|
+
readonly g: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
100
|
+
readonly b: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
101
|
+
readonly a: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
102
|
+
}, undefined>;
|
|
103
|
+
readonly density: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
|
|
104
|
+
}, undefined>], undefined>, v.StrictObjectSchema<{
|
|
105
|
+
readonly type: v.LiteralSchema<"TEXTURE", undefined>;
|
|
106
|
+
readonly visible: v.BooleanSchema<undefined>;
|
|
107
|
+
readonly radius: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
108
|
+
readonly boundVariables: v.OptionalSchema<v.StrictObjectSchema<{}, undefined>, undefined>;
|
|
109
|
+
readonly noiseSize: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
110
|
+
readonly noiseSizeVector: v.OptionalSchema<v.StrictObjectSchema<{
|
|
111
|
+
readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
112
|
+
readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>]>, v.TransformAction<number, number>]>;
|
|
113
|
+
}, undefined>, undefined>;
|
|
114
|
+
readonly clipToShape: v.BooleanSchema<undefined>;
|
|
46
115
|
}, undefined>], undefined>;
|
|
47
116
|
/** An effect as Figma's plugin API reads and writes it (`Effect` in `@figma/plugin-typings`). */
|
|
48
117
|
type FigmaEffect = v.InferOutput<typeof effectSchema>;
|
|
49
118
|
/** Figma's spelling of a path into a value: `[0].color.r`. */
|
|
50
119
|
declare function issuePath(path: readonly v.IssuePathItem[] | undefined): string;
|
|
120
|
+
/**
|
|
121
|
+
* `effects` with every texture after the first left out, as Figma silently keeps one. The effects
|
|
122
|
+
* setter reads bindings from the same list, so their indexes match the effects it keeps.
|
|
123
|
+
*/
|
|
124
|
+
declare function firstTextureOnly<T extends {
|
|
125
|
+
readonly type: string;
|
|
126
|
+
}>(effects: readonly T[]): T[];
|
|
51
127
|
/**
|
|
52
128
|
* Check `value` against Figma's effect shapes and convert it to scene effects.
|
|
53
129
|
* Throws with the first problem, as Figma's `effects` setter does.
|
|
@@ -56,7 +132,7 @@ declare function parseFigmaEffects(value: unknown): Effect[];
|
|
|
56
132
|
/** `value` as scene effects when it holds valid Figma effects, or null. */
|
|
57
133
|
declare function tryParseFigmaEffects(value: unknown): Effect[] | null;
|
|
58
134
|
/** A scene effect in the shape Figma's `effects` getter returns. */
|
|
59
|
-
declare function toFigmaEffect(effect:
|
|
135
|
+
declare function toFigmaEffect(effect: Exclude<Effect, ShaderEffect>): FigmaEffect;
|
|
60
136
|
//#endregion
|
|
61
|
-
export { BLEND_MODES, FigmaEffect, issuePath, parseFigmaEffects, toFigmaEffect, tryParseFigmaEffects };
|
|
137
|
+
export { BLEND_MODES, FigmaEffect, firstTextureOnly, issuePath, parseFigmaEffects, toFigmaEffect, tryParseFigmaEffects };
|
|
62
138
|
//# sourceMappingURL=effects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.d.ts","names":[],"sources":["../../src/figma-api/effects.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"effects.d.ts","names":[],"sources":["../../src/figma-api/effects.ts"],"mappings":";;;cAqCa,aAA8C;cA4CrD,cAAY,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCN,cAAc,EAAE,mBAAmB;;iBAG/B,UAAU,eAAe,EAAE;;;;;iBAsC3B,iBAAiB;WAAqB;GAAgB,kBAAkB,MAAM;;;;;iBAS9E,kBAAkB,iBAAiB;;iBAgBnC,qBAAqB,iBAAiB;;iBA8DtC,cAAc,QAAQ,QAAQ,QAAQ,gBAAgB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TRANSPARENT } from "../constants.js";
|
|
2
|
+
import { BLACK } from "@pairdraw/scene-graph/constants";
|
|
2
3
|
import * as v from "valibot";
|
|
3
4
|
const BLEND_MODES = Object.keys({
|
|
4
5
|
NORMAL: true,
|
|
@@ -22,15 +23,16 @@ const BLEND_MODES = Object.keys({
|
|
|
22
23
|
PASS_THROUGH: true
|
|
23
24
|
});
|
|
24
25
|
/** Effect kinds Figma's plugin API accepts that Pairdraw does not model yet. */
|
|
25
|
-
const UNSUPPORTED_EFFECT_TYPES = /* @__PURE__ */ new Set([
|
|
26
|
-
"NOISE",
|
|
27
|
-
"TEXTURE",
|
|
28
|
-
"GLASS",
|
|
29
|
-
"SHADER"
|
|
30
|
-
]);
|
|
26
|
+
const UNSUPPORTED_EFFECT_TYPES = /* @__PURE__ */ new Set(["GLASS", "SHADER"]);
|
|
31
27
|
const finiteSchema = v.pipe(v.number(), v.finite());
|
|
32
28
|
const unitSchema = v.pipe(finiteSchema, v.minValue(0), v.maxValue(1));
|
|
33
29
|
const nonNegativeSchema = v.pipe(finiteSchema, v.minValue(0));
|
|
30
|
+
const GRAIN_MAX = 100;
|
|
31
|
+
const grainSchema = v.pipe(nonNegativeSchema, v.transform((size) => Math.min(size, GRAIN_MAX)));
|
|
32
|
+
const grainVectorSchema = v.optional(v.strictObject({
|
|
33
|
+
x: grainSchema,
|
|
34
|
+
y: grainSchema
|
|
35
|
+
}));
|
|
34
36
|
const colorSchema = v.strictObject({
|
|
35
37
|
r: unitSchema,
|
|
36
38
|
g: unitSchema,
|
|
@@ -51,6 +53,15 @@ const shadowEntries = {
|
|
|
51
53
|
blendMode: v.picklist(BLEND_MODES),
|
|
52
54
|
boundVariables: boundVariablesSchema
|
|
53
55
|
};
|
|
56
|
+
const noiseEntries = {
|
|
57
|
+
type: v.literal("NOISE"),
|
|
58
|
+
visible: v.boolean(),
|
|
59
|
+
boundVariables: boundVariablesSchema,
|
|
60
|
+
noiseSize: grainSchema,
|
|
61
|
+
noiseSizeVector: grainVectorSchema,
|
|
62
|
+
color: colorSchema,
|
|
63
|
+
density: unitSchema
|
|
64
|
+
};
|
|
54
65
|
const effectSchema = v.variant("type", [
|
|
55
66
|
v.strictObject({
|
|
56
67
|
type: v.literal("DROP_SHADOW"),
|
|
@@ -67,6 +78,31 @@ const effectSchema = v.variant("type", [
|
|
|
67
78
|
visible: v.boolean(),
|
|
68
79
|
blurType: v.optional(v.literal("NORMAL"), "NORMAL"),
|
|
69
80
|
boundVariables: boundVariablesSchema
|
|
81
|
+
}),
|
|
82
|
+
v.variant("noiseType", [
|
|
83
|
+
v.strictObject({
|
|
84
|
+
...noiseEntries,
|
|
85
|
+
noiseType: v.literal("MONOTONE")
|
|
86
|
+
}),
|
|
87
|
+
v.strictObject({
|
|
88
|
+
...noiseEntries,
|
|
89
|
+
noiseType: v.literal("DUOTONE"),
|
|
90
|
+
secondaryColor: colorSchema
|
|
91
|
+
}),
|
|
92
|
+
v.strictObject({
|
|
93
|
+
...noiseEntries,
|
|
94
|
+
noiseType: v.literal("MULTITONE"),
|
|
95
|
+
opacity: unitSchema
|
|
96
|
+
})
|
|
97
|
+
]),
|
|
98
|
+
v.strictObject({
|
|
99
|
+
type: v.literal("TEXTURE"),
|
|
100
|
+
visible: v.boolean(),
|
|
101
|
+
radius: grainSchema,
|
|
102
|
+
boundVariables: boundVariablesSchema,
|
|
103
|
+
noiseSize: grainSchema,
|
|
104
|
+
noiseSizeVector: grainVectorSchema,
|
|
105
|
+
clipToShape: v.boolean()
|
|
70
106
|
})
|
|
71
107
|
]);
|
|
72
108
|
const effectsSchema = v.array(effectSchema);
|
|
@@ -84,6 +120,30 @@ function unsupportedEffect(value) {
|
|
|
84
120
|
return null;
|
|
85
121
|
}
|
|
86
122
|
/**
|
|
123
|
+
* Figma's complaint about an effect whose `noiseSize` is not its `noiseSizeVector.x`, read from
|
|
124
|
+
* the values it was given, or null. The vector's `y` may differ: that is how a grain is not square.
|
|
125
|
+
*/
|
|
126
|
+
function grainSizeMismatch(value) {
|
|
127
|
+
const grain = v.object({
|
|
128
|
+
noiseSize: v.number(),
|
|
129
|
+
noiseSizeVector: v.object({ x: v.number() })
|
|
130
|
+
});
|
|
131
|
+
if (!Array.isArray(value)) return null;
|
|
132
|
+
for (const effect of value) {
|
|
133
|
+
if (!v.is(grain, effect) || effect.noiseSize === effect.noiseSizeVector.x) continue;
|
|
134
|
+
return `Effect noiseSize (${effect.noiseSize}) does not match noiseSizeVector.x (${effect.noiseSizeVector.x}). Ensure these values are consistent.`;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* `effects` with every texture after the first left out, as Figma silently keeps one. The effects
|
|
140
|
+
* setter reads bindings from the same list, so their indexes match the effects it keeps.
|
|
141
|
+
*/
|
|
142
|
+
function firstTextureOnly(effects) {
|
|
143
|
+
const first = effects.findIndex((effect) => effect.type === "TEXTURE");
|
|
144
|
+
return effects.filter((effect, index) => effect.type !== "TEXTURE" || index === first);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
87
147
|
* Check `value` against Figma's effect shapes and convert it to scene effects.
|
|
88
148
|
* Throws with the first problem, as Figma's `effects` setter does.
|
|
89
149
|
*/
|
|
@@ -95,15 +155,51 @@ function parseFigmaEffects(value) {
|
|
|
95
155
|
const [issue] = result.issues;
|
|
96
156
|
throw new Error(`Property "effects" failed validation: ${issue.message} at ${issuePath(issue.path) || "effects"}`);
|
|
97
157
|
}
|
|
98
|
-
|
|
158
|
+
const mismatch = grainSizeMismatch(value);
|
|
159
|
+
if (mismatch) throw new Error(`Property "effects" failed validation: ${mismatch}`);
|
|
160
|
+
return firstTextureOnly(result.output).map(toSceneEffect);
|
|
99
161
|
}
|
|
100
162
|
/** `value` as scene effects when it holds valid Figma effects, or null. */
|
|
101
163
|
function tryParseFigmaEffects(value) {
|
|
102
164
|
if (unsupportedEffect(value)) return null;
|
|
103
165
|
const result = v.safeParse(effectsSchema, value);
|
|
104
|
-
|
|
166
|
+
if (!result.success) return null;
|
|
167
|
+
if (grainSizeMismatch(value)) return null;
|
|
168
|
+
return firstTextureOnly(result.output).map(toSceneEffect);
|
|
169
|
+
}
|
|
170
|
+
/** A grain size as both axes, from the vector when given, else the one number. */
|
|
171
|
+
function grainSize(effect) {
|
|
172
|
+
return effect.noiseSizeVector ? { ...effect.noiseSizeVector } : {
|
|
173
|
+
x: effect.noiseSize,
|
|
174
|
+
y: effect.noiseSize
|
|
175
|
+
};
|
|
105
176
|
}
|
|
106
177
|
function toSceneEffect(effect) {
|
|
178
|
+
if (effect.type === "NOISE") {
|
|
179
|
+
const noise = {
|
|
180
|
+
noiseType: effect.noiseType,
|
|
181
|
+
noiseSize: grainSize(effect),
|
|
182
|
+
density: effect.density
|
|
183
|
+
};
|
|
184
|
+
if (effect.noiseType === "DUOTONE") noise.secondaryColor = { ...effect.secondaryColor };
|
|
185
|
+
if (effect.noiseType === "MULTITONE") noise.opacity = effect.opacity;
|
|
186
|
+
return {
|
|
187
|
+
type: "NOISE",
|
|
188
|
+
color: { ...effect.color },
|
|
189
|
+
visible: effect.visible,
|
|
190
|
+
noise
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (effect.type === "TEXTURE") return {
|
|
194
|
+
type: "TEXTURE",
|
|
195
|
+
color: { ...BLACK },
|
|
196
|
+
radius: effect.radius,
|
|
197
|
+
visible: effect.visible,
|
|
198
|
+
texture: {
|
|
199
|
+
noiseSize: grainSize(effect),
|
|
200
|
+
clipToShape: effect.clipToShape
|
|
201
|
+
}
|
|
202
|
+
};
|
|
107
203
|
if (effect.type === "DROP_SHADOW" || effect.type === "INNER_SHADOW") return {
|
|
108
204
|
type: effect.type,
|
|
109
205
|
color: { ...effect.color },
|
|
@@ -128,6 +224,8 @@ function toSceneEffect(effect) {
|
|
|
128
224
|
}
|
|
129
225
|
/** A scene effect in the shape Figma's `effects` getter returns. */
|
|
130
226
|
function toFigmaEffect(effect) {
|
|
227
|
+
if (effect.type === "NOISE") return figmaNoiseEffect(effect);
|
|
228
|
+
if (effect.type === "TEXTURE") return figmaTextureEffect(effect);
|
|
131
229
|
if (effect.type === "LAYER_BLUR" || effect.type === "FOREGROUND_BLUR" || effect.type === "BACKGROUND_BLUR") return {
|
|
132
230
|
type: effect.type === "BACKGROUND_BLUR" ? "BACKGROUND_BLUR" : "LAYER_BLUR",
|
|
133
231
|
visible: effect.visible,
|
|
@@ -153,7 +251,50 @@ function toFigmaEffect(effect) {
|
|
|
153
251
|
...shadow
|
|
154
252
|
};
|
|
155
253
|
}
|
|
254
|
+
/** A scene noise effect as Figma's `effects` getter returns it, each noise type with its field. */
|
|
255
|
+
function figmaNoiseEffect(effect) {
|
|
256
|
+
const noise = effect.noise;
|
|
257
|
+
const base = {
|
|
258
|
+
type: "NOISE",
|
|
259
|
+
visible: effect.visible,
|
|
260
|
+
boundVariables: {},
|
|
261
|
+
noiseSize: noise.noiseSize.x,
|
|
262
|
+
noiseSizeVector: { ...noise.noiseSize },
|
|
263
|
+
color: { ...effect.color },
|
|
264
|
+
density: noise.density
|
|
265
|
+
};
|
|
266
|
+
if (noise.noiseType === "DUOTONE") {
|
|
267
|
+
const secondaryColor = { ...noise.secondaryColor ?? effect.color };
|
|
268
|
+
return {
|
|
269
|
+
...base,
|
|
270
|
+
noiseType: "DUOTONE",
|
|
271
|
+
secondaryColor
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
if (noise.noiseType === "MULTITONE") return {
|
|
275
|
+
...base,
|
|
276
|
+
noiseType: "MULTITONE",
|
|
277
|
+
opacity: noise.opacity ?? 1
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
...base,
|
|
281
|
+
noiseType: "MONOTONE"
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/** A scene texture effect as Figma's `effects` getter returns it. */
|
|
285
|
+
function figmaTextureEffect(effect) {
|
|
286
|
+
const texture = effect.texture;
|
|
287
|
+
return {
|
|
288
|
+
type: "TEXTURE",
|
|
289
|
+
visible: effect.visible,
|
|
290
|
+
radius: effect.radius,
|
|
291
|
+
boundVariables: {},
|
|
292
|
+
noiseSize: texture.noiseSize.x,
|
|
293
|
+
noiseSizeVector: { ...texture.noiseSize },
|
|
294
|
+
clipToShape: texture.clipToShape
|
|
295
|
+
};
|
|
296
|
+
}
|
|
156
297
|
//#endregion
|
|
157
|
-
export { BLEND_MODES, issuePath, parseFigmaEffects, toFigmaEffect, tryParseFigmaEffects };
|
|
298
|
+
export { BLEND_MODES, firstTextureOnly, issuePath, parseFigmaEffects, toFigmaEffect, tryParseFigmaEffects };
|
|
158
299
|
|
|
159
300
|
//# sourceMappingURL=effects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","names":[],"sources":["../../src/figma-api/effects.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type { BlendMode, Effect, ShadowEffect } from '@pairdraw/scene-graph'\n\nimport { TRANSPARENT } from '#core/constants'\n\nconst BLEND_MODE_KEYS = {\n NORMAL: true,\n DARKEN: true,\n MULTIPLY: true,\n LINEAR_BURN: true,\n COLOR_BURN: true,\n LIGHTEN: true,\n SCREEN: true,\n LINEAR_DODGE: true,\n COLOR_DODGE: true,\n OVERLAY: true,\n SOFT_LIGHT: true,\n HARD_LIGHT: true,\n DIFFERENCE: true,\n EXCLUSION: true,\n HUE: true,\n SATURATION: true,\n COLOR: true,\n LUMINOSITY: true,\n PASS_THROUGH: true\n} satisfies Record<BlendMode, true>\n\nexport const BLEND_MODES = Object.keys(BLEND_MODE_KEYS) as BlendMode[]\n\n/** Effect kinds Figma's plugin API accepts that Pairdraw does not model yet. */\nconst UNSUPPORTED_EFFECT_TYPES = new Set(['NOISE', 'TEXTURE', 'GLASS', 'SHADER'])\n\n// Figma rejects Infinity as well as NaN (\"Number must be finite\").\nconst finiteSchema = v.pipe(v.number(), v.finite())\nconst unitSchema = v.pipe(finiteSchema, v.minValue(0), v.maxValue(1))\nconst nonNegativeSchema = v.pipe(finiteSchema, v.minValue(0))\n\nconst colorSchema = v.strictObject({ r: unitSchema, g: unitSchema, b: unitSchema, a: unitSchema })\nconst vectorSchema = v.strictObject({ x: finiteSchema, y: finiteSchema })\n// Variable bindings on effects are not supported; Figma reports an empty object.\nconst boundVariablesSchema = v.optional(v.strictObject({}))\n\nconst shadowEntries = {\n color: colorSchema,\n offset: vectorSchema,\n radius: nonNegativeSchema,\n spread: v.optional(finiteSchema),\n visible: v.boolean(),\n blendMode: v.picklist(BLEND_MODES),\n boundVariables: boundVariablesSchema\n}\n\nconst effectSchema = v.variant('type', [\n v.strictObject({\n type: v.literal('DROP_SHADOW'),\n ...shadowEntries,\n showShadowBehindNode: v.optional(v.boolean())\n }),\n v.strictObject({ type: v.literal('INNER_SHADOW'), ...shadowEntries }),\n v.strictObject({\n type: v.picklist(['LAYER_BLUR', 'BACKGROUND_BLUR']),\n radius: nonNegativeSchema,\n visible: v.boolean(),\n blurType: v.optional(v.literal('NORMAL'), 'NORMAL'),\n boundVariables: boundVariablesSchema\n })\n])\n\nconst effectsSchema = v.array(effectSchema)\n\n/** An effect as Figma's plugin API reads and writes it (`Effect` in `@figma/plugin-typings`). */\nexport type FigmaEffect = v.InferOutput<typeof effectSchema>\n\n/** Figma's spelling of a path into a value: `[0].color.r`. */\nexport function issuePath(path: readonly v.IssuePathItem[] | undefined): string {\n return (path ?? [])\n .map((item) => (typeof item.key === 'number' ? `[${item.key}]` : `.${String(item.key)}`))\n .join('')\n}\n\nfunction unsupportedEffect(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n for (const [index, effect] of value.entries()) {\n const type: unknown = v.is(v.object({ type: v.unknown() }), effect) ? effect.type : undefined\n if (typeof type === 'string' && UNSUPPORTED_EFFECT_TYPES.has(type)) {\n return `${type} effects are not supported at [${index}].type`\n }\n if (v.is(v.object({ blurType: v.literal('PROGRESSIVE') }), effect)) {\n return `Progressive blur is not supported at [${index}].blurType`\n }\n }\n return null\n}\n\n/**\n * Check `value` against Figma's effect shapes and convert it to scene effects.\n * Throws with the first problem, as Figma's `effects` setter does.\n */\nexport function parseFigmaEffects(value: unknown): Effect[] {\n const unsupported = unsupportedEffect(value)\n if (unsupported) throw new Error(`Property \"effects\" failed validation: ${unsupported}`)\n const result = v.safeParse(effectsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"effects\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'effects'}`\n )\n }\n return result.output.map(toSceneEffect)\n}\n\n/** `value` as scene effects when it holds valid Figma effects, or null. */\nexport function tryParseFigmaEffects(value: unknown): Effect[] | null {\n if (unsupportedEffect(value)) return null\n const result = v.safeParse(effectsSchema, value)\n return result.success ? result.output.map(toSceneEffect) : null\n}\n\nfunction toSceneEffect(effect: FigmaEffect): Effect {\n if (effect.type === 'DROP_SHADOW' || effect.type === 'INNER_SHADOW') {\n return {\n type: effect.type,\n color: { ...effect.color },\n offset: { ...effect.offset },\n radius: effect.radius,\n spread: effect.spread ?? 0,\n visible: effect.visible,\n // Figma accepts PASS_THROUGH on shadows but stores NORMAL; it is a layer blend mode.\n blendMode: effect.blendMode === 'PASS_THROUGH' ? 'NORMAL' : effect.blendMode,\n ...(effect.type === 'DROP_SHADOW' && effect.showShadowBehindNode !== undefined\n ? { showShadowBehindNode: effect.showShadowBehindNode }\n : {})\n }\n }\n return {\n type: effect.type,\n color: { ...TRANSPARENT },\n offset: { x: 0, y: 0 },\n radius: effect.radius,\n spread: 0,\n visible: effect.visible\n }\n}\n\n/** A scene effect in the shape Figma's `effects` getter returns. */\nexport function toFigmaEffect(effect: ShadowEffect): FigmaEffect {\n if (\n effect.type === 'LAYER_BLUR' ||\n effect.type === 'FOREGROUND_BLUR' ||\n effect.type === 'BACKGROUND_BLUR'\n ) {\n return {\n // `.fig` files call a layer blur FOREGROUND_BLUR; the plugin API calls it LAYER_BLUR.\n type: effect.type === 'BACKGROUND_BLUR' ? 'BACKGROUND_BLUR' : 'LAYER_BLUR',\n visible: effect.visible,\n radius: effect.radius,\n boundVariables: {},\n blurType: 'NORMAL'\n }\n }\n const shadow = {\n visible: effect.visible,\n radius: effect.radius,\n boundVariables: {},\n color: { ...effect.color },\n offset: { ...effect.offset },\n spread: effect.spread,\n blendMode: effect.blendMode ?? 'NORMAL'\n }\n return effect.type === 'DROP_SHADOW'\n ? {\n type: 'DROP_SHADOW',\n ...shadow,\n // The renderer draws the shadow behind the node unless this is `false`.\n showShadowBehindNode: effect.showShadowBehindNode ?? true\n }\n : { type: 'INNER_SHADOW', ...shadow }\n}\n"],"mappings":";;AA4BA,MAAa,cAAc,OAAO,KAAK;CArBrC,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,aAAa;CACb,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,cAAc;CACd,aAAa;CACb,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,KAAK;CACL,YAAY;CACZ,OAAO;CACP,YAAY;CACZ,cAAc;AAGuB,CAAe;;AAG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zB,QAAQ,EAAE,GAAG,OAAO,OAAO;EAC3B,QAAQ,OAAO;EACf,QAAQ,OAAO,UAAU;EACzB,SAAS,OAAO;EAEhB,WAAW,OAAO,cAAc,iBAAiB,WAAW,OAAO;EACnE,GAAI,OAAO,SAAS,iBAAiB,OAAO,yBAAyB,KAAA,IACjE,EAAE,sBAAsB,OAAO,qBAAqB,IACpD,CAAC;CACP;CAEF,OAAO;EACL,MAAM,OAAO;EACb,OAAO,EAAE,GAAG,YAAY;EACxB,QAAQ;GAAE,GAAG;GAAG,GAAG;EAAE;EACrB,QAAQ,OAAO;EACf,QAAQ;EACR,SAAS,OAAO;CAClB;AACF;;AAGA,SAAgB,cAAc,QAAmC;CAC/D,IACE,OAAO,SAAS,gBAChB,OAAO,SAAS,qBAChB,OAAO,SAAS,mBAEhB,OAAO;EAEL,MAAM,OAAO,SAAS,oBAAoB,oBAAoB;EAC9D,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,gBAAgB,CAAC;EACjB,UAAU;CACZ;CAEF,MAAM,SAAS;EACb,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,gBAAgB,CAAC;EACjB,OAAO,EAAE,GAAG,OAAO,MAAM;EACzB,QAAQ,EAAE,GAAG,OAAO,OAAO;EAC3B,QAAQ,OAAO;EACf,WAAW,OAAO,aAAa;CACjC;CACA,OAAO,OAAO,SAAS,gBACnB;EACE,MAAM;EACN,GAAG;EAEH,sBAAsB,OAAO,wBAAwB;CACvD,IACA;EAAE,MAAM;EAAgB,GAAG;CAAO;AACxC"}
|
|
1
|
+
{"version":3,"file":"effects.js","names":[],"sources":["../../src/figma-api/effects.ts"],"sourcesContent":["import * as v from 'valibot'\n\nimport type {\n BlendMode,\n Effect,\n NoiseEffect,\n NoiseEffectParams,\n ShaderEffect,\n TextureEffect\n} from '@pairdraw/scene-graph'\nimport { BLACK } from '@pairdraw/scene-graph/constants'\nimport type { Vector } from '@pairdraw/scene-graph/primitives'\n\nimport { TRANSPARENT } from '#core/constants'\n\nconst BLEND_MODE_KEYS = {\n NORMAL: true,\n DARKEN: true,\n MULTIPLY: true,\n LINEAR_BURN: true,\n COLOR_BURN: true,\n LIGHTEN: true,\n SCREEN: true,\n LINEAR_DODGE: true,\n COLOR_DODGE: true,\n OVERLAY: true,\n SOFT_LIGHT: true,\n HARD_LIGHT: true,\n DIFFERENCE: true,\n EXCLUSION: true,\n HUE: true,\n SATURATION: true,\n COLOR: true,\n LUMINOSITY: true,\n PASS_THROUGH: true\n} satisfies Record<BlendMode, true>\n\nexport const BLEND_MODES = Object.keys(BLEND_MODE_KEYS) as BlendMode[]\n\n/** Effect kinds Figma's plugin API accepts that Pairdraw does not model yet. */\nconst UNSUPPORTED_EFFECT_TYPES = new Set(['GLASS', 'SHADER'])\n\n// Figma rejects Infinity as well as NaN (\"Number must be finite\").\nconst finiteSchema = v.pipe(v.number(), v.finite())\nconst unitSchema = v.pipe(finiteSchema, v.minValue(0), v.maxValue(1))\nconst nonNegativeSchema = v.pipe(finiteSchema, v.minValue(0))\n\n// Figma keeps a grain size, and a texture's radius, above 100 at 100 rather than refusing it.\nconst GRAIN_MAX = 100\nconst grainSchema = v.pipe(\n nonNegativeSchema,\n v.transform((size) => Math.min(size, GRAIN_MAX))\n)\nconst grainVectorSchema = v.optional(v.strictObject({ x: grainSchema, y: grainSchema }))\n\nconst colorSchema = v.strictObject({ r: unitSchema, g: unitSchema, b: unitSchema, a: unitSchema })\nconst vectorSchema = v.strictObject({ x: finiteSchema, y: finiteSchema })\n// Variable bindings on effects are not supported; Figma reports an empty object.\nconst boundVariablesSchema = v.optional(v.strictObject({}))\n\nconst shadowEntries = {\n color: colorSchema,\n offset: vectorSchema,\n radius: nonNegativeSchema,\n spread: v.optional(finiteSchema),\n visible: v.boolean(),\n blendMode: v.picklist(BLEND_MODES),\n boundVariables: boundVariablesSchema\n}\n\n// A noise has no visible radius, yet only its radius binds, as on a blur (Figma 126).\nconst noiseEntries = {\n type: v.literal('NOISE'),\n visible: v.boolean(),\n boundVariables: boundVariablesSchema,\n noiseSize: grainSchema,\n noiseSizeVector: grainVectorSchema,\n color: colorSchema,\n density: unitSchema\n}\n\nconst effectSchema = v.variant('type', [\n v.strictObject({\n type: v.literal('DROP_SHADOW'),\n ...shadowEntries,\n showShadowBehindNode: v.optional(v.boolean())\n }),\n v.strictObject({ type: v.literal('INNER_SHADOW'), ...shadowEntries }),\n v.strictObject({\n type: v.picklist(['LAYER_BLUR', 'BACKGROUND_BLUR']),\n radius: nonNegativeSchema,\n visible: v.boolean(),\n blurType: v.optional(v.literal('NORMAL'), 'NORMAL'),\n boundVariables: boundVariablesSchema\n }),\n v.variant('noiseType', [\n v.strictObject({ ...noiseEntries, noiseType: v.literal('MONOTONE') }),\n v.strictObject({\n ...noiseEntries,\n noiseType: v.literal('DUOTONE'),\n secondaryColor: colorSchema\n }),\n v.strictObject({ ...noiseEntries, noiseType: v.literal('MULTITONE'), opacity: unitSchema })\n ]),\n v.strictObject({\n type: v.literal('TEXTURE'),\n visible: v.boolean(),\n radius: grainSchema,\n boundVariables: boundVariablesSchema,\n noiseSize: grainSchema,\n noiseSizeVector: grainVectorSchema,\n clipToShape: v.boolean()\n })\n])\n\nconst effectsSchema = v.array(effectSchema)\n\n/** An effect as Figma's plugin API reads and writes it (`Effect` in `@figma/plugin-typings`). */\nexport type FigmaEffect = v.InferOutput<typeof effectSchema>\n\n/** Figma's spelling of a path into a value: `[0].color.r`. */\nexport function issuePath(path: readonly v.IssuePathItem[] | undefined): string {\n return (path ?? [])\n .map((item) => (typeof item.key === 'number' ? `[${item.key}]` : `.${String(item.key)}`))\n .join('')\n}\n\nfunction unsupportedEffect(value: unknown): string | null {\n if (!Array.isArray(value)) return null\n for (const [index, effect] of value.entries()) {\n const type: unknown = v.is(v.object({ type: v.unknown() }), effect) ? effect.type : undefined\n if (typeof type === 'string' && UNSUPPORTED_EFFECT_TYPES.has(type)) {\n return `${type} effects are not supported at [${index}].type`\n }\n if (v.is(v.object({ blurType: v.literal('PROGRESSIVE') }), effect)) {\n return `Progressive blur is not supported at [${index}].blurType`\n }\n }\n return null\n}\n\n/**\n * Figma's complaint about an effect whose `noiseSize` is not its `noiseSizeVector.x`, read from\n * the values it was given, or null. The vector's `y` may differ: that is how a grain is not square.\n */\nfunction grainSizeMismatch(value: unknown): string | null {\n const grain = v.object({ noiseSize: v.number(), noiseSizeVector: v.object({ x: v.number() }) })\n if (!Array.isArray(value)) return null\n for (const effect of value) {\n if (!v.is(grain, effect) || effect.noiseSize === effect.noiseSizeVector.x) continue\n return `Effect noiseSize (${effect.noiseSize}) does not match noiseSizeVector.x (${effect.noiseSizeVector.x}). Ensure these values are consistent.`\n }\n return null\n}\n\n/**\n * `effects` with every texture after the first left out, as Figma silently keeps one. The effects\n * setter reads bindings from the same list, so their indexes match the effects it keeps.\n */\nexport function firstTextureOnly<T extends { readonly type: string }>(effects: readonly T[]): T[] {\n const first = effects.findIndex((effect) => effect.type === 'TEXTURE')\n return effects.filter((effect, index) => effect.type !== 'TEXTURE' || index === first)\n}\n\n/**\n * Check `value` against Figma's effect shapes and convert it to scene effects.\n * Throws with the first problem, as Figma's `effects` setter does.\n */\nexport function parseFigmaEffects(value: unknown): Effect[] {\n const unsupported = unsupportedEffect(value)\n if (unsupported) throw new Error(`Property \"effects\" failed validation: ${unsupported}`)\n const result = v.safeParse(effectsSchema, value)\n if (!result.success) {\n const [issue] = result.issues\n throw new Error(\n `Property \"effects\" failed validation: ${issue.message} at ${issuePath(issue.path) || 'effects'}`\n )\n }\n const mismatch = grainSizeMismatch(value)\n if (mismatch) throw new Error(`Property \"effects\" failed validation: ${mismatch}`)\n return firstTextureOnly(result.output).map(toSceneEffect)\n}\n\n/** `value` as scene effects when it holds valid Figma effects, or null. */\nexport function tryParseFigmaEffects(value: unknown): Effect[] | null {\n if (unsupportedEffect(value)) return null\n const result = v.safeParse(effectsSchema, value)\n if (!result.success) return null\n if (grainSizeMismatch(value)) return null\n return firstTextureOnly(result.output).map(toSceneEffect)\n}\n\n/** A grain size as both axes, from the vector when given, else the one number. */\nfunction grainSize(effect: { noiseSize: number; noiseSizeVector?: Vector }): Vector {\n return effect.noiseSizeVector\n ? { ...effect.noiseSizeVector }\n : { x: effect.noiseSize, y: effect.noiseSize }\n}\n\nfunction toSceneEffect(effect: FigmaEffect): Effect {\n if (effect.type === 'NOISE') {\n const noise: NoiseEffectParams = {\n noiseType: effect.noiseType,\n noiseSize: grainSize(effect),\n density: effect.density\n }\n if (effect.noiseType === 'DUOTONE') noise.secondaryColor = { ...effect.secondaryColor }\n if (effect.noiseType === 'MULTITONE') noise.opacity = effect.opacity\n return { type: 'NOISE', color: { ...effect.color }, visible: effect.visible, noise }\n }\n if (effect.type === 'TEXTURE') {\n return {\n type: 'TEXTURE',\n // A `.fig` texture carries an opaque black colour it does not use.\n color: { ...BLACK },\n radius: effect.radius,\n visible: effect.visible,\n texture: { noiseSize: grainSize(effect), clipToShape: effect.clipToShape }\n }\n }\n if (effect.type === 'DROP_SHADOW' || effect.type === 'INNER_SHADOW') {\n return {\n type: effect.type,\n color: { ...effect.color },\n offset: { ...effect.offset },\n radius: effect.radius,\n spread: effect.spread ?? 0,\n visible: effect.visible,\n // Figma accepts PASS_THROUGH on shadows but stores NORMAL; it is a layer blend mode.\n blendMode: effect.blendMode === 'PASS_THROUGH' ? 'NORMAL' : effect.blendMode,\n ...(effect.type === 'DROP_SHADOW' && effect.showShadowBehindNode !== undefined\n ? { showShadowBehindNode: effect.showShadowBehindNode }\n : {})\n }\n }\n return {\n type: effect.type,\n color: { ...TRANSPARENT },\n offset: { x: 0, y: 0 },\n radius: effect.radius,\n spread: 0,\n visible: effect.visible\n }\n}\n\n/** A scene effect in the shape Figma's `effects` getter returns. */\nexport function toFigmaEffect(effect: Exclude<Effect, ShaderEffect>): FigmaEffect {\n if (effect.type === 'NOISE') return figmaNoiseEffect(effect)\n if (effect.type === 'TEXTURE') return figmaTextureEffect(effect)\n if (\n effect.type === 'LAYER_BLUR' ||\n effect.type === 'FOREGROUND_BLUR' ||\n effect.type === 'BACKGROUND_BLUR'\n ) {\n return {\n // `.fig` files call a layer blur FOREGROUND_BLUR; the plugin API calls it LAYER_BLUR.\n type: effect.type === 'BACKGROUND_BLUR' ? 'BACKGROUND_BLUR' : 'LAYER_BLUR',\n visible: effect.visible,\n radius: effect.radius,\n boundVariables: {},\n blurType: 'NORMAL'\n }\n }\n const shadow = {\n visible: effect.visible,\n radius: effect.radius,\n boundVariables: {},\n color: { ...effect.color },\n offset: { ...effect.offset },\n spread: effect.spread,\n blendMode: effect.blendMode ?? 'NORMAL'\n }\n return effect.type === 'DROP_SHADOW'\n ? {\n type: 'DROP_SHADOW',\n ...shadow,\n // The renderer draws the shadow behind the node unless this is `false`.\n showShadowBehindNode: effect.showShadowBehindNode ?? true\n }\n : { type: 'INNER_SHADOW', ...shadow }\n}\n\n/** A scene noise effect as Figma's `effects` getter returns it, each noise type with its field. */\nfunction figmaNoiseEffect(effect: NoiseEffect): FigmaEffect {\n const noise = effect.noise\n const base = {\n type: 'NOISE' as const,\n visible: effect.visible,\n boundVariables: {},\n noiseSize: noise.noiseSize.x,\n noiseSizeVector: { ...noise.noiseSize },\n color: { ...effect.color },\n density: noise.density\n }\n if (noise.noiseType === 'DUOTONE') {\n const secondaryColor = { ...(noise.secondaryColor ?? effect.color) }\n return { ...base, noiseType: 'DUOTONE', secondaryColor }\n }\n if (noise.noiseType === 'MULTITONE') {\n return { ...base, noiseType: 'MULTITONE', opacity: noise.opacity ?? 1 }\n }\n return { ...base, noiseType: 'MONOTONE' }\n}\n\n/** A scene texture effect as Figma's `effects` getter returns it. */\nfunction figmaTextureEffect(effect: TextureEffect): FigmaEffect {\n const texture = effect.texture\n return {\n type: 'TEXTURE',\n visible: effect.visible,\n radius: effect.radius,\n boundVariables: {},\n noiseSize: texture.noiseSize.x,\n noiseSizeVector: { ...texture.noiseSize },\n clipToShape: texture.clipToShape\n }\n}\n"],"mappings":";;;AAqCA,MAAa,cAAc,OAAO,KAAK;CArB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AM;CACjB;CACA,IAAI,MAAM,cAAc,WAAW;EACjC,MAAM,iBAAiB,EAAE,GAAI,MAAM,kBAAkB,OAAO,MAAO;EACnE,OAAO;GAAE,GAAG;GAAM,WAAW;GAAW;EAAe;CACzD;CACA,IAAI,MAAM,cAAc,aACtB,OAAO;EAAE,GAAG;EAAM,WAAW;EAAa,SAAS,MAAM,WAAW;CAAE;CAExE,OAAO;EAAE,GAAG;EAAM,WAAW;CAAW;AAC1C;;AAGA,SAAS,mBAAmB,QAAoC;CAC9D,MAAM,UAAU,OAAO;CACvB,OAAO;EACL,MAAM;EACN,SAAS,OAAO;EAChB,QAAQ,OAAO;EACf,gBAAgB,CAAC;EACjB,WAAW,QAAQ,UAAU;EAC7B,iBAAiB,EAAE,GAAG,QAAQ,UAAU;EACxC,aAAa,QAAQ;CACvB;AACF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CharacterStyleOverride, SceneNode } from "@pairdraw/scene-graph";
|
|
2
2
|
//#region src/figma-api/fonts/loaded.d.ts
|
|
3
|
+
/** Whether every face the text draws in is one the document can use, loaded or from a known family. */
|
|
4
|
+
declare function textHasMissingFont(node: SceneNode): boolean;
|
|
3
5
|
/**
|
|
4
6
|
* Figma refuses an edit that lays text out again until every font the text uses is loaded, so
|
|
5
7
|
* the text is never measured in a stand-in font. Paints and links need no font. Callers check
|
|
@@ -9,5 +11,5 @@ declare function assertTextFontsLoaded(method: string, node: SceneNode): void;
|
|
|
9
11
|
/** Figma refuses a font that is not loaded yet, before it checks the text's own. */
|
|
10
12
|
declare function assertFontLoaded(method: string, node: SceneNode, style: CharacterStyleOverride): void;
|
|
11
13
|
//#endregion
|
|
12
|
-
export { assertFontLoaded, assertTextFontsLoaded };
|
|
14
|
+
export { assertFontLoaded, assertTextFontsLoaded, textHasMissingFont };
|
|
13
15
|
//# sourceMappingURL=loaded.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaded.d.ts","names":[],"sources":["../../../src/figma-api/fonts/loaded.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"loaded.d.ts","names":[],"sources":["../../../src/figma-api/fonts/loaded.ts"],"mappings":";;;iBAyCgB,mBAAmB,MAAM;;;;;;iBAazB,sBAAsB,gBAAgB,MAAM;;iBAS5C,iBACd,gBACA,MAAM,WACN,OAAO"}
|
|
@@ -23,6 +23,13 @@ function textFaces(node) {
|
|
|
23
23
|
const faces = [describedFace(node), ...node.styleRuns.map((run) => describedFace(node, run.style))];
|
|
24
24
|
return uniqBy(faces, (face) => `${face.family}\0${face.loadStyle}`);
|
|
25
25
|
}
|
|
26
|
+
/** Whether every face the text draws in is one the document can use, loaded or from a known family. */
|
|
27
|
+
function textHasMissingFont(node) {
|
|
28
|
+
return textFaces(node).some((face) => {
|
|
29
|
+
if (isLoaded(face)) return false;
|
|
30
|
+
return !(fontManager.familyFacesSync(face.family) ?? []).some((faceOfFamily) => faceOfFamily.style === face.loadStyle);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
26
33
|
/**
|
|
27
34
|
* Figma refuses an edit that lays text out again until every font the text uses is loaded, so
|
|
28
35
|
* the text is never measured in a stand-in font. Paints and links need no font. Callers check
|
|
@@ -40,6 +47,6 @@ function assertFontLoaded(method, node, style) {
|
|
|
40
47
|
throw new Error(`in ${method}: Cannot use unloaded font "${font.family} ${font.style}". ${loadHint(font)}`);
|
|
41
48
|
}
|
|
42
49
|
//#endregion
|
|
43
|
-
export { assertFontLoaded, assertTextFontsLoaded };
|
|
50
|
+
export { assertFontLoaded, assertTextFontsLoaded, textHasMissingFont };
|
|
44
51
|
|
|
45
52
|
//# sourceMappingURL=loaded.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaded.js","names":[],"sources":["../../../src/figma-api/fonts/loaded.ts"],"sourcesContent":["import { uniqBy } from 'es-toolkit/array'\n\nimport type { CharacterStyleOverride, SceneNode } from '@pairdraw/scene-graph'\n\nimport { fontManager } from '#core/text/font/manager'\nimport { textFaceName } from '#core/text/font/names'\nimport { textFontFace } from '#core/text/requirements/collect'\n\n/** A face text draws in, and its name as Figma names it in its messages. */\ninterface DescribedFace {\n family: string\n /** The style the font manager loads the face as. */\n loadStyle: string\n /** The face's own name, as `fontName` reads it. */\n style: string\n}\n\n/** The face characters with `style` over the text draw in, named as the text names it. */\nfunction describedFace(node: SceneNode, style: CharacterStyleOverride = {}): DescribedFace {\n const face = textFontFace(node, style)\n return { family: face.family, loadStyle: face.style, style: textFaceName(node, style) }\n}\n\nfunction loadHint({ family, style }: DescribedFace): string {\n return `Please call figma.loadFontAsync({ family: \"${family}\", style: \"${style}\" }) and await the returned promise first.`\n}\n\nfunction isLoaded(face: DescribedFace): boolean {\n return fontManager.isStyleLoaded(face.family, face.loadStyle)\n}\n\n/** Every face the text draws in: its own and each style run's. */\nfunction textFaces(node: SceneNode): DescribedFace[] {\n const faces = [\n describedFace(node),\n ...node.styleRuns.map((run) => describedFace(node, run.style))\n ]\n return uniqBy(faces, (face) => `${face.family}\\0${face.loadStyle}`)\n}\n\n/**\n * Figma refuses an edit that lays text out again until every font the text uses is loaded, so\n * the text is never measured in a stand-in font. Paints and links need no font. Callers check\n * the edit's own arguments first, as Figma does.\n */\nexport function assertTextFontsLoaded(method: string, node: SceneNode): void {\n const font = textFaces(node).find((face) => !isLoaded(face))\n if (!font) return\n throw new Error(\n `in ${method}: Cannot write to node with unloaded font \"${font.family} ${font.style}\". ${loadHint(font)}`\n )\n}\n\n/** Figma refuses a font that is not loaded yet, before it checks the text's own. */\nexport function assertFontLoaded(\n method: string,\n node: SceneNode,\n style: CharacterStyleOverride\n): void {\n const font = describedFace(node, style)\n if (isLoaded(font)) return\n throw new Error(\n `in ${method}: Cannot use unloaded font \"${font.family} ${font.style}\". ${loadHint(font)}`\n )\n}\n"],"mappings":";;;;;;AAkBA,SAAS,cAAc,MAAiB,QAAgC,CAAC,GAAkB;CACzF,MAAM,OAAO,aAAa,MAAM,KAAK;CACrC,OAAO;EAAE,QAAQ,KAAK;EAAQ,WAAW,KAAK;EAAO,OAAO,aAAa,MAAM,KAAK;CAAE;AACxF;AAEA,SAAS,SAAS,EAAE,QAAQ,SAAgC;CAC1D,OAAO,8CAA8C,OAAO,aAAa,MAAM;AACjF;AAEA,SAAS,SAAS,MAA8B;CAC9C,OAAO,YAAY,cAAc,KAAK,QAAQ,KAAK,SAAS;AAC9D;;AAGA,SAAS,UAAU,MAAkC;CACnD,MAAM,QAAQ,CACZ,cAAc,IAAI,GAClB,GAAG,KAAK,UAAU,KAAK,QAAQ,cAAc,MAAM,IAAI,KAAK,CAAC,CAC/D;CACA,OAAO,OAAO,QAAQ,SAAS,GAAG,KAAK,OAAO,IAAI,KAAK,WAAW;AACpE;;;;;;AAOA,SAAgB,sBAAsB,QAAgB,MAAuB;CAC3E,MAAM,OAAO,UAAU,IAAI,CAAC,CAAC,MAAM,SAAS,CAAC,SAAS,IAAI,CAAC;CAC3D,IAAI,CAAC,MAAM;CACX,MAAM,IAAI,MACR,MAAM,OAAO,6CAA6C,KAAK,OAAO,GAAG,KAAK,MAAM,KAAK,SAAS,IAAI,GACxG;AACF;;AAGA,SAAgB,iBACd,QACA,MACA,OACM;CACN,MAAM,OAAO,cAAc,MAAM,KAAK;CACtC,IAAI,SAAS,IAAI,GAAG;CACpB,MAAM,IAAI,MACR,MAAM,OAAO,8BAA8B,KAAK,OAAO,GAAG,KAAK,MAAM,KAAK,SAAS,IAAI,GACzF;AACF"}
|
|
1
|
+
{"version":3,"file":"loaded.js","names":[],"sources":["../../../src/figma-api/fonts/loaded.ts"],"sourcesContent":["import { uniqBy } from 'es-toolkit/array'\n\nimport type { CharacterStyleOverride, SceneNode } from '@pairdraw/scene-graph'\n\nimport { fontManager } from '#core/text/font/manager'\nimport { textFaceName } from '#core/text/font/names'\nimport { textFontFace } from '#core/text/requirements/collect'\n\n/** A face text draws in, and its name as Figma names it in its messages. */\ninterface DescribedFace {\n family: string\n /** The style the font manager loads the face as. */\n loadStyle: string\n /** The face's own name, as `fontName` reads it. */\n style: string\n}\n\n/** The face characters with `style` over the text draw in, named as the text names it. */\nfunction describedFace(node: SceneNode, style: CharacterStyleOverride = {}): DescribedFace {\n const face = textFontFace(node, style)\n return { family: face.family, loadStyle: face.style, style: textFaceName(node, style) }\n}\n\nfunction loadHint({ family, style }: DescribedFace): string {\n return `Please call figma.loadFontAsync({ family: \"${family}\", style: \"${style}\" }) and await the returned promise first.`\n}\n\nfunction isLoaded(face: DescribedFace): boolean {\n return fontManager.isStyleLoaded(face.family, face.loadStyle)\n}\n\n/** Every face the text draws in: its own and each style run's. */\nfunction textFaces(node: SceneNode): DescribedFace[] {\n const faces = [\n describedFace(node),\n ...node.styleRuns.map((run) => describedFace(node, run.style))\n ]\n return uniqBy(faces, (face) => `${face.family}\\0${face.loadStyle}`)\n}\n\n/** Whether every face the text draws in is one the document can use, loaded or from a known family. */\nexport function textHasMissingFont(node: SceneNode): boolean {\n return textFaces(node).some((face) => {\n if (isLoaded(face)) return false\n const known = fontManager.familyFacesSync(face.family) ?? []\n return !known.some((faceOfFamily) => faceOfFamily.style === face.loadStyle)\n })\n}\n\n/**\n * Figma refuses an edit that lays text out again until every font the text uses is loaded, so\n * the text is never measured in a stand-in font. Paints and links need no font. Callers check\n * the edit's own arguments first, as Figma does.\n */\nexport function assertTextFontsLoaded(method: string, node: SceneNode): void {\n const font = textFaces(node).find((face) => !isLoaded(face))\n if (!font) return\n throw new Error(\n `in ${method}: Cannot write to node with unloaded font \"${font.family} ${font.style}\". ${loadHint(font)}`\n )\n}\n\n/** Figma refuses a font that is not loaded yet, before it checks the text's own. */\nexport function assertFontLoaded(\n method: string,\n node: SceneNode,\n style: CharacterStyleOverride\n): void {\n const font = describedFace(node, style)\n if (isLoaded(font)) return\n throw new Error(\n `in ${method}: Cannot use unloaded font \"${font.family} ${font.style}\". ${loadHint(font)}`\n )\n}\n"],"mappings":";;;;;;AAkBA,SAAS,cAAc,MAAiB,QAAgC,CAAC,GAAkB;CACzF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implements NodeProxyHost {
|
|
|
182
182
|
listAvailableFontsAsync(): Promise<FigmaFont[]>;
|
|
183
183
|
base64Encode(data: Uint8Array): string;
|
|
184
184
|
base64Decode(data: string): Uint8Array;
|
|
185
|
+
/**
|
|
186
|
+
* A script run in the editor has no UI to talk to, and Figma still gives every plugin a UI
|
|
187
|
+
* object, so scripts that guard on `figma.ui` keep working here: the calls do nothing.
|
|
188
|
+
*/
|
|
189
|
+
readonly ui: {
|
|
190
|
+
onmessage: ((message: unknown, props: unknown) => void) | undefined;
|
|
191
|
+
postMessage(message: unknown): void;
|
|
192
|
+
resize(width: number, height: number): void;
|
|
193
|
+
close(): void;
|
|
194
|
+
show(): void;
|
|
195
|
+
hide(): void;
|
|
196
|
+
};
|
|
197
|
+
showUI(html?: string, options?: unknown): void;
|
|
185
198
|
notify(message: string): {
|
|
186
199
|
cancel: () => void;
|
|
187
200
|
};
|
|
@@ -195,6 +208,11 @@ declare class FigmaAPI implements NodeProxyHost {
|
|
|
195
208
|
commitUndo(): void;
|
|
196
209
|
triggerUndo(): void;
|
|
197
210
|
exportImage?: (nodeIds: string[], options: ExportImageOptions) => Promise<Uint8Array | null>;
|
|
211
|
+
/**
|
|
212
|
+
* Renders nodes of a graph other than the open document's, such as a copy a tool resized, so
|
|
213
|
+
* checking a variant leaves the document and its undo history untouched.
|
|
214
|
+
*/
|
|
215
|
+
exportGraphImage?: (graph: SceneGraph, pageId: string, nodeIds: string[], options: ExportImageOptions) => Promise<Uint8Array | null>;
|
|
198
216
|
/** Where icon tools search and fetch icons; hosts may pass a self-hosted or bundled set. */
|
|
199
217
|
icons: IconProvider;
|
|
200
218
|
rasterCodec?: RasterCodec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/figma-api/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;UAmEiB;EACf,QAAQ;EACR;;;UAIe;;EAEf,QAAQ;;;;;;EAMR,YAAY,mBAAmB;;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