@visactor/vrender-components 0.20.1-alpha.6 → 0.20.1-alpha.7

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 (52) hide show
  1. package/cjs/axis/tick-data/continuous.js +2 -2
  2. package/cjs/axis/tick-data/continuous.js.map +1 -1
  3. package/cjs/axis/type.d.ts +1 -0
  4. package/cjs/axis/type.js.map +1 -1
  5. package/cjs/axis/util.js +3 -2
  6. package/cjs/axis/util.js.map +1 -1
  7. package/cjs/checkbox/checkbox.d.ts +2 -0
  8. package/cjs/checkbox/checkbox.js +4 -0
  9. package/cjs/checkbox/checkbox.js.map +1 -1
  10. package/cjs/crosshair/polygon.js +2 -1
  11. package/cjs/data-zoom/config.js +1 -2
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/label/arc.d.ts +2 -2
  16. package/cjs/label/arc.js +3 -2
  17. package/cjs/label/arc.js.map +1 -1
  18. package/cjs/label/type.d.ts +1 -1
  19. package/cjs/label/type.js.map +1 -1
  20. package/cjs/radio/radio.d.ts +2 -0
  21. package/cjs/radio/radio.js +4 -0
  22. package/cjs/radio/radio.js.map +1 -1
  23. package/cjs/tag/tag.d.ts +10 -0
  24. package/cjs/tag/tag.js +32 -2
  25. package/cjs/tag/tag.js.map +1 -1
  26. package/dist/index.es.js +81 -11
  27. package/es/axis/tick-data/continuous.js +2 -2
  28. package/es/axis/tick-data/continuous.js.map +1 -1
  29. package/es/axis/type.d.ts +1 -0
  30. package/es/axis/type.js.map +1 -1
  31. package/es/axis/util.js +2 -2
  32. package/es/axis/util.js.map +1 -1
  33. package/es/checkbox/checkbox.d.ts +2 -0
  34. package/es/checkbox/checkbox.js +4 -0
  35. package/es/checkbox/checkbox.js.map +1 -1
  36. package/es/crosshair/polygon.js +2 -1
  37. package/es/data-zoom/config.js +1 -2
  38. package/es/index.d.ts +1 -1
  39. package/es/index.js +1 -1
  40. package/es/index.js.map +1 -1
  41. package/es/label/arc.d.ts +2 -2
  42. package/es/label/arc.js +3 -2
  43. package/es/label/arc.js.map +1 -1
  44. package/es/label/type.d.ts +1 -1
  45. package/es/label/type.js.map +1 -1
  46. package/es/radio/radio.d.ts +2 -0
  47. package/es/radio/radio.js +4 -0
  48. package/es/radio/radio.js.map +1 -1
  49. package/es/tag/tag.d.ts +10 -0
  50. package/es/tag/tag.js +32 -2
  51. package/es/tag/tag.js.map +1 -1
  52. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,kBAAkB,EAAE,CAAC;AACrB,MAAM,OAAO,KAAM,SAAQ,iBAA4C;IAmCrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAgFpF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBAErD,OAAO;aACR;YACD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAEnC,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE;gBACnC,SAAS,EAAE,eAAe;gBAC1B,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,eAAe,E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CAAC;QACd,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio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nB,QAAQ,EAAE,KAAK;KAChB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n name: 'radio';\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio_checked', {\n eventType: 'radio_checked',\n target: this\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: RadioAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Radio.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
package/es/tag/tag.d.ts CHANGED
@@ -6,9 +6,19 @@ export declare class Tag extends AbstractComponent<Required<TagAttributes>> {
6
6
  name: string;
7
7
  private _bgRect;
8
8
  private _textShape;
9
+ private _symbol;
10
+ private _tagStates;
11
+ private _rectStates;
12
+ private _symbolStates;
13
+ private _textStates;
9
14
  getBgRect(): IRect;
10
15
  getTextShape(): IRichText | IText;
11
16
  static defaultAttributes: Partial<TagAttributes>;
12
17
  constructor(attributes: TagAttributes, options?: ComponentOptions);
13
18
  protected render(): void;
19
+ initAttributes(params: TagAttributes, options?: ComponentOptions): void;
20
+ addState(stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean): void;
21
+ removeState(stateName: string, hasAnimation?: boolean): void;
22
+ cacheStates(): void;
23
+ resetStates(): void;
14
24
  }
package/es/tag/tag.js CHANGED
@@ -29,10 +29,12 @@ export class Tag extends AbstractComponent {
29
29
  }
30
30
  constructor(attributes, options) {
31
31
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Tag.defaultAttributes, attributes)),
32
- this.name = "tag";
32
+ this.name = "tag", this._tagStates = [], this._rectStates = [], this._symbolStates = [],
33
+ this._textStates = [];
33
34
  }
34
35
  render() {
35
36
  var _a, _b, _c;
37
+ this.cacheStates();
36
38
  const {text: text = "", textStyle: textStyle = {}, shape: shape = {}, panel: panel = {}, space: space = 4, minWidth: minWidth, maxWidth: maxWidth, padding: padding = 4, visible: visible, state: state, type: type, textAlwaysCenter: textAlwaysCenter, containerTextAlign: containerTextAlign} = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", {
37
39
  x: 0,
38
40
  y: 0,
@@ -163,7 +165,35 @@ export class Tag extends AbstractComponent {
163
165
  this._bgRect = bgRect;
164
166
  }
165
167
  }
166
- this._textShape = textShape;
168
+ this._textShape = textShape, this._symbol = symbol, this.resetStates();
169
+ }
170
+ initAttributes(params, options) {
171
+ params = (null == options ? void 0 : options.skipDefault) ? params : merge({}, Tag.defaultAttributes, params),
172
+ super.initAttributes(params), this.render();
173
+ }
174
+ addState(stateName, keepCurrentStates, hasAnimation) {
175
+ super.addState(stateName, keepCurrentStates, hasAnimation), this._textShape && this._textShape.addState(stateName, keepCurrentStates, hasAnimation),
176
+ this._bgRect && this._bgRect.addState(stateName, keepCurrentStates, hasAnimation),
177
+ this._symbol && this._symbol.addState(stateName, keepCurrentStates, hasAnimation);
178
+ }
179
+ removeState(stateName, hasAnimation) {
180
+ super.removeState(stateName, hasAnimation), this._textShape && this._textShape.removeState(stateName, hasAnimation),
181
+ this._bgRect && this._bgRect.removeState(stateName, hasAnimation), this._symbol && this._symbol.removeState(stateName, hasAnimation);
182
+ }
183
+ cacheStates() {
184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
185
+ this._tagStates = null !== (_b = null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.slice()) && void 0 !== _b ? _b : [],
186
+ this._rectStates = null !== (_e = null === (_d = null === (_c = this._bgRect) || void 0 === _c ? void 0 : _c.currentStates) || void 0 === _d ? void 0 : _d.slice()) && void 0 !== _e ? _e : [],
187
+ this._symbolStates = null !== (_h = null === (_g = null === (_f = this._symbol) || void 0 === _f ? void 0 : _f.currentStates) || void 0 === _g ? void 0 : _g.slice()) && void 0 !== _h ? _h : [],
188
+ this._textStates = null !== (_l = null === (_k = null === (_j = this._textShape) || void 0 === _j ? void 0 : _j.currentStates) || void 0 === _k ? void 0 : _k.slice()) && void 0 !== _l ? _l : [],
189
+ this.clearStates(), null === (_m = this._bgRect) || void 0 === _m || _m.clearStates(),
190
+ null === (_o = this._symbol) || void 0 === _o || _o.clearStates(), null === (_p = this._textShape) || void 0 === _p || _p.clearStates();
191
+ }
192
+ resetStates() {
193
+ var _a, _b, _c;
194
+ this._tagStates.length && this.useStates(this._tagStates), this._rectStates.length && (null === (_a = this._bgRect) || void 0 === _a || _a.useStates(this._rectStates)),
195
+ this._symbolStates.length && (null === (_b = this._symbol) || void 0 === _b || _b.useStates(this._symbolStates)),
196
+ this._textStates.length && (null === (_c = this._textShape) || void 0 === _c || _c.useStates(this._textStates));
167
197
  }
168
198
  }
169
199
 
package/es/tag/tag.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tag/tag.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,OAAO,EAUL,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAGlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,gBAAgB,EAAE,CAAC;AACnB,MAAM,OAAO,GAAI,SAAQ,iBAA0C;IAMjE,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAkBD,YAAY,UAAyB,EAAE,OAA0B;QAC/D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,iBAAiB,EAAE,UAAU,CA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AAI,eAAe,CAAC,WAAW,EAAE;oBAC/B,MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;oBAChD,MAAM,CAAC,SAAS,GAAG,CAAC,KAAiC,EAAE,EAAE;wBACvD,OAAO,WAAW,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,YAAY,EAAE,CAAC,CAAC;oBACrE,CAAC,CAAC;iBACH;gBACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;aACvB;SACF;QACD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;;AAnSM,qBAAiB,GAA2B;IACjD,OAAO,EAAE,IAAI;IACb,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IAEV,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;KACb;CACF,CAAC","file":"tag.js","sourcesContent":["/**\n * @description 标签组件\n */\nimport {\n type IGroup,\n type IRect,\n type ISymbol,\n type IText,\n type ITextAttribute,\n type ITextGraphicAttribute,\n type IRichTextGraphicAttribute,\n type IRichText,\n type IGraphicAttribute,\n CustomPath2D\n} from '@visactor/vrender-core';\nimport { isBoolean, isEmpty, isNil, isNumber, isObject, isValid, merge, normalizePadding } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { isRichText, measureTextSize, richTextAttributeTransform } from '../util';\nimport type { BackgroundAttributes, ComponentOptions } from '../interface';\nimport type { TagAttributes, TagShapeAttributes } from './type';\nimport { loadTagComponent } from './register';\nimport type { TextContent } from '../core/type';\n\nloadTagComponent();\nexport class Tag extends AbstractComponent<Required<TagAttributes>> {\n name = 'tag';\n\n private _bgRect!: IRect;\n private _textShape!: IText | IRichText;\n\n getBgRect() {\n return this._bgRect;\n }\n\n getTextShape() {\n return this._textShape;\n }\n\n static defaultAttributes: Partial<TagAttributes> = {\n visible: true,\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n space: 4,\n padding: 4,\n // @ts-ignore\n shape: {\n fill: '#000'\n }\n };\n\n constructor(attributes: TagAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Tag.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n text = '',\n textStyle = {} as ITextGraphicAttribute | IRichTextGraphicAttribute,\n shape = {} as TagShapeAttributes,\n panel = {} as BackgroundAttributes,\n space = 4,\n minWidth,\n maxWidth,\n padding = 4,\n visible,\n state,\n type,\n textAlwaysCenter,\n containerTextAlign\n } = this.attribute as TagAttributes;\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n let symbol;\n let tagWidth = parsedPadding[1] + parsedPadding[3];\n let tagHeight = parsedPadding[0] + parsedPadding[2];\n let textX = 0;\n let symbolPlaceWidth = 0;\n const { visible: shapeVisible, ...shapeStyle } = shape;\n if (isBoolean(shapeVisible)) {\n const size = shapeStyle?.size || 10;\n const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1])) as number;\n\n symbol = group.createOrUpdateChild(\n 'tag-shape',\n {\n symbolType: 'circle',\n size,\n strokeBoundsBuffer: 0,\n ...shapeStyle,\n visible: shapeVisible,\n x: maxSize / 2,\n y: maxSize / 2\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.shape)) {\n symbol.states = state.shape;\n }\n\n if (shapeVisible) {\n symbolPlaceWidth = maxSize + space;\n }\n }\n\n tagWidth += symbolPlaceWidth;\n textX += symbolPlaceWidth;\n\n let textShape: IRichText | IText;\n const isRich = isRichText({ text } as TextContent) || type === 'rich';\n if (isRich) {\n const richTextAttrs = {\n ...richTextAttributeTransform({ type, text, ...textStyle } as any),\n ...(textStyle as IRichTextGraphicAttribute),\n visible: isValid(text) && visible !== false,\n x: textX,\n y: 0\n };\n textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext') as IRichText;\n\n // 绘制背景层\n const { visible: bgVisible, ...backgroundStyle } = panel;\n if (visible && isBoolean(bgVisible)) {\n const bgRect = this.createOrUpdateChild(\n 'tag-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && !!text,\n x: textShape.AABBBounds.x1,\n y: textShape.AABBBounds.y1,\n width: textShape.AABBBounds.width(),\n height: textShape.AABBBounds.height()\n },\n 'rect'\n ) as IRect;\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n if (backgroundStyle.customShape) {\n const customShape = backgroundStyle.customShape;\n bgRect.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return customShape(textShape.attribute, attrs, new CustomPath2D());\n };\n }\n this._bgRect = bgRect;\n }\n } else {\n const textAttrs = {\n text: isObject(text) && 'type' in text && text.type === 'text' ? text.text : text,\n visible: isValid(text) && visible !== false,\n lineHeight: (textStyle as ITextGraphicAttribute)?.fontSize,\n ...(textStyle as ITextGraphicAttribute),\n x: textX,\n y: 0\n };\n if (isNil(textAttrs.lineHeight)) {\n textAttrs.lineHeight = (textStyle as ITextGraphicAttribute).fontSize;\n }\n textShape = group.createOrUpdateChild('tag-text', textAttrs as ITextGraphicAttribute, 'text') as IText;\n if (!isEmpty(state?.text)) {\n textShape.states = state.text;\n }\n\n // 因为文本可能发生旋转,所以需要使用 measureTextSize 方法\n const textBounds = measureTextSize(textAttrs.text as string, textStyle, this.stage?.getTheme()?.text);\n const textWidth = textBounds.width;\n const textHeight = textBounds.height;\n tagWidth += textWidth;\n const size = shape.size ?? 10;\n const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1])) as number;\n tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);\n\n const { textAlign, textBaseline } = textStyle as ITextAttribute;\n\n if (isValid(minWidth) || isValid(maxWidth)) {\n if (isValid(minWidth) && tagWidth < minWidth) {\n tagWidth = minWidth;\n }\n if (isValid(maxWidth) && tagWidth > maxWidth) {\n tagWidth = maxWidth;\n textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);\n }\n }\n\n let x = 0;\n let y = 0;\n let flag = 0;\n if (textAlign === 'left' || textAlign === 'start') {\n flag = 1;\n } else if (textAlign === 'right' || textAlign === 'end') {\n flag = -1;\n } else if (textAlign === 'center') {\n flag = 0;\n }\n if (!flag) {\n x -= tagWidth / 2;\n if (symbol) {\n symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);\n }\n\n group.setAttribute('x', -symbolPlaceWidth / 2);\n } else if (flag < 0) {\n x -= tagWidth;\n if (symbol) {\n symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);\n }\n\n group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);\n } else if (flag > 0) {\n group.setAttribute('x', parsedPadding[3]);\n }\n\n const shouldCenter = containerTextAlign ? containerTextAlign === 'center' : textAlwaysCenter;\n const shouldRight = containerTextAlign === 'right' || containerTextAlign === 'end';\n const shouldLeft = containerTextAlign === 'left' || containerTextAlign === 'start';\n\n if (shouldCenter && flag) {\n // 文本容器内居中\n // 剔除padding后的内宽度\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const tsWidth = textWidth + symbolPlaceWidth;\n const textX =\n flag === 1\n ? (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2\n : parsedPadding[0] + symbolPlaceWidth - (tagWidth / 2 + tsWidth / 2 - symbolPlaceWidth) + textWidth / 2;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'center'\n });\n if (symbol) {\n const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (shouldLeft && flag !== 1) {\n // 文本容器内朝左展示\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const offset =\n flag === 0\n ? -containerWidth / 2 + symbolPlaceWidth / 2\n : -tagWidth + parsedPadding[3] + parsedPadding[1] + symbolPlaceWidth;\n const textX = offset + symbolPlaceWidth;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'left'\n });\n\n if (symbol) {\n const symbolX = offset + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (shouldRight && flag !== -1) {\n // 文本容器内朝右展示\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const textX = flag === 0 ? containerWidth / 2 + symbolPlaceWidth / 2 : containerWidth;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'right'\n });\n if (symbol) {\n const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (textBaseline === 'middle') {\n y -= tagHeight / 2;\n if (symbol) {\n symbol.setAttribute('y', 0);\n }\n } else if (textBaseline === 'bottom') {\n y -= tagHeight;\n if (symbol) {\n symbol.setAttribute('y', -textHeight / 2);\n }\n\n group.setAttribute('y', -parsedPadding[2]);\n } else if (textBaseline === 'top') {\n group.setAttribute('y', parsedPadding[0]);\n if (symbol) {\n symbol.setAttribute('y', textHeight / 2);\n }\n }\n\n // 绘制背景层\n const { visible: bgVisible, ...backgroundStyle } = panel;\n if (visible && isBoolean(bgVisible)) {\n const bgRect = this.createOrUpdateChild(\n 'tag-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && !!text,\n x,\n y,\n width: tagWidth,\n height: tagHeight\n },\n 'rect'\n ) as IRect;\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n if (backgroundStyle.customShape) {\n const customShape = backgroundStyle.customShape;\n bgRect.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return customShape(textShape.attribute, attrs, new CustomPath2D());\n };\n }\n this._bgRect = bgRect;\n }\n }\n this._textShape = textShape;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/tag/tag.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,OAAO,EAUL,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OA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E,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA,CAAC;IAC1E,CAAC;;AAxVM,qBAAiB,GAA2B;IACjD,OAAO,EAAE,IAAI;IACb,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IAEV,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;KACb;CACF,CAAC","file":"tag.js","sourcesContent":["/**\n * @description 标签组件\n */\nimport {\n type IGroup,\n type IRect,\n type ISymbol,\n type IText,\n type ITextAttribute,\n type ITextGraphicAttribute,\n type IRichTextGraphicAttribute,\n type IRichText,\n type IGraphicAttribute,\n CustomPath2D\n} from '@visactor/vrender-core';\nimport { isBoolean, isEmpty, isNil, isNumber, isObject, isValid, merge, normalizePadding } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { isRichText, measureTextSize, richTextAttributeTransform } from '../util';\nimport type { BackgroundAttributes, ComponentOptions } from '../interface';\nimport type { TagAttributes, TagShapeAttributes } from './type';\nimport { loadTagComponent } from './register';\nimport type { TextContent } from '../core/type';\n\nloadTagComponent();\nexport class Tag extends AbstractComponent<Required<TagAttributes>> {\n name = 'tag';\n\n private _bgRect!: IRect;\n private _textShape!: IText | IRichText;\n private _symbol!: ISymbol;\n private _tagStates: string[] = [];\n private _rectStates: string[] = [];\n private _symbolStates: string[] = [];\n private _textStates: string[] = [];\n\n getBgRect() {\n return this._bgRect;\n }\n\n getTextShape() {\n return this._textShape;\n }\n\n static defaultAttributes: Partial<TagAttributes> = {\n visible: true,\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n space: 4,\n padding: 4,\n // @ts-ignore\n shape: {\n fill: '#000'\n }\n };\n\n constructor(attributes: TagAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Tag.defaultAttributes, attributes));\n }\n\n protected render() {\n this.cacheStates();\n const {\n text = '',\n textStyle = {} as ITextGraphicAttribute | IRichTextGraphicAttribute,\n shape = {} as TagShapeAttributes,\n panel = {} as BackgroundAttributes,\n space = 4,\n minWidth,\n maxWidth,\n padding = 4,\n visible,\n state,\n type,\n textAlwaysCenter,\n containerTextAlign\n } = this.attribute as TagAttributes;\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n let symbol;\n let tagWidth = parsedPadding[1] + parsedPadding[3];\n let tagHeight = parsedPadding[0] + parsedPadding[2];\n let textX = 0;\n let symbolPlaceWidth = 0;\n const { visible: shapeVisible, ...shapeStyle } = shape;\n if (isBoolean(shapeVisible)) {\n const size = shapeStyle?.size || 10;\n const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1])) as number;\n\n symbol = group.createOrUpdateChild(\n 'tag-shape',\n {\n symbolType: 'circle',\n size,\n strokeBoundsBuffer: 0,\n ...shapeStyle,\n visible: shapeVisible,\n x: maxSize / 2,\n y: maxSize / 2\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.shape)) {\n symbol.states = state.shape;\n }\n\n if (shapeVisible) {\n symbolPlaceWidth = maxSize + space;\n }\n }\n\n tagWidth += symbolPlaceWidth;\n textX += symbolPlaceWidth;\n\n let textShape: IRichText | IText;\n const isRich = isRichText({ text } as TextContent) || type === 'rich';\n if (isRich) {\n const richTextAttrs = {\n ...richTextAttributeTransform({ type, text, ...textStyle } as any),\n ...(textStyle as IRichTextGraphicAttribute),\n visible: isValid(text) && visible !== false,\n x: textX,\n y: 0\n };\n textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext') as IRichText;\n\n // 绘制背景层\n const { visible: bgVisible, ...backgroundStyle } = panel;\n if (visible && isBoolean(bgVisible)) {\n const bgRect = this.createOrUpdateChild(\n 'tag-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && !!text,\n x: textShape.AABBBounds.x1,\n y: textShape.AABBBounds.y1,\n width: textShape.AABBBounds.width(),\n height: textShape.AABBBounds.height()\n },\n 'rect'\n ) as IRect;\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n if (backgroundStyle.customShape) {\n const customShape = backgroundStyle.customShape;\n bgRect.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return customShape(textShape.attribute, attrs, new CustomPath2D());\n };\n }\n this._bgRect = bgRect;\n }\n } else {\n const textAttrs = {\n text: isObject(text) && 'type' in text && text.type === 'text' ? text.text : text,\n visible: isValid(text) && visible !== false,\n lineHeight: (textStyle as ITextGraphicAttribute)?.fontSize,\n ...(textStyle as ITextGraphicAttribute),\n x: textX,\n y: 0\n };\n if (isNil(textAttrs.lineHeight)) {\n textAttrs.lineHeight = (textStyle as ITextGraphicAttribute).fontSize;\n }\n textShape = group.createOrUpdateChild('tag-text', textAttrs as ITextGraphicAttribute, 'text') as IText;\n if (!isEmpty(state?.text)) {\n textShape.states = state.text;\n }\n\n // 因为文本可能发生旋转,所以需要使用 measureTextSize 方法\n const textBounds = measureTextSize(textAttrs.text as string, textStyle, this.stage?.getTheme()?.text);\n const textWidth = textBounds.width;\n const textHeight = textBounds.height;\n tagWidth += textWidth;\n const size = shape.size ?? 10;\n const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1])) as number;\n tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);\n\n const { textAlign, textBaseline } = textStyle as ITextAttribute;\n\n if (isValid(minWidth) || isValid(maxWidth)) {\n if (isValid(minWidth) && tagWidth < minWidth) {\n tagWidth = minWidth;\n }\n if (isValid(maxWidth) && tagWidth > maxWidth) {\n tagWidth = maxWidth;\n textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);\n }\n }\n\n let x = 0;\n let y = 0;\n let flag = 0;\n if (textAlign === 'left' || textAlign === 'start') {\n flag = 1;\n } else if (textAlign === 'right' || textAlign === 'end') {\n flag = -1;\n } else if (textAlign === 'center') {\n flag = 0;\n }\n if (!flag) {\n x -= tagWidth / 2;\n if (symbol) {\n symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);\n }\n\n group.setAttribute('x', -symbolPlaceWidth / 2);\n } else if (flag < 0) {\n x -= tagWidth;\n if (symbol) {\n symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);\n }\n\n group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);\n } else if (flag > 0) {\n group.setAttribute('x', parsedPadding[3]);\n }\n\n const shouldCenter = containerTextAlign ? containerTextAlign === 'center' : textAlwaysCenter;\n const shouldRight = containerTextAlign === 'right' || containerTextAlign === 'end';\n const shouldLeft = containerTextAlign === 'left' || containerTextAlign === 'start';\n\n if (shouldCenter && flag) {\n // 文本容器内居中\n // 剔除padding后的内宽度\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const tsWidth = textWidth + symbolPlaceWidth;\n const textX =\n flag === 1\n ? (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2\n : parsedPadding[0] + symbolPlaceWidth - (tagWidth / 2 + tsWidth / 2 - symbolPlaceWidth) + textWidth / 2;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'center'\n });\n if (symbol) {\n const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (shouldLeft && flag !== 1) {\n // 文本容器内朝左展示\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const offset =\n flag === 0\n ? -containerWidth / 2 + symbolPlaceWidth / 2\n : -tagWidth + parsedPadding[3] + parsedPadding[1] + symbolPlaceWidth;\n const textX = offset + symbolPlaceWidth;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'left'\n });\n\n if (symbol) {\n const symbolX = offset + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (shouldRight && flag !== -1) {\n // 文本容器内朝右展示\n const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];\n const textX = flag === 0 ? containerWidth / 2 + symbolPlaceWidth / 2 : containerWidth;\n\n textShape.setAttributes({\n x: textX,\n textAlign: 'right'\n });\n if (symbol) {\n const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;\n symbol.setAttributes({\n x: symbolX\n });\n }\n }\n\n if (textBaseline === 'middle') {\n y -= tagHeight / 2;\n if (symbol) {\n symbol.setAttribute('y', 0);\n }\n } else if (textBaseline === 'bottom') {\n y -= tagHeight;\n if (symbol) {\n symbol.setAttribute('y', -textHeight / 2);\n }\n\n group.setAttribute('y', -parsedPadding[2]);\n } else if (textBaseline === 'top') {\n group.setAttribute('y', parsedPadding[0]);\n if (symbol) {\n symbol.setAttribute('y', textHeight / 2);\n }\n }\n\n // 绘制背景层\n const { visible: bgVisible, ...backgroundStyle } = panel;\n if (visible && isBoolean(bgVisible)) {\n const bgRect = this.createOrUpdateChild(\n 'tag-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && !!text,\n x,\n y,\n width: tagWidth,\n height: tagHeight\n },\n 'rect'\n ) as IRect;\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n if (backgroundStyle.customShape) {\n const customShape = backgroundStyle.customShape;\n bgRect.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return customShape(textShape.attribute, attrs, new CustomPath2D());\n };\n }\n this._bgRect = bgRect;\n }\n }\n this._textShape = textShape;\n this._symbol = symbol;\n\n this.resetStates();\n }\n\n initAttributes(params: TagAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Tag.defaultAttributes, params);\n super.initAttributes(params);\n this.render();\n }\n\n addState(stateName: string, keepCurrentStates?: boolean, hasAnimation?: boolean): void {\n super.addState(stateName, keepCurrentStates, hasAnimation);\n if (this._textShape) {\n this._textShape.addState(stateName, keepCurrentStates, hasAnimation);\n }\n if (this._bgRect) {\n this._bgRect.addState(stateName, keepCurrentStates, hasAnimation);\n }\n if (this._symbol) {\n this._symbol.addState(stateName, keepCurrentStates, hasAnimation);\n }\n }\n\n removeState(stateName: string, hasAnimation?: boolean): void {\n super.removeState(stateName, hasAnimation);\n if (this._textShape) {\n this._textShape.removeState(stateName, hasAnimation);\n }\n if (this._bgRect) {\n this._bgRect.removeState(stateName, hasAnimation);\n }\n if (this._symbol) {\n this._symbol.removeState(stateName, hasAnimation);\n }\n }\n\n cacheStates() {\n this._tagStates = this.currentStates?.slice() ?? [];\n this._rectStates = this._bgRect?.currentStates?.slice() ?? [];\n this._symbolStates = this._symbol?.currentStates?.slice() ?? [];\n this._textStates = this._textShape?.currentStates?.slice() ?? [];\n this.clearStates();\n this._bgRect?.clearStates();\n this._symbol?.clearStates();\n this._textShape?.clearStates();\n }\n resetStates() {\n this._tagStates.length && this.useStates(this._tagStates);\n this._rectStates.length && this._bgRect?.useStates(this._rectStates);\n this._symbolStates.length && this._symbol?.useStates(this._symbolStates);\n this._textStates.length && this._textShape?.useStates(this._textStates);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.20.1-alpha.6",
3
+ "version": "0.20.1-alpha.7",
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.20.1-alpha.6",
16
- "@visactor/vrender-kits": "0.20.1-alpha.6",
15
+ "@visactor/vrender-core": "0.20.1-alpha.7",
16
+ "@visactor/vrender-kits": "0.20.1-alpha.7",
17
17
  "@visactor/vutils": "~0.18.14",
18
18
  "@visactor/vscale": "~0.18.14"
19
19
  },
@@ -30,8 +30,8 @@
30
30
  "typescript": "4.9.5",
31
31
  "cross-env": "^7.0.3",
32
32
  "@internal/bundler": "0.0.1",
33
- "@internal/ts-config": "0.0.1",
34
- "@internal/eslint-config": "0.0.1"
33
+ "@internal/eslint-config": "0.0.1",
34
+ "@internal/ts-config": "0.0.1"
35
35
  },
36
36
  "keywords": [
37
37
  "VisActor",