@visactor/vrender-components 0.21.9-alpha.1 → 0.21.10

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n };\n\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * @since 0.21.3\n * 水平方向时,一行中多个图例的垂直对齐方式\n */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n};\n\nexport type DiscreteLegendAttrs = {\n /**\n * 是否开启选中交互\n */\n select?:\n | boolean\n | {\n /** @since 0.20.13 */\n trigger?: GraphicEventType;\n };\n\n /**\n * 是否开启 hover 交互\n */\n hover?:\n | boolean\n | {\n /** @since 0.20.13 */\n trigger?: GraphicEventType;\n /** @since 0.20.13 */\n triggerOff?: GraphicEventType;\n };\n /**\n * 图例数据\n */\n items: LegendItemDatum[];\n /**\n * 默认选中的图例项\n */\n defaultSelected?: (string | number)[];\n /**\n * 单选/多选模式配置,默认 'multiple'。\n * - `single` 表示单选\n * - `multiple` 表示多选\n * - `focus` 表示聚焦模式 (自 0.19.2版本开始支持)\n */\n selectMode?: 'single' | 'multiple' | 'focus';\n /**\n * 是否允许图例全部取消,多选模式下生效\n */\n allowAllCanceled?: boolean;\n /**\n * 图例项的顺序是否要逆序,默认为 false\n */\n reversed?: boolean;\n /**\n * 图例项相关的配置\n */\n item?: LegendItem;\n /**\n * 最大宽度,决定 layout : 'horizontal' 是否自动换行\n */\n maxWidth?: number;\n /**\n * 最大高度,决定是否分页\n */\n maxHeight?: number;\n /**\n * 最大行数,当且仅当 layout 为 'horizontal' 时生效\n */\n maxRow?: number;\n /**\n * 最大列数,当且仅当 layout 为 'vertical' 时生效\n */\n maxCol?: number;\n /**\n * 延迟渲染,按需渲染图例项目\n */\n lazyload?: boolean;\n /**\n * 是否进行自动分页,默认为 true\n */\n autoPage?: boolean;\n /**\n * 翻页器配置\n */\n pager?: LegendPagerAttributes | LegendScrollbarAttributes;\n} & LegendBaseAttributes;\n"]}
1
+ {"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\n/**\n * 离散类型的图例组件,当图例项较多的时候,默认使用分页器组件\n */\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n };\n\n/**\n * 离散类型的图例组件使用滚动条组件的时候对应的配置\n */\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n /**\n * 将翻页器的类型设置为 'scrollbar'\n * 申明图例组件使用滚动条进行翻页展示更多的图例项\n */\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * 水平方向时,一行中多个图例的垂直对齐方式\n * @since 0.21.3\n */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n};\n\nexport type DiscreteLegendAttrs = {\n /**\n * 是否开启选中交互\n */\n select?:\n | boolean\n | {\n /**\n * 触发选中交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n };\n\n /**\n * 是否开启 hover 交互\n */\n hover?:\n | boolean\n | {\n /**\n * 触发hover交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n /**\n * 触发取消hover交互的事件类型\n * @since 0.20.13\n **/\n triggerOff?: GraphicEventType;\n };\n /**\n * 图例数据\n */\n items: LegendItemDatum[];\n /**\n * 默认选中的图例项\n */\n defaultSelected?: (string | number)[];\n /**\n * 单选/多选模式配置,默认 'multiple'。\n * - `single` 表示单选\n * - `multiple` 表示多选\n * - `focus` 表示聚焦模式 (自 0.19.2版本开始支持)\n */\n selectMode?: 'single' | 'multiple' | 'focus';\n /**\n * 是否允许图例全部取消,多选模式下生效\n */\n allowAllCanceled?: boolean;\n /**\n * 图例项的顺序是否要逆序,默认为 false\n */\n reversed?: boolean;\n /**\n * 图例项相关的配置\n */\n item?: LegendItem;\n /**\n * 最大宽度,决定 layout : 'horizontal' 是否自动换行\n */\n maxWidth?: number;\n /**\n * 最大高度,决定是否分页\n */\n maxHeight?: number;\n /**\n * 最大行数,当且仅当 layout 为 'horizontal' 时生效\n */\n maxRow?: number;\n /**\n * 最大列数,当且仅当 layout 为 'vertical' 时生效\n */\n maxCol?: number;\n /**\n * 延迟渲染,按需渲染图例项目\n */\n lazyload?: boolean;\n /**\n * 是否进行自动分页,默认为 true\n */\n autoPage?: boolean;\n /**\n * 翻页器配置\n */\n pager?: LegendPagerAttributes | LegendScrollbarAttributes;\n} & LegendBaseAttributes;\n"]}
package/es/marker/area.js CHANGED
@@ -38,23 +38,14 @@ export class MarkArea extends Marker {
38
38
  this.defaultExitAnimation = DefaultExitMarkerAnimation;
39
39
  }
40
40
  getPointAttrByPosition(position) {
41
- const {x1: x1, x2: x2, y1: y1, y2: y2} = this._area.AABBBounds;
42
- return position.includes("left") || position.includes("Left") ? {
43
- x: x1,
44
- y: (y1 + y2) / 2
45
- } : position.includes("right") || position.includes("Right") ? {
46
- x: x2,
47
- y: (y1 + y2) / 2
48
- } : position.includes("top") || position.includes("Top") ? {
49
- x: (x1 + x2) / 2,
50
- y: y1
51
- } : position.includes("bottom") || position.includes("Bottom") ? {
52
- x: (x1 + x2) / 2,
53
- y: y2
54
- } : {
41
+ const {x1: x1, x2: x2, y1: y1, y2: y2} = this._area.AABBBounds, result = {
55
42
  x: (x1 + x2) / 2,
56
43
  y: (y1 + y2) / 2
57
44
  };
45
+ return (position.includes("left") || position.includes("Left")) && (result.x = x1),
46
+ (position.includes("right") || position.includes("Right")) && (result.x = x2), (position.includes("top") || position.includes("Top")) && (result.y = y1),
47
+ (position.includes("bottom") || position.includes("Bottom")) && (result.y = y2),
48
+ result;
58
49
  }
59
50
  setLabelPos() {
60
51
  var _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/area.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0CAA0C,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhH,q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AAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AA/IM,0BAAiB,GAAG,uBAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP, DEFAULT_MARK_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, IMarkAreaLabelPosition, MarkAreaAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkAreaComponent } from './register';\nimport type { Point } from '../core/type';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markAreaAnimate } from './animate/animate';\n\nloadMarkAreaComponent();\n\nexport function registerMarkAreaAnimate() {\n MarkArea._animate = markAreaAnimate;\n}\n\nexport class MarkArea extends Marker<MarkAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArea';\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArea._animate && this._animationConfig) {\n MarkArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n private _area!: IPolygon;\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkAreaLabelPosition) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n\n if (position.includes('left') || position.includes('Left')) {\n return {\n x: x1,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('right') || position.includes('Right')) {\n return {\n x: x2,\n y: (y1 + y2) / 2\n };\n }\n if (position.includes('top') || position.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1\n };\n }\n if (position.includes('bottom') || position.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2\n };\n }\n\n return {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as MarkAreaAttrs;\n const labelPosition = label.position ?? 'middle';\n const labelPoint = this.getPointAttrByPosition(labelPosition as IMarkAreaLabelPosition);\n this._label.setAttributes({\n ...labelPoint,\n textStyle: {\n ...DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition],\n ...label.textStyle\n }\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, label, areaStyle, state } = this.attribute as MarkAreaAttrs;\n const area = graphicCreator.polygon({\n points: points,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'mark-area-polygon';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, label, areaStyle, state } = this.attribute as MarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n points: points,\n ...areaStyle\n });\n this._area.states = merge({}, DEFAULT_STATES, state?.area);\n }\n if (this._label) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as MarkAreaAttrs;\n if (!points || points.length < 3) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point) => {\n if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/area.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0CAA0C,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhH,qBAAqB,EAAE,CAAC;AAExB,MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,eAAe,CAAC;AACtC,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,MAAkD;IAOpE,aAAa,CAAC,KAA2B;QACjD,IAAI,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAA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AAE,EAAE,CAAC,IACD,KAAuB,KAC3B,KAAK,EAAE;oBACL,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;oBACxD,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;iBAC9C,IACD,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAA0B,CAAC;QACnD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,EAAE;YAC9B,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBAC5E,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AApIM,0BAAiB,GAAG,uBAAuB,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP, DEFAULT_MARK_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, IMarkAreaLabelPosition, MarkAreaAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkAreaComponent } from './register';\nimport type { Point } from '../core/type';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markAreaAnimate } from './animate/animate';\n\nloadMarkAreaComponent();\n\nexport function registerMarkAreaAnimate() {\n MarkArea._animate = markAreaAnimate;\n}\n\nexport class MarkArea extends Marker<MarkAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArea';\n static defaultAttributes = DEFAULT_MARK_AREA_THEME;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArea._animate && this._animationConfig) {\n MarkArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n private _area!: IPolygon;\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkAreaLabelPosition) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n const result = {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n };\n\n if (position.includes('left') || position.includes('Left')) {\n result.x = x1;\n }\n if (position.includes('right') || position.includes('Right')) {\n result.x = x2;\n }\n if (position.includes('top') || position.includes('Top')) {\n result.y = y1;\n }\n if (position.includes('bottom') || position.includes('Bottom')) {\n result.y = y2;\n }\n\n return result;\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as MarkAreaAttrs;\n const labelPosition = label.position ?? 'middle';\n const labelPoint = this.getPointAttrByPosition(labelPosition as IMarkAreaLabelPosition);\n this._label.setAttributes({\n ...labelPoint,\n textStyle: {\n ...DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition],\n ...label.textStyle\n }\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { points, label, areaStyle, state } = this.attribute as MarkAreaAttrs;\n const area = graphicCreator.polygon({\n points: points,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'mark-area-polygon';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, label, areaStyle, state } = this.attribute as MarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n points: points,\n ...areaStyle\n });\n this._area.states = merge({}, DEFAULT_STATES, state?.area);\n }\n if (this._label) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as MarkAreaAttrs;\n if (!points || points.length < 3) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point) => {\n if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAN,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;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IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n topLeft = 'topLeft',\n topRight = 'topRight',\n bottomLeft = 'bottomLeft',\n bottomRight = 'bottomRight',\n\n middle = 'middle',\n\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideTopLeft = 'insideTopLeft',\n insideTopRight = 'insideTopRight',\n insideBottomLeft = 'insideBottomLeft',\n insideBottomRight = 'insideBottomRight'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是true, 保持不变\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n type: 'fadeOut';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n line?: State<LineAttr>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n area?: State<Partial<AreaAttr>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n style?: ISymbol;\n };\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
1
+ {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":"AAmBA,MAAM,CAAN,IAAY,sBAkBX;AAlBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,+CAAqB,CAAA;IACrB,qDAA2B,CAAA;IAC3B,qDAA2B,CAAA;IAC3B,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IAEvC,2CAAiB,CAAA;IACjB,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAlBW,sBAAsB,KAAtB,sBAAsB,QAkBjC;AAED,MAAM,CAAN,IAAY,sBAoBX;AApBD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,6CAAmB,CAAA;IACnB,+CAAqB,CAAA;IACrB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAE3B,2CAAiB,CAAA;IAEjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,yDAA+B,CAAA;IAC/B,2DAAiC,CAAA;IACjC,+DAAqC,CAAA;IACrC,iEAAuC,CAAA;AACzC,CAAC,EApBW,sBAAsB,KAAtB,sBAAsB,QAoBjC;AAED,MAAM,CAAN,IAAY,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,KAA3B,2BAA2B,QAQtC;AAED,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbol,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes } from '../segment/type';\nimport type { TagAttributes } from '../tag/type';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n startTop = 'startTop',\n startBottom = 'startBottom',\n insideStart = 'insideStart',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n\n middle = 'middle',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n\n end = 'end',\n endTop = 'endTop',\n endBottom = 'endBottom',\n insideEnd = 'insideEnd',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n topLeft = 'topLeft',\n topRight = 'topRight',\n bottomLeft = 'bottomLeft',\n bottomRight = 'bottomRight',\n\n middle = 'middle',\n\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideTopLeft = 'insideTopLeft',\n insideTopRight = 'insideTopRight',\n insideBottomLeft = 'insideBottomLeft',\n insideBottomRight = 'insideBottomRight'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向\n * @default\n * mark-line/mark-area/mark-point: false - 旧逻辑里autoRotate是false, 保持不变\n * mark-arc-line/mark-arc-area: true - 新增逻辑, 如果不开启的话, 效果不太好, 所以默认true\n * mark-point - 旧逻辑里autoRotate是true, 保持不变\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n /**\n * 设置标注的类型\n */\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n /**\n * 绘制范围的起点x坐标\n */\n x: number;\n /**\n * 绘制范围的起点y坐标\n */\n y: number;\n /**\n * 绘制范围的宽度\n */\n width: number;\n /**\n * 绘制范围的高度\n */\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n /**\n * 动画公共配置\n */\n animation?: MarkerAnimation<T> | boolean;\n /**\n * 入场动画配置\n */\n animationEnter?: MarkerUpdateAnimation<T>;\n /**\n * 更新动画配置\n */\n animationUpdate?: MarkerUpdateAnimation<T>;\n /**\n * 离场动画配置\n */\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n /**\n * 设置动画的类型\n */\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkCommonLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n /**\n * 设置离场动画的类型为fadeOut,即淡出\n */\n type: 'fadeOut';\n /**\n * 动画的时长\n */\n duration?: number;\n /**\n * 动画延迟的时长\n */\n delay?: number;\n /**\n * 动画的缓动函数\n */\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type MarkCommonLineState<LineAttr> = {\n /**\n * 设置线图形的在特定状态下的样式\n */\n line?: State<LineAttr>;\n /**\n * 设置线的起点在特定状态下的样式\n */\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置线的终点在特定状态下的样式\n */\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标签在特定状态下的样式\n */\n label?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n /**\n * 设置标注区域在特定状态下的样式\n */\n area?: State<Partial<AreaAttr>>;\n /**\n * 设置标注区域标签在特定状态下的样式\n */\n label?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n /**\n * 设置标注点连线在特定状态下的样式\n */\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n /**\n * 设置线起点图形在特定状态下的样式\n */\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置线终点图形在特定状态下的样式\n */\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标注图形在特定状态下的样式\n */\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n /**\n * 设置标注图形在特定状态下的样式\n */\n image?: State<Partial<IImageGraphicAttribute>>;\n /**\n * 设置标签在特定状态下的样式\n */\n text?: State<Partial<ITextGraphicAttribute>>;\n /**\n * 设置标签背景区块在特定状态下的样式\n */\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n /**\n * 设置富文本在特定状态下的样式\n */\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n /**\n * 设置自定义标注图形在特定状态下的样式\n */\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n /**\n * 设置目标元素在特定状态下的样式\n */\n targetItem?: State<Partial<ISymbolGraphicAttribute>>;\n};\n\nexport type MarkCommonLineAttrs<LineAttr, LineLabelPosition, MarkCommonLineAnimationType> =\n MarkerAttrs<MarkCommonLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * 辅助线各种状态下的样式\n */\n state?: MarkCommonLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = MarkCommonLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n MarkCommonLineAnimationType\n> & {\n /**\n * 将辅助线的类型设置为 'line'\n */\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为折线\n */\n points: Point[] | Point[][];\n /**\n * 线的样式设置\n */\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = MarkCommonLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n MarkCommonLineAnimationType\n> & {\n /**\n * 将辅助线的类型设置为 'arc-line',即弧线\n */\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n /**\n * 设置弧线的样式\n */\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n /**\n * 设置标签的位置\n */\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n /**\n * 设置标注区域在各种状态下的样式\n */\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n /**\n * 标签的位置\n */\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n /**\n * 辅助区域这种状态下各个图元的样式设置\n */\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n /**\n * 设置标注的位置\n */\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op' | 'type-arc';\n /**\n * 是否展示该标注\n */\n visible?: boolean;\n /**\n * 当type为type-arc时生效, 数值决定曲率, 符号决定法向, 不能等于0\n * @default 0.8\n */\n arcRatio?: number;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n /**\n * 是否显示引导线的装饰线\n */\n visible?: boolean;\n /**\n * 装饰线的长度\n */\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n /**\n * 被标注的内容\n */\n targetSymbol?: {\n /**\n * 被标注内容与标记线间的间隙\n * @default 0\n */\n offset?: number;\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 大小\n * @default 20\n */\n size?: number;\n /**\n * 被标注内容的样式设置\n */\n style?: ISymbol;\n };\n /**\n * 标注点各个状态下的样式\n */\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /** 位置,参考arco design */\n position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /** 标题样式 */\n titleStyle?: Partial<ITextGraphicAttribute>;\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /** 内容文本样式 */\n contentStyle?: Partial<ITextGraphicAttribute>;\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n */\n panel?: BackgroundAttributes & ISymbolGraphicAttribute & { space?: number };\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n // 最大宽度比例\n maxWidthPercent?: number;\n\n visible?: boolean;\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
1
+ {"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /**\n * 标题样式\n */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题的格式化方法\n */\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /**\n * 内容文本样式\n */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容的格式化方法\n */\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n */\n panel?: BackgroundAttributes & ISymbolGraphicAttribute & { space?: number };\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n /**\n * 最大宽度比例\n */\n maxWidthPercent?: number;\n /**\n * 是否展示\n */\n visible?: boolean;\n /**\n * 自定义的展示逻辑\n */\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.21.9-alpha.1",
3
+ "version": "0.21.10",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -14,8 +14,8 @@
14
14
  "dependencies": {
15
15
  "@visactor/vutils": "~0.19.3",
16
16
  "@visactor/vscale": "~0.19.3",
17
- "@visactor/vrender-core": "0.21.9-alpha.1",
18
- "@visactor/vrender-kits": "0.21.9-alpha.1"
17
+ "@visactor/vrender-core": "0.21.10",
18
+ "@visactor/vrender-kits": "0.21.10"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rushstack/eslint-patch": "~1.1.4",
@@ -30,8 +30,8 @@
30
30
  "typescript": "4.9.5",
31
31
  "cross-env": "^7.0.3",
32
32
  "@internal/bundler": "0.0.1",
33
- "@internal/ts-config": "0.0.1",
34
- "@internal/eslint-config": "0.0.1"
33
+ "@internal/eslint-config": "0.0.1",
34
+ "@internal/ts-config": "0.0.1"
35
35
  },
36
36
  "keywords": [
37
37
  "VisActor",