@revolist/vue-charts 0.0.0-stage → 3.0.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/README.md CHANGED
@@ -1,3 +1,104 @@
1
- # Temporary Holding Version
1
+ # RevoGrid Vue Charts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ One generic `RevoChart` component backed by the standalone chart engine.
4
+
5
+ ## Installation: public wrapper, private engine
6
+
7
+ The four wrapper packages are configured for public npm publishing. `@revolist/charts` remains a
8
+ private commercial package on GitHub Packages; you need licensed access to
9
+ install and use it. The wrapper imports the engine and does not bundle it.
10
+
11
+ ### Before the first release
12
+
13
+ The wrappers are not published yet; registry install commands below apply after
14
+ publication. In this monorepo, replace `your-app` with your consumer workspace
15
+ name and use the local package:
16
+
17
+ ```sh
18
+ pnpm --filter your-app add "@revolist/vue-charts@workspace:*" "@revolist/charts@workspace:*"
19
+ pnpm build
20
+ ```
21
+
22
+ Source: `packages/charts/packages/vue-charts`. The public import name is unchanged.
23
+
24
+ ### Registry installation after publication
25
+
26
+ Configure your project's `.npmrc` for the engine, keeping credentials in your
27
+ environment:
28
+
29
+ ```ini
30
+ @revolist:registry=https://npm.pkg.github.com/
31
+ //npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}
32
+ ```
33
+
34
+ Both registries use the `@revolist` scope. Install the public wrapper by its
35
+ explicit npm tarball URL so the scope mapping continues to send the engine to
36
+ GitHub Packages. A plain `pnpm add @revolist/vue-charts` with that mapping
37
+ would look for the wrapper on GitHub instead. Changing only the default
38
+ `--registry` does not override the scope mapping.
39
+
40
+ ```sh
41
+ pnpm add @revolist/charts@3.0.0
42
+ pnpm add https://registry.npmjs.org/@revolist/vue-charts/-/vue-charts-3.0.0.tgz
43
+ ```
44
+
45
+ Use matching released wrapper and engine versions; replace `3.0.0` in these
46
+ examples when upgrading. Commit your lockfile so CI retains both registries'
47
+ resolved tarball URLs, and provide `GITHUB_PACKAGES_TOKEN` during CI installs.
48
+ Missing or unauthorized engine access causes installation to fail. No separate
49
+ wrapper trial package is published.
50
+
51
+ ```vue
52
+ <script setup lang="ts">
53
+ import { shallowRef } from 'vue';
54
+ import { RevoChart, type ChartComponentOptions } from '@revolist/vue-charts';
55
+ const options = shallowRef<ChartComponentOptions>({
56
+ chartType: 'line',
57
+ data: [{ month: 'Jan', revenue: 120 }, { month: 'Feb', revenue: 180 }],
58
+ mapping: { category: { field: 'month' }, series: [{ field: 'revenue' }] },
59
+ });
60
+ </script>
61
+ <template>
62
+ <RevoChart :options="options" @ready="chart => console.log(chart.model)"
63
+ style="height:400px" class="sales-chart" />
64
+ </template>
65
+ ```
66
+
67
+ ## Updates and lifecycle
68
+
69
+ `options` has type `Omit<ChartOptions, 'container'>`. It accepts the same rows and
70
+ mapping, dataset, saved model, renderer, data source and chart settings as
71
+ `@revolist/charts`. Existing callbacks such as `onNodeClick`, `onChange` and
72
+ `onError` belong inside `options`. Callback replacements take effect without
73
+ recreating a chart.
74
+
75
+ Replace `options` and changed nested values to update the chart; do not mutate
76
+ nested objects in place. In Vue, replace the ref value; in Svelte, prefer
77
+ `$state.raw` for chart configuration. Ordinary data/settings changes update the
78
+ current chart. Source replacements use `setDataSource`. Initialization settings,
79
+ input-mode changes and removed settings recreate it to restore engine defaults.
80
+
81
+ The host defaults to width `100%` and height `300px`. Override its dimensions with
82
+ framework styles. The engine observes resizing. No stylesheet, element
83
+ registration or manual mount call is needed.
84
+
85
+ The readiness callback/event receives `ChartRef` for `download`, `getCSV`,
86
+ `getImageDataURL`, selection and transactions. It fires again after recreation;
87
+ replace any stored ref on each readiness event. The component owns destruction,
88
+ so do not destroy its ref yourself.
89
+
90
+ Creation and updates are asynchronous. Pending work is cancelled on unmount or
91
+ superseding configuration, and stale results are destroyed. Failures call
92
+ `options.onError`, or `console.error` when no error handler is supplied. Server
93
+ rendering produces an empty host; chart creation starts after client mounting.
94
+
95
+ ## Building and distribution
96
+
97
+ The package compiles with the monorepo's root `pnpm build`. Framework runtimes and
98
+ `@revolist/charts` stay external. Install the framework peers listed in
99
+ `package.json`; the engine version follows the wrapper version.
100
+
101
+ The normal charts release publishes this wrapper to public npmjs using the
102
+ repository's `NPM_TOKEN` secret. The private engine is published separately to
103
+ GitHub Packages using GitHub credentials. No wrapper `build:trial` or trial
104
+ publication is needed.
@@ -0,0 +1,21 @@
1
+ import type { PropType } from 'vue';
2
+ import type { ChartComponentOptions } from '@revolist/charts/framework';
3
+ import type { ChartRef } from '@revolist/charts';
4
+ export type { ChartComponentOptions, ChartRef };
5
+ export declare const RevoChart: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ options: {
7
+ type: PropType<ChartComponentOptions>;
8
+ required: true;
9
+ };
10
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
11
+ [key: string]: any;
12
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ ready: (_chart: ChartRef) => true;
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ options: {
16
+ type: PropType<ChartComponentOptions>;
17
+ required: true;
18
+ };
19
+ }>> & Readonly<{
20
+ onReady?: ((_chart: ChartRef) => any) | undefined;
21
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import { defineComponent, h, mergeProps, onBeforeUnmount, onMounted, ref, toRaw, watch } from 'vue';
2
+ import { createChartComponentController } from '@revolist/charts/framework';
3
+ export const RevoChart = defineComponent({
4
+ name: 'RevoChart',
5
+ inheritAttrs: false,
6
+ props: { options: { type: Object, required: true } },
7
+ emits: { ready: (_chart) => true },
8
+ setup(props, { attrs, emit }) {
9
+ const host = ref();
10
+ let controller;
11
+ onMounted(() => {
12
+ controller = createChartComponentController(host.value, chart => emit('ready', chart));
13
+ void controller.setOptions(toRaw(props.options));
14
+ });
15
+ watch(() => props.options, options => { void controller?.setOptions(toRaw(options)); });
16
+ onBeforeUnmount(() => controller?.destroy());
17
+ return () => h('div', mergeProps({ style: { width: '100%', height: '300px' } }, attrs, { ref: host }));
18
+ },
19
+ });
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@revolist/vue-charts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "3.0.2",
4
+ "description": "Vue components for RevoGrid Charts",
5
+ "type": "module",
6
+ "license": "Commercial",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": false,
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ }
19
+ },
20
+ "dependencies": {
21
+ "@revolist/charts": "3.0.2"
22
+ },
23
+ "peerDependencies": {
24
+ "vue": "^3.5.0"
25
+ },
26
+ "devDependencies": {
27
+ "vue": "^3.5.0",
28
+ "typescript": "~6.0.3"
29
+ },
30
+ "publishConfig": {
31
+ "registry": "https://registry.npmjs.org/",
32
+ "access": "public"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/revolist/revogrid-pro.git",
37
+ "directory": "packages/charts/packages/vue-charts"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "lint": "tsc -p tsconfig.json --noEmit",
42
+ "test": "node --test --test-name-pattern=\"^vue charts\" ../../../../.github/workflows/chart-frameworks.test.mjs"
43
+ }
6
44
  }