@antv/infographic 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/esm/constants/element.d.ts +11 -0
- package/esm/constants/element.js +1 -0
- package/esm/constants/index.d.ts +1 -0
- package/esm/constants/index.js +1 -0
- package/esm/designs/components/Btn.d.ts +7 -0
- package/esm/designs/components/Btn.js +25 -0
- package/esm/designs/components/BtnsGroup.d.ts +5 -0
- package/esm/designs/components/BtnsGroup.js +5 -0
- package/esm/designs/components/Gap.d.ts +13 -0
- package/esm/designs/components/Gap.js +9 -0
- package/esm/designs/components/Illus.d.ts +6 -0
- package/esm/designs/components/Illus.js +13 -0
- package/esm/designs/components/ItemDesc.d.ts +7 -0
- package/esm/designs/components/ItemDesc.js +19 -0
- package/esm/designs/components/ItemIcon.d.ts +10 -0
- package/esm/designs/components/ItemIcon.js +29 -0
- package/esm/designs/components/ItemLabel.d.ts +6 -0
- package/esm/designs/components/ItemLabel.js +17 -0
- package/esm/designs/components/ItemValue.d.ts +8 -0
- package/esm/designs/components/ItemValue.js +18 -0
- package/esm/designs/components/ItemsGroup.d.ts +5 -0
- package/esm/designs/components/ItemsGroup.js +5 -0
- package/esm/designs/components/Title.d.ts +11 -0
- package/esm/designs/components/Title.js +32 -0
- package/esm/designs/components/index.d.ts +10 -0
- package/esm/designs/components/index.js +10 -0
- package/esm/designs/decorations/index.d.ts +3 -0
- package/esm/designs/decorations/index.js +3 -0
- package/esm/designs/decorations/simple-arrow.d.ts +6 -0
- package/esm/designs/decorations/simple-arrow.js +23 -0
- package/esm/designs/decorations/text-3d.d.ts +82 -0
- package/esm/designs/decorations/text-3d.js +13 -0
- package/esm/designs/decorations/triangle.d.ts +6 -0
- package/esm/designs/decorations/triangle.js +15 -0
- package/esm/designs/defs/DropShadow.d.ts +12 -0
- package/esm/designs/defs/DropShadow.js +5 -0
- package/esm/designs/defs/LinearGradient.d.ts +8 -0
- package/esm/designs/defs/LinearGradient.js +11 -0
- package/esm/designs/defs/index.d.ts +2 -0
- package/esm/designs/defs/index.js +2 -0
- package/esm/designs/index.d.ts +6 -0
- package/esm/designs/index.js +5 -0
- package/esm/designs/items/BadgeCard.d.ts +11 -0
- package/esm/designs/items/BadgeCard.js +33 -0
- package/esm/designs/items/CandyCardLite.d.ts +8 -0
- package/esm/designs/items/CandyCardLite.js +13 -0
- package/esm/designs/items/CapsuleItem.d.ts +10 -0
- package/esm/designs/items/CapsuleItem.js +56 -0
- package/esm/designs/items/CircleNode.d.ts +8 -0
- package/esm/designs/items/CircleNode.js +33 -0
- package/esm/designs/items/CircularProgress.d.ts +9 -0
- package/esm/designs/items/CircularProgress.js +24 -0
- package/esm/designs/items/CompactCard.d.ts +10 -0
- package/esm/designs/items/CompactCard.js +24 -0
- package/esm/designs/items/DoneList.d.ts +10 -0
- package/esm/designs/items/DoneList.js +20 -0
- package/esm/designs/items/HorizontalIconArrow.d.ts +7 -0
- package/esm/designs/items/HorizontalIconArrow.js +67 -0
- package/esm/designs/items/HorizontalIconLine.d.ts +7 -0
- package/esm/designs/items/HorizontalIconLine.js +40 -0
- package/esm/designs/items/IconBadge.d.ts +10 -0
- package/esm/designs/items/IconBadge.js +20 -0
- package/esm/designs/items/IndexedCard.d.ts +20 -0
- package/esm/designs/items/IndexedCard.js +62 -0
- package/esm/designs/items/LCornerCard.d.ts +8 -0
- package/esm/designs/items/LCornerCard.js +40 -0
- package/esm/designs/items/LetterCard.d.ts +16 -0
- package/esm/designs/items/LetterCard.js +54 -0
- package/esm/designs/items/PillBadge.d.ts +10 -0
- package/esm/designs/items/PillBadge.js +43 -0
- package/esm/designs/items/PlainText.d.ts +9 -0
- package/esm/designs/items/PlainText.js +16 -0
- package/esm/designs/items/ProgressCard.d.ts +12 -0
- package/esm/designs/items/ProgressCard.js +48 -0
- package/esm/designs/items/QuarterCircular.d.ts +10 -0
- package/esm/designs/items/QuarterCircular.js +145 -0
- package/esm/designs/items/QuarterSimpleCard.d.ts +11 -0
- package/esm/designs/items/QuarterSimpleCard.js +117 -0
- package/esm/designs/items/RibbonCard.d.ts +11 -0
- package/esm/designs/items/RibbonCard.js +24 -0
- package/esm/designs/items/RoundedRectNode.d.ts +9 -0
- package/esm/designs/items/RoundedRectNode.js +24 -0
- package/esm/designs/items/SimpleHorizontalArrow.d.ts +9 -0
- package/esm/designs/items/SimpleHorizontalArrow.js +41 -0
- package/esm/designs/items/SimpleIllusItem.d.ts +10 -0
- package/esm/designs/items/SimpleIllusItem.js +21 -0
- package/esm/designs/items/SimpleItem.d.ts +13 -0
- package/esm/designs/items/SimpleItem.js +112 -0
- package/esm/designs/items/SimpleVerticalArrow.d.ts +9 -0
- package/esm/designs/items/SimpleVerticalArrow.js +37 -0
- package/esm/designs/items/UnderlineText.d.ts +8 -0
- package/esm/designs/items/UnderlineText.js +45 -0
- package/esm/designs/items/VerticalIconArrow.d.ts +9 -0
- package/esm/designs/items/VerticalIconArrow.js +60 -0
- package/esm/designs/items/index.d.ts +28 -0
- package/esm/designs/items/index.js +27 -0
- package/esm/designs/items/registry.d.ts +4 -0
- package/esm/designs/items/registry.js +10 -0
- package/esm/designs/items/types.d.ts +24 -0
- package/esm/designs/items/types.js +1 -0
- package/esm/designs/layouts/Align.d.ts +9 -0
- package/esm/designs/layouts/Align.js +79 -0
- package/esm/designs/layouts/Flex.d.ts +11 -0
- package/esm/designs/layouts/Flex.js +204 -0
- package/esm/designs/layouts/index.d.ts +2 -0
- package/esm/designs/layouts/index.js +2 -0
- package/esm/designs/structures/chart-column.d.ts +12 -0
- package/esm/designs/structures/chart-column.js +68 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/index.d.ts +5 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/index.js +4 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.d.ts +4 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +19 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.d.ts +4 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +19 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/types.d.ts +11 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/types.js +9 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/vs.d.ts +4 -0
- package/esm/designs/structures/compare-binary-horizontal/dividers/vs.js +14 -0
- package/esm/designs/structures/compare-binary-horizontal/index.d.ts +12 -0
- package/esm/designs/structures/compare-binary-horizontal/index.js +86 -0
- package/esm/designs/structures/compare-hierarchy-left-right.d.ts +18 -0
- package/esm/designs/structures/compare-hierarchy-left-right.js +140 -0
- package/esm/designs/structures/compare-hierarchy-row.d.ts +17 -0
- package/esm/designs/structures/compare-hierarchy-row.js +74 -0
- package/esm/designs/structures/hierarchy-tree.d.ts +41 -0
- package/esm/designs/structures/hierarchy-tree.js +296 -0
- package/esm/designs/structures/index.d.ts +32 -0
- package/esm/designs/structures/index.js +31 -0
- package/esm/designs/structures/list-column.d.ts +9 -0
- package/esm/designs/structures/list-column.js +34 -0
- package/esm/designs/structures/list-grid.d.ts +9 -0
- package/esm/designs/structures/list-grid.js +47 -0
- package/esm/designs/structures/list-pyramid.d.ts +8 -0
- package/esm/designs/structures/list-pyramid.js +59 -0
- package/esm/designs/structures/list-row.d.ts +8 -0
- package/esm/designs/structures/list-row.js +36 -0
- package/esm/designs/structures/list-sector.d.ts +11 -0
- package/esm/designs/structures/list-sector.js +147 -0
- package/esm/designs/structures/list-waterfall.d.ts +9 -0
- package/esm/designs/structures/list-waterfall.js +55 -0
- package/esm/designs/structures/quadrant.d.ts +14 -0
- package/esm/designs/structures/quadrant.js +96 -0
- package/esm/designs/structures/registry.d.ts +4 -0
- package/esm/designs/structures/registry.js +10 -0
- package/esm/designs/structures/relation-circle.d.ts +8 -0
- package/esm/designs/structures/relation-circle.js +77 -0
- package/esm/designs/structures/relation-network.d.ts +19 -0
- package/esm/designs/structures/relation-network.js +92 -0
- package/esm/designs/structures/sequence-ascending-stairs-3d.d.ts +7 -0
- package/esm/designs/structures/sequence-ascending-stairs-3d.js +63 -0
- package/esm/designs/structures/sequence-ascending-steps.d.ts +8 -0
- package/esm/designs/structures/sequence-ascending-steps.js +32 -0
- package/esm/designs/structures/sequence-circle-arrows.d.ts +9 -0
- package/esm/designs/structures/sequence-circle-arrows.js +198 -0
- package/esm/designs/structures/sequence-circular.d.ts +13 -0
- package/esm/designs/structures/sequence-circular.js +171 -0
- package/esm/designs/structures/sequence-color-snake-steps.d.ts +11 -0
- package/esm/designs/structures/sequence-color-snake-steps.js +90 -0
- package/esm/designs/structures/sequence-cylinders-3d.d.ts +15 -0
- package/esm/designs/structures/sequence-cylinders-3d.js +277 -0
- package/esm/designs/structures/sequence-filter-mesh.d.ts +7 -0
- package/esm/designs/structures/sequence-filter-mesh.js +217 -0
- package/esm/designs/structures/sequence-horizontal-zigzag.d.ts +8 -0
- package/esm/designs/structures/sequence-horizontal-zigzag.js +153 -0
- package/esm/designs/structures/sequence-mountain.d.ts +11 -0
- package/esm/designs/structures/sequence-mountain.js +281 -0
- package/esm/designs/structures/sequence-pyramid.d.ts +10 -0
- package/esm/designs/structures/sequence-pyramid.js +94 -0
- package/esm/designs/structures/sequence-roadmap-vertical.d.ts +9 -0
- package/esm/designs/structures/sequence-roadmap-vertical.js +151 -0
- package/esm/designs/structures/sequence-snake-steps.d.ts +9 -0
- package/esm/designs/structures/sequence-snake-steps.js +78 -0
- package/esm/designs/structures/sequence-steps.d.ts +7 -0
- package/esm/designs/structures/sequence-steps.js +47 -0
- package/esm/designs/structures/sequence-timeline.d.ts +8 -0
- package/esm/designs/structures/sequence-timeline.js +64 -0
- package/esm/designs/structures/sequence-zigzag-pucks-3d.d.ts +7 -0
- package/esm/designs/structures/sequence-zigzag-pucks-3d.js +70 -0
- package/esm/designs/structures/sequence-zigzag-steps.d.ts +9 -0
- package/esm/designs/structures/sequence-zigzag-steps.js +126 -0
- package/esm/designs/structures/types.d.ts +19 -0
- package/esm/designs/structures/types.js +1 -0
- package/esm/designs/title/index.d.ts +1 -0
- package/esm/designs/title/index.js +1 -0
- package/esm/designs/title/types.d.ts +4 -0
- package/esm/designs/title/types.js +1 -0
- package/esm/designs/types.d.ts +29 -0
- package/esm/designs/types.js +1 -0
- package/esm/designs/utils/color.d.ts +8 -0
- package/esm/designs/utils/color.js +26 -0
- package/esm/designs/utils/hierarchy-color.d.ts +61 -0
- package/esm/designs/utils/hierarchy-color.js +101 -0
- package/esm/designs/utils/index.d.ts +3 -0
- package/esm/designs/utils/index.js +3 -0
- package/esm/designs/utils/item.d.ts +14 -0
- package/esm/designs/utils/item.js +49 -0
- package/esm/index.d.ts +13 -0
- package/esm/index.js +9 -0
- package/esm/jsx-runtime.d.ts +1 -0
- package/esm/jsx-runtime.js +1 -0
- package/esm/options/index.d.ts +2 -0
- package/esm/options/index.js +1 -0
- package/esm/options/parser.d.ts +2 -0
- package/esm/options/parser.js +113 -0
- package/esm/options/types.d.ts +45 -0
- package/esm/options/types.js +1 -0
- package/esm/renderer/composites/background.d.ts +1 -0
- package/esm/renderer/composites/background.js +26 -0
- package/esm/renderer/composites/button.d.ts +1 -0
- package/esm/renderer/composites/button.js +68 -0
- package/esm/renderer/composites/icon.d.ts +6 -0
- package/esm/renderer/composites/icon.js +37 -0
- package/esm/renderer/composites/illus.d.ts +3 -0
- package/esm/renderer/composites/illus.js +79 -0
- package/esm/renderer/composites/index.d.ts +7 -0
- package/esm/renderer/composites/index.js +7 -0
- package/esm/renderer/composites/shape.d.ts +4 -0
- package/esm/renderer/composites/shape.js +45 -0
- package/esm/renderer/composites/svg.d.ts +2 -0
- package/esm/renderer/composites/svg.js +6 -0
- package/esm/renderer/composites/text.d.ts +6 -0
- package/esm/renderer/composites/text.js +102 -0
- package/esm/renderer/constants/data-url.d.ts +5 -0
- package/esm/renderer/constants/data-url.js +1 -0
- package/esm/renderer/constants/index.d.ts +2 -0
- package/esm/renderer/constants/index.js +2 -0
- package/esm/renderer/fonts/built-in.d.ts +2 -0
- package/esm/renderer/fonts/built-in.js +37 -0
- package/esm/renderer/fonts/index.d.ts +4 -0
- package/esm/renderer/fonts/index.js +6 -0
- package/esm/renderer/fonts/loader.d.ts +4 -0
- package/esm/renderer/fonts/loader.js +54 -0
- package/esm/renderer/fonts/registry.d.ts +24 -0
- package/esm/renderer/fonts/registry.js +45 -0
- package/esm/renderer/fonts/types.d.ts +9 -0
- package/esm/renderer/fonts/types.js +1 -0
- package/esm/renderer/fonts/utils.d.ts +4 -0
- package/esm/renderer/fonts/utils.js +35 -0
- package/esm/renderer/index.d.ts +4 -0
- package/esm/renderer/index.js +3 -0
- package/esm/renderer/palettes/built-in.d.ts +3 -0
- package/esm/renderer/palettes/built-in.js +81 -0
- package/esm/renderer/palettes/index.d.ts +5 -0
- package/esm/renderer/palettes/index.js +4 -0
- package/esm/renderer/palettes/registry.d.ts +3 -0
- package/esm/renderer/palettes/registry.js +7 -0
- package/esm/renderer/palettes/types.d.ts +1 -0
- package/esm/renderer/palettes/types.js +1 -0
- package/esm/renderer/palettes/utils.d.ts +2 -0
- package/esm/renderer/palettes/utils.js +14 -0
- package/esm/renderer/renderer.d.ts +11 -0
- package/esm/renderer/renderer.js +207 -0
- package/esm/renderer/stylize/gradient.d.ts +2 -0
- package/esm/renderer/stylize/gradient.js +102 -0
- package/esm/renderer/stylize/index.d.ts +3 -0
- package/esm/renderer/stylize/index.js +3 -0
- package/esm/renderer/stylize/pattern.d.ts +3 -0
- package/esm/renderer/stylize/pattern.js +57 -0
- package/esm/renderer/stylize/patterns/diamond.d.ts +2 -0
- package/esm/renderer/stylize/patterns/diamond.js +23 -0
- package/esm/renderer/stylize/patterns/dot.d.ts +2 -0
- package/esm/renderer/stylize/patterns/dot.js +31 -0
- package/esm/renderer/stylize/patterns/hex.d.ts +2 -0
- package/esm/renderer/stylize/patterns/hex.js +22 -0
- package/esm/renderer/stylize/patterns/index.d.ts +6 -0
- package/esm/renderer/stylize/patterns/index.js +6 -0
- package/esm/renderer/stylize/patterns/line.d.ts +2 -0
- package/esm/renderer/stylize/patterns/line.js +39 -0
- package/esm/renderer/stylize/patterns/mosaic.d.ts +2 -0
- package/esm/renderer/stylize/patterns/mosaic.js +36 -0
- package/esm/renderer/stylize/patterns/square.d.ts +2 -0
- package/esm/renderer/stylize/patterns/square.js +22 -0
- package/esm/renderer/stylize/rough.d.ts +2 -0
- package/esm/renderer/stylize/rough.js +108 -0
- package/esm/renderer/types/index.d.ts +3 -0
- package/esm/renderer/types/index.js +1 -0
- package/esm/renderer/types/renderer.d.ts +6 -0
- package/esm/renderer/types/renderer.js +1 -0
- package/esm/renderer/types/stylize.d.ts +42 -0
- package/esm/renderer/types/stylize.js +1 -0
- package/esm/renderer/types/text.d.ts +3 -0
- package/esm/renderer/types/text.js +1 -0
- package/esm/renderer/utils/attrs.d.ts +2 -0
- package/esm/renderer/utils/attrs.js +21 -0
- package/esm/renderer/utils/id.d.ts +1 -0
- package/esm/renderer/utils/id.js +3 -0
- package/esm/renderer/utils/index.d.ts +2 -0
- package/esm/renderer/utils/index.js +2 -0
- package/esm/resource/index.d.ts +5 -0
- package/esm/resource/index.js +4 -0
- package/esm/resource/loader.d.ts +6 -0
- package/esm/resource/loader.js +54 -0
- package/esm/resource/loaders/image.d.ts +1 -0
- package/esm/resource/loaders/image.js +70 -0
- package/esm/resource/loaders/index.d.ts +3 -0
- package/esm/resource/loaders/index.js +3 -0
- package/esm/resource/loaders/remote.d.ts +1 -0
- package/esm/resource/loaders/remote.js +35 -0
- package/esm/resource/loaders/svg.d.ts +1 -0
- package/esm/resource/loaders/svg.js +12 -0
- package/esm/resource/registry.d.ts +3 -0
- package/esm/resource/registry.js +7 -0
- package/esm/resource/types/font.d.ts +12 -0
- package/esm/resource/types/font.js +1 -0
- package/esm/resource/types/index.d.ts +1 -0
- package/esm/resource/types/index.js +1 -0
- package/esm/resource/types/resource.d.ts +7 -0
- package/esm/resource/types/resource.js +1 -0
- package/esm/resource/utils/data-uri.d.ts +2 -0
- package/esm/resource/utils/data-uri.js +22 -0
- package/esm/resource/utils/hash.d.ts +1 -0
- package/esm/resource/utils/hash.js +11 -0
- package/esm/resource/utils/index.d.ts +4 -0
- package/esm/resource/utils/index.js +4 -0
- package/esm/resource/utils/parser.d.ts +2 -0
- package/esm/resource/utils/parser.js +6 -0
- package/esm/resource/utils/ref.d.ts +3 -0
- package/esm/resource/utils/ref.js +14 -0
- package/esm/runtime/Infographic.d.ts +15 -0
- package/esm/runtime/Infographic.js +45 -0
- package/esm/runtime/index.d.ts +1 -0
- package/esm/runtime/index.js +1 -0
- package/esm/templates/built-in.d.ts +1 -0
- package/esm/templates/built-in.js +693 -0
- package/esm/templates/hierarchy-tree.d.ts +2 -0
- package/esm/templates/hierarchy-tree.js +65 -0
- package/esm/templates/index.d.ts +3 -0
- package/esm/templates/index.js +2 -0
- package/esm/templates/registry.d.ts +4 -0
- package/esm/templates/registry.js +10 -0
- package/esm/templates/types.d.ts +3 -0
- package/esm/templates/types.js +1 -0
- package/esm/themes/built-in.d.ts +1 -0
- package/esm/themes/built-in.js +9 -0
- package/esm/themes/generator.d.ts +2 -0
- package/esm/themes/generator.js +82 -0
- package/esm/themes/index.d.ts +4 -0
- package/esm/themes/index.js +3 -0
- package/esm/themes/registry.d.ts +4 -0
- package/esm/themes/registry.js +10 -0
- package/esm/themes/types.d.ts +60 -0
- package/esm/themes/types.js +1 -0
- package/esm/types/attrs.d.ts +53 -0
- package/esm/types/attrs.js +1 -0
- package/esm/types/data.d.ts +17 -0
- package/esm/types/data.js +1 -0
- package/esm/types/element.d.ts +8 -0
- package/esm/types/element.js +1 -0
- package/esm/types/index.d.ts +5 -0
- package/esm/types/index.js +1 -0
- package/esm/types/padding.d.ts +2 -0
- package/esm/types/padding.js +1 -0
- package/esm/types/resource.d.ts +6 -0
- package/esm/types/resource.js +1 -0
- package/esm/utils/color.d.ts +2 -0
- package/esm/utils/color.js +19 -0
- package/esm/utils/data.d.ts +5 -0
- package/esm/utils/data.js +16 -0
- package/esm/utils/get-types.d.ts +7 -0
- package/esm/utils/get-types.js +47 -0
- package/esm/utils/icon.d.ts +6 -0
- package/esm/utils/icon.js +34 -0
- package/esm/utils/index.d.ts +11 -0
- package/esm/utils/index.js +11 -0
- package/esm/utils/item.d.ts +30 -0
- package/esm/utils/item.js +45 -0
- package/esm/utils/join.d.ts +1 -0
- package/esm/utils/join.js +6 -0
- package/esm/utils/padding.d.ts +2 -0
- package/esm/utils/padding.js +20 -0
- package/esm/utils/recognizer.d.ts +24 -0
- package/esm/utils/recognizer.js +52 -0
- package/esm/utils/svg.d.ts +8 -0
- package/esm/utils/svg.js +73 -0
- package/esm/utils/text.d.ts +2 -0
- package/esm/utils/text.js +115 -0
- package/esm/utils/uuid.d.ts +1 -0
- package/esm/utils/uuid.js +10 -0
- package/lib/constants/element.d.ts +11 -0
- package/lib/constants/element.js +2 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +17 -0
- package/lib/designs/components/Btn.d.ts +7 -0
- package/lib/designs/components/Btn.js +30 -0
- package/lib/designs/components/BtnsGroup.d.ts +5 -0
- package/lib/designs/components/BtnsGroup.js +9 -0
- package/lib/designs/components/Gap.d.ts +13 -0
- package/lib/designs/components/Gap.js +13 -0
- package/lib/designs/components/Illus.d.ts +6 -0
- package/lib/designs/components/Illus.js +17 -0
- package/lib/designs/components/ItemDesc.d.ts +7 -0
- package/lib/designs/components/ItemDesc.js +23 -0
- package/lib/designs/components/ItemIcon.d.ts +10 -0
- package/lib/designs/components/ItemIcon.js +34 -0
- package/lib/designs/components/ItemLabel.d.ts +6 -0
- package/lib/designs/components/ItemLabel.js +21 -0
- package/lib/designs/components/ItemValue.d.ts +8 -0
- package/lib/designs/components/ItemValue.js +22 -0
- package/lib/designs/components/ItemsGroup.d.ts +5 -0
- package/lib/designs/components/ItemsGroup.js +9 -0
- package/lib/designs/components/Title.d.ts +11 -0
- package/lib/designs/components/Title.js +36 -0
- package/lib/designs/components/index.d.ts +10 -0
- package/lib/designs/components/index.js +26 -0
- package/lib/designs/decorations/index.d.ts +3 -0
- package/lib/designs/decorations/index.js +19 -0
- package/lib/designs/decorations/simple-arrow.d.ts +6 -0
- package/lib/designs/decorations/simple-arrow.js +27 -0
- package/lib/designs/decorations/text-3d.d.ts +82 -0
- package/lib/designs/decorations/text-3d.js +17 -0
- package/lib/designs/decorations/triangle.d.ts +6 -0
- package/lib/designs/decorations/triangle.js +19 -0
- package/lib/designs/defs/DropShadow.d.ts +12 -0
- package/lib/designs/defs/DropShadow.js +9 -0
- package/lib/designs/defs/LinearGradient.d.ts +8 -0
- package/lib/designs/defs/LinearGradient.js +15 -0
- package/lib/designs/defs/index.d.ts +2 -0
- package/lib/designs/defs/index.js +18 -0
- package/lib/designs/index.d.ts +6 -0
- package/lib/designs/index.js +21 -0
- package/lib/designs/items/BadgeCard.d.ts +11 -0
- package/lib/designs/items/BadgeCard.js +40 -0
- package/lib/designs/items/CandyCardLite.d.ts +8 -0
- package/lib/designs/items/CandyCardLite.js +17 -0
- package/lib/designs/items/CapsuleItem.d.ts +10 -0
- package/lib/designs/items/CapsuleItem.js +60 -0
- package/lib/designs/items/CircleNode.d.ts +8 -0
- package/lib/designs/items/CircleNode.js +40 -0
- package/lib/designs/items/CircularProgress.d.ts +9 -0
- package/lib/designs/items/CircularProgress.js +28 -0
- package/lib/designs/items/CompactCard.d.ts +10 -0
- package/lib/designs/items/CompactCard.js +28 -0
- package/lib/designs/items/DoneList.d.ts +10 -0
- package/lib/designs/items/DoneList.js +24 -0
- package/lib/designs/items/HorizontalIconArrow.d.ts +7 -0
- package/lib/designs/items/HorizontalIconArrow.js +71 -0
- package/lib/designs/items/HorizontalIconLine.d.ts +7 -0
- package/lib/designs/items/HorizontalIconLine.js +44 -0
- package/lib/designs/items/IconBadge.d.ts +10 -0
- package/lib/designs/items/IconBadge.js +27 -0
- package/lib/designs/items/IndexedCard.d.ts +20 -0
- package/lib/designs/items/IndexedCard.js +69 -0
- package/lib/designs/items/LCornerCard.d.ts +8 -0
- package/lib/designs/items/LCornerCard.js +44 -0
- package/lib/designs/items/LetterCard.d.ts +16 -0
- package/lib/designs/items/LetterCard.js +61 -0
- package/lib/designs/items/PillBadge.d.ts +10 -0
- package/lib/designs/items/PillBadge.js +47 -0
- package/lib/designs/items/PlainText.d.ts +9 -0
- package/lib/designs/items/PlainText.js +20 -0
- package/lib/designs/items/ProgressCard.d.ts +12 -0
- package/lib/designs/items/ProgressCard.js +55 -0
- package/lib/designs/items/QuarterCircular.d.ts +10 -0
- package/lib/designs/items/QuarterCircular.js +149 -0
- package/lib/designs/items/QuarterSimpleCard.d.ts +11 -0
- package/lib/designs/items/QuarterSimpleCard.js +121 -0
- package/lib/designs/items/RibbonCard.d.ts +11 -0
- package/lib/designs/items/RibbonCard.js +31 -0
- package/lib/designs/items/RoundedRectNode.d.ts +9 -0
- package/lib/designs/items/RoundedRectNode.js +28 -0
- package/lib/designs/items/SimpleHorizontalArrow.d.ts +9 -0
- package/lib/designs/items/SimpleHorizontalArrow.js +45 -0
- package/lib/designs/items/SimpleIllusItem.d.ts +10 -0
- package/lib/designs/items/SimpleIllusItem.js +25 -0
- package/lib/designs/items/SimpleItem.d.ts +13 -0
- package/lib/designs/items/SimpleItem.js +116 -0
- package/lib/designs/items/SimpleVerticalArrow.d.ts +9 -0
- package/lib/designs/items/SimpleVerticalArrow.js +41 -0
- package/lib/designs/items/UnderlineText.d.ts +8 -0
- package/lib/designs/items/UnderlineText.js +49 -0
- package/lib/designs/items/VerticalIconArrow.d.ts +9 -0
- package/lib/designs/items/VerticalIconArrow.js +64 -0
- package/lib/designs/items/index.d.ts +28 -0
- package/lib/designs/items/index.js +43 -0
- package/lib/designs/items/registry.d.ts +4 -0
- package/lib/designs/items/registry.js +15 -0
- package/lib/designs/items/types.d.ts +24 -0
- package/lib/designs/items/types.js +2 -0
- package/lib/designs/layouts/Align.d.ts +9 -0
- package/lib/designs/layouts/Align.js +82 -0
- package/lib/designs/layouts/Flex.d.ts +11 -0
- package/lib/designs/layouts/Flex.js +207 -0
- package/lib/designs/layouts/index.d.ts +2 -0
- package/lib/designs/layouts/index.js +18 -0
- package/lib/designs/structures/chart-column.d.ts +12 -0
- package/lib/designs/structures/chart-column.js +75 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/index.d.ts +5 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/index.js +23 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.d.ts +4 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +23 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.d.ts +4 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +23 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/types.d.ts +11 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/types.js +14 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/vs.d.ts +4 -0
- package/lib/designs/structures/compare-binary-horizontal/dividers/vs.js +21 -0
- package/lib/designs/structures/compare-binary-horizontal/index.d.ts +12 -0
- package/lib/designs/structures/compare-binary-horizontal/index.js +90 -0
- package/lib/designs/structures/compare-hierarchy-left-right.d.ts +18 -0
- package/lib/designs/structures/compare-hierarchy-left-right.js +144 -0
- package/lib/designs/structures/compare-hierarchy-row.d.ts +17 -0
- package/lib/designs/structures/compare-hierarchy-row.js +78 -0
- package/lib/designs/structures/hierarchy-tree.d.ts +41 -0
- package/lib/designs/structures/hierarchy-tree.js +333 -0
- package/lib/designs/structures/index.d.ts +32 -0
- package/lib/designs/structures/index.js +47 -0
- package/lib/designs/structures/list-column.d.ts +9 -0
- package/lib/designs/structures/list-column.js +38 -0
- package/lib/designs/structures/list-grid.d.ts +9 -0
- package/lib/designs/structures/list-grid.js +51 -0
- package/lib/designs/structures/list-pyramid.d.ts +8 -0
- package/lib/designs/structures/list-pyramid.js +63 -0
- package/lib/designs/structures/list-row.d.ts +8 -0
- package/lib/designs/structures/list-row.js +40 -0
- package/lib/designs/structures/list-sector.d.ts +11 -0
- package/lib/designs/structures/list-sector.js +151 -0
- package/lib/designs/structures/list-waterfall.d.ts +9 -0
- package/lib/designs/structures/list-waterfall.js +59 -0
- package/lib/designs/structures/quadrant.d.ts +14 -0
- package/lib/designs/structures/quadrant.js +100 -0
- package/lib/designs/structures/registry.d.ts +4 -0
- package/lib/designs/structures/registry.js +15 -0
- package/lib/designs/structures/relation-circle.d.ts +8 -0
- package/lib/designs/structures/relation-circle.js +81 -0
- package/lib/designs/structures/relation-network.d.ts +19 -0
- package/lib/designs/structures/relation-network.js +129 -0
- package/lib/designs/structures/sequence-ascending-stairs-3d.d.ts +7 -0
- package/lib/designs/structures/sequence-ascending-stairs-3d.js +67 -0
- package/lib/designs/structures/sequence-ascending-steps.d.ts +8 -0
- package/lib/designs/structures/sequence-ascending-steps.js +36 -0
- package/lib/designs/structures/sequence-circle-arrows.d.ts +9 -0
- package/lib/designs/structures/sequence-circle-arrows.js +235 -0
- package/lib/designs/structures/sequence-circular.d.ts +13 -0
- package/lib/designs/structures/sequence-circular.js +175 -0
- package/lib/designs/structures/sequence-color-snake-steps.d.ts +11 -0
- package/lib/designs/structures/sequence-color-snake-steps.js +94 -0
- package/lib/designs/structures/sequence-cylinders-3d.d.ts +15 -0
- package/lib/designs/structures/sequence-cylinders-3d.js +284 -0
- package/lib/designs/structures/sequence-filter-mesh.d.ts +7 -0
- package/lib/designs/structures/sequence-filter-mesh.js +221 -0
- package/lib/designs/structures/sequence-horizontal-zigzag.d.ts +8 -0
- package/lib/designs/structures/sequence-horizontal-zigzag.js +157 -0
- package/lib/designs/structures/sequence-mountain.d.ts +11 -0
- package/lib/designs/structures/sequence-mountain.js +288 -0
- package/lib/designs/structures/sequence-pyramid.d.ts +10 -0
- package/lib/designs/structures/sequence-pyramid.js +134 -0
- package/lib/designs/structures/sequence-roadmap-vertical.d.ts +9 -0
- package/lib/designs/structures/sequence-roadmap-vertical.js +155 -0
- package/lib/designs/structures/sequence-snake-steps.d.ts +9 -0
- package/lib/designs/structures/sequence-snake-steps.js +82 -0
- package/lib/designs/structures/sequence-steps.d.ts +7 -0
- package/lib/designs/structures/sequence-steps.js +51 -0
- package/lib/designs/structures/sequence-timeline.d.ts +8 -0
- package/lib/designs/structures/sequence-timeline.js +68 -0
- package/lib/designs/structures/sequence-zigzag-pucks-3d.d.ts +7 -0
- package/lib/designs/structures/sequence-zigzag-pucks-3d.js +74 -0
- package/lib/designs/structures/sequence-zigzag-steps.d.ts +9 -0
- package/lib/designs/structures/sequence-zigzag-steps.js +130 -0
- package/lib/designs/structures/types.d.ts +19 -0
- package/lib/designs/structures/types.js +2 -0
- package/lib/designs/title/index.d.ts +1 -0
- package/lib/designs/title/index.js +2 -0
- package/lib/designs/title/types.d.ts +4 -0
- package/lib/designs/title/types.js +2 -0
- package/lib/designs/types.d.ts +29 -0
- package/lib/designs/types.js +2 -0
- package/lib/designs/utils/color.d.ts +8 -0
- package/lib/designs/utils/color.js +32 -0
- package/lib/designs/utils/hierarchy-color.d.ts +61 -0
- package/lib/designs/utils/hierarchy-color.js +105 -0
- package/lib/designs/utils/index.d.ts +3 -0
- package/lib/designs/utils/index.js +19 -0
- package/lib/designs/utils/item.d.ts +14 -0
- package/lib/designs/utils/item.js +54 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +39 -0
- package/lib/jsx-runtime.d.ts +1 -0
- package/lib/jsx-runtime.js +17 -0
- package/lib/options/index.d.ts +2 -0
- package/lib/options/index.js +5 -0
- package/lib/options/parser.d.ts +2 -0
- package/lib/options/parser.js +116 -0
- package/lib/options/types.d.ts +45 -0
- package/lib/options/types.js +2 -0
- package/lib/renderer/composites/background.d.ts +1 -0
- package/lib/renderer/composites/background.js +29 -0
- package/lib/renderer/composites/button.d.ts +1 -0
- package/lib/renderer/composites/button.js +71 -0
- package/lib/renderer/composites/icon.d.ts +6 -0
- package/lib/renderer/composites/icon.js +41 -0
- package/lib/renderer/composites/illus.d.ts +3 -0
- package/lib/renderer/composites/illus.js +82 -0
- package/lib/renderer/composites/index.d.ts +7 -0
- package/lib/renderer/composites/index.js +22 -0
- package/lib/renderer/composites/shape.d.ts +4 -0
- package/lib/renderer/composites/shape.js +50 -0
- package/lib/renderer/composites/svg.d.ts +2 -0
- package/lib/renderer/composites/svg.js +9 -0
- package/lib/renderer/composites/text.d.ts +6 -0
- package/lib/renderer/composites/text.js +107 -0
- package/lib/renderer/constants/data-url.d.ts +5 -0
- package/lib/renderer/constants/data-url.js +2 -0
- package/lib/renderer/constants/index.d.ts +2 -0
- package/lib/renderer/constants/index.js +18 -0
- package/lib/renderer/fonts/built-in.d.ts +2 -0
- package/lib/renderer/fonts/built-in.js +40 -0
- package/lib/renderer/fonts/index.d.ts +4 -0
- package/lib/renderer/fonts/index.js +20 -0
- package/lib/renderer/fonts/loader.d.ts +4 -0
- package/lib/renderer/fonts/loader.js +60 -0
- package/lib/renderer/fonts/registry.d.ts +24 -0
- package/lib/renderer/fonts/registry.js +53 -0
- package/lib/renderer/fonts/types.d.ts +9 -0
- package/lib/renderer/fonts/types.js +2 -0
- package/lib/renderer/fonts/utils.d.ts +4 -0
- package/lib/renderer/fonts/utils.js +40 -0
- package/lib/renderer/index.d.ts +4 -0
- package/lib/renderer/index.js +21 -0
- package/lib/renderer/palettes/built-in.d.ts +3 -0
- package/lib/renderer/palettes/built-in.js +85 -0
- package/lib/renderer/palettes/index.d.ts +5 -0
- package/lib/renderer/palettes/index.js +9 -0
- package/lib/renderer/palettes/registry.d.ts +3 -0
- package/lib/renderer/palettes/registry.js +11 -0
- package/lib/renderer/palettes/types.d.ts +1 -0
- package/lib/renderer/palettes/types.js +2 -0
- package/lib/renderer/palettes/utils.d.ts +2 -0
- package/lib/renderer/palettes/utils.js +18 -0
- package/lib/renderer/renderer.d.ts +11 -0
- package/lib/renderer/renderer.js +211 -0
- package/lib/renderer/stylize/gradient.d.ts +2 -0
- package/lib/renderer/stylize/gradient.js +108 -0
- package/lib/renderer/stylize/index.d.ts +3 -0
- package/lib/renderer/stylize/index.js +9 -0
- package/lib/renderer/stylize/pattern.d.ts +3 -0
- package/lib/renderer/stylize/pattern.js +97 -0
- package/lib/renderer/stylize/patterns/diamond.d.ts +2 -0
- package/lib/renderer/stylize/patterns/diamond.js +27 -0
- package/lib/renderer/stylize/patterns/dot.d.ts +2 -0
- package/lib/renderer/stylize/patterns/dot.js +35 -0
- package/lib/renderer/stylize/patterns/hex.d.ts +2 -0
- package/lib/renderer/stylize/patterns/hex.js +26 -0
- package/lib/renderer/stylize/patterns/index.d.ts +6 -0
- package/lib/renderer/stylize/patterns/index.js +15 -0
- package/lib/renderer/stylize/patterns/line.d.ts +2 -0
- package/lib/renderer/stylize/patterns/line.js +43 -0
- package/lib/renderer/stylize/patterns/mosaic.d.ts +2 -0
- package/lib/renderer/stylize/patterns/mosaic.js +40 -0
- package/lib/renderer/stylize/patterns/square.d.ts +2 -0
- package/lib/renderer/stylize/patterns/square.js +26 -0
- package/lib/renderer/stylize/rough.d.ts +2 -0
- package/lib/renderer/stylize/rough.js +114 -0
- package/lib/renderer/types/index.d.ts +3 -0
- package/lib/renderer/types/index.js +2 -0
- package/lib/renderer/types/renderer.d.ts +6 -0
- package/lib/renderer/types/renderer.js +2 -0
- package/lib/renderer/types/stylize.d.ts +42 -0
- package/lib/renderer/types/stylize.js +2 -0
- package/lib/renderer/types/text.d.ts +3 -0
- package/lib/renderer/types/text.js +2 -0
- package/lib/renderer/utils/attrs.d.ts +2 -0
- package/lib/renderer/utils/attrs.js +24 -0
- package/lib/renderer/utils/id.d.ts +1 -0
- package/lib/renderer/utils/id.js +6 -0
- package/lib/renderer/utils/index.d.ts +2 -0
- package/lib/renderer/utils/index.js +18 -0
- package/lib/resource/index.d.ts +5 -0
- package/lib/resource/index.js +26 -0
- package/lib/resource/loader.d.ts +6 -0
- package/lib/resource/loader.js +57 -0
- package/lib/resource/loaders/image.d.ts +1 -0
- package/lib/resource/loaders/image.js +73 -0
- package/lib/resource/loaders/index.d.ts +3 -0
- package/lib/resource/loaders/index.js +19 -0
- package/lib/resource/loaders/remote.d.ts +1 -0
- package/lib/resource/loaders/remote.js +38 -0
- package/lib/resource/loaders/svg.d.ts +1 -0
- package/lib/resource/loaders/svg.js +15 -0
- package/lib/resource/registry.d.ts +3 -0
- package/lib/resource/registry.js +11 -0
- package/lib/resource/types/font.d.ts +12 -0
- package/lib/resource/types/font.js +2 -0
- package/lib/resource/types/index.d.ts +1 -0
- package/lib/resource/types/index.js +2 -0
- package/lib/resource/types/resource.d.ts +7 -0
- package/lib/resource/types/resource.js +2 -0
- package/lib/resource/utils/data-uri.d.ts +2 -0
- package/lib/resource/utils/data-uri.js +25 -0
- package/lib/resource/utils/hash.d.ts +1 -0
- package/lib/resource/utils/hash.js +14 -0
- package/lib/resource/utils/index.d.ts +4 -0
- package/lib/resource/utils/index.js +20 -0
- package/lib/resource/utils/parser.d.ts +2 -0
- package/lib/resource/utils/parser.js +9 -0
- package/lib/resource/utils/ref.d.ts +3 -0
- package/lib/resource/utils/ref.js +18 -0
- package/lib/runtime/Infographic.d.ts +15 -0
- package/lib/runtime/Infographic.js +49 -0
- package/lib/runtime/index.d.ts +1 -0
- package/lib/runtime/index.js +17 -0
- package/lib/templates/built-in.d.ts +1 -0
- package/lib/templates/built-in.js +695 -0
- package/lib/templates/hierarchy-tree.d.ts +2 -0
- package/lib/templates/hierarchy-tree.js +68 -0
- package/lib/templates/index.d.ts +3 -0
- package/lib/templates/index.js +18 -0
- package/lib/templates/registry.d.ts +4 -0
- package/lib/templates/registry.js +15 -0
- package/lib/templates/types.d.ts +3 -0
- package/lib/templates/types.js +2 -0
- package/lib/themes/built-in.d.ts +1 -0
- package/lib/themes/built-in.js +11 -0
- package/lib/themes/generator.d.ts +2 -0
- package/lib/themes/generator.js +86 -0
- package/lib/themes/index.d.ts +4 -0
- package/lib/themes/index.js +21 -0
- package/lib/themes/registry.d.ts +4 -0
- package/lib/themes/registry.js +15 -0
- package/lib/themes/types.d.ts +60 -0
- package/lib/themes/types.js +2 -0
- package/lib/types/attrs.d.ts +53 -0
- package/lib/types/attrs.js +2 -0
- package/lib/types/data.d.ts +17 -0
- package/lib/types/data.js +2 -0
- package/lib/types/element.d.ts +8 -0
- package/lib/types/element.js +2 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.js +2 -0
- package/lib/types/padding.d.ts +2 -0
- package/lib/types/padding.js +2 -0
- package/lib/types/resource.d.ts +6 -0
- package/lib/types/resource.js +2 -0
- package/lib/utils/color.d.ts +2 -0
- package/lib/utils/color.js +23 -0
- package/lib/utils/data.d.ts +5 -0
- package/lib/utils/data.js +22 -0
- package/lib/utils/get-types.d.ts +7 -0
- package/lib/utils/get-types.js +50 -0
- package/lib/utils/icon.d.ts +6 -0
- package/lib/utils/icon.js +40 -0
- package/lib/utils/index.d.ts +11 -0
- package/lib/utils/index.js +27 -0
- package/lib/utils/item.d.ts +30 -0
- package/lib/utils/item.js +53 -0
- package/lib/utils/join.d.ts +1 -0
- package/lib/utils/join.js +9 -0
- package/lib/utils/padding.d.ts +2 -0
- package/lib/utils/padding.js +23 -0
- package/lib/utils/recognizer.d.ts +24 -0
- package/lib/utils/recognizer.js +79 -0
- package/lib/utils/svg.d.ts +8 -0
- package/lib/utils/svg.js +83 -0
- package/lib/utils/text.d.ts +2 -0
- package/lib/utils/text.js +121 -0
- package/lib/utils/uuid.d.ts +1 -0
- package/lib/utils/uuid.js +13 -0
- package/package.json +69 -0
- package/src/constants/element.ts +11 -0
- package/src/constants/index.ts +1 -0
- package/src/designs/components/Btn.tsx +32 -0
- package/src/designs/components/BtnsGroup.tsx +9 -0
- package/src/designs/components/Gap.tsx +17 -0
- package/src/designs/components/Illus.tsx +21 -0
- package/src/designs/components/ItemDesc.tsx +37 -0
- package/src/designs/components/ItemIcon.tsx +53 -0
- package/src/designs/components/ItemLabel.tsx +29 -0
- package/src/designs/components/ItemValue.tsx +37 -0
- package/src/designs/components/ItemsGroup.tsx +9 -0
- package/src/designs/components/Title.tsx +77 -0
- package/src/designs/components/index.ts +10 -0
- package/src/designs/decorations/index.ts +3 -0
- package/src/designs/decorations/simple-arrow.tsx +57 -0
- package/src/designs/decorations/text-3d.tsx +158 -0
- package/src/designs/decorations/triangle.tsx +40 -0
- package/src/designs/defs/DropShadow.tsx +33 -0
- package/src/designs/defs/LinearGradient.tsx +31 -0
- package/src/designs/defs/index.ts +2 -0
- package/src/designs/index.ts +6 -0
- package/src/designs/items/BadgeCard.tsx +165 -0
- package/src/designs/items/CandyCardLite.tsx +88 -0
- package/src/designs/items/CapsuleItem.tsx +148 -0
- package/src/designs/items/CircleNode.tsx +107 -0
- package/src/designs/items/CircularProgress.tsx +106 -0
- package/src/designs/items/CompactCard.tsx +147 -0
- package/src/designs/items/DoneList.tsx +69 -0
- package/src/designs/items/HorizontalIconArrow.tsx +225 -0
- package/src/designs/items/HorizontalIconLine.tsx +152 -0
- package/src/designs/items/IconBadge.tsx +125 -0
- package/src/designs/items/IndexedCard.tsx +210 -0
- package/src/designs/items/LCornerCard.tsx +109 -0
- package/src/designs/items/LetterCard.tsx +187 -0
- package/src/designs/items/PillBadge.tsx +138 -0
- package/src/designs/items/PlainText.tsx +53 -0
- package/src/designs/items/ProgressCard.tsx +198 -0
- package/src/designs/items/QuarterCircular.tsx +284 -0
- package/src/designs/items/QuarterSimpleCard.tsx +210 -0
- package/src/designs/items/RibbonCard.tsx +151 -0
- package/src/designs/items/RoundedRectNode.tsx +79 -0
- package/src/designs/items/SimpleHorizontalArrow.tsx +150 -0
- package/src/designs/items/SimpleIllusItem.tsx +78 -0
- package/src/designs/items/SimpleItem.tsx +336 -0
- package/src/designs/items/SimpleVerticalArrow.tsx +147 -0
- package/src/designs/items/UnderlineText.tsx +126 -0
- package/src/designs/items/VerticalIconArrow.tsx +227 -0
- package/src/designs/items/index.ts +28 -0
- package/src/designs/items/prompt.md +891 -0
- package/src/designs/items/registry.ts +15 -0
- package/src/designs/items/types.ts +28 -0
- package/src/designs/layouts/Align.tsx +104 -0
- package/src/designs/layouts/Flex.tsx +274 -0
- package/src/designs/layouts/index.tsx +2 -0
- package/src/designs/structures/chart-column.tsx +186 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/index.ts +5 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.tsx +46 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.tsx +68 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/types.ts +26 -0
- package/src/designs/structures/compare-binary-horizontal/dividers/vs.tsx +57 -0
- package/src/designs/structures/compare-binary-horizontal/index.tsx +271 -0
- package/src/designs/structures/compare-hierarchy-left-right.tsx +362 -0
- package/src/designs/structures/compare-hierarchy-row.tsx +220 -0
- package/src/designs/structures/hierarchy-tree.tsx +594 -0
- package/src/designs/structures/index.ts +32 -0
- package/src/designs/structures/list-column.tsx +89 -0
- package/src/designs/structures/list-grid.tsx +118 -0
- package/src/designs/structures/list-pyramid.tsx +132 -0
- package/src/designs/structures/list-row.tsx +90 -0
- package/src/designs/structures/list-sector.tsx +296 -0
- package/src/designs/structures/list-waterfall.tsx +140 -0
- package/src/designs/structures/prompt.md +996 -0
- package/src/designs/structures/quadrant.tsx +241 -0
- package/src/designs/structures/registry.ts +15 -0
- package/src/designs/structures/relation-circle.tsx +150 -0
- package/src/designs/structures/relation-network.tsx +191 -0
- package/src/designs/structures/sequence-ascending-stairs-3d.tsx +241 -0
- package/src/designs/structures/sequence-ascending-steps.tsx +81 -0
- package/src/designs/structures/sequence-circle-arrows.tsx +392 -0
- package/src/designs/structures/sequence-circular.tsx +368 -0
- package/src/designs/structures/sequence-color-snake-steps.tsx +223 -0
- package/src/designs/structures/sequence-cylinders-3d.tsx +804 -0
- package/src/designs/structures/sequence-filter-mesh.tsx +443 -0
- package/src/designs/structures/sequence-horizontal-zigzag.tsx +310 -0
- package/src/designs/structures/sequence-mountain.tsx +567 -0
- package/src/designs/structures/sequence-pyramid.tsx +222 -0
- package/src/designs/structures/sequence-roadmap-vertical.tsx +338 -0
- package/src/designs/structures/sequence-snake-steps.tsx +191 -0
- package/src/designs/structures/sequence-steps.tsx +122 -0
- package/src/designs/structures/sequence-timeline.tsx +189 -0
- package/src/designs/structures/sequence-zigzag-pucks-3d.tsx +261 -0
- package/src/designs/structures/sequence-zigzag-steps.tsx +280 -0
- package/src/designs/structures/types.ts +25 -0
- package/src/designs/title/index.ts +1 -0
- package/src/designs/title/types.ts +4 -0
- package/src/designs/types.ts +27 -0
- package/src/designs/utils/color.ts +53 -0
- package/src/designs/utils/hierarchy-color.ts +127 -0
- package/src/designs/utils/index.ts +3 -0
- package/src/designs/utils/item.ts +66 -0
- package/src/index.ts +13 -0
- package/src/jsx-runtime.ts +1 -0
- package/src/options/index.ts +2 -0
- package/src/options/parser.ts +163 -0
- package/src/options/types.ts +47 -0
- package/src/renderer/composites/background.ts +33 -0
- package/src/renderer/composites/button.ts +99 -0
- package/src/renderer/composites/icon.ts +61 -0
- package/src/renderer/composites/illus.ts +119 -0
- package/src/renderer/composites/index.ts +7 -0
- package/src/renderer/composites/shape.ts +80 -0
- package/src/renderer/composites/svg.ts +12 -0
- package/src/renderer/composites/text.ts +160 -0
- package/src/renderer/constants/data-url.ts +5 -0
- package/src/renderer/constants/index.ts +2 -0
- package/src/renderer/fonts/built-in.ts +41 -0
- package/src/renderer/fonts/index.ts +15 -0
- package/src/renderer/fonts/loader.ts +64 -0
- package/src/renderer/fonts/registry.ts +51 -0
- package/src/renderer/fonts/types.ts +20 -0
- package/src/renderer/fonts/utils.ts +39 -0
- package/src/renderer/index.ts +4 -0
- package/src/renderer/palettes/built-in.ts +86 -0
- package/src/renderer/palettes/index.ts +6 -0
- package/src/renderer/palettes/registry.ts +11 -0
- package/src/renderer/palettes/types.ts +4 -0
- package/src/renderer/palettes/utils.ts +21 -0
- package/src/renderer/renderer.ts +325 -0
- package/src/renderer/stylize/gradient.ts +131 -0
- package/src/renderer/stylize/index.ts +3 -0
- package/src/renderer/stylize/pattern.ts +82 -0
- package/src/renderer/stylize/patterns/diamond.ts +29 -0
- package/src/renderer/stylize/patterns/dot.ts +37 -0
- package/src/renderer/stylize/patterns/hex.ts +29 -0
- package/src/renderer/stylize/patterns/index.ts +6 -0
- package/src/renderer/stylize/patterns/line.ts +46 -0
- package/src/renderer/stylize/patterns/mosaic.ts +45 -0
- package/src/renderer/stylize/patterns/square.ts +29 -0
- package/src/renderer/stylize/rough.ts +149 -0
- package/src/renderer/types/index.ts +3 -0
- package/src/renderer/types/renderer.ts +7 -0
- package/src/renderer/types/stylize.ts +43 -0
- package/src/renderer/types/text.ts +3 -0
- package/src/renderer/utils/attrs.ts +27 -0
- package/src/renderer/utils/id.ts +3 -0
- package/src/renderer/utils/index.ts +2 -0
- package/src/resource/index.ts +5 -0
- package/src/resource/loader.ts +64 -0
- package/src/resource/loaders/image.ts +87 -0
- package/src/resource/loaders/index.ts +3 -0
- package/src/resource/loaders/remote.ts +40 -0
- package/src/resource/loaders/svg.ts +13 -0
- package/src/resource/registry.ts +11 -0
- package/src/resource/types/font.ts +23 -0
- package/src/resource/types/index.ts +1 -0
- package/src/resource/types/resource.ts +9 -0
- package/src/resource/utils/data-uri.ts +26 -0
- package/src/resource/utils/hash.ts +11 -0
- package/src/resource/utils/index.ts +4 -0
- package/src/resource/utils/parser.ts +9 -0
- package/src/resource/utils/ref.ts +15 -0
- package/src/runtime/Infographic.tsx +65 -0
- package/src/runtime/index.ts +1 -0
- package/src/templates/built-in.ts +696 -0
- package/src/templates/hierarchy-tree.ts +70 -0
- package/src/templates/index.ts +3 -0
- package/src/templates/registry.ts +15 -0
- package/src/templates/types.ts +11 -0
- package/src/themes/built-in.ts +10 -0
- package/src/themes/generator.ts +131 -0
- package/src/themes/index.ts +4 -0
- package/src/themes/registry.ts +15 -0
- package/src/themes/types.ts +66 -0
- package/src/types/attrs.ts +56 -0
- package/src/types/data.ts +19 -0
- package/src/types/element.ts +13 -0
- package/src/types/index.ts +5 -0
- package/src/types/padding.ts +3 -0
- package/src/types/resource.ts +8 -0
- package/src/utils/color.ts +21 -0
- package/src/utils/data.ts +21 -0
- package/src/utils/get-types.ts +67 -0
- package/src/utils/icon.ts +51 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/item.ts +56 -0
- package/src/utils/join.ts +6 -0
- package/src/utils/padding.ts +21 -0
- package/src/utils/recognizer.ts +70 -0
- package/src/utils/svg.ts +104 -0
- package/src/utils/text.ts +150 -0
- package/src/utils/uuid.ts +11 -0
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
# 信息图结构生成 Agent 提示词
|
|
2
|
+
|
|
3
|
+
你是一个专业的信息图结构组件生成专家。你的任务是根据用户需求,生成符合 @antv/infographic-jsx 框架规范的结构组件代码。
|
|
4
|
+
|
|
5
|
+
## 框架核心概念
|
|
6
|
+
|
|
7
|
+
信息图框架由三个核心部分组成:
|
|
8
|
+
|
|
9
|
+
- **结构 (Structure)**: 负责整体布局和数据项的组织方式
|
|
10
|
+
- **标题 (Title)**: 可选的标题组件
|
|
11
|
+
- **数据项 (Item/Items)**: 单个或多个信息单元的展示组件
|
|
12
|
+
|
|
13
|
+
结构是入口组件,通过组合 Title 和 Item/Items,配合布局逻辑和交互按钮,形成完整的信息图。对于层级结构,可以使用 `Items` 数组传递多个组件(如根节点组件和子节点组件)。
|
|
14
|
+
|
|
15
|
+
## 结构分类体系
|
|
16
|
+
|
|
17
|
+
根据信息组织特点,结构分为以下类型:
|
|
18
|
+
|
|
19
|
+
1. **列表结构 (list-\*)**: 信息项并列排布,无明显方向性或层级关系
|
|
20
|
+
- 横向列表、纵向列表、网格列表、瀑布流等
|
|
21
|
+
|
|
22
|
+
2. **对比结构 (compare-\*)**: 明确的二元或多元对比布局
|
|
23
|
+
- 左右对比、上下对比、多项对比、镜像对比等
|
|
24
|
+
|
|
25
|
+
3. **顺序结构 (sequence-\*)**: 具有明确方向性和顺序性的信息流
|
|
26
|
+
- 时间轴、步骤流程、阶梯式、S型流程等
|
|
27
|
+
|
|
28
|
+
4. **层级结构 (hierarchy-\*)**: 树状、嵌套或明显的主次关系布局
|
|
29
|
+
- 树形、金字塔、放射状、嵌套圈等
|
|
30
|
+
|
|
31
|
+
5. **关系结构 (relation-\*)**: 展示元素间的连接、依赖或相互作用关系
|
|
32
|
+
- 网络图、矩阵、循环图、维恩图等
|
|
33
|
+
|
|
34
|
+
6. **地理结构 (geo-\*)**: 基于地理空间或物理位置的信息组织
|
|
35
|
+
- 地图标注、区域分布、路线图等
|
|
36
|
+
|
|
37
|
+
7. **统计图 (chart-\*)**: 以图表形式展示定量数据关系
|
|
38
|
+
- 柱状图、饼图、折线图、雷达图等
|
|
39
|
+
|
|
40
|
+
## 技术规范
|
|
41
|
+
|
|
42
|
+
### 1. 类型定义
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
export interface BaseStructureProps {
|
|
46
|
+
Title?: ComponentType<Pick<TitleProps, 'title' | 'desc'>>;
|
|
47
|
+
Item?: ComponentType<
|
|
48
|
+
Omit<BaseItemProps, 'themeColors'> &
|
|
49
|
+
Partial<Pick<BaseItemProps, 'themeColors'>>
|
|
50
|
+
>;
|
|
51
|
+
Items?: ComponentType<Omit<BaseItemProps, 'themeColors'>>[];
|
|
52
|
+
data: Data;
|
|
53
|
+
options: ParsedInfographicOptions;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface Data {
|
|
57
|
+
title?: string;
|
|
58
|
+
desc?: string;
|
|
59
|
+
items: ItemDatum[];
|
|
60
|
+
illus?: Record<string, string | ResourceConfig>;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ItemDatum {
|
|
65
|
+
icon?: string | ResourceConfig;
|
|
66
|
+
label?: string;
|
|
67
|
+
desc?: string;
|
|
68
|
+
value?: number;
|
|
69
|
+
illus?: string | ResourceConfig;
|
|
70
|
+
children?: ItemDatum[];
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface BaseItemProps {
|
|
75
|
+
x?: number;
|
|
76
|
+
y?: number;
|
|
77
|
+
id?: string;
|
|
78
|
+
indexes: number[];
|
|
79
|
+
data: Data;
|
|
80
|
+
datum: Data['items'][number];
|
|
81
|
+
themeColors?: ThemeColors;
|
|
82
|
+
positionH?: 'normal' | 'center' | 'flipped';
|
|
83
|
+
positionV?: 'normal' | 'center' | 'flipped';
|
|
84
|
+
width?: number;
|
|
85
|
+
height?: number;
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**重要说明**:
|
|
91
|
+
|
|
92
|
+
- 对于简单结构,使用 `Item` 属性传递单个组件
|
|
93
|
+
- 对于层级结构(如树形、金字塔等),使用 `Items` 数组传递多个组件,不同层级可以使用不同的组件样式
|
|
94
|
+
- `options` 包含主题配置、调色板等信息,可通过工具函数访问
|
|
95
|
+
- `themeColors` 在 `BaseItemProps` 中是可选的,部分组件会自定义传入
|
|
96
|
+
|
|
97
|
+
### 2. 可用组件清单
|
|
98
|
+
|
|
99
|
+
**必须从以下组件中选择,不得使用未列出的组件:**
|
|
100
|
+
|
|
101
|
+
#### 原子组件 (从 @antv/infographic-jsx 导入)
|
|
102
|
+
|
|
103
|
+
所有原子组件统一使用 `x`, `y`, `width`, `height` 属性来定义位置和尺寸,不使用 SVG 原生属性如 cx/cy/r 等。
|
|
104
|
+
|
|
105
|
+
- **Defs**: 定义渐变、滤镜等 SVG 定义
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
<Defs>{/* 渐变、滤镜等定义 */}</Defs>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- **Ellipse**: 椭圆图形
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
<Ellipse x={0} y={0} width={100} height={60} fill="blue" />
|
|
115
|
+
// 注意:
|
|
116
|
+
// 1. x/y 为左上角位置,非中心点
|
|
117
|
+
// 2. 使用 width/height,不使用 rx/ry
|
|
118
|
+
// 3. 绘制圆形时,width 和 height 相等
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- **Group**: 分组容器
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
<Group x={10} y={10}>
|
|
125
|
+
{children}
|
|
126
|
+
</Group>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- **Path**: 路径图形
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
<Path d="M 0 0 L 100 100" stroke="black" strokeWidth={2} width={100} height={100} />
|
|
133
|
+
// width/height 为 d 的预估尺寸
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- **Rect**: 矩形图形
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
<Rect x={0} y={0} width={100} height={50} fill="red" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- **Text**: 文本元素(支持换行)
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
<Text
|
|
146
|
+
x={0}
|
|
147
|
+
y={0}
|
|
148
|
+
width={100}
|
|
149
|
+
height={50}
|
|
150
|
+
fontSize={14}
|
|
151
|
+
fontWeight="normal" // 或 'bold'
|
|
152
|
+
alignHorizontal="center" // 'left' | 'center' | 'right'
|
|
153
|
+
alignVertical="center" // 'top' | 'center' | 'bottom'
|
|
154
|
+
fill="#000000"
|
|
155
|
+
>
|
|
156
|
+
Text Content
|
|
157
|
+
</Text>
|
|
158
|
+
// 注意: 文本内容作为 children 传入,不是 text 属性
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- **Polygon**: 多边形
|
|
162
|
+
```typescript
|
|
163
|
+
<Polygon
|
|
164
|
+
points={[
|
|
165
|
+
{ x: 0, y: 0 },
|
|
166
|
+
{ x: 100, y: 0 },
|
|
167
|
+
{ x: 50, y: 100 },
|
|
168
|
+
]}
|
|
169
|
+
fill="green"
|
|
170
|
+
/>
|
|
171
|
+
// 注意: points 是对象数组 {x, y}[],不是字符串
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### 封装组件 (从 ../components 导入)
|
|
175
|
+
|
|
176
|
+
- **BtnAdd**: 添加按钮,需要 indexes 属性
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
<BtnAdd indexes={[0]} x={10} y={20} />
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- **BtnRemove**: 删除按钮,需要 indexes 属性
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
<BtnRemove indexes={[0]} x={10} y={20} />
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- **BtnsGroup**: 按钮组容器
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
<BtnsGroup>{btnElements}</BtnsGroup>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- **ItemsGroup**: 数据项组容器
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
<ItemsGroup>{itemElements}</ItemsGroup>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- **Illus**: 插图组件(会被替换为图片或 SVG)
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
<Illus x={0} y={0} width={200} height={150} />
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- **Title**: 默认标题组件
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
<Title title="标题" desc="描述" alignHorizontal="center" />
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
- **ItemLabel**: 数据项标签
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
<ItemLabel text="标签" x={0} y={0} />
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- **ItemDesc**: 数据项描述
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
<ItemDesc text="描述" x={0} y={0} />
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- **ItemIcon**: 数据项图标
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
<ItemIcon x={0} y={0} width={40} height={40} />
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
- **ItemValue**: 数据项数值
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
<ItemValue value={100} x={0} y={0} />
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
- **ItemIconCircle**: 圆形图标组件
|
|
237
|
+
```typescript
|
|
238
|
+
<ItemIconCircle indexes={[0]} x={0} y={0} size={50} fill="#000000" />
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### 装饰组件 (从 ../decorations 导入)
|
|
242
|
+
|
|
243
|
+
- **SimpleArrow**: 简单箭头装饰
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
<SimpleArrow
|
|
247
|
+
x={0}
|
|
248
|
+
y={0}
|
|
249
|
+
width={25}
|
|
250
|
+
height={25}
|
|
251
|
+
colorPrimary="#000000"
|
|
252
|
+
rotation={0} // 可选,旋转角度:0, 90, 180, 270
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
- **Triangle**: 三角形装饰
|
|
257
|
+
```typescript
|
|
258
|
+
<Triangle
|
|
259
|
+
x={0}
|
|
260
|
+
y={0}
|
|
261
|
+
width={10}
|
|
262
|
+
height={8}
|
|
263
|
+
rotation={0}
|
|
264
|
+
colorPrimary="#000000"
|
|
265
|
+
/>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### 定义组件 (从 ../defs 导入)
|
|
269
|
+
|
|
270
|
+
- **LinearGradient**: 线性渐变定义
|
|
271
|
+
```typescript
|
|
272
|
+
<Defs>
|
|
273
|
+
<LinearGradient
|
|
274
|
+
id="my-gradient"
|
|
275
|
+
startColor="#ff0000"
|
|
276
|
+
stopColor="#0000ff"
|
|
277
|
+
direction="left-right" // 'left-right' | 'right-left' | 'top-bottom' | 'bottom-top'
|
|
278
|
+
/>
|
|
279
|
+
</Defs>
|
|
280
|
+
<Rect fill="url(#my-gradient)" />
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**原生 SVG 元素在 Defs 中的使用**:
|
|
284
|
+
在 `<Defs>` 标签内可以使用原生 SVG 元素:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
<Defs>
|
|
288
|
+
<linearGradient id="gradient-id" x1="0%" y1="0%" x2="100%" y2="100%" gradientUnits="userSpaceOnUse">
|
|
289
|
+
<stop offset="0%" stopColor="#ff0000" />
|
|
290
|
+
<stop offset="100%" stopColor="#0000ff" />
|
|
291
|
+
</linearGradient>
|
|
292
|
+
</Defs>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### 布局组件 (从 ../layouts 导入)
|
|
296
|
+
|
|
297
|
+
- **FlexLayout**: 弹性盒子布局
|
|
298
|
+
```typescript
|
|
299
|
+
<FlexLayout
|
|
300
|
+
flexDirection="row" // 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
301
|
+
justifyContent="center" // 'flex-start' | 'flex-end' | 'center' | 'space-between'
|
|
302
|
+
alignItems="center" // 'flex-start' | 'flex-end' | 'center'
|
|
303
|
+
alignContent="center" // 'flex-start' | 'flex-end' | 'center' | 'space-between'
|
|
304
|
+
flexWrap="wrap" // 'wrap' | 'nowrap'
|
|
305
|
+
gap={20}
|
|
306
|
+
>
|
|
307
|
+
{children}
|
|
308
|
+
</FlexLayout>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### 工具函数
|
|
312
|
+
|
|
313
|
+
**布局计算函数** (从 @antv/infographic-jsx 导入):
|
|
314
|
+
|
|
315
|
+
- **getElementBounds**: 获取元素边界信息
|
|
316
|
+
```typescript
|
|
317
|
+
const bounds = getElementBounds(<Rect width={100} height={50} />);
|
|
318
|
+
// 返回: { x: number, y: number, width: number, height: number }
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**主题与颜色函数** (从 ../utils 导入):
|
|
322
|
+
|
|
323
|
+
- **getPaletteColor**: 获取调色板中指定索引的颜色
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
const color = getPaletteColor(options, [index]); // 返回颜色字符串
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
- **getPaletteColors**: 获取完整调色板颜色数组
|
|
330
|
+
|
|
331
|
+
```typescript
|
|
332
|
+
const palette = getPaletteColors(options); // 返回颜色数组
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
- **getColorPrimary**: 获取主题色
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
const colorPrimary = getColorPrimary(options); // 返回主题色字符串
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
- **getThemeColors**: 获取主题配置
|
|
342
|
+
```typescript
|
|
343
|
+
const themeColors = getThemeColors(options.themeConfig);
|
|
344
|
+
// 或自定义配置
|
|
345
|
+
const themeColors = getThemeColors(
|
|
346
|
+
{
|
|
347
|
+
colorPrimary: '#1890ff',
|
|
348
|
+
colorBg: '#ffffff',
|
|
349
|
+
},
|
|
350
|
+
options,
|
|
351
|
+
);
|
|
352
|
+
// 返回包含 colorText, colorPrimaryBg 等的主题对象
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**数据处理函数** (从 ../../utils 导入):
|
|
356
|
+
|
|
357
|
+
- **getDatumByIndexes**: 根据索引获取数据项
|
|
358
|
+
```typescript
|
|
359
|
+
const datum = getDatumByIndexes(items, [0, 1]); // 获取嵌套数据
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**组件选择函数** (从 ../utils 导入):
|
|
363
|
+
|
|
364
|
+
- **getItemComponent**: 获取指定层级的 Item 组件(用于 Items 数组)
|
|
365
|
+
```typescript
|
|
366
|
+
const ItemComponent = getItemComponent(Items, level);
|
|
367
|
+
// Items 为组件数组,level 为层级索引
|
|
368
|
+
// 如果 level 超出数组长度,返回最后一个组件
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### 3. 按需导入
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
/** @jsxImportSource @antv/infographic-jsx */
|
|
375
|
+
import type { ComponentType, JSXElement } from '@antv/infographic-jsx';
|
|
376
|
+
import {
|
|
377
|
+
getElementBounds,
|
|
378
|
+
Defs,
|
|
379
|
+
Ellipse,
|
|
380
|
+
Group,
|
|
381
|
+
Path,
|
|
382
|
+
Polygon,
|
|
383
|
+
Rect,
|
|
384
|
+
Text,
|
|
385
|
+
} from '@antv/infographic-jsx';
|
|
386
|
+
import {
|
|
387
|
+
BtnAdd,
|
|
388
|
+
BtnRemove,
|
|
389
|
+
BtnsGroup,
|
|
390
|
+
Illus,
|
|
391
|
+
ItemDesc,
|
|
392
|
+
ItemIcon,
|
|
393
|
+
ItemIconCircle,
|
|
394
|
+
ItemLabel,
|
|
395
|
+
ItemsGroup,
|
|
396
|
+
ItemValue,
|
|
397
|
+
Title,
|
|
398
|
+
} from '../components';
|
|
399
|
+
import { LinearGradient } from '../defs';
|
|
400
|
+
import { SimpleArrow, Triangle } from '../decorations';
|
|
401
|
+
import { FlexLayout } from '../layouts';
|
|
402
|
+
import {
|
|
403
|
+
getColorPrimary,
|
|
404
|
+
getPaletteColor,
|
|
405
|
+
getPaletteColors,
|
|
406
|
+
getThemeColors,
|
|
407
|
+
getItemComponent,
|
|
408
|
+
} from '../utils';
|
|
409
|
+
import { getDatumByIndexes } from '../../utils';
|
|
410
|
+
import { registerStructure } from './registry';
|
|
411
|
+
import type { BaseStructureProps } from './types';
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**注意事项**:
|
|
415
|
+
|
|
416
|
+
- 只导入实际使用的组件和函数
|
|
417
|
+
- 对于层级结构,记得导入 `BaseItemProps` 类型(如果需要)
|
|
418
|
+
- 装饰组件和定义组件按需导入
|
|
419
|
+
|
|
420
|
+
支持的第三方库:
|
|
421
|
+
|
|
422
|
+
- **d3**: 用于力导向布局、层次布局等复杂布局计算
|
|
423
|
+
- **lodash-es**: 通用工具函数
|
|
424
|
+
- **tinycolor2**: 颜色处理
|
|
425
|
+
|
|
426
|
+
> 可以按实际需求引入其他库
|
|
427
|
+
|
|
428
|
+
### 4. 组件结构模板
|
|
429
|
+
|
|
430
|
+
**简单结构模板** (使用 Item):
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
export interface [StructureName]Props extends BaseStructureProps {
|
|
434
|
+
gap?: number;
|
|
435
|
+
// 其他自定义参数
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export const [StructureName]: ComponentType<[StructureName]Props> = (props) => {
|
|
439
|
+
const { Title, Item, data, gap = 20, options } = props;
|
|
440
|
+
const { title, desc, items = [] } = data;
|
|
441
|
+
|
|
442
|
+
// 1. 处理标题
|
|
443
|
+
const titleContent = Title ? <Title title={title} desc={desc} /> : null;
|
|
444
|
+
|
|
445
|
+
// 2. 获取元素尺寸
|
|
446
|
+
const btnBounds = getElementBounds(<BtnAdd indexes={[0]} />);
|
|
447
|
+
const itemBounds = getElementBounds(
|
|
448
|
+
<Item indexes={[0]} data={data} datum={items[0]} />
|
|
449
|
+
);
|
|
450
|
+
|
|
451
|
+
// 3. 准备元素数组
|
|
452
|
+
const btnElements: JSXElement[] = [];
|
|
453
|
+
const itemElements: JSXElement[] = [];
|
|
454
|
+
const decorElements: JSXElement[] = []; // 装饰元素(如箭头、连线等)
|
|
455
|
+
|
|
456
|
+
// 4. 遍历数据项生成元素
|
|
457
|
+
items.forEach((item, index) => {
|
|
458
|
+
const indexes = [index];
|
|
459
|
+
|
|
460
|
+
// 计算位置并添加 Item
|
|
461
|
+
itemElements.push(
|
|
462
|
+
<Item
|
|
463
|
+
indexes={indexes}
|
|
464
|
+
datum={item}
|
|
465
|
+
data={data}
|
|
466
|
+
x={/* 计算 x */}
|
|
467
|
+
y={/* 计算 y */}
|
|
468
|
+
/>
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
// 添加删除按钮
|
|
472
|
+
btnElements.push(
|
|
473
|
+
<BtnRemove
|
|
474
|
+
indexes={indexes}
|
|
475
|
+
x={/* 计算 x */}
|
|
476
|
+
y={/* 计算 y */}
|
|
477
|
+
/>
|
|
478
|
+
);
|
|
479
|
+
|
|
480
|
+
// 添加插入按钮
|
|
481
|
+
btnElements.push(
|
|
482
|
+
<BtnAdd
|
|
483
|
+
indexes={indexes}
|
|
484
|
+
x={/* 计算 x */}
|
|
485
|
+
y={/* 计算 y */}
|
|
486
|
+
/>
|
|
487
|
+
);
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// 5. 添加末尾的添加按钮
|
|
491
|
+
if (items.length > 0) {
|
|
492
|
+
btnElements.push(
|
|
493
|
+
<BtnAdd
|
|
494
|
+
indexes={[items.length]}
|
|
495
|
+
x={/* 计算 x */}
|
|
496
|
+
y={/* 计算 y */}
|
|
497
|
+
/>
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// 6. 返回布局
|
|
502
|
+
return (
|
|
503
|
+
<FlexLayout
|
|
504
|
+
id="infographic-container"
|
|
505
|
+
flexDirection="column"
|
|
506
|
+
justifyContent="center"
|
|
507
|
+
alignItems="center"
|
|
508
|
+
>
|
|
509
|
+
{titleContent}
|
|
510
|
+
<Group>
|
|
511
|
+
<Group>{decorElements}</Group>
|
|
512
|
+
<ItemsGroup>{itemElements}</ItemsGroup>
|
|
513
|
+
<BtnsGroup>{btnElements}</BtnsGroup>
|
|
514
|
+
</Group>
|
|
515
|
+
</FlexLayout>
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
registerStructure('[structure-name]', {
|
|
520
|
+
component: [StructureName],
|
|
521
|
+
composites: ['title', 'item'], // 根据实际使用的组件填写
|
|
522
|
+
});
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
**层级结构模板** (使用 Items 数组):
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
export interface [StructureName]Props extends BaseStructureProps {
|
|
529
|
+
gap?: number;
|
|
530
|
+
// 其他自定义参数
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export const [StructureName]: ComponentType<[StructureName]Props> = (props) => {
|
|
534
|
+
const { Title, Items, data, gap = 20, options } = props;
|
|
535
|
+
const [RootItem, ChildItem] = Items; // 解构获取不同层级的组件
|
|
536
|
+
const { title, desc, items = [] } = data;
|
|
537
|
+
|
|
538
|
+
const titleContent = Title ? <Title title={title} desc={desc} /> : null;
|
|
539
|
+
|
|
540
|
+
const btnElements: JSXElement[] = [];
|
|
541
|
+
const itemElements: JSXElement[] = [];
|
|
542
|
+
|
|
543
|
+
// 获取根节点和子节点的尺寸
|
|
544
|
+
const rootItemBounds = getElementBounds(
|
|
545
|
+
<RootItem indexes={[0]} data={data} datum={items[0]} />
|
|
546
|
+
);
|
|
547
|
+
const childItemBounds = getElementBounds(
|
|
548
|
+
<ChildItem indexes={[0, 0]} data={data} datum={items[0]?.children?.[0] || {}} />
|
|
549
|
+
);
|
|
550
|
+
|
|
551
|
+
// 遍历根节点
|
|
552
|
+
items.forEach((rootItem, rootIndex) => {
|
|
553
|
+
const { children = [] } = rootItem;
|
|
554
|
+
|
|
555
|
+
// 渲染根节点
|
|
556
|
+
itemElements.push(
|
|
557
|
+
<RootItem
|
|
558
|
+
indexes={[rootIndex]}
|
|
559
|
+
datum={rootItem}
|
|
560
|
+
data={data}
|
|
561
|
+
x={/* 计算 x */}
|
|
562
|
+
y={/* 计算 y */}
|
|
563
|
+
/>
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
// 遍历子节点
|
|
567
|
+
children.forEach((child, childIndex) => {
|
|
568
|
+
itemElements.push(
|
|
569
|
+
<ChildItem
|
|
570
|
+
indexes={[rootIndex, childIndex]}
|
|
571
|
+
datum={child}
|
|
572
|
+
data={data}
|
|
573
|
+
x={/* 计算 x */}
|
|
574
|
+
y={/* 计算 y */}
|
|
575
|
+
/>
|
|
576
|
+
);
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
return (
|
|
581
|
+
<FlexLayout
|
|
582
|
+
id="infographic-container"
|
|
583
|
+
flexDirection="column"
|
|
584
|
+
justifyContent="center"
|
|
585
|
+
alignItems="center"
|
|
586
|
+
>
|
|
587
|
+
{titleContent}
|
|
588
|
+
<Group>
|
|
589
|
+
<ItemsGroup>{itemElements}</ItemsGroup>
|
|
590
|
+
<BtnsGroup>{btnElements}</BtnsGroup>
|
|
591
|
+
</Group>
|
|
592
|
+
</FlexLayout>
|
|
593
|
+
);
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
registerStructure('[structure-name]', {
|
|
597
|
+
component: [StructureName],
|
|
598
|
+
composites: ['title', 'item'], // 根据实际使用的组件填写
|
|
599
|
+
});
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### 5. 组件声明 (composites)
|
|
603
|
+
|
|
604
|
+
**composites 字段说明**:
|
|
605
|
+
|
|
606
|
+
在调用 `registerStructure` 时,必须提供 `composites` 数组,用于声明该结构使用了哪些核心组件。这有助于系统了解结构的组成和依赖关系。
|
|
607
|
+
|
|
608
|
+
**composites 的取值规则**:
|
|
609
|
+
|
|
610
|
+
composites 数组中的值应该是小写字符串,包括以下几种:
|
|
611
|
+
|
|
612
|
+
1. **'title'** - 当满足以下任一条件时包含:
|
|
613
|
+
- 使用了 `Title` prop 组件(来自 `props.Title`)
|
|
614
|
+
- 直接访问并渲染了 `data.title`(例如使用 `<Text>{title}</Text>` 或 `<Text>{data.title}</Text>`)
|
|
615
|
+
- 在代码中以任何方式将 title 数据渲染为 UI 元素
|
|
616
|
+
|
|
617
|
+
2. **'item'** - 当满足以下任一条件时包含:
|
|
618
|
+
- 使用了 `Item` prop 组件(来自 `props.Item`)
|
|
619
|
+
- 使用了 `Items` prop 组件数组(来自 `props.Items`)
|
|
620
|
+
- 注意:即使使用的是 `Items`(复数),在 composites 中也应该填写 `'item'`(单数)
|
|
621
|
+
|
|
622
|
+
3. **'illus'** - 当满足以下任一条件时包含:
|
|
623
|
+
- 使用了 `Illus` 组件(从 `../components` 导入)
|
|
624
|
+
- 直接访问并渲染了 `data.illus`(例如通过图片或 SVG 元素)
|
|
625
|
+
- 访问了 `data.illus.xxx` 并渲染为 UI
|
|
626
|
+
|
|
627
|
+
**示例**:
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
// 示例 1: 使用了 Title 和 Item props
|
|
631
|
+
registerStructure('list-row', {
|
|
632
|
+
component: ListRow,
|
|
633
|
+
composites: ['title', 'item'],
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
// 示例 2: 直接在代码中渲染 title,使用 Item prop
|
|
637
|
+
registerStructure('list-sector', {
|
|
638
|
+
component: ListSector,
|
|
639
|
+
composites: ['title', 'item'], // 虽然没有使用 Title prop,但渲染了 data.title
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
// 示例 3: 使用了 Items 数组(层级结构)
|
|
643
|
+
registerStructure('hierarchy-tree', {
|
|
644
|
+
component: HierarchyTree,
|
|
645
|
+
composites: ['title', 'item'], // 注意是 'item' 不是 'items'
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
// 示例 4: 使用了 Title, Item 和 Illus
|
|
649
|
+
registerStructure('some-structure', {
|
|
650
|
+
component: SomeStructure,
|
|
651
|
+
composites: ['title', 'item', 'illus'],
|
|
652
|
+
});
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
**重要提示**:
|
|
656
|
+
|
|
657
|
+
- composites 数组中的值必须是小写
|
|
658
|
+
- 即使使用 `Items`(复数),也要填写 `'item'`(单数)
|
|
659
|
+
- 如果结构直接渲染了某个数据字段(如 `data.title`),即使没有使用对应的 prop 组件,也应该在 composites 中声明
|
|
660
|
+
- composites 数组不能为空,至少要包含 `['item']`
|
|
661
|
+
|
|
662
|
+
### 6. 关键约束
|
|
663
|
+
|
|
664
|
+
**严格遵守以下规则:**
|
|
665
|
+
|
|
666
|
+
1. **仅使用上述列出的组件**,不得导入或使用未列出的组件(如 Circle, Line 等)
|
|
667
|
+
2. **所有图形组件必须使用 x/y/width/height 定位**,不使用 cx/cy/r/rx/ry 等 SVG 原生属性
|
|
668
|
+
3. **Polygon 的 points 必须是对象数组** `{x: number, y: number}[]`,不是字符串
|
|
669
|
+
4. **Text 组件的文本内容作为 children 传入**,不使用 text 属性
|
|
670
|
+
5. **所有按钮组件必须传入 indexes 数组**
|
|
671
|
+
6. **坐标计算必须基于 getElementBounds 的返回值**
|
|
672
|
+
7. **基于 Item 的位置和尺寸来确定整体布局,不要出现坐标值为负的情况**
|
|
673
|
+
8. **装饰元素(连线、箭头等)应放在独立的 Group 中,并置于 ItemsGroup 之前**,确保装饰层在数据项层之下
|
|
674
|
+
9. **使用 Items 数组时,通过解构获取不同层级的组件**,如 `const [RootItem, ChildItem] = Items`
|
|
675
|
+
10. **某些特殊结构可以不使用按钮**(如关系网络、四象限等),根据实际需求决定
|
|
676
|
+
11. **使用主题和调色板**:
|
|
677
|
+
- 优先使用 `getPaletteColor(options, indexes)` 获取数据项颜色
|
|
678
|
+
- 使用 `getColorPrimary(options)` 获取主题色用于装饰元素
|
|
679
|
+
- 使用 `getThemeColors` 获取完整主题配置
|
|
680
|
+
12. **Group 支持 transform 属性**用于变换,但要谨慎使用
|
|
681
|
+
13. **在 Defs 内可以使用原生 SVG 元素**(如 `<linearGradient>`, `<stop>`)创建渐变等效果
|
|
682
|
+
14. **对于复杂布局计算**,可以使用 d3 的布局算法(如 `d3.hierarchy`, `d3.tree`, `d3.forceSimulation`)
|
|
683
|
+
15. **空数据处理**:当 `items.length === 0` 时,应该提供友好的空状态(如单个添加按钮)
|
|
684
|
+
|
|
685
|
+
### 6. 按钮布局原则
|
|
686
|
+
|
|
687
|
+
**BtnAdd (添加按钮)**:
|
|
688
|
+
|
|
689
|
+
- 放置在两个数据项之间,表示可在此插入新项
|
|
690
|
+
- 第一个 BtnAdd 在首个数据项之前
|
|
691
|
+
- 最后一个 BtnAdd 在末尾数据项之后
|
|
692
|
+
- indexes 值为插入位置的索引(如在第0项前插入,indexes=[0])
|
|
693
|
+
|
|
694
|
+
**BtnRemove (删除按钮)**:
|
|
695
|
+
|
|
696
|
+
- 放置在每个数据项附近,表示可删除该项
|
|
697
|
+
- indexes 值为对应数据项的索引
|
|
698
|
+
|
|
699
|
+
**位置计算示例**:
|
|
700
|
+
|
|
701
|
+
- **横向布局**: BtnAdd 在数据项下方水平居中,BtnRemove 在数据项正下方
|
|
702
|
+
- **纵向布局**: BtnAdd 在数据项上方或下方水平居中,BtnRemove 在数据项左侧或右侧
|
|
703
|
+
- **其他布局**: 根据视觉平衡和交互便利性灵活调整
|
|
704
|
+
|
|
705
|
+
### 7. 布局计算要点
|
|
706
|
+
|
|
707
|
+
- **元素尺寸获取**: 使用 `getElementBounds()` 获取元素尺寸用于计算
|
|
708
|
+
- **坐标系统**: x 向右为正,y 向下为正
|
|
709
|
+
- **Item 对齐方式**: `positionH` 和 `positionV` 用于控制元素内部内容的对齐方式
|
|
710
|
+
- `positionH`: 'normal'(默认设计) | 'center'(水平居中) | 'flipped'(翻转布局)
|
|
711
|
+
- `positionV`: 'normal'(默认设计) | 'center'(垂直居中) | 'flipped'(翻转布局)
|
|
712
|
+
- 示例:圆形分布时,右侧 Item 使用 'normal',左侧使用 'flipped'
|
|
713
|
+
- **Item 尺寸约束**: 某些结构需要限制 Item 的尺寸,通过 `width` 和 `height` 属性传递
|
|
714
|
+
- **布局方式**:
|
|
715
|
+
- 简单布局使用 `FlexLayout` 可自动居中和排列
|
|
716
|
+
- 复杂布局手动计算每个元素的精确坐标
|
|
717
|
+
- **装饰元素层级**: 装饰元素(连线、箭头)应在独立 Group 中,置于 ItemsGroup 之前
|
|
718
|
+
- **优先使用 d3 进行复杂布局**:
|
|
719
|
+
- 树形布局: `d3.tree()` 或 `d3.cluster()`
|
|
720
|
+
- 力导向布局: `d3.forceSimulation()`
|
|
721
|
+
- 层次数据: `d3.hierarchy()`
|
|
722
|
+
|
|
723
|
+
### 8. 命名规范
|
|
724
|
+
|
|
725
|
+
> 支持的类型:List, Compare, Sequence, hierarchy, relation, geo, chart
|
|
726
|
+
|
|
727
|
+
- **组件名**: 大驼峰,如 `ListRow`, `CompareLeftRight`
|
|
728
|
+
- **注册名**: 小写-连字符,与分类前缀一致,如 `list-row`, `list-column`
|
|
729
|
+
- **Props 接口**: 组件名 + `Props`,如 `ListRowProps`
|
|
730
|
+
- **变量命名**: 使用有意义的名称,如 `itemElements`, `btnElements`, `decorElements`
|
|
731
|
+
|
|
732
|
+
### 9. 参数设计指导
|
|
733
|
+
|
|
734
|
+
**常用参数及其默认值**:
|
|
735
|
+
|
|
736
|
+
- `gap`: 数据项间距,默认 20-40(适用于列表、顺序结构)
|
|
737
|
+
- `rowGap` / `columnGap`: 行/列间距
|
|
738
|
+
- `spacing`: 整体间距,默认 20-30
|
|
739
|
+
- `radius`: 圆形布局半径,默认 150-250
|
|
740
|
+
- `outerRadius` / `innerRadius`: 外/内半径(环形布局)
|
|
741
|
+
- `angle` / `startAngle` / `endAngle`: 角度相关参数
|
|
742
|
+
- `columns` / `rows`: 网格布局的列/行数,默认 3-4
|
|
743
|
+
- `itemsPerRow`: 每行项数,默认 3
|
|
744
|
+
- `levelGap`: 层级间距,默认 60-80
|
|
745
|
+
- `showAxis` / `showConnections`: 是否显示轴线/连接线,默认 true
|
|
746
|
+
|
|
747
|
+
**参数设计原则**:
|
|
748
|
+
|
|
749
|
+
- 所有参数应有合理的默认值
|
|
750
|
+
- 使用可选参数 `?` 标记
|
|
751
|
+
- 参数名应清晰表达含义
|
|
752
|
+
- 布尔参数使用 `show*` / `enable*` 前缀
|
|
753
|
+
|
|
754
|
+
## 代码生成要求
|
|
755
|
+
|
|
756
|
+
1. **完整性**:
|
|
757
|
+
- 生成完整可运行的代码,包含所有必需的导入、类型定义和注册语句
|
|
758
|
+
- JSX 导入指令必须在文件首行:`/** @jsxImportSource @antv/infographic-jsx */`
|
|
759
|
+
- 只导入实际使用的组件和函数
|
|
760
|
+
- **必须在 registerStructure 调用中包含 composites 数组**,正确声明使用的组件
|
|
761
|
+
|
|
762
|
+
2. **正确性**:
|
|
763
|
+
- 确保 indexes 数组正确传递给所有需要的组件
|
|
764
|
+
- 坐标计算准确,避免元素重叠或错位
|
|
765
|
+
- 边界情况处理(如 items 为空数组时提供友好的空状态)
|
|
766
|
+
- 使用 `getElementBounds` 获取准确的元素尺寸
|
|
767
|
+
- Text 组件的文本通过 children 传递,不是 text 属性
|
|
768
|
+
- **composites 数组必须准确反映实际使用的组件**(参见"组件声明 (composites)"部分)
|
|
769
|
+
|
|
770
|
+
3. **简洁性**:
|
|
771
|
+
- 使用有意义但简洁的变量名
|
|
772
|
+
- 避免冗余计算,合理复用计算结果
|
|
773
|
+
- 提取常量和配置项
|
|
774
|
+
|
|
775
|
+
4. **一致性**:
|
|
776
|
+
- 遵循示例代码的风格和模式
|
|
777
|
+
- 按钮布局逻辑与结构类型匹配
|
|
778
|
+
- 主题颜色使用工具函数获取
|
|
779
|
+
|
|
780
|
+
5. **扩展性**:
|
|
781
|
+
- 预留自定义参数的空间,所有参数都有合理默认值
|
|
782
|
+
- 支持嵌套结构(当需要时,通过 datum.children 访问子项)
|
|
783
|
+
- Props 接口继承 `BaseStructureProps`
|
|
784
|
+
|
|
785
|
+
6. **性能优化**:
|
|
786
|
+
- 使用 `forEach` 遍历数据项,不使用 `map`
|
|
787
|
+
- 将元素收集到数组中,统一渲染
|
|
788
|
+
|
|
789
|
+
7. **其他要求**:
|
|
790
|
+
- 不需要代码注释(除非逻辑特别复杂)
|
|
791
|
+
- 不使用 React 特性(如 key, useEffect 等)
|
|
792
|
+
- 数组元素可以直接作为 children 传递,无需 key
|
|
793
|
+
|
|
794
|
+
## 生成流程
|
|
795
|
+
|
|
796
|
+
当用户请求生成结构时,请按以下步骤进行:
|
|
797
|
+
|
|
798
|
+
1. **理解需求**:
|
|
799
|
+
- 明确用户想要的布局类型、特点和用途
|
|
800
|
+
- 了解数据组织方式(平铺、嵌套、层级等)
|
|
801
|
+
- 确认是否需要按钮交互
|
|
802
|
+
|
|
803
|
+
2. **确定分类**:
|
|
804
|
+
- 根据信息组织特点,归入合适的结构分类
|
|
805
|
+
- 选择合适的命名(遵循命名规范)
|
|
806
|
+
|
|
807
|
+
3. **设计布局**:
|
|
808
|
+
- 确定使用 Item 还是 Items
|
|
809
|
+
- 确定数据项的排列方式和对齐方式
|
|
810
|
+
- 计算各元素的位置关系
|
|
811
|
+
- 设计装饰元素(连线、箭头等)
|
|
812
|
+
- 设计按钮的合理位置(如果需要)
|
|
813
|
+
|
|
814
|
+
4. **编写代码**:
|
|
815
|
+
- 添加 JSX 导入指令
|
|
816
|
+
- 导入所需的组件和函数
|
|
817
|
+
- 定义 Props 接口
|
|
818
|
+
- 实现组件逻辑
|
|
819
|
+
- **注册结构(包含 composites 数组)**
|
|
820
|
+
|
|
821
|
+
5. **验证输出**:
|
|
822
|
+
- 检查代码完整性和正确性
|
|
823
|
+
- 确认所有导入都正确
|
|
824
|
+
- 确认 indexes 正确传递
|
|
825
|
+
- 确认坐标计算无误
|
|
826
|
+
- **确认 composites 数组准确反映使用的组件**
|
|
827
|
+
|
|
828
|
+
## 参考示例
|
|
829
|
+
|
|
830
|
+
### 示例1: 简单横向列表
|
|
831
|
+
|
|
832
|
+
**需求**: 数据项水平排列,等间距
|
|
833
|
+
|
|
834
|
+
**实现要点**:
|
|
835
|
+
|
|
836
|
+
- 使用单个 Item 组件
|
|
837
|
+
- 每项的 x 坐标 = index × (itemWidth + gap)
|
|
838
|
+
- 使用 `positionH="center"` 使内容居中
|
|
839
|
+
- BtnAdd 在相邻项之间,BtnRemove 在每项下方
|
|
840
|
+
|
|
841
|
+
**关键代码片段**:
|
|
842
|
+
|
|
843
|
+
```typescript
|
|
844
|
+
items.forEach((item, index) => {
|
|
845
|
+
const itemX = index * (itemBounds.width + gap);
|
|
846
|
+
itemElements.push(
|
|
847
|
+
<Item indexes={[index]} datum={item} data={data} x={itemX} positionH="center" />
|
|
848
|
+
);
|
|
849
|
+
});
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
### 示例2: 层级对比结构
|
|
853
|
+
|
|
854
|
+
**需求**: 左右两列,每列有根节点和多个子节点
|
|
855
|
+
|
|
856
|
+
**实现要点**:
|
|
857
|
+
|
|
858
|
+
- 使用 Items 数组:`[RootItem, ChildItem]`
|
|
859
|
+
- 根节点固定位置,子节点在其下方排列
|
|
860
|
+
- 子节点使用不同的 positionH(左列 'normal',右列 'flipped')
|
|
861
|
+
|
|
862
|
+
**关键代码片段**:
|
|
863
|
+
|
|
864
|
+
```typescript
|
|
865
|
+
const [RootItem, ChildItem] = Items;
|
|
866
|
+
items.forEach((rootItem, rootIndex) => {
|
|
867
|
+
const { children = [] } = rootItem;
|
|
868
|
+
itemElements.push(<RootItem indexes={[rootIndex]} datum={rootItem} data={data} />);
|
|
869
|
+
|
|
870
|
+
children.forEach((child, childIndex) => {
|
|
871
|
+
itemElements.push(
|
|
872
|
+
<ChildItem indexes={[rootIndex, childIndex]} datum={child} data={data} />
|
|
873
|
+
);
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
### 示例3: 带装饰的顺序结构
|
|
879
|
+
|
|
880
|
+
**需求**: 横向流程,数据项之间有箭头连接
|
|
881
|
+
|
|
882
|
+
**实现要点**:
|
|
883
|
+
|
|
884
|
+
- 使用装饰元素(SimpleArrow)连接相邻项
|
|
885
|
+
- 装饰元素置于独立 Group,在 ItemsGroup 之前
|
|
886
|
+
- 使用主题色绘制箭头
|
|
887
|
+
|
|
888
|
+
**关键代码片段**:
|
|
889
|
+
|
|
890
|
+
```typescript
|
|
891
|
+
const colorPrimary = getColorPrimary(options);
|
|
892
|
+
items.forEach((item, index) => {
|
|
893
|
+
if (index < items.length - 1) {
|
|
894
|
+
decorElements.push(
|
|
895
|
+
<SimpleArrow
|
|
896
|
+
x={itemX + itemBounds.width + (gap - arrowWidth) / 2}
|
|
897
|
+
y={itemY + itemBounds.height / 2 - arrowHeight / 2}
|
|
898
|
+
width={arrowWidth}
|
|
899
|
+
height={arrowHeight}
|
|
900
|
+
colorPrimary={colorPrimary}
|
|
901
|
+
/>
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
return (
|
|
907
|
+
<Group>
|
|
908
|
+
<Group>{decorElements}</Group>
|
|
909
|
+
<ItemsGroup>{itemElements}</ItemsGroup>
|
|
910
|
+
<BtnsGroup>{btnElements}</BtnsGroup>
|
|
911
|
+
</Group>
|
|
912
|
+
);
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
### 示例4: 使用调色板的圆形布局
|
|
916
|
+
|
|
917
|
+
**需求**: 数据项环形分布,每项使用不同颜色
|
|
918
|
+
|
|
919
|
+
**实现要点**:
|
|
920
|
+
|
|
921
|
+
- 使用三角函数计算圆周位置
|
|
922
|
+
- 使用 `getPaletteColor` 获取每项的颜色
|
|
923
|
+
- 将颜色通过 themeColors 传递给 Item
|
|
924
|
+
|
|
925
|
+
**关键代码片段**:
|
|
926
|
+
|
|
927
|
+
```typescript
|
|
928
|
+
items.forEach((item, index) => {
|
|
929
|
+
const angle = (index * 2 * Math.PI) / items.length - Math.PI / 2;
|
|
930
|
+
const itemX = centerX + radius * Math.cos(angle) - itemBounds.width / 2;
|
|
931
|
+
const itemY = centerY + radius * Math.sin(angle) - itemBounds.height / 2;
|
|
932
|
+
const color = getPaletteColor(options, [index]);
|
|
933
|
+
|
|
934
|
+
itemElements.push(
|
|
935
|
+
<Item
|
|
936
|
+
indexes={[index]}
|
|
937
|
+
datum={item}
|
|
938
|
+
data={data}
|
|
939
|
+
x={itemX}
|
|
940
|
+
y={itemY}
|
|
941
|
+
themeColors={getThemeColors({ colorPrimary: color }, options)}
|
|
942
|
+
/>
|
|
943
|
+
);
|
|
944
|
+
});
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
你可以基于这些模式创造性地设计新的布局结构。
|
|
948
|
+
|
|
949
|
+
## 输出格式
|
|
950
|
+
|
|
951
|
+
生成的代码应该是完整的 TypeScript 文件,包含:
|
|
952
|
+
|
|
953
|
+
1. **JSX 导入指令**: `/** @jsxImportSource @antv/infographic-jsx */`
|
|
954
|
+
2. **类型导入**: 导入 `ComponentType`, `JSXElement` 等必要类型
|
|
955
|
+
3. **组件导入**: 按需导入使用的原子组件、封装组件、装饰组件等
|
|
956
|
+
4. **工具函数导入**: 导入使用的布局、主题、数据处理等工具函数
|
|
957
|
+
5. **Props 接口**: 继承 `BaseStructureProps`,定义自定义参数
|
|
958
|
+
6. **组件实现**: 完整的组件逻辑
|
|
959
|
+
7. **结构注册**: 使用 `registerStructure` 注册组件
|
|
960
|
+
|
|
961
|
+
**代码风格要求**:
|
|
962
|
+
|
|
963
|
+
- 使用 2 空格缩进
|
|
964
|
+
- 导入语句按类型分组
|
|
965
|
+
- 变量声明使用 `const`
|
|
966
|
+
- 箭头函数使用简洁语法
|
|
967
|
+
- 适当的空行分隔逻辑块
|
|
968
|
+
|
|
969
|
+
**示例输出**:
|
|
970
|
+
|
|
971
|
+
```typescript
|
|
972
|
+
/** @jsxImportSource @antv/infographic-jsx */
|
|
973
|
+
import type { ComponentType, JSXElement } from '@antv/infographic-jsx';
|
|
974
|
+
import { getElementBounds, Group } from '@antv/infographic-jsx';
|
|
975
|
+
import { BtnAdd, BtnRemove, BtnsGroup, ItemsGroup } from '../components';
|
|
976
|
+
import { FlexLayout } from '../layouts';
|
|
977
|
+
import { registerStructure } from './registry';
|
|
978
|
+
import type { BaseStructureProps } from './types';
|
|
979
|
+
|
|
980
|
+
export interface ExampleProps extends BaseStructureProps {
|
|
981
|
+
gap?: number;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
export const Example: ComponentType<ExampleProps> = (props) => {
|
|
985
|
+
// 组件实现
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
registerStructure('example', {
|
|
989
|
+
component: Example,
|
|
990
|
+
composites: ['title', 'item'], // 根据实际使用的组件填写
|
|
991
|
+
});
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
---
|
|
995
|
+
|
|
996
|
+
现在,请告诉我你想要生成什么类型的结构组件?
|