@scalar/api-reference 1.36.2 → 1.37.0

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 (226) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/browser/standalone.js +26143 -25935
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReferenceContent.vue.d.ts +34 -0
  5. package/dist/components/ApiReferenceContent.vue.d.ts.map +1 -0
  6. package/dist/components/ApiReferenceContent.vue.js +8 -0
  7. package/dist/components/ApiReferenceContent.vue2.js +148 -0
  8. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  9. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  10. package/dist/components/ApiReferenceLayout.vue2.js +239 -219
  11. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts +2 -2
  12. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
  13. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts +1 -1
  14. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts.map +1 -1
  15. package/dist/components/Content/ClientLibraries/featured-clients.d.ts +1 -1
  16. package/dist/components/Content/ClientLibraries/featured-clients.d.ts.map +1 -1
  17. package/dist/components/Content/Content.vue.d.ts +21 -3
  18. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  19. package/dist/components/Content/Content.vue.js +132 -95
  20. package/dist/components/Content/Models/ClassicLayout.vue.d.ts +4 -2
  21. package/dist/components/Content/Models/ClassicLayout.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Models/ClassicLayout.vue.js +2 -2
  23. package/dist/components/Content/Models/ClassicLayout.vue2.js +28 -28
  24. package/dist/components/Content/Models/Models.vue.d.ts +10 -2
  25. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  26. package/dist/components/Content/Models/Models.vue.js +25 -27
  27. package/dist/components/Content/Models/ModernLayout.vue.d.ts +6 -2
  28. package/dist/components/Content/Models/ModernLayout.vue.d.ts.map +1 -1
  29. package/dist/components/Content/Models/ModernLayout.vue.js +1 -1
  30. package/dist/components/Content/Models/ModernLayout.vue2.js +30 -29
  31. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +20 -6
  32. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  33. package/dist/components/Content/Operations/TraversedEntry.vue.js +58 -46
  34. package/dist/components/Content/Operations/get-current-index.d.ts +1 -1
  35. package/dist/components/Content/Operations/get-current-index.d.ts.map +1 -1
  36. package/dist/components/Content/Schema/helpers/get-ref-name.d.ts.map +1 -1
  37. package/dist/components/Content/Schema/helpers/get-ref-name.js +9 -7
  38. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +1 -1
  39. package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
  40. package/dist/components/Content/Schema/helpers/schema-name.js +15 -14
  41. package/dist/components/Content/Tags/ClassicLayout.vue.d.ts +1 -1
  42. package/dist/components/Content/Tags/ClassicLayout.vue.d.ts.map +1 -1
  43. package/dist/components/Content/Tags/ClassicLayout.vue.js +2 -2
  44. package/dist/components/Content/Tags/ModernLayout.vue.d.ts +3 -1
  45. package/dist/components/Content/Tags/ModernLayout.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Tags/ModernLayout.vue.js +1 -1
  47. package/dist/components/Content/Tags/ModernLayout.vue2.js +34 -30
  48. package/dist/components/Content/Tags/Tag.vue.d.ts +3 -1
  49. package/dist/components/Content/Tags/Tag.vue.d.ts.map +1 -1
  50. package/dist/components/Content/Tags/Tag.vue.js +14 -12
  51. package/dist/components/Content/Tags/TagSection.vue.d.ts +2 -1
  52. package/dist/components/Content/Tags/TagSection.vue.d.ts.map +1 -1
  53. package/dist/components/Content/Tags/TagSection.vue.js +49 -52
  54. package/dist/components/OperationsList/OperationsList.vue.d.ts +1 -1
  55. package/dist/components/OperationsList/OperationsList.vue.d.ts.map +1 -1
  56. package/dist/components/OperationsList/OperationsList.vue.js +2 -2
  57. package/dist/components/OperationsList/OperationsListItem.vue.d.ts +1 -1
  58. package/dist/components/OperationsList/OperationsListItem.vue.d.ts.map +1 -1
  59. package/dist/components/OperationsList/OperationsListItem.vue.js +2 -2
  60. package/dist/components/ShowMoreButton.vue.d.ts +1 -0
  61. package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
  62. package/dist/components/ShowMoreButton.vue.js +2 -2
  63. package/dist/components/ShowMoreButton.vue2.js +12 -12
  64. package/dist/features/Operation/Operation.vue.d.ts +21 -9
  65. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  66. package/dist/features/Operation/Operation.vue.js +42 -53
  67. package/dist/features/Operation/components/Header.vue.d.ts +2 -2
  68. package/dist/features/Operation/components/Header.vue.d.ts.map +1 -1
  69. package/dist/features/Operation/components/Header.vue.js +9 -8
  70. package/dist/features/Operation/components/Headers.vue.d.ts +2 -2
  71. package/dist/features/Operation/components/Headers.vue.d.ts.map +1 -1
  72. package/dist/features/Operation/components/Headers.vue.js +2 -2
  73. package/dist/features/Operation/components/Headers.vue2.js +31 -29
  74. package/dist/features/Operation/components/OperationParameters.vue.d.ts +4 -0
  75. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  76. package/dist/features/Operation/components/OperationParameters.vue.js +37 -31
  77. package/dist/features/Operation/components/OperationResponses.vue.d.ts +5 -1
  78. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  79. package/dist/features/Operation/components/OperationResponses.vue.js +16 -17
  80. package/dist/features/Operation/components/ParameterList.vue.d.ts +6 -2
  81. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  82. package/dist/features/Operation/components/ParameterList.vue.js +17 -19
  83. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +6 -2
  84. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  85. package/dist/features/Operation/components/ParameterListItem.vue.js +3 -3
  86. package/dist/features/Operation/components/ParameterListItem.vue2.js +64 -65
  87. package/dist/features/Operation/components/RequestBody.vue.d.ts +4 -0
  88. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  89. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  90. package/dist/features/Operation/components/RequestBody.vue2.js +65 -65
  91. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +4 -0
  92. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  93. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  94. package/dist/features/Operation/components/callbacks/Callback.vue2.js +29 -22
  95. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +6 -0
  96. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  97. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +18 -16
  98. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +11 -5
  99. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  100. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  101. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +99 -90
  102. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +12 -5
  103. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  104. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  105. package/dist/features/Operation/layouts/ModernLayout.vue2.js +99 -87
  106. package/dist/features/Search/helpers/create-search-index.d.ts +2 -1
  107. package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
  108. package/dist/features/Search/types.d.ts +1 -1
  109. package/dist/features/Search/types.d.ts.map +1 -1
  110. package/dist/features/api-client-modal/ApiClientModal.vue.d.ts.map +1 -1
  111. package/dist/features/api-client-modal/ApiClientModal.vue.js +23 -26
  112. package/dist/features/api-client-modal/useApiClient.d.ts +3032 -2888
  113. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  114. package/dist/features/document-source/hooks/useDocumentFetcher.d.ts.map +1 -1
  115. package/dist/features/document-source/hooks/useDocumentFetcher.js +13 -11
  116. package/dist/features/document-source/hooks/useDocumentSource.d.ts +1 -1
  117. package/dist/features/document-source/hooks/useDocumentSource.d.ts.map +1 -1
  118. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  119. package/dist/features/example-responses/ExampleResponse.vue.js +3 -3
  120. package/dist/features/example-responses/ExampleResponse.vue2.js +26 -18
  121. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  122. package/dist/features/example-responses/ExampleResponses.vue.js +2 -2
  123. package/dist/features/example-responses/ExampleResponses.vue2.js +53 -53
  124. package/dist/features/multiple-documents/useMultipleDocuments.d.ts +8 -5
  125. package/dist/features/multiple-documents/useMultipleDocuments.d.ts.map +1 -1
  126. package/dist/features/multiple-documents/useMultipleDocuments.js +46 -43
  127. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  128. package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
  129. package/dist/features/test-request-button/TestRequestButton.vue2.js +15 -21
  130. package/dist/features/toolbar/ApiReferenceToolbar.vue.js +18 -18
  131. package/dist/features/toolbar/ApiReferenceToolbarConfig.vue.js +1 -1
  132. package/dist/features/toolbar/ApiReferenceToolbarConfigTheme.vue.d.ts +2 -2
  133. package/dist/features/toolbar/ApiReferenceToolbarPopover.vue.js +1 -1
  134. package/dist/features/toolbar/ApiReferenceToolbarSdks.vue.js +1 -1
  135. package/dist/features/toolbar/ApiReferenceToolbarShare.vue.js +8 -8
  136. package/dist/features/toolbar/ApiReferenceToolbarShareRegister.vue.d.ts.map +1 -1
  137. package/dist/features/toolbar/ApiReferenceToolbarShareRegister.vue.js +34 -28
  138. package/dist/features/toolbar/ApiReferenceToolbarTitle.vue.js +27 -27
  139. package/dist/helpers/test-utils.d.ts +3 -365
  140. package/dist/helpers/test-utils.d.ts.map +1 -1
  141. package/dist/hooks/useNavState.d.ts +4 -2
  142. package/dist/hooks/useNavState.d.ts.map +1 -1
  143. package/dist/hooks/useNavState.js +31 -27
  144. package/dist/index.d.ts +1 -0
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +21 -19
  147. package/dist/style.css +1 -1
  148. package/dist/types.d.ts.map +1 -1
  149. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  150. package/dist/v2/ApiReferenceWorkspace.vue.js +46 -40
  151. package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +1 -1
  152. package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts.map +1 -1
  153. package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +2 -2
  154. package/dist/v2/blocks/scalar-client-selector-block/components/ClientDropdown.vue2.js +11 -11
  155. package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts +2 -2
  156. package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts.map +1 -1
  157. package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +2 -2
  158. package/dist/v2/blocks/scalar-client-selector-block/components/ClientSelector.vue2.js +10 -10
  159. package/dist/v2/blocks/scalar-client-selector-block/helpers/featured-clients.d.ts +1 -1
  160. package/dist/v2/blocks/scalar-client-selector-block/helpers/featured-clients.d.ts.map +1 -1
  161. package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.d.ts +3 -0
  162. package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.d.ts.map +1 -1
  163. package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.js +2 -2
  164. package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue2.js +32 -31
  165. package/dist/v2/blocks/scalar-info-block/components/InfoBlock.vue.d.ts +15 -8
  166. package/dist/v2/blocks/scalar-info-block/components/InfoBlock.vue.d.ts.map +1 -1
  167. package/dist/v2/blocks/scalar-info-block/components/InfoBlock.vue.js +25 -20
  168. package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue.d.ts +8 -7
  169. package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue.d.ts.map +1 -1
  170. package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue.js +2 -2
  171. package/dist/v2/blocks/scalar-info-block/components/IntroductionLayout.vue2.js +27 -32
  172. package/dist/v2/blocks/scalar-server-selector-block/components/Selector.vue.d.ts +2 -22
  173. package/dist/v2/blocks/scalar-server-selector-block/components/Selector.vue.d.ts.map +1 -1
  174. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.d.ts +8 -0
  175. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.d.ts.map +1 -1
  176. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue.js +2 -2
  177. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarBlock.vue2.js +70 -65
  178. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue.d.ts +9 -1
  179. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue.d.ts.map +1 -1
  180. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue.js +2 -2
  181. package/dist/v2/blocks/scalar-sidebar-block/components/SidebarElement.vue2.js +60 -57
  182. package/dist/v2/blocks/scalar-sidebar-block/helpers/create-sidebar.d.ts +3 -365
  183. package/dist/v2/blocks/scalar-sidebar-block/helpers/create-sidebar.d.ts.map +1 -1
  184. package/dist/v2/blocks/scalar-sidebar-block/helpers/generate-reverse-index.d.ts +3 -183
  185. package/dist/v2/blocks/scalar-sidebar-block/helpers/generate-reverse-index.d.ts.map +1 -1
  186. package/dist/v2/helpers/map-configuration.d.ts +22 -22
  187. package/dist/v2/helpers/map-configuration.d.ts.map +1 -1
  188. package/package.json +19 -16
  189. package/dist/components/Content/Operations/TraversedEntryContainer.vue.d.ts +0 -13
  190. package/dist/components/Content/Operations/TraversedEntryContainer.vue.d.ts.map +0 -1
  191. package/dist/components/Content/Operations/TraversedEntryContainer.vue.js +0 -52
  192. package/dist/components/Content/Operations/TraversedEntryContainer.vue2.js +0 -4
  193. package/dist/components/Content/Operations/index.d.ts +0 -2
  194. package/dist/components/Content/Operations/index.d.ts.map +0 -1
  195. package/dist/hooks/useConfig.d.ts +0 -9
  196. package/dist/hooks/useConfig.d.ts.map +0 -1
  197. package/dist/hooks/useConfig.js +0 -10
  198. package/dist/legacy/stores/index.d.ts +0 -2
  199. package/dist/legacy/stores/index.d.ts.map +0 -1
  200. package/dist/legacy/stores/useExampleStore.d.ts +0 -5
  201. package/dist/legacy/stores/useExampleStore.d.ts.map +0 -1
  202. package/dist/legacy/stores/useExampleStore.js +0 -8
  203. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.d.ts +0 -14
  204. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.d.ts.map +0 -1
  205. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +0 -4
  206. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +0 -55
  207. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts +0 -79
  208. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +0 -1
  209. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +0 -7
  210. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +0 -236
  211. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.d.ts +0 -41
  212. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.d.ts.map +0 -1
  213. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +0 -22
  214. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.d.ts +0 -20
  215. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.d.ts.map +0 -1
  216. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +0 -33
  217. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts +0 -17
  218. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts.map +0 -1
  219. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +0 -26
  220. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.d.ts +0 -4
  221. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.d.ts.map +0 -1
  222. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +0 -10
  223. package/dist/v2/blocks/scalar-request-example-block/index.d.ts +0 -3
  224. package/dist/v2/blocks/scalar-request-example-block/index.d.ts.map +0 -1
  225. package/dist/v2/blocks/scalar-request-example-block/types.d.ts +0 -29
  226. package/dist/v2/blocks/scalar-request-example-block/types.d.ts.map +0 -1
@@ -1,236 +0,0 @@
1
- import { defineComponent as D, computed as u, ref as k, watch as H, useId as I, createBlock as h, createCommentVNode as m, openBlock as i, unref as o, withCtx as n, createVNode as s, createSlots as N, createElementVNode as y, createElementBlock as S, renderSlot as C, toDisplayString as z } from "vue";
2
- import { ScalarCard as E, ScalarCardHeader as K, ScalarCombobox as M, ScalarButton as F, ScalarCardSection as q, ScalarCodeBlock as U, ScalarCardFooter as A } from "@scalar/components";
3
- import { freezeElement as G } from "@scalar/helpers/dom/freeze-element";
4
- import { ScalarIconCaretDown as J } from "@scalar/icons";
5
- import { operationToHar as P } from "@scalar/oas-utils/helpers/operation-to-har";
6
- import { emitCustomEvent as T } from "@scalar/workspace-store/events";
7
- import { getResolvedRef as Q } from "@scalar/workspace-store/helpers/get-resolved-ref";
8
- import { getResolvedRefDeep as $ } from "../../../../features/example-responses/helpers/get-resolved-ref-deep.js";
9
- import { findClient as j } from "../helpers/find-client.js";
10
- import { generateCustomId as B } from "../helpers/generate-client-options.js";
11
- import { generateCodeSnippet as X } from "../helpers/generate-code-snippet.js";
12
- import { getSecrets as Y } from "../helpers/get-secrets.js";
13
- import Z from "./ExamplePicker.vue2.js";
14
- import V from "../../../../components/HttpMethod/HttpMethod.vue.js";
15
- const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], le = {
16
- key: 0,
17
- class: "request-card-footer-addon"
18
- }, oe = { class: "request-header" }, ae = {}, be = /* @__PURE__ */ D({
19
- ...ae,
20
- __name: "RequestExample",
21
- props: {
22
- clientOptions: {},
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
- isWebhook: { type: Boolean }
34
- },
35
- setup(l) {
36
- const c = u(() => {
37
- const e = Q(l.operation.requestBody)?.content ?? {}, t = l.selectedContentType || Object.keys(e)[0];
38
- return e[t]?.examples ?? {};
39
- }), f = k(
40
- l.selectedExample ?? Object.keys(c.value)[0]
41
- ), b = u(() => [
42
- "x-custom-examples",
43
- "x-codeSamples",
44
- "x-code-samples"
45
- ].flatMap((t) => l.operation[t] ?? [])), p = u(() => b.value.length ? [
46
- {
47
- label: "Code Examples",
48
- options: b.value.map((t) => {
49
- const a = B(t), v = t.label || t.lang || a;
50
- return {
51
- id: a,
52
- lang: t.lang || "plaintext",
53
- title: v,
54
- label: v
55
- };
56
- })
57
- },
58
- ...l.clientOptions
59
- ] : l.clientOptions), r = k(
60
- j(p.value, l.selectedClient) ?? null
61
- );
62
- H(
63
- () => l.selectedClient,
64
- (e) => {
65
- const t = j(p.value, e);
66
- t && (r.value = t);
67
- }
68
- );
69
- const g = u(() => {
70
- if (!l.isWebhook) return null;
71
- try {
72
- const e = c.value[f.value || ""], t = $(e), a = t?.value ?? t?.summary;
73
- return P({ operation: l.operation, method: l.method, path: l.path, example: a });
74
- } catch (e) {
75
- return console.error("[webhookHar]", e), null;
76
- }
77
- }), x = u(() => {
78
- try {
79
- if (r.value?.id.startsWith("custom"))
80
- return b.value.find(
81
- (v) => B(v) === r.value?.id
82
- )?.source ?? "Custom example not found";
83
- const e = c.value[f.value || ""], t = $(e), a = t?.value ?? t?.summary;
84
- return l.isWebhook ? g.value?.postData?.text ?? "" : X({
85
- clientId: r.value?.id,
86
- operation: l.operation,
87
- method: l.method,
88
- server: l.selectedServer,
89
- securitySchemes: l.securitySchemes,
90
- contentType: l.selectedContentType,
91
- path: l.path,
92
- example: a
93
- });
94
- } catch (e) {
95
- return console.error("[generateSnippet]", e), "";
96
- }
97
- }), w = u(() => l.isWebhook ? O.value : r.value?.lang), O = u(() => {
98
- if (!g.value?.postData) return "json";
99
- const e = g.value.postData.mimeType;
100
- return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
101
- }), W = u(() => Y(l.securitySchemes)), d = k(null), L = (e) => {
102
- if (d.value) {
103
- const t = G(d.value.$el);
104
- setTimeout(() => {
105
- t();
106
- }, 300);
107
- }
108
- r.value = e, e.id.startsWith("custom") || T(d.value?.$el, "scalar-update-selected-client", e.id);
109
- }, R = I();
110
- return (e, t) => x.value ? (i(), h(o(E), {
111
- key: 0,
112
- ref_key: "elem",
113
- ref: d,
114
- class: "request-card dark-mode"
115
- }, {
116
- default: n(() => [
117
- s(o(K), { class: "pr-2.5" }, N({
118
- default: n(() => [
119
- t[3] || (t[3] = y("span", { class: "sr-only" }, "Request Example for", -1)),
120
- s(o(V), {
121
- as: "span",
122
- class: "request-method",
123
- method: e.method
124
- }, null, 8, ["method"]),
125
- e.generateLabel ? (i(), S("span", {
126
- key: 0,
127
- innerHTML: e.generateLabel()
128
- }, null, 8, _)) : m("", !0),
129
- C(e.$slots, "header", {}, void 0, !0)
130
- ]),
131
- _: 2
132
- }, [
133
- !e.isWebhook && p.value.length ? {
134
- name: "actions",
135
- fn: n(() => [
136
- s(o(M), {
137
- class: "max-h-80",
138
- modelValue: r.value,
139
- options: p.value,
140
- placement: "bottom-end",
141
- teleport: "",
142
- "onUpdate:modelValue": t[0] || (t[0] = (a) => L(a))
143
- }, {
144
- default: n(() => [
145
- s(o(F), {
146
- class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5",
147
- "data-testid": "client-picker",
148
- fullWidth: "",
149
- variant: "ghost"
150
- }, {
151
- default: n(() => [
152
- y("span", ee, z(r.value.title), 1),
153
- s(o(J), {
154
- class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
155
- weight: "bold"
156
- })
157
- ]),
158
- _: 1
159
- })
160
- ]),
161
- _: 1
162
- }, 8, ["modelValue", "options"])
163
- ]),
164
- key: "0"
165
- } : void 0
166
- ]), 1024),
167
- s(o(q), { class: "request-editor-section custom-scroll p-0" }, {
168
- default: n(() => [
169
- y("div", {
170
- id: `${o(R)}-example`,
171
- class: "code-snippet"
172
- }, [
173
- s(o(U), {
174
- class: "bg-b-2 !min-h-full -outline-offset-2",
175
- content: x.value,
176
- hideCredentials: W.value,
177
- lang: w.value,
178
- lineNumbers: ""
179
- }, null, 8, ["content", "hideCredentials", "lang"])
180
- ], 8, te)
181
- ]),
182
- _: 1
183
- }),
184
- Object.keys(c.value).length > 1 || e.$slots.footer ? (i(), h(o(A), {
185
- key: 0,
186
- class: "request-card-footer bg-b-3"
187
- }, {
188
- default: n(() => [
189
- Object.keys(c.value).length > 1 ? (i(), S("div", le, [
190
- Object.keys(c.value).length ? (i(), h(Z, {
191
- key: 0,
192
- modelValue: f.value,
193
- "onUpdate:modelValue": [
194
- t[1] || (t[1] = (a) => f.value = a),
195
- t[2] || (t[2] = (a) => o(T)(
196
- d.value?.$el,
197
- "scalar-update-selected-example",
198
- a
199
- ))
200
- ],
201
- examples: c.value
202
- }, null, 8, ["modelValue", "examples"])) : m("", !0)
203
- ])) : m("", !0),
204
- C(e.$slots, "footer", {}, void 0, !0)
205
- ]),
206
- _: 3
207
- })) : m("", !0)
208
- ]),
209
- _: 3
210
- }, 512)) : e.fallback ? (i(), h(o(E), {
211
- key: 1,
212
- class: "request-card dark-mode"
213
- }, {
214
- default: n(() => [
215
- s(o(q), { class: "request-card-simple" }, {
216
- default: n(() => [
217
- y("div", oe, [
218
- s(o(V), {
219
- as: "span",
220
- class: "request-method",
221
- method: e.method
222
- }, null, 8, ["method"]),
223
- C(e.$slots, "header", {}, void 0, !0)
224
- ]),
225
- C(e.$slots, "footer", {}, void 0, !0)
226
- ]),
227
- _: 3
228
- })
229
- ]),
230
- _: 3
231
- })) : m("", !0);
232
- }
233
- });
234
- export {
235
- be as default
236
- };
@@ -1,41 +0,0 @@
1
- import type { ClientOption, ClientOptionGroup } from '../../../../v2/blocks/scalar-request-example-block/types';
2
- import { type AvailableClients } from '@scalar/snippetz';
3
- export declare const DEFAULT_CLIENT = "shell/curl";
4
- /** Type guard to check if a string is a valid client id */
5
- export declare const isClient: (id: any) => id is AvailableClients[number];
6
- /**
7
- * Finds and returns the appropriate client option from a list of client option groups.
8
- *
9
- * This function is used to determine which client should be initially selected in the
10
- * request example block. It prioritizes a specific client ID if provided, otherwise
11
- * falls back to the first available option.
12
- *
13
- * @param options - Array of client option groups, each containing a label and array of client options
14
- * @param id - Optional client identifier to search for (e.g., 'js/fetch', 'python/requests')
15
-
16
- * @returns The selected client option. If a specific ID is provided and found, returns that client.
17
- * If the ID is not found or not provided, returns the first available client option.
18
- *
19
- * @example
20
- * ```typescript
21
- * const clientGroups = [
22
- * {
23
- * label: 'JavaScript',
24
- * options: [
25
- * { id: 'js/fetch', label: 'Fetch API', lang: 'js' },
26
- * { id: 'js/axios', label: 'Axios', lang: 'js' }
27
- * ]
28
- * }
29
- * ]
30
- *
31
- * // Find specific client
32
- * const client = findClient(clientGroups, 'js/fetch')
33
- * // Returns: { id: 'js/fetch', label: 'Fetch API', lang: 'js' }
34
- *
35
- * // Find first available client
36
- * const firstClient = findClient(clientGroups)
37
- * // Returns: { id: 'js/fetch', label: 'Fetch API', lang: 'js' }
38
- * ```
39
- */
40
- export declare const findClient: (clientGroups: ClientOptionGroup[], clientId?: AvailableClients[number] | undefined) => ClientOption;
41
- //# sourceMappingURL=find-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-client.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/find-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAA;AACrG,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,KAAG,EAAE,IAAI,gBAAgB,CAAC,MAAM,CAAmC,CAAA;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,iBAAiB,EAAE,EACjC,WAAW,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,KAC9C,YAwBF,CAAA"}
@@ -1,22 +0,0 @@
1
- import { AVAILABLE_CLIENTS as f } from "@scalar/snippetz";
2
- const c = "shell/curl", d = (o) => f.includes(o), u = (o, s) => {
3
- const r = o[0]?.options[0];
4
- if (s)
5
- for (const i of o) {
6
- const t = i.options.find((n) => n.id === s);
7
- if (t)
8
- return t;
9
- }
10
- if (!r?.id.startsWith("custom"))
11
- for (const i of o) {
12
- const t = i.options.find((n) => n.id === c);
13
- if (t)
14
- return t;
15
- }
16
- return r;
17
- };
18
- export {
19
- c as DEFAULT_CLIENT,
20
- u as findClient,
21
- d as isClient
22
- };
@@ -1,20 +0,0 @@
1
- import type { ClientOptionGroup } from '../../../../v2/blocks/scalar-request-example-block/types';
2
- import type { XCodeSample } from '@scalar/openapi-types/schemas/extensions';
3
- import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
4
- /** Helper to generate an ID for custom code samples */
5
- export declare const generateCustomId: (example: XCodeSample) => string;
6
- /**
7
- * Generates client options for the request example block by filtering and organizing
8
- * built-in snippets based on the hiddenClients configuration. This function creates
9
- * a structured list of available client options that can be used to generate code
10
- * examples for different programming languages and frameworks.
11
- *
12
- * The function filters built-in clients based on the hiddenClients parameter and
13
- * groups them by their category (e.g., JavaScript, Python, etc.). The hiddenClients
14
- * parameter supports multiple formats:
15
- * - boolean: true to hide all clients
16
- * - array: ['fetch', 'axios'] to hide specific clients across all categories
17
- * - object: { node: true, python: ['requests'] } to hide entire categories or specific clients within categories
18
- */
19
- export declare const generateClientOptions: (hiddenClients: ApiReferenceConfiguration["hiddenClients"]) => ClientOptionGroup[];
20
- //# sourceMappingURL=generate-client-options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-client-options.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/generate-client-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAA;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAA;AAE3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAG5E,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,WAA6B,CAAA;AAElF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,eAAe,yBAAyB,CAAC,eAAe,CAAC,KACxD,iBAAiB,EAwDnB,CAAA"}
@@ -1,33 +0,0 @@
1
- import { snippetz as l } from "@scalar/snippetz";
2
- import { capitalize as o } from "vue";
3
- const y = (t) => `custom/${t.lang}`, m = (t) => t === !0 ? [] : l().clients().flatMap((e) => {
4
- const n = e.clients.flatMap((r) => {
5
- const c = `${e.key}/${r.client}`;
6
- if (Array.isArray(t) && t.includes(r.client))
7
- return [];
8
- if (typeof t == "object" && t !== null) {
9
- const i = t[e.key];
10
- if (i === !0)
11
- return [];
12
- if (Array.isArray(i) && i.includes(r.client))
13
- return [];
14
- }
15
- return {
16
- id: c,
17
- lang: r.client === "curl" ? "curl" : e.key,
18
- title: `${o(e.title)} ${r.title}`,
19
- label: r.title,
20
- targetKey: e.key,
21
- targetTitle: e.title,
22
- clientKey: r.client
23
- };
24
- });
25
- return n.length === 0 ? [] : {
26
- label: e.title,
27
- options: n
28
- };
29
- });
30
- export {
31
- m as generateClientOptions,
32
- y as generateCustomId
33
- };
@@ -1,17 +0,0 @@
1
- import type { AvailableClients } from '@scalar/snippetz';
2
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
3
- import type { ServerObject, OperationObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
4
- type Props = {
5
- clientId: AvailableClients[number];
6
- operation: OperationObject;
7
- example: unknown;
8
- method: HttpMethod;
9
- path: string;
10
- contentType?: string | undefined;
11
- server?: ServerObject | undefined;
12
- securitySchemes?: SecuritySchemeObject[] | undefined;
13
- };
14
- /** Generate the code snippet for the selected example OR operation */
15
- export declare const generateCodeSnippet: ({ clientId, operation, method, path, example, contentType, server, securitySchemes, }: Props) => string;
16
- export {};
17
- //# sourceMappingURL=generate-code-snippet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAA;AAG5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAErE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAClC,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACjC,eAAe,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAA;CACrD,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,GAAI,uFASjC,KAAK,KAAG,MAmBV,CAAA"}
@@ -1,26 +0,0 @@
1
- import { operationToHar as f } from "@scalar/oas-utils/helpers/operation-to-har";
2
- import { getSnippet as l } from "@scalar/api-client/views/Components/CodeSnippet";
3
- const K = ({
4
- clientId: r,
5
- operation: t,
6
- method: o,
7
- path: n,
8
- example: p,
9
- contentType: i,
10
- server: a,
11
- securitySchemes: s
12
- }) => {
13
- const c = f({
14
- operation: t,
15
- contentType: i,
16
- method: o,
17
- path: n,
18
- server: a,
19
- securitySchemes: s,
20
- example: p
21
- }), [g, m] = r.split("/"), [e, d] = l(g, m, c);
22
- return e ? e.message ?? "Error generating code snippet" : d;
23
- };
24
- export {
25
- K as generateCodeSnippet
26
- };
@@ -1,4 +0,0 @@
1
- import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
- /** Extract secrets from security schemes */
3
- export declare const getSecrets: (securitySchemes: SecuritySchemeObject[]) => string[];
4
- //# sourceMappingURL=get-secrets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-secrets.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/get-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAA;AAGxG,4CAA4C;AAC5C,eAAO,MAAM,UAAU,GAAI,iBAAiB,oBAAoB,EAAE,KAAG,MAAM,EAqBvD,CAAA"}
@@ -1,10 +0,0 @@
1
- import { encode as e } from "js-base64";
2
- const l = (t) => t.flatMap((r) => r.type === "apiKey" ? r["x-scalar-secret-token"] : r?.type === "http" ? [
3
- r["x-scalar-secret-token"],
4
- r["x-scalar-secret-username"],
5
- r["x-scalar-secret-password"],
6
- e(`${r["x-scalar-secret-username"]}:${r["x-scalar-secret-password"]}`)
7
- ] : r.type === "oauth2" ? Object.values(r.flows).map((a) => a["x-scalar-secret-token"]) : []).filter(Boolean);
8
- export {
9
- l as getSecrets
10
- };
@@ -1,3 +0,0 @@
1
- export { default as RequestExample } from './components/RequestExample.vue.js';
2
- export { default as ExamplePicker } from './components/ExamplePicker.vue.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/scalar-request-example-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAA"}
@@ -1,29 +0,0 @@
1
- import type { ScalarComboboxOption, ScalarComboboxOptionGroup } from '@scalar/components';
2
- import type { AvailableClients, ClientId, TargetId } from '@scalar/snippetz';
3
- /**
4
- * Represents a client option in the request example block.
5
- * Extends the base combobox option with language-specific information
6
- * for generating code examples in different programming languages.
7
- */
8
- export type ClientOption = ScalarComboboxOption & {
9
- /** A more specific ID */
10
- id: AvailableClients[number];
11
- /** Programming language or tool for code generation (e.g., 'javascript', 'python', 'curl') */
12
- lang: TargetId | 'curl' | 'plaintext';
13
- /** Title shows when the client is selected in the dropdown */
14
- title: string;
15
- /** Target key for the client, differs from the lang due to the curl thing */
16
- targetKey: TargetId;
17
- /** Title of the target */
18
- targetTitle: string;
19
- /** Client key for the client */
20
- clientKey: ClientId<TargetId>;
21
- };
22
- /**
23
- * Augments the base combobox option group with ClientOptions
24
- */
25
- export type ClientOptionGroup = Omit<ScalarComboboxOptionGroup, 'options'> & {
26
- /** Array of client options that belong to this group */
27
- options: ClientOption[];
28
- };
29
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/scalar-request-example-block/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE5E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,oBAAoB,GAAG;IAChD,yBAAyB;IACzB,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC5B,8FAA8F;IAC9F,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;IACrC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,SAAS,EAAE,QAAQ,CAAA;IACnB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,gCAAgC;IAChC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;CAC9B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,yBAAyB,EAAE,SAAS,CAAC,GAAG;IAC3E,wDAAwD;IACxD,OAAO,EAAE,YAAY,EAAE,CAAA;CACxB,CAAA"}