@typespec/html-program-viewer 0.72.0-dev.2 → 0.72.0-dev.4
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 +1 -1
- package/dist/{manifest-CVLhuDVf.js → manifest-Bn7Voc8C.js} +1 -1
- package/dist/react/index.js +228 -219
- package/dist/react/type-graph.d.ts +2 -0
- package/dist/react/type-graph.d.ts.map +1 -1
- package/dist/react/use-tree-navigation.d.ts +3 -1
- package/dist/react/use-tree-navigation.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
|
}
|
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-Bn7Voc8C.js')).default;
|
|
34329
34309
|
}
|
|
34330
34310
|
catch {
|
|
34331
34311
|
const name = "../dist/manifest.js";
|
|
@@ -45625,12 +45605,29 @@ function useTreeNavigator() {
|
|
|
45625
45605
|
}
|
|
45626
45606
|
return nav;
|
|
45627
45607
|
}
|
|
45628
|
-
const TypeGraphNavigatorProvider = ({
|
|
45629
|
-
|
|
45608
|
+
const TypeGraphNavigatorProvider = ({
|
|
45609
|
+
program,
|
|
45610
|
+
children,
|
|
45611
|
+
onNavigationChange,
|
|
45612
|
+
currentPath
|
|
45613
|
+
}) => {
|
|
45614
|
+
const treeNavigator = useTreeNavigatorInternal(program, onNavigationChange, currentPath);
|
|
45630
45615
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(TreeNavigatorContext.Provider, { value: treeNavigator, children });
|
|
45631
45616
|
};
|
|
45632
|
-
function useTreeNavigatorInternal(program) {
|
|
45633
|
-
const [selectedPath,
|
|
45617
|
+
function useTreeNavigatorInternal(program, onNavigationChange, currentPath) {
|
|
45618
|
+
const [selectedPath, setSelectedPath] = useState(currentPath || "");
|
|
45619
|
+
const selectPath = useCallback(
|
|
45620
|
+
(path) => {
|
|
45621
|
+
setSelectedPath(path);
|
|
45622
|
+
onNavigationChange?.(path);
|
|
45623
|
+
},
|
|
45624
|
+
[onNavigationChange]
|
|
45625
|
+
);
|
|
45626
|
+
useEffect(() => {
|
|
45627
|
+
if (currentPath !== void 0 && currentPath !== selectedPath) {
|
|
45628
|
+
setSelectedPath(currentPath);
|
|
45629
|
+
}
|
|
45630
|
+
}, [currentPath, selectedPath]);
|
|
45634
45631
|
const tree = useMemo(() => computeTree(program), [program]);
|
|
45635
45632
|
const { pathToNode, typeToPath } = useMemo(() => computeReferences(tree), [tree]);
|
|
45636
45633
|
const selectedNode = useMemo(() => pathToNode.get(selectedPath), [pathToNode, selectedPath]);
|
|
@@ -46405,9 +46402,9 @@ const style$1 = {
|
|
|
46405
46402
|
|
|
46406
46403
|
const TypeDataTable = ({ type }) => {
|
|
46407
46404
|
const program = useProgram();
|
|
46408
|
-
const entries = [...program.stateMaps.entries()].map(([k, v]) => [k, v.get(
|
|
46405
|
+
const entries = [...program.stateMaps.entries()].map(([k, v]) => [k, v.get(type)]).filter(([k, v]) => !!v);
|
|
46409
46406
|
if (entries.length === 0) {
|
|
46410
|
-
return
|
|
46407
|
+
return "No decorator state found on this type.";
|
|
46411
46408
|
}
|
|
46412
46409
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsxs("table", { className: style$1["table"], children: [
|
|
46413
46410
|
/* @__PURE__ */ jsxRuntimeExports$1.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs("tr", { children: [
|
|
@@ -46474,14 +46471,26 @@ const TypeNodeView = ({ node }) => {
|
|
|
46474
46471
|
] });
|
|
46475
46472
|
};
|
|
46476
46473
|
|
|
46477
|
-
const TypeGraph = ({
|
|
46478
|
-
|
|
46479
|
-
|
|
46480
|
-
|
|
46481
|
-
|
|
46482
|
-
|
|
46483
|
-
|
|
46484
|
-
|
|
46474
|
+
const TypeGraph = ({
|
|
46475
|
+
program,
|
|
46476
|
+
onNavigationChange,
|
|
46477
|
+
currentPath
|
|
46478
|
+
}) => {
|
|
46479
|
+
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
46480
|
+
TypeGraphNavigatorProvider,
|
|
46481
|
+
{
|
|
46482
|
+
program,
|
|
46483
|
+
onNavigationChange,
|
|
46484
|
+
currentPath,
|
|
46485
|
+
children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(ProgramProvider, { value: program, children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs(SplitPane, { initialSizes: ["200px", ""], split: "vertical", className: style$6["type-graph"], children: [
|
|
46486
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(Pane, { className: style$6["tree-navigation-pane"], children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(TreeNavigation, {}) }),
|
|
46487
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsxs(Pane, { className: style$6["view-pane"], children: [
|
|
46488
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: style$6["current-path"], children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(CurrentPath, {}) }),
|
|
46489
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(TypeGraphContent, {})
|
|
46490
|
+
] })
|
|
46491
|
+
] }) })
|
|
46492
|
+
}
|
|
46493
|
+
);
|
|
46485
46494
|
};
|
|
46486
46495
|
const TypeGraphContent = () => {
|
|
46487
46496
|
const nav = useTreeNavigator();
|
|
@@ -3,6 +3,8 @@ import { FunctionComponent } from 'react';
|
|
|
3
3
|
export declare function renderProgram(program: Program): string;
|
|
4
4
|
export interface TypeGraphProps {
|
|
5
5
|
readonly program: Program;
|
|
6
|
+
readonly onNavigationChange?: (path: string) => void;
|
|
7
|
+
readonly currentPath?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare const TypeGraph: FunctionComponent<TypeGraphProps>;
|
|
8
10
|
//# sourceMappingURL=type-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-graph.d.ts","sourceRoot":"","sources":["../../src/react/type-graph.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAO7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"type-graph.d.ts","sourceRoot":"","sources":["../../src/react/type-graph.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAO7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CA0BvD,CAAC"}
|
|
@@ -25,6 +25,8 @@ export declare function useTreeNavigator(): TreeNavigator;
|
|
|
25
25
|
export interface TypeGraphNavigatorProvider {
|
|
26
26
|
program: Program;
|
|
27
27
|
children: ReactNode;
|
|
28
|
+
onNavigationChange?: (path: string) => void;
|
|
29
|
+
currentPath?: string;
|
|
28
30
|
}
|
|
29
|
-
export declare const TypeGraphNavigatorProvider: ({ program, children }: TypeGraphNavigatorProvider) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const TypeGraphNavigatorProvider: ({ program, children, onNavigationChange, currentPath, }: TypeGraphNavigatorProvider) => import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
//# sourceMappingURL=use-tree-navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tree-navigation.d.ts","sourceRoot":"","sources":["../../src/react/use-tree-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"use-tree-navigation.d.ts","sourceRoot":"","sources":["../../src/react/use-tree-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAQD,wBAAgB,wBAAwB,IAAI,aAAa,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD,eAAO,MAAM,0BAA0B,GAAI,yDAKxC,0BAA0B,4CAK5B,CAAC"}
|
package/package.json
CHANGED