@scalar/components 0.16.2 → 0.16.4

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 (34) hide show
  1. package/dist/components/ScalarIcon/logos/Astro.svg.js +14 -0
  2. package/dist/components/ScalarIcon/logos/index.d.ts +1 -1
  3. package/dist/components/ScalarIcon/logos/index.d.ts.map +1 -1
  4. package/dist/components/ScalarIcon/utils/index.js +66 -64
  5. package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.d.ts +2 -2
  6. package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.d.ts.map +1 -1
  7. package/dist/components/ScalarMarkdown/ScalarMarkdownSummary.vue.js +21 -19
  8. package/dist/components/ScalarMarkdown/types.d.ts +10 -0
  9. package/dist/components/ScalarMarkdown/types.d.ts.map +1 -1
  10. package/dist/components/ScalarThemeSwatches/ScalarThemeSwatches.vue.d.ts +15 -0
  11. package/dist/components/ScalarThemeSwatches/ScalarThemeSwatches.vue.d.ts.map +1 -0
  12. package/dist/components/ScalarThemeSwatches/ScalarThemeSwatches.vue.js +35 -0
  13. package/dist/components/ScalarThemeSwatches/ScalarThemeSwatches.vue2.js +4 -0
  14. package/dist/components/ScalarThemeSwatches/index.d.ts +3 -0
  15. package/dist/components/ScalarThemeSwatches/index.d.ts.map +1 -0
  16. package/dist/components/ScalarThemeSwatches/useThemeSwatches.d.ts +28 -0
  17. package/dist/components/ScalarThemeSwatches/useThemeSwatches.d.ts.map +1 -0
  18. package/dist/components/ScalarThemeSwatches/useThemeSwatches.js +33 -0
  19. package/dist/components/ScalarWrappingText/ScalarWrappingText.vue.d.ts +14 -0
  20. package/dist/components/ScalarWrappingText/ScalarWrappingText.vue.d.ts.map +1 -0
  21. package/dist/components/ScalarWrappingText/ScalarWrappingText.vue.js +25 -0
  22. package/dist/components/ScalarWrappingText/ScalarWrappingText.vue2.js +4 -0
  23. package/dist/components/ScalarWrappingText/constants.d.ts +13 -0
  24. package/dist/components/ScalarWrappingText/constants.d.ts.map +1 -0
  25. package/dist/components/ScalarWrappingText/constants.js +12 -0
  26. package/dist/components/ScalarWrappingText/index.d.ts +2 -0
  27. package/dist/components/ScalarWrappingText/index.d.ts.map +1 -0
  28. package/dist/components/ScalarWrappingText/types.d.ts +18 -0
  29. package/dist/components/ScalarWrappingText/types.d.ts.map +1 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +76 -70
  33. package/dist/style.css +1 -1
  34. package/package.json +8 -12
@@ -0,0 +1,14 @@
1
+ import { createElementBlock as e, openBlock as o } from "vue";
2
+ const t = {
3
+ xmlns: "http://www.w3.org/2000/svg",
4
+ fill: "none",
5
+ viewBox: "0 0 24 24"
6
+ };
7
+ function n(r, c) {
8
+ return o(), e("svg", t);
9
+ }
10
+ const l = { render: n };
11
+ export {
12
+ l as default,
13
+ n as render
14
+ };
@@ -1,2 +1,2 @@
1
- export declare const LOGOS: readonly ["Adonisjs", "Docusaurus", "Dotnet", "Elysiajs", "Express", "Fastapi", "Fastify", "Go", "Hono", "Laravel", "Litestar", "Nestjs", "Nextjs", "Nitro", "Nuxt", "Openapi", "Platformatic", "React", "Rust", "Svelte", "Vue"];
1
+ export declare const LOGOS: readonly ["Adonisjs", "Astro", "Docusaurus", "Dotnet", "Elysiajs", "Express", "Fastapi", "Fastify", "Go", "Hono", "Laravel", "Litestar", "Nestjs", "Nextjs", "Nitro", "Nuxt", "Openapi", "Platformatic", "React", "Rust", "Svelte", "Vue"];
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ScalarIcon/logos/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,mOAsBR,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ScalarIcon/logos/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,4OAuBR,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as g from "../icons/Add.svg.js";
1
+ import * as a from "../icons/Add.svg.js";
2
2
  import * as m from "../icons/AddTab.svg.js";
3
3
  import * as i from "../icons/Alert.svg.js";
4
4
  import * as n from "../icons/ArrowLeft.svg.js";
@@ -20,9 +20,9 @@ import * as b from "../icons/CodeFolder.svg.js";
20
20
  import * as j from "../icons/Cog.svg.js";
21
21
  import * as D from "../icons/Collection.svg.js";
22
22
  import * as S from "../icons/Cookie.svg.js";
23
- import * as F from "../icons/DarkMode.svg.js";
24
- import * as y from "../icons/Delete.svg.js";
25
- import * as A from "../icons/Discord.svg.js";
23
+ import * as A from "../icons/DarkMode.svg.js";
24
+ import * as F from "../icons/Delete.svg.js";
25
+ import * as y from "../icons/Discord.svg.js";
26
26
  import * as E from "../icons/DocsPage.svg.js";
27
27
  import * as H from "../icons/Download.svg.js";
28
28
  import * as R from "../icons/Duplicate.svg.js";
@@ -51,8 +51,8 @@ import * as _ from "../icons/LightMode.svg.js";
51
51
  import * as oo from "../icons/Link.svg.js";
52
52
  import * as ro from "../icons/Lock.svg.js";
53
53
  import * as so from "../icons/Logo.svg.js";
54
- import * as ao from "../icons/Magic.svg.js";
55
- import * as go from "../icons/Markdown.svg.js";
54
+ import * as go from "../icons/Magic.svg.js";
55
+ import * as ao from "../icons/Markdown.svg.js";
56
56
  import * as mo from "../icons/Menu.svg.js";
57
57
  import * as io from "../icons/NotAllowed.svg.js";
58
58
  import * as no from "../icons/Page.svg.js";
@@ -73,9 +73,9 @@ import * as bo from "../icons/Unwatch.svg.js";
73
73
  import * as jo from "../icons/Upload.svg.js";
74
74
  import * as Do from "../icons/User.svg.js";
75
75
  import * as So from "../icons/UserSwitch.svg.js";
76
- import * as Fo from "../icons/Users.svg.js";
77
- import * as yo from "../icons/Versions.svg.js";
78
- import * as Ao from "../icons/Wallet.svg.js";
76
+ import * as Ao from "../icons/Users.svg.js";
77
+ import * as Fo from "../icons/Versions.svg.js";
78
+ import * as yo from "../icons/Wallet.svg.js";
79
79
  import * as Eo from "../icons/Watch.svg.js";
80
80
  import * as Ho from "../icons/Workspace.svg.js";
81
81
  import * as Ro from "../icons/programming-framework-angular.svg.js";
@@ -104,8 +104,8 @@ import * as _o from "../icons/programming-language-php.svg.js";
104
104
  import * as or from "../icons/programming-language-powershell.svg.js";
105
105
  import * as rr from "../icons/programming-language-python.svg.js";
106
106
  import * as sr from "../icons/programming-language-r.svg.js";
107
- import * as ar from "../icons/programming-language-ruby.svg.js";
108
- import * as gr from "../icons/programming-language-rust.svg.js";
107
+ import * as gr from "../icons/programming-language-ruby.svg.js";
108
+ import * as ar from "../icons/programming-language-rust.svg.js";
109
109
  import * as mr from "../icons/programming-language-scala.svg.js";
110
110
  import * as ir from "../icons/programming-language-shell.svg.js";
111
111
  import * as nr from "../icons/programming-language-swift.svg.js";
@@ -114,28 +114,29 @@ import * as pr from "../icons/programming-script-code.svg.js";
114
114
  import * as er from "../icons/programming-tool-git.svg.js";
115
115
  import * as cr from "../icons/programming-tool-tailwindcss.svg.js";
116
116
  import * as lr from "../logos/Adonisjs.svg.js";
117
- import * as fr from "../logos/Docusaurus.svg.js";
118
- import * as vr from "../logos/Dotnet.svg.js";
119
- import * as ur from "../logos/Elysiajs.svg.js";
120
- import * as dr from "../logos/Express.svg.js";
121
- import * as Lr from "../logos/Fastapi.svg.js";
122
- import * as hr from "../logos/Fastify.svg.js";
123
- import * as wr from "../logos/Go.svg.js";
124
- import * as kr from "../logos/Hono.svg.js";
125
- import * as Cr from "../logos/Laravel.svg.js";
126
- import * as br from "../logos/Litestar.svg.js";
127
- import * as jr from "../logos/Nestjs.svg.js";
128
- import * as Dr from "../logos/Nextjs.svg.js";
129
- import * as Sr from "../logos/Nitro.svg.js";
117
+ import * as fr from "../logos/Astro.svg.js";
118
+ import * as vr from "../logos/Docusaurus.svg.js";
119
+ import * as ur from "../logos/Dotnet.svg.js";
120
+ import * as dr from "../logos/Elysiajs.svg.js";
121
+ import * as Lr from "../logos/Express.svg.js";
122
+ import * as hr from "../logos/Fastapi.svg.js";
123
+ import * as wr from "../logos/Fastify.svg.js";
124
+ import * as kr from "../logos/Go.svg.js";
125
+ import * as Cr from "../logos/Hono.svg.js";
126
+ import * as br from "../logos/Laravel.svg.js";
127
+ import * as jr from "../logos/Litestar.svg.js";
128
+ import * as Dr from "../logos/Nestjs.svg.js";
129
+ import * as Sr from "../logos/Nextjs.svg.js";
130
+ import * as Ar from "../logos/Nitro.svg.js";
130
131
  import * as Fr from "../logos/Nuxt.svg.js";
131
132
  import * as yr from "../logos/Openapi.svg.js";
132
- import * as Ar from "../logos/Platformatic.svg.js";
133
- import * as Er from "../logos/React.svg.js";
134
- import * as Hr from "../logos/Rust.svg.js";
135
- import * as Rr from "../logos/Svelte.svg.js";
136
- import * as Tr from "../logos/Vue.svg.js";
133
+ import * as Er from "../logos/Platformatic.svg.js";
134
+ import * as Hr from "../logos/React.svg.js";
135
+ import * as Rr from "../logos/Rust.svg.js";
136
+ import * as Tr from "../logos/Svelte.svg.js";
137
+ import * as Ur from "../logos/Vue.svg.js";
137
138
  const s = /* @__PURE__ */ Object.assign({
138
- "../icons/Add.svg": g,
139
+ "../icons/Add.svg": a,
139
140
  "../icons/AddTab.svg": m,
140
141
  "../icons/Alert.svg": i,
141
142
  "../icons/ArrowLeft.svg": n,
@@ -157,9 +158,9 @@ const s = /* @__PURE__ */ Object.assign({
157
158
  "../icons/Cog.svg": j,
158
159
  "../icons/Collection.svg": D,
159
160
  "../icons/Cookie.svg": S,
160
- "../icons/DarkMode.svg": F,
161
- "../icons/Delete.svg": y,
162
- "../icons/Discord.svg": A,
161
+ "../icons/DarkMode.svg": A,
162
+ "../icons/Delete.svg": F,
163
+ "../icons/Discord.svg": y,
163
164
  "../icons/DocsPage.svg": E,
164
165
  "../icons/Download.svg": H,
165
166
  "../icons/Duplicate.svg": R,
@@ -188,8 +189,8 @@ const s = /* @__PURE__ */ Object.assign({
188
189
  "../icons/Link.svg": oo,
189
190
  "../icons/Lock.svg": ro,
190
191
  "../icons/Logo.svg": so,
191
- "../icons/Magic.svg": ao,
192
- "../icons/Markdown.svg": go,
192
+ "../icons/Magic.svg": go,
193
+ "../icons/Markdown.svg": ao,
193
194
  "../icons/Menu.svg": mo,
194
195
  "../icons/NotAllowed.svg": io,
195
196
  "../icons/Page.svg": no,
@@ -210,9 +211,9 @@ const s = /* @__PURE__ */ Object.assign({
210
211
  "../icons/Upload.svg": jo,
211
212
  "../icons/User.svg": Do,
212
213
  "../icons/UserSwitch.svg": So,
213
- "../icons/Users.svg": Fo,
214
- "../icons/Versions.svg": yo,
215
- "../icons/Wallet.svg": Ao,
214
+ "../icons/Users.svg": Ao,
215
+ "../icons/Versions.svg": Fo,
216
+ "../icons/Wallet.svg": yo,
216
217
  "../icons/Watch.svg": Eo,
217
218
  "../icons/Workspace.svg": Ho,
218
219
  "../icons/programming-framework-angular.svg": Ro,
@@ -241,8 +242,8 @@ const s = /* @__PURE__ */ Object.assign({
241
242
  "../icons/programming-language-powershell.svg": or,
242
243
  "../icons/programming-language-python.svg": rr,
243
244
  "../icons/programming-language-r.svg": sr,
244
- "../icons/programming-language-ruby.svg": ar,
245
- "../icons/programming-language-rust.svg": gr,
245
+ "../icons/programming-language-ruby.svg": gr,
246
+ "../icons/programming-language-rust.svg": ar,
246
247
  "../icons/programming-language-scala.svg": mr,
247
248
  "../icons/programming-language-shell.svg": ir,
248
249
  "../icons/programming-language-swift.svg": nr,
@@ -250,36 +251,37 @@ const s = /* @__PURE__ */ Object.assign({
250
251
  "../icons/programming-script-code.svg": pr,
251
252
  "../icons/programming-tool-git.svg": er,
252
253
  "../icons/programming-tool-tailwindcss.svg": cr
253
- }), a = /* @__PURE__ */ Object.assign({
254
+ }), g = /* @__PURE__ */ Object.assign({
254
255
  "../logos/Adonisjs.svg": lr,
255
- "../logos/Docusaurus.svg": fr,
256
- "../logos/Dotnet.svg": vr,
257
- "../logos/Elysiajs.svg": ur,
258
- "../logos/Express.svg": dr,
259
- "../logos/Fastapi.svg": Lr,
260
- "../logos/Fastify.svg": hr,
261
- "../logos/Go.svg": wr,
262
- "../logos/Hono.svg": kr,
263
- "../logos/Laravel.svg": Cr,
264
- "../logos/Litestar.svg": br,
265
- "../logos/Nestjs.svg": jr,
266
- "../logos/Nextjs.svg": Dr,
267
- "../logos/Nitro.svg": Sr,
256
+ "../logos/Astro.svg": fr,
257
+ "../logos/Docusaurus.svg": vr,
258
+ "../logos/Dotnet.svg": ur,
259
+ "../logos/Elysiajs.svg": dr,
260
+ "../logos/Express.svg": Lr,
261
+ "../logos/Fastapi.svg": hr,
262
+ "../logos/Fastify.svg": wr,
263
+ "../logos/Go.svg": kr,
264
+ "../logos/Hono.svg": Cr,
265
+ "../logos/Laravel.svg": br,
266
+ "../logos/Litestar.svg": jr,
267
+ "../logos/Nestjs.svg": Dr,
268
+ "../logos/Nextjs.svg": Sr,
269
+ "../logos/Nitro.svg": Ar,
268
270
  "../logos/Nuxt.svg": Fr,
269
271
  "../logos/Openapi.svg": yr,
270
- "../logos/Platformatic.svg": Ar,
271
- "../logos/React.svg": Er,
272
- "../logos/Rust.svg": Hr,
273
- "../logos/Svelte.svg": Rr,
274
- "../logos/Vue.svg": Tr
275
- }), Ur = (o) => {
272
+ "../logos/Platformatic.svg": Er,
273
+ "../logos/React.svg": Hr,
274
+ "../logos/Rust.svg": Rr,
275
+ "../logos/Svelte.svg": Tr,
276
+ "../logos/Vue.svg": Ur
277
+ }), xr = (o) => {
276
278
  const r = `../icons/${o}.svg`;
277
279
  return s[r] ? s[r] : (console.warn(`Could not find icon: ${o}`), null);
278
- }, xr = (o) => {
280
+ }, Pr = (o) => {
279
281
  const r = `../logos/${o}.svg`;
280
- return a[r] ? a[r] : (console.warn(`Could not find icon: ${o}`), null);
282
+ return g[r] ? g[r] : (console.warn(`Could not find icon: ${o}`), null);
281
283
  };
282
284
  export {
283
- Ur as getIcon,
284
- xr as getLogo
285
+ xr as getIcon,
286
+ Pr as getLogo
285
287
  };
@@ -1,5 +1,5 @@
1
- import type { ScalarMarkdownProps } from './types';
2
- type __VLS_Props = ScalarMarkdownProps;
1
+ import type { ScalarMarkdownSummaryProps } from './types';
2
+ type __VLS_Props = ScalarMarkdownSummaryProps;
3
3
  type __VLS_PublicProps = __VLS_Props & {
4
4
  /** * Whether the summary is open. */
5
5
  modelValue?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarMarkdownSummary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdownSummary.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,KAAK,WAAW,GAAG,mBAAmB,CAAC;AAmCvC,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA+DF,QAAA,IAAuB,OAAO;;CAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA0B9C,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
+ {"version":3,"file":"ScalarMarkdownSummary.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdownSummary.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAEzD,KAAK,WAAW,GAAG,0BAA0B,CAAC;AAmC9C,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA+DF,QAAA,IAAuB,OAAO;;CAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA0B9C,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,9 +1,9 @@
1
- import { defineComponent as p, mergeModels as f, createPropsRestProxy as v, useId as h, useModel as y, useTemplateRef as w, ref as k, onMounted as x, createElementBlock as u, openBlock as m, normalizeProps as g, guardReactiveProps as B, unref as a, createVNode as M, createCommentVNode as P, mergeProps as V, normalizeClass as b, renderSlot as C, createTextVNode as S, toDisplayString as T } from "vue";
1
+ import { defineComponent as p, mergeModels as f, createPropsRestProxy as v, useId as h, useModel as y, useTemplateRef as w, ref as k, onMounted as g, createElementBlock as u, openBlock as c, normalizeProps as x, guardReactiveProps as B, unref as a, createVNode as M, createCommentVNode as P, mergeProps as V, normalizeClass as b, renderSlot as C, createTextVNode as S, toDisplayString as T } from "vue";
2
2
  import { useBindCx as R } from "@scalar/use-hooks/useBindCx";
3
- import { useResizeObserver as _ } from "@vueuse/core";
4
- import z from "./ScalarMarkdown.vue.js";
3
+ import { useResizeObserver as z } from "@vueuse/core";
4
+ import N from "./ScalarMarkdown.vue.js";
5
5
  /* empty css */
6
- const N = ["aria-controls", "aria-expanded"], E = /* @__PURE__ */ p({
6
+ const _ = ["aria-controls", "aria-expanded"], E = /* @__PURE__ */ p({
7
7
  inheritAttrs: !1,
8
8
  __name: "ScalarMarkdownSummary",
9
9
  props: /* @__PURE__ */ f({
@@ -13,44 +13,46 @@ const N = ["aria-controls", "aria-expanded"], E = /* @__PURE__ */ p({
13
13
  transform: { type: Function },
14
14
  transformType: {},
15
15
  clamp: { default: 1 },
16
- anchorPrefix: {}
16
+ anchorPrefix: {},
17
+ controlled: { type: Boolean }
17
18
  }, {
18
19
  modelValue: { type: Boolean, default: !1 },
19
20
  modelModifiers: {}
20
21
  }),
21
22
  emits: ["update:modelValue"],
22
23
  setup(r) {
23
- const c = v(r, ["clamp"]), t = h(), e = y(r, "modelValue"), l = w("scalar-markdown"), n = k(!1);
24
- _(() => l.value?.el, s);
24
+ const m = v(r, ["clamp"]), l = h(), e = y(r, "modelValue"), t = w("scalar-markdown"), n = k(!1);
25
+ z(() => t.value?.el, s);
25
26
  function s() {
26
- const o = l.value?.el;
27
+ const o = t.value?.el;
27
28
  o && (n.value = o.scrollHeight > o.clientHeight || o.scrollWidth > o.clientWidth);
28
29
  }
29
- x(s);
30
+ g(s);
30
31
  const { cx: d } = R();
31
- return (o, i) => (m(), u("div", g(B(
32
+ return (o, i) => (c(), u("div", x(B(
32
33
  a(d)(
33
34
  "group/summary flex gap-0.5",
34
35
  e.value ? "flex-col" : "flex-row items-baseline"
35
36
  )
36
37
  )), [
37
- M(z, V({ ref: "scalar-markdown" }, c, {
38
- id: a(t),
39
- class: { "markdown-summary truncate": !e.value },
40
- clamp: e.value ? void 0 : o.clamp
41
- }), null, 16, ["id", "class", "clamp"]),
42
- n.value || e.value ? (m(), u("button", {
38
+ M(N, V(m, {
39
+ id: a(l),
40
+ ref: "scalar-markdown",
41
+ clamp: e.value ? void 0 : o.clamp,
42
+ class: { "markdown-summary truncate": !e.value }
43
+ }), null, 16, ["id", "clamp", "class"]),
44
+ !o.controlled && (n.value || e.value) ? (c(), u("button", {
43
45
  key: 0,
46
+ "aria-controls": a(l),
47
+ "aria-expanded": e.value,
44
48
  class: b(["whitespace-nowrap font-medium hover:underline", { "self-end": e.value }]),
45
49
  type: "button",
46
- "aria-controls": a(t),
47
- "aria-expanded": e.value,
48
50
  onClick: i[0] || (i[0] = ($) => e.value = !e.value)
49
51
  }, [
50
52
  C(o.$slots, "button", { open: e.value }, () => [
51
53
  S(T(e.value ? " Show Less" : "More"), 1)
52
54
  ])
53
- ], 10, N)) : P("", !0)
55
+ ], 10, _)) : P("", !0)
54
56
  ], 16));
55
57
  }
56
58
  });
@@ -36,4 +36,14 @@ export type ScalarMarkdownProps = {
36
36
  */
37
37
  anchorPrefix?: string;
38
38
  };
39
+ export type ScalarMarkdownSummaryProps = ScalarMarkdownProps & {
40
+ /**
41
+ * Allows the summary's open and closed state to
42
+ * be controlled by the parent component and hides
43
+ * the "More" and "Less" buttons.
44
+ *
45
+ * @default false
46
+ */
47
+ controlled?: boolean;
48
+ };
39
49
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9D;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9D;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAAG;IAC7D;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Scalar Theme Swatches component
3
+ *
4
+ * Displays the light and dark mode swatches for a given theme CSS string
5
+ *
6
+ * @example
7
+ * <ScalarThemeSwatches :css="theme" />
8
+ */
9
+ declare const _default: import("vue").DefineComponent<{
10
+ css: string;
11
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
12
+ css: string;
13
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
15
+ //# sourceMappingURL=ScalarThemeSwatches.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarThemeSwatches.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarThemeSwatches/ScalarThemeSwatches.vue"],"names":[],"mappings":"AAmDA;;;;;;;GAOG;;SAGI,MAAM;;SAAN,MAAM;;AAFb,wBAsEC"}
@@ -0,0 +1,35 @@
1
+ import { defineComponent as o, createElementBlock as a, openBlock as s, mergeProps as c, unref as e, Fragment as g, renderList as d, normalizeStyle as i } from "vue";
2
+ import { useBindCx as m } from "@scalar/use-hooks/useBindCx";
3
+ import { useThemeSwatches as u, THEME_CSS_VARS as b } from "./useThemeSwatches.js";
4
+ const h = {}, x = /* @__PURE__ */ o({
5
+ ...h,
6
+ inheritAttrs: !1,
7
+ __name: "ScalarThemeSwatches",
8
+ props: {
9
+ css: {}
10
+ },
11
+ setup(l) {
12
+ const { colors: r } = u(() => l.css), { cx: n } = m();
13
+ return (k, _) => (s(), a("div", c(
14
+ {
15
+ style: {
16
+ "--bg-light": e(r).light["--scalar-background-1"],
17
+ "--bg-dark": e(r).dark["--scalar-background-1"]
18
+ }
19
+ },
20
+ e(n)(
21
+ "flex *:size-3 overflow-hidden rounded",
22
+ "bg-(--bg-light) dark:bg-(--bg-dark)"
23
+ )
24
+ ), [
25
+ (s(!0), a(g, null, d(e(b), (t) => (s(), a("div", {
26
+ key: t,
27
+ class: "bg-(--bg-light) dark:bg-(--bg-dark)",
28
+ style: i({ "--bg-light": e(r).light[t], "--bg-dark": e(r).dark[t] })
29
+ }, null, 4))), 128))
30
+ ], 16));
31
+ }
32
+ });
33
+ export {
34
+ x as default
35
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarThemeSwatches.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,3 @@
1
+ export { default as ScalarThemeSwatches } from './ScalarThemeSwatches.vue.js';
2
+ export { useThemeSwatches } from './useThemeSwatches.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarThemeSwatches/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ /** Numbers 1 to 3 */
3
+ type OneToThree = 1 | 2 | 3;
4
+ /**
5
+ * CSS variable names that can be extracted from theme CSS
6
+ */
7
+ type ThemeCssVar = `--scalar-color-${OneToThree}` | `--scalar-background-${OneToThree}` | '--scalar-color-accent';
8
+ /**
9
+ * Theme colors for light and dark modes
10
+ */
11
+ type ThemeColors = {
12
+ light: ThemeCssVars;
13
+ dark: ThemeCssVars;
14
+ };
15
+ /**
16
+ * Record of theme CSS variables to their values (partial)
17
+ */
18
+ type ThemeCssVars = Partial<Record<ThemeCssVar, string>>;
19
+ /** Theme CSS variables */
20
+ export declare const THEME_CSS_VARS: ["--scalar-color-1", "--scalar-color-2", "--scalar-color-3", "--scalar-background-1", "--scalar-background-2", "--scalar-background-3", "--scalar-color-accent"];
21
+ /**
22
+ * Returns the light and dark colors for a given css string
23
+ */
24
+ export declare function useThemeSwatches(css: MaybeRefOrGetter<string>): {
25
+ colors: import("vue").ComputedRef<ThemeColors>;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=useThemeSwatches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeSwatches.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarThemeSwatches/useThemeSwatches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,KAAK,CAAA;AAE9D,qBAAqB;AACrB,KAAK,UAAU,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE3B;;GAEG;AACH,KAAK,WAAW,GAAG,kBAAkB,UAAU,EAAE,GAAG,uBAAuB,UAAU,EAAE,GAAG,uBAAuB,CAAA;AAEjH;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,YAAY,CAAA;IACnB,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAA;AAExD,0BAA0B;AAC1B,eAAO,MAAM,cAAc,kKAQO,CAAA;AA2BlC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC;;EAO7D"}
@@ -0,0 +1,33 @@
1
+ import { computed as n, toValue as t } from "vue";
2
+ const m = [
3
+ "--scalar-color-1",
4
+ "--scalar-color-2",
5
+ "--scalar-color-3",
6
+ "--scalar-background-1",
7
+ "--scalar-background-2",
8
+ "--scalar-background-3",
9
+ "--scalar-color-accent"
10
+ ];
11
+ function a(r, l) {
12
+ const c = [...l.matchAll(new RegExp(`(${r}): ([^;]+);`, "gm"))];
13
+ return c.length === 0 ? {} : Object.fromEntries(c.map((o) => [o[1], o[2]]));
14
+ }
15
+ function e(r) {
16
+ return r ? {
17
+ ...a("--scalar-color-[1-3]", r),
18
+ ...a("--scalar-background-[1-3]", r),
19
+ ...a("--scalar-color-accent", r)
20
+ } : {};
21
+ }
22
+ function s(r) {
23
+ return {
24
+ colors: n(() => ({
25
+ light: e(t(r).match(/\.light-mode[^{]*{[^}]*}/m)?.[0]),
26
+ dark: e(t(r).match(/\.dark-mode[^{]*{[^}]*}/m)?.[0])
27
+ }))
28
+ };
29
+ }
30
+ export {
31
+ m as THEME_CSS_VARS,
32
+ s as useThemeSwatches
33
+ };
@@ -0,0 +1,14 @@
1
+ import type { ScalarWrappingTextProps } from './types';
2
+ /**
3
+ * Scalar Text Wrapping component
4
+ *
5
+ * Adds word breaks to the text to allow improved line wrapping
6
+ *
7
+ * Does not inherit any attributes because it returns a set of html nodes
8
+ *
9
+ * @example
10
+ * <ScalarWrappingText text="/this/is/a/long/path/that/needs/to/be/wrapped" />
11
+ */
12
+ declare const _default: import("vue").DefineComponent<ScalarWrappingTextProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScalarWrappingTextProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
14
+ //# sourceMappingURL=ScalarWrappingText.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarWrappingText.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarWrappingText/ScalarWrappingText.vue"],"names":[],"mappings":"AAuDA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGtD;;;;;;;;;GASG;;AACH,wBAmEC"}
@@ -0,0 +1,25 @@
1
+ import { defineComponent as u, computed as c, createElementBlock as n, openBlock as a, Fragment as l, renderList as m, createElementVNode as d, createTextVNode as i, toDisplayString as f } from "vue";
2
+ import { PRESETS as x } from "./constants.js";
3
+ const g = {}, w = /* @__PURE__ */ u({
4
+ ...g,
5
+ inheritAttrs: !1,
6
+ __name: "ScalarWrappingText",
7
+ props: {
8
+ text: { default: "" },
9
+ preset: { default: "path" },
10
+ regex: {}
11
+ },
12
+ setup(e) {
13
+ const o = c(() => {
14
+ const r = new RegExp(e.regex ?? x[e.preset], "g");
15
+ return e.text.replace(r, "⁠$&").split("⁠").filter(Boolean);
16
+ });
17
+ return (r, t) => (a(!0), n(l, null, m(o.value, (s, p) => (a(), n(l, { key: p }, [
18
+ t[0] || (t[0] = d("wbr", null, null, -1)),
19
+ i(f(s), 1)
20
+ ], 64))), 128));
21
+ }
22
+ });
23
+ export {
24
+ w as default
25
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarWrappingText.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A list of preset regexes for word breaks
3
+ */
4
+ export declare const PRESETS: {
5
+ /** Breaks on `/`, '.' and `-` for urls or file paths */
6
+ readonly path: RegExp;
7
+ /**
8
+ * Breaks on capitals, `_` and `.` for properties written in
9
+ * camel, pascal or snake case
10
+ */
11
+ readonly property: RegExp;
12
+ };
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarWrappingText/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB,wDAAwD;;IAExD;;;OAGG;;CAEsC,CAAA"}
@@ -0,0 +1,12 @@
1
+ const p = {
2
+ /** Breaks on `/`, '.' and `-` for urls or file paths */
3
+ path: /[\/\.-]/,
4
+ /**
5
+ * Breaks on capitals, `_` and `.` for properties written in
6
+ * camel, pascal or snake case
7
+ */
8
+ property: /[A-Z\_\.-]/
9
+ };
10
+ export {
11
+ p as PRESETS
12
+ };
@@ -0,0 +1,2 @@
1
+ export { default as ScalarWrappingText } from './ScalarWrappingText.vue.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarWrappingText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { PRESETS } from './constants.js';
2
+ type Preset = keyof typeof PRESETS;
3
+ /** Props for the ScalarWrappingText component */
4
+ export type ScalarWrappingTextProps = {
5
+ /** The text to wrap */
6
+ text?: string;
7
+ /**
8
+ * Presets for word wrapping
9
+ *
10
+ * @see {@link PRESETS}
11
+ * @default 'path'
12
+ */
13
+ preset?: Preset;
14
+ /** Explicit regex to allow wrapping on, overrides any `preset` */
15
+ regex?: RegExp;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarWrappingText/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,KAAK,MAAM,GAAG,MAAM,OAAO,OAAO,CAAA;AAElC,iDAAiD;AACjD,MAAM,MAAM,uBAAuB,GAAG;IACpC,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
package/dist/index.d.ts CHANGED
@@ -28,8 +28,10 @@ export * from './components/ScalarSidebar';
28
28
  export * from './components/ScalarTeleport';
29
29
  export * from './components/ScalarTextArea';
30
30
  export * from './components/ScalarTextInput';
31
+ export * from './components/ScalarThemeSwatches';
31
32
  export * from './components/ScalarToggle';
32
33
  export * from './components/ScalarTooltip';
33
34
  export * from './components/ScalarVirtualText';
35
+ export * from './components/ScalarWrappingText';
34
36
  export * from './helpers';
35
37
  //# sourceMappingURL=index.d.ts.map
@@ -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,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,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,WAAW,CAAA"}
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,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,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,WAAW,CAAA"}