@scalar/api-client 3.1.0 → 3.2.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 (145) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  3. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts +2 -2
  4. package/dist/style.css +43 -43
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  7. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +2 -1
  8. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  9. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +5 -1
  10. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/send-request.js +2 -2
  12. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  13. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  15. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  16. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +4 -0
  17. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  18. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  19. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  21. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  22. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +1 -0
  23. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  24. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  26. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +1 -0
  27. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  28. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
  29. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
  30. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +3 -3
  31. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  32. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  33. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  35. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +131 -48
  36. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  37. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts +2 -2
  38. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  39. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  40. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +16 -0
  41. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  42. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +43 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  44. package/dist/v2/components/code-input/CodeInput.vue.d.ts +6 -2
  45. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  46. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  47. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  48. package/dist/v2/components/code-input/CodeInput.vue.script.js +9 -4
  49. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  50. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -0
  51. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  52. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  53. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  54. package/dist/v2/components/data-table/DataTableInput.vue.script.js +7 -1
  55. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  56. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts +2 -2
  57. package/dist/v2/constants.js +1 -1
  58. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/App.vue.js.map +1 -1
  60. package/dist/v2/features/app/App.vue.script.js +2 -1
  61. package/dist/v2/features/app/App.vue.script.js.map +1 -1
  62. package/dist/v2/features/app/app-state.d.ts +6 -1
  63. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  64. package/dist/v2/features/app/app-state.js +5 -3
  65. package/dist/v2/features/app/app-state.js.map +1 -1
  66. package/dist/v2/features/app/components/DesktopTab.vue.d.ts +2 -2
  67. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +9 -1
  68. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  69. package/dist/v2/features/app/helpers/create-api-client-app.js +3 -2
  70. package/dist/v2/features/app/helpers/create-api-client-app.js.map +1 -1
  71. package/dist/v2/features/app/helpers/routes.d.ts +4 -2
  72. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  73. package/dist/v2/features/app/helpers/routes.js.map +1 -1
  74. package/dist/v2/features/collection/DocumentCollection.vue.script.js +2 -1
  75. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  76. package/dist/v2/features/collection/OperationCollection.vue.script.js +2 -1
  77. package/dist/v2/features/collection/OperationCollection.vue.script.js.map +1 -1
  78. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js +2 -1
  79. package/dist/v2/features/collection/WorkspaceCollection.vue.script.js.map +1 -1
  80. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  81. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  82. package/dist/v2/features/collection/components/Authentication.vue.js.map +1 -1
  83. package/dist/v2/features/collection/components/Authentication.vue.script.js +10 -1
  84. package/dist/v2/features/collection/components/Authentication.vue.script.js.map +1 -1
  85. package/dist/v2/features/collection/components/Cookies.vue.script.js +1 -0
  86. package/dist/v2/features/collection/components/Cookies.vue.script.js.map +1 -1
  87. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js +1 -0
  88. package/dist/v2/features/collection/components/Editor/Editor.vue.script.js.map +1 -1
  89. package/dist/v2/features/collection/components/Environment.vue.script.js +1 -0
  90. package/dist/v2/features/collection/components/Environment.vue.script.js.map +1 -1
  91. package/dist/v2/features/collection/components/Form.vue.d.ts +2 -0
  92. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  93. package/dist/v2/features/collection/components/Form.vue.js.map +1 -1
  94. package/dist/v2/features/collection/components/Form.vue.script.js +4 -1
  95. package/dist/v2/features/collection/components/Form.vue.script.js.map +1 -1
  96. package/dist/v2/features/collection/components/LabelInput.vue.d.ts +1 -1
  97. package/dist/v2/features/collection/components/Overview.vue.script.js +1 -0
  98. package/dist/v2/features/collection/components/Overview.vue.script.js.map +1 -1
  99. package/dist/v2/features/collection/components/Runner/components/Runner.vue.d.ts.map +1 -1
  100. package/dist/v2/features/collection/components/Runner/components/Runner.vue.js.map +1 -1
  101. package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js +4 -2
  102. package/dist/v2/features/collection/components/Runner/components/Runner.vue.script.js.map +1 -1
  103. package/dist/v2/features/collection/components/Runner/components/RunnerTree.vue.d.ts +2 -2
  104. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.d.ts +4 -2
  105. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.d.ts.map +1 -1
  106. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js +3 -2
  107. package/dist/v2/features/collection/components/Runner/hooks/use-runner-execution.js.map +1 -1
  108. package/dist/v2/features/collection/components/Scripts.vue.script.js +1 -0
  109. package/dist/v2/features/collection/components/Scripts.vue.script.js.map +1 -1
  110. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  111. package/dist/v2/features/collection/components/Servers.vue.js.map +1 -1
  112. package/dist/v2/features/collection/components/Servers.vue.script.js +3 -1
  113. package/dist/v2/features/collection/components/Servers.vue.script.js.map +1 -1
  114. package/dist/v2/features/collection/components/Settings.vue.script.js +1 -0
  115. package/dist/v2/features/collection/components/Settings.vue.script.js.map +1 -1
  116. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +2 -2
  117. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts +2 -2
  118. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts +1 -1
  119. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  120. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  121. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +2 -2
  122. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  123. package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
  124. package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +1 -1
  125. package/dist/v2/features/global-cookies/components/CookiesTable.vue.js.map +1 -1
  126. package/dist/v2/features/global-cookies/components/CookiesTable.vue.script.js +2 -0
  127. package/dist/v2/features/global-cookies/components/CookiesTable.vue.script.js.map +1 -1
  128. package/dist/v2/features/modal/Modal.vue.d.ts +7 -6
  129. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  130. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  131. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  132. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +5 -5
  133. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  134. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  135. package/dist/v2/features/modal/helpers/types.d.ts +1 -7
  136. package/dist/v2/features/modal/helpers/types.d.ts.map +1 -1
  137. package/dist/v2/features/modal/index.d.ts +1 -1
  138. package/dist/v2/features/modal/index.d.ts.map +1 -1
  139. package/dist/v2/features/operation/Operation.vue.d.ts +0 -5
  140. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  141. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  142. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  143. package/dist/v2/types/options.d.ts +15 -0
  144. package/dist/v2/types/options.d.ts.map +1 -0
  145. package/package.json +12 -12
@@ -21,13 +21,14 @@ var createAppRouter = (layout) => {
21
21
  /**
22
22
  * Create the API Client with router and passes in the workspace store as a prop
23
23
  */
24
- var createApiClientApp = async (el, { layout = "desktop", plugins, customThemes, fallbackThemeSlug, fetchRegistryDocument, telemetry = true }) => {
24
+ var createApiClientApp = async (el, { layout = "desktop", plugins, customThemes, fallbackThemeSlug, fetchRegistryDocument, telemetry = true, options }) => {
25
25
  const router = createAppRouter(layout);
26
26
  const state = await createAppState({
27
27
  router,
28
28
  customThemes,
29
29
  fallbackThemeSlug,
30
- telemetryDefault: telemetry
30
+ telemetryDefault: telemetry,
31
+ options
31
32
  });
32
33
  const commandPaletteState = useCommandPaletteState();
33
34
  const app = createApp(App_default, {
@@ -1 +1 @@
1
- {"version":3,"file":"create-api-client-app.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport { createApp } from 'vue'\nimport { createRouter as createVueRouter, createWebHashHistory, createWebHistory } from 'vue-router'\n\nimport App from '@/v2/features/app/App.vue'\nimport { createAppState } from '@/v2/features/app/app-state'\nimport { ROUTES } from '@/v2/features/app/helpers/routes'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport { useCommandPaletteState } from '../../command-palette/hooks/use-command-palette-state'\n\ntype CreateApiClientOptions = {\n /**\n * The layout of the client, limited to web or desktop in app\n * @see {@link ClientLayout}\n *\n * @default 'desktop'\n */\n layout: Exclude<ClientLayout, 'modal'>\n /**\n * Api client plugins to include in the app\n */\n plugins?: ClientPlugin[]\n /**\n * Custom themes to include in the app\n */\n customThemes?: Theme[]\n /**\n * Fallback theme slug to use if no theme is selected for the workspace\n * @default 'default'\n */\n fallbackThemeSlug?: () => string\n /**\n * Fetches the full document from registry by meta. When set, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /**\n * Whether or not to send telemetry events.\n */\n telemetry?: boolean\n}\n\n/**\n * Creates the appropriate router with the appropriate routes based on the layout\n */\nexport const createAppRouter = (layout: CreateApiClientOptions['layout']) => {\n // Web uses the standard HTML5 history API\n if (layout === 'web') {\n return createVueRouter({ history: createWebHistory(), routes: ROUTES })\n }\n\n // Electron app has to use the webHashHistory due to file routing\n return createVueRouter({ history: createWebHashHistory(), routes: ROUTES })\n}\n\n/**\n * Create the API Client with router and passes in the workspace store as a prop\n */\nexport const createApiClientApp = async (\n el: HTMLElement | null,\n {\n layout = 'desktop',\n plugins,\n customThemes,\n fallbackThemeSlug,\n fetchRegistryDocument,\n telemetry = true,\n }: CreateApiClientOptions,\n) => {\n // Add the router\n const router = createAppRouter(layout)\n const state = await createAppState({\n router,\n customThemes,\n fallbackThemeSlug,\n telemetryDefault: telemetry,\n })\n const commandPaletteState = useCommandPaletteState()\n\n // Pass in our initial props at the top level\n const app = createApp(App, {\n layout,\n plugins,\n getAppState: () => state,\n getCommandPaletteState: () => commandPaletteState,\n fetchRegistryDocument,\n })\n app.use(router)\n\n // Mount the vue app\n if (!el) {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Invalid HTML element provided.',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n\n return\n }\n app.mount(el)\n\n return {\n app,\n state,\n }\n}\n"],"mappings":";;;;;;;;;;AAgDA,IAAa,mBAAmB,WAA6C;AAE3E,KAAI,WAAW,MACb,QAAO,aAAgB;EAAE,SAAS,kBAAkB;EAAE,QAAQ;EAAQ,CAAC;AAIzE,QAAO,aAAgB;EAAE,SAAS,sBAAsB;EAAE,QAAQ;EAAQ,CAAC;;;;;AAM7E,IAAa,qBAAqB,OAChC,IACA,EACE,SAAS,WACT,SACA,cACA,mBACA,uBACA,YAAY,WAEX;CAEH,MAAM,SAAS,gBAAgB,OAAO;CACtC,MAAM,QAAQ,MAAM,eAAe;EACjC;EACA;EACA;EACA,kBAAkB;EACnB,CAAC;CACF,MAAM,sBAAsB,wBAAwB;CAGpD,MAAM,MAAM,UAAU,aAAK;EACzB;EACA;EACA,mBAAmB;EACnB,8BAA8B;EAC9B;EACD,CAAC;AACF,KAAI,IAAI,OAAO;AAGf,KAAI,CAAC,IAAI;AACP,UAAQ,MACN,+DACA,kCACA,4EACD;AAED;;AAEF,KAAI,MAAM,GAAG;AAEb,QAAO;EACL;EACA;EACD"}
1
+ {"version":3,"file":"create-api-client-app.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport { createApp } from 'vue'\nimport { createRouter as createVueRouter, createWebHashHistory, createWebHistory } from 'vue-router'\n\nimport App from '@/v2/features/app/App.vue'\nimport { createAppState } from '@/v2/features/app/app-state'\nimport { ROUTES } from '@/v2/features/app/helpers/routes'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\nimport { useCommandPaletteState } from '../../command-palette/hooks/use-command-palette-state'\n\ntype CreateApiClientOptions = {\n /**\n * The layout of the client, limited to web or desktop in app\n * @see {@link ClientLayout}\n *\n * @default 'desktop'\n */\n layout: Exclude<ClientLayout, 'modal'>\n /**\n * Api client plugins to include in the app\n */\n plugins?: ClientPlugin[]\n /**\n * Custom themes to include in the app\n */\n customThemes?: Theme[]\n /**\n * Fallback theme slug to use if no theme is selected for the workspace\n * @default 'default'\n */\n fallbackThemeSlug?: () => string\n /**\n * Fetches the full document from registry by meta. When set, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /**\n * Whether or not to send telemetry events.\n */\n telemetry?: boolean\n /** Runtime behaviour overrides */\n options?: ApiClientAppOptions\n}\n\n/**\n * Runtime behaviour overrides shared between createApiClientApp and createAppState.\n * Derived from the canonical ApiClientOptions to guarantee structural compatibility.\n */\nexport type ApiClientAppOptions = Pick<ApiClientOptions, 'customFetch' | 'oauth2RedirectUri'>\n\n/**\n * Creates the appropriate router with the appropriate routes based on the layout\n */\nexport const createAppRouter = (layout: CreateApiClientOptions['layout']) => {\n // Web uses the standard HTML5 history API\n if (layout === 'web') {\n return createVueRouter({ history: createWebHistory(), routes: ROUTES })\n }\n\n // Electron app has to use the webHashHistory due to file routing\n return createVueRouter({ history: createWebHashHistory(), routes: ROUTES })\n}\n\n/**\n * Create the API Client with router and passes in the workspace store as a prop\n */\nexport const createApiClientApp = async (\n el: HTMLElement | null,\n {\n layout = 'desktop',\n plugins,\n customThemes,\n fallbackThemeSlug,\n fetchRegistryDocument,\n telemetry = true,\n options,\n }: CreateApiClientOptions,\n) => {\n // Add the router\n const router = createAppRouter(layout)\n const state = await createAppState({\n router,\n customThemes,\n fallbackThemeSlug,\n telemetryDefault: telemetry,\n options,\n })\n const commandPaletteState = useCommandPaletteState()\n\n // Pass in our initial props at the top level\n const app = createApp(App, {\n layout,\n plugins,\n getAppState: () => state,\n getCommandPaletteState: () => commandPaletteState,\n fetchRegistryDocument,\n })\n app.use(router)\n\n // Mount the vue app\n if (!el) {\n console.error(\n '[@scalar/api-client-modal] Could not create the API client.',\n 'Invalid HTML element provided.',\n 'Read more: https://github.com/scalar/scalar/tree/main/packages/api-client',\n )\n\n return\n }\n app.mount(el)\n\n return {\n app,\n state,\n }\n}\n"],"mappings":";;;;;;;;;;AAyDA,IAAa,mBAAmB,WAA6C;AAE3E,KAAI,WAAW,MACb,QAAO,aAAgB;EAAE,SAAS,kBAAkB;EAAE,QAAQ;EAAQ,CAAC;AAIzE,QAAO,aAAgB;EAAE,SAAS,sBAAsB;EAAE,QAAQ;EAAQ,CAAC;;;;;AAM7E,IAAa,qBAAqB,OAChC,IACA,EACE,SAAS,WACT,SACA,cACA,mBACA,uBACA,YAAY,MACZ,cAEC;CAEH,MAAM,SAAS,gBAAgB,OAAO;CACtC,MAAM,QAAQ,MAAM,eAAe;EACjC;EACA;EACA;EACA,kBAAkB;EAClB;EACD,CAAC;CACF,MAAM,sBAAsB,wBAAwB;CAGpD,MAAM,MAAM,UAAU,aAAK;EACzB;EACA;EACA,mBAAmB;EACnB,8BAA8B;EAC9B;EACD,CAAC;AACF,KAAI,IAAI,OAAO;AAGf,KAAI,CAAC,IAAI;AACP,UAAQ,MACN,+DACA,kCACA,4EACD;AAED;;AAEF,KAAI,MAAM,GAAG;AAEb,QAAO;EACL;EACA;EACD"}
@@ -5,6 +5,8 @@ import type { WorkspaceStore } from '@scalar/workspace-store/client';
5
5
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
6
6
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
7
7
  import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
8
+ import type { MaybeRefOrGetter } from 'vue';
9
+ import type { ApiClientOptions } from '../../../../v2/types/options';
8
10
  import type { ImportDocumentFromRegistry } from '../../../../v2/types/configuration';
9
11
  import type { ClientLayout } from '../../../../v2/types/layout';
10
12
  /** These props are provided at the route level */
@@ -49,6 +51,8 @@ export type RouteProps = {
49
51
  telemetry?: boolean;
50
52
  /** Updates the telemetry enabled state */
51
53
  onUpdateTelemetry?: (value: boolean) => void;
54
+ /** App or modal options forwarded to operation/auth blocks */
55
+ options?: MaybeRefOrGetter<ApiClientOptions>;
52
56
  };
53
57
  /** When in the collections pages */
54
58
  export type CollectionProps = RouteProps & ({
@@ -70,10 +74,8 @@ export declare const ROUTES: ({
70
74
  name: string;
71
75
  path: string;
72
76
  component: import("vue").DefineComponent<RouteProps & {
73
- options?: import("../../modal/helpers/types").ApiClientModalOptionsRef;
74
77
  requestBodyCompositionSelection?: Record<string, number>;
75
78
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<RouteProps & {
76
- options?: import("../../modal/helpers/types").ApiClientModalOptionsRef;
77
79
  requestBodyCompositionSelection?: Record<string, number>;
78
80
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
79
81
  redirect?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,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AAO,CAAA;IACnB,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,8DAA8D;IAC9D,OAAO,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;CAC7C,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,UAAU,GACtC,CACI;IACE,cAAc,EAAE,UAAU,GAAG,WAAW,CAAA;IACxC,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GACD;IACE,cAAc,EAAE,WAAW,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;CACf,CACJ,CAAA;AAEH,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,CAAA;AAEjB,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAlBK,UAAU,GAAG,WAAW;kCAC9B,iBAAiB;;wCAGX,WAAW;kCACjB,IAAI;;wCALE,UAAU,GAAG,WAAW;kCAC9B,iBAAiB;;wCAGX,WAAW;kCACjB,IAAI;;;;;;;;;;;;;;;;;;;;;oCALE,UAAU,GAAG,WAAW;8BAC9B,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;oCALE,UAAU,GAAG,WAAW;8BAC9B,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;;;;;;gCALE,UAAU,GAAG,WAAW;0BAC9B,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU,GAAG,WAAW;0BAC9B,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IA+KM,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { mergeSearchParams } from '@scalar/helpers/url/merge-urls'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport type { RouteRecordRaw } from 'vue-router'\n\nimport Authentication from '@/v2/features/collection/components/Authentication.vue'\nimport Cookies from '@/v2/features/collection/components/Cookies.vue'\nimport { Editor } from '@/v2/features/collection/components/Editor'\nimport Environment from '@/v2/features/collection/components/Environment.vue'\nimport Overview from '@/v2/features/collection/components/Overview.vue'\nimport { Runner } from '@/v2/features/collection/components/Runner'\nimport Servers from '@/v2/features/collection/components/Servers.vue'\nimport Settings from '@/v2/features/collection/components/Settings.vue'\nimport DocumentCollection from '@/v2/features/collection/DocumentCollection.vue'\nimport OperationCollection from '@/v2/features/collection/OperationCollection.vue'\nimport WorkspaceCollection from '@/v2/features/collection/WorkspaceCollection.vue'\nimport { Operation } from '@/v2/features/operation'\nimport { workspaceStorage } from '@/v2/helpers/storage'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\n/** These props are provided at the route level */\nexport type RouteProps = {\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document */\n document: WorkspaceDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** The currently active workspace */\n activeWorkspace: { id: string; label: string }\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Custom themes available to the team */\n customThemes?: Theme[]\n /** The currently selected theme styles string */\n currentTheme?: string\n /** Whether the current color mode is dark */\n isDarkMode?: boolean\n /**\n * Fetches the full document from registry by meta. When provided, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /** Whether telemetry is enabled */\n telemetry?: boolean\n /** Updates the telemetry enabled state */\n onUpdateTelemetry?: (value: boolean) => void\n}\n\n/** When in the collections pages */\nexport type CollectionProps = RouteProps &\n (\n | {\n collectionType: 'document' | 'operation'\n document: WorkspaceDocument\n }\n | {\n collectionType: 'workspace'\n document: null\n }\n )\n\nexport type ScalarClientAppRouteParams =\n | 'namespace'\n | 'workspaceSlug'\n | 'documentSlug'\n | 'pathEncoded'\n | 'method'\n | 'exampleName'\n\n/** Routes for the API client app and web, the same as modal + workspace routes */\nexport const ROUTES = [\n {\n path: '/@:namespace/:workspaceSlug',\n children: [\n {\n path: 'document/:documentSlug',\n children: [\n // Example page\n {\n path: 'path/:pathEncoded/method/:method',\n children: [\n {\n name: 'example',\n path: 'example/:exampleName',\n component: Operation,\n },\n {\n name: 'operation',\n path: '',\n component: OperationCollection,\n redirect: {\n name: 'operation.overview',\n },\n children: [\n {\n name: 'operation.overview',\n path: 'overview',\n component: Overview,\n },\n {\n name: 'operation.servers',\n path: 'servers',\n component: Servers,\n },\n {\n name: 'operation.authentication',\n path: 'authentication',\n component: Authentication,\n },\n {\n name: 'operation.editor',\n path: 'editor',\n component: Editor,\n },\n ],\n },\n ],\n },\n // Document Page\n {\n name: 'document',\n path: '',\n component: DocumentCollection,\n children: [\n // Redirect to overview\n {\n name: 'document.redirect',\n path: '',\n redirect: {\n name: 'document.overview',\n },\n },\n // Document overview\n {\n name: 'document.overview',\n path: 'overview',\n component: Overview,\n },\n // Document servers\n {\n name: 'document.servers',\n path: 'servers',\n component: Servers,\n },\n // Document environment\n {\n name: 'document.environment',\n path: 'environment',\n component: Environment,\n },\n // Document authentication\n {\n name: 'document.authentication',\n path: 'authentication',\n component: Authentication,\n },\n // Document cookies\n {\n name: 'document.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Document scripts (pre-request / post-response)\n {\n name: 'document.scripts',\n path: 'scripts',\n component: () => import('@/v2/features/collection/components/Scripts.vue'),\n },\n // Document runner\n {\n name: 'document.runner',\n path: 'runner',\n component: Runner,\n },\n // Document settings\n {\n name: 'document.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n // Workspace page\n {\n name: 'workspace',\n path: '',\n component: WorkspaceCollection,\n children: [\n // Workspace environment\n {\n name: 'workspace.environment',\n path: 'environment',\n component: Environment,\n },\n // Workspace cookies\n {\n name: 'workspace.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Workspace settings\n {\n name: 'workspace.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n {\n path: '/:pathMatch(.*)*',\n redirect: () => {\n const DEFAULT_PATH = '/@local/default/document/drafts/overview'\n const lastPath = workspaceStorage.getLastPath() ?? DEFAULT_PATH\n\n // Set the default path to the last path so we don't go to an inifite loop if the last path is invalid\n workspaceStorage.setCurrentPath(DEFAULT_PATH)\n\n const url = new URL(lastPath, 'http://example.com')\n\n const queryParameters = new URLSearchParams(window.location.search)\n\n //Merge the query parameters with the last path\n const mergedSearchParams = mergeSearchParams(url.searchParams, queryParameters)\n\n // Preserve all query paramters\n return `${url.pathname}?${mergedSearchParams.toString()}`\n },\n },\n] satisfies RouteRecordRaw[]\n"],"mappings":";;;;;;;;;;;;;;;;AAyFA,IAAa,SAAS,CACpB;CACE,MAAM;CACN,UAAU,CACR;EACE,MAAM;EACN,UAAU,CAER;GACE,MAAM;GACN,UAAU,CACR;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ,EACD;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU,EACR,MAAM,sBACP;IACD,UAAU;KACR;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACF;IACF,CACF;GACF,EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACX,UAAU;IAER;KACE,MAAM;KACN,MAAM;KACN,UAAU,EACR,MAAM,qBACP;KACF;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IACF;GACF,CACF;EACF,EAED;EACE,MAAM;EACN,MAAM;EACN,WAAW;EACX,UAAU;GAER;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GACF;EACF,CACF;CACF,EACD;CACE,MAAM;CACN,gBAAgB;EACd,MAAM,eAAe;EACrB,MAAM,WAAW,iBAAiB,aAAa,IAAI;AAGnD,mBAAiB,eAAe,aAAa;EAE7C,MAAM,MAAM,IAAI,IAAI,UAAU,qBAAqB;EAEnD,MAAM,kBAAkB,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAGnE,MAAM,qBAAqB,kBAAkB,IAAI,cAAc,gBAAgB;AAG/E,SAAO,GAAG,IAAI,SAAS,GAAG,mBAAmB,UAAU;;CAE1D,CACF"}
1
+ {"version":3,"file":"routes.js","names":[],"sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { mergeSearchParams } from '@scalar/helpers/url/merge-urls'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { Theme } from '@scalar/themes'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace'\nimport type { MaybeRefOrGetter } from 'vue'\nimport type { RouteRecordRaw } from 'vue-router'\n\nimport Authentication from '@/v2/features/collection/components/Authentication.vue'\nimport Cookies from '@/v2/features/collection/components/Cookies.vue'\nimport { Editor } from '@/v2/features/collection/components/Editor'\nimport Environment from '@/v2/features/collection/components/Environment.vue'\nimport Overview from '@/v2/features/collection/components/Overview.vue'\nimport { Runner } from '@/v2/features/collection/components/Runner'\nimport Servers from '@/v2/features/collection/components/Servers.vue'\nimport Settings from '@/v2/features/collection/components/Settings.vue'\nimport DocumentCollection from '@/v2/features/collection/DocumentCollection.vue'\nimport OperationCollection from '@/v2/features/collection/OperationCollection.vue'\nimport WorkspaceCollection from '@/v2/features/collection/WorkspaceCollection.vue'\nimport type { ApiClientOptions } from '@/v2/types/options'\nimport { Operation } from '@/v2/features/operation'\nimport { workspaceStorage } from '@/v2/helpers/storage'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\n/** These props are provided at the route level */\nexport type RouteProps = {\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document */\n document: WorkspaceDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** The currently active workspace */\n activeWorkspace: { id: string; label: string }\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Custom themes available to the team */\n customThemes?: Theme[]\n /** The currently selected theme styles string */\n currentTheme?: string\n /** Whether the current color mode is dark */\n isDarkMode?: boolean\n /**\n * Fetches the full document from registry by meta. When provided, registry meta takes priority\n * over x-scalar-original-source-url when syncing. Returns the document as a plain object.\n */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /** Whether telemetry is enabled */\n telemetry?: boolean\n /** Updates the telemetry enabled state */\n onUpdateTelemetry?: (value: boolean) => void\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n\n/** When in the collections pages */\nexport type CollectionProps = RouteProps &\n (\n | {\n collectionType: 'document' | 'operation'\n document: WorkspaceDocument\n }\n | {\n collectionType: 'workspace'\n document: null\n }\n )\n\nexport type ScalarClientAppRouteParams =\n | 'namespace'\n | 'workspaceSlug'\n | 'documentSlug'\n | 'pathEncoded'\n | 'method'\n | 'exampleName'\n\n/** Routes for the API client app and web, the same as modal + workspace routes */\nexport const ROUTES = [\n {\n path: '/@:namespace/:workspaceSlug',\n children: [\n {\n path: 'document/:documentSlug',\n children: [\n // Example page\n {\n path: 'path/:pathEncoded/method/:method',\n children: [\n {\n name: 'example',\n path: 'example/:exampleName',\n component: Operation,\n },\n {\n name: 'operation',\n path: '',\n component: OperationCollection,\n redirect: {\n name: 'operation.overview',\n },\n children: [\n {\n name: 'operation.overview',\n path: 'overview',\n component: Overview,\n },\n {\n name: 'operation.servers',\n path: 'servers',\n component: Servers,\n },\n {\n name: 'operation.authentication',\n path: 'authentication',\n component: Authentication,\n },\n {\n name: 'operation.editor',\n path: 'editor',\n component: Editor,\n },\n ],\n },\n ],\n },\n // Document Page\n {\n name: 'document',\n path: '',\n component: DocumentCollection,\n children: [\n // Redirect to overview\n {\n name: 'document.redirect',\n path: '',\n redirect: {\n name: 'document.overview',\n },\n },\n // Document overview\n {\n name: 'document.overview',\n path: 'overview',\n component: Overview,\n },\n // Document servers\n {\n name: 'document.servers',\n path: 'servers',\n component: Servers,\n },\n // Document environment\n {\n name: 'document.environment',\n path: 'environment',\n component: Environment,\n },\n // Document authentication\n {\n name: 'document.authentication',\n path: 'authentication',\n component: Authentication,\n },\n // Document cookies\n {\n name: 'document.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Document scripts (pre-request / post-response)\n {\n name: 'document.scripts',\n path: 'scripts',\n component: () => import('@/v2/features/collection/components/Scripts.vue'),\n },\n // Document runner\n {\n name: 'document.runner',\n path: 'runner',\n component: Runner,\n },\n // Document settings\n {\n name: 'document.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n // Workspace page\n {\n name: 'workspace',\n path: '',\n component: WorkspaceCollection,\n children: [\n // Workspace environment\n {\n name: 'workspace.environment',\n path: 'environment',\n component: Environment,\n },\n // Workspace cookies\n {\n name: 'workspace.cookies',\n path: 'cookies',\n component: Cookies,\n },\n // Workspace settings\n {\n name: 'workspace.settings',\n path: 'settings',\n component: Settings,\n },\n ],\n },\n ],\n },\n {\n path: '/:pathMatch(.*)*',\n redirect: () => {\n const DEFAULT_PATH = '/@local/default/document/drafts/overview'\n const lastPath = workspaceStorage.getLastPath() ?? DEFAULT_PATH\n\n // Set the default path to the last path so we don't go to an inifite loop if the last path is invalid\n workspaceStorage.setCurrentPath(DEFAULT_PATH)\n\n const url = new URL(lastPath, 'http://example.com')\n\n const queryParameters = new URLSearchParams(window.location.search)\n\n //Merge the query parameters with the last path\n const mergedSearchParams = mergeSearchParams(url.searchParams, queryParameters)\n\n // Preserve all query paramters\n return `${url.pathname}?${mergedSearchParams.toString()}`\n },\n },\n] satisfies RouteRecordRaw[]\n"],"mappings":";;;;;;;;;;;;;;;;AA6FA,IAAa,SAAS,CACpB;CACE,MAAM;CACN,UAAU,CACR;EACE,MAAM;EACN,UAAU,CAER;GACE,MAAM;GACN,UAAU,CACR;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ,EACD;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU,EACR,MAAM,sBACP;IACD,UAAU;KACR;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACD;MACE,MAAM;MACN,MAAM;MACN,WAAW;MACZ;KACF;IACF,CACF;GACF,EAED;GACE,MAAM;GACN,MAAM;GACN,WAAW;GACX,UAAU;IAER;KACE,MAAM;KACN,MAAM;KACN,UAAU,EACR,MAAM,qBACP;KACF;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,iBAAiB,OAAO;KACzB;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IAED;KACE,MAAM;KACN,MAAM;KACN,WAAW;KACZ;IACF;GACF,CACF;EACF,EAED;EACE,MAAM;EACN,MAAM;EACN,WAAW;EACX,UAAU;GAER;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GAED;IACE,MAAM;IACN,MAAM;IACN,WAAW;IACZ;GACF;EACF,CACF;CACF,EACD;CACE,MAAM;CACN,gBAAgB;EACd,MAAM,eAAe;EACrB,MAAM,WAAW,iBAAiB,aAAa,IAAI;AAGnD,mBAAiB,eAAe,aAAa;EAE7C,MAAM,MAAM,IAAI,IAAI,UAAU,qBAAqB;EAEnD,MAAM,kBAAkB,IAAI,gBAAgB,OAAO,SAAS,OAAO;EAGnE,MAAM,qBAAqB,kBAAkB,IAAI,cAAc,gBAAgB;AAG/E,SAAO,GAAG,IAAI,SAAS,GAAG,mBAAmB,UAAU;;CAE1D,CACF"}
@@ -53,7 +53,8 @@ var DocumentCollection_vue_vue_type_script_setup_true_lang_default = /* @__PURE_
53
53
  isDarkMode: { type: Boolean },
54
54
  fetchRegistryDocument: { type: Function },
55
55
  telemetry: { type: Boolean },
56
- onUpdateTelemetry: { type: Function }
56
+ onUpdateTelemetry: { type: Function },
57
+ options: {}
57
58
  },
58
59
  setup(__props) {
59
60
  const props = __props;
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Document Collection Page\n *\n * Displays primary document editing and viewing interface, enabling users to:\n * - Choose a document icon\n * - Edit the document title\n * - Navigate among Overview, Servers, Authentication, Environment, Cookies, and Settings tabs\n */\nexport default {\n name: 'DocumentCollection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarModal,\n ScalarSavePrompt,\n useLoadingState,\n useModal,\n} from '@scalar/components'\nimport {\n ScalarIconCloudArrowDown,\n ScalarIconDownload,\n ScalarIconFloppyDisk,\n ScalarIconSpinner,\n ScalarIconWarning,\n} from '@scalar/icons'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { apply, type Difference, type merge } from '@scalar/json-magic/diff'\nimport { useToasts } from '@scalar/use-toasts'\nimport { deepClone } from '@scalar/workspace-store/helpers/deep-clone'\nimport { computed, ref } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport IconSelector from '@/components/IconSelector.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { downloadAsFile } from '@/v2/helpers/download-document'\n\nimport LabelInput from './components/LabelInput.vue'\nimport SyncConflictResolutionEditor from './components/SyncConflictResolutionEditor.vue'\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\n/** Snag the title from the info object */\nconst title = computed(() => props.document?.info?.title ?? '')\n\n/** Default to the folder icon */\nconst icon = computed(\n () => props.document?.['x-scalar-icon'] || 'interface-content-folder',\n)\n\nconst syncModal = useModal()\nconst dirtyBeforeSyncModal = useModal()\n\nconst isDocumentDirty = computed(\n () => props.document?.['x-scalar-is-dirty'] === true,\n)\n\nconst saveLoader = useLoadingState()\n\nconst documentSourceUrl = computed(\n () => props.document?.['x-scalar-original-source-url'] as string | undefined,\n)\n\nconst documentRegistryMeta = computed(\n () =>\n props.document?.['x-scalar-registry-meta'] as\n | { namespace: string; slug: string }\n | undefined,\n)\n\n/** Show Sync when the document has a source URL or registry meta (registry can be used if fetchRegistryDocument is set). */\nconst canShowSyncButton = computed(\n () =>\n documentSourceUrl.value !== undefined ||\n documentRegistryMeta.value !== undefined,\n)\n\nconst { toast } = useToasts()\n\nconst undoChanges = () => {\n props.workspaceStore.revertDocumentChanges(props.documentSlug)\n}\n\nconst saveChanges = async () => {\n saveLoader.start()\n const res = await props.workspaceStore.saveDocument(props.documentSlug)\n await (res ? saveLoader.validate() : saveLoader.invalidate({ persist: true }))\n}\n\n/** Downloads the document as a JSON file using the last saved state. */\nconst downloadDocument = () => {\n const content = props.workspaceStore.exportDocument(\n props.documentSlug,\n 'json',\n false,\n )\n if (!content) return\n const baseName = title.value.replace(/[^\\w\\s-]/g, '').trim() || 'document'\n downloadAsFile(content, `${baseName}.json`)\n}\n\nconst handleSaveThenCloseDirtyModal = async () => {\n await props.workspaceStore.saveDocument(props.documentSlug)\n dirtyBeforeSyncModal.hide()\n await handleSyncFlow()\n}\n\nconst handleDiscardThenCloseDirtyModal = async () => {\n await props.workspaceStore.revertDocumentChanges(props.documentSlug)\n dirtyBeforeSyncModal.hide()\n await handleSyncFlow()\n}\n\nconst isSyncInProgress = ref(false)\n\nconst rebaseResult = ref<{\n originalDocument: Record<string, unknown>\n resolvedDocument: Record<string, unknown>\n conflicts: ReturnType<typeof merge>['conflicts']\n applyChanges: (\n applyChangesInput:\n | {\n resolvedConflicts: Difference<unknown>[]\n }\n | {\n resolvedDocument: Record<string, unknown>\n },\n ) => Promise<void>\n} | null>(null)\n\n/**\n * Resolves the source for syncing. Registry meta has priority over x-scalar-original-source-url\n * when fetchRegistryDocument is provided. Returns either a URL or the full document object.\n */\nconst resolveSyncInput = async (): Promise<\n { url: string } | { document: Record<string, unknown> } | null\n> => {\n const registryMeta = documentRegistryMeta.value\n if (registryMeta && props.fetchRegistryDocument) {\n try {\n const result = await props.fetchRegistryDocument(registryMeta)\n if (!result.ok) {\n toast(result.error, 'error')\n return null\n }\n return { document: result.data }\n } catch (err) {\n toast('Failed to resolve document from registry', 'error')\n return null\n }\n }\n const url = documentSourceUrl.value\n if (url) {\n return { url }\n }\n return null\n}\n\n/**\n * Handles actions to perform when synchronization is complete.\n * Hides the sync modal, resets the sync progress flag, and emits the\n * 'hooks:on:rebase:document:complete' event with document metadata.\n */\nconst onSyncComplete = () => {\n syncModal.hide()\n isSyncInProgress.value = false\n // Display the toast to show that the sync is complete\n toast(\n 'Your document has been rebased with the latest version from the source.',\n 'info',\n )\n // Emit the event to notify other components that the sync is complete\n props.eventBus.emit('hooks:on:rebase:document:complete', {\n meta: {\n documentName: props.documentSlug,\n },\n })\n}\n\n/**\n * Handles errors that occur during synchronization.\n * If an error string is provided, it displays the error via toast.\n * Always resets the sync progress flag.\n */\nconst onSyncError = (error: string | null) => {\n if (error !== null) {\n toast(error, 'error')\n }\n isSyncInProgress.value = false\n}\n\n/**\n * Handles the synchronization flow for a document.\n * Checks for unsaved changes, resolves source (registry over URL),\n * initiates rebasing, handles conflicts, and emits completion events.\n * If conflicts are detected, a modal dialog is shown for user resolution.\n */\nconst handleSyncFlow = async () => {\n if (isDocumentDirty.value) {\n dirtyBeforeSyncModal.show()\n return\n }\n\n if (isSyncInProgress.value) {\n return\n }\n\n isSyncInProgress.value = true\n\n const input = await resolveSyncInput()\n if (!input) {\n onSyncError(null)\n return\n }\n\n const result = await props.workspaceStore.rebaseDocument({\n name: props.documentSlug,\n ...input,\n })\n\n if (result?.ok) {\n const originalDocument =\n props.workspaceStore.getOriginalDocument(props.documentSlug) ?? {}\n rebaseResult.value = {\n conflicts: result.conflicts,\n applyChanges: result.applyChanges,\n resolvedDocument: apply(deepClone(originalDocument), result.changes),\n originalDocument,\n }\n\n if (rebaseResult.value.conflicts.length > 0) {\n syncModal.show()\n } else {\n // If there is no conflict just rebase immediately\n await rebaseResult.value?.applyChanges({\n resolvedDocument: rebaseResult.value.resolvedDocument,\n })\n onSyncComplete()\n }\n } else if (result?.ok === false && result.type === 'NO_CHANGES_DETECTED') {\n // Emit the event either way even if there was no need to rebase the document\n onSyncComplete()\n } else {\n onSyncError('Failed to sync document')\n }\n}\n\n/*\n * Handles applying changes to the current document after conflict resolution.\n * Emits a completion event and hides the sync modal dialog.\n */\nconst handleApplyChanges = async ({\n resolvedDocument,\n}: {\n resolvedDocument: Record<string, unknown>\n}) => {\n await rebaseResult.value?.applyChanges({ resolvedDocument })\n props.eventBus.emit('hooks:on:rebase:document:complete', {\n meta: {\n documentName: props.documentSlug,\n },\n })\n syncModal.hide()\n}\n\n/**\n * Resets sync state when the sync conflict modal is closed (dismissed or after\n * applying changes). Ensures the Sync button is re-enabled and conflict state\n * is cleared.\n */\nconst onSyncModalClose = () => {\n isSyncInProgress.value = false\n rebaseResult.value = null\n}\n</script>\n\n<template>\n <div class=\"custom-scroll h-full\">\n <div\n v-if=\"document\"\n class=\"md:max-w-content w-full px-3 md:mx-auto\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${title}`\"\n class=\"md:max-w-content mx-auto flex h-fit w-full flex-col gap-2 pt-14 pb-3 md:pt-6\">\n <ScalarSavePrompt\n v-model=\"isDocumentDirty\"\n class=\"w-content-padded-4 max-w-full-padded-4 absolute\"\n :loader=\"saveLoader\"\n @discard=\"undoChanges\"\n @save=\"saveChanges\" />\n <div class=\"flex flex-row items-center justify-between gap-2\">\n <div class=\"flex min-w-0 items-center gap-2\">\n <IconSelector\n :modelValue=\"icon\"\n placement=\"bottom-start\"\n @update:modelValue=\"\n (icon) => eventBus.emit('document:update:icon', icon)\n \">\n <ScalarButton\n class=\"hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit\"\n variant=\"ghost\">\n <LibraryIcon\n class=\"text-c-2 size-5\"\n :src=\"icon\"\n stroke-width=\"2\" />\n </ScalarButton>\n </IconSelector>\n\n <div class=\"group relative ml-1.25 min-w-0\">\n <LabelInput\n class=\"text-xl font-bold\"\n inputId=\"documentName\"\n :modelValue=\"title\"\n @update:modelValue=\"\n (title) => eventBus.emit('document:update:info', { title })\n \" />\n </div>\n </div>\n\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex shrink-0 items-center gap-2\"\n size=\"xs\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"downloadDocument\">\n <ScalarIconDownload\n size=\"sm\"\n thickness=\"1.5\" />\n <span>Download document</span>\n </ScalarButton>\n\n <ScalarButton\n v-if=\"canShowSyncButton\"\n class=\"text-c-2 hover:text-c-1 shrink-0 gap-1.5\"\n data-testid=\"document-sync-button\"\n :disabled=\"isSyncInProgress\"\n size=\"xs\"\n :title=\"'Pull the latest version from the document source and merge with your local copy. Save your changes first if you have unsaved edits.'\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"handleSyncFlow\">\n <ScalarIconSpinner\n v-if=\"isSyncInProgress\"\n class=\"size-3.5 animate-spin\"\n size=\"sm\" />\n <ScalarIconCloudArrowDown\n v-else\n class=\"size-3.5\"\n size=\"sm\"\n thickness=\"1.5\" />\n <span>Sync from source</span>\n </ScalarButton>\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"document\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 pt-8 pb-20\">\n <RouterView v-slot=\"{ Component }\">\n <component\n :is=\"Component\"\n v-bind=\"props\"\n collectionType=\"document\" />\n </RouterView>\n </div>\n </div>\n\n <!-- Document not found -->\n <div\n v-else\n class=\"flex w-full flex-1 items-center justify-center\">\n <div class=\"flex h-full flex-col items-center justify-center\">\n <h1 class=\"text-2xl font-bold\">Document not found</h1>\n <p class=\"text-gray-500\">\n The document you are looking for does not exist.\n </p>\n </div>\n </div>\n </div>\n <ScalarModal\n bodyClass=\"border-t-0 rounded-t-lg flex flex-col gap-5\"\n size=\"xs\"\n :state=\"dirtyBeforeSyncModal\"\n title=\"Sync requires saved document\"\n @close=\"dirtyBeforeSyncModal.hide()\">\n <div class=\"flex flex-col gap-5\">\n <div class=\"flex gap-3\">\n <div\n aria-hidden=\"true\"\n class=\"bg-b-3 text-c-2 flex size-10 shrink-0 items-center justify-center rounded-lg\">\n <ScalarIconWarning class=\"text-yellow size-5\" />\n </div>\n <div class=\"min-w-0 flex-1 space-y-1\">\n <p class=\"text-c-1 text-sm leading-snug font-medium\">\n You have unsaved changes\n </p>\n <p class=\"text-c-2 text-sm leading-relaxed\">\n Save your work to keep changes, or discard to revert to the last\n saved version. Then you can sync with the source.\n </p>\n </div>\n </div>\n <div class=\"flex flex-wrap items-center justify-end gap-2 border-t pt-4\">\n <ScalarButton\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"dirtyBeforeSyncModal.hide()\">\n Cancel\n </ScalarButton>\n <ScalarButton\n size=\"sm\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"handleDiscardThenCloseDirtyModal\">\n Discard changes\n </ScalarButton>\n <ScalarButton\n class=\"flex items-center gap-2\"\n size=\"sm\"\n type=\"button\"\n variant=\"solid\"\n @click=\"handleSaveThenCloseDirtyModal\">\n <ScalarIconFloppyDisk\n size=\"sm\"\n thickness=\"1.5\" />\n Save and continue\n </ScalarButton>\n </div>\n </div>\n </ScalarModal>\n <ScalarModal\n v-if=\"rebaseResult\"\n bodyClass=\"sync-conflict-modal-root flex h-dvh flex-col p-4\"\n maxWidth=\"calc(100dvw - 32px)\"\n size=\"full\"\n :state=\"syncModal\"\n @close=\"onSyncModalClose\">\n <div class=\"flex h-full w-full flex-col gap-4 overflow-hidden\">\n <SyncConflictResolutionEditor\n :baseDocument=\"rebaseResult.originalDocument\"\n :conflicts=\"rebaseResult.conflicts\"\n :resolvedDocument=\"rebaseResult.resolvedDocument\"\n @applyChanges=\"(payload) => handleApplyChanges(payload)\" />\n </div>\n </ScalarModal>\n</template>\n\n<style>\n.full-size-styles:has(.sync-conflict-modal-root) {\n width: 100dvw !important;\n max-width: 100dvw !important;\n border-right: none !important;\n}\n\n.full-size-styles:has(.sync-conflict-modal-root)::after {\n display: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUE,MAAM;;;;;;;;;;;;;;;;;;;;;EAkCR,MAAM,QAAQ;;EAGd,MAAM,QAAQ,eAAe,MAAM,UAAU,MAAM,SAAS,GAAE;;EAG9D,MAAM,OAAO,eACL,MAAM,WAAW,oBAAoB,2BAC7C;EAEA,MAAM,YAAY,UAAS;EAC3B,MAAM,uBAAuB,UAAS;EAEtC,MAAM,kBAAkB,eAChB,MAAM,WAAW,yBAAyB,KAClD;EAEA,MAAM,aAAa,iBAAgB;EAEnC,MAAM,oBAAoB,eAClB,MAAM,WAAW,gCACzB;EAEA,MAAM,uBAAuB,eAEzB,MAAM,WAAW,0BAGrB;;EAGA,MAAM,oBAAoB,eAEtB,kBAAkB,UAAU,KAAA,KAC5B,qBAAqB,UAAU,KAAA,EACnC;EAEA,MAAM,EAAE,UAAU,WAAU;EAE5B,MAAM,oBAAoB;AACxB,SAAM,eAAe,sBAAsB,MAAM,aAAY;;EAG/D,MAAM,cAAc,YAAY;AAC9B,cAAW,OAAM;AAEjB,UADY,MAAM,MAAM,eAAe,aAAa,MAAM,aAAY,GACzD,WAAW,UAAU,GAAG,WAAW,WAAW,EAAE,SAAS,MAAM,CAAC;;;EAI/E,MAAM,yBAAyB;GAC7B,MAAM,UAAU,MAAM,eAAe,eACnC,MAAM,cACN,QACA,MACF;AACA,OAAI,CAAC,QAAS;AAEd,kBAAe,SAAS,GADP,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oB,MAAA,qBAAA,EAAA;QADlB,MAAK;QACL,WAAU;uDAAQ,uBAEtB,GAAA,EAAA,CAAA;;;;;;IAKE,aAAA,SAAA,WAAA,EADR,YAcc,MAAA,YAAA,EAAA;;KAZZ,WAAU;KACV,UAAS;KACT,MAAK;KACJ,OAAO,MAAA,UAAS;KAChB,SAAO;;4BAOF,CANN,mBAMM,OANN,aAMM,CALJ,YAI6D,sCAAA;MAH1D,cAAc,aAAA,MAAa;MAC3B,WAAW,aAAA,MAAa;MACxB,kBAAkB,aAAA,MAAa;MAC/B,gBAAY,OAAA,OAAA,OAAA,MAAG,YAAY,mBAAmB,QAAO"}
1
+ {"version":3,"file":"DocumentCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Document Collection Page\n *\n * Displays primary document editing and viewing interface, enabling users to:\n * - Choose a document icon\n * - Edit the document title\n * - Navigate among Overview, Servers, Authentication, Environment, Cookies, and Settings tabs\n */\nexport default {\n name: 'DocumentCollection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarButton,\n ScalarModal,\n ScalarSavePrompt,\n useLoadingState,\n useModal,\n} from '@scalar/components'\nimport {\n ScalarIconCloudArrowDown,\n ScalarIconDownload,\n ScalarIconFloppyDisk,\n ScalarIconSpinner,\n ScalarIconWarning,\n} from '@scalar/icons'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { apply, type Difference, type merge } from '@scalar/json-magic/diff'\nimport { useToasts } from '@scalar/use-toasts'\nimport { deepClone } from '@scalar/workspace-store/helpers/deep-clone'\nimport { computed, ref } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport IconSelector from '@/components/IconSelector.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { downloadAsFile } from '@/v2/helpers/download-document'\n\nimport LabelInput from './components/LabelInput.vue'\nimport SyncConflictResolutionEditor from './components/SyncConflictResolutionEditor.vue'\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\n/** Snag the title from the info object */\nconst title = computed(() => props.document?.info?.title ?? '')\n\n/** Default to the folder icon */\nconst icon = computed(\n () => props.document?.['x-scalar-icon'] || 'interface-content-folder',\n)\n\nconst syncModal = useModal()\nconst dirtyBeforeSyncModal = useModal()\n\nconst isDocumentDirty = computed(\n () => props.document?.['x-scalar-is-dirty'] === true,\n)\n\nconst saveLoader = useLoadingState()\n\nconst documentSourceUrl = computed(\n () => props.document?.['x-scalar-original-source-url'] as string | undefined,\n)\n\nconst documentRegistryMeta = computed(\n () =>\n props.document?.['x-scalar-registry-meta'] as\n | { namespace: string; slug: string }\n | undefined,\n)\n\n/** Show Sync when the document has a source URL or registry meta (registry can be used if fetchRegistryDocument is set). */\nconst canShowSyncButton = computed(\n () =>\n documentSourceUrl.value !== undefined ||\n documentRegistryMeta.value !== undefined,\n)\n\nconst { toast } = useToasts()\n\nconst undoChanges = () => {\n props.workspaceStore.revertDocumentChanges(props.documentSlug)\n}\n\nconst saveChanges = async () => {\n saveLoader.start()\n const res = await props.workspaceStore.saveDocument(props.documentSlug)\n await (res ? saveLoader.validate() : saveLoader.invalidate({ persist: true }))\n}\n\n/** Downloads the document as a JSON file using the last saved state. */\nconst downloadDocument = () => {\n const content = props.workspaceStore.exportDocument(\n props.documentSlug,\n 'json',\n false,\n )\n if (!content) return\n const baseName = title.value.replace(/[^\\w\\s-]/g, '').trim() || 'document'\n downloadAsFile(content, `${baseName}.json`)\n}\n\nconst handleSaveThenCloseDirtyModal = async () => {\n await props.workspaceStore.saveDocument(props.documentSlug)\n dirtyBeforeSyncModal.hide()\n await handleSyncFlow()\n}\n\nconst handleDiscardThenCloseDirtyModal = async () => {\n await props.workspaceStore.revertDocumentChanges(props.documentSlug)\n dirtyBeforeSyncModal.hide()\n await handleSyncFlow()\n}\n\nconst isSyncInProgress = ref(false)\n\nconst rebaseResult = ref<{\n originalDocument: Record<string, unknown>\n resolvedDocument: Record<string, unknown>\n conflicts: ReturnType<typeof merge>['conflicts']\n applyChanges: (\n applyChangesInput:\n | {\n resolvedConflicts: Difference<unknown>[]\n }\n | {\n resolvedDocument: Record<string, unknown>\n },\n ) => Promise<void>\n} | null>(null)\n\n/**\n * Resolves the source for syncing. Registry meta has priority over x-scalar-original-source-url\n * when fetchRegistryDocument is provided. Returns either a URL or the full document object.\n */\nconst resolveSyncInput = async (): Promise<\n { url: string } | { document: Record<string, unknown> } | null\n> => {\n const registryMeta = documentRegistryMeta.value\n if (registryMeta && props.fetchRegistryDocument) {\n try {\n const result = await props.fetchRegistryDocument(registryMeta)\n if (!result.ok) {\n toast(result.error, 'error')\n return null\n }\n return { document: result.data }\n } catch (err) {\n toast('Failed to resolve document from registry', 'error')\n return null\n }\n }\n const url = documentSourceUrl.value\n if (url) {\n return { url }\n }\n return null\n}\n\n/**\n * Handles actions to perform when synchronization is complete.\n * Hides the sync modal, resets the sync progress flag, and emits the\n * 'hooks:on:rebase:document:complete' event with document metadata.\n */\nconst onSyncComplete = () => {\n syncModal.hide()\n isSyncInProgress.value = false\n // Display the toast to show that the sync is complete\n toast(\n 'Your document has been rebased with the latest version from the source.',\n 'info',\n )\n // Emit the event to notify other components that the sync is complete\n props.eventBus.emit('hooks:on:rebase:document:complete', {\n meta: {\n documentName: props.documentSlug,\n },\n })\n}\n\n/**\n * Handles errors that occur during synchronization.\n * If an error string is provided, it displays the error via toast.\n * Always resets the sync progress flag.\n */\nconst onSyncError = (error: string | null) => {\n if (error !== null) {\n toast(error, 'error')\n }\n isSyncInProgress.value = false\n}\n\n/**\n * Handles the synchronization flow for a document.\n * Checks for unsaved changes, resolves source (registry over URL),\n * initiates rebasing, handles conflicts, and emits completion events.\n * If conflicts are detected, a modal dialog is shown for user resolution.\n */\nconst handleSyncFlow = async () => {\n if (isDocumentDirty.value) {\n dirtyBeforeSyncModal.show()\n return\n }\n\n if (isSyncInProgress.value) {\n return\n }\n\n isSyncInProgress.value = true\n\n const input = await resolveSyncInput()\n if (!input) {\n onSyncError(null)\n return\n }\n\n const result = await props.workspaceStore.rebaseDocument({\n name: props.documentSlug,\n ...input,\n })\n\n if (result?.ok) {\n const originalDocument =\n props.workspaceStore.getOriginalDocument(props.documentSlug) ?? {}\n rebaseResult.value = {\n conflicts: result.conflicts,\n applyChanges: result.applyChanges,\n resolvedDocument: apply(deepClone(originalDocument), result.changes),\n originalDocument,\n }\n\n if (rebaseResult.value.conflicts.length > 0) {\n syncModal.show()\n } else {\n // If there is no conflict just rebase immediately\n await rebaseResult.value?.applyChanges({\n resolvedDocument: rebaseResult.value.resolvedDocument,\n })\n onSyncComplete()\n }\n } else if (result?.ok === false && result.type === 'NO_CHANGES_DETECTED') {\n // Emit the event either way even if there was no need to rebase the document\n onSyncComplete()\n } else {\n onSyncError('Failed to sync document')\n }\n}\n\n/*\n * Handles applying changes to the current document after conflict resolution.\n * Emits a completion event and hides the sync modal dialog.\n */\nconst handleApplyChanges = async ({\n resolvedDocument,\n}: {\n resolvedDocument: Record<string, unknown>\n}) => {\n await rebaseResult.value?.applyChanges({ resolvedDocument })\n props.eventBus.emit('hooks:on:rebase:document:complete', {\n meta: {\n documentName: props.documentSlug,\n },\n })\n syncModal.hide()\n}\n\n/**\n * Resets sync state when the sync conflict modal is closed (dismissed or after\n * applying changes). Ensures the Sync button is re-enabled and conflict state\n * is cleared.\n */\nconst onSyncModalClose = () => {\n isSyncInProgress.value = false\n rebaseResult.value = null\n}\n</script>\n\n<template>\n <div class=\"custom-scroll h-full\">\n <div\n v-if=\"document\"\n class=\"md:max-w-content w-full px-3 md:mx-auto\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${title}`\"\n class=\"md:max-w-content mx-auto flex h-fit w-full flex-col gap-2 pt-14 pb-3 md:pt-6\">\n <ScalarSavePrompt\n v-model=\"isDocumentDirty\"\n class=\"w-content-padded-4 max-w-full-padded-4 absolute\"\n :loader=\"saveLoader\"\n @discard=\"undoChanges\"\n @save=\"saveChanges\" />\n <div class=\"flex flex-row items-center justify-between gap-2\">\n <div class=\"flex min-w-0 items-center gap-2\">\n <IconSelector\n :modelValue=\"icon\"\n placement=\"bottom-start\"\n @update:modelValue=\"\n (icon) => eventBus.emit('document:update:icon', icon)\n \">\n <ScalarButton\n class=\"hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit\"\n variant=\"ghost\">\n <LibraryIcon\n class=\"text-c-2 size-5\"\n :src=\"icon\"\n stroke-width=\"2\" />\n </ScalarButton>\n </IconSelector>\n\n <div class=\"group relative ml-1.25 min-w-0\">\n <LabelInput\n class=\"text-xl font-bold\"\n inputId=\"documentName\"\n :modelValue=\"title\"\n @update:modelValue=\"\n (title) => eventBus.emit('document:update:info', { title })\n \" />\n </div>\n </div>\n\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex shrink-0 items-center gap-2\"\n size=\"xs\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"downloadDocument\">\n <ScalarIconDownload\n size=\"sm\"\n thickness=\"1.5\" />\n <span>Download document</span>\n </ScalarButton>\n\n <ScalarButton\n v-if=\"canShowSyncButton\"\n class=\"text-c-2 hover:text-c-1 shrink-0 gap-1.5\"\n data-testid=\"document-sync-button\"\n :disabled=\"isSyncInProgress\"\n size=\"xs\"\n :title=\"'Pull the latest version from the document source and merge with your local copy. Save your changes first if you have unsaved edits.'\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"handleSyncFlow\">\n <ScalarIconSpinner\n v-if=\"isSyncInProgress\"\n class=\"size-3.5 animate-spin\"\n size=\"sm\" />\n <ScalarIconCloudArrowDown\n v-else\n class=\"size-3.5\"\n size=\"sm\"\n thickness=\"1.5\" />\n <span>Sync from source</span>\n </ScalarButton>\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"document\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 pt-8 pb-20\">\n <RouterView v-slot=\"{ Component }\">\n <component\n :is=\"Component\"\n v-bind=\"props\"\n collectionType=\"document\" />\n </RouterView>\n </div>\n </div>\n\n <!-- Document not found -->\n <div\n v-else\n class=\"flex w-full flex-1 items-center justify-center\">\n <div class=\"flex h-full flex-col items-center justify-center\">\n <h1 class=\"text-2xl font-bold\">Document not found</h1>\n <p class=\"text-gray-500\">\n The document you are looking for does not exist.\n </p>\n </div>\n </div>\n </div>\n <ScalarModal\n bodyClass=\"border-t-0 rounded-t-lg flex flex-col gap-5\"\n size=\"xs\"\n :state=\"dirtyBeforeSyncModal\"\n title=\"Sync requires saved document\"\n @close=\"dirtyBeforeSyncModal.hide()\">\n <div class=\"flex flex-col gap-5\">\n <div class=\"flex gap-3\">\n <div\n aria-hidden=\"true\"\n class=\"bg-b-3 text-c-2 flex size-10 shrink-0 items-center justify-center rounded-lg\">\n <ScalarIconWarning class=\"text-yellow size-5\" />\n </div>\n <div class=\"min-w-0 flex-1 space-y-1\">\n <p class=\"text-c-1 text-sm leading-snug font-medium\">\n You have unsaved changes\n </p>\n <p class=\"text-c-2 text-sm leading-relaxed\">\n Save your work to keep changes, or discard to revert to the last\n saved version. Then you can sync with the source.\n </p>\n </div>\n </div>\n <div class=\"flex flex-wrap items-center justify-end gap-2 border-t pt-4\">\n <ScalarButton\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n @click=\"dirtyBeforeSyncModal.hide()\">\n Cancel\n </ScalarButton>\n <ScalarButton\n size=\"sm\"\n type=\"button\"\n variant=\"outlined\"\n @click=\"handleDiscardThenCloseDirtyModal\">\n Discard changes\n </ScalarButton>\n <ScalarButton\n class=\"flex items-center gap-2\"\n size=\"sm\"\n type=\"button\"\n variant=\"solid\"\n @click=\"handleSaveThenCloseDirtyModal\">\n <ScalarIconFloppyDisk\n size=\"sm\"\n thickness=\"1.5\" />\n Save and continue\n </ScalarButton>\n </div>\n </div>\n </ScalarModal>\n <ScalarModal\n v-if=\"rebaseResult\"\n bodyClass=\"sync-conflict-modal-root flex h-dvh flex-col p-4\"\n maxWidth=\"calc(100dvw - 32px)\"\n size=\"full\"\n :state=\"syncModal\"\n @close=\"onSyncModalClose\">\n <div class=\"flex h-full w-full flex-col gap-4 overflow-hidden\">\n <SyncConflictResolutionEditor\n :baseDocument=\"rebaseResult.originalDocument\"\n :conflicts=\"rebaseResult.conflicts\"\n :resolvedDocument=\"rebaseResult.resolvedDocument\"\n @applyChanges=\"(payload) => handleApplyChanges(payload)\" />\n </div>\n </ScalarModal>\n</template>\n\n<style>\n.full-size-styles:has(.sync-conflict-modal-root) {\n width: 100dvw !important;\n max-width: 100dvw !important;\n border-right: none !important;\n}\n\n.full-size-styles:has(.sync-conflict-modal-root)::after {\n display: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUE,MAAM;;;;;;;;;;;;;;;;;;;;;;EAkCR,MAAM,QAAQ;;EAGd,MAAM,QAAQ,eAAe,MAAM,UAAU,MAAM,SAAS,GAAE;;EAG9D,MAAM,OAAO,eACL,MAAM,WAAW,oBAAoB,2BAC7C;EAEA,MAAM,YAAY,UAAS;EAC3B,MAAM,uBAAuB,UAAS;EAEtC,MAAM,kBAAkB,eAChB,MAAM,WAAW,yBAAyB,KAClD;EAEA,MAAM,aAAa,iBAAgB;EAEnC,MAAM,oBAAoB,eAClB,MAAM,WAAW,gCACzB;EAEA,MAAM,uBAAuB,eAEzB,MAAM,WAAW,0BAGrB;;EAGA,MAAM,oBAAoB,eAEtB,kBAAkB,UAAU,KAAA,KAC5B,qBAAqB,UAAU,KAAA,EACnC;EAEA,MAAM,EAAE,UAAU,WAAU;EAE5B,MAAM,oBAAoB;AACxB,SAAM,eAAe,sBAAsB,MAAM,aAAY;;EAG/D,MAAM,cAAc,YAAY;AAC9B,cAAW,OAAM;AAEjB,UADY,MAAM,MAAM,eAAe,aAAa,MAAM,aAAY,GACzD,WAAW,UAAU,GAAG,WAAW,WAAW,EAAE,SAAS,MAAM,CAAC;;;EAI/E,MAAM,yBAAyB;GAC7B,MAAM,UAAU,MAAM,eAAe,eACnC,MAAM,c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,MAAK;OACL,MAAK;OACL,SAAQ;OACP,SAAO;;8BAGY,CAFpB,YAEoB,MAAA,qBAAA,EAAA;QADlB,MAAK;QACL,WAAU;uDAAQ,uBAEtB,GAAA,EAAA,CAAA;;;;;;IAKE,aAAA,SAAA,WAAA,EADR,YAcc,MAAA,YAAA,EAAA;;KAZZ,WAAU;KACV,UAAS;KACT,MAAK;KACJ,OAAO,MAAA,UAAS;KAChB,SAAO;;4BAOF,CANN,mBAMM,OANN,aAMM,CALJ,YAI6D,sCAAA;MAH1D,cAAc,aAAA,MAAa;MAC3B,WAAW,aAAA,MAAa;MACxB,kBAAkB,aAAA,MAAa;MAC/B,gBAAY,OAAA,OAAA,OAAA,MAAG,YAAY,mBAAmB,QAAO"}
@@ -36,7 +36,8 @@ var OperationCollection_vue_vue_type_script_setup_true_lang_default = /* @__PURE
36
36
  isDarkMode: { type: Boolean },
37
37
  fetchRegistryDocument: { type: Function },
38
38
  telemetry: { type: Boolean },
39
- onUpdateTelemetry: { type: Function }
39
+ onUpdateTelemetry: { type: Function },
40
+ options: {}
40
41
  },
41
42
  setup(__props) {
42
43
  const props = __props;
@@ -1 +1 @@
1
- {"version":3,"file":"OperationCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/OperationCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Document collection page — tabs for Overview, Servers, Auth, Environment, Cookies, and Settings. */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, ref, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport LabelInput from '@/v2/features/collection/components/LabelInput.vue'\n\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\nconst operation = computed(() => {\n if (!props.path || !props.method) {\n return undefined\n }\n\n return getResolvedRef(props.document?.paths?.[props.path]?.[props.method])\n})\n\n/**\n * Local copy of the label so we can reset on empty-blur rejection and stay in\n * sync when Vue Router reuses this component across workspace navigations.\n */\nconst operationSummary = ref(operation.value?.summary ?? '')\n\nwatch(\n () => operation.value?.summary,\n (newSummary) => {\n operationSummary.value = newSummary ?? ''\n },\n)\n\n/** Emits the rename event on blur, or resets the input if the title is blank. */\nconst handleSummaryUpdate = (payload: string) => {\n const { path, method } = props\n\n if (!path || !method || !isHttpMethod(method)) {\n return\n }\n\n props.eventBus.emit('operation:update:meta', {\n meta: { path, method },\n payload: {\n summary: payload.trim(),\n },\n })\n}\n\nconst operationPlaceholder = computed(() => {\n if (!props.path || !props.method) {\n return 'Untitled Operation'\n }\n return `${props.method.toUpperCase()} ${props.path}`\n})\n</script>\n\n<template>\n <div\n v-if=\"operation !== undefined\"\n class=\"custom-scroll h-full\">\n <div class=\"w-full px-3 md:mx-auto md:max-w-180\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${operationSummary}`\"\n class=\"mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8\">\n <div class=\"group relative ml-1.25\">\n <LabelInput\n v-model=\"operationSummary\"\n class=\"text-xl font-bold\"\n inputId=\"operationSummary\"\n :placeholder=\"operationPlaceholder\"\n @blur=\"handleSummaryUpdate\" />\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"operation\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 py-8\">\n <RouterView\n v-bind=\"props\"\n collectionType=\"operation\" />\n </div>\n </div>\n </div>\n\n <!-- Operation not found -->\n <div\n v-else\n class=\"flex w-full flex-1 items-center justify-center\">\n <div class=\"flex h-full flex-col items-center justify-center\">\n <h1 class=\"text-2xl font-bold\">Operation not found</h1>\n <p class=\"text-gray-500\">\n The operation you are looking for does not exist.\n </p>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,QAAQ;E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AAA,EAAnD,OAAM,sBAAoB,EAAC,sBAAmB,EAClD,mBAEI,KAAA,EAFD,OAAM,iBAAe,EAAC,sDAEzB,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"OperationCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/OperationCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Document collection page — tabs for Overview, Servers, Auth, Environment, Cookies, and Settings. */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, ref, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport LabelInput from '@/v2/features/collection/components/LabelInput.vue'\n\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\nconst operation = computed(() => {\n if (!props.path || !props.method) {\n return undefined\n }\n\n return getResolvedRef(props.document?.paths?.[props.path]?.[props.method])\n})\n\n/**\n * Local copy of the label so we can reset on empty-blur rejection and stay in\n * sync when Vue Router reuses this component across workspace navigations.\n */\nconst operationSummary = ref(operation.value?.summary ?? '')\n\nwatch(\n () => operation.value?.summary,\n (newSummary) => {\n operationSummary.value = newSummary ?? ''\n },\n)\n\n/** Emits the rename event on blur, or resets the input if the title is blank. */\nconst handleSummaryUpdate = (payload: string) => {\n const { path, method } = props\n\n if (!path || !method || !isHttpMethod(method)) {\n return\n }\n\n props.eventBus.emit('operation:update:meta', {\n meta: { path, method },\n payload: {\n summary: payload.trim(),\n },\n })\n}\n\nconst operationPlaceholder = computed(() => {\n if (!props.path || !props.method) {\n return 'Untitled Operation'\n }\n return `${props.method.toUpperCase()} ${props.path}`\n})\n</script>\n\n<template>\n <div\n v-if=\"operation !== undefined\"\n class=\"custom-scroll h-full\">\n <div class=\"w-full px-3 md:mx-auto md:max-w-180\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${operationSummary}`\"\n class=\"mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8\">\n <div class=\"group relative ml-1.25\">\n <LabelInput\n v-model=\"operationSummary\"\n class=\"text-xl font-bold\"\n inputId=\"operationSummary\"\n :placeholder=\"operationPlaceholder\"\n @blur=\"handleSummaryUpdate\" />\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"operation\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 py-8\">\n <RouterView\n v-bind=\"props\"\n collectionType=\"operation\" />\n </div>\n </div>\n </div>\n\n <!-- Operation not found -->\n <div\n v-else\n class=\"flex w-full flex-1 items-center justify-center\">\n <div class=\"flex h-full flex-col items-center justify-center\">\n <h1 class=\"text-2xl font-bold\">Operation not found</h1>\n <p class=\"text-gray-500\">\n The operation you are looking for does not exist.\n </p>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,QAAQ;EAEd,MAAM,YAAY,eAAe;AAC/B,OAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OACxB;AAGF,UAAO,eAAe,MAAM,UAAU,QAAQ,MAAM,QAAQ,MAAM,QAAO;IAC1E;;;;;EAMD,MAAM,mBAAmB,IAAI,UAAU,OAAO,WAAW,GAAE;AAE3D,cACQ,UAAU,OAAO,UACtB,eAAe;AACd,oBAAiB,QAAQ,cAAc;IAE3C;;EAGA,MAAM,uBAAuB,YAAoB;GAC/C,MAAM,EAAE,MAAM,WAAW;AAEzB,OAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,OAAO,CAC3C;AAGF,SAAM,SAAS,KAAK,yBAAyB;IAC3C,MAAM;KAAE;KAAM;KAAQ;IACtB,SAAS,EACP,SAAS,QAAQ,MAAM,EACxB;IACF,CAAA;;EAGH,MAAM,uBAAuB,eAAe;AAC1C,OAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,OACxB,QAAO;AAET,UAAO,GAAG,MAAM,OAAO,aAAa,CAAC,GAAG,MAAM;IAC/C;;UAKS,UAAA,UAAc,KAAA,KAAA,WAAA,EADtB,mBA4BM,OA5BN,YA4BM,CAzBJ,mBAwBM,OAxBN,YAwBM;IAtBJ,mBAWM,OAAA;KAVH,cAAU,UAAY,iBAAA;KACvB,OAAM;QACN,mBAOM,OAPN,YAOM,CANJ,YAKgC,oBAAA;iBAJrB,iBAAA;mFAAgB,QAAA;KACzB,OAAM;KACN,SAAQ;KACP,aAAa,qBAAA;KACb,QAAM;;IAKb,YAAyB,cAAA,EAAnB,MAAK,aAAW,CAAA;IAGtB,mBAIM,OAJN,YAIM,CAHJ,YAE+B,MAAA,WAAA,EAF/B,WACU,OAAK,EACb,gBAAe,aAAW,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA;yBAMlC,mBASM,OATN,YASM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CANJ,mBAKM,OAAA,EALD,OAAM,oDAAkD,EAAA,CAC3D,mBAAuD,MAAA,EAAnD,OAAM,sBAAoB,EAAC,sBAAmB,EAClD,mBAEI,KAAA,EAFD,OAAM,iBAAe,EAAC,sDAEzB,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA"}
@@ -27,7 +27,8 @@ var WorkspaceCollection_vue_vue_type_script_setup_true_lang_default = /* @__PURE
27
27
  isDarkMode: { type: Boolean },
28
28
  fetchRegistryDocument: { type: Function },
29
29
  telemetry: { type: Boolean },
30
- onUpdateTelemetry: { type: Function }
30
+ onUpdateTelemetry: { type: Function },
31
+ options: {}
31
32
  },
32
33
  setup(__props) {
33
34
  const props = __props;
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/WorkspaceCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Document collection page — tabs for Overview, Servers, Auth, Environment, Cookies, and Settings. */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport LabelInput from '@/v2/features/collection/components/LabelInput.vue'\n\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\n/**\n * Local copy of the label so we can reset on empty-blur rejection and stay in\n * sync when Vue Router reuses this component across workspace navigations.\n */\nconst workspaceTitle = ref(props.activeWorkspace.label)\n\nwatch(\n () => props.activeWorkspace.label,\n (newLabel) => {\n workspaceTitle.value = newLabel\n },\n)\n\n/** Emits the rename event on blur, or resets the input if the title is blank. */\nconst handleUpdateWorkspaceTitle = (title: string) => {\n if (title.trim() === '') {\n // Force defineModel inside LabelInput to re-sync to the original value.\n workspaceTitle.value = props.activeWorkspace.label\n return\n }\n props.eventBus.emit('workspace:update:name', title)\n}\n</script>\n\n<template>\n <div class=\"custom-scroll h-full\">\n <div class=\"w-full px-3 md:mx-auto md:max-w-180\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${activeWorkspace.label}`\"\n class=\"mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-6\">\n <div class=\"group relative ml-1.25\">\n <LabelInput\n v-model=\"workspaceTitle\"\n class=\"text-xl font-bold\"\n inputId=\"workspaceName\"\n placeholder=\"Untitled Workspace\"\n @blur=\"handleUpdateWorkspaceTitle\" />\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"workspace\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 py-8\">\n <RouterView\n v-bind=\"props\"\n collectionType=\"workspace\" />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,QAAQ;;;;;EAMd,MAAM,iBAAiB,IAAI,MAAM,gBAAgB,MAAK;AAEtD,cACQ,MAAM,gBAAgB,QAC3B,aAAa;AACZ,kBAAe,QAAQ;IAE3B;;EAGA,MAAM,8BAA8B,UAAkB;AACpD,OAAI,MAAM,MAAM,KAAK,IAAI;AAEvB,mBAAe,QAAQ,MAAM,gBAAgB;AAC7C;;AAEF,SAAM,SAAS,KAAK,yBAAyB,MAAK;;;uBAKlD,mBA0BM,OA1BN,YA0BM,CAzBJ,mBAwBM,OAxBN,YAwBM;IAtBJ,mBAWM,OAAA;KAVH,cAAU,UAAY,QAAA,gBAAgB;KACvC,OAAM;QACN,mBAOM,OAPN,YAOM,CANJ,YAKuC,oBAAA;iBAJ5B,eAAA;iFAAc,QAAA;KACvB,OAAM;KACN,SAAQ;KACR,aAAY;KACX,QAAM;;IAKb,YAAyB,cAAA,EAAnB,MAAK,aAAW,CAAA;IAGtB,mBAIM,OAJN,YAIM,CAHJ,YAE+B,MAAA,WAAA,EAF/B,WACU,OAAK,EACb,gBAAe,aAAW,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"WorkspaceCollection.vue.script.js","names":[],"sources":["../../../../src/v2/features/collection/WorkspaceCollection.vue"],"sourcesContent":["<script lang=\"ts\">\n/** Document collection page — tabs for Overview, Servers, Auth, Environment, Cookies, and Settings. */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport LabelInput from '@/v2/features/collection/components/LabelInput.vue'\n\nimport Tabs from './components/Tabs.vue'\n\nconst props = defineProps<RouteProps>()\n\n/**\n * Local copy of the label so we can reset on empty-blur rejection and stay in\n * sync when Vue Router reuses this component across workspace navigations.\n */\nconst workspaceTitle = ref(props.activeWorkspace.label)\n\nwatch(\n () => props.activeWorkspace.label,\n (newLabel) => {\n workspaceTitle.value = newLabel\n },\n)\n\n/** Emits the rename event on blur, or resets the input if the title is blank. */\nconst handleUpdateWorkspaceTitle = (title: string) => {\n if (title.trim() === '') {\n // Force defineModel inside LabelInput to re-sync to the original value.\n workspaceTitle.value = props.activeWorkspace.label\n return\n }\n props.eventBus.emit('workspace:update:name', title)\n}\n</script>\n\n<template>\n <div class=\"custom-scroll h-full\">\n <div class=\"w-full px-3 md:mx-auto md:max-w-180\">\n <!-- Header -->\n <div\n :aria-label=\"`title: ${activeWorkspace.label}`\"\n class=\"mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-6\">\n <div class=\"group relative ml-1.25\">\n <LabelInput\n v-model=\"workspaceTitle\"\n class=\"text-xl font-bold\"\n inputId=\"workspaceName\"\n placeholder=\"Untitled Workspace\"\n @blur=\"handleUpdateWorkspaceTitle\" />\n </div>\n </div>\n\n <!-- Tabs -->\n <Tabs type=\"workspace\" />\n\n <!-- Router views -->\n <div class=\"px-1.5 py-8\">\n <RouterView\n v-bind=\"props\"\n collectionType=\"workspace\" />\n </div>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,QAAQ;;;;;EAMd,MAAM,iBAAiB,IAAI,MAAM,gBAAgB,MAAK;AAEtD,cACQ,MAAM,gBAAgB,QAC3B,aAAa;AACZ,kBAAe,QAAQ;IAE3B;;EAGA,MAAM,8BAA8B,UAAkB;AACpD,OAAI,MAAM,MAAM,KAAK,IAAI;AAEvB,mBAAe,QAAQ,MAAM,gBAAgB;AAC7C;;AAEF,SAAM,SAAS,KAAK,yBAAyB,MAAK;;;uBAKlD,mBA0BM,OA1BN,YA0BM,CAzBJ,mBAwBM,OAxBN,YAwBM;IAtBJ,mBAWM,OAAA;KAVH,cAAU,UAAY,QAAA,gBAAgB;KACvC,OAAM;QACN,mBAOM,OAPN,YAOM,CANJ,YAKuC,oBAAA;iBAJ5B,eAAA;iFAAc,QAAA;KACvB,OAAM;KACN,SAAQ;KACR,aAAY;KACX,QAAM;;IAKb,YAAyB,cAAA,EAAnB,MAAK,aAAW,CAAA;IAGtB,mBAIM,OAJN,YAIM,CAHJ,YAE+B,MAAA,WAAA,EAF/B,WACU,OAAK,EACb,gBAAe,aAAW,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Authentication.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"names":[],"mappings":"AA+jBA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Authentication.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"names":[],"mappings":"AA+lBA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import Authentication_vue_vue_type_script_setup_true_lang_default from "./Authentication.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/features/collection/components/Authentication.vue
5
- var Authentication_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Authentication_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6bba6b78"]]);
5
+ var Authentication_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Authentication_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-d3bc49bd"]]);
6
6
  //#endregion
7
7
  export { Authentication_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"Authentication.vue.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarToggle } from '@scalar/components'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { AuthMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getActiveProxyUrl,\n getSelectedSecurity,\n getServers,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport { computed, ref, watchEffect } from 'vue'\n\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { getDefaultOperationSecurityToggle } from '@/v2/features/collection/helpers/get-default-operation-security-toggle'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst {\n document,\n eventBus,\n environment,\n workspaceStore,\n documentSlug,\n path,\n method,\n collectionType,\n layout,\n} = defineProps<CollectionProps>()\n\n/**\n * Compute the authentication metadata based on the current collection type.\n * If we're working with an operation, include its path and method; otherwise, use the document scope.\n */\nconst authMeta = computed<AuthMeta>(() => {\n if (collectionType === 'operation') {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n return { type: 'document' }\n})\n\n/**\n * Compute the operation object based on the current collection type.\n */\nconst operation = computed(() => {\n if (collectionType === 'operation') {\n // Operation not found\n if (!path || !isHttpMethod(method)) {\n return null\n }\n // Operation found, return the servers\n return getResolvedRef(document?.paths?.[path]?.[method])\n }\n return null\n})\n\n/**\n * If enabled we use/set the selected security schemes on the operation level\n */\nconst useOperationSecurity = ref(false)\nwatchEffect(() => {\n useOperationSecurity.value = getDefaultOperationSecurityToggle({\n authStore: workspaceStore.auth,\n documentName: documentSlug,\n ...authMeta.value,\n })\n})\n\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n {},\n workspaceStore.auth,\n documentSlug,\n ),\n)\n\n/** Resolved selected security for the current collection (operation or document), with defaults applied */\nconst selectedSecurity = computed(() => {\n if (collectionType === 'operation') {\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n return getSelectedSecurity(\n undefined,\n fromStore,\n operation.value?.security ?? [],\n securitySchemes.value,\n )\n }\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n return getSelectedSecurity(\n fromStore,\n undefined,\n document?.security ?? [],\n securitySchemes.value,\n )\n})\n\n/** Compute the security requirements for the operation or document based on the current collection type */\nconst securityRequirements = computed(() => {\n if (collectionType === 'operation') {\n return operation.value?.security ?? []\n }\n return document?.security ?? []\n})\n\n/** Compute the proxy URL for the current layout (for the electron we don't want to use the proxy by default) */\nconst proxyUrl = computed(\n () =>\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? '',\n)\n\nconst servers = computed(() => {\n return getServers(operation.value?.servers ?? document?.servers, {\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Grab the currently selected server for relative auth URIs */\nconst server = computed(() => {\n const documentServer = document?.['x-scalar-selected-server']\n const operationServer = operation.value?.['x-scalar-selected-server']\n const selectedServerUrl = operationServer ?? documentServer\n return (\n servers.value.find(({ url }) => url === selectedServerUrl) ??\n servers.value[0] ??\n null\n )\n})\n\n/**\n * Handles toggling operation-level security authentication. (Only for operation collections)\n * When enabled (`value` is true), overrides document-level authentication for the current operation.\n * When disabled (`value` is false), reverts to using document-level authentication instead.\n */\nconst handleToggleOperationSecurity = (value: boolean) => {\n if (authMeta.value.type !== 'operation') {\n return\n }\n\n useOperationSecurity.value = value\n\n if (value) {\n // Use the same resolved selection as the UI; unpack so the event payload is plain objects\n const { selectedSchemes } = selectedSecurity.value\n return eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: unpackProxyObject(selectedSchemes, { depth: 1 }),\n newSchemes: [],\n meta: authMeta.value,\n })\n }\n\n // Clear the operation security so document level authentication is used\n return eventBus.emit('auth:clear:selected-security-schemes', {\n meta: authMeta.value,\n })\n}\n</script>\n\n<template>\n <Section>\n <template #title>Authentication</template>\n <template #description>\n <template v-if=\"collectionType === 'operation'\">\n <span class=\"block\">\n Override authentication for this operation with the toggle.\n </span>\n <span class=\"mt-1 block\">\n <strong>On</strong> — Authentication below applies only to this\n operation.\n </span>\n <span class=\"mt-1 block\">\n <strong>Off</strong> — This operation uses document-level\n authentication from the OpenAPI spec.\n </span>\n </template>\n <template v-else>\n Configure authentication for this document. Selected authentication\n applies to all operations unless overridden at the operation level.\n </template>\n </template>\n <template\n v-if=\"collectionType === 'operation'\"\n #actions>\n <div class=\"flex h-8 items-center\">\n <ScalarToggle\n class=\"w-4\"\n :modelValue=\"useOperationSecurity\"\n @update:modelValue=\"handleToggleOperationSecurity\" />\n </div>\n </template>\n\n <!-- Auth Selector -->\n <div\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'cursor-not-allowed'\n \">\n <AuthSelector\n class=\"scalar-collection-auth border-none!\"\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'pointer-events-none opacity-50 mix-blend-luminosity'\n \"\n :createAnySecurityScheme=\"true\"\n :environment\n :eventBus=\"eventBus\"\n isStatic\n :meta=\"authMeta\"\n :proxyUrl=\"proxyUrl\"\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedSecurity=\"selectedSecurity\"\n :server\n title=\"Authentication\" />\n </div>\n </Section>\n</template>\n<style scoped>\n.scalar-collection-auth {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"Authentication.vue.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarToggle } from '@scalar/components'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { AuthMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getActiveProxyUrl,\n getSelectedSecurity,\n getServers,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport { computed, ref, toValue, watchEffect } from 'vue'\n\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { getDefaultOperationSecurityToggle } from '@/v2/features/collection/helpers/get-default-operation-security-toggle'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst {\n document,\n eventBus,\n environment,\n workspaceStore,\n documentSlug,\n path,\n method,\n collectionType,\n layout,\n options,\n} = defineProps<CollectionProps>()\n\n/**\n * Compute the authentication metadata based on the current collection type.\n * If we're working with an operation, include its path and method; otherwise, use the document scope.\n */\nconst authMeta = computed<AuthMeta>(() => {\n if (collectionType === 'operation') {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n return { type: 'document' }\n})\n\n/**\n * Compute the operation object based on the current collection type.\n */\nconst operation = computed(() => {\n if (collectionType === 'operation') {\n // Operation not found\n if (!path || !isHttpMethod(method)) {\n return null\n }\n // Operation found, return the servers\n return getResolvedRef(document?.paths?.[path]?.[method])\n }\n return null\n})\n\n/**\n * If enabled we use/set the selected security schemes on the operation level\n */\nconst useOperationSecurity = ref(false)\nwatchEffect(() => {\n useOperationSecurity.value = getDefaultOperationSecurityToggle({\n authStore: workspaceStore.auth,\n documentName: documentSlug,\n ...authMeta.value,\n })\n})\n\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n {},\n workspaceStore.auth,\n documentSlug,\n ),\n)\n\n/** Resolved selected security for the current collection (operation or document), with defaults applied */\nconst selectedSecurity = computed(() => {\n if (collectionType === 'operation') {\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n return getSelectedSecurity(\n undefined,\n fromStore,\n operation.value?.security ?? [],\n securitySchemes.value,\n )\n }\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n return getSelectedSecurity(\n fromStore,\n undefined,\n document?.security ?? [],\n securitySchemes.value,\n )\n})\n\n/** Compute the security requirements for the operation or document based on the current collection type */\nconst securityRequirements = computed(() => {\n if (collectionType === 'operation') {\n return operation.value?.security ?? []\n }\n return document?.security ?? []\n})\n\n/** Compute the proxy URL for the current layout (for the electron we don't want to use the proxy by default) */\nconst proxyUrl = computed(\n () =>\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? '',\n)\n\nconst servers = computed(() => {\n return getServers(operation.value?.servers ?? document?.servers, {\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Grab the currently selected server for relative auth URIs */\nconst server = computed(() => {\n const documentServer = document?.['x-scalar-selected-server']\n const operationServer = operation.value?.['x-scalar-selected-server']\n const selectedServerUrl = operationServer ?? documentServer\n return (\n servers.value.find(({ url }) => url === selectedServerUrl) ??\n servers.value[0] ??\n null\n )\n})\n\n/** Auth selector only needs OAuth2-specific option overrides. */\nconst authOptions = computed<OAuth2Options | undefined>(() => {\n const routeOptions = toValue(options)\n if (!routeOptions?.oauth2RedirectUri) {\n return undefined\n }\n\n return {\n oauth2RedirectUri: routeOptions.oauth2RedirectUri,\n }\n})\n\n/**\n * Handles toggling operation-level security authentication. (Only for operation collections)\n * When enabled (`value` is true), overrides document-level authentication for the current operation.\n * When disabled (`value` is false), reverts to using document-level authentication instead.\n */\nconst handleToggleOperationSecurity = (value: boolean) => {\n if (authMeta.value.type !== 'operation') {\n return\n }\n\n useOperationSecurity.value = value\n\n if (value) {\n // Use the same resolved selection as the UI; unpack so the event payload is plain objects\n const { selectedSchemes } = selectedSecurity.value\n return eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: unpackProxyObject(selectedSchemes, { depth: 1 }),\n newSchemes: [],\n meta: authMeta.value,\n })\n }\n\n // Clear the operation security so document level authentication is used\n return eventBus.emit('auth:clear:selected-security-schemes', {\n meta: authMeta.value,\n })\n}\n</script>\n\n<template>\n <Section>\n <template #title>Authentication</template>\n <template #description>\n <template v-if=\"collectionType === 'operation'\">\n <span class=\"block\">\n Override authentication for this operation with the toggle.\n </span>\n <span class=\"mt-1 block\">\n <strong>On</strong> — Authentication below applies only to this\n operation.\n </span>\n <span class=\"mt-1 block\">\n <strong>Off</strong> — This operation uses document-level\n authentication from the OpenAPI spec.\n </span>\n </template>\n <template v-else>\n Configure authentication for this document. Selected authentication\n applies to all operations unless overridden at the operation level.\n </template>\n </template>\n <template\n v-if=\"collectionType === 'operation'\"\n #actions>\n <div class=\"flex h-8 items-center\">\n <ScalarToggle\n class=\"w-4\"\n :modelValue=\"useOperationSecurity\"\n @update:modelValue=\"handleToggleOperationSecurity\" />\n </div>\n </template>\n\n <!-- Auth Selector -->\n <div\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'cursor-not-allowed'\n \">\n <AuthSelector\n class=\"scalar-collection-auth border-none!\"\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'pointer-events-none opacity-50 mix-blend-luminosity'\n \"\n :createAnySecurityScheme=\"true\"\n :environment\n :eventBus=\"eventBus\"\n isStatic\n :meta=\"authMeta\"\n :options=\"authOptions\"\n :proxyUrl=\"proxyUrl\"\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedSecurity=\"selectedSecurity\"\n :server\n title=\"Authentication\" />\n </div>\n </Section>\n</template>\n<style scoped>\n.scalar-collection-auth {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n}\n</style>\n"],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import AuthSelector_default from "../../../blocks/scalar-auth-selector-block/components/AuthSelector.vue.js";
2
2
  import { getDefaultOperationSecurityToggle } from "../helpers/get-default-operation-security-toggle.js";
3
3
  import Section_default from "../../settings/components/Section.vue.js";
4
- import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, unref, watchEffect, withCtx } from "vue";
4
+ import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toValue, unref, watchEffect, withCtx } from "vue";
5
5
  import { ScalarToggle } from "@scalar/components";
6
6
  import { getActiveProxyUrl, getSelectedSecurity, getServers, mergeSecurity } from "@scalar/workspace-store/request-example";
7
7
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
@@ -29,6 +29,7 @@ var Authentication_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
29
29
  fetchRegistryDocument: { type: Function },
30
30
  telemetry: { type: Boolean },
31
31
  onUpdateTelemetry: { type: Function },
32
+ options: {},
32
33
  collectionType: {}
33
34
  },
34
35
  setup(__props) {
@@ -95,6 +96,12 @@ var Authentication_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
95
96
  const selectedServerUrl = operation.value?.["x-scalar-selected-server"] ?? documentServer;
96
97
  return servers.value.find(({ url }) => url === selectedServerUrl) ?? servers.value[0] ?? null;
97
98
  });
99
+ /** Auth selector only needs OAuth2-specific option overrides. */
100
+ const authOptions = computed(() => {
101
+ const routeOptions = toValue(__props.options);
102
+ if (!routeOptions?.oauth2RedirectUri) return;
103
+ return { oauth2RedirectUri: routeOptions.oauth2RedirectUri };
104
+ });
98
105
  /**
99
106
  * Handles toggling operation-level security authentication. (Only for operation collections)
100
107
  * When enabled (`value` is true), overrides document-level authentication for the current operation.
@@ -128,6 +135,7 @@ var Authentication_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
128
135
  eventBus: __props.eventBus,
129
136
  isStatic: "",
130
137
  meta: authMeta.value,
138
+ options: authOptions.value,
131
139
  proxyUrl: proxyUrl.value,
132
140
  securityRequirements: securityRequirements.value,
133
141
  securitySchemes: securitySchemes.value,
@@ -139,6 +147,7 @@ var Authentication_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
139
147
  "environment",
140
148
  "eventBus",
141
149
  "meta",
150
+ "options",
142
151
  "proxyUrl",
143
152
  "securityRequirements",
144
153
  "securitySchemes",
@@ -1 +1 @@
1
- {"version":3,"file":"Authentication.vue.script.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarToggle } from '@scalar/components'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { AuthMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getActiveProxyUrl,\n getSelectedSecurity,\n getServers,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport { computed, ref, watchEffect } from 'vue'\n\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { getDefaultOperationSecurityToggle } from '@/v2/features/collection/helpers/get-default-operation-security-toggle'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst {\n document,\n eventBus,\n environment,\n workspaceStore,\n documentSlug,\n path,\n method,\n collectionType,\n layout,\n} = defineProps<CollectionProps>()\n\n/**\n * Compute the authentication metadata based on the current collection type.\n * If we're working with an operation, include its path and method; otherwise, use the document scope.\n */\nconst authMeta = computed<AuthMeta>(() => {\n if (collectionType === 'operation') {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n return { type: 'document' }\n})\n\n/**\n * Compute the operation object based on the current collection type.\n */\nconst operation = computed(() => {\n if (collectionType === 'operation') {\n // Operation not found\n if (!path || !isHttpMethod(method)) {\n return null\n }\n // Operation found, return the servers\n return getResolvedRef(document?.paths?.[path]?.[method])\n }\n return null\n})\n\n/**\n * If enabled we use/set the selected security schemes on the operation level\n */\nconst useOperationSecurity = ref(false)\nwatchEffect(() => {\n useOperationSecurity.value = getDefaultOperationSecurityToggle({\n authStore: workspaceStore.auth,\n documentName: documentSlug,\n ...authMeta.value,\n })\n})\n\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n {},\n workspaceStore.auth,\n documentSlug,\n ),\n)\n\n/** Resolved selected security for the current collection (operation or document), with defaults applied */\nconst selectedSecurity = computed(() => {\n if (collectionType === 'operation') {\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n return getSelectedSecurity(\n undefined,\n fromStore,\n operation.value?.security ?? [],\n securitySchemes.value,\n )\n }\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n return getSelectedSecurity(\n fromStore,\n undefined,\n document?.security ?? [],\n securitySchemes.value,\n )\n})\n\n/** Compute the security requirements for the operation or document based on the current collection type */\nconst securityRequirements = computed(() => {\n if (collectionType === 'operation') {\n return operation.value?.security ?? []\n }\n return document?.security ?? []\n})\n\n/** Compute the proxy URL for the current layout (for the electron we don't want to use the proxy by default) */\nconst proxyUrl = computed(\n () =>\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? '',\n)\n\nconst servers = computed(() => {\n return getServers(operation.value?.servers ?? document?.servers, {\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Grab the currently selected server for relative auth URIs */\nconst server = computed(() => {\n const documentServer = document?.['x-scalar-selected-server']\n const operationServer = operation.value?.['x-scalar-selected-server']\n const selectedServerUrl = operationServer ?? documentServer\n return (\n servers.value.find(({ url }) => url === selectedServerUrl) ??\n servers.value[0] ??\n null\n )\n})\n\n/**\n * Handles toggling operation-level security authentication. (Only for operation collections)\n * When enabled (`value` is true), overrides document-level authentication for the current operation.\n * When disabled (`value` is false), reverts to using document-level authentication instead.\n */\nconst handleToggleOperationSecurity = (value: boolean) => {\n if (authMeta.value.type !== 'operation') {\n return\n }\n\n useOperationSecurity.value = value\n\n if (value) {\n // Use the same resolved selection as the UI; unpack so the event payload is plain objects\n const { selectedSchemes } = selectedSecurity.value\n return eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: unpackProxyObject(selectedSchemes, { depth: 1 }),\n newSchemes: [],\n meta: authMeta.value,\n })\n }\n\n // Clear the operation security so document level authentication is used\n return eventBus.emit('auth:clear:selected-security-schemes', {\n meta: authMeta.value,\n })\n}\n</script>\n\n<template>\n <Section>\n <template #title>Authentication</template>\n <template #description>\n <template v-if=\"collectionType === 'operation'\">\n <span class=\"block\">\n Override authentication for this operation with the toggle.\n </span>\n <span class=\"mt-1 block\">\n <strong>On</strong> — Authentication below applies only to this\n operation.\n </span>\n <span class=\"mt-1 block\">\n <strong>Off</strong> — This operation uses document-level\n authentication from the OpenAPI spec.\n </span>\n </template>\n <template v-else>\n Configure authentication for this document. Selected authentication\n applies to all operations unless overridden at the operation level.\n </template>\n </template>\n <template\n v-if=\"collectionType === 'operation'\"\n #actions>\n <div class=\"flex h-8 items-center\">\n <ScalarToggle\n class=\"w-4\"\n :modelValue=\"useOperationSecurity\"\n @update:modelValue=\"handleToggleOperationSecurity\" />\n </div>\n </template>\n\n <!-- Auth Selector -->\n <div\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'cursor-not-allowed'\n \">\n <AuthSelector\n class=\"scalar-collection-auth border-none!\"\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'pointer-events-none opacity-50 mix-blend-luminosity'\n \"\n :createAnySecurityScheme=\"true\"\n :environment\n :eventBus=\"eventBus\"\n isStatic\n :meta=\"authMeta\"\n :proxyUrl=\"proxyUrl\"\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedSecurity=\"selectedSecurity\"\n :server\n title=\"Authentication\" />\n </div>\n </Section>\n</template>\n<style scoped>\n.scalar-collection-auth {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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B,CAAA,EAAA,GAAA;4BAEF,mBAGW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,gBAHM,4IAGjB,CAAA,EAAA,GAAA,EAAA,CAAA;2BAsCI,CAxBN,mBAwBM,OAAA,EAvBH,OAAK,eAAW,QAAA,mBAAc,eAAA,CAA6B,qBAAA,SAAA,qBAAA,EAAA,EAAA,CAK5D,YAiB2B,MAAA,qBAAA,EAAA;KAhBzB,OAAK,eAAA,CAAC,uCACa,QAAA,mBAAc,eAAA,CAA+B,qBAAA,SAAA,sDAAA,CAAA;KAK/D,yBAAyB;KACzB,aAAA,QAAA;KACA,UAAU,QAAA;KACX,UAAA;KACC,MAAM,SAAA;KACN,UAAU,SAAA;KACV,sBAAsB,qBAAA;KACtB,iBAAA,gBAAA;KACA,kBAAkB,iBAAA;KAClB,QAAA,OAAA;KACD,OAAM;;;;;;;;;;;;;OAlCF,QAAA,mBAAc,cAAA;UACnB;sBAMK,CALN,mBAKM,OALN,YAKM,CAJJ,YAGuD,MAAA,aAAA,EAAA;KAFrD,OAAM;KACL,YAAY,qBAAA;KACZ,uBAAmB"}
1
+ {"version":3,"file":"Authentication.vue.script.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarToggle } from '@scalar/components'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { AuthMeta } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport {\n getActiveProxyUrl,\n getSelectedSecurity,\n getServers,\n mergeSecurity,\n} from '@scalar/workspace-store/request-example'\nimport { computed, ref, toValue, watchEffect } from 'vue'\n\nimport { AuthSelector } from '@/v2/blocks/scalar-auth-selector-block'\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { getDefaultOperationSecurityToggle } from '@/v2/features/collection/helpers/get-default-operation-security-toggle'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst {\n document,\n eventBus,\n environment,\n workspaceStore,\n documentSlug,\n path,\n method,\n collectionType,\n layout,\n options,\n} = defineProps<CollectionProps>()\n\n/**\n * Compute the authentication metadata based on the current collection type.\n * If we're working with an operation, include its path and method; otherwise, use the document scope.\n */\nconst authMeta = computed<AuthMeta>(() => {\n if (collectionType === 'operation') {\n return {\n type: 'operation',\n path: path ?? '',\n method: method ?? 'get',\n }\n }\n return { type: 'document' }\n})\n\n/**\n * Compute the operation object based on the current collection type.\n */\nconst operation = computed(() => {\n if (collectionType === 'operation') {\n // Operation not found\n if (!path || !isHttpMethod(method)) {\n return null\n }\n // Operation found, return the servers\n return getResolvedRef(document?.paths?.[path]?.[method])\n }\n return null\n})\n\n/**\n * If enabled we use/set the selected security schemes on the operation level\n */\nconst useOperationSecurity = ref(false)\nwatchEffect(() => {\n useOperationSecurity.value = getDefaultOperationSecurityToggle({\n authStore: workspaceStore.auth,\n documentName: documentSlug,\n ...authMeta.value,\n })\n})\n\nconst securitySchemes = computed(() =>\n mergeSecurity(\n document?.components?.securitySchemes ?? {},\n {},\n workspaceStore.auth,\n documentSlug,\n ),\n)\n\n/** Resolved selected security for the current collection (operation or document), with defaults applied */\nconst selectedSecurity = computed(() => {\n if (collectionType === 'operation') {\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'operation',\n documentName: documentSlug,\n path: path ?? '',\n method: method ?? 'get',\n })\n return getSelectedSecurity(\n undefined,\n fromStore,\n operation.value?.security ?? [],\n securitySchemes.value,\n )\n }\n const fromStore = workspaceStore.auth.getAuthSelectedSchemas({\n type: 'document',\n documentName: documentSlug,\n })\n return getSelectedSecurity(\n fromStore,\n undefined,\n document?.security ?? [],\n securitySchemes.value,\n )\n})\n\n/** Compute the security requirements for the operation or document based on the current collection type */\nconst securityRequirements = computed(() => {\n if (collectionType === 'operation') {\n return operation.value?.security ?? []\n }\n return document?.security ?? []\n})\n\n/** Compute the proxy URL for the current layout (for the electron we don't want to use the proxy by default) */\nconst proxyUrl = computed(\n () =>\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? '',\n)\n\nconst servers = computed(() => {\n return getServers(operation.value?.servers ?? document?.servers, {\n documentUrl: document?.['x-scalar-original-source-url'],\n })\n})\n\n/** Grab the currently selected server for relative auth URIs */\nconst server = computed(() => {\n const documentServer = document?.['x-scalar-selected-server']\n const operationServer = operation.value?.['x-scalar-selected-server']\n const selectedServerUrl = operationServer ?? documentServer\n return (\n servers.value.find(({ url }) => url === selectedServerUrl) ??\n servers.value[0] ??\n null\n )\n})\n\n/** Auth selector only needs OAuth2-specific option overrides. */\nconst authOptions = computed<OAuth2Options | undefined>(() => {\n const routeOptions = toValue(options)\n if (!routeOptions?.oauth2RedirectUri) {\n return undefined\n }\n\n return {\n oauth2RedirectUri: routeOptions.oauth2RedirectUri,\n }\n})\n\n/**\n * Handles toggling operation-level security authentication. (Only for operation collections)\n * When enabled (`value` is true), overrides document-level authentication for the current operation.\n * When disabled (`value` is false), reverts to using document-level authentication instead.\n */\nconst handleToggleOperationSecurity = (value: boolean) => {\n if (authMeta.value.type !== 'operation') {\n return\n }\n\n useOperationSecurity.value = value\n\n if (value) {\n // Use the same resolved selection as the UI; unpack so the event payload is plain objects\n const { selectedSchemes } = selectedSecurity.value\n return eventBus.emit('auth:update:selected-security-schemes', {\n selectedRequirements: unpackProxyObject(selectedSchemes, { depth: 1 }),\n newSchemes: [],\n meta: authMeta.value,\n })\n }\n\n // Clear the operation security so document level authentication is used\n return eventBus.emit('auth:clear:selected-security-schemes', {\n meta: authMeta.value,\n })\n}\n</script>\n\n<template>\n <Section>\n <template #title>Authentication</template>\n <template #description>\n <template v-if=\"collectionType === 'operation'\">\n <span class=\"block\">\n Override authentication for this operation with the toggle.\n </span>\n <span class=\"mt-1 block\">\n <strong>On</strong> — Authentication below applies only to this\n operation.\n </span>\n <span class=\"mt-1 block\">\n <strong>Off</strong> — This operation uses document-level\n authentication from the OpenAPI spec.\n </span>\n </template>\n <template v-else>\n Configure authentication for this document. Selected authentication\n applies to all operations unless overridden at the operation level.\n </template>\n </template>\n <template\n v-if=\"collectionType === 'operation'\"\n #actions>\n <div class=\"flex h-8 items-center\">\n <ScalarToggle\n class=\"w-4\"\n :modelValue=\"useOperationSecurity\"\n @update:modelValue=\"handleToggleOperationSecurity\" />\n </div>\n </template>\n\n <!-- Auth Selector -->\n <div\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'cursor-not-allowed'\n \">\n <AuthSelector\n class=\"scalar-collection-auth border-none!\"\n :class=\"\n collectionType === 'operation' &&\n !useOperationSecurity &&\n 'pointer-events-none opacity-50 mix-blend-luminosity'\n \"\n :createAnySecurityScheme=\"true\"\n :environment\n :eventBus=\"eventBus\"\n isStatic\n :meta=\"authMeta\"\n :options=\"authOptions\"\n :proxyUrl=\"proxyUrl\"\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedSecurity=\"selectedSecurity\"\n :server\n title=\"Authentication\" />\n </div>\n </Section>\n</template>\n<style scoped>\n.scalar-collection-auth {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,MAAM,WAAW,eAAyB;AACxC,OAAI,QAAA,mBAAmB,YACrB,QAAO;IACL,MAAM;IACN,MAAM,QAAA,QAAQ;IACd,QAAQ,QAAA,UAAU;IACpB;AAEF,UAAO,EAAE,MAAM,YAAW;IAC3B;;;;EAKD,MAAM,YAAY,eAAe;AAC/B,OAAI,QAAA,mBAAmB,aAAa;AAElC,QAAI,CAAC,QAAA,QAAQ,CAAC,aAAa,QAAA,OAAO,CAChC,QAAO;AAGT,WAAO,eAAe,QA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AA,SAAA,qBAAA,EAAA,EAAA,CAK5D,YAkB2B,MAAA,qBAAA,EAAA;KAjBzB,OAAK,eAAA,CAAC,uCACa,QAAA,mBAAc,eAAA,CAA+B,qBAAA,SAAA,sDAAA,CAAA;KAK/D,yBAAyB;KACzB,aAAA,QAAA;KACA,UAAU,QAAA;KACX,UAAA;KACC,MAAM,SAAA;KACN,SAAS,YAAA;KACT,UAAU,SAAA;KACV,sBAAsB,qBAAA;KACtB,iBAAA,gBAAA;KACA,kBAAkB,iBAAA;KAClB,QAAA,OAAA;KACD,OAAM;;;;;;;;;;;;;;OAnCF,QAAA,mBAAc,cAAA;UACnB;sBAMK,CALN,mBAKM,OALN,YAKM,CAJJ,YAGuD,MAAA,aAAA,EAAA;KAFrD,OAAM;KACL,YAAY,qBAAA;KACZ,uBAAmB"}
@@ -21,6 +21,7 @@ var Cookies_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
21
21
  fetchRegistryDocument: { type: Function },
22
22
  telemetry: { type: Boolean },
23
23
  onUpdateTelemetry: { type: Function },
24
+ options: {},
24
25
  collectionType: {}
25
26
  },
26
27
  setup(__props) {
@@ -1 +1 @@
1
- {"version":3,"file":"Cookies.vue.script.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Cookies.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Cookies section for the collection.\n * Renders document or workspace cookies and lets users manage key-value data\n * sent with API requests (e.g. session tokens, auth, preferences).\n */\nexport default {\n name: 'Cookies',\n}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { CookiesTable } from '@/v2/features/global-cookies'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst { collectionType, eventBus, document, workspaceStore } =\n defineProps<CollectionProps>()\n\nconst cookies = computed(() => {\n return (\n (collectionType === 'document'\n ? document['x-scalar-cookies']\n : workspaceStore.workspace['x-scalar-cookies']) ?? []\n )\n})\n</script>\n\n<template>\n <Section v-if=\"collectionType !== 'operation'\">\n <template #title>Cookies</template>\n <template #description>\n Manage your collection's cookies here.<br />Cookies allow you to store and\n send key-value data with your API requests—often used for things like\n session tokens, authentication, and saving user preferences.<br />\n </template>\n <CookiesTable\n :collectionType=\"collectionType\"\n :cookies=\"cookies\"\n :eventBus=\"eventBus\" />\n </Section>\n</template>\n"],"mappings":";;;;CAOE,MAAM;;;;;;;;;;;;;;;;;;;;;;EAaR,MAAM,UAAU,eAAe;AAC7B,WACG,QAAA,mBAAmB,aAChB,QAAA,SAAS,sBACT,QAAA,eAAe,UAAU,wBAAwB,EAAC;IAEzD;;UAIgB,QAAA,mBAAc,eAAA,WAAA,EAA7B,YAWU,iBAAA,EAAA,KAAA,GAAA,EAAA;IAVG,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;IACb,aAAW,cACkB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA;qBADjB,2CACiB,GAAA;KAAA,mBAAM,MAAA,MAAA,MAAA,GAAA;qBAAA,qKAEgB,GAAA;KAAA,mBAAM,MAAA,MAAA,MAAA,GAAA;;2BAK3C,CAHzB,YAGyB,MAAA,qBAAA,EAAA;KAFtB,gBAAgB,QAAA;KAChB,SAAS,QAAA;KACT,UAAU,QAAA"}
1
+ {"version":3,"file":"Cookies.vue.script.js","names":[],"sources":["../../../../../src/v2/features/collection/components/Cookies.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Cookies section for the collection.\n * Renders document or workspace cookies and lets users manage key-value data\n * sent with API requests (e.g. session tokens, auth, preferences).\n */\nexport default {\n name: 'Cookies',\n}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport type { CollectionProps } from '@/v2/features/app/helpers/routes'\nimport { CookiesTable } from '@/v2/features/global-cookies'\nimport Section from '@/v2/features/settings/components/Section.vue'\n\nconst { collectionType, eventBus, document, workspaceStore } =\n defineProps<CollectionProps>()\n\nconst cookies = computed(() => {\n return (\n (collectionType === 'document'\n ? document['x-scalar-cookies']\n : workspaceStore.workspace['x-scalar-cookies']) ?? []\n )\n})\n</script>\n\n<template>\n <Section v-if=\"collectionType !== 'operation'\">\n <template #title>Cookies</template>\n <template #description>\n Manage your collection's cookies here.<br />Cookies allow you to store and\n send key-value data with your API requests—often used for things like\n session tokens, authentication, and saving user preferences.<br />\n </template>\n <CookiesTable\n :collectionType=\"collectionType\"\n :cookies=\"cookies\"\n :eventBus=\"eventBus\" />\n </Section>\n</template>\n"],"mappings":";;;;CAOE,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAaR,MAAM,UAAU,eAAe;AAC7B,WACG,QAAA,mBAAmB,aAChB,QAAA,SAAS,sBACT,QAAA,eAAe,UAAU,wBAAwB,EAAC;IAEzD;;UAIgB,QAAA,mBAAc,eAAA,WAAA,EAA7B,YAWU,iBAAA,EAAA,KAAA,GAAA,EAAA;IAVG,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;IACb,aAAW,cACkB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA;qBADjB,2CACiB,GAAA;KAAA,mBAAM,MAAA,MAAA,MAAA,GAAA;qBAAA,qKAEgB,GAAA;KAAA,mBAAM,MAAA,MAAA,MAAA,GAAA;;2BAK3C,CAHzB,YAGyB,MAAA,qBAAA,EAAA;KAFtB,gBAAgB,QAAA;KAChB,SAAS,QAAA;KACT,UAAU,QAAA"}
@@ -55,6 +55,7 @@ var Editor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
55
55
  fetchRegistryDocument: { type: Function },
56
56
  telemetry: { type: Boolean },
57
57
  onUpdateTelemetry: { type: Function },
58
+ options: {},
58
59
  collectionType: {}
59
60
  },
60
61
  setup(__props) {