@scalar/api-reference 1.32.9 → 1.32.10

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 (122) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/browser/standalone.js +15115 -14878
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  6. package/dist/components/ApiReferenceLayout.vue2.js +164 -176
  7. package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
  8. package/dist/components/Badge/Badge.vue.js +3 -3
  9. package/dist/components/Content/Content.vue.js +2 -2
  10. package/dist/components/Content/Content.vue2.js +21 -21
  11. package/dist/components/Content/Introduction/Description.vue.d.ts.map +1 -1
  12. package/dist/components/Content/Introduction/Description.vue.js +2 -2
  13. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  15. package/dist/components/Content/Introduction/Introduction.vue2.js +104 -72
  16. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  17. package/dist/components/LinkList/LinkList.vue.d.ts +18 -0
  18. package/dist/components/LinkList/LinkList.vue.d.ts.map +1 -0
  19. package/dist/components/LinkList/LinkList.vue.js +12 -0
  20. package/dist/components/LinkList/index.d.ts +2 -0
  21. package/dist/components/LinkList/index.d.ts.map +1 -0
  22. package/dist/components/Section/SectionHeader.vue.d.ts +1 -0
  23. package/dist/components/Section/SectionHeader.vue.d.ts.map +1 -1
  24. package/dist/components/Section/SectionHeader.vue.js +2 -2
  25. package/dist/components/Section/SectionHeader.vue2.js +11 -10
  26. package/dist/features/Operation/Operation.vue.d.ts +6 -6
  27. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  28. package/dist/features/Operation/Operation.vue.js +50 -49
  29. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +8 -6
  30. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  31. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  32. package/dist/features/Operation/components/callbacks/Callback.vue2.js +21 -28
  33. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +5 -3
  34. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  35. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +33 -18
  36. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +11 -12
  37. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  38. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  39. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +164 -163
  40. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +12 -13
  41. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  42. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  43. package/dist/features/Operation/layouts/ModernLayout.vue2.js +111 -118
  44. package/dist/features/api-client-modal/useApiClient.d.ts +5299 -5299
  45. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  46. package/dist/features/base-url/BaseUrl.vue.d.ts.map +1 -1
  47. package/dist/features/base-url/BaseUrl.vue.js +26 -26
  48. package/dist/features/download-link/DownloadLink.vue.js +1 -1
  49. package/dist/features/example-responses/ExampleResponseTab.vue.js +2 -2
  50. package/dist/features/example-responses/ExampleResponseTabList.vue.js +1 -1
  51. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  52. package/dist/features/example-responses/ExampleResponses.vue.js +2 -2
  53. package/dist/features/example-responses/ExampleResponses.vue2.js +60 -57
  54. package/dist/features/external-docs/ExternalDocs.vue.d.ts +7 -0
  55. package/dist/features/external-docs/ExternalDocs.vue.d.ts.map +1 -0
  56. package/dist/features/external-docs/ExternalDocs.vue.js +36 -0
  57. package/dist/features/external-docs/ExternalDocs.vue2.js +4 -0
  58. package/dist/features/external-docs/index.d.ts +2 -0
  59. package/dist/features/external-docs/index.d.ts.map +1 -0
  60. package/dist/features/info-object/Contact.vue.d.ts +7 -0
  61. package/dist/features/info-object/Contact.vue.d.ts.map +1 -0
  62. package/dist/features/info-object/Contact.vue.js +44 -0
  63. package/dist/features/info-object/Contact.vue2.js +4 -0
  64. package/dist/features/info-object/License.vue.d.ts +7 -0
  65. package/dist/features/info-object/License.vue.d.ts.map +1 -0
  66. package/dist/features/info-object/License.vue.js +34 -0
  67. package/dist/features/info-object/License.vue2.js +4 -0
  68. package/dist/features/info-object/TermsOfService.vue.d.ts +7 -0
  69. package/dist/features/info-object/TermsOfService.vue.d.ts.map +1 -0
  70. package/dist/features/info-object/TermsOfService.vue.js +30 -0
  71. package/dist/features/info-object/TermsOfService.vue2.js +4 -0
  72. package/dist/features/info-object/index.d.ts +4 -0
  73. package/dist/features/info-object/index.d.ts.map +1 -0
  74. package/dist/features/test-request-button/TestRequestButton.vue.d.ts +3 -2
  75. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  76. package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
  77. package/dist/features/test-request-button/TestRequestButton.vue2.js +21 -19
  78. package/dist/helpers/convert-security-scheme.js +23 -0
  79. package/dist/index.d.ts +0 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +13 -15
  82. package/dist/style.css +1 -1
  83. package/dist/v2/ApiReferenceWorkspace.vue.d.ts +3 -1
  84. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  85. package/dist/v2/ApiReferenceWorkspace.vue.js +113 -86
  86. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.d.ts +0 -2
  87. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.d.ts.map +1 -1
  88. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +4 -0
  89. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +69 -0
  90. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
  91. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +7 -0
  92. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +227 -0
  93. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +20 -3
  94. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +35 -0
  95. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +29 -0
  96. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +10 -0
  97. package/dist/v2/blocks/scalar-request-example-block/index.d.ts +2 -2
  98. package/dist/v2/events/definitions.js +7 -0
  99. package/dist/v2/events/index.d.ts +1 -1
  100. package/dist/v2/events/listeners.d.ts +1 -1
  101. package/dist/v2/hooks/useStore.js +14 -0
  102. package/package.json +11 -11
  103. package/LICENSE +0 -21
  104. package/dist/blocks/constants.js +0 -6
  105. package/dist/blocks/helpers/getPointer.js +0 -12
  106. package/dist/blocks/hooks/useBlockProps.d.ts +0 -31
  107. package/dist/blocks/hooks/useBlockProps.d.ts.map +0 -1
  108. package/dist/blocks/hooks/useBlockProps.js +0 -24
  109. package/dist/features/example-request/ExamplePicker.vue.d.ts +0 -13
  110. package/dist/features/example-request/ExamplePicker.vue.d.ts.map +0 -1
  111. package/dist/features/example-request/ExamplePicker.vue.js +0 -7
  112. package/dist/features/example-request/ExamplePicker.vue2.js +0 -57
  113. package/dist/features/example-request/ExampleRequest.vue.d.ts +0 -85
  114. package/dist/features/example-request/ExampleRequest.vue.d.ts.map +0 -1
  115. package/dist/features/example-request/ExampleRequest.vue.js +0 -7
  116. package/dist/features/example-request/ExampleRequest.vue2.js +0 -348
  117. package/dist/features/example-request/TextSelect.vue.d.ts +0 -34
  118. package/dist/features/example-request/TextSelect.vue.d.ts.map +0 -1
  119. package/dist/features/example-request/TextSelect.vue.js +0 -48
  120. package/dist/features/example-request/TextSelect.vue3.js +0 -5
  121. package/dist/features/example-request/index.d.ts +0 -3
  122. package/dist/features/example-request/index.d.ts.map +0 -1
@@ -11,7 +11,9 @@ declare function __VLS_template(): {
11
11
  footer?(_: {}): any;
12
12
  "sidebar-start"?(_: {}): any;
13
13
  };
14
- refs: {};
14
+ refs: {
15
+ root: HTMLDivElement;
16
+ };
15
17
  rootEl: any;
16
18
  };
17
19
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"AAqUA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA0BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,iBAAiB,EAAE,MAAM,cAAc,CAAA;CACxC,CAAC;AAuNF,iBAAS,cAAc;WA0GT,OAAO,IAA6B;;wBAVrB,GAAG;wBACH,GAAG;iCACM,GAAG;;;;EAaxC;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"AAuXA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAA;AAGjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA2BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,iBAAiB,EAAE,MAAM,cAAc,CAAA;CACxC,CAAC;AAwQF,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;wBAXrB,GAAG;wBACH,GAAG;iCACM,GAAG;;;;;;EAcxC;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,43 +1,47 @@
1
- import { defineComponent as V, ref as f, toRef as b, provide as _, shallowRef as w, onServerPrefetch as $, onMounted as C, watch as d, computed as A, createElementBlock as B, openBlock as D, Fragment as F, createBlock as P, createCommentVNode as U, createVNode as S, unref as r, resolveDynamicComponent as W, withCtx as n, createTextVNode as Y, toDisplayString as O, renderSlot as p, isRef as j } from "vue";
2
- import { safeLocalStorage as x, REFERENCE_LS_KEYS as h } from "@scalar/helpers/object/local-storage";
3
- import { parseJsonOrYaml as J, redirectToProxy as K } from "@scalar/oas-utils/helpers";
4
- import { useColorMode as q } from "@scalar/use-hooks/useColorMode";
5
- import { useSeoMeta as z } from "@unhead/vue";
6
- import { useFavicon as G } from "@vueuse/core";
7
- import H from "../components/ApiReferenceLayout.vue.js";
8
- import { NAV_STATE_SYMBOL as Q } from "../hooks/useNavState.js";
9
- import { isClient as X } from "./blocks/scalar-request-example-block/helpers/find-client.js";
10
- import { useMultipleDocuments as Z } from "../features/multiple-documents/useMultipleDocuments.js";
11
- import { onCustomEvent as v } from "./events/listeners.js";
12
- import ee from "../features/multiple-documents/DocumentSelector.vue.js";
13
- const fe = /* @__PURE__ */ V({
1
+ import { defineComponent as b, ref as p, toRef as A, provide as B, useTemplateRef as P, onServerPrefetch as V, onMounted as F, watch as n, computed as H, createElementBlock as U, openBlock as y, createBlock as W, createCommentVNode as Y, createVNode as D, unref as l, resolveDynamicComponent as O, withCtx as i, createTextVNode as j, toDisplayString as w, renderSlot as v, isRef as J } from "vue";
2
+ import { safeLocalStorage as S, REFERENCE_LS_KEYS as g } from "@scalar/helpers/object/local-storage";
3
+ import { parseJsonOrYaml as q, redirectToProxy as z } from "@scalar/oas-utils/helpers";
4
+ import { useColorMode as G } from "@scalar/use-hooks/useColorMode";
5
+ import { useSeoMeta as Q } from "@unhead/vue";
6
+ import { useFavicon as X } from "@vueuse/core";
7
+ import Z from "../components/ApiReferenceLayout.vue.js";
8
+ import { NAV_STATE_SYMBOL as ee } from "../hooks/useNavState.js";
9
+ import { useHttpClientStore as te } from "../stores/useHttpClientStore.js";
10
+ import { isClient as k } from "./blocks/scalar-request-example-block/helpers/find-client.js";
11
+ import { useStore as oe } from "./hooks/useStore.js";
12
+ import { useMultipleDocuments as ae } from "../features/multiple-documents/useMultipleDocuments.js";
13
+ import { onCustomEvent as C } from "./events/listeners.js";
14
+ import re from "../features/multiple-documents/DocumentSelector.vue.js";
15
+ const xe = /* @__PURE__ */ b({
14
16
  __name: "ApiReferenceWorkspace",
15
17
  props: {
16
18
  configuration: {},
17
19
  getWorkspaceStore: { type: Function }
18
20
  },
19
- setup(M) {
20
- const k = M, {
21
- availableDocuments: l,
21
+ setup(h) {
22
+ const E = h, {
23
+ availableDocuments: u,
22
24
  selectedConfiguration: a,
23
- selectedDocumentIndex: s,
24
- isIntersectionEnabled: g,
25
- hash: y,
26
- hashPrefix: T
27
- } = Z({
28
- configuration: b(k, "configuration"),
29
- isIntersectionEnabled: f(!1),
30
- hash: f(""),
31
- hashPrefix: f("")
32
- }), L = (e, t) => fetch(
33
- K(a.value.proxyUrl, e.toString()),
25
+ selectedDocumentIndex: d,
26
+ isIntersectionEnabled: M,
27
+ hash: T,
28
+ hashPrefix: I
29
+ } = ae({
30
+ configuration: A(E, "configuration"),
31
+ isIntersectionEnabled: p(!1),
32
+ hash: p(""),
33
+ hashPrefix: p("")
34
+ }), { httpClient: $, setExcludedClients: L, setDefaultHttpClient: x } = te(), K = (e, t) => fetch(
35
+ z(a.value.proxyUrl, e.toString()),
34
36
  t
35
37
  );
36
- _(Q, { isIntersectionEnabled: g, hash: y, hashPrefix: T });
37
- const i = w(null), o = k.getWorkspaceStore(), c = l, u = (e) => {
38
+ B(ee, { isIntersectionEnabled: M, hash: T, hashPrefix: I });
39
+ const c = P("root"), o = E.getWorkspaceStore();
40
+ oe(o);
41
+ const f = u, m = (e) => {
38
42
  if (o.workspace.documents[e.slug ?? "default"] === void 0) {
39
43
  if (e.content) {
40
- const t = typeof e.content == "string" ? J(e.content) : e.content;
44
+ const t = typeof e.content == "string" ? q(e.content) : e.content;
41
45
  return o.addDocumentSync({
42
46
  name: e.slug ?? "default",
43
47
  document: typeof t == "function" ? t() : t
@@ -47,97 +51,120 @@ const fe = /* @__PURE__ */ V({
47
51
  return o.addDocument({
48
52
  name: e.slug ?? "default",
49
53
  url: e.url,
50
- fetch: L
54
+ fetch: K
51
55
  });
52
56
  }
53
57
  };
54
- c.value.forEach((e) => {
55
- e.content && u(e);
56
- }), $(() => {
57
- c.value.forEach((e) => {
58
- e.url && u(e);
58
+ f.value.forEach((e) => {
59
+ e.content && m(e);
60
+ }), V(() => {
61
+ f.value.forEach((e) => {
62
+ e.url && m(e);
59
63
  });
60
- }), C(() => {
61
- c.value.forEach((e) => {
62
- e.url && u(e);
64
+ }), F(() => {
65
+ f.value.forEach((t) => {
66
+ t.url && m(t);
63
67
  });
64
- }), v(i, "scalar-update-dark-mode", (e) => {
68
+ const e = S().getItem(
69
+ g.SELECTED_CLIENT
70
+ );
71
+ k(e) && !o.workspace["x-scalar-default-client"] && o.update("x-scalar-default-client", e);
72
+ }), C(c, "scalar-update-dark-mode", (e) => {
65
73
  o.update("x-scalar-dark-mode", e.detail.value);
66
- }), v(i, "scalar-update-active-document", (e) => {
74
+ }), C(c, "scalar-update-active-document", (e) => {
67
75
  o.update("x-scalar-active-document", e.detail.value);
68
- }), v(i, "scalar-update-selected-client", (e) => {
69
- o.update("x-scalar-default-client", e.detail), x().setItem(h.SELECTED_CLIENT, e.detail);
70
- }), C(() => {
71
- const e = x().getItem(
72
- h.SELECTED_CLIENT
73
- );
74
- X(e) && o.update("x-scalar-default-client", e);
75
- });
76
- const { toggleColorMode: I, isDarkMode: N } = q({
76
+ }), C(c, "scalar-update-selected-client", (e) => {
77
+ o.update("x-scalar-default-client", e.detail), S().setItem(g.SELECTED_CLIENT, e.detail);
78
+ const [t, r] = e.detail.split("/");
79
+ x({
80
+ targetKey: t,
81
+ clientKey: r
82
+ });
83
+ }), n(
84
+ () => a.value.hiddenClients,
85
+ (e) => e && L(e)
86
+ ), n($, (e) => {
87
+ var r;
88
+ const t = `${e.targetKey}/${e.clientKey}`;
89
+ e && ((r = o.workspace.activeDocument) == null ? void 0 : r["x-scalar-default-client"]) !== t && k(t) && o.update("x-scalar-default-client", t);
90
+ }), n(
91
+ () => a.value.defaultHttpClient,
92
+ (e) => {
93
+ if (e) {
94
+ const { targetKey: t, clientKey: r } = e, s = `${t}/${r}`;
95
+ k(s) && o.update("x-scalar-default-client", s), x(e);
96
+ }
97
+ },
98
+ { immediate: !0 }
99
+ );
100
+ const { toggleColorMode: N, isDarkMode: R } = G({
77
101
  initialColorMode: a.value.darkMode ? "dark" : void 0,
78
102
  overrideColorMode: a.value.forceDarkModeState
79
103
  });
80
- d(
104
+ n(
81
105
  () => a.value.darkMode,
82
106
  (e) => o.update("x-scalar-dark-mode", !!e)
83
- ), d(
84
- () => N.value,
107
+ ), n(
108
+ () => R.value,
85
109
  (e) => o.update("x-scalar-dark-mode", e),
86
110
  { immediate: !0 }
87
- ), d(
88
- () => s.value,
111
+ ), n(
112
+ () => d.value,
89
113
  (e) => {
90
114
  var t;
91
115
  return o.update(
92
116
  "x-scalar-active-document",
93
- (t = l.value[e]) == null ? void 0 : t.slug
117
+ (t = u.value[e]) == null ? void 0 : t.slug
94
118
  );
95
119
  },
96
120
  { immediate: !0 }
97
- ), d(
98
- () => l.value,
121
+ ), n(
122
+ () => u.value,
99
123
  (e) => {
100
- e.forEach(u);
124
+ e.forEach(m);
101
125
  }
102
- ), a.value.metaData && z(a.value.metaData);
103
- const R = A(() => a.value.favicon);
104
- return G(R), (e, t) => {
105
- var E;
106
- return D(), B(F, null, [
107
- (E = r(a)) != null && E.customCss ? (D(), P(W("style"), { key: 0 }, {
108
- default: n(() => [
109
- Y(O(r(a).customCss), 1)
126
+ ), a.value.metaData && Q(a.value.metaData);
127
+ const _ = H(() => a.value.favicon);
128
+ return X(_), (e, t) => {
129
+ var r;
130
+ return y(), U("div", {
131
+ ref_key: "root",
132
+ ref: c
133
+ }, [
134
+ (r = l(a)) != null && r.customCss ? (y(), W(O("style"), { key: 0 }, {
135
+ default: i(() => [
136
+ j(w(l(a).customCss), 1)
110
137
  ]),
111
138
  _: 1
112
- })) : U("", !0),
113
- S(H, {
114
- configuration: r(a),
115
- isDark: !!r(o).workspace["x-scalar-dark-mode"],
116
- onToggleDarkMode: t[1] || (t[1] = () => r(I)()),
117
- onUpdateContent: t[2] || (t[2] = (m) => e.$emit("updateContent", m))
139
+ })) : Y("", !0),
140
+ D(Z, {
141
+ configuration: l(a),
142
+ isDark: !!l(o).workspace["x-scalar-dark-mode"],
143
+ onToggleDarkMode: t[1] || (t[1] = () => l(N)()),
144
+ onUpdateContent: t[2] || (t[2] = (s) => e.$emit("updateContent", s))
118
145
  }, {
119
- footer: n(() => [
120
- p(e.$slots, "footer")
146
+ footer: i(() => [
147
+ v(e.$slots, "footer")
121
148
  ]),
122
- "content-end": n(() => [
123
- p(e.$slots, "footer")
149
+ "content-end": i(() => [
150
+ v(e.$slots, "footer")
124
151
  ]),
125
- "document-selector": n(() => [
126
- S(r(ee), {
127
- modelValue: r(s),
128
- "onUpdate:modelValue": t[0] || (t[0] = (m) => j(s) ? s.value = m : null),
129
- options: r(l)
152
+ "document-selector": i(() => [
153
+ D(l(re), {
154
+ modelValue: l(d),
155
+ "onUpdate:modelValue": t[0] || (t[0] = (s) => J(d) ? d.value = s : null),
156
+ options: l(u)
130
157
  }, null, 8, ["modelValue", "options"])
131
158
  ]),
132
- "sidebar-start": n(() => [
133
- p(e.$slots, "sidebar-start")
159
+ "sidebar-start": i(() => [
160
+ v(e.$slots, "sidebar-start")
134
161
  ]),
135
162
  _: 3
136
163
  }, 8, ["configuration", "isDark"])
137
- ], 64);
164
+ ], 512);
138
165
  };
139
166
  }
140
167
  });
141
168
  export {
142
- fe as default
169
+ xe as default
143
170
  };
@@ -1,4 +1,3 @@
1
- import { type ScalarComboboxOption } from '@scalar/components';
2
1
  import type { ExampleObject } from '@scalar/workspace-store/schemas/v3.1/strict/example';
3
2
  type __VLS_Props = {
4
3
  examples: Record<string, ExampleObject>;
@@ -8,7 +7,6 @@ type __VLS_PublicProps = {
8
7
  } & __VLS_Props;
9
8
  declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
10
9
  getLabel: (key: string | null) => string;
11
- selectedExample: import("vue").ComputedRef<ScalarComboboxOption>;
12
10
  selectedExampleKey: import("vue").ModelRef<string, string, string, string>;
13
11
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
12
  "update:modelValue": (value: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue"],"names":[],"mappings":"AA2EA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AAKxF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACxC,CAAC;AAuDF,KAAK,iBAAiB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;CAClB,GAAG,WAAW,CAAC;;oBAnCO,MAAM,GAAG,IAAI;;;;;;;;AA4IpC,wBASG"}
1
+ {"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue"],"names":[],"mappings":"AA+EA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AAIxF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACxC,CAAC;AAqCF,KAAK,iBAAiB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;CAClB,GAAG,WAAW,CAAC;;oBAjCO,MAAM,GAAG,IAAI;;;;;;;AAkLpC,wBASG"}
@@ -0,0 +1,4 @@
1
+ import f from "./ExamplePicker.vue2.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,69 @@
1
+ import { defineComponent as h, mergeModels as _, useModel as v, createBlock as p, openBlock as s, unref as t, withCtx as o, createVNode as c, createElementVNode as m, toDisplayString as d, createElementBlock as w, Fragment as g, renderList as C, normalizeClass as S } from "vue";
2
+ import { ScalarDropdown as b, ScalarButton as k, ScalarDropdownItem as E, ScalarIcon as V } from "@scalar/components";
3
+ import { ScalarIconCaretDown as B } from "@scalar/icons";
4
+ const D = { class: "overflow-hidden text-ellipsis" }, j = /* @__PURE__ */ h({
5
+ __name: "ExamplePicker",
6
+ props: /* @__PURE__ */ _({
7
+ examples: {}
8
+ }, {
9
+ modelValue: { required: !0 },
10
+ modelModifiers: {}
11
+ }),
12
+ emits: ["update:modelValue"],
13
+ setup(i, { expose: u }) {
14
+ const f = i, a = v(i, "modelValue"), n = (e) => {
15
+ if (!e)
16
+ return "Select an example";
17
+ const l = f.examples[e];
18
+ return (l == null ? void 0 : l.summary) ?? e;
19
+ }, x = (e) => {
20
+ a.value = e;
21
+ };
22
+ return u({
23
+ getLabel: n,
24
+ selectedExampleKey: a
25
+ }), (e, l) => (s(), p(t(b), { placement: "bottom-start" }, {
26
+ items: o(() => [
27
+ (s(!0), w(g, null, C(e.examples, (I, r) => (s(), p(t(E), {
28
+ key: r,
29
+ onClick: (M) => x(r)
30
+ }, {
31
+ default: o(() => [
32
+ m("div", {
33
+ class: S([
34
+ "flex h-4 w-4 items-center justify-center rounded-full p-[3px]",
35
+ a.value === r ? "bg-c-accent text-b-1" : "shadow-border text-transparent"
36
+ ])
37
+ }, [
38
+ c(t(V), {
39
+ class: "size-2.5",
40
+ icon: "Checkmark",
41
+ thickness: "3"
42
+ })
43
+ ], 2),
44
+ m("span", D, d(n(r)), 1)
45
+ ]),
46
+ _: 2
47
+ }, 1032, ["onClick"]))), 128))
48
+ ]),
49
+ default: o(() => [
50
+ c(t(k), {
51
+ "data-testid": "example-picker",
52
+ class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.5 py-0.75 text-base font-normal",
53
+ fullWidth: "",
54
+ variant: "ghost"
55
+ }, {
56
+ default: o(() => [
57
+ m("span", null, d(n(a.value)), 1),
58
+ c(t(B))
59
+ ]),
60
+ _: 1
61
+ })
62
+ ]),
63
+ _: 1
64
+ }));
65
+ }
66
+ });
67
+ export {
68
+ j as default
69
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/RequestExample.vue"],"names":[],"mappings":"AAqYA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGrF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iDAAiD,CAAA;AAkBxD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC3C;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;;YAoBO,MAAM,OAAO;YACb,MAAM,OAAO;;YADb,MAAM,OAAO;YACb,MAAM,OAAO;;AApBvB,wBAkaC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"RequestExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/RequestExample.vue"],"names":[],"mappings":"AAiZA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGrF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AACtF,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iDAAiD,CAAA;AAoBxD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC3C;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;;YAoBO,MAAM,OAAO;YACb,MAAM,OAAO;;YADb,MAAM,OAAO;YACb,MAAM,OAAO;;AApBvB,wBA0bC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import o from "./RequestExample.vue2.js";
2
+ /* empty css */
3
+ import t from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-03733855"]]);
5
+ export {
6
+ r as default
7
+ };
@@ -0,0 +1,227 @@
1
+ import { defineComponent as O, computed as m, ref as S, watch as j, useId as D, createElementBlock as k, openBlock as u, Fragment as I, createBlock as p, createCommentVNode as v, unref as l, withCtx as n, createVNode as o, createSlots as N, createElementVNode as h, renderSlot as y, toDisplayString as R } from "vue";
2
+ import { ScalarCard as x, ScalarCardHeader as z, ScalarCombobox as F, ScalarButton as H, ScalarCardSection as q, ScalarCodeBlock as K, ScalarCardFooter as M } from "@scalar/components";
3
+ import { freezeElement as W } from "@scalar/helpers/dom/freeze-element";
4
+ import { ScalarIconCaretDown as U } from "@scalar/icons";
5
+ import { isReference as A } from "@scalar/workspace-store/schemas/v3.1/type-guard";
6
+ import { findClient as $ } from "../helpers/find-client.js";
7
+ import { generateClientOptions as G, generateCustomId as J } from "../helpers/generate-client-options.js";
8
+ import { generateCodeSnippet as P } from "../helpers/generate-code-snippet.js";
9
+ import { getSecrets as Q } from "../helpers/get-secrets.js";
10
+ import X from "./ExamplePicker.vue2.js";
11
+ import Y from "../../../../components/LinkList/LinkList.vue.js";
12
+ import Z from "../../../../features/external-docs/ExternalDocs.vue.js";
13
+ import B from "../../../../components/HttpMethod/HttpMethod.vue.js";
14
+ import { emitCustomEvent as V } from "../../../events/definitions.js";
15
+ const _ = ["innerHTML"], ee = { class: "text-base" }, te = ["id"], le = {
16
+ key: 0,
17
+ class: "request-card-footer-addon"
18
+ }, ae = { class: "request-header" }, oe = {}, Se = /* @__PURE__ */ O({
19
+ ...oe,
20
+ __name: "RequestExample",
21
+ props: {
22
+ allowedClients: {},
23
+ selectedClient: {},
24
+ selectedServer: { default: () => ({ url: "/" }) },
25
+ selectedContentType: {},
26
+ selectedExample: {},
27
+ securitySchemes: { default: () => [] },
28
+ method: {},
29
+ path: {},
30
+ operation: {},
31
+ fallback: { type: Boolean },
32
+ generateLabel: { type: Function },
33
+ hideClientSelector: { type: Boolean, default: !1 }
34
+ },
35
+ setup(a) {
36
+ const c = m(() => {
37
+ var d, b;
38
+ if (A(a.operation.requestBody))
39
+ return {};
40
+ const t = ((d = a.operation.requestBody) == null ? void 0 : d.content) ?? {}, e = a.selectedContentType || Object.keys(t)[0];
41
+ return ((b = t[e]) == null ? void 0 : b.examples) ?? {};
42
+ }), C = S(
43
+ a.selectedExample ?? Object.keys(c.value)[0]
44
+ ), g = m(() => [
45
+ "x-custom-examples",
46
+ "x-codeSamples",
47
+ "x-code-samples"
48
+ ].flatMap(
49
+ (e) => a.operation[e] ?? []
50
+ )), f = m(
51
+ () => G(g.value, a.allowedClients)
52
+ ), r = S(
53
+ $(f.value, a.selectedClient)
54
+ );
55
+ j(
56
+ () => a.selectedClient,
57
+ (t) => {
58
+ const e = $(f.value, t);
59
+ e && (r.value = e);
60
+ }
61
+ );
62
+ const E = m(() => {
63
+ var t;
64
+ try {
65
+ if (r.value.id.startsWith("custom"))
66
+ return ((t = g.value.find(
67
+ (d) => J(d) === r.value.id
68
+ )) == null ? void 0 : t.source) ?? "Custom example not found";
69
+ const e = c.value[C.value || ""], s = (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.summary);
70
+ return P({
71
+ clientId: r.value.id,
72
+ operation: a.operation,
73
+ method: a.method,
74
+ server: a.selectedServer,
75
+ securitySchemes: a.securitySchemes,
76
+ contentType: a.selectedContentType,
77
+ path: a.path,
78
+ example: s
79
+ });
80
+ } catch (e) {
81
+ return console.error("[generateSnippet]", e), "";
82
+ }
83
+ }), T = m(() => Q(a.securitySchemes)), i = S(null), L = (t) => {
84
+ var e;
85
+ if (i.value) {
86
+ const s = W(i.value.$el);
87
+ setTimeout(() => {
88
+ s();
89
+ }, 300);
90
+ }
91
+ r.value = t, t.id.startsWith("custom") || V(
92
+ (e = i.value) == null ? void 0 : e.$el,
93
+ "scalar-update-selected-client",
94
+ t.id
95
+ );
96
+ }, w = D();
97
+ return (t, e) => (u(), k(I, null, [
98
+ t.operation.externalDocs ? (u(), p(l(Y), { key: 0 }, {
99
+ default: n(() => [
100
+ o(l(Z), {
101
+ value: t.operation.externalDocs
102
+ }, null, 8, ["value"])
103
+ ]),
104
+ _: 1
105
+ })) : v("", !0),
106
+ f.value.length ? (u(), p(l(x), {
107
+ key: 1,
108
+ class: "request-card dark-mode",
109
+ ref_key: "elem",
110
+ ref: i
111
+ }, {
112
+ default: n(() => [
113
+ o(l(z), { class: "pr-0.5" }, N({
114
+ default: n(() => [
115
+ e[3] || (e[3] = h("span", { class: "sr-only" }, "Request Example for", -1)),
116
+ o(l(B), {
117
+ as: "span",
118
+ class: "request-method",
119
+ method: t.method
120
+ }, null, 8, ["method"]),
121
+ t.generateLabel ? (u(), k("span", {
122
+ key: 0,
123
+ innerHTML: t.generateLabel()
124
+ }, null, 8, _)) : y(t.$slots, "header", { key: 1 }, void 0, !0)
125
+ ]),
126
+ _: 2
127
+ }, [
128
+ t.hideClientSelector ? void 0 : {
129
+ name: "actions",
130
+ fn: n(() => [
131
+ o(l(F), {
132
+ class: "max-h-80",
133
+ modelValue: r.value,
134
+ options: f.value,
135
+ teleport: "",
136
+ placement: "bottom-end",
137
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => L(s))
138
+ }, {
139
+ default: n(() => [
140
+ o(l(H), {
141
+ "data-testid": "client-picker",
142
+ class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-2 px-1",
143
+ fullWidth: "",
144
+ variant: "ghost"
145
+ }, {
146
+ default: n(() => [
147
+ h("span", ee, R(r.value.title), 1),
148
+ o(l(U), { class: "size-3.5" })
149
+ ]),
150
+ _: 1
151
+ })
152
+ ]),
153
+ _: 1
154
+ }, 8, ["modelValue", "options"])
155
+ ]),
156
+ key: "0"
157
+ }
158
+ ]), 1024),
159
+ o(l(q), { class: "request-editor-section custom-scroll p-0" }, {
160
+ default: n(() => [
161
+ h("div", {
162
+ id: `${l(w)}-example`,
163
+ class: "code-snippet"
164
+ }, [
165
+ o(l(K), {
166
+ class: "bg-b-2 !min-h-full -outline-offset-2",
167
+ content: E.value,
168
+ hideCredentials: T.value,
169
+ lang: r.value.lang,
170
+ lineNumbers: ""
171
+ }, null, 8, ["content", "hideCredentials", "lang"])
172
+ ], 8, te)
173
+ ]),
174
+ _: 1
175
+ }),
176
+ Object.keys(c.value).length || t.$slots.footer ? (u(), p(l(M), {
177
+ key: 0,
178
+ class: "request-card-footer bg-b-3"
179
+ }, {
180
+ default: n(() => [
181
+ Object.keys(c.value).length ? (u(), k("div", le, [
182
+ o(X, {
183
+ examples: c.value,
184
+ modelValue: C.value,
185
+ "onUpdate:modelValue": [
186
+ e[1] || (e[1] = (s) => C.value = s),
187
+ e[2] || (e[2] = (s) => {
188
+ var d;
189
+ return l(V)((d = i.value) == null ? void 0 : d.$el, "scalar-update-selected-example", s);
190
+ })
191
+ ]
192
+ }, null, 8, ["examples", "modelValue"])
193
+ ])) : v("", !0),
194
+ y(t.$slots, "footer", {}, void 0, !0)
195
+ ]),
196
+ _: 3
197
+ })) : v("", !0)
198
+ ]),
199
+ _: 3
200
+ }, 512)) : t.fallback ? (u(), p(l(x), {
201
+ key: 2,
202
+ class: "request-card dark-mode"
203
+ }, {
204
+ default: n(() => [
205
+ o(l(q), { class: "request-card-simple" }, {
206
+ default: n(() => [
207
+ h("div", ae, [
208
+ o(l(B), {
209
+ as: "span",
210
+ class: "request-method",
211
+ method: t.method
212
+ }, null, 8, ["method"]),
213
+ y(t.$slots, "header", {}, void 0, !0)
214
+ ]),
215
+ y(t.$slots, "footer", {}, void 0, !0)
216
+ ]),
217
+ _: 3
218
+ })
219
+ ]),
220
+ _: 3
221
+ })) : v("", !0)
222
+ ], 64));
223
+ }
224
+ });
225
+ export {
226
+ Se as default
227
+ };
@@ -1,5 +1,22 @@
1
- import { AVAILABLE_CLIENTS as o } from "@scalar/snippetz";
2
- const e = (i) => o.includes(i);
1
+ import { AVAILABLE_CLIENTS as c } from "@scalar/snippetz";
2
+ const d = "shell/curl", u = (o) => c.includes(o), e = (o, r) => {
3
+ var f;
4
+ const n = (f = o[0]) == null ? void 0 : f.options[0];
5
+ if (r)
6
+ for (const i of o) {
7
+ const t = i.options.find((s) => s.id === r);
8
+ if (t)
9
+ return t;
10
+ }
11
+ if (!(n != null && n.id.startsWith("custom")))
12
+ for (const i of o) {
13
+ const t = i.options.find((s) => s.id === d);
14
+ if (t)
15
+ return t;
16
+ }
17
+ return n;
18
+ };
3
19
  export {
4
- e as isClient
20
+ e as findClient,
21
+ u as isClient
5
22
  };