@scalar/api-reference 1.33.0 → 1.34.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 (146) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/browser/standalone.js +13260 -13196
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Anchor/WithBreadcrumb.vue.d.ts +24 -0
  5. package/dist/components/Anchor/WithBreadcrumb.vue.d.ts.map +1 -0
  6. package/dist/components/Anchor/WithBreadcrumb.vue.js +4 -0
  7. package/dist/components/Anchor/WithBreadcrumb.vue2.js +46 -0
  8. package/dist/components/Anchor/index.d.ts +1 -0
  9. package/dist/components/Anchor/index.d.ts.map +1 -1
  10. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  11. package/dist/components/ApiReferenceLayout.vue.js +1 -1
  12. package/dist/components/ApiReferenceLayout.vue2.js +184 -201
  13. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
  15. package/dist/components/Content/Introduction/Introduction.vue2.js +1 -0
  16. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -0
  17. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Operations/TraversedEntry.vue.js +34 -32
  19. package/dist/components/Content/Operations/TraversedEntryContainer.vue.d.ts.map +1 -1
  20. package/dist/components/Content/Operations/TraversedEntryContainer.vue.js +33 -29
  21. package/dist/components/Content/Operations/get-current-index.d.ts +4 -0
  22. package/dist/components/Content/Operations/get-current-index.d.ts.map +1 -0
  23. package/dist/components/Content/Operations/get-current-index.js +16 -0
  24. package/dist/components/Content/Schema/Schema.preview.d.ts +28 -0
  25. package/dist/components/Content/Schema/Schema.preview.d.ts.map +1 -1
  26. package/dist/components/Content/Schema/Schema.vue.d.ts +2 -0
  27. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  28. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  29. package/dist/components/Content/Schema/Schema.vue2.js +164 -157
  30. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +1 -0
  31. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  32. package/dist/components/Content/Schema/SchemaComposition.vue.js +58 -53
  33. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts +1 -0
  34. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
  35. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +52 -40
  36. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -0
  37. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  38. package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
  39. package/dist/components/Content/Schema/SchemaProperty.vue2.js +100 -87
  40. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  41. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
  42. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +4 -1
  43. package/dist/components/Lazy/Lazy.vue.d.ts +1 -0
  44. package/dist/components/Lazy/Lazy.vue.d.ts.map +1 -1
  45. package/dist/components/Lazy/Lazy.vue2.js +12 -11
  46. package/dist/components/Lazy/lazyBus.d.ts +5 -3
  47. package/dist/components/Lazy/lazyBus.d.ts.map +1 -1
  48. package/dist/components/OperationsList/OperationsListItem.vue.d.ts.map +1 -1
  49. package/dist/components/OperationsList/OperationsListItem.vue.js +1 -1
  50. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts +4 -4
  51. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
  52. package/dist/features/Operation/components/OperationParameters.vue.d.ts +1 -0
  53. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  54. package/dist/features/Operation/components/OperationParameters.vue.js +49 -43
  55. package/dist/features/Operation/components/OperationResponses.vue.d.ts +1 -0
  56. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  57. package/dist/features/Operation/components/OperationResponses.vue.js +4 -3
  58. package/dist/features/Operation/components/ParameterHeaders.vue.d.ts +1 -0
  59. package/dist/features/Operation/components/ParameterHeaders.vue.d.ts.map +1 -1
  60. package/dist/features/Operation/components/ParameterHeaders.vue.js +2 -2
  61. package/dist/features/Operation/components/ParameterHeaders.vue2.js +28 -26
  62. package/dist/features/Operation/components/ParameterList.vue.d.ts +1 -0
  63. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  64. package/dist/features/Operation/components/ParameterList.vue.js +2 -2
  65. package/dist/features/Operation/components/ParameterList.vue2.js +17 -15
  66. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +1 -0
  67. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  68. package/dist/features/Operation/components/ParameterListItem.vue.js +2 -2
  69. package/dist/features/Operation/components/ParameterListItem.vue2.js +17 -16
  70. package/dist/features/Operation/components/RequestBody.vue.d.ts +2 -2
  71. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  72. package/dist/features/Operation/components/RequestBody.vue.js +2 -2
  73. package/dist/features/Operation/components/RequestBody.vue2.js +47 -39
  74. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +1 -0
  75. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  76. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  77. package/dist/features/Operation/components/callbacks/Callback.vue2.js +12 -11
  78. package/dist/features/Operation/components/callbacks/Callback.vue3.js +2 -2
  79. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  80. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  81. package/dist/features/Operation/layouts/ModernLayout.vue2.js +63 -61
  82. package/dist/features/Search/{SearchButton.vue.d.ts → components/SearchButton.vue.d.ts} +0 -2
  83. package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -0
  84. package/dist/features/Search/components/SearchButton.vue.js +65 -0
  85. package/dist/features/Search/{SearchModal.vue.d.ts → components/SearchModal.vue.d.ts} +0 -2
  86. package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -0
  87. package/dist/features/Search/components/SearchModal.vue.js +7 -0
  88. package/dist/features/Search/components/SearchModal.vue2.js +199 -0
  89. package/dist/features/Search/helpers/create-fuse-instance.d.ts +9 -0
  90. package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -0
  91. package/dist/features/Search/helpers/create-fuse-instance.js +46 -0
  92. package/dist/features/Search/helpers/create-search-index.d.ts +7 -0
  93. package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -0
  94. package/dist/features/Search/helpers/create-search-index.js +109 -0
  95. package/dist/features/Search/hooks/useSearchIndex.d.ts +14 -0
  96. package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -0
  97. package/dist/features/Search/hooks/useSearchIndex.js +46 -0
  98. package/dist/features/Search/index.d.ts +2 -2
  99. package/dist/features/Search/index.d.ts.map +1 -1
  100. package/dist/features/Search/types.d.ts +15 -0
  101. package/dist/features/Search/types.d.ts.map +1 -0
  102. package/dist/features/api-client-modal/useApiClient.d.ts +14 -14
  103. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  104. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +3 -1
  105. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
  106. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
  107. package/dist/features/traverse-schema/helpers/traverse-schemas.js +18 -18
  108. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
  109. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
  110. package/dist/features/traverse-schema/types.d.ts +10 -6
  111. package/dist/features/traverse-schema/types.d.ts.map +1 -1
  112. package/dist/helpers/test-utils.d.ts +9 -0
  113. package/dist/helpers/test-utils.d.ts.map +1 -1
  114. package/dist/hooks/useNavState.d.ts +4 -1
  115. package/dist/hooks/useNavState.d.ts.map +1 -1
  116. package/dist/index.d.ts +0 -1
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +17 -19
  119. package/dist/libs/openapi.d.ts +11 -8
  120. package/dist/libs/openapi.d.ts.map +1 -1
  121. package/dist/libs/openapi.js +34 -55
  122. package/dist/style.css +1 -1
  123. package/dist/types.d.ts +1 -6
  124. package/dist/types.d.ts.map +1 -1
  125. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  126. package/dist/v2/ApiReferenceWorkspace.vue.js +120 -111
  127. package/dist/v2/helpers/get-document-name.d.ts +13 -0
  128. package/dist/v2/helpers/get-document-name.d.ts.map +1 -0
  129. package/dist/v2/helpers/get-document-name.js +15 -0
  130. package/dist/v2/helpers/normalize-content.d.ts +3 -0
  131. package/dist/v2/helpers/normalize-content.d.ts.map +1 -0
  132. package/dist/v2/helpers/normalize-content.js +8 -0
  133. package/package.json +14 -8
  134. package/dist/features/Search/SearchButton.vue.d.ts.map +0 -1
  135. package/dist/features/Search/SearchButton.vue.js +0 -66
  136. package/dist/features/Search/SearchModal.vue.d.ts.map +0 -1
  137. package/dist/features/Search/SearchModal.vue.js +0 -7
  138. package/dist/features/Search/SearchModal.vue2.js +0 -207
  139. package/dist/features/Search/useSearchIndex.d.ts +0 -32
  140. package/dist/features/Search/useSearchIndex.d.ts.map +0 -1
  141. package/dist/features/Search/useSearchIndex.js +0 -170
  142. package/dist/helpers/parse.d.ts +0 -10
  143. package/dist/helpers/parse.d.ts.map +0 -1
  144. package/dist/helpers/parse.js +0 -81
  145. /package/dist/features/Search/{SearchButton.vue2.js → components/SearchButton.vue2.js} +0 -0
  146. /package/dist/features/Search/{SearchModal.vue3.js → components/SearchModal.vue3.js} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AnyApiReferenceConfiguration, ApiReferenceConfiguration } from '@scalar/types/api-reference';
2
- import type { OpenAPIV3_1, Spec } from '@scalar/types/legacy';
2
+ import type { OpenAPIV3_1 } from '@scalar/types/legacy';
3
3
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
4
4
  export type { ApiReferenceConfiguration };
5
5
  export type ReferenceProps = {
@@ -29,10 +29,6 @@ export type ReferenceLayoutProps = {
29
29
  */
30
30
  originalDocument?: string;
31
31
  isDark: boolean;
32
- /**
33
- * @deprecated We can't use this anymore. Use `dereferencedDocument` instead.
34
- */
35
- parsedSpec?: Spec;
36
32
  /**
37
33
  * @deprecated Use `originalDocument` instead.
38
34
  */
@@ -70,7 +66,6 @@ export type DocumentSelectorSlot = {
70
66
  'document-selector': any;
71
67
  };
72
68
  export type ReferenceSlotProps = {
73
- spec: Spec;
74
69
  breadcrumb: string;
75
70
  };
76
71
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC1G,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,YAAY,EAAE,yBAAyB,EAAE,CAAA;AAEzC,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,4BAA4B,CAAA;CAC7C,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACjD;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC3C;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB;;OAEG;IACH,OAAO,CAAC,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,GACR,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,aAAa,GACb,eAAe,GACf,aAAa,CAAA;AAEjB,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,mBAAmB,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG;CAC/D,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,EAAE,GAAG,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"AAkVA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAA;AAEjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA0BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAkOF,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;wBAXrB,GAAG;wBACH,GAAG;iCACM,GAAG;;;;;;EAcxC;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"AAmVA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA2BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AA+NF,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;wBAXrB,GAAG;wBACH,GAAG;iCACM,GAAG;;;;;;EAcxC;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,153 +1,162 @@
1
- import { defineComponent as N, ref as p, toRef as _, provide as $, useTemplateRef as P, onServerPrefetch as V, onBeforeMount as A, onMounted as B, watch as s, computed as w, createElementBlock as U, openBlock as E, createBlock as K, createCommentVNode as Y, createVNode as D, unref as r, resolveDynamicComponent as F, withCtx as u, createTextVNode as O, toDisplayString as j, renderSlot as v, isRef as H } from "vue";
2
- import { safeLocalStorage as x, REFERENCE_LS_KEYS as h } from "@scalar/helpers/object/local-storage";
3
- import { makeUrlAbsolute as J } from "@scalar/helpers/url/make-url-absolute";
4
- import { parseJsonOrYaml as W, redirectToProxy as q } from "@scalar/oas-utils/helpers";
5
- import { useColorMode as z } from "@scalar/use-hooks/useColorMode";
6
- import { useSeoMeta as G } from "@unhead/vue";
7
- import { useFavicon as Q } from "@vueuse/core";
8
- import X from "../components/ApiReferenceLayout.vue.js";
9
- import { NAV_STATE_SYMBOL as Z } from "../hooks/useNavState.js";
10
- import { isClient as y } from "./blocks/scalar-request-example-block/helpers/find-client.js";
1
+ import { defineComponent as R, ref as c, toRef as _, provide as $, useTemplateRef as w, onBeforeMount as V, watch as u, computed as A, createElementBlock as B, openBlock as D, createBlock as P, createCommentVNode as U, createVNode as E, unref as n, resolveDynamicComponent as K, withCtx as s, createTextVNode as F, toDisplayString as O, renderSlot as p, isRef as Y } from "vue";
2
+ import { safeLocalStorage as x, REFERENCE_LS_KEYS as g } from "@scalar/helpers/object/local-storage";
3
+ import { makeUrlAbsolute as z } from "@scalar/helpers/url/make-url-absolute";
4
+ import { redirectToProxy as H } from "@scalar/oas-utils/helpers";
5
+ import { useColorMode as W } from "@scalar/use-hooks/useColorMode";
6
+ import { deepClone as j } from "@scalar/workspace-store/helpers/general";
7
+ import { useSeoMeta as q } from "@unhead/vue";
8
+ import { useFavicon as G } from "@vueuse/core";
9
+ import J from "../components/ApiReferenceLayout.vue.js";
10
+ import { NAV_STATE_SYMBOL as Q } from "../hooks/useNavState.js";
11
+ import { isClient as M } from "./blocks/scalar-request-example-block/helpers/find-client.js";
12
+ import { getDocumentName as X } from "./helpers/get-document-name.js";
13
+ import { normalizeContent as Z } from "./helpers/normalize-content.js";
11
14
  import { useMultipleDocuments as ee } from "../features/multiple-documents/useMultipleDocuments.js";
12
- import { onCustomEvent as k } from "./events/listeners.js";
15
+ import { onCustomEvent as f } from "./events/listeners.js";
13
16
  import te from "../features/multiple-documents/DocumentSelector.vue.js";
14
- const ve = /* @__PURE__ */ N({
17
+ const De = /* @__PURE__ */ R({
15
18
  __name: "ApiReferenceWorkspace",
16
19
  props: {
17
20
  configuration: {},
18
21
  store: {}
19
22
  },
20
- setup(M) {
21
- const C = M, {
22
- availableDocuments: d,
23
- selectedConfiguration: a,
23
+ setup(y) {
24
+ const v = y, {
25
+ availableDocuments: C,
26
+ selectedConfiguration: o,
24
27
  selectedDocumentIndex: i,
25
- isIntersectionEnabled: S,
26
- hash: g,
28
+ isIntersectionEnabled: m,
29
+ hash: S,
27
30
  hashPrefix: T
28
31
  } = ee({
29
- configuration: _(C, "configuration"),
30
- isIntersectionEnabled: p(!1),
31
- hash: p(""),
32
- hashPrefix: p("")
33
- }), b = (e, t) => fetch(
34
- q(a.value.proxyUrl, e.toString()),
32
+ configuration: _(v, "configuration"),
33
+ isIntersectionEnabled: c(!1),
34
+ hash: c(""),
35
+ hashPrefix: c("")
36
+ }), h = (e, t) => fetch(
37
+ H(o.value.proxyUrl, e.toString()),
35
38
  t
36
39
  );
37
- $(Z, { isIntersectionEnabled: S, hash: g, hashPrefix: T });
38
- const c = P("root"), o = C.store, f = d, m = (e) => {
39
- var t;
40
- if (o.workspace.documents[e.slug ?? "default"] === void 0) {
41
- if (e.content) {
42
- const n = typeof e.content == "string" ? W(e.content) : e.content;
43
- return o.addDocumentSync({
44
- name: e.slug ?? "default",
45
- document: typeof n == "function" ? n() : n
46
- });
47
- }
48
- if (e.url)
49
- return o.addDocument({
50
- name: e.slug ?? "default",
51
- url: J(e.url, {
52
- basePath: (t = a.value.pathRouting) == null ? void 0 : t.basePath
53
- }),
54
- fetch: b
55
- });
56
- }
57
- };
58
- f.value.forEach((e) => {
59
- e.content && m(e);
60
- }), V(() => {
61
- f.value.forEach((e) => {
62
- e.url && m(e);
63
- });
64
- }), A(() => {
40
+ $(Q, { isIntersectionEnabled: m, hash: S, hashPrefix: T });
41
+ const d = w("root"), a = v.store;
42
+ V(() => {
65
43
  const e = x().getItem(
66
- h.SELECTED_CLIENT
44
+ g.SELECTED_CLIENT
67
45
  );
68
- y(e) && !o.workspace["x-scalar-default-client"] && o.update("x-scalar-default-client", e);
69
- }), B(() => {
70
- f.value.forEach((e) => {
71
- e.url && m(e);
46
+ M(e) && !a.workspace["x-scalar-default-client"] && a.update("x-scalar-default-client", e);
47
+ });
48
+ const k = async (e) => {
49
+ var l;
50
+ const t = Z(e.content), r = X({
51
+ name: e.slug || e.title,
52
+ url: e.url,
53
+ document: t
72
54
  });
73
- }), k(c, "scalar-update-dark-mode", (e) => {
74
- o.update("x-scalar-dark-mode", e.detail.value);
75
- }), k(c, "scalar-update-active-document", (e) => {
76
- o.update("x-scalar-active-document", e.detail.value);
77
- }), k(c, "scalar-update-selected-client", (e) => {
78
- o.update("x-scalar-default-client", e.detail), x().setItem(h.SELECTED_CLIENT, e.detail);
79
- }), s(
80
- () => a.value.defaultHttpClient,
55
+ if (a.workspace.documents[r]) {
56
+ if (t) {
57
+ m.value = !1;
58
+ const N = j(t);
59
+ a.replaceDocument(r, N), a.update("x-scalar-active-document", r), setTimeout(() => {
60
+ m.value = !0;
61
+ }, 300);
62
+ }
63
+ return;
64
+ }
65
+ if (t)
66
+ return await a.addDocument({
67
+ name: r,
68
+ document: t
69
+ });
70
+ if (e.url)
71
+ return await a.addDocument({
72
+ name: e.slug ?? "default",
73
+ url: z(e.url, {
74
+ basePath: (l = o.value.pathRouting) == null ? void 0 : l.basePath
75
+ }),
76
+ fetch: h
77
+ });
78
+ };
79
+ u(
80
+ () => o.value.url,
81
+ (e) => e && k(o.value),
82
+ { immediate: !0 }
83
+ ), u(
84
+ () => o.value.content,
85
+ (e) => e && k(o.value),
86
+ { immediate: !0, deep: !0 }
87
+ ), f(d, "scalar-update-dark-mode", (e) => {
88
+ a.update("x-scalar-dark-mode", e.detail.value);
89
+ }), f(d, "scalar-update-active-document", (e) => {
90
+ a.update("x-scalar-active-document", e.detail.value);
91
+ }), f(d, "scalar-update-selected-client", (e) => {
92
+ a.update("x-scalar-default-client", e.detail), x().setItem(g.SELECTED_CLIENT, e.detail);
93
+ }), u(
94
+ () => o.value.defaultHttpClient,
81
95
  (e) => {
82
96
  if (e) {
83
- const { targetKey: t, clientKey: n } = e, l = `${t}/${n}`;
84
- y(l) && o.update("x-scalar-default-client", l);
97
+ const { targetKey: t, clientKey: r } = e, l = `${t}/${r}`;
98
+ M(l) && a.update("x-scalar-default-client", l);
85
99
  }
86
100
  },
87
101
  { immediate: !0 }
88
102
  );
89
- const { toggleColorMode: I, isDarkMode: L } = z({
90
- initialColorMode: a.value.darkMode ? "dark" : void 0,
91
- overrideColorMode: a.value.forceDarkModeState
103
+ const { toggleColorMode: b, isDarkMode: I } = W({
104
+ initialColorMode: o.value.darkMode ? "dark" : void 0,
105
+ overrideColorMode: o.value.forceDarkModeState
92
106
  });
93
- s(
94
- () => a.value.darkMode,
95
- (e) => o.update("x-scalar-dark-mode", !!e)
96
- ), s(
97
- () => L.value,
98
- (e) => o.update("x-scalar-dark-mode", e),
107
+ u(
108
+ () => o.value.darkMode,
109
+ (e) => a.update("x-scalar-dark-mode", !!e)
110
+ ), u(
111
+ () => I.value,
112
+ (e) => a.update("x-scalar-dark-mode", e),
99
113
  { immediate: !0 }
100
- ), s(
114
+ ), u(
101
115
  () => i.value,
102
116
  (e) => {
103
117
  var t;
104
- return o.update(
118
+ return a.update(
105
119
  "x-scalar-active-document",
106
- (t = d.value[e]) == null ? void 0 : t.slug
120
+ (t = C.value[e]) == null ? void 0 : t.slug
107
121
  );
108
122
  },
109
123
  { immediate: !0 }
110
- ), s(
111
- () => d.value,
112
- (e) => {
113
- e.forEach(m);
114
- }
115
- ), a.value.metaData && G(a.value.metaData);
116
- const R = w(() => a.value.favicon);
117
- return Q(R), (e, t) => {
118
- var n;
119
- return E(), U("div", {
124
+ ), o.value.metaData && q(o.value.metaData);
125
+ const L = A(() => o.value.favicon);
126
+ return G(L), (e, t) => {
127
+ var r;
128
+ return D(), B("div", {
120
129
  ref_key: "root",
121
- ref: c
130
+ ref: d
122
131
  }, [
123
- (n = r(a)) != null && n.customCss ? (E(), K(F("style"), { key: 0 }, {
124
- default: u(() => [
125
- O(j(r(a).customCss), 1)
132
+ (r = n(o)) != null && r.customCss ? (D(), P(K("style"), { key: 0 }, {
133
+ default: s(() => [
134
+ F(O(n(o).customCss), 1)
126
135
  ]),
127
136
  _: 1
128
- })) : Y("", !0),
129
- D(X, {
130
- configuration: r(a),
131
- isDark: !!r(o).workspace["x-scalar-dark-mode"],
132
- store: r(o),
133
- onToggleDarkMode: t[1] || (t[1] = () => r(I)()),
137
+ })) : U("", !0),
138
+ E(J, {
139
+ configuration: n(o),
140
+ isDark: !!n(a).workspace["x-scalar-dark-mode"],
141
+ store: n(a),
142
+ onToggleDarkMode: t[1] || (t[1] = () => n(b)()),
134
143
  onUpdateContent: t[2] || (t[2] = (l) => e.$emit("updateContent", l))
135
144
  }, {
136
- footer: u(() => [
137
- v(e.$slots, "footer")
145
+ footer: s(() => [
146
+ p(e.$slots, "footer")
138
147
  ]),
139
- "content-end": u(() => [
140
- v(e.$slots, "footer")
148
+ "content-end": s(() => [
149
+ p(e.$slots, "footer")
141
150
  ]),
142
- "document-selector": u(() => [
143
- D(r(te), {
144
- modelValue: r(i),
145
- "onUpdate:modelValue": t[0] || (t[0] = (l) => H(i) ? i.value = l : null),
146
- options: r(d)
151
+ "document-selector": s(() => [
152
+ E(n(te), {
153
+ modelValue: n(i),
154
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => Y(i) ? i.value = l : null),
155
+ options: n(C)
147
156
  }, null, 8, ["modelValue", "options"])
148
157
  ]),
149
- "sidebar-start": u(() => [
150
- v(e.$slots, "sidebar-start")
158
+ "sidebar-start": s(() => [
159
+ p(e.$slots, "sidebar-start")
151
160
  ]),
152
161
  _: 3
153
162
  }, 8, ["configuration", "isDark", "store"])
@@ -156,5 +165,5 @@ const ve = /* @__PURE__ */ N({
156
165
  }
157
166
  });
158
167
  export {
159
- ve as default
168
+ De as default
160
169
  };
@@ -0,0 +1,13 @@
1
+ import type { ObjectDoc, UrlDoc } from '@scalar/workspace-store/client';
2
+ import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
+ /**
4
+ * Calculate a default name for the document to make the workspace store name parameter optional
5
+ *
6
+ * @param params.name - If we have a name already, like config.slug
7
+ * @param params.url - URL of the document
8
+ * @param params.document - The document object
9
+ * @param documents - Optional documents record which will automatically iterate the title if we have a duplicate
10
+ * @returns The name of the document
11
+ */
12
+ export declare const getDocumentName: ({ name, url, document }?: Partial<UrlDoc> & Partial<ObjectDoc>, documents?: Record<string, OpenApiDocument>) => string;
13
+ //# sourceMappingURL=get-document-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-document-name.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/get-document-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,6BACD,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,cACjD,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KAC1C,MA2BF,CAAA"}
@@ -0,0 +1,15 @@
1
+ const n = ({ name: i, url: f, document: t } = {}, e) => {
2
+ if (i)
3
+ return i;
4
+ if (f)
5
+ return f;
6
+ if (t != null && t.info) {
7
+ const r = t.info;
8
+ if (r.title)
9
+ return r.title;
10
+ }
11
+ return "default";
12
+ };
13
+ export {
14
+ n as getDocumentName
15
+ };
@@ -0,0 +1,3 @@
1
+ /** Normalize content into a JS object or return null if it is falsey */
2
+ export declare const normalizeContent: (content: string | Record<string, unknown> | (() => string | Record<string, unknown>) | undefined | null) => Record<string, unknown> | undefined;
3
+ //# sourceMappingURL=normalize-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-content.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/normalize-content.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,YAClB,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,KACtG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAc5B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { parseJsonOrYaml as i } from "@scalar/oas-utils/helpers";
2
+ const f = (r) => {
3
+ if (r)
4
+ return typeof r == "function" ? f(r()) : typeof r == "string" ? i(r) : r || void 0;
5
+ };
6
+ export {
7
+ f as normalizeContent
8
+ };
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "vue",
21
21
  "vue3"
22
22
  ],
23
- "version": "1.33.0",
23
+ "version": "1.34.0",
24
24
  "engines": {
25
25
  "node": ">=20"
26
26
  },
@@ -54,21 +54,21 @@
54
54
  "nanoid": "5.1.5",
55
55
  "vue": "^3.5.17",
56
56
  "zod": "3.24.1",
57
+ "@scalar/components": "0.14.22",
58
+ "@scalar/api-client": "2.5.21",
57
59
  "@scalar/code-highlight": "0.1.9",
58
- "@scalar/components": "0.14.21",
59
60
  "@scalar/helpers": "0.0.7",
60
61
  "@scalar/icons": "0.4.6",
61
62
  "@scalar/object-utils": "1.2.3",
62
- "@scalar/openapi-parser": "0.18.3",
63
- "@scalar/api-client": "2.5.20",
64
- "@scalar/oas-utils": "0.4.16",
63
+ "@scalar/openapi-parser": "0.19.0",
65
64
  "@scalar/openapi-types": "0.3.7",
65
+ "@scalar/oas-utils": "0.4.17",
66
66
  "@scalar/snippetz": "0.4.4",
67
67
  "@scalar/themes": "0.13.12",
68
68
  "@scalar/types": "0.2.11",
69
69
  "@scalar/use-hooks": "0.2.4",
70
70
  "@scalar/use-toasts": "0.8.0",
71
- "@scalar/workspace-store": "0.11.0"
71
+ "@scalar/workspace-store": "0.12.0"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@tailwindcss/vite": "^4.1.7",
@@ -85,9 +85,13 @@
85
85
  "vite-plugin-banner": "^0.7.1",
86
86
  "vite-plugin-css-injected-by-js": "^3.4.0",
87
87
  "vitest": "^3.2.4",
88
- "@scalar/build-tooling": "0.2.4",
88
+ "@hono/node-server": "^1.11.0",
89
+ "@playwright/test": "^1.49.1",
90
+ "hono": "^4.6.5",
91
+ "@scalar/galaxy": "0.5.5",
89
92
  "@scalar/react-renderer": "0.2.1",
90
- "@scalar/galaxy": "0.5.5"
93
+ "@scalar/core": "0.3.11",
94
+ "@scalar/build-tooling": "0.2.4"
91
95
  },
92
96
  "scripts": {
93
97
  "build": "pnpm build:default && pnpm build:standalone && pnpm types:build && tsc-alias -p tsconfig.build.json",
@@ -103,6 +107,8 @@
103
107
  "playground:vue": "vite ./playground/vue -c ./playground/vue/vite.config.ts",
104
108
  "preview": "vite preview",
105
109
  "test": "vitest",
110
+ "test:e2e": "playwright test",
111
+ "test:e2e:ui": "playwright test --ui",
106
112
  "types:build": "scalar-types-build-vue",
107
113
  "types:check": "scalar-types-check-vue"
108
114
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Search/SearchButton.vue"],"names":[],"mappings":"AAmFA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAQhD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAC;;AAiJF,wBAMG"}
@@ -1,66 +0,0 @@
1
- import { defineComponent as k, ref as w, watch as M, nextTick as C, onMounted as v, onBeforeUnmount as B, createElementBlock as n, openBlock as r, Fragment as s, createVNode as u, unref as l, normalizeClass as K, withCtx as c, createElementVNode as a, createTextVNode as m, toDisplayString as b } from "vue";
2
- import { useModal as E, ScalarSidebarSearchButton as H } from "@scalar/components";
3
- import { isMacOS as f } from "@scalar/helpers/general/is-mac-os";
4
- import g from "./SearchModal.vue.js";
5
- import { useApiClient as L } from "../api-client-modal/useApiClient.js";
6
- const $ = /* @__PURE__ */ k({
7
- __name: "SearchButton",
8
- props: {
9
- spec: {},
10
- searchHotKey: { default: "k" },
11
- hideModels: { type: Boolean, default: !1 }
12
- },
13
- setup(h) {
14
- const d = w(), t = E(), { client: y } = L(), i = (o) => {
15
- var e;
16
- (f() ? o.metaKey : o.ctrlKey) && o.key === h.searchHotKey && !((e = y.value) != null && e.modalState.open) && (o.preventDefault(), o.stopPropagation(), t.open ? t.hide() : t.show());
17
- };
18
- M(
19
- () => t.open,
20
- (o, e) => {
21
- !o && e && C(() => {
22
- var p;
23
- (p = d.value) == null || p.$el.focus();
24
- });
25
- }
26
- ), v(() => window.addEventListener("keydown", i)), B(() => window.removeEventListener("keydown", i));
27
- function S() {
28
- t.show();
29
- }
30
- return (o, e) => (r(), n(s, null, [
31
- u(l(H), {
32
- ref_key: "button",
33
- ref: d,
34
- class: K(["w-full", o.$attrs.class]),
35
- onClick: S
36
- }, {
37
- shortcut: c(() => [
38
- l(f)() ? (r(), n(s, { key: 0 }, [
39
- m("⌘")
40
- ], 64)) : (r(), n(s, { key: 1 }, [
41
- e[0] || (e[0] = a("span", { class: "sr-only" }, "CTRL", -1)),
42
- e[1] || (e[1] = a("span", { "aria-hidden": "true" }, "⌃", -1))
43
- ], 64)),
44
- m(" " + b(o.searchHotKey), 1)
45
- ]),
46
- default: c(() => [
47
- e[2] || (e[2] = a("span", { class: "sr-only" }, "Open Search", -1)),
48
- e[3] || (e[3] = a("span", {
49
- "aria-hidden": "true",
50
- class: "sidebar-search-placeholder"
51
- }, " Search ", -1))
52
- ]),
53
- _: 1,
54
- __: [2, 3]
55
- }, 8, ["class"]),
56
- u(g, {
57
- modalState: l(t),
58
- hideModels: o.hideModels,
59
- parsedSpec: o.spec
60
- }, null, 8, ["modalState", "hideModels", "parsedSpec"])
61
- ], 64));
62
- }
63
- });
64
- export {
65
- $ as default
66
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Search/SearchModal.vue"],"names":[],"mappings":"AAoTA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAU3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAgBhD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,IAAI,CAAA;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAC;;AAoaF,wBAOG"}
@@ -1,7 +0,0 @@
1
- import o from "./SearchModal.vue2.js";
2
- import "./SearchModal.vue3.js";
3
- import a from "../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ a(o, [["__scopeId", "data-v-dc7ea19e"]]);
5
- export {
6
- c as default
7
- };