@scalar/components 0.18.0 → 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.
Files changed (36) hide show
  1. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts +3 -2
  2. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts.map +1 -1
  3. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.js +51 -25
  4. package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts +23 -5
  5. package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.d.ts.map +1 -1
  6. package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue.js +55 -5
  7. package/dist/components/ScalarCodeBlock/ScalarCodeBlockCopy.vue2.js +2 -64
  8. package/dist/components/ScalarCodeBlock/constants.d.ts +53 -0
  9. package/dist/components/ScalarCodeBlock/constants.d.ts.map +1 -0
  10. package/dist/components/ScalarCodeBlock/constants.js +54 -0
  11. package/dist/components/ScalarCodeBlock/types.d.ts +4 -0
  12. package/dist/components/ScalarCodeBlock/types.d.ts.map +1 -0
  13. package/dist/components/ScalarCopy/ScalarCopy.vue.d.ts +28 -0
  14. package/dist/components/ScalarCopy/ScalarCopy.vue.d.ts.map +1 -0
  15. package/dist/components/ScalarCopy/ScalarCopy.vue.js +54 -0
  16. package/dist/components/ScalarCopy/ScalarCopy.vue2.js +4 -0
  17. package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.d.ts +16 -0
  18. package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.d.ts.map +1 -0
  19. package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue.js +14 -0
  20. package/dist/components/ScalarCopy/ScalarCopyBackdrop.vue2.js +4 -0
  21. package/dist/components/ScalarCopy/ScalarCopyButton.vue.d.ts +43 -0
  22. package/dist/components/ScalarCopy/ScalarCopyButton.vue.d.ts.map +1 -0
  23. package/dist/components/ScalarCopy/ScalarCopyButton.vue.js +108 -0
  24. package/dist/components/ScalarCopy/ScalarCopyButton.vue2.js +4 -0
  25. package/dist/components/ScalarCopy/index.d.ts +3 -0
  26. package/dist/components/ScalarCopy/index.d.ts.map +1 -0
  27. package/dist/components/ScalarCopy/types.d.ts +31 -0
  28. package/dist/components/ScalarCopy/types.d.ts.map +1 -0
  29. package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts +2 -1
  30. package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts.map +1 -1
  31. package/dist/components/ScalarMenu/ScalarMenuProducts.vue.js +33 -20
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +190 -186
  35. package/dist/style.css +1 -1
  36. package/package.json +5 -5
@@ -0,0 +1,108 @@
1
+ import { defineComponent as y, mergeModels as v, useModel as b, computed as k, createElementBlock as a, openBlock as t, mergeProps as x, unref as C, createVNode as i, createElementVNode as c, Transition as d, withCtx as p, createBlock as h, resolveDynamicComponent as g, normalizeClass as u, renderSlot as l, createTextVNode as r } from "vue";
2
+ import { ScalarIconCheck as w, ScalarIconCopy as B } from "@scalar/icons";
3
+ import { useBindCx as $ } from "@scalar/use-hooks/useBindCx";
4
+ import z from "./ScalarCopyBackdrop.vue.js";
5
+ const S = {
6
+ "aria-hidden": "true",
7
+ class: "flex items-center py-1.5 mask-y-from-[calc(100%-8px)] mask-y-to-100%"
8
+ }, M = {
9
+ key: 0,
10
+ class: "whitespace-nowrap px-1.5"
11
+ }, N = {
12
+ key: 0,
13
+ role: "alert",
14
+ class: "sr-only"
15
+ }, V = {
16
+ key: 1,
17
+ class: "sr-only"
18
+ }, E = {}, A = /* @__PURE__ */ y({
19
+ ...E,
20
+ inheritAttrs: !1,
21
+ __name: "ScalarCopyButton",
22
+ props: /* @__PURE__ */ v({
23
+ showLabel: { type: Boolean },
24
+ placement: { default: "right" }
25
+ }, {
26
+ copied: { type: Boolean, default: !1 },
27
+ copiedModifiers: {}
28
+ }),
29
+ emits: ["update:copied"],
30
+ setup(n) {
31
+ const o = b(n, "copied"), { cx: m } = $(), f = k(() => o.value ? w : B);
32
+ return (s, e) => (t(), a("button", x(
33
+ { type: "button" },
34
+ C(m)(
35
+ "group/copy-button relative z-0 flex items-center justify-center",
36
+ "size-6 p-1.25 -m-1 rounded text-xs bg-b-2",
37
+ o.value ? "text-c-1" : "text-c-2 hover:text-c-1"
38
+ )
39
+ ), [
40
+ i(d, {
41
+ mode: "out-in",
42
+ "enter-active-class": "transition-transform",
43
+ "enter-from-class": "scale-0",
44
+ "enter-to-class": "scale-100",
45
+ "leave-active-class": "transition-transform",
46
+ "leave-from-class": "scale-100",
47
+ "leave-to-class": "scale-0"
48
+ }, {
49
+ default: p(() => [
50
+ (t(), h(g(f.value), { class: "size-full" }))
51
+ ]),
52
+ _: 1
53
+ }),
54
+ e[4] || (e[4] = c("div", { class: "bg-inherit rounded-[inherit] absolute inset-0 -z-1" }, null, -1)),
55
+ c("div", {
56
+ class: u(["group/copy-label absolute flex items-center -inset-y-0.5 rounded", {
57
+ "left-0 pl-[100%]": n.placement === "right",
58
+ "right-0 pr-[100%]": n.placement === "left"
59
+ }])
60
+ }, [
61
+ c("div", S, [
62
+ i(d, {
63
+ mode: "out-in",
64
+ "enter-active-class": "transition-transform ease-out",
65
+ "enter-from-class": "translate-y-1.5",
66
+ "enter-to-class": "translate-y-0",
67
+ "leave-active-class": "transition-transform ease-in",
68
+ "leave-from-class": "translate-y-0",
69
+ "leave-to-class": "-translate-y-1.5"
70
+ }, {
71
+ default: p(() => [
72
+ o.value ? (t(), a("div", M, [
73
+ l(s.$slots, "copied", {}, () => [
74
+ e[0] || (e[0] = r("Copied", -1))
75
+ ])
76
+ ])) : (t(), a("div", {
77
+ key: 1,
78
+ class: u(["whitespace-nowrap px-1.5", {
79
+ "group-hocus/copy-button:block hidden": !n.showLabel && !o.value
80
+ }])
81
+ }, [
82
+ l(s.$slots, "copy", {}, () => [
83
+ e[1] || (e[1] = r("Copy", -1))
84
+ ])
85
+ ], 2))
86
+ ]),
87
+ _: 3
88
+ })
89
+ ]),
90
+ o.value ? (t(), a("div", N, [
91
+ l(s.$slots, "copied", {}, () => [
92
+ e[2] || (e[2] = r("Copied", -1))
93
+ ])
94
+ ])) : (t(), a("div", V, [
95
+ l(s.$slots, "copy", {}, () => [
96
+ e[3] || (e[3] = r("Copy", -1))
97
+ ])
98
+ ])),
99
+ l(s.$slots, "backdrop", {}, () => [
100
+ i(z)
101
+ ])
102
+ ], 2)
103
+ ], 16));
104
+ }
105
+ });
106
+ export {
107
+ A as default
108
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarCopyButton.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,3 @@
1
+ export { default as ScalarCopy } from './ScalarCopy.vue.js';
2
+ export { default as ScalarCopyButton } from './ScalarCopyButton.vue.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,31 @@
1
+ export type ScalarCopyPlacement = 'left' | 'right';
2
+ export type ScalarCopyProps = {
3
+ /** The content to copy to the clipboard */
4
+ content?: string;
5
+ /** The placement of the label relative to the copy button */
6
+ placement?: ScalarCopyPlacement;
7
+ /**
8
+ * Whether the label should always be shown or only when the copy button is hovered
9
+ */
10
+ showLabel?: boolean;
11
+ /**
12
+ * The duration to show the copied state after the copy button is clicked in milliseconds
13
+ *
14
+ * @default 1500
15
+ */
16
+ duration?: number;
17
+ };
18
+ export type ScalarCopySlots = {
19
+ /** The label shown next to the copy button before it is clicked */
20
+ copy?: () => unknown;
21
+ /** The label shown next to the copy button after it is clicked */
22
+ copied?: () => unknown;
23
+ /**
24
+ * Overrides the backdrop for the label
25
+ *
26
+ * This should match the background color of the parent
27
+ * container to ensure the label is legible
28
+ */
29
+ backdrop?(): unknown;
30
+ };
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCopy/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,OAAO,CAAA;IACpB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,OAAO,CAAA;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,OAAO,CAAA;CACrB,CAAA"}
@@ -1,6 +1,7 @@
1
- type Product = 'dashboard' | 'docs' | 'client';
1
+ type Product = 'dashboard' | 'docs' | 'editor' | 'client';
2
2
  type __VLS_Props = {
3
3
  selected?: Product;
4
+ showDocs?: boolean;
4
5
  hrefs?: Record<Product, string>;
5
6
  };
6
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarMenuProducts.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMenu/ScalarMenuProducts.vue"],"names":[],"mappings":"AA4DA,KAAK,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE9C,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;CAChC,CAAC;;;;;;AAoHF,wBAOG"}
1
+ {"version":3,"file":"ScalarMenuProducts.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMenu/ScalarMenuProducts.vue"],"names":[],"mappings":"AAuEA,KAAK,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEzD,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;CAChC,CAAC;;;;;;AA+IF,wBAOG"}
@@ -1,48 +1,61 @@
1
- import { defineComponent as a, createElementBlock as f, openBlock as m, normalizeProps as u, guardReactiveProps as h, unref as r, createVNode as n, withCtx as l, createTextVNode as d } from "vue";
2
- import { ScalarIconHouse as p, ScalarIconBook as C, ScalarIconArrowUpRight as k } from "@scalar/icons";
3
- import { useBindCx as b } from "@scalar/use-hooks/useBindCx";
4
- import i from "./ScalarMenuProduct.vue.js";
5
- const I = /* @__PURE__ */ a({
1
+ import { defineComponent as f, createElementBlock as m, openBlock as c, normalizeProps as u, guardReactiveProps as h, unref as r, createVNode as i, createBlock as k, createCommentVNode as C, withCtx as d, createTextVNode as l } from "vue";
2
+ import { ScalarIconHouse as p, ScalarIconBook as B, ScalarIconNotepad as b, ScalarIconArrowUpRight as S } from "@scalar/icons";
3
+ import { useBindCx as $ } from "@scalar/use-hooks/useBindCx";
4
+ import n from "./ScalarMenuProduct.vue.js";
5
+ const N = /* @__PURE__ */ f({
6
6
  inheritAttrs: !1,
7
7
  __name: "ScalarMenuProducts",
8
8
  props: {
9
9
  selected: {},
10
+ showDocs: { type: Boolean },
10
11
  hrefs: {}
11
12
  },
12
13
  emits: ["open"],
13
14
  setup(o) {
14
- const { cx: c } = b();
15
- return (s, e) => (m(), f("div", u(h(r(c)("flex flex-col"))), [
16
- n(i, {
15
+ const { cx: a } = $();
16
+ return (s, e) => (c(), m("div", u(h(r(a)("flex flex-col"))), [
17
+ i(n, {
17
18
  href: o.hrefs?.dashboard ?? "https://dashboard.scalar.com",
18
19
  icon: r(p),
19
20
  selected: o.selected === "dashboard",
20
21
  onClick: e[0] || (e[0] = (t) => s.$emit("open", t, "dashboard"))
21
22
  }, {
22
- default: l(() => [...e[3] || (e[3] = [
23
- d(" Dashboard ", -1)
23
+ default: d(() => [...e[4] || (e[4] = [
24
+ l(" Dashboard ", -1)
24
25
  ])]),
25
26
  _: 1
26
27
  }, 8, ["href", "icon", "selected"]),
27
- n(i, {
28
+ o.showDocs || o.selected === "docs" ? (c(), k(n, {
29
+ key: 0,
28
30
  href: o.hrefs?.docs ?? "https://docs.scalar.com",
29
- icon: r(C),
31
+ icon: r(B),
30
32
  selected: o.selected === "docs",
31
33
  onClick: e[1] || (e[1] = (t) => s.$emit("open", t, "docs"))
32
34
  }, {
33
- default: l(() => [...e[4] || (e[4] = [
34
- d(" Docs ", -1)
35
+ default: d(() => [...e[5] || (e[5] = [
36
+ l(" Docs ", -1)
37
+ ])]),
38
+ _: 1
39
+ }, 8, ["href", "icon", "selected"])) : C("", !0),
40
+ i(n, {
41
+ href: o.hrefs?.editor ?? "https://editor.scalar.com",
42
+ icon: r(b),
43
+ selected: o.selected === "editor",
44
+ onClick: e[2] || (e[2] = (t) => s.$emit("open", t, "editor"))
45
+ }, {
46
+ default: d(() => [...e[6] || (e[6] = [
47
+ l(" Editor ", -1)
35
48
  ])]),
36
49
  _: 1
37
50
  }, 8, ["href", "icon", "selected"]),
38
- n(i, {
51
+ i(n, {
39
52
  href: o.hrefs?.client ?? "https://client.scalar.com",
40
- icon: r(k),
53
+ icon: r(S),
41
54
  selected: o.selected === "client",
42
- onClick: e[2] || (e[2] = (t) => s.$emit("open", t, "client"))
55
+ onClick: e[3] || (e[3] = (t) => s.$emit("open", t, "client"))
43
56
  }, {
44
- default: l(() => [...e[5] || (e[5] = [
45
- d(" Client ", -1)
57
+ default: d(() => [...e[7] || (e[7] = [
58
+ l(" Client ", -1)
46
59
  ])]),
47
60
  _: 1
48
61
  }, 8, ["href", "icon", "selected"])
@@ -50,5 +63,5 @@ const I = /* @__PURE__ */ a({
50
63
  }
51
64
  });
52
65
  export {
53
- I as default
66
+ N as default
54
67
  };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './components/ScalarCodeBlock';
8
8
  export * from './components/ScalarColorModeToggle';
9
9
  export * from './components/ScalarCombobox';
10
10
  export * from './components/ScalarContextMenu';
11
+ export * from './components/ScalarCopy';
11
12
  export * from './components/ScalarDropdown';
12
13
  export * from './components/ScalarErrorBoundary';
13
14
  export * from './components/ScalarFileUpload';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE7E,4EAA4E;AAC5E,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cA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