@scalar/sidebar 0.8.8 → 0.8.10
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.
- package/dist/components/ScalarSidebar.vue.d.ts +2 -2
- package/dist/components/SidebarItem.vue.d.ts +2 -2
- package/dist/components/SidebarItemLabel.vue.d.ts +1 -1
- package/dist/helpers/filter-items.d.ts +1 -1
- package/dist/helpers/has-children.d.ts +1 -1
- package/dist/helpers/is-sidebar-folder.d.ts +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +832 -20
- package/dist/index.js.map +1 -0
- package/dist/style.css +4535 -1
- package/package.json +12 -18
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/components/HttpMethod.vue.js +0 -30
- package/dist/components/HttpMethod.vue2.js +0 -4
- package/dist/components/ScalarSidebar.vue.js +0 -82
- package/dist/components/ScalarSidebar.vue2.js +0 -4
- package/dist/components/SidebarHttpBadge.vue.js +0 -7
- package/dist/components/SidebarHttpBadge.vue2.js +0 -41
- package/dist/components/SidebarItem.vue.js +0 -264
- package/dist/components/SidebarItem.vue2.js +0 -4
- package/dist/components/SidebarItemDecorator.vue.js +0 -12
- package/dist/components/SidebarItemLabel.vue.js +0 -22
- package/dist/components/SidebarItemLabel.vue2.js +0 -4
- package/dist/helpers/create-sidebar-state.js +0 -38
- package/dist/helpers/filter-items.js +0 -4
- package/dist/helpers/generate-reverse-index.js +0 -14
- package/dist/helpers/get-child-entry.js +0 -14
- package/dist/helpers/has-children.js +0 -4
- package/dist/helpers/is-sidebar-folder.js +0 -5
- package/dist/helpers/scroll-sidebar-to-top.js +0 -27
- package/dist/hooks/use-draggable.js +0 -82
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { cva as y } from "@scalar/use-hooks/useBindCx";
|
|
2
|
-
import { computed as c, ref as h, toValue as p } from "vue";
|
|
3
|
-
const S = (i, u) => {
|
|
4
|
-
let n = !1;
|
|
5
|
-
return (...f) => {
|
|
6
|
-
n || (i(...f), n = !0, setTimeout(() => n = !1, u));
|
|
7
|
-
};
|
|
8
|
-
}, w = y({
|
|
9
|
-
base: "relative after:absolute after:inset-x-0 after:block after:bg-blue after:opacity-15 after:pointer-events-none after:rounded",
|
|
10
|
-
variants: {
|
|
11
|
-
position: {
|
|
12
|
-
before: "after:-top-0.5 after:h-0.75",
|
|
13
|
-
after: "after:-bottom-0.5 after:h-0.75",
|
|
14
|
-
into: "after:inset-0"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}), a = h(null), r = h(null);
|
|
18
|
-
function P(i) {
|
|
19
|
-
const {
|
|
20
|
-
ceiling: u = 0.8,
|
|
21
|
-
floor: n = 0.2,
|
|
22
|
-
isDraggable: f = !0,
|
|
23
|
-
isDroppable: d = !0,
|
|
24
|
-
parentIds: v = [],
|
|
25
|
-
id: l,
|
|
26
|
-
onDragStart: D,
|
|
27
|
-
onDragEnd: I
|
|
28
|
-
} = i, g = c(() => v.at(-1) ?? null), A = (t) => typeof d == "function" ? d(a.value, {
|
|
29
|
-
id: l,
|
|
30
|
-
parentId: g.value,
|
|
31
|
-
offset: t
|
|
32
|
-
}) : p(d), E = (t) => {
|
|
33
|
-
if (!p(f) || !t.dataTransfer || !(t.target instanceof HTMLElement))
|
|
34
|
-
return;
|
|
35
|
-
t.target.setAttribute("data-dragging", "true"), t.dataTransfer.dropEffect = "move", t.dataTransfer.effectAllowed = "move";
|
|
36
|
-
const e = { id: l, parentId: g.value };
|
|
37
|
-
a.value = e, D?.(e);
|
|
38
|
-
}, T = S((t) => {
|
|
39
|
-
if (!a.value || a.value.id === l || v.includes(a.value?.id ?? ""))
|
|
40
|
-
return;
|
|
41
|
-
const e = r.value?.offset, s = t.target.offsetHeight, b = n * s, m = u * s;
|
|
42
|
-
let o = null;
|
|
43
|
-
t.offsetY <= 0 && e && e !== "after" ? o = e : t.offsetY <= b ? o = "before" : t.offsetY >= m ? o = "after" : t.offsetY > b && t.offsetY < m && (o = "into"), A(o) && (r.value = { id: l, parentId: g.value, offset: o });
|
|
44
|
-
}, 25), Y = () => {
|
|
45
|
-
if (!r.value || !a.value)
|
|
46
|
-
return;
|
|
47
|
-
const t = { ...a.value }, e = { ...r.value };
|
|
48
|
-
a.value = null, r.value = null, document.querySelectorAll("[data-dragging]").forEach((s) => s.removeAttribute("data-dragging")), t.id !== e.id && I?.(t, e);
|
|
49
|
-
}, _ = c(() => {
|
|
50
|
-
const t = l === r.value?.id ? r.value.offset : void 0;
|
|
51
|
-
return t ? w({ position: t }) : "";
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
/**
|
|
55
|
-
* Props object to bind to the draggable element.
|
|
56
|
-
* Contains the class and draggable attribute.
|
|
57
|
-
*/
|
|
58
|
-
draggableAttrs: c(() => ({
|
|
59
|
-
class: _.value || void 0,
|
|
60
|
-
// Only set the draggable attribute if isDraggable is true
|
|
61
|
-
draggable: p(f) ? !0 : void 0
|
|
62
|
-
})),
|
|
63
|
-
/**
|
|
64
|
-
* Event handlers object to bind to the draggable element.
|
|
65
|
-
* Contains dragend, dragover, and dragstart handlers with proper event prevention.
|
|
66
|
-
*/
|
|
67
|
-
draggableEvents: {
|
|
68
|
-
dragend: Y,
|
|
69
|
-
dragover: (t) => {
|
|
70
|
-
t.preventDefault(), t.stopPropagation(), T(t);
|
|
71
|
-
},
|
|
72
|
-
dragstart: (t) => {
|
|
73
|
-
t.stopPropagation(), E(t);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
draggingItem: a,
|
|
77
|
-
hoveredItem: r
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
P as useDraggable
|
|
82
|
-
};
|