@scalar/api-reference 1.25.80 → 1.25.82

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 (49) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/browser/standalone.js +13239 -14204
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Anchor/Anchor.vue.d.ts.map +1 -1
  5. package/dist/components/Anchor/Anchor.vue.js +1 -1
  6. package/dist/components/Anchor/Anchor.vue2.js +19 -21
  7. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  8. package/dist/components/ApiReferenceLayout.vue.js +1 -1
  9. package/dist/components/ApiReferenceLayout.vue2.js +94 -90
  10. package/dist/components/Content/ClientLibraries/ClientSelector.vue.d.ts.map +1 -1
  11. package/dist/components/Content/ClientLibraries/ClientSelector.vue.js +1 -1
  12. package/dist/components/Content/ClientLibraries/ClientSelector.vue2.js +22 -20
  13. package/dist/components/Content/Introduction/Description.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Introduction/Description.vue.js +2 -2
  15. package/dist/components/Content/Introduction/Description.vue2.js +30 -33
  16. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  17. package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
  18. package/dist/components/Content/Schema/SchemaProperty.vue2.js +106 -102
  19. package/dist/components/Section/CompactSection.vue.js +2 -2
  20. package/dist/components/Section/CompactSection.vue2.js +14 -14
  21. package/dist/components/Section/Section.vue.d.ts.map +1 -1
  22. package/dist/components/Section/Section.vue.js +1 -1
  23. package/dist/components/Section/Section.vue2.js +16 -19
  24. package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
  25. package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
  26. package/dist/components/Sidebar/SidebarElement.vue2.js +42 -46
  27. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +4 -4
  28. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  29. package/dist/features/ApiClientModal/ApiClientModal.vue.js +12 -12
  30. package/dist/features/ApiClientModal/useApiClient.d.ts +28 -28
  31. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  32. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  33. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +1 -1
  34. package/dist/helpers/convertRequestToHarRequest.d.ts +1 -1
  35. package/dist/helpers/convertRequestToHarRequest.d.ts.map +1 -1
  36. package/dist/helpers/getExampleCode.d.ts +3 -4
  37. package/dist/helpers/getExampleCode.d.ts.map +1 -1
  38. package/dist/helpers/getExampleCode.js +12 -31
  39. package/dist/hooks/useNavState.d.ts +22 -0
  40. package/dist/hooks/useNavState.d.ts.map +1 -1
  41. package/dist/hooks/useNavState.js +57 -34
  42. package/dist/index.js +1 -1
  43. package/dist/stores/useHttpClientStore.d.ts +3 -4
  44. package/dist/stores/useHttpClientStore.d.ts.map +1 -1
  45. package/dist/stores/useHttpClientStore.js +45 -58
  46. package/dist/style.css +1 -1
  47. package/dist/types.d.ts +2 -5
  48. package/dist/types.d.ts.map +1 -1
  49. package/package.json +9 -10
@@ -1,35 +1,16 @@
1
1
  import { snippetz as i } from "@scalar/snippetz";
2
- import { HTTPSnippet as c } from "httpsnippet-lite";
3
- import { convertRequestToHarRequest as l } from "./convertRequestToHarRequest.js";
4
- async function h(t, e, r) {
5
- const p = await l(t), s = e;
6
- if (i().hasPlugin(s, r))
7
- return i().print(
8
- e,
9
- r,
10
- // TODO: We shouldn’t cast the type here.
11
- // Luckily, the difference between those two types is tiny. We’ll get rid of this compatibility issue soon.
12
- p
13
- );
14
- if (t.url.startsWith("__"))
15
- return t.url;
16
- try {
17
- const o = e == null ? void 0 : e.replace(
18
- "js",
19
- "javascript"
20
- ), a = r, n = await new c(p).convert(
21
- o,
22
- a
23
- );
24
- if (typeof n == "string") return n;
25
- } catch (o) {
26
- console.error(
27
- "[getExampleCode] Failed to generate example code with httpsnippet-lite:",
28
- o
29
- );
30
- }
31
- return "";
2
+ import { convertRequestToHarRequest as p } from "./convertRequestToHarRequest.js";
3
+ async function u(r, n, t) {
4
+ const o = await p(r), e = n == null ? void 0 : n.replace(
5
+ "javascript",
6
+ "js"
7
+ );
8
+ return i().hasPlugin(e, t) ? i().print(
9
+ e,
10
+ t,
11
+ o
12
+ ) : r.url.startsWith("__") ? r.url : "";
32
13
  }
33
14
  export {
34
- h as getExampleCode
15
+ u as getExampleCode
35
16
  };
@@ -9,6 +9,28 @@ import type { PathRouting } from '../types';
9
9
  */
10
10
  export declare const useNavState: () => {
11
11
  hash: import("vue").Ref<string, string>;
12
+ /** Sets the prefix for the hash */
13
+ setHashPrefix: (prefix: string) => void;
14
+ /**
15
+ * Gets the full hash with the prefix
16
+ * @param hashTarget The hash to target with the return
17
+ * @returns The full hash
18
+ */
19
+ getFullHash: (hashTarget?: string) => string;
20
+ /**
21
+ * Gets the hashed url with the prefix
22
+ * @param replacementHash The hash to replace the current hash with
23
+ * @param url The url to get the hashed url from
24
+ * @returns The hashed url
25
+ */
26
+ getHashedUrl: (replacementHash: string, url?: string, search?: string) => string;
27
+ /**
28
+ * Replaces the URL state with the new url and hash
29
+ * Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
30
+ */
31
+ replaceUrlState: (replacementHash: string, url?: string) => void;
32
+ /** Gets the portion of the hash used by the references */
33
+ getReferenceHash: () => string;
12
34
  getWebhookId: (name?: string, httpVerb?: string) => string;
13
35
  getModelId: (name?: string) => string;
14
36
  getHeadingId: (heading: Heading) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AA2E3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;0BArDK,MAAM,aAAa,MAAM;wBAU3B,MAAM;4BAzBF,OAAO;gCAmCH,oBAAoB,aAAa,GAAG;iCA3BnC,MAAM;;yBA8Bd,GAAG;;;;CA0C7B,CAAA"}
1
+ {"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAsH3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IAEtB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BAhC4B,MAAM;IAkCrC;;;;;OAKG;oCAjDc,MAAM;IAmDvB;;;OAGG;uCA3Ec,MAAM;IA6EvB,0DAA0D;;0BAtH/B,MAAM,aAAa,MAAM;wBAQ3B,MAAM;4BAvBF,OAAO;gCA+BH,oBAAoB,aAAa,GAAG;iCAvBnC,MAAM;;yBA0Bd,GAAG;;;;CA+G7B,CAAA"}
@@ -1,43 +1,66 @@
1
- import { ssrState as g } from "@scalar/oas-utils/helpers";
1
+ import { ssrState as d } from "@scalar/oas-utils/helpers";
2
2
  import { slug as c } from "github-slugger";
3
- import { ref as d } from "vue";
4
- const r = d(g.hash ?? ""), n = d(), i = d(!1), h = (e) => e.slug ? `description/${e.slug}` : "", u = (e) => {
5
- var t;
3
+ import { ref as l } from "vue";
4
+ import { joinWithSlash as g } from "../helpers/joinWithSlash.js";
5
+ const a = l(""), r = l(d.hash ?? ""), n = l(), w = l(!1), p = (e) => e.slug ? `description/${e.slug}` : "", h = (e) => {
6
+ var o;
6
7
  if (!n.value) return "";
7
- const o = new RegExp("^" + ((t = n.value) == null ? void 0 : t.basePath) + "/?");
8
- return decodeURIComponent(e.replace(o, ""));
9
- }, p = (e, o) => {
10
- if (!e)
11
- return "webhooks";
12
- const t = c(e), s = encodeURIComponent(t);
13
- return `webhook/${o}/${s}`;
14
- }, m = (e) => {
15
- if (!e)
16
- return "models";
17
- const o = c(e);
18
- return `model/${encodeURIComponent(o)}`;
19
- }, I = (e, o) => `${l(o)}/${e.httpVerb}${e.path}`, l = ({ name: e }) => {
20
- const o = c(e);
21
- return `tag/${encodeURIComponent(o)}`;
22
- }, w = (e = r.value) => {
23
- var a;
24
- const o = (a = e.match(/(tag\/[^/]+)/)) == null ? void 0 : a[0], t = e.startsWith("model") ? "models" : "", s = e.startsWith("webhook") ? "webhooks" : "";
25
- return o || t || s;
8
+ const t = new RegExp("^" + ((o = n.value) == null ? void 0 : o.basePath) + "/?");
9
+ return decodeURIComponent(e.replace(t, ""));
10
+ }, f = (e, t) => e ? `webhook/${t}/${c(e)}` : "webhooks", v = (e) => e ? `model/${c(e)}` : "models", m = (e, t) => `${u(t)}/${e.httpVerb}${e.path}`, u = ({ name: e }) => `tag/${c(e)}`, I = (e = r.value) => {
11
+ var i;
12
+ const t = (i = e.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], o = e.startsWith("model") ? "models" : "", s = e.startsWith("webhook") ? "webhooks" : "";
13
+ return t || o || s;
26
14
  }, b = () => {
27
- r.value = n.value ? u(window.location.pathname) : decodeURIComponent(window.location.hash.replace(/^#/, ""));
28
- }, $ = () => ({
15
+ r.value = n.value ? h(window.location.pathname) : (
16
+ // Must remove the prefix from the hash as the internal hash value should be pure
17
+ window.location.hash.replace(/^#/, "").slice(a.value.length)
18
+ );
19
+ }, $ = (e, t = window.location.href) => {
20
+ const o = new URL(t);
21
+ n.value ? o.pathname = g(n.value.basePath, e) : o.hash = a.value + e, r.value = e, window.history.replaceState({}, "", o);
22
+ }, R = (e, t = window.location.href, o = window.location.search) => {
23
+ const s = new URL(t);
24
+ return s.hash = a.value + e, s.search = o, s.toString();
25
+ }, U = (e = r.value) => `${a.value}${e}`, k = () => decodeURIComponent(
26
+ window.location.hash.replace(/^#/, "").slice(a.value.length)
27
+ ), W = () => ({
29
28
  hash: r,
30
- getWebhookId: p,
31
- getModelId: m,
32
- getHeadingId: h,
33
- getOperationId: I,
34
- getPathRoutingId: u,
35
- getSectionId: w,
36
- getTagId: l,
37
- isIntersectionEnabled: i,
29
+ /** Sets the prefix for the hash */
30
+ setHashPrefix: (e) => {
31
+ a.value = e;
32
+ },
33
+ /**
34
+ * Gets the full hash with the prefix
35
+ * @param hashTarget The hash to target with the return
36
+ * @returns The full hash
37
+ */
38
+ getFullHash: U,
39
+ /**
40
+ * Gets the hashed url with the prefix
41
+ * @param replacementHash The hash to replace the current hash with
42
+ * @param url The url to get the hashed url from
43
+ * @returns The hashed url
44
+ */
45
+ getHashedUrl: R,
46
+ /**
47
+ * Replaces the URL state with the new url and hash
48
+ * Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
49
+ */
50
+ replaceUrlState: $,
51
+ /** Gets the portion of the hash used by the references */
52
+ getReferenceHash: k,
53
+ getWebhookId: f,
54
+ getModelId: v,
55
+ getHeadingId: p,
56
+ getOperationId: m,
57
+ getPathRoutingId: h,
58
+ getSectionId: I,
59
+ getTagId: u,
60
+ isIntersectionEnabled: w,
38
61
  pathRouting: n,
39
62
  updateHash: b
40
63
  });
41
64
  export {
42
- $ as useNavState
65
+ W as useNavState
43
66
  };