@cypress-design/vue-docmenu 0.4.0 → 0.4.2
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +18 -0
- package/DocMenu.vue +37 -21
- package/DocMenuVue.cy.tsx +3 -3
- package/ReadMe.md +9 -10
- package/_DocGroup.vue +60 -77
- package/_DocGroupElements.vue +97 -0
- package/_DocLink.vue +46 -4
- package/dist/DocMenu.vue.d.ts +6 -1
- package/dist/DocMenu.vue.d.ts.map +1 -1
- package/dist/_DocGroup.vue.d.ts +21 -4
- package/dist/_DocGroup.vue.d.ts.map +1 -1
- package/dist/_DocGroupElements.vue.d.ts +43 -0
- package/dist/_DocGroupElements.vue.d.ts.map +1 -0
- package/dist/_DocLink.vue.d.ts +18 -3
- package/dist/_DocLink.vue.d.ts.map +1 -1
- package/dist/index.es.mjs +219 -140
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DefineComponent } from 'vue';
|
|
2
|
+
import { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu';
|
|
3
|
+
declare function reTriggerSetActiveGroup(): void;
|
|
4
|
+
declare const _default: DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
items: (NavGroup | NavItemLink)[];
|
|
6
|
+
activePath?: string | undefined;
|
|
7
|
+
collapsible: boolean;
|
|
8
|
+
linkComponent: DefineComponent | 'a';
|
|
9
|
+
depth: number;
|
|
10
|
+
}>, {
|
|
11
|
+
reTriggerSetActiveGroup: typeof reTriggerSetActiveGroup;
|
|
12
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
updateActivePosition: (opts?: {
|
|
14
|
+
top: number;
|
|
15
|
+
height: number;
|
|
16
|
+
} | undefined) => void;
|
|
17
|
+
hideMarker: () => void;
|
|
18
|
+
updateMarkerPosition: () => void;
|
|
19
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
20
|
+
items: (NavGroup | NavItemLink)[];
|
|
21
|
+
activePath?: string | undefined;
|
|
22
|
+
collapsible: boolean;
|
|
23
|
+
linkComponent: DefineComponent | 'a';
|
|
24
|
+
depth: number;
|
|
25
|
+
}>>> & {
|
|
26
|
+
onUpdateActivePosition?: ((opts?: {
|
|
27
|
+
top: number;
|
|
28
|
+
height: number;
|
|
29
|
+
} | undefined) => any) | undefined;
|
|
30
|
+
onHideMarker?: (() => any) | undefined;
|
|
31
|
+
onUpdateMarkerPosition?: (() => any) | undefined;
|
|
32
|
+
}, {}, {}>;
|
|
33
|
+
export default _default;
|
|
34
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
35
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
36
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
37
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
38
|
+
} : {
|
|
39
|
+
type: import('vue').PropType<T[K]>;
|
|
40
|
+
required: true;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=_DocGroupElements.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_DocGroupElements.vue.d.ts","sourceRoot":"","sources":["../_DocGroupElements.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAO,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAgCzE,iBAAS,uBAAuB,SAO/B;;WAoJQ,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE;;iBAEpB,OAAO;mBACL,eAAe,GAAG,GAAG;WAC7B,MAAM;;;;;;;;;;;WAJN,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE;;iBAEpB,OAAO;mBACL,eAAe,GAAG,GAAG;WAC7B,MAAM;;;;;;;;;AAXf,wBAcG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
package/dist/_DocLink.vue.d.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DefineComponent } from 'vue';
|
|
2
2
|
import type { NavItemLink } from '@cypress-design/constants-docmenu';
|
|
3
|
+
declare function setActiveMarkerPosition(): void;
|
|
3
4
|
declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
5
|
item: NavItemLink;
|
|
6
|
+
active: boolean;
|
|
5
7
|
collapsible: boolean;
|
|
6
8
|
depth?: number | undefined;
|
|
7
9
|
linkComponent: DefineComponent | 'a';
|
|
8
10
|
}>, {
|
|
9
11
|
depth: number;
|
|
10
|
-
}>, {
|
|
12
|
+
}>, {
|
|
13
|
+
setActiveMarkerPosition: typeof setActiveMarkerPosition;
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:active": (active: boolean, opts?: {
|
|
16
|
+
top: number;
|
|
17
|
+
height: number;
|
|
18
|
+
} | undefined) => void;
|
|
19
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
11
20
|
item: NavItemLink;
|
|
21
|
+
active: boolean;
|
|
12
22
|
collapsible: boolean;
|
|
13
23
|
depth?: number | undefined;
|
|
14
24
|
linkComponent: DefineComponent | 'a';
|
|
15
25
|
}>, {
|
|
16
26
|
depth: number;
|
|
17
|
-
}
|
|
27
|
+
}>>> & {
|
|
28
|
+
"onUpdate:active"?: ((active: boolean, opts?: {
|
|
29
|
+
top: number;
|
|
30
|
+
height: number;
|
|
31
|
+
} | undefined) => any) | undefined;
|
|
32
|
+
}, {
|
|
18
33
|
depth: number;
|
|
19
34
|
}, {}>;
|
|
20
35
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_DocLink.vue.d.ts","sourceRoot":"","sources":["../_DocLink.vue.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"_DocLink.vue.d.ts","sourceRoot":"","sources":["../_DocLink.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,eAAe,EAAkB,MAAM,KAAK,CAAA;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AA2BpE,iBAAS,uBAAuB,SAU/B;;UA4HS,WAAW;YACT,OAAO;iBACF,OAAO;;mBAEL,eAAe,GAAG,GAAG;;;;;;;;;;;UAJ9B,WAAW;YACT,OAAO;iBACF,OAAO;;mBAEL,eAAe,GAAG,GAAG;;;;;;;;;WAD5B,MAAM;;AAVlB,wBAcG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,179 +1,258 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { IconChevronDownSmall as
|
|
3
|
-
const
|
|
4
|
-
button: "flex leading-[24px] py-[10px] items-center relative w-full",
|
|
1
|
+
import { defineComponent as y, ref as c, computed as B, watch as M, nextTick as G, openBlock as p, createElementBlock as d, Fragment as $, createBlock as b, resolveDynamicComponent as w, normalizeClass as k, unref as g, withCtx as S, createCommentVNode as A, createTextVNode as D, toDisplayString as T, withDirectives as U, createVNode as C, vShow as x, onMounted as H, normalizeStyle as z, renderList as R } from "vue";
|
|
2
|
+
import { IconChevronDownSmall as F } from "@cypress-design/vue-icon";
|
|
3
|
+
const P = {
|
|
4
|
+
button: "flex leading-[24px] py-[10px] items-center relative w-full text-start",
|
|
5
5
|
topButton: "leading-[24px] text-[16px] pl-[24px] font-medium",
|
|
6
6
|
leafButton: "leading-[20px] text-[14px] pl-[40px]"
|
|
7
|
-
},
|
|
8
|
-
__name: "_DocLink",
|
|
9
|
-
props: {
|
|
10
|
-
item: {},
|
|
11
|
-
collapsible: { type: Boolean },
|
|
12
|
-
depth: { default: -1 },
|
|
13
|
-
linkComponent: {}
|
|
14
|
-
},
|
|
15
|
-
setup(h) {
|
|
16
|
-
return (l, o) => (t(), p("li", {
|
|
17
|
-
class: a(["list-none p-0", {
|
|
18
|
-
"pl-[16px]": l.depth >= 0
|
|
19
|
-
}])
|
|
20
|
-
}, [
|
|
21
|
-
(t(), u(x(l.linkComponent), {
|
|
22
|
-
class: a(["group relative block w-full pl-[24px]", {
|
|
23
|
-
"text-indigo-500": l.item.active,
|
|
24
|
-
"py-[8px] text-[16px] leading-[24px]": l.depth < 0,
|
|
25
|
-
"leading-[20px] text-[14px] py-[12px]": l.depth >= 0
|
|
26
|
-
}]),
|
|
27
|
-
href: l.item.href
|
|
28
|
-
}, {
|
|
29
|
-
default: B(() => [
|
|
30
|
-
l.depth >= 0 ? (t(), p("div", {
|
|
31
|
-
key: 0,
|
|
32
|
-
class: a(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden", {
|
|
33
|
-
"group-hover:block bg-gray-300": !l.item.active && l.collapsible
|
|
34
|
-
}]),
|
|
35
|
-
style: w({
|
|
36
|
-
left: `-${18.5 + l.depth * 7.5}px`
|
|
37
|
-
})
|
|
38
|
-
}, null, 6)) : k("", !0),
|
|
39
|
-
$(" " + D(l.item.label), 1)
|
|
40
|
-
]),
|
|
41
|
-
_: 1
|
|
42
|
-
}, 8, ["class", "href"]))
|
|
43
|
-
], 2));
|
|
44
|
-
}
|
|
45
|
-
}), O = {
|
|
46
|
-
key: 0,
|
|
47
|
-
class: "relative list-none p-0"
|
|
48
|
-
}, V = /* @__PURE__ */ v({
|
|
7
|
+
}, I = /* @__PURE__ */ y({
|
|
49
8
|
__name: "_DocGroup",
|
|
50
9
|
props: {
|
|
51
10
|
group: {},
|
|
11
|
+
activePath: {},
|
|
52
12
|
collapsible: { type: Boolean },
|
|
53
13
|
linkComponent: {},
|
|
54
14
|
depth: { default: 0 }
|
|
55
15
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
class: a([
|
|
80
|
-
m(b).button,
|
|
16
|
+
emits: ["updateActivePosition", "hideMarker", "updateMarkerPosition"],
|
|
17
|
+
setup(f, { expose: v, emit: m }) {
|
|
18
|
+
const i = f, n = c(i.group.collapsed !== !0), u = c(), l = B(
|
|
19
|
+
() => i.collapsible ? "button" : i.group.href ? "a" : "div"
|
|
20
|
+
), e = m;
|
|
21
|
+
function s(t = i.group.items) {
|
|
22
|
+
return t.some((a) => "items" in a ? s(a.items) : a.href === i.activePath);
|
|
23
|
+
}
|
|
24
|
+
function o() {
|
|
25
|
+
var t;
|
|
26
|
+
(t = u.value) == null || t.reTriggerSetActiveGroup();
|
|
27
|
+
}
|
|
28
|
+
const r = B(() => i.group.href === i.activePath);
|
|
29
|
+
return M(r, (t) => {
|
|
30
|
+
t && e("hideMarker");
|
|
31
|
+
}), M(n, async (t) => {
|
|
32
|
+
await G(), s() ? t ? o() : e("hideMarker") : e("updateMarkerPosition");
|
|
33
|
+
}), v({
|
|
34
|
+
reTriggerSetActiveGroup: o
|
|
35
|
+
}), (t, a) => (p(), d($, null, [
|
|
36
|
+
(p(), b(w(l.value), {
|
|
37
|
+
class: k([
|
|
38
|
+
g(P).button,
|
|
81
39
|
{
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
"text-indigo-500":
|
|
40
|
+
[g(P).topButton]: t.depth === 0,
|
|
41
|
+
[g(P).leafButton]: t.depth,
|
|
42
|
+
"text-indigo-500": r.value
|
|
85
43
|
}
|
|
86
44
|
]),
|
|
87
|
-
href:
|
|
88
|
-
onClick:
|
|
89
|
-
|
|
45
|
+
href: t.group.href,
|
|
46
|
+
onClick: a[0] || (a[0] = () => {
|
|
47
|
+
t.collapsible ? n.value = !n.value : e("updateActivePosition");
|
|
90
48
|
})
|
|
91
49
|
}, {
|
|
92
|
-
default:
|
|
93
|
-
|
|
50
|
+
default: S(() => [
|
|
51
|
+
i.collapsible ? (p(), b(g(F), {
|
|
94
52
|
key: 0,
|
|
95
53
|
"stroke-color": "gray-400",
|
|
96
|
-
size:
|
|
97
|
-
class:
|
|
54
|
+
size: t.depth ? "8" : "16",
|
|
55
|
+
class: k(["absolute left-0 transform transition-transform", {
|
|
98
56
|
"rotate-0": n.value,
|
|
99
57
|
"-rotate-90": !n.value,
|
|
100
|
-
"ml-[16px]":
|
|
58
|
+
"ml-[16px]": t.depth
|
|
101
59
|
}])
|
|
102
|
-
}, null, 8, ["size", "class"])) :
|
|
103
|
-
|
|
60
|
+
}, null, 8, ["size", "class"])) : A("", !0),
|
|
61
|
+
D(" " + T(t.group.label), 1)
|
|
104
62
|
]),
|
|
105
63
|
_: 1
|
|
106
64
|
}, 8, ["class", "href"])),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(t(!0), p(d, null, z(e.group.items, (r) => (t(), p(d, null, [
|
|
121
|
-
r && "items" in r ? (t(), p("li", O, [
|
|
122
|
-
S(V, {
|
|
123
|
-
ref_for: !0,
|
|
124
|
-
ref_key: "$groups",
|
|
125
|
-
ref: c,
|
|
126
|
-
group: r,
|
|
127
|
-
depth: e.depth + 1,
|
|
128
|
-
collapsible: o.collapsible,
|
|
129
|
-
"link-component": o.linkComponent
|
|
130
|
-
}, null, 8, ["group", "depth", "collapsible", "link-component"])
|
|
131
|
-
])) : (t(), u(N, {
|
|
132
|
-
key: 1,
|
|
133
|
-
item: r,
|
|
134
|
-
depth: e.depth,
|
|
135
|
-
collapsible: e.collapsible,
|
|
136
|
-
"link-component": o.linkComponent
|
|
137
|
-
}, null, 8, ["item", "depth", "collapsible", "link-component"]))
|
|
138
|
-
], 64))), 256))
|
|
139
|
-
], 2), [
|
|
140
|
-
[L, n.value]
|
|
65
|
+
U(C(E, {
|
|
66
|
+
ref_key: "$groupElements",
|
|
67
|
+
ref: u,
|
|
68
|
+
depth: t.depth,
|
|
69
|
+
items: t.group.items,
|
|
70
|
+
"active-path": t.activePath,
|
|
71
|
+
collapsible: t.collapsible,
|
|
72
|
+
"link-component": t.linkComponent,
|
|
73
|
+
onHideMarker: a[1] || (a[1] = (h) => e("hideMarker")),
|
|
74
|
+
onUpdateMarkerPosition: a[2] || (a[2] = (h) => e("updateMarkerPosition")),
|
|
75
|
+
onUpdateActivePosition: a[3] || (a[3] = (h) => e("updateActivePosition", h))
|
|
76
|
+
}, null, 8, ["depth", "items", "active-path", "collapsible", "link-component"]), [
|
|
77
|
+
[x, n.value]
|
|
141
78
|
])
|
|
142
79
|
], 64));
|
|
143
80
|
}
|
|
144
|
-
}),
|
|
81
|
+
}), N = /* @__PURE__ */ y({
|
|
82
|
+
__name: "_DocLink",
|
|
83
|
+
props: {
|
|
84
|
+
item: {},
|
|
85
|
+
active: { type: Boolean },
|
|
86
|
+
collapsible: { type: Boolean },
|
|
87
|
+
depth: { default: -1 },
|
|
88
|
+
linkComponent: {}
|
|
89
|
+
},
|
|
90
|
+
emits: ["update:active"],
|
|
91
|
+
setup(f, { expose: v, emit: m }) {
|
|
92
|
+
const i = f, n = m, u = c();
|
|
93
|
+
function l() {
|
|
94
|
+
var e;
|
|
95
|
+
if (i.active) {
|
|
96
|
+
const { top: s = 0, height: o = 36 } = ((e = u.value) == null ? void 0 : e.getBoundingClientRect()) ?? {};
|
|
97
|
+
n("update:active", i.active, {
|
|
98
|
+
top: s,
|
|
99
|
+
height: o
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return H(() => {
|
|
104
|
+
M(
|
|
105
|
+
() => i.active,
|
|
106
|
+
(e) => {
|
|
107
|
+
e ? l() : n("update:active", e);
|
|
108
|
+
},
|
|
109
|
+
{ immediate: !0 }
|
|
110
|
+
);
|
|
111
|
+
}), v({
|
|
112
|
+
setActiveMarkerPosition: l
|
|
113
|
+
}), (e, s) => (p(), d("li", {
|
|
114
|
+
ref_key: "$container",
|
|
115
|
+
ref: u,
|
|
116
|
+
class: k(["list-none p-0", {
|
|
117
|
+
"pl-[16px]": e.depth >= 0
|
|
118
|
+
}])
|
|
119
|
+
}, [
|
|
120
|
+
(p(), b(w(e.linkComponent), {
|
|
121
|
+
class: k(["group relative block w-full pl-[24px]", {
|
|
122
|
+
"text-indigo-500": e.active,
|
|
123
|
+
"py-[8px] text-[16px] leading-[24px]": e.depth < 0,
|
|
124
|
+
"leading-[20px] text-[14px] py-[12px]": e.depth >= 0
|
|
125
|
+
}]),
|
|
126
|
+
href: e.item.href
|
|
127
|
+
}, {
|
|
128
|
+
default: S(() => [
|
|
129
|
+
e.depth >= 0 ? (p(), d("div", {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: k(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden", {
|
|
132
|
+
"group-hover:block bg-gray-300": !e.active && e.collapsible
|
|
133
|
+
}]),
|
|
134
|
+
style: z({
|
|
135
|
+
left: `-${18.5 + e.depth * 7.5}px`
|
|
136
|
+
})
|
|
137
|
+
}, null, 6)) : A("", !0),
|
|
138
|
+
D(" " + T(e.item.label), 1)
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, ["class", "href"]))
|
|
142
|
+
], 2));
|
|
143
|
+
}
|
|
144
|
+
}), V = {
|
|
145
145
|
key: 0,
|
|
146
146
|
class: "relative list-none p-0"
|
|
147
|
-
},
|
|
147
|
+
}, E = /* @__PURE__ */ y({
|
|
148
|
+
__name: "_DocGroupElements",
|
|
149
|
+
props: {
|
|
150
|
+
items: {},
|
|
151
|
+
activePath: {},
|
|
152
|
+
collapsible: { type: Boolean },
|
|
153
|
+
linkComponent: { type: [Object, Function, String] },
|
|
154
|
+
depth: {}
|
|
155
|
+
},
|
|
156
|
+
emits: ["updateActivePosition", "hideMarker", "updateMarkerPosition"],
|
|
157
|
+
setup(f, { expose: v, emit: m }) {
|
|
158
|
+
const i = f, n = m, u = c([]), l = c([]);
|
|
159
|
+
function e(o = i.items) {
|
|
160
|
+
return o.some((r) => "items" in r ? e(r.items) : r.href === i.activePath);
|
|
161
|
+
}
|
|
162
|
+
function s() {
|
|
163
|
+
u.value.forEach((o) => {
|
|
164
|
+
o.setActiveMarkerPosition();
|
|
165
|
+
}), l.value.forEach((o) => {
|
|
166
|
+
o.reTriggerSetActiveGroup();
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return v({
|
|
170
|
+
reTriggerSetActiveGroup: s
|
|
171
|
+
}), (o, r) => (p(), d("ul", {
|
|
172
|
+
class: k(["list-none p-0", {
|
|
173
|
+
"border-l border-gray-100": o.depth === 0 && o.collapsible,
|
|
174
|
+
"ml-[8px]": o.depth >= 0
|
|
175
|
+
}])
|
|
176
|
+
}, [
|
|
177
|
+
(p(!0), d($, null, R(o.items, (t) => (p(), d($, null, [
|
|
178
|
+
t && "items" in t ? (p(), d("li", V, [
|
|
179
|
+
C(I, {
|
|
180
|
+
ref_for: !0,
|
|
181
|
+
ref_key: "$groups",
|
|
182
|
+
ref: l,
|
|
183
|
+
"active-path": o.activePath,
|
|
184
|
+
group: t,
|
|
185
|
+
depth: o.depth + 1,
|
|
186
|
+
collapsible: o.collapsible,
|
|
187
|
+
"link-component": o.linkComponent,
|
|
188
|
+
onUpdateActivePosition: r[0] || (r[0] = (a) => {
|
|
189
|
+
n("updateActivePosition", a);
|
|
190
|
+
}),
|
|
191
|
+
onUpdateMarkerPosition: r[1] || (r[1] = () => {
|
|
192
|
+
e() ? s() : n("updateMarkerPosition");
|
|
193
|
+
})
|
|
194
|
+
}, null, 8, ["active-path", "group", "depth", "collapsible", "link-component"])
|
|
195
|
+
])) : (p(), b(N, {
|
|
196
|
+
key: 1,
|
|
197
|
+
ref_for: !0,
|
|
198
|
+
ref_key: "$items",
|
|
199
|
+
ref: u,
|
|
200
|
+
item: t,
|
|
201
|
+
active: t.href === o.activePath,
|
|
202
|
+
depth: o.depth,
|
|
203
|
+
collapsible: o.collapsible,
|
|
204
|
+
"link-component": o.linkComponent,
|
|
205
|
+
"onUpdate:active": r[2] || (r[2] = (a, h) => {
|
|
206
|
+
h && n("updateActivePosition", h);
|
|
207
|
+
})
|
|
208
|
+
}, null, 8, ["item", "active", "depth", "collapsible", "link-component"]))
|
|
209
|
+
], 64))), 256))
|
|
210
|
+
], 2));
|
|
211
|
+
}
|
|
212
|
+
}), O = /* @__PURE__ */ y({
|
|
148
213
|
__name: "DocMenu",
|
|
149
214
|
props: {
|
|
150
215
|
items: {},
|
|
216
|
+
activePath: { default: void 0 },
|
|
151
217
|
collapsible: { type: Boolean, default: !0 },
|
|
152
218
|
linkComponent: { type: [Object, Function, String], default: "a" }
|
|
153
219
|
},
|
|
154
|
-
setup(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
220
|
+
setup(f) {
|
|
221
|
+
const v = c(), m = c(0), i = c(36), n = c(!1);
|
|
222
|
+
function u({ top: l, height: e } = { height: 0, top: 0 }) {
|
|
223
|
+
var o;
|
|
224
|
+
const s = ((o = v.value) == null ? void 0 : o.getBoundingClientRect().top) || 0;
|
|
225
|
+
m.value = l - s, i.value = e, n.value = !0;
|
|
226
|
+
}
|
|
227
|
+
return (l, e) => (p(), d("div", {
|
|
228
|
+
ref_key: "$container",
|
|
229
|
+
ref: v,
|
|
230
|
+
class: "relative"
|
|
231
|
+
}, [
|
|
232
|
+
n.value && l.collapsible ? (p(), d("div", {
|
|
233
|
+
key: 0,
|
|
234
|
+
"data-cy": "doc-menu-active-marker",
|
|
235
|
+
class: "absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]",
|
|
236
|
+
style: z({
|
|
237
|
+
top: `${m.value + 4}px`,
|
|
238
|
+
height: `${i.value - 8}px`
|
|
239
|
+
})
|
|
240
|
+
}, null, 4)) : A("", !0),
|
|
241
|
+
C(E, {
|
|
242
|
+
items: l.items,
|
|
243
|
+
"active-path": l.activePath,
|
|
244
|
+
collapsible: l.collapsible,
|
|
245
|
+
"link-component": l.linkComponent,
|
|
246
|
+
depth: -1,
|
|
247
|
+
onUpdateActivePosition: u,
|
|
248
|
+
onHideMarker: e[0] || (e[0] = (s) => n.value = !1)
|
|
249
|
+
}, null, 8, ["items", "active-path", "collapsible", "link-component"])
|
|
250
|
+
], 512));
|
|
172
251
|
}
|
|
173
252
|
});
|
|
174
253
|
export {
|
|
175
|
-
|
|
254
|
+
O as default
|
|
176
255
|
};
|
|
177
256
|
//# sourceMappingURL=index.es.mjs.map
|
|
178
257
|
|
|
179
|
-
/* <wind-keep class="
|
|
258
|
+
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] list-none p-0 border-l border-gray-100 ml-[8px] text-indigo-500 left-0 transform transition-transform rotate-0 -rotate-90 ml-[16px] icon-dark-gray-400 pl-[16px] block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] h-[80%] top-[10%] z-10 hidden group-hover:block bg-gray-300 flex py-[10px] items-center text-start font-medium pl-[40px]"> */
|
package/dist/index.es.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.js","../_DocGroup.vue"],"sourcesContent":["export const classes = {\n button: 'flex leading-[24px] py-[10px] items-center relative w-full',\n topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',\n leafButton: 'leading-[20px] text-[14px] pl-[40px]',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, Ref, ref } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocLink from './_DocLink.vue'\nimport DocGroup from './_DocGroup.vue'\n\nconst props = withDefaults(\n defineProps<{\n group: NavGroup\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth?: number\n }>(),\n {\n depth: 0,\n },\n)\n\nconst open = ref(props.depth === 0)\n\nconst $groups = ref<{ height: number }[]>([])\n\nconst height = computed(() => {\n return $groups.value && open.value\n ? $groups.value.reduce(\n (acc, { height: h }) => acc + h,\n props.group.items.length,\n )\n : 0\n})\n\ndefineExpose<{\n height: Ref<number>\n}>({\n height,\n})\n\nconst activeMarkerTop = computed(() => {\n const activeIndex = props.group.items.findIndex(\n (item) => 'href' in item && item.active,\n )\n\n // how many groups are before the active element?\n let numberOfGroups = props.group.items.filter(\n (item, index) => !('href' in item) && index < activeIndex,\n ).length\n\n // if there is any open group before the active element\n // compensate for the height\n const groupHeight = $groups.value?.reduce((acc, group) => {\n if (numberOfGroups < -1) return acc\n numberOfGroups--\n return acc + group.height\n }, 0)\n return (activeIndex + groupHeight) * 44\n})\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n</script>\n\n<template>\n <component\n :is=\"Head\"\n :class=\"[\n classes.button,\n {\n [classes.topButton]: depth === 0,\n [classes.leafButton]: depth,\n 'text-indigo-500': props.group.active,\n },\n ]\"\n :href=\"props.group.href\"\n @click=\"\n () => {\n if (collapsible) {\n open = !open\n }\n }\n \"\n >\n <IconChevronDownSmall\n v-if=\"props.collapsible\"\n stroke-color=\"gray-400\"\n :size=\"depth ? '8' : '16'\"\n class=\"absolute left-0 transform transition-transform\"\n :class=\"{\n 'rotate-0': open,\n '-rotate-90': !open,\n 'ml-[16px]': depth,\n }\"\n />\n {{ group.label }}\n </component>\n <div\n v-if=\"\n props.collapsible &&\n depth >= 0 &&\n open &&\n group.items.some((item) => 'href' in item && item.active)\n \"\n class=\"absolute h-[36px] w-[4px] z-10 rounded-full bg-indigo-500 transition-all duration-300 ml-[6px] mt-[48px]\"\n :style=\"{\n top: `${activeMarkerTop}px`,\n left: `-${depth === 0 ? 0 : depth * 7.5 + 1}px`,\n }\"\n />\n <ul\n v-show=\"open\"\n class=\"list-none p-0 ml-[7.5px]\"\n :class=\"{\n 'border-l border-gray-100': depth === 0 && props.collapsible,\n }\"\n >\n <template v-for=\"item in group.items\">\n <li class=\"relative list-none p-0\" v-if=\"item && 'items' in item\">\n <DocGroup\n ref=\"$groups\"\n :group=\"item\"\n :depth=\"depth + 1\"\n :collapsible=\"props.collapsible\"\n :link-component=\"props.linkComponent\"\n />\n </li>\n <DocLink\n v-else\n :item=\"item\"\n :depth=\"depth\"\n :collapsible=\"collapsible\"\n :link-component=\"props.linkComponent\"\n />\n </template>\n </ul>\n</template>\n"],"names":["classes","props","__props","open","ref","$groups","height","computed","acc","h","__expose","activeMarkerTop","activeIndex","item","numberOfGroups","index","groupHeight","_a","group","Head"],"mappings":";;AAAO,MAAMA,IAAU;AAAA,EACnB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACGA,UAAMC,IAAQC,GAYRC,IAAOC,EAAIH,EAAM,UAAU,CAAC,GAE5BI,IAAUD,EAA0B,CAAA,CAAE,GAEtCE,IAASC,EAAS,MACfF,EAAQ,SAASF,EAAK,QACzBE,EAAQ,MAAM;AAAA,MACZ,CAACG,GAAK,EAAE,QAAQC,QAAQD,IAAMC;AAAA,MAC9BR,EAAM,MAAM,MAAM;AAAA,IAEpB,IAAA,CACL;AAIE,IAAAS,EAAA;AAAA,MACD,QAAAJ;AAAA,IAAA,CACD;AAEK,UAAAK,IAAkBJ,EAAS,MAAM;;AAC/B,YAAAK,IAAcX,EAAM,MAAM,MAAM;AAAA,QACpC,CAACY,MAAS,UAAUA,KAAQA,EAAK;AAAA,MAAA;AAI/B,UAAAC,IAAiBb,EAAM,MAAM,MAAM;AAAA,QACrC,CAACY,GAAME,MAAU,EAAE,UAAUF,MAASE,IAAQH;AAAA,MAC9C,EAAA;AAIF,YAAMI,KAAcC,IAAAZ,EAAQ,UAAR,gBAAAY,EAAe,OAAO,CAACT,GAAKU,MAC1CJ,IAAiB,KAAWN,KAChCM,KACON,IAAMU,EAAM,SAClB;AACH,cAAQN,IAAcI,KAAe;AAAA,IAAA,CACtC,GAEKG,IAAOZ;AAAA,MAAS,MACpBN,EAAM,cAAc,WAAWA,EAAM,MAAM,OAAO,MAAM;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.es.mjs","sources":["../../constants/dist/index.js","../_DocGroup.vue","../_DocLink.vue","../_DocGroupElements.vue","../DocMenu.vue"],"sourcesContent":["export const classes = {\n button: 'flex leading-[24px] py-[10px] items-center relative w-full text-start',\n topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',\n leafButton: 'leading-[20px] text-[14px] pl-[40px]',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, nextTick } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements from './_DocGroupElements.vue'\n\nconst props = withDefaults(\n defineProps<{\n group: NavGroup\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth?: number\n }>(),\n {\n depth: 0,\n },\n)\n\nconst open = ref(props.group.collapsed !== true)\nconst $groupElements = ref<typeof DocGroupElements>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<{\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n (event: 'hideMarker'): void\n (event: 'updateMarkerPosition'): void\n}>()\n\nfunction hasActiveItemRecursively(items = props.group.items): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items)\n }\n return item.href === props.activePath\n })\n}\n\nfunction reTriggerSetActiveGroup() {\n $groupElements.value?.reTriggerSetActiveGroup()\n}\n\nconst active = computed(() => props.group.href === props.activePath)\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, async (open) => {\n await nextTick()\n if (hasActiveItemRecursively()) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <component\n :is=\"Head\"\n :class=\"[\n classes.button,\n {\n [classes.topButton]: depth === 0,\n [classes.leafButton]: depth,\n 'text-indigo-500': active,\n },\n ]\"\n :href=\"group.href\"\n @click=\"\n () => {\n if (collapsible) {\n open = !open\n } else {\n emit('updateActivePosition')\n }\n }\n \"\n >\n <IconChevronDownSmall\n v-if=\"props.collapsible\"\n stroke-color=\"gray-400\"\n :size=\"depth ? '8' : '16'\"\n class=\"absolute left-0 transform transition-transform\"\n :class=\"{\n 'rotate-0': open,\n '-rotate-90': !open,\n 'ml-[16px]': depth,\n }\"\n />\n {{ group.label }}\n </component>\n <DocGroupElements\n ref=\"$groupElements\"\n v-show=\"open\"\n :depth=\"depth\"\n :items=\"group.items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @hide-marker=\"emit('hideMarker')\"\n @update-marker-position=\"emit('updateMarkerPosition')\"\n @update-active-position=\"(opts) => emit('updateActivePosition', opts)\"\n />\n</template>\n","<script lang=\"ts\" setup>\nimport { watch, type DefineComponent, ref, onMounted } from 'vue'\nimport type { NavItemLink } from '@cypress-design/constants-docmenu'\n\nconst props = withDefaults(\n defineProps<{\n item: NavItemLink\n active: boolean\n collapsible: boolean\n depth?: number\n linkComponent: DefineComponent | 'a'\n }>(),\n {\n depth: -1,\n },\n)\n\nconst emit = defineEmits<{\n (\n event: 'update:active',\n active: boolean,\n opts?: { top: number; height: number },\n ): void\n}>()\n\nconst $container = ref<HTMLLIElement>()\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n const { top = 0, height = 36 } =\n $container.value?.getBoundingClientRect() ?? {}\n\n emit('update:active', props.active, {\n top,\n height,\n })\n }\n}\n\nonMounted(() => {\n watch(\n () => props.active,\n (active) => {\n if (active) {\n setActiveMarkerPosition()\n } else {\n emit('update:active', active)\n }\n },\n { immediate: true },\n )\n})\n\ndefineExpose({\n setActiveMarkerPosition,\n})\n</script>\n\n<template>\n <li\n ref=\"$container\"\n class=\"list-none p-0\"\n :class=\"{\n 'pl-[16px]': depth >= 0,\n }\"\n >\n <component\n :is=\"linkComponent\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500': active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :href=\"item.href\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden\"\n :class=\"{\n 'group-hover:block bg-gray-300': !active && collapsible,\n }\"\n :style=\"{\n left: `-${18.5 + depth * 7.5}px`,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\" setup>\nimport { DefineComponent, ref } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroup from './_DocGroup.vue'\nimport DocLink from './_DocLink.vue'\n\nconst props = defineProps<{\n items: (NavGroup | NavItemLink)[]\n activePath?: string\n collapsible: boolean\n linkComponent: DefineComponent | 'a'\n depth: number\n}>()\n\nconst emit = defineEmits<{\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n (event: 'hideMarker'): void\n (event: 'updateMarkerPosition'): void\n}>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nfunction hasActiveItemRecursively(items = props.items): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items)\n }\n return item.href === props.activePath\n })\n}\n\nfunction reTriggerSetActiveGroup() {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n $groups.value.forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul\n class=\"list-none p-0\"\n :class=\"{\n 'border-l border-gray-100': depth === 0 && collapsible,\n 'ml-[8px]': depth >= 0,\n }\"\n >\n <template v-for=\"item in items\">\n <li class=\"relative list-none p-0\" v-if=\"item && 'items' in item\">\n <DocGroup\n ref=\"$groups\"\n :active-path=\"activePath\"\n :group=\"item\"\n :depth=\"depth + 1\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update-active-position=\"\n (opts) => {\n emit('updateActivePosition', opts)\n }\n \"\n @update-marker-position=\"\n () => {\n if (hasActiveItemRecursively()) {\n reTriggerSetActiveGroup()\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n />\n </li>\n <DocLink\n v-else\n ref=\"$items\"\n :item=\"item\"\n :active=\"item.href === activePath\"\n :depth=\"depth\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n @update:active=\"\n (_, opts) => {\n if (!opts) return\n emit('updateActivePosition', opts)\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent } from 'vue'\nimport { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu'\nimport DocGroupElements from './_DocGroupElements.vue'\n\nwithDefaults(\n defineProps<{\n items: (NavItemLink | NavGroup)[]\n activePath?: string\n collapsible?: boolean\n linkComponent?: DefineComponent | 'a'\n }>(),\n {\n linkComponent: 'a',\n collapsible: true,\n activePath: undefined,\n },\n)\n\nconst $container = ref<HTMLDivElement>()\n\nconst activeTop = ref(0)\nconst activeHeight = ref(36)\nconst showMarker = ref(false)\n\nfunction updateActiveMarkerPosition({ top, height } = { height: 0, top: 0 }) {\n const containerTop = $container.value?.getBoundingClientRect().top || 0\n activeTop.value = top - containerTop\n activeHeight.value = height\n showMarker.value = true\n}\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible\"\n data-cy=\"doc-menu-active-marker\"\n class=\"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]\"\n :style=\"{\n top: `${activeTop + 4}px`,\n height: `${activeHeight - 8}px`,\n }\"\n />\n <DocGroupElements\n :items=\"items\"\n :active-path=\"activePath\"\n :collapsible=\"collapsible\"\n :link-component=\"linkComponent\"\n :depth=\"-1\"\n @update-active-position=\"updateActiveMarkerPosition\"\n @hide-marker=\"showMarker = false\"\n />\n </div>\n</template>\n"],"names":["classes","props","__props","open","ref","$groupElements","Head","computed","emit","__emit","hasActiveItemRecursively","items","item","reTriggerSetActiveGroup","_a","active","watch","nextTick","__expose","$container","setActiveMarkerPosition","top","height","onMounted","$items","$groups","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop"],"mappings":"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"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,k){typeof exports=="object"&&typeof module<"u"?module.exports=k(require("vue"),require("@cypress-design/vue-icon")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/vue-icon"],k):(e=typeof globalThis<"u"?globalThis:e||self,e.DocMenu=k(e.Vue,e.CyIcon))})(this,function(e,k){"use strict";const h={button:"flex leading-[24px] py-[10px] items-center relative w-full text-start",topButton:"leading-[24px] text-[16px] pl-[24px] font-medium",leafButton:"leading-[20px] text-[14px] pl-[40px]"},y=e.defineComponent({__name:"_DocGroup",props:{group:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{default:0}},emits:["updateActivePosition","hideMarker","updateMarkerPosition"],setup(f,{expose:d,emit:m}){const i=f,l=e.ref(i.group.collapsed!==!0),c=e.ref(),r=e.computed(()=>i.collapsible?"button":i.group.href?"a":"div"),t=m;function s(o=i.group.items){return o.some(a=>"items"in a?s(a.items):a.href===i.activePath)}function n(){var o;(o=c.value)==null||o.reTriggerSetActiveGroup()}const p=e.computed(()=>i.group.href===i.activePath);return e.watch(p,o=>{o&&t("hideMarker")}),e.watch(l,async o=>{await e.nextTick(),s()?o?n():t("hideMarker"):t("updateMarkerPosition")}),d({reTriggerSetActiveGroup:n}),(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{class:e.normalizeClass([e.unref(h).button,{[e.unref(h).topButton]:o.depth===0,[e.unref(h).leafButton]:o.depth,"text-indigo-500":p.value}]),href:o.group.href,onClick:a[0]||(a[0]=()=>{o.collapsible?l.value=!l.value:t("updateActivePosition")})},{default:e.withCtx(()=>[i.collapsible?(e.openBlock(),e.createBlock(e.unref(k.IconChevronDownSmall),{key:0,"stroke-color":"gray-400",size:o.depth?"8":"16",class:e.normalizeClass(["absolute left-0 transform transition-transform",{"rotate-0":l.value,"-rotate-90":!l.value,"ml-[16px]":o.depth}])},null,8,["size","class"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.group.label),1)]),_:1},8,["class","href"])),e.withDirectives(e.createVNode(g,{ref_key:"$groupElements",ref:c,depth:o.depth,items:o.group.items,"active-path":o.activePath,collapsible:o.collapsible,"link-component":o.linkComponent,onHideMarker:a[1]||(a[1]=u=>t("hideMarker")),onUpdateMarkerPosition:a[2]||(a[2]=u=>t("updateMarkerPosition")),onUpdateActivePosition:a[3]||(a[3]=u=>t("updateActivePosition",u))},null,8,["depth","items","active-path","collapsible","link-component"]),[[e.vShow,l.value]])],64))}}),b=e.defineComponent({__name:"_DocLink",props:{item:{},active:{type:Boolean},collapsible:{type:Boolean},depth:{default:-1},linkComponent:{}},emits:["update:active"],setup(f,{expose:d,emit:m}){const i=f,l=m,c=e.ref();function r(){var t;if(i.active){const{top:s=0,height:n=36}=((t=c.value)==null?void 0:t.getBoundingClientRect())??{};l("update:active",i.active,{top:s,height:n})}}return e.onMounted(()=>{e.watch(()=>i.active,t=>{t?r():l("update:active",t)},{immediate:!0})}),d({setActiveMarkerPosition:r}),(t,s)=>(e.openBlock(),e.createElementBlock("li",{ref_key:"$container",ref:c,class:e.normalizeClass(["list-none p-0",{"pl-[16px]":t.depth>=0}])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkComponent),{class:e.normalizeClass(["group relative block w-full pl-[24px]",{"text-indigo-500":t.active,"py-[8px] text-[16px] leading-[24px]":t.depth<0,"leading-[20px] text-[14px] py-[12px]":t.depth>=0}]),href:t.item.href},{default:e.withCtx(()=>[t.depth>=0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["absolute h-[80%] top-[10%] w-[4px] z-10 rounded-full hidden",{"group-hover:block bg-gray-300":!t.active&&t.collapsible}]),style:e.normalizeStyle({left:`-${18.5+t.depth*7.5}px`})},null,6)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.item.label),1)]),_:1},8,["class","href"]))],2))}}),B={key:0,class:"relative list-none p-0"},g=e.defineComponent({__name:"_DocGroupElements",props:{items:{},activePath:{},collapsible:{type:Boolean},linkComponent:{type:[Object,Function,String]},depth:{}},emits:["updateActivePosition","hideMarker","updateMarkerPosition"],setup(f,{expose:d,emit:m}){const i=f,l=m,c=e.ref([]),r=e.ref([]);function t(n=i.items){return n.some(p=>"items"in p?t(p.items):p.href===i.activePath)}function s(){c.value.forEach(n=>{n.setActiveMarkerPosition()}),r.value.forEach(n=>{n.reTriggerSetActiveGroup()})}return d({reTriggerSetActiveGroup:s}),(n,p)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["list-none p-0",{"border-l border-gray-100":n.depth===0&&n.collapsible,"ml-[8px]":n.depth>=0}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[o&&"items"in o?(e.openBlock(),e.createElementBlock("li",B,[e.createVNode(y,{ref_for:!0,ref_key:"$groups",ref:r,"active-path":n.activePath,group:o,depth:n.depth+1,collapsible:n.collapsible,"link-component":n.linkComponent,onUpdateActivePosition:p[0]||(p[0]=a=>{l("updateActivePosition",a)}),onUpdateMarkerPosition:p[1]||(p[1]=()=>{t()?s():l("updateMarkerPosition")})},null,8,["active-path","group","depth","collapsible","link-component"])])):(e.openBlock(),e.createBlock(b,{key:1,ref_for:!0,ref_key:"$items",ref:c,item:o,active:o.href===n.activePath,depth:n.depth,collapsible:n.collapsible,"link-component":n.linkComponent,"onUpdate:active":p[2]||(p[2]=(a,u)=>{u&&l("updateActivePosition",u)})},null,8,["item","active","depth","collapsible","link-component"]))],64))),256))],2))}});return e.defineComponent({__name:"DocMenu",props:{items:{},activePath:{default:void 0},collapsible:{type:Boolean,default:!0},linkComponent:{type:[Object,Function,String],default:"a"}},setup(f){const d=e.ref(),m=e.ref(0),i=e.ref(36),l=e.ref(!1);function c({top:r,height:t}={height:0,top:0}){var n;const s=((n=d.value)==null?void 0:n.getBoundingClientRect().top)||0;m.value=r-s,i.value=t,l.value=!0}return(r,t)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"$container",ref:d,class:"relative"},[l.value&&r.collapsible?(e.openBlock(),e.createElementBlock("div",{key:0,"data-cy":"doc-menu-active-marker",class:"absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px]",style:e.normalizeStyle({top:`${m.value+4}px`,height:`${i.value-8}px`})},null,4)):e.createCommentVNode("",!0),e.createVNode(g,{items:r.items,"active-path":r.activePath,collapsible:r.collapsible,"link-component":r.linkComponent,depth:-1,onUpdateActivePosition:c,onHideMarker:t[0]||(t[0]=s=>l.value=!1)},null,8,["items","active-path","collapsible","link-component"])],512))}})});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
|
3
3
|
|
|
4
|
-
/* <wind-keep class="
|
|
4
|
+
/* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 transition-all duration-300 ml-[6.5px] mt-[4px] list-none p-0 border-l border-gray-100 ml-[8px] text-indigo-500 left-0 transform transition-transform rotate-0 -rotate-90 ml-[16px] icon-dark-gray-400 pl-[16px] block w-full pl-[24px] py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] h-[80%] top-[10%] z-10 hidden group-hover:block bg-gray-300 flex py-[10px] items-center text-start font-medium pl-[40px]"> */
|