@scalar/components 0.15.0 → 0.15.1

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,17 +1,31 @@
1
- /**
2
- * Uses highlight.js for syntax highlighting
3
- */
4
- type __VLS_Props = {
5
- content: string | object;
1
+ type BaseProps = {
2
+ content?: string | object;
3
+ prettyPrintedContent?: string;
6
4
  lang?: string;
7
5
  lineNumbers?: boolean;
8
6
  hideCredentials?: string | string[];
9
7
  copy?: boolean;
10
8
  };
11
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
- lang: string;
13
- lineNumbers: boolean;
14
- copy: boolean;
15
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: import("vue").DefineComponent<(BaseProps & {
10
+ /** Raw unformatted object or string content */
11
+ content: string | object;
12
+ }) | (BaseProps & {
13
+ /**
14
+ * Pre-pretty printed content string for better performance
15
+ *
16
+ * Avoids unnecessary costly re-serialization of large content
17
+ */
18
+ prettyPrintedContent: string;
19
+ }), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<(BaseProps & {
20
+ /** Raw unformatted object or string content */
21
+ content: string | object;
22
+ }) | (BaseProps & {
23
+ /**
24
+ * Pre-pretty printed content string for better performance
25
+ *
26
+ * Avoids unnecessary costly re-serialization of large content
27
+ */
28
+ prettyPrintedContent: string;
29
+ })> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
30
  export default _default;
17
31
  //# sourceMappingURL=ScalarCodeBlock.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AA0FA;;GAEG;AACH,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAC;;UAJO,MAAM;iBACC,OAAO;UAEd,OAAO;;AAsGlB,wBAOG"}
1
+ {"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AAoHA,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;;IAUS,+CAA+C;aACtC,MAAM,GAAG,MAAM;;IAGxB;;;;OAIG;0BACmB,MAAM;;IAT5B,+CAA+C;aACtC,MAAM,GAAG,MAAM;;IAGxB;;;;OAIG;0BACmB,MAAM;;AAwGtC,wBAMG"}
@@ -1,40 +1,43 @@
1
- import { defineComponent as d, useId as u, computed as l, createElementBlock as m, openBlock as c, createBlock as p, createCommentVNode as f, createElementVNode as h, unref as t } from "vue";
2
- import { syntaxHighlight as g, standardLanguages as k } from "@scalar/code-highlight";
3
- import { prettyPrintJson as r } from "@scalar/oas-utils/helpers";
4
- import C from "./ScalarCodeBlockCopy.vue.js";
5
- const _ = {
1
+ import { defineComponent as s, useId as u, computed as n, createElementBlock as d, openBlock as r, createBlock as m, createCommentVNode as p, createElementVNode as f, unref as o } from "vue";
2
+ import { syntaxHighlight as h, standardLanguages as C } from "@scalar/code-highlight";
3
+ import { prettyPrintJson as g } from "@scalar/oas-utils/helpers";
4
+ import y from "./ScalarCodeBlockCopy.vue.js";
5
+ const k = {
6
6
  class: "scalar-code-block group/code-block custom-scroll min-h-12 focus-visible:outline",
7
7
  tabindex: "0"
8
- }, b = ["id", "innerHTML"], H = /* @__PURE__ */ d({
8
+ }, v = ["id", "innerHTML"], L = /* @__PURE__ */ s({
9
9
  __name: "ScalarCodeBlock",
10
10
  props: {
11
11
  content: {},
12
+ prettyPrintedContent: {},
12
13
  lang: { default: "plaintext" },
13
14
  lineNumbers: { type: Boolean, default: !1 },
14
15
  hideCredentials: {},
15
16
  copy: { type: Boolean, default: !0 }
16
17
  },
17
- setup(a) {
18
- const e = a, n = u(), s = l(() => g(r(e.content), {
18
+ setup(e) {
19
+ const l = u(), t = n(
20
+ () => e.prettyPrintedContent || g(e.content ?? "")
21
+ ), c = n(() => h(t.value, {
19
22
  lang: e.lang.trim(),
20
- languages: k,
23
+ languages: C,
21
24
  lineNumbers: e.lineNumbers,
22
25
  maskCredentials: e.hideCredentials
23
- }).slice(5, -6)), i = l(() => e.content !== null && e.content !== "null" && e.content !== "404 Not Found");
24
- return (o, y) => (c(), m("div", _, [
25
- o.copy && i.value ? (c(), p(t(C), {
26
+ }).slice(5, -6)), i = n(() => t.value !== null && t.value !== "null" && t.value !== "404 Not Found");
27
+ return (a, b) => (r(), d("div", k, [
28
+ a.copy && i.value ? (r(), m(o(y), {
26
29
  key: 0,
27
- content: t(r)(e.content),
28
- controls: t(n)
29
- }, null, 8, ["content", "controls"])) : f("", !0),
30
- h("pre", {
31
- id: t(n),
30
+ content: t.value,
31
+ controls: o(l)
32
+ }, null, 8, ["content", "controls"])) : p("", !0),
33
+ f("pre", {
34
+ id: o(l),
32
35
  class: "scalar-codeblock-pre",
33
- innerHTML: s.value
34
- }, null, 8, b)
36
+ innerHTML: c.value
37
+ }, null, 8, v)
35
38
  ]));
36
39
  }
37
40
  });
38
41
  export {
39
- H as default
42
+ L as default
40
43
  };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/components"
12
12
  },
13
- "version": "0.15.0",
13
+ "version": "0.15.1",
14
14
  "engines": {
15
15
  "node": ">=20"
16
16
  },
@@ -40,12 +40,12 @@
40
40
  "vue": "^3.5.17",
41
41
  "vue-component-type-helpers": "^3.0.4",
42
42
  "@scalar/code-highlight": "0.2.0",
43
- "@scalar/helpers": "0.0.11",
43
+ "@scalar/helpers": "0.0.12",
44
44
  "@scalar/icons": "0.4.7",
45
- "@scalar/oas-utils": "0.5.1",
46
45
  "@scalar/use-hooks": "0.2.5",
47
- "@scalar/use-toasts": "0.8.0",
48
- "@scalar/themes": "0.13.21"
46
+ "@scalar/themes": "0.13.22",
47
+ "@scalar/oas-utils": "0.5.2",
48
+ "@scalar/use-toasts": "0.8.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@headlessui/tailwindcss": "^0.2.2",