@scalar/blocks 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
  3. package/dist/code-example/components/AsyncApiCodeExample.vue.js +1 -2
  4. package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
  5. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
  6. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
  8. package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
  9. package/dist/code-example/components/CodeExample.vue.js +4 -5
  10. package/dist/code-example/components/CodeExample.vue.js.map +1 -1
  11. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +102 -100
  12. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/code-example/components/ExamplePicker.vue.js +1 -2
  14. package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
  15. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +1 -2
  16. package/dist/code-example/components/HttpMethod.vue.js +1 -2
  17. package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
  18. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +1 -2
  19. package/dist/code-example/helpers/filter-clients-by-query.js +1 -2
  20. package/dist/code-example/helpers/find-client.js +1 -2
  21. package/dist/code-example/helpers/format-language.js +1 -2
  22. package/dist/code-example/helpers/generate-client-options.js +1 -2
  23. package/dist/code-example/helpers/generate-code-snippet.d.ts +2 -1
  24. package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
  25. package/dist/code-example/helpers/generate-code-snippet.js +11 -11
  26. package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
  27. package/dist/code-example/helpers/get-asyncapi-example-context.js +1 -2
  28. package/dist/code-example/helpers/get-clients.js +8 -9
  29. package/dist/code-example/helpers/get-custom-code-samples.js +1 -2
  30. package/dist/code-example/helpers/get-generated-payload-example.js +1 -2
  31. package/dist/code-example/helpers/get-message-example-content.js +1 -2
  32. package/dist/code-example/helpers/get-secrets.js +1 -2
  33. package/dist/code-example/helpers/get-snippet.js +1 -2
  34. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +2 -1
  35. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  36. package/dist/code-example/helpers/operation-to-har/operation-to-har.js +32 -31
  37. package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
  38. package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
  39. package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
  40. package/dist/code-example/helpers/operation-to-har/process-body.js +80 -52
  41. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  42. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts +2 -1
  43. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  44. package/dist/code-example/helpers/operation-to-har/process-parameters.js +65 -58
  45. package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
  46. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +1 -2
  47. package/dist/code-example/helpers/operation-to-har/process-server-url.js +1 -2
  48. package/dist/code-example/index.js +10 -10
  49. package/dist/code-example/mount-asyncapi.js +7 -8
  50. package/dist/code-example/mount.js +5 -6
  51. package/dist/constants.js +2 -3
  52. package/dist/schema/LinkButton.vue.js +1 -2
  53. package/dist/schema/RenderString.vue.js +1 -2
  54. package/dist/schema/RenderString.vue.js.map +1 -1
  55. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +1 -2
  56. package/dist/schema/Schema.vue.js +4 -5
  57. package/dist/schema/Schema.vue.js.map +1 -1
  58. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +67 -68
  59. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
  60. package/dist/schema/SchemaCollapsedPreview.vue.js +1 -2
  61. package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
  62. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +1 -2
  63. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/schema/SchemaComposition.vue.js +4 -5
  65. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  66. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +26 -27
  67. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/schema/SchemaEnumPropertyItem.vue.js +1 -2
  69. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  70. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +1 -2
  71. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/schema/SchemaEnums.vue.js +4 -5
  73. package/dist/schema/SchemaEnums.vue.js.map +1 -1
  74. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +12 -13
  75. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/schema/SchemaGlyphPuck.vue.js +1 -2
  77. package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
  78. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +1 -2
  79. package/dist/schema/SchemaGutterToggle.vue.js +1 -2
  80. package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
  81. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +1 -2
  82. package/dist/schema/SchemaHeading.vue.js +4 -5
  83. package/dist/schema/SchemaHeading.vue.js.map +1 -1
  84. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +1 -2
  85. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
  86. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +1 -2
  87. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
  88. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +1 -2
  89. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/schema/SchemaObjectProperties.vue.js +1 -2
  91. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  92. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +1 -2
  93. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/schema/SchemaProperty.vue.js +4 -5
  95. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  96. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +48 -49
  97. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/schema/SchemaPropertyDefault.vue.js +4 -5
  99. package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
  100. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +9 -10
  101. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/schema/SchemaPropertyDetail.vue.js +4 -5
  103. package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
  104. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +1 -2
  105. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
  106. package/dist/schema/SchemaPropertyExamples.vue.js +4 -5
  107. package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
  108. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +18 -19
  109. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +1 -1
  110. package/dist/schema/SchemaPropertyHeading.vue.js +4 -5
  111. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  112. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +101 -102
  113. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
  114. package/dist/schema/SchemaPropertyPattern.vue.js +4 -5
  115. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  116. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +1 -2
  117. package/dist/schema/SchemaRailPanel.vue.js +1 -2
  118. package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
  119. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +1 -2
  120. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  121. package/dist/schema/components/CopyLinkButton.vue.js +1 -2
  122. package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
  123. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +1 -2
  124. package/dist/schema/components/WithBreadcrumb.vue.js +1 -2
  125. package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
  126. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +1 -2
  127. package/dist/schema/discriminator-metadata.js +1 -2
  128. package/dist/schema/helpers/dynamic-scope.js +1 -2
  129. package/dist/schema/helpers/format-example.js +1 -2
  130. package/dist/schema/helpers/format-value.js +1 -2
  131. package/dist/schema/helpers/get-compositions-to-render.js +19 -20
  132. package/dist/schema/helpers/get-discriminator-values.js +1 -2
  133. package/dist/schema/helpers/get-enum-values.js +1 -2
  134. package/dist/schema/helpers/get-property-description.js +1 -2
  135. package/dist/schema/helpers/get-ref-name.js +1 -2
  136. package/dist/schema/helpers/get-rendered-example.js +1 -2
  137. package/dist/schema/helpers/get-schema-type.js +1 -2
  138. package/dist/schema/helpers/get-type-signature-tokens.d.ts +2 -2
  139. package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
  140. package/dist/schema/helpers/get-type-signature-tokens.js +3 -4
  141. package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
  142. package/dist/schema/helpers/has-complex-array-items.js +1 -2
  143. package/dist/schema/helpers/index.js +13 -13
  144. package/dist/schema/helpers/is-empty-schema-object.js +1 -2
  145. package/dist/schema/helpers/is-model-linkable.js +1 -2
  146. package/dist/schema/helpers/is-on-schema-target-path.js +1 -2
  147. package/dist/schema/helpers/is-type-object.js +1 -2
  148. package/dist/schema/helpers/merge-all-of-schemas.js +1 -2
  149. package/dist/schema/helpers/normalize-object-composition.js +1 -2
  150. package/dist/schema/helpers/optimize-value-for-display.js +1 -2
  151. package/dist/schema/helpers/partition-all-of-compositions.js +1 -2
  152. package/dist/schema/helpers/schema-composition.js +1 -2
  153. package/dist/schema/helpers/schema-cycle.js +1 -2
  154. package/dist/schema/helpers/schema-expansion.js +1 -2
  155. package/dist/schema/helpers/schema-keyboard-nav.js +1 -2
  156. package/dist/schema/helpers/schema-name.js +2 -3
  157. package/dist/schema/helpers/schema-name.js.map +1 -1
  158. package/dist/schema/helpers/should-display-description.js +1 -2
  159. package/dist/schema/helpers/should-display-heading.js +1 -2
  160. package/dist/schema/helpers/should-render-array-item-composition.js +1 -2
  161. package/dist/schema/helpers/sort-property-names.js +1 -2
  162. package/dist/schema/helpers/unwrap-for-read.js +1 -2
  163. package/dist/schema/index.js +8 -8
  164. package/dist/schema/localization/index.js +1 -2
  165. package/dist/schema/localization/locales/ar.js +1 -2
  166. package/dist/schema/localization/locales/de.js +1 -2
  167. package/dist/schema/localization/locales/en.js +1 -2
  168. package/dist/schema/localization/locales/es.js +1 -2
  169. package/dist/schema/localization/locales/fr.js +1 -2
  170. package/dist/schema/localization/locales/pt.js +1 -2
  171. package/dist/schema/localization/locales/ru.js +1 -2
  172. package/dist/schema/localization/locales/zh-cn.js +1 -2
  173. package/dist/schema/localization/locales/zh-tw.js +1 -2
  174. package/dist/schema/localization/translations.js +1 -2
  175. package/dist/schema/protobuf-metadata.js +1 -2
  176. package/dist/schema/recursive-metadata.js +1 -2
  177. package/dist/schema/request-body-composition-index.js +1 -2
  178. package/dist/shared/Badge.vue.d.ts.map +1 -1
  179. package/dist/shared/Badge.vue.js +4 -5
  180. package/dist/shared/Badge.vue.js.map +1 -1
  181. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +2 -3
  182. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  183. package/dist/shared/ExternalDocs.vue.js +1 -2
  184. package/dist/shared/ExternalDocs.vue.js.map +1 -1
  185. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +1 -2
  186. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  187. package/dist/shared/ScreenReader.vue.js +1 -2
  188. package/dist/shared/ScreenReader.vue.js.map +1 -1
  189. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +1 -2
  190. package/dist/shared/index.js +4 -4
  191. package/dist/specification-extensions/ExtensionValue.vue.js +1 -2
  192. package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
  193. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +5 -6
  194. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  195. package/dist/specification-extensions/SpecificationExtensions.vue.js +1 -2
  196. package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
  197. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +1 -2
  198. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +1 -1
  199. package/dist/style.css +40 -20
  200. package/dist/vue-styles.css +1 -1
  201. package/package.json +22 -22
@@ -1,12 +1,12 @@
1
- import { normalizeRenderedExamples as e } from "./helpers/get-rendered-example.js";
2
- import t from "./LinkButton.vue.js";
3
- import { useLocalization as n } from "./localization/index.js";
4
- import { formatExample as r } from "./helpers/format-example.js";
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
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
6
  import { ScalarIcon as b } from "@scalar/components/icon";
7
7
  import { useClipboard as x } from "@scalar/use-hooks/useClipboard";
8
8
  import { onClickOutside as S, onKeyStroke as C } from "@vueuse/core";
9
- //#region src/schema/SchemaPropertyExamples.vue?vue&type=script&setup=true&lang.ts
9
+ // src/schema/SchemaPropertyExamples.vue?vue&type=script&setup=true&lang.ts
10
10
  var w = ["id"], T = ["aria-label"], E = ["id"], D = {
11
11
  key: 0,
12
12
  class: "text-c-2 font-sans text-xs font-normal break-words"
@@ -18,12 +18,12 @@ var w = ["id"], T = ["aria-label"], E = ["id"], D = {
18
18
  example: {}
19
19
  },
20
20
  setup(d) {
21
- let { copyToClipboard: A } = x(), { translate: j } = n(), M = a(() => d.example !== void 0), N = a(() => e(d.examples, { allowRawObjects: !0 }).map((e) => {
22
- let t = e.summary || e.name, n = r(e.value);
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
23
  return {
24
- label: t,
25
- value: n,
26
- ariaLabel: `${j("common.copyExample")}: ${t ? `${t}: ` : ""}${n}`
24
+ label: n,
25
+ value: r,
26
+ ariaLabel: `${j("common.copyExample")}: ${n ? `${n}: ` : ""}${r}`
27
27
  };
28
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
29
  W = !0, window.clearTimeout(G), G = window.setTimeout(() => {
@@ -56,20 +56,20 @@ var w = ["id"], T = ["aria-label"], E = ["id"], D = {
56
56
  };
57
57
  return C("Escape", () => {
58
58
  $(R, I, L), $(H, B, V);
59
- }), (e, n) => (p(), s(i, null, [M.value ? (p(), s("div", {
59
+ }), (t, r) => (p(), s(i, null, [M.value ? (p(), s("div", {
60
60
  key: 0,
61
61
  ref_key: "singleRootRef",
62
62
  ref: I,
63
63
  class: f(["property-example", { "is-open": R.value }]),
64
64
  onFocusin: Y,
65
65
  onFocusout: X
66
- }, [u(t, {
66
+ }, [u(n, {
67
67
  ref_key: "singleTriggerRef",
68
68
  ref: L,
69
69
  "aria-controls": _(z),
70
70
  "aria-expanded": R.value,
71
71
  class: "decoration-dotted",
72
- onClick: n[0] ||= (e) => R.value = !R.value,
72
+ onClick: r[0] ||= (e) => R.value = !R.value,
73
73
  onPointerdown: q
74
74
  }, {
75
75
  default: y(() => [l(g(_(j)("schema.example")), 1)]),
@@ -81,11 +81,11 @@ var w = ["id"], T = ["aria-label"], E = ["id"], D = {
81
81
  "property-example-value-list-start": d.align === "start"
82
82
  }])
83
83
  }, [c("button", {
84
- "aria-label": `${_(j)("common.copyExample")}: ${_(r)(d.example)}`,
84
+ "aria-label": `${_(j)("common.copyExample")}: ${_(e)(d.example)}`,
85
85
  class: "property-example-value group",
86
86
  type: "button",
87
- onClick: n[1] ||= (e) => _(A)(_(r)(d.example))
88
- }, [c("span", null, g(_(r)(d.example)), 1), u(_(b), {
87
+ onClick: r[1] ||= (t) => _(A)(_(e)(d.example))
88
+ }, [c("span", null, g(_(e)(d.example)), 1), u(_(b), {
89
89
  "aria-hidden": "true",
90
90
  class: "group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3",
91
91
  icon: "Clipboard",
@@ -97,13 +97,13 @@ var w = ["id"], T = ["aria-label"], E = ["id"], D = {
97
97
  class: f(["property-example", { "is-open": H.value }]),
98
98
  onFocusin: Z,
99
99
  onFocusout: Q
100
- }, [u(t, {
100
+ }, [u(n, {
101
101
  ref_key: "multipleTriggerRef",
102
102
  ref: V,
103
103
  "aria-controls": _(U),
104
104
  "aria-expanded": H.value,
105
105
  class: "decoration-dotted",
106
- onClick: n[2] ||= (e) => H.value = !H.value,
106
+ onClick: r[2] ||= (e) => H.value = !H.value,
107
107
  onPointerdown: q
108
108
  }, {
109
109
  default: y(() => [l(g(F.value), 1)]),
@@ -130,7 +130,6 @@ var w = ["id"], T = ["aria-label"], E = ["id"], D = {
130
130
  })], 8, O)]))), 128))], 10, E)], 34)) : o("", !0)], 64));
131
131
  }
132
132
  });
133
- //#endregion
134
133
  export { A as default };
135
134
 
136
135
  //# sourceMappingURL=SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
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","_createCommentVNode","_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,kCA4EMmB,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,KAAKE;GAChF;EACF,CACF,CACF,GAEMG,IAAsBT,QAAeE,EAAmB,MAAM,SAAS,CAAC,GAExEQ,IAAwBV,QAC5BE,EAAmB,MAAM,WAAW,IAChCM,EAAU,gBAAgB,IAC1BA,EAAU,iBAAiB,CACjC,GAOMG,IAAgBC,EAAwB,IAAI,GAC5CC,IAAmBD,EAA+C,IAAI,GACtEE,IAAeF,EAAI,EAAK,GACxBG,IAAgBC,EAAM,GAEtBC,IAAkBL,EAAwB,IAAI,GAC9CM,IAAqBN,EAA+C,IAAI,GACxEO,IAAiBP,EAAI,EAAK,GAC1BQ,IAAkBJ,EAAM,GAO1BK,IAAkB,IAIlBC,IAAoB,GAMpBC,IAAiB,IAEfC,UAA4B;GAOhC,AAFA,IAAkB,IAClB,OAAO,aA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,SAAAzC,QAA2B,CAAxBC,EAAAC,EAAAyB,EAAA,KAAqB,GAAA,CAAA,C;;E,2CAE1BxB,EA6BM,OAAA;GA5BH,IAAIJ,EAAAsC,CAAA;GACL,OAAKzC,EAAA,CAAC,2CAAyC;IAClB,SAAAwC,EAAA;IAA+D,qCAAAlB,EAAA,UAAK;;E,KAIjGzB,EAAA,EAAA,GAAAC,EAqBMC,GAAA,MAAAU,EApBgBc,EAAA,QAAZ,GAAI,OADd1B,EAAA,GAAAC,EAqBM,OAAA;GAnBE;GACN,OAAM;E,IAEE+E,EAAG,SADXhF,EAAA,GAAAC,EAIO,QAJPgB,GAIOR,EADFuE,EAAG,KAAK,GAAA,CAAA,K,WAEbtE,EAWS,UAAA;GAVN,cAAYsE,EAAG;GAChB,OAAM;GACN,MAAK;GACJ,UAAK,MAAE1E,EAAAsE,CAAA,CAAe,CAACI,EAAG,KAAK;E,IAChCtE,EAA2B,QAAA,MAAAD,EAAlBuE,EAAG,KAAK,GAAA,CAAA,GACjB5E,EAIcE,EAAAuE,CAAA,GAAA;GAHZ,eAAY;GACZ,OAAM;GACN,MAAK;GACL,MAAK"}
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,KAAKE;GAChF;EACF,CACF,CACF,GAEMG,IAAsBT,QAAeE,EAAmB,MAAM,SAAS,CAAC,GAExEQ,IAAwBV,QAC5BE,EAAmB,MAAM,WAAW,IAChCM,EAAU,gBAAgB,IAC1BA,EAAU,iBAAiB,CACjC,GAOMG,IAAgBC,EAAwB,IAAI,GAC5CC,IAAmBD,EAA+C,IAAI,GACtEE,IAAeF,EAAI,EAAK,GACxBG,IAAgBC,EAAM,GAEtBC,IAAkBL,EAAwB,IAAI,GAC9CM,IAAqBN,EAA+C,IAAI,GACxEO,IAAiBP,EAAI,EAAK,GAC1BQ,IAAkBJ,EAAM,GAO1BK,IAAkB,IAIlBC,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,AAAA4B,EAAA,QAAA,MAAE,EAAA,QAAc,CAAI5B,EAAA;GACzB,eAAaK;;GACd,SAAAxC,QAA2B,CAAxBC,EAAAC,EAAAwB,EAAA,KAAqB,GAAA,CAAA,C;;E,2CAE1BvB,EA6BM,OAAA;GA5BH,IAAIJ,EAAAqC,CAAA;GACL,OAAKxC,EAAA,CAAC,2CAAyC;IAClB,SAAAuC,EAAA;IAA+D,qCAAAlB,EAAA,UAAK;;E,KAIjGxB,EAAA,EAAA,GAAAC,EAqBMC,GAAA,MAAAS,EApBgBc,EAAA,QAAZ,GAAI,OADdzB,EAAA,GAAAC,EAqBM,OAAA;GAnBE;GACN,OAAM;E,IAEE8E,EAAG,SADX/E,EAAA,GAAAC,EAIO,QAJPe,GAIOP,EADFsE,EAAG,KAAK,GAAA,CAAA,K,WAEbrE,EAWS,UAAA;GAVN,cAAYqE,EAAG;GAChB,OAAM;GACN,MAAK;GACJ,UAAK,MAAEzE,EAAAqE,CAAA,CAAe,CAACI,EAAG,KAAK;E,IAChCrE,EAA2B,QAAA,MAAAD,EAAlBsE,EAAG,KAAK,GAAA,CAAA,GACjB3E,EAIcE,EAAAsE,CAAA,GAAA;GAHZ,eAAY;GACZ,OAAM;GACN,MAAK;GACL,MAAK"}
@@ -1,9 +1,8 @@
1
- import e from "../_virtual/_plugin-vue_export-helper.js";
2
- import t from "./SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js";
1
+ import e from "./SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js";
3
2
  /* empty css */
4
- //#region src/schema/SchemaPropertyHeading.vue
5
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-09888606"]]);
6
- //#endregion
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ // src/schema/SchemaPropertyHeading.vue
5
+ var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-09888606"]]);
7
6
  export { n as default };
8
7
 
9
8
  //# sourceMappingURL=SchemaPropertyHeading.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPropertyHeading.vue.js","names":["_sfc_main","_plugin_vue_export_helper_default","SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default","SchemaPropertyHeading_default"],"sources":["../../src/schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarTooltip } from '@scalar/components/tooltip'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport Badge from '../shared/Badge.vue'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getDisplayTypeSignatureTokens } from './helpers/get-type-signature-tokens'\nimport {\n isModelLinkable,\n type ModelLinkOptions,\n} from './helpers/is-model-linkable'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n protobufFieldNumber,\n protobufPresence,\n type ProtobufSchema,\n} from './protobuf-metadata'\nimport {\n schemaRecursiveTarget,\n type RecursiveSchema,\n} from './recursive-metadata'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\nimport SchemaPropertyPattern from './SchemaPropertyPattern.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n /** Effective AsyncAPI variant value, separate from const/enum constraints. */\n discriminatorValue?: string\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /**\n * Config for deciding whether a model name links to the models section. When the section or\n * the referenced model is hidden there is nothing to scroll to, so the name renders as plain text.\n */\n modelLinkOptions?: ModelLinkOptions\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n /**\n * The row's name is a stand-in for keys the caller chooses\n * (`additionalProperties`) or keys matching a regex (`patternProperties`),\n * not a literal property. The heading says so in the signature line, where\n * the tree already describes shapes, instead of styling the name itself.\n */\n keyKind?: 'additional' | 'pattern'\n /**\n * The name of the schema this row loops back to. A cut cycle is a leaf, so\n * the signature line says why it does not expand; the model link beside it\n * already names the schema the loop returns to.\n */\n recursiveTo?: string\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst fieldNumber = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufFieldNumber],\n)\n\nconst recursiveTarget = computed(\n () =>\n props.recursiveTo ??\n (props.value as RecursiveSchema | undefined)?.[schemaRecursiveTarget],\n)\n\nconst presence = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufPresence],\n)\nconst presenceDescription = computed(() =>\n presence.value === 'explicit'\n ? 'Explicit presence: Protobuf distinguishes an unset field from one set to its default value.'\n : 'Implicit presence: Protobuf does not distinguish an unset field from one set to its default value.',\n)\n\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\ntype ValidationProperty = {\n key: string\n value: string | number\n prefix?: string\n code?: boolean\n truncate?: boolean\n}\n\n/**\n * Constraints that live on a leaf (string or number) schema: length, pattern,\n * format and numeric ranges. Extracted so they can be surfaced for a primitive\n * schema as well as for a primitive array's items, which are not rendered on\n * their own. See https://github.com/scalar/scalar/issues/9690\n */\nconst getLeafConstraints = (schema: SchemaObject) => {\n const properties: ValidationProperty[] = []\n\n if (isStringSchema(schema)) {\n if (schema.minLength) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('schema.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (schema.maxLength) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('schema.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // pattern is rendered via SchemaPropertyPattern (hover dropdown), skip here\n }\n\n if ((isStringSchema(schema) || isNumberSchema(schema)) && schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('schema.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('schema.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('schema.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('schema.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('schema.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n}\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties: ValidationProperty[] = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (schema.minItems || schema.maxItems) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems || ''}…${schema.maxItems || ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('schema.unique')}!`,\n })\n }\n }\n\n properties.push(...getLeafConstraints(schema))\n\n // Primitive array items carry their own constraints (e.g. an array of `uuid`\n // strings) but are not rendered separately, so surface them here.\n if (isArraySchema(schema) && schema.items) {\n properties.push(...getLeafConstraints(resolve.schema(schema.items)))\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n return getModelNameWithArray(props.value)\n})\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, props.modelLinkOptions ?? {}),\n)\n\n/**\n * The type as a run of tokens rather than a single string — identifiers in\n * the code face, English words like `array of` in the sans face, and a muted\n * `|` so `string | null` reads as one type with an alternative.\n *\n * The token run and the screen-reader label are written straight into the\n * template instead of being their own components: the tree mounts one per\n * typed row, and a component instance costs more to create than the span it\n * renders. On a flat object the type cells would be most of the instance\n * count. The linked and the plain copy of the token markup below must stay\n * identical.\n */\nconst signatureTokens = computed(() =>\n getDisplayTypeSignatureTokens(props.value, {\n hideModelNames: props.hideModelNames,\n modelName: modelLink.value?.label,\n }),\n)\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n // An array's own examples take precedence over the fallback from its items.\n if (\n props.value &&\n isArraySchema(props.value) &&\n !props.value.examples?.length\n ) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n\n/**\n * Whether the examples chip has anything to render.\n *\n * `SchemaPropertyExamples` already renders nothing without an example, but it\n * still mounts, and mounting is what installs its popup's window-level click\n * and keydown listeners. `withExamples` defaults to true, so without this gate\n * every property row on the page — including a plain `{ type: 'string' }` —\n * pays for a popup it never opens. Mirrors the component's own two branches.\n */\nconst hasExampleContent = computed((): boolean => {\n if (exampleValue.value !== undefined) {\n return true\n }\n\n const examples = props.value?.examples\n\n return (\n !!examples &&\n typeof examples === 'object' &&\n Object.keys(examples).length > 0\n )\n})\n\n/**\n * The regex `pattern` to surface via the hover dropdown. It lives on a string\n * schema, or on the items of a primitive array (which is not rendered on its\n * own, so its constraints are surfaced on the array heading — see\n * https://github.com/scalar/scalar/issues/9690).\n */\nconst patternValue = computed(() => {\n const schema = valueRef.value\n if (!schema) {\n return undefined\n }\n\n if (isStringSchema(schema) && schema.pattern) {\n return schema.pattern\n }\n\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n if (isStringSchema(items) && items.pattern) {\n return items.pattern\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div\n class=\"property-heading [&>.property-detail:has(+.property-detail)]:mr-0\">\n <!-- `:has(+.property-detail)`: only a detail FOLLOWED BY another detail\n drops its right margin, because the `·` separator supplies the gap\n there. Not `:not(:last-of-type)`, which matches by element type: the\n collapsed preview and the trailing copy-link are spans as well, so it\n would strip the margin from the final detail and glue \"Addressrequired\"\n together on a collapsed row. -->\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <ScalarTooltip\n v-if=\"fieldNumber !== undefined\"\n content=\"Protobuf field number\">\n <span class=\"text-c-3 font-code mr-2 text-xs\">\n <span aria-hidden=\"true\">#{{ fieldNumber }}</span>\n <span class=\"sr-only\">Protobuf field number: {{ fieldNumber }}</span>\n </span>\n </ScalarTooltip>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('schema.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- A map key reads `additionalProperty · string`: the keyword leads the\n detail list in the accent colour, like a type word, so the name\n above it can look like every other name. -->\n <SchemaPropertyDetail\n v-if=\"props.keyKind\"\n class=\"property-key-kind\">\n <span class=\"font-code text-c-accent\">{{\n props.keyKind === 'pattern' ? 'patternProperty' : 'additionalProperty'\n }}</span>\n </SchemaPropertyDetail>\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <!-- The type is a token run (`array of Planet`) and a $ref link IS the\n type, not an appended `· Account` -->\n <!-- Written across lines on purpose: Vue drops whitespace-only text\n between two elements, so a single-line label would read\n `Type:string`. -->\n <span class=\"screenreader-only\"> {{ translate('schema.type') }}: </span>\n <button\n v-if=\"props.eventBus && modelLink?.schemaKey && modelLinkable\"\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n <span\n v-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </button>\n <span\n v-else-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </SchemaPropertyDetail>\n\n <!-- A cycle reads `array of Satellite · recursive`, a modifier like\n `nullable`; the full sentence rides the tooltip. -->\n <SchemaPropertyDetail\n v-if=\"recursiveTarget\"\n class=\"property-recursive\"\n :title=\"\n translate('schema.recursiveReference', { name: recursiveTarget })\n \">\n {{ translate('schema.recursive') }}\n </SchemaPropertyDetail>\n\n <ScalarTooltip\n v-if=\"presence\"\n :content=\"presenceDescription\">\n <span class=\"text-c-2 mr-2 text-xs\">\n <span aria-hidden=\"true\">optional</span>\n <span class=\"sr-only\"\n >Optional ({{ presence }} presence). {{ presenceDescription }}</span\n >\n </span>\n </ScalarTooltip>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('schema.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <span\n v-if=\"property.key === 'format'\"\n class=\"screenreader-only\">\n {{ translate('schema.format') }}:\n </span>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('schema.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('schema.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('schema.deprecated') }}</Badge>\n </div>\n <span\n v-if=\"discriminatorValue !== undefined\"\n class=\"text-c-2\">\n {{ translate('schema.discriminatorValue') }}:\n <RenderString :value=\"discriminatorValue\" />\n </span>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('schema.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('schema.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('schema.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('schema.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('schema.required') }}\n </div>\n <!-- Gated here, not only inside the component: each popup instance installs\n window-level click and keydown listeners for its dismissal, so mounting\n one per row costs the page a listener per row it never shows anything\n for. Same reason `SchemaPropertyPattern` below is gated. -->\n <SchemaPropertyDefault\n v-if=\"props.value?.default !== undefined\"\n :value=\"props.value?.default\" />\n <!--\n Pattern is a hover dropdown chip like Examples, not an inline constraint,\n so it sits beside the example. This keeps the real constraints (length,\n nullable, …) together in the dotted list. See #9966.\n -->\n <SchemaPropertyPattern\n v-if=\"patternValue\"\n :pattern=\"patternValue\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples && hasExampleContent\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n <!-- The collapsed preview rides the end of the heading line -->\n <slot name=\"preview\" />\n <!-- Last so the tab order matches the visual order: the trailing copy-link\n is painted at the row's right edge, after every control to its left -->\n <slot name=\"trailing\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n/*\n * Light-mode oranges are too bright on a light page for 13px text (the default\n * #ff5800 is 3.16:1), so blend the theme orange toward the text colour to reach\n * WCAG 1.4.3 (4.5:1) while keeping the hue and letting custom themes flow\n * through. Dark mode already passes (8.37:1) and keeps the plain token.\n */\n.light-mode .property-required {\n color: color-mix(\n in srgb,\n var(--scalar-color-orange),\n var(--scalar-color-1) 32%\n );\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaPropertyHeading.vue.js","names":["SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default","_plugin_vue_export_helper_default","SchemaPropertyHeading_default"],"sources":[],"mappings":""}