@process.co/ui 0.0.9 → 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 +0 -7
- package/dist/components/fields/index.cjs +130 -0
- 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 +126 -1
- package/dist/components/fields/index.js.map +1 -1
- package/dist/{index-nu_JyZnb.d.cts → index-DGN9LJqq.d.cts} +149 -2
- package/dist/{index-nu_JyZnb.d.ts → index-DGN9LJqq.d.ts} +149 -2
- package/dist/index.cjs +140 -0
- 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 +140 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/css/ui.css
CHANGED
|
@@ -23,13 +23,6 @@
|
|
|
23
23
|
--uii-default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
24
24
|
--uii-default-font-family: Inter, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
25
25
|
--uii-default-mono-font-family: var(--uii-font-mono);
|
|
26
|
-
--uii-color-adam-test-0: #0b0d33;
|
|
27
|
-
--uii-color-adam-test-50: #ebf2ff;
|
|
28
|
-
--uii-color-adam-test-100: #dae8ff;
|
|
29
|
-
--uii-color-adam-test-200: #bdd3ff;
|
|
30
|
-
--uii-color-adam-test-300: #95b5ff;
|
|
31
|
-
--uii-color-adam-test-400: #6b8bff;
|
|
32
|
-
--uii-color-adam-test-500: #4961ff;
|
|
33
26
|
--uii-color-hero-bg: #0b0d33;
|
|
34
27
|
}
|
|
35
28
|
}
|
|
@@ -5110,6 +5110,131 @@ function Select2(param) {
|
|
|
5110
5110
|
}, opt.node ? opt.node : /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, opt.label));
|
|
5111
5111
|
})))));
|
|
5112
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;
|
|
5237
|
+
}
|
|
5113
5238
|
// src/components/fields/index.tsx
|
|
5114
5239
|
function useTemplateFieldContext() {
|
|
5115
5240
|
return {
|
|
@@ -5349,9 +5474,14 @@ exports.NodePropertyProvider = NodePropertyProvider;
|
|
|
5349
5474
|
exports.OPERATORS_BY_TYPE = OPERATORS_BY_TYPE;
|
|
5350
5475
|
exports.Select = Select2;
|
|
5351
5476
|
exports.TemplateFieldProvider = TemplateFieldProvider;
|
|
5477
|
+
exports.computeExtendedType = computeExtendedType;
|
|
5478
|
+
exports.filterOperatorsByType = filterOperatorsByType;
|
|
5479
|
+
exports.getNumberConstants = getNumberConstants;
|
|
5352
5480
|
exports.getOperatorsForType = getOperatorsForType;
|
|
5481
|
+
exports.getStringConstants = getStringConstants;
|
|
5353
5482
|
exports.intersectTypes = intersectTypes;
|
|
5354
5483
|
exports.parseInferSyntax = parseInferSyntax;
|
|
5484
|
+
exports.parseInferredTypes = parseInferredTypes;
|
|
5355
5485
|
exports.useAllInferredTypes = useAllInferredTypes;
|
|
5356
5486
|
exports.useFieldPath = useFieldPath;
|
|
5357
5487
|
exports.useFieldValidation = useFieldValidation;
|