@typespec/html-program-viewer 0.72.0-dev.1 → 0.72.0-dev.3
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/dist/emitter/index.js +94 -50
- package/dist/{manifest-DvYpHITg.js → manifest-DH1LKq9n.js} +1 -1
- package/dist/react/index.js +281 -257
- package/dist/react/inspect-type/inspect-type.d.ts.map +1 -1
- package/dist/react/type-config.d.ts +27 -11
- package/dist/react/type-config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/emitter/index.js
CHANGED
|
@@ -3991,7 +3991,7 @@ function disposeKeyborg(instance) {
|
|
|
3991
3991
|
disposeCurrentElement();
|
|
3992
3992
|
scope.removeEventListener(KEYBORG_FOCUSIN, keyborgListener);
|
|
3993
3993
|
scope.removeEventListener('focusout', blurListener);
|
|
3994
|
-
|
|
3994
|
+
scope.focusVisible = undefined;
|
|
3995
3995
|
disposeKeyborg(keyborg);
|
|
3996
3996
|
};
|
|
3997
3997
|
}
|
|
@@ -5427,39 +5427,62 @@ const JsValue = ({ value }) => {
|
|
|
5427
5427
|
}
|
|
5428
5428
|
};
|
|
5429
5429
|
|
|
5430
|
-
const
|
|
5430
|
+
const CommonPropsConfig = {
|
|
5431
|
+
namespace: "parent",
|
|
5432
|
+
name: "value"
|
|
5433
|
+
};
|
|
5434
|
+
const HiddenProps = [
|
|
5435
|
+
"entityKind",
|
|
5436
|
+
"kind",
|
|
5437
|
+
"node",
|
|
5438
|
+
"symbol",
|
|
5439
|
+
"templateNode",
|
|
5440
|
+
"templateArguments",
|
|
5441
|
+
"templateMapper",
|
|
5442
|
+
"instantiationParameters",
|
|
5443
|
+
"decorators",
|
|
5444
|
+
"isFinished"
|
|
5445
|
+
];
|
|
5446
|
+
const HiddenPropsConfig = Object.fromEntries(HiddenProps.map((prop) => [prop, "skip"]));
|
|
5447
|
+
const TypeConfig = buildConfig({
|
|
5431
5448
|
Namespace: {
|
|
5432
5449
|
namespaces: "skip",
|
|
5433
|
-
models: "nested",
|
|
5434
|
-
scalars: "nested",
|
|
5435
|
-
interfaces: "nested",
|
|
5436
|
-
operations: "nested",
|
|
5437
|
-
unions: "nested",
|
|
5438
|
-
enums: "nested",
|
|
5439
|
-
decoratorDeclarations: "nested"
|
|
5450
|
+
models: "nested-items",
|
|
5451
|
+
scalars: "nested-items",
|
|
5452
|
+
interfaces: "nested-items",
|
|
5453
|
+
operations: "nested-items",
|
|
5454
|
+
unions: "nested-items",
|
|
5455
|
+
enums: "nested-items",
|
|
5456
|
+
decoratorDeclarations: "nested-items"
|
|
5440
5457
|
},
|
|
5441
5458
|
Interface: {
|
|
5442
|
-
operations: "nested",
|
|
5459
|
+
operations: "nested-items",
|
|
5443
5460
|
sourceInterfaces: "ref"
|
|
5444
5461
|
},
|
|
5445
5462
|
Operation: {
|
|
5446
5463
|
interface: "parent",
|
|
5447
|
-
parameters: "nested",
|
|
5464
|
+
parameters: "nested-items",
|
|
5448
5465
|
returnType: "ref",
|
|
5449
5466
|
sourceOperation: "ref"
|
|
5450
5467
|
},
|
|
5451
5468
|
Model: {
|
|
5452
|
-
indexer:
|
|
5469
|
+
indexer: {
|
|
5470
|
+
kind: "nested",
|
|
5471
|
+
properties: {
|
|
5472
|
+
key: "ref",
|
|
5473
|
+
value: "ref"
|
|
5474
|
+
}
|
|
5475
|
+
},
|
|
5453
5476
|
baseModel: "ref",
|
|
5454
5477
|
derivedModels: "ref",
|
|
5455
|
-
properties: "nested",
|
|
5478
|
+
properties: "nested-items",
|
|
5456
5479
|
sourceModel: "ref",
|
|
5457
5480
|
sourceModels: "value"
|
|
5458
5481
|
},
|
|
5459
5482
|
Scalar: {
|
|
5460
5483
|
baseScalar: "ref",
|
|
5461
5484
|
derivedScalars: "ref",
|
|
5462
|
-
constructors: "nested"
|
|
5485
|
+
constructors: "nested-items"
|
|
5463
5486
|
},
|
|
5464
5487
|
ModelProperty: {
|
|
5465
5488
|
model: "parent",
|
|
@@ -5469,7 +5492,7 @@ const TypeConfig = {
|
|
|
5469
5492
|
defaultValue: "value"
|
|
5470
5493
|
},
|
|
5471
5494
|
Enum: {
|
|
5472
|
-
members: "nested"
|
|
5495
|
+
members: "nested-items"
|
|
5473
5496
|
},
|
|
5474
5497
|
EnumMember: {
|
|
5475
5498
|
enum: "parent",
|
|
@@ -5477,8 +5500,8 @@ const TypeConfig = {
|
|
|
5477
5500
|
value: "value"
|
|
5478
5501
|
},
|
|
5479
5502
|
Union: {
|
|
5480
|
-
expression: "
|
|
5481
|
-
variants: "nested"
|
|
5503
|
+
expression: "value",
|
|
5504
|
+
variants: "nested-items"
|
|
5482
5505
|
},
|
|
5483
5506
|
UnionVariant: {
|
|
5484
5507
|
union: "parent",
|
|
@@ -5488,13 +5511,13 @@ const TypeConfig = {
|
|
|
5488
5511
|
value: "value"
|
|
5489
5512
|
},
|
|
5490
5513
|
Decorator: {
|
|
5491
|
-
parameters: "nested",
|
|
5514
|
+
parameters: "nested-items",
|
|
5492
5515
|
implementation: "skip",
|
|
5493
5516
|
target: "ref"
|
|
5494
5517
|
},
|
|
5495
5518
|
ScalarConstructor: {
|
|
5496
5519
|
scalar: "parent",
|
|
5497
|
-
parameters: "nested"
|
|
5520
|
+
parameters: "nested-items"
|
|
5498
5521
|
},
|
|
5499
5522
|
FunctionParameter: null,
|
|
5500
5523
|
Number: {
|
|
@@ -5506,10 +5529,10 @@ const TypeConfig = {
|
|
|
5506
5529
|
value: "value"
|
|
5507
5530
|
},
|
|
5508
5531
|
Tuple: {
|
|
5509
|
-
values: "nested"
|
|
5532
|
+
values: "nested-items"
|
|
5510
5533
|
},
|
|
5511
5534
|
StringTemplate: {
|
|
5512
|
-
spans: "nested",
|
|
5535
|
+
spans: "nested-items",
|
|
5513
5536
|
stringValue: "value"
|
|
5514
5537
|
},
|
|
5515
5538
|
StringTemplateSpan: {
|
|
@@ -5522,29 +5545,38 @@ const TypeConfig = {
|
|
|
5522
5545
|
},
|
|
5523
5546
|
// Don't want to expose those for now
|
|
5524
5547
|
Intrinsic: null
|
|
5525
|
-
};
|
|
5526
|
-
const CommonPropsConfig = {
|
|
5527
|
-
namespace: "parent"
|
|
5528
|
-
};
|
|
5529
|
-
const HiddenProps = [
|
|
5530
|
-
"entityKind",
|
|
5531
|
-
"kind",
|
|
5532
|
-
"name",
|
|
5533
|
-
"node",
|
|
5534
|
-
"symbol",
|
|
5535
|
-
"templateNode",
|
|
5536
|
-
"templateArguments",
|
|
5537
|
-
"templateMapper",
|
|
5538
|
-
"instantiationParameters",
|
|
5539
|
-
"decorators",
|
|
5540
|
-
"projector",
|
|
5541
|
-
"isFinished"
|
|
5542
|
-
];
|
|
5548
|
+
});
|
|
5543
5549
|
new Set(HiddenProps);
|
|
5544
|
-
function
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5550
|
+
function getRenderingConfig(type) {
|
|
5551
|
+
return TypeConfig[type.kind];
|
|
5552
|
+
}
|
|
5553
|
+
function buildConfig(raw) {
|
|
5554
|
+
return Object.fromEntries(
|
|
5555
|
+
Object.entries(raw).map(([kind, config]) => {
|
|
5556
|
+
return [kind, buildConfigForKind(config)];
|
|
5557
|
+
})
|
|
5558
|
+
);
|
|
5559
|
+
}
|
|
5560
|
+
function buildConfigForKind(config) {
|
|
5561
|
+
if (config === null) {
|
|
5562
|
+
return null;
|
|
5563
|
+
}
|
|
5564
|
+
return Object.fromEntries(
|
|
5565
|
+
Object.entries({ ...CommonPropsConfig, ...HiddenPropsConfig, ...config }).map(
|
|
5566
|
+
([key, value]) => {
|
|
5567
|
+
return [key, buildConfigForProperty(value)];
|
|
5568
|
+
}
|
|
5569
|
+
)
|
|
5570
|
+
);
|
|
5571
|
+
}
|
|
5572
|
+
function buildConfigForProperty(value) {
|
|
5573
|
+
if (typeof value === "string") {
|
|
5574
|
+
return { kind: value };
|
|
5575
|
+
}
|
|
5576
|
+
return {
|
|
5577
|
+
kind: "nested",
|
|
5578
|
+
properties: buildConfigForKind(value.properties)
|
|
5579
|
+
};
|
|
5548
5580
|
}
|
|
5549
5581
|
|
|
5550
5582
|
const TreeNavigatorContext = createContext(void 0);
|
|
@@ -5669,13 +5701,22 @@ const SimpleType = ({ type, children }) => {
|
|
|
5669
5701
|
children
|
|
5670
5702
|
] });
|
|
5671
5703
|
};
|
|
5672
|
-
const EntityProperties = ({ entity
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5704
|
+
const EntityProperties = ({ entity }) => {
|
|
5705
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InspectObject, { value: entity, config: getRenderingConfig(entity) });
|
|
5706
|
+
};
|
|
5707
|
+
const InspectObject = ({
|
|
5708
|
+
value,
|
|
5709
|
+
config
|
|
5710
|
+
}) => {
|
|
5711
|
+
if (value === void 0) {
|
|
5712
|
+
return null;
|
|
5713
|
+
}
|
|
5714
|
+
const props = Object.entries(value).map(([key, value2]) => {
|
|
5715
|
+
const action = config?.[key];
|
|
5716
|
+
if (action === void 0 || action === null || action.kind === "skip") {
|
|
5676
5717
|
return void 0;
|
|
5677
5718
|
}
|
|
5678
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(EntityProperty, { name: key, value, action }, key);
|
|
5719
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(EntityProperty, { name: key, value: value2, action }, key);
|
|
5679
5720
|
}).filter((x) => Boolean(x));
|
|
5680
5721
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: props });
|
|
5681
5722
|
};
|
|
@@ -5689,12 +5730,15 @@ const EntityProperty = (props) => {
|
|
|
5689
5730
|
};
|
|
5690
5731
|
const EntityPropertyValue = ({ value, action }) => {
|
|
5691
5732
|
const render = (x) => {
|
|
5692
|
-
if (action === "parent") {
|
|
5733
|
+
if (action.kind === "parent") {
|
|
5693
5734
|
return x.entityKind === "Type" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ParentReference, { type: x }) : null;
|
|
5694
5735
|
}
|
|
5695
|
-
const renderRef = action === "ref";
|
|
5736
|
+
const renderRef = action.kind === "ref";
|
|
5696
5737
|
return renderRef ? /* @__PURE__ */ jsxRuntimeExports.jsx(EntityReference, { entity: x }) : /* @__PURE__ */ jsxRuntimeExports.jsx(EntityUI, { entity: x });
|
|
5697
5738
|
};
|
|
5739
|
+
if (action.kind === "nested") {
|
|
5740
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InspectObject, { value, config: action.properties });
|
|
5741
|
+
}
|
|
5698
5742
|
if (value === void 0) {
|
|
5699
5743
|
return null;
|
|
5700
5744
|
} else if (value.entityKind) {
|
package/dist/react/index.js
CHANGED
|
@@ -31494,219 +31494,19 @@ defineKit({
|
|
|
31494
31494
|
},
|
|
31495
31495
|
});
|
|
31496
31496
|
|
|
31497
|
-
class InvalidNumericError extends Error {
|
|
31498
|
-
code = "InvalidNumeric";
|
|
31499
|
-
}
|
|
31500
|
-
/** @internal */
|
|
31501
|
-
const InternalDataSym = Symbol.for("NumericInternalData");
|
|
31502
|
-
/**
|
|
31503
|
-
* Represent any possible numeric value
|
|
31504
|
-
*/
|
|
31505
|
-
function Numeric(stringValue) {
|
|
31506
|
-
if (new.target) {
|
|
31507
|
-
throw new Error("Numeric is not a constructor");
|
|
31508
|
-
}
|
|
31509
|
-
const data = parse(stringValue);
|
|
31510
|
-
const isInteger = data.d === 0;
|
|
31511
|
-
const obj = {
|
|
31512
|
-
[InternalDataSym]: data,
|
|
31513
|
-
isInteger,
|
|
31514
|
-
};
|
|
31515
|
-
// We are explicitly not using a class here due to version mismatch between the compiler and the runtime that could happen and break instanceof checks.
|
|
31516
|
-
const numeric = setTypedProptotype(obj, NumericPrototype);
|
|
31517
|
-
return Object.freeze(numeric);
|
|
31518
|
-
}
|
|
31519
|
-
function setTypedProptotype(obj, prototype) {
|
|
31520
|
-
Object.setPrototypeOf(obj, prototype);
|
|
31521
|
-
return obj;
|
|
31522
|
-
}
|
|
31523
|
-
function parse(original) {
|
|
31524
|
-
let stringValue = original;
|
|
31525
|
-
let start = 0;
|
|
31526
|
-
let sign = 1;
|
|
31527
|
-
let n;
|
|
31528
|
-
let exp;
|
|
31529
|
-
let decimal = undefined;
|
|
31530
|
-
if (stringValue[0] === "-") {
|
|
31531
|
-
start = 1;
|
|
31532
|
-
sign = -1;
|
|
31533
|
-
}
|
|
31534
|
-
const second = stringValue[start + 1]?.toLowerCase();
|
|
31535
|
-
if (stringValue[start] === "0" && (second === "b" || second === "x" || second === "o")) {
|
|
31536
|
-
try {
|
|
31537
|
-
n = BigInt(stringValue.slice(start));
|
|
31538
|
-
exp = n.toString().length;
|
|
31539
|
-
decimal = 0;
|
|
31540
|
-
}
|
|
31541
|
-
catch {
|
|
31542
|
-
throw new InvalidNumericError(`Invalid numeric value: ${original}`);
|
|
31543
|
-
}
|
|
31544
|
-
}
|
|
31545
|
-
else {
|
|
31546
|
-
// Skip leading 0.
|
|
31547
|
-
while (stringValue[start] === "0") {
|
|
31548
|
-
start++;
|
|
31549
|
-
}
|
|
31550
|
-
const decimalPointIndex = stringValue.indexOf(".");
|
|
31551
|
-
const adjustedPointIndex = decimalPointIndex - start;
|
|
31552
|
-
// Decimal point?
|
|
31553
|
-
if (decimalPointIndex !== -1) {
|
|
31554
|
-
exp = adjustedPointIndex;
|
|
31555
|
-
stringValue = stringValue.replace(".", "");
|
|
31556
|
-
}
|
|
31557
|
-
let i;
|
|
31558
|
-
if ((i = stringValue.search(/e/i)) > 0) {
|
|
31559
|
-
// Determine exponent.
|
|
31560
|
-
if (exp === undefined) {
|
|
31561
|
-
exp = i - start;
|
|
31562
|
-
}
|
|
31563
|
-
exp += Number(stringValue.slice(i + 1));
|
|
31564
|
-
stringValue = stringValue.slice(start, i);
|
|
31565
|
-
decimal = Math.max(stringValue.length - exp, 0);
|
|
31566
|
-
}
|
|
31567
|
-
else if (exp === undefined) {
|
|
31568
|
-
// Integer.
|
|
31569
|
-
exp = stringValue.length - start;
|
|
31570
|
-
stringValue = stringValue.slice(start);
|
|
31571
|
-
}
|
|
31572
|
-
else {
|
|
31573
|
-
stringValue = stringValue.slice(start);
|
|
31574
|
-
}
|
|
31575
|
-
let end = stringValue.length;
|
|
31576
|
-
while (stringValue[end - 1] === "0" && end > adjustedPointIndex) {
|
|
31577
|
-
end--;
|
|
31578
|
-
}
|
|
31579
|
-
// Only if there is 0 before the decimal point, keeps checking how many 0 there is after it and update the exponent accordingly.
|
|
31580
|
-
if (start === adjustedPointIndex + 1) {
|
|
31581
|
-
let cur = adjustedPointIndex;
|
|
31582
|
-
while (stringValue[cur] === "0" && cur < end) {
|
|
31583
|
-
cur++;
|
|
31584
|
-
exp--;
|
|
31585
|
-
}
|
|
31586
|
-
}
|
|
31587
|
-
try {
|
|
31588
|
-
stringValue = stringValue.slice(0, end);
|
|
31589
|
-
stringValue = stringValue + "0".repeat(Math.max(exp - stringValue.length, 0)); // add remaining zeros for cases like 3e30
|
|
31590
|
-
n = BigInt(stringValue);
|
|
31591
|
-
if (n === 0n) {
|
|
31592
|
-
decimal = 0;
|
|
31593
|
-
}
|
|
31594
|
-
else if (decimal === undefined) {
|
|
31595
|
-
decimal = Math.max(stringValue.length - Math.max(exp, 0), 0);
|
|
31596
|
-
}
|
|
31597
|
-
}
|
|
31598
|
-
catch {
|
|
31599
|
-
throw new InvalidNumericError(`Invalid numeric value: ${original}`);
|
|
31600
|
-
}
|
|
31601
|
-
}
|
|
31602
|
-
return { n, e: exp, s: sign, d: decimal };
|
|
31603
|
-
}
|
|
31604
|
-
function stringify(value) {
|
|
31605
|
-
if (value.n === 0n)
|
|
31606
|
-
return "0";
|
|
31607
|
-
const n = value.n.toString();
|
|
31608
|
-
const sign = value.s === -1 ? "-" : "";
|
|
31609
|
-
const int = value.e <= 0 ? "0" : n.slice(0, value.e);
|
|
31610
|
-
const decimal = value.e < n.length ? "." + n.slice(-value.d).padStart(value.d, "0") : "";
|
|
31611
|
-
return sign + int + decimal;
|
|
31612
|
-
}
|
|
31613
|
-
const equals = (a, b) => a.n === b.n && a.e === b.e;
|
|
31614
|
-
const compare = (a, b) => {
|
|
31615
|
-
if (a.s < b.s) {
|
|
31616
|
-
return -1;
|
|
31617
|
-
}
|
|
31618
|
-
else if (a.s > b.s) {
|
|
31619
|
-
return 1;
|
|
31620
|
-
}
|
|
31621
|
-
const neg = a.s;
|
|
31622
|
-
if (a.e < b.e) {
|
|
31623
|
-
return (-1 * neg);
|
|
31624
|
-
}
|
|
31625
|
-
else if (a.e > b.e) {
|
|
31626
|
-
return (1 * neg);
|
|
31627
|
-
}
|
|
31628
|
-
let aN = a.n;
|
|
31629
|
-
let bN = b.n;
|
|
31630
|
-
if (a.d < b.d) {
|
|
31631
|
-
aN *= 10n ** BigInt(b.d - a.d);
|
|
31632
|
-
}
|
|
31633
|
-
else {
|
|
31634
|
-
bN *= 10n ** BigInt(a.d - b.d);
|
|
31635
|
-
}
|
|
31636
|
-
if (aN < bN)
|
|
31637
|
-
return (-1 * neg);
|
|
31638
|
-
if (aN > bN)
|
|
31639
|
-
return (1 * neg);
|
|
31640
|
-
return 0;
|
|
31641
|
-
};
|
|
31642
|
-
const NumericPrototype = {
|
|
31643
|
-
toString: function () {
|
|
31644
|
-
return stringify(this[InternalDataSym]);
|
|
31645
|
-
},
|
|
31646
|
-
asNumber: function () {
|
|
31647
|
-
const num = Number(stringify(this[InternalDataSym]));
|
|
31648
|
-
return equals(this[InternalDataSym], Numeric(num.toString())[InternalDataSym]) ? num : null;
|
|
31649
|
-
},
|
|
31650
|
-
asBigInt: function () {
|
|
31651
|
-
if (!this.isInteger) {
|
|
31652
|
-
return null;
|
|
31653
|
-
}
|
|
31654
|
-
const { s, n } = this[InternalDataSym];
|
|
31655
|
-
return BigInt(s) * n;
|
|
31656
|
-
},
|
|
31657
|
-
equals: function (other) {
|
|
31658
|
-
return equals(this[InternalDataSym], other[InternalDataSym]);
|
|
31659
|
-
},
|
|
31660
|
-
lt: function (other) {
|
|
31661
|
-
return compare(this[InternalDataSym], other[InternalDataSym]) === -1;
|
|
31662
|
-
},
|
|
31663
|
-
lte: function (other) {
|
|
31664
|
-
return compare(this[InternalDataSym], other[InternalDataSym]) <= 0;
|
|
31665
|
-
},
|
|
31666
|
-
gt: function (other) {
|
|
31667
|
-
return compare(this[InternalDataSym], other[InternalDataSym]) === 1;
|
|
31668
|
-
},
|
|
31669
|
-
gte: function (other) {
|
|
31670
|
-
return compare(this[InternalDataSym], other[InternalDataSym]) >= 0;
|
|
31671
|
-
},
|
|
31672
|
-
};
|
|
31673
|
-
NumericPrototype.toString = function () {
|
|
31674
|
-
return stringify(this[InternalDataSym]);
|
|
31675
|
-
};
|
|
31676
|
-
|
|
31677
31497
|
defineKit({
|
|
31678
31498
|
literal: {
|
|
31679
31499
|
create(value) {
|
|
31680
|
-
|
|
31681
|
-
return this.literal.createString(value);
|
|
31682
|
-
}
|
|
31683
|
-
else if (typeof value === "number") {
|
|
31684
|
-
return this.literal.createNumeric(value);
|
|
31685
|
-
}
|
|
31686
|
-
else {
|
|
31687
|
-
return this.literal.createBoolean(value);
|
|
31688
|
-
}
|
|
31500
|
+
return this.program.checker.createLiteralType(value);
|
|
31689
31501
|
},
|
|
31690
31502
|
createString(value) {
|
|
31691
|
-
return this.program.checker.
|
|
31692
|
-
kind: "String",
|
|
31693
|
-
value,
|
|
31694
|
-
});
|
|
31503
|
+
return this.program.checker.createLiteralType(value);
|
|
31695
31504
|
},
|
|
31696
31505
|
createNumeric(value) {
|
|
31697
|
-
|
|
31698
|
-
return this.program.checker.createType({
|
|
31699
|
-
kind: "Number",
|
|
31700
|
-
value,
|
|
31701
|
-
valueAsString,
|
|
31702
|
-
numericValue: Numeric(valueAsString),
|
|
31703
|
-
});
|
|
31506
|
+
return this.program.checker.createLiteralType(value);
|
|
31704
31507
|
},
|
|
31705
31508
|
createBoolean(value) {
|
|
31706
|
-
return this.program.checker.
|
|
31707
|
-
kind: "Boolean",
|
|
31708
|
-
value,
|
|
31709
|
-
});
|
|
31509
|
+
return this.program.checker.createLiteralType(value);
|
|
31710
31510
|
},
|
|
31711
31511
|
isBoolean(type) {
|
|
31712
31512
|
return type.entityKind === "Type" && type.kind === "Boolean";
|
|
@@ -32346,6 +32146,186 @@ defineKit({
|
|
|
32346
32146
|
},
|
|
32347
32147
|
});
|
|
32348
32148
|
|
|
32149
|
+
class InvalidNumericError extends Error {
|
|
32150
|
+
code = "InvalidNumeric";
|
|
32151
|
+
}
|
|
32152
|
+
/** @internal */
|
|
32153
|
+
const InternalDataSym = Symbol.for("NumericInternalData");
|
|
32154
|
+
/**
|
|
32155
|
+
* Represent any possible numeric value
|
|
32156
|
+
*/
|
|
32157
|
+
function Numeric(stringValue) {
|
|
32158
|
+
if (new.target) {
|
|
32159
|
+
throw new Error("Numeric is not a constructor");
|
|
32160
|
+
}
|
|
32161
|
+
const data = parse(stringValue);
|
|
32162
|
+
const isInteger = data.d === 0;
|
|
32163
|
+
const obj = {
|
|
32164
|
+
[InternalDataSym]: data,
|
|
32165
|
+
isInteger,
|
|
32166
|
+
};
|
|
32167
|
+
// We are explicitly not using a class here due to version mismatch between the compiler and the runtime that could happen and break instanceof checks.
|
|
32168
|
+
const numeric = setTypedProptotype(obj, NumericPrototype);
|
|
32169
|
+
return Object.freeze(numeric);
|
|
32170
|
+
}
|
|
32171
|
+
function setTypedProptotype(obj, prototype) {
|
|
32172
|
+
Object.setPrototypeOf(obj, prototype);
|
|
32173
|
+
return obj;
|
|
32174
|
+
}
|
|
32175
|
+
function parse(original) {
|
|
32176
|
+
let stringValue = original;
|
|
32177
|
+
let start = 0;
|
|
32178
|
+
let sign = 1;
|
|
32179
|
+
let n;
|
|
32180
|
+
let exp;
|
|
32181
|
+
let decimal = undefined;
|
|
32182
|
+
if (stringValue[0] === "-") {
|
|
32183
|
+
start = 1;
|
|
32184
|
+
sign = -1;
|
|
32185
|
+
}
|
|
32186
|
+
const second = stringValue[start + 1]?.toLowerCase();
|
|
32187
|
+
if (stringValue[start] === "0" && (second === "b" || second === "x" || second === "o")) {
|
|
32188
|
+
try {
|
|
32189
|
+
n = BigInt(stringValue.slice(start));
|
|
32190
|
+
exp = n.toString().length;
|
|
32191
|
+
decimal = 0;
|
|
32192
|
+
}
|
|
32193
|
+
catch {
|
|
32194
|
+
throw new InvalidNumericError(`Invalid numeric value: ${original}`);
|
|
32195
|
+
}
|
|
32196
|
+
}
|
|
32197
|
+
else {
|
|
32198
|
+
// Skip leading 0.
|
|
32199
|
+
while (stringValue[start] === "0") {
|
|
32200
|
+
start++;
|
|
32201
|
+
}
|
|
32202
|
+
const decimalPointIndex = stringValue.indexOf(".");
|
|
32203
|
+
const adjustedPointIndex = decimalPointIndex - start;
|
|
32204
|
+
// Decimal point?
|
|
32205
|
+
if (decimalPointIndex !== -1) {
|
|
32206
|
+
exp = adjustedPointIndex;
|
|
32207
|
+
stringValue = stringValue.replace(".", "");
|
|
32208
|
+
}
|
|
32209
|
+
let i;
|
|
32210
|
+
if ((i = stringValue.search(/e/i)) > 0) {
|
|
32211
|
+
// Determine exponent.
|
|
32212
|
+
if (exp === undefined) {
|
|
32213
|
+
exp = i - start;
|
|
32214
|
+
}
|
|
32215
|
+
exp += Number(stringValue.slice(i + 1));
|
|
32216
|
+
stringValue = stringValue.slice(start, i);
|
|
32217
|
+
decimal = Math.max(stringValue.length - exp, 0);
|
|
32218
|
+
}
|
|
32219
|
+
else if (exp === undefined) {
|
|
32220
|
+
// Integer.
|
|
32221
|
+
exp = stringValue.length - start;
|
|
32222
|
+
stringValue = stringValue.slice(start);
|
|
32223
|
+
}
|
|
32224
|
+
else {
|
|
32225
|
+
stringValue = stringValue.slice(start);
|
|
32226
|
+
}
|
|
32227
|
+
let end = stringValue.length;
|
|
32228
|
+
while (stringValue[end - 1] === "0" && end > adjustedPointIndex) {
|
|
32229
|
+
end--;
|
|
32230
|
+
}
|
|
32231
|
+
// Only if there is 0 before the decimal point, keeps checking how many 0 there is after it and update the exponent accordingly.
|
|
32232
|
+
if (start === adjustedPointIndex + 1) {
|
|
32233
|
+
let cur = adjustedPointIndex;
|
|
32234
|
+
while (stringValue[cur] === "0" && cur < end) {
|
|
32235
|
+
cur++;
|
|
32236
|
+
exp--;
|
|
32237
|
+
}
|
|
32238
|
+
}
|
|
32239
|
+
try {
|
|
32240
|
+
stringValue = stringValue.slice(0, end);
|
|
32241
|
+
stringValue = stringValue + "0".repeat(Math.max(exp - stringValue.length, 0)); // add remaining zeros for cases like 3e30
|
|
32242
|
+
n = BigInt(stringValue);
|
|
32243
|
+
if (n === 0n) {
|
|
32244
|
+
decimal = 0;
|
|
32245
|
+
}
|
|
32246
|
+
else if (decimal === undefined) {
|
|
32247
|
+
decimal = Math.max(stringValue.length - Math.max(exp, 0), 0);
|
|
32248
|
+
}
|
|
32249
|
+
}
|
|
32250
|
+
catch {
|
|
32251
|
+
throw new InvalidNumericError(`Invalid numeric value: ${original}`);
|
|
32252
|
+
}
|
|
32253
|
+
}
|
|
32254
|
+
return { n, e: exp, s: sign, d: decimal };
|
|
32255
|
+
}
|
|
32256
|
+
function stringify(value) {
|
|
32257
|
+
if (value.n === 0n)
|
|
32258
|
+
return "0";
|
|
32259
|
+
const n = value.n.toString();
|
|
32260
|
+
const sign = value.s === -1 ? "-" : "";
|
|
32261
|
+
const int = value.e <= 0 ? "0" : n.slice(0, value.e);
|
|
32262
|
+
const decimal = value.e < n.length ? "." + n.slice(-value.d).padStart(value.d, "0") : "";
|
|
32263
|
+
return sign + int + decimal;
|
|
32264
|
+
}
|
|
32265
|
+
const equals = (a, b) => a.n === b.n && a.e === b.e;
|
|
32266
|
+
const compare = (a, b) => {
|
|
32267
|
+
if (a.s < b.s) {
|
|
32268
|
+
return -1;
|
|
32269
|
+
}
|
|
32270
|
+
else if (a.s > b.s) {
|
|
32271
|
+
return 1;
|
|
32272
|
+
}
|
|
32273
|
+
const neg = a.s;
|
|
32274
|
+
if (a.e < b.e) {
|
|
32275
|
+
return (-1 * neg);
|
|
32276
|
+
}
|
|
32277
|
+
else if (a.e > b.e) {
|
|
32278
|
+
return (1 * neg);
|
|
32279
|
+
}
|
|
32280
|
+
let aN = a.n;
|
|
32281
|
+
let bN = b.n;
|
|
32282
|
+
if (a.d < b.d) {
|
|
32283
|
+
aN *= 10n ** BigInt(b.d - a.d);
|
|
32284
|
+
}
|
|
32285
|
+
else {
|
|
32286
|
+
bN *= 10n ** BigInt(a.d - b.d);
|
|
32287
|
+
}
|
|
32288
|
+
if (aN < bN)
|
|
32289
|
+
return (-1 * neg);
|
|
32290
|
+
if (aN > bN)
|
|
32291
|
+
return (1 * neg);
|
|
32292
|
+
return 0;
|
|
32293
|
+
};
|
|
32294
|
+
const NumericPrototype = {
|
|
32295
|
+
toString: function () {
|
|
32296
|
+
return stringify(this[InternalDataSym]);
|
|
32297
|
+
},
|
|
32298
|
+
asNumber: function () {
|
|
32299
|
+
const num = Number(stringify(this[InternalDataSym]));
|
|
32300
|
+
return equals(this[InternalDataSym], Numeric(num.toString())[InternalDataSym]) ? num : null;
|
|
32301
|
+
},
|
|
32302
|
+
asBigInt: function () {
|
|
32303
|
+
if (!this.isInteger) {
|
|
32304
|
+
return null;
|
|
32305
|
+
}
|
|
32306
|
+
const { s, n } = this[InternalDataSym];
|
|
32307
|
+
return BigInt(s) * n;
|
|
32308
|
+
},
|
|
32309
|
+
equals: function (other) {
|
|
32310
|
+
return equals(this[InternalDataSym], other[InternalDataSym]);
|
|
32311
|
+
},
|
|
32312
|
+
lt: function (other) {
|
|
32313
|
+
return compare(this[InternalDataSym], other[InternalDataSym]) === -1;
|
|
32314
|
+
},
|
|
32315
|
+
lte: function (other) {
|
|
32316
|
+
return compare(this[InternalDataSym], other[InternalDataSym]) <= 0;
|
|
32317
|
+
},
|
|
32318
|
+
gt: function (other) {
|
|
32319
|
+
return compare(this[InternalDataSym], other[InternalDataSym]) === 1;
|
|
32320
|
+
},
|
|
32321
|
+
gte: function (other) {
|
|
32322
|
+
return compare(this[InternalDataSym], other[InternalDataSym]) >= 0;
|
|
32323
|
+
},
|
|
32324
|
+
};
|
|
32325
|
+
NumericPrototype.toString = function () {
|
|
32326
|
+
return stringify(this[InternalDataSym]);
|
|
32327
|
+
};
|
|
32328
|
+
|
|
32349
32329
|
defineKit({
|
|
32350
32330
|
value: {
|
|
32351
32331
|
is(value) {
|
|
@@ -34325,7 +34305,7 @@ let manifest;
|
|
|
34325
34305
|
try {
|
|
34326
34306
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34327
34307
|
// @ts-ignore
|
|
34328
|
-
manifest = (await import('../manifest-
|
|
34308
|
+
manifest = (await import('../manifest-DH1LKq9n.js')).default;
|
|
34329
34309
|
}
|
|
34330
34310
|
catch {
|
|
34331
34311
|
const name = "../dist/manifest.js";
|
|
@@ -45459,39 +45439,62 @@ function isMapLike(value) {
|
|
|
45459
45439
|
return "entries" in value && typeof value.entries === "function";
|
|
45460
45440
|
}
|
|
45461
45441
|
|
|
45462
|
-
const
|
|
45442
|
+
const CommonPropsConfig = {
|
|
45443
|
+
namespace: "parent",
|
|
45444
|
+
name: "value"
|
|
45445
|
+
};
|
|
45446
|
+
const HiddenProps = [
|
|
45447
|
+
"entityKind",
|
|
45448
|
+
"kind",
|
|
45449
|
+
"node",
|
|
45450
|
+
"symbol",
|
|
45451
|
+
"templateNode",
|
|
45452
|
+
"templateArguments",
|
|
45453
|
+
"templateMapper",
|
|
45454
|
+
"instantiationParameters",
|
|
45455
|
+
"decorators",
|
|
45456
|
+
"isFinished"
|
|
45457
|
+
];
|
|
45458
|
+
const HiddenPropsConfig = Object.fromEntries(HiddenProps.map((prop) => [prop, "skip"]));
|
|
45459
|
+
const TypeConfig = buildConfig({
|
|
45463
45460
|
Namespace: {
|
|
45464
45461
|
namespaces: "skip",
|
|
45465
|
-
models: "nested",
|
|
45466
|
-
scalars: "nested",
|
|
45467
|
-
interfaces: "nested",
|
|
45468
|
-
operations: "nested",
|
|
45469
|
-
unions: "nested",
|
|
45470
|
-
enums: "nested",
|
|
45471
|
-
decoratorDeclarations: "nested"
|
|
45462
|
+
models: "nested-items",
|
|
45463
|
+
scalars: "nested-items",
|
|
45464
|
+
interfaces: "nested-items",
|
|
45465
|
+
operations: "nested-items",
|
|
45466
|
+
unions: "nested-items",
|
|
45467
|
+
enums: "nested-items",
|
|
45468
|
+
decoratorDeclarations: "nested-items"
|
|
45472
45469
|
},
|
|
45473
45470
|
Interface: {
|
|
45474
|
-
operations: "nested",
|
|
45471
|
+
operations: "nested-items",
|
|
45475
45472
|
sourceInterfaces: "ref"
|
|
45476
45473
|
},
|
|
45477
45474
|
Operation: {
|
|
45478
45475
|
interface: "parent",
|
|
45479
|
-
parameters: "nested",
|
|
45476
|
+
parameters: "nested-items",
|
|
45480
45477
|
returnType: "ref",
|
|
45481
45478
|
sourceOperation: "ref"
|
|
45482
45479
|
},
|
|
45483
45480
|
Model: {
|
|
45484
|
-
indexer:
|
|
45481
|
+
indexer: {
|
|
45482
|
+
kind: "nested",
|
|
45483
|
+
properties: {
|
|
45484
|
+
key: "ref",
|
|
45485
|
+
value: "ref"
|
|
45486
|
+
}
|
|
45487
|
+
},
|
|
45485
45488
|
baseModel: "ref",
|
|
45486
45489
|
derivedModels: "ref",
|
|
45487
|
-
properties: "nested",
|
|
45490
|
+
properties: "nested-items",
|
|
45488
45491
|
sourceModel: "ref",
|
|
45489
45492
|
sourceModels: "value"
|
|
45490
45493
|
},
|
|
45491
45494
|
Scalar: {
|
|
45492
45495
|
baseScalar: "ref",
|
|
45493
45496
|
derivedScalars: "ref",
|
|
45494
|
-
constructors: "nested"
|
|
45497
|
+
constructors: "nested-items"
|
|
45495
45498
|
},
|
|
45496
45499
|
ModelProperty: {
|
|
45497
45500
|
model: "parent",
|
|
@@ -45501,7 +45504,7 @@ const TypeConfig = {
|
|
|
45501
45504
|
defaultValue: "value"
|
|
45502
45505
|
},
|
|
45503
45506
|
Enum: {
|
|
45504
|
-
members: "nested"
|
|
45507
|
+
members: "nested-items"
|
|
45505
45508
|
},
|
|
45506
45509
|
EnumMember: {
|
|
45507
45510
|
enum: "parent",
|
|
@@ -45509,8 +45512,8 @@ const TypeConfig = {
|
|
|
45509
45512
|
value: "value"
|
|
45510
45513
|
},
|
|
45511
45514
|
Union: {
|
|
45512
|
-
expression: "
|
|
45513
|
-
variants: "nested"
|
|
45515
|
+
expression: "value",
|
|
45516
|
+
variants: "nested-items"
|
|
45514
45517
|
},
|
|
45515
45518
|
UnionVariant: {
|
|
45516
45519
|
union: "parent",
|
|
@@ -45520,13 +45523,13 @@ const TypeConfig = {
|
|
|
45520
45523
|
value: "value"
|
|
45521
45524
|
},
|
|
45522
45525
|
Decorator: {
|
|
45523
|
-
parameters: "nested",
|
|
45526
|
+
parameters: "nested-items",
|
|
45524
45527
|
implementation: "skip",
|
|
45525
45528
|
target: "ref"
|
|
45526
45529
|
},
|
|
45527
45530
|
ScalarConstructor: {
|
|
45528
45531
|
scalar: "parent",
|
|
45529
|
-
parameters: "nested"
|
|
45532
|
+
parameters: "nested-items"
|
|
45530
45533
|
},
|
|
45531
45534
|
FunctionParameter: null,
|
|
45532
45535
|
Number: {
|
|
@@ -45538,10 +45541,10 @@ const TypeConfig = {
|
|
|
45538
45541
|
value: "value"
|
|
45539
45542
|
},
|
|
45540
45543
|
Tuple: {
|
|
45541
|
-
values: "nested"
|
|
45544
|
+
values: "nested-items"
|
|
45542
45545
|
},
|
|
45543
45546
|
StringTemplate: {
|
|
45544
|
-
spans: "nested",
|
|
45547
|
+
spans: "nested-items",
|
|
45545
45548
|
stringValue: "value"
|
|
45546
45549
|
},
|
|
45547
45550
|
StringTemplateSpan: {
|
|
@@ -45554,29 +45557,38 @@ const TypeConfig = {
|
|
|
45554
45557
|
},
|
|
45555
45558
|
// Don't want to expose those for now
|
|
45556
45559
|
Intrinsic: null
|
|
45557
|
-
};
|
|
45558
|
-
const CommonPropsConfig = {
|
|
45559
|
-
namespace: "parent"
|
|
45560
|
-
};
|
|
45561
|
-
const HiddenProps = [
|
|
45562
|
-
"entityKind",
|
|
45563
|
-
"kind",
|
|
45564
|
-
"name",
|
|
45565
|
-
"node",
|
|
45566
|
-
"symbol",
|
|
45567
|
-
"templateNode",
|
|
45568
|
-
"templateArguments",
|
|
45569
|
-
"templateMapper",
|
|
45570
|
-
"instantiationParameters",
|
|
45571
|
-
"decorators",
|
|
45572
|
-
"projector",
|
|
45573
|
-
"isFinished"
|
|
45574
|
-
];
|
|
45560
|
+
});
|
|
45575
45561
|
new Set(HiddenProps);
|
|
45576
|
-
function
|
|
45577
|
-
|
|
45578
|
-
|
|
45579
|
-
|
|
45562
|
+
function getRenderingConfig(type) {
|
|
45563
|
+
return TypeConfig[type.kind];
|
|
45564
|
+
}
|
|
45565
|
+
function buildConfig(raw) {
|
|
45566
|
+
return Object.fromEntries(
|
|
45567
|
+
Object.entries(raw).map(([kind, config]) => {
|
|
45568
|
+
return [kind, buildConfigForKind(config)];
|
|
45569
|
+
})
|
|
45570
|
+
);
|
|
45571
|
+
}
|
|
45572
|
+
function buildConfigForKind(config) {
|
|
45573
|
+
if (config === null) {
|
|
45574
|
+
return null;
|
|
45575
|
+
}
|
|
45576
|
+
return Object.fromEntries(
|
|
45577
|
+
Object.entries({ ...CommonPropsConfig, ...HiddenPropsConfig, ...config }).map(
|
|
45578
|
+
([key, value]) => {
|
|
45579
|
+
return [key, buildConfigForProperty(value)];
|
|
45580
|
+
}
|
|
45581
|
+
)
|
|
45582
|
+
);
|
|
45583
|
+
}
|
|
45584
|
+
function buildConfigForProperty(value) {
|
|
45585
|
+
if (typeof value === "string") {
|
|
45586
|
+
return { kind: value };
|
|
45587
|
+
}
|
|
45588
|
+
return {
|
|
45589
|
+
kind: "nested",
|
|
45590
|
+
properties: buildConfigForKind(value.properties)
|
|
45591
|
+
};
|
|
45580
45592
|
}
|
|
45581
45593
|
|
|
45582
45594
|
function expandNamespaces(namespace) {
|
|
@@ -45646,7 +45658,7 @@ function computeTypeNode(parentPath, type, name) {
|
|
|
45646
45658
|
}
|
|
45647
45659
|
function computeTypeNodeProps(path, type, name) {
|
|
45648
45660
|
const typeRendering = TypeConfig[type.kind];
|
|
45649
|
-
const children = Object.entries(type).filter(([key]) => typeRendering?.[key] === "nested").map(([key, value]) => {
|
|
45661
|
+
const children = Object.entries(type).filter(([key]) => typeRendering?.[key]?.kind === "nested-items").map(([key, value]) => {
|
|
45650
45662
|
const propPath = path + "." + key;
|
|
45651
45663
|
if (isMapLike(value)) {
|
|
45652
45664
|
return computeItemList(propPath, key, value);
|
|
@@ -46066,13 +46078,22 @@ const SimpleType = ({ type, children }) => {
|
|
|
46066
46078
|
children
|
|
46067
46079
|
] });
|
|
46068
46080
|
};
|
|
46069
|
-
const EntityProperties = ({ entity
|
|
46070
|
-
|
|
46071
|
-
|
|
46072
|
-
|
|
46081
|
+
const EntityProperties = ({ entity }) => {
|
|
46082
|
+
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(InspectObject, { value: entity, config: getRenderingConfig(entity) });
|
|
46083
|
+
};
|
|
46084
|
+
const InspectObject = ({
|
|
46085
|
+
value,
|
|
46086
|
+
config
|
|
46087
|
+
}) => {
|
|
46088
|
+
if (value === void 0) {
|
|
46089
|
+
return null;
|
|
46090
|
+
}
|
|
46091
|
+
const props = Object.entries(value).map(([key, value2]) => {
|
|
46092
|
+
const action = config?.[key];
|
|
46093
|
+
if (action === void 0 || action === null || action.kind === "skip") {
|
|
46073
46094
|
return void 0;
|
|
46074
46095
|
}
|
|
46075
|
-
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(EntityProperty, { name: key, value, action }, key);
|
|
46096
|
+
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(EntityProperty, { name: key, value: value2, action }, key);
|
|
46076
46097
|
}).filter((x) => Boolean(x));
|
|
46077
46098
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsx("ul", { children: props });
|
|
46078
46099
|
};
|
|
@@ -46086,12 +46107,15 @@ const EntityProperty = (props) => {
|
|
|
46086
46107
|
};
|
|
46087
46108
|
const EntityPropertyValue = ({ value, action }) => {
|
|
46088
46109
|
const render = (x) => {
|
|
46089
|
-
if (action === "parent") {
|
|
46110
|
+
if (action.kind === "parent") {
|
|
46090
46111
|
return x.entityKind === "Type" ? /* @__PURE__ */ jsxRuntimeExports$1.jsx(ParentReference, { type: x }) : null;
|
|
46091
46112
|
}
|
|
46092
|
-
const renderRef = action === "ref";
|
|
46113
|
+
const renderRef = action.kind === "ref";
|
|
46093
46114
|
return renderRef ? /* @__PURE__ */ jsxRuntimeExports$1.jsx(EntityReference, { entity: x }) : /* @__PURE__ */ jsxRuntimeExports$1.jsx(EntityUI, { entity: x });
|
|
46094
46115
|
};
|
|
46116
|
+
if (action.kind === "nested") {
|
|
46117
|
+
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(InspectObject, { value, config: action.properties });
|
|
46118
|
+
}
|
|
46095
46119
|
if (value === void 0) {
|
|
46096
46120
|
return null;
|
|
46097
46121
|
} else if (value.entityKind) {
|
|
@@ -46361,9 +46385,9 @@ const style$1 = {
|
|
|
46361
46385
|
|
|
46362
46386
|
const TypeDataTable = ({ type }) => {
|
|
46363
46387
|
const program = useProgram();
|
|
46364
|
-
const entries = [...program.stateMaps.entries()].map(([k, v]) => [k, v.get(
|
|
46388
|
+
const entries = [...program.stateMaps.entries()].map(([k, v]) => [k, v.get(type)]).filter(([k, v]) => !!v);
|
|
46365
46389
|
if (entries.length === 0) {
|
|
46366
|
-
return
|
|
46390
|
+
return "No decorator state found on this type.";
|
|
46367
46391
|
}
|
|
46368
46392
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsxs("table", { className: style$1["table"], children: [
|
|
46369
46393
|
/* @__PURE__ */ jsxRuntimeExports$1.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs("tr", { children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-type.d.ts","sourceRoot":"","sources":["../../../src/react/inspect-type/inspect-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAe,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"inspect-type.d.ts","sourceRoot":"","sources":["../../../src/react/inspect-type/inspect-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAe,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAc/F,UAAU,gBAAgB;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAM3D,CAAC;AAuEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAmD3D,CAAC"}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
import { Type } from '@typespec/compiler';
|
|
2
|
-
export type
|
|
1
|
+
import { Entity, Type } from '@typespec/compiler';
|
|
2
|
+
export type PropertyRendering<T> = {
|
|
3
|
+
kind: "parent" | "nested-items" | "ref" | "value" | "skip";
|
|
4
|
+
} | NestedPropertyRendering<T>;
|
|
5
|
+
export type PropertyRenderingRaw<T> = "parent" | "nested-items" | "ref" | "value" | "skip" | NestedPropertyRenderingRaw<T>;
|
|
6
|
+
export type PropertiesRenderingRaw<T> = {
|
|
7
|
+
[K in keyof T]: PropertyRenderingRaw<T[K]>;
|
|
8
|
+
};
|
|
9
|
+
export type PropertiesRendering<T> = {
|
|
10
|
+
[K in keyof T]: PropertyRendering<T[K]>;
|
|
11
|
+
};
|
|
12
|
+
export type NestedPropertyRendering<T> = {
|
|
13
|
+
kind: "nested";
|
|
14
|
+
properties: PropertiesRendering<T>;
|
|
15
|
+
};
|
|
16
|
+
export type NestedPropertyRenderingRaw<T> = {
|
|
17
|
+
kind: "nested";
|
|
18
|
+
properties: PropertiesRenderingRaw<T>;
|
|
19
|
+
};
|
|
20
|
+
export declare const CommonPropsConfig: {
|
|
21
|
+
namespace: string;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
3
24
|
export declare const TypeConfig: TypeGraphConfig;
|
|
4
|
-
type
|
|
5
|
-
type TypeConfig<T extends Type> = Record<PropsToDefine<T>, EntityPropertyConfig> | null;
|
|
25
|
+
type TypeConfig<T extends Type> = PropertiesRendering<T> | null;
|
|
6
26
|
type TypeGraphConfig = {
|
|
7
27
|
[K in Type["kind"]]: TypeConfig<Extract<Type, {
|
|
8
28
|
kind: K;
|
|
9
29
|
}>>;
|
|
10
30
|
};
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare const HiddenProps: readonly ["entityKind", "kind", "name", "node", "symbol", "templateNode", "templateArguments", "templateMapper", "instantiationParameters", "decorators", "projector", "isFinished"];
|
|
15
|
-
type HiddenPropsType = (typeof HiddenProps)[number];
|
|
16
|
-
export declare const HiddenPropsSet: Set<"symbol" | "kind" | "entityKind" | "name" | "node" | "templateNode" | "templateArguments" | "templateMapper" | "instantiationParameters" | "decorators" | "projector" | "isFinished">;
|
|
17
|
-
export declare function getPropertyRendering<T extends Type, K extends keyof T>(type: T, key: K): EntityPropertyConfig;
|
|
31
|
+
export declare const HiddenPropsSet: Set<"symbol" | "entityKind" | "kind" | "node" | "templateNode" | "templateArguments" | "templateMapper" | "instantiationParameters" | "decorators" | "isFinished">;
|
|
32
|
+
export declare function getPropertyRendering<T extends Type, K extends keyof T>(type: T, key: K): PropertyRenderingRaw<T>;
|
|
33
|
+
export declare function getRenderingConfig<T extends Entity>(type: T): PropertiesRendering<T> | null;
|
|
18
34
|
export {};
|
|
19
35
|
//# sourceMappingURL=type-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-config.d.ts","sourceRoot":"","sources":["../../src/react/type-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"type-config.d.ts","sourceRoot":"","sources":["../../src/react/type-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC3B;IAAE,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;CAAE,GAC9D,uBAAuB,CAAC,CAAC,CAAC,CAAC;AAC/B,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAC9B,QAAQ,GACR,cAAc,GACd,KAAK,GACL,OAAO,GACP,MAAM,GACN,0BAA0B,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AACvF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEjF,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;CACpC,CAAC;AACF,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAoBF,eAAO,MAAM,UAAU,EAAE,eAsGvB,CAAC;AAOH,KAAK,UAAU,CAAC,CAAC,SAAS,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAChE,KAAK,eAAe,GAAG;KACpB,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAC5D,CAAC;AAIF,eAAO,MAAM,cAAc,oKAAuB,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,MAAM,CAAC,EACpE,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,CAAC,GACL,oBAAoB,CAAC,CAAC,CAAC,CAIzB;AACD,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI,CAE3F"}
|
package/package.json
CHANGED