@scalar/blocks 0.5.1 → 0.5.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
  3. package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
  4. package/dist/code-example/components/CodeExample.vue.js +1 -1
  5. package/dist/code-example/components/CodeExample.vue.js.map +1 -1
  6. package/dist/code-example/components/CodeExample.vue.script.js +71 -68
  7. package/dist/code-example/components/CodeExample.vue.script.js.map +1 -1
  8. package/dist/code-example/helpers/generate-client-options.d.ts.map +1 -1
  9. package/dist/code-example/helpers/generate-client-options.js.map +1 -1
  10. package/dist/code-example/helpers/get-clients.d.ts.map +1 -1
  11. package/dist/code-example/helpers/get-clients.js.map +1 -1
  12. package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
  13. package/dist/code-example/helpers/operation-to-har/process-body.js +42 -42
  14. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  15. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  16. package/dist/code-example/helpers/operation-to-har/process-parameters.js +63 -62
  17. package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
  18. package/dist/code-example/mount.d.ts.map +1 -1
  19. package/dist/code-example/mount.js +1 -1
  20. package/dist/code-example/mount.js.map +1 -1
  21. package/dist/constants.js +1 -1
  22. package/dist/schema/Schema.vue.d.ts.map +1 -1
  23. package/dist/schema/Schema.vue.js +1 -1
  24. package/dist/schema/Schema.vue.js.map +1 -1
  25. package/dist/schema/Schema.vue.script.js +122 -116
  26. package/dist/schema/Schema.vue.script.js.map +1 -1
  27. package/dist/schema/SchemaComposition.vue.d.ts.map +1 -1
  28. package/dist/schema/SchemaComposition.vue.js +1 -1
  29. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  30. package/dist/schema/SchemaComposition.vue.script.js +110 -106
  31. package/dist/schema/SchemaComposition.vue.script.js.map +1 -1
  32. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  33. package/dist/schema/SchemaEnumPropertyItem.vue.script.js +2 -2
  34. package/dist/schema/SchemaEnumPropertyItem.vue.script.js.map +1 -1
  35. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  36. package/dist/schema/SchemaObjectProperties.vue.script.js +1 -1
  37. package/dist/schema/SchemaObjectProperties.vue.script.js.map +1 -1
  38. package/dist/schema/SchemaProperty.vue.d.ts +1 -1
  39. package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
  40. package/dist/schema/SchemaProperty.vue.js +1 -1
  41. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  42. package/dist/schema/SchemaProperty.vue.script.js +179 -164
  43. package/dist/schema/SchemaProperty.vue.script.js.map +1 -1
  44. package/dist/schema/SchemaPropertyHeading.vue.d.ts +5 -3
  45. package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  46. package/dist/schema/SchemaPropertyHeading.vue.js +1 -1
  47. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  48. package/dist/schema/SchemaPropertyHeading.vue.script.js +122 -117
  49. package/dist/schema/SchemaPropertyHeading.vue.script.js.map +1 -1
  50. package/dist/schema/SchemaPropertyPattern.vue.js +1 -1
  51. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  52. package/dist/schema/SchemaPropertyPattern.vue.script.js +1 -1
  53. package/dist/schema/SchemaPropertyPattern.vue.script.js.map +1 -1
  54. package/dist/schema/discriminator-metadata.d.ts +13 -0
  55. package/dist/schema/discriminator-metadata.d.ts.map +1 -0
  56. package/dist/schema/discriminator-metadata.js +6 -0
  57. package/dist/schema/discriminator-metadata.js.map +1 -0
  58. package/dist/schema/helpers/get-compositions-to-render.d.ts +3 -1
  59. package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
  60. package/dist/schema/helpers/get-compositions-to-render.js +25 -24
  61. package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
  62. package/dist/schema/helpers/get-property-description.d.ts +6 -3
  63. package/dist/schema/helpers/get-property-description.d.ts.map +1 -1
  64. package/dist/schema/helpers/get-property-description.js +10 -10
  65. package/dist/schema/helpers/get-property-description.js.map +1 -1
  66. package/dist/schema/helpers/has-complex-array-items.d.ts.map +1 -1
  67. package/dist/schema/helpers/has-complex-array-items.js +6 -2
  68. package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
  69. package/dist/schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
  70. package/dist/schema/helpers/merge-all-of-schemas.js +2 -2
  71. package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
  72. package/dist/schema/helpers/optimize-value-for-display.d.ts.map +1 -1
  73. package/dist/schema/helpers/optimize-value-for-display.js +34 -33
  74. package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
  75. package/dist/schema/helpers/partition-all-of-compositions.d.ts.map +1 -1
  76. package/dist/schema/helpers/partition-all-of-compositions.js +39 -27
  77. package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
  78. package/dist/schema/helpers/schema-name.js +1 -1
  79. package/dist/schema/helpers/schema-name.js.map +1 -1
  80. package/dist/schema/index.d.ts +2 -0
  81. package/dist/schema/index.d.ts.map +1 -1
  82. package/dist/schema/index.js +13 -11
  83. package/dist/schema/localization/index.d.ts +11 -1
  84. package/dist/schema/localization/index.d.ts.map +1 -1
  85. package/dist/schema/localization/locales/ar.d.ts +10 -0
  86. package/dist/schema/localization/locales/ar.d.ts.map +1 -1
  87. package/dist/schema/localization/locales/ar.js +11 -1
  88. package/dist/schema/localization/locales/ar.js.map +1 -1
  89. package/dist/schema/localization/locales/de.d.ts +10 -0
  90. package/dist/schema/localization/locales/de.d.ts.map +1 -1
  91. package/dist/schema/localization/locales/de.js +11 -1
  92. package/dist/schema/localization/locales/de.js.map +1 -1
  93. package/dist/schema/localization/locales/en.d.ts +10 -0
  94. package/dist/schema/localization/locales/en.d.ts.map +1 -1
  95. package/dist/schema/localization/locales/en.js +11 -1
  96. package/dist/schema/localization/locales/en.js.map +1 -1
  97. package/dist/schema/localization/locales/es.d.ts +10 -0
  98. package/dist/schema/localization/locales/es.d.ts.map +1 -1
  99. package/dist/schema/localization/locales/es.js +11 -1
  100. package/dist/schema/localization/locales/es.js.map +1 -1
  101. package/dist/schema/localization/locales/fr.d.ts +10 -0
  102. package/dist/schema/localization/locales/fr.d.ts.map +1 -1
  103. package/dist/schema/localization/locales/fr.js +11 -1
  104. package/dist/schema/localization/locales/fr.js.map +1 -1
  105. package/dist/schema/localization/locales/pt.d.ts +10 -0
  106. package/dist/schema/localization/locales/pt.d.ts.map +1 -1
  107. package/dist/schema/localization/locales/pt.js +11 -1
  108. package/dist/schema/localization/locales/pt.js.map +1 -1
  109. package/dist/schema/localization/locales/ru.d.ts +10 -0
  110. package/dist/schema/localization/locales/ru.d.ts.map +1 -1
  111. package/dist/schema/localization/locales/ru.js +11 -1
  112. package/dist/schema/localization/locales/ru.js.map +1 -1
  113. package/dist/schema/localization/locales/zh-cn.d.ts +10 -0
  114. package/dist/schema/localization/locales/zh-cn.d.ts.map +1 -1
  115. package/dist/schema/localization/locales/zh-cn.js +11 -1
  116. package/dist/schema/localization/locales/zh-cn.js.map +1 -1
  117. package/dist/schema/localization/locales/zh-tw.d.ts +69 -0
  118. package/dist/schema/localization/locales/zh-tw.d.ts.map +1 -0
  119. package/dist/schema/localization/locales/zh-tw.js +70 -0
  120. package/dist/schema/localization/locales/zh-tw.js.map +1 -0
  121. package/dist/schema/localization/translations.d.ts +147 -0
  122. package/dist/schema/localization/translations.d.ts.map +1 -1
  123. package/dist/schema/localization/translations.js +5 -3
  124. package/dist/schema/localization/translations.js.map +1 -1
  125. package/dist/schema/types.d.ts +2 -0
  126. package/dist/schema/types.d.ts.map +1 -1
  127. package/dist/shared/ExternalDocs.vue.d.ts +9 -0
  128. package/dist/shared/ExternalDocs.vue.d.ts.map +1 -0
  129. package/dist/shared/ExternalDocs.vue.js +7 -0
  130. package/dist/shared/ExternalDocs.vue.js.map +1 -0
  131. package/dist/shared/ExternalDocs.vue.script.js +46 -0
  132. package/dist/shared/ExternalDocs.vue.script.js.map +1 -0
  133. package/dist/shared/index.d.ts +1 -0
  134. package/dist/shared/index.d.ts.map +1 -1
  135. package/dist/shared/index.js +4 -3
  136. package/dist/style.css +63 -19
  137. package/dist/styles/schema-tree.css +3 -1
  138. package/dist/vue-styles.css +1 -1
  139. package/package.json +10 -10
@@ -1,26 +1,27 @@
1
- import { REQUEST_BODY_COMPOSITION_INDEX_SYMBOL as e } from "./request-body-composition-index.js";
2
- import { partitionAllOfCompositions as t } from "./helpers/partition-all-of-compositions.js";
3
- import { getCycleKey as n } from "./helpers/schema-cycle.js";
4
- import { useLocalization as r } from "./localization/index.js";
5
- import { getDiscriminatorValues as i } from "./helpers/get-discriminator-values.js";
6
- import { getSchemaType as a } from "./helpers/get-schema-type.js";
7
- import { getModelNameWithArray as o } from "./helpers/schema-name.js";
8
- import s from "./SchemaGlyphPuck.vue.js";
9
- import c from "./SchemaRailPanel.vue.js";
10
- import l from "./Schema.vue.js";
11
- import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, inject as y, normalizeClass as b, openBlock as x, ref as S, renderList as C, resolveComponent as w, toDisplayString as T, unref as E, watch as D, withCtx as O } from "vue";
12
- import { ScalarIconCaretUpDown as k } from "@scalar/icons";
13
- import { ScalarListbox as A } from "@scalar/components/listbox";
14
- import { resolve as j } from "@scalar/workspace-store/resolve";
1
+ import { schemaDiscriminator as e } from "./discriminator-metadata.js";
2
+ import { REQUEST_BODY_COMPOSITION_INDEX_SYMBOL as t } from "./request-body-composition-index.js";
3
+ import { partitionAllOfCompositions as n } from "./helpers/partition-all-of-compositions.js";
4
+ import { getCycleKey as r } from "./helpers/schema-cycle.js";
5
+ import { useLocalization as i } from "./localization/index.js";
6
+ import { getDiscriminatorValues as a } from "./helpers/get-discriminator-values.js";
7
+ import { getSchemaType as o } from "./helpers/get-schema-type.js";
8
+ import { getModelNameWithArray as s } from "./helpers/schema-name.js";
9
+ import c from "./SchemaGlyphPuck.vue.js";
10
+ import l from "./SchemaRailPanel.vue.js";
11
+ import u from "./Schema.vue.js";
12
+ import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, inject as b, normalizeClass as x, openBlock as S, ref as C, renderList as w, resolveComponent as T, toDisplayString as E, unref as D, watch as O, withCtx as k } from "vue";
13
+ import { ScalarIconCaretUpDown as A } from "@scalar/icons";
14
+ import { ScalarListbox as j } from "@scalar/components/listbox";
15
15
  import { isDefined as M } from "@scalar/helpers/array/is-defined";
16
+ import { resolve as N } from "@scalar/workspace-store/resolve";
16
17
  //#region src/schema/SchemaComposition.vue?vue&type=script&setup=true&lang.ts
17
- var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
18
+ var P = { class: "property-rule [.children+&]:mt-1.5!" }, F = {
18
19
  class: "composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm",
19
20
  type: "button"
20
- }, F = { class: "text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap" }, I = ["title"], L = {
21
+ }, I = { class: "text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap" }, L = ["title"], R = {
21
22
  key: 0,
22
23
  class: "text-red"
23
- }, R = /*@__PURE__*/ v({
24
+ }, z = /*@__PURE__*/ y({
24
25
  __name: "SchemaComposition",
25
26
  props: {
26
27
  composition: {},
@@ -47,53 +48,56 @@ var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
47
48
  specificationExtension: {},
48
49
  expansion: {}
49
50
  },
50
- setup(v) {
51
- let R = v, { translate: z } = r(), B = d(() => R.composition === "allOf" ? t(R.schema).segments : []), V = d(() => [R.schema[R.composition]].flat().map((e) => ({
52
- value: j.schema(e),
51
+ setup(y) {
52
+ let z = y, { translate: B } = i(), V = f(() => z.composition === "allOf" ? n(z.schema).segments : []), H = f(() => [z.schema[z.composition]].flat().map((e) => ({
53
+ value: N.schema(e),
53
54
  original: e
54
- })).filter((e) => M(e.value))), H = d(() => V.value.map((e, t) => {
55
- let n = j.schema(e.original), r = (o(n)?.label ?? a(n)) || z("schema.schema"), s = (R.schema.discriminator ?? R.discriminator)?.mapping, c = i(n.$ref, s);
55
+ })).filter((e) => M(e.value))), U = f(() => H.value.map((t, n) => {
56
+ let r = N.schema(t.original), i = (s(r)?.label ?? o(r)) || B("schema.schema"), c = (z.schema.discriminator ?? z.discriminator)?.mapping, l = a(r.$ref, c), u = r.discriminator?.[e]?.value, d = l.length ? l : u === void 0 ? [] : [u];
56
57
  return {
57
- id: String(t),
58
- label: c.length ? `${c.join(", ")} · ${r}` : r
58
+ id: String(n),
59
+ label: d.length && d.join(", ") !== i ? `${d.join(", ")} · ${i}` : i
59
60
  };
60
- })), U = d(() => R.compositionPath?.length ? [...R.compositionPath, R.composition].join(".") : ""), W = y(e, void 0), G = d(() => {
61
- if (R.schemaContext !== "requestBody" || !W?.value || !U.value) return 0;
62
- let e = W.value[U.value];
63
- return typeof e != "number" || Number.isNaN(e) ? 0 : Math.max(0, Math.min(e, H.value.length - 1));
64
- }), K = S();
65
- D([H, G], ([e, t]) => {
66
- (!K.value || !e.some((e) => e.id === K.value?.id)) && (K.value = e[t] ?? e[0]);
61
+ })), W = f(() => z.compositionPath?.length ? [...z.compositionPath, z.composition].join(".") : ""), G = b(t, void 0), K = f(() => {
62
+ if (z.schemaContext !== "requestBody" || !G?.value || !W.value) return 0;
63
+ let e = G.value[W.value];
64
+ return typeof e != "number" || Number.isNaN(e) ? 0 : Math.max(0, Math.min(e, U.value.length - 1));
65
+ }), q = C();
66
+ O([U, K], ([e, t]) => {
67
+ (!q.value || !e.some((e) => e.id === q.value?.id)) && (q.value = e[t] ?? e[0]);
67
68
  }, { immediate: !0 });
68
- let q = (e) => z(`schema.${e}`), J = d(() => V.value[Number(K.value?.id ?? "0")]?.value), Y = d(() => R.schemaContext === "requestBody" && R.compositionPath?.length === 1), X = d(() => n(V.value[Number(K.value?.id ?? "0")]?.original)), Z = S(!!R.options.expandAllSchemaProperties);
69
- return W && R.schemaContext === "requestBody" && U.value && D(K, (e) => {
69
+ let J = (t) => z.schema[e]?.inheritedVariants ? B("schema.variants") : B(`schema.${t}`), Y = f(() => H.value[Number(q.value?.id ?? "0")]?.value), X = f(() => {
70
+ let t = Y.value?.discriminator;
71
+ return t?.[e] ? t : z.discriminator;
72
+ }), Z = f(() => z.schemaContext === "requestBody" && z.compositionPath?.length === 1), Q = f(() => r(H.value[Number(q.value?.id ?? "0")]?.original)), $ = C(!!z.options.expandAllSchemaProperties);
73
+ return G && z.schemaContext === "requestBody" && W.value && O(q, (e) => {
70
74
  let t = e ? Number(e.id) : 0;
71
- Number.isNaN(t) || (W.value = {
72
- ...W.value,
73
- [U.value]: t
75
+ Number.isNaN(t) || (G.value = {
76
+ ...G.value,
77
+ [W.value]: t
74
78
  });
75
79
  }, { immediate: !0 }), (e, t) => {
76
- let n = w("SchemaComposition", !0);
77
- return x(), m("div", N, [R.composition === "allOf" ? (x(!0), m(u, { key: 0 }, C(B.value, (e, t) => (x(), m(u, { key: t }, [e.kind === "object" ? (x(), f(l, {
80
+ let n = T("SchemaComposition", !0);
81
+ return S(), h("div", P, [z.composition === "allOf" ? (S(!0), h(d, { key: 0 }, w(V.value, (e, t) => (S(), h(d, { key: t }, [e.kind === "object" ? (S(), p(u, {
78
82
  key: 0,
79
- breadcrumb: v.breadcrumb,
80
- compact: v.compact,
81
- compositionPath: v.compositionPath,
82
- depth: v.depth,
83
- discriminator: v.discriminator,
84
- eventBus: v.eventBus,
85
- expansion: v.expansion,
86
- hideDescription: Y.value,
87
- hideHeading: v.hideHeading,
88
- hideModelNames: v.hideModelNames,
89
- level: v.level + 1,
90
- name: v.name,
83
+ breadcrumb: y.breadcrumb,
84
+ compact: y.compact,
85
+ compositionPath: y.compositionPath,
86
+ depth: y.depth,
87
+ discriminator: y.schema.discriminator ?? y.discriminator,
88
+ eventBus: y.eventBus,
89
+ expansion: y.expansion,
90
+ hideDescription: Z.value,
91
+ hideHeading: y.hideHeading,
92
+ hideModelNames: y.hideModelNames,
93
+ level: y.level + 1,
94
+ name: y.name,
91
95
  noncollapsible: !0,
92
- options: v.options,
96
+ options: y.options,
93
97
  schema: e.schema,
94
- schemaContext: v.schemaContext,
95
- scrollTargetId: v.scrollTargetId,
96
- specificationExtension: v.specificationExtension
98
+ schemaContext: y.schemaContext,
99
+ scrollTargetId: y.scrollTargetId,
100
+ specificationExtension: y.specificationExtension
97
101
  }, null, 8, [
98
102
  "breadcrumb",
99
103
  "compact",
@@ -112,23 +116,23 @@ var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
112
116
  "schemaContext",
113
117
  "scrollTargetId",
114
118
  "specificationExtension"
115
- ])) : (x(), f(n, {
119
+ ])) : (S(), p(n, {
116
120
  key: 1,
117
- breadcrumb: v.breadcrumb,
118
- compact: v.compact,
121
+ breadcrumb: y.breadcrumb,
122
+ compact: y.compact,
119
123
  composition: e.composition,
120
- compositionPath: [...v.compositionPath ?? [], String(e.choiceIndex)],
121
- depth: v.depth,
122
- eventBus: v.eventBus,
123
- expansion: v.expansion,
124
- hideHeading: v.hideHeading,
125
- hideModelNames: v.hideModelNames,
126
- level: v.level,
127
- options: v.options,
124
+ compositionPath: [...y.compositionPath ?? [], String(e.choiceIndex)],
125
+ depth: y.depth,
126
+ eventBus: y.eventBus,
127
+ expansion: y.expansion,
128
+ hideHeading: y.hideHeading,
129
+ hideModelNames: y.hideModelNames,
130
+ level: y.level,
131
+ options: y.options,
128
132
  schema: e.value,
129
- schemaContext: v.schemaContext,
130
- scrollTargetId: v.scrollTargetId,
131
- specificationExtension: v.specificationExtension
133
+ schemaContext: y.schemaContext,
134
+ scrollTargetId: y.scrollTargetId,
135
+ specificationExtension: y.specificationExtension
132
136
  }, null, 8, [
133
137
  "breadcrumb",
134
138
  "compact",
@@ -145,62 +149,62 @@ var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
145
149
  "schemaContext",
146
150
  "scrollTargetId",
147
151
  "specificationExtension"
148
- ]))], 64))), 128)) : (x(), f(c, {
152
+ ]))], 64))), 128)) : (S(), p(l, {
149
153
  key: 1,
150
154
  class: "composition-panel composition-panel--tree mt-1 mb-0.5",
151
- depth: v.depth + 1
155
+ depth: y.depth + 1
152
156
  }, {
153
- default: O(() => [_(E(A), {
154
- modelValue: K.value,
155
- "onUpdate:modelValue": t[0] ||= (e) => K.value = e,
157
+ default: k(() => [v(D(j), {
158
+ modelValue: q.value,
159
+ "onUpdate:modelValue": t[0] ||= (e) => q.value = e,
156
160
  class: "w-fit max-w-full min-w-40",
157
- options: H.value
161
+ options: U.value
158
162
  }, {
159
- default: O(() => [h("button", P, [
160
- _(s, {
163
+ default: k(() => [g("button", F, [
164
+ v(c, {
161
165
  anchor: "line",
162
166
  class: "composition-selector-icon mt-1"
163
167
  }, {
164
- default: O(() => [_(E(k))]),
168
+ default: k(() => [v(D(A))]),
165
169
  _: 1
166
170
  }),
167
- h("span", F, T(q(R.composition)), 1),
168
- t[2] ||= h("span", {
171
+ g("span", I, E(J(z.composition)), 1),
172
+ t[2] ||= g("span", {
169
173
  "aria-hidden": "true",
170
174
  class: "text-c-3 shrink-0"
171
175
  }, "·", -1),
172
- h("span", {
173
- class: b(["composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]", { "line-through": J.value?.deprecated }]),
174
- title: K.value?.label || E(z)("schema.schema")
175
- }, T(K.value?.label || E(z)("schema.schema")), 11, I),
176
- J.value?.deprecated ? (x(), m("div", L, T(E(z)("schema.deprecated")), 1)) : p("", !0)
176
+ g("span", {
177
+ class: x(["composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]", { "line-through": Y.value?.deprecated }]),
178
+ title: q.value?.label || D(B)("schema.schema")
179
+ }, E(q.value?.label || D(B)("schema.schema")), 11, L),
180
+ Y.value?.deprecated ? (S(), h("div", R, E(D(B)("schema.deprecated")), 1)) : m("", !0)
177
181
  ])]),
178
182
  _: 1
179
- }, 8, ["modelValue", "options"]), !Z.value && v.level > 2 ? (x(), m("button", {
183
+ }, 8, ["modelValue", "options"]), !$.value && y.level > 2 ? (S(), h("button", {
180
184
  key: 0,
181
185
  class: "composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal",
182
186
  type: "button",
183
- onClick: t[1] ||= (e) => Z.value = !0
184
- }, [_(s), g(" " + T(E(z)("schema.showSchemaDetails")), 1)])) : (x(), f(l, {
185
- key: K.value?.id ?? "0",
186
- breadcrumb: v.breadcrumb,
187
- compact: v.compact,
188
- compositionPath: v.compositionPath,
189
- cycleKey: X.value,
190
- depth: v.depth + 1,
191
- discriminator: v.discriminator,
192
- eventBus: v.eventBus,
193
- expansion: v.expansion,
194
- hideHeading: v.hideHeading,
195
- hideModelNames: v.hideModelNames,
196
- level: v.level + 1,
197
- name: v.name,
187
+ onClick: t[1] ||= (e) => $.value = !0
188
+ }, [v(c), _(" " + E(D(B)("schema.showSchemaDetails")), 1)])) : (S(), p(u, {
189
+ key: q.value?.id ?? "0",
190
+ breadcrumb: y.breadcrumb,
191
+ compact: y.compact,
192
+ compositionPath: y.compositionPath,
193
+ cycleKey: Q.value,
194
+ depth: y.depth + 1,
195
+ discriminator: X.value,
196
+ eventBus: y.eventBus,
197
+ expansion: y.expansion,
198
+ hideHeading: y.hideHeading,
199
+ hideModelNames: y.hideModelNames,
200
+ level: y.level + 1,
201
+ name: y.name,
198
202
  noncollapsible: !0,
199
- options: v.options,
200
- schema: J.value,
201
- schemaContext: v.schemaContext,
202
- scrollTargetId: v.scrollTargetId,
203
- specificationExtension: v.specificationExtension
203
+ options: y.options,
204
+ schema: Y.value,
205
+ schemaContext: y.schemaContext,
206
+ scrollTargetId: y.scrollTargetId,
207
+ specificationExtension: y.specificationExtension
204
208
  }, null, 8, [
205
209
  "breadcrumb",
206
210
  "compact",
@@ -226,6 +230,6 @@ var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
226
230
  }
227
231
  });
228
232
  //#endregion
229
- export { R as default };
233
+ export { z as default };
230
234
 
231
235
  //# sourceMappingURL=SchemaComposition.vue.script.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../src/schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretUpDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport { getDiscriminatorValues } from './helpers/get-discriminator-values'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from './request-body-composition-index'\nimport Schema from './Schema.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaRailPanel from './SchemaRailPanel.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst props = withDefaults(\n defineProps<\n {\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n } & SchemaRenderingProps\n >(),\n {\n depth: 0,\n compact: false,\n hideHeading: false,\n },\n)\nconst { translate } = useLocalization()\n\n/**\n * Split an `allOf` into an ordered list of segments (object chunks + choice\n * pickers) so multiple mutually-exclusive selections each render their own\n * picker, in the position they were declared, instead of all but the first\n * being dropped and the rest bubbling to the end.\n */\nconst allOfSegments = computed(() =>\n props.composition === 'allOf'\n ? partitionAllOfCompositions(props.schema).segments\n : [],\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name (including array item models, e.g. `Model[]`) over\n * structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameWithArray(resolved)?.label ?? getSchemaType(resolved)) ||\n translate('schema.schema')\n const mapping = (props.schema.discriminator ?? props.discriminator)?.mapping\n const values = getDiscriminatorValues(resolved.$ref, mapping)\n return {\n id: String(index),\n label: values.length ? `${values.join(', ')} · ${label}` : label,\n }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\nconst compositionLabel = (type: CompositionKeyword): string =>\n translate(`schema.${type}`)\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/**\n * The request body card renders the merged `allOf` description on its outer card\n * (see `Schema.vue`), but only for the top-level request body schema. For that\n * single composition we hide the nested merged `Schema`'s description so the text\n * is not shown twice. Nested request-body compositions (deeper properties) are\n * not shown on the outer card and would otherwise lose their description\n * entirely, because the property row already skips it when `allOf` is present.\n *\n * The top-level request body composition is the one whose `compositionPath` is\n * still the request body root (`['requestBody']`); nested compositions append\n * property segments and therefore have a longer path.\n */\nconst isRequestBodyRootComposition = computed(\n () =>\n props.schemaContext === 'requestBody' &&\n props.compositionPath?.length === 1,\n)\n\n/**\n * Cycle key for the selected composition member, derived from its raw\n * (unresolved) value so a member that references an ancestor is detected as a\n * cycle.\n */\nconst selectedCompositionCycleKey = computed(() =>\n getCycleKey(\n composition.value[Number(selectedOption.value?.id ?? '0')]?.original,\n ),\n)\n\n/**\n * Controls whether the nested schema is displayed. When expanding all schema\n * properties we open it by default; the nested Schema handles cycle detection,\n * so finite compositions render fully while recursive ones still stop.\n */\nconst showNestedSchema = ref(!!props.options.expandAllSchemaProperties)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <!-- 6px after a container's children keeps the 12px row rhythm -->\n <div class=\"property-rule [.children+&]:mt-1.5!\">\n <!--\n allOf: render the members in source order — object chunks as fields, each\n oneOf/anyOf group as its own picker in place. Keeps every mutually-exclusive\n selection (mergeAllOfSchemas alone drops all but the first) and preserves the\n position of each choice group among the surrounding fields, flowing inline\n with them as one continuous list (no extra spacing or card).\n -->\n <template v-if=\"props.composition === 'allOf'\">\n <template\n v-for=\"(segment, segmentIndex) in allOfSegments\"\n :key=\"segmentIndex\">\n <Schema\n v-if=\"segment.kind === 'object'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideDescription=\"isRequestBodyRootComposition\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"segment.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <SchemaComposition\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :composition=\"segment.composition\"\n :compositionPath=\"[\n ...(compositionPath ?? []),\n String(segment.choiceIndex),\n ]\"\n :depth=\"depth\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level\"\n :options=\"options\"\n :schema=\"segment.value\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </template>\n\n <!-- The picker sits on the rail behind a circled icon, like the toggle\n pucks; the chosen variant hangs below in the same panel -->\n <SchemaRailPanel\n v-else\n class=\"composition-panel composition-panel--tree mt-1 mb-0.5\"\n :depth=\"depth + 1\">\n <!-- No `resize`: it would pin the popup to this compact trigger's width.\n The listbox slot must hold exactly ONE node: Headless UI renders its\n button as a fragment and passes props through to the slot root, so\n even an HTML comment in here breaks the picker. The puck is the\n picker's whole affordance: an up/down caret on the rail, like the\n plus on a row, so no trailing caret. -->\n <ScalarListbox\n v-model=\"selectedOption\"\n class=\"w-fit max-w-full min-w-40\"\n :options=\"listboxOptions\">\n <button\n class=\"composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm\"\n type=\"button\">\n <SchemaGlyphPuck\n anchor=\"line\"\n class=\"composition-selector-icon mt-1\">\n <!-- No size of its own: the puck sizes the icons it holds, so this\n one shrinks with the others in a narrow container -->\n <ScalarIconCaretUpDown />\n </SchemaGlyphPuck>\n <!-- Keyword and choice read as one bold name, split by the same `·`\n the tree uses between details -->\n <span\n class=\"text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap\"\n >{{ compositionLabel(props.composition) }}</span\n >\n <span\n aria-hidden=\"true\"\n class=\"text-c-3 shrink-0\"\n >·</span\n >\n <span\n class=\"composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\"\n :title=\"selectedOption?.label || translate('schema.schema')\">\n {{ selectedOption?.label || translate('schema.schema') }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n {{ translate('schema.deprecated') }}\n </div>\n </button>\n </ScalarListbox>\n\n <!-- The reveal is one more row of the tree: a plus puck on the rail -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n <SchemaGlyphPuck />\n {{ translate('schema.showSchemaDetails') }}\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :key=\"selectedOption?.id ?? '0'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :cycleKey=\"selectedCompositionCycleKey\"\n :depth=\"depth + 1\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </SchemaRailPanel>\n </div>\n</template>\n\n<style scoped>\n/*\n * A `oneOf`/`anyOf` whose chosen variant `allOf`s back to a shared base — most\n * commonly a discriminator-inferred `oneOf` sitting directly on the request body\n * — renders the merged variant one level deeper than a plain object variant:\n * `Schema.vue` cannot flatten the `allOf`, so it hands the merged object to\n * `SchemaProperty`, which wraps it in a headless passthrough row\n * (`.property--tree-container`). That wrapper carries a row's own\n * `--schema-row-pad`, opening a gap between the selector and the first field\n * that a plain `oneOf` does not have, so the variant reads as detached from its\n * picker. Drop that leading row pad for the panel's own variant card so the\n * field sits flush under the selector, matching a plain `oneOf`. Only the top\n * pad goes: the wrapper's trailing pad is what closes the card under the last\n * field, exactly as a plain variant's last row does.\n *\n * The rule lives here rather than in `SchemaProperty` because a body-level\n * discriminator `oneOf` is rendered straight from `Schema.vue` and never passes\n * through `SchemaProperty`, so a rule scoped there would never reach it.\n * See https://github.com/scalar/scalar/issues/9861\n */\n.property-rule\n :deep(\n .composition-panel\n > .schema-card\n > .schema-properties\n > ul\n > li.property.property--tree-container\n ) {\n padding-top: 0 !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BA,IAAM,IAAQ,GAuCR,EAAE,iBAAc,EAAgB,GAQhC,IAAgB,QACpB,EAAM,gBAAgB,UAClB,EAA2B,EAAM,MAAM,CAAC,CAAC,WACzC,CAAC,CACP,GAGM,IAAc,QAClB,CAAC,EAAM,OAAO,EAAM,YAAY,CAAA,CAC7B,KAAK,CAAA,CACL,KAAK,OAAY;GAAE,OAAO,EAAQ,OAAO,CAAM;GAAG,UAAU;EAAO,EAAE,CAAA,CACrE,QAAQ,MAAO,EAAU,EAAG,KAAK,CAAC,CACvC,GAQM,IAAiB,QACrB,EAAY,MAAM,KAAK,GAAQ,MAAkB;GAC/C,IAAM,IAAW,EAAQ,OAAO,EAAO,QAAS,GAC1C,KACH,EAAsB,CAAQ,CAAC,EAAE,SAAS,EAAc,CAAQ,MACjE,EAAU,eAAe,GACrB,KAAW,EAAM,OAAO,iBAAiB,EAAM,cAAA,EAAgB,SAC/D,IAAS,EAAuB,EAAS,MAAM,CAAO;GAC5D,OAAO;IACL,IAAI,OAAO,CAAK;IAChB,OAAO,EAAO,SAAS,GAAG,EAAO,KAAK,IAAI,EAAE,KAAK,MAAU;GAC7D;EACF,CAAC,CACH,GAEM,IAA0B,QAC9B,EAAM,iBAAiB,SACnB,CAAC,GAAG,EAAM,iBAAiB,EAAM,WAAW,CAAC,CAAC,KAAK,GAAG,IACtD,EACN,GAGM,IAAqC,EACzC,GACA,KAAA,CACF,GAEM,IAAuB,QAAe;GAC1C,IACE,EAAM,kBAAkB,iBACxB,CAAC,GAAoC,SACrC,CAAC,EAAwB,O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AA,CAAA;OAG5D,OAAO,EAAA,OAAgB,SAAS,EAAA,CAAA,CAAS,CAAA,eAAA;WACvC,EAAA,OAAgB,SAAS,EAAA,CAAA,CAAS,CAAA,eAAA,CAAA,GAAA,IAAA,CAAA;MAG/B,EAAA,OAAqB,cAAA,EAAA,GAD7B,EAIM,OAJN,GAIM,EADD,EAAA,CAAA,CAAS,CAAA,mBAAA,CAAA,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA;;;uCAOT,EAAA,SAAoB,EAAA,QAAK,KAAA,EAAA,GADlC,EAOS,UAAA;;KALP,OAAM;KACN,MAAK;KACJ,SAAK,AAAA,EAAA,QAAA,MAAE,EAAA,QAAgB;QACxB,EAAmB,CAAA,GAAA,EAAA,MACnB,EAAG,EAAA,CAAA,CAAS,CAAA,0BAAA,CAAA,GAAA,CAAA,CAAA,CAAA,MAAA,EAAA,GAId,EAoBqD,GAAA;KAlBlD,KAAK,EAAA,OAAgB,MAAE;KACvB,YAAY,EAAA;KACZ,SAAS,EAAA;KACT,iBAAiB,EAAA;KACjB,UAAU,EAAA;KACV,OAAO,EAAA,QAAK;KACZ,eAAe,EAAA;KACf,UAAU,EAAA;KACV,WAAW,EAAA;KACX,aAAa,EAAA;KACb,gBAAA,EAAA;KACA,OAAO,EAAA,QAAK;KACZ,MAAM,EAAA;KACN,gBAAgB;KAChB,SAAS,EAAA;KACT,QAAQ,EAAA;KACR,eAAe,EAAA;KACf,gBAAgB,EAAA;KAChB,wBAAwB,EAAA"}
1
+ {"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../src/schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretUpDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport {\n schemaDiscriminator,\n type DiscriminatorMetadata,\n type DiscriminatorSchema,\n} from './discriminator-metadata'\nimport { getDiscriminatorValues } from './helpers/get-discriminator-values'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from './request-body-composition-index'\nimport Schema from './Schema.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaRailPanel from './SchemaRailPanel.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst props = withDefaults(\n defineProps<\n {\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n } & SchemaRenderingProps\n >(),\n {\n depth: 0,\n compact: false,\n hideHeading: false,\n },\n)\nconst { translate } = useLocalization()\n\n/**\n * Split an `allOf` into an ordered list of segments (object chunks + choice\n * pickers) so multiple mutually-exclusive selections each render their own\n * picker, in the position they were declared, instead of all but the first\n * being dropped and the rest bubbling to the end.\n */\nconst allOfSegments = computed(() =>\n props.composition === 'allOf'\n ? partitionAllOfCompositions(props.schema).segments\n : [],\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name (including array item models, e.g. `Model[]`) over\n * structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameWithArray(resolved)?.label ?? getSchemaType(resolved)) ||\n translate('schema.schema')\n const mapping = (props.schema.discriminator ?? props.discriminator)?.mapping\n const mappedValues = getDiscriminatorValues(resolved.$ref, mapping)\n // Multiple inherited schemas can share a value that a mapping can only store once.\n const inheritedValue = (resolved.discriminator as DiscriminatorMetadata)?.[\n schemaDiscriminator\n ]?.value\n const values = mappedValues.length\n ? mappedValues\n : inheritedValue === undefined\n ? []\n : [inheritedValue]\n return {\n id: String(index),\n label:\n values.length && values.join(', ') !== label\n ? `${values.join(', ')} · ${label}`\n : label,\n }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\nconst compositionLabel = (type: CompositionKeyword): string =>\n (props.schema as DiscriminatorSchema)[schemaDiscriminator]?.inheritedVariants\n ? translate('schema.variants')\n : translate(`schema.${type}`)\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** AsyncAPI variants carry their own effective value; OpenAPI keeps its existing inference context. */\nconst selectedDiscriminator = computed((): DiscriminatorObject | undefined => {\n const own = selectedComposition.value?.discriminator\n return (own as DiscriminatorMetadata)?.[schemaDiscriminator]\n ? own\n : props.discriminator\n})\n\n/**\n * The request body card renders the merged `allOf` description on its outer card\n * (see `Schema.vue`), but only for the top-level request body schema. For that\n * single composition we hide the nested merged `Schema`'s description so the text\n * is not shown twice. Nested request-body compositions (deeper properties) are\n * not shown on the outer card and would otherwise lose their description\n * entirely, because the property row already skips it when `allOf` is present.\n *\n * The top-level request body composition is the one whose `compositionPath` is\n * still the request body root (`['requestBody']`); nested compositions append\n * property segments and therefore have a longer path.\n */\nconst isRequestBodyRootComposition = computed(\n () =>\n props.schemaContext === 'requestBody' &&\n props.compositionPath?.length === 1,\n)\n\n/**\n * Cycle key for the selected composition member, derived from its raw\n * (unresolved) value so a member that references an ancestor is detected as a\n * cycle.\n */\nconst selectedCompositionCycleKey = computed(() =>\n getCycleKey(\n composition.value[Number(selectedOption.value?.id ?? '0')]?.original,\n ),\n)\n\n/**\n * Controls whether the nested schema is displayed. When expanding all schema\n * properties we open it by default; the nested Schema handles cycle detection,\n * so finite compositions render fully while recursive ones still stop.\n */\nconst showNestedSchema = ref(!!props.options.expandAllSchemaProperties)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <!-- 6px after a container's children keeps the 12px row rhythm -->\n <div class=\"property-rule [.children+&]:mt-1.5!\">\n <!--\n allOf: render the members in source order — object chunks as fields, each\n oneOf/anyOf group as its own picker in place. Keeps every mutually-exclusive\n selection (mergeAllOfSchemas alone drops all but the first) and preserves the\n position of each choice group among the surrounding fields, flowing inline\n with them as one continuous list (no extra spacing or card).\n -->\n <template v-if=\"props.composition === 'allOf'\">\n <template\n v-for=\"(segment, segmentIndex) in allOfSegments\"\n :key=\"segmentIndex\">\n <Schema\n v-if=\"segment.kind === 'object'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"schema.discriminator ?? discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideDescription=\"isRequestBodyRootComposition\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"segment.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <SchemaComposition\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :composition=\"segment.composition\"\n :compositionPath=\"[\n ...(compositionPath ?? []),\n String(segment.choiceIndex),\n ]\"\n :depth=\"depth\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level\"\n :options=\"options\"\n :schema=\"segment.value\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </template>\n\n <!-- The picker sits on the rail behind a circled icon, like the toggle\n pucks; the chosen variant hangs below in the same panel -->\n <SchemaRailPanel\n v-else\n class=\"composition-panel composition-panel--tree mt-1 mb-0.5\"\n :depth=\"depth + 1\">\n <!-- No `resize`: it would pin the popup to this compact trigger's width.\n The listbox slot must hold exactly ONE node: Headless UI renders its\n button as a fragment and passes props through to the slot root, so\n even an HTML comment in here breaks the picker. The puck is the\n picker's whole affordance: an up/down caret on the rail, like the\n plus on a row, so no trailing caret. -->\n <ScalarListbox\n v-model=\"selectedOption\"\n class=\"w-fit max-w-full min-w-40\"\n :options=\"listboxOptions\">\n <button\n class=\"composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm\"\n type=\"button\">\n <SchemaGlyphPuck\n anchor=\"line\"\n class=\"composition-selector-icon mt-1\">\n <!-- No size of its own: the puck sizes the icons it holds, so this\n one shrinks with the others in a narrow container -->\n <ScalarIconCaretUpDown />\n </SchemaGlyphPuck>\n <!-- Keyword and choice read as one bold name, split by the same `·`\n the tree uses between details -->\n <span\n class=\"text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap\"\n >{{ compositionLabel(props.composition) }}</span\n >\n <span\n aria-hidden=\"true\"\n class=\"text-c-3 shrink-0\"\n >·</span\n >\n <span\n class=\"composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\"\n :title=\"selectedOption?.label || translate('schema.schema')\">\n {{ selectedOption?.label || translate('schema.schema') }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n {{ translate('schema.deprecated') }}\n </div>\n </button>\n </ScalarListbox>\n\n <!-- The reveal is one more row of the tree: a plus puck on the rail -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n <SchemaGlyphPuck />\n {{ translate('schema.showSchemaDetails') }}\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :key=\"selectedOption?.id ?? '0'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :cycleKey=\"selectedCompositionCycleKey\"\n :depth=\"depth + 1\"\n :discriminator=\"selectedDiscriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </SchemaRailPanel>\n </div>\n</template>\n\n<style scoped>\n/*\n * A `oneOf`/`anyOf` whose chosen variant `allOf`s back to a shared base — most\n * commonly a discriminator-inferred `oneOf` sitting directly on the request body\n * — renders the merged variant one level deeper than a plain object variant:\n * `Schema.vue` cannot flatten the `allOf`, so it hands the merged object to\n * `SchemaProperty`, which wraps it in a headless passthrough row\n * (`.property--tree-container`). That wrapper carries a row's own\n * `--schema-row-pad`, opening a gap between the selector and the first field\n * that a plain `oneOf` does not have, so the variant reads as detached from its\n * picker. Drop that leading row pad for the panel's own variant card so the\n * field sits flush under the selector, matching a plain `oneOf`. Only the top\n * pad goes: the wrapper's trailing pad is what closes the card under the last\n * field, exactly as a plain variant's last row does.\n *\n * The rule lives here rather than in `SchemaProperty` because a body-level\n * discriminator `oneOf` is rendered straight from `Schema.vue` and never passes\n * through `SchemaProperty`, so a rule scoped there would never reach it.\n * See https://github.com/scalar/scalar/issues/9861\n */\n.property-rule\n :deep(\n .composition-panel\n > .schema-card\n > .schema-properties\n > ul\n > li.property.property--tree-container\n ) {\n padding-top: 0 !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,IAAM,IAAQ,GAuCR,EAAE,iBAAc,EAAgB,GAQhC,IAAgB,QACpB,EAAM,gBAAgB,UAClB,EAA2B,EAAM,MAAM,CAAC,CAAC,WACzC,CAAC,CACP,GAGM,IAAc,QAClB,CAAC,EAAM,OAAO,EAAM,YAAY,CAAA,CAC7B,KAAK,CAAA,CACL,KAAK,OAAY;GAAE,OAAO,EAAQ,OAAO,CAAM;GAAG,UAAU;EAAO,EAAE,CAAA,CACrE,QAAQ,MAAO,EAAU,EAAG,KAAK,CAAC,CACvC,GAQM,IAAiB,QACrB,EAAY,MAAM,KAAK,GAAQ,MAAkB;GAC/C,IAAM,IAAW,EAAQ,OAAO,EAAO,QAAS,GAC1C,KACH,EAAsB,CAAQ,CAAC,EAAE,SAAS,EAAc,CAAQ,MACjE,EAAU,eAAe,GACrB,KAAW,EAAM,OAAO,iBAAiB,EAAM,cAAA,EAAgB,SAC/D,IAAe,EAAuB,EAAS,MAAM,CAAO,GAE5D,IAAkB,EAAS,gBAC/B,EACD,EAAE,OACG,IAAS,EAAa,SACxB,IACA,MAAmB,KAAA,IACjB,CAAC,IACD,CAAC,CAAc;GACrB,OAAO;IACL,IAAI,OAAO,CAAK;IAChB,OACE,EAAO,UAAU,EAAO,KAAK,IAAI,MAAM,IACnC,GAAG,EAAO,KAAK,IAAI,EAAE,KAAK,MAC1B;GACR;EACF,CAAC,CACH,GAEM,IAA0B,QAC9B,EAAM,iBAAiB,SACnB,CAAC,GAAG,EAAM,iBAAiB,EAAM,WAAW,CAAC,CAAC,KAAK,GAAG,IACtD,EACN,GAGM,IAAqC,EACzC,GACA,KAAA,CACF,GAEM,IAAuB,QA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[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n :text=\"label\"\n preset=\"property\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaEnumPropertyItem.vue.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"label\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":""}
@@ -13,8 +13,8 @@ var l = { class: "property-enum-row flex flex-col gap-0.5 border-t px-3 py-2" },
13
13
  },
14
14
  setup(i) {
15
15
  return (f, p) => (a(), t("li", l, [n("span", u, [r(o(c), {
16
- text: i.label,
17
- preset: "property"
16
+ preset: "property",
17
+ text: i.label
18
18
  }, null, 8, ["text"])]), i.description ? (a(), t("span", d, [r(o(s), { value: i.description }, null, 8, ["value"])])) : e("", !0)]));
19
19
  }
20
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEnumPropertyItem.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n :text=\"label\"\n preset=\"property\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBAWE,EAWK,MAXL,GAWK,CAVH,EAIO,QAJP,GAIO,CAHL,EAEsB,EAAA,CAAA,GAAA;GADnB,MAAM,EAAA;GACP,QAAO;2BAGH,EAAA,eAAA,EAAA,GADR,EAIO,QAJP,GAIO,CADL,EAAuC,EAAA,CAAA,GAAA,EAAtB,OAAO,EAAA,YAAW,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"SchemaEnumPropertyItem.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"label\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBAWE,EAWK,MAXL,GAWK,CAVH,EAIO,QAJP,GAIO,CAHL,EAEkB,EAAA,CAAA,GAAA;GADhB,QAAO;GACN,MAAM,EAAA;2BAGH,EAAA,eAAA,EAAA,GADR,EAIO,QAJP,GAIO,CADL,EAAuC,EAAA,CAAA,GAAA,EAAtB,OAAO,EAAA,YAAW,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.js","names":[],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (!property) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.js","names":[],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (property === undefined) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":""}
@@ -42,7 +42,7 @@ var m = /*@__PURE__*/ l({
42
42
  }), v = a(() => {
43
43
  if (!(!e(l.schema) || !l.schema.additionalProperties)) return l.schema.propertyNames ? p.schema(l.schema.propertyNames) : void 0;
44
44
  }), y = (e) => {
45
- if (e) return p.schema(e);
45
+ if (e !== void 0) return p.schema(e);
46
46
  }, b = (e) => {
47
47
  if (e) return typeof e.description == "string" ? e.description : void 0;
48
48
  }, x = a(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (!property) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,IAAM,IAAmB,QACvB,EAAkB,EAAA,QAAQ,EAAA,eAAe,EAAA,OAAO,CAClD,GAQM,KACJ,GAIA,MACG;GACH,IAAM,IACJ,OAAO,KAA0B,YAC7B,IACA,EAAQ,OAAO,CAAqB;GAE1C,IACE,OAAO,KAAyB,YAChC,OAAO,EAAqB,iCAAkC,YAC9D,EAAqB,6BAA6B,CAAC,KAAK,CAAC,CAAC,SAAS,GAEnE,OAAO,GAAG,EAAqB,6BAA6B,CAAC,KAAK;GAIpE,IAAI,GAAgB;IAClB,IAAM,IAAW,EAAQ,OAAO,CAAc;IAC9C,IAAI,GAAU,OACZ,OAAO,EAAS;GAEpB;GAEA,OAAO;EACT,GASM,KACJ,MACyB;GACzB,IAAI,CAAC,GACH;GAGF,IAAM,IAAW,EAAQ,OAAO,CAAc;GAC9C,IACE,KACA,UAAU,KACV,MAAM,QAAQ,EAAS,IAAI,KAC3B,EAAS,KAAK,SAAS,GAEvB,OAAO,EAAS;EAIpB,GAGM,IAA2B,QAAe;GAC1C,OAAC,EAAa,EAAA,MAAM,KAAK,CAAC,EAAA,OAAO,uBAGrC,OAAO,EAAqB,EAAA,OAAO,aAAa;EAClD,CAAC,GAQK,IAAgC,QAAe;GAC/C,OAAC,EAAa,EAAA,MAAM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,aAAA,EAAA;IACA,gBAAA,EAAA;IACA,OAAA,EAAA;IACA,MAAe,EAAuC,EAAA,OAAO,sBAAgC,EAAA,OAAO,aAAA;IAMrG,gBAAA;IACC,SAAS,EAAA;IACT,mBAAmB,EAAA;IACnB,qBAAqB,EAAA;IACrB,QAAQ,EAA6B,EAAA,OAAO,oBAAoB;IAChE,eAAe,EAAA;IACf,gBAAgB,EAAA;IAChB,wBAAwB,EAAA;IACzB,SAAQ"}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (property === undefined) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,IAAM,IAAmB,QACvB,EAAkB,EAAA,QAAQ,EAAA,eAAe,EAAA,OAAO,CAClD,GAQM,KACJ,GAIA,MACG;GACH,IAAM,IACJ,OAAO,KAA0B,YAC7B,IACA,EAAQ,OAAO,CAAqB;GAE1C,IACE,OAAO,KAAyB,YAChC,OAAO,EAAqB,iCAAkC,YAC9D,EAAqB,6BAA6B,CAAC,KAAK,CAAC,CAAC,SAAS,GAEnE,OAAO,GAAG,EAAqB,6BAA6B,CAAC,KAAK;GAIpE,IAAI,GAAgB;IAClB,IAAM,IAAW,EAAQ,OAAO,CAAc;IAC9C,IAAI,GAAU,OACZ,OAAO,EAAS;GAEpB;GAEA,OAAO;EACT,GASM,KACJ,MACyB;GACzB,IAAI,CAAC,GACH;GAGF,IAAM,IAAW,EAAQ,OAAO,CAAc;GAC9C,IACE,KACA,UAAU,KACV,MAAM,QAAQ,EAAS,IAAI,KAC3B,EAAS,KAAK,SAAS,GAEvB,OAAO,EAAS;EAIpB,GAGM,IAA2B,QAAe;GAC1C,OAAC,EAAa,EAAA,MAAM,KAAK,CAAC,EAAA,OAAO,uBAGrC,OAAO,EAAqB,EAAA,OAAO,aAAa;EAClD,CAAC,GAQK,IAAgC,QAAe;GAC/C,OAAC,EAAa,EAAA,MAAM,KAAK,CAAC,EAAA,OAAO,uBAGrC,OAAO,EAAA,OAAO,gBAAgB,EAAQ,OAAO,EAAA,OAAO,aAAa,IAAI,KAAA;EACvE,CAAC,GASK,KACJ,MAC6B;GACzB,UAAa,KAAA,GAGjB,OAAO,EAAQ,OAAO,CAAQ;EAChC,GAEM,KACJ,MACuB;GA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AA,OAAO,oBAAoB;IAChE,eAAe,EAAA;IACf,gBAAgB,EAAA;IAChB,wBAAwB,EAAA;IACzB,SAAQ"}
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
81
81
  } & SchemaRenderingProps> & Readonly<{}>, {
82
82
  required: boolean;
83
83
  level: number;
84
- depth: number;
85
84
  hideModelNames: boolean;
85
+ depth: number;
86
86
  compact: boolean;
87
87
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
88
88
  //# sourceMappingURL=SchemaProperty.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaProperty.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaProperty.vue"],"names":[],"mappings":"AA80CA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAMvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAErE,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,KAAK,CAAA;AAiCZ,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;wBAU7C,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;SAEP,MAAM,GAAG,SAAS;YACf,YAAY,GAAG,SAAS;IAChC,uFAAuF;sBACrE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACxB,OAAO;YAChB,MAAM;IACd;;;OAGG;YACK,MAAM;WACP,MAAM;eACF,OAAO;cACR,OAAO;oBACD,mBAAmB;kBACrB,MAAM;qBACH,OAAO;kBACV,OAAO;IACrB,kGAAkG;gBACtF,MAAM,GAAG,IAAI;cACf,sBAAsB,GAAG,mBAAmB;iBACzC,MAAM,EAAE;cACX,iBAAiB,GAAG,IAAI;aACzB,aAAa;IACtB,+EAA+E;wBAC3D,MAAM,EAAE;IAC5B,iFAAiF;0BAC3D,YAAY;IAClC,mFAAmF;oBACnE,MAAM;IACtB,uFAAuF;sBACrE,MAAM,EAAE;IAC1B,oFAAoF;6BAC3D,MAAM;IAC/B,2EAA2E;eAChE,OAAO;;SAnCb,MAAM,GAAG,SAAS;YACf,YAAY,GAAG,SAAS;IAChC,uFAAuF;sBACrE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACxB,OAAO;YAChB,MAAM;IACd;;;OAGG;YACK,MAAM;WACP,MAAM;eACF,OAAO;cACR,OAAO;oBACD,mBAAmB;kBACrB,MAAM;qBACH,OAAO;kBACV,OAAO;IACrB,kGAAkG;gBACtF,MAAM,GAAG,IAAI;cACf,sBAAsB,GAAG,mBAAmB;iBACzC,MAAM,EAAE;cACX,iBAAiB,GAAG,IAAI;aACzB,aAAa;IACtB,+EAA+E;wBAC3D,MAAM,EAAE;IAC5B,iFAAiF;0BAC3D,YAAY;IAClC,mFAAmF;oBACnE,MAAM;IACtB,uFAAuF;sBACrE,MAAM,EAAE;IAC1B,oFAAoF;6BAC3D,MAAM;IAC/B,2EAA2E;eAChE,OAAO;;cAvBP,OAAO;WAPV,MAAM;WAKN,MAAM;oBAMG,OAAO;aAHd,OAAO;6EAwgDnB,CAAC"}
1
+ {"version":3,"file":"SchemaProperty.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaProperty.vue"],"names":[],"mappings":"AAg3CA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAMvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAErE,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,KAAK,CAAA;AAsCZ,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;wBAU7C,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;SAEP,MAAM,GAAG,SAAS;YACf,YAAY,GAAG,SAAS;IAChC,uFAAuF;sBACrE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACxB,OAAO;YAChB,MAAM;IACd;;;OAGG;YACK,MAAM;WACP,MAAM;eACF,OAAO;cACR,OAAO;oBACD,mBAAmB;kBACrB,MAAM;qBACH,OAAO;kBACV,OAAO;IACrB,kGAAkG;gBACtF,MAAM,GAAG,IAAI;cACf,sBAAsB,GAAG,mBAAmB;iBACzC,MAAM,EAAE;cACX,iBAAiB,GAAG,IAAI;aACzB,aAAa;IACtB,+EAA+E;wBAC3D,MAAM,EAAE;IAC5B,iFAAiF;0BAC3D,YAAY;IAClC,mFAAmF;oBACnE,MAAM;IACtB,uFAAuF;sBACrE,MAAM,EAAE;IAC1B,oFAAoF;6BAC3D,MAAM;IAC/B,2EAA2E;eAChE,OAAO;;SAnCb,MAAM,GAAG,SAAS;YACf,YAAY,GAAG,SAAS;IAChC,uFAAuF;sBACrE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACxB,OAAO;YAChB,MAAM;IACd;;;OAGG;YACK,MAAM;WACP,MAAM;eACF,OAAO;cACR,OAAO;oBACD,mBAAmB;kBACrB,MAAM;qBACH,OAAO;kBACV,OAAO;IACrB,kGAAkG;gBACtF,MAAM,GAAG,IAAI;cACf,sBAAsB,GAAG,mBAAmB;iBACzC,MAAM,EAAE;cACX,iBAAiB,GAAG,IAAI;aACzB,aAAa;IACtB,+EAA+E;wBAC3D,MAAM,EAAE;IAC5B,iFAAiF;0BAC3D,YAAY;IAClC,mFAAmF;oBACnE,MAAM;IACtB,uFAAuF;sBACrE,MAAM,EAAE;IAC1B,oFAAoF;6BAC3D,MAAM;IAC/B,2EAA2E;eAChE,OAAO;;cAvBP,OAAO;WAPV,MAAM;oBAWG,OAAO;WANhB,MAAM;aAGJ,OAAO;6EA8iDnB,CAAC"}
@@ -2,7 +2,7 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "./SchemaProperty.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/schema/SchemaProperty.vue
5
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-071aaa62"]]);
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-00f22f7c"]]);
6
6
  //#endregion
7
7
  export { n as default };
8
8