@scalar/blocks 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +42 -42
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/code-example/mount.d.ts.map +1 -1
- package/dist/code-example/mount.js +32 -31
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/Schema.vue.d.ts.map +1 -1
- package/dist/schema/Schema.vue.js +1 -1
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema.vue.script.js +122 -116
- package/dist/schema/Schema.vue.script.js.map +1 -1
- package/dist/schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/schema/SchemaComposition.vue.js +1 -1
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition.vue.script.js +110 -106
- package/dist/schema/SchemaComposition.vue.script.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.script.js +6 -6
- package/dist/schema/SchemaEnumPropertyItem.vue.script.js.map +1 -1
- package/dist/schema/SchemaHeading.vue.script.js +5 -5
- package/dist/schema/SchemaProperty.vue.d.ts +1 -1
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +1 -1
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty.vue.script.js +179 -167
- package/dist/schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +5 -3
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.script.js +122 -117
- package/dist/schema/SchemaPropertyHeading.vue.script.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.js +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.script.js +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.script.js.map +1 -1
- package/dist/schema/discriminator-metadata.d.ts +13 -0
- package/dist/schema/discriminator-metadata.d.ts.map +1 -0
- package/dist/schema/discriminator-metadata.js +6 -0
- package/dist/schema/discriminator-metadata.js.map +1 -0
- package/dist/schema/helpers/get-compositions-to-render.d.ts +3 -1
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js +25 -24
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/get-property-description.d.ts +6 -3
- package/dist/schema/helpers/get-property-description.d.ts.map +1 -1
- package/dist/schema/helpers/get-property-description.js +10 -10
- package/dist/schema/helpers/get-property-description.js.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.d.ts.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js +34 -33
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +13 -11
- package/dist/schema/localization/index.d.ts +11 -1
- package/dist/schema/localization/index.d.ts.map +1 -1
- package/dist/schema/localization/locales/ar.d.ts +10 -0
- package/dist/schema/localization/locales/ar.d.ts.map +1 -1
- package/dist/schema/localization/locales/ar.js +11 -1
- package/dist/schema/localization/locales/ar.js.map +1 -1
- package/dist/schema/localization/locales/de.d.ts +10 -0
- package/dist/schema/localization/locales/de.d.ts.map +1 -1
- package/dist/schema/localization/locales/de.js +11 -1
- package/dist/schema/localization/locales/de.js.map +1 -1
- package/dist/schema/localization/locales/en.d.ts +10 -0
- package/dist/schema/localization/locales/en.d.ts.map +1 -1
- package/dist/schema/localization/locales/en.js +11 -1
- package/dist/schema/localization/locales/en.js.map +1 -1
- package/dist/schema/localization/locales/es.d.ts +10 -0
- package/dist/schema/localization/locales/es.d.ts.map +1 -1
- package/dist/schema/localization/locales/es.js +11 -1
- package/dist/schema/localization/locales/es.js.map +1 -1
- package/dist/schema/localization/locales/fr.d.ts +10 -0
- package/dist/schema/localization/locales/fr.d.ts.map +1 -1
- package/dist/schema/localization/locales/fr.js +11 -1
- package/dist/schema/localization/locales/fr.js.map +1 -1
- package/dist/schema/localization/locales/pt.d.ts +10 -0
- package/dist/schema/localization/locales/pt.d.ts.map +1 -1
- package/dist/schema/localization/locales/pt.js +11 -1
- package/dist/schema/localization/locales/pt.js.map +1 -1
- package/dist/schema/localization/locales/ru.d.ts +10 -0
- package/dist/schema/localization/locales/ru.d.ts.map +1 -1
- package/dist/schema/localization/locales/ru.js +11 -1
- package/dist/schema/localization/locales/ru.js.map +1 -1
- package/dist/schema/localization/locales/zh-cn.d.ts +10 -0
- package/dist/schema/localization/locales/zh-cn.d.ts.map +1 -1
- package/dist/schema/localization/locales/zh-cn.js +11 -1
- package/dist/schema/localization/locales/zh-cn.js.map +1 -1
- package/dist/schema/localization/locales/zh-tw.d.ts +10 -0
- package/dist/schema/localization/locales/zh-tw.d.ts.map +1 -1
- package/dist/schema/localization/locales/zh-tw.js +11 -1
- package/dist/schema/localization/locales/zh-tw.js.map +1 -1
- package/dist/schema/localization/translations.d.ts +90 -0
- package/dist/schema/localization/translations.d.ts.map +1 -1
- package/dist/shared/ExternalDocs.vue.d.ts +9 -0
- package/dist/shared/ExternalDocs.vue.d.ts.map +1 -0
- package/dist/shared/ExternalDocs.vue.js +7 -0
- package/dist/shared/ExternalDocs.vue.js.map +1 -0
- package/dist/shared/ExternalDocs.vue.script.js +46 -0
- package/dist/shared/ExternalDocs.vue.script.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +4 -3
- package/dist/style.css +63 -10
- package/dist/vue-styles.css +1 -1
- package/package.json +10 -10
|
@@ -3,48 +3,51 @@ import { getSchemaType as t } from "./helpers/get-schema-type.js";
|
|
|
3
3
|
import { getModelNameWithArray as n } from "./helpers/schema-name.js";
|
|
4
4
|
import { getDisplayTypeSignatureTokens as r } from "./helpers/get-type-signature-tokens.js";
|
|
5
5
|
import i from "../shared/Badge.vue.js";
|
|
6
|
-
import { isModelLinkable as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createSlots as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { isArraySchema as
|
|
6
|
+
import { isModelLinkable as a } from "./helpers/is-model-linkable.js";
|
|
7
|
+
import o from "./RenderString.vue.js";
|
|
8
|
+
import ee from "./SchemaPropertyDefault.vue.js";
|
|
9
|
+
import s from "./SchemaPropertyDetail.vue.js";
|
|
10
|
+
import c from "./SchemaPropertyExamples.vue.js";
|
|
11
|
+
import te from "./SchemaPropertyPattern.vue.js";
|
|
12
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createSlots as ne, createTextVNode as h, createVNode as g, defineComponent as _, normalizeClass as v, openBlock as y, renderList as b, renderSlot as x, toDisplayString as S, toRef as re, unref as C, withCtx as w } from "vue";
|
|
13
|
+
import { isDefined as T } from "@scalar/helpers/array/is-defined";
|
|
14
|
+
import { resolve as E } from "@scalar/workspace-store/resolve";
|
|
15
|
+
import { isArraySchema as D, isNumberSchema as O, isStringSchema as k } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
16
16
|
//#region src/schema/SchemaPropertyHeading.vue?vue&type=script&setup=true&lang.ts
|
|
17
|
-
var
|
|
17
|
+
var A = { class: "property-heading [&>.property-detail:has(+.property-detail)]:mr-0" }, j = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "property-discriminator"
|
|
20
|
-
},
|
|
20
|
+
}, M = { class: "font-code text-c-accent" }, N = { class: "screenreader-only" }, P = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "property-type-signature text-c-2 text-(length:--scalar-mini)"
|
|
23
|
-
},
|
|
23
|
+
}, F = {
|
|
24
24
|
key: 1,
|
|
25
25
|
class: "property-type-signature text-c-2 text-(length:--scalar-mini)"
|
|
26
|
-
},
|
|
26
|
+
}, I = {
|
|
27
27
|
key: 0,
|
|
28
28
|
class: "screenreader-only"
|
|
29
|
-
},
|
|
29
|
+
}, L = {
|
|
30
30
|
key: 3,
|
|
31
31
|
class: "property-additional"
|
|
32
|
-
},
|
|
32
|
+
}, R = {
|
|
33
33
|
key: 4,
|
|
34
34
|
class: "property-deprecated"
|
|
35
|
-
}, R = {
|
|
36
|
-
key: 5,
|
|
37
|
-
class: "property-const"
|
|
38
35
|
}, z = {
|
|
39
|
-
key:
|
|
40
|
-
class: "
|
|
36
|
+
key: 5,
|
|
37
|
+
class: "text-c-2"
|
|
41
38
|
}, B = {
|
|
42
|
-
key:
|
|
43
|
-
class: "property-
|
|
39
|
+
key: 6,
|
|
40
|
+
class: "property-const"
|
|
44
41
|
}, V = {
|
|
42
|
+
key: 8,
|
|
43
|
+
class: "property-write-only"
|
|
44
|
+
}, H = {
|
|
45
45
|
key: 9,
|
|
46
|
+
class: "property-read-only"
|
|
47
|
+
}, U = {
|
|
48
|
+
key: 10,
|
|
46
49
|
class: "property-required"
|
|
47
|
-
},
|
|
50
|
+
}, W = /*@__PURE__*/ _({
|
|
48
51
|
__name: "SchemaPropertyHeading",
|
|
49
52
|
props: {
|
|
50
53
|
value: {},
|
|
@@ -53,6 +56,7 @@ var ne = { class: "property-heading [&>.property-detail:has(+.property-detail)]:
|
|
|
53
56
|
type: Boolean,
|
|
54
57
|
default: !1
|
|
55
58
|
},
|
|
59
|
+
discriminatorValue: {},
|
|
56
60
|
required: {
|
|
57
61
|
type: Boolean,
|
|
58
62
|
default: !1
|
|
@@ -73,198 +77,199 @@ var ne = { class: "property-heading [&>.property-detail:has(+.property-detail)]:
|
|
|
73
77
|
keyKind: {},
|
|
74
78
|
recursiveTo: {}
|
|
75
79
|
},
|
|
76
|
-
setup(
|
|
77
|
-
let
|
|
78
|
-
if (!
|
|
79
|
-
let e =
|
|
80
|
+
setup(_) {
|
|
81
|
+
let W = _, { translate: G } = e(), K = re(W, "value"), q = u(() => {
|
|
82
|
+
if (!K.value) return;
|
|
83
|
+
let e = K.value;
|
|
80
84
|
if (e.const !== void 0) return e.const;
|
|
81
85
|
if (e.enum?.length === 1) return e.enum[0];
|
|
82
|
-
if (
|
|
83
|
-
let t =
|
|
84
|
-
if (
|
|
86
|
+
if (D(e) && e.items) {
|
|
87
|
+
let t = E.schema(e.items);
|
|
88
|
+
if (T(t.const)) return t.const;
|
|
85
89
|
if (t.enum?.length === 1) return t.enum[0];
|
|
86
90
|
}
|
|
87
|
-
}),
|
|
91
|
+
}), J = (e) => {
|
|
88
92
|
let t = [];
|
|
89
|
-
return
|
|
93
|
+
return k(e) && (e.minLength && t.push({
|
|
90
94
|
key: "min-length",
|
|
91
|
-
prefix: `${
|
|
95
|
+
prefix: `${G("schema.minLength")}: `,
|
|
92
96
|
value: e.minLength
|
|
93
97
|
}), e.maxLength && t.push({
|
|
94
98
|
key: "max-length",
|
|
95
|
-
prefix: `${
|
|
99
|
+
prefix: `${G("schema.maxLength")}: `,
|
|
96
100
|
value: e.maxLength
|
|
97
|
-
})), (
|
|
101
|
+
})), (k(e) || O(e)) && e.format && t.push({
|
|
98
102
|
key: "format",
|
|
99
103
|
value: e.format,
|
|
100
104
|
truncate: !0
|
|
101
|
-
}),
|
|
105
|
+
}), O(e) && (T(e.exclusiveMinimum) && t.push({
|
|
102
106
|
key: "exclusive-minimum",
|
|
103
|
-
prefix: `${
|
|
107
|
+
prefix: `${G("schema.greaterThan")}: `,
|
|
104
108
|
value: e.exclusiveMinimum
|
|
105
|
-
}),
|
|
109
|
+
}), T(e.minimum) && t.push({
|
|
106
110
|
key: "minimum",
|
|
107
|
-
prefix: `${
|
|
111
|
+
prefix: `${G("schema.min")}: `,
|
|
108
112
|
value: e.minimum
|
|
109
|
-
}),
|
|
113
|
+
}), T(e.exclusiveMaximum) && t.push({
|
|
110
114
|
key: "exclusive-maximum",
|
|
111
|
-
prefix: `${
|
|
115
|
+
prefix: `${G("schema.lessThan")}: `,
|
|
112
116
|
value: e.exclusiveMaximum
|
|
113
|
-
}),
|
|
117
|
+
}), T(e.maximum) && t.push({
|
|
114
118
|
key: "maximum",
|
|
115
|
-
prefix: `${
|
|
119
|
+
prefix: `${G("schema.max")}: `,
|
|
116
120
|
value: e.maximum
|
|
117
|
-
}),
|
|
121
|
+
}), T(e.multipleOf) && t.push({
|
|
118
122
|
key: "multiple-of",
|
|
119
|
-
prefix: `${
|
|
123
|
+
prefix: `${G("schema.multipleOf")}: `,
|
|
120
124
|
value: e.multipleOf
|
|
121
125
|
})), t;
|
|
122
|
-
},
|
|
123
|
-
if (!
|
|
124
|
-
let e =
|
|
125
|
-
return
|
|
126
|
+
}, ie = u(() => {
|
|
127
|
+
if (!K.value) return [];
|
|
128
|
+
let e = K.value, t = [];
|
|
129
|
+
return D(e) && ((e.minItems || e.maxItems) && t.push({
|
|
126
130
|
key: "array-range",
|
|
127
131
|
value: `${e.minItems || ""}…${e.maxItems || ""}`
|
|
128
132
|
}), e.uniqueItems && t.push({
|
|
129
133
|
key: "unique-items",
|
|
130
|
-
value: `${
|
|
131
|
-
})), t.push(...
|
|
132
|
-
}),
|
|
133
|
-
schemaKey:
|
|
134
|
-
label:
|
|
135
|
-
} : n(
|
|
136
|
-
hideModelNames:
|
|
137
|
-
modelName:
|
|
138
|
-
})),
|
|
139
|
-
let e =
|
|
134
|
+
value: `${G("schema.unique")}!`
|
|
135
|
+
})), t.push(...J(e)), D(e) && e.items && t.push(...J(E.schema(e.items))), t;
|
|
136
|
+
}), Y = u(() => !W.value || W.hideModelNames ? null : W.modelName ? {
|
|
137
|
+
schemaKey: W.modelName,
|
|
138
|
+
label: W.modelName
|
|
139
|
+
} : n(W.value)), ae = u(() => a(Y.value?.schemaKey, W.modelLinkOptions ?? {})), X = u(() => r(W.value, {
|
|
140
|
+
hideModelNames: W.hideModelNames,
|
|
141
|
+
modelName: Y.value?.label
|
|
142
|
+
})), oe = u(() => !W.value || !("type" in W.value) ? !1 : W.value.type === "array" || !q.value), Z = u(() => {
|
|
143
|
+
let e = W.propertyNames;
|
|
140
144
|
if (!e) return;
|
|
141
145
|
let n = [t(e)];
|
|
142
146
|
"format" in e && typeof e.format == "string" && n.push(e.format);
|
|
143
147
|
let r = n.filter(Boolean).join(" · ");
|
|
144
148
|
return r.length > 0 ? r : void 0;
|
|
145
149
|
}), Q = u(() => {
|
|
146
|
-
if (
|
|
147
|
-
if (
|
|
148
|
-
let e =
|
|
150
|
+
if (W.value && "example" in W.value && W.value.example !== void 0) return W.value.example;
|
|
151
|
+
if (W.value && D(W.value)) {
|
|
152
|
+
let e = E.schema(W.value.items);
|
|
149
153
|
if (e && "example" in e && e.example !== void 0) return e.example;
|
|
150
154
|
}
|
|
151
|
-
}),
|
|
155
|
+
}), se = u(() => {
|
|
152
156
|
if (Q.value !== void 0) return !0;
|
|
153
|
-
let e =
|
|
157
|
+
let e = W.value?.examples;
|
|
154
158
|
return !!e && typeof e == "object" && Object.keys(e).length > 0;
|
|
155
159
|
}), $ = u(() => {
|
|
156
|
-
let e =
|
|
160
|
+
let e = K.value;
|
|
157
161
|
if (e) {
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
160
|
-
let t =
|
|
161
|
-
if (
|
|
162
|
+
if (k(e) && e.pattern) return e.pattern;
|
|
163
|
+
if (D(e) && e.items) {
|
|
164
|
+
let t = E.schema(e.items);
|
|
165
|
+
if (k(t) && t.pattern) return t.pattern;
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
});
|
|
165
|
-
return (e, t) => (
|
|
166
|
-
e.$slots.name ? (
|
|
169
|
+
return (e, t) => (y(), p("div", A, [
|
|
170
|
+
e.$slots.name ? (y(), p("div", {
|
|
167
171
|
key: 0,
|
|
168
|
-
class:
|
|
169
|
-
}, [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
class: v(["property-name", { deprecated: W.value?.deprecated }])
|
|
173
|
+
}, [x(e.$slots, "name", {}, void 0, !0)], 2)) : f("", !0),
|
|
174
|
+
W.isDiscriminator ? (y(), p("div", j, S(C(G)("schema.discriminator")), 1)) : f("", !0),
|
|
175
|
+
W.value ? (y(), p(l, { key: 2 }, [
|
|
176
|
+
W.keyKind ? (y(), d(s, {
|
|
173
177
|
key: 0,
|
|
174
178
|
class: "property-key-kind"
|
|
175
179
|
}, {
|
|
176
|
-
default:
|
|
180
|
+
default: w(() => [m("span", M, S(W.keyKind === "pattern" ? "patternProperty" : "additionalProperty"), 1)]),
|
|
177
181
|
_: 1
|
|
178
182
|
})) : f("", !0),
|
|
179
|
-
|
|
183
|
+
oe.value ? (y(), d(s, {
|
|
180
184
|
key: 1,
|
|
181
185
|
truncate: ""
|
|
182
186
|
}, {
|
|
183
|
-
default:
|
|
187
|
+
default: w(() => [m("span", N, S(C(G)("schema.type")) + ": ", 1), W.eventBus && Y.value?.schemaKey && ae.value ? (y(), p("button", {
|
|
184
188
|
key: 0,
|
|
185
189
|
class: "text-c-2 hover:text-c-1 underline",
|
|
186
190
|
type: "button",
|
|
187
|
-
onClick: t[0] ||= (e) =>
|
|
188
|
-
}, [X.value.length ? (
|
|
191
|
+
onClick: t[0] ||= (e) => W.eventBus.emit("scroll-to:model-by-name", { name: Y.value.schemaKey })
|
|
192
|
+
}, [X.value.length ? (y(), p("span", P, [(y(!0), p(l, null, b(X.value, (e, t) => (y(), p(l, { key: t }, [h(S(t > 0 ? " " : ""), 1), m("span", { class: v(["property-type-token", [
|
|
189
193
|
`property-type-token--${e.kind}`,
|
|
190
194
|
e.kind === "word" ? "font-sans" : "",
|
|
191
195
|
e.kind === "ident" || e.kind === "literal" ? "font-code" : "",
|
|
192
196
|
e.kind === "punctuation" ? "text-c-2" : ""
|
|
193
|
-
]]) },
|
|
197
|
+
]]) }, S(e.text), 3)], 64))), 128))])) : f("", !0)])) : X.value.length ? (y(), p("span", F, [(y(!0), p(l, null, b(X.value, (e, t) => (y(), p(l, { key: t }, [h(S(t > 0 ? " " : ""), 1), m("span", { class: v(["property-type-token", [
|
|
194
198
|
`property-type-token--${e.kind}`,
|
|
195
199
|
e.kind === "word" ? "font-sans" : "",
|
|
196
200
|
e.kind === "ident" || e.kind === "literal" ? "font-code" : "",
|
|
197
201
|
e.kind === "punctuation" ? "text-c-2" : ""
|
|
198
|
-
]]) },
|
|
202
|
+
]]) }, S(e.text), 3)], 64))), 128))])) : f("", !0)]),
|
|
199
203
|
_: 1
|
|
200
204
|
})) : f("", !0),
|
|
201
|
-
|
|
205
|
+
W.recursiveTo ? (y(), d(s, {
|
|
202
206
|
key: 2,
|
|
203
207
|
class: "property-recursive",
|
|
204
|
-
title:
|
|
208
|
+
title: C(G)("schema.recursiveReference", { name: W.recursiveTo })
|
|
205
209
|
}, {
|
|
206
|
-
default:
|
|
210
|
+
default: w(() => [h(S(C(G)("schema.recursive")), 1)]),
|
|
207
211
|
_: 1
|
|
208
212
|
}, 8, ["title"])) : f("", !0),
|
|
209
|
-
Z.value ? (
|
|
213
|
+
Z.value ? (y(), d(s, {
|
|
210
214
|
key: 3,
|
|
211
215
|
truncate: ""
|
|
212
216
|
}, {
|
|
213
|
-
prefix:
|
|
214
|
-
default:
|
|
217
|
+
prefix: w(() => [h(S(C(G)("schema.keys")) + ":", 1)]),
|
|
218
|
+
default: w(() => [h(" " + S(Z.value), 1)]),
|
|
215
219
|
_: 1
|
|
216
220
|
})) : f("", !0),
|
|
217
|
-
(
|
|
221
|
+
(y(!0), p(l, null, b(ie.value, (e) => (y(), d(s, {
|
|
218
222
|
key: e.key,
|
|
219
223
|
code: e.code,
|
|
220
224
|
truncate: e.truncate
|
|
221
|
-
},
|
|
222
|
-
default:
|
|
225
|
+
}, ne({
|
|
226
|
+
default: w(() => [e.key === "format" ? (y(), p("span", I, S(C(G)("schema.format")) + ": ", 1)) : f("", !0), h(" " + S(e.value), 1)]),
|
|
223
227
|
_: 2
|
|
224
228
|
}, [e.prefix ? {
|
|
225
229
|
name: "prefix",
|
|
226
|
-
fn:
|
|
230
|
+
fn: w(() => [h(S(e.prefix), 1)]),
|
|
227
231
|
key: "0"
|
|
228
232
|
} : void 0]), 1032, ["code", "truncate"]))), 128)),
|
|
229
|
-
|
|
230
|
-
default:
|
|
233
|
+
W.enum ? (y(), d(s, { key: 4 }, {
|
|
234
|
+
default: w(() => [h(S(C(G)("schema.enum")), 1)]),
|
|
231
235
|
_: 1
|
|
232
236
|
})) : f("", !0)
|
|
233
237
|
], 64)) : f("", !0),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
default:
|
|
238
|
+
W.additional ? (y(), p("div", L, [W.value?.["x-additionalPropertiesName"] ? (y(), p(l, { key: 0 }, [h(S(W.value["x-additionalPropertiesName"]), 1)], 64)) : (y(), p(l, { key: 1 }, [h(S(C(G)("schema.additionalProperties")), 1)], 64))])) : f("", !0),
|
|
239
|
+
W.value?.deprecated ? (y(), p("div", R, [g(i, null, {
|
|
240
|
+
default: w(() => [h(S(C(G)("schema.deprecated")), 1)]),
|
|
237
241
|
_: 1
|
|
238
242
|
})])) : f("", !0),
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
_.discriminatorValue === void 0 ? f("", !0) : (y(), p("span", z, [h(S(C(G)("schema.discriminatorValue")) + ": ", 1), g(o, { value: _.discriminatorValue }, null, 8, ["value"])])),
|
|
244
|
+
q.value === void 0 ? (y(), p(l, { key: 7 }, [W.value?.nullable === !0 ? (y(), d(s, { key: 0 }, {
|
|
245
|
+
default: w(() => [h(S(C(G)("schema.nullable")), 1)]),
|
|
241
246
|
_: 1
|
|
242
|
-
})) : f("", !0)], 64)) : (
|
|
243
|
-
prefix:
|
|
244
|
-
default:
|
|
247
|
+
})) : f("", !0)], 64)) : (y(), p("div", B, [g(s, { truncate: "" }, {
|
|
248
|
+
prefix: w(() => [h(S(C(G)("schema.const")) + ": ", 1)]),
|
|
249
|
+
default: w(() => [g(o, { value: q.value }, null, 8, ["value"])]),
|
|
245
250
|
_: 1
|
|
246
251
|
})])),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
key: 10,
|
|
251
|
-
value: H.value?.default
|
|
252
|
-
}, null, 8, ["value"])),
|
|
253
|
-
$.value ? (b(), d(c, {
|
|
252
|
+
W.value?.writeOnly ? (y(), p("div", V, S(C(G)("schema.writeOnly")), 1)) : W.value?.readOnly ? (y(), p("div", H, S(C(G)("schema.readOnly")), 1)) : f("", !0),
|
|
253
|
+
W.required ? (y(), p("div", U, S(C(G)("schema.required")), 1)) : f("", !0),
|
|
254
|
+
W.value?.default === void 0 ? f("", !0) : (y(), d(ee, {
|
|
254
255
|
key: 11,
|
|
256
|
+
value: W.value?.default
|
|
257
|
+
}, null, 8, ["value"])),
|
|
258
|
+
$.value ? (y(), d(te, {
|
|
259
|
+
key: 12,
|
|
255
260
|
pattern: $.value
|
|
256
261
|
}, null, 8, ["pattern"])) : f("", !0),
|
|
257
|
-
|
|
258
|
-
key:
|
|
262
|
+
W.withExamples && se.value ? (y(), d(c, {
|
|
263
|
+
key: 13,
|
|
259
264
|
example: Q.value,
|
|
260
|
-
examples:
|
|
265
|
+
examples: W.value?.examples
|
|
261
266
|
}, null, 8, ["example", "examples"])) : f("", !0),
|
|
262
|
-
|
|
263
|
-
|
|
267
|
+
x(e.$slots, "preview", {}, void 0, !0),
|
|
268
|
+
x(e.$slots, "trailing", {}, void 0, !0)
|
|
264
269
|
]));
|
|
265
270
|
}
|
|
266
271
|
});
|
|
267
272
|
//#endregion
|
|
268
|
-
export {
|
|
273
|
+
export { W as default };
|
|
269
274
|
|
|
270
275
|
//# sourceMappingURL=SchemaPropertyHeading.vue.script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyHeading.vue.script.js","names":["$slots"],"sources":["../../src/schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport Badge from '../shared/Badge.vue'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getDisplayTypeSignatureTokens } from './helpers/get-type-signature-tokens'\nimport {\n isModelLinkable,\n type ModelLinkOptions,\n} from './helpers/is-model-linkable'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\nimport SchemaPropertyPattern from './SchemaPropertyPattern.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /**\n * Config for deciding whether a model name links to the models section. When the section or\n * the referenced model is hidden there is nothing to scroll to, so the name renders as plain text.\n */\n modelLinkOptions?: ModelLinkOptions\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n /**\n * The row's name is a stand-in for keys the caller chooses\n * (`additionalProperties`) or keys matching a regex (`patternProperties`),\n * not a literal property. The heading says so in the signature line, where\n * the tree already describes shapes, instead of styling the name itself.\n */\n keyKind?: 'additional' | 'pattern'\n /**\n * The name of the schema this row loops back to. A cut cycle is a leaf, so\n * the signature line says why it does not expand; the model link beside it\n * already names the schema the loop returns to.\n */\n recursiveTo?: string\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\ntype ValidationProperty = {\n key: string\n value: string | number\n prefix?: string\n code?: boolean\n truncate?: boolean\n}\n\n/**\n * Constraints that live on a leaf (string or number) schema: length, pattern,\n * format and numeric ranges. Extracted so they can be surfaced for a primitive\n * schema as well as for a primitive array's items, which are not rendered on\n * their own. See https://github.com/scalar/scalar/issues/9690\n */\nconst getLeafConstraints = (schema: SchemaObject) => {\n const properties: ValidationProperty[] = []\n\n if (isStringSchema(schema)) {\n if (schema.minLength) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('schema.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (schema.maxLength) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('schema.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // pattern is rendered via SchemaPropertyPattern (hover dropdown), skip here\n }\n\n if ((isStringSchema(schema) || isNumberSchema(schema)) && schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('schema.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('schema.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('schema.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('schema.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('schema.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n}\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties: ValidationProperty[] = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (schema.minItems || schema.maxItems) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems || ''}…${schema.maxItems || ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('schema.unique')}!`,\n })\n }\n }\n\n properties.push(...getLeafConstraints(schema))\n\n // Primitive array items carry their own constraints (e.g. an array of `uuid`\n // strings) but are not rendered separately, so surface them here.\n if (isArraySchema(schema) && schema.items) {\n properties.push(...getLeafConstraints(resolve.schema(schema.items)))\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n return getModelNameWithArray(props.value)\n})\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, props.modelLinkOptions ?? {}),\n)\n\n/**\n * The type as a run of tokens rather than a single string — identifiers in\n * the code face, English words like `array of` in the sans face, and a muted\n * `|` so `string | null` reads as one type with an alternative.\n *\n * The token run and the screen-reader label are written straight into the\n * template instead of being their own components: the tree mounts one per\n * typed row, and a component instance costs more to create than the span it\n * renders. On a flat object the type cells would be most of the instance\n * count. The linked and the plain copy of the token markup below must stay\n * identical.\n */\nconst signatureTokens = computed(() =>\n getDisplayTypeSignatureTokens(props.value, {\n hideModelNames: props.hideModelNames,\n modelName: modelLink.value?.label,\n }),\n)\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n if (props.value && isArraySchema(props.value)) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n\n/**\n * Whether the examples chip has anything to render.\n *\n * `SchemaPropertyExamples` already renders nothing without an example, but it\n * still mounts, and mounting is what installs its popup's window-level click\n * and keydown listeners. `withExamples` defaults to true, so without this gate\n * every property row on the page — including a plain `{ type: 'string' }` —\n * pays for a popup it never opens. Mirrors the component's own two branches.\n */\nconst hasExampleContent = computed((): boolean => {\n if (exampleValue.value !== undefined) {\n return true\n }\n\n const examples = props.value?.examples\n\n return (\n !!examples &&\n typeof examples === 'object' &&\n Object.keys(examples).length > 0\n )\n})\n\n/**\n * The regex `pattern` to surface via the hover dropdown. It lives on a string\n * schema, or on the items of a primitive array (which is not rendered on its\n * own, so its constraints are surfaced on the array heading — see\n * https://github.com/scalar/scalar/issues/9690).\n */\nconst patternValue = computed(() => {\n const schema = valueRef.value\n if (!schema) {\n return undefined\n }\n\n if (isStringSchema(schema) && schema.pattern) {\n return schema.pattern\n }\n\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n if (isStringSchema(items) && items.pattern) {\n return items.pattern\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div\n class=\"property-heading [&>.property-detail:has(+.property-detail)]:mr-0\">\n <!-- `:has(+.property-detail)`: only a detail FOLLOWED BY another detail\n drops its right margin, because the `·` separator supplies the gap\n there. Not `:not(:last-of-type)`, which matches by element type: the\n collapsed preview and the trailing copy-link are spans as well, so it\n would strip the margin from the final detail and glue \"Addressrequired\"\n together on a collapsed row. -->\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('schema.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- A map key reads `additionalProperty · string`: the keyword leads the\n detail list in the accent colour, like a type word, so the name\n above it can look like every other name. -->\n <SchemaPropertyDetail\n v-if=\"props.keyKind\"\n class=\"property-key-kind\">\n <span class=\"font-code text-c-accent\">{{\n props.keyKind === 'pattern' ? 'patternProperty' : 'additionalProperty'\n }}</span>\n </SchemaPropertyDetail>\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <!-- The type is a token run (`array of Planet`) and a $ref link IS the\n type, not an appended `· Account` -->\n <!-- Written across lines on purpose: Vue drops whitespace-only text\n between two elements, so a single-line label would read\n `Type:string`. -->\n <span class=\"screenreader-only\"> {{ translate('schema.type') }}: </span>\n <button\n v-if=\"props.eventBus && modelLink?.schemaKey && modelLinkable\"\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n <span\n v-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </button>\n <span\n v-else-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </SchemaPropertyDetail>\n\n <!-- A cycle reads `array of Satellite · recursive`, a modifier like\n `nullable`; the full sentence rides the tooltip. -->\n <SchemaPropertyDetail\n v-if=\"props.recursiveTo\"\n class=\"property-recursive\"\n :title=\"\n translate('schema.recursiveReference', { name: props.recursiveTo })\n \">\n {{ translate('schema.recursive') }}\n </SchemaPropertyDetail>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('schema.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <span\n v-if=\"property.key === 'format'\"\n class=\"screenreader-only\">\n {{ translate('schema.format') }}:\n </span>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('schema.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('schema.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('schema.deprecated') }}</Badge>\n </div>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('schema.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('schema.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('schema.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('schema.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('schema.required') }}\n </div>\n <!-- Gated here, not only inside the component: each popup instance installs\n window-level click and keydown listeners for its dismissal, so mounting\n one per row costs the page a listener per row it never shows anything\n for. Same reason `SchemaPropertyPattern` below is gated. -->\n <SchemaPropertyDefault\n v-if=\"props.value?.default !== undefined\"\n :value=\"props.value?.default\" />\n <!--\n Pattern is a hover dropdown chip like Examples, not an inline constraint,\n so it sits beside the example. This keeps the real constraints (length,\n nullable, …) together in the dotted list. See #9966.\n -->\n <SchemaPropertyPattern\n v-if=\"patternValue\"\n :pattern=\"patternValue\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples && hasExampleContent\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n <!-- The collapsed preview rides the end of the heading line -->\n <slot name=\"preview\" />\n <!-- Last so the tab order matches the visual order: the trailing copy-link\n is painted at the row's right edge, after every control to its left -->\n <slot name=\"trailing\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n/*\n * Light-mode oranges are too bright on a light page for 13px text (the default\n * #ff5800 is 3.16:1), so blend the theme orange toward the text colour to reach\n * WCAG 1.4.3 (4.5:1) while keeping the hue and letting custom themes flow\n * through. Dark mode already passes (8.37:1) and keeps the plain token.\n */\n.light-mode .property-required {\n color: color-mix(\n in srgb,\n var(--scalar-color-orange),\n var(--scalar-color-1) 32%\n );\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,IAAM,IAAQ,GAyCR,EAAE,iBAAc,EAAgB,GAGhC,IAAW,EAAM,GAAO,OAAO,GAE/B,IAAa,QAAe;GAChC,IAAI,CAAC,EAAS,OACZ;GAGF,IAAM,IAAS,EAAS;GAGxB,IAAI,EAAO,UAAU,KAAA,GACnB,OAAO,EAAO;GAIhB,IAAI,EAAO,MAAM,WAAW,GAC1B,OAAO,EAAO,KAAK;GAIrB,IAAI,EAAc,CAAM,KAAK,EAAO,OAAO;IACzC,IAAM,IAAQ,EAAQ,OAAO,EAAO,KAAK;IAEzC,IAAI,EAAU,EAAM,KAAK,GACvB,OAAO,EAAM;IAGf,IAAI,EAAM,MAAM,WAAW,GACzB,OAAO,EAAM,KAAK;GAEtB;EAGF,CAAC,GAgBK,KAAsB,MAAyB;GACnD,IAAM,IAAmC,CAAC;GAwE1C,OAtEI,EAAe,CAAM,MACnB,EAAO,aACT,EAAW,KAAK;IACd,KAAK;IACL,QAAQ,GAAG,EAAU,kBAAkB,EAAE;IACzC,OAAO,EAAO;GAChB,CAAC,GAGC,EAAO,aACT,EAAW,KAAK;IACd,KAAK;IACL,QAAQ,GAAG,EAAU,kBAAkB,EAAE;IACzC,OAAO,EAAO;GAChB,CAAC,KAMA,EAAe,CAAM,KAA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|
+
{"version":3,"file":"SchemaPropertyHeading.vue.script.js","names":["$slots"],"sources":["../../src/schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport Badge from '../shared/Badge.vue'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getDisplayTypeSignatureTokens } from './helpers/get-type-signature-tokens'\nimport {\n isModelLinkable,\n type ModelLinkOptions,\n} from './helpers/is-model-linkable'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\nimport SchemaPropertyPattern from './SchemaPropertyPattern.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n /** Effective AsyncAPI variant value, separate from const/enum constraints. */\n discriminatorValue?: string\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /**\n * Config for deciding whether a model name links to the models section. When the section or\n * the referenced model is hidden there is nothing to scroll to, so the name renders as plain text.\n */\n modelLinkOptions?: ModelLinkOptions\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n /**\n * The row's name is a stand-in for keys the caller chooses\n * (`additionalProperties`) or keys matching a regex (`patternProperties`),\n * not a literal property. The heading says so in the signature line, where\n * the tree already describes shapes, instead of styling the name itself.\n */\n keyKind?: 'additional' | 'pattern'\n /**\n * The name of the schema this row loops back to. A cut cycle is a leaf, so\n * the signature line says why it does not expand; the model link beside it\n * already names the schema the loop returns to.\n */\n recursiveTo?: string\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\ntype ValidationProperty = {\n key: string\n value: string | number\n prefix?: string\n code?: boolean\n truncate?: boolean\n}\n\n/**\n * Constraints that live on a leaf (string or number) schema: length, pattern,\n * format and numeric ranges. Extracted so they can be surfaced for a primitive\n * schema as well as for a primitive array's items, which are not rendered on\n * their own. See https://github.com/scalar/scalar/issues/9690\n */\nconst getLeafConstraints = (schema: SchemaObject) => {\n const properties: ValidationProperty[] = []\n\n if (isStringSchema(schema)) {\n if (schema.minLength) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('schema.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (schema.maxLength) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('schema.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // pattern is rendered via SchemaPropertyPattern (hover dropdown), skip here\n }\n\n if ((isStringSchema(schema) || isNumberSchema(schema)) && schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('schema.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('schema.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('schema.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('schema.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('schema.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n}\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties: ValidationProperty[] = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (schema.minItems || schema.maxItems) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems || ''}…${schema.maxItems || ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('schema.unique')}!`,\n })\n }\n }\n\n properties.push(...getLeafConstraints(schema))\n\n // Primitive array items carry their own constraints (e.g. an array of `uuid`\n // strings) but are not rendered separately, so surface them here.\n if (isArraySchema(schema) && schema.items) {\n properties.push(...getLeafConstraints(resolve.schema(schema.items)))\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n return getModelNameWithArray(props.value)\n})\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, props.modelLinkOptions ?? {}),\n)\n\n/**\n * The type as a run of tokens rather than a single string — identifiers in\n * the code face, English words like `array of` in the sans face, and a muted\n * `|` so `string | null` reads as one type with an alternative.\n *\n * The token run and the screen-reader label are written straight into the\n * template instead of being their own components: the tree mounts one per\n * typed row, and a component instance costs more to create than the span it\n * renders. On a flat object the type cells would be most of the instance\n * count. The linked and the plain copy of the token markup below must stay\n * identical.\n */\nconst signatureTokens = computed(() =>\n getDisplayTypeSignatureTokens(props.value, {\n hideModelNames: props.hideModelNames,\n modelName: modelLink.value?.label,\n }),\n)\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n if (props.value && isArraySchema(props.value)) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n\n/**\n * Whether the examples chip has anything to render.\n *\n * `SchemaPropertyExamples` already renders nothing without an example, but it\n * still mounts, and mounting is what installs its popup's window-level click\n * and keydown listeners. `withExamples` defaults to true, so without this gate\n * every property row on the page — including a plain `{ type: 'string' }` —\n * pays for a popup it never opens. Mirrors the component's own two branches.\n */\nconst hasExampleContent = computed((): boolean => {\n if (exampleValue.value !== undefined) {\n return true\n }\n\n const examples = props.value?.examples\n\n return (\n !!examples &&\n typeof examples === 'object' &&\n Object.keys(examples).length > 0\n )\n})\n\n/**\n * The regex `pattern` to surface via the hover dropdown. It lives on a string\n * schema, or on the items of a primitive array (which is not rendered on its\n * own, so its constraints are surfaced on the array heading — see\n * https://github.com/scalar/scalar/issues/9690).\n */\nconst patternValue = computed(() => {\n const schema = valueRef.value\n if (!schema) {\n return undefined\n }\n\n if (isStringSchema(schema) && schema.pattern) {\n return schema.pattern\n }\n\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n if (isStringSchema(items) && items.pattern) {\n return items.pattern\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div\n class=\"property-heading [&>.property-detail:has(+.property-detail)]:mr-0\">\n <!-- `:has(+.property-detail)`: only a detail FOLLOWED BY another detail\n drops its right margin, because the `·` separator supplies the gap\n there. Not `:not(:last-of-type)`, which matches by element type: the\n collapsed preview and the trailing copy-link are spans as well, so it\n would strip the margin from the final detail and glue \"Addressrequired\"\n together on a collapsed row. -->\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('schema.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- A map key reads `additionalProperty · string`: the keyword leads the\n detail list in the accent colour, like a type word, so the name\n above it can look like every other name. -->\n <SchemaPropertyDetail\n v-if=\"props.keyKind\"\n class=\"property-key-kind\">\n <span class=\"font-code text-c-accent\">{{\n props.keyKind === 'pattern' ? 'patternProperty' : 'additionalProperty'\n }}</span>\n </SchemaPropertyDetail>\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <!-- The type is a token run (`array of Planet`) and a $ref link IS the\n type, not an appended `· Account` -->\n <!-- Written across lines on purpose: Vue drops whitespace-only text\n between two elements, so a single-line label would read\n `Type:string`. -->\n <span class=\"screenreader-only\"> {{ translate('schema.type') }}: </span>\n <button\n v-if=\"props.eventBus && modelLink?.schemaKey && modelLinkable\"\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n <span\n v-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </button>\n <span\n v-else-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </SchemaPropertyDetail>\n\n <!-- A cycle reads `array of Satellite · recursive`, a modifier like\n `nullable`; the full sentence rides the tooltip. -->\n <SchemaPropertyDetail\n v-if=\"props.recursiveTo\"\n class=\"property-recursive\"\n :title=\"\n translate('schema.recursiveReference', { name: props.recursiveTo })\n \">\n {{ translate('schema.recursive') }}\n </SchemaPropertyDetail>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('schema.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <span\n v-if=\"property.key === 'format'\"\n class=\"screenreader-only\">\n {{ translate('schema.format') }}:\n </span>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('schema.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('schema.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('schema.deprecated') }}</Badge>\n </div>\n <span\n v-if=\"discriminatorValue !== undefined\"\n class=\"text-c-2\">\n {{ translate('schema.discriminatorValue') }}:\n <RenderString :value=\"discriminatorValue\" />\n </span>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('schema.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('schema.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('schema.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('schema.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('schema.required') }}\n </div>\n <!-- Gated here, not only inside the component: each popup instance installs\n window-level click and keydown listeners for its dismissal, so mounting\n one per row costs the page a listener per row it never shows anything\n for. Same reason `SchemaPropertyPattern` below is gated. -->\n <SchemaPropertyDefault\n v-if=\"props.value?.default !== undefined\"\n :value=\"props.value?.default\" />\n <!--\n Pattern is a hover dropdown chip like Examples, not an inline constraint,\n so it sits beside the example. This keeps the real constraints (length,\n nullable, …) together in the dotted list. See #9966.\n -->\n <SchemaPropertyPattern\n v-if=\"patternValue\"\n :pattern=\"patternValue\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples && hasExampleContent\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n <!-- The collapsed preview rides the end of the heading line -->\n <slot name=\"preview\" />\n <!-- Last so the tab order matches the visual order: the trailing copy-link\n is painted at the row's right edge, after every control to its left -->\n <slot name=\"trailing\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n/*\n * Light-mode oranges are too bright on a light page for 13px text (the default\n * #ff5800 is 3.16:1), so blend the theme orange toward the text colour to reach\n * WCAG 1.4.3 (4.5:1) while keeping the hue and letting custom themes flow\n * through. Dark mode already passes (8.37:1) and keeps the plain token.\n */\n.light-mode .property-required {\n color: color-mix(\n in srgb,\n var(--scalar-color-orange),\n var(--scalar-color-1) 32%\n );\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BA,IAAM,IAAQ,GA2CR,EAAE,iBAAc,EAAgB,GAGhC,IAAW,GAAM,GAAO,OAAO,GAE/B,IAAa,QAAe;GAChC,IAAI,CAAC,EAAS,OACZ;GAGF,IAAM,IAAS,EAAS;GAGxB,IAAI,EAAO,UAAU,KAAA,GACnB,OAAO,EAAO;GAIhB,IAAI,EAAO,MAAM,WAAW,GAC1B,OAAO,EAAO,KAAK;GAIrB,IAAI,EAAc,CAAM,KAAK,EAAO,OAAO;IACzC,IAAM,IAAQ,EAAQ,OAAO,EAAO,KAAK;IAEzC,IAAI,EAAU,EAAM,KAAK,GACvB,OAAO,EAAM;IAGf,IAAI,EAAM,MAAM,WAAW,GACzB,OAAO,EAAM,KAAK;GAEtB;EAGF,CAAC,GAgBK,KAAsB,MAAyB;GACnD,IAAM,IAAmC,CAAC;GAwE1C,OAtEI,EAAe,CAAM,MACnB,EAAO,aACT,EAAW,KAAK;IACd,KAAK;IACL,QAAQ,GAAG,EAAU,kBAAkB,EAAE;IACzC,OAAO,EAAO;GAChB,CAAC,GAGC,EAAO,aACT,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AY,KAAA,iBAAA,EAAA,GADjC,EAEkC,IAAA;;IAA/B,OAAO,EAAM,OAAO;;GAOf,EAAA,SAAA,EAAA,GADR,EAE4B,IAAA;;IAAzB,SAAS,EAAA;;GAEJ,EAAM,gBAAgB,GAAA,SAAA,EAAA,GAD9B,EAGsC,GAAA;;IADnC,SAAS,EAAA;IACT,UAAU,EAAM,OAAO;;GAE1B,EAAuB,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA;GAGvB,EAAwB,EAAA,QAAA,YAAA,CAAA,GAAA,KAAA,GAAA,EAAA"}
|
|
@@ -2,7 +2,7 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
|
2
2
|
import t from "./SchemaPropertyPattern.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/schema/SchemaPropertyPattern.vue
|
|
5
|
-
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-e8f7b07b"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { n as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyPattern.vue.js","names":[],"sources":["../../src/schema/SchemaPropertyPattern.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { ref } from 'vue'\n\nimport LinkButton from './LinkButton.vue'\nimport { useLocalization } from './localization'\n\nconst { pattern } = defineProps<{ pattern: string }>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n/**\n * The popup reveals on hover and keyboard focus purely via CSS. Touch devices\n * have no hover, so a click/tap also pins it open, and a second click, a click\n * outside, or Escape closes it again. Without this the full pattern was\n * unreachable on mobile — a regression from the old inline (truncated) text.\n */\nconst rootRef = ref<HTMLElement | null>(null)\nconst isOpen = ref(false)\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n}\n\nconst close = () => {\n isOpen.value = false\n}\n\nonClickOutside(rootRef, close)\nonKeyStroke('Escape', () => {\n if (isOpen.value) {\n close()\n }\n})\n</script>\n<template>\n <div\n ref=\"rootRef\"\n class=\"property-pattern\"\n :class=\"{ 'is-open': isOpen }\">\n <LinkButton\n class=\"decoration-dotted\"\n @click=\"toggle\">\n {{ translate('schema.pattern') }}\n </LinkButton>\n <div class=\"property-pattern-popup\">\n <button\n
|
|
1
|
+
{"version":3,"file":"SchemaPropertyPattern.vue.js","names":[],"sources":["../../src/schema/SchemaPropertyPattern.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { ref } from 'vue'\n\nimport LinkButton from './LinkButton.vue'\nimport { useLocalization } from './localization'\n\nconst { pattern } = defineProps<{ pattern: string }>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n/**\n * The popup reveals on hover and keyboard focus purely via CSS. Touch devices\n * have no hover, so a click/tap also pins it open, and a second click, a click\n * outside, or Escape closes it again. Without this the full pattern was\n * unreachable on mobile — a regression from the old inline (truncated) text.\n */\nconst rootRef = ref<HTMLElement | null>(null)\nconst isOpen = ref(false)\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n}\n\nconst close = () => {\n isOpen.value = false\n}\n\nonClickOutside(rootRef, close)\nonKeyStroke('Escape', () => {\n if (isOpen.value) {\n close()\n }\n})\n</script>\n<template>\n <div\n ref=\"rootRef\"\n class=\"property-pattern\"\n :class=\"{ 'is-open': isOpen }\">\n <LinkButton\n class=\"decoration-dotted\"\n @click=\"toggle\">\n {{ translate('schema.pattern') }}\n </LinkButton>\n <div class=\"property-pattern-popup\">\n <button\n :aria-label=\"`${translate('schema.copyPattern')}: ${pattern}`\"\n class=\"property-pattern-value group\"\n type=\"button\"\n @click=\"copyToClipboard(pattern)\">\n <code>{{ pattern }}</code>\n <ScalarIcon\n aria-hidden=\"true\"\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n@reference \"../style.css\";\n\n.property-pattern {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n\n/*\n * Invisible bridge that fills the gap between the label and the popup, so the\n * pointer can travel down into the popup without dropping the `:hover` state.\n * Mirrors the same trick in SchemaPropertyExamples.vue.\n */\n.property-pattern:hover::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n\n.property-pattern-popup {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n /* Cap the width so the centered popup never overflows a narrow viewport\n * (mobile, modal). Long patterns wrap instead of widening it. */\n max-width: min(500px, calc(100vw - 32px));\n /* Cap the height too, so a very long multi-line regex scrolls inside the\n * popup instead of running off the bottom of the viewport. */\n max-height: min(400px, calc(100vh - 32px));\n overflow-y: auto;\n display: none;\n @apply z-context;\n}\n\n.property-pattern:hover .property-pattern-popup,\n.property-pattern:focus-within .property-pattern-popup,\n.property-pattern.is-open .property-pattern-popup {\n display: flex;\n}\n\n.property-pattern-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n /* Top-align so the copy icon stays with the first line of a wrapped pattern. */\n align-items: flex-start;\n width: 100%;\n padding: 6px;\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n\n.property-pattern-value code {\n font-family: var(--scalar-font-code);\n font-size: var(--scalar-font-size-3);\n color: var(--scalar-color-2);\n /* Wrap long regex so the full pattern is readable, not just copyable. */\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n flex: 1;\n text-align: left;\n}\n</style>\n"],"mappings":""}
|
|
@@ -27,9 +27,9 @@ var _ = { class: "property-pattern-popup" }, v = ["aria-label"], y = /*@__PURE__
|
|
|
27
27
|
default: f(() => [i(u(d(b)("schema.pattern")), 1)]),
|
|
28
28
|
_: 1
|
|
29
29
|
}), r("div", _, [r("button", {
|
|
30
|
+
"aria-label": `${d(b)("schema.copyPattern")}: ${o.pattern}`,
|
|
30
31
|
class: "property-pattern-value group",
|
|
31
32
|
type: "button",
|
|
32
|
-
"aria-label": `${d(b)("schema.copyPattern")}: ${o.pattern}`,
|
|
33
33
|
onClick: l[0] ||= (e) => d(y)(o.pattern)
|
|
34
34
|
}, [r("code", null, u(o.pattern), 1), a(d(p), {
|
|
35
35
|
"aria-hidden": "true",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyPattern.vue.script.js","names":[],"sources":["../../src/schema/SchemaPropertyPattern.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { ref } from 'vue'\n\nimport LinkButton from './LinkButton.vue'\nimport { useLocalization } from './localization'\n\nconst { pattern } = defineProps<{ pattern: string }>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n/**\n * The popup reveals on hover and keyboard focus purely via CSS. Touch devices\n * have no hover, so a click/tap also pins it open, and a second click, a click\n * outside, or Escape closes it again. Without this the full pattern was\n * unreachable on mobile — a regression from the old inline (truncated) text.\n */\nconst rootRef = ref<HTMLElement | null>(null)\nconst isOpen = ref(false)\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n}\n\nconst close = () => {\n isOpen.value = false\n}\n\nonClickOutside(rootRef, close)\nonKeyStroke('Escape', () => {\n if (isOpen.value) {\n close()\n }\n})\n</script>\n<template>\n <div\n ref=\"rootRef\"\n class=\"property-pattern\"\n :class=\"{ 'is-open': isOpen }\">\n <LinkButton\n class=\"decoration-dotted\"\n @click=\"toggle\">\n {{ translate('schema.pattern') }}\n </LinkButton>\n <div class=\"property-pattern-popup\">\n <button\n
|
|
1
|
+
{"version":3,"file":"SchemaPropertyPattern.vue.script.js","names":[],"sources":["../../src/schema/SchemaPropertyPattern.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { onClickOutside, onKeyStroke } from '@vueuse/core'\nimport { ref } from 'vue'\n\nimport LinkButton from './LinkButton.vue'\nimport { useLocalization } from './localization'\n\nconst { pattern } = defineProps<{ pattern: string }>()\n\nconst { copyToClipboard } = useClipboard()\nconst { translate } = useLocalization()\n\n/**\n * The popup reveals on hover and keyboard focus purely via CSS. Touch devices\n * have no hover, so a click/tap also pins it open, and a second click, a click\n * outside, or Escape closes it again. Without this the full pattern was\n * unreachable on mobile — a regression from the old inline (truncated) text.\n */\nconst rootRef = ref<HTMLElement | null>(null)\nconst isOpen = ref(false)\n\nconst toggle = () => {\n isOpen.value = !isOpen.value\n}\n\nconst close = () => {\n isOpen.value = false\n}\n\nonClickOutside(rootRef, close)\nonKeyStroke('Escape', () => {\n if (isOpen.value) {\n close()\n }\n})\n</script>\n<template>\n <div\n ref=\"rootRef\"\n class=\"property-pattern\"\n :class=\"{ 'is-open': isOpen }\">\n <LinkButton\n class=\"decoration-dotted\"\n @click=\"toggle\">\n {{ translate('schema.pattern') }}\n </LinkButton>\n <div class=\"property-pattern-popup\">\n <button\n :aria-label=\"`${translate('schema.copyPattern')}: ${pattern}`\"\n class=\"property-pattern-value group\"\n type=\"button\"\n @click=\"copyToClipboard(pattern)\">\n <code>{{ pattern }}</code>\n <ScalarIcon\n aria-hidden=\"true\"\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n@reference \"../style.css\";\n\n.property-pattern {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n\n/*\n * Invisible bridge that fills the gap between the label and the popup, so the\n * pointer can travel down into the popup without dropping the `:hover` state.\n * Mirrors the same trick in SchemaPropertyExamples.vue.\n */\n.property-pattern:hover::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n\n.property-pattern-popup {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n /* Cap the width so the centered popup never overflows a narrow viewport\n * (mobile, modal). Long patterns wrap instead of widening it. */\n max-width: min(500px, calc(100vw - 32px));\n /* Cap the height too, so a very long multi-line regex scrolls inside the\n * popup instead of running off the bottom of the viewport. */\n max-height: min(400px, calc(100vh - 32px));\n overflow-y: auto;\n display: none;\n @apply z-context;\n}\n\n.property-pattern:hover .property-pattern-popup,\n.property-pattern:focus-within .property-pattern-popup,\n.property-pattern.is-open .property-pattern-popup {\n display: flex;\n}\n\n.property-pattern-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n /* Top-align so the copy icon stays with the first line of a wrapped pattern. */\n align-items: flex-start;\n width: 100%;\n padding: 6px;\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n\n.property-pattern-value code {\n font-family: var(--scalar-font-code);\n font-size: var(--scalar-font-size-3);\n color: var(--scalar-color-2);\n /* Wrap long regex so the full pattern is readable, not just copyable. */\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n flex: 1;\n text-align: left;\n}\n</style>\n"],"mappings":";;;;;;;;;;;EAWA,IAAM,EAAE,uBAAoB,EAAa,GACnC,EAAE,iBAAc,EAAgB,GAQhC,IAAU,EAAwB,IAAI,GACtC,IAAS,EAAI,EAAK,GAElB,UAAe;GACnB,EAAO,QAAQ,CAAC,EAAO;EACzB,GAEM,UAAc;GAClB,EAAO,QAAQ;EACjB;SAEA,EAAe,GAAS,CAAK,GAC7B,EAAY,gBAAgB;GAC1B,AAAI,EAAO,SACT,EAAM;EAEV,CAAC,mBAGC,EAuBM,OAAA;YAtBA;GAAJ,KAAI;GACJ,OAAK,EAAA,CAAC,oBAAkB,EAAA,WACH,EAAA,MAAM,CAAA,CAAA;MAC3B,EAIa,GAAA;GAHX,OAAM;GACL,SAAO;;oBACyB,CAAA,EAAA,EAA9B,EAAA,CAAA,CAAS,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;MAEd,EAaM,OAbN,GAaM,CAZJ,EAWS,UAAA;GAVN,cAAU,GAAK,EAAA,CAAA,CAAS,CAAA,oBAAA,EAAA,IAA2B,EAAA;GACpD,OAAM;GACN,MAAK;GACJ,SAAK,AAAA,EAAA,QAAA,MAAE,EAAA,CAAA,CAAe,CAAC,EAAA,OAAO;MAC/B,EAA0B,QAAA,MAAA,EAAjB,EAAA,OAAO,GAAA,CAAA,GAChB,EAIc,EAAA,CAAA,GAAA;GAHZ,eAAY;GACZ,OAAM;GACN,MAAK;GACL,MAAK"}
|