@surveystudio/node-registery 1.0.1 → 1.1.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 CHANGED
@@ -16,10 +16,28 @@ Use `/logic` for Worker, export, and server runtimes. It is intentionally React-
16
16
 
17
17
  Use `/runner` and `/builder` only in React runtimes. React is a peer dependency and is not bundled.
18
18
 
19
+ ## Logic Pipeline
20
+
21
+ Every node logic module should expose the same pure, Worker-safe pipeline:
22
+
23
+ ```ts
24
+ const value = logicRegistry.plainText.normalizeValue(rawAnswer, node.data, context);
25
+ const validation = logicRegistry.plainText.validate(value, node.data, context);
26
+ const columns = logicRegistry.plainText.extractValue(value, node.data, context);
27
+ ```
28
+
29
+ Runner APIs should persist and queue normalized values. Export/projection APIs should read normalized values through `extractValue`.
30
+
19
31
  ## Current Status
20
32
 
21
33
  Migrated nodes:
22
34
 
35
+ - `textInput`
36
+ - `numberInput`
37
+ - `emailInput`
38
+ - `dateInput`
39
+ - `multiInput`
40
+ - `zipCodeInput`
23
41
  - `plainText`
24
42
 
25
43
  The registry contract test intentionally fails until all planned question nodes are migrated.
@@ -1,6 +1,7 @@
1
- import { J as JsonValue } from './types-Bsz6x6iU.mjs';
2
- export { B as BuilderRegistry, h as CompleteBuilderRegistry, i as NodeBuilder, j as NodeBuilderProps, k as NodeCanvasProps, l as NodeManifest, P as PropertyField, m as PropertyFieldType, Q as QuestionNodeDefinition, S as SelectOption, n as defineBuilderRegistry, b as defineQuestionNode } from './types-Bsz6x6iU.mjs';
3
- import { P as PlainTextData } from './types-HCD7-TAw.mjs';
1
+ export { B as BuilderRegistry, C as CompleteBuilderRegistry, N as NodeBuilder, a as NodeBuilderProps, b as NodeCanvasProps, Q as QuestionNodeDefinition, d as defineBuilderRegistry, c as defineQuestionNode } from './types-CgiAR_DF.mjs';
2
+ import { J as JsonValue } from './coreTypes-YSpR0Oyh.mjs';
3
+ export { N as NodeManifest, P as PropertyField, a as PropertyFieldType, S as SelectOption } from './coreTypes-YSpR0Oyh.mjs';
4
+ import { P as PlainTextData, B as BaseTextData, M as MultiInputData, N as NumberInputData, T as TextInputData, Z as ZipCodeInputData } from './types-CjF8-OZi.mjs';
4
5
  import 'react';
5
6
 
6
7
  declare const plainTextBuilder: {
@@ -47,11 +48,275 @@ declare const plainTextManifest: {
47
48
  })[];
48
49
  };
49
50
 
51
+ declare const textInputBuilder: {
52
+ type: "textInput";
53
+ label: string;
54
+ };
55
+ declare const emailInputBuilder: {
56
+ type: "emailInput";
57
+ label: string;
58
+ };
59
+ declare const dateInputBuilder: {
60
+ type: "dateInput";
61
+ label: string;
62
+ };
63
+ declare const numberInputBuilder: {
64
+ type: "numberInput";
65
+ label: string;
66
+ };
67
+ declare const zipCodeInputBuilder: {
68
+ type: "zipCodeInput";
69
+ label: string;
70
+ };
71
+ declare const multiInputBuilder: {
72
+ type: "multiInput";
73
+ label: string;
74
+ };
75
+
76
+ declare const textInputManifest: {
77
+ type: "textInput";
78
+ label: string;
79
+ description: string;
80
+ category: "input";
81
+ dataType: "text";
82
+ defaultData: TextInputData;
83
+ properties: ({
84
+ name: string;
85
+ label: string;
86
+ type: "text";
87
+ defaultValue?: never;
88
+ } | {
89
+ name: string;
90
+ label: string;
91
+ type: "textarea";
92
+ defaultValue?: never;
93
+ } | {
94
+ name: string;
95
+ label: string;
96
+ type: "condition";
97
+ defaultValue: {
98
+ id: string;
99
+ type: "group";
100
+ logicType: "AND";
101
+ children: never[];
102
+ };
103
+ } | {
104
+ name: string;
105
+ label: string;
106
+ type: "number";
107
+ helperText: string;
108
+ defaultValue: number;
109
+ } | {
110
+ name: string;
111
+ label: string;
112
+ type: "text";
113
+ placeholder: string;
114
+ defaultValue: string;
115
+ } | {
116
+ name: string;
117
+ label: string;
118
+ type: "switch";
119
+ defaultValue: false;
120
+ placeholder?: never;
121
+ })[];
122
+ };
123
+ declare const emailInputManifest: {
124
+ type: "emailInput";
125
+ label: string;
126
+ description: string;
127
+ category: "input";
128
+ dataType: "text";
129
+ defaultData: BaseTextData;
130
+ properties: ({
131
+ name: string;
132
+ label: string;
133
+ type: "text";
134
+ defaultValue?: never;
135
+ } | {
136
+ name: string;
137
+ label: string;
138
+ type: "textarea";
139
+ defaultValue?: never;
140
+ } | {
141
+ name: string;
142
+ label: string;
143
+ type: "condition";
144
+ defaultValue: {
145
+ id: string;
146
+ type: "group";
147
+ logicType: "AND";
148
+ children: never[];
149
+ };
150
+ })[];
151
+ };
152
+ declare const dateInputManifest: {
153
+ type: "dateInput";
154
+ label: string;
155
+ description: string;
156
+ category: "input";
157
+ dataType: "text";
158
+ defaultData: BaseTextData;
159
+ properties: ({
160
+ name: string;
161
+ label: string;
162
+ type: "text";
163
+ defaultValue?: never;
164
+ } | {
165
+ name: string;
166
+ label: string;
167
+ type: "textarea";
168
+ defaultValue?: never;
169
+ } | {
170
+ name: string;
171
+ label: string;
172
+ type: "condition";
173
+ defaultValue: {
174
+ id: string;
175
+ type: "group";
176
+ logicType: "AND";
177
+ children: never[];
178
+ };
179
+ })[];
180
+ };
181
+ declare const numberInputManifest: {
182
+ type: "numberInput";
183
+ label: string;
184
+ description: string;
185
+ category: "input";
186
+ dataType: "number";
187
+ defaultData: NumberInputData;
188
+ properties: ({
189
+ name: string;
190
+ label: string;
191
+ type: "text";
192
+ defaultValue?: never;
193
+ } | {
194
+ name: string;
195
+ label: string;
196
+ type: "textarea";
197
+ defaultValue?: never;
198
+ } | {
199
+ name: string;
200
+ label: string;
201
+ type: "condition";
202
+ defaultValue: {
203
+ id: string;
204
+ type: "group";
205
+ logicType: "AND";
206
+ children: never[];
207
+ };
208
+ } | {
209
+ name: string;
210
+ label: string;
211
+ type: "number";
212
+ })[];
213
+ };
214
+ declare const zipCodeInputManifest: {
215
+ type: "zipCodeInput";
216
+ label: string;
217
+ description: string;
218
+ category: "input";
219
+ dataType: "text";
220
+ defaultData: ZipCodeInputData;
221
+ properties: ({
222
+ name: string;
223
+ label: string;
224
+ type: "text";
225
+ defaultValue?: never;
226
+ } | {
227
+ name: string;
228
+ label: string;
229
+ type: "textarea";
230
+ defaultValue?: never;
231
+ } | {
232
+ name: string;
233
+ label: string;
234
+ type: "condition";
235
+ defaultValue: {
236
+ id: string;
237
+ type: "group";
238
+ logicType: "AND";
239
+ children: never[];
240
+ };
241
+ } | {
242
+ name: string;
243
+ label: string;
244
+ type: "fileTextarea";
245
+ placeholder: string;
246
+ helperText: string;
247
+ })[];
248
+ };
249
+ declare const multiInputManifest: {
250
+ type: "multiInput";
251
+ label: string;
252
+ description: string;
253
+ category: "input";
254
+ dataType: "object";
255
+ defaultData: MultiInputData;
256
+ properties: ({
257
+ name: string;
258
+ label: string;
259
+ type: "text";
260
+ defaultValue?: never;
261
+ } | {
262
+ name: string;
263
+ label: string;
264
+ type: "textarea";
265
+ defaultValue?: never;
266
+ } | {
267
+ name: string;
268
+ label: string;
269
+ type: "condition";
270
+ defaultValue: {
271
+ id: string;
272
+ type: "group";
273
+ logicType: "AND";
274
+ children: never[];
275
+ };
276
+ } | {
277
+ name: string;
278
+ label: string;
279
+ type: "number";
280
+ helperText: string;
281
+ defaultValue: number;
282
+ } | {
283
+ name: string;
284
+ label: string;
285
+ type: "options";
286
+ defaultValue: never[];
287
+ helperText: string;
288
+ })[];
289
+ };
290
+
50
291
  declare const builderRegistry: {
292
+ readonly textInput: {
293
+ type: "textInput";
294
+ label: string;
295
+ };
296
+ readonly numberInput: {
297
+ type: "numberInput";
298
+ label: string;
299
+ };
300
+ readonly emailInput: {
301
+ type: "emailInput";
302
+ label: string;
303
+ };
304
+ readonly dateInput: {
305
+ type: "dateInput";
306
+ label: string;
307
+ };
308
+ readonly multiInput: {
309
+ type: "multiInput";
310
+ label: string;
311
+ };
312
+ readonly zipCodeInput: {
313
+ type: "zipCodeInput";
314
+ label: string;
315
+ };
51
316
  readonly plainText: {
52
317
  type: "plainText";
53
318
  label: string;
54
319
  };
55
320
  };
56
321
 
57
- export { builderRegistry, plainTextBuilder, plainTextManifest };
322
+ export { builderRegistry, dateInputBuilder, dateInputManifest, emailInputBuilder, emailInputManifest, multiInputBuilder, multiInputManifest, numberInputBuilder, numberInputManifest, plainTextBuilder, plainTextManifest, textInputBuilder, textInputManifest, zipCodeInputBuilder, zipCodeInputManifest };
package/dist/builder.mjs CHANGED
@@ -12,6 +12,14 @@ var plainTextBuilder = {
12
12
  label: "Info / Text"
13
13
  };
14
14
 
15
+ // src/nodes/textLike/builder.ts
16
+ var textInputBuilder = { type: "textInput", label: "Text Answer" };
17
+ var emailInputBuilder = { type: "emailInput", label: "Email" };
18
+ var dateInputBuilder = { type: "dateInput", label: "Date Picker" };
19
+ var numberInputBuilder = { type: "numberInput", label: "Number" };
20
+ var zipCodeInputBuilder = { type: "zipCodeInput", label: "Accepted Zip Codes" };
21
+ var multiInputBuilder = { type: "multiInput", label: "Multi-Input" };
22
+
15
23
  // src/nodes/plainText/manifest.ts
16
24
  var plainTextDefaultData = {
17
25
  label: "Info / Text",
@@ -50,14 +58,157 @@ var plainTextManifest = {
50
58
  ]
51
59
  };
52
60
 
61
+ // src/nodes/textLike/manifest.ts
62
+ var defaultCondition = {
63
+ id: "root",
64
+ type: "group",
65
+ logicType: "AND",
66
+ children: []
67
+ };
68
+ var baseTextData = {
69
+ label: "",
70
+ description: "",
71
+ condition: defaultCondition,
72
+ minChars: 0,
73
+ maxChars: 0,
74
+ minWords: 0,
75
+ maxWords: 0
76
+ };
77
+ var commonProperties = [
78
+ { name: "label", label: "Field Label", type: "text" },
79
+ { name: "description", label: "Description", type: "textarea" },
80
+ {
81
+ name: "condition",
82
+ label: "Logic Rule",
83
+ type: "condition",
84
+ defaultValue: defaultCondition
85
+ }
86
+ ];
87
+ var textLimitProperties = [
88
+ { name: "minChars", label: "Min Characters", type: "number", helperText: "Requires at least this many characters.", defaultValue: 0 },
89
+ { name: "maxChars", label: "Max Characters", type: "number", helperText: "Limits total characters. 0 or empty for no limit.", defaultValue: 0 },
90
+ { name: "minWords", label: "Min Words", type: "number", helperText: "Requires at least this many words.", defaultValue: 0 },
91
+ { name: "maxWords", label: "Max Words", type: "number", helperText: "Limits total words. 0 or empty for no limit.", defaultValue: 0 }
92
+ ];
93
+ var createBaseData = (label) => ({
94
+ ...baseTextData,
95
+ label
96
+ });
97
+ var textInputDefaultData = {
98
+ ...createBaseData("Text Answer"),
99
+ placeholder: "",
100
+ longAnswer: false
101
+ };
102
+ var emailInputDefaultData = createBaseData("Email");
103
+ var dateInputDefaultData = createBaseData("Date Picker");
104
+ var numberInputDefaultData = {
105
+ ...createBaseData("Number")
106
+ };
107
+ var zipCodeInputDefaultData = {
108
+ ...createBaseData("Accepted Zip Codes"),
109
+ allowedZips: ""
110
+ };
111
+ var multiInputDefaultData = {
112
+ ...createBaseData("Multi-Input"),
113
+ fields: []
114
+ };
115
+ var textInputManifest = {
116
+ type: "textInput",
117
+ label: "Text Answer",
118
+ description: "Capture text responses",
119
+ category: "input",
120
+ dataType: "text",
121
+ defaultData: textInputDefaultData,
122
+ properties: [
123
+ ...commonProperties,
124
+ { name: "placeholder", label: "Placeholder", type: "text", placeholder: "e.g., Type here...", defaultValue: "" },
125
+ { name: "longAnswer", label: "Long Answer (Multi-line)", type: "switch", defaultValue: false },
126
+ ...textLimitProperties
127
+ ]
128
+ };
129
+ var emailInputManifest = {
130
+ type: "emailInput",
131
+ label: "Email",
132
+ description: "Validate email addresses",
133
+ category: "input",
134
+ dataType: "text",
135
+ defaultData: emailInputDefaultData,
136
+ properties: commonProperties
137
+ };
138
+ var dateInputManifest = {
139
+ type: "dateInput",
140
+ label: "Date Picker",
141
+ description: "Select dates from a calendar",
142
+ category: "input",
143
+ dataType: "text",
144
+ defaultData: dateInputDefaultData,
145
+ properties: commonProperties
146
+ };
147
+ var numberInputManifest = {
148
+ type: "numberInput",
149
+ label: "Number",
150
+ description: "Input for numerical values",
151
+ category: "input",
152
+ dataType: "number",
153
+ defaultData: numberInputDefaultData,
154
+ properties: [
155
+ ...commonProperties,
156
+ { name: "min", label: "Minimum Value", type: "number" },
157
+ { name: "max", label: "Maximum Value", type: "number" }
158
+ ]
159
+ };
160
+ var zipCodeInputManifest = {
161
+ type: "zipCodeInput",
162
+ label: "Accepted Zip Codes",
163
+ description: "Validate against a list of zip codes",
164
+ category: "input",
165
+ dataType: "text",
166
+ defaultData: zipCodeInputDefaultData,
167
+ properties: [
168
+ ...commonProperties,
169
+ { name: "allowedZips", label: "Allowed Zip Codes", type: "fileTextarea", placeholder: "10001, 10002, 90210... (Leave empty to allow all)", helperText: "Validation: Only users entering these zip codes can proceed. Others will be blocked." }
170
+ ]
171
+ };
172
+ var multiInputManifest = {
173
+ type: "multiInput",
174
+ label: "Multi-Input",
175
+ description: "Multiple fields in one screen",
176
+ category: "input",
177
+ dataType: "object",
178
+ defaultData: multiInputDefaultData,
179
+ properties: [
180
+ ...commonProperties,
181
+ { name: "fields", label: "Input Fields", type: "options", defaultValue: [], helperText: "Value column represents input type (text, number, email)" },
182
+ ...textLimitProperties
183
+ ]
184
+ };
185
+
53
186
  // src/builder/index.ts
54
187
  var builderRegistry = defineBuilderRegistry({
188
+ textInput: textInputBuilder,
189
+ numberInput: numberInputBuilder,
190
+ emailInput: emailInputBuilder,
191
+ dateInput: dateInputBuilder,
192
+ multiInput: multiInputBuilder,
193
+ zipCodeInput: zipCodeInputBuilder,
55
194
  plainText: plainTextBuilder
56
195
  });
57
196
  export {
58
197
  builderRegistry,
198
+ dateInputBuilder,
199
+ dateInputManifest,
59
200
  defineBuilderRegistry,
60
201
  defineQuestionNode,
202
+ emailInputBuilder,
203
+ emailInputManifest,
204
+ multiInputBuilder,
205
+ multiInputManifest,
206
+ numberInputBuilder,
207
+ numberInputManifest,
61
208
  plainTextBuilder,
62
- plainTextManifest
209
+ plainTextManifest,
210
+ textInputBuilder,
211
+ textInputManifest,
212
+ zipCodeInputBuilder,
213
+ zipCodeInputManifest
63
214
  };
@@ -1,5 +1,3 @@
1
- import { ReactNode, ComponentType } from 'react';
2
-
3
1
  declare const QUESTION_NODE_TYPES: readonly ["textInput", "numberInput", "emailInput", "dateInput", "multiInput", "zipCodeInput", "singleChoice", "multipleChoice", "dropdown", "ranking", "cascadingChoice", "matrixChoice", "rating", "slider", "consent", "captcha", "image", "video", "audio", "plainText", "emojiRating"];
4
2
  declare const FLOW_NODE_TYPES: readonly ["start", "end", "branch", "validation"];
5
3
  type QuestionNodeType = (typeof QUESTION_NODE_TYPES)[number];
@@ -43,6 +41,14 @@ interface ValidationResult {
43
41
  readonly valid: boolean;
44
42
  readonly error?: string;
45
43
  }
44
+ interface NodeLogicContext<TType extends SurveyNodeType = SurveyNodeType> {
45
+ readonly nodeId: string;
46
+ readonly nodeType: TType;
47
+ readonly answerKey?: string;
48
+ }
49
+ interface ValidationContext<TType extends SurveyNodeType = SurveyNodeType> extends NodeLogicContext<TType> {
50
+ readonly mode?: "LIVE" | "TEST";
51
+ }
46
52
  interface ExtractedValue {
47
53
  readonly questionId?: string;
48
54
  readonly columnKey?: string;
@@ -56,9 +62,7 @@ interface ExtractedValue {
56
62
  readonly objectValue?: Readonly<Record<string, JsonValue>>;
57
63
  readonly metadata?: Readonly<Record<string, JsonValue>>;
58
64
  }
59
- interface ExtractionContext<TType extends SurveyNodeType = SurveyNodeType> {
60
- readonly nodeId: string;
61
- readonly nodeType: TType;
65
+ interface ExtractionContext<TType extends SurveyNodeType = SurveyNodeType> extends NodeLogicContext<TType> {
62
66
  readonly questionLabel?: string;
63
67
  }
64
68
  interface NodeLogic<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
@@ -66,60 +70,16 @@ interface NodeLogic<TType extends SurveyNodeType = SurveyNodeType, TData extends
66
70
  readonly dataType: DataType;
67
71
  readonly defaultData: Readonly<TData>;
68
72
  readonly defaultValue?: TValue;
69
- validate(value: TValue, nodeData: Readonly<TData>): ValidationResult;
73
+ normalizeValue(rawValue: unknown, nodeData: Readonly<TData>, context: NodeLogicContext<TType>): TValue;
74
+ validate(value: TValue, nodeData: Readonly<TData>, context: ValidationContext<TType>): ValidationResult;
70
75
  extractValue(value: TValue, nodeData: Readonly<TData>, context: ExtractionContext<TType>): readonly ExtractedValue[];
71
76
  }
72
- interface NodeRunnerProps<TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
73
- readonly data: Readonly<TData>;
74
- readonly value: TValue;
75
- readonly onChange: (newValue: TValue) => void;
76
- readonly onNext?: () => void;
77
- readonly error?: string;
78
- readonly isActive?: boolean;
79
- }
80
- interface NodeRunner<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
81
- readonly type: TType;
82
- readonly Component?: ComponentType<NodeRunnerProps<TData, TValue>>;
83
- }
84
- interface NodeBuilderProps<TData extends NodeData = NodeData> {
85
- readonly data: Readonly<TData>;
86
- readonly onChange: (newData: TData) => void;
87
- }
88
- interface NodeCanvasProps<TData extends NodeData = NodeData> {
89
- readonly id: string;
90
- readonly type: SurveyNodeType;
91
- readonly data: Readonly<TData>;
92
- readonly selected?: boolean;
93
- }
94
- interface NodeBuilder<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData> {
95
- readonly type: TType;
96
- readonly label: string;
97
- readonly icon?: ReactNode;
98
- readonly SettingsComponent?: ComponentType<NodeBuilderProps<TData>>;
99
- readonly CanvasComponent?: ComponentType<NodeCanvasProps<TData>>;
100
- }
101
- interface QuestionNodeDefinition<TType extends QuestionNodeType = QuestionNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
102
- readonly manifest: NodeManifest<TType, TData>;
103
- readonly logic: NodeLogic<TType, TData, TValue>;
104
- readonly builder: NodeBuilder<TType, TData>;
105
- readonly runner: NodeRunner<TType, TData, TValue>;
106
- }
107
77
  type CompleteLogicRegistry<TType extends QuestionNodeType = QuestionNodeType> = Readonly<Record<TType, NodeLogic<TType, NodeData, NodeValue>>>;
108
- type CompleteBuilderRegistry<TType extends QuestionNodeType = QuestionNodeType> = Readonly<Record<TType, NodeBuilder<TType, NodeData>>>;
109
- type CompleteRunnerRegistry<TType extends QuestionNodeType = QuestionNodeType> = Readonly<Record<TType, NodeRunner<TType, NodeData, NodeValue>>>;
110
78
  type LogicRegistry<TType extends SurveyNodeType = SurveyNodeType> = Readonly<Partial<{
111
79
  [K in TType]: NodeLogic<K, NodeData, NodeValue>;
112
80
  }>>;
113
- type BuilderRegistry<TType extends SurveyNodeType = SurveyNodeType> = Readonly<Partial<{
114
- [K in TType]: NodeBuilder<K, NodeData>;
115
- }>>;
116
- type RunnerRegistry<TType extends SurveyNodeType = SurveyNodeType> = Readonly<Partial<{
117
- [K in TType]: NodeRunner<K, NodeData, NodeValue>;
118
- }>>;
119
- declare function defineQuestionNode<const TType extends QuestionNodeType, TData extends NodeData, TValue extends NodeValue>(definition: QuestionNodeDefinition<TType, TData, TValue>): QuestionNodeDefinition<TType, TData, TValue>;
120
81
  type RegistryKeySet = Readonly<Partial<Record<SurveyNodeType, unknown>>>;
121
82
  declare function defineLogicRegistry<const TRegistry extends RegistryKeySet>(registry: TRegistry): TRegistry;
122
- declare function defineBuilderRegistry<const TRegistry extends RegistryKeySet>(registry: TRegistry): TRegistry;
123
- declare function defineRunnerRegistry<const TRegistry extends RegistryKeySet>(registry: TRegistry): TRegistry;
83
+ declare function createInitialData<TData extends NodeData>(manifest: NodeManifest<SurveyNodeType, TData>): TData;
124
84
 
125
- export { type BuilderRegistry as B, type CompleteLogicRegistry as C, type DataType as D, type ExtractedValue as E, type JsonValue as J, type LogicRegistry as L, type NodeLogic as N, type PropertyField as P, type QuestionNodeDefinition as Q, type RunnerRegistry as R, type SelectOption as S, type ValidationResult as V, type ExtractionContext as a, defineQuestionNode as b, type CompleteRunnerRegistry as c, defineLogicRegistry as d, type NodeRunner as e, type NodeRunnerProps as f, defineRunnerRegistry as g, type CompleteBuilderRegistry as h, type NodeBuilder as i, type NodeBuilderProps as j, type NodeCanvasProps as k, type NodeManifest as l, type PropertyFieldType as m, defineBuilderRegistry as n, type NodeData as o };
85
+ export { type CompleteLogicRegistry as C, type DataType as D, type ExtractedValue as E, type JsonValue as J, type LogicRegistry as L, type NodeManifest as N, type PropertyField as P, type QuestionNodeType as Q, type SelectOption as S, type ValidationContext as V, type PropertyFieldType as a, type NodeLogic as b, type ExtractionContext as c, type NodeLogicContext as d, type ValidationResult as e, createInitialData as f, defineLogicRegistry as g, type NodeData as h, type SurveyNodeType as i, type NodeValue as j };
package/dist/logic.d.mts CHANGED
@@ -1,41 +1,24 @@
1
- import { P as PlainTextData, a as PlainTextValue } from './types-HCD7-TAw.mjs';
2
- export { C as CompleteLogicRegistry, D as DataType, E as ExtractedValue, a as ExtractionContext, L as LogicRegistry, N as NodeLogic, Q as QuestionNodeDefinition, V as ValidationResult, d as defineLogicRegistry, b as defineQuestionNode } from './types-Bsz6x6iU.mjs';
3
- import 'react';
1
+ import { P as PlainTextData, a as PlainTextValue, D as DateInputData, b as TextValue, E as EmailInputData, M as MultiInputData, c as MultiInputValue, N as NumberInputData, T as TextInputData, Z as ZipCodeInputData, B as BaseTextData } from './types-CjF8-OZi.mjs';
2
+ import { b as NodeLogic } from './coreTypes-YSpR0Oyh.mjs';
3
+ export { C as CompleteLogicRegistry, D as DataType, E as ExtractedValue, c as ExtractionContext, L as LogicRegistry, d as NodeLogicContext, V as ValidationContext, e as ValidationResult, f as createInitialData, g as defineLogicRegistry } from './coreTypes-YSpR0Oyh.mjs';
4
4
 
5
- declare const plainTextLogic: {
6
- type: "plainText";
7
- dataType: "none";
8
- defaultData: PlainTextData;
9
- defaultValue: {
10
- viewed: false;
11
- };
12
- validate: () => {
13
- valid: true;
14
- };
15
- extractValue: (value: PlainTextValue) => {
16
- columnKey: string;
17
- columnLabel: string;
18
- booleanValue: boolean;
19
- }[];
20
- };
5
+ declare const plainTextLogic: NodeLogic<"plainText", PlainTextData, PlainTextValue>;
6
+
7
+ declare const textInputLogic: NodeLogic<"textInput", TextInputData, TextValue>;
8
+ declare const emailInputLogic: NodeLogic<"emailInput", EmailInputData, TextValue>;
9
+ declare const dateInputLogic: NodeLogic<"dateInput", DateInputData, TextValue>;
10
+ declare const numberInputLogic: NodeLogic<"numberInput", NumberInputData, TextValue>;
11
+ declare const zipCodeInputLogic: NodeLogic<"zipCodeInput", ZipCodeInputData, TextValue>;
12
+ declare const multiInputLogic: NodeLogic<"multiInput", MultiInputData, MultiInputValue>;
21
13
 
22
14
  declare const logicRegistry: {
23
- readonly plainText: {
24
- type: "plainText";
25
- dataType: "none";
26
- defaultData: PlainTextData;
27
- defaultValue: {
28
- viewed: false;
29
- };
30
- validate: () => {
31
- valid: true;
32
- };
33
- extractValue: (value: PlainTextValue) => {
34
- columnKey: string;
35
- columnLabel: string;
36
- booleanValue: boolean;
37
- }[];
38
- };
15
+ readonly textInput: NodeLogic<"textInput", TextInputData, string>;
16
+ readonly numberInput: NodeLogic<"numberInput", NumberInputData, string>;
17
+ readonly emailInput: NodeLogic<"emailInput", BaseTextData, string>;
18
+ readonly dateInput: NodeLogic<"dateInput", BaseTextData, string>;
19
+ readonly multiInput: NodeLogic<"multiInput", MultiInputData, MultiInputValue>;
20
+ readonly zipCodeInput: NodeLogic<"zipCodeInput", ZipCodeInputData, string>;
21
+ readonly plainText: NodeLogic<"plainText", PlainTextData, PlainTextValue>;
39
22
  };
40
23
 
41
- export { logicRegistry, plainTextLogic };
24
+ export { NodeLogic, dateInputLogic, emailInputLogic, logicRegistry, multiInputLogic, numberInputLogic, plainTextLogic, textInputLogic, zipCodeInputLogic };
package/dist/logic.mjs CHANGED
@@ -1,10 +1,10 @@
1
- // src/types.ts
2
- function defineQuestionNode(definition) {
3
- return definition;
4
- }
1
+ // src/coreTypes.ts
5
2
  function defineLogicRegistry(registry) {
6
3
  return registry;
7
4
  }
5
+ function createInitialData(manifest) {
6
+ return { ...manifest.defaultData };
7
+ }
8
8
 
9
9
  // src/nodes/plainText/manifest.ts
10
10
  var plainTextDefaultData = {
@@ -45,28 +45,309 @@ var plainTextManifest = {
45
45
  };
46
46
 
47
47
  // src/nodes/plainText/logic.ts
48
+ var normalizePlainTextValue = (value) => {
49
+ if (!value || typeof value !== "object") {
50
+ return { viewed: false };
51
+ }
52
+ return { viewed: Boolean(value.viewed) };
53
+ };
48
54
  var plainTextLogic = {
49
55
  type: "plainText",
50
56
  dataType: "none",
51
57
  defaultData: plainTextDefaultData,
52
58
  defaultValue: { viewed: false },
59
+ normalizeValue: (value) => normalizePlainTextValue(value),
53
60
  validate: () => ({ valid: true }),
54
61
  extractValue: (value) => [
55
62
  {
56
63
  columnKey: "viewed",
57
64
  columnLabel: "Viewed",
58
- booleanValue: Boolean(value?.viewed)
65
+ booleanValue: Boolean(value.viewed)
66
+ }
67
+ ]
68
+ };
69
+
70
+ // src/nodes/textLike/manifest.ts
71
+ var defaultCondition = {
72
+ id: "root",
73
+ type: "group",
74
+ logicType: "AND",
75
+ children: []
76
+ };
77
+ var baseTextData = {
78
+ label: "",
79
+ description: "",
80
+ condition: defaultCondition,
81
+ minChars: 0,
82
+ maxChars: 0,
83
+ minWords: 0,
84
+ maxWords: 0
85
+ };
86
+ var commonProperties = [
87
+ { name: "label", label: "Field Label", type: "text" },
88
+ { name: "description", label: "Description", type: "textarea" },
89
+ {
90
+ name: "condition",
91
+ label: "Logic Rule",
92
+ type: "condition",
93
+ defaultValue: defaultCondition
94
+ }
95
+ ];
96
+ var textLimitProperties = [
97
+ { name: "minChars", label: "Min Characters", type: "number", helperText: "Requires at least this many characters.", defaultValue: 0 },
98
+ { name: "maxChars", label: "Max Characters", type: "number", helperText: "Limits total characters. 0 or empty for no limit.", defaultValue: 0 },
99
+ { name: "minWords", label: "Min Words", type: "number", helperText: "Requires at least this many words.", defaultValue: 0 },
100
+ { name: "maxWords", label: "Max Words", type: "number", helperText: "Limits total words. 0 or empty for no limit.", defaultValue: 0 }
101
+ ];
102
+ var createBaseData = (label) => ({
103
+ ...baseTextData,
104
+ label
105
+ });
106
+ var textInputDefaultData = {
107
+ ...createBaseData("Text Answer"),
108
+ placeholder: "",
109
+ longAnswer: false
110
+ };
111
+ var emailInputDefaultData = createBaseData("Email");
112
+ var dateInputDefaultData = createBaseData("Date Picker");
113
+ var numberInputDefaultData = {
114
+ ...createBaseData("Number")
115
+ };
116
+ var zipCodeInputDefaultData = {
117
+ ...createBaseData("Accepted Zip Codes"),
118
+ allowedZips: ""
119
+ };
120
+ var multiInputDefaultData = {
121
+ ...createBaseData("Multi-Input"),
122
+ fields: []
123
+ };
124
+ var textInputManifest = {
125
+ type: "textInput",
126
+ label: "Text Answer",
127
+ description: "Capture text responses",
128
+ category: "input",
129
+ dataType: "text",
130
+ defaultData: textInputDefaultData,
131
+ properties: [
132
+ ...commonProperties,
133
+ { name: "placeholder", label: "Placeholder", type: "text", placeholder: "e.g., Type here...", defaultValue: "" },
134
+ { name: "longAnswer", label: "Long Answer (Multi-line)", type: "switch", defaultValue: false },
135
+ ...textLimitProperties
136
+ ]
137
+ };
138
+ var numberInputManifest = {
139
+ type: "numberInput",
140
+ label: "Number",
141
+ description: "Input for numerical values",
142
+ category: "input",
143
+ dataType: "number",
144
+ defaultData: numberInputDefaultData,
145
+ properties: [
146
+ ...commonProperties,
147
+ { name: "min", label: "Minimum Value", type: "number" },
148
+ { name: "max", label: "Maximum Value", type: "number" }
149
+ ]
150
+ };
151
+ var zipCodeInputManifest = {
152
+ type: "zipCodeInput",
153
+ label: "Accepted Zip Codes",
154
+ description: "Validate against a list of zip codes",
155
+ category: "input",
156
+ dataType: "text",
157
+ defaultData: zipCodeInputDefaultData,
158
+ properties: [
159
+ ...commonProperties,
160
+ { name: "allowedZips", label: "Allowed Zip Codes", type: "fileTextarea", placeholder: "10001, 10002, 90210... (Leave empty to allow all)", helperText: "Validation: Only users entering these zip codes can proceed. Others will be blocked." }
161
+ ]
162
+ };
163
+ var multiInputManifest = {
164
+ type: "multiInput",
165
+ label: "Multi-Input",
166
+ description: "Multiple fields in one screen",
167
+ category: "input",
168
+ dataType: "object",
169
+ defaultData: multiInputDefaultData,
170
+ properties: [
171
+ ...commonProperties,
172
+ { name: "fields", label: "Input Fields", type: "options", defaultValue: [], helperText: "Value column represents input type (text, number, email)" },
173
+ ...textLimitProperties
174
+ ]
175
+ };
176
+
177
+ // src/nodes/textLike/logic.ts
178
+ var normalizeTextValue = (value) => {
179
+ if (typeof value === "string") return value;
180
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
181
+ return "";
182
+ };
183
+ var normalizeMultiInputValue = (value) => {
184
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
185
+ return Object.fromEntries(
186
+ Object.entries(value).map(([key, item]) => [key, normalizeTextValue(item)])
187
+ );
188
+ };
189
+ var numberLimit = (value) => {
190
+ const parsed = Number(value);
191
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
192
+ };
193
+ var countWords = (value) => value.trim().split(/\s+/).filter(Boolean).length;
194
+ var validateTextLimits = (value, nodeData) => {
195
+ const minChars = numberLimit(nodeData.minChars);
196
+ const maxChars = numberLimit(nodeData.maxChars);
197
+ const minWords = numberLimit(nodeData.minWords);
198
+ const maxWords = numberLimit(nodeData.maxWords);
199
+ if (minChars && value.length < minChars) {
200
+ return { valid: false, error: `Minimum character requirement not met (${value.length}/${minChars})` };
201
+ }
202
+ if (maxChars && value.length > maxChars) {
203
+ return { valid: false, error: `Character limit exceeded (${value.length}/${maxChars})` };
204
+ }
205
+ const wordCount = countWords(value);
206
+ if (minWords && wordCount < minWords) {
207
+ return { valid: false, error: `Minimum word requirement not met (${wordCount}/${minWords})` };
208
+ }
209
+ if (maxWords && wordCount > maxWords) {
210
+ return { valid: false, error: `Word limit exceeded (${wordCount}/${maxWords})` };
211
+ }
212
+ return { valid: true };
213
+ };
214
+ var extractTextValue = (value) => [
215
+ {
216
+ columnKey: "value",
217
+ columnLabel: "Value",
218
+ textValue: value
219
+ }
220
+ ];
221
+ var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
222
+ var textInputLogic = {
223
+ type: "textInput",
224
+ dataType: "text",
225
+ defaultData: textInputDefaultData,
226
+ defaultValue: "",
227
+ normalizeValue: normalizeTextValue,
228
+ validate: validateTextLimits,
229
+ extractValue: extractTextValue
230
+ };
231
+ var emailInputLogic = {
232
+ type: "emailInput",
233
+ dataType: "text",
234
+ defaultData: emailInputDefaultData,
235
+ defaultValue: "",
236
+ normalizeValue: normalizeTextValue,
237
+ validate: (value, nodeData) => {
238
+ const limitResult = validateTextLimits(value, nodeData);
239
+ if (!limitResult.valid) return limitResult;
240
+ if (value.trim() && !emailRegex.test(value)) return { valid: false, error: "Please enter a valid email address" };
241
+ return { valid: true };
242
+ },
243
+ extractValue: extractTextValue
244
+ };
245
+ var dateInputLogic = {
246
+ type: "dateInput",
247
+ dataType: "text",
248
+ defaultData: dateInputDefaultData,
249
+ defaultValue: "",
250
+ normalizeValue: normalizeTextValue,
251
+ validate: validateTextLimits,
252
+ extractValue: extractTextValue
253
+ };
254
+ var numberInputLogic = {
255
+ type: "numberInput",
256
+ dataType: "number",
257
+ defaultData: numberInputDefaultData,
258
+ defaultValue: "",
259
+ normalizeValue: normalizeTextValue,
260
+ validate: (value, nodeData) => {
261
+ const limitResult = validateTextLimits(value, nodeData);
262
+ if (!limitResult.valid) return limitResult;
263
+ if (!value.trim()) return { valid: true };
264
+ const numberValue = Number(value);
265
+ if (Number.isNaN(numberValue)) return { valid: false, error: "Please enter a valid number" };
266
+ if (typeof nodeData.min === "number" && numberValue < nodeData.min) {
267
+ return { valid: false, error: `Minimum value is ${nodeData.min}` };
268
+ }
269
+ if (typeof nodeData.max === "number" && numberValue > nodeData.max) {
270
+ return { valid: false, error: `Maximum value is ${nodeData.max}` };
271
+ }
272
+ return { valid: true };
273
+ },
274
+ extractValue: (value) => [
275
+ value.trim() ? {
276
+ columnKey: "value",
277
+ columnLabel: "Value",
278
+ textValue: value,
279
+ numberValue: Number(value)
280
+ } : {
281
+ columnKey: "value",
282
+ columnLabel: "Value",
283
+ textValue: value
59
284
  }
60
285
  ]
61
286
  };
287
+ var parseZipList = (value) => value.split(/[\s,]+/).map((item) => item.trim()).filter(Boolean);
288
+ var zipCodeInputLogic = {
289
+ type: "zipCodeInput",
290
+ dataType: "text",
291
+ defaultData: zipCodeInputDefaultData,
292
+ defaultValue: "",
293
+ normalizeValue: normalizeTextValue,
294
+ validate: (value, nodeData) => {
295
+ const limitResult = validateTextLimits(value, nodeData);
296
+ if (!limitResult.valid) return limitResult;
297
+ const allowedZips = parseZipList(String(nodeData.allowedZips || ""));
298
+ if (allowedZips.length > 0 && value.trim() && !allowedZips.includes(value.trim())) {
299
+ return { valid: false, error: "Zip code is not accepted" };
300
+ }
301
+ return { valid: true };
302
+ },
303
+ extractValue: extractTextValue
304
+ };
305
+ var multiInputLogic = {
306
+ type: "multiInput",
307
+ dataType: "object",
308
+ defaultData: multiInputDefaultData,
309
+ defaultValue: {},
310
+ normalizeValue: normalizeMultiInputValue,
311
+ validate: (value, nodeData) => {
312
+ for (const [fieldId, fieldValue] of Object.entries(value)) {
313
+ const limitResult = validateTextLimits(fieldValue, nodeData);
314
+ if (!limitResult.valid) return { valid: false, error: `${fieldId}: ${limitResult.error}` };
315
+ }
316
+ return { valid: true };
317
+ },
318
+ extractValue: (value, nodeData) => {
319
+ const fields = Array.isArray(nodeData.fields) ? nodeData.fields : [];
320
+ return Object.entries(value).map(([fieldId, fieldValue]) => {
321
+ const field = fields.find((item) => item.id === fieldId);
322
+ const label = field?.label || fieldId;
323
+ return {
324
+ columnKey: fieldId,
325
+ columnLabel: label,
326
+ textValue: fieldValue
327
+ };
328
+ });
329
+ }
330
+ };
62
331
 
63
332
  // src/logic/index.ts
64
333
  var logicRegistry = defineLogicRegistry({
334
+ textInput: textInputLogic,
335
+ numberInput: numberInputLogic,
336
+ emailInput: emailInputLogic,
337
+ dateInput: dateInputLogic,
338
+ multiInput: multiInputLogic,
339
+ zipCodeInput: zipCodeInputLogic,
65
340
  plainText: plainTextLogic
66
341
  });
67
342
  export {
343
+ createInitialData,
344
+ dateInputLogic,
68
345
  defineLogicRegistry,
69
- defineQuestionNode,
346
+ emailInputLogic,
70
347
  logicRegistry,
71
- plainTextLogic
348
+ multiInputLogic,
349
+ numberInputLogic,
350
+ plainTextLogic,
351
+ textInputLogic,
352
+ zipCodeInputLogic
72
353
  };
package/dist/runner.d.mts CHANGED
@@ -1,14 +1,52 @@
1
- export { c as CompleteRunnerRegistry, e as NodeRunner, f as NodeRunnerProps, Q as QuestionNodeDefinition, R as RunnerRegistry, b as defineQuestionNode, g as defineRunnerRegistry } from './types-Bsz6x6iU.mjs';
1
+ export { e as CompleteRunnerRegistry, f as NodeRunner, g as NodeRunnerProps, Q as QuestionNodeDefinition, R as RunnerRegistry, c as defineQuestionNode, h as defineRunnerRegistry } from './types-CgiAR_DF.mjs';
2
2
  import 'react';
3
+ import './coreTypes-YSpR0Oyh.mjs';
3
4
 
4
5
  declare const plainTextRunner: {
5
6
  type: "plainText";
6
7
  };
7
8
 
9
+ declare const textInputRunner: {
10
+ type: "textInput";
11
+ };
12
+ declare const emailInputRunner: {
13
+ type: "emailInput";
14
+ };
15
+ declare const dateInputRunner: {
16
+ type: "dateInput";
17
+ };
18
+ declare const numberInputRunner: {
19
+ type: "numberInput";
20
+ };
21
+ declare const zipCodeInputRunner: {
22
+ type: "zipCodeInput";
23
+ };
24
+ declare const multiInputRunner: {
25
+ type: "multiInput";
26
+ };
27
+
8
28
  declare const runnerRegistry: {
29
+ readonly textInput: {
30
+ type: "textInput";
31
+ };
32
+ readonly numberInput: {
33
+ type: "numberInput";
34
+ };
35
+ readonly emailInput: {
36
+ type: "emailInput";
37
+ };
38
+ readonly dateInput: {
39
+ type: "dateInput";
40
+ };
41
+ readonly multiInput: {
42
+ type: "multiInput";
43
+ };
44
+ readonly zipCodeInput: {
45
+ type: "zipCodeInput";
46
+ };
9
47
  readonly plainText: {
10
48
  type: "plainText";
11
49
  };
12
50
  };
13
51
 
14
- export { plainTextRunner, runnerRegistry };
52
+ export { dateInputRunner, emailInputRunner, multiInputRunner, numberInputRunner, plainTextRunner, runnerRegistry, textInputRunner, zipCodeInputRunner };
package/dist/runner.mjs CHANGED
@@ -11,13 +11,33 @@ var plainTextRunner = {
11
11
  type: "plainText"
12
12
  };
13
13
 
14
+ // src/nodes/textLike/runner.ts
15
+ var textInputRunner = { type: "textInput" };
16
+ var emailInputRunner = { type: "emailInput" };
17
+ var dateInputRunner = { type: "dateInput" };
18
+ var numberInputRunner = { type: "numberInput" };
19
+ var zipCodeInputRunner = { type: "zipCodeInput" };
20
+ var multiInputRunner = { type: "multiInput" };
21
+
14
22
  // src/runner/index.ts
15
23
  var runnerRegistry = defineRunnerRegistry({
24
+ textInput: textInputRunner,
25
+ numberInput: numberInputRunner,
26
+ emailInput: emailInputRunner,
27
+ dateInput: dateInputRunner,
28
+ multiInput: multiInputRunner,
29
+ zipCodeInput: zipCodeInputRunner,
16
30
  plainText: plainTextRunner
17
31
  });
18
32
  export {
33
+ dateInputRunner,
19
34
  defineQuestionNode,
20
35
  defineRunnerRegistry,
36
+ emailInputRunner,
37
+ multiInputRunner,
38
+ numberInputRunner,
21
39
  plainTextRunner,
22
- runnerRegistry
40
+ runnerRegistry,
41
+ textInputRunner,
42
+ zipCodeInputRunner
23
43
  };
@@ -0,0 +1,51 @@
1
+ import { ReactNode, ComponentType } from 'react';
2
+ import { i as SurveyNodeType, h as NodeData, Q as QuestionNodeType, j as NodeValue, N as NodeManifest, b as NodeLogic } from './coreTypes-YSpR0Oyh.mjs';
3
+
4
+ interface NodeRunnerProps<TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
5
+ readonly data: Readonly<TData>;
6
+ readonly value: TValue;
7
+ readonly onChange: (newValue: TValue) => void;
8
+ readonly onNext?: () => void;
9
+ readonly error?: string;
10
+ readonly isActive?: boolean;
11
+ }
12
+ interface NodeRunner<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
13
+ readonly type: TType;
14
+ readonly Component?: ComponentType<NodeRunnerProps<TData, TValue>>;
15
+ }
16
+ interface NodeBuilderProps<TData extends NodeData = NodeData> {
17
+ readonly data: Readonly<TData>;
18
+ readonly onChange: (newData: TData) => void;
19
+ }
20
+ interface NodeCanvasProps<TData extends NodeData = NodeData> {
21
+ readonly id: string;
22
+ readonly type: SurveyNodeType;
23
+ readonly data: Readonly<TData>;
24
+ readonly selected?: boolean;
25
+ }
26
+ interface NodeBuilder<TType extends SurveyNodeType = SurveyNodeType, TData extends NodeData = NodeData> {
27
+ readonly type: TType;
28
+ readonly label: string;
29
+ readonly icon?: ReactNode;
30
+ readonly SettingsComponent?: ComponentType<NodeBuilderProps<TData>>;
31
+ readonly CanvasComponent?: ComponentType<NodeCanvasProps<TData>>;
32
+ }
33
+ interface QuestionNodeDefinition<TType extends QuestionNodeType = QuestionNodeType, TData extends NodeData = NodeData, TValue extends NodeValue = NodeValue> {
34
+ readonly manifest: NodeManifest<TType, TData>;
35
+ readonly logic: NodeLogic<TType, TData, TValue>;
36
+ readonly builder: NodeBuilder<TType, TData>;
37
+ readonly runner: NodeRunner<TType, TData, TValue>;
38
+ }
39
+ type CompleteBuilderRegistry<TType extends QuestionNodeType = QuestionNodeType> = Readonly<Record<TType, NodeBuilder<TType, NodeData>>>;
40
+ type CompleteRunnerRegistry<TType extends QuestionNodeType = QuestionNodeType> = Readonly<Record<TType, NodeRunner<TType, NodeData, NodeValue>>>;
41
+ type BuilderRegistry<TType extends SurveyNodeType = SurveyNodeType> = Readonly<Partial<{
42
+ [K in TType]: NodeBuilder<K, NodeData>;
43
+ }>>;
44
+ type RunnerRegistry<TType extends SurveyNodeType = SurveyNodeType> = Readonly<Partial<{
45
+ [K in TType]: NodeRunner<K, NodeData, NodeValue>;
46
+ }>>;
47
+ declare function defineQuestionNode<const TType extends QuestionNodeType, TData extends NodeData, TValue extends NodeValue>(definition: QuestionNodeDefinition<TType, TData, TValue>): QuestionNodeDefinition<TType, TData, TValue>;
48
+ declare function defineBuilderRegistry<const TRegistry extends Readonly<Partial<Record<SurveyNodeType, unknown>>>>(registry: TRegistry): TRegistry;
49
+ declare function defineRunnerRegistry<const TRegistry extends Readonly<Partial<Record<SurveyNodeType, unknown>>>>(registry: TRegistry): TRegistry;
50
+
51
+ export { type BuilderRegistry as B, type CompleteBuilderRegistry as C, type NodeBuilder as N, type QuestionNodeDefinition as Q, type RunnerRegistry as R, type NodeBuilderProps as a, type NodeCanvasProps as b, defineQuestionNode as c, defineBuilderRegistry as d, type CompleteRunnerRegistry as e, type NodeRunner as f, type NodeRunnerProps as g, defineRunnerRegistry as h };
@@ -0,0 +1,59 @@
1
+ import { h as NodeData, J as JsonValue } from './coreTypes-YSpR0Oyh.mjs';
2
+
3
+ type PlainTextData = NodeData & {
4
+ label: string;
5
+ description: string;
6
+ buttonLabel: string;
7
+ condition: {
8
+ id: string;
9
+ type: "group";
10
+ logicType: "AND" | "OR";
11
+ children: JsonValue[];
12
+ };
13
+ };
14
+ type PlainTextValue = {
15
+ viewed: boolean;
16
+ };
17
+
18
+ type ConditionData = {
19
+ id: string;
20
+ type: "group";
21
+ logicType: "AND" | "OR";
22
+ children: JsonValue[];
23
+ };
24
+ type TextLimitData = NodeData & {
25
+ minChars?: number;
26
+ maxChars?: number;
27
+ minWords?: number;
28
+ maxWords?: number;
29
+ };
30
+ type BaseTextData = TextLimitData & {
31
+ label: string;
32
+ description: string;
33
+ condition: ConditionData;
34
+ };
35
+ type TextInputData = BaseTextData & {
36
+ placeholder: string;
37
+ longAnswer: boolean;
38
+ };
39
+ type EmailInputData = BaseTextData;
40
+ type DateInputData = BaseTextData;
41
+ type NumberInputData = BaseTextData & {
42
+ min?: number;
43
+ max?: number;
44
+ };
45
+ type ZipCodeInputData = BaseTextData & {
46
+ allowedZips: string;
47
+ };
48
+ type MultiInputField = {
49
+ id: string;
50
+ label?: string;
51
+ value?: string;
52
+ };
53
+ type MultiInputData = BaseTextData & {
54
+ fields: MultiInputField[];
55
+ };
56
+ type TextValue = string;
57
+ type MultiInputValue = Record<string, string>;
58
+
59
+ export type { BaseTextData as B, DateInputData as D, EmailInputData as E, MultiInputData as M, NumberInputData as N, PlainTextData as P, TextInputData as T, ZipCodeInputData as Z, PlainTextValue as a, TextValue as b, MultiInputValue as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surveystudio/node-registery",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Typed survey question node registry with split builder, runner, and logic entrypoints.",
5
5
  "main": "./dist/logic.mjs",
6
6
  "types": "./dist/logic.d.mts",
@@ -46,7 +46,7 @@
46
46
  "react-dom": "^19.2.3"
47
47
  },
48
48
  "scripts": {
49
- "test": "node --test test/*.test.mjs",
49
+ "test": "pnpm build && node --test test/*.test.mjs",
50
50
  "typecheck": "tsc --noEmit",
51
51
  "build": "tsup",
52
52
  "prepack": "pnpm build",
@@ -1,18 +0,0 @@
1
- import { o as NodeData, J as JsonValue } from './types-Bsz6x6iU.mjs';
2
-
3
- type PlainTextData = NodeData & {
4
- label: string;
5
- description: string;
6
- buttonLabel: string;
7
- condition: {
8
- id: string;
9
- type: "group";
10
- logicType: "AND" | "OR";
11
- children: JsonValue[];
12
- };
13
- };
14
- type PlainTextValue = {
15
- viewed: boolean;
16
- };
17
-
18
- export type { PlainTextData as P, PlainTextValue as a };