@scalar/api-client 3.11.0 → 3.13.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.
- package/CHANGELOG.md +27 -0
- package/dist/plugins/posthog/sanitize-event-payload.d.ts.map +1 -1
- package/dist/plugins/posthog/sanitize-event-payload.js +1 -0
- package/dist/plugins/posthog/sanitize-event-payload.js.map +1 -1
- package/dist/style.css +15 -69
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -2
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +2 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +2 -6
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +17 -3
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +28 -17
- package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +8 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +27 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +30 -5
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js +1 -1
- package/dist/v2/types/options.d.ts +7 -0
- package/dist/v2/types/options.d.ts.map +1 -1
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +1 -0
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/vue-styles.css +6 -48
- package/package.json +11 -22
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +0 -16
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +0 -7
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.script.js +0 -53
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.script.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts +0 -26
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.js +0 -7
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.script.js +0 -33
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.script.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +0 -141
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +0 -9
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +0 -272
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/filter-clients-by-query.d.ts +0 -9
- package/dist/v2/blocks/operation-code-sample/helpers/filter-clients-by-query.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/filter-clients-by-query.js +0 -37
- package/dist/v2/blocks/operation-code-sample/helpers/filter-clients-by-query.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +0 -41
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +0 -48
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/format-language.d.ts +0 -8
- package/dist/v2/blocks/operation-code-sample/helpers/format-language.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/format-language.js +0 -70
- package/dist/v2/blocks/operation-code-sample/helpers/format-language.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +0 -30
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +0 -63
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +0 -39
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +0 -38
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +0 -13
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +0 -37
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts +0 -45
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +0 -84
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts +0 -27
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +0 -41
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +0 -4
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js +0 -18
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-snippet.d.ts +0 -8
- package/dist/v2/blocks/operation-code-sample/helpers/get-snippet.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-snippet.js +0 -38
- package/dist/v2/blocks/operation-code-sample/helpers/get-snippet.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +0 -72
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +0 -114
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +0 -13
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +0 -196
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts +0 -24
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +0 -237
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +0 -15
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js +0 -65
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts +0 -6
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +0 -19
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js.map +0 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts +0 -9
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/index.js +0 -8
- package/dist/v2/blocks/operation-code-sample/types.d.ts +0 -46
- package/dist/v2/blocks/operation-code-sample/types.d.ts.map +0 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts +0 -13
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.d.ts.map +0 -1
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +0 -21
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js.map +0 -1
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.
|
|
21
|
+
"version": "3.13.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
@@ -87,11 +87,6 @@
|
|
|
87
87
|
"types": "./dist/v2/blocks/operation-block/index.d.ts",
|
|
88
88
|
"default": "./dist/v2/blocks/operation-block/index.js"
|
|
89
89
|
},
|
|
90
|
-
"./v2/blocks/operation-code-sample": {
|
|
91
|
-
"import": "./dist/v2/blocks/operation-code-sample/index.js",
|
|
92
|
-
"types": "./dist/v2/blocks/operation-code-sample/index.d.ts",
|
|
93
|
-
"default": "./dist/v2/blocks/operation-code-sample/index.js"
|
|
94
|
-
},
|
|
95
90
|
"./v2/blocks/request-block": {
|
|
96
91
|
"import": "./dist/v2/blocks/request-block/index.js",
|
|
97
92
|
"types": "./dist/v2/blocks/request-block/index.d.ts",
|
|
@@ -197,11 +192,6 @@
|
|
|
197
192
|
"types": "./dist/v2/blocks/operation-block/index.d.ts",
|
|
198
193
|
"default": "./dist/v2/blocks/operation-block/index.js"
|
|
199
194
|
},
|
|
200
|
-
"./blocks/operation-code-sample": {
|
|
201
|
-
"import": "./dist/v2/blocks/operation-code-sample/index.js",
|
|
202
|
-
"types": "./dist/v2/blocks/operation-code-sample/index.d.ts",
|
|
203
|
-
"default": "./dist/v2/blocks/operation-code-sample/index.js"
|
|
204
|
-
},
|
|
205
195
|
"./blocks/request-block": {
|
|
206
196
|
"import": "./dist/v2/blocks/request-block/index.js",
|
|
207
197
|
"types": "./dist/v2/blocks/request-block/index.d.ts",
|
|
@@ -306,7 +296,6 @@
|
|
|
306
296
|
"@headlessui/tailwindcss": "^0.2.2",
|
|
307
297
|
"@headlessui/vue": "1.7.23",
|
|
308
298
|
"@scalar/typebox": "^0.1.3",
|
|
309
|
-
"@types/har-format": "^1.2.16",
|
|
310
299
|
"@vueuse/core": "13.9.0",
|
|
311
300
|
"@vueuse/integrations": "13.9.0",
|
|
312
301
|
"focus-trap": "^7.8.0",
|
|
@@ -320,20 +309,20 @@
|
|
|
320
309
|
"vue": "^3.5.30",
|
|
321
310
|
"yaml": "^2.8.3",
|
|
322
311
|
"zod": "^4.3.5",
|
|
323
|
-
"@scalar/
|
|
324
|
-
"@scalar/helpers": "0.
|
|
312
|
+
"@scalar/blocks": "0.1.1",
|
|
313
|
+
"@scalar/helpers": "0.9.0",
|
|
314
|
+
"@scalar/oas-utils": "0.19.2",
|
|
315
|
+
"@scalar/components": "0.27.4",
|
|
325
316
|
"@scalar/icons": "0.7.3",
|
|
326
|
-
"@scalar/json-magic": "0.12.16",
|
|
327
|
-
"@scalar/oas-utils": "0.19.0",
|
|
328
|
-
"@scalar/snippetz": "0.9.18",
|
|
329
|
-
"@scalar/sidebar": "0.9.24",
|
|
330
|
-
"@scalar/themes": "0.16.1",
|
|
331
317
|
"@scalar/openapi-types": "0.9.1",
|
|
332
|
-
"@scalar/
|
|
318
|
+
"@scalar/sidebar": "0.9.26",
|
|
319
|
+
"@scalar/snippetz": "0.9.19",
|
|
320
|
+
"@scalar/themes": "0.16.2",
|
|
321
|
+
"@scalar/types": "0.16.0",
|
|
333
322
|
"@scalar/use-codemirror": "0.14.12",
|
|
334
|
-
"@scalar/use-toasts": "0.10.2",
|
|
335
323
|
"@scalar/use-hooks": "0.4.7",
|
|
336
|
-
"@scalar/
|
|
324
|
+
"@scalar/use-toasts": "0.10.2",
|
|
325
|
+
"@scalar/workspace-store": "0.55.1"
|
|
337
326
|
},
|
|
338
327
|
"devDependencies": {
|
|
339
328
|
"@tailwindcss/cli": "^4.2.4",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
examples?: MediaTypeObject['examples'] | Record<string, string>;
|
|
4
|
-
};
|
|
5
|
-
type __VLS_ModelProps = {
|
|
6
|
-
modelValue: string;
|
|
7
|
-
};
|
|
8
|
-
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
-
"update:modelValue": (value: string) => any;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
-
declare const _default: typeof __VLS_export;
|
|
15
|
-
export default _default;
|
|
16
|
-
//# sourceMappingURL=ExamplePicker.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAGnG,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChE,CAAC;AAwBF,KAAK,gBAAgB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAyGxD,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import ExamplePicker_vue_vue_type_script_setup_true_lang_default from "./ExamplePicker.vue.script.js";
|
|
2
|
-
//#region src/v2/blocks/operation-code-sample/components/ExamplePicker.vue
|
|
3
|
-
var ExamplePicker_default = ExamplePicker_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { ExamplePicker_default as default };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=ExamplePicker.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.js","names":[],"sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { examples = {} } = defineProps<{\n examples?: MediaTypeObject['examples'] | Record<string, string>\n}>()\n\nconst selectedExampleKey = defineModel<string>({\n required: true,\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst exampleOptions = computed<ScalarListboxOption[]>(() =>\n Object.entries(examples).map(([key, example]) => ({\n id: key,\n label: example?.summary ?? key,\n })),\n)\n\nconst selectedExample = computed<ScalarListboxOption | undefined>({\n get: () =>\n exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),\n set: (v) => (selectedExampleKey.value = v?.id ?? ''),\n})\n</script>\n\n<template>\n <ScalarListbox\n v-model=\"selectedExample\"\n class=\"w-fit min-w-32\"\n :options=\"exampleOptions\"\n placement=\"bottom-start\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal\"\n data-testid=\"example-picker\"\n variant=\"ghost\"\n v-bind=\"$attrs\">\n <div class=\"min-w-0 flex-1 truncate\">\n {{ selectedExample?.label ?? 'Select an example' }}\n </div>\n <ScalarIconCaretDown\n class=\"ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n</template>\n"],"mappings":""}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { computed, createBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
2
|
-
import { ScalarButton } from "@scalar/components/button";
|
|
3
|
-
import { ScalarListbox } from "@scalar/components/listbox";
|
|
4
|
-
import { ScalarIconCaretDown } from "@scalar/icons";
|
|
5
|
-
//#region src/v2/blocks/operation-code-sample/components/ExamplePicker.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var _hoisted_1 = { class: "min-w-0 flex-1 truncate" };
|
|
7
|
-
var ExamplePicker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
8
|
-
inheritAttrs: false,
|
|
9
|
-
__name: "ExamplePicker",
|
|
10
|
-
props: /* @__PURE__ */ mergeModels({ examples: { default: () => ({}) } }, {
|
|
11
|
-
"modelValue": { required: true },
|
|
12
|
-
"modelModifiers": {}
|
|
13
|
-
}),
|
|
14
|
-
emits: ["update:modelValue"],
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const selectedExampleKey = useModel(__props, "modelValue");
|
|
17
|
-
const exampleOptions = computed(() => Object.entries(__props.examples).map(([key, example]) => ({
|
|
18
|
-
id: key,
|
|
19
|
-
label: example?.summary ?? key
|
|
20
|
-
})));
|
|
21
|
-
const selectedExample = computed({
|
|
22
|
-
get: () => exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),
|
|
23
|
-
set: (v) => selectedExampleKey.value = v?.id ?? ""
|
|
24
|
-
});
|
|
25
|
-
return (_ctx, _cache) => {
|
|
26
|
-
return openBlock(), createBlock(unref(ScalarListbox), {
|
|
27
|
-
modelValue: selectedExample.value,
|
|
28
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedExample.value = $event),
|
|
29
|
-
class: "w-fit min-w-32",
|
|
30
|
-
options: exampleOptions.value,
|
|
31
|
-
placement: "bottom-start",
|
|
32
|
-
teleport: ""
|
|
33
|
-
}, {
|
|
34
|
-
default: withCtx(() => [createVNode(unref(ScalarButton), mergeProps({
|
|
35
|
-
class: "text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal",
|
|
36
|
-
"data-testid": "example-picker",
|
|
37
|
-
variant: "ghost"
|
|
38
|
-
}, _ctx.$attrs), {
|
|
39
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_1, toDisplayString(selectedExample.value?.label ?? "Select an example"), 1), createVNode(unref(ScalarIconCaretDown), {
|
|
40
|
-
class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
|
|
41
|
-
weight: "bold"
|
|
42
|
-
})]),
|
|
43
|
-
_: 1
|
|
44
|
-
}, 16)]),
|
|
45
|
-
_: 1
|
|
46
|
-
}, 8, ["modelValue", "options"]);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
//#endregion
|
|
51
|
-
export { ExamplePicker_vue_vue_type_script_setup_true_lang_default as default };
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=ExamplePicker.vue.script.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue.script.js","names":["$attrs"],"sources":["../../../../../src/v2/blocks/operation-code-sample/components/ExamplePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { examples = {} } = defineProps<{\n examples?: MediaTypeObject['examples'] | Record<string, string>\n}>()\n\nconst selectedExampleKey = defineModel<string>({\n required: true,\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst exampleOptions = computed<ScalarListboxOption[]>(() =>\n Object.entries(examples).map(([key, example]) => ({\n id: key,\n label: example?.summary ?? key,\n })),\n)\n\nconst selectedExample = computed<ScalarListboxOption | undefined>({\n get: () =>\n exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),\n set: (v) => (selectedExampleKey.value = v?.id ?? ''),\n})\n</script>\n\n<template>\n <ScalarListbox\n v-model=\"selectedExample\"\n class=\"w-fit min-w-32\"\n :options=\"exampleOptions\"\n placement=\"bottom-start\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal\"\n data-testid=\"example-picker\"\n variant=\"ghost\"\n v-bind=\"$attrs\">\n <div class=\"min-w-0 flex-1 truncate\">\n {{ selectedExample?.label ?? 'Select an example' }}\n </div>\n <ScalarIconCaretDown\n class=\"ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAcA,MAAM,qBAAqB,SAAmB,SAAA,aAE7C;EAID,MAAM,iBAAiB,eACrB,OAAO,QAAQ,QAAA,SAAS,CAAC,KAAK,CAAC,KAAK,cAAc;GAChD,IAAI;GACJ,OAAO,SAAS,WAAW;GAC5B,EAAE,CACL;EAEA,MAAM,kBAAkB,SAA0C;GAChE,WACE,eAAe,MAAM,MAAM,EAAE,SAAS,OAAO,mBAAmB,MAAM;GACxE,MAAM,MAAO,mBAAmB,QAAQ,GAAG,MAAM;GAClD,CAAA;;uBAIC,YAkBgB,MAAA,cAAA,EAAA;gBAjBL,gBAAA;iFAAe,QAAA;IACxB,OAAM;IACL,SAAS,eAAA;IACV,WAAU;IACV,UAAA;;2BAYe,CAXf,YAWe,MAAA,aAAA,EAXf,WAWe;KAVb,OAAM;KACN,eAAY;KACZ,SAAQ;OACAA,KAAAA,OAAM,EAAA;4BAGR,CAFN,mBAEM,OAFN,YAEM,gBADD,gBAAA,OAAiB,SAAK,oBAAA,EAAA,EAAA,EAE3B,YAEkB,MAAA,oBAAA,EAAA;MADhB,OAAM;MACN,QAAO"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
-
import { type Component } from 'vue';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
/** The type of element to render as, defaults to `span` */
|
|
5
|
-
as?: Component | string;
|
|
6
|
-
/** The css style property or variable that will be set to the request method color, defaults to `color` */
|
|
7
|
-
property?: string;
|
|
8
|
-
/** Whether or not to abbreviated the slot content */
|
|
9
|
-
short?: boolean;
|
|
10
|
-
/** The HTTP method to show */
|
|
11
|
-
method: HttpMethod | string;
|
|
12
|
-
};
|
|
13
|
-
declare var __VLS_8: {};
|
|
14
|
-
type __VLS_Slots = {} & {
|
|
15
|
-
default?: (props: typeof __VLS_8) => any;
|
|
16
|
-
};
|
|
17
|
-
declare const __VLS_base: 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>;
|
|
18
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
-
declare const _default: typeof __VLS_export;
|
|
20
|
-
export default _default;
|
|
21
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
-
new (): {
|
|
23
|
-
$slots: S;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=HttpMethod.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/HttpMethod.vue"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AAE9C,KAAK,WAAW,GAAG;IACjB,2DAA2D;IAC3D,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IACvB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8BAA8B;IAC9B,MAAM,EAAE,UAAU,GAAG,MAAM,CAAA;CAC5B,CAAC;AAiDF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import HttpMethod_vue_vue_type_script_setup_true_lang_default from "./HttpMethod.vue.script.js";
|
|
2
|
-
//#region src/v2/blocks/operation-code-sample/components/HttpMethod.vue
|
|
3
|
-
var HttpMethod_default = HttpMethod_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { HttpMethod_default as default };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=HttpMethod.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.vue.js","names":[],"sources":["../../../../../src/v2/blocks/operation-code-sample/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { normalizeHttpMethod } from '@scalar/helpers/http/normalize-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: HttpMethod | string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => normalizeHttpMethod(props.method))\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n class=\"uppercase\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { computed, createBlock, createTextVNode, defineComponent, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx } from "vue";
|
|
2
|
-
import { getHttpMethodInfo } from "@scalar/helpers/http/http-info";
|
|
3
|
-
import { normalizeHttpMethod } from "@scalar/helpers/http/normalize-http-method";
|
|
4
|
-
//#region src/v2/blocks/operation-code-sample/components/HttpMethod.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var HttpMethod_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
6
|
-
__name: "HttpMethod",
|
|
7
|
-
props: {
|
|
8
|
-
as: {},
|
|
9
|
-
property: {},
|
|
10
|
-
short: { type: Boolean },
|
|
11
|
-
method: {}
|
|
12
|
-
},
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const props = __props;
|
|
15
|
-
/** Grabs the method info object which contains abbreviation, color, and background color etc */
|
|
16
|
-
const httpMethodInfo = computed(() => getHttpMethodInfo(String(props.method || "")));
|
|
17
|
-
/** Full method name */
|
|
18
|
-
const normalized = computed(() => normalizeHttpMethod(props.method));
|
|
19
|
-
return (_ctx, _cache) => {
|
|
20
|
-
return openBlock(), createBlock(resolveDynamicComponent(__props.as ?? "span"), {
|
|
21
|
-
class: "uppercase",
|
|
22
|
-
style: normalizeStyle({ [__props.property || "color"]: httpMethodInfo.value.colorVar })
|
|
23
|
-
}, {
|
|
24
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), createTextVNode(" " + toDisplayString(__props.short ? httpMethodInfo.value.short : normalized.value), 1)]),
|
|
25
|
-
_: 3
|
|
26
|
-
}, 8, ["style"]);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
//#endregion
|
|
31
|
-
export { HttpMethod_vue_vue_type_script_setup_true_lang_default as default };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=HttpMethod.vue.script.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-code-sample/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { normalizeHttpMethod } from '@scalar/helpers/http/normalize-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: HttpMethod | string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => normalizeHttpMethod(props.method))\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n class=\"uppercase\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;;EAYd,MAAM,iBAAiB,eACrB,kBAAkB,OAAO,MAAM,UAAU,GAAG,CAAC,CAC/C;;EAGA,MAAM,aAAa,eAAe,oBAAoB,MAAM,OAAO,CAAA;;uBAIjE,YAMY,wBALL,QAAA,MAAE,OAAA,EAAA;IACP,OAAM;IACL,OAAK,eAAA,GAAK,QAAA,YAAQ,UAAc,eAAA,MAAe,UAAQ,CAAA;;2BAChD,CAAR,WAAQ,KAAA,QAAA,UAAA,EAAA,gBAAA,MACR,gBAAG,QAAA,QAAQ,eAAA,MAAe,QAAQ,WAAA,MAAU,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods';
|
|
2
|
-
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
-
import type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
|
|
4
|
-
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
5
|
-
import type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
6
|
-
import type { ClientOptionGroup } from '../../../../v2/blocks/operation-code-sample/types';
|
|
7
|
-
export type OperationCodeSampleProps = {
|
|
8
|
-
/**
|
|
9
|
-
* Integration type: determines if the code sample is displayed in a client environment
|
|
10
|
-
* or in an API reference environment.
|
|
11
|
-
*/
|
|
12
|
-
integration?: 'client' | 'reference';
|
|
13
|
-
/**
|
|
14
|
-
* List of all http clients formatted into option groups for the client selector
|
|
15
|
-
*/
|
|
16
|
-
clientOptions: ClientOptionGroup[];
|
|
17
|
-
/**
|
|
18
|
-
* Pre-selected client, this will determine which client is initially selected in the dropdown.
|
|
19
|
-
* Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).
|
|
20
|
-
*
|
|
21
|
-
* Typed as a plain string: unioning the (large) client-id union with the `custom/...`
|
|
22
|
-
* ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.
|
|
23
|
-
*
|
|
24
|
-
* @defaults to a custom sample if one is available, otherwise shell/curl
|
|
25
|
-
*/
|
|
26
|
-
selectedClient?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Which server from the spec to use for the code example
|
|
29
|
-
*/
|
|
30
|
-
selectedServer?: ServerObject | null;
|
|
31
|
-
/**
|
|
32
|
-
* The selected content type from the requestBody.content, this will determine which examples are available
|
|
33
|
-
* as well as the content type of the code example
|
|
34
|
-
*
|
|
35
|
-
* @defaults to the first content type if not provided
|
|
36
|
-
*/
|
|
37
|
-
selectedContentType?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Example name to use for resolving example values for parameters AND requestBody
|
|
40
|
-
*
|
|
41
|
-
* @example "limited"
|
|
42
|
-
* ```ts
|
|
43
|
-
* parameters: {
|
|
44
|
-
* name: 'foobar',
|
|
45
|
-
* in: 'query',
|
|
46
|
-
* examples: {
|
|
47
|
-
* limited: {
|
|
48
|
-
* dataValue: 10,
|
|
49
|
-
* }
|
|
50
|
-
* }
|
|
51
|
-
* },
|
|
52
|
-
* body: {
|
|
53
|
-
* content: {
|
|
54
|
-
* 'application/json': {
|
|
55
|
-
* examples: {
|
|
56
|
-
* limited: {
|
|
57
|
-
* dataValue: { foo: 'bar' },
|
|
58
|
-
* }
|
|
59
|
-
* }
|
|
60
|
-
* }
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
selectedExample?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Event bus
|
|
69
|
-
*/
|
|
70
|
-
eventBus: WorkspaceEventBus;
|
|
71
|
-
/**
|
|
72
|
-
* The security schemes which are applicable to this operation
|
|
73
|
-
*/
|
|
74
|
-
securitySchemes: SecuritySchemeObjectSecret[];
|
|
75
|
-
/**
|
|
76
|
-
* HTTP method of the operation
|
|
77
|
-
*/
|
|
78
|
-
method: HttpMethodType;
|
|
79
|
-
/**
|
|
80
|
-
* Path of the operation
|
|
81
|
-
*/
|
|
82
|
-
path: string;
|
|
83
|
-
/**
|
|
84
|
-
* De-referenced OpenAPI Operation object
|
|
85
|
-
*/
|
|
86
|
-
operation: OperationObject;
|
|
87
|
-
/**
|
|
88
|
-
* If true and there's no example, we will display a small card with the method and path only
|
|
89
|
-
*/
|
|
90
|
-
fallback?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* A method to generate the label of the block, should return an html string
|
|
93
|
-
*/
|
|
94
|
-
generateLabel?: () => string;
|
|
95
|
-
/**
|
|
96
|
-
* If true, render this as a webhook request example
|
|
97
|
-
*/
|
|
98
|
-
isWebhook?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Workspace + document cookies
|
|
101
|
-
*/
|
|
102
|
-
globalCookies?: XScalarCookie[];
|
|
103
|
-
/**
|
|
104
|
-
* When the request body schema uses oneOf/anyOf, use these selected variants
|
|
105
|
-
* for the example snippet (e.g. from the schema dropdowns in the API reference).
|
|
106
|
-
*/
|
|
107
|
-
requestBodyCompositionSelection?: Record<string, number>;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Request Example
|
|
111
|
-
*
|
|
112
|
-
* The core component for rendering a request example block,
|
|
113
|
-
* this component does not have much of its own state but operates on props and custom events
|
|
114
|
-
*
|
|
115
|
-
* @event workspace:update:selected-client - Emitted when the selected client changes
|
|
116
|
-
* @event scalar-update-selected-example - removed for now, we can bring it back when we need it
|
|
117
|
-
*/
|
|
118
|
-
declare const _default: typeof __VLS_export;
|
|
119
|
-
export default _default;
|
|
120
|
-
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<OperationCodeSampleProps & {
|
|
121
|
-
/** The currently selected example key with v-model support */
|
|
122
|
-
selectedExample?: string;
|
|
123
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
124
|
-
"update:selectedExample": (value: string) => any;
|
|
125
|
-
}, string, import("vue").PublicProps, Readonly<OperationCodeSampleProps & {
|
|
126
|
-
/** The currently selected example key with v-model support */
|
|
127
|
-
selectedExample?: string;
|
|
128
|
-
}> & Readonly<{
|
|
129
|
-
"onUpdate:selectedExample"?: ((value: string) => any) | undefined;
|
|
130
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
131
|
-
header: () => unknown;
|
|
132
|
-
footer: ({ exampleName }: {
|
|
133
|
-
exampleName: string;
|
|
134
|
-
}) => unknown;
|
|
135
|
-
}>;
|
|
136
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
137
|
-
new (): {
|
|
138
|
-
$slots: S;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=OperationCodeSample.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OperationCodeSample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"names":[],"mappings":"AA2gBA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAiBrE,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,yCAAyC,CAAA;AAMhD,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IACpC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACpC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;OAEG;IACH,eAAe,EAAE,0BAA0B,EAAE,CAAA;IAC7C;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B;;;OAGG;IACH,+BAA+B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACzD,CAAA;AAED;;;;;;;;GAQG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAyMlB,8DAA8D;sBAC1C,MAAM;;;;IAD1B,8DAA8D;sBAC1C,MAAM;;;;YArLhB,MAAM,OAAO;YACb,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO;EA6jB3D,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
-
import OperationCodeSample_vue_vue_type_script_setup_true_lang_default from "./OperationCodeSample.vue.script.js";
|
|
3
|
-
/* empty css */
|
|
4
|
-
//#region src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue
|
|
5
|
-
var OperationCodeSample_default = /* @__PURE__ */ _plugin_vue_export_helper_default(OperationCodeSample_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-70ede25b"]]);
|
|
6
|
-
//#endregion
|
|
7
|
-
export { OperationCodeSample_default as default };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=OperationCodeSample.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OperationCodeSample.vue.js","names":[],"sources":["../../../../../src/v2/blocks/operation-code-sample/components/OperationCodeSample.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type OperationCodeSampleProps = {\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: HttpMethodType\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event scalar-update-selected-example - removed for now, we can bring it back when we need it\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { operationToHar } from '@v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har'\nimport {\n computed,\n onBeforeMount,\n ref,\n useId,\n watch,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport HttpMethod from '@/v2/blocks/operation-code-sample/components/HttpMethod.vue'\nimport { filterClientsByQuery } from '@/v2/blocks/operation-code-sample/helpers/filter-clients-by-query'\nimport { findClient } from '@/v2/blocks/operation-code-sample/helpers/find-client'\nimport { getClients } from '@/v2/blocks/operation-code-sample/helpers/get-clients'\nimport { getCustomCodeSamples } from '@/v2/blocks/operation-code-sample/helpers/get-custom-code-samples'\nimport { getSecrets } from '@/v2/blocks/operation-code-sample/helpers/get-secrets'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '@/v2/blocks/operation-code-sample/types'\n\nimport { generateCodeSnippet } from '../helpers/generate-code-snippet'\nimport ExamplePicker from './ExamplePicker.vue'\n\nconst {\n integration,\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n requestBodyCompositionSelection,\n} = defineProps<OperationCodeSampleProps>()\n\ndefineSlots<{\n header: () => unknown\n footer: ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Grab the examples for the given content type */\nconst requestBodyExamples = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n if (!contentType) return {}\n\n const examples = content[contentType]?.examples ?? {}\n\n return examples\n})\n\n/** The currently selected example key with v-model support */\nconst selectedExampleKey = defineModel<string>('selectedExample', {\n default: '',\n})\n\n// Set default value to the first example\nonBeforeMount(() => {\n selectedExampleKey.value ||= Object.keys(requestBodyExamples.value)[0] ?? ''\n})\n\n/** Reset the selected example key if the content type changes and the new content type doesn't have the previously selected example */\nwatch(\n () => selectedContentType,\n () => {\n if (\n !Object.keys(requestBodyExamples.value).includes(selectedExampleKey.value)\n ) {\n selectedExampleKey.value = Object.keys(requestBodyExamples.value)[0] ?? ''\n }\n },\n)\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n const client = findClient(clients.value, newClient)\n if (client) {\n localSelectedClient.value = client\n }\n})\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation,\n method,\n path,\n example: selectedExampleKey.value,\n requestBodyCompositionSelection,\n defaultDisabledParameters: false,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedCode = computed<string>(() => {\n if (isWebhook) {\n return webhookHar.value?.postData?.text ?? ''\n }\n\n return generateCodeSnippet({\n defaultDisabledParameters: false,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: selectedExampleKey.value,\n globalCookies,\n requestBodyCompositionSelection,\n })\n})\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() => getSecrets(securitySchemes))\n\n/** Grab the ref to freeze the ui as the clients change so there's no jump as the size of the dom changes */\nconst elem = ref<ComponentPublicInstance | null>(null)\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"generatedCode\"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <ScalarIconCaretDown\n class=\"ui-open:rotate-180 mt-px size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <div\n :id=\"`${id}-example`\"\n class=\"code-snippet\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"bg-b-2 h-full\"\n :content=\"generatedCode\"\n :hideCredentials=\"secretCredentials\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <ScalarVirtualText\n v-else\n containerClass=\"custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n :text=\"generatedCode\" />\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"Object.keys(requestBodyExamples).length > 1 || $slots.footer\"\n class=\"request-card-footer bg-b-3\">\n <!-- Example picker -->\n <div\n v-if=\"Object.keys(requestBodyExamples).length > 1\"\n class=\"request-card-footer-addon\">\n <template v-if=\"Object.keys(requestBodyExamples).length\">\n <ExamplePicker\n v-model=\"selectedExampleKey\"\n :examples=\"requestBodyExamples\" />\n </template>\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"selectedExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <ScalarCardSection class=\"request-card-simple\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <slot\n :exampleName=\"selectedExampleKey\"\n name=\"footer\" />\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n text-transform: uppercase;\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1;\n min-width: 0;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n.request-card-simple {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":""}
|