@scalar/api-client 3.22.0 → 3.23.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 (121) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/hooks/use-file-dialog.js +1 -1
  3. package/dist/hooks/use-file-dialog.js.map +1 -1
  4. package/dist/style.css +64 -50
  5. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.d.ts +3 -3
  6. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.js +4 -4
  8. package/dist/v2/blocks/operation-block/helpers/persist-response-cookies.js.map +1 -1
  9. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js.map +1 -1
  11. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  12. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  13. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  14. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +13 -8
  15. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  16. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  17. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  18. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  19. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +3 -1
  20. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  21. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js.map +1 -1
  22. package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.script.js.map +1 -1
  23. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +12 -0
  24. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  26. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +132 -32
  27. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  28. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +3 -1
  29. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  31. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  32. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +13 -2
  33. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  34. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +3 -1
  35. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  36. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  37. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +6 -2
  38. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  39. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
  40. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +10 -3
  41. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js.map +1 -1
  42. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
  43. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +10 -1
  44. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
  45. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +1 -1
  46. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  48. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  49. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +55 -16
  50. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  51. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +3 -3
  52. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  53. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js.map +1 -1
  54. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js +20 -7
  55. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js.map +1 -1
  56. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  57. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  58. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +32 -27
  59. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  60. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
  61. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +2 -1
  62. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  63. package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
  64. package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
  65. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +4 -1
  66. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  67. package/dist/v2/components/code-input/code-variable-widget.js +1 -1
  68. package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
  69. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -1
  70. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  71. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  72. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  73. package/dist/v2/components/data-table/DataTableInput.vue.script.js +46 -15
  74. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  75. package/dist/v2/constants.js +1 -1
  76. package/dist/v2/features/localization/index.d.ts.map +1 -1
  77. package/dist/v2/features/localization/index.js +2 -0
  78. package/dist/v2/features/localization/index.js.map +1 -1
  79. package/dist/v2/features/localization/locales/ar.d.ts +3 -0
  80. package/dist/v2/features/localization/locales/ar.d.ts.map +1 -1
  81. package/dist/v2/features/localization/locales/ar.js +3 -0
  82. package/dist/v2/features/localization/locales/ar.js.map +1 -1
  83. package/dist/v2/features/localization/locales/de.d.ts +3 -0
  84. package/dist/v2/features/localization/locales/de.d.ts.map +1 -1
  85. package/dist/v2/features/localization/locales/de.js +3 -0
  86. package/dist/v2/features/localization/locales/de.js.map +1 -1
  87. package/dist/v2/features/localization/locales/es.d.ts +3 -0
  88. package/dist/v2/features/localization/locales/es.d.ts.map +1 -1
  89. package/dist/v2/features/localization/locales/es.js +3 -0
  90. package/dist/v2/features/localization/locales/es.js.map +1 -1
  91. package/dist/v2/features/localization/locales/fr.d.ts +3 -0
  92. package/dist/v2/features/localization/locales/fr.d.ts.map +1 -1
  93. package/dist/v2/features/localization/locales/fr.js +3 -0
  94. package/dist/v2/features/localization/locales/fr.js.map +1 -1
  95. package/dist/v2/features/localization/locales/pt.d.ts +3 -0
  96. package/dist/v2/features/localization/locales/pt.d.ts.map +1 -1
  97. package/dist/v2/features/localization/locales/pt.js +3 -0
  98. package/dist/v2/features/localization/locales/pt.js.map +1 -1
  99. package/dist/v2/features/localization/locales/ru.d.ts +3 -0
  100. package/dist/v2/features/localization/locales/ru.d.ts.map +1 -1
  101. package/dist/v2/features/localization/locales/ru.js +3 -0
  102. package/dist/v2/features/localization/locales/ru.js.map +1 -1
  103. package/dist/v2/features/localization/locales/zh-cn.d.ts +3 -0
  104. package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -1
  105. package/dist/v2/features/localization/locales/zh-cn.js +3 -0
  106. package/dist/v2/features/localization/locales/zh-cn.js.map +1 -1
  107. package/dist/v2/features/localization/locales/zh-tw.d.ts +398 -0
  108. package/dist/v2/features/localization/locales/zh-tw.d.ts.map +1 -0
  109. package/dist/v2/features/localization/locales/zh-tw.js +360 -0
  110. package/dist/v2/features/localization/locales/zh-tw.js.map +1 -0
  111. package/dist/v2/features/localization/translations.d.ts +3 -0
  112. package/dist/v2/features/localization/translations.d.ts.map +1 -1
  113. package/dist/v2/features/localization/translations.js +3 -0
  114. package/dist/v2/features/localization/translations.js.map +1 -1
  115. package/dist/v2/features/modal/index.d.ts +1 -1
  116. package/dist/v2/features/modal/index.d.ts.map +1 -1
  117. package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
  118. package/dist/v2/helpers/handle-hotkeys.js +4 -1
  119. package/dist/v2/helpers/handle-hotkeys.js.map +1 -1
  120. package/dist/vue-styles.css +15 -15
  121. package/package.json +13 -13
@@ -20,11 +20,12 @@ import { useToasts } from "@scalar/use-toasts";
20
20
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
21
21
  import { ScalarMarkdownSummary } from "@scalar/components/markdown";
22
22
  import { useLoadingState } from "@scalar/components/loading";
23
+ import { canResetSecretField } from "@scalar/workspace-store/helpers/auth-secret-fields";
23
24
  import { getDocumentTypeLabel } from "@scalar/workspace-store/schemas/type-guards";
24
25
  //#region src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue?vue&type=script&setup=true&lang.ts
25
26
  var _hoisted_1 = { class: "bg-b-1 min-w-0 flex-1 px-3 py-1.25" };
26
27
  var _hoisted_2 = { class: "text-c-1 leading-5.5 font-medium" };
27
- var _hoisted_3 = { class: "flex h-8 items-center gap-2 border-t pl-3 text-base" };
28
+ var _hoisted_3 = { class: "flex h-8 items-center gap-2 border-t pr-1 pl-3 text-base" };
28
29
  var _hoisted_4 = { class: "text-c-1 mr-auto" };
29
30
  var _hoisted_5 = { class: "flex min-h-8 border-t text-base" };
30
31
  var _hoisted_6 = { class: "flex h-8 max-w-full gap-2.5 overflow-x-auto px-3" };
@@ -236,7 +237,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
236
237
  /** Refreshes the OAuth2 token and rewrites it onto the bearer scheme. */
237
238
  const handleAcquisitionRefresh = async (bearerName) => {
238
239
  const target = oauth2Target.value;
239
- if (!target || target.flowType !== "authorizationCode" || acquisitionLoader.isLoading) return;
240
+ if (target?.flowType !== "authorizationCode" || acquisitionLoader.isLoading) return;
240
241
  acquisitionLoader.start();
241
242
  const [error, tokens] = await refreshOauth2Token(target.flows, target.flowType, __props.proxyUrl, __props.server, getEnvironmentVariables(__props.environment), __props.options?.customFetch);
242
243
  await acquisitionLoader.clear();
@@ -290,7 +291,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
290
291
  }, 1024)) : createCommentVNode("", true),
291
292
  scheme?.type === "http" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [scheme.scheme === "bearer" ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 0 }, {
292
293
  default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
293
- canReset: "",
294
+ canReset: unref(canResetSecretField)(scheme, "x-scalar-secret-token", scheme["x-scalar-secret-token"]),
294
295
  containerClass: getStaticBorderClass(),
295
296
  environment: __props.environment,
296
297
  modelValue: scheme["x-scalar-secret-token"],
@@ -305,6 +306,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
305
306
  default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.bearerToken")), 1)]),
306
307
  _: 1
307
308
  }, 8, [
309
+ "canReset",
308
310
  "containerClass",
309
311
  "environment",
310
312
  "modelValue",
@@ -316,17 +318,16 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
316
318
  }, 1024)) : createCommentVNode("", true), scheme.scheme === "bearer" && oauth2Target.value ? (openBlock(), createBlock(unref(DataTableRow_default), { key: 1 }, {
317
319
  default: withCtx(() => [createElementVNode("div", _hoisted_3, [
318
320
  createElementVNode("span", _hoisted_4, toDisplayString(unref(translate)("apiClient.requestAuthTab.getAToken")), 1),
319
- createVNode(unref(ScalarButton), {
320
- class: "text-c-1 px-3 py-1",
321
- loader: unref(acquisitionLoader),
322
- size: "sm",
323
- type: "button",
324
- variant: "gradient",
325
- onClick: ($event) => handleAcquisitionAuthorize(name)
326
- }, {
327
- default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.authorizeVia", { name: oauth2Target.value.name })), 1)]),
328
- _: 2
329
- }, 1032, ["loader", "onClick"]),
321
+ createVNode(unref(ScalarIconButton), {
322
+ class: "h-6 w-6 p-1.25",
323
+ icon: unref(ScalarIconGear),
324
+ label: unref(translate)("apiClient.requestAuthTab.configure", { name: oauth2Target.value.name }),
325
+ onClick: ($event) => openAcquisitionConfig(name)
326
+ }, null, 8, [
327
+ "icon",
328
+ "label",
329
+ "onClick"
330
+ ]),
330
331
  scheme["x-scalar-secret-token"] && oauth2Target.value.flowType === "authorizationCode" ? (openBlock(), createBlock(unref(ScalarButton), {
331
332
  key: 0,
332
333
  class: "px-3 py-1",
@@ -339,21 +340,22 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
339
340
  default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.refresh")), 1)]),
340
341
  _: 1
341
342
  }, 8, ["disabled", "onClick"])) : createCommentVNode("", true),
342
- createVNode(unref(ScalarIconButton), {
343
- class: "mr-1.25 h-6 w-6 p-1.25",
344
- icon: unref(ScalarIconGear),
345
- label: unref(translate)("apiClient.requestAuthTab.configure", { name: oauth2Target.value.name }),
346
- onClick: ($event) => openAcquisitionConfig(name)
347
- }, null, 8, [
348
- "icon",
349
- "label",
350
- "onClick"
351
- ])
343
+ createVNode(unref(ScalarButton), {
344
+ class: "text-c-1 px-3 py-1",
345
+ loader: unref(acquisitionLoader),
346
+ size: "sm",
347
+ type: "button",
348
+ variant: "gradient",
349
+ onClick: ($event) => handleAcquisitionAuthorize(name)
350
+ }, {
351
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.authorizeVia", { name: oauth2Target.value.name })), 1)]),
352
+ _: 2
353
+ }, 1032, ["loader", "onClick"])
352
354
  ])]),
353
355
  _: 2
354
356
  }, 1024)) : scheme?.scheme === "basic" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createVNode(unref(DataTableRow_default), null, {
355
357
  default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
356
- canReset: "",
358
+ canReset: unref(canResetSecretField)(scheme, "x-scalar-secret-username", scheme["x-scalar-secret-username"]),
357
359
  class: "text-c-2",
358
360
  environment: __props.environment,
359
361
  modelValue: scheme["x-scalar-secret-username"],
@@ -368,6 +370,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
368
370
  default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.username")), 1)]),
369
371
  _: 1
370
372
  }, 8, [
373
+ "canReset",
371
374
  "environment",
372
375
  "modelValue",
373
376
  "onReset",
@@ -376,7 +379,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
376
379
  _: 2
377
380
  }, 1024), createVNode(unref(DataTableRow_default), null, {
378
381
  default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
379
- canReset: "",
382
+ canReset: unref(canResetSecretField)(scheme, "x-scalar-secret-password", scheme["x-scalar-secret-password"]),
380
383
  environment: __props.environment,
381
384
  modelValue: scheme["x-scalar-secret-password"],
382
385
  placeholder: "********",
@@ -390,6 +393,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
390
393
  default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.password")), 1)]),
391
394
  _: 1
392
395
  }, 8, [
396
+ "canReset",
393
397
  "environment",
394
398
  "modelValue",
395
399
  "onReset",
@@ -415,7 +419,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
415
419
  _: 2
416
420
  }, 1024)) : createCommentVNode("", true), createVNode(unref(DataTableRow_default), null, {
417
421
  default: withCtx(() => [createVNode(RequestAuthDataTableInput_default, {
418
- canReset: "",
422
+ canReset: unref(canResetSecretField)(scheme, "x-scalar-secret-token", scheme["x-scalar-secret-token"]),
419
423
  containerClass: apiKeyHasName(scheme) ? void 0 : getStaticBorderClass(),
420
424
  environment: __props.environment,
421
425
  modelValue: scheme["x-scalar-secret-token"],
@@ -430,6 +434,7 @@ var RequestAuthTab_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
430
434
  default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.requestAuthTab.value")), 1)]),
431
435
  _: 1
432
436
  }, 8, [
437
+ "canReset",
433
438
  "containerClass",
434
439
  "environment",
435
440
  "modelValue",
@@ -1 +1 @@
1
- {"version":3,"file":"RequestAuthTab.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { ScalarMarkdownSummary } from '@scalar/components/markdown'\nimport { ScalarModal, useModal } from '@scalar/components/modal'\nimport { ScalarIconGear } from '@scalar/icons'\nimport { useToasts } from '@scalar/use-toasts'\nimport type {\n SecretsApiKey,\n SecretsHttp,\n} from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getEnvironmentVariables,\n type MergedSecuritySchemes,\n type OAuthFlowsObjectSecret,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { getDocumentTypeLabel } from '@scalar/workspace-store/schemas/type-guards'\nimport type {\n ApiKeyObject,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { capitalize, computed, ref } from 'vue'\n\nimport { refreshOauth2Token } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport { getVisibleOrderedFlowKeys } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth-flows'\nimport {\n runOAuth2Authorize,\n storeOAuth2Tokens,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize'\nimport { getOauth2AcquisitionTarget } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport {\n DataTable,\n DataTableCell,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport OAuth2, { type OAuth2Options } from './OAuth2.vue'\nimport OAuth2Metadata from './OAuth2Metadata.vue'\nimport OpenIDConnect from './OpenIDConnect.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n isStatic,\n proxyUrl,\n selectedSecuritySchemas,\n securitySchemes,\n server,\n eventBus,\n options,\n documentType = 'openapi',\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Controls the display of certain borders which are used when we are non-collapsible */\n isStatic: boolean\n /** Proxy URL */\n proxyUrl: string\n /** Selected security schemes*/\n selectedSecuritySchemas: SecurityRequirementObject\n /** Merged security schemes from the document and the config together with the auth store secrets */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n ): void\n (e: 'upsert:scope', payload: ApiReferenceEvents['auth:upsert:scopes']): void\n (e: 'delete:scope', payload: ApiReferenceEvents['auth:delete:scopes']): void\n}>()\n\nconst { translate } = useLocalization()\n\ntype SecurityItem = {\n scheme: SecuritySchemeObjectSecret | undefined\n name: string\n scopes: string[]\n /** Ordered, non-hidden oauth2/openIdConnect flow keys for this scheme (empty for other types). */\n visibleFlowKeys: (keyof OAuthFlowsObjectSecret)[]\n}\n\n/**\n * Human-readable name of the document type.\n * Used in the missing-type warning so it points at the correct document\n * (e.g. \"AsyncAPI\") instead of always naming OpenAPI.\n */\nconst documentTypeLabel = computed<string>(() =>\n getDocumentTypeLabel(documentType),\n)\n\n/**\n * Resolves security schemes from the OpenAPI document and combines them with their selected scopes.\n * Each item includes the scheme definition, name, and associated scopes.\n */\nconst security = computed<SecurityItem[]>(() =>\n Object.entries(selectedSecuritySchemas).map(([name, scopes = []]) => {\n const scheme = getResolvedRef(securitySchemes[name])\n return {\n scheme,\n name,\n scopes,\n // Compute the visible, ordered flow keys once per scheme so the tabs, the label, and the\n // active-flow tracking all agree on the same set (and we do not filter + sort on every access).\n visibleFlowKeys:\n scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\n ? getVisibleOrderedFlowKeys(scheme.flows)\n : [],\n }\n }),\n)\n\n/** Tracks which OAuth2 flow is currently active when multiple flows are available. */\nconst activeFlow = ref<string>('')\n\n/**\n * Keeps the selected flow in sync with the currently visible flow keys. Validating against the\n * visible set (not every declared flow) means a selection that becomes hidden — e.g. the document\n * is updated to mark the active flow with `x-scalar-ignore` — resets, so the default (first visible)\n * flow activates instead of leaving no tab selected.\n */\nconst selectedFlow = computed<string>(() => {\n const visibleFlowKeys = security.value.flatMap((item) => item.visibleFlowKeys)\n\n return visibleFlowKeys.some((key) => key === activeFlow.value)\n ? activeFlow.value\n : ''\n})\n\nconst setActiveFlow = (flow: string): void => {\n activeFlow.value = flow\n}\n\n/** Determines if multiple auth schemes are configured, which affects the UI layout. */\nconst hasMultipleSchemes = computed<boolean>(() => security.value.length > 1)\n\n/**\n * Generates a human-readable label for the security scheme.\n * Intentionally omits the description here — it is rendered separately as\n * rich text via ScalarMarkdownSummary so markdown formatting is preserved.\n */\nconst generateLabel = (\n name: string,\n scheme: SecuritySchemeObjectSecret,\n): string => {\n const capitalizedName = capitalize(name)\n\n switch (scheme.type) {\n case 'apiKey':\n return `${capitalizedName}: ${scheme.in}`\n\n case 'openIdConnect':\n case 'oauth2': {\n const firstFlow = getVisibleOrderedFlowKeys(scheme.flows)[0]\n const currentFlow = selectedFlow.value || firstFlow\n if (!currentFlow) {\n return capitalizedName\n }\n return `${capitalizedName}: ${currentFlow}`\n }\n\n case 'http':\n return `${capitalizedName}: ${scheme.scheme}`\n\n default:\n return capitalizedName\n }\n}\n\n/**\n * Whether an API key scheme exposes an editable parameter name.\n *\n * OpenAPI `apiKey` and AsyncAPI `httpApiKey` (normalized to `apiKey`) name a query/header/cookie\n * parameter, so the Name input is shown. AsyncAPI `apiKey` places the key in the broker `user` or\n * `password` slot and has no parameter name, so the Name input is hidden and only the value is asked for.\n */\nconst apiKeyHasName = (scheme: { in?: string }): boolean =>\n scheme.in !== 'user' && scheme.in !== 'password'\n\n/**\n * The scheme's type when it is one we do not render inputs for (a type outside both the OpenAPI\n * and AsyncAPI security scheme unions). Read through a helper so the fallback template branch,\n * where the scheme type is narrowed to `never` after the supported cases, can still surface the type.\n */\nconst getUnsupportedSchemeType = (\n scheme: SecurityItem['scheme'],\n): string | undefined => scheme?.type\n\n/**\n * Determines if an OAuth2 flow tab should be active.\n * The first flow is active by default if no flow is explicitly selected.\n */\nconst isFlowActive = (flowKey: string, index: number): boolean =>\n selectedFlow.value === flowKey || (index === 0 && !selectedFlow.value)\n\n/** Computes the container class for static display mode. */\nconst getStaticBorderClass = (): string | false => isStatic && 'border-t'\n\nconst handleHttpSecretsUpdate = (\n payload: Omit<Partial<SecretsHttp>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'http', ...payload },\n name,\n })\n\nconst handleApiKeySecretsUpdate = (\n payload: Omit<Partial<SecretsApiKey>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\nconst handleApiKeySecuritySchemeUpdate = (\n payload: Omit<Partial<ApiKeyObject>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\n/** Handles scope selection updates for OAuth2 */\nconst handleScopesUpdate = (\n name: string,\n event: { scopes?: string[]; scope?: string; selected?: boolean },\n): void => {\n emits('update:selectedScopes', {\n id: Object.keys(selectedSecuritySchemas),\n name,\n ...event,\n })\n}\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n name: string,\n event: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n): void => {\n emits('upsert:scope', { ...event, name })\n}\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n name: string,\n event: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n): void => {\n emits('delete:scope', { ...event, name })\n}\n\n/**\n * Computes dynamic classes for OAuth2 flow tabs based on active state.\n */\nconst getFlowTabClasses = (flowKey: string, index: number): string => {\n const baseClasses =\n 'floating-bg text-c-3 relative cursor-pointer border-b border-transparent py-1 text-base font-medium'\n const activeClasses = '!text-c-1 !rounded-none border-b !border-current'\n\n return isFlowActive(flowKey, index)\n ? `${baseClasses} ${activeClasses} ${isStatic ? 'opacity-100' : ''}`\n : baseClasses\n}\n\n/**\n * OAuth2 token-acquisition target (an oauth2 scheme with an interactive grant) sourced from\n * the merged schemes. When the active scheme is HTTP bearer, this powers the inline\n * \"Authorize via OAuth2\" shortcut: the flow's bearer token is written onto the bearer scheme,\n * so the panel never switches to oauth2.\n *\n * The shortcut is purely a convenience, so it is offered for any interactive oauth2 scheme —\n * including one that is also independently selectable in the dropdown (e.g. Scalar Galaxy's\n * `oAuth2`). Whether that oauth2 scheme is *hidden* from the dropdown is a separate decision made\n * in the selector; here we only surface the shortcut.\n */\nconst oauth2Target = computed(() => getOauth2AcquisitionTarget(securitySchemes))\n\n/** Resolved oauth2 scheme object, for embedding its config form behind the gear. */\nconst oauth2Scheme = computed(() =>\n oauth2Target.value\n ? getResolvedRef(securitySchemes[oauth2Target.value.name])\n : undefined,\n)\n\nconst acquisitionLoader = useLoadingState()\nconst { toast } = useToasts()\nconst configModal = useModal()\n/** Bearer scheme that opened the config modal, so its Authorize callback targets it. */\nconst configBearerName = ref<string | undefined>()\n\n/** Runs the OAuth2 flow and writes the resulting bearer token onto the bearer scheme. */\nconst handleAcquisitionAuthorize = async (\n bearerName: string,\n): Promise<void> => {\n const target = oauth2Target.value\n if (!target || acquisitionLoader.isLoading) {\n return\n }\n acquisitionLoader.start()\n const [error] = await runOAuth2Authorize({\n eventBus,\n bearerSchemeName: bearerName,\n oauth2Name: target.name,\n flows: target.flows,\n flowType: target.flowType,\n scopes: target.scopes,\n server,\n proxyUrl,\n environment,\n options,\n })\n await acquisitionLoader.clear()\n if (error) {\n toast(\n error?.message ?? translate('apiClient.requestAuthTab.failedToauthorize'),\n 'error',\n )\n }\n}\n\n/** Refreshes the OAuth2 token and rewrites it onto the bearer scheme. */\nconst handleAcquisitionRefresh = async (bearerName: string): Promise<void> => {\n const target = oauth2Target.value\n // Only the authorization-code flow carries a refresh token; implicit can't be refreshed.\n if (\n !target ||\n target.flowType !== 'authorizationCode' ||\n acquisitionLoader.isLoading\n ) {\n return\n }\n acquisitionLoader.start()\n const [error, tokens] = await refreshOauth2Token(\n target.flows,\n target.flowType,\n proxyUrl,\n server,\n getEnvironmentVariables(environment),\n options?.customFetch,\n )\n await acquisitionLoader.clear()\n if (tokens?.accessToken) {\n storeOAuth2Tokens(eventBus, {\n bearerSchemeName: bearerName,\n oauth2Name: target.name,\n flowType: target.flowType,\n tokens,\n })\n } else if (error) {\n toast(\n error?.message ?? translate('apiClient.requestAuthTab.failedToRefresh'),\n 'error',\n )\n }\n}\n\nconst openAcquisitionConfig = (bearerName: string): void => {\n configBearerName.value = bearerName\n configModal.show()\n}\n\n/** Closes the config modal and runs Authorize against the bearer scheme that opened it. */\nconst handleConfigAuthorize = (): void => {\n const bearerName = configBearerName.value\n configModal.hide()\n if (bearerName) {\n void handleAcquisitionAuthorize(bearerName)\n }\n}\n</script>\n<template>\n <template\n v-for=\"{ scheme, name, scopes, visibleFlowKeys } in security\"\n :key=\"name\">\n <!--\n Header row for AND'ed schemes: label (bold) and description (rich text) are\n combined.\n -->\n <DataTableRow v-if=\"hasMultipleSchemes && scheme\">\n <DataTableCell\n :aria-label=\"generateLabel(name, scheme)\"\n class=\"max-h-[auto]\">\n <div class=\"bg-b-1 min-w-0 flex-1 px-3 py-1.25\">\n <p class=\"text-c-1 leading-5.5 font-medium\">\n {{ generateLabel(name, scheme) }}\n </p>\n <ScalarMarkdownSummary\n v-if=\"scheme.description\"\n class=\"auth-description text-c-2 w-full\"\n :value=\"scheme.description\" />\n </div>\n </DataTableCell>\n </DataTableRow>\n\n <!-- Description: shown for single auth schemes with descriptions -->\n <DataTableRow v-if=\"scheme?.description && !hasMultipleSchemes\">\n <DataTableCell\n :aria-label=\"scheme.description\"\n class=\"max-h-[auto]\">\n <ScalarMarkdownSummary\n class=\"auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25\"\n :value=\"scheme.description\" />\n </DataTableCell>\n </DataTableRow>\n\n <!-- HTTP Authentication -->\n <template v-if=\"scheme?.type === 'http'\">\n <!-- Bearer Token -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer'\">\n <RequestAuthDataTableInput\n canReset\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n :placeholder=\"translate('apiClient.requestAuthTab.token')\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-token',\n })\n \"\n @update:modelValue=\"\n (v) => handleHttpSecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.bearerToken') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- OAuth2 token-acquisition shortcut (shown when an interactive oauth2 flow exists) -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer' && oauth2Target\">\n <div class=\"flex h-8 items-center gap-2 border-t pl-3 text-base\">\n <span class=\"text-c-1 mr-auto\">{{\n translate('apiClient.requestAuthTab.getAToken')\n }}</span>\n <ScalarButton\n class=\"text-c-1 px-3 py-1\"\n :loader=\"acquisitionLoader\"\n size=\"sm\"\n type=\"button\"\n variant=\"gradient\"\n @click=\"handleAcquisitionAuthorize(name)\">\n {{\n translate('apiClient.requestAuthTab.authorizeVia', {\n name: oauth2Target.name,\n })\n }}\n </ScalarButton>\n <ScalarButton\n v-if=\"\n scheme['x-scalar-secret-token'] &&\n oauth2Target.flowType === 'authorizationCode'\n \"\n class=\"px-3 py-1\"\n :disabled=\"acquisitionLoader.isLoading\"\n size=\"sm\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"handleAcquisitionRefresh(name)\">\n {{ translate('apiClient.requestAuthTab.refresh') }}\n </ScalarButton>\n <!-- Sized and inset like the password toggle in the row above so the two icons line up -->\n <ScalarIconButton\n class=\"mr-1.25 h-6 w-6 p-1.25\"\n :icon=\"ScalarIconGear\"\n :label=\"\n translate('apiClient.requestAuthTab.configure', {\n name: oauth2Target.name,\n })\n \"\n @click=\"openAcquisitionConfig(name)\" />\n </div>\n </DataTableRow>\n\n <!-- HTTP Basic Authentication -->\n <template v-else-if=\"scheme?.scheme === 'basic'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n canReset\n class=\"text-c-2\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n required\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-username',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-username': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.username') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n canReset\n :environment\n :modelValue=\"scheme['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-password',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-password': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.password') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n </template>\n\n <!-- API Key Authentication -->\n <template v-else-if=\"scheme?.type === 'apiKey'\">\n <DataTableRow v-if=\"apiKeyHasName(scheme)\">\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.name ?? ''\"\n placeholder=\"api-key\"\n @update:modelValue=\"\n (v) => handleApiKeySecuritySchemeUpdate({ name: v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.name') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n canReset\n :containerClass=\"\n apiKeyHasName(scheme) ? undefined : getStaticBorderClass()\n \"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-token',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleApiKeySecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.value') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- OAuth 2.0 / OpenID Connect Authentication -->\n <template\n v-else-if=\"scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\">\n <OAuth2Metadata\n v-if=\"\n scheme.type === 'oauth2' && (!isStatic || scheme.oauth2MetadataUrl)\n \"\n :customFetch=\"options?.customFetch\"\n :environment\n :eventBus\n :name\n :proxyUrl\n :scheme />\n\n <!-- OpenID Connect -->\n <OpenIDConnect\n v-if=\"scheme?.type === 'openIdConnect' && !visibleFlowKeys.length\"\n :customFetch=\"options?.customFetch\"\n :environment\n :eventBus\n :getStaticBorderClass\n :name\n :proxyUrl\n :scheme />\n\n <!-- Flow selector tabs: shown when multiple visible flows are available -->\n <DataTableRow v-if=\"visibleFlowKeys.length > 1\">\n <div class=\"flex min-h-8 border-t text-base\">\n <div class=\"flex h-8 max-w-full gap-2.5 overflow-x-auto px-3\">\n <button\n v-for=\"(key, ind) in visibleFlowKeys\"\n :key=\"key\"\n :class=\"getFlowTabClasses(key, ind)\"\n type=\"button\"\n @click=\"setActiveFlow(key)\">\n <span class=\"relative z-10\">{{ key }}</span>\n </button>\n </div>\n </div>\n </DataTableRow>\n\n <!-- OAuth2 flow configuration -->\n <template\n v-for=\"(key, ind) in visibleFlowKeys\"\n :key=\"key\">\n <OAuth2\n v-if=\"scheme.flows && isFlowActive(key, ind)\"\n :environment\n :eventBus\n :flows=\"scheme.flows\"\n :name\n :options\n :proxyUrl\n :scheme\n :selectedScopes=\"scopes\"\n :server\n :type=\"key\"\n @delete:scope=\"(event) => handleScopeDelete(name, event)\"\n @update:selectedScopes=\"(event) => handleScopesUpdate(name, event)\"\n @upsert:scope=\"(event) => handleScopeUpsert(name, event)\" />\n </template>\n </template>\n\n <!-- Browser WebSocket connections cannot apply these broker credentials. -->\n <div\n v-else-if=\"\n scheme?.type === 'userPassword' ||\n scheme?.type === 'plain' ||\n scheme?.type === 'scramSha256' ||\n scheme?.type === 'scramSha512' ||\n scheme?.type === 'X509' ||\n scheme?.type === 'symmetricEncryption' ||\n scheme?.type === 'asymmetricEncryption' ||\n scheme?.type === 'gssapi'\n \"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{ translate('apiClient.requestAuthTab.unsupportedCredentials') }}\n </div>\n\n <!-- Mutual TLS credentials are chosen during the browser-managed TLS handshake. -->\n <div\n v-else-if=\"scheme?.type === 'mutualTLS'\"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{ translate('apiClient.requestAuthTab.mutualTlsHint') }}\n </div>\n\n <!-- Scheme has a type we do not render inputs for -->\n <div\n v-else-if=\"getUnsupportedSchemeType(scheme)\"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{\n translate('apiClient.requestAuthTab.unsupportedType', {\n type: getUnsupportedSchemeType(scheme) ?? '',\n })\n }}\n </div>\n\n <!-- Scheme is missing type -->\n <div\n v-else\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{\n translate('apiClient.requestAuthTab.missingType', {\n type: documentTypeLabel,\n })\n }}\n </div>\n </template>\n\n <!-- OAuth2 configuration modal (opened from the bearer scheme's gear) -->\n <ScalarModal\n v-if=\"oauth2Target && oauth2Scheme\"\n size=\"sm\"\n :state=\"configModal\"\n :title=\"\n translate('apiClient.requestAuthTab.configure', {\n name: oauth2Target.name,\n })\n \">\n <DataTable\n :columns=\"['']\"\n presentational>\n <OAuth2\n :environment\n :eventBus\n :flows=\"oauth2Target.flows\"\n hideActions\n :name=\"oauth2Target.name\"\n :options\n :proxyUrl\n :scheme=\"oauth2Scheme\"\n :selectedScopes=\"oauth2Target.scopes\"\n :server\n :type=\"oauth2Target.flowType\"\n @delete:scope=\"(event) => handleScopeDelete(oauth2Target!.name, event)\"\n @update:selectedScopes=\"\n (event) => handleScopesUpdate(oauth2Target!.name, event)\n \"\n @upsert:scope=\"\n (event) => handleScopeUpsert(oauth2Target!.name, event)\n \" />\n </DataTable>\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n class=\"p-0 px-2 py-0.5\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"configModal.hide()\">\n {{ translate('apiClient.requestAuthTab.cancel') }}\n </ScalarButton>\n <ScalarButton\n class=\"p-0 px-2 py-0.5\"\n :loader=\"acquisitionLoader\"\n size=\"sm\"\n @click=\"handleConfigAuthorize\">\n {{ translate('apiClient.requestAuthTab.authorize') }}\n </ScalarButton>\n </div>\n </ScalarModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkFA,MAAM,QAAQ;EASd,MAAM,EAAE,cAAc,gBAAgB;EAetC,MAAM,oBAAoB,eACxB,qBAAqB,QAAA,YAAY,CACnC;;;;;EAMA,MAAM,WAAW,eACf,OAAO,QAAQ,QAAA,uBAAuB,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS,CAAC,OAAO;GACnE,MAAM,SAAS,eAAe,QAAA,gBAAgB,KAAK;GACnD,OAAO;IACL;IACA;IACA;IAGA,iBACE,QAAQ,SAAS,YAAY,QAAQ,SAAS,kBAC1C,0BAA0B,OAAO,KAAK,IACtC,CAAC;GACT;EACF,CAAC,CACH;;EAGA,MAAM,aAAa,IAAY,EAAE;;;;;;;EAQjC,MAAM,eAAe,eAAuB;GAG1C,OAFwB,SAAS,MAAM,SAAS,SAAS,KAAK,eAEvD,CAAA,CAAgB,MAAM,QAAQ,QAAQ,WAAW,KAAK,IACzD,WAAW,QACX;EACN,CAAC;EAED,MAAM,iBAAiB,SAAuB;GAC5C,WAAW,QAAQ;EACrB;;EAGA,MAAM,qBAAqB,eAAwB,SAAS,MAAM,SAAS,CAAC;;;;;;EAO5E,MAAM,iBACJ,MACA,WACW;G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;IA9CZ,MAAK;IACJ,OAAO,MAAA,WAAA;IACP,OAAc,MAAA,SAAA,CAAS,CAAA,sCAAA,EAAA,MAAuD,aAAA,MAAa,KAAA,CAAA;;2BA2BhF,CAtBZ,YAsBY,MAAA,iBAAA,GAAA;KArBT,SAAS,CAAA,EAAA;KACV,gBAAA;;4BAmBM,CAlBN,YAkBM,gBAAA;MAjBH,aAAA,QAAA;MACA,UAAA,QAAA;MACA,OAAO,aAAA,MAAa;MACrB,aAAA;MACC,MAAM,aAAA,MAAa;MACnB,SAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAQ,aAAA;MACR,gBAAgB,aAAA,MAAa;MAC7B,QAAA,QAAA;MACA,MAAM,aAAA,MAAa;MACnB,kBAAY,OAAA,OAAA,OAAA,MAAG,UAAU,kBAAkB,aAAA,MAAc,MAAM,KAAK;MACpE,2BAAqB,OAAA,OAAA,OAAA,MAAc,UAAU,mBAAmB,aAAA,MAAc,MAAM,KAAK;MAGzF,kBAAY,OAAA,OAAA,OAAA,MAAc,UAAU,kBAAkB,aAAA,MAAc,MAAM,KAAK;;;;;;;;;;;;;;QAIpF,mBAeM,OAfN,aAeM,CAdJ,YAMe,MAAA,YAAA,GAAA;KALb,OAAM;KACN,MAAK;KACL,SAAQ;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,WAAA,CAAW,CAAC,KAAI;;4BAC0B,CAAA,gBAAA,gBAA/C,MAAA,SAAA,CAAS,CAAA,iCAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;QAEd,YAMe,MAAA,YAAA,GAAA;KALb,OAAM;KACL,QAAQ,MAAA,iBAAA;KACT,MAAK;KACJ,SAAO;;4BAC6C,CAAA,gBAAA,gBAAlD,MAAA,SAAA,CAAS,CAAA,oCAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"RequestAuthTab.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { ScalarMarkdownSummary } from '@scalar/components/markdown'\nimport { ScalarModal, useModal } from '@scalar/components/modal'\nimport { ScalarIconGear } from '@scalar/icons'\nimport { useToasts } from '@scalar/use-toasts'\nimport type {\n SecretsApiKey,\n SecretsHttp,\n} from '@scalar/workspace-store/entities/auth'\nimport type {\n ApiReferenceEvents,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport { canResetSecretField } from '@scalar/workspace-store/helpers/auth-secret-fields'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getEnvironmentVariables,\n type MergedSecuritySchemes,\n type OAuthFlowsObjectSecret,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { getDocumentTypeLabel } from '@scalar/workspace-store/schemas/type-guards'\nimport type {\n ApiKeyObject,\n SecurityRequirementObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { capitalize, computed, ref } from 'vue'\n\nimport { refreshOauth2Token } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth'\nimport { getVisibleOrderedFlowKeys } from '@/v2/blocks/scalar-auth-selector-block/helpers/oauth-flows'\nimport {\n runOAuth2Authorize,\n storeOAuth2Tokens,\n} from '@/v2/blocks/scalar-auth-selector-block/helpers/run-oauth2-authorize'\nimport { getOauth2AcquisitionTarget } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport {\n DataTable,\n DataTableCell,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport OAuth2, { type OAuth2Options } from './OAuth2.vue'\nimport OAuth2Metadata from './OAuth2Metadata.vue'\nimport OpenIDConnect from './OpenIDConnect.vue'\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n isStatic,\n proxyUrl,\n selectedSecuritySchemas,\n securitySchemes,\n server,\n eventBus,\n options,\n documentType = 'openapi',\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Controls the display of certain borders which are used when we are non-collapsible */\n isStatic: boolean\n /** Proxy URL */\n proxyUrl: string\n /** Selected security schemes*/\n selectedSecuritySchemas: SecurityRequirementObject\n /** Merged security schemes from the document and the config together with the auth store secrets */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, used to label the missing-type warning */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n ): void\n (e: 'upsert:scope', payload: ApiReferenceEvents['auth:upsert:scopes']): void\n (e: 'delete:scope', payload: ApiReferenceEvents['auth:delete:scopes']): void\n}>()\n\nconst { translate } = useLocalization()\n\ntype SecurityItem = {\n scheme: SecuritySchemeObjectSecret | undefined\n name: string\n scopes: string[]\n /** Ordered, non-hidden oauth2/openIdConnect flow keys for this scheme (empty for other types). */\n visibleFlowKeys: (keyof OAuthFlowsObjectSecret)[]\n}\n\n/**\n * Human-readable name of the document type.\n * Used in the missing-type warning so it points at the correct document\n * (e.g. \"AsyncAPI\") instead of always naming OpenAPI.\n */\nconst documentTypeLabel = computed<string>(() =>\n getDocumentTypeLabel(documentType),\n)\n\n/**\n * Resolves security schemes from the OpenAPI document and combines them with their selected scopes.\n * Each item includes the scheme definition, name, and associated scopes.\n */\nconst security = computed<SecurityItem[]>(() =>\n Object.entries(selectedSecuritySchemas).map(([name, scopes = []]) => {\n const scheme = getResolvedRef(securitySchemes[name])\n return {\n scheme,\n name,\n scopes,\n // Compute the visible, ordered flow keys once per scheme so the tabs, the label, and the\n // active-flow tracking all agree on the same set (and we do not filter + sort on every access).\n visibleFlowKeys:\n scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\n ? getVisibleOrderedFlowKeys(scheme.flows)\n : [],\n }\n }),\n)\n\n/** Tracks which OAuth2 flow is currently active when multiple flows are available. */\nconst activeFlow = ref<string>('')\n\n/**\n * Keeps the selected flow in sync with the currently visible flow keys. Validating against the\n * visible set (not every declared flow) means a selection that becomes hidden — e.g. the document\n * is updated to mark the active flow with `x-scalar-ignore` — resets, so the default (first visible)\n * flow activates instead of leaving no tab selected.\n */\nconst selectedFlow = computed<string>(() => {\n const visibleFlowKeys = security.value.flatMap((item) => item.visibleFlowKeys)\n\n return visibleFlowKeys.some((key) => key === activeFlow.value)\n ? activeFlow.value\n : ''\n})\n\nconst setActiveFlow = (flow: string): void => {\n activeFlow.value = flow\n}\n\n/** Determines if multiple auth schemes are configured, which affects the UI layout. */\nconst hasMultipleSchemes = computed<boolean>(() => security.value.length > 1)\n\n/**\n * Generates a human-readable label for the security scheme.\n * Intentionally omits the description here — it is rendered separately as\n * rich text via ScalarMarkdownSummary so markdown formatting is preserved.\n */\nconst generateLabel = (\n name: string,\n scheme: SecuritySchemeObjectSecret,\n): string => {\n const capitalizedName = capitalize(name)\n\n switch (scheme.type) {\n case 'apiKey':\n return `${capitalizedName}: ${scheme.in}`\n\n case 'openIdConnect':\n case 'oauth2': {\n const firstFlow = getVisibleOrderedFlowKeys(scheme.flows)[0]\n const currentFlow = selectedFlow.value || firstFlow\n if (!currentFlow) {\n return capitalizedName\n }\n return `${capitalizedName}: ${currentFlow}`\n }\n\n case 'http':\n return `${capitalizedName}: ${scheme.scheme}`\n\n default:\n return capitalizedName\n }\n}\n\n/**\n * Whether an API key scheme exposes an editable parameter name.\n *\n * OpenAPI `apiKey` and AsyncAPI `httpApiKey` (normalized to `apiKey`) name a query/header/cookie\n * parameter, so the Name input is shown. AsyncAPI `apiKey` places the key in the broker `user` or\n * `password` slot and has no parameter name, so the Name input is hidden and only the value is asked for.\n */\nconst apiKeyHasName = (scheme: { in?: string }): boolean =>\n scheme.in !== 'user' && scheme.in !== 'password'\n\n/**\n * The scheme's type when it is one we do not render inputs for (a type outside both the OpenAPI\n * and AsyncAPI security scheme unions). Read through a helper so the fallback template branch,\n * where the scheme type is narrowed to `never` after the supported cases, can still surface the type.\n */\nconst getUnsupportedSchemeType = (\n scheme: SecurityItem['scheme'],\n): string | undefined => scheme?.type\n\n/**\n * Determines if an OAuth2 flow tab should be active.\n * The first flow is active by default if no flow is explicitly selected.\n */\nconst isFlowActive = (flowKey: string, index: number): boolean =>\n selectedFlow.value === flowKey || (index === 0 && !selectedFlow.value)\n\n/** Computes the container class for static display mode. */\nconst getStaticBorderClass = (): string | false => isStatic && 'border-t'\n\nconst handleHttpSecretsUpdate = (\n payload: Omit<Partial<SecretsHttp>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'http', ...payload },\n name,\n })\n\nconst handleApiKeySecretsUpdate = (\n payload: Omit<Partial<SecretsApiKey>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\nconst handleApiKeySecuritySchemeUpdate = (\n payload: Omit<Partial<ApiKeyObject>, 'type'>,\n name: string,\n): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: { type: 'apiKey', ...payload },\n name,\n })\n\n/** Handles scope selection updates for OAuth2 */\nconst handleScopesUpdate = (\n name: string,\n event: { scopes?: string[]; scope?: string; selected?: boolean },\n): void => {\n emits('update:selectedScopes', {\n id: Object.keys(selectedSecuritySchemas),\n name,\n ...event,\n })\n}\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n name: string,\n event: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n): void => {\n emits('upsert:scope', { ...event, name })\n}\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n name: string,\n event: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n): void => {\n emits('delete:scope', { ...event, name })\n}\n\n/**\n * Computes dynamic classes for OAuth2 flow tabs based on active state.\n */\nconst getFlowTabClasses = (flowKey: string, index: number): string => {\n const baseClasses =\n 'floating-bg text-c-3 relative cursor-pointer border-b border-transparent py-1 text-base font-medium'\n const activeClasses = '!text-c-1 !rounded-none border-b !border-current'\n\n return isFlowActive(flowKey, index)\n ? `${baseClasses} ${activeClasses} ${isStatic ? 'opacity-100' : ''}`\n : baseClasses\n}\n\n/**\n * OAuth2 token-acquisition target (an oauth2 scheme with an interactive grant) sourced from\n * the merged schemes. When the active scheme is HTTP bearer, this powers the inline\n * \"Authorize via OAuth2\" shortcut: the flow's bearer token is written onto the bearer scheme,\n * so the panel never switches to oauth2.\n *\n * The shortcut is purely a convenience, so it is offered for any interactive oauth2 scheme —\n * including one that is also independently selectable in the dropdown (e.g. Scalar Galaxy's\n * `oAuth2`). Whether that oauth2 scheme is *hidden* from the dropdown is a separate decision made\n * in the selector; here we only surface the shortcut.\n */\nconst oauth2Target = computed(() => getOauth2AcquisitionTarget(securitySchemes))\n\n/** Resolved oauth2 scheme object, for embedding its config form behind the gear. */\nconst oauth2Scheme = computed(() =>\n oauth2Target.value\n ? getResolvedRef(securitySchemes[oauth2Target.value.name])\n : undefined,\n)\n\nconst acquisitionLoader = useLoadingState()\nconst { toast } = useToasts()\nconst configModal = useModal()\n/** Bearer scheme that opened the config modal, so its Authorize callback targets it. */\nconst configBearerName = ref<string | undefined>()\n\n/** Runs the OAuth2 flow and writes the resulting bearer token onto the bearer scheme. */\nconst handleAcquisitionAuthorize = async (\n bearerName: string,\n): Promise<void> => {\n const target = oauth2Target.value\n if (!target || acquisitionLoader.isLoading) {\n return\n }\n acquisitionLoader.start()\n const [error] = await runOAuth2Authorize({\n eventBus,\n bearerSchemeName: bearerName,\n oauth2Name: target.name,\n flows: target.flows,\n flowType: target.flowType,\n scopes: target.scopes,\n server,\n proxyUrl,\n environment,\n options,\n })\n await acquisitionLoader.clear()\n if (error) {\n toast(\n error?.message ?? translate('apiClient.requestAuthTab.failedToauthorize'),\n 'error',\n )\n }\n}\n\n/** Refreshes the OAuth2 token and rewrites it onto the bearer scheme. */\nconst handleAcquisitionRefresh = async (bearerName: string): Promise<void> => {\n const target = oauth2Target.value\n // Only the authorization-code flow carries a refresh token; implicit can't be refreshed.\n if (target?.flowType !== 'authorizationCode' || acquisitionLoader.isLoading) {\n return\n }\n acquisitionLoader.start()\n const [error, tokens] = await refreshOauth2Token(\n target.flows,\n target.flowType,\n proxyUrl,\n server,\n getEnvironmentVariables(environment),\n options?.customFetch,\n )\n await acquisitionLoader.clear()\n if (tokens?.accessToken) {\n storeOAuth2Tokens(eventBus, {\n bearerSchemeName: bearerName,\n oauth2Name: target.name,\n flowType: target.flowType,\n tokens,\n })\n } else if (error) {\n toast(\n error?.message ?? translate('apiClient.requestAuthTab.failedToRefresh'),\n 'error',\n )\n }\n}\n\nconst openAcquisitionConfig = (bearerName: string): void => {\n configBearerName.value = bearerName\n configModal.show()\n}\n\n/** Closes the config modal and runs Authorize against the bearer scheme that opened it. */\nconst handleConfigAuthorize = (): void => {\n const bearerName = configBearerName.value\n configModal.hide()\n if (bearerName) {\n void handleAcquisitionAuthorize(bearerName)\n }\n}\n</script>\n<template>\n <template\n v-for=\"{ scheme, name, scopes, visibleFlowKeys } in security\"\n :key=\"name\">\n <!--\n Header row for AND'ed schemes: label (bold) and description (rich text) are\n combined.\n -->\n <DataTableRow v-if=\"hasMultipleSchemes && scheme\">\n <DataTableCell\n :aria-label=\"generateLabel(name, scheme)\"\n class=\"max-h-[auto]\">\n <div class=\"bg-b-1 min-w-0 flex-1 px-3 py-1.25\">\n <p class=\"text-c-1 leading-5.5 font-medium\">\n {{ generateLabel(name, scheme) }}\n </p>\n <ScalarMarkdownSummary\n v-if=\"scheme.description\"\n class=\"auth-description text-c-2 w-full\"\n :value=\"scheme.description\" />\n </div>\n </DataTableCell>\n </DataTableRow>\n\n <!-- Description: shown for single auth schemes with descriptions -->\n <DataTableRow v-if=\"scheme?.description && !hasMultipleSchemes\">\n <DataTableCell\n :aria-label=\"scheme.description\"\n class=\"max-h-[auto]\">\n <ScalarMarkdownSummary\n class=\"auth-description bg-b-1 text-c-2 min-w-0 flex-1 px-3 py-1.25\"\n :value=\"scheme.description\" />\n </DataTableCell>\n </DataTableRow>\n\n <!-- HTTP Authentication -->\n <template v-if=\"scheme?.type === 'http'\">\n <!-- Bearer Token -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer'\">\n <RequestAuthDataTableInput\n :canReset=\"\n canResetSecretField(\n scheme,\n 'x-scalar-secret-token',\n scheme['x-scalar-secret-token'],\n )\n \"\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n :placeholder=\"translate('apiClient.requestAuthTab.token')\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-token',\n })\n \"\n @update:modelValue=\"\n (v) => handleHttpSecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.bearerToken') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <!-- OAuth2 token-acquisition shortcut (shown when an interactive oauth2 flow exists) -->\n <DataTableRow v-if=\"scheme.scheme === 'bearer' && oauth2Target\">\n <!--\n Authorize stays rightmost so it never moves: Refresh only appears once there is a token,\n and it slots in between the gear and Authorize instead of pushing Authorize aside.\n -->\n <div class=\"flex h-8 items-center gap-2 border-t pr-1 pl-3 text-base\">\n <span class=\"text-c-1 mr-auto\">{{\n translate('apiClient.requestAuthTab.getAToken')\n }}</span>\n <ScalarIconButton\n class=\"h-6 w-6 p-1.25\"\n :icon=\"ScalarIconGear\"\n :label=\"\n translate('apiClient.requestAuthTab.configure', {\n name: oauth2Target.name,\n })\n \"\n @click=\"openAcquisitionConfig(name)\" />\n <ScalarButton\n v-if=\"\n scheme['x-scalar-secret-token'] &&\n oauth2Target.flowType === 'authorizationCode'\n \"\n class=\"px-3 py-1\"\n :disabled=\"acquisitionLoader.isLoading\"\n size=\"sm\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"handleAcquisitionRefresh(name)\">\n {{ translate('apiClient.requestAuthTab.refresh') }}\n </ScalarButton>\n <ScalarButton\n class=\"text-c-1 px-3 py-1\"\n :loader=\"acquisitionLoader\"\n size=\"sm\"\n type=\"button\"\n variant=\"gradient\"\n @click=\"handleAcquisitionAuthorize(name)\">\n {{\n translate('apiClient.requestAuthTab.authorizeVia', {\n name: oauth2Target.name,\n })\n }}\n </ScalarButton>\n </div>\n </DataTableRow>\n\n <!-- HTTP Basic Authentication -->\n <template v-else-if=\"scheme?.scheme === 'basic'\">\n <DataTableRow>\n <RequestAuthDataTableInput\n :canReset=\"\n canResetSecretField(\n scheme,\n 'x-scalar-secret-username',\n scheme['x-scalar-secret-username'],\n )\n \"\n class=\"text-c-2\"\n :environment\n :modelValue=\"scheme['x-scalar-secret-username']\"\n placeholder=\"janedoe\"\n required\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-username',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-username': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.username') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :canReset=\"\n canResetSecretField(\n scheme,\n 'x-scalar-secret-password',\n scheme['x-scalar-secret-password'],\n )\n \"\n :environment\n :modelValue=\"scheme['x-scalar-secret-password']\"\n placeholder=\"********\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-password',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleHttpSecretsUpdate({ 'x-scalar-secret-password': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.password') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n </template>\n\n <!-- API Key Authentication -->\n <template v-else-if=\"scheme?.type === 'apiKey'\">\n <DataTableRow v-if=\"apiKeyHasName(scheme)\">\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.name ?? ''\"\n placeholder=\"api-key\"\n @update:modelValue=\"\n (v) => handleApiKeySecuritySchemeUpdate({ name: v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.name') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n <DataTableRow>\n <RequestAuthDataTableInput\n :canReset=\"\n canResetSecretField(\n scheme,\n 'x-scalar-secret-token',\n scheme['x-scalar-secret-token'],\n )\n \"\n :containerClass=\"\n apiKeyHasName(scheme) ? undefined : getStaticBorderClass()\n \"\n :environment\n :modelValue=\"scheme['x-scalar-secret-token']\"\n placeholder=\"QUxMIFlPVVIgQkFTRSBBUkUgQkVMT05HIFRPIFVT\"\n type=\"password\"\n @reset=\"\n eventBus.emit('auth:reset:security-scheme-secret', {\n name,\n field: 'x-scalar-secret-token',\n })\n \"\n @update:modelValue=\"\n (v) =>\n handleApiKeySecretsUpdate({ 'x-scalar-secret-token': v }, name)\n \">\n {{ translate('apiClient.requestAuthTab.value') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n </template>\n\n <!-- OAuth 2.0 / OpenID Connect Authentication -->\n <template\n v-else-if=\"scheme?.type === 'oauth2' || scheme?.type === 'openIdConnect'\">\n <OAuth2Metadata\n v-if=\"\n scheme.type === 'oauth2' && (!isStatic || scheme.oauth2MetadataUrl)\n \"\n :customFetch=\"options?.customFetch\"\n :environment\n :eventBus\n :name\n :proxyUrl\n :scheme />\n\n <!-- OpenID Connect -->\n <OpenIDConnect\n v-if=\"scheme?.type === 'openIdConnect' && !visibleFlowKeys.length\"\n :customFetch=\"options?.customFetch\"\n :environment\n :eventBus\n :getStaticBorderClass\n :name\n :proxyUrl\n :scheme />\n\n <!-- Flow selector tabs: shown when multiple visible flows are available -->\n <DataTableRow v-if=\"visibleFlowKeys.length > 1\">\n <div class=\"flex min-h-8 border-t text-base\">\n <div class=\"flex h-8 max-w-full gap-2.5 overflow-x-auto px-3\">\n <button\n v-for=\"(key, ind) in visibleFlowKeys\"\n :key=\"key\"\n :class=\"getFlowTabClasses(key, ind)\"\n type=\"button\"\n @click=\"setActiveFlow(key)\">\n <span class=\"relative z-10\">{{ key }}</span>\n </button>\n </div>\n </div>\n </DataTableRow>\n\n <!-- OAuth2 flow configuration -->\n <template\n v-for=\"(key, ind) in visibleFlowKeys\"\n :key=\"key\">\n <OAuth2\n v-if=\"scheme.flows && isFlowActive(key, ind)\"\n :environment\n :eventBus\n :flows=\"scheme.flows\"\n :name\n :options\n :proxyUrl\n :scheme\n :selectedScopes=\"scopes\"\n :server\n :type=\"key\"\n @delete:scope=\"(event) => handleScopeDelete(name, event)\"\n @update:selectedScopes=\"(event) => handleScopesUpdate(name, event)\"\n @upsert:scope=\"(event) => handleScopeUpsert(name, event)\" />\n </template>\n </template>\n\n <!-- Browser WebSocket connections cannot apply these broker credentials. -->\n <div\n v-else-if=\"\n scheme?.type === 'userPassword' ||\n scheme?.type === 'plain' ||\n scheme?.type === 'scramSha256' ||\n scheme?.type === 'scramSha512' ||\n scheme?.type === 'X509' ||\n scheme?.type === 'symmetricEncryption' ||\n scheme?.type === 'asymmetricEncryption' ||\n scheme?.type === 'gssapi'\n \"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{ translate('apiClient.requestAuthTab.unsupportedCredentials') }}\n </div>\n\n <!-- Mutual TLS credentials are chosen during the browser-managed TLS handshake. -->\n <div\n v-else-if=\"scheme?.type === 'mutualTLS'\"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{ translate('apiClient.requestAuthTab.mutualTlsHint') }}\n </div>\n\n <!-- Scheme has a type we do not render inputs for -->\n <div\n v-else-if=\"getUnsupportedSchemeType(scheme)\"\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{\n translate('apiClient.requestAuthTab.unsupportedType', {\n type: getUnsupportedSchemeType(scheme) ?? '',\n })\n }}\n </div>\n\n <!-- Scheme is missing type -->\n <div\n v-else\n class=\"text-c-3 flex items-center justify-center border-t p-4 px-4 text-center text-xs text-balance\">\n {{\n translate('apiClient.requestAuthTab.missingType', {\n type: documentTypeLabel,\n })\n }}\n </div>\n </template>\n\n <!-- OAuth2 configuration modal (opened from the bearer scheme's gear) -->\n <ScalarModal\n v-if=\"oauth2Target && oauth2Scheme\"\n size=\"sm\"\n :state=\"configModal\"\n :title=\"\n translate('apiClient.requestAuthTab.configure', {\n name: oauth2Target.name,\n })\n \">\n <DataTable\n :columns=\"['']\"\n presentational>\n <OAuth2\n :environment\n :eventBus\n :flows=\"oauth2Target.flows\"\n hideActions\n :name=\"oauth2Target.name\"\n :options\n :proxyUrl\n :scheme=\"oauth2Scheme\"\n :selectedScopes=\"oauth2Target.scopes\"\n :server\n :type=\"oauth2Target.flowType\"\n @delete:scope=\"(event) => handleScopeDelete(oauth2Target!.name, event)\"\n @update:selectedScopes=\"\n (event) => handleScopesUpdate(oauth2Target!.name, event)\n \"\n @upsert:scope=\"\n (event) => handleScopeUpsert(oauth2Target!.name, event)\n \" />\n </DataTable>\n <div class=\"flex h-8 items-center justify-end gap-2 border-t\">\n <ScalarButton\n class=\"p-0 px-2 py-0.5\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"configModal.hide()\">\n {{ translate('apiClient.requestAuthTab.cancel') }}\n </ScalarButton>\n <ScalarButton\n class=\"p-0 px-2 py-0.5\"\n :loader=\"acquisitionLoader\"\n size=\"sm\"\n @click=\"handleConfigAuthorize\">\n {{ translate('apiClient.requestAuthTab.authorize') }}\n </ScalarButton>\n </div>\n </ScalarModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;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,CAlBN,YAkBM,gBAAA;MAjBH,aAAA,QAAA;MACA,UAAA,QAAA;MACA,OAAO,aAAA,MAAa;MACrB,aAAA;MACC,MAAM,aAAA,MAAa;MACnB,SAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAQ,aAAA;MACR,gBAAgB,aAAA,MAAa;MAC7B,QAAA,QAAA;MACA,MAAM,aAAA,MAAa;MACnB,kBAAY,OAAA,OAAA,OAAA,MAAG,UAAU,kBAAkB,aAAA,MAAc,MAAM,KAAK;MACpE,2BAAqB,OAAA,OAAA,OAAA,MAAc,UAAU,mBAAmB,aAAA,MAAc,MAAM,KAAK;MAGzF,kBAAY,OAAA,OAAA,OAAA,MAAc,UAAU,kBAAkB,aAAA,MAAc,MAAM,KAAK;;;;;;;;;;;;;;QAIpF,mBAeM,OAfN,aAeM,CAdJ,YAMe,MAAA,YAAA,GAAA;KALb,OAAM;KACN,MAAK;KACL,SAAQ;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,WAAA,CAAW,CAAC,KAAI;;4BAC0B,CAAA,gBAAA,gBAA/C,MAAA,SAAA,CAAS,CAAA,iCAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;QAEd,YAMe,MAAA,YAAA,GAAA;KALb,OAAM;KACL,QAAQ,MAAA,iBAAA;KACT,MAAK;KACJ,SAAO;;4BAC6C,CAAA,gBAAA,gBAAlD,MAAA,SAAA,CAAS,CAAA,oCAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"openid-discovery-to-flows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAItG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAE9E,qHAAqH;AACrH,eAAO,MAAM,sBAAsB,GAAI,WAAW,sBAAsB,KAAG,oBAiE1E,CAAA"}
1
+ {"version":3,"file":"openid-discovery-to-flows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAItG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAE9E,qHAAqH;AACrH,eAAO,MAAM,sBAAsB,GAAI,WAAW,sBAAsB,KAAG,oBA8D1E,CAAA"}
@@ -7,7 +7,8 @@ var openIDDiscoveryToFlows = (discovery) => {
7
7
  const grantTypes = new Set(discovery.grant_types_supported ?? ["authorization_code", "implicit"]);
8
8
  const authorizationUrl = discovery.authorization_endpoint;
9
9
  const tokenUrl = discovery.token_endpoint;
10
- const usePkce = discovery.code_challenge_methods_supported?.includes("S256") ? "SHA-256" : discovery.code_challenge_methods_supported?.includes("plain") ? "plain" : "no";
10
+ const fallbackPkce = discovery.code_challenge_methods_supported?.includes("plain") ? "plain" : "no";
11
+ const usePkce = discovery.code_challenge_methods_supported?.includes("S256") ? "SHA-256" : fallbackPkce;
11
12
  const flows = {};
12
13
  if (grantTypes.has("urn:ietf:params:oauth:grant-type:device_code") && discovery.device_authorization_endpoint && tokenUrl) flows.deviceAuthorization = {
13
14
  deviceAuthorizationUrl: discovery.device_authorization_endpoint,
@@ -1 +1 @@
1
- {"version":3,"file":"openid-discovery-to-flows.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.ts"],"sourcesContent":["import { OpenIDConnectSchema, type SecretsOpenIdConnect } from '@scalar/workspace-store/entities/auth'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport type { OAuthFlowsObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { OpenIDConnectDiscovery } from './fetch-openid-connect-discovery'\n\n/** Takes in an open ID Connect discovery response and converts it into an oauth flow to be used for authorization */\nexport const openIDDiscoveryToFlows = (discovery: OpenIDConnectDiscovery): SecretsOpenIdConnect => {\n const scopes = Object.fromEntries((discovery.scopes_supported ?? []).map((scope) => [scope, '']))\n const grantTypes = new Set(discovery.grant_types_supported ?? ['authorization_code', 'implicit'])\n const authorizationUrl = discovery.authorization_endpoint\n const tokenUrl = discovery.token_endpoint\n\n const usePkce = discovery.code_challenge_methods_supported?.includes('S256')\n ? 'SHA-256'\n : discovery.code_challenge_methods_supported?.includes('plain')\n ? 'plain'\n : 'no'\n\n const flows: OAuthFlowsObject = {}\n if (\n grantTypes.has('urn:ietf:params:oauth:grant-type:device_code') &&\n discovery.device_authorization_endpoint &&\n tokenUrl\n ) {\n flows.deviceAuthorization = {\n deviceAuthorizationUrl: discovery.device_authorization_endpoint,\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Implicit\n if (grantTypes.has('implicit') && authorizationUrl) {\n flows.implicit = {\n authorizationUrl,\n refreshUrl: authorizationUrl,\n scopes,\n }\n }\n\n // Password\n if (grantTypes.has('password') && tokenUrl) {\n flows.password = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Client Credentials\n if (grantTypes.has('client_credentials') && tokenUrl) {\n flows.clientCredentials = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Authorization Code\n if (grantTypes.has('authorization_code') && authorizationUrl && tokenUrl) {\n flows.authorizationCode = {\n authorizationUrl,\n tokenUrl,\n refreshUrl: tokenUrl,\n 'x-usePkce': usePkce,\n scopes,\n }\n }\n\n return coerceValue(OpenIDConnectSchema, flows)\n}\n"],"mappings":";;;;AAOA,IAAa,0BAA0B,cAA4D;CACjG,MAAM,SAAS,OAAO,aAAa,UAAU,oBAAoB,CAAC,EAAA,CAAG,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;CAChG,MAAM,aAAa,IAAI,IAAI,UAAU,yBAAyB,CAAC,sBAAsB,UAAU,CAAC;CAChG,MAAM,mBAAmB,UAAU;CACnC,MAAM,WAAW,UAAU;CAE3B,MAAM,UAAU,UAAU,kCAAkC,SAAS,MAAM,IACvE,YACA,UAAU,kCAAkC,SAAS,OAAO,IAC1D,UACA;CAEN,MAAM,QAA0B,CAAC;CACjC,IACE,WAAW,IAAI,8CAA8C,KAC7D,UAAU,iCACV,UAEA,MAAM,sBAAsB;EAC1B,wBAAwB,UAAU;EAClC;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,UAAU,KAAK,kBAChC,MAAM,WAAW;EACf;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,UAAU,KAAK,UAChC,MAAM,WAAW;EACf;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,oBAAoB,KAAK,UAC1C,MAAM,oBAAoB;EACxB;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,oBAAoB,KAAK,oBAAoB,UAC9D,MAAM,oBAAoB;EACxB;EACA;EACA,YAAY;EACZ,aAAa;EACb;CACF;CAGF,OAAO,YAAY,qBAAqB,KAAK;AAC/C"}
1
+ {"version":3,"file":"openid-discovery-to-flows.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.ts"],"sourcesContent":["import { OpenIDConnectSchema, type SecretsOpenIdConnect } from '@scalar/workspace-store/entities/auth'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\nimport type { OAuthFlowsObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { OpenIDConnectDiscovery } from './fetch-openid-connect-discovery'\n\n/** Takes in an open ID Connect discovery response and converts it into an oauth flow to be used for authorization */\nexport const openIDDiscoveryToFlows = (discovery: OpenIDConnectDiscovery): SecretsOpenIdConnect => {\n const scopes = Object.fromEntries((discovery.scopes_supported ?? []).map((scope) => [scope, '']))\n const grantTypes = new Set(discovery.grant_types_supported ?? ['authorization_code', 'implicit'])\n const authorizationUrl = discovery.authorization_endpoint\n const tokenUrl = discovery.token_endpoint\n\n const fallbackPkce = discovery.code_challenge_methods_supported?.includes('plain') ? 'plain' : 'no'\n const usePkce = discovery.code_challenge_methods_supported?.includes('S256') ? 'SHA-256' : fallbackPkce\n\n const flows: OAuthFlowsObject = {}\n if (\n grantTypes.has('urn:ietf:params:oauth:grant-type:device_code') &&\n discovery.device_authorization_endpoint &&\n tokenUrl\n ) {\n flows.deviceAuthorization = {\n deviceAuthorizationUrl: discovery.device_authorization_endpoint,\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Implicit\n if (grantTypes.has('implicit') && authorizationUrl) {\n flows.implicit = {\n authorizationUrl,\n refreshUrl: authorizationUrl,\n scopes,\n }\n }\n\n // Password\n if (grantTypes.has('password') && tokenUrl) {\n flows.password = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Client Credentials\n if (grantTypes.has('client_credentials') && tokenUrl) {\n flows.clientCredentials = {\n tokenUrl,\n refreshUrl: tokenUrl,\n scopes,\n }\n }\n\n // Authorization Code\n if (grantTypes.has('authorization_code') && authorizationUrl && tokenUrl) {\n flows.authorizationCode = {\n authorizationUrl,\n tokenUrl,\n refreshUrl: tokenUrl,\n 'x-usePkce': usePkce,\n scopes,\n }\n }\n\n return coerceValue(OpenIDConnectSchema, flows)\n}\n"],"mappings":";;;;AAOA,IAAa,0BAA0B,cAA4D;CACjG,MAAM,SAAS,OAAO,aAAa,UAAU,oBAAoB,CAAC,EAAA,CAAG,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;CAChG,MAAM,aAAa,IAAI,IAAI,UAAU,yBAAyB,CAAC,sBAAsB,UAAU,CAAC;CAChG,MAAM,mBAAmB,UAAU;CACnC,MAAM,WAAW,UAAU;CAE3B,MAAM,eAAe,UAAU,kCAAkC,SAAS,OAAO,IAAI,UAAU;CAC/F,MAAM,UAAU,UAAU,kCAAkC,SAAS,MAAM,IAAI,YAAY;CAE3F,MAAM,QAA0B,CAAC;CACjC,IACE,WAAW,IAAI,8CAA8C,KAC7D,UAAU,iCACV,UAEA,MAAM,sBAAsB;EAC1B,wBAAwB,UAAU;EAClC;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,UAAU,KAAK,kBAChC,MAAM,WAAW;EACf;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,UAAU,KAAK,UAChC,MAAM,WAAW;EACf;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,oBAAoB,KAAK,UAC1C,MAAM,oBAAoB;EACxB;EACA,YAAY;EACZ;CACF;CAIF,IAAI,WAAW,IAAI,oBAAoB,KAAK,oBAAoB,UAC9D,MAAM,oBAAoB;EACxB;EACA;EACA,YAAY;EACZ,aAAa;EACb;CACF;CAGF,OAAO,YAAY,qBAAqB,KAAK;AAC/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"names":[],"mappings":"AA2GA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,KAAK,WAAW,GAAG;IACjB,uEAAuE;IACvE,OAAO,EAAE,WAAW,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAA;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAA;CACjD,CAAC;AAmEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"PillTooltipHost.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"names":[],"mappings":"AA4GA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,KAAK,WAAW,GAAG;IACjB,uEAAuE;IACvE,OAAO,EAAE,WAAW,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAA;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAA;CACjD,CAAC;AAoEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment'\n ? props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PillTooltipHost.vue.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() => {\n if (props.context.type !== 'environment') {\n return ''\n }\n return props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n})\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":""}
@@ -35,7 +35,10 @@ var PillTooltipHost_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
35
35
  render(h("div", { class: "flex flex-col gap-1.5 text-left" }, [h("span", {}, props.context.details), h("div", { class: "text-[color:var(--scalar-color-3)] text-[10px] font-normal" }, translate("apiClient.pillTooltipHost.computedAtExecution"))]), el);
36
36
  return el.innerHTML;
37
37
  });
38
- const environmentTooltipText = computed(() => props.context.type === "environment" ? props.context.isDefined ? props.context.value : translate("apiClient.pillTooltipHost.noValue") : "");
38
+ const environmentTooltipText = computed(() => {
39
+ if (props.context.type !== "environment") return "";
40
+ return props.context.isDefined ? props.context.value : translate("apiClient.pillTooltipHost.noValue");
41
+ });
39
42
  const targetRef = ref(props.target);
40
43
  useTooltip({
41
44
  content: isContextFn ? contextTooltipHtml : environmentTooltipText,
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.script.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment'\n ? props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,QAAQ;EASd,MAAM,EAAE,WAAW,sBAAsB,gBAAgB;EAIzD,MAAM,YAAY,MAAM,aAAa;EAErC,MAAM,cAAc,MAAM,QAAQ,SAAS;;EAG3C,MAAM,qBAAqB,eAAe;GACxC,IACE,CAAC,eACD,OAAO,aAAa,eACpB,MAAM,QAAQ,SAAS,mBAEvB,OAAO;GAET,MAAM,KAAK,SAAS,cAAc,KAAK;GACvC,OACE,EAAE,OAAO,EAAE,OAAO,kCAAkC,GAAG,CACrD,EAAE,QAAQ,CAAC,GAAG,MAAM,QAAQ,OAAO,GACnC,EACE,OACA,EAAE,OAAO,6DAA6D,GACtE,UAAU,+CAA+C,CAC3D,CACF,CAAC,GACD,EACF;GACA,OAAO,GAAG;EACZ,CAAC;EAED,MAAM,yBAAyB,eAC7B,MAAM,QAAQ,SAAS,gBACnB,MAAM,QAAQ,YACZ,MAAM,QAAQ,QACd,UAAU,mCAAmC,IAC/C,EACN;EAEA,MAAM,YAAY,IAAiB,MAAM,MAAM;EAE/C,WAAW;GACT,SAAS,cAAc,qBAAqB;GAC5C,eAAe,cAAc,cAAc;GAC3C,OAAO;GACP,WAAW;GACX,QAAQ;GACR;EACF,CAAC"}
1
+ {"version":3,"file":"PillTooltipHost.vue.script.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() => {\n if (props.context.type !== 'environment') {\n return ''\n }\n return props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n})\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,QAAQ;EASd,MAAM,EAAE,WAAW,sBAAsB,gBAAgB;EAIzD,MAAM,YAAY,MAAM,aAAa;EAErC,MAAM,cAAc,MAAM,QAAQ,SAAS;;EAG3C,MAAM,qBAAqB,eAAe;GACxC,IACE,CAAC,eACD,OAAO,aAAa,eACpB,MAAM,QAAQ,SAAS,mBAEvB,OAAO;GAET,MAAM,KAAK,SAAS,cAAc,KAAK;GACvC,OACE,EAAE,OAAO,EAAE,OAAO,kCAAkC,GAAG,CACrD,EAAE,QAAQ,CAAC,GAAG,MAAM,QAAQ,OAAO,GACnC,EACE,OACA,EAAE,OAAO,6DAA6D,GACtE,UAAU,+CAA+C,CAC3D,CACF,CAAC,GACD,EACF;GACA,OAAO,GAAG;EACZ,CAAC;EAED,MAAM,yBAAyB,eAAe;GAC5C,IAAI,MAAM,QAAQ,SAAS,eACzB,OAAO;GAET,OAAO,MAAM,QAAQ,YACjB,MAAM,QAAQ,QACd,UAAU,mCAAmC;EACnD,CAAC;EAED,MAAM,YAAY,IAAiB,MAAM,MAAM;EAE/C,WAAW;GACT,SAAS,cAAc,qBAAqB;GAC5C,eAAe,cAAc,cAAc;GAC3C,OAAO;GACP,WAAW;GACX,QAAQ;GACR;EACF,CAAC"}
@@ -29,7 +29,7 @@ var PillWidget = class PillWidget extends WidgetType {
29
29
  }
30
30
  this.pillColor = environment?.color || "var(--scalar-color-1)";
31
31
  const variable = environment?.variables?.find((v) => v.name === variableName);
32
- const value = variable ? typeof variable.value === "string" ? variable.value : variable.value?.default : void 0;
32
+ const value = typeof variable?.value === "string" ? variable.value : variable?.value?.default;
33
33
  this.variableInfo = {
34
34
  type: "environment",
35
35
  name: variableName,
@@ -1 +1 @@
1
- {"version":3,"file":"code-variable-widget.js","names":[],"sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport type { TranslateFn } from '@scalar/localization'\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n RangeSetBuilder,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n} from '@scalar/use-codemirror'\nimport { type ContextFunctionName, getContextFunctionComment } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { createApp } from 'vue'\n\nimport type { ApiClientTranslationKey } from '@/v2/features/localization'\n\nimport PillTooltipHost from './PillTooltipHost.vue'\nimport type { PillContext } from './pill-context'\n\n/**\n * Displays `{{name}}` as a pill: environment variables show the resolved value;\n * context functions (e.g. `{{$guid}}`) show that the value is generated at send time.\n */\nclass PillWidget extends WidgetType {\n private app: any\n private readonly pillColor: string\n private readonly variableInfo: PillContext\n\n constructor(\n private readonly variableName: string,\n environment: XScalarEnvironment | undefined,\n variant: PillContext['type'],\n private readonly translate?: TranslateFn<ApiClientTranslationKey>,\n ) {\n super()\n if (variant === 'contextFunction') {\n this.pillColor = 'var(--scalar-color-3)'\n this.variableInfo = {\n type: 'contextFunction',\n identifier: variableName,\n details: getContextFunctionComment(variableName as ContextFunctionName),\n }\n return\n }\n\n this.pillColor = environment?.color || 'var(--scalar-color-1)'\n\n const variable = environment?.variables?.find((v) => v.name === variableName)\n const value = variable ? (typeof variable.value === 'string' ? variable.value : variable.value?.default) : undefined\n this.variableInfo = {\n type: 'environment',\n name: variableName,\n value: value || 'No value',\n isDefined: Boolean(value),\n }\n }\n\n toDOM(): HTMLElement {\n const span = document.createElement('span')\n span.className = this.variableInfo.type === 'contextFunction' ? 'cm-pill cm-pill--context-fn' : 'cm-pill'\n span.textContent = this.variableName\n\n span.style.setProperty('--tw-bg-base', this.pillColor)\n\n if (this.variableInfo.type === 'environment') {\n span.style.opacity = this.variableInfo.isDefined ? '1' : '0.5'\n }\n\n // PillTooltipHost is renderless and attaches `useTooltip` listeners to\n // `target` directly — mount onto a throwaway container so the pill DOM\n // we just built is preserved.\n this.app = createApp(PillTooltipHost, {\n context: this.variableInfo,\n target: span,\n translate: this.translate,\n })\n this.app.mount(document.createElement('div'))\n\n return span\n }\n\n override destroy(): void {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n }\n\n override eq(other: WidgetType): boolean {\n if (!(other instanceof PillWidget)) {\n return false\n }\n if (\n other.variableName !== this.variableName ||\n other.pillColor !== this.pillColor ||\n other.variableInfo.type !== this.variableInfo.type\n ) {\n return false\n }\n const a = other.variableInfo\n const b = this.variableInfo\n if (a.type !== b.type) {\n return false\n }\n if (a.type === 'environment' && b.type === 'environment') {\n return a.name === b.name && a.value === b.value && a.isDefined === b.isDefined\n }\n if (a.type === 'contextFunction' && b.type === 'contextFunction') {\n return a.identifier === b.identifier && a.details === b.details\n }\n return false\n }\n\n override ignoreEvent(): boolean {\n return false\n }\n}\n\n/**\n * Styles the active environment variable pill.\n * This plugin creates decorations for environment variables in the editor.\n */\nexport const pillPlugin = (props: {\n environment: XScalarEnvironment | undefined\n isReadOnly: boolean | undefined\n isContextFunctionName?: (name: string) => boolean\n translate?: TranslateFn<ApiClientTranslationKey>\n}) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet\n lastEnvironment: XScalarEnvironment | undefined\n\n constructor(view: EditorView) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(view)\n }\n\n update(update: ViewUpdate): void {\n // Rebuild decorations if environment changed\n if (props.environment !== this.lastEnvironment) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(update.view)\n return\n }\n\n // Only rebuild decorations if document or viewport changed\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view)\n }\n }\n\n buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>()\n const isContextFn = props.isContextFunctionName ?? (() => false)\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to)\n\n // Create a new regex instance to ensure lastIndex is reset\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index\n const end = start + match[0].length\n const variableName = match[1] ?? ''\n\n // Skip decorations that span line breaks as CodeMirror does not allow them\n const matchedText = view.state.doc.sliceString(start, end)\n if (matchedText.includes('\\n')) {\n continue\n }\n\n const variant: PillContext['type'] = isContextFn(variableName) ? 'contextFunction' : 'environment'\n\n builder.add(\n start,\n end,\n Decoration.widget({\n widget: new PillWidget(variableName, props.environment, variant, props.translate),\n side: 1,\n }),\n )\n }\n }\n\n return builder.finish()\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n )\n\n/**\n * Custom backspace handler for the editor.\n * Handles special cases like removing entire variable syntax and clearing all content.\n */\nexport const backspaceCommand = EditorView.domEventHandlers({\n keydown(event, view): boolean {\n if (event.key !== 'Backspace') {\n return false\n }\n\n const { state } = view\n const { from, to } = state.selection.main\n\n // When selecting all content and pressing backspace,\n // prevent breaking line content addition on pill removal\n if (from === 0 && to === state.doc.length) {\n view.dispatch({\n changes: { from: 0, to: state.doc.length },\n selection: { anchor: 0 },\n })\n event.preventDefault()\n return true\n }\n\n // When cursor is after a variable closing bracket (}}),\n // remove the entire closing syntax at once\n if (from === to && from >= 2) {\n const before = state.doc.sliceString(from - 2, from)\n if (before === '}}') {\n view.dispatch({\n changes: { from: from - 2, to: from },\n selection: { anchor: from - 2 },\n })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n})\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,aAAN,MAAM,mBAAmB,WAAW;CAMf;CAGA;CARnB;CACA;CACA;CAEA,YACE,cACA,aACA,SACA,WACA;EACA,MAAM;EALW,KAAA,eAAA;EAGA,KAAA,YAAA;EAGjB,IAAI,YAAY,mBAAmB;GACjC,KAAK,YAAY;GACjB,KAAK,eAAe;IAClB,MAAM;IACN,YAAY;IACZ,SAAS,0BAA0B,YAAmC;GACxE;GACA;EACF;EAEA,KAAK,YAAY,aAAa,SAAS;EAEvC,MAAM,WAAW,aAAa,WAAW,MAAM,MAAM,EAAE,SAAS,YAAY;EAC5E,MAAM,QAAQ,WAAY,OAAO,SAAS,UAAU,WAAW,SAAS,QAAQ,SAAS,OAAO,UAAW,KAAA;EAC3G,KAAK,eAAe;GAClB,MAAM;GACN,MAAM;GACN,OAAO,SAAS;GAChB,WAAW,QAAQ,KAAK;EAC1B;CACF;CAEA,QAAqB;EACnB,MAAM,OAAO,SAAS,cAAc,MAAM;EAC1C,KAAK,YAAY,KAAK,aAAa,SAAS,oBAAoB,gCAAgC;EAChG,KAAK,cAAc,KAAK;EAExB,KAAK,MAAM,YAAY,gBAAgB,KAAK,SAAS;EAErD,IAAI,KAAK,aAAa,SAAS,eAC7B,KAAK,MAAM,UAAU,KAAK,aAAa,YAAY,MAAM;EAM3D,KAAK,MAAM,UAAU,yBAAiB;GACpC,SAAS,KAAK;GACd,QAAQ;GACR,WAAW,KAAK;EAClB,CAAC;EACD,KAAK,IAAI,MAAM,SAAS,cAAc,KAAK,CAAC;EAE5C,OAAO;CACT;CAEA,UAAyB;EACvB,IAAI,KAAK,KAAK;GACZ,KAAK,IAAI,QAAQ;GACjB,KAAK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K,IAAI,OAAO,MAAM;IAC1C,MAAM,QAAQ,OAAO,MAAM;IAC3B,MAAM,MAAM,QAAQ,MAAM,EAAE,CAAC;IAC7B,MAAM,eAAe,MAAM,MAAM;IAIjC,IADoB,KAAK,MAAM,IAAI,YAAY,OAAO,GAClD,CAAA,CAAY,SAAS,IAAI,GAC3B;IAGF,MAAM,UAA+B,YAAY,YAAY,IAAI,oBAAoB;IAErF,QAAQ,IACN,OACA,KACA,WAAW,OAAO;KAChB,QAAQ,IAAI,WAAW,cAAc,MAAM,aAAa,SAAS,MAAM,SAAS;KAChF,MAAM;IACR,CAAC,CACH;GACF;EACF;EAEA,OAAO,QAAQ,OAAO;CACxB;AACF,GACA,EACE,cAAc,MAAM,EAAE,YACxB,CACF;;;;;AAMF,IAAa,mBAAmB,WAAW,iBAAiB,EAC1D,QAAQ,OAAO,MAAe;CAC5B,IAAI,MAAM,QAAQ,aAChB,OAAO;CAGT,MAAM,EAAE,UAAU;CAClB,MAAM,EAAE,MAAM,OAAO,MAAM,UAAU;CAIrC,IAAI,SAAS,KAAK,OAAO,MAAM,IAAI,QAAQ;EACzC,KAAK,SAAS;GACZ,SAAS;IAAE,MAAM;IAAG,IAAI,MAAM,IAAI;GAAO;GACzC,WAAW,EAAE,QAAQ,EAAE;EACzB,CAAC;EACD,MAAM,eAAe;EACrB,OAAO;CACT;CAIA,IAAI,SAAS,MAAM,QAAQ;MACV,MAAM,IAAI,YAAY,OAAO,GAAG,IAC3C,MAAW,MAAM;GACnB,KAAK,SAAS;IACZ,SAAS;KAAE,MAAM,OAAO;KAAG,IAAI;IAAK;IACpC,WAAW,EAAE,QAAQ,OAAO,EAAE;GAChC,CAAC;GACD,MAAM,eAAe;GACrB,OAAO;EACT;;CAGF,OAAO;AACT,EACF,CAAC"}
1
+ {"version":3,"file":"code-variable-widget.js","names":[],"sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport type { TranslateFn } from '@scalar/localization'\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n RangeSetBuilder,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n} from '@scalar/use-codemirror'\nimport { type ContextFunctionName, getContextFunctionComment } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { createApp } from 'vue'\n\nimport type { ApiClientTranslationKey } from '@/v2/features/localization'\n\nimport PillTooltipHost from './PillTooltipHost.vue'\nimport type { PillContext } from './pill-context'\n\n/**\n * Displays `{{name}}` as a pill: environment variables show the resolved value;\n * context functions (e.g. `{{$guid}}`) show that the value is generated at send time.\n */\nclass PillWidget extends WidgetType {\n private app: any\n private readonly pillColor: string\n private readonly variableInfo: PillContext\n\n constructor(\n private readonly variableName: string,\n environment: XScalarEnvironment | undefined,\n variant: PillContext['type'],\n private readonly translate?: TranslateFn<ApiClientTranslationKey>,\n ) {\n super()\n if (variant === 'contextFunction') {\n this.pillColor = 'var(--scalar-color-3)'\n this.variableInfo = {\n type: 'contextFunction',\n identifier: variableName,\n details: getContextFunctionComment(variableName as ContextFunctionName),\n }\n return\n }\n\n this.pillColor = environment?.color || 'var(--scalar-color-1)'\n\n const variable = environment?.variables?.find((v) => v.name === variableName)\n const value = typeof variable?.value === 'string' ? variable.value : variable?.value?.default\n this.variableInfo = {\n type: 'environment',\n name: variableName,\n value: value || 'No value',\n isDefined: Boolean(value),\n }\n }\n\n toDOM(): HTMLElement {\n const span = document.createElement('span')\n span.className = this.variableInfo.type === 'contextFunction' ? 'cm-pill cm-pill--context-fn' : 'cm-pill'\n span.textContent = this.variableName\n\n span.style.setProperty('--tw-bg-base', this.pillColor)\n\n if (this.variableInfo.type === 'environment') {\n span.style.opacity = this.variableInfo.isDefined ? '1' : '0.5'\n }\n\n // PillTooltipHost is renderless and attaches `useTooltip` listeners to\n // `target` directly — mount onto a throwaway container so the pill DOM\n // we just built is preserved.\n this.app = createApp(PillTooltipHost, {\n context: this.variableInfo,\n target: span,\n translate: this.translate,\n })\n this.app.mount(document.createElement('div'))\n\n return span\n }\n\n override destroy(): void {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n }\n\n override eq(other: WidgetType): boolean {\n if (!(other instanceof PillWidget)) {\n return false\n }\n if (\n other.variableName !== this.variableName ||\n other.pillColor !== this.pillColor ||\n other.variableInfo.type !== this.variableInfo.type\n ) {\n return false\n }\n const a = other.variableInfo\n const b = this.variableInfo\n if (a.type !== b.type) {\n return false\n }\n if (a.type === 'environment' && b.type === 'environment') {\n return a.name === b.name && a.value === b.value && a.isDefined === b.isDefined\n }\n if (a.type === 'contextFunction' && b.type === 'contextFunction') {\n return a.identifier === b.identifier && a.details === b.details\n }\n return false\n }\n\n override ignoreEvent(): boolean {\n return false\n }\n}\n\n/**\n * Styles the active environment variable pill.\n * This plugin creates decorations for environment variables in the editor.\n */\nexport const pillPlugin = (props: {\n environment: XScalarEnvironment | undefined\n isReadOnly: boolean | undefined\n isContextFunctionName?: (name: string) => boolean\n translate?: TranslateFn<ApiClientTranslationKey>\n}) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet\n lastEnvironment: XScalarEnvironment | undefined\n\n constructor(view: EditorView) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(view)\n }\n\n update(update: ViewUpdate): void {\n // Rebuild decorations if environment changed\n if (props.environment !== this.lastEnvironment) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(update.view)\n return\n }\n\n // Only rebuild decorations if document or viewport changed\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view)\n }\n }\n\n buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>()\n const isContextFn = props.isContextFunctionName ?? (() => false)\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to)\n\n // Create a new regex instance to ensure lastIndex is reset\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index\n const end = start + match[0].length\n const variableName = match[1] ?? ''\n\n // Skip decorations that span line breaks as CodeMirror does not allow them\n const matchedText = view.state.doc.sliceString(start, end)\n if (matchedText.includes('\\n')) {\n continue\n }\n\n const variant: PillContext['type'] = isContextFn(variableName) ? 'contextFunction' : 'environment'\n\n builder.add(\n start,\n end,\n Decoration.widget({\n widget: new PillWidget(variableName, props.environment, variant, props.translate),\n side: 1,\n }),\n )\n }\n }\n\n return builder.finish()\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n )\n\n/**\n * Custom backspace handler for the editor.\n * Handles special cases like removing entire variable syntax and clearing all content.\n */\nexport const backspaceCommand = EditorView.domEventHandlers({\n keydown(event, view): boolean {\n if (event.key !== 'Backspace') {\n return false\n }\n\n const { state } = view\n const { from, to } = state.selection.main\n\n // When selecting all content and pressing backspace,\n // prevent breaking line content addition on pill removal\n if (from === 0 && to === state.doc.length) {\n view.dispatch({\n changes: { from: 0, to: state.doc.length },\n selection: { anchor: 0 },\n })\n event.preventDefault()\n return true\n }\n\n // When cursor is after a variable closing bracket (}}),\n // remove the entire closing syntax at once\n if (from === to && from >= 2) {\n const before = state.doc.sliceString(from - 2, from)\n if (before === '}}') {\n view.dispatch({\n changes: { from: from - 2, to: from },\n selection: { anchor: from - 2 },\n })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n})\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,aAAN,MAAM,mBAAmB,WAAW;CAMf;CAGA;CARnB;CACA;CACA;CAEA,YACE,cACA,aACA,SACA,WACA;EACA,MAAM;EALW,KAAA,eAAA;EAGA,KAAA,YAAA;EAGjB,IAAI,YAAY,mBAAmB;GACjC,KAAK,YAAY;GACjB,KAAK,eAAe;IAClB,MAAM;IACN,YAAY;IACZ,SAAS,0BAA0B,YAAmC;GACxE;GACA;EACF;EAEA,KAAK,YAAY,aAAa,SAAS;EAEvC,MAAM,W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5B,IAAI,MAAM,QAAQ,aAChB,OAAO;CAGT,MAAM,EAAE,UAAU;CAClB,MAAM,EAAE,MAAM,OAAO,MAAM,UAAU;CAIrC,IAAI,SAAS,KAAK,OAAO,MAAM,IAAI,QAAQ;EACzC,KAAK,SAAS;GACZ,SAAS;IAAE,MAAM;IAAG,IAAI,MAAM,IAAI;GAAO;GACzC,WAAW,EAAE,QAAQ,EAAE;EACzB,CAAC;EACD,MAAM,eAAe;EACrB,OAAO;CACT;CAIA,IAAI,SAAS,MAAM,QAAQ;MACV,MAAM,IAAI,YAAY,OAAO,GAAG,IAC3C,MAAW,MAAM;GACnB,KAAK,SAAS;IACZ,SAAS;KAAE,MAAM,OAAO;KAAG,IAAI;IAAK;IACpC,WAAW,EAAE,QAAQ,OAAO,EAAE;GAChC,CAAC;GACD,MAAM,eAAe;GACrB,OAAO;EACT;;CAGF,OAAO;AACT,EACF,CAAC"}
@@ -24,7 +24,9 @@ type __VLS_Slots = {} & {
24
24
  } & {
25
25
  icon?: (props: typeof __VLS_30) => any;
26
26
  };
27
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
27
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
28
+ focus: () => void;
29
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
28
30
  "update:modelValue": (v: string | number) => any;
29
31
  selectVariable: (value: string) => any;
30
32
  inputFocus: () => any;
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"names":[],"mappings":"AAyLA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO/C,KAAK,WAAW,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,CAA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wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import DataTableInput_vue_vue_type_script_setup_true_lang_default from "./DataTableInput.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/components/data-table/DataTableInput.vue
5
- var DataTableInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DataTableInput_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ce270af2"]]);
5
+ var DataTableInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DataTableInput_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-029a43f5"]]);
6
6
  //#endregion
7
7
  export { DataTableInput_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableInput.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, ref, useTemplateRef } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\nconst maskedInput = useTemplateRef('maskedInput')\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n// If not an enum nor read only, focus the code input or masked input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n codeInput.value?.focus()\n maskedInput.value?.focus()\n }\n}\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div class=\"relative flex min-w-0 flex-1\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n ref=\"maskedInput\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue && !readOnly\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"emit('update:modelValue', '')\" />\n <!-- Toggle Visibility -->\n <!-- A toggle button keeps one name and reports its state, so the label\n stays \"Show Password\" while `aria-pressed` says whether the value is\n revealed. Flipping the name instead leaves screen readers silent,\n because activating a button does not re-announce its name. -->\n <ScalarIconButton\n v-if=\"type === 'password'\"\n :aria-pressed=\"!mask\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"translate('apiClient.dataTableInput.showPassword')\"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"DataTableInput.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, nextTick, ref, useTemplateRef, watch } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\nconst maskedInput = useTemplateRef('maskedInput')\n\n/**\n * Whether focus is inside the field. Tracked with focusin and focusout on the wrapper because the\n * revealed editor does not report its own focus, and swapping it out mid-typing would drop focus.\n */\nconst fieldFocused = ref(false)\n\n/** There is nothing to reveal in an empty field, so the toggle only shows once it has a value */\nconst showVisibilityToggle = computed(\n () => props.type === 'password' && Boolean(props.modelValue),\n)\n\n// An emptied secret goes back to masked, so whatever is typed or pasted next stays hidden\nwatch(\n () => props.modelValue,\n (value) => {\n if (!value && !fieldFocused.value) {\n mask.value = true\n }\n },\n)\n\n/** A field emptied while typing in the revealed editor masks once focus leaves it */\nconst handleFieldFocusOut = (): void => {\n fieldFocused.value = false\n\n if (!props.modelValue) {\n mask.value = true\n }\n}\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n/** Focus whichever editor is showing, the masked input or the code input */\nconst focus = (): void => {\n codeInput.value?.focus()\n maskedInput.value?.focus()\n}\n\n// If not an enum nor read only, focus the code input or masked input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n focus()\n }\n}\n\n/**\n * The clear button disappears once the field is empty, so focus moves to the field instead of\n * falling back to the page. A cleared secret is masked again so the next one is not shown.\n */\nconst clearValue = async (): Promise<void> => {\n mask.value = true\n emit('update:modelValue', '')\n await nextTick()\n focus()\n}\n\ndefineExpose({ focus })\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div\n class=\"relative flex min-w-0 flex-1\"\n @focusin=\"fieldFocused = true\"\n @focusout=\"handleFieldFocusOut\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n ref=\"maskedInput\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue && !readOnly\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"clearValue\" />\n <!-- Toggle Visibility -->\n <!-- A toggle button keeps one name and reports its state, so the label\n stays \"Show Password\" while `aria-pressed` says whether the value is\n revealed. Flipping the name instead leaves screen readers silent,\n because activating a button does not re-announce its name. -->\n <ScalarIconButton\n v-if=\"showVisibilityToggle\"\n :aria-pressed=\"!mask\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"translate('apiClient.dataTableInput.showPassword')\"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":""}