@scalar/components 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/components/ScalarCard/ScalarCard.vue.d.ts.map +1 -1
  2. package/dist/components/ScalarCard/ScalarCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  3. package/dist/components/ScalarDialog/ScalarDialog.vue.d.ts.map +1 -1
  4. package/dist/components/ScalarDialog/ScalarDialog.vue_vue_type_script_setup_true_lang.js +19 -2
  5. package/dist/components/ScalarDialog/ScalarDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  6. package/dist/components/ScalarModal/ScalarModal.vue.d.ts +0 -2
  7. package/dist/components/ScalarModal/ScalarModal.vue.d.ts.map +1 -1
  8. package/dist/components/ScalarModal/ScalarModal.vue.js +1 -1
  9. package/dist/components/ScalarModal/ScalarModal.vue_vue_type_script_setup_true_lang.js +53 -34
  10. package/dist/components/ScalarModal/ScalarModal.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue.d.ts +3 -0
  12. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue.d.ts.map +1 -1
  13. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js +1 -1
  14. package/dist/components/ScalarSidebar/ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue.d.ts +5 -0
  16. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue.d.ts.map +1 -1
  17. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js +3 -3
  18. package/dist/components/ScalarSidebar/ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts +5 -0
  20. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue.d.ts.map +1 -1
  21. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js +9 -7
  22. package/dist/components/ScalarSidebar/ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue.d.ts +3 -0
  24. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue.d.ts.map +1 -1
  25. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js +1 -1
  26. package/dist/components/ScalarSidebar/ScalarSidebarSearchButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/components/ScalarTeleport/ScalarTeleport.vue.d.ts +2 -1
  28. package/dist/components/ScalarTeleport/ScalarTeleport.vue.d.ts.map +1 -1
  29. package/dist/components/ScalarTeleport/ScalarTeleport.vue_vue_type_script_setup_true_lang.js +47 -4
  30. package/dist/components/ScalarTeleport/ScalarTeleport.vue_vue_type_script_setup_true_lang.js.map +1 -1
  31. package/dist/components/ScalarTooltip/useTooltip.d.ts.map +1 -1
  32. package/dist/components/ScalarTooltip/useTooltip.js +7 -2
  33. package/dist/components/ScalarTooltip/useTooltip.js.map +1 -1
  34. package/dist/style.css +59 -40
  35. package/dist/vue-styles.css +22 -21
  36. package/package.json +5 -4
@@ -1 +1 @@
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
+ {"version":3,"file":"ScalarCard.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCard/ScalarCard.vue"],"names":[],"mappings":"AAmHA;;;;;;;;;;;;;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 +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 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
+ {"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: oklab(from white l a b)) {\n .scalar-card {\n /*\n * The lightness step is taken in oklab, not oklch. Chrome treats the hue of a near-grey color\n * as missing in oklch(from …) but keeps its small chroma, which turned the surfaces of themes\n * with tinted greys pink. Oklab has the same lightness and no hue to lose.\n */\n --scalar-card-surface: oklab(\n from var(--scalar-background-2) calc(l + 0.055) a b\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":"ScalarDialog.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDialog/ScalarDialog.vue"],"names":[],"mappings":"AAuLA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAsIlB,uFAAuF;WAC9E,OAAO;;;;;;IADhB,uFAAuF;WAC9E,OAAO;;;;;IA3Hd,2EAA2E;eAChE,OAAO;EA8LhB,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":"ScalarDialog.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDialog/ScalarDialog.vue"],"names":[],"mappings":"AAiNA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;IAgKlB,uFAAuF;WAC9E,OAAO;;;;;;IADhB,uFAAuF;WAC9E,OAAO;;;;;IArJd,2EAA2E;eAChE,OAAO;EAwNhB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -23,12 +23,29 @@ var ScalarDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
23
23
  const open = useModel(__props, "open");
24
24
  const dialog = cva({ base: [
25
25
  "scalar-dialog m-auto rounded-lg border-0 p-3 shadow-lg",
26
+ "not-open:hidden",
26
27
  "bg-b-1 text-c-1",
27
28
  "backdrop:bg-backdrop dark:backdrop:bg-backdrop-dark",
28
29
  "custom-scroll max-h-[85svh] w-[calc(100dvw-2rem)] max-w-md overflow-auto"
29
30
  ] });
30
31
  const { cx } = useBindCx();
31
32
  const dialogRef = ref(null);
33
+ /**
34
+ * Open the dialog as a modal, or just mark it open where the dialog API is missing.
35
+ *
36
+ * jsdom (and so every consumer's component tests) and very old browsers do not implement
37
+ * `showModal()`. Toggling the `open` attribute there keeps the contents rendering and the model
38
+ * working, without the top layer, focus trap or inert background the real API adds.
39
+ */
40
+ const showModal = (element) => {
41
+ if (typeof element.showModal === "function") element.showModal();
42
+ else element.setAttribute("open", "");
43
+ };
44
+ /** Close the dialog, falling back to removing the `open` attribute like {@link showModal}. */
45
+ const closeDialog = (element) => {
46
+ if (typeof element.close === "function") element.close();
47
+ else element.removeAttribute("open");
48
+ };
32
49
  const { lock, unlock } = useScrollLock();
33
50
  /** Whether the dialog was open on the last run of the bridge, so `close` fires once per close. */
34
51
  let wasOpen = false;
@@ -44,11 +61,11 @@ var ScalarDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
44
61
  const element = dialogRef.value;
45
62
  if (!element) return;
46
63
  if (open.value) {
47
- if (!element.open) element.showModal();
64
+ if (!element.open) showModal(element);
48
65
  lock(element);
49
66
  wasOpen = true;
50
67
  } else {
51
- if (element.open) element.close();
68
+ if (element.open) closeDialog(element);
52
69
  unlock();
53
70
  if (wasOpen) emit("close");
54
71
  wasOpen = false;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarDialog.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_withKeys","_createBlock","ScalarTeleportRoot","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarDialog/ScalarDialog.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Dialog\n *\n * A modal dialog built on the native `<dialog>` element. It calls `showModal()`\n * under the hood, so the dialog is promoted to the browser top layer (escaping\n * ancestor stacking, overflow, and transform contexts), traps and restores focus,\n * makes the rest of the page inert, and closes on Escape — all natively, with no\n * teleport. It also locks page scrolling while open, and gives popovers inside it a\n * teleport target within the dialog so they render above it rather than under the\n * top layer.\n *\n * Control it with `v-model:open` and compose the contents with the default slot.\n * Restyle or resize it by passing your own `class`; the defaults are intentionally\n * minimal so consumers compose rather than configure.\n *\n * Give the dialog an accessible name, ideally by pointing `aria-labelledby` at its\n * visible heading so screen readers announce the same title sighted users see.\n *\n * @example\n * <ScalarDialog v-model:open=\"open\">\n * <h2>Title</h2>\n * <p>Some content</p>\n * </ScalarDialog>\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { ref, watchPostEffect } from 'vue'\n\nimport { ScalarTeleportRoot } from '../ScalarTeleport'\nimport type { ScalarDialogProps } from './types'\nimport { useBackdropClick } from './useBackdropClick'\nimport { useScrollLock } from './useScrollLock'\n\nconst { persist = false } = defineProps<ScalarDialogProps>()\n\nconst emit = defineEmits<{\n /** Emitted whenever the dialog closes, whether via Escape, a backdrop click, or `open` being set to false. */\n (e: 'close'): void\n}>()\n\ndefineSlots<{\n /** The dialog contents. Compose your own header, body, and footer here. */\n default(): unknown\n}>()\n\n/** Whether the dialog is open. Drives the native `showModal()` and `close()` calls. */\nconst open = defineModel<boolean>('open', { default: false })\n\nconst dialog = cva({\n base: [\n // Reset the native dialog chrome and center it within the top layer\n 'scalar-dialog m-auto rounded-lg border-0 p-3 shadow-lg',\n // Surface colors\n 'bg-b-1 text-c-1',\n // Theme the native ::backdrop via Tailwind's backdrop variant\n 'backdrop:bg-backdrop dark:backdrop:bg-backdrop-dark',\n // Constrain the size and let long content scroll\n 'custom-scroll max-h-[85svh] w-[calc(100dvw-2rem)] max-w-md overflow-auto',\n ],\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n\nconst dialogRef = ref<HTMLDialogElement | null>(null)\n\nconst { lock, unlock } = useScrollLock()\n\n/** Whether the dialog was open on the last run of the bridge, so `close` fires once per close. */\nlet wasOpen = false\n\n/**\n * Puppet the native dialog from the reactive `open` model.\n *\n * `watchPostEffect` runs after the DOM updates, so the slotted content (and any\n * `autofocus` target) is mounted before `showModal()` moves focus into it. The\n * guards against `dialog.open` avoid the `InvalidStateError` the browser throws\n * when `showModal()` is called on an already-open dialog.\n */\nwatchPostEffect(() => {\n const element = dialogRef.value\n if (!element) {\n return\n }\n\n if (open.value) {\n if (!element.open) {\n element.showModal()\n }\n lock(element)\n wasOpen = true\n } else {\n if (element.open) {\n element.close()\n }\n unlock()\n // Emit here rather than from the native `close` event, which is queued and never\n // arrives if the dialog is reopened before it fires\n if (wasOpen) {\n emit('close')\n }\n wasOpen = false\n }\n})\n\n/**\n * Mirror native closes (a form submit, or the browser force-closing the dialog) back into the model.\n *\n * The `close` event is queued rather than fired synchronously, so when the dialog is closed and\n * reopened in quick succession the event lands after it is open again. Ignoring it while the\n * dialog is open keeps that stale event from closing it.\n */\nconst handleClose = (): void => {\n if (dialogRef.value?.open) {\n return\n }\n open.value = false\n}\n\n/**\n * Close on Escape, unless something inside the dialog already handled it.\n *\n * Child widgets such as listboxes and comboboxes use Escape to close themselves and mark the event\n * as handled, so the dialog leaves those alone. The same goes for Escape cancelling an IME\n * composition, which should not also close the dialog. Stopping propagation means only the innermost of\n * several nested dialogs closes. Preventing the default also stops a search input from clearing\n * its value on the same keypress that dismisses the dialog.\n */\nconst handleEscape = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || event.isComposing) {\n return\n }\n event.preventDefault()\n event.stopPropagation()\n open.value = false\n}\n\n/**\n * Route other close requests, such as the Android back gesture, through the model.\n *\n * The browser would otherwise close the dialog itself. Going through `open` keeps every close on\n * the same path, so the scroll lock is released and the contents unmount in step.\n */\nconst handleCancel = (event: Event): void => {\n event.preventDefault()\n open.value = false\n}\n\n/**\n * Close when the backdrop is clicked. The composable ignores text-selection drags\n * and keyboard-activated controls; setting `open` to false lets the puppet bridge\n * run the native `close()` so the flow matches Escape and programmatic closes.\n */\nconst { handlePointerDown, handleClick } = useBackdropClick(dialogRef, () => {\n open.value = false\n})\n</script>\n\n<template>\n <dialog\n ref=\"dialogRef\"\n v-bind=\"cx(dialog())\"\n @cancel=\"handleCancel\"\n @click=\"handleClick\"\n @close=\"handleClose\"\n @keydown.esc=\"handleEscape\"\n @pointerdown=\"handlePointerDown\">\n <ScalarTeleportRoot v-if=\"persist || open\">\n <slot />\n </ScalarTeleportRoot>\n </dialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,OAAO;;EAWb,MAAM,OAAOA,SAAoB,SAAC,MAA0B;EAE5D,MAAM,SAAS,IAAI,EACjB,MAAM;GAEJ;GAEA;GAEA;GAEA;EACF,EACF,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;EAEzB,MAAM,YAAY,IAA8B,IAAI;EAEpD,MAAM,EAAE,MAAM,WAAW,cAAc;;EAGvC,IAAI,UAAU;;;;;;;;;EAUd,sBAAsB;GACpB,MAAM,UAAU,UAAU;GAC1B,IAAI,CAAC,SACH;GAGF,IAAI,KAAK,OAAO;IACd,IAAI,CAAC,QAAQ,MACX,QAAQ,UAAU;IAEpB,KAAK,OAAO;IACZ,UAAU;GACZ,OAAO;IACL,IAAI,QAAQ,MACV,QAAQ,MAAM;IAEhB,OAAO;IAGP,IAAI,SACF,KAAK,OAAO;IAEd,UAAU;GACZ;EACF,CAAC;;;;;;;;EASD,MAAM,oBAA0B;GAC9B,IAAI,UAAU,OAAO,MACnB;GAEF,KAAK,QAAQ;EACf;;;;;;;;;;EAWA,MAAM,gBAAgB,UAA+B;GACnD,IAAI,MAAM,oBAAoB,MAAM,aAClC;GAEF,MAAM,eAAe;GACrB,MAAM,gBAAgB;GACtB,KAAK,QAAQ;EACf;;;;;;;EAQA,MAAM,gBAAgB,UAAuB;GAC3C,MAAM,eAAe;GACrB,KAAK,QAAQ;EACf;;;;;;EAOA,MAAM,EAAE,mBAAmB,gBAAgB,iBAAiB,iBAAiB;GAC3E,KAAK,QAAQ;EACf,CAAC;;GAIC,OAAAC,UAAA,GAAAC,mBAWS,UAXTC,WAWS;IAVH,SAAA;IAAJ,KAAI;GACI,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,MAAA,CAAM,CAAA,CAAA,GAAA;IAChB,UAAQ;IACR,SAAK,OAAA,OAAA,OAAA,MAAE,GAAA,SAAAA,MAAA,WAAA,KAAAA,MAAA,WAAA,CAAA,CAAA,GAAA,IAAA;IACP,SAAO;IACP,WAAOC,SAAM,cAAY,CAAA,KAAA,CAAA;IACzB,eAAW,OAAA,OAAA,OAAA,MAAE,GAAA,SAAAD,MAAA,iBAAA,KAAAA,MAAA,iBAAA,CAAA,CAAA,GAAA,IAAA;G,KACY,QAAA,WAAW,KAAA,SAArCH,UAAA,GAAAK,YAEqBF,MAAAG,0BAAA,GAAA,EAAA,KAAA,EAAA,GAAA;IADnB,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarDialog.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_withKeys","_createBlock","ScalarTeleportRoot","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarDialog/ScalarDialog.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Dialog\n *\n * A modal dialog built on the native `<dialog>` element. It calls `showModal()`\n * under the hood, so the dialog is promoted to the browser top layer (escaping\n * ancestor stacking, overflow, and transform contexts), traps and restores focus,\n * makes the rest of the page inert, and closes on Escape — all natively, with no\n * teleport. It also locks page scrolling while open, and gives popovers inside it a\n * teleport target within the dialog so they render above it rather than under the\n * top layer.\n *\n * Control it with `v-model:open` and compose the contents with the default slot.\n * Restyle or resize it by passing your own `class`; the defaults are intentionally\n * minimal so consumers compose rather than configure.\n *\n * Give the dialog an accessible name, ideally by pointing `aria-labelledby` at its\n * visible heading so screen readers announce the same title sighted users see.\n *\n * @example\n * <ScalarDialog v-model:open=\"open\">\n * <h2>Title</h2>\n * <p>Some content</p>\n * </ScalarDialog>\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\nimport { ref, watchPostEffect } from 'vue'\n\nimport { ScalarTeleportRoot } from '../ScalarTeleport'\nimport type { ScalarDialogProps } from './types'\nimport { useBackdropClick } from './useBackdropClick'\nimport { useScrollLock } from './useScrollLock'\n\nconst { persist = false } = defineProps<ScalarDialogProps>()\n\nconst emit = defineEmits<{\n /** Emitted whenever the dialog closes, whether via Escape, a backdrop click, or `open` being set to false. */\n (e: 'close'): void\n}>()\n\ndefineSlots<{\n /** The dialog contents. Compose your own header, body, and footer here. */\n default(): unknown\n}>()\n\n/** Whether the dialog is open. Drives the native `showModal()` and `close()` calls. */\nconst open = defineModel<boolean>('open', { default: false })\n\nconst dialog = cva({\n base: [\n // Reset the native dialog chrome and center it within the top layer\n 'scalar-dialog m-auto rounded-lg border-0 p-3 shadow-lg',\n // Keep a closed dialog hidden even when a consumer class sets its display, such as `flex`\n 'not-open:hidden',\n // Surface colors\n 'bg-b-1 text-c-1',\n // Theme the native ::backdrop via Tailwind's backdrop variant\n 'backdrop:bg-backdrop dark:backdrop:bg-backdrop-dark',\n // Constrain the size and let long content scroll\n 'custom-scroll max-h-[85svh] w-[calc(100dvw-2rem)] max-w-md overflow-auto',\n ],\n})\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n\nconst dialogRef = ref<HTMLDialogElement | null>(null)\n\n/**\n * Open the dialog as a modal, or just mark it open where the dialog API is missing.\n *\n * jsdom (and so every consumer's component tests) and very old browsers do not implement\n * `showModal()`. Toggling the `open` attribute there keeps the contents rendering and the model\n * working, without the top layer, focus trap or inert background the real API adds.\n */\nconst showModal = (element: HTMLDialogElement): void => {\n if (typeof element.showModal === 'function') {\n element.showModal()\n } else {\n element.setAttribute('open', '')\n }\n}\n\n/** Close the dialog, falling back to removing the `open` attribute like {@link showModal}. */\nconst closeDialog = (element: HTMLDialogElement): void => {\n if (typeof element.close === 'function') {\n element.close()\n } else {\n element.removeAttribute('open')\n }\n}\n\nconst { lock, unlock } = useScrollLock()\n\n/** Whether the dialog was open on the last run of the bridge, so `close` fires once per close. */\nlet wasOpen = false\n\n/**\n * Puppet the native dialog from the reactive `open` model.\n *\n * `watchPostEffect` runs after the DOM updates, so the slotted content (and any\n * `autofocus` target) is mounted before `showModal()` moves focus into it. The\n * guards against `dialog.open` avoid the `InvalidStateError` the browser throws\n * when `showModal()` is called on an already-open dialog.\n */\nwatchPostEffect(() => {\n const element = dialogRef.value\n if (!element) {\n return\n }\n\n if (open.value) {\n if (!element.open) {\n showModal(element)\n }\n lock(element)\n wasOpen = true\n } else {\n if (element.open) {\n closeDialog(element)\n }\n unlock()\n // Emit here rather than from the native `close` event, which is queued and never\n // arrives if the dialog is reopened before it fires\n if (wasOpen) {\n emit('close')\n }\n wasOpen = false\n }\n})\n\n/**\n * Mirror native closes (a form submit, or the browser force-closing the dialog) back into the model.\n *\n * The `close` event is queued rather than fired synchronously, so when the dialog is closed and\n * reopened in quick succession the event lands after it is open again. Ignoring it while the\n * dialog is open keeps that stale event from closing it.\n */\nconst handleClose = (): void => {\n if (dialogRef.value?.open) {\n return\n }\n open.value = false\n}\n\n/**\n * Close on Escape, unless something inside the dialog already handled it.\n *\n * Child widgets such as listboxes and comboboxes use Escape to close themselves and mark the event\n * as handled, so the dialog leaves those alone. The same goes for Escape cancelling an IME\n * composition, which should not also close the dialog. Stopping propagation means only the innermost of\n * several nested dialogs closes. Preventing the default also stops a search input from clearing\n * its value on the same keypress that dismisses the dialog.\n */\nconst handleEscape = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || event.isComposing) {\n return\n }\n event.preventDefault()\n event.stopPropagation()\n open.value = false\n}\n\n/**\n * Route other close requests, such as the Android back gesture, through the model.\n *\n * The browser would otherwise close the dialog itself. Going through `open` keeps every close on\n * the same path, so the scroll lock is released and the contents unmount in step.\n */\nconst handleCancel = (event: Event): void => {\n event.preventDefault()\n open.value = false\n}\n\n/**\n * Close when the backdrop is clicked. The composable ignores text-selection drags\n * and keyboard-activated controls; setting `open` to false lets the puppet bridge\n * run the native `close()` so the flow matches Escape and programmatic closes.\n */\nconst { handlePointerDown, handleClick } = useBackdropClick(dialogRef, () => {\n open.value = false\n})\n</script>\n\n<template>\n <dialog\n ref=\"dialogRef\"\n v-bind=\"cx(dialog())\"\n @cancel=\"handleCancel\"\n @click=\"handleClick\"\n @close=\"handleClose\"\n @keydown.esc=\"handleEscape\"\n @pointerdown=\"handlePointerDown\">\n <ScalarTeleportRoot v-if=\"persist || open\">\n <slot />\n </ScalarTeleportRoot>\n </dialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,OAAO;;EAWb,MAAM,OAAOA,SAAoB,SAAC,MAA0B;EAE5D,MAAM,SAAS,IAAI,EACjB,MAAM;GAEJ;GAEA;GAEA;GAEA;GAEA;EACF,EACF,CAAC;EAGD,MAAM,EAAE,OAAO,UAAU;EAEzB,MAAM,YAAY,IAA8B,IAAI;;;;;;;;EASpD,MAAM,aAAa,YAAqC;GACtD,IAAI,OAAO,QAAQ,cAAc,YAC/B,QAAQ,UAAU;QAElB,QAAQ,aAAa,QAAQ,EAAE;EAEnC;;EAGA,MAAM,eAAe,YAAqC;GACxD,IAAI,OAAO,QAAQ,UAAU,YAC3B,QAAQ,MAAM;QAEd,QAAQ,gBAAgB,MAAM;EAElC;EAEA,MAAM,EAAE,MAAM,WAAW,cAAc;;EAGvC,IAAI,UAAU;;;;;;;;;EAUd,sBAAsB;GACpB,MAAM,UAAU,UAAU;GAC1B,I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_WithSlots<import("vue").DefineComponent<{
37
37
  onClose?: (() => any) | undefined;
38
38
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
39
  default?: (props: {}) => any;
40
- } & {
41
- default?: (props: {}) => any;
42
40
  }>;
43
41
  type __VLS_WithSlots<T, S> = T & {
44
42
  new (): {
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarModal/ScalarModal.vue"],"names":[],"mappings":"AAyOA;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAIzC,+CAA+C;AAC/C,wBAAgB,QAAQ;;;;EAUvB;AACD,QAAA,MAAM,YAAY;WAIT,UAAU,CAAC,OAAO,QAAQ,CAAC;YAC1B,MAAM;gBACF,MAAM;eACP,MAAM;;;;;;WAHV,UAAU,CAAC,OAAO,QAAQ,CAAC;YAC1B,MAAM;gBACF,MAAM;eACP,MAAM;;;;;;cAuOL,CAAC,KAAK,IAAiB,KAAK,GAAG;;cAC/B,CAAC,KAAK,IAAiB,KAAK,GAAG;EAUzC,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":"ScalarModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarModal/ScalarModal.vue"],"names":[],"mappings":"AA6OA;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAIzC,+CAA+C;AAC/C,wBAAgB,QAAQ;;;;EAUvB;AACD,QAAA,MAAM,YAAY;WAIT,UAAU,CAAC,OAAO,QAAQ,CAAC;YAC1B,MAAM;gBACF,MAAM;eACP,MAAM;;;;;;WAHV,UAAU,CAAC,OAAO,QAAQ,CAAC;YAC1B,MAAM;gBACF,MAAM;eACP,MAAM;;;;;;cAuNL,CAAC,KAAK,IAAiB,KAAK,GAAG;EAUzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import ScalarModal_vue_vue_type_script_setup_true_lang_default, { useModal } fro
2
2
  /* empty css */
3
3
  import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  // src/components/ScalarModal/ScalarModal.vue
5
- var ScalarModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ScalarModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b002945c"]]);
5
+ var ScalarModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(ScalarModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-09866bb7"]]);
6
6
  export { ScalarModal_default as default, useModal };
7
7
 
8
8
  //# sourceMappingURL=ScalarModal.vue.js.map
@@ -1,10 +1,11 @@
1
+ import ScalarDialog_default from "../ScalarDialog/ScalarDialog.vue.js";
1
2
  import ScalarIconButton_default from "../ScalarIconButton/ScalarIconButton.vue.js";
2
3
  import { cva, cx } from "@scalar/use-hooks/useBindCx";
3
- import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, reactive, renderSlot, toDisplayString, unref, withCtx } from "vue";
4
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, reactive, renderSlot, toDisplayString, unref, useId, withCtx } from "vue";
4
5
  import { ScalarIconX } from "@scalar/icons";
5
- import { Dialog, DialogPanel, DialogTitle } from "@headlessui/vue";
6
6
  // src/components/ScalarModal/ScalarModal.vue?vue&type=script&setup=true&lang.ts
7
- var _hoisted_1 = {
7
+ var _hoisted_1 = ["id"];
8
+ var _hoisted_2 = {
8
9
  key: 0,
9
10
  class: "close-button fixed top-2 right-2 z-10"
10
11
  };
@@ -46,8 +47,29 @@ var ScalarModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
46
47
  emits: ["close"],
47
48
  setup(__props, { emit: __emit }) {
48
49
  const emit = __emit;
50
+ const titleId = useId();
51
+ /** Whether the modal is the full-height side panel rather than a centered panel */
52
+ const isFull = computed(() => __props.size === "full");
53
+ /** The full size dialog is an invisible full-viewport layer the side panel sits in */
54
+ const FULL_LAYOUT = "scalar-modal-layout-full m-0 h-dvh max-h-dvh w-dvw max-w-none overflow-visible rounded-none bg-transparent p-0 shadow-none backdrop:bg-transparent dark:backdrop:bg-transparent";
55
+ /**
56
+ * Sync user dismissals from the dialog back into the modal state.
57
+ *
58
+ * Only `false` updates come through here, since the dialog never opens itself. Programmatic
59
+ * closes via `state.hide()` do not emit `close`, which matches how the modal has always behaved.
60
+ */
61
+ const handleOpenChange = (open) => {
62
+ if (!open) {
63
+ __props.state.hide();
64
+ emit("close");
65
+ }
66
+ };
49
67
  const modal = cva({
50
- base: ["scalar-modal", "flex flex-col relative mb-0 rounded-lg bg-b-1 p-0 text-left leading-snug text-c-1 opacity-0 w-[calc(100vw-12px)] md:w-[calc(100vw-16px)] lg:w-[calc(100vw-32px)]"].join(" "),
68
+ base: [
69
+ "scalar-modal",
70
+ "flex flex-col mb-0 rounded-lg bg-b-1 p-0 text-left leading-snug text-c-1 opacity-0 w-[calc(100vw-12px)] md:w-[calc(100vw-16px)] lg:w-[calc(100vw-32px)]",
71
+ "overflow-visible"
72
+ ].join(" "),
51
73
  variants: {
52
74
  size: {
53
75
  xxs: "mt-[20svh] max-h-[60svh] max-w-[360px]",
@@ -85,45 +107,42 @@ var ScalarModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
85
107
  }
86
108
  });
87
109
  return (_ctx, _cache) => {
88
- return openBlock(), createBlock(unref(Dialog), {
110
+ return openBlock(), createBlock(unref(ScalarDialog_default), {
111
+ "aria-labelledby": __props.title ? unref(titleId) : void 0,
112
+ class: normalizeClass(isFull.value ? FULL_LAYOUT : unref(modal)({
113
+ size: __props.size,
114
+ variant: __props.variant
115
+ })),
89
116
  open: __props.state.open,
90
- onClose: _cache[1] || (_cache[1] = () => {
91
- __props.state.hide();
92
- emit("close");
93
- })
117
+ style: normalizeStyle(isFull.value ? void 0 : { maxWidth: __props.maxWidth }),
118
+ "onUpdate:open": handleOpenChange
94
119
  }, {
95
- default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(cx)(__props.size === "full" ? "scalar-modal-layout-full" : "scalar-modal-layout", "fixed top-0 left-0 flex items-start justify-center", "z-overlay h-dvh w-dvw", "bg-backdrop dark:bg-backdrop-dark opacity-0", __props.size === "full" && "flex")) }, [createVNode(unref(DialogPanel), {
96
- class: normalizeClass(unref(modal)({
120
+ default: withCtx(() => [createElementVNode("div", {
121
+ class: normalizeClass(isFull.value ? unref(modal)({
97
122
  size: __props.size,
98
123
  variant: __props.variant
99
- })),
100
- style: normalizeStyle({ maxWidth: __props.maxWidth })
101
- }, {
102
- default: withCtx(() => [__props.title ? (openBlock(), createBlock(unref(DialogTitle), {
103
- key: 0,
104
- class: "scalar-modal-header text-c-1 m-0 -mb-1 rounded-lg px-3 pt-3 text-left text-sm font-medium"
105
- }, {
106
- default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
107
- _: 1
108
- })) : createCommentVNode("", true), __props.size === "full" ? (openBlock(), createElementBlock("div", {
109
- key: 1,
110
- class: normalizeClass(__props.bodyClass)
111
- }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 2)) : (openBlock(), createElementBlock("div", {
112
- key: 2,
113
- class: normalizeClass(unref(cx)(unref(body)({
114
- size: __props.size,
115
- variant: __props.variant
116
- }), __props.bodyClass))
117
- }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 2))]),
118
- _: 3
119
- }, 8, ["class", "style"]), __props.size === "full" ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(ScalarIconButton_default), {
124
+ }) : "contents"),
125
+ style: normalizeStyle(isFull.value ? { maxWidth: __props.maxWidth } : void 0)
126
+ }, [__props.title ? (openBlock(), createElementBlock("h2", {
127
+ key: 0,
128
+ id: unref(titleId),
129
+ class: "scalar-modal-header text-c-1 m-0 -mb-1 rounded-lg px-3 pt-3 text-left text-sm font-medium"
130
+ }, toDisplayString(__props.title), 9, _hoisted_1)) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(isFull.value ? __props.bodyClass : unref(cx)(unref(body)({
131
+ size: __props.size,
132
+ variant: __props.variant
133
+ }), __props.bodyClass)) }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 2)], 6), isFull.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(ScalarIconButton_default), {
120
134
  class: "hover:bg-b-3 focus:outline-none",
121
135
  icon: unref(ScalarIconX),
122
136
  label: "Close modal",
123
137
  onClick: _cache[0] || (_cache[0] = ($event) => __props.state.hide())
124
- }, null, 8, ["icon"])])) : createCommentVNode("", true)], 2)]),
138
+ }, null, 8, ["icon"])])) : createCommentVNode("", true)]),
125
139
  _: 3
126
- }, 8, ["open"]);
140
+ }, 8, [
141
+ "aria-labelledby",
142
+ "class",
143
+ "open",
144
+ "style"
145
+ ]);
127
146
  };
128
147
  }
129
148
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarModal.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createElementVNode","_normalizeClass","_createVNode","_normalizeStyle","_createTextVNode","_toDisplayString","_createElementBlock","_renderSlot","ScalarIconButton"],"sources":["../../../src/components/ScalarModal/ScalarModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Dialog, DialogPanel, DialogTitle } from '@headlessui/vue'\nimport { ScalarIconX } from '@scalar/icons'\nimport { cva, cx } from '@scalar/use-hooks/useBindCx'\nimport type { VariantProps } from 'cva'\nimport { reactive } from 'vue'\n\nimport { ScalarIconButton } from '../ScalarIconButton'\n\ntype ModalVariants = VariantProps<typeof modal>\n\nconst { size = 'md' } = defineProps<{\n state: ReturnType<typeof useModal>\n title?: string\n bodyClass?: string\n maxWidth?: string\n size?: ModalVariants['size']\n variant?: ModalVariants['variant']\n}>()\n\nconst emit = defineEmits<{\n (event: 'close'): void\n}>()\n\nconst modal = cva({\n base: [\n 'scalar-modal',\n 'flex flex-col relative mb-0 rounded-lg bg-b-1 p-0 text-left leading-snug text-c-1 opacity-0 w-[calc(100vw-12px)] md:w-[calc(100vw-16px)] lg:w-[calc(100vw-32px)]',\n ].join(' '),\n variants: {\n size: {\n xxs: 'mt-[20svh] max-h-[60svh] max-w-[360px]',\n xs: 'mt-[20svh] max-h-[60svh] max-w-[480px]',\n sm: 'mt-[20svh] max-h-[60svh] max-w-[540px]',\n md: 'mt-[20svh] max-h-[60svh] max-w-[640px]',\n lg: 'm-auto max-h-[80svh] max-w-[800px]',\n xl: 'm-auto max-h-[90svh] max-w-[1000px]',\n full: 'full-size-styles max-h-dvh mt-0 lg:w-full',\n },\n variant: {\n form: 'scalar-modal-form',\n search: 'scalar-modal-search mt-[15svh] max-h-[60svh] max-w-[540px]',\n error: 'scalar-modal-error',\n },\n },\n})\nconst body = cva({\n base: ['scalar-modal-body', 'relative flex-1 min-h-0 p-3'].join(' '),\n variants: {\n variant: {\n form: 'overflow-visible',\n search: 'flex flex-col !m-0 overflow-hidden p-0',\n error: 'overflow-y-scroll',\n },\n size: {\n xxs: '',\n xs: '',\n sm: '',\n md: '',\n lg: '',\n xl: 'm-0 p-0',\n full: ' rounded-none',\n },\n },\n})\n</script>\n<script lang=\"ts\">\n/**\n * Scalar Modal component\n *\n * A dialog overlay with configurable size and variant.\n * Use the {@link useModal} hook to control the open state.\n *\n * @example\n * <ScalarModal :state=\"modal\" title=\"My Modal\">\n * Modal content\n * </ScalarModal>\n */\nexport default {}\n\n/** Hook for creating a reactive modal state */\nexport function useModal() {\n return reactive({\n open: false,\n show() {\n this.open = true\n },\n hide() {\n this.open = false\n },\n })\n}\n</script>\n<template>\n <Dialog\n :open=\"state.open\"\n @close=\"\n () => {\n state.hide()\n emit('close')\n }\n \">\n <div\n :class=\"\n cx(\n size === 'full' ? 'scalar-modal-layout-full' : 'scalar-modal-layout',\n 'fixed top-0 left-0 flex items-start justify-center',\n 'z-overlay h-dvh w-dvw',\n 'bg-backdrop dark:bg-backdrop-dark opacity-0',\n size === 'full' && 'flex',\n )\n \">\n <DialogPanel\n :class=\"modal({ size, variant })\"\n :style=\"{ maxWidth }\">\n <DialogTitle\n v-if=\"title\"\n class=\"scalar-modal-header text-c-1 m-0 -mb-1 rounded-lg px-3 pt-3 text-left text-sm font-medium\">\n {{ title }}\n </DialogTitle>\n <div\n v-if=\"size === 'full'\"\n :class=\"bodyClass\">\n <slot />\n </div>\n <div\n v-else\n :class=\"cx(body({ size, variant }), bodyClass)\">\n <slot />\n </div>\n </DialogPanel>\n <div\n v-if=\"size === 'full'\"\n class=\"close-button fixed top-2 right-2 z-10\">\n <ScalarIconButton\n class=\"hover:bg-b-3 focus:outline-none\"\n :icon=\"ScalarIconX\"\n label=\"Close modal\"\n @click=\"state.hide()\" />\n </div>\n </div>\n </Dialog>\n</template>\n<style scoped>\n@reference '../../style.css';\n\n.scalar-modal-layout {\n animation: fadein-layout ease-in-out 0.3s forwards;\n}\n.scalar-modal {\n animation: fadein-modal ease-in-out 0.3s forwards;\n animation-delay: 0.1s;\n box-shadow: var(--scalar-shadow-2);\n transform: translate3d(0, 10px, 0);\n}\n.scalar-modal-layout-full {\n opacity: 1 !important;\n background: transparent !important;\n}\n.modal-content-search .modal-body {\n padding: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: 440px;\n}\n/*\n * Allow the modal to fill more space on\n * very short (or very zoomed in) screens\n */\n@variant zoomed {\n .scalar-modal-layout .scalar-modal {\n margin-top: 5svh;\n max-height: 90svh;\n }\n}\n@keyframes fadein-layout {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes fadein-modal {\n 0% {\n opacity: 0;\n transform: translate3d(0, 10px, 0);\n }\n 100% {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n.full-size-styles {\n transform: translate3d(0, 0, 0);\n animation: fadein-layout ease-in-out 0.3s forwards;\n max-height: 100% !important;\n top: 0 !important;\n left: 0;\n position: absolute !important;\n margin: initial;\n border-radius: 0 !important;\n background-color: var(--scalar-background-1) !important;\n box-shadow: none !important;\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n@variant md {\n .full-size-styles {\n width: 50dvw !important;\n }\n}\n.full-size-styles:after {\n content: '';\n width: 50dvw;\n height: 100dvh;\n position: absolute;\n right: -50dvw;\n top: 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8EA,IAAA,cAAe,CAAC;;AAGhB,SAAgB,WAAW;CACzB,OAAO,SAAS;EACd,MAAM;EACN,OAAO;GACL,KAAK,OAAO;EACd;EACA,OAAO;GACL,KAAK,OAAO;EACd;CACF,CAAC;AACH;;;;;;;;;;;;;;EAvEA,MAAM,OAAO;EAIb,MAAM,QAAQ,IAAI;GAChB,MAAM,CACJ,gBACA,kKACF,CAAC,CAAC,KAAK,GAAG;GACV,UAAU;IACR,MAAM;KACJ,KAAK;KACL,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,MAAM;IACR;IACA,SAAS;KACP,MAAM;KACN,QAAQ;KACR,OAAO;IACT;GACF;EACF,CAAC;EACD,MAAM,OAAO,IAAI;GACf,MAAM,CAAC,qBAAqB,6BAA6B,CAAC,CAAC,KAAK,GAAG;GACnE,UAAU;IACR,SAAS;KACP,MAAM;KACN,QAAQ;KACR,OAAO;IACT;IACA,MAAM;KACJ,KAAK;KACL,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,IAAI;KACJ,MAAM;IACR;GACF;EACF,CAAC;;GA8BC,OAAAA,UAAA,GAAAC,YA+CSC,MAAA,MAAA,GAAA;IA9CN,MA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_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","ScalarDialog","_normalizeClass","_normalizeStyle","_withCtx","_createElementVNode","_createElementBlock","_toDisplayString","_renderSlot","_createVNode","ScalarIconButton"],"sources":["../../../src/components/ScalarModal/ScalarModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconX } from '@scalar/icons'\nimport { cva, cx } from '@scalar/use-hooks/useBindCx'\nimport type { VariantProps } from 'cva'\nimport { computed, reactive, useId } from 'vue'\n\nimport { ScalarDialog } from '../ScalarDialog'\nimport { ScalarIconButton } from '../ScalarIconButton'\n\ntype ModalVariants = VariantProps<typeof modal>\n\nconst { size = 'md', state } = defineProps<{\n state: ReturnType<typeof useModal>\n title?: string\n bodyClass?: string\n maxWidth?: string\n size?: ModalVariants['size']\n variant?: ModalVariants['variant']\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when the user dismisses the modal with Escape or a backdrop click. */\n (event: 'close'): void\n}>()\n\nconst titleId = useId()\n\n/** Whether the modal is the full-height side panel rather than a centered panel */\nconst isFull = computed(() => size === 'full')\n\n/** The full size dialog is an invisible full-viewport layer the side panel sits in */\nconst FULL_LAYOUT =\n 'scalar-modal-layout-full m-0 h-dvh max-h-dvh w-dvw max-w-none overflow-visible rounded-none bg-transparent p-0 shadow-none backdrop:bg-transparent dark:backdrop:bg-transparent'\n\n/**\n * Sync user dismissals from the dialog back into the modal state.\n *\n * Only `false` updates come through here, since the dialog never opens itself. Programmatic\n * closes via `state.hide()` do not emit `close`, which matches how the modal has always behaved.\n */\nconst handleOpenChange = (open: boolean): void => {\n if (!open) {\n state.hide()\n emit('close')\n }\n}\n\nconst modal = cva({\n base: [\n 'scalar-modal',\n 'flex flex-col mb-0 rounded-lg bg-b-1 p-0 text-left leading-snug text-c-1 opacity-0 w-[calc(100vw-12px)] md:w-[calc(100vw-16px)] lg:w-[calc(100vw-32px)]',\n // Let form popovers overflow the panel rather than scrolling the whole dialog\n 'overflow-visible',\n ].join(' '),\n variants: {\n size: {\n xxs: 'mt-[20svh] max-h-[60svh] max-w-[360px]',\n xs: 'mt-[20svh] max-h-[60svh] max-w-[480px]',\n sm: 'mt-[20svh] max-h-[60svh] max-w-[540px]',\n md: 'mt-[20svh] max-h-[60svh] max-w-[640px]',\n lg: 'm-auto max-h-[80svh] max-w-[800px]',\n xl: 'm-auto max-h-[90svh] max-w-[1000px]',\n full: 'full-size-styles max-h-dvh mt-0 lg:w-full',\n },\n variant: {\n form: 'scalar-modal-form',\n search: 'scalar-modal-search mt-[15svh] max-h-[60svh] max-w-[540px]',\n error: 'scalar-modal-error',\n },\n },\n})\nconst body = cva({\n base: ['scalar-modal-body', 'relative flex-1 min-h-0 p-3'].join(' '),\n variants: {\n variant: {\n form: 'overflow-visible',\n search: 'flex flex-col !m-0 overflow-hidden p-0',\n error: 'overflow-y-scroll',\n },\n size: {\n xxs: '',\n xs: '',\n sm: '',\n md: '',\n lg: '',\n xl: 'm-0 p-0',\n full: ' rounded-none',\n },\n },\n})\n</script>\n<script lang=\"ts\">\n/**\n * Scalar Modal component\n *\n * A dialog overlay with configurable size and variant.\n * Use the {@link useModal} hook to control the open state.\n *\n * @example\n * <ScalarModal :state=\"modal\" title=\"My Modal\">\n * Modal content\n * </ScalarModal>\n */\nexport default {}\n\n/** Hook for creating a reactive modal state */\nexport function useModal() {\n return reactive({\n open: false,\n show() {\n this.open = true\n },\n hide() {\n this.open = false\n },\n })\n}\n</script>\n<template>\n <ScalarDialog\n :aria-labelledby=\"title ? titleId : undefined\"\n :class=\"isFull ? FULL_LAYOUT : modal({ size, variant })\"\n :open=\"state.open\"\n :style=\"isFull ? undefined : { maxWidth }\"\n @update:open=\"handleOpenChange\">\n <!-- The full size is a side panel, so the dialog fills the viewport and the panel sits inside\n it. Every other size is the panel itself, and the wrapper steps out of the layout. -->\n <div\n :class=\"isFull ? modal({ size, variant }) : 'contents'\"\n :style=\"isFull ? { maxWidth } : undefined\">\n <h2\n v-if=\"title\"\n :id=\"titleId\"\n class=\"scalar-modal-header text-c-1 m-0 -mb-1 rounded-lg px-3 pt-3 text-left text-sm font-medium\">\n {{ title }}\n </h2>\n <div :class=\"isFull ? bodyClass : cx(body({ size, variant }), bodyClass)\">\n <slot />\n </div>\n </div>\n <div\n v-if=\"isFull\"\n class=\"close-button fixed top-2 right-2 z-10\">\n <ScalarIconButton\n class=\"hover:bg-b-3 focus:outline-none\"\n :icon=\"ScalarIconX\"\n label=\"Close modal\"\n @click=\"state.hide()\" />\n </div>\n </ScalarDialog>\n</template>\n<style scoped>\n@reference '../../style.css';\n\n.scalar-modal::backdrop {\n animation: fadein-layout ease-in-out 0.3s forwards;\n}\n.scalar-modal {\n animation: fadein-modal ease-in-out 0.3s forwards;\n animation-delay: 0.1s;\n box-shadow: var(--scalar-shadow-2);\n transform: translate3d(0, 10px, 0);\n}\n.modal-content-search .modal-body {\n padding: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n max-height: 440px;\n}\n/*\n * Allow the modal to fill more space on\n * very short (or very zoomed in) screens\n */\n@variant zoomed {\n .scalar-modal:not(.full-size-styles) {\n margin-top: 5svh;\n max-height: 90svh;\n }\n}\n@keyframes fadein-layout {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes fadein-modal {\n 0% {\n opacity: 0;\n transform: translate3d(0, 10px, 0);\n }\n 100% {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n.full-size-styles {\n transform: translate3d(0, 0, 0);\n animation: fadein-layout ease-in-out 0.3s forwards;\n max-height: 100% !important;\n top: 0 !important;\n left: 0;\n position: absolute !important;\n margin: initial;\n border-radius: 0 !important;\n background-color: var(--scalar-background-1) !important;\n box-shadow: none !important;\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n@variant md {\n .full-size-styles {\n width: 50dvw !important;\n }\n}\n.full-size-styles:after {\n content: '';\n width: 50dvw;\n height: 100dvh;\n position: absolute;\n right: -50dvw;\n top: 0;\n}\n</style>\n"],"mappings":";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AK,QAAA,SAAQ,CAAA;IACtC,iBAAa;;IAGd,SAAAC,cAYM,CAZNC,mBAYM,OAAA;KAXH,OAAKH,eAAE,OAAA,QAASF,MAAA,KAAA,CAAK,CAAA;MAAA,MAAG,QAAA;MAAI,SAAE,QAAA;KAAO,CAAA,IAAA,UAAA;KACrC,OAAKG,eAAE,OAAA,QAAM,EAAA,UAAK,QAAA,SAAQ,IAAK,KAAA,CAAS;I,IAEjC,QAAA,SADRL,UAAA,GAAAQ,mBAKK,MAAA;;KAHF,IAAIN,MAAA,OAAA;KACL,OAAM;IACH,GAAAO,gBAAA,QAAA,KAAK,GAAA,GAAA,UAAA,K,8BAEVF,mBAEM,OAAA,EAFA,OAAKH,eAAE,OAAA,QAAS,QAAA,YAAYF,MAAA,EAAA,CAAE,CAACA,MAAA,IAAA,CAAI,CAAA;KAAA,MAAG,QAAA;KAAI,SAAE,QAAA;IAAO,CAAA,GAAK,QAAA,SAAS,CAAA,E,IACrEQ,WAAQ,KAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,IAAA,C,YAIJ,OAAA,SADRV,UAAA,GAAAQ,mBAQM,OARN,YAQM,CALJG,YAI0BT,MAAAU,wBAAA,GAAA;KAHxB,OAAM;KACL,MAAMV,MAAA,WAAA;KACP,OAAM;KACL,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,MAAM,KAAI"}
@@ -20,6 +20,9 @@ import type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types';
20
20
  * <!-- After the button text -->
21
21
  * </template>
22
22
  * </ScalarSidebarButton>
23
+ *
24
+ * Stable hooks for styling from outside the component:
25
+ * - `.scalar-sidebar-button` targets the button
23
26
  */
24
27
  declare const _default: typeof __VLS_export;
25
28
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"names":[],"mappings":"AAsGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAG/E;;;;;;;;;;;;;;;;;;;;;GAqBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,mWAsId,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":"ScalarSidebarButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAG/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,mWAsId,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -28,7 +28,7 @@ var ScalarSidebarButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
28
28
  },
29
29
  setup(__props) {
30
30
  const variants = cva({
31
- base: ["group/button peer/button flex items-stretch rounded p-2", "font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word"],
31
+ base: ["scalar-sidebar-button group/button peer/button flex items-stretch rounded p-2", "font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word"],
32
32
  variants: {
33
33
  active: { true: "text-sidebar-c-active font-sidebar-active" },
34
34
  disabled: { true: "cursor-auto" },
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot","_createVNode","ScalarSidebarIndent","_createElementBlock","ScalarIconLegacyAdapter","_createElementVNode"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Button component\n *\n * Provide a styled link for the ScalarSidebar or similar, supports\n * the same props and slots as ScalarSidebarItem\n *\n * This is used internally by the ScalarSidebarItem component\n *\n * If you're looking to create items in ScalarSidebarItems\n * you probably want the ScalarSidebarItem component\n *\n * @example\n * <ScalarSidebarButton>\n * <template #icon>\n * <!-- Overrides the icon slot -->\n * </template>\n * <!-- Button text -->\n * <template #aside>\n * <!-- After the button text -->\n * </template>\n * </ScalarSidebarButton>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport { ScalarIconLegacyAdapter } from '../ScalarIcon'\nimport ScalarSidebarIndent from './ScalarSidebarIndent.vue'\nimport type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types'\n\nconst { is = 'a', indent = 0 } = defineProps<ScalarSidebarItemProps>()\n\ndefineSlots<ScalarSidebarButtonSlots>()\n\nconst variants = cva({\n base: [\n 'group/button peer/button flex items-stretch rounded p-2',\n 'font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word',\n ],\n variants: {\n active: { true: 'text-sidebar-c-active font-sidebar-active' },\n disabled: { true: 'cursor-auto' },\n selected: {\n true: 'cursor-auto bg-sidebar-b-active text-sidebar-c-active font-sidebar-active',\n },\n },\n compoundVariants: [\n {\n selected: false,\n disabled: false,\n active: false,\n class: 'hover:bg-sidebar-b-hover hover:text-sidebar-c-hover',\n },\n {\n selected: false,\n disabled: false,\n active: true,\n class: 'hover:bg-sidebar-b-hover',\n },\n ],\n defaultVariants: { selected: false, disabled: false, active: false },\n})\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n :aria-current=\"selected ? 'page' : undefined\"\n :type=\"is === 'button' ? 'button' : undefined\"\n v-bind=\"cx(variants({ selected, disabled, active }))\">\n <slot name=\"indent\">\n <ScalarSidebarIndent\n class=\"-my-2\"\n :disabled\n :indent\n :selected />\n </slot>\n <div\n v-if=\"icon || $slots.icon\"\n class=\"mr-1 flex h-lh items-center *:size-4\">\n <slot name=\"icon\">\n <ScalarIconLegacyAdapter\n v-if=\"icon\"\n :icon=\"icon\" />\n </slot>\n </div>\n <div class=\"group/button-label min-w-0 flex-1\">\n <slot />\n </div>\n <slot name=\"aside\" />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,MAAM,WAAW,IAAI;GACnB,MAAM,CACJ,2DACA,yEACF;GACA,UAAU;IACR,QAAQ,EAAE,MAAM,4CAA4C;IAC5D,UAAU,EAAE,MAAM,cAAc;IAChC,UAAU,EACR,MAAM,4EACR;GACF;GACA,kBAAkB,CAChB;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,GACA;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,CACF;GACA,iBAAiB;IAAE,UAAU;IAAO,UAAU;IAAO,QAAQ;GAAM;EACrE,CAAC;EAED,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAC,UAAA,GAAAC,YAyBYC,wBAxBL,QAAA,EAAE,GADTC,WAyBY;IAvBT,gBAAc,QAAA,WAAQ,SAAY,KAAA;IAClC,MAAM,QAAA,OAAE,WAAA,WAA2B,KAAA;GAC5B,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA;IAAA,UAAG,QAAA;IAAQ,UAAE,QAAA;IAAQ,QAAE,QAAA;GAAM,CAAA,CAAA,CAAA,GAAA;IAChD,SAAAC,cAMO;KANPC,WAMO,KAAA,QAAA,UAAA,CAAA,SAAA,CALLC,YAIcC,6BAAA;MAHZ,OAAM;MACL,UAAA,QAAA;MACA,QAAA,QAAA;MACA,UAAA,QAAA;;;;;;KAGG,QAAA,QAAQT,KAAAA,OAAO,QADvBC,UAAA,GAAAS,mBAQM,OARN,YAQM,CALJH,WAIO,KAAA,QAAA,QAAA,CAAA,SAAA,CAFG,QAAA,QADRN,UAAA,GAAAC,YAEiBG,MAAAM,+BAAA,GAAA;;MAAd,MAAM,QAAA;;KAGbC,mBAEM,OAFN,YAEM,CADJL,WAAQ,KAAA,QAAA,SAAA,C;KAEVA,WAAqB,KAAA,QAAA,OAAA"}
1
+ {"version":3,"file":"ScalarSidebarButton.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot","_createVNode","ScalarSidebarIndent","_createElementBlock","ScalarIconLegacyAdapter","_createElementVNode"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarButton.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Button component\n *\n * Provide a styled link for the ScalarSidebar or similar, supports\n * the same props and slots as ScalarSidebarItem\n *\n * This is used internally by the ScalarSidebarItem component\n *\n * If you're looking to create items in ScalarSidebarItems\n * you probably want the ScalarSidebarItem component\n *\n * @example\n * <ScalarSidebarButton>\n * <template #icon>\n * <!-- Overrides the icon slot -->\n * </template>\n * <!-- Button text -->\n * <template #aside>\n * <!-- After the button text -->\n * </template>\n * </ScalarSidebarButton>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-button` targets the button\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { cva, useBindCx } from '@scalar/use-hooks/useBindCx'\n\nimport { ScalarIconLegacyAdapter } from '../ScalarIcon'\nimport ScalarSidebarIndent from './ScalarSidebarIndent.vue'\nimport type { ScalarSidebarButtonSlots, ScalarSidebarItemProps } from './types'\n\nconst { is = 'a', indent = 0 } = defineProps<ScalarSidebarItemProps>()\n\ndefineSlots<ScalarSidebarButtonSlots>()\n\nconst variants = cva({\n base: [\n 'scalar-sidebar-button group/button peer/button flex items-stretch rounded p-2',\n 'font-sidebar text-base/4 text-sidebar-c-2 no-underline wrap-break-word',\n ],\n variants: {\n active: { true: 'text-sidebar-c-active font-sidebar-active' },\n disabled: { true: 'cursor-auto' },\n selected: {\n true: 'cursor-auto bg-sidebar-b-active text-sidebar-c-active font-sidebar-active',\n },\n },\n compoundVariants: [\n {\n selected: false,\n disabled: false,\n active: false,\n class: 'hover:bg-sidebar-b-hover hover:text-sidebar-c-hover',\n },\n {\n selected: false,\n disabled: false,\n active: true,\n class: 'hover:bg-sidebar-b-hover',\n },\n ],\n defaultVariants: { selected: false, disabled: false, active: false },\n})\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n :aria-current=\"selected ? 'page' : undefined\"\n :type=\"is === 'button' ? 'button' : undefined\"\n v-bind=\"cx(variants({ selected, disabled, active }))\">\n <slot name=\"indent\">\n <ScalarSidebarIndent\n class=\"-my-2\"\n :disabled\n :indent\n :selected />\n </slot>\n <div\n v-if=\"icon || $slots.icon\"\n class=\"mr-1 flex h-lh items-center *:size-4\">\n <slot name=\"icon\">\n <ScalarIconLegacyAdapter\n v-if=\"icon\"\n :icon=\"icon\" />\n </slot>\n </div>\n <div class=\"group/button-label min-w-0 flex-1\">\n <slot />\n </div>\n <slot name=\"aside\" />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,MAAM,WAAW,IAAI;GACnB,MAAM,CACJ,iFACA,yEACF;GACA,UAAU;IACR,QAAQ,EAAE,MAAM,4CAA4C;IAC5D,UAAU,EAAE,MAAM,cAAc;IAChC,UAAU,EACR,MAAM,4EACR;GACF;GACA,kBAAkB,CAChB;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,GACA;IACE,UAAU;IACV,UAAU;IACV,QAAQ;IACR,OAAO;GACT,CACF;GACA,iBAAiB;IAAE,UAAU;IAAO,UAAU;IAAO,QAAQ;GAAM;EACrE,CAAC;EAED,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAC,UAAA,GAAAC,YAyBYC,wBAxBL,QAAA,EAAE,GADTC,WAyBY;IAvBT,gBAAc,QAAA,WAAQ,SAAY,KAAA;IAClC,MAAM,QAAA,OAAE,WAAA,WAA2B,KAAA;GAC5B,GAAAC,MAAA,EAAA,CAAE,CAACA,MAAA,QAAA,CAAQ,CAAA;IAAA,UAAG,QAAA;IAAQ,UAAE,QAAA;IAAQ,QAAE,QAAA;GAAM,CAAA,CAAA,CAAA,GAAA;IAChD,SAAAC,cAMO;KANPC,WAMO,KAAA,QAAA,UAAA,CAAA,SAAA,CALLC,YAIcC,6BAAA;MAHZ,OAAM;MACL,UAAA,QAAA;MACA,QAAA,QAAA;MACA,UAAA,QAAA;;;;;;KAGG,QAAA,QAAQT,KAAAA,OAAO,QADvBC,UAAA,GAAAS,mBAQM,OARN,YAQM,CALJH,WAIO,KAAA,QAAA,QAAA,CAAA,SAAA,CAFG,QAAA,QADRN,UAAA,GAAAC,YAEiBG,MAAAM,+BAAA,GAAA;;MAAd,MAAM,QAAA;;KAGbC,mBAEM,OAFN,YAEM,CADJL,WAAQ,KAAA,QAAA,SAAA,C;KAEVA,WAAqB,KAAA,QAAA,OAAA"}
@@ -11,6 +11,11 @@ import type { Component } from 'vue';
11
11
  * <ScalarSidebarItem>...</ScalarSidebarItem>
12
12
  * <ScalarSidebarItem>...</ScalarSidebarItem>
13
13
  * </ScalarSidebarItems>
14
+ *
15
+ * Stable hooks for styling from outside the component:
16
+ * - `.scalar-sidebar-items` targets the list
17
+ * - `[data-nested-open]` is set while a nested list inside it is open,
18
+ * which slides this list out of view
14
19
  */
15
20
  declare const _default: typeof __VLS_export;
16
21
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"names":[],"mappings":"AAwEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;GAYG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;SAEX,SAAS,GAAG,MAAM;;SAAlB,SAAS,GAAG,MAAM;;cAwDX,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":"ScalarSidebarItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;;;;;;GAiBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;SAEX,SAAS,GAAG,MAAM;;SAAlB,SAAS,GAAG,MAAM;;cA0DX,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,6 +1,6 @@
1
1
  import { useSidebarNestedItems } from "./useSidebarNestedItems.js";
2
2
  import { useBindCx } from "@scalar/use-hooks/useBindCx";
3
- import { createBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
3
+ import { createBlock, defineComponent, mergeProps, openBlock, renderSlot, resolveDynamicComponent, unref, withCtx } from "vue";
4
4
  var ScalarSidebarItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5
5
  inheritAttrs: false,
6
6
  __name: "ScalarSidebarItems",
@@ -16,10 +16,10 @@ var ScalarSidebarItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
16
16
  const { open } = useSidebarNestedItems();
17
17
  const { cx } = useBindCx();
18
18
  return (_ctx, _cache) => {
19
- return openBlock(), createBlock(resolveDynamicComponent(__props.is), normalizeProps(guardReactiveProps(unref(cx)("group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300", unref(open) ? "-translate-x-full" : "translate-x-0"))), {
19
+ return openBlock(), createBlock(resolveDynamicComponent(__props.is), mergeProps(unref(cx)("scalar-sidebar-items group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300", unref(open) ? "-translate-x-full" : "translate-x-0"), { "data-nested-open": unref(open) || void 0 }), {
20
20
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
21
21
  _: 3
22
- }, 16);
22
+ }, 16, ["data-nested-open"]);
23
23
  };
24
24
  }
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeProps","_guardReactiveProps","_unref","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Items component\n *\n * A base container for ScalarSidebarItem(s), renders as\n * a `<ul>` by default to meet accessibility requirements\n *\n * @example\n * <ScalarSidebarItems>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </ScalarSidebarItems>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nimport { useSidebarNestedItems } from './useSidebarNestedItems'\n\nconst { is = 'ul' } = defineProps<{\n is?: Component | string\n}>()\n\nconst { open } = useSidebarNestedItems()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300',\n open ? '-translate-x-full' : 'translate-x-0',\n )\n \">\n <slot />\n </component>\n</template>\n<style>\n@reference \"../../style.css\";\n\n/* Hide the buttons from the keyboard when a nested item is open */\n.group\\/items.-translate-x-full .group\\/button {\n /* Required to prevent the button from being focused */\n display: none;\n /* Required to prevent the button from taking up scroll space */\n max-height: 0;\n\n transition-property: display, max-height;\n transition-behavior: allow-discrete;\n transition-duration: 0s;\n transition-delay: 300ms;\n}\n\n/* Show the buttons within a nested item when it is open */\n.group\\/item.group\\/nested-items-open\n > *\n > .group\\/items.translate-x-0\n .group\\/button {\n max-height: calc(infinity * 1px);\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;EA0BA,MAAM,EAAE,SAAS,sBAAsB;EAGvC,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YASYC,wBARL,QAAA,EAAE,GAAAC,eAAAC,mBACQC,MAAA,EAAA,CAAE,C,4GAA8HA,MAAA,IAAA,IAAI,sBAAA,e;IAMnJ,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
1
+ {"version":3,"file":"ScalarSidebarItems.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_withCtx","_renderSlot"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Items component\n *\n * A base container for ScalarSidebarItem(s), renders as\n * a `<ul>` by default to meet accessibility requirements\n *\n * @example\n * <ScalarSidebarItems>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </ScalarSidebarItems>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-items` targets the list\n * - `[data-nested-open]` is set while a nested list inside it is open,\n * which slides this list out of view\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { useBindCx } from '@scalar/use-hooks/useBindCx'\nimport type { Component } from 'vue'\n\nimport { useSidebarNestedItems } from './useSidebarNestedItems'\n\nconst { is = 'ul' } = defineProps<{\n is?: Component | string\n}>()\n\nconst { open } = useSidebarNestedItems()\n\ndefineOptions({ inheritAttrs: false })\nconst { cx } = useBindCx()\n</script>\n<template>\n <component\n :is=\"is\"\n v-bind=\"\n cx(\n 'scalar-sidebar-items group/items relative flex flex-col p-(--scalar-sidebar-padding) gap-px transition-transform duration-300',\n open ? '-translate-x-full' : 'translate-x-0',\n )\n \"\n :data-nested-open=\"open || undefined\">\n <slot />\n </component>\n</template>\n<style>\n@reference \"../../style.css\";\n\n/*\n * Hide the buttons from the keyboard when a nested item is open\n *\n * group/button still matches so custom buttons passed through a #button slot\n * keep working. :is() keeps the specificity of a single class.\n */\n.scalar-sidebar-items[data-nested-open]\n :is(.scalar-sidebar-button, .group\\/button) {\n /* Required to prevent the button from being focused */\n display: none;\n /* Required to prevent the button from taking up scroll space */\n max-height: 0;\n\n transition-property: display, max-height;\n transition-behavior: allow-discrete;\n transition-duration: 0s;\n transition-delay: 300ms;\n}\n\n/* Show the buttons within a nested item when it is open */\n.scalar-sidebar-nested-items[data-open]\n > *\n > .scalar-sidebar-items:not([data-nested-open])\n :is(.scalar-sidebar-button, .group\\/button) {\n max-height: calc(infinity * 1px);\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;EA+BA,MAAM,EAAE,SAAS,sBAAsB;EAGvC,MAAM,EAAE,OAAO,UAAU;;GAGvB,OAAAA,UAAA,GAAAC,YAUYC,wBATL,QAAA,EAAE,GADTC,WAEiBC,MAAA,EAAA,CAAE,C,iIAAmJA,MAAA,IAAA,IAAI,sBAAA,e,KAMvK,oBAAkBA,MAAA,IAAA,KAAQ,KAAA,E;IAC3B,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,C"}
@@ -13,6 +13,11 @@
13
13
  * <ScalarSidebarItem>...</ScalarSidebarItem>
14
14
  * </template>
15
15
  * </ScalarSidebarNestedItems>
16
+ *
17
+ * Stable hooks for styling from outside the component:
18
+ * - `.scalar-sidebar-nested-items` targets the item, with `[data-open]` while open
19
+ * - `.scalar-sidebar-nested-items-panel` targets the layer the opened list is
20
+ * drawn in, positioned over the parent list
16
21
  */
17
22
  declare const _default: typeof __VLS_export;
18
23
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarNestedItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"names":[],"mappings":"AAyNA;;;;;;;;;;;;;;;GAeG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;;;;;WA+FT,OAAO;;;;;;;;;;;WAAP,OAAO;;;;;;IA9Ed,qCAAqC;cACzB,MAAM,OAAO;IACzB,iCAAiC;aACtB,MAAM,OAAO;IACxB,wBAAwB;WACf,MAAM,OAAO;IACtB,8BAA8B;YACpB,MAAM,OAAO;IACvB,+BAA+B;WACtB,MAAM,OAAO;IACtB,qCAAqC;mBACtB,MAAM,OAAO;IAC5B,mCAAmC;YACzB,MAAM,OAAO;EAmUrB,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":"ScalarSidebarNestedItems.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"names":[],"mappings":"AAkOA;;;;;;;;;;;;;;;;;;;;GAoBG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;;;;;WA+FT,OAAO;;;;;;;;;;;WAAP,OAAO;;;;;;IA9Ed,qCAAqC;cACzB,MAAM,OAAO;IACzB,iCAAiC;aACtB,MAAM,OAAO;IACxB,wBAAwB;WACf,MAAM,OAAO;IACtB,8BAA8B;YACpB,MAAM,OAAO;IACvB,+BAA+B;WACtB,MAAM,OAAO;IACtB,qCAAqC;mBACtB,MAAM,OAAO;IAC5B,mCAAmC;YACzB,MAAM,OAAO;EAyUrB,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -8,11 +8,12 @@ import { useSidebarNestedItem } from "./useSidebarNestedItems.js";
8
8
  import { Transition, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, openBlock, ref, renderSlot, unref, useModel, useTemplateRef, withCtx } from "vue";
9
9
  import { ScalarIconArrowRight, ScalarIconCaretLeft } from "@scalar/icons";
10
10
  // src/components/ScalarSidebar/ScalarSidebarNestedItems.vue?vue&type=script&setup=true&lang.ts
11
- var _hoisted_1 = {
11
+ var _hoisted_1 = ["data-open"];
12
+ var _hoisted_2 = {
12
13
  key: 0,
13
- class: "absolute inset-0 translate-x-full"
14
+ class: "scalar-sidebar-nested-items-panel absolute inset-0 translate-x-full"
14
15
  };
15
- var _hoisted_2 = { class: "bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)" };
16
+ var _hoisted_3 = { class: "bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)" };
16
17
  var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
17
18
  inheritAttrs: false,
18
19
  __name: "ScalarSidebarNestedItems",
@@ -75,7 +76,8 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
75
76
  return openBlock(), createElementBlock("li", {
76
77
  ref_key: "el",
77
78
  ref: el,
78
- class: normalizeClass(["group/item group/nested-items contents", { "group/nested-items-open": open.value }]),
79
+ class: normalizeClass(["scalar-sidebar-nested-items group/item group/nested-items contents", { "group/nested-items-open": open.value }]),
80
+ "data-open": open.value || void 0,
79
81
  style: normalizeStyle({ "--nested-items-offset": `${offset.value}px` })
80
82
  }, [renderSlot(_ctx.$slots, "button", {}, () => [createVNode(ScalarSidebarButton_default, mergeProps({
81
83
  is: "button",
@@ -106,8 +108,8 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
106
108
  onEnter: onOpen,
107
109
  onLeave: onClose
108
110
  }, {
109
- default: withCtx(() => [open.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(ScalarSidebarItems_default, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
110
- default: withCtx(() => [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "back", {}, () => [createVNode(ScalarSidebarButton_default, {
111
+ default: withCtx(() => [open.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(ScalarSidebarItems_default, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
112
+ default: withCtx(() => [createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "back", {}, () => [createVNode(ScalarSidebarButton_default, {
111
113
  is: "button",
112
114
  class: "text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1",
113
115
  onClick: handleBack
@@ -119,7 +121,7 @@ var ScalarSidebarNestedItems_vue_vue_type_script_setup_true_lang_default = /*@__
119
121
  _: 3
120
122
  }, 16)])) : createCommentVNode("", true)]),
121
123
  _: 3
122
- })], 6);
124
+ })], 14, _hoisted_1);
123
125
  };
124
126
  }
125
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_renderSlot","_createVNode","ScalarSidebarButton","_mergeProps","_unref","_createSlots","_withCtx","_Transition","ScalarSidebarItems","_normalizeProps","_guardReactiveProps","_createElementVNode","_createTextVNode","ScalarSidebarSpacer","_createBlock","ScalarSidebarLoading"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Nested Items component\n *\n * A provides list of items thats presented over the parent list\n * Needs to be nested inside a ScalarSidebarItems component\n *\n * @example\n * <ScalarSidebarNestedItems v-model=\"open\">\n * <!-- Item text -->\n * <template #items>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </template>\n * </ScalarSidebarNestedItems>\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconArrowRight, ScalarIconCaretLeft } from '@scalar/icons'\nimport { nextTick, ref, useTemplateRef } from 'vue'\n\nimport { findScrollContainer } from './findScrollContainer'\nimport ScalarSidebarButton from './ScalarSidebarButton.vue'\nimport ScalarSidebarItems from './ScalarSidebarItems.vue'\nimport ScalarSidebarLoading from './ScalarSidebarLoading.vue'\nimport ScalarSidebarSpacer from './ScalarSidebarSpacer.vue'\nimport type { ScalarSidebarGroupProps } from './types'\nimport { useSidebarGroups } from './useSidebarGroups'\nimport { useSidebarNestedItem } from './useSidebarNestedItems'\n\nconst { controlled } = defineProps<ScalarSidebarGroupProps>()\n\nconst emit = defineEmits<{\n /** Emitted when the nested item button is clicked */\n (e: 'click', event: MouseEvent): void\n /** Emitted when the back button is clicked */\n (e: 'back', event: MouseEvent): void\n}>()\n\nconst open = defineModel<boolean>('open', { default: false })\nuseSidebarNestedItem(() => open.value)\n\ndefineSlots<{\n /** The text content of the button */\n 'default'?: () => unknown\n /** Override the entire button */\n 'button'?: () => unknown\n /** Override the icon */\n 'icon'?: () => unknown\n /** Override the aside slot */\n 'aside'?: () => unknown\n /** Override the back button */\n 'back'?: () => unknown\n /** Override the back button label */\n 'back-label'?: () => unknown\n /** The list of sidebar subitems */\n 'items'?: () => unknown\n}>()\n\nconst { level } = useSidebarGroups({ reset: true })\n\n/** The root element ref */\nconst el = useTemplateRef('el')\n\n/** How far down to offset the nested items by when animating them in */\nconst offset = ref(0)\n\n// Transition hooks\n\nfunction onOpen() {\n // Calculate how far down the nearest scroll container is scrolled\n // We offset the nested items by this amount when animating them\n // in so they appear in line with the parent items list.\n offset.value = findScrollContainer(el.value).scrollTop ?? 0\n\n // Focus the first button in the nested items\n nextTick(() =>\n el.value\n ?.querySelector<HTMLButtonElement>('button:not([aria-expanded=\"true\"])')\n ?.focus({ preventScroll: true }),\n )\n}\nfunction onOpened() {\n /** Reset the scroll position of the scroll container after opening */\n findScrollContainer(el.value).scrollTop = 0\n}\nfunction onClose() {\n nextTick(() => {\n el.value?.querySelector('button')?.focus({ preventScroll: true })\n findScrollContainer(el.value).scrollTop = offset.value\n })\n}\n\ndefineOptions({ inheritAttrs: false })\n\n/** Handle the click event for the nested items button */\nconst handleClick = (event: MouseEvent) => {\n // Bubble up the click event\n emit('click', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = true\n }\n}\n\n/** Handle the back button click event */\nconst handleBack = (event: MouseEvent) => {\n // Bubble up the back event\n emit('back', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = false\n }\n}\n</script>\n<template>\n <li\n ref=\"el\"\n class=\"group/item group/nested-items contents\"\n :class=\"{ 'group/nested-items-open': open }\"\n :style=\"{ '--nested-items-offset': `${offset}px` }\">\n <slot name=\"button\">\n <ScalarSidebarButton\n is=\"button\"\n :aria-expanded=\"open\"\n :disabled\n :icon\n :indent=\"level\"\n :selected\n v-bind=\"$attrs\"\n @click=\"handleClick\">\n <template\n v-if=\"$slots.icon\"\n #icon>\n <slot name=\"icon\" />\n </template>\n <slot />\n <template #aside>\n <slot name=\"aside\">\n <ScalarIconArrowRight class=\"text-sidebar-c-2 size-4\" />\n </slot>\n </template>\n </ScalarSidebarButton>\n </slot>\n <!-- Make sure the div is around for the entire transition -->\n <Transition\n :duration=\"300\"\n enterActiveClass=\"top-(--nested-items-offset)!\"\n leaveActiveClass=\"top-(--nested-items-offset)!\"\n @afterEnter=\"onOpened\"\n @enter=\"onOpen\"\n @leave=\"onClose\">\n <div\n v-if=\"open\"\n class=\"absolute inset-0 translate-x-full\">\n <ScalarSidebarItems v-bind=\"$attrs\">\n <div\n class=\"bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)\">\n <slot name=\"back\">\n <ScalarSidebarButton\n is=\"button\"\n class=\"text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1\"\n @click=\"handleBack\">\n <template #icon>\n <ScalarIconCaretLeft class=\"text-sidebar-c-2 -m-px size-4\" />\n </template>\n <slot name=\"back-label\">Back</slot>\n </ScalarSidebarButton>\n </slot>\n <ScalarSidebarSpacer class=\"h-3\" />\n </div>\n <ScalarSidebarLoading v-if=\"loading\" />\n <slot\n v-else\n name=\"items\" />\n </ScalarSidebarItems>\n </div>\n </Transition>\n </li>\n</template>\n\n<style>\n@reference \"../../style.css\";\n\n.animate-sidebar-border-bottom {\n animation: border-bottom forwards;\n animation-timeline: scroll();\n animation-range-end: 1px;\n}\n\n@keyframes border-bottom {\n from {\n border-bottom-width: 0;\n }\n to {\n border-bottom-width: var(--scalar-border-width);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCA,MAAM,OAAO;EA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AAW,CAAA,GAAAY,YAAA;IAOR,OAAKC,cAGP,CAFPN,WAEO,KAAA,QAAA,SAAA,CAAA,SAAA,CADLC,YAAwDG,MAAA,oBAAA,GAAA,EAAlC,OAAM,0BAAyB,CAAA,C;IAHzD,SAAAE,cAAQ,CAARN,WAAQ,KAAA,QAAA,SAAA,C;;G,IAJAN,KAAAA,OAAO,O;IACZ,MAAA;IACD,IAAAY,cAAoB,CAApBN,WAAoB,KAAA,QAAA,MAAA,C;;;;;;;;G,MAW1BC,YAgCaM,YAAA;IA/BV,UAAU;IACX,kBAAiB;IACjB,kBAAiB;IAChB,cAAY;IACZ,SAAO;IACP,SAAO;;IACR,SAAAD,cAwBM,CAvBE,KAAA,SADRV,UAAA,GAAAC,mBAwBM,OAxBN,YAwBM,CArBJI,YAoBqBO,4BAAAC,eAAAC,mBApBOjB,KAAAA,MAAM,CAAA,GAAA;KAChC,SAAAa,cAcM,CAdNK,mBAcM,OAdN,YAcM,CAZJX,WAUO,KAAA,QAAA,QAAA,CAAA,SAAA,CATLC,YAQsBC,6BAAA;MAPpB,IAAG;MACH,OAAM;MACL,SAAO;;MACG,MAAII,cACgD,CAA7DL,YAA6DG,MAAA,mBAAA,GAAA,EAAxC,OAAM,gCAA+B,CAAA,C;MAE5D,SAAAE,cAAmC,CAAnCN,WAAmC,KAAA,QAAA,cAAA,CAAA,SAAA,CAAX,OAAA,OAAA,OAAA,KAAAY,gBAAA,QAAI,EAAA,E;;K,MAGhCX,YAAmCY,6BAAA,EAAd,OAAM,MAAK,CAAA,C,IAEN,QAAA,WAA5BjB,UAAA,GAAAkB,YAAuCC,8BAAA,EAAA,KAAA,EAAA,CAAA,KACvCf,WAEiB,KAAA,QAAA,SAAA,CAAA,GAAA,KAAA,GAAA,KAAA,GAAA,CAAA,C"}
1
+ {"version":3,"file":"ScalarSidebarNestedItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs","$slots","_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_renderSlot","_createVNode","ScalarSidebarButton","_mergeProps","_unref","_createSlots","_withCtx","_Transition","ScalarSidebarItems","_normalizeProps","_guardReactiveProps","_createElementVNode","_createTextVNode","ScalarSidebarSpacer","_createBlock","ScalarSidebarLoading"],"sources":["../../../src/components/ScalarSidebar/ScalarSidebarNestedItems.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Scalar Sidebar Nested Items component\n *\n * A provides list of items thats presented over the parent list\n * Needs to be nested inside a ScalarSidebarItems component\n *\n * @example\n * <ScalarSidebarNestedItems v-model=\"open\">\n * <!-- Item text -->\n * <template #items>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * <ScalarSidebarItem>...</ScalarSidebarItem>\n * </template>\n * </ScalarSidebarNestedItems>\n *\n * Stable hooks for styling from outside the component:\n * - `.scalar-sidebar-nested-items` targets the item, with `[data-open]` while open\n * - `.scalar-sidebar-nested-items-panel` targets the layer the opened list is\n * drawn in, positioned over the parent list\n */\nexport default {}\n</script>\n<script setup lang=\"ts\">\nimport { ScalarIconArrowRight, ScalarIconCaretLeft } from '@scalar/icons'\nimport { nextTick, ref, useTemplateRef } from 'vue'\n\nimport { findScrollContainer } from './findScrollContainer'\nimport ScalarSidebarButton from './ScalarSidebarButton.vue'\nimport ScalarSidebarItems from './ScalarSidebarItems.vue'\nimport ScalarSidebarLoading from './ScalarSidebarLoading.vue'\nimport ScalarSidebarSpacer from './ScalarSidebarSpacer.vue'\nimport type { ScalarSidebarGroupProps } from './types'\nimport { useSidebarGroups } from './useSidebarGroups'\nimport { useSidebarNestedItem } from './useSidebarNestedItems'\n\nconst { controlled } = defineProps<ScalarSidebarGroupProps>()\n\nconst emit = defineEmits<{\n /** Emitted when the nested item button is clicked */\n (e: 'click', event: MouseEvent): void\n /** Emitted when the back button is clicked */\n (e: 'back', event: MouseEvent): void\n}>()\n\nconst open = defineModel<boolean>('open', { default: false })\nuseSidebarNestedItem(() => open.value)\n\ndefineSlots<{\n /** The text content of the button */\n 'default'?: () => unknown\n /** Override the entire button */\n 'button'?: () => unknown\n /** Override the icon */\n 'icon'?: () => unknown\n /** Override the aside slot */\n 'aside'?: () => unknown\n /** Override the back button */\n 'back'?: () => unknown\n /** Override the back button label */\n 'back-label'?: () => unknown\n /** The list of sidebar subitems */\n 'items'?: () => unknown\n}>()\n\nconst { level } = useSidebarGroups({ reset: true })\n\n/** The root element ref */\nconst el = useTemplateRef('el')\n\n/** How far down to offset the nested items by when animating them in */\nconst offset = ref(0)\n\n// Transition hooks\n\nfunction onOpen() {\n // Calculate how far down the nearest scroll container is scrolled\n // We offset the nested items by this amount when animating them\n // in so they appear in line with the parent items list.\n offset.value = findScrollContainer(el.value).scrollTop ?? 0\n\n // Focus the first button in the nested items\n nextTick(() =>\n el.value\n ?.querySelector<HTMLButtonElement>('button:not([aria-expanded=\"true\"])')\n ?.focus({ preventScroll: true }),\n )\n}\nfunction onOpened() {\n /** Reset the scroll position of the scroll container after opening */\n findScrollContainer(el.value).scrollTop = 0\n}\nfunction onClose() {\n nextTick(() => {\n el.value?.querySelector('button')?.focus({ preventScroll: true })\n findScrollContainer(el.value).scrollTop = offset.value\n })\n}\n\ndefineOptions({ inheritAttrs: false })\n\n/** Handle the click event for the nested items button */\nconst handleClick = (event: MouseEvent) => {\n // Bubble up the click event\n emit('click', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = true\n }\n}\n\n/** Handle the back button click event */\nconst handleBack = (event: MouseEvent) => {\n // Bubble up the back event\n emit('back', event)\n if (!controlled) {\n // Only toggle the open state if the group is uncontrolled\n open.value = false\n }\n}\n</script>\n<template>\n <li\n ref=\"el\"\n class=\"scalar-sidebar-nested-items group/item group/nested-items contents\"\n :class=\"{\n // Deprecated: kept for existing selectors, use [data-open] instead\n 'group/nested-items-open': open,\n }\"\n :data-open=\"open || undefined\"\n :style=\"{ '--nested-items-offset': `${offset}px` }\">\n <slot name=\"button\">\n <ScalarSidebarButton\n is=\"button\"\n :aria-expanded=\"open\"\n :disabled\n :icon\n :indent=\"level\"\n :selected\n v-bind=\"$attrs\"\n @click=\"handleClick\">\n <template\n v-if=\"$slots.icon\"\n #icon>\n <slot name=\"icon\" />\n </template>\n <slot />\n <template #aside>\n <slot name=\"aside\">\n <ScalarIconArrowRight class=\"text-sidebar-c-2 size-4\" />\n </slot>\n </template>\n </ScalarSidebarButton>\n </slot>\n <!-- Make sure the div is around for the entire transition -->\n <Transition\n :duration=\"300\"\n enterActiveClass=\"top-(--nested-items-offset)!\"\n leaveActiveClass=\"top-(--nested-items-offset)!\"\n @afterEnter=\"onOpened\"\n @enter=\"onOpen\"\n @leave=\"onClose\">\n <div\n v-if=\"open\"\n class=\"scalar-sidebar-nested-items-panel absolute inset-0 translate-x-full\">\n <ScalarSidebarItems v-bind=\"$attrs\">\n <div\n class=\"bg-sidebar-b-1 animate-sidebar-border-bottom border-b-sidebar-border sticky top-(--scalar-sidebar-sticky-offset,0) z-1 -mx-(--scalar-sidebar-padding) -mt-(--scalar-sidebar-padding) flex flex-col gap-px px-(--scalar-sidebar-padding) pt-(--scalar-sidebar-padding)\">\n <slot name=\"back\">\n <ScalarSidebarButton\n is=\"button\"\n class=\"text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1\"\n @click=\"handleBack\">\n <template #icon>\n <ScalarIconCaretLeft class=\"text-sidebar-c-2 -m-px size-4\" />\n </template>\n <slot name=\"back-label\">Back</slot>\n </ScalarSidebarButton>\n </slot>\n <ScalarSidebarSpacer class=\"h-3\" />\n </div>\n <ScalarSidebarLoading v-if=\"loading\" />\n <slot\n v-else\n name=\"items\" />\n </ScalarSidebarItems>\n </div>\n </Transition>\n </li>\n</template>\n\n<style>\n@reference \"../../style.css\";\n\n.animate-sidebar-border-bottom {\n animation: border-bottom forwards;\n animation-timeline: scroll();\n animation-range-end: 1px;\n}\n\n@keyframes border-bottom {\n from {\n border-bottom-width: 0;\n }\n to {\n border-bottom-width: var(--scalar-border-width);\n }\n}\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 @@
8
8
  * <ScalarSidebarSearchButton>
9
9
  * <template #shortcut>⌘K</template>
10
10
  * </ScalarSidebarSearchButton>
11
+ *
12
+ * Stable hooks for styling from outside the component:
13
+ * - `.scalar-sidebar-search-shortcut` targets the keyboard shortcut hint
11
14
  */
12
15
  declare const _default: typeof __VLS_export;
13
16
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebarSearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"names":[],"mappings":"AA0DA;;;;;;;;;;GAUG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;oBAEA,MAAM;;oBAAN,MAAM;;cAmFV,CAAC,KAAK,IAAgB,KAAK,GAAG;;eAC7B,CAAC,KAAK,IAAgB,KAAK,GAAG;EASzC,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":"ScalarSidebarSearchButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarSidebar/ScalarSidebarSearchButton.vue"],"names":[],"mappings":"AA6DA;;;;;;;;;;;;;GAaG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;oBAEA,MAAM;;oBAAN,MAAM;;cAoFV,CAAC,KAAK,IAAgB,KAAK,GAAG;;eAC7B,CAAC,KAAK,IAAgB,KAAK,GAAG;EASzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -5,7 +5,7 @@ import { ScalarIconMagnifyingGlass } from "@scalar/icons";
5
5
  var _hoisted_1 = { class: "flex-1 text-start leading-none" };
6
6
  var _hoisted_2 = {
7
7
  key: 0,
8
- class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase"
8
+ class: "scalar-sidebar-search-shortcut text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase"
9
9
  };
10
10
  var _hoisted_3 = { class: "sr-only" };
11
11
  var _hoisted_4 = { dir: "ltr" };