@moda-chart/vue2 0.1.2

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 park-taejoon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # @moda-chart/vue2
2
+
3
+ `@moda-chart/core`의 Vue 2.7 어댑터 — composable + SFC.
4
+ Vue 2.7의 composition API를 사용한다.
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ import {
3
+ defineComponent,
4
+ getCurrentInstance,
5
+ onBeforeUnmount,
6
+ onMounted,
7
+ } from "vue";
8
+ import { attachChartView } from "@moda-chart/core";
9
+ import type { ChartCore } from "@moda-chart/core";
10
+
11
+ // Vue 2.7 렌더러 — 루트 $el에 공용 DOM 렌더러를 연결한다.
12
+ export default defineComponent({
13
+ name: "ChartView",
14
+ props: {
15
+ chart: { type: Object as () => ChartCore, required: true },
16
+ },
17
+ setup(props) {
18
+ const vm = getCurrentInstance();
19
+ let detach: (() => void) | undefined;
20
+ onMounted(() => {
21
+ detach = attachChartView(vm!.proxy!.$el as HTMLElement, props.chart);
22
+ });
23
+ onBeforeUnmount(() => detach?.());
24
+ },
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <div></div>
30
+ </template>
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conformance.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.test.d.ts","sourceRoot":"","sources":["../src/conformance.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ // @vitest-environment happy-dom
2
+ import Vue from "vue";
3
+ import { runChartConformance } from "@moda-chart/core/conformance";
4
+ import { ChartCore } from "@moda-chart/core";
5
+ import ChartView from "./ChartView.vue";
6
+ // Vue 2.7 렌더러 — $mount(el)은 el을 대체하므로, 호스트 div에 마운트 결과를 넣는다
7
+ runChartConformance("vue2", async (opts) => {
8
+ const el = document.createElement("div");
9
+ document.body.appendChild(el);
10
+ const chart = new ChartCore(opts);
11
+ const vm = new Vue({
12
+ render: (h) => h(ChartView, { props: { chart } }),
13
+ }).$mount();
14
+ el.appendChild(vm.$el);
15
+ await vm.$nextTick();
16
+ return {
17
+ el,
18
+ chart,
19
+ flush: () => vm.$nextTick(),
20
+ destroy: () => {
21
+ vm.$destroy();
22
+ el.remove();
23
+ },
24
+ };
25
+ });
26
+ //# sourceMappingURL=conformance.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.test.js","sourceRoot":"","sources":["../src/conformance.test.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,4DAA4D;AAC5D,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IACzC,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC;QACjB,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAgB,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;KACzD,CAAC,CAAC,MAAM,EAAE,CAAC;IACZ,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;IACrB,OAAO;QACL,EAAE;QACF,KAAK;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE;QAC3B,OAAO,EAAE,GAAG,EAAE;YACZ,EAAE,CAAC,QAAQ,EAAE,CAAC;YACd,EAAE,CAAC,MAAM,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { useChart, useChartState } from "./useChart.js";
2
+ export type { UseChartReturn } from "./useChart.js";
3
+ export { default as ChartView } from "./ChartView.vue";
4
+ export type { AnnotationInput, CategoryValue, Chart, ChartCoreOptions, ChartEventHandlers, ChartEventMap, ChartEventType, ChartChordOptions, ChartFlowLink, ChartGaugeOptions, ChartHeatmapOptions, ChartLocale, ChartMapDatum, ChartMapLine, ChartMapOptions, ChartMapPoint, ChartBoxInput, ChartMenuItem, ChartContextMenuOptions, ItemStyle, ItemStyleContext, TooltipRenderContext, ChartDrawingOptions, ChartSearchOptions, ChartPictogramOptions, ChartPyramidPopOptions, ChartState, DrawingInput, DrawingView, DrawTool, SearchLoadArgs, PictoIconView, PictoRowView, SparklineOptions, ChartPointInput, ChartSankeyOptions, ChartSeriesInput, ChartSnapshot, ChartTheme, ChartTreeNode, ChartType, DrilldownLevel, MapProjection, MarkBandInput, MarkLineInput, } from "@moda-chart/core";
5
+ export { ChartCore, mountSparkline, parseDataXml, parseText, sparklineMarkup, WORLD_TOPOLOGY, } from "@moda-chart/core";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EACV,eAAe,EACf,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { useChart, useChartState } from "./useChart.js";
2
+ export { default as ChartView } from "./ChartView.vue";
3
+ export { ChartCore, mountSparkline, parseDataXml, parseText, sparklineMarkup, WORLD_TOPOLOGY, } from "@moda-chart/core";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgDvD,OAAO,EACL,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ @import "@moda-chart/core/styles.css";
@@ -0,0 +1,19 @@
1
+ import type { Ref } from "vue";
2
+ import { ChartCore } from "@moda-chart/core";
3
+ import type { ChartCoreOptions, ChartSnapshot } from "@moda-chart/core";
4
+ export interface UseChartReturn {
5
+ chart: ChartCore;
6
+ state: Ref<ChartSnapshot>;
7
+ unsubscribe(): void;
8
+ }
9
+ /**
10
+ * Vue 2.7 어댑터 composable — 코어 생성 + 스냅샷을 shallowRef로 구독.
11
+ * 컴포넌트 스코프 안에서만 getCurrentScope 기반 자동 해제된다.
12
+ */
13
+ export declare function useChart(options: ChartCoreOptions): UseChartReturn;
14
+ /** 외부에서 만든 ChartCore의 스냅샷만 구독한다 */
15
+ export declare function useChartState(chart: ChartCore): {
16
+ state: Ref<ChartSnapshot>;
17
+ unsubscribe: () => void;
18
+ };
19
+ //# sourceMappingURL=useChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChart.d.ts","sourceRoot":"","sources":["../src/useChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC1B,WAAW,IAAI,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAQlE;AAED,mCAAmC;AACnC,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG;IAC/C,KAAK,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAOA"}
@@ -0,0 +1,27 @@
1
+ import { getCurrentScope, onScopeDispose, shallowRef } from "vue";
2
+ import { ChartCore } from "@moda-chart/core";
3
+ /**
4
+ * Vue 2.7 어댑터 composable — 코어 생성 + 스냅샷을 shallowRef로 구독.
5
+ * 컴포넌트 스코프 안에서만 getCurrentScope 기반 자동 해제된다.
6
+ */
7
+ export function useChart(options) {
8
+ const chart = new ChartCore(options);
9
+ const state = shallowRef(chart.getSnapshot());
10
+ const unsubscribe = chart.subscribe(() => {
11
+ state.value = chart.getSnapshot();
12
+ });
13
+ if (getCurrentScope())
14
+ onScopeDispose(unsubscribe);
15
+ return { chart, state: state, unsubscribe };
16
+ }
17
+ /** 외부에서 만든 ChartCore의 스냅샷만 구독한다 */
18
+ export function useChartState(chart) {
19
+ const state = shallowRef(chart.getSnapshot());
20
+ const unsubscribe = chart.subscribe(() => {
21
+ state.value = chart.getSnapshot();
22
+ });
23
+ if (getCurrentScope())
24
+ onScopeDispose(unsubscribe);
25
+ return { state: state, unsubscribe };
26
+ }
27
+ //# sourceMappingURL=useChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChart.js","sourceRoot":"","sources":["../src/useChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAS7C;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAyB;IAChD,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACvC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IACH,IAAI,eAAe,EAAE;QAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAA2B,EAAE,WAAW,EAAE,CAAC;AACpE,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,aAAa,CAAC,KAAgB;IAI5C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACvC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IACH,IAAI,eAAe,EAAE;QAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,EAAE,KAA2B,EAAE,WAAW,EAAE,CAAC;AAC7D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@moda-chart/vue2",
3
+ "version": "0.1.2",
4
+ "description": "Vue 2.7 adapter for @moda-chart — useChart + ChartView",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./styles.css": "./dist/styles.css"
13
+ },
14
+ "types": "./dist/index.d.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "sideEffects": [
19
+ "**/*.css"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "keywords": [
25
+ "vue2",
26
+ "adapter",
27
+ "headless",
28
+ "library"
29
+ ],
30
+ "dependencies": {
31
+ "@moda-chart/core": "0.1.2"
32
+ },
33
+ "peerDependencies": {
34
+ "vue": "^2.7.0"
35
+ },
36
+ "devDependencies": {
37
+ "@vitejs/plugin-vue2": "^2.3.4",
38
+ "happy-dom": "^20.14.5",
39
+ "typescript": "~5.9.2",
40
+ "vitest": "^3.2.7",
41
+ "vue": "2.7.16"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json && cp src/styles.css src/ChartView.vue dist/",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "dev": "tsc -p tsconfig.json --watch",
47
+ "test": "vitest run"
48
+ },
49
+ "main": "./dist/index.js"
50
+ }