@process.co/ui 0.0.9 → 0.0.11

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.
@@ -149,6 +149,140 @@ interface SelectRenderProps {
149
149
  */
150
150
  declare function Select({ fieldName, label, value, onChange, options: rawOptions, disabled, placeholder, expectedType, required, hasRequiredError, className, children, }: SelectProps): React.JSX.Element;
151
151
 
152
+ /**
153
+ * Shared Operator Type Definitions and Utilities
154
+ *
155
+ * This module provides reusable types and utilities for building
156
+ * query builders with type-aware operators (Switch, IfThenElse, etc.)
157
+ */
158
+ /**
159
+ * Standard operator types for condition builders.
160
+ * Custom UIs can extend this with their own operators.
161
+ */
162
+ type BaseOperatorType = 'exists' | 'not_exists' | 'string_equals' | 'string_not_equals' | 'string_is_blank' | 'string_is_not_blank' | 'string_starts_with' | 'string_contains' | 'string_not_contains' | 'string_ends_with' | 'number_equals' | 'number_not_equals' | 'number_gt' | 'number_gte' | 'number_lt' | 'number_lte' | 'boolean_equals' | 'is_null' | 'is_not_null' | 'is_string' | 'is_not_string' | 'is_number' | 'is_not_number' | 'is_true' | 'is_false' | 'is_boolean' | 'is_not_boolean';
163
+ /**
164
+ * Generic operator definition that can be extended with custom operators.
165
+ *
166
+ * @template T - Additional operator types to include (defaults to never)
167
+ *
168
+ * @example
169
+ * // Using base operators only
170
+ * const operators: OperatorDef[] = [...];
171
+ *
172
+ * // Extending with custom operators
173
+ * type MyOperator = 'expression' | 'custom_op';
174
+ * const operators: OperatorDef<MyOperator>[] = [...];
175
+ */
176
+ type OperatorDef<T = never> = {
177
+ /** The operator value/key */
178
+ value: BaseOperatorType | T;
179
+ /** Which inferred types this applies to ('any' = always shown) */
180
+ types: string[];
181
+ /** Human-readable label for the operator */
182
+ label: string;
183
+ /** Short label for compact display (optional) */
184
+ shortLabel?: string;
185
+ /** Whether to show the value Input */
186
+ needsValue: boolean;
187
+ /** Type to register for narrowing ('never' = no narrowing) */
188
+ narrowsTo: string;
189
+ /** If true, union narrowed type with base type (e.g., narrowed | string) */
190
+ extendsWithBase?: boolean;
191
+ };
192
+ /**
193
+ * Result of parsing an inferred type string.
194
+ */
195
+ type ParsedTypes = {
196
+ /** Deduplicated base types (string, number, boolean, any, etc.) */
197
+ baseTypes: string[];
198
+ /** Extracted string literal constants */
199
+ stringConstants: string[];
200
+ /** Extracted number literal constants */
201
+ numberConstants: number[];
202
+ /** Whether any literal constants were found */
203
+ hasConstants: boolean;
204
+ /** Original type strings for union building */
205
+ rawTypes: string[];
206
+ };
207
+ /**
208
+ * Parse an inferred type string into base types and extract any literal constants.
209
+ *
210
+ * Handles:
211
+ * - Base types: string, number, boolean
212
+ * - Union types: string | number
213
+ * - String literals: "Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" -> treated as string type
214
+ * - Number literals: 1 | 2 | 3 -> treated as number type
215
+ * - Boolean literals: true | false -> treated as boolean type
216
+ *
217
+ * @param typeStr - The inferred type string to parse
218
+ * @returns Parsed type information
219
+ *
220
+ * @example
221
+ * parseInferredTypes('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string')
222
+ * // Returns:
223
+ * // {
224
+ * // baseTypes: ['string'],
225
+ * // stringConstants: ['Hans', 'Karl', 'Eddie', 'Theo', 'Fritz'],
226
+ * // numberConstants: [],
227
+ * // hasConstants: true,
228
+ * // rawTypes: ['"Hans"', '"Karl"', '"Eddie"', '"Theo"', '"Fritz"', 'string']
229
+ * // }
230
+ */
231
+ declare function parseInferredTypes(typeStr: string): ParsedTypes;
232
+ /**
233
+ * Compute the expected type for a value input based on the operator.
234
+ *
235
+ * If `extendsWithBase` is true, the result includes both:
236
+ * - The matching literal types from the inferred type
237
+ * - The base type (to allow arbitrary input)
238
+ *
239
+ * This enables scenarios like:
240
+ * - `string_equals` on `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` → expects `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` (exact match)
241
+ * - `string_starts_with` on `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` → expects `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` (allows partial match)
242
+ *
243
+ * @param inferredType - The inferred type string from the statement
244
+ * @param opDef - The operator definition
245
+ * @returns The computed expected type string
246
+ *
247
+ * @example
248
+ * const opDef = { narrowsTo: 'string', extendsWithBase: true, ... };
249
+ * computeExtendedType('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string', opDef);
250
+ * // Returns: '"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string'
251
+ */
252
+ declare function computeExtendedType<T = never>(inferredType: string, opDef: OperatorDef<T>): string;
253
+ /**
254
+ * Filter operators based on an inferred type.
255
+ * Returns only operators whose `types` include a matching base type.
256
+ *
257
+ * @param operators - Array of operator definitions
258
+ * @param inferredType - The inferred type string to filter by
259
+ * @returns Filtered array of operators
260
+ *
261
+ * @example
262
+ * const filtered = filterOperatorsByType(OPERATORS, '"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string');
263
+ * // Returns operators with types: ['any'] or types: ['string']
264
+ */
265
+ declare function filterOperatorsByType<T = never>(operators: OperatorDef<T>[], inferredType: string): OperatorDef<T>[];
266
+ /**
267
+ * Get string constants from an inferred type.
268
+ * Useful for showing constant-based autocomplete options.
269
+ *
270
+ * @param inferredType - The inferred type string
271
+ * @returns Array of string constants
272
+ *
273
+ * @example
274
+ * getStringConstants('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string');
275
+ * // Returns: ['Hans', 'Karl', 'Eddie', 'Theo', 'Fritz']
276
+ */
277
+ declare function getStringConstants(inferredType: string): string[];
278
+ /**
279
+ * Get number constants from an inferred type.
280
+ *
281
+ * @param inferredType - The inferred type string
282
+ * @returns Array of number constants
283
+ */
284
+ declare function getNumberConstants(inferredType: string): number[];
285
+
152
286
  /**
153
287
  * Simplified Field Components (Mock/Development Version)
154
288
  *
@@ -326,6 +460,10 @@ interface InferredTypesContextValue {
326
460
  setInferredType: (fieldName: string, type: string) => void;
327
461
  /** Get the inferred type for a field (called by subscriber fields) */
328
462
  getInferredType: (fieldName: string) => string | undefined;
463
+ /** Remove an inferred type by field name */
464
+ clearInferredType: (fieldName: string) => void;
465
+ /** Remove all inferred types */
466
+ clearAllInferredTypes: () => void;
329
467
  }
330
468
  /**
331
469
  * Context for inferred types.
@@ -334,7 +472,10 @@ interface InferredTypesContextValue {
334
472
  declare const InferredTypesContext: React__default.Context<InferredTypesContextValue | null>;
335
473
  /**
336
474
  * Hook to access the inferred types context.
337
- * Returns null when not inside an InferredTypesProvider (e.g., in mock/dev mode).
475
+ *
476
+ * When used within a DevProvider, uses the dev context's inferred types storage.
477
+ * When used within a production InferredTypesProvider, uses the real context.
478
+ * Returns null when not inside any provider.
338
479
  *
339
480
  * @example
340
481
  * ```tsx
@@ -399,9 +540,12 @@ interface InferConfig {
399
540
  * ```
400
541
  */
401
542
  declare function parseInferSyntax(expectedType: string | undefined): InferConfig;
543
+
402
544
  /**
403
545
  * Standard operators grouped by compatible types.
404
546
  * Use getOperatorsForType() to retrieve operators for a specific type.
547
+ *
548
+ * @deprecated Use OperatorDef<T> and filterOperatorsByType() for more flexibility
405
549
  */
406
550
  declare const OPERATORS_BY_TYPE: Record<string, Array<{
407
551
  value: string;
@@ -411,6 +555,8 @@ declare const OPERATORS_BY_TYPE: Record<string, Array<{
411
555
  * Get the appropriate operators for a given type.
412
556
  * Falls back to 'any' operators for unrecognized types.
413
557
  *
558
+ * @deprecated Use OperatorDef<T> and filterOperatorsByType() for more flexibility
559
+ *
414
560
  * @example
415
561
  * ```tsx
416
562
  * const ctx = useInferredTypes();
@@ -448,47 +594,77 @@ interface NodePropertyProviderProps {
448
594
  */
449
595
  declare function NodePropertyProvider({ children }: NodePropertyProviderProps): React__default.ReactElement;
450
596
  /**
451
- * Mock hook - always returns false in development mode.
452
- * In production, returns true when inside a NodePropertyProvider.
597
+ * Hook to check if we're inside a property provider.
598
+ *
599
+ * Returns true when inside a DevProvider or a production NodePropertyProvider.
600
+ * Returns false otherwise.
453
601
  */
454
602
  declare function useIsInNodePropertyProvider(): boolean;
455
603
  /**
456
- * Mock hook - returns [undefined, no-op] in development mode.
457
- * In production, subscribes to a single property from the store.
604
+ * Hook to access and update a single property from the node store.
605
+ *
606
+ * When used within a DevProvider, uses the dev context's storage.
607
+ * When used within a production NodePropertyProvider, uses the real store.
608
+ * Otherwise, returns [undefined, no-op] as a fallback.
458
609
  *
459
610
  * @example
460
611
  * ```tsx
461
612
  * const [operator, setOperator] = useNodeProperty<string>('operator');
462
- * // In mock mode: operator is undefined, setOperator is a no-op
463
613
  * ```
464
614
  */
465
615
  declare function useNodeProperty<T = any>(key: string): [T | undefined, (value: T, metadata?: any) => void];
466
616
  /**
467
- * Mock hook - returns [{}, no-op] in development mode.
468
- * In production, subscribes to all properties from the store.
617
+ * Hook to access and update all properties from the node store.
618
+ *
619
+ * When used within a DevProvider, uses the dev context's storage.
620
+ * When used within a production NodePropertyProvider, uses the real store.
621
+ * Otherwise, returns [{}, no-op] as a fallback.
469
622
  */
470
623
  declare function useNodeProperties(): [
471
624
  Record<string, any>,
472
625
  (updates: Record<string, any>, metadata?: Record<string, any>) => void
473
626
  ];
474
627
  /**
475
- * Mock hook - returns undefined in development mode.
476
- * In production, subscribes to an inferred type by field name.
628
+ * Hook to subscribe to an inferred type by field name.
629
+ *
630
+ * When used within a DevProvider, uses the dev context's inferred types.
631
+ * When used within a production provider, uses the real store.
632
+ * Returns undefined when not inside any provider.
477
633
  */
478
634
  declare function useInferredType(fieldName: string): string | undefined;
479
635
  /**
480
- * Mock hook - returns no-op in development mode.
481
- * In production, returns a setter for inferred types.
636
+ * Hook to get a setter for inferred types.
637
+ *
638
+ * When used within a DevProvider, uses the dev context's setInferredType.
639
+ * Returns a no-op when not inside any provider.
482
640
  */
483
641
  declare function useSetInferredType(): (fieldName: string, type: string) => void;
484
642
  /**
485
- * Mock hook - returns {} in development mode.
486
- * In production, subscribes to all inferred types.
643
+ * Hook to get a clearer for inferred types.
644
+ *
645
+ * When used within a DevProvider, uses the dev context's clearInferredType.
646
+ * Returns a no-op when not inside any provider.
647
+ */
648
+ declare function useClearInferredType(): (fieldName: string) => void;
649
+ /**
650
+ * Hook to get a function that clears all inferred types.
651
+ *
652
+ * When used within a DevProvider, uses the dev context's clearAllInferredTypes.
653
+ * Returns a no-op when not inside any provider.
654
+ */
655
+ declare function useClearAllInferredTypes(): () => void;
656
+ /**
657
+ * Hook to subscribe to all inferred types.
658
+ *
659
+ * When used within a DevProvider, uses the dev context's inferred types.
660
+ * Returns {} when not inside any provider.
487
661
  */
488
662
  declare function useAllInferredTypes(): Record<string, string>;
489
663
  /**
490
- * Mock hook - returns no-op in development mode.
491
- * In production, returns a setter for individual properties.
664
+ * Hook to get a setter for individual properties.
665
+ *
666
+ * When used within a DevProvider, uses the dev context's setProperty.
667
+ * Returns a no-op when not inside any provider.
492
668
  */
493
669
  declare function useSetProperty(): <T = any>(key: string, value: T, metadata?: any) => void;
494
670
  /**
@@ -519,6 +695,7 @@ declare function useFieldValidation(): {
519
695
  validateField: (fieldName: string) => string | null;
520
696
  };
521
697
 
698
+ type index_BaseOperatorType = BaseOperatorType;
522
699
  type index_FieldValidationRule = FieldValidationRule;
523
700
  type index_InferConfig = InferConfig;
524
701
  declare const index_InferredTypesContext: typeof InferredTypesContext;
@@ -532,6 +709,8 @@ type index_NestedFieldProviderProps = NestedFieldProviderProps;
532
709
  declare const index_NodePropertyProvider: typeof NodePropertyProvider;
533
710
  type index_NodePropertyProviderProps = NodePropertyProviderProps;
534
711
  declare const index_OPERATORS_BY_TYPE: typeof OPERATORS_BY_TYPE;
712
+ type index_OperatorDef<T = never> = OperatorDef<T>;
713
+ type index_ParsedTypes = ParsedTypes;
535
714
  declare const index_Select: typeof Select;
536
715
  type index_SelectOption = SelectOption;
537
716
  type index_SelectProps = SelectProps;
@@ -542,10 +721,17 @@ type index_TemplateFieldFocusContext = TemplateFieldFocusContext;
542
721
  declare const index_TemplateFieldProvider: typeof TemplateFieldProvider;
543
722
  type index_TemplateFieldProviderProps = TemplateFieldProviderProps;
544
723
  type index_TemplateFieldValidationError = TemplateFieldValidationError;
724
+ declare const index_computeExtendedType: typeof computeExtendedType;
725
+ declare const index_filterOperatorsByType: typeof filterOperatorsByType;
726
+ declare const index_getNumberConstants: typeof getNumberConstants;
545
727
  declare const index_getOperatorsForType: typeof getOperatorsForType;
728
+ declare const index_getStringConstants: typeof getStringConstants;
546
729
  declare const index_intersectTypes: typeof intersectTypes;
547
730
  declare const index_parseInferSyntax: typeof parseInferSyntax;
731
+ declare const index_parseInferredTypes: typeof parseInferredTypes;
548
732
  declare const index_useAllInferredTypes: typeof useAllInferredTypes;
733
+ declare const index_useClearAllInferredTypes: typeof useClearAllInferredTypes;
734
+ declare const index_useClearInferredType: typeof useClearInferredType;
549
735
  declare const index_useFieldPath: typeof useFieldPath;
550
736
  declare const index_useFieldValidation: typeof useFieldValidation;
551
737
  declare const index_useInferredType: typeof useInferredType;
@@ -558,7 +744,7 @@ declare const index_useSetInferredType: typeof useSetInferredType;
558
744
  declare const index_useSetProperty: typeof useSetProperty;
559
745
  declare const index_useTemplateFieldContext: typeof useTemplateFieldContext;
560
746
  declare namespace index {
561
- export { type index_FieldValidationRule as FieldValidationRule, type index_InferConfig as InferConfig, index_InferredTypesContext as InferredTypesContext, type index_InferredTypesContextValue as InferredTypesContextValue, index_InferredTypesProvider as InferredTypesProvider, type index_InferredTypesProviderProps as InferredTypesProviderProps, index_Input as Input, type index_InputProps as InputProps, index_NestedFieldProvider as NestedFieldProvider, type index_NestedFieldProviderProps as NestedFieldProviderProps, index_NodePropertyProvider as NodePropertyProvider, type index_NodePropertyProviderProps as NodePropertyProviderProps, index_OPERATORS_BY_TYPE as OPERATORS_BY_TYPE, index_Select as Select, type index_SelectOption as SelectOption, type index_SelectProps as SelectProps, type index_SelectRenderProps as SelectRenderProps, type index_TemplateFieldChangeEvent as TemplateFieldChangeEvent, type index_TemplateFieldContextValue as TemplateFieldContextValue, type index_TemplateFieldFocusContext as TemplateFieldFocusContext, index_TemplateFieldProvider as TemplateFieldProvider, type index_TemplateFieldProviderProps as TemplateFieldProviderProps, type index_TemplateFieldValidationError as TemplateFieldValidationError, index_getOperatorsForType as getOperatorsForType, index_intersectTypes as intersectTypes, index_parseInferSyntax as parseInferSyntax, index_useAllInferredTypes as useAllInferredTypes, index_useFieldPath as useFieldPath, index_useFieldValidation as useFieldValidation, index_useInferredType as useInferredType, index_useInferredTypes as useInferredTypes, index_useIsInNodePropertyProvider as useIsInNodePropertyProvider, index_useIsInTemplateFieldProvider as useIsInTemplateFieldProvider, index_useNodeProperties as useNodeProperties, index_useNodeProperty as useNodeProperty, index_useSetInferredType as useSetInferredType, index_useSetProperty as useSetProperty, index_useTemplateFieldContext as useTemplateFieldContext };
747
+ export { type index_BaseOperatorType as BaseOperatorType, type index_FieldValidationRule as FieldValidationRule, type index_InferConfig as InferConfig, index_InferredTypesContext as InferredTypesContext, type index_InferredTypesContextValue as InferredTypesContextValue, index_InferredTypesProvider as InferredTypesProvider, type index_InferredTypesProviderProps as InferredTypesProviderProps, index_Input as Input, type index_InputProps as InputProps, index_NestedFieldProvider as NestedFieldProvider, type index_NestedFieldProviderProps as NestedFieldProviderProps, index_NodePropertyProvider as NodePropertyProvider, type index_NodePropertyProviderProps as NodePropertyProviderProps, index_OPERATORS_BY_TYPE as OPERATORS_BY_TYPE, type index_OperatorDef as OperatorDef, type index_ParsedTypes as ParsedTypes, index_Select as Select, type index_SelectOption as SelectOption, type index_SelectProps as SelectProps, type index_SelectRenderProps as SelectRenderProps, type index_TemplateFieldChangeEvent as TemplateFieldChangeEvent, type index_TemplateFieldContextValue as TemplateFieldContextValue, type index_TemplateFieldFocusContext as TemplateFieldFocusContext, index_TemplateFieldProvider as TemplateFieldProvider, type index_TemplateFieldProviderProps as TemplateFieldProviderProps, type index_TemplateFieldValidationError as TemplateFieldValidationError, index_computeExtendedType as computeExtendedType, index_filterOperatorsByType as filterOperatorsByType, index_getNumberConstants as getNumberConstants, index_getOperatorsForType as getOperatorsForType, index_getStringConstants as getStringConstants, index_intersectTypes as intersectTypes, index_parseInferSyntax as parseInferSyntax, index_parseInferredTypes as parseInferredTypes, index_useAllInferredTypes as useAllInferredTypes, index_useClearAllInferredTypes as useClearAllInferredTypes, index_useClearInferredType as useClearInferredType, index_useFieldPath as useFieldPath, index_useFieldValidation as useFieldValidation, index_useInferredType as useInferredType, index_useInferredTypes as useInferredTypes, index_useIsInNodePropertyProvider as useIsInNodePropertyProvider, index_useIsInTemplateFieldProvider as useIsInTemplateFieldProvider, index_useNodeProperties as useNodeProperties, index_useNodeProperty as useNodeProperty, index_useSetInferredType as useSetInferredType, index_useSetProperty as useSetProperty, index_useTemplateFieldContext as useTemplateFieldContext };
562
748
  }
563
749
 
564
- export { useSetProperty as A, useFieldValidation as B, Input as C, type InputProps as D, type SelectProps as E, type FieldValidationRule as F, type SelectOption as G, type SelectRenderProps as H, type InferredTypesContextValue as I, NestedFieldProvider as N, OPERATORS_BY_TYPE as O, Select as S, type TemplateFieldContextValue as T, useIsInTemplateFieldProvider as a, useFieldPath as b, TemplateFieldProvider as c, type TemplateFieldProviderProps as d, type NestedFieldProviderProps as e, type TemplateFieldValidationError as f, type TemplateFieldFocusContext as g, type TemplateFieldChangeEvent as h, index as i, InferredTypesContext as j, useInferredTypes as k, type InferredTypesProviderProps as l, InferredTypesProvider as m, intersectTypes as n, type InferConfig as o, parseInferSyntax as p, getOperatorsForType as q, type NodePropertyProviderProps as r, NodePropertyProvider as s, useIsInNodePropertyProvider as t, useTemplateFieldContext as u, useNodeProperty as v, useNodeProperties as w, useInferredType as x, useSetInferredType as y, useAllInferredTypes as z };
750
+ export { useClearAllInferredTypes as A, useAllInferredTypes as B, useSetProperty as C, useFieldValidation as D, Input as E, type FieldValidationRule as F, type InputProps as G, type SelectProps as H, type InferredTypesContextValue as I, type SelectOption as J, type SelectRenderProps as K, parseInferredTypes as L, computeExtendedType as M, NestedFieldProvider as N, OPERATORS_BY_TYPE as O, filterOperatorsByType as P, getStringConstants as Q, getNumberConstants as R, Select as S, type TemplateFieldContextValue as T, type BaseOperatorType as U, type OperatorDef as V, type ParsedTypes as W, useIsInTemplateFieldProvider as a, useFieldPath as b, TemplateFieldProvider as c, type TemplateFieldProviderProps as d, type NestedFieldProviderProps as e, type TemplateFieldValidationError as f, type TemplateFieldFocusContext as g, type TemplateFieldChangeEvent as h, index as i, InferredTypesContext as j, useInferredTypes as k, type InferredTypesProviderProps as l, InferredTypesProvider as m, intersectTypes as n, type InferConfig as o, parseInferSyntax as p, getOperatorsForType as q, type NodePropertyProviderProps as r, NodePropertyProvider as s, useIsInNodePropertyProvider as t, useTemplateFieldContext as u, useNodeProperty as v, useNodeProperties as w, useInferredType as x, useSetInferredType as y, useClearInferredType as z };
@@ -149,6 +149,140 @@ interface SelectRenderProps {
149
149
  */
150
150
  declare function Select({ fieldName, label, value, onChange, options: rawOptions, disabled, placeholder, expectedType, required, hasRequiredError, className, children, }: SelectProps): React.JSX.Element;
151
151
 
152
+ /**
153
+ * Shared Operator Type Definitions and Utilities
154
+ *
155
+ * This module provides reusable types and utilities for building
156
+ * query builders with type-aware operators (Switch, IfThenElse, etc.)
157
+ */
158
+ /**
159
+ * Standard operator types for condition builders.
160
+ * Custom UIs can extend this with their own operators.
161
+ */
162
+ type BaseOperatorType = 'exists' | 'not_exists' | 'string_equals' | 'string_not_equals' | 'string_is_blank' | 'string_is_not_blank' | 'string_starts_with' | 'string_contains' | 'string_not_contains' | 'string_ends_with' | 'number_equals' | 'number_not_equals' | 'number_gt' | 'number_gte' | 'number_lt' | 'number_lte' | 'boolean_equals' | 'is_null' | 'is_not_null' | 'is_string' | 'is_not_string' | 'is_number' | 'is_not_number' | 'is_true' | 'is_false' | 'is_boolean' | 'is_not_boolean';
163
+ /**
164
+ * Generic operator definition that can be extended with custom operators.
165
+ *
166
+ * @template T - Additional operator types to include (defaults to never)
167
+ *
168
+ * @example
169
+ * // Using base operators only
170
+ * const operators: OperatorDef[] = [...];
171
+ *
172
+ * // Extending with custom operators
173
+ * type MyOperator = 'expression' | 'custom_op';
174
+ * const operators: OperatorDef<MyOperator>[] = [...];
175
+ */
176
+ type OperatorDef<T = never> = {
177
+ /** The operator value/key */
178
+ value: BaseOperatorType | T;
179
+ /** Which inferred types this applies to ('any' = always shown) */
180
+ types: string[];
181
+ /** Human-readable label for the operator */
182
+ label: string;
183
+ /** Short label for compact display (optional) */
184
+ shortLabel?: string;
185
+ /** Whether to show the value Input */
186
+ needsValue: boolean;
187
+ /** Type to register for narrowing ('never' = no narrowing) */
188
+ narrowsTo: string;
189
+ /** If true, union narrowed type with base type (e.g., narrowed | string) */
190
+ extendsWithBase?: boolean;
191
+ };
192
+ /**
193
+ * Result of parsing an inferred type string.
194
+ */
195
+ type ParsedTypes = {
196
+ /** Deduplicated base types (string, number, boolean, any, etc.) */
197
+ baseTypes: string[];
198
+ /** Extracted string literal constants */
199
+ stringConstants: string[];
200
+ /** Extracted number literal constants */
201
+ numberConstants: number[];
202
+ /** Whether any literal constants were found */
203
+ hasConstants: boolean;
204
+ /** Original type strings for union building */
205
+ rawTypes: string[];
206
+ };
207
+ /**
208
+ * Parse an inferred type string into base types and extract any literal constants.
209
+ *
210
+ * Handles:
211
+ * - Base types: string, number, boolean
212
+ * - Union types: string | number
213
+ * - String literals: "Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" -> treated as string type
214
+ * - Number literals: 1 | 2 | 3 -> treated as number type
215
+ * - Boolean literals: true | false -> treated as boolean type
216
+ *
217
+ * @param typeStr - The inferred type string to parse
218
+ * @returns Parsed type information
219
+ *
220
+ * @example
221
+ * parseInferredTypes('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string')
222
+ * // Returns:
223
+ * // {
224
+ * // baseTypes: ['string'],
225
+ * // stringConstants: ['Hans', 'Karl', 'Eddie', 'Theo', 'Fritz'],
226
+ * // numberConstants: [],
227
+ * // hasConstants: true,
228
+ * // rawTypes: ['"Hans"', '"Karl"', '"Eddie"', '"Theo"', '"Fritz"', 'string']
229
+ * // }
230
+ */
231
+ declare function parseInferredTypes(typeStr: string): ParsedTypes;
232
+ /**
233
+ * Compute the expected type for a value input based on the operator.
234
+ *
235
+ * If `extendsWithBase` is true, the result includes both:
236
+ * - The matching literal types from the inferred type
237
+ * - The base type (to allow arbitrary input)
238
+ *
239
+ * This enables scenarios like:
240
+ * - `string_equals` on `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` → expects `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` (exact match)
241
+ * - `string_starts_with` on `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` → expects `"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string"` (allows partial match)
242
+ *
243
+ * @param inferredType - The inferred type string from the statement
244
+ * @param opDef - The operator definition
245
+ * @returns The computed expected type string
246
+ *
247
+ * @example
248
+ * const opDef = { narrowsTo: 'string', extendsWithBase: true, ... };
249
+ * computeExtendedType('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string', opDef);
250
+ * // Returns: '"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string'
251
+ */
252
+ declare function computeExtendedType<T = never>(inferredType: string, opDef: OperatorDef<T>): string;
253
+ /**
254
+ * Filter operators based on an inferred type.
255
+ * Returns only operators whose `types` include a matching base type.
256
+ *
257
+ * @param operators - Array of operator definitions
258
+ * @param inferredType - The inferred type string to filter by
259
+ * @returns Filtered array of operators
260
+ *
261
+ * @example
262
+ * const filtered = filterOperatorsByType(OPERATORS, '"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string');
263
+ * // Returns operators with types: ['any'] or types: ['string']
264
+ */
265
+ declare function filterOperatorsByType<T = never>(operators: OperatorDef<T>[], inferredType: string): OperatorDef<T>[];
266
+ /**
267
+ * Get string constants from an inferred type.
268
+ * Useful for showing constant-based autocomplete options.
269
+ *
270
+ * @param inferredType - The inferred type string
271
+ * @returns Array of string constants
272
+ *
273
+ * @example
274
+ * getStringConstants('"Hans" | "Karl" | "Eddie" | "Theo" | "Fritz" | string');
275
+ * // Returns: ['Hans', 'Karl', 'Eddie', 'Theo', 'Fritz']
276
+ */
277
+ declare function getStringConstants(inferredType: string): string[];
278
+ /**
279
+ * Get number constants from an inferred type.
280
+ *
281
+ * @param inferredType - The inferred type string
282
+ * @returns Array of number constants
283
+ */
284
+ declare function getNumberConstants(inferredType: string): number[];
285
+
152
286
  /**
153
287
  * Simplified Field Components (Mock/Development Version)
154
288
  *
@@ -326,6 +460,10 @@ interface InferredTypesContextValue {
326
460
  setInferredType: (fieldName: string, type: string) => void;
327
461
  /** Get the inferred type for a field (called by subscriber fields) */
328
462
  getInferredType: (fieldName: string) => string | undefined;
463
+ /** Remove an inferred type by field name */
464
+ clearInferredType: (fieldName: string) => void;
465
+ /** Remove all inferred types */
466
+ clearAllInferredTypes: () => void;
329
467
  }
330
468
  /**
331
469
  * Context for inferred types.
@@ -334,7 +472,10 @@ interface InferredTypesContextValue {
334
472
  declare const InferredTypesContext: React__default.Context<InferredTypesContextValue | null>;
335
473
  /**
336
474
  * Hook to access the inferred types context.
337
- * Returns null when not inside an InferredTypesProvider (e.g., in mock/dev mode).
475
+ *
476
+ * When used within a DevProvider, uses the dev context's inferred types storage.
477
+ * When used within a production InferredTypesProvider, uses the real context.
478
+ * Returns null when not inside any provider.
338
479
  *
339
480
  * @example
340
481
  * ```tsx
@@ -399,9 +540,12 @@ interface InferConfig {
399
540
  * ```
400
541
  */
401
542
  declare function parseInferSyntax(expectedType: string | undefined): InferConfig;
543
+
402
544
  /**
403
545
  * Standard operators grouped by compatible types.
404
546
  * Use getOperatorsForType() to retrieve operators for a specific type.
547
+ *
548
+ * @deprecated Use OperatorDef<T> and filterOperatorsByType() for more flexibility
405
549
  */
406
550
  declare const OPERATORS_BY_TYPE: Record<string, Array<{
407
551
  value: string;
@@ -411,6 +555,8 @@ declare const OPERATORS_BY_TYPE: Record<string, Array<{
411
555
  * Get the appropriate operators for a given type.
412
556
  * Falls back to 'any' operators for unrecognized types.
413
557
  *
558
+ * @deprecated Use OperatorDef<T> and filterOperatorsByType() for more flexibility
559
+ *
414
560
  * @example
415
561
  * ```tsx
416
562
  * const ctx = useInferredTypes();
@@ -448,47 +594,77 @@ interface NodePropertyProviderProps {
448
594
  */
449
595
  declare function NodePropertyProvider({ children }: NodePropertyProviderProps): React__default.ReactElement;
450
596
  /**
451
- * Mock hook - always returns false in development mode.
452
- * In production, returns true when inside a NodePropertyProvider.
597
+ * Hook to check if we're inside a property provider.
598
+ *
599
+ * Returns true when inside a DevProvider or a production NodePropertyProvider.
600
+ * Returns false otherwise.
453
601
  */
454
602
  declare function useIsInNodePropertyProvider(): boolean;
455
603
  /**
456
- * Mock hook - returns [undefined, no-op] in development mode.
457
- * In production, subscribes to a single property from the store.
604
+ * Hook to access and update a single property from the node store.
605
+ *
606
+ * When used within a DevProvider, uses the dev context's storage.
607
+ * When used within a production NodePropertyProvider, uses the real store.
608
+ * Otherwise, returns [undefined, no-op] as a fallback.
458
609
  *
459
610
  * @example
460
611
  * ```tsx
461
612
  * const [operator, setOperator] = useNodeProperty<string>('operator');
462
- * // In mock mode: operator is undefined, setOperator is a no-op
463
613
  * ```
464
614
  */
465
615
  declare function useNodeProperty<T = any>(key: string): [T | undefined, (value: T, metadata?: any) => void];
466
616
  /**
467
- * Mock hook - returns [{}, no-op] in development mode.
468
- * In production, subscribes to all properties from the store.
617
+ * Hook to access and update all properties from the node store.
618
+ *
619
+ * When used within a DevProvider, uses the dev context's storage.
620
+ * When used within a production NodePropertyProvider, uses the real store.
621
+ * Otherwise, returns [{}, no-op] as a fallback.
469
622
  */
470
623
  declare function useNodeProperties(): [
471
624
  Record<string, any>,
472
625
  (updates: Record<string, any>, metadata?: Record<string, any>) => void
473
626
  ];
474
627
  /**
475
- * Mock hook - returns undefined in development mode.
476
- * In production, subscribes to an inferred type by field name.
628
+ * Hook to subscribe to an inferred type by field name.
629
+ *
630
+ * When used within a DevProvider, uses the dev context's inferred types.
631
+ * When used within a production provider, uses the real store.
632
+ * Returns undefined when not inside any provider.
477
633
  */
478
634
  declare function useInferredType(fieldName: string): string | undefined;
479
635
  /**
480
- * Mock hook - returns no-op in development mode.
481
- * In production, returns a setter for inferred types.
636
+ * Hook to get a setter for inferred types.
637
+ *
638
+ * When used within a DevProvider, uses the dev context's setInferredType.
639
+ * Returns a no-op when not inside any provider.
482
640
  */
483
641
  declare function useSetInferredType(): (fieldName: string, type: string) => void;
484
642
  /**
485
- * Mock hook - returns {} in development mode.
486
- * In production, subscribes to all inferred types.
643
+ * Hook to get a clearer for inferred types.
644
+ *
645
+ * When used within a DevProvider, uses the dev context's clearInferredType.
646
+ * Returns a no-op when not inside any provider.
647
+ */
648
+ declare function useClearInferredType(): (fieldName: string) => void;
649
+ /**
650
+ * Hook to get a function that clears all inferred types.
651
+ *
652
+ * When used within a DevProvider, uses the dev context's clearAllInferredTypes.
653
+ * Returns a no-op when not inside any provider.
654
+ */
655
+ declare function useClearAllInferredTypes(): () => void;
656
+ /**
657
+ * Hook to subscribe to all inferred types.
658
+ *
659
+ * When used within a DevProvider, uses the dev context's inferred types.
660
+ * Returns {} when not inside any provider.
487
661
  */
488
662
  declare function useAllInferredTypes(): Record<string, string>;
489
663
  /**
490
- * Mock hook - returns no-op in development mode.
491
- * In production, returns a setter for individual properties.
664
+ * Hook to get a setter for individual properties.
665
+ *
666
+ * When used within a DevProvider, uses the dev context's setProperty.
667
+ * Returns a no-op when not inside any provider.
492
668
  */
493
669
  declare function useSetProperty(): <T = any>(key: string, value: T, metadata?: any) => void;
494
670
  /**
@@ -519,6 +695,7 @@ declare function useFieldValidation(): {
519
695
  validateField: (fieldName: string) => string | null;
520
696
  };
521
697
 
698
+ type index_BaseOperatorType = BaseOperatorType;
522
699
  type index_FieldValidationRule = FieldValidationRule;
523
700
  type index_InferConfig = InferConfig;
524
701
  declare const index_InferredTypesContext: typeof InferredTypesContext;
@@ -532,6 +709,8 @@ type index_NestedFieldProviderProps = NestedFieldProviderProps;
532
709
  declare const index_NodePropertyProvider: typeof NodePropertyProvider;
533
710
  type index_NodePropertyProviderProps = NodePropertyProviderProps;
534
711
  declare const index_OPERATORS_BY_TYPE: typeof OPERATORS_BY_TYPE;
712
+ type index_OperatorDef<T = never> = OperatorDef<T>;
713
+ type index_ParsedTypes = ParsedTypes;
535
714
  declare const index_Select: typeof Select;
536
715
  type index_SelectOption = SelectOption;
537
716
  type index_SelectProps = SelectProps;
@@ -542,10 +721,17 @@ type index_TemplateFieldFocusContext = TemplateFieldFocusContext;
542
721
  declare const index_TemplateFieldProvider: typeof TemplateFieldProvider;
543
722
  type index_TemplateFieldProviderProps = TemplateFieldProviderProps;
544
723
  type index_TemplateFieldValidationError = TemplateFieldValidationError;
724
+ declare const index_computeExtendedType: typeof computeExtendedType;
725
+ declare const index_filterOperatorsByType: typeof filterOperatorsByType;
726
+ declare const index_getNumberConstants: typeof getNumberConstants;
545
727
  declare const index_getOperatorsForType: typeof getOperatorsForType;
728
+ declare const index_getStringConstants: typeof getStringConstants;
546
729
  declare const index_intersectTypes: typeof intersectTypes;
547
730
  declare const index_parseInferSyntax: typeof parseInferSyntax;
731
+ declare const index_parseInferredTypes: typeof parseInferredTypes;
548
732
  declare const index_useAllInferredTypes: typeof useAllInferredTypes;
733
+ declare const index_useClearAllInferredTypes: typeof useClearAllInferredTypes;
734
+ declare const index_useClearInferredType: typeof useClearInferredType;
549
735
  declare const index_useFieldPath: typeof useFieldPath;
550
736
  declare const index_useFieldValidation: typeof useFieldValidation;
551
737
  declare const index_useInferredType: typeof useInferredType;
@@ -558,7 +744,7 @@ declare const index_useSetInferredType: typeof useSetInferredType;
558
744
  declare const index_useSetProperty: typeof useSetProperty;
559
745
  declare const index_useTemplateFieldContext: typeof useTemplateFieldContext;
560
746
  declare namespace index {
561
- export { type index_FieldValidationRule as FieldValidationRule, type index_InferConfig as InferConfig, index_InferredTypesContext as InferredTypesContext, type index_InferredTypesContextValue as InferredTypesContextValue, index_InferredTypesProvider as InferredTypesProvider, type index_InferredTypesProviderProps as InferredTypesProviderProps, index_Input as Input, type index_InputProps as InputProps, index_NestedFieldProvider as NestedFieldProvider, type index_NestedFieldProviderProps as NestedFieldProviderProps, index_NodePropertyProvider as NodePropertyProvider, type index_NodePropertyProviderProps as NodePropertyProviderProps, index_OPERATORS_BY_TYPE as OPERATORS_BY_TYPE, index_Select as Select, type index_SelectOption as SelectOption, type index_SelectProps as SelectProps, type index_SelectRenderProps as SelectRenderProps, type index_TemplateFieldChangeEvent as TemplateFieldChangeEvent, type index_TemplateFieldContextValue as TemplateFieldContextValue, type index_TemplateFieldFocusContext as TemplateFieldFocusContext, index_TemplateFieldProvider as TemplateFieldProvider, type index_TemplateFieldProviderProps as TemplateFieldProviderProps, type index_TemplateFieldValidationError as TemplateFieldValidationError, index_getOperatorsForType as getOperatorsForType, index_intersectTypes as intersectTypes, index_parseInferSyntax as parseInferSyntax, index_useAllInferredTypes as useAllInferredTypes, index_useFieldPath as useFieldPath, index_useFieldValidation as useFieldValidation, index_useInferredType as useInferredType, index_useInferredTypes as useInferredTypes, index_useIsInNodePropertyProvider as useIsInNodePropertyProvider, index_useIsInTemplateFieldProvider as useIsInTemplateFieldProvider, index_useNodeProperties as useNodeProperties, index_useNodeProperty as useNodeProperty, index_useSetInferredType as useSetInferredType, index_useSetProperty as useSetProperty, index_useTemplateFieldContext as useTemplateFieldContext };
747
+ export { type index_BaseOperatorType as BaseOperatorType, type index_FieldValidationRule as FieldValidationRule, type index_InferConfig as InferConfig, index_InferredTypesContext as InferredTypesContext, type index_InferredTypesContextValue as InferredTypesContextValue, index_InferredTypesProvider as InferredTypesProvider, type index_InferredTypesProviderProps as InferredTypesProviderProps, index_Input as Input, type index_InputProps as InputProps, index_NestedFieldProvider as NestedFieldProvider, type index_NestedFieldProviderProps as NestedFieldProviderProps, index_NodePropertyProvider as NodePropertyProvider, type index_NodePropertyProviderProps as NodePropertyProviderProps, index_OPERATORS_BY_TYPE as OPERATORS_BY_TYPE, type index_OperatorDef as OperatorDef, type index_ParsedTypes as ParsedTypes, index_Select as Select, type index_SelectOption as SelectOption, type index_SelectProps as SelectProps, type index_SelectRenderProps as SelectRenderProps, type index_TemplateFieldChangeEvent as TemplateFieldChangeEvent, type index_TemplateFieldContextValue as TemplateFieldContextValue, type index_TemplateFieldFocusContext as TemplateFieldFocusContext, index_TemplateFieldProvider as TemplateFieldProvider, type index_TemplateFieldProviderProps as TemplateFieldProviderProps, type index_TemplateFieldValidationError as TemplateFieldValidationError, index_computeExtendedType as computeExtendedType, index_filterOperatorsByType as filterOperatorsByType, index_getNumberConstants as getNumberConstants, index_getOperatorsForType as getOperatorsForType, index_getStringConstants as getStringConstants, index_intersectTypes as intersectTypes, index_parseInferSyntax as parseInferSyntax, index_parseInferredTypes as parseInferredTypes, index_useAllInferredTypes as useAllInferredTypes, index_useClearAllInferredTypes as useClearAllInferredTypes, index_useClearInferredType as useClearInferredType, index_useFieldPath as useFieldPath, index_useFieldValidation as useFieldValidation, index_useInferredType as useInferredType, index_useInferredTypes as useInferredTypes, index_useIsInNodePropertyProvider as useIsInNodePropertyProvider, index_useIsInTemplateFieldProvider as useIsInTemplateFieldProvider, index_useNodeProperties as useNodeProperties, index_useNodeProperty as useNodeProperty, index_useSetInferredType as useSetInferredType, index_useSetProperty as useSetProperty, index_useTemplateFieldContext as useTemplateFieldContext };
562
748
  }
563
749
 
564
- export { useSetProperty as A, useFieldValidation as B, Input as C, type InputProps as D, type SelectProps as E, type FieldValidationRule as F, type SelectOption as G, type SelectRenderProps as H, type InferredTypesContextValue as I, NestedFieldProvider as N, OPERATORS_BY_TYPE as O, Select as S, type TemplateFieldContextValue as T, useIsInTemplateFieldProvider as a, useFieldPath as b, TemplateFieldProvider as c, type TemplateFieldProviderProps as d, type NestedFieldProviderProps as e, type TemplateFieldValidationError as f, type TemplateFieldFocusContext as g, type TemplateFieldChangeEvent as h, index as i, InferredTypesContext as j, useInferredTypes as k, type InferredTypesProviderProps as l, InferredTypesProvider as m, intersectTypes as n, type InferConfig as o, parseInferSyntax as p, getOperatorsForType as q, type NodePropertyProviderProps as r, NodePropertyProvider as s, useIsInNodePropertyProvider as t, useTemplateFieldContext as u, useNodeProperty as v, useNodeProperties as w, useInferredType as x, useSetInferredType as y, useAllInferredTypes as z };
750
+ export { useClearAllInferredTypes as A, useAllInferredTypes as B, useSetProperty as C, useFieldValidation as D, Input as E, type FieldValidationRule as F, type InputProps as G, type SelectProps as H, type InferredTypesContextValue as I, type SelectOption as J, type SelectRenderProps as K, parseInferredTypes as L, computeExtendedType as M, NestedFieldProvider as N, OPERATORS_BY_TYPE as O, filterOperatorsByType as P, getStringConstants as Q, getNumberConstants as R, Select as S, type TemplateFieldContextValue as T, type BaseOperatorType as U, type OperatorDef as V, type ParsedTypes as W, useIsInTemplateFieldProvider as a, useFieldPath as b, TemplateFieldProvider as c, type TemplateFieldProviderProps as d, type NestedFieldProviderProps as e, type TemplateFieldValidationError as f, type TemplateFieldFocusContext as g, type TemplateFieldChangeEvent as h, index as i, InferredTypesContext as j, useInferredTypes as k, type InferredTypesProviderProps as l, InferredTypesProvider as m, intersectTypes as n, type InferConfig as o, parseInferSyntax as p, getOperatorsForType as q, type NodePropertyProviderProps as r, NodePropertyProvider as s, useIsInNodePropertyProvider as t, useTemplateFieldContext as u, useNodeProperty as v, useNodeProperties as w, useInferredType as x, useSetInferredType as y, useClearInferredType as z };