@scalar/components 0.17.6 → 0.19.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.
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts +3 -2
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts.map +1 -1
- package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.js +51 -25
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts +23 -5
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts.map +1 -1
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.js +55 -5
- package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue2.js +2 -64
- package/dist/components/ScalarCodeBlock/constants.d.ts +53 -0
- package/dist/components/ScalarCodeBlock/constants.d.ts.map +1 -0
- package/dist/components/ScalarCodeBlock/constants.js +54 -0
- package/dist/components/ScalarCodeBlock/types.d.ts +4 -0
- package/dist/components/ScalarCodeBlock/types.d.ts.map +1 -0
- package/dist/components/ScalarCopy/ScalarCopy.vue.d.ts +28 -0
- package/dist/components/ScalarCopy/ScalarCopy.vue.d.ts.map +1 -0
- package/dist/components/ScalarCopy/ScalarCopy.vue.js +54 -0
- package/dist/components/ScalarCopy/ScalarCopy.vue2.js +4 -0
- package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.d.ts +16 -0
- package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.d.ts.map +1 -0
- package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.js +14 -0
- package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue2.js +4 -0
- package/dist/components/ScalarCopy/ScalarCopyButton.vue.d.ts +43 -0
- package/dist/components/ScalarCopy/ScalarCopyButton.vue.d.ts.map +1 -0
- package/dist/components/ScalarCopy/ScalarCopyButton.vue.js +108 -0
- package/dist/components/ScalarCopy/ScalarCopyButton.vue2.js +4 -0
- package/dist/components/ScalarCopy/index.d.ts +3 -0
- package/dist/components/ScalarCopy/index.d.ts.map +1 -0
- package/dist/components/ScalarCopy/types.d.ts +31 -0
- package/dist/components/ScalarCopy/types.d.ts.map +1 -0
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts +2 -1
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.js +33 -20
- package/dist/components/ScalarMenu/ScalarMenuWorkspacePicker.vue.d.ts +1 -1
- package/dist/components/ScalarMenu/ScalarMenuWorkspacePicker.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/index.d.ts +1 -1
- package/dist/components/ScalarMenu/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +190 -186
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { StandardLanguageKey } from './types';
|
|
1
2
|
type BaseProps = {
|
|
2
3
|
content?: string | object;
|
|
3
4
|
prettyPrintedContent?: string;
|
|
4
|
-
lang?: string;
|
|
5
|
+
lang?: StandardLanguageKey | string;
|
|
5
6
|
lineNumbers?: boolean;
|
|
6
7
|
hideCredentials?: string | string[];
|
|
7
|
-
copy?:
|
|
8
|
+
copy?: 'always' | 'hover' | false;
|
|
8
9
|
};
|
|
9
10
|
declare const _default: import("vue").DefineComponent<(BaseProps & {
|
|
10
11
|
/** Raw unformatted object or string content */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AAqJA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,KAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,IAAI,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAA;IACnC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;CAClC,CAAA;;IAUS,+CAA+C;aACtC,MAAM,GAAG,MAAM;;IAGxB;;;;OAIG;0BACmB,MAAM;;IAT5B,+CAA+C;aACtC,MAAM,GAAG,MAAM;;IAGxB;;;;OAIG;0BACmB,MAAM;;AA2KtC,wBAMG"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { defineComponent as p, useId as f, computed as n, createElementBlock as h, openBlock as r, normalizeProps as g, guardReactiveProps as v, unref as o, createElementVNode as i, createBlock as y, createCommentVNode as b, normalizeClass as c, withCtx as x, createVNode as C } from "vue";
|
|
2
|
+
import k from "../ScalarCopy/ScalarCopyBackdrop.vue.js";
|
|
3
|
+
import { syntaxHighlight as w, standardLanguages as B } from "@scalar/code-highlight";
|
|
4
|
+
import { prettyPrintJson as N } from "@scalar/oas-utils/helpers";
|
|
5
|
+
import { useBindCx as L } from "@scalar/use-hooks/useBindCx";
|
|
6
|
+
import P from "./ScalarCodeBlockCopy.vue.js";
|
|
7
|
+
const V = {
|
|
8
|
+
tabindex: "0",
|
|
9
|
+
class: "custom-scroll overflow-x-auto p-2 -outline-offset-2 min-h-0 min-w-0 flex-1"
|
|
10
|
+
}, H = ["id", "innerHTML"], F = /* @__PURE__ */ p({
|
|
11
|
+
inheritAttrs: !1,
|
|
9
12
|
__name: "ScalarCodeBlock",
|
|
10
13
|
props: {
|
|
11
14
|
content: {},
|
|
@@ -13,31 +16,54 @@ const k = {
|
|
|
13
16
|
lang: { default: "plaintext" },
|
|
14
17
|
lineNumbers: { type: Boolean, default: !1 },
|
|
15
18
|
hideCredentials: {},
|
|
16
|
-
copy: { type: Boolean, default:
|
|
19
|
+
copy: { type: [String, Boolean], default: "hover" }
|
|
17
20
|
},
|
|
18
21
|
setup(e) {
|
|
19
|
-
const l =
|
|
20
|
-
() => e.prettyPrintedContent ||
|
|
21
|
-
),
|
|
22
|
+
const l = f(), t = n(
|
|
23
|
+
() => e.prettyPrintedContent || N(e.content ?? "")
|
|
24
|
+
), s = n(() => w(t.value, {
|
|
22
25
|
lang: e.lang.trim(),
|
|
23
|
-
languages:
|
|
26
|
+
languages: B,
|
|
24
27
|
lineNumbers: e.lineNumbers,
|
|
25
28
|
maskCredentials: e.hideCredentials
|
|
26
|
-
}).slice(5, -6)),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
}).slice(5, -6)), a = n(() => !t.value.includes(`
|
|
30
|
+
`)), u = n(() => t.value !== null && t.value !== "null" && t.value !== "404 Not Found"), { cx: d } = L();
|
|
31
|
+
return (m, z) => (r(), h("div", g(v(
|
|
32
|
+
o(d)(
|
|
33
|
+
"scalar-code-block group/code-block flex flex-col",
|
|
34
|
+
"relative bg-b-1 min-h-0 min-w-0 focus-visible:outline"
|
|
35
|
+
)
|
|
36
|
+
)), [
|
|
37
|
+
i("div", V, [
|
|
38
|
+
i("pre", {
|
|
39
|
+
id: o(l),
|
|
40
|
+
class: "m-0 bg-transparent text-nowrap whitespace-pre w-fit",
|
|
41
|
+
innerHTML: s.value
|
|
42
|
+
}, null, 8, H)
|
|
43
|
+
]),
|
|
44
|
+
e.copy && u.value ? (r(), y(o(P), {
|
|
29
45
|
key: 0,
|
|
46
|
+
class: c(["scalar-code-copy absolute", [
|
|
47
|
+
a.value ? "top-[calc(10px+0.5lh)] -translate-y-1/2 m-0 right-1" : "top-2.5 right-2.5",
|
|
48
|
+
{ "opacity-100": e.copy === "always" }
|
|
49
|
+
]]),
|
|
30
50
|
content: t.value,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
showLang: !a.value,
|
|
52
|
+
lang: e.lang,
|
|
53
|
+
"aria-controls": o(l)
|
|
54
|
+
}, {
|
|
55
|
+
backdrop: x(() => [
|
|
56
|
+
C(k, {
|
|
57
|
+
class: c(["scalar-code-copy-backdrop", [
|
|
58
|
+
a.value ? "-inset-y-0.75 -right-1 group-hocus-within/code-block:-left-0.5 left-3" : "-right-1.5 -top-1"
|
|
59
|
+
]])
|
|
60
|
+
}, null, 8, ["class"])
|
|
61
|
+
]),
|
|
62
|
+
_: 1
|
|
63
|
+
}, 8, ["class", "content", "showLang", "lang", "aria-controls"])) : b("", !0)
|
|
64
|
+
], 16));
|
|
39
65
|
}
|
|
40
66
|
});
|
|
41
67
|
export {
|
|
42
|
-
|
|
68
|
+
F as default
|
|
43
69
|
};
|
|
@@ -1,11 +1,29 @@
|
|
|
1
|
+
import type { StandardLanguageKey } from './types';
|
|
1
2
|
type __VLS_Props = {
|
|
3
|
+
/** Whether to show the language label */
|
|
4
|
+
showLang?: boolean;
|
|
2
5
|
/** Content to copy to clipboard */
|
|
3
6
|
content: string | object;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/** Class to apply to the copy button */
|
|
7
|
-
class?: string;
|
|
7
|
+
/** Language of the code block */
|
|
8
|
+
lang?: StandardLanguageKey | string;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
11
|
+
'copied'?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare var __VLS_6: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
backdrop?: (props: typeof __VLS_6) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:copied": (value: boolean) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
20
|
+
"onUpdate:copied"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
23
|
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
11
29
|
//# sourceMappingURL=ScalarCodeBlockCopy.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarCodeBlockCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarCodeBlockCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue"],"names":[],"mappings":"AA6EA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,KAAK,WAAW,GAAG;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mCAAmC;IACnC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,iCAAiC;IACjC,IAAI,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAAA;CACpC,CAAC;AAwBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAuEF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA0BhD,QAAA,MAAM,eAAe;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as g, mergeModels as y, useModel as f, computed as h, createBlock as k, openBlock as l, unref as n, mergeProps as C, createSlots as B, withCtx as i, renderSlot as L, createElementVNode as s, createElementBlock as b, createCommentVNode as w, normalizeClass as r, toDisplayString as S } from "vue";
|
|
2
|
+
import { useBindCx as v } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
import { LANGUAGE_LABELS as d } from "./constants.js";
|
|
4
|
+
import x from "../ScalarCopy/ScalarCopy.vue.js";
|
|
5
|
+
const A = { class: "hidden group-hocus-within/code-block:inline" }, G = /* @__PURE__ */ g({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "ScalarCodeBlockCopy",
|
|
8
|
+
props: /* @__PURE__ */ y({
|
|
9
|
+
showLang: { type: Boolean },
|
|
10
|
+
content: {},
|
|
11
|
+
lang: {}
|
|
12
|
+
}, {
|
|
13
|
+
copied: { type: Boolean, default: !1 },
|
|
14
|
+
copiedModifiers: {}
|
|
15
|
+
}),
|
|
16
|
+
emits: ["update:copied"],
|
|
17
|
+
setup(e) {
|
|
18
|
+
const o = f(e, "copied"), u = h(() => typeof e.content == "string" ? e.content : JSON.stringify(e.content, null, 2)), a = (t) => t in d, { cx: p } = v();
|
|
19
|
+
return (t, c) => (l(), k(n(x), C({
|
|
20
|
+
content: u.value,
|
|
21
|
+
showLabel: "",
|
|
22
|
+
copied: o.value,
|
|
23
|
+
"onUpdate:copied": c[0] || (c[0] = (m) => o.value = m),
|
|
24
|
+
placement: "left"
|
|
25
|
+
}, {
|
|
26
|
+
...n(p)(
|
|
27
|
+
o.value ? "opacity-100" : "opacity-0 group-hocus-within/code-block:opacity-100"
|
|
28
|
+
)
|
|
29
|
+
}), B({
|
|
30
|
+
backdrop: i(() => [
|
|
31
|
+
L(t.$slots, "backdrop")
|
|
32
|
+
]),
|
|
33
|
+
_: 2
|
|
34
|
+
}, [
|
|
35
|
+
e.lang ? {
|
|
36
|
+
name: "copy",
|
|
37
|
+
fn: i(() => [
|
|
38
|
+
s("span", A, [
|
|
39
|
+
e.showLang ? (l(), b("span", {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: r(["group-hocus/copy-button:sr-only", { capitalize: !a(e.lang) }])
|
|
42
|
+
}, S(a(e.lang) ? n(d)[e.lang] : e.lang), 3)) : w("", !0),
|
|
43
|
+
s("span", {
|
|
44
|
+
class: r({
|
|
45
|
+
"group-hocus/copy-button:not-sr-only sr-only": e.showLang
|
|
46
|
+
})
|
|
47
|
+
}, "Copy", 2)
|
|
48
|
+
])
|
|
49
|
+
]),
|
|
50
|
+
key: "0"
|
|
51
|
+
} : void 0
|
|
52
|
+
]), 1040, ["content", "copied"]));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
5
55
|
export {
|
|
6
|
-
|
|
56
|
+
G as default
|
|
7
57
|
};
|
|
@@ -1,66 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ScalarIconCopy as C, ScalarIconCheck as h } from "@scalar/icons";
|
|
3
|
-
import { cva as v, cx as i } from "@scalar/use-hooks/useBindCx";
|
|
4
|
-
import { useClipboard as b } from "@scalar/use-hooks/useClipboard";
|
|
5
|
-
import k from "../ScalarButton/ScalarButton.vue.js";
|
|
6
|
-
const x = {
|
|
7
|
-
key: 0,
|
|
8
|
-
class: "sr-only",
|
|
9
|
-
role: "alert"
|
|
10
|
-
}, T = /* @__PURE__ */ p({
|
|
11
|
-
__name: "ScalarCodeBlockCopy",
|
|
12
|
-
props: {
|
|
13
|
-
content: {},
|
|
14
|
-
controls: {},
|
|
15
|
-
class: {}
|
|
16
|
-
},
|
|
17
|
-
setup(o) {
|
|
18
|
-
const { copyToClipboard: r } = b(), e = d(!1), u = async () => {
|
|
19
|
-
if (e.value)
|
|
20
|
-
return;
|
|
21
|
-
const a = typeof o.content == "string" ? o.content : JSON.stringify(o.content, null, 2);
|
|
22
|
-
await r(a), e.value = !0, setTimeout(() => {
|
|
23
|
-
e.value = !1;
|
|
24
|
-
}, 1200);
|
|
25
|
-
}, f = v({
|
|
26
|
-
base: "absolute top-0 right-0 h-8 w-8 p-0 flex items-center justify-center brightness-lifted bg-inherit rounded focus-visible:opacity-100 -outline-offset-1",
|
|
27
|
-
variants: {
|
|
28
|
-
showCopied: {
|
|
29
|
-
true: "text-c-1",
|
|
30
|
-
false: "text-c-3 hover:text-c-1"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
return (a, g) => (l(), n("div", {
|
|
35
|
-
class: c(
|
|
36
|
-
t(i)(
|
|
37
|
-
"scalar-code-copy opacity-0 group-hover/code-block:opacity-100 sticky flex inset-0 justify-end items-start bg-inherit",
|
|
38
|
-
o.class
|
|
39
|
-
)
|
|
40
|
-
)
|
|
41
|
-
}, [
|
|
42
|
-
s(t(k), {
|
|
43
|
-
"aria-controls": o.controls,
|
|
44
|
-
"aria-label": "Copy",
|
|
45
|
-
class: c(t(i)(t(f)({ showCopied: e.value }))),
|
|
46
|
-
type: "button",
|
|
47
|
-
variant: "ghost",
|
|
48
|
-
onClick: u
|
|
49
|
-
}, {
|
|
50
|
-
default: y(() => [
|
|
51
|
-
s(t(C), {
|
|
52
|
-
class: c(["copy-icon size-4", { copied: e.value }])
|
|
53
|
-
}, null, 8, ["class"]),
|
|
54
|
-
s(t(h), {
|
|
55
|
-
class: c(["check-icon size-4", { visible: e.value }])
|
|
56
|
-
}, null, 8, ["class"])
|
|
57
|
-
]),
|
|
58
|
-
_: 1
|
|
59
|
-
}, 8, ["aria-controls", "class"]),
|
|
60
|
-
e.value ? (l(), n("div", x, " Copied ")) : m("", !0)
|
|
61
|
-
], 2));
|
|
62
|
-
}
|
|
63
|
-
});
|
|
1
|
+
import f from "./ScalarCodeBlockCopy.vue.js";
|
|
64
2
|
export {
|
|
65
|
-
|
|
3
|
+
f as default
|
|
66
4
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Labels for the standard languages */
|
|
2
|
+
export declare const LANGUAGE_LABELS: {
|
|
3
|
+
readonly bash: "Bash";
|
|
4
|
+
readonly c: "C";
|
|
5
|
+
readonly clojure: "Clojure";
|
|
6
|
+
readonly cpp: "C++";
|
|
7
|
+
readonly csharp: "C#";
|
|
8
|
+
readonly css: "CSS";
|
|
9
|
+
readonly curl: "cURL";
|
|
10
|
+
readonly dart: "Dart";
|
|
11
|
+
readonly diff: "Diff";
|
|
12
|
+
readonly docker: "Docker";
|
|
13
|
+
readonly dockerfile: "Dockerfile";
|
|
14
|
+
readonly elixir: "Elixir";
|
|
15
|
+
readonly fsharp: "F#";
|
|
16
|
+
readonly go: "Go";
|
|
17
|
+
readonly graphql: "GraphQL";
|
|
18
|
+
readonly haskell: "Haskell";
|
|
19
|
+
readonly html: "HTML";
|
|
20
|
+
readonly http: "HTTP";
|
|
21
|
+
readonly ini: "INI";
|
|
22
|
+
readonly java: "Java";
|
|
23
|
+
readonly javascript: "JavaScript";
|
|
24
|
+
readonly json: "JSON";
|
|
25
|
+
readonly kotlin: "Kotlin";
|
|
26
|
+
readonly less: "Less";
|
|
27
|
+
readonly lua: "Lua";
|
|
28
|
+
readonly makefile: "Makefile";
|
|
29
|
+
readonly markdown: "Markdown";
|
|
30
|
+
readonly matlab: "MATLAB";
|
|
31
|
+
readonly nginx: "Nginx";
|
|
32
|
+
readonly objectivec: "Objective-C";
|
|
33
|
+
readonly ocaml: "OCaml";
|
|
34
|
+
readonly perl: "Perl";
|
|
35
|
+
readonly php: "PHP";
|
|
36
|
+
readonly plaintext: "Plain Text";
|
|
37
|
+
readonly powershell: "PowerShell";
|
|
38
|
+
readonly properties: "Properties";
|
|
39
|
+
readonly python: "Python";
|
|
40
|
+
readonly r: "R";
|
|
41
|
+
readonly ruby: "Ruby";
|
|
42
|
+
readonly rust: "Rust";
|
|
43
|
+
readonly scala: "Scala";
|
|
44
|
+
readonly scss: "SCSS";
|
|
45
|
+
readonly shell: "Shell";
|
|
46
|
+
readonly sql: "SQL";
|
|
47
|
+
readonly swift: "Swift";
|
|
48
|
+
readonly toml: "TOML";
|
|
49
|
+
readonly typescript: "TypeScript";
|
|
50
|
+
readonly xml: "XML";
|
|
51
|
+
readonly yaml: "YAML";
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/constants.ts"],"names":[],"mappings":"AAEA,wCAAwC;AACxC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD4B,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const l = {
|
|
2
|
+
bash: "Bash",
|
|
3
|
+
c: "C",
|
|
4
|
+
clojure: "Clojure",
|
|
5
|
+
cpp: "C++",
|
|
6
|
+
csharp: "C#",
|
|
7
|
+
css: "CSS",
|
|
8
|
+
curl: "cURL",
|
|
9
|
+
dart: "Dart",
|
|
10
|
+
diff: "Diff",
|
|
11
|
+
docker: "Docker",
|
|
12
|
+
dockerfile: "Dockerfile",
|
|
13
|
+
elixir: "Elixir",
|
|
14
|
+
fsharp: "F#",
|
|
15
|
+
go: "Go",
|
|
16
|
+
graphql: "GraphQL",
|
|
17
|
+
haskell: "Haskell",
|
|
18
|
+
html: "HTML",
|
|
19
|
+
http: "HTTP",
|
|
20
|
+
ini: "INI",
|
|
21
|
+
java: "Java",
|
|
22
|
+
javascript: "JavaScript",
|
|
23
|
+
json: "JSON",
|
|
24
|
+
kotlin: "Kotlin",
|
|
25
|
+
less: "Less",
|
|
26
|
+
lua: "Lua",
|
|
27
|
+
makefile: "Makefile",
|
|
28
|
+
markdown: "Markdown",
|
|
29
|
+
matlab: "MATLAB",
|
|
30
|
+
nginx: "Nginx",
|
|
31
|
+
objectivec: "Objective-C",
|
|
32
|
+
ocaml: "OCaml",
|
|
33
|
+
perl: "Perl",
|
|
34
|
+
php: "PHP",
|
|
35
|
+
plaintext: "Plain Text",
|
|
36
|
+
powershell: "PowerShell",
|
|
37
|
+
properties: "Properties",
|
|
38
|
+
python: "Python",
|
|
39
|
+
r: "R",
|
|
40
|
+
ruby: "Ruby",
|
|
41
|
+
rust: "Rust",
|
|
42
|
+
scala: "Scala",
|
|
43
|
+
scss: "SCSS",
|
|
44
|
+
shell: "Shell",
|
|
45
|
+
sql: "SQL",
|
|
46
|
+
swift: "Swift",
|
|
47
|
+
toml: "TOML",
|
|
48
|
+
typescript: "TypeScript",
|
|
49
|
+
xml: "XML",
|
|
50
|
+
yaml: "YAML"
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
l as LANGUAGE_LABELS
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ScalarCopyProps, ScalarCopySlots } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Scalar Copy component
|
|
4
|
+
*
|
|
5
|
+
* Provides a copy button and copies content to the clipboard.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <ScalarCopy>
|
|
9
|
+
* <template #copy>Button label</template>
|
|
10
|
+
* <template #copied>Copied label</template>
|
|
11
|
+
* </ScalarCopy>
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ScalarCopyProps & {
|
|
14
|
+
copied?: boolean;
|
|
15
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
"update:copied": (value: boolean) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<ScalarCopyProps & {
|
|
18
|
+
copied?: boolean;
|
|
19
|
+
}> & Readonly<{
|
|
20
|
+
"onUpdate:copied"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScalarCopySlots>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=ScalarCopy.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarCopy.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/ScalarCopy.vue"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG/D;;;;;;;;;;GAUG;;aAwBQ,OAAO;;;;aAAP,OAAO;;;;AAvBlB,wBAgHC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent as p, mergeModels as s, useModel as r, watch as m, createBlock as u, openBlock as f, unref as c, createSlots as y, withCtx as t, renderSlot as a } from "vue";
|
|
2
|
+
import { useClipboard as b } from "@vueuse/core";
|
|
3
|
+
import k from "./ScalarCopyButton.vue.js";
|
|
4
|
+
const $ = {}, B = /* @__PURE__ */ p({
|
|
5
|
+
...$,
|
|
6
|
+
__name: "ScalarCopy",
|
|
7
|
+
props: /* @__PURE__ */ s({
|
|
8
|
+
content: { default: "" },
|
|
9
|
+
placement: {},
|
|
10
|
+
showLabel: { type: Boolean },
|
|
11
|
+
duration: { default: 1500 }
|
|
12
|
+
}, {
|
|
13
|
+
copied: { type: Boolean, default: !1 },
|
|
14
|
+
copiedModifiers: {}
|
|
15
|
+
}),
|
|
16
|
+
emits: ["update:copied"],
|
|
17
|
+
setup(o) {
|
|
18
|
+
const n = r(o, "copied"), { copy: i, copied: l } = b({
|
|
19
|
+
legacy: !0,
|
|
20
|
+
copiedDuring: o.duration
|
|
21
|
+
});
|
|
22
|
+
return m(l, (e) => n.value = e), (e, d) => (f(), u(k, {
|
|
23
|
+
placement: o.placement,
|
|
24
|
+
showLabel: o.showLabel,
|
|
25
|
+
copied: n.value || c(l),
|
|
26
|
+
onClick: d[0] || (d[0] = (v) => c(i)(o.content))
|
|
27
|
+
}, y({ _: 2 }, [
|
|
28
|
+
e.$slots.copy ? {
|
|
29
|
+
name: "copy",
|
|
30
|
+
fn: t(() => [
|
|
31
|
+
a(e.$slots, "copy")
|
|
32
|
+
]),
|
|
33
|
+
key: "0"
|
|
34
|
+
} : void 0,
|
|
35
|
+
e.$slots.copied ? {
|
|
36
|
+
name: "copied",
|
|
37
|
+
fn: t(() => [
|
|
38
|
+
a(e.$slots, "copied")
|
|
39
|
+
]),
|
|
40
|
+
key: "1"
|
|
41
|
+
} : void 0,
|
|
42
|
+
e.$slots.backdrop ? {
|
|
43
|
+
name: "backdrop",
|
|
44
|
+
fn: t(() => [
|
|
45
|
+
a(e.$slots, "backdrop")
|
|
46
|
+
]),
|
|
47
|
+
key: "2"
|
|
48
|
+
} : void 0
|
|
49
|
+
]), 1032, ["placement", "showLabel", "copied"]));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
B as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalar Copy Backdrop component
|
|
3
|
+
*
|
|
4
|
+
* A backdrop for the copy button label, this component can be
|
|
5
|
+
* used to override the default backdrop with a custom one.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <ScalarCopy>
|
|
9
|
+
* <template #backdrop>
|
|
10
|
+
* <ScalarCopyBackdrop class="bg-b-2" />
|
|
11
|
+
* </template>
|
|
12
|
+
* </ScalarCopy>
|
|
13
|
+
*/
|
|
14
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=ScalarCopyBackdrop.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarCopyBackdrop.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/ScalarCopyBackdrop.vue"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;GAYG;;AACH,wBAyCC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineComponent as t, createElementBlock as r, openBlock as o, normalizeProps as n, guardReactiveProps as a, unref as c } from "vue";
|
|
2
|
+
import { useBindCx as s } from "@scalar/use-hooks/useBindCx";
|
|
3
|
+
const i = {}, f = /* @__PURE__ */ t({
|
|
4
|
+
...i,
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "ScalarCopyBackdrop",
|
|
7
|
+
setup(l) {
|
|
8
|
+
const { cx: e } = s();
|
|
9
|
+
return (p, _) => (o(), r("div", n(a(c(e)("absolute inset-y-0.5 -z-2 left-0 right-0 bg-b-1 rounded"))), null, 16));
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
f as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ScalarCopyPlacement, ScalarCopySlots } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Scalar Copy Button component
|
|
4
|
+
*
|
|
5
|
+
* A dumb button with copy animations.
|
|
6
|
+
*
|
|
7
|
+
* If you're looking for a button that copies content to the clipboard,
|
|
8
|
+
* use the ScalarCopy component instead.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <ScalarCopyButton @click="handleCopy">
|
|
12
|
+
* <template #copy>Button label</template>
|
|
13
|
+
* <template #copied>Copied label</template>
|
|
14
|
+
* </ScalarCopyButton>
|
|
15
|
+
*/
|
|
16
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
17
|
+
/** Whether the label should be shown on hover or always */
|
|
18
|
+
showLabel?: boolean;
|
|
19
|
+
/** The placement of the copy button */
|
|
20
|
+
placement?: ScalarCopyPlacement;
|
|
21
|
+
} & {
|
|
22
|
+
/** Whether the copy button has been clicked */
|
|
23
|
+
copied?: boolean;
|
|
24
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
"update:copied": (value: boolean) => any;
|
|
26
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
27
|
+
/** Whether the label should be shown on hover or always */
|
|
28
|
+
showLabel?: boolean;
|
|
29
|
+
/** The placement of the copy button */
|
|
30
|
+
placement?: ScalarCopyPlacement;
|
|
31
|
+
} & {
|
|
32
|
+
/** Whether the copy button has been clicked */
|
|
33
|
+
copied?: boolean;
|
|
34
|
+
}> & Readonly<{
|
|
35
|
+
"onUpdate:copied"?: ((value: boolean) => any) | undefined;
|
|
36
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScalarCopySlots>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=ScalarCopyButton.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarCopyButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/ScalarCopyButton.vue"],"names":[],"mappings":"AA6HA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGnE;;;;;;;;;;;;;GAaG;;IAGD,2DAA2D;gBAC/C,OAAO;IACnB,uCAAuC;gBAC3B,mBAAmB;;IAuBjC,+CAA+C;aACpC,OAAO;;;;IA3BhB,2DAA2D;gBAC/C,OAAO;IACnB,uCAAuC;gBAC3B,mBAAmB;;IAuBjC,+CAA+C;aACpC,OAAO;;;;AA7BlB,wBAsNC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|