@vuer-ai/vuer-uikit 0.0.99 → 0.0.100
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/dist/SyncScroll/SyncScroll.cjs +3 -3
- package/dist/SyncScroll/SyncScroll.mjs +3 -3
- package/dist/SyncScroll/index.cjs +3 -3
- package/dist/SyncScroll/index.mjs +3 -3
- package/dist/{chunk-WIGYDOHM.cjs → chunk-XBTBTLID.cjs} +2 -2
- package/dist/{chunk-XMFU7SDD.mjs → chunk-XGXWOY3U.mjs} +2 -2
- package/dist/dial/DialPanel.cjs +6 -6
- package/dist/dial/DialPanel.mjs +6 -6
- package/dist/dial/index.cjs +6 -6
- package/dist/dial/index.mjs +6 -6
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +6 -6
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +6 -6
- package/dist/dial/wrapped-inputs/DialInputs.cjs +6 -6
- package/dist/dial/wrapped-inputs/DialInputs.mjs +6 -6
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +6 -6
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +6 -6
- package/dist/dial/wrapped-inputs/index.cjs +6 -6
- package/dist/dial/wrapped-inputs/index.mjs +6 -6
- package/dist/highlight-cursor/enhanced-components.cjs +4 -4
- package/dist/highlight-cursor/enhanced-components.mjs +4 -4
- package/dist/highlight-cursor/index.cjs +8 -8
- package/dist/highlight-cursor/index.mjs +4 -4
- package/dist/hooks/index.cjs +12 -12
- package/dist/hooks/index.mjs +3 -3
- package/dist/hooks/useQueryParams.cjs +3 -3
- package/dist/hooks/useQueryParams.mjs +2 -2
- package/dist/index.cjs +47 -47
- package/dist/index.css +7 -1
- package/dist/index.mjs +6 -6
- package/dist/ui/DialBadge.cjs +3 -3
- package/dist/ui/DialBadge.mjs +3 -3
- package/dist/ui/UIKitBadge.cjs +8 -8
- package/dist/ui/UIKitBadge.mjs +4 -4
- package/dist/ui/avatar.cjs +3 -3
- package/dist/ui/avatar.mjs +3 -3
- package/dist/ui/badge.cjs +3 -3
- package/dist/ui/badge.mjs +3 -3
- package/dist/ui/button.cjs +3 -3
- package/dist/ui/button.mjs +3 -3
- package/dist/ui/card.cjs +3 -3
- package/dist/ui/card.mjs +3 -3
- package/dist/ui/checkbox.cjs +3 -3
- package/dist/ui/checkbox.mjs +3 -3
- package/dist/ui/collapsible.cjs +3 -3
- package/dist/ui/collapsible.mjs +3 -3
- package/dist/ui/drawer.cjs +3 -3
- package/dist/ui/drawer.mjs +3 -3
- package/dist/ui/dropdown.cjs +3 -3
- package/dist/ui/dropdown.mjs +3 -3
- package/dist/ui/index.cjs +33 -33
- package/dist/ui/index.mjs +5 -5
- package/dist/ui/inputs/color-input.cjs +3 -3
- package/dist/ui/inputs/color-input.mjs +3 -3
- package/dist/ui/inputs/index.cjs +3 -3
- package/dist/ui/inputs/index.mjs +3 -3
- package/dist/ui/inputs/input-numbers.cjs +3 -3
- package/dist/ui/inputs/input-numbers.mjs +3 -3
- package/dist/ui/inputs/input.cjs +3 -3
- package/dist/ui/inputs/input.mjs +3 -3
- package/dist/ui/inputs/number-inputs/CmInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/CmInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/DegInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/DegInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/InchInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/InchInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/IntInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/IntInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/KVectorInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/KVectorInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/RadInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/RadInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/TimeInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/TimeInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/Vec3Input.cjs +3 -3
- package/dist/ui/inputs/number-inputs/Vec3Input.mjs +3 -3
- package/dist/ui/inputs/number-inputs/VectorInput.cjs +3 -3
- package/dist/ui/inputs/number-inputs/VectorInput.mjs +3 -3
- package/dist/ui/inputs/number-inputs/index.cjs +3 -3
- package/dist/ui/inputs/number-inputs/index.mjs +3 -3
- package/dist/ui/inputs/presets-input.cjs +3 -3
- package/dist/ui/inputs/presets-input.mjs +3 -3
- package/dist/ui/label.cjs +3 -3
- package/dist/ui/label.mjs +3 -3
- package/dist/ui/layout.cjs +3 -3
- package/dist/ui/layout.mjs +3 -3
- package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +3 -3
- package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +3 -3
- package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +3 -3
- package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +3 -3
- package/dist/ui/layouts/dock-layout/index.cjs +3 -3
- package/dist/ui/layouts/dock-layout/index.mjs +3 -3
- package/dist/ui/layouts/index.cjs +3 -3
- package/dist/ui/layouts/index.mjs +3 -3
- package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +3 -3
- package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +3 -3
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +3 -3
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +3 -3
- package/dist/ui/layouts/liquid-layout/index.cjs +3 -3
- package/dist/ui/layouts/liquid-layout/index.mjs +3 -3
- package/dist/ui/modal.cjs +3 -3
- package/dist/ui/modal.mjs +3 -3
- package/dist/ui/navigation.cjs +3 -3
- package/dist/ui/navigation.mjs +3 -3
- package/dist/ui/pagination.cjs +3 -3
- package/dist/ui/pagination.mjs +3 -3
- package/dist/ui/panel.cjs +3 -3
- package/dist/ui/panel.mjs +3 -3
- package/dist/ui/popover.cjs +3 -3
- package/dist/ui/popover.mjs +3 -3
- package/dist/ui/radio-group.cjs +3 -3
- package/dist/ui/radio-group.mjs +3 -3
- package/dist/ui/resizable.cjs +3 -3
- package/dist/ui/resizable.mjs +3 -3
- package/dist/ui/select.cjs +3 -3
- package/dist/ui/select.mjs +3 -3
- package/dist/ui/separator.cjs +3 -3
- package/dist/ui/separator.mjs +3 -3
- package/dist/ui/sheet.cjs +3 -3
- package/dist/ui/sheet.mjs +3 -3
- package/dist/ui/sidebar.cjs +28 -28
- package/dist/ui/sidebar.mjs +4 -4
- package/dist/ui/simple-tree-view.cjs +3 -3
- package/dist/ui/simple-tree-view.mjs +3 -3
- package/dist/ui/skeleton.cjs +3 -3
- package/dist/ui/skeleton.mjs +3 -3
- package/dist/ui/slider.cjs +3 -3
- package/dist/ui/slider.mjs +3 -3
- package/dist/ui/switch.cjs +3 -3
- package/dist/ui/switch.mjs +3 -3
- package/dist/ui/table.cjs +3 -3
- package/dist/ui/table.mjs +3 -3
- package/dist/ui/tabs.cjs +3 -3
- package/dist/ui/tabs.mjs +3 -3
- package/dist/ui/textarea.cjs +3 -3
- package/dist/ui/textarea.mjs +3 -3
- package/dist/ui/theme/ThemeToggles.cjs +3 -3
- package/dist/ui/theme/ThemeToggles.mjs +3 -3
- package/dist/ui/theme/index.cjs +3 -3
- package/dist/ui/theme/index.mjs +3 -3
- package/dist/ui/toggle-buttons.cjs +3 -3
- package/dist/ui/toggle-buttons.mjs +3 -3
- package/dist/ui/toggle-group.cjs +3 -3
- package/dist/ui/toggle-group.mjs +3 -3
- package/dist/ui/toggle.cjs +3 -3
- package/dist/ui/toggle.mjs +3 -3
- package/dist/ui/toolbar.cjs +3 -3
- package/dist/ui/toolbar.mjs +3 -3
- package/dist/ui/tooltip.cjs +3 -3
- package/dist/ui/tooltip.mjs +3 -3
- package/dist/ui/tree-view/TreeSearchBar.cjs +3 -3
- package/dist/ui/tree-view/TreeSearchBar.mjs +3 -3
- package/dist/ui/tree-view/TreeView.cjs +3 -3
- package/dist/ui/tree-view/TreeView.mjs +3 -3
- package/dist/ui/tree-view/index.cjs +3 -3
- package/dist/ui/tree-view/index.mjs +3 -3
- package/dist/ui/tree-view-legacy.cjs +3 -3
- package/dist/ui/tree-view-legacy.mjs +3 -3
- package/dist/ui/waterfall/CursorOverlay.cjs +3 -3
- package/dist/ui/waterfall/CursorOverlay.mjs +3 -3
- package/dist/ui/waterfall/TimelineEvent.cjs +3 -3
- package/dist/ui/waterfall/TimelineEvent.mjs +3 -3
- package/dist/ui/waterfall/TimelineProcessBar.cjs +3 -3
- package/dist/ui/waterfall/TimelineProcessBar.mjs +3 -3
- package/dist/ui/waterfall/Wedges.cjs +3 -3
- package/dist/ui/waterfall/Wedges.mjs +3 -3
- package/dist/ui/waterfall/index.cjs +3 -3
- package/dist/ui/waterfall/index.mjs +3 -3
- package/package.json +1 -5
- package/dial-cli/README.md +0 -137
- package/dial-cli/dial-cli.ts +0 -1136
- package/dial-cli/dist/dial-cli.js +0 -838
- package/dial-cli/node_modules/.bin/api-extractor +0 -17
- package/dial-cli/node_modules/.bin/jiti +0 -17
- package/dial-cli/node_modules/.bin/tsc +0 -17
- package/dial-cli/node_modules/.bin/tsserver +0 -17
- package/dial-cli/node_modules/.bin/tsup +0 -17
- package/dial-cli/node_modules/.bin/tsup-node +0 -17
- package/dial-cli/node_modules/.bin/tsx +0 -17
- package/dial-cli/node_modules/.bin/yaml +0 -17
- package/dial-cli/package.json +0 -47
- package/dial-cli/tsconfig.json +0 -20
- package/dial-cli/tsup.config.ts +0 -18
- package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
- package/dist/{chunk-Q4XH2Z5M.cjs → chunk-LYZJNEOR.cjs} +1 -1
- package/dist/{chunk-U3LN5NB6.mjs → chunk-OEIF3JCH.mjs} +1 -1
- package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
|
@@ -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
|
-
};
|