@antv/infographic 0.1.3 → 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/dist/infographic.min.js +110 -105
- package/dist/infographic.min.js.map +1 -1
- package/esm/constants/element.d.ts +1 -1
- package/esm/constants/index.d.ts +1 -0
- package/esm/constants/index.js +1 -0
- package/esm/constants/service.d.ts +1 -0
- package/esm/constants/service.js +1 -0
- package/esm/designs/components/Illus.js +1 -1
- package/esm/designs/structures/chart-wordcloud.d.ts +11 -0
- package/esm/designs/structures/chart-wordcloud.js +156 -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 +2 -0
- package/esm/designs/structures/index.js +2 -0
- package/esm/designs/structures/sequence-stairs-front.d.ts +8 -0
- package/esm/designs/structures/sequence-stairs-front.js +116 -0
- package/esm/designs/types.d.ts +8 -0
- package/esm/editor/managers/state.js +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/options/parser.d.ts +1 -1
- package/esm/options/parser.js +33 -15
- package/esm/renderer/composites/icon.js +1 -1
- package/esm/renderer/composites/illus.js +1 -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/utils/data-uri.js +20 -11
- package/esm/resource/utils/parser.js +92 -1
- package/esm/resource/utils/ref.js +2 -2
- package/esm/runtime/Infographic.d.ts +7 -6
- package/esm/runtime/Infographic.js +48 -17
- package/esm/runtime/utils.d.ts +4 -2
- package/esm/runtime/utils.js +33 -13
- 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 +4 -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/utils/design.d.ts +2 -0
- package/esm/utils/design.js +10 -0
- package/esm/utils/font.js +11 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/lib/constants/element.d.ts +1 -1
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +1 -0
- package/lib/constants/service.d.ts +1 -0
- package/lib/constants/service.js +4 -0
- package/lib/designs/components/Illus.js +1 -1
- package/lib/designs/structures/chart-wordcloud.d.ts +11 -0
- package/lib/designs/structures/chart-wordcloud.js +160 -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 +2 -0
- package/lib/designs/structures/index.js +2 -0
- package/lib/designs/structures/sequence-stairs-front.d.ts +8 -0
- package/lib/designs/structures/sequence-stairs-front.js +120 -0
- package/lib/designs/types.d.ts +8 -0
- package/lib/editor/managers/state.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -1
- package/lib/options/parser.d.ts +1 -1
- package/lib/options/parser.js +32 -14
- package/lib/renderer/composites/icon.js +1 -1
- package/lib/renderer/composites/illus.js +1 -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/utils/data-uri.js +20 -11
- package/lib/resource/utils/parser.js +92 -1
- package/lib/resource/utils/ref.js +2 -2
- package/lib/runtime/Infographic.d.ts +7 -6
- package/lib/runtime/Infographic.js +47 -16
- package/lib/runtime/utils.d.ts +4 -2
- package/lib/runtime/utils.js +35 -13
- 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 +4 -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/utils/design.d.ts +2 -0
- package/lib/utils/design.js +13 -0
- package/lib/utils/font.js +11 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/package.json +1 -1
- package/src/constants/element.ts +1 -1
- package/src/constants/index.ts +1 -0
- package/src/constants/service.ts +1 -0
- package/src/designs/components/Illus.tsx +1 -1
- package/src/designs/structures/chart-wordcloud.tsx +278 -0
- package/src/designs/structures/hierarchy-tree.tsx +212 -59
- package/src/designs/structures/index.ts +2 -0
- package/src/designs/structures/sequence-stairs-front.tsx +291 -0
- package/src/designs/types.ts +9 -0
- package/src/editor/managers/state.ts +1 -1
- package/src/index.ts +2 -0
- package/src/options/parser.ts +57 -28
- package/src/renderer/composites/icon.ts +1 -1
- package/src/renderer/composites/illus.ts +1 -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/parser.ts +103 -2
- package/src/resource/utils/ref.ts +2 -2
- package/src/runtime/Infographic.tsx +74 -22
- package/src/runtime/utils.ts +38 -16
- 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 +4 -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/utils/design.ts +14 -0
- package/src/utils/font.ts +11 -1
- package/src/utils/index.ts +1 -0
- 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/resource/types/{font.js → scene.js} +0 -0
- /package/lib/resource/types/{font.js → scene.js} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { hierarchyMindmapTemplates } from './hierarchy-mindmap';
|
|
2
2
|
import { hierarchyTreeTemplates } from './hierarchy-tree';
|
|
3
3
|
import { registerTemplate } from './registry';
|
|
4
|
+
import { sequenceStairsTemplates } from './sequence-stairs';
|
|
4
5
|
import type { TemplateOptions } from './types';
|
|
6
|
+
import { wordCloudTemplate } from './word-cloud';
|
|
5
7
|
|
|
6
8
|
const BUILT_IN_TEMPLATES: Record<string, TemplateOptions> = {
|
|
7
9
|
'compare-hierarchy-left-right-circle-node-pill-badge': {
|
|
@@ -803,6 +805,8 @@ const BUILT_IN_TEMPLATES: Record<string, TemplateOptions> = {
|
|
|
803
805
|
},
|
|
804
806
|
...hierarchyTreeTemplates,
|
|
805
807
|
...hierarchyMindmapTemplates,
|
|
808
|
+
...sequenceStairsTemplates,
|
|
809
|
+
...wordCloudTemplate,
|
|
806
810
|
};
|
|
807
811
|
|
|
808
812
|
Object.entries(BUILT_IN_TEMPLATES).forEach(([name, options]) => {
|
|
@@ -52,19 +52,42 @@ const items: string[] = [
|
|
|
52
52
|
export const hierarchyTreeTemplates: Record<string, TemplateOptions> = {};
|
|
53
53
|
|
|
54
54
|
const structureName = 'hierarchy-tree';
|
|
55
|
+
const orientationConfigs: Array<{
|
|
56
|
+
key: string;
|
|
57
|
+
orientation?: HierarchyTreeProps['orientation'];
|
|
58
|
+
}> = [
|
|
59
|
+
{ key: '' },
|
|
60
|
+
{ key: 'bt', orientation: 'bottom-top' },
|
|
61
|
+
{ key: 'lr', orientation: 'left-right' },
|
|
62
|
+
{ key: 'rl', orientation: 'right-left' },
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
const createTemplateName = (
|
|
66
|
+
oriKey: string,
|
|
67
|
+
name: string,
|
|
68
|
+
item: string,
|
|
69
|
+
): string => {
|
|
70
|
+
return oriKey
|
|
71
|
+
? `${structureName}-${oriKey}-${name}-${item}`
|
|
72
|
+
: `${structureName}-${name}-${item}`;
|
|
73
|
+
};
|
|
74
|
+
|
|
55
75
|
for (const item of items) {
|
|
56
76
|
for (const [name, structureProps] of Object.entries(structures)) {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
for (const { key, orientation } of orientationConfigs) {
|
|
78
|
+
const templateName = createTemplateName(key, name, item);
|
|
79
|
+
hierarchyTreeTemplates[templateName] = {
|
|
80
|
+
design: {
|
|
81
|
+
structure: {
|
|
82
|
+
type: 'hierarchy-tree',
|
|
83
|
+
...(orientation ? { orientation } : {}),
|
|
84
|
+
...structureProps,
|
|
85
|
+
},
|
|
86
|
+
item: {
|
|
87
|
+
type: item,
|
|
88
|
+
},
|
|
66
89
|
},
|
|
67
|
-
}
|
|
68
|
-
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
69
92
|
}
|
|
70
93
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { TemplateOptions } from './types';
|
|
2
|
+
|
|
3
|
+
export const sequenceStairsTemplates: Record<string, TemplateOptions> = {
|
|
4
|
+
'sequence-stairs-front-pill-badge': {
|
|
5
|
+
design: {
|
|
6
|
+
title: 'default',
|
|
7
|
+
structure: {
|
|
8
|
+
type: 'sequence-stairs-front',
|
|
9
|
+
},
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
type: 'pill-badge',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
'sequence-stairs-front-compact-card': {
|
|
18
|
+
design: {
|
|
19
|
+
title: 'default',
|
|
20
|
+
structure: {
|
|
21
|
+
type: 'sequence-stairs-front',
|
|
22
|
+
},
|
|
23
|
+
items: [
|
|
24
|
+
{
|
|
25
|
+
type: 'compact-card',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
'sequence-stairs-front-simple': {
|
|
31
|
+
design: {
|
|
32
|
+
title: 'default',
|
|
33
|
+
structure: {
|
|
34
|
+
type: 'sequence-stairs-front',
|
|
35
|
+
},
|
|
36
|
+
items: [
|
|
37
|
+
{
|
|
38
|
+
type: 'simple',
|
|
39
|
+
usePaletteColor: true,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TemplateOptions } from './types';
|
|
2
|
+
|
|
3
|
+
export const wordCloudTemplate: Record<string, TemplateOptions> = {
|
|
4
|
+
'chart-wordcloud-rotate': {
|
|
5
|
+
design: {
|
|
6
|
+
structure: {
|
|
7
|
+
type: 'chart-wordcloud',
|
|
8
|
+
},
|
|
9
|
+
item: 'simple',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
'chart-wordcloud': {
|
|
13
|
+
design: {
|
|
14
|
+
structure: {
|
|
15
|
+
type: 'chart-wordcloud',
|
|
16
|
+
enableRotate: false,
|
|
17
|
+
},
|
|
18
|
+
item: 'simple',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
package/src/themes/types.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ThemeConfig {
|
|
|
29
29
|
palette?: Palette;
|
|
30
30
|
title?: TextAttributes;
|
|
31
31
|
desc?: TextAttributes;
|
|
32
|
-
shape?:
|
|
32
|
+
shape?: ShapeAttributes;
|
|
33
33
|
item?: {
|
|
34
34
|
icon?: DynamicAttributes<IconAttributes>;
|
|
35
35
|
label?: DynamicAttributes<TextAttributes>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NullableParsedDesignsOptions,
|
|
3
|
+
ParsedDesignsOptions,
|
|
4
|
+
} from '../designs';
|
|
5
|
+
|
|
6
|
+
export function isNonNullableParsedDesignsOptions(
|
|
7
|
+
options: NullableParsedDesignsOptions,
|
|
8
|
+
): options is ParsedDesignsOptions {
|
|
9
|
+
const { structure, item, items } = options;
|
|
10
|
+
if (!structure) return false;
|
|
11
|
+
if (!item) return false;
|
|
12
|
+
if (items.some((it) => !it)) return false;
|
|
13
|
+
return true;
|
|
14
|
+
}
|
package/src/utils/font.ts
CHANGED
|
@@ -14,21 +14,31 @@ export function encodeFontFamily(font: string) {
|
|
|
14
14
|
const FontWeightNameMap: Record<string, FontWeightName> = {
|
|
15
15
|
'100': 'thin',
|
|
16
16
|
hairline: 'thin',
|
|
17
|
+
thin: 'thin',
|
|
17
18
|
'200': 'extralight',
|
|
18
19
|
ultralight: 'extralight',
|
|
20
|
+
extralight: 'extralight',
|
|
19
21
|
'300': 'light',
|
|
22
|
+
light: 'light',
|
|
20
23
|
'400': 'regular',
|
|
21
24
|
normal: 'regular',
|
|
25
|
+
regular: 'regular',
|
|
22
26
|
'500': 'medium',
|
|
27
|
+
medium: 'medium',
|
|
23
28
|
'600': 'semibold',
|
|
24
29
|
demibold: 'semibold',
|
|
30
|
+
semibold: 'semibold',
|
|
25
31
|
'700': 'bold',
|
|
32
|
+
bold: 'bold',
|
|
26
33
|
'800': 'extrabold',
|
|
27
|
-
ultrabold: '
|
|
34
|
+
ultrabold: 'extrabold',
|
|
35
|
+
extrabold: 'extrabold',
|
|
28
36
|
'900': 'black',
|
|
29
37
|
heavy: 'black',
|
|
38
|
+
black: 'black',
|
|
30
39
|
'950': 'extrablack',
|
|
31
40
|
ultrablack: 'extrablack',
|
|
41
|
+
extrablack: 'extrablack',
|
|
32
42
|
};
|
|
33
43
|
|
|
34
44
|
export function normalizeFontWeightName(
|
package/src/utils/index.ts
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
|
|
3
|
-
*/
|
|
4
|
-
export type FontWeightName = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 'extrablack';
|
|
5
|
-
export interface Font {
|
|
6
|
-
font: string;
|
|
7
|
-
name: string;
|
|
8
|
-
/** 字体 CDN */
|
|
9
|
-
fontWeight: {
|
|
10
|
-
[keys in FontWeightName]?: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
|
|
3
|
-
*/
|
|
4
|
-
export type FontWeightName = 'thin' | 'extralight' | 'light' | 'regular' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 'extrablack';
|
|
5
|
-
export interface Font {
|
|
6
|
-
font: string;
|
|
7
|
-
name: string;
|
|
8
|
-
/** 字体 CDN */
|
|
9
|
-
fontWeight: {
|
|
10
|
-
[keys in FontWeightName]?: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
|
|
3
|
-
*/
|
|
4
|
-
export type FontWeightName =
|
|
5
|
-
| 'thin'
|
|
6
|
-
| 'extralight'
|
|
7
|
-
| 'light'
|
|
8
|
-
| 'regular'
|
|
9
|
-
| 'medium'
|
|
10
|
-
| 'semibold'
|
|
11
|
-
| 'bold'
|
|
12
|
-
| 'extrabold'
|
|
13
|
-
| 'black'
|
|
14
|
-
| 'extrablack';
|
|
15
|
-
|
|
16
|
-
export interface Font {
|
|
17
|
-
font: string;
|
|
18
|
-
name: string;
|
|
19
|
-
/** 字体 CDN */
|
|
20
|
-
fontWeight: {
|
|
21
|
-
[keys in FontWeightName]?: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
File without changes
|
|
File without changes
|