@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
|
@@ -23,6 +23,20 @@ function _define_property(obj, key, value) {
|
|
|
23
23
|
}
|
|
24
24
|
return obj;
|
|
25
25
|
}
|
|
26
|
+
function _extends() {
|
|
27
|
+
_extends = Object.assign || function(target) {
|
|
28
|
+
for(var i = 1; i < arguments.length; i++){
|
|
29
|
+
var source = arguments[i];
|
|
30
|
+
for(var key in source){
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
return _extends.apply(this, arguments);
|
|
39
|
+
}
|
|
26
40
|
function _iterable_to_array(iter) {
|
|
27
41
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
28
42
|
}
|
|
@@ -56,6 +70,10 @@ function _non_iterable_rest() {
|
|
|
56
70
|
function _non_iterable_spread() {
|
|
57
71
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
72
|
}
|
|
73
|
+
function _object_destructuring_empty(o) {
|
|
74
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
75
|
+
return o;
|
|
76
|
+
}
|
|
59
77
|
function _object_spread(target) {
|
|
60
78
|
for(var i = 1; i < arguments.length; i++){
|
|
61
79
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -71,6 +89,33 @@ function _object_spread(target) {
|
|
|
71
89
|
}
|
|
72
90
|
return target;
|
|
73
91
|
}
|
|
92
|
+
function _object_without_properties(source, excluded) {
|
|
93
|
+
if (source == null) return {};
|
|
94
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
95
|
+
var key, i;
|
|
96
|
+
if (Object.getOwnPropertySymbols) {
|
|
97
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
98
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
99
|
+
key = sourceSymbolKeys[i];
|
|
100
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
101
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
102
|
+
target[key] = source[key];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return target;
|
|
106
|
+
}
|
|
107
|
+
function _object_without_properties_loose(source, excluded) {
|
|
108
|
+
if (source == null) return {};
|
|
109
|
+
var target = {};
|
|
110
|
+
var sourceKeys = Object.keys(source);
|
|
111
|
+
var key, i;
|
|
112
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
113
|
+
key = sourceKeys[i];
|
|
114
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
115
|
+
target[key] = source[key];
|
|
116
|
+
}
|
|
117
|
+
return target;
|
|
118
|
+
}
|
|
74
119
|
function _sliced_to_array(arr, i) {
|
|
75
120
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
76
121
|
}
|
|
@@ -90,6 +135,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
90
135
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
91
136
|
}
|
|
92
137
|
var React3 = require('react');
|
|
138
|
+
var SelectPrimitive = require('@radix-ui/react-select');
|
|
139
|
+
var lucideReact = require('lucide-react');
|
|
93
140
|
function _interopNamespace(e) {
|
|
94
141
|
if (e && e.__esModule) return e;
|
|
95
142
|
var n = Object.create(null);
|
|
@@ -110,6 +157,7 @@ function _interopNamespace(e) {
|
|
|
110
157
|
return Object.freeze(n);
|
|
111
158
|
}
|
|
112
159
|
var React3__namespace = /*#__PURE__*/ _interopNamespace(React3);
|
|
160
|
+
var SelectPrimitive__namespace = /*#__PURE__*/ _interopNamespace(SelectPrimitive);
|
|
113
161
|
// src/components/fields/index.tsx
|
|
114
162
|
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
115
163
|
function r(e) {
|
|
@@ -4811,7 +4859,89 @@ function Input(param) {
|
|
|
4811
4859
|
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)
|
|
4812
4860
|
})));
|
|
4813
4861
|
}
|
|
4814
|
-
function Select(
|
|
4862
|
+
function Select(_param) {
|
|
4863
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
4864
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Root, _object_spread({
|
|
4865
|
+
"data-slot": "select"
|
|
4866
|
+
}, props));
|
|
4867
|
+
}
|
|
4868
|
+
function SelectValue(_param) {
|
|
4869
|
+
var props = _extends({}, _object_destructuring_empty(_param));
|
|
4870
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Value, _object_spread({
|
|
4871
|
+
"data-slot": "select-value"
|
|
4872
|
+
}, props));
|
|
4873
|
+
}
|
|
4874
|
+
function SelectTrigger(_param) {
|
|
4875
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
4876
|
+
"className",
|
|
4877
|
+
"children"
|
|
4878
|
+
]);
|
|
4879
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Trigger, _object_spread({
|
|
4880
|
+
"data-slot": "select-trigger",
|
|
4881
|
+
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)
|
|
4882
|
+
}, props), children, /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Icon, {
|
|
4883
|
+
asChild: true
|
|
4884
|
+
}, /* @__PURE__ */ React3__namespace.createElement(lucideReact.ChevronDownIcon, {
|
|
4885
|
+
className: "uii:size-4 uii:opacity-50"
|
|
4886
|
+
})));
|
|
4887
|
+
}
|
|
4888
|
+
function SelectContent(_param) {
|
|
4889
|
+
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, [
|
|
4890
|
+
"className",
|
|
4891
|
+
"children",
|
|
4892
|
+
"position",
|
|
4893
|
+
"footer",
|
|
4894
|
+
"hideScrollUpButton",
|
|
4895
|
+
"hideScrollDownButton"
|
|
4896
|
+
]);
|
|
4897
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Portal, null, /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Content, _object_spread({
|
|
4898
|
+
"data-slot": "select-content",
|
|
4899
|
+
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),
|
|
4900
|
+
position: position
|
|
4901
|
+
}, props), !hideScrollUpButton && /* @__PURE__ */ React3__namespace.createElement(SelectScrollUpButton, null), /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Viewport, {
|
|
4902
|
+
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")
|
|
4903
|
+
}, children), footer ? /* @__PURE__ */ React3__namespace.createElement("div", {
|
|
4904
|
+
className: "uii:border-t uii:p-2 uii:bg-popover"
|
|
4905
|
+
}, footer) : null, !hideScrollDownButton && /* @__PURE__ */ React3__namespace.createElement(SelectScrollDownButton, null)));
|
|
4906
|
+
}
|
|
4907
|
+
function SelectItem(_param) {
|
|
4908
|
+
var className = _param.className, children = _param.children, props = _object_without_properties(_param, [
|
|
4909
|
+
"className",
|
|
4910
|
+
"children"
|
|
4911
|
+
]);
|
|
4912
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.Item, _object_spread({
|
|
4913
|
+
"data-slot": "select-item",
|
|
4914
|
+
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)
|
|
4915
|
+
}, props), /* @__PURE__ */ React3__namespace.createElement("span", {
|
|
4916
|
+
className: "uii:absolute uii:right-2 uii:flex uii:size-3.5 uii:items-center uii:justify-center"
|
|
4917
|
+
}, /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.ItemIndicator, null, /* @__PURE__ */ React3__namespace.createElement(lucideReact.CheckIcon, {
|
|
4918
|
+
className: "uii:size-4"
|
|
4919
|
+
}))), /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.ItemText, null, children));
|
|
4920
|
+
}
|
|
4921
|
+
function SelectScrollUpButton(_param) {
|
|
4922
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
4923
|
+
"className"
|
|
4924
|
+
]);
|
|
4925
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.ScrollUpButton, _object_spread({
|
|
4926
|
+
"data-slot": "select-scroll-up-button",
|
|
4927
|
+
className: cn("uii:flex uii:cursor-default uii:items-center uii:justify-center uii:py-1", className)
|
|
4928
|
+
}, props), /* @__PURE__ */ React3__namespace.createElement(lucideReact.ChevronUpIcon, {
|
|
4929
|
+
className: "uii:size-4"
|
|
4930
|
+
}));
|
|
4931
|
+
}
|
|
4932
|
+
function SelectScrollDownButton(_param) {
|
|
4933
|
+
var className = _param.className, props = _object_without_properties(_param, [
|
|
4934
|
+
"className"
|
|
4935
|
+
]);
|
|
4936
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectPrimitive__namespace.ScrollDownButton, _object_spread({
|
|
4937
|
+
"data-slot": "select-scroll-down-button",
|
|
4938
|
+
className: cn("uii:flex uii:cursor-default uii:items-center uii:justify-center uii:py-1", className)
|
|
4939
|
+
}, props), /* @__PURE__ */ React3__namespace.createElement(lucideReact.ChevronDownIcon, {
|
|
4940
|
+
className: "uii:size-4"
|
|
4941
|
+
}));
|
|
4942
|
+
}
|
|
4943
|
+
// src/components/fields/Select.tsx
|
|
4944
|
+
function Select2(param) {
|
|
4815
4945
|
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;
|
|
4816
4946
|
var _React3__namespace_useState = _sliced_to_array(React3__namespace.useState(false), 2), isExpressionMode = _React3__namespace_useState[0], setIsExpressionMode = _React3__namespace_useState[1];
|
|
4817
4947
|
var _React3__namespace_useState1 = _sliced_to_array(React3__namespace.useState(""), 2), expressionValue = _React3__namespace_useState1[0], setExpressionValue = _React3__namespace_useState1[1];
|
|
@@ -4933,26 +5063,177 @@ function Select(param) {
|
|
|
4933
5063
|
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",
|
|
4934
5064
|
title: "Clear and return to value mode"
|
|
4935
5065
|
}, "\xD7")) : // Value mode - show select
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
5066
|
+
// <select
|
|
5067
|
+
// id={fieldName}
|
|
5068
|
+
// name={fieldName}
|
|
5069
|
+
// value={displayValue}
|
|
5070
|
+
// onChange={(e) => handleSelectChange(e.target.value)}
|
|
5071
|
+
// disabled={disabled}
|
|
5072
|
+
// className={cn(
|
|
5073
|
+
// 'uii:w-full uii:h-9 uii:px-3 uii:rounded-sm uii:border uii:bg-background uii:text-sm',
|
|
5074
|
+
// 'uii:outline-none uii:transition-all uii:cursor-pointer',
|
|
5075
|
+
// 'focus:uii:border-ring focus:uii:ring-ring/50 focus:uii:ring-[3px]',
|
|
5076
|
+
// showError
|
|
5077
|
+
// ? 'uii:border-red-500 hover:uii:border-red-600'
|
|
5078
|
+
// : 'uii:border-input hover:uii:border-ring/50',
|
|
5079
|
+
// disabled && 'uii:opacity-50 uii:cursor-not-allowed'
|
|
5080
|
+
// )}
|
|
5081
|
+
// >
|
|
5082
|
+
// {placeholder && (
|
|
5083
|
+
// <option value="" disabled>
|
|
5084
|
+
// {placeholder}
|
|
5085
|
+
// </option>
|
|
5086
|
+
// )}
|
|
5087
|
+
// {options.map(opt => (
|
|
5088
|
+
// <option key={opt.value} value={opt.value}>
|
|
5089
|
+
// {opt.label}
|
|
5090
|
+
// </option>
|
|
5091
|
+
// ))}
|
|
5092
|
+
// <option value="__expression__">
|
|
5093
|
+
// 📝 Custom Expression
|
|
5094
|
+
// </option>
|
|
5095
|
+
// </select>
|
|
5096
|
+
/* @__PURE__ */ React3__namespace.createElement(Select, {
|
|
4939
5097
|
value: displayValue,
|
|
4940
|
-
|
|
4941
|
-
return handleSelectChange(e
|
|
5098
|
+
onValueChange: function(e) {
|
|
5099
|
+
return handleSelectChange(e);
|
|
4942
5100
|
},
|
|
4943
|
-
disabled: disabled
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
},
|
|
4949
|
-
return /* @__PURE__ */ React3__namespace.createElement(
|
|
5101
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : disabled
|
|
5102
|
+
}, /* @__PURE__ */ React3__namespace.createElement(SelectTrigger, {
|
|
5103
|
+
className: "ui:w-full ui:h-9 ui:px-3 ui:border ui:border-input ui:rounded-sm ui:bg-background"
|
|
5104
|
+
}, /* @__PURE__ */ React3__namespace.createElement(SelectValue, {
|
|
5105
|
+
placeholder: placeholder
|
|
5106
|
+
})), /* @__PURE__ */ React3__namespace.createElement(SelectContent, null, options.map(function(opt) {
|
|
5107
|
+
return /* @__PURE__ */ React3__namespace.createElement(SelectItem, {
|
|
4950
5108
|
key: opt.value,
|
|
4951
5109
|
value: opt.value
|
|
4952
|
-
}, opt.label);
|
|
4953
|
-
})
|
|
4954
|
-
|
|
4955
|
-
|
|
5110
|
+
}, opt.node ? opt.node : /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, opt.label));
|
|
5111
|
+
})))));
|
|
5112
|
+
}
|
|
5113
|
+
// src/components/template-editor/operatorTypes.ts
|
|
5114
|
+
function parseInferredTypes(typeStr) {
|
|
5115
|
+
var result = {
|
|
5116
|
+
baseTypes: [],
|
|
5117
|
+
stringConstants: [],
|
|
5118
|
+
numberConstants: [],
|
|
5119
|
+
hasConstants: false,
|
|
5120
|
+
rawTypes: []
|
|
5121
|
+
};
|
|
5122
|
+
if (!typeStr || typeStr === "any" || typeStr === "unknown") {
|
|
5123
|
+
result.baseTypes = [
|
|
5124
|
+
"any"
|
|
5125
|
+
];
|
|
5126
|
+
result.rawTypes = [
|
|
5127
|
+
"any"
|
|
5128
|
+
];
|
|
5129
|
+
return result;
|
|
5130
|
+
}
|
|
5131
|
+
var types = typeStr.split("|").map(function(t) {
|
|
5132
|
+
return t.trim();
|
|
5133
|
+
}).filter(Boolean);
|
|
5134
|
+
var baseTypesSet = /* @__PURE__ */ new Set();
|
|
5135
|
+
var rawTypesSet = /* @__PURE__ */ new Set();
|
|
5136
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5137
|
+
try {
|
|
5138
|
+
for(var _iterator = types[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5139
|
+
var t = _step.value;
|
|
5140
|
+
rawTypesSet.add(t);
|
|
5141
|
+
var stringLiteralMatch = t.match(/^["'](.*)["']$/);
|
|
5142
|
+
if (stringLiteralMatch && stringLiteralMatch[1] !== void 0) {
|
|
5143
|
+
result.stringConstants.push(stringLiteralMatch[1]);
|
|
5144
|
+
baseTypesSet.add("string");
|
|
5145
|
+
result.hasConstants = true;
|
|
5146
|
+
continue;
|
|
5147
|
+
}
|
|
5148
|
+
if (/^-?\d+(\.\d+)?$/.test(t)) {
|
|
5149
|
+
result.numberConstants.push(parseFloat(t));
|
|
5150
|
+
baseTypesSet.add("number");
|
|
5151
|
+
result.hasConstants = true;
|
|
5152
|
+
continue;
|
|
5153
|
+
}
|
|
5154
|
+
if (t === "true" || t === "false") {
|
|
5155
|
+
baseTypesSet.add("boolean");
|
|
5156
|
+
result.hasConstants = true;
|
|
5157
|
+
continue;
|
|
5158
|
+
}
|
|
5159
|
+
baseTypesSet.add(t);
|
|
5160
|
+
}
|
|
5161
|
+
} catch (err) {
|
|
5162
|
+
_didIteratorError = true;
|
|
5163
|
+
_iteratorError = err;
|
|
5164
|
+
} finally{
|
|
5165
|
+
try {
|
|
5166
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5167
|
+
_iterator.return();
|
|
5168
|
+
}
|
|
5169
|
+
} finally{
|
|
5170
|
+
if (_didIteratorError) {
|
|
5171
|
+
throw _iteratorError;
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5175
|
+
result.baseTypes = Array.from(baseTypesSet);
|
|
5176
|
+
result.rawTypes = Array.from(rawTypesSet);
|
|
5177
|
+
return result;
|
|
5178
|
+
}
|
|
5179
|
+
function computeExtendedType(inferredType, opDef) {
|
|
5180
|
+
if (!opDef.extendsWithBase || opDef.narrowsTo === "never") {
|
|
5181
|
+
return opDef.narrowsTo;
|
|
5182
|
+
}
|
|
5183
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5184
|
+
var matchingTypes = [];
|
|
5185
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5186
|
+
try {
|
|
5187
|
+
for(var _iterator = parsed.rawTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5188
|
+
var t = _step.value;
|
|
5189
|
+
if (opDef.narrowsTo === "string") {
|
|
5190
|
+
if (t === "string" || /^["'].*["']$/.test(t)) {
|
|
5191
|
+
matchingTypes.push(t);
|
|
5192
|
+
}
|
|
5193
|
+
} else if (opDef.narrowsTo === "number") {
|
|
5194
|
+
if (t === "number" || /^-?\d+(\.\d+)?$/.test(t)) {
|
|
5195
|
+
matchingTypes.push(t);
|
|
5196
|
+
}
|
|
5197
|
+
} else if (opDef.narrowsTo === "boolean") {
|
|
5198
|
+
if (t === "boolean" || t === "true" || t === "false") {
|
|
5199
|
+
matchingTypes.push(t);
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5203
|
+
} catch (err) {
|
|
5204
|
+
_didIteratorError = true;
|
|
5205
|
+
_iteratorError = err;
|
|
5206
|
+
} finally{
|
|
5207
|
+
try {
|
|
5208
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5209
|
+
_iterator.return();
|
|
5210
|
+
}
|
|
5211
|
+
} finally{
|
|
5212
|
+
if (_didIteratorError) {
|
|
5213
|
+
throw _iteratorError;
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
if (opDef.extendsWithBase && !matchingTypes.includes(opDef.narrowsTo)) {
|
|
5218
|
+
matchingTypes.push(opDef.narrowsTo);
|
|
5219
|
+
}
|
|
5220
|
+
return matchingTypes.length > 0 ? matchingTypes.join(" | ") : opDef.narrowsTo;
|
|
5221
|
+
}
|
|
5222
|
+
function filterOperatorsByType(operators, inferredType) {
|
|
5223
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5224
|
+
var baseTypes = parsed.baseTypes;
|
|
5225
|
+
return operators.filter(function(op) {
|
|
5226
|
+
if (op.types.includes("any")) return true;
|
|
5227
|
+
return op.types.some(function(t) {
|
|
5228
|
+
return baseTypes.includes(t) || baseTypes.includes("any");
|
|
5229
|
+
});
|
|
5230
|
+
});
|
|
5231
|
+
}
|
|
5232
|
+
function getStringConstants(inferredType) {
|
|
5233
|
+
return parseInferredTypes(inferredType).stringConstants;
|
|
5234
|
+
}
|
|
5235
|
+
function getNumberConstants(inferredType) {
|
|
5236
|
+
return parseInferredTypes(inferredType).numberConstants;
|
|
4956
5237
|
}
|
|
4957
5238
|
// src/components/fields/index.tsx
|
|
4958
5239
|
function useTemplateFieldContext() {
|
|
@@ -4981,11 +5262,11 @@ function useFieldPath(fieldName) {
|
|
|
4981
5262
|
}
|
|
4982
5263
|
function TemplateFieldProvider(param) {
|
|
4983
5264
|
var children = param.children;
|
|
4984
|
-
return /* @__PURE__ */
|
|
5265
|
+
return /* @__PURE__ */ React3__namespace.default.createElement(React3__namespace.default.Fragment, null, children);
|
|
4985
5266
|
}
|
|
4986
5267
|
function NestedFieldProvider(param) {
|
|
4987
5268
|
var children = param.children;
|
|
4988
|
-
return /* @__PURE__ */
|
|
5269
|
+
return /* @__PURE__ */ React3__namespace.default.createElement(React3__namespace.default.Fragment, null, children);
|
|
4989
5270
|
}
|
|
4990
5271
|
var InferredTypesContext = React3.createContext(null);
|
|
4991
5272
|
function useInferredTypes() {
|
|
@@ -4993,7 +5274,7 @@ function useInferredTypes() {
|
|
|
4993
5274
|
}
|
|
4994
5275
|
function InferredTypesProvider(param) {
|
|
4995
5276
|
var children = param.children;
|
|
4996
|
-
return /* @__PURE__ */
|
|
5277
|
+
return /* @__PURE__ */ React3__namespace.default.createElement(React3__namespace.default.Fragment, null, children);
|
|
4997
5278
|
}
|
|
4998
5279
|
function intersectTypes(types) {
|
|
4999
5280
|
var validTypes = types.filter(function(t) {
|
|
@@ -5114,18 +5395,103 @@ function getOperatorsForType(type) {
|
|
|
5114
5395
|
}
|
|
5115
5396
|
];
|
|
5116
5397
|
}
|
|
5398
|
+
function NodePropertyProvider(param) {
|
|
5399
|
+
var children = param.children;
|
|
5400
|
+
return /* @__PURE__ */ React3__namespace.default.createElement(React3__namespace.default.Fragment, null, children);
|
|
5401
|
+
}
|
|
5402
|
+
function useIsInNodePropertyProvider() {
|
|
5403
|
+
return false;
|
|
5404
|
+
}
|
|
5405
|
+
function useNodeProperty(key) {
|
|
5406
|
+
var noopSetter = React3.useCallback(function() {
|
|
5407
|
+
console.warn('[useNodeProperty] Mock mode - cannot set "'.concat(key, '"'));
|
|
5408
|
+
}, [
|
|
5409
|
+
key
|
|
5410
|
+
]);
|
|
5411
|
+
return [
|
|
5412
|
+
void 0,
|
|
5413
|
+
noopSetter
|
|
5414
|
+
];
|
|
5415
|
+
}
|
|
5416
|
+
function useNodeProperties() {
|
|
5417
|
+
var noopSetter = React3.useCallback(function() {
|
|
5418
|
+
console.warn("[useNodeProperties] Mock mode - cannot set properties");
|
|
5419
|
+
}, []);
|
|
5420
|
+
return [
|
|
5421
|
+
{},
|
|
5422
|
+
noopSetter
|
|
5423
|
+
];
|
|
5424
|
+
}
|
|
5425
|
+
function useInferredType(fieldName) {
|
|
5426
|
+
return void 0;
|
|
5427
|
+
}
|
|
5428
|
+
function useSetInferredType() {
|
|
5429
|
+
return React3.useCallback(function(fieldName, type) {
|
|
5430
|
+
console.warn('[useSetInferredType] Mock mode - cannot set "'.concat(fieldName, '" to "').concat(type, '"'));
|
|
5431
|
+
}, []);
|
|
5432
|
+
}
|
|
5433
|
+
function useAllInferredTypes() {
|
|
5434
|
+
return {};
|
|
5435
|
+
}
|
|
5436
|
+
function useSetProperty() {
|
|
5437
|
+
return React3.useCallback(function(key, value) {
|
|
5438
|
+
console.warn('[useSetProperty] Mock mode - cannot set "'.concat(key, '"'));
|
|
5439
|
+
}, []);
|
|
5440
|
+
}
|
|
5441
|
+
function useFieldValidation() {
|
|
5442
|
+
var setFieldRequired = React3.useCallback(function(fieldName, required) {
|
|
5443
|
+
console.warn('[useFieldValidation] Mock mode - cannot set required for "'.concat(fieldName, '"'));
|
|
5444
|
+
}, []);
|
|
5445
|
+
var setFieldRequiredIf = React3.useCallback(function(fieldName, requiredIf) {
|
|
5446
|
+
console.warn('[useFieldValidation] Mock mode - cannot set requiredIf for "'.concat(fieldName, '"'));
|
|
5447
|
+
}, []);
|
|
5448
|
+
var setFieldValidation = React3.useCallback(function(fieldName, customValidation) {
|
|
5449
|
+
console.warn('[useFieldValidation] Mock mode - cannot set validation for "'.concat(fieldName, '"'));
|
|
5450
|
+
}, []);
|
|
5451
|
+
var clearFieldValidation = React3.useCallback(function(fieldName) {
|
|
5452
|
+
console.warn('[useFieldValidation] Mock mode - cannot clear validation for "'.concat(fieldName, '"'));
|
|
5453
|
+
}, []);
|
|
5454
|
+
var isFieldRequired = React3.useCallback(function(fieldName) {
|
|
5455
|
+
return false;
|
|
5456
|
+
}, []);
|
|
5457
|
+
var validateField = React3.useCallback(function(fieldName) {
|
|
5458
|
+
return null;
|
|
5459
|
+
}, []);
|
|
5460
|
+
return {
|
|
5461
|
+
setFieldRequired: setFieldRequired,
|
|
5462
|
+
setFieldRequiredIf: setFieldRequiredIf,
|
|
5463
|
+
setFieldValidation: setFieldValidation,
|
|
5464
|
+
clearFieldValidation: clearFieldValidation,
|
|
5465
|
+
isFieldRequired: isFieldRequired,
|
|
5466
|
+
validateField: validateField
|
|
5467
|
+
};
|
|
5468
|
+
}
|
|
5117
5469
|
exports.InferredTypesContext = InferredTypesContext;
|
|
5118
5470
|
exports.InferredTypesProvider = InferredTypesProvider;
|
|
5119
5471
|
exports.Input = Input;
|
|
5120
5472
|
exports.NestedFieldProvider = NestedFieldProvider;
|
|
5473
|
+
exports.NodePropertyProvider = NodePropertyProvider;
|
|
5121
5474
|
exports.OPERATORS_BY_TYPE = OPERATORS_BY_TYPE;
|
|
5122
|
-
exports.Select =
|
|
5475
|
+
exports.Select = Select2;
|
|
5123
5476
|
exports.TemplateFieldProvider = TemplateFieldProvider;
|
|
5477
|
+
exports.computeExtendedType = computeExtendedType;
|
|
5478
|
+
exports.filterOperatorsByType = filterOperatorsByType;
|
|
5479
|
+
exports.getNumberConstants = getNumberConstants;
|
|
5124
5480
|
exports.getOperatorsForType = getOperatorsForType;
|
|
5481
|
+
exports.getStringConstants = getStringConstants;
|
|
5125
5482
|
exports.intersectTypes = intersectTypes;
|
|
5126
5483
|
exports.parseInferSyntax = parseInferSyntax;
|
|
5484
|
+
exports.parseInferredTypes = parseInferredTypes;
|
|
5485
|
+
exports.useAllInferredTypes = useAllInferredTypes;
|
|
5127
5486
|
exports.useFieldPath = useFieldPath;
|
|
5487
|
+
exports.useFieldValidation = useFieldValidation;
|
|
5488
|
+
exports.useInferredType = useInferredType;
|
|
5128
5489
|
exports.useInferredTypes = useInferredTypes;
|
|
5490
|
+
exports.useIsInNodePropertyProvider = useIsInNodePropertyProvider;
|
|
5129
5491
|
exports.useIsInTemplateFieldProvider = useIsInTemplateFieldProvider;
|
|
5492
|
+
exports.useNodeProperties = useNodeProperties;
|
|
5493
|
+
exports.useNodeProperty = useNodeProperty;
|
|
5494
|
+
exports.useSetInferredType = useSetInferredType;
|
|
5495
|
+
exports.useSetProperty = useSetProperty;
|
|
5130
5496
|
exports.useTemplateFieldContext = useTemplateFieldContext; //# sourceMappingURL=index.cjs.map
|
|
5131
5497
|
//# sourceMappingURL=index.cjs.map
|