vue-data-ui-cli 0.0.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/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "es5",
6
+ "vueIndentScriptAndStyle": true
7
+ }
package/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 ALEC LLOYD PROBERT
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,32 @@
1
+ # Vue Data UI CLI
2
+
3
+ A CLI tool to generate Vue Data UI chart component boilerplates.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i -g vue-data-ui-cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Run the CLI command:
14
+
15
+ ```bash
16
+ vdui-cli
17
+ ```
18
+
19
+ You will be prompted for the following:
20
+
21
+ - Select a Vue Data UI component
22
+ - Use computed or ref for the dataset
23
+ - Use computed or ref for the config
24
+ - Use TypeScript or not
25
+ - The name of your Vue component
26
+ - The directory to create the component
27
+
28
+ The tool will then create a Vue file containing the boilerplate chart component, with a sample dataset for immediate testing.
29
+
30
+ ## Vue Data UI documentation
31
+
32
+ Check out the [official documentation website](https://vue-data-ui.graphieros.com/)
package/boilerplate.js ADDED
@@ -0,0 +1,76 @@
1
+ export default ({
2
+ component,
3
+ config,
4
+ dataset,
5
+ useTypescript,
6
+ useComputedDataset,
7
+ useComputedConfig,
8
+ configType,
9
+ datasetType,
10
+ isDatasetArray,
11
+ componentSlots,
12
+ componentLink,
13
+ emits
14
+ }) => {
15
+
16
+ const dsType = useTypescript ? `<${`${datasetType}${isDatasetArray ? '[]' : ''}`}>` : '';
17
+ const confType = useTypescript ? `<${configType}>` : '';
18
+ const ds = JSON.stringify(dataset);
19
+ const conf = JSON.stringify(config);
20
+
21
+ const sourceSlot = `
22
+ <!-- #source slot: display the source for your data -->
23
+ <!--<template #source>
24
+ <small>Source: <cite>My source</cite></small>
25
+ </template>-->
26
+ `;
27
+
28
+ // let emitFuncs = '';
29
+ // let emitDefs = '';
30
+
31
+ // if (emits && emits.length) {
32
+ // emitFuncs = emits.map(emit => {
33
+ // return `${useTypescript ? emit.funcTs : emit.func}`
34
+ // }).toString().replaceAll(',', '\n\n');
35
+
36
+ // emitDefs = emits.map(emit => {
37
+ // return `@${emit.name}="${emit.name}"`;
38
+ // }).toString().replaceAll(',', '');
39
+ // }
40
+
41
+
42
+ return `
43
+ <script setup${useTypescript ? ' lang="ts"' : ''}>
44
+ import { ${[useComputedConfig, useComputedDataset].includes(false) ? 'ref, ' : ''}${useComputedConfig || useComputedDataset ? 'computed ' : ''}} from "vue";
45
+ import { VueDataUi${useTypescript ? `,${['number', 'Array<Array<string | number>>', ''].includes(datasetType) ? '' : `type ${datasetType},`} type ${configType} }` : '}'} from "vue-data-ui";
46
+
47
+ ${!datasetType ? '' : `const dataset = ${useComputedDataset ? `computed${dsType}(() => {
48
+ return ${ds};
49
+ })` : `ref${dsType}(${ds})`};`}
50
+
51
+ /**
52
+ * This is the default config.
53
+ * It is not required to send it all to the component.
54
+ * You can keep only the modified attributes you need.
55
+ */
56
+ const config = ${useComputedConfig ? `computed${confType}(() => {
57
+ return ${conf};
58
+ })` : `ref${confType}(${conf})`};
59
+
60
+ </script>
61
+
62
+ <template>
63
+ <div :style="{ width: '600px' }">
64
+ <VueDataUi
65
+ component="${component}"
66
+ ${!datasetType ? '' : `:dataset="dataset"`}
67
+ :config="config"
68
+ ${componentSlots.length ? '>' : '/>'}
69
+ ${ componentSlots.length ? '<!-- Use slots here in template tags. Official Vue slots documentation https://vuejs.org/guide/components/slots -->' : '' }
70
+ ${ componentSlots.length ? `<!-- Documentation on Vue Data UI slots, check the slots tab at https://vue-data-ui.graphieros.com/docs#${componentLink} -->` : '' }
71
+ ${ componentSlots.includes('source') ? sourceSlot : ''}
72
+ ${componentSlots.length ? '</VueDataUi>' : ''}
73
+ </div>
74
+ </template>
75
+ `;
76
+ };