@antv/g2 5.1.4 → 5.1.5-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/g2-lite.min.js +1 -1
  2. package/dist/g2.min.js +1 -1
  3. package/esm/api/chart.d.ts +1 -0
  4. package/esm/api/library.d.ts +1 -0
  5. package/esm/api/utils.d.ts +1 -0
  6. package/esm/api/utils.js +25 -6
  7. package/esm/api/utils.js.map +1 -1
  8. package/esm/composition/repeatMatrix.js +4 -1
  9. package/esm/composition/repeatMatrix.js.map +1 -1
  10. package/esm/interaction/fisheye.js +3 -1
  11. package/esm/interaction/fisheye.js.map +1 -1
  12. package/esm/interaction/legendFilter.d.ts +1 -1
  13. package/esm/interaction/legendFilter.js +72 -31
  14. package/esm/interaction/legendFilter.js.map +1 -1
  15. package/esm/interaction/tooltip.d.ts +2 -2
  16. package/esm/interaction/tooltip.js +37 -20
  17. package/esm/interaction/tooltip.js.map +1 -1
  18. package/esm/lib/core.d.ts +1 -0
  19. package/esm/lib/core.js +2 -1
  20. package/esm/lib/core.js.map +1 -1
  21. package/esm/lib/std.d.ts +1 -0
  22. package/esm/runtime/plot.js +11 -4
  23. package/esm/runtime/plot.js.map +1 -1
  24. package/esm/shape/connector/connector.js +1 -1
  25. package/esm/shape/connector/connector.js.map +1 -1
  26. package/esm/theme/academy.js +30 -358
  27. package/esm/theme/academy.js.map +1 -1
  28. package/esm/theme/classic.js +4 -433
  29. package/esm/theme/classic.js.map +1 -1
  30. package/esm/theme/classicDark.js +3 -404
  31. package/esm/theme/classicDark.js.map +1 -1
  32. package/esm/theme/create.d.ts +437 -0
  33. package/esm/theme/create.js +421 -0
  34. package/esm/theme/create.js.map +1 -0
  35. package/esm/theme/dark.d.ts +3 -0
  36. package/esm/theme/dark.js +76 -0
  37. package/esm/theme/dark.js.map +1 -0
  38. package/esm/theme/index.d.ts +1 -0
  39. package/esm/theme/index.js +1 -0
  40. package/esm/theme/index.js.map +1 -1
  41. package/esm/theme/light.js +52 -470
  42. package/esm/theme/light.js.map +1 -1
  43. package/lib/api/chart.d.ts +1 -0
  44. package/lib/api/library.d.ts +1 -0
  45. package/lib/api/utils.d.ts +1 -0
  46. package/lib/api/utils.js +26 -7
  47. package/lib/api/utils.js.map +1 -1
  48. package/lib/composition/repeatMatrix.js +4 -1
  49. package/lib/composition/repeatMatrix.js.map +1 -1
  50. package/lib/interaction/fisheye.js +3 -1
  51. package/lib/interaction/fisheye.js.map +1 -1
  52. package/lib/interaction/legendFilter.d.ts +1 -1
  53. package/lib/interaction/legendFilter.js +72 -31
  54. package/lib/interaction/legendFilter.js.map +1 -1
  55. package/lib/interaction/tooltip.d.ts +2 -2
  56. package/lib/interaction/tooltip.js +37 -20
  57. package/lib/interaction/tooltip.js.map +1 -1
  58. package/lib/lib/core.d.ts +1 -0
  59. package/lib/lib/core.js +1 -0
  60. package/lib/lib/core.js.map +1 -1
  61. package/lib/lib/std.d.ts +1 -0
  62. package/lib/runtime/plot.js +11 -4
  63. package/lib/runtime/plot.js.map +1 -1
  64. package/lib/shape/connector/connector.js +1 -1
  65. package/lib/shape/connector/connector.js.map +1 -1
  66. package/lib/theme/academy.js +30 -358
  67. package/lib/theme/academy.js.map +1 -1
  68. package/lib/theme/classic.js +4 -433
  69. package/lib/theme/classic.js.map +1 -1
  70. package/lib/theme/classicDark.js +3 -404
  71. package/lib/theme/classicDark.js.map +1 -1
  72. package/lib/theme/create.d.ts +437 -0
  73. package/lib/theme/create.js +425 -0
  74. package/lib/theme/create.js.map +1 -0
  75. package/lib/theme/dark.d.ts +3 -0
  76. package/lib/theme/dark.js +80 -0
  77. package/lib/theme/dark.js.map +1 -0
  78. package/lib/theme/index.d.ts +1 -0
  79. package/lib/theme/index.js +3 -1
  80. package/lib/theme/index.js.map +1 -1
  81. package/lib/theme/light.js +52 -470
  82. package/lib/theme/light.js.map +1 -1
  83. package/package.json +1 -1
  84. package/src/api/utils.ts +22 -6
  85. package/src/composition/repeatMatrix.ts +11 -2
  86. package/src/interaction/fisheye.ts +3 -1
  87. package/src/interaction/legendFilter.ts +81 -48
  88. package/src/interaction/tooltip.ts +56 -32
  89. package/src/lib/core.ts +2 -1
  90. package/src/runtime/plot.ts +34 -7
  91. package/src/shape/connector/connector.ts +1 -1
  92. package/src/theme/academy.ts +74 -399
  93. package/src/theme/classic.ts +11 -438
  94. package/src/theme/classicDark.ts +10 -409
  95. package/src/theme/create.ts +439 -0
  96. package/src/theme/dark.ts +85 -0
  97. package/src/theme/index.ts +1 -0
  98. package/src/theme/light.ts +53 -473
@@ -1,484 +1,64 @@
1
+ import { deepMix } from '@antv/util';
1
2
  import { ThemeComponent as TC, Theme } from '../runtime';
3
+ import { create } from './create';
2
4
 
3
- export type LightOptions = Theme;
4
-
5
- const COLORS = {
6
- BLACK: '#1D2129',
7
- WHITE: '#fff',
8
- STROKE: '#416180',
9
- DEFAULT: '#1783FF',
10
- BACKGROUND: 'transparent',
11
- };
5
+ const defaults = create({
6
+ colorBlack: '#1D2129',
7
+ colorWhite: '#fff',
8
+ colorStroke: '#416180',
9
+ colorDefault: '#1783FF',
10
+ colorBackground: 'transparent',
11
+ category10: [
12
+ '#1783FF',
13
+ '#00C9C9',
14
+ '#F0884D',
15
+ '#D580FF',
16
+ '#7863FF',
17
+ '#60C42D',
18
+ '#BD8F24',
19
+ '#FF80CA',
20
+ '#2491B3',
21
+ '#17C76F',
22
+ ],
23
+ category20: [
24
+ '#1783FF',
25
+ '#00C9C9',
26
+ '#F0884D',
27
+ '#D580FF',
28
+ '#7863FF',
29
+ '#60C42D',
30
+ '#BD8F24',
31
+ '#FF80CA',
32
+ '#2491B3',
33
+ '#17C76F',
34
+ '#AABA01',
35
+ '#BC7CFC',
36
+ '#237CBC',
37
+ '#2DE379',
38
+ '#CE8032',
39
+ '#FF7AF4',
40
+ '#545FD3',
41
+ '#AFE410',
42
+ '#D8C608',
43
+ '#FFA1E0',
44
+ ],
45
+ padding1: 8,
46
+ padding2: 12,
47
+ padding3: 20,
48
+ alpha90: 0.9,
49
+ alpha65: 0.65,
50
+ alpha45: 0.45,
51
+ alpha25: 0.25,
52
+ alpha10: 0.1,
53
+ });
12
54
 
13
- const PADDING = {
14
- 1: 8,
15
- 2: 12,
16
- 3: 20,
17
- };
18
-
19
- const ALPHA = {
20
- 90: 0.9,
21
- 65: 0.65,
22
- 45: 0.45,
23
- 25: 0.25,
24
- 10: 0.1,
25
- };
55
+ export type LightOptions = Theme;
26
56
 
27
57
  /**
28
58
  * Default theme.
29
59
  */
30
60
  export const Light: TC<LightOptions> = (options) => {
31
- const defaultOptions: Theme = {
32
- padding: 'auto',
33
- margin: 16,
34
- color: COLORS.DEFAULT,
35
- size: 1,
36
- category10: [
37
- '#1783FF',
38
- '#00C9C9',
39
- '#F0884D',
40
- '#D580FF',
41
- '#7863FF',
42
- '#60C42D',
43
- '#BD8F24',
44
- '#FF80CA',
45
- '#2491B3',
46
- '#17C76F',
47
- ],
48
- category20: [
49
- '#1783FF',
50
- '#00C9C9',
51
- '#F0884D',
52
- '#D580FF',
53
- '#7863FF',
54
- '#60C42D',
55
- '#BD8F24',
56
- '#FF80CA',
57
- '#2491B3',
58
- '#17C76F',
59
- '#AABA01',
60
- '#BC7CFC',
61
- '#237CBC',
62
- '#2DE379',
63
- '#CE8032',
64
- '#FF7AF4',
65
- '#545FD3',
66
- '#AFE410',
67
- '#D8C608',
68
- '#FFA1E0',
69
- ],
70
- enter: {
71
- duration: 300,
72
- fill: 'both',
73
- delay: 0,
74
- },
75
- update: {
76
- duration: 300,
77
- fill: 'both',
78
- delay: 0,
79
- },
80
- exit: {
81
- duration: 300,
82
- fill: 'both',
83
- delay: 0,
84
- },
85
- view: {
86
- viewFill: COLORS.BACKGROUND,
87
- plotFill: 'transparent',
88
- mainFill: 'transparent',
89
- contentFill: 'transparent',
90
- },
91
- line: {
92
- line: {
93
- fill: '',
94
- strokeOpacity: 1,
95
- lineWidth: 1,
96
- },
97
- },
98
- point: {
99
- point: {
100
- r: 3,
101
- fillOpacity: 0.95,
102
- lineWidth: 0,
103
- },
104
- hollow: {
105
- r: 3,
106
- strokeOpacity: 0.95,
107
- lineWidth: 1,
108
- },
109
- plus: {
110
- r: 3,
111
- strokeOpacity: 0.95,
112
- lineWidth: 3,
113
- },
114
- diamond: {
115
- r: 3,
116
- strokeOpacity: 0.95,
117
- lineWidth: 1,
118
- },
119
- },
120
- interval: {
121
- rect: {
122
- fillOpacity: 0.95,
123
- },
124
- hollow: {
125
- fill: '',
126
- strokeOpacity: 1,
127
- lineWidth: 2,
128
- },
129
- },
130
- area: {
131
- area: {
132
- fillOpacity: 0.85,
133
- lineWidth: 0,
134
- },
135
- },
136
- polygon: {
137
- polygon: {
138
- fillOpacity: 0.95,
139
- },
140
- },
141
- cell: {
142
- cell: {
143
- fillOpacity: 0.95,
144
- },
145
- hollow: {
146
- fill: '',
147
- strokeOpacity: 1,
148
- lineWidth: 2,
149
- },
150
- },
151
- rect: {
152
- rect: {
153
- fillOpacity: 0.95,
154
- },
155
- hollow: {
156
- fill: '',
157
- strokeOpacity: 1,
158
- lineWidth: 2,
159
- },
160
- },
161
- link: {
162
- link: {
163
- fill: '',
164
- strokeOpacity: 1,
165
- },
166
- },
167
- vector: {
168
- vector: {
169
- fillOpacity: 1,
170
- },
171
- },
172
- box: {
173
- box: {
174
- fillOpacity: 0.95,
175
- stroke: COLORS.BLACK,
176
- lineWidth: 1,
177
- },
178
- },
179
- text: {
180
- text: {
181
- fill: '#1D2129',
182
- fontSize: 12,
183
- strokeWidth: 0,
184
- connectorStroke: COLORS.STROKE,
185
- connectorStrokeOpacity: 0.45,
186
- connectorLineWidth: 1,
187
- backgroundFill: COLORS.STROKE,
188
- backgroundFillOpacity: 0.15,
189
- backgroundPadding: [2, 4],
190
- startMarkerSymbol: 'circle',
191
- startMarkerSize: 4,
192
- endMarkerSymbol: 'circle',
193
- endMarkerSize: 4,
194
- },
195
- badge: {
196
- fill: '#1D2129',
197
- fillOpacity: 0.65,
198
- strokeWidth: 0,
199
- fontSize: 10,
200
- textAlign: 'center',
201
- textBaseline: 'middle',
202
- markerFill: COLORS.STROKE,
203
- markerFillOpacity: 0.25,
204
- markerStrokeOpacity: 0,
205
- },
206
- },
207
- lineX: {
208
- line: {
209
- stroke: COLORS.STROKE,
210
- strokeOpacity: 0.45,
211
- lineWidth: 1,
212
- },
213
- },
214
- lineY: {
215
- line: {
216
- stroke: COLORS.STROKE,
217
- strokeOpacity: 0.45,
218
- lineWidth: 1,
219
- },
220
- },
221
- rangeX: {
222
- range: {
223
- fill: COLORS.STROKE,
224
- fillOpacity: 0.15,
225
- lineWidth: 0,
226
- },
227
- },
228
- rangeY: {
229
- range: {
230
- fill: COLORS.STROKE,
231
- fillOpacity: 0.15,
232
- lineWidth: 0,
233
- },
234
- },
235
- connector: {
236
- connector: {
237
- stroke: COLORS.STROKE,
238
- strokeOpacity: 0.45,
239
- lineWidth: 1,
240
- connectLength1: 12,
241
- endMarker: true,
242
- endMarkerSize: 6,
243
- endMarkerFill: COLORS.STROKE,
244
- endMarkerFillOpacity: 0.95,
245
- },
246
- },
247
- axis: {
248
- arrow: false,
249
- gridLineDash: [3, 4],
250
- gridLineWidth: 0.5,
251
- gridStroke: COLORS.BLACK,
252
- gridStrokeOpacity: ALPHA[10],
253
- labelAlign: 'horizontal',
254
- labelFill: COLORS.BLACK,
255
- labelOpacity: ALPHA[45],
256
- labelFontSize: 12,
257
- labelFontWeight: 'normal',
258
- labelSpacing: PADDING[1], // spacing between label and it's tick
259
- line: false,
260
- lineLineWidth: 0.5,
261
- lineStroke: COLORS.BLACK,
262
- lineStrokeOpacity: ALPHA[45],
263
- tickLength: 4,
264
- tickLineWidth: 1,
265
- tickStroke: COLORS.BLACK,
266
- tickOpacity: ALPHA[45],
267
- titleFill: COLORS.BLACK,
268
- titleOpacity: ALPHA[90],
269
- titleFontSize: 12,
270
- titleFontWeight: 'normal',
271
- titleSpacing: 12,
272
- titleTransformOrigin: 'center',
273
- lineArrowOffset: 6,
274
- lineArrowSize: 6,
275
- },
276
- axisTop: {
277
- gridDirection: 'positive',
278
- labelDirection: 'negative',
279
- tickDirection: 'negative',
280
- titlePosition: 'top',
281
- labelAutoRotate: false,
282
- titleSpacing: 12,
283
- labelSpacing: 4,
284
- titleTextBaseline: 'middle',
285
- },
286
- axisBottom: {
287
- gridDirection: 'negative',
288
- labelDirection: 'positive',
289
- labelAutoRotate: false,
290
- tickDirection: 'positive',
291
- titlePosition: 'bottom',
292
- titleSpacing: 12,
293
- labelSpacing: 4,
294
- titleTextBaseline: 'bottom',
295
- },
296
- axisLeft: {
297
- gridDirection: 'positive',
298
- labelAutoRotate: false,
299
- labelDirection: 'negative',
300
- labelSpacing: 4,
301
- tickDirection: 'negative',
302
- titlePosition: 'left',
303
- titleSpacing: 12,
304
- titleTextBaseline: 'middle',
305
- titleDirection: 'vertical',
306
- titleTransformOrigin: 'center',
307
- },
308
- axisRight: {
309
- gridDirection: 'negative',
310
- labelDirection: 'positive',
311
- labelSpacing: 4,
312
- tickDirection: 'positive',
313
- titlePosition: 'right',
314
- labelAutoRotate: false,
315
- titleSpacing: 12,
316
- titleTextBaseline: 'top',
317
- titleDirection: 'vertical',
318
- titleTransformOrigin: 'center',
319
- },
320
- axisLinear: {
321
- girdClosed: true,
322
- gridConnect: 'arc',
323
- gridDirection: 'negative',
324
- gridType: 'surround',
325
- titlePosition: 'top',
326
- titleSpacing: 0,
327
- },
328
- axisArc: {
329
- title: false,
330
- titlePosition: 'inner',
331
- line: false,
332
- tick: true,
333
- labelSpacing: 4,
334
- },
335
- axisRadar: {
336
- girdClosed: true,
337
- gridStrokeOpacity: 0.3,
338
- gridType: 'surround',
339
- label: false,
340
- tick: false,
341
- titlePosition: 'start',
342
- },
343
- legendCategory: {
344
- backgroundFill: 'transparent',
345
- itemBackgroundFill: 'transparent',
346
- itemLabelFill: COLORS.BLACK,
347
- itemLabelFillOpacity: ALPHA[90],
348
- itemLabelFontSize: 12,
349
- itemLabelFontWeight: 'normal',
350
- itemMarkerFillOpacity: 1,
351
- itemMarkerSize: 8,
352
- itemSpacing: [PADDING[1], PADDING[1]],
353
- itemValueFill: COLORS.BLACK,
354
- itemValueFillOpacity: 0.65,
355
- itemValueFontSize: 12,
356
- itemValueFontWeight: 'normal',
357
- navButtonFill: COLORS.BLACK,
358
- navButtonFillOpacity: 0.65,
359
- navPageNumFill: COLORS.BLACK,
360
- navPageNumFillOpacity: 0.45,
361
- navPageNumFontSize: 12,
362
- padding: 8,
363
- title: false,
364
- titleFill: COLORS.BLACK,
365
- titleFillOpacity: 0.65,
366
- titleFontSize: 12,
367
- titleFontWeight: 'normal',
368
- titleSpacing: 4,
369
- tickStroke: COLORS.BLACK,
370
- tickStrokeOpacity: 0.25,
371
- rowPadding: PADDING[1],
372
- colPadding: PADDING[2],
373
- maxRows: 3,
374
- maxCols: 3,
375
- },
376
- legendContinuous: {
377
- handleHeight: 12,
378
- handleLabelFill: COLORS.BLACK,
379
- handleLabelFillOpacity: ALPHA[45],
380
- handleLabelFontSize: 12,
381
- handleLabelFontWeight: 'normal',
382
- handleMarkerFill: COLORS.BLACK,
383
- handleMarkerFillOpacity: 0.6,
384
- handleMarkerLineWidth: 1,
385
- handleMarkerStroke: COLORS.BLACK,
386
- handleMarkerStrokeOpacity: 0.25,
387
- handleWidth: 10,
388
- labelFill: COLORS.BLACK,
389
- labelFillOpacity: ALPHA[45],
390
- labelFontSize: 12,
391
- labelFontWeight: 'normal',
392
- labelSpacing: 3,
393
- tick: true,
394
- tickLength: 12,
395
- ribbonSize: 12,
396
- ribbonFill: '#aaa',
397
- handle: true,
398
- handleLabel: false,
399
- handleShape: 'slider',
400
- handleIconSize: 12 / 1.8,
401
- indicator: false,
402
- titleFontSize: 12,
403
- titleSpacing: 4,
404
- titleFontWeight: 'normal',
405
- titleFillOpacity: ALPHA[90],
406
- tickStroke: COLORS.BLACK,
407
- tickStrokeOpacity: ALPHA[45],
408
- },
409
- label: {
410
- fill: COLORS.BLACK,
411
- fillOpacity: 0.65,
412
- fontSize: 12,
413
- fontWeight: 'normal',
414
- stroke: undefined,
415
- offset: 12,
416
- connectorStroke: COLORS.BLACK,
417
- connectorStrokeOpacity: 0.45,
418
- connectorLineWidth: 1,
419
- connectorLength: 12,
420
- connectorLength2: 8,
421
- connectorDistance: 4,
422
- },
423
- innerLabel: {
424
- fill: COLORS.WHITE,
425
- fontSize: 12,
426
- fillOpacity: 0.85,
427
- fontWeight: 'normal',
428
- stroke: undefined,
429
- offset: 0,
430
- },
431
- htmlLabel: {
432
- fontSize: 12,
433
- opacity: 0.65,
434
- color: COLORS.BLACK,
435
- fontWeight: 'normal',
436
- },
437
- slider: {
438
- trackSize: 16,
439
- trackFill: COLORS.STROKE,
440
- trackFillOpacity: 1,
441
- selectionFill: COLORS.DEFAULT,
442
- selectionFillOpacity: 0.15,
443
- handleIconSize: 10,
444
- handleIconFill: '#f7f7f7',
445
- handleIconFillOpacity: 1,
446
- handleIconStroke: COLORS.BLACK,
447
- handleIconStrokeOpacity: 0.25,
448
- handleIconLineWidth: 1,
449
- handleIconRadius: 2,
450
- handleLabelFill: COLORS.BLACK,
451
- handleLabelFillOpacity: 0.45,
452
- handleLabelFontSize: 12,
453
- handleLabelFontWeight: 'normal',
454
- },
455
- scrollbar: {
456
- padding: [0, 0, 0, 0],
457
- trackSize: 6,
458
- isRound: true,
459
- slidable: true,
460
- scrollable: true,
461
- trackFill: '#e5e5e5',
462
- trackFillOpacity: 0,
463
- thumbFill: '#000',
464
- thumbFillOpacity: 0.15,
465
- thumbHighlightedFillOpacity: 0.2,
466
- },
467
- title: {
468
- spacing: 8,
469
- titleFill: COLORS.BLACK,
470
- titleFillOpacity: ALPHA[90],
471
- titleFontSize: 16,
472
- titleFontWeight: 'bold',
473
- titleTextBaseline: 'top',
474
- subtitleFill: COLORS.BLACK,
475
- subtitleFillOpacity: ALPHA[65],
476
- subtitleFontSize: 12,
477
- subtitleFontWeight: 'normal',
478
- subtitleTextBaseline: 'top',
479
- },
480
- };
481
- return Object.assign({}, defaultOptions, options);
61
+ return deepMix({}, defaults, options);
482
62
  };
483
63
 
484
64
  Light.props = {};