@vuer-ai/vuer-uikit 0.0.97 → 0.0.98
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/README.md +106 -7
- package/cli/dial-cli.js +49 -7
- package/dist/SyncScroll/SyncScroll.cjs +9 -9
- package/dist/SyncScroll/SyncScroll.mjs +2 -2
- package/dist/SyncScroll/index.cjs +9 -9
- package/dist/SyncScroll/index.mjs +2 -2
- package/dist/chunk-4KWGGESI.cjs +494 -0
- package/dist/{chunk-6YDZA2RP.cjs → chunk-7GWDO25E.cjs} +1 -1
- package/dist/chunk-A5LCX2UQ.cjs +208 -0
- package/dist/chunk-BEJIZ56L.mjs +300 -0
- package/dist/chunk-C7VGRU3O.mjs +283 -0
- package/dist/chunk-LJMNHTTG.cjs +679 -0
- package/dist/chunk-O66RESRR.cjs +285 -0
- package/dist/{chunk-JBHXGZUF.mjs → chunk-TTYSYGVE.mjs} +1 -1
- package/dist/chunk-VA3PEYFM.mjs +489 -0
- package/dist/chunk-VBBJSIY7.cjs +308 -0
- package/dist/chunk-W4JCKCW7.mjs +661 -0
- package/dist/chunk-WWGF6TBZ.mjs +206 -0
- package/dist/dial/DialPanel.cjs +11 -11
- package/dist/dial/DialPanel.mjs +10 -10
- package/dist/dial/index.cjs +27 -27
- package/dist/dial/index.mjs +10 -10
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +14 -14
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +10 -10
- package/dist/dial/wrapped-inputs/DialInputs.cjs +21 -21
- package/dist/dial/wrapped-inputs/DialInputs.mjs +10 -10
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +11 -11
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +10 -10
- package/dist/dial/wrapped-inputs/index.cjs +26 -26
- package/dist/dial/wrapped-inputs/index.mjs +10 -10
- package/dist/highlight-cursor/cursor-provider.cjs +3 -3
- package/dist/highlight-cursor/cursor-provider.mjs +2 -2
- package/dist/highlight-cursor/enhanced-components.cjs +1 -1
- package/dist/highlight-cursor/enhanced-components.mjs +1 -1
- package/dist/highlight-cursor/index.cjs +3 -3
- package/dist/highlight-cursor/index.mjs +2 -2
- package/dist/index.cjs +86 -86
- package/dist/index.mjs +10 -10
- package/dist/ui/UIKitBadge.cjs +5 -5
- package/dist/ui/UIKitBadge.mjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/index.cjs +12 -12
- package/dist/ui/index.mjs +6 -6
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/tree-view-legacy.cjs +8 -8
- package/dist/ui/tree-view-legacy.mjs +4 -4
- package/dist/ui/waterfall/index.cjs +5 -5
- package/dist/ui/waterfall/index.mjs +4 -4
- package/package.json +1 -1
- package/src/cli/dial-cli.ts +64 -8
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import { QuaternionInput } from './chunk-6J7ZVRSY.mjs';
|
|
2
|
+
import { RadInput } from './chunk-GPV4XELL.mjs';
|
|
3
|
+
import { TimeInput } from './chunk-7R2ZBAE6.mjs';
|
|
4
|
+
import { Vec3Input } from './chunk-PIXIN3IG.mjs';
|
|
5
|
+
import { CmInput } from './chunk-SQQXY4AY.mjs';
|
|
6
|
+
import { DegInput } from './chunk-CZ2YNM7Y.mjs';
|
|
7
|
+
import { EulerDegInput } from './chunk-OJUK6WJ5.mjs';
|
|
8
|
+
import { EulerInput } from './chunk-5TXABUNC.mjs';
|
|
9
|
+
import { InchInput } from './chunk-ZZLF2YWP.mjs';
|
|
10
|
+
import { IntInput } from './chunk-NT5ZTF56.mjs';
|
|
11
|
+
import { VectorInput } from './chunk-6CM4GYJU.mjs';
|
|
12
|
+
import { Slider } from './chunk-Y6WGGVT2.mjs';
|
|
13
|
+
import { Switch } from './chunk-AZBJB6KC.mjs';
|
|
14
|
+
import { FormLayout } from './chunk-NRQJX772.mjs';
|
|
15
|
+
import { Label } from './chunk-42UBHC2D.mjs';
|
|
16
|
+
import { useDialSchema } from './chunk-3HEZVWRW.mjs';
|
|
17
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-CX6OFX5Z.mjs';
|
|
18
|
+
import { InputRoot, InputSlot } from './chunk-4XUJBMDE.mjs';
|
|
19
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
+
|
|
21
|
+
var DialInputWrapper = ({ label, children }) => {
|
|
22
|
+
if (!label) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsxs(FormLayout, { orientation: "label-top", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Label, { size: "sm", children: label }),
|
|
27
|
+
children
|
|
28
|
+
] });
|
|
29
|
+
};
|
|
30
|
+
var DialVec3Input = ({
|
|
31
|
+
name,
|
|
32
|
+
label,
|
|
33
|
+
size = "sm",
|
|
34
|
+
step,
|
|
35
|
+
labelPosition
|
|
36
|
+
}) => {
|
|
37
|
+
const { getValue, setValue } = useDialSchema();
|
|
38
|
+
const value = getValue(name) ?? [0, 0, 0];
|
|
39
|
+
if (labelPosition === "inline") {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
Vec3Input,
|
|
42
|
+
{
|
|
43
|
+
value,
|
|
44
|
+
onValuesChange: (val) => setValue(name, val),
|
|
45
|
+
size,
|
|
46
|
+
step,
|
|
47
|
+
prefix: label ? [label, "", ""] : void 0
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
} else {
|
|
51
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(
|
|
52
|
+
Vec3Input,
|
|
53
|
+
{
|
|
54
|
+
value,
|
|
55
|
+
onValuesChange: (val) => setValue(name, val),
|
|
56
|
+
size,
|
|
57
|
+
step
|
|
58
|
+
}
|
|
59
|
+
) });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var DialEulerInput = ({
|
|
63
|
+
name,
|
|
64
|
+
label,
|
|
65
|
+
size = "sm",
|
|
66
|
+
step,
|
|
67
|
+
labelPosition
|
|
68
|
+
}) => {
|
|
69
|
+
const { getValue, setValue } = useDialSchema();
|
|
70
|
+
const value = getValue(name) ?? [0, 0, 0];
|
|
71
|
+
if (labelPosition === "inline") {
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
EulerInput,
|
|
74
|
+
{
|
|
75
|
+
value,
|
|
76
|
+
onValuesChange: (val) => setValue(name, val),
|
|
77
|
+
size,
|
|
78
|
+
step,
|
|
79
|
+
prefix: label ? [label, "", ""] : void 0
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
} else {
|
|
83
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(
|
|
84
|
+
EulerInput,
|
|
85
|
+
{
|
|
86
|
+
value,
|
|
87
|
+
onValuesChange: (val) => setValue(name, val),
|
|
88
|
+
size,
|
|
89
|
+
step
|
|
90
|
+
}
|
|
91
|
+
) });
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var DialEulerDegInput = ({
|
|
95
|
+
name,
|
|
96
|
+
label,
|
|
97
|
+
size = "sm",
|
|
98
|
+
step,
|
|
99
|
+
labelPosition
|
|
100
|
+
}) => {
|
|
101
|
+
const { getValue, setValue } = useDialSchema();
|
|
102
|
+
const value = getValue(name) ?? [0, 0, 0];
|
|
103
|
+
if (labelPosition === "inline") {
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
EulerDegInput,
|
|
106
|
+
{
|
|
107
|
+
value,
|
|
108
|
+
onValuesChange: (val) => setValue(name, val),
|
|
109
|
+
size,
|
|
110
|
+
step,
|
|
111
|
+
prefix: label ? [label, "", ""] : void 0
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
} else {
|
|
115
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(
|
|
116
|
+
EulerDegInput,
|
|
117
|
+
{
|
|
118
|
+
value,
|
|
119
|
+
onValuesChange: (val) => setValue(name, val),
|
|
120
|
+
size,
|
|
121
|
+
step
|
|
122
|
+
}
|
|
123
|
+
) });
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var DialQuaternionInput = ({
|
|
127
|
+
name,
|
|
128
|
+
label,
|
|
129
|
+
size = "sm",
|
|
130
|
+
step,
|
|
131
|
+
labelPosition
|
|
132
|
+
}) => {
|
|
133
|
+
const { getValue, setValue } = useDialSchema();
|
|
134
|
+
const value = getValue(name) ?? [1, 0, 0, 0];
|
|
135
|
+
if (labelPosition === "inline") {
|
|
136
|
+
return /* @__PURE__ */ jsx(
|
|
137
|
+
QuaternionInput,
|
|
138
|
+
{
|
|
139
|
+
value,
|
|
140
|
+
onValuesChange: (val) => setValue(name, val),
|
|
141
|
+
size,
|
|
142
|
+
step,
|
|
143
|
+
prefix: label ? [label, "", "", ""] : void 0
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
} else {
|
|
147
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(
|
|
148
|
+
QuaternionInput,
|
|
149
|
+
{
|
|
150
|
+
value,
|
|
151
|
+
onValuesChange: (val) => setValue(name, val),
|
|
152
|
+
size,
|
|
153
|
+
step
|
|
154
|
+
}
|
|
155
|
+
) });
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var DialVectorInput = ({
|
|
159
|
+
name,
|
|
160
|
+
label,
|
|
161
|
+
size = "sm",
|
|
162
|
+
step,
|
|
163
|
+
dimensions = 3,
|
|
164
|
+
labelPosition
|
|
165
|
+
}) => {
|
|
166
|
+
const { getValue, setValue } = useDialSchema();
|
|
167
|
+
const value = getValue(name) ?? new Array(dimensions).fill(0);
|
|
168
|
+
if (labelPosition === "inline") {
|
|
169
|
+
return /* @__PURE__ */ jsx(
|
|
170
|
+
VectorInput,
|
|
171
|
+
{
|
|
172
|
+
value,
|
|
173
|
+
onValuesChange: (val) => setValue(name, val),
|
|
174
|
+
size,
|
|
175
|
+
step,
|
|
176
|
+
prefix: label ? [label, ...new Array(value.length - 1).fill("")] : void 0
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
} else {
|
|
180
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(
|
|
181
|
+
VectorInput,
|
|
182
|
+
{
|
|
183
|
+
value,
|
|
184
|
+
onValuesChange: (val) => setValue(name, val),
|
|
185
|
+
size,
|
|
186
|
+
step
|
|
187
|
+
}
|
|
188
|
+
) });
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var DialIntInput = ({
|
|
192
|
+
name,
|
|
193
|
+
label,
|
|
194
|
+
size = "sm",
|
|
195
|
+
step = 1,
|
|
196
|
+
labelPosition
|
|
197
|
+
}) => {
|
|
198
|
+
const { getValue, setValue } = useDialSchema();
|
|
199
|
+
const value = getValue(name) ?? 0;
|
|
200
|
+
if (labelPosition === "inline") {
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
202
|
+
IntInput,
|
|
203
|
+
{
|
|
204
|
+
value,
|
|
205
|
+
prefix: label ? [label] : void 0,
|
|
206
|
+
onChange: (val) => setValue(name, val),
|
|
207
|
+
size,
|
|
208
|
+
step
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
} else {
|
|
212
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(IntInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var DialDegInput = ({
|
|
216
|
+
name,
|
|
217
|
+
label,
|
|
218
|
+
size = "sm",
|
|
219
|
+
step,
|
|
220
|
+
labelPosition
|
|
221
|
+
}) => {
|
|
222
|
+
const { getValue, setValue } = useDialSchema();
|
|
223
|
+
const value = getValue(name) ?? 0;
|
|
224
|
+
if (labelPosition === "inline") {
|
|
225
|
+
return /* @__PURE__ */ jsx(
|
|
226
|
+
DegInput,
|
|
227
|
+
{
|
|
228
|
+
value,
|
|
229
|
+
onChange: (val) => setValue(name, val),
|
|
230
|
+
size,
|
|
231
|
+
step,
|
|
232
|
+
prefix: label ? [label] : void 0
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
} else {
|
|
236
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(DegInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var DialRadInput = ({
|
|
240
|
+
name,
|
|
241
|
+
label,
|
|
242
|
+
size = "sm",
|
|
243
|
+
step,
|
|
244
|
+
labelPosition
|
|
245
|
+
}) => {
|
|
246
|
+
const { getValue, setValue } = useDialSchema();
|
|
247
|
+
const value = getValue(name) ?? 0;
|
|
248
|
+
if (labelPosition === "inline") {
|
|
249
|
+
return /* @__PURE__ */ jsx(
|
|
250
|
+
RadInput,
|
|
251
|
+
{
|
|
252
|
+
value,
|
|
253
|
+
onChange: (val) => setValue(name, val),
|
|
254
|
+
size,
|
|
255
|
+
step,
|
|
256
|
+
prefix: label ? [label] : void 0
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
} else {
|
|
260
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(RadInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var DialCmInput = ({
|
|
264
|
+
name,
|
|
265
|
+
label,
|
|
266
|
+
size = "sm",
|
|
267
|
+
step,
|
|
268
|
+
labelPosition
|
|
269
|
+
}) => {
|
|
270
|
+
const { getValue, setValue } = useDialSchema();
|
|
271
|
+
const value = getValue(name) ?? 0;
|
|
272
|
+
if (labelPosition === "inline") {
|
|
273
|
+
return /* @__PURE__ */ jsx(
|
|
274
|
+
CmInput,
|
|
275
|
+
{
|
|
276
|
+
value,
|
|
277
|
+
onChange: (val) => setValue(name, val),
|
|
278
|
+
size,
|
|
279
|
+
step,
|
|
280
|
+
prefix: label ? [label] : void 0
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
} else {
|
|
284
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(CmInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
var DialInchInput = ({
|
|
288
|
+
name,
|
|
289
|
+
label,
|
|
290
|
+
size = "sm",
|
|
291
|
+
step,
|
|
292
|
+
labelPosition
|
|
293
|
+
}) => {
|
|
294
|
+
const { getValue, setValue } = useDialSchema();
|
|
295
|
+
const value = getValue(name) ?? 0;
|
|
296
|
+
if (labelPosition === "inline") {
|
|
297
|
+
return /* @__PURE__ */ jsx(
|
|
298
|
+
InchInput,
|
|
299
|
+
{
|
|
300
|
+
value,
|
|
301
|
+
onChange: (val) => setValue(name, val),
|
|
302
|
+
size,
|
|
303
|
+
step,
|
|
304
|
+
prefix: label ? [label] : void 0
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
} else {
|
|
308
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(InchInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var DialTimeInput = ({
|
|
312
|
+
name,
|
|
313
|
+
label,
|
|
314
|
+
size = "sm",
|
|
315
|
+
step,
|
|
316
|
+
labelPosition
|
|
317
|
+
}) => {
|
|
318
|
+
const { getValue, setValue } = useDialSchema();
|
|
319
|
+
const value = getValue(name) ?? 0;
|
|
320
|
+
if (labelPosition === "inline") {
|
|
321
|
+
return /* @__PURE__ */ jsx(
|
|
322
|
+
TimeInput,
|
|
323
|
+
{
|
|
324
|
+
value,
|
|
325
|
+
onChange: (val) => setValue(name, val),
|
|
326
|
+
size,
|
|
327
|
+
step,
|
|
328
|
+
prefix: label ? [label] : void 0
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
} else {
|
|
332
|
+
return /* @__PURE__ */ jsx(DialInputWrapper, { label, children: /* @__PURE__ */ jsx(TimeInput, { value, onChange: (val) => setValue(name, val), size, step }) });
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
var DialVectorInput2 = ({
|
|
336
|
+
name,
|
|
337
|
+
label,
|
|
338
|
+
size = "sm"
|
|
339
|
+
}) => {
|
|
340
|
+
const { getValue, setValue, schemas } = useDialSchema();
|
|
341
|
+
const schema = schemas.find((s) => s.name === name);
|
|
342
|
+
if (!schema) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
const value = getValue(name) || [];
|
|
346
|
+
const dimensions = schema.dimensions || schema.placeholders?.length || schema.dtypes?.length || (Array.isArray(value) ? value.length : 6);
|
|
347
|
+
const placeholders = schema.placeholders || [];
|
|
348
|
+
const dtypes = schema.dtypes || [];
|
|
349
|
+
const steps = schema.steps || [];
|
|
350
|
+
const tags = schema.tags || {};
|
|
351
|
+
let gridAutoFlow;
|
|
352
|
+
let gridColumns;
|
|
353
|
+
let gridRows;
|
|
354
|
+
if (typeof tags.col === "number") {
|
|
355
|
+
gridAutoFlow = "column";
|
|
356
|
+
gridRows = tags.col;
|
|
357
|
+
gridColumns = void 0;
|
|
358
|
+
} else if (typeof tags.row === "number") {
|
|
359
|
+
gridAutoFlow = "row";
|
|
360
|
+
gridColumns = tags.row;
|
|
361
|
+
gridRows = void 0;
|
|
362
|
+
} else {
|
|
363
|
+
gridAutoFlow = "row";
|
|
364
|
+
gridColumns = void 0;
|
|
365
|
+
gridRows = void 0;
|
|
366
|
+
}
|
|
367
|
+
console.log("the grid-flow is", gridAutoFlow, gridColumns, gridRows);
|
|
368
|
+
const vectorValue = Array.isArray(value) ? value.concat(Array(Math.max(0, dimensions - value.length)).fill(0)) : Array(dimensions).fill(0);
|
|
369
|
+
const inputSteps = Array.from({ length: dimensions }, (_, i) => {
|
|
370
|
+
if (steps[i] !== void 0) {
|
|
371
|
+
return steps[i];
|
|
372
|
+
}
|
|
373
|
+
const dtype = dtypes[i];
|
|
374
|
+
return dtype === "number-int" ? 1 : 1e-3;
|
|
375
|
+
});
|
|
376
|
+
const labels = placeholders.length > 0 ? placeholders.map((p) => /* @__PURE__ */ jsx("span", { className: "text-xs", children: p })) : void 0;
|
|
377
|
+
const handleValuesChange = (newValues) => {
|
|
378
|
+
setValue(name, newValues);
|
|
379
|
+
};
|
|
380
|
+
const inputComponent = /* @__PURE__ */ jsx(
|
|
381
|
+
VectorInput,
|
|
382
|
+
{
|
|
383
|
+
value: vectorValue,
|
|
384
|
+
onValuesChange: handleValuesChange,
|
|
385
|
+
size,
|
|
386
|
+
step: inputSteps,
|
|
387
|
+
labels,
|
|
388
|
+
gridAutoFlow,
|
|
389
|
+
columns: gridColumns,
|
|
390
|
+
rows: gridRows
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
if (!label) {
|
|
394
|
+
return inputComponent;
|
|
395
|
+
}
|
|
396
|
+
return /* @__PURE__ */ jsxs(FormLayout, { orientation: "label-top", children: [
|
|
397
|
+
/* @__PURE__ */ jsx(Label, { size: "sm", children: label }),
|
|
398
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2", children: [
|
|
399
|
+
schema.helpText && /* @__PURE__ */ jsx(
|
|
400
|
+
"span",
|
|
401
|
+
{
|
|
402
|
+
className: "text-text-secondary cursor-help text-xs",
|
|
403
|
+
title: schema.helpText,
|
|
404
|
+
children: "\u24D8"
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
inputComponent
|
|
408
|
+
] })
|
|
409
|
+
] });
|
|
410
|
+
};
|
|
411
|
+
var DialPanel = ({ schemas, groups: groupConfigs }) => {
|
|
412
|
+
const groupConfigMap = {};
|
|
413
|
+
if (groupConfigs) {
|
|
414
|
+
groupConfigs.forEach((config) => {
|
|
415
|
+
groupConfigMap[config.name] = config;
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
schemas.forEach((schema) => {
|
|
419
|
+
const grouping = schema.tags?.grouping;
|
|
420
|
+
if (grouping && !groupConfigMap[grouping]) {
|
|
421
|
+
groupConfigMap[grouping] = { name: grouping };
|
|
422
|
+
}
|
|
423
|
+
if (grouping && schema.tags?.noWrap && groupConfigMap[grouping]) {
|
|
424
|
+
groupConfigMap[grouping].noWrap = true;
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
const groupedSchemas = {};
|
|
428
|
+
const ungrouped = [];
|
|
429
|
+
schemas.forEach((schema) => {
|
|
430
|
+
const grouping = schema.tags?.grouping;
|
|
431
|
+
if (grouping) {
|
|
432
|
+
if (!groupedSchemas[grouping]) {
|
|
433
|
+
groupedSchemas[grouping] = [];
|
|
434
|
+
}
|
|
435
|
+
groupedSchemas[grouping].push(schema);
|
|
436
|
+
} else {
|
|
437
|
+
ungrouped.push(schema);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
const renderSchemaInput = (schema) => {
|
|
441
|
+
const { name, dtype, min, max, step, options, tags } = schema;
|
|
442
|
+
const labelPosition = tags?.labelPosition;
|
|
443
|
+
const label = name.charAt(0).toUpperCase() + name.slice(1);
|
|
444
|
+
switch (dtype) {
|
|
445
|
+
case "vector3":
|
|
446
|
+
return /* @__PURE__ */ jsx(
|
|
447
|
+
DialVec3Input,
|
|
448
|
+
{
|
|
449
|
+
name,
|
|
450
|
+
label,
|
|
451
|
+
step,
|
|
452
|
+
labelPosition
|
|
453
|
+
},
|
|
454
|
+
name
|
|
455
|
+
);
|
|
456
|
+
case "euler":
|
|
457
|
+
return /* @__PURE__ */ jsx(
|
|
458
|
+
DialEulerDegInput,
|
|
459
|
+
{
|
|
460
|
+
name,
|
|
461
|
+
label,
|
|
462
|
+
step,
|
|
463
|
+
labelPosition
|
|
464
|
+
},
|
|
465
|
+
name
|
|
466
|
+
);
|
|
467
|
+
case "vector":
|
|
468
|
+
case "vector-6":
|
|
469
|
+
case "number-group":
|
|
470
|
+
return /* @__PURE__ */ jsx(DialVectorInput2, { name, label }, name);
|
|
471
|
+
case "boolean":
|
|
472
|
+
return /* @__PURE__ */ jsx(DialBooleanInput, { name, label, labelPosition }, name);
|
|
473
|
+
case "number-int":
|
|
474
|
+
return /* @__PURE__ */ jsx(
|
|
475
|
+
DialIntInput,
|
|
476
|
+
{
|
|
477
|
+
name,
|
|
478
|
+
label,
|
|
479
|
+
step: step || 1,
|
|
480
|
+
labelPosition
|
|
481
|
+
},
|
|
482
|
+
name
|
|
483
|
+
);
|
|
484
|
+
case "number":
|
|
485
|
+
if (min !== void 0 && max !== void 0 && !options) {
|
|
486
|
+
return /* @__PURE__ */ jsx(
|
|
487
|
+
DialSliderInput,
|
|
488
|
+
{
|
|
489
|
+
name,
|
|
490
|
+
label,
|
|
491
|
+
min,
|
|
492
|
+
max,
|
|
493
|
+
step,
|
|
494
|
+
labelPosition
|
|
495
|
+
},
|
|
496
|
+
name
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
if (options && options.length > 0) {
|
|
500
|
+
return /* @__PURE__ */ jsx(
|
|
501
|
+
DialSelectInput,
|
|
502
|
+
{
|
|
503
|
+
name,
|
|
504
|
+
label,
|
|
505
|
+
options,
|
|
506
|
+
labelPosition
|
|
507
|
+
},
|
|
508
|
+
name
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
return /* @__PURE__ */ jsx(
|
|
512
|
+
DialNumberInput,
|
|
513
|
+
{
|
|
514
|
+
name,
|
|
515
|
+
label,
|
|
516
|
+
min,
|
|
517
|
+
max,
|
|
518
|
+
step,
|
|
519
|
+
labelPosition
|
|
520
|
+
},
|
|
521
|
+
name
|
|
522
|
+
);
|
|
523
|
+
case "string":
|
|
524
|
+
if (options && options.length > 0) {
|
|
525
|
+
return /* @__PURE__ */ jsx(
|
|
526
|
+
DialSelectInput,
|
|
527
|
+
{
|
|
528
|
+
name,
|
|
529
|
+
label,
|
|
530
|
+
options,
|
|
531
|
+
labelPosition
|
|
532
|
+
},
|
|
533
|
+
name
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
default:
|
|
538
|
+
return null;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
return /* @__PURE__ */ jsxs("div", { className: "dial-schema-renderer space-y-4", children: [
|
|
542
|
+
Object.entries(groupedSchemas).map(([name, schemaList]) => {
|
|
543
|
+
const groupConfig = groupConfigMap[name];
|
|
544
|
+
const hasNoWrap = groupConfig?.noWrap;
|
|
545
|
+
const wrapClass = hasNoWrap ? "" : "flex-wrap";
|
|
546
|
+
return /* @__PURE__ */ jsxs("div", { className: "dial-group", children: [
|
|
547
|
+
/* @__PURE__ */ jsx("div", { className: "text-text-primary mb-2 font-medium", children: name }),
|
|
548
|
+
/* @__PURE__ */ jsx("div", { className: `dial-row flex flex-row ${wrapClass} gap-4`, children: schemaList.map(renderSchemaInput) })
|
|
549
|
+
] }, name);
|
|
550
|
+
}),
|
|
551
|
+
ungrouped.length > 0 && /* @__PURE__ */ jsx("div", { className: "dial-group", children: /* @__PURE__ */ jsx("div", { className: "dial-row flex flex-row flex-wrap gap-4", children: ungrouped.map(renderSchemaInput) }) })
|
|
552
|
+
] });
|
|
553
|
+
};
|
|
554
|
+
var DialInputWrapper2 = ({ label, children }) => {
|
|
555
|
+
if (!label) {
|
|
556
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
557
|
+
}
|
|
558
|
+
return /* @__PURE__ */ jsxs(FormLayout, { orientation: "label-top", children: [
|
|
559
|
+
/* @__PURE__ */ jsx(Label, { size: "sm", children: label }),
|
|
560
|
+
children
|
|
561
|
+
] });
|
|
562
|
+
};
|
|
563
|
+
var DialNumberInput = ({
|
|
564
|
+
name,
|
|
565
|
+
min,
|
|
566
|
+
max,
|
|
567
|
+
step = 1,
|
|
568
|
+
label,
|
|
569
|
+
labelPosition,
|
|
570
|
+
size = "sm"
|
|
571
|
+
}) => {
|
|
572
|
+
const { getValue, setValue } = useDialSchema();
|
|
573
|
+
const value = getValue(name) ?? 0;
|
|
574
|
+
const inputProps = {
|
|
575
|
+
type: "number",
|
|
576
|
+
value,
|
|
577
|
+
min,
|
|
578
|
+
max,
|
|
579
|
+
step,
|
|
580
|
+
onChange: (e) => setValue(name, parseFloat(e.target.value)),
|
|
581
|
+
size
|
|
582
|
+
};
|
|
583
|
+
if (labelPosition === "inline") {
|
|
584
|
+
return /* @__PURE__ */ jsx(InputRoot, { ...inputProps, children: label ? /* @__PURE__ */ jsx(InputSlot, { side: "left", children: label }) : null });
|
|
585
|
+
} else {
|
|
586
|
+
return /* @__PURE__ */ jsx(DialInputWrapper2, { label, children: /* @__PURE__ */ jsx(InputRoot, { ...inputProps }) });
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
var DialBooleanInput = ({ name, label, labelPosition }) => {
|
|
590
|
+
const { getValue, setValue } = useDialSchema();
|
|
591
|
+
const value = getValue(name) ?? false;
|
|
592
|
+
const switchProps = {
|
|
593
|
+
checked: value,
|
|
594
|
+
onCheckedChange: (checked) => setValue(name, checked)
|
|
595
|
+
};
|
|
596
|
+
if (!label) {
|
|
597
|
+
return /* @__PURE__ */ jsx(Switch, { ...switchProps });
|
|
598
|
+
}
|
|
599
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2", children: [
|
|
600
|
+
/* @__PURE__ */ jsx(Label, { size: "sm", children: label }),
|
|
601
|
+
/* @__PURE__ */ jsx(Switch, { ...switchProps })
|
|
602
|
+
] });
|
|
603
|
+
};
|
|
604
|
+
var DialSelectInput = ({
|
|
605
|
+
name,
|
|
606
|
+
options = [],
|
|
607
|
+
label,
|
|
608
|
+
labelPosition,
|
|
609
|
+
size = "sm"
|
|
610
|
+
}) => {
|
|
611
|
+
const { getValue, setValue } = useDialSchema();
|
|
612
|
+
const value = getValue(name);
|
|
613
|
+
const selectComponent = /* @__PURE__ */ jsxs(
|
|
614
|
+
Select,
|
|
615
|
+
{
|
|
616
|
+
value: String(value),
|
|
617
|
+
onValueChange: (val) => {
|
|
618
|
+
const parsed = !isNaN(Number(val)) ? Number(val) : val;
|
|
619
|
+
setValue(name, parsed);
|
|
620
|
+
},
|
|
621
|
+
children: [
|
|
622
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select an option" }) }),
|
|
623
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.map((opt, i) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt), children: String(opt) }, i)) })
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
if (!label) {
|
|
628
|
+
return selectComponent;
|
|
629
|
+
}
|
|
630
|
+
return /* @__PURE__ */ jsx(DialInputWrapper2, { label, children: selectComponent });
|
|
631
|
+
};
|
|
632
|
+
var DialSliderInput = ({
|
|
633
|
+
name,
|
|
634
|
+
min = 0,
|
|
635
|
+
max = 100,
|
|
636
|
+
step = 1,
|
|
637
|
+
label,
|
|
638
|
+
labelPosition,
|
|
639
|
+
size = "sm"
|
|
640
|
+
}) => {
|
|
641
|
+
const { getValue, setValue } = useDialSchema();
|
|
642
|
+
const value = getValue(name) ?? min;
|
|
643
|
+
const sliderProps = {
|
|
644
|
+
value: [value],
|
|
645
|
+
onValueChange: ([val]) => setValue(name, val),
|
|
646
|
+
min,
|
|
647
|
+
max,
|
|
648
|
+
step,
|
|
649
|
+
className: "flex-1"
|
|
650
|
+
};
|
|
651
|
+
const sliderComponent = /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
|
|
652
|
+
/* @__PURE__ */ jsx(Slider, { ...sliderProps }),
|
|
653
|
+
/* @__PURE__ */ jsx("span", { className: "text-text-secondary w-12 text-right text-sm", children: value })
|
|
654
|
+
] });
|
|
655
|
+
if (!label) {
|
|
656
|
+
return sliderComponent;
|
|
657
|
+
}
|
|
658
|
+
return /* @__PURE__ */ jsx(DialInputWrapper2, { label, children: sliderComponent });
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
export { DialBooleanInput, DialCmInput, DialDegInput, DialEulerDegInput, DialEulerInput, DialInchInput, DialIntInput, DialNumberInput, DialPanel, DialQuaternionInput, DialRadInput, DialSelectInput, DialSliderInput, DialTimeInput, DialVec3Input, DialVectorInput, DialVectorInput2 };
|