@scalar/sidebar 0.13.1 → 0.13.3

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.
@@ -5,7 +5,11 @@ import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
5
5
  var HttpMethod_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
6
6
  __name: "HttpMethod",
7
7
  props: {
8
- as: {},
8
+ as: { type: [
9
+ Object,
10
+ Function,
11
+ String
12
+ ] },
9
13
  property: {},
10
14
  short: { type: Boolean },
11
15
  method: {}
@@ -1 +1 @@
1
- {"version":3,"file":"HttpMethod.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_unref","_normalizeStyle","_withCtx","_renderSlot","_createTextVNode","_toDisplayString"],"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 { isHttpMethod } from '@scalar/helpers/http/is-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(() => {\n if (typeof props.method !== 'string' || !props.method.trim()) {\n return 'get'\n }\n const method = props.method.trim()\n return isHttpMethod(method.toLowerCase()) ? method.toLowerCase() : method\n})\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n :class=\"{ uppercase: isHttpMethod(normalized) }\"\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;GAChC,IAAI,OAAO,MAAM,WAAW,YAAY,CAAC,MAAM,OAAO,KAAK,GACzD,OAAO;GAET,MAAM,SAAS,MAAM,OAAO,KAAK;GACjC,OAAO,aAAa,OAAO,YAAY,CAAC,IAAI,OAAO,YAAY,IAAI;EACrE,CAAC;;GAIC,OAAAA,UAAA,GAAAC,YAMYC,wBALL,QAAA,MAAE,MAAA,GAAA;IACN,OAAKC,eAAA,EAAA,WAAeC,MAAA,YAAA,CAAY,CAAC,WAAA,KAAU,EAAA,CAAA;IAC3C,OAAKC,eAAA,GAAK,QAAA,YAAQ,UAAc,eAAA,MAAe,SAAQ,CAAA;;IACxD,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,GAAAC,gBAAA,MACRC,gBAAG,QAAA,QAAQ,eAAA,MAAe,QAAQ,WAAA,KAAU,GAAA,CAAA,C"}
1
+ {"version":3,"file":"HttpMethod.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_unref","_normalizeStyle","_withCtx","_renderSlot","_createTextVNode","_toDisplayString"],"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 { isHttpMethod } from '@scalar/helpers/http/is-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(() => {\n if (typeof props.method !== 'string' || !props.method.trim()) {\n return 'get'\n }\n const method = props.method.trim()\n return isHttpMethod(method.toLowerCase()) ? method.toLowerCase() : method\n})\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n :class=\"{ uppercase: isHttpMethod(normalized) }\"\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;GAChC,IAAI,OAAO,MAAM,WAAW,YAAY,CAAC,MAAM,OAAO,KAAK,GACzD,OAAO;GAET,MAAM,SAAS,MAAM,OAAO,KAAK;GACjC,OAAO,aAAa,OAAO,YAAY,CAAC,IAAI,OAAO,YAAY,IAAI;EACrE,CAAC;;GAIC,OAAAA,UAAA,GAAAC,YAMYC,wBALL,QAAA,MAAE,MAAA,GAAA;IACN,OAAKC,eAAA,EAAA,WAAeC,MAAA,YAAA,CAAY,CAAC,WAAA,KAAU,EAAA,CAAA;IAC3C,OAAKC,eAAA,GAAK,QAAA,YAAQ,UAAc,eAAA,MAAe,SAAQ,CAAA;;IACxD,SAAAC,cAAQ,CAARC,WAAQ,KAAA,QAAA,SAAA,GAAAC,gBAAA,MACRC,gBAAG,QAAA,QAAQ,eAAA,MAAe,QAAQ,WAAA,KAAU,GAAA,CAAA,C"}
@@ -14,7 +14,7 @@ var ScalarSidebar_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
14
14
  indent: { default: 20 },
15
15
  getHref: { type: Function },
16
16
  isDraggable: {},
17
- isDroppable: { type: Function }
17
+ isDroppable: { type: [Object, Function] }
18
18
  },
19
19
  emits: [
20
20
  "reorder",
@@ -29,7 +29,7 @@ var SidebarItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
29
29
  options: {},
30
30
  getHref: { type: Function },
31
31
  isDraggable: {},
32
- isDroppable: { type: Function }
32
+ isDroppable: { type: [Object, Function] }
33
33
  },
34
34
  emits: [
35
35
  "selectItem",
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Scrolls the sidebar container so the requested item appears near the top.
3
+ *
4
+ * @param root - Where the sidebar lives, so it is found inside a shadow root too. Defaults to the document.
3
5
  */
4
- export declare const scrollSidebarToTop: (id: string, offsetTop?: number) => void;
6
+ export declare const scrollSidebarToTop: (id: string, offsetTop?: number, root?: Document | ShadowRoot) => void;
5
7
  //# sourceMappingURL=scroll-sidebar-to-top.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-sidebar-to-top.d.ts","sourceRoot":"","sources":["../../src/helpers/scroll-sidebar-to-top.ts"],"names":[],"mappings":"AAiDA;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,MAAM,EAAE,YAAW,MAAkC,KAAG,IAmB9F,CAAA"}
1
+ {"version":3,"file":"scroll-sidebar-to-top.d.ts","sourceRoot":"","sources":["../../src/helpers/scroll-sidebar-to-top.ts"],"names":[],"mappings":"AAiDA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,MAAM,EACV,YAAW,MAAkC,EAC7C,OAAO,QAAQ,GAAG,UAAU,KAC3B,IAmBF,CAAA"}
@@ -33,10 +33,12 @@ var getTopRelativeToScroller = (element, scroller) => {
33
33
  };
34
34
  /**
35
35
  * Scrolls the sidebar container so the requested item appears near the top.
36
+ *
37
+ * @param root - Where the sidebar lives, so it is found inside a shadow root too. Defaults to the document.
36
38
  */
37
- var scrollSidebarToTop = (id, offsetTop = DEFAULT_SCROLL_OFFSET_TOP) => {
39
+ var scrollSidebarToTop = (id, offsetTop = DEFAULT_SCROLL_OFFSET_TOP, root) => {
38
40
  if (typeof window === "undefined") return;
39
- const element = document.querySelector(`[data-sidebar-id="${id}"]`);
41
+ const element = (root ?? document).querySelector(`[data-sidebar-id="${id}"]`);
40
42
  const scroller = element?.closest(".custom-scroll, .custom-scrollbar") ?? null;
41
43
  if (!element || !scroller) return;
42
44
  const targetTop = getTopRelativeToScroller(getMeasurableElement(element), scroller) + getHeadingOffset(element) - offsetTop;
@@ -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;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"}
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 *\n * @param root - Where the sidebar lives, so it is found inside a shadow root too. Defaults to the document.\n */\nexport const scrollSidebarToTop = (\n id: string,\n offsetTop: number = DEFAULT_SCROLL_OFFSET_TOP,\n root?: Document | ShadowRoot,\n): void => {\n if (typeof window === 'undefined') {\n return\n }\n\n const element = (root ?? 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,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"}
@@ -1,5 +1,6 @@
1
1
  import { computed, ref, toValue } from "vue";
2
2
  import { cva } from "@scalar/use-hooks/useBindCx";
3
+ import { useDocumentRoot } from "@scalar/use-hooks/useDocumentRoot";
3
4
  // src/hooks/use-draggable.ts
4
5
  /**
5
6
  * Simple throttle function to avoid package dependencies
@@ -33,6 +34,7 @@ var hoveredItem = ref(null);
33
34
  */
34
35
  function useDraggable(options) {
35
36
  const { ceiling = .8, floor = .2, isDraggable = true, isDroppable = true, parentIds = [], id, onDragStart, onDragEnd } = options;
37
+ const documentRoot = useDocumentRoot();
36
38
  const parentId = computed(() => parentIds.at(-1) ?? null);
37
39
  /** Check if isDroppable guard */
38
40
  const _isDroppable = (offset) => typeof isDroppable === "function" ? isDroppable(draggingItem.value, {
@@ -76,7 +78,7 @@ function useDraggable(options) {
76
78
  const _hoveredItem = { ...hoveredItem.value };
77
79
  draggingItem.value = null;
78
80
  hoveredItem.value = null;
79
- document.querySelectorAll("[data-dragging]").forEach((el) => el.removeAttribute("data-dragging"));
81
+ documentRoot?.querySelectorAll("[data-dragging]").forEach((el) => el.removeAttribute("data-dragging"));
80
82
  if (_draggingItem.id === _hoveredItem.id) return;
81
83
  onDragEnd?.(_draggingItem, _hoveredItem);
82
84
  };
@@ -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;CAEX,QAAQ,GAAG,SAAgB;EACzB,IAAI,MACF;EAGF,SAAS,GAAG,IAAI;EAChB,OAAO;EACP,iBAAkB,OAAO,OAAQ,KAAK;CACxC;AACF;;AAGA,IAAM,oBAAoB,IAAI;CAC5B,MAAM;CACN,UAAU,EACR,UAAU;EACR,QAAQ;EACR,OAAO;EACP,MAAM;CACR,EACF;AACF,CAAC;;;;;AAMD,IAAM,eAAe,IAAyB,IAAI;AAClD,IAAM,cAAc,IAAwB,IAAI;;;;AAgDhD,SAAgB,aAAa,SAA8B;CACzD,MAAM,EACJ,UAAU,IACV,QAAQ,IACR,cAAc,MACd,cAAc,MACd,YAAY,CAAC,GACb,IACA,aACA,cACE;CAGJ,MAAM,WAAW,eAAe,UAAU,GAAG,EAAE,KAAK,IAAI;;CAGxD,MAAM,gBAAg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gB,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"}
1
+ {"version":3,"file":"use-draggable.js","names":[],"sources":["../../src/hooks/use-draggable.ts"],"sourcesContent":["import { cva } from '@scalar/use-hooks/useBindCx'\nimport { useDocumentRoot } from '@scalar/use-hooks/useDocumentRoot'\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 const documentRoot = useDocumentRoot()\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 documentRoot?.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":";;;;;;;AA8BA,IAAM,YACJ,UACA,UAC+B;CAC/B,IAAI,OAAO;CAEX,QAAQ,GAAG,SAAgB;EACzB,IAAI,MACF;EAGF,SAAS,GAAG,IAAI;EAChB,OAAO;EACP,iBAAkB,OAAO,OAAQ,KAAK;CACxC;AACF;;AAGA,IAAM,oBAAoB,IAAI;CAC5B,MAAM;CACN,UAAU,EACR,UAAU;EACR,QAAQ;EACR,OAAO;EACP,MAAM;CACR,EACF;AACF,CAAC;;;;;AAMD,IAAM,eAAe,IAAyB,IAAI;AAClD,IAAM,cAAc,IAAwB,IAAI;;;;AAgDhD,SAAgB,aAAa,SAA8B;CACzD,MAAM,EACJ,UAAU,IACV,QAAQ,IACR,cAAc,MACd,cAAc,MACd,YAAY,CAAC,GACb,IACA,aACA,cACE;CAEJ,MAAM,eAAe,gBAAgB;CAGrC,MAAM,WAAW,eAAe,UAAU,GAAG,EAAE,KAAK,IAAI;;CAGxD,MAAM,gBAAgB,WACpB,OAAO,gBAAgB,aACnB,YAAY,aAAa,OAAQ;EAC3B;EACJ,UAAU,SAAS;EACnB;CACF,CAAC,IACD,QAAQ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B,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
@@ -1017,7 +1017,7 @@
1017
1017
  color: var(--scalar-code-string, var(--scalar-color-blue));
1018
1018
  }
1019
1019
 
1020
- .hljs.language-curl .hljs-literal, .hljs.language-php .hljs-variable, .hljs.language-objectivec .hljs-meta {
1020
+ .hljs.language-php .hljs-variable, .hljs.language-objectivec .hljs-meta {
1021
1021
  color: var(--scalar-color-1);
1022
1022
  }
1023
1023
 
@@ -2605,6 +2605,10 @@
2605
2605
  max-height: 80svh;
2606
2606
  }
2607
2607
 
2608
+ .scalar-app .max-h-\[85svh\] {
2609
+ max-height: 85svh;
2610
+ }
2611
+
2608
2612
  .scalar-app .max-h-\[90svh\] {
2609
2613
  max-height: 90svh;
2610
2614
  }
@@ -2669,6 +2673,10 @@
2669
2673
  width: 38px;
2670
2674
  }
2671
2675
 
2676
+ .scalar-app .w-\[calc\(100dvw-2rem\)\] {
2677
+ width: calc(100dvw - 2rem);
2678
+ }
2679
+
2672
2680
  .scalar-app .w-\[calc\(100vw-12px\)\] {
2673
2681
  width: calc(100vw - 12px);
2674
2682
  }
@@ -2733,6 +2741,14 @@
2733
2741
  max-width: inherit;
2734
2742
  }
2735
2743
 
2744
+ .scalar-app .max-w-full {
2745
+ max-width: 100%;
2746
+ }
2747
+
2748
+ .scalar-app .max-w-md {
2749
+ max-width: 448px;
2750
+ }
2751
+
2736
2752
  .scalar-app .max-w-screen-padded-4 {
2737
2753
  max-width: calc(100vw - 32px);
2738
2754
  }
@@ -4073,6 +4089,10 @@
4073
4089
  font-family: inherit;
4074
4090
  }
4075
4091
 
4092
+ .scalar-app .backdrop\:bg-backdrop::backdrop {
4093
+ background-color: #00000038;
4094
+ }
4095
+
4076
4096
  .scalar-app .after\:pointer-events-none:after {
4077
4097
  content: var(--tw-content);
4078
4098
  pointer-events: none;
@@ -4366,7 +4386,13 @@
4366
4386
  background-color: color-mix(in srgb, var(--scalar-background-1), var(--scalar-background-2));
4367
4387
  }
4368
4388
  }
4389
+ }
4369
4390
 
4391
+ .scalar-app .dark\:backdrop\:bg-backdrop-dark:where(.dark-mode, .dark-mode *)::backdrop {
4392
+ background-color: #00000073;
4393
+ }
4394
+
4395
+ @media (hover: hover) {
4370
4396
  .scalar-app .dark\:hover\:bg-b-2:where(.dark-mode, .dark-mode *):hover {
4371
4397
  background-color: var(--scalar-background-2);
4372
4398
  }
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.13.1",
13
+ "version": "0.13.3",
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
@@ -32,13 +32,13 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@scalar/components": "0.35.4",
36
- "@scalar/helpers": "0.19.0",
37
- "@scalar/icons": "0.7.11",
38
- "@scalar/themes": "0.21.0",
39
- "@scalar/use-hooks": "0.4.29",
40
- "@scalar/workspace-store": "0.75.0",
41
- "vue": "^3.5.45"
35
+ "@scalar/components": "0.36.0",
36
+ "@scalar/helpers": "0.20.0",
37
+ "@scalar/icons": "0.7.12",
38
+ "@scalar/themes": "0.21.1",
39
+ "@scalar/use-hooks": "0.5.0",
40
+ "@scalar/workspace-store": "0.77.0",
41
+ "vue": "^3.5.46"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@tailwindcss/cli": "^4.3.5",
@@ -47,10 +47,10 @@
47
47
  "@types/node": "^24.19.2",
48
48
  "@vitejs/plugin-vue": "^6.0.11",
49
49
  "@vue/test-utils": "2.6.0",
50
- "jsdom": "30.1.3",
50
+ "jsdom": "31.0.1",
51
51
  "tailwindcss": "^4.3.5",
52
52
  "vite": "8.3.8",
53
- "vitest": "5.1.0"
53
+ "vitest": "5.1.1"
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",