@hyvor/design 0.0.67 → 0.0.68

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.
Files changed (123) hide show
  1. package/dist/components/ActionList/ActionList.svelte +2 -7
  2. package/dist/components/ActionList/ActionListGroup.svelte +24 -29
  3. package/dist/components/ActionList/ActionListItem.svelte +86 -88
  4. package/dist/components/ActionList/Selected.svelte +17 -20
  5. package/dist/components/Avatar/Avatar.svelte +7 -11
  6. package/dist/components/Avatar/AvatarStack.svelte +16 -20
  7. package/dist/components/Base/Base.svelte +3 -3
  8. package/dist/components/Box/Box.svelte +8 -8
  9. package/dist/components/Button/Button.svelte +33 -42
  10. package/dist/components/Button/ButtonGroup.svelte +6 -6
  11. package/dist/components/Callout/Callout.svelte +88 -86
  12. package/dist/components/Callout/Callout.svelte.d.ts +1 -0
  13. package/dist/components/Checkbox/Checkbox.svelte +113 -121
  14. package/dist/components/CodeBlock/CodeBlock.svelte +26 -23
  15. package/dist/components/CodeBlock/getCode.js +6 -6
  16. package/dist/components/CodeBlock/hljs.scss +189 -191
  17. package/dist/components/CodeBlock/prism.scss +370 -7
  18. package/dist/components/ColorPicker/ColorPicker.svelte +42 -42
  19. package/dist/components/Dark/DarkProvider.svelte +9 -9
  20. package/dist/components/Dark/DarkToggle.svelte +7 -10
  21. package/dist/components/Divider/Divider.svelte +6 -7
  22. package/dist/components/Dropdown/Dropdown.svelte +33 -108
  23. package/dist/components/Dropdown/DropdownContent.svelte +120 -0
  24. package/dist/components/Dropdown/DropdownContent.svelte.d.ts +24 -0
  25. package/dist/components/FormControl/Caption.svelte +9 -9
  26. package/dist/components/FormControl/FormControl.svelte +18 -18
  27. package/dist/components/FormControl/InputGroup.svelte +7 -8
  28. package/dist/components/FormControl/Label.svelte +5 -5
  29. package/dist/components/FormControl/Validation.svelte +18 -16
  30. package/dist/components/FormControl/Validation.svelte.d.ts +1 -1
  31. package/dist/components/HyvorBar/BarProducts.svelte +52 -0
  32. package/dist/components/HyvorBar/BarProducts.svelte.d.ts +39 -0
  33. package/dist/components/HyvorBar/BarSupport.svelte +119 -0
  34. package/dist/components/HyvorBar/BarSupport.svelte.d.ts +19 -0
  35. package/dist/components/HyvorBar/BarUpdates.svelte +58 -0
  36. package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +18 -0
  37. package/dist/components/HyvorBar/BarUpdatesList.svelte +134 -0
  38. package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +18 -0
  39. package/dist/components/HyvorBar/BarUser.svelte +60 -0
  40. package/dist/components/HyvorBar/BarUser.svelte.d.ts +16 -0
  41. package/dist/components/HyvorBar/BarUserPreview.svelte +42 -0
  42. package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +14 -0
  43. package/dist/components/HyvorBar/HyvorBar.svelte +150 -0
  44. package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +19 -0
  45. package/dist/components/HyvorBar/bar.d.ts +33 -0
  46. package/dist/components/HyvorBar/bar.js +74 -0
  47. package/dist/components/HyvorBar/img/G2.svelte +9 -0
  48. package/dist/components/HyvorBar/img/G2.svelte.d.ts +23 -0
  49. package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
  50. package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +23 -0
  51. package/dist/components/IconButton/IconButton.svelte +19 -23
  52. package/dist/components/IconMessage/IconMessage.svelte +89 -38
  53. package/dist/components/IconMessage/IconMessage.svelte.d.ts +9 -1
  54. package/dist/components/Internationalization/InternationalizationProvider.svelte +2 -2
  55. package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +1 -1
  56. package/dist/components/Internationalization/LanguageToggle.svelte +33 -36
  57. package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +2 -2
  58. package/dist/components/Internationalization/T.svelte.d.ts +3 -3
  59. package/dist/components/Internationalization/i18n.d.ts +4 -4
  60. package/dist/components/Internationalization/i18n.js +13 -11
  61. package/dist/components/Internationalization/t.d.ts +3 -3
  62. package/dist/components/Internationalization/t.js +4 -4
  63. package/dist/components/Internationalization/types.d.ts +1 -1
  64. package/dist/components/Link/Link.svelte +53 -58
  65. package/dist/components/Loader/LoadButton.svelte +15 -29
  66. package/dist/components/Loader/Loader.svelte +56 -69
  67. package/dist/components/Modal/ConfirmModalProvider.svelte +18 -36
  68. package/dist/components/Modal/Modal.svelte +134 -164
  69. package/dist/components/Modal/ModalFooter.svelte +23 -26
  70. package/dist/components/Modal/confirm.d.ts +1 -1
  71. package/dist/components/Modal/confirm.js +4 -4
  72. package/dist/components/Modal/modal-types.d.ts +2 -2
  73. package/dist/components/NavLink/NavLink.svelte +78 -86
  74. package/dist/components/Radio/Radio.svelte +23 -31
  75. package/dist/components/Slider/Slider.svelte +71 -79
  76. package/dist/components/SplitControl/SplitControl.svelte +28 -42
  77. package/dist/components/Switch/Switch.svelte +60 -65
  78. package/dist/components/TabNav/TabNav.svelte +6 -10
  79. package/dist/components/TabNav/TabNavItem.svelte +36 -43
  80. package/dist/components/Table/Table.svelte +7 -4
  81. package/dist/components/Table/TableRow.svelte +23 -23
  82. package/dist/components/Tag/Tag.svelte +28 -36
  83. package/dist/components/Text/Text.svelte +15 -22
  84. package/dist/components/TextInput/TextInput.svelte +26 -26
  85. package/dist/components/Textarea/Textarea.svelte +38 -38
  86. package/dist/components/Toast/ToastIcon.svelte +29 -31
  87. package/dist/components/Toast/ToastMessage.svelte +33 -39
  88. package/dist/components/Toast/ToastProvider.svelte +16 -16
  89. package/dist/components/Toast/cleaner.js +5 -5
  90. package/dist/components/Toast/toast.d.ts +2 -2
  91. package/dist/components/Toast/toast.js +10 -10
  92. package/dist/components/Tooltip/Tooltip.svelte +82 -83
  93. package/dist/components/directives/clickOutside.js +4 -4
  94. package/dist/components/directives/debounce.d.ts +1 -0
  95. package/dist/components/directives/debounce.js +8 -0
  96. package/dist/components/index.d.ts +1 -0
  97. package/dist/components/index.js +1 -0
  98. package/dist/index.css +31 -33
  99. package/dist/marketing/Container/Container.svelte +8 -8
  100. package/dist/marketing/Docs/Content/Content.svelte +8 -7
  101. package/dist/marketing/Docs/Content/DocsImage.svelte +52 -62
  102. package/dist/marketing/Docs/Docs.svelte +21 -24
  103. package/dist/marketing/Docs/Nav/Nav.svelte +21 -22
  104. package/dist/marketing/Docs/Nav/NavCategory.svelte +28 -28
  105. package/dist/marketing/Docs/Nav/NavItem.svelte +21 -24
  106. package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
  107. package/dist/marketing/Docs/Toc.svelte +17 -19
  108. package/dist/marketing/Document/Document.svelte +5 -5
  109. package/dist/marketing/Document/DocumentTitle.svelte +49 -49
  110. package/dist/marketing/Footer/Footer.svelte +111 -119
  111. package/dist/marketing/Footer/FooterLinkList.svelte +24 -26
  112. package/dist/marketing/Header/Header.svelte +7 -15
  113. package/dist/marketing/Logo/LogoBlogs.svelte +41 -0
  114. package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +16 -0
  115. package/dist/marketing/Logo/LogoCore.svelte +41 -0
  116. package/dist/marketing/Logo/LogoCore.svelte.d.ts +16 -0
  117. package/dist/marketing/Logo/LogoFortguard.svelte +49 -0
  118. package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +16 -0
  119. package/dist/marketing/Logo/LogoTalk.svelte +27 -0
  120. package/dist/marketing/Logo/LogoTalk.svelte.d.ts +16 -0
  121. package/dist/stores/dark.js +8 -8
  122. package/dist/variables.scss +41 -48
  123. package/package.json +59 -58
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { BarConfig, BarProduct } from './bar.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ mobile?: boolean | undefined;
6
+ product: BarProduct;
7
+ config: BarConfig;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type BarSupportProps = typeof __propDef.props;
15
+ export type BarSupportEvents = typeof __propDef.events;
16
+ export type BarSupportSlots = typeof __propDef.slots;
17
+ export default class BarSupport extends SvelteComponent<BarSupportProps, BarSupportEvents, BarSupportSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,58 @@
1
+ <script>import { IconButton, Dropdown } from "../index.js";
2
+ import { IconMegaphone } from "@hyvor/icons";
3
+ import BarUpdatesList from "./BarUpdatesList.svelte";
4
+ import { barUnreadUpdates } from "./bar.js";
5
+ export let instance;
6
+ export let product;
7
+ </script>
8
+
9
+ <div class="updates">
10
+ <Dropdown align="end" width={525}>
11
+ <IconButton color="input" variant="invisible" slot="trigger">
12
+ <IconMegaphone size={14} />
13
+
14
+ {#if $barUnreadUpdates > 0}
15
+ <span class="unread">{$barUnreadUpdates}</span>
16
+ {/if}
17
+ </IconButton>
18
+
19
+ <div slot="content" class="content-inner">
20
+ <BarUpdatesList {instance} {product} />
21
+ </div>
22
+ </Dropdown>
23
+ </div>
24
+
25
+ <style>
26
+ .updates {
27
+ height: 100%;
28
+ }
29
+ .content-inner {
30
+ height: 100%;
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+ .updates :global(.dropdown .content) {
35
+ padding: 0;
36
+ height: 100%;
37
+ }
38
+ .unread {
39
+ position: absolute;
40
+ top: 0;
41
+ right: 0;
42
+ font-size: 8px;
43
+ width: 15px;
44
+ height: 15px;
45
+ display: inline-flex;
46
+ border-radius: 50%;
47
+ margin-right: -5px;
48
+ margin-top: -3px;
49
+ background: var(--accent);
50
+ align-items: center;
51
+ justify-content: center;
52
+ color: var(--accent-text);
53
+ font-weight: 600;
54
+ }
55
+ .updates :global(.trigger) {
56
+ position: relative;
57
+ }
58
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type BarProduct } from './bar.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ instance: string;
6
+ product: BarProduct;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type BarUpdatesProps = typeof __propDef.props;
14
+ export type BarUpdatesEvents = typeof __propDef.events;
15
+ export type BarUpdatesSlots = typeof __propDef.slots;
16
+ export default class BarUpdates extends SvelteComponent<BarUpdatesProps, BarUpdatesEvents, BarUpdatesSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,134 @@
1
+ <script>import { onMount } from "svelte";
2
+ import Loader from "../Loader/Loader.svelte";
3
+ import ActionList from "../ActionList/ActionList.svelte";
4
+ import ActionListItem from "../ActionList/ActionListItem.svelte";
5
+ import {
6
+ barUnreadUpdates,
7
+ UnreadUpdatesTimeLocalStorage
8
+ } from "./bar.js";
9
+ import { IconBoxArrowUpRight } from "@hyvor/icons";
10
+ import Button from "../Button/Button.svelte";
11
+ import Tag from "../Tag/Tag.svelte";
12
+ import IconMessage from "../IconMessage/IconMessage.svelte";
13
+ export let instance;
14
+ export let product;
15
+ let updates = [];
16
+ let loading = true;
17
+ let error = false;
18
+ let lastReadTime = null;
19
+ function fetchUpdates() {
20
+ error = false;
21
+ lastReadTime = UnreadUpdatesTimeLocalStorage.get();
22
+ loading = true;
23
+ fetch(instance + "/api/public/updates?types=company," + product).then((response) => response.json()).then((data) => {
24
+ updates = data;
25
+ barUnreadUpdates.set(0);
26
+ UnreadUpdatesTimeLocalStorage.setNow();
27
+ }).catch(() => {
28
+ error = true;
29
+ }).finally(() => {
30
+ loading = false;
31
+ });
32
+ }
33
+ onMount(() => {
34
+ fetchUpdates();
35
+ });
36
+ </script>
37
+
38
+ {#if loading}
39
+ <Loader padding={80} block size="small" />
40
+ {:else if error}
41
+ <IconMessage
42
+ error
43
+ cta={{
44
+ text: 'Try again',
45
+ onClick: (e) => {
46
+ e.stopPropagation();
47
+ fetchUpdates();
48
+ },
49
+ props: { color: 'input' }
50
+ }}>Failed to load updates.</IconMessage
51
+ >
52
+ {:else if updates.length === 0}
53
+ <IconMessage empty>There are no updates to show.</IconMessage>
54
+ {:else}
55
+ <div class="updates-wrap">
56
+ <ActionList>
57
+ {#each updates as update}
58
+ <a href={update.url || '#'} target="_blank" rel="noopener noreferrer">
59
+ <ActionListItem>
60
+ {#if update.type === 'company' || (lastReadTime && update.created_at > lastReadTime)}
61
+ <div class="company-update">
62
+ {#if lastReadTime && update.created_at > lastReadTime}
63
+ <Tag size="x-small" color="green">New</Tag>
64
+ {/if}
65
+ {#if update.type === 'company'}
66
+ <Tag size="x-small" color="blue">Company Update</Tag>
67
+ {/if}
68
+ </div>
69
+ {/if}
70
+ <div class="title">
71
+ {update.title}
72
+ </div>
73
+ <div slot="description">
74
+ <div class="description">
75
+ {update.content}
76
+ </div>
77
+ <div class="date">
78
+ {new Intl.DateTimeFormat('en-US').format(new Date(update.created_at * 1000))}
79
+ </div>
80
+ </div>
81
+ <span slot="end">
82
+ {#if update.url}
83
+ <IconBoxArrowUpRight size={12} />
84
+ {/if}
85
+ </span>
86
+ </ActionListItem>
87
+ </a>
88
+ {/each}
89
+ </ActionList>
90
+ </div>
91
+ {/if}
92
+
93
+ <div class="top">
94
+ <Button size="small" color="input" as="a" href={instance + '/updates'} target="_blank">
95
+ View all updates
96
+ <IconBoxArrowUpRight size={12} slot="end" />
97
+ </Button>
98
+ </div>
99
+
100
+ <style>
101
+ .title {
102
+ font-weight: 600;
103
+ font-size: 16px;
104
+ }
105
+ .description {
106
+ font-size: 14px;
107
+ color: var(--text);
108
+ }
109
+ .date {
110
+ margin-top: 4px;
111
+ font-weight: normal;
112
+ }
113
+ a :global(.action-list-item) {
114
+ padding: 12px 20px;
115
+ }
116
+ .updates-wrap {
117
+ max-height: 600px;
118
+ overflow-y: auto;
119
+ padding: 10px;
120
+ }
121
+ .top {
122
+ padding: 10px 20px;
123
+ display: flex;
124
+ justify-content: center;
125
+ border-top: 1px solid var(--border);
126
+ }
127
+ .company-update {
128
+ margin-bottom: 4px;
129
+ font-weight: normal;
130
+ }
131
+ .description {
132
+ margin-top: 4px;
133
+ }
134
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type BarProduct } from './bar.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ instance: string;
6
+ product: BarProduct;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export type BarUpdatesListProps = typeof __propDef.props;
14
+ export type BarUpdatesListEvents = typeof __propDef.events;
15
+ export type BarUpdatesListSlots = typeof __propDef.slots;
16
+ export default class BarUpdatesList extends SvelteComponent<BarUpdatesListProps, BarUpdatesListEvents, BarUpdatesListSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,60 @@
1
+ <script>import ActionList from "../ActionList/ActionList.svelte";
2
+ import ActionListItem from "../ActionList/ActionListItem.svelte";
3
+ import Dropdown from "../Dropdown/Dropdown.svelte";
4
+ import { IconBoxArrowUpRight } from "@hyvor/icons";
5
+ import { barUser } from "./bar.js";
6
+ import BarUserPreview from "./BarUserPreview.svelte";
7
+ export let instance;
8
+ </script>
9
+
10
+ <div class="wrap">
11
+ <Dropdown align="end" width={325}>
12
+ <button class="user-wrap" slot="trigger">
13
+ {#if $barUser}
14
+ <img class="user-picture" src={$barUser?.picture_url} alt={$barUser?.name} />
15
+ {/if}
16
+ </button>
17
+
18
+ <ActionList slot="content">
19
+ <BarUserPreview />
20
+
21
+ <a href="{instance}/account" target="_blank">
22
+ <ActionListItem>
23
+ Manage Account
24
+ <IconBoxArrowUpRight slot="end" size={12} />
25
+ </ActionListItem>
26
+ </a>
27
+ <a href="{instance}/account/logout">
28
+ <ActionListItem>Logout</ActionListItem>
29
+ </a>
30
+ </ActionList>
31
+ </Dropdown>
32
+ </div>
33
+
34
+ <style>
35
+ .wrap,
36
+ .wrap :global(.dropdown),
37
+ :global(.dropdown > .trigger) {
38
+ display: inline-flex;
39
+ align-items: center;
40
+ }
41
+ .user-wrap {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ margin-left: 5px;
45
+ border-radius: 50%;
46
+ width: 30px;
47
+ height: 30px;
48
+ overflow: hidden;
49
+ transition: 0.3s box-shadow;
50
+ cursor: pointer;
51
+ background-color: var(--input);
52
+ }
53
+ .user-wrap:hover {
54
+ box-shadow: 0 0 0 4px var(--input);
55
+ }
56
+ img {
57
+ width: 100%;
58
+ height: 100%;
59
+ }
60
+ </style>
@@ -0,0 +1,16 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ instance: string;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {};
10
+ };
11
+ export type BarUserProps = typeof __propDef.props;
12
+ export type BarUserEvents = typeof __propDef.events;
13
+ export type BarUserSlots = typeof __propDef.slots;
14
+ export default class BarUser extends SvelteComponent<BarUserProps, BarUserEvents, BarUserSlots> {
15
+ }
16
+ export {};
@@ -0,0 +1,42 @@
1
+ <script>import { barUser } from "./bar.js";
2
+ </script>
3
+
4
+ {#if $barUser}
5
+ <div class="preview">
6
+ <div class="left">
7
+ <img src={$barUser.picture_url} alt={$barUser.name} />
8
+ </div>
9
+ <div class="right">
10
+ <div class="username">@{$barUser.username}</div>
11
+ <div class="email">{$barUser.email}</div>
12
+ </div>
13
+ </div>
14
+ {/if}
15
+
16
+ <style>
17
+ .preview {
18
+ display: flex;
19
+ align-items: center;
20
+ padding: 8px 14px;
21
+ }
22
+ .left {
23
+ flex-shrink: 0;
24
+ margin-right: 8px;
25
+ }
26
+ img {
27
+ width: 40px;
28
+ height: 40px;
29
+ border-radius: 50%;
30
+ }
31
+ .right {
32
+ flex: 1;
33
+ line-height: 18px;
34
+ }
35
+ .username {
36
+ font-weight: 600;
37
+ }
38
+ .email {
39
+ color: var(--text-light);
40
+ font-size: 14px;
41
+ }
42
+ </style>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type BarUserPreviewProps = typeof __propDef.props;
10
+ export type BarUserPreviewEvents = typeof __propDef.events;
11
+ export type BarUserPreviewSlots = typeof __propDef.slots;
12
+ export default class BarUserPreview extends SvelteComponent<BarUserPreviewProps, BarUserPreviewEvents, BarUserPreviewSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,150 @@
1
+ <script>import BarUser from "./BarUser.svelte";
2
+ import { onMount } from "svelte";
3
+ import BarProducts, { PRODUCTS } from "./BarProducts.svelte";
4
+ import BarSupport from "./BarSupport.svelte";
5
+ import { loadBarUser } from "./bar.js";
6
+ import BarUpdates from "./BarUpdates.svelte";
7
+ import { IconCaretDownFill } from "@hyvor/icons";
8
+ export let instance = "https://hyvor.com";
9
+ export let product;
10
+ export let config = {};
11
+ let mobileShow = false;
12
+ const configComplete = {
13
+ ...{
14
+ docs: true,
15
+ chat: true,
16
+ twitter: null,
17
+ g2: null
18
+ },
19
+ ...config
20
+ };
21
+ function handleBarClick(e) {
22
+ if (mobileShow && e.target instanceof Element && e.target.closest(".dropdown .trigger")) {
23
+ return;
24
+ }
25
+ if (window.innerWidth <= 600) {
26
+ mobileShow = !mobileShow;
27
+ }
28
+ }
29
+ onMount(() => {
30
+ loadBarUser(instance, product);
31
+ });
32
+ </script>
33
+
34
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
35
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
36
+ <div id="bar" on:click={handleBarClick} class:mobile-show={mobileShow}>
37
+ <div class="inner hds-box">
38
+ <div class="left">
39
+ <a class="logo" href="/">
40
+ <svelte:component this={PRODUCTS[product].logo} size={20} />
41
+ <span class="name">
42
+ {PRODUCTS[product].name}
43
+ </span>
44
+ </a>
45
+ </div>
46
+ <div class="right">
47
+ <div class="hidden-on-mobile">
48
+ <BarSupport config={configComplete} {product} mobile={mobileShow} />
49
+ <BarProducts mobile={mobileShow} />
50
+ <BarUpdates {instance} {product} />
51
+ </div>
52
+
53
+ <div class="mobile">
54
+ <IconCaretDownFill />
55
+ </div>
56
+
57
+ <BarUser {instance} />
58
+ </div>
59
+ </div>
60
+
61
+ {#if mobileShow}
62
+ <div class="mobile-layer"></div>
63
+ {/if}
64
+ </div>
65
+
66
+ <style>
67
+ #bar {
68
+ height: 50px;
69
+ padding: 0 15px;
70
+ z-index: 100;
71
+ }
72
+ .inner {
73
+ padding: 10px 29px;
74
+ display: flex;
75
+ align-items: center;
76
+ border-top-left-radius: 0;
77
+ border-top-right-radius: 0;
78
+ height: 100%;
79
+ }
80
+ .left {
81
+ display: flex;
82
+ align-items: center;
83
+ flex: 1;
84
+ }
85
+ .logo {
86
+ display: flex;
87
+ align-items: center;
88
+ text-decoration: none;
89
+ gap: 5px;
90
+ font-weight: 600;
91
+ }
92
+ .right {
93
+ display: flex;
94
+ align-items: center;
95
+ gap: 10px;
96
+ }
97
+ .hidden-on-mobile {
98
+ display: flex;
99
+ align-items: center;
100
+ gap: 10px;
101
+ }
102
+
103
+ .mobile {
104
+ display: none;
105
+ }
106
+
107
+ @media (max-width: 600px) {
108
+ .mobile {
109
+ display: block;
110
+ }
111
+ #bar {
112
+ cursor: pointer;
113
+ }
114
+ .hidden-on-mobile {
115
+ display: none;
116
+ animation: 0.2s slideIn;
117
+ }
118
+ #bar.mobile-show .hidden-on-mobile {
119
+ display: flex;
120
+ position: fixed;
121
+ top: 60px;
122
+ z-index: 100;
123
+ left: 15px;
124
+ right: 15px;
125
+ flex-direction: column;
126
+ }
127
+ .mobile-layer {
128
+ position: fixed;
129
+ top: 0;
130
+ left: 0;
131
+ right: 0;
132
+ bottom: 0;
133
+ background: rgba(0, 0, 0, 0.5);
134
+ z-index: 99;
135
+ backdrop-filter: blur(3px);
136
+ }
137
+ #bar.mobile-show :global(button.button) {
138
+ background-color: #fff;
139
+ }
140
+ }
141
+
142
+ @keyframes slideIn {
143
+ from {
144
+ transform: translateY(-20px);
145
+ }
146
+ to {
147
+ transform: translateY(0);
148
+ }
149
+ }
150
+ </style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type BarConfig, type BarProduct } from './bar.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ instance?: string | undefined;
6
+ product: BarProduct;
7
+ config?: Partial<BarConfig> | undefined;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type HyvorBarProps = typeof __propDef.props;
15
+ export type HyvorBarEvents = typeof __propDef.events;
16
+ export type HyvorBarSlots = typeof __propDef.slots;
17
+ export default class HyvorBar extends SvelteComponent<HyvorBarProps, HyvorBarEvents, HyvorBarSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,33 @@
1
+ /// <reference types="svelte" />
2
+ export type BarProduct = 'talk' | 'blogs';
3
+ export interface BarConfig {
4
+ docs: boolean;
5
+ chat: boolean;
6
+ twitter: string | null;
7
+ g2: string | null;
8
+ }
9
+ interface BarUser {
10
+ name: string | null;
11
+ username: string;
12
+ email: string;
13
+ picture_url: string;
14
+ }
15
+ export interface BarUpdate {
16
+ id: number;
17
+ created_at: number;
18
+ type: BarUpdateType;
19
+ title: string;
20
+ content: string;
21
+ url?: string;
22
+ }
23
+ export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'fortguard';
24
+ export declare const barUser: import("svelte/store").Writable<BarUser | null>;
25
+ export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
26
+ export declare function loadBarUser(instance: string, product: BarProduct): void;
27
+ export declare class UnreadUpdatesTimeLocalStorage {
28
+ static KEY: string;
29
+ static get(): number | null;
30
+ static set(value: string): void;
31
+ static setNow(): void;
32
+ }
33
+ export {};
@@ -0,0 +1,74 @@
1
+ import { writable } from 'svelte/store';
2
+ export const barUser = writable(null);
3
+ export const barUnreadUpdates = writable(0);
4
+ export function loadBarUser(instance, product) {
5
+ const query = new URLSearchParams();
6
+ query.set('product', product);
7
+ const lastUnreadTime = UnreadUpdatesTimeLocalStorage.get();
8
+ if (lastUnreadTime) {
9
+ query.set('last_read_updates_at', lastUnreadTime.toString());
10
+ }
11
+ fetch(instance + '/api/public/bar?' + query.toString(), {
12
+ credentials: 'include'
13
+ })
14
+ .then((response) => response.json())
15
+ .then((data) => {
16
+ barUser.set(data.user);
17
+ barUnreadUpdates.set(data.updates.unread);
18
+ if (lastUnreadTime === null) {
19
+ UnreadUpdatesTimeLocalStorage.setNow();
20
+ }
21
+ })
22
+ .catch((error) => {
23
+ console.error('Error:', error);
24
+ });
25
+ }
26
+ export class UnreadUpdatesTimeLocalStorage {
27
+ static KEY = 'unread_updates';
28
+ static get() {
29
+ const val = BarLocalStorage.get(UnreadUpdatesTimeLocalStorage.KEY);
30
+ if (val) {
31
+ return Number(val);
32
+ }
33
+ return null;
34
+ }
35
+ static set(value) {
36
+ BarLocalStorage.set(UnreadUpdatesTimeLocalStorage.KEY, value);
37
+ }
38
+ static setNow() {
39
+ UnreadUpdatesTimeLocalStorage.set(Math.floor(Date.now() / 1000).toString());
40
+ }
41
+ }
42
+ class BarLocalStorage {
43
+ static KEY = 'hyvor_bar';
44
+ static getJson() {
45
+ try {
46
+ const data = localStorage.getItem(BarLocalStorage.KEY);
47
+ if (data) {
48
+ return JSON.parse(data);
49
+ }
50
+ }
51
+ catch (e) {
52
+ console.error(e);
53
+ return null;
54
+ }
55
+ return null;
56
+ }
57
+ static get(key) {
58
+ const data = BarLocalStorage.getJson();
59
+ if (data) {
60
+ return data[key];
61
+ }
62
+ return null;
63
+ }
64
+ static set(key, value) {
65
+ try {
66
+ const data = BarLocalStorage.getJson() || {};
67
+ data[key] = value;
68
+ localStorage.setItem(BarLocalStorage.KEY, JSON.stringify(data));
69
+ }
70
+ catch (e) {
71
+ console.error(e);
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,9 @@
1
+ <svg height="12" viewBox="-36.72 -19.24 748.01 780.17" width="12" xmlns="http://www.w3.org/2000/svg"
2
+ ><g fill="#000"
3
+ ><path
4
+ d="m501.22 521c26.9 46.68 53.5 92.83 80.08 138.93-117.7 90.11-300.82 101-436.38-2.77-156-119.51-181.64-323.43-98.12-470.22 96.06-168.84 275.82-206.18 391.56-178.8-3.13 6.8-72.45 150.61-72.45 150.61s-5.48.36-8.58.42c-34.21 1.45-59.69 9.41-87 23.53a206.93 206.93 0 0 0 -109.84 159.76 201.71 201.71 0 0 0 13.68 100.29c11 26.82 26.56 50.64 47.42 70.75 32 30.88 70.08 50 114.22 56.33 41.8 6 82 .06 119.67-18.87 14.13-7.09 26.15-14.92 40.2-25.66 1.79-1.16 3.38-2.63 5.54-4.3z"
5
+ /><path
6
+ d="m501.48 111.61c-6.83-6.72-13.16-12.92-19.46-19.16-3.76-3.72-7.38-7.59-11.23-11.22-1.38-1.31-3-3.1-3-3.1s1.31-2.78 1.87-3.92c7.37-14.79 18.92-25.6 32.62-34.2a90.65 90.65 0 0 1 50.72-14.01c22.93.45 44.25 6.16 62.24 21.54 13.28 11.35 20.09 25.75 21.29 42.94 2 29-10 51.21-33.83 66.71-14 9.12-29.1 16.17-44.24 24.52-8.35 4.61-15.49 8.66-23.65 17-7.18 8.37-7.53 16.26-7.53 16.26l108.47-.14v48.31h-167.43v-4.67c-.64-23.74 2.13-46.08 13-67.64 10-19.78 25.54-34.26 44.21-45.41 14.38-8.59 29.52-15.9 43.93-24.45 8.89-5.27 15.17-13 15.12-24.21 0-9.62-7-18.17-17-20.84-23.58-6.36-47.58 3.79-60.06 25.37-1.82 3.15-3.68 6.28-6.04 10.32zm209.81 358.04-91.41-157.86h-180.89l-92 159.49h182.22l89.92 157.11z"
7
+ /></g
8
+ ></svg
9
+ >