@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/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
5
|
-
export { i as fields } from './index-
|
|
5
|
+
export { i as fields } from './index-DGN9LJqq.cjs';
|
|
6
6
|
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
8
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as class_variance_authority_types from 'class-variance-authority/types'
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
5
|
-
export { i as fields } from './index-
|
|
5
|
+
export { i as fields } from './index-DGN9LJqq.js';
|
|
6
6
|
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
8
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -5102,15 +5102,30 @@ __export(fields_exports, {
|
|
|
5102
5102
|
TemplateFieldProvider: function() {
|
|
5103
5103
|
return TemplateFieldProvider;
|
|
5104
5104
|
},
|
|
5105
|
+
computeExtendedType: function() {
|
|
5106
|
+
return computeExtendedType;
|
|
5107
|
+
},
|
|
5108
|
+
filterOperatorsByType: function() {
|
|
5109
|
+
return filterOperatorsByType;
|
|
5110
|
+
},
|
|
5111
|
+
getNumberConstants: function() {
|
|
5112
|
+
return getNumberConstants;
|
|
5113
|
+
},
|
|
5105
5114
|
getOperatorsForType: function() {
|
|
5106
5115
|
return getOperatorsForType;
|
|
5107
5116
|
},
|
|
5117
|
+
getStringConstants: function() {
|
|
5118
|
+
return getStringConstants;
|
|
5119
|
+
},
|
|
5108
5120
|
intersectTypes: function() {
|
|
5109
5121
|
return intersectTypes;
|
|
5110
5122
|
},
|
|
5111
5123
|
parseInferSyntax: function() {
|
|
5112
5124
|
return parseInferSyntax;
|
|
5113
5125
|
},
|
|
5126
|
+
parseInferredTypes: function() {
|
|
5127
|
+
return parseInferredTypes;
|
|
5128
|
+
},
|
|
5114
5129
|
useAllInferredTypes: function() {
|
|
5115
5130
|
return useAllInferredTypes;
|
|
5116
5131
|
},
|
|
@@ -5452,6 +5467,131 @@ function Select2(param) {
|
|
|
5452
5467
|
}, opt.node ? opt.node : /* @__PURE__ */ React2.createElement(React2.Fragment, null, opt.label));
|
|
5453
5468
|
})))));
|
|
5454
5469
|
}
|
|
5470
|
+
// src/components/template-editor/operatorTypes.ts
|
|
5471
|
+
function parseInferredTypes(typeStr) {
|
|
5472
|
+
var result = {
|
|
5473
|
+
baseTypes: [],
|
|
5474
|
+
stringConstants: [],
|
|
5475
|
+
numberConstants: [],
|
|
5476
|
+
hasConstants: false,
|
|
5477
|
+
rawTypes: []
|
|
5478
|
+
};
|
|
5479
|
+
if (!typeStr || typeStr === "any" || typeStr === "unknown") {
|
|
5480
|
+
result.baseTypes = [
|
|
5481
|
+
"any"
|
|
5482
|
+
];
|
|
5483
|
+
result.rawTypes = [
|
|
5484
|
+
"any"
|
|
5485
|
+
];
|
|
5486
|
+
return result;
|
|
5487
|
+
}
|
|
5488
|
+
var types = typeStr.split("|").map(function(t) {
|
|
5489
|
+
return t.trim();
|
|
5490
|
+
}).filter(Boolean);
|
|
5491
|
+
var baseTypesSet = /* @__PURE__ */ new Set();
|
|
5492
|
+
var rawTypesSet = /* @__PURE__ */ new Set();
|
|
5493
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5494
|
+
try {
|
|
5495
|
+
for(var _iterator = types[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5496
|
+
var t = _step.value;
|
|
5497
|
+
rawTypesSet.add(t);
|
|
5498
|
+
var stringLiteralMatch = t.match(/^["'](.*)["']$/);
|
|
5499
|
+
if (stringLiteralMatch && stringLiteralMatch[1] !== void 0) {
|
|
5500
|
+
result.stringConstants.push(stringLiteralMatch[1]);
|
|
5501
|
+
baseTypesSet.add("string");
|
|
5502
|
+
result.hasConstants = true;
|
|
5503
|
+
continue;
|
|
5504
|
+
}
|
|
5505
|
+
if (/^-?\d+(\.\d+)?$/.test(t)) {
|
|
5506
|
+
result.numberConstants.push(parseFloat(t));
|
|
5507
|
+
baseTypesSet.add("number");
|
|
5508
|
+
result.hasConstants = true;
|
|
5509
|
+
continue;
|
|
5510
|
+
}
|
|
5511
|
+
if (t === "true" || t === "false") {
|
|
5512
|
+
baseTypesSet.add("boolean");
|
|
5513
|
+
result.hasConstants = true;
|
|
5514
|
+
continue;
|
|
5515
|
+
}
|
|
5516
|
+
baseTypesSet.add(t);
|
|
5517
|
+
}
|
|
5518
|
+
} catch (err) {
|
|
5519
|
+
_didIteratorError = true;
|
|
5520
|
+
_iteratorError = err;
|
|
5521
|
+
} finally{
|
|
5522
|
+
try {
|
|
5523
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5524
|
+
_iterator.return();
|
|
5525
|
+
}
|
|
5526
|
+
} finally{
|
|
5527
|
+
if (_didIteratorError) {
|
|
5528
|
+
throw _iteratorError;
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
result.baseTypes = Array.from(baseTypesSet);
|
|
5533
|
+
result.rawTypes = Array.from(rawTypesSet);
|
|
5534
|
+
return result;
|
|
5535
|
+
}
|
|
5536
|
+
function computeExtendedType(inferredType, opDef) {
|
|
5537
|
+
if (!opDef.extendsWithBase || opDef.narrowsTo === "never") {
|
|
5538
|
+
return opDef.narrowsTo;
|
|
5539
|
+
}
|
|
5540
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5541
|
+
var matchingTypes = [];
|
|
5542
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5543
|
+
try {
|
|
5544
|
+
for(var _iterator = parsed.rawTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5545
|
+
var t = _step.value;
|
|
5546
|
+
if (opDef.narrowsTo === "string") {
|
|
5547
|
+
if (t === "string" || /^["'].*["']$/.test(t)) {
|
|
5548
|
+
matchingTypes.push(t);
|
|
5549
|
+
}
|
|
5550
|
+
} else if (opDef.narrowsTo === "number") {
|
|
5551
|
+
if (t === "number" || /^-?\d+(\.\d+)?$/.test(t)) {
|
|
5552
|
+
matchingTypes.push(t);
|
|
5553
|
+
}
|
|
5554
|
+
} else if (opDef.narrowsTo === "boolean") {
|
|
5555
|
+
if (t === "boolean" || t === "true" || t === "false") {
|
|
5556
|
+
matchingTypes.push(t);
|
|
5557
|
+
}
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
} catch (err) {
|
|
5561
|
+
_didIteratorError = true;
|
|
5562
|
+
_iteratorError = err;
|
|
5563
|
+
} finally{
|
|
5564
|
+
try {
|
|
5565
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5566
|
+
_iterator.return();
|
|
5567
|
+
}
|
|
5568
|
+
} finally{
|
|
5569
|
+
if (_didIteratorError) {
|
|
5570
|
+
throw _iteratorError;
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
5574
|
+
if (opDef.extendsWithBase && !matchingTypes.includes(opDef.narrowsTo)) {
|
|
5575
|
+
matchingTypes.push(opDef.narrowsTo);
|
|
5576
|
+
}
|
|
5577
|
+
return matchingTypes.length > 0 ? matchingTypes.join(" | ") : opDef.narrowsTo;
|
|
5578
|
+
}
|
|
5579
|
+
function filterOperatorsByType(operators, inferredType) {
|
|
5580
|
+
var parsed = parseInferredTypes(inferredType);
|
|
5581
|
+
var baseTypes = parsed.baseTypes;
|
|
5582
|
+
return operators.filter(function(op) {
|
|
5583
|
+
if (op.types.includes("any")) return true;
|
|
5584
|
+
return op.types.some(function(t) {
|
|
5585
|
+
return baseTypes.includes(t) || baseTypes.includes("any");
|
|
5586
|
+
});
|
|
5587
|
+
});
|
|
5588
|
+
}
|
|
5589
|
+
function getStringConstants(inferredType) {
|
|
5590
|
+
return parseInferredTypes(inferredType).stringConstants;
|
|
5591
|
+
}
|
|
5592
|
+
function getNumberConstants(inferredType) {
|
|
5593
|
+
return parseInferredTypes(inferredType).numberConstants;
|
|
5594
|
+
}
|
|
5455
5595
|
// src/components/fields/index.tsx
|
|
5456
5596
|
function useTemplateFieldContext() {
|
|
5457
5597
|
return {
|