@cypress-design/vue-docmenu 0.6.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,13 @@ $ yarn build:module && yarn build:types
2
2
  $ yarn vite build
3
3
  $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
4
4
  The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
5
- vite v5.0.12 building for production...
5
+ vite v5.2.12 building for production...
6
6
  transforming...
7
7
  ✓ 10 modules transformed.
8
8
  rendering chunks...
9
9
  computing gzip size...
10
- dist/index.es.mjs 11.81 kB │ gzip: 3.45 kB │ map: 17.02 kB
11
- dist/index.umd.js 9.17 kB │ gzip: 2.96 kB │ map: 16.55 kB
12
- ✓ built in 3.21s
10
+ dist/index.es.mjs 11.90 kB │ gzip: 3.47 kB │ map: 17.14 kB
11
+ dist/index.umd.js 9.22 kB │ gzip: 2.98 kB │ map: 16.67 kB
12
+ ✓ built in 4.41s
13
13
  $ yarn vue-tsc --project ./tsconfig.build.json
14
14
  $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vue-tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @cypress-design/vue-docmenu
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87) Thanks [@elevatebart](https://github.com/elevatebart)! - Create 1.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87)]:
12
+ - @cypress-design/constants-docmenu@1.0.0
13
+ - @cypress-design/vue-icon@1.0.0
14
+
15
+ ## 0.6.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`ad32042`](https://github.com/cypress-io/cypress-design/commit/ad3204289730de696c9728b1343e06ce68382561) Thanks [@elevatebart](https://github.com/elevatebart)! - only skip scrolling if both dimension are in view
20
+
3
21
  ## 0.6.0
4
22
 
5
23
  ### Minor Changes
package/DocMenuVue.cy.tsx CHANGED
@@ -111,7 +111,7 @@ describe('<DocMenu/>', () => {
111
111
  ))
112
112
  })
113
113
 
114
- it.only('scrolls the active item into view', { viewportHeight: 200 }, () => {
114
+ it('scrolls the active item into view', { viewportHeight: 200 }, () => {
115
115
  const CustomLinkVue: DefineComponent<{ href: StringConstructor }> =
116
116
  defineComponent({
117
117
  props: {
@@ -127,7 +127,7 @@ describe('<DocMenu/>', () => {
127
127
  const pathState = ref('/fooTop')
128
128
  const SUT = () => {
129
129
  return (
130
- <>
130
+ <div class="p-4">
131
131
  <button
132
132
  onClick={() => (pathState.value = '/faa6')}
133
133
  class="p-2 m-2 rounded bg-gray-100 border border-gray-300"
@@ -140,7 +140,7 @@ describe('<DocMenu/>', () => {
140
140
  linkComponent={CustomLinkVue}
141
141
  collapsible
142
142
  />
143
- </>
143
+ </div>
144
144
  )
145
145
  }
146
146
  mount(() => <SUT />)
@@ -148,6 +148,7 @@ describe('<DocMenu/>', () => {
148
148
  cy.findByText('Code').click()
149
149
 
150
150
  cy.contains('Set path to').click()
151
+ cy.wait(200)
151
152
  cy.contains('Quisquam, quos').then(($el) => {
152
153
  const windowInnerHeight = Cypress.config(`viewportHeight`)
153
154
 
package/_DocGroup.vue CHANGED
@@ -124,8 +124,8 @@ defineExpose({
124
124
  {{ group.label }}
125
125
  </component>
126
126
  <div
127
- class="grid transition-all relative"
128
127
  ref="$listWrapper"
128
+ class="grid transition-all relative"
129
129
  :class="{
130
130
  'grid-rows-[0fr]': !open && collapsible,
131
131
  'grid-rows-[1fr]': open || !collapsible,
@@ -88,7 +88,7 @@ defineExpose({
88
88
  <template>
89
89
  <ul class="list-none p-0">
90
90
  <template v-for="(item, index) in items">
91
- <li class="relative list-none p-0" v-if="item && 'items' in item">
91
+ <li v-if="item && 'items' in item" class="relative list-none p-0">
92
92
  <DocGroup
93
93
  ref="$groups"
94
94
  :active-path="activePath"
package/_DocLink.vue CHANGED
@@ -70,24 +70,27 @@ defineExpose({
70
70
  watch(
71
71
  () => props.active,
72
72
  (active) => {
73
- if (active && $container.value) {
74
- // if active check if the item is visible in the
75
- // viewport and scrollIntoView if not
76
- const rect = $container.value.getBoundingClientRect()
73
+ setTimeout(() => {
74
+ if (active && $container.value) {
75
+ // if active check if the item is visible in the
76
+ // viewport and scrollIntoView if not
77
+ const rect = $container.value.getBoundingClientRect()
77
78
 
78
- if (rect.top > 0 && rect.bottom < window.innerHeight) {
79
- return
80
- }
79
+ if (
80
+ rect.top > 0 &&
81
+ rect.bottom < window.innerHeight &&
82
+ rect.left > 0 &&
83
+ rect.right < window.innerWidth
84
+ ) {
85
+ return
86
+ }
81
87
 
82
- if (rect.left > 0 && rect.right < window.innerWidth) {
83
- return
88
+ $container.value.scrollIntoView({
89
+ block: 'nearest',
90
+ inline: 'nearest',
91
+ })
84
92
  }
85
-
86
- $container.value.scrollIntoView({
87
- block: 'nearest',
88
- inline: 'nearest',
89
- })
90
- }
93
+ }, 200)
91
94
  },
92
95
  )
93
96
 
@@ -99,7 +102,7 @@ const itemWithoutLabel = computed(() => {
99
102
  </script>
100
103
 
101
104
  <template>
102
- <li ref="$container" class="list-none p-0">
105
+ <li ref="$container" class="list-none p-0 scroll-my-10">
103
106
  <component
104
107
  :is="linkComponent"
105
108
  v-bind="itemWithoutLabel"
@@ -1,7 +1,7 @@
1
1
  import { type DefineComponent } from 'vue';
2
2
  import { NavGroup, NavItemLink } from '@cypress-design/constants-docmenu';
3
- declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
- items: (NavItemLink | NavGroup)[];
3
+ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
4
+ items: (NavGroup | NavItemLink)[];
5
5
  activePath?: string | undefined;
6
6
  collapsible?: boolean | undefined;
7
7
  linkComponent?: DefineComponent | "a" | undefined;
@@ -9,8 +9,8 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
9
9
  linkComponent: string;
10
10
  collapsible: boolean;
11
11
  activePath: undefined;
12
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
13
- items: (NavItemLink | NavGroup)[];
12
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
13
+ items: (NavGroup | NavItemLink)[];
14
14
  activePath?: string | undefined;
15
15
  collapsible?: boolean | undefined;
16
16
  linkComponent?: DefineComponent | "a" | undefined;
@@ -21,18 +21,10 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
21
21
  }>>>, {
22
22
  activePath: string;
23
23
  collapsible: boolean;
24
- linkComponent: DefineComponent | 'a';
24
+ linkComponent: DefineComponent | "a";
25
25
  }, {}>;
26
26
  export default _default;
27
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
- type __VLS_TypePropsToRuntimeProps<T> = {
29
- [K in keyof T]-?: {} extends Pick<T, K> ? {
30
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
- } : {
32
- type: import('vue').PropType<T[K]>;
33
- required: true;
34
- };
35
- };
27
+
36
28
  type __VLS_WithDefaults<P, D> = {
37
29
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
38
30
  default: D[K];
@@ -41,4 +33,13 @@ type __VLS_WithDefaults<P, D> = {
41
33
  type __VLS_Prettify<T> = {
42
34
  [K in keyof T]: T[K];
43
35
  } & {};
36
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
+ type __VLS_TypePropsToOption<T> = {
38
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
39
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
40
+ } : {
41
+ type: import('vue').PropType<T[K]>;
42
+ required: true;
43
+ };
44
+ };
44
45
  //# sourceMappingURL=DocMenu.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocMenu.vue.d.ts","sourceRoot":"","sources":["../DocMenu.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,eAAe,EAAW,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;;WA8I9D,CAAC,WAAW,GAAG,QAAQ,CAAC,EAAE;;;;;;;;;WAA1B,CAAC,WAAW,GAAG,QAAQ,CAAC,EAAE;;;;;;;;;gBACpB,MAAM;iBACL,OAAO;mBACL,eAAe,GAAG,GAAG;;AATzC,wBAWG;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,C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AQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { type DefineComponent } from 'vue';
2
2
  import { NavGroup } from '@cypress-design/constants-docmenu';
3
3
  declare function reTriggerSetActiveGroup(): void;
4
- declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
+ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
5
5
  group: NavGroup;
6
6
  activePath?: string | undefined;
7
7
  collapsible: boolean;
8
- linkComponent: DefineComponent | 'a';
8
+ linkComponent: DefineComponent | "a";
9
9
  depth?: number | undefined;
10
10
  }>, {
11
11
  depth: number;
@@ -18,11 +18,11 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
18
18
  } | undefined) => void;
19
19
  updateMarkerPosition: () => void;
20
20
  hideMarker: () => void;
21
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
21
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
22
22
  group: NavGroup;
23
23
  activePath?: string | undefined;
24
24
  collapsible: boolean;
25
- linkComponent: DefineComponent | 'a';
25
+ linkComponent: DefineComponent | "a";
26
26
  depth?: number | undefined;
27
27
  }>, {
28
28
  depth: number;
@@ -37,15 +37,6 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
37
37
  depth: number;
38
38
  }, {}>;
39
39
  export default _default;
40
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
41
- type __VLS_TypePropsToRuntimeProps<T> = {
42
- [K in keyof T]-?: {} extends Pick<T, K> ? {
43
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
44
- } : {
45
- type: import('vue').PropType<T[K]>;
46
- required: true;
47
- };
48
- };
49
40
  type __VLS_WithDefaults<P, D> = {
50
41
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
51
42
  default: D[K];
@@ -54,4 +45,13 @@ type __VLS_WithDefaults<P, D> = {
54
45
  type __VLS_Prettify<T> = {
55
46
  [K in keyof T]: T[K];
56
47
  } & {};
48
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
49
+ type __VLS_TypePropsToOption<T> = {
50
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
51
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
52
+ } : {
53
+ type: import('vue').PropType<T[K]>;
54
+ required: true;
55
+ };
56
+ };
57
57
  //# sourceMappingURL=_DocGroup.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_DocGroup.vue.d.ts","sourceRoot":"","sources":["../_DocGroup.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,eAAe,EAAsB,MAAM,KAAK,CAAA;AAExE,OAAO,EAAE,QAAQ,EAAW,MAAM,mCAAmC,CAAA;AAwCrE,iBAAS,uBAAuB,SAE/B;;WA0QU,QAAQ;;iBAEF,OAAO;mBACL,eAAe,GAAG,GAAG;;;;;;;;;;;;;;WAH7B,QAAQ;;iBAEF,OAAO;mBACL,eAAe,GAAG,GAAG;;;;;;;;;;;;WAC5B,MAAM;;AAXlB,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,OA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KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -20,7 +20,7 @@ export interface DocGroupEventsEmitted {
20
20
  */
21
21
  (event: 'hideMarker'): void;
22
22
  }
23
- declare const _default: DefineComponent<__VLS_TypePropsToRuntimeProps<{
23
+ declare const _default: DefineComponent<__VLS_TypePropsToOption<{
24
24
  items: (NavGroup | NavItemLink)[];
25
25
  activePath?: string | undefined;
26
26
  collapsible: boolean;
@@ -35,7 +35,7 @@ declare const _default: DefineComponent<__VLS_TypePropsToRuntimeProps<{
35
35
  } | undefined) => void;
36
36
  updateMarkerPosition: () => void;
37
37
  hideMarker: () => void;
38
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
38
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
39
39
  items: (NavGroup | NavItemLink)[];
40
40
  activePath?: string | undefined;
41
41
  collapsible: boolean;
@@ -51,7 +51,7 @@ declare const _default: DefineComponent<__VLS_TypePropsToRuntimeProps<{
51
51
  }, {}, {}>;
52
52
  export default _default;
53
53
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
54
- type __VLS_TypePropsToRuntimeProps<T> = {
54
+ type __VLS_TypePropsToOption<T> = {
55
55
  [K in keyof T]-?: {} extends Pick<T, K> ? {
56
56
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
57
57
  } : {
@@ -1 +1 @@
1
- {"version":3,"file":"_DocGroupElements.vue.d.ts","sourceRoot":"","sources":["../_DocGroupElements.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAiB,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAMzE,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,EACjC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAOT;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,CAAC,KAAK,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC7E;;;OAGG;IACH,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAA;IACrC;;OAEG;IACH,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;CAC5B;;WAyMQ,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;;;;;;;;;AA5Mf,wBAgNI;AAAA,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACrE,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,OA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,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { type DefineComponent } from 'vue';
2
2
  import type { NavItemLink } from '@cypress-design/constants-docmenu';
3
3
  declare function setActiveMarkerPosition(): void;
4
- declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
+ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
5
5
  item: NavItemLink;
6
6
  active: boolean;
7
7
  collapsible: boolean;
8
8
  depth?: number | undefined;
9
- linkComponent: DefineComponent | 'a';
9
+ linkComponent: DefineComponent | "a";
10
10
  }>, {
11
11
  depth: number;
12
12
  }>, {
@@ -16,12 +16,12 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
16
16
  top: number;
17
17
  height: number;
18
18
  } | undefined) => void;
19
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
19
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
20
20
  item: NavItemLink;
21
21
  active: boolean;
22
22
  collapsible: boolean;
23
23
  depth?: number | undefined;
24
- linkComponent: DefineComponent | 'a';
24
+ linkComponent: DefineComponent | "a";
25
25
  }>, {
26
26
  depth: number;
27
27
  }>>> & {
@@ -33,15 +33,6 @@ declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRunt
33
33
  depth: number;
34
34
  }, {}>;
35
35
  export default _default;
36
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
- type __VLS_TypePropsToRuntimeProps<T> = {
38
- [K in keyof T]-?: {} extends Pick<T, K> ? {
39
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
40
- } : {
41
- type: import('vue').PropType<T[K]>;
42
- required: true;
43
- };
44
- };
45
36
  type __VLS_WithDefaults<P, D> = {
46
37
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
47
38
  default: D[K];
@@ -50,4 +41,13 @@ type __VLS_WithDefaults<P, D> = {
50
41
  type __VLS_Prettify<T> = {
51
42
  [K in keyof T]: T[K];
52
43
  } & {};
44
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
45
+ type __VLS_TypePropsToOption<T> = {
46
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
47
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
48
+ } : {
49
+ type: import('vue').PropType<T[K]>;
50
+ required: true;
51
+ };
52
+ };
53
53
  //# sourceMappingURL=_DocLink.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_DocLink.vue.d.ts","sourceRoot":"","sources":["../_DocLink.vue.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EAMrB,MAAM,KAAK,CAAA;AACZ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AA6BpE,iBAAS,uBAAuB,SAY/B;;UA2JS,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,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,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AAExD,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
package/dist/index.es.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as C, ref as d, computed as y, inject as T, watch as P, openBlock as p, createElementBlock as f, Fragment as w, createBlock as $, resolveDynamicComponent as D, normalizeClass as b, unref as h, normalizeStyle as B, withCtx as E, createCommentVNode as A, createTextVNode as G, toDisplayString as S, createElementVNode as z, createVNode as x, onMounted as H, mergeProps as V, nextTick as N, renderList as R, provide as W } from "vue";
1
+ import { defineComponent as C, ref as d, computed as y, inject as L, watch as P, openBlock as p, createElementBlock as f, Fragment as w, createBlock as $, resolveDynamicComponent as D, normalizeClass as b, unref as h, normalizeStyle as B, withCtx as E, createCommentVNode as A, createTextVNode as G, toDisplayString as S, createElementVNode as z, createVNode as x, onMounted as H, mergeProps as V, nextTick as N, renderList as R, provide as W } from "vue";
2
2
  import { IconChevronDownSmall as j } from "@cypress-design/vue-icon";
3
3
  const k = {
4
4
  expandedIcon: "absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700",
@@ -19,18 +19,18 @@ const k = {
19
19
  setup(g, { expose: c, emit: v }) {
20
20
  const o = g, i = d(o.group.collapsed !== !0), u = d(), m = d(), s = y(
21
21
  () => o.collapsible ? "button" : o.group.href ? "a" : "div"
22
- ), l = v, e = y(
23
- () => o.group.items.some((t) => "items" in t ? I(t.items, o.activePath) : t.href === o.activePath)
22
+ ), a = v, e = y(
23
+ () => o.group.items.some((t) => "items" in t ? T(t.items, o.activePath) : t.href === o.activePath)
24
24
  );
25
25
  function n() {
26
26
  var t;
27
27
  (t = u.value) == null || t.reTriggerSetActiveGroup();
28
28
  }
29
- const a = y(() => o.group.href === o.activePath), M = T("transition-is-moving", d(!1));
30
- return P(a, (t) => {
31
- t && l("hideMarker");
29
+ const l = y(() => o.group.href === o.activePath), M = L("transition-is-moving", d(!1));
30
+ return P(l, (t) => {
31
+ t && a("hideMarker");
32
32
  }), P(i, (t) => {
33
- e.value ? t ? n() : l("hideMarker") : l("updateMarkerPosition");
33
+ e.value ? t ? n() : a("hideMarker") : a("updateMarkerPosition");
34
34
  }), P(
35
35
  () => o.activePath,
36
36
  () => {
@@ -45,9 +45,9 @@ const k = {
45
45
  {
46
46
  [h(k).topButton]: t.depth === 0,
47
47
  [h(k).leafButton]: t.depth,
48
- "text-indigo-500 dark:text-indigo-400": a.value,
49
- "text-gray-900 dark:text-gray-100": e.value && !a.value,
50
- "text-gray-800 dark:text-gray-200": !e.value && !a.value
48
+ "text-indigo-500 dark:text-indigo-400": l.value,
49
+ "text-gray-900 dark:text-gray-100": e.value && !l.value,
50
+ "text-gray-800 dark:text-gray-200": !e.value && !l.value
51
51
  }
52
52
  ]),
53
53
  style: B({
@@ -55,7 +55,7 @@ const k = {
55
55
  }),
56
56
  href: t.group.href,
57
57
  onClick: r[0] || (r[0] = () => {
58
- t.collapsible ? i.value = !i.value : l("updateActivePosition");
58
+ t.collapsible ? i.value = !i.value : a("updateActivePosition");
59
59
  })
60
60
  }, {
61
61
  default: E(() => [
@@ -79,17 +79,17 @@ const k = {
79
79
  _: 1
80
80
  }, 8, ["class", "style", "href"])),
81
81
  z("div", {
82
+ ref_key: "$listWrapper",
83
+ ref: m,
82
84
  class: b(["grid transition-all relative", {
83
85
  "grid-rows-[0fr]": !i.value && t.collapsible,
84
86
  "grid-rows-[1fr]": i.value || !t.collapsible
85
87
  }]),
86
- ref_key: "$listWrapper",
87
- ref: m,
88
88
  onTransitionstart: r[4] || (r[4] = () => {
89
89
  M.value = !0;
90
90
  }),
91
91
  onTransitionend: r[5] || (r[5] = () => {
92
- M.value = !1, (i.value || !e.value) && l("updateMarkerPosition");
92
+ M.value = !1, (i.value || !e.value) && a("updateMarkerPosition");
93
93
  })
94
94
  }, [
95
95
  i.value && t.collapsible && t.depth === 0 ? (p(), f("div", {
@@ -105,9 +105,9 @@ const k = {
105
105
  "active-path": t.activePath,
106
106
  collapsible: t.collapsible,
107
107
  "link-component": t.linkComponent,
108
- onHideMarker: r[1] || (r[1] = (L) => l("hideMarker")),
109
- onUpdateMarkerPosition: r[2] || (r[2] = () => l("updateMarkerPosition")),
110
- onUpdateActivePosition: r[3] || (r[3] = (L) => i.value ? l("updateActivePosition", L) : null)
108
+ onHideMarker: r[1] || (r[1] = (I) => a("hideMarker")),
109
+ onUpdateMarkerPosition: r[2] || (r[2] = () => a("updateMarkerPosition")),
110
+ onUpdateActivePosition: r[3] || (r[3] = (I) => i.value ? a("updateActivePosition", I) : null)
111
111
  }, null, 8, ["depth", "items", "active-path", "collapsible", "link-component"])
112
112
  ], 34)
113
113
  ], 64));
@@ -123,11 +123,11 @@ const k = {
123
123
  },
124
124
  emits: ["update:active"],
125
125
  setup(g, { expose: c, emit: v }) {
126
- const o = g, i = v, u = d(), m = T("transition-is-moving", d(!1));
126
+ const o = g, i = v, u = d(), m = L("transition-is-moving", d(!1));
127
127
  function s() {
128
128
  o.active && N(() => {
129
- var a;
130
- const { top: e = 0, height: n = 36 } = ((a = u.value) == null ? void 0 : a.getBoundingClientRect()) ?? {};
129
+ var l;
130
+ const { top: e = 0, height: n = 36 } = ((l = u.value) == null ? void 0 : l.getBoundingClientRect()) ?? {};
131
131
  i("update:active", o.active, {
132
132
  top: e,
133
133
  height: n
@@ -147,27 +147,29 @@ const k = {
147
147
  }), P(
148
148
  () => o.active,
149
149
  (e) => {
150
- if (e && u.value) {
151
- const n = u.value.getBoundingClientRect();
152
- if (n.top > 0 && n.bottom < window.innerHeight || n.left > 0 && n.right < window.innerWidth)
153
- return;
154
- u.value.scrollIntoView({
155
- block: "nearest",
156
- inline: "nearest"
157
- });
158
- }
150
+ setTimeout(() => {
151
+ if (e && u.value) {
152
+ const n = u.value.getBoundingClientRect();
153
+ if (n.top > 0 && n.bottom < window.innerHeight && n.left > 0 && n.right < window.innerWidth)
154
+ return;
155
+ u.value.scrollIntoView({
156
+ block: "nearest",
157
+ inline: "nearest"
158
+ });
159
+ }
160
+ }, 200);
159
161
  }
160
162
  );
161
- const l = y(() => {
163
+ const a = y(() => {
162
164
  const { label: e, ...n } = o.item;
163
165
  return n;
164
166
  });
165
167
  return (e, n) => (p(), f("li", {
166
168
  ref_key: "$container",
167
169
  ref: u,
168
- class: "list-none p-0"
170
+ class: "list-none p-0 scroll-my-10"
169
171
  }, [
170
- (p(), $(D(e.linkComponent), V(l.value, {
172
+ (p(), $(D(e.linkComponent), V(a.value, {
171
173
  class: ["group relative block w-full pl-[24px]", {
172
174
  "text-indigo-500 dark:text-indigo-400": e.active,
173
175
  "text-gray-700 dark:text-gray-500": !e.active,
@@ -197,8 +199,8 @@ const k = {
197
199
  key: 0,
198
200
  class: "relative list-none p-0"
199
201
  };
200
- function I(g, c) {
201
- return g.some((v) => "items" in v ? I(v.items, c) : v.href === c);
202
+ function T(g, c) {
203
+ return g.some((v) => "items" in v ? T(v.items, c) : v.href === c);
202
204
  }
203
205
  const U = /* @__PURE__ */ C({
204
206
  __name: "_DocGroupElements",
@@ -212,29 +214,29 @@ const U = /* @__PURE__ */ C({
212
214
  emits: ["updateActivePosition", "updateMarkerPosition", "hideMarker"],
213
215
  setup(g, { expose: c, emit: v }) {
214
216
  const o = g, i = v, u = d([]), m = d([]), s = y(
215
- () => o.items.some((e) => "items" in e ? I(e.items, o.activePath) : e.href === o.activePath)
217
+ () => o.items.some((e) => "items" in e ? T(e.items, o.activePath) : e.href === o.activePath)
216
218
  );
217
- function l(e = -1) {
218
- u.value.forEach((a) => {
219
- a.setActiveMarkerPosition();
219
+ function a(e = -1) {
220
+ u.value.forEach((l) => {
221
+ l.setActiveMarkerPosition();
220
222
  });
221
223
  const n = e - // remove all the items that are not groups from the array and count them
222
- o.items.slice(0, e).filter((a) => !("items" in a)).length;
223
- m.value.slice(n + 1).forEach((a) => {
224
- a.reTriggerSetActiveGroup();
224
+ o.items.slice(0, e).filter((l) => !("items" in l)).length;
225
+ m.value.slice(n + 1).forEach((l) => {
226
+ l.reTriggerSetActiveGroup();
225
227
  });
226
228
  }
227
229
  return c({
228
- reTriggerSetActiveGroup: l
230
+ reTriggerSetActiveGroup: a
229
231
  }), (e, n) => (p(), f("ul", J, [
230
- (p(!0), f(w, null, R(e.items, (a, M) => (p(), f(w, null, [
231
- a && "items" in a ? (p(), f("li", K, [
232
+ (p(!0), f(w, null, R(e.items, (l, M) => (p(), f(w, null, [
233
+ l && "items" in l ? (p(), f("li", K, [
232
234
  x(F, {
233
235
  ref_for: !0,
234
236
  ref_key: "$groups",
235
237
  ref: m,
236
238
  "active-path": e.activePath,
237
- group: a,
239
+ group: l,
238
240
  depth: e.depth + 1,
239
241
  collapsible: e.collapsible,
240
242
  "link-component": e.linkComponent,
@@ -242,7 +244,7 @@ const U = /* @__PURE__ */ C({
242
244
  i("updateActivePosition", t);
243
245
  }),
244
246
  onUpdateMarkerPosition: () => {
245
- s.value ? l(M) : i("updateMarkerPosition");
247
+ s.value ? a(M) : i("updateMarkerPosition");
246
248
  },
247
249
  onHideMarker: n[1] || (n[1] = (t) => i("hideMarker"))
248
250
  }, null, 8, ["active-path", "group", "depth", "collapsible", "link-component", "onUpdateMarkerPosition"])
@@ -251,8 +253,8 @@ const U = /* @__PURE__ */ C({
251
253
  ref_for: !0,
252
254
  ref_key: "$items",
253
255
  ref: u,
254
- item: a,
255
- active: a.href === e.activePath,
256
+ item: l,
257
+ active: l.href === e.activePath,
256
258
  depth: e.depth,
257
259
  collapsible: e.collapsible,
258
260
  "link-component": e.linkComponent,
@@ -276,13 +278,13 @@ const U = /* @__PURE__ */ C({
276
278
  },
277
279
  setup(g) {
278
280
  const c = d(), v = d(0), o = d(36), i = d(!1);
279
- function u({ top: s, height: l } = { height: 0, top: 0 }) {
281
+ function u({ top: s, height: a } = { height: 0, top: 0 }) {
280
282
  var n;
281
283
  const e = ((n = c.value) == null ? void 0 : n.getBoundingClientRect().top) || 0;
282
- v.value = s - e, o.value = l, i.value = !0;
284
+ v.value = s - e, o.value = a, i.value = !0;
283
285
  }
284
286
  const m = d(!1);
285
- return W("transition-is-moving", m), (s, l) => (p(), f("div", {
287
+ return W("transition-is-moving", m), (s, a) => (p(), f("div", {
286
288
  ref_key: "$container",
287
289
  ref: c,
288
290
  class: "relative"
@@ -303,7 +305,7 @@ const U = /* @__PURE__ */ C({
303
305
  "link-component": s.linkComponent,
304
306
  depth: -1,
305
307
  onUpdateActivePosition: u,
306
- onHideMarker: l[0] || (l[0] = (e) => i.value = !1)
308
+ onHideMarker: a[0] || (a[0] = (e) => i.value = !1)
307
309
  }, null, 8, ["items", "active-path", "collapsible", "link-component"])
308
310
  ], 512));
309
311
  }
@@ -313,4 +315,4 @@ export {
313
315
  };
314
316
  //# sourceMappingURL=index.es.mjs.map
315
317
 
316
- /* <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] filter list-none p-0 text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-indigo-400 text-gray-100 text-gray-200 icon-dark-current visible block inline w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-gray-500 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
318
+ /* <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] filter list-none p-0 text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-indigo-400 text-gray-100 text-gray-200 icon-dark-current visible block inline scroll-my-10 w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-gray-500 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
@@ -1 +1 @@
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 expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',\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-[48px]',\n openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, inject } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements, {\n hasActiveItemRecursively,\n type DocGroupEventsEmitted,\n} 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>()\nconst $listWrapper = ref<HTMLDivElement>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst hasActiveItem = computed(() =>\n props.group.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, (open) => {\n if (hasActiveItem.value) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\nwatch(\n () => props.activePath,\n () => {\n if (hasActiveItem.value && !open.value) {\n open.value = true\n }\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 dark:text-indigo-400': active,\n 'text-gray-900 dark:text-gray-100': hasActiveItem && !active,\n 'text-gray-800 dark:text-gray-200': !hasActiveItem && !active,\n },\n ]\"\n :style=\"{\n paddingLeft: depth >= 1 ? `${(depth - 1) * 12 + 48}px` : undefined,\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=\"current\"\n :size=\"depth ? '8' : '16'\"\n :class=\"[\n classes.expandedIcon,\n {\n 'rotate-0': open,\n '-rotate-90': !open,\n },\n ]\"\n :style=\"{\n marginLeft: depth >= 1 ? `${(depth - 1) * 12 + 28}px` : undefined,\n }\"\n />\n {{ group.label }}\n </component>\n <div\n class=\"grid transition-all relative\"\n ref=\"$listWrapper\"\n :class=\"{\n 'grid-rows-[0fr]': !open && collapsible,\n 'grid-rows-[1fr]': open || !collapsible,\n }\"\n @transitionstart=\"\n () => {\n markerIsMoving = true\n }\n \"\n @transitionend=\"\n () => {\n markerIsMoving = false\n if (open || !hasActiveItem) {\n emit('updateMarkerPosition')\n }\n }\n \"\n >\n <div\n v-if=\"open && collapsible && depth === 0\"\n :class=\"classes.openListBorderLeft\"\n />\n <DocGroupElements\n ref=\"$groupElements\"\n class=\"overflow-hidden\"\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=\"\n (opts) => (open ? emit('updateActivePosition', opts) : null)\n \"\n />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport {\n watch,\n type DefineComponent,\n ref,\n onMounted,\n inject,\n nextTick,\n computed,\n} 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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n nextTick(() => {\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}\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\nwatch(\n () => props.active,\n (active) => {\n if (active && $container.value) {\n // if active check if the item is visible in the\n // viewport and scrollIntoView if not\n const rect = $container.value.getBoundingClientRect()\n\n if (rect.top > 0 && rect.bottom < window.innerHeight) {\n return\n }\n\n if (rect.left > 0 && rect.right < window.innerWidth) {\n return\n }\n\n $container.value.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n })\n }\n },\n)\n\nconst itemWithoutLabel = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { label, ...rest } = props.item\n return rest\n})\n</script>\n\n<template>\n <li ref=\"$container\" class=\"list-none p-0\">\n <component\n :is=\"linkComponent\"\n v-bind=\"itemWithoutLabel\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500 dark:text-indigo-400': active,\n 'text-gray-700 dark:text-gray-500': !active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :style=\"{\n paddingLeft: depth >= 0 ? `${depth * 12 + 48}px` : undefined,\n }\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full\"\n :class=\"{\n hidden: !markerIsMoving || !active,\n 'group-hover:block bg-gray-300': !active && collapsible,\n 'bg-indigo-500': active && markerIsMoving,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\">\nexport function hasActiveItemRecursively(\n items: (NavGroup | NavItemLink)[],\n activePath?: string,\n): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, activePath)\n }\n return item.href === activePath\n })\n}\n\nexport interface DocGroupEventsEmitted {\n /**\n * If the group is not collapsed, this event will emit the\n * active marker position all the way to the menu component\n */\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n /**\n * This event will trigger a re-render of the active marker\n * to update its position if not in the current subtree\n */\n (event: 'updateMarkerPosition'): void\n /**\n * This event will bubble-up and hide the active marker\n */\n (event: 'hideMarker'): void\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { DefineComponent, computed, 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<DocGroupEventsEmitted>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nconst hasActiveItem = computed(() =>\n props.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\n/**\n * update the position of the marker when opening a group\n * @param index\n */\nfunction reTriggerSetActiveGroup(index = -1) {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n\n // calculate the index of the calling group in the list of groups\n const indexGroup =\n index -\n // remove all the items that are not groups from the array and count them\n props.items.slice(0, index).filter((item) => !('items' in item)).length\n\n // only update groups that come after the toggled one\n // others will not need to update the marker\n // since they are \"before\" in the rendering tree\n $groups.value.slice(indexGroup + 1).forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul class=\"list-none p-0\">\n <template v-for=\"(item, index) 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 (hasActiveItem) {\n reTriggerSetActiveGroup(index)\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n @hide-marker=\"emit('hideMarker')\"\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) {\n return\n } else if (depth < 0) {\n emit('hideMarker')\n } else {\n emit('updateActivePosition', opts)\n }\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent, provide } 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\nconst markerIsMoving = ref(false)\n\nprovide('transition-is-moving', markerIsMoving)\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible && !markerIsMoving\"\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}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","$listWrapper","Head","computed","emit","__emit","hasActiveItem","item","hasActiveItemRecursively","reTriggerSetActiveGroup","_a","active","markerIsMoving","inject","watch","__expose","$container","setActiveMarkerPosition","nextTick","top","height","onMounted","rect","itemWithoutLabel","label","rest","items","activePath","$items","$groups","index","indexGroup","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop","provide"],"mappings":";;AAAO,MAAMA,IAAU;AAAA,EACnB,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,oBAAoB;AACxB;;;;;;;;;;;ACGA,UAAMC,IAAQC,GAaRC,IAAOC,EAAIH,EAAM,MAAM,cAAc,EAAI,GACzCI,IAAiBD,KACjBE,IAAeF,KAEfG,IAAOC;AAAA,MAAS,MACpBP,EAAM,cAAc,WAAWA,EAAM,MAAM,OAAO,MAAM;AAAA,IAAA,GAGpDQ,IAAOC,GAEPC,IAAgBH;AAAA,MAAS,MAC7BP,EAAM,MAAM,MAAM,KAAK,CAACW,MAClB,WAAWA,IACNC,EAAyBD,EAAK,OAAOX,EAAM,UAAU,IAEvDW,EAAK,SAASX,EAAM,UAC5B;AAAA,IAAA;AAGH,aAASa,IAA0B;;AACjC,OAAAC,IAAAV,EAAe,UAAf,QAAAU,EAAsB;AAAA,IACxB;AAEA,UAAMC,IAASR,EAAS,MAAMP,EAAM,MAAM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E,QAAQ,CAACC,MAAU;AACrD,QAAAA,EAAM,wBAAwB;AAAA,MAAA,CAC/B;AAAA,IACH;AAEa,WAAAjB,EAAA;AAAA,MACX,yBAAAN;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjED,UAAMO,IAAajB,KAEbkC,IAAYlC,EAAI,CAAC,GACjBmC,IAAenC,EAAI,EAAE,GACrBoC,IAAapC,EAAI,EAAK;AAEnB,aAAAqC,EAA2B,EAAE,KAAAjB,GAAK,QAAAC,EAAO,IAAI,EAAE,QAAQ,GAAG,KAAK,KAAK;;AAC3E,YAAMiB,MAAe3B,IAAAM,EAAW,UAAX,gBAAAN,EAAkB,wBAAwB,QAAO;AACtE,MAAAuB,EAAU,QAAQd,IAAMkB,GACxBH,EAAa,QAAQd,GACrBe,EAAW,QAAQ;AAAA,IACrB;AAEM,UAAAvB,IAAiBb,EAAI,EAAK;AAEhC,WAAAuC,EAAQ,wBAAwB1B,CAAc;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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 expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',\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-[48px]',\n openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, inject } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements, {\n hasActiveItemRecursively,\n type DocGroupEventsEmitted,\n} 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>()\nconst $listWrapper = ref<HTMLDivElement>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst hasActiveItem = computed(() =>\n props.group.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, (open) => {\n if (hasActiveItem.value) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\nwatch(\n () => props.activePath,\n () => {\n if (hasActiveItem.value && !open.value) {\n open.value = true\n }\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 dark:text-indigo-400': active,\n 'text-gray-900 dark:text-gray-100': hasActiveItem && !active,\n 'text-gray-800 dark:text-gray-200': !hasActiveItem && !active,\n },\n ]\"\n :style=\"{\n paddingLeft: depth >= 1 ? `${(depth - 1) * 12 + 48}px` : undefined,\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=\"current\"\n :size=\"depth ? '8' : '16'\"\n :class=\"[\n classes.expandedIcon,\n {\n 'rotate-0': open,\n '-rotate-90': !open,\n },\n ]\"\n :style=\"{\n marginLeft: depth >= 1 ? `${(depth - 1) * 12 + 28}px` : undefined,\n }\"\n />\n {{ group.label }}\n </component>\n <div\n ref=\"$listWrapper\"\n class=\"grid transition-all relative\"\n :class=\"{\n 'grid-rows-[0fr]': !open && collapsible,\n 'grid-rows-[1fr]': open || !collapsible,\n }\"\n @transitionstart=\"\n () => {\n markerIsMoving = true\n }\n \"\n @transitionend=\"\n () => {\n markerIsMoving = false\n if (open || !hasActiveItem) {\n emit('updateMarkerPosition')\n }\n }\n \"\n >\n <div\n v-if=\"open && collapsible && depth === 0\"\n :class=\"classes.openListBorderLeft\"\n />\n <DocGroupElements\n ref=\"$groupElements\"\n class=\"overflow-hidden\"\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=\"\n (opts) => (open ? emit('updateActivePosition', opts) : null)\n \"\n />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport {\n watch,\n type DefineComponent,\n ref,\n onMounted,\n inject,\n nextTick,\n computed,\n} 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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n nextTick(() => {\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}\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\nwatch(\n () => props.active,\n (active) => {\n setTimeout(() => {\n if (active && $container.value) {\n // if active check if the item is visible in the\n // viewport and scrollIntoView if not\n const rect = $container.value.getBoundingClientRect()\n\n if (\n rect.top > 0 &&\n rect.bottom < window.innerHeight &&\n rect.left > 0 &&\n rect.right < window.innerWidth\n ) {\n return\n }\n\n $container.value.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n })\n }\n }, 200)\n },\n)\n\nconst itemWithoutLabel = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { label, ...rest } = props.item\n return rest\n})\n</script>\n\n<template>\n <li ref=\"$container\" class=\"list-none p-0 scroll-my-10\">\n <component\n :is=\"linkComponent\"\n v-bind=\"itemWithoutLabel\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500 dark:text-indigo-400': active,\n 'text-gray-700 dark:text-gray-500': !active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :style=\"{\n paddingLeft: depth >= 0 ? `${depth * 12 + 48}px` : undefined,\n }\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full\"\n :class=\"{\n hidden: !markerIsMoving || !active,\n 'group-hover:block bg-gray-300': !active && collapsible,\n 'bg-indigo-500': active && markerIsMoving,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\">\nexport function hasActiveItemRecursively(\n items: (NavGroup | NavItemLink)[],\n activePath?: string,\n): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, activePath)\n }\n return item.href === activePath\n })\n}\n\nexport interface DocGroupEventsEmitted {\n /**\n * If the group is not collapsed, this event will emit the\n * active marker position all the way to the menu component\n */\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n /**\n * This event will trigger a re-render of the active marker\n * to update its position if not in the current subtree\n */\n (event: 'updateMarkerPosition'): void\n /**\n * This event will bubble-up and hide the active marker\n */\n (event: 'hideMarker'): void\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { DefineComponent, computed, 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<DocGroupEventsEmitted>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nconst hasActiveItem = computed(() =>\n props.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\n/**\n * update the position of the marker when opening a group\n * @param index\n */\nfunction reTriggerSetActiveGroup(index = -1) {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n\n // calculate the index of the calling group in the list of groups\n const indexGroup =\n index -\n // remove all the items that are not groups from the array and count them\n props.items.slice(0, index).filter((item) => !('items' in item)).length\n\n // only update groups that come after the toggled one\n // others will not need to update the marker\n // since they are \"before\" in the rendering tree\n $groups.value.slice(indexGroup + 1).forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul class=\"list-none p-0\">\n <template v-for=\"(item, index) in items\">\n <li v-if=\"item && 'items' in item\" class=\"relative list-none p-0\">\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 (hasActiveItem) {\n reTriggerSetActiveGroup(index)\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n @hide-marker=\"emit('hideMarker')\"\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) {\n return\n } else if (depth < 0) {\n emit('hideMarker')\n } else {\n emit('updateActivePosition', opts)\n }\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent, provide } 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\nconst markerIsMoving = ref(false)\n\nprovide('transition-is-moving', markerIsMoving)\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible && !markerIsMoving\"\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}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","$listWrapper","Head","computed","emit","__emit","hasActiveItem","item","hasActiveItemRecursively","reTriggerSetActiveGroup","_a","active","markerIsMoving","inject","watch","__expose","$container","setActiveMarkerPosition","nextTick","top","height","onMounted","rect","itemWithoutLabel","label","rest","items","activePath","$items","$groups","index","indexGroup","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop","provide"],"mappings":";;AAAO,MAAMA,IAAU;AAAA,EACnB,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,oBAAoB;AACxB;;;;;;;;;;;ACGA,UAAMC,IAAQC,GAaRC,IAAOC,EAAIH,EAAM,MAAM,cAAc,EAAI,GACzCI,IAAiBD,KACjBE,IAAeF,KAEfG,IAAOC;AAAA,MAAS,MACpBP,EAAM,cAAc,WAAWA,EAAM,MAAM,OAAO,MAAM;AAAA,IAAA,GAGpDQ,IAAOC,GAEPC,IAAgBH;AAAA,MAAS,MAC7BP,EAAM,MAAM,MAAM,KAAK,CAACW,MAClB,WAAWA,IACNC,EAAyBD,EAAK,OAAOX,EAAM,UAAU,IAEvDW,EAAK,SAASX,EAAM,UAC5B;AAAA,IAAA;AAGH,aAASa,IAA0B;;AACjC,OAAAC,IAAAV,EAAe,UAAf,QAAAU,EAAsB;AAAA,IACxB;AAEA,UAAMC,IAASR,EAAS,MAAMP,EAAM,MAAM,SAASA,EAAM,UAAU,GAE7DgB,IAAiBC,EAAO,wBAAwBd,EAAI,EAAK,CAAC;AAE1D,WAAAe,EAAAH,GAAQ,CAACA,MAAW;AACxB,MAAIA,KACFP,EAAK,YAAY;AAAA,IACnB,CACD,GAEKU,EAAAhB,GAAM,CAACA,MAAS;AACpB,MAAIQ,EAAc,QACZR,IAC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;;;;ACjED,UAAMO,IAAajB,KAEbkC,IAAYlC,EAAI,CAAC,GACjBmC,IAAenC,EAAI,EAAE,GACrBoC,IAAapC,EAAI,EAAK;AAEnB,aAAAqC,EAA2B,EAAE,KAAAjB,GAAK,QAAAC,EAAO,IAAI,EAAE,QAAQ,GAAG,KAAK,KAAK;;AAC3E,YAAMiB,MAAe3B,IAAAM,EAAW,UAAX,gBAAAN,EAAkB,wBAAwB,QAAO;AACtE,MAAAuB,EAAU,QAAQd,IAAMkB,GACxBH,EAAa,QAAQd,GACrBe,EAAW,QAAQ;AAAA,IACrB;AAEM,UAAAvB,IAAiBb,EAAI,EAAK;AAEhC,WAAAuC,EAAQ,wBAAwB1B,CAAc;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
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 g={expandedIcon:"absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700",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-[48px]",openListBorderLeft:"absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"},v=e.defineComponent({__name:"_DocGroup",props:{group:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{default:0}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:d}){const i=u,n=e.ref(i.group.collapsed!==!0),c=e.ref(),f=e.ref(),p=e.computed(()=>i.collapsible?"button":i.group.href?"a":"div"),a=d,t=e.computed(()=>i.group.items.some(o=>"items"in o?y(o.items,i.activePath):o.href===i.activePath));function l(){var o;(o=c.value)==null||o.reTriggerSetActiveGroup()}const r=e.computed(()=>i.group.href===i.activePath),h=e.inject("transition-is-moving",e.ref(!1));return e.watch(r,o=>{o&&a("hideMarker")}),e.watch(n,o=>{t.value?o?l():a("hideMarker"):a("updateMarkerPosition")}),e.watch(()=>i.activePath,()=>{t.value&&!n.value&&(n.value=!0)}),m({reTriggerSetActiveGroup:l}),(o,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),{class:e.normalizeClass([e.unref(g).button,{[e.unref(g).topButton]:o.depth===0,[e.unref(g).leafButton]:o.depth,"text-indigo-500 dark:text-indigo-400":r.value,"text-gray-900 dark:text-gray-100":t.value&&!r.value,"text-gray-800 dark:text-gray-200":!t.value&&!r.value}]),style:e.normalizeStyle({paddingLeft:o.depth>=1?`${(o.depth-1)*12+48}px`:void 0}),href:o.group.href,onClick:s[0]||(s[0]=()=>{o.collapsible?n.value=!n.value:a("updateActivePosition")})},{default:e.withCtx(()=>[i.collapsible?(e.openBlock(),e.createBlock(e.unref(k.IconChevronDownSmall),{key:0,"stroke-color":"current",size:o.depth?"8":"16",class:e.normalizeClass([e.unref(g).expandedIcon,{"rotate-0":n.value,"-rotate-90":!n.value}]),style:e.normalizeStyle({marginLeft:o.depth>=1?`${(o.depth-1)*12+28}px`:void 0})},null,8,["size","class","style"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.group.label),1)]),_:1},8,["class","style","href"])),e.createElementVNode("div",{class:e.normalizeClass(["grid transition-all relative",{"grid-rows-[0fr]":!n.value&&o.collapsible,"grid-rows-[1fr]":n.value||!o.collapsible}]),ref_key:"$listWrapper",ref:f,onTransitionstart:s[4]||(s[4]=()=>{h.value=!0}),onTransitionend:s[5]||(s[5]=()=>{h.value=!1,(n.value||!t.value)&&a("updateMarkerPosition")})},[n.value&&o.collapsible&&o.depth===0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(g).openListBorderLeft)},null,2)):e.createCommentVNode("",!0),e.createVNode(b,{ref_key:"$groupElements",ref:c,class:"overflow-hidden",depth:o.depth,items:o.group.items,"active-path":o.activePath,collapsible:o.collapsible,"link-component":o.linkComponent,onHideMarker:s[1]||(s[1]=B=>a("hideMarker")),onUpdateMarkerPosition:s[2]||(s[2]=()=>a("updateMarkerPosition")),onUpdateActivePosition:s[3]||(s[3]=B=>n.value?a("updateActivePosition",B):null)},null,8,["depth","items","active-path","collapsible","link-component"])],34)],64))}}),P=e.defineComponent({__name:"_DocLink",props:{item:{},active:{type:Boolean},collapsible:{type:Boolean},depth:{default:-1},linkComponent:{}},emits:["update:active"],setup(u,{expose:m,emit:d}){const i=u,n=d,c=e.ref(),f=e.inject("transition-is-moving",e.ref(!1));function p(){i.active&&e.nextTick(()=>{var r;const{top:t=0,height:l=36}=((r=c.value)==null?void 0:r.getBoundingClientRect())??{};n("update:active",i.active,{top:t,height:l})})}e.onMounted(()=>{e.watch(()=>i.active,t=>{t?p():n("update:active",t)},{immediate:!0})}),m({setActiveMarkerPosition:p}),e.watch(()=>i.active,t=>{if(t&&c.value){const l=c.value.getBoundingClientRect();if(l.top>0&&l.bottom<window.innerHeight||l.left>0&&l.right<window.innerWidth)return;c.value.scrollIntoView({block:"nearest",inline:"nearest"})}});const a=e.computed(()=>{const{label:t,...l}=i.item;return l});return(t,l)=>(e.openBlock(),e.createElementBlock("li",{ref_key:"$container",ref:c,class:"list-none p-0"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkComponent),e.mergeProps(a.value,{class:["group relative block w-full pl-[24px]",{"text-indigo-500 dark:text-indigo-400":t.active,"text-gray-700 dark:text-gray-500":!t.active,"py-[8px] text-[16px] leading-[24px]":t.depth<0,"leading-[20px] text-[14px] py-[12px]":t.depth>=0}],style:{paddingLeft:t.depth>=0?`${t.depth*12+48}px`:void 0}}),{default:e.withCtx(()=>[t.depth>=0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full",{hidden:!e.unref(f)||!t.active,"group-hover:block bg-gray-300":!t.active&&t.collapsible,"bg-indigo-500":t.active&&e.unref(f)}])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.item.label),1)]),_:1},16,["class","style"]))],512))}}),C={class:"list-none p-0"},M={key:0,class:"relative list-none p-0"};function y(u,m){return u.some(d=>"items"in d?y(d.items,m):d.href===m)}const b=e.defineComponent({__name:"_DocGroupElements",props:{items:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:d}){const i=u,n=d,c=e.ref([]),f=e.ref([]),p=e.computed(()=>i.items.some(t=>"items"in t?y(t.items,i.activePath):t.href===i.activePath));function a(t=-1){c.value.forEach(r=>{r.setActiveMarkerPosition()});const l=t-i.items.slice(0,t).filter(r=>!("items"in r)).length;f.value.slice(l+1).forEach(r=>{r.reTriggerSetActiveGroup()})}return m({reTriggerSetActiveGroup:a}),(t,l)=>(e.openBlock(),e.createElementBlock("ul",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(r,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r&&"items"in r?(e.openBlock(),e.createElementBlock("li",M,[e.createVNode(v,{ref_for:!0,ref_key:"$groups",ref:f,"active-path":t.activePath,group:r,depth:t.depth+1,collapsible:t.collapsible,"link-component":t.linkComponent,onUpdateActivePosition:l[0]||(l[0]=o=>{n("updateActivePosition",o)}),onUpdateMarkerPosition:()=>{p.value?a(h):n("updateMarkerPosition")},onHideMarker:l[1]||(l[1]=o=>n("hideMarker"))},null,8,["active-path","group","depth","collapsible","link-component","onUpdateMarkerPosition"])])):(e.openBlock(),e.createBlock(P,{key:1,ref_for:!0,ref_key:"$items",ref:c,item:r,active:r.href===t.activePath,depth:t.depth,collapsible:t.collapsible,"link-component":t.linkComponent,"onUpdate:active":l[2]||(l[2]=(o,s)=>{if(s)t.depth<0?n("hideMarker"):n("updateActivePosition",s);else return})},null,8,["item","active","depth","collapsible","link-component"]))],64))),256))]))}});return e.defineComponent({__name:"DocMenu",props:{items:{},activePath:{default:void 0},collapsible:{type:Boolean,default:!0},linkComponent:{default:"a"}},setup(u){const m=e.ref(),d=e.ref(0),i=e.ref(36),n=e.ref(!1);function c({top:p,height:a}={height:0,top:0}){var l;const t=((l=m.value)==null?void 0:l.getBoundingClientRect().top)||0;d.value=p-t,i.value=a,n.value=!0}const f=e.ref(!1);return e.provide("transition-is-moving",f),(p,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"$container",ref:m,class:"relative"},[n.value&&p.collapsible&&!f.value?(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:`${d.value}px`,height:`${i.value-8}px`})},null,4)):e.createCommentVNode("",!0),e.createVNode(b,{items:p.items,"active-path":p.activePath,collapsible:p.collapsible,"link-component":p.linkComponent,depth:-1,onUpdateActivePosition:c,onHideMarker:a[0]||(a[0]=t=>n.value=!1)},null,8,["items","active-path","collapsible","link-component"])],512))}})});
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 g={expandedIcon:"absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700",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-[48px]",openListBorderLeft:"absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"},v=e.defineComponent({__name:"_DocGroup",props:{group:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{default:0}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:d}){const i=u,n=e.ref(i.group.collapsed!==!0),c=e.ref(),f=e.ref(),p=e.computed(()=>i.collapsible?"button":i.group.href?"a":"div"),a=d,t=e.computed(()=>i.group.items.some(o=>"items"in o?y(o.items,i.activePath):o.href===i.activePath));function l(){var o;(o=c.value)==null||o.reTriggerSetActiveGroup()}const r=e.computed(()=>i.group.href===i.activePath),h=e.inject("transition-is-moving",e.ref(!1));return e.watch(r,o=>{o&&a("hideMarker")}),e.watch(n,o=>{t.value?o?l():a("hideMarker"):a("updateMarkerPosition")}),e.watch(()=>i.activePath,()=>{t.value&&!n.value&&(n.value=!0)}),m({reTriggerSetActiveGroup:l}),(o,s)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),{class:e.normalizeClass([e.unref(g).button,{[e.unref(g).topButton]:o.depth===0,[e.unref(g).leafButton]:o.depth,"text-indigo-500 dark:text-indigo-400":r.value,"text-gray-900 dark:text-gray-100":t.value&&!r.value,"text-gray-800 dark:text-gray-200":!t.value&&!r.value}]),style:e.normalizeStyle({paddingLeft:o.depth>=1?`${(o.depth-1)*12+48}px`:void 0}),href:o.group.href,onClick:s[0]||(s[0]=()=>{o.collapsible?n.value=!n.value:a("updateActivePosition")})},{default:e.withCtx(()=>[i.collapsible?(e.openBlock(),e.createBlock(e.unref(k.IconChevronDownSmall),{key:0,"stroke-color":"current",size:o.depth?"8":"16",class:e.normalizeClass([e.unref(g).expandedIcon,{"rotate-0":n.value,"-rotate-90":!n.value}]),style:e.normalizeStyle({marginLeft:o.depth>=1?`${(o.depth-1)*12+28}px`:void 0})},null,8,["size","class","style"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(o.group.label),1)]),_:1},8,["class","style","href"])),e.createElementVNode("div",{ref_key:"$listWrapper",ref:f,class:e.normalizeClass(["grid transition-all relative",{"grid-rows-[0fr]":!n.value&&o.collapsible,"grid-rows-[1fr]":n.value||!o.collapsible}]),onTransitionstart:s[4]||(s[4]=()=>{h.value=!0}),onTransitionend:s[5]||(s[5]=()=>{h.value=!1,(n.value||!t.value)&&a("updateMarkerPosition")})},[n.value&&o.collapsible&&o.depth===0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(g).openListBorderLeft)},null,2)):e.createCommentVNode("",!0),e.createVNode(b,{ref_key:"$groupElements",ref:c,class:"overflow-hidden",depth:o.depth,items:o.group.items,"active-path":o.activePath,collapsible:o.collapsible,"link-component":o.linkComponent,onHideMarker:s[1]||(s[1]=B=>a("hideMarker")),onUpdateMarkerPosition:s[2]||(s[2]=()=>a("updateMarkerPosition")),onUpdateActivePosition:s[3]||(s[3]=B=>n.value?a("updateActivePosition",B):null)},null,8,["depth","items","active-path","collapsible","link-component"])],34)],64))}}),P=e.defineComponent({__name:"_DocLink",props:{item:{},active:{type:Boolean},collapsible:{type:Boolean},depth:{default:-1},linkComponent:{}},emits:["update:active"],setup(u,{expose:m,emit:d}){const i=u,n=d,c=e.ref(),f=e.inject("transition-is-moving",e.ref(!1));function p(){i.active&&e.nextTick(()=>{var r;const{top:t=0,height:l=36}=((r=c.value)==null?void 0:r.getBoundingClientRect())??{};n("update:active",i.active,{top:t,height:l})})}e.onMounted(()=>{e.watch(()=>i.active,t=>{t?p():n("update:active",t)},{immediate:!0})}),m({setActiveMarkerPosition:p}),e.watch(()=>i.active,t=>{setTimeout(()=>{if(t&&c.value){const l=c.value.getBoundingClientRect();if(l.top>0&&l.bottom<window.innerHeight&&l.left>0&&l.right<window.innerWidth)return;c.value.scrollIntoView({block:"nearest",inline:"nearest"})}},200)});const a=e.computed(()=>{const{label:t,...l}=i.item;return l});return(t,l)=>(e.openBlock(),e.createElementBlock("li",{ref_key:"$container",ref:c,class:"list-none p-0 scroll-my-10"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.linkComponent),e.mergeProps(a.value,{class:["group relative block w-full pl-[24px]",{"text-indigo-500 dark:text-indigo-400":t.active,"text-gray-700 dark:text-gray-500":!t.active,"py-[8px] text-[16px] leading-[24px]":t.depth<0,"leading-[20px] text-[14px] py-[12px]":t.depth>=0}],style:{paddingLeft:t.depth>=0?`${t.depth*12+48}px`:void 0}}),{default:e.withCtx(()=>[t.depth>=0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full",{hidden:!e.unref(f)||!t.active,"group-hover:block bg-gray-300":!t.active&&t.collapsible,"bg-indigo-500":t.active&&e.unref(f)}])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.item.label),1)]),_:1},16,["class","style"]))],512))}}),C={class:"list-none p-0"},M={key:0,class:"relative list-none p-0"};function y(u,m){return u.some(d=>"items"in d?y(d.items,m):d.href===m)}const b=e.defineComponent({__name:"_DocGroupElements",props:{items:{},activePath:{},collapsible:{type:Boolean},linkComponent:{},depth:{}},emits:["updateActivePosition","updateMarkerPosition","hideMarker"],setup(u,{expose:m,emit:d}){const i=u,n=d,c=e.ref([]),f=e.ref([]),p=e.computed(()=>i.items.some(t=>"items"in t?y(t.items,i.activePath):t.href===i.activePath));function a(t=-1){c.value.forEach(r=>{r.setActiveMarkerPosition()});const l=t-i.items.slice(0,t).filter(r=>!("items"in r)).length;f.value.slice(l+1).forEach(r=>{r.reTriggerSetActiveGroup()})}return m({reTriggerSetActiveGroup:a}),(t,l)=>(e.openBlock(),e.createElementBlock("ul",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(r,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r&&"items"in r?(e.openBlock(),e.createElementBlock("li",M,[e.createVNode(v,{ref_for:!0,ref_key:"$groups",ref:f,"active-path":t.activePath,group:r,depth:t.depth+1,collapsible:t.collapsible,"link-component":t.linkComponent,onUpdateActivePosition:l[0]||(l[0]=o=>{n("updateActivePosition",o)}),onUpdateMarkerPosition:()=>{p.value?a(h):n("updateMarkerPosition")},onHideMarker:l[1]||(l[1]=o=>n("hideMarker"))},null,8,["active-path","group","depth","collapsible","link-component","onUpdateMarkerPosition"])])):(e.openBlock(),e.createBlock(P,{key:1,ref_for:!0,ref_key:"$items",ref:c,item:r,active:r.href===t.activePath,depth:t.depth,collapsible:t.collapsible,"link-component":t.linkComponent,"onUpdate:active":l[2]||(l[2]=(o,s)=>{if(s)t.depth<0?n("hideMarker"):n("updateActivePosition",s);else return})},null,8,["item","active","depth","collapsible","link-component"]))],64))),256))]))}});return e.defineComponent({__name:"DocMenu",props:{items:{},activePath:{default:void 0},collapsible:{type:Boolean,default:!0},linkComponent:{default:"a"}},setup(u){const m=e.ref(),d=e.ref(0),i=e.ref(36),n=e.ref(!1);function c({top:p,height:a}={height:0,top:0}){var l;const t=((l=m.value)==null?void 0:l.getBoundingClientRect().top)||0;d.value=p-t,i.value=a,n.value=!0}const f=e.ref(!1);return e.provide("transition-is-moving",f),(p,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"$container",ref:m,class:"relative"},[n.value&&p.collapsible&&!f.value?(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:`${d.value}px`,height:`${i.value-8}px`})},null,4)):e.createCommentVNode("",!0),e.createVNode(b,{items:p.items,"active-path":p.activePath,collapsible:p.collapsible,"link-component":p.linkComponent,depth:-1,onUpdateActivePosition:c,onHideMarker:a[0]||(a[0]=t=>n.value=!1)},null,8,["items","active-path","collapsible","link-component"])],512))}})});
2
2
  //# sourceMappingURL=index.umd.js.map
3
3
 
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] filter list-none p-0 text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-indigo-400 text-gray-100 text-gray-200 icon-dark-current visible block inline w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-gray-500 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
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] filter list-none p-0 text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden text-indigo-400 text-gray-100 text-gray-200 icon-dark-current visible block inline scroll-my-10 w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-gray-500 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../constants/dist/index.js","../_DocGroup.vue","../_DocLink.vue","../_DocGroupElements.vue","../DocMenu.vue"],"sourcesContent":["export const classes = {\n expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',\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-[48px]',\n openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, inject } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements, {\n hasActiveItemRecursively,\n type DocGroupEventsEmitted,\n} 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>()\nconst $listWrapper = ref<HTMLDivElement>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst hasActiveItem = computed(() =>\n props.group.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, (open) => {\n if (hasActiveItem.value) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\nwatch(\n () => props.activePath,\n () => {\n if (hasActiveItem.value && !open.value) {\n open.value = true\n }\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 dark:text-indigo-400': active,\n 'text-gray-900 dark:text-gray-100': hasActiveItem && !active,\n 'text-gray-800 dark:text-gray-200': !hasActiveItem && !active,\n },\n ]\"\n :style=\"{\n paddingLeft: depth >= 1 ? `${(depth - 1) * 12 + 48}px` : undefined,\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=\"current\"\n :size=\"depth ? '8' : '16'\"\n :class=\"[\n classes.expandedIcon,\n {\n 'rotate-0': open,\n '-rotate-90': !open,\n },\n ]\"\n :style=\"{\n marginLeft: depth >= 1 ? `${(depth - 1) * 12 + 28}px` : undefined,\n }\"\n />\n {{ group.label }}\n </component>\n <div\n class=\"grid transition-all relative\"\n ref=\"$listWrapper\"\n :class=\"{\n 'grid-rows-[0fr]': !open && collapsible,\n 'grid-rows-[1fr]': open || !collapsible,\n }\"\n @transitionstart=\"\n () => {\n markerIsMoving = true\n }\n \"\n @transitionend=\"\n () => {\n markerIsMoving = false\n if (open || !hasActiveItem) {\n emit('updateMarkerPosition')\n }\n }\n \"\n >\n <div\n v-if=\"open && collapsible && depth === 0\"\n :class=\"classes.openListBorderLeft\"\n />\n <DocGroupElements\n ref=\"$groupElements\"\n class=\"overflow-hidden\"\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=\"\n (opts) => (open ? emit('updateActivePosition', opts) : null)\n \"\n />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport {\n watch,\n type DefineComponent,\n ref,\n onMounted,\n inject,\n nextTick,\n computed,\n} 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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n nextTick(() => {\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}\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\nwatch(\n () => props.active,\n (active) => {\n if (active && $container.value) {\n // if active check if the item is visible in the\n // viewport and scrollIntoView if not\n const rect = $container.value.getBoundingClientRect()\n\n if (rect.top > 0 && rect.bottom < window.innerHeight) {\n return\n }\n\n if (rect.left > 0 && rect.right < window.innerWidth) {\n return\n }\n\n $container.value.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n })\n }\n },\n)\n\nconst itemWithoutLabel = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { label, ...rest } = props.item\n return rest\n})\n</script>\n\n<template>\n <li ref=\"$container\" class=\"list-none p-0\">\n <component\n :is=\"linkComponent\"\n v-bind=\"itemWithoutLabel\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500 dark:text-indigo-400': active,\n 'text-gray-700 dark:text-gray-500': !active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :style=\"{\n paddingLeft: depth >= 0 ? `${depth * 12 + 48}px` : undefined,\n }\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full\"\n :class=\"{\n hidden: !markerIsMoving || !active,\n 'group-hover:block bg-gray-300': !active && collapsible,\n 'bg-indigo-500': active && markerIsMoving,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\">\nexport function hasActiveItemRecursively(\n items: (NavGroup | NavItemLink)[],\n activePath?: string,\n): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, activePath)\n }\n return item.href === activePath\n })\n}\n\nexport interface DocGroupEventsEmitted {\n /**\n * If the group is not collapsed, this event will emit the\n * active marker position all the way to the menu component\n */\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n /**\n * This event will trigger a re-render of the active marker\n * to update its position if not in the current subtree\n */\n (event: 'updateMarkerPosition'): void\n /**\n * This event will bubble-up and hide the active marker\n */\n (event: 'hideMarker'): void\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { DefineComponent, computed, 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<DocGroupEventsEmitted>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nconst hasActiveItem = computed(() =>\n props.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\n/**\n * update the position of the marker when opening a group\n * @param index\n */\nfunction reTriggerSetActiveGroup(index = -1) {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n\n // calculate the index of the calling group in the list of groups\n const indexGroup =\n index -\n // remove all the items that are not groups from the array and count them\n props.items.slice(0, index).filter((item) => !('items' in item)).length\n\n // only update groups that come after the toggled one\n // others will not need to update the marker\n // since they are \"before\" in the rendering tree\n $groups.value.slice(indexGroup + 1).forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul class=\"list-none p-0\">\n <template v-for=\"(item, index) 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 (hasActiveItem) {\n reTriggerSetActiveGroup(index)\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n @hide-marker=\"emit('hideMarker')\"\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) {\n return\n } else if (depth < 0) {\n emit('hideMarker')\n } else {\n emit('updateActivePosition', opts)\n }\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent, provide } 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\nconst markerIsMoving = ref(false)\n\nprovide('transition-is-moving', markerIsMoving)\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible && !markerIsMoving\"\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}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","$listWrapper","Head","computed","emit","__emit","hasActiveItem","item","hasActiveItemRecursively","reTriggerSetActiveGroup","_a","active","markerIsMoving","inject","watch","__expose","$container","setActiveMarkerPosition","nextTick","top","height","onMounted","rect","itemWithoutLabel","label","rest","items","activePath","$items","$groups","index","indexGroup","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop","provide"],"mappings":"8TAAO,MAAMA,EAAU,CACnB,aAAc,kFACd,OAAQ,wEACR,UAAW,mDACX,WAAY,uCACZ,mBAAoB,uEACxB,qOCGA,MAAMC,EAAQC,EAaRC,EAAOC,EAAAA,IAAIH,EAAM,MAAM,YAAc,EAAI,EACzCI,EAAiBD,EAAAA,MACjBE,EAAeF,EAAAA,MAEfG,EAAOC,EAAA,SAAS,IACpBP,EAAM,YAAc,SAAWA,EAAM,MAAM,KAAO,IAAM,KAAA,EAGpDQ,EAAOC,EAEPC,EAAgBH,EAAA,SAAS,IAC7BP,EAAM,MAAM,MAAM,KAAMW,GAClB,UAAWA,EACNC,EAAyBD,EAAK,MAAOX,EAAM,UAAU,EAEvDW,EAAK,OAASX,EAAM,UAC5B,CAAA,EAGH,SAASa,GAA0B,QACjCC,EAAAV,EAAe,QAAf,MAAAU,EAAsB,yBACxB,CAEA,MAAMC,EAASR,EAAS,SAAA,IAAMP,EAAM,MAAM,OAASA,E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MkB,EACxBH,EAAa,MAAQd,EACrBe,EAAW,MAAQ,EACrB,CAEM,MAAAvB,EAAiBb,MAAI,EAAK,EAEhCuC,OAAAA,UAAQ,uBAAwB1B,CAAc"}
1
+ {"version":3,"file":"index.umd.js","sources":["../../constants/dist/index.js","../_DocGroup.vue","../_DocLink.vue","../_DocGroupElements.vue","../DocMenu.vue"],"sourcesContent":["export const classes = {\n expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',\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-[48px]',\n openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',\n};\n","<script lang=\"ts\" setup>\nimport { computed, type DefineComponent, ref, watch, inject } from 'vue'\nimport { IconChevronDownSmall } from '@cypress-design/vue-icon'\nimport { NavGroup, classes } from '@cypress-design/constants-docmenu'\nimport DocGroupElements, {\n hasActiveItemRecursively,\n type DocGroupEventsEmitted,\n} 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>()\nconst $listWrapper = ref<HTMLDivElement>()\n\nconst Head = computed(() =>\n props.collapsible ? 'button' : props.group.href ? 'a' : 'div',\n)\n\nconst emit = defineEmits<DocGroupEventsEmitted>()\n\nconst hasActiveItem = computed(() =>\n props.group.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nwatch(active, (active) => {\n if (active) {\n emit('hideMarker')\n }\n})\n\nwatch(open, (open) => {\n if (hasActiveItem.value) {\n if (open) {\n reTriggerSetActiveGroup()\n } else {\n emit('hideMarker')\n }\n } else {\n emit('updateMarkerPosition')\n }\n})\n\nwatch(\n () => props.activePath,\n () => {\n if (hasActiveItem.value && !open.value) {\n open.value = true\n }\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 dark:text-indigo-400': active,\n 'text-gray-900 dark:text-gray-100': hasActiveItem && !active,\n 'text-gray-800 dark:text-gray-200': !hasActiveItem && !active,\n },\n ]\"\n :style=\"{\n paddingLeft: depth >= 1 ? `${(depth - 1) * 12 + 48}px` : undefined,\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=\"current\"\n :size=\"depth ? '8' : '16'\"\n :class=\"[\n classes.expandedIcon,\n {\n 'rotate-0': open,\n '-rotate-90': !open,\n },\n ]\"\n :style=\"{\n marginLeft: depth >= 1 ? `${(depth - 1) * 12 + 28}px` : undefined,\n }\"\n />\n {{ group.label }}\n </component>\n <div\n ref=\"$listWrapper\"\n class=\"grid transition-all relative\"\n :class=\"{\n 'grid-rows-[0fr]': !open && collapsible,\n 'grid-rows-[1fr]': open || !collapsible,\n }\"\n @transitionstart=\"\n () => {\n markerIsMoving = true\n }\n \"\n @transitionend=\"\n () => {\n markerIsMoving = false\n if (open || !hasActiveItem) {\n emit('updateMarkerPosition')\n }\n }\n \"\n >\n <div\n v-if=\"open && collapsible && depth === 0\"\n :class=\"classes.openListBorderLeft\"\n />\n <DocGroupElements\n ref=\"$groupElements\"\n class=\"overflow-hidden\"\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=\"\n (opts) => (open ? emit('updateActivePosition', opts) : null)\n \"\n />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport {\n watch,\n type DefineComponent,\n ref,\n onMounted,\n inject,\n nextTick,\n computed,\n} 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\nconst markerIsMoving = inject('transition-is-moving', ref(false))\n\nfunction setActiveMarkerPosition() {\n if (props.active) {\n nextTick(() => {\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}\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\nwatch(\n () => props.active,\n (active) => {\n setTimeout(() => {\n if (active && $container.value) {\n // if active check if the item is visible in the\n // viewport and scrollIntoView if not\n const rect = $container.value.getBoundingClientRect()\n\n if (\n rect.top > 0 &&\n rect.bottom < window.innerHeight &&\n rect.left > 0 &&\n rect.right < window.innerWidth\n ) {\n return\n }\n\n $container.value.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n })\n }\n }, 200)\n },\n)\n\nconst itemWithoutLabel = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { label, ...rest } = props.item\n return rest\n})\n</script>\n\n<template>\n <li ref=\"$container\" class=\"list-none p-0 scroll-my-10\">\n <component\n :is=\"linkComponent\"\n v-bind=\"itemWithoutLabel\"\n class=\"group relative block w-full pl-[24px]\"\n :class=\"{\n 'text-indigo-500 dark:text-indigo-400': active,\n 'text-gray-700 dark:text-gray-500': !active,\n 'py-[8px] text-[16px] leading-[24px]': depth < 0,\n 'leading-[20px] text-[14px] py-[12px]': depth >= 0,\n }\"\n :style=\"{\n paddingLeft: depth >= 0 ? `${depth * 12 + 48}px` : undefined,\n }\"\n >\n <div\n v-if=\"depth >= 0\"\n class=\"left-[6.5px] absolute top-[4px] bottom-[4px] w-[4px] z-10 rounded-full\"\n :class=\"{\n hidden: !markerIsMoving || !active,\n 'group-hover:block bg-gray-300': !active && collapsible,\n 'bg-indigo-500': active && markerIsMoving,\n }\"\n />\n {{ item.label }}\n </component>\n </li>\n</template>\n","<script lang=\"ts\">\nexport function hasActiveItemRecursively(\n items: (NavGroup | NavItemLink)[],\n activePath?: string,\n): boolean {\n return items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, activePath)\n }\n return item.href === activePath\n })\n}\n\nexport interface DocGroupEventsEmitted {\n /**\n * If the group is not collapsed, this event will emit the\n * active marker position all the way to the menu component\n */\n (event: 'updateActivePosition', opts?: { top: number; height: number }): void\n /**\n * This event will trigger a re-render of the active marker\n * to update its position if not in the current subtree\n */\n (event: 'updateMarkerPosition'): void\n /**\n * This event will bubble-up and hide the active marker\n */\n (event: 'hideMarker'): void\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { DefineComponent, computed, 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<DocGroupEventsEmitted>()\n\nconst $items = ref<(typeof DocLink)[]>([])\nconst $groups = ref<(typeof DocGroup)[]>([])\n\nconst hasActiveItem = computed(() =>\n props.items.some((item) => {\n if ('items' in item) {\n return hasActiveItemRecursively(item.items, props.activePath)\n }\n return item.href === props.activePath\n }),\n)\n\n/**\n * update the position of the marker when opening a group\n * @param index\n */\nfunction reTriggerSetActiveGroup(index = -1) {\n $items.value.forEach((item) => {\n item.setActiveMarkerPosition()\n })\n\n // calculate the index of the calling group in the list of groups\n const indexGroup =\n index -\n // remove all the items that are not groups from the array and count them\n props.items.slice(0, index).filter((item) => !('items' in item)).length\n\n // only update groups that come after the toggled one\n // others will not need to update the marker\n // since they are \"before\" in the rendering tree\n $groups.value.slice(indexGroup + 1).forEach((group) => {\n group.reTriggerSetActiveGroup()\n })\n}\n\ndefineExpose({\n reTriggerSetActiveGroup,\n})\n</script>\n\n<template>\n <ul class=\"list-none p-0\">\n <template v-for=\"(item, index) in items\">\n <li v-if=\"item && 'items' in item\" class=\"relative list-none p-0\">\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 (hasActiveItem) {\n reTriggerSetActiveGroup(index)\n } else {\n emit('updateMarkerPosition')\n }\n }\n \"\n @hide-marker=\"emit('hideMarker')\"\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) {\n return\n } else if (depth < 0) {\n emit('hideMarker')\n } else {\n emit('updateActivePosition', opts)\n }\n }\n \"\n />\n </template>\n </ul>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref, type DefineComponent, provide } 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\nconst markerIsMoving = ref(false)\n\nprovide('transition-is-moving', markerIsMoving)\n</script>\n\n<template>\n <div ref=\"$container\" class=\"relative\">\n <div\n v-if=\"showMarker && collapsible && !markerIsMoving\"\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}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","$listWrapper","Head","computed","emit","__emit","hasActiveItem","item","hasActiveItemRecursively","reTriggerSetActiveGroup","_a","active","markerIsMoving","inject","watch","__expose","$container","setActiveMarkerPosition","nextTick","top","height","onMounted","rect","itemWithoutLabel","label","rest","items","activePath","$items","$groups","index","indexGroup","group","activeTop","activeHeight","showMarker","updateActiveMarkerPosition","containerTop","provide"],"mappings":"8TAAO,MAAMA,EAAU,CACnB,aAAc,kFACd,OAAQ,wEACR,UAAW,mDACX,WAAY,uCACZ,mBAAoB,uEACxB,qOCGA,MAAMC,EAAQC,EAaRC,EAAOC,EAAAA,IAAIH,E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AE,UAAWA,EAAK,EAAE,OAKnEsB,EAAQ,MAAM,MAAME,EAAa,CAAC,EAAE,QAASC,GAAU,CACrDA,EAAM,wBAAwB,CAAA,CAC/B,CACH,CAEa,OAAAjB,EAAA,CACX,wBAAAN,CAAA,CACD,gtCCjED,MAAMO,EAAajB,EAAAA,MAEbkC,EAAYlC,MAAI,CAAC,EACjBmC,EAAenC,MAAI,EAAE,EACrBoC,EAAapC,MAAI,EAAK,EAEnB,SAAAqC,EAA2B,CAAE,IAAAjB,EAAK,OAAAC,CAAO,EAAI,CAAE,OAAQ,EAAG,IAAK,GAAK,OAC3E,MAAMiB,IAAe3B,EAAAM,EAAW,QAAX,YAAAN,EAAkB,wBAAwB,MAAO,EACtEuB,EAAU,MAAQd,EAAMkB,EACxBH,EAAa,MAAQd,EACrBe,EAAW,MAAQ,EACrB,CAEM,MAAAvB,EAAiBb,MAAI,EAAK,EAEhCuC,OAAAA,UAAQ,uBAAwB1B,CAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress-design/vue-docmenu",
3
- "version": "0.6.0",
3
+ "version": "1.0.0",
4
4
  "files": [
5
5
  "*"
6
6
  ],
@@ -20,8 +20,8 @@
20
20
  "build:types": "yarn vue-tsc --project ./tsconfig.build.json"
21
21
  },
22
22
  "dependencies": {
23
- "@cypress-design/constants-docmenu": "^0.2.0",
24
- "@cypress-design/vue-icon": "^0.32.0"
23
+ "@cypress-design/constants-docmenu": "^1.0.0",
24
+ "@cypress-design/vue-icon": "^1.0.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@cypress-design/rollup-plugin-tailwind-keep": "*"