@ic-reactor/candid 3.0.13-beta.0 → 3.0.14-beta.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 +28 -0
- package/dist/visitor/arguments/helpers.d.ts +5 -5
- package/dist/visitor/arguments/helpers.d.ts.map +1 -1
- package/dist/visitor/arguments/helpers.js.map +1 -1
- package/dist/visitor/arguments/index.d.ts +12 -2
- package/dist/visitor/arguments/index.d.ts.map +1 -1
- package/dist/visitor/arguments/index.js +136 -12
- package/dist/visitor/arguments/index.js.map +1 -1
- package/dist/visitor/arguments/types.d.ts +112 -359
- package/dist/visitor/arguments/types.d.ts.map +1 -1
- package/dist/visitor/returns/types.d.ts +3 -4
- package/dist/visitor/returns/types.d.ts.map +1 -1
- package/dist/visitor/types.d.ts +14 -0
- package/dist/visitor/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/visitor/arguments/helpers.ts +5 -5
- package/src/visitor/arguments/index.test.ts +43 -22
- package/src/visitor/arguments/index.ts +167 -32
- package/src/visitor/arguments/schema.test.ts +114 -4
- package/src/visitor/arguments/types.ts +178 -444
- package/src/visitor/returns/types.ts +4 -27
- package/src/visitor/types.ts +45 -0
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import type { BaseActor, FunctionName, FunctionType } from "@ic-reactor/core";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
|
|
3
|
+
import type { VisitorDataType, TextFormat, NumberFormat } from "../types";
|
|
4
|
+
export type { TextFormat, NumberFormat };
|
|
5
|
+
export type ArgumentFieldType = VisitorDataType;
|
|
4
6
|
/**
|
|
5
7
|
* Suggested component type for rendering the field.
|
|
6
8
|
* This eliminates the need for switch statements in the frontend.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const componentMap = {
|
|
11
|
-
* 'text-input': TextField,
|
|
12
|
-
* 'number-input': NumberField,
|
|
13
|
-
* 'boolean-checkbox': BooleanField,
|
|
14
|
-
* // ...
|
|
15
|
-
* }
|
|
16
|
-
* const Component = componentMap[field.component]
|
|
17
|
-
* return <Component field={field} />
|
|
18
|
-
* ```
|
|
19
9
|
*/
|
|
20
10
|
export type FieldComponentType = "record-container" | "tuple-container" | "variant-select" | "optional-toggle" | "vector-list" | "blob-upload" | "principal-input" | "text-input" | "number-input" | "boolean-checkbox" | "null-hidden" | "recursive-lazy" | "unknown-fallback";
|
|
21
11
|
/**
|
|
@@ -26,18 +16,6 @@ export type InputType = "text" | "number" | "checkbox" | "select" | "file" | "te
|
|
|
26
16
|
/**
|
|
27
17
|
* Rendering hints for the UI.
|
|
28
18
|
* Eliminates the need for frontend to maintain COMPLEX_TYPES arrays.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```tsx
|
|
32
|
-
* // Frontend no longer needs:
|
|
33
|
-
* // const COMPLEX_TYPES = ["record", "tuple", "variant", "vector", "optional"]
|
|
34
|
-
*
|
|
35
|
-
* // Instead use:
|
|
36
|
-
* if (field.renderHint.isCompound) {
|
|
37
|
-
* return <CompoundFieldRenderer field={field} />
|
|
38
|
-
* }
|
|
39
|
-
* return <PrimitiveInput field={field} />
|
|
40
|
-
* ```
|
|
41
19
|
*/
|
|
42
20
|
export interface RenderHint {
|
|
43
21
|
/** Whether this field has its own container/card styling (compound types) */
|
|
@@ -52,15 +30,10 @@ export interface RenderHint {
|
|
|
52
30
|
/**
|
|
53
31
|
* Pre-computed HTML input props for primitive fields.
|
|
54
32
|
* Can be spread directly onto an input element.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```tsx
|
|
58
|
-
* <input {...field.inputProps} value={value} onChange={handleChange} />
|
|
59
|
-
* ```
|
|
60
33
|
*/
|
|
61
34
|
export interface PrimitiveInputProps {
|
|
62
|
-
/** HTML input type */
|
|
63
|
-
type?: "text" | "number" | "checkbox";
|
|
35
|
+
/** HTML input type - includes format-specific types */
|
|
36
|
+
type?: "text" | "number" | "checkbox" | "email" | "url" | "tel";
|
|
64
37
|
/** Placeholder text */
|
|
65
38
|
placeholder?: string;
|
|
66
39
|
/** Minimum value for number inputs */
|
|
@@ -69,10 +42,10 @@ export interface PrimitiveInputProps {
|
|
|
69
42
|
max?: string | number;
|
|
70
43
|
/** Step value for number inputs */
|
|
71
44
|
step?: string | number;
|
|
72
|
-
/** Pattern for text inputs */
|
|
45
|
+
/** Pattern for text inputs (e.g., phone numbers) */
|
|
73
46
|
pattern?: string;
|
|
74
47
|
/** Input mode for virtual keyboards */
|
|
75
|
-
inputMode?: "text" | "numeric" | "decimal";
|
|
48
|
+
inputMode?: "text" | "numeric" | "decimal" | "email" | "tel" | "url";
|
|
76
49
|
/** Autocomplete hint */
|
|
77
50
|
autoComplete?: string;
|
|
78
51
|
/** Whether to check spelling */
|
|
@@ -82,196 +55,23 @@ export interface PrimitiveInputProps {
|
|
|
82
55
|
/** Maximum length for text inputs */
|
|
83
56
|
maxLength?: number;
|
|
84
57
|
}
|
|
85
|
-
|
|
58
|
+
interface FieldBase<T extends VisitorDataType = VisitorDataType> {
|
|
86
59
|
/** The field type */
|
|
87
|
-
type:
|
|
60
|
+
type: T;
|
|
88
61
|
/** Raw label from Candid: "__arg0", "_0_" */
|
|
89
62
|
label: string;
|
|
90
|
-
/**
|
|
91
|
-
* Pre-formatted display label for UI rendering.
|
|
92
|
-
* Transforms raw labels into human-readable format.
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* "__arg0" => "Arg 0"
|
|
96
|
-
* "_0_" => "Item 0"
|
|
97
|
-
* "created_at_time" => "Created At Time"
|
|
98
|
-
*/
|
|
63
|
+
/** Pre-formatted display label for UI rendering */
|
|
99
64
|
displayLabel: string;
|
|
100
|
-
/**
|
|
101
|
-
* Form field name path for binding.
|
|
102
|
-
* Uses bracket notation for array indices: `[0]`, `args[0].owner`, `tags[1]`
|
|
103
|
-
* Compatible with TanStack Form's `form.Field` name prop.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* <form.Field name={field.name}>
|
|
108
|
-
* {(fieldApi) => <input {...} />}
|
|
109
|
-
* </form.Field>
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
65
|
+
/** Form field name path for binding */
|
|
112
66
|
name: string;
|
|
113
|
-
/**
|
|
114
|
-
* Suggested component type for rendering this field.
|
|
115
|
-
* Eliminates the need for switch statements in the frontend.
|
|
116
|
-
*/
|
|
67
|
+
/** Suggested component type for rendering this field */
|
|
117
68
|
component: FieldComponentType;
|
|
118
|
-
/**
|
|
119
|
-
* Rendering hints for UI strategy.
|
|
120
|
-
* Use this to determine if the field needs a container or is a simple input.
|
|
121
|
-
*/
|
|
69
|
+
/** Rendering hints for UI strategy */
|
|
122
70
|
renderHint: RenderHint;
|
|
123
71
|
/** Zod schema for field validation */
|
|
124
72
|
schema: z.ZodTypeAny;
|
|
125
|
-
/** Default value for the field */
|
|
126
|
-
defaultValue: TValue;
|
|
127
73
|
/** Original Candid type name for reference */
|
|
128
|
-
candidType
|
|
129
|
-
}
|
|
130
|
-
export interface RecordField extends FieldBase<Record<string, unknown>> {
|
|
131
|
-
type: "record";
|
|
132
|
-
/** Child fields in the record */
|
|
133
|
-
fields: Field[];
|
|
134
|
-
/** Map of field label to its metadata for quick lookup */
|
|
135
|
-
fieldMap: Map<string, Field>;
|
|
136
|
-
}
|
|
137
|
-
export interface VariantField extends FieldBase<Record<string, unknown>> {
|
|
138
|
-
type: "variant";
|
|
139
|
-
/** All variant option fields */
|
|
140
|
-
fields: Field[];
|
|
141
|
-
/** List of variant option names */
|
|
142
|
-
options: string[];
|
|
143
|
-
/** Default selected option */
|
|
144
|
-
defaultOption: string;
|
|
145
|
-
/** Map of option name to its field metadata */
|
|
146
|
-
optionMap: Map<string, Field>;
|
|
147
|
-
/**
|
|
148
|
-
* Get default value for a specific option.
|
|
149
|
-
* Useful when switching between variant options.
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```tsx
|
|
153
|
-
* const handleOptionChange = (newOption: string) => {
|
|
154
|
-
* const newDefault = field.getOptionDefault(newOption)
|
|
155
|
-
* fieldApi.handleChange(newDefault)
|
|
156
|
-
* }
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
getOptionDefault: (option: string) => Record<string, unknown>;
|
|
160
|
-
/**
|
|
161
|
-
* Get the field for a specific option.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```tsx
|
|
165
|
-
* const transferField = field.getField("Transfer")
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
getField: (option: string) => Field;
|
|
169
|
-
/**
|
|
170
|
-
* Get the currently selected option from a value.
|
|
171
|
-
* Returns the first valid key found, or the default option.
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* const selectedOption = field.getSelectedOption(currentValue)
|
|
176
|
-
* // { Transfer: {...} } => "Transfer"
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
getSelectedOption: (value: Record<string, unknown>) => string;
|
|
180
|
-
/**
|
|
181
|
-
* Get the selected field from a value.
|
|
182
|
-
* Combines getSelectedOption and getField for convenience.
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```tsx
|
|
186
|
-
* // Current (verbose):
|
|
187
|
-
* const validKeys = Object.keys(currentValue).filter(k => field.options.includes(k))
|
|
188
|
-
* const selected = validKeys[0] ?? field.options[0]
|
|
189
|
-
* const selectedIndex = Math.max(0, field.options.indexOf(selected))
|
|
190
|
-
* const selectedField = field.fields[selectedIndex]
|
|
191
|
-
*
|
|
192
|
-
* // Proposed (simple):
|
|
193
|
-
* const selectedField = field.getSelectedField(currentValue)
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
getSelectedField: (value: Record<string, unknown>) => Field;
|
|
197
|
-
}
|
|
198
|
-
export interface TupleField extends FieldBase<unknown[]> {
|
|
199
|
-
type: "tuple";
|
|
200
|
-
/** Tuple element fields in order */
|
|
201
|
-
fields: Field[];
|
|
202
|
-
}
|
|
203
|
-
export interface OptionalField extends FieldBase<null> {
|
|
204
|
-
type: "optional";
|
|
205
|
-
/** The inner field when value is present */
|
|
206
|
-
innerField: Field;
|
|
207
|
-
/**
|
|
208
|
-
* Get default value when enabling the optional.
|
|
209
|
-
* Returns the inner field's default value.
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```tsx
|
|
213
|
-
* const handleToggle = (enabled: boolean) => {
|
|
214
|
-
* if (enabled) {
|
|
215
|
-
* fieldApi.handleChange(field.getInnerDefault())
|
|
216
|
-
* } else {
|
|
217
|
-
* fieldApi.handleChange(null)
|
|
218
|
-
* }
|
|
219
|
-
* }
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
getInnerDefault: () => unknown;
|
|
223
|
-
/**
|
|
224
|
-
* Check if a value represents an enabled optional.
|
|
225
|
-
* Returns true if the value is not null or undefined.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* ```tsx
|
|
229
|
-
* // Current:
|
|
230
|
-
* const enabled = fieldApi.state.value !== null && typeof fieldApi.state.value !== "undefined"
|
|
231
|
-
*
|
|
232
|
-
* // Proposed:
|
|
233
|
-
* const enabled = field.isEnabled(fieldApi.state.value)
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
isEnabled: (value: unknown) => boolean;
|
|
237
|
-
}
|
|
238
|
-
export interface VectorField extends FieldBase<unknown[]> {
|
|
239
|
-
type: "vector";
|
|
240
|
-
/** Template field for vector items */
|
|
241
|
-
itemField: Field;
|
|
242
|
-
/**
|
|
243
|
-
* Get a new item with default values.
|
|
244
|
-
* Used when adding items to the vector.
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```tsx
|
|
248
|
-
* <button onClick={() => fieldApi.pushValue(field.getItemDefault())}>
|
|
249
|
-
* Add Item
|
|
250
|
-
* </button>
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
getItemDefault: () => unknown;
|
|
254
|
-
/**
|
|
255
|
-
* Create a properly configured item field for a specific index.
|
|
256
|
-
* Handles name path and label generation.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* ```tsx
|
|
260
|
-
* // Current:
|
|
261
|
-
* renderField({
|
|
262
|
-
* ...field.itemField,
|
|
263
|
-
* label: itemLabel,
|
|
264
|
-
* name: itemFieldName
|
|
265
|
-
* })
|
|
266
|
-
*
|
|
267
|
-
* // Proposed:
|
|
268
|
-
* const itemField = field.createItemField(index, { label: itemLabel })
|
|
269
|
-
* renderField(itemField)
|
|
270
|
-
* ```
|
|
271
|
-
*/
|
|
272
|
-
createItemField: (index: number, overrides?: {
|
|
273
|
-
label?: string;
|
|
274
|
-
}) => Field;
|
|
74
|
+
candidType: string;
|
|
275
75
|
}
|
|
276
76
|
/**
|
|
277
77
|
* Blob field size limits.
|
|
@@ -293,68 +93,81 @@ export interface BlobValidationResult {
|
|
|
293
93
|
/** Error message if invalid */
|
|
294
94
|
error?: string;
|
|
295
95
|
}
|
|
296
|
-
|
|
297
|
-
|
|
96
|
+
type FieldExtras<T extends VisitorDataType> = T extends "record" ? {
|
|
97
|
+
/** Child fields in the record */
|
|
98
|
+
fields: FieldNode[];
|
|
99
|
+
/** Map of field label to its metadata for quick lookup */
|
|
100
|
+
fieldMap: Map<string, FieldNode>;
|
|
101
|
+
defaultValue: Record<string, unknown>;
|
|
102
|
+
} : T extends "variant" ? {
|
|
103
|
+
/** All variant option fields */
|
|
104
|
+
fields: FieldNode[];
|
|
105
|
+
/** List of variant option names */
|
|
106
|
+
options: string[];
|
|
107
|
+
/** Default selected option */
|
|
108
|
+
defaultOption: string;
|
|
109
|
+
/** Map of option name to its field metadata */
|
|
110
|
+
optionMap: Map<string, FieldNode>;
|
|
111
|
+
defaultValue: Record<string, unknown>;
|
|
112
|
+
/** Get default value for a specific option */
|
|
113
|
+
getOptionDefault: (option: string) => Record<string, unknown>;
|
|
114
|
+
/** Get the field for a specific option */
|
|
115
|
+
getField: (option: string) => FieldNode;
|
|
116
|
+
/** Get the currently selected option from a value */
|
|
117
|
+
getSelectedOption: (value: Record<string, unknown>) => string;
|
|
118
|
+
/** Get the selected field from a value */
|
|
119
|
+
getSelectedField: (value: Record<string, unknown>) => FieldNode;
|
|
120
|
+
} : T extends "tuple" ? {
|
|
121
|
+
/** Tuple element fields in order */
|
|
122
|
+
fields: FieldNode[];
|
|
123
|
+
defaultValue: unknown[];
|
|
124
|
+
} : T extends "optional" ? {
|
|
125
|
+
/** The inner field when value is present */
|
|
126
|
+
innerField: FieldNode;
|
|
127
|
+
defaultValue: null;
|
|
128
|
+
/** Get default value when enabling the optional */
|
|
129
|
+
getInnerDefault: () => unknown;
|
|
130
|
+
/** Check if a value represents an enabled optional */
|
|
131
|
+
isEnabled: (value: unknown) => boolean;
|
|
132
|
+
} : T extends "vector" ? {
|
|
133
|
+
/** Template field for vector items */
|
|
134
|
+
itemField: FieldNode;
|
|
135
|
+
defaultValue: unknown[];
|
|
136
|
+
/** Get a new item with default values */
|
|
137
|
+
getItemDefault: () => unknown;
|
|
138
|
+
/** Create a properly configured item field for a specific index */
|
|
139
|
+
createItemField: (index: number, overrides?: {
|
|
140
|
+
label?: string;
|
|
141
|
+
}) => FieldNode;
|
|
142
|
+
} : T extends "blob" ? {
|
|
298
143
|
/** Item field for individual bytes (nat8) */
|
|
299
|
-
itemField:
|
|
144
|
+
itemField: FieldNode;
|
|
300
145
|
/** Accepted input formats */
|
|
301
146
|
acceptedFormats: ("hex" | "base64" | "file")[];
|
|
302
147
|
/** Size limits for blob input */
|
|
303
148
|
limits: BlobLimits;
|
|
304
|
-
/**
|
|
305
|
-
* Normalize hex input (remove 0x prefix, lowercase, etc.)
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```tsx
|
|
309
|
-
* const normalized = field.normalizeHex("0xDEADBEEF")
|
|
310
|
-
* // => "deadbeef"
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
149
|
+
/** Normalize hex input */
|
|
313
150
|
normalizeHex: (input: string) => string;
|
|
314
|
-
/**
|
|
315
|
-
* Validate blob input value.
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* ```tsx
|
|
319
|
-
* const result = field.validateInput(value)
|
|
320
|
-
* if (!result.valid) {
|
|
321
|
-
* setError(result.error)
|
|
322
|
-
* }
|
|
323
|
-
* ```
|
|
324
|
-
*/
|
|
151
|
+
/** Validate blob input value */
|
|
325
152
|
validateInput: (value: string | Uint8Array) => BlobValidationResult;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
type: "recursive";
|
|
153
|
+
defaultValue: string;
|
|
154
|
+
} : T extends "recursive" ? {
|
|
329
155
|
/** Type name for the recursive type */
|
|
330
156
|
typeName: string;
|
|
331
157
|
/** Lazily extract the inner field to prevent infinite loops */
|
|
332
|
-
extract: () =>
|
|
333
|
-
/**
|
|
334
|
-
* Get default value for the recursive type.
|
|
335
|
-
* Evaluates the inner type on demand.
|
|
336
|
-
*/
|
|
158
|
+
extract: () => FieldNode;
|
|
159
|
+
/** Get default value for the recursive type (evaluates lazily) */
|
|
337
160
|
getInnerDefault: () => unknown;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
type: "principal";
|
|
161
|
+
defaultValue: undefined;
|
|
162
|
+
} : T extends "principal" ? {
|
|
341
163
|
maxLength: number;
|
|
342
164
|
minLength: number;
|
|
343
|
-
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
* ```tsx
|
|
347
|
-
* <input {...field.inputProps} value={value} onChange={handleChange} />
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
165
|
+
/** Detected format based on label heuristics */
|
|
166
|
+
format: TextFormat;
|
|
167
|
+
/** Pre-computed HTML input props */
|
|
350
168
|
inputProps: PrimitiveInputProps;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
type: "number";
|
|
354
|
-
/**
|
|
355
|
-
* Original Candid type: nat, int, nat8, nat16, nat32, nat64, int8, int16, int32, int64, float32, float64
|
|
356
|
-
*/
|
|
357
|
-
candidType: string;
|
|
169
|
+
defaultValue: string;
|
|
170
|
+
} : T extends "number" ? {
|
|
358
171
|
/** Whether this is an unsigned type */
|
|
359
172
|
unsigned: boolean;
|
|
360
173
|
/** Whether this is a floating point type */
|
|
@@ -365,78 +178,52 @@ export interface NumberField extends FieldBase<string> {
|
|
|
365
178
|
min?: string;
|
|
366
179
|
/** Maximum value constraint (for bounded types) */
|
|
367
180
|
max?: string;
|
|
368
|
-
/**
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
* ```tsx
|
|
372
|
-
* <input {...field.inputProps} value={value} onChange={handleChange} />
|
|
373
|
-
* ```
|
|
374
|
-
*/
|
|
181
|
+
/** Detected format based on label heuristics */
|
|
182
|
+
format: NumberFormat;
|
|
183
|
+
/** Pre-computed HTML input props */
|
|
375
184
|
inputProps: PrimitiveInputProps;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
type: "text";
|
|
185
|
+
defaultValue: string;
|
|
186
|
+
} : T extends "text" ? {
|
|
379
187
|
/** Minimum length constraint */
|
|
380
188
|
minLength?: number;
|
|
381
189
|
/** Maximum length constraint */
|
|
382
190
|
maxLength?: number;
|
|
383
191
|
/** Whether to render as multiline textarea */
|
|
384
192
|
multiline?: boolean;
|
|
385
|
-
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
* ```tsx
|
|
389
|
-
* <input {...field.inputProps} value={value} onChange={handleChange} />
|
|
390
|
-
* ```
|
|
391
|
-
*/
|
|
193
|
+
/** Detected format based on label heuristics */
|
|
194
|
+
format: TextFormat;
|
|
195
|
+
/** Pre-computed HTML input props */
|
|
392
196
|
inputProps: PrimitiveInputProps;
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Pre-computed HTML input props for direct spreading.
|
|
398
|
-
* @example
|
|
399
|
-
* ```tsx
|
|
400
|
-
* <input {...field.inputProps} checked={value} onChange={handleChange} />
|
|
401
|
-
* ```
|
|
402
|
-
*/
|
|
197
|
+
defaultValue: string;
|
|
198
|
+
} : T extends "boolean" ? {
|
|
199
|
+
/** Pre-computed HTML input props */
|
|
403
200
|
inputProps: PrimitiveInputProps;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
201
|
+
defaultValue: boolean;
|
|
202
|
+
} : T extends "null" ? {
|
|
203
|
+
defaultValue: null;
|
|
204
|
+
} : T extends "unknown" ? {
|
|
205
|
+
defaultValue: undefined;
|
|
206
|
+
} : {};
|
|
207
|
+
/**
|
|
208
|
+
* A unified field node that contains all metadata needed for rendering.
|
|
209
|
+
*/
|
|
210
|
+
export type FieldNode<T extends VisitorDataType = VisitorDataType> = FieldBase<T> & FieldExtras<T>;
|
|
211
|
+
export type RecordField = FieldNode<"record">;
|
|
212
|
+
export type VariantField = FieldNode<"variant">;
|
|
213
|
+
export type TupleField = FieldNode<"tuple">;
|
|
214
|
+
export type OptionalField = FieldNode<"optional">;
|
|
215
|
+
export type VectorField = FieldNode<"vector">;
|
|
216
|
+
export type BlobField = FieldNode<"blob">;
|
|
217
|
+
export type RecursiveField = FieldNode<"recursive">;
|
|
218
|
+
export type PrincipalField = FieldNode<"principal">;
|
|
219
|
+
export type NumberField = FieldNode<"number">;
|
|
220
|
+
export type TextField = FieldNode<"text">;
|
|
221
|
+
export type BooleanField = FieldNode<"boolean">;
|
|
222
|
+
export type NullField = FieldNode<"null">;
|
|
223
|
+
export type UnknownField = FieldNode<"unknown">;
|
|
412
224
|
/**
|
|
413
225
|
* Form metadata for a Candid method.
|
|
414
226
|
* Contains all information needed to create a TanStack Form instance.
|
|
415
|
-
*
|
|
416
|
-
* @example
|
|
417
|
-
* ```tsx
|
|
418
|
-
* import { useForm } from '@tanstack/react-form'
|
|
419
|
-
*
|
|
420
|
-
* function MethodForm({ meta }: { meta: FormMeta }) {
|
|
421
|
-
* const form = useForm({
|
|
422
|
-
* ...meta.formOptions,
|
|
423
|
-
* onSubmit: async ({ value }) => {
|
|
424
|
-
* await actor[meta.functionName](...value)
|
|
425
|
-
* }
|
|
426
|
-
* })
|
|
427
|
-
*
|
|
428
|
-
* return (
|
|
429
|
-
* <form onSubmit={(e) => { e.preventDefault(); form.handleSubmit() }}>
|
|
430
|
-
* {meta.fields.map(field => (
|
|
431
|
-
* <form.Field key={field.name} name={field.name}>
|
|
432
|
-
* {(fieldApi) => <DynamicInput field={field} fieldApi={fieldApi} />}
|
|
433
|
-
* </form.Field>
|
|
434
|
-
* ))}
|
|
435
|
-
* <button type="submit">Submit</button>
|
|
436
|
-
* </form>
|
|
437
|
-
* )
|
|
438
|
-
* }
|
|
439
|
-
* ```
|
|
440
227
|
*/
|
|
441
228
|
export interface ArgumentsMeta<A = BaseActor, Name extends FunctionName<A> = FunctionName<A>> {
|
|
442
229
|
/** Whether this is a "query" or "update" function */
|
|
@@ -444,7 +231,7 @@ export interface ArgumentsMeta<A = BaseActor, Name extends FunctionName<A> = Fun
|
|
|
444
231
|
/** The function name */
|
|
445
232
|
functionName: Name;
|
|
446
233
|
/** Argument field definitions for rendering */
|
|
447
|
-
fields:
|
|
234
|
+
fields: FieldNode[];
|
|
448
235
|
/** Default values for all arguments (as a tuple) */
|
|
449
236
|
defaultValues: unknown[];
|
|
450
237
|
/** Combined Zod schema for all arguments */
|
|
@@ -475,53 +262,19 @@ export type ArgumentsServiceMeta<A = BaseActor> = {
|
|
|
475
262
|
[K in FunctionName<A>]: ArgumentsMeta<A, K>;
|
|
476
263
|
};
|
|
477
264
|
/** Extract a specific field type */
|
|
478
|
-
export type FieldByType<T extends ArgumentFieldType> = Extract<
|
|
265
|
+
export type FieldByType<T extends ArgumentFieldType> = Extract<FieldNode, {
|
|
479
266
|
type: T;
|
|
480
267
|
}>;
|
|
481
268
|
/**
|
|
482
269
|
* Props type helper for field components.
|
|
483
270
|
* Use this to type your field components for better DX.
|
|
484
|
-
*
|
|
485
|
-
* @example
|
|
486
|
-
* ```tsx
|
|
487
|
-
* const VariantField: React.FC<FieldProps<'variant'>> = ({ field, renderField }) => {
|
|
488
|
-
* // field is properly typed as VariantField
|
|
489
|
-
* return (
|
|
490
|
-
* <div>
|
|
491
|
-
* <select>{field.options.map(opt => ...)}</select>
|
|
492
|
-
* {renderField?.(field.getSelectedField(currentValue))}
|
|
493
|
-
* </div>
|
|
494
|
-
* )
|
|
495
|
-
* }
|
|
496
|
-
* ```
|
|
497
271
|
*/
|
|
498
272
|
export type FieldProps<T extends ArgumentFieldType> = {
|
|
499
273
|
field: FieldByType<T>;
|
|
500
|
-
renderField?: (child:
|
|
274
|
+
renderField?: (child: FieldNode) => React.ReactNode;
|
|
501
275
|
};
|
|
502
276
|
/** Compound field types that contain other fields */
|
|
503
277
|
export type CompoundField = RecordField | VariantField | TupleField | OptionalField | VectorField | RecursiveField;
|
|
504
278
|
/** Primitive field types */
|
|
505
279
|
export type PrimitiveField = PrincipalField | NumberField | TextField | BooleanField | NullField;
|
|
506
|
-
/**
|
|
507
|
-
* A complete mapping of component types to React components.
|
|
508
|
-
* Use this type when defining your component map.
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* ```tsx
|
|
512
|
-
* const componentMap: ComponentMap<typeof MyTextInput, typeof MyNumberInput, ...> = {
|
|
513
|
-
* 'text-input': MyTextInput,
|
|
514
|
-
* 'number-input': MyNumberInput,
|
|
515
|
-
* // ...
|
|
516
|
-
* }
|
|
517
|
-
* ```
|
|
518
|
-
*/
|
|
519
|
-
export type ComponentMap<TComponents extends Record<FieldComponentType, unknown>> = {
|
|
520
|
-
[K in FieldComponentType]: TComponents[K];
|
|
521
|
-
};
|
|
522
|
-
/**
|
|
523
|
-
* Get the component type for a given field component type.
|
|
524
|
-
* Useful for typing dynamic component lookups.
|
|
525
|
-
*/
|
|
526
|
-
export type GetComponentType<TMap extends Partial<Record<FieldComponentType, unknown>>, TKey extends FieldComponentType> = TKey extends keyof TMap ? TMap[TKey] : never;
|
|
527
280
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/visitor/arguments/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/visitor/arguments/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEzE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA;AAMxC,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAM/C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,aAAa,GACb,gBAAgB,GAChB,kBAAkB,CAAA;AAMtB;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,MAAM,GACN,UAAU,CAAA;AAEd;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,UAAU,EAAE,OAAO,CAAA;IACnB,qDAAqD;IACrD,WAAW,EAAE,OAAO,CAAA;IACpB,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,mEAAmE;IACnE,WAAW,CAAC,EA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GACX,SAAS,GACT,YAAY,GACZ,SAAS,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BaseActor, FunctionName, FunctionType, ActorMethodReturnType } from "@ic-reactor/core";
|
|
2
|
-
|
|
2
|
+
import type { VisitorDataType, TextFormat, NumberFormat } from "../types";
|
|
3
|
+
export type { TextFormat, NumberFormat };
|
|
4
|
+
export type NodeType = VisitorDataType;
|
|
3
5
|
export type DisplayType = "string" | "number" | "boolean" | "null" | "object" | "array" | "variant" | "result" | "nullable" | "recursive" | "blob" | "unknown";
|
|
4
|
-
export type NumberFormat = "timestamp" | "cycle" | "value" | "token" | "normal";
|
|
5
|
-
export type TextFormat = "plain" | "timestamp" | "uuid" | "url" | "email" | "phone" | "btc" | "eth" | "account-id" | "principal";
|
|
6
6
|
/**
|
|
7
7
|
* Base properties shared by all result nodes.
|
|
8
8
|
*/
|
|
@@ -99,5 +99,4 @@ export interface ResolvedMethodResult<A = BaseActor> {
|
|
|
99
99
|
export type ServiceMeta<A = BaseActor> = {
|
|
100
100
|
[K in FunctionName<A>]: MethodMeta<A, K>;
|
|
101
101
|
};
|
|
102
|
-
export {};
|
|
103
102
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/visitor/returns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/visitor/returns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEzE,YAAY,EAAE,UAAU,E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