@antv/infographic 0.1.2 → 0.1.4
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/README.md +26 -2
- package/README.zh-CN.md +26 -3
- package/dist/infographic.min.js +491 -81
- package/dist/infographic.min.js.map +1 -1
- package/esm/constants/components.d.ts +1 -0
- package/esm/constants/components.js +1 -0
- package/esm/constants/element.d.ts +17 -6
- package/esm/constants/index.d.ts +3 -0
- package/esm/constants/index.js +3 -0
- package/esm/constants/service.d.ts +1 -0
- package/esm/constants/service.js +1 -0
- package/esm/constants/shape.d.ts +16 -0
- package/esm/designs/components/Btn.js +2 -2
- package/esm/designs/components/BtnsGroup.js +1 -1
- package/esm/designs/components/Illus.js +2 -2
- package/esm/designs/components/ItemDesc.js +1 -2
- package/esm/designs/components/ItemIcon.js +1 -1
- package/esm/designs/components/ItemLabel.js +1 -2
- package/esm/designs/components/ItemValue.js +1 -2
- package/esm/designs/components/ItemsGroup.js +1 -1
- package/esm/designs/components/Title.js +2 -5
- package/esm/designs/items/CandyCardLite.js +1 -1
- package/esm/designs/items/CircularProgress.js +2 -1
- package/esm/designs/items/HorizontalIconArrow.js +1 -2
- package/esm/designs/items/HorizontalIconLine.js +1 -1
- package/esm/designs/items/IconBadge.js +1 -1
- package/esm/designs/items/LinedText.d.ts +12 -0
- package/esm/designs/items/LinedText.js +57 -0
- package/esm/designs/items/PlainText.d.ts +1 -0
- package/esm/designs/items/PlainText.js +16 -3
- package/esm/designs/items/QuarterCircular.js +1 -31
- package/esm/designs/items/index.d.ts +1 -0
- package/esm/designs/items/index.js +1 -0
- package/esm/designs/layouts/Align.js +31 -45
- package/esm/designs/layouts/Flex.js +33 -29
- package/esm/designs/structures/chart-bar.d.ts +15 -0
- package/esm/designs/structures/chart-bar.js +99 -0
- package/esm/designs/structures/chart-line.d.ts +12 -0
- package/esm/designs/structures/chart-line.js +164 -0
- package/esm/designs/structures/chart-pie.d.ts +9 -0
- package/esm/designs/structures/chart-pie.js +127 -0
- package/esm/designs/structures/chart-wordcloud.d.ts +11 -0
- package/esm/designs/structures/chart-wordcloud.js +156 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
- package/esm/designs/structures/hierarchy-mindmap.d.ts +24 -0
- package/esm/designs/structures/hierarchy-mindmap.js +199 -0
- package/esm/designs/structures/hierarchy-tree.d.ts +2 -0
- package/esm/designs/structures/hierarchy-tree.js +179 -50
- package/esm/designs/structures/index.d.ts +6 -0
- package/esm/designs/structures/index.js +6 -0
- package/esm/designs/structures/list-sector.js +1 -1
- package/esm/designs/structures/sequence-circular.js +1 -1
- package/esm/designs/structures/sequence-cylinders-3d.js +4 -4
- package/esm/designs/structures/sequence-roadmap-vertical.js +1 -1
- package/esm/designs/structures/sequence-stairs-front.d.ts +8 -0
- package/esm/designs/structures/sequence-stairs-front.js +116 -0
- package/esm/designs/structures/sequence-zigzag-pucks-3d.js +5 -5
- package/esm/designs/types.d.ts +8 -0
- package/esm/editor/commands/Batch.d.ts +11 -0
- package/esm/editor/commands/Batch.js +21 -0
- package/esm/editor/commands/UpdateElement.d.ts +16 -0
- package/esm/editor/commands/UpdateElement.js +83 -0
- package/esm/editor/commands/UpdateOptions.d.ts +14 -0
- package/esm/editor/commands/UpdateOptions.js +25 -0
- package/esm/editor/commands/UpdateText.d.ts +16 -0
- package/esm/editor/commands/UpdateText.js +40 -0
- package/esm/editor/commands/index.d.ts +4 -0
- package/esm/editor/commands/index.js +4 -0
- package/esm/editor/editor.d.ts +16 -0
- package/esm/editor/editor.js +50 -0
- package/esm/editor/index.d.ts +4 -0
- package/esm/editor/index.js +3 -0
- package/esm/editor/interactions/base.d.ts +12 -0
- package/esm/editor/interactions/base.js +5 -0
- package/esm/editor/interactions/brush-select.d.ts +23 -0
- package/esm/editor/interactions/brush-select.js +167 -0
- package/esm/editor/interactions/click-select.d.ts +12 -0
- package/esm/editor/interactions/click-select.js +67 -0
- package/esm/editor/interactions/dblclick-edit-text.d.ts +10 -0
- package/esm/editor/interactions/dblclick-edit-text.js +204 -0
- package/esm/editor/interactions/drag-element.d.ts +41 -0
- package/esm/editor/interactions/drag-element.js +391 -0
- package/esm/editor/interactions/hotkey-history.d.ts +10 -0
- package/esm/editor/interactions/hotkey-history.js +27 -0
- package/esm/editor/interactions/index.d.ts +8 -0
- package/esm/editor/interactions/index.js +8 -0
- package/esm/editor/interactions/select-highlight.d.ts +16 -0
- package/esm/editor/interactions/select-highlight.js +99 -0
- package/esm/editor/interactions/zoom-wheel.d.ts +8 -0
- package/esm/editor/interactions/zoom-wheel.js +46 -0
- package/esm/editor/managers/command.d.ts +19 -0
- package/esm/editor/managers/command.js +63 -0
- package/esm/editor/managers/index.d.ts +4 -0
- package/esm/editor/managers/index.js +4 -0
- package/esm/editor/managers/interaction.d.ts +33 -0
- package/esm/editor/managers/interaction.js +196 -0
- package/esm/editor/managers/plugin.d.ts +14 -0
- package/esm/editor/managers/plugin.js +45 -0
- package/esm/editor/managers/state.d.ts +22 -0
- package/esm/editor/managers/state.js +141 -0
- package/esm/editor/plugins/base.d.ts +12 -0
- package/esm/editor/plugins/base.js +5 -0
- package/esm/editor/plugins/edit-bar/components/button.d.ts +12 -0
- package/esm/editor/plugins/edit-bar/components/button.js +53 -0
- package/esm/editor/plugins/edit-bar/components/color-picker.d.ts +10 -0
- package/esm/editor/plugins/edit-bar/components/color-picker.js +351 -0
- package/esm/editor/plugins/edit-bar/components/icons.d.ts +26 -0
- package/esm/editor/plugins/edit-bar/components/icons.js +30 -0
- package/esm/editor/plugins/edit-bar/components/index.d.ts +5 -0
- package/esm/editor/plugins/edit-bar/components/index.js +5 -0
- package/esm/editor/plugins/edit-bar/components/popover.d.ts +23 -0
- package/esm/editor/plugins/edit-bar/components/popover.js +378 -0
- package/esm/editor/plugins/edit-bar/components/select.d.ts +22 -0
- package/esm/editor/plugins/edit-bar/components/select.js +201 -0
- package/esm/editor/plugins/edit-bar/edit-bar.d.ts +32 -0
- package/esm/editor/plugins/edit-bar/edit-bar.js +211 -0
- package/esm/editor/plugins/edit-bar/edit-items/align-elements.d.ts +2 -0
- package/esm/editor/plugins/edit-bar/edit-items/align-elements.js +312 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-align.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-align.js +81 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-color.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-color.js +77 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-family.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-family.js +115 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-size.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/edit-items/font-size.js +88 -0
- package/esm/editor/plugins/edit-bar/edit-items/icon-color.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/edit-items/icon-color.js +77 -0
- package/esm/editor/plugins/edit-bar/edit-items/index.d.ts +7 -0
- package/esm/editor/plugins/edit-bar/edit-items/index.js +6 -0
- package/esm/editor/plugins/edit-bar/edit-items/types.d.ts +3 -0
- package/esm/editor/plugins/edit-bar/index.d.ts +4 -0
- package/esm/editor/plugins/edit-bar/index.js +2 -0
- package/esm/editor/plugins/edit-bar/utils.d.ts +4 -0
- package/esm/editor/plugins/edit-bar/utils.js +14 -0
- package/esm/editor/plugins/index.d.ts +3 -0
- package/esm/editor/plugins/index.js +3 -0
- package/esm/editor/plugins/resize-element.d.ts +45 -0
- package/esm/editor/plugins/resize-element.js +393 -0
- package/esm/editor/types/command.d.ts +28 -0
- package/esm/editor/types/command.js +1 -0
- package/esm/editor/types/editor.d.ts +4 -0
- package/esm/editor/types/editor.js +1 -0
- package/esm/editor/types/index.d.ts +7 -0
- package/esm/editor/types/index.js +1 -0
- package/esm/editor/types/interaction.d.ts +44 -0
- package/esm/editor/types/interaction.js +1 -0
- package/esm/editor/types/plugin.d.ts +30 -0
- package/esm/editor/types/plugin.js +1 -0
- package/esm/editor/types/selection.d.ts +2 -0
- package/esm/editor/types/selection.js +1 -0
- package/esm/editor/types/shape.d.ts +16 -0
- package/esm/editor/types/shape.js +1 -0
- package/esm/editor/types/state.d.ts +57 -0
- package/esm/editor/types/state.js +1 -0
- package/esm/editor/utils/click-handler.d.ts +28 -0
- package/esm/editor/utils/click-handler.js +97 -0
- package/esm/editor/utils/coordinate.d.ts +6 -0
- package/esm/editor/utils/coordinate.js +31 -0
- package/esm/editor/utils/data.d.ts +10 -0
- package/esm/editor/utils/data.js +18 -0
- package/esm/editor/utils/element.d.ts +2 -0
- package/esm/editor/utils/element.js +9 -0
- package/esm/editor/utils/event.d.ts +3 -0
- package/esm/editor/utils/event.js +63 -0
- package/esm/editor/utils/extension.d.ts +13 -0
- package/esm/editor/utils/extension.js +39 -0
- package/esm/editor/utils/hotkey.d.ts +20 -0
- package/esm/editor/utils/hotkey.js +109 -0
- package/esm/editor/utils/index.d.ts +7 -0
- package/esm/editor/utils/index.js +7 -0
- package/esm/exporter/svg.js +7 -5
- package/esm/index.d.ts +7 -2
- package/esm/index.js +3 -0
- package/esm/jsx/components/Polygon.js +2 -1
- package/esm/jsx/components/Text.js +66 -68
- package/esm/options/parser.d.ts +1 -1
- package/esm/options/parser.js +33 -15
- package/esm/options/types.d.ts +15 -2
- package/esm/renderer/composites/background.js +2 -2
- package/esm/renderer/composites/button.js +4 -3
- package/esm/renderer/composites/icon.d.ts +1 -1
- package/esm/renderer/composites/icon.js +3 -1
- package/esm/renderer/composites/illus.js +1 -1
- package/esm/renderer/composites/text.js +2 -1
- package/esm/renderer/renderer.js +3 -2
- package/esm/renderer/stylize/rough.js +3 -7
- package/esm/renderer/types/index.d.ts +0 -1
- package/esm/resource/loader.d.ts +2 -2
- package/esm/resource/loader.js +22 -11
- package/esm/resource/loaders/index.d.ts +1 -0
- package/esm/resource/loaders/index.js +1 -0
- package/esm/resource/loaders/remote.d.ts +1 -1
- package/esm/resource/loaders/remote.js +10 -2
- package/esm/resource/loaders/search.d.ts +1 -0
- package/esm/resource/loaders/search.js +51 -0
- package/esm/resource/types/index.d.ts +1 -0
- package/esm/resource/types/resource.d.ts +8 -1
- package/esm/resource/types/scene.d.ts +1 -0
- package/esm/resource/types/scene.js +1 -0
- package/esm/resource/utils/data-uri.js +20 -11
- package/esm/resource/utils/index.d.ts +0 -1
- package/esm/resource/utils/index.js +0 -1
- package/esm/resource/utils/parser.js +92 -1
- package/esm/resource/utils/ref.js +3 -3
- package/esm/runtime/Infographic.d.ts +14 -7
- package/esm/runtime/Infographic.js +70 -10
- package/esm/runtime/options.d.ts +2 -0
- package/esm/runtime/options.js +24 -0
- package/esm/runtime/utils.d.ts +4 -0
- package/esm/runtime/utils.js +38 -0
- package/esm/syntax/index.d.ts +3 -0
- package/esm/syntax/index.js +101 -0
- package/esm/syntax/mapper.d.ts +3 -0
- package/esm/syntax/mapper.js +238 -0
- package/esm/syntax/parser.d.ts +14 -0
- package/esm/syntax/parser.js +142 -0
- package/esm/syntax/schema.d.ts +6 -0
- package/esm/syntax/schema.js +74 -0
- package/esm/syntax/types.d.ts +61 -0
- package/esm/syntax/types.js +1 -0
- package/esm/templates/built-in.js +116 -1
- package/esm/templates/hierarchy-mindmap.d.ts +2 -0
- package/esm/templates/hierarchy-mindmap.js +61 -0
- package/esm/templates/hierarchy-tree.js +25 -11
- package/esm/templates/sequence-stairs.d.ts +2 -0
- package/esm/templates/sequence-stairs.js +42 -0
- package/esm/templates/word-cloud.d.ts +2 -0
- package/esm/templates/word-cloud.js +19 -0
- package/esm/themes/types.d.ts +1 -1
- package/esm/types/attrs.d.ts +15 -13
- package/esm/types/data.d.ts +2 -0
- package/esm/types/element.d.ts +1 -1
- package/esm/types/event.d.ts +6 -0
- package/esm/types/event.js +1 -0
- package/esm/types/index.d.ts +2 -0
- package/esm/{renderer/types → types}/text.d.ts +0 -1
- package/esm/types/text.js +1 -0
- package/esm/utils/attrs.d.ts +1 -0
- package/esm/utils/attrs.js +9 -0
- package/esm/utils/design.d.ts +2 -0
- package/esm/utils/design.js +10 -0
- package/esm/utils/element.d.ts +4 -0
- package/esm/utils/element.js +13 -0
- package/esm/utils/font.js +11 -1
- package/esm/utils/icon.d.ts +5 -3
- package/esm/utils/icon.js +38 -19
- package/esm/utils/index.d.ts +6 -0
- package/esm/utils/index.js +6 -0
- package/esm/utils/measure-text.d.ts +5 -0
- package/esm/utils/measure-text.js +22 -0
- package/esm/utils/recognizer.d.ts +15 -0
- package/esm/utils/recognizer.js +61 -1
- package/esm/utils/style.d.ts +1 -0
- package/esm/utils/style.js +8 -0
- package/esm/utils/text.d.ts +7 -0
- package/esm/utils/text.js +110 -35
- package/lib/constants/components.d.ts +1 -0
- package/lib/constants/components.js +4 -0
- package/lib/constants/element.d.ts +17 -6
- package/lib/constants/index.d.ts +3 -0
- package/lib/constants/index.js +3 -0
- package/lib/constants/service.d.ts +1 -0
- package/lib/constants/service.js +4 -0
- package/lib/constants/shape.d.ts +16 -0
- package/lib/designs/components/Btn.js +2 -2
- package/lib/designs/components/BtnsGroup.js +1 -1
- package/lib/designs/components/Illus.js +2 -2
- package/lib/designs/components/ItemDesc.js +1 -2
- package/lib/designs/components/ItemIcon.js +1 -1
- package/lib/designs/components/ItemLabel.js +1 -2
- package/lib/designs/components/ItemValue.js +1 -2
- package/lib/designs/components/ItemsGroup.js +1 -1
- package/lib/designs/components/Title.js +2 -5
- package/lib/designs/items/CandyCardLite.js +1 -1
- package/lib/designs/items/CircularProgress.js +2 -1
- package/lib/designs/items/HorizontalIconArrow.js +1 -2
- package/lib/designs/items/HorizontalIconLine.js +1 -1
- package/lib/designs/items/IconBadge.js +1 -1
- package/lib/designs/items/LinedText.d.ts +12 -0
- package/lib/designs/items/LinedText.js +61 -0
- package/lib/designs/items/PlainText.d.ts +1 -0
- package/lib/designs/items/PlainText.js +16 -3
- package/lib/designs/items/QuarterCircular.js +1 -31
- package/lib/designs/items/index.d.ts +1 -0
- package/lib/designs/items/index.js +1 -0
- package/lib/designs/layouts/Align.js +31 -45
- package/lib/designs/layouts/Flex.js +33 -29
- package/lib/designs/structures/chart-bar.d.ts +15 -0
- package/lib/designs/structures/chart-bar.js +103 -0
- package/lib/designs/structures/chart-line.d.ts +12 -0
- package/lib/designs/structures/chart-line.js +168 -0
- package/lib/designs/structures/chart-pie.d.ts +9 -0
- package/lib/designs/structures/chart-pie.js +131 -0
- package/lib/designs/structures/chart-wordcloud.d.ts +11 -0
- package/lib/designs/structures/chart-wordcloud.js +160 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
- package/lib/designs/structures/hierarchy-mindmap.d.ts +24 -0
- package/lib/designs/structures/hierarchy-mindmap.js +203 -0
- package/lib/designs/structures/hierarchy-tree.d.ts +2 -0
- package/lib/designs/structures/hierarchy-tree.js +179 -50
- package/lib/designs/structures/index.d.ts +6 -0
- package/lib/designs/structures/index.js +6 -0
- package/lib/designs/structures/list-sector.js +1 -1
- package/lib/designs/structures/sequence-circular.js +1 -1
- package/lib/designs/structures/sequence-cylinders-3d.js +4 -4
- package/lib/designs/structures/sequence-roadmap-vertical.js +1 -1
- package/lib/designs/structures/sequence-stairs-front.d.ts +8 -0
- package/lib/designs/structures/sequence-stairs-front.js +120 -0
- package/lib/designs/structures/sequence-zigzag-pucks-3d.js +5 -5
- package/lib/designs/types.d.ts +8 -0
- package/lib/editor/commands/Batch.d.ts +11 -0
- package/lib/editor/commands/Batch.js +25 -0
- package/lib/editor/commands/UpdateElement.d.ts +16 -0
- package/lib/editor/commands/UpdateElement.js +87 -0
- package/lib/editor/commands/UpdateOptions.d.ts +14 -0
- package/lib/editor/commands/UpdateOptions.js +29 -0
- package/lib/editor/commands/UpdateText.d.ts +16 -0
- package/lib/editor/commands/UpdateText.js +44 -0
- package/lib/editor/commands/index.d.ts +4 -0
- package/lib/editor/commands/index.js +20 -0
- package/lib/editor/editor.d.ts +16 -0
- package/lib/editor/editor.js +54 -0
- package/lib/editor/index.d.ts +4 -0
- package/lib/editor/index.js +21 -0
- package/lib/editor/interactions/base.d.ts +12 -0
- package/lib/editor/interactions/base.js +9 -0
- package/lib/editor/interactions/brush-select.d.ts +23 -0
- package/lib/editor/interactions/brush-select.js +171 -0
- package/lib/editor/interactions/click-select.d.ts +12 -0
- package/lib/editor/interactions/click-select.js +71 -0
- package/lib/editor/interactions/dblclick-edit-text.d.ts +10 -0
- package/lib/editor/interactions/dblclick-edit-text.js +208 -0
- package/lib/editor/interactions/drag-element.d.ts +41 -0
- package/lib/editor/interactions/drag-element.js +395 -0
- package/lib/editor/interactions/hotkey-history.d.ts +10 -0
- package/lib/editor/interactions/hotkey-history.js +31 -0
- package/lib/editor/interactions/index.d.ts +8 -0
- package/lib/editor/interactions/index.js +19 -0
- package/lib/editor/interactions/select-highlight.d.ts +16 -0
- package/lib/editor/interactions/select-highlight.js +103 -0
- package/lib/editor/interactions/zoom-wheel.d.ts +8 -0
- package/lib/editor/interactions/zoom-wheel.js +50 -0
- package/lib/editor/managers/command.d.ts +19 -0
- package/lib/editor/managers/command.js +67 -0
- package/lib/editor/managers/index.d.ts +4 -0
- package/lib/editor/managers/index.js +20 -0
- package/lib/editor/managers/interaction.d.ts +33 -0
- package/lib/editor/managers/interaction.js +200 -0
- package/lib/editor/managers/plugin.d.ts +14 -0
- package/lib/editor/managers/plugin.js +49 -0
- package/lib/editor/managers/state.d.ts +22 -0
- package/lib/editor/managers/state.js +145 -0
- package/lib/editor/plugins/base.d.ts +12 -0
- package/lib/editor/plugins/base.js +9 -0
- package/lib/editor/plugins/edit-bar/components/button.d.ts +12 -0
- package/lib/editor/plugins/edit-bar/components/button.js +57 -0
- package/lib/editor/plugins/edit-bar/components/color-picker.d.ts +10 -0
- package/lib/editor/plugins/edit-bar/components/color-picker.js +354 -0
- package/lib/editor/plugins/edit-bar/components/icons.d.ts +26 -0
- package/lib/editor/plugins/edit-bar/components/icons.js +33 -0
- package/lib/editor/plugins/edit-bar/components/index.d.ts +5 -0
- package/lib/editor/plugins/edit-bar/components/index.js +21 -0
- package/lib/editor/plugins/edit-bar/components/popover.d.ts +23 -0
- package/lib/editor/plugins/edit-bar/components/popover.js +381 -0
- package/lib/editor/plugins/edit-bar/components/select.d.ts +22 -0
- package/lib/editor/plugins/edit-bar/components/select.js +204 -0
- package/lib/editor/plugins/edit-bar/edit-bar.d.ts +32 -0
- package/lib/editor/plugins/edit-bar/edit-bar.js +215 -0
- package/lib/editor/plugins/edit-bar/edit-items/align-elements.d.ts +2 -0
- package/lib/editor/plugins/edit-bar/edit-items/align-elements.js +316 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-align.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-align.js +85 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-color.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-color.js +81 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-family.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-family.js +119 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-size.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/edit-items/font-size.js +92 -0
- package/lib/editor/plugins/edit-bar/edit-items/icon-color.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/edit-items/icon-color.js +81 -0
- package/lib/editor/plugins/edit-bar/edit-items/index.d.ts +7 -0
- package/lib/editor/plugins/edit-bar/edit-items/index.js +22 -0
- package/lib/editor/plugins/edit-bar/edit-items/types.d.ts +3 -0
- package/lib/editor/plugins/edit-bar/index.d.ts +4 -0
- package/lib/editor/plugins/edit-bar/index.js +9 -0
- package/lib/editor/plugins/edit-bar/utils.d.ts +4 -0
- package/lib/editor/plugins/edit-bar/utils.js +17 -0
- package/lib/editor/plugins/index.d.ts +3 -0
- package/lib/editor/plugins/index.js +22 -0
- package/lib/editor/plugins/resize-element.d.ts +45 -0
- package/lib/editor/plugins/resize-element.js +397 -0
- package/lib/editor/types/command.d.ts +28 -0
- package/lib/editor/types/command.js +2 -0
- package/lib/editor/types/editor.d.ts +4 -0
- package/lib/editor/types/editor.js +2 -0
- package/lib/editor/types/index.d.ts +7 -0
- package/lib/editor/types/index.js +2 -0
- package/lib/editor/types/interaction.d.ts +44 -0
- package/lib/editor/types/interaction.js +2 -0
- package/lib/editor/types/plugin.d.ts +30 -0
- package/lib/editor/types/plugin.js +2 -0
- package/lib/editor/types/selection.d.ts +2 -0
- package/lib/editor/types/selection.js +2 -0
- package/lib/editor/types/shape.d.ts +16 -0
- package/lib/editor/types/shape.js +2 -0
- package/lib/editor/types/state.d.ts +57 -0
- package/lib/editor/types/state.js +2 -0
- package/lib/editor/utils/click-handler.d.ts +28 -0
- package/lib/editor/utils/click-handler.js +101 -0
- package/lib/editor/utils/coordinate.d.ts +6 -0
- package/lib/editor/utils/coordinate.js +38 -0
- package/lib/editor/utils/data.d.ts +10 -0
- package/lib/editor/utils/data.js +22 -0
- package/lib/editor/utils/element.d.ts +2 -0
- package/lib/editor/utils/element.js +12 -0
- package/lib/editor/utils/event.d.ts +3 -0
- package/lib/editor/utils/event.js +67 -0
- package/lib/editor/utils/extension.d.ts +13 -0
- package/lib/editor/utils/extension.js +43 -0
- package/lib/editor/utils/hotkey.d.ts +20 -0
- package/lib/editor/utils/hotkey.js +113 -0
- package/lib/editor/utils/index.d.ts +7 -0
- package/lib/editor/utils/index.js +23 -0
- package/lib/exporter/svg.js +6 -4
- package/lib/index.d.ts +7 -2
- package/lib/index.js +17 -1
- package/lib/jsx/components/Polygon.js +2 -1
- package/lib/jsx/components/Text.js +66 -68
- package/lib/options/parser.d.ts +1 -1
- package/lib/options/parser.js +32 -14
- package/lib/options/types.d.ts +15 -2
- package/lib/renderer/composites/background.js +1 -1
- package/lib/renderer/composites/button.js +3 -2
- package/lib/renderer/composites/icon.d.ts +1 -1
- package/lib/renderer/composites/icon.js +3 -1
- package/lib/renderer/composites/illus.js +1 -1
- package/lib/renderer/composites/text.js +2 -1
- package/lib/renderer/renderer.js +2 -1
- package/lib/renderer/stylize/rough.js +3 -7
- package/lib/renderer/types/index.d.ts +0 -1
- package/lib/resource/loader.d.ts +2 -2
- package/lib/resource/loader.js +21 -10
- package/lib/resource/loaders/index.d.ts +1 -0
- package/lib/resource/loaders/index.js +1 -0
- package/lib/resource/loaders/remote.d.ts +1 -1
- package/lib/resource/loaders/remote.js +10 -2
- package/lib/resource/loaders/search.d.ts +1 -0
- package/lib/resource/loaders/search.js +54 -0
- package/lib/resource/types/index.d.ts +1 -0
- package/lib/resource/types/resource.d.ts +8 -1
- package/lib/resource/types/scene.d.ts +1 -0
- package/lib/resource/types/scene.js +2 -0
- package/lib/resource/utils/data-uri.js +20 -11
- package/lib/resource/utils/index.d.ts +0 -1
- package/lib/resource/utils/index.js +0 -1
- package/lib/resource/utils/parser.js +92 -1
- package/lib/resource/utils/ref.js +4 -4
- package/lib/runtime/Infographic.d.ts +14 -7
- package/lib/runtime/Infographic.js +73 -10
- package/lib/runtime/options.d.ts +2 -0
- package/lib/runtime/options.js +27 -0
- package/lib/runtime/utils.d.ts +4 -0
- package/lib/runtime/utils.js +43 -0
- package/lib/syntax/index.d.ts +3 -0
- package/lib/syntax/index.js +104 -0
- package/lib/syntax/mapper.d.ts +3 -0
- package/lib/syntax/mapper.js +242 -0
- package/lib/syntax/parser.d.ts +14 -0
- package/lib/syntax/parser.js +146 -0
- package/lib/syntax/schema.d.ts +6 -0
- package/lib/syntax/schema.js +77 -0
- package/lib/syntax/types.d.ts +61 -0
- package/lib/syntax/types.js +2 -0
- package/lib/templates/built-in.js +116 -1
- package/lib/templates/hierarchy-mindmap.d.ts +2 -0
- package/lib/templates/hierarchy-mindmap.js +64 -0
- package/lib/templates/hierarchy-tree.js +25 -11
- package/lib/templates/sequence-stairs.d.ts +2 -0
- package/lib/templates/sequence-stairs.js +45 -0
- package/lib/templates/word-cloud.d.ts +2 -0
- package/lib/templates/word-cloud.js +22 -0
- package/lib/themes/types.d.ts +1 -1
- package/lib/types/attrs.d.ts +15 -13
- package/lib/types/data.d.ts +2 -0
- package/lib/types/element.d.ts +1 -1
- package/lib/types/event.d.ts +6 -0
- package/lib/types/event.js +2 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/{renderer/types → types}/text.d.ts +0 -1
- package/lib/types/text.js +2 -0
- package/lib/utils/attrs.d.ts +1 -0
- package/lib/utils/attrs.js +12 -0
- package/lib/utils/design.d.ts +2 -0
- package/lib/utils/design.js +13 -0
- package/lib/utils/element.d.ts +4 -0
- package/lib/utils/element.js +18 -0
- package/lib/utils/font.js +11 -1
- package/lib/utils/icon.d.ts +5 -3
- package/lib/utils/icon.js +42 -21
- package/lib/utils/index.d.ts +6 -0
- package/lib/utils/index.js +6 -0
- package/lib/utils/measure-text.d.ts +5 -0
- package/lib/utils/measure-text.js +28 -0
- package/lib/utils/recognizer.d.ts +15 -0
- package/lib/utils/recognizer.js +72 -2
- package/lib/utils/style.d.ts +1 -0
- package/lib/utils/style.js +11 -0
- package/lib/utils/text.d.ts +7 -0
- package/lib/utils/text.js +113 -32
- package/package.json +7 -3
- package/src/constants/components.ts +1 -0
- package/src/constants/element.ts +17 -5
- package/src/constants/index.ts +3 -0
- package/src/constants/service.ts +1 -0
- package/src/constants/shape.ts +16 -0
- package/src/designs/components/Btn.tsx +3 -2
- package/src/designs/components/BtnsGroup.tsx +2 -1
- package/src/designs/components/Illus.tsx +3 -2
- package/src/designs/components/ItemDesc.tsx +2 -2
- package/src/designs/components/ItemIcon.tsx +3 -2
- package/src/designs/components/ItemLabel.tsx +2 -2
- package/src/designs/components/ItemValue.tsx +2 -2
- package/src/designs/components/ItemsGroup.tsx +2 -1
- package/src/designs/components/Title.tsx +8 -5
- package/src/designs/items/CandyCardLite.tsx +3 -3
- package/src/designs/items/CircularProgress.tsx +19 -8
- package/src/designs/items/HorizontalIconArrow.tsx +4 -5
- package/src/designs/items/HorizontalIconLine.tsx +7 -10
- package/src/designs/items/IconBadge.tsx +3 -3
- package/src/designs/items/LinedText.tsx +131 -0
- package/src/designs/items/PlainText.tsx +25 -3
- package/src/designs/items/QuarterCircular.tsx +2 -31
- package/src/designs/items/index.ts +1 -0
- package/src/designs/layouts/Align.tsx +31 -48
- package/src/designs/layouts/Flex.tsx +33 -31
- package/src/designs/structures/chart-bar.tsx +289 -0
- package/src/designs/structures/chart-line.tsx +415 -0
- package/src/designs/structures/chart-pie.tsx +298 -0
- package/src/designs/structures/chart-wordcloud.tsx +278 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.tsx +2 -2
- package/src/designs/structures/hierarchy-mindmap.tsx +394 -0
- package/src/designs/structures/hierarchy-tree.tsx +212 -59
- package/src/designs/structures/index.ts +6 -0
- package/src/designs/structures/list-sector.tsx +2 -1
- package/src/designs/structures/sequence-ascending-steps.tsx +0 -1
- package/src/designs/structures/sequence-circular.tsx +1 -1
- package/src/designs/structures/sequence-cylinders-3d.tsx +5 -5
- package/src/designs/structures/sequence-roadmap-vertical.tsx +2 -1
- package/src/designs/structures/sequence-stairs-front.tsx +291 -0
- package/src/designs/structures/sequence-zigzag-pucks-3d.tsx +18 -25
- package/src/designs/types.ts +9 -0
- package/src/editor/commands/Batch.ts +24 -0
- package/src/editor/commands/UpdateElement.ts +115 -0
- package/src/editor/commands/UpdateOptions.ts +31 -0
- package/src/editor/commands/UpdateText.ts +54 -0
- package/src/editor/commands/index.ts +4 -0
- package/src/editor/editor.ts +78 -0
- package/src/editor/index.ts +4 -0
- package/src/editor/interactions/base.ts +25 -0
- package/src/editor/interactions/brush-select.ts +204 -0
- package/src/editor/interactions/click-select.ts +72 -0
- package/src/editor/interactions/dblclick-edit-text.ts +260 -0
- package/src/editor/interactions/drag-element.ts +516 -0
- package/src/editor/interactions/hotkey-history.ts +34 -0
- package/src/editor/interactions/index.ts +8 -0
- package/src/editor/interactions/select-highlight.ts +140 -0
- package/src/editor/interactions/zoom-wheel.ts +52 -0
- package/src/editor/managers/command.ts +83 -0
- package/src/editor/managers/index.ts +4 -0
- package/src/editor/managers/interaction.ts +244 -0
- package/src/editor/managers/plugin.ts +66 -0
- package/src/editor/managers/state.ts +186 -0
- package/src/editor/plugins/base.ts +25 -0
- package/src/editor/plugins/edit-bar/components/button.ts +77 -0
- package/src/editor/plugins/edit-bar/components/color-picker.ts +397 -0
- package/src/editor/plugins/edit-bar/components/icons.ts +86 -0
- package/src/editor/plugins/edit-bar/components/index.ts +5 -0
- package/src/editor/plugins/edit-bar/components/popover.ts +446 -0
- package/src/editor/plugins/edit-bar/components/select.ts +247 -0
- package/src/editor/plugins/edit-bar/edit-bar.ts +292 -0
- package/src/editor/plugins/edit-bar/edit-items/align-elements.ts +447 -0
- package/src/editor/plugins/edit-bar/edit-items/font-align.ts +129 -0
- package/src/editor/plugins/edit-bar/edit-items/font-color.ts +101 -0
- package/src/editor/plugins/edit-bar/edit-items/font-family.ts +147 -0
- package/src/editor/plugins/edit-bar/edit-items/font-size.ts +116 -0
- package/src/editor/plugins/edit-bar/edit-items/icon-color.ts +101 -0
- package/src/editor/plugins/edit-bar/edit-items/index.ts +7 -0
- package/src/editor/plugins/edit-bar/edit-items/types.ts +9 -0
- package/src/editor/plugins/edit-bar/index.ts +18 -0
- package/src/editor/plugins/edit-bar/utils.ts +16 -0
- package/src/editor/plugins/index.ts +3 -0
- package/src/editor/plugins/resize-element.ts +518 -0
- package/src/editor/types/command.ts +32 -0
- package/src/editor/types/editor.ts +4 -0
- package/src/editor/types/index.ts +7 -0
- package/src/editor/types/interaction.ts +56 -0
- package/src/editor/types/plugin.ts +34 -0
- package/src/editor/types/selection.ts +3 -0
- package/src/editor/types/shape.ts +28 -0
- package/src/editor/types/state.ts +51 -0
- package/src/editor/utils/click-handler.ts +114 -0
- package/src/editor/utils/coordinate.ts +54 -0
- package/src/editor/utils/data.ts +30 -0
- package/src/editor/utils/element.ts +13 -0
- package/src/editor/utils/event.ts +92 -0
- package/src/editor/utils/extension.ts +45 -0
- package/src/editor/utils/hotkey.ts +139 -0
- package/src/editor/utils/index.ts +7 -0
- package/src/exporter/svg.ts +15 -5
- package/src/index.ts +16 -3
- package/src/jsx/components/Polygon.ts +2 -1
- package/src/jsx/components/Text.ts +70 -71
- package/src/options/parser.ts +57 -28
- package/src/options/types.ts +17 -2
- package/src/renderer/composites/background.ts +2 -2
- package/src/renderer/composites/button.ts +4 -3
- package/src/renderer/composites/icon.ts +3 -1
- package/src/renderer/composites/illus.ts +1 -1
- package/src/renderer/composites/text.ts +2 -1
- package/src/renderer/renderer.ts +4 -2
- package/src/renderer/stylize/rough.ts +3 -7
- package/src/renderer/types/index.ts +0 -1
- package/src/resource/loader.ts +22 -8
- package/src/resource/loaders/index.ts +1 -0
- package/src/resource/loaders/remote.ts +9 -2
- package/src/resource/loaders/search.ts +52 -0
- package/src/resource/types/index.ts +2 -1
- package/src/resource/types/resource.ts +12 -1
- package/src/resource/types/scene.ts +1 -0
- package/src/resource/utils/data-uri.ts +20 -11
- package/src/resource/utils/index.ts +0 -1
- package/src/resource/utils/parser.ts +103 -2
- package/src/resource/utils/ref.ts +3 -3
- package/src/runtime/Infographic.tsx +106 -13
- package/src/runtime/options.ts +37 -0
- package/src/runtime/utils.ts +45 -0
- package/src/syntax/index.ts +124 -0
- package/src/syntax/mapper.ts +362 -0
- package/src/syntax/parser.ts +171 -0
- package/src/syntax/schema.ts +98 -0
- package/src/syntax/types.ts +89 -0
- package/src/templates/built-in.ts +116 -1
- package/src/templates/hierarchy-mindmap.ts +129 -0
- package/src/templates/hierarchy-tree.ts +34 -11
- package/src/templates/sequence-stairs.ts +44 -0
- package/src/templates/word-cloud.ts +21 -0
- package/src/themes/types.ts +1 -1
- package/src/types/attrs.ts +17 -13
- package/src/types/data.ts +2 -0
- package/src/types/element.ts +1 -1
- package/src/types/event.ts +6 -0
- package/src/types/index.ts +2 -0
- package/src/{renderer/types → types}/text.ts +0 -1
- package/src/utils/attrs.ts +9 -0
- package/src/utils/design.ts +14 -0
- package/src/utils/element.ts +26 -0
- package/src/utils/font.ts +11 -1
- package/src/utils/icon.ts +45 -25
- package/src/utils/index.ts +6 -0
- package/src/utils/measure-text.ts +38 -0
- package/src/utils/recognizer.ts +75 -1
- package/src/utils/style.ts +8 -0
- package/src/utils/text.ts +135 -40
- package/esm/resource/types/font.d.ts +0 -12
- package/lib/resource/types/font.d.ts +0 -12
- package/src/resource/types/font.ts +0 -23
- /package/esm/{renderer/types/text.js → constants/shape.js} +0 -0
- /package/esm/{resource/types/font.js → editor/plugins/edit-bar/edit-items/types.js} +0 -0
- /package/esm/{resource/utils → utils}/hash.d.ts +0 -0
- /package/esm/{resource/utils → utils}/hash.js +0 -0
- /package/lib/{renderer/types/text.js → constants/shape.js} +0 -0
- /package/lib/{resource/types/font.js → editor/plugins/edit-bar/edit-items/types.js} +0 -0
- /package/lib/{resource/utils → utils}/hash.d.ts +0 -0
- /package/lib/{resource/utils → utils}/hash.js +0 -0
- /package/src/{resource/utils → utils}/hash.ts +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { injectStyleOnce } from '../../../../utils';
|
|
2
|
+
import type { Icon } from './icons';
|
|
3
|
+
|
|
4
|
+
export type Button = HTMLButtonElement & IconButtonHandle;
|
|
5
|
+
|
|
6
|
+
export interface IconButtonProps {
|
|
7
|
+
icon: Icon;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
activate?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IconButtonHandle {
|
|
13
|
+
activate: boolean;
|
|
14
|
+
setActivate: (activate: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const IconButton = ({
|
|
18
|
+
icon,
|
|
19
|
+
onClick,
|
|
20
|
+
activate = false,
|
|
21
|
+
}: IconButtonProps): Button => {
|
|
22
|
+
ensureIconButtonStyle();
|
|
23
|
+
|
|
24
|
+
const button = document.createElement('button');
|
|
25
|
+
button.type = 'button';
|
|
26
|
+
button.classList.add(ICON_BUTTON_CLASS);
|
|
27
|
+
if (activate) button.setAttribute('data-activate', 'true');
|
|
28
|
+
if (onClick) button.addEventListener('click', onClick);
|
|
29
|
+
|
|
30
|
+
const iconElement = icon();
|
|
31
|
+
button.appendChild(iconElement);
|
|
32
|
+
|
|
33
|
+
const setActivate = (next: boolean) => {
|
|
34
|
+
if (next) button.setAttribute('data-activate', 'true');
|
|
35
|
+
else button.removeAttribute('data-activate');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return Object.assign(button, {
|
|
39
|
+
setActivate: setActivate.bind(button),
|
|
40
|
+
activate,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const ICON_BUTTON_CLASS = 'infographic-edit-bar-icon-btn';
|
|
45
|
+
const ICON_BUTTON_STYLE_ID = 'infographic-edit-bar-icon-btn-style';
|
|
46
|
+
|
|
47
|
+
function ensureIconButtonStyle() {
|
|
48
|
+
injectStyleOnce(
|
|
49
|
+
ICON_BUTTON_STYLE_ID,
|
|
50
|
+
`
|
|
51
|
+
.${ICON_BUTTON_CLASS} {
|
|
52
|
+
padding: 0;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
width: 32px;
|
|
57
|
+
height: 32px;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
color: #000000d9;
|
|
60
|
+
border: none;
|
|
61
|
+
border-radius: 6px;
|
|
62
|
+
background-color: #fff;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
transition: color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
|
|
65
|
+
}
|
|
66
|
+
.${ICON_BUTTON_CLASS}:hover {
|
|
67
|
+
background-color: #f5f5f5;
|
|
68
|
+
}
|
|
69
|
+
.${ICON_BUTTON_CLASS}:active {
|
|
70
|
+
background-color: #d9d9d9;
|
|
71
|
+
}
|
|
72
|
+
.${ICON_BUTTON_CLASS}[data-activate="true"] {
|
|
73
|
+
background-color: #d9d9d9;
|
|
74
|
+
}
|
|
75
|
+
`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { parse } from 'culori';
|
|
2
|
+
|
|
3
|
+
import { injectStyleOnce } from '../../../../utils';
|
|
4
|
+
|
|
5
|
+
export type ColorPickerProps = {
|
|
6
|
+
value?: string;
|
|
7
|
+
swatches?: string[];
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ColorPickerHandle = {
|
|
12
|
+
setValue: (value?: string) => void;
|
|
13
|
+
destroy: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const COLOR_PICKER_CLASS = 'infographic-color-picker';
|
|
17
|
+
const COLOR_PICKER_SWATCHES_CLASS = `${COLOR_PICKER_CLASS}__swatches`;
|
|
18
|
+
const COLOR_PICKER_SWATCH_CLASS = `${COLOR_PICKER_CLASS}__swatch`;
|
|
19
|
+
const COLOR_PICKER_CONTROLS_CLASS = `${COLOR_PICKER_CLASS}__controls`;
|
|
20
|
+
const COLOR_PICKER_INPUT_CLASS = `${COLOR_PICKER_CLASS}__input`;
|
|
21
|
+
const COLOR_PICKER_FORMAT_CLASS = `${COLOR_PICKER_CLASS}__format`;
|
|
22
|
+
const COLOR_PICKER_SWITCH_CLASS = `${COLOR_PICKER_CLASS}__format-switch`;
|
|
23
|
+
const COLOR_PICKER_SWITCH_KNOB_CLASS = `${COLOR_PICKER_CLASS}__format-switch-knob`;
|
|
24
|
+
const COLOR_PICKER_SWITCH_LABEL_CLASS = `${COLOR_PICKER_CLASS}__format-switch-label`;
|
|
25
|
+
const COLOR_PICKER_STYLE_ID = 'infographic-color-picker-style';
|
|
26
|
+
|
|
27
|
+
const DEFAULT_COLOR = '#1f1f1f';
|
|
28
|
+
const DEFAULT_SWATCHES = [
|
|
29
|
+
'#000000',
|
|
30
|
+
'#1f1f1f',
|
|
31
|
+
'#434343',
|
|
32
|
+
'#595959',
|
|
33
|
+
'#8c8c8c',
|
|
34
|
+
'#bfbfbf',
|
|
35
|
+
'#d9d9d9',
|
|
36
|
+
'#f0f0f0',
|
|
37
|
+
'#ffffff',
|
|
38
|
+
'#1677ff',
|
|
39
|
+
'#2f54eb',
|
|
40
|
+
'#91caff',
|
|
41
|
+
'#13c2c2',
|
|
42
|
+
'#36cfc9',
|
|
43
|
+
'#52c41a',
|
|
44
|
+
'#73d13d',
|
|
45
|
+
'#fadb14',
|
|
46
|
+
'#ffd666',
|
|
47
|
+
'#fa8c16',
|
|
48
|
+
'#fa541c',
|
|
49
|
+
'#f5222d',
|
|
50
|
+
'#ff7875',
|
|
51
|
+
'#eb2f96',
|
|
52
|
+
'#ffadd2',
|
|
53
|
+
'#722ed1',
|
|
54
|
+
'#9254de',
|
|
55
|
+
'rgba(0, 0, 0, 0.65)',
|
|
56
|
+
'rgba(255, 255, 255, 0.85)',
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
type ColorFormat = 'hexa' | 'rgba';
|
|
60
|
+
type RgbaColor = { r: number; g: number; b: number; a: number };
|
|
61
|
+
|
|
62
|
+
export function ColorPicker(
|
|
63
|
+
props: ColorPickerProps,
|
|
64
|
+
): HTMLDivElement & ColorPickerHandle {
|
|
65
|
+
if (typeof document === 'undefined') {
|
|
66
|
+
throw new Error('ColorPicker can only be used in the browser.');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
ensureColorPickerStyles();
|
|
70
|
+
|
|
71
|
+
const container = document.createElement('div');
|
|
72
|
+
container.classList.add(COLOR_PICKER_CLASS);
|
|
73
|
+
|
|
74
|
+
const swatchContainer = document.createElement('div');
|
|
75
|
+
swatchContainer.classList.add(COLOR_PICKER_SWATCHES_CLASS);
|
|
76
|
+
container.appendChild(swatchContainer);
|
|
77
|
+
|
|
78
|
+
const controls = document.createElement('div');
|
|
79
|
+
controls.classList.add(COLOR_PICKER_CONTROLS_CLASS);
|
|
80
|
+
container.appendChild(controls);
|
|
81
|
+
|
|
82
|
+
const input = document.createElement('input');
|
|
83
|
+
input.type = 'text';
|
|
84
|
+
input.spellcheck = false;
|
|
85
|
+
input.classList.add(COLOR_PICKER_INPUT_CLASS);
|
|
86
|
+
controls.appendChild(input);
|
|
87
|
+
|
|
88
|
+
const formatToggle = document.createElement('div');
|
|
89
|
+
formatToggle.classList.add(COLOR_PICKER_FORMAT_CLASS);
|
|
90
|
+
controls.appendChild(formatToggle);
|
|
91
|
+
|
|
92
|
+
const formatSwitch = document.createElement('button');
|
|
93
|
+
formatSwitch.type = 'button';
|
|
94
|
+
formatSwitch.classList.add(COLOR_PICKER_SWITCH_CLASS);
|
|
95
|
+
formatSwitch.appendChild(createSwitchLabel('HEXA'));
|
|
96
|
+
const switchKnob = document.createElement('span');
|
|
97
|
+
switchKnob.classList.add(COLOR_PICKER_SWITCH_KNOB_CLASS);
|
|
98
|
+
formatSwitch.appendChild(switchKnob);
|
|
99
|
+
formatSwitch.appendChild(createSwitchLabel('RGBA'));
|
|
100
|
+
formatToggle.appendChild(formatSwitch);
|
|
101
|
+
|
|
102
|
+
let format: ColorFormat = 'hexa';
|
|
103
|
+
let color: RgbaColor = parseColor(props.value) ??
|
|
104
|
+
parseColor(DEFAULT_COLOR) ?? {
|
|
105
|
+
r: 31,
|
|
106
|
+
g: 31,
|
|
107
|
+
b: 31,
|
|
108
|
+
a: 1,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const swatchButtons: HTMLButtonElement[] = [];
|
|
112
|
+
|
|
113
|
+
const swatches = props.swatches?.length ? props.swatches : DEFAULT_SWATCHES;
|
|
114
|
+
swatches.forEach((value) => {
|
|
115
|
+
const parsed = parseColor(value);
|
|
116
|
+
if (!parsed) return;
|
|
117
|
+
const button = document.createElement('button');
|
|
118
|
+
button.type = 'button';
|
|
119
|
+
button.classList.add(COLOR_PICKER_SWATCH_CLASS);
|
|
120
|
+
button.style.setProperty('--swatch-color', formatColor(parsed, 'rgba'));
|
|
121
|
+
button.dataset.colorKey = colorKey(parsed);
|
|
122
|
+
button.addEventListener('click', () => {
|
|
123
|
+
setColor(parsed);
|
|
124
|
+
});
|
|
125
|
+
swatchContainer.appendChild(button);
|
|
126
|
+
swatchButtons.push(button);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
formatSwitch.addEventListener('click', () =>
|
|
130
|
+
setFormat(format === 'hexa' ? 'rgba' : 'hexa', true),
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
input.addEventListener('change', handleInput);
|
|
134
|
+
input.addEventListener('keydown', (event) => {
|
|
135
|
+
if (event.key === 'Enter') handleInput();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
syncUI();
|
|
139
|
+
|
|
140
|
+
const api: ColorPickerHandle = {
|
|
141
|
+
setValue: (value) => {
|
|
142
|
+
const parsed = parseColor(value);
|
|
143
|
+
if (!parsed) {
|
|
144
|
+
input.setAttribute('data-invalid', 'true');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
input.removeAttribute('data-invalid');
|
|
148
|
+
setColor(parsed, false);
|
|
149
|
+
},
|
|
150
|
+
destroy: () => {
|
|
151
|
+
container.remove();
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return Object.assign(container, api);
|
|
156
|
+
|
|
157
|
+
function handleInput() {
|
|
158
|
+
const parsed = parseColor(input.value);
|
|
159
|
+
if (!parsed) {
|
|
160
|
+
input.setAttribute('data-invalid', 'true');
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
input.removeAttribute('data-invalid');
|
|
164
|
+
setColor(parsed);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function setFormat(next: ColorFormat, emitChange: boolean) {
|
|
168
|
+
if (format === next) return;
|
|
169
|
+
format = next;
|
|
170
|
+
syncUI();
|
|
171
|
+
if (emitChange) {
|
|
172
|
+
props.onChange?.(formatColor(color, format));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function setColor(next: RgbaColor, emitChange = true) {
|
|
177
|
+
if (isSameColor(color, next)) {
|
|
178
|
+
syncUI();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
color = next;
|
|
182
|
+
syncUI();
|
|
183
|
+
if (emitChange) {
|
|
184
|
+
props.onChange?.(formatColor(color, format));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function syncUI() {
|
|
189
|
+
input.value = formatColor(color, format);
|
|
190
|
+
updateSwatches();
|
|
191
|
+
updateFormatButtons();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function updateSwatches() {
|
|
195
|
+
const key = colorKey(color);
|
|
196
|
+
swatchButtons.forEach((btn) => {
|
|
197
|
+
if (btn.dataset.colorKey === key) {
|
|
198
|
+
btn.setAttribute('data-active', 'true');
|
|
199
|
+
} else {
|
|
200
|
+
btn.removeAttribute('data-active');
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function updateFormatButtons() {
|
|
206
|
+
if (format === 'rgba') {
|
|
207
|
+
formatSwitch.setAttribute('data-format', 'rgba');
|
|
208
|
+
} else {
|
|
209
|
+
formatSwitch.setAttribute('data-format', 'hexa');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function parseColor(value?: string | null): RgbaColor | undefined {
|
|
215
|
+
if (!value) return undefined;
|
|
216
|
+
const parsed = parse(value);
|
|
217
|
+
if (!parsed || typeof (parsed as any).r !== 'number') return undefined;
|
|
218
|
+
const rgb = parsed as { r: number; g: number; b: number; alpha?: number };
|
|
219
|
+
return {
|
|
220
|
+
r: clampByte(rgb.r),
|
|
221
|
+
g: clampByte(rgb.g),
|
|
222
|
+
b: clampByte(rgb.b),
|
|
223
|
+
a: clamp01(rgb.alpha ?? 1),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function formatColor(color: RgbaColor, format: ColorFormat): string {
|
|
228
|
+
if (format === 'rgba') return formatRgba(color);
|
|
229
|
+
return formatHexa(color);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function formatHexa(color: RgbaColor): string {
|
|
233
|
+
const r = toHex(color.r);
|
|
234
|
+
const g = toHex(color.g);
|
|
235
|
+
const b = toHex(color.b);
|
|
236
|
+
const alpha = color.a < 1 ? toHex(Math.round(color.a * 255)) : '';
|
|
237
|
+
return `#${r}${g}${b}${alpha}`;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function formatRgba(color: RgbaColor): string {
|
|
241
|
+
const alpha = trimAlpha(color.a);
|
|
242
|
+
return `rgba(${color.r}, ${color.g}, ${color.b}, ${alpha})`;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function colorKey(color: RgbaColor): string {
|
|
246
|
+
return formatHexa(color).toLowerCase();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function isSameColor(a: RgbaColor, b: RgbaColor): boolean {
|
|
250
|
+
return a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function clamp01(value: number): number {
|
|
254
|
+
if (Number.isNaN(value)) return 0;
|
|
255
|
+
return Math.min(1, Math.max(0, value));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function clampByte(value: number): number {
|
|
259
|
+
if (Number.isNaN(value)) return 0;
|
|
260
|
+
const normalized = value <= 1 ? value * 255 : value;
|
|
261
|
+
return Math.round(Math.min(255, Math.max(0, normalized)));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function toHex(value: number): string {
|
|
265
|
+
return value.toString(16).padStart(2, '0');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function trimAlpha(alpha: number): string {
|
|
269
|
+
const rounded = Math.round(clamp01(alpha) * 100) / 100;
|
|
270
|
+
if (rounded === 1) return '1';
|
|
271
|
+
if (rounded === 0) return '0';
|
|
272
|
+
return rounded.toString();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function createSwitchLabel(text: string): HTMLSpanElement {
|
|
276
|
+
const span = document.createElement('span');
|
|
277
|
+
span.textContent = text;
|
|
278
|
+
span.classList.add(COLOR_PICKER_SWITCH_LABEL_CLASS);
|
|
279
|
+
return span;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function ensureColorPickerStyles() {
|
|
283
|
+
injectStyleOnce(
|
|
284
|
+
COLOR_PICKER_STYLE_ID,
|
|
285
|
+
`
|
|
286
|
+
.${COLOR_PICKER_CLASS} {
|
|
287
|
+
width: 240px;
|
|
288
|
+
padding: 10px;
|
|
289
|
+
box-sizing: border-box;
|
|
290
|
+
}
|
|
291
|
+
.${COLOR_PICKER_SWATCHES_CLASS} {
|
|
292
|
+
display: grid;
|
|
293
|
+
grid-template-columns: repeat(auto-fit, 26px);
|
|
294
|
+
gap: 6px;
|
|
295
|
+
margin-bottom: 10px;
|
|
296
|
+
}
|
|
297
|
+
.${COLOR_PICKER_SWATCH_CLASS} {
|
|
298
|
+
width: 24px;
|
|
299
|
+
height: 24px;
|
|
300
|
+
border-radius: 50%;
|
|
301
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
302
|
+
background: var(--swatch-color);
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
padding: 0;
|
|
305
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
|
|
306
|
+
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
|
307
|
+
}
|
|
308
|
+
.${COLOR_PICKER_SWATCH_CLASS}[data-active="true"] {
|
|
309
|
+
box-shadow: 0 0 0 2px #1677ff;
|
|
310
|
+
transform: translateY(-1px);
|
|
311
|
+
}
|
|
312
|
+
.${COLOR_PICKER_SWATCH_CLASS}:hover {
|
|
313
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
|
|
314
|
+
}
|
|
315
|
+
.${COLOR_PICKER_CONTROLS_CLASS} {
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
gap: 6px;
|
|
319
|
+
}
|
|
320
|
+
.${COLOR_PICKER_INPUT_CLASS} {
|
|
321
|
+
flex: 1;
|
|
322
|
+
min-width: 0;
|
|
323
|
+
height: 30px;
|
|
324
|
+
padding: 2px 6px;
|
|
325
|
+
border: 1px solid #d9d9d9;
|
|
326
|
+
border-radius: 6px;
|
|
327
|
+
background: #f5f5f5;
|
|
328
|
+
color: #262626;
|
|
329
|
+
font-size: 12px;
|
|
330
|
+
font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
331
|
+
"Liberation Mono", "Courier New", monospace;
|
|
332
|
+
box-sizing: border-box;
|
|
333
|
+
outline: none;
|
|
334
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
|
|
335
|
+
}
|
|
336
|
+
.${COLOR_PICKER_INPUT_CLASS}:focus {
|
|
337
|
+
border-color: #1677ff;
|
|
338
|
+
background: #ffffff;
|
|
339
|
+
box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
|
|
340
|
+
}
|
|
341
|
+
.${COLOR_PICKER_INPUT_CLASS}[data-invalid="true"] {
|
|
342
|
+
border-color: #ff4d4f;
|
|
343
|
+
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.12);
|
|
344
|
+
}
|
|
345
|
+
.${COLOR_PICKER_FORMAT_CLASS} {
|
|
346
|
+
display: inline-flex;
|
|
347
|
+
}
|
|
348
|
+
.${COLOR_PICKER_SWITCH_CLASS} {
|
|
349
|
+
position: relative;
|
|
350
|
+
display: grid;
|
|
351
|
+
grid-template-columns: 1fr 1fr;
|
|
352
|
+
align-items: center;
|
|
353
|
+
width: 110px;
|
|
354
|
+
height: 30px;
|
|
355
|
+
padding: 0;
|
|
356
|
+
border: 1px solid #d9d9d9;
|
|
357
|
+
border-radius: 6px;
|
|
358
|
+
background: #f5f5f5;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
overflow: hidden;
|
|
361
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
|
|
362
|
+
}
|
|
363
|
+
.${COLOR_PICKER_SWITCH_CLASS}:hover {
|
|
364
|
+
background: #ededed;
|
|
365
|
+
}
|
|
366
|
+
.${COLOR_PICKER_SWITCH_CLASS}:focus-visible {
|
|
367
|
+
outline: none;
|
|
368
|
+
border-color: #1677ff;
|
|
369
|
+
box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
|
|
370
|
+
}
|
|
371
|
+
.${COLOR_PICKER_SWITCH_KNOB_CLASS} {
|
|
372
|
+
position: absolute;
|
|
373
|
+
inset: 0;
|
|
374
|
+
width: 50%;
|
|
375
|
+
background: #1677ff;
|
|
376
|
+
border-radius: 6px;
|
|
377
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
378
|
+
transition: transform 0.2s ease;
|
|
379
|
+
}
|
|
380
|
+
.${COLOR_PICKER_SWITCH_CLASS}[data-format="rgba"] .${COLOR_PICKER_SWITCH_KNOB_CLASS} {
|
|
381
|
+
transform: translateX(100%);
|
|
382
|
+
}
|
|
383
|
+
.${COLOR_PICKER_SWITCH_LABEL_CLASS} {
|
|
384
|
+
position: relative;
|
|
385
|
+
z-index: 1;
|
|
386
|
+
text-align: center;
|
|
387
|
+
font-size: 12px;
|
|
388
|
+
color: #434343;
|
|
389
|
+
user-select: none;
|
|
390
|
+
}
|
|
391
|
+
.${COLOR_PICKER_SWITCH_CLASS}[data-format="hexa"] .${COLOR_PICKER_SWITCH_LABEL_CLASS}:first-child,
|
|
392
|
+
.${COLOR_PICKER_SWITCH_CLASS}[data-format="rgba"] .${COLOR_PICKER_SWITCH_LABEL_CLASS}:last-child {
|
|
393
|
+
color: #ffffff;
|
|
394
|
+
}
|
|
395
|
+
`,
|
|
396
|
+
);
|
|
397
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export type Icon = (props?: IconProps) => HTMLElement;
|
|
2
|
+
|
|
3
|
+
interface IconCreatorProps {
|
|
4
|
+
viewBox?: string;
|
|
5
|
+
size?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IconProps {
|
|
9
|
+
fill?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const createIcon =
|
|
13
|
+
(
|
|
14
|
+
children: string,
|
|
15
|
+
{ viewBox = '0 0 1024 1024', size = '1.5em' }: IconCreatorProps = {},
|
|
16
|
+
) =>
|
|
17
|
+
({ fill = 'currentColor' }: IconProps = {}) => {
|
|
18
|
+
const html = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" width="${size}" height="${size}" fill="${fill}">
|
|
19
|
+
${children.trim()}
|
|
20
|
+
</svg>`;
|
|
21
|
+
return document.createRange().createContextualFragment(html)
|
|
22
|
+
.firstElementChild as HTMLElement;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const TEXT_ICONS = {
|
|
26
|
+
fontFamily: createIcon(
|
|
27
|
+
`<path d="M236.992 938.688H145.088L469.312 128h85.376l324.224 810.688h-91.904l-102.4-256H339.392l-102.4 256z m136.512-341.376h276.992L512 251.072l-138.496 346.24z"></path>`,
|
|
28
|
+
{ size: '1.2em' },
|
|
29
|
+
),
|
|
30
|
+
fontSize: createIcon(
|
|
31
|
+
`<path d="M479.829333 640H202.837333l-85.333333 213.333333H25.6L298.666667 170.666667h85.333333l273.066667 682.666666h-91.904l-85.333334-213.333333z m-34.133333-85.333333L341.333333 293.76 236.970667 554.666667h208.725333zM896 534.826667V512h85.333333v341.333333h-85.333333v-22.826666a170.666667 170.666667 0 1 1 0-295.68zM810.666667 768a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z"></path>`,
|
|
32
|
+
{ size: '1.2em' },
|
|
33
|
+
),
|
|
34
|
+
align: createIcon(
|
|
35
|
+
`<path d="M832 96c53.02 0 96 42.98 96 96v640c0 53.02-42.98 96-96 96H192c-53.02 0-96-42.98-96-96V192c0-53.02 42.98-96 96-96z m0 64H192c-17.673 0-32 14.327-32 32v640c0 17.673 14.327 32 32 32h640c17.673 0 32-14.327 32-32V192c0-17.673-14.327-32-32-32zM725.333 672c17.673 0 32 14.327 32 32 0 17.496-14.041 31.713-31.47 31.996l-0.53 0.004H298.667c-17.673 0-32-14.327-32-32 0-17.496 14.041-31.713 31.47-31.996l0.53-0.004h426.666z m0-192c17.673 0 32 14.327 32 32 0 17.496-14.041 31.713-31.47 31.996l-0.53 0.004H298.667c-17.673 0-32-14.327-32-32 0-17.496 14.041-31.713 31.47-31.996l0.53-0.004h426.666z m0-192c17.673 0 32 14.327 32 32 0 17.496-14.041 31.713-31.47 31.996l-0.53 0.004H298.667c-17.673 0-32-14.327-32-32 0-17.496 14.041-31.713 31.47-31.996l0.53-0.004h426.666z"></path>`,
|
|
36
|
+
),
|
|
37
|
+
alignTop: createIcon(
|
|
38
|
+
`<path d="M896 859.329c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H128c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h768z m0-121.533c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768zM512.45 91.003L512 91a32.632 32.632 0 0 1 1.653 0.042l0.134 0.008c3.447 0.189 6.75 0.924 9.82 2.12l0.198 0.078a16.118 16.118 0 0 1 0.485 0.197l0.11 0.046a31.82 31.82 0 0 1 8.546 5.315l0.12 0.105a31.066 31.066 0 0 1 1.189 1.095l0.08 0.078 0.235 0.23 0.062 0.063 128 128.055c12.494 12.5 12.49 32.761-0.01 45.255-12.374 12.37-32.356 12.489-44.877 0.362l-0.377-0.372L544 200.28v413.598c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-31.996-31.471l-0.004-0.53V200.278l-73.368 73.4c-12.369 12.375-32.35 12.503-44.877 0.381l-0.378-0.37c-12.374-12.37-12.502-32.352-0.38-44.878l0.37-0.378 128-128.055 0.181-0.178a31.875 31.875 0 0 1 9.5-6.47l0.105-0.046c0.116-0.051 0.233-0.101 0.35-0.15 0.054-0.024 0.11-0.047 0.165-0.07a28.198 28.198 0 0 1 0.536-0.219l0.157-0.061a31.816 31.816 0 0 1 9.356-2.103l0.113-0.007c0.147-0.01 0.294-0.02 0.442-0.027l0.028-0.001 0.39-0.019 0.144-0.005a23.911 23.911 0 0 1 0.712-0.018c0.3-0.004 0.602-0.004 0.904 0z"></path>`,
|
|
39
|
+
),
|
|
40
|
+
alignRight: createIcon(
|
|
41
|
+
`<path d="M896 800.339c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H298.667c-17.673 0-32-14.327-32-32 0-17.497 14.041-31.713 31.47-31.996l0.53-0.004H896z m0-213.226c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h768z m0-213.226c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H298.667c-17.673 0-32-14.327-32-32 0-17.496 14.041-31.713 31.47-31.996l0.53-0.004H896z m0-213.226c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768z"></path>`,
|
|
42
|
+
),
|
|
43
|
+
alignBottom: createIcon(
|
|
44
|
+
`<path d="M896 859.329c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H128c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h768z m0-121.533c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768zM490.505 637.584l-0.127-0.117a32.174 32.174 0 0 1-0.633-0.596l-0.098-0.096-0.217-0.213-0.062-0.063-128-128.055c-12.494-12.499-12.49-32.76 0.01-45.254 12.374-12.37 32.356-12.489 44.877-0.362l0.377 0.371L480 536.598V123c0-17.673 14.327-32 32-32 17.496 0 31.713 14.042 31.996 31.47l0.004 0.53v413.597l73.368-73.398c12.494-12.5 32.755-12.503 45.255-0.01 12.374 12.37 12.502 32.352 0.38 44.878l-0.37 0.377-128 128.055c-0.121 0.12-0.238 0.236-0.356 0.35l0.355-0.35a31.922 31.922 0 0 1-9.68 6.649l-0.09 0.039a29.917 29.917 0 0 1-1.241 0.514 31.816 31.816 0 0 1-9.338 2.095l-0.113 0.008c-0.147 0.01-0.294 0.019-0.442 0.027h-0.028c-0.13 0.008-0.26 0.014-0.39 0.02l-0.144 0.005a23.92 23.92 0 0 1-0.796 0.019 33.927 33.927 0 0 1-0.37 0.002h-0.13l-0.236-0.002 0.366 0.002a32.633 32.633 0 0 1-1.153-0.02l-0.129-0.006a31.108 31.108 0 0 1-0.876-0.046l-0.105-0.008a31.811 31.811 0 0 1-8.926-1.931l-0.089-0.034a21.022 21.022 0 0 1-0.362-0.138l-0.098-0.04a22.132 22.132 0 0 1-0.746-0.304l-0.219-0.093-0.209-0.092a31.812 31.812 0 0 1-8.034-5.094l-0.12-0.105-0.173-0.153-0.151-0.136-0.105-0.093z"></path>`,
|
|
45
|
+
),
|
|
46
|
+
alignLeft: createIcon(
|
|
47
|
+
`<path d="M725.333 800.339c17.673 0 32 14.327 32 32 0 17.496-14.041 31.713-31.47 31.995l-0.53 0.005H128c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h597.333zM896 587.113c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h768zM725.333 373.887c17.673 0 32 14.327 32 32 0 17.496-14.041 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h597.333zM896 160.661c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768z"></path>`,
|
|
48
|
+
),
|
|
49
|
+
alignCenter: createIcon(
|
|
50
|
+
`<path d="M768 800.339c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H256c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h512z m128-213.226c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h768zM768 373.887c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H256c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h512z m128-213.226c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768z"></path>`,
|
|
51
|
+
),
|
|
52
|
+
alignMiddle: createIcon(
|
|
53
|
+
`<path d="M534.246 617.448l0.377 0.371 128 127.952c12.5 12.494 12.503 32.755 0.009 45.255-12.37 12.374-32.352 12.501-44.878 0.38l-0.377-0.372-73.38-73.352V939c0 17.673-14.326 32-32 32-17.496 0-31.712-14.042-31.995-31.47l-0.004-0.53-0.001-221.314-73.374 73.348c-12.374 12.37-32.356 12.49-44.878 0.363l-0.377-0.371c-12.37-12.375-12.49-32.356-0.362-44.878l0.37-0.377 128-127.952c12.372-12.366 32.347-12.49 44.87-0.37zM896 480.508c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768zM511.998 54c17.496 0 31.713 14.042 31.996 31.47l0.004 0.53-0.001 221.314 73.38-73.349c12.499-12.494 32.76-12.49 45.255 0.009 12.37 12.374 12.49 32.356 0.362 44.878l-0.37 0.377-128 127.951c-12.372 12.366-32.347 12.49-44.87 0.371l-0.377-0.37-128-127.952c-12.5-12.495-12.503-32.756-0.009-45.255 12.37-12.374 32.352-12.502 44.878-0.38l0.377 0.371 73.374 73.346V86c0-17.673 14.328-32 32-32z"></path>`,
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const ELEMENT_ICONS = {
|
|
58
|
+
align: createIcon(
|
|
59
|
+
`<path d="M555.188 715.059c17.673 0 32 14.327 32 32V875c0 17.673-14.327 32-32 32H171c-17.673 0-32-14.327-32-32V747.059c0-17.673 14.327-32 32-32z m-32.001 63.999H203V843h320.187v-63.942zM854 416.529c17.673 0 32 14.327 32 32v127.942c0 17.673-14.327 32-32 32H171c-17.673 0-32-14.327-32-32V448.529c0-17.673 14.327-32 32-32z m-32 64H203v63.941h619v-63.941zM683.25 118c17.673 0 32 14.327 32 32v127.941c0 17.673-14.327 32-32 32H171c-17.673 0-32-14.327-32-32V150c0-17.673 14.327-32 32-32z m-32 64H203v63.941h448.25V182z"></path>`,
|
|
60
|
+
),
|
|
61
|
+
alignTop: createIcon(
|
|
62
|
+
`
|
|
63
|
+
<path d="M661.333 272.411c17.673 0 32 14.327 32 32V902c0 17.673-14.327 32-32 32H362.667c-17.673 0-32-14.327-32-32V304.411c0-17.673 14.327-32 32-32z m-32 63.999H394.666V870h234.667V336.41zM896 101.671c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768z" />`,
|
|
64
|
+
),
|
|
65
|
+
alignRight: createIcon(
|
|
66
|
+
`<path d="M891.329 96c17.496 0 31.713 14.042 31.995 31.47l0.005 0.53v768c0 17.673-14.327 32-32 32-17.497 0-31.713-14.042-31.996-31.47l-0.004-0.53V128c0-17.673 14.327-32 32-32z m-170.74 234.667c17.673 0 32 14.327 32 32v298.666c0 17.673-14.327 32-32 32H123c-17.673 0-32-14.327-32-32V362.667c0-17.673 14.327-32 32-32z m-32 63.999H155v234.667h533.589V394.666z" />`,
|
|
67
|
+
),
|
|
68
|
+
alignBottom: createIcon(
|
|
69
|
+
`<path d="M896 859.329c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H128c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h768zM661.333 91c17.673 0 32 14.327 32 32v597.589c0 17.673-14.327 32-32 32H362.667c-17.673 0-32-14.327-32-32V123c0-17.673 14.327-32 32-32z m-32 64H394.666v533.589h234.667V155z" />`,
|
|
70
|
+
),
|
|
71
|
+
alignLeft: createIcon(
|
|
72
|
+
`<path d="M133.671 96c17.497 0 31.713 14.042 31.996 31.47l0.004 0.53v768c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-31.995-31.47l-0.005-0.53V128c0-17.673 14.327-32 32-32zM902 330.667c17.673 0 32 14.327 32 32v298.666c0 17.673-14.327 32-32 32H304.411c-17.673 0-32-14.327-32-32V362.667c0-17.673 14.327-32 32-32z m-32.001 63.999H336.41v234.667h533.589V394.666z" />`,
|
|
73
|
+
),
|
|
74
|
+
alignH: createIcon(
|
|
75
|
+
`<path d="M512.5 96c17.496 0 31.713 14.042 31.996 31.47l0.004 0.53v202.666H875c17.496 0 31.713 14.042 31.996 31.471l0.004 0.53v298.666c0 17.673-14.327 32-32 32H544.5V896c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-31.996-31.47l-0.004-0.53V693.333H150c-17.496 0-31.713-14.041-31.996-31.47l-0.004-0.53V362.667c0-17.673 14.327-32 32-32l330.5-0.001V128c0-17.673 14.327-32 32-32z m-32 298.666H182v234.667h298.5V394.666z m362.5 0H544.5v234.667H843V394.666z" />`,
|
|
76
|
+
),
|
|
77
|
+
alignV: createIcon(
|
|
78
|
+
`<path d="M661.333 118c17.673 0 32 14.327 32 32v330.5H896c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.996l-0.53 0.004H693.333V875c0 17.496-14.041 31.713-31.47 31.996l-0.53 0.004H362.667c-17.673 0-32-14.327-32-32l-0.001-330.5H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.996l0.53-0.004h202.666V150c0-17.496 14.042-31.713 31.471-31.996l0.53-0.004z m-32.001 426.5H394.665l0.001 298.5h234.667l-0.001-298.5z m0.001-362.5H394.666l-0.001 298.5h234.667l0.001-298.5z" />`,
|
|
79
|
+
),
|
|
80
|
+
distributeH: createIcon(
|
|
81
|
+
`<path d="M853.333 96c17.497 0 31.713 14.042 31.996 31.47l0.004 0.53v768c0 17.673-14.327 32-32 32-17.496 0-31.713-14.042-31.995-31.47l-0.005-0.53V128c0-17.673 14.327-32 32-32z m-682.666 0c17.496 0 31.713 14.042 31.995 31.47l0.005 0.53v768c0 17.673-14.327 32-32 32-17.497 0-31.713-14.042-31.996-31.47l-0.004-0.53V128c0-17.673 14.327-32 32-32zM640 181.333c17.673 0 32 14.327 32 32v597.334c0 17.673-14.327 32-32 32H384c-17.673 0-32-14.327-32-32V213.333c0-17.673 14.327-32 32-32z m-32 64H416v533.333h192V245.333z" />`,
|
|
82
|
+
),
|
|
83
|
+
distributeV: createIcon(
|
|
84
|
+
`<path d="M896 821.333c17.673 0 32 14.327 32 32 0 17.497-14.042 31.713-31.47 31.996l-0.53 0.004H128c-17.673 0-32-14.327-32-32 0-17.496 14.042-31.713 31.47-31.995l0.53-0.005h768zM810.667 352c17.673 0 32 14.327 32 32v256c0 17.673-14.327 32-32 32H213.333c-17.673 0-32-14.327-32-32V384c0-17.673 14.327-32 32-32z m-32 64H245.334v192h533.333V416zM896 138.667c17.673 0 32 14.327 32 32 0 17.496-14.042 31.713-31.47 31.995l-0.53 0.005H128c-17.673 0-32-14.327-32-32 0-17.497 14.042-31.713 31.47-31.996l0.53-0.004h768z" />`,
|
|
85
|
+
),
|
|
86
|
+
};
|