@scalar/components 0.34.1 → 0.35.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 (43) hide show
  1. package/dist/components/ScalarCard/ScalarCard.vue.d.ts.map +1 -1
  2. package/dist/components/ScalarCard/ScalarCard.vue.js +1 -0
  3. package/dist/components/ScalarCard/ScalarCard.vue.js.map +1 -1
  4. package/dist/components/ScalarCard/ScalarCard.vue_vue_type_script_setup_true_lang.js +1 -1
  5. package/dist/components/ScalarCard/ScalarCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/ScalarCard/ScalarCardSection.vue.d.ts.map +1 -1
  7. package/dist/components/ScalarCard/ScalarCardSection.vue.js +1 -0
  8. package/dist/components/ScalarCard/ScalarCardSection.vue.js.map +1 -1
  9. package/dist/components/ScalarCard/ScalarCardSection.vue_vue_type_script_setup_true_lang.js +1 -1
  10. package/dist/components/ScalarCard/ScalarCardSection.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.d.ts.map +1 -1
  12. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue.js.map +1 -1
  13. package/dist/components/ScalarCodeBlock/ScalarCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts +2 -2
  15. package/dist/components/ScalarTeleport/ScalarTeleport.vue.d.ts +1 -1
  16. package/dist/components/ScalarTeleport/ScalarTeleport.vue.d.ts.map +1 -1
  17. package/dist/components/ScalarTeleport/ScalarTeleport.vue.js.map +1 -1
  18. package/dist/components/ScalarTeleport/ScalarTeleport.vue_vue_type_script_setup_true_lang.js +31 -2
  19. package/dist/components/ScalarTeleport/ScalarTeleport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  20. package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts +13 -0
  21. package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts.map +1 -1
  22. package/dist/components/ScalarToggle/ScalarToggle.vue.js.map +1 -1
  23. package/dist/components/ScalarToggle/ScalarToggle.vue_vue_type_script_setup_true_lang.js +4 -1
  24. package/dist/components/ScalarToggle/ScalarToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/ScalarToggle/ScalarToggleSlider.vue.d.ts +3 -0
  26. package/dist/components/ScalarToggle/ScalarToggleSlider.vue.d.ts.map +1 -1
  27. package/dist/components/ScalarToggle/ScalarToggleSlider.vue.js.map +1 -1
  28. package/dist/components/ScalarToggle/ScalarToggleSlider.vue_vue_type_script_setup_true_lang.js +56 -6
  29. package/dist/components/ScalarToggle/ScalarToggleSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/ScalarToggle/ScalarTristateToggle.vue.d.ts +13 -0
  31. package/dist/components/ScalarToggle/ScalarTristateToggle.vue.d.ts.map +1 -1
  32. package/dist/components/ScalarToggle/ScalarTristateToggle.vue.js.map +1 -1
  33. package/dist/components/ScalarToggle/ScalarTristateToggle.vue_vue_type_script_setup_true_lang.js +6 -3
  34. package/dist/components/ScalarToggle/ScalarTristateToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/dist/components/ScalarToggle/index.d.ts +1 -1
  36. package/dist/components/ScalarToggle/index.d.ts.map +1 -1
  37. package/dist/components/ScalarToggle/types.d.ts +7 -0
  38. package/dist/components/ScalarToggle/types.d.ts.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/style.css +92 -4
  42. package/dist/vue-styles.css +70 -0
  43. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"names":[],"mappings":"AAkEA;;;;;;;;;;;;;GAaG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB,yCAAyC;YACjC,MAAM;;IADd,yCAAyC;YACjC,MAAM;;cAsDF,CAAC,KAAK,IAAgB,KAAK,GAAG;EASxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"names":[],"mappings":"AA8GA;;;;;;;;;;;;;GAaG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB,yCAAyC;YACjC,MAAM;;IADd,yCAAyC;YACjC,MAAM;;cAsDF,CAAC,KAAK,IAAgB,KAAK,GAAG;EASxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import ScalarCard_vue_vue_type_script_setup_true_lang_default from "./ScalarCard.vue_vue_type_script_setup_true_lang.js";
2
+ /* empty css */
2
3
  //#region src/components/ScalarCard/ScalarCard.vue
3
4
  var ScalarCard_default = ScalarCard_vue_vue_type_script_setup_true_lang_default;
4
5
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCard.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card component\n *\n * Creates an aria region using the nearest ScalarCardHeader as the label\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/region_role\n *\n * @example\n * <ScalarCard>\n * <ScalarCardHeader>Header</ScalarCardHeader>\n * <ScalarCardSection>Content</ScalarCardSection>\n * <ScalarCardFooter>Footer</ScalarCardFooter>\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed } from 'vue'\n\nimport { useCardRegion } from './useCardHeading'\n\nconst { label } = defineProps<{\n /** The a11y label for the card region */\n label?: string\n}>()\n\n// Get the id for the nearest ScalarCardHeader if it exists\nconst { id } = useCardRegion()\n\nconst labelAttrs = computed(() => {\n if (label) {\n // If a label is provided, use it\n return { 'aria-label': label }\n }\n if (id.value) {\n // If no label is provided, use the heading id\n return { 'aria-labelledby': id.value }\n }\n // If no label or heading id is provided, don't add any aria attributes\n return {}\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n role=\"group\"\n v-bind=\"{\n ...labelAttrs,\n ...cx('scalar-card bg-b-2 flex flex-col divide-y rounded-xl border'),\n }\">\n <slot />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarCard.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card component\n *\n * Creates an aria region using the nearest ScalarCardHeader as the label\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/region_role\n *\n * @example\n * <ScalarCard>\n * <ScalarCardHeader>Header</ScalarCardHeader>\n * <ScalarCardSection>Content</ScalarCardSection>\n * <ScalarCardFooter>Footer</ScalarCardFooter>\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed } from 'vue'\n\nimport { useCardRegion } from './useCardHeading'\n\nconst { label } = defineProps<{\n /** The a11y label for the card region */\n label?: string\n}>()\n\n// Get the id for the nearest ScalarCardHeader if it exists\nconst { id } = useCardRegion()\n\nconst labelAttrs = computed(() => {\n if (label) {\n // If a label is provided, use it\n return { 'aria-label': label }\n }\n if (id.value) {\n // If no label is provided, use the heading id\n return { 'aria-labelledby': id.value }\n }\n // If no label or heading id is provided, don't add any aria attributes\n return {}\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n role=\"group\"\n v-bind=\"{\n ...labelAttrs,\n ...cx('scalar-card bg-b-2 flex flex-col rounded-2xl p-1'),\n }\">\n <slot />\n </div>\n</template>\n<style>\n/**\n * A card is a backdrop with its sections lifted off it as surfaces.\n *\n * The surface color is worked out from the backdrop instead of being read from another theme\n * token, so it stays one step lighter than the card whatever a theme does to the card's colors.\n * That lands on white over the default light backdrop and next to --scalar-background-3 over the\n * default dark one, and it keeps working for a theme that paints its cards dark in light mode,\n * where a token picked by color mode would be the wrong way round.\n *\n * A control that sits on a surface, such as a copy button, is one step further again. That step\n * goes toward the text color, so it is lighter than a dark surface and darker than a light one,\n * and never sinks back to the color of the card behind the surface.\n *\n * The variables are resolved here, on the card, so a section that swaps --scalar-background-2 for\n * its own purposes does not move the surface under the code inside it, and so a theme can set\n * --scalar-card-surface, --scalar-card-surface-raised or --scalar-card-surface-shadow on\n * `.scalar-card` without restating a section selector.\n *\n * Every rule below is a single class, so any theme or `customCss` rule that names the same\n * element still wins.\n */\n.scalar-card {\n /* Browsers without relative colors get the light arrangement in both color modes. */\n --scalar-card-surface: var(--scalar-background-1);\n --scalar-card-surface-raised: var(--scalar-background-2);\n /* The theme's own soft shadow and border color, so a theme steers the outline of a surface */\n --scalar-card-surface-shadow:\n var(--scalar-shadow-1),\n 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n@supports (color: oklch(from white l c h)) {\n .scalar-card {\n --scalar-card-surface: oklch(\n from var(--scalar-background-2) calc(l + 0.055) c h\n );\n --scalar-card-surface-raised: color-mix(\n in oklab,\n var(--scalar-card-surface),\n var(--scalar-color-1) 8%\n );\n }\n}\n</style>\n"],"mappings":""}
@@ -16,7 +16,7 @@ var ScalarCard_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
16
16
  return (_ctx, _cache) => {
17
17
  return openBlock(), createElementBlock("div", mergeProps({ role: "group" }, {
18
18
  ...labelAttrs.value,
19
- ...unref(cx)("scalar-card bg-b-2 flex flex-col divide-y rounded-xl border")
19
+ ...unref(cx)("scalar-card bg-b-2 flex flex-col rounded-2xl p-1")
20
20
  }), [renderSlot(_ctx.$slots, "default")], 16);
21
21
  };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCard.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot"],"sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card component\n *\n * Creates an aria region using the nearest ScalarCardHeader as the label\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/region_role\n *\n * @example\n * <ScalarCard>\n * <ScalarCardHeader>Header</ScalarCardHeader>\n * <ScalarCardSection>Content</ScalarCardSection>\n * <ScalarCardFooter>Footer</ScalarCardFooter>\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed } from 'vue'\n\nimport { useCardRegion } from './useCardHeading'\n\nconst { label } = defineProps<{\n /** The a11y label for the card region */\n label?: string\n}>()\n\n// Get the id for the nearest ScalarCardHeader if it exists\nconst { id } = useCardRegion()\n\nconst labelAttrs = computed(() => {\n if (label) {\n // If a label is provided, use it\n return { 'aria-label': label }\n }\n if (id.value) {\n // If no label is provided, use the heading id\n return { 'aria-labelledby': id.value }\n }\n // If no label or heading id is provided, don't add any aria attributes\n return {}\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n role=\"group\"\n v-bind=\"{\n ...labelAttrs,\n ...cx('scalar-card bg-b-2 flex flex-col divide-y rounded-xl border'),\n }\">\n <slot />\n </div>\n</template>\n"],"mappings":";;;;;;;;EA6BA,MAAM,EAAE,OAAO,cAAc;EAE7B,MAAM,aAAa,eAAe;GAChC,IAAI,QAAA,OAEF,OAAO,EAAE,cAAc,QAAA,MAAM;GAE/B,IAAI,GAAG,OAEL,OAAO,EAAE,mBAAmB,GAAG,MAAM;GAGvC,OAAO,CAAC;EACV,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAOM,OAPNC,WAOM,EANJ,MAAK,QAAO,GAAA;IACO,GAAA,WAAA;IAAqB,GAAAC,MAAA,EAAA,CAAE,CAAA,6DAAA;G,KAI1CC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarCard.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot"],"sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card component\n *\n * Creates an aria region using the nearest ScalarCardHeader as the label\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/region_role\n *\n * @example\n * <ScalarCard>\n * <ScalarCardHeader>Header</ScalarCardHeader>\n * <ScalarCardSection>Content</ScalarCardSection>\n * <ScalarCardFooter>Footer</ScalarCardFooter>\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed } from 'vue'\n\nimport { useCardRegion } from './useCardHeading'\n\nconst { label } = defineProps<{\n /** The a11y label for the card region */\n label?: string\n}>()\n\n// Get the id for the nearest ScalarCardHeader if it exists\nconst { id } = useCardRegion()\n\nconst labelAttrs = computed(() => {\n if (label) {\n // If a label is provided, use it\n return { 'aria-label': label }\n }\n if (id.value) {\n // If no label is provided, use the heading id\n return { 'aria-labelledby': id.value }\n }\n // If no label or heading id is provided, don't add any aria attributes\n return {}\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n role=\"group\"\n v-bind=\"{\n ...labelAttrs,\n ...cx('scalar-card bg-b-2 flex flex-col rounded-2xl p-1'),\n }\">\n <slot />\n </div>\n</template>\n<style>\n/**\n * A card is a backdrop with its sections lifted off it as surfaces.\n *\n * The surface color is worked out from the backdrop instead of being read from another theme\n * token, so it stays one step lighter than the card whatever a theme does to the card's colors.\n * That lands on white over the default light backdrop and next to --scalar-background-3 over the\n * default dark one, and it keeps working for a theme that paints its cards dark in light mode,\n * where a token picked by color mode would be the wrong way round.\n *\n * A control that sits on a surface, such as a copy button, is one step further again. That step\n * goes toward the text color, so it is lighter than a dark surface and darker than a light one,\n * and never sinks back to the color of the card behind the surface.\n *\n * The variables are resolved here, on the card, so a section that swaps --scalar-background-2 for\n * its own purposes does not move the surface under the code inside it, and so a theme can set\n * --scalar-card-surface, --scalar-card-surface-raised or --scalar-card-surface-shadow on\n * `.scalar-card` without restating a section selector.\n *\n * Every rule below is a single class, so any theme or `customCss` rule that names the same\n * element still wins.\n */\n.scalar-card {\n /* Browsers without relative colors get the light arrangement in both color modes. */\n --scalar-card-surface: var(--scalar-background-1);\n --scalar-card-surface-raised: var(--scalar-background-2);\n /* The theme's own soft shadow and border color, so a theme steers the outline of a surface */\n --scalar-card-surface-shadow:\n var(--scalar-shadow-1),\n 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n@supports (color: oklch(from white l c h)) {\n .scalar-card {\n --scalar-card-surface: oklch(\n from var(--scalar-background-2) calc(l + 0.055) c h\n );\n --scalar-card-surface-raised: color-mix(\n in oklab,\n var(--scalar-card-surface),\n var(--scalar-color-1) 8%\n );\n }\n}\n</style>\n"],"mappings":";;;;;;;;EA6BA,MAAM,EAAE,OAAO,cAAc;EAE7B,MAAM,aAAa,eAAe;GAChC,IAAI,QAAA,OAEF,OAAO,EAAE,cAAc,QAAA,MAAM;GAE/B,IAAI,GAAG,OAEL,OAAO,EAAE,mBAAmB,GAAG,MAAM;GAGvC,OAAO,CAAC;EACV,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAOM,OAPNC,WAOM,EANJ,MAAK,QAAO,GAAA;IACO,GAAA,WAAA;IAAqB,GAAAC,MAAA,EAAA,CAAE,CAAA,kDAAA;G,KAI1CC,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCardSection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"names":[],"mappings":"AAqCA;;;;;;;;;;;GAWG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;cA8BJ,CAAC,KAAK,IAAgB,KAAK,GAAG;EAQxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarCardSection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"names":[],"mappings":"AAsDA;;;;;;;;;;;GAWG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;cA0BJ,CAAC,KAAK,IAAgB,KAAK,GAAG;EAQxC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import ScalarCardSection_vue_vue_type_script_setup_true_lang_default from "./ScalarCardSection.vue_vue_type_script_setup_true_lang.js";
2
+ /* empty css */
2
3
  //#region src/components/ScalarCard/ScalarCardSection.vue
3
4
  var ScalarCardSection_default = ScalarCardSection_vue_vue_type_script_setup_true_lang_default;
4
5
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCardSection.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card section component\n *\n * A generic section of a ScalarCard component, provides the base for ScalarCardHeader and ScalarCardFooter\n *\n * @example\n * <ScalarCard>\n * ...\n * <ScalarCardSection>Content</ScalarCardSection>\n * ...\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-card-content flex overflow-auto first:rounded-t-[inherit] last:rounded-b-[inherit]',\n )\n \">\n <slot />\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarCardSection.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card section component\n *\n * A generic section of a ScalarCard component, provides the base for ScalarCardHeader and ScalarCardFooter\n *\n * @example\n * <ScalarCard>\n * ...\n * <ScalarCardSection>Content</ScalarCardSection>\n * ...\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div v-bind=\"cx('scalar-card-content flex overflow-auto')\">\n <slot />\n </div>\n</template>\n<style>\n/**\n * A plain section is a surface lifted off the card. The header and footer are sections too, but\n * they sit on the card itself, so they are left out here with `:where()` to keep every selector at\n * a single class: a theme or `customCss` rule on `.scalar-card-content` still wins.\n */\n.scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {\n background: var(--scalar-card-surface);\n /* The card's corner less its padding, so the two curves stay concentric. */\n border-radius: var(--scalar-radius-xl);\n box-shadow: var(--scalar-card-surface-shadow);\n}\n/* Two surfaces in a row keep the card's padding between them. */\n:where(.scalar-card-content:not(.scalar-card-header, .scalar-card-footer))\n + .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {\n margin-top: 4px;\n}\n/* A theme that paints the header or footer gets corners that follow the surface between them. */\n:where(.scalar-card-header, .scalar-card-footer) {\n border-radius: var(--scalar-radius-xl);\n}\n</style>\n"],"mappings":""}
@@ -6,7 +6,7 @@ var ScalarCardSection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
6
6
  setup(__props) {
7
7
  const { cx } = useBindCx();
8
8
  return (_ctx, _cache) => {
9
- return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(cx)("scalar-card-content flex overflow-auto first:rounded-t-[inherit] last:rounded-b-[inherit]"))), [renderSlot(_ctx.$slots, "default")], 16);
9
+ return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(cx)("scalar-card-content flex overflow-auto"))), [renderSlot(_ctx.$slots, "default")], 16);
10
10
  };
11
11
  }
12
12
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCardSection.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_renderSlot"],"sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card section component\n *\n * A generic section of a ScalarCard component, provides the base for ScalarCardHeader and ScalarCardFooter\n *\n * @example\n * <ScalarCard>\n * ...\n * <ScalarCardSection>Content</ScalarCardSection>\n * ...\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-card-content flex overflow-auto first:rounded-t-[inherit] last:rounded-b-[inherit]',\n )\n \">\n <slot />\n </div>\n</template>\n"],"mappings":";;;;;;EAmBA,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAOM,OAAAC,eAAAC,mBANWC,MAAA,EAAA,CAAE,C,iGAKjBC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarCardSection.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_renderSlot"],"sources":["../../../src/components/ScalarCard/ScalarCardSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar card section component\n *\n * A generic section of a ScalarCard component, provides the base for ScalarCardHeader and ScalarCardFooter\n *\n * @example\n * <ScalarCard>\n * ...\n * <ScalarCardSection>Content</ScalarCardSection>\n * ...\n * </ScalarCard>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div v-bind=\"cx('scalar-card-content flex overflow-auto')\">\n <slot />\n </div>\n</template>\n<style>\n/**\n * A plain section is a surface lifted off the card. The header and footer are sections too, but\n * they sit on the card itself, so they are left out here with `:where()` to keep every selector at\n * a single class: a theme or `customCss` rule on `.scalar-card-content` still wins.\n */\n.scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {\n background: var(--scalar-card-surface);\n /* The card's corner less its padding, so the two curves stay concentric. */\n border-radius: var(--scalar-radius-xl);\n box-shadow: var(--scalar-card-surface-shadow);\n}\n/* Two surfaces in a row keep the card's padding between them. */\n:where(.scalar-card-content:not(.scalar-card-header, .scalar-card-footer))\n + .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {\n margin-top: 4px;\n}\n/* A theme that paints the header or footer gets corners that follow the surface between them. */\n:where(.scalar-card-header, .scalar-card-footer) {\n border-radius: var(--scalar-radius-xl);\n}\n</style>\n"],"mappings":";;;;;;EAmBA,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAEM,OAAAC,eAAAC,mBAFOC,MAAA,EAAA,CAAE,CAAA,wCAAA,CAAA,CAAA,GAAA,CACbC,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AAiOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAsBlD;;;;;;;;;GASG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;cAEN,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAWV,+CAA+C;aACtC,MAAM,GAAG,MAAM;;cA9BtB,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAeV;;;;OAIG;0BACmB,MAAM;;cAtC1B,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAWV,+CAA+C;aACtC,MAAM,GAAG,MAAM;;cA9BtB,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAeV;;;;OAIG;0BACmB,MAAM;kGAkMlC,CAAC"}
1
+ {"version":3,"file":"ScalarCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"names":[],"mappings":"AAgPA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAsBlD;;;;;;;;;GASG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;cAEN,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAWV,+CAA+C;aACtC,MAAM,GAAG,MAAM;;cA9BtB,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAeV;;;;OAIG;0BACmB,MAAM;;cAtC1B,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAWV,+CAA+C;aACtC,MAAM,GAAG,MAAM;;cA9BtB,MAAM,GAAG,MAAM;2BACF,MAAM;WACtB,mBAAmB,GAAG,MAAM;kBACrB,OAAO;sBACH,MAAM,GAAG,MAAM,EAAE;WAC5B,QAAQ,GAAG,OAAO,GAAG,KAAK;IACjC,2EAA2E;kBAC7D,MAAM;IACpB;;;;OAIG;YACK,MAAM;IACd;;;OAGG;gBACS,MAAM;;IAeV;;;;OAIG;0BACmB,MAAM;kGAkMlC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCodeBlock.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { languages, registerLanguage } from '@scalar/highlight/all'\n\n/**\n * Registers every bundled grammar, once per module rather than once per block.\n *\n * `@scalar/highlight/all` already registers them when it is evaluated, so a\n * bare `import '@scalar/highlight/all'` reads like enough. It is not: that is a\n * side-effect-only import of an external package, and the library build drops\n * it from the emitted module. Storybook hid this because it compiles from\n * source, while the API reference consumes `dist` and lost highlighting\n * entirely — every block fell back to escaped, unscoped text.\n *\n * Registering from a named import keeps a binding the bundler can see used, so\n * the module survives. It lives in this block rather than in `<script setup>`\n * because setup runs for every instance, and a page of API reference renders\n * hundreds of code blocks.\n */\nregisterLanguage(...languages)\n\n/**\n * Scalar Code Block component\n *\n * Renders syntax-highlighted code using @scalar/highlight.\n * Supports line numbers, credential masking, and an optional copy button.\n * Set --scalar-code-line-height on the component or an ancestor to override its 1.4 line height.\n *\n * @example\n * <ScalarCodeBlock content=\"const x = 1\" lang=\"javascript\" />\n */\nexport default {}\n</script>\n<script lang=\"ts\" setup>\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { syntaxHighlight } from '@scalar/highlight/compat'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed, useId } from 'vue'\n\nimport ScalarCopyBackdrop from '@/components/ScalarCopy/ScalarCopyBackdrop.vue'\n\nimport { ScalarCodeBlockCopy } from '../ScalarCodeBlock'\nimport type { StandardLanguageKey } from './types'\n\ntype BaseProps = {\n content?: string | object\n prettyPrintedContent?: string\n lang?: StandardLanguageKey | string\n lineNumbers?: boolean\n hideCredentials?: string | string[]\n copy?: 'always' | 'hover' | false\n /** Original content to copy when the displayed content has been masked. */\n copyContent?: string\n /**\n * Accessible name for the code scroller. Long code scrolls inside a focusable region so\n * keyboard users can reach it, and a focusable region needs a name or screen readers announce\n * nothing when focus lands on it.\n */\n label?: string\n /**\n * Accessible name for the copy button. The visible label only reads \"Copy\" (and the language)\n * while the block is hovered, so the name has to say what is copied on its own.\n */\n copyLabel?: string\n}\n\n/**\n * Uses @scalar/highlight for syntax highlighting\n *\n * Requires at least one of content or prettyPrintedContent\n */\nconst {\n lang = 'plaintext',\n lineNumbers = false,\n copy = 'hover',\n label = 'Code sample',\n copyLabel,\n copyContent,\n content,\n prettyPrintedContent,\n hideCredentials,\n} = defineProps<\n BaseProps &\n (\n | {\n /** Raw unformatted object or string content */\n content: string | object\n }\n | {\n /**\n * Pre-pretty printed content string for better performance\n *\n * Avoids unnecessary costly re-serialization of large content\n */\n prettyPrintedContent: string\n }\n )\n>()\n\n/** Base id for the code block */\nconst id = useId()\n\n/** Formatted the content into an indented json string */\nconst prettyContent = computed(\n () => prettyPrintedContent || prettyPrintJson(content ?? ''),\n)\n\nconst highlightedCode = computed(() => {\n const html = syntaxHighlight(prettyContent.value, {\n lang: lang.trim(),\n lineNumbers: lineNumbers,\n maskCredentials: hideCredentials,\n })\n\n // Need to remove the wrapping <pre> element so we can use v-html without another wrapper\n return html.slice(5, -6)\n})\n\n/** Determine if the content is a single line */\nconst isOneLine = computed(() => !prettyContent.value.includes('\\n'))\n\nconst isContentValid = computed(() => {\n return (\n prettyContent.value !== null &&\n prettyContent.value !== 'null' &&\n prettyContent.value !== '404 Not Found'\n )\n})\n\n/** Whether the copy button is rendered on top of the code */\nconst showCopy = computed(() => copy && isContentValid.value)\n\n/**\n * A one-liner has the copy button floating over the end of the line, so the line needs room to\n * scroll clear of the button. The padding goes on the `w-fit` <pre> because browsers disagree about\n * whether trailing padding on an `overflow-x` container is scrollable.\n */\nconst reserveCopySpace = computed(() => isOneLine.value && showCopy.value)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-code-block group/code-block flex flex-col',\n 'relative bg-b-1 min-h-0 min-w-0 focus-visible:outline',\n )\n \">\n <!--\n Inherits the corners so the inset focus ring follows a rounded code block.\n Always a tab stop so code that scrolls stays reachable by keyboard (WCAG 2.1.1). A named\n group rather than a region, so every code sample does not add a landmark.\n -->\n <div\n :aria-label=\"label\"\n class=\"custom-scroll min-h-0 min-w-0 flex-1 overflow-x-auto rounded-[inherit] p-2 -outline-offset-2\"\n role=\"group\"\n tabindex=\"0\">\n <pre\n :id=\"id\"\n class=\"scalar-code-block-pre m-0 w-fit border-0 bg-transparent p-0 text-nowrap whitespace-pre\"\n :class=\"{ 'pr-6': reserveCopySpace }\"\n v-html=\"highlightedCode\" />\n </div>\n <ScalarCodeBlockCopy\n v-if=\"showCopy\"\n :aria-controls=\"id\"\n class=\"scalar-code-copy absolute\"\n :class=\"[\n isOneLine\n ? 'top-1/2 right-1 m-0 -translate-y-1/2'\n : 'top-2.5 right-2.5',\n { 'opacity-100': copy === 'always' },\n ]\"\n :content=\"copyContent ?? prettyContent\"\n :copyLabel=\"copyLabel\"\n :lang=\"lang\"\n :showLang=\"!isOneLine\">\n <template #backdrop>\n <ScalarCopyBackdrop\n class=\"scalar-code-copy-backdrop\"\n :class=\"[\n isOneLine\n ? 'group-hocus-within/code-block:-left-0.5 -inset-y-0.75 -right-1 left-3'\n : '-top-1 -right-1.5',\n ]\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n</template>\n<style>\n@reference '../../style.css';\n@import '@scalar/code-highlight/css/code.css';\n\n/** Match the pre line-box metrics to the code font so blank and highlighted lines have the same pitch. */\n.scalar-code-block-pre {\n font-family: var(--scalar-font-code);\n /* Disable ligatures so code characters remain distinct. */\n font-variant-ligatures: none;\n}\n\n/** Make the copy button label backdrop match the background */\n.scalar-code-block.bg-b-1 .scalar-code-copy-backdrop {\n @apply bg-b-1;\n}\n.scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {\n @apply bg-b-2;\n}\n/** Make the copy button one shade darker than the background */\n.scalar-code-block.bg-b-2 .scalar-code-copy {\n @apply bg-b-3;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarCodeBlock.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { languages, registerLanguage } from '@scalar/highlight/all'\n\n/**\n * Registers every bundled grammar, once per module rather than once per block.\n *\n * `@scalar/highlight/all` already registers them when it is evaluated, so a\n * bare `import '@scalar/highlight/all'` reads like enough. It is not: that is a\n * side-effect-only import of an external package, and the library build drops\n * it from the emitted module. Storybook hid this because it compiles from\n * source, while the API reference consumes `dist` and lost highlighting\n * entirely — every block fell back to escaped, unscoped text.\n *\n * Registering from a named import keeps a binding the bundler can see used, so\n * the module survives. It lives in this block rather than in `<script setup>`\n * because setup runs for every instance, and a page of API reference renders\n * hundreds of code blocks.\n */\nregisterLanguage(...languages)\n\n/**\n * Scalar Code Block component\n *\n * Renders syntax-highlighted code using @scalar/highlight.\n * Supports line numbers, credential masking, and an optional copy button.\n * Set --scalar-code-line-height on the component or an ancestor to override its 1.4 line height.\n *\n * @example\n * <ScalarCodeBlock content=\"const x = 1\" lang=\"javascript\" />\n */\nexport default {}\n</script>\n<script lang=\"ts\" setup>\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { syntaxHighlight } from '@scalar/highlight/compat'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed, useId } from 'vue'\n\nimport ScalarCopyBackdrop from '@/components/ScalarCopy/ScalarCopyBackdrop.vue'\n\nimport { ScalarCodeBlockCopy } from '../ScalarCodeBlock'\nimport type { StandardLanguageKey } from './types'\n\ntype BaseProps = {\n content?: string | object\n prettyPrintedContent?: string\n lang?: StandardLanguageKey | string\n lineNumbers?: boolean\n hideCredentials?: string | string[]\n copy?: 'always' | 'hover' | false\n /** Original content to copy when the displayed content has been masked. */\n copyContent?: string\n /**\n * Accessible name for the code scroller. Long code scrolls inside a focusable region so\n * keyboard users can reach it, and a focusable region needs a name or screen readers announce\n * nothing when focus lands on it.\n */\n label?: string\n /**\n * Accessible name for the copy button. The visible label only reads \"Copy\" (and the language)\n * while the block is hovered, so the name has to say what is copied on its own.\n */\n copyLabel?: string\n}\n\n/**\n * Uses @scalar/highlight for syntax highlighting\n *\n * Requires at least one of content or prettyPrintedContent\n */\nconst {\n lang = 'plaintext',\n lineNumbers = false,\n copy = 'hover',\n label = 'Code sample',\n copyLabel,\n copyContent,\n content,\n prettyPrintedContent,\n hideCredentials,\n} = defineProps<\n BaseProps &\n (\n | {\n /** Raw unformatted object or string content */\n content: string | object\n }\n | {\n /**\n * Pre-pretty printed content string for better performance\n *\n * Avoids unnecessary costly re-serialization of large content\n */\n prettyPrintedContent: string\n }\n )\n>()\n\n/** Base id for the code block */\nconst id = useId()\n\n/** Formatted the content into an indented json string */\nconst prettyContent = computed(\n () => prettyPrintedContent || prettyPrintJson(content ?? ''),\n)\n\nconst highlightedCode = computed(() => {\n const html = syntaxHighlight(prettyContent.value, {\n lang: lang.trim(),\n lineNumbers: lineNumbers,\n maskCredentials: hideCredentials,\n })\n\n // Need to remove the wrapping <pre> element so we can use v-html without another wrapper\n return html.slice(5, -6)\n})\n\n/** Determine if the content is a single line */\nconst isOneLine = computed(() => !prettyContent.value.includes('\\n'))\n\nconst isContentValid = computed(() => {\n return (\n prettyContent.value !== null &&\n prettyContent.value !== 'null' &&\n prettyContent.value !== '404 Not Found'\n )\n})\n\n/** Whether the copy button is rendered on top of the code */\nconst showCopy = computed(() => copy && isContentValid.value)\n\n/**\n * A one-liner has the copy button floating over the end of the line, so the line needs room to\n * scroll clear of the button. The padding goes on the `w-fit` <pre> because browsers disagree about\n * whether trailing padding on an `overflow-x` container is scrollable.\n */\nconst reserveCopySpace = computed(() => isOneLine.value && showCopy.value)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-code-block group/code-block flex flex-col',\n 'relative bg-b-1 min-h-0 min-w-0 focus-visible:outline',\n )\n \">\n <!--\n Inherits the corners so the inset focus ring follows a rounded code block.\n Always a tab stop so code that scrolls stays reachable by keyboard (WCAG 2.1.1). A named\n group rather than a region, so every code sample does not add a landmark.\n -->\n <div\n :aria-label=\"label\"\n class=\"custom-scroll min-h-0 min-w-0 flex-1 overflow-x-auto rounded-[inherit] p-2 -outline-offset-2\"\n role=\"group\"\n tabindex=\"0\">\n <pre\n :id=\"id\"\n class=\"scalar-code-block-pre m-0 w-fit border-0 bg-transparent p-0 text-nowrap whitespace-pre\"\n :class=\"{ 'pr-6': reserveCopySpace }\"\n v-html=\"highlightedCode\" />\n </div>\n <ScalarCodeBlockCopy\n v-if=\"showCopy\"\n :aria-controls=\"id\"\n class=\"scalar-code-copy absolute\"\n :class=\"[\n isOneLine\n ? 'top-1/2 right-1 m-0 -translate-y-1/2'\n : 'top-2.5 right-2.5',\n { 'opacity-100': copy === 'always' },\n ]\"\n :content=\"copyContent ?? prettyContent\"\n :copyLabel=\"copyLabel\"\n :lang=\"lang\"\n :showLang=\"!isOneLine\">\n <template #backdrop>\n <ScalarCopyBackdrop\n class=\"scalar-code-copy-backdrop\"\n :class=\"[\n isOneLine\n ? 'group-hocus-within/code-block:-left-0.5 -inset-y-0.75 -right-1 left-3'\n : '-top-1 -right-1.5',\n ]\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n</template>\n<style>\n@reference '../../style.css';\n@import '@scalar/code-highlight/css/code.css';\n\n/** Match the pre line-box metrics to the code font so blank and highlighted lines have the same pitch. */\n.scalar-code-block-pre {\n font-family: var(--scalar-font-code);\n /* Disable ligatures so code characters remain distinct. */\n font-variant-ligatures: none;\n}\n\n/** Make the copy button label backdrop match the background */\n.scalar-code-block.bg-b-1 .scalar-code-copy-backdrop {\n @apply bg-b-1;\n}\n.scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {\n @apply bg-b-2;\n}\n/**\n * A transparent block shows the surface of the card it sits in, so the label takes that color.\n * Outside a card there is nothing to match, and the label goes without a backdrop.\n */\n.scalar-code-block.bg-transparent .scalar-code-copy-backdrop {\n background: var(--scalar-card-surface, transparent);\n}\n/** Make the copy button one shade darker than the background */\n.scalar-code-block.bg-b-2 .scalar-code-copy {\n @apply bg-b-3;\n}\n/**\n * On a card's surface the button's own fill is the color of the card behind the surface, which\n * reads as a hole in a dark card. It takes the card's raised color instead, one step above the\n * surface. Outside a card the button keeps its own fill.\n */\n.scalar-code-block.bg-transparent .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n</style>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarCodeBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_createElementVNode","_normalizeClass","_createBlock","ScalarCodeBlockCopy","_withCtx","_createVNode","ScalarCopyBackdrop","_createCommentVNode"],"sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { languages, registerLanguage } from '@scalar/highlight/all'\n\n/**\n * Registers every bundled grammar, once per module rather than once per block.\n *\n * `@scalar/highlight/all` already registers them when it is evaluated, so a\n * bare `import '@scalar/highlight/all'` reads like enough. It is not: that is a\n * side-effect-only import of an external package, and the library build drops\n * it from the emitted module. Storybook hid this because it compiles from\n * source, while the API reference consumes `dist` and lost highlighting\n * entirely — every block fell back to escaped, unscoped text.\n *\n * Registering from a named import keeps a binding the bundler can see used, so\n * the module survives. It lives in this block rather than in `<script setup>`\n * because setup runs for every instance, and a page of API reference renders\n * hundreds of code blocks.\n */\nregisterLanguage(...languages)\n\n/**\n * Scalar Code Block component\n *\n * Renders syntax-highlighted code using @scalar/highlight.\n * Supports line numbers, credential masking, and an optional copy button.\n * Set --scalar-code-line-height on the component or an ancestor to override its 1.4 line height.\n *\n * @example\n * <ScalarCodeBlock content=\"const x = 1\" lang=\"javascript\" />\n */\nexport default {}\n</script>\n<script lang=\"ts\" setup>\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { syntaxHighlight } from '@scalar/highlight/compat'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed, useId } from 'vue'\n\nimport ScalarCopyBackdrop from '@/components/ScalarCopy/ScalarCopyBackdrop.vue'\n\nimport { ScalarCodeBlockCopy } from '../ScalarCodeBlock'\nimport type { StandardLanguageKey } from './types'\n\ntype BaseProps = {\n content?: string | object\n prettyPrintedContent?: string\n lang?: StandardLanguageKey | string\n lineNumbers?: boolean\n hideCredentials?: string | string[]\n copy?: 'always' | 'hover' | false\n /** Original content to copy when the displayed content has been masked. */\n copyContent?: string\n /**\n * Accessible name for the code scroller. Long code scrolls inside a focusable region so\n * keyboard users can reach it, and a focusable region needs a name or screen readers announce\n * nothing when focus lands on it.\n */\n label?: string\n /**\n * Accessible name for the copy button. The visible label only reads \"Copy\" (and the language)\n * while the block is hovered, so the name has to say what is copied on its own.\n */\n copyLabel?: string\n}\n\n/**\n * Uses @scalar/highlight for syntax highlighting\n *\n * Requires at least one of content or prettyPrintedContent\n */\nconst {\n lang = 'plaintext',\n lineNumbers = false,\n copy = 'hover',\n label = 'Code sample',\n copyLabel,\n copyContent,\n content,\n prettyPrintedContent,\n hideCredentials,\n} = defineProps<\n BaseProps &\n (\n | {\n /** Raw unformatted object or string content */\n content: string | object\n }\n | {\n /**\n * Pre-pretty printed content string for better performance\n *\n * Avoids unnecessary costly re-serialization of large content\n */\n prettyPrintedContent: string\n }\n )\n>()\n\n/** Base id for the code block */\nconst id = useId()\n\n/** Formatted the content into an indented json string */\nconst prettyContent = computed(\n () => prettyPrintedContent || prettyPrintJson(content ?? ''),\n)\n\nconst highlightedCode = computed(() => {\n const html = syntaxHighlight(prettyContent.value, {\n lang: lang.trim(),\n lineNumbers: lineNumbers,\n maskCredentials: hideCredentials,\n })\n\n // Need to remove the wrapping <pre> element so we can use v-html without another wrapper\n return html.slice(5, -6)\n})\n\n/** Determine if the content is a single line */\nconst isOneLine = computed(() => !prettyContent.value.includes('\\n'))\n\nconst isContentValid = computed(() => {\n return (\n prettyContent.value !== null &&\n prettyContent.value !== 'null' &&\n prettyContent.value !== '404 Not Found'\n )\n})\n\n/** Whether the copy button is rendered on top of the code */\nconst showCopy = computed(() => copy && isContentValid.value)\n\n/**\n * A one-liner has the copy button floating over the end of the line, so the line needs room to\n * scroll clear of the button. The padding goes on the `w-fit` <pre> because browsers disagree about\n * whether trailing padding on an `overflow-x` container is scrollable.\n */\nconst reserveCopySpace = computed(() => isOneLine.value && showCopy.value)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-code-block group/code-block flex flex-col',\n 'relative bg-b-1 min-h-0 min-w-0 focus-visible:outline',\n )\n \">\n <!--\n Inherits the corners so the inset focus ring follows a rounded code block.\n Always a tab stop so code that scrolls stays reachable by keyboard (WCAG 2.1.1). A named\n group rather than a region, so every code sample does not add a landmark.\n -->\n <div\n :aria-label=\"label\"\n class=\"custom-scroll min-h-0 min-w-0 flex-1 overflow-x-auto rounded-[inherit] p-2 -outline-offset-2\"\n role=\"group\"\n tabindex=\"0\">\n <pre\n :id=\"id\"\n class=\"scalar-code-block-pre m-0 w-fit border-0 bg-transparent p-0 text-nowrap whitespace-pre\"\n :class=\"{ 'pr-6': reserveCopySpace }\"\n v-html=\"highlightedCode\" />\n </div>\n <ScalarCodeBlockCopy\n v-if=\"showCopy\"\n :aria-controls=\"id\"\n class=\"scalar-code-copy absolute\"\n :class=\"[\n isOneLine\n ? 'top-1/2 right-1 m-0 -translate-y-1/2'\n : 'top-2.5 right-2.5',\n { 'opacity-100': copy === 'always' },\n ]\"\n :content=\"copyContent ?? prettyContent\"\n :copyLabel=\"copyLabel\"\n :lang=\"lang\"\n :showLang=\"!isOneLine\">\n <template #backdrop>\n <ScalarCopyBackdrop\n class=\"scalar-code-copy-backdrop\"\n :class=\"[\n isOneLine\n ? 'group-hocus-within/code-block:-left-0.5 -inset-y-0.75 -right-1 left-3'\n : '-top-1 -right-1.5',\n ]\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n</template>\n<style>\n@reference '../../style.css';\n@import '@scalar/code-highlight/css/code.css';\n\n/** Match the pre line-box metrics to the code font so blank and highlighted lines have the same pitch. */\n.scalar-code-block-pre {\n font-family: var(--scalar-font-code);\n /* Disable ligatures so code characters remain distinct. */\n font-variant-ligatures: none;\n}\n\n/** Make the copy button label backdrop match the background */\n.scalar-code-block.bg-b-1 .scalar-code-copy-backdrop {\n @apply bg-b-1;\n}\n.scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {\n @apply bg-b-2;\n}\n/** Make the copy button one shade darker than the background */\n.scalar-code-block.bg-b-2 .scalar-code-copy {\n @apply bg-b-3;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,iBAAiB,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;EAiF7B,MAAM,KAAK,MAAM;;EAGjB,MAAM,gBAAgB,eACd,QAAA,wBAAwB,gBAAgB,QAAA,WAAW,EAAE,CAC7D;EAEA,MAAM,kBAAkB,eAAe;GAQrC,OAPa,gBAAgB,cAAc,OAAO;IAChD,MAAM,QAAA,KAAK,KAAK;IAChB,aAAa,QAAA;IACb,iBAAiB,QAAA;GACnB,CAGO,CAAA,CAAK,MAAM,GAAG,EAAE;EACzB,CAAC;;EAGD,MAAM,YAAY,eAAe,CAAC,cAAc,MAAM,SAAS,IAAI,CAAC;EAEpE,MAAM,iBAAiB,eAAe;GACpC,OACE,cAAc,UAAU,QACxB,cAAc,UAAU,UACxB,cAAc,UAAU;EAE5B,CAAC;;EAGD,MAAM,WAAW,eAAe,QAAA,QAAQ,eAAe,KAAK;;;;;;EAO5D,MAAM,mBAAmB,eAAe,UAAU,SAAS,SAAS,KAAK;EAGzE,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBA+CM,OAAAC,eAAAC,mBA9CWC,MAAA,EAAA,CAAE,C,iHAWjBC,mBAUM,OAAA;IATH,cAAY,QAAA;IACb,OAAM;IACN,MAAK;IACL,UAAS;G,IACTA,mBAI6B,OAAA;IAH1B,IAAID,MAAA,EAAA;IACL,OAAKE,eAAA,CAAC,0FAAwF,EAAA,QAC5E,iBAAA,MAAgB,CAAA,CAAA;IAClC,WAAQ,gBAAA;G,2CAGJ,SAAA,SADRN,UAAA,GAAAO,YAuBsBH,MAAAI,2BAAA,GAAA;;IArBnB,iBAAeJ,MAAA,EAAA;IAChB,OAAKE,eAAA,CAAC,6BAA2B,CACf,UAAA,Q,8DAAuH,EAAA,eAAA,QAAA,SAAI,SAAA,C;IAM5I,SAAS,QAAA,eAAe,cAAA;IACxB,WAAW,QAAA;IACX,MAAM,QAAA;IACN,UAAQ,CAAG,UAAA;;IACD,UAAQG,cAOV,CANPC,YAMOC,4BAAA,EALL,OAAKL,eAAA,CAAC,6BAA2B,CACX,UAAA,Q"}
1
+ {"version":3,"file":"ScalarCodeBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeProps","_guardReactiveProps","_unref","_createElementVNode","_normalizeClass","_createBlock","ScalarCodeBlockCopy","_withCtx","_createVNode","ScalarCopyBackdrop","_createCommentVNode"],"sources":["../../../src/components/ScalarCodeBlock/ScalarCodeBlock.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { languages, registerLanguage } from '@scalar/highlight/all'\n\n/**\n * Registers every bundled grammar, once per module rather than once per block.\n *\n * `@scalar/highlight/all` already registers them when it is evaluated, so a\n * bare `import '@scalar/highlight/all'` reads like enough. It is not: that is a\n * side-effect-only import of an external package, and the library build drops\n * it from the emitted module. Storybook hid this because it compiles from\n * source, while the API reference consumes `dist` and lost highlighting\n * entirely — every block fell back to escaped, unscoped text.\n *\n * Registering from a named import keeps a binding the bundler can see used, so\n * the module survives. It lives in this block rather than in `<script setup>`\n * because setup runs for every instance, and a page of API reference renders\n * hundreds of code blocks.\n */\nregisterLanguage(...languages)\n\n/**\n * Scalar Code Block component\n *\n * Renders syntax-highlighted code using @scalar/highlight.\n * Supports line numbers, credential masking, and an optional copy button.\n * Set --scalar-code-line-height on the component or an ancestor to override its 1.4 line height.\n *\n * @example\n * <ScalarCodeBlock content=\"const x = 1\" lang=\"javascript\" />\n */\nexport default {}\n</script>\n<script lang=\"ts\" setup>\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { syntaxHighlight } from '@scalar/highlight/compat'\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { computed, useId } from 'vue'\n\nimport ScalarCopyBackdrop from '@/components/ScalarCopy/ScalarCopyBackdrop.vue'\n\nimport { ScalarCodeBlockCopy } from '../ScalarCodeBlock'\nimport type { StandardLanguageKey } from './types'\n\ntype BaseProps = {\n content?: string | object\n prettyPrintedContent?: string\n lang?: StandardLanguageKey | string\n lineNumbers?: boolean\n hideCredentials?: string | string[]\n copy?: 'always' | 'hover' | false\n /** Original content to copy when the displayed content has been masked. */\n copyContent?: string\n /**\n * Accessible name for the code scroller. Long code scrolls inside a focusable region so\n * keyboard users can reach it, and a focusable region needs a name or screen readers announce\n * nothing when focus lands on it.\n */\n label?: string\n /**\n * Accessible name for the copy button. The visible label only reads \"Copy\" (and the language)\n * while the block is hovered, so the name has to say what is copied on its own.\n */\n copyLabel?: string\n}\n\n/**\n * Uses @scalar/highlight for syntax highlighting\n *\n * Requires at least one of content or prettyPrintedContent\n */\nconst {\n lang = 'plaintext',\n lineNumbers = false,\n copy = 'hover',\n label = 'Code sample',\n copyLabel,\n copyContent,\n content,\n prettyPrintedContent,\n hideCredentials,\n} = defineProps<\n BaseProps &\n (\n | {\n /** Raw unformatted object or string content */\n content: string | object\n }\n | {\n /**\n * Pre-pretty printed content string for better performance\n *\n * Avoids unnecessary costly re-serialization of large content\n */\n prettyPrintedContent: string\n }\n )\n>()\n\n/** Base id for the code block */\nconst id = useId()\n\n/** Formatted the content into an indented json string */\nconst prettyContent = computed(\n () => prettyPrintedContent || prettyPrintJson(content ?? ''),\n)\n\nconst highlightedCode = computed(() => {\n const html = syntaxHighlight(prettyContent.value, {\n lang: lang.trim(),\n lineNumbers: lineNumbers,\n maskCredentials: hideCredentials,\n })\n\n // Need to remove the wrapping <pre> element so we can use v-html without another wrapper\n return html.slice(5, -6)\n})\n\n/** Determine if the content is a single line */\nconst isOneLine = computed(() => !prettyContent.value.includes('\\n'))\n\nconst isContentValid = computed(() => {\n return (\n prettyContent.value !== null &&\n prettyContent.value !== 'null' &&\n prettyContent.value !== '404 Not Found'\n )\n})\n\n/** Whether the copy button is rendered on top of the code */\nconst showCopy = computed(() => copy && isContentValid.value)\n\n/**\n * A one-liner has the copy button floating over the end of the line, so the line needs room to\n * scroll clear of the button. The padding goes on the `w-fit` <pre> because browsers disagree about\n * whether trailing padding on an `overflow-x` container is scrollable.\n */\nconst reserveCopySpace = computed(() => isOneLine.value && showCopy.value)\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <div\n v-bind=\"\n cx(\n 'scalar-code-block group/code-block flex flex-col',\n 'relative bg-b-1 min-h-0 min-w-0 focus-visible:outline',\n )\n \">\n <!--\n Inherits the corners so the inset focus ring follows a rounded code block.\n Always a tab stop so code that scrolls stays reachable by keyboard (WCAG 2.1.1). A named\n group rather than a region, so every code sample does not add a landmark.\n -->\n <div\n :aria-label=\"label\"\n class=\"custom-scroll min-h-0 min-w-0 flex-1 overflow-x-auto rounded-[inherit] p-2 -outline-offset-2\"\n role=\"group\"\n tabindex=\"0\">\n <pre\n :id=\"id\"\n class=\"scalar-code-block-pre m-0 w-fit border-0 bg-transparent p-0 text-nowrap whitespace-pre\"\n :class=\"{ 'pr-6': reserveCopySpace }\"\n v-html=\"highlightedCode\" />\n </div>\n <ScalarCodeBlockCopy\n v-if=\"showCopy\"\n :aria-controls=\"id\"\n class=\"scalar-code-copy absolute\"\n :class=\"[\n isOneLine\n ? 'top-1/2 right-1 m-0 -translate-y-1/2'\n : 'top-2.5 right-2.5',\n { 'opacity-100': copy === 'always' },\n ]\"\n :content=\"copyContent ?? prettyContent\"\n :copyLabel=\"copyLabel\"\n :lang=\"lang\"\n :showLang=\"!isOneLine\">\n <template #backdrop>\n <ScalarCopyBackdrop\n class=\"scalar-code-copy-backdrop\"\n :class=\"[\n isOneLine\n ? 'group-hocus-within/code-block:-left-0.5 -inset-y-0.75 -right-1 left-3'\n : '-top-1 -right-1.5',\n ]\" />\n </template>\n </ScalarCodeBlockCopy>\n </div>\n</template>\n<style>\n@reference '../../style.css';\n@import '@scalar/code-highlight/css/code.css';\n\n/** Match the pre line-box metrics to the code font so blank and highlighted lines have the same pitch. */\n.scalar-code-block-pre {\n font-family: var(--scalar-font-code);\n /* Disable ligatures so code characters remain distinct. */\n font-variant-ligatures: none;\n}\n\n/** Make the copy button label backdrop match the background */\n.scalar-code-block.bg-b-1 .scalar-code-copy-backdrop {\n @apply bg-b-1;\n}\n.scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {\n @apply bg-b-2;\n}\n/**\n * A transparent block shows the surface of the card it sits in, so the label takes that color.\n * Outside a card there is nothing to match, and the label goes without a backdrop.\n */\n.scalar-code-block.bg-transparent .scalar-code-copy-backdrop {\n background: var(--scalar-card-surface, transparent);\n}\n/** Make the copy button one shade darker than the background */\n.scalar-code-block.bg-b-2 .scalar-code-copy {\n @apply bg-b-3;\n}\n/**\n * On a card's surface the button's own fill is the color of the card behind the surface, which\n * reads as a hole in a dark card. It takes the card's raised color instead, one step above the\n * surface. Outside a card the button keeps its own fill.\n */\n.scalar-code-block.bg-transparent .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;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ACD,UAAQG,cAOV,CANPC,YAMOC,4BAAA,EALL,OAAKL,eAAA,CAAC,6BAA2B,CACX,UAAA,Q"}
@@ -258,7 +258,7 @@ declare const __VLS_export: <O extends Option = Option, G extends OptionGroup<O>
258
258
  disabled: boolean;
259
259
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any> | null>;
260
260
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
261
- $slots: import("../ScalarPopover/index.js").ScalarPopoverSlots;
261
+ $slots: import("../ScalarPopover/types.ts").Slots;
262
262
  })) | null, ({
263
263
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ScalarFloatingOptions> & Readonly<{}>, {
264
264
  popoverButtonRef: import("vue").Ref<import("vue").DefineComponent<{
@@ -470,7 +470,7 @@ declare const __VLS_export: <O extends Option = Option, G extends OptionGroup<O>
470
470
  disabled: boolean;
471
471
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any> | null>;
472
472
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
473
- $slots: import("../ScalarPopover/index.js").ScalarPopoverSlots;
473
+ $slots: import("../ScalarPopover/types.ts").Slots;
474
474
  })) | null>;
475
475
  }>) => void;
476
476
  attrs: any;
@@ -1,4 +1,4 @@
1
- import type { TeleportProps } from 'vue';
1
+ import { type TeleportProps } from 'vue';
2
2
  /**
3
3
  * Scalar teleport component
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTeleport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAKxC;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB;;OAEG;SACE,aAAa,CAAC,IAAI,CAAC;IACxB;;;;OAIG;gBACS,OAAO;IACnB;;OAEG;eACQ,aAAa,CAAC,UAAU,CAAC;;IAbpC;;OAEG;SACE,aAAa,CAAC,IAAI,CAAC;IACxB;;;;OAIG;gBACS,OAAO;IACnB;;OAEG;eACQ,aAAa,CAAC,UAAU,CAAC;;IAKpC,mCAAmC;eACxB,OAAO;EA2DhB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarTeleport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"names":[],"mappings":"AA2GA,OAAO,EACL,KAAK,aAAa,EAMnB,MAAM,KAAK,CAAA;AAKZ;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB;;OAEG;SACE,aAAa,CAAC,IAAI,CAAC;IACxB;;;;OAIG;gBACS,OAAO;IACnB;;OAEG;eACQ,aAAa,CAAC,UAAU,CAAC;;IAbpC;;OAEG;SACE,aAAa,CAAC,IAAI,CAAC;IACxB;;;;OAIG;gBACS,OAAO;IACnB;;OAEG;eACQ,aAAa,CAAC,UAAU,CAAC;;IAMpC,mCAAmC;eACxB,OAAO;EAiGhB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTeleport.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar teleport component\n *\n * Teleports the contents to the nearest <ScalarTeleportRoot>\n * Falls back to the default teleport target (body) if no root is found\n *\n * Is a wrapper around the Vue <Teleport> component and takes the same props\n *\n * @example\n * <ScalarTeleport>\n * <div>Teleported Content</div>\n * </ScalarTeleport>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport type { TeleportProps } from 'vue'\n\nimport { useTeleport } from './useTeleport'\n\ndefineProps<{\n /**\n * Override the default teleport target\n */\n to?: TeleportProps['to']\n /**\n * Whether to teleport immediately, disables the default defer behavior\n *\n * @see https://vuejs.org/guide/built-ins/teleport#deferred-teleport\n */\n immediate?: boolean\n /**\n * Whether to disable teleportation\n */\n disabled?: TeleportProps['disabled']\n}>()\n\ndefineSlots<{\n /** The element to be teleported */\n default(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst root = useTeleport()\n</script>\n<template>\n <Teleport\n :defer=\"!immediate\"\n :disabled=\"disabled\"\n :to=\"to || root\">\n <div\n class=\"scalar-app\"\n style=\"display: contents\"\n v-bind=\"$attrs\">\n <slot />\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarTeleport.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar teleport component\n *\n * Teleports the contents to the nearest <ScalarTeleportRoot>\n * Falls back to the default teleport target (body) if no root is found\n *\n * Is a wrapper around the Vue <Teleport> component and takes the same props\n *\n * @example\n * <ScalarTeleport>\n * <div>Teleported Content</div>\n * </ScalarTeleport>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport {\n type TeleportProps,\n getCurrentInstance,\n inject,\n onMounted,\n ref,\n ssrContextKey,\n} from 'vue'\n\nimport { useTeleport } from './useTeleport'\n\nconst { to } = defineProps<{\n /**\n * Override the default teleport target\n */\n to?: TeleportProps['to']\n /**\n * Whether to teleport immediately, disables the default defer behavior\n *\n * @see https://vuejs.org/guide/built-ins/teleport#deferred-teleport\n */\n immediate?: boolean\n /**\n * Whether to disable teleportation\n */\n disabled?: TeleportProps['disabled']\n}>()\n\ndefineSlots<{\n /** The element to be teleported */\n default(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst root = useTeleport()\n\n/**\n * Server-rendered teleports stay in place until the component is mounted.\n *\n * Vue's server renderer does not put teleported content into the page. It\n * hands the content back separately and expects the host to place it in the\n * target. A host that embeds the server-rendered markup never receives it, so\n * during hydration Vue looks for the content in the target and hydrates over\n * whatever the host page has there.\n *\n * Rendering in place asks nothing of the host. The content is part of the\n * markup where the component is used, it is hydrated there, and it moves to\n * the target once the component is mounted. A component that is mounted\n * without server-rendered markup still teleports right away.\n *\n * @see https://vuejs.org/guide/scaling-up/ssr.html#teleports\n */\nconst isServerRendering = inject<unknown>(ssrContextKey, null) !== null\nconst isHydrating = getCurrentInstance()?.vnode.el != null\nconst renderInPlace = ref<boolean>(isServerRendering || isHydrating)\n\n/**\n * Vue looks up the target once, while it hydrates the teleport, and keeps\n * what it found. If the target is not on the page at that moment there is\n * nowhere to move the content to later, so it stays where it was rendered.\n */\nconst isTargetOnPage = (target: TeleportProps['to']): boolean =>\n typeof target === 'string'\n ? document.querySelector(target) !== null\n : !!target\nconst canTeleport = !isHydrating || isTargetOnPage(to || root)\n\nonMounted(() => {\n if (canTeleport) {\n renderInPlace.value = false\n }\n})\n</script>\n<template>\n <Teleport\n :defer=\"!immediate\"\n :disabled=\"disabled || renderInPlace\"\n :to=\"to || root\">\n <div\n class=\"scalar-app\"\n style=\"display: contents\"\n v-bind=\"$attrs\">\n <slot />\n </div>\n </Teleport>\n</template>\n"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { useTeleport } from "./useTeleport.js";
2
- import { Teleport, createBlock, createElementVNode, defineComponent, mergeProps, openBlock, renderSlot, unref } from "vue";
2
+ import { Teleport, createBlock, createElementVNode, defineComponent, getCurrentInstance, inject, mergeProps, onMounted, openBlock, ref, renderSlot, ssrContextKey, unref } from "vue";
3
3
  var ScalarTeleport_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
4
4
  inheritAttrs: false,
5
5
  __name: "ScalarTeleport",
@@ -10,10 +10,39 @@ var ScalarTeleport_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
10
10
  },
11
11
  setup(__props) {
12
12
  const root = useTeleport();
13
+ /**
14
+ * Server-rendered teleports stay in place until the component is mounted.
15
+ *
16
+ * Vue's server renderer does not put teleported content into the page. It
17
+ * hands the content back separately and expects the host to place it in the
18
+ * target. A host that embeds the server-rendered markup never receives it, so
19
+ * during hydration Vue looks for the content in the target and hydrates over
20
+ * whatever the host page has there.
21
+ *
22
+ * Rendering in place asks nothing of the host. The content is part of the
23
+ * markup where the component is used, it is hydrated there, and it moves to
24
+ * the target once the component is mounted. A component that is mounted
25
+ * without server-rendered markup still teleports right away.
26
+ *
27
+ * @see https://vuejs.org/guide/scaling-up/ssr.html#teleports
28
+ */
29
+ const isServerRendering = inject(ssrContextKey, null) !== null;
30
+ const isHydrating = getCurrentInstance()?.vnode.el != null;
31
+ const renderInPlace = ref(isServerRendering || isHydrating);
32
+ /**
33
+ * Vue looks up the target once, while it hydrates the teleport, and keeps
34
+ * what it found. If the target is not on the page at that moment there is
35
+ * nowhere to move the content to later, so it stays where it was rendered.
36
+ */
37
+ const isTargetOnPage = (target) => typeof target === "string" ? document.querySelector(target) !== null : !!target;
38
+ const canTeleport = !isHydrating || isTargetOnPage(__props.to || root);
39
+ onMounted(() => {
40
+ if (canTeleport) renderInPlace.value = false;
41
+ });
13
42
  return (_ctx, _cache) => {
14
43
  return openBlock(), createBlock(Teleport, {
15
44
  defer: !__props.immediate,
16
- disabled: __props.disabled,
45
+ disabled: __props.disabled || renderInPlace.value,
17
46
  to: __props.to || unref(root)
18
47
  }, [createElementVNode("div", mergeProps({
19
48
  class: "scalar-app",
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTeleport.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_Teleport","_unref","_createElementVNode","_mergeProps","_renderSlot"],"sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar teleport component\n *\n * Teleports the contents to the nearest <ScalarTeleportRoot>\n * Falls back to the default teleport target (body) if no root is found\n *\n * Is a wrapper around the Vue <Teleport> component and takes the same props\n *\n * @example\n * <ScalarTeleport>\n * <div>Teleported Content</div>\n * </ScalarTeleport>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport type { TeleportProps } from 'vue'\n\nimport { useTeleport } from './useTeleport'\n\ndefineProps<{\n /**\n * Override the default teleport target\n */\n to?: TeleportProps['to']\n /**\n * Whether to teleport immediately, disables the default defer behavior\n *\n * @see https://vuejs.org/guide/built-ins/teleport#deferred-teleport\n */\n immediate?: boolean\n /**\n * Whether to disable teleportation\n */\n disabled?: TeleportProps['disabled']\n}>()\n\ndefineSlots<{\n /** The element to be teleported */\n default(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst root = useTeleport()\n</script>\n<template>\n <Teleport\n :defer=\"!immediate\"\n :disabled=\"disabled\"\n :to=\"to || root\">\n <div\n class=\"scalar-app\"\n style=\"display: contents\"\n v-bind=\"$attrs\">\n <slot />\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;EA6CA,MAAM,OAAO,YAAY;;GAGvB,OAAAC,UAAA,GAAAC,YAUWC,UAAA;IATR,OAAK,CAAG,QAAA;IACR,UAAU,QAAA;IACV,IAAI,QAAA,MAAMC,MAAA,IAAA;G,IACXC,mBAKM,OALNC,WAKM;IAJJ,OAAM;IACN,OAAA,EAAA,WAAA,WAAA;GACQN,GAAAA,KAAAA,MAAM,GAAA,CACdO,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarTeleport.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_Teleport","_unref","_createElementVNode","_mergeProps","_renderSlot"],"sources":["../../../src/components/ScalarTeleport/ScalarTeleport.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar teleport component\n *\n * Teleports the contents to the nearest <ScalarTeleportRoot>\n * Falls back to the default teleport target (body) if no root is found\n *\n * Is a wrapper around the Vue <Teleport> component and takes the same props\n *\n * @example\n * <ScalarTeleport>\n * <div>Teleported Content</div>\n * </ScalarTeleport>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport {\n type TeleportProps,\n getCurrentInstance,\n inject,\n onMounted,\n ref,\n ssrContextKey,\n} from 'vue'\n\nimport { useTeleport } from './useTeleport'\n\nconst { to } = defineProps<{\n /**\n * Override the default teleport target\n */\n to?: TeleportProps['to']\n /**\n * Whether to teleport immediately, disables the default defer behavior\n *\n * @see https://vuejs.org/guide/built-ins/teleport#deferred-teleport\n */\n immediate?: boolean\n /**\n * Whether to disable teleportation\n */\n disabled?: TeleportProps['disabled']\n}>()\n\ndefineSlots<{\n /** The element to be teleported */\n default(): unknown\n}>()\n\ndefineOptions({ inheritAttrs: false })\n\nconst root = useTeleport()\n\n/**\n * Server-rendered teleports stay in place until the component is mounted.\n *\n * Vue's server renderer does not put teleported content into the page. It\n * hands the content back separately and expects the host to place it in the\n * target. A host that embeds the server-rendered markup never receives it, so\n * during hydration Vue looks for the content in the target and hydrates over\n * whatever the host page has there.\n *\n * Rendering in place asks nothing of the host. The content is part of the\n * markup where the component is used, it is hydrated there, and it moves to\n * the target once the component is mounted. A component that is mounted\n * without server-rendered markup still teleports right away.\n *\n * @see https://vuejs.org/guide/scaling-up/ssr.html#teleports\n */\nconst isServerRendering = inject<unknown>(ssrContextKey, null) !== null\nconst isHydrating = getCurrentInstance()?.vnode.el != null\nconst renderInPlace = ref<boolean>(isServerRendering || isHydrating)\n\n/**\n * Vue looks up the target once, while it hydrates the teleport, and keeps\n * what it found. If the target is not on the page at that moment there is\n * nowhere to move the content to later, so it stays where it was rendered.\n */\nconst isTargetOnPage = (target: TeleportProps['to']): boolean =>\n typeof target === 'string'\n ? document.querySelector(target) !== null\n : !!target\nconst canTeleport = !isHydrating || isTargetOnPage(to || root)\n\nonMounted(() => {\n if (canTeleport) {\n renderInPlace.value = false\n }\n})\n</script>\n<template>\n <Teleport\n :defer=\"!immediate\"\n :disabled=\"disabled || renderInPlace\"\n :to=\"to || root\">\n <div\n class=\"scalar-app\"\n style=\"display: contents\"\n v-bind=\"$attrs\">\n <slot />\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;EAoDA,MAAM,OAAO,YAAY;;;;;;;;;;;;;;;;;EAkBzB,MAAM,oBAAoB,OAAgB,eAAe,IAAI,MAAM;EACnE,MAAM,cAAc,mBAAmB,CAAC,EAAE,MAAM,MAAM;EACtD,MAAM,gBAAgB,IAAa,qBAAqB,WAAW;;;;;;EAOnE,MAAM,kBAAkB,WACtB,OAAO,WAAW,WACd,SAAS,cAAc,MAAM,MAAM,OACnC,CAAC,CAAC;EACR,MAAM,cAAc,CAAC,eAAe,eAAe,QAAA,MAAM,IAAI;EAE7D,gBAAgB;GACd,IAAI,aACF,cAAc,QAAQ;EAE1B,CAAC;;GAGC,OAAAC,UAAA,GAAAC,YAUWC,UAAA;IATR,OAAK,CAAG,QAAA;IACR,UAAU,QAAA,YAAY,cAAA;IACtB,IAAI,QAAA,MAAMC,MAAA,IAAA;G,IACXC,mBAKM,OALNC,WAKM;IAJJ,OAAM;IACN,OAAA,EAAA,WAAA,WAAA;GACQN,GAAAA,KAAAA,MAAM,GAAA,CACdO,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -1,3 +1,4 @@
1
+ import type { ScalarToggleSize } from './types';
1
2
  /**
2
3
  * Scalar Toggle component
3
4
  *
@@ -12,6 +13,12 @@ export default _default;
12
13
  declare const __VLS_export: import("vue").DefineComponent<{
13
14
  disabled?: boolean;
14
15
  label?: string;
16
+ /**
17
+ * Size of the toggle
18
+ *
19
+ * @default 'sm'
20
+ */
21
+ size?: ScalarToggleSize;
15
22
  } & {
16
23
  modelValue?: boolean;
17
24
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -19,6 +26,12 @@ declare const __VLS_export: import("vue").DefineComponent<{
19
26
  }, string, import("vue").PublicProps, Readonly<{
20
27
  disabled?: boolean;
21
28
  label?: string;
29
+ /**
30
+ * Size of the toggle
31
+ *
32
+ * @default 'sm'
33
+ */
34
+ size?: ScalarToggleSize;
22
35
  } & {
23
36
  modelValue?: boolean;
24
37
  }> & Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"names":[],"mappings":"AA6CA;;;;;;;;GAQG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;eAEL,OAAO;YACV,MAAM;;iBAkBH,OAAO;;;;eAnBP,OAAO;YACV,MAAM;;iBAkBH,OAAO;;;kFA6DhB,CAAC"}
1
+ {"version":3,"file":"ScalarToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C;;;;;;;;GAQG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;eAEL,OAAO;YACV,MAAM;IACd;;;;OAIG;WACI,gBAAgB;;iBAkBZ,OAAO;;;;eAzBP,OAAO;YACV,MAAM;IACd;;;;OAIG;WACI,gBAAgB;;iBAkBZ,OAAO;;;kFA+DhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggle.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Toggle component\n *\n * A switch-style toggle control with support for\n * disabled state and accessible labeling.\n *\n * @example\n * <ScalarToggle v-model=\"enabled\" label=\"Enable feature\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\n\nconst props = defineProps<{\n disabled?: boolean\n label?: string\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nfunction toggle() {\n if (props.disabled) {\n return\n }\n model.value = !model.value\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"model\"\n :class=\"model ? 'bg-c-accent' : ''\"\n :disabled\n :label\n role=\"switch\"\n :thumb=\"model ? 'end' : 'start'\"\n @click=\"toggle\" />\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarToggle.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Toggle component\n *\n * A switch-style toggle control with support for\n * disabled state and accessible labeling.\n *\n * @example\n * <ScalarToggle v-model=\"enabled\" label=\"Enable feature\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\nimport type { ScalarToggleSize } from './types'\n\nconst props = defineProps<{\n disabled?: boolean\n label?: string\n /**\n * Size of the toggle\n *\n * @default 'sm'\n */\n size?: ScalarToggleSize\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nfunction toggle() {\n if (props.disabled) {\n return\n }\n model.value = !model.value\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"model\"\n :class=\"model ? 'bg-c-accent' : ''\"\n :disabled\n :label\n role=\"switch\"\n :size\n :thumb=\"model ? 'end' : 'start'\"\n @click=\"toggle\" />\n</template>\n"],"mappings":""}
@@ -4,7 +4,8 @@ var ScalarToggle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
4
4
  __name: "ScalarToggle",
5
5
  props: /*@__PURE__*/ mergeModels({
6
6
  disabled: { type: Boolean },
7
- label: {}
7
+ label: {},
8
+ size: {}
8
9
  }, {
9
10
  "modelValue": {
10
11
  type: Boolean,
@@ -27,6 +28,7 @@ var ScalarToggle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
27
28
  disabled: __props.disabled,
28
29
  label: __props.label,
29
30
  role: "switch",
31
+ size: __props.size,
30
32
  thumb: model.value ? "end" : "start",
31
33
  onClick: toggle
32
34
  }, null, 8, [
@@ -34,6 +36,7 @@ var ScalarToggle_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
34
36
  "class",
35
37
  "disabled",
36
38
  "label",
39
+ "size",
37
40
  "thumb"
38
41
  ]);
39
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggle.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","ScalarToggleSlider","_normalizeClass"],"sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Toggle component\n *\n * A switch-style toggle control with support for\n * disabled state and accessible labeling.\n *\n * @example\n * <ScalarToggle v-model=\"enabled\" label=\"Enable feature\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\n\nconst props = defineProps<{\n disabled?: boolean\n label?: string\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nfunction toggle() {\n if (props.disabled) {\n return\n }\n model.value = !model.value\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"model\"\n :class=\"model ? 'bg-c-accent' : ''\"\n :disabled\n :label\n role=\"switch\"\n :thumb=\"model ? 'end' : 'start'\"\n @click=\"toggle\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAeA,MAAM,QAAQ;EAKd,MAAM,QAAQA,SAAoB,SAAA,YAAmB;EAErD,SAAS,SAAS;GAChB,IAAI,MAAM,UACR;GAEF,MAAM,QAAQ,CAAC,MAAM;EACvB;;GAGE,OAAAC,UAAA,GAAAC,YAOoBC,4BAAA;IANjB,gBAAc,MAAA;IACd,OAAKC,eAAE,MAAA,QAAK,gBAAA,EAAA;IACZ,UAAA,QAAA;IACA,OAAA,QAAA;IACD,MAAK;IACJ,OAAO,MAAA,QAAK,QAAA;IACZ,SAAO"}
1
+ {"version":3,"file":"ScalarToggle.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","ScalarToggleSlider","_normalizeClass"],"sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Toggle component\n *\n * A switch-style toggle control with support for\n * disabled state and accessible labeling.\n *\n * @example\n * <ScalarToggle v-model=\"enabled\" label=\"Enable feature\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\nimport type { ScalarToggleSize } from './types'\n\nconst props = defineProps<{\n disabled?: boolean\n label?: string\n /**\n * Size of the toggle\n *\n * @default 'sm'\n */\n size?: ScalarToggleSize\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nfunction toggle() {\n if (props.disabled) {\n return\n }\n model.value = !model.value\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"model\"\n :class=\"model ? 'bg-c-accent' : ''\"\n :disabled\n :label\n role=\"switch\"\n :size\n :thumb=\"model ? 'end' : 'start'\"\n @click=\"toggle\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAgBA,MAAM,QAAQ;EAWd,MAAM,QAAQA,SAAoB,SAAA,YAAmB;EAErD,SAAS,SAAS;GAChB,IAAI,MAAM,UACR;GAEF,MAAM,QAAQ,CAAC,MAAM;EACvB;;GAGE,OAAAC,UAAA,GAAAC,YAQoBC,4BAAA;IAPjB,gBAAc,MAAA;IACd,OAAKC,eAAE,MAAA,QAAK,gBAAA,EAAA;IACZ,UAAA,QAAA;IACA,OAAA,QAAA;IACD,MAAK;IACJ,MAAA,QAAA;IACA,OAAO,MAAA,QAAK,QAAA;IACZ,SAAO"}
@@ -1,6 +1,9 @@
1
+ import type { ScalarToggleSize } from './types';
1
2
  type __VLS_Props = {
2
3
  /** Resting position of the thumb within the track */
3
4
  thumb?: 'start' | 'center' | 'end';
5
+ /** Size of the track and thumb */
6
+ size?: ScalarToggleSize;
4
7
  /** Visually dims the control and applies a not-allowed cursor */
5
8
  disabled?: boolean;
6
9
  /** Accessible label announced to assistive technology */
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggleSlider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"names":[],"mappings":"AAiDA,KAAK,WAAW,GAAG;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAyEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ScalarToggleSlider.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"names":[],"mappings":"AA0EA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,KAAK,WAAW,GAAG;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,kCAAkC;IAClC,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAkFF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggleSlider.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nconst {\n thumb = 'start',\n disabled,\n label,\n} = defineProps<{\n /** Resting position of the thumb within the track */\n thumb?: 'start' | 'center' | 'end'\n /** Visually dims the control and applies a not-allowed cursor */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst variants = cva({\n base: 'relative h-3.5 min-w-6 w-6 cursor-pointer rounded-full bg-b-3 transition-colors duration-300',\n variants: {\n disabled: { true: 'cursor-not-allowed opacity-40' },\n },\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <button\n :aria-disabled=\"disabled\"\n type=\"button\"\n v-bind=\"cx(variants({ disabled }))\">\n <div\n class=\"bg-b-1 absolute top-px left-px flex h-3 w-3 items-center justify-center rounded-full transition-transform duration-300\"\n :class=\"{\n 'translate-x-1.25': thumb === 'center',\n 'translate-x-2.5': thumb === 'end',\n }\" />\n <span\n v-if=\"label\"\n class=\"sr-only\">\n {{ label }}\n </span>\n </button>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarToggleSlider.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport type { ScalarToggleSize } from './types'\n\nconst {\n thumb = 'start',\n size = 'sm',\n disabled,\n label,\n} = defineProps<{\n /** Resting position of the thumb within the track */\n thumb?: 'start' | 'center' | 'end'\n /** Size of the track and thumb */\n size?: ScalarToggleSize\n /** Visually dims the control and applies a not-allowed cursor */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst variants = cva({\n base: 'relative cursor-pointer rounded-full bg-b-3 transition-colors duration-300',\n variants: {\n size: {\n sm: 'h-3.5 min-w-6 w-6',\n md: 'h-5 min-w-8 w-8',\n },\n disabled: { true: 'cursor-not-allowed opacity-40' },\n },\n})\n\n/**\n * The thumb travels the width of the track minus its own width and the inset\n * on both sides, so each size needs its own offsets for the center and end.\n */\nconst thumbVariants = cva({\n base: 'bg-b-1 absolute flex items-center justify-center rounded-full transition-transform duration-300',\n variants: {\n size: {\n sm: 'top-px left-px size-3',\n md: 'top-0.5 left-0.5 size-4',\n },\n thumb: { start: '', center: '', end: '' },\n },\n compoundVariants: [\n { size: 'sm', thumb: 'center', class: 'translate-x-1.25' },\n { size: 'sm', thumb: 'end', class: 'translate-x-2.5' },\n { size: 'md', thumb: 'center', class: 'translate-x-1.5' },\n { size: 'md', thumb: 'end', class: 'translate-x-3' },\n ],\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <button\n :aria-disabled=\"disabled\"\n type=\"button\"\n v-bind=\"cx(variants({ size, disabled }))\">\n <div :class=\"thumbVariants({ size, thumb })\" />\n <span\n v-if=\"label\"\n class=\"sr-only\">\n {{ label }}\n </span>\n </button>\n</template>\n"],"mappings":""}
@@ -11,23 +11,73 @@ var ScalarToggleSlider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
11
11
  __name: "ScalarToggleSlider",
12
12
  props: {
13
13
  thumb: { default: "start" },
14
+ size: { default: "sm" },
14
15
  disabled: { type: Boolean },
15
16
  label: {}
16
17
  },
17
18
  setup(__props) {
18
19
  const variants = cva({
19
- base: "relative h-3.5 min-w-6 w-6 cursor-pointer rounded-full bg-b-3 transition-colors duration-300",
20
- variants: { disabled: { true: "cursor-not-allowed opacity-40" } }
20
+ base: "relative cursor-pointer rounded-full bg-b-3 transition-colors duration-300",
21
+ variants: {
22
+ size: {
23
+ sm: "h-3.5 min-w-6 w-6",
24
+ md: "h-5 min-w-8 w-8"
25
+ },
26
+ disabled: { true: "cursor-not-allowed opacity-40" }
27
+ }
28
+ });
29
+ /**
30
+ * The thumb travels the width of the track minus its own width and the inset
31
+ * on both sides, so each size needs its own offsets for the center and end.
32
+ */
33
+ const thumbVariants = cva({
34
+ base: "bg-b-1 absolute flex items-center justify-center rounded-full transition-transform duration-300",
35
+ variants: {
36
+ size: {
37
+ sm: "top-px left-px size-3",
38
+ md: "top-0.5 left-0.5 size-4"
39
+ },
40
+ thumb: {
41
+ start: "",
42
+ center: "",
43
+ end: ""
44
+ }
45
+ },
46
+ compoundVariants: [
47
+ {
48
+ size: "sm",
49
+ thumb: "center",
50
+ class: "translate-x-1.25"
51
+ },
52
+ {
53
+ size: "sm",
54
+ thumb: "end",
55
+ class: "translate-x-2.5"
56
+ },
57
+ {
58
+ size: "md",
59
+ thumb: "center",
60
+ class: "translate-x-1.5"
61
+ },
62
+ {
63
+ size: "md",
64
+ thumb: "end",
65
+ class: "translate-x-3"
66
+ }
67
+ ]
21
68
  });
22
69
  const { cx } = useBindCx();
23
70
  return (_ctx, _cache) => {
24
71
  return openBlock(), createElementBlock("button", mergeProps({
25
72
  "aria-disabled": __props.disabled,
26
73
  type: "button"
27
- }, unref(cx)(unref(variants)({ disabled: __props.disabled }))), [createElementVNode("div", { class: normalizeClass(["bg-b-1 absolute top-px left-px flex h-3 w-3 items-center justify-center rounded-full transition-transform duration-300", {
28
- "translate-x-1.25": __props.thumb === "center",
29
- "translate-x-2.5": __props.thumb === "end"
30
- }]) }, null, 2), __props.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 16, _hoisted_1);
74
+ }, unref(cx)(unref(variants)({
75
+ size: __props.size,
76
+ disabled: __props.disabled
77
+ }))), [createElementVNode("div", { class: normalizeClass(unref(thumbVariants)({
78
+ size: __props.size,
79
+ thumb: __props.thumb
80
+ })) }, null, 2), __props.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 16, _hoisted_1);
31
81
  };
32
82
  }
33
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarToggleSlider.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nconst {\n thumb = 'start',\n disabled,\n label,\n} = defineProps<{\n /** Resting position of the thumb within the track */\n thumb?: 'start' | 'center' | 'end'\n /** Visually dims the control and applies a not-allowed cursor */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst variants = cva({\n base: 'relative h-3.5 min-w-6 w-6 cursor-pointer rounded-full bg-b-3 transition-colors duration-300',\n variants: {\n disabled: { true: 'cursor-not-allowed opacity-40' },\n },\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <button\n :aria-disabled=\"disabled\"\n type=\"button\"\n v-bind=\"cx(variants({ disabled }))\">\n <div\n class=\"bg-b-1 absolute top-px left-px flex h-3 w-3 items-center justify-center rounded-full transition-transform duration-300\"\n :class=\"{\n 'translate-x-1.25': thumb === 'center',\n 'translate-x-2.5': thumb === 'end',\n }\" />\n <span\n v-if=\"label\"\n class=\"sr-only\">\n {{ label }}\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAgBA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,UAAU,EAAE,MAAM,gCAAgC,EACpD;EACF,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAeS,UAfTC,WAeS;IAdN,iBAAe,QAAA;IAChB,MAAK;GACG,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA,EAAA,UAAG,QAAA,SAAQ,CAAA,CAAA,CAAA,GAAA,CAC9BC,mBAKO,OAAA,EAJL,OAAKC,eAAA,CAAC,0HAAwH;IACxF,oBAAA,QAAA,UAAK;IAA0C,mBAAA,QAAA,UAAK;G,iBAKpF,QAAA,SADRL,UAAA,GAAAC,mBAIO,QAJP,YAIOK,gBADF,QAAA,KAAK,GAAA,CAAA,K"}
1
+ {"version":3,"file":"ScalarToggleSlider.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_normalizeClass","_toDisplayString","_createCommentVNode"],"sources":["../../../src/components/ScalarToggle/ScalarToggleSlider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport type { ScalarToggleSize } from './types'\n\nconst {\n thumb = 'start',\n size = 'sm',\n disabled,\n label,\n} = defineProps<{\n /** Resting position of the thumb within the track */\n thumb?: 'start' | 'center' | 'end'\n /** Size of the track and thumb */\n size?: ScalarToggleSize\n /** Visually dims the control and applies a not-allowed cursor */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst variants = cva({\n base: 'relative cursor-pointer rounded-full bg-b-3 transition-colors duration-300',\n variants: {\n size: {\n sm: 'h-3.5 min-w-6 w-6',\n md: 'h-5 min-w-8 w-8',\n },\n disabled: { true: 'cursor-not-allowed opacity-40' },\n },\n})\n\n/**\n * The thumb travels the width of the track minus its own width and the inset\n * on both sides, so each size needs its own offsets for the center and end.\n */\nconst thumbVariants = cva({\n base: 'bg-b-1 absolute flex items-center justify-center rounded-full transition-transform duration-300',\n variants: {\n size: {\n sm: 'top-px left-px size-3',\n md: 'top-0.5 left-0.5 size-4',\n },\n thumb: { start: '', center: '', end: '' },\n },\n compoundVariants: [\n { size: 'sm', thumb: 'center', class: 'translate-x-1.25' },\n { size: 'sm', thumb: 'end', class: 'translate-x-2.5' },\n { size: 'md', thumb: 'center', class: 'translate-x-1.5' },\n { size: 'md', thumb: 'end', class: 'translate-x-3' },\n ],\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <button\n :aria-disabled=\"disabled\"\n type=\"button\"\n v-bind=\"cx(variants({ size, disabled }))\">\n <div :class=\"thumbVariants({ size, thumb })\" />\n <span\n v-if=\"label\"\n class=\"sr-only\">\n {{ label }}\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAqBA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU;IACR,MAAM;KACJ,IAAI;KACJ,IAAI;IACN;IACA,UAAU,EAAE,MAAM,gCAAgC;GACpD;EACF,CAAC;;;;;EAMD,MAAM,gBAAgB,IAAI;GACxB,MAAM;GACN,UAAU;IACR,MAAM;KACJ,IAAI;KACJ,IAAI;IACN;IACA,OAAO;KAAE,OAAO;KAAI,QAAQ;KAAI,KAAK;IAAG;GAC1C;GACA,kBAAkB;IAChB;KAAE,MAAM;KAAM,OAAO;KAAU,OAAO;IAAmB;IACzD;KAAE,MAAM;KAAM,OAAO;KAAO,OAAO;IAAkB;IACrD;KAAE,MAAM;KAAM,OAAO;KAAU,OAAO;IAAkB;IACxD;KAAE,MAAM;KAAM,OAAO;KAAO,OAAO;IAAgB;GACrD;EACF,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,mBAUS,UAVTC,WAUS;IATN,iBAAe,QAAA;IAChB,MAAK;GACG,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA;IAAA,MAAG,QAAA;IAAI,UAAE,QAAA;GAAQ,CAAA,CAAA,CAAA,GAAA,CACpCC,mBAA+C,OAAA,EAAzC,OAAKC,eAAEF,MAAA,aAAA,CAAa,CAAA;IAAA,MAAG,QAAA;IAAI,OAAE,QAAA;GAAK,CAAA,CAAA,E,aAEhC,QAAA,SADRH,UAAA,GAAAC,mBAIO,QAJP,YAIOK,gBADF,QAAA,KAAK,GAAA,CAAA,K"}
@@ -1,3 +1,4 @@
1
+ import type { ScalarToggleSize } from './types';
1
2
  /**
2
3
  * Scalar Tristate Toggle component
3
4
  *
@@ -16,6 +17,12 @@ declare const __VLS_export: import("vue").DefineComponent<{
16
17
  disabled?: boolean;
17
18
  /** Accessible label announced to assistive technology */
18
19
  label?: string;
20
+ /**
21
+ * Size of the toggle
22
+ *
23
+ * @default 'sm'
24
+ */
25
+ size?: ScalarToggleSize;
19
26
  } & {
20
27
  modelValue?: boolean | undefined;
21
28
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -25,6 +32,12 @@ declare const __VLS_export: import("vue").DefineComponent<{
25
32
  disabled?: boolean;
26
33
  /** Accessible label announced to assistive technology */
27
34
  label?: string;
35
+ /**
36
+ * Size of the toggle
37
+ *
38
+ * @default 'sm'
39
+ */
40
+ size?: ScalarToggleSize;
28
41
  } & {
29
42
  modelValue?: boolean | undefined;
30
43
  }> & Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTristateToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"names":[],"mappings":"AA0EA;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB,mEAAmE;eACxD,OAAO;IAClB,yDAAyD;YACjD,MAAM;;iBAqCH,OAAO,GAAG,SAAS;;;;IAxC9B,mEAAmE;eACxD,OAAO;IAClB,yDAAyD;YACjD,MAAM;;iBAqCH,OAAO,GAAG,SAAS;;;kFA6D5B,CAAC"}
1
+ {"version":3,"file":"ScalarTristateToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"names":[],"mappings":"AAgFA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAEhB,mEAAmE;eACxD,OAAO;IAClB,yDAAyD;YACjD,MAAM;IACd;;;;OAIG;WACI,gBAAgB;;iBAqCZ,OAAO,GAAG,SAAS;;;;IA9C9B,mEAAmE;eACxD,OAAO;IAClB,yDAAyD;YACjD,MAAM;IACd;;;;OAIG;WACI,gBAAgB;;iBAqCZ,OAAO,GAAG,SAAS;;;kFA+D5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTristateToggle.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Tristate Toggle component\n *\n * A switch-style toggle control with three states — unset, on, and off —\n * useful for representing an optional boolean that can also be left\n * unset (e.g. \"inherit\"). Supports a disabled state and accessible\n * labeling.\n *\n * @example\n * <ScalarTristateToggle v-model=\"overridden\" label=\"Override default\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\n\nconst props = defineProps<{\n /** Prevents the toggle from being cycled, and dims it visually. */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst model = defineModel<boolean | undefined>()\n\n/** The current tristate value, derived from the boolean | undefined model. */\nconst state = computed<'unset' | 'on' | 'off'>(() => {\n if (model.value === undefined) {\n return 'unset'\n }\n return model.value ? 'on' : 'off'\n})\n\n/** Slider appearance for each tristate value. */\nconst SLIDER_PROPS = {\n unset: { class: '', thumb: 'center' },\n on: { class: 'bg-green', thumb: 'end' },\n off: { class: 'bg-c-danger', thumb: 'start' },\n} as const\n\n/** Cycles unset -> on -> off -> unset. */\nfunction toggle() {\n if (props.disabled) {\n return\n }\n if (model.value === undefined) {\n model.value = true\n } else if (model.value === true) {\n model.value = false\n } else {\n model.value = undefined\n }\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"state === 'unset' ? 'mixed' : model\"\n :disabled\n :label\n role=\"checkbox\"\n v-bind=\"SLIDER_PROPS[state]\"\n @click=\"toggle\" />\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ScalarTristateToggle.vue.js","names":["_sfc_main"],"sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Tristate Toggle component\n *\n * A switch-style toggle control with three states — unset, on, and off —\n * useful for representing an optional boolean that can also be left\n * unset (e.g. \"inherit\"). Supports a disabled state and accessible\n * labeling.\n *\n * @example\n * <ScalarTristateToggle v-model=\"overridden\" label=\"Override default\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\nimport type { ScalarToggleSize } from './types'\n\nconst props = defineProps<{\n /** Prevents the toggle from being cycled, and dims it visually. */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n /**\n * Size of the toggle\n *\n * @default 'sm'\n */\n size?: ScalarToggleSize\n}>()\n\nconst model = defineModel<boolean | undefined>()\n\n/** The current tristate value, derived from the boolean | undefined model. */\nconst state = computed<'unset' | 'on' | 'off'>(() => {\n if (model.value === undefined) {\n return 'unset'\n }\n return model.value ? 'on' : 'off'\n})\n\n/** Slider appearance for each tristate value. */\nconst SLIDER_PROPS = {\n unset: { class: '', thumb: 'center' },\n on: { class: 'bg-green', thumb: 'end' },\n off: { class: 'bg-c-danger', thumb: 'start' },\n} as const\n\n/** Cycles unset -> on -> off -> unset. */\nfunction toggle() {\n if (props.disabled) {\n return\n }\n if (model.value === undefined) {\n model.value = true\n } else if (model.value === true) {\n model.value = false\n } else {\n model.value = undefined\n }\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"state === 'unset' ? 'mixed' : model\"\n :disabled\n :label\n role=\"checkbox\"\n :size\n v-bind=\"SLIDER_PROPS[state]\"\n @click=\"toggle\" />\n</template>\n"],"mappings":""}
@@ -4,7 +4,8 @@ var ScalarTristateToggle_vue_vue_type_script_setup_true_lang_default = /*@__PURE
4
4
  __name: "ScalarTristateToggle",
5
5
  props: /*@__PURE__*/ mergeModels({
6
6
  disabled: { type: Boolean },
7
- label: {}
7
+ label: {},
8
+ size: {}
8
9
  }, {
9
10
  "modelValue": { type: Boolean },
10
11
  "modelModifiers": {}
@@ -45,11 +46,13 @@ var ScalarTristateToggle_vue_vue_type_script_setup_true_lang_default = /*@__PURE
45
46
  "aria-checked": state.value === "unset" ? "mixed" : model.value,
46
47
  disabled: __props.disabled,
47
48
  label: __props.label,
48
- role: "checkbox"
49
+ role: "checkbox",
50
+ size: __props.size
49
51
  }, SLIDER_PROPS[state.value], { onClick: toggle }), null, 16, [
50
52
  "aria-checked",
51
53
  "disabled",
52
- "label"
54
+ "label",
55
+ "size"
53
56
  ]);
54
57
  };
55
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTristateToggle.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","ScalarToggleSlider","_mergeProps"],"sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Tristate Toggle component\n *\n * A switch-style toggle control with three states — unset, on, and off —\n * useful for representing an optional boolean that can also be left\n * unset (e.g. \"inherit\"). Supports a disabled state and accessible\n * labeling.\n *\n * @example\n * <ScalarTristateToggle v-model=\"overridden\" label=\"Override default\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\n\nconst props = defineProps<{\n /** Prevents the toggle from being cycled, and dims it visually. */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n}>()\n\nconst model = defineModel<boolean | undefined>()\n\n/** The current tristate value, derived from the boolean | undefined model. */\nconst state = computed<'unset' | 'on' | 'off'>(() => {\n if (model.value === undefined) {\n return 'unset'\n }\n return model.value ? 'on' : 'off'\n})\n\n/** Slider appearance for each tristate value. */\nconst SLIDER_PROPS = {\n unset: { class: '', thumb: 'center' },\n on: { class: 'bg-green', thumb: 'end' },\n off: { class: 'bg-c-danger', thumb: 'start' },\n} as const\n\n/** Cycles unset -> on -> off -> unset. */\nfunction toggle() {\n if (props.disabled) {\n return\n }\n if (model.value === undefined) {\n model.value = true\n } else if (model.value === true) {\n model.value = false\n } else {\n model.value = undefined\n }\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"state === 'unset' ? 'mixed' : model\"\n :disabled\n :label\n role=\"checkbox\"\n v-bind=\"SLIDER_PROPS[state]\"\n @click=\"toggle\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;EAmBA,MAAM,QAAQ;EAOd,MAAM,QAAQA,SAAgC,SAAA,YAAC;;EAG/C,MAAM,QAAQ,eAAuC;GACnD,IAAI,MAAM,UAAU,KAAA,GAClB,OAAO;GAET,OAAO,MAAM,QAAQ,OAAO;EAC9B,CAAC;;EAGD,MAAM,eAAe;GACnB,OAAO;IAAE,OAAO;IAAI,OAAO;GAAS;GACpC,IAAI;IAAE,OAAO;IAAY,OAAO;GAAM;GACtC,KAAK;IAAE,OAAO;IAAe,OAAO;GAAQ;EAC9C;;EAGA,SAAS,SAAS;GAChB,IAAI,MAAM,UACR;GAEF,IAAI,MAAM,UAAU,KAAA,GAClB,MAAM,QAAQ;QACT,IAAI,MAAM,UAAU,MACzB,MAAM,QAAQ;QAEd,MAAM,QAAQ,KAAA;EAElB;;GAGE,OAAAC,UAAA,GAAAC,YAMoBC,4BANpBC,WAMoB;IALjB,gBAAc,MAAA,UAAK,UAAA,UAAyB,MAAA;IAC5C,UAAA,QAAA;IACA,OAAA,QAAA;IACD,MAAK;GACG,GAAA,aAAa,MAAA,QAAK,EACzB,SAAO,OAAM,CAAA,GAAA,MAAA,IAAA;IAAA;IAAA;IAAA;GAAA,CAAA"}
1
+ {"version":3,"file":"ScalarTristateToggle.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","ScalarToggleSlider","_mergeProps"],"sources":["../../../src/components/ScalarToggle/ScalarTristateToggle.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Tristate Toggle component\n *\n * A switch-style toggle control with three states — unset, on, and off —\n * useful for representing an optional boolean that can also be left\n * unset (e.g. \"inherit\"). Supports a disabled state and accessible\n * labeling.\n *\n * @example\n * <ScalarTristateToggle v-model=\"overridden\" label=\"Override default\" />\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport ScalarToggleSlider from './ScalarToggleSlider.vue'\nimport type { ScalarToggleSize } from './types'\n\nconst props = defineProps<{\n /** Prevents the toggle from being cycled, and dims it visually. */\n disabled?: boolean\n /** Accessible label announced to assistive technology */\n label?: string\n /**\n * Size of the toggle\n *\n * @default 'sm'\n */\n size?: ScalarToggleSize\n}>()\n\nconst model = defineModel<boolean | undefined>()\n\n/** The current tristate value, derived from the boolean | undefined model. */\nconst state = computed<'unset' | 'on' | 'off'>(() => {\n if (model.value === undefined) {\n return 'unset'\n }\n return model.value ? 'on' : 'off'\n})\n\n/** Slider appearance for each tristate value. */\nconst SLIDER_PROPS = {\n unset: { class: '', thumb: 'center' },\n on: { class: 'bg-green', thumb: 'end' },\n off: { class: 'bg-c-danger', thumb: 'start' },\n} as const\n\n/** Cycles unset -> on -> off -> unset. */\nfunction toggle() {\n if (props.disabled) {\n return\n }\n if (model.value === undefined) {\n model.value = true\n } else if (model.value === true) {\n model.value = false\n } else {\n model.value = undefined\n }\n}\n</script>\n<template>\n <ScalarToggleSlider\n :aria-checked=\"state === 'unset' ? 'mixed' : model\"\n :disabled\n :label\n role=\"checkbox\"\n :size\n v-bind=\"SLIDER_PROPS[state]\"\n @click=\"toggle\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAoBA,MAAM,QAAQ;EAad,MAAM,QAAQA,SAAgC,SAAA,YAAC;;EAG/C,MAAM,QAAQ,eAAuC;GACnD,IAAI,MAAM,UAAU,KAAA,GAClB,OAAO;GAET,OAAO,MAAM,QAAQ,OAAO;EAC9B,CAAC;;EAGD,MAAM,eAAe;GACnB,OAAO;IAAE,OAAO;IAAI,OAAO;GAAS;GACpC,IAAI;IAAE,OAAO;IAAY,OAAO;GAAM;GACtC,KAAK;IAAE,OAAO;IAAe,OAAO;GAAQ;EAC9C;;EAGA,SAAS,SAAS;GAChB,IAAI,MAAM,UACR;GAEF,IAAI,MAAM,UAAU,KAAA,GAClB,MAAM,QAAQ;QACT,IAAI,MAAM,UAAU,MACzB,MAAM,QAAQ;QAEd,MAAM,QAAQ,KAAA;EAElB;;GAGE,OAAAC,UAAA,GAAAC,YAOoBC,4BAPpBC,WAOoB;IANjB,gBAAc,MAAA,UAAK,UAAA,UAAyB,MAAA;IAC5C,UAAA,QAAA;IACA,OAAA,QAAA;IACD,MAAK;IACJ,MAAA,QAAA;GACO,GAAA,aAAa,MAAA,QAAK,EACzB,SAAO,OAAM,CAAA,GAAA,MAAA,IAAA;IAAA;IAAA;IAAA;IAAA;GAAA,CAAA"}
@@ -4,5 +4,5 @@ export { default as ScalarToggleInput } from './ScalarToggleInput.vue.js';
4
4
  export { default as ScalarTristateToggle } from './ScalarTristateToggle.vue.js';
5
5
  export { default as ScalarTristateToggleGroup } from './ScalarTristateToggleGroup.vue.js';
6
6
  export { default as ScalarTristateToggleInput } from './ScalarTristateToggleInput.vue.js';
7
- export type { ScalarTristateOption } from './types';
7
+ export type { ScalarToggleSize, ScalarTristateOption } from './types';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AACtF,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA"}
@@ -8,4 +8,11 @@ import type { ScalarCheckboxOption } from '../ScalarCheckboxInput/index.js';
8
8
  export type ScalarTristateOption = ScalarCheckboxOption & {
9
9
  checked: boolean;
10
10
  };
11
+ /**
12
+ * Size of a ScalarToggle or ScalarTristateToggle.
13
+ *
14
+ * `sm` is the compact toggle used in dense lists and menus. `md` is the larger
15
+ * toggle for settings rows that sit alongside full-height form controls.
16
+ */
17
+ export type ScalarToggleSize = 'sm' | 'md';
11
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAA"}
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export { ScalarTeleport, ScalarTeleportRoot, TELEPORT_SYMBOL, useProvideTeleport
40
40
  export { ScalarTextArea } from './components/ScalarTextArea/index.js';
41
41
  export { ScalarTextInput, ScalarTextInputCopy } from './components/ScalarTextInput/index.js';
42
42
  export { ScalarThemeSwatches, useThemeSwatches } from './components/ScalarThemeSwatches/index.js';
43
- export type { ScalarTristateOption } from './components/ScalarToggle/index.js';
43
+ export type { ScalarToggleSize, ScalarTristateOption } from './components/ScalarToggle/index.js';
44
44
  export { ScalarToggle, ScalarToggleGroup, ScalarToggleInput, ScalarTristateToggle, ScalarTristateToggleGroup, ScalarTristateToggleInput, } from './components/ScalarToggle/index.js';
45
45
  export type { ScalarTooltipPlacement, TooltipConfiguration } from './components/ScalarTooltip/index.js';
46
46
  export { ScalarHotkeyTooltip, ScalarTooltip, useTooltip } from './components/ScalarTooltip/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE7E,YAAY,EAAE,gB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U,EAAE,MAAM,4BAA4B,CAAA;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA"}
package/dist/style.css CHANGED
@@ -783,6 +783,10 @@
783
783
  left: 0;
784
784
  }
785
785
 
786
+ .scalar-app .left-0\.5 {
787
+ left: 2px;
788
+ }
789
+
786
790
  .scalar-app .left-1\.75 {
787
791
  left: 7px;
788
792
  }
@@ -1326,10 +1330,6 @@
1326
1330
  width: 66.6667%;
1327
1331
  }
1328
1332
 
1329
- .scalar-app .w-3 {
1330
- width: 12px;
1331
- }
1332
-
1333
1333
  .scalar-app .w-5 {
1334
1334
  width: 20px;
1335
1335
  }
@@ -1338,6 +1338,10 @@
1338
1338
  width: 24px;
1339
1339
  }
1340
1340
 
1341
+ .scalar-app .w-8 {
1342
+ width: 32px;
1343
+ }
1344
+
1341
1345
  .scalar-app .w-12 {
1342
1346
  width: 48px;
1343
1347
  }
@@ -1478,6 +1482,10 @@
1478
1482
  min-width: 24px;
1479
1483
  }
1480
1484
 
1485
+ .scalar-app .min-w-8 {
1486
+ min-width: 32px;
1487
+ }
1488
+
1481
1489
  .scalar-app .min-w-40 {
1482
1490
  min-width: 160px;
1483
1491
  }
@@ -1513,6 +1521,11 @@
1513
1521
  translate: var(--tw-translate-x) var(--tw-translate-y);
1514
1522
  }
1515
1523
 
1524
+ .scalar-app .translate-x-1\.5 {
1525
+ --tw-translate-x: calc(4px * 1.5);
1526
+ translate: var(--tw-translate-x) var(--tw-translate-y);
1527
+ }
1528
+
1516
1529
  .scalar-app .translate-x-1\.25 {
1517
1530
  --tw-translate-x: calc(4px * 1.25);
1518
1531
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -1523,6 +1536,11 @@
1523
1536
  translate: var(--tw-translate-x) var(--tw-translate-y);
1524
1537
  }
1525
1538
 
1539
+ .scalar-app .translate-x-3 {
1540
+ --tw-translate-x: calc(4px * 3);
1541
+ translate: var(--tw-translate-x) var(--tw-translate-y);
1542
+ }
1543
+
1526
1544
  .scalar-app .translate-x-\[14px\] {
1527
1545
  --tw-translate-x: 14px;
1528
1546
  translate: var(--tw-translate-x) var(--tw-translate-y);
@@ -3656,6 +3674,70 @@ to {
3656
3674
  transform: scale(3.5) rotate(360deg);
3657
3675
  }
3658
3676
  }
3677
+
3678
+ /**
3679
+ * A card is a backdrop with its sections lifted off it as surfaces.
3680
+ *
3681
+ * The surface color is worked out from the backdrop instead of being read from another theme
3682
+ * token, so it stays one step lighter than the card whatever a theme does to the card's colors.
3683
+ * That lands on white over the default light backdrop and next to --scalar-background-3 over the
3684
+ * default dark one, and it keeps working for a theme that paints its cards dark in light mode,
3685
+ * where a token picked by color mode would be the wrong way round.
3686
+ *
3687
+ * A control that sits on a surface, such as a copy button, is one step further again. That step
3688
+ * goes toward the text color, so it is lighter than a dark surface and darker than a light one,
3689
+ * and never sinks back to the color of the card behind the surface.
3690
+ *
3691
+ * The variables are resolved here, on the card, so a section that swaps --scalar-background-2 for
3692
+ * its own purposes does not move the surface under the code inside it, and so a theme can set
3693
+ * --scalar-card-surface, --scalar-card-surface-raised or --scalar-card-surface-shadow on
3694
+ * `.scalar-card` without restating a section selector.
3695
+ *
3696
+ * Every rule below is a single class, so any theme or `customCss` rule that names the same
3697
+ * element still wins.
3698
+ */
3699
+ .scalar-card {
3700
+ /* Browsers without relative colors get the light arrangement in both color modes. */
3701
+ --scalar-card-surface: var(--scalar-background-1);
3702
+ --scalar-card-surface-raised: var(--scalar-background-2);
3703
+ /* The theme's own soft shadow and border color, so a theme steers the outline of a surface */
3704
+ --scalar-card-surface-shadow:
3705
+ var(--scalar-shadow-1),
3706
+ 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
3707
+ }
3708
+ @supports (color: oklch(from white l c h)) {
3709
+ .scalar-card {
3710
+ --scalar-card-surface: oklch(
3711
+ from var(--scalar-background-2) calc(l + 0.055) c h
3712
+ );
3713
+ --scalar-card-surface-raised: color-mix(
3714
+ in oklab,
3715
+ var(--scalar-card-surface),
3716
+ var(--scalar-color-1) 8%
3717
+ );
3718
+ }
3719
+ }
3720
+
3721
+ /**
3722
+ * A plain section is a surface lifted off the card. The header and footer are sections too, but
3723
+ * they sit on the card itself, so they are left out here with `:where()` to keep every selector at
3724
+ * a single class: a theme or `customCss` rule on `.scalar-card-content` still wins.
3725
+ */
3726
+ .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {
3727
+ background: var(--scalar-card-surface);
3728
+ /* The card's corner less its padding, so the two curves stay concentric. */
3729
+ border-radius: var(--scalar-radius-xl);
3730
+ box-shadow: var(--scalar-card-surface-shadow);
3731
+ }
3732
+ /* Two surfaces in a row keep the card's padding between them. */
3733
+ :where(.scalar-card-content:not(.scalar-card-header, .scalar-card-footer))
3734
+ + .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {
3735
+ margin-top: 4px;
3736
+ }
3737
+ /* A theme that paints the header or footer gets corners that follow the surface between them. */
3738
+ :where(.scalar-card-header, .scalar-card-footer) {
3739
+ border-radius: var(--scalar-radius-xl);
3740
+ }
3659
3741
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
3660
3742
  :where(pre:has( > code.hljs)) {
3661
3743
  line-height: var(--scalar-code-line-height, 1.4);
@@ -3783,9 +3865,15 @@ to {
3783
3865
  .scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {
3784
3866
  background-color: var(--scalar-background-2);
3785
3867
  }
3868
+ .scalar-code-block.bg-transparent .scalar-code-copy-backdrop {
3869
+ background: var(--scalar-card-surface, transparent);
3870
+ }
3786
3871
  .scalar-code-block.bg-b-2 .scalar-code-copy {
3787
3872
  background-color: var(--scalar-background-3);
3788
3873
  }
3874
+ .scalar-code-block.bg-transparent .scalar-code-copy {
3875
+ background: var(--scalar-card-surface-raised, var(--scalar-background-2));
3876
+ }
3789
3877
 
3790
3878
  .toggle-icon-ellipse[data-v-8f507267] {
3791
3879
  width: 7px;
@@ -83,6 +83,70 @@ to {
83
83
  transform: scale(3.5) rotate(360deg);
84
84
  }
85
85
  }
86
+
87
+ /**
88
+ * A card is a backdrop with its sections lifted off it as surfaces.
89
+ *
90
+ * The surface color is worked out from the backdrop instead of being read from another theme
91
+ * token, so it stays one step lighter than the card whatever a theme does to the card's colors.
92
+ * That lands on white over the default light backdrop and next to --scalar-background-3 over the
93
+ * default dark one, and it keeps working for a theme that paints its cards dark in light mode,
94
+ * where a token picked by color mode would be the wrong way round.
95
+ *
96
+ * A control that sits on a surface, such as a copy button, is one step further again. That step
97
+ * goes toward the text color, so it is lighter than a dark surface and darker than a light one,
98
+ * and never sinks back to the color of the card behind the surface.
99
+ *
100
+ * The variables are resolved here, on the card, so a section that swaps --scalar-background-2 for
101
+ * its own purposes does not move the surface under the code inside it, and so a theme can set
102
+ * --scalar-card-surface, --scalar-card-surface-raised or --scalar-card-surface-shadow on
103
+ * `.scalar-card` without restating a section selector.
104
+ *
105
+ * Every rule below is a single class, so any theme or `customCss` rule that names the same
106
+ * element still wins.
107
+ */
108
+ .scalar-card {
109
+ /* Browsers without relative colors get the light arrangement in both color modes. */
110
+ --scalar-card-surface: var(--scalar-background-1);
111
+ --scalar-card-surface-raised: var(--scalar-background-2);
112
+ /* The theme's own soft shadow and border color, so a theme steers the outline of a surface */
113
+ --scalar-card-surface-shadow:
114
+ var(--scalar-shadow-1),
115
+ 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
116
+ }
117
+ @supports (color: oklch(from white l c h)) {
118
+ .scalar-card {
119
+ --scalar-card-surface: oklch(
120
+ from var(--scalar-background-2) calc(l + 0.055) c h
121
+ );
122
+ --scalar-card-surface-raised: color-mix(
123
+ in oklab,
124
+ var(--scalar-card-surface),
125
+ var(--scalar-color-1) 8%
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * A plain section is a surface lifted off the card. The header and footer are sections too, but
132
+ * they sit on the card itself, so they are left out here with `:where()` to keep every selector at
133
+ * a single class: a theme or `customCss` rule on `.scalar-card-content` still wins.
134
+ */
135
+ .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {
136
+ background: var(--scalar-card-surface);
137
+ /* The card's corner less its padding, so the two curves stay concentric. */
138
+ border-radius: var(--scalar-radius-xl);
139
+ box-shadow: var(--scalar-card-surface-shadow);
140
+ }
141
+ /* Two surfaces in a row keep the card's padding between them. */
142
+ :where(.scalar-card-content:not(.scalar-card-header, .scalar-card-footer))
143
+ + .scalar-card-content:where(:not(.scalar-card-header, .scalar-card-footer)) {
144
+ margin-top: 4px;
145
+ }
146
+ /* A theme that paints the header or footer gets corners that follow the surface between them. */
147
+ :where(.scalar-card-header, .scalar-card-footer) {
148
+ border-radius: var(--scalar-radius-xl);
149
+ }
86
150
  /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
87
151
  :where(pre:has( > code.hljs)) {
88
152
  line-height: var(--scalar-code-line-height, 1.4);
@@ -210,9 +274,15 @@ to {
210
274
  .scalar-code-block.bg-b-2 .scalar-code-copy-backdrop {
211
275
  background-color: var(--scalar-background-2);
212
276
  }
277
+ .scalar-code-block.bg-transparent .scalar-code-copy-backdrop {
278
+ background: var(--scalar-card-surface, transparent);
279
+ }
213
280
  .scalar-code-block.bg-b-2 .scalar-code-copy {
214
281
  background-color: var(--scalar-background-3);
215
282
  }
283
+ .scalar-code-block.bg-transparent .scalar-code-copy {
284
+ background: var(--scalar-card-surface-raised, var(--scalar-background-2));
285
+ }
216
286
 
217
287
  .toggle-icon-ellipse[data-v-8f507267] {
218
288
  width: 7px;
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.34.1",
13
+ "version": "0.35.0",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -216,12 +216,12 @@
216
216
  "@floating-ui/vue": "2.0.1",
217
217
  "@headlessui/tailwindcss": "^0.2.2",
218
218
  "@headlessui/vue": "1.7.23",
219
- "@scalar/code-highlight": "0.4.13",
219
+ "@scalar/code-highlight": "0.4.14",
220
220
  "@scalar/helpers": "0.18.0",
221
221
  "@scalar/highlight": "0.6.0",
222
- "@scalar/icons": "0.7.8",
223
- "@scalar/themes": "0.20.0",
224
- "@scalar/use-hooks": "0.4.25",
222
+ "@scalar/icons": "0.7.9",
223
+ "@scalar/themes": "0.20.1",
224
+ "@scalar/use-hooks": "0.4.26",
225
225
  "@vueuse/core": "15.0.0",
226
226
  "cva": "1.0.0-beta.4",
227
227
  "radix-vue": "^1.9.17",