@revivejs/vue-highcharts 2.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexandro Marques
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,116 @@
1
+ # @revivejs/vue-highcharts
2
+
3
+ > A maintained **Vue 2 wrapper for Highcharts** with a thin plugin API, a globally registered `<highcharts>` component, and versioned live demos.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@revivejs/vue-highcharts.svg?style=flat-square)](https://www.npmjs.com/package/@revivejs/vue-highcharts)
6
+ [![npm downloads](https://img.shields.io/npm/dt/@revivejs/vue-highcharts.svg?style=flat-square)](https://www.npmjs.com/package/@revivejs/vue-highcharts)
7
+ [![license](https://img.shields.io/npm/l/@revivejs/vue-highcharts.svg?style=flat-square)](https://github.com/alexandroit/vue-highcharts/blob/master/LICENSE)
8
+ [![Vue 2](https://img.shields.io/badge/Vue-2-brightgreen?style=flat-square&logo=vuedotjs)](https://v2.vuejs.org)
9
+ [![Highcharts](https://img.shields.io/badge/Highcharts-12.5-navy?style=flat-square)](https://www.highcharts.com)
10
+
11
+ **[Documentation & Live Demos](https://alexandroit.github.io/vue-highcharts/)** | **[npm](https://www.npmjs.com/package/@revivejs/vue-highcharts)** | **[Issues](https://github.com/alexandroit/vue-highcharts/issues)** | **[Repository](https://github.com/alexandroit/vue-highcharts)**
12
+
13
+ **Latest version:** `2.0.0`
14
+
15
+ ## Why this library?
16
+
17
+ `@revivejs/vue-highcharts` follows the familiar Vue + Highcharts pattern:
18
+
19
+ - install one plugin
20
+ - pass a `highcharts` instance
21
+ - pass a single `options` object
22
+ - grab the live chart through a component ref when you need imperative access
23
+
24
+ That keeps Vue in charge of your template structure while preserving the native Highcharts API.
25
+
26
+ ## Vue Version Compatibility
27
+
28
+ | Package version | Vue version | Highcharts version | Demo link |
29
+ | :---: | :---: | :---: | :--- |
30
+ | **2.0.0** | **2.7.x** | **12.5.x** | [Vue 2 demo](https://alexandroit.github.io/vue-highcharts/vue-2/) |
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ npm install @revivejs/vue-highcharts highcharts
36
+ ```
37
+
38
+ ## Basic Usage
39
+
40
+ ```js
41
+ import Vue from 'vue';
42
+ import Highcharts from 'highcharts';
43
+ import HighchartsVue from '@revivejs/vue-highcharts';
44
+
45
+ Vue.use(HighchartsVue);
46
+
47
+ new Vue({
48
+ data() {
49
+ return {
50
+ Highcharts,
51
+ chartOptions: {
52
+ title: { text: 'Quarterly revenue' },
53
+ series: [{ type: 'line', data: [14, 18, 22, 28] }]
54
+ }
55
+ };
56
+ }
57
+ });
58
+ ```
59
+
60
+ ```html
61
+ <highcharts :highcharts="Highcharts" :options="chartOptions" />
62
+ ```
63
+
64
+ ## StockChart
65
+
66
+ ```html
67
+ <highcharts
68
+ :highcharts="Highstock"
69
+ constructor-type="stockChart"
70
+ :options="stockOptions"
71
+ />
72
+ ```
73
+
74
+ ## Modules
75
+
76
+ ```js
77
+ import Highcharts from 'highcharts';
78
+ import {
79
+ exposeHighchartsGlobals,
80
+ initHighchartsModules
81
+ } from '@revivejs/vue-highcharts';
82
+
83
+ exposeHighchartsGlobals(Highcharts);
84
+
85
+ const [{ default: Highcharts3D }, { default: HeatmapModule }] = await Promise.all([
86
+ import('highcharts/highcharts-3d.js'),
87
+ import('highcharts/modules/heatmap.js')
88
+ ]);
89
+
90
+ initHighchartsModules(Highcharts, Highcharts3D, HeatmapModule);
91
+ ```
92
+
93
+ ## Imperative Access
94
+
95
+ ```js
96
+ this.$refs.salesChart.chart.series[0].addPoint(42);
97
+ ```
98
+
99
+ ## API
100
+
101
+ | Prop | Type | Notes |
102
+ | :--- | :--- | :--- |
103
+ | `highcharts` | `typeof Highcharts` | Required. Pass the instance or bundle you want to use. |
104
+ | `options` | `Highcharts.Options` | Required. Passed into the selected Highcharts constructor. |
105
+ | `constructorType` | `'chart' \| 'stockChart' \| 'mapChart' \| 'ganttChart'` | Defaults to `'chart'`. |
106
+ | `callback` | `(chart) => void` | Called after the chart is created. |
107
+ | `allowChartUpdate` | `boolean` | Defaults to `true`. |
108
+ | `immutable` | `boolean` | Recreates the chart instead of calling `chart.update`. |
109
+ | `updateArgs` | `[redraw, oneToOne, animation]` | Forwarded to `chart.update`. |
110
+
111
+ ## Changelog
112
+
113
+ ### 2.0.0
114
+ - Initial Vue wrapper line
115
+ - Added the first versioned docs app for Vue 2
116
+ - Established the versioned docs structure used by later releases
package/dist/index.cjs ADDED
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Chart: () => Chart,
34
+ HighchartsVue: () => HighchartsVue,
35
+ default: () => plugin_default,
36
+ exposeHighchartsGlobals: () => exposeHighchartsGlobals,
37
+ initHighchartsModules: () => initHighchartsModules
38
+ });
39
+ module.exports = __toCommonJS(index_exports);
40
+
41
+ // src/Chart.ts
42
+ var import_vue = __toESM(require("vue"), 1);
43
+ function createChart() {
44
+ const container = this.$refs.container;
45
+ if (!container) {
46
+ return;
47
+ }
48
+ const factory = this.highcharts[this.constructorType];
49
+ if (typeof factory !== "function") {
50
+ throw new Error(
51
+ `Unknown Highcharts constructor "${this.constructorType}". Make sure you passed the right Highcharts bundle.`
52
+ );
53
+ }
54
+ destroyChart.call(this);
55
+ this.chart = factory(container, this.options, (chart) => {
56
+ this.callback?.(chart);
57
+ });
58
+ }
59
+ function destroyChart() {
60
+ this.chart?.destroy();
61
+ this.chart = null;
62
+ }
63
+ var Chart = import_vue.default.extend({
64
+ name: "highcharts",
65
+ props: {
66
+ highcharts: {
67
+ type: Object,
68
+ required: true
69
+ },
70
+ options: {
71
+ type: Object,
72
+ required: true
73
+ },
74
+ constructorType: {
75
+ type: String,
76
+ default: "chart"
77
+ },
78
+ callback: {
79
+ type: Function,
80
+ default: void 0
81
+ },
82
+ allowChartUpdate: {
83
+ type: Boolean,
84
+ default: true
85
+ },
86
+ immutable: {
87
+ type: Boolean,
88
+ default: false
89
+ },
90
+ updateArgs: {
91
+ type: Array,
92
+ default: () => [true, true, true]
93
+ }
94
+ },
95
+ data() {
96
+ return {
97
+ chart: null
98
+ };
99
+ },
100
+ mounted() {
101
+ createChart.call(this);
102
+ },
103
+ beforeDestroy() {
104
+ destroyChart.call(this);
105
+ },
106
+ watch: {
107
+ highcharts() {
108
+ createChart.call(this);
109
+ },
110
+ constructorType() {
111
+ createChart.call(this);
112
+ },
113
+ options: {
114
+ deep: true,
115
+ handler() {
116
+ if (!this.chart) {
117
+ return;
118
+ }
119
+ if (this.immutable) {
120
+ createChart.call(this);
121
+ return;
122
+ }
123
+ if (!this.allowChartUpdate) {
124
+ return;
125
+ }
126
+ this.chart.update(
127
+ this.options,
128
+ this.updateArgs[0],
129
+ this.updateArgs[1],
130
+ this.updateArgs[2]
131
+ );
132
+ }
133
+ }
134
+ },
135
+ render(h) {
136
+ return h("div", { ref: "container" });
137
+ }
138
+ });
139
+
140
+ // src/plugin.ts
141
+ var HighchartsVue = {
142
+ install(Vue2) {
143
+ Vue2.component("highcharts", Chart);
144
+ }
145
+ };
146
+ var plugin_default = HighchartsVue;
147
+
148
+ // src/modules.ts
149
+ var appliedModules = /* @__PURE__ */ new WeakMap();
150
+ function exposeHighchartsGlobals(highcharts) {
151
+ const scope = globalThis;
152
+ scope.Highcharts = highcharts;
153
+ scope._Highcharts = highcharts;
154
+ }
155
+ function initHighchartsModules(highcharts, ...modules) {
156
+ exposeHighchartsGlobals(highcharts);
157
+ const registry = appliedModules.get(highcharts) ?? /* @__PURE__ */ new Set();
158
+ for (const entry of modules) {
159
+ const factory = entry.default ?? entry;
160
+ if (registry.has(factory)) {
161
+ continue;
162
+ }
163
+ if (typeof factory === "function") {
164
+ factory(highcharts);
165
+ registry.add(factory);
166
+ }
167
+ }
168
+ appliedModules.set(highcharts, registry);
169
+ }
170
+ // Annotate the CommonJS export names for ESM import in node:
171
+ 0 && (module.exports = {
172
+ Chart,
173
+ HighchartsVue,
174
+ exposeHighchartsGlobals,
175
+ initHighchartsModules
176
+ });
177
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/Chart.ts","../src/plugin.ts","../src/modules.ts"],"sourcesContent":["export { Chart } from './Chart';\nexport type { ConstructorType, UpdateArgs } from './Chart';\nexport { HighchartsVue } from './plugin';\nexport { exposeHighchartsGlobals, initHighchartsModules } from './modules';\nexport type { HighchartsModuleFactory } from './modules';\nexport { default } from './plugin';\n","import Vue from 'vue';\nimport type Highcharts from 'highcharts';\n\nexport type ConstructorType = 'chart' | 'stockChart' | 'mapChart' | 'ganttChart';\n\nexport type UpdateArgs = [\n redraw?: boolean,\n oneToOne?: boolean,\n animation?: boolean | Partial<Highcharts.AnimationOptionsObject>\n];\n\nfunction createChart(this: Vue & {\n highcharts: typeof Highcharts;\n options: Highcharts.Options;\n constructorType: ConstructorType;\n callback?: (chart: Highcharts.Chart) => void;\n chart: Highcharts.Chart | null;\n $refs: { container?: HTMLElement };\n}) {\n const container = this.$refs.container;\n\n if (!container) {\n return;\n }\n\n const factory = (this.highcharts as unknown as Record<string, unknown>)[this.constructorType];\n\n if (typeof factory !== 'function') {\n throw new Error(\n `Unknown Highcharts constructor \"${this.constructorType}\". ` +\n 'Make sure you passed the right Highcharts bundle.'\n );\n }\n\n destroyChart.call(this);\n\n this.chart = (\n factory as (\n container: HTMLElement,\n options: Highcharts.Options,\n callback?: (chart: Highcharts.Chart) => void\n ) => Highcharts.Chart\n )(container, this.options, (chart) => {\n this.callback?.(chart);\n });\n}\n\nfunction destroyChart(this: Vue & { chart: Highcharts.Chart | null }) {\n this.chart?.destroy();\n this.chart = null;\n}\n\nexport const Chart = Vue.extend({\n name: 'highcharts',\n props: {\n highcharts: {\n type: Object,\n required: true\n },\n options: {\n type: Object,\n required: true\n },\n constructorType: {\n type: String,\n default: 'chart'\n },\n callback: {\n type: Function,\n default: undefined\n },\n allowChartUpdate: {\n type: Boolean,\n default: true\n },\n immutable: {\n type: Boolean,\n default: false\n },\n updateArgs: {\n type: Array,\n default: () => [true, true, true]\n }\n },\n data() {\n return {\n chart: null as Highcharts.Chart | null\n };\n },\n mounted() {\n createChart.call(this as never);\n },\n beforeDestroy() {\n destroyChart.call(this as never);\n },\n watch: {\n highcharts() {\n createChart.call(this as never);\n },\n constructorType() {\n createChart.call(this as never);\n },\n options: {\n deep: true,\n handler(this: Vue & {\n allowChartUpdate: boolean;\n immutable: boolean;\n updateArgs: UpdateArgs;\n chart: Highcharts.Chart | null;\n options: Highcharts.Options;\n }) {\n if (!this.chart) {\n return;\n }\n\n if (this.immutable) {\n createChart.call(this as never);\n return;\n }\n\n if (!this.allowChartUpdate) {\n return;\n }\n\n this.chart.update(\n this.options,\n this.updateArgs[0],\n this.updateArgs[1],\n this.updateArgs[2]\n );\n }\n }\n },\n render(h) {\n return h('div', { ref: 'container' });\n }\n});\n","import type { PluginObject } from 'vue';\nimport { Chart } from './Chart';\n\nexport const HighchartsVue: PluginObject<never> = {\n install(Vue) {\n Vue.component('highcharts', Chart);\n }\n};\n\nexport default HighchartsVue;\n","import type Highcharts from 'highcharts';\n\nexport type HighchartsModuleFactory =\n | ((highcharts: typeof Highcharts) => void)\n | { default?: (highcharts: typeof Highcharts) => void };\n\ntype HighchartsGlobalScope = typeof globalThis & {\n Highcharts?: typeof Highcharts;\n _Highcharts?: typeof Highcharts;\n};\n\nconst appliedModules = new WeakMap<object, Set<unknown>>();\n\nexport function exposeHighchartsGlobals(highcharts: typeof Highcharts) {\n const scope = globalThis as HighchartsGlobalScope;\n\n scope.Highcharts = highcharts;\n scope._Highcharts = highcharts;\n}\n\nexport function initHighchartsModules(\n highcharts: typeof Highcharts,\n ...modules: HighchartsModuleFactory[]\n) {\n exposeHighchartsGlobals(highcharts);\n\n const registry = appliedModules.get(highcharts) ?? new Set<unknown>();\n\n for (const entry of modules) {\n const factory = (entry as { default?: (highcharts: typeof Highcharts) => void }).default ?? entry;\n\n if (registry.has(factory)) {\n continue;\n }\n\n if (typeof factory === 'function') {\n factory(highcharts);\n registry.add(factory);\n }\n }\n\n appliedModules.set(highcharts, registry);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAgB;AAWhB,SAAS,cAON;AACD,QAAM,YAAY,KAAK,MAAM;AAE7B,MAAI,CAAC,WAAW;AACd;AAAA,EACF;AAEA,QAAM,UAAW,KAAK,WAAkD,KAAK,eAAe;AAE5F,MAAI,OAAO,YAAY,YAAY;AACjC,UAAM,IAAI;AAAA,MACR,mCAAmC,KAAK,eAAe;AAAA,IAEzD;AAAA,EACF;AAEA,eAAa,KAAK,IAAI;AAEtB,OAAK,QACH,QAKA,WAAW,KAAK,SAAS,CAAC,UAAU;AACpC,SAAK,WAAW,KAAK;AAAA,EACvB,CAAC;AACH;AAEA,SAAS,eAA6D;AACpE,OAAK,OAAO,QAAQ;AACpB,OAAK,QAAQ;AACf;AAEO,IAAM,QAAQ,WAAAA,QAAI,OAAO;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,M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AAM,QAAQ;AAEd,QAAM,aAAa;AACnB,QAAM,cAAc;AACtB;AAEO,SAAS,sBACd,eACG,SACH;AACA,0BAAwB,UAAU;AAElC,QAAM,WAAW,eAAe,IAAI,UAAU,KAAK,oBAAI,IAAa;AAEpE,aAAW,SAAS,SAAS;AAC3B,UAAM,UAAW,MAAgE,WAAW;AAE5F,QAAI,SAAS,IAAI,OAAO,GAAG;AACzB;AAAA,IACF;AAEA,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ,UAAU;AAClB,eAAS,IAAI,OAAO;AAAA,IACtB;AAAA,EACF;AAEA,iBAAe,IAAI,YAAY,QAAQ;AACzC;","names":["Vue","Vue"]}
@@ -0,0 +1,32 @@
1
+ import * as vue_types_vue from 'vue/types/vue';
2
+ import * as Vue from 'vue';
3
+ import Vue__default, { PluginObject } from 'vue';
4
+ import Highcharts from 'highcharts';
5
+
6
+ type ConstructorType = 'chart' | 'stockChart' | 'mapChart' | 'ganttChart';
7
+ type UpdateArgs = [
8
+ redraw?: boolean,
9
+ oneToOne?: boolean,
10
+ animation?: boolean | Partial<Highcharts.AnimationOptionsObject>
11
+ ];
12
+ declare const Chart: vue_types_vue.ExtendedVue<Vue__default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue__default>, {
13
+ chart: Highcharts.Chart | null;
14
+ }, unknown, unknown, {
15
+ highcharts: any;
16
+ options: any;
17
+ constructorType: string;
18
+ callback: Function;
19
+ allowChartUpdate: boolean;
20
+ immutable: boolean;
21
+ updateArgs: unknown[];
22
+ }, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin>;
23
+
24
+ declare const HighchartsVue: PluginObject<never>;
25
+
26
+ type HighchartsModuleFactory = ((highcharts: typeof Highcharts) => void) | {
27
+ default?: (highcharts: typeof Highcharts) => void;
28
+ };
29
+ declare function exposeHighchartsGlobals(highcharts: typeof Highcharts): void;
30
+ declare function initHighchartsModules(highcharts: typeof Highcharts, ...modules: HighchartsModuleFactory[]): void;
31
+
32
+ export { Chart, type ConstructorType, type HighchartsModuleFactory, HighchartsVue, type UpdateArgs, HighchartsVue as default, exposeHighchartsGlobals, initHighchartsModules };
@@ -0,0 +1,32 @@
1
+ import * as vue_types_vue from 'vue/types/vue';
2
+ import * as Vue from 'vue';
3
+ import Vue__default, { PluginObject } from 'vue';
4
+ import Highcharts from 'highcharts';
5
+
6
+ type ConstructorType = 'chart' | 'stockChart' | 'mapChart' | 'ganttChart';
7
+ type UpdateArgs = [
8
+ redraw?: boolean,
9
+ oneToOne?: boolean,
10
+ animation?: boolean | Partial<Highcharts.AnimationOptionsObject>
11
+ ];
12
+ declare const Chart: vue_types_vue.ExtendedVue<Vue__default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue__default>, {
13
+ chart: Highcharts.Chart | null;
14
+ }, unknown, unknown, {
15
+ highcharts: any;
16
+ options: any;
17
+ constructorType: string;
18
+ callback: Function;
19
+ allowChartUpdate: boolean;
20
+ immutable: boolean;
21
+ updateArgs: unknown[];
22
+ }, {}, Vue.ComponentOptionsMixin, Vue.ComponentOptionsMixin>;
23
+
24
+ declare const HighchartsVue: PluginObject<never>;
25
+
26
+ type HighchartsModuleFactory = ((highcharts: typeof Highcharts) => void) | {
27
+ default?: (highcharts: typeof Highcharts) => void;
28
+ };
29
+ declare function exposeHighchartsGlobals(highcharts: typeof Highcharts): void;
30
+ declare function initHighchartsModules(highcharts: typeof Highcharts, ...modules: HighchartsModuleFactory[]): void;
31
+
32
+ export { Chart, type ConstructorType, type HighchartsModuleFactory, HighchartsVue, type UpdateArgs, HighchartsVue as default, exposeHighchartsGlobals, initHighchartsModules };
package/dist/index.js ADDED
@@ -0,0 +1,137 @@
1
+ // src/Chart.ts
2
+ import Vue from "vue";
3
+ function createChart() {
4
+ const container = this.$refs.container;
5
+ if (!container) {
6
+ return;
7
+ }
8
+ const factory = this.highcharts[this.constructorType];
9
+ if (typeof factory !== "function") {
10
+ throw new Error(
11
+ `Unknown Highcharts constructor "${this.constructorType}". Make sure you passed the right Highcharts bundle.`
12
+ );
13
+ }
14
+ destroyChart.call(this);
15
+ this.chart = factory(container, this.options, (chart) => {
16
+ this.callback?.(chart);
17
+ });
18
+ }
19
+ function destroyChart() {
20
+ this.chart?.destroy();
21
+ this.chart = null;
22
+ }
23
+ var Chart = Vue.extend({
24
+ name: "highcharts",
25
+ props: {
26
+ highcharts: {
27
+ type: Object,
28
+ required: true
29
+ },
30
+ options: {
31
+ type: Object,
32
+ required: true
33
+ },
34
+ constructorType: {
35
+ type: String,
36
+ default: "chart"
37
+ },
38
+ callback: {
39
+ type: Function,
40
+ default: void 0
41
+ },
42
+ allowChartUpdate: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ immutable: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ updateArgs: {
51
+ type: Array,
52
+ default: () => [true, true, true]
53
+ }
54
+ },
55
+ data() {
56
+ return {
57
+ chart: null
58
+ };
59
+ },
60
+ mounted() {
61
+ createChart.call(this);
62
+ },
63
+ beforeDestroy() {
64
+ destroyChart.call(this);
65
+ },
66
+ watch: {
67
+ highcharts() {
68
+ createChart.call(this);
69
+ },
70
+ constructorType() {
71
+ createChart.call(this);
72
+ },
73
+ options: {
74
+ deep: true,
75
+ handler() {
76
+ if (!this.chart) {
77
+ return;
78
+ }
79
+ if (this.immutable) {
80
+ createChart.call(this);
81
+ return;
82
+ }
83
+ if (!this.allowChartUpdate) {
84
+ return;
85
+ }
86
+ this.chart.update(
87
+ this.options,
88
+ this.updateArgs[0],
89
+ this.updateArgs[1],
90
+ this.updateArgs[2]
91
+ );
92
+ }
93
+ }
94
+ },
95
+ render(h) {
96
+ return h("div", { ref: "container" });
97
+ }
98
+ });
99
+
100
+ // src/plugin.ts
101
+ var HighchartsVue = {
102
+ install(Vue2) {
103
+ Vue2.component("highcharts", Chart);
104
+ }
105
+ };
106
+ var plugin_default = HighchartsVue;
107
+
108
+ // src/modules.ts
109
+ var appliedModules = /* @__PURE__ */ new WeakMap();
110
+ function exposeHighchartsGlobals(highcharts) {
111
+ const scope = globalThis;
112
+ scope.Highcharts = highcharts;
113
+ scope._Highcharts = highcharts;
114
+ }
115
+ function initHighchartsModules(highcharts, ...modules) {
116
+ exposeHighchartsGlobals(highcharts);
117
+ const registry = appliedModules.get(highcharts) ?? /* @__PURE__ */ new Set();
118
+ for (const entry of modules) {
119
+ const factory = entry.default ?? entry;
120
+ if (registry.has(factory)) {
121
+ continue;
122
+ }
123
+ if (typeof factory === "function") {
124
+ factory(highcharts);
125
+ registry.add(factory);
126
+ }
127
+ }
128
+ appliedModules.set(highcharts, registry);
129
+ }
130
+ export {
131
+ Chart,
132
+ HighchartsVue,
133
+ plugin_default as default,
134
+ exposeHighchartsGlobals,
135
+ initHighchartsModules
136
+ };
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Chart.ts","../src/plugin.ts","../src/modules.ts"],"sourcesContent":["import Vue from 'vue';\nimport type Highcharts from 'highcharts';\n\nexport type ConstructorType = 'chart' | 'stockChart' | 'mapChart' | 'ganttChart';\n\nexport type UpdateArgs = [\n redraw?: boolean,\n oneToOne?: boolean,\n animation?: boolean | Partial<Highcharts.AnimationOptionsObject>\n];\n\nfunction createChart(this: Vue & {\n highcharts: typeof Highcharts;\n options: Highcharts.Options;\n constructorType: ConstructorType;\n callback?: (chart: Highcharts.Chart) => void;\n chart: Highcharts.Chart | null;\n $refs: { container?: HTMLElement };\n}) {\n const container = this.$refs.container;\n\n if (!container) {\n return;\n }\n\n const factory = (this.highcharts as unknown as Record<string, unknown>)[this.constructorType];\n\n if (typeof factory !== 'function') {\n throw new Error(\n `Unknown Highcharts constructor \"${this.constructorType}\". ` +\n 'Make sure you passed the right Highcharts bundle.'\n );\n }\n\n destroyChart.call(this);\n\n this.chart = (\n factory as (\n container: HTMLElement,\n options: Highcharts.Options,\n callback?: (chart: Highcharts.Chart) => void\n ) => Highcharts.Chart\n )(container, this.options, (chart) => {\n this.callback?.(chart);\n });\n}\n\nfunction destroyChart(this: Vue & { chart: Highcharts.Chart | null }) {\n this.chart?.destroy();\n this.chart = null;\n}\n\nexport const Chart = Vue.extend({\n name: 'highcharts',\n props: {\n highcharts: {\n type: Object,\n required: true\n },\n options: {\n type: Object,\n required: true\n },\n constructorType: {\n type: String,\n default: 'chart'\n },\n callback: {\n type: Function,\n default: undefined\n },\n allowChartUpdate: {\n type: Boolean,\n default: true\n },\n immutable: {\n type: Boolean,\n default: false\n },\n updateArgs: {\n type: Array,\n default: () => [true, true, true]\n }\n },\n data() {\n return {\n chart: null as Highcharts.Chart | null\n };\n },\n mounted() {\n createChart.call(this as never);\n },\n beforeDestroy() {\n destroyChart.call(this as never);\n },\n watch: {\n highcharts() {\n createChart.call(this as never);\n },\n constructorType() {\n createChart.call(this as never);\n },\n options: {\n deep: true,\n handler(this: Vue & {\n allowChartUpdate: boolean;\n immutable: boolean;\n updateArgs: UpdateArgs;\n chart: Highcharts.Chart | null;\n options: Highcharts.Options;\n }) {\n if (!this.chart) {\n return;\n }\n\n if (this.immutable) {\n createChart.call(this as never);\n return;\n }\n\n if (!this.allowChartUpdate) {\n return;\n }\n\n this.chart.update(\n this.options,\n this.updateArgs[0],\n this.updateArgs[1],\n this.updateArgs[2]\n );\n }\n }\n },\n render(h) {\n return h('div', { ref: 'container' });\n }\n});\n","import type { PluginObject } from 'vue';\nimport { Chart } from './Chart';\n\nexport const HighchartsVue: PluginObject<never> = {\n install(Vue) {\n Vue.component('highcharts', Chart);\n }\n};\n\nexport default HighchartsVue;\n","import type Highcharts from 'highcharts';\n\nexport type HighchartsModuleFactory =\n | ((highcharts: typeof Highcharts) => void)\n | { default?: (highcharts: typeof Highcharts) => void };\n\ntype HighchartsGlobalScope = typeof globalThis & {\n Highcharts?: typeof Highcharts;\n _Highcharts?: typeof Highcharts;\n};\n\nconst appliedModules = new WeakMap<object, Set<unknown>>();\n\nexport function exposeHighchartsGlobals(highcharts: typeof Highcharts) {\n const scope = globalThis as HighchartsGlobalScope;\n\n scope.Highcharts = highcharts;\n scope._Highcharts = highcharts;\n}\n\nexport function initHighchartsModules(\n highcharts: typeof Highcharts,\n ...modules: HighchartsModuleFactory[]\n) {\n exposeHighchartsGlobals(highcharts);\n\n const registry = appliedModules.get(highcharts) ?? new Set<unknown>();\n\n for (const entry of modules) {\n const factory = (entry as { default?: (highcharts: typeof Highcharts) => void }).default ?? entry;\n\n if (registry.has(factory)) {\n continue;\n }\n\n if (typeof factory === 'function') {\n factory(highcharts);\n registry.add(factory);\n }\n }\n\n appliedModules.set(highcharts, registry);\n}\n"],"mappings":";AAAA,OAAO,SAAS;AAWhB,SAAS,cAON;AACD,QAAM,YAAY,KAAK,MAAM;AAE7B,MAAI,CAAC,WAAW;AACd;AAAA,EACF;AAEA,QAAM,UAAW,KAAK,WAAkD,KAAK,eAAe;AAE5F,MAAI,OAAO,YAAY,YAAY;AACjC,UAAM,IAAI;AAAA,MACR,mCAAmC,KAAK,eAAe;AAAA,IAEzD;AAAA,EACF;AAEA,eAAa,KAAK,IAAI;AAEtB,OAAK,QACH,QAKA,WAAW,KAAK,SAAS,CAAC,UAAU;AACpC,SAAK,WAAW,KAAK;AAAA,EACvB,CAAC;AACH;AAEA,SAAS,eAA6D;AACpE,OAAK,OAAO,QAAQ;AACpB,OAAK,QAAQ;AACf;AAEO,IAAM,QAAQ,IAAI,OAAO;AAAA,EAC9B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,YAAY;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,WAAW;AAAA,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AAe,IAAI,UAAU,KAAK,oBAAI,IAAa;AAEpE,aAAW,SAAS,SAAS;AAC3B,UAAM,UAAW,MAAgE,WAAW;AAE5F,QAAI,SAAS,IAAI,OAAO,GAAG;AACzB;AAAA,IACF;AAEA,QAAI,OAAO,YAAY,YAAY;AACjC,cAAQ,UAAU;AAClB,eAAS,IAAI,OAAO;AAAA,IACtB;AAAA,EACF;AAEA,iBAAe,IAAI,YAAY,QAAQ;AACzC;","names":["Vue"]}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@revivejs/vue-highcharts",
3
+ "version": "2.0.0",
4
+ "description": "A thin Vue 2 wrapper for Highcharts with versioned demos.",
5
+ "keywords": [
6
+ "vue",
7
+ "vue-library",
8
+ "highcharts",
9
+ "charts",
10
+ "vue-highcharts",
11
+ "highcharts-vue",
12
+ "stock-chart",
13
+ "heatmap",
14
+ "3d-chart",
15
+ "plugin",
16
+ "wrapper",
17
+ "ui-component",
18
+ "revived",
19
+ "maintained"
20
+ ],
21
+ "homepage": "https://alexandroit.github.io/vue-highcharts/",
22
+ "bugs": {
23
+ "url": "https://github.com/alexandroit/vue-highcharts/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/alexandroit/vue-highcharts.git"
28
+ },
29
+ "license": "MIT",
30
+ "type": "module",
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "main": "./dist/index.cjs",
37
+ "module": "./dist/index.js",
38
+ "types": "./dist/index.d.ts",
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.js",
43
+ "require": "./dist/index.cjs"
44
+ }
45
+ },
46
+ "sideEffects": false,
47
+ "scripts": {
48
+ "build": "tsup",
49
+ "clean": "rm -rf dist docs/vue-2 docs/vue-3",
50
+ "docs:install:vue-2": "cd docs-src/vue-2 && npm install",
51
+ "build:docs:vue-2": "cd docs-src/vue-2 && npm run build",
52
+ "build:docs": "npm run build:docs:vue-2",
53
+ "typecheck": "tsc --noEmit"
54
+ },
55
+ "peerDependencies": {
56
+ "highcharts": ">=12.5.0",
57
+ "vue": ">=2.7.0 <3.0.0"
58
+ },
59
+ "devDependencies": {
60
+ "highcharts": "12.5.0",
61
+ "tsup": "8.5.1",
62
+ "typescript": "5.9.3",
63
+ "vue": "2.7.16"
64
+ }
65
+ }