@visactor/vrender-components 0.14.6-alpha.8 → 0.14.6-alpha.9

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 (99) hide show
  1. package/cjs/axis/line.js +1 -50
  2. package/cjs/axis/line.js.map +1 -1
  3. package/cjs/axis/overlap/auto-rotate.js +2 -2
  4. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  5. package/cjs/axis/type.d.ts +0 -1
  6. package/cjs/axis/type.js.map +1 -1
  7. package/cjs/brush/brush.d.ts +0 -1
  8. package/cjs/brush/brush.js +0 -5
  9. package/cjs/brush/brush.js.map +1 -1
  10. package/cjs/index.d.ts +2 -1
  11. package/cjs/index.js +2 -2
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/jsx/component-type.d.ts +4 -0
  14. package/cjs/jsx/component-type.js +14 -0
  15. package/cjs/jsx/component-type.js.map +1 -0
  16. package/cjs/jsx/index.d.ts +1 -0
  17. package/cjs/jsx/index.js +21 -0
  18. package/cjs/jsx/index.js.map +1 -0
  19. package/cjs/label/arc.d.ts +3 -6
  20. package/cjs/label/arc.js +1 -31
  21. package/cjs/label/arc.js.map +1 -1
  22. package/cjs/label/base.d.ts +9 -12
  23. package/cjs/label/base.js +134 -117
  24. package/cjs/label/base.js.map +1 -1
  25. package/cjs/label/dataLabel.js +4 -4
  26. package/cjs/label/dataLabel.js.map +1 -1
  27. package/cjs/label/overlap/place.d.ts +2 -2
  28. package/cjs/label/overlap/place.js +8 -15
  29. package/cjs/label/overlap/place.js.map +1 -1
  30. package/cjs/label/rect.js.map +1 -1
  31. package/cjs/label/symbol.js.map +1 -1
  32. package/cjs/label/type.d.ts +2 -5
  33. package/cjs/label/type.js.map +1 -1
  34. package/cjs/link-path/index.js +1 -2
  35. package/cjs/link-path/link-path.js +2 -1
  36. package/cjs/marker/point.js +1 -1
  37. package/cjs/poptip/poptip.js +20 -7
  38. package/cjs/poptip/poptip.js.map +1 -1
  39. package/cjs/poptip/register.js +6 -4
  40. package/cjs/poptip/register.js.map +1 -1
  41. package/cjs/util/labelSmartInvert.d.ts +0 -1
  42. package/cjs/util/labelSmartInvert.js +2 -20
  43. package/cjs/util/labelSmartInvert.js.map +1 -1
  44. package/cjs/util/text.js +3 -3
  45. package/cjs/util/text.js.map +1 -1
  46. package/dist/index.js +222 -314
  47. package/dist/index.min.js +1 -1
  48. package/es/axis/line.js +2 -50
  49. package/es/axis/line.js.map +1 -1
  50. package/es/axis/overlap/auto-rotate.js +2 -2
  51. package/es/axis/overlap/auto-rotate.js.map +1 -1
  52. package/es/axis/type.d.ts +0 -1
  53. package/es/axis/type.js.map +1 -1
  54. package/es/brush/brush.d.ts +0 -1
  55. package/es/brush/brush.js +0 -5
  56. package/es/brush/brush.js.map +1 -1
  57. package/es/index.d.ts +2 -1
  58. package/es/index.js +3 -1
  59. package/es/index.js.map +1 -1
  60. package/es/jsx/component-type.d.ts +4 -0
  61. package/es/jsx/component-type.js +6 -0
  62. package/es/jsx/component-type.js.map +1 -0
  63. package/es/jsx/index.d.ts +1 -0
  64. package/es/jsx/index.js +2 -0
  65. package/es/jsx/index.js.map +1 -0
  66. package/es/label/arc.d.ts +3 -6
  67. package/es/label/arc.js +0 -31
  68. package/es/label/arc.js.map +1 -1
  69. package/es/label/base.d.ts +9 -12
  70. package/es/label/base.js +132 -118
  71. package/es/label/base.js.map +1 -1
  72. package/es/label/dataLabel.js +3 -5
  73. package/es/label/dataLabel.js.map +1 -1
  74. package/es/label/overlap/place.d.ts +2 -2
  75. package/es/label/overlap/place.js +8 -15
  76. package/es/label/overlap/place.js.map +1 -1
  77. package/es/label/rect.js.map +1 -1
  78. package/es/label/symbol.js.map +1 -1
  79. package/es/label/type.d.ts +2 -5
  80. package/es/label/type.js.map +1 -1
  81. package/es/link-path/index.js +1 -2
  82. package/es/link-path/link-path.js +2 -1
  83. package/es/marker/point.js +1 -1
  84. package/es/poptip/poptip.js +19 -6
  85. package/es/poptip/poptip.js.map +1 -1
  86. package/es/poptip/register.js +6 -4
  87. package/es/poptip/register.js.map +1 -1
  88. package/es/util/labelSmartInvert.d.ts +0 -1
  89. package/es/util/labelSmartInvert.js +0 -17
  90. package/es/util/labelSmartInvert.js.map +1 -1
  91. package/es/util/text.js +3 -3
  92. package/es/util/text.js.map +1 -1
  93. package/package.json +2 -2
  94. package/cjs/label/polygon.d.ts +0 -12
  95. package/cjs/label/polygon.js +0 -35
  96. package/cjs/label/polygon.js.map +0 -1
  97. package/es/label/polygon.d.ts +0 -12
  98. package/es/label/polygon.js +0 -31
  99. package/es/label/polygon.js.map +0 -1
package/es/util/text.js CHANGED
@@ -14,17 +14,17 @@ export const initTextMeasure = (textSpec, option, useNaiveCanvas) => new TextMea
14
14
  }, null != option ? option : {}), textSpec);
15
15
 
16
16
  export function measureTextSize(text, textSpec) {
17
- var _a, _b;
17
+ var _a;
18
18
  if (!text) return {
19
19
  width: 0,
20
20
  height: 0
21
21
  };
22
22
  const bounds = getTextBounds({
23
23
  text: text,
24
- fontFamily: null !== (_a = textSpec.fontFamily) && void 0 !== _a ? _a : "",
24
+ fontFamily: textSpec.fontFamily,
25
25
  fontSize: textSpec.fontSize || 12,
26
26
  fontWeight: textSpec.fontWeight,
27
- textAlign: null !== (_b = textSpec.textAlign) && void 0 !== _b ? _b : "center",
27
+ textAlign: null !== (_a = textSpec.textAlign) && void 0 !== _a ? _a : "center",
28
28
  textBaseline: textSpec.textBaseline,
29
29
  ellipsis: !!textSpec.ellipsis,
30
30
  maxLineWidth: textSpec.maxLineWidth || 1 / 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["util/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,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plicate-imports\nimport { getTextBounds } from '@visactor/vrender';\nimport type { ITextMeasureOption } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { TextMeasure } from '@visactor/vutils';\nimport { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE } from '../constant';\n\nexport const initTextMeasure = (\n textSpec?: Partial<ITextGraphicAttribute>,\n option?: Partial<ITextMeasureOption>,\n useNaiveCanvas?: boolean\n): TextMeasure<ITextGraphicAttribute> => {\n return new TextMeasure<ITextGraphicAttribute>(\n {\n defaultFontParams: {\n fontFamily: DEFAULT_TEXT_FONT_FAMILY,\n fontSize: DEFAULT_TEXT_FONT_SIZE\n },\n getTextBounds: useNaiveCanvas ? undefined : getTextBounds,\n specialCharSet: '-/: .,@%\\'\"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),\n ...(option ?? {})\n },\n textSpec\n );\n};\n\n// FIXME: 和上一个方法统一,使用 TextMeasure 类\nexport function measureTextSize(text: string | number | string[] | number[], textSpec: Partial<ITextGraphicAttribute>) {\n if (!text) {\n return { width: 0, height: 0 };\n }\n const bounds = getTextBounds({\n text,\n fontFamily: textSpec.fontFamily ?? '',\n fontSize: textSpec.fontSize || 12,\n fontWeight: textSpec.fontWeight as any,\n textAlign: textSpec.textAlign ?? 'center',\n textBaseline: textSpec.textBaseline,\n ellipsis: !!textSpec.ellipsis,\n maxLineWidth: textSpec.maxLineWidth || Infinity,\n lineHeight: textSpec.fontSize || 12\n });\n\n return { width: bounds.width(), height: bounds.height() };\n}\n"]}
1
+ {"version":3,"sources":["util/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,CAAC,MAAM,eAAe,GA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\nimport { getTextBounds } from '@visactor/vrender';\nimport type { ITextMeasureOption } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { TextMeasure } from '@visactor/vutils';\nimport { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE } from '../constant';\n\nexport const initTextMeasure = (\n textSpec?: Partial<ITextGraphicAttribute>,\n option?: Partial<ITextMeasureOption>,\n useNaiveCanvas?: boolean\n): TextMeasure<ITextGraphicAttribute> => {\n return new TextMeasure<ITextGraphicAttribute>(\n {\n defaultFontParams: {\n fontFamily: DEFAULT_TEXT_FONT_FAMILY,\n fontSize: DEFAULT_TEXT_FONT_SIZE\n },\n getTextBounds: useNaiveCanvas ? undefined : getTextBounds,\n specialCharSet: '-/: .,@%\\'\"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),\n ...(option ?? {})\n },\n textSpec\n );\n};\n\n// FIXME: 和上一个方法统一,使用 TextMeasure 类\nexport function measureTextSize(text: string | number | string[] | number[], textSpec: Partial<ITextGraphicAttribute>) {\n if (!text) {\n return { width: 0, height: 0 };\n }\n const bounds = getTextBounds({\n text,\n fontFamily: textSpec.fontFamily,\n fontSize: textSpec.fontSize || 12,\n fontWeight: textSpec.fontWeight as any,\n textAlign: textSpec.textAlign ?? 'center',\n textBaseline: textSpec.textBaseline,\n ellipsis: !!textSpec.ellipsis,\n maxLineWidth: textSpec.maxLineWidth || Infinity,\n lineHeight: textSpec.fontSize || 12\n });\n\n return { width: bounds.width(), height: bounds.height() };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.14.6-alpha.8",
3
+ "version": "0.14.6-alpha.9",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender": "0.14.6-alpha.8",
15
+ "@visactor/vrender": "0.15.0-alpha.9",
16
16
  "@visactor/vutils": "~0.15.5",
17
17
  "@visactor/vscale": "~0.15.5",
18
18
  "inversify": "6.0.1"
@@ -1,12 +0,0 @@
1
- import type { IBoundsLike } from '@visactor/vutils';
2
- import type { PolygonLabelAttrs } from './type';
3
- import { LabelBase } from './base';
4
- export declare class PolygonLabel extends LabelBase<PolygonLabelAttrs> {
5
- name: string;
6
- static defaultAttributes: Partial<PolygonLabelAttrs>;
7
- constructor(attributes: PolygonLabelAttrs);
8
- protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: PolygonLabelAttrs['position'], offset?: number): {
9
- x: number;
10
- y: number;
11
- };
12
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- }), exports.PolygonLabel = void 0;
6
-
7
- const vutils_1 = require("@visactor/vutils"), base_1 = require("./base");
8
-
9
- class PolygonLabel extends base_1.LabelBase {
10
- constructor(attributes) {
11
- super((0, vutils_1.merge)({}, PolygonLabel.defaultAttributes, attributes)), this.name = "polygon-label";
12
- }
13
- labeling(textBounds, graphicBounds, position = "center", offset = 0) {
14
- if (!textBounds || !graphicBounds) return;
15
- const {x1: x1, x2: x2, y2: y2, y1: y1} = textBounds;
16
- return {
17
- x: (x1 + x2) / 2,
18
- y: (y1 + y2) / 2
19
- };
20
- }
21
- }
22
-
23
- exports.PolygonLabel = PolygonLabel, PolygonLabel.defaultAttributes = {
24
- textStyle: {
25
- fontSize: 12,
26
- fill: "#000",
27
- textAlign: "center",
28
- textBaseline: "middle",
29
- boundsPadding: [ -1, 0, -1, 0 ]
30
- },
31
- position: "center",
32
- offset: 6,
33
- pickable: !1
34
- };
35
- //# sourceMappingURL=polygon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["label/polygon.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AAEzC,iCAAmC;AAEnC,MAAa,YAAa,SAAQ,gBAA4B;IAgB5D,YAAY,UAA6B;QACvC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhB/D,SAAI,GAAG,eAAe,CAAC;IAiBvB,CAAC;IAES,QAAQ,CAChB,UAAuB,EACvB,aAA0B,EAC1B,WAA0C,QAAQ,EAClD,MAAM,GAAG,CAAC;QAEV,IAAI,CAAC,UAAU,IAAI,CAAC,aAAa,EAAE;YACjC,OAAO;SACR;QAED,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC;QAEtC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC;;AApCH,oCAqCC;AAlCQ,8BAAiB,GAA+B;IACrD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"polygon.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { PolygonLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nexport class PolygonLabel extends LabelBase<PolygonLabelAttrs> {\n name = 'polygon-label';\n\n static defaultAttributes: Partial<PolygonLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n position: 'center',\n offset: 6,\n pickable: false\n };\n\n constructor(attributes: PolygonLabelAttrs) {\n super(merge({}, PolygonLabel.defaultAttributes, attributes));\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position: PolygonLabelAttrs['position'] = 'center',\n offset = 0\n ) {\n if (!textBounds || !graphicBounds) {\n return;\n }\n\n const { x1, x2, y2, y1 } = textBounds;\n\n const x = (x1 + x2) / 2;\n const y = (y1 + y2) / 2;\n\n return { x, y };\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import type { IBoundsLike } from '@visactor/vutils';
2
- import type { PolygonLabelAttrs } from './type';
3
- import { LabelBase } from './base';
4
- export declare class PolygonLabel extends LabelBase<PolygonLabelAttrs> {
5
- name: string;
6
- static defaultAttributes: Partial<PolygonLabelAttrs>;
7
- constructor(attributes: PolygonLabelAttrs);
8
- protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: PolygonLabelAttrs['position'], offset?: number): {
9
- x: number;
10
- y: number;
11
- };
12
- }
@@ -1,31 +0,0 @@
1
- import { merge } from "@visactor/vutils";
2
-
3
- import { LabelBase } from "./base";
4
-
5
- export class PolygonLabel extends LabelBase {
6
- constructor(attributes) {
7
- super(merge({}, PolygonLabel.defaultAttributes, attributes)), this.name = "polygon-label";
8
- }
9
- labeling(textBounds, graphicBounds, position = "center", offset = 0) {
10
- if (!textBounds || !graphicBounds) return;
11
- const {x1: x1, x2: x2, y2: y2, y1: y1} = textBounds;
12
- return {
13
- x: (x1 + x2) / 2,
14
- y: (y1 + y2) / 2
15
- };
16
- }
17
- }
18
-
19
- PolygonLabel.defaultAttributes = {
20
- textStyle: {
21
- fontSize: 12,
22
- fill: "#000",
23
- textAlign: "center",
24
- textBaseline: "middle",
25
- boundsPadding: [ -1, 0, -1, 0 ]
26
- },
27
- position: "center",
28
- offset: 6,
29
- pickable: !1
30
- };
31
- //# sourceMappingURL=polygon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["label/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,YAAa,SAAQ,SAA4B;IAgB5D,YAAY,UAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhB/D,SAAI,GAAG,eAAe,CAAC;IAiBvB,CAAC;IAES,QAAQ,CAChB,UAAuB,EACvB,aAA0B,EAC1B,WAA0C,QAAQ,EAClD,MAAM,GAAG,CAAC;QAEV,IAAI,CAAC,UAAU,IAAI,CAAC,aAAa,EAAE;YACjC,OAAO;SACR;QAED,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC;QAEtC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC;;AAjCM,8BAAiB,GAA+B;IACrD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"polygon.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport type { PolygonLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nexport class PolygonLabel extends LabelBase<PolygonLabelAttrs> {\n name = 'polygon-label';\n\n static defaultAttributes: Partial<PolygonLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n position: 'center',\n offset: 6,\n pickable: false\n };\n\n constructor(attributes: PolygonLabelAttrs) {\n super(merge({}, PolygonLabel.defaultAttributes, attributes));\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position: PolygonLabelAttrs['position'] = 'center',\n offset = 0\n ) {\n if (!textBounds || !graphicBounds) {\n return;\n }\n\n const { x1, x2, y2, y1 } = textBounds;\n\n const x = (x1 + x2) / 2;\n const y = (y1 + y2) / 2;\n\n return { x, y };\n }\n}\n"]}