@scalar/api-client 2.22.0 → 2.22.2

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 (62) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/hooks/useClientConfig.d.ts +6 -3
  3. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
  7. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  8. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  10. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +23 -29
  11. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  12. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +45 -43
  13. package/dist/v2/components/code-input/CodeInput.vue.d.ts +0 -6
  14. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  15. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  16. package/dist/v2/components/code-input/CodeInput.vue2.js +50 -63
  17. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +0 -3
  18. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  19. package/dist/v2/components/sidebar/Sidebar.vue.js +55 -53
  20. package/dist/v2/features/app/App.vue.d.ts +3 -1
  21. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  22. package/dist/v2/features/app/App.vue.js +46 -43
  23. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  24. package/dist/v2/features/app/app-state.js +33 -28
  25. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  26. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  27. package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -127
  28. package/dist/v2/features/app/index.d.ts +3 -0
  29. package/dist/v2/features/app/index.d.ts.map +1 -1
  30. package/dist/v2/features/app/index.js +17 -11
  31. package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -1
  32. package/dist/v2/features/command-palette/TheCommandPalette.vue.js +1 -1
  33. package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +6 -6
  34. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +2 -2
  35. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  36. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +60 -56
  37. package/dist/v2/features/operation/Operation.vue.js +1 -1
  38. package/dist/v2/features/search/hooks/use-search-index.d.ts +3 -7
  39. package/dist/v2/features/search/hooks/use-search-index.d.ts.map +1 -1
  40. package/dist/v2/features/search/hooks/use-search-index.js +12 -18
  41. package/dist/v2/features/search/index.d.ts +1 -2
  42. package/dist/v2/features/search/index.d.ts.map +1 -1
  43. package/dist/v2/features/search/index.js +2 -4
  44. package/dist/v2/features/search/types.d.ts +1 -1
  45. package/dist/v2/features/search/types.d.ts.map +1 -1
  46. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  47. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  48. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  49. package/dist/views/Request/libs/oauth2.js +54 -52
  50. package/package.json +19 -19
  51. package/dist/v2/features/search/components/SearchButton.vue.d.ts +0 -12
  52. package/dist/v2/features/search/components/SearchButton.vue.d.ts.map +0 -1
  53. package/dist/v2/features/search/components/SearchButton.vue.js +0 -71
  54. package/dist/v2/features/search/components/SearchButton.vue2.js +0 -4
  55. package/dist/v2/features/search/components/SearchModal.vue.d.ts +0 -11
  56. package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +0 -1
  57. package/dist/v2/features/search/components/SearchModal.vue.js +0 -7
  58. package/dist/v2/features/search/components/SearchModal.vue2.js +0 -102
  59. package/dist/v2/features/search/components/SearchResult.vue.d.ts +0 -10
  60. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +0 -1
  61. package/dist/v2/features/search/components/SearchResult.vue.js +0 -80
  62. package/dist/v2/features/search/components/SearchResult.vue2.js +0 -4
@@ -1,14 +1,20 @@
1
- import { useAppState as o } from "./app-state.js";
2
- import { baseClientActions as a, baseRoutes as m, useCommandPaletteState as s } from "../command-palette/hooks/use-command-palette-state.js";
3
- import { default as A } from "./App.vue.js";
1
+ import { useAppState as a } from "./app-state.js";
2
+ import { default as p } from "./components/CreateWorkspaceModal.vue.js";
3
+ import { default as f } from "../command-palette/components/CommandActionForm.vue.js";
4
+ import { default as n } from "../command-palette/components/CommandActionInput.vue.js";
5
+ import { baseClientActions as u, baseRoutes as d, useCommandPaletteState as i } from "../command-palette/hooks/use-command-palette-state.js";
6
+ import { default as x } from "./App.vue.js";
4
7
  /* empty css */
5
- import { createApiClientApp as l, createAppRouter as n } from "./helpers/create-api-client-app.js";
8
+ import { createApiClientApp as c, createAppRouter as b } from "./helpers/create-api-client-app.js";
6
9
  export {
7
- A as ClientApp,
8
- a as baseClientActions,
9
- m as baseRoutes,
10
- l as createApiClientApp,
11
- n as createAppRouter,
12
- o as useAppState,
13
- s as useCommandPaletteState
10
+ x as ClientApp,
11
+ f as CommandActionForm,
12
+ n as CommandActionInput,
13
+ p as CreateWorkspaceModal,
14
+ u as baseClientActions,
15
+ d as baseRoutes,
16
+ c as createApiClientApp,
17
+ b as createAppRouter,
18
+ a as useAppState,
19
+ i as useCommandPaletteState
14
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/command-palette/TheCommandPalette.vue"],"names":[],"mappings":"AAkWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAWvC,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,mCAAmC,CAAA;AAG1C;;;;;;;;;;;;;;;;;;;;GAoBG;;IAGD,gDAAgD;kBAClC,mBAAmB;IACjC,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;IAL3B,gDAAgD;kBAClC,mBAAmB;IACjC,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;AAP7B,wBA+bC"}
1
+ {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/command-palette/TheCommandPalette.vue"],"names":[],"mappings":"AA0WA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAIV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAWvC,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,mCAAmC,CAAA;AAG1C;;;;;;;;;;;;;;;;;;;;GAoBG;;IAGD,gDAAgD;kBAClC,mBAAmB;IACjC,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;IAL3B,gDAAgD;kBAClC,mBAAmB;IACjC,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;AAP7B,wBAscC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./TheCommandPalette.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c47a3ecf"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2fe57517"]]);
5
5
  export {
6
6
  r as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as V, ref as E, computed as f, watch as K, onBeforeMount as R, onBeforeUnmount as X, createBlock as v, openBlock as l, unref as r, withCtx as p, createElementVNode as u, createVNode as i, createElementBlock as s, createTextVNode as I, createCommentVNode as S, withKeys as x, withModifiers as C, Fragment as h, renderList as B, withDirectives as Q, toDisplayString as D, vShow as A, normalizeClass as F, resolveDynamicComponent as O, mergeProps as G, nextTick as H } from "vue";
1
+ import { defineComponent as V, ref as E, computed as f, watch as K, onBeforeMount as R, onBeforeUnmount as X, createBlock as v, openBlock as l, unref as r, withCtx as p, createElementVNode as u, createVNode as i, createElementBlock as s, createTextVNode as I, createCommentVNode as S, withKeys as x, withModifiers as C, Fragment as h, renderList as D, withDirectives as Q, toDisplayString as B, vShow as A, normalizeClass as F, resolveDynamicComponent as O, mergeProps as G, nextTick as H } from "vue";
2
2
  import { Dialog as U, DialogPanel as W, DialogTitle as $ } from "@headlessui/vue";
3
3
  import { ScalarIconMagnifyingGlass as j, ScalarIconCaretLeft as q } from "@scalar/icons";
4
4
  import { useRouter as J } from "vue-router";
@@ -58,7 +58,7 @@ const Y = {
58
58
  eventBus: e.eventBus,
59
59
  ...e.paletteState.activeCommandProps.value
60
60
  })), N = (t) => {
61
- t ? e.paletteState.open(t.action, t.payload) : e.paletteState.open();
61
+ t?.event && t.event.preventDefault(), t && "action" in t ? e.paletteState.open(t.action, t.payload) : e.paletteState.open();
62
62
  };
63
63
  return R(() => e.eventBus.on("ui:open:command-palette", N)), X(() => e.eventBus.off("ui:open:command-palette", N)), (t, a) => (l(), v(r(U), {
64
64
  open: e.paletteState.isOpen.value,
@@ -113,13 +113,13 @@ const Y = {
113
113
  ]
114
114
  }, null, 40, ee)
115
115
  ]),
116
- (l(!0), s(h, null, B(e.paletteState.filteredCommands.value, (n) => (l(), s(h, {
116
+ (l(!0), s(h, null, D(e.paletteState.filteredCommands.value, (n) => (l(), s(h, {
117
117
  key: n.label || "100"
118
118
  }, [
119
- Q(u("div", { class: "text-c-3 mt-2 mb-1 px-2 text-xs font-medium" }, D(n.label), 513), [
119
+ Q(u("div", { class: "text-c-3 mt-2 mb-1 px-2 text-xs font-medium" }, B(n.label), 513), [
120
120
  [A, n.commands.length > 0]
121
121
  ]),
122
- (l(!0), s(h, null, B(n.commands, (o) => (l(), s("button", {
122
+ (l(!0), s(h, null, D(n.commands, (o) => (l(), s("button", {
123
123
  id: o.id,
124
124
  key: o.id,
125
125
  class: F(["commandmenu-item hover:bg-b-2 flex w-full cursor-pointer items-center rounded px-2 py-1.5 text-left text-sm", {
@@ -134,7 +134,7 @@ const Y = {
134
134
  size: "md",
135
135
  thickness: "1.5"
136
136
  })) : S("", !0),
137
- I(" " + D(o.name), 1)
137
+ I(" " + B(o.name), 1)
138
138
  ], 10, te))), 128))
139
139
  ], 64))), 128)),
140
140
  e.paletteState.filteredCommands.value.flatMap((n) => n.commands).length ? S("", !0) : (l(), s("div", ne, " No commands found "))
@@ -1,6 +1,6 @@
1
1
  import type { ScalarIconComponent } from '@scalar/icons/types';
2
2
  import type { CommandPalettePayload } from '@scalar/workspace-store/events';
3
- import { type Component, type ComputedRef, type Ref, type ShallowRef } from 'vue';
3
+ import { type Component, type ComputedRef, type MaybeRefOrGetter, type Ref, type ShallowRef } from 'vue';
4
4
  import type { RouteLocationRaw } from 'vue-router';
5
5
  /**
6
6
  * Command IDs that map to UI components (folder and hidden-folder types)
@@ -100,7 +100,7 @@ export type CommandPaletteState = {
100
100
  * // Close and reset
101
101
  * palette.close()
102
102
  */
103
- export declare const useCommandPaletteState: (actions?: CommandPaletteAction[], routes?: CommandPaletteRoute[]) => CommandPaletteState;
103
+ export declare const useCommandPaletteState: (actions?: MaybeRefOrGetter<CommandPaletteAction[]>, routes?: MaybeRefOrGetter<CommandPaletteRoute[]>) => CommandPaletteState;
104
104
  /**
105
105
  * The base naviation routes used in the command palette.
106
106
  * This object can be extended and passed to the useCommandPaletteState hook to add custom routes
@@ -1 +1 @@
1
- {"version":3,"file":"use-command-palette-state.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/hooks/use-command-palette-state.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCiB,CAAA"}
@@ -1,61 +1,65 @@
1
- import { useModal as I } from "@scalar/components";
2
- import { ScalarIconArrowSquareIn as k, ScalarIconPackage as y, ScalarIconFolder as _, ScalarIconArrowUpRight as P, ScalarIconPuzzlePiece as A, ScalarIconBracketsCurly as R, ScalarIconCookie as q, ScalarIconSlidersHorizontal as b } from "@scalar/icons";
3
- import l from "fuse.js";
4
- import { ref as u, shallowRef as L, computed as t } from "vue";
5
- import $ from "../components/CommandPaletteDocument.vue.js";
6
- import x from "../components/CommandPaletteExample.vue.js";
7
- import z from "../components/CommandPaletteImport.vue.js";
8
- import F from "../components/CommandPaletteImportCurl.vue.js";
9
- import U from "../components/CommandPaletteRequest.vue.js";
10
- import E from "../components/CommandPaletteTag.vue.js";
11
- const V = (a = Q, i = O) => {
12
- const r = I(), n = u(""), m = L(null), c = u(null), d = t(() => r.open), p = new l(a, {
13
- keys: ["name"],
14
- threshold: 0.1
15
- }), f = new l(i, {
16
- keys: ["name"],
17
- threshold: 0.1
18
- }), v = t(() => {
1
+ import { useModal as k } from "@scalar/components";
2
+ import { ScalarIconArrowSquareIn as y, ScalarIconPackage as _, ScalarIconFolder as P, ScalarIconArrowUpRight as A, ScalarIconPuzzlePiece as R, ScalarIconBracketsCurly as b, ScalarIconCookie as q, ScalarIconSlidersHorizontal as L } from "@scalar/icons";
3
+ import d from "fuse.js";
4
+ import { ref as p, shallowRef as $, computed as o, toValue as a } from "vue";
5
+ import x from "../components/CommandPaletteDocument.vue.js";
6
+ import z from "../components/CommandPaletteExample.vue.js";
7
+ import F from "../components/CommandPaletteImport.vue.js";
8
+ import U from "../components/CommandPaletteImportCurl.vue.js";
9
+ import E from "../components/CommandPaletteRequest.vue.js";
10
+ import O from "../components/CommandPaletteTag.vue.js";
11
+ const W = (m = B, l = Q) => {
12
+ const c = k(), n = p(""), s = $(null), i = p(null), f = o(() => c.open), v = o(
13
+ () => new d(a(m), {
14
+ keys: ["name"],
15
+ threshold: 0.1
16
+ })
17
+ ), C = o(
18
+ () => new d(a(l), {
19
+ keys: ["name"],
20
+ threshold: 0.1
21
+ })
22
+ ), S = o(() => {
19
23
  const e = n.value.toLowerCase().trim();
20
- return (e ? p.search(e).map((o) => o.item) : a).filter((o) => !o.hidden);
21
- }), C = t(() => {
24
+ return (e ? v.value.search(e).map((t) => t.item) : a(m)).filter((t) => !t.hidden);
25
+ }), w = o(() => {
22
26
  const e = n.value.toLowerCase().trim();
23
- return e ? f.search(e).map((o) => o.item) : i;
24
- }), S = (e, ...o) => {
25
- e && (m.value = a.find((h) => h.id === e) ?? null, c.value = o[0] ?? null), r.show();
26
- }, w = () => {
27
- r.hide(), s();
28
- }, g = (e) => {
27
+ return e ? C.value.search(e).map((r) => r.item) : a(l);
28
+ }), g = (e, ...r) => {
29
+ e && (s.value = a(m).find((t) => t.id === e) ?? null, i.value = r[0] ?? null), c.show();
30
+ }, h = () => {
31
+ c.hide(), u();
32
+ }, I = (e) => {
29
33
  n.value = e;
30
- }, s = () => {
31
- n.value = "", m.value = null, c.value = null;
34
+ }, u = () => {
35
+ n.value = "", s.value = null, i.value = null;
32
36
  };
33
37
  return {
34
- isOpen: d,
35
- activeCommand: m,
36
- activeCommandProps: c,
38
+ isOpen: f,
39
+ activeCommand: s,
40
+ activeCommandProps: i,
37
41
  filterQuery: n,
38
- filteredCommands: t(() => [
42
+ filteredCommands: o(() => [
39
43
  {
40
44
  label: "",
41
- commands: v.value
45
+ commands: S.value
42
46
  },
43
47
  {
44
48
  label: "Pages",
45
- commands: C.value
49
+ commands: w.value
46
50
  }
47
51
  ]),
48
- open: S,
49
- close: w,
50
- setFilterQuery: g,
51
- reset: s
52
+ open: g,
53
+ close: h,
54
+ setFilterQuery: I,
55
+ reset: u
52
56
  };
53
- }, O = [
57
+ }, Q = [
54
58
  {
55
59
  type: "route",
56
60
  id: "environment",
57
61
  name: "Environment",
58
- icon: R,
62
+ icon: b,
59
63
  to: {
60
64
  name: "workspace.environment"
61
65
  }
@@ -73,51 +77,51 @@ const V = (a = Q, i = O) => {
73
77
  type: "route",
74
78
  id: "settings",
75
79
  name: "Settings",
76
- icon: b,
80
+ icon: L,
77
81
  to: {
78
82
  name: "workspace.settings"
79
83
  }
80
84
  }
81
- ], Q = [
85
+ ], B = [
82
86
  {
83
87
  id: "import-from-openapi-swagger-postman-curl",
84
88
  name: "Import from OpenAPI/Swagger/Postman/cURL",
85
- component: z,
86
- icon: k
89
+ component: F,
90
+ icon: y
87
91
  },
88
92
  {
89
93
  id: "create-document",
90
94
  name: "Create Document",
91
- component: $,
92
- icon: y
95
+ component: x,
96
+ icon: _
93
97
  },
94
98
  {
95
99
  id: "add-tag",
96
100
  name: "Add Tag",
97
- component: E,
98
- icon: _
101
+ component: O,
102
+ icon: P
99
103
  },
100
104
  {
101
105
  id: "create-request",
102
106
  name: "Create Request",
103
- component: U,
104
- icon: P
107
+ component: E,
108
+ icon: A
105
109
  },
106
110
  {
107
111
  id: "add-example",
108
112
  name: "Add Example",
109
- component: x,
110
- icon: A
113
+ component: z,
114
+ icon: R
111
115
  },
112
116
  {
113
117
  id: "import-curl-command",
114
118
  name: "Import cURL Command",
115
119
  hidden: !0,
116
- component: F
120
+ component: U
117
121
  }
118
122
  ];
119
123
  export {
120
- Q as baseClientActions,
121
- O as baseRoutes,
122
- V as useCommandPaletteState
124
+ B as baseClientActions,
125
+ Q as baseRoutes,
126
+ W as useCommandPaletteState
123
127
  };
@@ -69,7 +69,7 @@ const b = {
69
69
  type: "document"
70
70
  }), h = n(
71
71
  () => C(o(e.options)?.hiddenClients)
72
- ), f = "2.22.0";
72
+ ), f = "2.22.2";
73
73
  return (t, a) => e.path && e.method && e.exampleName && l.value ? (c(), x(i(p), {
74
74
  key: 0,
75
75
  appVersion: i(f),
@@ -1,14 +1,10 @@
1
1
  import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  import { type MaybeRefOrGetter } from 'vue';
3
- import type { FuseData } from '../types';
4
3
  /**
5
- * Creates the search index from an OpenAPI document.
4
+ * Creates the search index from multiple OpenAPI documents
6
5
  */
7
- export declare function useSearchIndex(documents: MaybeRefOrGetter<OpenApiDocument[]>): {
8
- results: import("vue").ComputedRef<{
9
- item: FuseData;
10
- refIndex: number;
11
- }[]>;
6
+ export declare const useSearchIndex: (documents: MaybeRefOrGetter<OpenApiDocument[]>) => {
7
+ results: import("vue").ComputedRef<import("@scalar/workspace-store/schemas/navigation").TraversedEntry[] | null>;
12
8
  query: import("vue").Ref<string, string>;
13
9
  };
14
10
  //# sourceMappingURL=use-search-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-search-index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/hooks/use-search-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,KAAK,CAAA;AAInE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,gBAAgB,CAAC,eAAe,EAAE,CAAC;;;;;;EAkC5E"}
1
+ {"version":3,"file":"use-search-index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/hooks/use-search-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,KAAK,CAAA;AAOnE;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,gBAAgB,CAAC,eAAe,EAAE,CAAC;;;CAiC5E,CAAA"}
@@ -1,24 +1,18 @@
1
- import { computed as n, toValue as l, ref as a } from "vue";
2
- import { createFuseInstance as i } from "../helpers/create-fuse-instance.js";
3
- import { createSearchIndex as m } from "../helpers/create-search-index.js";
4
- const s = 25;
5
- function h(o) {
6
- const r = n(() => {
7
- const t = i();
8
- return t.setCollection(m(l(o))), t;
9
- }), e = a("");
1
+ import { computed as n, toValue as o, ref as c } from "vue";
2
+ import { createFuseInstance as a } from "../helpers/create-fuse-instance.js";
3
+ import { createSearchIndex as l } from "../helpers/create-search-index.js";
4
+ const i = 25, h = (s) => {
5
+ const u = n(() => {
6
+ const t = a();
7
+ return t.setCollection(l(o(s))), t;
8
+ }), e = c("");
10
9
  return {
11
- results: n(() => e.value.length !== 0 ? r.value.search(e.value, {
12
- limit: s
13
- }) : r.value._docs.slice(0, s).map(
14
- (c, u) => ({
15
- item: c,
16
- refIndex: u
17
- })
18
- )),
10
+ results: n(() => e.value.length !== 0 ? u.value.search(e.value, {
11
+ limit: i
12
+ }).flatMap((r) => r.item.entry.type !== "operation" ? [] : r.item.entry) : null),
19
13
  query: e
20
14
  };
21
- }
15
+ };
22
16
  export {
23
17
  h as useSearchIndex
24
18
  };
@@ -1,3 +1,2 @@
1
- export { default as SearchButton } from './components/SearchButton.vue.js';
2
- export { default as SearchModal } from './components/SearchModal.vue.js';
1
+ export { useSearchIndex } from './hooks/use-search-index.js';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA"}
@@ -1,6 +1,4 @@
1
- import { default as o } from "./components/SearchButton.vue.js";
2
- import { default as t } from "./components/SearchModal.vue.js";
1
+ import { useSearchIndex as o } from "./hooks/use-search-index.js";
3
2
  export {
4
- o as SearchButton,
5
- t as SearchModal
3
+ o as useSearchIndex
6
4
  };
@@ -1,5 +1,5 @@
1
1
  import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
2
- export type EntryType = 'operation' | 'heading' | 'tag';
2
+ type EntryType = 'operation' | 'heading' | 'tag';
3
3
  type BaseFuse = {
4
4
  id: string;
5
5
  type: EntryType;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAChF,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAA;AAEvD,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,WAAW,GAAG,QAAQ,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,KAAK,OAAO,GAAG,QAAQ,GAAG;IACxB,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAEhF,KAAK,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAA;AAEhD,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,SAAS,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,aAAa,GAAG,QAAQ,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,KAAK,WAAW,GAAG,QAAQ,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,KAAK,OAAO,GAAG,QAAQ,GAAG;IACxB,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA"}
@@ -2,7 +2,7 @@ import { isMacOS as f } from "@scalar/helpers/general/is-mac-os";
2
2
  const r = {
3
3
  Enter: { event: "operation:send:request:hotkey", modifiers: ["default"] },
4
4
  b: { event: "ui:toggle:sidebar", modifiers: ["default"] },
5
- p: { event: "ui:open:command-palette", modifiers: ["shiftKey"] },
5
+ k: { event: "ui:open:command-palette", modifiers: ["default"] },
6
6
  l: { event: "ui:focus:address-bar", modifiers: ["default"] }
7
7
  }, n = {
8
8
  web: r,
@@ -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 = (u) => {
35
35
  u?.createNew && g.name === "request" && p();
36
- }, v = "2.22.0";
36
+ }, v = "2.22.2";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAA;AAEhE,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAgBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,EAAE,UAAU,SAAS,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAkB3G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,UAAU;AAChB,wEAAwE;AACxE,cAAc,MAAM;AACpB,kCAAkC;AAClC,WAAW,MAAM,KAChB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA4K/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,eAAe,EACrB,QAAQ,MAAM,EACd,2BAIG;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B,YAAK,EACN,cAAc,MAAM,GAAG,SAAS,KAC/B,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA2F/B,CAAA"}
1
+ {"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,qDAAqD;AACrD,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAA;AAEhE,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AA8BD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,EAAE,UAAU,SAAS,GAAG,OAAO,KAAG,OAAO,CAAC,MAAM,CAkB3G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,UAAU;AAChB,wEAAwE;AACxE,cAAc,MAAM;AACpB,kCAAkC;AAClC,WAAW,MAAM,KAChB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA0K/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,eAAe,EACrB,QAAQ,MAAM,EACd,2BAIG;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B,YAAK,EACN,cAAc,MAAM,GAAG,SAAS,KAC/B,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA2F/B,CAAA"}
@@ -1,113 +1,115 @@
1
+ import { isRelativePath as U } from "@scalar/helpers/url/is-relative-path";
1
2
  import { makeUrlAbsolute as x } from "@scalar/helpers/url/make-url-absolute";
2
- import { shouldUseProxy as U } from "@scalar/helpers/url/redirect-to-proxy";
3
- import { encode as w, fromUint8Array as S } from "js-base64";
4
- const A = () => {
3
+ import { shouldUseProxy as f } from "@scalar/helpers/url/redirect-to-proxy";
4
+ import { encode as A, fromUint8Array as k } from "js-base64";
5
+ const w = (e) => {
6
+ const a = e?.url;
7
+ return a ? U(a) ? typeof window > "u" ? {} : { basePath: a } : { baseUrl: a } : {};
8
+ }, b = () => {
5
9
  const e = new Uint8Array(32);
6
- return crypto.getRandomValues(e), S(e, !0);
7
- }, b = async (e, c) => {
8
- if (c === "plain")
10
+ return crypto.getRandomValues(e), k(e, !0);
11
+ }, E = async (e, a) => {
12
+ if (a === "plain")
9
13
  return e;
10
14
  if (typeof crypto?.subtle?.digest != "function")
11
15
  return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), e;
12
- const n = new TextEncoder().encode(e), o = await crypto.subtle.digest("SHA-256", n);
13
- return S(new Uint8Array(o), !0);
14
- }, T = async (e, c, u) => {
16
+ const c = new TextEncoder().encode(e), o = await crypto.subtle.digest("SHA-256", c);
17
+ return k(new Uint8Array(o), !0);
18
+ }, $ = async (e, a, u) => {
15
19
  try {
16
20
  if (!e)
17
21
  return [new Error("Flow not found"), null];
18
- const n = e.selectedScopes.join(" ");
22
+ const c = e.selectedScopes.join(" ");
19
23
  if (e.type === "clientCredentials" || e.type === "password")
20
- return k(
24
+ return S(
21
25
  e,
22
- n,
26
+ c,
23
27
  {
24
28
  proxyUrl: u
25
29
  },
26
- c
30
+ a
27
31
  );
28
- const o = (Math.random() + 1).toString(36).substring(2, 10), _ = x(e.authorizationUrl, {
29
- baseUrl: c?.url
30
- }), t = new URL(_);
32
+ const o = (Math.random() + 1).toString(36).substring(2, 10), _ = x(e.authorizationUrl, w(a)), t = new URL(_);
31
33
  let y = null;
32
34
  if (e.type === "implicit")
33
35
  t.searchParams.set("response_type", "token");
34
36
  else if (e.type === "authorizationCode" && (t.searchParams.set("response_type", "code"), e["x-usePkce"] !== "no")) {
35
- const r = A(), a = await b(r, e["x-usePkce"]);
37
+ const r = b(), s = await E(r, e["x-usePkce"]);
36
38
  y = {
37
39
  codeVerifier: r,
38
- codeChallenge: a,
40
+ codeChallenge: s,
39
41
  codeChallengeMethod: e["x-usePkce"] === "SHA-256" ? "S256" : "plain"
40
- }, t.searchParams.set("code_challenge", a), t.searchParams.set("code_challenge_method", y.codeChallengeMethod);
42
+ }, t.searchParams.set("code_challenge", s), t.searchParams.set("code_challenge_method", y.codeChallengeMethod);
41
43
  }
42
44
  if (e["x-scalar-redirect-uri"].startsWith("/")) {
43
- const r = c?.url || window.location.origin + window.location.pathname, a = x(e["x-scalar-redirect-uri"], { baseUrl: r });
44
- t.searchParams.set("redirect_uri", a);
45
+ const r = a?.url || window.location.origin + window.location.pathname, s = x(e["x-scalar-redirect-uri"], { baseUrl: r });
46
+ t.searchParams.set("redirect_uri", s);
45
47
  } else
46
48
  t.searchParams.set("redirect_uri", e["x-scalar-redirect-uri"]);
47
49
  e["x-scalar-security-query"] && Object.keys(e["x-scalar-security-query"]).forEach((r) => {
48
- const a = e["x-scalar-security-query"]?.[r];
49
- a && t.searchParams.set(r, a);
50
- }), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state", o), n && t.searchParams.set("scope", n);
51
- const s = window.open(t, "openAuth2Window", "left=100,top=100,width=800,height=600");
52
- return s ? new Promise((r) => {
53
- const a = setInterval(() => {
54
- let h = null, l = null, d = null, m = null;
50
+ const s = e["x-scalar-security-query"]?.[r];
51
+ s && t.searchParams.set(r, s);
52
+ }), t.searchParams.set("client_id", e["x-scalar-client-id"]), t.searchParams.set("state", o), c && t.searchParams.set("scope", c);
53
+ const n = window.open(t, "openAuth2Window", "left=100,top=100,width=800,height=600");
54
+ return n ? new Promise((r) => {
55
+ const s = setInterval(() => {
56
+ let h = null, d = null, l = null, m = null;
55
57
  try {
56
- const i = new URL(s.location.href).searchParams, P = e["x-tokenName"] || "access_token";
57
- h = i.get(P), l = i.get("code"), d = i.get("error"), m = i.get("error_description");
58
- const g = new URLSearchParams(s.location.href.split("#")[1]);
59
- h ||= g.get(P), l ||= g.get("code"), d ||= g.get("error"), m ||= g.get("error_description");
58
+ const i = new URL(n.location.href).searchParams, P = e["x-tokenName"] || "access_token";
59
+ h = i.get(P), d = i.get("code"), l = i.get("error"), m = i.get("error_description");
60
+ const g = new URLSearchParams(n.location.href.split("#")[1]);
61
+ h ||= g.get(P), d ||= g.get("code"), l ||= g.get("error"), m ||= g.get("error_description");
60
62
  } catch {
61
63
  }
62
- if (s.closed || h || l || d)
63
- if (clearInterval(a), s.close(), d)
64
- r([new Error(`OAuth error: ${d}${m ? ` (${m})` : ""}`), null]);
64
+ if (n.closed || h || d || l)
65
+ if (clearInterval(s), n.close(), l)
66
+ r([new Error(`OAuth error: ${l}${m ? ` (${m})` : ""}`), null]);
65
67
  else if (h) {
66
- const i = s.location.href.match(/state=([^&]*)/)?.[1];
68
+ const i = n.location.href.match(/state=([^&]*)/)?.[1];
67
69
  r(i === o ? [null, h] : [new Error("State mismatch"), null]);
68
- } else l ? new URL(s.location.href).searchParams.get("state") === o ? k(
70
+ } else d ? new URL(n.location.href).searchParams.get("state") === o ? S(
69
71
  e,
70
- n,
72
+ c,
71
73
  {
72
- code: l,
74
+ code: d,
73
75
  pkce: y,
74
76
  proxyUrl: u
75
77
  },
76
- c
77
- ).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(a), r([new Error("Window was closed without granting authorization"), null]));
78
+ a
79
+ ).then(r) : r([new Error("State mismatch"), null]) : (clearInterval(s), r([new Error("Window was closed without granting authorization"), null]));
78
80
  }, 200);
79
81
  }) : [new Error("Failed to open auth window"), null];
80
82
  } catch {
81
83
  return [new Error("Failed to authorize oauth2 flow"), null];
82
84
  }
83
- }, k = async (e, c, {
85
+ }, S = async (e, a, {
84
86
  code: u,
85
- pkce: n,
87
+ pkce: c,
86
88
  proxyUrl: o
87
89
  } = {}, _) => {
88
90
  if (!e)
89
91
  return [new Error("OAuth2 flow was not defined"), null];
90
92
  const t = new URLSearchParams();
91
- t.set("client_id", e["x-scalar-client-id"]), c && (e.type === "clientCredentials" || e.type === "password") && t.set("scope", c), e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "body") && t.set("client_secret", e.clientSecret), "x-scalar-redirect-uri" in e && e["x-scalar-redirect-uri"] && t.set("redirect_uri", e["x-scalar-redirect-uri"]), u ? (t.set("code", u), t.set("grant_type", "authorization_code"), n && t.set("code_verifier", n.codeVerifier)) : e.type === "password" ? (t.set("grant_type", "password"), t.set("username", e.username), t.set("password", e.password)) : t.set("grant_type", "client_credentials"), e["x-scalar-security-body"] && Object.entries(e["x-scalar-security-body"]).forEach(([p, s]) => {
92
- s && t.set(p, s);
93
+ t.set("client_id", e["x-scalar-client-id"]), a && (e.type === "clientCredentials" || e.type === "password") && t.set("scope", a), e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "body") && t.set("client_secret", e.clientSecret), "x-scalar-redirect-uri" in e && e["x-scalar-redirect-uri"] && t.set("redirect_uri", e["x-scalar-redirect-uri"]), u ? (t.set("code", u), t.set("grant_type", "authorization_code"), c && t.set("code_verifier", c.codeVerifier)) : e.type === "password" ? (t.set("grant_type", "password"), t.set("username", e.username), t.set("password", e.password)) : t.set("grant_type", "client_credentials"), e["x-scalar-security-body"] && Object.entries(e["x-scalar-security-body"]).forEach(([p, n]) => {
94
+ n && t.set(p, n);
93
95
  });
94
96
  try {
95
97
  const p = {
96
98
  "Content-Type": "application/x-www-form-urlencoded"
97
99
  };
98
- e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${w(`${e["x-scalar-client-id"]}:${e.clientSecret}`)}`);
99
- const r = x(e.tokenUrl, { baseUrl: _?.url }), a = U(o, r) ? `${o}?${new URLSearchParams([["scalar_url", r]]).toString()}` : r, l = await (await fetch(a, {
100
+ e.clientSecret && (!e["x-scalar-credentials-location"] || e["x-scalar-credentials-location"] === "header") && (p.Authorization = `Basic ${A(`${e["x-scalar-client-id"]}:${e.clientSecret}`)}`);
101
+ const r = x(e.tokenUrl, w(_)), s = f(o, r) ? `${o}?${new URLSearchParams([["scalar_url", r]]).toString()}` : r, d = await (await fetch(s, {
100
102
  method: "POST",
101
103
  headers: p,
102
104
  body: t
103
- })).json(), d = e["x-tokenName"] || "access_token";
104
- return [null, l[d]];
105
+ })).json(), l = e["x-tokenName"] || "access_token";
106
+ return [null, d[l]];
105
107
  } catch {
106
108
  return [new Error("Failed to get an access token. Please check your credentials."), null];
107
109
  }
108
110
  };
109
111
  export {
110
- T as authorizeOauth2,
111
- k as authorizeServers,
112
- b as generateCodeChallenge
112
+ $ as authorizeOauth2,
113
+ S as authorizeServers,
114
+ E as generateCodeChallenge
113
115
  };