@vuer-ai/vuer-uikit 0.0.99 → 0.0.101

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 (221) hide show
  1. package/dist/SyncScroll/SyncScroll.cjs +3 -3
  2. package/dist/SyncScroll/SyncScroll.mjs +3 -3
  3. package/dist/SyncScroll/index.cjs +3 -3
  4. package/dist/SyncScroll/index.mjs +3 -3
  5. package/dist/chunk-LPA6WYFD.cjs +26 -0
  6. package/dist/{chunk-OEI7NCF6.cjs → chunk-M5UZ3SBY.cjs} +46 -2
  7. package/dist/{chunk-QHPFLC2O.mjs → chunk-MEE3IHTT.mjs} +46 -3
  8. package/dist/{chunk-WIGYDOHM.cjs → chunk-QBFOBDBC.cjs} +2 -2
  9. package/dist/chunk-TPPM276W.mjs +24 -0
  10. package/dist/{chunk-XMFU7SDD.mjs → chunk-VO3C6RE2.mjs} +2 -2
  11. package/dist/dial/DialPanel.cjs +17 -16
  12. package/dist/dial/DialPanel.mjs +16 -15
  13. package/dist/dial/index.cjs +33 -32
  14. package/dist/dial/index.mjs +16 -15
  15. package/dist/dial/wrapped-inputs/ControlledInputs.cjs +20 -19
  16. package/dist/dial/wrapped-inputs/ControlledInputs.mjs +16 -15
  17. package/dist/dial/wrapped-inputs/DialInputs.cjs +31 -26
  18. package/dist/dial/wrapped-inputs/DialInputs.d.cts +4 -1
  19. package/dist/dial/wrapped-inputs/DialInputs.d.ts +4 -1
  20. package/dist/dial/wrapped-inputs/DialInputs.mjs +16 -15
  21. package/dist/dial/wrapped-inputs/DialVectorInput.cjs +17 -16
  22. package/dist/dial/wrapped-inputs/DialVectorInput.mjs +16 -15
  23. package/dist/dial/wrapped-inputs/index.cjs +36 -31
  24. package/dist/dial/wrapped-inputs/index.d.cts +1 -1
  25. package/dist/dial/wrapped-inputs/index.d.ts +1 -1
  26. package/dist/dial/wrapped-inputs/index.mjs +16 -15
  27. package/dist/highlight-cursor/enhanced-components.cjs +4 -4
  28. package/dist/highlight-cursor/enhanced-components.mjs +4 -4
  29. package/dist/highlight-cursor/index.cjs +8 -8
  30. package/dist/highlight-cursor/index.mjs +4 -4
  31. package/dist/hooks/index.cjs +12 -12
  32. package/dist/hooks/index.mjs +3 -3
  33. package/dist/hooks/useQueryParams.cjs +3 -3
  34. package/dist/hooks/useQueryParams.mjs +2 -2
  35. package/dist/index.cjs +105 -100
  36. package/dist/index.css +7 -1
  37. package/dist/index.d.cts +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.mjs +16 -15
  40. package/dist/ui/DialBadge.cjs +3 -3
  41. package/dist/ui/DialBadge.mjs +3 -3
  42. package/dist/ui/UIKitBadge.cjs +8 -8
  43. package/dist/ui/UIKitBadge.mjs +4 -4
  44. package/dist/ui/avatar.cjs +3 -3
  45. package/dist/ui/avatar.mjs +3 -3
  46. package/dist/ui/badge.cjs +3 -3
  47. package/dist/ui/badge.mjs +3 -3
  48. package/dist/ui/button.cjs +3 -3
  49. package/dist/ui/button.mjs +3 -3
  50. package/dist/ui/card.cjs +3 -3
  51. package/dist/ui/card.mjs +3 -3
  52. package/dist/ui/checkbox.cjs +3 -3
  53. package/dist/ui/checkbox.mjs +3 -3
  54. package/dist/ui/collapsible.cjs +3 -3
  55. package/dist/ui/collapsible.mjs +3 -3
  56. package/dist/ui/drawer.cjs +3 -3
  57. package/dist/ui/drawer.mjs +3 -3
  58. package/dist/ui/dropdown.cjs +3 -3
  59. package/dist/ui/dropdown.mjs +3 -3
  60. package/dist/ui/index.cjs +73 -68
  61. package/dist/ui/index.d.cts +1 -0
  62. package/dist/ui/index.d.ts +1 -0
  63. package/dist/ui/index.mjs +14 -13
  64. package/dist/ui/inputs/color-input.cjs +3 -3
  65. package/dist/ui/inputs/color-input.mjs +3 -3
  66. package/dist/ui/inputs/index.cjs +14 -9
  67. package/dist/ui/inputs/index.d.cts +1 -0
  68. package/dist/ui/inputs/index.d.ts +1 -0
  69. package/dist/ui/inputs/index.mjs +6 -5
  70. package/dist/ui/inputs/input-numbers.cjs +3 -3
  71. package/dist/ui/inputs/input-numbers.mjs +3 -3
  72. package/dist/ui/inputs/input.cjs +3 -3
  73. package/dist/ui/inputs/input.mjs +3 -3
  74. package/dist/ui/inputs/number-inputs/CmInput.cjs +3 -3
  75. package/dist/ui/inputs/number-inputs/CmInput.mjs +3 -3
  76. package/dist/ui/inputs/number-inputs/DegInput.cjs +3 -3
  77. package/dist/ui/inputs/number-inputs/DegInput.mjs +3 -3
  78. package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +3 -3
  79. package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +3 -3
  80. package/dist/ui/inputs/number-inputs/EulerInput.cjs +3 -3
  81. package/dist/ui/inputs/number-inputs/EulerInput.mjs +3 -3
  82. package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +3 -3
  83. package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +3 -3
  84. package/dist/ui/inputs/number-inputs/InchInput.cjs +3 -3
  85. package/dist/ui/inputs/number-inputs/InchInput.mjs +3 -3
  86. package/dist/ui/inputs/number-inputs/IntInput.cjs +3 -3
  87. package/dist/ui/inputs/number-inputs/IntInput.mjs +3 -3
  88. package/dist/ui/inputs/number-inputs/KVectorInput.cjs +3 -3
  89. package/dist/ui/inputs/number-inputs/KVectorInput.mjs +3 -3
  90. package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +3 -3
  91. package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +3 -3
  92. package/dist/ui/inputs/number-inputs/RadInput.cjs +3 -3
  93. package/dist/ui/inputs/number-inputs/RadInput.mjs +3 -3
  94. package/dist/ui/inputs/number-inputs/TimeInput.cjs +3 -3
  95. package/dist/ui/inputs/number-inputs/TimeInput.mjs +3 -3
  96. package/dist/ui/inputs/number-inputs/Vec3Input.cjs +3 -3
  97. package/dist/ui/inputs/number-inputs/Vec3Input.mjs +3 -3
  98. package/dist/ui/inputs/number-inputs/VectorInput.cjs +3 -3
  99. package/dist/ui/inputs/number-inputs/VectorInput.mjs +3 -3
  100. package/dist/ui/inputs/number-inputs/index.cjs +8 -8
  101. package/dist/ui/inputs/number-inputs/index.mjs +4 -4
  102. package/dist/ui/inputs/presets-input.cjs +3 -3
  103. package/dist/ui/inputs/presets-input.mjs +3 -3
  104. package/dist/ui/inputs/text-input.cjs +21 -0
  105. package/dist/ui/inputs/text-input.d.cts +27 -0
  106. package/dist/ui/inputs/text-input.d.ts +27 -0
  107. package/dist/ui/inputs/text-input.mjs +12 -0
  108. package/dist/ui/label.cjs +3 -3
  109. package/dist/ui/label.mjs +3 -3
  110. package/dist/ui/layout.cjs +3 -3
  111. package/dist/ui/layout.mjs +3 -3
  112. package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +3 -3
  113. package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +3 -3
  114. package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +3 -3
  115. package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +3 -3
  116. package/dist/ui/layouts/dock-layout/index.cjs +3 -3
  117. package/dist/ui/layouts/dock-layout/index.mjs +3 -3
  118. package/dist/ui/layouts/index.cjs +9 -9
  119. package/dist/ui/layouts/index.mjs +5 -5
  120. package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +3 -3
  121. package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +3 -3
  122. package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +3 -3
  123. package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +3 -3
  124. package/dist/ui/layouts/liquid-layout/index.cjs +3 -3
  125. package/dist/ui/layouts/liquid-layout/index.mjs +3 -3
  126. package/dist/ui/modal.cjs +3 -3
  127. package/dist/ui/modal.mjs +3 -3
  128. package/dist/ui/navigation.cjs +3 -3
  129. package/dist/ui/navigation.mjs +3 -3
  130. package/dist/ui/pagination.cjs +3 -3
  131. package/dist/ui/pagination.mjs +3 -3
  132. package/dist/ui/panel.cjs +3 -3
  133. package/dist/ui/panel.mjs +3 -3
  134. package/dist/ui/popover.cjs +3 -3
  135. package/dist/ui/popover.mjs +3 -3
  136. package/dist/ui/radio-group.cjs +3 -3
  137. package/dist/ui/radio-group.mjs +3 -3
  138. package/dist/ui/resizable.cjs +3 -3
  139. package/dist/ui/resizable.mjs +3 -3
  140. package/dist/ui/select.cjs +3 -3
  141. package/dist/ui/select.mjs +3 -3
  142. package/dist/ui/separator.cjs +3 -3
  143. package/dist/ui/separator.mjs +3 -3
  144. package/dist/ui/sheet.cjs +3 -3
  145. package/dist/ui/sheet.mjs +3 -3
  146. package/dist/ui/sidebar.cjs +28 -28
  147. package/dist/ui/sidebar.mjs +4 -4
  148. package/dist/ui/simple-tree-view.cjs +3 -3
  149. package/dist/ui/simple-tree-view.mjs +3 -3
  150. package/dist/ui/skeleton.cjs +3 -3
  151. package/dist/ui/skeleton.mjs +3 -3
  152. package/dist/ui/slider.cjs +3 -3
  153. package/dist/ui/slider.mjs +3 -3
  154. package/dist/ui/switch.cjs +3 -3
  155. package/dist/ui/switch.mjs +3 -3
  156. package/dist/ui/table.cjs +3 -3
  157. package/dist/ui/table.mjs +3 -3
  158. package/dist/ui/tabs.cjs +3 -3
  159. package/dist/ui/tabs.mjs +3 -3
  160. package/dist/ui/textarea.cjs +3 -3
  161. package/dist/ui/textarea.mjs +3 -3
  162. package/dist/ui/theme/ThemeToggles.cjs +3 -3
  163. package/dist/ui/theme/ThemeToggles.mjs +3 -3
  164. package/dist/ui/theme/index.cjs +3 -3
  165. package/dist/ui/theme/index.mjs +3 -3
  166. package/dist/ui/toggle-buttons.cjs +3 -3
  167. package/dist/ui/toggle-buttons.mjs +3 -3
  168. package/dist/ui/toggle-group.cjs +3 -3
  169. package/dist/ui/toggle-group.mjs +3 -3
  170. package/dist/ui/toggle.cjs +3 -3
  171. package/dist/ui/toggle.mjs +3 -3
  172. package/dist/ui/toolbar.cjs +3 -3
  173. package/dist/ui/toolbar.mjs +3 -3
  174. package/dist/ui/tooltip.cjs +3 -3
  175. package/dist/ui/tooltip.mjs +3 -3
  176. package/dist/ui/tree-view/TreeSearchBar.cjs +3 -3
  177. package/dist/ui/tree-view/TreeSearchBar.mjs +3 -3
  178. package/dist/ui/tree-view/TreeView.cjs +3 -3
  179. package/dist/ui/tree-view/TreeView.mjs +3 -3
  180. package/dist/ui/tree-view/index.cjs +3 -3
  181. package/dist/ui/tree-view/index.mjs +3 -3
  182. package/dist/ui/tree-view-legacy.cjs +3 -3
  183. package/dist/ui/tree-view-legacy.mjs +3 -3
  184. package/dist/ui/waterfall/CursorOverlay.cjs +3 -3
  185. package/dist/ui/waterfall/CursorOverlay.mjs +3 -3
  186. package/dist/ui/waterfall/TimelineEvent.cjs +3 -3
  187. package/dist/ui/waterfall/TimelineEvent.mjs +3 -3
  188. package/dist/ui/waterfall/TimelineProcessBar.cjs +3 -3
  189. package/dist/ui/waterfall/TimelineProcessBar.mjs +3 -3
  190. package/dist/ui/waterfall/Wedges.cjs +3 -3
  191. package/dist/ui/waterfall/Wedges.mjs +3 -3
  192. package/dist/ui/waterfall/index.cjs +8 -8
  193. package/dist/ui/waterfall/index.mjs +7 -7
  194. package/package.json +1 -5
  195. package/src/dial/DialPanel.tsx +12 -2
  196. package/src/dial/wrapped-inputs/DialInputs.tsx +36 -0
  197. package/src/dial/wrapped-inputs/index.ts +1 -0
  198. package/src/ui/inputs/index.tsx +1 -0
  199. package/src/ui/inputs/text-input.tsx +43 -0
  200. package/dial-cli/README.md +0 -137
  201. package/dial-cli/dial-cli.ts +0 -1136
  202. package/dial-cli/dist/dial-cli.js +0 -838
  203. package/dial-cli/node_modules/.bin/api-extractor +0 -17
  204. package/dial-cli/node_modules/.bin/jiti +0 -17
  205. package/dial-cli/node_modules/.bin/tsc +0 -17
  206. package/dial-cli/node_modules/.bin/tsserver +0 -17
  207. package/dial-cli/node_modules/.bin/tsup +0 -17
  208. package/dial-cli/node_modules/.bin/tsup-node +0 -17
  209. package/dial-cli/node_modules/.bin/tsx +0 -17
  210. package/dial-cli/node_modules/.bin/yaml +0 -17
  211. package/dial-cli/package.json +0 -47
  212. package/dial-cli/tsconfig.json +0 -20
  213. package/dial-cli/tsup.config.ts +0 -18
  214. package/dist/{chunk-FIWBOGQV.mjs → chunk-ADYUCJMQ.mjs} +0 -0
  215. package/dist/{chunk-KXKEZ3MH.mjs → chunk-AJYO5W6O.mjs} +2 -2
  216. package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
  217. package/dist/{chunk-K4I4YU6N.cjs → chunk-G7FYBSFO.cjs} +2 -2
  218. package/dist/{chunk-Q4XH2Z5M.cjs → chunk-LYZJNEOR.cjs} +1 -1
  219. package/dist/{chunk-U3LN5NB6.mjs → chunk-OEIF3JCH.mjs} +1 -1
  220. package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
  221. /package/dist/{chunk-65OSA4MM.cjs → chunk-SQRAUVEP.cjs} +0 -0
@@ -1,838 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // dial-cli.ts
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
5
- import { basename, dirname, join, resolve } from "path";
6
- import { parseArgs } from "util";
7
- import { fileURLToPath } from "url";
8
- import { execSync } from "child_process";
9
- import * as docgen from "react-docgen-typescript";
10
- import * as ts from "typescript";
11
- function getVersionInfo() {
12
- try {
13
- const __filename2 = fileURLToPath(import.meta.url);
14
- const __dirname2 = dirname(__filename2);
15
- const possiblePaths = [
16
- resolve(__dirname2, "./package.json"),
17
- // Same directory (for standalone package)
18
- resolve(__dirname2, "../package.json"),
19
- // Parent directory (built version)
20
- resolve(__dirname2, "../../package.json")
21
- // Two levels up (for development)
22
- ];
23
- let packageJson = null;
24
- for (const path of possiblePaths) {
25
- try {
26
- if (existsSync(path)) {
27
- const content = JSON.parse(readFileSync(path, "utf-8"));
28
- if (content.name === "@vuer-ai/dial-cli" || content.bin?.["dial-cli"]) {
29
- packageJson = content;
30
- break;
31
- }
32
- }
33
- } catch {
34
- }
35
- }
36
- const version = packageJson?.version || "unknown";
37
- let gitHash;
38
- try {
39
- gitHash = execSync("git rev-parse --short HEAD", { encoding: "utf-8", cwd: dirname(__dirname2) }).trim();
40
- } catch {
41
- gitHash = void 0;
42
- }
43
- return { version, gitHash };
44
- } catch (error) {
45
- return { version: "unknown" };
46
- }
47
- }
48
- function parseTypeAlias(sourceFile, typeName) {
49
- let typeDefinition = null;
50
- function visit(node) {
51
- if (ts.isTypeAliasDeclaration(node) && node.name.text === typeName) {
52
- typeDefinition = {
53
- name: typeName,
54
- kind: "typeAlias",
55
- raw: node.getFullText().trim()
56
- };
57
- const fullText = node.getFullText();
58
- const jsDocMatch = fullText.match(/\/\*\*([\s\S]*?)\*\//);
59
- if (jsDocMatch) {
60
- const jsDocContent = jsDocMatch[1];
61
- typeDefinition.dialTags = parseDialTags(jsDocContent);
62
- typeDefinition.jsDoc = jsDocContent.trim();
63
- }
64
- if (ts.isTupleTypeNode(node.type)) {
65
- typeDefinition.type = "tuple";
66
- typeDefinition.elements = [];
67
- node.type.elements.forEach((element, index) => {
68
- const elementData = {
69
- index,
70
- raw: element.getFullText().trim()
71
- };
72
- if (ts.isNamedTupleMember(element)) {
73
- elementData.name = element.name?.getText();
74
- elementData.type = element.type?.getText();
75
- const sourceText = element.getFullText();
76
- const commentMatch = sourceText.match(/\/\/(.+)/);
77
- if (commentMatch) {
78
- elementData.comment = commentMatch[1].trim();
79
- const dialTags = {};
80
- const minMatch = commentMatch[1].match(/@dial-min\s+([\d.]+)/);
81
- if (minMatch) {
82
- dialTags.min = parseFloat(minMatch[1]);
83
- elementData.min = dialTags.min;
84
- }
85
- const maxMatch = commentMatch[1].match(/@dial-max\s+([\d.]+)/);
86
- if (maxMatch) {
87
- dialTags.max = parseFloat(maxMatch[1]);
88
- elementData.max = dialTags.max;
89
- }
90
- const stepMatch = commentMatch[1].match(/@dial-step\s+([\d.]+)/);
91
- if (stepMatch) {
92
- dialTags.step = parseFloat(stepMatch[1]);
93
- elementData.step = dialTags.step;
94
- }
95
- const dtypeMatch = commentMatch[1].match(/@dial-dtype\s+(\w+)/);
96
- if (dtypeMatch) {
97
- dialTags.dtype = dtypeMatch[1];
98
- elementData.dtype = dtypeMatch[1];
99
- } else {
100
- elementData.dtype = "number";
101
- }
102
- elementData.dialTags = dialTags;
103
- }
104
- }
105
- typeDefinition.elements.push(elementData);
106
- });
107
- } else if (ts.isArrayTypeNode(node.type)) {
108
- typeDefinition.type = "array";
109
- typeDefinition.elementType = node.type.elementType?.getText();
110
- } else {
111
- typeDefinition.type = "other";
112
- typeDefinition.typeNode = node.type ? node.type.getText() : "unknown";
113
- }
114
- }
115
- ts.forEachChild(node, visit);
116
- }
117
- visit(sourceFile);
118
- return typeDefinition;
119
- }
120
- function parseInterfaceProperties(sourceFile, interfaceName) {
121
- const properties = [];
122
- let interfaceDialTags = {};
123
- const groupConfigs = {};
124
- function visit(node) {
125
- if (ts.isInterfaceDeclaration(node) && node.name.text === interfaceName) {
126
- const interfaceJsDocNodes = ts.getJSDocCommentsAndTags(node);
127
- if (interfaceJsDocNodes && interfaceJsDocNodes.length > 0) {
128
- const interfaceFullText = interfaceJsDocNodes[0].getFullText();
129
- interfaceDialTags = parseDialTags(interfaceFullText);
130
- const lines = interfaceFullText.split("\n");
131
- lines.forEach((line) => {
132
- const groupMatch = line.match(/@dial\s+(\w+)(.*)/);
133
- if (groupMatch) {
134
- const groupName = groupMatch[1];
135
- const configStr = groupMatch[2];
136
- if (configStr.includes("@dial-no-wrap")) {
137
- groupConfigs[groupName] = { noWrap: true };
138
- }
139
- }
140
- });
141
- }
142
- node.members.forEach((member) => {
143
- if (ts.isPropertySignature(member) && member.name && ts.isIdentifier(member.name)) {
144
- const propName = member.name.text;
145
- const jsDocNodes = ts.getJSDocCommentsAndTags(member);
146
- let propertyDialTags = {};
147
- if (jsDocNodes && jsDocNodes.length > 0) {
148
- const fullText = jsDocNodes[0].getFullText();
149
- propertyDialTags = parseDialTags(fullText);
150
- }
151
- const mergedDialTags = { ...interfaceDialTags, ...propertyDialTags };
152
- const prop = {
153
- name: propName,
154
- dtype: mergedDialTags.dtype || "number"
155
- };
156
- if (mergedDialTags.min !== void 0) prop.min = mergedDialTags.min;
157
- if (mergedDialTags.max !== void 0) prop.max = mergedDialTags.max;
158
- if (mergedDialTags.step !== void 0) prop.step = mergedDialTags.step;
159
- if (mergedDialTags.icon) prop.icon = mergedDialTags.icon;
160
- if (mergedDialTags.grouping || mergedDialTags.column || mergedDialTags.rowCount || mergedDialTags.colCount || mergedDialTags.labelPosition || mergedDialTags.noWrap) {
161
- prop.tags = {};
162
- if (mergedDialTags.grouping) {
163
- prop.tags.grouping = mergedDialTags.grouping;
164
- if (groupConfigs[mergedDialTags.grouping]?.noWrap) {
165
- prop.tags.noWrap = true;
166
- }
167
- }
168
- if (mergedDialTags.column) prop.tags.layout = "column";
169
- if (mergedDialTags.rowCount) prop.tags.row = mergedDialTags.rowCount;
170
- if (mergedDialTags.colCount) prop.tags.col = mergedDialTags.colCount;
171
- if (mergedDialTags.labelPosition) prop.tags.labelPosition = mergedDialTags.labelPosition;
172
- if (mergedDialTags.noWrap) prop.tags.noWrap = true;
173
- }
174
- properties.push(prop);
175
- }
176
- });
177
- }
178
- ts.forEachChild(node, visit);
179
- }
180
- visit(sourceFile);
181
- return properties;
182
- }
183
- function parseDialTags(description) {
184
- const dialTags = {};
185
- if (!description) return dialTags;
186
- if (/@dial-ignore\b/i.test(description)) {
187
- dialTags.ignore = true;
188
- return dialTags;
189
- }
190
- const groupingPattern = /@dial\s+(transform|visibility|geometry|segments)\b/gm;
191
- let match;
192
- while ((match = groupingPattern.exec(description)) !== null) {
193
- dialTags.grouping = match[1];
194
- }
195
- const propertyPattern = /@dial-([\w-]+)(?:\s+([^\n@]+?))?(?:\n|@|$)/gm;
196
- while ((match = propertyPattern.exec(description)) !== null) {
197
- const [, key, value] = match;
198
- switch (key) {
199
- case "options":
200
- if (value) {
201
- try {
202
- dialTags.options = JSON.parse(value);
203
- } catch {
204
- dialTags.options = value;
205
- }
206
- }
207
- break;
208
- case "min":
209
- case "max":
210
- case "step":
211
- if (value) {
212
- dialTags[key] = parseFloat(value);
213
- }
214
- break;
215
- case "col":
216
- case "column":
217
- dialTags.column = true;
218
- break;
219
- case "row":
220
- if (value && /^\d+$/.test(value)) {
221
- dialTags.rowCount = parseInt(value, 10);
222
- }
223
- break;
224
- case "col-3":
225
- case "col-2":
226
- case "col-4": {
227
- const colMatch = key.match(/col-(\d+)/);
228
- if (colMatch) {
229
- dialTags.colCount = parseInt(colMatch[1], 10);
230
- }
231
- break;
232
- }
233
- case "row-3":
234
- case "row-2":
235
- case "row-4": {
236
- const rowMatch = key.match(/row-(\d+)/);
237
- if (rowMatch) {
238
- dialTags.rowCount = parseInt(rowMatch[1], 10);
239
- }
240
- break;
241
- }
242
- case "dtype":
243
- if (value) {
244
- dialTags.dtype = value.trim();
245
- }
246
- break;
247
- case "dtypes":
248
- if (value) {
249
- dialTags.dtypes = value.split(",").map((s) => s.trim());
250
- }
251
- break;
252
- case "type":
253
- if (value) {
254
- dialTags.type = value.trim();
255
- }
256
- break;
257
- case "icon":
258
- if (value) {
259
- dialTags.icon = value.trim();
260
- }
261
- break;
262
- case "default":
263
- if (value) {
264
- try {
265
- dialTags.default = JSON.parse(value);
266
- } catch {
267
- dialTags.default = value.trim();
268
- }
269
- }
270
- break;
271
- case "placeholders":
272
- if (value) {
273
- dialTags.placeholders = value.split(",").map((s) => s.trim());
274
- }
275
- break;
276
- case "tooltips":
277
- if (value) {
278
- dialTags.tooltips = value.split(",").map((s) => s.trim());
279
- }
280
- break;
281
- case "mins":
282
- if (value) {
283
- dialTags.mins = value.split(",").map((s) => parseFloat(s.trim()));
284
- }
285
- break;
286
- case "maxs":
287
- if (value) {
288
- dialTags.maxs = value.split(",").map((s) => parseFloat(s.trim()));
289
- }
290
- break;
291
- case "steps":
292
- if (value) {
293
- dialTags.steps = value.split(",").map((s) => parseFloat(s.trim()));
294
- }
295
- break;
296
- case "label-left":
297
- case "left":
298
- dialTags.labelPosition = "left";
299
- break;
300
- case "label-right":
301
- case "right":
302
- dialTags.labelPosition = "right";
303
- break;
304
- case "label-center":
305
- case "label-middle":
306
- case "center":
307
- case "middle":
308
- dialTags.labelPosition = "center";
309
- break;
310
- case "label-top":
311
- case "top":
312
- dialTags.labelPosition = "top";
313
- break;
314
- case "label-bottom":
315
- case "bottom":
316
- dialTags.labelPosition = "bottom";
317
- break;
318
- case "label-inline":
319
- case "inline":
320
- dialTags.labelPosition = "inline";
321
- break;
322
- case "no-wrap":
323
- dialTags.noWrap = true;
324
- break;
325
- default:
326
- break;
327
- }
328
- }
329
- return dialTags;
330
- }
331
- function propToDialSchema(propName, propData, groupConfigs) {
332
- const description = propData.description || "";
333
- const dialTags = parseDialTags(description);
334
- if (dialTags.ignore) {
335
- return null;
336
- }
337
- let dtype = dialTags.dtype;
338
- if (!dtype) {
339
- const type = propData.type;
340
- const typeName = type?.name || "";
341
- if (typeName === "boolean") {
342
- dtype = "boolean";
343
- } else if (typeName === "number") {
344
- dtype = "number";
345
- } else if (typeName.includes("[]")) {
346
- dtype = "array";
347
- } else {
348
- dtype = "string";
349
- }
350
- }
351
- const schema = {
352
- name: propName,
353
- dtype
354
- };
355
- if (dialTags.default !== void 0) {
356
- schema.value = dialTags.default;
357
- } else {
358
- const defaultValue = propData.defaultValue;
359
- if (defaultValue?.value) {
360
- try {
361
- schema.value = JSON.parse(defaultValue.value);
362
- } catch {
363
- schema.value = defaultValue.value;
364
- }
365
- }
366
- }
367
- if (dialTags.min !== void 0) schema.min = dialTags.min;
368
- if (dialTags.max !== void 0) schema.max = dialTags.max;
369
- if (dialTags.step !== void 0) schema.step = dialTags.step;
370
- if (dialTags.options) schema.options = dialTags.options;
371
- if (dialTags.icon) schema.icon = dialTags.icon;
372
- if (dialTags.placeholders) schema.placeholders = dialTags.placeholders;
373
- if (dialTags.tooltips) schema.tooltips = dialTags.tooltips;
374
- if (dialTags.dtypes) schema.dtypes = dialTags.dtypes;
375
- if (dialTags.mins) schema.mins = dialTags.mins;
376
- if (dialTags.maxs) schema.maxs = dialTags.maxs;
377
- if (dialTags.steps) schema.steps = dialTags.steps;
378
- const tags = {};
379
- if (dialTags.grouping) {
380
- tags.grouping = dialTags.grouping;
381
- if (groupConfigs && groupConfigs[dialTags.grouping]?.noWrap) {
382
- tags.noWrap = true;
383
- }
384
- }
385
- if (dialTags.column) {
386
- tags.col = true;
387
- }
388
- if (dialTags.rowCount) {
389
- tags.row = dialTags.rowCount;
390
- tags.layout = "row";
391
- }
392
- if (dialTags.colCount) {
393
- tags.col = dialTags.colCount;
394
- tags.layout = "column";
395
- }
396
- if (dialTags.labelPosition) {
397
- tags.labelPosition = dialTags.labelPosition;
398
- }
399
- if (Object.keys(tags).length > 0) {
400
- schema.tags = tags;
401
- }
402
- return schema;
403
- }
404
- async function processFile(filePath, outputDir, options, flags = {}) {
405
- if (!flags.quiet) {
406
- console.log(`
407
- \u{1F4E6} Processing ${filePath}...`);
408
- }
409
- const docs = docgen.parse(filePath, options);
410
- const sourceCode = readFileSync(filePath, "utf-8");
411
- const sourceFile = ts.createSourceFile(filePath, sourceCode, ts.ScriptTarget.Latest, true);
412
- const enhancedMetadata = docs.map((doc) => {
413
- const dialSchema = [];
414
- const groupConfigs = {};
415
- if (doc.description) {
416
- const componentTags = parseDialTags(doc.description);
417
- const descLines = doc.description.split("\n");
418
- descLines.forEach((line) => {
419
- const groupMatch = line.match(/@dial\s+(\w+)(.*)/);
420
- if (groupMatch) {
421
- const groupName = groupMatch[1];
422
- const configStr = groupMatch[2];
423
- if (configStr.includes("@dial-no-wrap")) {
424
- groupConfigs[groupName] = { noWrap: true };
425
- }
426
- }
427
- });
428
- }
429
- const propsInterfaceName = doc.displayName + "Props";
430
- function findInterfaceJSDoc(node) {
431
- if (ts.isInterfaceDeclaration(node) && node.name.text === propsInterfaceName) {
432
- const interfaceJsDocNodes = ts.getJSDocCommentsAndTags(node);
433
- if (interfaceJsDocNodes && interfaceJsDocNodes.length > 0) {
434
- const interfaceFullText = interfaceJsDocNodes[0].getFullText();
435
- const lines = interfaceFullText.split("\n");
436
- lines.forEach((line) => {
437
- const groupMatch = line.match(/@dial\s+(\w+)(.*)/);
438
- if (groupMatch) {
439
- const groupName = groupMatch[1];
440
- const configStr = groupMatch[2];
441
- if (configStr.includes("@dial-no-wrap")) {
442
- groupConfigs[groupName] = { noWrap: true };
443
- }
444
- }
445
- });
446
- }
447
- }
448
- ts.forEachChild(node, findInterfaceJSDoc);
449
- }
450
- findInterfaceJSDoc(sourceFile);
451
- for (const [propName, propData] of Object.entries(doc.props || {})) {
452
- const propDescription = propData.description || "";
453
- const propDialTags = parseDialTags(propDescription);
454
- if (propDialTags.ignore) {
455
- continue;
456
- }
457
- const propType = propData.type;
458
- const referencedType = propDialTags.type || propType?.name;
459
- if (referencedType) {
460
- const typeDefinition = parseTypeAlias(sourceFile, referencedType);
461
- if (typeDefinition) {
462
- const schema = propToDialSchema(propName, propData, groupConfigs);
463
- if (!schema) {
464
- continue;
465
- }
466
- if (typeDefinition.elements && typeDefinition.elements.length > 0) {
467
- schema.dtype = "vector";
468
- const mins = [];
469
- const maxs = [];
470
- const steps = [];
471
- const dtypes = [];
472
- const placeholders = [];
473
- const tooltips = [];
474
- typeDefinition.elements.forEach((element) => {
475
- if (element.name) {
476
- mins.push(element.min !== void 0 ? element.min : 0);
477
- maxs.push(element.max !== void 0 ? element.max : 100);
478
- steps.push(element.step !== void 0 ? element.step : 1);
479
- dtypes.push(element.dtype || "number");
480
- placeholders.push(element.name);
481
- const tooltip = element.name.includes("Segments") ? `${element.name.replace("Segments", " segments")}` : element.name.charAt(0).toUpperCase() + element.name.slice(1);
482
- tooltips.push(tooltip);
483
- }
484
- });
485
- if (mins.length > 0) schema.mins = mins;
486
- if (maxs.length > 0) schema.maxs = maxs;
487
- if (steps.length > 0) schema.steps = steps;
488
- if (dtypes.length > 0) schema.dtypes = dtypes;
489
- if (placeholders.length > 0) schema.placeholders = placeholders;
490
- if (tooltips.length > 0) schema.tooltips = tooltips;
491
- schema.typeDefinition = typeDefinition;
492
- }
493
- dialSchema.push(schema);
494
- const interfaceProps = parseInterfaceProperties(sourceFile, referencedType);
495
- interfaceProps.forEach((prop) => {
496
- dialSchema.push({
497
- ...prop,
498
- name: `${propName}.${prop.name}`,
499
- tags: {
500
- grouping: "nested",
501
- parent: propName,
502
- hidden: true,
503
- metadata: true
504
- }
505
- });
506
- });
507
- } else {
508
- const schema = propToDialSchema(propName, propData, groupConfigs);
509
- if (schema) {
510
- dialSchema.push(schema);
511
- }
512
- }
513
- } else {
514
- const schema = propToDialSchema(propName, propData, groupConfigs);
515
- if (schema) {
516
- dialSchema.push(schema);
517
- }
518
- }
519
- }
520
- return {
521
- displayName: doc.displayName,
522
- description: doc.description,
523
- dialSchema,
524
- groupConfigs,
525
- props: doc.props
526
- };
527
- });
528
- if (!existsSync(outputDir)) {
529
- mkdirSync(outputDir, { recursive: true });
530
- }
531
- const baseName = basename(filePath, ".tsx").toLowerCase();
532
- writeFileSync(join(outputDir, `${baseName}-raw.json`), JSON.stringify(docs, null, 2));
533
- if (!flags.quiet) {
534
- console.log(`\u{1F4DD} Wrote raw metadata to ${baseName}-raw.json`);
535
- }
536
- writeFileSync(
537
- join(outputDir, `${baseName}-combined.json`),
538
- JSON.stringify(enhancedMetadata, null, 2)
539
- );
540
- if (!flags.quiet) {
541
- console.log(`\u{1F4DD} Wrote enhanced metadata to ${baseName}-combined.json`);
542
- }
543
- const schemas = enhancedMetadata.map((c) => {
544
- const groups = Object.entries(c.groupConfigs || {}).map(([name, config]) => ({
545
- name,
546
- ...config
547
- }));
548
- return {
549
- component: c.displayName,
550
- schemas: c.dialSchema,
551
- groups: groups.length > 0 ? groups : void 0,
552
- config: c.dialConfig
553
- };
554
- });
555
- writeFileSync(join(outputDir, `${baseName}-schemas.json`), JSON.stringify(schemas, null, 2));
556
- if (!flags.quiet) {
557
- console.log(`\u{1F4DD} Wrote dial schemas to ${baseName}-schemas.json`);
558
- }
559
- if (flags.verbose && enhancedMetadata.length > 0) {
560
- console.log("\n\u{1F4CA} Generated dial schemas:");
561
- enhancedMetadata.forEach((meta) => {
562
- console.log(`
563
- Component: ${meta.displayName}`);
564
- console.log(` Properties: ${meta.dialSchema.length}`);
565
- if (meta.dialSchema.length > 0) {
566
- console.log(` Sample schema:`);
567
- console.log(JSON.stringify(meta.dialSchema[0], null, 4).split("\n").map((line) => " " + line).join("\n"));
568
- }
569
- });
570
- }
571
- }
572
- function getHelpText() {
573
- const { version, gitHash } = getVersionInfo();
574
- const versionString = gitHash ? `v${version} (${gitHash})` : `v${version}`;
575
- return `
576
- dial-cli - Generate dial metadata from TypeScript/React components
577
-
578
- SYNOPSIS
579
- dial-cli [options] <file.tsx> [file2.tsx ...]
580
-
581
- DESCRIPTION
582
- The dial-cli tool parses TypeScript and React component files to extract
583
- @dial annotations from JSDoc comments and generates JSON metadata files
584
- that can be used to automatically create UI controls.
585
-
586
- The tool generates three types of output files for each input:
587
- \u2022 *-raw.json - Raw output from react-docgen-typescript
588
- \u2022 *-combined.json - Enhanced metadata with dial schema information
589
- \u2022 *-schemas.json - Just the dial schemas for UI generation
590
-
591
- OPTIONS
592
- -o, --output <dir>
593
- Output directory for generated metadata files (default: ./metadata)
594
-
595
- -i, --ignore <prop>
596
- Property names or patterns to exclude from dial schema generation
597
- Can be specified multiple times: -i prop1 -i prop2
598
- Or as a comma-separated list: -i prop1,prop2,prop3
599
- Supports glob patterns: -i "*Style" -i "on*" -i "_*"
600
-
601
- -h, --help
602
- Display this help message and exit
603
-
604
- -v, --version
605
- Display version information and exit
606
-
607
- --verbose
608
- Enable verbose output with detailed processing information
609
-
610
- --quiet
611
- Suppress all output except errors
612
-
613
- DIAL ANNOTATIONS
614
- The tool recognizes the following @dial annotations in JSDoc comments:
615
-
616
- Grouping:
617
- @dial <group> Group related properties (transform, visibility, etc.)
618
-
619
- Property Configuration:
620
- @dial-dtype <type> Data type (vector3, euler, boolean, int, etc.)
621
- @dial-min <number> Minimum value for numeric inputs
622
- @dial-max <number> Maximum value for numeric inputs
623
- @dial-step <number> Step increment for numeric inputs
624
- @dial-default <value> Default value (overrides component default)
625
- @dial-options [...] Array of preset values
626
- @dial-icon <name> Lucide icon name for the control
627
- @dial-ignore Exclude this property from dial schema generation
628
-
629
- FormLayout:
630
- @dial-col-<n> Display in column layout with n columns
631
- @dial-row-<n> Display in row layout with n items per row
632
- @dial-label-<pos> Label position (left, right, top, bottom, inline)
633
-
634
- Vector Types:
635
- @dial-mins <n,n,n> Comma-separated min values for vector elements
636
- @dial-maxs <n,n,n> Comma-separated max values for vector elements
637
- @dial-steps <n,n,n> Comma-separated step values for vector elements
638
- @dial-dtypes <t,t,t> Comma-separated data types for vector elements
639
-
640
- EXAMPLES
641
- Generate metadata for a single component:
642
- $ dial-cli MyComponent.tsx
643
-
644
- Specify a custom output directory:
645
- $ dial-cli -o ./docs/metadata MyComponent.tsx
646
-
647
- Process multiple files:
648
- $ dial-cli Component1.tsx Component2.tsx Component3.tsx
649
-
650
- Process all components in a directory:
651
- $ dial-cli src/components/*.tsx
652
-
653
- Generate metadata with verbose output:
654
- $ dial-cli --verbose MyComponent.tsx
655
-
656
- Exclude specific properties from schema generation:
657
- $ dial-cli -i className -i style -i children MyComponent.tsx
658
- $ dial-cli --ignore ref,key,id MyComponent.tsx
659
-
660
- EXAMPLE COMPONENT
661
- interface Props {
662
- /**
663
- * Position in 3D space
664
- * @dial transform
665
- * @dial-dtype vector3
666
- * @dial-mins -10,-10,-10
667
- * @dial-maxs 10,10,10
668
- * @dial-steps 0.1,0.1,0.1
669
- * @dial-icon Move3d
670
- */
671
- position: [number, number, number];
672
-
673
- /**
674
- * Visibility toggle
675
- * @dial visibility
676
- * @dial-dtype boolean
677
- * @dial-icon Eye
678
- */
679
- visible: boolean;
680
- }
681
-
682
- FILES
683
- The tool generates the following files in the output directory:
684
-
685
- <component>-raw.json
686
- Raw docgen output with all prop information
687
-
688
- <component>-combined.json
689
- Enhanced metadata including dial schemas and type definitions
690
-
691
- <component>-schemas.json
692
- Extracted dial schemas ready for UI generation
693
-
694
- ENVIRONMENT
695
- NODE_ENV
696
- Set to 'development' for debug output
697
-
698
- SEE ALSO
699
- Documentation: https://uikit.vuer.ai/dial
700
- GitHub: https://github.com/vuer-ai/vuer-uikit
701
-
702
- VERSION
703
- dial-cli ${versionString} (part of @vuer-ai/vuer-uikit)
704
-
705
- AUTHORS
706
- Vuer AI Team <team@vuer.ai>
707
- `;
708
- }
709
- async function main() {
710
- const { values, positionals } = parseArgs({
711
- args: process.argv.slice(2),
712
- options: {
713
- output: {
714
- type: "string",
715
- short: "o",
716
- default: "./metadata"
717
- },
718
- ignore: {
719
- type: "string",
720
- short: "i",
721
- multiple: true,
722
- default: []
723
- },
724
- help: {
725
- type: "boolean",
726
- short: "h"
727
- },
728
- version: {
729
- type: "boolean",
730
- short: "v"
731
- },
732
- verbose: {
733
- type: "boolean"
734
- },
735
- quiet: {
736
- type: "boolean"
737
- }
738
- },
739
- allowPositionals: true
740
- });
741
- if (values.version) {
742
- const { version, gitHash } = getVersionInfo();
743
- const versionString = gitHash ? `v${version} (${gitHash})` : `v${version}`;
744
- console.log(`dial-cli ${versionString} (part of @vuer-ai/vuer-uikit)`);
745
- process.exit(0);
746
- }
747
- if (values.help || positionals.length === 0) {
748
- console.log(getHelpText());
749
- process.exit(0);
750
- }
751
- if (positionals.length === 1 && (positionals[0] === "man" || positionals[0] === "help")) {
752
- console.log(getHelpText());
753
- process.exit(0);
754
- }
755
- const outputDir = resolve(process.cwd(), values.output);
756
- const ignoreList = [];
757
- const ignoreValues = values.ignore;
758
- if (ignoreValues) {
759
- if (Array.isArray(ignoreValues)) {
760
- ignoreValues.forEach((val) => {
761
- ignoreList.push(...val.split(",").map((s) => s.trim()));
762
- });
763
- } else if (typeof ignoreValues === "string") {
764
- ignoreList.push(...ignoreValues.split(",").map((s) => s.trim()));
765
- }
766
- }
767
- const options = {
768
- savePropValueAsString: true,
769
- shouldExtractLiteralValuesFromEnum: true,
770
- shouldRemoveUndefinedFromOptional: true,
771
- propFilter: (prop) => {
772
- if (prop.name === "ref" || prop.name === "key") {
773
- return false;
774
- }
775
- for (const pattern of ignoreList) {
776
- if (pattern.includes("*") || pattern.includes("?")) {
777
- const regex = new RegExp("^" + pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$");
778
- if (regex.test(prop.name)) {
779
- return false;
780
- }
781
- } else if (prop.name === pattern) {
782
- return false;
783
- }
784
- }
785
- return true;
786
- }
787
- };
788
- const flags = {
789
- verbose: values.verbose,
790
- quiet: values.quiet,
791
- ignoreList
792
- };
793
- if (!flags.quiet) {
794
- const { version, gitHash } = getVersionInfo();
795
- const versionString = gitHash ? `v${version} (${gitHash})` : `v${version}`;
796
- console.log(`\u{1F680} Dial Documentation Generator ${versionString}`);
797
- console.log(`\u{1F4C2} Output directory: ${outputDir}`);
798
- if (flags.verbose && ignoreList.length > 0) {
799
- console.log(`\u{1F6AB} Ignoring properties: ${ignoreList.join(", ")}`);
800
- }
801
- }
802
- let filesProcessed = 0;
803
- let filesErrored = 0;
804
- for (const file of positionals) {
805
- const filePath = resolve(process.cwd(), file);
806
- if (!existsSync(filePath)) {
807
- console.error(`\u274C File not found: ${filePath}`);
808
- filesErrored++;
809
- continue;
810
- }
811
- try {
812
- await processFile(filePath, outputDir, options, flags);
813
- filesProcessed++;
814
- } catch (error) {
815
- console.error(`\u274C Error processing ${filePath}:`, error);
816
- filesErrored++;
817
- }
818
- }
819
- if (!flags.quiet) {
820
- console.log("\n\u2705 Documentation generation complete!");
821
- if (flags.verbose) {
822
- console.log(` Files processed: ${filesProcessed}`);
823
- if (filesErrored > 0) {
824
- console.log(` Files with errors: ${filesErrored}`);
825
- }
826
- }
827
- }
828
- }
829
- main().catch((error) => {
830
- console.error("Fatal error:", error);
831
- process.exit(1);
832
- });
833
- export {
834
- parseDialTags,
835
- parseInterfaceProperties,
836
- parseTypeAlias,
837
- propToDialSchema
838
- };