@scalar/components 0.12.4 → 0.12.5

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.
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as r, computed as a, openBlock as l, createElementBlock as s } from "vue";
2
2
  import { syntaxHighlight as i, standardLanguages as c } from "@scalar/code-highlight";
3
3
  import "@scalar/code-highlight/css/code.css";
4
- import { prettyPrintJson as m } from "@scalar/oas-utils/helpers";
4
+ import { prettyPrintJson as m } from "../../helpers/oas-utils.js";
5
5
  const p = ["innerHTML"], _ = /* @__PURE__ */ r({
6
6
  __name: "ScalarCodeBlock",
7
7
  props: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as r, computed as a, onServerPrefetch as n, openBlock as m, createElementBlock as s } from "vue";
2
2
  import { htmlFromMarkdown as c } from "@scalar/code-highlight";
3
3
  import "@scalar/code-highlight/css/markdown.css";
4
- import { sleep as l } from "../../helpers/sleep.js";
4
+ import { sleep as l } from "../../helpers/oas-utils.js";
5
5
  const p = ["innerHTML"], v = /* @__PURE__ */ r({
6
6
  __name: "ScalarMarkdown",
7
7
  props: {
@@ -0,0 +1,17 @@
1
+ const t = () => {
2
+ const d = new MutationObserver((a) => {
3
+ const e = a.find(
4
+ (s) => Array.from(s.addedNodes).find(
5
+ (o) => o.id === "headlessui-portal-root"
6
+ )
7
+ );
8
+ if (e) {
9
+ const s = e.addedNodes[0];
10
+ s.classList.add("scalar-app"), s.classList.add("scalar-client"), d.disconnect();
11
+ }
12
+ });
13
+ d.observe(document.body, { childList: !0 });
14
+ };
15
+ export {
16
+ t as addScalarClassesToHeadless
17
+ };
@@ -0,0 +1,47 @@
1
+ const s = (r) => typeof r != "string" ? !1 : !!i.parseSafe(r, !1), i = {
2
+ /** Parse and throw if the return value is not an object */
3
+ parse: (r) => {
4
+ const t = JSON.parse(r);
5
+ if (typeof t != "object") throw Error("Invalid JSON object");
6
+ return t;
7
+ },
8
+ /** Parse and return a fallback on failure */
9
+ parseSafe(r, t) {
10
+ try {
11
+ return i.parse(r);
12
+ } catch (e) {
13
+ return typeof t == "function" ? t(e) : t;
14
+ }
15
+ },
16
+ stringify: (r) => JSON.stringify(r)
17
+ }, f = (r) => {
18
+ if (typeof r == "string")
19
+ return s(r) ? JSON.stringify(JSON.parse(r), null, 2) : r;
20
+ if (typeof r == "object")
21
+ try {
22
+ return JSON.stringify(r, null, 2);
23
+ } catch {
24
+ return o(r);
25
+ }
26
+ return r.toString();
27
+ };
28
+ function o(r) {
29
+ const t = /* @__PURE__ */ new Set();
30
+ return JSON.stringify(
31
+ r,
32
+ (e, n) => {
33
+ if (typeof n == "object" && n !== null) {
34
+ if (t.has(n))
35
+ return "[Circular]";
36
+ t.add(n);
37
+ }
38
+ return n;
39
+ },
40
+ 2
41
+ );
42
+ }
43
+ const c = (r) => new Promise((t) => setTimeout(t, r));
44
+ export {
45
+ f as prettyPrintJson,
46
+ c as sleep
47
+ };
package/dist/index.d.ts CHANGED
@@ -615,6 +615,9 @@ declare type __VLS_WithTemplateSlots_9<T, S> = T & {
615
615
  };
616
616
  };
617
617
 
618
+ /** Helper method for adding the scalar classes to HeadlessUI portal root */
619
+ export declare const addScalarClassesToHeadless: () => void;
620
+
618
621
  declare type FloatingOptions = {
619
622
  /**
620
623
  * Where to place the floating element relative to its reference element.
package/dist/index.js CHANGED
@@ -1,44 +1,46 @@
1
- import { default as e } from "./components/ScalarModal/ScalarModal.vue.js";
1
+ import { default as t } from "./components/ScalarModal/ScalarModal.vue.js";
2
2
  /* empty css */
3
3
  import { default as f } from "./components/ScalarButton/ScalarButton.vue.js";
4
4
  import { default as p } from "./components/ScalarCodeBlock/ScalarCodeBlock.vue.js";
5
5
  /* empty css */
6
6
  import { default as c } from "./components/ScalarMarkdown/ScalarMarkdown.vue.js";
7
- import { default as s } from "./components/ScalarDropdown/ScalarDropdown.vue.js";
7
+ import { default as u } from "./components/ScalarDropdown/ScalarDropdown.vue.js";
8
8
  import { default as S } from "./components/ScalarDropdown/ScalarDropdownDivider.vue.js";
9
9
  import { default as i } from "./components/ScalarDropdown/ScalarDropdownItem.vue.js";
10
10
  import { default as w } from "./components/ScalarFloating/ScalarFloating.vue.js";
11
11
  import { default as L } from "./components/ScalarIcon/ScalarIcon.vue.js";
12
12
  import { default as h } from "./components/ScalarIconButton/ScalarIconButton.vue.js";
13
13
  import { default as M } from "./components/ScalarListbox/ScalarListbox.vue.js";
14
- import { default as v } from "./components/ScalarLoading/ScalarLoading.vue.js";
15
- import { default as R } from "./components/ScalarPopover/ScalarPopover.vue.js";
16
- import { default as b } from "./components/ScalarSearchInput/ScalarSearchInput.vue.js";
17
- import { default as P } from "./components/ScalarSearchResults/ScalarSearchResultItem.vue.js";
18
- import { default as q } from "./components/ScalarSearchResults/ScalarSearchResultList.vue.js";
19
- import { default as z } from "./components/ScalarTextField/ScalarTextField.vue.js";
20
- import { default as E } from "./components/ScalarTooltip/ScalarTooltip.vue.js";
21
- import { useLoadingState as H } from "./components/ScalarLoading/ScalarLoading.vue2.js";
22
- import { useModal as K } from "./components/ScalarModal/ScalarModal.vue2.js";
14
+ import { default as k } from "./components/ScalarLoading/ScalarLoading.vue.js";
15
+ import { default as C } from "./components/ScalarPopover/ScalarPopover.vue.js";
16
+ import { default as R } from "./components/ScalarSearchInput/ScalarSearchInput.vue.js";
17
+ import { default as H } from "./components/ScalarSearchResults/ScalarSearchResultItem.vue.js";
18
+ import { default as j } from "./components/ScalarSearchResults/ScalarSearchResultList.vue.js";
19
+ import { default as y } from "./components/ScalarTextField/ScalarTextField.vue.js";
20
+ import { default as A } from "./components/ScalarTooltip/ScalarTooltip.vue.js";
21
+ import { addScalarClassesToHeadless as G } from "./helpers/add-scalar-classes.js";
22
+ import { useLoadingState as K } from "./components/ScalarLoading/ScalarLoading.vue2.js";
23
+ import { useModal as O } from "./components/ScalarModal/ScalarModal.vue2.js";
23
24
  export {
24
25
  f as ScalarButton,
25
26
  p as ScalarCodeBlock,
26
- s as ScalarDropdown,
27
+ u as ScalarDropdown,
27
28
  S as ScalarDropdownDivider,
28
29
  i as ScalarDropdownItem,
29
30
  w as ScalarFloating,
30
31
  L as ScalarIcon,
31
32
  h as ScalarIconButton,
32
33
  M as ScalarListbox,
33
- v as ScalarLoading,
34
+ k as ScalarLoading,
34
35
  c as ScalarMarkdown,
35
- e as ScalarModal,
36
- R as ScalarPopover,
37
- b as ScalarSearchInput,
38
- P as ScalarSearchResultItem,
39
- q as ScalarSearchResultList,
40
- z as ScalarTextField,
41
- E as ScalarTooltip,
42
- H as useLoadingState,
43
- K as useModal
36
+ t as ScalarModal,
37
+ C as ScalarPopover,
38
+ R as ScalarSearchInput,
39
+ H as ScalarSearchResultItem,
40
+ j as ScalarSearchResultList,
41
+ y as ScalarTextField,
42
+ A as ScalarTooltip,
43
+ G as addScalarClassesToHeadless,
44
+ K as useLoadingState,
45
+ O as useModal
44
46
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/components"
12
12
  },
13
- "version": "0.12.4",
13
+ "version": "0.12.5",
14
14
  "engines": {
15
15
  "node": ">=18"
16
16
  },
@@ -39,8 +39,7 @@
39
39
  "radix-vue": "^1.8.4",
40
40
  "tailwind-merge": "^2.3.0",
41
41
  "vue": "^3.4.22",
42
- "@scalar/code-highlight": "0.0.5",
43
- "@scalar/oas-utils": "0.2.5"
42
+ "@scalar/code-highlight": "0.0.5"
44
43
  },
45
44
  "devDependencies": {
46
45
  "@headlessui/tailwindcss": "^0.2.0",
@@ -1,4 +0,0 @@
1
- const s = (e) => new Promise((o) => setTimeout(o, e));
2
- export {
3
- s as sleep
4
- };