@scalar/sidebar 0.9.34 → 0.9.35

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.
@@ -2,7 +2,7 @@ import { computed, createBlock, createTextVNode, defineComponent, normalizeStyle
2
2
  import { getHttpMethodInfo } from "@scalar/helpers/http/http-info";
3
3
  import { normalizeHttpMethod } from "@scalar/helpers/http/normalize-http-method";
4
4
  //#region src/components/HttpMethod.vue?vue&type=script&setup=true&lang.ts
5
- var HttpMethod_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
5
+ var HttpMethod_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
6
6
  __name: "HttpMethod",
7
7
  props: {
8
8
  as: {},
@@ -1 +1 @@
1
- {"version":3,"file":"HttpMethod.vue.script.js","names":[],"sources":["../../src/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { normalizeHttpMethod } from '@scalar/helpers/http/normalize-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: HttpMethod | string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => normalizeHttpMethod(props.method))\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n class=\"uppercase\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;;EAYd,MAAM,iBAAiB,eACrB,kBAAkB,OAAO,MAAM,UAAU,GAAG,CAAC,CAC/C;;EAGA,MAAM,aAAa,eAAe,oBAAoB,MAAM,OAAO,CAAA;;uBAIjE,YAMY,wBALL,QAAA,MAAE,OAAA,EAAA;IACP,OAAM;IACL,OAAK,eAAA,GAAK,QAAA,YAAQ,UAAc,eAAA,MAAe,UAAQ,CAAA;;2BAChD,CAAR,WAAQ,KAAA,QAAA,UAAA,EAAA,gBAAA,MACR,gBAAG,QAAA,QAAQ,eAAA,MAAe,QAAQ,WAAA,MAAU,EAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"HttpMethod.vue.script.js","names":[],"sources":["../../src/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { normalizeHttpMethod } from '@scalar/helpers/http/normalize-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: HttpMethod | string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => normalizeHttpMethod(props.method))\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n class=\"uppercase\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;;EAYd,MAAM,iBAAiB,eACrB,kBAAkB,OAAO,MAAM,UAAU,EAAE,CAAC,CAC9C;;EAGA,MAAM,aAAa,eAAe,oBAAoB,MAAM,MAAM,CAAC;;uBAIjE,YAMY,wBALL,QA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createElementVNode, createSlots, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, renderList, renderSlot, unref, useSlots, withCtx } from "vue";
4
4
  import { ScalarSidebar, ScalarSidebarItems } from "@scalar/components/sidebar";
5
5
  //#region src/components/ScalarSidebar.vue?vue&type=script&setup=true&lang.ts
6
- var ScalarSidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
6
+ var ScalarSidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
7
  __name: "ScalarSidebar",
8
8
  props: {
9
9
  layout: {},
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarSidebar.vue.script.js","names":[],"sources":["../../src/components/ScalarSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSidebar, ScalarSidebarItems } from '@scalar/components/sidebar'\n\nimport { filterItems } from '@/helpers/filter-items'\nimport type {\n DraggingItem,\n HoveredItem,\n UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarItem from './SidebarItem.vue'\n\nconst {\n layout,\n items,\n indent = 20,\n} = defineProps<{\n /**\n * Layout type for the sidebar.\n * Determines whether the sidebar should behave in 'client' or 'reference' mode.\n */\n layout: Layout\n /**\n * List of items to render in the sidebar.\n */\n items: Item[]\n /**\n * Function to determine whether a given item (by id) is currently selected.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine whether a given item (by id) is currently expanded (open to show children).\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 * The indentation in pixels to apply to nested items/groups in the sidebar.\n */\n indent?: number\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 user reorders sidebar items via drag-and-drop.\n * @param draggingItem - The item being dragged.\n * @param hoveredItem - The item currently being hovered over.\n */\n (e: 'reorder', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when a sidebar item is selected.\n * @param id - The id of the selected item.\n */\n (e: 'selectItem', id: string): 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 /** Overrides the main items list */\n default?(): unknown\n /** Adds an optional decorator for each item like an edit menu */\n decorator?(props: { item: Item }): unknown\n /** Places content at the top of the sidebar outside of the items list */\n header?(): unknown\n /** Places content between the header and the items list */\n spacer?(): unknown\n /** Places content at the bottom of the sidebar outside of the items list */\n footer?(): unknown\n /** Places content before the first item in the items list */\n before?(): unknown\n /** Places content when an item is empty */\n empty?(props: { item: Item }): unknown\n /** Places content when an item is empty */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\n/**\n * Handle drag and drop reordering of sidebar items.\n * Emit the reorder event to the parent component for handling.\n */\nconst handleDragEnd = (\n draggingItem: DraggingItem,\n hoveredItem: HoveredItem,\n) => {\n emit('reorder', draggingItem, hoveredItem)\n}\n</script>\n<template>\n <ScalarSidebar\n class=\"flex min-h-0 flex-col\"\n :style=\"{ '--scalar-sidebar-indent': indent + 'px' }\">\n <slot name=\"header\" />\n <slot>\n <ScalarSidebarItems class=\"custom-scroll\">\n <!-- First item -->\n <slot name=\"before\" />\n <SidebarItem\n v-for=\"item in filterItems(layout, items)\"\n :key=\"item.id\"\n :isDraggable=\"isDraggable ?? layout === 'client'\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"item\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"handleDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"props\">\n <slot\n name=\"decorator\"\n v-bind=\"props\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"props\">\n <slot\n name=\"empty\"\n v-bind=\"props\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"props\">\n <slot\n name=\"icon\"\n v-bind=\"props\" />\n </template>\n </SidebarItem>\n </ScalarSidebarItems>\n <!-- Spacer -->\n <slot name=\"spacer\">\n <div class=\"flex-1\"></div>\n </slot>\n </slot>\n <slot name=\"footer\" />\n </ScalarSidebar>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EA0DA,MAAM,OAAO;EAqBb,MAAM,QAAQ,UAAA;;;;;EAuBd,MAAM,iBACJ,cACA,gBACG;AACH,QAAK,WAAW,cAAc,YAAW;;;uBAIzC,YAkDgB,MAAA,cAAA,EAAA;IAjDd,OAAM;IACL,OAAK,eAAA,EAAA,2BAA+B,QAAA,SAAM,MAAA,CAAA;;2BACrB;KAAtB,WAAsB,KAAA,QAAA,SAAA;KACtB,WA4CO,KAAA,QAAA,WAAA,EAAA,QAAA,CA3CL,YAsCqB,MAAA,mBAAA,EAAA,EAtCD,OAAM,iBAAe,EAAA;6BAEjB,CAAtB,WAAsB,KAAA,QAAA,SAAA,GAAA,UAAA,KAAA,EACtB,mBAkCc,UAAA,MAAA,WAjCG,MAAA,YAAW,CAAC,QAAA,QAAQ,QAAA,MAAK,GAAjC,SAAI;2BADb,YAkCc,qBAAA;QAhCX,KAAK,KAAK;QACV,aAAa,QAAA,eAAe,QAAA,WAAM;QAClC,aAAa,QAAA;QACb,YAAY,QAAA;QACZ,YAAY,QAAA;QACN;QACN,QAAQ,QAAA;QACR,SAAS,QAAA;QACT,aAAW;QACX,cAAU,OAAA,OAAA,OAAA,MAAG,OAAO,KAAI,cAAe,GAAE;QACzC,eAAW,OAAA,OAAA,OAAA,MAAG,OAAO,KAAI,eAAgB,GAAE;;QAEpC,MAAM,YAAA;eACX;sBAAW,UAAK,CACjB,WAEmB,KAAA,QAAA,aAFnB,WAEmB,EAAA,SAAA,MAAA,EAAT,MAAK,CAAA,CAAA,CAAA;;;QAGT,MAAM,QAAA;eACX;sBAAO,UAAK,CACb,WAEmB,KAAA,QAAA,SAFnB,WAEmB,EAAA,SAAA,MAAA,EAAT,MAAK,CAAA,CAAA,CAAA;;;QAGT,MAAM,OAAA;eACX;sBAAM,UAAK,CACZ,WAEmB,KAAA,QAAA,QAFnB,WAEmB,EAAA,SAAA,MAAA,EAAT,MAAK,CAAA,CAAA,CAAA;;;;;;;;;;;;;;SAKrB,WAEO,KAAA,QAAA,UAAA,EAAA,QAAA,CAAA,OAAA,OAAA,OAAA,KADL,mBAA0B,OAAA,EAArB,OAAM,UAAQ,EAAA,MAAA,GAAA,EAAA,CAAA,CAAA,CAAA;KAGvB,WAAsB,KAAA,QAAA,SAAA"}
1
+ {"version":3,"file":"ScalarSidebar.vue.script.js","names":[],"sources":["../../src/components/ScalarSidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSidebar, ScalarSidebarItems } from '@scalar/components/sidebar'\n\nimport { filterItems } from '@/helpers/filter-items'\nimport type {\n DraggingItem,\n HoveredItem,\n UseDraggableOptions,\n} from '@/hooks/use-draggable'\nimport type { Item, Layout, SidebarOptions } from '@/types'\n\nimport SidebarItem from './SidebarItem.vue'\n\nconst {\n layout,\n items,\n indent = 20,\n} = defineProps<{\n /**\n * Layout type for the sidebar.\n * Determines whether the sidebar should behave in 'client' or 'reference' mode.\n */\n layout: Layout\n /**\n * List of items to render in the sidebar.\n */\n items: Item[]\n /**\n * Function to determine whether a given item (by id) is currently selected.\n */\n isSelected: (id: string) => boolean\n /**\n * Function to determine whether a given item (by id) is currently expanded (open to show children).\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 * The indentation in pixels to apply to nested items/groups in the sidebar.\n */\n indent?: number\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 user reorders sidebar items via drag-and-drop.\n * @param draggingItem - The item being dragged.\n * @param hoveredItem - The item currently being hovered over.\n */\n (e: 'reorder', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n\n /**\n * Emitted when a sidebar item is selected.\n * @param id - The id of the selected item.\n */\n (e: 'selectItem', id: string): 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 /** Overrides the main items list */\n default?(): unknown\n /** Adds an optional decorator for each item like an edit menu */\n decorator?(props: { item: Item }): unknown\n /** Places content at the top of the sidebar outside of the items list */\n header?(): unknown\n /** Places content between the header and the items list */\n spacer?(): unknown\n /** Places content at the bottom of the sidebar outside of the items list */\n footer?(): unknown\n /** Places content before the first item in the items list */\n before?(): unknown\n /** Places content when an item is empty */\n empty?(props: { item: Item }): unknown\n /** Places content when an item is empty */\n icon?(props: { item: Item; open: boolean }): unknown\n}>()\n\n/**\n * Handle drag and drop reordering of sidebar items.\n * Emit the reorder event to the parent component for handling.\n */\nconst handleDragEnd = (\n draggingItem: DraggingItem,\n hoveredItem: HoveredItem,\n) => {\n emit('reorder', draggingItem, hoveredItem)\n}\n</script>\n<template>\n <ScalarSidebar\n class=\"flex min-h-0 flex-col\"\n :style=\"{ '--scalar-sidebar-indent': indent + 'px' }\">\n <slot name=\"header\" />\n <slot>\n <ScalarSidebarItems class=\"custom-scroll\">\n <!-- First item -->\n <slot name=\"before\" />\n <SidebarItem\n v-for=\"item in filterItems(layout, items)\"\n :key=\"item.id\"\n :isDraggable=\"isDraggable ?? layout === 'client'\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"isExpanded\"\n :isSelected=\"isSelected\"\n :item=\"item\"\n :layout=\"layout\"\n :options=\"options\"\n @onDragEnd=\"handleDragEnd\"\n @selectItem=\"(id) => emit('selectItem', id)\"\n @toggleGroup=\"(id) => emit('toggleGroup', id)\">\n <template\n v-if=\"slots.decorator\"\n #decorator=\"props\">\n <slot\n name=\"decorator\"\n v-bind=\"props\" />\n </template>\n <template\n v-if=\"slots.empty\"\n #empty=\"props\">\n <slot\n name=\"empty\"\n v-bind=\"props\" />\n </template>\n <template\n v-if=\"slots.icon\"\n #icon=\"props\">\n <slot\n name=\"icon\"\n v-bind=\"props\" />\n </template>\n </SidebarItem>\n </ScalarSidebarItems>\n <!-- Spacer -->\n <slot name=\"spacer\">\n <div class=\"flex-1\"></div>\n </slot>\n </slot>\n <slot name=\"footer\" />\n </ScalarSidebar>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EA0DA,MAAM,OAAO;EAqBb,MAAM,QAAQ,SAAA;;;;;EAuBd,MAAM,iBACJ,cACA,gBACG;GACH,KAAK,WAAW,cAAc,WAAW;EAC3C;;uBAGE,YAkDgB,MAAA,aAAA,GAAA;IAjDd,OAAM;IACL,OAAK,eAAA,EAAA,2BAA+B,QAAA,SAAM,KAAA,CAAA;;2BACrB;KAAtB,WAAsB,KAAA,QAAA,QAAA;KACtB,WA4CO,KAAA,QAAA,WAAA,CAAA,SAAA,CA3CL,YAsCqB,MAAA,kBAAA,GAAA,EAtCD,OAAM,gBAAe,GAAA;6BAEjB,CAAtB,WAAsB,KAAA,QAAA,QAAA,IAAA,UAAA,IAAA,GACtB,mBAkCc,UAAA,MAAA,WAjCG,MAAA,WAAA,CAAW,CAAC,QAAA,QAAQ,QAAA,KAAK,IAAjC,SAAI;2BADb,YAkCc,qBAAA;QAhCX,KAAK,KAAK;QACV,aAAa,QAAA,eAAe,QAAA,WAAM;QAClC,aAAa,QAAA;QACb,YAAY,QAAA;QACZ,YAAY,QAAA;QACN;QACN,QAAQ,QAAA;QACR,SAAS,QAAA;QACT,aAAW;QACX,cAAU,OAAA,OAAA,OAAA,MAAG,OAAO,KAAI,cAAe,EAAE;QACzC,eAAW,OAAA,OAAA,OAAA,MAAG,OAAO,KAAI,eAAgB,EAAE;;QAEpC,MAAM,YAAA;eACX;sBAAW,UAAK,CACjB,WAEmB,KAAA,QAAA,aAFnB,WAEmB,EAAA,SAAA,KAAA,GAAT,KAAK,CAAA,CAAA,CAAA;;;QAGT,MAAM,QAAA;eACX;sBAAO,UAAK,CACb,WAEmB,KAAA,QAAA,SAFnB,WAEmB,EAAA,SAAA,KAAA,GAAT,KAAK,CAAA,CAAA,CAAA;;;QAGT,MAAM,OAAA;eACX;sBAAM,UAAK,CACZ,WAEmB,KAAA,QAAA,QAFnB,WAEmB,EAAA,SAAA,KAAA,GAAT,KAAK,CAAA,CAAA,CAAA;;;;;;;;;;;;;;SAKrB,WAEO,KAAA,QAAA,UAAA,CAAA,SAAA,CAAA,OAAA,OAAA,OAAA,KADL,mBAA0B,OAAA,EAArB,OAAM,SAAQ,GAAA,MAAA,EAAA,EAAA,CAAA,CAAA,CAAA;KAGvB,WAAsB,KAAA,QAAA,QAAA"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../_virtual/_plugin-vue_export-he
2
2
  import SidebarHttpBadge_vue_vue_type_script_setup_true_lang_default from "./SidebarHttpBadge.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/components/SidebarHttpBadge.vue
5
- var SidebarHttpBadge_default = /* @__PURE__ */ _plugin_vue_export_helper_default(SidebarHttpBadge_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bdef8365"]]);
5
+ var SidebarHttpBadge_default = /*#__PURE__*/ _plugin_vue_export_helper_default(SidebarHttpBadge_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-bdef8365"]]);
6
6
  //#endregion
7
7
  export { SidebarHttpBadge_default as default };
8
8
 
@@ -4,7 +4,7 @@ import { getHttpMethodInfo } from "@scalar/helpers/http/http-info";
4
4
  import { ScalarIconWebhooksLogo } from "@scalar/icons";
5
5
  //#region src/components/SidebarHttpBadge.vue?vue&type=script&setup=true&lang.ts
6
6
  var _hoisted_1 = { class: "sr-only" };
7
- var SidebarHttpBadge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
7
+ var SidebarHttpBadge_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
8
8
  __name: "SidebarHttpBadge",
9
9
  props: {
10
10
  method: {},
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarHttpBadge.vue.script.js","names":[],"sources":["../../src/components/SidebarHttpBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\n\nimport HttpMethod from './HttpMethod.vue'\n\ndefineProps<{\n method: string\n active?: boolean\n label?: string\n webhook?: boolean\n}>()\n</script>\n<template>\n <HttpMethod\n :class=\"[\n 'sidebar-heading-type',\n `sidebar-heading-type--${method.toLowerCase()}`,\n { 'sidebar-heading-type-active': active },\n ]\"\n :method=\"method\"\n property=\"--method-color\"\n short>\n <span class=\"sr-only\">{{ label ?? 'HTTP Method' }}:&nbsp;</span>\n <slot>\n <ScalarIconWebhooksLogo\n v-if=\"webhook\"\n :style=\"{\n color: getHttpMethodInfo(method).colorVar,\n }\"\n weight=\"bold\" />\n </slot>\n </HttpMethod>\n</template>\n\n<style scoped>\n.sidebar-heading-type {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n overflow: hidden;\n line-height: 14px;\n flex-shrink: 0;\n text-transform: uppercase;\n color: var(--method-color, var(--scalar-color-1));\n font-size: 10px;\n font-weight: var(--scalar-bold);\n font-family: var(--scalar-font-code);\n white-space: nowrap;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;uBAcE,YAkBa,oBAAA;IAjBV,OAAK,eAAA;;8BAAiE,QAAA,OAAO,aAAW;sCAA6C,QAAA,QAAM;;IAK3I,QAAQ,QAAA;IACT,UAAS;IACT,OAAA;;2BACgE,CAAhE,mBAAgE,QAAhE,YAAgE,gBAAvC,QAAA,SAAK,cAAA,GAAoB,SAAO,EAAA,EACzD,WAOO,KAAA,QAAA,WAAA,EAAA,QAAA,CALG,QAAA,WAAA,WAAA,EADR,YAKkB,MAAA,uBAAA,EAAA;;KAHf,OAAK,eAAA,EAAA,OAAqB,MAAA,kBAAiB,CAAC,QAAA,OAAM,CAAE,UAAA,CAAA;KAGrD,QAAO"}
1
+ {"version":3,"file":"SidebarHttpBadge.vue.script.js","names":[],"sources":["../../src/components/SidebarHttpBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\n\nimport HttpMethod from './HttpMethod.vue'\n\ndefineProps<{\n method: string\n active?: boolean\n label?: string\n webhook?: boolean\n}>()\n</script>\n<template>\n <HttpMethod\n :class=\"[\n 'sidebar-heading-type',\n `sidebar-heading-type--${method.toLowerCase()}`,\n { 'sidebar-heading-type-active': active },\n ]\"\n :method=\"method\"\n property=\"--method-color\"\n short>\n <span class=\"sr-only\">{{ label ?? 'HTTP Method' }}:&nbsp;</span>\n <slot>\n <ScalarIconWebhooksLogo\n v-if=\"webhook\"\n :style=\"{\n color: getHttpMethodInfo(method).colorVar,\n }\"\n weight=\"bold\" />\n </slot>\n </HttpMethod>\n</template>\n\n<style scoped>\n.sidebar-heading-type {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n overflow: hidden;\n line-height: 14px;\n flex-shrink: 0;\n text-transform: uppercase;\n color: var(--method-color, var(--scalar-color-1));\n font-size: 10px;\n font-weight: var(--scalar-bold);\n font-family: var(--scalar-font-code);\n white-space: nowrap;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;uBAcE,YAkBa,oBAAA;IAjBV,OAAK,eAAA;;8BAAiE,QAAA,OAAO,YAAW;sCAA6C,QAAA,OAAM;;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;IACjB;;;OAGG;IACH,SAAS,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAA;IAC1C;;;OAGG;IACH,KAAK,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAA;IACtC;;;OAGG;IACH,IAAI,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAA;CACrD,CAAC;AAonBF,QAAA,MAAM,UAAU;;;;;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -17,7 +17,7 @@ var _hoisted_2 = {
17
17
  key: 0,
18
18
  class: "line-through"
19
19
  };
20
- var SidebarItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
20
+ var SidebarItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
21
21
  __name: "SidebarItem",
22
22
  props: {
23
23
  item: {},
@@ -154,10 +154,7 @@ var SidebarItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
154
154
  "layout",
155
155
  "options"
156
156
  ]);
157
- }), 128)), slots.empty && (__props.item.children?.length ?? 0) === 0 ? renderSlot(_ctx.$slots, "empty", {
158
- key: 0,
159
- item: __props.item
160
- }) : createCommentVNode("", true)]),
157
+ }), 128)), slots.empty && (__props.item.children?.length ?? 0) === 0 ? renderSlot(_ctx.$slots, "empty", { item: __props.item }, void 0, void 0, 0) : createCommentVNode("", true)]),
161
158
  default: withCtx(() => [isDeprecated(__props.item) ? (openBlock(), createElementBlock("span", _hoisted_1, [createVNode(SidebarItemLabel_default, {
162
159
  item: __props.item,
163
160
  operationTitleSource: __props.options?.operationTitleSource
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItem.vue.script.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\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} = 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 * 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</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 :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=\"layout === 'reference' && item.type === 'text'\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\"\n @click=\"() => emit('selectItem', item.id)\"\n @toggle=\"() => emit('toggleGroup', item.id)\">\n <template\n v-if=\"item.type === 'document'\"\n #icon=\"{ open }\">\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"('icon' in item && item.icon) || 'interface-content-folder'\" />\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\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 <!--\n Hide the chevron\n -->\n <template\n v-if=\"'method' in item\"\n #toggle>\n <span class=\"hidden\"></span>\n </template>\n <template\n v-else\n #toggle=\"{ open }\">\n <ScalarSidebarGroupToggle\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 <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 :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 is=\"button\"\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n :selected=\"isSelected(item.id)\"\n v-on=\"draggableEvents\"\n @click=\"() => emit('selectItem', 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 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 </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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEA,MAAM,OAAO;EAoBb,MAAM,QAAQ,UAAA;EAkBd,MAAM,WACJ,gBAC4C;AAC5C,UAAO,aAAa,eAAe,YAAY;;EAGjD,MAAM,gBACJ,gBACiD;AACjD,WAAQ,kBAAkB,eAAe,YAAY,iBAAiB;;;;;EAMxE,MAAM,aAAa,cAA4B,gBAA6B;AAC1E,QAAK,aAAa,cAAc,YAAW;;EAE7C,MAAM,EAAE,gBAAgB,oBAAoB,aAAa;GACvD,IAAI,QAAA,KAAK;GACT,aAAU,QAAA;GACV,aAAU,QAAA;GACV;G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;6BADA,CAFrB,WAEqB,KAAA,QAAA,aAAA,EADlB,MAAA,QAAA,MAAI,CAAA,CAAA,CAAA;;;;;;;;;;uBAkDb,YAqDoB,MAAA,kBAAA,EArDpB,WAqDoB;;IApDlB,IAAG;MAEK,MAAA,eAAc,EAAA;IACtB,OAAM;IACL,mBAAiB,QAAA,KAAK;IACtB,UAAU,QAAA,WAAW,QAAA,KAAK,GAAE;MAC7B,WAAM,MAAgB,gBAAD,CAAA,EAAA,EACpB,SAAK,OAAA,OAAA,OAAA,WAAQ,KAAI,cAAe,QAAA,KAAK,GAAE,GAAA,CAAA,EAAA,YAAA;2BAejC,CALC,aAAa,QAAA,KAAI,IAAA,WAAA,EADzB,mBAMO,QANP,YAMO,CAHL,YAE0D,0BAAA;KADvD,MAAA,QAAA;KACA,sBAAsB,QAAA,SAAS;qEAEpC,YAG0D,0BAAA;;KADvD,MAAA,QAAA;KACA,sBAAsB,QAAA,SAAS;;;;IAjB1B,MAAM,OAAA;WACX;uBAIgB,CAHjB,WAGiB,KAAA,QAAA,QAAA;MAFd,MAAM,QAAA;MAEN,MAAM;;;;gBAcS,QAAA,OAAA;WACjB;uBAYsC,CAAA,YAVnB,QAAA,QAAA,WAAA,EADpB,YAWuC,0BAAA;;MATpC,QAAQ,QAAA,WAAW,QAAA,KAAK,GAAE;MAC3B,OAAK,eAAA,CAAC,uBAAqB,EAAA,6MAC+Q,MAAM,WAAA,CAAA,CAAA;MAK/S,OAAO,QAAA,SAAS,QAAQ;MACxB,QAAQ,QAAA,KAAK;MACb,SAAS,QAAA,KAAK,SAAI;;;;;;;;;;IAGf,MAAM,YAAA;WACX;uBAKsB,CAJvB,YAIuB,8BAAA,MAAA;6BADA,CAFrB,WAEqB,KAAA,QAAA,aAAA,EADlB,MAAA,QAAA,MAAI,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"SidebarItem.vue.script.js","names":[],"sources":["../../src/components/SidebarItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarSidebarGroup,\n ScalarSidebarGroupToggle,\n ScalarSidebarItem,\n ScalarSidebarSection,\n} from '@scalar/components/sidebar'\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} = 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 * 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</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 :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=\"layout === 'reference' && item.type === 'text'\"\n :open=\"isExpanded(item.id)\"\n v-on=\"draggableEvents\"\n @click=\"() => emit('selectItem', item.id)\"\n @toggle=\"() => emit('toggleGroup', item.id)\">\n <template\n v-if=\"item.type === 'document'\"\n #icon=\"{ open }\">\n <slot\n :item=\"item\"\n name=\"icon\"\n :open=\"open\">\n <LibraryIcon\n class=\"block\"\n :src=\"('icon' in item && item.icon) || 'interface-content-folder'\" />\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\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 <!--\n Hide the chevron\n -->\n <template\n v-if=\"'method' in item\"\n #toggle>\n <span class=\"hidden\"></span>\n </template>\n <template\n v-else\n #toggle=\"{ open }\">\n <ScalarSidebarGroupToggle\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 <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 :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 is=\"button\"\n v-else\n v-bind=\"draggableAttrs\"\n class=\"relative\"\n :data-sidebar-id=\"item.id\"\n :selected=\"isSelected(item.id)\"\n v-on=\"draggableEvents\"\n @click=\"() => emit('selectItem', 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 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 </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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEA,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,QAAA,IAAI,IACZ,YAAY,QAAA,QAAQ,QAAA,KAAK,UAAU,QAAA,SAAS,4BAA4B,IACxE,CAAC,CACP;;;UAKU,SAAA,MAAS,SAAM,KAAQ,QAAQ,QAAA,IAAI,KAAA,UAAA,GAD3C,YA2CuB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WAqDoB;;IApDlB,IAAG;MAEK,MAAA,cAAA,GAAc;IACtB,OAAM;IACL,mBAAiB,QAAA,KAAK;IACtB,UAAU,QAAA,WAAW,QAAA,KAAK,EAAE;MAC7B,WAAM,MAAgB,eAAA,CAAD,GAAA,EACpB,SAAK,OAAA,OAAA,OAAA,WAAQ,KAAI,cAAe,QAAA,KAAK,EAAE,GAAA,CAAA,GAAA,YAAA;2BAejC,CALC,aAAa,QAAA,IAAI,KAAA,UAAA,GADzB,mBAMO,QANP,YAMO,CAHL,YAE0D,0BAAA;KADvD,MAAA,QAAA;KACA,sBAAsB,QAAA,SAAS;qEAEpC,YAG0D,0BAAA;;KADvD,MAAA,QAAA;KACA,sBAAsB,QAAA,SAAS;;;;IAjB1B,MAAM,OAAA;WACX;uBAIgB,CAHjB,WAGiB,KAAA,QAAA,QAAA;MAFd,MAAM,QAAA;MAEN,MAAM;;;;gBAcS,QAAA,OAAA;WACjB;uBAYsC,CAAA,YAVnB,QAAA,QAAA,UAAA,GADpB,YAWuC,0BAAA;;MATpC,QAAQ,QAAA,WAAW,QAAA,KAAK,EAAE;MAC3B,OAAK,eAAA,CAAC,uBAAqB,EAAA,6MAC+Q,MAAM,UAAA,CAAA,CAAA;MAK/S,OAAO,QAAA,SAAS,QAAQ;MACxB,QAAQ,QAAA,KAAK;MACb,SAAS,QAAA,KAAK,SAAI;;;;;;;;;;IAGf,MAAM,YAAA;WACX;uBAKsB,CAJvB,YAIuB,8BAAA,MAAA;6BADA,CAFrB,WAEqB,KAAA,QAAA,aAAA,EADlB,MAAA,QAAA,KAAI,CAAA,CAAA,CAAA"}
@@ -6,7 +6,7 @@ var _hoisted_1 = { class: "absolute top-[1lh] right-0.75 flex -translate-y-1/2 o
6
6
  function _sfc_render(_ctx, _cache) {
7
7
  return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "default")]);
8
8
  }
9
- var SidebarItemDecorator_default = /* @__PURE__ */ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
9
+ var SidebarItemDecorator_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
10
10
  //#endregion
11
11
  export { SidebarItemDecorator_default as default };
12
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItemDecorator.vue.js","names":[],"sources":["../../src/components/SidebarItemDecorator.vue"],"sourcesContent":["<template>\n <div\n class=\"absolute top-[1lh] right-0.75 flex -translate-y-1/2 opacity-0 peer-hover/button:opacity-100 peer-focus-visible/button:opacity-100 focus-within:opacity-100 hover:opacity-100 has-[&[aria-expanded=true]]:opacity-100\">\n <slot />\n </div>\n</template>\n"],"mappings":";;;;mBAEI,OAAM,wNAAsN;;qBAD9N,mBAGM,OAHN,YAGM,CADJ,WAAQ,KAAA,QAAA,UAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"SidebarItemDecorator.vue.js","names":[],"sources":["../../src/components/SidebarItemDecorator.vue"],"sourcesContent":["<template>\n <div\n class=\"absolute top-[1lh] right-0.75 flex -translate-y-1/2 opacity-0 peer-hover/button:opacity-100 peer-focus-visible/button:opacity-100 focus-within:opacity-100 hover:opacity-100 has-[&[aria-expanded=true]]:opacity-100\">\n <slot />\n </div>\n</template>\n"],"mappings":";;;;mBAEI,OAAM,uNAAsN;;qBAD9N,mBAGM,OAHN,YAGM,CADJ,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { createBlock, defineComponent, openBlock, unref } from "vue";
2
2
  import { ScalarWrappingText } from "@scalar/components/wrapping-text";
3
3
  //#region src/components/SidebarItemLabel.vue?vue&type=script&setup=true&lang.ts
4
- var SidebarItemLabel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4
+ var SidebarItemLabel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5
5
  __name: "SidebarItemLabel",
6
6
  props: {
7
7
  item: {},
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarItemLabel.vue.script.js","names":[],"sources":["../../src/components/SidebarItemLabel.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\nimport type { Item } from '@/types'\n\nconst { item } = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The source of the operation title.\n */\n operationTitleSource?: 'path' | 'summary'\n}>()\n</script>\n<template>\n <ScalarWrappingText\n v-if=\"item.type === 'model' || item.type === 'example'\"\n preset=\"property\"\n :text=\"item.title\" />\n <ScalarWrappingText\n v-else\n :text=\"\n operationTitleSource === 'path' && 'path' in item\n ? (item.path as string)\n : (item.title as string)\n \" />\n</template>\n"],"mappings":";;;;;;;;;;;UAkBU,QAAA,KAAK,SAAI,WAAgB,QAAA,KAAK,SAAI,aAAA,WAAA,EAD1C,YAGuB,MAAA,mBAAA,EAAA;;IADrB,QAAO;IACN,MAAM,QAAA,KAAK;0CACd,YAMM,MAAA,mBAAA,EAAA;;IAJH,MAAa,QAAA,yBAAoB,UAAA,UAAyB,QAAA,OAAgB,QAAA,KAAK,OAA2B,QAAA,KAAK"}
1
+ {"version":3,"file":"SidebarItemLabel.vue.script.js","names":[],"sources":["../../src/components/SidebarItemLabel.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\nimport type { Item } from '@/types'\n\nconst { item } = defineProps<{\n /**\n * The sidebar item to render.\n */\n item: Item\n /**\n * The source of the operation title.\n */\n operationTitleSource?: 'path' | 'summary'\n}>()\n</script>\n<template>\n <ScalarWrappingText\n v-if=\"item.type === 'model' || item.type === 'example'\"\n preset=\"property\"\n :text=\"item.title\" />\n <ScalarWrappingText\n v-else\n :text=\"\n operationTitleSource === 'path' && 'path' in item\n ? (item.path as string)\n : (item.title as string)\n \" />\n</template>\n"],"mappings":";;;;;;;;;;;UAkBU,QAAA,KAAK,SAAI,WAAgB,QAAA,KAAK,SAAI,aAAA,UAAA,GAD1C,YAGuB,MAAA,kBAAA,GAAA;;IADrB,QAAO;IACN,MAAM,QAAA,KAAK;0CACd,YAMM,MAAA,kBAAA,GAAA;;IAJH,MAAa,QAAA,yBAAoB,UAAA,UAAyB,QAAA,OAAgB,QAAA,KAAK,OAA2B,QAAA,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-sidebar-state.js","names":[],"sources":["../../src/helpers/create-sidebar-state.ts"],"sourcesContent":["import { type MaybeRefOrGetter, computed, ref, toValue } from 'vue'\n\nimport { generateReverseIndex } from './generate-reverse-index'\n\ntype SidebarStateOptions = Partial<{\n /** The key used to access child items in the sidebar tree. Defaults to \"children\". */\n key: string\n /** Optional event hooks for sidebar item lifecycle */\n hooks: Partial<{\n /**\n * Called before an item is expanded.\n * @param id - The ID of the item to expand.\n */\n onBeforeExpand: (id: string) => void\n /**\n * Called after an item is expanded.\n * @param id - The ID of the item that was expanded.\n */\n onAfterExpand: (id: string) => void\n /**\n * Called just before a sidebar item selection changes.\n * @param id - The ID of the item that is about to be selected, or null if deselecting.\n */\n onBeforeSelect: (id: string | null) => void\n /**\n * Called immediately after a sidebar item has been selected.\n * @param id - The ID of the item that was selected, or null if selection was cleared.\n */\n onAfterSelect: (id: string | null) => void\n }>\n}>\n\n/**\n * Creates and manages the state for a sidebar tree, including selection and expansion of items.\n *\n * @template T - The type of sidebar items, which must include an `id` property.\n * @param items - The array of sidebar items.\n * @param options - Optional configuration for customizing behavior and hooks.\n * @returns An object containing sidebar state and methods to manipulate it.\n *\n * ## Example Usage\n *\n * ```ts\n * // Example sidebar items\n * const sidebarItems = [\n * { id: 'root', label: 'Root', children: [\n * { id: 'child1', label: 'Child 1' },\n * { id: 'child2', label: 'Child 2', children: [\n * { id: 'grandchild1', label: 'Grandchild 1' }\n * ]}\n * ]}\n * ]\n *\n * // Create sidebar state\n * const sidebarState = createSidebarState(sidebarItems, {\n * key: 'children',\n * hooks: {\n * onBeforeSelect: (id) => console.log('Before select:', id),\n * onAfterSelect: (id) => console.log('After select:', id),\n * onBeforeExpand: (id) => console.log('Before expand:', id),\n * onAfterExpand: (id) => console.log('After expand:', id),\n * }\n * })\n *\n * // Select an item\n * await sidebarState.setSelected('grandchild1')\n * // Expand an item\n * await sidebarState.setExpanded('child2', true)\n * ```\n */\nexport const createSidebarState = <T extends { id: string }>(\n items: MaybeRefOrGetter<T[]>,\n options?: SidebarStateOptions,\n) => {\n // Reverse index for quick lookup of items and their parents\n const index = computed(() =>\n generateReverseIndex({\n items: toValue(items),\n nestedKey: options?.key ?? 'children',\n }),\n )\n // Reactive record of selected item ids\n const selectedItems = ref<Record<string, boolean>>({})\n // Reactive record of expanded item ids\n const expandedItems = ref<Record<string, boolean>>({})\n\n // Lowest level selected item\n const selectedItem = ref<string | null>(null)\n\n /**\n * Selects the given item by id, and recursively marks all its parent items as selected.\n * Triggers optional lifecycle hooks before and after selection.\n *\n * @param id - The ID of the item to select.\n *\n * ## Example\n * ```ts\n * await sidebarState.setSelected('grandchild1')\n * // selectedItems.value will include 'grandchild1', 'child2', and 'root'\n * ```\n */\n const setSelected = (id: string | null) => {\n /**\n * Recursively mark all parent items as selected.\n * @param node - The current node to mark as selected.\n */\n const markSelected = (node: (T & { parent?: T }) | undefined) => {\n if (!node) {\n return\n }\n selectedItems.value[node.id] = true\n if ('parent' in node && node.parent) {\n markSelected(node.parent)\n }\n }\n\n // Call onBeforeSelect hook if provided\n if (options?.hooks?.onBeforeSelect) {\n options.hooks.onBeforeSelect(id)\n }\n\n // Clear previous selection\n selectedItems.value = {}\n selectedItem.value = id\n\n // If id is null, do not select anything\n // We already cleared the selection above\n if (id !== null) {\n // Mark the selected item and all its parents as selected\n markSelected(index.value.get(id))\n }\n\n // Call onAfterSelect hook if provided\n if (options?.hooks?.onAfterSelect) {\n options.hooks.onAfterSelect(id)\n }\n }\n\n /**\n * Expands or collapses the given item by id.\n * When expanding, recursively expands all parent items.\n * Triggers optional lifecycle hooks before and after expansion.\n *\n * @param id - The ID of the item to expand or collapse.\n * @param value - true to expand, false to collapse.\n *\n * ## Example\n * ```ts\n * await sidebarState.setExpanded('child2', true)\n * // expandedItems.value will include 'child2' and 'root'\n *\n * await sidebarState.setExpanded('child2', false)\n * // expandedItems.value['child2'] will be false\n * ```\n */\n const setExpanded = (id: string, value: boolean) => {\n /**\n * Recursively expand all parent items of the given node.\n * @param node - The current node to expand.\n */\n const openParents = (node: (T & { parent?: T }) | undefined) => {\n if (!node) {\n return\n }\n expandedItems.value[node.id] = true\n if ('parent' in node && node.parent) {\n openParents(node.parent)\n }\n }\n\n // Call onBeforeExpand hook if provided\n if (options?.hooks?.onBeforeExpand) {\n options.hooks.onBeforeExpand(id)\n }\n\n // When collapsing, only collapse the specified item, not its parents\n if (value === false) {\n expandedItems.value[id] = false\n } else {\n // When expanding, ensure all parents are expanded as well\n openParents(index.value.get(id))\n }\n\n // Call onAfterExpand hook if provided\n if (options?.hooks?.onAfterExpand) {\n options.hooks.onAfterExpand(id)\n }\n }\n\n const isExpanded = (id: string) => {\n return expandedItems.value[id] ?? false\n }\n\n const isSelected = (id: string) => {\n return selectedItems.value[id] ?? false\n }\n\n const getEntryById = (id: string) => index.value.get(id)\n\n return {\n items: computed(() => toValue(items)),\n index,\n selectedItems,\n expandedItems,\n selectedItem,\n setSelected,\n setExpanded,\n isExpanded,\n isSelected,\n getEntryById,\n reset: () => {\n selectedItems.value = {}\n expandedItems.value = {}\n },\n }\n}\n\nexport type SidebarState<Item extends { id: string }> = ReturnType<typeof createSidebarState<Item>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAa,sBACX,OACA,YACG;CAEH,MAAM,QAAQ,eACZ,qBAAqB;EACnB,OAAO,QAAQ,MAAM;EACrB,WAAW,SAAS,OAAO;EAC5B,CAAC,CACH;CAED,MAAM,gBAAgB,IAA6B,EAAE,CAAC;CAEtD,MAAM,gBAAgB,IAA6B,EAAE,CAAC;CAGtD,MAAM,eAAe,IAAmB,KAAK;;;;;;;;;;;;;CAc7C,MAAM,eAAe,OAAsB;;;;;EAKzC,MAAM,gBAAgB,SAA2C;AAC/D,OAAI,CAAC,KACH;AAEF,iBAAc,MAAM,KAAK,MAAM;AAC/B,OAAI,YAAY,QAAQ,KAAK,OAC3B,cAAa,KAAK,OAAO;;AAK7B,MAAI,SAAS,OAAO,eAClB,SAAQ,MAAM,eAAe,GAAG;AAIlC,gBAAc,QAAQ,EAAE;AACxB,eAAa,QAAQ;AAIrB,MAAI,OAAO,KAET,cAAa,MAAM,MAAM,IAAI,GAAG,CAAC;AAInC,MAAI,SAAS,OAAO,cAClB,SAAQ,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;CAqBnC,MAAM,eAAe,IAAY,UAAmB;;;;;EAKlD,MAAM,eAAe,SAA2C;AAC9D,OAAI,CAAC,KACH;AAEF,iBAAc,MAAM,KAAK,MAAM;AAC/B,OAAI,YAAY,QAAQ,KAAK,OAC3B,aAAY,KAAK,OAAO;;AAK5B,MAAI,SAAS,OAAO,eAClB,SAAQ,MAAM,eAAe,GAAG;AAIlC,MAAI,UAAU,MACZ,eAAc,MAAM,MAAM;MAG1B,aAAY,MAAM,MAAM,IAAI,GAAG,CAAC;AAIlC,MAAI,SAAS,OAAO,cAClB,SAAQ,MAAM,cAAc,GAAG;;CAInC,MAAM,cAAc,OAAe;AACjC,SAAO,cAAc,MAAM,OAAO;;CAGpC,MAAM,cAAc,OAAe;AACjC,SAAO,cAAc,MAAM,OAAO;;CAGpC,MAAM,gBAAgB,OAAe,MAAM,MAAM,IAAI,GAAG;AAExD,QAAO;EACL,OAAO,eAAe,QAAQ,MAAM,CAAC;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;AACX,iBAAc,QAAQ,EAAE;AACxB,iBAAc,QAAQ,EAAE;;EAE3B"}
1
+ {"version":3,"file":"create-sidebar-state.js","names":[],"sources":["../../src/helpers/create-sidebar-state.ts"],"sourcesContent":["import { type MaybeRefOrGetter, computed, ref, toValue } from 'vue'\n\nimport { generateReverseIndex } from './generate-reverse-index'\n\ntype SidebarStateOptions = Partial<{\n /** The key used to access child items in the sidebar tree. Defaults to \"children\". */\n key: string\n /** Optional event hooks for sidebar item lifecycle */\n hooks: Partial<{\n /**\n * Called before an item is expanded.\n * @param id - The ID of the item to expand.\n */\n onBeforeExpand: (id: string) => void\n /**\n * Called after an item is expanded.\n * @param id - The ID of the item that was expanded.\n */\n onAfterExpand: (id: string) => void\n /**\n * Called just before a sidebar item selection changes.\n * @param id - The ID of the item that is about to be selected, or null if deselecting.\n */\n onBeforeSelect: (id: string | null) => void\n /**\n * Called immediately after a sidebar item has been selected.\n * @param id - The ID of the item that was selected, or null if selection was cleared.\n */\n onAfterSelect: (id: string | null) => void\n }>\n}>\n\n/**\n * Creates and manages the state for a sidebar tree, including selection and expansion of items.\n *\n * @template T - The type of sidebar items, which must include an `id` property.\n * @param items - The array of sidebar items.\n * @param options - Optional configuration for customizing behavior and hooks.\n * @returns An object containing sidebar state and methods to manipulate it.\n *\n * ## Example Usage\n *\n * ```ts\n * // Example sidebar items\n * const sidebarItems = [\n * { id: 'root', label: 'Root', children: [\n * { id: 'child1', label: 'Child 1' },\n * { id: 'child2', label: 'Child 2', children: [\n * { id: 'grandchild1', label: 'Grandchild 1' }\n * ]}\n * ]}\n * ]\n *\n * // Create sidebar state\n * const sidebarState = createSidebarState(sidebarItems, {\n * key: 'children',\n * hooks: {\n * onBeforeSelect: (id) => console.log('Before select:', id),\n * onAfterSelect: (id) => console.log('After select:', id),\n * onBeforeExpand: (id) => console.log('Before expand:', id),\n * onAfterExpand: (id) => console.log('After expand:', id),\n * }\n * })\n *\n * // Select an item\n * await sidebarState.setSelected('grandchild1')\n * // Expand an item\n * await sidebarState.setExpanded('child2', true)\n * ```\n */\nexport const createSidebarState = <T extends { id: string }>(\n items: MaybeRefOrGetter<T[]>,\n options?: SidebarStateOptions,\n) => {\n // Reverse index for quick lookup of items and their parents\n const index = computed(() =>\n generateReverseIndex({\n items: toValue(items),\n nestedKey: options?.key ?? 'children',\n }),\n )\n // Reactive record of selected item ids\n const selectedItems = ref<Record<string, boolean>>({})\n // Reactive record of expanded item ids\n const expandedItems = ref<Record<string, boolean>>({})\n\n // Lowest level selected item\n const selectedItem = ref<string | null>(null)\n\n /**\n * Selects the given item by id, and recursively marks all its parent items as selected.\n * Triggers optional lifecycle hooks before and after selection.\n *\n * @param id - The ID of the item to select.\n *\n * ## Example\n * ```ts\n * await sidebarState.setSelected('grandchild1')\n * // selectedItems.value will include 'grandchild1', 'child2', and 'root'\n * ```\n */\n const setSelected = (id: string | null) => {\n /**\n * Recursively mark all parent items as selected.\n * @param node - The current node to mark as selected.\n */\n const markSelected = (node: (T & { parent?: T }) | undefined) => {\n if (!node) {\n return\n }\n selectedItems.value[node.id] = true\n if ('parent' in node && node.parent) {\n markSelected(node.parent)\n }\n }\n\n // Call onBeforeSelect hook if provided\n if (options?.hooks?.onBeforeSelect) {\n options.hooks.onBeforeSelect(id)\n }\n\n // Clear previous selection\n selectedItems.value = {}\n selectedItem.value = id\n\n // If id is null, do not select anything\n // We already cleared the selection above\n if (id !== null) {\n // Mark the selected item and all its parents as selected\n markSelected(index.value.get(id))\n }\n\n // Call onAfterSelect hook if provided\n if (options?.hooks?.onAfterSelect) {\n options.hooks.onAfterSelect(id)\n }\n }\n\n /**\n * Expands or collapses the given item by id.\n * When expanding, recursively expands all parent items.\n * Triggers optional lifecycle hooks before and after expansion.\n *\n * @param id - The ID of the item to expand or collapse.\n * @param value - true to expand, false to collapse.\n *\n * ## Example\n * ```ts\n * await sidebarState.setExpanded('child2', true)\n * // expandedItems.value will include 'child2' and 'root'\n *\n * await sidebarState.setExpanded('child2', false)\n * // expandedItems.value['child2'] will be false\n * ```\n */\n const setExpanded = (id: string, value: boolean) => {\n /**\n * Recursively expand all parent items of the given node.\n * @param node - The current node to expand.\n */\n const openParents = (node: (T & { parent?: T }) | undefined) => {\n if (!node) {\n return\n }\n expandedItems.value[node.id] = true\n if ('parent' in node && node.parent) {\n openParents(node.parent)\n }\n }\n\n // Call onBeforeExpand hook if provided\n if (options?.hooks?.onBeforeExpand) {\n options.hooks.onBeforeExpand(id)\n }\n\n // When collapsing, only collapse the specified item, not its parents\n if (value === false) {\n expandedItems.value[id] = false\n } else {\n // When expanding, ensure all parents are expanded as well\n openParents(index.value.get(id))\n }\n\n // Call onAfterExpand hook if provided\n if (options?.hooks?.onAfterExpand) {\n options.hooks.onAfterExpand(id)\n }\n }\n\n const isExpanded = (id: string) => {\n return expandedItems.value[id] ?? false\n }\n\n const isSelected = (id: string) => {\n return selectedItems.value[id] ?? false\n }\n\n const getEntryById = (id: string) => index.value.get(id)\n\n return {\n items: computed(() => toValue(items)),\n index,\n selectedItems,\n expandedItems,\n selectedItem,\n setSelected,\n setExpanded,\n isExpanded,\n isSelected,\n getEntryById,\n reset: () => {\n selectedItems.value = {}\n expandedItems.value = {}\n },\n }\n}\n\nexport type SidebarState<Item extends { id: string }> = ReturnType<typeof createSidebarState<Item>>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,IAAa,sBACX,OACA,YACG;CAEH,MAAM,QAAQ,eACZ,qBAAqB;EACnB,OAAO,QAAQ,KAAK;EACpB,WAAW,SAAS,OAAO;CAC7B,CAAC,CACH;CAEA,MAAM,gBAAgB,IAA6B,CAAC,CAAC;CAErD,MAAM,gBAAgB,IAA6B,CAAC,CAAC;CAGrD,MAAM,eAAe,IAAmB,IAAI;;;;;;;;;;;;;CAc5C,MAAM,eAAe,OAAsB;;;;;EAKzC,MAAM,gBAAgB,SAA2C;GAC/D,IAAI,CAAC,MACH;GAEF,cAAc,MAAM,KAAK,MAAM;GAC/B,IAAI,YAAY,QAAQ,KAAK,QAC3B,aAAa,KAAK,MAAM;EAE5B;EAGA,IAAI,SAAS,OAAO,gBAClB,QAAQ,MAAM,eAAe,EAAE;EAIjC,cAAc,QAAQ,CAAC;EACvB,aAAa,QAAQ;EAIrB,IAAI,OAAO,MAET,aAAa,MAAM,MAAM,IAAI,EAAE,CAAC;EAIlC,IAAI,SAAS,OAAO,eAClB,QAAQ,MAAM,cAAc,EAAE;CAElC;;;;;;;;;;;;;;;;;;CAmBA,MAAM,eAAe,IAAY,UAAmB;;;;;EAKlD,MAAM,eAAe,SAA2C;GAC9D,IAAI,CAAC,MACH;GAEF,cAAc,MAAM,KAAK,MAAM;GAC/B,IAAI,YAAY,QAAQ,KAAK,QAC3B,YAAY,KAAK,MAAM;EAE3B;EAGA,IAAI,SAAS,OAAO,gBAClB,QAAQ,MAAM,eAAe,EAAE;EAIjC,IAAI,UAAU,OACZ,cAAc,MAAM,MAAM;OAG1B,YAAY,MAAM,MAAM,IAAI,EAAE,CAAC;EAIjC,IAAI,SAAS,OAAO,eAClB,QAAQ,MAAM,cAAc,EAAE;CAElC;CAEA,MAAM,cAAc,OAAe;EACjC,OAAO,cAAc,MAAM,OAAO;CACpC;CAEA,MAAM,cAAc,OAAe;EACjC,OAAO,cAAc,MAAM,OAAO;CACpC;CAEA,MAAM,gBAAgB,OAAe,MAAM,MAAM,IAAI,EAAE;CAEvD,OAAO;EACL,OAAO,eAAe,QAAQ,KAAK,CAAC;EACpC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;GACX,cAAc,QAAQ,CAAC;GACvB,cAAc,QAAQ,CAAC;EACzB;CACF;AACF"}
@@ -1,6 +1,6 @@
1
1
  //#region src/helpers/filter-items.ts
2
2
  /** The type of items we want to */
3
- var API_CLIENT_TYPES_SET = new Set([
3
+ var API_CLIENT_TYPES_SET = /* @__PURE__ */ new Set([
4
4
  "document",
5
5
  "operation",
6
6
  "example",
@@ -1 +1 @@
1
- {"version":3,"file":"filter-items.js","names":[],"sources":["../../src/helpers/filter-items.ts"],"sourcesContent":["import type { Item, Layout } from '@/types'\n\n/** The type of items we want to */\nconst API_CLIENT_TYPES_SET = new Set(['document', 'operation', 'example', 'tag'])\n\nexport const filterItems = (layout: Layout, items: Item[], hideOperationDefaultExamples?: boolean) => {\n // If we are hiding the default examples and there is only one example and it is the default example, we don't want to show it\n if (\n hideOperationDefaultExamples &&\n items.length === 1 &&\n items[0]?.type === 'example' &&\n items[0]?.name === 'default'\n ) {\n return []\n }\n\n if (layout === 'reference') {\n return items\n }\n\n // For client layout, filter to only show documents, operations, examples, and tags\n return items.filter((c) => API_CLIENT_TYPES_SET.has(c.type))\n}\n"],"mappings":";;AAGA,IAAM,uBAAuB,IAAI,IAAI;CAAC;CAAY;CAAa;CAAW;CAAM,CAAC;AAEjF,IAAa,eAAe,QAAgB,OAAe,iCAA2C;AAEpG,KACE,gCACA,MAAM,WAAW,KACjB,MAAM,IAAI,SAAS,aACnB,MAAM,IAAI,SAAS,UAEnB,QAAO,EAAE;AAGX,KAAI,WAAW,YACb,QAAO;AAIT,QAAO,MAAM,QAAQ,MAAM,qBAAqB,IAAI,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"filter-items.js","names":[],"sources":["../../src/helpers/filter-items.ts"],"sourcesContent":["import type { Item, Layout } from '@/types'\n\n/** The type of items we want to */\nconst API_CLIENT_TYPES_SET = new Set(['document', 'operation', 'example', 'tag'])\n\nexport const filterItems = (layout: Layout, items: Item[], hideOperationDefaultExamples?: boolean) => {\n // If we are hiding the default examples and there is only one example and it is the default example, we don't want to show it\n if (\n hideOperationDefaultExamples &&\n items.length === 1 &&\n items[0]?.type === 'example' &&\n items[0]?.name === 'default'\n ) {\n return []\n }\n\n if (layout === 'reference') {\n return items\n }\n\n // For client layout, filter to only show documents, operations, examples, and tags\n return items.filter((c) => API_CLIENT_TYPES_SET.has(c.type))\n}\n"],"mappings":";;AAGA,IAAM,uCAAuB,IAAI,IAAI;CAAC;CAAY;CAAa;CAAW;AAAK,CAAC;AAEhF,IAAa,eAAe,QAAgB,OAAe,iCAA2C;CAEpG,IACE,gCACA,MAAM,WAAW,KACjB,MAAM,EAAE,EAAE,SAAS,aACnB,MAAM,EAAE,EAAE,SAAS,WAEnB,OAAO,CAAC;CAGV,IAAI,WAAW,aACb,OAAO;CAIT,OAAO,MAAM,QAAQ,MAAM,qBAAqB,IAAI,EAAE,IAAI,CAAC;AAC7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-reverse-index.js","names":[],"sources":["../../src/helpers/generate-reverse-index.ts"],"sourcesContent":["/**\n * Builds a reverse index for fast ID-based lookup and attaches a `parent` property to each node for upward traversal.\n *\n * @template T - The node type (must include `id`).\n * @template Key - The key pointing to nested children arrays (defaults to 'children').\n *\n * @param items - The root-level array of entities to index.\n * @param nestedKey - The property name that contains child nodes within an entity (defaults to 'children').\n * @param filter - Optional. A predicate to determine which nodes are included in the map (default: includes all).\n * @param getId - Optional. A function to obtain the unique ID from a node (defaults to `node.id`).\n * @returns A Map where each key is a node's ID and each value is the node, extended with an optional `parent` property.\n *\n * @example\n * const data = [\n * { id: '1', name: 'Root', children: [\n * { id: '2', name: 'Child 1' },\n * { id: '3', name: 'Child 2', children: [\n * { id: '4', name: 'Grandchild' }\n * ]}\n * ]}\n * ];\n * const index = generateReverseIndex({ items: data });\n * // index.get('3') => { id: '3', name: 'Child 2', children: [...], parent: { id: '1', ... } }\n * // index.get('4') => { id: '4', name: 'Grandchild', parent: { id: '3', ... } }\n */\nexport const generateReverseIndex = <T extends { id: string } & Record<string, unknown>, Key extends string>({\n items,\n nestedKey = 'children' as Key,\n filter = () => true,\n getId = (node: T) => node.id,\n}: {\n items: T[]\n nestedKey?: Key\n filter?: (node: T) => boolean\n getId?: (node: T) => string\n}) => {\n // Create a mapping from id to node (with parent reference)\n const mapping = new Map<string, T & { parent?: T }>()\n\n const dfs = (node: T & { parent?: T }) => {\n if (filter(node)) {\n mapping.set(getId(node), node)\n }\n\n if (nestedKey in node && Array.isArray(node[nestedKey])) {\n // Recursively traverse children and add the current node as their parent\n node[nestedKey]?.forEach((it) => dfs({ ...it, parent: node }))\n }\n }\n\n items.forEach(dfs)\n\n return mapping\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,wBAAgG,EAC3G,OACA,YAAY,YACZ,eAAe,MACf,SAAS,SAAY,KAAK,SAMtB;CAEJ,MAAM,0BAAU,IAAI,KAAiC;CAErD,MAAM,OAAO,SAA6B;AACxC,MAAI,OAAO,KAAK,CACd,SAAQ,IAAI,MAAM,KAAK,EAAE,KAAK;AAGhC,MAAI,aAAa,QAAQ,MAAM,QAAQ,KAAK,WAAW,CAErD,MAAK,YAAY,SAAS,OAAO,IAAI;GAAE,GAAG;GAAI,QAAQ;GAAM,CAAC,CAAC;;AAIlE,OAAM,QAAQ,IAAI;AAElB,QAAO"}
1
+ {"version":3,"file":"generate-reverse-index.js","names":[],"sources":["../../src/helpers/generate-reverse-index.ts"],"sourcesContent":["/**\n * Builds a reverse index for fast ID-based lookup and attaches a `parent` property to each node for upward traversal.\n *\n * @template T - The node type (must include `id`).\n * @template Key - The key pointing to nested children arrays (defaults to 'children').\n *\n * @param items - The root-level array of entities to index.\n * @param nestedKey - The property name that contains child nodes within an entity (defaults to 'children').\n * @param filter - Optional. A predicate to determine which nodes are included in the map (default: includes all).\n * @param getId - Optional. A function to obtain the unique ID from a node (defaults to `node.id`).\n * @returns A Map where each key is a node's ID and each value is the node, extended with an optional `parent` property.\n *\n * @example\n * const data = [\n * { id: '1', name: 'Root', children: [\n * { id: '2', name: 'Child 1' },\n * { id: '3', name: 'Child 2', children: [\n * { id: '4', name: 'Grandchild' }\n * ]}\n * ]}\n * ];\n * const index = generateReverseIndex({ items: data });\n * // index.get('3') => { id: '3', name: 'Child 2', children: [...], parent: { id: '1', ... } }\n * // index.get('4') => { id: '4', name: 'Grandchild', parent: { id: '3', ... } }\n */\nexport const generateReverseIndex = <T extends { id: string } & Record<string, unknown>, Key extends string>({\n items,\n nestedKey = 'children' as Key,\n filter = () => true,\n getId = (node: T) => node.id,\n}: {\n items: T[]\n nestedKey?: Key\n filter?: (node: T) => boolean\n getId?: (node: T) => string\n}) => {\n // Create a mapping from id to node (with parent reference)\n const mapping = new Map<string, T & { parent?: T }>()\n\n const dfs = (node: T & { parent?: T }) => {\n if (filter(node)) {\n mapping.set(getId(node), node)\n }\n\n if (nestedKey in node && Array.isArray(node[nestedKey])) {\n // Recursively traverse children and add the current node as their parent\n node[nestedKey]?.forEach((it) => dfs({ ...it, parent: node }))\n }\n }\n\n items.forEach(dfs)\n\n return mapping\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,wBAAgG,EAC3G,OACA,YAAY,YACZ,eAAe,MACf,SAAS,SAAY,KAAK,SAMtB;CAEJ,MAAM,0BAAU,IAAI,IAAgC;CAEpD,MAAM,OAAO,SAA6B;EACxC,IAAI,OAAO,IAAI,GACb,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI;EAG/B,IAAI,aAAa,QAAQ,MAAM,QAAQ,KAAK,UAAU,GAEpD,KAAK,UAAU,EAAE,SAAS,OAAO,IAAI;GAAE,GAAG;GAAI,QAAQ;EAAK,CAAC,CAAC;CAEjE;CAEA,MAAM,QAAQ,GAAG;CAEjB,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-child-entry.js","names":[],"sources":["../../src/helpers/get-child-entry.ts"],"sourcesContent":["import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\n\n/**\n * Recursively searches for and returns the first child node (including the given node itself)\n * of a specific type within the provided node's subtree.\n *\n * @template Type - The type of node to search for.\n * @param type - The node type to match.\n * @param node - The root node to begin searching from.\n * @returns The first child node of the specified type, or null if not found.\n */\nexport const getChildEntry = <Type extends TraversedEntry['type']>(\n type: Type,\n node: TraversedEntry,\n): (TraversedEntry & { type: Type }) | null => {\n if (node.type === type) {\n return node as TraversedEntry & { type: Type }\n }\n\n if ('children' in node) {\n for (const child of node.children ?? []) {\n const result = getChildEntry(type, child)\n\n if (result) {\n return result\n }\n }\n }\n\n return null\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAa,iBACX,MACA,SAC6C;AAC7C,KAAI,KAAK,SAAS,KAChB,QAAO;AAGT,KAAI,cAAc,KAChB,MAAK,MAAM,SAAS,KAAK,YAAY,EAAE,EAAE;EACvC,MAAM,SAAS,cAAc,MAAM,MAAM;AAEzC,MAAI,OACF,QAAO;;AAKb,QAAO"}
1
+ {"version":3,"file":"get-child-entry.js","names":[],"sources":["../../src/helpers/get-child-entry.ts"],"sourcesContent":["import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\n\n/**\n * Recursively searches for and returns the first child node (including the given node itself)\n * of a specific type within the provided node's subtree.\n *\n * @template Type - The type of node to search for.\n * @param type - The node type to match.\n * @param node - The root node to begin searching from.\n * @returns The first child node of the specified type, or null if not found.\n */\nexport const getChildEntry = <Type extends TraversedEntry['type']>(\n type: Type,\n node: TraversedEntry,\n): (TraversedEntry & { type: Type }) | null => {\n if (node.type === type) {\n return node as TraversedEntry & { type: Type }\n }\n\n if ('children' in node) {\n for (const child of node.children ?? []) {\n const result = getChildEntry(type, child)\n\n if (result) {\n return result\n }\n }\n }\n\n return null\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAa,iBACX,MACA,SAC6C;CAC7C,IAAI,KAAK,SAAS,MAChB,OAAO;CAGT,IAAI,cAAc,MAChB,KAAK,MAAM,SAAS,KAAK,YAAY,CAAC,GAAG;EACvC,MAAM,SAAS,cAAc,MAAM,KAAK;EAExC,IAAI,QACF,OAAO;CAEX;CAGF,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"has-children.js","names":[],"sources":["../../src/helpers/has-children.ts"],"sourcesContent":["import type { Item } from '@/types'\n\n/**\n * Type guard to check if the given Item has a non-empty array of children.\n * Returns true if `currentItem` has a `children` property that is an array with at least one element.\n */\nexport const hasChildren = (currentItem: Item): currentItem is Item & { children: Item[] } => {\n return 'children' in currentItem && Array.isArray(currentItem.children) && currentItem.children.length > 0\n}\n"],"mappings":";;;;;AAMA,IAAa,eAAe,gBAAkE;AAC5F,QAAO,cAAc,eAAe,MAAM,QAAQ,YAAY,SAAS,IAAI,YAAY,SAAS,SAAS"}
1
+ {"version":3,"file":"has-children.js","names":[],"sources":["../../src/helpers/has-children.ts"],"sourcesContent":["import type { Item } from '@/types'\n\n/**\n * Type guard to check if the given Item has a non-empty array of children.\n * Returns true if `currentItem` has a `children` property that is an array with at least one element.\n */\nexport const hasChildren = (currentItem: Item): currentItem is Item & { children: Item[] } => {\n return 'children' in currentItem && Array.isArray(currentItem.children) && currentItem.children.length > 0\n}\n"],"mappings":";;;;;AAMA,IAAa,eAAe,gBAAkE;CAC5F,OAAO,cAAc,eAAe,MAAM,QAAQ,YAAY,QAAQ,KAAK,YAAY,SAAS,SAAS;AAC3G"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-sidebar-folder.js","names":[],"sources":["../../src/helpers/is-sidebar-folder.ts"],"sourcesContent":["import { hasChildren } from '@/helpers/has-children'\nimport type { Item, Layout } from '@/types'\n\n/**\n * Determines if a sidebar item should be treated as a \"folder\",\n * i.e. a collapsible group, depending on the layout, its type,\n * whether it has children, and special slot rules.\n *\n * @param layout - The sidebar layout ('client' or 'reference')\n * @param item - The sidebar item to check\n * @param hasEmptySlot - True if there is an empty slot to display as a group (client layout only)\n * @returns True if the item should be rendered as a folder/group node\n */\nexport const isSidebarFolder = (\n layout: Layout,\n item: Item,\n hasEmptySlot: boolean,\n hideOperationDefaultExamples: boolean,\n): item is Item & { children?: Item[] } => {\n // If the item has no children, check if there is an empty slot.\n if (!hasChildren(item)) {\n // In 'client' layout, allow \"document\" or \"tag\" items to act as group if there's an empty slot\n if (layout === 'client' && hasEmptySlot) {\n return item.type === 'document' || item.type === 'tag'\n }\n // Otherwise, not a folder if it has no children\n return false\n }\n\n if (\n hideOperationDefaultExamples &&\n item.type === 'operation' &&\n item.children?.length === 1 &&\n item.children[0]?.type === 'example' &&\n item.children[0]?.name === 'default'\n ) {\n return false\n }\n\n // 'client' layout: any item with children is a folder\n if (layout === 'client') {\n return true\n }\n\n // 'reference' layout: only non-'operation' and non-'webhook' are groups/folders\n if (layout === 'reference') {\n return item.type !== 'operation' && item.type !== 'webhook'\n }\n\n // Fallback: not a folder in other cases/layouts\n return false\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,mBACX,QACA,MACA,cACA,iCACyC;AAEzC,KAAI,CAAC,YAAY,KAAK,EAAE;AAEtB,MAAI,WAAW,YAAY,aACzB,QAAO,KAAK,SAAS,cAAc,KAAK,SAAS;AAGnD,SAAO;;AAGT,KACE,gCACA,KAAK,SAAS,eACd,KAAK,UAAU,WAAW,KAC1B,KAAK,SAAS,IAAI,SAAS,aAC3B,KAAK,SAAS,IAAI,SAAS,UAE3B,QAAO;AAIT,KAAI,WAAW,SACb,QAAO;AAIT,KAAI,WAAW,YACb,QAAO,KAAK,SAAS,eAAe,KAAK,SAAS;AAIpD,QAAO"}
1
+ {"version":3,"file":"is-sidebar-folder.js","names":[],"sources":["../../src/helpers/is-sidebar-folder.ts"],"sourcesContent":["import { hasChildren } from '@/helpers/has-children'\nimport type { Item, Layout } from '@/types'\n\n/**\n * Determines if a sidebar item should be treated as a \"folder\",\n * i.e. a collapsible group, depending on the layout, its type,\n * whether it has children, and special slot rules.\n *\n * @param layout - The sidebar layout ('client' or 'reference')\n * @param item - The sidebar item to check\n * @param hasEmptySlot - True if there is an empty slot to display as a group (client layout only)\n * @returns True if the item should be rendered as a folder/group node\n */\nexport const isSidebarFolder = (\n layout: Layout,\n item: Item,\n hasEmptySlot: boolean,\n hideOperationDefaultExamples: boolean,\n): item is Item & { children?: Item[] } => {\n // If the item has no children, check if there is an empty slot.\n if (!hasChildren(item)) {\n // In 'client' layout, allow \"document\" or \"tag\" items to act as group if there's an empty slot\n if (layout === 'client' && hasEmptySlot) {\n return item.type === 'document' || item.type === 'tag'\n }\n // Otherwise, not a folder if it has no children\n return false\n }\n\n if (\n hideOperationDefaultExamples &&\n item.type === 'operation' &&\n item.children?.length === 1 &&\n item.children[0]?.type === 'example' &&\n item.children[0]?.name === 'default'\n ) {\n return false\n }\n\n // 'client' layout: any item with children is a folder\n if (layout === 'client') {\n return true\n }\n\n // 'reference' layout: only non-'operation' and non-'webhook' are groups/folders\n if (layout === 'reference') {\n return item.type !== 'operation' && item.type !== 'webhook'\n }\n\n // Fallback: not a folder in other cases/layouts\n return false\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,mBACX,QACA,MACA,cACA,iCACyC;CAEzC,IAAI,CAAC,YAAY,IAAI,GAAG;EAEtB,IAAI,WAAW,YAAY,cACzB,OAAO,KAAK,SAAS,cAAc,KAAK,SAAS;EAGnD,OAAO;CACT;CAEA,IACE,gCACA,KAAK,SAAS,eACd,KAAK,UAAU,WAAW,KAC1B,KAAK,SAAS,EAAE,EAAE,SAAS,aAC3B,KAAK,SAAS,EAAE,EAAE,SAAS,WAE3B,OAAO;CAIT,IAAI,WAAW,UACb,OAAO;CAIT,IAAI,WAAW,aACb,OAAO,KAAK,SAAS,eAAe,KAAK,SAAS;CAIpD,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-sidebar-to-top.js","names":[],"sources":["../../src/helpers/scroll-sidebar-to-top.ts"],"sourcesContent":["const DEFAULT_SCROLL_OFFSET_TOP = 100\n\n/**\n * Returns the element that should be used for vertical position measurement.\n */\nconst getMeasurableElement = (element: HTMLElement): HTMLElement => {\n if (window.getComputedStyle(element).display !== 'contents') {\n return element\n }\n\n /**\n * `display: contents` does not render a layout box, so use the first child with\n * a measurable offset to keep the scroll target aligned with what users see.\n */\n for (const child of element.children) {\n if (child instanceof HTMLElement && child.offsetParent !== null) {\n return child\n }\n }\n\n return element\n}\n\n/**\n * Adds extra offset for heading rows so the selected item stays visible below labels.\n */\nconst getHeadingOffset = (element: HTMLElement): number => {\n if (element.dataset.sidebarType !== 'heading') {\n return 0\n }\n\n return element.querySelector<HTMLElement>('.sidebar-heading')?.offsetHeight ?? 0\n}\n\n/**\n * Computes an element top position relative to the provided scroll container.\n */\nconst getTopRelativeToScroller = (element: HTMLElement, scroller: HTMLElement): number => {\n let top = element.offsetTop\n let currentOffsetParent = element.offsetParent as HTMLElement | null\n\n while (currentOffsetParent && currentOffsetParent !== scroller) {\n top += currentOffsetParent.offsetTop\n currentOffsetParent = currentOffsetParent.offsetParent as HTMLElement | null\n }\n\n return top\n}\n\n/**\n * Scrolls the sidebar container so the requested item appears near the top.\n */\nexport const scrollSidebarToTop = (id: string, offsetTop: number = DEFAULT_SCROLL_OFFSET_TOP): void => {\n if (typeof window === 'undefined') {\n return\n }\n\n const element = document.querySelector<HTMLElement>(`[data-sidebar-id=\"${id}\"]`)\n const scroller = element?.closest<HTMLElement>('.custom-scroll, .custom-scrollbar') ?? null\n if (!element || !scroller) {\n return\n }\n\n const measurableElement = getMeasurableElement(element)\n const itemTop = getTopRelativeToScroller(measurableElement, scroller)\n const itemOffset = getHeadingOffset(element)\n const targetTop = itemTop + itemOffset - offsetTop\n\n scroller.scrollTo({\n top: targetTop > 0 ? targetTop : 0,\n })\n}\n"],"mappings":";AAAA,IAAM,4BAA4B;;;;AAKlC,IAAM,wBAAwB,YAAsC;AAClE,KAAI,OAAO,iBAAiB,QAAQ,CAAC,YAAY,WAC/C,QAAO;;;;;AAOT,MAAK,MAAM,SAAS,QAAQ,SAC1B,KAAI,iBAAiB,eAAe,MAAM,iBAAiB,KACzD,QAAO;AAIX,QAAO;;;;;AAMT,IAAM,oBAAoB,YAAiC;AACzD,KAAI,QAAQ,QAAQ,gBAAgB,UAClC,QAAO;AAGT,QAAO,QAAQ,cAA2B,mBAAmB,EAAE,gBAAgB;;;;;AAMjF,IAAM,4BAA4B,SAAsB,aAAkC;CACxF,IAAI,MAAM,QAAQ;CAClB,IAAI,sBAAsB,QAAQ;AAElC,QAAO,uBAAuB,wBAAwB,UAAU;AAC9D,SAAO,oBAAoB;AAC3B,wBAAsB,oBAAoB;;AAG5C,QAAO;;;;;AAMT,IAAa,sBAAsB,IAAY,YAAoB,8BAAoC;AACrG,KAAI,OAAO,WAAW,YACpB;CAGF,MAAM,UAAU,SAAS,cAA2B,qBAAqB,GAAG,IAAI;CAChF,MAAM,WAAW,SAAS,QAAqB,oCAAoC,IAAI;AACvF,KAAI,CAAC,WAAW,CAAC,SACf;CAMF,MAAM,YAFU,yBADU,qBAAqB,QAAQ,EACK,SAAS,GAClD,iBAAiB,QAAQ,GACH;AAEzC,UAAS,SAAS,EAChB,KAAK,YAAY,IAAI,YAAY,GAClC,CAAC"}
1
+ {"version":3,"file":"scroll-sidebar-to-top.js","names":[],"sources":["../../src/helpers/scroll-sidebar-to-top.ts"],"sourcesContent":["const DEFAULT_SCROLL_OFFSET_TOP = 100\n\n/**\n * Returns the element that should be used for vertical position measurement.\n */\nconst getMeasurableElement = (element: HTMLElement): HTMLElement => {\n if (window.getComputedStyle(element).display !== 'contents') {\n return element\n }\n\n /**\n * `display: contents` does not render a layout box, so use the first child with\n * a measurable offset to keep the scroll target aligned with what users see.\n */\n for (const child of element.children) {\n if (child instanceof HTMLElement && child.offsetParent !== null) {\n return child\n }\n }\n\n return element\n}\n\n/**\n * Adds extra offset for heading rows so the selected item stays visible below labels.\n */\nconst getHeadingOffset = (element: HTMLElement): number => {\n if (element.dataset.sidebarType !== 'heading') {\n return 0\n }\n\n return element.querySelector<HTMLElement>('.sidebar-heading')?.offsetHeight ?? 0\n}\n\n/**\n * Computes an element top position relative to the provided scroll container.\n */\nconst getTopRelativeToScroller = (element: HTMLElement, scroller: HTMLElement): number => {\n let top = element.offsetTop\n let currentOffsetParent = element.offsetParent as HTMLElement | null\n\n while (currentOffsetParent && currentOffsetParent !== scroller) {\n top += currentOffsetParent.offsetTop\n currentOffsetParent = currentOffsetParent.offsetParent as HTMLElement | null\n }\n\n return top\n}\n\n/**\n * Scrolls the sidebar container so the requested item appears near the top.\n */\nexport const scrollSidebarToTop = (id: string, offsetTop: number = DEFAULT_SCROLL_OFFSET_TOP): void => {\n if (typeof window === 'undefined') {\n return\n }\n\n const element = document.querySelector<HTMLElement>(`[data-sidebar-id=\"${id}\"]`)\n const scroller = element?.closest<HTMLElement>('.custom-scroll, .custom-scrollbar') ?? null\n if (!element || !scroller) {\n return\n }\n\n const measurableElement = getMeasurableElement(element)\n const itemTop = getTopRelativeToScroller(measurableElement, scroller)\n const itemOffset = getHeadingOffset(element)\n const targetTop = itemTop + itemOffset - offsetTop\n\n scroller.scrollTo({\n top: targetTop > 0 ? targetTop : 0,\n })\n}\n"],"mappings":";AAAA,IAAM,4BAA4B;;;;AAKlC,IAAM,wBAAwB,YAAsC;CAClE,IAAI,OAAO,iBAAiB,OAAO,CAAC,CAAC,YAAY,YAC/C,OAAO;;;;;CAOT,KAAK,MAAM,SAAS,QAAQ,UAC1B,IAAI,iBAAiB,eAAe,MAAM,iBAAiB,MACzD,OAAO;CAIX,OAAO;AACT;;;;AAKA,IAAM,oBAAoB,YAAiC;CACzD,IAAI,QAAQ,QAAQ,gBAAgB,WAClC,OAAO;CAGT,OAAO,QAAQ,cAA2B,kBAAkB,CAAC,EAAE,gBAAgB;AACjF;;;;AAKA,IAAM,4BAA4B,SAAsB,aAAkC;CACxF,IAAI,MAAM,QAAQ;CAClB,IAAI,sBAAsB,QAAQ;CAElC,OAAO,uBAAuB,wBAAwB,UAAU;EAC9D,OAAO,oBAAoB;EAC3B,sBAAsB,oBAAoB;CAC5C;CAEA,OAAO;AACT;;;;AAKA,IAAa,sBAAsB,IAAY,YAAoB,8BAAoC;CACrG,IAAI,OAAO,WAAW,aACpB;CAGF,MAAM,UAAU,SAAS,cAA2B,qBAAqB,GAAG,GAAG;CAC/E,MAAM,WAAW,SAAS,QAAqB,mCAAmC,KAAK;CACvF,IAAI,CAAC,WAAW,CAAC,UACf;CAMF,MAAM,YAFU,yBADU,qBAAqB,OACN,GAAmB,QAE1C,IADC,iBAAiB,OACR,IAAa;CAEzC,SAAS,SAAS,EAChB,KAAK,YAAY,IAAI,YAAY,EACnC,CAAC;AACH"}
@@ -86,10 +86,18 @@ function useDraggable(options) {
86
86
  return draggableVariants({ position });
87
87
  });
88
88
  return {
89
+ /**
90
+ * Props object to bind to the draggable element.
91
+ * Contains the class and draggable attribute.
92
+ */
89
93
  draggableAttrs: computed(() => ({
90
94
  class: draggableClass.value || void 0,
91
95
  draggable: toValue(isDraggable) ? true : void 0
92
96
  })),
97
+ /**
98
+ * Event handlers object to bind to the draggable element.
99
+ * Contains dragend, dragover, and dragstart handlers with proper event prevention.
100
+ */
93
101
  draggableEvents: {
94
102
  dragend: handleDragEnd,
95
103
  dragover: (ev) => {
@@ -1 +1 @@
1
- {"version":3,"file":"use-draggable.js","names":[],"sources":["../../src/hooks/use-draggable.ts"],"sourcesContent":["import { cva } from '@scalar/use-hooks/useBindCx'\nimport { type MaybeRef, type Ref, computed, ref, toValue } from 'vue'\n\n/**\n * Drag offsets\n */\nexport type DragOffset =\n | 'before' // Insert before the hovered item\n | 'after' // Insert after the hovered item\n | 'into' // Drop into the hovered item\n | null\n\n/**\n * Item you are currently dragging over\n */\nexport type HoveredItem = {\n id: string\n parentId: string | null\n offset: DragOffset\n}\n\n/**\n * Item you are currently dragging\n */\nexport type DraggingItem = Omit<HoveredItem, 'offset'>\n\n/**\n * Simple throttle function to avoid package dependencies\n */\nconst throttle = <TArgs extends Array<unknown>>(\n callback: (...args: TArgs) => void,\n limit: number,\n): ((...args: TArgs) => void) => {\n let wait = false\n\n return (...args: TArgs) => {\n if (wait) {\n return\n }\n\n callback(...args)\n wait = true\n setTimeout(() => (wait = false), limit)\n }\n}\n\n/** Draggable class variants to apply to the draggable element */\nconst draggableVariants = cva({\n base: 'relative after:absolute after:inset-x-0 after:block after:bg-blue after:opacity-15 after:pointer-events-none after:rounded',\n variants: {\n position: {\n before: 'after:-top-0.5 after:h-0.75',\n after: 'after:-bottom-0.5 after:h-0.75',\n into: 'after:inset-0',\n } as const satisfies Record<NonNullable<DragOffset>, string>,\n },\n})\n\n/**\n * Shared state for drag and drop operations\n * These are module-level refs so all draggable instances share the same state\n */\nconst draggingItem = ref<DraggingItem | null>(null)\nconst hoveredItem = ref<HoveredItem | null>(null)\n\nexport type UseDraggableOptions = {\n /**\n * Upper threshold (gets multiplied with height)\n *\n * @default 0.8\n */\n ceiling?: number\n /**\n * Lower threshold (gets multiplied with height)\n *\n * @default 0.2\n */\n floor?: number\n /**\n * Enable dragging. Can be a reactive ref or computed.\n *\n * @default true\n */\n isDraggable?: MaybeRef<boolean>\n /**\n * Prevents items from being hovered and dropped into. Can be either a function or a boolean\n *\n * @default true\n */\n isDroppable?: MaybeRef<boolean> | ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => boolean)\n /**\n * We pass an array of parents to make it easier to reverse traverse\n */\n parentIds?: string[]\n /**\n * ID for the current item\n */\n id: string\n /**\n * Callback when drag starts\n */\n onDragStart?: (draggingItem: DraggingItem) => void\n /**\n * Callback when drag ends\n */\n onDragEnd?: (draggingItem: DraggingItem, hoveredItem: HoveredItem) => void\n}\n\n/**\n * Composable for handling drag and drop functionality\n */\nexport function useDraggable(options: UseDraggableOptions) {\n const {\n ceiling = 0.8,\n floor = 0.2,\n isDraggable = true,\n isDroppable = true,\n parentIds = [],\n id,\n onDragStart,\n onDragEnd,\n } = options\n\n // The latest parentId in the arr should be the current parent\n const parentId = computed(() => parentIds.at(-1) ?? null)\n\n /** Check if isDroppable guard */\n const _isDroppable = (offset: DragOffset): boolean =>\n typeof isDroppable === 'function'\n ? isDroppable(draggingItem.value!, {\n id: id,\n parentId: parentId.value,\n offset,\n })\n : toValue(isDroppable)\n\n // Start dragging, we want to store the uid + parentUid\n const handleDragStart = (ev: DragEvent) => {\n if (!toValue(isDraggable) || !ev.dataTransfer || !(ev.target instanceof HTMLElement)) {\n return\n }\n\n ev.target.setAttribute('data-dragging', 'true')\n ev.dataTransfer.dropEffect = 'move'\n ev.dataTransfer.effectAllowed = 'move'\n\n // Store dragging item\n const item = { id: id, parentId: parentId.value }\n draggingItem.value = item\n onDragStart?.(item)\n }\n\n // On dragging over we decide which highlight to show\n const handleDragOver = throttle((ev: DragEvent) => {\n // Don't highlight if hovering over self or child\n if (!draggingItem.value || draggingItem.value.id === id || parentIds.includes(draggingItem.value?.id ?? '')) {\n return\n }\n\n const previousOffset = hoveredItem.value?.offset\n const height = (ev.target as HTMLDivElement).offsetHeight\n const _floor = floor * height\n const _ceiling = ceiling * height\n let offset: DragOffset = null\n\n // handle negative offset to be previous offset\n if (ev.offsetY <= 0 && previousOffset && previousOffset !== 'after') {\n offset = previousOffset\n }\n // Above\n else if (ev.offsetY <= _floor) {\n offset = 'before'\n }\n // Below\n else if (ev.offsetY >= _ceiling) {\n offset = 'after'\n }\n // between\n else if (ev.offsetY > _floor && ev.offsetY < _ceiling) {\n offset = 'into'\n }\n\n // Hover guard\n if (!_isDroppable(offset)) {\n return\n }\n\n hoveredItem.value = { id: id, parentId: parentId.value, offset }\n }, 25)\n\n const handleDragEnd = () => {\n if (!hoveredItem.value || !draggingItem.value) {\n return\n }\n\n const _draggingItem = { ...draggingItem.value }\n const _hoveredItem = { ...hoveredItem.value }\n\n // Remove hover and dragging\n draggingItem.value = null\n hoveredItem.value = null\n document.querySelectorAll('[data-dragging]').forEach((el) => el.removeAttribute('data-dragging'))\n\n if (_draggingItem.id === _hoveredItem.id) {\n return\n }\n\n onDragEnd?.(_draggingItem, _hoveredItem)\n }\n\n const draggableClass = computed(() => {\n const position = id === hoveredItem.value?.id ? hoveredItem.value.offset : undefined\n\n if (!position) {\n return ''\n }\n\n return draggableVariants({ position })\n })\n\n /**\n * Props object to bind to the draggable element.\n * Contains the class and draggable attribute.\n */\n const draggableAttrs = computed(() => ({\n class: draggableClass.value || undefined,\n // Only set the draggable attribute if isDraggable is true\n draggable: toValue(isDraggable) ? true : undefined,\n }))\n\n return {\n /**\n * Props object to bind to the draggable element.\n * Contains the class and draggable attribute.\n */\n draggableAttrs,\n /**\n * Event handlers object to bind to the draggable element.\n * Contains dragend, dragover, and dragstart handlers with proper event prevention.\n */\n draggableEvents: {\n dragend: handleDragEnd,\n dragover: (ev: DragEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n handleDragOver(ev)\n },\n dragstart: (ev: DragEvent) => {\n ev.stopPropagation()\n handleDragStart(ev)\n },\n },\n draggingItem: draggingItem as Readonly<Ref<DraggingItem | null>>,\n hoveredItem: hoveredItem as Readonly<Ref<HoveredItem | null>>,\n }\n}\n"],"mappings":";;;;;;AA6BA,IAAM,YACJ,UACA,UAC+B;CAC/B,IAAI,OAAO;AAEX,SAAQ,GAAG,SAAgB;AACzB,MAAI,KACF;AAGF,WAAS,GAAG,KAAK;AACjB,SAAO;AACP,mBAAkB,OAAO,OAAQ,MAAM;;;;AAK3C,IAAM,oBAAoB,IAAI;CAC5B,MAAM;CACN,UAAU,EACR,UAAU;EACR,QAAQ;EACR,OAAO;EACP,MAAM;EACP,EACF;CACF,CAAC;;;;;AAMF,IAAM,eAAe,IAAyB,KAAK;AACnD,IAAM,cAAc,IAAwB,KAAK;;;;AAgDjD,SAAgB,aAAa,SAA8B;CACzD,MAAM,EACJ,UAAU,IACV,QAAQ,IACR,cAAc,MACd,cAAc,MACd,YAAY,EAAE,EACd,IACA,aACA,cACE;CAGJ,MAAM,WAAW,eAAe,UAAU,GAAG,GAAG,IAAI,KAAK;;CAGzD,MAAM,gBAAgB,WACpB,OAAO,gBAAgB,aACnB,YAAY,aAAa,OAAQ;EAC3B;EACJ,UAAU,SAAS;EACnB;EACD,CAAC,GACF,QAAQ,YAAY;CAG1B,MAAM,mBAAmB,OAAkB;AACzC,MAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,GAAG,gBAAgB,EAAE,GAAG,kBAAkB,aACtE;AAGF,KAAG,OAAO,aAAa,iBAAiB,OAAO;AAC/C,KAAG,aAAa,aAAa;AAC7B,KAAG,aAAa,gBAAgB;EAGhC,MAAM,OAAO;GAAM;GAAI,UAAU,SAAS;GAAO;AACjD,eAAa,QAAQ;AACrB,gBAAc,KAAK;;CAIrB,MAAM,iBAAiB,UAAU,OAAkB;AAEjD,MAAI,CAAC,aAAa,SAAS,aAAa,MAAM,OAAO,MAAM,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pB,oBAAgB,GAAG;;GAEtB;EACa;EACD;EACd"}
1
+ {"version":3,"file":"use-draggable.js","names":[],"sources":["../../src/hooks/use-draggable.ts"],"sourcesContent":["import { cva } from '@scalar/use-hooks/useBindCx'\nimport { type MaybeRef, type Ref, computed, ref, toValue } from 'vue'\n\n/**\n * Drag offsets\n */\nexport type DragOffset =\n | 'before' // Insert before the hovered item\n | 'after' // Insert after the hovered item\n | 'into' // Drop into the hovered item\n | null\n\n/**\n * Item you are currently dragging over\n */\nexport type HoveredItem = {\n id: string\n parentId: string | null\n offset: DragOffset\n}\n\n/**\n * Item you are currently dragging\n */\nexport type DraggingItem = Omit<HoveredItem, 'offset'>\n\n/**\n * Simple throttle function to avoid package dependencies\n */\nconst throttle = <TArgs extends Array<unknown>>(\n callback: (...args: TArgs) => void,\n limit: number,\n): ((...args: TArgs) => void) => {\n let wait = false\n\n return (...args: TArgs) => {\n if (wait) {\n return\n }\n\n callback(...args)\n wait = true\n setTimeout(() => (wait = false), limit)\n }\n}\n\n/** Draggable class variants to apply to the draggable element */\nconst draggableVariants = cva({\n base: 'relative after:absolute after:inset-x-0 after:block after:bg-blue after:opacity-15 after:pointer-events-none after:rounded',\n variants: {\n position: {\n before: 'after:-top-0.5 after:h-0.75',\n after: 'after:-bottom-0.5 after:h-0.75',\n into: 'after:inset-0',\n } as const satisfies Record<NonNullable<DragOffset>, string>,\n },\n})\n\n/**\n * Shared state for drag and drop operations\n * These are module-level refs so all draggable instances share the same state\n */\nconst draggingItem = ref<DraggingItem | null>(null)\nconst hoveredItem = ref<HoveredItem | null>(null)\n\nexport type UseDraggableOptions = {\n /**\n * Upper threshold (gets multiplied with height)\n *\n * @default 0.8\n */\n ceiling?: number\n /**\n * Lower threshold (gets multiplied with height)\n *\n * @default 0.2\n */\n floor?: number\n /**\n * Enable dragging. Can be a reactive ref or computed.\n *\n * @default true\n */\n isDraggable?: MaybeRef<boolean>\n /**\n * Prevents items from being hovered and dropped into. Can be either a function or a boolean\n *\n * @default true\n */\n isDroppable?: MaybeRef<boolean> | ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => boolean)\n /**\n * We pass an array of parents to make it easier to reverse traverse\n */\n parentIds?: string[]\n /**\n * ID for the current item\n */\n id: string\n /**\n * Callback when drag starts\n */\n onDragStart?: (draggingItem: DraggingItem) => void\n /**\n * Callback when drag ends\n */\n onDragEnd?: (draggingItem: DraggingItem, hoveredItem: HoveredItem) => void\n}\n\n/**\n * Composable for handling drag and drop functionality\n */\nexport function useDraggable(options: UseDraggableOptions) {\n const {\n ceiling = 0.8,\n floor = 0.2,\n isDraggable = true,\n isDroppable = true,\n parentIds = [],\n id,\n onDragStart,\n onDragEnd,\n } = options\n\n // The latest parentId in the arr should be the current parent\n const parentId = computed(() => parentIds.at(-1) ?? null)\n\n /** Check if isDroppable guard */\n const _isDroppable = (offset: DragOffset): boolean =>\n typeof isDroppable === 'function'\n ? isDroppable(draggingItem.value!, {\n id: id,\n parentId: parentId.value,\n offset,\n })\n : toValue(isDroppable)\n\n // Start dragging, we want to store the uid + parentUid\n const handleDragStart = (ev: DragEvent) => {\n if (!toValue(isDraggable) || !ev.dataTransfer || !(ev.target instanceof HTMLElement)) {\n return\n }\n\n ev.target.setAttribute('data-dragging', 'true')\n ev.dataTransfer.dropEffect = 'move'\n ev.dataTransfer.effectAllowed = 'move'\n\n // Store dragging item\n const item = { id: id, parentId: parentId.value }\n draggingItem.value = item\n onDragStart?.(item)\n }\n\n // On dragging over we decide which highlight to show\n const handleDragOver = throttle((ev: DragEvent) => {\n // Don't highlight if hovering over self or child\n if (!draggingItem.value || draggingItem.value.id === id || parentIds.includes(draggingItem.value?.id ?? '')) {\n return\n }\n\n const previousOffset = hoveredItem.value?.offset\n const height = (ev.target as HTMLDivElement).offsetHeight\n const _floor = floor * height\n const _ceiling = ceiling * height\n let offset: DragOffset = null\n\n // handle negative offset to be previous offset\n if (ev.offsetY <= 0 && previousOffset && previousOffset !== 'after') {\n offset = previousOffset\n }\n // Above\n else if (ev.offsetY <= _floor) {\n offset = 'before'\n }\n // Below\n else if (ev.offsetY >= _ceiling) {\n offset = 'after'\n }\n // between\n else if (ev.offsetY > _floor && ev.offsetY < _ceiling) {\n offset = 'into'\n }\n\n // Hover guard\n if (!_isDroppable(offset)) {\n return\n }\n\n hoveredItem.value = { id: id, parentId: parentId.value, offset }\n }, 25)\n\n const handleDragEnd = () => {\n if (!hoveredItem.value || !draggingItem.value) {\n return\n }\n\n const _draggingItem = { ...draggingItem.value }\n const _hoveredItem = { ...hoveredItem.value }\n\n // Remove hover and dragging\n draggingItem.value = null\n hoveredItem.value = null\n document.querySelectorAll('[data-dragging]').forEach((el) => el.removeAttribute('data-dragging'))\n\n if (_draggingItem.id === _hoveredItem.id) {\n return\n }\n\n onDragEnd?.(_draggingItem, _hoveredItem)\n }\n\n const draggableClass = computed(() => {\n const position = id === hoveredItem.value?.id ? hoveredItem.value.offset : undefined\n\n if (!position) {\n return ''\n }\n\n return draggableVariants({ position })\n })\n\n /**\n * Props object to bind to the draggable element.\n * Contains the class and draggable attribute.\n */\n const draggableAttrs = computed(() => ({\n class: draggableClass.value || undefined,\n // Only set the draggable attribute if isDraggable is true\n draggable: toValue(isDraggable) ? true : undefined,\n }))\n\n return {\n /**\n * Props object to bind to the draggable element.\n * Contains the class and draggable attribute.\n */\n draggableAttrs,\n /**\n * Event handlers object to bind to the draggable element.\n * Contains dragend, dragover, and dragstart handlers with proper event prevention.\n */\n draggableEvents: {\n dragend: handleDragEnd,\n dragover: (ev: DragEvent) => {\n ev.preventDefault()\n ev.stopPropagation()\n handleDragOver(ev)\n },\n dragstart: (ev: DragEvent) => {\n ev.stopPropagation()\n handleDragStart(ev)\n },\n },\n draggingItem: draggingItem as Readonly<Ref<DraggingItem | null>>,\n hoveredItem: hoveredItem as Readonly<Ref<HoveredItem | null>>,\n }\n}\n"],"mappings":";;;;;;AA6BA,IAAM,YACJ,UACA,UAC+B;CAC/B,IAAI,OAAO;CAEX,QAAQ,GAAG,SAAg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AAG,WAAW,QACrB,SAAS;OAGN,IAAI,GAAG,WAAW,UACrB,SAAS;OAGN,IAAI,GAAG,UAAU,UAAU,GAAG,UAAU,UAC3C,SAAS;EAIX,IAAI,CAAC,aAAa,MAAM,GACtB;EAGF,YAAY,QAAQ;GAAM;GAAI,UAAU,SAAS;GAAO;EAAO;CACjE,GAAG,EAAE;CAEL,MAAM,sBAAsB;EAC1B,IAAI,CAAC,YAAY,SAAS,CAAC,aAAa,OACtC;EAGF,MAAM,gBAAgB,EAAE,GAAG,aAAa,MAAM;EAC9C,MAAM,eAAe,EAAE,GAAG,YAAY,MAAM;EAG5C,aAAa,QAAQ;EACrB,YAAY,QAAQ;EACpB,SAAS,iBAAiB,iBAAiB,CAAC,CAAC,SAAS,OAAO,GAAG,gBAAgB,eAAe,CAAC;EAEhG,IAAI,cAAc,OAAO,aAAa,IACpC;EAGF,YAAY,eAAe,YAAY;CACzC;CAEA,MAAM,iBAAiB,eAAe;EACpC,MAAM,WAAW,OAAO,YAAY,OAAO,KAAK,YAAY,MAAM,SAAS,KAAA;EAE3E,IAAI,CAAC,UACH,OAAO;EAGT,OAAO,kBAAkB,EAAE,SAAS,CAAC;CACvC,CAAC;CAYD,OAAO;;;;;EAKL,gBAXqB,gBAAgB;GACrC,OAAO,eAAe,SAAS,KAAA;GAE/B,WAAW,QAAQ,WAAW,IAAI,OAAO,KAAA;EAC3C,EAOE;;;;;EAKA,iBAAiB;GACf,SAAS;GACT,WAAW,OAAkB;IAC3B,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,eAAe,EAAE;GACnB;GACA,YAAY,OAAkB;IAC5B,GAAG,gBAAgB;IACnB,gBAAgB,EAAE;GACpB;EACF;EACc;EACD;CACf;AACF"}
package/dist/style.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
2
  @layer properties {
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 {
@@ -691,6 +691,10 @@
691
691
  }
692
692
  }
693
693
 
694
+ .scalar-app .hljs-regexp, .scalar-app .hljs-string, .scalar-app .hljs-built_in, .scalar-app .hljs-subst, .scalar-app .hljs-name, .scalar-app .hljs-doctag, .scalar-app .hljs-section, .scalar-app .hljs-title {
695
+ color: var(--scalar-color-blue);
696
+ }
697
+
694
698
  .scalar-code-block pre {
695
699
  font-variant-ligatures: none;
696
700
  }
@@ -1676,7 +1680,7 @@
1676
1680
  margin-bottom: -1px;
1677
1681
  }
1678
1682
 
1679
- :where(body) > .scalar-tooltip {
1683
+ :where(body, dialog) > .scalar-tooltip {
1680
1684
  --scalar-tooltip-padding-x: 8px;
1681
1685
  --scalar-tooltip-padding-y: 6px;
1682
1686
  padding: var(--scalar-tooltip-padding-y) var(--scalar-tooltip-padding-x);
@@ -1690,23 +1694,23 @@
1690
1694
  color: var(--scalar-tooltip-color);
1691
1695
  }
1692
1696
 
1693
- :where(body) > .scalar-tooltip[data-side="top"] {
1697
+ :where(body, dialog) > .scalar-tooltip[data-side="top"] {
1694
1698
  padding-bottom: calc(var(--scalar-tooltip-padding-y) + var(--scalar-tooltip-offset));
1695
1699
  }
1696
1700
 
1697
- :where(body) > .scalar-tooltip[data-side="bottom"] {
1701
+ :where(body, dialog) > .scalar-tooltip[data-side="bottom"] {
1698
1702
  padding-top: calc(var(--scalar-tooltip-padding-y) + var(--scalar-tooltip-offset));
1699
1703
  }
1700
1704
 
1701
- :where(body) > .scalar-tooltip[data-side="left"] {
1705
+ :where(body, dialog) > .scalar-tooltip[data-side="left"] {
1702
1706
  padding-right: calc(var(--scalar-tooltip-padding-x) + var(--scalar-tooltip-offset));
1703
1707
  }
1704
1708
 
1705
- :where(body) > .scalar-tooltip[data-side="right"] {
1709
+ :where(body, dialog) > .scalar-tooltip[data-side="right"] {
1706
1710
  padding-left: calc(var(--scalar-tooltip-padding-x) + var(--scalar-tooltip-offset));
1707
1711
  }
1708
1712
 
1709
- :where(body) > .scalar-tooltip:before {
1713
+ :where(body, dialog) > .scalar-tooltip:before {
1710
1714
  content: "";
1711
1715
  z-index: calc(1 * -1);
1712
1716
  border-radius: var(--scalar-radius-lg);
@@ -1722,19 +1726,19 @@
1722
1726
  inset: 0;
1723
1727
  }
1724
1728
 
1725
- :where(body) > .scalar-tooltip[data-side="top"]:before {
1729
+ :where(body, dialog) > .scalar-tooltip[data-side="top"]:before {
1726
1730
  bottom: var(--scalar-tooltip-offset);
1727
1731
  }
1728
1732
 
1729
- :where(body) > .scalar-tooltip[data-side="bottom"]:before {
1733
+ :where(body, dialog) > .scalar-tooltip[data-side="bottom"]:before {
1730
1734
  top: var(--scalar-tooltip-offset);
1731
1735
  }
1732
1736
 
1733
- :where(body) > .scalar-tooltip[data-side="left"]:before {
1737
+ :where(body, dialog) > .scalar-tooltip[data-side="left"]:before {
1734
1738
  right: var(--scalar-tooltip-offset);
1735
1739
  }
1736
1740
 
1737
- :where(body) > .scalar-tooltip[data-side="right"]:before {
1741
+ :where(body, dialog) > .scalar-tooltip[data-side="right"]:before {
1738
1742
  left: var(--scalar-tooltip-offset);
1739
1743
  }
1740
1744
 
@@ -1971,22 +1975,6 @@
1971
1975
  inset-block: 2px;
1972
1976
  }
1973
1977
 
1974
- .scalar-app .-start {
1975
- inset-inline-start: -4px;
1976
- }
1977
-
1978
- .scalar-app .start {
1979
- inset-inline-start: 4px;
1980
- }
1981
-
1982
- .scalar-app .-end {
1983
- inset-inline-end: -4px;
1984
- }
1985
-
1986
- .scalar-app .end {
1987
- inset-inline-end: 4px;
1988
- }
1989
-
1990
1978
  .scalar-app .-top-1 {
1991
1979
  top: -4px;
1992
1980
  }
@@ -2109,7 +2097,6 @@
2109
2097
 
2110
2098
  .scalar-app .z-10 {
2111
2099
  z-index: 10;
2112
- z-index: 10;
2113
2100
  }
2114
2101
 
2115
2102
  .scalar-app .z-context {
@@ -2660,7 +2647,7 @@
2660
2647
  }
2661
2648
 
2662
2649
  .scalar-app .translate-x-0 {
2663
- --tw-translate-x: calc(4px * 0);
2650
+ --tw-translate-x: 0px;
2664
2651
  translate: var(--tw-translate-x) var(--tw-translate-y);
2665
2652
  }
2666
2653
 
@@ -2695,7 +2682,7 @@
2695
2682
  }
2696
2683
 
2697
2684
  .scalar-app .translate-y-0 {
2698
- --tw-translate-y: calc(4px * 0);
2685
+ --tw-translate-y: 0px;
2699
2686
  translate: var(--tw-translate-x) var(--tw-translate-y);
2700
2687
  }
2701
2688
 
@@ -3562,7 +3549,7 @@
3562
3549
  }
3563
3550
 
3564
3551
  .scalar-app .shadow-border {
3565
- --tw-shadow: inset 0 0 0 var(--tw-shadow-color, var(--scalar-border-width)) var(--scalar-border-color);
3552
+ --tw-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);
3566
3553
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
3567
3554
  }
3568
3555
 
@@ -3797,6 +3784,16 @@
3797
3784
  .scalar-app .group-hover\/button\:opacity-0:is(:where(.group\/button):hover *) {
3798
3785
  opacity: 0;
3799
3786
  }
3787
+
3788
+ .scalar-app .group-hover\/copy-button\:bg-b-1\.5:is(:where(.group\/copy-button):hover *) {
3789
+ background-color: var(--scalar-background-1);
3790
+ }
3791
+
3792
+ @supports (color: color-mix(in lab, red, red)) {
3793
+ .scalar-app .group-hover\/copy-button\:bg-b-1\.5:is(:where(.group\/copy-button):hover *) {
3794
+ background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
3795
+ }
3796
+ }
3800
3797
  }
3801
3798
 
3802
3799
  .scalar-app .group-focus-visible\/button\:opacity-0:is(:where(.group\/button):focus-visible *) {
@@ -3930,10 +3927,6 @@
3930
3927
  border-bottom-left-radius: inherit;
3931
3928
  }
3932
3929
 
3933
- .scalar-app .focus-within\:bg-b-1:focus-within {
3934
- background-color: var(--scalar-background-1);
3935
- }
3936
-
3937
3930
  .scalar-app .focus-within\:opacity-100:focus-within {
3938
3931
  opacity: 1;
3939
3932
  }
@@ -3944,6 +3937,16 @@
3944
3937
  }
3945
3938
 
3946
3939
  @media (hover: hover) {
3940
+ .scalar-app .hover\:bg-b-1\.5:hover {
3941
+ background-color: var(--scalar-background-1);
3942
+ }
3943
+
3944
+ @supports (color: color-mix(in lab, red, red)) {
3945
+ .scalar-app .hover\:bg-b-1\.5:hover {
3946
+ background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
3947
+ }
3948
+ }
3949
+
3947
3950
  .scalar-app .hover\:bg-b-2:hover {
3948
3951
  background-color: var(--scalar-background-2);
3949
3952
  }
@@ -4106,6 +4109,20 @@
4106
4109
  background-color: var(--bg-dark);
4107
4110
  }
4108
4111
 
4112
+ .scalar-app .dark\:bg-b-1\.5:where(.dark-mode, .dark-mode *) {
4113
+ background-color: var(--scalar-background-1);
4114
+ }
4115
+
4116
+ @supports (color: color-mix(in lab, red, red)) {
4117
+ .scalar-app .dark\:bg-b-1\.5:where(.dark-mode, .dark-mode *) {
4118
+ background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
4119
+ }
4120
+ }
4121
+
4122
+ .scalar-app .dark\:bg-b-2:where(.dark-mode, .dark-mode *) {
4123
+ background-color: var(--scalar-background-2);
4124
+ }
4125
+
4109
4126
  .scalar-app .dark\:bg-b-3:where(.dark-mode, .dark-mode *) {
4110
4127
  background-color: var(--scalar-background-3);
4111
4128
  }
@@ -4129,6 +4146,20 @@
4129
4146
  }
4130
4147
 
4131
4148
  @media (hover: hover) {
4149
+ .scalar-app .dark\:group-hover\/copy-button\:bg-b-1\.5:where(.dark-mode, .dark-mode *):is(:where(.group\/copy-button):hover *) {
4150
+ background-color: var(--scalar-background-1);
4151
+ }
4152
+
4153
+ @supports (color: color-mix(in lab, red, red)) {
4154
+ .scalar-app .dark\:group-hover\/copy-button\:bg-b-1\.5:where(.dark-mode, .dark-mode *):is(:where(.group\/copy-button):hover *) {
4155
+ background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
4156
+ }
4157
+ }
4158
+
4159
+ .scalar-app .dark\:hover\:bg-b-2:where(.dark-mode, .dark-mode *):hover {
4160
+ background-color: var(--scalar-background-2);
4161
+ }
4162
+
4132
4163
  .scalar-app .dark\:hover\:bg-b-3:where(.dark-mode, .dark-mode *):hover {
4133
4164
  background-color: var(--scalar-background-3);
4134
4165
  }
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.9.34",
13
+ "version": "0.9.35",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -32,25 +32,25 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "vue": "^3.5.30",
36
- "@scalar/helpers": "0.9.2",
35
+ "vue": "^3.5.40",
37
36
  "@scalar/icons": "0.7.5",
38
- "@scalar/components": "0.27.10",
39
- "@scalar/use-hooks": "0.4.9",
37
+ "@scalar/components": "0.27.11",
40
38
  "@scalar/themes": "0.17.2",
41
- "@scalar/workspace-store": "0.56.0"
39
+ "@scalar/workspace-store": "0.56.1",
40
+ "@scalar/helpers": "0.10.0",
41
+ "@scalar/use-hooks": "0.4.9"
42
42
  },
43
43
  "devDependencies": {
44
- "@tailwindcss/cli": "^4.2.4",
45
- "@tailwindcss/vite": "^4.2.0",
44
+ "@tailwindcss/cli": "^4.3.3",
45
+ "@tailwindcss/vite": "^4.3.3",
46
46
  "@types/jsdom": "28.0.1",
47
47
  "@types/node": "^24.1.0",
48
- "@vitejs/plugin-vue": "^6.0.3",
49
- "@vue/test-utils": "2.4.6",
48
+ "@vitejs/plugin-vue": "^6.0.8",
49
+ "@vue/test-utils": "2.4.11",
50
50
  "jsdom": "27.4.0",
51
- "tailwindcss": "^4.1.18",
52
- "vite": "8.0.0",
53
- "vitest": "4.1.0"
51
+ "tailwindcss": "^4.3.3",
52
+ "vite": "8.1.5",
53
+ "vitest": "4.1.10"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "vite build && pnpm build:styles && vue-tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",