@visactor/vrender-components 0.17.13-alpha.0 → 0.17.13

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/es/util/text.js CHANGED
@@ -13,18 +13,18 @@ export const initTextMeasure = (textSpec, option, useNaiveCanvas) => new TextMea
13
13
  specialCharSet: "-/: .,@%'\"~" + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
14
14
  }, null != option ? option : {}), textSpec);
15
15
 
16
- export function measureTextSize(text, textSpec) {
17
- var _a;
16
+ export function measureTextSize(text, textSpec, fontFamily = DEFAULT_TEXT_FONT_FAMILY) {
17
+ var _a, _b;
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: textSpec.fontFamily,
24
+ fontFamily: null !== (_a = textSpec.fontFamily) && void 0 !== _a ? _a : fontFamily,
25
25
  fontSize: textSpec.fontSize || 12,
26
26
  fontWeight: textSpec.fontWeight,
27
- textAlign: null !== (_a = textSpec.textAlign) && void 0 !== _a ? _a : "center",
27
+ textAlign: null !== (_b = textSpec.textAlign) && void 0 !== _b ? _b : "center",
28
28
  textBaseline: textSpec.textBaseline,
29
29
  ellipsis: !!textSpec.ellipsis,
30
30
  maxLineWidth: textSpec.maxLineWidth || 1 / 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,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,QAAyC,EACzC,MAAoC,EACpC,cAAwB,EACY,EAAE;IACtC,OAAO,IAAI,WAAW,iBAElB,iBAAiB,EAAE;YACjB,UAAU,EAAE,wBAAwB;YACpC,QAAQ,EAAE,sBAAsB;SACjC,EACD,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACzD,cAAc,EAAE,cAAc,GAAG,WAAW,CAAC,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,IACzG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,GAEnB,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAGF,MAAM,UAAU,eAAe,CAAC,IAA2C,EAAE,QAAwC;;IACnH,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAChC;IACD,MAAM,MAAM,GAAG,aAAa,CAAC;QAC3B,IAAI;QACJ,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAiB;QACtC,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,QAAQ;QACzC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ;QAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,QAAQ;QAC/C,UAAU,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;AAC5D,CAAC","file":"text.js","sourcesContent":["import type { ITextGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getTextBounds } from '@visactor/vrender-core';\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":["../src/util/text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,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,QAAyC,EACzC,MAAoC,EACpC,cAAwB,EACY,EAAE;IACtC,OAAO,IAAI,WAAW,iBAElB,iBAAiB,EAAE;YACjB,UAAU,EAAE,wBAAwB;YACpC,QAAQ,EAAE,sBAAsB;SACjC,EACD,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACzD,cAAc,EAAE,cAAc,GAAG,WAAW,CAAC,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,IACzG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,GAEnB,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAGF,MAAM,UAAU,eAAe,CAC7B,IAA2C,EAC3C,QAAwC,EACxC,aAAqB,wBAAwB;;IAE7C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAChC;IACD,MAAM,MAAM,GAAG,aAAa,CAAC;QAC3B,IAAI;QACJ,UAAU,EAAE,MAAA,QAAQ,CAAC,UAAU,mCAAI,UAAU;QAC7C,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAiB;QACtC,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,QAAQ;QACzC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ;QAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,QAAQ;QAC/C,UAAU,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;AAC5D,CAAC","file":"text.js","sourcesContent":["import type { ITextGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getTextBounds } from '@visactor/vrender-core';\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(\n text: string | number | string[] | number[],\n textSpec: Partial<ITextGraphicAttribute>,\n fontFamily: string = DEFAULT_TEXT_FONT_FAMILY\n) {\n if (!text) {\n return { width: 0, height: 0 };\n }\n const bounds = getTextBounds({\n text,\n fontFamily: textSpec.fontFamily ?? 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.17.13-alpha.0",
3
+ "version": "0.17.13",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,8 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "0.17.13-alpha.0",
16
- "@visactor/vrender-kits": "0.17.13-alpha.0",
15
+ "@visactor/vrender-core": "0.17.13",
16
+ "@visactor/vrender-kits": "0.17.13",
17
17
  "@visactor/vutils": "~0.17.3",
18
18
  "@visactor/vscale": "~0.17.3"
19
19
  },
@@ -28,8 +28,8 @@
28
28
  "eslint": "~8.18.0",
29
29
  "vite": "3.2.6",
30
30
  "typescript": "4.9.5",
31
- "@internal/eslint-config": "0.0.1",
32
31
  "@internal/bundler": "0.0.1",
32
+ "@internal/eslint-config": "0.0.1",
33
33
  "@internal/ts-config": "0.0.1"
34
34
  },
35
35
  "keywords": [