@cadit-app/script-params 0.1.0 → 0.2.0
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 +107 -34
- package/dist/index.d.ts +143 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,14 +14,17 @@ npm install @cadit-app/script-params
|
|
|
14
14
|
import { defineParams } from '@cadit-app/script-params';
|
|
15
15
|
|
|
16
16
|
export default defineParams({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
params: {
|
|
18
|
+
size: { type: 'number', default: 10, min: 1, max: 100 },
|
|
19
|
+
label: { type: 'text', default: 'Hello' },
|
|
20
|
+
hollow: { type: 'boolean', default: false },
|
|
21
|
+
},
|
|
22
|
+
main: (params) => {
|
|
23
|
+
// params.size is number
|
|
24
|
+
// params.label is string
|
|
25
|
+
// params.hollow is boolean
|
|
26
|
+
return createModel(params.size, params.label, params.hollow);
|
|
27
|
+
},
|
|
25
28
|
});
|
|
26
29
|
```
|
|
27
30
|
|
|
@@ -30,6 +33,7 @@ export default defineParams({
|
|
|
30
33
|
- **Type-safe parameters** - Full TypeScript inference without `as const`
|
|
31
34
|
- **Default values** - Scripts work standalone when params are undefined
|
|
32
35
|
- **UI generation** - Schema can be converted to UI controls
|
|
36
|
+
- **Exporters** - Define custom export formats (SVG, PNG, etc.)
|
|
33
37
|
- **Simple API** - Just one function to learn
|
|
34
38
|
|
|
35
39
|
## Parameter Types
|
|
@@ -40,48 +44,71 @@ export default defineParams({
|
|
|
40
44
|
| `int` | `number` | `min`, `max`, `step` |
|
|
41
45
|
| `text` | `string` | `maxLength`, `placeholder` |
|
|
42
46
|
| `boolean` | `boolean` | - |
|
|
43
|
-
| `choice` | `string` | `options: string[]` |
|
|
47
|
+
| `choice` | `string` | `options: string[]` or `options: { value, label }[]` |
|
|
44
48
|
| `slider` | `number` | `min`, `max`, `step` (required: `min`, `max`) |
|
|
49
|
+
| `buttonGrid` | `string` | `options: { value, image?, caption? }[]` |
|
|
45
50
|
| `image` | `ImageData \| null` | - |
|
|
51
|
+
| `embedded` | `EmbeddedParamValue` | `params`, `enabled?`, `showSettings?` |
|
|
46
52
|
|
|
47
53
|
## API Reference
|
|
48
54
|
|
|
49
|
-
### `defineParams(
|
|
55
|
+
### `defineParams(config)`
|
|
50
56
|
|
|
51
|
-
Define parameters for a script.
|
|
57
|
+
Define parameters for a script. Pass a config object with `params` (required), and optionally `main` and `exporters`.
|
|
52
58
|
|
|
53
|
-
**
|
|
59
|
+
**Basic usage:**
|
|
54
60
|
```typescript
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
export default defineParams({
|
|
62
|
+
params: {
|
|
63
|
+
size: { type: 'number', default: 10 },
|
|
64
|
+
},
|
|
65
|
+
main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
57
66
|
});
|
|
58
|
-
// Returns
|
|
67
|
+
// Returns a callable ScriptModule
|
|
59
68
|
```
|
|
60
69
|
|
|
61
|
-
**With
|
|
70
|
+
**With exporters:**
|
|
62
71
|
```typescript
|
|
63
72
|
export default defineParams({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
params: {
|
|
74
|
+
size: { type: 'number', default: 10 },
|
|
75
|
+
},
|
|
76
|
+
exporters: {
|
|
77
|
+
svg: {
|
|
78
|
+
name: 'SVG',
|
|
79
|
+
label: 'Download SVG',
|
|
80
|
+
export: async (params) => ({
|
|
81
|
+
mimeType: 'image/svg+xml',
|
|
82
|
+
fileName: 'model.svg',
|
|
83
|
+
data: generateSvg(params),
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Without main (add main separately):**
|
|
92
|
+
```typescript
|
|
93
|
+
const script = defineParams({
|
|
94
|
+
params: { size: { type: 'number', default: 10 } },
|
|
95
|
+
exporters: { svg: svgExporter },
|
|
67
96
|
});
|
|
68
|
-
|
|
97
|
+
|
|
98
|
+
export default createMain(script, myMainFunction);
|
|
69
99
|
```
|
|
70
100
|
|
|
71
|
-
### `createMain(
|
|
101
|
+
### `createMain(scriptModule, main)`
|
|
72
102
|
|
|
73
|
-
|
|
103
|
+
Add a main function to a ScriptModule. Preserves any exporters.
|
|
74
104
|
|
|
75
105
|
```typescript
|
|
76
|
-
const
|
|
77
|
-
size: { type: 'number', default: 10 },
|
|
106
|
+
const script = defineParams({
|
|
107
|
+
params: { size: { type: 'number', default: 10 } },
|
|
108
|
+
exporters: { svg: svgExporter },
|
|
78
109
|
});
|
|
79
110
|
|
|
80
|
-
|
|
81
|
-
return Manifold.cube([p.size, p.size, p.size]);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default createMain(params, main);
|
|
111
|
+
export default createMain(script, (p) => Manifold.cube([p.size, ...]));
|
|
85
112
|
```
|
|
86
113
|
|
|
87
114
|
### `Params<S>`
|
|
@@ -89,11 +116,13 @@ export default createMain(params, main);
|
|
|
89
116
|
Type helper to get the params object type from a schema.
|
|
90
117
|
|
|
91
118
|
```typescript
|
|
92
|
-
const
|
|
93
|
-
|
|
119
|
+
const script = defineParams({
|
|
120
|
+
params: {
|
|
121
|
+
size: { type: 'number', default: 10 },
|
|
122
|
+
},
|
|
94
123
|
});
|
|
95
124
|
|
|
96
|
-
type MyParams = Params<typeof
|
|
125
|
+
type MyParams = Params<typeof script.params>;
|
|
97
126
|
// { size: number }
|
|
98
127
|
```
|
|
99
128
|
|
|
@@ -105,7 +134,7 @@ Convert object-based schema to array format for legacy UI compatibility.
|
|
|
105
134
|
const array = schemaToArray({
|
|
106
135
|
size: { type: 'number', default: 10 },
|
|
107
136
|
});
|
|
108
|
-
// [{ name: 'size', type: 'number',
|
|
137
|
+
// [{ name: 'size', type: 'number', initial: 10, caption: 'size' }]
|
|
109
138
|
```
|
|
110
139
|
|
|
111
140
|
### `getDefaults(schema)`
|
|
@@ -122,7 +151,7 @@ const defaults = getDefaults({
|
|
|
122
151
|
|
|
123
152
|
### `isScriptModule(value)`
|
|
124
153
|
|
|
125
|
-
Check if a value is a
|
|
154
|
+
Check if a value is a ScriptModule created by `defineParams`.
|
|
126
155
|
|
|
127
156
|
```typescript
|
|
128
157
|
const mod = await import('./script.ts');
|
|
@@ -131,6 +160,50 @@ if (isScriptModule(mod.default)) {
|
|
|
131
160
|
}
|
|
132
161
|
```
|
|
133
162
|
|
|
163
|
+
### `getParams(source)`
|
|
164
|
+
|
|
165
|
+
Extract the parameter schema from a ScriptModule.
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
const qrParams = getParams(qrCodeScript);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### `getExporters(module)`
|
|
172
|
+
|
|
173
|
+
Extract exporters from a ScriptModule.
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
const exporters = getExporters(script);
|
|
177
|
+
// { svg: { name: 'SVG', ... }, png: { name: 'PNG', ... } }
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Exporters
|
|
181
|
+
|
|
182
|
+
Exporters allow scripts to define custom download formats:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { defineParams, Exporter, ExportResult } from '@cadit-app/script-params';
|
|
186
|
+
|
|
187
|
+
const svgExporter: Exporter = {
|
|
188
|
+
name: 'SVG',
|
|
189
|
+
label: 'Download SVG',
|
|
190
|
+
description: 'Export as scalable vector graphic',
|
|
191
|
+
export: async (params): Promise<ExportResult> => ({
|
|
192
|
+
mimeType: 'image/svg+xml',
|
|
193
|
+
fileName: 'output.svg',
|
|
194
|
+
data: generateSvgFromParams(params),
|
|
195
|
+
}),
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export default defineParams({
|
|
199
|
+
params: {
|
|
200
|
+
size: { type: 'number', default: 10 },
|
|
201
|
+
},
|
|
202
|
+
exporters: { svg: svgExporter },
|
|
203
|
+
main: (params) => generateGeometry(params),
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
134
207
|
## License
|
|
135
208
|
|
|
136
209
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -8,14 +8,48 @@
|
|
|
8
8
|
* import { defineParams } from '@cadit-app/script-params';
|
|
9
9
|
*
|
|
10
10
|
* export default defineParams({
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* params: {
|
|
12
|
+
* size: { type: 'number', default: 10 },
|
|
13
|
+
* label: { type: 'text', default: 'Hello' },
|
|
14
|
+
* },
|
|
15
|
+
* main: (params) => {
|
|
16
|
+
* // params.size is number, params.label is string
|
|
17
|
+
* return Manifold.cube([params.size, params.size, params.size]);
|
|
18
|
+
* },
|
|
16
19
|
* });
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
22
|
+
/**
|
|
23
|
+
* Result returned by an exporter function.
|
|
24
|
+
* Contains the file data, MIME type, and suggested filename.
|
|
25
|
+
*/
|
|
26
|
+
export interface ExportResult {
|
|
27
|
+
/** MIME type of the exported data (e.g., 'image/svg+xml', 'image/png'). */
|
|
28
|
+
mimeType: string;
|
|
29
|
+
/** Suggested filename for download (e.g., 'model.svg'). */
|
|
30
|
+
fileName: string;
|
|
31
|
+
/** The exported data - string for text formats, ArrayBuffer for binary. */
|
|
32
|
+
data: ArrayBuffer | string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Exporter definition.
|
|
36
|
+
* Provides a function to export the current state to a downloadable format.
|
|
37
|
+
*/
|
|
38
|
+
export interface Exporter<S extends ParamSchema = ParamSchema> {
|
|
39
|
+
/** Short name for the exporter (e.g., 'SVG', 'PNG', '3MF'). */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Label shown on the download button (e.g., 'Download SVG'). */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Description or tooltip for the exporter. */
|
|
44
|
+
description?: string;
|
|
45
|
+
/** Export function that receives the current parameter values. */
|
|
46
|
+
export: (params: Params<S>) => Promise<ExportResult> | ExportResult;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Map of exporters keyed by identifier.
|
|
50
|
+
* The key is used to identify the exporter, the value contains the definition.
|
|
51
|
+
*/
|
|
52
|
+
export type Exporters<S extends ParamSchema = ParamSchema> = Record<string, Exporter<S>>;
|
|
19
53
|
/**
|
|
20
54
|
* Base properties shared by all parameter types.
|
|
21
55
|
*/
|
|
@@ -61,13 +95,40 @@ export interface BooleanParamDef extends ParamDefBase {
|
|
|
61
95
|
type: 'boolean';
|
|
62
96
|
default: boolean;
|
|
63
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Option for choice parameter.
|
|
100
|
+
* Can be a simple string or an object with value and optional label.
|
|
101
|
+
*/
|
|
102
|
+
export type ChoiceOption = string | {
|
|
103
|
+
value: string;
|
|
104
|
+
label?: string;
|
|
105
|
+
};
|
|
64
106
|
/**
|
|
65
107
|
* Choice parameter - select from predefined options.
|
|
108
|
+
* Options can be simple strings or objects with value/label pairs.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* // Simple options
|
|
113
|
+
* color: { type: 'choice', default: 'red', options: ['red', 'green', 'blue'] }
|
|
114
|
+
*
|
|
115
|
+
* // Options with labels
|
|
116
|
+
* errorLevel: {
|
|
117
|
+
* type: 'choice',
|
|
118
|
+
* default: 'M',
|
|
119
|
+
* options: [
|
|
120
|
+
* { value: 'L', label: 'L - ~7% recovery' },
|
|
121
|
+
* { value: 'M', label: 'M - ~15% recovery' },
|
|
122
|
+
* { value: 'Q', label: 'Q - ~25% recovery' },
|
|
123
|
+
* { value: 'H', label: 'H - ~30% recovery' },
|
|
124
|
+
* ]
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
66
127
|
*/
|
|
67
128
|
export interface ChoiceParamDef extends ParamDefBase {
|
|
68
129
|
type: 'choice';
|
|
69
130
|
default: string;
|
|
70
|
-
options: readonly
|
|
131
|
+
options: readonly ChoiceOption[];
|
|
71
132
|
}
|
|
72
133
|
/**
|
|
73
134
|
* Slider parameter - number with visual slider control.
|
|
@@ -199,69 +260,91 @@ export type Params<S extends ParamSchema> = {
|
|
|
199
260
|
[K in keyof S]: ParamValue<S[K]>;
|
|
200
261
|
};
|
|
201
262
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
263
|
+
* Configuration object for defineParams when using named properties.
|
|
264
|
+
* All options are named for clarity and extensibility.
|
|
265
|
+
*/
|
|
266
|
+
export interface ScriptConfig<S extends ParamSchema, R = unknown> {
|
|
267
|
+
/** The parameter schema defining all inputs. */
|
|
268
|
+
params: S;
|
|
269
|
+
/** Optional main function that generates geometry. */
|
|
270
|
+
main?: (params: Params<S>) => R;
|
|
271
|
+
/** Optional exporters for custom download formats (SVG, PNG, etc.). */
|
|
272
|
+
exporters?: Exporters<S>;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* The result returned by defineParams.
|
|
276
|
+
* Contains the schema (for UI), optional exporters, and is optionally callable.
|
|
204
277
|
*/
|
|
205
|
-
export interface ScriptModule<S extends ParamSchema, R> {
|
|
278
|
+
export interface ScriptModule<S extends ParamSchema, R = unknown> {
|
|
206
279
|
/** The parameter schema for UI generation. */
|
|
207
280
|
params: S;
|
|
281
|
+
/** Optional exporters for custom download formats. */
|
|
282
|
+
exporters?: Exporters<S>;
|
|
208
283
|
/**
|
|
209
284
|
* Execute the script with optional parameter overrides.
|
|
210
285
|
* Missing parameters use their default values.
|
|
286
|
+
* Only available if a main function was provided.
|
|
211
287
|
*/
|
|
212
288
|
(inputParams?: Partial<Params<S>>): R;
|
|
213
289
|
}
|
|
214
290
|
/**
|
|
215
291
|
* Define parameters for a parametric script.
|
|
216
292
|
*
|
|
217
|
-
*
|
|
218
|
-
* 1. Schema only - returns the schema for use with `createMain`
|
|
219
|
-
* 2. Schema + callback - returns an executable module with defaults
|
|
293
|
+
* Pass a config object with `params` (required), and optionally `main` and `exporters`.
|
|
220
294
|
*
|
|
221
|
-
* @example
|
|
295
|
+
* @example Basic usage
|
|
222
296
|
* ```typescript
|
|
223
|
-
*
|
|
224
|
-
*
|
|
297
|
+
* export default defineParams({
|
|
298
|
+
* params: {
|
|
299
|
+
* size: { type: 'number', default: 10 },
|
|
300
|
+
* },
|
|
301
|
+
* main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
225
302
|
* });
|
|
226
|
-
*
|
|
227
|
-
* function main(p: Params<typeof params>) {
|
|
228
|
-
* return Manifold.cube([p.size, p.size, p.size]);
|
|
229
|
-
* }
|
|
230
|
-
*
|
|
231
|
-
* export default createMain(params, main);
|
|
232
303
|
* ```
|
|
233
304
|
*
|
|
234
|
-
* @example With
|
|
305
|
+
* @example With exporters
|
|
235
306
|
* ```typescript
|
|
236
307
|
* export default defineParams({
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
308
|
+
* params: {
|
|
309
|
+
* size: { type: 'number', default: 10 },
|
|
310
|
+
* },
|
|
311
|
+
* exporters: {
|
|
312
|
+
* svg: { name: 'SVG', export: (p) => svgExport(p) },
|
|
313
|
+
* png: { name: 'PNG', export: (p) => pngExport(p) },
|
|
314
|
+
* },
|
|
315
|
+
* main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* @example Without main (add main separately with createMain)
|
|
320
|
+
* ```typescript
|
|
321
|
+
* const script = defineParams({
|
|
322
|
+
* params: { size: { type: 'number', default: 10 } },
|
|
323
|
+
* exporters: { svg: svgExporter },
|
|
240
324
|
* });
|
|
325
|
+
* export default createMain(script, myMainFunction);
|
|
241
326
|
* ```
|
|
242
327
|
*/
|
|
243
|
-
export declare function defineParams<const S extends ParamSchema>(
|
|
244
|
-
export declare function defineParams<const S extends ParamSchema, R>(schema: S, main: (params: Params<S>) => R): ScriptModule<S, R>;
|
|
328
|
+
export declare function defineParams<const S extends ParamSchema, R = unknown>(config: ScriptConfig<S, R>): ScriptModule<S, R>;
|
|
245
329
|
/**
|
|
246
|
-
* Create an executable script module
|
|
330
|
+
* Create an executable script module by adding a main function.
|
|
331
|
+
*
|
|
332
|
+
* Use this when you want to define your main function separately from the params,
|
|
333
|
+
* for example when the main is complex or needs to be tested independently.
|
|
247
334
|
*
|
|
248
|
-
*
|
|
249
|
-
* for example when it's complex or needs to be tested independently.
|
|
335
|
+
* Preserves any exporters defined on the original ScriptModule.
|
|
250
336
|
*
|
|
251
337
|
* @example
|
|
252
338
|
* ```typescript
|
|
253
|
-
* const
|
|
254
|
-
* size: { type: 'number', default: 10 },
|
|
339
|
+
* const script = defineParams({
|
|
340
|
+
* params: { size: { type: 'number', default: 10 } },
|
|
341
|
+
* exporters: { svg: svgExporter },
|
|
255
342
|
* });
|
|
256
343
|
*
|
|
257
|
-
*
|
|
258
|
-
* return Manifold.cube([p.size, p.size, p.size]);
|
|
259
|
-
* }
|
|
260
|
-
*
|
|
261
|
-
* export default createMain(params, main);
|
|
344
|
+
* export default createMain(script, (p) => Manifold.cube([p.size, ...]));
|
|
262
345
|
* ```
|
|
263
346
|
*/
|
|
264
|
-
export declare function createMain<S extends ParamSchema, R>(
|
|
347
|
+
export declare function createMain<S extends ParamSchema, R>(scriptModule: ScriptModule<S, unknown>, main: (params: Params<S>) => R): ScriptModule<S, R>;
|
|
265
348
|
/**
|
|
266
349
|
* Convert an object-based schema to array format for legacy UI compatibility.
|
|
267
350
|
*
|
|
@@ -303,30 +386,40 @@ export declare function getDefaults<S extends ParamSchema>(schema: S): Params<S>
|
|
|
303
386
|
*/
|
|
304
387
|
export declare function isScriptModule(value: unknown): value is ScriptModule<ParamSchema, unknown>;
|
|
305
388
|
/**
|
|
306
|
-
* Extract the parameter schema from a ScriptModule
|
|
389
|
+
* Extract the parameter schema from a ScriptModule.
|
|
307
390
|
* Useful for embedding another script's parameters.
|
|
308
391
|
*
|
|
309
392
|
* @example
|
|
310
393
|
* ```typescript
|
|
311
394
|
* import qrCodeScript from './qr-code';
|
|
312
395
|
*
|
|
313
|
-
* // Works with ScriptModule
|
|
314
396
|
* const qrParams = getParams(qrCodeScript);
|
|
315
397
|
*
|
|
316
|
-
* // Also works with plain schema
|
|
317
|
-
* const schema = { size: { type: 'number', default: 10 } } as const;
|
|
318
|
-
* const plainParams = getParams(schema);
|
|
319
|
-
*
|
|
320
398
|
* // Use in embedded param definition
|
|
321
399
|
* export default defineParams({
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
400
|
+
* params: {
|
|
401
|
+
* qrCode: {
|
|
402
|
+
* type: 'embedded',
|
|
403
|
+
* params: getParams(qrCodeScript),
|
|
404
|
+
* enabled: false,
|
|
405
|
+
* },
|
|
406
|
+
* },
|
|
327
407
|
* });
|
|
328
408
|
* ```
|
|
329
409
|
*/
|
|
330
|
-
export declare function getParams<S extends ParamSchema>(source: ScriptModule<S, unknown>
|
|
410
|
+
export declare function getParams<S extends ParamSchema>(source: ScriptModule<S, unknown>): S;
|
|
411
|
+
/**
|
|
412
|
+
* Extract exporters from a ScriptModule.
|
|
413
|
+
* Returns an empty array if the module has no exporters.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* import qrCodeScript from './qr-code';
|
|
418
|
+
*
|
|
419
|
+
* const exporters = getExporters(qrCodeScript);
|
|
420
|
+
* // { svg: { name: 'SVG', ... }, png: { name: 'PNG', ... } }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
export declare function getExporters<S extends ParamSchema>(source: ScriptModule<S, unknown>): Exporters<S>;
|
|
331
424
|
export {};
|
|
332
425
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC3D,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;CACrE;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAMzF;;GAEG;AACH,UAAU,YAAY;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAA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|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* params: {
|
|
12
|
+
* size: { type: 'number', default: 10 },
|
|
13
|
+
* label: { type: 'text', default: 'Hello' },
|
|
14
|
+
* },
|
|
15
|
+
* main: (params) => {
|
|
16
|
+
* // params.size is number, params.label is string
|
|
17
|
+
* return Manifold.cube([params.size, params.size, params.size]);
|
|
18
|
+
* },
|
|
16
19
|
* });
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
@@ -41,39 +44,89 @@ function buildDefaults(schema) {
|
|
|
41
44
|
}
|
|
42
45
|
return defaults;
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Define parameters for a parametric script.
|
|
49
|
+
*
|
|
50
|
+
* Pass a config object with `params` (required), and optionally `main` and `exporters`.
|
|
51
|
+
*
|
|
52
|
+
* @example Basic usage
|
|
53
|
+
* ```typescript
|
|
54
|
+
* export default defineParams({
|
|
55
|
+
* params: {
|
|
56
|
+
* size: { type: 'number', default: 10 },
|
|
57
|
+
* },
|
|
58
|
+
* main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example With exporters
|
|
63
|
+
* ```typescript
|
|
64
|
+
* export default defineParams({
|
|
65
|
+
* params: {
|
|
66
|
+
* size: { type: 'number', default: 10 },
|
|
67
|
+
* },
|
|
68
|
+
* exporters: {
|
|
69
|
+
* svg: { name: 'SVG', export: (p) => svgExport(p) },
|
|
70
|
+
* png: { name: 'PNG', export: (p) => pngExport(p) },
|
|
71
|
+
* },
|
|
72
|
+
* main: (params) => Manifold.cube([params.size, params.size, params.size]),
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Without main (add main separately with createMain)
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const script = defineParams({
|
|
79
|
+
* params: { size: { type: 'number', default: 10 } },
|
|
80
|
+
* exporters: { svg: svgExporter },
|
|
81
|
+
* });
|
|
82
|
+
* export default createMain(script, myMainFunction);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function defineParams(config) {
|
|
86
|
+
const { params: schema, main, exporters } = config;
|
|
48
87
|
const defaults = buildDefaults(schema);
|
|
49
88
|
const scriptModule = ((inputParams) => {
|
|
89
|
+
if (!main) {
|
|
90
|
+
throw new Error('This script does not have a main function. Use createMain() to add one.');
|
|
91
|
+
}
|
|
50
92
|
const merged = { ...defaults, ...inputParams };
|
|
51
93
|
return main(merged);
|
|
52
94
|
});
|
|
53
95
|
scriptModule.params = schema;
|
|
96
|
+
if (exporters) {
|
|
97
|
+
scriptModule.exporters = exporters;
|
|
98
|
+
}
|
|
54
99
|
return scriptModule;
|
|
55
100
|
}
|
|
56
101
|
/**
|
|
57
|
-
* Create an executable script module
|
|
102
|
+
* Create an executable script module by adding a main function.
|
|
58
103
|
*
|
|
59
|
-
* Use this when you want to define your main function separately,
|
|
60
|
-
* for example when
|
|
104
|
+
* Use this when you want to define your main function separately from the params,
|
|
105
|
+
* for example when the main is complex or needs to be tested independently.
|
|
106
|
+
*
|
|
107
|
+
* Preserves any exporters defined on the original ScriptModule.
|
|
61
108
|
*
|
|
62
109
|
* @example
|
|
63
110
|
* ```typescript
|
|
64
|
-
* const
|
|
65
|
-
* size: { type: 'number', default: 10 },
|
|
111
|
+
* const script = defineParams({
|
|
112
|
+
* params: { size: { type: 'number', default: 10 } },
|
|
113
|
+
* exporters: { svg: svgExporter },
|
|
66
114
|
* });
|
|
67
115
|
*
|
|
68
|
-
*
|
|
69
|
-
* return Manifold.cube([p.size, p.size, p.size]);
|
|
70
|
-
* }
|
|
71
|
-
*
|
|
72
|
-
* export default createMain(params, main);
|
|
116
|
+
* export default createMain(script, (p) => Manifold.cube([p.size, ...]));
|
|
73
117
|
* ```
|
|
74
118
|
*/
|
|
75
|
-
export function createMain(
|
|
76
|
-
|
|
119
|
+
export function createMain(scriptModule, main) {
|
|
120
|
+
const defaults = buildDefaults(scriptModule.params);
|
|
121
|
+
const newModule = ((inputParams) => {
|
|
122
|
+
const merged = { ...defaults, ...inputParams };
|
|
123
|
+
return main(merged);
|
|
124
|
+
});
|
|
125
|
+
newModule.params = scriptModule.params;
|
|
126
|
+
if (scriptModule.exporters) {
|
|
127
|
+
newModule.exporters = scriptModule.exporters;
|
|
128
|
+
}
|
|
129
|
+
return newModule;
|
|
77
130
|
}
|
|
78
131
|
// =============================================================================
|
|
79
132
|
// Utility Functions
|
|
@@ -103,9 +156,31 @@ function convertParamDef(name, def) {
|
|
|
103
156
|
base.maxLength = def.maxLength;
|
|
104
157
|
// Handle type-specific conversions
|
|
105
158
|
switch (def.type) {
|
|
106
|
-
case 'choice':
|
|
107
|
-
|
|
159
|
+
case 'choice': {
|
|
160
|
+
// Handle both simple string options and { value, label } objects
|
|
161
|
+
const options = def.options;
|
|
162
|
+
const values = [];
|
|
163
|
+
const captions = [];
|
|
164
|
+
let hasCaptions = false;
|
|
165
|
+
for (const opt of options) {
|
|
166
|
+
if (typeof opt === 'string') {
|
|
167
|
+
values.push(opt);
|
|
168
|
+
captions.push(opt); // Use value as caption if no label
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
values.push(opt.value);
|
|
172
|
+
captions.push(opt.label ?? opt.value);
|
|
173
|
+
if (opt.label)
|
|
174
|
+
hasCaptions = true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
base.values = values;
|
|
178
|
+
// Only set captions if at least one option has a label
|
|
179
|
+
if (hasCaptions) {
|
|
180
|
+
base.captions = captions;
|
|
181
|
+
}
|
|
108
182
|
break;
|
|
183
|
+
}
|
|
109
184
|
case 'buttonGrid': {
|
|
110
185
|
// Convert buttonGrid options to ObjectMakerButtonGridParam format
|
|
111
186
|
base.options = def.options.map((opt) => ({
|
|
@@ -176,34 +251,43 @@ export function isScriptModule(value) {
|
|
|
176
251
|
value.params !== null);
|
|
177
252
|
}
|
|
178
253
|
/**
|
|
179
|
-
* Extract the parameter schema from a ScriptModule
|
|
254
|
+
* Extract the parameter schema from a ScriptModule.
|
|
180
255
|
* Useful for embedding another script's parameters.
|
|
181
256
|
*
|
|
182
257
|
* @example
|
|
183
258
|
* ```typescript
|
|
184
259
|
* import qrCodeScript from './qr-code';
|
|
185
260
|
*
|
|
186
|
-
* // Works with ScriptModule
|
|
187
261
|
* const qrParams = getParams(qrCodeScript);
|
|
188
262
|
*
|
|
189
|
-
* // Also works with plain schema
|
|
190
|
-
* const schema = { size: { type: 'number', default: 10 } } as const;
|
|
191
|
-
* const plainParams = getParams(schema);
|
|
192
|
-
*
|
|
193
263
|
* // Use in embedded param definition
|
|
194
264
|
* export default defineParams({
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
265
|
+
* params: {
|
|
266
|
+
* qrCode: {
|
|
267
|
+
* type: 'embedded',
|
|
268
|
+
* params: getParams(qrCodeScript),
|
|
269
|
+
* enabled: false,
|
|
270
|
+
* },
|
|
271
|
+
* },
|
|
200
272
|
* });
|
|
201
273
|
* ```
|
|
202
274
|
*/
|
|
203
275
|
export function getParams(source) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
276
|
+
return source.params;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Extract exporters from a ScriptModule.
|
|
280
|
+
* Returns an empty array if the module has no exporters.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* import qrCodeScript from './qr-code';
|
|
285
|
+
*
|
|
286
|
+
* const exporters = getExporters(qrCodeScript);
|
|
287
|
+
* // { svg: { name: 'SVG', ... }, png: { name: 'PNG', ... } }
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
export function getExporters(source) {
|
|
291
|
+
return source.exporters ?? {};
|
|
208
292
|
}
|
|
209
293
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAyUH,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;GAGG;AACH,SAAS,aAAa,CAAwB,MAAS;IACrD,MAAM,QAAQ,GAAG,EAAe,CAAC;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAChD,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,qDAAqD;YACrD,MAAM,WAAW,GAAG,GAAuB,CAAC;YAC3C,QAAoC,CAAC,GAAG,CAAC,GAAG;gBAC3C,OAAO,EAAE,WAAW,CAAC,OAAO,IAAI,KAAK;gBACrC,YAAY,EAAE,WAAW,CAAC,YAAY,IAAI,KAAK;gBAC/C,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC;aAC1C,CAAC;QACJ,CAAC;aAAM,CAAC;YACL,QAAoC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3D,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACnD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,CAAC,CAAC,WAAgC,EAAK,EAAE;QAC5D,IAAI,CAAC,IAAI,E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