@process.co/ui 0.0.8 → 0.0.10
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 +349 -284
- package/css/ui.css +142 -7
- package/dist/components/fields/index.cjs +387 -21
- package/dist/components/fields/index.cjs.map +1 -1
- package/dist/components/fields/index.d.cts +1 -1
- package/dist/components/fields/index.d.ts +1 -1
- package/dist/components/fields/index.js +373 -22
- package/dist/components/fields/index.js.map +1 -1
- package/dist/index-DGN9LJqq.d.cts +711 -0
- package/dist/index-DGN9LJqq.d.ts +711 -0
- package/dist/index.cjs +428 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +426 -79
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-yubVl0hX.d.cts +0 -403
- package/dist/index-yubVl0hX.d.ts +0 -403
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export {
|
|
2
|
+
export { Q as BaseOperatorType, F as FieldValidationRule, o as InferConfig, j as InferredTypesContext, I as InferredTypesContextValue, m as InferredTypesProvider, l as InferredTypesProviderProps, C as Input, D as InputProps, N as NestedFieldProvider, e as NestedFieldProviderProps, s as NodePropertyProvider, r as NodePropertyProviderProps, O as OPERATORS_BY_TYPE, R as OperatorDef, U as ParsedTypes, S as Select, G as SelectOption, E as SelectProps, H as SelectRenderProps, h as TemplateFieldChangeEvent, T as TemplateFieldContextValue, g as TemplateFieldFocusContext, c as TemplateFieldProvider, d as TemplateFieldProviderProps, f as TemplateFieldValidationError, K as computeExtendedType, L as filterOperatorsByType, P as getNumberConstants, q as getOperatorsForType, M as getStringConstants, n as intersectTypes, p as parseInferSyntax, J as parseInferredTypes, z as useAllInferredTypes, b as useFieldPath, B as useFieldValidation, x as useInferredType, k as useInferredTypes, t as useIsInNodePropertyProvider, a as useIsInTemplateFieldProvider, w as useNodeProperties, v as useNodeProperty, y as useSetInferredType, A as useSetProperty, u as useTemplateFieldContext } from '../../index-DGN9LJqq.cjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export {
|
|
2
|
+
export { Q as BaseOperatorType, F as FieldValidationRule, o as InferConfig, j as InferredTypesContext, I as InferredTypesContextValue, m as InferredTypesProvider, l as InferredTypesProviderProps, C as Input, D as InputProps, N as NestedFieldProvider, e as NestedFieldProviderProps, s as NodePropertyProvider, r as NodePropertyProviderProps, O as OPERATORS_BY_TYPE, R as OperatorDef, U as ParsedTypes, S as Select, G as SelectOption, E as SelectProps, H as SelectRenderProps, h as TemplateFieldChangeEvent, T as TemplateFieldContextValue, g as TemplateFieldFocusContext, c as TemplateFieldProvider, d as TemplateFieldProviderProps, f as TemplateFieldValidationError, K as computeExtendedType, L as filterOperatorsByType, P as getNumberConstants, q as getOperatorsForType, M as getStringConstants, n as intersectTypes, p as parseInferSyntax, J as parseInferredTypes, z as useAllInferredTypes, b as useFieldPath, B as useFieldValidation, x as useInferredType, k as useInferredTypes, t as useIsInNodePropertyProvider, a as useIsInTemplateFieldProvider, w as useNodeProperties, v as useNodeProperty, y as useSetInferredType, A as useSetProperty, u as useTemplateFieldContext } from '../../index-DGN9LJqq.js';
|
|
@@ -22,6 +22,20 @@ function _define_property(obj, key, value) {
|
|
|
22
22
|
}
|
|
23
23
|
return obj;
|
|
24
24
|
}
|
|
25
|
+
function _extends() {
|
|
26
|
+
_extends = Object.assign || function(target) {
|
|
27
|
+
for(var i = 1; i < arguments.length; i++){
|
|
28
|
+
var source = arguments[i];
|
|
29
|
+
for(var key in source){
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
31
|
+
target[key] = source[key];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
return _extends.apply(this, arguments);
|
|
38
|
+
}
|
|
25
39
|
function _iterable_to_array(iter) {
|
|
26
40
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27
41
|
}
|
|
@@ -55,6 +69,10 @@ function _non_iterable_rest() {
|
|
|
55
69
|
function _non_iterable_spread() {
|
|
56
70
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
71
|
}
|
|
72
|
+
function _object_destructuring_empty(o) {
|
|
73
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
74
|
+
return o;
|
|
75
|
+
}
|
|
58
76
|
function _object_spread(target) {
|
|
59
77
|
for(var i = 1; i < arguments.length; i++){
|
|
60
78
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -70,6 +88,33 @@ function _object_spread(target) {
|
|
|
70
88
|
}
|
|
71
89
|
return target;
|
|
72
90
|
}
|
|
91
|
+
function _object_without_properties(source, excluded) {
|
|
92
|
+
if (source == null) return {};
|
|
93
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
94
|
+
var key, i;
|
|
95
|
+
if (Object.getOwnPropertySymbols) {
|
|
96
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
97
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
98
|
+
key = sourceSymbolKeys[i];
|
|
99
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
100
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
101
|
+
target[key] = source[key];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return target;
|
|
105
|
+
}
|
|
106
|
+
function _object_without_properties_loose(source, excluded) {
|
|
107
|
+
if (source == null) return {};
|
|
108
|
+
var target = {};
|
|
109
|
+
var sourceKeys = Object.keys(source);
|
|
110
|
+
var key, i;
|
|
111
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
112
|
+
key = sourceKeys[i];
|
|
113
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
114
|
+
target[key] = source[key];
|
|
115
|
+
}
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
73
118
|
function _sliced_to_array(arr, i) {
|
|
74
119
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
75
120
|
}
|
|
@@ -89,7 +134,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
89
134
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
135
|
}
|
|
91
136
|
import * as React3 from 'react';
|
|
92
|
-
import { createContext, useContext } from 'react';
|
|
137
|
+
import React3__default, { createContext, useContext, useCallback } from 'react';
|
|
138
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
139
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
|
|
93
140
|
// src/components/fields/index.tsx
|
|
94
141
|
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
95
142
|
function r(e) {
|
|
@@ -4791,7 +4838,89 @@ function Input(param) {
|
|
|
4791
4838
|
className: cn("uii:w-full uii:h-9 uii:px-3 uii:rounded-sm uii:border uii:bg-background uii:text-sm", "uii:outline-none uii:transition-all", "focus:uii:border-ring focus:uii:ring-ring/50 focus:uii:ring-[3px]", showError ? "uii:border-red-500 hover:uii:border-red-600" : "uii:border-input hover:uii:border-ring/50", isExpression && "uii:font-mono uii:text-amber-600", disabled && "uii:opacity-50 uii:cursor-not-allowed", editorClassName)
|
|
4792
4839
|
})));
|
|
4793
4840
|
}
|
|
4794
|
-
function Select(
|
|
4841
|
+
function Select(_param) {
|
|
4842
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
4843
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.Root, _object_spread({
|
|
4844
|
+
"data-slot": "select"
|
|
4845
|
+
}, props));
|
|
4846
|
+
}
|
|
4847
|
+
function SelectValue(_param) {
|
|
4848
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
4849
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.Value, _object_spread({
|
|
4850
|
+
"data-slot": "select-value"
|
|
4851
|
+
}, props));
|
|
4852
|
+
}
|
|
4853
|
+
function SelectTrigger(_param) {
|
|
4854
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
4855
|
+
"className",
|
|
4856
|
+
"children"
|
|
4857
|
+
]);
|
|
4858
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.Trigger, _object_spread({
|
|
4859
|
+
"data-slot": "select-trigger",
|
|
4860
|
+
className: cn("uii:border-input uii:data-[placeholder]:text-muted-foreground uii:[&_svg:not([class*=text-])]:text-muted-foreground uii:focus-visible:border-ring uii:focus-visible:ring-ring/50 uii:aria-invalid:ring-destructive/20 uii:dark:aria-invalid:ring-destructive/40 uii:aria-invalid:border-destructive uii:flex uii:h-9 uii:w-full uii:items-center uii:justify-between uii:gap-2 uii:rounded-md uii:border uii:bg-transparent uii:px-3 uii:py-2 uii:text-sm uii:whitespace-nowrap uii:shadow-xs uii:transition-[color,box-shadow] uii:outline-none uii:focus-visible:ring-[3px] uii:disabled:cursor-not-allowed uii:disabled:opacity-50 uii:*:data-[slot=select-value]:line-clamp-1 uii:*:data-[slot=select-value]:flex uii:*:data-[slot=select-value]:items-center uii:*:data-[slot=select-value]:gap-2 uii:[&_svg]:pointer-events-none uii:[&_svg]:shrink-0 uii:[&_svg:not([class*=size-])]:size-4", className)
|
|
4861
|
+
}, props), children, /* @__PURE__ */ React3.createElement(SelectPrimitive.Icon, {
|
|
4862
|
+
asChild: true
|
|
4863
|
+
}, /* @__PURE__ */ React3.createElement(ChevronDownIcon, {
|
|
4864
|
+
className: "uii:size-4 uii:opacity-50"
|
|
4865
|
+
})));
|
|
4866
|
+
}
|
|
4867
|
+
function SelectContent(_param) {
|
|
4868
|
+
var className = _param.className, children = _param.children, _param_position = _param.position, position = _param_position === void 0 ? "popper" : _param_position, footer = _param.footer, _param_hideScrollUpButton = _param.hideScrollUpButton, hideScrollUpButton = _param_hideScrollUpButton === void 0 ? false : _param_hideScrollUpButton, _param_hideScrollDownButton = _param.hideScrollDownButton, hideScrollDownButton = _param_hideScrollDownButton === void 0 ? false : _param_hideScrollDownButton, props = _object_without_properties(_param, [
|
|
4869
|
+
"className",
|
|
4870
|
+
"children",
|
|
4871
|
+
"position",
|
|
4872
|
+
"footer",
|
|
4873
|
+
"hideScrollUpButton",
|
|
4874
|
+
"hideScrollDownButton"
|
|
4875
|
+
]);
|
|
4876
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.Portal, null, /* @__PURE__ */ React3.createElement(SelectPrimitive.Content, _object_spread({
|
|
4877
|
+
"data-slot": "select-content",
|
|
4878
|
+
className: cn("uii:bg-popover uii:text-popover-foreground uii:data-[state=open]:animate-in uii:data-[state=closed]:animate-out uii:data-[state=closed]:fade-out-0 uii:data-[state=open]:fade-in-0 uii:data-[state=closed]:zoom-out-95 uii:data-[state=open]:zoom-in-95 uii:data-[side=bottom]:slide-in-from-top-2 uii:data-[side=left]:slide-in-from-right-2 uii:data-[side=right]:slide-in-from-left-2 uii:data-[side=top]:slide-in-from-bottom-2 uii:relative uii:z-50 uii:max-h-96 uii:min-w-[8rem] uii:overflow-hidden uii:rounded-md uii:border uii:shadow-md", position === "popper" && "uii:data-[side=bottom]:translate-y-1 uii:data-[side=left]:-translate-x-1 uii:data-[side=right]:translate-x-1 uii:data-[side=top]:-translate-y-1", "uii:slide-in-from-right-6", className),
|
|
4879
|
+
position: position
|
|
4880
|
+
}, props), !hideScrollUpButton && /* @__PURE__ */ React3.createElement(SelectScrollUpButton, null), /* @__PURE__ */ React3.createElement(SelectPrimitive.Viewport, {
|
|
4881
|
+
className: cn("uii:p-1", position === "popper" && "uii:h-[var(--radix-select-trigger-height)] uii:w-full uii:min-w-[var(--radix-select-trigger-width)] uii:scroll-my-1")
|
|
4882
|
+
}, children), footer ? /* @__PURE__ */ React3.createElement("div", {
|
|
4883
|
+
className: "uii:border-t uii:p-2 uii:bg-popover"
|
|
4884
|
+
}, footer) : null, !hideScrollDownButton && /* @__PURE__ */ React3.createElement(SelectScrollDownButton, null)));
|
|
4885
|
+
}
|
|
4886
|
+
function SelectItem(_param) {
|
|
4887
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
4888
|
+
"className",
|
|
4889
|
+
"children"
|
|
4890
|
+
]);
|
|
4891
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.Item, _object_spread({
|
|
4892
|
+
"data-slot": "select-item",
|
|
4893
|
+
className: cn("uii:focus:bg-accent uii:focus:text-accent-foreground uii:[&_svg:not([class*=text-])]:text-muted-foreground uii:relative uii:flex uii:w-full uii:cursor-default uii:items-center uii:gap-2 uii:rounded-sm uii:py-1.5 uii:pr-8 uii:pl-2 uii:text-sm uii:outline-hidden uii:select-none uii:data-[disabled]:pointer-events-none uii:data-[disabled]:opacity-50 uii:[&_svg]:pointer-events-none uii:[&_svg]:shrink-0 uii:[&_svg:not([class*=size-])]:size-4 uii:*:[span]:last:flex uii:*:[span]:last:items-center uii:*:[span]:last:gap-2", className)
|
|
4894
|
+
}, props), /* @__PURE__ */ React3.createElement("span", {
|
|
4895
|
+
className: "uii:absolute uii:right-2 uii:flex uii:size-3.5 uii:items-center uii:justify-center"
|
|
4896
|
+
}, /* @__PURE__ */ React3.createElement(SelectPrimitive.ItemIndicator, null, /* @__PURE__ */ React3.createElement(CheckIcon, {
|
|
4897
|
+
className: "uii:size-4"
|
|
4898
|
+
}))), /* @__PURE__ */ React3.createElement(SelectPrimitive.ItemText, null, children));
|
|
4899
|
+
}
|
|
4900
|
+
function SelectScrollUpButton(_param) {
|
|
4901
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
4902
|
+
"className"
|
|
4903
|
+
]);
|
|
4904
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.ScrollUpButton, _object_spread({
|
|
4905
|
+
"data-slot": "select-scroll-up-button",
|
|
4906
|
+
className: cn("uii:flex uii:cursor-default uii:items-center uii:justify-center uii:py-1", className)
|
|
4907
|
+
}, props), /* @__PURE__ */ React3.createElement(ChevronUpIcon, {
|
|
4908
|
+
className: "uii:size-4"
|
|
4909
|
+
}));
|
|
4910
|
+
}
|
|
4911
|
+
function SelectScrollDownButton(_param) {
|
|
4912
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
4913
|
+
"className"
|
|
4914
|
+
]);
|
|
4915
|
+
return /* @__PURE__ */ React3.createElement(SelectPrimitive.ScrollDownButton, _object_spread({
|
|
4916
|
+
"data-slot": "select-scroll-down-button",
|
|
4917
|
+
className: cn("uii:flex uii:cursor-default uii:items-center uii:justify-center uii:py-1", className)
|
|
4918
|
+
}, props), /* @__PURE__ */ React3.createElement(ChevronDownIcon, {
|
|
4919
|
+
className: "uii:size-4"
|
|
4920
|
+
}));
|
|
4921
|
+
}
|
|
4922
|
+
// src/components/fields/Select.tsx
|
|
4923
|
+
function Select2(param) {
|
|
4795
4924
|
var fieldName = param.fieldName, label = param.label, value = param.value, onChange = param.onChange, rawOptions = param.options, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, placeholder = param.placeholder, _param_expectedType = param.expectedType, expectedType = _param_expectedType === void 0 ? "string" : _param_expectedType, _param_required = param.required, required = _param_required === void 0 ? false : _param_required, _param_hasRequiredError = param.hasRequiredError, hasRequiredError = _param_hasRequiredError === void 0 ? false : _param_hasRequiredError, className = param.className, children = param.children;
|
|
4796
4925
|
var _React3_useState = _sliced_to_array(React3.useState(false), 2), isExpressionMode = _React3_useState[0], setIsExpressionMode = _React3_useState[1];
|
|
4797
4926
|
var _React3_useState1 = _sliced_to_array(React3.useState(""), 2), expressionValue = _React3_useState1[0], setExpressionValue = _React3_useState1[1];
|
|
@@ -4913,26 +5042,177 @@ function Select(param) {
|
|
|
4913
5042
|
className: "uii:flex uii:items-center uii:justify-center uii:h-full uii:px-2 uii:text-amber-600 hover:uii:text-red-600 uii:border-l uii:border-amber-500/30",
|
|
4914
5043
|
title: "Clear and return to value mode"
|
|
4915
5044
|
}, "\xD7")) : // Value mode - show select
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
5045
|
+
// <select
|
|
5046
|
+
// id={fieldName}
|
|
5047
|
+
// name={fieldName}
|
|
5048
|
+
// value={displayValue}
|
|
5049
|
+
// onChange={(e) => handleSelectChange(e.target.value)}
|
|
5050
|
+
// disabled={disabled}
|
|
5051
|
+
// className={cn(
|
|
5052
|
+
// 'uii:w-full uii:h-9 uii:px-3 uii:rounded-sm uii:border uii:bg-background uii:text-sm',
|
|
5053
|
+
// 'uii:outline-none uii:transition-all uii:cursor-pointer',
|
|
5054
|
+
// 'focus:uii:border-ring focus:uii:ring-ring/50 focus:uii:ring-[3px]',
|
|
5055
|
+
// showError
|
|
5056
|
+
// ? 'uii:border-red-500 hover:uii:border-red-600'
|
|
5057
|
+
// : 'uii:border-input hover:uii:border-ring/50',
|
|
5058
|
+
// disabled && 'uii:opacity-50 uii:cursor-not-allowed'
|
|
5059
|
+
// )}
|
|
5060
|
+
// >
|
|
5061
|
+
// {placeholder && (
|
|
5062
|
+
// <option value="" disabled>
|
|
5063
|
+
// {placeholder}
|
|
5064
|
+
// </option>
|
|
5065
|
+
// )}
|
|
5066
|
+
// {options.map(opt => (
|
|
5067
|
+
// <option key={opt.value} value={opt.value}>
|
|
5068
|
+
// {opt.label}
|
|
5069
|
+
// </option>
|
|
5070
|
+
// ))}
|
|
5071
|
+
// <option value="__expression__">
|
|
5072
|
+
// 📝 Custom Expression
|
|
5073
|
+
// </option>
|
|
5074
|
+
// </select>
|
|
5075
|
+
/* @__PURE__ */ React3.createElement(Select, {
|
|
4919
5076
|
value: displayValue,
|
|
4920
|
-
|
|
4921
|
-
return handleSelectChange(e
|
|
5077
|
+
onValueChange: function(e) {
|
|
5078
|
+
return handleSelectChange(e);
|
|
4922
5079
|
},
|
|
4923
|
-
disabled: disabled
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
},
|
|
4929
|
-
return /* @__PURE__ */ React3.createElement(
|
|
5080
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : disabled
|
|
5081
|
+
}, /* @__PURE__ */ React3.createElement(SelectTrigger, {
|
|
5082
|
+
className: "ui:w-full ui:h-9 ui:px-3 ui:border ui:border-input ui:rounded-sm ui:bg-background"
|
|
5083
|
+
}, /* @__PURE__ */ React3.createElement(SelectValue, {
|
|
5084
|
+
placeholder: placeholder
|
|
5085
|
+
})), /* @__PURE__ */ React3.createElement(SelectContent, null, options.map(function(opt) {
|
|
5086
|
+
return /* @__PURE__ */ React3.createElement(SelectItem, {
|
|
4930
5087
|
key: opt.value,
|
|
4931
5088
|
value: opt.value
|
|
4932
|
-
}, opt.label);
|
|
4933
|
-
})
|
|
4934
|
-
|
|
4935
|
-
|
|
5089
|
+
}, opt.node ? opt.node : /* @__PURE__ */ React3.createElement(React3.Fragment, null, opt.label));
|
|
5090
|
+
})))));
|
|
5091
|
+
}
|
|
5092
|
+
// src/components/template-editor/operatorTypes.ts
|
|
5093
|
+
function parseInferredTypes(typeStr) {
|
|
5094
|
+
var result = {
|
|
5095
|
+
baseTypes: [],
|
|
5096
|
+
stringConstants: [],
|
|
5097
|
+
numberConstants: [],
|
|
5098
|
+
hasConstants: false,
|
|
5099
|
+
rawTypes: []
|
|
5100
|
+
};
|
|
5101
|
+
if (!typeStr || typeStr === "any" || typeStr === "unknown") {
|
|
5102
|
+
result.baseTypes = [
|
|
5103
|
+
"any"
|
|
5104
|
+
];
|
|
5105
|
+
result.rawTypes = [
|
|
5106
|
+
"any"
|
|
5107
|
+
];
|
|
5108
|
+
return result;
|
|
5109
|
+
}
|
|
5110
|
+
var types = typeStr.split("|").map(function(t) {
|
|
5111
|
+
return t.trim();
|
|
5112
|
+
}).filter(Boolean);
|
|
5113
|
+
var baseTypesSet = /* @__PURE__ */ new Set();
|
|
5114
|
+
var rawTypesSet = /* @__PURE__ */ new Set();
|
|
5115
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5116
|
+
try {
|
|
5117
|
+
for(var _iterator = types[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5118
|
+
var t = _step.value;
|
|
5119
|
+
rawTypesSet.add(t);
|
|
5120
|
+
var stringLiteralMatch = t.match(/^["'](.*)["']$/);
|
|
5121
|
+
if (stringLiteralMatch && stringLiteralMatch[1] !== void 0) {
|
|
5122
|
+
result.stringConstants.push(stringLiteralMatch[1]);
|
|
5123
|
+
baseTypesSet.add("string");
|
|
5124
|
+
result.hasConstants = true;
|
|
5125
|
+
continue;
|
|
5126
|
+
}
|
|
5127
|
+
if (/^-?\d+(\.\d+)?$/.test(t)) {
|
|
5128
|
+
result.numberConstants.push(parseFloat(t));
|
|
5129
|
+
baseTypesSet.add("number");
|
|
5130
|
+
result.hasConstants = true;
|
|
5131
|
+
continue;
|
|
5132
|
+
}
|
|
5133
|
+
if (t === "true" || t === "false") {
|
|
5134
|
+
baseTypesSet.add("boolean");
|
|
5135
|
+
result.hasConstants = true;
|
|
5136
|
+
continue;
|
|
5137
|
+
}
|
|
5138
|
+
baseTypesSet.add(t);
|
|
5139
|
+
}
|
|
5140
|
+
} catch (err) {
|
|
5141
|
+
_didIteratorError = true;
|
|
5142
|
+
_iteratorError = err;
|
|
5143
|
+
} finally{
|
|
5144
|
+
try {
|
|
5145
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5146
|
+
_iterator.return();
|
|
5147
|
+
}
|
|
5148
|
+
} finally{
|
|
5149
|
+
if (_didIteratorError) {
|
|
5150
|
+
throw _iteratorError;
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
result.baseTypes = Array.from(baseTypesSet);
|
|
5155
|
+
result.rawTypes = Array.from(rawTypesSet);
|
|
5156
|
+
return result;
|
|
5157
|
+
}
|
|
5158
|
+
function computeExtendedType(inferredType, opDef) {
|
|
5159
|
+
if (!opDef.extendsWithBase || opDef.narrowsTo === "never") {
|
|
5160
|
+
return opDef.narrowsTo;
|
|
5161
|
+
}
|
|
5162
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5163
|
+
var matchingTypes = [];
|
|
5164
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5165
|
+
try {
|
|
5166
|
+
for(var _iterator = parsed.rawTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5167
|
+
var t = _step.value;
|
|
5168
|
+
if (opDef.narrowsTo === "string") {
|
|
5169
|
+
if (t === "string" || /^["'].*["']$/.test(t)) {
|
|
5170
|
+
matchingTypes.push(t);
|
|
5171
|
+
}
|
|
5172
|
+
} else if (opDef.narrowsTo === "number") {
|
|
5173
|
+
if (t === "number" || /^-?\d+(\.\d+)?$/.test(t)) {
|
|
5174
|
+
matchingTypes.push(t);
|
|
5175
|
+
}
|
|
5176
|
+
} else if (opDef.narrowsTo === "boolean") {
|
|
5177
|
+
if (t === "boolean" || t === "true" || t === "false") {
|
|
5178
|
+
matchingTypes.push(t);
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
}
|
|
5182
|
+
} catch (err) {
|
|
5183
|
+
_didIteratorError = true;
|
|
5184
|
+
_iteratorError = err;
|
|
5185
|
+
} finally{
|
|
5186
|
+
try {
|
|
5187
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5188
|
+
_iterator.return();
|
|
5189
|
+
}
|
|
5190
|
+
} finally{
|
|
5191
|
+
if (_didIteratorError) {
|
|
5192
|
+
throw _iteratorError;
|
|
5193
|
+
}
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5196
|
+
if (opDef.extendsWithBase && !matchingTypes.includes(opDef.narrowsTo)) {
|
|
5197
|
+
matchingTypes.push(opDef.narrowsTo);
|
|
5198
|
+
}
|
|
5199
|
+
return matchingTypes.length > 0 ? matchingTypes.join(" | ") : opDef.narrowsTo;
|
|
5200
|
+
}
|
|
5201
|
+
function filterOperatorsByType(operators, inferredType) {
|
|
5202
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5203
|
+
var baseTypes = parsed.baseTypes;
|
|
5204
|
+
return operators.filter(function(op) {
|
|
5205
|
+
if (op.types.includes("any")) return true;
|
|
5206
|
+
return op.types.some(function(t) {
|
|
5207
|
+
return baseTypes.includes(t) || baseTypes.includes("any");
|
|
5208
|
+
});
|
|
5209
|
+
});
|
|
5210
|
+
}
|
|
5211
|
+
function getStringConstants(inferredType) {
|
|
5212
|
+
return parseInferredTypes(inferredType).stringConstants;
|
|
5213
|
+
}
|
|
5214
|
+
function getNumberConstants(inferredType) {
|
|
5215
|
+
return parseInferredTypes(inferredType).numberConstants;
|
|
4936
5216
|
}
|
|
4937
5217
|
// src/components/fields/index.tsx
|
|
4938
5218
|
function useTemplateFieldContext() {
|
|
@@ -4961,11 +5241,11 @@ function useFieldPath(fieldName) {
|
|
|
4961
5241
|
}
|
|
4962
5242
|
function TemplateFieldProvider(param) {
|
|
4963
5243
|
var children = param.children;
|
|
4964
|
-
return /* @__PURE__ */
|
|
5244
|
+
return /* @__PURE__ */ React3__default.createElement(React3__default.Fragment, null, children);
|
|
4965
5245
|
}
|
|
4966
5246
|
function NestedFieldProvider(param) {
|
|
4967
5247
|
var children = param.children;
|
|
4968
|
-
return /* @__PURE__ */
|
|
5248
|
+
return /* @__PURE__ */ React3__default.createElement(React3__default.Fragment, null, children);
|
|
4969
5249
|
}
|
|
4970
5250
|
var InferredTypesContext = createContext(null);
|
|
4971
5251
|
function useInferredTypes() {
|
|
@@ -4973,7 +5253,7 @@ function useInferredTypes() {
|
|
|
4973
5253
|
}
|
|
4974
5254
|
function InferredTypesProvider(param) {
|
|
4975
5255
|
var children = param.children;
|
|
4976
|
-
return /* @__PURE__ */
|
|
5256
|
+
return /* @__PURE__ */ React3__default.createElement(React3__default.Fragment, null, children);
|
|
4977
5257
|
}
|
|
4978
5258
|
function intersectTypes(types) {
|
|
4979
5259
|
var validTypes = types.filter(function(t) {
|
|
@@ -5094,5 +5374,76 @@ function getOperatorsForType(type) {
|
|
|
5094
5374
|
}
|
|
5095
5375
|
];
|
|
5096
5376
|
}
|
|
5097
|
-
|
|
5377
|
+
function NodePropertyProvider(param) {
|
|
5378
|
+
var children = param.children;
|
|
5379
|
+
return /* @__PURE__ */ React3__default.createElement(React3__default.Fragment, null, children);
|
|
5380
|
+
}
|
|
5381
|
+
function useIsInNodePropertyProvider() {
|
|
5382
|
+
return false;
|
|
5383
|
+
}
|
|
5384
|
+
function useNodeProperty(key) {
|
|
5385
|
+
var noopSetter = useCallback(function() {
|
|
5386
|
+
console.warn('[useNodeProperty] Mock mode - cannot set "'.concat(key, '"'));
|
|
5387
|
+
}, [
|
|
5388
|
+
key
|
|
5389
|
+
]);
|
|
5390
|
+
return [
|
|
5391
|
+
void 0,
|
|
5392
|
+
noopSetter
|
|
5393
|
+
];
|
|
5394
|
+
}
|
|
5395
|
+
function useNodeProperties() {
|
|
5396
|
+
var noopSetter = useCallback(function() {
|
|
5397
|
+
console.warn("[useNodeProperties] Mock mode - cannot set properties");
|
|
5398
|
+
}, []);
|
|
5399
|
+
return [
|
|
5400
|
+
{},
|
|
5401
|
+
noopSetter
|
|
5402
|
+
];
|
|
5403
|
+
}
|
|
5404
|
+
function useInferredType(fieldName) {
|
|
5405
|
+
return void 0;
|
|
5406
|
+
}
|
|
5407
|
+
function useSetInferredType() {
|
|
5408
|
+
return useCallback(function(fieldName, type) {
|
|
5409
|
+
console.warn('[useSetInferredType] Mock mode - cannot set "'.concat(fieldName, '" to "').concat(type, '"'));
|
|
5410
|
+
}, []);
|
|
5411
|
+
}
|
|
5412
|
+
function useAllInferredTypes() {
|
|
5413
|
+
return {};
|
|
5414
|
+
}
|
|
5415
|
+
function useSetProperty() {
|
|
5416
|
+
return useCallback(function(key, value) {
|
|
5417
|
+
console.warn('[useSetProperty] Mock mode - cannot set "'.concat(key, '"'));
|
|
5418
|
+
}, []);
|
|
5419
|
+
}
|
|
5420
|
+
function useFieldValidation() {
|
|
5421
|
+
var setFieldRequired = useCallback(function(fieldName, required) {
|
|
5422
|
+
console.warn('[useFieldValidation] Mock mode - cannot set required for "'.concat(fieldName, '"'));
|
|
5423
|
+
}, []);
|
|
5424
|
+
var setFieldRequiredIf = useCallback(function(fieldName, requiredIf) {
|
|
5425
|
+
console.warn('[useFieldValidation] Mock mode - cannot set requiredIf for "'.concat(fieldName, '"'));
|
|
5426
|
+
}, []);
|
|
5427
|
+
var setFieldValidation = useCallback(function(fieldName, customValidation) {
|
|
5428
|
+
console.warn('[useFieldValidation] Mock mode - cannot set validation for "'.concat(fieldName, '"'));
|
|
5429
|
+
}, []);
|
|
5430
|
+
var clearFieldValidation = useCallback(function(fieldName) {
|
|
5431
|
+
console.warn('[useFieldValidation] Mock mode - cannot clear validation for "'.concat(fieldName, '"'));
|
|
5432
|
+
}, []);
|
|
5433
|
+
var isFieldRequired = useCallback(function(fieldName) {
|
|
5434
|
+
return false;
|
|
5435
|
+
}, []);
|
|
5436
|
+
var validateField = useCallback(function(fieldName) {
|
|
5437
|
+
return null;
|
|
5438
|
+
}, []);
|
|
5439
|
+
return {
|
|
5440
|
+
setFieldRequired: setFieldRequired,
|
|
5441
|
+
setFieldRequiredIf: setFieldRequiredIf,
|
|
5442
|
+
setFieldValidation: setFieldValidation,
|
|
5443
|
+
clearFieldValidation: clearFieldValidation,
|
|
5444
|
+
isFieldRequired: isFieldRequired,
|
|
5445
|
+
validateField: validateField
|
|
5446
|
+
};
|
|
5447
|
+
}
|
|
5448
|
+
export { InferredTypesContext, InferredTypesProvider, Input, NestedFieldProvider, NodePropertyProvider, OPERATORS_BY_TYPE, Select2 as Select, TemplateFieldProvider, computeExtendedType, filterOperatorsByType, getNumberConstants, getOperatorsForType, getStringConstants, intersectTypes, parseInferSyntax, parseInferredTypes, useAllInferredTypes, useFieldPath, useFieldValidation, useInferredType, useInferredTypes, useIsInNodePropertyProvider, useIsInTemplateFieldProvider, useNodeProperties, useNodeProperty, useSetInferredType, useSetProperty, useTemplateFieldContext }; //# sourceMappingURL=index.js.map
|
|
5098
5449
|
//# sourceMappingURL=index.js.map
|