@picteus/extension-sdk 0.15.0 → 0.16.0
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/featureViewGrammar.d.ts +2814 -0
- package/dist/featureViewGrammar.js +2612 -0
- package/dist/generated/featureViewGrammar.d.ts +3913 -0
- package/dist/generated/featureViewGrammar.js +4099 -0
- package/dist/generated/viewKit.d.ts +3884 -0
- package/dist/generated/viewKit.js +4099 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/picteus-ws-client/apis/AdministrationApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/AdministrationApi.js +1 -1
- package/dist/picteus-ws-client/apis/ApiSecretApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/ApiSecretApi.js +1 -1
- package/dist/picteus-ws-client/apis/CollectionApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/CollectionApi.js +1 -1
- package/dist/picteus-ws-client/apis/ExtensionApi.d.ts +65 -32
- package/dist/picteus-ws-client/apis/ExtensionApi.js +82 -37
- package/dist/picteus-ws-client/apis/ImageApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/ImageApi.js +1 -1
- package/dist/picteus-ws-client/apis/ImageAttachmentApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/ImageAttachmentApi.js +1 -1
- package/dist/picteus-ws-client/apis/MiscellaneousApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/MiscellaneousApi.js +1 -1
- package/dist/picteus-ws-client/apis/RepositoryApi.d.ts +5 -5
- package/dist/picteus-ws-client/apis/RepositoryApi.js +3 -3
- package/dist/picteus-ws-client/apis/SettingsApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/SettingsApi.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecret.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecret.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecretSummary.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecretSummary.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecretType.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecretType.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationConfiguration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationConfiguration.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadata.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadata.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItem.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItem.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItemValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItemValue.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationSettings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationSettings.js +1 -1
- package/dist/picteus-ws-client/models/Collection.d.ts +1 -1
- package/dist/picteus-ws-client/models/Collection.js +1 -1
- package/dist/picteus-ws-client/models/CommandEntity.d.ts +1 -1
- package/dist/picteus-ws-client/models/CommandEntity.js +1 -1
- package/dist/picteus-ws-client/models/ComputedImageFormat.d.ts +1 -1
- package/dist/picteus-ws-client/models/ComputedImageFormat.js +1 -1
- package/dist/picteus-ws-client/models/ConfigurationCapability.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConfigurationCapability.js +1 -1
- package/dist/picteus-ws-client/models/ConfigurationExtensionCommand.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConfigurationExtensionCommand.js +1 -1
- package/dist/picteus-ws-client/models/ConstantsRegistry.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConstantsRegistry.js +1 -1
- package/dist/picteus-ws-client/models/Dates.d.ts +1 -1
- package/dist/picteus-ws-client/models/Dates.js +1 -1
- package/dist/picteus-ws-client/models/Extension.d.ts +5 -5
- package/dist/picteus-ws-client/models/Extension.js +5 -5
- package/dist/picteus-ws-client/models/ExtensionActivity.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivity.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivityKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivityKind.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionAndManual.d.ts +5 -5
- package/dist/picteus-ws-client/models/ExtensionAndManual.js +5 -5
- package/dist/picteus-ws-client/models/ExtensionCategory.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionCategory.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionGenerationOptions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionGenerationOptions.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionIdImageEmbeddingName.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionIdImageEmbeddingName.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageEmbeddings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageEmbeddings.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeature.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeature.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeatureName.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeatureName.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeaturesAttribute.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeaturesAttribute.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTag.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTag.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTagsAttribute.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTagsAttribute.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionManual.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionManual.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionSettings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionSettings.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionState.d.ts +25 -0
- package/dist/picteus-ws-client/models/ExtensionState.js +43 -0
- package/dist/picteus-ws-client/models/ExtensionsConfiguration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionsConfiguration.js +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipe.d.ts +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipe.js +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipePrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipePrompt.js +1 -1
- package/dist/picteus-ws-client/models/Image.d.ts +1 -1
- package/dist/picteus-ws-client/models/Image.js +1 -1
- package/dist/picteus-ws-client/models/ImageDimensions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageDimensions.js +1 -1
- package/dist/picteus-ws-client/models/ImageDistance.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageDistance.js +1 -1
- package/dist/picteus-ws-client/models/ImageEmbedding.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageEmbedding.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeature.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeature.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureFormat.d.ts +3 -1
- package/dist/picteus-ws-client/models/ImageFeatureFormat.js +4 -2
- package/dist/picteus-ws-client/models/ImageFeatureNullValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureNullValue.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureType.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureType.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureValue.js +1 -1
- package/dist/picteus-ws-client/models/ImageFormat.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFormat.js +1 -1
- package/dist/picteus-ws-client/models/ImageMediaUrl.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageMediaUrl.js +1 -1
- package/dist/picteus-ws-client/models/ImageMetadata.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageMetadata.js +1 -1
- package/dist/picteus-ws-client/models/ImageResizeRender.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageResizeRender.js +1 -1
- package/dist/picteus-ws-client/models/ImageSummary.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageSummary.js +1 -1
- package/dist/picteus-ws-client/models/InstructionsPrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/InstructionsPrompt.js +1 -1
- package/dist/picteus-ws-client/models/Manifest.d.ts +1 -1
- package/dist/picteus-ws-client/models/Manifest.js +1 -1
- package/dist/picteus-ws-client/models/ManifestCapability.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestCapability.js +1 -1
- package/dist/picteus-ws-client/models/ManifestCapabilityId.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestCapabilityId.js +1 -1
- package/dist/picteus-ws-client/models/ManifestEvent.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestEvent.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExecution.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExecution.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommand.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommand.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandOn.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandOn.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandSpecification.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandSpecification.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandUi.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandUi.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInstructions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInstructions.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElement.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElement.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElementIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElementIntegration.js +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntime.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntime.js +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntimeEnvironment.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntimeEnvironment.js +1 -1
- package/dist/picteus-ws-client/models/ManifestThrottlingPolicy.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestThrottlingPolicy.js +1 -1
- package/dist/picteus-ws-client/models/ManifestUserInterface.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestUserInterface.js +1 -1
- package/dist/picteus-ws-client/models/PromptKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/PromptKind.js +1 -1
- package/dist/picteus-ws-client/models/Repository.d.ts +5 -5
- package/dist/picteus-ws-client/models/Repository.js +5 -5
- package/dist/picteus-ws-client/models/RepositoryActivity.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivity.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivityKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivityKind.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryLocationType.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryLocationType.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryState.d.ts +27 -0
- package/dist/picteus-ws-client/models/RepositoryState.js +45 -0
- package/dist/picteus-ws-client/models/RunCommandParameters.d.ts +1 -1
- package/dist/picteus-ws-client/models/RunCommandParameters.js +1 -1
- package/dist/picteus-ws-client/models/SearchCriteria.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchCriteria.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureComparisonOperator.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureComparisonOperator.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureCondition.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureCondition.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureConditionValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureConditionValue.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureLogicalOperator.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureLogicalOperator.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatures.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatures.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeaturesResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeaturesResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchFilter.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFilter.js +1 -1
- package/dist/picteus-ws-client/models/SearchFilterOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFilterOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageIdResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageIdResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageSummaryResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageSummaryResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImagesOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImagesOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchKeyword.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchKeyword.js +1 -1
- package/dist/picteus-ws-client/models/SearchMediaUrlResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchMediaUrlResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchOriginNature.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchOriginNature.js +1 -1
- package/dist/picteus-ws-client/models/SearchParameters.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchParameters.js +1 -1
- package/dist/picteus-ws-client/models/SearchProperties.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchProperties.js +1 -1
- package/dist/picteus-ws-client/models/SearchPropertyRange.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchPropertyRange.js +1 -1
- package/dist/picteus-ws-client/models/SearchRange.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchRange.js +1 -1
- package/dist/picteus-ws-client/models/SearchRepositoriesOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchRepositoriesOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchSorting.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchSorting.js +1 -1
- package/dist/picteus-ws-client/models/SearchSortingProperty.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchSortingProperty.js +1 -1
- package/dist/picteus-ws-client/models/SearchTags.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchTags.js +1 -1
- package/dist/picteus-ws-client/models/SearchTagsResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchTagsResult.js +1 -1
- package/dist/picteus-ws-client/models/Software.d.ts +1 -1
- package/dist/picteus-ws-client/models/Software.js +1 -1
- package/dist/picteus-ws-client/models/TextualPrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/TextualPrompt.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceAnchor.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceAnchor.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceSidebarIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceSidebarIntegration.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceWindowIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceWindowIntegration.js +1 -1
- package/dist/picteus-ws-client/models/index.d.ts +2 -2
- package/dist/picteus-ws-client/models/index.js +2 -2
- package/dist/picteus-ws-client/runtime.d.ts +1 -1
- package/dist/picteus-ws-client/runtime.js +1 -1
- package/dist/picteusExtension.js +17 -14
- package/package.json +1 -1
|
@@ -0,0 +1,4099 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Auto-generated by @picteus/specification-factory emitter. Do not edit directly.
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/** Generic base class providing recursive JSON serialization for all model instances. */
|
|
5
|
+
export class ViewKitNode {
|
|
6
|
+
/**
|
|
7
|
+
* Serializes this model instance into a strongly-typed, JSON-compatible plain object.
|
|
8
|
+
*
|
|
9
|
+
* @returns The plain object representation conforming to interface `T`.
|
|
10
|
+
*/
|
|
11
|
+
toJSON() {
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const [key, value] of Object.entries(this)) {
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
result[key] = value.map((item) => {
|
|
17
|
+
return item && typeof item === "object" && typeof item.toJSON === "function"
|
|
18
|
+
? item.toJSON()
|
|
19
|
+
: item;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else if (value && typeof value === "object" && typeof value.toJSON === "function") {
|
|
23
|
+
result[key] = value.toJSON();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
result[key] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the compact JSON string representation of this model instance with no indentation.
|
|
34
|
+
*
|
|
35
|
+
* @returns Compact JSON string without indentation.
|
|
36
|
+
*/
|
|
37
|
+
toString() {
|
|
38
|
+
return JSON.stringify(this.toJSON());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Typographic stroke weight styling. */
|
|
42
|
+
export var TextWeight;
|
|
43
|
+
(function (TextWeight) {
|
|
44
|
+
// Thin / light text weight
|
|
45
|
+
TextWeight["thin"] = "thin";
|
|
46
|
+
// Standard text weight
|
|
47
|
+
TextWeight["normal"] = "normal";
|
|
48
|
+
// Heavy / bold text weight
|
|
49
|
+
TextWeight["heavy"] = "heavy";
|
|
50
|
+
})(TextWeight || (TextWeight = {}));
|
|
51
|
+
/** Visual text color intensity and contrast. */
|
|
52
|
+
export var TextIntensity;
|
|
53
|
+
(function (TextIntensity) {
|
|
54
|
+
// Low visual contrast / subdued text color
|
|
55
|
+
TextIntensity["low"] = "low";
|
|
56
|
+
// Standard text color
|
|
57
|
+
TextIntensity["medium"] = "medium";
|
|
58
|
+
// High visual contrast / intense text color
|
|
59
|
+
TextIntensity["high"] = "high";
|
|
60
|
+
})(TextIntensity || (TextIntensity = {}));
|
|
61
|
+
/** Representation style for short string values. */
|
|
62
|
+
export var StringShortRepresentation;
|
|
63
|
+
(function (StringShortRepresentation) {
|
|
64
|
+
// Standard plain text rendering
|
|
65
|
+
StringShortRepresentation["plain"] = "plain";
|
|
66
|
+
// Visual chip / tag pill representation
|
|
67
|
+
StringShortRepresentation["chip"] = "chip";
|
|
68
|
+
})(StringShortRepresentation || (StringShortRepresentation = {}));
|
|
69
|
+
/** Supported syntax highlighting languages for formatted code blocks. */
|
|
70
|
+
export var CodeLanguage;
|
|
71
|
+
(function (CodeLanguage) {
|
|
72
|
+
// XML markup syntax
|
|
73
|
+
CodeLanguage["xml"] = "xml";
|
|
74
|
+
// JSON format syntax
|
|
75
|
+
CodeLanguage["json"] = "json";
|
|
76
|
+
// YAML format syntax
|
|
77
|
+
CodeLanguage["yaml"] = "yaml";
|
|
78
|
+
})(CodeLanguage || (CodeLanguage = {}));
|
|
79
|
+
/** Visual color tone variants for badge pill representations. */
|
|
80
|
+
export var BadgeVariant;
|
|
81
|
+
(function (BadgeVariant) {
|
|
82
|
+
// Neutral gray tone
|
|
83
|
+
BadgeVariant["neutral"] = "neutral";
|
|
84
|
+
// Success green tone
|
|
85
|
+
BadgeVariant["success"] = "success";
|
|
86
|
+
// Warning yellow/orange tone
|
|
87
|
+
BadgeVariant["warning"] = "warning";
|
|
88
|
+
// Danger red tone
|
|
89
|
+
BadgeVariant["danger"] = "danger";
|
|
90
|
+
})(BadgeVariant || (BadgeVariant = {}));
|
|
91
|
+
/** Presentation format styles for timestamp elements. */
|
|
92
|
+
export var TimestampFormat;
|
|
93
|
+
(function (TimestampFormat) {
|
|
94
|
+
// Complete date and time display
|
|
95
|
+
TimestampFormat["full"] = "full";
|
|
96
|
+
// Date-only display
|
|
97
|
+
TimestampFormat["date"] = "date";
|
|
98
|
+
// Time-only display
|
|
99
|
+
TimestampFormat["time"] = "time";
|
|
100
|
+
// Relative time expression (e.g. "5 minutes ago")
|
|
101
|
+
TimestampFormat["relative"] = "relative";
|
|
102
|
+
})(TimestampFormat || (TimestampFormat = {}));
|
|
103
|
+
/** Visual style variants for interactive button actions. */
|
|
104
|
+
export var ButtonVariant;
|
|
105
|
+
(function (ButtonVariant) {
|
|
106
|
+
// Primary emphasis button style for default/recommended actions
|
|
107
|
+
ButtonVariant["primary"] = "primary";
|
|
108
|
+
// Secondary standard button style
|
|
109
|
+
ButtonVariant["secondary"] = "secondary";
|
|
110
|
+
// Subtle low-contrast button style
|
|
111
|
+
ButtonVariant["subtle"] = "subtle";
|
|
112
|
+
// Destructive / dangerous action button style
|
|
113
|
+
ButtonVariant["danger"] = "danger";
|
|
114
|
+
})(ButtonVariant || (ButtonVariant = {}));
|
|
115
|
+
/** Text horizontal alignment options for table columns. */
|
|
116
|
+
export var TableColumnAlign;
|
|
117
|
+
(function (TableColumnAlign) {
|
|
118
|
+
// Left-aligned text
|
|
119
|
+
TableColumnAlign["left"] = "left";
|
|
120
|
+
// Center-aligned text
|
|
121
|
+
TableColumnAlign["center"] = "center";
|
|
122
|
+
// Right-aligned text
|
|
123
|
+
TableColumnAlign["right"] = "right";
|
|
124
|
+
})(TableColumnAlign || (TableColumnAlign = {}));
|
|
125
|
+
/** Visual styling variants for hairline dividers. */
|
|
126
|
+
export var DividerStyle;
|
|
127
|
+
(function (DividerStyle) {
|
|
128
|
+
// Subtle thin hairline border
|
|
129
|
+
DividerStyle["hairline"] = "hairline";
|
|
130
|
+
// Solid standard divider line
|
|
131
|
+
DividerStyle["solid"] = "solid";
|
|
132
|
+
// Dashed separator line
|
|
133
|
+
DividerStyle["dashed"] = "dashed";
|
|
134
|
+
})(DividerStyle || (DividerStyle = {}));
|
|
135
|
+
/** Abstract base class for all `UiElement` models. */
|
|
136
|
+
export class BaseUiElement extends ViewKitNode {
|
|
137
|
+
}
|
|
138
|
+
/** Abstract base class for all `UiAction` models. */
|
|
139
|
+
export class BaseUiAction extends ViewKitNode {
|
|
140
|
+
}
|
|
141
|
+
// --- Concrete Model Classes Implementing Interfaces ---
|
|
142
|
+
/**
|
|
143
|
+
* Class implementation of the `TruncateOptions` interface.
|
|
144
|
+
*
|
|
145
|
+
* @remarks
|
|
146
|
+
* Truncation configuration for long textual content with optional expand affordance.
|
|
147
|
+
*/
|
|
148
|
+
export class TruncateOptionsClass extends ViewKitNode {
|
|
149
|
+
/** Maximum number of characters to display before truncating */
|
|
150
|
+
characterLimit;
|
|
151
|
+
/**
|
|
152
|
+
* Whether to render a "Show more" / "Show less" toggle affordance
|
|
153
|
+
*
|
|
154
|
+
* @defaultValue true
|
|
155
|
+
*/
|
|
156
|
+
showMore;
|
|
157
|
+
/**
|
|
158
|
+
* Constructs a new `TruncateOptionsClass` instance.
|
|
159
|
+
*
|
|
160
|
+
* @param characterLimit - Maximum number of characters to display before truncating
|
|
161
|
+
* @param options - Optional component settings. (showMore (defaults to `true`)).
|
|
162
|
+
*/
|
|
163
|
+
constructor(characterLimit, options) {
|
|
164
|
+
super();
|
|
165
|
+
this.characterLimit = characterLimit;
|
|
166
|
+
this.showMore = options?.showMore ?? true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Class implementation of the `BaseModifiers` interface.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* Base modifier traits for elements that support copy affordance.
|
|
174
|
+
*/
|
|
175
|
+
export class BaseModifiersClass extends ViewKitNode {
|
|
176
|
+
/** Adds an interactive copy button/action next to the rendered value */
|
|
177
|
+
copyable;
|
|
178
|
+
/**
|
|
179
|
+
* Constructs a new `BaseModifiersClass` instance.
|
|
180
|
+
*
|
|
181
|
+
* @param options - Optional component settings. (copyable).
|
|
182
|
+
*/
|
|
183
|
+
constructor(options) {
|
|
184
|
+
super();
|
|
185
|
+
this.copyable = options?.copyable;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Class implementation of the `PrimitiveModifiers` interface.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* Common modifier traits that can be attached to primitive elements.
|
|
193
|
+
*/
|
|
194
|
+
export class PrimitiveModifiersClass extends ViewKitNode {
|
|
195
|
+
/** Configures character truncation threshold with show-more affordance */
|
|
196
|
+
truncate;
|
|
197
|
+
/**
|
|
198
|
+
* Typographic text weight
|
|
199
|
+
*
|
|
200
|
+
* @defaultValue TextWeight.normal
|
|
201
|
+
*/
|
|
202
|
+
weight;
|
|
203
|
+
/**
|
|
204
|
+
* Visual text color intensity
|
|
205
|
+
*
|
|
206
|
+
* @defaultValue TextIntensity.medium
|
|
207
|
+
*/
|
|
208
|
+
intensity;
|
|
209
|
+
/**
|
|
210
|
+
* Whether to use monospace font rendering (for hashes, IDs, codes)
|
|
211
|
+
*
|
|
212
|
+
* @defaultValue false
|
|
213
|
+
*/
|
|
214
|
+
monospace;
|
|
215
|
+
/** Adds an interactive copy button/action next to the rendered value */
|
|
216
|
+
copyable;
|
|
217
|
+
/**
|
|
218
|
+
* Constructs a new `PrimitiveModifiersClass` instance.
|
|
219
|
+
*
|
|
220
|
+
* @param options - Optional component settings. (truncate, weight (defaults to `normal`), intensity (defaults to `medium`), monospace (defaults to `false`), copyable).
|
|
221
|
+
*/
|
|
222
|
+
constructor(options) {
|
|
223
|
+
super();
|
|
224
|
+
this.truncate = options?.truncate;
|
|
225
|
+
this.weight = options?.weight ?? TextWeight.normal;
|
|
226
|
+
this.intensity = options?.intensity ?? TextIntensity.medium;
|
|
227
|
+
this.monospace = options?.monospace ?? false;
|
|
228
|
+
this.copyable = options?.copyable;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Class implementation of the `StringShortElement` interface.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* Short string primitive element.
|
|
236
|
+
* Supports plain text or compact chip pill presentation.
|
|
237
|
+
*/
|
|
238
|
+
export class StringShortElementClass extends BaseUiElement {
|
|
239
|
+
/**
|
|
240
|
+
* Discriminator identifier for `StringShortElement`.
|
|
241
|
+
*
|
|
242
|
+
* @defaultValue "string-short"
|
|
243
|
+
*/
|
|
244
|
+
type = "string-short";
|
|
245
|
+
/** Text value */
|
|
246
|
+
value;
|
|
247
|
+
/**
|
|
248
|
+
* Display representation mode
|
|
249
|
+
*
|
|
250
|
+
* @defaultValue StringShortRepresentation.plain
|
|
251
|
+
*/
|
|
252
|
+
representation;
|
|
253
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
254
|
+
modifiers;
|
|
255
|
+
/**
|
|
256
|
+
* Constructs a new `StringShortElementClass` instance.
|
|
257
|
+
*
|
|
258
|
+
* @param value - Text value
|
|
259
|
+
* @param options - Optional component settings. (representation (defaults to `plain`), modifiers).
|
|
260
|
+
*/
|
|
261
|
+
constructor(value, options) {
|
|
262
|
+
super();
|
|
263
|
+
this.value = value;
|
|
264
|
+
this.representation = options?.representation ?? StringShortRepresentation.plain;
|
|
265
|
+
this.modifiers = options?.modifiers;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Class implementation of the `StringLongElement` interface.
|
|
270
|
+
*
|
|
271
|
+
* @remarks
|
|
272
|
+
* Multiline text block primitive element for descriptions, comments, or prose.
|
|
273
|
+
*/
|
|
274
|
+
export class StringLongElementClass extends BaseUiElement {
|
|
275
|
+
/**
|
|
276
|
+
* Discriminator identifier for `StringLongElement`.
|
|
277
|
+
*
|
|
278
|
+
* @defaultValue "string-long"
|
|
279
|
+
*/
|
|
280
|
+
type = "string-long";
|
|
281
|
+
/** Text value */
|
|
282
|
+
value;
|
|
283
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
284
|
+
modifiers;
|
|
285
|
+
/**
|
|
286
|
+
* Constructs a new `StringLongElementClass` instance.
|
|
287
|
+
*
|
|
288
|
+
* @param value - Text value
|
|
289
|
+
* @param options - Optional component settings. (modifiers).
|
|
290
|
+
*/
|
|
291
|
+
constructor(value, options) {
|
|
292
|
+
super();
|
|
293
|
+
this.value = value;
|
|
294
|
+
this.modifiers = options?.modifiers;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Class implementation of the `StringCodeElement` interface.
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* Monospace code block or formatted code snippet representation.
|
|
302
|
+
*/
|
|
303
|
+
export class StringCodeElementClass extends BaseUiElement {
|
|
304
|
+
/**
|
|
305
|
+
* Discriminator identifier for `StringCodeElement`.
|
|
306
|
+
*
|
|
307
|
+
* @defaultValue "string-code"
|
|
308
|
+
*/
|
|
309
|
+
type = "string-code";
|
|
310
|
+
/** Text value */
|
|
311
|
+
value;
|
|
312
|
+
/** Optional syntax highlighting language identifier */
|
|
313
|
+
language;
|
|
314
|
+
/** Optional visual modifiers (copyable) */
|
|
315
|
+
modifiers;
|
|
316
|
+
/**
|
|
317
|
+
* Constructs a new `StringCodeElementClass` instance.
|
|
318
|
+
*
|
|
319
|
+
* @param value - Text value
|
|
320
|
+
* @param options - Optional component settings. (language, modifiers).
|
|
321
|
+
*/
|
|
322
|
+
constructor(value, options) {
|
|
323
|
+
super();
|
|
324
|
+
this.value = value;
|
|
325
|
+
this.language = options?.language;
|
|
326
|
+
this.modifiers = options?.modifiers;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Class implementation of the `XmlElement` interface.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* XML markup code block element.
|
|
334
|
+
*/
|
|
335
|
+
export class XmlElementClass extends BaseUiElement {
|
|
336
|
+
/**
|
|
337
|
+
* Discriminator identifier for `XmlElement`.
|
|
338
|
+
*
|
|
339
|
+
* @defaultValue "xml"
|
|
340
|
+
*/
|
|
341
|
+
type = "xml";
|
|
342
|
+
/** XML content value */
|
|
343
|
+
value;
|
|
344
|
+
/** Optional visual modifiers (copyable) */
|
|
345
|
+
modifiers;
|
|
346
|
+
/**
|
|
347
|
+
* Constructs a new `XmlElementClass` instance.
|
|
348
|
+
*
|
|
349
|
+
* @param value - XML content value
|
|
350
|
+
* @param options - Optional component settings. (modifiers).
|
|
351
|
+
*/
|
|
352
|
+
constructor(value, options) {
|
|
353
|
+
super();
|
|
354
|
+
this.value = value;
|
|
355
|
+
this.modifiers = options?.modifiers;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Class implementation of the `JsonElement` interface.
|
|
360
|
+
*
|
|
361
|
+
* @remarks
|
|
362
|
+
* JSON data or structure representation element.
|
|
363
|
+
*/
|
|
364
|
+
export class JsonElementClass extends BaseUiElement {
|
|
365
|
+
/**
|
|
366
|
+
* Discriminator identifier for `JsonElement`.
|
|
367
|
+
*
|
|
368
|
+
* @defaultValue "json"
|
|
369
|
+
*/
|
|
370
|
+
type = "json";
|
|
371
|
+
/** JSON content value */
|
|
372
|
+
value;
|
|
373
|
+
/** Optional visual modifiers (copyable) */
|
|
374
|
+
modifiers;
|
|
375
|
+
/**
|
|
376
|
+
* Constructs a new `JsonElementClass` instance.
|
|
377
|
+
*
|
|
378
|
+
* @param value - JSON content value
|
|
379
|
+
* @param options - Optional component settings. (modifiers).
|
|
380
|
+
*/
|
|
381
|
+
constructor(value, options) {
|
|
382
|
+
super();
|
|
383
|
+
this.value = value;
|
|
384
|
+
this.modifiers = options?.modifiers;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Class implementation of the `StringUrlElement` interface.
|
|
389
|
+
*
|
|
390
|
+
* @remarks
|
|
391
|
+
* Hyperlink representation for external or internal URL navigation.
|
|
392
|
+
*/
|
|
393
|
+
export class StringUrlElementClass extends BaseUiElement {
|
|
394
|
+
/**
|
|
395
|
+
* Discriminator identifier for `StringUrlElement`.
|
|
396
|
+
*
|
|
397
|
+
* @defaultValue "string-url"
|
|
398
|
+
*/
|
|
399
|
+
type = "string-url";
|
|
400
|
+
/** Target URL or navigation destination */
|
|
401
|
+
value;
|
|
402
|
+
/** Optional custom anchor text label */
|
|
403
|
+
label;
|
|
404
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
405
|
+
modifiers;
|
|
406
|
+
/**
|
|
407
|
+
* Constructs a new `StringUrlElementClass` instance.
|
|
408
|
+
*
|
|
409
|
+
* @param value - Target URL or navigation destination
|
|
410
|
+
* @param options - Optional component settings. (label, modifiers).
|
|
411
|
+
*/
|
|
412
|
+
constructor(value, options) {
|
|
413
|
+
super();
|
|
414
|
+
this.value = value;
|
|
415
|
+
this.label = options?.label;
|
|
416
|
+
this.modifiers = options?.modifiers;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Class implementation of the `IdentifierElement` interface.
|
|
421
|
+
*
|
|
422
|
+
* @remarks
|
|
423
|
+
* Monospace semantic identifier representation.
|
|
424
|
+
*/
|
|
425
|
+
export class IdentifierElementClass extends BaseUiElement {
|
|
426
|
+
/**
|
|
427
|
+
* Discriminator identifier for `IdentifierElement`.
|
|
428
|
+
*
|
|
429
|
+
* @defaultValue "identifier"
|
|
430
|
+
*/
|
|
431
|
+
type = "identifier";
|
|
432
|
+
/** Identifier string value */
|
|
433
|
+
value;
|
|
434
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
435
|
+
modifiers;
|
|
436
|
+
/**
|
|
437
|
+
* Constructs a new `IdentifierElementClass` instance.
|
|
438
|
+
*
|
|
439
|
+
* @param value - Identifier string value
|
|
440
|
+
* @param options - Optional component settings. (modifiers).
|
|
441
|
+
*/
|
|
442
|
+
constructor(value, options) {
|
|
443
|
+
super();
|
|
444
|
+
this.value = value;
|
|
445
|
+
this.modifiers = options?.modifiers;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Class implementation of the `RatioElement` interface.
|
|
450
|
+
*
|
|
451
|
+
* @remarks
|
|
452
|
+
* Aspect ratio representation (e.g. "16:9", "4:3", "1:1").
|
|
453
|
+
*/
|
|
454
|
+
export class RatioElementClass extends BaseUiElement {
|
|
455
|
+
/**
|
|
456
|
+
* Discriminator identifier for `RatioElement`.
|
|
457
|
+
*
|
|
458
|
+
* @defaultValue "ratio"
|
|
459
|
+
*/
|
|
460
|
+
type = "ratio";
|
|
461
|
+
/** Aspect ratio textual expression */
|
|
462
|
+
value;
|
|
463
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
464
|
+
modifiers;
|
|
465
|
+
/**
|
|
466
|
+
* Constructs a new `RatioElementClass` instance.
|
|
467
|
+
*
|
|
468
|
+
* @param value - Aspect ratio textual expression
|
|
469
|
+
* @param options - Optional component settings. (modifiers).
|
|
470
|
+
*/
|
|
471
|
+
constructor(value, options) {
|
|
472
|
+
super();
|
|
473
|
+
this.value = value;
|
|
474
|
+
this.modifiers = options?.modifiers;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Class implementation of the `ColourElement` interface.
|
|
479
|
+
*
|
|
480
|
+
* @remarks
|
|
481
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
482
|
+
*/
|
|
483
|
+
export class ColourElementClass extends BaseUiElement {
|
|
484
|
+
/**
|
|
485
|
+
* Discriminator identifier for `ColourElement`.
|
|
486
|
+
*
|
|
487
|
+
* @defaultValue "color-swatch"
|
|
488
|
+
*/
|
|
489
|
+
type = "color-swatch";
|
|
490
|
+
/** Hexadecimal color code */
|
|
491
|
+
value;
|
|
492
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
493
|
+
modifiers;
|
|
494
|
+
/**
|
|
495
|
+
* Constructs a new `ColourElementClass` instance.
|
|
496
|
+
*
|
|
497
|
+
* @param value - Hexadecimal color code
|
|
498
|
+
* @param options - Optional component settings. (modifiers).
|
|
499
|
+
*/
|
|
500
|
+
constructor(value, options) {
|
|
501
|
+
super();
|
|
502
|
+
this.value = value;
|
|
503
|
+
this.modifiers = options?.modifiers;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Class implementation of the `NumberUnboundedElement` interface.
|
|
508
|
+
*
|
|
509
|
+
* @remarks
|
|
510
|
+
* Plain unbounded numeric value primitive element.
|
|
511
|
+
*/
|
|
512
|
+
export class NumberUnboundedElementClass extends BaseUiElement {
|
|
513
|
+
/**
|
|
514
|
+
* Discriminator identifier for `NumberUnboundedElement`.
|
|
515
|
+
*
|
|
516
|
+
* @defaultValue "number-unbounded"
|
|
517
|
+
*/
|
|
518
|
+
type = "number-unbounded";
|
|
519
|
+
/** Numeric value */
|
|
520
|
+
value;
|
|
521
|
+
/** Optional unit suffix (e.g. "px", "ms", "MB") */
|
|
522
|
+
unit;
|
|
523
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
524
|
+
modifiers;
|
|
525
|
+
/**
|
|
526
|
+
* Constructs a new `NumberUnboundedElementClass` instance.
|
|
527
|
+
*
|
|
528
|
+
* @param value - Numeric value
|
|
529
|
+
* @param options - Optional component settings. (unit, modifiers).
|
|
530
|
+
*/
|
|
531
|
+
constructor(value, options) {
|
|
532
|
+
super();
|
|
533
|
+
this.value = value;
|
|
534
|
+
this.unit = options?.unit;
|
|
535
|
+
this.modifiers = options?.modifiers;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Class implementation of the `NumberBoundedStarsElement` interface.
|
|
540
|
+
*
|
|
541
|
+
* @remarks
|
|
542
|
+
* Bounded numeric rating represented as visual stars.
|
|
543
|
+
*/
|
|
544
|
+
export class NumberBoundedStarsElementClass extends BaseUiElement {
|
|
545
|
+
/**
|
|
546
|
+
* Discriminator identifier for `NumberBoundedStarsElement`.
|
|
547
|
+
*
|
|
548
|
+
* @defaultValue "number-stars"
|
|
549
|
+
*/
|
|
550
|
+
type = "number-stars";
|
|
551
|
+
/** Numeric rating score */
|
|
552
|
+
value;
|
|
553
|
+
/** Maximum rating scale (defaults to 5) */
|
|
554
|
+
maximum;
|
|
555
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
556
|
+
modifiers;
|
|
557
|
+
/**
|
|
558
|
+
* Constructs a new `NumberBoundedStarsElementClass` instance.
|
|
559
|
+
*
|
|
560
|
+
* @param value - Numeric rating score
|
|
561
|
+
* @param options - Optional component settings. (maximum, modifiers).
|
|
562
|
+
*/
|
|
563
|
+
constructor(value, options) {
|
|
564
|
+
super();
|
|
565
|
+
this.value = value;
|
|
566
|
+
this.maximum = options?.maximum;
|
|
567
|
+
this.modifiers = options?.modifiers;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Class implementation of the `NumberBoundedMeterElement` interface.
|
|
572
|
+
*
|
|
573
|
+
* @remarks
|
|
574
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
575
|
+
*/
|
|
576
|
+
export class NumberBoundedMeterElementClass extends BaseUiElement {
|
|
577
|
+
/**
|
|
578
|
+
* Discriminator identifier for `NumberBoundedMeterElement`.
|
|
579
|
+
*
|
|
580
|
+
* @defaultValue "number-meter"
|
|
581
|
+
*/
|
|
582
|
+
type = "number-meter";
|
|
583
|
+
/** Numeric value */
|
|
584
|
+
value;
|
|
585
|
+
/** Minimum scale bound (defaults to 0) */
|
|
586
|
+
minimum;
|
|
587
|
+
/** Maximum scale bound (e.g. 100) */
|
|
588
|
+
maximum;
|
|
589
|
+
/** Optional custom text label override (e.g. "68 / 100") */
|
|
590
|
+
label;
|
|
591
|
+
/** Optional unit suffix (e.g. "%") */
|
|
592
|
+
unit;
|
|
593
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
594
|
+
modifiers;
|
|
595
|
+
/**
|
|
596
|
+
* Constructs a new `NumberBoundedMeterElementClass` instance.
|
|
597
|
+
*
|
|
598
|
+
* @param value - Numeric value
|
|
599
|
+
* @param options - Optional component settings. (minimum, maximum, label, unit, modifiers).
|
|
600
|
+
*/
|
|
601
|
+
constructor(value, options) {
|
|
602
|
+
super();
|
|
603
|
+
this.value = value;
|
|
604
|
+
this.minimum = options?.minimum;
|
|
605
|
+
this.maximum = options?.maximum;
|
|
606
|
+
this.label = options?.label;
|
|
607
|
+
this.unit = options?.unit;
|
|
608
|
+
this.modifiers = options?.modifiers;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Class implementation of the `BooleanPlainElement` interface.
|
|
613
|
+
*
|
|
614
|
+
* @remarks
|
|
615
|
+
* Plain boolean value representation (textual "true" / "false").
|
|
616
|
+
*/
|
|
617
|
+
export class BooleanPlainElementClass extends BaseUiElement {
|
|
618
|
+
/**
|
|
619
|
+
* Discriminator identifier for `BooleanPlainElement`.
|
|
620
|
+
*
|
|
621
|
+
* @defaultValue "boolean-plain"
|
|
622
|
+
*/
|
|
623
|
+
type = "boolean-plain";
|
|
624
|
+
/** Boolean state value */
|
|
625
|
+
value;
|
|
626
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
627
|
+
modifiers;
|
|
628
|
+
/**
|
|
629
|
+
* Constructs a new `BooleanPlainElementClass` instance.
|
|
630
|
+
*
|
|
631
|
+
* @param value - Boolean state value
|
|
632
|
+
* @param options - Optional component settings. (modifiers).
|
|
633
|
+
*/
|
|
634
|
+
constructor(value, options) {
|
|
635
|
+
super();
|
|
636
|
+
this.value = value;
|
|
637
|
+
this.modifiers = options?.modifiers;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Class implementation of the `BooleanBadgeElement` interface.
|
|
642
|
+
*
|
|
643
|
+
* @remarks
|
|
644
|
+
* Visual badge pill representation of a boolean state.
|
|
645
|
+
*/
|
|
646
|
+
export class BooleanBadgeElementClass extends BaseUiElement {
|
|
647
|
+
/**
|
|
648
|
+
* Discriminator identifier for `BooleanBadgeElement`.
|
|
649
|
+
*
|
|
650
|
+
* @defaultValue "boolean-badge"
|
|
651
|
+
*/
|
|
652
|
+
type = "boolean-badge";
|
|
653
|
+
/** Boolean state value */
|
|
654
|
+
value;
|
|
655
|
+
/**
|
|
656
|
+
* Custom display label when true (defaults to "true")
|
|
657
|
+
*
|
|
658
|
+
* @defaultValue "true"
|
|
659
|
+
*/
|
|
660
|
+
trueLabel;
|
|
661
|
+
/**
|
|
662
|
+
* Custom display label when false (defaults to "false")
|
|
663
|
+
*
|
|
664
|
+
* @defaultValue "false"
|
|
665
|
+
*/
|
|
666
|
+
falseLabel;
|
|
667
|
+
/**
|
|
668
|
+
* Badge color tone
|
|
669
|
+
*
|
|
670
|
+
* @defaultValue BadgeVariant.neutral
|
|
671
|
+
*/
|
|
672
|
+
variant;
|
|
673
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
674
|
+
modifiers;
|
|
675
|
+
/**
|
|
676
|
+
* Constructs a new `BooleanBadgeElementClass` instance.
|
|
677
|
+
*
|
|
678
|
+
* @param value - Boolean state value
|
|
679
|
+
* @param options - Optional component settings. (trueLabel (defaults to `true`), falseLabel (defaults to `false`), variant (defaults to `neutral`), modifiers).
|
|
680
|
+
*/
|
|
681
|
+
constructor(value, options) {
|
|
682
|
+
super();
|
|
683
|
+
this.value = value;
|
|
684
|
+
this.trueLabel = options?.trueLabel ?? "true";
|
|
685
|
+
this.falseLabel = options?.falseLabel ?? "false";
|
|
686
|
+
this.variant = options?.variant ?? BadgeVariant.neutral;
|
|
687
|
+
this.modifiers = options?.modifiers;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Class implementation of the `TimestampElement` interface.
|
|
692
|
+
*
|
|
693
|
+
* @remarks
|
|
694
|
+
* Formatted date and time representation.
|
|
695
|
+
*/
|
|
696
|
+
export class TimestampElementClass extends BaseUiElement {
|
|
697
|
+
/**
|
|
698
|
+
* Discriminator identifier for `TimestampElement`.
|
|
699
|
+
*
|
|
700
|
+
* @defaultValue "timestamp"
|
|
701
|
+
*/
|
|
702
|
+
type = "timestamp";
|
|
703
|
+
/** ISO 8601 date string or epoch timestamp in milliseconds */
|
|
704
|
+
value;
|
|
705
|
+
/**
|
|
706
|
+
* Presentation date/time format
|
|
707
|
+
*
|
|
708
|
+
* @defaultValue TimestampFormat.full
|
|
709
|
+
*/
|
|
710
|
+
format;
|
|
711
|
+
/** Optional visual modifiers (copyable, truncate, emphasis, monospace) */
|
|
712
|
+
modifiers;
|
|
713
|
+
/**
|
|
714
|
+
* Constructs a new `TimestampElementClass` instance.
|
|
715
|
+
*
|
|
716
|
+
* @param value - ISO 8601 date string or epoch timestamp in milliseconds
|
|
717
|
+
* @param options - Optional component settings. (format (defaults to `full`), modifiers).
|
|
718
|
+
*/
|
|
719
|
+
constructor(value, options) {
|
|
720
|
+
super();
|
|
721
|
+
this.value = value;
|
|
722
|
+
this.format = options?.format ?? TimestampFormat.full;
|
|
723
|
+
this.modifiers = options?.modifiers;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Class implementation of the `ImageReferenceElement` interface.
|
|
728
|
+
*
|
|
729
|
+
* @remarks
|
|
730
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
731
|
+
*/
|
|
732
|
+
export class ImageReferenceElementClass extends BaseUiElement {
|
|
733
|
+
/**
|
|
734
|
+
* Discriminator identifier for `ImageReferenceElement`.
|
|
735
|
+
*
|
|
736
|
+
* @defaultValue "image-ref"
|
|
737
|
+
*/
|
|
738
|
+
type = "image-ref";
|
|
739
|
+
/** Image source URI (HTTPS URL, base64 data URI, or asset path) */
|
|
740
|
+
src;
|
|
741
|
+
/** Accessible alternative description */
|
|
742
|
+
alt;
|
|
743
|
+
/**
|
|
744
|
+
* Aspect ratio of the thumbnail container
|
|
745
|
+
*
|
|
746
|
+
* @defaultValue "1:1"
|
|
747
|
+
*/
|
|
748
|
+
aspectRatio;
|
|
749
|
+
/** Fallback placeholder image URI */
|
|
750
|
+
placeholder;
|
|
751
|
+
/**
|
|
752
|
+
* Constructs a new `ImageReferenceElementClass` instance.
|
|
753
|
+
*
|
|
754
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
755
|
+
* @param options - Optional component settings. (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
756
|
+
*/
|
|
757
|
+
constructor(src, options) {
|
|
758
|
+
super();
|
|
759
|
+
this.src = src;
|
|
760
|
+
this.alt = options?.alt;
|
|
761
|
+
this.aspectRatio = options?.aspectRatio ?? "1:1";
|
|
762
|
+
this.placeholder = options?.placeholder;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Class implementation of the `DominantColourSetElement` interface.
|
|
767
|
+
*
|
|
768
|
+
* @remarks
|
|
769
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
770
|
+
*/
|
|
771
|
+
export class DominantColourSetElementClass extends BaseUiElement {
|
|
772
|
+
/**
|
|
773
|
+
* Discriminator identifier for `DominantColourSetElement`.
|
|
774
|
+
*
|
|
775
|
+
* @defaultValue "color-set"
|
|
776
|
+
*/
|
|
777
|
+
type = "color-set";
|
|
778
|
+
/** List of hexadecimal color strings in descending priority */
|
|
779
|
+
colors;
|
|
780
|
+
/**
|
|
781
|
+
* Constructs a new `DominantColourSetElementClass` instance.
|
|
782
|
+
*
|
|
783
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
784
|
+
*/
|
|
785
|
+
constructor(colors) {
|
|
786
|
+
super();
|
|
787
|
+
this.colors = colors ? [...colors] : [];
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Class implementation of the `ButtonActionElement` interface.
|
|
792
|
+
*
|
|
793
|
+
* @remarks
|
|
794
|
+
* Interactive button action triggering an extension command.
|
|
795
|
+
*/
|
|
796
|
+
export class ButtonActionElementClass extends BaseUiAction {
|
|
797
|
+
/**
|
|
798
|
+
* Discriminator identifier for `ButtonActionElement`.
|
|
799
|
+
*
|
|
800
|
+
* @defaultValue "button"
|
|
801
|
+
*/
|
|
802
|
+
type = "button";
|
|
803
|
+
/** Command identifier to invoke */
|
|
804
|
+
commandId;
|
|
805
|
+
/** Display label for the action */
|
|
806
|
+
label;
|
|
807
|
+
/** Extension identifier owning the target command */
|
|
808
|
+
extensionId;
|
|
809
|
+
/** Target entity or context identifier */
|
|
810
|
+
target;
|
|
811
|
+
/** Optional arbitrary parameters payload forwarded to the command handler */
|
|
812
|
+
parameters;
|
|
813
|
+
/**
|
|
814
|
+
* Whether the button is disabled / unavailable
|
|
815
|
+
*
|
|
816
|
+
* @defaultValue false
|
|
817
|
+
*/
|
|
818
|
+
disabled;
|
|
819
|
+
/**
|
|
820
|
+
* Button visual style variant
|
|
821
|
+
*
|
|
822
|
+
* @defaultValue ButtonVariant.secondary
|
|
823
|
+
*/
|
|
824
|
+
variant;
|
|
825
|
+
/**
|
|
826
|
+
* Constructs a new `ButtonActionElementClass` instance.
|
|
827
|
+
*
|
|
828
|
+
* @param commandId - Command identifier to invoke
|
|
829
|
+
* @param label - Display label for the action
|
|
830
|
+
* @param options - Optional component settings. (extensionId, target, parameters, disabled (defaults to `false`), variant (defaults to `secondary`)).
|
|
831
|
+
*/
|
|
832
|
+
constructor(commandId, label, options) {
|
|
833
|
+
super();
|
|
834
|
+
this.commandId = commandId;
|
|
835
|
+
this.label = label;
|
|
836
|
+
this.extensionId = options?.extensionId;
|
|
837
|
+
this.target = options?.target;
|
|
838
|
+
this.parameters = options?.parameters;
|
|
839
|
+
this.disabled = options?.disabled ?? false;
|
|
840
|
+
this.variant = options?.variant ?? ButtonVariant.secondary;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Class implementation of the `ExternalLinkActionElement` interface.
|
|
845
|
+
*
|
|
846
|
+
* @remarks
|
|
847
|
+
* External link action distinct from inline URL text values.
|
|
848
|
+
*/
|
|
849
|
+
export class ExternalLinkActionElementClass extends BaseUiAction {
|
|
850
|
+
/**
|
|
851
|
+
* Discriminator identifier for `ExternalLinkActionElement`.
|
|
852
|
+
*
|
|
853
|
+
* @defaultValue "external-link"
|
|
854
|
+
*/
|
|
855
|
+
type = "external-link";
|
|
856
|
+
/** Target URL destination */
|
|
857
|
+
url;
|
|
858
|
+
/** Display label for the action */
|
|
859
|
+
label;
|
|
860
|
+
/**
|
|
861
|
+
* Constructs a new `ExternalLinkActionElementClass` instance.
|
|
862
|
+
*
|
|
863
|
+
* @param url - Target URL destination
|
|
864
|
+
* @param label - Display label for the action
|
|
865
|
+
*/
|
|
866
|
+
constructor(url, label) {
|
|
867
|
+
super();
|
|
868
|
+
this.url = url;
|
|
869
|
+
this.label = label;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Class implementation of the `MarkdownBlockElement` interface.
|
|
874
|
+
*
|
|
875
|
+
* @remarks
|
|
876
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
877
|
+
*/
|
|
878
|
+
export class MarkdownBlockElementClass extends BaseUiElement {
|
|
879
|
+
/**
|
|
880
|
+
* Discriminator identifier for `MarkdownBlockElement`.
|
|
881
|
+
*
|
|
882
|
+
* @defaultValue "markdown"
|
|
883
|
+
*/
|
|
884
|
+
type = "markdown";
|
|
885
|
+
/** Raw Markdown markup content */
|
|
886
|
+
content;
|
|
887
|
+
/** Optional visual modifiers (copyable) */
|
|
888
|
+
modifiers;
|
|
889
|
+
/**
|
|
890
|
+
* Constructs a new `MarkdownBlockElementClass` instance.
|
|
891
|
+
*
|
|
892
|
+
* @param content - Raw Markdown markup content
|
|
893
|
+
* @param options - Optional component settings. (modifiers).
|
|
894
|
+
*/
|
|
895
|
+
constructor(content, options) {
|
|
896
|
+
super();
|
|
897
|
+
this.content = content;
|
|
898
|
+
this.modifiers = options?.modifiers;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Class implementation of the `HtmlBlockElement` interface.
|
|
903
|
+
*
|
|
904
|
+
* @remarks
|
|
905
|
+
* Sandboxed HTML rendering escape hatch.
|
|
906
|
+
*/
|
|
907
|
+
export class HtmlBlockElementClass extends BaseUiElement {
|
|
908
|
+
/**
|
|
909
|
+
* Discriminator identifier for `HtmlBlockElement`.
|
|
910
|
+
*
|
|
911
|
+
* @defaultValue "html"
|
|
912
|
+
*/
|
|
913
|
+
type = "html";
|
|
914
|
+
/** Raw HTML markup content */
|
|
915
|
+
content;
|
|
916
|
+
/** Optional visual modifiers (copyable) */
|
|
917
|
+
modifiers;
|
|
918
|
+
/**
|
|
919
|
+
* Constructs a new `HtmlBlockElementClass` instance.
|
|
920
|
+
*
|
|
921
|
+
* @param content - Raw HTML markup content
|
|
922
|
+
* @param options - Optional component settings. (modifiers).
|
|
923
|
+
*/
|
|
924
|
+
constructor(content, options) {
|
|
925
|
+
super();
|
|
926
|
+
this.content = content;
|
|
927
|
+
this.modifiers = options?.modifiers;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Class implementation of the `Slot` interface.
|
|
932
|
+
*
|
|
933
|
+
* @remarks
|
|
934
|
+
* Single slot within a multi-slot horizontal row layout.
|
|
935
|
+
*/
|
|
936
|
+
export class SlotClass extends ViewKitNode {
|
|
937
|
+
/** Rendered content inside the slot */
|
|
938
|
+
content;
|
|
939
|
+
/** Optional slot label (e.g. "Slot A") */
|
|
940
|
+
label;
|
|
941
|
+
/** Relative or fractional width proportion (e.g. "1/3", "2/3", "100px", "auto") */
|
|
942
|
+
width;
|
|
943
|
+
/**
|
|
944
|
+
* Constructs a new `SlotClass` instance.
|
|
945
|
+
*
|
|
946
|
+
* @param content - Rendered content inside the slot
|
|
947
|
+
* @param options - Optional component settings. (label, width).
|
|
948
|
+
*/
|
|
949
|
+
constructor(content, options) {
|
|
950
|
+
super();
|
|
951
|
+
this.content = content;
|
|
952
|
+
this.label = options?.label;
|
|
953
|
+
this.width = options?.width;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Class implementation of the `MultiSlotRowElement` interface.
|
|
958
|
+
*
|
|
959
|
+
* @remarks
|
|
960
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
961
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
962
|
+
*/
|
|
963
|
+
export class MultiSlotRowElementClass extends BaseUiElement {
|
|
964
|
+
/**
|
|
965
|
+
* Discriminator identifier for `MultiSlotRowElement`.
|
|
966
|
+
*
|
|
967
|
+
* @defaultValue "multi-slot"
|
|
968
|
+
*/
|
|
969
|
+
type = "multi-slot";
|
|
970
|
+
/** List of slots comprising the row */
|
|
971
|
+
slots;
|
|
972
|
+
/** Proportions descriptor (e.g. "1/3 + 2/3", "equal", "1/4 + 3/4") */
|
|
973
|
+
proportions;
|
|
974
|
+
/**
|
|
975
|
+
* Constructs a new `MultiSlotRowElementClass` instance.
|
|
976
|
+
*
|
|
977
|
+
* @param slots - List of slots comprising the row
|
|
978
|
+
* @param options - Optional component settings. (proportions).
|
|
979
|
+
*/
|
|
980
|
+
constructor(slots, options) {
|
|
981
|
+
super();
|
|
982
|
+
this.slots = slots ? [...slots] : [];
|
|
983
|
+
this.proportions = options?.proportions;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Class implementation of the `LabelValueRowElement` interface.
|
|
988
|
+
*
|
|
989
|
+
* @remarks
|
|
990
|
+
* Standard label and value row.
|
|
991
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
992
|
+
*/
|
|
993
|
+
export class LabelValueRowElementClass extends BaseUiElement {
|
|
994
|
+
/**
|
|
995
|
+
* Discriminator identifier for `LabelValueRowElement`.
|
|
996
|
+
*
|
|
997
|
+
* @defaultValue "label-value"
|
|
998
|
+
*/
|
|
999
|
+
type = "label-value";
|
|
1000
|
+
/** Key or descriptive label displayed muted on the left */
|
|
1001
|
+
label;
|
|
1002
|
+
/** Rendered value element on the right */
|
|
1003
|
+
value;
|
|
1004
|
+
/**
|
|
1005
|
+
* Whether to render a bottom border/hairline divider
|
|
1006
|
+
*
|
|
1007
|
+
* @defaultValue false
|
|
1008
|
+
*/
|
|
1009
|
+
withDivider;
|
|
1010
|
+
/**
|
|
1011
|
+
* Constructs a new `LabelValueRowElementClass` instance.
|
|
1012
|
+
*
|
|
1013
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
1014
|
+
* @param value - Rendered value element on the right
|
|
1015
|
+
* @param options - Optional component settings. (withDivider (defaults to `false`)).
|
|
1016
|
+
*/
|
|
1017
|
+
constructor(label, value, options) {
|
|
1018
|
+
super();
|
|
1019
|
+
this.label = label;
|
|
1020
|
+
this.value = value;
|
|
1021
|
+
this.withDivider = options?.withDivider ?? false;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Class implementation of the `TableColumn` interface.
|
|
1026
|
+
*
|
|
1027
|
+
* @remarks
|
|
1028
|
+
* Column definition for structured tables.
|
|
1029
|
+
*/
|
|
1030
|
+
export class TableColumnClass extends ViewKitNode {
|
|
1031
|
+
/** Display header text */
|
|
1032
|
+
header;
|
|
1033
|
+
/**
|
|
1034
|
+
* Text horizontal alignment
|
|
1035
|
+
*
|
|
1036
|
+
* @defaultValue TableColumnAlign.left
|
|
1037
|
+
*/
|
|
1038
|
+
align;
|
|
1039
|
+
/** Optional width constraint */
|
|
1040
|
+
width;
|
|
1041
|
+
/**
|
|
1042
|
+
* Constructs a new `TableColumnClass` instance.
|
|
1043
|
+
*
|
|
1044
|
+
* @param options - Optional component settings. (header, align (defaults to `left`), width).
|
|
1045
|
+
*/
|
|
1046
|
+
constructor(options) {
|
|
1047
|
+
super();
|
|
1048
|
+
this.header = options?.header;
|
|
1049
|
+
this.align = options?.align ?? TableColumnAlign.left;
|
|
1050
|
+
this.width = options?.width;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Class implementation of the `TableRow` interface.
|
|
1055
|
+
*
|
|
1056
|
+
* @remarks
|
|
1057
|
+
* Single table row containing an array of cell values.
|
|
1058
|
+
*/
|
|
1059
|
+
export class TableRowClass extends ViewKitNode {
|
|
1060
|
+
/** Array of cell values corresponding to table columns */
|
|
1061
|
+
cells;
|
|
1062
|
+
/**
|
|
1063
|
+
* Constructs a new `TableRowClass` instance.
|
|
1064
|
+
*
|
|
1065
|
+
* @param cells - Array of cell values corresponding to table columns
|
|
1066
|
+
*/
|
|
1067
|
+
constructor(cells) {
|
|
1068
|
+
super();
|
|
1069
|
+
this.cells = cells ? [...cells] : [];
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Class implementation of the `TableElement` interface.
|
|
1074
|
+
*
|
|
1075
|
+
* @remarks
|
|
1076
|
+
* Structured tabular data representation.
|
|
1077
|
+
* Supports header/borderless modes, 2-column key-value tables, and 3-column data tables.
|
|
1078
|
+
*/
|
|
1079
|
+
export class TableElementClass extends BaseUiElement {
|
|
1080
|
+
/**
|
|
1081
|
+
* Discriminator identifier for `TableElement`.
|
|
1082
|
+
*
|
|
1083
|
+
* @defaultValue "table"
|
|
1084
|
+
*/
|
|
1085
|
+
type = "table";
|
|
1086
|
+
/** Tabular data rows */
|
|
1087
|
+
rows;
|
|
1088
|
+
/**
|
|
1089
|
+
* Whether to render a column header row
|
|
1090
|
+
*
|
|
1091
|
+
* @defaultValue true
|
|
1092
|
+
*/
|
|
1093
|
+
hasHeader;
|
|
1094
|
+
/**
|
|
1095
|
+
* Whether to render alternating row background colors
|
|
1096
|
+
*
|
|
1097
|
+
* @defaultValue false
|
|
1098
|
+
*/
|
|
1099
|
+
isStriped;
|
|
1100
|
+
/**
|
|
1101
|
+
* Whether to render vertical column separators
|
|
1102
|
+
*
|
|
1103
|
+
* @defaultValue false
|
|
1104
|
+
*/
|
|
1105
|
+
withColumnSeparators;
|
|
1106
|
+
/**
|
|
1107
|
+
* Whether to render horizontal row separators
|
|
1108
|
+
*
|
|
1109
|
+
* @defaultValue false
|
|
1110
|
+
*/
|
|
1111
|
+
withRowSeparators;
|
|
1112
|
+
/** Optional explicit column definitions */
|
|
1113
|
+
columns;
|
|
1114
|
+
/**
|
|
1115
|
+
* Constructs a new `TableElementClass` instance.
|
|
1116
|
+
*
|
|
1117
|
+
* @param rows - Tabular data rows
|
|
1118
|
+
* @param options - Optional component settings. (hasHeader (defaults to `true`), isStriped (defaults to `false`), withColumnSeparators (defaults to `false`), withRowSeparators (defaults to `false`), columns).
|
|
1119
|
+
*/
|
|
1120
|
+
constructor(rows, options) {
|
|
1121
|
+
super();
|
|
1122
|
+
this.rows = rows ? [...rows] : [];
|
|
1123
|
+
this.hasHeader = options?.hasHeader ?? true;
|
|
1124
|
+
this.isStriped = options?.isStriped ?? false;
|
|
1125
|
+
this.withColumnSeparators = options?.withColumnSeparators ?? false;
|
|
1126
|
+
this.withRowSeparators = options?.withRowSeparators ?? false;
|
|
1127
|
+
this.columns = options?.columns ? [...options.columns] : undefined;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Class implementation of the `RepeatingGroupEntry` interface.
|
|
1132
|
+
*
|
|
1133
|
+
* @remarks
|
|
1134
|
+
* Single entry within a repeating group.
|
|
1135
|
+
*/
|
|
1136
|
+
export class RepeatingGroupEntryClass extends ViewKitNode {
|
|
1137
|
+
/** Entry label */
|
|
1138
|
+
label;
|
|
1139
|
+
/** Primary entry value or nested elements */
|
|
1140
|
+
value;
|
|
1141
|
+
/** Nested elements for structured entries */
|
|
1142
|
+
elements;
|
|
1143
|
+
/**
|
|
1144
|
+
* Constructs a new `RepeatingGroupEntryClass` instance.
|
|
1145
|
+
*
|
|
1146
|
+
* @param label - Entry label
|
|
1147
|
+
* @param options - Optional component settings. (value, elements).
|
|
1148
|
+
*/
|
|
1149
|
+
constructor(label, options) {
|
|
1150
|
+
super();
|
|
1151
|
+
this.label = label;
|
|
1152
|
+
this.value = options?.value;
|
|
1153
|
+
this.elements = options?.elements ? [...options.elements] : undefined;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Class implementation of the `RepeatingGroupElement` interface.
|
|
1158
|
+
*
|
|
1159
|
+
* @remarks
|
|
1160
|
+
* Repeating group container where entries share uniform structure and retain per-entry labels.
|
|
1161
|
+
*/
|
|
1162
|
+
export class RepeatingGroupElementClass extends BaseUiElement {
|
|
1163
|
+
/**
|
|
1164
|
+
* Discriminator identifier for `RepeatingGroupElement`.
|
|
1165
|
+
*
|
|
1166
|
+
* @defaultValue "repeating-group"
|
|
1167
|
+
*/
|
|
1168
|
+
type = "repeating-group";
|
|
1169
|
+
/** List of repeated entry records */
|
|
1170
|
+
entries;
|
|
1171
|
+
/** Optional section header for the group */
|
|
1172
|
+
title;
|
|
1173
|
+
/**
|
|
1174
|
+
* Constructs a new `RepeatingGroupElementClass` instance.
|
|
1175
|
+
*
|
|
1176
|
+
* @param entries - List of repeated entry records
|
|
1177
|
+
* @param options - Optional component settings. (title).
|
|
1178
|
+
*/
|
|
1179
|
+
constructor(entries, options) {
|
|
1180
|
+
super();
|
|
1181
|
+
this.entries = entries ? [...entries] : [];
|
|
1182
|
+
this.title = options?.title;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Class implementation of the `CollapsibleGroupElement` interface.
|
|
1187
|
+
*
|
|
1188
|
+
* @remarks
|
|
1189
|
+
* Collapsible disclosure container (accordion) with summary badge.
|
|
1190
|
+
*/
|
|
1191
|
+
export class CollapsibleGroupElementClass extends BaseUiElement {
|
|
1192
|
+
/**
|
|
1193
|
+
* Discriminator identifier for `CollapsibleGroupElement`.
|
|
1194
|
+
*
|
|
1195
|
+
* @defaultValue "collapsible-group"
|
|
1196
|
+
*/
|
|
1197
|
+
type = "collapsible-group";
|
|
1198
|
+
/** Group title (e.g. "Show specimen details") */
|
|
1199
|
+
title;
|
|
1200
|
+
/** Nested content elements revealed when expanded */
|
|
1201
|
+
elements;
|
|
1202
|
+
/** Secondary summary indicator (e.g. "2 neutral values") */
|
|
1203
|
+
summary;
|
|
1204
|
+
/**
|
|
1205
|
+
* Whether the disclosure is open/expanded by default
|
|
1206
|
+
*
|
|
1207
|
+
* @defaultValue false
|
|
1208
|
+
*/
|
|
1209
|
+
defaultExpanded;
|
|
1210
|
+
/**
|
|
1211
|
+
* Constructs a new `CollapsibleGroupElementClass` instance.
|
|
1212
|
+
*
|
|
1213
|
+
* @param title - Group title (e.g. "Show specimen details")
|
|
1214
|
+
* @param elements - Nested content elements revealed when expanded
|
|
1215
|
+
* @param options - Optional component settings. (summary, defaultExpanded (defaults to `false`)).
|
|
1216
|
+
*/
|
|
1217
|
+
constructor(title, elements, options) {
|
|
1218
|
+
super();
|
|
1219
|
+
this.title = title;
|
|
1220
|
+
this.elements = elements ? [...elements] : [];
|
|
1221
|
+
this.summary = options?.summary;
|
|
1222
|
+
this.defaultExpanded = options?.defaultExpanded ?? false;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Class implementation of the `DividerElement` interface.
|
|
1227
|
+
*
|
|
1228
|
+
* @remarks
|
|
1229
|
+
* Visual hairline separator separating sections or element groups.
|
|
1230
|
+
*/
|
|
1231
|
+
export class DividerElementClass extends BaseUiElement {
|
|
1232
|
+
/**
|
|
1233
|
+
* Discriminator identifier for `DividerElement`.
|
|
1234
|
+
*
|
|
1235
|
+
* @defaultValue "divider"
|
|
1236
|
+
*/
|
|
1237
|
+
type = "divider";
|
|
1238
|
+
/**
|
|
1239
|
+
* Line styling
|
|
1240
|
+
*
|
|
1241
|
+
* @defaultValue DividerStyle.hairline
|
|
1242
|
+
*/
|
|
1243
|
+
style;
|
|
1244
|
+
/**
|
|
1245
|
+
* Constructs a new `DividerElementClass` instance.
|
|
1246
|
+
*
|
|
1247
|
+
* @param options - Optional component settings. (style (defaults to `hairline`)).
|
|
1248
|
+
*/
|
|
1249
|
+
constructor(options) {
|
|
1250
|
+
super();
|
|
1251
|
+
this.style = options?.style ?? DividerStyle.hairline;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Class implementation of the `Envelop` interface.
|
|
1256
|
+
*
|
|
1257
|
+
* @remarks
|
|
1258
|
+
* Base envelope container model holding the schema version attribute.
|
|
1259
|
+
*/
|
|
1260
|
+
export class EnvelopClass extends ViewKitNode {
|
|
1261
|
+
/**
|
|
1262
|
+
* Schema specification version
|
|
1263
|
+
*
|
|
1264
|
+
* @defaultValue "1.0"
|
|
1265
|
+
*/
|
|
1266
|
+
schemaVersion;
|
|
1267
|
+
/**
|
|
1268
|
+
* Constructs a new `EnvelopClass` instance.
|
|
1269
|
+
*
|
|
1270
|
+
* @param options - Optional component settings. (schemaVersion (defaults to `1.0`)).
|
|
1271
|
+
*/
|
|
1272
|
+
constructor(options) {
|
|
1273
|
+
super();
|
|
1274
|
+
this.schemaVersion = options?.schemaVersion ?? "1.0";
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Class implementation of the `UiContainer` interface.
|
|
1279
|
+
*
|
|
1280
|
+
* @remarks
|
|
1281
|
+
* Container model representing an ordered list of visual elements.
|
|
1282
|
+
*/
|
|
1283
|
+
export class UiContainerClass extends ViewKitNode {
|
|
1284
|
+
/** Ordered list of visual elements, structures, and content */
|
|
1285
|
+
elements;
|
|
1286
|
+
/**
|
|
1287
|
+
* Schema specification version
|
|
1288
|
+
*
|
|
1289
|
+
* @defaultValue "1.0"
|
|
1290
|
+
*/
|
|
1291
|
+
schemaVersion;
|
|
1292
|
+
/**
|
|
1293
|
+
* Constructs a new `UiContainerClass` instance.
|
|
1294
|
+
*
|
|
1295
|
+
* @param elements - Ordered list of visual elements, structures, and content
|
|
1296
|
+
* @param options - Optional component settings. (schemaVersion (defaults to `1.0`)).
|
|
1297
|
+
*/
|
|
1298
|
+
constructor(elements, options) {
|
|
1299
|
+
super();
|
|
1300
|
+
this.elements = elements ? [...elements] : [];
|
|
1301
|
+
this.schemaVersion = options?.schemaVersion ?? "1.0";
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Class implementation of the `UiCard` interface.
|
|
1306
|
+
*
|
|
1307
|
+
* @remarks
|
|
1308
|
+
* Root Card container model.
|
|
1309
|
+
* Represents a complete feature card rendered inside the 360px panel.
|
|
1310
|
+
*/
|
|
1311
|
+
export class UiCardClass extends ViewKitNode {
|
|
1312
|
+
/** Human-readable feature title displayed in the card header */
|
|
1313
|
+
title;
|
|
1314
|
+
/** Ordered list of visual elements, structures, and content */
|
|
1315
|
+
elements;
|
|
1316
|
+
/** Optional neutral subtitle / description for the feature */
|
|
1317
|
+
description;
|
|
1318
|
+
/** Optional card action buttons rendered at the base of the feature card */
|
|
1319
|
+
actions;
|
|
1320
|
+
/**
|
|
1321
|
+
* Schema specification version
|
|
1322
|
+
*
|
|
1323
|
+
* @defaultValue "1.0"
|
|
1324
|
+
*/
|
|
1325
|
+
schemaVersion;
|
|
1326
|
+
/**
|
|
1327
|
+
* Constructs a new `UiCardClass` instance.
|
|
1328
|
+
*
|
|
1329
|
+
* @param title - Human-readable feature title displayed in the card header
|
|
1330
|
+
* @param elements - Ordered list of visual elements, structures, and content
|
|
1331
|
+
* @param options - Optional component settings. (description, actions, schemaVersion (defaults to `1.0`)).
|
|
1332
|
+
*/
|
|
1333
|
+
constructor(title, elements, options) {
|
|
1334
|
+
super();
|
|
1335
|
+
this.title = title;
|
|
1336
|
+
this.elements = elements ? [...elements] : [];
|
|
1337
|
+
this.description = options?.description;
|
|
1338
|
+
this.actions = options?.actions ? [...options.actions] : undefined;
|
|
1339
|
+
this.schemaVersion = options?.schemaVersion ?? "1.0";
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Fluent builder for constructing strongly-typed `UiContainer` instances.
|
|
1344
|
+
*
|
|
1345
|
+
* @remarks
|
|
1346
|
+
* Container model representing an ordered list of visual elements.
|
|
1347
|
+
*/
|
|
1348
|
+
export class UiContainerBuilder {
|
|
1349
|
+
_elements = [];
|
|
1350
|
+
/** Initializes a new `UiContainerBuilder`. */
|
|
1351
|
+
constructor() {
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Appends a visual element.
|
|
1355
|
+
*
|
|
1356
|
+
* @param element - The visual UI element component to add.
|
|
1357
|
+
* @returns This builder instance for method chaining.
|
|
1358
|
+
*/
|
|
1359
|
+
add(element) {
|
|
1360
|
+
this._elements.push(element);
|
|
1361
|
+
return this;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Appends multiple elements items.
|
|
1365
|
+
*
|
|
1366
|
+
* @param items - The `UiElement` items to add.
|
|
1367
|
+
* @returns This builder instance for method chaining.
|
|
1368
|
+
*/
|
|
1369
|
+
addElements(...items) {
|
|
1370
|
+
this._elements.push(...items);
|
|
1371
|
+
return this;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Appends a `StringShortElement` component.
|
|
1375
|
+
*
|
|
1376
|
+
* @remarks
|
|
1377
|
+
* Short string primitive element.
|
|
1378
|
+
* Supports plain text or compact chip pill presentation.
|
|
1379
|
+
*
|
|
1380
|
+
* @param value - Text value
|
|
1381
|
+
* @param options - Optional component settings (representation (defaults to `plain`), modifiers).
|
|
1382
|
+
* @returns This builder instance for method chaining.
|
|
1383
|
+
*/
|
|
1384
|
+
addStringShort(value, options) {
|
|
1385
|
+
return this.add(stringShort(value, options));
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Appends a `StringLongElement` component.
|
|
1389
|
+
*
|
|
1390
|
+
* @remarks
|
|
1391
|
+
* Multiline text block primitive element for descriptions, comments, or prose.
|
|
1392
|
+
*
|
|
1393
|
+
* @param value - Text value
|
|
1394
|
+
* @param options - Optional component settings (modifiers).
|
|
1395
|
+
* @returns This builder instance for method chaining.
|
|
1396
|
+
*/
|
|
1397
|
+
addStringLong(value, options) {
|
|
1398
|
+
return this.add(stringLong(value, options));
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Appends a `StringCodeElement` component.
|
|
1402
|
+
*
|
|
1403
|
+
* @remarks
|
|
1404
|
+
* Monospace code block or formatted code snippet representation.
|
|
1405
|
+
*
|
|
1406
|
+
* @param value - Text value
|
|
1407
|
+
* @param options - Optional component settings (language, modifiers).
|
|
1408
|
+
* @returns This builder instance for method chaining.
|
|
1409
|
+
*/
|
|
1410
|
+
addStringCode(value, options) {
|
|
1411
|
+
return this.add(stringCode(value, options));
|
|
1412
|
+
}
|
|
1413
|
+
/**
|
|
1414
|
+
* Appends a `XmlElement` component.
|
|
1415
|
+
*
|
|
1416
|
+
* @remarks
|
|
1417
|
+
* XML markup code block element.
|
|
1418
|
+
*
|
|
1419
|
+
* @param value - XML content value
|
|
1420
|
+
* @param options - Optional component settings (modifiers).
|
|
1421
|
+
* @returns This builder instance for method chaining.
|
|
1422
|
+
*/
|
|
1423
|
+
addXml(value, options) {
|
|
1424
|
+
return this.add(xml(value, options));
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Appends a `JsonElement` component.
|
|
1428
|
+
*
|
|
1429
|
+
* @remarks
|
|
1430
|
+
* JSON data or structure representation element.
|
|
1431
|
+
*
|
|
1432
|
+
* @param value - JSON content value
|
|
1433
|
+
* @param options - Optional component settings (modifiers).
|
|
1434
|
+
* @returns This builder instance for method chaining.
|
|
1435
|
+
*/
|
|
1436
|
+
addJson(value, options) {
|
|
1437
|
+
return this.add(json(value, options));
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Appends a `StringUrlElement` component.
|
|
1441
|
+
*
|
|
1442
|
+
* @remarks
|
|
1443
|
+
* Hyperlink representation for external or internal URL navigation.
|
|
1444
|
+
*
|
|
1445
|
+
* @param value - Target URL or navigation destination
|
|
1446
|
+
* @param options - Optional component settings (label, modifiers).
|
|
1447
|
+
* @returns This builder instance for method chaining.
|
|
1448
|
+
*/
|
|
1449
|
+
addStringUrl(value, options) {
|
|
1450
|
+
return this.add(stringUrl(value, options));
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Appends a `IdentifierElement` component.
|
|
1454
|
+
*
|
|
1455
|
+
* @remarks
|
|
1456
|
+
* Monospace semantic identifier representation.
|
|
1457
|
+
*
|
|
1458
|
+
* @param value - Identifier string value
|
|
1459
|
+
* @param options - Optional component settings (modifiers).
|
|
1460
|
+
* @returns This builder instance for method chaining.
|
|
1461
|
+
*/
|
|
1462
|
+
addIdentifier(value, options) {
|
|
1463
|
+
return this.add(identifier(value, options));
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Appends a `RatioElement` component.
|
|
1467
|
+
*
|
|
1468
|
+
* @remarks
|
|
1469
|
+
* Aspect ratio representation (e.g. "16:9", "4:3", "1:1").
|
|
1470
|
+
*
|
|
1471
|
+
* @param value - Aspect ratio textual expression
|
|
1472
|
+
* @param options - Optional component settings (modifiers).
|
|
1473
|
+
* @returns This builder instance for method chaining.
|
|
1474
|
+
*/
|
|
1475
|
+
addRatio(value, options) {
|
|
1476
|
+
return this.add(ratio(value, options));
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Appends a `ColourElement` component.
|
|
1480
|
+
*
|
|
1481
|
+
* @remarks
|
|
1482
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
1483
|
+
*
|
|
1484
|
+
* @param value - Hexadecimal color code
|
|
1485
|
+
* @param options - Optional component settings (modifiers).
|
|
1486
|
+
* @returns This builder instance for method chaining.
|
|
1487
|
+
*/
|
|
1488
|
+
addColour(value, options) {
|
|
1489
|
+
return this.add(colour(value, options));
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Appends a `ColourElement` component.
|
|
1493
|
+
*
|
|
1494
|
+
* @remarks
|
|
1495
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
1496
|
+
*
|
|
1497
|
+
* @param value - Hexadecimal color code
|
|
1498
|
+
* @param options - Optional component settings (modifiers).
|
|
1499
|
+
* @returns This builder instance for method chaining.
|
|
1500
|
+
*/
|
|
1501
|
+
addColorSwatch(value, options) {
|
|
1502
|
+
return this.add(colorSwatch(value, options));
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Appends a `NumberUnboundedElement` component.
|
|
1506
|
+
*
|
|
1507
|
+
* @remarks
|
|
1508
|
+
* Plain unbounded numeric value primitive element.
|
|
1509
|
+
*
|
|
1510
|
+
* @param value - Numeric value
|
|
1511
|
+
* @param options - Optional component settings (unit, modifiers).
|
|
1512
|
+
* @returns This builder instance for method chaining.
|
|
1513
|
+
*/
|
|
1514
|
+
addNumberUnbounded(value, options) {
|
|
1515
|
+
return this.add(numberUnbounded(value, options));
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Appends a `NumberBoundedStarsElement` component.
|
|
1519
|
+
*
|
|
1520
|
+
* @remarks
|
|
1521
|
+
* Bounded numeric rating represented as visual stars.
|
|
1522
|
+
*
|
|
1523
|
+
* @param value - Numeric rating score
|
|
1524
|
+
* @param options - Optional component settings (maximum, modifiers).
|
|
1525
|
+
* @returns This builder instance for method chaining.
|
|
1526
|
+
*/
|
|
1527
|
+
addNumberBoundedStars(value, options) {
|
|
1528
|
+
return this.add(numberBoundedStars(value, options));
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Appends a `NumberBoundedStarsElement` component.
|
|
1532
|
+
*
|
|
1533
|
+
* @remarks
|
|
1534
|
+
* Bounded numeric rating represented as visual stars.
|
|
1535
|
+
*
|
|
1536
|
+
* @param value - Numeric rating score
|
|
1537
|
+
* @param options - Optional component settings (maximum, modifiers).
|
|
1538
|
+
* @returns This builder instance for method chaining.
|
|
1539
|
+
*/
|
|
1540
|
+
addNumberStars(value, options) {
|
|
1541
|
+
return this.add(numberStars(value, options));
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Appends a `NumberBoundedMeterElement` component.
|
|
1545
|
+
*
|
|
1546
|
+
* @remarks
|
|
1547
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
1548
|
+
*
|
|
1549
|
+
* @param value - Numeric value
|
|
1550
|
+
* @param options - Optional component settings (minimum, maximum, label, unit, modifiers).
|
|
1551
|
+
* @returns This builder instance for method chaining.
|
|
1552
|
+
*/
|
|
1553
|
+
addNumberBoundedMeter(value, options) {
|
|
1554
|
+
return this.add(numberBoundedMeter(value, options));
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Appends a `NumberBoundedMeterElement` component.
|
|
1558
|
+
*
|
|
1559
|
+
* @remarks
|
|
1560
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
1561
|
+
*
|
|
1562
|
+
* @param value - Numeric value
|
|
1563
|
+
* @param options - Optional component settings (minimum, maximum, label, unit, modifiers).
|
|
1564
|
+
* @returns This builder instance for method chaining.
|
|
1565
|
+
*/
|
|
1566
|
+
addNumberMeter(value, options) {
|
|
1567
|
+
return this.add(numberMeter(value, options));
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Appends a `BooleanPlainElement` component.
|
|
1571
|
+
*
|
|
1572
|
+
* @remarks
|
|
1573
|
+
* Plain boolean value representation (textual "true" / "false").
|
|
1574
|
+
*
|
|
1575
|
+
* @param value - Boolean state value
|
|
1576
|
+
* @param options - Optional component settings (modifiers).
|
|
1577
|
+
* @returns This builder instance for method chaining.
|
|
1578
|
+
*/
|
|
1579
|
+
addBooleanPlain(value, options) {
|
|
1580
|
+
return this.add(booleanPlain(value, options));
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Appends a `BooleanBadgeElement` component.
|
|
1584
|
+
*
|
|
1585
|
+
* @remarks
|
|
1586
|
+
* Visual badge pill representation of a boolean state.
|
|
1587
|
+
*
|
|
1588
|
+
* @param value - Boolean state value
|
|
1589
|
+
* @param options - Optional component settings (trueLabel (defaults to `true`), falseLabel (defaults to `false`), variant (defaults to `neutral`), modifiers).
|
|
1590
|
+
* @returns This builder instance for method chaining.
|
|
1591
|
+
*/
|
|
1592
|
+
addBooleanBadge(value, options) {
|
|
1593
|
+
return this.add(booleanBadge(value, options));
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Appends a `TimestampElement` component.
|
|
1597
|
+
*
|
|
1598
|
+
* @remarks
|
|
1599
|
+
* Formatted date and time representation.
|
|
1600
|
+
*
|
|
1601
|
+
* @param value - ISO 8601 date string or epoch timestamp in milliseconds
|
|
1602
|
+
* @param options - Optional component settings (format (defaults to `full`), modifiers).
|
|
1603
|
+
* @returns This builder instance for method chaining.
|
|
1604
|
+
*/
|
|
1605
|
+
addTimestamp(value, options) {
|
|
1606
|
+
return this.add(timestamp(value, options));
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Appends a `ImageReferenceElement` component.
|
|
1610
|
+
*
|
|
1611
|
+
* @remarks
|
|
1612
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
1613
|
+
*
|
|
1614
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
1615
|
+
* @param options - Optional component settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
1616
|
+
* @returns This builder instance for method chaining.
|
|
1617
|
+
*/
|
|
1618
|
+
addImageReference(src, options) {
|
|
1619
|
+
return this.add(imageReference(src, options));
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Appends a `ImageReferenceElement` component.
|
|
1623
|
+
*
|
|
1624
|
+
* @remarks
|
|
1625
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
1626
|
+
*
|
|
1627
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
1628
|
+
* @param options - Optional component settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
1629
|
+
* @returns This builder instance for method chaining.
|
|
1630
|
+
*/
|
|
1631
|
+
addImageRef(src, options) {
|
|
1632
|
+
return this.add(imageRef(src, options));
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Appends a `DominantColourSetElement` component.
|
|
1636
|
+
*
|
|
1637
|
+
* @remarks
|
|
1638
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
1639
|
+
*
|
|
1640
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
1641
|
+
* @returns This builder instance for method chaining.
|
|
1642
|
+
*/
|
|
1643
|
+
addDominantColourSet(colors) {
|
|
1644
|
+
return this.add(dominantColourSet(colors));
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Appends a `DominantColourSetElement` component.
|
|
1648
|
+
*
|
|
1649
|
+
* @remarks
|
|
1650
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
1651
|
+
*
|
|
1652
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
1653
|
+
* @returns This builder instance for method chaining.
|
|
1654
|
+
*/
|
|
1655
|
+
addDominantColors(colors) {
|
|
1656
|
+
return this.add(dominantColors(colors));
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Appends a `MarkdownBlockElement` component.
|
|
1660
|
+
*
|
|
1661
|
+
* @remarks
|
|
1662
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
1663
|
+
*
|
|
1664
|
+
* @param content - Raw Markdown markup content
|
|
1665
|
+
* @param options - Optional component settings (modifiers).
|
|
1666
|
+
* @returns This builder instance for method chaining.
|
|
1667
|
+
*/
|
|
1668
|
+
addMarkdownBlock(content, options) {
|
|
1669
|
+
return this.add(markdownBlock(content, options));
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Appends a `MarkdownBlockElement` component.
|
|
1673
|
+
*
|
|
1674
|
+
* @remarks
|
|
1675
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
1676
|
+
*
|
|
1677
|
+
* @param content - Raw Markdown markup content
|
|
1678
|
+
* @param options - Optional component settings (modifiers).
|
|
1679
|
+
* @returns This builder instance for method chaining.
|
|
1680
|
+
*/
|
|
1681
|
+
addMarkdown(content, options) {
|
|
1682
|
+
return this.add(markdown(content, options));
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Appends a `HtmlBlockElement` component.
|
|
1686
|
+
*
|
|
1687
|
+
* @remarks
|
|
1688
|
+
* Sandboxed HTML rendering escape hatch.
|
|
1689
|
+
*
|
|
1690
|
+
* @param content - Raw HTML markup content
|
|
1691
|
+
* @param options - Optional component settings (modifiers).
|
|
1692
|
+
* @returns This builder instance for method chaining.
|
|
1693
|
+
*/
|
|
1694
|
+
addHtmlBlock(content, options) {
|
|
1695
|
+
return this.add(htmlBlock(content, options));
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Appends a `HtmlBlockElement` component.
|
|
1699
|
+
*
|
|
1700
|
+
* @remarks
|
|
1701
|
+
* Sandboxed HTML rendering escape hatch.
|
|
1702
|
+
*
|
|
1703
|
+
* @param content - Raw HTML markup content
|
|
1704
|
+
* @param options - Optional component settings (modifiers).
|
|
1705
|
+
* @returns This builder instance for method chaining.
|
|
1706
|
+
*/
|
|
1707
|
+
addHtml(content, options) {
|
|
1708
|
+
return this.add(html(content, options));
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Appends a `MultiSlotRowElement` component.
|
|
1712
|
+
*
|
|
1713
|
+
* @remarks
|
|
1714
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
1715
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
1716
|
+
*
|
|
1717
|
+
* @param slots - List of slots comprising the row
|
|
1718
|
+
* @param options - Optional component settings (proportions).
|
|
1719
|
+
* @returns This builder instance for method chaining.
|
|
1720
|
+
*/
|
|
1721
|
+
addMultiSlotRow(slots, options) {
|
|
1722
|
+
return this.add(multiSlotRow(slots, options));
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Appends a `MultiSlotRowElement` component.
|
|
1726
|
+
*
|
|
1727
|
+
* @remarks
|
|
1728
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
1729
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
1730
|
+
*
|
|
1731
|
+
* @param slots - List of slots comprising the row
|
|
1732
|
+
* @param options - Optional component settings (proportions).
|
|
1733
|
+
* @returns This builder instance for method chaining.
|
|
1734
|
+
*/
|
|
1735
|
+
addMultiSlot(slots, options) {
|
|
1736
|
+
return this.add(multiSlot(slots, options));
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Appends a `LabelValueRowElement` component.
|
|
1740
|
+
*
|
|
1741
|
+
* @remarks
|
|
1742
|
+
* Standard label and value row.
|
|
1743
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
1744
|
+
*
|
|
1745
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
1746
|
+
* @param value - Rendered value element on the right
|
|
1747
|
+
* @param options - Optional component settings (withDivider (defaults to `false`)).
|
|
1748
|
+
* @returns This builder instance for method chaining.
|
|
1749
|
+
*/
|
|
1750
|
+
addLabelValueRow(label, value, options) {
|
|
1751
|
+
return this.add(labelValueRow(label, value, options));
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Appends a `LabelValueRowElement` component.
|
|
1755
|
+
*
|
|
1756
|
+
* @remarks
|
|
1757
|
+
* Standard label and value row.
|
|
1758
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
1759
|
+
*
|
|
1760
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
1761
|
+
* @param value - Rendered value element on the right
|
|
1762
|
+
* @param options - Optional component settings (withDivider (defaults to `false`)).
|
|
1763
|
+
* @returns This builder instance for method chaining.
|
|
1764
|
+
*/
|
|
1765
|
+
addLabelValue(label, value, options) {
|
|
1766
|
+
return this.add(labelValue(label, value, options));
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Appends a `TableElement` component.
|
|
1770
|
+
*
|
|
1771
|
+
* @remarks
|
|
1772
|
+
* Structured tabular data representation.
|
|
1773
|
+
* Supports header/borderless modes, 2-column key-value tables, and 3-column data tables.
|
|
1774
|
+
*
|
|
1775
|
+
* @param rows - Tabular data rows
|
|
1776
|
+
* @param options - Optional component settings (hasHeader (defaults to `true`), isStriped (defaults to `false`), withColumnSeparators (defaults to `false`), withRowSeparators (defaults to `false`), columns).
|
|
1777
|
+
* @returns This builder instance for method chaining.
|
|
1778
|
+
*/
|
|
1779
|
+
addTable(rows, options) {
|
|
1780
|
+
return this.add(table(rows, options));
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Appends a `RepeatingGroupElement` component.
|
|
1784
|
+
*
|
|
1785
|
+
* @remarks
|
|
1786
|
+
* Repeating group container where entries share uniform structure and retain per-entry labels.
|
|
1787
|
+
*
|
|
1788
|
+
* @param entries - List of repeated entry records
|
|
1789
|
+
* @param options - Optional component settings (title).
|
|
1790
|
+
* @returns This builder instance for method chaining.
|
|
1791
|
+
*/
|
|
1792
|
+
addRepeatingGroup(entries, options) {
|
|
1793
|
+
return this.add(repeatingGroup(entries, options));
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Appends a `CollapsibleGroupElement` component.
|
|
1797
|
+
*
|
|
1798
|
+
* @remarks
|
|
1799
|
+
* Collapsible disclosure container (accordion) with summary badge.
|
|
1800
|
+
*
|
|
1801
|
+
* @param title - Group title (e.g. "Show specimen details")
|
|
1802
|
+
* @param elements - Nested content elements revealed when expanded
|
|
1803
|
+
* @param options - Optional component settings (summary, defaultExpanded (defaults to `false`)).
|
|
1804
|
+
* @returns This builder instance for method chaining.
|
|
1805
|
+
*/
|
|
1806
|
+
addCollapsibleGroup(title, elements, options) {
|
|
1807
|
+
return this.add(collapsibleGroup(title, elements, options));
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Appends a `DividerElement` component.
|
|
1811
|
+
*
|
|
1812
|
+
* @remarks
|
|
1813
|
+
* Visual hairline separator separating sections or element groups.
|
|
1814
|
+
*
|
|
1815
|
+
* @param options - Optional component settings (style (defaults to `hairline`)).
|
|
1816
|
+
* @returns This builder instance for method chaining.
|
|
1817
|
+
*/
|
|
1818
|
+
addDivider(options) {
|
|
1819
|
+
return this.add(divider(options));
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Finalizes and returns the complete strongly-typed `UiContainerClass` instance.
|
|
1823
|
+
*
|
|
1824
|
+
* @returns The constructed `UiContainerClass` instance.
|
|
1825
|
+
*/
|
|
1826
|
+
build() {
|
|
1827
|
+
return new UiContainerClass(this._elements);
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Serializes this builder into a strongly-typed, JSON-compatible plain object conforming to interface `UiContainer`.
|
|
1831
|
+
*
|
|
1832
|
+
* @returns The plain object representation conforming to interface `UiContainer`.
|
|
1833
|
+
*/
|
|
1834
|
+
toJSON() {
|
|
1835
|
+
return this.build().toJSON();
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Returns the compact JSON string representation of the built `UiContainerClass` instance with no indentation.
|
|
1839
|
+
*
|
|
1840
|
+
* @returns Compact JSON string without indentation.
|
|
1841
|
+
*/
|
|
1842
|
+
toString() {
|
|
1843
|
+
return this.build().toString();
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
/** Static helper factory object for `UiContainer`. */
|
|
1847
|
+
export const UiContainer = {
|
|
1848
|
+
/**
|
|
1849
|
+
* Creates a new fluent builder for constructing a `UiContainer`.
|
|
1850
|
+
*
|
|
1851
|
+
* @returns A new `UiContainerBuilder` instance.
|
|
1852
|
+
*/
|
|
1853
|
+
builder() {
|
|
1854
|
+
return new UiContainerBuilder();
|
|
1855
|
+
},
|
|
1856
|
+
/**
|
|
1857
|
+
* Creates a `UiContainerClass` directly from a properties object.
|
|
1858
|
+
*
|
|
1859
|
+
* @param params - Configuration properties.
|
|
1860
|
+
* @returns A completed `UiContainerClass` instance.
|
|
1861
|
+
*/
|
|
1862
|
+
create(params) {
|
|
1863
|
+
return new UiContainerClass(params.elements);
|
|
1864
|
+
},
|
|
1865
|
+
/**
|
|
1866
|
+
* Parses a JSON string or raw object into a validated `UiContainerClass` instance.
|
|
1867
|
+
*
|
|
1868
|
+
* @remarks
|
|
1869
|
+
* Throws an `Error` if the input does not conform to the `UiContainer` schema.
|
|
1870
|
+
*
|
|
1871
|
+
* @param json - JSON string or parsed JavaScript object to validate and hydrate.
|
|
1872
|
+
* @param withDeepValidation - Whether to recursively validate all nested child entities.
|
|
1873
|
+
* @returns A strongly-typed `UiContainerClass` instance.
|
|
1874
|
+
*/
|
|
1875
|
+
parse(json, withDeepValidation = true) {
|
|
1876
|
+
const data = typeof json === "string" ? JSON.parse(json) : json;
|
|
1877
|
+
if (!isUiContainer(data, withDeepValidation)) {
|
|
1878
|
+
throw new Error("Invalid JSON: value does not match the `UiContainer` schema.");
|
|
1879
|
+
}
|
|
1880
|
+
return UiContainer.create(data);
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* Functional helper to create a `UiContainerClass` instance directly.
|
|
1885
|
+
*
|
|
1886
|
+
* @remarks
|
|
1887
|
+
* Container model representing an ordered list of visual elements.
|
|
1888
|
+
*
|
|
1889
|
+
* @param options - Optional configuration properties.
|
|
1890
|
+
* @returns A strongly-typed `UiContainerClass` instance.
|
|
1891
|
+
*/
|
|
1892
|
+
export function createUiContainer(options) {
|
|
1893
|
+
return new UiContainerClass(options?.elements ?? []);
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Parses a JSON string or raw object into a validated `UiContainerClass` instance.
|
|
1897
|
+
*
|
|
1898
|
+
* @remarks
|
|
1899
|
+
* Container model representing an ordered list of visual elements.
|
|
1900
|
+
*
|
|
1901
|
+
* @param json - JSON string or parsed JavaScript object to validate and hydrate.
|
|
1902
|
+
* @param withDeepValidation - Whether to recursively validate all nested child entities.
|
|
1903
|
+
* @returns A strongly-typed `UiContainerClass` instance.
|
|
1904
|
+
*/
|
|
1905
|
+
export function parseUiContainer(json, withDeepValidation = true) {
|
|
1906
|
+
return UiContainer.parse(json, withDeepValidation);
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Fluent builder for constructing strongly-typed `UiCard` instances.
|
|
1910
|
+
*
|
|
1911
|
+
* @remarks
|
|
1912
|
+
* Root Card container model.
|
|
1913
|
+
* Represents a complete feature card rendered inside the 360px panel.
|
|
1914
|
+
*/
|
|
1915
|
+
export class UiCardBuilder {
|
|
1916
|
+
_title;
|
|
1917
|
+
_description;
|
|
1918
|
+
_actions = [];
|
|
1919
|
+
_elements = [];
|
|
1920
|
+
/**
|
|
1921
|
+
* Initializes a new `UiCardBuilder`.
|
|
1922
|
+
*
|
|
1923
|
+
* @param title - Human-readable feature title displayed in the card header
|
|
1924
|
+
*/
|
|
1925
|
+
constructor(title) {
|
|
1926
|
+
this._title = title;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Sets the `description` property on this builder.
|
|
1930
|
+
*
|
|
1931
|
+
* @param description - Optional neutral subtitle / description for the feature
|
|
1932
|
+
* @returns This builder instance for method chaining.
|
|
1933
|
+
*/
|
|
1934
|
+
description(description) {
|
|
1935
|
+
this._description = description;
|
|
1936
|
+
return this;
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Appends multiple actions items.
|
|
1940
|
+
*
|
|
1941
|
+
* @param items - The `UiAction` items to add.
|
|
1942
|
+
* @returns This builder instance for method chaining.
|
|
1943
|
+
*/
|
|
1944
|
+
addActions(...items) {
|
|
1945
|
+
this._actions.push(...items);
|
|
1946
|
+
return this;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Appends a single action.
|
|
1950
|
+
*
|
|
1951
|
+
* @param item - The `UiAction` item to add.
|
|
1952
|
+
* @returns This builder instance for method chaining.
|
|
1953
|
+
*/
|
|
1954
|
+
addAction(item) {
|
|
1955
|
+
this._actions.push(item);
|
|
1956
|
+
return this;
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Appends a visual element.
|
|
1960
|
+
*
|
|
1961
|
+
* @param element - The visual UI element component to add.
|
|
1962
|
+
* @returns This builder instance for method chaining.
|
|
1963
|
+
*/
|
|
1964
|
+
add(element) {
|
|
1965
|
+
this._elements.push(element);
|
|
1966
|
+
return this;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Appends multiple elements items.
|
|
1970
|
+
*
|
|
1971
|
+
* @param items - The `UiElement` items to add.
|
|
1972
|
+
* @returns This builder instance for method chaining.
|
|
1973
|
+
*/
|
|
1974
|
+
addElements(...items) {
|
|
1975
|
+
this._elements.push(...items);
|
|
1976
|
+
return this;
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Appends a `StringShortElement` component.
|
|
1980
|
+
*
|
|
1981
|
+
* @remarks
|
|
1982
|
+
* Short string primitive element.
|
|
1983
|
+
* Supports plain text or compact chip pill presentation.
|
|
1984
|
+
*
|
|
1985
|
+
* @param value - Text value
|
|
1986
|
+
* @param options - Optional component settings (representation (defaults to `plain`), modifiers).
|
|
1987
|
+
* @returns This builder instance for method chaining.
|
|
1988
|
+
*/
|
|
1989
|
+
addStringShort(value, options) {
|
|
1990
|
+
return this.add(stringShort(value, options));
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Appends a `StringLongElement` component.
|
|
1994
|
+
*
|
|
1995
|
+
* @remarks
|
|
1996
|
+
* Multiline text block primitive element for descriptions, comments, or prose.
|
|
1997
|
+
*
|
|
1998
|
+
* @param value - Text value
|
|
1999
|
+
* @param options - Optional component settings (modifiers).
|
|
2000
|
+
* @returns This builder instance for method chaining.
|
|
2001
|
+
*/
|
|
2002
|
+
addStringLong(value, options) {
|
|
2003
|
+
return this.add(stringLong(value, options));
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Appends a `StringCodeElement` component.
|
|
2007
|
+
*
|
|
2008
|
+
* @remarks
|
|
2009
|
+
* Monospace code block or formatted code snippet representation.
|
|
2010
|
+
*
|
|
2011
|
+
* @param value - Text value
|
|
2012
|
+
* @param options - Optional component settings (language, modifiers).
|
|
2013
|
+
* @returns This builder instance for method chaining.
|
|
2014
|
+
*/
|
|
2015
|
+
addStringCode(value, options) {
|
|
2016
|
+
return this.add(stringCode(value, options));
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Appends a `XmlElement` component.
|
|
2020
|
+
*
|
|
2021
|
+
* @remarks
|
|
2022
|
+
* XML markup code block element.
|
|
2023
|
+
*
|
|
2024
|
+
* @param value - XML content value
|
|
2025
|
+
* @param options - Optional component settings (modifiers).
|
|
2026
|
+
* @returns This builder instance for method chaining.
|
|
2027
|
+
*/
|
|
2028
|
+
addXml(value, options) {
|
|
2029
|
+
return this.add(xml(value, options));
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Appends a `JsonElement` component.
|
|
2033
|
+
*
|
|
2034
|
+
* @remarks
|
|
2035
|
+
* JSON data or structure representation element.
|
|
2036
|
+
*
|
|
2037
|
+
* @param value - JSON content value
|
|
2038
|
+
* @param options - Optional component settings (modifiers).
|
|
2039
|
+
* @returns This builder instance for method chaining.
|
|
2040
|
+
*/
|
|
2041
|
+
addJson(value, options) {
|
|
2042
|
+
return this.add(json(value, options));
|
|
2043
|
+
}
|
|
2044
|
+
/**
|
|
2045
|
+
* Appends a `StringUrlElement` component.
|
|
2046
|
+
*
|
|
2047
|
+
* @remarks
|
|
2048
|
+
* Hyperlink representation for external or internal URL navigation.
|
|
2049
|
+
*
|
|
2050
|
+
* @param value - Target URL or navigation destination
|
|
2051
|
+
* @param options - Optional component settings (label, modifiers).
|
|
2052
|
+
* @returns This builder instance for method chaining.
|
|
2053
|
+
*/
|
|
2054
|
+
addStringUrl(value, options) {
|
|
2055
|
+
return this.add(stringUrl(value, options));
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Appends a `IdentifierElement` component.
|
|
2059
|
+
*
|
|
2060
|
+
* @remarks
|
|
2061
|
+
* Monospace semantic identifier representation.
|
|
2062
|
+
*
|
|
2063
|
+
* @param value - Identifier string value
|
|
2064
|
+
* @param options - Optional component settings (modifiers).
|
|
2065
|
+
* @returns This builder instance for method chaining.
|
|
2066
|
+
*/
|
|
2067
|
+
addIdentifier(value, options) {
|
|
2068
|
+
return this.add(identifier(value, options));
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Appends a `RatioElement` component.
|
|
2072
|
+
*
|
|
2073
|
+
* @remarks
|
|
2074
|
+
* Aspect ratio representation (e.g. "16:9", "4:3", "1:1").
|
|
2075
|
+
*
|
|
2076
|
+
* @param value - Aspect ratio textual expression
|
|
2077
|
+
* @param options - Optional component settings (modifiers).
|
|
2078
|
+
* @returns This builder instance for method chaining.
|
|
2079
|
+
*/
|
|
2080
|
+
addRatio(value, options) {
|
|
2081
|
+
return this.add(ratio(value, options));
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* Appends a `ColourElement` component.
|
|
2085
|
+
*
|
|
2086
|
+
* @remarks
|
|
2087
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
2088
|
+
*
|
|
2089
|
+
* @param value - Hexadecimal color code
|
|
2090
|
+
* @param options - Optional component settings (modifiers).
|
|
2091
|
+
* @returns This builder instance for method chaining.
|
|
2092
|
+
*/
|
|
2093
|
+
addColour(value, options) {
|
|
2094
|
+
return this.add(colour(value, options));
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Appends a `ColourElement` component.
|
|
2098
|
+
*
|
|
2099
|
+
* @remarks
|
|
2100
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
2101
|
+
*
|
|
2102
|
+
* @param value - Hexadecimal color code
|
|
2103
|
+
* @param options - Optional component settings (modifiers).
|
|
2104
|
+
* @returns This builder instance for method chaining.
|
|
2105
|
+
*/
|
|
2106
|
+
addColorSwatch(value, options) {
|
|
2107
|
+
return this.add(colorSwatch(value, options));
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Appends a `NumberUnboundedElement` component.
|
|
2111
|
+
*
|
|
2112
|
+
* @remarks
|
|
2113
|
+
* Plain unbounded numeric value primitive element.
|
|
2114
|
+
*
|
|
2115
|
+
* @param value - Numeric value
|
|
2116
|
+
* @param options - Optional component settings (unit, modifiers).
|
|
2117
|
+
* @returns This builder instance for method chaining.
|
|
2118
|
+
*/
|
|
2119
|
+
addNumberUnbounded(value, options) {
|
|
2120
|
+
return this.add(numberUnbounded(value, options));
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Appends a `NumberBoundedStarsElement` component.
|
|
2124
|
+
*
|
|
2125
|
+
* @remarks
|
|
2126
|
+
* Bounded numeric rating represented as visual stars.
|
|
2127
|
+
*
|
|
2128
|
+
* @param value - Numeric rating score
|
|
2129
|
+
* @param options - Optional component settings (maximum, modifiers).
|
|
2130
|
+
* @returns This builder instance for method chaining.
|
|
2131
|
+
*/
|
|
2132
|
+
addNumberBoundedStars(value, options) {
|
|
2133
|
+
return this.add(numberBoundedStars(value, options));
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Appends a `NumberBoundedStarsElement` component.
|
|
2137
|
+
*
|
|
2138
|
+
* @remarks
|
|
2139
|
+
* Bounded numeric rating represented as visual stars.
|
|
2140
|
+
*
|
|
2141
|
+
* @param value - Numeric rating score
|
|
2142
|
+
* @param options - Optional component settings (maximum, modifiers).
|
|
2143
|
+
* @returns This builder instance for method chaining.
|
|
2144
|
+
*/
|
|
2145
|
+
addNumberStars(value, options) {
|
|
2146
|
+
return this.add(numberStars(value, options));
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Appends a `NumberBoundedMeterElement` component.
|
|
2150
|
+
*
|
|
2151
|
+
* @remarks
|
|
2152
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
2153
|
+
*
|
|
2154
|
+
* @param value - Numeric value
|
|
2155
|
+
* @param options - Optional component settings (minimum, maximum, label, unit, modifiers).
|
|
2156
|
+
* @returns This builder instance for method chaining.
|
|
2157
|
+
*/
|
|
2158
|
+
addNumberBoundedMeter(value, options) {
|
|
2159
|
+
return this.add(numberBoundedMeter(value, options));
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Appends a `NumberBoundedMeterElement` component.
|
|
2163
|
+
*
|
|
2164
|
+
* @remarks
|
|
2165
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
2166
|
+
*
|
|
2167
|
+
* @param value - Numeric value
|
|
2168
|
+
* @param options - Optional component settings (minimum, maximum, label, unit, modifiers).
|
|
2169
|
+
* @returns This builder instance for method chaining.
|
|
2170
|
+
*/
|
|
2171
|
+
addNumberMeter(value, options) {
|
|
2172
|
+
return this.add(numberMeter(value, options));
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* Appends a `BooleanPlainElement` component.
|
|
2176
|
+
*
|
|
2177
|
+
* @remarks
|
|
2178
|
+
* Plain boolean value representation (textual "true" / "false").
|
|
2179
|
+
*
|
|
2180
|
+
* @param value - Boolean state value
|
|
2181
|
+
* @param options - Optional component settings (modifiers).
|
|
2182
|
+
* @returns This builder instance for method chaining.
|
|
2183
|
+
*/
|
|
2184
|
+
addBooleanPlain(value, options) {
|
|
2185
|
+
return this.add(booleanPlain(value, options));
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Appends a `BooleanBadgeElement` component.
|
|
2189
|
+
*
|
|
2190
|
+
* @remarks
|
|
2191
|
+
* Visual badge pill representation of a boolean state.
|
|
2192
|
+
*
|
|
2193
|
+
* @param value - Boolean state value
|
|
2194
|
+
* @param options - Optional component settings (trueLabel (defaults to `true`), falseLabel (defaults to `false`), variant (defaults to `neutral`), modifiers).
|
|
2195
|
+
* @returns This builder instance for method chaining.
|
|
2196
|
+
*/
|
|
2197
|
+
addBooleanBadge(value, options) {
|
|
2198
|
+
return this.add(booleanBadge(value, options));
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Appends a `TimestampElement` component.
|
|
2202
|
+
*
|
|
2203
|
+
* @remarks
|
|
2204
|
+
* Formatted date and time representation.
|
|
2205
|
+
*
|
|
2206
|
+
* @param value - ISO 8601 date string or epoch timestamp in milliseconds
|
|
2207
|
+
* @param options - Optional component settings (format (defaults to `full`), modifiers).
|
|
2208
|
+
* @returns This builder instance for method chaining.
|
|
2209
|
+
*/
|
|
2210
|
+
addTimestamp(value, options) {
|
|
2211
|
+
return this.add(timestamp(value, options));
|
|
2212
|
+
}
|
|
2213
|
+
/**
|
|
2214
|
+
* Appends a `ImageReferenceElement` component.
|
|
2215
|
+
*
|
|
2216
|
+
* @remarks
|
|
2217
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
2218
|
+
*
|
|
2219
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
2220
|
+
* @param options - Optional component settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
2221
|
+
* @returns This builder instance for method chaining.
|
|
2222
|
+
*/
|
|
2223
|
+
addImageReference(src, options) {
|
|
2224
|
+
return this.add(imageReference(src, options));
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Appends a `ImageReferenceElement` component.
|
|
2228
|
+
*
|
|
2229
|
+
* @remarks
|
|
2230
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
2231
|
+
*
|
|
2232
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
2233
|
+
* @param options - Optional component settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
2234
|
+
* @returns This builder instance for method chaining.
|
|
2235
|
+
*/
|
|
2236
|
+
addImageRef(src, options) {
|
|
2237
|
+
return this.add(imageRef(src, options));
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Appends a `DominantColourSetElement` component.
|
|
2241
|
+
*
|
|
2242
|
+
* @remarks
|
|
2243
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
2244
|
+
*
|
|
2245
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
2246
|
+
* @returns This builder instance for method chaining.
|
|
2247
|
+
*/
|
|
2248
|
+
addDominantColourSet(colors) {
|
|
2249
|
+
return this.add(dominantColourSet(colors));
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Appends a `DominantColourSetElement` component.
|
|
2253
|
+
*
|
|
2254
|
+
* @remarks
|
|
2255
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
2256
|
+
*
|
|
2257
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
2258
|
+
* @returns This builder instance for method chaining.
|
|
2259
|
+
*/
|
|
2260
|
+
addDominantColors(colors) {
|
|
2261
|
+
return this.add(dominantColors(colors));
|
|
2262
|
+
}
|
|
2263
|
+
/**
|
|
2264
|
+
* Appends a `MarkdownBlockElement` component.
|
|
2265
|
+
*
|
|
2266
|
+
* @remarks
|
|
2267
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
2268
|
+
*
|
|
2269
|
+
* @param content - Raw Markdown markup content
|
|
2270
|
+
* @param options - Optional component settings (modifiers).
|
|
2271
|
+
* @returns This builder instance for method chaining.
|
|
2272
|
+
*/
|
|
2273
|
+
addMarkdownBlock(content, options) {
|
|
2274
|
+
return this.add(markdownBlock(content, options));
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Appends a `MarkdownBlockElement` component.
|
|
2278
|
+
*
|
|
2279
|
+
* @remarks
|
|
2280
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
2281
|
+
*
|
|
2282
|
+
* @param content - Raw Markdown markup content
|
|
2283
|
+
* @param options - Optional component settings (modifiers).
|
|
2284
|
+
* @returns This builder instance for method chaining.
|
|
2285
|
+
*/
|
|
2286
|
+
addMarkdown(content, options) {
|
|
2287
|
+
return this.add(markdown(content, options));
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Appends a `HtmlBlockElement` component.
|
|
2291
|
+
*
|
|
2292
|
+
* @remarks
|
|
2293
|
+
* Sandboxed HTML rendering escape hatch.
|
|
2294
|
+
*
|
|
2295
|
+
* @param content - Raw HTML markup content
|
|
2296
|
+
* @param options - Optional component settings (modifiers).
|
|
2297
|
+
* @returns This builder instance for method chaining.
|
|
2298
|
+
*/
|
|
2299
|
+
addHtmlBlock(content, options) {
|
|
2300
|
+
return this.add(htmlBlock(content, options));
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Appends a `HtmlBlockElement` component.
|
|
2304
|
+
*
|
|
2305
|
+
* @remarks
|
|
2306
|
+
* Sandboxed HTML rendering escape hatch.
|
|
2307
|
+
*
|
|
2308
|
+
* @param content - Raw HTML markup content
|
|
2309
|
+
* @param options - Optional component settings (modifiers).
|
|
2310
|
+
* @returns This builder instance for method chaining.
|
|
2311
|
+
*/
|
|
2312
|
+
addHtml(content, options) {
|
|
2313
|
+
return this.add(html(content, options));
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Appends a `MultiSlotRowElement` component.
|
|
2317
|
+
*
|
|
2318
|
+
* @remarks
|
|
2319
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
2320
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
2321
|
+
*
|
|
2322
|
+
* @param slots - List of slots comprising the row
|
|
2323
|
+
* @param options - Optional component settings (proportions).
|
|
2324
|
+
* @returns This builder instance for method chaining.
|
|
2325
|
+
*/
|
|
2326
|
+
addMultiSlotRow(slots, options) {
|
|
2327
|
+
return this.add(multiSlotRow(slots, options));
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Appends a `MultiSlotRowElement` component.
|
|
2331
|
+
*
|
|
2332
|
+
* @remarks
|
|
2333
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
2334
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
2335
|
+
*
|
|
2336
|
+
* @param slots - List of slots comprising the row
|
|
2337
|
+
* @param options - Optional component settings (proportions).
|
|
2338
|
+
* @returns This builder instance for method chaining.
|
|
2339
|
+
*/
|
|
2340
|
+
addMultiSlot(slots, options) {
|
|
2341
|
+
return this.add(multiSlot(slots, options));
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Appends a `LabelValueRowElement` component.
|
|
2345
|
+
*
|
|
2346
|
+
* @remarks
|
|
2347
|
+
* Standard label and value row.
|
|
2348
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
2349
|
+
*
|
|
2350
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
2351
|
+
* @param value - Rendered value element on the right
|
|
2352
|
+
* @param options - Optional component settings (withDivider (defaults to `false`)).
|
|
2353
|
+
* @returns This builder instance for method chaining.
|
|
2354
|
+
*/
|
|
2355
|
+
addLabelValueRow(label, value, options) {
|
|
2356
|
+
return this.add(labelValueRow(label, value, options));
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Appends a `LabelValueRowElement` component.
|
|
2360
|
+
*
|
|
2361
|
+
* @remarks
|
|
2362
|
+
* Standard label and value row.
|
|
2363
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
2364
|
+
*
|
|
2365
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
2366
|
+
* @param value - Rendered value element on the right
|
|
2367
|
+
* @param options - Optional component settings (withDivider (defaults to `false`)).
|
|
2368
|
+
* @returns This builder instance for method chaining.
|
|
2369
|
+
*/
|
|
2370
|
+
addLabelValue(label, value, options) {
|
|
2371
|
+
return this.add(labelValue(label, value, options));
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Appends a `TableElement` component.
|
|
2375
|
+
*
|
|
2376
|
+
* @remarks
|
|
2377
|
+
* Structured tabular data representation.
|
|
2378
|
+
* Supports header/borderless modes, 2-column key-value tables, and 3-column data tables.
|
|
2379
|
+
*
|
|
2380
|
+
* @param rows - Tabular data rows
|
|
2381
|
+
* @param options - Optional component settings (hasHeader (defaults to `true`), isStriped (defaults to `false`), withColumnSeparators (defaults to `false`), withRowSeparators (defaults to `false`), columns).
|
|
2382
|
+
* @returns This builder instance for method chaining.
|
|
2383
|
+
*/
|
|
2384
|
+
addTable(rows, options) {
|
|
2385
|
+
return this.add(table(rows, options));
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Appends a `RepeatingGroupElement` component.
|
|
2389
|
+
*
|
|
2390
|
+
* @remarks
|
|
2391
|
+
* Repeating group container where entries share uniform structure and retain per-entry labels.
|
|
2392
|
+
*
|
|
2393
|
+
* @param entries - List of repeated entry records
|
|
2394
|
+
* @param options - Optional component settings (title).
|
|
2395
|
+
* @returns This builder instance for method chaining.
|
|
2396
|
+
*/
|
|
2397
|
+
addRepeatingGroup(entries, options) {
|
|
2398
|
+
return this.add(repeatingGroup(entries, options));
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Appends a `CollapsibleGroupElement` component.
|
|
2402
|
+
*
|
|
2403
|
+
* @remarks
|
|
2404
|
+
* Collapsible disclosure container (accordion) with summary badge.
|
|
2405
|
+
*
|
|
2406
|
+
* @param title - Group title (e.g. "Show specimen details")
|
|
2407
|
+
* @param elements - Nested content elements revealed when expanded
|
|
2408
|
+
* @param options - Optional component settings (summary, defaultExpanded (defaults to `false`)).
|
|
2409
|
+
* @returns This builder instance for method chaining.
|
|
2410
|
+
*/
|
|
2411
|
+
addCollapsibleGroup(title, elements, options) {
|
|
2412
|
+
return this.add(collapsibleGroup(title, elements, options));
|
|
2413
|
+
}
|
|
2414
|
+
/**
|
|
2415
|
+
* Appends a `DividerElement` component.
|
|
2416
|
+
*
|
|
2417
|
+
* @remarks
|
|
2418
|
+
* Visual hairline separator separating sections or element groups.
|
|
2419
|
+
*
|
|
2420
|
+
* @param options - Optional component settings (style (defaults to `hairline`)).
|
|
2421
|
+
* @returns This builder instance for method chaining.
|
|
2422
|
+
*/
|
|
2423
|
+
addDivider(options) {
|
|
2424
|
+
return this.add(divider(options));
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* Finalizes and returns the complete strongly-typed `UiCardClass` instance.
|
|
2428
|
+
*
|
|
2429
|
+
* @returns The constructed `UiCardClass` instance.
|
|
2430
|
+
*/
|
|
2431
|
+
build() {
|
|
2432
|
+
return new UiCardClass(this._title, this._elements, {
|
|
2433
|
+
description: this._description,
|
|
2434
|
+
actions: this._actions.length > 0 ? this._actions : undefined
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Serializes this builder into a strongly-typed, JSON-compatible plain object conforming to interface `UiCard`.
|
|
2439
|
+
*
|
|
2440
|
+
* @returns The plain object representation conforming to interface `UiCard`.
|
|
2441
|
+
*/
|
|
2442
|
+
toJSON() {
|
|
2443
|
+
return this.build().toJSON();
|
|
2444
|
+
}
|
|
2445
|
+
/**
|
|
2446
|
+
* Returns the compact JSON string representation of the built `UiCardClass` instance with no indentation.
|
|
2447
|
+
*
|
|
2448
|
+
* @returns Compact JSON string without indentation.
|
|
2449
|
+
*/
|
|
2450
|
+
toString() {
|
|
2451
|
+
return this.build().toString();
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
/** Static helper factory object for `UiCard`. */
|
|
2455
|
+
export const UiCard = {
|
|
2456
|
+
/**
|
|
2457
|
+
* Creates a new fluent builder for constructing a `UiCard`.
|
|
2458
|
+
*
|
|
2459
|
+
* @param title - Human-readable feature title displayed in the card header
|
|
2460
|
+
* @returns A new `UiCardBuilder` instance.
|
|
2461
|
+
*/
|
|
2462
|
+
builder(title) {
|
|
2463
|
+
return new UiCardBuilder(title);
|
|
2464
|
+
},
|
|
2465
|
+
/**
|
|
2466
|
+
* Creates a `UiCardClass` directly from a properties object.
|
|
2467
|
+
*
|
|
2468
|
+
* @param params - Configuration properties.
|
|
2469
|
+
* @returns A completed `UiCardClass` instance.
|
|
2470
|
+
*/
|
|
2471
|
+
create(params) {
|
|
2472
|
+
return new UiCardClass(params.title, params.elements, {
|
|
2473
|
+
description: params.description,
|
|
2474
|
+
actions: params.actions
|
|
2475
|
+
});
|
|
2476
|
+
},
|
|
2477
|
+
/**
|
|
2478
|
+
* Parses a JSON string or raw object into a validated `UiCardClass` instance.
|
|
2479
|
+
*
|
|
2480
|
+
* @remarks
|
|
2481
|
+
* Throws an `Error` if the input does not conform to the `UiCard` schema.
|
|
2482
|
+
*
|
|
2483
|
+
* @param json - JSON string or parsed JavaScript object to validate and hydrate.
|
|
2484
|
+
* @param withDeepValidation - Whether to recursively validate all nested child entities.
|
|
2485
|
+
* @returns A strongly-typed `UiCardClass` instance.
|
|
2486
|
+
*/
|
|
2487
|
+
parse(json, withDeepValidation = true) {
|
|
2488
|
+
const data = typeof json === "string" ? JSON.parse(json) : json;
|
|
2489
|
+
if (!isUiCard(data, withDeepValidation)) {
|
|
2490
|
+
throw new Error("Invalid JSON: value does not match the `UiCard` schema.");
|
|
2491
|
+
}
|
|
2492
|
+
return UiCard.create(data);
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
/**
|
|
2496
|
+
* Functional helper to create a `UiCardClass` instance directly.
|
|
2497
|
+
*
|
|
2498
|
+
* @remarks
|
|
2499
|
+
* Root Card container model.
|
|
2500
|
+
* Represents a complete feature card rendered inside the 360px panel.
|
|
2501
|
+
*
|
|
2502
|
+
* @param title - Human-readable feature title displayed in the card header
|
|
2503
|
+
* @param options - Optional configuration properties.
|
|
2504
|
+
* @returns A strongly-typed `UiCardClass` instance.
|
|
2505
|
+
*/
|
|
2506
|
+
export function createUiCard(title, options) {
|
|
2507
|
+
return new UiCardClass(title, options?.elements ?? [], {
|
|
2508
|
+
description: options?.description,
|
|
2509
|
+
actions: options?.actions
|
|
2510
|
+
});
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2513
|
+
* Parses a JSON string or raw object into a validated `UiCardClass` instance.
|
|
2514
|
+
*
|
|
2515
|
+
* @remarks
|
|
2516
|
+
* Root Card container model.
|
|
2517
|
+
* Represents a complete feature card rendered inside the 360px panel.
|
|
2518
|
+
*
|
|
2519
|
+
* @param json - JSON string or parsed JavaScript object to validate and hydrate.
|
|
2520
|
+
* @param withDeepValidation - Whether to recursively validate all nested child entities.
|
|
2521
|
+
* @returns A strongly-typed `UiCardClass` instance.
|
|
2522
|
+
*/
|
|
2523
|
+
export function parseUiCard(json, withDeepValidation = true) {
|
|
2524
|
+
return UiCard.parse(json, withDeepValidation);
|
|
2525
|
+
}
|
|
2526
|
+
// --- Functional DSL Factory Helpers ---
|
|
2527
|
+
/**
|
|
2528
|
+
* Creates a `TruncateOptions` component instance.
|
|
2529
|
+
*
|
|
2530
|
+
* @remarks
|
|
2531
|
+
* Truncation configuration for long textual content with optional expand affordance.
|
|
2532
|
+
*
|
|
2533
|
+
* @param characterLimit - Maximum number of characters to display before truncating
|
|
2534
|
+
* @param options - Optional settings (showMore (defaults to `true`)).
|
|
2535
|
+
* @returns A strongly-typed `TruncateOptions` object.
|
|
2536
|
+
*/
|
|
2537
|
+
export function truncateOptions(characterLimit, options) {
|
|
2538
|
+
return {
|
|
2539
|
+
characterLimit,
|
|
2540
|
+
showMore: options?.showMore ?? true
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Creates a `BaseModifiers` component instance.
|
|
2545
|
+
*
|
|
2546
|
+
* @remarks
|
|
2547
|
+
* Base modifier traits for elements that support copy affordance.
|
|
2548
|
+
*
|
|
2549
|
+
* @param options - Optional settings (copyable).
|
|
2550
|
+
* @returns A strongly-typed `BaseModifiers` object.
|
|
2551
|
+
*/
|
|
2552
|
+
export function baseModifiers(options) {
|
|
2553
|
+
return {
|
|
2554
|
+
copyable: options?.copyable
|
|
2555
|
+
};
|
|
2556
|
+
}
|
|
2557
|
+
/**
|
|
2558
|
+
* Creates a `PrimitiveModifiers` component instance.
|
|
2559
|
+
*
|
|
2560
|
+
* @remarks
|
|
2561
|
+
* Common modifier traits that can be attached to primitive elements.
|
|
2562
|
+
*
|
|
2563
|
+
* @param options - Optional settings (truncate, weight (defaults to `normal`), intensity (defaults to `medium`), monospace (defaults to `false`), copyable).
|
|
2564
|
+
* @returns A strongly-typed `PrimitiveModifiers` object.
|
|
2565
|
+
*/
|
|
2566
|
+
export function primitiveModifiers(options) {
|
|
2567
|
+
return {
|
|
2568
|
+
truncate: options?.truncate,
|
|
2569
|
+
weight: options?.weight ?? TextWeight.normal,
|
|
2570
|
+
intensity: options?.intensity ?? TextIntensity.medium,
|
|
2571
|
+
monospace: options?.monospace ?? false,
|
|
2572
|
+
copyable: options?.copyable
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Creates a `StringShortElement` component instance.
|
|
2577
|
+
*
|
|
2578
|
+
* @remarks
|
|
2579
|
+
* Short string primitive element.
|
|
2580
|
+
* Supports plain text or compact chip pill presentation.
|
|
2581
|
+
*
|
|
2582
|
+
* @param value - Text value
|
|
2583
|
+
* @param options - Optional settings (representation (defaults to `plain`), modifiers).
|
|
2584
|
+
* @returns A strongly-typed `StringShortElement` object.
|
|
2585
|
+
*/
|
|
2586
|
+
export function stringShort(value, options) {
|
|
2587
|
+
return {
|
|
2588
|
+
type: "string-short",
|
|
2589
|
+
value,
|
|
2590
|
+
representation: options?.representation ?? StringShortRepresentation.plain,
|
|
2591
|
+
modifiers: options?.modifiers
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Creates a `StringLongElement` component instance.
|
|
2596
|
+
*
|
|
2597
|
+
* @remarks
|
|
2598
|
+
* Multiline text block primitive element for descriptions, comments, or prose.
|
|
2599
|
+
*
|
|
2600
|
+
* @param value - Text value
|
|
2601
|
+
* @param options - Optional settings (modifiers).
|
|
2602
|
+
* @returns A strongly-typed `StringLongElement` object.
|
|
2603
|
+
*/
|
|
2604
|
+
export function stringLong(value, options) {
|
|
2605
|
+
return {
|
|
2606
|
+
type: "string-long",
|
|
2607
|
+
value,
|
|
2608
|
+
modifiers: options?.modifiers
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Creates a `StringCodeElement` component instance.
|
|
2613
|
+
*
|
|
2614
|
+
* @remarks
|
|
2615
|
+
* Monospace code block or formatted code snippet representation.
|
|
2616
|
+
*
|
|
2617
|
+
* @param value - Text value
|
|
2618
|
+
* @param options - Optional settings (language, modifiers).
|
|
2619
|
+
* @returns A strongly-typed `StringCodeElement` object.
|
|
2620
|
+
*/
|
|
2621
|
+
export function stringCode(value, options) {
|
|
2622
|
+
return {
|
|
2623
|
+
type: "string-code",
|
|
2624
|
+
value,
|
|
2625
|
+
language: options?.language,
|
|
2626
|
+
modifiers: options?.modifiers
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* Creates a `XmlElement` component instance.
|
|
2631
|
+
*
|
|
2632
|
+
* @remarks
|
|
2633
|
+
* XML markup code block element.
|
|
2634
|
+
*
|
|
2635
|
+
* @param value - XML content value
|
|
2636
|
+
* @param options - Optional settings (modifiers).
|
|
2637
|
+
* @returns A strongly-typed `XmlElement` object.
|
|
2638
|
+
*/
|
|
2639
|
+
export function xml(value, options) {
|
|
2640
|
+
return {
|
|
2641
|
+
type: "xml",
|
|
2642
|
+
value,
|
|
2643
|
+
modifiers: options?.modifiers
|
|
2644
|
+
};
|
|
2645
|
+
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Creates a `JsonElement` component instance.
|
|
2648
|
+
*
|
|
2649
|
+
* @remarks
|
|
2650
|
+
* JSON data or structure representation element.
|
|
2651
|
+
*
|
|
2652
|
+
* @param value - JSON content value
|
|
2653
|
+
* @param options - Optional settings (modifiers).
|
|
2654
|
+
* @returns A strongly-typed `JsonElement` object.
|
|
2655
|
+
*/
|
|
2656
|
+
export function json(value, options) {
|
|
2657
|
+
return {
|
|
2658
|
+
type: "json",
|
|
2659
|
+
value,
|
|
2660
|
+
modifiers: options?.modifiers
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Creates a `StringUrlElement` component instance.
|
|
2665
|
+
*
|
|
2666
|
+
* @remarks
|
|
2667
|
+
* Hyperlink representation for external or internal URL navigation.
|
|
2668
|
+
*
|
|
2669
|
+
* @param value - Target URL or navigation destination
|
|
2670
|
+
* @param options - Optional settings (label, modifiers).
|
|
2671
|
+
* @returns A strongly-typed `StringUrlElement` object.
|
|
2672
|
+
*/
|
|
2673
|
+
export function stringUrl(value, options) {
|
|
2674
|
+
return {
|
|
2675
|
+
type: "string-url",
|
|
2676
|
+
value,
|
|
2677
|
+
label: options?.label,
|
|
2678
|
+
modifiers: options?.modifiers
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* Creates a `IdentifierElement` component instance.
|
|
2683
|
+
*
|
|
2684
|
+
* @remarks
|
|
2685
|
+
* Monospace semantic identifier representation.
|
|
2686
|
+
*
|
|
2687
|
+
* @param value - Identifier string value
|
|
2688
|
+
* @param options - Optional settings (modifiers).
|
|
2689
|
+
* @returns A strongly-typed `IdentifierElement` object.
|
|
2690
|
+
*/
|
|
2691
|
+
export function identifier(value, options) {
|
|
2692
|
+
return {
|
|
2693
|
+
type: "identifier",
|
|
2694
|
+
value,
|
|
2695
|
+
modifiers: options?.modifiers
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
/**
|
|
2699
|
+
* Creates a `RatioElement` component instance.
|
|
2700
|
+
*
|
|
2701
|
+
* @remarks
|
|
2702
|
+
* Aspect ratio representation (e.g. "16:9", "4:3", "1:1").
|
|
2703
|
+
*
|
|
2704
|
+
* @param value - Aspect ratio textual expression
|
|
2705
|
+
* @param options - Optional settings (modifiers).
|
|
2706
|
+
* @returns A strongly-typed `RatioElement` object.
|
|
2707
|
+
*/
|
|
2708
|
+
export function ratio(value, options) {
|
|
2709
|
+
return {
|
|
2710
|
+
type: "ratio",
|
|
2711
|
+
value,
|
|
2712
|
+
modifiers: options?.modifiers
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2715
|
+
/**
|
|
2716
|
+
* Creates a `ColourElement` component instance.
|
|
2717
|
+
*
|
|
2718
|
+
* @remarks
|
|
2719
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
2720
|
+
*
|
|
2721
|
+
* @param value - Hexadecimal color code
|
|
2722
|
+
* @param options - Optional settings (modifiers).
|
|
2723
|
+
* @returns A strongly-typed `ColourElement` object.
|
|
2724
|
+
*/
|
|
2725
|
+
export function colour(value, options) {
|
|
2726
|
+
return {
|
|
2727
|
+
type: "color-swatch",
|
|
2728
|
+
value,
|
|
2729
|
+
modifiers: options?.modifiers
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* Creates a `ColourElement` component instance.
|
|
2734
|
+
*
|
|
2735
|
+
* @remarks
|
|
2736
|
+
* Single color swatch representation with hex value and copy affordance.
|
|
2737
|
+
*
|
|
2738
|
+
* @param value - Hexadecimal color code
|
|
2739
|
+
* @param options - Optional settings (modifiers).
|
|
2740
|
+
* @returns A strongly-typed `ColourElement` object.
|
|
2741
|
+
*/
|
|
2742
|
+
export function colorSwatch(value, options) {
|
|
2743
|
+
return {
|
|
2744
|
+
type: "color-swatch",
|
|
2745
|
+
value,
|
|
2746
|
+
modifiers: options?.modifiers
|
|
2747
|
+
};
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Creates a `NumberUnboundedElement` component instance.
|
|
2751
|
+
*
|
|
2752
|
+
* @remarks
|
|
2753
|
+
* Plain unbounded numeric value primitive element.
|
|
2754
|
+
*
|
|
2755
|
+
* @param value - Numeric value
|
|
2756
|
+
* @param options - Optional settings (unit, modifiers).
|
|
2757
|
+
* @returns A strongly-typed `NumberUnboundedElement` object.
|
|
2758
|
+
*/
|
|
2759
|
+
export function numberUnbounded(value, options) {
|
|
2760
|
+
return {
|
|
2761
|
+
type: "number-unbounded",
|
|
2762
|
+
value,
|
|
2763
|
+
unit: options?.unit,
|
|
2764
|
+
modifiers: options?.modifiers
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* Creates a `NumberBoundedStarsElement` component instance.
|
|
2769
|
+
*
|
|
2770
|
+
* @remarks
|
|
2771
|
+
* Bounded numeric rating represented as visual stars.
|
|
2772
|
+
*
|
|
2773
|
+
* @param value - Numeric rating score
|
|
2774
|
+
* @param options - Optional settings (maximum, modifiers).
|
|
2775
|
+
* @returns A strongly-typed `NumberBoundedStarsElement` object.
|
|
2776
|
+
*/
|
|
2777
|
+
export function numberBoundedStars(value, options) {
|
|
2778
|
+
return {
|
|
2779
|
+
type: "number-stars",
|
|
2780
|
+
value,
|
|
2781
|
+
maximum: options?.maximum,
|
|
2782
|
+
modifiers: options?.modifiers
|
|
2783
|
+
};
|
|
2784
|
+
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Creates a `NumberBoundedStarsElement` component instance.
|
|
2787
|
+
*
|
|
2788
|
+
* @remarks
|
|
2789
|
+
* Bounded numeric rating represented as visual stars.
|
|
2790
|
+
*
|
|
2791
|
+
* @param value - Numeric rating score
|
|
2792
|
+
* @param options - Optional settings (maximum, modifiers).
|
|
2793
|
+
* @returns A strongly-typed `NumberBoundedStarsElement` object.
|
|
2794
|
+
*/
|
|
2795
|
+
export function numberStars(value, options) {
|
|
2796
|
+
return {
|
|
2797
|
+
type: "number-stars",
|
|
2798
|
+
value,
|
|
2799
|
+
maximum: options?.maximum,
|
|
2800
|
+
modifiers: options?.modifiers
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
/**
|
|
2804
|
+
* Creates a `NumberBoundedMeterElement` component instance.
|
|
2805
|
+
*
|
|
2806
|
+
* @remarks
|
|
2807
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
2808
|
+
*
|
|
2809
|
+
* @param value - Numeric value
|
|
2810
|
+
* @param options - Optional settings (minimum, maximum, label, unit, modifiers).
|
|
2811
|
+
* @returns A strongly-typed `NumberBoundedMeterElement` object.
|
|
2812
|
+
*/
|
|
2813
|
+
export function numberBoundedMeter(value, options) {
|
|
2814
|
+
return {
|
|
2815
|
+
type: "number-meter",
|
|
2816
|
+
value,
|
|
2817
|
+
minimum: options?.minimum,
|
|
2818
|
+
maximum: options?.maximum,
|
|
2819
|
+
label: options?.label,
|
|
2820
|
+
unit: options?.unit,
|
|
2821
|
+
modifiers: options?.modifiers
|
|
2822
|
+
};
|
|
2823
|
+
}
|
|
2824
|
+
/**
|
|
2825
|
+
* Creates a `NumberBoundedMeterElement` component instance.
|
|
2826
|
+
*
|
|
2827
|
+
* @remarks
|
|
2828
|
+
* Bounded numeric meter representation (read-only progress / score bar).
|
|
2829
|
+
*
|
|
2830
|
+
* @param value - Numeric value
|
|
2831
|
+
* @param options - Optional settings (minimum, maximum, label, unit, modifiers).
|
|
2832
|
+
* @returns A strongly-typed `NumberBoundedMeterElement` object.
|
|
2833
|
+
*/
|
|
2834
|
+
export function numberMeter(value, options) {
|
|
2835
|
+
return {
|
|
2836
|
+
type: "number-meter",
|
|
2837
|
+
value,
|
|
2838
|
+
minimum: options?.minimum,
|
|
2839
|
+
maximum: options?.maximum,
|
|
2840
|
+
label: options?.label,
|
|
2841
|
+
unit: options?.unit,
|
|
2842
|
+
modifiers: options?.modifiers
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Creates a `BooleanPlainElement` component instance.
|
|
2847
|
+
*
|
|
2848
|
+
* @remarks
|
|
2849
|
+
* Plain boolean value representation (textual "true" / "false").
|
|
2850
|
+
*
|
|
2851
|
+
* @param value - Boolean state value
|
|
2852
|
+
* @param options - Optional settings (modifiers).
|
|
2853
|
+
* @returns A strongly-typed `BooleanPlainElement` object.
|
|
2854
|
+
*/
|
|
2855
|
+
export function booleanPlain(value, options) {
|
|
2856
|
+
return {
|
|
2857
|
+
type: "boolean-plain",
|
|
2858
|
+
value,
|
|
2859
|
+
modifiers: options?.modifiers
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
/**
|
|
2863
|
+
* Creates a `BooleanBadgeElement` component instance.
|
|
2864
|
+
*
|
|
2865
|
+
* @remarks
|
|
2866
|
+
* Visual badge pill representation of a boolean state.
|
|
2867
|
+
*
|
|
2868
|
+
* @param value - Boolean state value
|
|
2869
|
+
* @param options - Optional settings (trueLabel (defaults to `true`), falseLabel (defaults to `false`), variant (defaults to `neutral`), modifiers).
|
|
2870
|
+
* @returns A strongly-typed `BooleanBadgeElement` object.
|
|
2871
|
+
*/
|
|
2872
|
+
export function booleanBadge(value, options) {
|
|
2873
|
+
return {
|
|
2874
|
+
type: "boolean-badge",
|
|
2875
|
+
value,
|
|
2876
|
+
trueLabel: options?.trueLabel ?? "true",
|
|
2877
|
+
falseLabel: options?.falseLabel ?? "false",
|
|
2878
|
+
variant: options?.variant ?? BadgeVariant.neutral,
|
|
2879
|
+
modifiers: options?.modifiers
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Creates a `TimestampElement` component instance.
|
|
2884
|
+
*
|
|
2885
|
+
* @remarks
|
|
2886
|
+
* Formatted date and time representation.
|
|
2887
|
+
*
|
|
2888
|
+
* @param value - ISO 8601 date string or epoch timestamp in milliseconds
|
|
2889
|
+
* @param options - Optional settings (format (defaults to `full`), modifiers).
|
|
2890
|
+
* @returns A strongly-typed `TimestampElement` object.
|
|
2891
|
+
*/
|
|
2892
|
+
export function timestamp(value, options) {
|
|
2893
|
+
return {
|
|
2894
|
+
type: "timestamp",
|
|
2895
|
+
value,
|
|
2896
|
+
format: options?.format ?? TimestampFormat.full,
|
|
2897
|
+
modifiers: options?.modifiers
|
|
2898
|
+
};
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Creates a `ImageReferenceElement` component instance.
|
|
2902
|
+
*
|
|
2903
|
+
* @remarks
|
|
2904
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
2905
|
+
*
|
|
2906
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
2907
|
+
* @param options - Optional settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
2908
|
+
* @returns A strongly-typed `ImageReferenceElement` object.
|
|
2909
|
+
*/
|
|
2910
|
+
export function imageReference(src, options) {
|
|
2911
|
+
return {
|
|
2912
|
+
type: "image-ref",
|
|
2913
|
+
src,
|
|
2914
|
+
alt: options?.alt,
|
|
2915
|
+
aspectRatio: options?.aspectRatio ?? "1:1",
|
|
2916
|
+
placeholder: options?.placeholder
|
|
2917
|
+
};
|
|
2918
|
+
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Creates a `ImageReferenceElement` component instance.
|
|
2921
|
+
*
|
|
2922
|
+
* @remarks
|
|
2923
|
+
* Thumbnail image reference with placeholder fallback handling.
|
|
2924
|
+
*
|
|
2925
|
+
* @param src - Image source URI (HTTPS URL, base64 data URI, or asset path)
|
|
2926
|
+
* @param options - Optional settings (alt, aspectRatio (defaults to `1:1`), placeholder).
|
|
2927
|
+
* @returns A strongly-typed `ImageReferenceElement` object.
|
|
2928
|
+
*/
|
|
2929
|
+
export function imageRef(src, options) {
|
|
2930
|
+
return {
|
|
2931
|
+
type: "image-ref",
|
|
2932
|
+
src,
|
|
2933
|
+
alt: options?.alt,
|
|
2934
|
+
aspectRatio: options?.aspectRatio ?? "1:1",
|
|
2935
|
+
placeholder: options?.placeholder
|
|
2936
|
+
};
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Creates a `DominantColourSetElement` component instance.
|
|
2940
|
+
*
|
|
2941
|
+
* @remarks
|
|
2942
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
2943
|
+
*
|
|
2944
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
2945
|
+
* @returns A strongly-typed `DominantColourSetElement` object.
|
|
2946
|
+
*/
|
|
2947
|
+
export function dominantColourSet(colors) {
|
|
2948
|
+
return {
|
|
2949
|
+
type: "color-set",
|
|
2950
|
+
colors: [...colors]
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
/**
|
|
2954
|
+
* Creates a `DominantColourSetElement` component instance.
|
|
2955
|
+
*
|
|
2956
|
+
* @remarks
|
|
2957
|
+
* Dominant color set palette rendered in descending dominance order.
|
|
2958
|
+
*
|
|
2959
|
+
* @param colors - List of hexadecimal color strings in descending priority
|
|
2960
|
+
* @returns A strongly-typed `DominantColourSetElement` object.
|
|
2961
|
+
*/
|
|
2962
|
+
export function dominantColors(colors) {
|
|
2963
|
+
return {
|
|
2964
|
+
type: "color-set",
|
|
2965
|
+
colors: [...colors]
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* Creates a `ButtonActionElement` component instance.
|
|
2970
|
+
*
|
|
2971
|
+
* @remarks
|
|
2972
|
+
* Interactive button action triggering an extension command.
|
|
2973
|
+
*
|
|
2974
|
+
* @param commandId - Command identifier to invoke
|
|
2975
|
+
* @param label - Display label for the action
|
|
2976
|
+
* @param options - Optional settings (extensionId, target, parameters, disabled (defaults to `false`), variant (defaults to `secondary`)).
|
|
2977
|
+
* @returns A strongly-typed `ButtonActionElement` object.
|
|
2978
|
+
*/
|
|
2979
|
+
export function buttonAction(commandId, label, options) {
|
|
2980
|
+
return {
|
|
2981
|
+
type: "button",
|
|
2982
|
+
commandId,
|
|
2983
|
+
label,
|
|
2984
|
+
extensionId: options?.extensionId,
|
|
2985
|
+
target: options?.target,
|
|
2986
|
+
parameters: options?.parameters,
|
|
2987
|
+
disabled: options?.disabled ?? false,
|
|
2988
|
+
variant: options?.variant ?? ButtonVariant.secondary
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
/**
|
|
2992
|
+
* Creates a `ExternalLinkActionElement` component instance.
|
|
2993
|
+
*
|
|
2994
|
+
* @remarks
|
|
2995
|
+
* External link action distinct from inline URL text values.
|
|
2996
|
+
*
|
|
2997
|
+
* @param url - Target URL destination
|
|
2998
|
+
* @param label - Display label for the action
|
|
2999
|
+
* @returns A strongly-typed `ExternalLinkActionElement` object.
|
|
3000
|
+
*/
|
|
3001
|
+
export function externalLinkAction(url, label) {
|
|
3002
|
+
return {
|
|
3003
|
+
type: "external-link",
|
|
3004
|
+
url,
|
|
3005
|
+
label
|
|
3006
|
+
};
|
|
3007
|
+
}
|
|
3008
|
+
/**
|
|
3009
|
+
* Creates a `MarkdownBlockElement` component instance.
|
|
3010
|
+
*
|
|
3011
|
+
* @remarks
|
|
3012
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
3013
|
+
*
|
|
3014
|
+
* @param content - Raw Markdown markup content
|
|
3015
|
+
* @param options - Optional settings (modifiers).
|
|
3016
|
+
* @returns A strongly-typed `MarkdownBlockElement` object.
|
|
3017
|
+
*/
|
|
3018
|
+
export function markdownBlock(content, options) {
|
|
3019
|
+
return {
|
|
3020
|
+
type: "markdown",
|
|
3021
|
+
content,
|
|
3022
|
+
modifiers: options?.modifiers
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
/**
|
|
3026
|
+
* Creates a `MarkdownBlockElement` component instance.
|
|
3027
|
+
*
|
|
3028
|
+
* @remarks
|
|
3029
|
+
* Full Markdown fallback block rendered with core typographic hierarchy, spacing, and styling.
|
|
3030
|
+
*
|
|
3031
|
+
* @param content - Raw Markdown markup content
|
|
3032
|
+
* @param options - Optional settings (modifiers).
|
|
3033
|
+
* @returns A strongly-typed `MarkdownBlockElement` object.
|
|
3034
|
+
*/
|
|
3035
|
+
export function markdown(content, options) {
|
|
3036
|
+
return {
|
|
3037
|
+
type: "markdown",
|
|
3038
|
+
content,
|
|
3039
|
+
modifiers: options?.modifiers
|
|
3040
|
+
};
|
|
3041
|
+
}
|
|
3042
|
+
/**
|
|
3043
|
+
* Creates a `HtmlBlockElement` component instance.
|
|
3044
|
+
*
|
|
3045
|
+
* @remarks
|
|
3046
|
+
* Sandboxed HTML rendering escape hatch.
|
|
3047
|
+
*
|
|
3048
|
+
* @param content - Raw HTML markup content
|
|
3049
|
+
* @param options - Optional settings (modifiers).
|
|
3050
|
+
* @returns A strongly-typed `HtmlBlockElement` object.
|
|
3051
|
+
*/
|
|
3052
|
+
export function htmlBlock(content, options) {
|
|
3053
|
+
return {
|
|
3054
|
+
type: "html",
|
|
3055
|
+
content,
|
|
3056
|
+
modifiers: options?.modifiers
|
|
3057
|
+
};
|
|
3058
|
+
}
|
|
3059
|
+
/**
|
|
3060
|
+
* Creates a `HtmlBlockElement` component instance.
|
|
3061
|
+
*
|
|
3062
|
+
* @remarks
|
|
3063
|
+
* Sandboxed HTML rendering escape hatch.
|
|
3064
|
+
*
|
|
3065
|
+
* @param content - Raw HTML markup content
|
|
3066
|
+
* @param options - Optional settings (modifiers).
|
|
3067
|
+
* @returns A strongly-typed `HtmlBlockElement` object.
|
|
3068
|
+
*/
|
|
3069
|
+
export function html(content, options) {
|
|
3070
|
+
return {
|
|
3071
|
+
type: "html",
|
|
3072
|
+
content,
|
|
3073
|
+
modifiers: options?.modifiers
|
|
3074
|
+
};
|
|
3075
|
+
}
|
|
3076
|
+
/**
|
|
3077
|
+
* Creates a `Slot` component instance.
|
|
3078
|
+
*
|
|
3079
|
+
* @remarks
|
|
3080
|
+
* Single slot within a multi-slot horizontal row layout.
|
|
3081
|
+
*
|
|
3082
|
+
* @param content - Rendered content inside the slot
|
|
3083
|
+
* @param options - Optional settings (label, width).
|
|
3084
|
+
* @returns A strongly-typed `Slot` object.
|
|
3085
|
+
*/
|
|
3086
|
+
export function slot(content, options) {
|
|
3087
|
+
return {
|
|
3088
|
+
content,
|
|
3089
|
+
label: options?.label,
|
|
3090
|
+
width: options?.width
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Creates a `MultiSlotRowElement` component instance.
|
|
3095
|
+
*
|
|
3096
|
+
* @remarks
|
|
3097
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
3098
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
3099
|
+
*
|
|
3100
|
+
* @param slots - List of slots comprising the row
|
|
3101
|
+
* @param options - Optional settings (proportions).
|
|
3102
|
+
* @returns A strongly-typed `MultiSlotRowElement` object.
|
|
3103
|
+
*/
|
|
3104
|
+
export function multiSlotRow(slots, options) {
|
|
3105
|
+
return {
|
|
3106
|
+
type: "multi-slot",
|
|
3107
|
+
slots: [...slots],
|
|
3108
|
+
proportions: options?.proportions
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
/**
|
|
3112
|
+
* Creates a `MultiSlotRowElement` component instance.
|
|
3113
|
+
*
|
|
3114
|
+
* @remarks
|
|
3115
|
+
* Multi-slot horizontal row with declared column width proportions.
|
|
3116
|
+
* Examples: "1/3 + 2/3", "equal thirds", "1/4 + 3/4".
|
|
3117
|
+
*
|
|
3118
|
+
* @param slots - List of slots comprising the row
|
|
3119
|
+
* @param options - Optional settings (proportions).
|
|
3120
|
+
* @returns A strongly-typed `MultiSlotRowElement` object.
|
|
3121
|
+
*/
|
|
3122
|
+
export function multiSlot(slots, options) {
|
|
3123
|
+
return {
|
|
3124
|
+
type: "multi-slot",
|
|
3125
|
+
slots: [...slots],
|
|
3126
|
+
proportions: options?.proportions
|
|
3127
|
+
};
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Creates a `LabelValueRowElement` component instance.
|
|
3131
|
+
*
|
|
3132
|
+
* @remarks
|
|
3133
|
+
* Standard label and value row.
|
|
3134
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
3135
|
+
*
|
|
3136
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
3137
|
+
* @param value - Rendered value element on the right
|
|
3138
|
+
* @param options - Optional settings (withDivider (defaults to `false`)).
|
|
3139
|
+
* @returns A strongly-typed `LabelValueRowElement` object.
|
|
3140
|
+
*/
|
|
3141
|
+
export function labelValueRow(label, value, options) {
|
|
3142
|
+
return {
|
|
3143
|
+
type: "label-value",
|
|
3144
|
+
label,
|
|
3145
|
+
value,
|
|
3146
|
+
withDivider: options?.withDivider ?? false
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
/**
|
|
3150
|
+
* Creates a `LabelValueRowElement` component instance.
|
|
3151
|
+
*
|
|
3152
|
+
* @remarks
|
|
3153
|
+
* Standard label and value row.
|
|
3154
|
+
* Displays a muted label on the left and value representation on the right with a vertical dividing line.
|
|
3155
|
+
*
|
|
3156
|
+
* @param label - Key or descriptive label displayed muted on the left
|
|
3157
|
+
* @param value - Rendered value element on the right
|
|
3158
|
+
* @param options - Optional settings (withDivider (defaults to `false`)).
|
|
3159
|
+
* @returns A strongly-typed `LabelValueRowElement` object.
|
|
3160
|
+
*/
|
|
3161
|
+
export function labelValue(label, value, options) {
|
|
3162
|
+
return {
|
|
3163
|
+
type: "label-value",
|
|
3164
|
+
label,
|
|
3165
|
+
value,
|
|
3166
|
+
withDivider: options?.withDivider ?? false
|
|
3167
|
+
};
|
|
3168
|
+
}
|
|
3169
|
+
/**
|
|
3170
|
+
* Creates a `TableColumn` component instance.
|
|
3171
|
+
*
|
|
3172
|
+
* @remarks
|
|
3173
|
+
* Column definition for structured tables.
|
|
3174
|
+
*
|
|
3175
|
+
* @param options - Optional settings (header, align (defaults to `left`), width).
|
|
3176
|
+
* @returns A strongly-typed `TableColumn` object.
|
|
3177
|
+
*/
|
|
3178
|
+
export function tableColumn(options) {
|
|
3179
|
+
return {
|
|
3180
|
+
header: options?.header,
|
|
3181
|
+
align: options?.align ?? TableColumnAlign.left,
|
|
3182
|
+
width: options?.width
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Creates a `TableRow` component instance.
|
|
3187
|
+
*
|
|
3188
|
+
* @remarks
|
|
3189
|
+
* Single table row containing an array of cell values.
|
|
3190
|
+
*
|
|
3191
|
+
* @param cells - Array of cell values corresponding to table columns
|
|
3192
|
+
* @returns A strongly-typed `TableRow` object.
|
|
3193
|
+
*/
|
|
3194
|
+
export function tableRow(cells) {
|
|
3195
|
+
return {
|
|
3196
|
+
cells: [...cells]
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Creates a `TableElement` component instance.
|
|
3201
|
+
*
|
|
3202
|
+
* @remarks
|
|
3203
|
+
* Structured tabular data representation.
|
|
3204
|
+
* Supports header/borderless modes, 2-column key-value tables, and 3-column data tables.
|
|
3205
|
+
*
|
|
3206
|
+
* @param rows - Tabular data rows
|
|
3207
|
+
* @param options - Optional settings (hasHeader (defaults to `true`), isStriped (defaults to `false`), withColumnSeparators (defaults to `false`), withRowSeparators (defaults to `false`), columns).
|
|
3208
|
+
* @returns A strongly-typed `TableElement` object.
|
|
3209
|
+
*/
|
|
3210
|
+
export function table(rows, options) {
|
|
3211
|
+
return {
|
|
3212
|
+
type: "table",
|
|
3213
|
+
rows: [...rows],
|
|
3214
|
+
hasHeader: options?.hasHeader ?? true,
|
|
3215
|
+
isStriped: options?.isStriped ?? false,
|
|
3216
|
+
withColumnSeparators: options?.withColumnSeparators ?? false,
|
|
3217
|
+
withRowSeparators: options?.withRowSeparators ?? false,
|
|
3218
|
+
columns: options?.columns ? [...options.columns] : undefined
|
|
3219
|
+
};
|
|
3220
|
+
}
|
|
3221
|
+
/**
|
|
3222
|
+
* Creates a `RepeatingGroupEntry` component instance.
|
|
3223
|
+
*
|
|
3224
|
+
* @remarks
|
|
3225
|
+
* Single entry within a repeating group.
|
|
3226
|
+
*
|
|
3227
|
+
* @param label - Entry label
|
|
3228
|
+
* @param options - Optional settings (value, elements).
|
|
3229
|
+
* @returns A strongly-typed `RepeatingGroupEntry` object.
|
|
3230
|
+
*/
|
|
3231
|
+
export function repeatingGroupEntry(label, options) {
|
|
3232
|
+
return {
|
|
3233
|
+
label,
|
|
3234
|
+
value: options?.value,
|
|
3235
|
+
elements: options?.elements ? [...options.elements] : undefined
|
|
3236
|
+
};
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Creates a `RepeatingGroupElement` component instance.
|
|
3240
|
+
*
|
|
3241
|
+
* @remarks
|
|
3242
|
+
* Repeating group container where entries share uniform structure and retain per-entry labels.
|
|
3243
|
+
*
|
|
3244
|
+
* @param entries - List of repeated entry records
|
|
3245
|
+
* @param options - Optional settings (title).
|
|
3246
|
+
* @returns A strongly-typed `RepeatingGroupElement` object.
|
|
3247
|
+
*/
|
|
3248
|
+
export function repeatingGroup(entries, options) {
|
|
3249
|
+
return {
|
|
3250
|
+
type: "repeating-group",
|
|
3251
|
+
entries: [...entries],
|
|
3252
|
+
title: options?.title
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* Creates a `CollapsibleGroupElement` component instance.
|
|
3257
|
+
*
|
|
3258
|
+
* @remarks
|
|
3259
|
+
* Collapsible disclosure container (accordion) with summary badge.
|
|
3260
|
+
*
|
|
3261
|
+
* @param title - Group title (e.g. "Show specimen details")
|
|
3262
|
+
* @param elements - Nested content elements revealed when expanded
|
|
3263
|
+
* @param options - Optional settings (summary, defaultExpanded (defaults to `false`)).
|
|
3264
|
+
* @returns A strongly-typed `CollapsibleGroupElement` object.
|
|
3265
|
+
*/
|
|
3266
|
+
export function collapsibleGroup(title, elements, options) {
|
|
3267
|
+
return {
|
|
3268
|
+
type: "collapsible-group",
|
|
3269
|
+
title,
|
|
3270
|
+
elements: [...elements],
|
|
3271
|
+
summary: options?.summary,
|
|
3272
|
+
defaultExpanded: options?.defaultExpanded ?? false
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* Creates a `DividerElement` component instance.
|
|
3277
|
+
*
|
|
3278
|
+
* @remarks
|
|
3279
|
+
* Visual hairline separator separating sections or element groups.
|
|
3280
|
+
*
|
|
3281
|
+
* @param options - Optional settings (style (defaults to `hairline`)).
|
|
3282
|
+
* @returns A strongly-typed `DividerElement` object.
|
|
3283
|
+
*/
|
|
3284
|
+
export function divider(options) {
|
|
3285
|
+
return {
|
|
3286
|
+
type: "divider",
|
|
3287
|
+
style: options?.style ?? DividerStyle.hairline
|
|
3288
|
+
};
|
|
3289
|
+
}
|
|
3290
|
+
/**
|
|
3291
|
+
* Creates a `Envelop` component instance.
|
|
3292
|
+
*
|
|
3293
|
+
* @remarks
|
|
3294
|
+
* Base envelope container model holding the schema version attribute.
|
|
3295
|
+
*
|
|
3296
|
+
* @param options - Optional settings (schemaVersion (defaults to `1.0`)).
|
|
3297
|
+
* @returns A strongly-typed `Envelop` object.
|
|
3298
|
+
*/
|
|
3299
|
+
export function envelop(options) {
|
|
3300
|
+
return {
|
|
3301
|
+
schemaVersion: options?.schemaVersion ?? "1.0"
|
|
3302
|
+
};
|
|
3303
|
+
}
|
|
3304
|
+
// --- Type Guards ---
|
|
3305
|
+
/**
|
|
3306
|
+
* Type guard predicate verifying whether an unknown value conforms to `TruncateOptions`.
|
|
3307
|
+
*
|
|
3308
|
+
* @param value - The value to inspect.
|
|
3309
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3310
|
+
* @returns `true` if the value conforms to `TruncateOptions`, otherwise `false`.
|
|
3311
|
+
*/
|
|
3312
|
+
export function isTruncateOptions(value, withDeepValidation = false) {
|
|
3313
|
+
if (typeof value !== "object" || value === null) {
|
|
3314
|
+
return false;
|
|
3315
|
+
}
|
|
3316
|
+
if (!withDeepValidation) {
|
|
3317
|
+
return true;
|
|
3318
|
+
}
|
|
3319
|
+
const element = value;
|
|
3320
|
+
return ("characterLimit" in value && typeof element.characterLimit === "number") &&
|
|
3321
|
+
(element.showMore === undefined || typeof element.showMore === "boolean");
|
|
3322
|
+
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Type guard predicate verifying whether an unknown value conforms to `BaseModifiers`.
|
|
3325
|
+
*
|
|
3326
|
+
* @param value - The value to inspect.
|
|
3327
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3328
|
+
* @returns `true` if the value conforms to `BaseModifiers`, otherwise `false`.
|
|
3329
|
+
*/
|
|
3330
|
+
export function isBaseModifiers(value, withDeepValidation = false) {
|
|
3331
|
+
if (typeof value !== "object" || value === null) {
|
|
3332
|
+
return false;
|
|
3333
|
+
}
|
|
3334
|
+
if (!withDeepValidation) {
|
|
3335
|
+
return true;
|
|
3336
|
+
}
|
|
3337
|
+
const element = value;
|
|
3338
|
+
return (element.copyable === undefined || typeof element.copyable === "boolean");
|
|
3339
|
+
}
|
|
3340
|
+
/**
|
|
3341
|
+
* Type guard predicate verifying whether an unknown value conforms to `PrimitiveModifiers`.
|
|
3342
|
+
*
|
|
3343
|
+
* @param value - The value to inspect.
|
|
3344
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3345
|
+
* @returns `true` if the value conforms to `PrimitiveModifiers`, otherwise `false`.
|
|
3346
|
+
*/
|
|
3347
|
+
export function isPrimitiveModifiers(value, withDeepValidation = false) {
|
|
3348
|
+
if (typeof value !== "object" || value === null) {
|
|
3349
|
+
return false;
|
|
3350
|
+
}
|
|
3351
|
+
if (!withDeepValidation) {
|
|
3352
|
+
return true;
|
|
3353
|
+
}
|
|
3354
|
+
const element = value;
|
|
3355
|
+
return (element.truncate === undefined || isTruncateOptions(element.truncate, true)) &&
|
|
3356
|
+
(element.weight === undefined || Object.values(TextWeight).includes(element.weight)) &&
|
|
3357
|
+
(element.intensity === undefined || Object.values(TextIntensity).includes(element.intensity)) &&
|
|
3358
|
+
(element.monospace === undefined || typeof element.monospace === "boolean") &&
|
|
3359
|
+
(element.copyable === undefined || typeof element.copyable === "boolean");
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* Type guard predicate verifying whether an unknown value conforms to `Slot`.
|
|
3363
|
+
*
|
|
3364
|
+
* @param value - The value to inspect.
|
|
3365
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3366
|
+
* @returns `true` if the value conforms to `Slot`, otherwise `false`.
|
|
3367
|
+
*/
|
|
3368
|
+
export function isSlot(value, withDeepValidation = false) {
|
|
3369
|
+
if (typeof value !== "object" || value === null) {
|
|
3370
|
+
return false;
|
|
3371
|
+
}
|
|
3372
|
+
if (!withDeepValidation) {
|
|
3373
|
+
return true;
|
|
3374
|
+
}
|
|
3375
|
+
const element = value;
|
|
3376
|
+
return (element.label === undefined || typeof element.label === "string") &&
|
|
3377
|
+
(element.width === undefined || typeof element.width === "string") &&
|
|
3378
|
+
("content" in value && isUiElement(element.content, true));
|
|
3379
|
+
}
|
|
3380
|
+
/**
|
|
3381
|
+
* Type guard predicate verifying whether an unknown value conforms to `TableColumn`.
|
|
3382
|
+
*
|
|
3383
|
+
* @param value - The value to inspect.
|
|
3384
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3385
|
+
* @returns `true` if the value conforms to `TableColumn`, otherwise `false`.
|
|
3386
|
+
*/
|
|
3387
|
+
export function isTableColumn(value, withDeepValidation = false) {
|
|
3388
|
+
if (typeof value !== "object" || value === null) {
|
|
3389
|
+
return false;
|
|
3390
|
+
}
|
|
3391
|
+
if (!withDeepValidation) {
|
|
3392
|
+
return true;
|
|
3393
|
+
}
|
|
3394
|
+
const element = value;
|
|
3395
|
+
return (element.header === undefined || typeof element.header === "string") &&
|
|
3396
|
+
(element.align === undefined || Object.values(TableColumnAlign).includes(element.align)) &&
|
|
3397
|
+
(element.width === undefined || typeof element.width === "string");
|
|
3398
|
+
}
|
|
3399
|
+
/**
|
|
3400
|
+
* Type guard predicate verifying whether an unknown value conforms to `TableRow`.
|
|
3401
|
+
*
|
|
3402
|
+
* @param value - The value to inspect.
|
|
3403
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3404
|
+
* @returns `true` if the value conforms to `TableRow`, otherwise `false`.
|
|
3405
|
+
*/
|
|
3406
|
+
export function isTableRow(value, withDeepValidation = false) {
|
|
3407
|
+
if (typeof value !== "object" || value === null) {
|
|
3408
|
+
return false;
|
|
3409
|
+
}
|
|
3410
|
+
if (!withDeepValidation) {
|
|
3411
|
+
return true;
|
|
3412
|
+
}
|
|
3413
|
+
const element = value;
|
|
3414
|
+
return ("cells" in value && (Array.isArray(element.cells) && element.cells.every((item) => isUiElement(item, true))));
|
|
3415
|
+
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Type guard predicate verifying whether an unknown value conforms to `RepeatingGroupEntry`.
|
|
3418
|
+
*
|
|
3419
|
+
* @param value - The value to inspect.
|
|
3420
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3421
|
+
* @returns `true` if the value conforms to `RepeatingGroupEntry`, otherwise `false`.
|
|
3422
|
+
*/
|
|
3423
|
+
export function isRepeatingGroupEntry(value, withDeepValidation = false) {
|
|
3424
|
+
if (typeof value !== "object" || value === null) {
|
|
3425
|
+
return false;
|
|
3426
|
+
}
|
|
3427
|
+
if (!withDeepValidation) {
|
|
3428
|
+
return true;
|
|
3429
|
+
}
|
|
3430
|
+
const element = value;
|
|
3431
|
+
return ("label" in value && typeof element.label === "string") &&
|
|
3432
|
+
(element.value === undefined || isUiElement(element.value, true)) &&
|
|
3433
|
+
(element.elements === undefined || (Array.isArray(element.elements) && element.elements.every((item) => isUiElement(item, true))));
|
|
3434
|
+
}
|
|
3435
|
+
/**
|
|
3436
|
+
* Type guard predicate verifying whether an unknown value conforms to `Envelop`.
|
|
3437
|
+
*
|
|
3438
|
+
* @param value - The value to inspect.
|
|
3439
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3440
|
+
* @returns `true` if the value conforms to `Envelop`, otherwise `false`.
|
|
3441
|
+
*/
|
|
3442
|
+
export function isEnvelop(value, withDeepValidation = false) {
|
|
3443
|
+
if (typeof value !== "object" || value === null) {
|
|
3444
|
+
return false;
|
|
3445
|
+
}
|
|
3446
|
+
if (!withDeepValidation) {
|
|
3447
|
+
return true;
|
|
3448
|
+
}
|
|
3449
|
+
const element = value;
|
|
3450
|
+
return true;
|
|
3451
|
+
}
|
|
3452
|
+
/**
|
|
3453
|
+
* Type guard predicate verifying whether an unknown value conforms to `UiElement`.
|
|
3454
|
+
*
|
|
3455
|
+
* @param value - The value to inspect.
|
|
3456
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3457
|
+
* @returns `true` if the value is a valid `UiElement`, otherwise `false`.
|
|
3458
|
+
*/
|
|
3459
|
+
export function isUiElement(value, withDeepValidation = false) {
|
|
3460
|
+
if (typeof value !== "object" || value === null || !("type" in value) || typeof value.type !== "string") {
|
|
3461
|
+
return false;
|
|
3462
|
+
}
|
|
3463
|
+
if (!withDeepValidation) {
|
|
3464
|
+
return true;
|
|
3465
|
+
}
|
|
3466
|
+
const element = value;
|
|
3467
|
+
switch (element.type) {
|
|
3468
|
+
case "string-short":
|
|
3469
|
+
return isStringShortElement(element, true);
|
|
3470
|
+
case "string-long":
|
|
3471
|
+
return isStringLongElement(element, true);
|
|
3472
|
+
case "string-code":
|
|
3473
|
+
return isStringCodeElement(element, true);
|
|
3474
|
+
case "xml":
|
|
3475
|
+
return isXmlElement(element, true);
|
|
3476
|
+
case "json":
|
|
3477
|
+
return isJsonElement(element, true);
|
|
3478
|
+
case "string-url":
|
|
3479
|
+
return isStringUrlElement(element, true);
|
|
3480
|
+
case "identifier":
|
|
3481
|
+
return isIdentifierElement(element, true);
|
|
3482
|
+
case "ratio":
|
|
3483
|
+
return isRatioElement(element, true);
|
|
3484
|
+
case "color-swatch":
|
|
3485
|
+
return isColourElement(element, true);
|
|
3486
|
+
case "number-unbounded":
|
|
3487
|
+
return isNumberUnboundedElement(element, true);
|
|
3488
|
+
case "number-stars":
|
|
3489
|
+
return isNumberBoundedStarsElement(element, true);
|
|
3490
|
+
case "number-meter":
|
|
3491
|
+
return isNumberBoundedMeterElement(element, true);
|
|
3492
|
+
case "boolean-plain":
|
|
3493
|
+
return isBooleanPlainElement(element, true);
|
|
3494
|
+
case "boolean-badge":
|
|
3495
|
+
return isBooleanBadgeElement(element, true);
|
|
3496
|
+
case "timestamp":
|
|
3497
|
+
return isTimestampElement(element, true);
|
|
3498
|
+
case "image-ref":
|
|
3499
|
+
return isImageReferenceElement(element, true);
|
|
3500
|
+
case "color-set":
|
|
3501
|
+
return isDominantColourSetElement(element, true);
|
|
3502
|
+
case "markdown":
|
|
3503
|
+
return isMarkdownBlockElement(element, true);
|
|
3504
|
+
case "html":
|
|
3505
|
+
return isHtmlBlockElement(element, true);
|
|
3506
|
+
case "multi-slot":
|
|
3507
|
+
return isMultiSlotRowElement(element, true);
|
|
3508
|
+
case "label-value":
|
|
3509
|
+
return isLabelValueRowElement(element, true);
|
|
3510
|
+
case "table":
|
|
3511
|
+
return isTableElement(element, true);
|
|
3512
|
+
case "repeating-group":
|
|
3513
|
+
return isRepeatingGroupElement(element, true);
|
|
3514
|
+
case "collapsible-group":
|
|
3515
|
+
return isCollapsibleGroupElement(element, true);
|
|
3516
|
+
case "divider":
|
|
3517
|
+
return isDividerElement(element, true);
|
|
3518
|
+
default:
|
|
3519
|
+
return false;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
/**
|
|
3523
|
+
* Type guard predicate narrowing a value to `StringShortElement`.
|
|
3524
|
+
*
|
|
3525
|
+
* @param value - The value to inspect.
|
|
3526
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3527
|
+
* @returns `true` if the value is a `StringShortElement` (type = "string-short"), otherwise `false`.
|
|
3528
|
+
*/
|
|
3529
|
+
export function isStringShortElement(value, withDeepValidation = false) {
|
|
3530
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "string-short") {
|
|
3531
|
+
return false;
|
|
3532
|
+
}
|
|
3533
|
+
if (!withDeepValidation) {
|
|
3534
|
+
return true;
|
|
3535
|
+
}
|
|
3536
|
+
const element = value;
|
|
3537
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3538
|
+
(element.representation === undefined || Object.values(StringShortRepresentation).includes(element.representation)) &&
|
|
3539
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* Type guard predicate narrowing a value to `StringLongElement`.
|
|
3543
|
+
*
|
|
3544
|
+
* @param value - The value to inspect.
|
|
3545
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3546
|
+
* @returns `true` if the value is a `StringLongElement` (type = "string-long"), otherwise `false`.
|
|
3547
|
+
*/
|
|
3548
|
+
export function isStringLongElement(value, withDeepValidation = false) {
|
|
3549
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "string-long") {
|
|
3550
|
+
return false;
|
|
3551
|
+
}
|
|
3552
|
+
if (!withDeepValidation) {
|
|
3553
|
+
return true;
|
|
3554
|
+
}
|
|
3555
|
+
const element = value;
|
|
3556
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3557
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3558
|
+
}
|
|
3559
|
+
/**
|
|
3560
|
+
* Type guard predicate narrowing a value to `StringCodeElement`.
|
|
3561
|
+
*
|
|
3562
|
+
* @param value - The value to inspect.
|
|
3563
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3564
|
+
* @returns `true` if the value is a `StringCodeElement` (type = "string-code"), otherwise `false`.
|
|
3565
|
+
*/
|
|
3566
|
+
export function isStringCodeElement(value, withDeepValidation = false) {
|
|
3567
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "string-code") {
|
|
3568
|
+
return false;
|
|
3569
|
+
}
|
|
3570
|
+
if (!withDeepValidation) {
|
|
3571
|
+
return true;
|
|
3572
|
+
}
|
|
3573
|
+
const element = value;
|
|
3574
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3575
|
+
(element.language === undefined || Object.values(CodeLanguage).includes(element.language)) &&
|
|
3576
|
+
(element.modifiers === undefined || isBaseModifiers(element.modifiers, true));
|
|
3577
|
+
}
|
|
3578
|
+
/**
|
|
3579
|
+
* Type guard predicate narrowing a value to `XmlElement`.
|
|
3580
|
+
*
|
|
3581
|
+
* @param value - The value to inspect.
|
|
3582
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3583
|
+
* @returns `true` if the value is a `XmlElement` (type = "xml"), otherwise `false`.
|
|
3584
|
+
*/
|
|
3585
|
+
export function isXmlElement(value, withDeepValidation = false) {
|
|
3586
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "xml") {
|
|
3587
|
+
return false;
|
|
3588
|
+
}
|
|
3589
|
+
if (!withDeepValidation) {
|
|
3590
|
+
return true;
|
|
3591
|
+
}
|
|
3592
|
+
const element = value;
|
|
3593
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3594
|
+
(element.modifiers === undefined || isBaseModifiers(element.modifiers, true));
|
|
3595
|
+
}
|
|
3596
|
+
/**
|
|
3597
|
+
* Type guard predicate narrowing a value to `JsonElement`.
|
|
3598
|
+
*
|
|
3599
|
+
* @param value - The value to inspect.
|
|
3600
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3601
|
+
* @returns `true` if the value is a `JsonElement` (type = "json"), otherwise `false`.
|
|
3602
|
+
*/
|
|
3603
|
+
export function isJsonElement(value, withDeepValidation = false) {
|
|
3604
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "json") {
|
|
3605
|
+
return false;
|
|
3606
|
+
}
|
|
3607
|
+
if (!withDeepValidation) {
|
|
3608
|
+
return true;
|
|
3609
|
+
}
|
|
3610
|
+
const element = value;
|
|
3611
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3612
|
+
(element.modifiers === undefined || isBaseModifiers(element.modifiers, true));
|
|
3613
|
+
}
|
|
3614
|
+
/**
|
|
3615
|
+
* Type guard predicate narrowing a value to `StringUrlElement`.
|
|
3616
|
+
*
|
|
3617
|
+
* @param value - The value to inspect.
|
|
3618
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3619
|
+
* @returns `true` if the value is a `StringUrlElement` (type = "string-url"), otherwise `false`.
|
|
3620
|
+
*/
|
|
3621
|
+
export function isStringUrlElement(value, withDeepValidation = false) {
|
|
3622
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "string-url") {
|
|
3623
|
+
return false;
|
|
3624
|
+
}
|
|
3625
|
+
if (!withDeepValidation) {
|
|
3626
|
+
return true;
|
|
3627
|
+
}
|
|
3628
|
+
const element = value;
|
|
3629
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3630
|
+
(element.label === undefined || typeof element.label === "string") &&
|
|
3631
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3632
|
+
}
|
|
3633
|
+
/**
|
|
3634
|
+
* Type guard predicate narrowing a value to `IdentifierElement`.
|
|
3635
|
+
*
|
|
3636
|
+
* @param value - The value to inspect.
|
|
3637
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3638
|
+
* @returns `true` if the value is a `IdentifierElement` (type = "identifier"), otherwise `false`.
|
|
3639
|
+
*/
|
|
3640
|
+
export function isIdentifierElement(value, withDeepValidation = false) {
|
|
3641
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "identifier") {
|
|
3642
|
+
return false;
|
|
3643
|
+
}
|
|
3644
|
+
if (!withDeepValidation) {
|
|
3645
|
+
return true;
|
|
3646
|
+
}
|
|
3647
|
+
const element = value;
|
|
3648
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3649
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3650
|
+
}
|
|
3651
|
+
/**
|
|
3652
|
+
* Type guard predicate narrowing a value to `RatioElement`.
|
|
3653
|
+
*
|
|
3654
|
+
* @param value - The value to inspect.
|
|
3655
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3656
|
+
* @returns `true` if the value is a `RatioElement` (type = "ratio"), otherwise `false`.
|
|
3657
|
+
*/
|
|
3658
|
+
export function isRatioElement(value, withDeepValidation = false) {
|
|
3659
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "ratio") {
|
|
3660
|
+
return false;
|
|
3661
|
+
}
|
|
3662
|
+
if (!withDeepValidation) {
|
|
3663
|
+
return true;
|
|
3664
|
+
}
|
|
3665
|
+
const element = value;
|
|
3666
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3667
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3668
|
+
}
|
|
3669
|
+
/**
|
|
3670
|
+
* Type guard predicate narrowing a value to `ColourElement`.
|
|
3671
|
+
*
|
|
3672
|
+
* @param value - The value to inspect.
|
|
3673
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3674
|
+
* @returns `true` if the value is a `ColourElement` (type = "color-swatch"), otherwise `false`.
|
|
3675
|
+
*/
|
|
3676
|
+
export function isColourElement(value, withDeepValidation = false) {
|
|
3677
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "color-swatch") {
|
|
3678
|
+
return false;
|
|
3679
|
+
}
|
|
3680
|
+
if (!withDeepValidation) {
|
|
3681
|
+
return true;
|
|
3682
|
+
}
|
|
3683
|
+
const element = value;
|
|
3684
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3685
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3686
|
+
}
|
|
3687
|
+
/**
|
|
3688
|
+
* Type guard predicate narrowing a value to `NumberUnboundedElement`.
|
|
3689
|
+
*
|
|
3690
|
+
* @param value - The value to inspect.
|
|
3691
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3692
|
+
* @returns `true` if the value is a `NumberUnboundedElement` (type = "number-unbounded"), otherwise `false`.
|
|
3693
|
+
*/
|
|
3694
|
+
export function isNumberUnboundedElement(value, withDeepValidation = false) {
|
|
3695
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "number-unbounded") {
|
|
3696
|
+
return false;
|
|
3697
|
+
}
|
|
3698
|
+
if (!withDeepValidation) {
|
|
3699
|
+
return true;
|
|
3700
|
+
}
|
|
3701
|
+
const element = value;
|
|
3702
|
+
return ("value" in value && typeof element.value === "number") &&
|
|
3703
|
+
(element.unit === undefined || typeof element.unit === "string") &&
|
|
3704
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3705
|
+
}
|
|
3706
|
+
/**
|
|
3707
|
+
* Type guard predicate narrowing a value to `NumberBoundedStarsElement`.
|
|
3708
|
+
*
|
|
3709
|
+
* @param value - The value to inspect.
|
|
3710
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3711
|
+
* @returns `true` if the value is a `NumberBoundedStarsElement` (type = "number-stars"), otherwise `false`.
|
|
3712
|
+
*/
|
|
3713
|
+
export function isNumberBoundedStarsElement(value, withDeepValidation = false) {
|
|
3714
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "number-stars") {
|
|
3715
|
+
return false;
|
|
3716
|
+
}
|
|
3717
|
+
if (!withDeepValidation) {
|
|
3718
|
+
return true;
|
|
3719
|
+
}
|
|
3720
|
+
const element = value;
|
|
3721
|
+
return ("value" in value && typeof element.value === "number") &&
|
|
3722
|
+
(element.maximum === undefined || typeof element.maximum === "number") &&
|
|
3723
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3724
|
+
}
|
|
3725
|
+
/**
|
|
3726
|
+
* Type guard predicate narrowing a value to `NumberBoundedMeterElement`.
|
|
3727
|
+
*
|
|
3728
|
+
* @param value - The value to inspect.
|
|
3729
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3730
|
+
* @returns `true` if the value is a `NumberBoundedMeterElement` (type = "number-meter"), otherwise `false`.
|
|
3731
|
+
*/
|
|
3732
|
+
export function isNumberBoundedMeterElement(value, withDeepValidation = false) {
|
|
3733
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "number-meter") {
|
|
3734
|
+
return false;
|
|
3735
|
+
}
|
|
3736
|
+
if (!withDeepValidation) {
|
|
3737
|
+
return true;
|
|
3738
|
+
}
|
|
3739
|
+
const element = value;
|
|
3740
|
+
return ("value" in value && typeof element.value === "number") &&
|
|
3741
|
+
(element.minimum === undefined || typeof element.minimum === "number") &&
|
|
3742
|
+
(element.maximum === undefined || typeof element.maximum === "number") &&
|
|
3743
|
+
(element.label === undefined || typeof element.label === "string") &&
|
|
3744
|
+
(element.unit === undefined || typeof element.unit === "string") &&
|
|
3745
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3746
|
+
}
|
|
3747
|
+
/**
|
|
3748
|
+
* Type guard predicate narrowing a value to `BooleanPlainElement`.
|
|
3749
|
+
*
|
|
3750
|
+
* @param value - The value to inspect.
|
|
3751
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3752
|
+
* @returns `true` if the value is a `BooleanPlainElement` (type = "boolean-plain"), otherwise `false`.
|
|
3753
|
+
*/
|
|
3754
|
+
export function isBooleanPlainElement(value, withDeepValidation = false) {
|
|
3755
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "boolean-plain") {
|
|
3756
|
+
return false;
|
|
3757
|
+
}
|
|
3758
|
+
if (!withDeepValidation) {
|
|
3759
|
+
return true;
|
|
3760
|
+
}
|
|
3761
|
+
const element = value;
|
|
3762
|
+
return ("value" in value && typeof element.value === "boolean") &&
|
|
3763
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3764
|
+
}
|
|
3765
|
+
/**
|
|
3766
|
+
* Type guard predicate narrowing a value to `BooleanBadgeElement`.
|
|
3767
|
+
*
|
|
3768
|
+
* @param value - The value to inspect.
|
|
3769
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3770
|
+
* @returns `true` if the value is a `BooleanBadgeElement` (type = "boolean-badge"), otherwise `false`.
|
|
3771
|
+
*/
|
|
3772
|
+
export function isBooleanBadgeElement(value, withDeepValidation = false) {
|
|
3773
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "boolean-badge") {
|
|
3774
|
+
return false;
|
|
3775
|
+
}
|
|
3776
|
+
if (!withDeepValidation) {
|
|
3777
|
+
return true;
|
|
3778
|
+
}
|
|
3779
|
+
const element = value;
|
|
3780
|
+
return ("value" in value && typeof element.value === "boolean") &&
|
|
3781
|
+
(element.trueLabel === undefined || typeof element.trueLabel === "string") &&
|
|
3782
|
+
(element.falseLabel === undefined || typeof element.falseLabel === "string") &&
|
|
3783
|
+
(element.variant === undefined || Object.values(BadgeVariant).includes(element.variant)) &&
|
|
3784
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3785
|
+
}
|
|
3786
|
+
/**
|
|
3787
|
+
* Type guard predicate narrowing a value to `TimestampElement`.
|
|
3788
|
+
*
|
|
3789
|
+
* @param value - The value to inspect.
|
|
3790
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3791
|
+
* @returns `true` if the value is a `TimestampElement` (type = "timestamp"), otherwise `false`.
|
|
3792
|
+
*/
|
|
3793
|
+
export function isTimestampElement(value, withDeepValidation = false) {
|
|
3794
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "timestamp") {
|
|
3795
|
+
return false;
|
|
3796
|
+
}
|
|
3797
|
+
if (!withDeepValidation) {
|
|
3798
|
+
return true;
|
|
3799
|
+
}
|
|
3800
|
+
const element = value;
|
|
3801
|
+
return ("value" in value && typeof element.value === "string") &&
|
|
3802
|
+
(element.format === undefined || Object.values(TimestampFormat).includes(element.format)) &&
|
|
3803
|
+
(element.modifiers === undefined || isPrimitiveModifiers(element.modifiers, true));
|
|
3804
|
+
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Type guard predicate narrowing a value to `ImageReferenceElement`.
|
|
3807
|
+
*
|
|
3808
|
+
* @param value - The value to inspect.
|
|
3809
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3810
|
+
* @returns `true` if the value is a `ImageReferenceElement` (type = "image-ref"), otherwise `false`.
|
|
3811
|
+
*/
|
|
3812
|
+
export function isImageReferenceElement(value, withDeepValidation = false) {
|
|
3813
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "image-ref") {
|
|
3814
|
+
return false;
|
|
3815
|
+
}
|
|
3816
|
+
if (!withDeepValidation) {
|
|
3817
|
+
return true;
|
|
3818
|
+
}
|
|
3819
|
+
const element = value;
|
|
3820
|
+
return ("src" in value && typeof element.src === "string") &&
|
|
3821
|
+
(element.alt === undefined || typeof element.alt === "string") &&
|
|
3822
|
+
(element.aspectRatio === undefined || typeof element.aspectRatio === "string") &&
|
|
3823
|
+
(element.placeholder === undefined || typeof element.placeholder === "string");
|
|
3824
|
+
}
|
|
3825
|
+
/**
|
|
3826
|
+
* Type guard predicate narrowing a value to `DominantColourSetElement`.
|
|
3827
|
+
*
|
|
3828
|
+
* @param value - The value to inspect.
|
|
3829
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3830
|
+
* @returns `true` if the value is a `DominantColourSetElement` (type = "color-set"), otherwise `false`.
|
|
3831
|
+
*/
|
|
3832
|
+
export function isDominantColourSetElement(value, withDeepValidation = false) {
|
|
3833
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "color-set") {
|
|
3834
|
+
return false;
|
|
3835
|
+
}
|
|
3836
|
+
if (!withDeepValidation) {
|
|
3837
|
+
return true;
|
|
3838
|
+
}
|
|
3839
|
+
const element = value;
|
|
3840
|
+
return ("colors" in value && (Array.isArray(element.colors) && element.colors.every((item) => typeof item === "string")));
|
|
3841
|
+
}
|
|
3842
|
+
/**
|
|
3843
|
+
* Type guard predicate narrowing a value to `MarkdownBlockElement`.
|
|
3844
|
+
*
|
|
3845
|
+
* @param value - The value to inspect.
|
|
3846
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3847
|
+
* @returns `true` if the value is a `MarkdownBlockElement` (type = "markdown"), otherwise `false`.
|
|
3848
|
+
*/
|
|
3849
|
+
export function isMarkdownBlockElement(value, withDeepValidation = false) {
|
|
3850
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "markdown") {
|
|
3851
|
+
return false;
|
|
3852
|
+
}
|
|
3853
|
+
if (!withDeepValidation) {
|
|
3854
|
+
return true;
|
|
3855
|
+
}
|
|
3856
|
+
const element = value;
|
|
3857
|
+
return ("content" in value && typeof element.content === "string") &&
|
|
3858
|
+
(element.modifiers === undefined || isBaseModifiers(element.modifiers, true));
|
|
3859
|
+
}
|
|
3860
|
+
/**
|
|
3861
|
+
* Type guard predicate narrowing a value to `HtmlBlockElement`.
|
|
3862
|
+
*
|
|
3863
|
+
* @param value - The value to inspect.
|
|
3864
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3865
|
+
* @returns `true` if the value is a `HtmlBlockElement` (type = "html"), otherwise `false`.
|
|
3866
|
+
*/
|
|
3867
|
+
export function isHtmlBlockElement(value, withDeepValidation = false) {
|
|
3868
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "html") {
|
|
3869
|
+
return false;
|
|
3870
|
+
}
|
|
3871
|
+
if (!withDeepValidation) {
|
|
3872
|
+
return true;
|
|
3873
|
+
}
|
|
3874
|
+
const element = value;
|
|
3875
|
+
return ("content" in value && typeof element.content === "string") &&
|
|
3876
|
+
(element.modifiers === undefined || isBaseModifiers(element.modifiers, true));
|
|
3877
|
+
}
|
|
3878
|
+
/**
|
|
3879
|
+
* Type guard predicate narrowing a value to `MultiSlotRowElement`.
|
|
3880
|
+
*
|
|
3881
|
+
* @param value - The value to inspect.
|
|
3882
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3883
|
+
* @returns `true` if the value is a `MultiSlotRowElement` (type = "multi-slot"), otherwise `false`.
|
|
3884
|
+
*/
|
|
3885
|
+
export function isMultiSlotRowElement(value, withDeepValidation = false) {
|
|
3886
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "multi-slot") {
|
|
3887
|
+
return false;
|
|
3888
|
+
}
|
|
3889
|
+
if (!withDeepValidation) {
|
|
3890
|
+
return true;
|
|
3891
|
+
}
|
|
3892
|
+
const element = value;
|
|
3893
|
+
return (element.proportions === undefined || typeof element.proportions === "string") &&
|
|
3894
|
+
("slots" in value && (Array.isArray(element.slots) && element.slots.every((item) => isSlot(item, true))));
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* Type guard predicate narrowing a value to `LabelValueRowElement`.
|
|
3898
|
+
*
|
|
3899
|
+
* @param value - The value to inspect.
|
|
3900
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3901
|
+
* @returns `true` if the value is a `LabelValueRowElement` (type = "label-value"), otherwise `false`.
|
|
3902
|
+
*/
|
|
3903
|
+
export function isLabelValueRowElement(value, withDeepValidation = false) {
|
|
3904
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "label-value") {
|
|
3905
|
+
return false;
|
|
3906
|
+
}
|
|
3907
|
+
if (!withDeepValidation) {
|
|
3908
|
+
return true;
|
|
3909
|
+
}
|
|
3910
|
+
const element = value;
|
|
3911
|
+
return ("label" in value && typeof element.label === "string") &&
|
|
3912
|
+
("value" in value && isUiElement(element.value, true)) &&
|
|
3913
|
+
(element.withDivider === undefined || typeof element.withDivider === "boolean");
|
|
3914
|
+
}
|
|
3915
|
+
/**
|
|
3916
|
+
* Type guard predicate narrowing a value to `TableElement`.
|
|
3917
|
+
*
|
|
3918
|
+
* @param value - The value to inspect.
|
|
3919
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3920
|
+
* @returns `true` if the value is a `TableElement` (type = "table"), otherwise `false`.
|
|
3921
|
+
*/
|
|
3922
|
+
export function isTableElement(value, withDeepValidation = false) {
|
|
3923
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "table") {
|
|
3924
|
+
return false;
|
|
3925
|
+
}
|
|
3926
|
+
if (!withDeepValidation) {
|
|
3927
|
+
return true;
|
|
3928
|
+
}
|
|
3929
|
+
const element = value;
|
|
3930
|
+
return (element.hasHeader === undefined || typeof element.hasHeader === "boolean") &&
|
|
3931
|
+
(element.isStriped === undefined || typeof element.isStriped === "boolean") &&
|
|
3932
|
+
(element.withColumnSeparators === undefined || typeof element.withColumnSeparators === "boolean") &&
|
|
3933
|
+
(element.withRowSeparators === undefined || typeof element.withRowSeparators === "boolean") &&
|
|
3934
|
+
(element.columns === undefined || (Array.isArray(element.columns) && element.columns.every((item) => isTableColumn(item, true)))) &&
|
|
3935
|
+
("rows" in value && (Array.isArray(element.rows) && element.rows.every((item) => isTableRow(item, true))));
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* Type guard predicate narrowing a value to `RepeatingGroupElement`.
|
|
3939
|
+
*
|
|
3940
|
+
* @param value - The value to inspect.
|
|
3941
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3942
|
+
* @returns `true` if the value is a `RepeatingGroupElement` (type = "repeating-group"), otherwise `false`.
|
|
3943
|
+
*/
|
|
3944
|
+
export function isRepeatingGroupElement(value, withDeepValidation = false) {
|
|
3945
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "repeating-group") {
|
|
3946
|
+
return false;
|
|
3947
|
+
}
|
|
3948
|
+
if (!withDeepValidation) {
|
|
3949
|
+
return true;
|
|
3950
|
+
}
|
|
3951
|
+
const element = value;
|
|
3952
|
+
return (element.title === undefined || typeof element.title === "string") &&
|
|
3953
|
+
("entries" in value && (Array.isArray(element.entries) && element.entries.every((item) => isRepeatingGroupEntry(item, true))));
|
|
3954
|
+
}
|
|
3955
|
+
/**
|
|
3956
|
+
* Type guard predicate narrowing a value to `CollapsibleGroupElement`.
|
|
3957
|
+
*
|
|
3958
|
+
* @param value - The value to inspect.
|
|
3959
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3960
|
+
* @returns `true` if the value is a `CollapsibleGroupElement` (type = "collapsible-group"), otherwise `false`.
|
|
3961
|
+
*/
|
|
3962
|
+
export function isCollapsibleGroupElement(value, withDeepValidation = false) {
|
|
3963
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "collapsible-group") {
|
|
3964
|
+
return false;
|
|
3965
|
+
}
|
|
3966
|
+
if (!withDeepValidation) {
|
|
3967
|
+
return true;
|
|
3968
|
+
}
|
|
3969
|
+
const element = value;
|
|
3970
|
+
return ("title" in value && typeof element.title === "string") &&
|
|
3971
|
+
(element.summary === undefined || typeof element.summary === "string") &&
|
|
3972
|
+
(element.defaultExpanded === undefined || typeof element.defaultExpanded === "boolean") &&
|
|
3973
|
+
("elements" in value && (Array.isArray(element.elements) && element.elements.every((item) => isUiElement(item, true))));
|
|
3974
|
+
}
|
|
3975
|
+
/**
|
|
3976
|
+
* Type guard predicate narrowing a value to `DividerElement`.
|
|
3977
|
+
*
|
|
3978
|
+
* @param value - The value to inspect.
|
|
3979
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3980
|
+
* @returns `true` if the value is a `DividerElement` (type = "divider"), otherwise `false`.
|
|
3981
|
+
*/
|
|
3982
|
+
export function isDividerElement(value, withDeepValidation = false) {
|
|
3983
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "divider") {
|
|
3984
|
+
return false;
|
|
3985
|
+
}
|
|
3986
|
+
if (!withDeepValidation) {
|
|
3987
|
+
return true;
|
|
3988
|
+
}
|
|
3989
|
+
const element = value;
|
|
3990
|
+
return (element.style === undefined || Object.values(DividerStyle).includes(element.style));
|
|
3991
|
+
}
|
|
3992
|
+
/**
|
|
3993
|
+
* Type guard predicate verifying whether an unknown value conforms to `UiAction`.
|
|
3994
|
+
*
|
|
3995
|
+
* @param value - The value to inspect.
|
|
3996
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
3997
|
+
* @returns `true` if the value is a valid `UiAction`, otherwise `false`.
|
|
3998
|
+
*/
|
|
3999
|
+
export function isUiAction(value, withDeepValidation = false) {
|
|
4000
|
+
if (typeof value !== "object" || value === null || !("type" in value) || typeof value.type !== "string") {
|
|
4001
|
+
return false;
|
|
4002
|
+
}
|
|
4003
|
+
if (!withDeepValidation) {
|
|
4004
|
+
return true;
|
|
4005
|
+
}
|
|
4006
|
+
const element = value;
|
|
4007
|
+
switch (element.type) {
|
|
4008
|
+
case "button":
|
|
4009
|
+
return isButtonActionElement(element, true);
|
|
4010
|
+
case "external-link":
|
|
4011
|
+
return isExternalLinkActionElement(element, true);
|
|
4012
|
+
default:
|
|
4013
|
+
return false;
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
/**
|
|
4017
|
+
* Type guard predicate narrowing a value to `ButtonActionElement`.
|
|
4018
|
+
*
|
|
4019
|
+
* @param value - The value to inspect.
|
|
4020
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
4021
|
+
* @returns `true` if the value is a `ButtonActionElement` (type = "button"), otherwise `false`.
|
|
4022
|
+
*/
|
|
4023
|
+
export function isButtonActionElement(value, withDeepValidation = false) {
|
|
4024
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "button") {
|
|
4025
|
+
return false;
|
|
4026
|
+
}
|
|
4027
|
+
if (!withDeepValidation) {
|
|
4028
|
+
return true;
|
|
4029
|
+
}
|
|
4030
|
+
const element = value;
|
|
4031
|
+
return (element.extensionId === undefined || typeof element.extensionId === "string") &&
|
|
4032
|
+
("commandId" in value && typeof element.commandId === "string") &&
|
|
4033
|
+
(element.target === undefined || typeof element.target === "string") &&
|
|
4034
|
+
(element.parameters === undefined || (typeof element.parameters === "object" && element.parameters !== null)) &&
|
|
4035
|
+
(element.disabled === undefined || typeof element.disabled === "boolean") &&
|
|
4036
|
+
(element.variant === undefined || Object.values(ButtonVariant).includes(element.variant)) &&
|
|
4037
|
+
("label" in value && typeof element.label === "string");
|
|
4038
|
+
}
|
|
4039
|
+
/**
|
|
4040
|
+
* Type guard predicate narrowing a value to `ExternalLinkActionElement`.
|
|
4041
|
+
*
|
|
4042
|
+
* @param value - The value to inspect.
|
|
4043
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
4044
|
+
* @returns `true` if the value is a `ExternalLinkActionElement` (type = "external-link"), otherwise `false`.
|
|
4045
|
+
*/
|
|
4046
|
+
export function isExternalLinkActionElement(value, withDeepValidation = false) {
|
|
4047
|
+
if (typeof value !== "object" || value === null || !("type" in value) || value.type !== "external-link") {
|
|
4048
|
+
return false;
|
|
4049
|
+
}
|
|
4050
|
+
if (!withDeepValidation) {
|
|
4051
|
+
return true;
|
|
4052
|
+
}
|
|
4053
|
+
const element = value;
|
|
4054
|
+
return ("url" in value && typeof element.url === "string") &&
|
|
4055
|
+
("label" in value && typeof element.label === "string");
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
* Type guard predicate verifying whether an unknown value conforms to `UiContainer`.
|
|
4059
|
+
*
|
|
4060
|
+
* @param value - The value to inspect.
|
|
4061
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
4062
|
+
* @returns `true` if the value is a valid `UiContainer`, otherwise `false`.
|
|
4063
|
+
*/
|
|
4064
|
+
export function isUiContainer(value, withDeepValidation = false) {
|
|
4065
|
+
if (typeof value !== "object" || value === null) {
|
|
4066
|
+
return false;
|
|
4067
|
+
}
|
|
4068
|
+
if (!("schemaVersion" in value) || value.schemaVersion !== "1.0" || !("elements" in value)) {
|
|
4069
|
+
return false;
|
|
4070
|
+
}
|
|
4071
|
+
if (!withDeepValidation) {
|
|
4072
|
+
return true;
|
|
4073
|
+
}
|
|
4074
|
+
const element = value;
|
|
4075
|
+
return ("elements" in value && (Array.isArray(element.elements) && element.elements.every((item) => isUiElement(item, true))));
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* Type guard predicate verifying whether an unknown value conforms to `UiCard`.
|
|
4079
|
+
*
|
|
4080
|
+
* @param value - The value to inspect.
|
|
4081
|
+
* @param withDeepValidation - Whether to recursively validate all properties.
|
|
4082
|
+
* @returns `true` if the value is a valid `UiCard`, otherwise `false`.
|
|
4083
|
+
*/
|
|
4084
|
+
export function isUiCard(value, withDeepValidation = false) {
|
|
4085
|
+
if (typeof value !== "object" || value === null) {
|
|
4086
|
+
return false;
|
|
4087
|
+
}
|
|
4088
|
+
if (!("schemaVersion" in value) || value.schemaVersion !== "1.0" || !("title" in value) || !("elements" in value)) {
|
|
4089
|
+
return false;
|
|
4090
|
+
}
|
|
4091
|
+
if (!withDeepValidation) {
|
|
4092
|
+
return true;
|
|
4093
|
+
}
|
|
4094
|
+
const element = value;
|
|
4095
|
+
return ("title" in value && typeof element.title === "string") &&
|
|
4096
|
+
(element.description === undefined || typeof element.description === "string") &&
|
|
4097
|
+
(element.actions === undefined || (Array.isArray(element.actions) && element.actions.every((item) => isUiAction(item, true)))) &&
|
|
4098
|
+
("elements" in value && (Array.isArray(element.elements) && element.elements.every((item) => isUiElement(item, true))));
|
|
4099
|
+
}
|