@scalar/sidebar 0.11.12 → 0.12.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.
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItem.vue.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarButton,\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarGroupToggleButton,\n ScalarSidebarGroupToggleSpacer,\n ScalarSidebarIndent,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\nimport { isPlainLeftClick } from '@scalar/helpers/dom/is-plain-left-click'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { computed } from 'vue'\n\nimport SidebarItemDecorator from '@/components/SidebarItemDecorator.vue'\nimport { filterItems } from '@/helpers/filter-items'\nimport { hasChildren } from '@/helpers/has-children'\nimport { isSidebarFolder } from '@/helpers/is-sidebar-folder'\nimport {\n useDraggable,\n type DraggingItem,\n type HoveredItem,\n type UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarHttpBadge from './SidebarHttpBadge.vue'\nimport SidebarItemLabel from './SidebarItemLabel.vue'\n\nconst {\n item,\n layout,\n isSelected,\n isExpanded,\n isDraggable,\n isDroppable,\n options,\n getHref,\n} = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The layout mode for the sidebar ('client' or 'reference').\n */\n layout: Layout\n /**\n * Function to determine if an item is currently selected by id.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine if an item is currently expanded (showing its children) by id.\n */\n isExpanded: (id: string) => boolean\n /**\n * Sidebar configuration options.\n * - operationTitleSource: sets whether operations show their path or summary as the display title.\n */\n options?: SidebarOptions\n\n /**\n * Returns the URL for a sidebar item.\n *\n * When provided (and it returns a value) items render as anchor tags\n * instead of buttons, so search engines can crawl the navigation.\n */\n getHref?: (item: Item) => string | undefined\n\n /**\n * Prevents this item from being dragged.\n *\n * @default true\n */\n isDraggable?: UseDraggableOptions['isDraggable']\n /**\n * Prevents this item from being hovered and dropped into. Can be either a function or a boolean.\n *\n * @default true\n */\n isDroppable?: UseDraggableOptions['isDroppable']\n}>()\n\nconst emit = defineEmits<{\n /**\n * Emitted when the item is selected\n * @param id - The id of the selected item\n */\n (e: 'selectItem', id: string): void\n /**\n * Emitted when a drag operation ends for this item\n * @param draggingItem - The item being dragged\n * @param hoveredItem - The item currently being hovered over\n */\n (e: 'onDragEnd', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when the group is toggled\n * @param id - The id of the group\n */\n (e: 'toggleGroup', id: string): void\n}>()\n\nconst slots = defineSlots<{\n /**\n * Adds an optional decorator for each item, such as an edit menu.\n * The slot receives an object with the current item.\n */\n decorator?(props: { item: Item }): unknown\n /**\n * Adds an optional empty state for an item.\n * The slot receives an object with the current item.\n */\n empty?(props: { item: Item }): unknown\n /**\n * Adds an optional icon for each item.\n * The slot receives an object with the current item and the open state.\n */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\nconst isGroup = (\n currentItem: Item,\n): currentItem is Item & { isGroup: true } => {\n return 'isGroup' in currentItem && currentItem.isGroup\n}\n\nconst isDeprecated = (\n currentItem: Item,\n): currentItem is Item & { isDeprecated: true } => {\n return ('isDeprecated' in currentItem && currentItem.isDeprecated) ?? false\n}\n\n/**\n * Handle drag end event and bubble it up to parent.\n */\nconst onDragEnd = (draggingItem: DraggingItem, hoveredItem: HoveredItem) => {\n emit('onDragEnd', draggingItem, hoveredItem)\n}\nconst { draggableAttrs, draggableEvents } = useDraggable({\n id: item.id,\n isDraggable,\n isDroppable,\n onDragEnd,\n})\n\nconst children = computed(() =>\n hasChildren(item)\n ? filterItems(layout, item.children, options?.hideOperationDefaultExamples)\n : [],\n)\n\n/**\n * Whether this item is the one currently displayed on the page.\n *\n * `isSelected` also reports true for every ancestor of the displayed item,\n * which is what the active styling of a group needs. Only the deepest\n * selected node is the current page though, so a group counts as current when\n * none of its children are selected. Leaf items already get this from the\n * `selected` prop of ScalarSidebarButton.\n */\nconst isCurrent = computed(\n () =>\n isSelected(item.id) &&\n !(hasChildren(item) && item.children.some((child) => isSelected(child.id))),\n)\n\n/** The URL for this item, when the consumer provides one it renders as a link */\nconst href = computed(() => getHref?.(item) || undefined)\n\n/**\n * Whether the group renders its toggle separately from its label.\n *\n * A label that navigates cannot also own the open state, so a group that\n * renders as a link needs a toggle button of its own. Without one there is no\n * way to collapse the group from the keyboard, because pressing Enter on the\n * label follows the link instead.\n */\nconst isDiscrete = computed(\n () => Boolean(href.value) || (layout === 'reference' && item.type === 'text'),\n)\n\n/**\n * Builds the screen reader label for the discrete group toggle.\n *\n * The title of the group is appended so the toggles can be told apart. A page\n * can hold a lot of them, and a list of identical \"Open Group\" buttons gives a\n * screen reader user nothing to navigate by.\n */\nconst getToggleLabel = (open: boolean): string => {\n const label = open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n\n return item.title ? `${label} - ${item.title}` : label\n}\n\n/**\n * Emit the select event for a click on the item label.\n *\n * When the item renders as a link we only hijack plain left clicks on the\n * link itself for in-app navigation. Modified clicks (meta, ctrl, shift,\n * alt) and middle clicks keep the browser's default behavior so the link\n * can be opened in a new tab or window, and clicks on surrounding content\n * (like the decorator menu) keep their native behavior. A click whose\n * default is already prevented has been handled by someone else, so it is\n * left alone rather than navigated a second time.\n */\nconst handleSelect = (event: MouseEvent) => {\n if (href.value) {\n const anchor =\n event.target instanceof Element ? event.target.closest('a') : null\n if (anchor?.getAttribute('href') !== href.value) {\n return\n }\n if (event.defaultPrevented || !isPlainLeftClick(event)) {\n return\n }\n event.preventDefault()\n }\n emit('selectItem', item.id)\n}\n</script>\n<template>\n <!-- Sidebar section -->\n <ScalarSidebarSection\n v-if=\"children.length > 0 && isGroup(item)\"\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n v-on=\"draggableEvents\">\n {{ item.title }}\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n </template>\n </ScalarSidebarSection>\n\n <!-- Sidebar group (folder) -->\n <ScalarSidebarGroup\n v-else-if=\"\n isSidebarFolder(\n layout,\n item,\n slots.empty !== undefined,\n options?.hideOperationDefaultExamples ?? false,\n )\n \"\n :active=\"isSelected(item.id)\"\n class=\"relative\"\n controlled\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n :discrete=\"isDiscrete\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\">\n <template #button=\"{ open, level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :active=\"isSelected(item.id)\"\n :aria-current=\"isCurrent ? 'page' : undefined\"\n :aria-expanded=\"isDiscrete ? undefined : open\"\n :href=\"href\"\n :indent=\"level\"\n @click=\"handleSelect\">\n <template #indent>\n <ScalarSidebarIndent\n class=\"-my-2 mr-0\"\n :indent=\"level\" />\n </template>\n <template\n v-if=\"item.type === 'document'\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"\n ('icon' in item && item.icon) || 'interface-content-folder'\n \" />\n </slot>\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template #aside>\n <SidebarHttpBadge\n v-if=\"'method' in item\"\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n <ScalarSidebarGroupToggleSpacer v-if=\"isDiscrete\" />\n <ScalarSidebarGroupToggle\n v-else-if=\"!('method' in item)\"\n class=\"text-sidebar-c-2\"\n :open>\n <template #label>\n {{\n open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n }}\n </template>\n </ScalarSidebarGroupToggle>\n </template>\n </ScalarSidebarButton>\n <ScalarSidebarGroupToggleButton\n v-if=\"isDiscrete\"\n :open\n @click=\"() => emit('toggleGroup', item.id)\">\n <template #label>{{ getToggleLabel(open) }}</template>\n </ScalarSidebarGroupToggleButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n :parentIds=\"[]\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n <template v-if=\"slots.empty && (item.children?.length ?? 0) === 0\">\n <slot\n :item\n name=\"empty\" />\n </template>\n </template>\n </ScalarSidebarGroup>\n\n <!-- Sidebar item (leaf node) -->\n <ScalarSidebarItem\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n v-on=\"draggableEvents\"\n @click=\"handleSelect\">\n <template #button=\"{ level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :href=\"href\"\n :indent=\"level\"\n :selected=\"isSelected(item.id)\">\n <template\n v-if=\"slots.icon\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"true\" />\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template\n v-if=\"'method' in item\"\n #aside>\n <SidebarHttpBadge\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n </template>\n </ScalarSidebarButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n </ScalarSidebarItem>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SidebarItem.vue.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarButton,\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarGroupToggleButton,\n ScalarSidebarGroupToggleSpacer,\n ScalarSidebarIndent,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\nimport { isPlainLeftClick } from '@scalar/helpers/dom/is-plain-left-click'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { computed } from 'vue'\n\nimport SidebarItemDecorator from '@/components/SidebarItemDecorator.vue'\nimport { filterItems } from '@/helpers/filter-items'\nimport { hasChildren } from '@/helpers/has-children'\nimport { isSidebarFolder } from '@/helpers/is-sidebar-folder'\nimport {\n useDraggable,\n type DraggingItem,\n type HoveredItem,\n type UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarHttpBadge from './SidebarHttpBadge.vue'\nimport SidebarItemLabel from './SidebarItemLabel.vue'\n\nconst {\n item,\n layout,\n isSelected,\n isExpanded,\n isDraggable,\n isDroppable,\n options,\n getHref,\n} = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The layout mode for the sidebar ('client' or 'reference').\n */\n layout: Layout\n /**\n * Function to determine if an item is currently selected by id.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine if an item is currently expanded (showing its children) by id.\n */\n isExpanded: (id: string) => boolean\n /**\n * Sidebar configuration options.\n * - operationTitleSource: sets whether operations show their path or summary as the display title.\n */\n options?: SidebarOptions\n\n /**\n * Returns the URL for a sidebar item.\n *\n * When provided (and it returns a value) items render as anchor tags\n * instead of buttons, so search engines can crawl the navigation.\n */\n getHref?: (item: Item) => string | undefined\n\n /**\n * Prevents this item from being dragged.\n *\n * @default true\n */\n isDraggable?: UseDraggableOptions['isDraggable']\n /**\n * Prevents this item from being hovered and dropped into. Can be either a function or a boolean.\n *\n * @default true\n */\n isDroppable?: UseDraggableOptions['isDroppable']\n}>()\n\nconst emit = defineEmits<{\n /**\n * Emitted when the item is selected\n * @param id - The id of the selected item\n */\n (e: 'selectItem', id: string): void\n /**\n * Emitted when a drag operation ends for this item\n * @param draggingItem - The item being dragged\n * @param hoveredItem - The item currently being hovered over\n */\n (e: 'onDragEnd', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when the group is toggled\n * @param id - The id of the group\n */\n (e: 'toggleGroup', id: string): void\n}>()\n\nconst slots = defineSlots<{\n /**\n * Adds an optional decorator for each item, such as an edit menu.\n * The slot receives an object with the current item.\n */\n decorator?(props: { item: Item }): unknown\n /**\n * Adds an optional empty state for an item.\n * The slot receives an object with the current item.\n */\n empty?(props: { item: Item }): unknown\n /**\n * Adds an optional icon for each item.\n * The slot receives an object with the current item and the open state.\n */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\nconst isGroup = (\n currentItem: Item,\n): currentItem is Item & { isGroup: true } => {\n return 'isGroup' in currentItem && currentItem.isGroup\n}\n\nconst isDeprecated = (\n currentItem: Item,\n): currentItem is Item & { isDeprecated: true } => {\n return ('isDeprecated' in currentItem && currentItem.isDeprecated) ?? false\n}\n\n/**\n * Handle drag end event and bubble it up to parent.\n */\nconst onDragEnd = (draggingItem: DraggingItem, hoveredItem: HoveredItem) => {\n emit('onDragEnd', draggingItem, hoveredItem)\n}\nconst { draggableAttrs, draggableEvents } = useDraggable({\n id: item.id,\n isDraggable,\n isDroppable,\n onDragEnd,\n})\n\nconst children = computed(() =>\n hasChildren(item)\n ? filterItems(layout, item.children, options?.hideOperationDefaultExamples)\n : [],\n)\n\n/**\n * Whether this item is the one currently displayed on the page.\n *\n * `isSelected` also reports true for every ancestor of the displayed item,\n * which is what the active styling of a group needs. Only the deepest\n * selected node is the current page though, so a group counts as current when\n * none of its children are selected. Leaf items already get this from the\n * `selected` prop of ScalarSidebarButton.\n */\nconst isCurrent = computed(\n () =>\n isSelected(item.id) &&\n !(hasChildren(item) && item.children.some((child) => isSelected(child.id))),\n)\n\n/** The URL for this item, when the consumer provides one it renders as a link */\nconst href = computed(() => getHref?.(item) || undefined)\n\n/**\n * Whether the group renders its toggle separately from its label.\n *\n * A label that navigates cannot also own the open state, so a group that\n * renders as a link needs a toggle button of its own. Without one there is no\n * way to collapse the group from the keyboard, because pressing Enter on the\n * label follows the link instead.\n */\nconst isDiscrete = computed(\n () => Boolean(href.value) || (layout === 'reference' && item.type === 'text'),\n)\n\n/**\n * Builds the screen reader label for the discrete group toggle.\n *\n * The title of the group is appended so the toggles can be told apart. A page\n * can hold a lot of them, and a list of identical \"Open Group\" buttons gives a\n * screen reader user nothing to navigate by.\n */\nconst getToggleLabel = (open: boolean): string => {\n const label = open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n\n return item.title ? `${label} - ${item.title}` : label\n}\n\n/**\n * Emit the select event for a click on the item label.\n *\n * When the item renders as a link we only hijack plain left clicks on the\n * link itself for in-app navigation. Modified clicks (meta, ctrl, shift,\n * alt) and middle clicks keep the browser's default behavior so the link\n * can be opened in a new tab or window, and clicks on surrounding content\n * (like the decorator menu) keep their native behavior. A click whose\n * default is already prevented has been handled by someone else, so it is\n * left alone rather than navigated a second time.\n */\nconst handleSelect = (event: MouseEvent) => {\n if (href.value) {\n const anchor =\n event.target instanceof Element ? event.target.closest('a') : null\n if (anchor?.getAttribute('href') !== href.value) {\n return\n }\n if (event.defaultPrevented || !isPlainLeftClick(event)) {\n return\n }\n event.preventDefault()\n }\n emit('selectItem', item.id)\n}\n</script>\n<template>\n <!-- Keep the client section layout; reference tags all use collapsible groups. -->\n <ScalarSidebarSection\n v-if=\"layout === 'client' && children.length > 0 && isGroup(item)\"\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n v-on=\"draggableEvents\">\n {{ item.title }}\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n </template>\n </ScalarSidebarSection>\n\n <!-- Sidebar group (folder) -->\n <ScalarSidebarGroup\n v-else-if=\"\n isSidebarFolder(\n layout,\n item,\n slots.empty !== undefined,\n options?.hideOperationDefaultExamples ?? false,\n )\n \"\n :active=\"isSelected(item.id)\"\n class=\"relative\"\n controlled\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n :discrete=\"isDiscrete\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\">\n <template #button=\"{ open, level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :active=\"isSelected(item.id)\"\n :aria-current=\"isCurrent ? 'page' : undefined\"\n :aria-expanded=\"isDiscrete ? undefined : open\"\n :href=\"href\"\n :indent=\"level\"\n @click=\"handleSelect\">\n <template #indent>\n <ScalarSidebarIndent\n class=\"-my-2 mr-0\"\n :indent=\"level\" />\n </template>\n <template\n v-if=\"item.type === 'document'\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"\n ('icon' in item && item.icon) || 'interface-content-folder'\n \" />\n </slot>\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template #aside>\n <SidebarHttpBadge\n v-if=\"'method' in item\"\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n <ScalarSidebarGroupToggleSpacer v-if=\"isDiscrete\" />\n <ScalarSidebarGroupToggle\n v-else-if=\"!('method' in item)\"\n class=\"text-sidebar-c-2\"\n :open>\n <template #label>\n {{\n open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n }}\n </template>\n </ScalarSidebarGroupToggle>\n </template>\n </ScalarSidebarButton>\n <ScalarSidebarGroupToggleButton\n v-if=\"isDiscrete\"\n :open\n @click=\"() => emit('toggleGroup', item.id)\">\n <template #label>{{ getToggleLabel(open) }}</template>\n </ScalarSidebarGroupToggleButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n :parentIds=\"[]\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n <template v-if=\"slots.empty && (item.children?.length ?? 0) === 0\">\n <slot\n :item\n name=\"empty\" />\n </template>\n </template>\n </ScalarSidebarGroup>\n\n <!-- Sidebar item (leaf node) -->\n <ScalarSidebarItem\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n v-on=\"draggableEvents\"\n @click=\"handleSelect\">\n <template #button=\"{ level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :href=\"href\"\n :indent=\"level\"\n :selected=\"isSelected(item.id)\">\n <template\n v-if=\"slots.icon\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"true\" />\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template\n v-if=\"'method' in item\"\n #aside>\n <SidebarHttpBadge\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n </template>\n </ScalarSidebarButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n </ScalarSidebarItem>\n</template>\n"],"mappings":""}
@@ -110,7 +110,7 @@ var SidebarItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
110
110
  };
111
111
  return (_ctx, _cache) => {
112
112
  const _component_SidebarItem = resolveComponent("SidebarItem", true);
113
- return children.value.length > 0 && isGroup(__props.item) ? (openBlock(), createBlock(unref(ScalarSidebarSection), mergeProps({
113
+ return __props.layout === "client" && children.value.length > 0 && isGroup(__props.item) ? (openBlock(), createBlock(unref(ScalarSidebarSection), mergeProps({
114
114
  key: 0,
115
115
  "data-sidebar-id": __props.item.id
116
116
  }, unref(draggableAttrs), toHandlers(unref(draggableEvents))), {
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItem.vue.script.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarButton,\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarGroupToggleButton,\n ScalarSidebarGroupToggleSpacer,\n ScalarSidebarIndent,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\nimport { isPlainLeftClick } from '@scalar/helpers/dom/is-plain-left-click'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { computed } from 'vue'\n\nimport SidebarItemDecorator from '@/components/SidebarItemDecorator.vue'\nimport { filterItems } from '@/helpers/filter-items'\nimport { hasChildren } from '@/helpers/has-children'\nimport { isSidebarFolder } from '@/helpers/is-sidebar-folder'\nimport {\n useDraggable,\n type DraggingItem,\n type HoveredItem,\n type UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarHttpBadge from './SidebarHttpBadge.vue'\nimport SidebarItemLabel from './SidebarItemLabel.vue'\n\nconst {\n item,\n layout,\n isSelected,\n isExpanded,\n isDraggable,\n isDroppable,\n options,\n getHref,\n} = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The layout mode for the sidebar ('client' or 'reference').\n */\n layout: Layout\n /**\n * Function to determine if an item is currently selected by id.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine if an item is currently expanded (showing its children) by id.\n */\n isExpanded: (id: string) => boolean\n /**\n * Sidebar configuration options.\n * - operationTitleSource: sets whether operations show their path or summary as the display title.\n */\n options?: SidebarOptions\n\n /**\n * Returns the URL for a sidebar item.\n *\n * When provided (and it returns a value) items render as anchor tags\n * instead of buttons, so search engines can crawl the navigation.\n */\n getHref?: (item: Item) => string | undefined\n\n /**\n * Prevents this item from being dragged.\n *\n * @default true\n */\n isDraggable?: UseDraggableOptions['isDraggable']\n /**\n * Prevents this item from being hovered and dropped into. Can be either a function or a boolean.\n *\n * @default true\n */\n isDroppable?: UseDraggableOptions['isDroppable']\n}>()\n\nconst emit = defineEmits<{\n /**\n * Emitted when the item is selected\n * @param id - The id of the selected item\n */\n (e: 'selectItem', id: string): void\n /**\n * Emitted when a drag operation ends for this item\n * @param draggingItem - The item being dragged\n * @param hoveredItem - The item currently being hovered over\n */\n (e: 'onDragEnd', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when the group is toggled\n * @param id - The id of the group\n */\n (e: 'toggleGroup', id: string): void\n}>()\n\nconst slots = defineSlots<{\n /**\n * Adds an optional decorator for each item, such as an edit menu.\n * The slot receives an object with the current item.\n */\n decorator?(props: { item: Item }): unknown\n /**\n * Adds an optional empty state for an item.\n * The slot receives an object with the current item.\n */\n empty?(props: { item: Item }): unknown\n /**\n * Adds an optional icon for each item.\n * The slot receives an object with the current item and the open state.\n */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\nconst isGroup = (\n currentItem: Item,\n): currentItem is Item & { isGroup: true } => {\n return 'isGroup' in currentItem && currentItem.isGroup\n}\n\nconst isDeprecated = (\n currentItem: Item,\n): currentItem is Item & { isDeprecated: true } => {\n return ('isDeprecated' in currentItem && currentItem.isDeprecated) ?? false\n}\n\n/**\n * Handle drag end event and bubble it up to parent.\n */\nconst onDragEnd = (draggingItem: DraggingItem, hoveredItem: HoveredItem) => {\n emit('onDragEnd', draggingItem, hoveredItem)\n}\nconst { draggableAttrs, draggableEvents } = useDraggable({\n id: item.id,\n isDraggable,\n isDroppable,\n onDragEnd,\n})\n\nconst children = computed(() =>\n hasChildren(item)\n ? filterItems(layout, item.children, options?.hideOperationDefaultExamples)\n : [],\n)\n\n/**\n * Whether this item is the one currently displayed on the page.\n *\n * `isSelected` also reports true for every ancestor of the displayed item,\n * which is what the active styling of a group needs. Only the deepest\n * selected node is the current page though, so a group counts as current when\n * none of its children are selected. Leaf items already get this from the\n * `selected` prop of ScalarSidebarButton.\n */\nconst isCurrent = computed(\n () =>\n isSelected(item.id) &&\n !(hasChildren(item) && item.children.some((child) => isSelected(child.id))),\n)\n\n/** The URL for this item, when the consumer provides one it renders as a link */\nconst href = computed(() => getHref?.(item) || undefined)\n\n/**\n * Whether the group renders its toggle separately from its label.\n *\n * A label that navigates cannot also own the open state, so a group that\n * renders as a link needs a toggle button of its own. Without one there is no\n * way to collapse the group from the keyboard, because pressing Enter on the\n * label follows the link instead.\n */\nconst isDiscrete = computed(\n () => Boolean(href.value) || (layout === 'reference' && item.type === 'text'),\n)\n\n/**\n * Builds the screen reader label for the discrete group toggle.\n *\n * The title of the group is appended so the toggles can be told apart. A page\n * can hold a lot of them, and a list of identical \"Open Group\" buttons gives a\n * screen reader user nothing to navigate by.\n */\nconst getToggleLabel = (open: boolean): string => {\n const label = open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n\n return item.title ? `${label} - ${item.title}` : label\n}\n\n/**\n * Emit the select event for a click on the item label.\n *\n * When the item renders as a link we only hijack plain left clicks on the\n * link itself for in-app navigation. Modified clicks (meta, ctrl, shift,\n * alt) and middle clicks keep the browser's default behavior so the link\n * can be opened in a new tab or window, and clicks on surrounding content\n * (like the decorator menu) keep their native behavior. A click whose\n * default is already prevented has been handled by someone else, so it is\n * left alone rather than navigated a second time.\n */\nconst handleSelect = (event: MouseEvent) => {\n if (href.value) {\n const anchor =\n event.target instanceof Element ? event.target.closest('a') : null\n if (anchor?.getAttribute('href') !== href.value) {\n return\n }\n if (event.defaultPrevented || !isPlainLeftClick(event)) {\n return\n }\n event.preventDefault()\n }\n emit('selectItem', item.id)\n}\n</script>\n<template>\n <!-- Sidebar section -->\n <ScalarSidebarSection\n v-if=\"children.length > 0 && isGroup(item)\"\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n v-on=\"draggableEvents\">\n {{ item.title }}\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n </template>\n </ScalarSidebarSection>\n\n <!-- Sidebar group (folder) -->\n <ScalarSidebarGroup\n v-else-if=\"\n isSidebarFolder(\n layout,\n item,\n slots.empty !== undefined,\n options?.hideOperationDefaultExamples ?? false,\n )\n \"\n :active=\"isSelected(item.id)\"\n class=\"relative\"\n controlled\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n :discrete=\"isDiscrete\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\">\n <template #button=\"{ open, level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :active=\"isSelected(item.id)\"\n :aria-current=\"isCurrent ? 'page' : undefined\"\n :aria-expanded=\"isDiscrete ? undefined : open\"\n :href=\"href\"\n :indent=\"level\"\n @click=\"handleSelect\">\n <template #indent>\n <ScalarSidebarIndent\n class=\"-my-2 mr-0\"\n :indent=\"level\" />\n </template>\n <template\n v-if=\"item.type === 'document'\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"\n ('icon' in item && item.icon) || 'interface-content-folder'\n \" />\n </slot>\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template #aside>\n <SidebarHttpBadge\n v-if=\"'method' in item\"\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n <ScalarSidebarGroupToggleSpacer v-if=\"isDiscrete\" />\n <ScalarSidebarGroupToggle\n v-else-if=\"!('method' in item)\"\n class=\"text-sidebar-c-2\"\n :open>\n <template #label>\n {{\n open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n }}\n </template>\n </ScalarSidebarGroupToggle>\n </template>\n </ScalarSidebarButton>\n <ScalarSidebarGroupToggleButton\n v-if=\"isDiscrete\"\n :open\n @click=\"() => emit('toggleGroup', item.id)\">\n <template #label>{{ getToggleLabel(open) }}</template>\n </ScalarSidebarGroupToggleButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n :parentIds=\"[]\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n <template v-if=\"slots.empty && (item.children?.length ?? 0) === 0\">\n <slot\n :item\n name=\"empty\" />\n </template>\n </template>\n </ScalarSidebarGroup>\n\n <!-- Sidebar item (leaf node) -->\n <ScalarSidebarItem\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n v-on=\"draggableEvents\"\n @click=\"handleSelect\">\n <template #button=\"{ level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :href=\"href\"\n :indent=\"level\"\n :selected=\"isSelected(item.id)\">\n <template\n v-if=\"slots.icon\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"true\" />\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template\n v-if=\"'method' in item\"\n #aside>\n <SidebarHttpBadge\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n </template>\n </ScalarSidebarButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n </ScalarSidebarItem>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFA,MAAM,OAAO;EAoBb,MAAM,QAAQ,SAAA;EAkBd,MAAM,WACJ,gBAC4C;GAC5C,OAAO,aAAa,eAAe,YAAY;EACjD;EAEA,MAAM,gBACJ,gBACiD;GACjD,QAAQ,kBAAkB,eAAe,YAAY,iBAAiB;EACxE;;;;EAKA,MAAM,aAAa,cAA4B,gBAA6B;GAC1E,KAAK,aAAa,cAAc,WAAW;EAC7C;EACA,MAAM,EAAE,gBAAgB,oBAAoB,aAAa;GACvD,IAAI,QAAA,KAAK;GACT,aAAU,QAAA;GACV,aAAU,QAAA;GACV;EACF,CAAC;EAED,MAAM,WAAW,eACf,YAAY,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"SidebarItem.vue.script.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarButton,\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarGroupToggleButton,\n ScalarSidebarGroupToggleSpacer,\n ScalarSidebarIndent,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\nimport { isPlainLeftClick } from '@scalar/helpers/dom/is-plain-left-click'\nimport { LibraryIcon } from '@scalar/icons/library'\nimport { computed } from 'vue'\n\nimport SidebarItemDecorator from '@/components/SidebarItemDecorator.vue'\nimport { filterItems } from '@/helpers/filter-items'\nimport { hasChildren } from '@/helpers/has-children'\nimport { isSidebarFolder } from '@/helpers/is-sidebar-folder'\nimport {\n useDraggable,\n type DraggingItem,\n type HoveredItem,\n type UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarHttpBadge from './SidebarHttpBadge.vue'\nimport SidebarItemLabel from './SidebarItemLabel.vue'\n\nconst {\n item,\n layout,\n isSelected,\n isExpanded,\n isDraggable,\n isDroppable,\n options,\n getHref,\n} = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The layout mode for the sidebar ('client' or 'reference').\n */\n layout: Layout\n /**\n * Function to determine if an item is currently selected by id.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine if an item is currently expanded (showing its children) by id.\n */\n isExpanded: (id: string) => boolean\n /**\n * Sidebar configuration options.\n * - operationTitleSource: sets whether operations show their path or summary as the display title.\n */\n options?: SidebarOptions\n\n /**\n * Returns the URL for a sidebar item.\n *\n * When provided (and it returns a value) items render as anchor tags\n * instead of buttons, so search engines can crawl the navigation.\n */\n getHref?: (item: Item) => string | undefined\n\n /**\n * Prevents this item from being dragged.\n *\n * @default true\n */\n isDraggable?: UseDraggableOptions['isDraggable']\n /**\n * Prevents this item from being hovered and dropped into. Can be either a function or a boolean.\n *\n * @default true\n */\n isDroppable?: UseDraggableOptions['isDroppable']\n}>()\n\nconst emit = defineEmits<{\n /**\n * Emitted when the item is selected\n * @param id - The id of the selected item\n */\n (e: 'selectItem', id: string): void\n /**\n * Emitted when a drag operation ends for this item\n * @param draggingItem - The item being dragged\n * @param hoveredItem - The item currently being hovered over\n */\n (e: 'onDragEnd', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when the group is toggled\n * @param id - The id of the group\n */\n (e: 'toggleGroup', id: string): void\n}>()\n\nconst slots = defineSlots<{\n /**\n * Adds an optional decorator for each item, such as an edit menu.\n * The slot receives an object with the current item.\n */\n decorator?(props: { item: Item }): unknown\n /**\n * Adds an optional empty state for an item.\n * The slot receives an object with the current item.\n */\n empty?(props: { item: Item }): unknown\n /**\n * Adds an optional icon for each item.\n * The slot receives an object with the current item and the open state.\n */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\nconst isGroup = (\n currentItem: Item,\n): currentItem is Item & { isGroup: true } => {\n return 'isGroup' in currentItem && currentItem.isGroup\n}\n\nconst isDeprecated = (\n currentItem: Item,\n): currentItem is Item & { isDeprecated: true } => {\n return ('isDeprecated' in currentItem && currentItem.isDeprecated) ?? false\n}\n\n/**\n * Handle drag end event and bubble it up to parent.\n */\nconst onDragEnd = (draggingItem: DraggingItem, hoveredItem: HoveredItem) => {\n emit('onDragEnd', draggingItem, hoveredItem)\n}\nconst { draggableAttrs, draggableEvents } = useDraggable({\n id: item.id,\n isDraggable,\n isDroppable,\n onDragEnd,\n})\n\nconst children = computed(() =>\n hasChildren(item)\n ? filterItems(layout, item.children, options?.hideOperationDefaultExamples)\n : [],\n)\n\n/**\n * Whether this item is the one currently displayed on the page.\n *\n * `isSelected` also reports true for every ancestor of the displayed item,\n * which is what the active styling of a group needs. Only the deepest\n * selected node is the current page though, so a group counts as current when\n * none of its children are selected. Leaf items already get this from the\n * `selected` prop of ScalarSidebarButton.\n */\nconst isCurrent = computed(\n () =>\n isSelected(item.id) &&\n !(hasChildren(item) && item.children.some((child) => isSelected(child.id))),\n)\n\n/** The URL for this item, when the consumer provides one it renders as a link */\nconst href = computed(() => getHref?.(item) || undefined)\n\n/**\n * Whether the group renders its toggle separately from its label.\n *\n * A label that navigates cannot also own the open state, so a group that\n * renders as a link needs a toggle button of its own. Without one there is no\n * way to collapse the group from the keyboard, because pressing Enter on the\n * label follows the link instead.\n */\nconst isDiscrete = computed(\n () => Boolean(href.value) || (layout === 'reference' && item.type === 'text'),\n)\n\n/**\n * Builds the screen reader label for the discrete group toggle.\n *\n * The title of the group is appended so the toggles can be told apart. A page\n * can hold a lot of them, and a list of identical \"Open Group\" buttons gives a\n * screen reader user nothing to navigate by.\n */\nconst getToggleLabel = (open: boolean): string => {\n const label = open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n\n return item.title ? `${label} - ${item.title}` : label\n}\n\n/**\n * Emit the select event for a click on the item label.\n *\n * When the item renders as a link we only hijack plain left clicks on the\n * link itself for in-app navigation. Modified clicks (meta, ctrl, shift,\n * alt) and middle clicks keep the browser's default behavior so the link\n * can be opened in a new tab or window, and clicks on surrounding content\n * (like the decorator menu) keep their native behavior. A click whose\n * default is already prevented has been handled by someone else, so it is\n * left alone rather than navigated a second time.\n */\nconst handleSelect = (event: MouseEvent) => {\n if (href.value) {\n const anchor =\n event.target instanceof Element ? event.target.closest('a') : null\n if (anchor?.getAttribute('href') !== href.value) {\n return\n }\n if (event.defaultPrevented || !isPlainLeftClick(event)) {\n return\n }\n event.preventDefault()\n }\n emit('selectItem', item.id)\n}\n</script>\n<template>\n <!-- Keep the client section layout; reference tags all use collapsible groups. -->\n <ScalarSidebarSection\n v-if=\"layout === 'client' && children.length > 0 && isGroup(item)\"\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n v-on=\"draggableEvents\">\n {{ item.title }}\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n </template>\n </ScalarSidebarSection>\n\n <!-- Sidebar group (folder) -->\n <ScalarSidebarGroup\n v-else-if=\"\n isSidebarFolder(\n layout,\n item,\n slots.empty !== undefined,\n options?.hideOperationDefaultExamples ?? false,\n )\n \"\n :active=\"isSelected(item.id)\"\n class=\"relative\"\n controlled\n :data-sidebar-id=\"item.id\"\n v-bind=\"draggableAttrs\"\n :discrete=\"isDiscrete\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\">\n <template #button=\"{ open, level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :active=\"isSelected(item.id)\"\n :aria-current=\"isCurrent ? 'page' : undefined\"\n :aria-expanded=\"isDiscrete ? undefined : open\"\n :href=\"href\"\n :indent=\"level\"\n @click=\"handleSelect\">\n <template #indent>\n <ScalarSidebarIndent\n class=\"-my-2 mr-0\"\n :indent=\"level\" />\n </template>\n <template\n v-if=\"item.type === 'document'\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"\n ('icon' in item && item.icon) || 'interface-content-folder'\n \" />\n </slot>\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template #aside>\n <SidebarHttpBadge\n v-if=\"'method' in item\"\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n <ScalarSidebarGroupToggleSpacer v-if=\"isDiscrete\" />\n <ScalarSidebarGroupToggle\n v-else-if=\"!('method' in item)\"\n class=\"text-sidebar-c-2\"\n :open>\n <template #label>\n {{\n open\n ? (options?.labels?.closeGroup ?? 'Close Group')\n : (options?.labels?.openGroup ?? 'Open Group')\n }}\n </template>\n </ScalarSidebarGroupToggle>\n </template>\n </ScalarSidebarButton>\n <ScalarSidebarGroupToggleButton\n v-if=\"isDiscrete\"\n :open\n @click=\"() => emit('toggleGroup', item.id)\">\n <template #label>{{ getToggleLabel(open) }}</template>\n </ScalarSidebarGroupToggleButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <SidebarItemDecorator>\n <slot\n :item\n name=\"decorator\" />\n </SidebarItemDecorator>\n </template>\n <template #items>\n <SidebarItem\n v-for=\"child in children\"\n :key=\"child.id\"\n :getHref=\"getHref\"\n :isDraggable=\"isDraggable\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"child\"\n :layout=\"layout\"\n :options=\"options\"\n :parentIds=\"[]\"\n @onDragEnd=\"onDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"decorator\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"empty\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"slotProps\">\n <slot\n v-bind=\"slotProps\"\n name=\"icon\" />\n </template>\n </SidebarItem>\n <template v-if=\"slots.empty && (item.children?.length ?? 0) === 0\">\n <slot\n :item\n name=\"empty\" />\n </template>\n </template>\n </ScalarSidebarGroup>\n\n <!-- Sidebar item (leaf node) -->\n <ScalarSidebarItem\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n v-on=\"draggableEvents\"\n @click=\"handleSelect\">\n <template #button=\"{ level }\">\n <ScalarSidebarButton\n :is=\"href ? 'a' : 'button'\"\n :href=\"href\"\n :indent=\"level\"\n :selected=\"isSelected(item.id)\">\n <template\n v-if=\"slots.icon\"\n #icon>\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"true\" />\n </template>\n <span\n v-if=\"isDeprecated(item)\"\n class=\"line-through\">\n <SidebarItemLabel\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n </span>\n <SidebarItemLabel\n v-else\n :item\n :operationTitleSource=\"options?.operationTitleSource\" />\n <template\n v-if=\"'method' in item\"\n #aside>\n <SidebarHttpBadge\n :active=\"isSelected(item.id)\"\n class=\"ml-2 h-4 self-start\"\n :class=\"{\n // Hide the badge when we're showing the decorator\n 'group-hover/button:opacity-0 group-focus-visible/button:opacity-0 group-has-[~*_[aria-expanded=true]]/button:opacity-0 group-has-[~*:focus-within]/button:opacity-0 group-has-[~*:hover]/button:opacity-0':\n slots.decorator,\n }\"\n :label=\"options?.labels?.httpMethod\"\n :method=\"item.method\"\n :webhook=\"item.type === 'webhook'\" />\n </template>\n </ScalarSidebarButton>\n </template>\n <template\n v-if=\"slots.decorator\"\n #after>\n <Sideb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,sBAAsB,QAAA,SAAS;;;QAjB1B,MAAM,OAAA;WACX;uBAIgB,CAHjB,WAGiB,KAAA,QAAA,QAAA;MAFd,MAAM,QAAA;MAEN,MAAM;;;4BAcS,QAAA,OAAA;WACjB;uBAWsC,CAVvC,YAUuC,0BAAA;MATpC,QAAQ,QAAA,WAAW,QAAA,KAAK,EAAE;MAC3B,OAAK,eAAA,CAAC,uBAAqB,EAAA,6MAC2R,MAAM,UAAA,CAAA,CAAA;MAK3T,OAAO,QAAA,SAAS,QAAQ;MACxB,QAAQ,QAAA,KAAK;MACb,SAAS,QAAA,KAAK,SAAI;;;;;;;;;;;;;;;;OAKnB,MAAM,YAAA;UACX;sBAKsB,CAJvB,YAIuB,8BAAA,MAAA;4BADA,CAFrB,WAEqB,KAAA,QAAA,aAAA,EADlB,MAAA,QAAA,KAAI,CAAA,CAAA,CAAA"}
package/dist/style.css CHANGED
@@ -3,7 +3,6 @@
3
3
  @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
4
4
  *, :before, :after, ::backdrop {
5
5
  --tw-font-weight: initial;
6
- --tw-border-style: solid;
7
6
  --tw-shadow: 0 0 #0000;
8
7
  --tw-shadow-color: initial;
9
8
  --tw-shadow-alpha: 100%;
@@ -39,6 +38,7 @@
39
38
  --tw-skew-x: initial;
40
39
  --tw-skew-y: initial;
41
40
  --tw-divide-y-reverse: 0;
41
+ --tw-border-style: solid;
42
42
  --tw-gradient-position: initial;
43
43
  --tw-gradient-from: #0000;
44
44
  --tw-gradient-via: #0000;
@@ -1729,10 +1729,9 @@
1729
1729
 
1730
1730
  :where(body, dialog) > .scalar-tooltip:before {
1731
1731
  content: "";
1732
+ border: var(--scalar-border-width) solid var(--scalar-border-color);
1732
1733
  z-index: calc(1 * -1);
1733
1734
  border-radius: var(--scalar-radius-lg);
1734
- border-style: var(--tw-border-style);
1735
- border-width: var(--scalar-border-width);
1736
1735
  background-color: var(--scalar-tooltip-background);
1737
1736
  --tw-shadow: var(--scalar-shadow-1);
1738
1737
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -1764,12 +1763,6 @@
1764
1763
  inherits: false
1765
1764
  }
1766
1765
 
1767
- @property --tw-border-style {
1768
- syntax: "*";
1769
- inherits: false;
1770
- initial-value: solid;
1771
- }
1772
-
1773
1766
  @property --tw-shadow {
1774
1767
  syntax: "*";
1775
1768
  inherits: false;
@@ -3579,11 +3572,6 @@
3579
3572
  opacity: 1;
3580
3573
  }
3581
3574
 
3582
- .scalar-app .shadow {
3583
- --tw-shadow: var(--scalar-shadow-1);
3584
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
3585
- }
3586
-
3587
3575
  .scalar-app .shadow-border {
3588
3576
  --tw-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
3589
3577
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -3609,6 +3597,11 @@
3609
3597
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
3610
3598
  }
3611
3599
 
3600
+ .scalar-app .inset-shadow-border {
3601
+ --tw-inset-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
3602
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
3603
+ }
3604
+
3612
3605
  .scalar-app .outline {
3613
3606
  outline-style: var(--tw-outline-style);
3614
3607
  outline-width: 1px;
@@ -3635,11 +3628,6 @@
3635
3628
  filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
3636
3629
  }
3637
3630
 
3638
- .scalar-app .brightness-lifted {
3639
- --tw-brightness: brightness(var(--scalar-lifted-brightness));
3640
- filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
3641
- }
3642
-
3643
3631
  .scalar-app .filter {
3644
3632
  filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
3645
3633
  }
@@ -3935,11 +3923,6 @@
3935
3923
  border-radius: var(--scalar-radius-md);
3936
3924
  }
3937
3925
 
3938
- .scalar-app .after\:rounded-\[inherit\]:after {
3939
- content: var(--tw-content);
3940
- border-radius: inherit;
3941
- }
3942
-
3943
3926
  .scalar-app .after\:bg-blue:after {
3944
3927
  content: var(--tw-content);
3945
3928
  background-color: var(--scalar-color-blue);
@@ -3950,12 +3933,6 @@
3950
3933
  opacity: .15;
3951
3934
  }
3952
3935
 
3953
- .scalar-app .after\:shadow-border:after {
3954
- content: var(--tw-content);
3955
- --tw-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
3956
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
3957
- }
3958
-
3959
3936
  .scalar-app .first\:rounded-t-\[inherit\]:first-child {
3960
3937
  border-top-left-radius: inherit;
3961
3938
  border-top-right-radius: inherit;
@@ -4309,6 +4286,12 @@
4309
4286
  initial-value: 0;
4310
4287
  }
4311
4288
 
4289
+ @property --tw-border-style {
4290
+ syntax: "*";
4291
+ inherits: false;
4292
+ initial-value: solid;
4293
+ }
4294
+
4312
4295
  @property --tw-gradient-position {
4313
4296
  syntax: "*";
4314
4297
  inherits: false
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/scalar/scalar.git",
11
11
  "directory": "packages/sidebar"
12
12
  },
13
- "version": "0.11.12",
13
+ "version": "0.12.0",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -32,12 +32,12 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@scalar/components": "0.30.7",
36
- "@scalar/helpers": "0.16.1",
35
+ "@scalar/components": "0.31.1",
36
+ "@scalar/helpers": "0.16.3",
37
37
  "@scalar/icons": "0.7.6",
38
- "@scalar/themes": "0.18.1",
39
- "@scalar/use-hooks": "0.4.18",
40
- "@scalar/workspace-store": "0.68.1",
38
+ "@scalar/themes": "0.19.1",
39
+ "@scalar/use-hooks": "0.4.20",
40
+ "@scalar/workspace-store": "0.68.3",
41
41
  "vue": "^3.5.40"
42
42
  },
43
43
  "devDependencies": {