@typespec/html-program-viewer 0.79.0-dev.1 → 0.79.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/react/index.js
CHANGED
|
@@ -47779,17 +47779,12 @@ function isType(entity) {
|
|
|
47779
47779
|
function isValue(entity) {
|
|
47780
47780
|
return entity.entityKind === "Value";
|
|
47781
47781
|
}
|
|
47782
|
-
|
|
47783
|
-
|
|
47784
|
-
*/
|
|
47785
|
-
function isArrayModelType(program, type) {
|
|
47782
|
+
function isArrayModelType(programOrType, maybeType) {
|
|
47783
|
+
const type = programOrType;
|
|
47786
47784
|
return Boolean(type.indexer && type.indexer.key.name === "integer");
|
|
47787
47785
|
}
|
|
47788
|
-
|
|
47789
|
-
|
|
47790
|
-
* @param type Model type
|
|
47791
|
-
*/
|
|
47792
|
-
function isRecordModelType(program, type) {
|
|
47786
|
+
function isRecordModelType(programOrType, maybeType) {
|
|
47787
|
+
const type = programOrType;
|
|
47793
47788
|
return Boolean(type.indexer && type.indexer.key.name === "string");
|
|
47794
47789
|
}
|
|
47795
47790
|
/**
|
|
@@ -47817,7 +47812,7 @@ defineKit({
|
|
|
47817
47812
|
is(type) {
|
|
47818
47813
|
return (type.entityKind === "Type" &&
|
|
47819
47814
|
type.kind === "Model" &&
|
|
47820
|
-
isArrayModelType(
|
|
47815
|
+
isArrayModelType(type) &&
|
|
47821
47816
|
type.properties.size === 0);
|
|
47822
47817
|
},
|
|
47823
47818
|
getElementType(type) {
|
|
@@ -49749,7 +49744,7 @@ const [
|
|
|
49749
49744
|
isPageItemsProperty, markPageItemsProperty,
|
|
49750
49745
|
/** {@inheritdoc PageItemsDecorator} */
|
|
49751
49746
|
pageItemsDecorator,] = createMarkerDecorator("pageItems", (context, target) => {
|
|
49752
|
-
if (target.type.kind !== "Model" || !isArrayModelType(
|
|
49747
|
+
if (target.type.kind !== "Model" || !isArrayModelType(target.type)) {
|
|
49753
49748
|
reportDiagnostic(context.program, {
|
|
49754
49749
|
code: "decorator-wrong-target",
|
|
49755
49750
|
messageId: "withExpected",
|
|
@@ -49768,18 +49763,7 @@ const [
|
|
|
49768
49763
|
*/
|
|
49769
49764
|
isContinuationTokenProperty, markContinuationTokenProperty,
|
|
49770
49765
|
/** {@inheritdoc ContinuationTokenDecorator} */
|
|
49771
|
-
continuationTokenDecorator,] = createMarkerDecorator("continuationToken"
|
|
49772
|
-
if (!isStringType(context.program, target.type)) {
|
|
49773
|
-
reportDiagnostic(context.program, {
|
|
49774
|
-
code: "decorator-wrong-target",
|
|
49775
|
-
messageId: "withExpected",
|
|
49776
|
-
format: { decorator: "continuationToken", expected: "string", to: getTypeName(target.type) },
|
|
49777
|
-
target: context.decoratorTarget,
|
|
49778
|
-
});
|
|
49779
|
-
return false;
|
|
49780
|
-
}
|
|
49781
|
-
return true;
|
|
49782
|
-
});
|
|
49766
|
+
continuationTokenDecorator,] = createMarkerDecorator("continuationToken");
|
|
49783
49767
|
const [
|
|
49784
49768
|
/**
|
|
49785
49769
|
* Check if the given property is the `@nextLink` property for a paging operation.
|
|
@@ -50076,10 +50060,6 @@ const $doc = (context, target, text, sourceObject) => {
|
|
|
50076
50060
|
function getDoc(program, target) {
|
|
50077
50061
|
return getDocDataInternal(program, target, "self")?.value;
|
|
50078
50062
|
}
|
|
50079
|
-
function isStringType(program, target) {
|
|
50080
|
-
const stringType = program.checker.getStdType("string");
|
|
50081
|
-
return (target.kind === "Scalar" && program.checker.isTypeAssignableTo(target, stringType, target)[0]);
|
|
50082
|
-
}
|
|
50083
50063
|
function isNumericType(program, target) {
|
|
50084
50064
|
const numericType = program.checker.getStdType("numeric");
|
|
50085
50065
|
return (target.kind === "Scalar" && program.checker.isTypeAssignableTo(target, numericType, target)[0]);
|
|
@@ -50369,7 +50349,7 @@ defineKit({
|
|
|
50369
50349
|
is(type) {
|
|
50370
50350
|
return (type.entityKind === "Type" &&
|
|
50371
50351
|
type.kind === "Model" &&
|
|
50372
|
-
isRecordModelType(
|
|
50352
|
+
isRecordModelType(type) &&
|
|
50373
50353
|
type.properties.size === 0);
|
|
50374
50354
|
},
|
|
50375
50355
|
getElementType(type) {
|
|
@@ -51122,6 +51102,106 @@ var Related;
|
|
|
51122
51102
|
})(Related || (Related = {}));
|
|
51123
51103
|
// #endregion
|
|
51124
51104
|
|
|
51105
|
+
var CheckFlags;
|
|
51106
|
+
(function (CheckFlags) {
|
|
51107
|
+
/** No flags set. */
|
|
51108
|
+
CheckFlags[CheckFlags["None"] = 0] = "None";
|
|
51109
|
+
/** Currently checking within an uninstantiated template declaration. */
|
|
51110
|
+
CheckFlags[CheckFlags["InTemplateDeclaration"] = 1] = "InTemplateDeclaration";
|
|
51111
|
+
})(CheckFlags || (CheckFlags = {}));
|
|
51112
|
+
class CheckContext {
|
|
51113
|
+
/** The type mapper associated with this context, if any. */
|
|
51114
|
+
mapper;
|
|
51115
|
+
/** The flags enabled in this context. */
|
|
51116
|
+
flags;
|
|
51117
|
+
#templateParametersObserved;
|
|
51118
|
+
static from(contextOrMapper) {
|
|
51119
|
+
if (contextOrMapper instanceof CheckContext) {
|
|
51120
|
+
return contextOrMapper;
|
|
51121
|
+
}
|
|
51122
|
+
return new CheckContext(contextOrMapper, CheckFlags.None);
|
|
51123
|
+
}
|
|
51124
|
+
/**
|
|
51125
|
+
* The default CheckContext to use at API entrypoints.
|
|
51126
|
+
*/
|
|
51127
|
+
static DEFAULT = new CheckContext(undefined, CheckFlags.None);
|
|
51128
|
+
constructor(mapper, flags, templateParametersObserved) {
|
|
51129
|
+
this.mapper = mapper;
|
|
51130
|
+
this.flags = flags;
|
|
51131
|
+
this.#templateParametersObserved = templateParametersObserved;
|
|
51132
|
+
Object.freeze(this);
|
|
51133
|
+
}
|
|
51134
|
+
/**
|
|
51135
|
+
* Returns a new context with the given flags _added_ to the existing flags.
|
|
51136
|
+
*
|
|
51137
|
+
* @param flags - the flags to enable
|
|
51138
|
+
* @returns a new CheckContext with the given flags enabled.
|
|
51139
|
+
*/
|
|
51140
|
+
withFlags(flags) {
|
|
51141
|
+
return new CheckContext(this.mapper, this.flags | flags, this.#templateParametersObserved);
|
|
51142
|
+
}
|
|
51143
|
+
/**
|
|
51144
|
+
* Returns a new context with the given flags disabled.
|
|
51145
|
+
*
|
|
51146
|
+
* @param flags - the flags to disable
|
|
51147
|
+
* @returns a new CheckContext with the given flags disabled.
|
|
51148
|
+
*/
|
|
51149
|
+
maskFlags(flags) {
|
|
51150
|
+
return new CheckContext(this.mapper, this.flags & ~flags, this.#templateParametersObserved);
|
|
51151
|
+
}
|
|
51152
|
+
/**
|
|
51153
|
+
* Returns true if ALL of the given flags are enabled in this context.
|
|
51154
|
+
*/
|
|
51155
|
+
hasFlags(flags) {
|
|
51156
|
+
return (this.flags & flags) === flags;
|
|
51157
|
+
}
|
|
51158
|
+
/**
|
|
51159
|
+
* Returns a new context with the given mapper.
|
|
51160
|
+
*
|
|
51161
|
+
* @param mapper - the new type mapper, or undefined to clear the mapper
|
|
51162
|
+
* @returns a new CheckContext with the given mapper.
|
|
51163
|
+
*/
|
|
51164
|
+
withMapper(mapper) {
|
|
51165
|
+
return new CheckContext(mapper, this.flags, this.#templateParametersObserved);
|
|
51166
|
+
}
|
|
51167
|
+
/**
|
|
51168
|
+
* Observes a template parameter within the current observation scope, if any.
|
|
51169
|
+
*
|
|
51170
|
+
* @param param - the TemplateParameter type instance to observe
|
|
51171
|
+
*/
|
|
51172
|
+
observeTemplateParameter(param) {
|
|
51173
|
+
this.#templateParametersObserved?.add(param);
|
|
51174
|
+
}
|
|
51175
|
+
/**
|
|
51176
|
+
* Returns a new CheckContext with a new (empty) template parameter observation scope.
|
|
51177
|
+
*
|
|
51178
|
+
* Call this when you need to observe template parameters used within a specific context.
|
|
51179
|
+
*
|
|
51180
|
+
* @returns a new CheckContext with an empty template parameter observation scope.
|
|
51181
|
+
*/
|
|
51182
|
+
enterTemplateObserverScope() {
|
|
51183
|
+
return new CheckContext(this.mapper, this.flags, new Set());
|
|
51184
|
+
}
|
|
51185
|
+
/**
|
|
51186
|
+
* Creates a new CheckContext with no template parameter observation enabled.
|
|
51187
|
+
*
|
|
51188
|
+
* Call this when the checker is moving from one declaration to another, where usage of template parameters
|
|
51189
|
+
* from the next scope should not impact the usage from the previous scope.
|
|
51190
|
+
*
|
|
51191
|
+
* @returns a new CheckContext with no template parameter observation.
|
|
51192
|
+
*/
|
|
51193
|
+
exitTemplateObserverScope() {
|
|
51194
|
+
return new CheckContext(this.mapper, this.flags, undefined);
|
|
51195
|
+
}
|
|
51196
|
+
/**
|
|
51197
|
+
* @returns true if the observer scope in this context has seen any template parameter usage.
|
|
51198
|
+
*/
|
|
51199
|
+
hasObservedTemplateParameters() {
|
|
51200
|
+
return this.#templateParametersObserved !== undefined
|
|
51201
|
+
? this.#templateParametersObserved.size > 0
|
|
51202
|
+
: false;
|
|
51203
|
+
}
|
|
51204
|
+
}
|
|
51125
51205
|
/**
|
|
51126
51206
|
* Find all named models that could have been the source of the given
|
|
51127
51207
|
* property. This includes the named parents of all property sources in a
|
|
@@ -51316,6 +51396,11 @@ var ResolutionKind;
|
|
|
51316
51396
|
ResolutionKind[ResolutionKind["Constraint"] = 3] = "Constraint";
|
|
51317
51397
|
})(ResolutionKind || (ResolutionKind = {}));
|
|
51318
51398
|
|
|
51399
|
+
const emittedFilesPerProgramKey = Symbol.for("TYPESPEC_EMITTED_FILES_PATHS");
|
|
51400
|
+
if (globalThis[emittedFilesPerProgramKey] === undefined) {
|
|
51401
|
+
globalThis[emittedFilesPerProgramKey] = new WeakMap();
|
|
51402
|
+
}
|
|
51403
|
+
|
|
51319
51404
|
var CommentCheckFlags;
|
|
51320
51405
|
(function (CommentCheckFlags) {
|
|
51321
51406
|
/** Check comment is a leading comment */
|
|
@@ -51355,7 +51440,7 @@ let manifest;
|
|
|
51355
51440
|
try {
|
|
51356
51441
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
51357
51442
|
// @ts-ignore
|
|
51358
|
-
manifest = (await import('../manifest-
|
|
51443
|
+
manifest = (await import('../manifest-BweYd_vW.js')).default;
|
|
51359
51444
|
}
|
|
51360
51445
|
catch {
|
|
51361
51446
|
const name = "../dist/manifest.js";
|
package/package.json
CHANGED