@pairdraw/core 0.17.0 → 0.19.0-beta.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/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/outline-stroke.d.ts.map +1 -1
- package/dist/canvas/outline-stroke.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/prototype.d.ts +2 -5
- package/dist/canvas/overlays/prototype.d.ts.map +1 -1
- package/dist/canvas/overlays/prototype.js +3 -19
- package/dist/canvas/overlays/prototype.js.map +1 -1
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +25 -10
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +26 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +50 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.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 +90 -54
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts +4 -3
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +13 -9
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +2 -9
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +18 -9
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +3 -3
- package/dist/canvas/text/placed.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -0
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +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/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +37 -7
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +18 -4
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +63 -10
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +104 -17
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +12 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/connectors.js +2 -14
- package/dist/geometry/connectors.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +3 -3
- package/dist/geometry/index.js +2 -2
- package/dist/geometry/scene.d.ts +3 -1
- package/dist/geometry/scene.d.ts.map +1 -1
- package/dist/geometry/scene.js +16 -1
- package/dist/geometry/scene.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -1
- package/dist/geometry/types.d.ts.map +1 -1
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +10 -0
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +32 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/shapes.d.ts +10 -5
- package/dist/io/formats/drawio/shapes.d.ts.map +1 -1
- package/dist/io/formats/drawio/shapes.js +10 -6
- package/dist/io/formats/drawio/shapes.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +11 -0
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -0
- package/dist/io/formats/drawio/warnings.js +23 -0
- package/dist/io/formats/drawio/warnings.js.map +1 -0
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- 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 +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts +10 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +96 -2
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +3 -2
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +3 -3
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +25 -14
- 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/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +8 -2
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +42 -8
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +3 -1
- package/dist/io/formats.js.map +1 -1
- package/dist/io/registry.d.ts +2 -0
- package/dist/io/registry.d.ts.map +1 -1
- package/dist/io/registry.js +5 -0
- package/dist/io/registry.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/io/types.d.ts +2 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +11 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +11 -2
- package/dist/lint/linter.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/rpc/variables-command.d.ts.map +1 -1
- package/dist/rpc/variables-command.js +4 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +16 -14
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +26 -3
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +135 -18
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +50 -6
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +178 -32
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +71 -71
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/path/caret.d.ts +2 -4
- package/dist/text/path/caret.d.ts.map +1 -1
- package/dist/text/path/caret.js.map +1 -1
- package/dist/text/prepare.d.ts +5 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +26 -3
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/text/web-font/assets.d.ts.map +1 -1
- package/dist/text/web-font/assets.js +13 -21
- package/dist/text/web-font/assets.js.map +1 -1
- package/dist/text/web-font/resolver.d.ts.map +1 -1
- package/dist/text/web-font/resolver.js +4 -1
- package/dist/text/web-font/resolver.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/components.d.ts +2 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +27 -1
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -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 +14 -6
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +13 -10
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/create.d.ts +2 -2
- package/dist/tools/create.js +2 -2
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/effects.d.ts.map +1 -1
- package/dist/tools/modify/effects.js +5 -3
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +9 -6
- 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 +7 -5
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +28 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +18 -4
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +6 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +30 -5
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +125 -7
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +86 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -2
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/export.d.ts.map +1 -1
- package/dist/tools/vector/export.js +5 -2
- package/dist/tools/vector/export.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/outline-stroke.ts +2 -6
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/prototype.ts +5 -27
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +42 -18
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +43 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +127 -77
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +14 -7
- package/src/canvas/text/index.ts +3 -9
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +19 -10
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/placed.ts +2 -2
- package/src/canvas/text/renderer.ts +2 -0
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +170 -19
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +16 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/connectors.ts +2 -12
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +2 -1
- package/src/geometry/scene.ts +19 -0
- package/src/geometry/types.ts +8 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/drawio/export.ts +11 -0
- package/src/io/formats/drawio/index.ts +36 -1
- package/src/io/formats/drawio/shapes.ts +13 -9
- package/src/io/formats/drawio/warnings.ts +27 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +125 -3
- package/src/io/formats/pdf/export.ts +3 -2
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +40 -14
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +66 -8
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/formats.ts +3 -1
- package/src/io/registry.ts +12 -0
- package/src/io/subgraph.ts +3 -1
- package/src/io/types.ts +2 -0
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +12 -2
- package/src/lint/linter.ts +12 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/rpc/variables-command.ts +6 -5
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +29 -15
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +163 -22
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +220 -49
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +106 -90
- package/src/text/path/caret.ts +3 -4
- package/src/text/prepare.ts +51 -2
- package/src/text/style-runs.ts +43 -16
- package/src/text/web-font/assets.ts +11 -15
- package/src/text/web-font/resolver.ts +7 -1
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/components.ts +33 -0
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +16 -6
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +20 -10
- package/src/tools/create.ts +1 -0
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/effects.ts +11 -4
- package/src/tools/modify/matching.ts +10 -6
- package/src/tools/modify/paint.ts +13 -5
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify/text.ts +53 -20
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +24 -4
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -3
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +6 -0
- package/src/tools/schema.ts +166 -6
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +84 -98
- package/src/tools/variables/values.ts +6 -3
- package/src/tools/vector/export.ts +5 -1
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placed.js","names":[],"sources":["../../../src/canvas/text/placed.ts"],"sourcesContent":["import type { Paragraph } from 'canvaskit-wasm'\nimport { uniq } from 'es-toolkit/array'\nimport { isEqual } from 'es-toolkit/predicate'\n\nimport type { SceneNode } from '@pairdraw/scene-graph'\nimport { textLengthPixels } from '@pairdraw/scene-graph/text'\nimport { resolveNodeTextDirection } from '@pairdraw/scene-graph/text/direction'\n\nimport {\n drawnFontVariations,\n loadedFace,\n paragraphSourceFamilies\n} from '#core/canvas/text/font-families'\nimport { laidOutText } from '#core/canvas/text/keycap'\nimport type { TextLayout, TextLayoutMarker } from '#core/canvas/text/layout'\nimport { utf16IndicesByUtf8 } from '#core/canvas/text/utf8'\nimport { DEFAULT_FONT_FAMILY } from '#core/constants'\nimport { shownCharacters } from '#core/text/case'\nimport { ELLIPSIS } from '#core/text/ellipsis'\nimport {\n glyphOutlineSourceSync,\n shardCovers,\n shardOutlineSources,\n type GlyphOutlineSource,\n type RunShaping,\n type ShapedGlyph\n} from '#core/text/font/glyphs'\nimport type { ShapingFeature } from '#core/text/font/harfbuzz'\nimport { fontManager } from '#core/text/font/manager'\nimport { textFontFace } from '#core/text/requirements/collect'\n\ntype GlyphRun = ReturnType<Paragraph['getShapedLines']>[number]['runs'][number]\n\n/** A glyph of laid-out text where the renderer draws it, with the font its outline comes from. */\nexport interface LaidOutGlyph {\n /** The glyph ID the shaper chose. */\n id: number\n x: number\n /** The baseline of its line. */\n y: number\n fontSize: number\n /** The character it draws, left out for a list marker. */\n firstCharacter?: number\n advance: number\n /** Where its line starts. */\n lineLeft: number\n /** The font that drew it, or `null` when the shaper may have used another. */\n source: GlyphOutlineSource | null\n}\n\n/** The loaded face of a family the paragraph draws a face in, as its key. */\nfunction loadedStyle(\n family: string,\n weight: number,\n italic: boolean,\n style: string\n): string | null {\n return loadedFace(family, weight, italic, style)?.style ?? null\n}\n\n/**\n * The font a character asks for: its family, weight, and slant, and the variable axes it sets;\n * and the face the paragraph asks every family for, the one its own family has loaded, as\n * `drawnFontStyle` asks CanvasKit.\n */\nfunction fontAt(node: SceneNode, index: number) {\n const run = styleRunAt(node, index)\n const family = run?.style.fontFamily ?? (node.fontFamily || DEFAULT_FONT_FAMILY)\n const weight = run?.style.fontWeight ?? node.fontWeight\n const italic = run?.style.italic ?? node.italic\n const style = textFontFace(node, run?.style).style\n const variations = drawnFontVariations({\n family,\n weight,\n italic,\n style,\n fontSize: run?.style.fontSize ?? node.fontSize,\n variations: run?.style.fontVariations ?? node.fontVariations,\n opticalSizeFromFontSize: run?.style.opticalSizeFromFontSize ?? node.opticalSizeFromFontSize\n })\n const drawn = loadedFace(family, weight, italic, style) ?? { weight, italic, style }\n return { family, weight, italic, style, variations, drawn }\n}\n\ntype StyleRun = SceneNode['styleRuns'][number]\n\nfunction styleRunAt(node: SceneNode, index: number): StyleRun | undefined {\n return node.styleRuns.find((item) => index >= item.start && index < item.start + item.length)\n}\n\n/**\n * The style run of each code unit of the shown text from `start` to `end`, scanning the node's\n * style runs only where one ends.\n */\nfunction styleRunsOver(\n node: SceneNode,\n start: number,\n end: number,\n sourceAt: (index: number) => number\n): Array<StyleRun | undefined> {\n const runs: Array<StyleRun | undefined> = []\n let current: StyleRun | undefined\n for (let index = start; index < end; index++) {\n const source = sourceAt(index)\n if (!current || source < current.start || source >= current.start + current.length)\n current = styleRunAt(node, source)\n runs.push(current)\n }\n return runs\n}\n\n/** The letter spacing a style run sets after each of its characters, in pixels. */\nfunction letterSpacingOf(node: SceneNode, run: StyleRun | undefined): number {\n return textLengthPixels(\n run?.style.letterSpacing ?? node.letterSpacing,\n run?.style.fontSize ?? node.fontSize\n )\n}\n\n/** The features a style run shapes its characters with, as CanvasKit is given them. */\nfunction featuresOf(node: SceneNode, run: StyleRun | undefined): ShapingFeature[] {\n return (run?.style.fontFeatures ?? node.fontFeatures).map((feature) => ({\n tag: feature.tag.toLowerCase(),\n value: feature.enabled ? 1 : 0\n }))\n}\n\n/**\n * The style a family of the paragraph is drawn in: the face its own family draws the asked style\n * in, and Regular for the Arabic and CJK fallbacks, as the paragraph asks CanvasKit for them.\n */\nfunction sourceStyle(family: string, font: ReturnType<typeof fontAt>): string | null {\n const scriptFallback =\n family !== font.family &&\n (fontManager.getArabicFallbackFamilies().includes(family) ||\n fontManager.getCJKFallbackFamilies().includes(family))\n if (scriptFallback) return fontManager.isStyleLoaded(family, 'Regular') ? 'Regular' : null\n return loadedStyle(family, font.drawn.weight, font.drawn.italic, font.drawn.style)\n}\n\n/**\n * The outline source of each file the paragraph may have drawn a character in, in its order:\n * each family's own file, then its shards.\n */\nfunction* candidateSources(font: ReturnType<typeof fontAt>) {\n for (const family of paragraphSourceFamilies(font.family)) {\n const style = sourceStyle(family, font)\n if (!style) continue\n const source = glyphOutlineSourceSync(family, style, font.variations)\n if (source) yield source\n yield* shardOutlineSources(family, style, font.variations)\n }\n}\n\n/** The face and file the paragraph draws a character in. */\nexport interface CharacterFace {\n family: string\n style: string\n /** Which of the style's files: 0 for its own, then its shards, as `FontManager.shardData` lists them. */\n file: number\n /** Whether it is not the character's own family. */\n fallback: boolean\n}\n\n/**\n * The loaded face the paragraph draws the character at `index` of `text` in, as it falls back:\n * of the fonts it lists, the style's own then its fallbacks, each file then its shards, the first\n * that maps the character.\n */\nexport function characterFace(node: SceneNode, text: string, index: number): CharacterFace | null {\n const codePoint = text.codePointAt(index)\n if (codePoint === undefined) return null\n const character = String.fromCodePoint(codePoint)\n const font = fontAt(node, index)\n for (const family of paragraphSourceFamilies(font.family)) {\n const style = sourceStyle(family, font)\n if (!style) continue\n const fallback = family !== font.family\n if (glyphOutlineSourceSync(family, style, font.variations)?.covers(character))\n return { family, style, file: 0, fallback }\n const shard = fontManager\n .shardData(family, style)\n .findIndex((data) => shardCovers(data, character))\n if (shard !== -1) return { family, style, file: shard + 1, fallback }\n }\n return null\n}\n\n/** The family the paragraph draws the character at `index` of `text` in; see {@link characterFace}. */\nexport function characterFamily(node: SceneNode, text: string, index: number): string | null {\n return characterFace(node, text, index)?.family ?? null\n}\n\n/** The characters of a run as the paragraph laid them out, and the features it shaped them with. */\ninterface RunShape {\n text: string\n runText: string\n /** The character each glyph starts at. */\n offsets: number[]\n /** Where the characters a glyph starts at end. */\n nextBoundary: Map<number, number>\n start: number\n end: number\n /** How the paragraph shaped the run, worked out when HarfBuzz shapes it. */\n shaping: () => RunShaping\n}\n\n/**\n * Whether the font drew the run. Every glyph of one character being the one the font maps it to\n * says so. A run whose features or ligatures changed glyphs (\"12:30\", \"->\", Arabic forms) is the\n * font's when HarfBuzz shapes its characters to the same glyphs in it, as CanvasKit, which\n * shapes with HarfBuzz, shaped them. One matching glyph says nothing: two files of a family, such\n * as a static instance and the variable font, number most glyphs alike.\n */\nfunction drewRun(source: GlyphOutlineSource, run: GlyphRun, shape: RunShape): boolean {\n const mapped = Array.from(run.glyphs).every((glyph, index) => {\n const from = shape.offsets[index]\n const character = shape.text.slice(from, shape.nextBoundary.get(from))\n // A glyph for a ligature or a cluster does not map from one character.\n const codePoint = character.codePointAt(0)\n if (codePoint === undefined || String.fromCodePoint(codePoint) !== character) return false\n // The missing glyph, like whitespace, says nothing about which font drew it.\n return glyph === 0 || /\\s/.test(character) || source.glyphOf(character) === glyph\n })\n if (mapped) return true\n const glyphs = source.shape(shape.runText, shape.shaping())\n return (\n glyphs.length === run.glyphs.length && glyphs.every(({ id }, index) => id === run.glyphs[index])\n )\n}\n\n/** Characters a shaper draws as nothing, such as variation selectors and joiners, whatever the font. */\nconst DRAWN_AS_NOTHING = /[\\s\\p{Default_Ignorable_Code_Point}]/u\n\n/**\n * The characters a run draws with glyphs of its font, leaving out whitespace and characters the\n * shaper draws as nothing. A character no font has is shaped as the run font's missing glyph\n * (ID 0), which says nothing about which font that is, so it does not count against the font\n * the run's other characters confirm.\n */\nfunction drawnCharacters(run: GlyphRun, shape: RunShape): string {\n const { text, offsets, nextBoundary, start, end } = shape\n const missing = new Set<number>()\n for (const [index, glyph] of run.glyphs.entries()) {\n if (glyph !== 0) continue\n const from = offsets[index]\n const to = nextBoundary.get(from) ?? end\n for (let character = from; character < to; character++) missing.add(character)\n }\n let characters = ''\n for (let index = start; index < end;) {\n const codePoint = text.codePointAt(index) ?? 0\n const character = String.fromCodePoint(codePoint)\n if (!missing.has(index) && !DRAWN_AS_NOTHING.test(character)) characters += character\n index += character.length\n }\n return characters\n}\n\n/**\n * The font a run's outlines come from, and the glyphs to save when it shaped them itself:\n * HarfBuzz's, from the run's first character, with the letter spacing of each code unit's style.\n */\ntype RunOutline =\n | { source: GlyphOutlineSource; glyphs?: undefined }\n | { source: GlyphOutlineSource; glyphs: ShapedGlyph[]; start: number; letterSpacing: number[] }\n\n/**\n * The font a run was shaped with. CanvasKit leaves `GlyphRun.typeface` null, so the run's font\n * is found as the paragraph falls back: the first of the fonts it lists, the style's own then\n * its fallbacks, that has every character of the run, confirmed by the glyphs it chose. When no\n * font confirms them their IDs name no outline, so the text keeps its characters in the first\n * font that has them all, shaped by HarfBuzz as the paragraph would shape them in it.\n * The paragraph asks each family for a face it has loaded, so CanvasKit never fakes one.\n */\nfunction runOutline(\n node: SceneNode,\n shaped: string,\n run: GlyphRun,\n characterAt: (offset: number) => number,\n sourceAt: (index: number) => number\n): RunOutline | null {\n if (run.glyphs.length === 0) return null\n const offsets = Array.from(run.offsets, characterAt)\n const start = Math.min(...offsets)\n const end = Math.max(...offsets)\n // A glyph covers the characters up to the next greater offset in the run, whatever its\n // direction; the sorted offsets give that once for every glyph.\n const boundaries = uniq([...offsets, end]).sort((a, b) => a - b)\n const nextBoundary = new Map(\n boundaries.map((offset, index) => [offset, boundaries[index + 1] ?? end])\n )\n const font = fontAt(node, sourceAt(start))\n let styles: Array<StyleRun | undefined> | undefined\n const stylesOver = () => (styles ??= styleRunsOver(node, start, end, sourceAt))\n let shaping: RunShaping | undefined\n const shape: RunShape = {\n text: shaped,\n runText: shaped.slice(start, end),\n offsets,\n nextBoundary,\n start,\n end,\n shaping: () => (shaping ??= runShaping(node, run, offsets, stylesOver()))\n }\n const characters = drawnCharacters(run, shape)\n let primary: GlyphOutlineSource | null = null\n for (const source of candidateSources(font)) {\n if (!source.covers(characters)) continue\n if (characters === '' || drewRun(source, run, shape)) return { source }\n primary ??= source\n }\n if (!primary) return null\n return {\n source: primary,\n glyphs: primary.shape(shape.runText, shape.shaping()),\n start,\n letterSpacing: stylesOver().map((style) => letterSpacingOf(node, style))\n }\n}\n\n/**\n * How the paragraph shaped a run: with the features of each style run in it, as CanvasKit gives\n * them for blocks it shapes as one run; in the direction its glyphs, in visual order, show by\n * their characters, the paragraph's for one glyph; and in its style's language.\n */\nfunction runShaping(\n node: SceneNode,\n run: GlyphRun,\n offsets: readonly number[],\n styles: ReadonlyArray<StyleRun | undefined>\n): RunShaping {\n const glyphCount = run.glyphs.length\n const ranges: Array<{ start: number; features: ShapingFeature[] }> = []\n for (const [index, style] of styles.entries()) {\n if (index > 0 && style === styles[index - 1]) continue\n const features = featuresOf(node, style)\n if (!isEqual(ranges.at(-1)?.features, features)) ranges.push({ start: index, features })\n }\n const features =\n ranges.length === 1\n ? ranges[0].features\n : ranges.flatMap((range, index) =>\n range.features.map((feature) => ({\n ...feature,\n start: range.start,\n end: ranges.at(index + 1)?.start ?? styles.length\n }))\n )\n const rtl =\n glyphCount > 1 && offsets[0] !== offsets[glyphCount - 1]\n ? offsets[0] > offsets[glyphCount - 1]\n : resolveNodeTextDirection(node) === 'RTL'\n const style = styles.at(0)?.style\n const language =\n (style?.textLanguage !== undefined ? style.textLanguage : node.textLanguage) ?? undefined\n return { features, rtl, language }\n}\n\n/**\n * The font of the ellipsis that ends truncated text, when the run is that ellipsis: the\n * paragraph adds it after the last characters shown, from the first font that maps it.\n */\nfunction ellipsisSource(\n node: SceneNode,\n run: GlyphRun,\n characterAt: (offset: number) => number,\n sourceAt: (index: number) => number\n): GlyphOutlineSource | null {\n if (run.glyphs.length !== 1) return null\n for (const source of candidateSources(fontAt(node, sourceAt(characterAt(run.offsets[0]))))) {\n if (source.glyphOf(ELLIPSIS) === run.glyphs[0]) return source\n }\n return null\n}\n\n/**\n * The outline of a run of a line, and whether the run is the ellipsis that ends truncated text.\n * The last run of truncated text that no font confirms may be an ellipsis, which keeps its glyph\n * unoutlined: shaping it again would save the characters its offsets point at instead.\n */\nfunction lineRunOutline(\n node: SceneNode,\n shaped: string,\n run: GlyphRun,\n endsTruncated: boolean,\n indices: { characterAt: (offset: number) => number; sourceAt: (index: number) => number }\n): { outline: RunOutline | null; ellipsis: boolean } {\n const { characterAt, sourceAt } = indices\n const ellipsis = endsTruncated ? ellipsisSource(node, run, characterAt, sourceAt) : null\n if (ellipsis) return { outline: { source: ellipsis }, ellipsis: true }\n const outline = runOutline(node, shaped, run, characterAt, sourceAt)\n return { outline: endsTruncated && outline?.glyphs ? null : outline, ellipsis: false }\n}\n\n/**\n * The character of the node's own text each character of the shown `text` comes from, which\n * its style run is found by: a case can show one character as several, as `ß` upper-cases to\n * `SS`.\n */\nfunction sourceIndices(node: SceneNode, text: string): (index: number) => number {\n if (text === node.text) return (index) => index\n const indices: number[] = []\n for (const { character, sourceIndex } of shownCharacters(node)) {\n indices.push(...Array.from({ length: character.length }, () => sourceIndex))\n }\n return (index) => indices.at(index) ?? index\n}\n\n/** Whether HarfBuzz shaped the run to glyphs of the same characters as CanvasKit's. */\nfunction sameClusters(\n run: GlyphRun,\n outline: Extract<RunOutline, { glyphs: ShapedGlyph[] }>,\n characterAt: (offset: number) => number\n): boolean {\n return (\n outline.glyphs.length === run.glyphs.length &&\n outline.glyphs.every(\n (glyph, index) => outline.start + glyph.cluster === characterAt(run.offsets[index])\n )\n )\n}\n\n/**\n * The glyphs HarfBuzz shaped for a run, when they are not as many as CanvasKit's or stand for\n * other characters: placed one after another from where the run starts.\n */\nfunction reshapedGlyphs(\n run: GlyphRun,\n outline: Extract<RunOutline, { glyphs: ShapedGlyph[] }>,\n lineLeft: number,\n y: number\n): LaidOutGlyph[] {\n let x = run.positions[0]\n return outline.glyphs.map((glyph, index) => {\n // Spacing follows a character once, after its last glyph, so marks stay on their base.\n const endsCharacter = outline.glyphs.at(index + 1)?.cluster !== glyph.cluster\n const spacing = endsCharacter ? (outline.letterSpacing.at(glyph.cluster) ?? 0) : 0\n const advance = glyph.advance * run.size + spacing\n const placed: LaidOutGlyph = {\n id: glyph.id,\n x: x + glyph.xOffset * run.size,\n y: y - glyph.yOffset * run.size,\n fontSize: run.size,\n firstCharacter: outline.start + glyph.cluster,\n advance,\n lineLeft,\n source: outline.source\n }\n x += advance\n return placed\n })\n}\n\n/**\n * A list marker's glyphs as Figma saves them: placed beside their item and drawing no\n * character of the text.\n */\nfunction markerGlyphs(marker: TextLayoutMarker, offsetY: number): LaidOutGlyph[] {\n const source = glyphOutlineSourceSync(marker.face.family, marker.face.style)\n const baseline = marker.paragraph.getLineMetrics().at(0)?.baseline ?? 0\n const glyphs: LaidOutGlyph[] = []\n for (const line of marker.paragraph.getShapedLines()) {\n for (const run of line.runs) {\n for (let index = 0; index < run.glyphs.length; index++) {\n const x = run.positions[index * 2]\n glyphs.push({\n id: run.glyphs[index],\n x: marker.x + x,\n y: marker.y + baseline + offsetY,\n fontSize: run.size,\n advance: run.positions[(index + 1) * 2] - x,\n lineLeft: marker.x,\n source\n })\n }\n }\n }\n return glyphs\n}\n\n/**\n * Every glyph of laid-out `text`, `offsetY` below the layout's top, in drawing order: an item's\n * marker before the glyphs of its first line, as Figma saves them. Returns `null` when the\n * layout's lines do not match its shaped lines.\n */\nexport function laidOutGlyphs(\n node: SceneNode,\n layout: TextLayout,\n text: string,\n offsetY: number\n): LaidOutGlyph[] | null {\n const lines = layout.getShapedLines()\n const metrics = layout.getLineMetrics()\n if (lines.length === 0 || lines.length !== metrics.length) return null\n const characterAt = utf16IndicesByUtf8(text)\n // The runs drew the text as laid out, a keycap mark as a zero-width space.\n const shaped = laidOutText(text)\n const sourceAt = sourceIndices(node, text)\n const markers = new Map(layout.getMarkers().map((marker) => [marker.lineNumber, marker]))\n const glyphs: LaidOutGlyph[] = []\n for (const [lineIndex, line] of lines.entries()) {\n const marker = markers.get(lineIndex)\n if (marker) glyphs.push(...markerGlyphs(marker, offsetY))\n const { left, baseline } = metrics[lineIndex]\n const lastLine = lineIndex === lines.length - 1\n for (const [runIndex, run] of line.runs.entries()) {\n const endsTruncated =\n lastLine && runIndex === line.runs.length - 1 && layout.didExceedMaxLines()\n const { outline, ellipsis } = lineRunOutline(node, shaped, run, endsTruncated, {\n characterAt,\n sourceAt\n })\n // Run positions round the baseline to whole pixels; line metrics keep it exact.\n const y = baseline + offsetY\n if (outline?.glyphs && !sameClusters(run, outline, characterAt)) {\n glyphs.push(...reshapedGlyphs(run, outline, left, y))\n continue\n }\n for (let index = 0; index < run.glyphs.length; index++) {\n const x = run.positions[index * 2]\n glyphs.push({\n id: outline?.glyphs?.[index].id ?? run.glyphs[index],\n x,\n y,\n fontSize: run.size,\n // The ellipsis truncation adds draws no character, as Figma saves it.\n firstCharacter: ellipsis ? undefined : characterAt(run.offsets[index]),\n advance: run.positions[(index + 1) * 2] - x,\n lineLeft: left,\n source: outline?.source ?? null\n })\n }\n }\n }\n return glyphs\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,SAAS,YACP,QACA,QACA,QACA,OACe;CACf,OAAO,WAAW,QAAQ,QAAQ,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O,CAAC;EACxD,MAAM,EAAE,MAAM,aAAa,QAAQ;EACnC,MAAM,WAAW,cAAc,MAAM,SAAS;EAC9C,KAAK,MAAM,CAAC,UAAU,QAAQ,KAAK,KAAK,QAAQ,GAAG;GAGjD,MAAM,EAAE,SAAS,aAAa,eAAe,MAAM,QAAQ,KADzD,YAAY,aAAa,KAAK,KAAK,SAAS,KAAK,OAAO,kBAAkB,GACG;IAC7E;IACA;GACF,CAAC;GAED,MAAM,IAAI,WAAW;GACrB,IAAI,SAAS,UAAU,CAAC,aAAa,KAAK,SAAS,WAAW,GAAG;IAC/D,OAAO,KAAK,GAAG,eAAe,KAAK,SAAS,MAAM,CAAC,CAAC;IACpD;GACF;GACA,KAAK,IAAI,QAAQ,GAAG,QAAQ,IAAI,OAAO,QAAQ,SAAS;IACtD,MAAM,IAAI,IAAI,UAAU,QAAQ;IAChC,OAAO,KAAK;KACV,IAAI,SAAS,SAAS,MAAM,CAAC,MAAM,IAAI,OAAO;KAC9C;KACA;KACA,UAAU,IAAI;KAEd,gBAAgB,WAAW,KAAA,IAAY,YAAY,IAAI,QAAQ,MAAM;KACrE,SAAS,IAAI,WAAW,QAAQ,KAAK,KAAK;KAC1C,UAAU;KACV,QAAQ,SAAS,UAAU;IAC7B,CAAC;GACH;EACF;CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"placed.js","names":[],"sources":["../../../src/canvas/text/placed.ts"],"sourcesContent":["import type { Paragraph } from 'canvaskit-wasm'\nimport { uniq } from 'es-toolkit/array'\nimport { isEqual } from 'es-toolkit/predicate'\n\nimport type { SceneNode } from '@pairdraw/scene-graph'\nimport { textLengthPixels } from '@pairdraw/scene-graph/text'\nimport { resolveNodeTextDirection } from '@pairdraw/scene-graph/text/direction'\n\nimport {\n drawnFontVariations,\n loadedFace,\n paragraphSourceFamilies\n} from '#core/canvas/text/font-families'\nimport { laidOutText } from '#core/canvas/text/keycap'\nimport type { TextLayout, TextLayoutMarker } from '#core/canvas/text/layout'\nimport { utf16IndicesByUtf8 } from '#core/canvas/text/utf8'\nimport { DEFAULT_FONT_FAMILY } from '#core/constants'\nimport { shownCharacters } from '#core/text/case'\nimport { ELLIPSIS } from '#core/text/ellipsis'\nimport {\n glyphOutlineSourceSync,\n shardCovers,\n shardOutlineSources,\n type GlyphOutlineSource,\n type RunShaping,\n type ShapedGlyph\n} from '#core/text/font/glyphs'\nimport type { ShapingFeature } from '#core/text/font/harfbuzz'\nimport { fontManager } from '#core/text/font/manager'\nimport { textFontFace } from '#core/text/requirements/collect'\n\ntype GlyphRun = ReturnType<Paragraph['getShapedLines']>[number]['runs'][number]\n\n/** A glyph of laid-out text where the renderer draws it, with the font its outline comes from. */\nexport interface LaidOutGlyph {\n /** The glyph ID the shaper chose. */\n id: number\n x: number\n /** The baseline of its line. */\n y: number\n fontSize: number\n /** The character it draws, left out for a list marker. */\n firstCharacter?: number\n advance: number\n /** Where its line starts. */\n lineLeft: number\n /** The font that drew it, or `null` when the shaper may have used another. */\n source: GlyphOutlineSource | null\n}\n\n/** The loaded face of a family the paragraph draws a face in, as its key. */\nfunction loadedStyle(\n family: string,\n weight: number,\n italic: boolean,\n style: string\n): string | null {\n return loadedFace(family, weight, italic, style)?.style ?? null\n}\n\n/**\n * The font a character asks for: its family, weight, and slant, and the variable axes it sets;\n * and the face the paragraph asks every family for, the one its own family has loaded, as\n * `drawnFontStyle` asks CanvasKit.\n */\nfunction fontAt(node: SceneNode, index: number) {\n const run = styleRunAt(node, index)\n const family = run?.style.fontFamily ?? (node.fontFamily || DEFAULT_FONT_FAMILY)\n const weight = run?.style.fontWeight ?? node.fontWeight\n const italic = run?.style.italic ?? node.italic\n const style = textFontFace(node, run?.style).style\n const variations = drawnFontVariations({\n family,\n weight,\n italic,\n style,\n fontSize: run?.style.fontSize ?? node.fontSize,\n variations: run?.style.fontVariations ?? node.fontVariations,\n opticalSizeFromFontSize: run?.style.opticalSizeFromFontSize ?? node.opticalSizeFromFontSize\n })\n const drawn = loadedFace(family, weight, italic, style) ?? { weight, italic, style }\n return { family, weight, italic, style, variations, drawn }\n}\n\ntype StyleRun = SceneNode['styleRuns'][number]\n\nfunction styleRunAt(node: SceneNode, index: number): StyleRun | undefined {\n return node.styleRuns.find((item) => index >= item.start && index < item.start + item.length)\n}\n\n/**\n * The style run of each code unit of the shown text from `start` to `end`, scanning the node's\n * style runs only where one ends.\n */\nfunction styleRunsOver(\n node: SceneNode,\n start: number,\n end: number,\n sourceAt: (index: number) => number\n): Array<StyleRun | undefined> {\n const runs: Array<StyleRun | undefined> = []\n let current: StyleRun | undefined\n for (let index = start; index < end; index++) {\n const source = sourceAt(index)\n if (!current || source < current.start || source >= current.start + current.length)\n current = styleRunAt(node, source)\n runs.push(current)\n }\n return runs\n}\n\n/** The letter spacing a style run sets after each of its characters, in pixels. */\nfunction letterSpacingOf(node: SceneNode, run: StyleRun | undefined): number {\n return textLengthPixels(\n run?.style.letterSpacing ?? node.letterSpacing,\n run?.style.fontSize ?? node.fontSize\n )\n}\n\n/** The features a style run shapes its characters with, as CanvasKit is given them. */\nfunction featuresOf(node: SceneNode, run: StyleRun | undefined): ShapingFeature[] {\n return (run?.style.fontFeatures ?? node.fontFeatures).map((feature) => ({\n tag: feature.tag.toLowerCase(),\n value: feature.enabled ? 1 : 0\n }))\n}\n\n/**\n * The style a family of the paragraph is drawn in: the face its own family draws the asked style\n * in, and Regular for the script fallbacks, as the paragraph asks CanvasKit for them.\n */\nfunction sourceStyle(family: string, font: ReturnType<typeof fontAt>): string | null {\n const scriptFallback =\n family !== font.family &&\n (fontManager.getLetterFallbackFamilies().includes(family) ||\n fontManager.getCJKFallbackFamilies().includes(family))\n if (scriptFallback) return fontManager.isStyleLoaded(family, 'Regular') ? 'Regular' : null\n return loadedStyle(family, font.drawn.weight, font.drawn.italic, font.drawn.style)\n}\n\n/**\n * The outline source of each file the paragraph may have drawn a character in, in its order:\n * each family's own file, then its shards.\n */\nfunction* candidateSources(font: ReturnType<typeof fontAt>) {\n for (const family of paragraphSourceFamilies(font.family)) {\n const style = sourceStyle(family, font)\n if (!style) continue\n const source = glyphOutlineSourceSync(family, style, font.variations)\n if (source) yield source\n yield* shardOutlineSources(family, style, font.variations)\n }\n}\n\n/** The face and file the paragraph draws a character in. */\nexport interface CharacterFace {\n family: string\n style: string\n /** Which of the style's files: 0 for its own, then its shards, as `FontManager.shardData` lists them. */\n file: number\n /** Whether it is not the character's own family. */\n fallback: boolean\n}\n\n/**\n * The loaded face the paragraph draws the character at `index` of `text` in, as it falls back:\n * of the fonts it lists, the style's own then its fallbacks, each file then its shards, the first\n * that maps the character.\n */\nexport function characterFace(node: SceneNode, text: string, index: number): CharacterFace | null {\n const codePoint = text.codePointAt(index)\n if (codePoint === undefined) return null\n const character = String.fromCodePoint(codePoint)\n const font = fontAt(node, index)\n for (const family of paragraphSourceFamilies(font.family)) {\n const style = sourceStyle(family, font)\n if (!style) continue\n const fallback = family !== font.family\n if (glyphOutlineSourceSync(family, style, font.variations)?.covers(character))\n return { family, style, file: 0, fallback }\n const shard = fontManager\n .shardData(family, style)\n .findIndex((data) => shardCovers(data, character))\n if (shard !== -1) return { family, style, file: shard + 1, fallback }\n }\n return null\n}\n\n/** The family the paragraph draws the character at `index` of `text` in; see {@link characterFace}. */\nexport function characterFamily(node: SceneNode, text: string, index: number): string | null {\n return characterFace(node, text, index)?.family ?? null\n}\n\n/** The characters of a run as the paragraph laid them out, and the features it shaped them with. */\ninterface RunShape {\n text: string\n runText: string\n /** The character each glyph starts at. */\n offsets: number[]\n /** Where the characters a glyph starts at end. */\n nextBoundary: Map<number, number>\n start: number\n end: number\n /** How the paragraph shaped the run, worked out when HarfBuzz shapes it. */\n shaping: () => RunShaping\n}\n\n/**\n * Whether the font drew the run. Every glyph of one character being the one the font maps it to\n * says so. A run whose features or ligatures changed glyphs (\"12:30\", \"->\", Arabic forms) is the\n * font's when HarfBuzz shapes its characters to the same glyphs in it, as CanvasKit, which\n * shapes with HarfBuzz, shaped them. One matching glyph says nothing: two files of a family, such\n * as a static instance and the variable font, number most glyphs alike.\n */\nfunction drewRun(source: GlyphOutlineSource, run: GlyphRun, shape: RunShape): boolean {\n const mapped = Array.from(run.glyphs).every((glyph, index) => {\n const from = shape.offsets[index]\n const character = shape.text.slice(from, shape.nextBoundary.get(from))\n // A glyph for a ligature or a cluster does not map from one character.\n const codePoint = character.codePointAt(0)\n if (codePoint === undefined || String.fromCodePoint(codePoint) !== character) return false\n // The missing glyph, like whitespace, says nothing about which font drew it.\n return glyph === 0 || /\\s/.test(character) || source.glyphOf(character) === glyph\n })\n if (mapped) return true\n const glyphs = source.shape(shape.runText, shape.shaping())\n return (\n glyphs.length === run.glyphs.length && glyphs.every(({ id }, index) => id === run.glyphs[index])\n )\n}\n\n/** Characters a shaper draws as nothing, such as variation selectors and joiners, whatever the font. */\nconst DRAWN_AS_NOTHING = /[\\s\\p{Default_Ignorable_Code_Point}]/u\n\n/**\n * The characters a run draws with glyphs of its font, leaving out whitespace and characters the\n * shaper draws as nothing. A character no font has is shaped as the run font's missing glyph\n * (ID 0), which says nothing about which font that is, so it does not count against the font\n * the run's other characters confirm.\n */\nfunction drawnCharacters(run: GlyphRun, shape: RunShape): string {\n const { text, offsets, nextBoundary, start, end } = shape\n const missing = new Set<number>()\n for (const [index, glyph] of run.glyphs.entries()) {\n if (glyph !== 0) continue\n const from = offsets[index]\n const to = nextBoundary.get(from) ?? end\n for (let character = from; character < to; character++) missing.add(character)\n }\n let characters = ''\n for (let index = start; index < end;) {\n const codePoint = text.codePointAt(index) ?? 0\n const character = String.fromCodePoint(codePoint)\n if (!missing.has(index) && !DRAWN_AS_NOTHING.test(character)) characters += character\n index += character.length\n }\n return characters\n}\n\n/**\n * The font a run's outlines come from, and the glyphs to save when it shaped them itself:\n * HarfBuzz's, from the run's first character, with the letter spacing of each code unit's style.\n */\ntype RunOutline =\n | { source: GlyphOutlineSource; glyphs?: undefined }\n | { source: GlyphOutlineSource; glyphs: ShapedGlyph[]; start: number; letterSpacing: number[] }\n\n/**\n * The font a run was shaped with. CanvasKit leaves `GlyphRun.typeface` null, so the run's font\n * is found as the paragraph falls back: the first of the fonts it lists, the style's own then\n * its fallbacks, that has every character of the run, confirmed by the glyphs it chose. When no\n * font confirms them their IDs name no outline, so the text keeps its characters in the first\n * font that has them all, shaped by HarfBuzz as the paragraph would shape them in it.\n * The paragraph asks each family for a face it has loaded, so CanvasKit never fakes one.\n */\nfunction runOutline(\n node: SceneNode,\n shaped: string,\n run: GlyphRun,\n characterAt: (offset: number) => number,\n sourceAt: (index: number) => number\n): RunOutline | null {\n if (run.glyphs.length === 0) return null\n const offsets = Array.from(run.offsets, characterAt)\n const start = Math.min(...offsets)\n const end = Math.max(...offsets)\n // A glyph covers the characters up to the next greater offset in the run, whatever its\n // direction; the sorted offsets give that once for every glyph.\n const boundaries = uniq([...offsets, end]).sort((a, b) => a - b)\n const nextBoundary = new Map(\n boundaries.map((offset, index) => [offset, boundaries[index + 1] ?? end])\n )\n const font = fontAt(node, sourceAt(start))\n let styles: Array<StyleRun | undefined> | undefined\n const stylesOver = () => (styles ??= styleRunsOver(node, start, end, sourceAt))\n let shaping: RunShaping | undefined\n const shape: RunShape = {\n text: shaped,\n runText: shaped.slice(start, end),\n offsets,\n nextBoundary,\n start,\n end,\n shaping: () => (shaping ??= runShaping(node, run, offsets, stylesOver()))\n }\n const characters = drawnCharacters(run, shape)\n let primary: GlyphOutlineSource | null = null\n for (const source of candidateSources(font)) {\n if (!source.covers(characters)) continue\n if (characters === '' || drewRun(source, run, shape)) return { source }\n primary ??= source\n }\n if (!primary) return null\n return {\n source: primary,\n glyphs: primary.shape(shape.runText, shape.shaping()),\n start,\n letterSpacing: stylesOver().map((style) => letterSpacingOf(node, style))\n }\n}\n\n/**\n * How the paragraph shaped a run: with the features of each style run in it, as CanvasKit gives\n * them for blocks it shapes as one run; in the direction its glyphs, in visual order, show by\n * their characters, the paragraph's for one glyph; and in its style's language.\n */\nfunction runShaping(\n node: SceneNode,\n run: GlyphRun,\n offsets: readonly number[],\n styles: ReadonlyArray<StyleRun | undefined>\n): RunShaping {\n const glyphCount = run.glyphs.length\n const ranges: Array<{ start: number; features: ShapingFeature[] }> = []\n for (const [index, style] of styles.entries()) {\n if (index > 0 && style === styles[index - 1]) continue\n const features = featuresOf(node, style)\n if (!isEqual(ranges.at(-1)?.features, features)) ranges.push({ start: index, features })\n }\n const features =\n ranges.length === 1\n ? ranges[0].features\n : ranges.flatMap((range, index) =>\n range.features.map((feature) => ({\n ...feature,\n start: range.start,\n end: ranges.at(index + 1)?.start ?? styles.length\n }))\n )\n const rtl =\n glyphCount > 1 && offsets[0] !== offsets[glyphCount - 1]\n ? offsets[0] > offsets[glyphCount - 1]\n : resolveNodeTextDirection(node) === 'RTL'\n const style = styles.at(0)?.style\n const language =\n (style?.textLanguage !== undefined ? style.textLanguage : node.textLanguage) ?? undefined\n return { features, rtl, language }\n}\n\n/**\n * The font of the ellipsis that ends truncated text, when the run is that ellipsis: the\n * paragraph adds it after the last characters shown, from the first font that maps it.\n */\nfunction ellipsisSource(\n node: SceneNode,\n run: GlyphRun,\n characterAt: (offset: number) => number,\n sourceAt: (index: number) => number\n): GlyphOutlineSource | null {\n if (run.glyphs.length !== 1) return null\n for (const source of candidateSources(fontAt(node, sourceAt(characterAt(run.offsets[0]))))) {\n if (source.glyphOf(ELLIPSIS) === run.glyphs[0]) return source\n }\n return null\n}\n\n/**\n * The outline of a run of a line, and whether the run is the ellipsis that ends truncated text.\n * The last run of truncated text that no font confirms may be an ellipsis, which keeps its glyph\n * unoutlined: shaping it again would save the characters its offsets point at instead.\n */\nfunction lineRunOutline(\n node: SceneNode,\n shaped: string,\n run: GlyphRun,\n endsTruncated: boolean,\n indices: { characterAt: (offset: number) => number; sourceAt: (index: number) => number }\n): { outline: RunOutline | null; ellipsis: boolean } {\n const { characterAt, sourceAt } = indices\n const ellipsis = endsTruncated ? ellipsisSource(node, run, characterAt, sourceAt) : null\n if (ellipsis) return { outline: { source: ellipsis }, ellipsis: true }\n const outline = runOutline(node, shaped, run, characterAt, sourceAt)\n return { outline: endsTruncated && outline?.glyphs ? null : outline, ellipsis: false }\n}\n\n/**\n * The character of the node's own text each character of the shown `text` comes from, which\n * its style run is found by: a case can show one character as several, as `ß` upper-cases to\n * `SS`.\n */\nfunction sourceIndices(node: SceneNode, text: string): (index: number) => number {\n if (text === node.text) return (index) => index\n const indices: number[] = []\n for (const { character, sourceIndex } of shownCharacters(node)) {\n indices.push(...Array.from({ length: character.length }, () => sourceIndex))\n }\n return (index) => indices.at(index) ?? index\n}\n\n/** Whether HarfBuzz shaped the run to glyphs of the same characters as CanvasKit's. */\nfunction sameClusters(\n run: GlyphRun,\n outline: Extract<RunOutline, { glyphs: ShapedGlyph[] }>,\n characterAt: (offset: number) => number\n): boolean {\n return (\n outline.glyphs.length === run.glyphs.length &&\n outline.glyphs.every(\n (glyph, index) => outline.start + glyph.cluster === characterAt(run.offsets[index])\n )\n )\n}\n\n/**\n * The glyphs HarfBuzz shaped for a run, when they are not as many as CanvasKit's or stand for\n * other characters: placed one after another from where the run starts.\n */\nfunction reshapedGlyphs(\n run: GlyphRun,\n outline: Extract<RunOutline, { glyphs: ShapedGlyph[] }>,\n lineLeft: number,\n y: number\n): LaidOutGlyph[] {\n let x = run.positions[0]\n return outline.glyphs.map((glyph, index) => {\n // Spacing follows a character once, after its last glyph, so marks stay on their base.\n const endsCharacter = outline.glyphs.at(index + 1)?.cluster !== glyph.cluster\n const spacing = endsCharacter ? (outline.letterSpacing.at(glyph.cluster) ?? 0) : 0\n const advance = glyph.advance * run.size + spacing\n const placed: LaidOutGlyph = {\n id: glyph.id,\n x: x + glyph.xOffset * run.size,\n y: y - glyph.yOffset * run.size,\n fontSize: run.size,\n firstCharacter: outline.start + glyph.cluster,\n advance,\n lineLeft,\n source: outline.source\n }\n x += advance\n return placed\n })\n}\n\n/**\n * A list marker's glyphs as Figma saves them: placed beside their item and drawing no\n * character of the text.\n */\nfunction markerGlyphs(marker: TextLayoutMarker, offsetY: number): LaidOutGlyph[] {\n const source = glyphOutlineSourceSync(marker.face.family, marker.face.style)\n const baseline = marker.paragraph.getLineMetrics().at(0)?.baseline ?? 0\n const glyphs: LaidOutGlyph[] = []\n for (const line of marker.paragraph.getShapedLines()) {\n for (const run of line.runs) {\n for (let index = 0; index < run.glyphs.length; index++) {\n const x = run.positions[index * 2]\n glyphs.push({\n id: run.glyphs[index],\n x: marker.x + x,\n y: marker.y + baseline + offsetY,\n fontSize: run.size,\n advance: run.positions[(index + 1) * 2] - x,\n lineLeft: marker.x,\n source\n })\n }\n }\n }\n return glyphs\n}\n\n/**\n * Every glyph of laid-out `text`, `offsetY` below the layout's top, in drawing order: an item's\n * marker before the glyphs of its first line, as Figma saves them. Returns `null` when the\n * layout's lines do not match its shaped lines.\n */\nexport function laidOutGlyphs(\n node: SceneNode,\n layout: TextLayout,\n text: string,\n offsetY: number\n): LaidOutGlyph[] | null {\n const lines = layout.getShapedLines()\n const metrics = layout.getLineMetrics()\n if (lines.length === 0 || lines.length !== metrics.length) return null\n const characterAt = utf16IndicesByUtf8(text)\n // The runs drew the text as laid out, a keycap mark as a zero-width space.\n const shaped = laidOutText(text)\n const sourceAt = sourceIndices(node, text)\n const markers = new Map(layout.getMarkers().map((marker) => [marker.lineNumber, marker]))\n const glyphs: LaidOutGlyph[] = []\n for (const [lineIndex, line] of lines.entries()) {\n const marker = markers.get(lineIndex)\n if (marker) glyphs.push(...markerGlyphs(marker, offsetY))\n const { left, baseline } = metrics[lineIndex]\n const lastLine = lineIndex === lines.length - 1\n for (const [runIndex, run] of line.runs.entries()) {\n const endsTruncated =\n lastLine && runIndex === line.runs.length - 1 && layout.didExceedMaxLines()\n const { outline, ellipsis } = lineRunOutline(node, shaped, run, endsTruncated, {\n characterAt,\n sourceAt\n })\n // Run positions round the baseline to whole pixels; line metrics keep it exact.\n const y = baseline + offsetY\n if (outline?.glyphs && !sameClusters(run, outline, characterAt)) {\n glyphs.push(...reshapedGlyphs(run, outline, left, y))\n continue\n }\n for (let index = 0; index < run.glyphs.length; index++) {\n const x = run.positions[index * 2]\n glyphs.push({\n id: outline?.glyphs?.[index].id ?? run.glyphs[index],\n x,\n y,\n fontSize: run.size,\n // The ellipsis truncation adds draws no character, as Figma saves it.\n firstCharacter: ellipsis ? undefined : characterAt(run.offsets[index]),\n advance: run.positions[(index + 1) * 2] - x,\n lineLeft: left,\n source: outline?.source ?? null\n })\n }\n }\n }\n return glyphs\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,SAAS,YACP,QACA,QACA,QACA,OACe;CACf,OAAO,WAAW,QAAQ,QAAQ,QAAQ,KAAK,CAAC,EAAE,SAAS;AAC7D;;;;;;AAOA,SAAS,OAAO,MAAiB,OAAe;CAC9C,MAAM,MAAM,WAAW,MAAM,KAAK;CAClC,MAAM,SAAS,KAAK,MAAM,eAAe,KAAK,cAAA;CAC9C,MAAM,SAAS,KAAK,MAAM,cAAc,KAAK;CAC7C,MAAM,SAAS,KAAK,MAAM,UAAU,KAAK;CACzC,MAAM,QAAQ,aAAa,MAAM,KAAK,KAAK,CAAC,CAAC;CAW7C,OAAO;EAAE;EAAQ;EAAQ;EAAQ;EAAO,YAVrB,oBAAoB;GACrC;GACA;GACA;GACA;GACA,UAAU,KAAK,MAAM,YAAY,KAAK;GACtC,YAAY,KAAK,MAAM,kBAAkB,KAAK;GAC9C,yBAAyB,KAAK,MAAM,2BAA2B,KAAK;EACtE,CAEiD;EAAG,OADtC,WAAW,QAAQ,QAAQ,QAAQ,KAAK,KAAK;GAAE;GAAQ;GAAQ;EAAM;CACzB;AAC5D;AAIA,SAAS,WAAW,MAAiB,OAAqC;CACxE,OAAO,KAAK,UAAU,MAAM,SAAS,SAAS,KAAK,SAAS,QAAQ,KAAK,QAAQ,KAAK,MAAM;AAC9F;;;;;AAMA,SAAS,cACP,MACA,OACA,KACA,UAC6B;CAC7B,MAAM,OAAoC,CAAC;CAC3C,IAAI;CACJ,KAAK,IAAI,QAAQ,OAAO,QAAQ,KAA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{
|
|
|
8
8
|
ck?: CanvasKit;
|
|
9
9
|
fontProvider?: TypefaceFontProvider | null;
|
|
10
10
|
fontsLoaded?: boolean;
|
|
11
|
+
/** The renderer has finished preparing its fonts, so a face still pending will not arrive. */
|
|
12
|
+
exportFontsSettled?: boolean;
|
|
11
13
|
onFontResolutionSettled?: FontResolutionSettled;
|
|
12
14
|
trackFontDemand?: (node: SceneNode, key: string) => void;
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","names":[],"sources":["../../../src/canvas/text/renderer.ts"],"mappings":";;;;;UAQiB;EACf,uBAAuB;EACvB,KAAK;EACL,eAAe;EACf;EACA,0BAA0B;EAC1B,mBAAmB,MAAM,WAAW;;UAGrB,qBAAqB;EACpC,IAAI;EACJ,cAAc;EACd"}
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","names":[],"sources":["../../../src/canvas/text/renderer.ts"],"mappings":";;;;;UAQiB;EACf,uBAAuB;EACvB,KAAK;EACL,eAAe;EACf;;EAEA;EACA,0BAA0B;EAC1B,mBAAmB,MAAM,WAAW;;UAGrB,qBAAqB;EACpC,IAAI;EACJ,cAAc;EACd"}
|
|
@@ -12,9 +12,10 @@ import { SceneGraph, SceneNode } from "@pairdraw/scene-graph";
|
|
|
12
12
|
*/
|
|
13
13
|
declare function shapeText(ck: CanvasKit, fontProvider: TypefaceFontProvider, node: SceneNode): ShapedText | null;
|
|
14
14
|
/**
|
|
15
|
-
* Run `use` with text shaped as the canvas lays it out
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Run `use` with text shaped as the canvas lays it out, from the font provider the canvas of
|
|
16
|
+
* `canvasKit` draws from, or one a caller attached and registered faces on for layout alone.
|
|
17
|
+
* Each call holds a share of that provider, so overlapping calls shape from the same one and the
|
|
18
|
+
* last to finish releases it; a provider with no share left is deleted.
|
|
18
19
|
*/
|
|
19
20
|
declare function withTextShaper<T>(canvasKit: CanvasKit, use: (shape: (node: SceneNode) => ShapedText | null) => Promise<T>): Promise<T>;
|
|
20
21
|
/** Run a `.fig` or Figma clipboard write with text shaping. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape.d.ts","names":[],"sources":["../../../src/canvas/text/shape.ts"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"shape.d.ts","names":[],"sources":["../../../src/canvas/text/shape.ts"],"mappings":";;;;;;;;;;;;iBA6GgB,UACd,IAAI,WACJ,cAAc,sBACd,MAAM,YACL;;;;;;;iBA0FmB,eAAe,GACnC,WAAW,WACX,MAAM,QAAQ,MAAM,cAAc,sBAAsB,QAAQ,KAC/D,QAAQ;;iBAUW,qBAAqB,GACzC,OAAO,YACP,IAAI,uBACJ,QAAQ,SAAS,+BAA+B,QAAQ,KACvD,QAAQ"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { getCanvasKit } from "../../canvaskit.js";
|
|
2
|
+
import "../../text/emoji.js";
|
|
2
3
|
import { shownText } from "../../text/case.js";
|
|
3
4
|
import { fontManager } from "../../text/font/manager.js";
|
|
4
5
|
import { outlineInk, savedGlyphInk } from "./ink.js";
|
|
5
6
|
import { keycapFrame } from "./keycap.js";
|
|
6
|
-
import "../../text/emoji.js";
|
|
7
7
|
import { characterFamily, laidOutGlyphs } from "./placed.js";
|
|
8
8
|
import { textDecorationRects } from "./decorations.js";
|
|
9
9
|
import { buildParagraph } from "./layout/build.js";
|
|
10
|
-
import { textVerticalOffset } from "./index.js";
|
|
11
10
|
import { faceStyleName } from "../../text/font/names.js";
|
|
12
11
|
import { nextGraphemeBoundary } from "../../text/graphemes.js";
|
|
13
12
|
import { EMPTY_EXPORT_RUNTIME } from "@pairdraw/fig/node-change";
|
|
13
|
+
import { textVerticalOffset } from "@pairdraw/scene-graph/text";
|
|
14
14
|
//#region src/canvas/text/shape.ts
|
|
15
15
|
/**
|
|
16
16
|
* Whether saved glyphs could stand for this text: case changes that alter its length move
|
|
@@ -142,7 +142,7 @@ function shapeText(ck, fontProvider, node) {
|
|
|
142
142
|
...glyph,
|
|
143
143
|
commands: null
|
|
144
144
|
})),
|
|
145
|
-
baselines: metrics.map((line) => ({
|
|
145
|
+
baselines: metrics.filter((line, index) => index === 0 || line.startIndex < text.length).map((line) => ({
|
|
146
146
|
firstCharacter: line.startIndex,
|
|
147
147
|
endCharacter: Math.min(line.endIncludingNewline, text.length),
|
|
148
148
|
position: {
|
|
@@ -184,31 +184,18 @@ function needsShaping(graph) {
|
|
|
184
184
|
for (const node of graph.nodes.values()) if (node.type === "TEXT" && node.text && !node.derivedTextGlyphs?.length) return true;
|
|
185
185
|
return false;
|
|
186
186
|
}
|
|
187
|
-
/** How many shaping calls share each provider made for them; the last one to finish deletes it. */
|
|
188
|
-
const shaperProviderUsers = /* @__PURE__ */ new Map();
|
|
189
187
|
/**
|
|
190
|
-
* Run `use` with text shaped as the canvas lays it out
|
|
191
|
-
*
|
|
192
|
-
*
|
|
188
|
+
* Run `use` with text shaped as the canvas lays it out, from the font provider the canvas of
|
|
189
|
+
* `canvasKit` draws from, or one a caller attached and registered faces on for layout alone.
|
|
190
|
+
* Each call holds a share of that provider, so overlapping calls shape from the same one and the
|
|
191
|
+
* last to finish releases it; a provider with no share left is deleted.
|
|
193
192
|
*/
|
|
194
193
|
async function withTextShaper(canvasKit, use) {
|
|
195
|
-
const
|
|
196
|
-
const provider = attached ?? canvasKit.TypefaceFontProvider.Make();
|
|
197
|
-
if (!attached) fontManager.attachProvider(canvasKit, provider);
|
|
198
|
-
const shared = !attached || shaperProviderUsers.has(provider);
|
|
199
|
-
if (shared) shaperProviderUsers.set(provider, (shaperProviderUsers.get(provider) ?? 0) + 1);
|
|
194
|
+
const provider = fontManager.acquireProvider(canvasKit);
|
|
200
195
|
try {
|
|
201
196
|
return await use((node) => shapeText(canvasKit, provider, node));
|
|
202
197
|
} finally {
|
|
203
|
-
|
|
204
|
-
const users = (shaperProviderUsers.get(provider) ?? 1) - 1;
|
|
205
|
-
if (users > 0) shaperProviderUsers.set(provider, users);
|
|
206
|
-
else {
|
|
207
|
-
shaperProviderUsers.delete(provider);
|
|
208
|
-
fontManager.detachProvider(provider);
|
|
209
|
-
provider.delete();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
198
|
+
fontManager.releaseProvider(provider);
|
|
212
199
|
}
|
|
213
200
|
}
|
|
214
201
|
/** Run a `.fig` or Figma clipboard write with text shaping. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape.js","names":[],"sources":["../../../src/canvas/text/shape.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'\n\nimport {\n EMPTY_EXPORT_RUNTIME,\n type FigNodeChangeExportRuntime,\n type PlacedTextGlyph,\n type ShapedText,\n type ShapedTextGlyph,\n type TextDecorationRecord\n} from '@pairdraw/fig/node-change'\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { buildParagraph, textVerticalOffset } from '#core/canvas/text'\nimport { textDecorationRects, type DecoratedGlyph } from '#core/canvas/text/decorations'\nimport { outlineInk, savedGlyphInk } from '#core/canvas/text/ink'\nimport { COMBINING_KEYCAP, keycapFrame } from '#core/canvas/text/keycap'\nimport { characterFamily, laidOutGlyphs, type LaidOutGlyph } from '#core/canvas/text/placed'\nimport { getCanvasKit } from '#core/canvaskit'\nimport { shownText } from '#core/text/case'\nimport { EMOJI_METRICS_FAMILY } from '#core/text/emoji'\nimport type { OutlineCommand } from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\nimport { faceStyleName } from '#core/text/font/names'\nimport { nextGraphemeBoundary } from '#core/text/graphemes'\n\n/**\n * Whether saved glyphs could stand for this text: case changes that alter its length move\n * glyphs off the characters they came from, and path text is placed along its path. Truncated\n * text saves the characters it shows and the ellipsis after them.\n */\nfunction canShape(node: SceneNode, text: string): boolean {\n return node.text.length > 0 && text.length === node.text.length && !node.textPathData\n}\n\n/** Characters inside a glyph cluster or without a glyph take the offset of the one before. */\nfunction completeCharacterOffsets(offsets: Array<number | undefined>): number[] {\n let previous = 0\n return offsets.map((offset) => {\n previous = offset ?? previous\n return previous\n })\n}\n\n/**\n * The square Figma saves for an emoji, in pixels at `size` with y down: 1 em wide, from 0.07 em\n * below the baseline, closed with a line back to its start as Figma writes it.\n */\nfunction emojiPlaceholder(size: number): OutlineCommand[] {\n const bottom = 0.07 * size\n const top = -0.93 * size\n return [\n { type: 'M', x: 0, y: bottom },\n { type: 'L', x: size, y: bottom },\n { type: 'L', x: size, y: top },\n { type: 'L', x: 0, y: top },\n { type: 'L', x: 0, y: bottom },\n { type: 'Z' }\n ]\n}\n\ninterface SavedEmoji {\n codePoints: number[]\n /** Where the emoji's characters end in the text. */\n end: number\n}\n\n/**\n * The emoji a glyph starts, as Figma saves it, when the layout gave it to the emoji metrics font:\n * its code points, an emoji that shows as text by default with the selector that asks for its\n * emoji form, as Figma saves ☺ as ☺️.\n */\nfunction savedEmoji(node: SceneNode, text: string, glyph: LaidOutGlyph): SavedEmoji | undefined {\n const start = glyph.firstCharacter\n if (start === undefined || characterFamily(node, text, start) !== EMOJI_METRICS_FAMILY)\n return undefined\n const end = nextGraphemeBoundary(text, start)\n const emoji = text.slice(start, end)\n const codePoints = Array.from(emoji, (character) => character.codePointAt(0) ?? 0)\n if (codePoints.length === 1 && !/\\p{Emoji_Presentation}/u.test(emoji)) codePoints.push(0xfe0f)\n return { codePoints, end }\n}\n\n/**\n * A glyph's saved outline: an emoji's placeholder, nothing inside one, a keycap's frame, or its\n * font's outline.\n */\nfunction savedOutline(\n glyph: LaidOutGlyph,\n text: string,\n emoji: SavedEmoji | undefined,\n insideEmoji: boolean\n): OutlineCommand[] | null {\n if (insideEmoji) return []\n if (emoji) return emojiPlaceholder(glyph.fontSize)\n const character = glyph.firstCharacter\n if (character !== undefined && text[character] === COMBINING_KEYCAP)\n return keycapFrame(glyph.fontSize)\n return glyph.source?.outline(glyph.id, glyph.fontSize) ?? null\n}\n\n/**\n * Lay a text node out as the renderer draws it and pair each shaped glyph with the outline of\n * the glyph ID CanvasKit chose, so ligatures and contextual forms keep their shapes. An emoji the\n * layout gives the emoji metrics font is saved as Figma saves one: a placeholder square with its\n * code points. When a run's font cannot be told, no glyph gets an outline: the layout still\n * stands and Pairdraw lays the text out again on reading, but Figma draws it blank.\n * Returns `null` for text saved glyphs cannot represent at all.\n */\nexport function shapeText(\n ck: CanvasKit,\n fontProvider: TypefaceFontProvider,\n node: SceneNode\n): ShapedText | null {\n const text = shownText(node)\n if (!canShape(node, text)) return null\n\n const paragraph = buildParagraph({ ck, fontProvider, fontsLoaded: true }, node, undefined, {\n halfLeading: true\n })\n try {\n const offsetY = textVerticalOffset(node, paragraph.getHeight())\n const placed = laidOutGlyphs(node, paragraph, text, offsetY)\n if (!placed) return null\n const metrics = paragraph.getLineMetrics()\n const characterOffsets: Array<number | undefined> = Array.from({ length: text.length })\n // A sequence the font does not join is several glyphs: the first stands for the emoji, and\n // the rest keep their place and draw nothing. Glyphs come in visual order, so in\n // right-to-left text a character before the emoji can follow it: the whole range counts.\n let emojiRange = { start: 0, end: 0 }\n const glyphs: ShapedTextGlyph[] = placed.map((glyph) => {\n const start = glyph.firstCharacter\n if (start !== undefined) characterOffsets[start] ??= glyph.x - glyph.lineLeft\n const insideEmoji = start !== undefined && start > emojiRange.start && start < emojiRange.end\n const emoji = insideEmoji ? undefined : savedEmoji(node, text, glyph)\n if (emoji && start !== undefined) emojiRange = { start, end: emoji.end }\n return {\n commands: savedOutline(glyph, text, emoji, insideEmoji),\n x: glyph.x,\n y: glyph.y,\n fontSize: glyph.fontSize,\n firstCharacter: start,\n advance: glyph.advance,\n emojiCodePoints: emoji?.codePoints\n }\n })\n // Outlines from some runs only would draw the text with characters missing.\n const outlined = glyphs.every((glyph) => glyph.commands)\n return {\n glyphs: outlined ? glyphs : glyphs.map((glyph) => ({ ...glyph, commands: null })),\n baselines: metrics.map((line) => ({\n firstCharacter: line.startIndex,\n endCharacter: Math.min(line.endIncludingNewline, text.length),\n position: { x: line.left, y: line.baseline + offsetY },\n width: line.width,\n lineY: line.baseline - line.ascent + offsetY,\n lineHeight: line.height,\n lineAscent: line.ascent\n })),\n logicalIndexToCharacterOffsetMap: completeCharacterOffsets(characterOffsets)\n }\n } finally {\n paragraph.delete()\n }\n}\n\nfunction decoratedGlyph(glyph: PlacedTextGlyph): DecoratedGlyph {\n const { commandsBlob, commands } = glyph\n return {\n ...glyph,\n ink: (top, bottom) => {\n if (commandsBlob) return savedGlyphInk(commandsBlob, glyph, top, bottom)\n return commands ? outlineInk(commands, glyph.x, glyph.y, top, bottom) : null\n }\n }\n}\n\n/** Decorations as Figma saves them, over glyphs saved or just shaped. */\nfunction textDecorations(\n node: SceneNode,\n glyphs: readonly PlacedTextGlyph[]\n): TextDecorationRecord[] {\n return textDecorationRects(node, glyphs.map(decoratedGlyph)).map(\n ({ firstCharacter, x, y, width, height }) => ({ firstCharacter, x, y, width, height })\n )\n}\n\nfunction needsShaping(graph: SceneGraph): boolean {\n for (const node of graph.nodes.values()) {\n if (node.type === 'TEXT' && node.text && !node.derivedTextGlyphs?.length) return true\n }\n return false\n}\n\n/** How many shaping calls share each provider made for them; the last one to finish deletes it. */\nconst shaperProviderUsers = new Map<TypefaceFontProvider, number>()\n\n/**\n * Run `use` with text shaped as the canvas lays it out. Unless the attached font provider belongs\n * to this CanvasKit, the loaded fonts are registered in one made for shaping, which calls that\n * overlap share and the last of them deletes.\n */\nexport async function withTextShaper<T>(\n canvasKit: CanvasKit,\n use: (shape: (node: SceneNode) => ShapedText | null) => Promise<T>\n): Promise<T> {\n const attached = fontManager.providerFor(canvasKit)\n const provider = attached ?? canvasKit.TypefaceFontProvider.Make()\n if (!attached) fontManager.attachProvider(canvasKit, provider)\n const shared = !attached || shaperProviderUsers.has(provider)\n if (shared) shaperProviderUsers.set(provider, (shaperProviderUsers.get(provider) ?? 0) + 1)\n try {\n return await use((node) => shapeText(canvasKit, provider, node))\n } finally {\n if (shared) {\n const users = (shaperProviderUsers.get(provider) ?? 1) - 1\n if (users > 0) {\n shaperProviderUsers.set(provider, users)\n } else {\n shaperProviderUsers.delete(provider)\n fontManager.detachProvider(provider)\n provider.delete()\n }\n }\n }\n}\n\n/** Run a `.fig` or Figma clipboard write with text shaping. */\nexport async function withFigExportRuntime<T>(\n graph: SceneGraph,\n ck: CanvasKit | undefined,\n write: (runtime: FigNodeChangeExportRuntime) => Promise<T>\n): Promise<T> {\n const named = { textDecorations, fontStyleName: faceStyleName }\n if (!needsShaping(graph)) return write({ ...EMPTY_EXPORT_RUNTIME, ...named })\n return withTextShaper(ck ?? (await getCanvasKit()), (shapeText) => write({ shapeText, ...named }))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,SAAS,SAAS,MAAiB,MAAuB;CACxD,OAAO,KAAK,KAAK,SAAS,KAAK,KAAK,WAAW,KAAK,KAAK,UAAU,CAAC,KAAK;AAC3E;;AAGA,SAAS,yBAAyB,SAA8C;CAC9E,IAAI,WAAW;CACf,OAAO,QAAQ,KAAK,WAAW;EAC7B,WAAW,UAAU;EACrB,OAAO;CACT,CAAC;AACH;;;;;AAMA,SAAS,iBAAiB,MAAgC;CACxD,MAAM,SAAS,MAAO;CACtB,MAAM,MAAM,OAAQ;CACpB,OAAO;EACL;GAAE,MAAM;GAAK,GAAG;GAAG,GAAG;EAAO;EAC7B;GAAE,MAAM;GAAK,GAAG;GAAM,GAAG;EAAO;EAChC;GAAE,MAAM;GAAK,GAAG;GAAM,GAAG;EAAI;EAC7B;GAAE,MAAM;GAAK,GAAG;GAAG,GAAG;EAAI;EAC1B;GAAE,MAAM;GAAK,GAAG;GAAG,GAAG;EAAO;EAC7B,EAAE,MAAM,IAAI;CACd;AACF;;;;;;AAaA,SAAS,WAAW,MAAiB,MAAc,OAA6C;CAC9F,MAAM,QAAQ,MAAM;CACpB,IAAI,UAAU,KAAA,KAAa,gBAAgB,MAAM,MAAM,KAAK,MAAA,0BAC1D,OAAO,KAAA;CACT,MAAM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AAS,aAAa,OAA4B;CAChD,KAAK,MAAM,QAAQ,MAAM,MAAM,OAAO,GACpC,IAAI,KAAK,SAAS,UAAU,KAAK,QAAQ,CAAC,KAAK,mBAAmB,QAAQ,OAAO;CAEnF,OAAO;AACT;;AAGA,MAAM,sCAAsB,IAAI,IAAkC;;;;;;AAOlE,eAAsB,eACpB,WACA,KACY;CACZ,MAAM,WAAW,YAAY,YAAY,SAAS;CAClD,MAAM,WAAW,YAAY,UAAU,qBAAqB,KAAK;CACjE,IAAI,CAAC,UAAU,YAAY,eAAe,WAAW,QAAQ;CAC7D,MAAM,SAAS,CAAC,YAAY,oBAAoB,IAAI,QAAQ;CAC5D,IAAI,QAAQ,oBAAoB,IAAI,WAAW,oBAAoB,IAAI,QAAQ,KAAK,KAAK,CAAC;CAC1F,IAAI;EACF,OAAO,MAAM,KAAK,SAAS,UAAU,WAAW,UAAU,IAAI,CAAC;CACjE,UAAU;EACR,IAAI,QAAQ;GACV,MAAM,SAAS,oBAAoB,IAAI,QAAQ,KAAK,KAAK;GACzD,IAAI,QAAQ,GACV,oBAAoB,IAAI,UAAU,KAAK;QAClC;IACL,oBAAoB,OAAO,QAAQ;IACnC,YAAY,eAAe,QAAQ;IACnC,SAAS,OAAO;GAClB;EACF;CACF;AACF;;AAGA,eAAsB,qBACpB,OACA,IACA,OACY;CACZ,MAAM,QAAQ;EAAE;EAAiB,eAAe;CAAc;CAC9D,IAAI,CAAC,aAAa,KAAK,GAAG,OAAO,MAAM;EAAE,GAAG;EAAsB,GAAG;CAAM,CAAC;CAC5E,OAAO,eAAe,MAAO,MAAM,aAAa,IAAK,cAAc,MAAM;EAAE;EAAW,GAAG;CAAM,CAAC,CAAC;AACnG"}
|
|
1
|
+
{"version":3,"file":"shape.js","names":[],"sources":["../../../src/canvas/text/shape.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'\n\nimport {\n EMPTY_EXPORT_RUNTIME,\n type FigNodeChangeExportRuntime,\n type PlacedTextGlyph,\n type ShapedText,\n type ShapedTextGlyph,\n type TextDecorationRecord\n} from '@pairdraw/fig/node-change'\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { textVerticalOffset } from '@pairdraw/scene-graph/text'\n\nimport { buildParagraph } from '#core/canvas/text'\nimport { textDecorationRects, type DecoratedGlyph } from '#core/canvas/text/decorations'\nimport { outlineInk, savedGlyphInk } from '#core/canvas/text/ink'\nimport { COMBINING_KEYCAP, keycapFrame } from '#core/canvas/text/keycap'\nimport { characterFamily, laidOutGlyphs, type LaidOutGlyph } from '#core/canvas/text/placed'\nimport { getCanvasKit } from '#core/canvaskit'\nimport { shownText } from '#core/text/case'\nimport { EMOJI_METRICS_FAMILY } from '#core/text/emoji'\nimport type { OutlineCommand } from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\nimport { faceStyleName } from '#core/text/font/names'\nimport { nextGraphemeBoundary } from '#core/text/graphemes'\n\n/**\n * Whether saved glyphs could stand for this text: case changes that alter its length move\n * glyphs off the characters they came from, and path text is placed along its path. Truncated\n * text saves the characters it shows and the ellipsis after them.\n */\nfunction canShape(node: SceneNode, text: string): boolean {\n return node.text.length > 0 && text.length === node.text.length && !node.textPathData\n}\n\n/** Characters inside a glyph cluster or without a glyph take the offset of the one before. */\nfunction completeCharacterOffsets(offsets: Array<number | undefined>): number[] {\n let previous = 0\n return offsets.map((offset) => {\n previous = offset ?? previous\n return previous\n })\n}\n\n/**\n * The square Figma saves for an emoji, in pixels at `size` with y down: 1 em wide, from 0.07 em\n * below the baseline, closed with a line back to its start as Figma writes it.\n */\nfunction emojiPlaceholder(size: number): OutlineCommand[] {\n const bottom = 0.07 * size\n const top = -0.93 * size\n return [\n { type: 'M', x: 0, y: bottom },\n { type: 'L', x: size, y: bottom },\n { type: 'L', x: size, y: top },\n { type: 'L', x: 0, y: top },\n { type: 'L', x: 0, y: bottom },\n { type: 'Z' }\n ]\n}\n\ninterface SavedEmoji {\n codePoints: number[]\n /** Where the emoji's characters end in the text. */\n end: number\n}\n\n/**\n * The emoji a glyph starts, as Figma saves it, when the layout gave it to the emoji metrics font:\n * its code points, an emoji that shows as text by default with the selector that asks for its\n * emoji form, as Figma saves ☺ as ☺️.\n */\nfunction savedEmoji(node: SceneNode, text: string, glyph: LaidOutGlyph): SavedEmoji | undefined {\n const start = glyph.firstCharacter\n if (start === undefined || characterFamily(node, text, start) !== EMOJI_METRICS_FAMILY)\n return undefined\n const end = nextGraphemeBoundary(text, start)\n const emoji = text.slice(start, end)\n const codePoints = Array.from(emoji, (character) => character.codePointAt(0) ?? 0)\n if (codePoints.length === 1 && !/\\p{Emoji_Presentation}/u.test(emoji)) codePoints.push(0xfe0f)\n return { codePoints, end }\n}\n\n/**\n * A glyph's saved outline: an emoji's placeholder, nothing inside one, a keycap's frame, or its\n * font's outline.\n */\nfunction savedOutline(\n glyph: LaidOutGlyph,\n text: string,\n emoji: SavedEmoji | undefined,\n insideEmoji: boolean\n): OutlineCommand[] | null {\n if (insideEmoji) return []\n if (emoji) return emojiPlaceholder(glyph.fontSize)\n const character = glyph.firstCharacter\n if (character !== undefined && text[character] === COMBINING_KEYCAP)\n return keycapFrame(glyph.fontSize)\n return glyph.source?.outline(glyph.id, glyph.fontSize) ?? null\n}\n\n/**\n * Lay a text node out as the renderer draws it and pair each shaped glyph with the outline of\n * the glyph ID CanvasKit chose, so ligatures and contextual forms keep their shapes. An emoji the\n * layout gives the emoji metrics font is saved as Figma saves one: a placeholder square with its\n * code points. When a run's font cannot be told, no glyph gets an outline: the layout still\n * stands and Pairdraw lays the text out again on reading, but Figma draws it blank.\n * Returns `null` for text saved glyphs cannot represent at all.\n */\nexport function shapeText(\n ck: CanvasKit,\n fontProvider: TypefaceFontProvider,\n node: SceneNode\n): ShapedText | null {\n const text = shownText(node)\n if (!canShape(node, text)) return null\n\n const paragraph = buildParagraph({ ck, fontProvider, fontsLoaded: true }, node, undefined, {\n halfLeading: true\n })\n try {\n const offsetY = textVerticalOffset(node, paragraph.getHeight())\n const placed = laidOutGlyphs(node, paragraph, text, offsetY)\n if (!placed) return null\n const metrics = paragraph.getLineMetrics()\n const characterOffsets: Array<number | undefined> = Array.from({ length: text.length })\n // A sequence the font does not join is several glyphs: the first stands for the emoji, and\n // the rest keep their place and draw nothing. Glyphs come in visual order, so in\n // right-to-left text a character before the emoji can follow it: the whole range counts.\n let emojiRange = { start: 0, end: 0 }\n const glyphs: ShapedTextGlyph[] = placed.map((glyph) => {\n const start = glyph.firstCharacter\n if (start !== undefined) characterOffsets[start] ??= glyph.x - glyph.lineLeft\n const insideEmoji = start !== undefined && start > emojiRange.start && start < emojiRange.end\n const emoji = insideEmoji ? undefined : savedEmoji(node, text, glyph)\n if (emoji && start !== undefined) emojiRange = { start, end: emoji.end }\n return {\n commands: savedOutline(glyph, text, emoji, insideEmoji),\n x: glyph.x,\n y: glyph.y,\n fontSize: glyph.fontSize,\n firstCharacter: start,\n advance: glyph.advance,\n emojiCodePoints: emoji?.codePoints\n }\n })\n // Outlines from some runs only would draw the text with characters missing.\n const outlined = glyphs.every((glyph) => glyph.commands)\n return {\n glyphs: outlined ? glyphs : glyphs.map((glyph) => ({ ...glyph, commands: null })),\n // Figma saves no baseline for the empty line after a closing line break.\n baselines: metrics\n .filter((line, index) => index === 0 || line.startIndex < text.length)\n .map((line) => ({\n firstCharacter: line.startIndex,\n endCharacter: Math.min(line.endIncludingNewline, text.length),\n position: { x: line.left, y: line.baseline + offsetY },\n width: line.width,\n lineY: line.baseline - line.ascent + offsetY,\n lineHeight: line.height,\n lineAscent: line.ascent\n })),\n logicalIndexToCharacterOffsetMap: completeCharacterOffsets(characterOffsets)\n }\n } finally {\n paragraph.delete()\n }\n}\n\nfunction decoratedGlyph(glyph: PlacedTextGlyph): DecoratedGlyph {\n const { commandsBlob, commands } = glyph\n return {\n ...glyph,\n ink: (top, bottom) => {\n if (commandsBlob) return savedGlyphInk(commandsBlob, glyph, top, bottom)\n return commands ? outlineInk(commands, glyph.x, glyph.y, top, bottom) : null\n }\n }\n}\n\n/** Decorations as Figma saves them, over glyphs saved or just shaped. */\nfunction textDecorations(\n node: SceneNode,\n glyphs: readonly PlacedTextGlyph[]\n): TextDecorationRecord[] {\n return textDecorationRects(node, glyphs.map(decoratedGlyph)).map(\n ({ firstCharacter, x, y, width, height }) => ({ firstCharacter, x, y, width, height })\n )\n}\n\nfunction needsShaping(graph: SceneGraph): boolean {\n for (const node of graph.nodes.values()) {\n if (node.type === 'TEXT' && node.text && !node.derivedTextGlyphs?.length) return true\n }\n return false\n}\n\n/**\n * Run `use` with text shaped as the canvas lays it out, from the font provider the canvas of\n * `canvasKit` draws from, or one a caller attached and registered faces on for layout alone.\n * Each call holds a share of that provider, so overlapping calls shape from the same one and the\n * last to finish releases it; a provider with no share left is deleted.\n */\nexport async function withTextShaper<T>(\n canvasKit: CanvasKit,\n use: (shape: (node: SceneNode) => ShapedText | null) => Promise<T>\n): Promise<T> {\n const provider = fontManager.acquireProvider(canvasKit)\n try {\n return await use((node) => shapeText(canvasKit, provider, node))\n } finally {\n fontManager.releaseProvider(provider)\n }\n}\n\n/** Run a `.fig` or Figma clipboard write with text shaping. */\nexport async function withFigExportRuntime<T>(\n graph: SceneGraph,\n ck: CanvasKit | undefined,\n write: (runtime: FigNodeChangeExportRuntime) => Promise<T>\n): Promise<T> {\n const named = { textDecorations, fontStyleName: faceStyleName }\n if (!needsShaping(graph)) return write({ ...EMPTY_EXPORT_RUNTIME, ...named })\n return withTextShaper(ck ?? (await getCanvasKit()), (shapeText) => write({ shapeText, ...named }))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA,SAAS,SAAS,MAAiB,MAAuB;CACxD,OAAO,KAAK,KAAK,SAAS,KAAK,KAAK,WAAW,KAAK,KAAK,UAAU,CAAC,KAAK;AAC3E;;AAGA,SAAS,yBAAyB,SAA8C;CAC9E,IAAI,WAAW;CACf,OAAO,QAAQ,KAAK,WAAW;EAC7B,WAAW,UAAU;EACrB,OAAO;CACT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|
package/dist/constants.d.ts
CHANGED
|
@@ -99,13 +99,13 @@ declare const PEN_ANCHOR_RADIUS = 4;
|
|
|
99
99
|
declare const PEN_CLOSE_RADIUS_BOOST = 2;
|
|
100
100
|
declare const PEN_PATH_STROKE_WIDTH = 2;
|
|
101
101
|
declare const PARENT_OUTLINE_ALPHA = 0.5;
|
|
102
|
-
declare const PARENT_OUTLINE_DASH = 4;
|
|
103
102
|
declare const DEFAULT_FONT_FAMILY = "Inter";
|
|
104
103
|
declare const DEFAULT_FONT_SIZE = 14;
|
|
105
104
|
declare const DEFAULT_STROKE_MITER_LIMIT = 4;
|
|
106
105
|
/** Figma's stroke weight for a node that has not been given one. */
|
|
107
106
|
declare const LABEL_FONT_SIZE = 11;
|
|
108
107
|
declare const SIZE_FONT_SIZE = 10;
|
|
108
|
+
declare const HUD_FONT_SIZE = 10;
|
|
109
109
|
declare const VALUE_FONT_SIZE = 11;
|
|
110
110
|
declare const HANDLE_HALF_SIZE = 3;
|
|
111
111
|
declare const LABEL_OFFSET_Y = 8;
|
|
@@ -287,10 +287,14 @@ declare const BOARD_PAGE_BACKGROUND: {
|
|
|
287
287
|
declare const SECTION_DEFAULT_FILLS: Record<InterfaceTheme, Fill>;
|
|
288
288
|
declare const SECTION_DEFAULT_STROKE: Stroke;
|
|
289
289
|
declare const SECTION_CORNER_RADIUS = 2;
|
|
290
|
+
/** Effect filters a renderer keeps: a slider drag would otherwise keep every value it passed. */
|
|
291
|
+
declare const EFFECT_FILTER_CACHE_ENTRIES = 64;
|
|
290
292
|
declare const ZOOM_DIVISOR = 50;
|
|
291
293
|
declare const ZOOM_SCALE_MIN = 0.75;
|
|
292
294
|
declare const ZOOM_SCALE_MAX = 1.25;
|
|
293
295
|
declare const PEN_CLOSE_THRESHOLD = 8;
|
|
296
|
+
/** Points a pen path needs before a press on its first point closes it: two make a closed shape, as in Figma. */
|
|
297
|
+
declare const PEN_CLOSE_MIN_POINTS = 2;
|
|
294
298
|
/**
|
|
295
299
|
* Screen pixels a pencil sample may stray from the line through its neighbours before the curve
|
|
296
300
|
* keeps it, so a stroke drawn zoomed in keeps more detail.
|
|
@@ -308,5 +312,5 @@ declare const DEFAULT_TEXT_HEIGHT = 24;
|
|
|
308
312
|
/** Space Figma leaves between a duplicated top-level frame and the layers to its left. */
|
|
309
313
|
declare const DUPLICATE_FRAME_GAP = 40;
|
|
310
314
|
//#endregion
|
|
311
|
-
export { ACPAgentDef, ACPAgentID, ACP_AGENTS, AIProviderDef, AIProviderID, AI_AGENT_COLOR, AI_DONE_COLOR, AI_DONE_DURATION_MS, AI_ENTER_DURATION_MS, AI_ENTER_MAX_DELAY_MS, AI_ENTER_STAGGER_MS, AI_PROVIDERS, AI_SHIMMER_BAND, AI_SHIMMER_PERIOD_MS, AUTOMATION_HTTP_PORT, AUTO_LAYOUT_HOVER_BLUE, AUTO_LAYOUT_HOVER_BLUE_FILL, AUTO_LAYOUT_HOVER_GAP_PILL, AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_MAGENTA, AUTO_LAYOUT_HOVER_MAGENTA_FILL, AUTO_LAYOUT_HOVER_PADDING_PILL, AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_STRIPE_GAP, AUTO_LAYOUT_HOVER_STRIPE_WIDTH, AUTO_LAYOUT_HOVER_STROKE_WIDTH, AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE, AUTO_LAYOUT_HOVER_TICK_LENGTH, AUTO_LAYOUT_HOVER_VALUE_OFFSET, AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT, AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X, AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y, BLACK, BOARD_GRID, BOARD_PAGE_BACKGROUND, CANVAS_BG_COLOR, CJK_FALLBACK_FAMILIES_LINUX, CJK_FALLBACK_FAMILIES_MACOS, CJK_FALLBACK_FAMILIES_WINDOWS, CJK_GOOGLE_FONTS, CODE_FOCUS_FILL_ALPHA, COMPONENT_COLOR, COMPONENT_LABEL_FONT_SIZE, COMPONENT_LABEL_GAP, COMPONENT_LABEL_ICON_GAP, COMPONENT_LABEL_ICON_SIZE, COMPONENT_SET_BORDER_WIDTH, COMPONENT_SET_DASH, COMPONENT_SET_DASH_GAP, COMPONENT_SET_OUTLINE_RADIUS, DEFAULT_AI_MODEL, DEFAULT_AI_PROVIDER, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FRAME_FILL, DEFAULT_SELECTION_THEME, DEFAULT_SHADOW_COLOR, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_TEXT_HEIGHT, DEFAULT_TEXT_WIDTH, DROP_HIGHLIGHT_ALPHA, DROP_HIGHLIGHT_STROKE, DUPLICATE_FRAME_GAP, FLASH_ATTACK_MS, FLASH_HOLD_MS, FLASH_OVERSHOOT, FLASH_PADDING, FLASH_RADIUS, FLASH_RELEASE_MS, FLASH_STROKE_WIDTH, GOOGLE_FONTS_API_KEY, HANDLE_HALF_SIZE, HANDLE_HIT_RADIUS, HARNESS_PROVIDER_ID, ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_WARNING_COLOR, IS_BROWSER, IS_TAURI, InterfaceTheme, LABEL_FONT_SIZE, LABEL_OFFSET_Y, LAYER_HIT_PAD, LAYOUT_INDICATOR_STROKE, LAYOUT_OUTLINE_DASH, LAYOUT_OUTLINE_GAP, MARQUEE_FILL_ALPHA, MCP_AGENT_HEADER, MCP_CHAT_HEADER, MEASUREMENT_COLOR, MEASUREMENT_PILL_HEIGHT, MEASUREMENT_PILL_PADDING_X, MEASUREMENT_PILL_RADIUS, MEASUREMENT_TEXT_BASELINE, ModelOption, PAGE_DEFAULT_BACKGROUNDS, PAIRDRAW_MCP_SERVER, PARENT_OUTLINE_ALPHA,
|
|
315
|
+
export { ACPAgentDef, ACPAgentID, ACP_AGENTS, AIProviderDef, AIProviderID, AI_AGENT_COLOR, AI_DONE_COLOR, AI_DONE_DURATION_MS, AI_ENTER_DURATION_MS, AI_ENTER_MAX_DELAY_MS, AI_ENTER_STAGGER_MS, AI_PROVIDERS, AI_SHIMMER_BAND, AI_SHIMMER_PERIOD_MS, AUTOMATION_HTTP_PORT, AUTO_LAYOUT_HOVER_BLUE, AUTO_LAYOUT_HOVER_BLUE_FILL, AUTO_LAYOUT_HOVER_GAP_PILL, AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_MAGENTA, AUTO_LAYOUT_HOVER_MAGENTA_FILL, AUTO_LAYOUT_HOVER_PADDING_PILL, AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_STRIPE_GAP, AUTO_LAYOUT_HOVER_STRIPE_WIDTH, AUTO_LAYOUT_HOVER_STROKE_WIDTH, AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE, AUTO_LAYOUT_HOVER_TICK_LENGTH, AUTO_LAYOUT_HOVER_VALUE_OFFSET, AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT, AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X, AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y, BLACK, BOARD_GRID, BOARD_PAGE_BACKGROUND, CANVAS_BG_COLOR, CJK_FALLBACK_FAMILIES_LINUX, CJK_FALLBACK_FAMILIES_MACOS, CJK_FALLBACK_FAMILIES_WINDOWS, CJK_GOOGLE_FONTS, CODE_FOCUS_FILL_ALPHA, COMPONENT_COLOR, COMPONENT_LABEL_FONT_SIZE, COMPONENT_LABEL_GAP, COMPONENT_LABEL_ICON_GAP, COMPONENT_LABEL_ICON_SIZE, COMPONENT_SET_BORDER_WIDTH, COMPONENT_SET_DASH, COMPONENT_SET_DASH_GAP, COMPONENT_SET_OUTLINE_RADIUS, DEFAULT_AI_MODEL, DEFAULT_AI_PROVIDER, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FRAME_FILL, DEFAULT_SELECTION_THEME, DEFAULT_SHADOW_COLOR, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_TEXT_HEIGHT, DEFAULT_TEXT_WIDTH, DROP_HIGHLIGHT_ALPHA, DROP_HIGHLIGHT_STROKE, DUPLICATE_FRAME_GAP, EFFECT_FILTER_CACHE_ENTRIES, FLASH_ATTACK_MS, FLASH_HOLD_MS, FLASH_OVERSHOOT, FLASH_PADDING, FLASH_RADIUS, FLASH_RELEASE_MS, FLASH_STROKE_WIDTH, GOOGLE_FONTS_API_KEY, HANDLE_HALF_SIZE, HANDLE_HIT_RADIUS, HARNESS_PROVIDER_ID, HUD_FONT_SIZE, ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_WARNING_COLOR, IS_BROWSER, IS_TAURI, InterfaceTheme, LABEL_FONT_SIZE, LABEL_OFFSET_Y, LAYER_HIT_PAD, LAYOUT_INDICATOR_STROKE, LAYOUT_OUTLINE_DASH, LAYOUT_OUTLINE_GAP, MARQUEE_FILL_ALPHA, MCP_AGENT_HEADER, MCP_CHAT_HEADER, MEASUREMENT_COLOR, MEASUREMENT_PILL_HEIGHT, MEASUREMENT_PILL_PADDING_X, MEASUREMENT_PILL_RADIUS, MEASUREMENT_TEXT_BASELINE, ModelOption, PAGE_DEFAULT_BACKGROUNDS, PAIRDRAW_MCP_SERVER, PARENT_OUTLINE_ALPHA, PENCIL_STROKE_WEIGHT, PENCIL_TOLERANCE, PEN_ANCHOR_RADIUS, PEN_CLOSE_MIN_POINTS, PEN_CLOSE_RADIUS_BOOST, PEN_CLOSE_THRESHOLD, PEN_HANDLE_RADIUS, PEN_PATH_STROKE_WIDTH, PEN_VERTEX_RADIUS, REASONING_EFFORTS, ROTATION_HANDLE_DISTANCE, ROTATION_SNAP_DEGREES, RULER_BADGE_EXCLUSION, RULER_BADGE_HEIGHT, RULER_BADGE_PADDING, RULER_BADGE_RADIUS, RULER_BG_COLOR, RULER_HIGHLIGHT_ALPHA, RULER_MAJOR_TICK, RULER_MAJOR_TOLERANCE, RULER_MINOR_TICK, RULER_SIZE, RULER_TARGET_PIXEL_SPACING, RULER_TEXT_BASELINE, RULER_TEXT_COLOR, RULER_TICK_COLOR, ReasoningEffort, SECTION_CORNER_RADIUS, SECTION_DEFAULT_FILLS, SECTION_DEFAULT_STROKE, SECTION_HOVER_STROKE_WIDTH, SECTION_TITLE_FONT_FAMILY, SECTION_TITLE_FONT_SIZE, SECTION_TITLE_FONT_URL, SECTION_TITLE_GAP, SECTION_TITLE_HEIGHT, SECTION_TITLE_PADDING_X, SECTION_TITLE_RADIUS, SELECTION_COLOR, SELECTION_DASH_ALPHA, SIZE_FONT_SIZE, SIZE_PILL_HEIGHT, SIZE_PILL_PADDING_X, SIZE_PILL_PADDING_Y, SIZE_PILL_RADIUS, SIZE_PILL_TEXT_OFFSET_Y, SLOT_COLOR, SLOT_EMPTY_FILL_ALPHA, SNAP_COLOR, SNAP_THRESHOLD_SCREEN_PX, SPACING_GUIDE_CAP, TEXT_CARET_COLOR, TEXT_CARET_WIDTH, TEXT_SELECTION_ALPHA, TRANSPARENT, VALUE_FONT_SIZE, VERTEX_SNAP_COLOR, VERTEX_SNAP_GUIDE_ALPHA, VERTEX_SNAP_MARK_RADIUS, ZOOM_DIVISOR, ZOOM_SCALE_MAX, ZOOM_SCALE_MIN };
|
|
312
316
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;cAQa;cACA;cAEA,OAAO;cACP,aAAa;cACb,sBAAsB;cACtB;;;;;;;cAEA,yBAAyB,SAAS;cAIlC;;;;;;;cAEA;;;;;;cACA;cACA;;;;;;;cAEA;;;;;;cACA;cACA;;cAEA;cACA;;;;;;cACA;cACA;cACA;cACA;cACA;;;;;;cACA;;cAEA;cAEA;cACA;;;;;;cACA;;;;;;cACA;;;;;;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cAEA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;cAQa;cACA;cAEA,OAAO;cACP,aAAa;cACb,sBAAsB;cACtB;;;;;;;cAEA,yBAAyB,SAAS;cAIlC;;;;;;;cAEA;;;;;;cACA;cACA;;;;;;;cAEA;;;;;;cACA;cACA;;cAEA;cACA;;;;;;cACA;cACA;cACA;cACA;cACA;;;;;;cACA;;cAEA;cAEA;cACA;;;;;;cACA;;;;;;cACA;;;;;;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cAEA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;;cAEA;cACA;cACA;cACA;cAEA;cAEA;cACA;cACA;cACA;cACA;cACA;cAEA;cACA;;cAEA;cACA;cACA;cAEA;cACA;cACA;cACA;cACA;;cAEA;cACA;cACA;cAEA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cACA;;;;;;cACA;;;;;;cACA;;;;;;cACA;;;;;;cAEA;;;;;;cACA;;;;;;cAEA;cACA;cACA;cACA;;;;;;cAMA;cACA;cACA;cACA;cAEA;cACA;cACA;;cAEA;cACA;cACA;cACA;cACA;cAEA;cACA;cAEA;cACA;cACA;cACA;cACA;cACA;cACA;cAEA;;;;;;cACA;;;;;;cACA;;;;;;cACA;cACA;;cAGA;;;;;cACA;;;;;cACA;;cAEA;;cAEA;;cAEA;;cAEA;;cAEA;;cAGA;;cAEA,kBAAgB;cAChB;cAEA;;;;;cAKA;;cAGA;;;;;cAMA;cAEA;cAEA;cASA;cAUA;cASA;;cAGA,oBAAoB;cAOpB,oBAAoB;;KAQrB;;cAGC,0BAA0B,OAAO,gBAAgB;;cAMjD;;;;;;;cAQA,uBAAuB,OAAO,gBAAgB;cAU9C,wBAAwB;cASxB;;cAGA;cAEA;cACA;cACA;cAEA;;cAEA;;;;;cAKA;;cAEA;cACA;cACA;;cAEA;cACA;cACA;cACA;;cAEA"}
|
package/dist/constants.js
CHANGED
|
@@ -115,13 +115,13 @@ const PEN_ANCHOR_RADIUS = 4;
|
|
|
115
115
|
const PEN_CLOSE_RADIUS_BOOST = 2;
|
|
116
116
|
const PEN_PATH_STROKE_WIDTH = 2;
|
|
117
117
|
const PARENT_OUTLINE_ALPHA = .5;
|
|
118
|
-
const PARENT_OUTLINE_DASH = 4;
|
|
119
118
|
const DEFAULT_FONT_FAMILY = "Inter";
|
|
120
119
|
const DEFAULT_FONT_SIZE = 14;
|
|
121
120
|
const DEFAULT_STROKE_MITER_LIMIT = 4;
|
|
122
121
|
/** Figma's stroke weight for a node that has not been given one. */
|
|
123
122
|
const LABEL_FONT_SIZE = 11;
|
|
124
123
|
const SIZE_FONT_SIZE = 10;
|
|
124
|
+
const HUD_FONT_SIZE = 10;
|
|
125
125
|
const VALUE_FONT_SIZE = 11;
|
|
126
126
|
const HANDLE_HALF_SIZE = 3;
|
|
127
127
|
const LABEL_OFFSET_Y = 8;
|
|
@@ -391,10 +391,14 @@ const SECTION_DEFAULT_STROKE = {
|
|
|
391
391
|
align: "INSIDE"
|
|
392
392
|
};
|
|
393
393
|
const SECTION_CORNER_RADIUS = 2;
|
|
394
|
+
/** Effect filters a renderer keeps: a slider drag would otherwise keep every value it passed. */
|
|
395
|
+
const EFFECT_FILTER_CACHE_ENTRIES = 64;
|
|
394
396
|
const ZOOM_DIVISOR = 50;
|
|
395
397
|
const ZOOM_SCALE_MIN = .75;
|
|
396
398
|
const ZOOM_SCALE_MAX = 1.25;
|
|
397
399
|
const PEN_CLOSE_THRESHOLD = 8;
|
|
400
|
+
/** Points a pen path needs before a press on its first point closes it: two make a closed shape, as in Figma. */
|
|
401
|
+
const PEN_CLOSE_MIN_POINTS = 2;
|
|
398
402
|
/**
|
|
399
403
|
* Screen pixels a pencil sample may stray from the line through its neighbours before the curve
|
|
400
404
|
* keeps it, so a stroke drawn zoomed in keeps more detail.
|
|
@@ -412,6 +416,6 @@ const DEFAULT_TEXT_HEIGHT = 24;
|
|
|
412
416
|
/** Space Figma leaves between a duplicated top-level frame and the layers to its left. */
|
|
413
417
|
const DUPLICATE_FRAME_GAP = 40;
|
|
414
418
|
//#endregion
|
|
415
|
-
export { ACP_AGENTS, AI_AGENT_COLOR, AI_DONE_COLOR, AI_DONE_DURATION_MS, AI_ENTER_DURATION_MS, AI_ENTER_MAX_DELAY_MS, AI_ENTER_STAGGER_MS, AI_PROVIDERS, AI_SHIMMER_BAND, AI_SHIMMER_PERIOD_MS, AUTOMATION_HTTP_PORT, AUTO_LAYOUT_HOVER_BLUE, AUTO_LAYOUT_HOVER_BLUE_FILL, AUTO_LAYOUT_HOVER_GAP_PILL, AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_MAGENTA, AUTO_LAYOUT_HOVER_MAGENTA_FILL, AUTO_LAYOUT_HOVER_PADDING_PILL, AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_STRIPE_GAP, AUTO_LAYOUT_HOVER_STRIPE_WIDTH, AUTO_LAYOUT_HOVER_STROKE_WIDTH, AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE, AUTO_LAYOUT_HOVER_TICK_LENGTH, AUTO_LAYOUT_HOVER_VALUE_OFFSET, AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT, AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X, AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y, BLACK, BOARD_GRID, BOARD_PAGE_BACKGROUND, CANVAS_BG_COLOR, CJK_FALLBACK_FAMILIES_LINUX, CJK_FALLBACK_FAMILIES_MACOS, CJK_FALLBACK_FAMILIES_WINDOWS, CJK_GOOGLE_FONTS, CODE_FOCUS_FILL_ALPHA, COMPONENT_COLOR, COMPONENT_LABEL_FONT_SIZE, COMPONENT_LABEL_GAP, COMPONENT_LABEL_ICON_GAP, COMPONENT_LABEL_ICON_SIZE, COMPONENT_SET_BORDER_WIDTH, COMPONENT_SET_DASH, COMPONENT_SET_DASH_GAP, COMPONENT_SET_OUTLINE_RADIUS, DEFAULT_AI_MODEL, DEFAULT_AI_PROVIDER, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FRAME_FILL, DEFAULT_SELECTION_THEME, DEFAULT_SHADOW_COLOR, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_TEXT_HEIGHT, DEFAULT_TEXT_WIDTH, DROP_HIGHLIGHT_ALPHA, DROP_HIGHLIGHT_STROKE, DUPLICATE_FRAME_GAP, FLASH_ATTACK_MS, FLASH_HOLD_MS, FLASH_OVERSHOOT, FLASH_PADDING, FLASH_RADIUS, FLASH_RELEASE_MS, FLASH_STROKE_WIDTH, GOOGLE_FONTS_API_KEY, HANDLE_HALF_SIZE, HANDLE_HIT_RADIUS, HARNESS_PROVIDER_ID, ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_WARNING_COLOR, IS_BROWSER, IS_TAURI, LABEL_FONT_SIZE, LABEL_OFFSET_Y, LAYER_HIT_PAD, LAYOUT_INDICATOR_STROKE, LAYOUT_OUTLINE_DASH, LAYOUT_OUTLINE_GAP, MARQUEE_FILL_ALPHA, MCP_AGENT_HEADER, MCP_CHAT_HEADER, MEASUREMENT_COLOR, MEASUREMENT_PILL_HEIGHT, MEASUREMENT_PILL_PADDING_X, MEASUREMENT_PILL_RADIUS, MEASUREMENT_TEXT_BASELINE, PAGE_DEFAULT_BACKGROUNDS, PAIRDRAW_MCP_SERVER, PARENT_OUTLINE_ALPHA,
|
|
419
|
+
export { ACP_AGENTS, AI_AGENT_COLOR, AI_DONE_COLOR, AI_DONE_DURATION_MS, AI_ENTER_DURATION_MS, AI_ENTER_MAX_DELAY_MS, AI_ENTER_STAGGER_MS, AI_PROVIDERS, AI_SHIMMER_BAND, AI_SHIMMER_PERIOD_MS, AUTOMATION_HTTP_PORT, AUTO_LAYOUT_HOVER_BLUE, AUTO_LAYOUT_HOVER_BLUE_FILL, AUTO_LAYOUT_HOVER_GAP_PILL, AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_MAGENTA, AUTO_LAYOUT_HOVER_MAGENTA_FILL, AUTO_LAYOUT_HOVER_PADDING_PILL, AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE, AUTO_LAYOUT_HOVER_STRIPE_GAP, AUTO_LAYOUT_HOVER_STRIPE_WIDTH, AUTO_LAYOUT_HOVER_STROKE_WIDTH, AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE, AUTO_LAYOUT_HOVER_TICK_LENGTH, AUTO_LAYOUT_HOVER_VALUE_OFFSET, AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT, AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X, AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X, AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y, BLACK, BOARD_GRID, BOARD_PAGE_BACKGROUND, CANVAS_BG_COLOR, CJK_FALLBACK_FAMILIES_LINUX, CJK_FALLBACK_FAMILIES_MACOS, CJK_FALLBACK_FAMILIES_WINDOWS, CJK_GOOGLE_FONTS, CODE_FOCUS_FILL_ALPHA, COMPONENT_COLOR, COMPONENT_LABEL_FONT_SIZE, COMPONENT_LABEL_GAP, COMPONENT_LABEL_ICON_GAP, COMPONENT_LABEL_ICON_SIZE, COMPONENT_SET_BORDER_WIDTH, COMPONENT_SET_DASH, COMPONENT_SET_DASH_GAP, COMPONENT_SET_OUTLINE_RADIUS, DEFAULT_AI_MODEL, DEFAULT_AI_PROVIDER, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FRAME_FILL, DEFAULT_SELECTION_THEME, DEFAULT_SHADOW_COLOR, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_MITER_LIMIT, DEFAULT_TEXT_HEIGHT, DEFAULT_TEXT_WIDTH, DROP_HIGHLIGHT_ALPHA, DROP_HIGHLIGHT_STROKE, DUPLICATE_FRAME_GAP, EFFECT_FILTER_CACHE_ENTRIES, FLASH_ATTACK_MS, FLASH_HOLD_MS, FLASH_OVERSHOOT, FLASH_PADDING, FLASH_RADIUS, FLASH_RELEASE_MS, FLASH_STROKE_WIDTH, GOOGLE_FONTS_API_KEY, HANDLE_HALF_SIZE, HANDLE_HIT_RADIUS, HARNESS_PROVIDER_ID, HUD_FONT_SIZE, ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_WARNING_COLOR, IS_BROWSER, IS_TAURI, LABEL_FONT_SIZE, LABEL_OFFSET_Y, LAYER_HIT_PAD, LAYOUT_INDICATOR_STROKE, LAYOUT_OUTLINE_DASH, LAYOUT_OUTLINE_GAP, MARQUEE_FILL_ALPHA, MCP_AGENT_HEADER, MCP_CHAT_HEADER, MEASUREMENT_COLOR, MEASUREMENT_PILL_HEIGHT, MEASUREMENT_PILL_PADDING_X, MEASUREMENT_PILL_RADIUS, MEASUREMENT_TEXT_BASELINE, PAGE_DEFAULT_BACKGROUNDS, PAIRDRAW_MCP_SERVER, PARENT_OUTLINE_ALPHA, PENCIL_STROKE_WEIGHT, PENCIL_TOLERANCE, PEN_ANCHOR_RADIUS, PEN_CLOSE_MIN_POINTS, PEN_CLOSE_RADIUS_BOOST, PEN_CLOSE_THRESHOLD, PEN_HANDLE_RADIUS, PEN_PATH_STROKE_WIDTH, PEN_VERTEX_RADIUS, REASONING_EFFORTS, ROTATION_HANDLE_DISTANCE, ROTATION_SNAP_DEGREES, RULER_BADGE_EXCLUSION, RULER_BADGE_HEIGHT, RULER_BADGE_PADDING, RULER_BADGE_RADIUS, RULER_BG_COLOR, RULER_HIGHLIGHT_ALPHA, RULER_MAJOR_TICK, RULER_MAJOR_TOLERANCE, RULER_MINOR_TICK, RULER_SIZE, RULER_TARGET_PIXEL_SPACING, RULER_TEXT_BASELINE, RULER_TEXT_COLOR, RULER_TICK_COLOR, SECTION_CORNER_RADIUS, SECTION_DEFAULT_FILLS, SECTION_DEFAULT_STROKE, SECTION_HOVER_STROKE_WIDTH, SECTION_TITLE_FONT_FAMILY, SECTION_TITLE_FONT_SIZE, SECTION_TITLE_FONT_URL, SECTION_TITLE_GAP, SECTION_TITLE_HEIGHT, SECTION_TITLE_PADDING_X, SECTION_TITLE_RADIUS, SELECTION_COLOR, SELECTION_DASH_ALPHA, SIZE_FONT_SIZE, SIZE_PILL_HEIGHT, SIZE_PILL_PADDING_X, SIZE_PILL_PADDING_Y, SIZE_PILL_RADIUS, SIZE_PILL_TEXT_OFFSET_Y, SLOT_COLOR, SLOT_EMPTY_FILL_ALPHA, SNAP_COLOR, SNAP_THRESHOLD_SCREEN_PX, SPACING_GUIDE_CAP, TEXT_CARET_COLOR, TEXT_CARET_WIDTH, TEXT_SELECTION_ALPHA, TRANSPARENT, VALUE_FONT_SIZE, VERTEX_SNAP_COLOR, VERTEX_SNAP_GUIDE_ALPHA, VERTEX_SNAP_MARK_RADIUS, ZOOM_DIVISOR, ZOOM_SCALE_MAX, ZOOM_SCALE_MIN };
|
|
416
420
|
|
|
417
421
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { Fill, Stroke } from '@pairdraw/scene-graph'\nimport { WHITE } from '@pairdraw/scene-graph/constants'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { SelectionTheme } from '#core/canvas/renderer/types'\n\nexport * from './ai/providers'\n\nexport const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_TAURI = IS_BROWSER && '__TAURI_INTERNALS__' in window\n\nexport const BLACK: Color = { r: 0, g: 0, b: 0, a: 1 }\nexport const TRANSPARENT: Color = { r: 0, g: 0, b: 0, a: 0 }\nexport const DEFAULT_SHADOW_COLOR: Color = { r: 0, g: 0, b: 0, a: 0.25 }\nexport const SELECTION_COLOR = { r: 0.23, g: 0.51, b: 0.96, a: 1 } satisfies Color\n/** Selection chrome when the app sets no accent: the default blue with white text. */\nexport const DEFAULT_SELECTION_THEME: Readonly<SelectionTheme> = {\n color: SELECTION_COLOR,\n foreground: WHITE\n}\nexport const COMPONENT_COLOR = { r: 0.592, g: 0.278, b: 1, a: 1 } satisfies Color\n/** Slot frames and their outlines, `#f24bbc` like the app's `--color-slot`. */\nexport const SLOT_COLOR = { r: 0.949, g: 0.294, b: 0.737, a: 1 } satisfies Color\nexport const SLOT_EMPTY_FILL_ALPHA = 0.08\nexport const SNAP_COLOR = { r: 1.0, g: 0.0, b: 0.56, a: 1 } satisfies Color\n/** Guides through path vertices and their crosses, measured from Figma's pen and vector edit mode. */\nexport const VERTEX_SNAP_COLOR = { r: 0.81, g: 0.3, b: 0.18, a: 1 } satisfies Color\nexport const VERTEX_SNAP_GUIDE_ALPHA = 0.6\nexport const VERTEX_SNAP_MARK_RADIUS = 2.5\n/** Half the length of the ticks that end an equal-spacing indicator, in screen pixels. */\nexport const SPACING_GUIDE_CAP = 4\nexport const MEASUREMENT_COLOR = { r: 0.949, g: 0.282, b: 0.133, a: 1 } satisfies Color\nexport const MEASUREMENT_PILL_PADDING_X = 5\nexport const MEASUREMENT_PILL_HEIGHT = 18\nexport const MEASUREMENT_PILL_RADIUS = 3\nexport const MEASUREMENT_TEXT_BASELINE = 4\nexport const CANVAS_BG_COLOR = { r: 0.96, g: 0.96, b: 0.96, a: 1 } satisfies Color\nexport const SNAP_THRESHOLD_SCREEN_PX = 5\n/** The grid a board's layers land on, as FigJam's dots every 16 units. */\nexport const BOARD_GRID = 16\n\nexport const RULER_SIZE = 20\nexport const RULER_BG_COLOR = { r: 0.14, g: 0.14, b: 0.14, a: 1 } satisfies Color\nexport const RULER_TICK_COLOR = { r: 0.4, g: 0.4, b: 0.4, a: 1 } satisfies Color\nexport const RULER_TEXT_COLOR = { r: 0.55, g: 0.55, b: 0.55, a: 1 } satisfies Color\nexport const RULER_BADGE_HEIGHT = 14\nexport const RULER_BADGE_PADDING = 3\nexport const RULER_BADGE_RADIUS = 2\nexport const RULER_BADGE_EXCLUSION = 30\nexport const RULER_TEXT_BASELINE = 0.65\nexport const RULER_MAJOR_TICK = 0.5\nexport const RULER_MINOR_TICK = 0.25\nexport const RULER_HIGHLIGHT_ALPHA = 0.3\n\nexport const PEN_HANDLE_RADIUS = 2.5\nexport const PEN_VERTEX_RADIUS = 3\nexport const PEN_ANCHOR_RADIUS = 4\nexport const PEN_CLOSE_RADIUS_BOOST = 2\nexport const PEN_PATH_STROKE_WIDTH = 2\nexport const PARENT_OUTLINE_ALPHA = 0.5\nexport const PARENT_OUTLINE_DASH = 4\nexport const DEFAULT_FONT_FAMILY = 'Inter'\nexport const DEFAULT_FONT_SIZE = 14\nexport const DEFAULT_STROKE_MITER_LIMIT = 4\n/** Figma's stroke weight for a node that has not been given one. */\nexport const LABEL_FONT_SIZE = 11\nexport const SIZE_FONT_SIZE = 10\nexport const VALUE_FONT_SIZE = 11\n\nexport const HANDLE_HALF_SIZE = 3\n\nexport const LABEL_OFFSET_Y = 8\nexport const SIZE_PILL_PADDING_X = 6\nexport const SIZE_PILL_PADDING_Y = 6\nexport const SIZE_PILL_HEIGHT = 18\nexport const SIZE_PILL_RADIUS = 4\nexport const SIZE_PILL_TEXT_OFFSET_Y = 13\n\nexport const MARQUEE_FILL_ALPHA = 0.08\nexport const SELECTION_DASH_ALPHA = 0.6\n/** Tint inside the layer of the code element around the cursor, under its hover outline. */\nexport const CODE_FOCUS_FILL_ALPHA = 0.1\nexport const DROP_HIGHLIGHT_ALPHA = 0.8\nexport const DROP_HIGHLIGHT_STROKE = 2\n\nexport const LAYOUT_INDICATOR_STROKE = 2\nexport const AUTO_LAYOUT_HOVER_TICK_LENGTH = 12\nexport const AUTO_LAYOUT_HOVER_STRIPE_GAP = 8\nexport const AUTO_LAYOUT_HOVER_STRIPE_WIDTH = 1\nexport const AUTO_LAYOUT_HOVER_STROKE_WIDTH = 1.5\n/** Dash and gap, in screen pixels, of the dotted outlines around auto layout children (Figma 126). */\nexport const LAYOUT_OUTLINE_DASH = 1.75\nexport const LAYOUT_OUTLINE_GAP = 1.25\nexport const AUTO_LAYOUT_HOVER_VALUE_OFFSET = 18\n// Measured on Figma desktop 126's padding and gap value pills.\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT = 16.5\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS = 2.5\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X = 4.5\nexport const AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE = 12\nexport const AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE = 8\nexport const AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE = 20\nexport const AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X = 18\nexport const AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y = 36\nexport const AUTO_LAYOUT_HOVER_BLUE = { r: 0.28, g: 0.64, b: 1, a: 0.82 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_BLUE_FILL = { r: 0.28, g: 0.64, b: 1, a: 0.1 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_MAGENTA = { r: 1, g: 0.32, b: 0.68, a: 0.78 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_MAGENTA_FILL = { r: 1, g: 0.32, b: 0.68, a: 0.1 } satisfies Color\n// The value pills over a gap and a padding, sampled from Figma desktop 126.\nexport const AUTO_LAYOUT_HOVER_GAP_PILL = { r: 0.886, g: 0.271, b: 0.686, a: 1 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_PADDING_PILL = { r: 0.271, g: 0.592, b: 0.973, a: 1 } satisfies Color\n\nexport const SECTION_TITLE_HEIGHT = 24\nexport const SECTION_TITLE_PADDING_X = 6\nexport const SECTION_TITLE_RADIUS = 5\nexport const SECTION_TITLE_FONT_SIZE = 11\n/**\n * The family section titles draw in: the bundled Inter SemiBold under a name of its own, on the\n * canvas and in the page, so renaming a title shows the same glyphs and document fonts named\n * Inter cannot replace them.\n */\nexport const SECTION_TITLE_FONT_FAMILY = 'Pairdraw Section Title'\nexport const SECTION_TITLE_FONT_URL = '/Inter-SemiBold.ttf'\nexport const SECTION_TITLE_GAP = 6\nexport const SECTION_HOVER_STROKE_WIDTH = 2\n\nexport const COMPONENT_SET_DASH = 6\nexport const COMPONENT_SET_DASH_GAP = 4\nexport const COMPONENT_SET_BORDER_WIDTH = 1.5\n/** Corners of the outline the editor draws around a component set with no strokes of its own. */\nexport const COMPONENT_SET_OUTLINE_RADIUS = 5\nexport const COMPONENT_LABEL_FONT_SIZE = 11\nexport const COMPONENT_LABEL_GAP = 6\nexport const COMPONENT_LABEL_ICON_SIZE = 10\nexport const COMPONENT_LABEL_ICON_GAP = 4\n\nexport const RULER_TARGET_PIXEL_SPACING = 100\nexport const RULER_MAJOR_TOLERANCE = 0.01\n\nexport const FLASH_ATTACK_MS = 200\nexport const FLASH_HOLD_MS = 400\nexport const FLASH_RELEASE_MS = 300\nexport const FLASH_STROKE_WIDTH = 2\nexport const FLASH_PADDING = 5\nexport const FLASH_OVERSHOOT = 30\nexport const FLASH_RADIUS = 4\n\nexport const ISSUE_ERROR_COLOR = { r: 0.949, g: 0.282, b: 0.133, a: 1 } satisfies Color // #F24822\nexport const ISSUE_WARNING_COLOR = { r: 1, g: 0.702, b: 0.078, a: 1 } satisfies Color // #FFB314\nexport const ISSUE_INFO_COLOR = { r: 0.55, g: 0.55, b: 0.55, a: 1 } satisfies Color\nexport const ISSUE_HIGHLIGHT_STROKE_WIDTH = 1.5\nexport const ISSUE_HIGHLIGHT_FILL_ALPHA = 0.08\n\n/** The violet AI agents show in everywhere, the app's `--color-agent`. */\nexport const AI_AGENT_COLOR = { r: 0.486, g: 0.361, b: 1 }\nexport const AI_DONE_COLOR = { r: 0.16, g: 0.73, b: 0.36 }\nexport const AI_DONE_DURATION_MS = 800\n/** How long a layer an agent adds takes to trace in, once its turn comes. */\nexport const AI_ENTER_DURATION_MS = 480\n/** The pause between the layers of one edit, so they appear one after another. */\nexport const AI_ENTER_STAGGER_MS = 45\n/** The last layer of an edit starts within this, however many layers the edit adds. */\nexport const AI_ENTER_MAX_DELAY_MS = 900\n/** One sweep of the light over an area an agent is working in. */\nexport const AI_SHIMMER_PERIOD_MS = 1600\n/** Width of the sweeping light, in screen pixels. */\nexport const AI_SHIMMER_BAND = 120\n\n/** Opacity of the selection color behind selected text while editing. */\nexport const TEXT_SELECTION_ALPHA = 0.3\n/** The caret's colour where the text's fill gives it none, as Figma's. */\nexport const TEXT_CARET_COLOR = BLACK\nexport const TEXT_CARET_WIDTH = 1\n\nexport const AUTOMATION_HTTP_PORT = 7600\n/**\n * Request header the app's own ACP and Pi harness chats send to the MCP server, so their sessions\n * show as those agents rather than as an outside MCP client.\n */\nexport const MCP_AGENT_HEADER = 'x-pairdraw-agent'\n\n/** The name the app's chats give Pairdraw's MCP server in an agent's session. */\nexport const PAIRDRAW_MCP_SERVER = 'pairdraw'\n\n/**\n * Request header naming the app chat whose agent opens an MCP session, so the app can tell that\n * this chat's agent reached its tools before it sends the prompt.\n */\nexport const MCP_CHAT_HEADER = 'x-pairdraw-chat'\n\nexport const GOOGLE_FONTS_API_KEY = 'AIzaSyD1tYDR_dUEiV-Tw1vksEhZbUytgKW5pc8'\n\nexport const CJK_FALLBACK_FAMILIES_MACOS = [\n 'PingFang SC',\n 'PingFang TC',\n 'Hiragino Sans',\n 'Apple SD Gothic Neo',\n 'Heiti SC',\n 'Heiti TC'\n]\n\nexport const CJK_FALLBACK_FAMILIES_WINDOWS = [\n 'Microsoft YaHei',\n 'Microsoft YaHei UI',\n 'Microsoft JhengHei',\n 'Yu Gothic',\n 'Malgun Gothic',\n 'SimHei',\n 'SimSun'\n]\n\nexport const CJK_FALLBACK_FAMILIES_LINUX = [\n 'Noto Sans CJK SC',\n 'Noto Sans CJK TC',\n 'Noto Sans CJK JP',\n 'Noto Sans CJK KR',\n 'WenQuanYi Micro Hei',\n 'Droid Sans Fallback'\n]\n\nexport const CJK_GOOGLE_FONTS = ['Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR']\n\n/** Figma's #D9D9D9 for new shapes. */\nexport const DEFAULT_SHAPE_FILL: Fill = {\n type: 'SOLID',\n color: { r: 217 / 255, g: 217 / 255, b: 217 / 255, a: 1 },\n opacity: 1,\n visible: true\n}\n\nexport const DEFAULT_FRAME_FILL: Fill = {\n type: 'SOLID',\n color: { r: 1, g: 1, b: 1, a: 1 },\n opacity: 1,\n visible: true\n}\n\n/** The light or dark interface a new page or section takes its colors from, as in Figma. */\nexport type InterfaceTheme = 'light' | 'dark'\n\n/** A new page's background, which Figma picks from the interface theme it was made in. */\nexport const PAGE_DEFAULT_BACKGROUNDS: Record<InterfaceTheme, Color> = {\n light: CANVAS_BG_COLOR,\n dark: { r: 0x1e / 255, g: 0x1e / 255, b: 0x1e / 255, a: 1 }\n}\n\n/** A FigJam board's page, #F5F5F5 whatever the interface theme, as Figma saves it. */\nexport const BOARD_PAGE_BACKGROUND = {\n r: 245 / 255,\n g: 245 / 255,\n b: 245 / 255,\n a: 1\n} satisfies Color\n\n/** A new section's fill, which Figma picks from the interface theme it was made in. */\nexport const SECTION_DEFAULT_FILLS: Record<InterfaceTheme, Fill> = {\n light: { type: 'SOLID', color: { r: 1, g: 1, b: 1, a: 1 }, opacity: 1, visible: true },\n dark: {\n type: 'SOLID',\n color: { r: 0x44 / 255, g: 0x44 / 255, b: 0x44 / 255, a: 1 },\n opacity: 1,\n visible: true\n }\n}\n\nexport const SECTION_DEFAULT_STROKE: Stroke = {\n type: 'SOLID',\n color: { r: 1, g: 1, b: 1, a: 1 },\n weight: 1,\n opacity: 0.1,\n visible: true,\n align: 'INSIDE'\n}\n\nexport const SECTION_CORNER_RADIUS = 2\n\nexport const ZOOM_DIVISOR = 50\nexport const ZOOM_SCALE_MIN = 0.75\nexport const ZOOM_SCALE_MAX = 1.25\n\nexport const PEN_CLOSE_THRESHOLD = 8\n/**\n * Screen pixels a pencil sample may stray from the line through its neighbours before the curve\n * keeps it, so a stroke drawn zoomed in keeps more detail.\n */\nexport const PENCIL_TOLERANCE = 2.5\n/** A new pencil layer's stroke weight (Figma desktop 126). */\nexport const PENCIL_STROKE_WEIGHT = 2\nexport const ROTATION_SNAP_DEGREES = 15\nexport const HANDLE_HIT_RADIUS = 6\n/** How far outside a shape, in screen pixels, a click still selects it (Figma desktop 126). */\nexport const LAYER_HIT_PAD = 3.5\nexport const ROTATION_HANDLE_DISTANCE = 24\nexport const DEFAULT_TEXT_WIDTH = 200\nexport const DEFAULT_TEXT_HEIGHT = 24\n/** Space Figma leaves between a duplicated top-level frame and the layers to its left. */\nexport const DUPLICATE_FRAME_GAP = 40\n"],"mappings":";;;AAQA,MAAa,aAAa,OAAO,WAAW;AAC5C,MAAa,WAAW,cAAc,yBAAyB;AAE/D,MAAa,QAAe;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AACrD,MAAa,cAAqB;CAAE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G;EAAG,GAAG;EAAG,GAAG;CAAE;CAChC,QAAQ;CACR,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAa,wBAAwB;AAErC,MAAa,eAAe;AAC5B,MAAa,iBAAiB;AAC9B,MAAa,iBAAiB;AAE9B,MAAa,sBAAsB;;;;;AAKnC,MAAa,mBAAmB;;AAEhC,MAAa,uBAAuB;AACpC,MAAa,wBAAwB;AACrC,MAAa,oBAAoB;;AAEjC,MAAa,gBAAgB;AAC7B,MAAa,2BAA2B;AACxC,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;;AAEnC,MAAa,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { Fill, Stroke } from '@pairdraw/scene-graph'\nimport { WHITE } from '@pairdraw/scene-graph/constants'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { SelectionTheme } from '#core/canvas/renderer/types'\n\nexport * from './ai/providers'\n\nexport const IS_BROWSER = typeof window !== 'undefined'\nexport const IS_TAURI = IS_BROWSER && '__TAURI_INTERNALS__' in window\n\nexport const BLACK: Color = { r: 0, g: 0, b: 0, a: 1 }\nexport const TRANSPARENT: Color = { r: 0, g: 0, b: 0, a: 0 }\nexport const DEFAULT_SHADOW_COLOR: Color = { r: 0, g: 0, b: 0, a: 0.25 }\nexport const SELECTION_COLOR = { r: 0.23, g: 0.51, b: 0.96, a: 1 } satisfies Color\n/** Selection chrome when the app sets no accent: the default blue with white text. */\nexport const DEFAULT_SELECTION_THEME: Readonly<SelectionTheme> = {\n color: SELECTION_COLOR,\n foreground: WHITE\n}\nexport const COMPONENT_COLOR = { r: 0.592, g: 0.278, b: 1, a: 1 } satisfies Color\n/** Slot frames and their outlines, `#f24bbc` like the app's `--color-slot`. */\nexport const SLOT_COLOR = { r: 0.949, g: 0.294, b: 0.737, a: 1 } satisfies Color\nexport const SLOT_EMPTY_FILL_ALPHA = 0.08\nexport const SNAP_COLOR = { r: 1.0, g: 0.0, b: 0.56, a: 1 } satisfies Color\n/** Guides through path vertices and their crosses, measured from Figma's pen and vector edit mode. */\nexport const VERTEX_SNAP_COLOR = { r: 0.81, g: 0.3, b: 0.18, a: 1 } satisfies Color\nexport const VERTEX_SNAP_GUIDE_ALPHA = 0.6\nexport const VERTEX_SNAP_MARK_RADIUS = 2.5\n/** Half the length of the ticks that end an equal-spacing indicator, in screen pixels. */\nexport const SPACING_GUIDE_CAP = 4\nexport const MEASUREMENT_COLOR = { r: 0.949, g: 0.282, b: 0.133, a: 1 } satisfies Color\nexport const MEASUREMENT_PILL_PADDING_X = 5\nexport const MEASUREMENT_PILL_HEIGHT = 18\nexport const MEASUREMENT_PILL_RADIUS = 3\nexport const MEASUREMENT_TEXT_BASELINE = 4\nexport const CANVAS_BG_COLOR = { r: 0.96, g: 0.96, b: 0.96, a: 1 } satisfies Color\nexport const SNAP_THRESHOLD_SCREEN_PX = 5\n/** The grid a board's layers land on, as FigJam's dots every 16 units. */\nexport const BOARD_GRID = 16\n\nexport const RULER_SIZE = 20\nexport const RULER_BG_COLOR = { r: 0.14, g: 0.14, b: 0.14, a: 1 } satisfies Color\nexport const RULER_TICK_COLOR = { r: 0.4, g: 0.4, b: 0.4, a: 1 } satisfies Color\nexport const RULER_TEXT_COLOR = { r: 0.55, g: 0.55, b: 0.55, a: 1 } satisfies Color\nexport const RULER_BADGE_HEIGHT = 14\nexport const RULER_BADGE_PADDING = 3\nexport const RULER_BADGE_RADIUS = 2\nexport const RULER_BADGE_EXCLUSION = 30\nexport const RULER_TEXT_BASELINE = 0.65\nexport const RULER_MAJOR_TICK = 0.5\nexport const RULER_MINOR_TICK = 0.25\nexport const RULER_HIGHLIGHT_ALPHA = 0.3\n\nexport const PEN_HANDLE_RADIUS = 2.5\nexport const PEN_VERTEX_RADIUS = 3\nexport const PEN_ANCHOR_RADIUS = 4\nexport const PEN_CLOSE_RADIUS_BOOST = 2\nexport const PEN_PATH_STROKE_WIDTH = 2\nexport const PARENT_OUTLINE_ALPHA = 0.5\nexport const DEFAULT_FONT_FAMILY = 'Inter'\nexport const DEFAULT_FONT_SIZE = 14\nexport const DEFAULT_STROKE_MITER_LIMIT = 4\n/** Figma's stroke weight for a node that has not been given one. */\nexport const LABEL_FONT_SIZE = 11\nexport const SIZE_FONT_SIZE = 10\nexport const HUD_FONT_SIZE = 10\nexport const VALUE_FONT_SIZE = 11\n\nexport const HANDLE_HALF_SIZE = 3\n\nexport const LABEL_OFFSET_Y = 8\nexport const SIZE_PILL_PADDING_X = 6\nexport const SIZE_PILL_PADDING_Y = 6\nexport const SIZE_PILL_HEIGHT = 18\nexport const SIZE_PILL_RADIUS = 4\nexport const SIZE_PILL_TEXT_OFFSET_Y = 13\n\nexport const MARQUEE_FILL_ALPHA = 0.08\nexport const SELECTION_DASH_ALPHA = 0.6\n/** Tint inside the layer of the code element around the cursor, under its hover outline. */\nexport const CODE_FOCUS_FILL_ALPHA = 0.1\nexport const DROP_HIGHLIGHT_ALPHA = 0.8\nexport const DROP_HIGHLIGHT_STROKE = 2\n\nexport const LAYOUT_INDICATOR_STROKE = 2\nexport const AUTO_LAYOUT_HOVER_TICK_LENGTH = 12\nexport const AUTO_LAYOUT_HOVER_STRIPE_GAP = 8\nexport const AUTO_LAYOUT_HOVER_STRIPE_WIDTH = 1\nexport const AUTO_LAYOUT_HOVER_STROKE_WIDTH = 1.5\n/** Dash and gap, in screen pixels, of the dotted outlines around auto layout children (Figma 126). */\nexport const LAYOUT_OUTLINE_DASH = 1.75\nexport const LAYOUT_OUTLINE_GAP = 1.25\nexport const AUTO_LAYOUT_HOVER_VALUE_OFFSET = 18\n// Measured on Figma desktop 126's padding and gap value pills.\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_HEIGHT = 16.5\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_RADIUS = 2.5\nexport const AUTO_LAYOUT_HOVER_VALUE_PILL_PADDING_X = 4.5\nexport const AUTO_LAYOUT_HOVER_GAP_REGION_TOLERANCE = 12\nexport const AUTO_LAYOUT_HOVER_TICK_HIT_TOLERANCE = 8\nexport const AUTO_LAYOUT_HOVER_PADDING_REGION_TOLERANCE = 20\nexport const AUTO_LAYOUT_PADDING_EDITOR_OFFSET_X = 18\nexport const AUTO_LAYOUT_PADDING_EDITOR_OFFSET_Y = 36\nexport const AUTO_LAYOUT_HOVER_BLUE = { r: 0.28, g: 0.64, b: 1, a: 0.82 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_BLUE_FILL = { r: 0.28, g: 0.64, b: 1, a: 0.1 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_MAGENTA = { r: 1, g: 0.32, b: 0.68, a: 0.78 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_MAGENTA_FILL = { r: 1, g: 0.32, b: 0.68, a: 0.1 } satisfies Color\n// The value pills over a gap and a padding, sampled from Figma desktop 126.\nexport const AUTO_LAYOUT_HOVER_GAP_PILL = { r: 0.886, g: 0.271, b: 0.686, a: 1 } satisfies Color\nexport const AUTO_LAYOUT_HOVER_PADDING_PILL = { r: 0.271, g: 0.592, b: 0.973, a: 1 } satisfies Color\n\nexport const SECTION_TITLE_HEIGHT = 24\nexport const SECTION_TITLE_PADDING_X = 6\nexport const SECTION_TITLE_RADIUS = 5\nexport const SECTION_TITLE_FONT_SIZE = 11\n/**\n * The family section titles draw in: the bundled Inter SemiBold under a name of its own, on the\n * canvas and in the page, so renaming a title shows the same glyphs and document fonts named\n * Inter cannot replace them.\n */\nexport const SECTION_TITLE_FONT_FAMILY = 'Pairdraw Section Title'\nexport const SECTION_TITLE_FONT_URL = '/Inter-SemiBold.ttf'\nexport const SECTION_TITLE_GAP = 6\nexport const SECTION_HOVER_STROKE_WIDTH = 2\n\nexport const COMPONENT_SET_DASH = 6\nexport const COMPONENT_SET_DASH_GAP = 4\nexport const COMPONENT_SET_BORDER_WIDTH = 1.5\n/** Corners of the outline the editor draws around a component set with no strokes of its own. */\nexport const COMPONENT_SET_OUTLINE_RADIUS = 5\nexport const COMPONENT_LABEL_FONT_SIZE = 11\nexport const COMPONENT_LABEL_GAP = 6\nexport const COMPONENT_LABEL_ICON_SIZE = 10\nexport const COMPONENT_LABEL_ICON_GAP = 4\n\nexport const RULER_TARGET_PIXEL_SPACING = 100\nexport const RULER_MAJOR_TOLERANCE = 0.01\n\nexport const FLASH_ATTACK_MS = 200\nexport const FLASH_HOLD_MS = 400\nexport const FLASH_RELEASE_MS = 300\nexport const FLASH_STROKE_WIDTH = 2\nexport const FLASH_PADDING = 5\nexport const FLASH_OVERSHOOT = 30\nexport const FLASH_RADIUS = 4\n\nexport const ISSUE_ERROR_COLOR = { r: 0.949, g: 0.282, b: 0.133, a: 1 } satisfies Color // #F24822\nexport const ISSUE_WARNING_COLOR = { r: 1, g: 0.702, b: 0.078, a: 1 } satisfies Color // #FFB314\nexport const ISSUE_INFO_COLOR = { r: 0.55, g: 0.55, b: 0.55, a: 1 } satisfies Color\nexport const ISSUE_HIGHLIGHT_STROKE_WIDTH = 1.5\nexport const ISSUE_HIGHLIGHT_FILL_ALPHA = 0.08\n\n/** The violet AI agents show in everywhere, the app's `--color-agent`. */\nexport const AI_AGENT_COLOR = { r: 0.486, g: 0.361, b: 1 }\nexport const AI_DONE_COLOR = { r: 0.16, g: 0.73, b: 0.36 }\nexport const AI_DONE_DURATION_MS = 800\n/** How long a layer an agent adds takes to trace in, once its turn comes. */\nexport const AI_ENTER_DURATION_MS = 480\n/** The pause between the layers of one edit, so they appear one after another. */\nexport const AI_ENTER_STAGGER_MS = 45\n/** The last layer of an edit starts within this, however many layers the edit adds. */\nexport const AI_ENTER_MAX_DELAY_MS = 900\n/** One sweep of the light over an area an agent is working in. */\nexport const AI_SHIMMER_PERIOD_MS = 1600\n/** Width of the sweeping light, in screen pixels. */\nexport const AI_SHIMMER_BAND = 120\n\n/** Opacity of the selection color behind selected text while editing. */\nexport const TEXT_SELECTION_ALPHA = 0.3\n/** The caret's colour where the text's fill gives it none, as Figma's. */\nexport const TEXT_CARET_COLOR = BLACK\nexport const TEXT_CARET_WIDTH = 1\n\nexport const AUTOMATION_HTTP_PORT = 7600\n/**\n * Request header the app's own ACP and Pi harness chats send to the MCP server, so their sessions\n * show as those agents rather than as an outside MCP client.\n */\nexport const MCP_AGENT_HEADER = 'x-pairdraw-agent'\n\n/** The name the app's chats give Pairdraw's MCP server in an agent's session. */\nexport const PAIRDRAW_MCP_SERVER = 'pairdraw'\n\n/**\n * Request header naming the app chat whose agent opens an MCP session, so the app can tell that\n * this chat's agent reached its tools before it sends the prompt.\n */\nexport const MCP_CHAT_HEADER = 'x-pairdraw-chat'\n\nexport const GOOGLE_FONTS_API_KEY = 'AIzaSyD1tYDR_dUEiV-Tw1vksEhZbUytgKW5pc8'\n\nexport const CJK_FALLBACK_FAMILIES_MACOS = [\n 'PingFang SC',\n 'PingFang TC',\n 'Hiragino Sans',\n 'Apple SD Gothic Neo',\n 'Heiti SC',\n 'Heiti TC'\n]\n\nexport const CJK_FALLBACK_FAMILIES_WINDOWS = [\n 'Microsoft YaHei',\n 'Microsoft YaHei UI',\n 'Microsoft JhengHei',\n 'Yu Gothic',\n 'Malgun Gothic',\n 'SimHei',\n 'SimSun'\n]\n\nexport const CJK_FALLBACK_FAMILIES_LINUX = [\n 'Noto Sans CJK SC',\n 'Noto Sans CJK TC',\n 'Noto Sans CJK JP',\n 'Noto Sans CJK KR',\n 'WenQuanYi Micro Hei',\n 'Droid Sans Fallback'\n]\n\nexport const CJK_GOOGLE_FONTS = ['Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR']\n\n/** Figma's #D9D9D9 for new shapes. */\nexport const DEFAULT_SHAPE_FILL: Fill = {\n type: 'SOLID',\n color: { r: 217 / 255, g: 217 / 255, b: 217 / 255, a: 1 },\n opacity: 1,\n visible: true\n}\n\nexport const DEFAULT_FRAME_FILL: Fill = {\n type: 'SOLID',\n color: { r: 1, g: 1, b: 1, a: 1 },\n opacity: 1,\n visible: true\n}\n\n/** The light or dark interface a new page or section takes its colors from, as in Figma. */\nexport type InterfaceTheme = 'light' | 'dark'\n\n/** A new page's background, which Figma picks from the interface theme it was made in. */\nexport const PAGE_DEFAULT_BACKGROUNDS: Record<InterfaceTheme, Color> = {\n light: CANVAS_BG_COLOR,\n dark: { r: 0x1e / 255, g: 0x1e / 255, b: 0x1e / 255, a: 1 }\n}\n\n/** A FigJam board's page, #F5F5F5 whatever the interface theme, as Figma saves it. */\nexport const BOARD_PAGE_BACKGROUND = {\n r: 245 / 255,\n g: 245 / 255,\n b: 245 / 255,\n a: 1\n} satisfies Color\n\n/** A new section's fill, which Figma picks from the interface theme it was made in. */\nexport const SECTION_DEFAULT_FILLS: Record<InterfaceTheme, Fill> = {\n light: { type: 'SOLID', color: { r: 1, g: 1, b: 1, a: 1 }, opacity: 1, visible: true },\n dark: {\n type: 'SOLID',\n color: { r: 0x44 / 255, g: 0x44 / 255, b: 0x44 / 255, a: 1 },\n opacity: 1,\n visible: true\n }\n}\n\nexport const SECTION_DEFAULT_STROKE: Stroke = {\n type: 'SOLID',\n color: { r: 1, g: 1, b: 1, a: 1 },\n weight: 1,\n opacity: 0.1,\n visible: true,\n align: 'INSIDE'\n}\n\nexport const SECTION_CORNER_RADIUS = 2\n\n/** Effect filters a renderer keeps: a slider drag would otherwise keep every value it passed. */\nexport const EFFECT_FILTER_CACHE_ENTRIES = 64\n\nexport const ZOOM_DIVISOR = 50\nexport const ZOOM_SCALE_MIN = 0.75\nexport const ZOOM_SCALE_MAX = 1.25\n\nexport const PEN_CLOSE_THRESHOLD = 8\n/** Points a pen path needs before a press on its first point closes it: two make a closed shape, as in Figma. */\nexport const PEN_CLOSE_MIN_POINTS = 2\n/**\n * Screen pixels a pencil sample may stray from the line through its neighbours before the curve\n * keeps it, so a stroke drawn zoomed in keeps more detail.\n */\nexport const PENCIL_TOLERANCE = 2.5\n/** A new pencil layer's stroke weight (Figma desktop 126). */\nexport const PENCIL_STROKE_WEIGHT = 2\nexport const ROTATION_SNAP_DEGREES = 15\nexport const HANDLE_HIT_RADIUS = 6\n/** How far outside a shape, in screen pixels, a click still selects it (Figma desktop 126). */\nexport const LAYER_HIT_PAD = 3.5\nexport const ROTATION_HANDLE_DISTANCE = 24\nexport const DEFAULT_TEXT_WIDTH = 200\nexport const DEFAULT_TEXT_HEIGHT = 24\n/** Space Figma leaves between a duplicated top-level frame and the layers to its left. */\nexport const DUPLICATE_FRAME_GAP = 40\n"],"mappings":";;;AAQA,MAAa,aAAa,OAAO,WAAW;AAC5C,MAAa,WAAW,cAAc,yBAAyB;AAE/D,MAAa,QAAe;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AACrD,MAAa,cAAqB;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;AAC3D,MAAa,uBAA8B;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,GAAG;AAAK;AACvE,MAAa,kBAAkB;CAAE,GAAG;CAAM,GAAG;CAAM,GAAG;CAAM,GAAG;AAAE;;AAEjE,MAAa,0BAAoD;CAC/D,OAAO;CACP,YAAY;AACd;AACA,MAAa,kBAAkB;CAAE,GAAG;CAAO,GAAG;CAAO,GAAG;CAAG,GAAG;AAAE;;AAEhE,MAAa,aAAa;CAAE,GAAG;CAAO,GAAG;CAAO,GAAG;CAAO,GAAG;AAAE;AAC/D,MAAa,wBAAwB;AACrC,MAAa,aAAa;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;CAAM,GAAG;AAAE;;AAE1D,MAAa,oBAAoB;CAAE,GAAG;CAAM,GAAG;CAAK,GAAG;CAAM,GAAG;AAAE;AAClE,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;;AAEvC,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;CAAE,GAAG;CAAO,GAAG;CAAO,GAAG;CAAO,GAAG;AAAE;AACtE,MAAa,6BAA6B;AAC1C,MAAa,0BAA0B;AACvC,MAAa,0BAA0B;AACvC,MAAa,4BAA4B;AACzC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AAGA,MAAa,wBAAwB;CACnC,GAAG,MAAM;CACT,GAAG,MAAM;CACT,GAAG,MAAM;CACT,GAAG;AACL;;AAGA,MAAa,wBAAsD;CACjE,OAAO;EAAE,MAAM;EAAS,OAAO;GAAE,GAAG;GAAG,GAAG;GAAG,GAAG;GAAG,GAAG;EAAE;EAAG,SAAS;EAAG,SAAS;CAAK;CACrF,MAAM;EACJ,MAAM;EACN,OAAO;GAAE,GAAG,KAAO;GAAK,GAAG,KAAO;GAAK,GAAG,KAAO;GAAK,GAAG;EAAE;EAC3D,SAAS;EACT,SAAS;CACX;AACF;AAEA,MAAa,yBAAiC;CAC5C,MAAM;CACN,OAAO;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE;CAChC,QAAQ;CACR,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAa,wBAAwB;;AAGrC,MAAa,8BAA8B;AAE3C,MAAa,eAAe;AAC5B,MAAa,iBAAiB;AAC9B,MAAa,iBAAiB;AAE9B,MAAa,sBAAsB;;AAEnC,MAAa,uBAAuB;;;;;AAKpC,MAAa,mBAAmB;;AAEhC,MAAa,uBAAuB;AACpC,MAAa,wBAAwB;AACrC,MAAa,oBAAoB;;AAEjC,MAAa,gBAAgB;AAC7B,MAAa,2BAA2B;AACxC,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;;AAEnC,MAAa,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","names":[],"sources":["../../src/design-jsx/renderer.ts"],"mappings":";;;;;;;iBAkEgB,kBAAkB,QAAO;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","names":[],"sources":["../../src/design-jsx/renderer.ts"],"mappings":";;;;;;;iBAkEgB,kBAAkB,QAAO;EAW2mR,YAAA,uCAAA,YAAA,mBAAA,yCAAC,kBAAA,uCAAA;EAA8K,aAAA,uCAAA,YAAA,qCAAA,UAAA,yCAAC,kBAAA,uCAAA;;;cADrzR,YAAS,uCAAA,YAAA,mBAAA,yCAAA,kBAAA,uCAAA,iBAAE,aAAU,uCAAA,YAAA,qCAAA,UAAA,yCAAA,kBAAA,uCAAA"}
|
|
@@ -22,6 +22,7 @@ declare function createClipboardBridge(clipboard: ClipboardActions, selection: S
|
|
|
22
22
|
replaceInInstance?: boolean;
|
|
23
23
|
dependencies?: ClipboardImportChoice;
|
|
24
24
|
}) => Promise<void>;
|
|
25
|
+
pastePlainText: (text: string, cx?: number, cy?: number) => Promise<boolean>;
|
|
25
26
|
deleteSelected: () => void;
|
|
26
27
|
storeImage: (bytes: Uint8Array) => string;
|
|
27
28
|
placeFiles: (files: File[], cx: number, cy: number) => Promise<void>;
|
|
@@ -6,6 +6,7 @@ function createClipboardBridge(clipboard, selection) {
|
|
|
6
6
|
prepareCopy: (options) => clipboard.prepareCopy(selection.getSelectedNodes(), options),
|
|
7
7
|
pasteSnapshot: clipboard.pasteSnapshot,
|
|
8
8
|
pasteFromHTML: clipboard.pasteFromHTML,
|
|
9
|
+
pastePlainText: clipboard.pastePlainText,
|
|
9
10
|
deleteSelected: clipboard.deleteSelected,
|
|
10
11
|
storeImage: clipboard.storeImage,
|
|
11
12
|
placeFiles: clipboard.placeFiles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","names":[],"sources":["../../../src/editor/bridges/clipboard.ts"],"sourcesContent":["import type { createClipboardActions } from '#core/editor/clipboard'\nimport type { CopyOptions } from '#core/editor/clipboard/copy'\nimport type { createSelectionActions } from '#core/editor/selection'\n\ntype ClipboardActions = ReturnType<typeof createClipboardActions>\ntype SelectionActions = ReturnType<typeof createSelectionActions>\n\nexport function createClipboardBridge(clipboard: ClipboardActions, selection: SelectionActions) {\n return {\n duplicateSelected: () => clipboard.duplicateSelected(selection.getSelectedNodes()),\n duplicateNode: clipboard.duplicateNode,\n prepareCopy: (options?: CopyOptions) =>\n clipboard.prepareCopy(selection.getSelectedNodes(), options),\n pasteSnapshot: clipboard.pasteSnapshot,\n pasteFromHTML: clipboard.pasteFromHTML,\n deleteSelected: clipboard.deleteSelected,\n storeImage: clipboard.storeImage,\n placeFiles: clipboard.placeFiles,\n placeImageFiles: clipboard.placeImageFiles,\n pasteSVG: clipboard.pasteSVG,\n pasteMermaid: clipboard.pasteMermaid,\n pasteStyledDocument: clipboard.pasteStyledDocument,\n loadFontsForNodes: clipboard.loadFontsForNodes,\n copySelectionAsText: clipboard.copySelectionAsText,\n copySelectionAsSVG: clipboard.copySelectionAsSVG,\n copySelectionAsJSX: clipboard.copySelectionAsJSX,\n copySelectionAsHTML: clipboard.copySelectionAsHTML\n }\n}\n"],"mappings":";AAOA,SAAgB,sBAAsB,WAA6B,WAA6B;CAC9F,OAAO;EACL,yBAAyB,UAAU,kBAAkB,UAAU,iBAAiB,CAAC;EACjF,eAAe,UAAU;EACzB,cAAc,YACZ,UAAU,YAAY,UAAU,iBAAiB,GAAG,OAAO;EAC7D,eAAe,UAAU;EACzB,eAAe,UAAU;EACzB,gBAAgB,UAAU;EAC1B,YAAY,UAAU;EACtB,YAAY,UAAU;EACtB,iBAAiB,UAAU;EAC3B,UAAU,UAAU;EACpB,cAAc,UAAU;EACxB,qBAAqB,UAAU;EAC/B,mBAAmB,UAAU;EAC7B,qBAAqB,UAAU;EAC/B,oBAAoB,UAAU;EAC9B,oBAAoB,UAAU;EAC9B,qBAAqB,UAAU;CACjC;AACF"}
|
|
1
|
+
{"version":3,"file":"clipboard.js","names":[],"sources":["../../../src/editor/bridges/clipboard.ts"],"sourcesContent":["import type { createClipboardActions } from '#core/editor/clipboard'\nimport type { CopyOptions } from '#core/editor/clipboard/copy'\nimport type { createSelectionActions } from '#core/editor/selection'\n\ntype ClipboardActions = ReturnType<typeof createClipboardActions>\ntype SelectionActions = ReturnType<typeof createSelectionActions>\n\nexport function createClipboardBridge(clipboard: ClipboardActions, selection: SelectionActions) {\n return {\n duplicateSelected: () => clipboard.duplicateSelected(selection.getSelectedNodes()),\n duplicateNode: clipboard.duplicateNode,\n prepareCopy: (options?: CopyOptions) =>\n clipboard.prepareCopy(selection.getSelectedNodes(), options),\n pasteSnapshot: clipboard.pasteSnapshot,\n pasteFromHTML: clipboard.pasteFromHTML,\n pastePlainText: clipboard.pastePlainText,\n deleteSelected: clipboard.deleteSelected,\n storeImage: clipboard.storeImage,\n placeFiles: clipboard.placeFiles,\n placeImageFiles: clipboard.placeImageFiles,\n pasteSVG: clipboard.pasteSVG,\n pasteMermaid: clipboard.pasteMermaid,\n pasteStyledDocument: clipboard.pasteStyledDocument,\n loadFontsForNodes: clipboard.loadFontsForNodes,\n copySelectionAsText: clipboard.copySelectionAsText,\n copySelectionAsSVG: clipboard.copySelectionAsSVG,\n copySelectionAsJSX: clipboard.copySelectionAsJSX,\n copySelectionAsHTML: clipboard.copySelectionAsHTML\n }\n}\n"],"mappings":";AAOA,SAAgB,sBAAsB,WAA6B,WAA6B;CAC9F,OAAO;EACL,yBAAyB,UAAU,kBAAkB,UAAU,iBAAiB,CAAC;EACjF,eAAe,UAAU;EACzB,cAAc,YACZ,UAAU,YAAY,UAAU,iBAAiB,GAAG,OAAO;EAC7D,eAAe,UAAU;EACzB,eAAe,UAAU;EACzB,gBAAgB,UAAU;EAC1B,gBAAgB,UAAU;EAC1B,YAAY,UAAU;EACtB,YAAY,UAAU;EACtB,iBAAiB,UAAU;EAC3B,UAAU,UAAU;EACpB,cAAc,UAAU;EACxB,qBAAqB,UAAU;EAC/B,mBAAmB,UAAU;EAC7B,qBAAqB,UAAU;EAC/B,oBAAoB,UAAU;EAC9B,oBAAoB,UAAU;EAC9B,qBAAqB,UAAU;CACjC;AACF"}
|
|
@@ -16,6 +16,8 @@ declare function createComponentBridge(components: ComponentActions, selection:
|
|
|
16
16
|
createComponentSetFromComponents: () => void;
|
|
17
17
|
createInstanceFromComponent: (componentId: string, x?: number, y?: number, parentId?: string) => string | null;
|
|
18
18
|
detachInstance: () => void;
|
|
19
|
+
instanceHasOverrides: (id: string) => boolean;
|
|
20
|
+
resetInstanceOverrides: (id: string) => void;
|
|
19
21
|
canConvertToFrame: (componentId: string) => boolean;
|
|
20
22
|
componentInstanceCount: (componentId: string) => number;
|
|
21
23
|
requestComponentToFrame: (componentId: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","names":[],"sources":["../../../src/editor/bridges/components.ts"],"mappings":";;;;;;;;;KAKK,mBAAmB,kBAAkB;KACrC,cAAc,kBAAkB;KAChC,mBAAmB,kBAAkB;KACrC,mBAAmB,kBAAkB;iBAE1B,sBACd,YAAY,kBACZ,WAAW,kBACX,WAAW,kBACX,OAAO
|
|
1
|
+
{"version":3,"file":"components.d.ts","names":[],"sources":["../../../src/editor/bridges/components.ts"],"mappings":";;;;;;;;;KAKK,mBAAmB,kBAAkB;KACrC,cAAc,kBAAkB;KAChC,mBAAmB,kBAAkB;KACrC,mBAAmB,kBAAkB;iBAE1B,sBACd,YAAY,kBACZ,WAAW,kBACX,WAAW,kBACX,OAAO;;;;;;EAgBwB,yBAAA;;;;;EAKC,iBAAA,wBAAM"}
|
|
@@ -5,6 +5,8 @@ function createComponentBridge(components, selection, structure, pages) {
|
|
|
5
5
|
createComponentSetFromComponents: () => components.createComponentSetFromComponents(selection.getSelectedNodes(), structure.wrapSelectionInContainer),
|
|
6
6
|
createInstanceFromComponent: components.createInstanceFromComponent,
|
|
7
7
|
detachInstance: () => components.detachInstance(selection.getSelectedNode()),
|
|
8
|
+
instanceHasOverrides: components.instanceHasOverrides,
|
|
9
|
+
resetInstanceOverrides: (id) => components.resetInstanceOverrides(id),
|
|
8
10
|
canConvertToFrame: components.canConvertToFrame,
|
|
9
11
|
componentInstanceCount: components.componentInstanceCount,
|
|
10
12
|
requestComponentToFrame: components.requestComponentToFrame,
|