vue-data-ui-cli 0.0.3 → 0.0.5

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 (3) hide show
  1. package/boilerplate.js +14 -10
  2. package/emits.js +100 -42
  3. package/package.json +6 -1
package/boilerplate.js CHANGED
@@ -25,24 +25,25 @@ export default ({
25
25
  </template>-->
26
26
  `;
27
27
 
28
- // let emitFuncs = '';
29
- // let emitDefs = '';
28
+ let emitFuncs = '';
29
+ let emitDefs = '';
30
30
 
31
- // if (emits && emits.length) {
32
- // emitFuncs = emits.map(emit => {
33
- // return `${useTypescript ? emit.funcTs : emit.func}`
34
- // }).toString().replaceAll(',', '\n\n');
31
+ if (emits && emits.length) {
32
+ emitFuncs = emits.map(emit => {
33
+ return `${useTypescript ? emit.funcTs : emit.func}`
34
+ }).toString().replaceAll(',', '\n\n');
35
35
 
36
- // emitDefs = emits.map(emit => {
37
- // return `@${emit.name}="${emit.name}"`;
38
- // }).toString().replaceAll(',', '');
39
- // }
36
+ emitDefs = emits.map(emit => {
37
+ return `@${emit.name}="${emit.name}"`;
38
+ }).toString().replaceAll(',', '');
39
+ }
40
40
 
41
41
 
42
42
  return `
43
43
  <script setup${useTypescript ? ' lang="ts"' : ''}>
44
44
  import { ${[useComputedConfig, useComputedDataset].includes(false) ? 'ref, ' : ''}${useComputedConfig || useComputedDataset ? 'computed ' : ''}} from "vue";
45
45
  import { VueDataUi${useTypescript ? `,${['number', 'Array<Array<string | number>>', ''].includes(datasetType) ? '' : `type ${datasetType},`} type ${configType} }` : '}'} from "vue-data-ui";
46
+ import "vue-data-ui/style.css";
46
47
 
47
48
  ${!datasetType ? '' : `const dataset = ${useComputedDataset ? `computed${dsType}(() => {
48
49
  return ${ds};
@@ -57,6 +58,8 @@ const config = ${useComputedConfig ? `computed${confType}(() => {
57
58
  return ${conf};
58
59
  })` : `ref${confType}(${conf})`};
59
60
 
61
+ ${emitFuncs}
62
+
60
63
  </script>
61
64
 
62
65
  <template>
@@ -65,6 +68,7 @@ const config = ${useComputedConfig ? `computed${confType}(() => {
65
68
  component="${component}"
66
69
  ${!datasetType ? '' : `:dataset="dataset"`}
67
70
  :config="config"
71
+ ${emitDefs}
68
72
  ${componentSlots.length ? '>' : '/>'}
69
73
  ${ componentSlots.length ? '<!-- Use slots here in template tags. Official Vue slots documentation https://vuejs.org/guide/components/slots -->' : '' }
70
74
  ${ componentSlots.length ? `<!-- Documentation on Vue Data UI slots, check the slots tab at https://vue-data-ui.graphieros.com/docs#${componentLink} -->` : '' }
package/emits.js CHANGED
@@ -1,4 +1,4 @@
1
- export default(componentName) => {
1
+ export default (componentName) => {
2
2
  const emitExamples = {
3
3
  VueUiXy: [
4
4
  {
@@ -19,10 +19,10 @@ export default(componentName) => {
19
19
  console.log({ legend });
20
20
  }`,
21
21
  funcTs: `type VueUiXySelectedLegend = {
22
- name: string
23
- values: number[]
24
- color: string
25
- type: 'line' | 'bar' | 'plot'
22
+ readonly name: string
23
+ readonly values: number[]
24
+ readonly color: string
25
+ readonly type: 'line' | 'bar' | 'plot'
26
26
  }
27
27
  /*
28
28
  * @selectLegend - Returns the current visible series when selecting / unselecting the legend
@@ -60,13 +60,13 @@ export default(componentName) => {
60
60
  */
61
61
  type VueUiXySelectedX = {
62
62
  dataset: Array<{
63
- name: string
64
- value: number
65
- color: string
66
- type: 'line' | 'bar' | 'plot'
63
+ readonly name: string
64
+ readonly value: number
65
+ readonly color: string
66
+ readonly type: 'line' | 'bar' | 'plot'
67
67
  }>
68
- index: number
69
- indexLabel: string
68
+ readonly index: number
69
+ readonly indexLabel: string
70
70
  }
71
71
  function selectX(selectedX: VueUiXySelectedX) {
72
72
  console.log({ selectedX });
@@ -105,17 +105,17 @@ export default(componentName) => {
105
105
  */
106
106
  type VueUiXySelectedTimeLabel = {
107
107
  datapoint: Array<{
108
- shape: 'circle' | 'triangle' | 'square' | 'dialond' | 'pentagon' | 'star' | 'hexagon'
109
- name: string
110
- color: string
111
- type: 'line' | 'bar' | 'plot'
112
- value: number
113
- comments: string[]
114
- prefix: string
115
- suffix: string
108
+ readonly shape: 'circle' | 'triangle' | 'square' | 'diamond' | 'pentagon' | 'star' | 'hexagon'
109
+ readonly name: string
110
+ readonly color: string
111
+ readonly type: 'line' | 'bar' | 'plot'
112
+ readonly value: number
113
+ readonly comments: string[]
114
+ readonly prefix: string
115
+ readonly suffix: string
116
116
  }>
117
- absoluteIndex: number
118
- label: string
117
+ readonly absoluteIndex: number
118
+ readonly label: string
119
119
  }
120
120
  function selectTimeLabel(selectedTimeLabel: VueUiXySelectedTimeLabel) {
121
121
  console.log({ selectedTimeLabel })
@@ -125,31 +125,89 @@ export default(componentName) => {
125
125
  ],
126
126
  VueUiDonut: [
127
127
  {
128
- name: 'selectLegend',
128
+ name: 'selectDatapoint',
129
129
  func: `/**
130
- * @selectLegend - Returns the current visible series when selecting / unselecting the legend
131
- *
132
- * @typedef {Object} VueUiDonutSelectedLegend
133
- * @property {string} name - The name of the legend item.
134
- * @property {number} value - The value associated with the legend item.
135
- * @property {string} color - The color representing the legend item.
136
- *
137
- * @param {VueUiDonutSelectedLegend[]} legend - The current visible series when selecting or unselecting the legend.
138
- * @returns {void}
139
- */
140
- function selectLegend(legend){
141
- console.log({ legend });
130
+ * @selectDatapoint - On click returns the data related to the selected donut arc
131
+ *
132
+ * @typedef {Object} VueUiDonutDatapoint
133
+ * @property {number} index - The index of the datapoint in the dataset.
134
+ * @property {number[]} absoluteValues - The array of absolute values associated with the datapoint.
135
+ * @property {string} arcSlice - The SVG path describing the arc slice.
136
+ * @property {Object} center - The center point of the donut slice.
137
+ * @property {number} center.endX - The ending X coordinate of the center.
138
+ * @property {number} center.endY - The ending Y coordinate of the center.
139
+ * @property {string} center.path - The path associated with the center point.
140
+ * @property {number} center.startX - The starting X coordinate of the center.
141
+ * @property {number} center.startY - The starting Y coordinate of the center.
142
+ * @property {string} color - The color of the datapoint slice.
143
+ * @property {string} comment - A comment or note associated with the datapoint.
144
+ * @property {number} cx - The X coordinate of the slice center.
145
+ * @property {number} cy - The Y coordinate of the slice center.
146
+ * @property {number} endX - The ending X coordinate of the arc.
147
+ * @property {number} endY - The ending Y coordinate of the arc.
148
+ * @property {Object} firstSeparator - The first separator coordinates for the arc.
149
+ * @property {number} firstSeparator.x - The X coordinate of the first separator.
150
+ * @property {number} firstSeparator.y - The Y coordinate of the first separator.
151
+ * @property {string} name - The name of the datapoint.
152
+ * @property {string} path - The SVG path of the arc.
153
+ * @property {number} proportion - The proportion of the datapoint relative to the total.
154
+ * @property {number} ratio - The ratio of the datapoint relative to the total.
155
+ * @property {Object} separator - The separator coordinates for the arc.
156
+ * @property {number} separator.x - The X coordinate of the separator.
157
+ * @property {number} separator.y - The Y coordinate of the separator.
158
+ * @property {number} seriesIndex - The index of the series to which the datapoint belongs.
159
+ * @property {number} startX - The starting X coordinate of the arc.
160
+ * @property {number} startY - The starting Y coordinate of the arc.
161
+ * @property {number} value - The value associated with the datapoint.
162
+ *
163
+ * Logs the data related to the selected donut arc.
164
+ *
165
+ * @param {VueUiDonutDatapoint} datapoint - The data related to the selected donut arc.
166
+ * @returns {void}
167
+ */
168
+ function selectDatapoint(datapoint) {
169
+ console.log(datapoint);
142
170
  }`,
143
- funcTs: `type VueUiDonutSelectedLegend = {
144
- name: string
145
- value: number
146
- color: string
171
+ funcTs: `type VueUiDonutDatapoint = {
172
+ readonly index: number
173
+ readonly absoluteValues: number[]
174
+ readonly arcSlice: string
175
+ readonly center: {
176
+ endX: number
177
+ endY: number
178
+ path: string
179
+ startX: number
180
+ startY: number
181
+ }
182
+ readonly color: string
183
+ readonly comment: string
184
+ readonly cx: number
185
+ readonly cy: number
186
+ readonly endX: number
187
+ readonly endY: number
188
+ readonly firstSeparator: {
189
+ x: number
190
+ y: number
191
+ }
192
+ readonly name: string
193
+ readonly path: string
194
+ readonly proportion: number
195
+ readonly ratio: number
196
+ readonly separator: {
197
+ x: number
198
+ y: number
199
+ }
200
+ readonly seriesIndex: number
201
+ readonly startX: number
202
+ readonly startY: number
203
+ readonly value: number
147
204
  }
148
- /*
149
- * @selectLegend - Returns the current visible series when selecting / unselecting the legend
205
+
206
+ /**
207
+ * @selectDatapoint - On click returns the data related to the selected donut arc
150
208
  */
151
- function selectLegend(legend: VueUiDonutSelectedLegend[]){
152
- console.log({ legend });
209
+ function selectDatapoint(datapoint: VueUiDonutDatapoint){
210
+ console.log(datapoint)
153
211
  }`,
154
212
  },
155
213
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-data-ui-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "description": "A CLI tool to generate Vue Data UI chart component boilerplates",
6
6
  "main": "index.js",
@@ -18,6 +18,11 @@
18
18
  ],
19
19
  "author": "Alec Lloyd Probert",
20
20
  "license": "MIT",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/graphieros/vue-data-ui-cli.git"
24
+ },
25
+ "homepage": "https://vue-data-ui.graphieros.com/",
21
26
  "dependencies": {
22
27
  "chalk": "^5.4.0",
23
28
  "commander": "^12.1.0",