@scalar/api-client 3.5.1 → 3.6.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 (113) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +0 -1
  5. package/dist/style.css +3916 -4768
  6. package/dist/styles/tailwind.config.css +20 -0
  7. package/dist/styles/utilities.css +45 -0
  8. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  10. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  11. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +1 -1
  12. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  13. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +1 -1
  14. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  15. package/dist/v2/constants.js +1 -1
  16. package/dist/v2/features/app/App.vue.d.ts +15 -31
  17. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  18. package/dist/v2/features/app/App.vue.js.map +1 -1
  19. package/dist/v2/features/app/App.vue.script.js +107 -28
  20. package/dist/v2/features/app/App.vue.script.js.map +1 -1
  21. package/dist/v2/features/app/app-state.d.ts +10 -14
  22. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  23. package/dist/v2/features/app/app-state.js +53 -21
  24. package/dist/v2/features/app/app-state.js.map +1 -1
  25. package/dist/v2/features/app/components/AppHeader.vue.d.ts.map +1 -1
  26. package/dist/v2/features/app/components/AppHeader.vue.js.map +1 -1
  27. package/dist/v2/features/app/components/AppHeader.vue.script.js +1 -1
  28. package/dist/v2/features/app/components/AppHeader.vue.script.js.map +1 -1
  29. package/dist/v2/features/app/components/AppHeaderActions.vue.d.ts +32 -0
  30. package/dist/v2/features/app/components/AppHeaderActions.vue.d.ts.map +1 -0
  31. package/dist/v2/features/app/components/AppHeaderActions.vue.js +7 -0
  32. package/dist/v2/features/app/components/AppHeaderActions.vue.js.map +1 -0
  33. package/dist/v2/features/app/components/AppHeaderActions.vue.script.js +170 -0
  34. package/dist/v2/features/app/components/AppHeaderActions.vue.script.js.map +1 -0
  35. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +2 -3
  36. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  37. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  38. package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
  39. package/dist/v2/features/app/components/AppSidebar.vue.script.js +1 -2
  40. package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
  41. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.d.ts +1 -2
  42. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.d.ts.map +1 -1
  43. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.js +1 -1
  44. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.js.map +1 -1
  45. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.script.js +3 -34
  46. package/dist/v2/features/app/components/DocumentBreadcrumb.vue.script.js.map +1 -1
  47. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.d.ts +1 -1
  48. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.d.ts.map +1 -1
  49. package/dist/v2/features/app/components/PublishDocumentModal.vue.d.ts +77 -0
  50. package/dist/v2/features/app/components/PublishDocumentModal.vue.d.ts.map +1 -0
  51. package/dist/v2/features/app/components/PublishDocumentModal.vue.js +7 -0
  52. package/dist/v2/features/app/components/PublishDocumentModal.vue.js.map +1 -0
  53. package/dist/v2/features/app/components/PublishDocumentModal.vue.script.js +209 -0
  54. package/dist/v2/features/app/components/PublishDocumentModal.vue.script.js.map +1 -0
  55. package/dist/v2/features/app/components/SyncConflictResolutionEditor.vue.d.ts.map +1 -0
  56. package/dist/v2/features/{collection → app}/components/SyncConflictResolutionEditor.vue.js +2 -2
  57. package/dist/v2/features/app/components/SyncConflictResolutionEditor.vue.js.map +1 -0
  58. package/dist/v2/features/{collection → app}/components/SyncConflictResolutionEditor.vue.script.js +1 -1
  59. package/dist/v2/features/{collection/components/SyncConflictResolutionEditor.vue.js.map → app/components/SyncConflictResolutionEditor.vue.script.js.map} +1 -1
  60. package/dist/v2/features/app/helpers/check-version-conflict.d.ts +8 -5
  61. package/dist/v2/features/app/helpers/check-version-conflict.d.ts.map +1 -1
  62. package/dist/v2/features/app/helpers/check-version-conflict.js +10 -7
  63. package/dist/v2/features/app/helpers/check-version-conflict.js.map +1 -1
  64. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +8 -5
  65. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  66. package/dist/v2/features/app/helpers/create-api-client-app.js +2 -2
  67. package/dist/v2/features/app/helpers/create-api-client-app.js.map +1 -1
  68. package/dist/v2/features/app/helpers/load-registry-document.d.ts +1 -10
  69. package/dist/v2/features/app/helpers/load-registry-document.d.ts.map +1 -1
  70. package/dist/v2/features/app/helpers/load-registry-document.js +6 -5
  71. package/dist/v2/features/app/helpers/load-registry-document.js.map +1 -1
  72. package/dist/v2/features/app/helpers/registry-error-messages.d.ts +23 -0
  73. package/dist/v2/features/app/helpers/registry-error-messages.d.ts.map +1 -0
  74. package/dist/v2/features/app/helpers/registry-error-messages.js +63 -0
  75. package/dist/v2/features/app/helpers/registry-error-messages.js.map +1 -0
  76. package/dist/v2/features/app/hooks/use-active-document-version.d.ts +2 -1
  77. package/dist/v2/features/app/hooks/use-active-document-version.d.ts.map +1 -1
  78. package/dist/v2/features/app/hooks/use-active-document-version.js.map +1 -1
  79. package/dist/v2/features/app/hooks/use-document-sync.d.ts +126 -0
  80. package/dist/v2/features/app/hooks/use-document-sync.d.ts.map +1 -0
  81. package/dist/v2/features/app/hooks/use-document-sync.js +448 -0
  82. package/dist/v2/features/app/hooks/use-document-sync.js.map +1 -0
  83. package/dist/v2/features/app/hooks/use-network-status.d.ts +29 -0
  84. package/dist/v2/features/app/hooks/use-network-status.d.ts.map +1 -0
  85. package/dist/v2/features/app/hooks/use-network-status.js +58 -0
  86. package/dist/v2/features/app/hooks/use-network-status.js.map +1 -0
  87. package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts +1 -25
  88. package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts.map +1 -1
  89. package/dist/v2/features/app/hooks/use-sidebar-documents.js.map +1 -1
  90. package/dist/v2/features/app/index.d.ts +1 -1
  91. package/dist/v2/features/app/index.d.ts.map +1 -1
  92. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  93. package/dist/v2/features/collection/DocumentCollection.vue.js.map +1 -1
  94. package/dist/v2/features/collection/DocumentCollection.vue.script.js +43 -277
  95. package/dist/v2/features/collection/DocumentCollection.vue.script.js.map +1 -1
  96. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.d.ts.map +1 -1
  97. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.js.map +1 -1
  98. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.script.js +25 -9
  99. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.script.js.map +1 -1
  100. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts.map +1 -1
  101. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +5 -5
  102. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js.map +1 -1
  103. package/dist/v2/types/configuration.d.ts +273 -7
  104. package/dist/v2/types/configuration.d.ts.map +1 -1
  105. package/dist/vue-styles.css +1389 -0
  106. package/package.json +21 -15
  107. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.js +0 -7
  108. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.js.map +0 -1
  109. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.script.js +0 -51
  110. package/dist/v2/features/app/components/DocumentSyncIndicator.vue.script.js.map +0 -1
  111. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts.map +0 -1
  112. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.script.js.map +0 -1
  113. /package/dist/v2/features/{collection → app}/components/SyncConflictResolutionEditor.vue.d.ts +0 -0
@@ -2,17 +2,20 @@ import TheCommandPalette_default from "../command-palette/TheCommandPalette.vue.
2
2
  import SidebarToggle_default from "../../components/sidebar/SidebarToggle.vue.js";
3
3
  import CreateWorkspaceModal_default from "./components/CreateWorkspaceModal.vue.js";
4
4
  import AppHeader_default from "./components/AppHeader.vue.js";
5
+ import AppHeaderActions_default from "./components/AppHeaderActions.vue.js";
5
6
  import AppSidebar_default from "./components/AppSidebar.vue.js";
6
7
  import DocumentBreadcrumb_default from "./components/DocumentBreadcrumb.vue.js";
7
- import DocumentSyncIndicator_default from "./components/DocumentSyncIndicator.vue.js";
8
+ import PublishDocumentModal_default from "./components/PublishDocumentModal.vue.js";
8
9
  import SplashScreen_default from "./components/SplashScreen.vue.js";
9
- import { useDocumentWatcher } from "./hooks/use-document-watcher.js";
10
10
  import { useMonacoEditorConfiguration } from "../editor/config.js";
11
+ import SyncConflictResolutionEditor_default from "./components/SyncConflictResolutionEditor.vue.js";
12
+ import { useDocumentSync } from "./hooks/use-document-sync.js";
13
+ import { useDocumentWatcher } from "./hooks/use-document-watcher.js";
11
14
  import { useColorMode } from "../../hooks/use-color-mode.js";
12
15
  import { useGlobalHotKeys } from "../../hooks/use-global-hot-keys.js";
13
16
  import DesktopTabs_default from "./components/DesktopTabs.vue.js";
14
17
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, onBeforeUnmount, openBlock, renderSlot, toValue, unref, watch, withCtx } from "vue";
15
- import { ScalarTeleportRoot, useModal } from "@scalar/components";
18
+ import { ScalarModal, ScalarTeleportRoot, useModal } from "@scalar/components";
16
19
  import { ScalarToasts } from "@scalar/use-toasts";
17
20
  import { RouterView } from "vue-router";
18
21
  import { extensions } from "@scalar/workspace-store/schemas/extensions";
@@ -22,14 +25,15 @@ var _hoisted_2 = { key: 0 };
22
25
  var _hoisted_3 = { class: "relative flex h-dvh w-dvw flex-col" };
23
26
  var _hoisted_4 = { class: "flex items-center gap-2" };
24
27
  var _hoisted_5 = {
25
- key: 2,
28
+ key: 0,
26
29
  "aria-hidden": "true",
27
30
  class: "bg-border h-4 w-px shrink-0"
28
31
  };
29
32
  var _hoisted_6 = { class: "flex min-h-0 flex-1 flex-row" };
30
33
  var _hoisted_7 = { class: "flex min-h-0 flex-1 flex-col" };
31
34
  var _hoisted_8 = { class: "bg-b-1 relative min-h-0 flex-1" };
32
- var _hoisted_9 = { key: 1 };
35
+ var _hoisted_9 = { class: "flex h-full w-full flex-col gap-4 overflow-hidden" };
36
+ var _hoisted_10 = { key: 1 };
33
37
  var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
34
38
  __name: "App",
35
39
  props: {
@@ -37,13 +41,19 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
37
41
  plugins: { default: () => [] },
38
42
  getAppState: { type: Function },
39
43
  getCommandPaletteState: { type: Function },
40
- fetchRegistryDocument: { type: Function },
41
- registryDocuments: { default: () => ({
42
- status: "success",
43
- documents: []
44
- }) }
44
+ registry: {}
45
45
  },
46
46
  setup(__props, { expose: __expose }) {
47
+ /**
48
+ * Reactive view of the registry documents list with a sane default for
49
+ * setups that did not wire an adapter up. The sidebar and breadcrumb
50
+ * read this getter so they keep rendering skeletons / empty states even
51
+ * when the host application has not provided a `registry` prop.
52
+ */
53
+ const registryDocuments = computed(() => __props.registry?.documents ?? {
54
+ status: "success",
55
+ documents: []
56
+ });
47
57
  __expose({ openCreateWorkspace: () => createWorkspaceModalState.show() });
48
58
  const app = __props.getAppState();
49
59
  const paletteState = __props.getCommandPaletteState();
@@ -82,6 +92,16 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
82
92
  darkMode: computed(() => app.isDarkMode.value)
83
93
  });
84
94
  const createWorkspaceModalState = useModal();
95
+ /**
96
+ * Owns the document-level Save / Revert / Pull / Push / Publish flow.
97
+ * Keeping it in a dedicated hook leaves this component focused on
98
+ * routing, layout, and slot composition.
99
+ */
100
+ const { showLocalSaveActions, showTeamSyncActions, showTeamPublishAction, hasHeaderActionCluster, isActiveDocumentDirty, isOffline, canPullActiveDocument, canPushActiveDocument, publishDocumentModalState, syncConflictModalState, pendingPullState, publishDefaultSlug, publishDefaultVersion, registryNamespaces, handleSaveDocument, handleRevertDocument, handlePullDocument, handlePushDocument, handlePublishDocument, handlePublishDocumentSubmit, handleSyncConflictApplyChanges, handleSyncConflictModalClose } = useDocumentSync({
101
+ app,
102
+ registry: __props.registry,
103
+ registryDocuments: () => registryDocuments.value
104
+ });
85
105
  /** Props to pass to the RouterView component. */
86
106
  const routerViewProps = computed(() => {
87
107
  return {
@@ -90,7 +110,7 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
90
110
  environment: app.environment.value,
91
111
  eventBus: app.eventBus,
92
112
  exampleName: app.activeEntities.exampleName.value,
93
- fetchRegistryDocument: __props.fetchRegistryDocument,
113
+ fetchRegistryDocument: __props.registry?.fetchDocument,
94
114
  layout: __props.layout,
95
115
  method: app.activeEntities.method.value,
96
116
  path: app.activeEntities.path.value,
@@ -130,34 +150,58 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
130
150
  menuItems: withCtx(() => [renderSlot(_ctx.$slots, "header-menu-items")]),
131
151
  breadcrumb: withCtx(() => [createVNode(DocumentBreadcrumb_default, {
132
152
  app: unref(app),
133
- fetchRegistryDocument: __props.fetchRegistryDocument,
134
- registryDocuments: __props.registryDocuments,
153
+ fetchRegistryDocument: __props.registry?.fetchDocument,
154
+ registryDocuments: registryDocuments.value,
135
155
  onCreateWorkspace: _cache[1] || (_cache[1] = ($event) => unref(createWorkspaceModalState).show())
136
156
  }, null, 8, [
137
157
  "app",
138
158
  "fetchRegistryDocument",
139
159
  "registryDocuments"
140
160
  ])]),
141
- end: withCtx(() => [createElementVNode("div", _hoisted_4, [
142
- unref(app).activeEntities.documentSlug.value ? (openBlock(), createBlock(DocumentSyncIndicator_default, {
143
- key: 0,
144
- app: unref(app),
145
- registryDocuments: __props.registryDocuments
146
- }, null, 8, ["app", "registryDocuments"])) : createCommentVNode("", true),
147
- _ctx.$slots["header-actions"] ? renderSlot(_ctx.$slots, "header-actions", { key: 1 }) : createCommentVNode("", true),
148
- _ctx.$slots["header-actions"] && _ctx.$slots["header-end"] ? (openBlock(), createElementBlock("span", _hoisted_5)) : createCommentVNode("", true),
149
- _ctx.$slots["header-end"] ? renderSlot(_ctx.$slots, "header-end", { key: 3 }) : createCommentVNode("", true)
150
- ])]),
151
161
  _: 2
152
162
  }, [_ctx.$slots["header-logo"] && unref(app).workspace.isTeamWorkspace.value ? {
153
163
  name: "logo",
154
164
  fn: withCtx(() => [renderSlot(_ctx.$slots, "header-logo", { isTeamWorkspace: unref(app).workspace.isTeamWorkspace.value })]),
155
165
  key: "0"
166
+ } : void 0, unref(hasHeaderActionCluster) || _ctx.$slots["header-actions"] || _ctx.$slots["header-end"] ? {
167
+ name: "end",
168
+ fn: withCtx(() => [createElementVNode("div", _hoisted_4, [
169
+ createVNode(AppHeaderActions_default, {
170
+ canPullActiveDocument: unref(canPullActiveDocument),
171
+ canPushActiveDocument: unref(canPushActiveDocument),
172
+ isActiveDocumentDirty: unref(isActiveDocumentDirty),
173
+ isOffline: unref(isOffline),
174
+ showLocalSaveActions: unref(showLocalSaveActions),
175
+ showTeamPublishAction: unref(showTeamPublishAction),
176
+ showTeamSyncActions: unref(showTeamSyncActions),
177
+ onPublish: unref(handlePublishDocument),
178
+ onPull: unref(handlePullDocument),
179
+ onPush: unref(handlePushDocument),
180
+ onRevert: unref(handleRevertDocument),
181
+ onSave: unref(handleSaveDocument)
182
+ }, null, 8, [
183
+ "canPullActiveDocument",
184
+ "canPushActiveDocument",
185
+ "isActiveDocumentDirty",
186
+ "isOffline",
187
+ "showLocalSaveActions",
188
+ "showTeamPublishAction",
189
+ "showTeamSyncActions",
190
+ "onPublish",
191
+ "onPull",
192
+ "onPush",
193
+ "onRevert",
194
+ "onSave"
195
+ ]),
196
+ _ctx.$slots["header-end"] ? (openBlock(), createElementBlock("span", _hoisted_5)) : createCommentVNode("", true),
197
+ _ctx.$slots["header-end"] ? renderSlot(_ctx.$slots, "header-end", { key: 1 }) : createCommentVNode("", true)
198
+ ])]),
199
+ key: "1"
156
200
  } : void 0]), 1032, ["menuTitle"]),
157
201
  createElementVNode("div", _hoisted_6, [createVNode(AppSidebar_default, {
158
202
  app: unref(app),
159
- fetchRegistryDocument: __props.fetchRegistryDocument,
160
- registryDocuments: __props.registryDocuments,
203
+ fetchRegistryDocument: __props.registry?.fetchDocument,
204
+ registryDocuments: registryDocuments.value,
161
205
  sidebarWidth: unref(app).sidebar.width.value,
162
206
  "onUpdate:sidebarWidth": unref(app).sidebar.handleSidebarWidthUpdate
163
207
  }, null, 8, [
@@ -177,10 +221,45 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
177
221
  "tabs"
178
222
  ])) : createCommentVNode("", true), createElementVNode("div", _hoisted_8, [createVNode(unref(RouterView), normalizeProps(guardReactiveProps(routerViewProps.value)), null, 16)])])])
179
223
  ]),
180
- renderSlot(_ctx.$slots, "create-workspace", { state: unref(createWorkspaceModalState) }, () => [createVNode(CreateWorkspaceModal_default, {
224
+ createVNode(CreateWorkspaceModal_default, {
181
225
  state: unref(createWorkspaceModalState),
182
226
  "onCreate:workspace": _cache[3] || (_cache[3] = (payload) => unref(app).workspace.create(payload))
183
- }, null, 8, ["state"])]),
227
+ }, null, 8, ["state"]),
228
+ __props.registry ? (openBlock(), createBlock(PublishDocumentModal_default, {
229
+ key: 0,
230
+ defaultSlug: unref(publishDefaultSlug),
231
+ defaultVersion: unref(publishDefaultVersion),
232
+ namespaces: unref(registryNamespaces),
233
+ state: unref(publishDocumentModalState),
234
+ onSubmit: unref(handlePublishDocumentSubmit)
235
+ }, null, 8, [
236
+ "defaultSlug",
237
+ "defaultVersion",
238
+ "namespaces",
239
+ "state",
240
+ "onSubmit"
241
+ ])) : createCommentVNode("", true),
242
+ unref(pendingPullState) ? (openBlock(), createBlock(unref(ScalarModal), {
243
+ key: 1,
244
+ bodyClass: "sync-conflict-modal-root flex h-dvh flex-col p-4",
245
+ maxWidth: "calc(100dvw - 32px)",
246
+ size: "full",
247
+ state: unref(syncConflictModalState),
248
+ onClose: unref(handleSyncConflictModalClose)
249
+ }, {
250
+ default: withCtx(() => [createElementVNode("div", _hoisted_9, [createVNode(SyncConflictResolutionEditor_default, {
251
+ baseDocument: unref(pendingPullState).rebaseResult.originalDocument,
252
+ conflicts: unref(pendingPullState).rebaseResult.conflicts,
253
+ resolvedDocument: unref(pendingPullState).rebaseResult.resolvedDocument,
254
+ onApplyChanges: unref(handleSyncConflictApplyChanges)
255
+ }, null, 8, [
256
+ "baseDocument",
257
+ "conflicts",
258
+ "resolvedDocument",
259
+ "onApplyChanges"
260
+ ])])]),
261
+ _: 1
262
+ }, 8, ["state", "onClose"])) : createCommentVNode("", true),
184
263
  createVNode(TheCommandPalette_default, {
185
264
  eventBus: unref(app).eventBus,
186
265
  paletteState: unref(paletteState),
@@ -190,7 +269,7 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
190
269
  "paletteState",
191
270
  "workspaceStore"
192
271
  ])
193
- ])) : (openBlock(), createElementBlock("main", _hoisted_9, [createVNode(SplashScreen_default)]))
272
+ ])) : (openBlock(), createElementBlock("main", _hoisted_10, [createVNode(SplashScreen_default)]))
194
273
  ]),
195
274
  _: 3
196
275
  });
@@ -1 +1 @@
1
- {"version":3,"file":"App.vue.script.js","names":["$slots"],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarTeleportRoot,\n useModal,\n type ModalState,\n} from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport AppHeader from '@/v2/features/app/components/AppHeader.vue'\nimport AppSidebar from '@/v2/features/app/components/AppSidebar.vue'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport DocumentBreadcrumb from '@/v2/features/app/components/DocumentBreadcrumb.vue'\nimport DocumentSyncIndicator from '@/v2/features/app/components/DocumentSyncIndicator.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { RegistryDocumentsState } from '@/v2/features/app/hooks/use-sidebar-documents'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { AppState } from './app-state'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n fetchRegistryDocument,\n registryDocuments = { status: 'success', documents: [] },\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /** Fetches the full document from registry by meta. Passed through to route props for sync. */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /**\n * The list of all available registry documents, with a loading status so the\n * sidebar can render skeleton placeholders until the real list is ready.\n */\n registryDocuments?: RegistryDocumentsState\n}>()\n\ndefineSlots<{\n /**\n * Slot for customizing the create workspace modal.\n * This slot is used to render custom actions or components within the create workspace modal.\n */\n 'create-workspace'?: (payload: { state: ModalState }) => unknown\n /**\n * Replaces the Scalar logo inside the header menu button. Typically used by\n * team-aware consumers (e.g. Scalar Cloud) to render a team avatar so the\n * left-most chrome reads as \"this team's workspace\" rather than the\n * generic Scalar wordmark.\n *\n * Receives `isTeamWorkspace` so consumers can opt into rendering a team\n * image only when the active workspace actually belongs to a team, while\n * keeping the default Scalar logo for local workspaces.\n */\n 'header-logo'?: (payload: { isTeamWorkspace: boolean }) => unknown\n /**\n * Slot for customizing the menu items section of the app header.\n * Defaults to a workspace picker bound to the current app state. Overriding this slot\n * replaces the default picker entirely, so the consumer is responsible for rendering\n * any workspace switcher (or other menu content) they need.\n */\n 'header-menu-items'?: () => unknown\n /**\n * Slot rendered at the trailing edge of the header, immediately before the\n * `header-end` slot. Use this for context-specific action buttons (for\n * example a \"Save\" button) so they sit next to the document chrome rather\n * than getting mixed in with the user / account controls in `header-end`.\n *\n * When both this slot and `header-end` are provided, a vertical divider is\n * inserted between them so the two groups read as visually distinct\n * clusters.\n */\n 'header-actions'?: () => unknown\n /**\n * Slot for customizing the end section of the app header.\n * Typically used for user menus, action buttons, or other trailing controls.\n */\n 'header-end'?: () => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst createWorkspaceModalState = useModal()\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n isTeamWorkspace: app.workspace.isTeamWorkspace.value,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div class=\"relative flex h-dvh w-dvw flex-col\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <AppHeader\n :menuTitle=\"app.workspace.isTeamWorkspace.value ? 'Team' : 'Local'\"\n @navigate:to:settings=\"\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'settings',\n })\n \">\n <!--\n Only forward the consumer-provided logo (typically a team\n avatar from Scalar Cloud) while the user is actually inside a\n team workspace. Outside of a team context the avatar would be\n misleading, so we omit the `#logo` template entirely and let\n `ScalarMenuButton` fall back to its default Scalar wordmark.\n -->\n <template\n v-if=\"$slots['header-logo'] && app.workspace.isTeamWorkspace.value\"\n #logo>\n <slot\n :isTeamWorkspace=\"app.workspace.isTeamWorkspace.value\"\n name=\"header-logo\" />\n </template>\n <template #menuItems>\n <!--\n The workspace picker used to live here as a submenu. It is now\n surfaced inline in the breadcrumb so the user reaches it in a\n single click. Consumers that want extra menu rows can still\n inject them through the `header-menu-items` slot.\n -->\n <slot name=\"header-menu-items\" />\n </template>\n <template #breadcrumb>\n <DocumentBreadcrumb\n :app=\"app\"\n :fetchRegistryDocument=\"fetchRegistryDocument\"\n :registryDocuments=\"registryDocuments\"\n @createWorkspace=\"createWorkspaceModalState.show()\" />\n </template>\n <template #end>\n <div class=\"flex items-center gap-2\">\n <!--\n Sync status mirrors the icon in the version picker so the\n user can see at a glance whether the active registry-backed\n document is synced / pending push / pending pull / in\n conflict, even when the picker dropdown is closed. We only\n mount it while a document is actually active on the route -\n on workspace-level pages (settings, get-started, etc.)\n there is nothing to sync, and an indicator there would just\n be noise.\n -->\n <DocumentSyncIndicator\n v-if=\"app.activeEntities.documentSlug.value\"\n :app=\"app\"\n :registryDocuments=\"registryDocuments\" />\n <slot\n v-if=\"$slots['header-actions']\"\n name=\"header-actions\" />\n <!--\n Vertical divider between the two trailing slot clusters.\n Only rendered when both `header-actions` and `header-end`\n are provided, so consumers using just one of the slots do\n not get an orphaned separator.\n -->\n <span\n v-if=\"$slots['header-actions'] && $slots['header-end']\"\n aria-hidden=\"true\"\n class=\"bg-border h-4 w-px shrink-0\" />\n <slot\n v-if=\"$slots['header-end']\"\n name=\"header-end\" />\n </div>\n </template>\n </AppHeader>\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n :app=\"app\"\n :fetchRegistryDocument=\"fetchRegistryDocument\"\n :registryDocuments=\"registryDocuments\"\n :sidebarWidth=\"app.sidebar.width.value\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\" />\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n\n <slot\n name=\"create-workspace\"\n :state=\"createWorkspaceModalState\">\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n </slot>\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,WAAa,EACX,2BAA2B,0BAA0B,MAAM,EAC5D,CAAA;EAED,MAAM,MAAM,QAAA,aAAY;EACxB,MAAM,eAAe,QAAA,wBAAuB;;AAG5C,MAAI,OAAO,WAAW,aAAa;AACjC,UAAO,0BAA0B,IAAI,MAAM;AAC3C,UAAO,qBAAqB;;;EAI9B,MAAM,qBAAqC,EAAC;AAE5C,OAAK,MAAM,UAAU,QAAA,SAAS;AAC5B,UAAO,WAAW,SAAS,EAAE,QAAQ,EAAE,WAAW,IAAI,UAAU,OAAO,EAAE,CAAA;AAEzE,OAAI,OAAO,GACT,MAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,OAAO,GAAG,CACtD,oBAAmB,KAAK,IAAI,SAAS,GAAG,OAAc,QAAe,CAAA;;;AAM3E,QAAM,IAAI,iBAAiB;AACzB,QAAK,MAAM,UAAU,QAAA,QACnB,QAAO,WAAW,iBAAiB,EACjC,QAAQ,EAAE,WAAW,IAAI,UAAU,OAAO,EAC3C,CAAA;IAEJ;AAED,wBAAsB;AACpB,QAAK,MAAM,SAAS,mBAClB,QAAM;AAER,QAAK,MAAM,UAAU,QAAA,QACnB,QAAO,WAAW,aAAY;IAEjC;;AAGD,mBAAiB,IAAI,UAAU,QAAA,OAAM;;AAKrC,qBAAmB;GACjB,oBACE,IAAI,MAAM,OAAO,UAAU,WAAW,UAAU;GAClD,OAAO,IAA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OAsDtD,mBAsBM,OAtBN,YAsBM,CApBJ,YAKgE,oBAAA;QAJ7D,KAAK,MAAA,IAAG;QACR,uBAAuB,QAAA;QACvB,mBAAmB,QAAA;QACnB,cAAc,MAAA,IAAG,CAAC,QAAQ,MAAM;QAChC,yBAAqB,MAAA,IAAG,CAAC,QAAQ;;;;;;;WAEpC,mBAYM,OAZN,YAYM,CATI,QAAA,WAAM,aAAA,WAAA,EADd,YAIiC,qBAAA;;QAF9B,gBAAgB,MAAA,IAAG,CAAC,KAAK,eAAe;QACxC,UAAU,MAAA,IAAG,CAAC;QACd,MAAM,MAAA,IAAG,CAAC,KAAK,MAAM;;;;;2CAGxB,mBAEM,OAFN,YAEM,CADJ,YAAuC,MAAA,WAAA,EAAA,eAAA,mBAAnB,gBAAA,MAAe,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;MAM3C,WAOO,KAAA,QAAA,oBAAA,EALJ,OAAO,MAAA,0BAAyB,EAAA,QAK5B,CAHL,YAEmE,8BAAA;OADhE,OAAO,MAAA,0BAAyB;OAChC,sBAAgB,OAAA,OAAA,OAAA,MAAG,YAAY,MAAA,IAAG,CAAC,UAAU,OAAO,QAAO;;MAGhE,YAGuC,2BAAA;OAFpC,UAAU,MAAA,IAAG,CAAC;OACd,cAAc,MAAA,aAAY;OAC1B,gBAAgB,MAAA,IAAG,CAAC,MAAM;;;;;;yBAG/B,mBAEO,QAAA,YAAA,CADL,YAAgB,qBAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"App.vue.script.js","names":["$slots"],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarModal, ScalarTeleportRoot, useModal } from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport AppHeader from '@/v2/features/app/components/AppHeader.vue'\nimport AppHeaderActions from '@/v2/features/app/components/AppHeaderActions.vue'\nimport AppSidebar from '@/v2/features/app/components/AppSidebar.vue'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport DocumentBreadcrumb from '@/v2/features/app/components/DocumentBreadcrumb.vue'\nimport PublishDocumentModal from '@/v2/features/app/components/PublishDocumentModal.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport SyncConflictResolutionEditor from '@/v2/features/app/components/SyncConflictResolutionEditor.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentSync } from '@/v2/features/app/hooks/use-document-sync'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type {\n RegistryAdapter,\n RegistryDocumentsState,\n} from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { AppState } from './app-state'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n registry,\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /**\n * Adapter wiring the API client up to an external registry (Scalar\n * Cloud or a custom self-hosted setup). The adapter itself is optional\n * - omit it to opt out of registry features entirely - but every\n * field on it (`documents`, `namespaces`, `fetchDocument`,\n * `publishDocument`, `publishVersion`) is required when provided so\n * the client can rely on the full surface.\n */\n registry?: RegistryAdapter\n}>()\n\n/**\n * Reactive view of the registry documents list with a sane default for\n * setups that did not wire an adapter up. The sidebar and breadcrumb\n * read this getter so they keep rendering skeletons / empty states even\n * when the host application has not provided a `registry` prop.\n */\nconst registryDocuments = computed<RegistryDocumentsState>(\n () => registry?.documents ?? { status: 'success', documents: [] },\n)\n\ndefineSlots<{\n /**\n * Replaces the Scalar logo inside the header menu button. Typically used by\n * team-aware consumers (e.g. Scalar Cloud) to render a team avatar so the\n * left-most chrome reads as \"this team's workspace\" rather than the\n * generic Scalar wordmark.\n *\n * Receives `isTeamWorkspace` so consumers can opt into rendering a team\n * image only when the active workspace actually belongs to a team, while\n * keeping the default Scalar logo for local workspaces.\n */\n 'header-logo'?: (payload: { isTeamWorkspace: boolean }) => unknown\n /**\n * Slot for customizing the menu items section of the app header.\n * Defaults to a workspace picker bound to the current app state. Overriding this slot\n * replaces the default picker entirely, so the consumer is responsible for rendering\n * any workspace switcher (or other menu content) they need.\n */\n 'header-menu-items'?: () => unknown\n /**\n * Slot for customizing the end section of the app header.\n * Typically used for user menus, action buttons, or other trailing controls.\n */\n 'header-end'?: () => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst createWorkspaceModalState = useModal()\n\n/**\n * Owns the document-level Save / Revert / Pull / Push / Publish flow.\n * Keeping it in a dedicated hook leaves this component focused on\n * routing, layout, and slot composition.\n */\nconst {\n showLocalSaveActions,\n showTeamSyncActions,\n showTeamPublishAction,\n hasHeaderActionCluster,\n isActiveDocumentDirty,\n isOffline,\n canPullActiveDocument,\n canPushActiveDocument,\n publishDocumentModalState,\n syncConflictModalState,\n pendingPullState,\n publishDefaultSlug,\n publishDefaultVersion,\n registryNamespaces,\n handleSaveDocument,\n handleRevertDocument,\n handlePullDocument,\n handlePushDocument,\n handlePublishDocument,\n handlePublishDocumentSubmit,\n handleSyncConflictApplyChanges,\n handleSyncConflictModalClose,\n} = useDocumentSync({\n app,\n registry,\n registryDocuments: () => registryDocuments.value,\n})\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument: registry?.fetchDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n isTeamWorkspace: app.workspace.isTeamWorkspace.value,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div class=\"relative flex h-dvh w-dvw flex-col\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <AppHeader\n :menuTitle=\"app.workspace.isTeamWorkspace.value ? 'Team' : 'Local'\"\n @navigate:to:settings=\"\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'settings',\n })\n \">\n <!--\n Only forward the consumer-provided logo (typically a team\n avatar from Scalar Cloud) while the user is actually inside a\n team workspace. Outside of a team context the avatar would be\n misleading, so we omit the `#logo` template entirely and let\n `ScalarMenuButton` fall back to its default Scalar wordmark.\n -->\n <template\n v-if=\"$slots['header-logo'] && app.workspace.isTeamWorkspace.value\"\n #logo>\n <slot\n :isTeamWorkspace=\"app.workspace.isTeamWorkspace.value\"\n name=\"header-logo\" />\n </template>\n <template #menuItems>\n <!--\n The workspace picker used to live here as a submenu. It is now\n surfaced inline in the breadcrumb so the user reaches it in a\n single click. Consumers that want extra menu rows can still\n inject them through the `header-menu-items` slot.\n -->\n <slot name=\"header-menu-items\" />\n </template>\n <template #breadcrumb>\n <DocumentBreadcrumb\n :app=\"app\"\n :fetchRegistryDocument=\"registry?.fetchDocument\"\n :registryDocuments=\"registryDocuments\"\n @createWorkspace=\"createWorkspaceModalState.show()\" />\n </template>\n <!--\n Only forward the trailing `#end` cluster when it has actual\n content. The action clusters and the consumer slots all gate\n independently, so we mirror those conditions on the wrapper to\n avoid mounting an empty cluster that would otherwise leak a\n stray divider.\n -->\n <template\n v-if=\"\n hasHeaderActionCluster ||\n $slots['header-actions'] ||\n $slots['header-end']\n \"\n #end>\n <div class=\"flex items-center gap-2\">\n <AppHeaderActions\n :canPullActiveDocument=\"canPullActiveDocument\"\n :canPushActiveDocument=\"canPushActiveDocument\"\n :isActiveDocumentDirty=\"isActiveDocumentDirty\"\n :isOffline=\"isOffline\"\n :showLocalSaveActions=\"showLocalSaveActions\"\n :showTeamPublishAction=\"showTeamPublishAction\"\n :showTeamSyncActions=\"showTeamSyncActions\"\n @publish=\"handlePublishDocument\"\n @pull=\"handlePullDocument\"\n @push=\"handlePushDocument\"\n @revert=\"handleRevertDocument\"\n @save=\"handleSaveDocument\" />\n <!--\n Vertical divider between the document-scoped action cluster\n (workspace-mode buttons + `header-actions`) and the trailing\n `header-end` cluster. Only rendered when both sides have\n content so single-cluster headers do not get an orphaned\n separator.\n -->\n <span\n v-if=\"$slots['header-end']\"\n aria-hidden=\"true\"\n class=\"bg-border h-4 w-px shrink-0\" />\n <slot\n v-if=\"$slots['header-end']\"\n name=\"header-end\" />\n </div>\n </template>\n </AppHeader>\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n :app=\"app\"\n :fetchRegistryDocument=\"registry?.fetchDocument\"\n :registryDocuments=\"registryDocuments\"\n :sidebarWidth=\"app.sidebar.width.value\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\" />\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n\n <!--\n First-time publish modal. Only mounted when a registry adapter\n is wired up - without one there is nothing meaningful to send,\n and the modal would never be opened anyway.\n -->\n <PublishDocumentModal\n v-if=\"registry\"\n :defaultSlug=\"publishDefaultSlug\"\n :defaultVersion=\"publishDefaultVersion\"\n :namespaces=\"registryNamespaces\"\n :state=\"publishDocumentModalState\"\n @submit=\"handlePublishDocumentSubmit\" />\n <!--\n Three-way merge editor for the Pull flow. We mount it lazily on\n `pendingPullState` so the heavy Monaco editors only spin up when\n a pull actually has conflicts to walk through. The full-size\n layout mirrors `DocumentCollection.vue`'s sync modal so the\n editor has enough room to render the local / remote / result\n panes side-by-side.\n -->\n <ScalarModal\n v-if=\"pendingPullState\"\n bodyClass=\"sync-conflict-modal-root flex h-dvh flex-col p-4\"\n maxWidth=\"calc(100dvw - 32px)\"\n size=\"full\"\n :state=\"syncConflictModalState\"\n @close=\"handleSyncConflictModalClose\">\n <div class=\"flex h-full w-full flex-col gap-4 overflow-hidden\">\n <SyncConflictResolutionEditor\n :baseDocument=\"pendingPullState.rebaseResult.originalDocument\"\n :conflicts=\"pendingPullState.rebaseResult.conflicts\"\n :resolvedDocument=\"pendingPullState.rebaseResult.resolvedDocument\"\n @applyChanges=\"handleSyncConflictApplyChanges\" />\n </div>\n </ScalarModal>\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n\n/*\n * The three-way merge editor needs the full viewport to fit its three\n * Monaco panes. `DocumentCollection.vue` ships the same override for\n * its in-page Sync modal, but the pull flow can run without that view\n * being mounted, so we duplicate the rule here to keep the modal\n * full-bleed.\n */\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEA,MAAM,oBAAoB,eAClB,QAAA,UAAU,aAAa;GAAE,QAAQ;GAAW,WAAW,EAAE;GAAE,CACnE;AA4BA,WAAa,EACX,2BAA2B,0BAA0B,MAAM,EAC5D,CAAA;EAED,MAAM,MAAM,QAAA,aAAY;EACxB,MAAM,eAAe,QAAA,wBAAuB;;AAG5C,MAAI,OAAO,WAAW,aAAa;AACjC,UAAO,0BAA0B,IAAI,MAAM;AAC3C,UAAO,qBAAqB;;;EAI9B,MAAM,qBAAqC,EAAC;AAE5C,OAAK,MAAM,UAAU,QAAA,SAAS;AAC5B,UAAO,WAAW,SAAS,EAAE,QAAQ,EAAE,WAAW,IAAI,UAAU,OAAO,EAAE,CAAA;AAEzE,OAAI,OAAO,GACT,MAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,OAAO,GAAG,CACtD,oBAAmB,KAAK,IAAI,SAAS,GAAG,OAAc,QAAe,CAAA;;;AAM3E,QAAM,IAAI,iBAAiB;AACzB,QAAK,MAAM,UAAU,QAAA,QACnB,QA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,eAAA,mBAAnB,gBAAA,MAAe,CAAA,EAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;MAM3C,YAEmE,8BAAA;OADhE,OAAO,MAAA,0BAAyB;OAChC,sBAAgB,OAAA,OAAA,OAAA,MAAG,YAAY,MAAA,IAAG,CAAC,UAAU,OAAO,QAAO;;MAQtD,QAAA,YAAA,WAAA,EADR,YAM0C,8BAAA;;OAJvC,aAAa,MAAA,mBAAkB;OAC/B,gBAAgB,MAAA,sBAAqB;OACrC,YAAY,MAAA,mBAAkB;OAC9B,OAAO,MAAA,0BAAyB;OAChC,UAAQ,MAAA,4BAA2B;;;;;;;;MAU9B,MAAA,iBAAgB,IAAA,WAAA,EADxB,YAcc,MAAA,YAAA,EAAA;;OAZZ,WAAU;OACV,UAAS;OACT,MAAK;OACJ,OAAO,MAAA,uBAAsB;OAC7B,SAAO,MAAA,6BAA4B;;8BAO9B,CANN,mBAMM,OANN,YAMM,CALJ,YAImD,sCAAA;QAHhD,cAAc,MAAA,iBAAgB,CAAC,aAAa;QAC5C,WAAW,MAAA,iBAAgB,CAAC,aAAa;QACzC,kBAAkB,MAAA,iBAAgB,CAAC,aAAa;QAChD,gBAAc,MAAA,+BAA8B;;;;;;;;;MAInD,YAGuC,2BAAA;OAFpC,UAAU,MAAA,IAAG,CAAC;OACd,cAAc,MAAA,aAAY;OAC1B,gBAAgB,MAAA,IAAG,CAAC,MAAM;;;;;;yBAG/B,mBAEO,QAAA,aAAA,CADL,YAAgB,qBAAA,CAAA,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { ScalarListboxOption, WorkspaceGroup } from '@scalar/components';
2
2
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
3
3
  import type { LoaderPlugin } from '@scalar/json-magic/bundle';
4
+ import type { Team } from '@scalar/sdk/models/components';
4
5
  import { createSidebarState } from '@scalar/sidebar';
5
6
  import type { Theme } from '@scalar/themes';
6
7
  import { type WorkspaceStore } from '@scalar/workspace-store/client';
@@ -80,6 +81,12 @@ export type AppState = {
80
81
  } | null>;
81
82
  /** Navigates to the specified workspace */
82
83
  navigateToWorkspace: (teamSlug?: string, slug?: string) => Promise<void>;
84
+ /**
85
+ * Routes to the get-started page of a workspace identified by id.
86
+ * Mirrors the picker affordances in the breadcrumb and header menu
87
+ * so both surfaces stay in sync when the user switches workspaces.
88
+ */
89
+ navigateToWorkspaceGetStarted: (workspaceId: string) => void;
83
90
  /** Whether the workspace page is open */
84
91
  isOpen: ComputedRef<boolean>;
85
92
  /**
@@ -113,8 +120,6 @@ export type AppState = {
113
120
  exampleName: Ref<string | undefined>;
114
121
  /** The slug of the selected team context (read-only; use setTeamSlug to change) */
115
122
  teamSlug: Readonly<Ref<string>>;
116
- /** Sets the current team context by team slug */
117
- setTeamSlug: (value: string) => void;
118
123
  };
119
124
  /** The currently active environment */
120
125
  environment: ComputedRef<XScalarEnvironment>;
@@ -136,20 +141,11 @@ export type AppState = {
136
141
  };
137
142
  telemetry: Ref<boolean>;
138
143
  };
139
- /** Default slug used when auto-creating a team workspace on demand. */
140
- export declare const DEFAULT_TEAM_WORKSPACE_SLUG = "default";
141
- /**
142
- * Temporary kill switch for team workspace functionality.
143
- *
144
- * While the team workspace experience is still being polished we hide the
145
- * "Team Workspaces" group from the picker and refuse to create new team
146
- * workspaces. Existing team workspaces remain in storage and can be restored
147
- * by flipping this flag back to `true`.
148
- */
149
- export declare const TEAM_WORKSPACES_ENABLED = false;
150
- export declare const createAppState: ({ router, fileLoader, fallbackThemeSlug, customThemes, telemetryDefault, options, }: {
144
+ export declare const createAppState: ({ router, fileLoader, currentTeam, fallbackThemeSlug, customThemes, telemetryDefault, options, }: {
151
145
  router: Router;
152
146
  fileLoader?: LoaderPlugin;
147
+ /** The currently active team */
148
+ currentTeam?: MaybeRefOrGetter<Team | undefined>;
153
149
  customThemes?: MaybeRefOrGetter<Theme[]>;
154
150
  fallbackThemeSlug?: MaybeRefOrGetter<string>;
155
151
  telemetryDefault?: boolean;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M,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,gCAAgC;IAChC,WAAW,CAAC,EAAE,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;IACxC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kCAAkC;IAClC,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B,KAAG,OAAO,CAAC,QAAQ,CA69BnB,CAAA"}
@@ -5,7 +5,7 @@ import { getTabDetails } from "../../helpers/get-tab-details.js";
5
5
  import { workspaceStorage } from "../../helpers/storage.js";
6
6
  import { initializeAppEventHandlers } from "./app-events.js";
7
7
  import { canLoadWorkspace, filterWorkspacesByTeam } from "./helpers/filter-workspaces.js";
8
- import { computed, readonly, ref, shallowRef, watch } from "vue";
8
+ import { computed, readonly, ref, shallowRef, toValue, watch } from "vue";
9
9
  import { getActiveEnvironment } from "@scalar/workspace-store/request-example";
10
10
  import { isDefined } from "@scalar/helpers/array/is-defined";
11
11
  import { createWorkspaceEventBus } from "@scalar/workspace-store/events";
@@ -24,11 +24,9 @@ import { extensions } from "@scalar/workspace-store/schemas/extensions";
24
24
  var DEFAULT_DEBOUNCE_DELAY = 1e3;
25
25
  /** Default sidebar width in pixels. */
26
26
  var DEFAULT_SIDEBAR_WIDTH = 288;
27
- /** Default slug used when auto-creating a team workspace on demand. */
28
- var DEFAULT_TEAM_WORKSPACE_SLUG = "default";
29
27
  /** Default display name used when auto-creating a team workspace on demand. */
30
28
  var DEFAULT_TEAM_WORKSPACE_NAME = "Workspace";
31
- var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "default", customThemes = () => [], telemetryDefault, options }) => {
29
+ var createAppState = async ({ router, fileLoader, currentTeam, fallbackThemeSlug = () => "default", customThemes = () => [], telemetryDefault, options }) => {
32
30
  /** Workspace event bus for handling workspace-level events. */
33
31
  const eventBus = createWorkspaceEventBus({ debug: false });
34
32
  const { workspace: persistence } = await createWorkspaceStorePersistence();
@@ -37,7 +35,7 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
37
35
  * This happens once per user and transforms old data structure to new workspace format
38
36
  */
39
37
  await migrateLocalStorageToIndexDb();
40
- const teamSlug = ref("local");
38
+ const teamSlug = computed(() => toValue(currentTeam)?.slug ?? "local");
41
39
  const routeTeamSlug = ref(void 0);
42
40
  const workspaceSlug = ref(void 0);
43
41
  const documentSlug = ref(void 0);
@@ -151,12 +149,16 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
151
149
  };
152
150
  };
153
151
  /**
154
- * Creates and persists the default workspace with a blank draft document.
155
- * Used when no workspaces exist yet.
152
+ * Creates and persists a new workspace.
153
+ *
154
+ * Local workspaces are seeded with a blank "drafts" document so the user
155
+ * lands on a usable starting point. Team workspaces start empty - their
156
+ * documents come from the registry, so seeding a local-only draft would
157
+ * just create dead state that is never synced.
156
158
  */
157
159
  const createAndPersistWorkspace = async ({ name, teamSlug, slug }) => {
158
160
  const draftStore = createWorkspaceStore();
159
- await draftStore.addDocument({
161
+ if (!Boolean(teamSlug && teamSlug !== "local")) await draftStore.addDocument({
160
162
  name: "drafts",
161
163
  document: {
162
164
  openapi: "3.1.0",
@@ -195,6 +197,16 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
195
197
  await router.push("/");
196
198
  return;
197
199
  }
200
+ if (teamSlug !== "local") {
201
+ await router.push({
202
+ name: "workspace.get-started",
203
+ params: {
204
+ teamSlug,
205
+ workspaceSlug: slug
206
+ }
207
+ });
208
+ return;
209
+ }
198
210
  await router.push({
199
211
  name: "example",
200
212
  params: {
@@ -208,6 +220,36 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
208
220
  });
209
221
  };
210
222
  /**
223
+ * Routes to the get-started page of a workspace identified by id.
224
+ *
225
+ * Get-started is the right landing surface on a workspace switch
226
+ * because the user has effectively arrived at a fresh workspace and
227
+ * may not have any documents loaded yet. We look the workspace up
228
+ * against the unfiltered `workspaces` list so callers can switch into
229
+ * a workspace that is not visible under the current team filter.
230
+ *
231
+ * When team workspaces are enabled and the active team has no real
232
+ * workspace yet, the picker may surface a synthetic placeholder option
233
+ * (id: `getWorkspaceId(teamSlug, DEFAULT_TEAM_WORKSPACE_SLUG)`). We
234
+ * route that through the normal navigation flow so the route handler
235
+ * can create the workspace on demand.
236
+ */
237
+ const navigateToWorkspaceGetStarted = (workspaceId) => {
238
+ const emitNavigation = (target, slug) => {
239
+ eventBus.emit("ui:navigate", {
240
+ page: "workspace",
241
+ path: "get-started",
242
+ teamSlug: target,
243
+ workspaceSlug: slug
244
+ });
245
+ };
246
+ const workspace = workspaces.value?.find((w) => w.id === workspaceId);
247
+ if (workspace) {
248
+ emitNavigation(workspace.teamSlug, workspace.slug);
249
+ return;
250
+ }
251
+ };
252
+ /**
211
253
  * Creates a new workspace with the provided name.
212
254
  * - Generates a unique slug for the workspace (uses the provided slug if it is unique, otherwise generates a unique slug).
213
255
  * - Adds a default blank document ("drafts") to the workspace.
@@ -307,16 +349,6 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
307
349
  if (!createResult) return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
308
350
  sidebarState.reset();
309
351
  };
310
- /**
311
- * Sets the current team context. If the active workspace is not accessible
312
- * with the new team, navigates to the default workspace for that team.
313
- */
314
- const setTeamSlug = (value) => {
315
- teamSlug.value = value;
316
- const workspace = filteredWorkspaces.value.find((w) => w.teamSlug === routeTeamSlug.value && w.slug === workspaceSlug.value);
317
- if (workspace && canLoadWorkspace(workspace.teamSlug, value)) return;
318
- return navigateToWorkspace("local", "default");
319
- };
320
352
  const entries = computed(() => {
321
353
  const activeStore = store.value;
322
354
  if (!activeStore) return [];
@@ -651,6 +683,7 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
651
683
  workspaceGroups,
652
684
  activeWorkspace,
653
685
  navigateToWorkspace,
686
+ navigateToWorkspaceGetStarted,
654
687
  isOpen: computed(() => Boolean(workspaceSlug.value && !documentSlug.value)),
655
688
  isTeamWorkspace
656
689
  },
@@ -664,8 +697,7 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
664
697
  path,
665
698
  method,
666
699
  exampleName,
667
- teamSlug: readonly(teamSlug),
668
- setTeamSlug
700
+ teamSlug: readonly(teamSlug)
669
701
  },
670
702
  environment,
671
703
  document: activeDocument,
@@ -680,6 +712,6 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
680
712
  };
681
713
  };
682
714
  //#endregion
683
- export { DEFAULT_TEAM_WORKSPACE_SLUG, createAppState };
715
+ export { createAppState };
684
716
 
685
717
  //# sourceMappingURL=app-state.js.map