@hyvor/design 2.1.22 → 2.1.23

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,21 +1,60 @@
1
1
  <script lang="ts">
2
- import ConfirmModalProvider from './../Modal/ConfirmModalProvider.svelte';
3
- import DarkProvider from './../Dark/DarkProvider.svelte';
4
- import ToastProvider from '../Toast/ToastProvider.svelte';
5
- import FileUploaderProvider from '../FileUploader/FileUploaderProvider.svelte';
6
2
  import fontsCss from './fonts.css?inline';
3
+ import DarkProvider from './../Dark/DarkProvider.svelte';
4
+ import { toastStore } from '../Toast/toast.js';
5
+ import { confirmStore } from '../Modal/confirm.js';
6
+ import { fileUploaderConfig } from '../FileUploader/file-uploader.js';
7
7
 
8
8
  interface Props {
9
9
  dark?: boolean;
10
10
  children?: import('svelte').Snippet;
11
+ marketing?: boolean;
11
12
  }
12
13
 
13
- let { dark = false, children }: Props = $props();
14
+ let { dark = false, children, marketing = false }: Props = $props();
15
+
16
+ let needsToast = $state(false);
17
+ let needsConfirm = $state(false);
18
+ let needsFileUploader = $state(false);
19
+
20
+ $effect(() => {
21
+ if ($toastStore.length > 0) needsToast = true;
22
+ });
23
+ $effect(() => {
24
+ if ($confirmStore !== null) needsConfirm = true;
25
+ });
26
+ $effect(() => {
27
+ if ($fileUploaderConfig !== null) needsFileUploader = true;
28
+ });
14
29
  </script>
15
30
 
16
31
  <svelte:head>
17
32
  <link rel="preconnect" href="https://media.hyvor.com" />
33
+ <link rel="preconnect" href="https://media.hyvor.com" crossorigin="" />
34
+
18
35
  {@html '<style>' + fontsCss + '</style>'}
36
+
37
+ {#if marketing}
38
+ <link
39
+ rel="preload"
40
+ href="https://media.hyvor.com/fonts/source-serif-4-latin-600-normal.DouSKlru.woff2"
41
+ as="font"
42
+ type="font/woff2"
43
+ crossorigin=""
44
+ />
45
+ <link
46
+ rel="preload"
47
+ href="https://media.hyvor.com/fonts/source-serif-4-latin-400-normal.DJ5YJwmz.woff2"
48
+ as="font"
49
+ type="font/woff2"
50
+ crossorigin=""
51
+ />
52
+ <style>
53
+ :root {
54
+ font-family: var(--font-serif) !important;
55
+ }
56
+ </style>
57
+ {/if}
19
58
  </svelte:head>
20
59
 
21
60
  <div id="hds-base">
@@ -26,9 +65,23 @@
26
65
  <DarkProvider />
27
66
  {/if}
28
67
 
29
- <ToastProvider />
30
- <ConfirmModalProvider />
31
- <FileUploaderProvider />
68
+ {#if needsToast}
69
+ {#await import('../Toast/ToastProvider.svelte') then m}
70
+ <m.default />
71
+ {/await}
72
+ {/if}
73
+
74
+ {#if needsConfirm}
75
+ {#await import('../Modal/ConfirmModalProvider.svelte') then m}
76
+ <m.default />
77
+ {/await}
78
+ {/if}
79
+
80
+ {#if needsFileUploader}
81
+ {#await import('../FileUploader/FileUploaderProvider.svelte') then m}
82
+ <m.default />
83
+ {/await}
84
+ {/if}
32
85
 
33
86
  <style>
34
87
  :global(:root) {
@@ -1,6 +1,7 @@
1
1
  interface Props {
2
2
  dark?: boolean;
3
3
  children?: import('svelte').Snippet;
4
+ marketing?: boolean;
4
5
  }
5
6
  declare const Base: import("svelte").Component<Props, {}, "">;
6
7
  type Base = ReturnType<typeof Base>;
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
2
  import Link from '../../components/Link/Link.svelte';
3
- import Modal from '../../components/Modal/Modal.svelte';
4
3
  import { replaceState } from '$app/navigation';
5
4
  import { onMount } from 'svelte';
6
5
 
7
6
  let partner: string | null = $state(null);
8
7
  let showModal = $state(false);
8
+ // Modal (and its Loader dependency) is only loaded once we actually need to show it
9
+ let modalNeeded = $state(false);
9
10
 
10
11
  onMount(() => {
11
12
  const params = new URLSearchParams(window.location.search);
@@ -13,6 +14,7 @@
13
14
 
14
15
  if (partner) {
15
16
  showModal = true;
17
+ modalNeeded = true;
16
18
  }
17
19
  });
18
20
 
@@ -44,31 +46,35 @@
44
46
  }
45
47
  </script>
46
48
 
47
- <Modal
48
- title="Referred by {partner}"
49
- bind:show={showModal}
50
- closeOnOutsideClick={false}
51
- footer={{
52
- cancel: {
53
- text: 'Do not track'
54
- },
55
- confirm: {
56
- text: 'Ok, Visit Site'
57
- }
58
- }}
59
- on:confirm={handleConsent}
60
- >
61
- <div class="notice">
62
- You visited our site through our affiliate partner <strong>{partner}</strong>. To track this
63
- referral, we will place a small cookie in your browser. This cookie helps us identify which
64
- affiliate partner referred you if you sign up. It does not collect any personal data.
65
- </div>
66
- <p>
67
- You can read more in our <Link href="https://hyvor.com/privacy" target="_blank"
68
- >Privacy Policy</Link
69
- >.
70
- </p>
71
- </Modal>
49
+ {#if modalNeeded}
50
+ {#await import('../../components/Modal/Modal.svelte') then m}
51
+ <m.default
52
+ title="Referred by {partner}"
53
+ bind:show={showModal}
54
+ closeOnOutsideClick={false}
55
+ footer={{
56
+ cancel: {
57
+ text: 'Do not track'
58
+ },
59
+ confirm: {
60
+ text: 'Ok, Visit Site'
61
+ }
62
+ }}
63
+ on:confirm={handleConsent}
64
+ >
65
+ <div class="notice">
66
+ You visited our site through our affiliate partner <strong>{partner}</strong>. To track this
67
+ referral, we will place a small cookie in your browser. This cookie helps us identify which
68
+ affiliate partner referred you if you sign up. It does not collect any personal data.
69
+ </div>
70
+ <p>
71
+ You can read more in our <Link href="https://hyvor.com/privacy" target="_blank"
72
+ >Privacy Policy</Link
73
+ >.
74
+ </p>
75
+ </m.default>
76
+ {/await}
77
+ {/if}
72
78
 
73
79
  <style>
74
80
  .notice {
@@ -11,11 +11,11 @@
11
11
  import IconBluesky from '@hyvor/icons/IconBluesky';
12
12
  import IconLockFill from '@hyvor/icons/IconLockFill';
13
13
  import IconButton from '../../components/IconButton/IconButton.svelte';
14
- import Tooltip from '../../components/Tooltip/Tooltip.svelte';
15
14
  import LanguageToggle from '../../components/Internationalization/LanguageToggle.svelte';
16
15
  import { SOCIAL_LINKS, type Socials } from '../social.js';
17
16
  import Affiliate from '../Affiliate/Affiliate.svelte';
18
17
  import RecordVisit from './RecordVisit.svelte';
18
+ import { onMount } from 'svelte';
19
19
 
20
20
  const year = new Date().getFullYear();
21
21
 
@@ -66,6 +66,13 @@
66
66
  gdprText = 'GDPR Compliant',
67
67
  fromFranceText = 'From France'
68
68
  }: Props = $props();
69
+
70
+ // load Tooltip after mount to avoid including it in builds
71
+ let tooltipReady = $state(false);
72
+ onMount(() => {
73
+ tooltipReady = true;
74
+ });
75
+
69
76
  const mascotLogo = $derived(
70
77
  logo || (product ? `${instance}/api/public/logo/${product}.svg` : undefined)
71
78
  );
@@ -159,18 +166,15 @@
159
166
  <IconEnvelope size={14} />
160
167
  {email}
161
168
  </a>
162
- <Tooltip text={emailCopied ? copiedLabel : copyEmailLabel} position="top">
163
- <IconButton
164
- size="small"
165
- variant="invisible"
166
- color="input"
167
- aria-label={emailCopied ? copiedLabel : copyEmailLabel}
168
- onclick={handleCopyEmail}
169
- onmouseleave={() => (emailCopied = false)}
170
- >
171
- <IconCopy size={12} />
172
- </IconButton>
173
- </Tooltip>
169
+ {#if tooltipReady}
170
+ {#await import('../../components/Tooltip/Tooltip.svelte') then m}
171
+ <m.default text={emailCopied ? copiedLabel : copyEmailLabel} position="top">
172
+ {@render CopyButton()}
173
+ </m.default>
174
+ {/await}
175
+ {:else}
176
+ {@render CopyButton()}
177
+ {/if}
174
178
  </div>
175
179
  {/if}
176
180
 
@@ -233,6 +237,19 @@
233
237
  {/if}
234
238
  </div>
235
239
 
240
+ {#snippet CopyButton()}
241
+ <IconButton
242
+ size="small"
243
+ variant="invisible"
244
+ color="input"
245
+ aria-label={emailCopied ? copiedLabel : copyEmailLabel}
246
+ onclick={handleCopyEmail}
247
+ onmouseleave={() => (emailCopied = false)}
248
+ >
249
+ <IconCopy size={12} />
250
+ </IconButton>
251
+ {/snippet}
252
+
236
253
  <style>
237
254
  .footer-outer {
238
255
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/design",
3
- "version": "2.1.22",
3
+ "version": "2.1.23",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "sideEffects": [