@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
package/dist/text/fallbacks.js
CHANGED
|
@@ -1,33 +1,97 @@
|
|
|
1
1
|
import { CJK_FALLBACK_FAMILIES_LINUX, CJK_FALLBACK_FAMILIES_MACOS, CJK_FALLBACK_FAMILIES_WINDOWS, CJK_GOOGLE_FONTS } from "../constants.js";
|
|
2
|
+
import { ResourceCache } from "../cache/resource.js";
|
|
3
|
+
import { memoize } from "es-toolkit/function";
|
|
4
|
+
import TS_CHARACTERS from "opencc-js/dict/TSCharacters";
|
|
2
5
|
//#region src/text/fallbacks.ts
|
|
6
|
+
/** The fallbacks for scripts written in letters, which the renderer tries before the CJK ones. */
|
|
7
|
+
const LETTER_FALLBACK_SCRIPTS = [
|
|
8
|
+
"arabic",
|
|
9
|
+
"hebrew",
|
|
10
|
+
"thai",
|
|
11
|
+
"devanagari"
|
|
12
|
+
];
|
|
3
13
|
/** Characters of the writing systems that need a fallback font, by their Unicode script. */
|
|
4
14
|
const ARABIC_CHARACTER = /\p{Script=Arabic}/u;
|
|
15
|
+
const HEBREW_CHARACTER = /\p{Script=Hebrew}/u;
|
|
16
|
+
const THAI_CHARACTER = /\p{Script=Thai}/u;
|
|
17
|
+
const DEVANAGARI_CHARACTER = /\p{Script=Devanagari}/u;
|
|
5
18
|
const HANGUL_CHARACTER = /\p{Script=Hangul}/u;
|
|
6
19
|
const KANA_CHARACTER = /[\p{Script=Hiragana}\p{Script=Katakana}]/u;
|
|
7
20
|
const HAN_CHARACTER = /\p{Script=Han}/u;
|
|
8
|
-
const
|
|
21
|
+
const CJK_CHARACTER = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;
|
|
22
|
+
/**
|
|
23
|
+
* What CJK text draws from its fallback: every character Unicode lists as used with a CJK script
|
|
24
|
+
* (its letters, punctuation, strokes, and Bopomofo), and the East Asian presentation forms, which
|
|
25
|
+
* it lists with none: vertical, compatibility, halfwidth and fullwidth forms.
|
|
26
|
+
*/
|
|
27
|
+
const CJK_FALLBACK_CHARACTER = /[\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Hangul}\p{scx=Bopomofo}\u3000\ufe10-\ufe1f\ufe30-\ufe4f\uff00-\uffef]/u;
|
|
28
|
+
/**
|
|
29
|
+
* Whether `script`'s fallback is loaded to draw `character`: the text's characters of its
|
|
30
|
+
* writing system, and the Han, punctuation, and forms the CJK languages share, but not another
|
|
31
|
+
* language's letters, which that language's fallback loads for.
|
|
32
|
+
*/
|
|
33
|
+
function fallbackDrawsCharacter(script, character) {
|
|
34
|
+
switch (script) {
|
|
35
|
+
case "arabic": return ARABIC_CHARACTER.test(character);
|
|
36
|
+
case "hebrew": return HEBREW_CHARACTER.test(character);
|
|
37
|
+
case "thai": return THAI_CHARACTER.test(character);
|
|
38
|
+
case "devanagari": return DEVANAGARI_CHARACTER.test(character);
|
|
39
|
+
}
|
|
40
|
+
if (!CJK_FALLBACK_CHARACTER.test(character)) return false;
|
|
41
|
+
if (script === "cjk") return true;
|
|
42
|
+
if (HANGUL_CHARACTER.test(character)) return script === "cjk-kr";
|
|
43
|
+
if (KANA_CHARACTER.test(character)) return script === "cjk-jp";
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Han characters written only in Traditional Chinese: those OpenCC's Traditional-to-Simplified
|
|
48
|
+
* character table changes. A guide to which fallback to load first, not language identification.
|
|
49
|
+
*/
|
|
50
|
+
const TRADITIONAL_ONLY_HAN = new Set(TS_CHARACTERS.split("|").flatMap((entry) => {
|
|
51
|
+
const [traditional, ...simplified] = entry.split(" ");
|
|
52
|
+
return simplified.includes(traditional) ? [] : [traditional];
|
|
53
|
+
}));
|
|
54
|
+
function isTraditionalOnlyHan(character) {
|
|
55
|
+
return TRADITIONAL_ONLY_HAN.has(character);
|
|
56
|
+
}
|
|
9
57
|
/** The fallback a character needs, if any; a language picks among the Chinese and Japanese ones. */
|
|
10
58
|
function fontFallbackScriptForCharacter(char, language) {
|
|
11
59
|
if (ARABIC_CHARACTER.test(char)) return "arabic";
|
|
60
|
+
if (HEBREW_CHARACTER.test(char)) return "hebrew";
|
|
61
|
+
if (THAI_CHARACTER.test(char)) return "thai";
|
|
62
|
+
if (DEVANAGARI_CHARACTER.test(char)) return "devanagari";
|
|
12
63
|
if (HANGUL_CHARACTER.test(char)) return "cjk-kr";
|
|
13
64
|
if (KANA_CHARACTER.test(char)) return "cjk-jp";
|
|
14
65
|
const languageScript = cjkFallbackScriptForLanguage(language);
|
|
15
66
|
if (languageScript && HAN_CHARACTER.test(char)) return languageScript;
|
|
16
|
-
if (
|
|
67
|
+
if (isTraditionalOnlyHan(char)) return "cjk-tc";
|
|
17
68
|
if (HAN_CHARACTER.test(char)) return "cjk-sc";
|
|
18
69
|
return null;
|
|
19
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* The CJK fallback a BCP 47 language tag's script asks for, as Unicode's likely subtags fill it in.
|
|
73
|
+
* Text asks once per character, so each tag is read once.
|
|
74
|
+
*/
|
|
20
75
|
function cjkFallbackScriptForLanguage(language) {
|
|
21
|
-
|
|
22
|
-
const normalized = language.toLowerCase().replaceAll("_", "-");
|
|
23
|
-
const [primary] = normalized.split("-");
|
|
24
|
-
if (primary === "ja") return "cjk-jp";
|
|
25
|
-
if (primary === "ko") return "cjk-kr";
|
|
26
|
-
if (primary !== "zh") return null;
|
|
27
|
-
const subtags = new Set(normalized.split("-").slice(1));
|
|
28
|
-
if (subtags.has("hant") || subtags.has("tw") || subtags.has("hk") || subtags.has("mo")) return "cjk-tc";
|
|
29
|
-
return "cjk-sc";
|
|
76
|
+
return language ? languageFallback(language) : null;
|
|
30
77
|
}
|
|
78
|
+
const languageFallback = memoize((language) => {
|
|
79
|
+
let locale;
|
|
80
|
+
try {
|
|
81
|
+
locale = new Intl.Locale(language.replaceAll("_", "-"));
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (locale.script === "Hani") locale = new Intl.Locale(locale.language, { region: locale.region });
|
|
86
|
+
const { script } = locale.maximize();
|
|
87
|
+
return script ? LANGUAGE_SCRIPT_FALLBACKS[script] ?? null : null;
|
|
88
|
+
}, { cache: new ResourceCache({ maxEntries: 64 }) });
|
|
89
|
+
const LANGUAGE_SCRIPT_FALLBACKS = {
|
|
90
|
+
Hans: "cjk-sc",
|
|
91
|
+
Hant: "cjk-tc",
|
|
92
|
+
Jpan: "cjk-jp",
|
|
93
|
+
Kore: "cjk-kr"
|
|
94
|
+
};
|
|
31
95
|
const ARABIC_LOCAL_FALLBACK_FAMILIES = [
|
|
32
96
|
"Noto Naskh Arabic",
|
|
33
97
|
"Noto Sans Arabic",
|
|
@@ -43,7 +107,7 @@ function cjkLocalFallbackFamilies(userAgent) {
|
|
|
43
107
|
if (userAgent.includes("Windows")) return [...CJK_FALLBACK_FAMILIES_WINDOWS];
|
|
44
108
|
return [...CJK_FALLBACK_FAMILIES_LINUX];
|
|
45
109
|
}
|
|
46
|
-
function
|
|
110
|
+
function platformFamilies(userAgent, families) {
|
|
47
111
|
if (!userAgent) return families.linux;
|
|
48
112
|
if (userAgent.includes("Mac")) return families.mac;
|
|
49
113
|
if (userAgent.includes("Windows")) return families.windows;
|
|
@@ -51,7 +115,7 @@ function platformCJKFamilies(userAgent, families) {
|
|
|
51
115
|
}
|
|
52
116
|
function cjkScriptLocalFallbackFamilies(script, userAgent) {
|
|
53
117
|
switch (script) {
|
|
54
|
-
case "cjk-tc": return
|
|
118
|
+
case "cjk-tc": return platformFamilies(userAgent, {
|
|
55
119
|
mac: [
|
|
56
120
|
"PingFang TC",
|
|
57
121
|
"Heiti TC",
|
|
@@ -70,7 +134,7 @@ function cjkScriptLocalFallbackFamilies(script, userAgent) {
|
|
|
70
134
|
"Droid Sans Fallback"
|
|
71
135
|
]
|
|
72
136
|
});
|
|
73
|
-
case "cjk-jp": return
|
|
137
|
+
case "cjk-jp": return platformFamilies(userAgent, {
|
|
74
138
|
mac: [
|
|
75
139
|
"Hiragino Sans",
|
|
76
140
|
"PingFang SC",
|
|
@@ -87,7 +151,7 @@ function cjkScriptLocalFallbackFamilies(script, userAgent) {
|
|
|
87
151
|
"Droid Sans Fallback"
|
|
88
152
|
]
|
|
89
153
|
});
|
|
90
|
-
case "cjk-kr": return
|
|
154
|
+
case "cjk-kr": return platformFamilies(userAgent, {
|
|
91
155
|
mac: [
|
|
92
156
|
"Apple SD Gothic Neo",
|
|
93
157
|
"PingFang SC",
|
|
@@ -104,7 +168,7 @@ function cjkScriptLocalFallbackFamilies(script, userAgent) {
|
|
|
104
168
|
"Droid Sans Fallback"
|
|
105
169
|
]
|
|
106
170
|
});
|
|
107
|
-
default: return
|
|
171
|
+
default: return platformFamilies(userAgent, {
|
|
108
172
|
mac: [
|
|
109
173
|
"PingFang SC",
|
|
110
174
|
"Heiti SC",
|
|
@@ -125,6 +189,56 @@ function cjkScriptLocalFallbackFamilies(script, userAgent) {
|
|
|
125
189
|
});
|
|
126
190
|
}
|
|
127
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Installed fonts that draw Hebrew, Thai, and Devanagari on each system, then the Noto family
|
|
194
|
+
* Google Fonts serves for it, so text in these scripts draws without bundling their fonts.
|
|
195
|
+
*/
|
|
196
|
+
const LETTER_SCRIPT_FAMILIES = {
|
|
197
|
+
hebrew: {
|
|
198
|
+
local: {
|
|
199
|
+
mac: ["Arial Hebrew", "Lucida Grande"],
|
|
200
|
+
windows: [
|
|
201
|
+
"Segoe UI",
|
|
202
|
+
"Arial",
|
|
203
|
+
"David"
|
|
204
|
+
],
|
|
205
|
+
linux: ["Noto Sans Hebrew", "DejaVu Sans"]
|
|
206
|
+
},
|
|
207
|
+
remote: ["Noto Sans Hebrew"]
|
|
208
|
+
},
|
|
209
|
+
thai: {
|
|
210
|
+
local: {
|
|
211
|
+
mac: [
|
|
212
|
+
"Thonburi",
|
|
213
|
+
"Sukhumvit Set",
|
|
214
|
+
"Ayuthaya"
|
|
215
|
+
],
|
|
216
|
+
windows: ["Leelawadee UI", "Tahoma"],
|
|
217
|
+
linux: ["Noto Sans Thai", "Loma"]
|
|
218
|
+
},
|
|
219
|
+
remote: ["Noto Sans Thai"]
|
|
220
|
+
},
|
|
221
|
+
devanagari: {
|
|
222
|
+
local: {
|
|
223
|
+
mac: [
|
|
224
|
+
"Kohinoor Devanagari",
|
|
225
|
+
"Devanagari Sangam MN",
|
|
226
|
+
"Devanagari MT"
|
|
227
|
+
],
|
|
228
|
+
windows: ["Nirmala UI", "Mangal"],
|
|
229
|
+
linux: ["Noto Sans Devanagari", "Lohit Devanagari"]
|
|
230
|
+
},
|
|
231
|
+
remote: ["Noto Sans Devanagari"]
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
function letterScriptEntry(script, userAgent) {
|
|
235
|
+
const families = LETTER_SCRIPT_FAMILIES[script];
|
|
236
|
+
return {
|
|
237
|
+
script,
|
|
238
|
+
localFamilies: [...platformFamilies(userAgent, families.local)],
|
|
239
|
+
remoteFamilies: [...families.remote]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
128
242
|
const CJK_SCRIPT_REMOTE_FAMILIES = {
|
|
129
243
|
"cjk-sc": ["Noto Sans SC"],
|
|
130
244
|
"cjk-tc": ["Noto Sans TC", "Noto Sans SC"],
|
|
@@ -162,13 +276,16 @@ function fontFallbackManifest(userAgent) {
|
|
|
162
276
|
script: "arabic",
|
|
163
277
|
localFamilies: [...ARABIC_LOCAL_FALLBACK_FAMILIES],
|
|
164
278
|
remoteFamilies: [...ARABIC_REMOTE_FALLBACK_FAMILIES]
|
|
165
|
-
}
|
|
279
|
+
},
|
|
280
|
+
hebrew: letterScriptEntry("hebrew", userAgent),
|
|
281
|
+
thai: letterScriptEntry("thai", userAgent),
|
|
282
|
+
devanagari: letterScriptEntry("devanagari", userAgent)
|
|
166
283
|
};
|
|
167
284
|
}
|
|
168
285
|
function fontFallbackEntry(script, userAgent) {
|
|
169
286
|
return fontFallbackManifest(userAgent)[script];
|
|
170
287
|
}
|
|
171
288
|
//#endregion
|
|
172
|
-
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, HANGUL_CHARACTER, HAN_CHARACTER, KANA_CHARACTER,
|
|
289
|
+
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, CJK_CHARACTER, CJK_FALLBACK_CHARACTER, DEVANAGARI_CHARACTER, HANGUL_CHARACTER, HAN_CHARACTER, HEBREW_CHARACTER, KANA_CHARACTER, LETTER_FALLBACK_SCRIPTS, THAI_CHARACTER, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, fallbackDrawsCharacter, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter, isTraditionalOnlyHan };
|
|
173
290
|
|
|
174
291
|
//# sourceMappingURL=fallbacks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallbacks.js","names":[],"sources":["../../src/text/fallbacks.ts"],"sourcesContent":["import {\n CJK_FALLBACK_FAMILIES_LINUX,\n CJK_FALLBACK_FAMILIES_MACOS,\n CJK_FALLBACK_FAMILIES_WINDOWS,\n CJK_GOOGLE_FONTS\n} from '#core/constants'\n\nexport type FontFallbackScript = 'cjk' | 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr' | 'arabic'\n\n/** Characters of the writing systems that need a fallback font, by their Unicode script. */\nexport const ARABIC_CHARACTER = /\\p{Script=Arabic}/u\nexport const HANGUL_CHARACTER = /\\p{Script=Hangul}/u\nexport const KANA_CHARACTER = /[\\p{Script=Hiragana}\\p{Script=Katakana}]/u\nexport const HAN_CHARACTER = /\\p{Script=Han}/u\n\n// Common Traditional-only characters. This is a heuristic for fallback order, not language ID.\nexport const TRADITIONAL_HAN_CHARACTER =\n /[萬與專業叢東絲丟兩嚴喪個豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亞產畝親褻褸億僅從侖倉儀們價眾優會傘偉傳傷倫偽體餘傭僉俠侶僥偵側僑儈儕儂億儉儐儔儕償儘兒兌黨蘭關興茲養獸內岡冊寫軍農冪凍淨準涼減湊凜幾鳳凱別刪剛創劃劉則剎剗剛劑剮劍劇勸辦務動勵勁勞勢勛勝匯匱區協華單賣盧衛卻卽廠廳歷厲壓厭厙厠廈廚廄縣參雙發變敘葉號嘆嘍嘔嘖嘗嘜嘩嘮嘯嘰囑圍園圓圖團聖場壞塊堅壇壩壯聲殼壺處備複夠頭夾奪奮奧婦媽妝姍姦娛婁婦嬰孫學孿宮寬賓寢實寧審寫寶將專尋導壽對爾塵嘗堯尷屆屍屜屢層屨歲歸當錄彥徹徑從復恥悅悵悶惡惱惲愛愜愷態慘慚慟慣慪慫慮慳慶憂憊憐憑憒憚憤憫憮憲憶懇應懶懷懸懺懼懾戀戇戔戧戰戲戶拋挾捨捫掃掄掗掙掛採揀揚換揮損搖搗搶摑摜摟摯摳摶摻撈撐撓撚撝撟撣撥撫撲撳撻撾撿擁擄擇擊擋擠擡擬擯擰擱擲擴擺擾攏攔攖攙攜攝攢敵斂斃斕斬斷於時晉晝暈暉暘暢暫曄曆曇曉曏曖曠曨會朧東棟棧棲樣欄樹樺橋機橢橫檔檢樓標樞樞樂樅歐殲殮毆氣氫氬氳決況洶浹涇涼淒淚淥淵淶淺漁漚漢滿滯滲滷滸滻滾滿漬漸漿潁潑潔潛潤潯潰潷潿澀澆澇澗澠澤澦澩澮濁濃濕濟濤濫濰濱濺濾瀆瀉瀋瀏瀕瀘瀝瀟瀠瀦瀧瀨瀰瀲灑灘灝灣灤災為烏無煉煒煙煩煬熱熾燁燈燒燙燜營燦燭爍爐爛爭爺牆牘犧狀獨狹獅獎獄獵獸獻獺璣瑪瑋環現琺琿瑤瑩瑪璉璦璫璽瓊瓏瓔甌產畝畢異畫當疇疊痙痾瘂瘋瘍瘞瘡瘧瘮瘲瘺瘻療癆癇癉癐癒癘癟癢癤癥癧癩癬癭癮癰癱癲發皚皺盜盞盡監盤盧眥眾睏睜睞瞘瞜瞞瞭瞼矚矯硃硤硨確碼磚磣磧磯礎礙礦礪礫礬祿禍禎禦禪禮禰禱禿秈稅稈稜稟種稱穀穌積穎穡穢穩穫窩窪窮竄竅竇竊競筆筍筧箋箏節範築篋篔篤篩簀簍簞簡簣簫簽簾籃籌籙籠籤籩籬粵糝糞糧糲糴糶糾紀紂約紅紆紇紈紉紋納紐紓純紕紗紙級紛紜紡紥細紱紲紳紹紺紿終組絆絎結絕絛絞絡給絨絰統絲絳絹綁綃綆綈綏經綜綞綠綢綣綫綬維綯綰綱網綴綵綸綹綺綻綽綾綿緄緇緊緋緑緒緓緔緗緘緙線緜緝緞締緡緣緦編緩緬緯緲練緶緹緻縈縉縊縋縐縑縗縛縝縞縟縣縧縫縭縮縱縲縳縴縵縶縷縹總績繃繅繆繈繒織繕繞繚繡繢繩繪繫繭繮繯繰繳繹繼纈纊續纍纏纓纖纘纜缽罈罌罰罵罷羅羆羈羋羥義習翬翹耬聖聞聯聰聲聳職聶聾肅脅脈脛脫脹腎腖腡腦腫腳腸膃膚膠膩膽膾膿臉臍臏臘臚臟臠臨臺與興舉舊艙艤艦艫艱艷芻苧茲荊莊莖莢莧華萇萊萬萵葉葒葦葷蒓蒔蒞蒼蓀蓋蓮蓯蓴蓽蔔蔞蔣蔥蔦蔭蕁蕆蕎蕒蕓蕕蕘蕢蕩蕪蕭蕷薈薊薌薔薘薟薦薩薳薴薺藍藎藝藥藪蘄蘆蘇蘊蘋蘚蘞蘢蘭蘺處虛虜號虧蟲蟄蟈蟎蟣蟥蟬蟯蟲蟻蠅蠆蠍蠐蠑蠟蠣蠱蠶蠻衆術衛衝袞裊裡補裝裡製複褲褳褸襇襠襤襪襬襯襲見覎規覓視覘覡覥覦親覬覯覲覷覺覽覿觀觴觸訁訂訃計訊訌討訐訕訖託記訛訝訟訣訥訪設許訴訶診註詁詆詎詐詔評詖詗詘詛詞詠詡詢詣試詩詫詬詭詮詰話該詳詵詼詿誄誅誆誇誌認誑誒誕誘誚語誠誡誣誤誥誦誨說誰課誶誹誼誾調諂諄談諉請諍諏諑諒論諗諛諜諝諞諡諢諤諦諧諫諭諮諱諳諶諷諸諺諾謀謁謂謄謅謊謎謐謔謖謗謙謚講謝謠謨謫謬謳謹謾譁證譎譏譔譖識譙譚譜譟警譫譯議譴護譽讀變讌讎讒讓讖讚讜讞豈豎豬貓貝貞負財責賢敗賬貨質販貪貧貶購貯貫貳賁貴貶買貸費貼貽貿賀賁賂賃賄資賈賊賑賒賓賕賙賚賜賞賠賡賢賣賤賦質賬賭賴賵賺賻購賽贄贅贇贈贊贋贍贏贐贓贔贖贗贛趕趙趨趲跡踐踴蹌蹕蹣蹤蹺躂躉躊躋躍躑躒躓躕躚躥躦躪軀車軋軌軍軒軔軛軟軤軫軲軸軹軺軻軼軾較輅載輊輒輓輔輕輛輜輝輞輟輥輦輩輪輯輸輻輾輿轂轄轅輿轉轍轎轔轟轡轢轤辦辭辮辯農迴逕這連週進遊運過達違遙遞遠適遲遷選遺遼邁還邇邊邏邐郟郵鄆鄉鄒鄔鄖鄧鄭鄰鄲鄴鄶鄺酈醜醞醫醬釀釁釃釅釋釐鈔鈕鈞鈣鈧鈮鈽鈾鈿鉀鉅鉈鉉鉋鉑鈴鉍鉗鉚鉛鉞鉦鉬鉭鉸鉺鉻鉿銀銃銅銑銓銖銘銚銛銜銠銣銥銦銨銩銪銫銬銱銳銷銹銻銼鋁鋃鋅鋇鋌鋏鋒鋙鋝鋟鋣鋤鋥鋦鋨鋪鋯鋰鋱鋶鋸鋼錄錆錇錈錏錐錒錕錘錙錚錛錟錠錡錢錦錨錫錮錯錳錶鍀鍁鍃鍆鍇鍊鍍鍔鍘鍛鍠鍤鍥鍩鍬鍰鍵鍶鍾鎂鎄鎇鎊鎔鎖鎗鎘鎚鎛鎝鎡鎢鎣鎦鎧鎩鎪鎬鎮鎰鎵鎿鏃鏇鏈鏌鏍鏑鏗鏘鏜鏝鏞鏟鏡鏢鏤鏨鏰鏵鏷鏹鐃鐋鐐鐒鐓鐔鐘鐙鐝鐠鐦鐧鐨鐫鐮鐲鐳鐵鐶鐸鐺鐿鑄鑊鑌鑒鑔鑞鑠鑣鑥鑭鑰鑲鑷鑽鑾鑿長門閂閃閉開閌閎閏閑間閔閘閡閣閥閨閩閫閬閭閱閶閹閻閼閽閾閿闃闆闈闊闋闌闍闐闓闔闕闖關闞闠闡闢闥闧阜陘陝陣陰陳陸陽隉隊階隕際隨險隱隴隸隻雋雙雛雜雞離難雲電霧霽靂靄靆靈靚靜靦鞏鞦韁韃韆韉韋韌韓韙韜韞韻響頁頂頃項順須頊頌頎預頑頒頓頗領頜頡頤頦頭頰頲頸頻頼題額顎顏顒顓願顙顛類顢顥顧顫顯顰顱風颭颮颯颱颳颶颼飄飆飛飠飢飣飥飩飪飫飭飯飲飴飼飽飾餃餄餅餉養餌餎餏餑餒餓餕餘餚餛餜餞餡館餱餳餵餶餷餺餼餾餿饁饃饅饈饉饋饌饑饒饗饜饞饢馬馭馮馱馳馴駁駐駑駒駔駕駙駛駝駟駡駢駭駰駱駿騁騅騎騏騖騙騚騷騶騾驀驁驂驃驄驅驊驍驏驕驗驚驛驟驢驥驦驪驫骯髏髒體髕髖鬆鬍鬚鬥鬧鬨鬩鬮魚魯魴鮁鮃鮑鮒鮚鮞鮦鮪鮫鮭鮮鯁鯉鯊鯒鯖鯗鯛鯝鯡鯢鯤鯧鯨鯪鯫鯰鯴鯷鯽鰂鰈鰉鰍鰒鰓鰜鰟鰠鰣鰥鰨鰩鰭鰱鰲鰳鰵鰷鰹鰺鰻鰾鱈鱉鱒鱔鱖鱗鱘鱝鱟鱠鱣鱤鱧鱨鱭鱯鱷鱸鳥鳧鳩鳳鳴鳶鴆鴇鴉鴒鴕鴛鴝鴞鴟鴣鴦鴨鴯鴰鴻鴿鵂鵃鵑鵒鵓鵜鵝鵠鵡鵪鵬鵮鵯鵲鶇鶉鶓鶘鶚鶩鶯鶲鶴鶺鶻鷂鷓鷗鷙鷚鷥鷦鷫鷯鷲鷸鷹鷺鸚鸛鹵鹹鹺鹼鹽麗麥麼黃黌點黨黲黷黽鼇鼉鼴齊齋齎齏齒齔齕齙齜齟齡齠齣齦齧齪齬齲齶齷龍龐龔龕龜]/u\n\n/** The fallback a character needs, if any; a language picks among the Chinese and Japanese ones. */\nexport function fontFallbackScriptForCharacter(\n char: string,\n language?: string | null\n): FontFallbackScript | null {\n if (ARABIC_CHARACTER.test(char)) return 'arabic'\n if (HANGUL_CHARACTER.test(char)) return 'cjk-kr'\n if (KANA_CHARACTER.test(char)) return 'cjk-jp'\n const languageScript = cjkFallbackScriptForLanguage(language)\n if (languageScript && HAN_CHARACTER.test(char)) return languageScript\n if (TRADITIONAL_HAN_CHARACTER.test(char)) return 'cjk-tc'\n if (HAN_CHARACTER.test(char)) return 'cjk-sc'\n return null\n}\n\nexport function cjkFallbackScriptForLanguage(\n language: string | null | undefined\n): Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'> | null {\n if (!language) return null\n const normalized = language.toLowerCase().replaceAll('_', '-')\n const [primary] = normalized.split('-')\n if (primary === 'ja') return 'cjk-jp'\n if (primary === 'ko') return 'cjk-kr'\n if (primary !== 'zh') return null\n const subtags = new Set(normalized.split('-').slice(1))\n if (subtags.has('hant') || subtags.has('tw') || subtags.has('hk') || subtags.has('mo')) {\n return 'cjk-tc'\n }\n return 'cjk-sc'\n}\n\nexport interface FontFallbackManifestEntry {\n script: FontFallbackScript\n localFamilies: string[]\n remoteFamilies: string[]\n}\n\nexport const ARABIC_LOCAL_FALLBACK_FAMILIES = [\n 'Noto Naskh Arabic',\n 'Noto Sans Arabic',\n 'Geeza Pro',\n 'Arial',\n 'Tahoma',\n 'Amiri'\n]\n\nexport const ARABIC_REMOTE_FALLBACK_FAMILIES = ['Noto Naskh Arabic', 'Noto Sans Arabic']\n\nexport function cjkLocalFallbackFamilies(userAgent?: string): string[] {\n if (!userAgent) return [...CJK_FALLBACK_FAMILIES_LINUX]\n if (userAgent.includes('Mac')) return [...CJK_FALLBACK_FAMILIES_MACOS]\n if (userAgent.includes('Windows')) return [...CJK_FALLBACK_FAMILIES_WINDOWS]\n return [...CJK_FALLBACK_FAMILIES_LINUX]\n}\n\nfunction platformCJKFamilies(\n userAgent: string | undefined,\n families: Record<'mac' | 'windows' | 'linux', string[]>\n): string[] {\n if (!userAgent) return families.linux\n if (userAgent.includes('Mac')) return families.mac\n if (userAgent.includes('Windows')) return families.windows\n return families.linux\n}\n\nfunction cjkScriptLocalFallbackFamilies(\n script: Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,\n userAgent?: string\n): string[] {\n switch (script) {\n case 'cjk-tc':\n return platformCJKFamilies(userAgent, {\n mac: ['PingFang TC', 'Heiti TC', 'PingFang SC', 'Hiragino Sans'],\n windows: ['Microsoft JhengHei', 'Microsoft YaHei', 'Microsoft YaHei UI', 'SimSun'],\n linux: ['Noto Sans CJK TC', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n case 'cjk-jp':\n return platformCJKFamilies(userAgent, {\n mac: ['Hiragino Sans', 'PingFang SC', 'PingFang TC'],\n windows: ['Yu Gothic', 'Microsoft YaHei', 'Microsoft JhengHei'],\n linux: ['Noto Sans CJK JP', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n case 'cjk-kr':\n return platformCJKFamilies(userAgent, {\n mac: ['Apple SD Gothic Neo', 'PingFang SC', 'Hiragino Sans'],\n windows: ['Malgun Gothic', 'Microsoft YaHei', 'Yu Gothic'],\n linux: ['Noto Sans CJK KR', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n default:\n return platformCJKFamilies(userAgent, {\n mac: ['PingFang SC', 'Heiti SC', 'PingFang TC', 'Hiragino Sans'],\n windows: ['Microsoft YaHei', 'Microsoft YaHei UI', 'SimHei', 'SimSun'],\n linux: ['Noto Sans CJK SC', 'WenQuanYi Micro Hei', 'Droid Sans Fallback']\n })\n }\n}\n\nconst CJK_SCRIPT_REMOTE_FAMILIES: Record<\n Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,\n string[]\n> = {\n 'cjk-sc': ['Noto Sans SC'],\n 'cjk-tc': ['Noto Sans TC', 'Noto Sans SC'],\n 'cjk-jp': ['Noto Sans JP', 'Noto Sans SC'],\n 'cjk-kr': ['Noto Sans KR', 'Noto Sans SC']\n}\n\nexport function fontFallbackManifest(\n userAgent?: string\n): Record<FontFallbackScript, FontFallbackManifestEntry> {\n return {\n cjk: {\n script: 'cjk',\n localFamilies: cjkLocalFallbackFamilies(userAgent),\n remoteFamilies: [...CJK_GOOGLE_FONTS]\n },\n 'cjk-sc': {\n script: 'cjk-sc',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-sc', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-sc']\n },\n 'cjk-tc': {\n script: 'cjk-tc',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-tc', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-tc']\n },\n 'cjk-jp': {\n script: 'cjk-jp',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-jp', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-jp']\n },\n 'cjk-kr': {\n script: 'cjk-kr',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-kr', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-kr']\n },\n arabic: {\n script: 'arabic',\n localFamilies: [...ARABIC_LOCAL_FALLBACK_FAMILIES],\n remoteFamilies: [...ARABIC_REMOTE_FALLBACK_FAMILIES]\n }\n }\n}\n\nexport function fontFallbackEntry(\n script: FontFallbackScript,\n userAgent?: string\n): FontFallbackManifestEntry {\n return fontFallbackManifest(userAgent)[script]\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"fallbacks.js","names":[],"sources":["../../src/text/fallbacks.ts"],"sourcesContent":["import { memoize } from 'es-toolkit/function'\nimport TS_CHARACTERS from 'opencc-js/dict/TSCharacters'\n\nimport { ResourceCache } from '#core/cache/resource'\nimport {\n CJK_FALLBACK_FAMILIES_LINUX,\n CJK_FALLBACK_FAMILIES_MACOS,\n CJK_FALLBACK_FAMILIES_WINDOWS,\n CJK_GOOGLE_FONTS\n} from '#core/constants'\n\nexport type FontFallbackScript =\n | 'cjk'\n | 'cjk-sc'\n | 'cjk-tc'\n | 'cjk-jp'\n | 'cjk-kr'\n | 'arabic'\n | 'hebrew'\n | 'thai'\n | 'devanagari'\n\n/** The fallbacks for scripts written in letters, which the renderer tries before the CJK ones. */\nexport const LETTER_FALLBACK_SCRIPTS = [\n 'arabic',\n 'hebrew',\n 'thai',\n 'devanagari'\n] as const satisfies readonly FontFallbackScript[]\n\nexport type LetterFallbackScript = (typeof LETTER_FALLBACK_SCRIPTS)[number]\n\n/** Characters of the writing systems that need a fallback font, by their Unicode script. */\nexport const ARABIC_CHARACTER = /\\p{Script=Arabic}/u\nexport const HEBREW_CHARACTER = /\\p{Script=Hebrew}/u\nexport const THAI_CHARACTER = /\\p{Script=Thai}/u\nexport const DEVANAGARI_CHARACTER = /\\p{Script=Devanagari}/u\nexport const HANGUL_CHARACTER = /\\p{Script=Hangul}/u\nexport const KANA_CHARACTER = /[\\p{Script=Hiragana}\\p{Script=Katakana}]/u\nexport const HAN_CHARACTER = /\\p{Script=Han}/u\nexport const CJK_CHARACTER =\n /[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}]/u\n/**\n * What CJK text draws from its fallback: every character Unicode lists as used with a CJK script\n * (its letters, punctuation, strokes, and Bopomofo), and the East Asian presentation forms, which\n * it lists with none: vertical, compatibility, halfwidth and fullwidth forms.\n */\nexport const CJK_FALLBACK_CHARACTER =\n /[\\p{scx=Han}\\p{scx=Hiragana}\\p{scx=Katakana}\\p{scx=Hangul}\\p{scx=Bopomofo}\\u3000\\ufe10-\\ufe1f\\ufe30-\\ufe4f\\uff00-\\uffef]/u\n\n/**\n * Whether `script`'s fallback is loaded to draw `character`: the text's characters of its\n * writing system, and the Han, punctuation, and forms the CJK languages share, but not another\n * language's letters, which that language's fallback loads for.\n */\nexport function fallbackDrawsCharacter(script: FontFallbackScript, character: string): boolean {\n switch (script) {\n case 'arabic':\n return ARABIC_CHARACTER.test(character)\n case 'hebrew':\n return HEBREW_CHARACTER.test(character)\n case 'thai':\n return THAI_CHARACTER.test(character)\n case 'devanagari':\n return DEVANAGARI_CHARACTER.test(character)\n }\n if (!CJK_FALLBACK_CHARACTER.test(character)) return false\n if (script === 'cjk') return true\n if (HANGUL_CHARACTER.test(character)) return script === 'cjk-kr'\n if (KANA_CHARACTER.test(character)) return script === 'cjk-jp'\n return true\n}\n\n/**\n * Han characters written only in Traditional Chinese: those OpenCC's Traditional-to-Simplified\n * character table changes. A guide to which fallback to load first, not language identification.\n */\nconst TRADITIONAL_ONLY_HAN = new Set(\n TS_CHARACTERS.split('|').flatMap((entry) => {\n const [traditional, ...simplified] = entry.split(' ')\n return simplified.includes(traditional) ? [] : [traditional]\n })\n)\n\nexport function isTraditionalOnlyHan(character: string): boolean {\n return TRADITIONAL_ONLY_HAN.has(character)\n}\n\n/** The fallback a character needs, if any; a language picks among the Chinese and Japanese ones. */\nexport function fontFallbackScriptForCharacter(\n char: string,\n language?: string | null\n): FontFallbackScript | null {\n if (ARABIC_CHARACTER.test(char)) return 'arabic'\n if (HEBREW_CHARACTER.test(char)) return 'hebrew'\n if (THAI_CHARACTER.test(char)) return 'thai'\n if (DEVANAGARI_CHARACTER.test(char)) return 'devanagari'\n if (HANGUL_CHARACTER.test(char)) return 'cjk-kr'\n if (KANA_CHARACTER.test(char)) return 'cjk-jp'\n const languageScript = cjkFallbackScriptForLanguage(language)\n if (languageScript && HAN_CHARACTER.test(char)) return languageScript\n if (isTraditionalOnlyHan(char)) return 'cjk-tc'\n if (HAN_CHARACTER.test(char)) return 'cjk-sc'\n return null\n}\n\n/**\n * The CJK fallback a BCP 47 language tag's script asks for, as Unicode's likely subtags fill it in.\n * Text asks once per character, so each tag is read once.\n */\nexport function cjkFallbackScriptForLanguage(\n language: string | null | undefined\n): Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'> | null {\n return language ? languageFallback(language) : null\n}\n\n/** How many language tags keep their answer; a document names a handful. */\nconst CACHED_LANGUAGE_TAGS = 64\n\nconst languageFallback = memoize(\n (\n language: string\n ): Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'> | null => {\n let locale: Intl.Locale\n try {\n locale = new Intl.Locale(language.replaceAll('_', '-'))\n } catch {\n return null\n }\n // `Hani` names Han without telling Simplified from Traditional, so the region does.\n if (locale.script === 'Hani')\n locale = new Intl.Locale(locale.language, { region: locale.region })\n const { script } = locale.maximize()\n return script ? (LANGUAGE_SCRIPT_FALLBACKS[script] ?? null) : null\n },\n { cache: new ResourceCache({ maxEntries: CACHED_LANGUAGE_TAGS }) }\n)\n\nconst LANGUAGE_SCRIPT_FALLBACKS: Partial<\n Record<string, Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>>\n> = { Hans: 'cjk-sc', Hant: 'cjk-tc', Jpan: 'cjk-jp', Kore: 'cjk-kr' }\n\nexport interface FontFallbackManifestEntry {\n script: FontFallbackScript\n localFamilies: string[]\n remoteFamilies: string[]\n}\n\nexport const ARABIC_LOCAL_FALLBACK_FAMILIES = [\n 'Noto Naskh Arabic',\n 'Noto Sans Arabic',\n 'Geeza Pro',\n 'Arial',\n 'Tahoma',\n 'Amiri'\n]\n\nexport const ARABIC_REMOTE_FALLBACK_FAMILIES = ['Noto Naskh Arabic', 'Noto Sans Arabic']\n\nexport function cjkLocalFallbackFamilies(userAgent?: string): string[] {\n if (!userAgent) return [...CJK_FALLBACK_FAMILIES_LINUX]\n if (userAgent.includes('Mac')) return [...CJK_FALLBACK_FAMILIES_MACOS]\n if (userAgent.includes('Windows')) return [...CJK_FALLBACK_FAMILIES_WINDOWS]\n return [...CJK_FALLBACK_FAMILIES_LINUX]\n}\n\nfunction platformFamilies(\n userAgent: string | undefined,\n families: Record<'mac' | 'windows' | 'linux', string[]>\n): string[] {\n if (!userAgent) return families.linux\n if (userAgent.includes('Mac')) return families.mac\n if (userAgent.includes('Windows')) return families.windows\n return families.linux\n}\n\nfunction cjkScriptLocalFallbackFamilies(\n script: Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,\n userAgent?: string\n): string[] {\n switch (script) {\n case 'cjk-tc':\n return platformFamilies(userAgent, {\n mac: ['PingFang TC', 'Heiti TC', 'PingFang SC', 'Hiragino Sans'],\n windows: ['Microsoft JhengHei', 'Microsoft YaHei', 'Microsoft YaHei UI', 'SimSun'],\n linux: ['Noto Sans CJK TC', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n case 'cjk-jp':\n return platformFamilies(userAgent, {\n mac: ['Hiragino Sans', 'PingFang SC', 'PingFang TC'],\n windows: ['Yu Gothic', 'Microsoft YaHei', 'Microsoft JhengHei'],\n linux: ['Noto Sans CJK JP', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n case 'cjk-kr':\n return platformFamilies(userAgent, {\n mac: ['Apple SD Gothic Neo', 'PingFang SC', 'Hiragino Sans'],\n windows: ['Malgun Gothic', 'Microsoft YaHei', 'Yu Gothic'],\n linux: ['Noto Sans CJK KR', 'Noto Sans CJK SC', 'Droid Sans Fallback']\n })\n default:\n return platformFamilies(userAgent, {\n mac: ['PingFang SC', 'Heiti SC', 'PingFang TC', 'Hiragino Sans'],\n windows: ['Microsoft YaHei', 'Microsoft YaHei UI', 'SimHei', 'SimSun'],\n linux: ['Noto Sans CJK SC', 'WenQuanYi Micro Hei', 'Droid Sans Fallback']\n })\n }\n}\n\n/**\n * Installed fonts that draw Hebrew, Thai, and Devanagari on each system, then the Noto family\n * Google Fonts serves for it, so text in these scripts draws without bundling their fonts.\n */\nconst LETTER_SCRIPT_FAMILIES: Record<\n Exclude<LetterFallbackScript, 'arabic'>,\n { local: Record<'mac' | 'windows' | 'linux', string[]>; remote: string[] }\n> = {\n hebrew: {\n local: {\n mac: ['Arial Hebrew', 'Lucida Grande'],\n windows: ['Segoe UI', 'Arial', 'David'],\n linux: ['Noto Sans Hebrew', 'DejaVu Sans']\n },\n remote: ['Noto Sans Hebrew']\n },\n thai: {\n local: {\n mac: ['Thonburi', 'Sukhumvit Set', 'Ayuthaya'],\n windows: ['Leelawadee UI', 'Tahoma'],\n linux: ['Noto Sans Thai', 'Loma']\n },\n remote: ['Noto Sans Thai']\n },\n devanagari: {\n local: {\n mac: ['Kohinoor Devanagari', 'Devanagari Sangam MN', 'Devanagari MT'],\n windows: ['Nirmala UI', 'Mangal'],\n linux: ['Noto Sans Devanagari', 'Lohit Devanagari']\n },\n remote: ['Noto Sans Devanagari']\n }\n}\n\nfunction letterScriptEntry(\n script: Exclude<LetterFallbackScript, 'arabic'>,\n userAgent?: string\n): FontFallbackManifestEntry {\n const families = LETTER_SCRIPT_FAMILIES[script]\n return {\n script,\n localFamilies: [...platformFamilies(userAgent, families.local)],\n remoteFamilies: [...families.remote]\n }\n}\n\nconst CJK_SCRIPT_REMOTE_FAMILIES: Record<\n Extract<FontFallbackScript, 'cjk-sc' | 'cjk-tc' | 'cjk-jp' | 'cjk-kr'>,\n string[]\n> = {\n 'cjk-sc': ['Noto Sans SC'],\n 'cjk-tc': ['Noto Sans TC', 'Noto Sans SC'],\n 'cjk-jp': ['Noto Sans JP', 'Noto Sans SC'],\n 'cjk-kr': ['Noto Sans KR', 'Noto Sans SC']\n}\n\nexport function fontFallbackManifest(\n userAgent?: string\n): Record<FontFallbackScript, FontFallbackManifestEntry> {\n return {\n cjk: {\n script: 'cjk',\n localFamilies: cjkLocalFallbackFamilies(userAgent),\n remoteFamilies: [...CJK_GOOGLE_FONTS]\n },\n 'cjk-sc': {\n script: 'cjk-sc',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-sc', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-sc']\n },\n 'cjk-tc': {\n script: 'cjk-tc',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-tc', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-tc']\n },\n 'cjk-jp': {\n script: 'cjk-jp',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-jp', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-jp']\n },\n 'cjk-kr': {\n script: 'cjk-kr',\n localFamilies: cjkScriptLocalFallbackFamilies('cjk-kr', userAgent),\n remoteFamilies: CJK_SCRIPT_REMOTE_FAMILIES['cjk-kr']\n },\n arabic: {\n script: 'arabic',\n localFamilies: [...ARABIC_LOCAL_FALLBACK_FAMILIES],\n remoteFamilies: [...ARABIC_REMOTE_FALLBACK_FAMILIES]\n },\n hebrew: letterScriptEntry('hebrew', userAgent),\n thai: letterScriptEntry('thai', userAgent),\n devanagari: letterScriptEntry('devanagari', userAgent)\n }\n}\n\nexport function fontFallbackEntry(\n script: FontFallbackScript,\n userAgent?: string\n): FontFallbackManifestEntry {\n return fontFallbackManifest(userAgent)[script]\n}\n"],"mappings":"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"}
|
|
@@ -30,6 +30,10 @@ declare class FamilyFaceCatalog {
|
|
|
30
30
|
* `null` when nothing says, so a caller offers every weight.
|
|
31
31
|
*/
|
|
32
32
|
faces(family: string): Promise<FamilyFace[] | null>;
|
|
33
|
+
/** The families the host's catalog lists. */
|
|
34
|
+
hostFamilies(): string[];
|
|
35
|
+
/** The families `faces` has found faces for so far. */
|
|
36
|
+
foundFamilies(): string[];
|
|
33
37
|
/** The faces `faces` found for a family, once it has; `undefined` before. */
|
|
34
38
|
foundFaces(family: string): FamilyFace[] | null | undefined;
|
|
35
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","names":[],"sources":["../../../src/text/font/catalog.ts"],"mappings":";;;;UASiB;EACf;EACA,gBAAgB;;;UAID;;EAEf,cAAc;;EAEd,SAAS,iBAAiB,QAAQ;;EAElC,cAAc;;;cAIH;mBAMkB;UALrB;UACA;UACA;UACA;EAEqB,YAAA,SAAS;;EAGtC,eAAe,gBAAgB;;;;;EAS/B,MAAM,iBAAiB,QAAQ;;EAe/B,WAAW,iBAAiB;;;;;;EAS5B,UAAU,iBAAiB;;EAK3B,WAAW,gBAAgB,gBAAgB;;;;;EAS3C,QAAQ;;EAMR;UAMc;;UASN;;UAQA"}
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","names":[],"sources":["../../../src/text/font/catalog.ts"],"mappings":";;;;UASiB;EACf;EACA,gBAAgB;;;UAID;;EAEf,cAAc;;EAEd,SAAS,iBAAiB,QAAQ;;EAElC,cAAc;;;cAIH;mBAMkB;UALrB;UACA;UACA;UACA;EAEqB,YAAA,SAAS;;EAGtC,eAAe,gBAAgB;;;;;EAS/B,MAAM,iBAAiB,QAAQ;;EAe/B;;EAKA;;EAKA,WAAW,iBAAiB;;;;;;EAS5B,UAAU,iBAAiB;;EAK3B,WAAW,gBAAgB,gBAAgB;;;;;EAS3C,QAAQ;;EAMR;UAMc;;UASN;;UAQA"}
|
|
@@ -31,6 +31,14 @@ var FamilyFaceCatalog = class {
|
|
|
31
31
|
}
|
|
32
32
|
return lookup;
|
|
33
33
|
}
|
|
34
|
+
/** The families the host's catalog lists. */
|
|
35
|
+
hostFamilies() {
|
|
36
|
+
return [...this.hostFaces.keys()];
|
|
37
|
+
}
|
|
38
|
+
/** The families `faces` has found faces for so far. */
|
|
39
|
+
foundFamilies() {
|
|
40
|
+
return [...this.found].filter(([, faces]) => faces?.length).map(([family]) => family);
|
|
41
|
+
}
|
|
34
42
|
/** The faces `faces` found for a family, once it has; `undefined` before. */
|
|
35
43
|
foundFaces(family) {
|
|
36
44
|
return this.found.get(family);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","names":[],"sources":["../../../src/text/font/catalog.ts"],"sourcesContent":["import {\n facesFromStyles,\n hasFamilyFace,\n standardFaces,\n type FamilyFace\n} from '#core/text/font/faces'\nimport type { FontInfo } from '#core/text/font/sources'\n\n/** A family a desktop host has installed, with its faces by the names their fonts give them. */\nexport interface HostFontFamily {\n family: string\n faces: readonly FamilyFace[]\n}\n\n/** Where a family's faces come from besides the host's catalog. */\nexport interface FamilyFaceSources {\n /** The browser's installed fonts, once listed. */\n localFonts(): FontInfo[] | null\n /** A web provider's faces for a family; none when no provider has it. */\n webFaces(family: string): Promise<FamilyFace[]>\n /** The style keys of a family's bundled faces. */\n bundledStyles(family: string): string[]\n}\n\n/** The faces each family has, as its installed, web, or bundled fonts list them. */\nexport class FamilyFaceCatalog {\n private hostFaces = new Map<string, readonly FamilyFace[]>()\n private lookups = new Map<string, Promise<FamilyFace[] | null>>()\n private found = new Map<string, FamilyFace[] | null>()\n private listeners = new Set<() => void>()\n\n constructor(private readonly sources: FamilyFaceSources) {}\n\n /** The system fonts a desktop host lists, by family, with their faces. */\n setHostCatalog(fonts: readonly HostFontFamily[]): void {\n this.hostFaces = new Map(fonts.map((font) => [font.family, [...font.faces]]))\n this.forget()\n }\n\n /**\n * The faces a family has: its installed fonts', else a web provider's, else the bundled ones;\n * `null` when nothing says, so a caller offers every weight.\n */\n faces(family: string): Promise<FamilyFace[] | null> {\n let lookup = this.lookups.get(family)\n if (!lookup) {\n const pending = this.lookUp(family).then((faces) => {\n // Faces forgotten while the lookup ran came from the sources it read before.\n if (this.lookups.get(family) === pending) this.found.set(family, faces)\n return faces\n })\n lookup = pending\n this.lookups.set(family, lookup)\n }\n return lookup\n }\n\n /** The faces `faces` found for a family, once it has; `undefined` before. */\n foundFaces(family: string): FamilyFace[] | null | undefined {\n return this.found.get(family)\n }\n\n /**\n * The faces known for a family without asking a provider: those looked up, else its installed\n * or bundled faces. A web family not looked up has none here, and its faces take Google\n * Fonts' names, which a provider would give them too.\n */\n facesSync(family: string): FamilyFace[] | null {\n return this.found.get(family) ?? this.installedFaces(family) ?? this.bundledFaces(family)\n }\n\n /** Whether a family has this face, or nothing found so far says it has not. */\n offersFace(family: string, weight: number, italic: boolean): boolean {\n const faces = this.found.get(family)\n return !faces || hasFamilyFace(faces, weight, italic)\n }\n\n /**\n * Calls the listener whenever the faces found so far are forgotten, as when the host's font\n * catalog arrives or online providers change, so a caller asks for its families again.\n */\n onReset(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n /** Forgets the faces found so far, whose sources changed. */\n forget(): void {\n this.lookups.clear()\n this.found.clear()\n for (const listener of this.listeners) listener()\n }\n\n private async lookUp(family: string): Promise<FamilyFace[] | null> {\n const installed = this.installedFaces(family)\n if (installed) return installed\n const web = await this.sources.webFaces(family)\n if (web.length > 0) return web\n return this.bundledFaces(family)\n }\n\n /** The faces of an installed family, from the host's catalog or the browser's local fonts. */\n private installedFaces(family: string): FamilyFace[] | null {\n const host = this.hostFaces.get(family)\n if (host && host.length > 0) return [...host]\n const local = this.sources.localFonts()?.filter((font) => font.family === family) ?? []\n return local.length > 0 ? facesFromStyles(local.map((font) => font.style)) : null\n }\n\n /** The bundled fonts name their faces as Google Fonts does; their keys are style keys. */\n private bundledFaces(family: string): FamilyFace[] | null {\n const styles = this.sources.bundledStyles(family)\n return styles.length > 0 ? standardFaces(styles) : null\n }\n}\n"],"mappings":";;;AAyBA,IAAa,oBAAb,MAA+B;CAMA;CAL7B,4BAAoB,IAAI,IAAmC;CAC3D,0BAAkB,IAAI,IAA0C;CAChE,wBAAgB,IAAI,IAAiC;CACrD,4BAAoB,IAAI,IAAgB;CAExC,YAAY,SAA6C;EAA5B,KAAA,UAAA;CAA6B;;CAG1D,eAAe,OAAwC;EACrD,KAAK,YAAY,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC;EAC5E,KAAK,OAAO;CACd;;;;;CAMA,MAAM,QAA8C;EAClD,IAAI,SAAS,KAAK,QAAQ,IAAI,MAAM;EACpC,IAAI,CAAC,QAAQ;GACX,MAAM,UAAU,KAAK,OAAO,MAAM,CAAC,CAAC,MAAM,UAAU;IAElD,IAAI,KAAK,QAAQ,IAAI,MAAM,MAAM,SAAS,KAAK,MAAM,IAAI,QAAQ,KAAK;IACtE,OAAO;GACT,CAAC;GACD,SAAS;GACT,KAAK,QAAQ,IAAI,QAAQ,MAAM;EACjC;EACA,OAAO;CACT;;CAGA,WAAW,QAAiD;EAC1D,OAAO,KAAK,MAAM,IAAI,MAAM;CAC9B;;;;;;CAOA,UAAU,QAAqC;EAC7C,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,eAAe,MAAM,KAAK,KAAK,aAAa,MAAM;CAC1F;;CAGA,WAAW,QAAgB,QAAgB,QAA0B;EACnE,MAAM,QAAQ,KAAK,MAAM,IAAI,MAAM;EACnC,OAAO,CAAC,SAAS,cAAc,OAAO,QAAQ,MAAM;CACtD;;;;;CAMA,QAAQ,UAAkC;EACxC,KAAK,UAAU,IAAI,QAAQ;EAC3B,aAAa,KAAK,UAAU,OAAO,QAAQ;CAC7C;;CAGA,SAAe;EACb,KAAK,QAAQ,MAAM;EACnB,KAAK,MAAM,MAAM;EACjB,KAAK,MAAM,YAAY,KAAK,WAAW,SAAS;CAClD;CAEA,MAAc,OAAO,QAA8C;EACjE,MAAM,YAAY,KAAK,eAAe,MAAM;EAC5C,IAAI,WAAW,OAAO;EACtB,MAAM,MAAM,MAAM,KAAK,QAAQ,SAAS,MAAM;EAC9C,IAAI,IAAI,SAAS,GAAG,OAAO;EAC3B,OAAO,KAAK,aAAa,MAAM;CACjC;;CAGA,eAAuB,QAAqC;EAC1D,MAAM,OAAO,KAAK,UAAU,IAAI,MAAM;EACtC,IAAI,QAAQ,KAAK,SAAS,GAAG,OAAO,CAAC,GAAG,IAAI;EAC5C,MAAM,QAAQ,KAAK,QAAQ,WAAW,CAAC,EAAE,QAAQ,SAAS,KAAK,WAAW,MAAM,KAAK,CAAC;EACtF,OAAO,MAAM,SAAS,IAAI,gBAAgB,MAAM,KAAK,SAAS,KAAK,KAAK,CAAC,IAAI;CAC/E;;CAGA,aAAqB,QAAqC;EACxD,MAAM,SAAS,KAAK,QAAQ,cAAc,MAAM;EAChD,OAAO,OAAO,SAAS,IAAI,cAAc,MAAM,IAAI;CACrD;AACF"}
|
|
1
|
+
{"version":3,"file":"catalog.js","names":[],"sources":["../../../src/text/font/catalog.ts"],"sourcesContent":["import {\n facesFromStyles,\n hasFamilyFace,\n standardFaces,\n type FamilyFace\n} from '#core/text/font/faces'\nimport type { FontInfo } from '#core/text/font/sources'\n\n/** A family a desktop host has installed, with its faces by the names their fonts give them. */\nexport interface HostFontFamily {\n family: string\n faces: readonly FamilyFace[]\n}\n\n/** Where a family's faces come from besides the host's catalog. */\nexport interface FamilyFaceSources {\n /** The browser's installed fonts, once listed. */\n localFonts(): FontInfo[] | null\n /** A web provider's faces for a family; none when no provider has it. */\n webFaces(family: string): Promise<FamilyFace[]>\n /** The style keys of a family's bundled faces. */\n bundledStyles(family: string): string[]\n}\n\n/** The faces each family has, as its installed, web, or bundled fonts list them. */\nexport class FamilyFaceCatalog {\n private hostFaces = new Map<string, readonly FamilyFace[]>()\n private lookups = new Map<string, Promise<FamilyFace[] | null>>()\n private found = new Map<string, FamilyFace[] | null>()\n private listeners = new Set<() => void>()\n\n constructor(private readonly sources: FamilyFaceSources) {}\n\n /** The system fonts a desktop host lists, by family, with their faces. */\n setHostCatalog(fonts: readonly HostFontFamily[]): void {\n this.hostFaces = new Map(fonts.map((font) => [font.family, [...font.faces]]))\n this.forget()\n }\n\n /**\n * The faces a family has: its installed fonts', else a web provider's, else the bundled ones;\n * `null` when nothing says, so a caller offers every weight.\n */\n faces(family: string): Promise<FamilyFace[] | null> {\n let lookup = this.lookups.get(family)\n if (!lookup) {\n const pending = this.lookUp(family).then((faces) => {\n // Faces forgotten while the lookup ran came from the sources it read before.\n if (this.lookups.get(family) === pending) this.found.set(family, faces)\n return faces\n })\n lookup = pending\n this.lookups.set(family, lookup)\n }\n return lookup\n }\n\n /** The families the host's catalog lists. */\n hostFamilies(): string[] {\n return [...this.hostFaces.keys()]\n }\n\n /** The families `faces` has found faces for so far. */\n foundFamilies(): string[] {\n return [...this.found].filter(([, faces]) => faces?.length).map(([family]) => family)\n }\n\n /** The faces `faces` found for a family, once it has; `undefined` before. */\n foundFaces(family: string): FamilyFace[] | null | undefined {\n return this.found.get(family)\n }\n\n /**\n * The faces known for a family without asking a provider: those looked up, else its installed\n * or bundled faces. A web family not looked up has none here, and its faces take Google\n * Fonts' names, which a provider would give them too.\n */\n facesSync(family: string): FamilyFace[] | null {\n return this.found.get(family) ?? this.installedFaces(family) ?? this.bundledFaces(family)\n }\n\n /** Whether a family has this face, or nothing found so far says it has not. */\n offersFace(family: string, weight: number, italic: boolean): boolean {\n const faces = this.found.get(family)\n return !faces || hasFamilyFace(faces, weight, italic)\n }\n\n /**\n * Calls the listener whenever the faces found so far are forgotten, as when the host's font\n * catalog arrives or online providers change, so a caller asks for its families again.\n */\n onReset(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n /** Forgets the faces found so far, whose sources changed. */\n forget(): void {\n this.lookups.clear()\n this.found.clear()\n for (const listener of this.listeners) listener()\n }\n\n private async lookUp(family: string): Promise<FamilyFace[] | null> {\n const installed = this.installedFaces(family)\n if (installed) return installed\n const web = await this.sources.webFaces(family)\n if (web.length > 0) return web\n return this.bundledFaces(family)\n }\n\n /** The faces of an installed family, from the host's catalog or the browser's local fonts. */\n private installedFaces(family: string): FamilyFace[] | null {\n const host = this.hostFaces.get(family)\n if (host && host.length > 0) return [...host]\n const local = this.sources.localFonts()?.filter((font) => font.family === family) ?? []\n return local.length > 0 ? facesFromStyles(local.map((font) => font.style)) : null\n }\n\n /** The bundled fonts name their faces as Google Fonts does; their keys are style keys. */\n private bundledFaces(family: string): FamilyFace[] | null {\n const styles = this.sources.bundledStyles(family)\n return styles.length > 0 ? standardFaces(styles) : null\n }\n}\n"],"mappings":";;;AAyBA,IAAa,oBAAb,MAA+B;CAMA;CAL7B,4BAAoB,IAAI,IAAmC;CAC3D,0BAAkB,IAAI,IAA0C;CAChE,wBAAgB,IAAI,IAAiC;CACrD,4BAAoB,IAAI,IAAgB;CAExC,YAAY,SAA6C;EAA5B,KAAA,UAAA;CAA6B;;CAG1D,eAAe,OAAwC;EACrD,KAAK,YAAY,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC;EAC5E,KAAK,OAAO;CACd;;;;;CAMA,MAAM,QAA8C;EAClD,IAAI,SAAS,KAAK,QAAQ,IAAI,MAAM;EACpC,IAAI,CAAC,QAAQ;GACX,MAAM,UAAU,KAAK,OAAO,MAAM,CAAC,CAAC,MAAM,UAAU;IAElD,IAAI,KAAK,QAAQ,IAAI,MAAM,MAAM,SAAS,KAAK,MAAM,IAAI,QAAQ,KAAK;IACtE,OAAO;GACT,CAAC;GACD,SAAS;GACT,KAAK,QAAQ,IAAI,QAAQ,MAAM;EACjC;EACA,OAAO;CACT;;CAGA,eAAyB;EACvB,OAAO,CAAC,GAAG,KAAK,UAAU,KAAK,CAAC;CAClC;;CAGA,gBAA0B;EACxB,OAAO,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,QAAQ,GAAG,WAAW,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC,YAAY,MAAM;CACtF;;CAGA,WAAW,QAAiD;EAC1D,OAAO,KAAK,MAAM,IAAI,MAAM;CAC9B;;;;;;CAOA,UAAU,QAAqC;EAC7C,OAAO,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,eAAe,MAAM,KAAK,KAAK,aAAa,MAAM;CAC1F;;CAGA,WAAW,QAAgB,QAAgB,QAA0B;EACnE,MAAM,QAAQ,KAAK,MAAM,IAAI,MAAM;EACnC,OAAO,CAAC,SAAS,cAAc,OAAO,QAAQ,MAAM;CACtD;;;;;CAMA,QAAQ,UAAkC;EACxC,KAAK,UAAU,IAAI,QAAQ;EAC3B,aAAa,KAAK,UAAU,OAAO,QAAQ;CAC7C;;CAGA,SAAe;EACb,KAAK,QAAQ,MAAM;EACnB,KAAK,MAAM,MAAM;EACjB,KAAK,MAAM,YAAY,KAAK,WAAW,SAAS;CAClD;CAEA,MAAc,OAAO,QAA8C;EACjE,MAAM,YAAY,KAAK,eAAe,MAAM;EAC5C,IAAI,WAAW,OAAO;EACtB,MAAM,MAAM,MAAM,KAAK,QAAQ,SAAS,MAAM;EAC9C,IAAI,IAAI,SAAS,GAAG,OAAO;EAC3B,OAAO,KAAK,aAAa,MAAM;CACjC;;CAGA,eAAuB,QAAqC;EAC1D,MAAM,OAAO,KAAK,UAAU,IAAI,MAAM;EACtC,IAAI,QAAQ,KAAK,SAAS,GAAG,OAAO,CAAC,GAAG,IAAI;EAC5C,MAAM,QAAQ,KAAK,QAAQ,WAAW,CAAC,EAAE,QAAQ,SAAS,KAAK,WAAW,MAAM,KAAK,CAAC;EACtF,OAAO,MAAM,SAAS,IAAI,gBAAgB,MAAM,KAAK,SAAS,KAAK,KAAK,CAAC,IAAI;CAC/E;;CAGA,aAAqB,QAAqC;EACxD,MAAM,SAAS,KAAK,QAAQ,cAAc,MAAM;EAChD,OAAO,OAAO,SAAS,IAAI,cAAc,MAAM,IAAI;CACrD;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CanvasKit, ParagraphBuilder, ParagraphStyle, TypefaceFontProvider } from "canvaskit-wasm";
|
|
2
|
+
//#region src/text/font/collection.d.ts
|
|
3
|
+
/** A paragraph builder drawing from `provider`, through the collection its paragraphs share. */
|
|
4
|
+
declare function makeParagraphBuilder(ck: CanvasKit, style: ParagraphStyle, provider: TypefaceFontProvider): ParagraphBuilder;
|
|
5
|
+
/**
|
|
6
|
+
* Lets `provider`'s next paragraph look its families up again: call it after registering a font
|
|
7
|
+
* in the provider, and before deleting the provider. Paragraphs built already keep the collection
|
|
8
|
+
* they were built with until they are deleted.
|
|
9
|
+
*/
|
|
10
|
+
declare function resetFontCollection(provider: TypefaceFontProvider): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { makeParagraphBuilder, resetFontCollection };
|
|
13
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","names":[],"sources":["../../../src/text/font/collection.ts"],"mappings":";;;iBA4BgB,qBACd,IAAI,WACJ,OAAO,gBACP,UAAU,uBACT;;;;;;iBAsBa,oBAAoB,UAAU"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/text/font/collection.ts
|
|
2
|
+
/**
|
|
3
|
+
* The font collection each provider's paragraphs are built with, made once and again only when
|
|
4
|
+
* the provider gains a font.
|
|
5
|
+
*
|
|
6
|
+
* `ParagraphBuilder.MakeFromFontProvider` makes a new collection for every paragraph, and each new
|
|
7
|
+
* collection instantiates a variable font's axes on a new typeface clone. CanvasKit keeps part of
|
|
8
|
+
* every clone, in proportion to the font's glyphs: about 64 KB a paragraph for Noto Sans SC, so a
|
|
9
|
+
* document of some 30,000 Chinese texts filled the 2 GB heap and aborted while it opened. A shared
|
|
10
|
+
* collection makes each instance once.
|
|
11
|
+
*
|
|
12
|
+
* A collection keeps the families it has looked up, the ones it did not find included, so a font
|
|
13
|
+
* registered in the provider afterwards needs a new one: {@link resetFontCollection}.
|
|
14
|
+
*
|
|
15
|
+
* Paragraphs with half leading and without it get a collection each: a collection's paragraph cache
|
|
16
|
+
* keys shaped text without its style's half leading, so a paragraph would take the line metrics of
|
|
17
|
+
* an earlier one that differs only there.
|
|
18
|
+
*/
|
|
19
|
+
const collections = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
/** A paragraph builder drawing from `provider`, through the collection its paragraphs share. */
|
|
21
|
+
function makeParagraphBuilder(ck, style, provider) {
|
|
22
|
+
const halfLeading = style.textStyle?.halfLeading ?? false;
|
|
23
|
+
let shared = collections.get(provider);
|
|
24
|
+
if (!shared) {
|
|
25
|
+
shared = /* @__PURE__ */ new Map();
|
|
26
|
+
collections.set(provider, shared);
|
|
27
|
+
}
|
|
28
|
+
let collection = shared.get(halfLeading);
|
|
29
|
+
if (!collection) {
|
|
30
|
+
collection = ck.FontCollection.Make();
|
|
31
|
+
collection.setDefaultFontManager(provider);
|
|
32
|
+
collection.enableFontFallback();
|
|
33
|
+
shared.set(halfLeading, collection);
|
|
34
|
+
}
|
|
35
|
+
return ck.ParagraphBuilder.MakeFromFontCollection(style, collection);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Lets `provider`'s next paragraph look its families up again: call it after registering a font
|
|
39
|
+
* in the provider, and before deleting the provider. Paragraphs built already keep the collection
|
|
40
|
+
* they were built with until they are deleted.
|
|
41
|
+
*/
|
|
42
|
+
function resetFontCollection(provider) {
|
|
43
|
+
const shared = collections.get(provider);
|
|
44
|
+
if (!shared) return;
|
|
45
|
+
collections.delete(provider);
|
|
46
|
+
for (const collection of shared.values()) collection.delete();
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { makeParagraphBuilder, resetFontCollection };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.js","names":[],"sources":["../../../src/text/font/collection.ts"],"sourcesContent":["import type {\n CanvasKit,\n FontCollection,\n ParagraphBuilder,\n ParagraphStyle,\n TypefaceFontProvider\n} from 'canvaskit-wasm'\n\n/**\n * The font collection each provider's paragraphs are built with, made once and again only when\n * the provider gains a font.\n *\n * `ParagraphBuilder.MakeFromFontProvider` makes a new collection for every paragraph, and each new\n * collection instantiates a variable font's axes on a new typeface clone. CanvasKit keeps part of\n * every clone, in proportion to the font's glyphs: about 64 KB a paragraph for Noto Sans SC, so a\n * document of some 30,000 Chinese texts filled the 2 GB heap and aborted while it opened. A shared\n * collection makes each instance once.\n *\n * A collection keeps the families it has looked up, the ones it did not find included, so a font\n * registered in the provider afterwards needs a new one: {@link resetFontCollection}.\n *\n * Paragraphs with half leading and without it get a collection each: a collection's paragraph cache\n * keys shaped text without its style's half leading, so a paragraph would take the line metrics of\n * an earlier one that differs only there.\n */\nconst collections = new WeakMap<TypefaceFontProvider, Map<boolean, FontCollection>>()\n\n/** A paragraph builder drawing from `provider`, through the collection its paragraphs share. */\nexport function makeParagraphBuilder(\n ck: CanvasKit,\n style: ParagraphStyle,\n provider: TypefaceFontProvider\n): ParagraphBuilder {\n const halfLeading = style.textStyle?.halfLeading ?? false\n let shared = collections.get(provider)\n if (!shared) {\n shared = new Map()\n collections.set(provider, shared)\n }\n let collection = shared.get(halfLeading)\n if (!collection) {\n collection = ck.FontCollection.Make()\n collection.setDefaultFontManager(provider)\n collection.enableFontFallback()\n shared.set(halfLeading, collection)\n }\n return ck.ParagraphBuilder.MakeFromFontCollection(style, collection)\n}\n\n/**\n * Lets `provider`'s next paragraph look its families up again: call it after registering a font\n * in the provider, and before deleting the provider. Paragraphs built already keep the collection\n * they were built with until they are deleted.\n */\nexport function resetFontCollection(provider: TypefaceFontProvider): void {\n const shared = collections.get(provider)\n if (!shared) return\n collections.delete(provider)\n for (const collection of shared.values()) collection.delete()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,8BAAc,IAAI,QAA4D;;AAGpF,SAAgB,qBACd,IACA,OACA,UACkB;CAClB,MAAM,cAAc,MAAM,WAAW,eAAe;CACpD,IAAI,SAAS,YAAY,IAAI,QAAQ;CACrC,IAAI,CAAC,QAAQ;EACX,yBAAS,IAAI,IAAI;EACjB,YAAY,IAAI,UAAU,MAAM;CAClC;CACA,IAAI,aAAa,OAAO,IAAI,WAAW;CACvC,IAAI,CAAC,YAAY;EACf,aAAa,GAAG,eAAe,KAAK;EACpC,WAAW,sBAAsB,QAAQ;EACzC,WAAW,mBAAmB;EAC9B,OAAO,IAAI,aAAa,UAAU;CACpC;CACA,OAAO,GAAG,iBAAiB,uBAAuB,OAAO,UAAU;AACrE;;;;;;AAOA,SAAgB,oBAAoB,UAAsC;CACxE,MAAM,SAAS,YAAY,IAAI,QAAQ;CACvC,IAAI,CAAC,QAAQ;CACb,YAAY,OAAO,QAAQ;CAC3B,KAAK,MAAM,cAAc,OAAO,OAAO,GAAG,WAAW,OAAO;AAC9D"}
|
|
@@ -11,7 +11,8 @@ interface FamilyFace extends FaceWeight {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The faces named by a family's style names, such as "Bold Italic" or "Semi Bold", each keeping
|
|
14
|
-
* its name. Of two names for one weight and slant, the first listed is the
|
|
14
|
+
* its name, in the order listed. Of two names for one weight and slant, the first listed is the
|
|
15
|
+
* face's, and a normal-width name ("Medium") goes before a width name ("Compressed Medium").
|
|
15
16
|
*/
|
|
16
17
|
declare function facesFromStyles(styles: readonly string[]): FamilyFace[];
|
|
17
18
|
/** A face named as Google Fonts names it, for a source that gives weights but no names. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faces.d.ts","names":[],"sources":["../../../src/text/font/faces.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"faces.d.ts","names":[],"sources":["../../../src/text/font/faces.ts"],"mappings":";;;UAUiB;EACf;EACA;;;UAIe,mBAAmB;EAClC;;;;;;;iBAQc,gBAAgB,4BAA4B;;iBAU5C,aAAa,gBAAgB,kBAAkB;;iBAK/C,cAAc,4BAA4B;iBAI1C,cAAc,gBAAgB,cAAc,gBAAgB;;;;;;iBAS5D,kBACd,gBAAgB,cAChB,gBACA,kBACC;;UAcc,oBAAoB;EACnC;EACA;EACA;;iBAGc,0BAA0B;EACxC;EACA;EACA;IACE;iBAUY,qBAAqB,gBAAgB"}
|
package/dist/text/font/faces.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { parseFontStyle, standardStyleName } from "@pairdraw/scene-graph/font-style";
|
|
2
|
-
import { uniqBy } from "es-toolkit";
|
|
1
|
+
import { namesWidth, parseFontStyle, standardStyleName } from "@pairdraw/scene-graph/font-style";
|
|
2
|
+
import { partition, uniqBy } from "es-toolkit";
|
|
3
3
|
//#region src/text/font/faces.ts
|
|
4
4
|
/**
|
|
5
5
|
* The faces named by a family's style names, such as "Bold Italic" or "Semi Bold", each keeping
|
|
6
|
-
* its name. Of two names for one weight and slant, the first listed is the
|
|
6
|
+
* its name, in the order listed. Of two names for one weight and slant, the first listed is the
|
|
7
|
+
* face's, and a normal-width name ("Medium") goes before a width name ("Compressed Medium").
|
|
7
8
|
*/
|
|
8
9
|
function facesFromStyles(styles) {
|
|
9
|
-
|
|
10
|
+
const faces = styles.map((style) => ({
|
|
10
11
|
...parseFontStyle(style),
|
|
11
12
|
style
|
|
12
|
-
}))
|
|
13
|
+
}));
|
|
14
|
+
const [normalWidth, otherWidth] = partition(faces, (face) => !namesWidth(face.style));
|
|
15
|
+
const slotFaces = new Set(uniqBy([...normalWidth, ...otherWidth], (face) => `${face.weight}${face.italic ? "i" : ""}`));
|
|
16
|
+
return faces.filter((face) => slotFaces.has(face));
|
|
13
17
|
}
|
|
14
18
|
/** A face named as Google Fonts names it, for a source that gives weights but no names. */
|
|
15
19
|
function standardFace(weight, italic) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faces.js","names":[],"sources":["../../../src/text/font/faces.ts"],"sourcesContent":["import { uniqBy } from 'es-toolkit'\n\nimport {\n parseFontStyle,\n standardStyleName,\n type ParsedFontStyle\n} from '@pairdraw/scene-graph/font-style'\n\n/** A weight, upright or italic. */\nexport interface FaceWeight {\n weight: number\n italic: boolean\n}\n\n/** One face a font family has: a weight, upright or italic, and the name its font gives it. */\nexport interface FamilyFace extends FaceWeight {\n style: string\n}\n\n/**\n * The faces named by a family's style names, such as \"Bold Italic\" or \"Semi Bold\", each keeping\n * its name. Of two names for one weight and slant, the first listed is the face's.\n */\nexport function facesFromStyles(styles: readonly string[]): FamilyFace[] {\n
|
|
1
|
+
{"version":3,"file":"faces.js","names":[],"sources":["../../../src/text/font/faces.ts"],"sourcesContent":["import { partition, uniqBy } from 'es-toolkit'\n\nimport {\n namesWidth,\n parseFontStyle,\n standardStyleName,\n type ParsedFontStyle\n} from '@pairdraw/scene-graph/font-style'\n\n/** A weight, upright or italic. */\nexport interface FaceWeight {\n weight: number\n italic: boolean\n}\n\n/** One face a font family has: a weight, upright or italic, and the name its font gives it. */\nexport interface FamilyFace extends FaceWeight {\n style: string\n}\n\n/**\n * The faces named by a family's style names, such as \"Bold Italic\" or \"Semi Bold\", each keeping\n * its name, in the order listed. Of two names for one weight and slant, the first listed is the\n * face's, and a normal-width name (\"Medium\") goes before a width name (\"Compressed Medium\").\n */\nexport function facesFromStyles(styles: readonly string[]): FamilyFace[] {\n const faces = styles.map((style) => ({ ...parseFontStyle(style), style }))\n const [normalWidth, otherWidth] = partition(faces, (face) => !namesWidth(face.style))\n const slotFaces = new Set(\n uniqBy([...normalWidth, ...otherWidth], (face) => `${face.weight}${face.italic ? 'i' : ''}`)\n )\n return faces.filter((face) => slotFaces.has(face))\n}\n\n/** A face named as Google Fonts names it, for a source that gives weights but no names. */\nexport function standardFace(weight: number, italic: boolean): FamilyFace {\n return { weight, italic, style: standardStyleName(weight, italic) }\n}\n\n/** The faces style keys stand for, named as Google Fonts names them. */\nexport function standardFaces(styles: readonly string[]): FamilyFace[] {\n return facesFromStyles(styles).map((face) => standardFace(face.weight, face.italic))\n}\n\nexport function hasFamilyFace(faces: readonly FaceWeight[], weight: number, italic: boolean) {\n return faces.some((face) => face.weight === weight && face.italic === italic)\n}\n\n/**\n * The face a text takes in a family, as Figma picks it when the family changes: the same weight\n * and slant where the family has it, otherwise the nearest weight with the same slant, or the\n * nearest weight at all in a family without that slant. Equally near weights take the lighter.\n */\nexport function nearestFamilyFace(\n faces: readonly FamilyFace[],\n weight: number,\n italic: boolean\n): FamilyFace | null {\n const sameSlant = faces.filter((face) => face.italic === italic)\n const candidates = sameSlant.length > 0 ? sameSlant : faces\n let nearest: FamilyFace | null = null\n for (const face of candidates) {\n const distance = Math.abs(face.weight - weight)\n const best = nearest ? Math.abs(nearest.weight - weight) : Infinity\n if (distance < best || (distance === best && nearest && face.weight < nearest.weight))\n nearest = face\n }\n return nearest\n}\n\n/** A face text asks the font manager for: its family, its style key, and its weight and slant. */\nexport interface FontFaceRef extends ParsedFontStyle {\n family: string\n style: string\n postscriptName?: string\n}\n\nexport function fontFaceFromFigmaFontName(fontName: {\n family?: string\n style?: string\n postscript?: string\n}): FontFaceRef {\n const style = fontName.style ?? 'Regular'\n return {\n family: fontName.family ?? 'Inter',\n style,\n postscriptName: fontName.postscript,\n ...parseFontStyle(style)\n }\n}\n\nexport function fontFaceRenderFamily(family: string, style: string): string {\n return `__pairdraw_font__${family.replace(/[^a-z0-9_-]+/giu, '_')}__${style.replace(/[^a-z0-9_-]+/giu, '_')}`\n}\n"],"mappings":";;;;;;;;AAyBA,SAAgB,gBAAgB,QAAyC;CACvE,MAAM,QAAQ,OAAO,KAAK,WAAW;EAAE,GAAG,eAAe,KAAK;EAAG;CAAM,EAAE;CACzE,MAAM,CAAC,aAAa,cAAc,UAAU,QAAQ,SAAS,CAAC,WAAW,KAAK,KAAK,CAAC;CACpF,MAAM,YAAY,IAAI,IACpB,OAAO,CAAC,GAAG,aAAa,GAAG,UAAU,IAAI,SAAS,GAAG,KAAK,SAAS,KAAK,SAAS,MAAM,IAAI,CAC7F;CACA,OAAO,MAAM,QAAQ,SAAS,UAAU,IAAI,IAAI,CAAC;AACnD;;AAGA,SAAgB,aAAa,QAAgB,QAA6B;CACxE,OAAO;EAAE;EAAQ;EAAQ,OAAO,kBAAkB,QAAQ,MAAM;CAAE;AACpE;;AAGA,SAAgB,cAAc,QAAyC;CACrE,OAAO,gBAAgB,MAAM,CAAC,CAAC,KAAK,SAAS,aAAa,KAAK,QAAQ,KAAK,MAAM,CAAC;AACrF;AAEA,SAAgB,cAAc,OAA8B,QAAgB,QAAiB;CAC3F,OAAO,MAAM,MAAM,SAAS,KAAK,WAAW,UAAU,KAAK,WAAW,MAAM;AAC9E;;;;;;AAOA,SAAgB,kBACd,OACA,QACA,QACmB;CACnB,MAAM,YAAY,MAAM,QAAQ,SAAS,KAAK,WAAW,MAAM;CAC/D,MAAM,aAAa,UAAU,SAAS,IAAI,YAAY;CACtD,IAAI,UAA6B;CACjC,KAAK,MAAM,QAAQ,YAAY;EAC7B,MAAM,WAAW,KAAK,IAAI,KAAK,SAAS,MAAM;EAC9C,MAAM,OAAO,UAAU,KAAK,IAAI,QAAQ,SAAS,MAAM,IAAI;EAC3D,IAAI,WAAW,QAAS,aAAa,QAAQ,WAAW,KAAK,SAAS,QAAQ,QAC5E,UAAU;CACd;CACA,OAAO;AACT;AASA,SAAgB,0BAA0B,UAI1B;CACd,MAAM,QAAQ,SAAS,SAAS;CAChC,OAAO;EACL,QAAQ,SAAS,UAAU;EAC3B;EACA,gBAAgB,SAAS;EACzB,GAAG,eAAe,KAAK;CACzB;AACF;AAEA,SAAgB,qBAAqB,QAAgB,OAAuB;CAC1E,OAAO,oBAAoB,OAAO,QAAQ,mBAAmB,GAAG,EAAE,IAAI,MAAM,QAAQ,mBAAmB,GAAG;AAC5G"}
|
|
@@ -52,8 +52,19 @@ interface GlyphOutlineMetrics {
|
|
|
52
52
|
type FontGlyphCoverage = 'has' | 'missing' | 'unknown';
|
|
53
53
|
declare function fontGlyphCoverageSync(family: string, style: string, char: string): FontGlyphCoverage;
|
|
54
54
|
declare function fontHasGlyphSync(family: string, style: string, char: string): boolean;
|
|
55
|
-
/**
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Each glyph HarfBuzz shapes `text` into, with its outline, pen position, and advance. A variable
|
|
57
|
+
* font shapes and draws the instance at `variations`.
|
|
58
|
+
*/
|
|
59
|
+
declare function getGlyphOutlineMetricsSync(family: string, style: string, text: string, fontSize: number, variations?: readonly FontVariation[]): GlyphOutlineMetrics[] | null;
|
|
60
|
+
/**
|
|
61
|
+
* The advance of each glyph HarfBuzz shapes `text` into and the UTF-16 index it starts at, at
|
|
62
|
+
* `fontSize` and, in a variable font, the instance at `variations`.
|
|
63
|
+
*/
|
|
64
|
+
declare function shapedAdvancesSync(family: string, style: string, text: string, fontSize: number, variations?: readonly FontVariation[]): {
|
|
65
|
+
cluster: number;
|
|
66
|
+
advance: number;
|
|
67
|
+
}[] | null;
|
|
57
68
|
/** Outlines of one loaded font, addressed by the glyph IDs a shaper produced. */
|
|
58
69
|
/** A glyph HarfBuzz shaped text into: its ID, the UTF-16 index it starts at, and its advance in em. */
|
|
59
70
|
interface ShapedGlyph {
|
|
@@ -89,5 +100,5 @@ declare function shardOutlineSources(family: string, style: string, variations?:
|
|
|
89
100
|
declare function glyphAdvanceSync(family: string, style: string, glyphId: number, fontSize: number): number | null;
|
|
90
101
|
declare function probeGlyphOutlineCommands(family: string, style: string, text: string, fontSize: number): Promise<GlyphOutlineProbe | null>;
|
|
91
102
|
//#endregion
|
|
92
|
-
export { FontDecorationMetrics, FontGlyphCoverage, GlyphOutlineMetrics, GlyphOutlineProbe, GlyphOutlineSource, type OutlineCommand, RunShaping, ShapedGlyph, fontDecorationMetricsSync, fontGlyphCoverageSync, fontHasGlyphSync, fontVerticalMetricsSync, getGlyphOutlineMetricsSync, glyphAdvanceSync, glyphIndex, glyphOutlineSourceSync, hasGlyphOutlines, measureTextWithFont, probeGlyphOutlineCommands, shardCovers, shardOutlineSources };
|
|
103
|
+
export { FontDecorationMetrics, FontGlyphCoverage, GlyphOutlineMetrics, GlyphOutlineProbe, GlyphOutlineSource, type OutlineCommand, RunShaping, ShapedGlyph, fontDecorationMetricsSync, fontGlyphCoverageSync, fontHasGlyphSync, fontVerticalMetricsSync, getGlyphOutlineMetricsSync, glyphAdvanceSync, glyphIndex, glyphOutlineSourceSync, hasGlyphOutlines, measureTextWithFont, probeGlyphOutlineCommands, shapedAdvancesSync, shardCovers, shardOutlineSources };
|
|
93
104
|
//# sourceMappingURL=glyphs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glyphs.d.ts","names":[],"sources":["../../../src/text/font/glyphs.ts"],"mappings":";;;UAmBiB;EACf;EACA;EACA;EACA;EACA,yBAAyB;;;iBAcX,YAAY,MAAM,aAAa;;iBA4B/B,WAAW,QAAQ,cAAc;;;;;;;;iBAiCjC,iBAAiB,gBAAgB;iBA4BjC,oBACd,cACA,kBACA,gBACA,eACA,mBACA;EACG;EAAe;;;;;;;;UAyBH;EACf;EACA;EACA;EACA;;;iBAIc,0BACd,gBACA,gBACC;;iBAyBa,wBACd,gBACA;EACG;EAAgB;;;UAQJ;EACf,UAAU;EACV;EACA;;KAGU;iBAEI,sBACd,gBACA,eACA,eACC;iBAMa,iBAAiB,gBAAgB,eAAe
|
|
1
|
+
{"version":3,"file":"glyphs.d.ts","names":[],"sources":["../../../src/text/font/glyphs.ts"],"mappings":";;;UAmBiB;EACf;EACA;EACA;EACA;EACA,yBAAyB;;;iBAcX,YAAY,MAAM,aAAa;;iBA4B/B,WAAW,QAAQ,cAAc;;;;;;;;iBAiCjC,iBAAiB,gBAAgB;iBA4BjC,oBACd,cACA,kBACA,gBACA,eACA,mBACA;EACG;EAAe;;;;;;;;UAyBH;EACf;EACA;EACA;EACA;;;iBAIc,0BACd,gBACA,gBACC;;iBAyBa,wBACd,gBACA;EACG;EAAgB;;;UAQJ;EACf,UAAU;EACV;EACA;;KAGU;iBAEI,sBACd,gBACA,eACA,eACC;iBAMa,iBAAiB,gBAAgB,eAAe;;;;;iBAQhD,2BACd,gBACA,eACA,cACA,kBACA,sBAAqB,kBACpB;;;;;iBAyBa,mBACd,gBACA,eACA,cACA,kBACA,sBAAqB;EAClB;EAAiB;;;;UAaL;EACf;EACA;EACA;;EAEA;EACA;;;KAIU,aAAa,KAAK;UAEb;;EAEf,OAAO;;EAEP,QAAQ;;EAER,MAAM,cAAc,SAAS,aAAa;EAC1C,QAAQ,iBAAiB,mBAAmB;;;;;;iBAO9B,uBACd,gBACA,eACA,sBAAqB,kBACpB;;;;;iBASa,oBACd,gBACA,eACA,sBAAqB,kBACpB;;iBA8Ba,iBACd,gBACA,eACA,iBACA;iBAOoB,0BACpB,gBACA,eACA,cACA,mBACC,QAAQ"}
|
package/dist/text/font/glyphs.js
CHANGED
|
@@ -140,14 +140,17 @@ function fontGlyphCoverageSync(family, style, char) {
|
|
|
140
140
|
function fontHasGlyphSync(family, style, char) {
|
|
141
141
|
return fontGlyphCoverageSync(family, style, char) === "has";
|
|
142
142
|
}
|
|
143
|
-
/**
|
|
144
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Each glyph HarfBuzz shapes `text` into, with its outline, pen position, and advance. A variable
|
|
145
|
+
* font shapes and draws the instance at `variations`.
|
|
146
|
+
*/
|
|
147
|
+
function getGlyphOutlineMetricsSync(family, style, text, fontSize, variations = []) {
|
|
145
148
|
const parsed = getParsedFont(family, style);
|
|
146
149
|
if (!parsed) return null;
|
|
147
150
|
const scale = fontSize / parsed.face.upem;
|
|
148
|
-
const instance = fontInstance(parsed,
|
|
151
|
+
const instance = fontInstance(parsed, variations);
|
|
149
152
|
let pen = 0;
|
|
150
|
-
return shapeText(parsed, text).map((glyph) => {
|
|
153
|
+
return shapeText(parsed, text, { instance }).map((glyph) => {
|
|
151
154
|
const offsetX = (glyph.xOffset ?? 0) * scale;
|
|
152
155
|
const baseline = 0 - (glyph.yOffset ?? 0) * scale;
|
|
153
156
|
const metrics = {
|
|
@@ -160,6 +163,20 @@ function getGlyphOutlineMetricsSync(family, style, text, fontSize) {
|
|
|
160
163
|
});
|
|
161
164
|
}
|
|
162
165
|
/**
|
|
166
|
+
* The advance of each glyph HarfBuzz shapes `text` into and the UTF-16 index it starts at, at
|
|
167
|
+
* `fontSize` and, in a variable font, the instance at `variations`.
|
|
168
|
+
*/
|
|
169
|
+
function shapedAdvancesSync(family, style, text, fontSize, variations = []) {
|
|
170
|
+
const parsed = getParsedFont(family, style);
|
|
171
|
+
if (!parsed) return null;
|
|
172
|
+
const scale = fontSize / parsed.face.upem;
|
|
173
|
+
const instance = fontInstance(parsed, variations);
|
|
174
|
+
return shapeText(parsed, text, { instance }).map((glyph) => ({
|
|
175
|
+
cluster: glyph.cluster,
|
|
176
|
+
advance: (glyph.xAdvance ?? 0) * scale
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
163
180
|
* Glyph outlines by glyph ID for a loaded font, or `null` when it is not loaded or cannot be
|
|
164
181
|
* parsed. A variable font draws the instance at `variations`, the axis values the shaper used.
|
|
165
182
|
*/
|
|
@@ -218,6 +235,6 @@ async function probeGlyphOutlineCommands(family, style, text, fontSize) {
|
|
|
218
235
|
};
|
|
219
236
|
}
|
|
220
237
|
//#endregion
|
|
221
|
-
export { fontDecorationMetricsSync, fontGlyphCoverageSync, fontHasGlyphSync, fontVerticalMetricsSync, getGlyphOutlineMetricsSync, glyphAdvanceSync, glyphIndex, glyphOutlineSourceSync, hasGlyphOutlines, measureTextWithFont, probeGlyphOutlineCommands, shardCovers, shardOutlineSources };
|
|
238
|
+
export { fontDecorationMetricsSync, fontGlyphCoverageSync, fontHasGlyphSync, fontVerticalMetricsSync, getGlyphOutlineMetricsSync, glyphAdvanceSync, glyphIndex, glyphOutlineSourceSync, hasGlyphOutlines, measureTextWithFont, probeGlyphOutlineCommands, shapedAdvancesSync, shardCovers, shardOutlineSources };
|
|
222
239
|
|
|
223
240
|
//# sourceMappingURL=glyphs.js.map
|