@macroui/echarts-vue 1.0.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.
- package/LICENSE +21 -0
- package/README.md +550 -0
- package/README.zh-Hans.md +518 -0
- package/dist/graphic.d.ts +2786 -0
- package/dist/graphic.js +673 -0
- package/dist/graphic.js.map +1 -0
- package/dist/index-CJnrqQei.d.ts +219 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +741 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +5 -0
- package/dist/index.min.js.map +1 -0
- package/dist/runtime-CcSlBnVC.js +55 -0
- package/dist/runtime-CcSlBnVC.js.map +1 -0
- package/dist/style.css +3 -0
- package/package.json +92 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphic.js","names":[],"sources":["../src/graphic/props-common.ts","../src/graphic/props-shape.ts","../src/graphic/build.ts","../src/graphic/collector.ts","../src/graphic/context.ts","../src/graphic/identity.ts","../src/graphic/marker.ts","../src/graphic/order.ts","../src/graphic/mount.ts","../src/graphic/extension.ts","../src/graphic/component-factory.ts","../src/graphic/components.ts","../src/graphic/index.ts"],"sourcesContent":["import type { ExtractPublicPropTypes, PropType } from \"vue\";\n\nexport const COMMON_PROP_KEYS = [\n \"id\",\n \"x\",\n \"y\",\n \"rotation\",\n \"scaleX\",\n \"scaleY\",\n \"originX\",\n \"originY\",\n \"left\",\n \"right\",\n \"top\",\n \"bottom\",\n \"width\",\n \"height\",\n \"bounding\",\n \"z\",\n \"zlevel\",\n \"silent\",\n \"draggable\",\n \"cursor\",\n \"ignore\",\n \"invisible\",\n \"progressive\",\n \"info\",\n \"focus\",\n \"blurScope\",\n \"textContent\",\n \"textConfig\",\n \"transition\",\n \"enterFrom\",\n \"leaveTo\",\n \"enterAnimation\",\n \"updateAnimation\",\n \"leaveAnimation\",\n \"keyframeAnimation\",\n] as const;\n\nexport const BASE_STYLE_KEYS = [\n \"fill\",\n \"stroke\",\n \"lineWidth\",\n \"lineDash\",\n \"lineDashOffset\",\n \"lineCap\",\n \"lineJoin\",\n \"miterLimit\",\n \"shadowBlur\",\n \"shadowOffsetX\",\n \"shadowOffsetY\",\n \"shadowColor\",\n \"opacity\",\n \"blend\",\n] as const;\n\nexport const TEXT_STYLE_KEYS = [\n \"text\",\n \"font\",\n \"textFill\",\n \"textStroke\",\n \"textStrokeWidth\",\n \"textAlign\",\n \"textVerticalAlign\",\n \"textLineHeight\",\n \"textShadowBlur\",\n \"textShadowOffsetX\",\n \"textShadowOffsetY\",\n \"textShadowColor\",\n \"width\",\n \"overflow\",\n \"ellipsis\",\n] as const;\n\nexport const IMAGE_STYLE_KEYS = [\"image\", \"x\", \"y\", \"width\", \"height\"] as const;\n\nexport const STYLE_KEYS_BY_TYPE = {\n text: TEXT_STYLE_KEYS,\n image: IMAGE_STYLE_KEYS,\n} as const;\n\nexport type GraphicCommonPropKey = (typeof COMMON_PROP_KEYS)[number];\nexport type GraphicBaseStyleKey = (typeof BASE_STYLE_KEYS)[number];\nexport type GraphicTextStyleKey = (typeof TEXT_STYLE_KEYS)[number];\nexport type GraphicImageStyleKey = (typeof IMAGE_STYLE_KEYS)[number];\n\ntype GraphicTextStyleOnlyKey = Exclude<GraphicTextStyleKey, \"width\">;\ntype GraphicImageStyleOnlyKey = Exclude<GraphicImageStyleKey, \"x\" | \"y\" | \"width\" | \"height\">;\nconst ImageElement = typeof HTMLImageElement === \"undefined\" ? Object : HTMLImageElement;\nconst CanvasElement = typeof HTMLCanvasElement === \"undefined\" ? Object : HTMLCanvasElement;\nconst VideoElement = typeof HTMLVideoElement === \"undefined\" ? Object : HTMLVideoElement;\n\nconst graphicCommonOnlyProps = {\n id: [String, Number] as PropType<string | number>,\n x: Number,\n y: Number,\n rotation: Number,\n scaleX: Number,\n scaleY: Number,\n originX: Number,\n originY: Number,\n left: [String, Number] as PropType<string | number>,\n right: [String, Number] as PropType<string | number>,\n top: [String, Number] as PropType<string | number>,\n bottom: [String, Number] as PropType<string | number>,\n width: [String, Number] as PropType<string | number>,\n height: [String, Number] as PropType<string | number>,\n bounding: String,\n z: Number,\n zlevel: Number,\n silent: Boolean,\n draggable: [Boolean, String] as PropType<boolean | \"horizontal\" | \"vertical\">,\n cursor: String,\n ignore: Boolean,\n invisible: Boolean,\n progressive: Number,\n info: null as unknown as PropType<unknown>,\n focus: String,\n blurScope: String,\n textContent: Object as PropType<Record<string, unknown>>,\n textConfig: Object as PropType<Record<string, unknown>>,\n transition: [String, Array] as PropType<string | string[]>,\n enterFrom: Object as PropType<Record<string, unknown>>,\n leaveTo: Object as PropType<Record<string, unknown>>,\n enterAnimation: Object as PropType<Record<string, unknown>>,\n updateAnimation: Object as PropType<Record<string, unknown>>,\n leaveAnimation: Object as PropType<Record<string, unknown>>,\n keyframeAnimation: Object as PropType<Record<string, unknown>>,\n} as const satisfies Record<GraphicCommonPropKey, unknown>;\n\nconst baseStyleProps = {\n fill: String,\n stroke: String,\n lineWidth: Number,\n lineDash: [String, Array] as PropType<string | number[]>,\n lineDashOffset: Number,\n lineCap: String,\n lineJoin: String,\n miterLimit: Number,\n shadowBlur: Number,\n shadowOffsetX: Number,\n shadowOffsetY: Number,\n shadowColor: String,\n opacity: Number,\n blend: String,\n} as const satisfies Record<GraphicBaseStyleKey, unknown>;\n\nconst textStyleProps = {\n text: String,\n font: String,\n textFill: String,\n textStroke: String,\n textStrokeWidth: Number,\n textAlign: String,\n textVerticalAlign: String,\n textLineHeight: Number,\n textShadowBlur: Number,\n textShadowOffsetX: Number,\n textShadowOffsetY: Number,\n textShadowColor: String,\n overflow: String,\n ellipsis: String,\n} as const satisfies Record<GraphicTextStyleOnlyKey, unknown>;\n\nconst imageStyleProps = {\n image: [String, ImageElement, CanvasElement, VideoElement] as PropType<\n string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement\n >,\n} as const satisfies Record<GraphicImageStyleOnlyKey, unknown>;\n\nexport const commonProps = {\n ...graphicCommonOnlyProps,\n shape: Object as PropType<Record<string, unknown>>,\n style: Object as PropType<Record<string, unknown>>,\n shapeTransition: [String, Array] as PropType<string | string[]>,\n styleTransition: [String, Array] as PropType<string | string[]>,\n ...baseStyleProps,\n ...textStyleProps,\n ...imageStyleProps,\n} as const;\n\nexport type GraphicCommonProps = ExtractPublicPropTypes<typeof commonProps>;\n","import type { ExtractPublicPropTypes, PropType } from \"vue\";\n\nimport type { GraphicComponentType } from \"./marker\";\n\nexport const SHAPE_KEYS_BY_TYPE = {\n rect: [\"x\", \"y\", \"width\", \"height\", \"r\"],\n circle: [\"cx\", \"cy\", \"r\"],\n sector: [\"cx\", \"cy\", \"r\", \"r0\", \"startAngle\", \"endAngle\", \"clockwise\", \"cornerRadius\"],\n ring: [\"cx\", \"cy\", \"r\", \"r0\"],\n arc: [\"cx\", \"cy\", \"r\", \"r0\", \"startAngle\", \"endAngle\", \"clockwise\"],\n line: [\"x1\", \"y1\", \"x2\", \"y2\", \"percent\"],\n polyline: [\"points\", \"smooth\", \"smoothConstraint\"],\n polygon: [\"points\", \"smooth\", \"smoothConstraint\"],\n bezierCurve: [\"x1\", \"y1\", \"x2\", \"y2\", \"cpx1\", \"cpy1\", \"cpx2\", \"cpy2\", \"percent\"],\n compoundPath: [\"paths\"],\n} as const satisfies Partial<Record<GraphicComponentType, readonly string[]>>;\n\nexport const shapeProps = {\n x: Number,\n y: Number,\n cx: Number,\n cy: Number,\n r: [Number, Array] as PropType<number | number[]>,\n r0: Number,\n x1: Number,\n y1: Number,\n x2: Number,\n y2: Number,\n cpx1: Number,\n cpy1: Number,\n cpx2: Number,\n cpy2: Number,\n startAngle: Number,\n endAngle: Number,\n percent: Number,\n points: Array as PropType<Array<[number, number]>>,\n smooth: [Boolean, Number] as PropType<boolean | number>,\n smoothConstraint: Array as PropType<Array<[number, number]>>,\n paths: Array as PropType<unknown[]>,\n clockwise: Boolean,\n cornerRadius: [Number, Array] as PropType<number | number[]>,\n} as const;\n\nexport type GraphicShapeProps = ExtractPublicPropTypes<typeof shapeProps>;\n","import type { Option } from \"../types\";\nimport { parseOnEvent } from \"../utils\";\nimport { BASE_STYLE_KEYS, COMMON_PROP_KEYS, STYLE_KEYS_BY_TYPE } from \"./props-common\";\nimport { SHAPE_KEYS_BY_TYPE } from \"./props-shape\";\nimport type { GraphicNode } from \"./collector\";\n\nconst EMPTY_PROP_KEYS: readonly string[] = [];\n\ntype GraphicEventHandler = (...args: unknown[]) => void;\n\nfunction resolveShapeKeys(type: string): readonly string[] {\n return SHAPE_KEYS_BY_TYPE[type as keyof typeof SHAPE_KEYS_BY_TYPE] ?? EMPTY_PROP_KEYS;\n}\n\nfunction resolveStyleKeys(type: string): readonly string[] {\n return STYLE_KEYS_BY_TYPE[type as keyof typeof STYLE_KEYS_BY_TYPE] ?? EMPTY_PROP_KEYS;\n}\n\nfunction mergeProps(\n target: Record<string, unknown>,\n keys: readonly string[],\n props: Record<string, unknown>,\n): void {\n for (const key of keys) {\n if (props[key] !== undefined) {\n target[key] = props[key];\n }\n }\n}\n\nfunction buildStyle(\n props: Record<string, unknown>,\n extraKeys: readonly string[],\n): Record<string, unknown> | undefined {\n const style = { ...(props.style as Record<string, unknown> | undefined) };\n mergeProps(style, BASE_STYLE_KEYS, props);\n mergeProps(style, extraKeys, props);\n\n if (props.styleTransition !== undefined) {\n style.transition = props.styleTransition;\n }\n\n return Object.keys(style).length > 0 ? style : undefined;\n}\n\nfunction buildShape(\n type: string,\n props: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n const shape = { ...(props.shape as Record<string, unknown> | undefined) };\n mergeProps(shape, resolveShapeKeys(type), props);\n\n if (props.shapeTransition !== undefined) {\n shape.transition = props.shapeTransition;\n }\n\n return Object.keys(shape).length > 0 ? shape : undefined;\n}\n\nfunction buildCommon(type: string, props: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n const shapeKeys = resolveShapeKeys(type);\n const styleKeys = resolveStyleKeys(type);\n\n for (const key of COMMON_PROP_KEYS) {\n if (shapeKeys.includes(key) || styleKeys.includes(key)) {\n continue;\n }\n\n if (props[key] !== undefined) {\n out[key] = props[key];\n }\n }\n\n return out;\n}\n\nfunction toEventHandler(value: unknown, once: boolean): GraphicEventHandler | undefined {\n const handlers: GraphicEventHandler[] = [];\n\n if (typeof value === \"function\") {\n handlers.push(value as GraphicEventHandler);\n } else if (Array.isArray(value)) {\n for (const item of value) {\n if (typeof item === \"function\") {\n handlers.push(item as GraphicEventHandler);\n }\n }\n }\n\n if (handlers.length === 0) {\n return undefined;\n }\n\n const invoke = (...args: unknown[]): void => {\n for (const handler of handlers) {\n handler(...args);\n }\n };\n\n if (!once) {\n return invoke;\n }\n\n let called = false;\n return (...args: unknown[]): void => {\n if (called) {\n return;\n }\n called = true;\n invoke(...args);\n };\n}\n\nfunction buildHandlers(\n handlers: Record<string, unknown>,\n): Record<string, GraphicEventHandler> | undefined {\n const out: Record<string, GraphicEventHandler> = {};\n\n for (const [key, value] of Object.entries(handlers)) {\n const descriptor = parseOnEvent(key);\n if (!descriptor) {\n continue;\n }\n\n const handler = toEventHandler(value, descriptor.once);\n if (!handler) {\n continue;\n }\n\n const eventKey = `on${descriptor.event}`;\n const existing = out[eventKey];\n if (!existing) {\n out[eventKey] = handler;\n continue;\n }\n\n out[eventKey] = (...args: unknown[]): void => {\n existing(...args);\n handler(...args);\n };\n }\n\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction toElement(node: GraphicNode, children?: Option[]): Option {\n const { type, id, props } = node;\n const styleKeys = resolveStyleKeys(type);\n const out: Record<string, unknown> = {\n type,\n id,\n };\n\n Object.assign(out, buildCommon(type, props));\n\n const handlers = buildHandlers(node.handlers);\n if (handlers) {\n Object.assign(out, handlers);\n }\n\n if (props.info !== undefined) {\n out.info = props.info;\n }\n\n if (type === \"group\") {\n if (children?.length) {\n out.children = children;\n }\n return out as Option;\n }\n\n const shape = buildShape(type, props);\n if (shape) {\n out.shape = shape;\n }\n\n const style = buildStyle(props, styleKeys);\n if (style) {\n out.style = style;\n }\n\n return out as Option;\n}\n\nexport function buildOption(nodes: Iterable<GraphicNode>, rootId: string): Option {\n const byParent = new Map<string | null, GraphicNode[]>();\n\n for (const node of nodes) {\n const list = byParent.get(node.parentId);\n if (list) {\n list.push(node);\n continue;\n }\n byParent.set(node.parentId, [node]);\n }\n\n for (const list of byParent.values()) {\n list.sort((a, b) => a.order - b.order);\n }\n\n const childrenOf = (parentId: string | null): Option[] => {\n const list = byParent.get(parentId) ?? [];\n return list.map((node) => {\n if (node.type !== \"group\") {\n return toElement(node);\n }\n return toElement(node, childrenOf(node.id));\n });\n };\n\n return {\n graphic: {\n elements: [\n {\n type: \"group\",\n id: rootId,\n $action: \"replace\",\n children: childrenOf(null),\n },\n ],\n },\n } as Option;\n}\n","import { warn as coreWarn } from \"../utils\";\nimport type { Warn, WarnOptions } from \"../utils\";\n\nexport type GraphicNode = {\n id: string;\n type: string;\n parentId: string | null;\n props: Record<string, unknown>;\n handlers: Record<string, unknown>;\n order: number;\n sourceId: number;\n};\n\nexport type GraphicCollector = {\n beginPass: () => void;\n register: (node: GraphicRegisterNode) => void;\n unregister: (id: string, sourceId?: number) => void;\n warn: Warn;\n getNodes: () => Iterable<GraphicNode>;\n dispose: () => void;\n};\n\nexport type GraphicRegisterNode = Omit<GraphicNode, \"order\"> & { order?: number };\n\nexport function createCollector(options: { onFlush: () => void }): GraphicCollector {\n const { onFlush } = options;\n const nodes = new Map<string, GraphicNode>();\n const warnedKeys = new Set<string>();\n const seenInPass = new Map<string, number>();\n\n let order = 0;\n let pending = false;\n let disposed = false;\n\n function beginPass(): void {\n order = 0;\n seenInPass.clear();\n }\n\n function warn(message: string, options?: WarnOptions): void {\n coreWarn(message, options ? { ...options, onceStore: warnedKeys } : undefined);\n }\n\n function register(node: GraphicRegisterNode): void {\n if (disposed) {\n return;\n }\n\n const seenSource = seenInPass.get(node.id);\n if (seenSource != null && seenSource !== node.sourceId) {\n warn(`Duplicate graphic id \"${node.id}\" detected. Updates may be unstable.`, {\n onceKey: `duplicate-id:${node.id}`,\n });\n }\n\n const nextOrder = node.order ?? order;\n order = Math.max(order, nextOrder + 1);\n\n nodes.set(node.id, { ...node, order: nextOrder });\n seenInPass.set(node.id, node.sourceId);\n requestFlush();\n }\n\n function unregister(id: string, sourceId?: number): void {\n if (disposed) {\n return;\n }\n\n const existing = nodes.get(id);\n if (!existing) {\n return;\n }\n if (sourceId != null && existing.sourceId !== sourceId) {\n return;\n }\n nodes.delete(id);\n requestFlush();\n }\n\n function requestFlush(): void {\n if (disposed || pending) {\n return;\n }\n pending = true;\n queueMicrotask(() => {\n pending = false;\n if (disposed) {\n return;\n }\n onFlush();\n });\n }\n\n function getNodes(): Iterable<GraphicNode> {\n return nodes.values();\n }\n\n function dispose(): void {\n disposed = true;\n pending = false;\n nodes.clear();\n seenInPass.clear();\n warnedKeys.clear();\n }\n\n return {\n beginPass,\n register,\n unregister,\n warn,\n getNodes,\n dispose,\n };\n}\n","import type { InjectionKey, Ref } from \"vue\";\n\nimport type { GraphicCollector } from \"./collector\";\n\nexport const GRAPHIC_COLLECTOR_KEY: InjectionKey<GraphicCollector> = Symbol(\n \"@macroui/echarts-vue:graphic-collector\",\n);\nexport const GRAPHIC_PARENT_ID_KEY: InjectionKey<Ref<string | null>> = Symbol(\n \"@macroui/echarts-vue:graphic-parent-id\",\n);\nexport const GRAPHIC_ORDER_KEY: InjectionKey<Ref<Map<string, number>>> = Symbol(\n \"@macroui/echarts-vue:graphic-order\",\n);\n","export function resolveIdentity(\n propsId: string | number | undefined,\n vnodeKey: unknown,\n uid: number,\n): { id: string; orderKey?: string; missingIdentity: boolean } {\n if (propsId != null) {\n const id = String(propsId);\n return { id, orderKey: `id:${id}`, missingIdentity: false };\n }\n if (vnodeKey != null) {\n const id = String(vnodeKey);\n return { id, orderKey: `key:${id}`, missingIdentity: false };\n }\n return { id: `__ve_graphic_${uid}`, missingIdentity: true };\n}\n\nexport function resolveOrderKey(propsId: unknown, vnodeKey: unknown): string | null {\n if (propsId != null) {\n return `id:${String(propsId)}`;\n }\n if (vnodeKey != null) {\n return `key:${String(vnodeKey)}`;\n }\n return null;\n}\n","export const GRAPHIC_COMPONENT_MARKER = Symbol(\"@macroui/echarts-vue:graphic-component\");\n\nexport type GraphicComponentType =\n | \"group\"\n | \"rect\"\n | \"circle\"\n | \"text\"\n | \"line\"\n | \"polyline\"\n | \"polygon\"\n | \"image\"\n | \"sector\"\n | \"ring\"\n | \"arc\"\n | \"bezierCurve\"\n | \"compoundPath\";\n","import type { VNode } from \"vue\";\n\nimport { resolveOrderKey } from \"./identity\";\nimport { GRAPHIC_COMPONENT_MARKER, type GraphicComponentType } from \"./marker\";\n\nexport function getType(vnode: unknown): GraphicComponentType | null {\n if (!vnode || typeof vnode !== \"object\") {\n return null;\n }\n const type = (vnode as VNode).type as Record<string, unknown> | string | symbol;\n if (!type || typeof type !== \"object\") {\n return null;\n }\n const mark = (type as Record<string | symbol, unknown>)[GRAPHIC_COMPONENT_MARKER];\n return typeof mark === \"string\" ? (mark as GraphicComponentType) : null;\n}\n\nexport function collectOrder(value: unknown, orderMap: Map<string, number>, order: number): number {\n if (Array.isArray(value)) {\n for (const child of value) {\n order = collectOrder(child, orderMap, order);\n }\n return order;\n }\n\n if (!value || typeof value !== \"object\") {\n return order;\n }\n const vnode = value as VNode;\n const type = getType(vnode);\n if (type) {\n const props = vnode.props as Record<string, unknown> | null;\n const identity = resolveOrderKey(props?.id, vnode.key);\n if (identity) {\n orderMap.set(identity, order);\n }\n order += 1;\n }\n\n if (type === \"group\") {\n const slot = (vnode.children as { default?: () => unknown } | null)?.default;\n if (slot) {\n return collectOrder(slot(), orderMap, order);\n }\n }\n\n const children = vnode.children;\n if (Array.isArray(children)) {\n for (const child of children) {\n order = collectOrder(child, orderMap, order);\n }\n }\n return order;\n}\n","import { Teleport, defineComponent, h, onUnmounted, provide, shallowRef } from \"vue\";\n\nimport { isBrowser } from \"../utils\";\nimport type { GraphicCollector } from \"./collector\";\nimport { GRAPHIC_COLLECTOR_KEY, GRAPHIC_ORDER_KEY, GRAPHIC_PARENT_ID_KEY } from \"./context\";\nimport { collectOrder } from \"./order\";\n\nexport const GraphicMount = defineComponent({\n name: \"GraphicMount\",\n props: {\n collector: {\n type: Object as () => GraphicCollector,\n required: true,\n },\n },\n setup(props, { slots }) {\n const { collector } = props;\n const { beginPass } = collector;\n const detachedRoot = isBrowser() ? document.createElement(\"div\") : undefined;\n const parentId = shallowRef<string | null>(null);\n const orderMapRef = shallowRef<Map<string, number>>(new Map());\n\n provide(GRAPHIC_COLLECTOR_KEY, collector);\n provide(GRAPHIC_PARENT_ID_KEY, parentId);\n provide(GRAPHIC_ORDER_KEY, orderMapRef);\n\n onUnmounted(() => {\n detachedRoot?.remove();\n });\n\n return () => {\n beginPass();\n const content = slots.default?.();\n const orderMap = new Map<string, number>();\n collectOrder(content, orderMap, 0);\n orderMapRef.value = orderMap;\n\n return detachedRoot\n ? h(Teleport, { to: detachedRoot }, h(\"div\", { style: { display: \"contents\" } }, content))\n : null;\n };\n },\n});\n","import { h, onScopeDispose } from \"vue\";\nimport { use } from \"echarts/core\";\nimport { GraphicComponent } from \"echarts/components\";\nimport { buildOption } from \"./build\";\nimport { createCollector } from \"./collector\";\nimport { GraphicMount } from \"./mount\";\nimport type { GraphicContext } from \"./runtime\";\nimport { registerRuntime } from \"./runtime\";\n\nconst ROOT_ID = \"__ve_graphic_root__\";\nconst UPDATE_OPTIONS = { replaceMerge: [\"graphic\"] };\nlet componentRegistered = false;\n\nexport function registerExtension(): void {\n if (!componentRegistered) {\n use([GraphicComponent]);\n componentRegistered = true;\n }\n\n registerRuntime((ctx: GraphicContext) => {\n const { slots, manualUpdate, requestUpdate } = ctx;\n let warnedOverride = false;\n\n const collector = createCollector({\n onFlush: handleFlush,\n });\n const { dispose, getNodes, warn } = collector;\n\n function handleFlush(): void {\n const updated = requestUpdate(UPDATE_OPTIONS);\n\n if (!updated && manualUpdate.value) {\n warn(\"`#graphic` slot updates are ignored when `manual-update` is `true`.\", {\n onceKey: \"manual-update-graphic\",\n });\n }\n }\n\n onScopeDispose(dispose);\n\n return {\n patchOption(option) {\n if (!slots.graphic) {\n return option;\n }\n if (option.graphic && !warnedOverride) {\n warn(\n \"`#graphic` slot is provided, so `option.graphic` is ignored. Remove one of them to avoid ambiguity.\",\n );\n warnedOverride = true;\n }\n const nextOption = buildOption(getNodes(), ROOT_ID);\n return {\n ...option,\n graphic: nextOption.graphic,\n };\n },\n render() {\n if (!slots.graphic) {\n return null;\n }\n return h(GraphicMount, { collector }, { default: slots.graphic });\n },\n };\n });\n}\n","import { defineComponent, getCurrentInstance, inject, onUnmounted, provide, shallowRef } from \"vue\";\n\nimport { warn } from \"../utils\";\nimport { GRAPHIC_COLLECTOR_KEY, GRAPHIC_ORDER_KEY, GRAPHIC_PARENT_ID_KEY } from \"./context\";\nimport { resolveIdentity } from \"./identity\";\nimport { GRAPHIC_COMPONENT_MARKER, type GraphicComponentType } from \"./marker\";\nimport { commonProps } from \"./props-common\";\nimport { shapeProps } from \"./props-shape\";\nimport type { GraphicEmits } from \"./types\";\n\nconst componentProps = {\n ...commonProps,\n ...shapeProps,\n} as const;\n\nexport function createComponent(name: string, type: GraphicComponentType) {\n const component = defineComponent({\n name,\n inheritAttrs: false,\n props: componentProps,\n emits: {} as unknown as GraphicEmits,\n setup(props, { attrs, slots }) {\n const instance = getCurrentInstance()!;\n const collector = inject(GRAPHIC_COLLECTOR_KEY, null);\n const parentIdRef = inject(GRAPHIC_PARENT_ID_KEY, null);\n const orderRef = inject(GRAPHIC_ORDER_KEY, null);\n\n if (!collector) {\n warn(`\\`${name}\\` must be used inside \\`#graphic\\` slot.`);\n return () => null;\n }\n const { register: registerNode, unregister, warn: warnScoped } = collector;\n let currentId: string | null = null;\n\n function register(): string {\n const identity = resolveIdentity(props.id, instance.vnode.key, instance.uid);\n if (identity.missingIdentity) {\n warnScoped(\n `\\`${name}\\` is missing \\`id\\` and \\`key\\`. Updates might be unstable in \\`v-for\\`.`,\n {\n onceKey: `missing-id:${instance.uid}`,\n },\n );\n }\n if (currentId && currentId !== identity.id) {\n unregister(currentId, instance.uid);\n }\n currentId = identity.id;\n const hintedOrder = identity.orderKey ? orderRef?.value.get(identity.orderKey) : undefined;\n\n registerNode({\n id: currentId,\n type,\n parentId: parentIdRef?.value ?? null,\n order: hintedOrder,\n props: props as Record<string, unknown>,\n handlers: attrs as Record<string, unknown>,\n sourceId: instance.uid,\n });\n return currentId;\n }\n\n onUnmounted(() => {\n if (currentId) {\n unregister(currentId, instance.uid);\n }\n });\n\n if (type === \"group\") {\n const providedParent = shallowRef<string | null>(null);\n provide(GRAPHIC_PARENT_ID_KEY, providedParent);\n\n return () => {\n providedParent.value = register();\n return slots.default?.() ?? null;\n };\n }\n\n return () => {\n register();\n return null;\n };\n },\n });\n\n (component as unknown as Record<symbol, unknown>)[GRAPHIC_COMPONENT_MARKER] = type;\n\n return component;\n}\n","import { createComponent } from \"./component-factory\";\n\nexport const GGroup = createComponent(\"GGroup\", \"group\");\nexport const GRect = createComponent(\"GRect\", \"rect\");\nexport const GCircle = createComponent(\"GCircle\", \"circle\");\nexport const GText = createComponent(\"GText\", \"text\");\nexport const GLine = createComponent(\"GLine\", \"line\");\nexport const GPolyline = createComponent(\"GPolyline\", \"polyline\");\nexport const GPolygon = createComponent(\"GPolygon\", \"polygon\");\nexport const GImage = createComponent(\"GImage\", \"image\");\nexport const GSector = createComponent(\"GSector\", \"sector\");\nexport const GRing = createComponent(\"GRing\", \"ring\");\nexport const GArc = createComponent(\"GArc\", \"arc\");\nexport const GBezierCurve = createComponent(\"GBezierCurve\", \"bezierCurve\");\nexport const GCompoundPath = createComponent(\"GCompoundPath\", \"compoundPath\");\n","import { registerExtension } from \"./extension\";\nimport \"./slots\";\n\nregisterExtension();\n\nexport type { VChartSlotsExtension } from \"../index\";\nexport type { GraphicEmits, GraphicEventName, GraphicOnEventName } from \"./types\";\nexport type { GraphicCommonProps } from \"./props-common\";\nexport type { GraphicShapeProps } from \"./props-shape\";\n\nexport {\n GGroup,\n GRect,\n GCircle,\n GText,\n GLine,\n GPolyline,\n GPolygon,\n GImage,\n GSector,\n GRing,\n GArc,\n GBezierCurve,\n GCompoundPath,\n} from \"./components\";\n"],"mappings":";;;;;AAEA,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAsBA,MAAa,qBAAqB;CAChC,MAAM;EApBN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAMM;CACN,OAAO;EAJwB;EAAS;EAAK;EAAK;EAAS;CAIpD;AACT;AASA,MAAM,eAAe,OAAO,qBAAqB,cAAc,SAAS;AACxE,MAAM,gBAAgB,OAAO,sBAAsB,cAAc,SAAS;AAC1E,MAAM,eAAe,OAAO,qBAAqB,cAAc,SAAS;AAExE,MAAM,yBAAyB;CAC7B,IAAI,CAAC,QAAQ,MAAM;CACnB,GAAG;CACH,GAAG;CACH,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,MAAM,CAAC,QAAQ,MAAM;CACrB,OAAO,CAAC,QAAQ,MAAM;CACtB,KAAK,CAAC,QAAQ,MAAM;CACpB,QAAQ,CAAC,QAAQ,MAAM;CACvB,OAAO,CAAC,QAAQ,MAAM;CACtB,QAAQ,CAAC,QAAQ,MAAM;CACvB,UAAU;CACV,GAAG;CACH,QAAQ;CACR,QAAQ;CACR,WAAW,CAAC,SAAS,MAAM;CAC3B,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,aAAa;CACb,MAAM;CACN,OAAO;CACP,WAAW;CACX,a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ACX5E,kBAAkB"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { InjectionKey, MaybeRefOrGetter, PropType, SlotsType } from "vue";
|
|
2
|
+
import { ElementEvent, SetOptionOpts, init } from "echarts/core";
|
|
3
|
+
import { TooltipComponentFormatterCallbackParams } from "echarts";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
type Injection<T> = MaybeRefOrGetter<T | null>;
|
|
7
|
+
type InitType = typeof init;
|
|
8
|
+
type InitParameters = Parameters<InitType>;
|
|
9
|
+
type Theme = NonNullable<InitParameters[1]>;
|
|
10
|
+
type ThemeInjection = Injection<Theme>;
|
|
11
|
+
type InitOptions = NonNullable<InitParameters[2]>;
|
|
12
|
+
type InitOptionsInjection = Injection<InitOptions>;
|
|
13
|
+
type UpdateOptions = SetOptionOpts;
|
|
14
|
+
type UpdateOptionsInjection = Injection<UpdateOptions>;
|
|
15
|
+
type EChartsType = ReturnType<InitType>;
|
|
16
|
+
type SetOptionType = EChartsType["setOption"];
|
|
17
|
+
type Option = Parameters<SetOptionType>[0];
|
|
18
|
+
type AutoResize = boolean | {
|
|
19
|
+
throttle?: number;
|
|
20
|
+
onResize?: () => void;
|
|
21
|
+
};
|
|
22
|
+
type LoadingOptions = {
|
|
23
|
+
text?: string;
|
|
24
|
+
textColor?: string;
|
|
25
|
+
fontSize?: number | string;
|
|
26
|
+
fontWeight?: number | string;
|
|
27
|
+
fontStyle?: string;
|
|
28
|
+
fontFamily?: string;
|
|
29
|
+
maskColor?: string;
|
|
30
|
+
showSpinner?: boolean;
|
|
31
|
+
color?: string;
|
|
32
|
+
spinnerRadius?: number;
|
|
33
|
+
lineWidth?: number;
|
|
34
|
+
zlevel?: number;
|
|
35
|
+
};
|
|
36
|
+
type LoadingOptionsInjection = Injection<LoadingOptions>;
|
|
37
|
+
type MouseEventName = "click" | "dblclick" | "mouseout" | "mouseover" | "mouseup" | "mousedown" | "mousemove" | "contextmenu" | "globalout";
|
|
38
|
+
type ElementEventName = MouseEventName | "mousewheel" | "drag" | "dragstart" | "dragend" | "dragenter" | "dragleave" | "dragover" | "drop";
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/composables/api.d.ts
|
|
41
|
+
declare const METHOD_NAMES: readonly ["getWidth", "getHeight", "getDom", "getOption", "resize", "dispatchAction", "convertToPixel", "convertFromPixel", "containPixel", "getDataURL", "getConnectedDataURL", "appendData", "clear", "isDisposed", "dispose"];
|
|
42
|
+
type MethodName = (typeof METHOD_NAMES)[number];
|
|
43
|
+
type PublicMethods = Pick<EChartsType, MethodName>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/composables/loading.d.ts
|
|
46
|
+
declare const LOADING_OPTIONS_KEY: InjectionKey<LoadingOptionsInjection>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/composables/slot.d.ts
|
|
49
|
+
type SlotsTypes = SlotsType<Record<"tooltip" | `tooltip-${string}`, TooltipComponentFormatterCallbackParams> & Record<"dataView" | `dataView-${string}`, Option> & VChartSlotsExtension>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/wc.d.ts
|
|
52
|
+
interface EChartsElement extends HTMLElement {
|
|
53
|
+
__dispose: (() => void) | null;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/ECharts.d.ts
|
|
57
|
+
declare const THEME_KEY: InjectionKey<ThemeInjection>;
|
|
58
|
+
declare const INIT_OPTIONS_KEY: InjectionKey<InitOptionsInjection>;
|
|
59
|
+
declare const UPDATE_OPTIONS_KEY: InjectionKey<UpdateOptionsInjection>;
|
|
60
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
61
|
+
loading: BooleanConstructor;
|
|
62
|
+
loadingOptions: PropType<LoadingOptions>;
|
|
63
|
+
autoresize: PropType<AutoResize>;
|
|
64
|
+
option: PropType<Option>;
|
|
65
|
+
theme: {
|
|
66
|
+
type: PropType<Theme>;
|
|
67
|
+
};
|
|
68
|
+
initOptions: PropType<InitOptions>;
|
|
69
|
+
updateOptions: PropType<UpdateOptions>;
|
|
70
|
+
group: StringConstructor;
|
|
71
|
+
manualUpdate: BooleanConstructor;
|
|
72
|
+
}>, {
|
|
73
|
+
setOption: {
|
|
74
|
+
<Opt extends import("echarts").EChartsCoreOption>(option: Opt, notMerge?: boolean, lazyUpdate?: boolean): void;
|
|
75
|
+
<Opt extends import("echarts").EChartsCoreOption>(option: Opt, opts?: import("echarts").SetOptionOpts): void;
|
|
76
|
+
};
|
|
77
|
+
root: import("vue").ShallowRef<EChartsElement | undefined, EChartsElement | undefined>;
|
|
78
|
+
chart: import("vue").ShallowRef<import("echarts").ECharts | undefined, import("echarts").ECharts | undefined>;
|
|
79
|
+
} & PublicMethods, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
80
|
+
click: (params: import("echarts").ECElementEvent) => void;
|
|
81
|
+
dblclick: (params: import("echarts").ECElementEvent) => void;
|
|
82
|
+
mouseout: (params: import("echarts").ECElementEvent) => void;
|
|
83
|
+
mouseover: (params: import("echarts").ECElementEvent) => void;
|
|
84
|
+
mouseup: (params: import("echarts").ECElementEvent) => void;
|
|
85
|
+
mousedown: (params: import("echarts").ECElementEvent) => void;
|
|
86
|
+
mousemove: (params: import("echarts").ECElementEvent) => void;
|
|
87
|
+
contextmenu: (params: import("echarts").ECElementEvent) => void;
|
|
88
|
+
globalout: (params: import("echarts").ECElementEvent) => void;
|
|
89
|
+
} & {
|
|
90
|
+
highlight: (params: unknown) => void;
|
|
91
|
+
downplay: (params: unknown) => void;
|
|
92
|
+
selectchanged: (params: unknown) => void;
|
|
93
|
+
legendselectchanged: (params: unknown) => void;
|
|
94
|
+
legendselected: (params: unknown) => void;
|
|
95
|
+
legendunselected: (params: unknown) => void;
|
|
96
|
+
legendselectall: (params: unknown) => void;
|
|
97
|
+
legendinverseselect: (params: unknown) => void;
|
|
98
|
+
legendscroll: (params: unknown) => void;
|
|
99
|
+
datazoom: (params: unknown) => void;
|
|
100
|
+
datarangeselected: (params: unknown) => void;
|
|
101
|
+
graphroam: (params: unknown) => void;
|
|
102
|
+
georoam: (params: unknown) => void;
|
|
103
|
+
treeroam: (params: unknown) => void;
|
|
104
|
+
timelinechanged: (params: unknown) => void;
|
|
105
|
+
timelineplaychanged: (params: unknown) => void;
|
|
106
|
+
restore: (params: unknown) => void;
|
|
107
|
+
dataviewchanged: (params: unknown) => void;
|
|
108
|
+
magictypechanged: (params: unknown) => void;
|
|
109
|
+
geoselectchanged: (params: unknown) => void;
|
|
110
|
+
geoselected: (params: unknown) => void;
|
|
111
|
+
geounselected: (params: unknown) => void;
|
|
112
|
+
axisareaselected: (params: unknown) => void;
|
|
113
|
+
brush: (params: unknown) => void;
|
|
114
|
+
brushEnd: (params: unknown) => void;
|
|
115
|
+
brushselected: (params: unknown) => void;
|
|
116
|
+
globalcursortaken: (params: unknown) => void;
|
|
117
|
+
} & {
|
|
118
|
+
rendered: (params: {
|
|
119
|
+
elapsedTime: number;
|
|
120
|
+
}) => void;
|
|
121
|
+
finished: () => void;
|
|
122
|
+
} & {
|
|
123
|
+
"zr:mousewheel": (params: import("echarts").ElementEvent) => void;
|
|
124
|
+
"zr:drag": (params: import("echarts").ElementEvent) => void;
|
|
125
|
+
"zr:dragstart": (params: import("echarts").ElementEvent) => void;
|
|
126
|
+
"zr:dragend": (params: import("echarts").ElementEvent) => void;
|
|
127
|
+
"zr:dragenter": (params: import("echarts").ElementEvent) => void;
|
|
128
|
+
"zr:dragleave": (params: import("echarts").ElementEvent) => void;
|
|
129
|
+
"zr:dragover": (params: import("echarts").ElementEvent) => void;
|
|
130
|
+
"zr:drop": (params: import("echarts").ElementEvent) => void;
|
|
131
|
+
"zr:click": (params: import("echarts").ElementEvent) => void;
|
|
132
|
+
"zr:dblclick": (params: import("echarts").ElementEvent) => void;
|
|
133
|
+
"zr:mouseout": (params: import("echarts").ElementEvent) => void;
|
|
134
|
+
"zr:mouseover": (params: import("echarts").ElementEvent) => void;
|
|
135
|
+
"zr:mouseup": (params: import("echarts").ElementEvent) => void;
|
|
136
|
+
"zr:mousedown": (params: import("echarts").ElementEvent) => void;
|
|
137
|
+
"zr:mousemove": (params: import("echarts").ElementEvent) => void;
|
|
138
|
+
"zr:contextmenu": (params: import("echarts").ElementEvent) => void;
|
|
139
|
+
"zr:globalout": (params: import("echarts").ElementEvent) => void;
|
|
140
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
141
|
+
loading: BooleanConstructor;
|
|
142
|
+
loadingOptions: PropType<LoadingOptions>;
|
|
143
|
+
autoresize: PropType<AutoResize>;
|
|
144
|
+
option: PropType<Option>;
|
|
145
|
+
theme: {
|
|
146
|
+
type: PropType<Theme>;
|
|
147
|
+
};
|
|
148
|
+
initOptions: PropType<InitOptions>;
|
|
149
|
+
updateOptions: PropType<UpdateOptions>;
|
|
150
|
+
group: StringConstructor;
|
|
151
|
+
manualUpdate: BooleanConstructor;
|
|
152
|
+
}>> & Readonly<{
|
|
153
|
+
onClick?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
154
|
+
onDblclick?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
155
|
+
onMouseout?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
156
|
+
onMouseover?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
157
|
+
onMouseup?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
158
|
+
onMousedown?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
159
|
+
onMousemove?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
160
|
+
onContextmenu?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
161
|
+
onGlobalout?: ((params: import("echarts").ECElementEvent) => any) | undefined;
|
|
162
|
+
onHighlight?: ((params: unknown) => any) | undefined;
|
|
163
|
+
onDownplay?: ((params: unknown) => any) | undefined;
|
|
164
|
+
onSelectchanged?: ((params: unknown) => any) | undefined;
|
|
165
|
+
onLegendselectchanged?: ((params: unknown) => any) | undefined;
|
|
166
|
+
onLegendselected?: ((params: unknown) => any) | undefined;
|
|
167
|
+
onLegendunselected?: ((params: unknown) => any) | undefined;
|
|
168
|
+
onLegendselectall?: ((params: unknown) => any) | undefined;
|
|
169
|
+
onLegendinverseselect?: ((params: unknown) => any) | undefined;
|
|
170
|
+
onLegendscroll?: ((params: unknown) => any) | undefined;
|
|
171
|
+
onDatazoom?: ((params: unknown) => any) | undefined;
|
|
172
|
+
onDatarangeselected?: ((params: unknown) => any) | undefined;
|
|
173
|
+
onGraphroam?: ((params: unknown) => any) | undefined;
|
|
174
|
+
onGeoroam?: ((params: unknown) => any) | undefined;
|
|
175
|
+
onTreeroam?: ((params: unknown) => any) | undefined;
|
|
176
|
+
onTimelinechanged?: ((params: unknown) => any) | undefined;
|
|
177
|
+
onTimelineplaychanged?: ((params: unknown) => any) | undefined;
|
|
178
|
+
onRestore?: ((params: unknown) => any) | undefined;
|
|
179
|
+
onDataviewchanged?: ((params: unknown) => any) | undefined;
|
|
180
|
+
onMagictypechanged?: ((params: unknown) => any) | undefined;
|
|
181
|
+
onGeoselectchanged?: ((params: unknown) => any) | undefined;
|
|
182
|
+
onGeoselected?: ((params: unknown) => any) | undefined;
|
|
183
|
+
onGeounselected?: ((params: unknown) => any) | undefined;
|
|
184
|
+
onAxisareaselected?: ((params: unknown) => any) | undefined;
|
|
185
|
+
onBrush?: ((params: unknown) => any) | undefined;
|
|
186
|
+
onBrushEnd?: ((params: unknown) => any) | undefined;
|
|
187
|
+
onBrushselected?: ((params: unknown) => any) | undefined;
|
|
188
|
+
onGlobalcursortaken?: ((params: unknown) => any) | undefined;
|
|
189
|
+
"onZr:mousewheel"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
190
|
+
"onZr:drag"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
191
|
+
"onZr:dragstart"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
192
|
+
"onZr:dragend"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
193
|
+
"onZr:dragenter"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
194
|
+
"onZr:dragleave"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
195
|
+
"onZr:dragover"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
196
|
+
"onZr:drop"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
197
|
+
"onZr:click"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
198
|
+
"onZr:dblclick"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
199
|
+
"onZr:mouseout"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
200
|
+
"onZr:mouseover"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
201
|
+
"onZr:mouseup"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
202
|
+
"onZr:mousedown"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
203
|
+
"onZr:mousemove"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
204
|
+
"onZr:contextmenu"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
205
|
+
"onZr:globalout"?: ((params: import("echarts").ElementEvent) => any) | undefined;
|
|
206
|
+
onRendered?: ((params: {
|
|
207
|
+
elapsedTime: number;
|
|
208
|
+
}) => any) | undefined;
|
|
209
|
+
onFinished?: (() => any) | undefined;
|
|
210
|
+
}>, {
|
|
211
|
+
manualUpdate: boolean;
|
|
212
|
+
loading: boolean;
|
|
213
|
+
}, SlotsTypes, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/index.d.ts
|
|
216
|
+
interface VChartSlotsExtension {}
|
|
217
|
+
//#endregion
|
|
218
|
+
export { _default as a, UPDATE_OPTIONS_KEY as i, INIT_OPTIONS_KEY as n, LOADING_OPTIONS_KEY as o, THEME_KEY as r, ElementEventName as s, VChartSlotsExtension as t };
|
|
219
|
+
//# sourceMappingURL=index-CJnrqQei.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as _default, i as UPDATE_OPTIONS_KEY, n as INIT_OPTIONS_KEY, o as LOADING_OPTIONS_KEY, r as THEME_KEY, t as VChartSlotsExtension } from "./index-CJnrqQei.js";
|
|
2
|
+
export { INIT_OPTIONS_KEY, LOADING_OPTIONS_KEY, THEME_KEY, UPDATE_OPTIONS_KEY, VChartSlotsExtension, _default as default };
|