@pairdraw/core 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/providers.d.ts +6 -0
- package/dist/ai/providers.d.ts.map +1 -1
- package/dist/ai/providers.js.map +1 -1
- package/dist/cache/resource.d.ts +8 -1
- package/dist/cache/resource.d.ts.map +1 -1
- package/dist/cache/resource.js +18 -0
- package/dist/cache/resource.js.map +1 -1
- package/dist/canvas/effects.d.ts +6 -4
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +37 -34
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/fills.d.ts.map +1 -1
- package/dist/canvas/fills.js +12 -8
- package/dist/canvas/fills.js.map +1 -1
- package/dist/canvas/images/adjustments.d.ts +18 -0
- package/dist/canvas/images/adjustments.d.ts.map +1 -0
- package/dist/canvas/images/adjustments.js +184 -0
- package/dist/canvas/images/adjustments.js.map +1 -0
- package/dist/canvas/images/sampling.d.ts +13 -0
- package/dist/canvas/images/sampling.d.ts.map +1 -0
- package/dist/canvas/images/sampling.js +49 -0
- package/dist/canvas/images/sampling.js.map +1 -0
- package/dist/canvas/index.d.ts +2 -2
- package/dist/canvas/masks.d.ts +1 -1
- package/dist/canvas/masks.d.ts.map +1 -1
- package/dist/canvas/masks.js.map +1 -1
- package/dist/canvas/noise/render.d.ts +15 -0
- package/dist/canvas/noise/render.d.ts.map +1 -0
- package/dist/canvas/noise/render.js +56 -0
- package/dist/canvas/noise/render.js.map +1 -0
- package/dist/canvas/noise/shader.d.ts +43 -0
- package/dist/canvas/noise/shader.d.ts.map +1 -0
- package/dist/canvas/noise/shader.js +161 -0
- package/dist/canvas/noise/shader.js.map +1 -0
- package/dist/canvas/noise/table.d.ts +13 -0
- package/dist/canvas/noise/table.d.ts.map +1 -0
- package/dist/canvas/noise/table.js +408 -0
- package/dist/canvas/noise/table.js.map +1 -0
- package/dist/canvas/noise/tile.d.ts +22 -0
- package/dist/canvas/noise/tile.d.ts.map +1 -0
- package/dist/canvas/noise/tile.js +73 -0
- package/dist/canvas/noise/tile.js.map +1 -0
- package/dist/canvas/outline-stroke.js +1 -1
- package/dist/canvas/overlays/auto-layout-hover.d.ts.map +1 -1
- package/dist/canvas/overlays/auto-layout-hover.js +31 -71
- package/dist/canvas/overlays/auto-layout-hover.js.map +1 -1
- package/dist/canvas/renderer/chunks/index.d.ts +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -0
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +13 -1
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/play-scenes.d.ts +13 -0
- package/dist/canvas/renderer/play-scenes.d.ts.map +1 -0
- package/dist/canvas/renderer/play-scenes.js +40 -0
- package/dist/canvas/renderer/play-scenes.js.map +1 -0
- package/dist/canvas/renderer/tiles/cache.d.ts +19 -1
- package/dist/canvas/renderer/tiles/cache.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/cache.js +32 -1
- package/dist/canvas/renderer/tiles/cache.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +11 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +18 -1
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/index.d.ts +2 -2
- package/dist/canvas/renderer/tiles/planner.d.ts +1 -1
- package/dist/canvas/renderer/types.d.ts +18 -3
- package/dist/canvas/renderer/types.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts +1 -1
- package/dist/canvas/renderer/visual-bounds.js +1 -1
- package/dist/canvas/renderer.d.ts +22 -2
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +29 -1
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +41 -9
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/silhouette.js +1 -1
- package/dist/canvas/texture.d.ts +20 -0
- package/dist/canvas/texture.d.ts.map +1 -0
- package/dist/canvas/texture.js +100 -0
- package/dist/canvas/texture.js.map +1 -0
- package/dist/clipboard.js +16 -5
- package/dist/clipboard.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/design-memory/check.d.ts +90 -0
- package/dist/design-memory/check.d.ts.map +1 -0
- package/dist/design-memory/check.js +281 -0
- package/dist/design-memory/check.js.map +1 -0
- package/dist/design-memory/describe.d.ts +37 -0
- package/dist/design-memory/describe.d.ts.map +1 -0
- package/dist/design-memory/describe.js +52 -0
- package/dist/design-memory/describe.js.map +1 -0
- package/dist/design-memory/distil.d.ts +22 -0
- package/dist/design-memory/distil.d.ts.map +1 -0
- package/dist/design-memory/distil.js +54 -0
- package/dist/design-memory/distil.js.map +1 -0
- package/dist/design-memory/document.d.ts +12 -0
- package/dist/design-memory/document.d.ts.map +1 -0
- package/dist/design-memory/document.js +64 -0
- package/dist/design-memory/document.js.map +1 -0
- package/dist/design-memory/guard.d.ts +48 -0
- package/dist/design-memory/guard.d.ts.map +1 -0
- package/dist/design-memory/guard.js +105 -0
- package/dist/design-memory/guard.js.map +1 -0
- package/dist/design-memory/index.d.ts +9 -0
- package/dist/design-memory/index.js +9 -0
- package/dist/design-memory/refusal.d.ts +32 -0
- package/dist/design-memory/refusal.d.ts.map +1 -0
- package/dist/design-memory/refusal.js +68 -0
- package/dist/design-memory/refusal.js.map +1 -0
- package/dist/design-memory/rules.d.ts +63 -0
- package/dist/design-memory/rules.d.ts.map +1 -0
- package/dist/design-memory/rules.js +224 -0
- package/dist/design-memory/rules.js.map +1 -0
- package/dist/design-memory/values.d.ts +28 -0
- package/dist/design-memory/values.d.ts.map +1 -0
- package/dist/design-memory/values.js +160 -0
- package/dist/design-memory/values.js.map +1 -0
- package/dist/editor/alignment.js +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/assets.js +1 -1
- package/dist/editor/clipboard/export.d.ts.map +1 -1
- package/dist/editor/clipboard/export.js +16 -2
- package/dist/editor/clipboard/export.js.map +1 -1
- package/dist/editor/clipboard/placement.d.ts +1 -1
- package/dist/editor/clipboard/placement.js +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +22 -1
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/connectors/attach.js +1 -1
- package/dist/editor/create.d.ts +27 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +16 -60
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/design-memory.d.ts +11 -0
- package/dist/editor/design-memory.d.ts.map +1 -0
- package/dist/editor/design-memory.js +40 -0
- package/dist/editor/design-memory.js.map +1 -0
- package/dist/editor/design-tokens.d.ts +4 -0
- package/dist/editor/design-tokens.d.ts.map +1 -1
- package/dist/editor/design-tokens.js +30 -1
- package/dist/editor/design-tokens.js.map +1 -1
- package/dist/editor/document-colors.d.ts +23 -0
- package/dist/editor/document-colors.d.ts.map +1 -0
- package/dist/editor/document-colors.js +53 -0
- package/dist/editor/document-colors.js.map +1 -0
- package/dist/editor/eyedropper.d.ts +47 -0
- package/dist/editor/eyedropper.d.ts.map +1 -0
- package/dist/editor/eyedropper.js +168 -0
- package/dist/editor/eyedropper.js.map +1 -0
- package/dist/editor/fonts.d.ts +9 -0
- package/dist/editor/fonts.d.ts.map +1 -0
- package/dist/editor/fonts.js +14 -0
- package/dist/editor/fonts.js.map +1 -0
- package/dist/editor/history/atomic-tool.d.ts +9 -2
- package/dist/editor/history/atomic-tool.d.ts.map +1 -1
- package/dist/editor/history/atomic-tool.js +6 -0
- package/dist/editor/history/atomic-tool.js.map +1 -1
- package/dist/editor/history/capture.d.ts +13 -0
- package/dist/editor/history/capture.d.ts.map +1 -0
- package/dist/editor/history/capture.js +28 -0
- package/dist/editor/history/capture.js.map +1 -0
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +2 -22
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts +7 -0
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +4 -2
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/subtree.d.ts +9 -0
- package/dist/editor/history/subtree.d.ts.map +1 -1
- package/dist/editor/history/subtree.js +12 -2
- package/dist/editor/history/subtree.js.map +1 -1
- package/dist/editor/index.d.ts +4 -2
- package/dist/editor/index.js +4 -2
- package/dist/editor/pages.d.ts +7 -5
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +35 -25
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts +3 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +1 -1
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +4 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/render-requests.d.ts +18 -0
- package/dist/editor/render-requests.d.ts.map +1 -0
- package/dist/editor/render-requests.js +76 -0
- package/dist/editor/render-requests.js.map +1 -0
- package/dist/editor/scale/rescale.d.ts +1 -1
- package/dist/editor/selection/overlays.d.ts.map +1 -1
- package/dist/editor/selection/overlays.js +1 -1
- package/dist/editor/selection/overlays.js.map +1 -1
- package/dist/editor/selection/read.d.ts +4 -0
- package/dist/editor/selection.d.ts +5 -0
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/tool-registry.d.ts.map +1 -1
- package/dist/editor/tool-registry.js +2 -1
- package/dist/editor/tool-registry.js.map +1 -1
- package/dist/editor/types.d.ts +5 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/variations/create.d.ts +28 -0
- package/dist/editor/variations/create.d.ts.map +1 -0
- package/dist/editor/variations/create.js +176 -0
- package/dist/editor/variations/create.js.map +1 -0
- package/dist/editor/variations/pick.d.ts +16 -0
- package/dist/editor/variations/pick.d.ts.map +1 -0
- package/dist/editor/variations/pick.js +23 -0
- package/dist/editor/variations/pick.js.map +1 -0
- package/dist/editor/variations.d.ts +28 -0
- package/dist/editor/variations.d.ts.map +1 -0
- package/dist/editor/variations.js +88 -0
- package/dist/editor/variations.js.map +1 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -1
- package/dist/figma-api/accessors/reactions.js +4 -1
- package/dist/figma-api/accessors/reactions.js.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -0
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/text/opentype.d.ts +17 -0
- package/dist/figma-api/accessors/text/opentype.d.ts.map +1 -0
- package/dist/figma-api/accessors/text/opentype.js +28 -0
- package/dist/figma-api/accessors/text/opentype.js.map +1 -0
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +33 -0
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/effects.d.ts +79 -3
- package/dist/figma-api/effects.d.ts.map +1 -1
- package/dist/figma-api/effects.js +150 -9
- package/dist/figma-api/effects.js.map +1 -1
- package/dist/figma-api/index.d.ts +5 -0
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +6 -1
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +13 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +196 -4
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/paints.d.ts +3 -3
- package/dist/figma-api/paints.d.ts.map +1 -1
- package/dist/figma-api/paints.js +14 -4
- package/dist/figma-api/paints.js.map +1 -1
- package/dist/figma-api/proxy.d.ts +4 -1
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +1 -1
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +41 -13
- package/dist/figma-api/reactions.d.ts.map +1 -1
- package/dist/figma-api/reactions.js +113 -31
- package/dist/figma-api/reactions.js.map +1 -1
- package/dist/figma-api/render-bounds.js +1 -1
- package/dist/figma-api/surface.d.ts +6 -3
- package/dist/figma-api/surface.d.ts.map +1 -1
- package/dist/figma-api/surface.js +6 -2
- package/dist/figma-api/surface.js.map +1 -1
- package/dist/figma-api/transform.d.ts +1 -1
- package/dist/geometry/figma.d.ts +1 -1
- package/dist/geometry/image-crop.d.ts +1 -1
- package/dist/geometry/image-crop.js +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/io/formats/boolean-path.d.ts +19 -0
- package/dist/io/formats/boolean-path.d.ts.map +1 -0
- package/dist/io/formats/boolean-path.js +47 -0
- package/dist/io/formats/boolean-path.js.map +1 -0
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/index.d.ts +4 -1
- package/dist/io/formats/design-tokens/index.js +4 -1
- package/dist/io/formats/design-tokens/plan/changes.d.ts +5 -3
- package/dist/io/formats/design-tokens/plan/changes.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js +1 -1
- package/dist/io/formats/design-tokens/plan/changes.js.map +1 -1
- package/dist/io/formats/design-tokens/project.d.ts +17 -2
- package/dist/io/formats/design-tokens/project.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/project.js +29 -8
- package/dist/io/formats/design-tokens/project.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/sync/apply.d.ts +42 -0
- package/dist/io/formats/design-tokens/sync/apply.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/apply.js +73 -0
- package/dist/io/formats/design-tokens/sync/apply.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts +77 -0
- package/dist/io/formats/design-tokens/sync/drift.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/drift.js +391 -0
- package/dist/io/formats/design-tokens/sync/drift.js.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts +15 -0
- package/dist/io/formats/design-tokens/sync/files.d.ts.map +1 -0
- package/dist/io/formats/design-tokens/sync/files.js +35 -0
- package/dist/io/formats/design-tokens/sync/files.js.map +1 -0
- package/dist/io/formats/drawio/edges.d.ts +7 -1
- package/dist/io/formats/drawio/edges.d.ts.map +1 -1
- package/dist/io/formats/drawio/edges.js +54 -1
- package/dist/io/formats/drawio/edges.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +19 -2
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.js +1 -0
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/label.js +1 -1
- package/dist/io/formats/drawio/paint.js +1 -1
- package/dist/io/formats/drawio/placement.d.ts +1 -1
- package/dist/io/formats/fig/export/patch/index.d.ts.map +1 -1
- package/dist/io/formats/fig/export/patch/index.js +5 -0
- package/dist/io/formats/fig/export/patch/index.js.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.d.ts +3 -4
- package/dist/io/formats/fig/thumbnail-page.d.ts.map +1 -1
- package/dist/io/formats/fig/thumbnail-page.js.map +1 -1
- package/dist/io/formats/html/import.d.ts.map +1 -1
- package/dist/io/formats/html/import.js +3 -1
- package/dist/io/formats/html/import.js.map +1 -1
- package/dist/io/formats/html/index.d.ts +2 -2
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +6 -4
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/html/vectors.d.ts +2 -1
- package/dist/io/formats/html/vectors.d.ts.map +1 -1
- package/dist/io/formats/html/vectors.js +3 -2
- package/dist/io/formats/html/vectors.js.map +1 -1
- package/dist/io/formats/mermaid/styles.js +1 -1
- package/dist/io/formats/pdf/document.d.ts +3 -1
- package/dist/io/formats/pdf/document.d.ts.map +1 -1
- package/dist/io/formats/pdf/document.js +6 -3
- package/dist/io/formats/pdf/document.js.map +1 -1
- package/dist/io/formats/pdf/prepare.d.ts +1 -1
- package/dist/io/formats/pen/imports.d.ts +4 -1
- package/dist/io/formats/pen/imports.d.ts.map +1 -1
- package/dist/io/formats/pen/imports.js.map +1 -1
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +31 -3
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/pptx/export.js +1 -1
- package/dist/io/formats/pptx/geometry.d.ts +1 -1
- package/dist/io/formats/raster/adjusted-images.d.ts +15 -0
- package/dist/io/formats/raster/adjusted-images.d.ts.map +1 -0
- package/dist/io/formats/raster/adjusted-images.js +118 -0
- package/dist/io/formats/raster/adjusted-images.js.map +1 -0
- package/dist/io/formats/raster/headless.d.ts +11 -1
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +4 -4
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/pixels.d.ts +7 -1
- package/dist/io/formats/raster/pixels.d.ts.map +1 -1
- package/dist/io/formats/raster/pixels.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +4 -0
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/defs.d.ts +5 -6
- package/dist/io/formats/svg/defs.d.ts.map +1 -1
- package/dist/io/formats/svg/defs.js +1 -53
- package/dist/io/formats/svg/defs.js.map +1 -1
- package/dist/io/formats/svg/effects.d.ts +16 -0
- package/dist/io/formats/svg/effects.d.ts.map +1 -0
- package/dist/io/formats/svg/effects.js +126 -0
- package/dist/io/formats/svg/effects.js.map +1 -0
- package/dist/io/formats/svg/export.d.ts +7 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +174 -36
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/filter.d.ts +27 -0
- package/dist/io/formats/svg/filter.d.ts.map +1 -0
- package/dist/io/formats/svg/filter.js +44 -0
- package/dist/io/formats/svg/filter.js.map +1 -0
- package/dist/io/formats/svg/grain.d.ts +26 -0
- package/dist/io/formats/svg/grain.d.ts.map +1 -0
- package/dist/io/formats/svg/grain.js +298 -0
- package/dist/io/formats/svg/grain.js.map +1 -0
- package/dist/io/formats/svg/strokes.d.ts +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +1 -2
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/import.js +1 -1
- package/dist/io/formats/svg/text/layout.d.ts +5 -2
- package/dist/io/formats/svg/text/layout.d.ts.map +1 -1
- package/dist/io/formats/svg/text/layout.js +6 -3
- package/dist/io/formats/svg/text/layout.js.map +1 -1
- package/dist/io/formats/video/composite.d.ts +18 -0
- package/dist/io/formats/video/composite.d.ts.map +1 -0
- package/dist/io/formats/video/composite.js +79 -0
- package/dist/io/formats/video/composite.js.map +1 -0
- package/dist/io/formats/video/formats.d.ts +29 -0
- package/dist/io/formats/video/formats.d.ts.map +1 -0
- package/dist/io/formats/video/formats.js +43 -0
- package/dist/io/formats/video/formats.js.map +1 -0
- package/dist/io/formats/video/gif.d.ts +13 -0
- package/dist/io/formats/video/gif.d.ts.map +1 -0
- package/dist/io/formats/video/gif.js +56 -0
- package/dist/io/formats/video/gif.js.map +1 -0
- package/dist/io/formats/video/index.d.ts +9 -0
- package/dist/io/formats/video/index.js +9 -0
- package/dist/io/formats/video/plan.d.ts +64 -0
- package/dist/io/formats/video/plan.d.ts.map +1 -0
- package/dist/io/formats/video/plan.js +90 -0
- package/dist/io/formats/video/plan.js.map +1 -0
- package/dist/io/formats/video/record.d.ts +36 -0
- package/dist/io/formats/video/record.d.ts.map +1 -0
- package/dist/io/formats/video/record.js +154 -0
- package/dist/io/formats/video/record.js.map +1 -0
- package/dist/io/formats/video/sink.d.ts +29 -0
- package/dist/io/formats/video/sink.d.ts.map +1 -0
- package/dist/io/formats/video/sink.js +16 -0
- package/dist/io/formats/video/sink.js.map +1 -0
- package/dist/io/formats/video/size.d.ts +19 -0
- package/dist/io/formats/video/size.d.ts.map +1 -0
- package/dist/io/formats/video/size.js +26 -0
- package/dist/io/formats/video/size.js.map +1 -0
- package/dist/io/formats/video/webcodecs.d.ts +18 -0
- package/dist/io/formats/video/webcodecs.d.ts.map +1 -0
- package/dist/io/formats/video/webcodecs.js +74 -0
- package/dist/io/formats/video/webcodecs.js.map +1 -0
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +40 -11
- package/dist/io/formats.js.map +1 -1
- package/dist/io/types.d.ts +19 -4
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/parse/transfer.d.ts +1 -1
- package/dist/layout/auto-layout-handles.d.ts +66 -0
- package/dist/layout/auto-layout-handles.d.ts.map +1 -0
- package/dist/layout/auto-layout-handles.js +291 -0
- package/dist/layout/auto-layout-handles.js.map +1 -0
- package/dist/layout.d.ts +3 -2
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +2 -1
- package/dist/layout.js.map +1 -1
- package/dist/lint/fixes.d.ts.map +1 -1
- package/dist/lint/fixes.js +9 -3
- package/dist/lint/fixes.js.map +1 -1
- package/dist/lint/index.d.ts +3 -2
- package/dist/lint/index.js +2 -1
- package/dist/lint/linter.d.ts +12 -0
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +110 -8
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/presets.d.ts.map +1 -1
- package/dist/lint/presets.js +2 -0
- package/dist/lint/presets.js.map +1 -1
- package/dist/lint/rules/design-memory.d.ts +15 -0
- package/dist/lint/rules/design-memory.d.ts.map +1 -0
- package/dist/lint/rules/design-memory.js +90 -0
- package/dist/lint/rules/design-memory.js.map +1 -0
- package/dist/lint/rules/index.d.ts +6 -5
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lint/rules/index.js +6 -2
- package/dist/lint/rules/index.js.map +1 -1
- package/dist/lint/rules/no-unbound-token-values.d.ts +6 -0
- package/dist/lint/rules/no-unbound-token-values.d.ts.map +1 -0
- package/dist/lint/rules/no-unbound-token-values.js +79 -0
- package/dist/lint/rules/no-unbound-token-values.js.map +1 -0
- package/dist/lint/types.d.ts +25 -2
- package/dist/lint/types.d.ts.map +1 -1
- package/dist/node/video.d.ts +12 -0
- package/dist/node/video.d.ts.map +1 -0
- package/dist/node/video.js +206 -0
- package/dist/node/video.js.map +1 -0
- package/dist/pairdraw-api/design-memory.d.ts +19 -0
- package/dist/pairdraw-api/design-memory.d.ts.map +1 -0
- package/dist/pairdraw-api/design-memory.js +39 -0
- package/dist/pairdraw-api/design-memory.js.map +1 -0
- package/dist/pairdraw-api/index.d.ts +45 -1
- package/dist/pairdraw-api/index.d.ts.map +1 -1
- package/dist/pairdraw-api/index.js +55 -2
- package/dist/pairdraw-api/index.js.map +1 -1
- package/dist/pairdraw-api/nodes.d.ts +12 -1
- package/dist/pairdraw-api/nodes.d.ts.map +1 -1
- package/dist/pairdraw-api/nodes.js +28 -1
- package/dist/pairdraw-api/nodes.js.map +1 -1
- package/dist/pairdraw-api/variations.d.ts +48 -0
- package/dist/pairdraw-api/variations.d.ts.map +1 -0
- package/dist/pairdraw-api/variations.js +76 -0
- package/dist/pairdraw-api/variations.js.map +1 -0
- package/dist/prototype/easing.d.ts +13 -0
- package/dist/prototype/easing.d.ts.map +1 -0
- package/dist/prototype/easing.js +36 -0
- package/dist/prototype/easing.js.map +1 -0
- package/dist/prototype/frames.d.ts +10 -0
- package/dist/prototype/frames.d.ts.map +1 -0
- package/dist/prototype/frames.js +12 -0
- package/dist/prototype/frames.js.map +1 -0
- package/dist/prototype/hit.d.ts +17 -0
- package/dist/prototype/hit.d.ts.map +1 -0
- package/dist/prototype/hit.js +45 -0
- package/dist/prototype/hit.js.map +1 -0
- package/dist/prototype/index.d.ts +14 -0
- package/dist/prototype/index.js +14 -0
- package/dist/prototype/pointer.d.ts +63 -0
- package/dist/prototype/pointer.d.ts.map +1 -0
- package/dist/prototype/pointer.js +104 -0
- package/dist/prototype/pointer.js.map +1 -0
- package/dist/prototype/reactions.d.ts +45 -0
- package/dist/prototype/reactions.d.ts.map +1 -0
- package/dist/prototype/reactions.js +122 -0
- package/dist/prototype/reactions.js.map +1 -0
- package/dist/prototype/scene.d.ts +35 -0
- package/dist/prototype/scene.d.ts.map +1 -0
- package/dist/prototype/scene.js +86 -0
- package/dist/prototype/scene.js.map +1 -0
- package/dist/prototype/scenes.d.ts +81 -0
- package/dist/prototype/scenes.d.ts.map +1 -0
- package/dist/prototype/scenes.js +175 -0
- package/dist/prototype/scenes.js.map +1 -0
- package/dist/prototype/scroll.d.ts +48 -0
- package/dist/prototype/scroll.d.ts.map +1 -0
- package/dist/prototype/scroll.js +159 -0
- package/dist/prototype/scroll.js.map +1 -0
- package/dist/prototype/session.d.ts +71 -0
- package/dist/prototype/session.d.ts.map +1 -0
- package/dist/prototype/session.js +135 -0
- package/dist/prototype/session.js.map +1 -0
- package/dist/prototype/smart-animate/animation.d.ts +34 -0
- package/dist/prototype/smart-animate/animation.d.ts.map +1 -0
- package/dist/prototype/smart-animate/animation.js +212 -0
- package/dist/prototype/smart-animate/animation.js.map +1 -0
- package/dist/prototype/smart-animate/match.d.ts +24 -0
- package/dist/prototype/smart-animate/match.d.ts.map +1 -0
- package/dist/prototype/smart-animate/match.js +72 -0
- package/dist/prototype/smart-animate/match.js.map +1 -0
- package/dist/prototype/snapshot.d.ts +19 -0
- package/dist/prototype/snapshot.d.ts.map +1 -0
- package/dist/prototype/snapshot.js +56 -0
- package/dist/prototype/snapshot.js.map +1 -0
- package/dist/prototype/timeline.d.ts +132 -0
- package/dist/prototype/timeline.d.ts.map +1 -0
- package/dist/prototype/timeline.js +260 -0
- package/dist/prototype/timeline.js.map +1 -0
- package/dist/rpc/read-commands.js +1 -1
- package/dist/text/font/features.d.ts +9 -0
- package/dist/text/font/features.d.ts.map +1 -0
- package/dist/text/font/features.js +27 -0
- package/dist/text/font/features.js.map +1 -0
- package/dist/text/font/manager.d.ts +12 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +60 -1
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +10 -8
- package/dist/text/index.js +3 -1
- package/dist/text/replace-fonts.d.ts +41 -0
- package/dist/text/replace-fonts.d.ts.map +1 -0
- package/dist/text/replace-fonts.js +121 -0
- package/dist/text/replace-fonts.js.map +1 -0
- package/dist/tools/analyze/responsive/index.d.ts +15 -0
- package/dist/tools/analyze/responsive/index.d.ts.map +1 -0
- package/dist/tools/analyze/responsive/index.js +203 -0
- package/dist/tools/analyze/responsive/index.js.map +1 -0
- package/dist/tools/analyze.d.ts +2 -1
- package/dist/tools/analyze.js +2 -1
- package/dist/tools/codegen/token-sync.d.ts +7 -0
- package/dist/tools/codegen/token-sync.d.ts.map +1 -0
- package/dist/tools/codegen/token-sync.js +85 -0
- package/dist/tools/codegen/token-sync.js.map +1 -0
- package/dist/tools/codegen/tokens.d.ts +1 -1
- package/dist/tools/codegen.d.ts +2 -1
- package/dist/tools/codegen.js +2 -1
- package/dist/tools/create/basic.js +1 -1
- package/dist/tools/create/behaviours.js +1 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +4 -0
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.js +3 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +2 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.js +2 -1
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.js +1 -1
- package/dist/tools/create/svg.js +2 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.js +1 -1
- package/dist/tools/design-memory.d.ts +8 -0
- package/dist/tools/design-memory.d.ts.map +1 -0
- package/dist/tools/design-memory.js +68 -0
- package/dist/tools/design-memory.js.map +1 -0
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -1
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/modify/fonts.d.ts +6 -0
- package/dist/tools/modify/fonts.d.ts.map +1 -0
- package/dist/tools/modify/fonts.js +27 -0
- package/dist/tools/modify/fonts.js.map +1 -0
- package/dist/tools/modify/paint.js +1 -1
- package/dist/tools/modify/reactions.d.ts.map +1 -1
- package/dist/tools/modify/reactions.js +3 -3
- package/dist/tools/modify/reactions.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +26 -5
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify/update.d.ts +10 -1
- package/dist/tools/modify/update.d.ts.map +1 -1
- package/dist/tools/modify/update.js +34 -3
- package/dist/tools/modify/update.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/fonts.d.ts.map +1 -1
- package/dist/tools/read/fonts.js +17 -2
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.js +2 -1
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/space.d.ts +3 -1
- package/dist/tools/read/space.d.ts.map +1 -1
- package/dist/tools/read/space.js +4 -3
- package/dist/tools/read/space.js.map +1 -1
- package/dist/tools/registry/core.d.ts +1 -1
- package/dist/tools/registry/core.d.ts.map +1 -1
- package/dist/tools/registry/core.js +3 -1
- package/dist/tools/registry/core.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +16 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +18 -2
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +1 -1
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo.js +1 -0
- package/dist/tools/stock-photo.js.map +1 -1
- package/dist/tools/structure/basic.d.ts.map +1 -1
- package/dist/tools/structure/basic.js +1 -0
- package/dist/tools/structure/basic.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +8 -1
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/structure/hierarchy.d.ts.map +1 -1
- package/dist/tools/structure/hierarchy.js +4 -0
- package/dist/tools/structure/hierarchy.js.map +1 -1
- package/dist/tools/structure/variations.d.ts +8 -0
- package/dist/tools/structure/variations.d.ts.map +1 -0
- package/dist/tools/structure/variations.js +106 -0
- package/dist/tools/structure/variations.js.map +1 -0
- package/dist/tools/structure.d.ts +2 -1
- package/dist/tools/structure.js +2 -1
- package/dist/tools/styles/types.d.ts +2 -4
- package/dist/tools/styles/types.d.ts.map +1 -1
- package/dist/tools/styles/types.js.map +1 -1
- package/dist/tools/vector/boolean.d.ts.map +1 -1
- package/dist/tools/vector/boolean.js +4 -0
- package/dist/tools/vector/boolean.js.map +1 -1
- package/dist/tools/vector/vectorize.js +1 -0
- package/dist/tools/vector/vectorize.js.map +1 -1
- package/dist/tools/vector/video.d.ts +6 -0
- package/dist/tools/vector/video.d.ts.map +1 -0
- package/dist/tools/vector/video.js +133 -0
- package/dist/tools/vector/video.js.map +1 -0
- package/dist/tools/vector.d.ts +2 -1
- package/dist/tools/vector.js +2 -1
- package/dist/tools/video-host.d.ts +12 -0
- package/dist/tools/video-host.d.ts.map +1 -0
- package/dist/tools/video-host.js +19 -0
- package/dist/tools/video-host.js.map +1 -0
- package/dist/vector/point-transform.d.ts +1 -1
- package/dist/vector/vectorize/svg/to-vectors.d.ts +1 -1
- package/package.json +31 -9
- package/src/ai/providers.ts +2 -0
- package/src/cache/resource.ts +24 -1
- package/src/canvas/effects.ts +47 -50
- package/src/canvas/fills.ts +19 -15
- package/src/canvas/images/adjustments.ts +203 -0
- package/src/canvas/images/sampling.ts +88 -0
- package/src/canvas/index.ts +1 -0
- package/src/canvas/masks.ts +1 -1
- package/src/canvas/noise/render.ts +75 -0
- package/src/canvas/noise/shader.ts +161 -0
- package/src/canvas/noise/table.ts +91 -0
- package/src/canvas/noise/tile.ts +94 -0
- package/src/canvas/overlays/auto-layout-hover.ts +47 -65
- package/src/canvas/renderer/lifecycle.ts +6 -0
- package/src/canvas/renderer/pipeline.ts +19 -1
- package/src/canvas/renderer/play-scenes.ts +51 -0
- package/src/canvas/renderer/tiles/cache.ts +54 -1
- package/src/canvas/renderer/tiles/controller.ts +30 -1
- package/src/canvas/renderer/types.ts +18 -2
- package/src/canvas/renderer.ts +40 -3
- package/src/canvas/scene.ts +65 -9
- package/src/canvas/texture.ts +136 -0
- package/src/clipboard.ts +23 -10
- package/src/constants.ts +6 -0
- package/src/design-memory/check.ts +376 -0
- package/src/design-memory/describe.ts +77 -0
- package/src/design-memory/distil.ts +69 -0
- package/src/design-memory/document.ts +80 -0
- package/src/design-memory/guard.ts +157 -0
- package/src/design-memory/index.ts +8 -0
- package/src/design-memory/refusal.ts +90 -0
- package/src/design-memory/rules.ts +274 -0
- package/src/design-memory/values.ts +179 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/clipboard/export.ts +24 -7
- package/src/editor/components/instances.ts +31 -0
- package/src/editor/create.ts +25 -69
- package/src/editor/design-memory.ts +39 -0
- package/src/editor/design-tokens.ts +41 -2
- package/src/editor/document-colors.ts +65 -0
- package/src/editor/eyedropper.ts +198 -0
- package/src/editor/fonts.ts +19 -0
- package/src/editor/history/atomic-tool.ts +29 -1
- package/src/editor/history/capture.ts +19 -0
- package/src/editor/history/document-change.ts +5 -17
- package/src/editor/history/edit.ts +11 -1
- package/src/editor/history/subtree.ts +13 -2
- package/src/editor/index.ts +11 -0
- package/src/editor/pages.ts +40 -29
- package/src/editor/play/states.ts +1 -1
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/render-requests.ts +83 -0
- package/src/editor/selection/overlays.ts +1 -0
- package/src/editor/tool-registry.ts +2 -1
- package/src/editor/types.ts +4 -0
- package/src/editor/variations/create.ts +235 -0
- package/src/editor/variations/pick.ts +35 -0
- package/src/editor/variations.ts +110 -0
- package/src/figma-api/accessors/reactions.ts +11 -1
- package/src/figma-api/accessors/text/index.ts +7 -0
- package/src/figma-api/accessors/text/opentype.ts +33 -0
- package/src/figma-api/accessors/visual.ts +55 -2
- package/src/figma-api/compatibility.ts +5 -2
- package/src/figma-api/effects.ts +143 -5
- package/src/figma-api/index.ts +10 -0
- package/src/figma-api/overrides.ts +295 -3
- package/src/figma-api/paints.ts +24 -9
- package/src/figma-api/proxy.ts +6 -1
- package/src/figma-api/reactions.ts +130 -32
- package/src/figma-api/surface.ts +6 -2
- package/src/global.d.ts +26 -0
- package/src/io/formats/boolean-path.ts +60 -0
- package/src/io/formats/design-tokens/index.ts +21 -0
- package/src/io/formats/design-tokens/plan/changes.ts +4 -1
- package/src/io/formats/design-tokens/project.ts +40 -9
- package/src/io/formats/design-tokens/styles.ts +10 -2
- package/src/io/formats/design-tokens/sync/apply.ts +130 -0
- package/src/io/formats/design-tokens/sync/drift.ts +587 -0
- package/src/io/formats/design-tokens/sync/files.ts +40 -0
- package/src/io/formats/drawio/edges.ts +65 -0
- package/src/io/formats/drawio/export.ts +37 -14
- package/src/io/formats/drawio/index.ts +2 -0
- package/src/io/formats/fig/export/patch/index.ts +8 -0
- package/src/io/formats/fig/thumbnail-page.ts +4 -4
- package/src/io/formats/html/import.ts +9 -1
- package/src/io/formats/html/index.ts +14 -7
- package/src/io/formats/html/vectors.ts +8 -2
- package/src/io/formats/pdf/document.ts +14 -4
- package/src/io/formats/pen/imports.ts +5 -6
- package/src/io/formats/pen/index.ts +36 -5
- package/src/io/formats/raster/adjusted-images.ts +125 -0
- package/src/io/formats/raster/headless.ts +3 -3
- package/src/io/formats/raster/index.ts +6 -1
- package/src/io/formats/raster/pixels.ts +7 -0
- package/src/io/formats/raster/render.ts +12 -1
- package/src/io/formats/svg/defs.ts +4 -72
- package/src/io/formats/svg/effects.ts +131 -0
- package/src/io/formats/svg/export.ts +278 -46
- package/src/io/formats/svg/filter.ts +47 -0
- package/src/io/formats/svg/grain.ts +249 -0
- package/src/io/formats/svg/strokes.ts +2 -2
- package/src/io/formats/svg/text/layout.ts +13 -3
- package/src/io/formats/video/composite.ts +79 -0
- package/src/io/formats/video/formats.ts +77 -0
- package/src/io/formats/video/gif.ts +65 -0
- package/src/io/formats/video/index.ts +30 -0
- package/src/io/formats/video/plan.ts +116 -0
- package/src/io/formats/video/record.ts +227 -0
- package/src/io/formats/video/sink.ts +32 -0
- package/src/io/formats/video/size.ts +25 -0
- package/src/io/formats/video/webcodecs.ts +89 -0
- package/src/io/formats.ts +59 -11
- package/src/io/types.ts +29 -10
- package/src/layout/auto-layout-handles.ts +396 -0
- package/src/layout.ts +2 -0
- package/src/lint/fixes.ts +12 -3
- package/src/lint/index.ts +3 -1
- package/src/lint/linter.ts +107 -10
- package/src/lint/presets.ts +2 -0
- package/src/lint/rules/design-memory.ts +97 -0
- package/src/lint/rules/index.ts +6 -1
- package/src/lint/rules/no-unbound-token-values.ts +73 -0
- package/src/lint/types.ts +32 -0
- package/src/node/video.ts +196 -0
- package/src/pairdraw-api/design-memory.ts +61 -0
- package/src/pairdraw-api/index.ts +81 -0
- package/src/pairdraw-api/nodes.ts +38 -0
- package/src/pairdraw-api/variations.ts +109 -0
- package/src/prototype/easing.ts +37 -0
- package/src/prototype/frames.ts +9 -0
- package/src/prototype/hit.ts +70 -0
- package/src/prototype/index.ts +69 -0
- package/src/prototype/pointer.ts +146 -0
- package/src/prototype/reactions.ts +178 -0
- package/src/prototype/scene.ts +116 -0
- package/src/prototype/scenes.ts +256 -0
- package/src/prototype/scroll.ts +190 -0
- package/src/prototype/session.ts +188 -0
- package/src/prototype/smart-animate/animation.ts +267 -0
- package/src/prototype/smart-animate/match.ts +85 -0
- package/src/prototype/snapshot.ts +60 -0
- package/src/prototype/timeline.ts +400 -0
- package/src/text/font/features.ts +27 -0
- package/src/text/font/manager.ts +79 -1
- package/src/text/index.ts +2 -0
- package/src/text/replace-fonts.ts +171 -0
- package/src/tools/analyze/responsive/index.ts +264 -0
- package/src/tools/analyze.ts +2 -0
- package/src/tools/codegen/token-sync.ts +98 -0
- package/src/tools/codegen.ts +1 -0
- package/src/tools/create/components.ts +4 -0
- package/src/tools/create/html.ts +1 -0
- package/src/tools/create/icons.ts +1 -0
- package/src/tools/create/mermaid.ts +1 -0
- package/src/tools/create/svg.ts +1 -0
- package/src/tools/design-memory.ts +72 -0
- package/src/tools/image-ai/generate.ts +2 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/modify/fonts.ts +34 -0
- package/src/tools/modify/reactions.ts +15 -8
- package/src/tools/modify/text.ts +42 -5
- package/src/tools/modify/update.ts +46 -2
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/fonts.ts +24 -2
- package/src/tools/read/libraries.ts +1 -0
- package/src/tools/read/space.ts +3 -2
- package/src/tools/registry/core.ts +3 -1
- package/src/tools/registry/extended.ts +28 -1
- package/src/tools/schema.ts +28 -4
- package/src/tools/stock-photo.ts +1 -0
- package/src/tools/structure/basic.ts +1 -0
- package/src/tools/structure/batch.ts +12 -1
- package/src/tools/structure/hierarchy.ts +4 -0
- package/src/tools/structure/variations.ts +118 -0
- package/src/tools/structure.ts +2 -0
- package/src/tools/styles/types.ts +3 -4
- package/src/tools/vector/boolean.ts +4 -0
- package/src/tools/vector/vectorize.ts +1 -0
- package/src/tools/vector/video.ts +228 -0
- package/src/tools/vector.ts +1 -0
- package/src/tools/video-host.ts +18 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import { colorToHex } from '@pairdraw/scene-graph/color'
|
|
3
|
+
import type { DesignMemoryGroup } from '@pairdraw/scene-graph/design-memory'
|
|
4
|
+
import { AUTO_LAYOUT_FIELDS, CORNER_FIELDS } from '@pairdraw/scene-graph/fields'
|
|
5
|
+
|
|
6
|
+
/** A value on a layer that a group of the memory judges. */
|
|
7
|
+
export interface DesignValue {
|
|
8
|
+
group: DesignMemoryGroup
|
|
9
|
+
/** The layer field that holds it, which an edit changes. */
|
|
10
|
+
field: keyof SceneNode
|
|
11
|
+
/** Where on the layer, such as `fills/0/color` or `styleRuns/2/fontSize`. */
|
|
12
|
+
path: string
|
|
13
|
+
value: string | number
|
|
14
|
+
/** Bound to a variable or given by a shared style, so the system's by construction. */
|
|
15
|
+
fromSystem: boolean
|
|
16
|
+
/** Judged at most as a warning: gradient stops and shadow colors are content as much as tokens. */
|
|
17
|
+
soft: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Gaps and padding, which the spacing group judges. */
|
|
21
|
+
const SPACING_FIELDS: readonly (keyof SceneNode)[] = AUTO_LAYOUT_FIELDS.filter((field) =>
|
|
22
|
+
/^padding|Spacing$|Gap$/.test(field)
|
|
23
|
+
)
|
|
24
|
+
/** Each corner's own radius, judged when the corners differ. */
|
|
25
|
+
const CORNER_RADIUS_FIELDS: readonly (keyof SceneNode)[] = CORNER_FIELDS.filter(
|
|
26
|
+
(field) => field !== 'cornerRadius' && field.endsWith('Radius')
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function paintValues(node: SceneNode, field: 'fills' | 'strokes', styled: boolean): DesignValue[] {
|
|
30
|
+
return node[field].flatMap((paint, index): DesignValue[] => {
|
|
31
|
+
if (!paint.visible) return []
|
|
32
|
+
const path = `${field}/${index}/color`
|
|
33
|
+
if (paint.type === 'SOLID') {
|
|
34
|
+
const fromSystem = styled || Boolean(node.boundVariables[path])
|
|
35
|
+
return [
|
|
36
|
+
{ group: 'colors', field, path, value: colorToHex(paint.color), fromSystem, soft: false }
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
return (paint.gradientStops ?? []).map((stop, stopIndex): DesignValue => ({
|
|
40
|
+
group: 'colors',
|
|
41
|
+
field,
|
|
42
|
+
path: `${field}/${index}/gradientStops/${stopIndex}`,
|
|
43
|
+
value: colorToHex(stop.color),
|
|
44
|
+
fromSystem: styled,
|
|
45
|
+
soft: true
|
|
46
|
+
}))
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function textValues(node: SceneNode): DesignValue[] {
|
|
51
|
+
const values: DesignValue[] = []
|
|
52
|
+
const styled = Boolean(node.textStyleId)
|
|
53
|
+
values.push({
|
|
54
|
+
group: 'fonts',
|
|
55
|
+
field: 'fontFamily',
|
|
56
|
+
path: 'fontFamily',
|
|
57
|
+
value: node.fontFamily,
|
|
58
|
+
fromSystem: styled || Boolean(node.boundVariables.fontFamily),
|
|
59
|
+
soft: false
|
|
60
|
+
})
|
|
61
|
+
values.push({
|
|
62
|
+
group: 'fontSizes',
|
|
63
|
+
field: 'fontSize',
|
|
64
|
+
path: 'fontSize',
|
|
65
|
+
value: node.fontSize,
|
|
66
|
+
fromSystem: styled || Boolean(node.boundVariables.fontSize),
|
|
67
|
+
soft: false
|
|
68
|
+
})
|
|
69
|
+
node.styleRuns.forEach(({ style }, index) => {
|
|
70
|
+
const runStyled = Boolean(style.textStyleId)
|
|
71
|
+
if (style.fontFamily !== undefined)
|
|
72
|
+
values.push({
|
|
73
|
+
group: 'fonts',
|
|
74
|
+
field: 'styleRuns',
|
|
75
|
+
path: `styleRuns/${index}/fontFamily`,
|
|
76
|
+
value: style.fontFamily,
|
|
77
|
+
fromSystem: runStyled || Boolean(style.boundVariables?.fontFamily),
|
|
78
|
+
soft: false
|
|
79
|
+
})
|
|
80
|
+
if (style.fontSize !== undefined)
|
|
81
|
+
values.push({
|
|
82
|
+
group: 'fontSizes',
|
|
83
|
+
field: 'styleRuns',
|
|
84
|
+
path: `styleRuns/${index}/fontSize`,
|
|
85
|
+
value: style.fontSize,
|
|
86
|
+
fromSystem: runStyled || Boolean(style.boundVariables?.fontSize),
|
|
87
|
+
soft: false
|
|
88
|
+
})
|
|
89
|
+
style.fills?.forEach((paint, paintIndex) => {
|
|
90
|
+
if (paint.type !== 'SOLID' || !paint.visible) return
|
|
91
|
+
values.push({
|
|
92
|
+
group: 'colors',
|
|
93
|
+
field: 'styleRuns',
|
|
94
|
+
path: `styleRuns/${index}/fills/${paintIndex}`,
|
|
95
|
+
value: colorToHex(paint.color),
|
|
96
|
+
fromSystem: Boolean(style.fillStyleId),
|
|
97
|
+
soft: false
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
return values
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function layoutValues(node: SceneNode): DesignValue[] {
|
|
105
|
+
if (node.layoutMode === 'NONE') return []
|
|
106
|
+
// The cross-axis gap counts only when rows wrap, and the grid gaps only in a grid.
|
|
107
|
+
const fields = SPACING_FIELDS.filter((field) => {
|
|
108
|
+
if (field === 'counterAxisSpacing') return node.layoutWrap === 'WRAP'
|
|
109
|
+
if (field.endsWith('Gap')) return node.layoutMode === 'GRID'
|
|
110
|
+
return node.layoutMode !== 'GRID' || field.startsWith('padding')
|
|
111
|
+
})
|
|
112
|
+
return fields.flatMap((field): DesignValue[] => {
|
|
113
|
+
const value = node[field]
|
|
114
|
+
if (typeof value !== 'number' || value === 0) return []
|
|
115
|
+
const fromSystem = Boolean(node.boundVariables[field])
|
|
116
|
+
return [{ group: 'spacing', field, path: field, value, fromSystem, soft: false }]
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function radiusValues(node: SceneNode): DesignValue[] {
|
|
121
|
+
// A pill's radius follows its size, so no scale step describes it.
|
|
122
|
+
const pill = Math.min(node.width, node.height) / 2
|
|
123
|
+
const fields: readonly (keyof SceneNode)[] = node.independentCorners
|
|
124
|
+
? CORNER_RADIUS_FIELDS
|
|
125
|
+
: ['cornerRadius']
|
|
126
|
+
return fields.flatMap((field): DesignValue[] => {
|
|
127
|
+
const value = node[field]
|
|
128
|
+
if (typeof value !== 'number' || value <= 0 || (pill > 0 && value >= pill)) return []
|
|
129
|
+
const fromSystem = Boolean(node.boundVariables[field])
|
|
130
|
+
return [{ group: 'radius', field, path: field, value, fromSystem, soft: false }]
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function effectValues(node: SceneNode): DesignValue[] {
|
|
135
|
+
return node.effects.flatMap((effect, index): DesignValue[] => {
|
|
136
|
+
if (!effect.visible || (effect.type !== 'DROP_SHADOW' && effect.type !== 'INNER_SHADOW'))
|
|
137
|
+
return []
|
|
138
|
+
const fromSystem = Boolean(node.effectStyleId)
|
|
139
|
+
const value = colorToHex(effect.color)
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
group: 'colors',
|
|
143
|
+
field: 'effects',
|
|
144
|
+
path: `effects/${index}/color`,
|
|
145
|
+
value,
|
|
146
|
+
fromSystem,
|
|
147
|
+
soft: true
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Every value on the layer that the memory judges. A style's own layer defines the system. */
|
|
154
|
+
export function designValues(node: SceneNode): DesignValue[] {
|
|
155
|
+
if (node.sharedStyleType) return []
|
|
156
|
+
const text = node.type === 'TEXT' ? textValues(node) : []
|
|
157
|
+
const fillStyled = Boolean(node.fillStyleId)
|
|
158
|
+
return [
|
|
159
|
+
...paintValues(node, 'fills', fillStyled),
|
|
160
|
+
...paintValues(node, 'strokes', Boolean(node.strokeStyleId)),
|
|
161
|
+
...effectValues(node),
|
|
162
|
+
...text,
|
|
163
|
+
...layoutValues(node),
|
|
164
|
+
...radiusValues(node)
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** How a value is told apart from others of its group: a color as `#RRGGBB`, a font in lowercase. */
|
|
169
|
+
export function designValueKey(group: DesignMemoryGroup, value: string | number): string {
|
|
170
|
+
return `${group}:${typeof value === 'string' ? value.toLowerCase() : value}`
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* A value's key with whether it only warns, so a copied gradient stop or shadow color never
|
|
175
|
+
* vouches for a fill of the same color.
|
|
176
|
+
*/
|
|
177
|
+
export function copiedValueKey(value: DesignValue): string {
|
|
178
|
+
return `${value.soft ? 'soft:' : ''}${designValueKey(value.group, value.value)}`
|
|
179
|
+
}
|
|
@@ -28,6 +28,8 @@ export function createComponentBridge(
|
|
|
28
28
|
createInstanceFromComponent: components.createInstanceFromComponent,
|
|
29
29
|
detachInstance: () => components.detachInstance(selection.getSelectedNode()),
|
|
30
30
|
instanceHasOverrides: components.instanceHasOverrides,
|
|
31
|
+
canPushInstanceOverrides: (id: string) => components.canPushInstanceOverrides(id),
|
|
32
|
+
pushInstanceOverrides: (id: string) => components.pushInstanceOverrides(id),
|
|
31
33
|
resetInstanceOverrides: (id: string) => components.resetInstanceOverrides(id),
|
|
32
34
|
canConvertToFrame: components.canConvertToFrame,
|
|
33
35
|
componentInstanceCount: components.componentInstanceCount,
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import { selectionToJSX } from '@pairdraw/design-jsx'
|
|
2
2
|
|
|
3
3
|
import type { EditorContext } from '#core/editor/types'
|
|
4
|
+
import type { BooleanPathResolver } from '#core/io/formats/boolean-path'
|
|
4
5
|
import { renderNodesToLaidOutSVG } from '#core/io/formats/svg/text/layout'
|
|
5
6
|
|
|
6
7
|
export function createClipboardExportActions(ctx: EditorContext) {
|
|
8
|
+
/**
|
|
9
|
+
* The copies compute an authored boolean's result with the app's own renderer, as an export
|
|
10
|
+
* does, so copying never loads a second CanvasKit; a headless editor falls back to one. The
|
|
11
|
+
* module is imported on copy rather than statically because it carries the raster renderer,
|
|
12
|
+
* which the editor would otherwise load for a feature most copies never use.
|
|
13
|
+
*/
|
|
14
|
+
async function booleanPath(): Promise<BooleanPathResolver | undefined> {
|
|
15
|
+
const { booleanPathResolver, needsBooleanPaths } = await import('#core/io/formats/boolean-path')
|
|
16
|
+
if (!needsBooleanPaths(ctx.graph)) return undefined
|
|
17
|
+
return booleanPathResolver(ctx.getCk() ?? undefined, ctx.getRenderer() ?? undefined)
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
function copySelectionAsText(ids: string[]): string {
|
|
8
21
|
return ids.map((id) => ctx.graph.getNode(id)?.name ?? id).join('\n')
|
|
9
22
|
}
|
|
10
23
|
|
|
11
|
-
function copySelectionAsSVG(ids: string[]): Promise<string | null> {
|
|
24
|
+
async function copySelectionAsSVG(ids: string[]): Promise<string | null> {
|
|
12
25
|
const nodeIds =
|
|
13
26
|
ids.length > 0 ? ids : ctx.graph.getChildren(ctx.state.currentPageId).map((n) => n.id)
|
|
14
|
-
return renderNodesToLaidOutSVG(ctx.graph, ctx.state.currentPageId, nodeIds
|
|
27
|
+
return renderNodesToLaidOutSVG(ctx.graph, ctx.state.currentPageId, nodeIds, {
|
|
28
|
+
booleanPath: await booleanPath()
|
|
29
|
+
})
|
|
15
30
|
}
|
|
16
31
|
|
|
17
32
|
function copySelectionAsJSX(ids: string[]): string | null {
|
|
@@ -26,11 +41,13 @@ export function createClipboardExportActions(ctx: EditorContext) {
|
|
|
26
41
|
async function copySelectionAsHTML(ids: string[]): Promise<string | null> {
|
|
27
42
|
if (ids.length === 0) return null
|
|
28
43
|
const { renderNodesToHTML } = await import('#core/io/formats/html')
|
|
29
|
-
const { html } = await renderNodesToHTML(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
assets: 'inline'
|
|
33
|
-
|
|
44
|
+
const { html } = await renderNodesToHTML(
|
|
45
|
+
ctx.graph,
|
|
46
|
+
ids,
|
|
47
|
+
{ html: 'fragment', style: 'inline', assets: 'inline' },
|
|
48
|
+
undefined,
|
|
49
|
+
{ canvasKit: ctx.getCk() ?? undefined, renderer: ctx.getRenderer() ?? undefined }
|
|
50
|
+
)
|
|
34
51
|
return html || null
|
|
35
52
|
}
|
|
36
53
|
|
|
@@ -8,12 +8,16 @@ import {
|
|
|
8
8
|
import Matrix from '@pairdraw/scene-graph/matrix'
|
|
9
9
|
import type { Vector } from '@pairdraw/scene-graph/primitives'
|
|
10
10
|
|
|
11
|
+
import { getNodeEditCapability } from '#core/editor/capabilities'
|
|
11
12
|
import { prepareSlotEdits } from '#core/editor/components/slots'
|
|
12
13
|
import { recordSubtreeEdit } from '#core/editor/components/slots/history'
|
|
14
|
+
import { recordEdit } from '#core/editor/history/edit'
|
|
13
15
|
import { restoreSubtree, snapshotSubtree } from '#core/editor/history/subtree'
|
|
14
16
|
import type { EditorContext } from '#core/editor/types'
|
|
15
17
|
import {
|
|
18
|
+
canPushInstanceOverrides as canPushInstanceOverridesInGraph,
|
|
16
19
|
instanceOverrides,
|
|
20
|
+
pushInstanceOverrides as pushInstanceOverridesInGraph,
|
|
17
21
|
resetInstanceOverrides as resetInstanceOverridesInGraph
|
|
18
22
|
} from '#core/figma-api/overrides'
|
|
19
23
|
|
|
@@ -179,10 +183,37 @@ export function createComponentInstanceActions(ctx: EditorContext) {
|
|
|
179
183
|
)
|
|
180
184
|
}
|
|
181
185
|
|
|
186
|
+
/** Whether a library owns the main component, whose changes only its library can take. */
|
|
187
|
+
function mainComponentEditable(componentId: string): boolean {
|
|
188
|
+
return getNodeEditCapability(ctx.graph, componentId).editable
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Figma's Push changes to main component: the instance's edits move to its main component,
|
|
193
|
+
* and the instance follows them. A library's main component cannot take them.
|
|
194
|
+
*/
|
|
195
|
+
function canPushInstanceOverrides(id: string): boolean {
|
|
196
|
+
const node = ctx.graph.getNode(id)
|
|
197
|
+
return (
|
|
198
|
+
node?.type === 'INSTANCE' &&
|
|
199
|
+
canPushInstanceOverridesInGraph(ctx.graph, node, mainComponentEditable)
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function pushInstanceOverridesFromSelection(id: string): boolean {
|
|
204
|
+
const node = ctx.graph.getNode(id)
|
|
205
|
+
if (node?.type !== 'INSTANCE' || !canPushInstanceOverrides(id)) return false
|
|
206
|
+
return recordEdit(ctx, { label: 'Push changes to main component' }, () =>
|
|
207
|
+
pushInstanceOverridesInGraph(ctx.graph, node, mainComponentEditable)
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
182
211
|
return {
|
|
183
212
|
createInstanceFromComponent,
|
|
184
213
|
detachInstance,
|
|
185
214
|
instanceHasOverrides,
|
|
215
|
+
canPushInstanceOverrides,
|
|
216
|
+
pushInstanceOverrides: pushInstanceOverridesFromSelection,
|
|
186
217
|
resetInstanceOverrides: resetInstanceOverridesFromSelection
|
|
187
218
|
}
|
|
188
219
|
}
|
package/src/editor/create.ts
CHANGED
|
@@ -18,7 +18,6 @@ import { releaseFigPopulationWorker } from '#core/kiwi/fig/population/client'
|
|
|
18
18
|
import { releaseOriginalFigArchive } from '#core/kiwi/fig/session/original-archive'
|
|
19
19
|
import { installTextMeasurer } from '#core/layout'
|
|
20
20
|
import { createLayoutRunner } from '#core/layout/mutations'
|
|
21
|
-
import { emitNavigationTrace } from '#core/profiler'
|
|
22
21
|
import { TextEditor } from '#core/text/editor'
|
|
23
22
|
import { fontManager } from '#core/text/font/manager'
|
|
24
23
|
import { fontResolver } from '#core/text/resolver'
|
|
@@ -39,9 +38,11 @@ import { createConnectorDrawActions, createConnectorEndpointActions } from './co
|
|
|
39
38
|
import { createConnectorLineActions } from './connectors/line'
|
|
40
39
|
import { createConnectorRouting } from './connectors/routing'
|
|
41
40
|
import { createConnectorStyleActions } from './connectors/style'
|
|
41
|
+
import { createDesignMemoryActions } from './design-memory'
|
|
42
42
|
import { createDesignTokenActions } from './design-tokens'
|
|
43
43
|
import { createDocumentSettingsActions } from './document-settings'
|
|
44
44
|
import { createFigCompressionActions } from './fig-compression'
|
|
45
|
+
import { createFontActions } from './fonts'
|
|
45
46
|
import { createGraphEventSubscription } from './graph-events'
|
|
46
47
|
import { createGraphReadActions } from './graph-reads'
|
|
47
48
|
import { createGuideActions } from './guides'
|
|
@@ -52,6 +53,7 @@ import { createLineEndActions } from './line-ends'
|
|
|
52
53
|
import { createNodeActions } from './nodes'
|
|
53
54
|
import { createPageActions } from './pages'
|
|
54
55
|
import { createReadOnlyActions, guardReadOnly, guardUndo } from './read-only'
|
|
56
|
+
import { createRenderRequests } from './render-requests'
|
|
55
57
|
import { createScaleActions } from './scale'
|
|
56
58
|
import { createSelectionActions } from './selection'
|
|
57
59
|
import { createShaderActions } from './shaders/actions'
|
|
@@ -77,6 +79,7 @@ import type {
|
|
|
77
79
|
} from './types'
|
|
78
80
|
import { createUndoActions } from './undo'
|
|
79
81
|
import { createVariableActions } from './variables'
|
|
82
|
+
import { createVariationActions } from './variations'
|
|
80
83
|
import { createVectorizeActions } from './vectorize'
|
|
81
84
|
import { createViewportActions, NO_VIEWPORT_INSETS } from './viewport'
|
|
82
85
|
import { createCanvasViewActions, offeredTool, resolveEditorProfile } from './views'
|
|
@@ -156,46 +159,13 @@ export function createEditor(options?: EditorOptions) {
|
|
|
156
159
|
return events.on(event, handler)
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
sceneVersion: state.sceneVersion
|
|
167
|
-
})
|
|
168
|
-
emitEditorEvent('render:requested', {
|
|
169
|
-
renderVersion: state.renderVersion,
|
|
170
|
-
sceneVersion: state.sceneVersion
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* The caret or selection of the edited text moved: the canvas repaints its overlay and the
|
|
176
|
-
* views that follow the selection update, without the document counting as changed.
|
|
177
|
-
*/
|
|
178
|
-
function textSelectionChanged() {
|
|
179
|
-
state.textSelectionVersion++
|
|
180
|
-
requestRepaint()
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function requestRefresh() {
|
|
184
|
-
state.sceneVersion++
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function requestRepaint() {
|
|
188
|
-
state.renderVersion++
|
|
189
|
-
emitNavigationTrace('render:requested', {
|
|
190
|
-
kind: 'repaint',
|
|
191
|
-
renderVersion: state.renderVersion,
|
|
192
|
-
sceneVersion: state.sceneVersion
|
|
193
|
-
})
|
|
194
|
-
emitEditorEvent('repaint:requested', {
|
|
195
|
-
renderVersion: state.renderVersion,
|
|
196
|
-
sceneVersion: state.sceneVersion
|
|
197
|
-
})
|
|
198
|
-
}
|
|
162
|
+
const {
|
|
163
|
+
requestRender,
|
|
164
|
+
requestRefresh,
|
|
165
|
+
requestRepaint,
|
|
166
|
+
textSelectionChanged,
|
|
167
|
+
setNavigationPhase
|
|
168
|
+
} = createRenderRequests(state, emitEditorEvent)
|
|
199
169
|
|
|
200
170
|
/** Track an actual live edit independently of history batching. Release is idempotent. */
|
|
201
171
|
function beginInteractiveEdit() {
|
|
@@ -207,31 +177,6 @@ export function createEditor(options?: EditorOptions) {
|
|
|
207
177
|
}
|
|
208
178
|
}
|
|
209
179
|
|
|
210
|
-
function setNavigationPhase(phase: EditorState['navigation']['phase'], inputAt = 0) {
|
|
211
|
-
const previous = { ...state.navigation }
|
|
212
|
-
const active = phase === 'pan' || phase === 'zoom' || phase === 'momentum'
|
|
213
|
-
const wasActive =
|
|
214
|
-
previous.phase === 'pan' || previous.phase === 'zoom' || previous.phase === 'momentum'
|
|
215
|
-
state.navigation = {
|
|
216
|
-
phase,
|
|
217
|
-
generation: active && !wasActive ? previous.generation + 1 : previous.generation,
|
|
218
|
-
lastInputAt: inputAt || previous.lastInputAt
|
|
219
|
-
}
|
|
220
|
-
if (
|
|
221
|
-
state.navigation.phase !== previous.phase ||
|
|
222
|
-
state.navigation.generation !== previous.generation ||
|
|
223
|
-
state.navigation.lastInputAt !== previous.lastInputAt
|
|
224
|
-
) {
|
|
225
|
-
emitNavigationTrace('navigation:phase', {
|
|
226
|
-
phase: state.navigation.phase,
|
|
227
|
-
previousPhase: previous.phase,
|
|
228
|
-
generation: state.navigation.generation,
|
|
229
|
-
lastInputAt: state.navigation.lastInputAt
|
|
230
|
-
})
|
|
231
|
-
emitEditorEvent('navigation:changed', state.navigation, previous)
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
180
|
function setSelectedIds(ids: Set<string>) {
|
|
236
181
|
const previous = [...state.selectedIds]
|
|
237
182
|
state.selectedIds = ids
|
|
@@ -337,6 +282,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
337
282
|
const documentSettings = createDocumentSettingsActions(ctx)
|
|
338
283
|
const undoActions = createUndoActions(ctx)
|
|
339
284
|
const text = createTextActions(ctx)
|
|
285
|
+
const fonts = createFontActions(ctx)
|
|
340
286
|
const nodes = createNodeActions(ctx)
|
|
341
287
|
const shapes = createShapeActions(ctx, nodes.updateNodeWithUndo)
|
|
342
288
|
const clipboardProperties = createClipboardPropertiesActions(
|
|
@@ -353,6 +299,8 @@ export function createEditor(options?: EditorOptions) {
|
|
|
353
299
|
const shapesWithText = createShapeWithTextActions(ctx, nodes)
|
|
354
300
|
const generatedText = createGeneratedTextActions(ctx, nodes)
|
|
355
301
|
const statuses = createStatusActions(ctx)
|
|
302
|
+
const designMemory = createDesignMemoryActions(ctx)
|
|
303
|
+
const variations = createVariationActions(ctx)
|
|
356
304
|
const figCompression = createFigCompressionActions(ctx)
|
|
357
305
|
createConnectorRouting(ctx)
|
|
358
306
|
const connectorDrawing = createConnectorDrawActions(ctx)
|
|
@@ -406,6 +354,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
406
354
|
function setCanvasKit(ck: CanvasKit, renderer: SkiaRenderer) {
|
|
407
355
|
_ck = ck
|
|
408
356
|
_renderer = renderer
|
|
357
|
+
const first = _renderers.size === 0
|
|
409
358
|
_renderers.add(renderer)
|
|
410
359
|
_textEditor ??= new TextEditor(ck)
|
|
411
360
|
uninstallTextMeasurer?.()
|
|
@@ -415,6 +364,9 @@ export function createEditor(options?: EditorOptions) {
|
|
|
415
364
|
pendingTextLayout.measure(renderer, node, maxWidth)
|
|
416
365
|
)
|
|
417
366
|
: null
|
|
367
|
+
// A page shown before this editor had a canvas to measure its text, as one a tab opens while
|
|
368
|
+
// its canvas loads, is laid out now that one can.
|
|
369
|
+
if (first) pages.layOutStaleCurrentPage()
|
|
418
370
|
}
|
|
419
371
|
|
|
420
372
|
function releaseTextMeasurer() {
|
|
@@ -485,9 +437,9 @@ export function createEditor(options?: EditorOptions) {
|
|
|
485
437
|
unsubscribeFromGraph()
|
|
486
438
|
}
|
|
487
439
|
|
|
488
|
-
function releaseGraphResources() {
|
|
489
|
-
releaseFigPopulationWorker(
|
|
490
|
-
releaseOriginalFigArchive(
|
|
440
|
+
function releaseGraphResources(graph: SceneGraph = _graph) {
|
|
441
|
+
releaseFigPopulationWorker(graph)
|
|
442
|
+
releaseOriginalFigArchive(graph)
|
|
491
443
|
}
|
|
492
444
|
|
|
493
445
|
const editor = {
|
|
@@ -577,6 +529,9 @@ export function createEditor(options?: EditorOptions) {
|
|
|
577
529
|
getShownStatus: statuses.getShownStatus,
|
|
578
530
|
setStatus: statuses.setStatus,
|
|
579
531
|
setStatusWorkflow: statuses.setStatusWorkflow,
|
|
532
|
+
...designMemory,
|
|
533
|
+
// Variations: copies of a layer side by side, one of which can replace it
|
|
534
|
+
...variations,
|
|
580
535
|
...connectorDrawing,
|
|
581
536
|
...connectorEndpoints,
|
|
582
537
|
...connectorLines,
|
|
@@ -592,6 +547,7 @@ export function createEditor(options?: EditorOptions) {
|
|
|
592
547
|
|
|
593
548
|
// Text editing
|
|
594
549
|
...text,
|
|
550
|
+
...fonts,
|
|
595
551
|
...textHyperlinks,
|
|
596
552
|
|
|
597
553
|
// Viewport
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cachedDesignMemory, type DesignMemory } from '@pairdraw/scene-graph/design-memory'
|
|
2
|
+
import {
|
|
3
|
+
PAIRDRAW_PLUGIN_DATA,
|
|
4
|
+
readPluginData,
|
|
5
|
+
withPluginData
|
|
6
|
+
} from '@pairdraw/scene-graph/plugin-data'
|
|
7
|
+
|
|
8
|
+
import type { EditorContext } from './types'
|
|
9
|
+
|
|
10
|
+
/** The document's design memory, and the command that replaces it. */
|
|
11
|
+
export function createDesignMemoryActions(ctx: EditorContext) {
|
|
12
|
+
function designMemory(): DesignMemory | null {
|
|
13
|
+
return cachedDesignMemory(ctx.graph)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Replaces the document's design memory, or removes it with null, as one undo step labelled
|
|
18
|
+
* `label`. Undo restores only the memory, so comments written meanwhile on the document node
|
|
19
|
+
* stay.
|
|
20
|
+
*/
|
|
21
|
+
function setDesignMemory(next: DesignMemory | null, label = 'Edit design memory'): void {
|
|
22
|
+
const field = PAIRDRAW_PLUGIN_DATA.designMemory
|
|
23
|
+
const rootId = ctx.graph.rootId
|
|
24
|
+
const previous = readPluginData(ctx.graph.getNode(rootId)?.pluginData, field)
|
|
25
|
+
const write = (value: DesignMemory | undefined) => {
|
|
26
|
+
const root = ctx.graph.getNode(rootId)
|
|
27
|
+
if (!root) return
|
|
28
|
+
ctx.graph.updateNode(rootId, {
|
|
29
|
+
pluginData: withPluginData(root.pluginData, field, value && structuredClone(value))
|
|
30
|
+
})
|
|
31
|
+
ctx.requestRender()
|
|
32
|
+
}
|
|
33
|
+
const value = next ?? undefined
|
|
34
|
+
write(value)
|
|
35
|
+
ctx.undo.push({ label, forward: () => write(value), inverse: () => write(previous) })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return { designMemory, setDesignMemory }
|
|
39
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { SceneNode } from '@pairdraw/scene-graph'
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import {
|
|
3
|
+
readTokenSources,
|
|
4
|
+
tokenSourcesPluginData,
|
|
5
|
+
type TokenSource
|
|
6
|
+
} from '@pairdraw/scene-graph/token-sources'
|
|
2
7
|
|
|
3
8
|
// Not the format's barrel: the editor always loads this file, and the exporter is loaded on demand.
|
|
4
9
|
import {
|
|
@@ -82,5 +87,39 @@ export function createDesignTokenActions(
|
|
|
82
87
|
})
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Brings linked code in as one undo step: the imports in order, then the document's links as
|
|
92
|
+
* `sources` gives them once the imports are applied, so undo takes back both.
|
|
93
|
+
*/
|
|
94
|
+
function syncDesignTokens(
|
|
95
|
+
plans: readonly TokenImportPlan[],
|
|
96
|
+
sources: (graph: SceneGraph) => TokenSource[]
|
|
97
|
+
): TokenImportResult[] {
|
|
98
|
+
return ctx.undo.runBatch('Sync design tokens', () => {
|
|
99
|
+
const results = plans.map((plan) => applyTokenImport({ ...target, graph: ctx.graph }, plan))
|
|
100
|
+
writeTokenSources(sources(ctx.graph), 'Sync design tokens')
|
|
101
|
+
ctx.requestRender()
|
|
102
|
+
return results
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function writeTokenSources(sources: readonly TokenSource[], label: string) {
|
|
107
|
+
nodes.updateNodeWithUndo(
|
|
108
|
+
ctx.graph.rootId,
|
|
109
|
+
{ pluginData: tokenSourcesPluginData(ctx.graph, sources) },
|
|
110
|
+
label
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Forgets a link to code; the variables it brought in stay. */
|
|
115
|
+
function unlinkTokenSource(id: string) {
|
|
116
|
+
const sources = readTokenSources(ctx.graph)
|
|
117
|
+
if (!sources.some((source) => source.id === id)) return
|
|
118
|
+
writeTokenSources(
|
|
119
|
+
sources.filter((source) => source.id !== id),
|
|
120
|
+
'Unlink code'
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return { importDesignTokens, syncDesignTokens, unlinkTokenSource }
|
|
86
125
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'
|
|
2
|
+
import type { Color } from '@pairdraw/scene-graph/primitives'
|
|
3
|
+
|
|
4
|
+
/** A solid colour the page uses, and how many paints use it. */
|
|
5
|
+
export interface DocumentColor {
|
|
6
|
+
color: Color
|
|
7
|
+
/** Fill and stroke paints with this exact RGBA, across the page's visible layers. */
|
|
8
|
+
count: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** How many colours the picker lists; Figma's document colours stop at a screenful too. */
|
|
12
|
+
export const DOCUMENT_COLOR_LIMIT = 48
|
|
13
|
+
|
|
14
|
+
/** The RGBA as a map key; colours are kept exact, alpha included. */
|
|
15
|
+
function colorKey(color: Color): string {
|
|
16
|
+
return `${color.r},${color.g},${color.b},${color.a}`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The solid fills and strokes a page's visible layers use, most used first.
|
|
21
|
+
*
|
|
22
|
+
* One pass over the page tree. A hidden layer takes its whole subtree with it. Paints bound to a
|
|
23
|
+
* variable or covered by a colour style are left to the variable/style sections instead. Gradient,
|
|
24
|
+
* image, mesh, pattern, noise, video and custom paints are not listed: this list is for reusing a
|
|
25
|
+
* solid colour, not for its stops.
|
|
26
|
+
*/
|
|
27
|
+
export function documentColors(graph: SceneGraph, pageId: string): DocumentColor[] {
|
|
28
|
+
const colors = new Map<string, DocumentColor>()
|
|
29
|
+
|
|
30
|
+
const count = (color: Color) => {
|
|
31
|
+
const key = colorKey(color)
|
|
32
|
+
const entry = colors.get(key)
|
|
33
|
+
if (entry) entry.count++
|
|
34
|
+
else colors.set(key, { color: { r: color.r, g: color.g, b: color.b, a: color.a }, count: 1 })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const isBound = (node: SceneNode, path: string) => Object.hasOwn(node.boundVariables, path)
|
|
38
|
+
|
|
39
|
+
const walk = (node: SceneNode) => {
|
|
40
|
+
if (!node.visible) return
|
|
41
|
+
if (!node.fillStyleId) {
|
|
42
|
+
node.fills.forEach((fill, index) => {
|
|
43
|
+
if (fill.visible && fill.type === 'SOLID' && !isBound(node, `fills/${index}/color`))
|
|
44
|
+
count(fill.color)
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
if (!node.strokeStyleId) {
|
|
48
|
+
node.strokes.forEach((stroke, index) => {
|
|
49
|
+
if (stroke.visible && stroke.type === 'SOLID' && !isBound(node, `strokes/${index}/color`))
|
|
50
|
+
count(stroke.color)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
for (const childId of node.childIds) {
|
|
54
|
+
const child = graph.getNode(childId)
|
|
55
|
+
if (child) walk(child)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const page = graph.getNode(pageId)
|
|
60
|
+
if (page) walk(page)
|
|
61
|
+
|
|
62
|
+
return [...colors.values()]
|
|
63
|
+
.sort((a, b) => b.count - a.count || colorKey(a.color).localeCompare(colorKey(b.color)))
|
|
64
|
+
.slice(0, DOCUMENT_COLOR_LIMIT)
|
|
65
|
+
}
|