@scalar/api-client 2.17.8 → 2.18.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 (87) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  4. package/dist/v2/blocks/operation-block/helpers/build-request.js +46 -51
  5. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +9 -0
  6. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +1 -0
  7. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +7 -0
  8. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  9. package/dist/v2/blocks/operation-block/helpers/get-example.js +12 -10
  10. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +3 -0
  11. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +1 -0
  12. package/dist/v2/blocks/operation-block/helpers/get-server-url.js +12 -0
  13. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  15. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +87 -65
  16. package/dist/v2/components/code-input/CodeInput.vue.d.ts +115 -144
  17. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  18. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  19. package/dist/v2/components/code-input/CodeInput.vue2.js +120 -107
  20. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -3
  21. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  22. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  23. package/dist/v2/components/data-table/DataTableInput.vue2.js +27 -27
  24. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +3 -2
  25. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  26. package/dist/v2/components/data-table/DataTableInputSelect.vue.js +42 -39
  27. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -3
  28. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  29. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +5 -3
  30. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  31. package/dist/v2/components/sidebar/SidebarMenu.vue.js +25 -30
  32. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  33. package/dist/v2/features/app/App.vue.js +89 -141
  34. package/dist/v2/features/app/app-events.d.ts +22 -0
  35. package/dist/v2/features/app/app-events.d.ts.map +1 -0
  36. package/dist/v2/features/app/app-events.js +136 -0
  37. package/dist/v2/features/app/app-state.d.ts +135 -0
  38. package/dist/v2/features/app/app-state.d.ts.map +1 -0
  39. package/dist/v2/features/app/app-state.js +316 -0
  40. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +6 -3
  41. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  42. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  43. package/dist/v2/features/app/components/AppSidebar.vue2.js +4 -4
  44. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +4 -2
  45. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  46. package/dist/v2/features/app/components/DesktopTabs.vue.js +25 -22
  47. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +9 -5
  48. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  49. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +62 -1
  50. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  51. package/dist/v2/features/app/helpers/create-api-client-app.js +14 -10
  52. package/dist/v2/features/app/helpers/routes.d.ts +5 -2
  53. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  54. package/dist/v2/features/collection/WorkspaceCollection.vue.js +7 -7
  55. package/dist/v2/features/collection/components/Form.vue.d.ts +1 -1
  56. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  57. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  58. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  59. package/dist/v2/features/modal/Modal.vue.js +2 -2
  60. package/dist/v2/features/modal/Modal.vue2.js +40 -41
  61. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  62. package/dist/v2/features/operation/Operation.vue.js +38 -28
  63. package/dist/v2/features/operation/helpers/combine-params.d.ts +4 -0
  64. package/dist/v2/features/operation/helpers/combine-params.d.ts.map +1 -0
  65. package/dist/v2/features/operation/helpers/combine-params.js +13 -0
  66. package/dist/v2/features/operation/index.d.ts +1 -0
  67. package/dist/v2/features/operation/index.d.ts.map +1 -1
  68. package/dist/v2/features/operation/index.js +10 -8
  69. package/dist/v2/helpers/get-tab-details.d.ts +2 -2
  70. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
  71. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  72. package/package.json +16 -16
  73. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts +0 -40
  74. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +0 -1
  75. package/dist/v2/features/app/hooks/use-app-sidebar.js +0 -134
  76. package/dist/v2/features/app/hooks/use-sync-path.d.ts +0 -11
  77. package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +0 -1
  78. package/dist/v2/features/app/hooks/use-sync-path.js +0 -52
  79. package/dist/v2/features/app/hooks/use-tabs.d.ts +0 -31
  80. package/dist/v2/features/app/hooks/use-tabs.d.ts.map +0 -1
  81. package/dist/v2/features/app/hooks/use-tabs.js +0 -44
  82. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts +0 -18
  83. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +0 -1
  84. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +0 -156
  85. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts +0 -28
  86. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +0 -1
  87. package/dist/v2/features/app/hooks/use-workspace-selector.js +0 -81
@@ -1,13 +1,14 @@
1
- import { defineComponent as i, computed as o, onMounted as d, watch as p, createBlock as h, createElementBlock as v, openBlock as n, unref as l, createElementVNode as y } from "vue";
2
- import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { getOperationHeader as S } from "./helpers/get-operation-header.js";
4
- import { getSelectedServer as k } from "./helpers/get-selected-server.js";
5
- import g from "../../blocks/operation-block/OperationBlock.vue.js";
6
- const w = {
1
+ import { defineComponent as p, computed as r, onMounted as h, watch as v, createBlock as y, createElementBlock as f, openBlock as s, unref as u, createElementVNode as S } from "vue";
2
+ import { getResolvedRef as l } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ import { combineParams as k } from "./helpers/combine-params.js";
4
+ import { getOperationHeader as g } from "./helpers/get-operation-header.js";
5
+ import { getSelectedServer as w } from "./helpers/get-selected-server.js";
6
+ import B from "../../blocks/operation-block/OperationBlock.vue.js";
7
+ const C = {
7
8
  key: 1,
8
9
  class: "flex h-full w-full items-center justify-center"
9
- }, B = {}, O = /* @__PURE__ */ i({
10
- ...B,
10
+ }, N = {}, R = /* @__PURE__ */ p({
11
+ ...N,
11
12
  __name: "Operation",
12
13
  props: {
13
14
  documentSlug: {},
@@ -24,18 +25,27 @@ const w = {
24
25
  plugins: {}
25
26
  },
26
27
  setup(t) {
27
- const r = o(
28
- () => t.path && t.method ? f(t.document?.paths?.[t.path]?.[t.method]) ?? null : null
29
- ), s = o(() => [
28
+ const o = r(() => {
29
+ if (!t.path || !t.method)
30
+ return null;
31
+ const e = l(t.document?.paths?.[t.path]?.[t.method]);
32
+ if (!e)
33
+ return null;
34
+ const a = l(t.document?.paths?.[t.path]);
35
+ if (!a)
36
+ return e;
37
+ const n = k(a.parameters, e.parameters);
38
+ return { ...e, parameters: n };
39
+ }), m = r(() => [
30
40
  ...t.workspaceStore.workspace?.["x-scalar-cookies"] ?? [],
31
41
  ...t.document?.["x-scalar-cookies"] ?? []
32
- ]), u = o(() => k(t.document));
33
- d(() => {
42
+ ]), i = r(() => w(t.document));
43
+ h(() => {
34
44
  typeof t.document?.["x-scalar-selected-server"] > "u" && t.document?.servers?.[0]?.url && t.eventBus.emit("server:update:selected", { url: t.document.servers[0].url });
35
- }), p(
36
- r,
45
+ }), v(
46
+ o,
37
47
  (e) => {
38
- e && t.path && t.method && !S({
48
+ e && t.path && t.method && !g({
39
49
  operation: e,
40
50
  name: "Accept",
41
51
  type: "header"
@@ -51,44 +61,44 @@ const w = {
51
61
  },
52
62
  { immediate: !0 }
53
63
  );
54
- const m = o(() => t.document?.["x-scalar-set-operation-security"] ? {
64
+ const c = r(() => t.document?.["x-scalar-set-operation-security"] ? {
55
65
  type: "operation",
56
66
  path: t.path ?? "",
57
67
  method: t.method ?? "get"
58
68
  } : {
59
69
  type: "document"
60
- }), c = "2.17.8";
61
- return (e, a) => e.path && e.method && e.exampleName && r.value ? (n(), h(l(g), {
70
+ }), d = "2.18.0";
71
+ return (e, a) => e.path && e.method && e.exampleName && o.value ? (s(), y(u(B), {
62
72
  key: 0,
63
- appVersion: l(c),
64
- authMeta: m.value,
73
+ appVersion: u(d),
74
+ authMeta: c.value,
65
75
  documentSecurity: e.document?.security ?? [],
66
76
  documentSelectedSecurity: e.document?.["x-scalar-selected-security"],
67
77
  documentUrl: e.document?.["x-scalar-original-source-url"],
68
78
  environment: e.environment,
69
79
  eventBus: e.eventBus,
70
80
  exampleKey: e.exampleName,
71
- globalCookies: s.value,
81
+ globalCookies: m.value,
72
82
  history: [],
73
83
  httpClients: e.workspaceStore.config["x-scalar-reference-config"]?.httpClients,
74
84
  layout: e.layout,
75
85
  method: e.method,
76
- operation: r.value,
86
+ operation: o.value,
77
87
  path: e.path,
78
88
  plugins: e.plugins,
79
89
  proxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"] ?? "",
80
90
  securitySchemes: e.securitySchemes,
81
91
  selectedClient: e.workspaceStore.workspace["x-scalar-default-client"],
82
- server: u.value,
92
+ server: i.value,
83
93
  servers: e.document?.servers ?? [],
84
94
  setOperationSecurity: e.document?.["x-scalar-set-operation-security"] ?? !1,
85
95
  totalPerformedRequests: 0,
86
- "onUpdate:servers": a[0] || (a[0] = (C) => e.eventBus.emit("ui:route:page", { name: "document.servers" }))
87
- }, null, 8, ["appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "eventBus", "exampleKey", "globalCookies", "httpClients", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (n(), v("div", w, [...a[1] || (a[1] = [
88
- y("span", { class: "text-c-3" }, "Select an operation to view details", -1)
96
+ "onUpdate:servers": a[0] || (a[0] = (n) => e.eventBus.emit("ui:route:page", { name: "document.servers" }))
97
+ }, null, 8, ["appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "eventBus", "exampleKey", "globalCookies", "httpClients", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "servers", "setOperationSecurity"])) : (s(), f("div", C, [...a[1] || (a[1] = [
98
+ S("span", { class: "text-c-3" }, "Select an operation to view details", -1)
89
99
  ])]));
90
100
  }
91
101
  });
92
102
  export {
93
- O as default
103
+ R as default
94
104
  };
@@ -0,0 +1,4 @@
1
+ import type { OperationObject, ParameterObject, PathItemObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
+ /** Combine pathItem and operation parameters into a single, dereferenced parameter array */
3
+ export declare const combineParams: (pathParams?: PathItemObject["parameters"], operationParams?: OperationObject["parameters"]) => ParameterObject[];
4
+ //# sourceMappingURL=combine-params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combine-params.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/operation/helpers/combine-params.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,8DAA8D,CAAA;AAErE,4FAA4F;AAC5F,eAAO,MAAM,aAAa,GACxB,aAAY,cAAc,CAAC,YAAY,CAAM,EAC7C,kBAAiB,eAAe,CAAC,YAAY,CAAM,KAClD,eAAe,EAgBjB,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { isDefined as s } from "@scalar/helpers/array/is-defined";
2
+ import { getResolvedRef as t } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
+ const c = (a = [], o = []) => {
4
+ const m = [...a, ...o].map((e) => t(e)).filter((e) => s(e) && e.name), r = /* @__PURE__ */ new Map();
5
+ for (const e of m) {
6
+ const n = `${e.in}:${e.name}`;
7
+ r.set(n, e);
8
+ }
9
+ return Array.from(r.values());
10
+ };
11
+ export {
12
+ c as combineParams
13
+ };
@@ -1,3 +1,4 @@
1
+ export { combineParams } from './helpers/combine-params.js';
1
2
  export { getSecurityRequirements } from './helpers/get-security-requirements.js';
2
3
  export { getSelectedSecurity } from './helpers/get-selected-security.js';
3
4
  export { getSelectedServer } from './helpers/get-selected-server.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,10 +1,12 @@
1
- import { getSecurityRequirements as t } from "./helpers/get-security-requirements.js";
2
- import { getSelectedSecurity as f } from "./helpers/get-selected-security.js";
3
- import { getSelectedServer as p } from "./helpers/get-selected-server.js";
4
- import { default as c } from "./Operation.vue.js";
1
+ import { combineParams as t } from "./helpers/combine-params.js";
2
+ import { getSecurityRequirements as m } from "./helpers/get-security-requirements.js";
3
+ import { getSelectedSecurity as p } from "./helpers/get-selected-security.js";
4
+ import { getSelectedServer as c } from "./helpers/get-selected-server.js";
5
+ import { default as x } from "./Operation.vue.js";
5
6
  export {
6
- c as Operation,
7
- t as getSecurityRequirements,
8
- f as getSelectedSecurity,
9
- p as getSelectedServer
7
+ x as Operation,
8
+ t as combineParams,
9
+ m as getSecurityRequirements,
10
+ p as getSelectedSecurity,
11
+ c as getSelectedServer
10
12
  };
@@ -1,6 +1,6 @@
1
1
  import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
2
  import type { Tab } from '@scalar/workspace-store/schemas/extensions/workspace';
3
- import type { UseAppSidebarReturn } from '../../v2/features/app/hooks/use-app-sidebar.js';
3
+ import type { GetEntryByLocation } from '../../v2/features/app/app-state.js';
4
4
  /**
5
5
  * Returns display details for a tab in the API client UI.
6
6
  * Determines the title and icon to use based on workspace, document, path, and method.
@@ -35,7 +35,7 @@ export declare const getTabDetails: ({ workspace, document, path, method, getEnt
35
35
  document?: string;
36
36
  path?: string;
37
37
  method?: HttpMethod;
38
- getEntryByLocation: UseAppSidebarReturn["getEntryByLocation"];
38
+ getEntryByLocation: GetEntryByLocation;
39
39
  }) => {
40
40
  title: string;
41
41
  icon?: Tab["icon"];
@@ -1 +1 @@
1
- {"version":3,"file":"get-tab-details.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/get-tab-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAA;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,aAAa,GAAI,4DAM3B;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,kBAAkB,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;CAC9D,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAoCtC,CAAA"}
1
+ {"version":3,"file":"get-tab-details.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/get-tab-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAA;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,aAAa,GAAI,4DAM3B;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,kBAAkB,EAAE,kBAAkB,CAAA;CACvC,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAoCtC,CAAA"}
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
33
33
  }));
34
34
  }, f = (o) => {
35
35
  o?.createNew && g.name === "request" && d();
36
- }, v = "2.17.8";
36
+ }, v = "2.18.0";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (o, e) => (i(), l("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.17.8",
21
+ "version": "2.18.0",
22
22
  "engines": {
23
23
  "node": ">=20"
24
24
  },
@@ -327,25 +327,25 @@
327
327
  "yaml": "^2.8.0",
328
328
  "zod": "^4.1.11",
329
329
  "@scalar/analytics-client": "1.0.1",
330
+ "@scalar/components": "0.16.19",
330
331
  "@scalar/draggable": "0.3.0",
331
- "@scalar/helpers": "0.2.6",
332
- "@scalar/import": "0.4.43",
333
- "@scalar/components": "0.16.18",
332
+ "@scalar/helpers": "0.2.7",
334
333
  "@scalar/icons": "0.5.2",
335
- "@scalar/json-magic": "0.8.10",
336
- "@scalar/oas-utils": "0.6.15",
337
- "@scalar/openapi-parser": "0.23.12",
338
- "@scalar/object-utils": "1.2.20",
334
+ "@scalar/import": "0.4.44",
335
+ "@scalar/oas-utils": "0.6.16",
336
+ "@scalar/json-magic": "0.9.0",
337
+ "@scalar/object-utils": "1.2.21",
338
+ "@scalar/openapi-parser": "0.23.13",
339
339
  "@scalar/openapi-types": "0.5.3",
340
- "@scalar/postman-to-openapi": "0.3.56",
341
- "@scalar/sidebar": "0.7.8",
342
- "@scalar/snippetz": "0.6.3",
340
+ "@scalar/postman-to-openapi": "0.3.57",
341
+ "@scalar/snippetz": "0.6.4",
342
+ "@scalar/types": "0.5.7",
343
+ "@scalar/sidebar": "0.7.9",
344
+ "@scalar/use-codemirror": "0.13.13",
343
345
  "@scalar/themes": "0.13.26",
344
- "@scalar/types": "0.5.6",
345
- "@scalar/use-codemirror": "0.13.12",
346
- "@scalar/use-hooks": "0.3.5",
347
- "@scalar/workspace-store": "0.24.5",
348
- "@scalar/use-toasts": "0.9.1"
346
+ "@scalar/use-hooks": "0.3.6",
347
+ "@scalar/use-toasts": "0.9.1",
348
+ "@scalar/workspace-store": "0.24.6"
349
349
  },
350
350
  "devDependencies": {
351
351
  "@tailwindcss/vite": "^4.1.7",
@@ -1,40 +0,0 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
- import { createSidebarState } from '@scalar/sidebar';
3
- import type { WorkspaceStore } from '@scalar/workspace-store/client';
4
- import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
5
- import { type ComputedRef, type Ref } from 'vue';
6
- export type UseAppSidebarReturn = {
7
- handleSelectItem: (id: string) => void;
8
- state: ReturnType<typeof createSidebarState<TraversedEntry>>;
9
- getEntryByLocation: (location: {
10
- document: string;
11
- path?: string;
12
- method?: HttpMethod;
13
- example?: string;
14
- }) => TraversedEntry | undefined;
15
- };
16
- /**
17
- * useSidebarState - Custom hook to manage the sidebar state and navigation logic in the Scalar API client
18
- *
19
- * This composable manages the sidebar structure, synchronizes selection state
20
- * with the current route, and provides a handler for selecting sidebar items.
21
- *
22
- * Example usage:
23
- *
24
- * const { handleSelectItem, sidebarState } = useSidebarState({
25
- * workspaceStore,
26
- * workspaceSlug,
27
- * documentSlug,
28
- * path,
29
- * method,
30
- * exampleName,
31
- * })
32
- */
33
- export declare const useAppSidebar: ({ workspaceStore, documentSlug, path, method, exampleName, }: {
34
- workspaceStore: Ref<WorkspaceStore | null>;
35
- documentSlug: ComputedRef<string | undefined>;
36
- path: ComputedRef<string | undefined>;
37
- method: ComputedRef<HttpMethod | undefined>;
38
- exampleName: ComputedRef<string | undefined>;
39
- }) => UseAppSidebarReturn;
40
- //# sourceMappingURL=use-app-sidebar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-app-sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-app-sidebar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAwB,MAAM,iBAAiB,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAA4B,MAAM,KAAK,CAAA;AAG1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,KAAK,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAA;IAC5D,kBAAkB,EAAE,CAAC,QAAQ,EAAE;QAC7B,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,UAAU,CAAA;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,KAAK,cAAc,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,8DAM3B;IACD,cAAc,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1C,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC7C,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrC,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC3C,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC7C,KAAG,mBAoOH,CAAA"}
@@ -1,134 +0,0 @@
1
- import { isDefined as l } from "@scalar/helpers/array/is-defined";
2
- import { sortByOrder as w } from "@scalar/helpers/array/sort-by-order";
3
- import { createSidebarState as b, generateReverseIndex as k } from "@scalar/sidebar";
4
- import { getParentEntry as o } from "@scalar/workspace-store/navigation";
5
- import { computed as h, toValue as x, watch as f } from "vue";
6
- import { useRouter as O } from "vue-router";
7
- const A = ({
8
- workspaceStore: d,
9
- documentSlug: y,
10
- path: E,
11
- method: g,
12
- exampleName: S
13
- }) => {
14
- const m = O(), c = h(() => {
15
- const e = x(d);
16
- if (!e)
17
- return [];
18
- const t = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
19
- return w(Object.keys(e.workspace.documents), t, (r) => r).map((r) => e.workspace.documents[r]?.["x-scalar-navigation"]).filter(l);
20
- }), n = b(c);
21
- f(
22
- () => x(d),
23
- () => {
24
- n.reset();
25
- },
26
- {
27
- immediate: !0
28
- }
29
- );
30
- const p = ({
31
- document: e,
32
- path: t,
33
- method: r,
34
- example: a
35
- }) => JSON.stringify([e, t, r, a].filter(l)), u = h(
36
- () => k({
37
- items: c.value,
38
- nestedKey: "children",
39
- filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
40
- getId: (e) => {
41
- const t = o("document", e), r = o("operation", e);
42
- return p({
43
- document: t?.name ?? "",
44
- path: r?.path,
45
- method: r?.method,
46
- example: e.type === "example" ? e.name : void 0
47
- });
48
- }
49
- })
50
- ), i = (e) => {
51
- const t = u.value.get(p(e));
52
- return t || u.value.get(
53
- p({
54
- document: e.document,
55
- path: e.path,
56
- method: e.method
57
- })
58
- );
59
- }, v = (e) => {
60
- const t = n.getEntryById(e);
61
- if (!t) {
62
- console.warn(`Could not find sidebar entry with id ${e} to select`);
63
- return;
64
- }
65
- if (t.type === "document")
66
- return n.setSelected(e), n.setExpanded(e, !n.isExpanded(e)), m.push({
67
- name: "document.overview",
68
- params: { documentSlug: t.name }
69
- });
70
- if (t.type === "operation") {
71
- if (n.isSelected(e)) {
72
- n.setExpanded(e, !n.isExpanded(e));
73
- return;
74
- }
75
- const r = t.children?.find((a) => a.type === "example");
76
- return r ? (n.setSelected(r.id), n.setExpanded(r.id, !0)) : n.setSelected(e), m.push({
77
- name: "example",
78
- params: {
79
- documentSlug: o("document", t)?.name,
80
- pathEncoded: encodeURIComponent(t.path),
81
- method: t.method,
82
- exampleName: r?.name ?? "default"
83
- }
84
- });
85
- }
86
- if (t.type === "example") {
87
- n.setSelected(e), n.setExpanded(e, !0);
88
- const r = o("operation", t);
89
- return m.push({
90
- name: "example",
91
- params: {
92
- documentSlug: o("document", t)?.name,
93
- pathEncoded: encodeURIComponent(r?.path ?? ""),
94
- method: r?.method,
95
- exampleName: t.name
96
- }
97
- });
98
- }
99
- if (t.type === "text")
100
- return m.push({
101
- name: "document.overview",
102
- params: {
103
- documentSlug: o("document", t)?.name
104
- }
105
- });
106
- n.setExpanded(e, !n.isExpanded(e));
107
- };
108
- return f(
109
- [d, y, E, g, S],
110
- ([e, t, r, a, I]) => {
111
- if (!t) {
112
- n.setSelected(null);
113
- return;
114
- }
115
- const s = i({
116
- document: t,
117
- path: r,
118
- method: a,
119
- example: I
120
- });
121
- s && (n.setSelected(s.id), n.setExpanded(s.id, !0));
122
- },
123
- {
124
- immediate: !0
125
- }
126
- ), {
127
- handleSelectItem: v,
128
- state: n,
129
- getEntryByLocation: i
130
- };
131
- };
132
- export {
133
- A as useAppSidebar
134
- };
@@ -1,11 +0,0 @@
1
- import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
- import type { UseTabsReturn } from '../../../../v2/features/app/hooks/use-tabs.js';
3
- import { type UseWorkspaceSelectorReturn } from '../../../../v2/features/app/hooks/use-workspace-selector.js';
4
- export declare const useSyncPath: ({ workspaceSelectorState, tabsState, eventBus, }: {
5
- workspaceSelectorState: UseWorkspaceSelectorReturn;
6
- tabsState: UseTabsReturn;
7
- eventBus: WorkspaceEventBus;
8
- }) => {
9
- isLoading: import("vue").Ref<boolean, boolean>;
10
- };
11
- //# sourceMappingURL=use-sync-path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-sync-path.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-sync-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAqB,KAAK,0BAA0B,EAAE,MAAM,gDAAgD,CAAA;AAGnH,eAAO,MAAM,WAAW,GAAI,kDAIzB;IACD,sBAAsB,EAAE,0BAA0B,CAAA;IAClD,SAAS,EAAE,aAAa,CAAA;IACxB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;;CAqJA,CAAA"}
@@ -1,52 +0,0 @@
1
- import { ref as w, watch as d } from "vue";
2
- import { useRoute as v, useRouter as x } from "vue-router";
3
- import { DEFAULT_WORKSPACE as g } from "./use-workspace-selector.js";
4
- import { workspaceStorage as k } from "../../../helpers/storage.js";
5
- const F = ({
6
- workspaceSelectorState: e,
7
- tabsState: u,
8
- eventBus: l
9
- }) => {
10
- const c = v(), f = x(), o = w(!1), b = () => {
11
- const a = e.store.value;
12
- if (!a)
13
- return;
14
- const t = a.workspace["x-scalar-tabs"], r = a.workspace["x-scalar-active-tab"] ?? 0;
15
- t?.[r] && (t[r] = u.createTabFromCurrentRoute());
16
- }, m = async (a) => {
17
- const t = e.store.value;
18
- if (!t)
19
- return;
20
- const r = t.workspace["x-scalar-tabs"] ?? [], n = t.workspace["x-scalar-active-tab"] ?? 0, s = r[n];
21
- s && s.path !== c.path && await a?.({ tabPath: s.path });
22
- }, h = async (a) => {
23
- e.store.value = null, o.value = !0;
24
- const t = await e.loadWorkspace(a);
25
- if (t.success) {
26
- const { workspace: n } = t, s = n.workspace["x-scalar-active-tab"] ?? 0, i = n.workspace["x-scalar-tabs"], p = i?.[s];
27
- p && await f.replace(p.path), i && s >= i.length && l.emit("tabs:update:tabs", {
28
- "x-scalar-active-tab": 0
29
- }), i || l.emit("tabs:update:tabs", {
30
- "x-scalar-tabs": [u.createTabFromCurrentRoute()],
31
- "x-scalar-active-tab": 0
32
- }), o.value = !1;
33
- return;
34
- }
35
- const r = await e.createWorkspace(g);
36
- if (o.value = !1, !r)
37
- return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
38
- };
39
- return d(
40
- [() => c.path],
41
- async () => {
42
- const a = c.params.workspaceSlug;
43
- if (typeof a == "string" && k.setCurrentPath(c.path), typeof a == "string" && a !== e.activeWorkspace.value?.id)
44
- return await h(a);
45
- await m(b), o.value = !1;
46
- },
47
- { immediate: !0 }
48
- ), { isLoading: o };
49
- };
50
- export {
51
- F as useSyncPath
52
- };
@@ -1,31 +0,0 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
- import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
- import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
- import type { Tab } from '@scalar/workspace-store/schemas/extensions/workspace';
5
- import { type MaybeRefOrGetter, type Ref } from 'vue';
6
- import type { UseAppSidebarReturn } from '../../../../v2/features/app/hooks/use-app-sidebar.js';
7
- export type UseTabsReturn = {
8
- tabs: Ref<Tab[]>;
9
- activeTabIndex: Ref<number>;
10
- copyTabUrl: (index: number) => Promise<void>;
11
- isLoading: Ref<boolean>;
12
- createTabFromCurrentRoute: () => Tab;
13
- };
14
- type UseTabsParams = {
15
- workspaceStore: Ref<WorkspaceStore | null>;
16
- eventBus: WorkspaceEventBus;
17
- workspaceSlug: MaybeRefOrGetter<string | undefined>;
18
- documentSlug: MaybeRefOrGetter<string | undefined>;
19
- path: MaybeRefOrGetter<string | undefined>;
20
- method: MaybeRefOrGetter<HttpMethod | undefined>;
21
- getEntryByLocation: UseAppSidebarReturn['getEntryByLocation'];
22
- };
23
- /**
24
- * Composable for managing desktop tabs functionality.
25
- *
26
- * Handles tab creation, switching, closing, and synchronization with the current route.
27
- * Tabs are persisted in the workspace store to maintain state across sessions.
28
- */
29
- export declare const useTabs: ({ workspaceStore, getEntryByLocation, workspaceSlug, documentSlug, path, method, }: UseTabsParams) => UseTabsReturn;
30
- export {};
31
- //# sourceMappingURL=use-tabs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tabs.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-tabs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sDAAsD,CAAA;AAC/E,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,GAAG,EAA0B,MAAM,KAAK,CAAA;AAG7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAOlF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;IAChB,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC3B,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACvB,yBAAyB,EAAE,MAAM,GAAG,CAAA;CACrC,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,cAAc,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,aAAa,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACnD,YAAY,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAClD,IAAI,EAAE,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC1C,MAAM,EAAE,gBAAgB,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAChD,kBAAkB,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;CAC9D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,oFAOrB,aAAa,KAAG,aA4DlB,CAAA"}
@@ -1,44 +0,0 @@
1
- import { ref as f, computed as n, toValue as t } from "vue";
2
- import { useRoute as h } from "vue-router";
3
- import { getTabDetails as v } from "../../../helpers/get-tab-details.js";
4
- const x = "x-scalar-tabs", y = "x-scalar-active-tab", C = ({
5
- workspaceStore: o,
6
- getEntryByLocation: s,
7
- workspaceSlug: i,
8
- documentSlug: u,
9
- path: l,
10
- method: p
11
- }) => {
12
- const b = h(), d = f(!1), a = () => ({
13
- ...v({
14
- workspace: t(i),
15
- document: t(u),
16
- path: t(l),
17
- method: t(p),
18
- getEntryByLocation: s
19
- }),
20
- path: b.path
21
- }), r = n(() => o.value?.workspace[x] ?? [a()]), m = n(() => o.value?.workspace[y] ?? 0);
22
- return {
23
- tabs: r,
24
- activeTabIndex: m,
25
- copyTabUrl: async (e) => {
26
- const c = r.value[e];
27
- if (!c) {
28
- console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
29
- return;
30
- }
31
- const T = `${window.location.origin}${c.path}`;
32
- try {
33
- await navigator.clipboard.writeText(T);
34
- } catch (w) {
35
- console.error("Failed to copy URL to clipboard:", w);
36
- }
37
- },
38
- isLoading: d,
39
- createTabFromCurrentRoute: a
40
- };
41
- };
42
- export {
43
- C as useTabs
44
- };
@@ -1,18 +0,0 @@
1
- import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
- import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
- import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
4
- import { type ComputedRef, type Ref } from 'vue';
5
- import type { UseAppSidebarReturn } from '../../../../v2/features/app/hooks/use-app-sidebar.js';
6
- import type { UseCommandPaletteStateReturn } from '../../../../v2/features/command-palette/hooks/use-command-palette-state.js';
7
- /**
8
- * Top level state mutation handling for the workspace store in the client
9
- */
10
- export declare const useWorkspaceClientAppEvents: ({ eventBus, document, workspaceStore, isSidebarOpen, commandPaletteState, sidebarState, }: {
11
- eventBus: WorkspaceEventBus;
12
- document: ComputedRef<WorkspaceDocument | null>;
13
- workspaceStore: Ref<WorkspaceStore | null>;
14
- isSidebarOpen: Ref<boolean>;
15
- commandPaletteState: UseCommandPaletteStateReturn;
16
- sidebarState: UseAppSidebarReturn;
17
- }) => void;
18
- //# sourceMappingURL=use-workspace-client-app-events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-workspace-client-app-events.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-workspace-client-app-events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAwC,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAoD7G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAW,MAAM,KAAK,CAAA;AAGzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+DAA+D,CAAA;AAEjH;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,2FAOzC;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,cAAc,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1C,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3B,mBAAmB,EAAE,4BAA4B,CAAA;IACjD,YAAY,EAAE,mBAAmB,CAAA;CAClC,SAyWA,CAAA"}