@pairdraw/core 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/noise/render.js +1 -1
- package/dist/canvas/noise/render.js.map +1 -1
- package/dist/canvas/noise/shader.d.ts +6 -3
- package/dist/canvas/noise/shader.d.ts.map +1 -1
- package/dist/canvas/noise/shader.js +12 -7
- package/dist/canvas/noise/shader.js.map +1 -1
- package/dist/canvas/noise/tile.d.ts.map +1 -1
- package/dist/canvas/noise/tile.js +2 -1
- package/dist/canvas/noise/tile.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts +20 -5
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +48 -42
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/document-surface.d.ts +25 -0
- package/dist/canvas/renderer/document-surface.d.ts.map +1 -0
- package/dist/canvas/renderer/document-surface.js +46 -0
- package/dist/canvas/renderer/document-surface.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +6 -4
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +4 -3
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -0
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +23 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.d.ts.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +2 -1
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +2 -7
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer.d.ts +20 -2
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +28 -4
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +4 -3
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +2 -1
- package/dist/canvas/shaders/effect.js.map +1 -1
- package/dist/canvas/shadows/shape.d.ts.map +1 -1
- package/dist/canvas/shadows/shape.js +4 -2
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +4 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/decorations.d.ts +2 -2
- package/dist/canvas/text/decorations.d.ts.map +1 -1
- package/dist/canvas/text/decorations.js +5 -5
- package/dist/canvas/text/decorations.js.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +2 -2
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -5
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -1
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +4 -4
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/canvas/texture.d.ts.map +1 -1
- package/dist/canvas/texture.js +2 -1
- package/dist/canvas/texture.js.map +1 -1
- package/dist/design-memory/rules.js +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.d.ts.map +1 -1
- package/dist/editor/clipboard/assets.js +2 -2
- package/dist/editor/clipboard/assets.js.map +1 -1
- package/dist/editor/clipboard/component-matches.d.ts +13 -0
- package/dist/editor/clipboard/component-matches.d.ts.map +1 -0
- package/dist/editor/clipboard/component-matches.js +50 -0
- package/dist/editor/clipboard/component-matches.js.map +1 -0
- package/dist/editor/clipboard/dependencies.d.ts +7 -0
- package/dist/editor/clipboard/dependencies.d.ts.map +1 -1
- package/dist/editor/clipboard/dependencies.js +5 -0
- package/dist/editor/clipboard/dependencies.js.map +1 -1
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +48 -19
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -3
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/create.d.ts +1 -1
- package/dist/editor/eyedropper.d.ts +1 -1
- package/dist/editor/eyedropper.d.ts.map +1 -1
- package/dist/editor/eyedropper.js +6 -3
- package/dist/editor/eyedropper.js.map +1 -1
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +3 -2
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/shapes/pencil.js +1 -1
- package/dist/editor/structure/state.d.ts.map +1 -1
- package/dist/editor/structure/state.js +2 -2
- package/dist/editor/structure/state.js.map +1 -1
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +2 -2
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/variables.js +3 -3
- package/dist/editor/variables.js.map +1 -1
- package/dist/figma-api/fresh-read.d.ts +15 -0
- package/dist/figma-api/fresh-read.d.ts.map +1 -0
- package/dist/figma-api/fresh-read.js +54 -0
- package/dist/figma-api/fresh-read.js.map +1 -0
- package/dist/figma-api/graph-ref.d.ts +9 -0
- package/dist/figma-api/graph-ref.d.ts.map +1 -0
- package/dist/figma-api/graph-ref.js +14 -0
- package/dist/figma-api/graph-ref.js.map +1 -0
- package/dist/figma-api/index.d.ts +6 -1
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +12 -5
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +3 -3
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +7 -3
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +1 -1
- package/dist/figma-api/pending-sync.d.ts.map +1 -1
- package/dist/figma-api/pending-sync.js +3 -1
- package/dist/figma-api/pending-sync.js.map +1 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +3 -2
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +20 -4
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +49 -3
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/variables/index.d.ts.map +1 -1
- package/dist/figma-api/variables/index.js +2 -2
- package/dist/figma-api/variables/index.js.map +1 -1
- package/dist/io/formats/design-tokens/css/known.js +1 -1
- package/dist/io/formats/design-tokens/css/known.js.map +1 -1
- package/dist/io/formats/design-tokens/css/read.d.ts +3 -1
- package/dist/io/formats/design-tokens/css/read.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/read.js +11 -5
- package/dist/io/formats/design-tokens/css/read.js.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/sync.js +17 -4
- package/dist/io/formats/design-tokens/css/sync.js.map +1 -1
- package/dist/io/formats/design-tokens/css/values.d.ts +6 -5
- package/dist/io/formats/design-tokens/css/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/css/values.js +24 -8
- package/dist/io/formats/design-tokens/css/values.js.map +1 -1
- package/dist/io/formats/design-tokens/decode.d.ts +7 -6
- package/dist/io/formats/design-tokens/decode.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/decode.js +13 -12
- package/dist/io/formats/design-tokens/decode.js.map +1 -1
- package/dist/io/formats/design-tokens/export.js +3 -3
- package/dist/io/formats/design-tokens/export.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -3
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +9 -9
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +4 -4
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +7 -7
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/drift.js +2 -2
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -1
- package/dist/io/formats/design-tokens/values.d.ts +10 -5
- package/dist/io/formats/design-tokens/values.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/values.js +13 -7
- package/dist/io/formats/design-tokens/values.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/warnings.js +2 -2
- package/dist/io/formats/drawio/warnings.js.map +1 -1
- package/dist/io/formats/fig/export/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/index.js +15 -3
- package/dist/io/formats/fig/export/index.js.map +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +2 -1
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts +7 -2
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +12 -13
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +9 -7
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/html/vectors.js +1 -0
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/layers.js +2 -2
- package/dist/io/formats/mermaid/layers.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +1 -1
- package/dist/io/formats/pdf/export.d.ts.map +1 -1
- package/dist/io/formats/pdf/export.js +1 -0
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +4 -4
- package/dist/io/formats/pdf/prepare.d.ts.map +1 -1
- package/dist/io/formats/pdf/prepare.js +2 -2
- package/dist/io/formats/pdf/prepare.js.map +1 -1
- package/dist/io/formats/pen/index.js +4 -2
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/style.js +1 -1
- package/dist/io/formats/raster/render.d.ts +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +9 -4
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +6 -3
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +12 -11
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.js +2 -2
- package/dist/io/formats/svg/effects.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts +5 -2
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +4 -2
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +4 -1
- package/dist/io/formats/svg/filter.d.ts.map +1 -1
- package/dist/io/formats/svg/filter.js +6 -2
- package/dist/io/formats/svg/filter.js.map +1 -1
- package/dist/io/formats/svg/grain.js +1 -1
- package/dist/io/formats/svg/grain.js.map +1 -1
- package/dist/io/formats/svg/import.d.ts +4 -2
- package/dist/io/formats/svg/import.d.ts.map +1 -1
- package/dist/io/formats/svg/import.js +2 -1
- package/dist/io/formats/svg/import.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +8 -8
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/layout.js +2 -2
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +1 -0
- package/dist/io/formats.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +1 -1
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +1 -1
- package/dist/kiwi/fig/session/options.d.ts +3 -0
- package/dist/kiwi/fig/session/options.d.ts.map +1 -1
- package/dist/kiwi/fig/session/options.js +4 -0
- package/dist/kiwi/fig/session/options.js.map +1 -1
- package/dist/layout/yoga-helpers.d.ts +2 -1
- package/dist/layout/yoga-helpers.d.ts.map +1 -1
- package/dist/layout/yoga-helpers.js +7 -1
- package/dist/layout/yoga-helpers.js.map +1 -1
- package/dist/layout.js +24 -1
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.js +1 -1
- package/dist/lint/linter.js +2 -2
- package/dist/lint/linter.js.map +1 -1
- package/dist/pairdraw-api/comments.d.ts +4 -1
- package/dist/pairdraw-api/comments.d.ts.map +1 -1
- package/dist/pairdraw-api/comments.js +5 -0
- package/dist/pairdraw-api/comments.js.map +1 -1
- package/dist/pairdraw-api/index.d.ts +3 -3
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +5 -5
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +1 -1
- package/dist/prototype/scene.js +1 -1
- package/dist/rpc/analyze-commands.js +1 -1
- package/dist/rpc/read-commands.d.ts +2 -2
- package/dist/rpc/read-commands.js +3 -3
- package/dist/rpc/read-commands.js.map +1 -1
- package/dist/rpc/variables-command.js +2 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/font/provider.d.ts +15 -0
- package/dist/text/font/provider.d.ts.map +1 -0
- package/dist/text/font/provider.js +18 -0
- package/dist/text/font/provider.js.map +1 -0
- package/dist/text/font/readiness.d.ts +32 -0
- package/dist/text/font/readiness.d.ts.map +1 -0
- package/dist/text/font/{status.js → readiness.js} +8 -4
- package/dist/text/font/readiness.js.map +1 -0
- package/dist/text/index.d.ts +4 -3
- package/dist/text/index.js +4 -3
- package/dist/text/prepare.d.ts +9 -4
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +9 -4
- package/dist/text/prepare.js.map +1 -1
- package/dist/tools/analyze/colors.js +1 -1
- package/dist/tools/analyze/responsive/index.js +7 -18
- package/dist/tools/analyze/responsive/index.js.map +1 -1
- package/dist/tools/analyze/responsive/widths.d.ts +27 -0
- package/dist/tools/analyze/responsive/widths.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/widths.js +49 -0
- package/dist/tools/analyze/responsive/widths.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -1
- package/dist/tools/codegen/tokens.d.ts.map +1 -1
- package/dist/tools/codegen/tokens.js +2 -2
- package/dist/tools/codegen/tokens.js.map +1 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +2 -2
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/component-catalog.d.ts.map +1 -1
- package/dist/tools/component-catalog.js +5 -3
- package/dist/tools/component-catalog.js.map +1 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +1 -3
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.js +2 -2
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +5 -2
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +3 -3
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/css/shorthand.d.ts +20 -0
- package/dist/tools/css/shorthand.d.ts.map +1 -0
- package/dist/tools/css/shorthand.js +54 -0
- package/dist/tools/css/shorthand.js.map +1 -0
- package/dist/tools/describe/index.js +2 -2
- package/dist/tools/describe/index.js.map +1 -1
- package/dist/tools/describe/issues.js +1 -1
- package/dist/tools/html-host.d.ts.map +1 -1
- package/dist/tools/html-host.js +5 -3
- package/dist/tools/html-host.js.map +1 -1
- package/dist/tools/image-ai/apply.d.ts.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -3
- package/dist/tools/image-ai/apply.js.map +1 -1
- package/dist/tools/image-ai/generate.js +1 -1
- package/dist/tools/image-ai/service.d.ts.map +1 -1
- package/dist/tools/image-ai/service.js +5 -3
- package/dist/tools/image-ai/service.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/modify/effects.js +1 -1
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/geometry.d.ts.map +1 -1
- package/dist/tools/modify/geometry.js +14 -3
- package/dist/tools/modify/geometry.js.map +1 -1
- package/dist/tools/modify/layout.d.ts.map +1 -1
- package/dist/tools/modify/layout.js +35 -8
- package/dist/tools/modify/layout.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +10 -10
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +57 -5
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +2 -2
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +3 -3
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/prompts/codegen.js +1 -1
- package/dist/tools/prompts/codegen.js.map +1 -1
- package/dist/tools/read/css.d.ts +14 -0
- package/dist/tools/read/css.d.ts.map +1 -0
- package/dist/tools/read/css.js +306 -0
- package/dist/tools/read/css.js.map +1 -0
- package/dist/tools/read/libraries.js +1 -1
- package/dist/tools/read/reactions.js +1 -1
- package/dist/tools/read/reactions.js.map +1 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +0 -2
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.js +3 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -4
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +9 -5
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/script/host.d.ts.map +1 -1
- package/dist/tools/script/host.js +5 -3
- package/dist/tools/script/host.js.map +1 -1
- package/dist/tools/variables/collections.js +1 -1
- package/dist/tools/variables/collections.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -4
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/vectorize.d.ts.map +1 -1
- package/dist/tools/vector/vectorize.js +6 -4
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/video-host.d.ts.map +1 -1
- package/dist/tools/video-host.js +5 -3
- package/dist/tools/video-host.js.map +1 -1
- package/dist/vector/vectorize/svg/gradients.d.ts +2 -2
- package/dist/vector/vectorize/svg/gradients.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/gradients.js +5 -5
- package/dist/vector/vectorize/svg/gradients.js.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +3 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts.map +1 -1
- package/dist/vector/vectorize/svg/to-vectors.js +13 -12
- package/dist/vector/vectorize/svg/to-vectors.js.map +1 -1
- package/package.json +9 -9
- package/src/canvas/noise/render.ts +1 -1
- package/src/canvas/noise/shader.ts +13 -5
- package/src/canvas/noise/tile.ts +2 -1
- package/src/canvas/renderer/colors.ts +76 -50
- package/src/canvas/renderer/document-surface.ts +53 -0
- package/src/canvas/renderer/fonts.ts +6 -4
- package/src/canvas/renderer/lifecycle.ts +4 -4
- package/src/canvas/renderer/methods.ts +1 -0
- package/src/canvas/renderer/pipeline.ts +21 -3
- package/src/canvas/renderer/retained-backing.ts +2 -1
- package/src/canvas/renderer/tiles/surface-pool.ts +9 -7
- package/src/canvas/renderer.ts +36 -11
- package/src/canvas/scene.ts +4 -3
- package/src/canvas/shaders/effect.ts +2 -1
- package/src/canvas/shadows/shape.ts +4 -2
- package/src/canvas/shadows.ts +5 -2
- package/src/canvas/text/decorations.ts +15 -5
- package/src/canvas/text/index.ts +9 -1
- package/src/canvas/text/paragraph/index.ts +16 -6
- package/src/canvas/text/renderer.ts +2 -1
- package/src/canvas/text/shape.ts +4 -4
- package/src/canvas/texture.ts +2 -1
- package/src/editor/clipboard/assets.ts +6 -2
- package/src/editor/clipboard/component-matches.ts +65 -0
- package/src/editor/clipboard/dependencies.ts +22 -1
- package/src/editor/clipboard.ts +74 -20
- package/src/editor/components/properties.ts +3 -2
- package/src/editor/eyedropper.ts +14 -4
- package/src/editor/history/atomic-tool.ts +3 -2
- package/src/editor/structure/state.ts +2 -1
- package/src/editor/text.ts +2 -1
- package/src/editor/variables.ts +3 -3
- package/src/figma-api/fresh-read.ts +57 -0
- package/src/figma-api/graph-ref.ts +13 -0
- package/src/figma-api/index.ts +12 -4
- package/src/figma-api/pending-layout.ts +7 -3
- package/src/figma-api/pending-sync.ts +4 -1
- package/src/figma-api/proxy.ts +2 -1
- package/src/figma-api/reactions.ts +91 -10
- package/src/figma-api/variables/index.ts +5 -4
- package/src/io/formats/design-tokens/css/known.ts +1 -1
- package/src/io/formats/design-tokens/css/read.ts +20 -7
- package/src/io/formats/design-tokens/css/sync.ts +9 -4
- package/src/io/formats/design-tokens/css/values.ts +37 -9
- package/src/io/formats/design-tokens/decode.ts +17 -12
- package/src/io/formats/design-tokens/export.ts +3 -3
- package/src/io/formats/design-tokens/plan/index.ts +6 -5
- package/src/io/formats/design-tokens/plan/styles.ts +37 -10
- package/src/io/formats/design-tokens/styles.ts +10 -7
- package/src/io/formats/design-tokens/sync/drift.ts +6 -4
- package/src/io/formats/design-tokens/values.ts +15 -8
- package/src/io/formats/drawio/warnings.ts +2 -2
- package/src/io/formats/fig/export/index.ts +36 -3
- package/src/io/formats/fig/export/patch/index.ts +4 -1
- package/src/io/formats/fig/export/setup.ts +25 -15
- package/src/io/formats/fig/export/variables.ts +17 -6
- package/src/io/formats/html/vectors.ts +1 -0
- package/src/io/formats/mermaid/layers.ts +2 -2
- package/src/io/formats/pdf/export.ts +1 -0
- package/src/io/formats/pdf/prepare.ts +6 -6
- package/src/io/formats/pen/index.ts +5 -2
- package/src/io/formats/raster/render.ts +12 -4
- package/src/io/formats/svg/defs.ts +26 -14
- package/src/io/formats/svg/effects.ts +2 -2
- package/src/io/formats/svg/export.ts +17 -3
- package/src/io/formats/svg/filter.ts +12 -2
- package/src/io/formats/svg/grain.ts +1 -1
- package/src/io/formats/svg/import.ts +6 -3
- package/src/io/formats/svg/text/export.ts +10 -8
- package/src/io/formats/svg/text/layout.ts +2 -2
- package/src/io/formats.ts +8 -1
- package/src/io/subgraph.ts +4 -1
- package/src/kiwi/fig/session/options.ts +4 -1
- package/src/layout/yoga-helpers.ts +8 -0
- package/src/layout.ts +47 -1
- package/src/lint/linter.ts +1 -1
- package/src/pairdraw-api/comments.ts +6 -0
- package/src/pairdraw-api/index.ts +7 -9
- package/src/rpc/read-commands.ts +4 -4
- package/src/rpc/variables-command.ts +2 -2
- package/src/text/font/provider.ts +26 -0
- package/src/text/font/{status.ts → readiness.ts} +13 -9
- package/src/text/index.ts +2 -1
- package/src/text/prepare.ts +9 -4
- package/src/tools/analyze/responsive/index.ts +8 -15
- package/src/tools/analyze/responsive/widths.ts +63 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/tokens.ts +4 -2
- package/src/tools/comments.ts +6 -4
- package/src/tools/component-catalog.ts +5 -3
- package/src/tools/create/html.ts +0 -3
- package/src/tools/create/icons.ts +1 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +2 -2
- package/src/tools/css/shorthand.ts +64 -0
- package/src/tools/describe/index.ts +2 -8
- package/src/tools/html-host.ts +5 -3
- package/src/tools/image-ai/apply.ts +0 -2
- package/src/tools/image-ai/service.ts +5 -3
- package/src/tools/index.ts +2 -0
- package/src/tools/modify/effects.ts +1 -1
- package/src/tools/modify/geometry.ts +16 -3
- package/src/tools/modify/layout.ts +47 -13
- package/src/tools/modify/matching.ts +14 -11
- package/src/tools/modify/paint.ts +85 -5
- package/src/tools/modify/reactions.ts +3 -2
- package/src/tools/modify/text.ts +15 -11
- package/src/tools/prompts/codegen.md +2 -1
- package/src/tools/read/css.ts +365 -0
- package/src/tools/read/reactions.ts +3 -2
- package/src/tools/read/space.ts +0 -2
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/core.ts +3 -2
- package/src/tools/schema.ts +14 -5
- package/src/tools/script/host.ts +6 -3
- package/src/tools/variables/collections.ts +1 -1
- package/src/tools/variables/values.ts +16 -5
- package/src/tools/vector/vectorize.ts +10 -4
- package/src/tools/video-host.ts +5 -3
- package/src/vector/vectorize/svg/gradients.ts +8 -5
- package/src/vector/vectorize/svg/to-vectors.ts +48 -14
- package/dist/text/font/status.d.ts +0 -28
- package/dist/text/font/status.d.ts.map +0 -1
- package/dist/text/font/status.js.map +0 -1
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import * as v from 'valibot'
|
|
2
2
|
|
|
3
|
+
import type { FigmaNodeProxy } from '#core/figma-api'
|
|
3
4
|
import { PairdrawAPI } from '#core/pairdraw-api'
|
|
5
|
+
import { lengthShorthandInput, parseLengthShorthand } from '#core/tools/css/shorthand'
|
|
4
6
|
import { toolNumber, nodeIdInputSchema, defineTool, nodeNotFound } from '#core/tools/schema'
|
|
5
7
|
|
|
8
|
+
type SpacingArgs = { padding?: number | string; gap?: number | string }
|
|
9
|
+
|
|
10
|
+
/** Parses the shorthand before the frame changes, so bad input leaves it as it was. */
|
|
11
|
+
function parseSpacing(
|
|
12
|
+
args: SpacingArgs
|
|
13
|
+
): { padding?: number[]; gap?: number[] } | { error: string } {
|
|
14
|
+
const parsed: { padding?: number[]; gap?: number[] } = {}
|
|
15
|
+
if (args.padding !== undefined) {
|
|
16
|
+
const padding = parseLengthShorthand(args.padding, 4, 'padding')
|
|
17
|
+
if ('error' in padding) return padding
|
|
18
|
+
parsed.padding = padding
|
|
19
|
+
}
|
|
20
|
+
if (args.gap !== undefined) {
|
|
21
|
+
const gap = parseLengthShorthand(args.gap, 2, 'gap')
|
|
22
|
+
if ('error' in gap) return gap
|
|
23
|
+
parsed.gap = gap
|
|
24
|
+
}
|
|
25
|
+
return parsed
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function writeSpacing(node: FigmaNodeProxy, spacing: { padding?: number[]; gap?: number[] }): void {
|
|
29
|
+
if (spacing.padding) {
|
|
30
|
+
const [top, right, bottom, left] = spacing.padding
|
|
31
|
+
node.paddingTop = top
|
|
32
|
+
node.paddingRight = right
|
|
33
|
+
node.paddingBottom = bottom
|
|
34
|
+
node.paddingLeft = left
|
|
35
|
+
}
|
|
36
|
+
if (spacing.gap) {
|
|
37
|
+
node.itemSpacing = spacing.gap[0]
|
|
38
|
+
node.counterAxisSpacing = spacing.gap[1]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
6
42
|
export const setLayout = defineTool({
|
|
7
43
|
name: 'set_layout',
|
|
8
44
|
|
|
9
|
-
description:
|
|
45
|
+
description:
|
|
46
|
+
'Set auto-layout (flexbox) on a frame. Direction, alignment, spacing, padding, which also take CSS shorthand: padding="16px 24px", gap="12px 4px".',
|
|
10
47
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
11
48
|
input: v.strictObject({
|
|
12
49
|
id: v.pipe(v.string(), v.description('Frame node ID')),
|
|
@@ -26,14 +63,13 @@ export const setLayout = defineTool({
|
|
|
26
63
|
)
|
|
27
64
|
),
|
|
28
65
|
padding: v.optional(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
v.number(),
|
|
32
|
-
v.minValue(0),
|
|
33
|
-
v.description('Equal padding on all sides (only changes if provided)')
|
|
34
|
-
)
|
|
66
|
+
lengthShorthandInput(
|
|
67
|
+
'Padding: one length for every side, or CSS shorthand "16px 24px" / "8px 16px 4px 24px"'
|
|
35
68
|
)
|
|
36
69
|
),
|
|
70
|
+
gap: v.optional(
|
|
71
|
+
lengthShorthandInput('Gap: one length, or "12px 4px" for main-axis and cross-axis spacing')
|
|
72
|
+
),
|
|
37
73
|
padding_horizontal: v.optional(
|
|
38
74
|
toolNumber(v.pipe(v.number(), v.minValue(0), v.description('Horizontal padding')))
|
|
39
75
|
),
|
|
@@ -62,6 +98,9 @@ export const setLayout = defineTool({
|
|
|
62
98
|
)
|
|
63
99
|
}),
|
|
64
100
|
execute: (figma, args) => {
|
|
101
|
+
const spacing = parseSpacing(args)
|
|
102
|
+
if ('error' in spacing) return spacing
|
|
103
|
+
|
|
65
104
|
const node = figma.getNodeById(args.id)
|
|
66
105
|
if (!node) return nodeNotFound(args.id)
|
|
67
106
|
|
|
@@ -89,12 +128,7 @@ export const setLayout = defineTool({
|
|
|
89
128
|
if (args.flow_direction !== undefined)
|
|
90
129
|
new PairdrawAPI(figma).setLayoutDirection(node, args.flow_direction)
|
|
91
130
|
|
|
92
|
-
|
|
93
|
-
node.paddingTop = args.padding
|
|
94
|
-
node.paddingRight = args.padding
|
|
95
|
-
node.paddingBottom = args.padding
|
|
96
|
-
node.paddingLeft = args.padding
|
|
97
|
-
}
|
|
131
|
+
writeSpacing(node, spacing)
|
|
98
132
|
if (args.padding_horizontal !== undefined) {
|
|
99
133
|
node.paddingLeft = args.padding_horizontal
|
|
100
134
|
node.paddingRight = args.padding_horizontal
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mapValues, pick } from 'es-toolkit'
|
|
2
2
|
import * as v from 'valibot'
|
|
3
3
|
|
|
4
|
-
import type { Fill, NodeType, SceneNode } from '@pairdraw/scene-graph'
|
|
4
|
+
import type { DocumentColorSpace, Fill, NodeType, SceneNode } from '@pairdraw/scene-graph'
|
|
5
5
|
import { copyStroke } from '@pairdraw/scene-graph/copy'
|
|
6
6
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
7
7
|
|
|
@@ -84,8 +84,8 @@ function channels(color: Color): string {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/** A colour as a tool reads it, so a bad value fails with the message other tools give. */
|
|
87
|
-
function colorOf(value: string): Color {
|
|
88
|
-
const parsed = parseToolColor(value)
|
|
87
|
+
function colorOf(value: string, profile: DocumentColorSpace): Color {
|
|
88
|
+
const parsed = parseToolColor(value, profile)
|
|
89
89
|
if ('error' in parsed) throw new Error(parsed.error)
|
|
90
90
|
return parsed
|
|
91
91
|
}
|
|
@@ -96,9 +96,9 @@ interface ColorSwap {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/** The swap a colour pair makes; throws on a value that is not a colour. */
|
|
99
|
-
function colorSwap(pair: ColorPair): ColorSwap {
|
|
100
|
-
const from = colorOf(pair.from)
|
|
101
|
-
const to = colorOf(pair.to)
|
|
99
|
+
function colorSwap(pair: ColorPair, profile: DocumentColorSpace): ColorSwap {
|
|
100
|
+
const from = colorOf(pair.from, profile)
|
|
101
|
+
const to = colorOf(pair.to, profile)
|
|
102
102
|
const key = channels(from)
|
|
103
103
|
const percent = (value: number) => Math.round(value * 100)
|
|
104
104
|
return {
|
|
@@ -206,8 +206,11 @@ function textEdits(node: SceneNode, replacements: Replacements): TextEdit[] {
|
|
|
206
206
|
|
|
207
207
|
const REPLACEMENT_KINDS = Object.keys(replacementInputs) as ReplacementKind[]
|
|
208
208
|
|
|
209
|
-
function colorSwaps(
|
|
210
|
-
|
|
209
|
+
function colorSwaps(
|
|
210
|
+
pairs: readonly ColorPair[] | undefined,
|
|
211
|
+
profile: DocumentColorSpace
|
|
212
|
+
): ColorSwap[] {
|
|
213
|
+
return (pairs ?? []).map((pair) => colorSwap(pair, profile))
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
export const replaceMatchingProperties = defineTool({
|
|
@@ -253,9 +256,9 @@ export const replaceMatchingProperties = defineTool({
|
|
|
253
256
|
const readOnly: string[] = []
|
|
254
257
|
try {
|
|
255
258
|
const swaps = {
|
|
256
|
-
fill: colorSwaps(args.fill_color),
|
|
257
|
-
text: colorSwaps(args.text_color),
|
|
258
|
-
stroke: colorSwaps(args.stroke_color)
|
|
259
|
+
fill: colorSwaps(args.fill_color, figma.graph.documentColorSpace),
|
|
260
|
+
text: colorSwaps(args.text_color, figma.graph.documentColorSpace),
|
|
261
|
+
stroke: colorSwaps(args.stroke_color, figma.graph.documentColorSpace)
|
|
259
262
|
}
|
|
260
263
|
for (const node of nodes) {
|
|
261
264
|
const paint = paintAndGeometryChanges(node, args, swaps)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { isValid, toUint8Array } from 'js-base64'
|
|
2
2
|
import * as v from 'valibot'
|
|
3
3
|
|
|
4
|
+
import type { Variable, VariableCollection, VariableValue } from '@pairdraw/scene-graph'
|
|
4
5
|
import { gradientTransformRows, linearGradientTransform } from '@pairdraw/scene-graph/gradient'
|
|
5
|
-
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
|
+
import type { Color, Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
7
|
|
|
8
|
+
import type { FigmaAPI } from '#core/figma-api'
|
|
7
9
|
import { storeImage } from '#core/figma-api/images'
|
|
10
|
+
import { PairdrawAPI } from '#core/pairdraw-api'
|
|
8
11
|
import {
|
|
9
12
|
defineTool,
|
|
10
13
|
nodeIdInputSchema,
|
|
@@ -22,11 +25,43 @@ const STRETCH_IMAGE_TRANSFORM: [[number, number, number], [number, number, numbe
|
|
|
22
25
|
[0, 1, 0]
|
|
23
26
|
]
|
|
24
27
|
|
|
28
|
+
/**
|
|
29
|
+
* `var(--color/brand)` or `var(--color/brand, #4F46E5)`: a token by name, as `get_css` writes it.
|
|
30
|
+
* The fallback runs to the last `)`, since a Display P3 document writes one as `color(display-p3 …)`.
|
|
31
|
+
*/
|
|
32
|
+
const COLOR_TOKEN = /^var\(\s*--([^,()]+?)\s*(?:,(.*))?\)$/
|
|
33
|
+
|
|
34
|
+
function colorVariablesNamed(figma: FigmaAPI, name: string): Variable[] {
|
|
35
|
+
const matches: Variable[] = []
|
|
36
|
+
for (const variable of figma.graph.variables.values()) {
|
|
37
|
+
if (variable.type === 'COLOR' && variable.name === name) matches.push(variable)
|
|
38
|
+
}
|
|
39
|
+
return matches
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A colour, as opposed to a token alias or an expression a variable may hold instead. */
|
|
43
|
+
function isColor(value: VariableValue | undefined): value is Color {
|
|
44
|
+
return typeof value === 'object' && 'r' in value && 'g' in value && 'b' in value && 'a' in value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The colour a token holds in its default mode, and its collection, for a fill to take. */
|
|
48
|
+
function tokenColor(
|
|
49
|
+
figma: FigmaAPI,
|
|
50
|
+
variable: Variable
|
|
51
|
+
): { color: Color; collection: VariableCollection | undefined } | { error: string } {
|
|
52
|
+
const collection = figma.graph.variableCollections.get(variable.collectionId)
|
|
53
|
+
const value = collection
|
|
54
|
+
? variable.valuesByMode[collection.defaultModeId]
|
|
55
|
+
: Object.values(variable.valuesByMode)[0]
|
|
56
|
+
if (!isColor(value)) return { error: `Variable "${variable.name}" holds no colour` }
|
|
57
|
+
return { color: value, collection }
|
|
58
|
+
}
|
|
59
|
+
|
|
25
60
|
export const setFill = defineTool({
|
|
26
61
|
name: 'set_fill',
|
|
27
62
|
|
|
28
63
|
description:
|
|
29
|
-
'Set fill on a node. Solid: color="#ff0000". Linear gradient: gradient="top-bottom" or "left-right" with color (start) and color_end (end).',
|
|
64
|
+
'Set fill on a node. Solid: color="#ff0000". A token by name: color="var(--color/brand)" paints its colour and binds the fill. Linear gradient: gradient="top-bottom" or "left-right" with color (start) and color_end (end); gradient stops take hex colours, not tokens.',
|
|
30
65
|
execution: { kind: 'sync', mutation: 'properties' },
|
|
31
66
|
input: v.strictObject({
|
|
32
67
|
id: nodeIdInputSchema,
|
|
@@ -45,11 +80,56 @@ export const setFill = defineTool({
|
|
|
45
80
|
const node = figma.getNodeById(id)
|
|
46
81
|
if (!node) return { error: `Node "${id}" not found` }
|
|
47
82
|
|
|
48
|
-
|
|
83
|
+
// A token name paints the colour it holds and binds the fill, so the layer follows the token.
|
|
84
|
+
const token = COLOR_TOKEN.exec(color)
|
|
85
|
+
const endToken = color_end === undefined ? null : COLOR_TOKEN.exec(color_end)
|
|
86
|
+
// Gradient stops carry no variable binding, so a token there would paint the wrong thing.
|
|
87
|
+
if (gradient && (token !== null || endToken !== null)) {
|
|
88
|
+
const named = [
|
|
89
|
+
token === null ? undefined : `"${token[1]}"`,
|
|
90
|
+
endToken === null ? undefined : `"${endToken[1]}"`
|
|
91
|
+
]
|
|
92
|
+
.filter((entry) => entry !== undefined)
|
|
93
|
+
.join(' and ')
|
|
94
|
+
return {
|
|
95
|
+
error: `A gradient cannot take the token ${named}: gradient stops have no variable binding. Pass hex colours for a gradient, or a token only for a solid fill.`
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const name = token === null ? null : token[1]
|
|
99
|
+
if (name !== null) {
|
|
100
|
+
const matches = colorVariablesNamed(figma, name)
|
|
101
|
+
if (matches.length === 0) {
|
|
102
|
+
return {
|
|
103
|
+
error: `No COLOR variable named "${name}". Call find_variables to list the document's tokens.`
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (matches.length > 1) {
|
|
107
|
+
const where = matches
|
|
108
|
+
.map(
|
|
109
|
+
(variable) =>
|
|
110
|
+
figma.graph.variableCollections.get(variable.collectionId)?.name ??
|
|
111
|
+
variable.collectionId
|
|
112
|
+
)
|
|
113
|
+
.join(', ')
|
|
114
|
+
return {
|
|
115
|
+
error: `${matches.length} variables named "${name}" (${where}); bind one with bind_variable.`
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const variable of matches) {
|
|
119
|
+
const resolved = tokenColor(figma, variable)
|
|
120
|
+
if ('error' in resolved) return resolved
|
|
121
|
+
node.fills = [{ type: 'SOLID', color: resolved.color }]
|
|
122
|
+
new PairdrawAPI(figma).bindVariable(node.id, 'fills/0/color', variable)
|
|
123
|
+
return { id, color: resolved.color, bound: name }
|
|
124
|
+
}
|
|
125
|
+
return { error: `No COLOR variable named "${name}"` }
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const c = parseToolColor(color, figma.graph.documentColorSpace)
|
|
49
129
|
if ('error' in c) return c
|
|
50
130
|
|
|
51
131
|
if (gradient && color_end) {
|
|
52
|
-
const cEnd = parseToolColor(color_end)
|
|
132
|
+
const cEnd = parseToolColor(color_end, figma.graph.documentColorSpace)
|
|
53
133
|
if ('error' in cEnd) return cEnd
|
|
54
134
|
// Edge middles of the layer's unit square that each direction runs between.
|
|
55
135
|
const ends: Record<string, [Vector, Vector]> = {
|
|
@@ -111,7 +191,7 @@ export const setStroke = defineTool({
|
|
|
111
191
|
const node = figma.getNodeById(id)
|
|
112
192
|
if (!node) return { error: `Node "${id}" not found` }
|
|
113
193
|
|
|
114
|
-
const c = parseToolColor(color)
|
|
194
|
+
const c = parseToolColor(color, figma.graph.documentColorSpace)
|
|
115
195
|
if ('error' in c) return c
|
|
116
196
|
node.strokes = [{ type: 'SOLID', color: c }]
|
|
117
197
|
node.strokeWeight = weight
|
|
@@ -15,8 +15,9 @@ const reactionsInputSchema = v.pipe(
|
|
|
15
15
|
"'EASE_IN' | 'EASE_IN_AND_OUT' | 'LINEAR' } }, overlayRelativePosition?: 'CENTER' | ... } | " +
|
|
16
16
|
"{ type: 'BACK' } | { type: 'CLOSE' }] }]. NAVIGATE and OVERLAY point at a top-level frame " +
|
|
17
17
|
'on the same page; CHANGE_TO at another variant of the set the layer is a variant of, an ' +
|
|
18
|
-
'instance of, or inside (set it once on the main component variant and every instance ' +
|
|
19
|
-
|
|
18
|
+
'instance of, or inside (set it once on the main component variant and every instance gets ' +
|
|
19
|
+
'it), named by destinationId or by variantProperties such as { State: "Hover" }; SCROLL_TO ' +
|
|
20
|
+
"at a layer in the layer's top-level frame. ON_HOVER and ON_PRESS undo " +
|
|
20
21
|
'their action when the pointer leaves or lifts. SMART_ANIMATE moves the layers two frames or ' +
|
|
21
22
|
'variants share by name and place, and fades the rest; easing defaults to EASE_OUT.'
|
|
22
23
|
)
|
package/src/tools/modify/text.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from 'valibot'
|
|
2
2
|
|
|
3
|
+
import type { DocumentColorSpace } from '@pairdraw/scene-graph'
|
|
3
4
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
4
5
|
|
|
5
6
|
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'
|
|
@@ -223,15 +224,18 @@ function badVariationTag(variations: FigmaVariationSettings | undefined): { erro
|
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
/** What a range edit sets, or why it cannot run: nothing named, a bad colour, or a bad link. */
|
|
226
|
-
function rangeEdit(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
function rangeEdit(
|
|
228
|
+
args: {
|
|
229
|
+
family?: string
|
|
230
|
+
size?: number
|
|
231
|
+
style?: string
|
|
232
|
+
variations?: unknown
|
|
233
|
+
font_features?: Record<string, boolean>
|
|
234
|
+
color?: string
|
|
235
|
+
hyperlink?: string | null
|
|
236
|
+
},
|
|
237
|
+
profile: DocumentColorSpace
|
|
238
|
+
): RangeEdit | { error: string } {
|
|
235
239
|
if (
|
|
236
240
|
!args.family &&
|
|
237
241
|
!args.size &&
|
|
@@ -248,7 +252,7 @@ function rangeEdit(args: {
|
|
|
248
252
|
}
|
|
249
253
|
const hyperlink = requestedHyperlink(args.hyperlink)
|
|
250
254
|
if (hyperlink && 'error' in hyperlink) return hyperlink
|
|
251
|
-
const color = parseOptionalToolColor(args.color)
|
|
255
|
+
const color = parseOptionalToolColor(args.color, profile)
|
|
252
256
|
if ('error' in color) return color
|
|
253
257
|
return { hyperlink: hyperlink ?? null, color: color.color }
|
|
254
258
|
}
|
|
@@ -287,7 +291,7 @@ export const setFontRange = defineTool({
|
|
|
287
291
|
if (badTag) return badTag
|
|
288
292
|
const badFeature = badFeatureEntry(args.font_features)
|
|
289
293
|
if (badFeature) return badFeature
|
|
290
|
-
const edit = rangeEdit(args)
|
|
294
|
+
const edit = rangeEdit(args, figma.graph.documentColorSpace)
|
|
291
295
|
if ('error' in edit) return edit
|
|
292
296
|
const { hyperlink, color } = edit
|
|
293
297
|
// The range methods reject an empty range or one past the text, before changing anything.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
You convert Figma designs into production frontend code. You have full access to the design document through tools. Never guess — always read the actual design data.
|
|
4
4
|
|
|
5
|
-
> Note: Auto-layout and visual property names match the JSX props in the render system.
|
|
5
|
+
> Note: Auto-layout and visual property names match the JSX props in the render system. Read geometry and style with `get_css` (CSS-like lines, colours as tokens), roles and design issues with `describe`, and structure with `get_jsx`.
|
|
6
6
|
|
|
7
7
|
## Workflow
|
|
8
8
|
|
|
@@ -34,6 +34,7 @@ Identify the component architecture.
|
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
analyze_clusters → find repeated visual patterns that should be components
|
|
37
|
+
get_css (per node) → CSS shape: flex, gap, padding, size constraints, token colours, text
|
|
37
38
|
describe (per node) → semantic role, layout direction, visual properties, issues
|
|
38
39
|
get_jsx (per node) → structural JSX to understand nesting and layout
|
|
39
40
|
```
|