@pairdraw/core 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/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/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +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 +23 -9
- 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 +22 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +46 -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 +30 -18
- 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.map +1 -1
- package/dist/canvas/text/font-families.js +5 -2
- 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 +1 -8
- 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 +16 -7
- 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 +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/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/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 +17 -3
- 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 +21 -3
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +58 -13
- 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 +2 -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/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 +2 -2
- package/dist/geometry/index.js +2 -2
- 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/apply.d.ts +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/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.map +1 -1
- package/dist/io/formats/pdf/dom.js +65 -1
- package/dist/io/formats/pdf/dom.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 +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +24 -13
- 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 +7 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +40 -6
- 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/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.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 +10 -2
- package/dist/library/snapshot.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/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 +15 -16
- 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 +19 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +63 -12
- 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 +36 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +139 -19
- 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 +70 -70
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +7 -1
- 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/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/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 +3 -1
- 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 +4 -4
- package/dist/tools/create/vector.js.map +1 -1
- 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/matching.js +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.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 +2 -0
- 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 +4 -0
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -0
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +53 -9
- 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 +85 -90
- package/dist/tools/structure/batch.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/overlays/index.ts +0 -1
- 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 +40 -17
- 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 +39 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +37 -16
- 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 +6 -0
- package/src/canvas/text/index.ts +0 -8
- 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 +17 -8
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- 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 +82 -12
- 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 +2 -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/figma.ts +9 -0
- package/src/geometry/index.ts +1 -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/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 +96 -3
- 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 +31 -12
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +62 -6
- 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/subgraph.ts +3 -1
- 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 +11 -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/text/character-style.ts +29 -9
- package/src/text/coverage.ts +17 -18
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +82 -15
- 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 +170 -32
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +105 -89
- package/src/text/prepare.ts +17 -0
- package/src/text/style-runs.ts +43 -16
- 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/html.ts +3 -1
- package/src/tools/create/icons.ts +3 -1
- 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 +4 -4
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/reactions.ts +40 -0
- 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 +3 -0
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -4
- 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 +4 -0
- package/src/tools/schema.ts +68 -12
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +82 -101
- 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
package/src/text/font/manager.ts
CHANGED
|
@@ -14,13 +14,16 @@ import {
|
|
|
14
14
|
|
|
15
15
|
import { DEFAULT_FONT_FAMILY, IS_BROWSER } from '#core/constants'
|
|
16
16
|
import {
|
|
17
|
+
fallbackDrawsCharacter,
|
|
17
18
|
fontFallbackEntry,
|
|
19
|
+
type FontFallbackManifestEntry,
|
|
18
20
|
LETTER_FALLBACK_SCRIPTS,
|
|
19
21
|
type FontFallbackScript,
|
|
20
22
|
type LetterFallbackScript
|
|
21
23
|
} from '#core/text/fallbacks'
|
|
22
24
|
import { BundledFonts, type BundledFontLocator } from '#core/text/font/bundled'
|
|
23
25
|
import { FamilyFaceCatalog, type HostFontFamily } from '#core/text/font/catalog'
|
|
26
|
+
import { resetFontCollection } from '#core/text/font/collection'
|
|
24
27
|
import { fontFaceRenderFamily, type FamilyFace } from '#core/text/font/faces'
|
|
25
28
|
import { loadHarfBuzz } from '#core/text/font/harfbuzz'
|
|
26
29
|
import { LocalFonts } from '#core/text/font/local'
|
|
@@ -51,6 +54,8 @@ export type { BundledFontLocator } from '#core/text/font/bundled'
|
|
|
51
54
|
|
|
52
55
|
export class FontManager {
|
|
53
56
|
private loadedFamilies = new Map<string, ArrayBuffer>()
|
|
57
|
+
/** The families `loadedFamilies` has a face of, so asking needs no scan of its keys. */
|
|
58
|
+
private loadedFamilyNames = new Set<string>()
|
|
54
59
|
private loadedFamilySources = new Map<string, FontLoadedSource>()
|
|
55
60
|
private unavailableFaces = new Map<string, FontUnavailableReason>()
|
|
56
61
|
private supplementalFamilyData = new Map<string, ArrayBuffer[]>()
|
|
@@ -80,12 +85,17 @@ export class FontManager {
|
|
|
80
85
|
private providerCanvasKits = new WeakMap<TypefaceFontProvider, CanvasKit>()
|
|
81
86
|
private registrationGeneration = 0
|
|
82
87
|
private providerRegistrations = new WeakMap<TypefaceFontProvider, Map<string, Set<ArrayBuffer>>>()
|
|
88
|
+
private readonly sharedProviders = new Map<
|
|
89
|
+
CanvasKit,
|
|
90
|
+
{ provider: TypefaceFontProvider; users: number }
|
|
91
|
+
>()
|
|
83
92
|
private downloadedFontCache: DownloadedFontCache | null = null
|
|
84
93
|
private fallbackUserAgent: string | undefined
|
|
85
94
|
private hostFontLoader: HostFontLoader | null = null
|
|
86
95
|
private readonly hostFontRequests = new SharedReads()
|
|
87
96
|
private webFonts = new WebFontResolver()
|
|
88
97
|
private readonly faceListeners = new Set<(family: string, style: string) => void>()
|
|
98
|
+
private readonly unblockListeners = new Set<(nodeIds: readonly string[]) => void>()
|
|
89
99
|
private readonly bundled = new BundledFonts()
|
|
90
100
|
private readonly localFonts = new LocalFonts()
|
|
91
101
|
private readonly faces = new FamilyFaceCatalog({
|
|
@@ -101,6 +111,43 @@ export class FontManager {
|
|
|
101
111
|
)
|
|
102
112
|
private readonly letterFallbackPromises = new Map<LetterFallbackScript, Promise<string[]>>()
|
|
103
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The provider every renderer and shaper of `canvasKit` draws from. They share one module's
|
|
116
|
+
* heap, and a provider holds its own copy of each font file, so a second provider would copy
|
|
117
|
+
* every face again: the scene and overlay canvases, and every CJK system font, alike. A provider
|
|
118
|
+
* already attached for `canvasKit` is shared too, so shaping draws the faces its caller
|
|
119
|
+
* registered, not a second copy. Each call is matched by {@link releaseProvider}; the last
|
|
120
|
+
* release deletes the provider.
|
|
121
|
+
*/
|
|
122
|
+
acquireProvider(canvasKit: CanvasKit): TypefaceFontProvider {
|
|
123
|
+
const shared = this.sharedProviders.get(canvasKit)
|
|
124
|
+
if (shared) {
|
|
125
|
+
shared.users++
|
|
126
|
+
return shared.provider
|
|
127
|
+
}
|
|
128
|
+
const attached = this.providerFor(canvasKit)
|
|
129
|
+
if (attached) {
|
|
130
|
+
this.sharedProviders.set(canvasKit, { provider: attached, users: 1 })
|
|
131
|
+
return attached
|
|
132
|
+
}
|
|
133
|
+
const provider = canvasKit.TypefaceFontProvider.Make()
|
|
134
|
+
this.sharedProviders.set(canvasKit, { provider, users: 1 })
|
|
135
|
+
this.attachProvider(canvasKit, provider)
|
|
136
|
+
return provider
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
releaseProvider(provider: TypefaceFontProvider): void {
|
|
140
|
+
for (const [canvasKit, shared] of this.sharedProviders) {
|
|
141
|
+
if (shared.provider !== provider) continue
|
|
142
|
+
if (--shared.users > 0) return
|
|
143
|
+
this.sharedProviders.delete(canvasKit)
|
|
144
|
+
this.detachProvider(provider)
|
|
145
|
+
resetFontCollection(provider)
|
|
146
|
+
provider.delete()
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
104
151
|
attachProvider(canvasKit: CanvasKit, provider: TypefaceFontProvider): void {
|
|
105
152
|
this.fontProviders.add(provider)
|
|
106
153
|
this.providerCanvasKits.set(provider, canvasKit)
|
|
@@ -120,6 +167,7 @@ export class FontManager {
|
|
|
120
167
|
detachProvider(provider: TypefaceFontProvider): void {
|
|
121
168
|
this.fontProviders.delete(provider)
|
|
122
169
|
this.providerRegistrations.delete(provider)
|
|
170
|
+
resetFontCollection(provider)
|
|
123
171
|
if (this.fontProvider === provider) {
|
|
124
172
|
this.fontProvider = Array.from(this.fontProviders).at(-1) ?? null
|
|
125
173
|
}
|
|
@@ -147,7 +195,18 @@ export class FontManager {
|
|
|
147
195
|
}
|
|
148
196
|
|
|
149
197
|
unblockNodes(nodeIds: readonly string[]): void {
|
|
150
|
-
|
|
198
|
+
const shown: string[] = []
|
|
199
|
+
for (const nodeId of nodeIds) if (this.blockedNodeIds.delete(nodeId)) shown.push(nodeId)
|
|
200
|
+
if (shown.length > 0) for (const listener of this.unblockListeners) listener(shown)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Calls the listener with the layers whose block ended, which the canvas left out while blocked
|
|
205
|
+
* and draws again now.
|
|
206
|
+
*/
|
|
207
|
+
onNodesUnblocked(listener: (nodeIds: readonly string[]) => void): () => void {
|
|
208
|
+
this.unblockListeners.add(listener)
|
|
209
|
+
return () => this.unblockListeners.delete(listener)
|
|
151
210
|
}
|
|
152
211
|
|
|
153
212
|
isNodeBlocked(nodeId: string): boolean {
|
|
@@ -204,6 +263,11 @@ export class FontManager {
|
|
|
204
263
|
return this.faces.offersFace(family, weight, italic)
|
|
205
264
|
}
|
|
206
265
|
|
|
266
|
+
/** The families whose faces `familyFaces` has found so far. */
|
|
267
|
+
familiesWithFoundFaces(): string[] {
|
|
268
|
+
return this.faces.foundFamilies()
|
|
269
|
+
}
|
|
270
|
+
|
|
207
271
|
/** Calls the listener whenever the faces found so far are forgotten. */
|
|
208
272
|
onFamilyFacesReset(listener: () => void): () => void {
|
|
209
273
|
return this.faces.onReset(listener)
|
|
@@ -288,7 +352,8 @@ export class FontManager {
|
|
|
288
352
|
if (!byFamily.has(family)) byFamily.set(family, { family, source: provider })
|
|
289
353
|
}
|
|
290
354
|
}
|
|
291
|
-
for (const
|
|
355
|
+
for (const family of [...fonts.map((font) => font.family), ...this.faces.hostFamilies()])
|
|
356
|
+
byFamily.set(family, { family, source: 'local' })
|
|
292
357
|
// A family loaded from a font file draws from that file, whatever the catalogs say.
|
|
293
358
|
for (const option of this.registeredFamilyOptions()) byFamily.set(option.family, option)
|
|
294
359
|
return [...byFamily.values()].sort((a, b) => a.family.localeCompare(b.family))
|
|
@@ -496,7 +561,7 @@ export class FontManager {
|
|
|
496
561
|
}
|
|
497
562
|
|
|
498
563
|
isLoaded(family: string): boolean {
|
|
499
|
-
return
|
|
564
|
+
return this.loadedFamilyNames.has(family)
|
|
500
565
|
}
|
|
501
566
|
|
|
502
567
|
isStyleLoaded(family: string, style: string): boolean {
|
|
@@ -704,6 +769,13 @@ export class FontManager {
|
|
|
704
769
|
if (!families.includes(family)) families.push(family)
|
|
705
770
|
}
|
|
706
771
|
|
|
772
|
+
/**
|
|
773
|
+
* Loads the fallback faces for `script`. The first installed one of its families comes in, and
|
|
774
|
+
* the next only for the characters of its writing system among `characters` that CanvasKit finds
|
|
775
|
+
* no glyph for in the fallbacks loaded: each is a whole system face, tens of megabytes for a CJK
|
|
776
|
+
* one, copied into CanvasKit. Web fonts come in, cut to the characters, when no installed face
|
|
777
|
+
* covers them.
|
|
778
|
+
*/
|
|
707
779
|
private async ensureFallbackFamilies(
|
|
708
780
|
script: FontFallbackScript,
|
|
709
781
|
targetFamilies: string[],
|
|
@@ -712,44 +784,89 @@ export class FontManager {
|
|
|
712
784
|
): Promise<string[]> {
|
|
713
785
|
signal?.throwIfAborted()
|
|
714
786
|
const manifest = fontFallbackEntry(script, this.fallbackUserAgent)
|
|
715
|
-
|
|
787
|
+
const needed = uniq(Array.from(characters)).filter((character) =>
|
|
788
|
+
fallbackDrawsCharacter(script, character)
|
|
789
|
+
)
|
|
790
|
+
// Families only come in, so what one check resolved stays resolved.
|
|
791
|
+
let pending = needed
|
|
792
|
+
const missing = () => (pending = this.unresolvedCharacters(targetFamilies, pending))
|
|
793
|
+
// Without text to check coverage against, the whole chain comes in as before: a document
|
|
794
|
+
// prepares its fallbacks before any text is known, and the chain must cover any character.
|
|
795
|
+
const loadAll = characters === ''
|
|
796
|
+
|
|
797
|
+
let installed = false
|
|
716
798
|
for (const family of manifest.localFamilies) {
|
|
799
|
+
if (!loadAll && installed && missing().length === 0) break
|
|
717
800
|
signal?.throwIfAborted()
|
|
718
801
|
const buffer =
|
|
719
802
|
(await this.loadHostFont(family, 'Regular')) ?? (await this.localFonts.read(family))
|
|
720
803
|
signal?.throwIfAborted()
|
|
721
|
-
if (
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
!targetFamilies.includes(family)
|
|
725
|
-
) {
|
|
726
|
-
targetFamilies.push(family)
|
|
804
|
+
if (buffer && this.registerAndCache(family, 'Regular', buffer, 'fallback')) {
|
|
805
|
+
if (!targetFamilies.includes(family)) targetFamilies.push(family)
|
|
806
|
+
installed = true
|
|
727
807
|
}
|
|
728
808
|
}
|
|
729
809
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
signal?.throwIfAborted()
|
|
734
|
-
const data = await this.loadRemoteFont(family, 'Regular', characters, signal)
|
|
735
|
-
signal?.throwIfAborted()
|
|
736
|
-
return data ? family : null
|
|
737
|
-
})
|
|
738
|
-
)
|
|
739
|
-
for (const result of results) {
|
|
740
|
-
if (
|
|
741
|
-
result.status === 'fulfilled' &&
|
|
742
|
-
result.value &&
|
|
743
|
-
!targetFamilies.includes(result.value)
|
|
744
|
-
) {
|
|
745
|
-
targetFamilies.push(result.value)
|
|
746
|
-
}
|
|
747
|
-
}
|
|
810
|
+
const remoteCharacters = loadAll || !installed ? characters : missing().join('')
|
|
811
|
+
if (loadAll ? targetFamilies.length === 0 : !installed || remoteCharacters) {
|
|
812
|
+
await this.loadRemoteFallbackFamilies(manifest, targetFamilies, remoteCharacters, signal)
|
|
748
813
|
}
|
|
749
814
|
|
|
750
815
|
return targetFamilies
|
|
751
816
|
}
|
|
752
817
|
|
|
818
|
+
/** Loads `manifest`'s web families, cut to `characters`, into `targetFamilies`. */
|
|
819
|
+
private async loadRemoteFallbackFamilies(
|
|
820
|
+
manifest: FontFallbackManifestEntry,
|
|
821
|
+
targetFamilies: string[],
|
|
822
|
+
characters: string,
|
|
823
|
+
signal?: AbortSignal
|
|
824
|
+
): Promise<void> {
|
|
825
|
+
const results = await Promise.allSettled(
|
|
826
|
+
manifest.remoteFamilies.map(async (family) => {
|
|
827
|
+
signal?.throwIfAborted()
|
|
828
|
+
const data = await this.loadRemoteFont(family, 'Regular', characters, signal)
|
|
829
|
+
signal?.throwIfAborted()
|
|
830
|
+
return data ? family : null
|
|
831
|
+
})
|
|
832
|
+
)
|
|
833
|
+
for (const result of results) {
|
|
834
|
+
if (result.status === 'fulfilled' && result.value && !targetFamilies.includes(result.value)) {
|
|
835
|
+
targetFamilies.push(result.value)
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* The characters CanvasKit finds no glyph for in `families`, shaped with the provider the
|
|
842
|
+
* canvas draws from. Without one, as in an export before any canvas or shaper holds it, it
|
|
843
|
+
* cannot tell and counts every character missing, so every family loads as it always did.
|
|
844
|
+
*/
|
|
845
|
+
private unresolvedCharacters(families: readonly string[], characters: string[]): string[] {
|
|
846
|
+
if (characters.length === 0) return []
|
|
847
|
+
if (families.length === 0) return characters
|
|
848
|
+
const shared = this.sharedProviders.entries().next().value
|
|
849
|
+
if (!shared) return characters
|
|
850
|
+
const [canvasKit, { provider }] = shared
|
|
851
|
+
const style = new canvasKit.ParagraphStyle({
|
|
852
|
+
textStyle: { fontFamilies: [...families], fontSize: 16 }
|
|
853
|
+
})
|
|
854
|
+
const builder = canvasKit.ParagraphBuilder.MakeFromFontProvider(style, provider)
|
|
855
|
+
try {
|
|
856
|
+
builder.addText(characters.join(''))
|
|
857
|
+
const paragraph = builder.build()
|
|
858
|
+
try {
|
|
859
|
+
paragraph.layout(Number.MAX_SAFE_INTEGER)
|
|
860
|
+
const unresolved = new Set(paragraph.unresolvedCodepoints())
|
|
861
|
+
return characters.filter((character) => unresolved.has(character.codePointAt(0) ?? 0))
|
|
862
|
+
} finally {
|
|
863
|
+
paragraph.delete()
|
|
864
|
+
}
|
|
865
|
+
} finally {
|
|
866
|
+
builder.delete()
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
753
870
|
private loadHostFont(family: string, style: string): Promise<ArrayBuffer | null> {
|
|
754
871
|
const loader = this.hostFontLoader
|
|
755
872
|
if (!loader) return Promise.resolve(null)
|
|
@@ -811,7 +928,12 @@ export class FontManager {
|
|
|
811
928
|
}
|
|
812
929
|
|
|
813
930
|
/** Adds `buffer` to the files of `style` after its own, returning the copy of it they keep. */
|
|
814
|
-
private registerSupplemental(
|
|
931
|
+
private registerSupplemental(
|
|
932
|
+
family: string,
|
|
933
|
+
style: string,
|
|
934
|
+
buffer: ArrayBuffer,
|
|
935
|
+
source?: FontLoadedSource
|
|
936
|
+
): ArrayBuffer {
|
|
815
937
|
const key = `${family}|${style}`
|
|
816
938
|
const supplemental = this.supplementalFamilyData.get(key) ?? []
|
|
817
939
|
const kept = supplemental.find((file) => sameFontFile(file, buffer))
|
|
@@ -819,7 +941,7 @@ export class FontManager {
|
|
|
819
941
|
supplemental.push(buffer)
|
|
820
942
|
this.supplementalFamilyData.set(key, supplemental)
|
|
821
943
|
this.registerFontInCanvasKit(family, buffer)
|
|
822
|
-
this.registerFontInBrowser(family, style, buffer)
|
|
944
|
+
if (!pageDrawsByName(source)) this.registerFontInBrowser(family, style, buffer)
|
|
823
945
|
return buffer
|
|
824
946
|
}
|
|
825
947
|
|
|
@@ -838,14 +960,19 @@ export class FontManager {
|
|
|
838
960
|
}
|
|
839
961
|
if (existing) {
|
|
840
962
|
const replaced = this.replacedFileData.get(key) ?? new Set<ArrayBuffer>()
|
|
841
|
-
replaced.add(
|
|
963
|
+
replaced.add(
|
|
964
|
+
this.registerSupplemental(family, style, existing, this.loadedFamilySources.get(key))
|
|
965
|
+
)
|
|
842
966
|
this.replacedFileData.set(key, replaced)
|
|
843
967
|
this.replacedFamilies.add(family)
|
|
844
968
|
}
|
|
845
969
|
this.loadedFamilies.set(key, buffer)
|
|
970
|
+
this.loadedFamilyNames.add(family)
|
|
846
971
|
if (source) this.loadedFamilySources.set(key, source)
|
|
847
972
|
this.registerFontInCanvasKit(family, buffer)
|
|
848
|
-
|
|
973
|
+
// The page's own text falls back to the system's fonts by itself, and a browser face would be
|
|
974
|
+
// one more copy of a whole system file.
|
|
975
|
+
if (!pageDrawsByName(source)) this.registerFontInBrowser(family, style, buffer)
|
|
849
976
|
for (const listener of this.faceListeners) listener(family, style)
|
|
850
977
|
return buffer
|
|
851
978
|
}
|
|
@@ -878,6 +1005,7 @@ export class FontManager {
|
|
|
878
1005
|
if (registeredData?.has(data)) return true
|
|
879
1006
|
try {
|
|
880
1007
|
provider.registerFont(data, family)
|
|
1008
|
+
resetFontCollection(provider)
|
|
881
1009
|
const familyRegistrations = registeredData ?? new Set<ArrayBuffer>()
|
|
882
1010
|
familyRegistrations.add(data)
|
|
883
1011
|
registrations.set(family, familyRegistrations)
|
|
@@ -907,6 +1035,16 @@ export class FontManager {
|
|
|
907
1035
|
}
|
|
908
1036
|
}
|
|
909
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* Whether the page draws a face from `source` by itself: it draws installed fonts by name and
|
|
1040
|
+
* falls back to the system's. A browser face would copy a whole system file, and one under an
|
|
1041
|
+
* installed family's name stands in for all of that family's faces: WebView2 draws their bold
|
|
1042
|
+
* and italic text in it.
|
|
1043
|
+
*/
|
|
1044
|
+
function pageDrawsByName(source: FontLoadedSource | undefined): boolean {
|
|
1045
|
+
return source === 'local' || source === 'fallback'
|
|
1046
|
+
}
|
|
1047
|
+
|
|
910
1048
|
export const fontManager = new FontManager()
|
|
911
1049
|
|
|
912
1050
|
function isLetterFallbackScript(script: FontFallbackScript): script is LetterFallbackScript {
|
package/src/text/font/style.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { partition, uniq } from 'es-toolkit'
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
FONT_WEIGHT_NAMES,
|
|
3
5
|
namesWeight,
|
|
6
|
+
namesWidth,
|
|
4
7
|
normalizeFontFamily,
|
|
5
8
|
type FontFamilyStyle,
|
|
6
|
-
parseFontStyle
|
|
9
|
+
parseFontStyle,
|
|
10
|
+
styleSpelling
|
|
7
11
|
} from '@pairdraw/scene-graph/font-style'
|
|
8
12
|
|
|
9
13
|
const FONT_WEIGHTS = Object.keys(FONT_WEIGHT_NAMES)
|
|
@@ -15,7 +19,18 @@ const FONT_WEIGHTS = Object.keys(FONT_WEIGHT_NAMES)
|
|
|
15
19
|
* from a family: heavier first above 500, lighter first below 400, and from 400 to 500 the
|
|
16
20
|
* weights up to 500, then lighter, then heavier.
|
|
17
21
|
*/
|
|
18
|
-
export function fontWeightMatchOrder(weight: number): number[] {
|
|
22
|
+
export function fontWeightMatchOrder(weight: number): readonly number[] {
|
|
23
|
+
let order = matchOrders.get(weight)
|
|
24
|
+
if (!order) {
|
|
25
|
+
order = matchOrder(weight)
|
|
26
|
+
matchOrders.set(weight, order)
|
|
27
|
+
}
|
|
28
|
+
return order
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const matchOrders = new Map<number, readonly number[]>()
|
|
32
|
+
|
|
33
|
+
function matchOrder(weight: number): number[] {
|
|
19
34
|
const lighter = FONT_WEIGHTS.filter((candidate) => candidate < weight).toReversed()
|
|
20
35
|
const heavier = FONT_WEIGHTS.filter((candidate) => candidate > weight)
|
|
21
36
|
const own = FONT_WEIGHTS.includes(weight) ? [weight] : []
|
|
@@ -48,7 +63,7 @@ export function chooseLocalFontMatch<T extends FontFamilyStyle>(
|
|
|
48
63
|
// A face named apart from its weight is that face or none, never another of its weight.
|
|
49
64
|
if (style && !namesWeight(style)) continue
|
|
50
65
|
|
|
51
|
-
const candidates = fonts.filter((font) => font.family === candidateFamily)
|
|
66
|
+
const candidates = normalWidthFirst(fonts.filter((font) => font.family === candidateFamily))
|
|
52
67
|
const sameStyle = candidates.find((font) => {
|
|
53
68
|
const parsed = parseFontStyle(font.style)
|
|
54
69
|
return parsed.weight === requested.weight && parsed.italic === requested.italic
|
|
@@ -70,3 +85,37 @@ export function chooseLocalFontMatch<T extends FontFamilyStyle>(
|
|
|
70
85
|
|
|
71
86
|
return undefined
|
|
72
87
|
}
|
|
88
|
+
|
|
89
|
+
function normalWidthFirst<T extends FontFamilyStyle>(fonts: T[]): T[] {
|
|
90
|
+
const [normalWidth, otherWidth] = partition(fonts, (font) => !namesWidth(font.style))
|
|
91
|
+
return [...normalWidth, ...otherWidth]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface NamedLocalFont extends FontFamilyStyle {
|
|
95
|
+
fullName: string
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function fontByFullName<T extends NamedLocalFont>(fonts: readonly T[], fullName: string) {
|
|
99
|
+
const wanted = styleSpelling(fullName)
|
|
100
|
+
return fonts.find((font) => styleSpelling(font.fullName) === wanted)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Windows lists a face beyond regular, bold, and italic as a family of its own, by its full name. */
|
|
104
|
+
export function findLocalFont<T extends NamedLocalFont>(
|
|
105
|
+
fonts: T[],
|
|
106
|
+
family: string,
|
|
107
|
+
style?: string
|
|
108
|
+
): T | undefined {
|
|
109
|
+
const listed = chooseLocalFontMatch(fonts, family, style)
|
|
110
|
+
if (listed || !style) {
|
|
111
|
+
return listed
|
|
112
|
+
}
|
|
113
|
+
const families = uniq([family, normalizeFontFamily(family)])
|
|
114
|
+
for (const named of families) {
|
|
115
|
+
const font = fontByFullName(fonts, `${named} ${style}`)
|
|
116
|
+
if (font) {
|
|
117
|
+
return font
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return undefined
|
|
121
|
+
}
|
package/src/text/index.ts
CHANGED