nuxt-charts 0.1.0-beta.1

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 ADDED
@@ -0,0 +1,107 @@
1
+ # @vue-chrts/nuxt
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+
6
+ > Nuxt module for vue-chrts
7
+
8
+ ## Features
9
+
10
+ - 📊 Use beautiful chart components in your Nuxt applications
11
+ - 🔄 Auto-imports for all chart components
12
+ - 🎛ïļ Configure which components to include
13
+ - ðŸŠķ Tree-shakable - only import what you use
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ # npm
19
+ npm install @vue-chrts/nuxt
20
+
21
+ # yarn
22
+ yarn add @vue-chrts/nuxt
23
+
24
+ # pnpm
25
+ pnpm add @vue-chrts/nuxt
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ Add the module to your Nuxt config:
31
+
32
+ ```ts
33
+ // nuxt.config.ts
34
+ export default defineNuxtConfig({
35
+ modules: ['@vue-chrts/nuxt'],
36
+
37
+ // Optional configuration
38
+ vueChrts: {
39
+ // Add prefix to component names (default: 'Chrt')
40
+ prefix: 'Chrt',
41
+
42
+ // Make components globally available (default: true)
43
+ global: true,
44
+
45
+ // Only include specific components (default: all components)
46
+ include: ['AreaChart', 'LineChart'],
47
+
48
+ // Enable auto-imports (default: true)
49
+ autoImports: true
50
+ }
51
+ })
52
+ ```
53
+
54
+ Then use the components in your Nuxt application:
55
+
56
+ ```vue
57
+ <template>
58
+ <div class="chart-wrapper">
59
+ <ChrtLineChart
60
+ :data="data"
61
+ :height="300"
62
+ :accessor="accessor"
63
+ :x-axis-title="xAxisTitle"
64
+ />
65
+ </div>
66
+ </template>
67
+
68
+ <script setup>
69
+ // The types are auto-imported
70
+ const data = ref([
71
+ { date: '2023-01', value: 100 },
72
+ { date: '2023-02', value: 200 },
73
+ { date: '2023-03', value: 150 },
74
+ ])
75
+
76
+ const accessor = (d) => d.value
77
+ const xAxisTitle = 'Month'
78
+ </script>
79
+ ```
80
+
81
+ ## Available Components
82
+
83
+ - `ChrtAreaChart` - Area chart
84
+ - `ChrtAreaStackedChart` - Stacked area chart
85
+ - `ChrtLineChart` - Line chart
86
+ - `ChrtBarChart` - Bar chart
87
+ - `ChrtDonutChart` - Donut chart
88
+
89
+ ## Auto-imported Types
90
+
91
+ The following types are auto-imported:
92
+
93
+ - `LegendPosition`
94
+ - `CurveType`
95
+ - `Orientation`
96
+ - `BulletLegendItemInterface`
97
+
98
+ ## License
99
+
100
+ MIT
101
+
102
+ <!-- Badges -->
103
+ [npm-version-src]: https://img.shields.io/npm/v/@vue-chrts/nuxt/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
104
+ [npm-version-href]: https://npmjs.com/package/@vue-chrts/nuxt
105
+
106
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@vue-chrts/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
107
+ [npm-downloads-href]: https://npmjs.com/package/@vue-chrts/nuxt
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,28 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ /**
5
+ * Prefix for component names
6
+ * @default 'Chrt'
7
+ */
8
+ prefix?: string;
9
+ /**
10
+ * Register global components
11
+ * @default true
12
+ */
13
+ global?: boolean;
14
+ /**
15
+ * Use auto-imports (recommended)
16
+ * @default true
17
+ */
18
+ autoImports?: boolean;
19
+ /**
20
+ * Components to include (empty array means all components)
21
+ * @default []
22
+ */
23
+ include?: string[];
24
+ }
25
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
26
+
27
+ export { _default as default };
28
+ export type { ModuleOptions };
@@ -0,0 +1,28 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface ModuleOptions {
4
+ /**
5
+ * Prefix for component names
6
+ * @default 'Chrt'
7
+ */
8
+ prefix?: string;
9
+ /**
10
+ * Register global components
11
+ * @default true
12
+ */
13
+ global?: boolean;
14
+ /**
15
+ * Use auto-imports (recommended)
16
+ * @default true
17
+ */
18
+ autoImports?: boolean;
19
+ /**
20
+ * Components to include (empty array means all components)
21
+ * @default []
22
+ */
23
+ include?: string[];
24
+ }
25
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
26
+
27
+ export { _default as default };
28
+ export type { ModuleOptions };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@vue-chrts/nuxt",
3
+ "configKey": "vueChrts",
4
+ "compatibility": {
5
+ "nuxt": "^3.0.0"
6
+ },
7
+ "version": "0.1.0-beta.1",
8
+ "builder": {
9
+ "@nuxt/module-builder": "0.8.4",
10
+ "unbuild": "unknown"
11
+ }
12
+ }
@@ -0,0 +1,55 @@
1
+ import { addComponent, addImportsSources, defineNuxtModule, createResolver } from '@nuxt/kit';
2
+
3
+ const resolveComponents = (config, filePath) => {
4
+ const { components, prefix } = config;
5
+ const allComponents = ["AreaChart"];
6
+ allComponents.forEach((component) => {
7
+ console.log(component, "component");
8
+ if (typeof component === "string") {
9
+ addComponent({
10
+ export: component,
11
+ name: prefix + component,
12
+ filePath
13
+ });
14
+ } else if (Array.isArray(component)) {
15
+ addComponent({
16
+ export: component[0],
17
+ name: prefix + component[1],
18
+ filePath
19
+ });
20
+ }
21
+ });
22
+ };
23
+
24
+ const resolveImports = (config, filePath) => {
25
+ const { imports } = config;
26
+ const allImports = imports ? imports : ["BulletLegendItemInterface"];
27
+ addImportsSources({
28
+ from: filePath,
29
+ type: true,
30
+ imports: [...allImports]
31
+ });
32
+ };
33
+
34
+ const module = defineNuxtModule({
35
+ meta: {
36
+ name: "@vue-chrts/nuxt",
37
+ configKey: "vueChrts",
38
+ compatibility: {
39
+ nuxt: "^3.0.0"
40
+ }
41
+ },
42
+ defaults: {
43
+ prefix: "",
44
+ global: true,
45
+ autoImports: true,
46
+ include: []
47
+ },
48
+ async setup(options, nuxt) {
49
+ const runtimePath = createResolver(import.meta.url).resolve("./runtime/vue-chrts");
50
+ resolveImports(options, runtimePath);
51
+ resolveComponents(options, runtimePath);
52
+ }
53
+ });
54
+
55
+ export { module as default };
@@ -0,0 +1 @@
1
+ export * from 'vue-chrts';
@@ -0,0 +1 @@
1
+ export * from "vue-chrts";
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.js'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.js'
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module'
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "nuxt-charts",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Nuxt module for vue-chrts",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/module.mjs",
10
+ "require": "./dist/module.cjs"
11
+ }
12
+ },
13
+ "main": "./dist/module.cjs",
14
+ "module": "./dist/module.mjs",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "prepack": "nuxt-module-build build",
20
+ "dev": "nuxi dev playground",
21
+ "dev:build": "nuxi build playground",
22
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
23
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
24
+ "lint": "eslint .",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest watch",
27
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
28
+ },
29
+ "dependencies": {
30
+ "@nuxt/kit": "^3.11.1",
31
+ "@unovis/vue": "^1.5.1",
32
+ "vue-chrts": "0.1.0"
33
+ },
34
+ "devDependencies": {
35
+ "@nuxt/eslint-config": "^0.2.0",
36
+ "@nuxt/module-builder": "^0.8.0",
37
+ "@nuxt/schema": "^3.11.1",
38
+ "@types/node": "^20.12.10",
39
+ "eslint": "^8.57.0",
40
+ "nuxt": "^3.11.1",
41
+ "typescript": "^5.4.5"
42
+ }
43
+ }