@visactor/vgrammar-core 0.9.0-alpha.0 → 0.9.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.
@@ -7,40 +7,45 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), enums_1 = require("../graph/enums"), component_1 = require("../view/component"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), generateLabelAttributes = (marks, groupSize, encoder, labelStyle, parameters, theme) => {
8
8
  var _a;
9
9
  const labelTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.dataLabel, dataLabels = marks.map(((mark, index) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
11
11
  const labelParameters = Object.assign(Object.assign({}, parameters), {
12
12
  labelIndex: index
13
- });
13
+ }), addition = (0, util_1.invokeFunctionType)(labelStyle, labelParameters, mark);
14
14
  let currentTheme = {};
15
15
  switch (mark.markType) {
16
16
  case enums_1.GrammarMarkType.line:
17
17
  case enums_1.GrammarMarkType.area:
18
- currentTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.lineDataLabel;
18
+ currentTheme = "line" === (null == addition ? void 0 : addition.type) ? null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.lineLabel : "area" === (null == addition ? void 0 : addition.type) ? null === (_b = null == theme ? void 0 : theme.components) || void 0 === _b ? void 0 : _b.areaLabel : null === (_c = null == theme ? void 0 : theme.components) || void 0 === _c ? void 0 : _c.lineDataLabel;
19
19
  break;
20
20
 
21
21
  case enums_1.GrammarMarkType.rect:
22
22
  case enums_1.GrammarMarkType.interval:
23
- currentTheme = null === (_b = null == theme ? void 0 : theme.components) || void 0 === _b ? void 0 : _b.rectLabel;
23
+ currentTheme = null === (_d = null == theme ? void 0 : theme.components) || void 0 === _d ? void 0 : _d.rectLabel;
24
24
  break;
25
25
 
26
26
  case enums_1.GrammarMarkType.symbol:
27
27
  case enums_1.GrammarMarkType.circle:
28
28
  case enums_1.GrammarMarkType.cell:
29
- currentTheme = null === (_c = null == theme ? void 0 : theme.components) || void 0 === _c ? void 0 : _c.symbolLabel;
29
+ currentTheme = null === (_e = null == theme ? void 0 : theme.components) || void 0 === _e ? void 0 : _e.symbolLabel;
30
30
  break;
31
31
 
32
32
  case enums_1.GrammarMarkType.arc:
33
33
  case enums_1.GrammarMarkType.arc3d:
34
- currentTheme = null === (_d = null == theme ? void 0 : theme.components) || void 0 === _d ? void 0 : _d.arcLabel;
34
+ currentTheme = null === (_f = null == theme ? void 0 : theme.components) || void 0 === _f ? void 0 : _f.arcLabel;
35
35
  break;
36
36
 
37
37
  case enums_1.GrammarMarkType.polygon:
38
38
  case enums_1.GrammarMarkType.path:
39
39
  default:
40
- currentTheme = null === (_e = null == theme ? void 0 : theme.components) || void 0 === _e ? void 0 : _e.pointLabel;
40
+ currentTheme = null === (_g = null == theme ? void 0 : theme.components) || void 0 === _g ? void 0 : _g.pointLabel;
41
41
  }
42
- const data = [], themeDatum = null !== (_g = null === (_f = null == currentTheme ? void 0 : currentTheme.data) || void 0 === _f ? void 0 : _f[0]) && void 0 !== _g ? _g : {};
43
- mark.elements.forEach((element => {
42
+ const data = null !== (_h = null == addition ? void 0 : addition.data) && void 0 !== _h ? _h : [], themeDatum = null !== (_k = null === (_j = null == currentTheme ? void 0 : currentTheme.data) || void 0 === _j ? void 0 : _j[0]) && void 0 !== _k ? _k : {};
43
+ data && data.length > 0 ? data.forEach(((d, index) => {
44
+ if (mark.elements[index]) {
45
+ const attributes = (0, encode_1.invokeEncoder)(encoder, d, mark.elements[index], labelParameters);
46
+ (0, vutils_1.merge)(d, themeDatum, attributes);
47
+ }
48
+ })) : mark.elements.forEach((element => {
44
49
  if ("willRelease" !== element.getGraphicItem().releaseStatus) if (mark.isCollectionMark()) {
45
50
  element.getDatum().forEach((entry => {
46
51
  const attributes = (0, encode_1.invokeEncoder)(encoder, entry, element, labelParameters);
@@ -52,7 +57,7 @@ const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@v
52
57
  data.push(datum);
53
58
  }
54
59
  }));
55
- const addition = (0, util_1.invokeFunctionType)(labelStyle, labelParameters, mark), graphicItemName = null === (_h = mark.graphicItem) || void 0 === _h ? void 0 : _h.name;
60
+ const graphicItemName = null === (_l = mark.graphicItem) || void 0 === _l ? void 0 : _l.name;
56
61
  return (0, vutils_1.merge)({}, currentTheme, {
57
62
  data: data,
58
63
  baseMarkGroupName: graphicItemName,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/label.ts"],"names":[],"mappings":";;;AAAA,6CAAiE;AAIjE,qEAAyD;AAYzD,0CAAgE;AAEhE,iDAA8C;AAC9C,iDAAqD;AACrD,wCAAmD;AACnD,6CAA0C;AAEnC,MAAM,uBAAuB,GAAG,CACrC,KAAc,EACd,SAA4C,EAC5C,OAA6B,EAC7B,UAAqD,EACrD,UAAe,EACf,KAAc,EACE,EAAE;;IAClB,MAAM,UAAU,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,SAAS,CAAC;IAChD,MAAM,UAAU,GAAG,KAAK;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;;QACnB,MAAM,eAAe,mCAAQ,UAAU,KAAE,UAAU,EAAE,KAAK,GAAE,CAAC;QAC7D,IAAI,YAAY,GAAQ,EAAE,CAAC;QAC3B,QAAQ,IAAI,CAAC,QAAQ,EAAE;YACrB,KAAK,uBAAe,CAAC,IAAI,CAAC;YAC1B,KAAK,uBAAe,CAAC,IAAI;gBACvB,YAAY,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,aAAa,CAAC;gBAChD,MAAM;YACR,KAAK,uBAAe,CAAC,IAAI,CAAC;YAC1B,KAA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AAC,CAAC;oCACE,KAAK,EAAE,MAAA,gBAAgB,CAAC,SAAS,CAAC,KAAK,mCAAI,gBAAgB,CAAC,UAAU,CAAC,KAAK,EAAE;oCAC9E,MAAM,EAAE,MAAA,gBAAgB,CAAC,SAAS,CAAC,MAAM,mCAAI,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE;iCAClF;gCACH,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;yBAC3C;wBAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;wBAEvE,OAAO,IAAA,+BAAuB,EAC5B,KAAK,EACL,IAAI,EACJ,OAA+B,EAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EACpB,UAAU,EACV,KAAK,CACN,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACrC,CAAC;;AA1EH,sBA2EC;AA1EiB,mBAAa,GAAW,qBAAa,CAAC,KAAK,CAAC;AA4EvD,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,iBAAO,CAAC,wBAAwB,CAC9B,qBAAa,CAAC,KAAK,EACnB,CAAC,KAAqB,EAAE,EAAE,CAAC,IAAI,8BAAS,CAAC,KAAK,CAAwB,CACvE,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB","file":"label.js","sourcesContent":["import { array, isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DataLabel } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum, GrammarMarkType } from '../graph/enums';\nimport type { ILabel, LabelSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateLabelAttributes = (\n marks: IMark[],\n groupSize: { width: number; height: number },\n encoder: BaseSignleEncodeSpec,\n labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>,\n parameters: any,\n theme?: ITheme\n): DataLabelAttrs => {\n const labelTheme = theme?.components?.dataLabel;\n const dataLabels = marks\n .map((mark, index) => {\n const labelParameters = { ...parameters, labelIndex: index };\n let currentTheme: any = {};\n switch (mark.markType) {\n case GrammarMarkType.line:\n case GrammarMarkType.area:\n currentTheme = theme?.components?.lineDataLabel;\n break;\n case GrammarMarkType.rect:\n case GrammarMarkType.interval:\n currentTheme = theme?.components?.rectLabel;\n break;\n case GrammarMarkType.symbol:\n case GrammarMarkType.circle:\n case GrammarMarkType.cell:\n currentTheme = theme?.components?.symbolLabel;\n break;\n case GrammarMarkType.arc:\n case GrammarMarkType.arc3d:\n currentTheme = theme?.components?.arcLabel;\n break;\n case GrammarMarkType.polygon:\n case GrammarMarkType.path:\n default:\n currentTheme = theme?.components?.pointLabel;\n break;\n }\n const data: any[] = [];\n const themeDatum = currentTheme?.data?.[0] ?? {};\n // process by order of elements\n mark.elements.forEach(element => {\n const graphicItem = element.getGraphicItem();\n if ((graphicItem as any).releaseStatus !== 'willRelease') {\n if (mark.isCollectionMark()) {\n const datum = element.getDatum();\n\n datum.forEach((entry: any) => {\n const attributes = invokeEncoder(encoder, entry, element, labelParameters);\n data.push(merge({}, themeDatum, attributes));\n });\n } else {\n const attributes = invokeEncoder(encoder, element.getDatum(), element, labelParameters);\n const datum = merge({}, themeDatum, attributes);\n data.push(datum);\n }\n }\n });\n const addition = invokeFunctionType(labelStyle, labelParameters, mark);\n const graphicItemName = mark.graphicItem?.name;\n return merge(\n {},\n currentTheme,\n {\n data,\n baseMarkGroupName: graphicItemName,\n // FIXME: hack\n // 标签是对数据顺序有强要求的场景,因为顺序会影响标签躲避结果;而目前没有机制保证 vrender 图元顺序与数据顺序一致。\n // 这里目前只能通过自定义方法来 hack\n getBaseMarks: () => mark.elements.map(element => element.getGraphicItem())\n },\n addition ?? {}\n );\n })\n .filter(label => !isNil(label));\n\n return merge({}, labelTheme, { size: groupSize, dataLabels });\n};\n\nexport class Label extends Component implements ILabel {\n static readonly componentType: string = ComponentEnum.label;\n protected declare spec: LabelSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.label, group);\n this.spec.componentType = ComponentEnum.label;\n }\n\n protected parseAddition(spec: LabelSpec) {\n super.parseAddition(spec);\n this.labelStyle(spec.labelStyle);\n this.size(spec.size);\n this.target(spec.target);\n return this;\n }\n\n labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>) {\n return this.setFunctionSpec(style, 'labelStyle');\n }\n\n size(size: LabelSpec['size']) {\n return this.setFunctionSpec(size, 'size');\n }\n\n target(mark: IMark | IMark[] | string | string[] | Nil): this {\n if (this.spec.target) {\n const prevMarks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.detach(prevMarks);\n }\n this.spec.target = mark;\n if (mark) {\n const nextMarks = array(mark).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.attach(nextMarks);\n }\n this.commit();\n return this;\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const marks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n const groupGraphicItem = this.group?.getGroupGraphicItem?.();\n let size = invokeFunctionType(this.spec.size, parameters);\n if (!size) {\n size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: Infinity, height: Infinity };\n }\n\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n\n return generateLabelAttributes(\n marks,\n size,\n encoder as BaseSignleEncodeSpec,\n this.spec.labelStyle,\n parameters,\n theme\n );\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerLabel = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.label,\n (attrs: DataLabelAttrs) => new DataLabel(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.label, Label);\n};\n"]}
1
+ {"version":3,"sources":["../src/component/label.ts"],"names":[],"mappings":";;;AACA,6CAAuE;AAIvE,qEAAyD;AAYzD,0CAAgE;AAEhE,iDAA8C;AAC9C,iDAAqD;AACrD,wCAAmD;AACnD,6CAA0C;AAEnC,MAAM,uBAAuB,GAAG,CACrC,KAAc,EACd,SAA4C,EAC5C,OAA6B,EAC7B,UAAqD,EACrD,UAAe,EACf,KAAc,EACE,EAAE;;IAClB,MAAM,UAAU,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,SAAS,CAAC;IAChD,MAAM,UAAU,GAAG,KAAK;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;;QACnB,MAAM,eAAe,mCAAQ,UAAU,KAAE,UAAU,EAAE,KAAK,GAAE,CAAC;QAC7D,MAAM,QAAQ,GAAG,IAAA,yBAAkB,EAAC,UAAU,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;QACvE,IAAI,YAAY,GAAQ,EAAE,CAAC;QAE3B,QAAQ,IAAI,CAAC,QAAQ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CACH,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;yBAC3C;wBAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;wBAEvE,OAAO,IAAA,+BAAuB,EAC5B,KAAK,EACL,IAAI,EACJ,OAA+B,EAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EACpB,UAAU,EACV,KAAK,CACN,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACrC,CAAC;;AA1EH,sBA2EC;AA1EiB,mBAAa,GAAW,qBAAa,CAAC,KAAK,CAAC;AA4EvD,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,iBAAO,CAAC,wBAAwB,CAC9B,qBAAa,CAAC,KAAK,EACnB,CAAC,KAAqB,EAAE,EAAE,CAAC,IAAI,8BAAS,CAAC,KAAK,CAAwB,CACvE,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB","file":"label.js","sourcesContent":["import { load } from './../util/data';\nimport { array, isNil, isString, merge, last } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DataLabel } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum, GrammarMarkType } from '../graph/enums';\nimport type { ILabel, LabelSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateLabelAttributes = (\n marks: IMark[],\n groupSize: { width: number; height: number },\n encoder: BaseSignleEncodeSpec,\n labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>,\n parameters: any,\n theme?: ITheme\n): DataLabelAttrs => {\n const labelTheme = theme?.components?.dataLabel;\n const dataLabels = marks\n .map((mark, index) => {\n const labelParameters = { ...parameters, labelIndex: index };\n const addition = invokeFunctionType(labelStyle, labelParameters, mark);\n let currentTheme: any = {};\n\n switch (mark.markType) {\n case GrammarMarkType.line:\n case GrammarMarkType.area:\n if (addition?.type === 'line') {\n currentTheme = theme?.components?.lineLabel;\n } else if (addition?.type === 'area') {\n currentTheme = theme?.components?.areaLabel;\n } else {\n currentTheme = theme?.components?.lineDataLabel;\n }\n break;\n case GrammarMarkType.rect:\n case GrammarMarkType.interval:\n currentTheme = theme?.components?.rectLabel;\n break;\n case GrammarMarkType.symbol:\n case GrammarMarkType.circle:\n case GrammarMarkType.cell:\n currentTheme = theme?.components?.symbolLabel;\n break;\n case GrammarMarkType.arc:\n case GrammarMarkType.arc3d:\n currentTheme = theme?.components?.arcLabel;\n break;\n case GrammarMarkType.polygon:\n case GrammarMarkType.path:\n default:\n currentTheme = theme?.components?.pointLabel;\n break;\n }\n\n const data: any[] = addition?.data ?? [];\n const themeDatum = currentTheme?.data?.[0] ?? {};\n\n if (data && data.length > 0) {\n data.forEach((d, index) => {\n if (mark.elements[index]) {\n const attributes = invokeEncoder(encoder, d, mark.elements[index], labelParameters);\n merge(d, themeDatum, attributes);\n }\n });\n } else {\n // process by order of elements\n mark.elements.forEach(element => {\n const graphicItem = element.getGraphicItem();\n if ((graphicItem as any).releaseStatus !== 'willRelease') {\n if (mark.isCollectionMark()) {\n const datum = element.getDatum();\n\n datum.forEach((entry: any) => {\n const attributes = invokeEncoder(encoder, entry, element, labelParameters);\n data.push(merge({}, themeDatum, attributes));\n });\n } else {\n const attributes = invokeEncoder(encoder, element.getDatum(), element, labelParameters);\n const datum = merge({}, themeDatum, attributes);\n data.push(datum);\n }\n }\n });\n }\n\n const graphicItemName = mark.graphicItem?.name;\n return merge(\n {},\n currentTheme,\n {\n data,\n baseMarkGroupName: graphicItemName,\n // FIXME: hack\n // 标签是对数据顺序有强要求的场景,因为顺序会影响标签躲避结果;而目前没有机制保证 vrender 图元顺序与数据顺序一致。\n // 这里目前只能通过自定义方法来 hack\n getBaseMarks: () => mark.elements.map(element => element.getGraphicItem())\n },\n addition ?? {}\n );\n })\n .filter(label => !isNil(label));\n\n return merge({}, labelTheme, { size: groupSize, dataLabels });\n};\n\nexport class Label extends Component implements ILabel {\n static readonly componentType: string = ComponentEnum.label;\n protected declare spec: LabelSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.label, group);\n this.spec.componentType = ComponentEnum.label;\n }\n\n protected parseAddition(spec: LabelSpec) {\n super.parseAddition(spec);\n this.labelStyle(spec.labelStyle);\n this.size(spec.size);\n this.target(spec.target);\n return this;\n }\n\n labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>) {\n return this.setFunctionSpec(style, 'labelStyle');\n }\n\n size(size: LabelSpec['size']) {\n return this.setFunctionSpec(size, 'size');\n }\n\n target(mark: IMark | IMark[] | string | string[] | Nil): this {\n if (this.spec.target) {\n const prevMarks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.detach(prevMarks);\n }\n this.spec.target = mark;\n if (mark) {\n const nextMarks = array(mark).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.attach(nextMarks);\n }\n this.commit();\n return this;\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const marks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n const groupGraphicItem = this.group?.getGroupGraphicItem?.();\n let size = invokeFunctionType(this.spec.size, parameters);\n if (!size) {\n size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: Infinity, height: Infinity };\n }\n\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n\n return generateLabelAttributes(\n marks,\n size,\n encoder as BaseSignleEncodeSpec,\n this.spec.labelStyle,\n parameters,\n theme\n );\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerLabel = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.label,\n (attrs: DataLabelAttrs) => new DataLabel(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.label, Label);\n};\n"]}
@@ -38,13 +38,13 @@ function getRulePoints(nextAttrs) {
38
38
  function getLinePoints(items, includeOnePoint, lastPoints, isArea) {
39
39
  if (!items || !items.length || 1 === items.length && includeOnePoint) return [];
40
40
  return items.some((item => isValidPointsChannel(Object.keys(item.nextAttrs), "line"))) ? items.map(((item, index) => {
41
- var _a, _b, _c, _d, _e, _f;
41
+ var _a, _b, _c, _d, _e;
42
42
  const attrs = item.nextAttrs;
43
43
  return (0, vutils_1.isNil)(attrs.x) && (attrs.x = null === (_a = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _a ? void 0 : _a.x),
44
44
  (0, vutils_1.isNil)(attrs.y) && (attrs.y = null === (_b = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _b ? void 0 : _b.y),
45
- (0, vutils_1.isNil)(attrs.defined) && !1 === (null === (_c = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _c ? void 0 : _c.defined) && (attrs.defined = null === (_d = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _d ? void 0 : _d.defined),
46
- attrs.context = item.key, isArea && ((0, vutils_1.isNil)(attrs.x1) && (attrs.x1 = null === (_e = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _e ? void 0 : _e.x1),
47
- (0, vutils_1.isNil)(attrs.y1) && (attrs.y1 = null === (_f = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _f ? void 0 : _f.y1)),
45
+ (0, vutils_1.isNil)(attrs.defined) && !1 === (null === (_c = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _c ? void 0 : _c.defined) && (attrs.defined = !1),
46
+ attrs.context = item.key, isArea && ((0, vutils_1.isNil)(attrs.x1) && (attrs.x1 = null === (_d = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _d ? void 0 : _d.x1),
47
+ (0, vutils_1.isNil)(attrs.y1) && (attrs.y1 = null === (_e = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _e ? void 0 : _e.y1)),
48
48
  attrs;
49
49
  })) : null != lastPoints ? lastPoints : [];
50
50
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":";;;AAEA,6CAAwD;AAExD,oCAA2C;AAE3C,SAAgB,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACvF,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,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"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n\n if (isNil(attrs.x)) {\n attrs.x = lastPoints?.[index]?.x;\n }\n if (isNil(attrs.y)) {\n attrs.y = lastPoints?.[index]?.y;\n }\n\n if (isNil(attrs.defined) && lastPoints?.[index]?.defined === false) {\n attrs.defined = lastPoints?.[index]?.defined;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = lastPoints?.[index]?.x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = lastPoints?.[index]?.y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 4];\n const y = attrs.y ?? lastPoints?.[index * 4 + 1];\n const width = attrs.width ?? lastPoints?.[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints?.[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 2];\n const y = attrs.y ?? lastPoints?.[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":";;;AAEA,6CAAwD;AAExD,oCAA2C;AAE3C,SAAgB,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACvF,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KACjE;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAZD,oDAYC;AAQD,SAAgB,aAAa,CAAC,SAA2D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EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,KAAK,uBAAe,CAAC,IAAI;YACvB,OAAO,OAAO,KAAK,SAAS,CAAC;QAC/B,KAAK,uBAAe,CAAC,IAAI;YACvB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnD,KAAK,uBAAe,CAAC,IAAI;YACvB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,uBAAe,CAAC,MAAM;YACzB,OAAO,OAAO,KAAK,MAAM,CAAC;QAC5B,KAAK,uBAAe,CAAC,OAAO;YAC1B,OAAO,OAAO,KAAK,QAAQ,CAAC;QAC9B,KAAK,uBAAe,CAAC,IAAI;YACvB,OAAO,OAAO,KAAK,MAAM,CAAC;KAC7B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AA9BD,0DA8BC;AAED,SAAgB,gBAAgB,CAAC,QAAkB;IACjD,OACE,CAAC,uBAAe,CAAC,IAAI,EAAE,uBAAe,CAAC,IAAI,EAAE,uBAAe,CAAC,UAAU,EAAE,uBAAe,CAAC,YAAY,CACtG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC;AAJD,4CAIC","file":"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n\n if (isNil(attrs.x)) {\n attrs.x = lastPoints?.[index]?.x;\n }\n if (isNil(attrs.y)) {\n attrs.y = lastPoints?.[index]?.y;\n }\n\n if (isNil(attrs.defined) && lastPoints?.[index]?.defined === false) {\n attrs.defined = false;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = lastPoints?.[index]?.x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = lastPoints?.[index]?.y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 4];\n const y = attrs.y ?? lastPoints?.[index * 4 + 1];\n const width = attrs.width ?? lastPoints?.[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints?.[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 2];\n const y = attrs.y ?? lastPoints?.[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
@@ -77,22 +77,32 @@ class CanvasRenderer {
77
77
  this._stage = null, this._layer = null, this._dragController = null, this._gestureController = null;
78
78
  }
79
79
  createStage() {
80
- var _a, _b, _c, _d, _e, _f, _g;
80
+ var _a, _b, _c, _d, _e;
81
81
  this._view.emit(enums_1.HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);
82
82
  const viewOptions = this._viewOptions, stage = null !== (_a = viewOptions.stage) && void 0 !== _a ? _a : (0,
83
- vrender_core_1.createStage)(Object.assign(Object.assign({}, viewOptions), {
83
+ vrender_core_1.createStage)({
84
84
  width: this._width,
85
85
  height: this._height,
86
+ renderStyle: viewOptions.renderStyle,
87
+ viewBox: viewOptions.viewBox,
88
+ dpr: viewOptions.dpr,
89
+ canvas: viewOptions.renderCanvas,
90
+ canvasControled: viewOptions.canvasControled,
91
+ container: viewOptions.container,
86
92
  title: viewOptions.rendererTitle,
87
- disableDirtyBounds: null === (_b = viewOptions.disableDirtyBounds) || void 0 === _b || _b,
88
- autoRender: null === (_c = viewOptions.autoRender) || void 0 === _c || _c
89
- }));
90
- (null === (_d = viewOptions.options3d) || void 0 === _d ? void 0 : _d.enable) && stage.set3dOptions(viewOptions.options3d),
93
+ beforeRender: viewOptions.beforeRender,
94
+ afterRender: viewOptions.afterRender,
95
+ disableDirtyBounds: !0,
96
+ autoRender: !0,
97
+ pluginList: viewOptions.pluginList,
98
+ enableHtmlAttribute: viewOptions.enableHtmlAttribute
99
+ });
100
+ (null === (_b = viewOptions.options3d) || void 0 === _b ? void 0 : _b.enable) && stage.set3dOptions(viewOptions.options3d),
91
101
  stage.enableIncrementalAutoRender(), this._viewBox = viewOptions.viewBox, this._view.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),
92
102
  this._view.emit(enums_1.HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);
93
- const layer = null !== (_e = viewOptions.layer) && void 0 !== _e ? _e : stage.defaultLayer;
94
- if (this._view.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER), (null === (_f = this._eventConfig) || void 0 === _f ? void 0 : _f.drag) && (this._dragController = new vrender_kits_1.DragNDrop(stage)),
95
- null === (_g = this._eventConfig) || void 0 === _g ? void 0 : _g.gesture) {
103
+ const layer = null !== (_c = viewOptions.layer) && void 0 !== _c ? _c : stage.defaultLayer;
104
+ if (this._view.emit(enums_1.HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER), (null === (_d = this._eventConfig) || void 0 === _d ? void 0 : _d.drag) && (this._dragController = new vrender_kits_1.DragNDrop(stage)),
105
+ null === (_e = this._eventConfig) || void 0 === _e ? void 0 : _e.gesture) {
96
106
  const gestureConfig = (0, vutils_1.isObject)(this._eventConfig.gesture) ? this._eventConfig.gesture : {};
97
107
  this._gestureController = new vrender_kits_1.Gesture(stage, gestureConfig);
98
108
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":";;AAEA,6CAA4C;AAG5C,yDAA0E;AAC1E,yDAA4D;AAG5D,mCAAqC;AAErC,MAAqB,cAAc;IAajC,YAAY,IAAW;QAgOf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBACxD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACjC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,kBAAkB,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC,CAAC;QAtOA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,MAAc,EAAE,OAAqB,EAAE,WAA6B;QAC5F,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,CAAC,S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AA0B,CAAC,CAAC;QAEvD,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,EAAE;YAE3B,IAAI,CAAC,eAAe,GAAG,IAAI,wBAAS,CAAC,KAAgC,CAAC,CAAC;SACxE;QACD,IAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,EAAE;YAC9B,MAAM,aAAa,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3F,IAAI,CAAC,kBAAkB,GAAG,IAAI,sBAAO,CAAC,KAAgC,EAAE,aAAa,CAAC,CAAC;SACxF;QAED,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF;AArPD,iCAqPC","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n ...viewOptions,\n width: this._width,\n height: this._height,\n title: viewOptions.rendererTitle,\n disableDirtyBounds: viewOptions.disableDirtyBounds ?? true,\n autoRender: viewOptions.autoRender ?? true\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag) {\n // 允许 drag 事件\n this._dragController = new DragNDrop(stage as unknown as IEventTarget);\n }\n if (this._eventConfig?.gesture) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new Gesture(stage as unknown as IEventTarget, gestureConfig);\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":";;AAEA,6CAA4C;AAG5C,yDAA0E;AAC1E,yDAA4D;AAG5D,mCAAqC;AAErC,MAAqB,cAAc;IAajC,YAAY,IAAW;QAyOf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBACxD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACjC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,kBAAkB,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC,CAAC;QA/OA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;I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AAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF;AA9PD,iCA8PC","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag) {\n // 允许 drag 事件\n this._dragController = new DragNDrop(stage as unknown as IEventTarget);\n }\n if (this._eventConfig?.gesture) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new Gesture(stage as unknown as IEventTarget, gestureConfig);\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.9.0-alpha.0";
1
+ export declare const version = "0.9.0";
2
2
  export * from './graph';
3
3
  export * from './interactions';
4
4
  export { View } from './view';
package/cjs/index.js CHANGED
@@ -18,7 +18,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), exports.vglobal = exports.ThemeManager = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.View = exports.version = void 0,
21
- exports.version = "0.9.0-alpha.0", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
21
+ exports.version = "0.9.0", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
22
22
 
23
23
  var view_1 = require("./view");
24
24
 
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,eAAe,CAAC;AAEvC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAGjB,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.9.0-alpha.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,OAAO,CAAC;AAE/B,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAGjB,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.9.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\n"]}
@@ -1,8 +1,9 @@
1
- import type { ContinuousPlayerAttributes, DataLabelAttrs, LineDataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes } from '@visactor/vrender-components';
1
+ import type { ContinuousPlayerAttributes, DataLabelAttrs, LineDataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes, AreaLabelAttrs } from '@visactor/vrender-components';
2
2
  import type { IComponentTheme, RecursivePartial } from '../../types';
3
3
  export declare const dataLabel: RecursivePartial<DataLabelAttrs>;
4
4
  export declare const lineDataLabel: RecursivePartial<LineDataLabelAttrs>;
5
5
  export declare const lineLabel: RecursivePartial<LineLabelAttrs>;
6
+ export declare const areaLabel: RecursivePartial<AreaLabelAttrs>;
6
7
  export declare const rectLabel: RecursivePartial<RectLabelAttrs>;
7
8
  export declare const symbolLabel: RecursivePartial<SymbolLabelAttrs>;
8
9
  export declare const arcLabel: RecursivePartial<ArcLabelAttrs>;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.defaultComponentTheme = exports.scrollbar = exports.title = exports.tooltip = exports.discretePlayer = exports.continuousPlayer = exports.datazoom = exports.pointLabel = exports.arcLabel = exports.symbolLabel = exports.rectLabel = exports.lineLabel = exports.lineDataLabel = exports.dataLabel = void 0;
5
+ }), exports.defaultComponentTheme = exports.scrollbar = exports.title = exports.tooltip = exports.discretePlayer = exports.continuousPlayer = exports.datazoom = exports.pointLabel = exports.arcLabel = exports.symbolLabel = exports.rectLabel = exports.areaLabel = exports.lineLabel = exports.lineDataLabel = exports.dataLabel = void 0;
6
6
 
7
7
  const axis = {
8
8
  label: {
@@ -370,15 +370,28 @@ exports.dataLabel = {
370
370
  } ],
371
371
  position: "start",
372
372
  overlap: {
373
- avoidBaseMark: !0,
373
+ avoidBaseMark: !1,
374
374
  clampForce: !1,
375
375
  size: {
376
376
  width: 1e3,
377
377
  height: 1e3
378
- },
379
- strategy: [ {
380
- type: "position"
381
- } ]
378
+ }
379
+ },
380
+ smartInvert: !1
381
+ }, exports.areaLabel = {
382
+ type: "area",
383
+ data: [ {
384
+ text: "",
385
+ data: {}
386
+ } ],
387
+ position: "end",
388
+ overlap: {
389
+ avoidBaseMark: !1,
390
+ clampForce: !1,
391
+ size: {
392
+ width: 1e3,
393
+ height: 1e3
394
+ }
382
395
  },
383
396
  smartInvert: !1
384
397
  }, exports.rectLabel = {
@@ -491,6 +504,7 @@ exports.title = {
491
504
  dataLabel: exports.dataLabel,
492
505
  pointLabel: exports.pointLabel,
493
506
  lineLabel: exports.lineLabel,
507
+ areaLabel: exports.areaLabel,
494
508
  rectLabel: exports.rectLabel,
495
509
  symbolLabel: exports.symbolLabel,
496
510
  arcLabel: exports.arcLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":";;;AA8BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAA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0C;IAC9D,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;CACF,CAAC;AAEW,QAAA,qBAAqB,GAAoB;IACpD,IAAI;IACJ,UAAU;IAEV,IAAI;IACJ,UAAU;IAEV,cAAc;IACd,WAAW;IACX,UAAU;IAEV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS,EAAT,iBAAS;IACT,UAAU,EAAV,kBAAU;IACV,SAAS,EAAT,iBAAS;IACT,SAAS,EAAT,iBAAS;IACT,WAAW,EAAX,mBAAW;IACX,QAAQ,EAAR,gBAAQ;IACR,aAAa,EAAb,qBAAa;IAEb,QAAQ,EAAR,gBAAQ;IAER,gBAAgB,EAAhB,wBAAgB;IAChB,cAAc,EAAd,sBAAc;IAEd,OAAO,EAAP,eAAO;IAEP,KAAK,EAAL,aAAK;IAEL,SAAS,EAAT,iBAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n LineDataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineDataLabel: RecursivePartial<LineDataLabelAttrs> = {\n type: 'line-data',\n data: [\n {\n text: ''\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: false,\n clampForce: false\n },\n smartInvert: false\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: true,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n lineDataLabel,\n\n datazoom,\n\n continuousPlayer,\n discretePlayer,\n\n tooltip,\n\n title,\n\n scrollbar\n};\n"]}
1
+ {"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":";;;AA+BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE,CAAC,EAA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AAElD,QAAA,KAAK,GAAiC;IACjD,SAAS,EAAE;QACT,IAAI,EAAE,SAAS;KAChB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,SAAS;KAChB;CACF,CAAC;AAEW,QAAA,SAAS,GAA0C;IAC9D,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;CACF,CAAC;AAEW,QAAA,qBAAqB,GAAoB;IACpD,IAAI;IACJ,UAAU;IAEV,IAAI;IACJ,UAAU;IAEV,cAAc;IACd,WAAW;IACX,UAAU;IAEV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS,EAAT,iBAAS;IACT,UAAU,EAAV,kBAAU;IACV,SAAS,EAAT,iBAAS;IACT,SAAS,EAAT,iBAAS;IACT,SAAS,EAAT,iBAAS;IACT,WAAW,EAAX,mBAAW;IACX,QAAQ,EAAR,gBAAQ;IACR,aAAa,EAAb,qBAAa;IAEb,QAAQ,EAAR,gBAAQ;IAER,gBAAgB,EAAhB,wBAAgB;IAChB,cAAc,EAAd,sBAAc;IAEd,OAAO,EAAP,eAAO;IAEP,KAAK,EAAL,aAAK;IAEL,SAAS,EAAT,iBAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n LineDataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes,\n AreaLabelAttrs\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineDataLabel: RecursivePartial<LineDataLabelAttrs> = {\n type: 'line-data',\n data: [\n {\n text: ''\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: false,\n clampForce: false\n },\n smartInvert: false\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const areaLabel: RecursivePartial<AreaLabelAttrs> = {\n type: 'area',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'end',\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n areaLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n lineDataLabel,\n\n datazoom,\n\n continuousPlayer,\n discretePlayer,\n\n tooltip,\n\n title,\n\n scrollbar\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IColor } from '@visactor/vrender-core';
2
- import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineDataLabelAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes } from '@visactor/vrender-components';
2
+ import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineDataLabelAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes, AreaLabelAttrs } from '@visactor/vrender-components';
3
3
  import type { IPadding } from '@visactor/vutils';
4
4
  import type { RecursivePartial } from './base';
5
5
  import type { BasicEncoderSpecMap } from './mark';
@@ -20,6 +20,7 @@ export interface IComponentTheme {
20
20
  slider?: RecursivePartial<SliderAttributes>;
21
21
  dataLabel?: RecursivePartial<DataLabelAttrs>;
22
22
  lineLabel?: RecursivePartial<LineLabelAttrs>;
23
+ areaLabel?: RecursivePartial<AreaLabelAttrs>;
23
24
  rectLabel?: RecursivePartial<RectLabelAttrs>;
24
25
  arcLabel?: RecursivePartial<ArcLabelAttrs>;
25
26
  symbolLabel?: RecursivePartial<SymbolLabelAttrs>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineDataLabelAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n lineDataLabel?: RecursivePartial<LineDataLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineDataLabelAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes,\n AreaLabelAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n areaLabel?: RecursivePartial<AreaLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n lineDataLabel?: RecursivePartial<LineDataLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
@@ -15,40 +15,45 @@ import { Factory } from "../core/factory";
15
15
  export const generateLabelAttributes = (marks, groupSize, encoder, labelStyle, parameters, theme) => {
16
16
  var _a;
17
17
  const labelTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.dataLabel, dataLabels = marks.map(((mark, index) => {
18
- var _a, _b, _c, _d, _e, _f, _g, _h;
18
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
19
19
  const labelParameters = Object.assign(Object.assign({}, parameters), {
20
20
  labelIndex: index
21
- });
21
+ }), addition = invokeFunctionType(labelStyle, labelParameters, mark);
22
22
  let currentTheme = {};
23
23
  switch (mark.markType) {
24
24
  case GrammarMarkType.line:
25
25
  case GrammarMarkType.area:
26
- currentTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.lineDataLabel;
26
+ currentTheme = "line" === (null == addition ? void 0 : addition.type) ? null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.lineLabel : "area" === (null == addition ? void 0 : addition.type) ? null === (_b = null == theme ? void 0 : theme.components) || void 0 === _b ? void 0 : _b.areaLabel : null === (_c = null == theme ? void 0 : theme.components) || void 0 === _c ? void 0 : _c.lineDataLabel;
27
27
  break;
28
28
 
29
29
  case GrammarMarkType.rect:
30
30
  case GrammarMarkType.interval:
31
- currentTheme = null === (_b = null == theme ? void 0 : theme.components) || void 0 === _b ? void 0 : _b.rectLabel;
31
+ currentTheme = null === (_d = null == theme ? void 0 : theme.components) || void 0 === _d ? void 0 : _d.rectLabel;
32
32
  break;
33
33
 
34
34
  case GrammarMarkType.symbol:
35
35
  case GrammarMarkType.circle:
36
36
  case GrammarMarkType.cell:
37
- currentTheme = null === (_c = null == theme ? void 0 : theme.components) || void 0 === _c ? void 0 : _c.symbolLabel;
37
+ currentTheme = null === (_e = null == theme ? void 0 : theme.components) || void 0 === _e ? void 0 : _e.symbolLabel;
38
38
  break;
39
39
 
40
40
  case GrammarMarkType.arc:
41
41
  case GrammarMarkType.arc3d:
42
- currentTheme = null === (_d = null == theme ? void 0 : theme.components) || void 0 === _d ? void 0 : _d.arcLabel;
42
+ currentTheme = null === (_f = null == theme ? void 0 : theme.components) || void 0 === _f ? void 0 : _f.arcLabel;
43
43
  break;
44
44
 
45
45
  case GrammarMarkType.polygon:
46
46
  case GrammarMarkType.path:
47
47
  default:
48
- currentTheme = null === (_e = null == theme ? void 0 : theme.components) || void 0 === _e ? void 0 : _e.pointLabel;
48
+ currentTheme = null === (_g = null == theme ? void 0 : theme.components) || void 0 === _g ? void 0 : _g.pointLabel;
49
49
  }
50
- const data = [], themeDatum = null !== (_g = null === (_f = null == currentTheme ? void 0 : currentTheme.data) || void 0 === _f ? void 0 : _f[0]) && void 0 !== _g ? _g : {};
51
- mark.elements.forEach((element => {
50
+ const data = null !== (_h = null == addition ? void 0 : addition.data) && void 0 !== _h ? _h : [], themeDatum = null !== (_k = null === (_j = null == currentTheme ? void 0 : currentTheme.data) || void 0 === _j ? void 0 : _j[0]) && void 0 !== _k ? _k : {};
51
+ data && data.length > 0 ? data.forEach(((d, index) => {
52
+ if (mark.elements[index]) {
53
+ const attributes = invokeEncoder(encoder, d, mark.elements[index], labelParameters);
54
+ merge(d, themeDatum, attributes);
55
+ }
56
+ })) : mark.elements.forEach((element => {
52
57
  if ("willRelease" !== element.getGraphicItem().releaseStatus) if (mark.isCollectionMark()) {
53
58
  element.getDatum().forEach((entry => {
54
59
  const attributes = invokeEncoder(encoder, entry, element, labelParameters);
@@ -59,7 +64,7 @@ export const generateLabelAttributes = (marks, groupSize, encoder, labelStyle, p
59
64
  data.push(datum);
60
65
  }
61
66
  }));
62
- const addition = invokeFunctionType(labelStyle, labelParameters, mark), graphicItemName = null === (_h = mark.graphicItem) || void 0 === _h ? void 0 : _h.name;
67
+ const graphicItemName = null === (_l = mark.graphicItem) || void 0 === _l ? void 0 : _l.name;
63
68
  return merge({}, currentTheme, {
64
69
  data: data,
65
70
  baseMarkGroupName: graphicItemName,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAYzD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,KAAc,EACd,SAA4C,EAC5C,OAA6B,EAC7B,UAAqD,EACrD,UAAe,EACf,KAAc,EACE,EAAE;;IAClB,MAAM,UAAU,GAAG,MAAA,KAAK,aAAL,KAAK,uBAA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CAAC,KAAqB,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAwB,CACvE,CAAC;IAEF,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC","file":"label.js","sourcesContent":["import { array, isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DataLabel } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum, GrammarMarkType } from '../graph/enums';\nimport type { ILabel, LabelSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateLabelAttributes = (\n marks: IMark[],\n groupSize: { width: number; height: number },\n encoder: BaseSignleEncodeSpec,\n labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>,\n parameters: any,\n theme?: ITheme\n): DataLabelAttrs => {\n const labelTheme = theme?.components?.dataLabel;\n const dataLabels = marks\n .map((mark, index) => {\n const labelParameters = { ...parameters, labelIndex: index };\n let currentTheme: any = {};\n switch (mark.markType) {\n case GrammarMarkType.line:\n case GrammarMarkType.area:\n currentTheme = theme?.components?.lineDataLabel;\n break;\n case GrammarMarkType.rect:\n case GrammarMarkType.interval:\n currentTheme = theme?.components?.rectLabel;\n break;\n case GrammarMarkType.symbol:\n case GrammarMarkType.circle:\n case GrammarMarkType.cell:\n currentTheme = theme?.components?.symbolLabel;\n break;\n case GrammarMarkType.arc:\n case GrammarMarkType.arc3d:\n currentTheme = theme?.components?.arcLabel;\n break;\n case GrammarMarkType.polygon:\n case GrammarMarkType.path:\n default:\n currentTheme = theme?.components?.pointLabel;\n break;\n }\n const data: any[] = [];\n const themeDatum = currentTheme?.data?.[0] ?? {};\n // process by order of elements\n mark.elements.forEach(element => {\n const graphicItem = element.getGraphicItem();\n if ((graphicItem as any).releaseStatus !== 'willRelease') {\n if (mark.isCollectionMark()) {\n const datum = element.getDatum();\n\n datum.forEach((entry: any) => {\n const attributes = invokeEncoder(encoder, entry, element, labelParameters);\n data.push(merge({}, themeDatum, attributes));\n });\n } else {\n const attributes = invokeEncoder(encoder, element.getDatum(), element, labelParameters);\n const datum = merge({}, themeDatum, attributes);\n data.push(datum);\n }\n }\n });\n const addition = invokeFunctionType(labelStyle, labelParameters, mark);\n const graphicItemName = mark.graphicItem?.name;\n return merge(\n {},\n currentTheme,\n {\n data,\n baseMarkGroupName: graphicItemName,\n // FIXME: hack\n // 标签是对数据顺序有强要求的场景,因为顺序会影响标签躲避结果;而目前没有机制保证 vrender 图元顺序与数据顺序一致。\n // 这里目前只能通过自定义方法来 hack\n getBaseMarks: () => mark.elements.map(element => element.getGraphicItem())\n },\n addition ?? {}\n );\n })\n .filter(label => !isNil(label));\n\n return merge({}, labelTheme, { size: groupSize, dataLabels });\n};\n\nexport class Label extends Component implements ILabel {\n static readonly componentType: string = ComponentEnum.label;\n protected declare spec: LabelSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.label, group);\n this.spec.componentType = ComponentEnum.label;\n }\n\n protected parseAddition(spec: LabelSpec) {\n super.parseAddition(spec);\n this.labelStyle(spec.labelStyle);\n this.size(spec.size);\n this.target(spec.target);\n return this;\n }\n\n labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>) {\n return this.setFunctionSpec(style, 'labelStyle');\n }\n\n size(size: LabelSpec['size']) {\n return this.setFunctionSpec(size, 'size');\n }\n\n target(mark: IMark | IMark[] | string | string[] | Nil): this {\n if (this.spec.target) {\n const prevMarks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.detach(prevMarks);\n }\n this.spec.target = mark;\n if (mark) {\n const nextMarks = array(mark).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.attach(nextMarks);\n }\n this.commit();\n return this;\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const marks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n const groupGraphicItem = this.group?.getGroupGraphicItem?.();\n let size = invokeFunctionType(this.spec.size, parameters);\n if (!size) {\n size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: Infinity, height: Infinity };\n }\n\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n\n return generateLabelAttributes(\n marks,\n size,\n encoder as BaseSignleEncodeSpec,\n this.spec.labelStyle,\n parameters,\n theme\n );\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerLabel = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.label,\n (attrs: DataLabelAttrs) => new DataLabel(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.label, Label);\n};\n"]}
1
+ {"version":3,"sources":["../src/component/label.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAQ,MAAM,kBAAkB,CAAC;AAIvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAYzD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,E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Aa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC","file":"label.js","sourcesContent":["import { load } from './../util/data';\nimport { array, isNil, isString, merge, last } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DataLabel } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum, GrammarMarkType } from '../graph/enums';\nimport type { ILabel, LabelSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateLabelAttributes = (\n marks: IMark[],\n groupSize: { width: number; height: number },\n encoder: BaseSignleEncodeSpec,\n labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>,\n parameters: any,\n theme?: ITheme\n): DataLabelAttrs => {\n const labelTheme = theme?.components?.dataLabel;\n const dataLabels = marks\n .map((mark, index) => {\n const labelParameters = { ...parameters, labelIndex: index };\n const addition = invokeFunctionType(labelStyle, labelParameters, mark);\n let currentTheme: any = {};\n\n switch (mark.markType) {\n case GrammarMarkType.line:\n case GrammarMarkType.area:\n if (addition?.type === 'line') {\n currentTheme = theme?.components?.lineLabel;\n } else if (addition?.type === 'area') {\n currentTheme = theme?.components?.areaLabel;\n } else {\n currentTheme = theme?.components?.lineDataLabel;\n }\n break;\n case GrammarMarkType.rect:\n case GrammarMarkType.interval:\n currentTheme = theme?.components?.rectLabel;\n break;\n case GrammarMarkType.symbol:\n case GrammarMarkType.circle:\n case GrammarMarkType.cell:\n currentTheme = theme?.components?.symbolLabel;\n break;\n case GrammarMarkType.arc:\n case GrammarMarkType.arc3d:\n currentTheme = theme?.components?.arcLabel;\n break;\n case GrammarMarkType.polygon:\n case GrammarMarkType.path:\n default:\n currentTheme = theme?.components?.pointLabel;\n break;\n }\n\n const data: any[] = addition?.data ?? [];\n const themeDatum = currentTheme?.data?.[0] ?? {};\n\n if (data && data.length > 0) {\n data.forEach((d, index) => {\n if (mark.elements[index]) {\n const attributes = invokeEncoder(encoder, d, mark.elements[index], labelParameters);\n merge(d, themeDatum, attributes);\n }\n });\n } else {\n // process by order of elements\n mark.elements.forEach(element => {\n const graphicItem = element.getGraphicItem();\n if ((graphicItem as any).releaseStatus !== 'willRelease') {\n if (mark.isCollectionMark()) {\n const datum = element.getDatum();\n\n datum.forEach((entry: any) => {\n const attributes = invokeEncoder(encoder, entry, element, labelParameters);\n data.push(merge({}, themeDatum, attributes));\n });\n } else {\n const attributes = invokeEncoder(encoder, element.getDatum(), element, labelParameters);\n const datum = merge({}, themeDatum, attributes);\n data.push(datum);\n }\n }\n });\n }\n\n const graphicItemName = mark.graphicItem?.name;\n return merge(\n {},\n currentTheme,\n {\n data,\n baseMarkGroupName: graphicItemName,\n // FIXME: hack\n // 标签是对数据顺序有强要求的场景,因为顺序会影响标签躲避结果;而目前没有机制保证 vrender 图元顺序与数据顺序一致。\n // 这里目前只能通过自定义方法来 hack\n getBaseMarks: () => mark.elements.map(element => element.getGraphicItem())\n },\n addition ?? {}\n );\n })\n .filter(label => !isNil(label));\n\n return merge({}, labelTheme, { size: groupSize, dataLabels });\n};\n\nexport class Label extends Component implements ILabel {\n static readonly componentType: string = ComponentEnum.label;\n protected declare spec: LabelSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.label, group);\n this.spec.componentType = ComponentEnum.label;\n }\n\n protected parseAddition(spec: LabelSpec) {\n super.parseAddition(spec);\n this.labelStyle(spec.labelStyle);\n this.size(spec.size);\n this.target(spec.target);\n return this;\n }\n\n labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>) {\n return this.setFunctionSpec(style, 'labelStyle');\n }\n\n size(size: LabelSpec['size']) {\n return this.setFunctionSpec(size, 'size');\n }\n\n target(mark: IMark | IMark[] | string | string[] | Nil): this {\n if (this.spec.target) {\n const prevMarks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.detach(prevMarks);\n }\n this.spec.target = mark;\n if (mark) {\n const nextMarks = array(mark).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.attach(nextMarks);\n }\n this.commit();\n return this;\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const marks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n const groupGraphicItem = this.group?.getGroupGraphicItem?.();\n let size = invokeFunctionType(this.spec.size, parameters);\n if (!size) {\n size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: Infinity, height: Infinity };\n }\n\n const theme = this.spec.skipTheme ? null : this.view.getCurrentTheme();\n\n return generateLabelAttributes(\n marks,\n size,\n encoder as BaseSignleEncodeSpec,\n this.spec.labelStyle,\n parameters,\n theme\n );\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerLabel = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.label,\n (attrs: DataLabelAttrs) => new DataLabel(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.label, Label);\n};\n"]}
@@ -33,13 +33,13 @@ export function getRulePoints(nextAttrs) {
33
33
  export function getLinePoints(items, includeOnePoint, lastPoints, isArea) {
34
34
  if (!items || !items.length || 1 === items.length && includeOnePoint) return [];
35
35
  return items.some((item => isValidPointsChannel(Object.keys(item.nextAttrs), "line"))) ? items.map(((item, index) => {
36
- var _a, _b, _c, _d, _e, _f;
36
+ var _a, _b, _c, _d, _e;
37
37
  const attrs = item.nextAttrs;
38
38
  return isNil(attrs.x) && (attrs.x = null === (_a = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _a ? void 0 : _a.x),
39
39
  isNil(attrs.y) && (attrs.y = null === (_b = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _b ? void 0 : _b.y),
40
- isNil(attrs.defined) && !1 === (null === (_c = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _c ? void 0 : _c.defined) && (attrs.defined = null === (_d = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _d ? void 0 : _d.defined),
41
- attrs.context = item.key, isArea && (isNil(attrs.x1) && (attrs.x1 = null === (_e = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _e ? void 0 : _e.x1),
42
- isNil(attrs.y1) && (attrs.y1 = null === (_f = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _f ? void 0 : _f.y1)),
40
+ isNil(attrs.defined) && !1 === (null === (_c = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _c ? void 0 : _c.defined) && (attrs.defined = !1),
41
+ attrs.context = item.key, isArea && (isNil(attrs.x1) && (attrs.x1 = null === (_d = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _d ? void 0 : _d.x1),
42
+ isNil(attrs.y1) && (attrs.y1 = null === (_e = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _e ? void 0 : _e.y1)),
43
43
  attrs;
44
44
  })) : null != lastPoints ? lastPoints : [];
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,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AAK,MAAM,CAAC;KAC7B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,OACE,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CACtG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC","file":"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n\n if (isNil(attrs.x)) {\n attrs.x = lastPoints?.[index]?.x;\n }\n if (isNil(attrs.y)) {\n attrs.y = lastPoints?.[index]?.y;\n }\n\n if (isNil(attrs.defined) && lastPoints?.[index]?.defined === false) {\n attrs.defined = lastPoints?.[index]?.defined;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = lastPoints?.[index]?.x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = lastPoints?.[index]?.y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 4];\n const y = attrs.y ?? lastPoints?.[index * 4 + 1];\n const width = attrs.width ?? lastPoints?.[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints?.[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 2];\n const y = attrs.y ?? lastPoints?.[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACvF,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,E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AC,IAAI,CAAC;QAC1B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrD,KAAK,eAAe,CAAC,IAAI,CAAC;QAC1B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClD,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,OAAO,KAAK,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnD,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,eAAe,CAAC,MAAM;YACzB,OAAO,OAAO,KAAK,MAAM,CAAC;QAC5B,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,OAAO,KAAK,QAAQ,CAAC;QAC9B,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,OAAO,KAAK,MAAM,CAAC;KAC7B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,OACE,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CACtG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC","file":"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n\n if (isNil(attrs.x)) {\n attrs.x = lastPoints?.[index]?.x;\n }\n if (isNil(attrs.y)) {\n attrs.y = lastPoints?.[index]?.y;\n }\n\n if (isNil(attrs.defined) && lastPoints?.[index]?.defined === false) {\n attrs.defined = false;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = lastPoints?.[index]?.x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = lastPoints?.[index]?.y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 4];\n const y = attrs.y ?? lastPoints?.[index * 4 + 1];\n const width = attrs.width ?? lastPoints?.[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints?.[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 2];\n const y = attrs.y ?? lastPoints?.[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
@@ -76,21 +76,31 @@ export default class CanvasRenderer {
76
76
  this._stage = null, this._layer = null, this._dragController = null, this._gestureController = null;
77
77
  }
78
78
  createStage() {
79
- var _a, _b, _c, _d, _e, _f, _g;
79
+ var _a, _b, _c, _d, _e;
80
80
  this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);
81
- const viewOptions = this._viewOptions, stage = null !== (_a = viewOptions.stage) && void 0 !== _a ? _a : createStage(Object.assign(Object.assign({}, viewOptions), {
81
+ const viewOptions = this._viewOptions, stage = null !== (_a = viewOptions.stage) && void 0 !== _a ? _a : createStage({
82
82
  width: this._width,
83
83
  height: this._height,
84
+ renderStyle: viewOptions.renderStyle,
85
+ viewBox: viewOptions.viewBox,
86
+ dpr: viewOptions.dpr,
87
+ canvas: viewOptions.renderCanvas,
88
+ canvasControled: viewOptions.canvasControled,
89
+ container: viewOptions.container,
84
90
  title: viewOptions.rendererTitle,
85
- disableDirtyBounds: null === (_b = viewOptions.disableDirtyBounds) || void 0 === _b || _b,
86
- autoRender: null === (_c = viewOptions.autoRender) || void 0 === _c || _c
87
- }));
88
- (null === (_d = viewOptions.options3d) || void 0 === _d ? void 0 : _d.enable) && stage.set3dOptions(viewOptions.options3d),
91
+ beforeRender: viewOptions.beforeRender,
92
+ afterRender: viewOptions.afterRender,
93
+ disableDirtyBounds: !0,
94
+ autoRender: !0,
95
+ pluginList: viewOptions.pluginList,
96
+ enableHtmlAttribute: viewOptions.enableHtmlAttribute
97
+ });
98
+ (null === (_b = viewOptions.options3d) || void 0 === _b ? void 0 : _b.enable) && stage.set3dOptions(viewOptions.options3d),
89
99
  stage.enableIncrementalAutoRender(), this._viewBox = viewOptions.viewBox, this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE),
90
100
  this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);
91
- const layer = null !== (_e = viewOptions.layer) && void 0 !== _e ? _e : stage.defaultLayer;
92
- if (this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER), (null === (_f = this._eventConfig) || void 0 === _f ? void 0 : _f.drag) && (this._dragController = new DragNDrop(stage)),
93
- null === (_g = this._eventConfig) || void 0 === _g ? void 0 : _g.gesture) {
101
+ const layer = null !== (_c = viewOptions.layer) && void 0 !== _c ? _c : stage.defaultLayer;
102
+ if (this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER), (null === (_d = this._eventConfig) || void 0 === _d ? void 0 : _d.drag) && (this._dragController = new DragNDrop(stage)),
103
+ null === (_e = this._eventConfig) || void 0 === _e ? void 0 : _e.gesture) {
94
104
  const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};
95
105
  this._gestureController = new Gesture(stage, gestureConfig);
96
106
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,OAAO,OAAO,cAAc;IAajC,YAAY,IAAW;QAgOf,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;gBACxD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;aACjC;YAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC,C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line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n ...viewOptions,\n width: this._width,\n height: this._height,\n title: viewOptions.rendererTitle,\n disableDirtyBounds: viewOptions.disableDirtyBounds ?? true,\n autoRender: viewOptions.autoRender ?? true\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag) {\n // 允许 drag 事件\n this._dragController = new DragNDrop(stage as unknown as IEventTarget);\n }\n if (this._eventConfig?.gesture) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new Gesture(stage as unknown as IEventTarget, gestureConfig);\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/canvas-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,M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CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3F,IAAI,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,KAAgC,EAAE,aAAa,CAAC,CAAC;SACxF;QAED,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7B;IACH,CAAC;CAUF","file":"canvas-renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isObject } from '@visactor/vutils';\nimport type { IEventTarget, IColor, ILayer, Stage } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { createStage, waitForAllSubLayers } from '@visactor/vrender-core';\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport type { IViewOptions, IView, IMark, IViewEventConfig } from '../types';\nimport type { IRenderer } from '../types/renderer';\nimport { HOOK_EVENT } from './enums';\n\nexport default class CanvasRenderer implements IRenderer {\n private _width: number;\n private _height: number;\n\n private _view: IView;\n private _viewOptions: IViewOptions;\n private _eventConfig: IViewEventConfig;\n private _stage: Stage;\n private _layer: ILayer;\n private _dragController: DragNDrop;\n private _gestureController: Gesture;\n private _viewBox: IBoundsLike;\n\n constructor(view: IView) {\n this._view = view;\n }\n\n initialize(width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) {\n this._width = width;\n this._height = height;\n this._viewOptions = options;\n this._eventConfig = eventConfig;\n\n this.initStage();\n\n // this method will invoke resize to size the canvas appropriately\n return this;\n }\n\n stage() {\n return this._stage ?? null;\n }\n\n canvas() {\n if (this._stage) {\n return this._stage.window.getNativeHandler().nativeCanvas;\n }\n return null;\n }\n\n context() {\n if (this._stage) {\n return this._stage.window.getContext().nativeContext;\n }\n return null;\n }\n\n combineIncrementalLayers() {\n if (this._stage) {\n waitForAllSubLayers(this._stage as any).then(() => {\n // stage might be null in current tick\n if (this._stage) {\n this._stage.defaultLayer.combineSubLayer();\n }\n });\n }\n return this;\n }\n\n background(color: IColor) {\n if (this._stage) {\n this._stage.background = color;\n return this;\n }\n }\n\n setDpr(resolution: number, redraw: boolean) {\n this._stage?.setDpr?.(resolution);\n if (redraw) {\n this.renderNextFrame();\n }\n return this;\n }\n\n shouldResize(width: number, height: number) {\n return width !== this._width || height !== this._height;\n }\n\n resize(width: number, height: number) {\n this._view.emit(HOOK_EVENT.BEFORE_STAGE_RESIZE);\n if (this.shouldResize(width, height)) {\n this._width = width;\n this._height = height;\n this._stage && this._stage.resize(width, height);\n }\n\n this._view.emit(HOOK_EVENT.AFTER_STAGE_RESIZE);\n\n return this;\n }\n\n setViewBox(viewBox: IBoundsLike, rerender: boolean = true) {\n if (!this._stage) {\n return this;\n }\n if (\n viewBox &&\n (!this._viewBox ||\n viewBox.x1 !== this._viewBox.x1 ||\n viewBox.x2 !== this._viewBox.x2 ||\n viewBox.y1 !== this._viewBox.y1 ||\n viewBox.y2 !== this._viewBox.y2)\n ) {\n this._viewBox = viewBox;\n\n // FIXME: vRender\n this._stage.setViewBox(viewBox.x1, viewBox.y1, viewBox.x2 - viewBox.x1, viewBox.y2 - viewBox.y1, rerender);\n }\n return this;\n }\n\n render(immediately: boolean = false) {\n this._view.emit(HOOK_EVENT.BEFORE_VRENDER_DRAW);\n\n this.initStage();\n\n // disable dirty bounds when render is called\n this._stage.disableDirtyBounds();\n this._stage.afterNextRender(this.handleAfterNextRender);\n\n // render immediately and skip render in next frame\n if (immediately) {\n this._stage.render();\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n }\n return this;\n }\n\n renderNextFrame() {\n this.initStage();\n\n this._stage.renderNextFrame();\n\n return this;\n }\n\n toCanvas() {\n if (this._stage) {\n return this._stage.toCanvas();\n }\n return null;\n }\n\n preventRender(tag: boolean) {\n if (this._stage) {\n this._stage.preventRender(tag);\n }\n }\n\n // toImageData() {\n // if (this._stage) {\n // return this._stage.toImageData();\n // }\n // return null;\n // }\n\n release() {\n this._view.traverseMarkTree((mark: IMark) => {\n mark.release();\n });\n\n if (this._dragController) {\n this._dragController.release();\n }\n if (this._gestureController) {\n this._gestureController.release();\n }\n\n if (this._stage !== (this._viewOptions?.stage as unknown as Stage)) {\n // don't release the stage created by outside\n this._stage.release();\n }\n\n this._stage = null;\n this._layer = null;\n this._dragController = null;\n this._gestureController = null;\n }\n\n private createStage() {\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_STAGE);\n\n const viewOptions = this._viewOptions;\n\n const stage =\n (viewOptions.stage as unknown as Stage) ??\n createStage({\n width: this._width,\n height: this._height,\n renderStyle: viewOptions.renderStyle,\n viewBox: viewOptions.viewBox,\n dpr: viewOptions.dpr,\n canvas: viewOptions.renderCanvas,\n canvasControled: viewOptions.canvasControled,\n container: viewOptions.container,\n title: viewOptions.rendererTitle,\n beforeRender: viewOptions.beforeRender,\n afterRender: viewOptions.afterRender,\n disableDirtyBounds: true,\n autoRender: true,\n pluginList: viewOptions.pluginList,\n enableHtmlAttribute: viewOptions.enableHtmlAttribute\n });\n\n if (viewOptions.options3d?.enable) {\n stage.set3dOptions(viewOptions.options3d);\n }\n\n stage.enableIncrementalAutoRender();\n\n this._viewBox = viewOptions.viewBox;\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_STAGE);\n\n this._view.emit(HOOK_EVENT.BEFORE_CREATE_VRENDER_LAYER);\n const layer = viewOptions.layer ?? (stage.defaultLayer as ILayer);\n this._view.emit(HOOK_EVENT.AFTER_CREATE_VRENDER_LAYER);\n\n if (this._eventConfig?.drag) {\n // 允许 drag 事件\n this._dragController = new DragNDrop(stage as unknown as IEventTarget);\n }\n if (this._eventConfig?.gesture) {\n const gestureConfig = isObject(this._eventConfig.gesture) ? this._eventConfig.gesture : {};\n // 允许手势\n this._gestureController = new Gesture(stage as unknown as IEventTarget, gestureConfig);\n }\n\n return {\n stage,\n layer\n };\n }\n\n private initStage() {\n if (!this._stage) {\n const { stage, layer } = this.createStage();\n\n this._stage = stage;\n this._layer = layer;\n\n const background = this._view.background();\n this.background(background);\n }\n }\n\n private handleAfterNextRender = () => {\n if (this._stage && !this._viewOptions.disableDirtyBounds) {\n this._stage.enableDirtyBounds();\n }\n\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_DRAW);\n this._view.emit(HOOK_EVENT.AFTER_VRENDER_NEXT_RENDER);\n };\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.9.0-alpha.0";
1
+ export declare const version = "0.9.0";
2
2
  export * from './graph';
3
3
  export * from './interactions';
4
4
  export { View } from './view';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.9.0-alpha.0";
1
+ export const version = "0.9.0";
2
2
 
3
3
  export * from "./graph";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.9.0-alpha.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.9.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\n"]}
@@ -1,8 +1,9 @@
1
- import type { ContinuousPlayerAttributes, DataLabelAttrs, LineDataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes } from '@visactor/vrender-components';
1
+ import type { ContinuousPlayerAttributes, DataLabelAttrs, LineDataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes, AreaLabelAttrs } from '@visactor/vrender-components';
2
2
  import type { IComponentTheme, RecursivePartial } from '../../types';
3
3
  export declare const dataLabel: RecursivePartial<DataLabelAttrs>;
4
4
  export declare const lineDataLabel: RecursivePartial<LineDataLabelAttrs>;
5
5
  export declare const lineLabel: RecursivePartial<LineLabelAttrs>;
6
+ export declare const areaLabel: RecursivePartial<AreaLabelAttrs>;
6
7
  export declare const rectLabel: RecursivePartial<RectLabelAttrs>;
7
8
  export declare const symbolLabel: RecursivePartial<SymbolLabelAttrs>;
8
9
  export declare const arcLabel: RecursivePartial<ArcLabelAttrs>;
@@ -368,15 +368,30 @@ export const lineLabel = {
368
368
  } ],
369
369
  position: "start",
370
370
  overlap: {
371
- avoidBaseMark: !0,
371
+ avoidBaseMark: !1,
372
372
  clampForce: !1,
373
373
  size: {
374
374
  width: 1e3,
375
375
  height: 1e3
376
- },
377
- strategy: [ {
378
- type: "position"
379
- } ]
376
+ }
377
+ },
378
+ smartInvert: !1
379
+ };
380
+
381
+ export const areaLabel = {
382
+ type: "area",
383
+ data: [ {
384
+ text: "",
385
+ data: {}
386
+ } ],
387
+ position: "end",
388
+ overlap: {
389
+ avoidBaseMark: !1,
390
+ clampForce: !1,
391
+ size: {
392
+ width: 1e3,
393
+ height: 1e3
394
+ }
380
395
  },
381
396
  smartInvert: !1
382
397
  };
@@ -510,6 +525,7 @@ export const defaultComponentTheme = {
510
525
  dataLabel: dataLabel,
511
526
  pointLabel: pointLabel,
512
527
  lineLabel: lineLabel,
528
+ areaLabel: areaLabel,
513
529
  rectLabel: rectLabel,
514
530
  symbolLabel: symbolLabel,
515
531
  arcLabel: arcLabel,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":"AA8BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,CAAC;AAE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mBAAmB;KAC1B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI;IACJ,UAAU;IAEV,IAAI;IACJ,UAAU;IAEV,cAAc;IACd,WAAW;IACX,UAAU;IAEV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS;IACT,UAAU;IACV,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,aAAa;IAEb,QAAQ;IAER,gBAAgB;IAChB,cAAc;IAEd,OAAO;IAEP,KAAK;IAEL,SAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n LineDataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineDataLabel: RecursivePartial<LineDataLabelAttrs> = {\n type: 'line-data',\n data: [\n {\n text: ''\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: false,\n clampForce: false\n },\n smartInvert: false\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: true,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n lineDataLabel,\n\n datazoom,\n\n continuousPlayer,\n discretePlayer,\n\n tooltip,\n\n title,\n\n scrollbar\n};\n"]}
1
+ {"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":"AA+BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,UAAU,GAA2C;IACzD,KAAK,EAAE;QACL,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CA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M,CAAC,MAAM,SAAS,GAA0C;IAC9D,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI;IACJ,UAAU;IAEV,IAAI;IACJ,UAAU;IAEV,cAAc;IACd,WAAW;IACX,UAAU;IAEV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS;IACT,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,aAAa;IAEb,QAAQ;IAER,gBAAgB;IAChB,cAAc;IAEd,OAAO;IAEP,KAAK;IAEL,SAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n LineDataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes,\n AreaLabelAttrs\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineDataLabel: RecursivePartial<LineDataLabelAttrs> = {\n type: 'line-data',\n data: [\n {\n text: ''\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: false,\n clampForce: false\n },\n smartInvert: false\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const areaLabel: RecursivePartial<AreaLabelAttrs> = {\n type: 'area',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'end',\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n areaLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n lineDataLabel,\n\n datazoom,\n\n continuousPlayer,\n discretePlayer,\n\n tooltip,\n\n title,\n\n scrollbar\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { IColor } from '@visactor/vrender-core';
2
- import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineDataLabelAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes } from '@visactor/vrender-components';
2
+ import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineDataLabelAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes, AreaLabelAttrs } from '@visactor/vrender-components';
3
3
  import type { IPadding } from '@visactor/vutils';
4
4
  import type { RecursivePartial } from './base';
5
5
  import type { BasicEncoderSpecMap } from './mark';
@@ -20,6 +20,7 @@ export interface IComponentTheme {
20
20
  slider?: RecursivePartial<SliderAttributes>;
21
21
  dataLabel?: RecursivePartial<DataLabelAttrs>;
22
22
  lineLabel?: RecursivePartial<LineLabelAttrs>;
23
+ areaLabel?: RecursivePartial<AreaLabelAttrs>;
23
24
  rectLabel?: RecursivePartial<RectLabelAttrs>;
24
25
  arcLabel?: RecursivePartial<ArcLabelAttrs>;
25
26
  symbolLabel?: RecursivePartial<SymbolLabelAttrs>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineDataLabelAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n lineDataLabel?: RecursivePartial<LineDataLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineDataLabelAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes,\n AreaLabelAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n areaLabel?: RecursivePartial<AreaLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n lineDataLabel?: RecursivePartial<LineDataLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vgrammar-core",
3
- "version": "0.9.0-alpha.0",
3
+ "version": "0.9.0",
4
4
  "description": "VGrammar is a visual grammar library",
5
5
  "keywords": [
6
6
  "grammar",
@@ -24,14 +24,14 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@visactor/vgrammar-coordinate": "0.9.0-alpha.0",
28
- "@visactor/vgrammar-util": "0.9.0-alpha.0",
29
- "@visactor/vscale": "~0.16.7",
30
- "@visactor/vrender-core": "~0.16.13",
31
- "@visactor/vrender-kits": "~0.16.13",
32
- "@visactor/vrender-components": "~0.16.13",
33
- "@visactor/vutils": "~0.16.7",
34
- "@visactor/vdataset": "~0.16.7"
27
+ "@visactor/vgrammar-coordinate": "0.9.0",
28
+ "@visactor/vgrammar-util": "0.9.0",
29
+ "@visactor/vscale": "~0.16.9",
30
+ "@visactor/vrender-core": "~0.16.15",
31
+ "@visactor/vrender-kits": "~0.16.15",
32
+ "@visactor/vrender-components": "~0.16.15",
33
+ "@visactor/vutils": "~0.16.9",
34
+ "@visactor/vdataset": "~0.16.9"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rushstack/eslint-patch": "~1.1.4",
@@ -45,9 +45,9 @@
45
45
  "@types/jest": "~29.5.0",
46
46
  "typescript": "4.9.5",
47
47
  "@internal/bundler": "0.0.1",
48
- "@internal/eslint-config": "0.0.1",
48
+ "@internal/jest-config": "0.0.1",
49
49
  "@internal/ts-config": "0.0.1",
50
- "@internal/jest-config": "0.0.1"
50
+ "@internal/eslint-config": "0.0.1"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public",