vue-chrts 0.0.109 → 0.0.111

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.
Files changed (70) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/auto-imports.d.ts +58 -0
  3. package/components.d.ts +46 -0
  4. package/image.png +0 -0
  5. package/index.html +14 -0
  6. package/index.js +2 -0
  7. package/package.json +17 -22
  8. package/src/components/Area/AreaChart.vue +141 -0
  9. package/src/components/Area/index.ts +1 -0
  10. package/src/components/AreaStacked/AreaStackedChart.vue +51 -0
  11. package/src/components/AreaStacked/index.ts +1 -0
  12. package/src/components/Bar/BarChart.vue +130 -0
  13. package/src/components/Bar/index.ts +1 -0
  14. package/src/components/Crosshair/Crosshair.vue +46 -0
  15. package/src/components/Crosshair/index.ts +1 -0
  16. package/src/components/Donut/DonutChart.vue +71 -0
  17. package/src/components/Donut/index.ts +1 -0
  18. package/src/components/Line/LineChart.vue +94 -0
  19. package/src/components/Line/index.ts +1 -0
  20. package/src/components/Tooltip.vue +17 -0
  21. package/src/components.ts +6 -0
  22. package/src/index.ts +6 -0
  23. package/src/shims-vue.d.ts +1 -0
  24. package/src-demo/AdminTemplate.vue +5 -0
  25. package/src-demo/App.vue +37 -0
  26. package/src-demo/AreaChartPage.vue +125 -0
  27. package/src-demo/BarChartPage.vue +166 -0
  28. package/src-demo/DashboardTemplate.vue +687 -0
  29. package/src-demo/Homepage.vue +325 -0
  30. package/src-demo/LineChartPage.vue +140 -0
  31. package/src-demo/assets/main.css +34 -0
  32. package/src-demo/components/Progress/Progress.vue +42 -0
  33. package/src-demo/components/Progress/index.ts +1 -0
  34. package/src-demo/components/Status/Status.vue +95 -0
  35. package/src-demo/components/Status/index.ts +1 -0
  36. package/src-demo/components/charts.ts +37 -0
  37. package/src-demo/components/index.ts +49 -0
  38. package/src-demo/data/AreaChartData.ts +294 -0
  39. package/src-demo/data/BarChartData.ts +79 -0
  40. package/src-demo/data/IncomeExpenseData.ts +189 -0
  41. package/src-demo/data/InvestmentData.ts +352 -0
  42. package/src-demo/data/RevenueData.ts +58 -0
  43. package/src-demo/data/VisitorsData.ts +260 -0
  44. package/src-demo/elements/Button.vue +13 -0
  45. package/src-demo/elements/Card.vue +17 -0
  46. package/src-demo/elements/Dropdown.vue +112 -0
  47. package/src-demo/elements/Logo.vue +8 -0
  48. package/src-demo/elements/Table.vue +363 -0
  49. package/src-demo/elements/TopBar.vue +40 -0
  50. package/src-demo/index.ts +58 -0
  51. package/tsconfig.json +11 -0
  52. package/vite.config.ts +59 -0
  53. package/dist/Area/AreaChart.vue.d.ts +0 -11
  54. package/dist/Area/index.d.ts +0 -23
  55. package/dist/AreaStacked/AreaStackedChart.vue.d.ts +0 -8
  56. package/dist/AreaStacked/index.d.ts +0 -7
  57. package/dist/Bar/BarChart.vue.d.ts +0 -11
  58. package/dist/Bar/index.d.ts +0 -23
  59. package/dist/Donut/DonutChart.vue.d.ts +0 -11
  60. package/dist/Donut/index.d.ts +0 -12
  61. package/dist/Line/LineChart.vue.d.ts +0 -8
  62. package/dist/Line/index.d.ts +0 -20
  63. package/dist/Progress/Progress.vue.d.ts +0 -2
  64. package/dist/Status/Status.vue.d.ts +0 -2
  65. package/dist/Tooltip/Tooltip.vue.d.ts +0 -10
  66. package/dist/charts-CO6Yq10P.js +0 -16172
  67. package/dist/charts.d.ts +0 -7
  68. package/dist/index.d.ts +0 -6
  69. package/dist/index.js +0 -193
  70. /package/{dist → public}/vite.svg +0 -0
@@ -0,0 +1,112 @@
1
+ <script setup lang="ts">
2
+ import { ref, onMounted, onBeforeUnmount } from "vue";
3
+
4
+ // Props (if needed)
5
+ const props = defineProps({
6
+ initialOption: {
7
+ type: String,
8
+ default: "24 hours",
9
+ },
10
+ optionList: {
11
+ type: Array,
12
+ default: () => ["24 hours", "30 days"],
13
+ },
14
+ });
15
+
16
+ // Emits
17
+ const emit = defineEmits(["option-selected"]);
18
+
19
+ // Reactive state
20
+ const isOpen = ref(false);
21
+ const selectedOption = ref(props.initialOption);
22
+ const options = ref(props.optionList);
23
+
24
+ // Methods
25
+ const toggleDropdown = () => {
26
+ isOpen.value = !isOpen.value;
27
+ };
28
+
29
+ const selectOption = (option) => {
30
+ selectedOption.value = option;
31
+ isOpen.value = false;
32
+ emit("option-selected", option);
33
+ };
34
+
35
+ const clickOutside = (e) => {
36
+ if (!e.target.closest(".relative")) {
37
+ isOpen.value = false;
38
+ }
39
+ };
40
+
41
+ // Lifecycle hooks
42
+ onMounted(() => {
43
+ document.addEventListener("click", clickOutside);
44
+ });
45
+
46
+ onBeforeUnmount(() => {
47
+ document.removeEventListener("click", clickOutside);
48
+ });
49
+ </script>
50
+
51
+ <template>
52
+ <div class="relative min-w-32 w-auto inline-block">
53
+ <!-- Dropdown Button -->
54
+ <button
55
+ @click="toggleDropdown"
56
+ class="flex items-center justify-between w-full px-4 py-2 text-sm text-white bg-card rounded-md hover:bg-card focus:outline-none ring ring-border"
57
+ >
58
+ <span>{{ selectedOption }}</span>
59
+ <svg
60
+ class="w-4 h-4 ml-2"
61
+ :class="{ 'transform rotate-180': isOpen }"
62
+ fill="none"
63
+ stroke="currentColor"
64
+ viewBox="0 0 24 24"
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ >
67
+ <path
68
+ stroke-linecap="round"
69
+ stroke-linejoin="round"
70
+ stroke-width="2"
71
+ d="M19 9l-7 7-7-7"
72
+ ></path>
73
+ </svg>
74
+ </button>
75
+
76
+ <!-- Dropdown Menu -->
77
+ <div
78
+ v-if="isOpen"
79
+ class="absolute z-10 w-full mt-1 bg-card rounded-md shadow-lg ring ring-border"
80
+ >
81
+ <div class="py-1">
82
+ <a
83
+ v-for="(option, index) in options"
84
+ :key="index"
85
+ @click="selectOption(option)"
86
+ class="block px-4 py-2 text-sm text-white hover:bg-background cursor-pointer"
87
+ :class="{ 'bg-card': option === selectedOption }"
88
+ >
89
+ <div class="flex items-center">
90
+ <svg
91
+ v-if="option === selectedOption"
92
+ class="w-4 h-4 mr-2"
93
+ fill="none"
94
+ stroke="currentColor"
95
+ viewBox="0 0 24 24"
96
+ xmlns="http://www.w3.org/2000/svg"
97
+ >
98
+ <path
99
+ stroke-linecap="round"
100
+ stroke-linejoin="round"
101
+ stroke-width="2"
102
+ d="M5 13l4 4L19 7"
103
+ ></path>
104
+ </svg>
105
+ <span v-else class="w-4 h-4 mr-2"></span>
106
+ {{ option }}
107
+ </div>
108
+ </a>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </template>
@@ -0,0 +1,8 @@
1
+ <template>
2
+ <div class="flex items-center justify-between">
3
+ <div class="flex items-center gap-2">
4
+ <img width="40" src="https://nuxterror.com/logo.svg" alt="" />
5
+ <h6 class="text-xl font-bold">Nuxt Charts</h6>
6
+ </div>
7
+ </div>
8
+ </template>
@@ -0,0 +1,363 @@
1
+ // components/TanStackTable.vue
2
+ <script setup lang="ts">
3
+ import {
4
+ FlexRender,
5
+ getCoreRowModel,
6
+ getPaginationRowModel,
7
+ getSortedRowModel,
8
+ getFilteredRowModel,
9
+ useVueTable,
10
+ ColumnDef,
11
+ SortingState,
12
+ PaginationState,
13
+ ColumnFiltersState,
14
+ Row
15
+ } from '@tanstack/vue-table'
16
+ import { computed, ref } from 'vue'
17
+
18
+ // Define the types for the props
19
+ type TableSize = 'sm' | 'md' | 'lg'
20
+ type PaginationPosition = 'top' | 'bottom' | 'both' | 'none'
21
+
22
+ // Define the props with defaults
23
+ const props = withDefaults(defineProps<{
24
+ // Data and columns
25
+ data: any[]
26
+ columns: ColumnDef<any, any>[]
27
+
28
+ // Features
29
+ enableSorting?: boolean
30
+ enableMultiSort?: boolean
31
+ enablePagination?: boolean
32
+ enableFiltering?: boolean
33
+ enableRowSelection?: boolean
34
+
35
+ // Appearance
36
+ tableSize?: TableSize
37
+ striped?: boolean
38
+ hover?: boolean
39
+ bordered?: boolean
40
+
41
+ // Pagination
42
+ paginationPosition?: PaginationPosition
43
+ pageSizeOptions?: any
44
+ initialPageSize?: number
45
+
46
+ // Functions
47
+ onRowClick?: (row: Row<any>) => void
48
+ getRowClass?: (row: Row<any>) => string
49
+ }>(), {
50
+ // Default prop values
51
+ enableSorting: true,
52
+ enableMultiSort: false,
53
+ enablePagination: true,
54
+ enableFiltering: false,
55
+ enableRowSelection: false,
56
+ tableSize: 'md',
57
+ striped: true,
58
+ hover: true,
59
+ bordered: false,
60
+ paginationPosition: 'bottom',
61
+ pageSizeOptions: [10, 20, 50, 100],
62
+ initialPageSize: 10,
63
+ })
64
+
65
+ // Define emits for external state management
66
+ const emit = defineEmits<{
67
+ 'update:sorting': [sorting: SortingState]
68
+ 'update:pagination': [pagination: PaginationState]
69
+ 'update:filters': [filters: ColumnFiltersState]
70
+ 'update:selectedRows': [selectedRowIds: Record<string, boolean>]
71
+ 'row-click': [row: Row<any>]
72
+ }>()
73
+
74
+ // Internal state
75
+ const sorting = ref<SortingState>([])
76
+ const pagination = ref<PaginationState>({
77
+ pageIndex: 0,
78
+ pageSize: props.initialPageSize,
79
+ })
80
+ const columnFilters = ref<ColumnFiltersState>([])
81
+ const rowSelection = ref<Record<string, boolean>>({})
82
+ const globalFilter = ref('')
83
+
84
+ // Create table instance with options
85
+ const table = useVueTable({
86
+ get data() { return props.data },
87
+ get columns() { return props.columns },
88
+ state: {
89
+ get sorting() { return sorting.value },
90
+ get pagination() { return pagination.value },
91
+ get columnFilters() { return columnFilters.value },
92
+ get rowSelection() { return rowSelection.value },
93
+ get globalFilter() { return globalFilter.value },
94
+ },
95
+ onSortingChange: (updater) => {
96
+ sorting.value = typeof updater === 'function' ? updater(sorting.value) : updater
97
+ emit('update:sorting', sorting.value)
98
+ },
99
+ onPaginationChange: (updater) => {
100
+ pagination.value = typeof updater === 'function' ? updater(pagination.value) : updater
101
+ emit('update:pagination', pagination.value)
102
+ },
103
+ onColumnFiltersChange: (updater) => {
104
+ columnFilters.value = typeof updater === 'function' ? updater(columnFilters.value) : updater
105
+ emit('update:filters', columnFilters.value)
106
+ },
107
+ onRowSelectionChange: (updater) => {
108
+ rowSelection.value = typeof updater === 'function' ? updater(rowSelection.value) : updater
109
+ emit('update:selectedRows', rowSelection.value)
110
+ },
111
+ onGlobalFilterChange: (updater) => {
112
+ globalFilter.value = typeof updater === 'function' ? updater(globalFilter.value) : updater
113
+ },
114
+ getCoreRowModel: getCoreRowModel(),
115
+ getSortedRowModel: getSortedRowModel(),
116
+ getPaginationRowModel: getPaginationRowModel(),
117
+ getFilteredRowModel: getFilteredRowModel(),
118
+ enableMultiSort: props.enableMultiSort,
119
+ enableSorting: props.enableSorting,
120
+ enableRowSelection: props.enableRowSelection,
121
+ enableFilters: props.enableFiltering,
122
+ manualPagination: !props.enablePagination,
123
+ })
124
+
125
+ // Handle row click events
126
+ const handleRowClick = (row: Row<any>) => {
127
+ if (props.onRowClick) {
128
+ props.onRowClick(row)
129
+ }
130
+ emit('row-click', row)
131
+ }
132
+
133
+ // Computed styles based on size
134
+ const tableSizeClasses = computed(() => {
135
+ switch (props.tableSize) {
136
+ case 'sm':
137
+ return {
138
+ table: 'text-xs',
139
+ cell: 'px-2 py-1',
140
+ pagination: 'text-xs'
141
+ }
142
+ case 'lg':
143
+ return {
144
+ table: 'text-base',
145
+ cell: 'px-6 py-4',
146
+ pagination: 'text-base'
147
+ }
148
+ default: // 'md'
149
+ return {
150
+ table: 'text-sm',
151
+ cell: 'px-4 py-2',
152
+ pagination: 'text-sm'
153
+ }
154
+ }
155
+ })
156
+
157
+ // Computed classes for table styling
158
+ const tableClasses = computed(() => {
159
+ return [
160
+ 'min-w-full divide-y divide-neutral-600 border-collapse',
161
+ tableSizeClasses.value.table,
162
+ props.bordered ? 'border border-gray-200' : '',
163
+ ]
164
+ })
165
+
166
+ // Row classes
167
+ const getRowClasses = (row: Row<any>) => {
168
+ const classes = [
169
+ 'transition-colors',
170
+ props.hover ? 'dark:hover:bg-neutral-900 hover:bg-neutral-100' : '',
171
+ props.striped && row.index % 2 === 1 ? 'bg-neutral' : '',
172
+ props.enableRowSelection && row.getIsSelected() ? 'bg-blue-50 hover:bg-blue-100' : '',
173
+ ]
174
+
175
+ if (props.getRowClass) {
176
+ classes.push(props.getRowClass(row))
177
+ }
178
+
179
+ return classes.join(' ')
180
+ }
181
+
182
+ // Cell classes
183
+ const getCellClasses = (isHeader = false) => {
184
+ return [
185
+ tableSizeClasses.value.cell,
186
+ isHeader ? 'font-semibold text-neutral-500 border-b border-border capitalize' : ' text-neutral-600 dark:text-neutral-400',
187
+ props.bordered ? 'border border-border' : '',
188
+ ].join(' ')
189
+ }
190
+
191
+ // Expose the table instance and key states for external use
192
+ defineExpose({
193
+ tableInstance: table,
194
+ sorting,
195
+ pagination,
196
+ columnFilters,
197
+ rowSelection,
198
+ globalFilter,
199
+ })
200
+ </script>
201
+
202
+ <template>
203
+ <div class="overflow-x-auto w-full">
204
+ <!-- Top Pagination -->
205
+ <div v-if="['top', 'both'].includes(paginationPosition) && enablePagination" class="mb-2">
206
+ <div class="flex justify-between items-center">
207
+ <div class="flex items-center gap-2">
208
+ <span :class="tableSizeClasses.pagination">Rows per page:</span>
209
+ <select
210
+ v-model="pagination.pageSize"
211
+ class="border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500"
212
+ >
213
+ <option v-for="size in pageSizeOptions" :key="size" :value="size">
214
+ {{ size }}
215
+ </option>
216
+ </select>
217
+ </div>
218
+ <div class="flex items-center gap-2">
219
+ <button
220
+ @click="table.previousPage"
221
+ :disabled="!table.getCanPreviousPage()"
222
+ class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
223
+ >
224
+ <span class="sr-only">Previous</span>
225
+ <span class="inline-block">&lt;</span>
226
+ </button>
227
+ <span :class="tableSizeClasses.pagination">
228
+ Page {{ table.getState().pagination.pageIndex + 1 }} of {{ table.getPageCount() }}
229
+ </span>
230
+ <button
231
+ @click="table.nextPage"
232
+ :disabled="!table.getCanNextPage()"
233
+ class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
234
+ >
235
+ <span class="sr-only">Next</span>
236
+ <span class="inline-block">&gt;</span>
237
+ </button>
238
+ </div>
239
+ </div>
240
+ </div>
241
+
242
+ <!-- Global Filter -->
243
+ <div v-if="enableFiltering" class="mb-2">
244
+ <input
245
+ v-model="globalFilter"
246
+ placeholder="Search all columns..."
247
+ class="border border-gray-300 rounded px-3 py-2 w-full max-w-sm"
248
+ />
249
+ </div>
250
+
251
+ <!-- Table -->
252
+ <table :class="tableClasses">
253
+ <thead>
254
+ <tr v-for="headerGroup in table.getHeaderGroups()" :key="headerGroup.id">
255
+ <th
256
+ v-for="header in headerGroup.headers"
257
+ :key="header.id"
258
+ :class="[
259
+ getCellClasses(true),
260
+ header.column.getCanSort() ? 'cursor-pointer select-none' : '',
261
+ 'text-left'
262
+ ]"
263
+ @click="header.column.getToggleSortingHandler()"
264
+ >
265
+ <div class="flex items-center gap-1">
266
+ <FlexRender
267
+ v-if="header.isPlaceholder"
268
+ :render="header.column.columnDef.header"
269
+ :props="header.getContext()"
270
+ />
271
+
272
+ <!-- Column title with sort icons -->
273
+ <div v-else class="flex-1">
274
+ <FlexRender
275
+ :render="header.column.columnDef.header"
276
+ :props="header.getContext()"
277
+ />
278
+ </div>
279
+
280
+ <!-- Sort indicator -->
281
+ <div class="w-4" v-if="header.column.getCanSort()">
282
+ {{{
283
+ asc: '▲',
284
+ desc: '▼',
285
+ }[header.column.getIsSorted() as string] ?? '⬍'}}
286
+ </div>
287
+ </div>
288
+ </th>
289
+ </tr>
290
+ </thead>
291
+ <tbody class="divide-y divide-border">
292
+ <template v-if="table.getRowModel().rows.length">
293
+ <tr
294
+ v-for="row in table.getRowModel().rows"
295
+ :key="row.id"
296
+ :class="getRowClasses(row)"
297
+ @click="handleRowClick(row)"
298
+ >
299
+ <td
300
+ v-for="cell in row.getVisibleCells()"
301
+ :key="cell.id"
302
+ :class="getCellClasses()"
303
+ >
304
+ <FlexRender
305
+ :render="cell.column.columnDef.cell"
306
+ :props="cell.getContext()"
307
+ />
308
+ </td>
309
+ </tr>
310
+ </template>
311
+ <template v-else>
312
+ <tr>
313
+ <td
314
+ :colspan="table.getAllColumns().length"
315
+ :class="getCellClasses()"
316
+ class="text-center py-4"
317
+ >
318
+ No results found
319
+ </td>
320
+ </tr>
321
+ </template>
322
+ </tbody>
323
+ </table>
324
+
325
+ <!-- Bottom Pagination -->
326
+ <div v-if="['bottom', 'both'].includes(paginationPosition) && enablePagination" class="mt-2">
327
+ <div class="flex justify-between items-center">
328
+ <div class="flex items-center gap-2">
329
+ <span :class="tableSizeClasses.pagination">Rows per page:</span>
330
+ <select
331
+ v-model="pagination.pageSize"
332
+ class="border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500"
333
+ >
334
+ <option v-for="size in pageSizeOptions" :key="size" :value="size">
335
+ {{ size }}
336
+ </option>
337
+ </select>
338
+ </div>
339
+ <div class="flex items-center gap-2">
340
+ <button
341
+ @click="table.previousPage"
342
+ :disabled="!table.getCanPreviousPage()"
343
+ class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
344
+ >
345
+ <span class="sr-only">Previous</span>
346
+ <span class="inline-block">&lt;</span>
347
+ </button>
348
+ <span :class="tableSizeClasses.pagination">
349
+ Page {{ table.getState().pagination.pageIndex + 1 }} of {{ table.getPageCount() }}
350
+ </span>
351
+ <button
352
+ @click="table.nextPage"
353
+ :disabled="!table.getCanNextPage()"
354
+ class="px-3 py-1 border border-gray-300 rounded disabled:opacity-50"
355
+ >
356
+ <span class="sr-only">Next</span>
357
+ <span class="inline-block">&gt;</span>
358
+ </button>
359
+ </div>
360
+ </div>
361
+ </div>
362
+ </div>
363
+ </template>
@@ -0,0 +1,40 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from "vue";
3
+ import Logo from "./Logo.vue";
4
+
5
+ import { useColorMode } from "@vueuse/core";
6
+ const colorMode = useColorMode();
7
+ const isDark = computed(() => colorMode.value === "dark");
8
+
9
+ function setColorMode() {
10
+ colorMode.value = isDark.value ? "light" : "dark";
11
+ }
12
+ </script>
13
+ <template>
14
+ <div class="border-b border-border">
15
+ <div
16
+ class="mx-auto py-4 flex items-center justify-between"
17
+ :class="$route.fullPath === '/admin' ? 'max-w-full px-16' : 'max-w-7xl'"
18
+ >
19
+ <RouterLink to="/">
20
+ <Logo></Logo>
21
+ </RouterLink>
22
+ <svg
23
+ @click="setColorMode"
24
+ xmlns="http://www.w3.org/2000/svg"
25
+ viewBox="0 0 16 16"
26
+ fill="currentColor"
27
+ class="size-5 cursor-pointer"
28
+ >
29
+ <path
30
+ v-if="!isDark"
31
+ d="M14.438 10.148c.19-.425-.321-.787-.748-.601A5.5 5.5 0 0 1 6.453 2.31c.186-.427-.176-.938-.6-.748a6.501 6.501 0 1 0 8.585 8.586Z"
32
+ />
33
+ <path
34
+ v-else
35
+ d="M8 1a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 1ZM10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM12.95 4.11a.75.75 0 1 0-1.06-1.06l-1.062 1.06a.75.75 0 0 0 1.061 1.062l1.06-1.061ZM15 8a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 15 8ZM11.89 12.95a.75.75 0 0 0 1.06-1.06l-1.06-1.062a.75.75 0 0 0-1.062 1.061l1.061 1.06ZM8 12a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 12ZM5.172 11.89a.75.75 0 0 0-1.061-1.062L3.05 11.89a.75.75 0 1 0 1.06 1.06l1.06-1.06ZM4 8a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 4 8ZM4.11 5.172A.75.75 0 0 0 5.173 4.11L4.11 3.05a.75.75 0 1 0-1.06 1.06l1.06 1.06Z"
36
+ />
37
+ </svg>
38
+ </div>
39
+ </div>
40
+ </template>
@@ -0,0 +1,58 @@
1
+
2
+ import { createApp } from 'vue'
3
+ import { createRouter, createWebHistory } from "vue-router";
4
+
5
+ import './assets/main.css'
6
+
7
+ import App from './App.vue'
8
+
9
+ const app = createApp(App)
10
+
11
+ const router = createRouter({
12
+ routes: [
13
+ {
14
+ path: '/',
15
+ name: 'Home',
16
+ component: () => import('./Homepage.vue')
17
+ },
18
+ {
19
+ path: '/admin',
20
+ name: 'AdminTemplate',
21
+ component: () => import('./AdminTemplate.vue')
22
+ },
23
+ {
24
+ path: '/dashboard',
25
+ name: 'DashboardTemplate',
26
+ component: () => import('./DashboardTemplate.vue')
27
+ },
28
+ {
29
+ path: '/area-charts',
30
+ name: 'AreaCharts',
31
+ component: () => import('./AreaChartPage.vue')
32
+ },
33
+ {
34
+ path: '/line-charts',
35
+ name: 'LineCharts',
36
+ component: () => import('./LineChartPage.vue')
37
+ },
38
+ {
39
+ path: '/bar-charts',
40
+ name: 'BarCharts',
41
+ component: () => import('./BarChartPage.vue')
42
+ },
43
+ // {
44
+ // path: '/overview',
45
+ // name: 'Overview',
46
+ // component: () => import('./components/Overview.vue') // Replace with your OverviewPage component path
47
+ // }
48
+ ],
49
+ history: createWebHistory(),
50
+ });
51
+
52
+ app.use(router);
53
+
54
+ app.mount('#app')
55
+
56
+ export default {
57
+
58
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ // "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": ["src/**/*.vue", "src/**/*.ts"],
4
+ "compilerOptions": {
5
+ "moduleResolution": "Node",
6
+ "skipLibCheck": true,
7
+ "outDir": "dist"
8
+ },
9
+ "exclude": ["node_modules/*"]
10
+ }
11
+
package/vite.config.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { resolve } from 'node:path'
2
+ import { UserConfig, defineConfig } from 'vite'
3
+ import vue from "@vitejs/plugin-vue";
4
+ import dts from "vite-plugin-dts";
5
+ import tailwindcss from "@tailwindcss/vite";
6
+ import type { ModuleFormat, OutputOptions } from 'rollup'
7
+
8
+ const outputDefault = (format: ModuleFormat, extension: string): OutputOptions => ({
9
+ // Provide global variables to use in the UMD build
10
+ // for externalized deps
11
+ globals: {
12
+ vue: 'Vue'
13
+ },
14
+ format,
15
+ entryFileNames: ({ name }) => {
16
+ return `${name.replace('.vue', '')}.${extension}`
17
+ }
18
+ })
19
+
20
+ export default defineConfig(({ command, mode }): UserConfig => {
21
+ if (command === 'build' && mode !== 'gallery') {
22
+ return {
23
+ plugins: [
24
+ vue(),
25
+ dts({
26
+ insertTypesEntry: true,
27
+ include: ['src/**/*.ts', 'src/**/*.vue'],
28
+ }),
29
+ ],
30
+ build: {
31
+ emptyOutDir: true,
32
+ lib: {
33
+ name: 'vue-chrts',
34
+ fileName: 'index',
35
+ entry: resolve(__dirname, 'src/index.ts'),
36
+ },
37
+ rollupOptions: {
38
+ // make sure to externalize deps that shouldn't be bundled
39
+ // into your library (Vue)
40
+ external: ['vue'],
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
+ // @ts-ignore overloaded issue
43
+ output: [outputDefault('cjs', 'cjs'), outputDefault('es', 'js')],
44
+ },
45
+ sourcemap: true,
46
+ },
47
+ }
48
+ } else {
49
+ return {
50
+ plugins: [
51
+ vue(),
52
+ tailwindcss()
53
+ ],
54
+ build: {
55
+ outDir: 'dist-demo',
56
+ },
57
+ }
58
+ }
59
+ })
@@ -1,11 +0,0 @@
1
- declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<any & any, string | number | symbol>> & {} & any;
3
- expose(exposed: import('../../../vue/dist/vue.esm-bundler.js').ShallowUnwrapRef<{}>): void;
4
- attrs: any;
5
- slots: ReturnType<() => {}>;
6
- emit: typeof __VLS_emit;
7
- }>) => any;
8
- export default _default;
9
- type __VLS_Prettify<T> = {
10
- [K in keyof T]: T[K];
11
- } & {};
@@ -1,23 +0,0 @@
1
- import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
2
- import { PaginationPosition } from '../charts';
3
-
4
- export { default as AreaChart } from './AreaChart.vue';
5
- export type AreaChartProps<T> = {
6
- data: T[];
7
- height: number;
8
- xLabel?: string;
9
- yLabel?: string;
10
- categories: Record<string, BulletLegendItemInterface>;
11
- xFormatter: (i: number, idx: number) => string;
12
- yFormatter?: (i: number, idx?: number) => string | number;
13
- curveType?: CurveType;
14
- xNumTicks?: number;
15
- yNumTicks?: number;
16
- hideLegend?: boolean;
17
- hideTooltip?: boolean;
18
- gridLineX?: boolean;
19
- domainLineX?: boolean;
20
- gridLineY?: boolean;
21
- domainLineY?: boolean;
22
- paginationPoisition?: PaginationPosition;
23
- };