@pairdraw/core 0.20.0 → 0.21.1
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/compile.d.ts +3 -1
- package/dist/canvas/shaders/compile.d.ts.map +1 -1
- package/dist/canvas/shaders/compile.js +12 -3
- package/dist/canvas/shaders/compile.js.map +1 -1
- package/dist/canvas/shaders/draw.d.ts.map +1 -1
- package/dist/canvas/shaders/draw.js +10 -3
- package/dist/canvas/shaders/draw.js.map +1 -1
- package/dist/canvas/shaders/effect.d.ts.map +1 -1
- package/dist/canvas/shaders/effect.js +8 -17
- 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/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/export.js +2 -2
- package/dist/editor/clipboard/export.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/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.d.ts +17 -2
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -1
- package/dist/io/formats/drawio/warnings.js +15 -8
- 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/index.d.ts +1 -0
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +5 -3
- package/dist/io/formats/html/index.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.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +13 -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 +11 -4
- package/dist/io/formats.js.map +1 -1
- package/dist/io/index.d.ts +2 -2
- 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 +12 -3
- package/dist/io/types.d.ts.map +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/compile.ts +14 -3
- package/src/canvas/shaders/draw.ts +11 -4
- package/src/canvas/shaders/effect.ts +8 -19
- 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/export.ts +2 -2
- 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 +28 -9
- 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/index.ts +9 -3
- 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 +15 -4
- 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 +18 -5
- package/src/io/index.ts +1 -0
- package/src/io/subgraph.ts +4 -1
- package/src/io/types.ts +10 -0
- 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,3 +1,4 @@
|
|
|
1
|
+
import type { ColorProfile } from '@pairdraw/scene-graph'
|
|
1
2
|
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
2
3
|
|
|
3
4
|
import { formatColor, type SVGExportContext } from './defs'
|
|
@@ -7,8 +8,12 @@ import { svg, type SVGNode } from './node'
|
|
|
7
8
|
* A flood's colour, opaque: its alpha goes in `flood-opacity`, which a Display P3 colour would
|
|
8
9
|
* otherwise carry a second time.
|
|
9
10
|
*/
|
|
10
|
-
export function floodColor(
|
|
11
|
-
|
|
11
|
+
export function floodColor(
|
|
12
|
+
color: Color,
|
|
13
|
+
colorSpace: SVGExportContext['colorSpace'],
|
|
14
|
+
documentColorSpace: ColorProfile = 'srgb'
|
|
15
|
+
): string {
|
|
16
|
+
return formatColor({ ...color, a: 1 }, 1, colorSpace, documentColorSpace)
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
/** An SVG filter's primitives as they are added, each naming its result uniquely. */
|
|
@@ -35,6 +40,11 @@ export class FilterBuilder {
|
|
|
35
40
|
return this.ctx.colorSpace
|
|
36
41
|
}
|
|
37
42
|
|
|
43
|
+
/** The document's profile, where its stored colors are. */
|
|
44
|
+
get documentColorSpace(): ColorProfile {
|
|
45
|
+
return this.ctx.documentColorSpace
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
/** A new result name, unique in this filter. */
|
|
39
49
|
result(name: string): string {
|
|
40
50
|
this.count += 1
|
|
@@ -95,7 +95,7 @@ export function noiseFilter(filter: FilterBuilder, effect: NoiseEffect, input: s
|
|
|
95
95
|
filter.push('feComposite', { in: band, in2: input, operator: 'in', result: clipped })
|
|
96
96
|
const flood = filter.result('noiseFlood')
|
|
97
97
|
filter.push('feFlood', {
|
|
98
|
-
'flood-color': floodColor(color, filter.colorSpace),
|
|
98
|
+
'flood-color': floodColor(color, filter.colorSpace, filter.documentColorSpace),
|
|
99
99
|
'flood-opacity': round(color.a),
|
|
100
100
|
result: flood
|
|
101
101
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { groupBy } from 'es-toolkit/array'
|
|
2
2
|
|
|
3
|
-
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
3
|
+
import type { DocumentColorSpace, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
import { WHITE } from '@pairdraw/scene-graph/constants'
|
|
5
5
|
import { fitEnclosingGroups } from '@pairdraw/scene-graph/group-bounds'
|
|
6
6
|
import type { Size } from '@pairdraw/scene-graph/primitives'
|
|
@@ -31,6 +31,8 @@ export type SVGImportData = SVGVectorizeResult &
|
|
|
31
31
|
export interface SVGImportOptions {
|
|
32
32
|
name?: string
|
|
33
33
|
defaultColor?: string
|
|
34
|
+
/** The profile a color that names its own space is read into. */
|
|
35
|
+
profile?: DocumentColorSpace
|
|
34
36
|
x?: number
|
|
35
37
|
y?: number
|
|
36
38
|
/** Keep the frame of an SVG that draws nothing, as `figma.createNodeFromSvg` does. */
|
|
@@ -40,7 +42,7 @@ export interface SVGImportOptions {
|
|
|
40
42
|
/** The layers SVG markup draws, or null when it does not parse as SVG. */
|
|
41
43
|
export function prepareSVGImport(
|
|
42
44
|
source: string,
|
|
43
|
-
options: Pick<SVGImportOptions, 'defaultColor'> = {}
|
|
45
|
+
options: Pick<SVGImportOptions, 'defaultColor' | 'profile'> = {}
|
|
44
46
|
): SVGImportData | null {
|
|
45
47
|
if (!parseSVGDocument(source)) return null
|
|
46
48
|
const sized = parseSVGSize(source, { width: 0, height: 0 }).width > 0
|
|
@@ -50,7 +52,8 @@ export function prepareSVGImport(
|
|
|
50
52
|
{ width, height },
|
|
51
53
|
{
|
|
52
54
|
defaultColor: options.defaultColor,
|
|
53
|
-
preserveAspectRatio: true
|
|
55
|
+
preserveAspectRatio: true,
|
|
56
|
+
profile: options.profile
|
|
54
57
|
}
|
|
55
58
|
) ?? { paths: [], texts: [], contentBounds: { x: 0, y: 0, width: 0, height: 0 } }
|
|
56
59
|
return { width, height, name: svgRootId(source), sized, ...vectorized }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CharacterStyleOverride, SceneNode } from '@pairdraw/scene-graph'
|
|
1
|
+
import type { CharacterStyleOverride, ColorProfile, SceneNode } from '@pairdraw/scene-graph'
|
|
2
2
|
import { parseFontStyle } from '@pairdraw/scene-graph/font-style'
|
|
3
3
|
import { textLengthPixels } from '@pairdraw/scene-graph/text'
|
|
4
4
|
import { resolveNodeTextDirection } from '@pairdraw/scene-graph/text/direction'
|
|
@@ -26,6 +26,7 @@ import { textFontFace } from '#core/text/requirements/collect'
|
|
|
26
26
|
function styleOverrideToTspanAttrs(
|
|
27
27
|
style: CharacterStyleOverride,
|
|
28
28
|
colorSpace: 'srgb' | 'display-p3',
|
|
29
|
+
documentSpace: ColorProfile,
|
|
29
30
|
parentFillOpacity: number | undefined,
|
|
30
31
|
node: Pick<SceneNode, 'fontSize' | 'letterSpacing'>
|
|
31
32
|
): Record<string, string | number | undefined> {
|
|
@@ -54,9 +55,9 @@ function styleOverrideToTspanAttrs(
|
|
|
54
55
|
// Paragraphs and saved glyphs draw a run at color.a * opacity. Shapes paint opacity alone.
|
|
55
56
|
const alpha = round(visibleFill.color.a * visibleFill.opacity)
|
|
56
57
|
if (colorSpace === 'display-p3') {
|
|
57
|
-
attrs.fill = formatColor({ ...visibleFill.color, a: 1 }, alpha, colorSpace)
|
|
58
|
+
attrs.fill = formatColor({ ...visibleFill.color, a: 1 }, alpha, colorSpace, documentSpace)
|
|
58
59
|
} else {
|
|
59
|
-
attrs.fill = formatColor(visibleFill.color, 1, colorSpace)
|
|
60
|
+
attrs.fill = formatColor(visibleFill.color, 1, colorSpace, documentSpace)
|
|
60
61
|
if (alpha < 1) attrs['fill-opacity'] = alpha
|
|
61
62
|
}
|
|
62
63
|
// `fill-opacity` inherits, so an opaque run has to cover a translucent parent.
|
|
@@ -105,12 +106,13 @@ function spanFontAttrs(
|
|
|
105
106
|
*/
|
|
106
107
|
function textStrokeAttrs(
|
|
107
108
|
node: SceneNode,
|
|
108
|
-
colorSpace: 'srgb' | 'display-p3'
|
|
109
|
+
colorSpace: 'srgb' | 'display-p3',
|
|
110
|
+
documentSpace: ColorProfile = 'srgb'
|
|
109
111
|
): Record<string, string | number | undefined> {
|
|
110
112
|
const stroke = node.strokes.find((candidate) => candidate.visible)
|
|
111
113
|
if (!stroke) return {}
|
|
112
114
|
const attrs: Record<string, string | number | undefined> = {
|
|
113
|
-
stroke: formatSolidColor(stroke.color, 1, colorSpace),
|
|
115
|
+
stroke: formatSolidColor(stroke.color, 1, colorSpace, documentSpace),
|
|
114
116
|
'stroke-width': round(stroke.weight * (stroke.align === 'OUTSIDE' ? 2 : 1))
|
|
115
117
|
}
|
|
116
118
|
if (stroke.opacity < 1) attrs['stroke-opacity'] = round(stroke.opacity)
|
|
@@ -202,7 +204,7 @@ export function renderTextNode(
|
|
|
202
204
|
ctx: SVGExportContext,
|
|
203
205
|
fillOpacity?: number
|
|
204
206
|
): SVGNode {
|
|
205
|
-
const { colorSpace, textLayout, fontAlias } = ctx
|
|
207
|
+
const { colorSpace, documentColorSpace: documentSpace, textLayout, fontAlias } = ctx
|
|
206
208
|
const direction = resolveNodeTextDirection(node)
|
|
207
209
|
const lines = textLayout ? textLayout(node) : null
|
|
208
210
|
const laidOut = lines && lines.length > 0 ? lines : null
|
|
@@ -224,11 +226,11 @@ export function renderTextNode(
|
|
|
224
226
|
'text-anchor': laidOut ? undefined : textAnchorForNode(node, direction),
|
|
225
227
|
'text-decoration': textDecoration,
|
|
226
228
|
'letter-spacing': letterSpacing ? round(letterSpacing) : undefined,
|
|
227
|
-
...textStrokeAttrs(node, colorSpace),
|
|
229
|
+
...textStrokeAttrs(node, colorSpace, documentSpace),
|
|
228
230
|
...(fontAlias ? aliasedFontAttrs(fontRequest(node), fontAlias) : {})
|
|
229
231
|
}
|
|
230
232
|
const spanAttrs = (style: CharacterStyleOverride, fallback?: SVGFallbackFace) => ({
|
|
231
|
-
...styleOverrideToTspanAttrs(style, colorSpace, fillOpacity, node),
|
|
233
|
+
...styleOverrideToTspanAttrs(style, colorSpace, documentSpace, fillOpacity, node),
|
|
232
234
|
...spanFontAttrs(node, style, fallback, fontAlias)
|
|
233
235
|
})
|
|
234
236
|
|
|
@@ -6,7 +6,7 @@ import type { SkiaRenderer } from '#core/canvas/renderer'
|
|
|
6
6
|
import { withPDFTextLayout } from '#core/io/formats/pdf/prepare'
|
|
7
7
|
import { bakeAdjustedImages, hasAdjustedImagePaints } from '#core/io/formats/raster/adjusted-images'
|
|
8
8
|
import { renderNodesToSVG, type SVGExportOptions } from '#core/io/formats/svg/export'
|
|
9
|
-
import {
|
|
9
|
+
import { resolveFontReadiness } from '#core/text/prepare'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Layers as SVG with their text set as the canvas sets it: the fonts it draws with loaded, each
|
|
@@ -22,7 +22,7 @@ export async function renderNodesToLaidOutSVG(
|
|
|
22
22
|
canvasKit?: CanvasKit,
|
|
23
23
|
renderer?: SkiaRenderer
|
|
24
24
|
): Promise<string | null> {
|
|
25
|
-
await
|
|
25
|
+
await resolveFontReadiness(graph, nodeIds)
|
|
26
26
|
const baked = hasAdjustedImagePaints(graph, nodeIds)
|
|
27
27
|
? await bakeAdjustedImages(graph, nodeIds, canvasKit, renderer)
|
|
28
28
|
: graph
|
package/src/io/formats.ts
CHANGED
|
@@ -314,14 +314,20 @@ export const mermaidFormat: IOFormatAdapter<'mermaid'> = {
|
|
|
314
314
|
async function writeDrawIO(graph: SceneGraph, target: DrawIOExportTarget): Promise<ExportResult> {
|
|
315
315
|
const { writeDrawIOFile } = await import('@pairdraw/drawio')
|
|
316
316
|
const { sceneGraphToDrawIO } = await import('./formats/drawio')
|
|
317
|
-
const {
|
|
318
|
-
|
|
317
|
+
const { drawioWriteWarnings, drawioWriteWarningText } = await import('./formats/drawio/warnings')
|
|
318
|
+
const warningDetails = drawioWriteWarnings(graph)
|
|
319
|
+
const written: ExportResult = {
|
|
319
320
|
format: 'drawio',
|
|
320
321
|
mimeType: 'application/vnd.jgraph.mxfile',
|
|
321
322
|
extension: 'drawio',
|
|
322
323
|
data: writeDrawIOFile(sceneGraphToDrawIO(graph, target)),
|
|
323
|
-
encoding: 'utf8'
|
|
324
|
-
|
|
324
|
+
encoding: 'utf8'
|
|
325
|
+
}
|
|
326
|
+
if (warningDetails.length === 0) return written
|
|
327
|
+
return {
|
|
328
|
+
...written,
|
|
329
|
+
warnings: warningDetails.map(drawioWriteWarningText),
|
|
330
|
+
warningDetails
|
|
325
331
|
}
|
|
326
332
|
}
|
|
327
333
|
|
|
@@ -351,7 +357,14 @@ export const svgFormat: IOFormatAdapter<'svg'> = {
|
|
|
351
357
|
request.graph,
|
|
352
358
|
target.pageId,
|
|
353
359
|
target.nodeIds,
|
|
354
|
-
{
|
|
360
|
+
{
|
|
361
|
+
...options,
|
|
362
|
+
// An export writes the profile the document is stored in, so a Display P3 color keeps its
|
|
363
|
+
// gamut; a caller may still ask for sRGB. PDF and thumbnails render SVG themselves and
|
|
364
|
+
// stay sRGB, as their formats expect.
|
|
365
|
+
colorSpace: options?.colorSpace ?? request.graph.documentColorSpace,
|
|
366
|
+
booleanPath
|
|
367
|
+
},
|
|
355
368
|
context?.canvasKit,
|
|
356
369
|
context?.renderer
|
|
357
370
|
)
|
package/src/io/index.ts
CHANGED
package/src/io/subgraph.ts
CHANGED
|
@@ -138,7 +138,10 @@ function copyReferencedTables(source: SceneGraph, graph: SceneGraph): void {
|
|
|
138
138
|
variableIds: []
|
|
139
139
|
})
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
// A collection lists its live variables; a deleted one is copied out of the list (addVariable).
|
|
142
|
+
if (!variable.deleted) {
|
|
143
|
+
graph.variableCollections.get(collection.id)?.variableIds.push(variableId)
|
|
144
|
+
}
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
|
package/src/io/types.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { CanvasKit } from 'canvaskit-wasm'
|
|
2
2
|
|
|
3
3
|
import type { TailwindStylesheetLoader } from '@pairdraw/dom-css/export'
|
|
4
|
+
import type { PenWriteWarning } from '@pairdraw/pen'
|
|
4
5
|
import type { SceneGraph } from '@pairdraw/scene-graph'
|
|
5
6
|
import type { RenderColorSpace } from '@pairdraw/scene-graph/color'
|
|
6
7
|
|
|
7
8
|
import type { SkiaRenderer } from '#core/canvas'
|
|
8
9
|
import type { IconProvider } from '#core/icons'
|
|
9
10
|
|
|
11
|
+
import type { DrawioWriteWarning } from './formats/drawio/warnings'
|
|
10
12
|
import type { RasterExportFormat } from './formats/raster'
|
|
11
13
|
|
|
12
14
|
export type IOFormatRole = 'native-document' | 'interchange-document' | 'derived-export'
|
|
@@ -154,8 +156,16 @@ export interface ExportResult {
|
|
|
154
156
|
assets?: ExportAsset[]
|
|
155
157
|
/** What the format could not hold, such as the variables draw.io has no model for. */
|
|
156
158
|
warnings?: string[]
|
|
159
|
+
/** The same facts as kinds, for a host that shows them in its own language. */
|
|
160
|
+
warningDetails?: WriteDocumentWarning[]
|
|
157
161
|
}
|
|
158
162
|
|
|
163
|
+
/**
|
|
164
|
+
* What a writer could not put in its file, as facts: the pen and draw.io writers name their own
|
|
165
|
+
* kinds, and a host translates them instead of printing the English `warnings` sentences.
|
|
166
|
+
*/
|
|
167
|
+
export type WriteDocumentWarning = PenWriteWarning | DrawioWriteWarning
|
|
168
|
+
|
|
159
169
|
export interface HTMLExportOptions {
|
|
160
170
|
html?: 'fragment' | 'standalone'
|
|
161
171
|
style?: 'inline' | 'tailwind'
|
|
@@ -13,6 +13,7 @@ export type FigReaderDiagnostic =
|
|
|
13
13
|
}
|
|
14
14
|
| { kind: 'component'; diagnostic: Parameters<Handler<'onMissingComponent'>>[0] }
|
|
15
15
|
| { kind: 'slot-content'; diagnostic: Parameters<Handler<'onMissingSlotContent'>>[0] }
|
|
16
|
+
| { kind: 'variable-type'; diagnostic: Parameters<Handler<'onUnsupportedVariableType'>>[0] }
|
|
16
17
|
|
|
17
18
|
/** Each sink's entries, so a record reported again is not listed twice. */
|
|
18
19
|
const reported = new WeakMap<FigReaderDiagnostic[], Set<string>>()
|
|
@@ -50,6 +51,8 @@ export function readerSessionOptions(sink: FigReaderDiagnostic[]): DocumentAssem
|
|
|
50
51
|
onUnsupportedVariableExpression: (diagnostic) =>
|
|
51
52
|
report(sink, { kind: 'variable-expression', diagnostic }),
|
|
52
53
|
onMissingComponent: (diagnostic) => report(sink, { kind: 'component', diagnostic }),
|
|
53
|
-
onMissingSlotContent: (diagnostic) => report(sink, { kind: 'slot-content', diagnostic })
|
|
54
|
+
onMissingSlotContent: (diagnostic) => report(sink, { kind: 'slot-content', diagnostic }),
|
|
55
|
+
onUnsupportedVariableType: (resource) =>
|
|
56
|
+
report(sink, { kind: 'variable-type', diagnostic: resource })
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -25,8 +25,16 @@ export function liveYogaNodeCount(): number {
|
|
|
25
25
|
return liveYogaNodes
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** Yoga nodes created since the process started, which tests read to see a pass build what it places. */
|
|
29
|
+
let yogaNodeCreations = 0
|
|
30
|
+
|
|
31
|
+
export function yogaNodeCreationCount(): number {
|
|
32
|
+
return yogaNodeCreations
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
export function createYogaNode(): YogaNode {
|
|
29
36
|
liveYogaNodes += 1
|
|
37
|
+
yogaNodeCreations += 1
|
|
30
38
|
return Yoga.Node.create(yogaConfig)
|
|
31
39
|
}
|
|
32
40
|
|
package/src/layout.ts
CHANGED
|
@@ -36,7 +36,7 @@ export {
|
|
|
36
36
|
} from './layout/text-measurement'
|
|
37
37
|
import type { LayoutSizing, SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
38
38
|
import { connectorSublayers, layoutConnector } from '@pairdraw/scene-graph/connectors'
|
|
39
|
-
import { layoutSizing } from '@pairdraw/scene-graph/layout'
|
|
39
|
+
import { enforcedAspectRatio, layoutSizing } from '@pairdraw/scene-graph/layout'
|
|
40
40
|
|
|
41
41
|
import { fitShapeWithTextFrame } from './layout/shape-with-text'
|
|
42
42
|
import {
|
|
@@ -376,6 +376,47 @@ function configureAutoLayoutChildSizing(
|
|
|
376
376
|
else setMainAxisSizing(yogaChild, 'height', heightSizing, child.height, child.layoutGrow)
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Whether the parent's pass places this child from the size it holds: neither its content nor the
|
|
381
|
+
* parent decides its size, so its own cells keep their places while the parent moves it.
|
|
382
|
+
*/
|
|
383
|
+
function placesFromSize(
|
|
384
|
+
child: SceneNode,
|
|
385
|
+
parent: SceneNode,
|
|
386
|
+
widthSizing: LayoutSizing,
|
|
387
|
+
heightSizing: LayoutSizing
|
|
388
|
+
): boolean {
|
|
389
|
+
return (
|
|
390
|
+
widthSizing === 'FIXED' &&
|
|
391
|
+
heightSizing === 'FIXED' &&
|
|
392
|
+
child.layoutGrow === 0 &&
|
|
393
|
+
parent.counterAxisAlign !== 'BASELINE' &&
|
|
394
|
+
child.layoutAlignSelf !== 'BASELINE' &&
|
|
395
|
+
enforcedAspectRatio(child) === null &&
|
|
396
|
+
child.minWidth === null &&
|
|
397
|
+
child.maxWidth === null &&
|
|
398
|
+
child.minHeight === null &&
|
|
399
|
+
child.maxHeight === null
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Refuses a chain deeper than Yoga can lay out, for the subtrees a pass places from their size and
|
|
405
|
+
* does not build: the same refusal, without the Yoga nodes.
|
|
406
|
+
*/
|
|
407
|
+
function assertLayoutDepth(graph: SceneGraph, frame: SceneNode, depth: number): void {
|
|
408
|
+
if (depth > MAX_LAYOUT_DEPTH) {
|
|
409
|
+
throw new RangeError(
|
|
410
|
+
`Layers nest more than ${MAX_LAYOUT_DEPTH} auto-layout frames deep, which the layout engine cannot lay out.`
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
for (const child of graph.getChildren(frame.id)) {
|
|
414
|
+
if (child.layoutMode === 'NONE' || !child.visible) continue
|
|
415
|
+
if (child.layoutPositioning === 'ABSOLUTE') continue
|
|
416
|
+
assertLayoutDepth(graph, child, depth + 1)
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
379
420
|
function configureChildAsAutoLayout(
|
|
380
421
|
yogaChild: YogaNode,
|
|
381
422
|
child: SceneNode,
|
|
@@ -410,6 +451,11 @@ function configureChildAsAutoLayout(
|
|
|
410
451
|
return
|
|
411
452
|
}
|
|
412
453
|
|
|
454
|
+
if (placesFromSize(child, parent, widthSizing, heightSizing)) {
|
|
455
|
+
assertLayoutDepth(graph, child, depth + 1)
|
|
456
|
+
return
|
|
457
|
+
}
|
|
458
|
+
|
|
413
459
|
configureFlexContainer(yogaChild, child, direction)
|
|
414
460
|
const heldAxis = heldHugAxis(graph, child)
|
|
415
461
|
if (heldAxis === 'width' && widthSizing === 'HUG') yogaChild.setWidth(child.width)
|
package/src/lint/linter.ts
CHANGED
|
@@ -334,7 +334,7 @@ function describeVariables(graph: SceneGraph): LintVariables {
|
|
|
334
334
|
const counts = { COLOR: 0, FLOAT: 0, STRING: 0, BOOLEAN: 0 }
|
|
335
335
|
const colorsByHex = new Map<string, { id: string; name: string }>()
|
|
336
336
|
const numbersByField = new Map<TokenNumberField, Map<number, { id: string; name: string }[]>>()
|
|
337
|
-
for (const variable of graph.
|
|
337
|
+
for (const variable of graph.getLiveVariables()) {
|
|
338
338
|
counts[variable.type]++
|
|
339
339
|
if (variable.type === 'FLOAT') {
|
|
340
340
|
const namespace = variableNamespace(variable)
|
|
@@ -111,6 +111,11 @@ export class CommentHandle {
|
|
|
111
111
|
return commentPosition(this.graph, this.thread)
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/** The area the person circled, in canvas units relative to the pin; null for a clicked pin. */
|
|
115
|
+
get region(): CommentThread['region'] {
|
|
116
|
+
return this.thread.region ?? null
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
get replies(): { id: string; author: string; text: string; createdAt: string }[] {
|
|
115
120
|
return liveReplies(this.thread).map(({ id, author, text, createdAt }) => ({
|
|
116
121
|
id,
|
|
@@ -151,6 +156,7 @@ export class CommentHandle {
|
|
|
151
156
|
page: this.page,
|
|
152
157
|
node: this.node,
|
|
153
158
|
position: this.position,
|
|
159
|
+
region: this.region,
|
|
154
160
|
replies: this.replies
|
|
155
161
|
}
|
|
156
162
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { exposeInstanceSwap } from '#core/figma-api/components'
|
|
18
18
|
import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api/index'
|
|
19
19
|
import { writeVariableValue } from '#core/figma-api/variables'
|
|
20
|
-
import {
|
|
20
|
+
import { readFontReadiness, type FontReadiness } from '#core/text/font/readiness'
|
|
21
21
|
|
|
22
22
|
import {
|
|
23
23
|
getBehaviour,
|
|
@@ -90,15 +90,13 @@ export class PairdrawAPI {
|
|
|
90
90
|
modeName?: string
|
|
91
91
|
): VariableLiteral {
|
|
92
92
|
const graph = this.figma.graph
|
|
93
|
-
const collections =
|
|
94
|
-
(item) => item.name === collectionName
|
|
95
|
-
)
|
|
93
|
+
const collections = graph.getLiveCollections().filter((item) => item.name === collectionName)
|
|
96
94
|
const collection = collections.at(0)
|
|
97
95
|
if (!collection || collections.length !== 1)
|
|
98
96
|
throw new Error(`Unknown or ambiguous collection: ${collectionName}`)
|
|
99
|
-
const variables =
|
|
100
|
-
(
|
|
101
|
-
|
|
97
|
+
const variables = graph
|
|
98
|
+
.getLiveVariables()
|
|
99
|
+
.filter((item) => item.collectionId === collection.id && item.name === variableName)
|
|
102
100
|
const variable = variables.at(0)
|
|
103
101
|
if (!variable || variables.length !== 1)
|
|
104
102
|
throw new Error(`Unknown or ambiguous variable: ${variableName}`)
|
|
@@ -266,8 +264,8 @@ export class PairdrawAPI {
|
|
|
266
264
|
* Whether the current page's fonts are faithfully available: requested faces, where each
|
|
267
265
|
* loaded from, substitutions, why an installed face could not load, and the layers affected.
|
|
268
266
|
*/
|
|
269
|
-
getFontStatus():
|
|
270
|
-
return
|
|
267
|
+
getFontStatus(): FontReadiness {
|
|
268
|
+
return readFontReadiness(this.figma.graph, this.figma.currentPageId)
|
|
271
269
|
}
|
|
272
270
|
|
|
273
271
|
/** A fill's OkHCL color, which the color picker keeps beside its RGB, or null. */
|
package/src/rpc/read-commands.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { BooleanOperation, MaskType, SceneGraph, SceneNode } from '@pairdra
|
|
|
4
4
|
|
|
5
5
|
import { shapeDetailFields } from '#core/figma-api/shape-details'
|
|
6
6
|
import { ELLIPSIS } from '#core/text/ellipsis'
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
7
|
+
import type { FontReadiness } from '#core/text/font/readiness'
|
|
8
|
+
import { resolveFontReadiness } from '#core/text/prepare'
|
|
9
9
|
import { queryByXPath } from '#core/xpath'
|
|
10
10
|
|
|
11
11
|
import type { RPCCommand } from './types'
|
|
@@ -104,11 +104,11 @@ export const infoCommand: RPCCommand<void, InfoResult> = {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
export const fontStatusCommand: RPCCommand<void,
|
|
107
|
+
export const fontStatusCommand: RPCCommand<void, FontReadiness> = {
|
|
108
108
|
name: 'font-status',
|
|
109
109
|
execute: async (graph) => {
|
|
110
110
|
const pageIds = graph.getPages().map((page) => page.id)
|
|
111
|
-
return
|
|
111
|
+
return resolveFontReadiness(graph, pageIds.length > 0 ? pageIds : [graph.rootId])
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -63,7 +63,7 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
63
63
|
|
|
64
64
|
const result: VariablesResult = { collections: [], totalVariables: 0, totalCollections: 0 }
|
|
65
65
|
|
|
66
|
-
for (const coll of graph.
|
|
66
|
+
for (const coll of graph.getLiveCollections()) {
|
|
67
67
|
if (collFilter && !coll.name.toLowerCase().includes(collFilter)) continue
|
|
68
68
|
|
|
69
69
|
const collVars = graph
|
|
@@ -120,7 +120,7 @@ async function designTokenFiles(graph: SceneGraph): Promise<TokensResult> {
|
|
|
120
120
|
const { files, issues } = exportDesignTokens(graph)
|
|
121
121
|
return {
|
|
122
122
|
css: '',
|
|
123
|
-
tokenCount: graph.
|
|
123
|
+
tokenCount: graph.getLiveVariables().length,
|
|
124
124
|
issues: issues.map(designTokenIssueMessage),
|
|
125
125
|
files
|
|
126
126
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'
|
|
2
|
+
|
|
3
|
+
import { fontManager } from './manager'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A share of the font provider `canvasKit` draws from. Every renderer and shaper holds one for as
|
|
7
|
+
* long as it reads text, so a face registered by one is shaped by all of them, and the last share
|
|
8
|
+
* given back deletes the provider. Releasing twice is safe and does nothing the second time.
|
|
9
|
+
*/
|
|
10
|
+
export interface FontProviderLease {
|
|
11
|
+
readonly provider: TypefaceFontProvider
|
|
12
|
+
release(): void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function leaseFontProvider(canvasKit: CanvasKit): FontProviderLease {
|
|
16
|
+
const provider = fontManager.acquireProvider(canvasKit)
|
|
17
|
+
let held = true
|
|
18
|
+
return {
|
|
19
|
+
provider,
|
|
20
|
+
release() {
|
|
21
|
+
if (!held) return
|
|
22
|
+
held = false
|
|
23
|
+
fontManager.releaseProvider(provider)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -5,15 +5,15 @@ import { fontManager, type FontManager } from '#core/text/font/manager'
|
|
|
5
5
|
import { collectNamedNodeFontFaces } from '#core/text/font/names'
|
|
6
6
|
import type { FontLoadedSource, FontUnavailableReason } from '#core/text/font/sources'
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type FontReadinessStatus = 'available' | 'substituted' | 'unresolved'
|
|
9
9
|
|
|
10
|
-
export interface
|
|
10
|
+
export interface FontFaceReadiness {
|
|
11
11
|
family: string
|
|
12
12
|
/** The style the font manager loads the face as. */
|
|
13
13
|
style: string
|
|
14
14
|
/** The face's name, as its text names it ("Book", "Semi Bold"). */
|
|
15
15
|
name: string
|
|
16
|
-
status:
|
|
16
|
+
status: FontReadinessStatus
|
|
17
17
|
source: FontLoadedSource | null
|
|
18
18
|
substituteFamily: string | null
|
|
19
19
|
/** Why the requested face could not be loaded, when the host reported a reason. */
|
|
@@ -22,10 +22,10 @@ export interface DocumentFontFaceStatus {
|
|
|
22
22
|
nodeNames: string[]
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export interface
|
|
25
|
+
export interface FontReadiness {
|
|
26
26
|
faithful: boolean
|
|
27
|
-
faces:
|
|
28
|
-
issues:
|
|
27
|
+
faces: FontFaceReadiness[]
|
|
28
|
+
issues: FontFaceReadiness[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
interface MutableFontFaceUse {
|
|
@@ -72,7 +72,7 @@ function collectFaceUses(graph: SceneGraph, rootIds: readonly string[]): Mutable
|
|
|
72
72
|
return [...uses.values()]
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function faceStatus(use: MutableFontFaceUse, manager: FontManager):
|
|
75
|
+
function faceStatus(use: MutableFontFaceUse, manager: FontManager): FontFaceReadiness {
|
|
76
76
|
const exactSource = manager.loadedFontSource(use.family, use.style)
|
|
77
77
|
if (exactSource) {
|
|
78
78
|
return {
|
|
@@ -116,11 +116,15 @@ function faceStatus(use: MutableFontFaceUse, manager: FontManager): DocumentFont
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
/**
|
|
120
|
+
* What the fonts loaded now can draw: a face reads `unresolved` until something loads it, so a
|
|
121
|
+
* caller that needs the truth for a document asks {@link resolveFontReadiness} instead.
|
|
122
|
+
*/
|
|
123
|
+
export function readFontReadiness(
|
|
120
124
|
graph: SceneGraph,
|
|
121
125
|
rootIds: string | readonly string[],
|
|
122
126
|
manager: FontManager = fontManager
|
|
123
|
-
):
|
|
127
|
+
): FontReadiness {
|
|
124
128
|
const roots = typeof rootIds === 'string' ? [rootIds] : rootIds
|
|
125
129
|
const faces = collectFaceUses(graph, roots)
|
|
126
130
|
.map((use) => faceStatus(use, manager))
|
package/src/text/index.ts
CHANGED
|
@@ -8,7 +8,8 @@ export * from './font/sources'
|
|
|
8
8
|
export * from './font/style'
|
|
9
9
|
export * from './font/variation'
|
|
10
10
|
export * from './font/woff2'
|
|
11
|
-
export * from './font/
|
|
11
|
+
export * from './font/provider'
|
|
12
|
+
export * from './font/readiness'
|
|
12
13
|
export * from './font/document'
|
|
13
14
|
export { setHarfBuzzSubsetLocator, type HarfBuzzSubsetLocator } from './font/harfbuzz'
|
|
14
15
|
export * from './fallbacks'
|
package/src/text/prepare.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { collectGraphFontRequirements, collectNodeFontFaces } from '#core/text/r
|
|
|
16
16
|
import { missingGraphFontScripts } from '#core/text/requirements/resolved'
|
|
17
17
|
import { fontFaceDemand, fontResolver } from '#core/text/resolver'
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { readFontReadiness, type FontReadiness } from './font/readiness'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The characters of a text its layout falls back to the emoji metrics font for: ones that may be
|
|
@@ -59,14 +59,19 @@ async function settleUnavailableFonts(
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The one readiness read a caller needs: loads every face the document under `nodeIds` asks for,
|
|
64
|
+
* then reports what it can draw with. {@link readFontReadiness} reports the loaded state without
|
|
65
|
+
* loading, for a caller that only mirrors it in the UI.
|
|
66
|
+
*/
|
|
67
|
+
export async function resolveFontReadiness(
|
|
63
68
|
graph: SceneGraph,
|
|
64
69
|
nodeIds: readonly string[],
|
|
65
70
|
/** Characters a writer draws besides the text's own, which the fonts must map too. */
|
|
66
71
|
extraCharacters = '',
|
|
67
72
|
/** An output that draws once and cannot wait for a face to arrive; see `settleUnavailableFonts`. */
|
|
68
73
|
{ settleUnavailable = false }: { settleUnavailable?: boolean } = {}
|
|
69
|
-
): Promise<
|
|
74
|
+
): Promise<FontReadiness> {
|
|
70
75
|
const collected = collectGraphFontRequirements(graph, nodeIds)
|
|
71
76
|
const requirements = extraCharacters
|
|
72
77
|
? {
|
|
@@ -118,5 +123,5 @@ export async function prepareGraphFonts(
|
|
|
118
123
|
requirements.nodes.map(laidOutEmojiCharacters).join('')
|
|
119
124
|
if (emoji && !canDrawPlatformEmoji())
|
|
120
125
|
await fontManager.loadRemoteFont(NOTO_COLOR_EMOJI_FAMILY, 'Regular', emoji)
|
|
121
|
-
return
|
|
126
|
+
return readFontReadiness(graph, nodeIds)
|
|
122
127
|
}
|