srcdev-nuxt-components 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,11 +27,11 @@
27
27
  <script lang="ts">
28
28
  const TAGS_ALLOWED = <string[]>['div', 'section', 'nav', 'ul', 'ol'];
29
29
 
30
- interface INavLink {
30
+ interface ResponsiveHeaderNavItem {
31
31
  name: string;
32
32
  path?: string;
33
33
  isExternal?: boolean;
34
- childLinks?: INavLink[];
34
+ childLinks?: ResponsiveHeaderNavItem[];
35
35
  childLinksTitle?: string;
36
36
  }
37
37
  </script>
@@ -46,7 +46,7 @@ const props = defineProps({
46
46
  },
47
47
  },
48
48
  navLinks: {
49
- type: Array as PropType<INavLink[]>,
49
+ type: Array as PropType<ResponsiveHeaderNavItem[]>,
50
50
  default: () => [],
51
51
  },
52
52
  styleClassPassthrough: {
@@ -34,7 +34,7 @@ const props = defineProps({
34
34
  },
35
35
  },
36
36
  navLinks: {
37
- type: Array as PropType<INavLink[]>,
37
+ type: Array as PropType<ResponsiveHeaderNavItem[]>,
38
38
  default: () => [],
39
39
  },
40
40
  styleClassPassthrough: {
@@ -66,12 +66,12 @@ onMounted(() => {
66
66
  <script lang="ts">
67
67
  const TAGS_ALLOWED = <string[]>['div', 'section', 'nav', 'ul', 'ol'];
68
68
 
69
- interface INavLink {
69
+ interface ResponsiveHeaderNavItem {
70
70
  name: string;
71
71
  path?: string;
72
72
  isExternal?: boolean;
73
73
  childLinksTitle?: string;
74
- childLinks?: INavLink[];
74
+ childLinks?: ResponsiveHeaderNavItem[];
75
75
  }
76
76
  </script>
77
77
 
@@ -49,37 +49,12 @@
49
49
  </div>
50
50
  </template>
51
51
 
52
- <script lang="ts">
53
- interface NavLinkConfig {
54
- left: number;
55
- right: number;
56
- width?: number;
57
- visible: boolean;
58
- }
59
-
60
- interface INavLink {
61
- name: string;
62
- path?: string;
63
- isExternal?: boolean;
64
- childLinksTitle?: string;
65
- childLinks?: INavLink[];
66
- config?: NavLinkConfig;
67
- }
68
-
69
- interface IResponsiveNavLinks {
70
- [key: string]: INavLink[];
71
- }
72
-
73
- interface INavigationRefTrackState {
74
- navListVisibility: Record<string, boolean>;
75
- clonedNavLinks?: IResponsiveNavLinks;
76
- }
77
- </script>
78
-
79
52
  <script setup lang="ts">
53
+ import type { ResponsiveHeaderState } from '@/types/responsiveHeader';
54
+
80
55
  const props = defineProps({
81
56
  mainNavigationState: {
82
- type: Object as PropType<INavigationRefTrackState>,
57
+ type: Object as PropType<ResponsiveHeaderState>,
83
58
  default: () => [],
84
59
  },
85
60
  styleClassPassthrough: {
@@ -89,6 +64,7 @@ const props = defineProps({
89
64
  });
90
65
 
91
66
  const detailsAanimationDuration = 200;
67
+ const detailsAanimationDurationString = `${detailsAanimationDuration}ms`;
92
68
 
93
69
  const widestNavLinkWidthInMainNavigationState = computed(() => {
94
70
  return Object.values(props.mainNavigationState.clonedNavLinks || {}).reduce((maxWidth, group) => {
@@ -166,7 +142,7 @@ watch(
166
142
  flex-direction: column;
167
143
  gap: 12px;
168
144
  margin-block-start: var(--_overflow-navigation-sub-nav-list-margin-block-start);
169
- transition: margin-block-start v-bind(`${detailsAanimationDuration}ms`) ease;
145
+ transition: margin-block-start v-bind(detailsAanimationDurationString) ease;
170
146
 
171
147
  .overflow-navigation-sub-nav-item {
172
148
 
@@ -73,51 +73,13 @@
73
73
  </LayoutRow>
74
74
  </template>
75
75
 
76
- <script lang="ts">
77
-
78
- interface INavLink {
79
- name: string;
80
- path?: string;
81
- isExternal?: boolean;
82
- childLinksTitle?: string;
83
- childLinks?: INavLink[];
84
- config?: NavLinkConfig;
85
- }
86
-
87
- interface IResponsiveNavLinks {
88
- [key: string]: INavLink[];
89
- }
90
-
91
- interface IFlooredRect {
92
- left: number;
93
- right: number;
94
- top: number;
95
- bottom: number;
96
- width: number;
97
- height: number;
98
- }
99
-
100
- interface NavLinkConfig {
101
- left: number;
102
- right: number;
103
- width?: number;
104
- visible: boolean;
105
- }
106
-
107
- interface INavigationRefTrackState {
108
- navListVisibility: Record<string, boolean>;
109
- clonedNavLinks?: IResponsiveNavLinks;
110
- }
111
-
112
-
113
- </script>
114
-
115
76
  <script setup lang="ts">
116
77
  import { useResizeObserver, onClickOutside } from '@vueuse/core';
78
+ import type { ResponsiveHeaderProp, ResponsiveHeaderState, IFlooredRect } from '@/types/responsiveHeader';
117
79
 
118
80
  const props = defineProps({
119
81
  responsiveNavLinks: {
120
- type: Object as PropType<IResponsiveNavLinks>,
82
+ type: Object as PropType<ResponsiveHeaderProp>,
121
83
  default: () => [],
122
84
  },
123
85
  gapBetweenFirstAndSecondNav: {
@@ -130,7 +92,6 @@ const props = defineProps({
130
92
  },
131
93
  });
132
94
 
133
-
134
95
  const navLoaded = ref(false);
135
96
  const navigationWrapperRef = useTemplateRef('navigationWrapper');
136
97
 
@@ -145,7 +106,7 @@ const handleSummaryHover = (event: MouseEvent | FocusEvent) => {
145
106
  }
146
107
  };
147
108
 
148
- const mainNavigationState = ref<INavigationRefTrackState>({
109
+ const mainNavigationState = ref<ResponsiveHeaderState>({
149
110
  navListVisibility: {
150
111
  firstNav: false,
151
112
  secondNav: false,
@@ -181,7 +142,11 @@ const showOverflowDetails = computed(() => {
181
142
  });
182
143
 
183
144
  const mainNavigationMarginBlockEnd = computed(() => {
184
- return secondaryNavRects.value ? secondaryNavRects.value.width + props.gapBetweenFirstAndSecondNav : 0;
145
+ return secondaryNavRects.value ? secondaryNavRects.value.width + props.gapBetweenFirstAndSecondNav : 0;
146
+ });
147
+
148
+ const mainNavigationMarginBlockEndStr = computed(() => {
149
+ return mainNavigationMarginBlockEnd.value + 'px';
185
150
  });
186
151
 
187
152
  const initTemplateRefs = async () => {
@@ -327,7 +292,7 @@ watch(
327
292
  gap: 60px;
328
293
 
329
294
  overflow-x: hidden;
330
- margin-inline-end: v-bind(`${mainNavigationMarginBlockEnd}px`);
295
+ margin-inline-end: v-bind(mainNavigationMarginBlockEndStr);
331
296
 
332
297
  &.collapsed {
333
298
  justify-content: flex-start;
@@ -485,14 +450,13 @@ watch(
485
450
  position: relative;
486
451
  cursor: pointer;
487
452
  width: fit-content;
488
- /* overflow: hidden; */
489
453
 
490
454
  transition: all 0.2s ease-in-out;
491
455
 
492
456
  &.visually-hidden {
493
457
  opacity: 0;
494
458
  visibility: hidden;
495
- /* width: 0; */
459
+ width: 0;
496
460
  }
497
461
 
498
462
  .overflow-details-summary {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "2.5.1",
4
+ "version": "2.5.2",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -0,0 +1,38 @@
1
+ export interface ResponsiveHeaderNavItem {
2
+ name: string;
3
+ path?: string;
4
+ iconName?: string;
5
+ imageSrc?: string;
6
+ imageAlt?: string;
7
+ description?: string;
8
+ isActive?: boolean;
9
+ isExternal?: boolean;
10
+ childLinksTitle?: string;
11
+ childLinks?: ResponsiveHeaderNavItem[];
12
+ config?: ResponsiveHeaderItemRects;
13
+ }
14
+
15
+ export interface ResponsiveHeaderProp {
16
+ [key: string]: ResponsiveHeaderNavItem[];
17
+ }
18
+
19
+ export interface IFlooredRect {
20
+ left: number;
21
+ right: number;
22
+ top: number;
23
+ bottom: number;
24
+ width: number;
25
+ height: number;
26
+ }
27
+
28
+ export interface ResponsiveHeaderItemRects {
29
+ left: number;
30
+ right: number;
31
+ width?: number;
32
+ visible: boolean;
33
+ }
34
+
35
+ export interface ResponsiveHeaderState {
36
+ navListVisibility: Record<string, boolean>;
37
+ clonedNavLinks?: ResponsiveHeaderProp;
38
+ }