@scalar/api-reference 1.32.7 → 1.32.8

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 (135) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/browser/standalone.js +16286 -16092
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Anchor/Anchor.vue2.js +2 -1
  5. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  6. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  7. package/dist/components/ApiReferenceLayout.vue2.js +164 -176
  8. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  9. package/dist/components/Content/Content.vue.js +2 -2
  10. package/dist/components/Content/Content.vue2.js +20 -20
  11. package/dist/components/Content/Models/Models.vue2.js +5 -4
  12. package/dist/components/Content/Models/ModelsAccordion.vue2.js +2 -1
  13. package/dist/components/Content/Schema/Schema.vue2.js +2 -1
  14. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +14 -7
  15. package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
  16. package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
  17. package/dist/components/Content/Tag/OperationsList.vue2.js +18 -22
  18. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
  19. package/dist/components/Content/Tag/OperationsListItem.vue.js +2 -2
  20. package/dist/components/Content/Tag/OperationsListItem.vue2.js +33 -34
  21. package/dist/components/Content/Tag/Tag.vue.js +2 -1
  22. package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
  23. package/dist/components/GettingStarted.vue2.js +8 -6
  24. package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
  25. package/dist/components/Section/SectionAccordion.vue.js +1 -1
  26. package/dist/components/Section/SectionAccordion.vue2.js +28 -29
  27. package/dist/components/Section/SectionContainerAccordion.vue.d.ts.map +1 -1
  28. package/dist/components/Section/SectionContainerAccordion.vue.js +2 -2
  29. package/dist/components/Section/SectionContainerAccordion.vue2.js +17 -18
  30. package/dist/features/Operation/Operation.vue.d.ts +6 -6
  31. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  32. package/dist/features/Operation/Operation.vue.js +50 -49
  33. package/dist/features/Operation/components/ContentTypeSelect.vue.js +8 -7
  34. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +8 -6
  35. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  36. package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
  37. package/dist/features/Operation/components/callbacks/Callback.vue2.js +21 -28
  38. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +5 -3
  39. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  40. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +33 -18
  41. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +11 -12
  42. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  43. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  44. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +168 -154
  45. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +12 -13
  46. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  47. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  48. package/dist/features/Operation/layouts/ModernLayout.vue2.js +113 -117
  49. package/dist/features/Search/SearchButton.vue.js +2 -1
  50. package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
  51. package/dist/features/Search/SearchModal.vue.js +2 -2
  52. package/dist/features/Search/SearchModal.vue2.js +16 -16
  53. package/dist/features/api-client-modal/useApiClient.d.ts +5338 -5258
  54. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  55. package/dist/features/download-link/DownloadLink.vue2.js +4 -2
  56. package/dist/{components/Card/CardTab.vue.d.ts → features/example-responses/ExampleResponseTab.vue.d.ts} +1 -1
  57. package/dist/features/example-responses/ExampleResponseTab.vue.d.ts.map +1 -0
  58. package/dist/features/example-responses/ExampleResponseTab.vue.js +7 -0
  59. package/dist/{components/Card/CardTab.vue2.js → features/example-responses/ExampleResponseTab.vue2.js} +6 -6
  60. package/dist/{components/Card/CardTabHeader.vue.d.ts → features/example-responses/ExampleResponseTabList.vue.d.ts} +3 -3
  61. package/dist/features/example-responses/ExampleResponseTabList.vue.d.ts.map +1 -0
  62. package/dist/features/example-responses/ExampleResponseTabList.vue.js +7 -0
  63. package/dist/{components/Card/CardTabHeader.vue2.js → features/example-responses/ExampleResponseTabList.vue2.js} +9 -9
  64. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  65. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  66. package/dist/features/example-responses/ExampleResponses.vue2.js +89 -96
  67. package/dist/features/test-request-button/TestRequestButton.vue.d.ts +3 -2
  68. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  69. package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
  70. package/dist/features/test-request-button/TestRequestButton.vue2.js +26 -24
  71. package/dist/helpers/convert-security-scheme.js +23 -0
  72. package/dist/index.d.ts +0 -2
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +15 -29
  75. package/dist/style.css +1 -1
  76. package/dist/v2/ApiReferenceWorkspace.vue.d.ts +3 -1
  77. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  78. package/dist/v2/ApiReferenceWorkspace.vue.js +113 -86
  79. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +4 -0
  80. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +64 -0
  81. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
  82. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +7 -0
  83. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +212 -0
  84. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +20 -3
  85. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +35 -0
  86. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +29 -0
  87. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +10 -0
  88. package/dist/v2/blocks/scalar-request-example-block/index.d.ts +2 -2
  89. package/dist/v2/events/definitions.js +7 -0
  90. package/dist/v2/events/index.d.ts +1 -1
  91. package/dist/v2/events/listeners.d.ts +1 -1
  92. package/dist/v2/hooks/useStore.js +14 -0
  93. package/package.json +26 -26
  94. package/dist/blocks/constants.js +0 -6
  95. package/dist/blocks/helpers/getPointer.js +0 -12
  96. package/dist/blocks/hooks/useBlockProps.d.ts +0 -31
  97. package/dist/blocks/hooks/useBlockProps.d.ts.map +0 -1
  98. package/dist/blocks/hooks/useBlockProps.js +0 -24
  99. package/dist/components/Card/Card.vue.d.ts +0 -18
  100. package/dist/components/Card/Card.vue.d.ts.map +0 -1
  101. package/dist/components/Card/Card.vue.js +0 -13
  102. package/dist/components/Card/CardContent.vue.d.ts +0 -19
  103. package/dist/components/Card/CardContent.vue.d.ts.map +0 -1
  104. package/dist/components/Card/CardContent.vue.js +0 -7
  105. package/dist/components/Card/CardContent.vue2.js +0 -27
  106. package/dist/components/Card/CardFooter.vue.d.ts +0 -19
  107. package/dist/components/Card/CardFooter.vue.d.ts.map +0 -1
  108. package/dist/components/Card/CardFooter.vue.js +0 -7
  109. package/dist/components/Card/CardFooter.vue2.js +0 -24
  110. package/dist/components/Card/CardHeader.vue.d.ts +0 -20
  111. package/dist/components/Card/CardHeader.vue.d.ts.map +0 -1
  112. package/dist/components/Card/CardHeader.vue.js +0 -7
  113. package/dist/components/Card/CardHeader.vue2.js +0 -31
  114. package/dist/components/Card/CardTab.vue.d.ts.map +0 -1
  115. package/dist/components/Card/CardTab.vue.js +0 -7
  116. package/dist/components/Card/CardTabHeader.vue.d.ts.map +0 -1
  117. package/dist/components/Card/CardTabHeader.vue.js +0 -7
  118. package/dist/components/Card/index.d.ts +0 -7
  119. package/dist/components/Card/index.d.ts.map +0 -1
  120. package/dist/components/Card/types.d.ts +0 -8
  121. package/dist/components/Card/types.d.ts.map +0 -1
  122. package/dist/features/example-request/ExamplePicker.vue.d.ts +0 -13
  123. package/dist/features/example-request/ExamplePicker.vue.d.ts.map +0 -1
  124. package/dist/features/example-request/ExamplePicker.vue.js +0 -7
  125. package/dist/features/example-request/ExamplePicker.vue2.js +0 -56
  126. package/dist/features/example-request/ExampleRequest.vue.d.ts +0 -79
  127. package/dist/features/example-request/ExampleRequest.vue.d.ts.map +0 -1
  128. package/dist/features/example-request/ExampleRequest.vue.js +0 -7
  129. package/dist/features/example-request/ExampleRequest.vue2.js +0 -361
  130. package/dist/features/example-request/TextSelect.vue.d.ts +0 -34
  131. package/dist/features/example-request/TextSelect.vue.d.ts.map +0 -1
  132. package/dist/features/example-request/TextSelect.vue.js +0 -48
  133. package/dist/features/example-request/TextSelect.vue3.js +0 -5
  134. package/dist/features/example-request/index.d.ts +0 -3
  135. package/dist/features/example-request/index.d.ts.map +0 -1
@@ -1,79 +0,0 @@
1
- import { type Collection, type Request, type Server } from '@scalar/oas-utils/entities/spec';
2
- import type { OpenAPIV3_1 } from '@scalar/types/legacy';
3
- import { type ComponentPublicInstance } from 'vue';
4
- import type { Schemas } from '../../features/Operation/types/schemas';
5
- type __VLS_Props = {
6
- server: Server | undefined;
7
- collection: Collection;
8
- operation: OpenAPIV3_1.OperationObject;
9
- request: Request | undefined;
10
- method: OpenAPIV3_1.HttpMethods;
11
- /** Show a simplified card if no example are available */
12
- fallback?: boolean;
13
- schemas?: Schemas;
14
- };
15
- declare function __VLS_template(): {
16
- attrs: Partial<{}>;
17
- slots: {
18
- header?(_: {}): any;
19
- header?(_: {}): any;
20
- footer?(_: {}): any;
21
- footer?(_: {}): any;
22
- };
23
- refs: {
24
- elem: ({
25
- $: import("vue").ComponentInternalInstance;
26
- $data: {};
27
- $props: Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
28
- $attrs: {
29
- [x: string]: unknown;
30
- };
31
- $refs: {
32
- [x: string]: unknown;
33
- };
34
- $slots: Readonly<{
35
- [name: string]: import("vue").Slot<any> | undefined;
36
- }>;
37
- $root: ComponentPublicInstance | null;
38
- $parent: ComponentPublicInstance | null;
39
- $host: Element | null;
40
- $emit: (event: string, ...args: any[]) => void;
41
- $el: HTMLDivElement;
42
- $options: import("vue").ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
43
- beforeCreate?: (() => void) | (() => void)[];
44
- created?: (() => void) | (() => void)[];
45
- beforeMount?: (() => void) | (() => void)[];
46
- mounted?: (() => void) | (() => void)[];
47
- beforeUpdate?: (() => void) | (() => void)[];
48
- updated?: (() => void) | (() => void)[];
49
- activated?: (() => void) | (() => void)[];
50
- deactivated?: (() => void) | (() => void)[];
51
- beforeDestroy?: (() => void) | (() => void)[];
52
- beforeUnmount?: (() => void) | (() => void)[];
53
- destroyed?: (() => void) | (() => void)[];
54
- unmounted?: (() => void) | (() => void)[];
55
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
56
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
57
- errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
58
- };
59
- $forceUpdate: () => void;
60
- $nextTick: typeof import("vue").nextTick;
61
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
62
- } & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
63
- $slots: {
64
- default?(_: {}): any;
65
- };
66
- }) | null;
67
- };
68
- rootEl: any;
69
- };
70
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
71
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
72
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
73
- export default _default;
74
- type __VLS_WithTemplateSlots<T, S> = T & {
75
- new (): {
76
- $slots: S;
77
- };
78
- };
79
- //# sourceMappingURL=ExampleRequest.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExampleRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-request/ExampleRequest.vue"],"names":[],"mappings":"AA6jBA,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,MAAM,EACZ,MAAM,iCAAiC,CAAA;AAGxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAOL,KAAK,uBAAuB,EAC7B,MAAM,KAAK,CAAA;AAKZ,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAiBjE,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,WAAW,CAAC,eAAe,CAAA;IACtC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,MAAM,EAAE,WAAW,CAAC,WAAW,CAAA;IAC/B,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;AAuXF,iBAAS,cAAc;WAoOT,OAAO,IAA6B;;wBAZrB,GAAG;wBAEH,GAAG;wBADH,GAAG;wBAEH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAzPF,GAAG,8CACZ,GAAG,yBAAyB,GAAG,6DACzC,GAAG;;;;;;;;EAqQb;AAkCD,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,7 +0,0 @@
1
- import o from "./ExampleRequest.vue2.js";
2
- /* empty css */
3
- import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7b64d055"]]);
5
- export {
6
- r as default
7
- };
@@ -1,361 +0,0 @@
1
- import { defineComponent as ye, useId as ve, ref as w, inject as Y, computed as c, watch as Z, onMounted as ge, createBlock as J, createCommentVNode as U, unref as r, openBlock as g, withCtx as s, createVNode as n, createElementVNode as D, renderSlot as T, createTextVNode as b, createElementBlock as H, Fragment as _, toDisplayString as I } from "vue";
2
- import { useWorkspace as xe } from "@scalar/api-client/store";
3
- import { getHarRequest as he, getSnippet as qe } from "@scalar/api-client/views/Components/CodeSnippet";
4
- import { filterSecurityRequirements as Ee } from "@scalar/api-client/views/Request/RequestSection";
5
- import { ScalarCodeBlock as Ke } from "@scalar/components";
6
- import { freezeElement as be } from "@scalar/helpers/dom/freeze-element";
7
- import { requestSchema as Se, createExampleFromRequest as ke } from "@scalar/oas-utils/entities/spec";
8
- import { isDereferenced as Ce } from "@scalar/openapi-types/helpers";
9
- import M from "../../components/ScreenReader.vue.js";
10
- import { useConfig as Oe } from "../../hooks/useConfig.js";
11
- import { EXAMPLE_CONTEXT as Ne, DISCRIMINATOR_CONTEXT as $e } from "../../hooks/useDiscriminator.js";
12
- import { useHttpClientStore as Te } from "../../stores/useHttpClientStore.js";
13
- import Ve from "./ExamplePicker.vue.js";
14
- import Re from "./TextSelect.vue.js";
15
- /* empty css */
16
- import ee from "../../components/Card/Card.vue.js";
17
- import Be from "../../components/Card/CardHeader.vue.js";
18
- import te from "../../components/HttpMethod/HttpMethod.vue.js";
19
- import ae from "../../components/Card/CardContent.vue.js";
20
- import je from "../../components/Card/CardFooter.vue.js";
21
- import { useExampleStore as we } from "../../legacy/stores/useExampleStore.js";
22
- const Je = ["id"], Ue = ["id"], De = {
23
- key: 0,
24
- class: "request-card-footer-addon"
25
- }, He = { class: "request-header" }, nt = /* @__PURE__ */ ye({
26
- __name: "ExampleRequest",
27
- props: {
28
- server: {},
29
- collection: {},
30
- operation: {},
31
- request: {},
32
- method: {},
33
- fallback: { type: Boolean },
34
- schemas: {}
35
- },
36
- setup(l) {
37
- const { selectedExampleKey: A, operationId: le } = we(), { requestExamples: S, securitySchemes: F, requestExampleMutators: V } = xe(), re = Oe(), {
38
- httpClient: u,
39
- setHttpClient: oe,
40
- availableTargets: P,
41
- httpTargetTitle: se,
42
- httpClientTitle: ne
43
- } = Te(), k = ve(), x = w(!1), C = Y(Ne), f = Y($e), R = c(() => {
44
- var e;
45
- return (e = f == null ? void 0 : f.value) == null ? void 0 : e.selectedType;
46
- }), X = c(
47
- () => {
48
- var e;
49
- return ((e = f == null ? void 0 : f.value) == null ? void 0 : e.hasDiscriminator) || !1;
50
- }
51
- ), d = c(() => {
52
- var t;
53
- const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
54
- for (const a of e)
55
- if ((t = l.operation) != null && t[a])
56
- return [...l.operation[a]];
57
- return [];
58
- }), o = w(
59
- // Default to first custom example
60
- d.value.length ? {
61
- targetKey: "customExamples",
62
- clientKey: 0
63
- } : (
64
- // Otherwise use the globally selected HTTP client
65
- {
66
- targetKey: u.targetKey,
67
- clientKey: u.clientKey
68
- }
69
- )
70
- );
71
- Z(u, () => {
72
- o.value = {
73
- targetKey: u.targetKey,
74
- clientKey: u.clientKey
75
- };
76
- });
77
- const z = c(() => {
78
- const e = O.value;
79
- return Object.keys(e).length > 1;
80
- }), ue = () => {
81
- var q, E, K;
82
- if (o.value.targetKey === "customExamples")
83
- return ((q = d.value[o.value.clientKey]) == null ? void 0 : q.source) ?? "";
84
- const e = u.clientKey, t = u.targetKey, a = l.request || Se.parse({
85
- uid: l.operation.operationId || "temp-request",
86
- method: l.method,
87
- path: l.operation.path,
88
- parameters: l.operation.parameters || [],
89
- requestBody: l.operation.requestBody,
90
- examples: [],
91
- type: "request",
92
- selectedSecuritySchemeUids: [],
93
- selectedServerUid: "",
94
- servers: [],
95
- summary: l.operation.summary || "Example Request"
96
- });
97
- let i = S[((K = (E = l.request) == null ? void 0 : E.examples) == null ? void 0 : K[0]) ?? ""];
98
- if (!i) {
99
- const $ = O.value, m = Object.keys($)[0];
100
- i = ke(a, m);
101
- }
102
- const p = Ee(
103
- l.operation.security || l.collection.security,
104
- l.collection.selectedSecuritySchemeUids,
105
- F
106
- ), y = he({
107
- operation: a,
108
- example: i,
109
- server: l.server,
110
- securitySchemes: p
111
- }), [h, N] = qe(t, e, y);
112
- return h ? h.message ?? "" : N;
113
- }, L = c(() => {
114
- try {
115
- return ue();
116
- } catch (e) {
117
- return console.error("[generateSnippet]", e), "";
118
- }
119
- }), O = c(() => {
120
- var a;
121
- if (!Ce(l.operation.requestBody))
122
- return {};
123
- const e = ((a = l.operation.requestBody) == null ? void 0 : a.content) ?? {}, t = Object.values(e)[0];
124
- return (t == null ? void 0 : t.examples) ?? {};
125
- }), ie = c(() => {
126
- var t, a;
127
- const e = (
128
- // Specified language
129
- ((t = o.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = d.value[o.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
130
- // Or language for the globally selected HTTP client
131
- u.targetKey
132
- )
133
- );
134
- return e === "shell" && L.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
135
- }), ce = c(
136
- () => Object.values(F).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
137
- e.token,
138
- e.password,
139
- btoa(`${e.username}:${e.password}`)
140
- ] : e.type === "oauth2" ? Object.values(e.flows).map((t) => t.token) : [])
141
- ), me = c(() => {
142
- const e = P.value.map((t) => ({
143
- value: t.key,
144
- label: t.title,
145
- options: t.clients.map((a) => ({
146
- value: JSON.stringify({
147
- targetKey: t.key,
148
- clientKey: a.client
149
- }),
150
- label: a.title
151
- }))
152
- }));
153
- return d.value.length && e.unshift({
154
- value: "customExamples",
155
- label: "Examples",
156
- options: d.value.map((t, a) => ({
157
- value: JSON.stringify({
158
- targetKey: "customExamples",
159
- clientKey: a
160
- }),
161
- label: t.label ?? t.lang ?? `Example #${a + 1}`
162
- }))
163
- }), e;
164
- }), B = w(null);
165
- function de(e) {
166
- const t = JSON.parse(e);
167
- if (B.value) {
168
- const a = be(B.value.$el);
169
- setTimeout(() => {
170
- a();
171
- }, 300);
172
- }
173
- t.targetKey === "customExamples" || o.value.targetKey === "customExamples" && t.targetKey === u.targetKey && t.clientKey === u.clientKey ? o.value = t : oe(t);
174
- }
175
- function pe(e) {
176
- var i, p;
177
- if (!e)
178
- return;
179
- A.value = e, le.value = l.operation.operationId;
180
- const t = S[((p = (i = l.request) == null ? void 0 : i.examples) == null ? void 0 : p[0]) ?? ""], a = O.value[e];
181
- if (t && (a != null && a.value))
182
- try {
183
- V.edit(
184
- t.uid,
185
- "body.raw.value",
186
- JSON.stringify(a.value, null, 2)
187
- );
188
- } catch (y) {
189
- console.error("[handleExampleUpdate]", y);
190
- }
191
- }
192
- ge(() => {
193
- X.value && R.value && !x.value && W(R.value);
194
- });
195
- const W = (e) => {
196
- var t, a, i, p, y, h, N, q, E, K, $;
197
- if (!x.value)
198
- try {
199
- x.value = !0;
200
- const m = S[((a = (t = l.request) == null ? void 0 : t.examples) == null ? void 0 : a[0]) ?? ""];
201
- if (m && (C != null && C.generateExampleValue)) {
202
- const fe = (p = (i = m.body) == null ? void 0 : i.raw) != null && p.value ? JSON.parse(m.body.raw.value) : void 0, j = C.generateExampleValue(
203
- Array.isArray(fe)
204
- );
205
- if (V.edit(
206
- m.uid,
207
- "body.raw.value",
208
- JSON.stringify(j, null, 2)
209
- ), (h = (y = l.request) == null ? void 0 : y.examples) != null && h[0]) {
210
- const v = S[(q = (N = l.request) == null ? void 0 : N.examples) == null ? void 0 : q[0]];
211
- v && V.edit(
212
- v.uid,
213
- "body.raw.value",
214
- JSON.stringify(j, null, 2)
215
- );
216
- }
217
- if (($ = (K = (E = l.operation.requestBody) == null ? void 0 : E.content) == null ? void 0 : K["application/json"]) != null && $.examples) {
218
- const v = l.operation.requestBody.content["application/json"].examples;
219
- Object.keys(v).forEach((G) => {
220
- var Q;
221
- (Q = v[G]) != null && Q.value && (v[G].value = j);
222
- });
223
- }
224
- }
225
- } catch (m) {
226
- console.error("[handleDiscriminatorChange]", m);
227
- } finally {
228
- x.value = !1;
229
- }
230
- };
231
- return Z(R, (e) => {
232
- e && X.value && !x.value && W();
233
- }), (e, t) => r(P).length || d.value.length ? (g(), J(r(ee), {
234
- key: 0,
235
- "aria-labelledby": `${r(k)}-header`,
236
- class: "dark-mode",
237
- ref_key: "elem",
238
- ref: B,
239
- role: "region"
240
- }, {
241
- default: s(() => [
242
- n(r(Be), { muted: "" }, {
243
- actions: s(() => [
244
- n(Re, {
245
- class: "request-client-picker",
246
- controls: `${r(k)}-example`,
247
- modelValue: JSON.stringify(o.value),
248
- options: me.value,
249
- "onUpdate:modelValue": de
250
- }, {
251
- default: s(() => [
252
- o.value.targetKey === "customExamples" ? (g(), H(_, { key: 0 }, [
253
- n(M, null, {
254
- default: s(() => t[1] || (t[1] = [
255
- b("Selected Example:")
256
- ])),
257
- _: 1
258
- }),
259
- b(" " + I(d.value[o.value.clientKey].label ?? "Example"), 1)
260
- ], 64)) : (g(), H(_, { key: 1 }, [
261
- n(M, null, {
262
- default: s(() => t[2] || (t[2] = [
263
- b("Selected HTTP client:")
264
- ])),
265
- _: 1
266
- }),
267
- b(" " + I(r(se)) + " " + I(r(ne)), 1)
268
- ], 64))
269
- ]),
270
- _: 1
271
- }, 8, ["controls", "modelValue", "options"])
272
- ]),
273
- default: s(() => [
274
- D("div", {
275
- id: `${r(k)}-header`,
276
- class: "request-header"
277
- }, [
278
- n(M, null, {
279
- default: s(() => t[0] || (t[0] = [
280
- b("Request Example for")
281
- ])),
282
- _: 1
283
- }),
284
- n(r(te), {
285
- as: "span",
286
- class: "request-method",
287
- method: e.method
288
- }, null, 8, ["method"]),
289
- T(e.$slots, "header", {}, void 0, !0)
290
- ], 8, Je)
291
- ]),
292
- _: 3
293
- }),
294
- n(r(ae), {
295
- borderless: "",
296
- class: "request-editor-section custom-scroll",
297
- frameless: ""
298
- }, {
299
- default: s(() => [
300
- D("div", {
301
- id: `${r(k)}-example`,
302
- class: "code-snippet"
303
- }, [
304
- n(r(Ke), {
305
- class: "bg-b-2 -outline-offset-2",
306
- content: L.value,
307
- hideCredentials: ce.value,
308
- lang: ie.value,
309
- lineNumbers: ""
310
- }, null, 8, ["content", "hideCredentials", "lang"])
311
- ], 8, Ue)
312
- ]),
313
- _: 1
314
- }),
315
- (z.value || !r(re).hideTestRequestButton) && e.$slots.footer ? (g(), J(r(je), {
316
- key: 0,
317
- class: "request-card-footer",
318
- contrast: ""
319
- }, {
320
- default: s(() => [
321
- z.value ? (g(), H("div", De, [
322
- n(Ve, {
323
- class: "request-example-selector",
324
- examples: O.value,
325
- modelValue: r(A),
326
- "onUpdate:modelValue": pe
327
- }, null, 8, ["examples", "modelValue"])
328
- ])) : U("", !0),
329
- T(e.$slots, "footer", {}, void 0, !0)
330
- ]),
331
- _: 3
332
- })) : U("", !0)
333
- ]),
334
- _: 3
335
- }, 8, ["aria-labelledby"])) : e.fallback ? (g(), J(r(ee), {
336
- key: 1,
337
- class: "dark-mode"
338
- }, {
339
- default: s(() => [
340
- n(r(ae), { class: "request-card-simple" }, {
341
- default: s(() => [
342
- D("div", He, [
343
- n(r(te), {
344
- as: "span",
345
- class: "request-method",
346
- method: e.method
347
- }, null, 8, ["method"]),
348
- T(e.$slots, "header", {}, void 0, !0)
349
- ]),
350
- T(e.$slots, "footer", {}, void 0, !0)
351
- ]),
352
- _: 3
353
- })
354
- ]),
355
- _: 3
356
- })) : U("", !0);
357
- }
358
- });
359
- export {
360
- nt as default
361
- };
@@ -1,34 +0,0 @@
1
- type __VLS_Props = {
2
- modelValue: any;
3
- options: {
4
- value: string;
5
- label: string;
6
- options?: {
7
- value: string;
8
- label: string;
9
- }[];
10
- }[];
11
- controls?: string;
12
- };
13
- declare function __VLS_template(): {
14
- attrs: Partial<{}>;
15
- slots: {
16
- default?(_: {}): any;
17
- };
18
- refs: {};
19
- rootEl: HTMLLabelElement;
20
- };
21
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
- "update:modelValue": (value: any) => any;
24
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
- "onUpdate:modelValue"?: ((value: any) => any) | undefined;
26
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLLabelElement>;
27
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
28
- export default _default;
29
- type __VLS_WithTemplateSlots<T, S> = T & {
30
- new (): {
31
- $slots: S;
32
- };
33
- };
34
- //# sourceMappingURL=TextSelect.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-request/TextSelect.vue"],"names":[],"mappings":"AA4HA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,GAAG,CAAA;IACf,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE;YACR,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,EAAE,CAAA;KACJ,EAAE,CAAA;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC;AAkBF,iBAAS,cAAc;WAyDT,OAAO,IAA6B;;yBARrB,GAAG;;;;EAa/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;+FAQnB,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,48 +0,0 @@
1
- import { defineComponent as m, computed as v, createElementBlock as l, openBlock as o, normalizeClass as b, createElementVNode as u, renderSlot as _, Fragment as s, renderList as r, toDisplayString as p } from "vue";
2
- const g = { class: "text-select-label" }, f = ["aria-controls", "tabindex", "value"], k = ["label"], y = ["value"], V = ["value"], S = /* @__PURE__ */ m({
3
- __name: "TextSelect",
4
- props: {
5
- modelValue: {},
6
- options: {},
7
- controls: {}
8
- },
9
- emits: ["update:modelValue"],
10
- setup(i) {
11
- const d = i, c = v(
12
- () => d.options.flatMap((e) => e.options ?? e).length
13
- );
14
- return (e, n) => (o(), l("label", {
15
- class: b(["text-select", c.value === 1 ? "text-select--single-option" : ""])
16
- }, [
17
- u("span", g, [
18
- _(e.$slots, "default")
19
- ]),
20
- u("select", {
21
- "aria-controls": e.controls,
22
- tabindex: e.options.length === 1 ? -1 : 0,
23
- value: e.modelValue,
24
- onInput: n[0] || (n[0] = (t) => e.$emit("update:modelValue", t.target.value))
25
- }, [
26
- (o(!0), l(s, null, r(e.options, (t) => (o(), l(s, {
27
- key: t.value
28
- }, [
29
- t.options ? (o(), l("optgroup", {
30
- key: 0,
31
- label: t.label
32
- }, [
33
- (o(!0), l(s, null, r(t.options, (a) => (o(), l("option", {
34
- key: a.value,
35
- value: a.value
36
- }, p(a.label), 9, y))), 128))
37
- ], 8, k)) : (o(), l("option", {
38
- key: t.value,
39
- value: t.value
40
- }, p(t.label), 9, V))
41
- ], 64))), 128))
42
- ], 40, f)
43
- ], 2));
44
- }
45
- });
46
- export {
47
- S as default
48
- };
@@ -1,5 +0,0 @@
1
- import o from "./TextSelect.vue.js";
2
- /* empty css */
3
- export {
4
- o as default
5
- };
@@ -1,3 +0,0 @@
1
- export { default as ExamplePicker } from './ExamplePicker.vue.js';
2
- export { default as ExampleRequest } from './ExampleRequest.vue.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/example-request/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA"}