@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
|
@@ -61,11 +61,7 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
61
61
|
const typeFilter = args.type?.toUpperCase()
|
|
62
62
|
const collFilter = args.collection?.toLowerCase()
|
|
63
63
|
|
|
64
|
-
const result: VariablesResult = {
|
|
65
|
-
collections: [],
|
|
66
|
-
totalVariables: graph.variables.size,
|
|
67
|
-
totalCollections: graph.variableCollections.size
|
|
68
|
-
}
|
|
64
|
+
const result: VariablesResult = { collections: [], totalVariables: 0, totalCollections: 0 }
|
|
69
65
|
|
|
70
66
|
for (const coll of graph.variableCollections.values()) {
|
|
71
67
|
if (collFilter && !coll.name.toLowerCase().includes(collFilter)) continue
|
|
@@ -89,6 +85,11 @@ export const variablesCommand: RPCCommand<VariablesArgs, VariablesResult> = {
|
|
|
89
85
|
})
|
|
90
86
|
}
|
|
91
87
|
|
|
88
|
+
result.totalVariables = result.collections.reduce(
|
|
89
|
+
(count, collection) => count + collection.variables.length,
|
|
90
|
+
0
|
|
91
|
+
)
|
|
92
|
+
result.totalCollections = result.collections.length
|
|
92
93
|
return result
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { omit, pick } from 'es-toolkit/object'
|
|
2
|
-
import { isEqual } from 'es-toolkit/predicate'
|
|
1
|
+
import { omit, omitBy, pick } from 'es-toolkit/object'
|
|
2
|
+
import { isEmptyObject, isEqual, isUndefined } from 'es-toolkit/predicate'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
TEXT_BINDABLE_FIELDS,
|
|
@@ -142,14 +142,11 @@ function withoutRedundantOverrides(node: SceneNode, runs: StyleRun[]): StyleRun[
|
|
|
142
142
|
const result: StyleRun[] = []
|
|
143
143
|
for (const run of runs) {
|
|
144
144
|
// A range keeps a binding's scale only while it binds the number itself.
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
run.style,
|
|
148
|
-
CHARACTER_STYLE_KEYS.filter(
|
|
149
|
-
(key) => run.style[key] !== undefined && isEqual(run.style[key], base[key])
|
|
150
|
-
)
|
|
151
|
-
)
|
|
145
|
+
const repeated = CHARACTER_STYLE_KEYS.filter(
|
|
146
|
+
(key) => run.style[key] !== undefined && isEqual(run.style[key], base[key])
|
|
152
147
|
)
|
|
148
|
+
// A key a copy left undefined overrides nothing either.
|
|
149
|
+
const style = withBoundBindingScales(omitBy(omit(run.style, repeated), isUndefined))
|
|
153
150
|
if (Object.keys(style).length === 0) continue
|
|
154
151
|
const previous = result.at(-1)
|
|
155
152
|
if (
|
|
@@ -266,3 +263,26 @@ export function textStyleChanges(
|
|
|
266
263
|
styleRuns: styleRunsWithPatch({ ...updated, styleRuns }, 0, node.text.length, sized)
|
|
267
264
|
}
|
|
268
265
|
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* A change to a text layer as a whole, such as from the design panel: a style it sets applies to
|
|
269
|
+
* every character, as Figma's node setters do, so no range keeps its own value of it.
|
|
270
|
+
*/
|
|
271
|
+
export function layerTextStyleChanges(
|
|
272
|
+
node: SceneNode,
|
|
273
|
+
changes: Partial<SceneNode>
|
|
274
|
+
): Partial<SceneNode> {
|
|
275
|
+
const style = pick(changes, TEXT_STYLE_KEYS)
|
|
276
|
+
if (node.type !== 'TEXT' || node.styleRuns.length === 0 || isEmptyObject(style)) return changes
|
|
277
|
+
return { ...changes, ...textStyleChanges(node, style) }
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The style a text layer shows as its own: its first character's, which a range may set; the
|
|
282
|
+
* panel shows it, as it shows the first selected character's while text is edited.
|
|
283
|
+
*/
|
|
284
|
+
export function shownTextStyle(node: SceneNode): Partial<SceneNode> | null {
|
|
285
|
+
if (node.type !== 'TEXT' || node.styleRuns.length === 0 || node.text.length === 0) return null
|
|
286
|
+
const [style] = characterStyles(node, 0, 1)
|
|
287
|
+
return pick(style, TEXT_STYLE_KEYS)
|
|
288
|
+
}
|
package/src/text/coverage.ts
CHANGED
|
@@ -3,36 +3,48 @@ import type { SceneNode } from '@pairdraw/scene-graph'
|
|
|
3
3
|
import { DEFAULT_FONT_FAMILY } from '#core/constants'
|
|
4
4
|
import {
|
|
5
5
|
ARABIC_CHARACTER,
|
|
6
|
+
CJK_CHARACTER,
|
|
6
7
|
cjkFallbackScriptForLanguage,
|
|
8
|
+
DEVANAGARI_CHARACTER,
|
|
7
9
|
fontFallbackScriptForCharacter,
|
|
8
10
|
HAN_CHARACTER,
|
|
9
11
|
HANGUL_CHARACTER,
|
|
12
|
+
HEBREW_CHARACTER,
|
|
10
13
|
KANA_CHARACTER,
|
|
11
|
-
|
|
14
|
+
LETTER_FALLBACK_SCRIPTS,
|
|
15
|
+
THAI_CHARACTER,
|
|
16
|
+
isTraditionalOnlyHan,
|
|
12
17
|
type FontFallbackScript
|
|
13
18
|
} from '#core/text/fallbacks'
|
|
14
19
|
import { fontGlyphCoverageSync } from '#core/text/font/glyphs'
|
|
15
20
|
import { textFontFace } from '#core/text/requirements/collect'
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function scriptCharRegex(script: FontFallbackScript): RegExp {
|
|
22
|
+
function scriptCharacterTest(script: FontFallbackScript): (character: string) => boolean {
|
|
20
23
|
switch (script) {
|
|
21
24
|
case 'arabic':
|
|
22
|
-
return ARABIC_CHARACTER
|
|
25
|
+
return (character) => ARABIC_CHARACTER.test(character)
|
|
26
|
+
case 'hebrew':
|
|
27
|
+
return (character) => HEBREW_CHARACTER.test(character)
|
|
28
|
+
case 'thai':
|
|
29
|
+
return (character) => THAI_CHARACTER.test(character)
|
|
30
|
+
case 'devanagari':
|
|
31
|
+
return (character) => DEVANAGARI_CHARACTER.test(character)
|
|
23
32
|
case 'cjk-jp':
|
|
24
|
-
return KANA_CHARACTER
|
|
33
|
+
return (character) => KANA_CHARACTER.test(character)
|
|
25
34
|
case 'cjk-kr':
|
|
26
|
-
return HANGUL_CHARACTER
|
|
35
|
+
return (character) => HANGUL_CHARACTER.test(character)
|
|
27
36
|
case 'cjk-tc':
|
|
28
|
-
return
|
|
37
|
+
return isTraditionalOnlyHan
|
|
29
38
|
default:
|
|
30
|
-
return HAN_CHARACTER
|
|
39
|
+
return (character) => HAN_CHARACTER.test(character)
|
|
31
40
|
}
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
export function textHasFallbackScript(text: string): boolean {
|
|
35
|
-
return
|
|
44
|
+
return (
|
|
45
|
+
LETTER_FALLBACK_SCRIPTS.some((script) => scriptCharacterTest(script)(text)) ||
|
|
46
|
+
CJK_CHARACTER.test(text)
|
|
47
|
+
)
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
function styleForCharacter(
|
|
@@ -58,11 +70,11 @@ function styleForCharacter(
|
|
|
58
70
|
*/
|
|
59
71
|
export function textNeedsFallbackScript(node: SceneNode, script: FontFallbackScript): boolean {
|
|
60
72
|
if (node.type !== 'TEXT' || !node.text) return false
|
|
61
|
-
const
|
|
73
|
+
const inScript = scriptCharacterTest(script)
|
|
62
74
|
|
|
63
75
|
let index = 0
|
|
64
76
|
for (const char of node.text) {
|
|
65
|
-
if (
|
|
77
|
+
if (inScript(char)) {
|
|
66
78
|
const { family, style } = styleForCharacter(node, index)
|
|
67
79
|
if (fontGlyphCoverageSync(family, style, char) === 'missing') return true
|
|
68
80
|
}
|
|
@@ -87,13 +99,15 @@ export function textFallbackScriptsWithoutCoverage(node: SceneNode): FontFallbac
|
|
|
87
99
|
|
|
88
100
|
export function textNeededFallbackScripts(node: SceneNode): FontFallbackScript[] {
|
|
89
101
|
const scripts = new Set<FontFallbackScript>()
|
|
90
|
-
|
|
102
|
+
for (const script of LETTER_FALLBACK_SCRIPTS) {
|
|
103
|
+
if (textNeedsFallbackScript(node, script)) scripts.add(script)
|
|
104
|
+
}
|
|
91
105
|
|
|
92
106
|
let missingIdeograph = false
|
|
93
107
|
let missingTraditionalIdeograph = false
|
|
94
108
|
let index = 0
|
|
95
109
|
for (const char of node.text) {
|
|
96
|
-
if (
|
|
110
|
+
if (CJK_CHARACTER.test(char)) {
|
|
97
111
|
const { family, style, language } = styleForCharacter(node, index)
|
|
98
112
|
if (fontGlyphCoverageSync(family, style, char) === 'missing') {
|
|
99
113
|
if (HAN_CHARACTER.test(char)) {
|
|
@@ -101,7 +115,7 @@ export function textNeededFallbackScripts(node: SceneNode): FontFallbackScript[]
|
|
|
101
115
|
if (languageScript) scripts.add(languageScript)
|
|
102
116
|
else {
|
|
103
117
|
missingIdeograph = true
|
|
104
|
-
if (
|
|
118
|
+
if (isTraditionalOnlyHan(char)) missingTraditionalIdeograph = true
|
|
105
119
|
}
|
|
106
120
|
} else {
|
|
107
121
|
const script = fontFallbackScriptForCharacter(char, language)
|
package/src/text/editor.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { CanvasKit } from 'canvaskit-wasm'
|
|
|
3
3
|
import type { DerivedTextGlyph, SceneNode } from '@pairdraw/scene-graph'
|
|
4
4
|
import { faceStyleKey } from '@pairdraw/scene-graph/font-style'
|
|
5
5
|
import type { Rect, Vector } from '@pairdraw/scene-graph/primitives'
|
|
6
|
+
import { textVerticalOffset } from '@pairdraw/scene-graph/text'
|
|
6
7
|
import { resolveNodeTextDirection } from '@pairdraw/scene-graph/text/direction'
|
|
7
8
|
|
|
8
9
|
import type { SkiaRenderer } from '#core/canvas'
|
|
@@ -50,10 +51,7 @@ export class TextEditor {
|
|
|
50
51
|
const s = this.current()
|
|
51
52
|
const node = this.paragraphNode
|
|
52
53
|
if (!s?.paragraph || !node) return 0
|
|
53
|
-
|
|
54
|
-
if (node.textAlignVertical === 'CENTER') return available / 2
|
|
55
|
-
if (node.textAlignVertical === 'BOTTOM') return available
|
|
56
|
-
return 0
|
|
54
|
+
return textVerticalOffset(node, s.paragraph.getHeight())
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
private paragraphY(y: number): number {
|
|
@@ -416,10 +414,7 @@ export class TextEditor {
|
|
|
416
414
|
const probe = this.renderer.buildParagraph({ ...node, text: ' ' })
|
|
417
415
|
const height = probe.getLineMetrics()[0]?.height ?? probe.getHeight()
|
|
418
416
|
probe.delete()
|
|
419
|
-
const
|
|
420
|
-
let offsetY = 0
|
|
421
|
-
if (node.textAlignVertical === 'CENTER') offsetY = available / 2
|
|
422
|
-
if (node.textAlignVertical === 'BOTTOM') offsetY = available
|
|
417
|
+
const offsetY = textVerticalOffset(node, height)
|
|
423
418
|
let x = 0
|
|
424
419
|
if (node.textAlignHorizontal === 'CENTER') x = node.width / 2
|
|
425
420
|
if (node.textAlignHorizontal === 'RIGHT') x = node.width
|
package/src/text/fallbacks.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { memoize } from 'es-toolkit/function'
|
|
2
|
+
import TS_CHARACTERS from 'opencc-js/dict/TSCharacters'
|
|
3
|
+
|
|
4
|
+
import { ResourceCache } from '#core/cache/resource'
|
|
1
5
|
import {
|
|
2
6
|
CJK_FALLBACK_FAMILIES_LINUX,
|
|
3
7
|
CJK_FALLBACK_FAMILIES_MACOS,
|
|
@@ -5,17 +9,82 @@ import {
|
|
|
5
9
|
CJK_GOOGLE_FONTS
|
|
6
10
|
} from '#core/constants'
|
|
7
11
|
|
|
8
|
-
export type FontFallbackScript =
|
|
12
|
+
export type FontFallbackScript =
|
|
13
|
+
| 'cjk'
|
|
14
|
+
| 'cjk-sc'
|
|
15
|
+
| 'cjk-tc'
|
|
16
|
+
| 'cjk-jp'
|
|
17
|
+
| 'cjk-kr'
|
|
18
|
+
| 'arabic'
|
|
19
|
+
| 'hebrew'
|
|
20
|
+
| 'thai'
|
|
21
|
+
| 'devanagari'
|
|
22
|
+
|
|
23
|
+
/** The fallbacks for scripts written in letters, which the renderer tries before the CJK ones. */
|
|
24
|
+
export const LETTER_FALLBACK_SCRIPTS = [
|
|
25
|
+
'arabic',
|
|
26
|
+
'hebrew',
|
|
27
|
+
'thai',
|
|
28
|
+
'devanagari'
|
|
29
|
+
] as const satisfies readonly FontFallbackScript[]
|
|
30
|
+
|
|
31
|
+
export type LetterFallbackScript = (typeof LETTER_FALLBACK_SCRIPTS)[number]
|
|
9
32
|
|
|
10
33
|
/** Characters of the writing systems that need a fallback font, by their Unicode script. */
|
|
11
34
|
export const ARABIC_CHARACTER = /\p{Script=Arabic}/u
|
|
35
|
+
export const HEBREW_CHARACTER = /\p{Script=Hebrew}/u
|
|
36
|
+
export const THAI_CHARACTER = /\p{Script=Thai}/u
|
|
37
|
+
export const DEVANAGARI_CHARACTER = /\p{Script=Devanagari}/u
|
|
12
38
|
export const HANGUL_CHARACTER = /\p{Script=Hangul}/u
|
|
13
39
|
export const KANA_CHARACTER = /[\p{Script=Hiragana}\p{Script=Katakana}]/u
|
|
14
40
|
export const HAN_CHARACTER = /\p{Script=Han}/u
|
|
41
|
+
export const CJK_CHARACTER =
|
|
42
|
+
/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u
|
|
43
|
+
/**
|
|
44
|
+
* What CJK text draws from its fallback: every character Unicode lists as used with a CJK script
|
|
45
|
+
* (its letters, punctuation, strokes, and Bopomofo), and the East Asian presentation forms, which
|
|
46
|
+
* it lists with none: vertical, compatibility, halfwidth and fullwidth forms.
|
|
47
|
+
*/
|
|
48
|
+
export const CJK_FALLBACK_CHARACTER =
|
|
49
|
+
/[\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Hangul}\p{scx=Bopomofo}\u3000\ufe10-\ufe1f\ufe30-\ufe4f\uff00-\uffef]/u
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Whether `script`'s fallback is loaded to draw `character`: the text's characters of its
|
|
53
|
+
* writing system, and the Han, punctuation, and forms the CJK languages share, but not another
|
|
54
|
+
* language's letters, which that language's fallback loads for.
|
|
55
|
+
*/
|
|
56
|
+
export function fallbackDrawsCharacter(script: FontFallbackScript, character: string): boolean {
|
|
57
|
+
switch (script) {
|
|
58
|
+
case 'arabic':
|
|
59
|
+
return ARABIC_CHARACTER.test(character)
|
|
60
|
+
case 'hebrew':
|
|
61
|
+
return HEBREW_CHARACTER.test(character)
|
|
62
|
+
case 'thai':
|
|
63
|
+
return THAI_CHARACTER.test(character)
|
|
64
|
+
case 'devanagari':
|
|
65
|
+
return DEVANAGARI_CHARACTER.test(character)
|
|
66
|
+
}
|
|
67
|
+
if (!CJK_FALLBACK_CHARACTER.test(character)) return false
|
|
68
|
+
if (script === 'cjk') return true
|
|
69
|
+
if (HANGUL_CHARACTER.test(character)) return script === 'cjk-kr'
|
|
70
|
+
if (KANA_CHARACTER.test(character)) return script === 'cjk-jp'
|
|
71
|
+
return true
|
|
72
|
+
}
|
|
15
73
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Han characters written only in Traditional Chinese: those OpenCC's Traditional-to-Simplified
|
|
76
|
+
* character table changes. A guide to which fallback to load first, not language identification.
|
|
77
|
+
*/
|
|
78
|
+
const TRADITIONAL_ONLY_HAN = new Set(
|
|
79
|
+
TS_CHARACTERS.split('|').flatMap((entry) => {
|
|
80
|
+
const [traditional, ...simplified] = entry.split(' ')
|
|
81
|
+
return simplified.includes(traditional) ? [] : [traditional]
|
|
82
|
+
})
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
export function isTraditionalOnlyHan(character: string): boolean {
|
|
86
|
+
return TRADITIONAL_ONLY_HAN.has(character)
|
|
87
|
+
}
|
|
19
88
|
|
|
20
89
|
/** The fallback a character needs, if any; a language picks among the Chinese and Japanese ones. */
|
|
21
90
|
export function fontFallbackScriptForCharacter(
|
|
@@ -23,31 +92,54 @@ export function fontFallbackScriptForCharacter(
|
|
|
23
92
|
language?: string | null
|
|
24
93
|
): FontFallbackScript | null {
|
|
25
94
|
if (ARABIC_CHARACTER.test(char)) return 'arabic'
|
|
95
|
+
if (HEBREW_CHARACTER.test(char)) return 'hebrew'
|
|
96
|
+
if (THAI_CHARACTER.test(char)) return 'thai'
|
|
97
|
+
if (DEVANAGARI_CHARACTER.test(char)) return 'devanagari'
|
|
26
98
|
if (HANGUL_CHARACTER.test(char)) return 'cjk-kr'
|
|
27
99
|
if (KANA_CHARACTER.test(char)) return 'cjk-jp'
|
|
28
100
|
const languageScript = cjkFallbackScriptForLanguage(language)
|
|
29
101
|
if (languageScript && HAN_CHARACTER.test(char)) return languageScript
|
|
30
|
-
if (
|
|
102
|
+
if (isTraditionalOnlyHan(char)) return 'cjk-tc'
|
|
31
103
|
if (HAN_CHARACTER.test(char)) return 'cjk-sc'
|
|
32
104
|
return null
|
|
33
105
|
}
|
|
34
106
|
|
|
107
|
+
/**
|
|
108
|
+
* The CJK fallback a BCP 47 language tag's script asks for, as Unicode's likely subtags fill it in.
|
|
109
|
+
* Text asks once per character, so each tag is read once.
|
|
110
|
+
*/
|
|
35
111
|
export function cjkFallbackScriptForLanguage(
|
|
36
112
|
language: string | null | undefined
|
|
37
113
|
): Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'> | null {
|
|
38
|
-
|
|
39
|
-
const normalized = language.toLowerCase().replaceAll('_', '-')
|
|
40
|
-
const [primary] = normalized.split('-')
|
|
41
|
-
if (primary === 'ja') return 'cjk-jp'
|
|
42
|
-
if (primary === 'ko') return 'cjk-kr'
|
|
43
|
-
if (primary !== 'zh') return null
|
|
44
|
-
const subtags = new Set(normalized.split('-').slice(1))
|
|
45
|
-
if (subtags.has('hant') || subtags.has('tw') || subtags.has('hk') || subtags.has('mo')) {
|
|
46
|
-
return 'cjk-tc'
|
|
47
|
-
}
|
|
48
|
-
return 'cjk-sc'
|
|
114
|
+
return language ? languageFallback(language) : null
|
|
49
115
|
}
|
|
50
116
|
|
|
117
|
+
/** How many language tags keep their answer; a document names a handful. */
|
|
118
|
+
const CACHED_LANGUAGE_TAGS = 64
|
|
119
|
+
|
|
120
|
+
const languageFallback = memoize(
|
|
121
|
+
(
|
|
122
|
+
language: string
|
|
123
|
+
): Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'> | null => {
|
|
124
|
+
let locale: Intl.Locale
|
|
125
|
+
try {
|
|
126
|
+
locale = new Intl.Locale(language.replaceAll('_', '-'))
|
|
127
|
+
} catch {
|
|
128
|
+
return null
|
|
129
|
+
}
|
|
130
|
+
// `Hani` names Han without telling Simplified from Traditional, so the region does.
|
|
131
|
+
if (locale.script === 'Hani')
|
|
132
|
+
locale = new Intl.Locale(locale.language, { region: locale.region })
|
|
133
|
+
const { script } = locale.maximize()
|
|
134
|
+
return script ? (LANGUAGE_SCRIPT_FALLBACKS[script] ?? null) : null
|
|
135
|
+
},
|
|
136
|
+
{ cache: new ResourceCache({ maxEntries: CACHED_LANGUAGE_TAGS }) }
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
const LANGUAGE_SCRIPT_FALLBACKS: Partial<
|
|
140
|
+
Record<string, Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>>
|
|
141
|
+
> = { Hans: 'cjk-sc', Hant: 'cjk-tc', Jpan: 'cjk-jp', Kore: 'cjk-kr' }
|
|
142
|
+
|
|
51
143
|
export interface FontFallbackManifestEntry {
|
|
52
144
|
script: FontFallbackScript
|
|
53
145
|
localFamilies: string[]
|
|
@@ -72,7 +164,7 @@ export function cjkLocalFallbackFamilies(userAgent?: string): string[] {
|
|
|
72
164
|
return [...CJK_FALLBACK_FAMILIES_LINUX]
|
|
73
165
|
}
|
|
74
166
|
|
|
75
|
-
function
|
|
167
|
+
function platformFamilies(
|
|
76
168
|
userAgent: string | undefined,
|
|
77
169
|
families: Record<'mac' | 'windows' | 'linux', string[]>
|
|
78
170
|
): string[] {
|
|
@@ -88,25 +180,25 @@ function cjkScriptLocalFallbackFamilies(
|
|
|
88
180
|
): string[] {
|
|
89
181
|
switch (script) {
|
|
90
182
|
case 'cjk-tc':
|
|
91
|
-
return
|
|
183
|
+
return platformFamilies(userAgent, {
|
|
92
184
|
mac: ['PingFang TC', 'Heiti TC', 'PingFang SC', 'Hiragino Sans'],
|
|
93
185
|
windows: ['Microsoft JhengHei', 'Microsoft YaHei', 'Microsoft YaHei UI', 'SimSun'],
|
|
94
186
|
linux: ['Noto Sans CJK TC', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
95
187
|
})
|
|
96
188
|
case 'cjk-jp':
|
|
97
|
-
return
|
|
189
|
+
return platformFamilies(userAgent, {
|
|
98
190
|
mac: ['Hiragino Sans', 'PingFang SC', 'PingFang TC'],
|
|
99
191
|
windows: ['Yu Gothic', 'Microsoft YaHei', 'Microsoft JhengHei'],
|
|
100
192
|
linux: ['Noto Sans CJK JP', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
101
193
|
})
|
|
102
194
|
case 'cjk-kr':
|
|
103
|
-
return
|
|
195
|
+
return platformFamilies(userAgent, {
|
|
104
196
|
mac: ['Apple SD Gothic Neo', 'PingFang SC', 'Hiragino Sans'],
|
|
105
197
|
windows: ['Malgun Gothic', 'Microsoft YaHei', 'Yu Gothic'],
|
|
106
198
|
linux: ['Noto Sans CJK KR', 'Noto Sans CJK SC', 'Droid Sans Fallback']
|
|
107
199
|
})
|
|
108
200
|
default:
|
|
109
|
-
return
|
|
201
|
+
return platformFamilies(userAgent, {
|
|
110
202
|
mac: ['PingFang SC', 'Heiti SC', 'PingFang TC', 'Hiragino Sans'],
|
|
111
203
|
windows: ['Microsoft YaHei', 'Microsoft YaHei UI', 'SimHei', 'SimSun'],
|
|
112
204
|
linux: ['Noto Sans CJK SC', 'WenQuanYi Micro Hei', 'Droid Sans Fallback']
|
|
@@ -114,6 +206,52 @@ function cjkScriptLocalFallbackFamilies(
|
|
|
114
206
|
}
|
|
115
207
|
}
|
|
116
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Installed fonts that draw Hebrew, Thai, and Devanagari on each system, then the Noto family
|
|
211
|
+
* Google Fonts serves for it, so text in these scripts draws without bundling their fonts.
|
|
212
|
+
*/
|
|
213
|
+
const LETTER_SCRIPT_FAMILIES: Record<
|
|
214
|
+
Exclude<LetterFallbackScript, 'arabic'>,
|
|
215
|
+
{ local: Record<'mac' | 'windows' | 'linux', string[]>; remote: string[] }
|
|
216
|
+
> = {
|
|
217
|
+
hebrew: {
|
|
218
|
+
local: {
|
|
219
|
+
mac: ['Arial Hebrew', 'Lucida Grande'],
|
|
220
|
+
windows: ['Segoe UI', 'Arial', 'David'],
|
|
221
|
+
linux: ['Noto Sans Hebrew', 'DejaVu Sans']
|
|
222
|
+
},
|
|
223
|
+
remote: ['Noto Sans Hebrew']
|
|
224
|
+
},
|
|
225
|
+
thai: {
|
|
226
|
+
local: {
|
|
227
|
+
mac: ['Thonburi', 'Sukhumvit Set', 'Ayuthaya'],
|
|
228
|
+
windows: ['Leelawadee UI', 'Tahoma'],
|
|
229
|
+
linux: ['Noto Sans Thai', 'Loma']
|
|
230
|
+
},
|
|
231
|
+
remote: ['Noto Sans Thai']
|
|
232
|
+
},
|
|
233
|
+
devanagari: {
|
|
234
|
+
local: {
|
|
235
|
+
mac: ['Kohinoor Devanagari', 'Devanagari Sangam MN', 'Devanagari MT'],
|
|
236
|
+
windows: ['Nirmala UI', 'Mangal'],
|
|
237
|
+
linux: ['Noto Sans Devanagari', 'Lohit Devanagari']
|
|
238
|
+
},
|
|
239
|
+
remote: ['Noto Sans Devanagari']
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function letterScriptEntry(
|
|
244
|
+
script: Exclude<LetterFallbackScript, 'arabic'>,
|
|
245
|
+
userAgent?: string
|
|
246
|
+
): FontFallbackManifestEntry {
|
|
247
|
+
const families = LETTER_SCRIPT_FAMILIES[script]
|
|
248
|
+
return {
|
|
249
|
+
script,
|
|
250
|
+
localFamilies: [...platformFamilies(userAgent, families.local)],
|
|
251
|
+
remoteFamilies: [...families.remote]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
117
255
|
const CJK_SCRIPT_REMOTE_FAMILIES: Record<
|
|
118
256
|
Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,
|
|
119
257
|
string[]
|
|
@@ -157,7 +295,10 @@ export function fontFallbackManifest(
|
|
|
157
295
|
script: 'arabic',
|
|
158
296
|
localFamilies: [...ARABIC_LOCAL_FALLBACK_FAMILIES],
|
|
159
297
|
remoteFamilies: [...ARABIC_REMOTE_FALLBACK_FAMILIES]
|
|
160
|
-
}
|
|
298
|
+
},
|
|
299
|
+
hebrew: letterScriptEntry('hebrew', userAgent),
|
|
300
|
+
thai: letterScriptEntry('thai', userAgent),
|
|
301
|
+
devanagari: letterScriptEntry('devanagari', userAgent)
|
|
161
302
|
}
|
|
162
303
|
}
|
|
163
304
|
|
package/src/text/font/catalog.ts
CHANGED
|
@@ -55,6 +55,16 @@ export class FamilyFaceCatalog {
|
|
|
55
55
|
return lookup
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/** The families the host's catalog lists. */
|
|
59
|
+
hostFamilies(): string[] {
|
|
60
|
+
return [...this.hostFaces.keys()]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The families `faces` has found faces for so far. */
|
|
64
|
+
foundFamilies(): string[] {
|
|
65
|
+
return [...this.found].filter(([, faces]) => faces?.length).map(([family]) => family)
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
/** The faces `faces` found for a family, once it has; `undefined` before. */
|
|
59
69
|
foundFaces(family: string): FamilyFace[] | null | undefined {
|
|
60
70
|
return this.found.get(family)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CanvasKit,
|
|
3
|
+
FontCollection,
|
|
4
|
+
ParagraphBuilder,
|
|
5
|
+
ParagraphStyle,
|
|
6
|
+
TypefaceFontProvider
|
|
7
|
+
} from 'canvaskit-wasm'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The font collection each provider's paragraphs are built with, made once and again only when
|
|
11
|
+
* the provider gains a font.
|
|
12
|
+
*
|
|
13
|
+
* `ParagraphBuilder.MakeFromFontProvider` makes a new collection for every paragraph, and each new
|
|
14
|
+
* collection instantiates a variable font's axes on a new typeface clone. CanvasKit keeps part of
|
|
15
|
+
* every clone, in proportion to the font's glyphs: about 64 KB a paragraph for Noto Sans SC, so a
|
|
16
|
+
* document of some 30,000 Chinese texts filled the 2 GB heap and aborted while it opened. A shared
|
|
17
|
+
* collection makes each instance once.
|
|
18
|
+
*
|
|
19
|
+
* A collection keeps the families it has looked up, the ones it did not find included, so a font
|
|
20
|
+
* registered in the provider afterwards needs a new one: {@link resetFontCollection}.
|
|
21
|
+
*
|
|
22
|
+
* Paragraphs with half leading and without it get a collection each: a collection's paragraph cache
|
|
23
|
+
* keys shaped text without its style's half leading, so a paragraph would take the line metrics of
|
|
24
|
+
* an earlier one that differs only there.
|
|
25
|
+
*/
|
|
26
|
+
const collections = new WeakMap<TypefaceFontProvider, Map<boolean, FontCollection>>()
|
|
27
|
+
|
|
28
|
+
/** A paragraph builder drawing from `provider`, through the collection its paragraphs share. */
|
|
29
|
+
export function makeParagraphBuilder(
|
|
30
|
+
ck: CanvasKit,
|
|
31
|
+
style: ParagraphStyle,
|
|
32
|
+
provider: TypefaceFontProvider
|
|
33
|
+
): ParagraphBuilder {
|
|
34
|
+
const halfLeading = style.textStyle?.halfLeading ?? false
|
|
35
|
+
let shared = collections.get(provider)
|
|
36
|
+
if (!shared) {
|
|
37
|
+
shared = new Map()
|
|
38
|
+
collections.set(provider, shared)
|
|
39
|
+
}
|
|
40
|
+
let collection = shared.get(halfLeading)
|
|
41
|
+
if (!collection) {
|
|
42
|
+
collection = ck.FontCollection.Make()
|
|
43
|
+
collection.setDefaultFontManager(provider)
|
|
44
|
+
collection.enableFontFallback()
|
|
45
|
+
shared.set(halfLeading, collection)
|
|
46
|
+
}
|
|
47
|
+
return ck.ParagraphBuilder.MakeFromFontCollection(style, collection)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Lets `provider`'s next paragraph look its families up again: call it after registering a font
|
|
52
|
+
* in the provider, and before deleting the provider. Paragraphs built already keep the collection
|
|
53
|
+
* they were built with until they are deleted.
|
|
54
|
+
*/
|
|
55
|
+
export function resetFontCollection(provider: TypefaceFontProvider): void {
|
|
56
|
+
const shared = collections.get(provider)
|
|
57
|
+
if (!shared) return
|
|
58
|
+
collections.delete(provider)
|
|
59
|
+
for (const collection of shared.values()) collection.delete()
|
|
60
|
+
}
|
package/src/text/font/faces.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { uniqBy } from 'es-toolkit'
|
|
1
|
+
import { partition, uniqBy } from 'es-toolkit'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
namesWidth,
|
|
4
5
|
parseFontStyle,
|
|
5
6
|
standardStyleName,
|
|
6
7
|
type ParsedFontStyle
|
|
@@ -19,13 +20,16 @@ export interface FamilyFace extends FaceWeight {
|
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* The faces named by a family's style names, such as "Bold Italic" or "Semi Bold", each keeping
|
|
22
|
-
* its name. Of two names for one weight and slant, the first listed is the
|
|
23
|
+
* its name, in the order listed. Of two names for one weight and slant, the first listed is the
|
|
24
|
+
* face's, and a normal-width name ("Medium") goes before a width name ("Compressed Medium").
|
|
23
25
|
*/
|
|
24
26
|
export function facesFromStyles(styles: readonly string[]): FamilyFace[] {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const faces = styles.map((style) => ({ ...parseFontStyle(style), style }))
|
|
28
|
+
const [normalWidth, otherWidth] = partition(faces, (face) => !namesWidth(face.style))
|
|
29
|
+
const slotFaces = new Set(
|
|
30
|
+
uniqBy([...normalWidth, ...otherWidth], (face) => `${face.weight}${face.italic ? 'i' : ''}`)
|
|
28
31
|
)
|
|
32
|
+
return faces.filter((face) => slotFaces.has(face))
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
/** A face named as Google Fonts names it, for a source that gives weights but no names. */
|
package/src/text/font/glyphs.ts
CHANGED
|
@@ -226,19 +226,23 @@ export function fontHasGlyphSync(family: string, style: string, char: string): b
|
|
|
226
226
|
return fontGlyphCoverageSync(family, style, char) === 'has'
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
/**
|
|
229
|
+
/**
|
|
230
|
+
* Each glyph HarfBuzz shapes `text` into, with its outline, pen position, and advance. A variable
|
|
231
|
+
* font shapes and draws the instance at `variations`.
|
|
232
|
+
*/
|
|
230
233
|
export function getGlyphOutlineMetricsSync(
|
|
231
234
|
family: string,
|
|
232
235
|
style: string,
|
|
233
236
|
text: string,
|
|
234
|
-
fontSize: number
|
|
237
|
+
fontSize: number,
|
|
238
|
+
variations: readonly FontVariation[] = []
|
|
235
239
|
): GlyphOutlineMetrics[] | null {
|
|
236
240
|
const parsed = getParsedFont(family, style)
|
|
237
241
|
if (!parsed) return null
|
|
238
242
|
const scale = fontSize / parsed.face.upem
|
|
239
|
-
const instance = fontInstance(parsed,
|
|
243
|
+
const instance = fontInstance(parsed, variations)
|
|
240
244
|
let pen = 0
|
|
241
|
-
return shapeText(parsed, text).map((glyph) => {
|
|
245
|
+
return shapeText(parsed, text, { instance }).map((glyph) => {
|
|
242
246
|
// Shaping moves some glyphs off the pen, such as marks onto their base letter.
|
|
243
247
|
const offsetX = (glyph.xOffset ?? 0) * scale
|
|
244
248
|
// y runs down; subtracting keeps an unmoved glyph's baseline 0 rather than -0.
|
|
@@ -253,6 +257,27 @@ export function getGlyphOutlineMetricsSync(
|
|
|
253
257
|
})
|
|
254
258
|
}
|
|
255
259
|
|
|
260
|
+
/**
|
|
261
|
+
* The advance of each glyph HarfBuzz shapes `text` into and the UTF-16 index it starts at, at
|
|
262
|
+
* `fontSize` and, in a variable font, the instance at `variations`.
|
|
263
|
+
*/
|
|
264
|
+
export function shapedAdvancesSync(
|
|
265
|
+
family: string,
|
|
266
|
+
style: string,
|
|
267
|
+
text: string,
|
|
268
|
+
fontSize: number,
|
|
269
|
+
variations: readonly FontVariation[] = []
|
|
270
|
+
): { cluster: number; advance: number }[] | null {
|
|
271
|
+
const parsed = getParsedFont(family, style)
|
|
272
|
+
if (!parsed) return null
|
|
273
|
+
const scale = fontSize / parsed.face.upem
|
|
274
|
+
const instance = fontInstance(parsed, variations)
|
|
275
|
+
return shapeText(parsed, text, { instance }).map((glyph) => ({
|
|
276
|
+
cluster: glyph.cluster,
|
|
277
|
+
advance: (glyph.xAdvance ?? 0) * scale
|
|
278
|
+
}))
|
|
279
|
+
}
|
|
280
|
+
|
|
256
281
|
/** Outlines of one loaded font, addressed by the glyph IDs a shaper produced. */
|
|
257
282
|
/** A glyph HarfBuzz shaped text into: its ID, the UTF-16 index it starts at, and its advance in em. */
|
|
258
283
|
export interface ShapedGlyph {
|
package/src/text/font/local.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IS_BROWSER } from '#core/constants'
|
|
2
2
|
import { SharedReads } from '#core/text/font/reads'
|
|
3
3
|
import type { FontInfo, LocalFontAccessState } from '#core/text/font/sources'
|
|
4
|
-
import {
|
|
4
|
+
import { findLocalFont } from '#core/text/font/style'
|
|
5
5
|
|
|
6
6
|
/** The fonts installed in the browser's system, read through the Local Font Access API. */
|
|
7
7
|
export class LocalFonts {
|
|
@@ -62,7 +62,7 @@ export class LocalFonts {
|
|
|
62
62
|
try {
|
|
63
63
|
const fonts = await window.queryLocalFonts?.()
|
|
64
64
|
if (!fonts) return null
|
|
65
|
-
const match =
|
|
65
|
+
const match = findLocalFont(fonts, family, style)
|
|
66
66
|
if (!match) return null
|
|
67
67
|
const blob: Blob = await match.blob()
|
|
68
68
|
return await blob.arrayBuffer()
|