@scalar/blocks 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/code-example/components/AsyncApiCodeExample.vue.js +111 -6
- package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js +8 -0
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/CodeExample.vue.d.ts +10 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +297 -6
- package/dist/code-example/components/CodeExample.vue.js.map +1 -1
- package/dist/code-example/components/CodeExample3.vue.js +8 -0
- package/dist/code-example/components/CodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts +2 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue.js +50 -4
- package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
- package/dist/code-example/components/ExamplePicker2.vue.js +6 -0
- package/dist/code-example/components/ExamplePicker2.vue.js.map +1 -0
- package/dist/code-example/components/HttpMethod.vue.js +32 -4
- package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
- package/dist/code-example/components/HttpMethod2.vue.js +6 -0
- package/dist/code-example/components/HttpMethod2.vue.js.map +1 -0
- package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
- package/dist/code-example/helpers/find-client.js.map +1 -1
- package/dist/code-example/helpers/format-language.js.map +1 -1
- package/dist/code-example/helpers/generate-client-options.js.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts +8 -2
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +57 -27
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -1
- package/dist/code-example/helpers/get-clients.js.map +1 -1
- package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
- package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -1
- package/dist/code-example/helpers/get-message-example-content.js.map +1 -1
- package/dist/code-example/helpers/get-secrets.js.map +1 -1
- package/dist/code-example/helpers/get-snippet.d.ts +2 -2
- package/dist/code-example/helpers/get-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/get-snippet.js +7 -9
- package/dist/code-example/helpers/get-snippet.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +102 -81
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +49 -47
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +6 -6
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
- package/dist/code-example/index.d.ts +1 -1
- package/dist/code-example/index.d.ts.map +1 -1
- package/dist/code-example/index.js +14 -14
- package/dist/code-example/mount-asyncapi.js +1 -1
- package/dist/code-example/mount-asyncapi.js.map +1 -1
- package/dist/code-example/mount.js +1 -1
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/LinkButton.vue.js.map +1 -1
- package/dist/schema/RenderString.vue.js +11 -4
- package/dist/schema/RenderString.vue.js.map +1 -1
- package/dist/schema/RenderString2.vue.js +6 -0
- package/dist/schema/RenderString2.vue.js.map +1 -0
- package/dist/schema/Schema.vue.js +235 -6
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema3.vue.js +8 -0
- package/dist/schema/Schema3.vue.js.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.js +25 -4
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview2.vue.js +6 -0
- package/dist/schema/SchemaCollapsedPreview2.vue.js.map +1 -0
- package/dist/schema/SchemaComposition.vue.js +232 -6
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition3.vue.js +8 -0
- package/dist/schema/SchemaComposition3.vue.js.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js +23 -4
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem2.vue.js +6 -0
- package/dist/schema/SchemaEnumPropertyItem2.vue.js.map +1 -0
- package/dist/schema/SchemaEnums.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnums.vue.js +74 -6
- package/dist/schema/SchemaEnums.vue.js.map +1 -1
- package/dist/schema/SchemaEnums3.vue.js +8 -0
- package/dist/schema/SchemaEnums3.vue.js.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.js +27 -4
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck2.vue.js +6 -0
- package/dist/schema/SchemaGlyphPuck2.vue.js.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.js +40 -4
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
- package/dist/schema/SchemaGutterToggle2.vue.js +6 -0
- package/dist/schema/SchemaGutterToggle2.vue.js.map +1 -0
- package/dist/schema/SchemaHeading.vue.js +32 -6
- package/dist/schema/SchemaHeading.vue.js.map +1 -1
- package/dist/schema/SchemaHeading3.vue.js +8 -0
- package/dist/schema/SchemaHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +42 -4
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js +6 -0
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.js +213 -4
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/schema/SchemaObjectProperties2.vue.js +6 -0
- package/dist/schema/SchemaObjectProperties2.vue.js.map +1 -0
- package/dist/schema/SchemaProperty.vue.js +472 -6
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty3.vue.js +8 -0
- package/dist/schema/SchemaProperty3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.js +61 -6
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDefault3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.js +22 -6
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDetail3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.js +133 -6
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples3.vue.js +8 -0
- package/dist/schema/SchemaPropertyExamples3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.js +312 -6
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading3.vue.js +8 -0
- package/dist/schema/SchemaPropertyHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.js +42 -6
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern3.vue.js +8 -0
- package/dist/schema/SchemaPropertyPattern3.vue.js.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.js +53 -4
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
- package/dist/schema/SchemaRailPanel2.vue.js +6 -0
- package/dist/schema/SchemaRailPanel2.vue.js.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.js +24 -4
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
- package/dist/schema/components/CopyLinkButton2.vue.js +6 -0
- package/dist/schema/components/CopyLinkButton2.vue.js.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.js +15 -4
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
- package/dist/schema/components/WithBreadcrumb2.vue.js +6 -0
- package/dist/schema/components/WithBreadcrumb2.vue.js.map +1 -0
- package/dist/schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/schema/helpers/format-example.js.map +1 -1
- package/dist/schema/helpers/format-structured-value.d.ts +3 -0
- package/dist/schema/helpers/format-structured-value.d.ts.map +1 -0
- package/dist/schema/helpers/format-structured-value.js +6 -0
- package/dist/schema/helpers/format-structured-value.js.map +1 -0
- package/dist/schema/helpers/format-value.js.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
- package/dist/schema/helpers/get-enum-values.js.map +1 -1
- package/dist/schema/helpers/get-property-description.js.map +1 -1
- package/dist/schema/helpers/get-ref-name.js.map +1 -1
- package/dist/schema/helpers/get-rendered-example.js.map +1 -1
- package/dist/schema/helpers/get-schema-type.js.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.js +37 -36
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
- package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
- package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
- package/dist/schema/helpers/is-model-linkable.js.map +1 -1
- package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
- package/dist/schema/helpers/is-type-object.js.map +1 -1
- package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
- package/dist/schema/helpers/schema-cycle.js.map +1 -1
- package/dist/schema/helpers/schema-expansion.js.map +1 -1
- package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
- package/dist/schema/helpers/schema-name.js.map +1 -1
- package/dist/schema/helpers/should-display-description.js.map +1 -1
- package/dist/schema/helpers/should-display-heading.js.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/schema/helpers/sort-property-names.js.map +1 -1
- package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
- package/dist/schema/index.js +8 -8
- package/dist/schema/localization/index.js.map +1 -1
- package/dist/schema/localization/translations.js.map +1 -1
- package/dist/shared/Badge.vue.js +13 -6
- package/dist/shared/Badge.vue.js.map +1 -1
- package/dist/shared/Badge3.vue.js +8 -0
- package/dist/shared/Badge3.vue.js.map +1 -0
- package/dist/shared/ExternalDocs.vue.js +43 -4
- package/dist/shared/ExternalDocs.vue.js.map +1 -1
- package/dist/shared/ExternalDocs2.vue.js +6 -0
- package/dist/shared/ExternalDocs2.vue.js.map +1 -0
- package/dist/shared/ExternalExampleStatus.vue.js +24 -4
- package/dist/shared/ExternalExampleStatus.vue.js.map +1 -1
- package/dist/shared/ExternalExampleStatus2.vue.js +6 -0
- package/dist/shared/ExternalExampleStatus2.vue.js.map +1 -0
- package/dist/shared/ScreenReader.vue.js +16 -4
- package/dist/shared/ScreenReader.vue.js.map +1 -1
- package/dist/shared/ScreenReader2.vue.js +6 -0
- package/dist/shared/ScreenReader2.vue.js.map +1 -0
- package/dist/shared/external-example-localization/index.js.map +1 -1
- package/dist/shared/external-example-localization/translations.js.map +1 -1
- package/dist/shared/index.js +4 -4
- package/dist/specification-extensions/ExtensionValue.vue.js +89 -4
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
- package/dist/specification-extensions/ExtensionValue2.vue.js +6 -0
- package/dist/specification-extensions/ExtensionValue2.vue.js.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.js +76 -4
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions2.vue.js +6 -0
- package/dist/specification-extensions/SpecificationExtensions2.vue.js.map +1 -0
- package/dist/specification-extensions/index.js +1 -1
- package/dist/style.css +13 -9
- package/dist/vue-styles.css +1 -1
- package/package.json +18 -18
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +0 -113
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +0 -269
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +0 -48
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +0 -13
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +0 -237
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +0 -27
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +0 -234
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +0 -23
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +0 -77
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +0 -29
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +0 -42
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +0 -215
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +0 -474
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +0 -63
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +0 -24
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +0 -135
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +0 -314
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +0 -55
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +0 -17
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +0 -15
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +0 -45
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +0 -18
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +0 -91
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +0 -78
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +0 -1
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { formatValue as e } from "./helpers/format-value.js";
|
|
2
|
-
import { useLocalization as t } from "./localization/index.js";
|
|
3
|
-
import { createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, ref as l, toDisplayString as u, unref as d, useId as f } from "vue";
|
|
4
|
-
import { ScalarIcon as p } from "@scalar/components/icon";
|
|
5
|
-
import { useClipboard as m } from "@scalar/use-hooks/useClipboard";
|
|
6
|
-
import { onClickOutside as h, onKeyStroke as g } from "@vueuse/core";
|
|
7
|
-
// src/schema/SchemaPropertyDefault.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var _ = ["aria-controls", "aria-expanded"], v = ["id"], y = ["aria-label"], b = 500, x = /*@__PURE__*/ o({
|
|
9
|
-
__name: "SchemaPropertyDefault",
|
|
10
|
-
props: { value: {} },
|
|
11
|
-
setup(o) {
|
|
12
|
-
let { copyToClipboard: x } = m(), { translate: S } = t(), C = l(null), w = l(null), T = l(!1), E = f(), D = () => {
|
|
13
|
-
T.value = !T.value;
|
|
14
|
-
}, O = () => {
|
|
15
|
-
!A && !k && (T.value = !0);
|
|
16
|
-
}, k = !1, A = !1, j = 0, M = () => {
|
|
17
|
-
A = !0, window.clearTimeout(j), j = window.setTimeout(() => {
|
|
18
|
-
A = !1;
|
|
19
|
-
}, b);
|
|
20
|
-
}, N = (e) => {
|
|
21
|
-
let t = e.relatedTarget;
|
|
22
|
-
t instanceof Node && C.value?.contains(t) || (T.value = !1);
|
|
23
|
-
}, P = () => {
|
|
24
|
-
let e = C.value?.contains(document.activeElement);
|
|
25
|
-
T.value = !1, e && (k = !0, w.value?.focus(), k = !1);
|
|
26
|
-
};
|
|
27
|
-
return h(C, P), g("Escape", () => {
|
|
28
|
-
T.value && P();
|
|
29
|
-
}), (t, l) => o.value === void 0 ? n("", !0) : (c(), r("div", {
|
|
30
|
-
key: 0,
|
|
31
|
-
ref_key: "rootRef",
|
|
32
|
-
ref: C,
|
|
33
|
-
class: s(["property-default", { "is-open": T.value }]),
|
|
34
|
-
onFocusin: O,
|
|
35
|
-
onFocusout: N
|
|
36
|
-
}, [i("button", {
|
|
37
|
-
ref_key: "labelRef",
|
|
38
|
-
ref: w,
|
|
39
|
-
"aria-controls": d(E),
|
|
40
|
-
"aria-expanded": T.value,
|
|
41
|
-
class: "property-default-label",
|
|
42
|
-
type: "button",
|
|
43
|
-
onClick: D,
|
|
44
|
-
onPointerdown: M
|
|
45
|
-
}, [i("span", null, u(d(S)("schema.default")), 1)], 40, _), i("div", {
|
|
46
|
-
id: d(E),
|
|
47
|
-
class: s(["property-default-value-list", { "flex!": T.value }])
|
|
48
|
-
}, [i("button", {
|
|
49
|
-
"aria-label": `${d(S)("common.copyDefault")}: ${d(e)(o.value)}`,
|
|
50
|
-
class: "property-default-value group",
|
|
51
|
-
type: "button",
|
|
52
|
-
onClick: l[0] ||= (t) => d(x)(d(e)(o.value))
|
|
53
|
-
}, [i("span", null, u(d(e)(o.value)), 1), a(d(p), {
|
|
54
|
-
"aria-hidden": "true",
|
|
55
|
-
class: "group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3",
|
|
56
|
-
icon: "Clipboard",
|
|
57
|
-
size: "xs"
|
|
58
|
-
})], 8, y)], 10, v)], 34));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
export { x as default };
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_unref","_toDisplayString","_createVNode","_hoisted_1","_hoisted_2","_hoisted_3","POINTER_GUARD_MS","SchemaPropertyDefault_vue_vue_type_script_setup_true_lang_default","useClipboard","useLocalization","rootRef","ref","labelRef","isOpen","popupId","useId","toggle","onFocusIn","openedByPointer","restoringFocus","pointerGuardTimer","onPointerDown","onFocusOut","next","event","close","wasInside","onClickOutside","onKeyStroke","__props","createCommentVNode","openBlock","createElementBlock","normalizeClass","createElementVNode","unref","toDisplayString","translate","formatValue","_cache","copyToClipboard","createVNode","ScalarIcon"],"sources":["../../src/schema/SchemaPropertyDefault.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { ref, useId } from 'vue'\n\nimport { formatValue } from './helpers/format-value'\nimport { useLocalization } from './localization'\n\ndefineProps<{\n value?: unknown\n}>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n/**\n * Hover/`:focus-within` CSS alone left the popup unreachable by Enter, Escape\n * or touch, so it is pinned open on click (as in SchemaPropertyPattern.vue).\n */\nconst rootRef = ref<HTMLElement | null>(null)\nconst labelRef = ref<HTMLButtonElement | null>(null)\nconst isOpen = ref(false)\nconst popupId = useId()\n\nconst toggle = (): void => {\n isOpen.value = !isOpen.value\n}\n\n/**\n * Focus opens the popup through the same state as the click, not a separate\n * `:focus-within` rule: with both, a click's own `focusin` opened it first and\n * `toggle()` closed it again, so `aria-expanded` disagreed with the screen.\n */\nconst onFocusIn = (): void => {\n if (!openedByPointer && !restoringFocus) {\n isOpen.value = true\n }\n}\n\n/**\n * `close()` refocuses the label, and `focus()` fires `focusin` synchronously,\n * which would re-open the popup and make the first Escape look inert.\n */\nlet restoringFocus = false\n\n/** A pointer press focuses before it clicks; that focus must not open the popup */\nlet openedByPointer = false\n\n/** Long enough to span a touch tap's delayed compatibility mouse events. */\nconst POINTER_GUARD_MS = 500\nlet pointerGuardTimer = 0\n\nconst onPointerDown = (): void => {\n /*\n * A touch tap's compatibility mousedown (which moves focus) lands 50-150ms\n * after touchend, past any one-frame guard, so the tap opened then closed.\n */\n openedByPointer = true\n window.clearTimeout(pointerGuardTimer)\n pointerGuardTimer = window.setTimeout(() => {\n openedByPointer = false\n }, POINTER_GUARD_MS)\n}\n\nconst onFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget\n\n if (!(next instanceof Node) || !rootRef.value?.contains(next)) {\n isOpen.value = false\n }\n}\n\n/**\n * Closing hides the popup outright, so focus is handed back deliberately, or\n * Escape from inside it drops focus to <body> and Tab resumes from the top.\n */\nconst close = (): void => {\n const wasInside = rootRef.value?.contains(document.activeElement)\n\n isOpen.value = false\n\n if (wasInside) {\n restoringFocus = true\n labelRef.value?.focus()\n restoringFocus = false\n }\n}\n\nonClickOutside(rootRef, close)\nonKeyStroke('Escape', () => {\n if (isOpen.value) {\n close()\n }\n})\n</script>\n<template>\n <template v-if=\"value !== undefined\">\n <div\n ref=\"rootRef\"\n class=\"property-default\"\n :class=\"{ 'is-open': isOpen }\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\">\n <button\n ref=\"labelRef\"\n :aria-controls=\"popupId\"\n :aria-expanded=\"isOpen\"\n class=\"property-default-label\"\n type=\"button\"\n @click=\"toggle\"\n @pointerdown=\"onPointerDown\">\n <span>{{ translate('schema.default') }}</span>\n </button>\n <div\n :id=\"popupId\"\n class=\"property-default-value-list\"\n :class=\"{ 'flex!': isOpen }\">\n <button\n :aria-label=\"`${translate('common.copyDefault')}: ${formatValue(value)}`\"\n class=\"property-default-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatValue(value))\">\n <span>\n {{ formatValue(value) }}\n </span>\n <ScalarIcon\n aria-hidden=\"true\"\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n</template>\n\n<style scoped>\n.property-default {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n.property-default:hover:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n.property-default:hover .property-default-label span {\n color: var(--scalar-color-1);\n}\n.property-default-label span {\n color: var(--scalar-color-2);\n position: relative;\n border-bottom: var(--scalar-border-width) dotted currentColor;\n}\n.property-default-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n align-items: center;\n width: 100%;\n padding: 6px;\n}\n.property-default-value span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.property-default-value :deep(svg) {\n color: var(--scalar-color-3);\n}\n\n.property-default-value:hover :deep(svg) {\n color: var(--scalar-color-1);\n}\n\n.property-default-value {\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n.property-default-value-list {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n overflow: auto;\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n max-width: 300px;\n flex-direction: column;\n gap: 3px;\n display: none;\n z-index: 2;\n}\n.property-default:hover .property-default-value-list {\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;A,4EAkDMU,IAAmB,K;;;;EArCzB,IAAM,EAAE,uBAAoBE,EAAa,GACnC,EAAE,iBAAcC,EAAgB,GAMhCC,IAAUC,EAAwB,IAAI,GACtCC,IAAWD,EAA8B,IAAI,GAC7CE,IAASF,EAAI,EAAK,GAClBG,IAAUC,EAAM,GAEhBC,UAAqB;GACzB,EAAO,QAAQ,CAACH,EAAO;EACzB,GAOMI,UAAwB;GAC5B,AAAI,CAACC,KAAmB,CAACC,MACvB,EAAO,QAAQ;EAEnB,GAMIA,IAAiB,IAGjBD,IAAk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J,SAAK,AAAAU,EAAA,QAAA,MAAEvC,EAAAwC,CAAA,CAAe,CAACxC,EAAAsC,CAAA,CAAW,CAACT,EAAA,KAAK,CAAA;E,IACzC9B,EAEO,QAAA,MAAAE,EADFD,EAAAsC,CAAA,CAAW,CAACT,EAAA,KAAK,CAAA,GAAA,CAAA,GAEtB3B,EAIcF,EAAA0C,CAAA,GAAA;GAHZ,eAAY;GACZ,OAAM;GACN,MAAK;GACL,MAAK"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createCommentVNode as e, createElementBlock as t, createTextVNode as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o } from "vue";
|
|
2
|
-
// src/schema/SchemaPropertyDetail.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var s = {
|
|
4
|
-
key: 0,
|
|
5
|
-
class: "property-detail-prefix"
|
|
6
|
-
}, c = {
|
|
7
|
-
key: 1,
|
|
8
|
-
class: "property-detail-value"
|
|
9
|
-
}, l = {
|
|
10
|
-
key: 2,
|
|
11
|
-
class: "property-detail-value"
|
|
12
|
-
}, u = /*@__PURE__*/ r({
|
|
13
|
-
__name: "SchemaPropertyDetail",
|
|
14
|
-
props: {
|
|
15
|
-
truncate: { type: Boolean },
|
|
16
|
-
code: { type: Boolean }
|
|
17
|
-
},
|
|
18
|
-
setup(r) {
|
|
19
|
-
return (u, d) => (a(), t("span", { class: i(["property-detail", { "property-detail-truncate": r.truncate }]) }, [u.$slots.prefix ? (a(), t("div", s, [o(u.$slots, "prefix", {}, void 0, !0), d[0] ||= n("\xA0 ", -1)])) : e("", !0), r.code ? (a(), t("code", c, [o(u.$slots, "default", {}, void 0, !0)])) : (a(), t("span", l, [o(u.$slots, "default", {}, void 0, !0)]))], 2));
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
export { u as default };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_hoisted_1","_hoisted_2","_hoisted_3","SchemaPropertyDetail_vue_vue_type_script_setup_true_lang_default","openBlock","createElementBlock","normalizeClass","__props","_ctx","renderSlot","_cache","createTextVNode","createCommentVNode"],"sources":["../../src/schema/SchemaPropertyDetail.vue"],"sourcesContent":["<script lang=\"ts\" setup>\ndefineProps<{\n truncate?: boolean\n code?: boolean\n}>()\n</script>\n<template>\n <span\n class=\"property-detail\"\n :class=\"{ 'property-detail-truncate': truncate }\">\n <div\n v-if=\"$slots.prefix\"\n class=\"property-detail-prefix\">\n <slot name=\"prefix\" /> \n </div>\n <code\n v-if=\"code\"\n class=\"property-detail-value\">\n <slot />\n </code>\n <span\n v-else\n class=\"property-detail-value\">\n <slot />\n </span>\n </span>\n</template>\n<style scoped>\n.property-detail {\n display: inline-flex;\n}\n.property-detail + .property-detail:before {\n display: block;\n content: '·';\n margin: 0 0.5ch;\n}\n.property-detail-truncate {\n overflow: hidden;\n}\n\n.property-detail-truncate > .property-detail-value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.property-detail-prefix {\n color: var(--scalar-color-2);\n}\n\ncode.property-detail-value {\n font-family: var(--scalar-font-code);\n font-size: var(--scalar-font-size-3);\n color: var(--scalar-color-2);\n background: color-mix(\n in srgb,\n var(--scalar-background-2),\n var(--scalar-background-1)\n );\n padding: 0 4px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;E,kBAOEC,EAAA,GAAAC,EAkBO,QAAA,EAjBL,OAAKC,EAAA,CAAC,mBAAiB,EAAA,4BACeU,EAAA,SAAQ,CAAA,CAAA,E,IAEtCb,EAAAA,OAAO,UADfC,EAAA,GAAAC,EAIM,OAJNI,GAIM,CADJF,EAAsBU,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,GAAA,AAAAE,EAAA,OAAAX,EAAA,SACxB,EAAA,C,iBAEQQ,EAAA,QADRZ,EAAA,GAAAC,EAIO,QAJPK,GAIO,CADLH,EAAQU,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,OAEVb,EAAA,GAAAC,EAIO,QAJPM,GAIO,CADLJ,EAAQU,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { formatExample as e } from "./helpers/format-example.js";
|
|
2
|
-
import { normalizeRenderedExamples as t } from "./helpers/get-rendered-example.js";
|
|
3
|
-
import n from "./LinkButton.vue.js";
|
|
4
|
-
import { useLocalization as r } from "./localization/index.js";
|
|
5
|
-
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, useId as v, withCtx as y } from "vue";
|
|
6
|
-
import { ScalarIcon as b } from "@scalar/components/icon";
|
|
7
|
-
import { useClipboard as x } from "@scalar/use-hooks/useClipboard";
|
|
8
|
-
import { onClickOutside as S, onKeyStroke as C } from "@vueuse/core";
|
|
9
|
-
// src/schema/SchemaPropertyExamples.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var w = ["id"], T = ["aria-label"], E = ["id"], D = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "text-c-2 font-sans text-xs font-normal break-words"
|
|
13
|
-
}, O = ["aria-label", "onClick"], k = 500, A = /*@__PURE__*/ d({
|
|
14
|
-
__name: "SchemaPropertyExamples",
|
|
15
|
-
props: {
|
|
16
|
-
align: { default: "center" },
|
|
17
|
-
examples: {},
|
|
18
|
-
example: {}
|
|
19
|
-
},
|
|
20
|
-
setup(d) {
|
|
21
|
-
let { copyToClipboard: A } = x(), { translate: j } = r(), M = a(() => d.example !== void 0), N = a(() => t(d.examples, { allowRawObjects: !0 }).map((t) => {
|
|
22
|
-
let n = t.summary || t.name, r = e(t.value);
|
|
23
|
-
return {
|
|
24
|
-
label: n,
|
|
25
|
-
value: r,
|
|
26
|
-
ariaLabel: `${j("common.copyExample")}: ${n ? `${n}: ` : ""}${r}`
|
|
27
|
-
};
|
|
28
|
-
})), P = a(() => N.value.length > 0), F = a(() => N.value.length === 1 ? j("schema.example") : j("schema.examples")), I = m(null), L = m(null), R = m(!1), z = v(), B = m(null), V = m(null), H = m(!1), U = v(), W = !1, G = 0, K = !1, q = () => {
|
|
29
|
-
W = !0, window.clearTimeout(G), G = window.setTimeout(() => {
|
|
30
|
-
W = !1;
|
|
31
|
-
}, k);
|
|
32
|
-
}, J = (e, t) => {
|
|
33
|
-
let n = e.relatedTarget;
|
|
34
|
-
return !(n instanceof Node) || !t?.contains(n);
|
|
35
|
-
}, Y = () => {
|
|
36
|
-
!W && !K && (R.value = !0);
|
|
37
|
-
}, X = (e) => {
|
|
38
|
-
J(e, I.value) && (R.value = !1);
|
|
39
|
-
}, Z = () => {
|
|
40
|
-
!W && !K && (H.value = !0);
|
|
41
|
-
}, Q = (e) => {
|
|
42
|
-
J(e, B.value) && (H.value = !1);
|
|
43
|
-
};
|
|
44
|
-
S(I, () => {
|
|
45
|
-
R.value = !1;
|
|
46
|
-
}), S(B, () => {
|
|
47
|
-
H.value = !1;
|
|
48
|
-
});
|
|
49
|
-
let $ = (e, t, n) => {
|
|
50
|
-
if (!e.value) return;
|
|
51
|
-
let r = t.value?.contains(document.activeElement);
|
|
52
|
-
if (e.value = !1, r) {
|
|
53
|
-
let e = n.value, t = e instanceof HTMLElement ? e : e?.$el;
|
|
54
|
-
K = !0, t?.focus?.(), K = !1;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
return C("Escape", () => {
|
|
58
|
-
$(R, I, L), $(H, B, V);
|
|
59
|
-
}), (t, r) => (p(), s(i, null, [M.value ? (p(), s("div", {
|
|
60
|
-
key: 0,
|
|
61
|
-
ref_key: "singleRootRef",
|
|
62
|
-
ref: I,
|
|
63
|
-
class: f(["property-example", { "is-open": R.value }]),
|
|
64
|
-
onFocusin: Y,
|
|
65
|
-
onFocusout: X
|
|
66
|
-
}, [u(n, {
|
|
67
|
-
ref_key: "singleTriggerRef",
|
|
68
|
-
ref: L,
|
|
69
|
-
"aria-controls": _(z),
|
|
70
|
-
"aria-expanded": R.value,
|
|
71
|
-
class: "decoration-dotted",
|
|
72
|
-
onClick: r[0] ||= (e) => R.value = !R.value,
|
|
73
|
-
onPointerdown: q
|
|
74
|
-
}, {
|
|
75
|
-
default: y(() => [l(g(_(j)("schema.example")), 1)]),
|
|
76
|
-
_: 1
|
|
77
|
-
}, 8, ["aria-controls", "aria-expanded"]), c("div", {
|
|
78
|
-
id: _(z),
|
|
79
|
-
class: f(["property-example-value-list", {
|
|
80
|
-
"flex!": R.value,
|
|
81
|
-
"property-example-value-list-start": d.align === "start"
|
|
82
|
-
}])
|
|
83
|
-
}, [c("button", {
|
|
84
|
-
"aria-label": `${_(j)("common.copyExample")}: ${_(e)(d.example)}`,
|
|
85
|
-
class: "property-example-value group",
|
|
86
|
-
type: "button",
|
|
87
|
-
onClick: r[1] ||= (t) => _(A)(_(e)(d.example))
|
|
88
|
-
}, [c("span", null, g(_(e)(d.example)), 1), u(_(b), {
|
|
89
|
-
"aria-hidden": "true",
|
|
90
|
-
class: "group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3",
|
|
91
|
-
icon: "Clipboard",
|
|
92
|
-
size: "xs"
|
|
93
|
-
})], 8, T)], 10, w)], 34)) : o("", !0), P.value ? (p(), s("div", {
|
|
94
|
-
key: 1,
|
|
95
|
-
ref_key: "multipleRootRef",
|
|
96
|
-
ref: B,
|
|
97
|
-
class: f(["property-example", { "is-open": H.value }]),
|
|
98
|
-
onFocusin: Z,
|
|
99
|
-
onFocusout: Q
|
|
100
|
-
}, [u(n, {
|
|
101
|
-
ref_key: "multipleTriggerRef",
|
|
102
|
-
ref: V,
|
|
103
|
-
"aria-controls": _(U),
|
|
104
|
-
"aria-expanded": H.value,
|
|
105
|
-
class: "decoration-dotted",
|
|
106
|
-
onClick: r[2] ||= (e) => H.value = !H.value,
|
|
107
|
-
onPointerdown: q
|
|
108
|
-
}, {
|
|
109
|
-
default: y(() => [l(g(F.value), 1)]),
|
|
110
|
-
_: 1
|
|
111
|
-
}, 8, ["aria-controls", "aria-expanded"]), c("div", {
|
|
112
|
-
id: _(U),
|
|
113
|
-
class: f(["property-example-value-list gap-3! p-3!", {
|
|
114
|
-
"flex!": H.value,
|
|
115
|
-
"property-example-value-list-start": d.align === "start"
|
|
116
|
-
}])
|
|
117
|
-
}, [(p(!0), s(i, null, h(N.value, (e, t) => (p(), s("div", {
|
|
118
|
-
key: t,
|
|
119
|
-
class: "flex min-w-0 flex-col gap-1.5"
|
|
120
|
-
}, [e.label ? (p(), s("span", D, g(e.label), 1)) : o("", !0), c("button", {
|
|
121
|
-
"aria-label": e.ariaLabel,
|
|
122
|
-
class: "property-example-value group text-left",
|
|
123
|
-
type: "button",
|
|
124
|
-
onClick: (t) => _(A)(e.value)
|
|
125
|
-
}, [c("span", null, g(e.value), 1), u(_(b), {
|
|
126
|
-
"aria-hidden": "true",
|
|
127
|
-
class: "text-c-3 group-hover:text-c-1 ml-auto min-h-3 min-w-3",
|
|
128
|
-
icon: "Clipboard",
|
|
129
|
-
size: "xs"
|
|
130
|
-
})], 8, O)]))), 128))], 10, E)], 34)) : o("", !0)], 64));
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
export { A as default };
|
|
134
|
-
|
|
135
|
-
//# sourceMappingURL=SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_normalizeClass","_createVNode","LinkButton","_unref","_withCtx","_createTextVNode","_toDisplayString","_createElementVNode","_renderList","LinkButton_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","POINTER_GUARD_MS","SchemaPropertyExamples_vue_vue_type_script_setup_true_lang_default","useClipboard","useLocalization","hasSingleExample","computed","__props","normalizedExamples","normalizeRenderedExamples","label","entry","value","formatExample","translate","hasMultipleExamples","multipleExamplesLabel","singleRootRef","ref","singleTriggerRef","isSingleOpen","singlePopupId","useId","multipleRootRef","multipleTriggerRef","isMultipleOpen","multiplePopupId","openedByPointer","pointerGuardTimer","restoringFocus","onPointerDown","leftPopup","next","event","root","onSingleFocusIn","onSingleFocusOut","onMultipleFocusIn","onMultipleFocusOut","onClickOutside","closeAndRestore","open","wasInside","element","trigger","focusable","onKeyStroke","openBlock","createElementBlock","Fragment","normalizeClass","createVNode","unref","_cache","withCtx","createTextVNode","toDisplayString","createElementVNode","copyToClipboard","ScalarIcon","createCommentVNode","renderList","ex"],"sources":["../../src/schema/SchemaPropertyExamples.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { computed, ref, useId } from 'vue'\n\nimport { formatExample } from './helpers/format-example'\nimport { normalizeRenderedExamples } from './helpers/get-rendered-example'\nimport LinkButton from './LinkButton.vue'\nimport { useLocalization } from './localization'\n\nconst {\n examples,\n example,\n align = 'center',\n} = defineProps<{\n /** Align the popup with its label when centering would overlap adjacent content. */\n align?: 'center' | 'start'\n examples?: unknown\n example?: unknown\n}>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n// `null` is a meaningful example value for nullable schemas, so only treat\n// `undefined` as \"not provided\".\nconst hasSingleExample = computed(() => example !== undefined)\n\nconst normalizedExamples = computed<\n { label: string | undefined; value: string | number; ariaLabel: string }[]\n>(() =>\n normalizeRenderedExamples(examples, { allowRawObjects: true }).map(\n (entry) => {\n const label = entry.summary || entry.name\n const value = formatExample(entry.value)\n return {\n label,\n value,\n ariaLabel: `${translate('common.copyExample')}: ${label ? `${label}: ` : ''}${value}`,\n }\n },\n ),\n)\n\nconst hasMultipleExamples = computed(() => normalizedExamples.value.length > 0)\n\nconst multipleExamplesLabel = computed(() =>\n normalizedExamples.value.length === 1\n ? translate('schema.example')\n : translate('schema.examples'),\n)\n\n/**\n * Hover/`:focus-within` CSS alone left the popup unreachable by Enter, Escape\n * or touch, so it is pinned open on click (as in SchemaPropertyPattern.vue).\n * `example` and `examples` can both render, so each popup has its own state.\n */\nconst singleRootRef = ref<HTMLElement | null>(null)\nconst singleTriggerRef = ref<HTMLElement | { $el: HTMLElement } | null>(null)\nconst isSingleOpen = ref(false)\nconst singlePopupId = useId()\n\nconst multipleRootRef = ref<HTMLElement | null>(null)\nconst multipleTriggerRef = ref<HTMLElement | { $el: HTMLElement } | null>(null)\nconst isMultipleOpen = ref(false)\nconst multiplePopupId = useId()\n\n/**\n * Focus opens the popup through the same state as the click, not a separate\n * `:focus-within` rule; with both, a click's own `focusin` opened it first and\n * the click closed it again. This flag stops a pointer press counting as focus.\n */\nlet openedByPointer = false\n\n/** Long enough to span a touch tap's delayed compatibility mouse events. */\nconst POINTER_GUARD_MS = 500\nlet pointerGuardTimer = 0\n\n/**\n * `closeAndRestore` refocuses the trigger, and `focus()` fires `focusin`\n * synchronously, which would re-open the popup and make the first Escape inert.\n */\nlet restoringFocus = false\n\nconst onPointerDown = (): void => {\n /*\n * A touch tap's compatibility mousedown (which moves focus) lands 50-150ms\n * after touchend, past any one-frame guard, so the tap opened then closed.\n */\n openedByPointer = true\n window.clearTimeout(pointerGuardTimer)\n pointerGuardTimer = window.setTimeout(() => {\n openedByPointer = false\n }, POINTER_GUARD_MS)\n}\n\nconst leftPopup = (event: FocusEvent, root: HTMLElement | null): boolean => {\n const next = event.relatedTarget\n\n return !(next instanceof Node) || !root?.contains(next)\n}\n\nconst onSingleFocusIn = (): void => {\n if (!openedByPointer && !restoringFocus) {\n isSingleOpen.value = true\n }\n}\n\nconst onSingleFocusOut = (event: FocusEvent): void => {\n if (leftPopup(event, singleRootRef.value)) {\n isSingleOpen.value = false\n }\n}\n\nconst onMultipleFocusIn = (): void => {\n if (!openedByPointer && !restoringFocus) {\n isMultipleOpen.value = true\n }\n}\n\nconst onMultipleFocusOut = (event: FocusEvent): void => {\n if (leftPopup(event, multipleRootRef.value)) {\n isMultipleOpen.value = false\n }\n}\n\nonClickOutside(singleRootRef, () => {\n isSingleOpen.value = false\n})\n\nonClickOutside(multipleRootRef, () => {\n isMultipleOpen.value = false\n})\n\n/**\n * Closing hides the popup outright, so focus is handed back deliberately, or\n * Escape from inside it drops focus to <body>.\n */\nconst closeAndRestore = (\n open: typeof isSingleOpen,\n root: typeof singleRootRef,\n trigger: typeof singleTriggerRef,\n): void => {\n if (!open.value) {\n return\n }\n\n const wasInside = root.value?.contains(document.activeElement)\n\n open.value = false\n\n if (wasInside) {\n const element = trigger.value\n const focusable = element instanceof HTMLElement ? element : element?.$el\n\n restoringFocus = true\n focusable?.focus?.()\n restoringFocus = false\n }\n}\n\nonKeyStroke('Escape', () => {\n closeAndRestore(isSingleOpen, singleRootRef, singleTriggerRef)\n closeAndRestore(isMultipleOpen, multipleRootRef, multipleTriggerRef)\n})\n</script>\n<template>\n <!-- single example (deprecated) -->\n <template v-if=\"hasSingleExample\">\n <div\n ref=\"singleRootRef\"\n class=\"property-example\"\n :class=\"{ 'is-open': isSingleOpen }\"\n @focusin=\"onSingleFocusIn\"\n @focusout=\"onSingleFocusOut\">\n <LinkButton\n ref=\"singleTriggerRef\"\n :aria-controls=\"singlePopupId\"\n :aria-expanded=\"isSingleOpen\"\n class=\"decoration-dotted\"\n @click=\"isSingleOpen = !isSingleOpen\"\n @pointerdown=\"onPointerDown\">\n {{ translate('schema.example') }}\n </LinkButton>\n <div\n :id=\"singlePopupId\"\n class=\"property-example-value-list\"\n :class=\"{\n 'flex!': isSingleOpen,\n 'property-example-value-list-start': align === 'start',\n }\">\n <button\n :aria-label=\"`${translate('common.copyExample')}: ${formatExample(example)}`\"\n class=\"property-example-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatExample(example))\">\n <span>\n {{ formatExample(example) }}\n </span>\n <ScalarIcon\n aria-hidden=\"true\"\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n\n <!-- multiple examples -->\n <template v-if=\"hasMultipleExamples\">\n <div\n ref=\"multipleRootRef\"\n class=\"property-example\"\n :class=\"{ 'is-open': isMultipleOpen }\"\n @focusin=\"onMultipleFocusIn\"\n @focusout=\"onMultipleFocusOut\">\n <LinkButton\n ref=\"multipleTriggerRef\"\n :aria-controls=\"multiplePopupId\"\n :aria-expanded=\"isMultipleOpen\"\n class=\"decoration-dotted\"\n @click=\"isMultipleOpen = !isMultipleOpen\"\n @pointerdown=\"onPointerDown\">\n {{ multipleExamplesLabel }}\n </LinkButton>\n <div\n :id=\"multiplePopupId\"\n class=\"property-example-value-list gap-3! p-3!\"\n :class=\"{\n 'flex!': isMultipleOpen,\n 'property-example-value-list-start': align === 'start',\n }\">\n <div\n v-for=\"(ex, key) in normalizedExamples\"\n :key=\"key\"\n class=\"flex min-w-0 flex-col gap-1.5\">\n <span\n v-if=\"ex.label\"\n class=\"text-c-2 font-sans text-xs font-normal break-words\">\n {{ ex.label }}\n </span>\n <button\n :aria-label=\"ex.ariaLabel\"\n class=\"property-example-value group text-left\"\n type=\"button\"\n @click=\"copyToClipboard(ex.value)\">\n <span>{{ ex.value }}</span>\n <ScalarIcon\n aria-hidden=\"true\"\n class=\"text-c-3 group-hover:text-c-1 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </div>\n </template>\n</template>\n\n<style scoped>\n@reference \"../style.css\";\n\n.property-example {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n.property-example:hover:before {\n pointer-events: none;\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n.property-example-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n align-items: center;\n width: 100%;\n padding: 6px;\n}\n.property-example-value span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre;\n}\n.property-example-value :deep(svg) {\n color: var(--scalar-color-3);\n}\n\n.property-example-value:hover :deep(svg) {\n color: var(--scalar-color-1);\n}\n\n.property-example-value {\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n.property-example-value-list {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n overflow: auto;\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n max-width: 300px;\n flex-direction: column;\n gap: 3px;\n display: none;\n @apply z-context;\n}\n.property-example-value-list-start {\n left: 0;\n transform: none;\n}\n.property-example:hover .property-example-value-list {\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;A,kCA4EMkB,IAAmB,K;;;;;;;;EAtDzB,IAAM,EAAE,uBAAoBE,EAAa,GACnC,EAAE,iBAAcC,EAAgB,GAIhCC,IAAmBC,QAAeC,EAAA,YAAY,KAAA,CAAS,GAEvDC,IAAqBF,QAGzBG,EAA0BF,EAAA,UAAU,EAAE,iBAAiB,GAAK,CAAC,CAAC,CAAC,KAC5D,MAAU;GACT,IAAMG,IAAQC,EAAM,WAAWA,EAAM,MAC/BC,IAAQC,EAAcF,EAAM,KAAK;GACvC,OAAO;IACL;IACA;IACA,WAAW,GAAGG,EAAU,oBAAoB,EAAE,IAAIJ,IAAQ,GAAGA,EAAM,MAAM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-
import e from "../shared/Badge.vue.js";
|
|
2
|
-
import { getSchemaType as t } from "./helpers/get-schema-type.js";
|
|
3
|
-
import { getDisplayTypeSignatureTokens as n } from "./helpers/get-type-signature-tokens.js";
|
|
4
|
-
import { isModelLinkable as r } from "./helpers/is-model-linkable.js";
|
|
5
|
-
import { getModelNameWithArray as ee } from "./helpers/schema-name.js";
|
|
6
|
-
import { useLocalization as te } from "./localization/index.js";
|
|
7
|
-
import { protobufFieldNumber as ne, protobufPresence as re } from "./protobuf-metadata.js";
|
|
8
|
-
import { schemaRecursiveTarget as ie } from "./recursive-metadata.js";
|
|
9
|
-
import i from "./RenderString.vue.js";
|
|
10
|
-
import ae from "./SchemaPropertyDefault.vue.js";
|
|
11
|
-
import a from "./SchemaPropertyDetail.vue.js";
|
|
12
|
-
import oe from "./SchemaPropertyExamples.vue.js";
|
|
13
|
-
import se from "./SchemaPropertyPattern.vue.js";
|
|
14
|
-
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as ce, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, openBlock as g, renderList as _, renderSlot as v, toDisplayString as y, toRef as le, unref as b, withCtx as x } from "vue";
|
|
15
|
-
import { resolve as S } from "@scalar/workspace-store/resolve";
|
|
16
|
-
import { isArraySchema as C, isNumberSchema as w, isStringSchema as T } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
17
|
-
import { isDefined as E } from "@scalar/helpers/array/is-defined";
|
|
18
|
-
import { ScalarTooltip as D } from "@scalar/components/tooltip";
|
|
19
|
-
// src/schema/SchemaPropertyHeading.vue?vue&type=script&setup=true&lang.ts
|
|
20
|
-
var ue = { class: "property-heading [&>.property-detail:has(+.property-detail)]:mr-0" }, de = { class: "text-c-3 font-code mr-2 text-xs" }, fe = { "aria-hidden": "true" }, pe = { class: "sr-only" }, me = {
|
|
21
|
-
key: 2,
|
|
22
|
-
class: "property-discriminator"
|
|
23
|
-
}, O = { class: "font-code text-c-accent" }, he = { class: "screenreader-only" }, k = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "property-type-signature text-c-2 text-(length:--scalar-mini)"
|
|
26
|
-
}, A = {
|
|
27
|
-
key: 1,
|
|
28
|
-
class: "property-type-signature text-c-2 text-(length:--scalar-mini)"
|
|
29
|
-
}, j = { class: "text-c-2 mr-2 text-xs" }, M = { class: "sr-only" }, N = {
|
|
30
|
-
key: 0,
|
|
31
|
-
class: "screenreader-only"
|
|
32
|
-
}, P = {
|
|
33
|
-
key: 4,
|
|
34
|
-
class: "property-additional"
|
|
35
|
-
}, F = {
|
|
36
|
-
key: 5,
|
|
37
|
-
class: "property-deprecated"
|
|
38
|
-
}, I = {
|
|
39
|
-
key: 6,
|
|
40
|
-
class: "text-c-2"
|
|
41
|
-
}, L = {
|
|
42
|
-
key: 7,
|
|
43
|
-
class: "property-const"
|
|
44
|
-
}, ge = {
|
|
45
|
-
key: 9,
|
|
46
|
-
class: "property-write-only"
|
|
47
|
-
}, _e = {
|
|
48
|
-
key: 10,
|
|
49
|
-
class: "property-read-only"
|
|
50
|
-
}, ve = {
|
|
51
|
-
key: 11,
|
|
52
|
-
class: "property-required"
|
|
53
|
-
}, R = "min-w-0 wrap-anywhere whitespace-normal", z = /*@__PURE__*/ m({
|
|
54
|
-
__name: "SchemaPropertyHeading",
|
|
55
|
-
props: {
|
|
56
|
-
value: {},
|
|
57
|
-
badges: {},
|
|
58
|
-
enum: { type: Boolean },
|
|
59
|
-
isDiscriminator: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: !1
|
|
62
|
-
},
|
|
63
|
-
discriminatorValue: {},
|
|
64
|
-
required: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: !1
|
|
67
|
-
},
|
|
68
|
-
additional: { type: Boolean },
|
|
69
|
-
withExamples: {
|
|
70
|
-
type: Boolean,
|
|
71
|
-
default: !0
|
|
72
|
-
},
|
|
73
|
-
hideModelNames: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
default: !1
|
|
76
|
-
},
|
|
77
|
-
modelLinkOptions: {},
|
|
78
|
-
modelName: {},
|
|
79
|
-
propertyNames: {},
|
|
80
|
-
eventBus: { default: null },
|
|
81
|
-
keyKind: {},
|
|
82
|
-
recursiveTo: {}
|
|
83
|
-
},
|
|
84
|
-
setup(m) {
|
|
85
|
-
let z = m, { translate: B } = te(), V = s(() => z.value?.[ne]), H = s(() => z.recursiveTo ?? z.value?.[ie]), U = s(() => z.value?.[re]), W = s(() => U.value === "explicit" ? "Explicit presence: Protobuf distinguishes an unset field from one set to its default value." : "Implicit presence: Protobuf does not distinguish an unset field from one set to its default value."), G = le(z, "value"), K = s(() => {
|
|
86
|
-
let e = z.badges;
|
|
87
|
-
if (e) return {
|
|
88
|
-
before: e.filter((e) => e.position === "before"),
|
|
89
|
-
after: e.filter((e) => e.position !== "before")
|
|
90
|
-
};
|
|
91
|
-
}), q = s(() => {
|
|
92
|
-
if (!G.value) return;
|
|
93
|
-
let e = G.value;
|
|
94
|
-
if (e.const !== void 0) return e.const;
|
|
95
|
-
if (e.enum?.length === 1) return e.enum[0];
|
|
96
|
-
if (C(e) && e.items) {
|
|
97
|
-
let t = S.schema(e.items);
|
|
98
|
-
if (E(t.const)) return t.const;
|
|
99
|
-
if (t.enum?.length === 1) return t.enum[0];
|
|
100
|
-
}
|
|
101
|
-
}), J = (e) => {
|
|
102
|
-
let t = [];
|
|
103
|
-
return T(e) && (E(e.minLength) && t.push({
|
|
104
|
-
key: "min-length",
|
|
105
|
-
prefix: `${B("schema.minLength")}: `,
|
|
106
|
-
value: e.minLength
|
|
107
|
-
}), E(e.maxLength) && t.push({
|
|
108
|
-
key: "max-length",
|
|
109
|
-
prefix: `${B("schema.maxLength")}: `,
|
|
110
|
-
value: e.maxLength
|
|
111
|
-
})), (T(e) || w(e)) && e.format && t.push({
|
|
112
|
-
key: "format",
|
|
113
|
-
value: e.format,
|
|
114
|
-
truncate: !0
|
|
115
|
-
}), w(e) && (E(e.exclusiveMinimum) && t.push({
|
|
116
|
-
key: "exclusive-minimum",
|
|
117
|
-
prefix: `${B("schema.greaterThan")}: `,
|
|
118
|
-
value: e.exclusiveMinimum
|
|
119
|
-
}), E(e.minimum) && t.push({
|
|
120
|
-
key: "minimum",
|
|
121
|
-
prefix: `${B("schema.min")}: `,
|
|
122
|
-
value: e.minimum
|
|
123
|
-
}), E(e.exclusiveMaximum) && t.push({
|
|
124
|
-
key: "exclusive-maximum",
|
|
125
|
-
prefix: `${B("schema.lessThan")}: `,
|
|
126
|
-
value: e.exclusiveMaximum
|
|
127
|
-
}), E(e.maximum) && t.push({
|
|
128
|
-
key: "maximum",
|
|
129
|
-
prefix: `${B("schema.max")}: `,
|
|
130
|
-
value: e.maximum
|
|
131
|
-
}), E(e.multipleOf) && t.push({
|
|
132
|
-
key: "multiple-of",
|
|
133
|
-
prefix: `${B("schema.multipleOf")}: `,
|
|
134
|
-
value: e.multipleOf
|
|
135
|
-
})), t;
|
|
136
|
-
}, ye = s(() => {
|
|
137
|
-
if (!G.value) return [];
|
|
138
|
-
let e = G.value, t = [];
|
|
139
|
-
return C(e) && ((E(e.minItems) || E(e.maxItems)) && t.push({
|
|
140
|
-
key: "array-range",
|
|
141
|
-
value: `${e.minItems ?? ""}…${e.maxItems ?? ""}`
|
|
142
|
-
}), e.uniqueItems && t.push({
|
|
143
|
-
key: "unique-items",
|
|
144
|
-
value: `${B("schema.unique")}!`
|
|
145
|
-
})), t.push(...J(e)), C(e) && e.items && t.push(...J(S.schema(e.items))), t;
|
|
146
|
-
}), Y = s(() => !z.value || z.hideModelNames ? null : z.modelName ? {
|
|
147
|
-
schemaKey: z.modelName,
|
|
148
|
-
label: z.modelName
|
|
149
|
-
} : ee(z.value)), be = s(() => r(Y.value?.schemaKey, z.modelLinkOptions ?? {})), X = s(() => n(z.value, {
|
|
150
|
-
hideModelNames: z.hideModelNames,
|
|
151
|
-
modelName: Y.value?.label
|
|
152
|
-
})), xe = s(() => !z.value || !("type" in z.value) ? !1 : z.value.type === "array" || !q.value), Z = s(() => {
|
|
153
|
-
let e = z.propertyNames;
|
|
154
|
-
if (!e) return;
|
|
155
|
-
let n = [t(e)];
|
|
156
|
-
"format" in e && typeof e.format == "string" && n.push(e.format);
|
|
157
|
-
let r = n.filter(Boolean).join(" · ");
|
|
158
|
-
return r.length > 0 ? r : void 0;
|
|
159
|
-
}), Q = s(() => {
|
|
160
|
-
if (z.value && "example" in z.value && z.value.example !== void 0) return z.value.example;
|
|
161
|
-
if (z.value && C(z.value) && !z.value.examples?.length) {
|
|
162
|
-
let e = S.schema(z.value.items);
|
|
163
|
-
if (e && "example" in e && e.example !== void 0) return e.example;
|
|
164
|
-
}
|
|
165
|
-
}), Se = s(() => {
|
|
166
|
-
if (Q.value !== void 0) return !0;
|
|
167
|
-
let e = z.value?.examples;
|
|
168
|
-
return !!e && typeof e == "object" && Object.keys(e).length > 0;
|
|
169
|
-
}), $ = s(() => {
|
|
170
|
-
let e = G.value;
|
|
171
|
-
if (e) {
|
|
172
|
-
if (T(e) && e.pattern) return e.pattern;
|
|
173
|
-
if (C(e) && e.items) {
|
|
174
|
-
let t = S.schema(e.items);
|
|
175
|
-
if (T(t) && t.pattern) return t.pattern;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
return (t, n) => (g(), u("div", ue, [
|
|
180
|
-
(g(!0), u(o, null, _(K.value?.before, (t, n) => (g(), c(e, {
|
|
181
|
-
key: n,
|
|
182
|
-
class: h(R),
|
|
183
|
-
color: t.color
|
|
184
|
-
}, {
|
|
185
|
-
default: x(() => [f(y(t.name), 1)]),
|
|
186
|
-
_: 2
|
|
187
|
-
}, 1032, ["color"]))), 128)),
|
|
188
|
-
t.$slots.name ? (g(), u("div", {
|
|
189
|
-
key: 0,
|
|
190
|
-
class: h(["property-name", { deprecated: z.value?.deprecated }])
|
|
191
|
-
}, [v(t.$slots, "name", {}, void 0, !0)], 2)) : l("", !0),
|
|
192
|
-
V.value === void 0 ? l("", !0) : (g(), c(b(D), {
|
|
193
|
-
key: 1,
|
|
194
|
-
content: "Protobuf field number"
|
|
195
|
-
}, {
|
|
196
|
-
default: x(() => [d("span", de, [d("span", fe, "#" + y(V.value), 1), d("span", pe, "Protobuf field number: " + y(V.value), 1)])]),
|
|
197
|
-
_: 1
|
|
198
|
-
})),
|
|
199
|
-
z.isDiscriminator ? (g(), u("div", me, y(b(B)("schema.discriminator")), 1)) : l("", !0),
|
|
200
|
-
z.value ? (g(), u(o, { key: 3 }, [
|
|
201
|
-
z.keyKind ? (g(), c(a, {
|
|
202
|
-
key: 0,
|
|
203
|
-
class: "property-key-kind"
|
|
204
|
-
}, {
|
|
205
|
-
default: x(() => [d("span", O, y(z.keyKind === "pattern" ? "patternProperty" : "additionalProperty"), 1)]),
|
|
206
|
-
_: 1
|
|
207
|
-
})) : l("", !0),
|
|
208
|
-
xe.value ? (g(), c(a, {
|
|
209
|
-
key: 1,
|
|
210
|
-
truncate: ""
|
|
211
|
-
}, {
|
|
212
|
-
default: x(() => [d("span", he, y(b(B)("schema.type")) + ": ", 1), z.eventBus && Y.value?.schemaKey && be.value ? (g(), u("button", {
|
|
213
|
-
key: 0,
|
|
214
|
-
class: "text-c-2 hover:text-c-1 underline",
|
|
215
|
-
type: "button",
|
|
216
|
-
onClick: n[0] ||= (e) => z.eventBus.emit("scroll-to:model-by-name", { name: Y.value.schemaKey })
|
|
217
|
-
}, [X.value.length ? (g(), u("span", k, [(g(!0), u(o, null, _(X.value, (e, t) => (g(), u(o, { key: t }, [f(y(t > 0 ? " " : ""), 1), d("span", { class: h(["property-type-token", [
|
|
218
|
-
`property-type-token--${e.kind}`,
|
|
219
|
-
e.kind === "word" ? "font-sans" : "",
|
|
220
|
-
e.kind === "ident" || e.kind === "literal" ? "font-code" : "",
|
|
221
|
-
e.kind === "punctuation" ? "text-c-2" : ""
|
|
222
|
-
]]) }, y(e.text), 3)], 64))), 128))])) : l("", !0)])) : X.value.length ? (g(), u("span", A, [(g(!0), u(o, null, _(X.value, (e, t) => (g(), u(o, { key: t }, [f(y(t > 0 ? " " : ""), 1), d("span", { class: h(["property-type-token", [
|
|
223
|
-
`property-type-token--${e.kind}`,
|
|
224
|
-
e.kind === "word" ? "font-sans" : "",
|
|
225
|
-
e.kind === "ident" || e.kind === "literal" ? "font-code" : "",
|
|
226
|
-
e.kind === "punctuation" ? "text-c-2" : ""
|
|
227
|
-
]]) }, y(e.text), 3)], 64))), 128))])) : l("", !0)]),
|
|
228
|
-
_: 1
|
|
229
|
-
})) : l("", !0),
|
|
230
|
-
H.value ? (g(), c(a, {
|
|
231
|
-
key: 2,
|
|
232
|
-
class: "property-recursive",
|
|
233
|
-
title: b(B)("schema.recursiveReference", { name: H.value })
|
|
234
|
-
}, {
|
|
235
|
-
default: x(() => [f(y(b(B)("schema.recursive")), 1)]),
|
|
236
|
-
_: 1
|
|
237
|
-
}, 8, ["title"])) : l("", !0),
|
|
238
|
-
U.value ? (g(), c(b(D), {
|
|
239
|
-
key: 3,
|
|
240
|
-
content: W.value
|
|
241
|
-
}, {
|
|
242
|
-
default: x(() => [d("span", j, [n[1] ||= d("span", { "aria-hidden": "true" }, "optional", -1), d("span", M, "Optional (" + y(U.value) + " presence). " + y(W.value), 1)])]),
|
|
243
|
-
_: 1
|
|
244
|
-
}, 8, ["content"])) : l("", !0),
|
|
245
|
-
Z.value ? (g(), c(a, {
|
|
246
|
-
key: 4,
|
|
247
|
-
truncate: ""
|
|
248
|
-
}, {
|
|
249
|
-
prefix: x(() => [f(y(b(B)("schema.keys")) + ":", 1)]),
|
|
250
|
-
default: x(() => [f(" " + y(Z.value), 1)]),
|
|
251
|
-
_: 1
|
|
252
|
-
})) : l("", !0),
|
|
253
|
-
(g(!0), u(o, null, _(ye.value, (e) => (g(), c(a, {
|
|
254
|
-
key: e.key,
|
|
255
|
-
code: e.code,
|
|
256
|
-
truncate: e.truncate
|
|
257
|
-
}, ce({
|
|
258
|
-
default: x(() => [e.key === "format" ? (g(), u("span", N, y(b(B)("schema.format")) + ": ", 1)) : l("", !0), f(" " + y(e.value), 1)]),
|
|
259
|
-
_: 2
|
|
260
|
-
}, [e.prefix ? {
|
|
261
|
-
name: "prefix",
|
|
262
|
-
fn: x(() => [f(y(e.prefix), 1)]),
|
|
263
|
-
key: "0"
|
|
264
|
-
} : void 0]), 1032, ["code", "truncate"]))), 128)),
|
|
265
|
-
z.enum ? (g(), c(a, { key: 5 }, {
|
|
266
|
-
default: x(() => [f(y(b(B)("schema.enum")), 1)]),
|
|
267
|
-
_: 1
|
|
268
|
-
})) : l("", !0)
|
|
269
|
-
], 64)) : l("", !0),
|
|
270
|
-
z.additional ? (g(), u("div", P, [z.value?.["x-additionalPropertiesName"] ? (g(), u(o, { key: 0 }, [f(y(z.value["x-additionalPropertiesName"]), 1)], 64)) : (g(), u(o, { key: 1 }, [f(y(b(B)("schema.additionalProperties")), 1)], 64))])) : l("", !0),
|
|
271
|
-
z.value?.deprecated ? (g(), u("div", F, [p(e, null, {
|
|
272
|
-
default: x(() => [f(y(b(B)("schema.deprecated")), 1)]),
|
|
273
|
-
_: 1
|
|
274
|
-
})])) : l("", !0),
|
|
275
|
-
(g(!0), u(o, null, _(K.value?.after, (t, n) => (g(), c(e, {
|
|
276
|
-
key: n,
|
|
277
|
-
class: h(R),
|
|
278
|
-
color: t.color
|
|
279
|
-
}, {
|
|
280
|
-
default: x(() => [f(y(t.name), 1)]),
|
|
281
|
-
_: 2
|
|
282
|
-
}, 1032, ["color"]))), 128)),
|
|
283
|
-
m.discriminatorValue === void 0 ? l("", !0) : (g(), u("span", I, [f(y(b(B)("schema.discriminatorValue")) + ": ", 1), p(i, { value: m.discriminatorValue }, null, 8, ["value"])])),
|
|
284
|
-
q.value === void 0 ? (g(), u(o, { key: 8 }, [z.value?.nullable === !0 ? (g(), c(a, { key: 0 }, {
|
|
285
|
-
default: x(() => [f(y(b(B)("schema.nullable")), 1)]),
|
|
286
|
-
_: 1
|
|
287
|
-
})) : l("", !0)], 64)) : (g(), u("div", L, [p(a, { truncate: "" }, {
|
|
288
|
-
prefix: x(() => [f(y(b(B)("schema.const")) + ": ", 1)]),
|
|
289
|
-
default: x(() => [p(i, { value: q.value }, null, 8, ["value"])]),
|
|
290
|
-
_: 1
|
|
291
|
-
})])),
|
|
292
|
-
z.value?.writeOnly ? (g(), u("div", ge, y(b(B)("schema.writeOnly")), 1)) : z.value?.readOnly ? (g(), u("div", _e, y(b(B)("schema.readOnly")), 1)) : l("", !0),
|
|
293
|
-
z.required ? (g(), u("div", ve, y(b(B)("schema.required")), 1)) : l("", !0),
|
|
294
|
-
z.value?.default === void 0 ? l("", !0) : (g(), c(ae, {
|
|
295
|
-
key: 12,
|
|
296
|
-
value: z.value?.default
|
|
297
|
-
}, null, 8, ["value"])),
|
|
298
|
-
$.value ? (g(), c(se, {
|
|
299
|
-
key: 13,
|
|
300
|
-
pattern: $.value
|
|
301
|
-
}, null, 8, ["pattern"])) : l("", !0),
|
|
302
|
-
z.withExamples && Se.value ? (g(), c(oe, {
|
|
303
|
-
key: 14,
|
|
304
|
-
example: Q.value,
|
|
305
|
-
examples: z.value?.examples
|
|
306
|
-
}, null, 8, ["example", "examples"])) : l("", !0),
|
|
307
|
-
v(t.$slots, "preview", {}, void 0, !0),
|
|
308
|
-
v(t.$slots, "trailing", {}, void 0, !0)
|
|
309
|
-
]));
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
export { z as default };
|
|
313
|
-
|
|
314
|
-
//# sourceMappingURL=SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map
|