@pairdraw/core 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/effects.d.ts +5 -11
- package/dist/canvas/effects.d.ts.map +1 -1
- package/dist/canvas/effects.js +25 -30
- package/dist/canvas/effects.js.map +1 -1
- package/dist/canvas/labels/hit-test.d.ts +5 -0
- package/dist/canvas/labels/hit-test.d.ts.map +1 -1
- package/dist/canvas/labels/hit-test.js +1 -1
- package/dist/canvas/labels/hit-test.js.map +1 -1
- package/dist/canvas/labels/paragraph-cache.d.ts.map +1 -1
- package/dist/canvas/labels/paragraph-cache.js +3 -2
- package/dist/canvas/labels/paragraph-cache.js.map +1 -1
- package/dist/canvas/labels/selection.js +3 -2
- package/dist/canvas/labels/selection.js.map +1 -1
- package/dist/canvas/labels/style.d.ts +1 -1
- package/dist/canvas/node-edit-overlay.js +2 -2
- package/dist/canvas/node-edit-overlay.js.map +1 -1
- package/dist/canvas/overlays/index.d.ts +2 -2
- package/dist/canvas/overlays/index.js +2 -2
- package/dist/canvas/overlays/selection.d.ts +1 -2
- package/dist/canvas/overlays/selection.d.ts.map +1 -1
- package/dist/canvas/overlays/selection.js +4 -37
- package/dist/canvas/overlays/selection.js.map +1 -1
- package/dist/canvas/region-hatch.js +3 -2
- package/dist/canvas/region-hatch.js.map +1 -1
- package/dist/canvas/renderer/colors.d.ts.map +1 -1
- package/dist/canvas/renderer/colors.js +36 -18
- package/dist/canvas/renderer/colors.js.map +1 -1
- package/dist/canvas/renderer/font-waiters.d.ts +9 -0
- package/dist/canvas/renderer/font-waiters.d.ts.map +1 -0
- package/dist/canvas/renderer/font-waiters.js +26 -0
- package/dist/canvas/renderer/font-waiters.js.map +1 -0
- package/dist/canvas/renderer/fonts.d.ts +4 -2
- package/dist/canvas/renderer/fonts.d.ts.map +1 -1
- package/dist/canvas/renderer/fonts.js +23 -9
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer/lifecycle.d.ts.map +1 -1
- package/dist/canvas/renderer/lifecycle.js +6 -9
- package/dist/canvas/renderer/lifecycle.js.map +1 -1
- package/dist/canvas/renderer/methods.d.ts +4 -5
- package/dist/canvas/renderer/methods.d.ts.map +1 -1
- package/dist/canvas/renderer/methods.js +1 -4
- package/dist/canvas/renderer/methods.js.map +1 -1
- package/dist/canvas/renderer/paints.d.ts.map +1 -1
- package/dist/canvas/renderer/paints.js +0 -6
- package/dist/canvas/renderer/paints.js.map +1 -1
- package/dist/canvas/renderer/pipeline.d.ts.map +1 -1
- package/dist/canvas/renderer/pipeline.js +20 -2
- package/dist/canvas/renderer/pipeline.js.map +1 -1
- package/dist/canvas/renderer/retained-backing.js +4 -4
- package/dist/canvas/renderer/retained-backing.js.map +1 -1
- package/dist/canvas/renderer/state.js +1 -1
- package/dist/canvas/renderer/state.js.map +1 -1
- package/dist/canvas/renderer/tiles/controller.d.ts +2 -0
- package/dist/canvas/renderer/tiles/controller.d.ts.map +1 -1
- package/dist/canvas/renderer/tiles/controller.js +8 -0
- package/dist/canvas/renderer/tiles/controller.js.map +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js +1 -1
- package/dist/canvas/renderer/tiles/surface-pool.js.map +1 -1
- package/dist/canvas/renderer/visual-bounds.d.ts.map +1 -1
- package/dist/canvas/renderer/visual-bounds.js +7 -5
- package/dist/canvas/renderer/visual-bounds.js.map +1 -1
- package/dist/canvas/renderer.d.ts +22 -7
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +46 -11
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/rulers.d.ts +8 -1
- package/dist/canvas/rulers.d.ts.map +1 -1
- package/dist/canvas/rulers.js +30 -5
- package/dist/canvas/rulers.js.map +1 -1
- package/dist/canvas/scene.d.ts +2 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +30 -18
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/shadows/shape.js +1 -1
- package/dist/canvas/shadows/shape.js.map +1 -1
- package/dist/canvas/shadows/silhouette.d.ts.map +1 -1
- package/dist/canvas/shadows/silhouette.js +4 -2
- package/dist/canvas/shadows/silhouette.js.map +1 -1
- package/dist/canvas/shadows.d.ts.map +1 -1
- package/dist/canvas/shadows.js +3 -2
- package/dist/canvas/shadows.js.map +1 -1
- package/dist/canvas/text/derived.d.ts +1 -2
- package/dist/canvas/text/derived.d.ts.map +1 -1
- package/dist/canvas/text/derived.js +1 -7
- package/dist/canvas/text/derived.js.map +1 -1
- package/dist/canvas/text/emoji/index.js +1 -1
- package/dist/canvas/text/emoji/raster.d.ts.map +1 -1
- package/dist/canvas/text/emoji/raster.js +14 -10
- package/dist/canvas/text/emoji/raster.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +5 -2
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts +1 -3
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -8
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/layout/build.d.ts.map +1 -1
- package/dist/canvas/text/layout/build.js +25 -9
- package/dist/canvas/text/layout/build.js.map +1 -1
- package/dist/canvas/text/layout/index.d.ts.map +1 -1
- package/dist/canvas/text/layout/index.js +8 -4
- package/dist/canvas/text/layout/index.js.map +1 -1
- package/dist/canvas/text/layout/lines.js +5 -3
- package/dist/canvas/text/layout/lines.js.map +1 -1
- package/dist/canvas/text/paragraph/index.d.ts +5 -0
- package/dist/canvas/text/paragraph/index.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/index.js +16 -7
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts +1 -1
- package/dist/canvas/text/paragraph/inputs.d.ts.map +1 -1
- package/dist/canvas/text/paragraph/inputs.js +9 -2
- package/dist/canvas/text/paragraph/inputs.js.map +1 -1
- package/dist/canvas/text/placed.js +1 -1
- package/dist/canvas/text/shape.d.ts +4 -3
- package/dist/canvas/text/shape.d.ts.map +1 -1
- package/dist/canvas/text/shape.js +9 -22
- package/dist/canvas/text/shape.js.map +1 -1
- package/dist/constants.d.ts +6 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -2
- package/dist/constants.js.map +1 -1
- package/dist/editor/bridges/clipboard.d.ts +1 -0
- package/dist/editor/bridges/clipboard.js +1 -0
- package/dist/editor/bridges/clipboard.js.map +1 -1
- package/dist/editor/bridges/components.d.ts +2 -0
- package/dist/editor/bridges/components.d.ts.map +1 -1
- package/dist/editor/bridges/components.js +2 -0
- package/dist/editor/bridges/components.js.map +1 -1
- package/dist/editor/bridges/frames.d.ts +4 -3
- package/dist/editor/bridges/frames.d.ts.map +1 -1
- package/dist/editor/bridges/frames.js +6 -4
- package/dist/editor/bridges/frames.js.map +1 -1
- package/dist/editor/bridges/structure.d.ts +1 -0
- package/dist/editor/bridges/structure.d.ts.map +1 -1
- package/dist/editor/bridges/structure.js +1 -0
- package/dist/editor/bridges/structure.js.map +1 -1
- package/dist/editor/clipboard/detach.js +2 -2
- package/dist/editor/clipboard/detach.js.map +1 -1
- package/dist/editor/clipboard/paste/properties.js +1 -1
- package/dist/editor/clipboard/paste/target.js +2 -2
- package/dist/editor/clipboard/paste/target.js.map +1 -1
- package/dist/editor/clipboard/snapshot.d.ts +3 -0
- package/dist/editor/clipboard/snapshot.d.ts.map +1 -1
- package/dist/editor/clipboard/snapshot.js +2 -0
- package/dist/editor/clipboard/snapshot.js.map +1 -1
- package/dist/editor/clipboard/variables.d.ts.map +1 -1
- package/dist/editor/clipboard/variables.js +14 -1
- package/dist/editor/clipboard/variables.js.map +1 -1
- package/dist/editor/clipboard.d.ts +1 -0
- package/dist/editor/clipboard.d.ts.map +1 -1
- package/dist/editor/clipboard.js +122 -16
- package/dist/editor/clipboard.js.map +1 -1
- package/dist/editor/component-sync.d.ts +10 -1
- package/dist/editor/component-sync.d.ts.map +1 -1
- package/dist/editor/component-sync.js +25 -8
- package/dist/editor/component-sync.js.map +1 -1
- package/dist/editor/components/authoring/text-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/text-edit.js +11 -2
- package/dist/editor/components/authoring/text-edit.js.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.d.ts.map +1 -1
- package/dist/editor/components/authoring/visibility-edit.js +7 -3
- package/dist/editor/components/authoring/visibility-edit.js.map +1 -1
- package/dist/editor/components/instances.d.ts +2 -0
- package/dist/editor/components/instances.d.ts.map +1 -1
- package/dist/editor/components/instances.js +37 -7
- package/dist/editor/components/instances.js.map +1 -1
- package/dist/editor/components/properties.d.ts.map +1 -1
- package/dist/editor/components/properties.js +3 -0
- package/dist/editor/components/properties.js.map +1 -1
- package/dist/editor/components/slots/authoring.js +2 -1
- package/dist/editor/components/slots/authoring.js.map +1 -1
- package/dist/editor/components.d.ts +2 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/create.d.ts +17 -3
- package/dist/editor/create.d.ts.map +1 -1
- package/dist/editor/create.js +43 -6
- package/dist/editor/create.js.map +1 -1
- package/dist/editor/guides.d.ts.map +1 -1
- package/dist/editor/guides.js +20 -13
- package/dist/editor/guides.js.map +1 -1
- package/dist/editor/history/document-change.d.ts +19 -3
- package/dist/editor/history/document-change.d.ts.map +1 -1
- package/dist/editor/history/document-change.js +94 -8
- package/dist/editor/history/document-change.js.map +1 -1
- package/dist/editor/history/edit.d.ts.map +1 -1
- package/dist/editor/history/edit.js +56 -12
- package/dist/editor/history/edit.js.map +1 -1
- package/dist/editor/history/position.js +1 -4
- package/dist/editor/history/position.js.map +1 -1
- package/dist/editor/history/sources.d.ts +14 -0
- package/dist/editor/history/sources.d.ts.map +1 -0
- package/dist/editor/history/sources.js +24 -0
- package/dist/editor/history/sources.js.map +1 -0
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +1 -1
- package/dist/editor/layout-mode.d.ts.map +1 -1
- package/dist/editor/layout-mode.js +16 -1
- package/dist/editor/layout-mode.js.map +1 -1
- package/dist/editor/node-preview.d.ts.map +1 -1
- package/dist/editor/node-preview.js +26 -7
- package/dist/editor/node-preview.js.map +1 -1
- package/dist/editor/nodes.d.ts.map +1 -1
- package/dist/editor/nodes.js +33 -10
- package/dist/editor/nodes.js.map +1 -1
- package/dist/editor/nudge.d.ts.map +1 -1
- package/dist/editor/nudge.js +12 -2
- package/dist/editor/nudge.js.map +1 -1
- package/dist/editor/pages.d.ts +2 -1
- package/dist/editor/pages.d.ts.map +1 -1
- package/dist/editor/pages.js +94 -15
- package/dist/editor/pages.js.map +1 -1
- package/dist/editor/play/states.d.ts.map +1 -1
- package/dist/editor/play/states.js +0 -5
- package/dist/editor/play/states.js.map +1 -1
- package/dist/editor/read-only/actions.js +3 -0
- package/dist/editor/read-only/actions.js.map +1 -1
- package/dist/editor/selection/hit-test.d.ts +2 -1
- package/dist/editor/selection/hit-test.d.ts.map +1 -1
- package/dist/editor/selection/hit-test.js +29 -4
- package/dist/editor/selection/hit-test.js.map +1 -1
- package/dist/editor/selection.d.ts +2 -2
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/shapes/pen.js +6 -2
- package/dist/editor/shapes/pen.js.map +1 -1
- package/dist/editor/shapes.d.ts.map +1 -1
- package/dist/editor/shapes.js +2 -1
- package/dist/editor/shapes.js.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.d.ts.map +1 -1
- package/dist/editor/structure/auto-layout-wrap.js +12 -0
- package/dist/editor/structure/auto-layout-wrap.js.map +1 -1
- package/dist/editor/structure/boolean.js +1 -1
- package/dist/editor/structure/group/bounds.d.ts +4 -2
- package/dist/editor/structure/group/bounds.d.ts.map +1 -1
- package/dist/editor/structure/group/bounds.js +17 -4
- package/dist/editor/structure/group/bounds.js.map +1 -1
- package/dist/editor/structure/rename.d.ts +2 -3
- package/dist/editor/structure/rename.d.ts.map +1 -1
- package/dist/editor/structure/rename.js +2 -5
- package/dist/editor/structure/rename.js.map +1 -1
- package/dist/editor/structure/reorder.d.ts.map +1 -1
- package/dist/editor/structure/reorder.js +20 -9
- package/dist/editor/structure/reorder.js.map +1 -1
- package/dist/editor/structure/state.js +1 -1
- package/dist/editor/structure.d.ts +1 -0
- package/dist/editor/structure.d.ts.map +1 -1
- package/dist/editor/structure.js +76 -20
- package/dist/editor/structure.js.map +1 -1
- package/dist/editor/text/hyperlink.d.ts.map +1 -1
- package/dist/editor/text/hyperlink.js +1 -1
- package/dist/editor/text/hyperlink.js.map +1 -1
- package/dist/editor/text/name.d.ts +13 -5
- package/dist/editor/text/name.d.ts.map +1 -1
- package/dist/editor/text/name.js +47 -17
- package/dist/editor/text/name.js.map +1 -1
- package/dist/editor/text/pending-layout.d.ts +2 -1
- package/dist/editor/text/pending-layout.d.ts.map +1 -1
- package/dist/editor/text/pending-layout.js +33 -6
- package/dist/editor/text/pending-layout.js.map +1 -1
- package/dist/editor/text/selection-style.d.ts +1 -0
- package/dist/editor/text/selection-style.d.ts.map +1 -1
- package/dist/editor/text/selection-style.js +16 -4
- package/dist/editor/text/selection-style.js.map +1 -1
- package/dist/editor/text.d.ts +5 -0
- package/dist/editor/text.d.ts.map +1 -1
- package/dist/editor/text.js +70 -3
- package/dist/editor/text.js.map +1 -1
- package/dist/editor/types.d.ts +18 -1
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/editor/undo.d.ts.map +1 -1
- package/dist/editor/undo.js +14 -2
- package/dist/editor/undo.js.map +1 -1
- package/dist/editor/variable-bindings.d.ts.map +1 -1
- package/dist/editor/variable-bindings.js +21 -2
- package/dist/editor/variable-bindings.js.map +1 -1
- package/dist/editor/variables.d.ts +1 -1
- package/dist/editor/variables.d.ts.map +1 -1
- package/dist/editor/variables.js +7 -8
- package/dist/editor/variables.js.map +1 -1
- package/dist/editor/viewport.d.ts +11 -2
- package/dist/editor/viewport.d.ts.map +1 -1
- package/dist/editor/viewport.js +61 -21
- package/dist/editor/viewport.js.map +1 -1
- package/dist/editor/views/actions.d.ts.map +1 -1
- package/dist/editor/views/actions.js +13 -5
- package/dist/editor/views/actions.js.map +1 -1
- package/dist/editor/views/present.d.ts +6 -4
- package/dist/editor/views/present.d.ts.map +1 -1
- package/dist/editor/views/present.js +12 -10
- package/dist/editor/views/present.js.map +1 -1
- package/dist/editor/views/types.d.ts +11 -5
- package/dist/editor/views/types.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.d.ts.map +1 -1
- package/dist/figma-api/accessor-utils.js +4 -1
- package/dist/figma-api/accessor-utils.js.map +1 -1
- package/dist/figma-api/accessors/basic.d.ts.map +1 -1
- package/dist/figma-api/accessors/basic.js +41 -21
- package/dist/figma-api/accessors/basic.js.map +1 -1
- package/dist/figma-api/accessors/layout.d.ts.map +1 -1
- package/dist/figma-api/accessors/layout.js +37 -7
- package/dist/figma-api/accessors/layout.js.map +1 -1
- package/dist/figma-api/accessors/reactions.d.ts +11 -0
- package/dist/figma-api/accessors/reactions.d.ts.map +1 -0
- package/dist/figma-api/accessors/reactions.js +30 -0
- package/dist/figma-api/accessors/reactions.js.map +1 -0
- package/dist/figma-api/accessors/strokes.d.ts.map +1 -1
- package/dist/figma-api/accessors/strokes.js +12 -4
- package/dist/figma-api/accessors/strokes.js.map +1 -1
- package/dist/figma-api/accessors/text/index.d.ts.map +1 -1
- package/dist/figma-api/accessors/text/index.js +3 -1
- package/dist/figma-api/accessors/text/index.js.map +1 -1
- package/dist/figma-api/accessors/vector.d.ts.map +1 -1
- package/dist/figma-api/accessors/vector.js +1 -1
- package/dist/figma-api/accessors/vector.js.map +1 -1
- package/dist/figma-api/accessors/visual.d.ts +6 -5
- package/dist/figma-api/accessors/visual.d.ts.map +1 -1
- package/dist/figma-api/accessors/visual.js +20 -17
- package/dist/figma-api/accessors/visual.js.map +1 -1
- package/dist/figma-api/components.d.ts.map +1 -1
- package/dist/figma-api/components.js +2 -1
- package/dist/figma-api/components.js.map +1 -1
- package/dist/figma-api/finite.d.ts +27 -0
- package/dist/figma-api/finite.d.ts.map +1 -0
- package/dist/figma-api/finite.js +69 -0
- package/dist/figma-api/finite.js.map +1 -0
- package/dist/figma-api/fonts/list.d.ts +13 -0
- package/dist/figma-api/fonts/list.d.ts.map +1 -0
- package/dist/figma-api/fonts/list.js +25 -0
- package/dist/figma-api/fonts/list.js.map +1 -0
- package/dist/figma-api/index.d.ts +21 -3
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +58 -13
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/overrides.d.ts +6 -1
- package/dist/figma-api/overrides.d.ts.map +1 -1
- package/dist/figma-api/overrides.js +2 -2
- package/dist/figma-api/overrides.js.map +1 -1
- package/dist/figma-api/pending-layout.d.ts +12 -2
- package/dist/figma-api/pending-layout.d.ts.map +1 -1
- package/dist/figma-api/pending-layout.js +41 -1
- package/dist/figma-api/pending-layout.js.map +1 -1
- package/dist/figma-api/pending-sync.d.ts +19 -0
- package/dist/figma-api/pending-sync.d.ts.map +1 -0
- package/dist/figma-api/pending-sync.js +52 -0
- package/dist/figma-api/pending-sync.js.map +1 -0
- package/dist/figma-api/proxy.d.ts +15 -2
- package/dist/figma-api/proxy.d.ts.map +1 -1
- package/dist/figma-api/proxy.js +23 -3
- package/dist/figma-api/proxy.js.map +1 -1
- package/dist/figma-api/reactions.d.ts +104 -0
- package/dist/figma-api/reactions.d.ts.map +1 -0
- package/dist/figma-api/reactions.js +157 -0
- package/dist/figma-api/reactions.js.map +1 -0
- package/dist/figma-api/render-bounds.d.ts.map +1 -1
- package/dist/figma-api/render-bounds.js +4 -4
- package/dist/figma-api/render-bounds.js.map +1 -1
- package/dist/figma-api/serialization.js +2 -2
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/figma-api/slots.d.ts +7 -1
- package/dist/figma-api/slots.d.ts.map +1 -1
- package/dist/figma-api/slots.js +12 -4
- package/dist/figma-api/slots.js.map +1 -1
- package/dist/figma-api/strokes.d.ts +5 -2
- package/dist/figma-api/strokes.d.ts.map +1 -1
- package/dist/figma-api/strokes.js +12 -19
- package/dist/figma-api/strokes.js.map +1 -1
- package/dist/figma-api/text/bindings.js +1 -1
- package/dist/figma-api/text/index.d.ts +2 -3
- package/dist/figma-api/text/index.d.ts.map +1 -1
- package/dist/figma-api/text/index.js +2 -12
- package/dist/figma-api/text/index.js.map +1 -1
- package/dist/figma-api/variables/bindings.js +1 -1
- package/dist/figma-api/variables/variable.d.ts.map +1 -1
- package/dist/figma-api/variables/variable.js +2 -2
- package/dist/figma-api/variables/variable.js.map +1 -1
- package/dist/geometry/figma.d.ts +6 -1
- package/dist/geometry/figma.d.ts.map +1 -1
- package/dist/geometry/figma.js +8 -1
- package/dist/geometry/figma.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/index.js +2 -2
- package/dist/icons/api.d.ts +3 -2
- package/dist/icons/api.d.ts.map +1 -1
- package/dist/icons/api.js +12 -12
- package/dist/icons/api.js.map +1 -1
- package/dist/icons/provider.d.ts +4 -3
- package/dist/icons/provider.d.ts.map +1 -1
- package/dist/icons/provider.js +6 -13
- package/dist/icons/provider.js.map +1 -1
- package/dist/icons/schema.d.ts +33 -1
- package/dist/icons/schema.d.ts.map +1 -1
- package/dist/icons/schema.js +30 -1
- package/dist/icons/schema.js.map +1 -1
- package/dist/icons/svg/presentation.d.ts +8 -1
- package/dist/icons/svg/presentation.d.ts.map +1 -1
- package/dist/icons/svg/presentation.js +21 -3
- package/dist/icons/svg/presentation.js.map +1 -1
- package/dist/icons/svg/text.js +1 -1
- package/dist/icons/svg/text.js.map +1 -1
- package/dist/icons/svg.d.ts +8 -3
- package/dist/icons/svg.d.ts.map +1 -1
- package/dist/icons/svg.js +15 -13
- package/dist/icons/svg.js.map +1 -1
- package/dist/icons/types.d.ts +1 -19
- package/dist/icons/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/io/formats/design-tokens/apply.d.ts +1 -1
- package/dist/io/formats/design-tokens/css/read.js +1 -1
- package/dist/io/formats/design-tokens/decode.js +1 -1
- package/dist/io/formats/design-tokens/plan/index.js +4 -2
- package/dist/io/formats/design-tokens/plan/index.js.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/plan/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/plan/styles.js +23 -3
- package/dist/io/formats/design-tokens/plan/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/styles.d.ts +9 -1
- package/dist/io/formats/design-tokens/styles.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/styles.js +41 -4
- package/dist/io/formats/design-tokens/styles.js.map +1 -1
- package/dist/io/formats/design-tokens/types.d.ts +5 -0
- package/dist/io/formats/design-tokens/types.d.ts.map +1 -1
- package/dist/io/formats/design-tokens/types.js +1 -0
- package/dist/io/formats/design-tokens/types.js.map +1 -1
- package/dist/io/formats/fig/export/setup.d.ts.map +1 -1
- package/dist/io/formats/fig/export/setup.js +8 -4
- package/dist/io/formats/fig/export/setup.js.map +1 -1
- package/dist/io/formats/fig/export/variables.d.ts.map +1 -1
- package/dist/io/formats/fig/export/variables.js +2 -2
- package/dist/io/formats/fig/export/variables.js.map +1 -1
- package/dist/io/formats/fig/index.d.ts +2 -2
- package/dist/io/formats/fig/index.js +2 -2
- package/dist/io/formats/fig/read.d.ts +9 -2
- package/dist/io/formats/fig/read.d.ts.map +1 -1
- package/dist/io/formats/fig/read.js +44 -20
- package/dist/io/formats/fig/read.js.map +1 -1
- package/dist/io/formats/html/index.d.ts.map +1 -1
- package/dist/io/formats/html/index.js +2 -6
- package/dist/io/formats/html/index.js.map +1 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +65 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/prepare.js +1 -1
- package/dist/io/formats/pen/fonts.d.ts +14 -0
- package/dist/io/formats/pen/fonts.d.ts.map +1 -0
- package/dist/io/formats/pen/fonts.js +39 -0
- package/dist/io/formats/pen/fonts.js.map +1 -0
- package/dist/io/formats/pen/index.d.ts.map +1 -1
- package/dist/io/formats/pen/index.js +25 -6
- package/dist/io/formats/pen/index.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +24 -13
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/index.d.ts +2 -2
- package/dist/io/formats/raster/index.js +2 -2
- package/dist/io/formats/raster/render.d.ts +7 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +40 -6
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats/svg/export.d.ts.map +1 -1
- package/dist/io/formats/svg/export.js +28 -24
- package/dist/io/formats/svg/export.js.map +1 -1
- package/dist/io/formats/svg/paths.d.ts +8 -2
- package/dist/io/formats/svg/paths.d.ts.map +1 -1
- package/dist/io/formats/svg/paths.js +11 -3
- package/dist/io/formats/svg/paths.js.map +1 -1
- package/dist/io/formats/svg/strokes.d.ts.map +1 -1
- package/dist/io/formats/svg/strokes.js +2 -5
- package/dist/io/formats/svg/strokes.js.map +1 -1
- package/dist/io/formats/svg/text/export.d.ts.map +1 -1
- package/dist/io/formats/svg/text/export.js +19 -1
- package/dist/io/formats/svg/text/export.js.map +1 -1
- package/dist/io/formats/svg/text/import.d.ts.map +1 -1
- package/dist/io/formats/svg/text/import.js +2 -1
- package/dist/io/formats/svg/text/import.js.map +1 -1
- package/dist/io/subgraph.d.ts.map +1 -1
- package/dist/io/subgraph.js +5 -2
- package/dist/io/subgraph.js.map +1 -1
- package/dist/kiwi/fig/population/client.d.ts.map +1 -1
- package/dist/kiwi/fig/population/client.js +63 -45
- package/dist/kiwi/fig/population/client.js.map +1 -1
- package/dist/kiwi/fig/population/delta.d.ts +34 -3
- package/dist/kiwi/fig/population/delta.d.ts.map +1 -1
- package/dist/kiwi/fig/population/delta.js +99 -16
- package/dist/kiwi/fig/population/delta.js.map +1 -1
- package/dist/kiwi/fig/population/edits.d.ts +51 -0
- package/dist/kiwi/fig/population/edits.d.ts.map +1 -0
- package/dist/kiwi/fig/population/edits.js +169 -0
- package/dist/kiwi/fig/population/edits.js.map +1 -0
- package/dist/kiwi/fig/session/archive/access.d.ts +3 -0
- package/dist/kiwi/fig/session/archive/access.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/access.js +8 -1
- package/dist/kiwi/fig/session/archive/access.js.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts +2 -1
- package/dist/kiwi/fig/session/archive/changes.d.ts.map +1 -1
- package/dist/kiwi/fig/session/archive/changes.js +12 -5
- package/dist/kiwi/fig/session/archive/changes.js.map +1 -1
- package/dist/kiwi/fig/session/document-state.d.ts +7 -1
- package/dist/kiwi/fig/session/document-state.d.ts.map +1 -1
- package/dist/kiwi/fig/session/document-state.js +16 -2
- package/dist/kiwi/fig/session/document-state.js.map +1 -1
- package/dist/kiwi/fig/session/protocol.d.ts +31 -3
- package/dist/kiwi/fig/session/protocol.d.ts.map +1 -1
- package/dist/kiwi/fig/session/worker.js +33 -8
- package/dist/kiwi/fig/session/worker.js.map +1 -1
- package/dist/layout/apply.d.ts +6 -1
- package/dist/layout/apply.d.ts.map +1 -1
- package/dist/layout/apply.js +39 -14
- package/dist/layout/apply.js.map +1 -1
- package/dist/layout/arrange/boxes.d.ts.map +1 -1
- package/dist/layout/arrange/boxes.js +31 -0
- package/dist/layout/arrange/boxes.js.map +1 -1
- package/dist/layout/flow-edges.d.ts +26 -0
- package/dist/layout/flow-edges.d.ts.map +1 -0
- package/dist/layout/flow-edges.js +105 -0
- package/dist/layout/flow-edges.js.map +1 -0
- package/dist/layout/grid.d.ts.map +1 -1
- package/dist/layout/grid.js +9 -5
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/text-auto-resize.d.ts.map +1 -1
- package/dist/layout/text-auto-resize.js +9 -4
- package/dist/layout/text-auto-resize.js.map +1 -1
- package/dist/layout/text-measurement.d.ts +15 -1
- package/dist/layout/text-measurement.d.ts.map +1 -1
- package/dist/layout/text-measurement.js +40 -4
- package/dist/layout/text-measurement.js.map +1 -1
- package/dist/layout/variables.d.ts +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +35 -35
- package/dist/layout.js.map +1 -1
- package/dist/library/asset-keys.d.ts +3 -2
- package/dist/library/asset-keys.d.ts.map +1 -1
- package/dist/library/asset-keys.js +4 -3
- package/dist/library/asset-keys.js.map +1 -1
- package/dist/library/copied-references.d.ts +8 -3
- package/dist/library/copied-references.d.ts.map +1 -1
- package/dist/library/copied-references.js +15 -5
- package/dist/library/copied-references.js.map +1 -1
- package/dist/library/materialize.js +1 -1
- package/dist/library/materialize.js.map +1 -1
- package/dist/library/schema.js.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +10 -2
- package/dist/library/snapshot.js.map +1 -1
- package/dist/pairdraw-api/variables.d.ts.map +1 -1
- package/dist/pairdraw-api/variables.js +0 -2
- package/dist/pairdraw-api/variables.js.map +1 -1
- package/dist/profiler/hud-controller.d.ts +4 -3
- package/dist/profiler/hud-controller.d.ts.map +1 -1
- package/dist/profiler/hud-controller.js +7 -5
- package/dist/profiler/hud-controller.js.map +1 -1
- package/dist/profiler/hud-renderer.d.ts +5 -2
- package/dist/profiler/hud-renderer.d.ts.map +1 -1
- package/dist/profiler/hud-renderer.js +8 -5
- package/dist/profiler/hud-renderer.js.map +1 -1
- package/dist/profiler/render-profiler.d.ts +3 -2
- package/dist/profiler/render-profiler.d.ts.map +1 -1
- package/dist/profiler/render-profiler.js +3 -2
- package/dist/profiler/render-profiler.js.map +1 -1
- package/dist/text/character-style.d.ts +11 -1
- package/dist/text/character-style.d.ts.map +1 -1
- package/dist/text/character-style.js +27 -5
- package/dist/text/character-style.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +15 -16
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/editor.d.ts.map +1 -1
- package/dist/text/editor.js +3 -8
- package/dist/text/editor.js.map +1 -1
- package/dist/text/fallbacks.d.ts +19 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +63 -12
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/catalog.d.ts +4 -0
- package/dist/text/font/catalog.d.ts.map +1 -1
- package/dist/text/font/catalog.js +8 -0
- package/dist/text/font/catalog.js.map +1 -1
- package/dist/text/font/collection.d.ts +13 -0
- package/dist/text/font/collection.d.ts.map +1 -0
- package/dist/text/font/collection.js +51 -0
- package/dist/text/font/collection.js.map +1 -0
- package/dist/text/font/faces.d.ts +2 -1
- package/dist/text/font/faces.d.ts.map +1 -1
- package/dist/text/font/faces.js +9 -5
- package/dist/text/font/faces.js.map +1 -1
- package/dist/text/font/glyphs.d.ts +14 -3
- package/dist/text/font/glyphs.d.ts.map +1 -1
- package/dist/text/font/glyphs.js +22 -5
- package/dist/text/font/glyphs.js.map +1 -1
- package/dist/text/font/local.js +2 -2
- package/dist/text/font/local.js.map +1 -1
- package/dist/text/font/manager.d.ts +36 -0
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +139 -19
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/font/style.d.ts +7 -2
- package/dist/text/font/style.d.ts.map +1 -1
- package/dist/text/font/style.js +31 -3
- package/dist/text/font/style.js.map +1 -1
- package/dist/text/index.d.ts +5 -4
- package/dist/text/index.js +5 -4
- package/dist/text/outlines.d.ts.map +1 -1
- package/dist/text/outlines.js +70 -70
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +7 -1
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/style-runs.d.ts +14 -2
- package/dist/text/style-runs.d.ts.map +1 -1
- package/dist/text/style-runs.js +22 -14
- package/dist/text/style-runs.js.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/helpers.js +9 -1
- package/dist/tools/analyze/overlaps/helpers.js.map +1 -1
- package/dist/tools/analyze/overlaps/index.d.ts.map +1 -1
- package/dist/tools/analyze/overlaps/index.js +27 -5
- package/dist/tools/analyze/overlaps/index.js.map +1 -1
- package/dist/tools/codegen/component-map.js +3 -3
- package/dist/tools/codegen/component-map.js.map +1 -1
- package/dist/tools/create/basic.d.ts.map +1 -1
- package/dist/tools/create/basic.js +5 -4
- package/dist/tools/create/basic.js.map +1 -1
- package/dist/tools/create/html.d.ts.map +1 -1
- package/dist/tools/create/html.js +4 -2
- package/dist/tools/create/html.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +3 -1
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/mermaid.d.ts.map +1 -1
- package/dist/tools/create/mermaid.js +2 -0
- package/dist/tools/create/mermaid.js.map +1 -1
- package/dist/tools/create/render.d.ts.map +1 -1
- package/dist/tools/create/render.js +2 -0
- package/dist/tools/create/render.js.map +1 -1
- package/dist/tools/create/script.js +3 -1
- package/dist/tools/create/script.js.map +1 -1
- package/dist/tools/create/svg.d.ts.map +1 -1
- package/dist/tools/create/svg.js +4 -1
- package/dist/tools/create/svg.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +4 -4
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/image-ai/apply.js +1 -1
- package/dist/tools/image-ai/generate.d.ts.map +1 -1
- package/dist/tools/image-ai/generate.js +3 -0
- package/dist/tools/image-ai/generate.js.map +1 -1
- package/dist/tools/modify/matching.js +1 -1
- package/dist/tools/modify/reactions.d.ts +6 -0
- package/dist/tools/modify/reactions.d.ts.map +1 -0
- package/dist/tools/modify/reactions.js +35 -0
- package/dist/tools/modify/reactions.js.map +1 -0
- package/dist/tools/modify.d.ts +2 -1
- package/dist/tools/modify.js +2 -1
- package/dist/tools/read/components.js +20 -22
- package/dist/tools/read/components.js.map +1 -1
- package/dist/tools/read/fonts.js +1 -1
- package/dist/tools/read/fonts.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +2 -0
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/nodes.d.ts.map +1 -1
- package/dist/tools/read/nodes.js +38 -16
- package/dist/tools/read/nodes.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js +4 -3
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/read/query.js +1 -0
- package/dist/tools/read/query.js.map +1 -1
- package/dist/tools/read/reactions.d.ts +6 -0
- package/dist/tools/read/reactions.d.ts.map +1 -0
- package/dist/tools/read/reactions.js +24 -0
- package/dist/tools/read/reactions.js.map +1 -0
- package/dist/tools/read/space.js +1 -1
- package/dist/tools/read.d.ts +2 -1
- package/dist/tools/read.js +2 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +4 -0
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +6 -0
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +53 -9
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/stock-photo/apply.js +8 -9
- package/dist/tools/stock-photo/apply.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +85 -90
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/vector/fill-geometry.d.ts +4 -1
- package/dist/vector/fill-geometry.d.ts.map +1 -1
- package/dist/vector/fill-geometry.js +8 -5
- package/dist/vector/fill-geometry.js.map +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/index.js.map +1 -1
- package/dist/vector/path-helpers.d.ts +1 -1
- package/dist/vector/path-helpers.d.ts.map +1 -1
- package/dist/vector/path-helpers.js +24 -7
- package/dist/vector/path-helpers.js.map +1 -1
- package/dist/vector/placement.js +1 -1
- package/dist/vector/placement.js.map +1 -1
- package/dist/vector/vectorize/preprocess.js +1 -1
- package/dist/vector/vectorize/preprocess.js.map +1 -1
- package/package.json +10 -10
- package/src/canvas/effects.ts +29 -33
- package/src/canvas/labels/hit-test.ts +6 -2
- package/src/canvas/labels/paragraph-cache.ts +2 -1
- package/src/canvas/labels/selection.ts +3 -3
- package/src/canvas/node-edit-overlay.ts +3 -2
- package/src/canvas/overlays/index.ts +0 -1
- package/src/canvas/overlays/selection.ts +4 -52
- package/src/canvas/region-hatch.ts +7 -2
- package/src/canvas/renderer/colors.ts +41 -26
- package/src/canvas/renderer/font-waiters.ts +25 -0
- package/src/canvas/renderer/fonts.ts +40 -17
- package/src/canvas/renderer/lifecycle.ts +8 -10
- package/src/canvas/renderer/methods.ts +9 -13
- package/src/canvas/renderer/paints.ts +0 -10
- package/src/canvas/renderer/pipeline.ts +29 -3
- package/src/canvas/renderer/retained-backing.ts +4 -4
- package/src/canvas/renderer/state.ts +1 -1
- package/src/canvas/renderer/tiles/controller.ts +8 -0
- package/src/canvas/renderer/tiles/surface-pool.ts +1 -1
- package/src/canvas/renderer/visual-bounds.ts +7 -6
- package/src/canvas/renderer.ts +39 -11
- package/src/canvas/rulers.ts +55 -26
- package/src/canvas/scene.ts +37 -16
- package/src/canvas/shadows/shape.ts +1 -1
- package/src/canvas/shadows/silhouette.ts +4 -2
- package/src/canvas/shadows.ts +4 -2
- package/src/canvas/text/derived.ts +0 -9
- package/src/canvas/text/emoji/raster.ts +14 -10
- package/src/canvas/text/font-families.ts +6 -0
- package/src/canvas/text/index.ts +0 -8
- package/src/canvas/text/layout/build.ts +35 -18
- package/src/canvas/text/layout/index.ts +15 -6
- package/src/canvas/text/layout/lines.ts +10 -4
- package/src/canvas/text/paragraph/index.ts +17 -8
- package/src/canvas/text/paragraph/inputs.ts +4 -2
- package/src/canvas/text/shape.ts +20 -31
- package/src/constants.ts +6 -1
- package/src/editor/bridges/clipboard.ts +1 -0
- package/src/editor/bridges/components.ts +2 -0
- package/src/editor/bridges/frames.ts +6 -4
- package/src/editor/bridges/structure.ts +1 -0
- package/src/editor/clipboard/detach.ts +3 -3
- package/src/editor/clipboard/paste/target.ts +2 -2
- package/src/editor/clipboard/snapshot.ts +7 -0
- package/src/editor/clipboard/variables.ts +20 -0
- package/src/editor/clipboard.ts +133 -14
- package/src/editor/component-sync.ts +28 -7
- package/src/editor/components/authoring/text-edit.ts +15 -2
- package/src/editor/components/authoring/visibility-edit.ts +11 -3
- package/src/editor/components/instances.ts +61 -11
- package/src/editor/components/properties.ts +10 -0
- package/src/editor/components/slots/authoring.ts +4 -1
- package/src/editor/create.ts +58 -8
- package/src/editor/guides.ts +27 -12
- package/src/editor/history/document-change.ts +115 -7
- package/src/editor/history/edit.ts +62 -14
- package/src/editor/history/position.ts +1 -4
- package/src/editor/history/sources.ts +25 -0
- package/src/editor/index.ts +3 -1
- package/src/editor/layout-mode.ts +20 -1
- package/src/editor/node-preview.ts +44 -8
- package/src/editor/nodes.ts +52 -12
- package/src/editor/nudge.ts +16 -2
- package/src/editor/pages.ts +100 -17
- package/src/editor/play/states.ts +0 -7
- package/src/editor/read-only/actions.ts +4 -0
- package/src/editor/selection/hit-test.ts +37 -4
- package/src/editor/shapes/pen.ts +6 -3
- package/src/editor/shapes.ts +2 -1
- package/src/editor/structure/auto-layout-wrap.ts +26 -0
- package/src/editor/structure/group/bounds.ts +22 -4
- package/src/editor/structure/rename.ts +2 -6
- package/src/editor/structure/reorder.ts +26 -8
- package/src/editor/structure.ts +88 -24
- package/src/editor/text/hyperlink.ts +2 -1
- package/src/editor/text/name.ts +51 -15
- package/src/editor/text/pending-layout.ts +42 -4
- package/src/editor/text/selection-style.ts +17 -3
- package/src/editor/text.ts +86 -4
- package/src/editor/types.ts +19 -0
- package/src/editor/undo.ts +21 -2
- package/src/editor/variable-bindings.ts +22 -2
- package/src/editor/variables.ts +10 -6
- package/src/editor/viewport.ts +55 -21
- package/src/editor/views/actions.ts +17 -7
- package/src/editor/views/present.ts +20 -11
- package/src/editor/views/types.ts +11 -5
- package/src/figma-api/accessor-utils.ts +4 -1
- package/src/figma-api/accessors/basic.ts +54 -18
- package/src/figma-api/accessors/layout.ts +46 -7
- package/src/figma-api/accessors/reactions.ts +29 -0
- package/src/figma-api/accessors/strokes.ts +28 -8
- package/src/figma-api/accessors/text/index.ts +4 -0
- package/src/figma-api/accessors/vector.ts +3 -1
- package/src/figma-api/accessors/visual.ts +25 -28
- package/src/figma-api/components.ts +9 -7
- package/src/figma-api/finite.ts +102 -0
- package/src/figma-api/fonts/list.ts +24 -0
- package/src/figma-api/index.ts +82 -12
- package/src/figma-api/overrides.ts +1 -1
- package/src/figma-api/pending-layout.ts +50 -1
- package/src/figma-api/pending-sync.ts +61 -0
- package/src/figma-api/proxy.ts +35 -2
- package/src/figma-api/reactions.ts +212 -0
- package/src/figma-api/render-bounds.ts +13 -4
- package/src/figma-api/serialization.ts +2 -2
- package/src/figma-api/slots.ts +12 -3
- package/src/figma-api/strokes.ts +16 -12
- package/src/figma-api/text/index.ts +9 -15
- package/src/figma-api/variables/variable.ts +3 -2
- package/src/geometry/figma.ts +9 -0
- package/src/geometry/index.ts +1 -0
- package/src/global.d.ts +6 -0
- package/src/icons/api.ts +27 -16
- package/src/icons/provider.ts +9 -20
- package/src/icons/schema.ts +31 -0
- package/src/icons/svg/presentation.ts +27 -3
- package/src/icons/svg/text.ts +1 -1
- package/src/icons/svg.ts +21 -19
- package/src/icons/types.ts +0 -14
- package/src/io/formats/design-tokens/plan/index.ts +7 -1
- package/src/io/formats/design-tokens/plan/styles.ts +40 -4
- package/src/io/formats/design-tokens/styles.ts +60 -3
- package/src/io/formats/design-tokens/types.ts +3 -0
- package/src/io/formats/fig/export/setup.ts +16 -14
- package/src/io/formats/fig/export/variables.ts +7 -8
- package/src/io/formats/fig/index.ts +1 -0
- package/src/io/formats/fig/read.ts +66 -23
- package/src/io/formats/html/index.ts +2 -6
- package/src/io/formats/pdf/dom.ts +96 -3
- package/src/io/formats/pen/fonts.ts +45 -0
- package/src/io/formats/pen/index.ts +30 -6
- package/src/io/formats/raster/headless.ts +31 -12
- package/src/io/formats/raster/index.ts +3 -0
- package/src/io/formats/raster/render.ts +62 -6
- package/src/io/formats/svg/export.ts +24 -25
- package/src/io/formats/svg/paths.ts +11 -2
- package/src/io/formats/svg/strokes.ts +8 -2
- package/src/io/formats/svg/text/export.ts +23 -0
- package/src/io/formats/svg/text/import.ts +2 -1
- package/src/io/subgraph.ts +3 -1
- package/src/kiwi/fig/population/client.ts +77 -43
- package/src/kiwi/fig/population/delta.ts +141 -18
- package/src/kiwi/fig/population/edits.ts +235 -0
- package/src/kiwi/fig/session/archive/access.ts +15 -0
- package/src/kiwi/fig/session/archive/changes.ts +27 -6
- package/src/kiwi/fig/session/document-state.ts +23 -1
- package/src/kiwi/fig/session/protocol.ts +26 -1
- package/src/kiwi/fig/session/worker.ts +38 -11
- package/src/layout/apply.ts +52 -10
- package/src/layout/arrange/boxes.ts +36 -0
- package/src/layout/flow-edges.ts +139 -0
- package/src/layout/grid.ts +14 -4
- package/src/layout/text-auto-resize.ts +13 -4
- package/src/layout/text-measurement.ts +46 -3
- package/src/layout.ts +60 -66
- package/src/library/asset-keys.ts +4 -3
- package/src/library/copied-references.ts +29 -5
- package/src/library/materialize.ts +1 -1
- package/src/library/schema.ts +1 -1
- package/src/library/snapshot.ts +11 -2
- package/src/pairdraw-api/variables.ts +1 -3
- package/src/profiler/hud-controller.ts +8 -6
- package/src/profiler/hud-renderer.ts +9 -6
- package/src/profiler/render-profiler.ts +4 -3
- package/src/text/character-style.ts +29 -9
- package/src/text/coverage.ts +17 -18
- package/src/text/editor.ts +3 -8
- package/src/text/fallbacks.ts +82 -15
- package/src/text/font/catalog.ts +10 -0
- package/src/text/font/collection.ts +60 -0
- package/src/text/font/faces.ts +9 -5
- package/src/text/font/glyphs.ts +29 -4
- package/src/text/font/local.ts +2 -2
- package/src/text/font/manager.ts +170 -32
- package/src/text/font/style.ts +52 -3
- package/src/text/index.ts +1 -0
- package/src/text/outlines.ts +105 -89
- package/src/text/prepare.ts +17 -0
- package/src/text/style-runs.ts +43 -16
- package/src/tools/analyze/overlaps/helpers.ts +18 -1
- package/src/tools/analyze/overlaps/index.ts +37 -6
- package/src/tools/codegen/component-map.ts +3 -3
- package/src/tools/create/basic.ts +6 -4
- package/src/tools/create/html.ts +3 -1
- package/src/tools/create/icons.ts +3 -1
- package/src/tools/create/mermaid.ts +2 -0
- package/src/tools/create/render.ts +2 -0
- package/src/tools/create/script.ts +5 -1
- package/src/tools/create/svg.ts +4 -1
- package/src/tools/create/vector.ts +4 -4
- package/src/tools/image-ai/generate.ts +3 -0
- package/src/tools/modify/reactions.ts +40 -0
- package/src/tools/modify.ts +1 -0
- package/src/tools/read/components.ts +28 -25
- package/src/tools/read/fonts.ts +1 -1
- package/src/tools/read/libraries.ts +3 -0
- package/src/tools/read/nodes.ts +47 -17
- package/src/tools/read/pages.ts +7 -4
- package/src/tools/read/query.ts +2 -0
- package/src/tools/read/reactions.ts +21 -0
- package/src/tools/read.ts +1 -0
- package/src/tools/registry/extended.ts +4 -0
- package/src/tools/schema.ts +68 -12
- package/src/tools/stock-photo/apply.ts +17 -5
- package/src/tools/structure/batch.ts +82 -101
- package/src/vector/fill-geometry.ts +11 -5
- package/src/vector/index.ts +1 -1
- package/src/vector/path-helpers.ts +34 -8
- package/src/vector/placement.ts +1 -1
- package/src/vector/vectorize/preprocess.ts +1 -1
package/dist/geometry/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { figmaRotation, panelPosition, panelPositionChange, panelRotation, panelRotationChange } from "./figma.js";
|
|
1
|
+
import { figmaRotation, panelNumber, panelPosition, panelPositionChange, panelRotation, panelRotationChange } from "./figma.js";
|
|
2
2
|
import { LineSegment, RotationPreview, ViewportTransform } from "./types.js";
|
|
3
3
|
import { SceneGeometry, createSceneGeometry, nodeOrientationMatrix, projectedNode, viewportMatrix } from "./scene.js";
|
|
4
4
|
import { ARC_HANDLE, ArcField, ArcHandleKind, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, isWholeArc } from "./handles/arc.js";
|
|
@@ -9,4 +9,4 @@ import { CropResizeOptions, IMAGE_CROP_GHOST_ALPHA, IMAGE_CROP_HANDLE, ImageCrop
|
|
|
9
9
|
import { CONNECTOR_SEGMENT_HANDLE, ConnectorRouteHandle, connectorRouteHandles, connectorScreenEnds, connectorScreenLabel } from "./connectors.js";
|
|
10
10
|
import { LineEnd, aimLine, draggedLineEnds, isLineLike, lineEndPoints, lineWorldEnds } from "./line-ends.js";
|
|
11
11
|
import { RotationHandleLayout, rotationHandleLayout, selectionHandleRect, selectionPath } from "./selection.js";
|
|
12
|
-
export { ARC_HANDLE, type ArcField, type ArcHandleKind, CONNECTOR_SEGMENT_HANDLE, type ConnectorRouteHandle, type CornerPosition, type CropResizeOptions, GRADIENT_HANDLE, type GradientHandle, type GradientHandleLayout, type GradientHandles, type GradientHit, type GradientStopLayout, type HandlePosition, IMAGE_CROP_GHOST_ALPHA, IMAGE_CROP_HANDLE, type ImageCropCorner, type ImageCropHit, type ImageCropLayout, type ImageCropQuad, type ImageScaleOptions, type LineEnd, type LineSegment, type RadiusCorner, type RotationHandleLayout, type RotationPreview, SHAPE_HANDLE, type SceneGeometry, type ShapeHandle, type ShapeHandleKind, TRANSFORM_ZONE, type TransformZone, type ViewportTransform, aimLine, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, connectorRouteHandles, connectorScreenEnds, connectorScreenLabel, cornerRadii, cornerRadiusAtPoint, cornerRadiusChanges, cornerRadiusOf, coveringImageBounds, createSceneGeometry, croppedImageTransform, draggedLineEnds, dragsSingleCorner, figmaRotation, gradientHandleLayout, gradientHandles, gradientStopPoint, gradientStopPosition, hasShapeHandles, hasTransformHandles, hitTestGradientHandles, hitTestImageCrop, hitTestShapeHandles, imageCropHandles, imageCropHitDirection, imageCropLayout, imageCropQuad, imageTransformFromLocalMatrix, isArcHandle, isLineLike, isRadiusHandle, isWholeArc, lineEndPoints, lineWorldEnds, moveGradientHandle, nodeOrientationMatrix, panelPosition, panelPositionChange, panelRotation, panelRotationChange, pannedImageTransform, pointCountAtPoint, pressesTinyLayer, projectedNode, quadContains, resizedCropRect, rotationHandleLayout, scaledImageTransform, selectionHandleRect, selectionPath, shapeHandleLayout, shapeHandleValue, starRatioAtPoint, transformZoneAt, viewportMatrix };
|
|
12
|
+
export { ARC_HANDLE, type ArcField, type ArcHandleKind, CONNECTOR_SEGMENT_HANDLE, type ConnectorRouteHandle, type CornerPosition, type CropResizeOptions, GRADIENT_HANDLE, type GradientHandle, type GradientHandleLayout, type GradientHandles, type GradientHit, type GradientStopLayout, type HandlePosition, IMAGE_CROP_GHOST_ALPHA, IMAGE_CROP_HANDLE, type ImageCropCorner, type ImageCropHit, type ImageCropLayout, type ImageCropQuad, type ImageScaleOptions, type LineEnd, type LineSegment, type RadiusCorner, type RotationHandleLayout, type RotationPreview, SHAPE_HANDLE, type SceneGeometry, type ShapeHandle, type ShapeHandleKind, TRANSFORM_ZONE, type TransformZone, type ViewportTransform, aimLine, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, connectorRouteHandles, connectorScreenEnds, connectorScreenLabel, cornerRadii, cornerRadiusAtPoint, cornerRadiusChanges, cornerRadiusOf, coveringImageBounds, createSceneGeometry, croppedImageTransform, draggedLineEnds, dragsSingleCorner, figmaRotation, gradientHandleLayout, gradientHandles, gradientStopPoint, gradientStopPosition, hasShapeHandles, hasTransformHandles, hitTestGradientHandles, hitTestImageCrop, hitTestShapeHandles, imageCropHandles, imageCropHitDirection, imageCropLayout, imageCropQuad, imageTransformFromLocalMatrix, isArcHandle, isLineLike, isRadiusHandle, isWholeArc, lineEndPoints, lineWorldEnds, moveGradientHandle, nodeOrientationMatrix, panelNumber, panelPosition, panelPositionChange, panelRotation, panelRotationChange, pannedImageTransform, pointCountAtPoint, pressesTinyLayer, projectedNode, quadContains, resizedCropRect, rotationHandleLayout, scaledImageTransform, selectionHandleRect, selectionPath, shapeHandleLayout, shapeHandleValue, starRatioAtPoint, transformZoneAt, viewportMatrix };
|
package/dist/geometry/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { figmaRotation, panelPosition, panelPositionChange, panelRotation, panelRotationChange } from "./figma.js";
|
|
1
|
+
import { figmaRotation, panelNumber, panelPosition, panelPositionChange, panelRotation, panelRotationChange } from "./figma.js";
|
|
2
2
|
import { ARC_HANDLE, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, isWholeArc } from "./handles/arc.js";
|
|
3
3
|
import { SHAPE_HANDLE, cornerRadii, cornerRadiusAtPoint, cornerRadiusChanges, cornerRadiusOf, dragsSingleCorner, hasShapeHandles, hitTestShapeHandles, isArcHandle, isRadiusHandle, pointCountAtPoint, shapeHandleLayout, shapeHandleValue, starRatioAtPoint } from "./handles/shape.js";
|
|
4
4
|
import { GRADIENT_HANDLE, gradientHandleLayout, gradientHandles, gradientStopPoint, gradientStopPosition, hitTestGradientHandles, moveGradientHandle } from "./gradient.js";
|
|
@@ -8,4 +8,4 @@ import { CONNECTOR_SEGMENT_HANDLE, connectorRouteHandles, connectorScreenEnds, c
|
|
|
8
8
|
import { aimLine, draggedLineEnds, isLineLike, lineEndPoints, lineWorldEnds } from "./line-ends.js";
|
|
9
9
|
import { rotationHandleLayout, selectionHandleRect, selectionPath } from "./selection.js";
|
|
10
10
|
import { TRANSFORM_ZONE, hasTransformHandles, pressesTinyLayer, transformZoneAt } from "./transform-zones.js";
|
|
11
|
-
export { ARC_HANDLE, CONNECTOR_SEGMENT_HANDLE, GRADIENT_HANDLE, IMAGE_CROP_GHOST_ALPHA, IMAGE_CROP_HANDLE, SHAPE_HANDLE, TRANSFORM_ZONE, aimLine, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, connectorRouteHandles, connectorScreenEnds, connectorScreenLabel, cornerRadii, cornerRadiusAtPoint, cornerRadiusChanges, cornerRadiusOf, coveringImageBounds, createSceneGeometry, croppedImageTransform, draggedLineEnds, dragsSingleCorner, figmaRotation, gradientHandleLayout, gradientHandles, gradientStopPoint, gradientStopPosition, hasShapeHandles, hasTransformHandles, hitTestGradientHandles, hitTestImageCrop, hitTestShapeHandles, imageCropHandles, imageCropHitDirection, imageCropLayout, imageCropQuad, imageTransformFromLocalMatrix, isArcHandle, isLineLike, isRadiusHandle, isWholeArc, lineEndPoints, lineWorldEnds, moveGradientHandle, nodeOrientationMatrix, panelPosition, panelPositionChange, panelRotation, panelRotationChange, pannedImageTransform, pointCountAtPoint, pressesTinyLayer, projectedNode, quadContains, resizedCropRect, rotationHandleLayout, scaledImageTransform, selectionHandleRect, selectionPath, shapeHandleLayout, shapeHandleValue, starRatioAtPoint, transformZoneAt, viewportMatrix };
|
|
11
|
+
export { ARC_HANDLE, CONNECTOR_SEGMENT_HANDLE, GRADIENT_HANDLE, IMAGE_CROP_GHOST_ALPHA, IMAGE_CROP_HANDLE, SHAPE_HANDLE, TRANSFORM_ZONE, aimLine, arcAtPoint, arcChanges, arcFieldValue, arcOf, arcWithField, connectorRouteHandles, connectorScreenEnds, connectorScreenLabel, cornerRadii, cornerRadiusAtPoint, cornerRadiusChanges, cornerRadiusOf, coveringImageBounds, createSceneGeometry, croppedImageTransform, draggedLineEnds, dragsSingleCorner, figmaRotation, gradientHandleLayout, gradientHandles, gradientStopPoint, gradientStopPosition, hasShapeHandles, hasTransformHandles, hitTestGradientHandles, hitTestImageCrop, hitTestShapeHandles, imageCropHandles, imageCropHitDirection, imageCropLayout, imageCropQuad, imageTransformFromLocalMatrix, isArcHandle, isLineLike, isRadiusHandle, isWholeArc, lineEndPoints, lineWorldEnds, moveGradientHandle, nodeOrientationMatrix, panelNumber, panelPosition, panelPositionChange, panelRotation, panelRotationChange, pannedImageTransform, pointCountAtPoint, pressesTinyLayer, projectedNode, quadContains, resizedCropRect, rotationHandleLayout, scaledImageTransform, selectionHandleRect, selectionPath, shapeHandleLayout, shapeHandleValue, starRatioAtPoint, transformZoneAt, viewportMatrix };
|
package/dist/icons/api.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconSet } from "./schema.js";
|
|
2
|
+
import { IconCollection, IconSearchResult } from "./types.js";
|
|
2
3
|
//#region src/icons/api.d.ts
|
|
3
4
|
declare function createIconifyAPIClient(fetcher?: typeof globalThis.fetch, baseURL?: string): {
|
|
4
|
-
fetchCollection(prefix: string, iconNames: string[]): Promise<
|
|
5
|
+
fetchCollection(prefix: string, iconNames: string[]): Promise<IconSet>;
|
|
5
6
|
/** Every icon set the API serves, retired ones left out. */
|
|
6
7
|
collections(): Promise<IconCollection[]>;
|
|
7
8
|
/** Every icon in the set `prefix`, as `prefix:name`, in the set's own order. */
|
package/dist/icons/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","names":[],"sources":["../../src/icons/api.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","names":[],"sources":["../../src/icons/api.ts"],"mappings":";;;iBAUgB,uBACd,iBAAgB,WAAW,OAC3B;EA2BgC,gBAAA,gBAAM,sBAAwB,QAAQ;;EAU/C,eAAA,QAAQ;;EAmBC,gBAAA,iBAAS;EAa9B,OAAA,eAAM;IACD;IAAgB;MAC3B,QAAQ"}
|
package/dist/icons/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { collectionListSchema, collectionsSchema } from "./schema.js";
|
|
1
|
+
import { collectionListSchema, collectionsSchema, iconSetSchema } from "./schema.js";
|
|
2
2
|
import { uniq } from "es-toolkit";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
import { createFetch } from "ofetch";
|
|
@@ -11,28 +11,28 @@ function createIconifyAPIClient(fetcher = globalThis.fetch, baseURL = ICONIFY_AP
|
|
|
11
11
|
retry: 0,
|
|
12
12
|
timeout: FETCH_TIMEOUT_MS
|
|
13
13
|
});
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A response body as text, so callers validate what the API sent rather than trust it. A failure
|
|
16
|
+
* names `what` failed, which for a set is its prefix, the name a caller knows the set by.
|
|
17
|
+
*/
|
|
18
|
+
async function text(path, query, what) {
|
|
16
19
|
const response = await iconifyAPI.raw(path, {
|
|
17
20
|
ignoreResponseError: true,
|
|
18
21
|
responseType: "text",
|
|
19
22
|
query
|
|
20
23
|
});
|
|
21
|
-
if (!response.ok) throw new Error(`Iconify API error: ${response.status} for ${
|
|
24
|
+
if (!response.ok) throw new Error(`Iconify API error: ${response.status} for ${what}`);
|
|
22
25
|
return response._data ?? "";
|
|
23
26
|
}
|
|
24
27
|
return {
|
|
25
28
|
async fetchCollection(prefix, iconNames) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
if (!response.ok) throw new Error(`Iconify API error: ${response.status} for prefix "${prefix}"`);
|
|
31
|
-
return response._data;
|
|
29
|
+
const parsed = v.safeParse(iconSetSchema, await text(`/${prefix}.json`, { icons: iconNames.join(",") }, `prefix "${prefix}"`));
|
|
30
|
+
if (!parsed.success) throw new Error(`Iconify API returned unexpected icons for "${prefix}"`);
|
|
31
|
+
return parsed.output;
|
|
32
32
|
},
|
|
33
33
|
/** Every icon set the API serves, retired ones left out. */
|
|
34
34
|
async collections() {
|
|
35
|
-
const parsed = v.safeParse(collectionsSchema, await text("/collections"));
|
|
35
|
+
const parsed = v.safeParse(collectionsSchema, await text("/collections", void 0, "the icon set list"));
|
|
36
36
|
if (!parsed.success) throw new Error("Iconify API returned an unexpected set list");
|
|
37
37
|
return Object.entries(parsed.output).filter(([, info]) => !info.hidden).map(([prefix, info]) => ({
|
|
38
38
|
prefix,
|
|
@@ -45,7 +45,7 @@ function createIconifyAPIClient(fetcher = globalThis.fetch, baseURL = ICONIFY_AP
|
|
|
45
45
|
},
|
|
46
46
|
/** Every icon in the set `prefix`, as `prefix:name`, in the set's own order. */
|
|
47
47
|
async collectionIcons(prefix) {
|
|
48
|
-
const parsed = v.safeParse(collectionListSchema, await text("/collection", { prefix }));
|
|
48
|
+
const parsed = v.safeParse(collectionListSchema, await text("/collection", { prefix }, `prefix "${prefix}"`));
|
|
49
49
|
if (!parsed.success) throw new Error(`Iconify API returned an unexpected list for "${prefix}"`);
|
|
50
50
|
const { uncategorized = [], categories = {} } = parsed.output;
|
|
51
51
|
return uniq([...uncategorized, ...Object.values(categories).flat()]).map((name) => `${prefix}:${name}`);
|
package/dist/icons/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":[],"sources":["../../src/icons/api.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\nimport { createFetch } from 'ofetch'\nimport * as v from 'valibot'\n\nimport { collectionListSchema, collectionsSchema } from './schema'\nimport type { IconCollection,
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../src/icons/api.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\nimport { createFetch } from 'ofetch'\nimport * as v from 'valibot'\n\nimport { collectionListSchema, collectionsSchema, iconSetSchema, type IconSet } from './schema'\nimport type { IconCollection, IconSearchResult } from './types'\n\nconst ICONIFY_API = 'https://api.iconify.design'\nconst FETCH_TIMEOUT_MS = 10_000\n\nexport function createIconifyAPIClient(\n fetcher: typeof globalThis.fetch = globalThis.fetch,\n baseURL = ICONIFY_API\n) {\n const iconifyAPI = createFetch({ fetch: fetcher }).create({\n baseURL,\n retry: 0,\n timeout: FETCH_TIMEOUT_MS\n })\n\n /**\n * A response body as text, so callers validate what the API sent rather than trust it. A failure\n * names `what` failed, which for a set is its prefix, the name a caller knows the set by.\n */\n async function text(\n path: string,\n query: Record<string, string> | undefined,\n what: string\n ): Promise<string> {\n const response = await iconifyAPI.raw<string, 'text'>(path, {\n ignoreResponseError: true,\n responseType: 'text',\n query\n })\n if (!response.ok) throw new Error(`Iconify API error: ${response.status} for ${what}`)\n return response._data ?? ''\n }\n\n return {\n async fetchCollection(prefix: string, iconNames: string[]): Promise<IconSet> {\n const parsed = v.safeParse(\n iconSetSchema,\n await text(`/${prefix}.json`, { icons: iconNames.join(',') }, `prefix \"${prefix}\"`)\n )\n if (!parsed.success) throw new Error(`Iconify API returned unexpected icons for \"${prefix}\"`)\n return parsed.output\n },\n\n /** Every icon set the API serves, retired ones left out. */\n async collections(): Promise<IconCollection[]> {\n const parsed = v.safeParse(\n collectionsSchema,\n await text('/collections', undefined, 'the icon set list')\n )\n if (!parsed.success) throw new Error('Iconify API returned an unexpected set list')\n return Object.entries(parsed.output)\n .filter(([, info]) => !info.hidden)\n .map(([prefix, info]) => ({\n prefix,\n name: info.name,\n total: info.total,\n category: info.category ?? null,\n license: info.license?.title ?? null,\n multicolor: info.palette === true\n }))\n },\n\n /** Every icon in the set `prefix`, as `prefix:name`, in the set's own order. */\n async collectionIcons(prefix: string): Promise<string[]> {\n const parsed = v.safeParse(\n collectionListSchema,\n await text('/collection', { prefix }, `prefix \"${prefix}\"`)\n )\n if (!parsed.success)\n throw new Error(`Iconify API returned an unexpected list for \"${prefix}\"`)\n const { uncategorized = [], categories = {} } = parsed.output\n const names = uniq([...uncategorized, ...Object.values(categories).flat()])\n return names.map((name) => `${prefix}:${name}`)\n },\n\n async search(\n query: string,\n options?: { limit?: number; prefix?: string }\n ): Promise<IconSearchResult> {\n const response = await iconifyAPI.raw<IconSearchResult>('/search', {\n ignoreResponseError: true,\n query: { query, limit: options?.limit, prefix: options?.prefix }\n })\n if (!response.ok) throw new Error(`Iconify search error: ${response.status}`)\n\n const data = response._data\n const limit = options?.limit ?? 5\n return {\n icons: data?.icons.slice(0, limit) ?? [],\n total: data?.total ?? 0,\n collections: data?.collections ?? {}\n }\n }\n }\n}\n"],"mappings":";;;;;AAOA,MAAM,cAAc;AACpB,MAAM,mBAAmB;AAEzB,SAAgB,uBACd,UAAmC,WAAW,OAC9C,UAAU,aACV;CACA,MAAM,aAAa,YAAY,EAAE,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,aAAa,CAAC,MAAM,OAAO;GAEvD,OADc,KAAK,CAAC,GAAG,eAAe,GAAG,OAAO,OAAO,UAAU,CAAC,CAAC,KAAK,CAAC,CAC9D,CAAC,CAAC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM;EAChD;EAEA,MAAM,OACJ,OACA,SAC2B;GAC3B,MAAM,WAAW,MAAM,WAAW,IAAsB,WAAW;IACjE,qBAAqB;IACrB,OAAO;KAAE;KAAO,OAAO,SAAS;KAAO,QAAQ,SAAS;IAAO;GACjE,CAAC;GACD,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM,yBAAyB,SAAS,QAAQ;GAE5E,MAAM,OAAO,SAAS;GACtB,MAAM,QAAQ,SAAS,SAAS;GAChC,OAAO;IACL,OAAO,MAAM,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC;IACvC,OAAO,MAAM,SAAS;IACtB,aAAa,MAAM,eAAe,CAAC;GACrC;EACF;CACF;AACF"}
|
package/dist/icons/provider.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconSet } from "./schema.js";
|
|
2
|
+
import { IconCollection, IconData, IconSearchResult } from "./types.js";
|
|
2
3
|
import { IconOptions } from "@pairdraw/scene-graph/icons";
|
|
3
4
|
//#region src/icons/provider.d.ts
|
|
4
5
|
interface IconSearchOptions {
|
|
@@ -38,11 +39,11 @@ declare function parseIconName(name: string): {
|
|
|
38
39
|
* previews and placed icons share what was loaded.
|
|
39
40
|
*/
|
|
40
41
|
declare function createIconifyProvider(client?: {
|
|
41
|
-
fetchCollection(prefix: string, iconNames: string[]): Promise<
|
|
42
|
+
fetchCollection(prefix: string, iconNames: string[]): Promise<IconSet>;
|
|
42
43
|
collections(): Promise<IconCollection[]>;
|
|
43
44
|
collectionIcons(prefix: string): Promise<string[]>;
|
|
44
45
|
search(query: string, options?: {
|
|
45
|
-
limit
|
|
46
|
+
limit? /** Requests on their way, by the names they ask for, so overlapping calls share them. */ : number;
|
|
46
47
|
prefix?: string;
|
|
47
48
|
}): Promise<IconSearchResult>;
|
|
48
49
|
}): IconProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","names":[],"sources":["../../src/icons/provider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","names":[],"sources":["../../src/icons/provider.ts"],"mappings":";;;;UASiB;EACf;;EAEA;;;;;;;UAQe;EACf,OAAO,eAAe,UAAU,oBAAoB,QAAQ;;;;;EAK5D,MACE,0BACA,cACA,UAAU,cACT,QAAQ,YAAY;;;;;EAKvB,SAAS,2BAA2B,QAAQ;;EAE5C,eAAe,QAAQ;;EAEvB,OAAO,iBAAiB;;;iBAIV,cAAc;EAAiB;EAAgB;;;;;;iBAa/C,sBAAsB;gEAAtB;;;;IAgBd;IADgB;;IAfwD"}
|
package/dist/icons/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildIconData } from "./svg.js";
|
|
2
2
|
import { createIconifyAPIClient } from "./api.js";
|
|
3
3
|
import { chunk } from "es-toolkit";
|
|
4
|
-
import { iconToHTML, iconToSVG } from "@iconify/utils";
|
|
4
|
+
import { getIconData, iconToHTML, iconToSVG } from "@iconify/utils";
|
|
5
5
|
//#region src/icons/provider.ts
|
|
6
6
|
/** `prefix:name` split, or null when the name has no set. */
|
|
7
7
|
function parseIconName(name) {
|
|
@@ -19,6 +19,7 @@ const NAMES_PER_REQUEST = 100;
|
|
|
19
19
|
* previews and placed icons share what was loaded.
|
|
20
20
|
*/
|
|
21
21
|
function createIconifyProvider(client = createIconifyAPIClient()) {
|
|
22
|
+
/** Icons with their aliases and the set's defaults resolved, as Iconify draws them. */
|
|
22
23
|
const entries = /* @__PURE__ */ new Map();
|
|
23
24
|
const built = /* @__PURE__ */ new Map();
|
|
24
25
|
let catalogue = null;
|
|
@@ -34,18 +35,10 @@ function createIconifyProvider(client = createIconifyAPIClient()) {
|
|
|
34
35
|
async function request(prefix, iconNames) {
|
|
35
36
|
const collection = await client.fetchCollection(prefix, iconNames);
|
|
36
37
|
for (const iconName of iconNames) {
|
|
37
|
-
const
|
|
38
|
-
const entry = collection.icons[iconName] ?? (parent ? collection.icons[parent] : void 0);
|
|
38
|
+
const icon = getIconData(collection, iconName);
|
|
39
39
|
const name = `${prefix}:${iconName}`;
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
entries.set(name, {
|
|
45
|
-
body: entry.body,
|
|
46
|
-
width: entry.width ?? collection.width ?? 24,
|
|
47
|
-
height: entry.height ?? collection.height ?? 24
|
|
48
|
-
});
|
|
40
|
+
if (icon) entries.set(name, icon);
|
|
41
|
+
else absent.add(name);
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
44
|
async function load(names) {
|
|
@@ -84,7 +77,7 @@ function createIconifyProvider(client = createIconifyAPIClient()) {
|
|
|
84
77
|
const parsed = parseIconName(name);
|
|
85
78
|
if (!entry || !parsed) continue;
|
|
86
79
|
const key = `${name}@${size}`;
|
|
87
|
-
const icon = built.get(key) ?? buildIconData(entry, parsed.prefix, parsed.iconName,
|
|
80
|
+
const icon = built.get(key) ?? buildIconData(entry, parsed.prefix, parsed.iconName, size);
|
|
88
81
|
built.set(key, icon);
|
|
89
82
|
found.set(name, icon);
|
|
90
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","names":[],"sources":["../../src/icons/provider.ts"],"sourcesContent":["import { iconToHTML, iconToSVG } from '@iconify/utils'\nimport { chunk } from 'es-toolkit'\n\nimport type { IconOptions } from '@pairdraw/scene-graph/icons'\n\nimport { createIconifyAPIClient } from './api'\nimport { buildIconData } from './svg'\nimport type { IconCollection, IconData,
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../src/icons/provider.ts"],"sourcesContent":["import { getIconData, iconToHTML, iconToSVG, type IconifyIcon } from '@iconify/utils'\nimport { chunk } from 'es-toolkit'\n\nimport type { IconOptions } from '@pairdraw/scene-graph/icons'\n\nimport { createIconifyAPIClient } from './api'\nimport { buildIconData } from './svg'\nimport type { IconCollection, IconData, IconSearchResult } from './types'\n\nexport interface IconSearchOptions {\n limit?: number\n /** Only icons from this set, such as `lucide`. */\n prefix?: string\n}\n\n/**\n * Where icons come from: their search, their paths, and their previews. Hosts pass one to the\n * renderer, tools, and the app, so another source, such as a bundled or self-hosted set, can\n * stand in for Iconify. A provider owns its cache.\n */\nexport interface IconProvider {\n search(query: string, options?: IconSearchOptions): Promise<IconSearchResult>\n /**\n * Each named icon at `size`, by name; names the source lacks are left out. `options` sets how\n * a set that has options draws them, its defaults filling in the rest; other sets ignore it.\n */\n icons(\n names: readonly string[],\n size: number,\n options?: IconOptions\n ): Promise<Map<string, IconData>>\n /**\n * Each named icon as SVG markup for pickers to show, painted in `currentColor` where the icon\n * takes its color; names the source lacks are left out.\n */\n previews(names: readonly string[]): Promise<Map<string, string>>\n /** The icon sets to choose from, for filtering a search or browsing one set. */\n collections(): Promise<IconCollection[]>\n /** Every icon in the set `prefix`, as `prefix:name`, for browsing without a query. */\n browse(prefix: string): Promise<string[]>\n}\n\n/** `prefix:name` split, or null when the name has no set. */\nexport function parseIconName(name: string): { prefix: string; iconName: string } | null {\n const colon = name.indexOf(':')\n if (colon <= 0 || colon === name.length - 1) return null\n return { prefix: name.slice(0, colon), iconName: name.slice(colon + 1) }\n}\n\n/** Names per request, so the query string of a long list stays well within URL limits. */\nconst NAMES_PER_REQUEST = 100\n\n/**\n * Icons from the Iconify API, fetched one request per set and cached by name, so search\n * previews and placed icons share what was loaded.\n */\nexport function createIconifyProvider(client = createIconifyAPIClient()): IconProvider {\n /** Icons with their aliases and the set's defaults resolved, as Iconify draws them. */\n const entries = new Map<string, IconifyIcon>()\n const built = new Map<string, IconData>()\n // Shared answers; a failed one is dropped so the next call asks again.\n let catalogue: Promise<IconCollection[]> | null = null\n const sets = new Map<string, Promise<string[]>>()\n\n function remember<T>(promise: Promise<T>, forget: () => void): Promise<T> {\n void promise.catch(forget)\n return promise\n }\n\n /** Names the source answered without, so they are not asked for again. */\n const absent = new Set<string>()\n /** Requests on their way, by the names they ask for, so overlapping calls share them. */\n const loading = new Map<string, Promise<void>>()\n\n async function request(prefix: string, iconNames: string[]): Promise<void> {\n const collection = await client.fetchCollection(prefix, iconNames)\n for (const iconName of iconNames) {\n // An alias may flip, turn, or resize its parent; a set may give every icon a box.\n const icon = getIconData(collection, iconName)\n const name = `${prefix}:${iconName}`\n if (icon) entries.set(name, icon)\n else absent.add(name)\n }\n }\n\n async function load(names: readonly string[]): Promise<void> {\n const waiting = new Set<Promise<void>>()\n const needed = new Map<string, string[]>()\n for (const name of names) {\n if (entries.has(name) || absent.has(name)) continue\n const pending = loading.get(name)\n if (pending) {\n waiting.add(pending)\n continue\n }\n const parsed = parseIconName(name)\n if (!parsed)\n throw new Error(\n `Invalid icon name \"${name}\". Use prefix:name format (e.g. lucide:heart, mdi:home)`\n )\n needed.set(parsed.prefix, [...(needed.get(parsed.prefix) ?? []), parsed.iconName])\n }\n for (const [prefix, iconNames] of needed) {\n for (const part of chunk(iconNames, NAMES_PER_REQUEST)) {\n const pending = request(prefix, part)\n const keys = part.map((iconName) => `${prefix}:${iconName}`)\n for (const key of keys) loading.set(key, pending)\n // Settled either way, the names leave the queue; a failure can be asked for again.\n const settle = () => {\n for (const key of keys) if (loading.get(key) === pending) loading.delete(key)\n }\n void pending.then(settle, settle)\n waiting.add(pending)\n }\n }\n await Promise.all(waiting)\n }\n\n return {\n search: (query, options) => client.search(query, options),\n\n async icons(names, size) {\n await load(names)\n const found = new Map<string, IconData>()\n for (const name of names) {\n const entry = entries.get(name)\n const parsed = parseIconName(name)\n if (!entry || !parsed) continue\n const key = `${name}@${size}`\n const icon = built.get(key) ?? buildIconData(entry, parsed.prefix, parsed.iconName, size)\n built.set(key, icon)\n found.set(name, icon)\n }\n return found\n },\n\n collections() {\n catalogue ??= remember(client.collections(), () => {\n catalogue = null\n })\n return catalogue\n },\n\n browse(prefix) {\n const cached = sets.get(prefix)\n if (cached) return cached\n const listed = remember(client.collectionIcons(prefix), () => sets.delete(prefix))\n sets.set(prefix, listed)\n return listed\n },\n\n async previews(names) {\n await load(names)\n const found = new Map<string, string>()\n for (const name of names) {\n const entry = entries.get(name)\n if (!entry) continue\n const { attributes, body } = iconToSVG(entry)\n found.set(name, iconToHTML(body, attributes))\n }\n return found\n }\n }\n}\n"],"mappings":";;;;;;AA2CA,SAAgB,cAAc,MAA2D;CACvF,MAAM,QAAQ,KAAK,QAAQ,GAAG;CAC9B,IAAI,SAAS,KAAK,UAAU,KAAK,SAAS,GAAG,OAAO;CACpD,OAAO;EAAE,QAAQ,KAAK,MAAM,GAAG,KAAK;EAAG,UAAU,KAAK,MAAM,QAAQ,CAAC;CAAE;AACzE;;AAGA,MAAM,oBAAoB;;;;;AAM1B,SAAgB,sBAAsB,SAAS,uBAAuB,GAAiB;;CAErF,MAAM,0BAAU,IAAI,IAAyB;CAC7C,MAAM,wBAAQ,IAAI,IAAsB;CAExC,IAAI,YAA8C;CAClD,MAAM,uBAAO,IAAI,IAA+B;CAEhD,SAAS,SAAY,SAAqB,QAAgC;EACxE,QAAa,MAAM,MAAM;EACzB,OAAO;CACT;;CAGA,MAAM,yBAAS,IAAI,IAAY;;CAE/B,MAAM,0BAAU,IAAI,IAA2B;CAE/C,eAAe,QAAQ,QAAgB,WAAoC;EACzE,MAAM,aAAa,MAAM,OAAO,gBAAgB,QAAQ,SAAS;EACjE,KAAK,MAAM,YAAY,WAAW;GAEhC,MAAM,OAAO,YAAY,YAAY,QAAQ;GAC7C,MAAM,OAAO,GAAG,OAAO,GAAG;GAC1B,IAAI,MAAM,QAAQ,IAAI,MAAM,IAAI;QAC3B,OAAO,IAAI,IAAI;EACtB;CACF;CAEA,eAAe,KAAK,OAAyC;EAC3D,MAAM,0BAAU,IAAI,IAAmB;EACvC,MAAM,yBAAS,IAAI,IAAsB;EACzC,KAAK,MAAM,QAAQ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AAM,IAAI,KAAK,IAAI;IACnB,MAAM,IAAI,MAAM,IAAI;GACtB;GACA,OAAO;EACT;EAEA,cAAc;GACZ,cAAc,SAAS,OAAO,YAAY,SAAS;IACjD,YAAY;GACd,CAAC;GACD,OAAO;EACT;EAEA,OAAO,QAAQ;GACb,MAAM,SAAS,KAAK,IAAI,MAAM;GAC9B,IAAI,QAAQ,OAAO;GACnB,MAAM,SAAS,SAAS,OAAO,gBAAgB,MAAM,SAAS,KAAK,OAAO,MAAM,CAAC;GACjF,KAAK,IAAI,QAAQ,MAAM;GACvB,OAAO;EACT;EAEA,MAAM,SAAS,OAAO;GACpB,MAAM,KAAK,KAAK;GAChB,MAAM,wBAAQ,IAAI,IAAoB;GACtC,KAAK,MAAM,QAAQ,OAAO;IACxB,MAAM,QAAQ,QAAQ,IAAI,IAAI;IAC9B,IAAI,CAAC,OAAO;IACZ,MAAM,EAAE,YAAY,SAAS,UAAU,KAAK;IAC5C,MAAM,IAAI,MAAM,WAAW,MAAM,UAAU,CAAC;GAC9C;GACA,OAAO;EACT;CACF;AACF"}
|
package/dist/icons/schema.d.ts
CHANGED
|
@@ -19,6 +19,38 @@ declare const collectionListSchema: v.SchemaWithPipe<readonly [v.StringSchema<un
|
|
|
19
19
|
readonly categories: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
|
|
20
20
|
readonly hidden: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
21
21
|
}, undefined>]>;
|
|
22
|
+
/**
|
|
23
|
+
* `GET /{prefix}.json?icons=…`: the asked-for icons and the aliases that lead to them, with the
|
|
24
|
+
* set's default box, which `getIconData` resolves into one icon.
|
|
25
|
+
*/
|
|
26
|
+
declare const iconSetSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.ParseJsonAction<string, undefined, undefined>, v.ObjectSchema<{
|
|
27
|
+
readonly prefix: v.StringSchema<undefined>;
|
|
28
|
+
readonly left: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
29
|
+
readonly top: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
30
|
+
readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
31
|
+
readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
32
|
+
readonly icons: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
33
|
+
readonly left: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
34
|
+
readonly top: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
35
|
+
readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
36
|
+
readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
37
|
+
readonly rotate: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
38
|
+
readonly hFlip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
39
|
+
readonly vFlip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
40
|
+
readonly body: v.StringSchema<undefined>;
|
|
41
|
+
}, undefined>, undefined>;
|
|
42
|
+
readonly aliases: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
43
|
+
readonly left: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
44
|
+
readonly top: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
45
|
+
readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
46
|
+
readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
47
|
+
readonly rotate: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
48
|
+
readonly hFlip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
49
|
+
readonly vFlip: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
50
|
+
readonly parent: v.StringSchema<undefined>;
|
|
51
|
+
}, undefined>, undefined>, undefined>;
|
|
52
|
+
}, undefined>]>;
|
|
53
|
+
type IconSet = v.InferOutput<typeof iconSetSchema>;
|
|
22
54
|
//#endregion
|
|
23
|
-
export { collectionListSchema, collectionsSchema };
|
|
55
|
+
export { IconSet, collectionListSchema, collectionsSchema, iconSetSchema };
|
|
24
56
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/icons/schema.ts"],"mappings":";;;cAea,mBAAiB,EAAA,yBAAA,EAAA,yBAAA,EAAA,+CAAA,EAAA,aAAA,EAAA,yBAAA,EAAA;;;;;;;;;;;;;cAOjB,sBAAoB,EAAA,yBAAA,EAAA,yBAAA,EAAA,+CAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/icons/schema.ts"],"mappings":";;;cAea,mBAAiB,EAAA,yBAAA,EAAA,yBAAA,EAAA,+CAAA,EAAA,aAAA,EAAA,yBAAA,EAAA;;;;;;;;;;;;;cAOjB,sBAAoB,EAAA,yBAAA,EAAA,yBAAA,EAAA,+CAAA,EAAA;;;;;;;;;cAyBpB,eAAa,EAAA,yBAAA,EAAA,yBAAA,EAAA,+CAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAcd,UAAU,EAAE,mBAAmB"}
|
package/dist/icons/schema.js
CHANGED
|
@@ -19,7 +19,36 @@ const collectionListSchema = v.pipe(v.string(), v.parseJson(), v.object({
|
|
|
19
19
|
categories: v.optional(v.record(v.string(), v.array(v.string()))),
|
|
20
20
|
hidden: v.optional(v.array(v.string()))
|
|
21
21
|
}));
|
|
22
|
+
/** An icon's box and turn, as an icon, an alias, or a whole set gives them. */
|
|
23
|
+
const iconPropsEntries = {
|
|
24
|
+
left: v.optional(v.number()),
|
|
25
|
+
top: v.optional(v.number()),
|
|
26
|
+
width: v.optional(v.number()),
|
|
27
|
+
height: v.optional(v.number()),
|
|
28
|
+
rotate: v.optional(v.number()),
|
|
29
|
+
hFlip: v.optional(v.boolean()),
|
|
30
|
+
vFlip: v.optional(v.boolean())
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* `GET /{prefix}.json?icons=…`: the asked-for icons and the aliases that lead to them, with the
|
|
34
|
+
* set's default box, which `getIconData` resolves into one icon.
|
|
35
|
+
*/
|
|
36
|
+
const iconSetSchema = v.pipe(v.string(), v.parseJson(), v.object({
|
|
37
|
+
prefix: v.string(),
|
|
38
|
+
left: v.optional(v.number()),
|
|
39
|
+
top: v.optional(v.number()),
|
|
40
|
+
width: v.optional(v.number()),
|
|
41
|
+
height: v.optional(v.number()),
|
|
42
|
+
icons: v.record(v.string(), v.object({
|
|
43
|
+
body: v.string(),
|
|
44
|
+
...iconPropsEntries
|
|
45
|
+
})),
|
|
46
|
+
aliases: v.optional(v.record(v.string(), v.object({
|
|
47
|
+
parent: v.string(),
|
|
48
|
+
...iconPropsEntries
|
|
49
|
+
})))
|
|
50
|
+
}));
|
|
22
51
|
//#endregion
|
|
23
|
-
export { collectionListSchema, collectionsSchema };
|
|
52
|
+
export { collectionListSchema, collectionsSchema, iconSetSchema };
|
|
24
53
|
|
|
25
54
|
//# sourceMappingURL=schema.js.map
|
package/dist/icons/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../src/icons/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\n/** One icon set in the Iconify catalogue, keeping only what pickers show. */\nconst collectionInfoSchema = v.object({\n name: v.string(),\n total: v.number(),\n category: v.optional(v.string()),\n license: v.optional(v.object({ title: v.string() })),\n /** True for sets drawn in their own colors, which an icon color cannot change. */\n palette: v.optional(v.boolean()),\n /** Iconify lists retired sets for old links; pickers leave them out. */\n hidden: v.optional(v.boolean())\n})\n\n/** `GET /collections`: every set by prefix. */\nexport const collectionsSchema = v.pipe(\n v.string(),\n v.parseJson(),\n v.record(v.string(), collectionInfoSchema)\n)\n\n/** `GET /collection?prefix=…`: the names in one set, loose or by category. */\nexport const collectionListSchema = v.pipe(\n v.string(),\n v.parseJson(),\n v.object({\n uncategorized: v.optional(v.array(v.string())),\n categories: v.optional(v.record(v.string(), v.array(v.string()))),\n hidden: v.optional(v.array(v.string()))\n })\n)\n"],"mappings":";;;AAGA,MAAM,uBAAuB,EAAE,OAAO;CACpC,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;;CAEnD,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;;CAE/B,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;AAChC,CAAC;;AAGD,MAAa,oBAAoB,EAAE,KACjC,EAAE,OAAO,GACT,EAAE,UAAU,GACZ,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB,CAC3C;;AAGA,MAAa,uBAAuB,EAAE,KACpC,EAAE,OAAO,GACT,EAAE,UAAU,GACZ,EAAE,OAAO;CACP,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/icons/schema.ts"],"sourcesContent":["import * as v from 'valibot'\n\n/** One icon set in the Iconify catalogue, keeping only what pickers show. */\nconst collectionInfoSchema = v.object({\n name: v.string(),\n total: v.number(),\n category: v.optional(v.string()),\n license: v.optional(v.object({ title: v.string() })),\n /** True for sets drawn in their own colors, which an icon color cannot change. */\n palette: v.optional(v.boolean()),\n /** Iconify lists retired sets for old links; pickers leave them out. */\n hidden: v.optional(v.boolean())\n})\n\n/** `GET /collections`: every set by prefix. */\nexport const collectionsSchema = v.pipe(\n v.string(),\n v.parseJson(),\n v.record(v.string(), collectionInfoSchema)\n)\n\n/** `GET /collection?prefix=…`: the names in one set, loose or by category. */\nexport const collectionListSchema = v.pipe(\n v.string(),\n v.parseJson(),\n v.object({\n uncategorized: v.optional(v.array(v.string())),\n categories: v.optional(v.record(v.string(), v.array(v.string()))),\n hidden: v.optional(v.array(v.string()))\n })\n)\n\n/** An icon's box and turn, as an icon, an alias, or a whole set gives them. */\nconst iconPropsEntries = {\n left: v.optional(v.number()),\n top: v.optional(v.number()),\n width: v.optional(v.number()),\n height: v.optional(v.number()),\n rotate: v.optional(v.number()),\n hFlip: v.optional(v.boolean()),\n vFlip: v.optional(v.boolean())\n}\n\n/**\n * `GET /{prefix}.json?icons=…`: the asked-for icons and the aliases that lead to them, with the\n * set's default box, which `getIconData` resolves into one icon.\n */\nexport const iconSetSchema = v.pipe(\n v.string(),\n v.parseJson(),\n v.object({\n prefix: v.string(),\n left: v.optional(v.number()),\n top: v.optional(v.number()),\n width: v.optional(v.number()),\n height: v.optional(v.number()),\n icons: v.record(v.string(), v.object({ body: v.string(), ...iconPropsEntries })),\n aliases: v.optional(v.record(v.string(), v.object({ parent: v.string(), ...iconPropsEntries })))\n })\n)\n\nexport type IconSet = v.InferOutput<typeof iconSetSchema>\n"],"mappings":";;;AAGA,MAAM,uBAAuB,EAAE,OAAO;CACpC,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;;CAEnD,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;;CAE/B,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;AAChC,CAAC;;AAGD,MAAa,oBAAoB,EAAE,KACjC,EAAE,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AAC,CAAC,CAAC;AACjG,CAAC,CACH"}
|
|
@@ -2,6 +2,8 @@ import { Element, Node } from "@xmldom/xmldom";
|
|
|
2
2
|
//#region src/icons/svg/presentation.d.ts
|
|
3
3
|
/** SVG presentation attributes as an element inherits them, still as source strings. */
|
|
4
4
|
interface PresentationAttributes {
|
|
5
|
+
/** The CSS `color` that `currentColor` paints take; empty when no element sets one. */
|
|
6
|
+
color: string;
|
|
5
7
|
fill: string;
|
|
6
8
|
stroke: string;
|
|
7
9
|
strokeWidth: string;
|
|
@@ -29,7 +31,12 @@ declare function presentationVisible(presentation: PresentationAttributes): bool
|
|
|
29
31
|
/** An SVG opacity, a number or a percentage, clamped to 0–1. */
|
|
30
32
|
declare function opacityValue(value: string | null | undefined): number;
|
|
31
33
|
declare function num(element: Element, attr: string, fallback?: number): number;
|
|
32
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A paint as drawn: null for `none`, and `currentColor`, in any case, as the element's `color`
|
|
36
|
+
* when one is set. Without one, and for a fill no element sets, it is `currentColor`, which the
|
|
37
|
+
* host's color fills, as an icon's color does.
|
|
38
|
+
*/
|
|
39
|
+
declare function normalizeSVGPaint(value: string | null, color?: string): string | null;
|
|
33
40
|
declare function combinedTransform(parent: string | null, element: Element): string | null;
|
|
34
41
|
//#endregion
|
|
35
42
|
export { DEFAULT_PRESENTATION, PresentationAttributes, combinedTransform, inlineStyles, isElement, normalizeSVGPaint, num, opacityValue, presentationFor, presentationVisible };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.d.ts","names":[],"sources":["../../../src/icons/svg/presentation.ts"],"mappings":";;;UAGiB;
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","names":[],"sources":["../../../src/icons/svg/presentation.ts"],"mappings":";;;UAGiB;;EAEf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;cAGW,sBAAsB;iBAsBnB,UAAU,MAAM,OAAO,QAAQ;iBAI/B,aAAa,SAAS,UAAU;iBAwBhC,gBACd,SAAS,SACT,WAAW,yBACV;;iBAgCa,oBAAoB,cAAc;;iBAKlC,aAAa;iBAQb,IAAI,SAAS,SAAS,cAAc;;;;;;iBAmBpC,kBAAkB,sBAAsB;iBASxC,kBAAkB,uBAAuB,SAAS"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/icons/svg/presentation.ts
|
|
2
2
|
const DEFAULT_PRESENTATION = {
|
|
3
|
-
|
|
3
|
+
color: "",
|
|
4
|
+
fill: "",
|
|
4
5
|
stroke: "none",
|
|
5
6
|
strokeWidth: "1",
|
|
6
7
|
strokeCap: "butt",
|
|
@@ -38,7 +39,9 @@ function inheritedAttribute(element, styles, name, inherited) {
|
|
|
38
39
|
function presentationFor(element, inherited) {
|
|
39
40
|
const styles = inlineStyles(element);
|
|
40
41
|
const attribute = (name, value) => inheritedAttribute(element, styles, name, value);
|
|
42
|
+
const color = attribute("color", inherited.color).trim();
|
|
41
43
|
return {
|
|
44
|
+
color: isCurrentColor(color) || color.toLowerCase() === "inherit" ? inherited.color : color,
|
|
42
45
|
fill: attribute("fill", inherited.fill),
|
|
43
46
|
stroke: attribute("stroke", inherited.stroke),
|
|
44
47
|
strokeWidth: attribute("stroke-width", inherited.strokeWidth),
|
|
@@ -76,8 +79,23 @@ function num(element, attr, fallback = 0) {
|
|
|
76
79
|
const parsed = Number.parseFloat(value);
|
|
77
80
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
78
81
|
}
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
const CURRENT_COLOR = "currentColor";
|
|
83
|
+
/** CSS keywords match in any case, so `currentcolor` is `currentColor`. */
|
|
84
|
+
function isCurrentColor(value) {
|
|
85
|
+
return value.trim().toLowerCase() === CURRENT_COLOR.toLowerCase();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A paint as drawn: null for `none`, and `currentColor`, in any case, as the element's `color`
|
|
89
|
+
* when one is set. Without one, and for a fill no element sets, it is `currentColor`, which the
|
|
90
|
+
* host's color fills, as an icon's color does.
|
|
91
|
+
*/
|
|
92
|
+
function normalizeSVGPaint(value, color = "") {
|
|
93
|
+
if (value === null) return null;
|
|
94
|
+
const paint = value.trim();
|
|
95
|
+
if (paint === "") return CURRENT_COLOR;
|
|
96
|
+
if (paint.toLowerCase() === "none") return null;
|
|
97
|
+
if (!isCurrentColor(paint)) return value;
|
|
98
|
+
return color || CURRENT_COLOR;
|
|
81
99
|
}
|
|
82
100
|
function combinedTransform(parent, element) {
|
|
83
101
|
const current = element.getAttribute("transform");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.js","names":[],"sources":["../../../src/icons/svg/presentation.ts"],"sourcesContent":["import type { Element, Node } from '@xmldom/xmldom'\n\n/** SVG presentation attributes as an element inherits them, still as source strings. */\nexport interface PresentationAttributes {\n fill: string\n stroke: string\n strokeWidth: string\n strokeCap: string\n strokeJoin: string\n fillRule: string\n fillOpacity: string\n strokeOpacity: string\n fontFamily: string\n fontSize: string\n fontWeight: string\n fontStyle: string\n textAnchor: string\n letterSpacing: string\n textDecoration: string\n visibility: string\n display: string\n}\n\nexport const DEFAULT_PRESENTATION: PresentationAttributes = {\n fill: '
|
|
1
|
+
{"version":3,"file":"presentation.js","names":[],"sources":["../../../src/icons/svg/presentation.ts"],"sourcesContent":["import type { Element, Node } from '@xmldom/xmldom'\n\n/** SVG presentation attributes as an element inherits them, still as source strings. */\nexport interface PresentationAttributes {\n /** The CSS `color` that `currentColor` paints take; empty when no element sets one. */\n color: string\n fill: string\n stroke: string\n strokeWidth: string\n strokeCap: string\n strokeJoin: string\n fillRule: string\n fillOpacity: string\n strokeOpacity: string\n fontFamily: string\n fontSize: string\n fontWeight: string\n fontStyle: string\n textAnchor: string\n letterSpacing: string\n textDecoration: string\n visibility: string\n display: string\n}\n\nexport const DEFAULT_PRESENTATION: PresentationAttributes = {\n color: '',\n // No fill set: the host's color, as an icon's, never the `color` an ancestor sets.\n fill: '',\n stroke: 'none',\n strokeWidth: '1',\n strokeCap: 'butt',\n strokeJoin: 'miter',\n fillRule: 'nonzero',\n fillOpacity: '1',\n strokeOpacity: '1',\n fontFamily: '',\n fontSize: '',\n fontWeight: 'normal',\n fontStyle: 'normal',\n textAnchor: 'start',\n letterSpacing: 'normal',\n textDecoration: 'none',\n visibility: 'visible',\n display: 'inline'\n}\n\nexport function isElement(node: Node): node is Element {\n return node.nodeType === node.ELEMENT_NODE\n}\n\nexport function inlineStyles(element: Element): ReadonlyMap<string, string> {\n const styles = new Map<string, string>()\n for (const declaration of (element.getAttribute('style') ?? '').split(';')) {\n const separator = declaration.indexOf(':')\n if (separator <= 0) continue\n const name = declaration.slice(0, separator).trim()\n const value = declaration.slice(separator + 1).trim()\n if (name && value) styles.set(name, value)\n }\n return styles\n}\n\nfunction inheritedAttribute(\n element: Element,\n styles: ReadonlyMap<string, string>,\n name: string,\n inherited: string\n): string {\n return (\n styles.get(name) ??\n (element.hasAttribute(name) ? (element.getAttribute(name) ?? inherited) : inherited)\n )\n}\n\nexport function presentationFor(\n element: Element,\n inherited: PresentationAttributes\n): PresentationAttributes {\n const styles = inlineStyles(element)\n const attribute = (name: string, value: string) =>\n inheritedAttribute(element, styles, name, value)\n const color = attribute('color', inherited.color).trim()\n return {\n // `inherit` and `currentColor` as a color both mean the parent's.\n color: isCurrentColor(color) || color.toLowerCase() === 'inherit' ? inherited.color : color,\n fill: attribute('fill', inherited.fill),\n stroke: attribute('stroke', inherited.stroke),\n strokeWidth: attribute('stroke-width', inherited.strokeWidth),\n strokeCap: attribute('stroke-linecap', inherited.strokeCap),\n strokeJoin: attribute('stroke-linejoin', inherited.strokeJoin),\n fillRule: attribute('fill-rule', inherited.fillRule),\n fillOpacity: attribute('fill-opacity', inherited.fillOpacity),\n strokeOpacity: attribute('stroke-opacity', inherited.strokeOpacity),\n fontFamily: attribute('font-family', inherited.fontFamily),\n fontSize: attribute('font-size', inherited.fontSize),\n fontWeight: attribute('font-weight', inherited.fontWeight),\n fontStyle: attribute('font-style', inherited.fontStyle),\n textAnchor: attribute('text-anchor', inherited.textAnchor),\n letterSpacing: attribute('letter-spacing', inherited.letterSpacing),\n textDecoration: attribute('text-decoration', inherited.textDecoration),\n // As Figma reads them: both inherit, unlike CSS `display`; any visibility but `visible`\n // hides, `inherit` included, and any display but `none` shows.\n visibility:\n attribute('visibility', inherited.visibility).trim() === 'visible' ? 'visible' : 'hidden',\n display: attribute('display', inherited.display).trim() === 'none' ? 'none' : 'inline'\n }\n}\n\n/** Whether an element with these attributes shows: `visibility: visible`, not `display: none`. */\nexport function presentationVisible(presentation: PresentationAttributes): boolean {\n return presentation.visibility === 'visible' && presentation.display !== 'none'\n}\n\n/** An SVG opacity, a number or a percentage, clamped to 0–1. */\nexport function opacityValue(value: string | null | undefined): number {\n if (!value) return 1\n const parsed = Number.parseFloat(value)\n if (!Number.isFinite(parsed)) return 1\n const opacity = value.trim().endsWith('%') ? parsed / 100 : parsed\n return Math.min(1, Math.max(0, opacity))\n}\n\nexport function num(element: Element, attr: string, fallback = 0): number {\n const value = element.getAttribute(attr)\n if (value === null) return fallback\n const parsed = Number.parseFloat(value)\n return Number.isFinite(parsed) ? parsed : fallback\n}\n\nconst CURRENT_COLOR = 'currentColor'\n\n/** CSS keywords match in any case, so `currentcolor` is `currentColor`. */\nfunction isCurrentColor(value: string): boolean {\n return value.trim().toLowerCase() === CURRENT_COLOR.toLowerCase()\n}\n\n/**\n * A paint as drawn: null for `none`, and `currentColor`, in any case, as the element's `color`\n * when one is set. Without one, and for a fill no element sets, it is `currentColor`, which the\n * host's color fills, as an icon's color does.\n */\nexport function normalizeSVGPaint(value: string | null, color = ''): string | null {\n if (value === null) return null\n const paint = value.trim()\n if (paint === '') return CURRENT_COLOR\n if (paint.toLowerCase() === 'none') return null\n if (!isCurrentColor(paint)) return value\n return color || CURRENT_COLOR\n}\n\nexport function combinedTransform(parent: string | null, element: Element): string | null {\n const current = element.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B;;AAGtB,SAAS,eAAe,OAAwB;CAC9C,OAAO,MAAM,KAAK,CAAC,CAAC,YAAY,MAAM,cAAc,YAAY;AAClE;;;;;;AAOA,SAAgB,kBAAkB,OAAsB,QAAQ,IAAmB;CACjF,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,QAAQ,MAAM,KAAK;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,MAAM,YAAY,MAAM,QAAQ,OAAO;CAC3C,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO;CACnC,OAAO,SAAS;AAClB;AAEA,SAAgB,kBAAkB,QAAuB,SAAiC;CACxF,MAAM,UAAU,QAAQ,aAAa,WAAW;CAChD,IAAI,UAAU,SAAS,OAAO,GAAG,OAAO,GAAG;CAC3C,OAAO,WAAW;AACpB"}
|
package/dist/icons/svg/text.js
CHANGED
|
@@ -47,7 +47,7 @@ function textRun(text, presentation) {
|
|
|
47
47
|
const spacing = Number.parseFloat(presentation.letterSpacing);
|
|
48
48
|
return {
|
|
49
49
|
text,
|
|
50
|
-
fill: normalizeSVGPaint(presentation.fill),
|
|
50
|
+
fill: normalizeSVGPaint(presentation.fill, presentation.color),
|
|
51
51
|
fillOpacity: opacityValue(presentation.fillOpacity),
|
|
52
52
|
fontFamily: fontFamily(presentation.fontFamily),
|
|
53
53
|
fontSize: Number.isFinite(size) && size > 0 ? size : DEFAULT_FONT_SIZE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../../src/icons/svg/text.ts"],"sourcesContent":["import type { Element, Node } from '@xmldom/xmldom'\n\nimport type { SVGTextInfo, SVGTextPiece, SVGTextRun } from '#core/icons/types'\n\nimport {\n isElement,\n normalizeSVGPaint,\n num,\n opacityValue,\n presentationFor,\n type PresentationAttributes\n} from './presentation'\nimport type { Scope } from './scope'\n\n/** Figma draws SVG text without a size at 12px. */\nconst DEFAULT_FONT_SIZE = 12\nconst GENERIC_FAMILIES = new Set([\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-sans-serif',\n 'ui-serif',\n 'ui-monospace'\n])\n/**\n * Attributes that start a new layer. A `dx` alone shifts from where the text so far ends, which\n * only layout knows, so such a `<tspan>` stays in its layer as a style run.\n */\nconst MOVES = ['x', 'y', 'dy']\n\nfunction fontFamily(value: string): string | null {\n for (const entry of value.split(',')) {\n const family = entry.trim().replace(/^['\"]|['\"]$/g, '')\n if (family && !GENERIC_FAMILIES.has(family.toLowerCase())) return family\n }\n return null\n}\n\nfunction fontWeight(value: string): number {\n const keyword = value.trim().toLowerCase()\n if (keyword === 'bold' || keyword === 'bolder') return 700\n if (keyword === 'lighter') return 300\n const parsed = Number.parseFloat(keyword)\n return Number.isFinite(parsed) ? parsed : 400\n}\n\nfunction textDecoration(value: string): SVGTextRun['textDecoration'] {\n const decoration = value.toLowerCase()\n if (decoration.includes('underline')) return 'UNDERLINE'\n if (decoration.includes('line-through')) return 'STRIKETHROUGH'\n return 'NONE'\n}\n\nfunction textRun(text: string, presentation: PresentationAttributes): SVGTextRun {\n const size = Number.parseFloat(presentation.fontSize)\n const spacing = Number.parseFloat(presentation.letterSpacing)\n return {\n text,\n fill: normalizeSVGPaint(presentation.fill),\n fillOpacity: opacityValue(presentation.fillOpacity),\n fontFamily: fontFamily(presentation.fontFamily),\n fontSize: Number.isFinite(size) && size > 0 ? size : DEFAULT_FONT_SIZE,\n fontWeight: fontWeight(presentation.fontWeight),\n italic: /italic|oblique/i.test(presentation.fontStyle),\n letterSpacing: Number.isFinite(spacing) ? spacing : 0,\n textDecoration: textDecoration(presentation.textDecoration)\n }\n}\n\nfunction anchor(presentation: PresentationAttributes): SVGTextPiece['anchor'] {\n const value = presentation.textAnchor.trim()\n return value === 'middle' || value === 'end' ? value : 'start'\n}\n\n/** Collapse whitespace as SVG does by default: runs of it become one space, trimmed at the ends. */\nfunction collapseWhitespace(piece: SVGTextPiece): SVGTextPiece {\n let afterSpace = true\n const runs = piece.runs.map((run) => {\n let text = run.text.replace(/\\s+/g, ' ')\n if (afterSpace) text = text.replace(/^ /, '')\n if (text) afterSpace = text.endsWith(' ')\n return { ...run, text }\n })\n const last = runs.findLastIndex((run) => run.text)\n if (last !== -1) runs[last] = { ...runs[last], text: runs[last].text.replace(/ $/, '') }\n return { ...piece, runs: runs.filter((run) => run.text) }\n}\n\n/** The pieces of a `<text>` element, split where a `<tspan>` moves the text position. */\nexport function collectTextPieces(element: Element, scope: Scope): SVGTextPiece[] {\n const pieces: SVGTextPiece[] = []\n let current: SVGTextPiece = {\n x: num(element, 'x'),\n y: num(element, 'y'),\n anchor: anchor(scope.presentation),\n runs: []\n }\n const walk = (node: Node, presentation: PresentationAttributes) => {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === child.TEXT_NODE || child.nodeType === child.CDATA_SECTION_NODE) {\n current.runs.push(textRun(child.nodeValue ?? '', presentation))\n continue\n }\n if (!isElement(child) || (child.localName || child.tagName) !== 'tspan') continue\n const style = presentationFor(child, presentation)\n if (MOVES.some((name) => child.hasAttribute(name))) {\n pieces.push(current)\n current = {\n x: child.hasAttribute('x') ? num(child, 'x') : current.x + num(child, 'dx'),\n y: child.hasAttribute('y') ? num(child, 'y') : current.y + num(child, 'dy'),\n anchor: anchor(style),\n runs: []\n }\n }\n walk(child, style)\n }\n }\n walk(element, scope.presentation)\n pieces.push(current)\n return pieces.map(collapseWhitespace).filter((piece) => piece.runs.length > 0)\n}\n\nexport function textInfo(\n element: Element,\n scope: Scope,\n pathIndex: number\n): Omit<SVGTextInfo, 'elements'> | null {\n const pieces = collectTextPieces(element, scope)\n if (pieces.length === 0) return null\n return {\n pieces,\n transform: scope.transform,\n clipPaths: scope.clipPaths.length > 0 ? scope.clipPaths : undefined,\n pathIndex\n }\n}\n"],"mappings":";;;AAeA,MAAM,oBAAoB;AAC1B,MAAM,mCAAmB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAKD,MAAM,QAAQ;CAAC;CAAK;CAAK;AAAI;AAE7B,SAAS,WAAW,OAA8B;CAChD,KAAK,MAAM,SAAS,MAAM,MAAM,GAAG,GAAG;EACpC,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,QAAQ,gBAAgB,EAAE;EACtD,IAAI,UAAU,CAAC,iBAAiB,IAAI,OAAO,YAAY,CAAC,GAAG,OAAO;CACpE;CACA,OAAO;AACT;AAEA,SAAS,WAAW,OAAuB;CACzC,MAAM,UAAU,MAAM,KAAK,CAAC,CAAC,YAAY;CACzC,IAAI,YAAY,UAAU,YAAY,UAAU,OAAO;CACvD,IAAI,YAAY,WAAW,OAAO;CAClC,MAAM,SAAS,OAAO,WAAW,OAAO;CACxC,OAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;AAEA,SAAS,eAAe,OAA6C;CACnE,MAAM,aAAa,MAAM,YAAY;CACrC,IAAI,WAAW,SAAS,WAAW,GAAG,OAAO;CAC7C,IAAI,WAAW,SAAS,cAAc,GAAG,OAAO;CAChD,OAAO;AACT;AAEA,SAAS,QAAQ,MAAc,cAAkD;CAC/E,MAAM,OAAO,OAAO,WAAW,aAAa,QAAQ;CACpD,MAAM,UAAU,OAAO,WAAW,aAAa,aAAa;CAC5D,OAAO;EACL;EACA,MAAM,kBAAkB,aAAa,
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../../src/icons/svg/text.ts"],"sourcesContent":["import type { Element, Node } from '@xmldom/xmldom'\n\nimport type { SVGTextInfo, SVGTextPiece, SVGTextRun } from '#core/icons/types'\n\nimport {\n isElement,\n normalizeSVGPaint,\n num,\n opacityValue,\n presentationFor,\n type PresentationAttributes\n} from './presentation'\nimport type { Scope } from './scope'\n\n/** Figma draws SVG text without a size at 12px. */\nconst DEFAULT_FONT_SIZE = 12\nconst GENERIC_FAMILIES = new Set([\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-sans-serif',\n 'ui-serif',\n 'ui-monospace'\n])\n/**\n * Attributes that start a new layer. A `dx` alone shifts from where the text so far ends, which\n * only layout knows, so such a `<tspan>` stays in its layer as a style run.\n */\nconst MOVES = ['x', 'y', 'dy']\n\nfunction fontFamily(value: string): string | null {\n for (const entry of value.split(',')) {\n const family = entry.trim().replace(/^['\"]|['\"]$/g, '')\n if (family && !GENERIC_FAMILIES.has(family.toLowerCase())) return family\n }\n return null\n}\n\nfunction fontWeight(value: string): number {\n const keyword = value.trim().toLowerCase()\n if (keyword === 'bold' || keyword === 'bolder') return 700\n if (keyword === 'lighter') return 300\n const parsed = Number.parseFloat(keyword)\n return Number.isFinite(parsed) ? parsed : 400\n}\n\nfunction textDecoration(value: string): SVGTextRun['textDecoration'] {\n const decoration = value.toLowerCase()\n if (decoration.includes('underline')) return 'UNDERLINE'\n if (decoration.includes('line-through')) return 'STRIKETHROUGH'\n return 'NONE'\n}\n\nfunction textRun(text: string, presentation: PresentationAttributes): SVGTextRun {\n const size = Number.parseFloat(presentation.fontSize)\n const spacing = Number.parseFloat(presentation.letterSpacing)\n return {\n text,\n fill: normalizeSVGPaint(presentation.fill, presentation.color),\n fillOpacity: opacityValue(presentation.fillOpacity),\n fontFamily: fontFamily(presentation.fontFamily),\n fontSize: Number.isFinite(size) && size > 0 ? size : DEFAULT_FONT_SIZE,\n fontWeight: fontWeight(presentation.fontWeight),\n italic: /italic|oblique/i.test(presentation.fontStyle),\n letterSpacing: Number.isFinite(spacing) ? spacing : 0,\n textDecoration: textDecoration(presentation.textDecoration)\n }\n}\n\nfunction anchor(presentation: PresentationAttributes): SVGTextPiece['anchor'] {\n const value = presentation.textAnchor.trim()\n return value === 'middle' || value === 'end' ? value : 'start'\n}\n\n/** Collapse whitespace as SVG does by default: runs of it become one space, trimmed at the ends. */\nfunction collapseWhitespace(piece: SVGTextPiece): SVGTextPiece {\n let afterSpace = true\n const runs = piece.runs.map((run) => {\n let text = run.text.replace(/\\s+/g, ' ')\n if (afterSpace) text = text.replace(/^ /, '')\n if (text) afterSpace = text.endsWith(' ')\n return { ...run, text }\n })\n const last = runs.findLastIndex((run) => run.text)\n if (last !== -1) runs[last] = { ...runs[last], text: runs[last].text.replace(/ $/, '') }\n return { ...piece, runs: runs.filter((run) => run.text) }\n}\n\n/** The pieces of a `<text>` element, split where a `<tspan>` moves the text position. */\nexport function collectTextPieces(element: Element, scope: Scope): SVGTextPiece[] {\n const pieces: SVGTextPiece[] = []\n let current: SVGTextPiece = {\n x: num(element, 'x'),\n y: num(element, 'y'),\n anchor: anchor(scope.presentation),\n runs: []\n }\n const walk = (node: Node, presentation: PresentationAttributes) => {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === child.TEXT_NODE || child.nodeType === child.CDATA_SECTION_NODE) {\n current.runs.push(textRun(child.nodeValue ?? '', presentation))\n continue\n }\n if (!isElement(child) || (child.localName || child.tagName) !== 'tspan') continue\n const style = presentationFor(child, presentation)\n if (MOVES.some((name) => child.hasAttribute(name))) {\n pieces.push(current)\n current = {\n x: child.hasAttribute('x') ? num(child, 'x') : current.x + num(child, 'dx'),\n y: child.hasAttribute('y') ? num(child, 'y') : current.y + num(child, 'dy'),\n anchor: anchor(style),\n runs: []\n }\n }\n walk(child, style)\n }\n }\n walk(element, scope.presentation)\n pieces.push(current)\n return pieces.map(collapseWhitespace).filter((piece) => piece.runs.length > 0)\n}\n\nexport function textInfo(\n element: Element,\n scope: Scope,\n pathIndex: number\n): Omit<SVGTextInfo, 'elements'> | null {\n const pieces = collectTextPieces(element, scope)\n if (pieces.length === 0) return null\n return {\n pieces,\n transform: scope.transform,\n clipPaths: scope.clipPaths.length > 0 ? scope.clipPaths : undefined,\n pathIndex\n }\n}\n"],"mappings":";;;AAeA,MAAM,oBAAoB;AAC1B,MAAM,mCAAmB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAKD,MAAM,QAAQ;CAAC;CAAK;CAAK;AAAI;AA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,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,IAAI,OAAO,IAAI;KAC1E,QAAQ,OAAO,KAAK;KACpB,MAAM,CAAC;IACT;GACF;GACA,KAAK,OAAO,KAAK;EACnB;CACF;CACA,KAAK,SAAS,MAAM,YAAY;CAChC,OAAO,KAAK,OAAO;CACnB,OAAO,OAAO,IAAI,kBAAkB,CAAC,CAAC,QAAQ,UAAU,MAAM,KAAK,SAAS,CAAC;AAC/E;AAEA,SAAgB,SACd,SACA,OACA,WACsC;CACtC,MAAM,SAAS,kBAAkB,SAAS,KAAK;CAC/C,IAAI,OAAO,WAAW,GAAG,OAAO;CAChC,OAAO;EACL;EACA,WAAW,MAAM;EACjB,WAAW,MAAM,UAAU,SAAS,IAAI,MAAM,YAAY,KAAA;EAC1D;CACF;AACF"}
|
package/dist/icons/svg.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IconData, IconPathInfo,
|
|
1
|
+
import { IconData, IconPathInfo, SVGTextInfo } from "./types.js";
|
|
2
|
+
import { IconifyIcon } from "@iconify/utils";
|
|
2
3
|
//#region src/icons/svg.d.ts
|
|
3
4
|
interface SVGElementInput {
|
|
4
5
|
type: string;
|
|
@@ -16,9 +17,13 @@ declare function extractSVGContent(svgBody: string): SVGContent;
|
|
|
16
17
|
declare function isSVGPathShown(path: Pick<IconPathInfo, 'elements'>): boolean;
|
|
17
18
|
/** The shapes an SVG shows, for drawing it as one icon rather than importing its layers. */
|
|
18
19
|
declare function extractPaths(svgBody: string): IconPathInfo[];
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* An Iconify icon at `size`. Iconify's own rendering applies its box, defaulting to 16, and any
|
|
22
|
+
* turn or flip, before the shapes are placed in the icon box as SVG import places them.
|
|
23
|
+
*/
|
|
24
|
+
declare function buildIconData(icon: IconifyIcon, prefix: string, iconName: string, size: number): IconData;
|
|
20
25
|
/** Scale extracted SVG path info into IconData paths (shared by buildIconData and design-jsx <svg>). */
|
|
21
|
-
declare function scalePathInfos(pathInfos: IconPathInfo[], scaleX: number, scaleY: number): IconData['paths'];
|
|
26
|
+
declare function scalePathInfos(pathInfos: IconPathInfo[], scaleX: number, scaleY: number, offsetX?: number, offsetY?: number): IconData['paths'];
|
|
22
27
|
//#endregion
|
|
23
28
|
export { SVGContent, buildIconData, extractPaths, extractPathsFromElements, extractSVGContent, isSVGPathShown, scalePathInfos };
|
|
24
29
|
//# sourceMappingURL=svg.d.ts.map
|
package/dist/icons/svg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.d.ts","names":[],"sources":["../../src/icons/svg.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.d.ts","names":[],"sources":["../../src/icons/svg.ts"],"mappings":";;;UA6BU;EACR;EACA,OAAO,SAAS;EAChB,oBAAoB;;;UAoPL;EACf,OAAO;EACP,OAAO;;iBA2BO,yBACd,mBAAmB,mBACnB,YAAW,SAAS,2BACnB;iBAQa,kBAAkB,kBAAkB;;iBAMpC,eAAe,MAAM,KAAK;;iBAK1B,aAAa,kBAAkB;;;;;iBAQ/B,cACd,MAAM,aACN,gBACA,kBACA,eACC;;iBAsCa,eACd,WAAW,gBACX,gBACA,gBACA,kBACA,mBACC"}
|