@hyvor/design 2.1.8-beta.1 → 2.1.8

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.
@@ -1,12 +1,9 @@
1
1
  <script lang="ts">
2
- import { onMount } from 'svelte';
3
- import type { Snippet } from 'svelte';
4
2
  import Container from './../Container/Container.svelte';
5
3
  import DarkToggle from '../../components/Dark/DarkToggle.svelte';
6
4
  import IconButton from '../../components/IconButton/IconButton.svelte';
7
5
  import Dropdown from '../../components/Dropdown/Dropdown.svelte';
8
6
  import IconList from '@hyvor/icons/IconList';
9
- import IconX from '@hyvor/icons/IconX';
10
7
  import HeaderNotification from './HeaderNotification.svelte';
11
8
 
12
9
  interface Props {
@@ -17,8 +14,8 @@
17
14
  href?: string;
18
15
  subName?: undefined | string;
19
16
  darkToggle?: boolean;
20
- center?: Snippet;
21
- end?: Snippet;
17
+ center?: import('svelte').Snippet;
18
+ end?: import('svelte').Snippet;
22
19
  max?: boolean;
23
20
  }
24
21
 
@@ -34,27 +31,9 @@
34
31
  end,
35
32
  max = false
36
33
  }: Props = $props();
37
-
38
- let scrolled = $state(false);
39
- let mobileOpen = $state(false);
40
-
41
- onMount(() => {
42
- const onScroll = () => (scrolled = window.scrollY > 8);
43
- onScroll();
44
- window.addEventListener('scroll', onScroll, { passive: true });
45
- return () => window.removeEventListener('scroll', onScroll);
46
- });
47
-
48
- // close the mobile menu once a link inside it is clicked
49
- function closeOnLinkClick(e: MouseEvent) {
50
- const target = e.target as HTMLElement;
51
- if (target.tagName === 'A' || target.closest('a')) {
52
- mobileOpen = false;
53
- }
54
- }
55
34
  </script>
56
35
 
57
- <header class:scrolled>
36
+ <header>
58
37
  <HeaderNotification {instance} {product} />
59
38
  <Container as="nav" {max}>
60
39
  <div class="nav-start">
@@ -62,8 +41,8 @@
62
41
  <img
63
42
  src={logo || `${instance}/api/public/logo/${product}.svg`}
64
43
  alt="{name + (subName ? ' ' + subName : '')} Logo"
65
- width="26"
66
- height="26"
44
+ width="30"
45
+ height="30"
67
46
  />
68
47
  <span class="brand-product">
69
48
  <span class="brand">{name}</span>
@@ -91,30 +70,20 @@
91
70
  </div>
92
71
 
93
72
  <span class="mobile-nav-wrap">
94
- <Dropdown bind:show={mobileOpen} align="end" width={300} contentPadding={8}>
73
+ <Dropdown align="end" width={300}>
95
74
  {#snippet trigger()}
96
- <IconButton variant="invisible" aria-label="Menu">
97
- {#if mobileOpen}
98
- <IconX size={18} />
99
- {:else}
100
- <IconList size={18} />
101
- {/if}
75
+ <IconButton variant="invisible">
76
+ <IconList size={18} />
102
77
  </IconButton>
103
78
  {/snippet}
104
79
  {#snippet content()}
105
- <!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
106
- <div class="mobile-content" onclick={closeOnLinkClick}>
107
- {#if center}
108
- <div class="mobile-inner">
109
- {@render center()}
110
- </div>
111
- {/if}
112
- {#if end}
113
- <div class="mobile-divider"></div>
114
- <div class="mobile-inner end">
115
- {@render end()}
116
- </div>
117
- {/if}
80
+ <div class="mobile-content">
81
+ <div class="mobile-inner center">
82
+ {@render center?.()}
83
+ </div>
84
+ <div class="mobile-inner end">
85
+ {@render end?.()}
86
+ </div>
118
87
  </div>
119
88
  {/snippet}
120
89
  </Dropdown>
@@ -136,15 +105,10 @@
136
105
  width: 100%;
137
106
  z-index: 100;
138
107
  background-color: var(--background, var(--accent-lightest));
139
- border-bottom: 1px solid transparent;
108
+ border-bottom: 1px solid var(--border);
140
109
  height: var(--header-height);
141
110
  display: flex;
142
111
  flex-direction: column;
143
- transition: border-color 0.2s ease;
144
- }
145
-
146
- header.scrolled {
147
- border-bottom-color: var(--border);
148
112
  }
149
113
 
150
114
  header :global(> nav) {
@@ -153,9 +117,7 @@
153
117
  flex: 1;
154
118
  }
155
119
  .nav-brand {
156
- display: inline-flex;
157
- align-items: center;
158
- gap: 8px;
120
+ display: inline-block;
159
121
  line-height: inherit;
160
122
  white-space: nowrap;
161
123
  color: inherit;
@@ -163,10 +125,11 @@
163
125
  font-weight: 600;
164
126
  }
165
127
  .nav-brand img {
166
- display: block;
128
+ vertical-align: middle;
167
129
  }
168
130
 
169
131
  .brand-product {
132
+ vertical-align: middle;
170
133
  display: inline-flex;
171
134
  flex-direction: column;
172
135
  justify-content: center;
@@ -185,7 +148,7 @@
185
148
  flex: 1;
186
149
  display: flex;
187
150
  align-items: center;
188
- gap: 2px;
151
+ gap: 6px;
189
152
  justify-content: center;
190
153
  }
191
154
 
@@ -229,21 +192,18 @@
229
192
  .mobile-inner {
230
193
  display: flex;
231
194
  flex-direction: column;
232
- gap: 2px;
195
+ }
196
+ .mobile-content {
197
+ gap: 10px;
233
198
  }
234
199
 
235
200
  .mobile-content :global(.button) {
236
201
  display: flex;
237
202
  }
238
203
 
239
- .mobile-divider {
240
- height: 1px;
241
- background: var(--border);
242
- margin: 6px 4px;
243
- }
244
-
245
- /*
246
- used to prevent the content from being hidden behind the header
204
+ /*
205
+ Scroll padding top is used to prevent the content from being hidden behind the header
206
+ https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-padding-top
247
207
  */
248
208
  :global(html) {
249
209
  scroll-padding-top: calc(var(--header-height) + 20px);
@@ -1,4 +1,3 @@
1
- import type { Snippet } from 'svelte';
2
1
  interface Props {
3
2
  product: string;
4
3
  instance?: string;
@@ -7,8 +6,8 @@ interface Props {
7
6
  href?: string;
8
7
  subName?: undefined | string;
9
8
  darkToggle?: boolean;
10
- center?: Snippet;
11
- end?: Snippet;
9
+ center?: import('svelte').Snippet;
10
+ end?: import('svelte').Snippet;
12
11
  max?: boolean;
13
12
  }
14
13
  declare const Header: import("svelte").Component<Props, {}, "">;
@@ -1,6 +1,5 @@
1
1
  export { default as Accordion } from './DetailsAccordion/DetailsAccordion.svelte';
2
2
  export { default as Header } from './Header/Header.svelte';
3
- export { default as HeaderNavLink } from './Header/HeaderNavLink.svelte';
4
3
  export { default as Container } from './Container/Container.svelte';
5
4
  export { default as Docs } from './Docs/Docs.svelte';
6
5
  export { default as DocsImage } from './Docs/DocsImage.svelte';
@@ -1,6 +1,5 @@
1
1
  export { default as Accordion } from './DetailsAccordion/DetailsAccordion.svelte';
2
2
  export { default as Header } from './Header/Header.svelte';
3
- export { default as HeaderNavLink } from './Header/HeaderNavLink.svelte';
4
3
  export { default as Container } from './Container/Container.svelte';
5
4
  export { default as Docs } from './Docs/Docs.svelte';
6
5
  export { default as DocsImage } from './Docs/DocsImage.svelte';
@@ -1,6 +1,6 @@
1
1
  export declare const SOCIAL_LINKS: {
2
2
  readonly x: "https://x.com/HyvorHQ";
3
- readonly bluesky: "https://bsky.app/profile/hyvor.com";
3
+ readonly blueksy: "https://bsky.app/profile/hyvor.com";
4
4
  readonly discord: "https://discord.com/invite/2WRJxQB";
5
5
  readonly github: "https://github.com/hyvor";
6
6
  readonly youtube: "https://www.youtube.com/@HYVOR";
@@ -1,6 +1,6 @@
1
1
  export const SOCIAL_LINKS = {
2
2
  x: 'https://x.com/HyvorHQ',
3
- bluesky: 'https://bsky.app/profile/hyvor.com',
3
+ blueksy: 'https://bsky.app/profile/hyvor.com',
4
4
  discord: 'https://discord.com/invite/2WRJxQB',
5
5
  github: 'https://github.com/hyvor',
6
6
  youtube: 'https://www.youtube.com/@HYVOR',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "2.1.8-beta.1",
3
+ "version": "2.1.8",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "repository": {
@@ -1,148 +0,0 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
-
4
- interface Props {
5
- href?: string;
6
- active?: boolean;
7
- menu?: boolean;
8
- target?: string;
9
- rel?: string;
10
- start?: Snippet;
11
- children?: Snippet;
12
- end?: Snippet;
13
- description?: Snippet;
14
- onclick?: (event: MouseEvent) => void;
15
- [key: string]: unknown;
16
- }
17
-
18
- let {
19
- href,
20
- active = false,
21
- menu = false,
22
- target,
23
- rel,
24
- start,
25
- children,
26
- end,
27
- description,
28
- onclick,
29
- ...rest
30
- }: Props = $props();
31
- </script>
32
-
33
- <svelte:element
34
- this={href ? 'a' : 'span'}
35
- {href}
36
- {target}
37
- {rel}
38
- {onclick}
39
- role={href ? undefined : 'button'}
40
- tabindex={href ? undefined : 0}
41
- class="header-nav-link"
42
- class:active
43
- class:menu={menu || !!description}
44
- class:rich={!!description}
45
- {...rest}
46
- >
47
- {#if description}
48
- {#if start}
49
- <span class="icon-box">{@render start()}</span>
50
- {/if}
51
- <span class="text-stack">
52
- <span class="title">{@render children?.()}</span>
53
- <span class="desc">{@render description()}</span>
54
- </span>
55
- {:else}
56
- {#if start}
57
- <span class="start">{@render start()}</span>
58
- {/if}
59
- {@render children?.()}
60
- {#if end}
61
- <span class="end">{@render end()}</span>
62
- {/if}
63
- {/if}
64
- </svelte:element>
65
-
66
- <style>
67
- .header-nav-link {
68
- display: inline-flex;
69
- align-items: center;
70
- gap: 6px;
71
- padding: 6px 16px;
72
- border-radius: 20px;
73
- font-size: 13px;
74
- font-weight: 500;
75
- color: var(--text-light);
76
- text-decoration: none;
77
- white-space: nowrap;
78
- cursor: pointer;
79
- user-select: none;
80
- transition:
81
- 0.15s background-color,
82
- 0.15s color;
83
- }
84
-
85
- .header-nav-link:hover {
86
- background: var(--hover, var(--accent-lightest));
87
- color: var(--text);
88
- }
89
-
90
- .header-nav-link.active {
91
- background: var(--accent-light);
92
- color: var(--text);
93
- }
94
-
95
- .header-nav-link.menu {
96
- width: 100%;
97
- padding: 8px 10px;
98
- border-radius: 12px;
99
- }
100
-
101
- .start,
102
- .end {
103
- display: inline-flex;
104
- align-items: center;
105
- }
106
-
107
- /* icon + title + description layout, see `description` above */
108
- .header-nav-link.rich {
109
- align-items: flex-start;
110
- gap: 10px;
111
- white-space: normal;
112
- }
113
-
114
- .icon-box {
115
- flex: none;
116
- display: inline-flex;
117
- align-items: center;
118
- justify-content: center;
119
- width: 30px;
120
- height: 30px;
121
- border-radius: 8px;
122
- background: var(--accent-light);
123
- color: var(--accent);
124
- }
125
-
126
- .header-nav-link.rich.active .icon-box {
127
- background: var(--background);
128
- }
129
-
130
- .text-stack {
131
- display: flex;
132
- flex-direction: column;
133
- gap: 1px;
134
- padding-top: 1px;
135
- }
136
-
137
- .title {
138
- font-size: 13px;
139
- font-weight: 600;
140
- color: var(--text);
141
- }
142
-
143
- .desc {
144
- font-size: 12px;
145
- font-weight: 400;
146
- color: var(--text-light);
147
- }
148
- </style>
@@ -1,17 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- interface Props {
3
- href?: string;
4
- active?: boolean;
5
- menu?: boolean;
6
- target?: string;
7
- rel?: string;
8
- start?: Snippet;
9
- children?: Snippet;
10
- end?: Snippet;
11
- description?: Snippet;
12
- onclick?: (event: MouseEvent) => void;
13
- [key: string]: unknown;
14
- }
15
- declare const HeaderNavLink: import("svelte").Component<Props, {}, "">;
16
- type HeaderNavLink = ReturnType<typeof HeaderNavLink>;
17
- export default HeaderNavLink;