@hyvor/design 0.0.67 → 1.0.3

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 (184) hide show
  1. package/dist/components/ActionList/ActionList.svelte +21 -13
  2. package/dist/components/ActionList/ActionList.svelte.d.ts +8 -20
  3. package/dist/components/ActionList/ActionListGroup.svelte +40 -35
  4. package/dist/components/ActionList/ActionListGroup.svelte.d.ts +8 -20
  5. package/dist/components/ActionList/ActionListItem.svelte +129 -107
  6. package/dist/components/ActionList/ActionListItem.svelte.d.ts +27 -25
  7. package/dist/components/ActionList/Selected.svelte +27 -24
  8. package/dist/components/ActionList/Selected.svelte.d.ts +6 -17
  9. package/dist/components/Avatar/Avatar.svelte +22 -19
  10. package/dist/components/Avatar/Avatar.svelte.d.ts +7 -18
  11. package/dist/components/Avatar/AvatarStack.svelte +29 -27
  12. package/dist/components/Avatar/AvatarStack.svelte.d.ts +6 -18
  13. package/dist/components/Base/Base.svelte +16 -8
  14. package/dist/components/Base/Base.svelte.d.ts +6 -18
  15. package/dist/components/Box/Box.svelte +16 -9
  16. package/dist/components/Box/Box.svelte.d.ts +7 -19
  17. package/dist/components/Button/Button.svelte +65 -47
  18. package/dist/components/Button/Button.svelte.d.ts +16 -39
  19. package/dist/components/Button/ButtonGroup.svelte +14 -6
  20. package/dist/components/Button/ButtonGroup.svelte.d.ts +5 -27
  21. package/dist/components/Callout/Callout.svelte +110 -87
  22. package/dist/components/Callout/Callout.svelte.d.ts +11 -22
  23. package/dist/components/Checkbox/Checkbox.svelte +156 -144
  24. package/dist/components/Checkbox/Checkbox.svelte.d.ts +11 -34
  25. package/dist/components/CodeBlock/CodeBlock.svelte +45 -32
  26. package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +6 -17
  27. package/dist/components/CodeBlock/getCode.js +8 -6
  28. package/dist/components/CodeBlock/hljs.scss +189 -191
  29. package/dist/components/CodeBlock/prism.scss +370 -7
  30. package/dist/components/ColorPicker/ColorPicker.svelte +75 -56
  31. package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +25 -19
  32. package/dist/components/Dark/DarkProvider.svelte +16 -14
  33. package/dist/components/Dark/DarkProvider.svelte.d.ts +16 -12
  34. package/dist/components/Dark/DarkToggle.svelte +15 -16
  35. package/dist/components/Dark/DarkToggle.svelte.d.ts +16 -12
  36. package/dist/components/Divider/Divider.svelte +23 -13
  37. package/dist/components/Divider/Divider.svelte.d.ts +9 -20
  38. package/dist/components/Dropdown/Dropdown.svelte +58 -114
  39. package/dist/components/Dropdown/Dropdown.svelte.d.ts +13 -24
  40. package/dist/components/Dropdown/DropdownContent.svelte +152 -0
  41. package/dist/components/Dropdown/DropdownContent.svelte.d.ts +12 -0
  42. package/dist/components/FormControl/Caption.svelte +18 -11
  43. package/dist/components/FormControl/Caption.svelte.d.ts +7 -19
  44. package/dist/components/FormControl/FormControl.svelte +28 -19
  45. package/dist/components/FormControl/FormControl.svelte.d.ts +6 -27
  46. package/dist/components/FormControl/InputGroup.svelte +22 -15
  47. package/dist/components/FormControl/InputGroup.svelte.d.ts +7 -19
  48. package/dist/components/FormControl/Label.svelte +15 -6
  49. package/dist/components/FormControl/Label.svelte.d.ts +6 -27
  50. package/dist/components/FormControl/Validation.svelte +30 -19
  51. package/dist/components/FormControl/Validation.svelte.d.ts +9 -21
  52. package/dist/components/HyvorBar/BarProducts.svelte +71 -0
  53. package/dist/components/HyvorBar/BarProducts.svelte.d.ts +32 -0
  54. package/dist/components/HyvorBar/BarSupport.svelte +183 -0
  55. package/dist/components/HyvorBar/BarSupport.svelte.d.ts +8 -0
  56. package/dist/components/HyvorBar/BarUpdates.svelte +68 -0
  57. package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +7 -0
  58. package/dist/components/HyvorBar/BarUpdatesList.svelte +159 -0
  59. package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +7 -0
  60. package/dist/components/HyvorBar/BarUser.svelte +72 -0
  61. package/dist/components/HyvorBar/BarUser.svelte.d.ts +5 -0
  62. package/dist/components/HyvorBar/BarUserPreview.svelte +43 -0
  63. package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +18 -0
  64. package/dist/components/HyvorBar/HyvorBar.svelte +183 -0
  65. package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +8 -0
  66. package/dist/components/HyvorBar/bar.d.ts +33 -0
  67. package/dist/components/HyvorBar/bar.js +74 -0
  68. package/dist/components/HyvorBar/img/G2.svelte +9 -0
  69. package/dist/components/HyvorBar/img/G2.svelte.d.ts +26 -0
  70. package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
  71. package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +26 -0
  72. package/dist/components/IconButton/IconButton.svelte +49 -32
  73. package/dist/components/IconButton/IconButton.svelte.d.ts +10 -33
  74. package/dist/components/IconMessage/IconMessage.svelte +157 -51
  75. package/dist/components/IconMessage/IconMessage.svelte.d.ts +19 -27
  76. package/dist/components/Internationalization/InternationalizationProvider.svelte +15 -8
  77. package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +7 -19
  78. package/dist/components/Internationalization/LanguageToggle.svelte +80 -57
  79. package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +11 -22
  80. package/dist/components/Internationalization/T.svelte +158 -114
  81. package/dist/components/Internationalization/T.svelte.d.ts +17 -15
  82. package/dist/components/Internationalization/i18n.d.ts +3 -5
  83. package/dist/components/Internationalization/i18n.js +13 -11
  84. package/dist/components/Internationalization/t.d.ts +2 -3
  85. package/dist/components/Internationalization/t.js +4 -4
  86. package/dist/components/Internationalization/types.d.ts +2 -1
  87. package/dist/components/Link/Link.svelte +68 -61
  88. package/dist/components/Link/Link.svelte.d.ts +11 -34
  89. package/dist/components/Loader/LoadButton.svelte +39 -38
  90. package/dist/components/Loader/LoadButton.svelte.d.ts +29 -42
  91. package/dist/components/Loader/Loader.svelte +121 -107
  92. package/dist/components/Loader/Loader.svelte.d.ts +15 -27
  93. package/dist/components/Modal/ConfirmModalProvider.svelte +41 -51
  94. package/dist/components/Modal/ConfirmModalProvider.svelte.d.ts +3 -14
  95. package/dist/components/Modal/Modal.svelte +202 -203
  96. package/dist/components/Modal/Modal.svelte.d.ts +31 -29
  97. package/dist/components/Modal/ModalFooter.svelte +36 -31
  98. package/dist/components/Modal/ModalFooter.svelte.d.ts +22 -18
  99. package/dist/components/Modal/confirm.d.ts +2 -2
  100. package/dist/components/Modal/confirm.js +4 -4
  101. package/dist/components/Modal/modal-types.d.ts +4 -4
  102. package/dist/components/NavLink/NavLink.svelte +94 -89
  103. package/dist/components/NavLink/NavLink.svelte.d.ts +11 -33
  104. package/dist/components/Radio/Radio.svelte +46 -35
  105. package/dist/components/Radio/Radio.svelte.d.ts +10 -33
  106. package/dist/components/Slider/Slider.svelte +129 -120
  107. package/dist/components/Slider/Slider.svelte.d.ts +24 -20
  108. package/dist/components/SplitControl/SplitControl.svelte +43 -48
  109. package/dist/components/SplitControl/SplitControl.svelte.d.ts +11 -24
  110. package/dist/components/Switch/Switch.svelte +77 -67
  111. package/dist/components/Switch/Switch.svelte.d.ts +8 -31
  112. package/dist/components/TabNav/TabNav.svelte +33 -23
  113. package/dist/components/TabNav/TabNav.svelte.d.ts +7 -19
  114. package/dist/components/TabNav/TabNavItem.svelte +65 -51
  115. package/dist/components/TabNav/TabNavItem.svelte.d.ts +10 -24
  116. package/dist/components/Table/Table.svelte +17 -7
  117. package/dist/components/Table/Table.svelte.d.ts +7 -19
  118. package/dist/components/Table/TableRow.svelte +32 -24
  119. package/dist/components/Table/TableRow.svelte.d.ts +7 -19
  120. package/dist/components/Tag/Tag.svelte +75 -49
  121. package/dist/components/Tag/Tag.svelte.d.ts +16 -39
  122. package/dist/components/Text/Text.svelte +33 -26
  123. package/dist/components/Text/Text.svelte.d.ts +10 -22
  124. package/dist/components/TextInput/TextInput.svelte +54 -33
  125. package/dist/components/TextInput/TextInput.svelte.d.ts +12 -36
  126. package/dist/components/Textarea/Textarea.svelte +68 -46
  127. package/dist/components/Textarea/Textarea.svelte.d.ts +13 -37
  128. package/dist/components/Toast/ToastIcon.svelte +55 -46
  129. package/dist/components/Toast/ToastIcon.svelte.d.ts +5 -16
  130. package/dist/components/Toast/ToastMessage.svelte +42 -41
  131. package/dist/components/Toast/ToastMessage.svelte.d.ts +5 -16
  132. package/dist/components/Toast/ToastProvider.svelte +22 -20
  133. package/dist/components/Toast/ToastProvider.svelte.d.ts +16 -12
  134. package/dist/components/Toast/cleaner.js +5 -5
  135. package/dist/components/Toast/toast.d.ts +3 -3
  136. package/dist/components/Toast/toast.js +10 -10
  137. package/dist/components/Tooltip/Tooltip.svelte +163 -148
  138. package/dist/components/Tooltip/Tooltip.svelte.d.ts +35 -23
  139. package/dist/components/directives/clickOutside.js +4 -4
  140. package/dist/components/directives/debounce.d.ts +1 -0
  141. package/dist/components/directives/debounce.js +8 -0
  142. package/dist/components/index.d.ts +1 -0
  143. package/dist/components/index.js +1 -0
  144. package/dist/index.css +31 -33
  145. package/dist/marketing/Container/Container.svelte +15 -9
  146. package/dist/marketing/Container/Container.svelte.d.ts +6 -18
  147. package/dist/marketing/Docs/Content/Content.svelte +48 -35
  148. package/dist/marketing/Docs/Content/Content.svelte.d.ts +5 -16
  149. package/dist/marketing/Docs/Content/DocsImage.svelte +67 -69
  150. package/dist/marketing/Docs/Content/DocsImage.svelte.d.ts +9 -20
  151. package/dist/marketing/Docs/Docs.svelte +28 -25
  152. package/dist/marketing/Docs/Docs.svelte.d.ts +6 -29
  153. package/dist/marketing/Docs/Nav/Nav.svelte +96 -70
  154. package/dist/marketing/Docs/Nav/Nav.svelte.d.ts +5 -16
  155. package/dist/marketing/Docs/Nav/NavCategory.svelte +39 -29
  156. package/dist/marketing/Docs/Nav/NavCategory.svelte.d.ts +8 -20
  157. package/dist/marketing/Docs/Nav/NavItem.svelte +30 -26
  158. package/dist/marketing/Docs/Nav/NavItem.svelte.d.ts +6 -18
  159. package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
  160. package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +22 -19
  161. package/dist/marketing/Docs/Toc.svelte +64 -56
  162. package/dist/marketing/Docs/Toc.svelte.d.ts +3 -14
  163. package/dist/marketing/Document/Document.svelte +15 -8
  164. package/dist/marketing/Document/Document.svelte.d.ts +7 -19
  165. package/dist/marketing/Document/DocumentTitle.svelte +65 -54
  166. package/dist/marketing/Document/DocumentTitle.svelte.d.ts +9 -20
  167. package/dist/marketing/Footer/Footer.svelte +154 -145
  168. package/dist/marketing/Footer/Footer.svelte.d.ts +8 -20
  169. package/dist/marketing/Footer/FooterLinkList.svelte +31 -27
  170. package/dist/marketing/Footer/FooterLinkList.svelte.d.ts +6 -18
  171. package/dist/marketing/Header/Header.svelte +47 -37
  172. package/dist/marketing/Header/Header.svelte.d.ts +10 -22
  173. package/dist/marketing/Logo/LogoBlogs.svelte +46 -0
  174. package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +5 -0
  175. package/dist/marketing/Logo/LogoCore.svelte +46 -0
  176. package/dist/marketing/Logo/LogoCore.svelte.d.ts +5 -0
  177. package/dist/marketing/Logo/LogoFortguard.svelte +54 -0
  178. package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +5 -0
  179. package/dist/marketing/Logo/LogoTalk.svelte +32 -0
  180. package/dist/marketing/Logo/LogoTalk.svelte.d.ts +5 -0
  181. package/dist/stores/dark.d.ts +0 -1
  182. package/dist/stores/dark.js +8 -8
  183. package/dist/variables.scss +41 -48
  184. package/package.json +59 -58
@@ -1,39 +1,49 @@
1
- <script>export let name;
1
+ <script lang="ts">
2
+ import type { ComponentType } from 'svelte';
3
+
4
+ interface Props {
5
+ name: string;
6
+ start?: import('svelte').Snippet;
7
+ end?: import('svelte').Snippet;
8
+ children?: import('svelte').Snippet;
9
+ }
10
+
11
+ let { name, start, end, children }: Props = $props();
2
12
  </script>
3
13
 
4
14
  <div class="nav-category">
5
- <div class="name">
6
- <span class="button-content">
7
- {#if $$slots.start}
8
- <span class="slot start"><slot name="start" /></span>
9
- {/if}
15
+ <div class="name">
16
+ <span class="button-content">
17
+ {#if start}
18
+ <span class="slot start">{@render start?.()}</span>
19
+ {/if}
10
20
 
11
- {#if $$slots.end}
12
- <span class="slot end"><slot name="end" /></span>
13
- {/if}
14
- </span>
15
- {name}
16
- </div>
17
- <div class="nav-items">
18
- <slot />
19
- </div>
21
+ {#if end}
22
+ <span class="slot end">{@render end?.()}</span>
23
+ {/if}
24
+ </span>
25
+ {name}
26
+ </div>
27
+ <div class="nav-items">
28
+ {@render children?.()}
29
+ </div>
20
30
  </div>
21
31
 
22
32
  <style>
23
- .nav-category {
24
- margin-bottom: 20px;
25
- }
33
+ .nav-category {
34
+ margin-bottom: 20px;
35
+ }
26
36
 
27
- .name {
28
- font-weight: 600;
29
- padding: 10px 25px;
30
- display: flex;
31
- align-items: center;
32
- }
37
+ .name {
38
+ font-weight: 600;
39
+ padding: 10px 25px;
40
+ display: flex;
41
+ align-items: center;
42
+ }
33
43
 
34
- .slot.start {
35
- margin-right: 5px;
36
- margin-left: 0;
37
- display: flex;
38
- }
44
+ .slot.start {
45
+ margin-right: 5px;
46
+ margin-left: 0;
47
+ display: flex;
48
+ }
39
49
  </style>
@@ -1,20 +1,8 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- name: string;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {
10
- start: {};
11
- end: {};
12
- default: {};
13
- };
14
- };
15
- export type NavCategoryProps = typeof __propDef.props;
16
- export type NavCategoryEvents = typeof __propDef.events;
17
- export type NavCategorySlots = typeof __propDef.slots;
18
- export default class NavCategory extends SvelteComponent<NavCategoryProps, NavCategoryEvents, NavCategorySlots> {
19
- }
20
- export {};
1
+ declare const NavCategory: import("svelte").Component<{
2
+ name: string;
3
+ start?: import("svelte").Snippet;
4
+ end?: import("svelte").Snippet;
5
+ children?: import("svelte").Snippet;
6
+ }, {}, "">;
7
+ type NavCategory = ReturnType<typeof NavCategory>;
8
+ export default NavCategory;
@@ -1,34 +1,38 @@
1
- <script>import { page } from "$app/stores";
2
- export let href;
3
- </script>
1
+ <script lang="ts">
2
+ import { page } from '$app/stores';
3
+
4
+ interface Props {
5
+ href: string;
6
+ children?: import('svelte').Snippet;
7
+ }
4
8
 
9
+ let { href, children }: Props = $props();
10
+ </script>
5
11
 
6
- <a
7
- href={href}
8
- class:active={href === $page.url.pathname}
9
- aria-current={href === $page.url.pathname ? "page" : undefined}
12
+ <a
13
+ {href}
14
+ class:active={href === $page.url.pathname}
15
+ aria-current={href === $page.url.pathname ? 'page' : undefined}
10
16
  >
11
- <slot />
17
+ {@render children?.()}
12
18
  </a>
13
19
 
14
20
  <style>
21
+ a {
22
+ display: block;
23
+ padding: 4px 25px;
24
+ color: var(--text-light);
25
+ font-size: 14px;
26
+ letter-spacing: 0.3px;
27
+ border-left: 3px solid transparent;
28
+ }
15
29
 
16
- a {
17
- display: block;
18
- padding: 4px 25px;
19
- color: var(--text-light);
20
- font-size: 14px;
21
- letter-spacing: .3px;
22
- border-left: 3px solid transparent;
23
- }
24
-
25
- a:hover {
26
- background-color: var(--hover);
27
- }
28
-
29
- a.active {
30
- background-color: var(--accent-lightest);
31
- border-left: 3px solid var(--accent);
32
- }
30
+ a:hover {
31
+ background-color: var(--hover);
32
+ }
33
33
 
34
- </style>
34
+ a.active {
35
+ background-color: var(--accent-lightest);
36
+ border-left: 3px solid var(--accent);
37
+ }
38
+ </style>
@@ -1,18 +1,6 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- href: string;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {
10
- default: {};
11
- };
12
- };
13
- export type NavItemProps = typeof __propDef.props;
14
- export type NavItemEvents = typeof __propDef.events;
15
- export type NavItemSlots = typeof __propDef.slots;
16
- export default class NavItem extends SvelteComponent<NavItemProps, NavItemEvents, NavItemSlots> {
17
- }
18
- export {};
1
+ declare const NavItem: import("svelte").Component<{
2
+ href: string;
3
+ children?: import("svelte").Snippet;
4
+ }, {}, "">;
5
+ type NavItem = ReturnType<typeof NavItem>;
6
+ export default NavItem;
@@ -1,32 +1,29 @@
1
1
  <script>
2
- import Toc from "../Toc.svelte";
3
-
2
+ import Toc from '../Toc.svelte';
4
3
  </script>
4
+
5
5
  <div class="sidebar">
6
- <Toc />
6
+ <Toc />
7
7
  </div>
8
8
 
9
-
10
9
  <style>
10
+ .sidebar {
11
+ width: 220px;
12
+ top: var(--header-height, 0);
13
+ padding: 25px 0;
14
+ position: sticky;
15
+ flex-shrink: 0;
16
+ align-self: flex-start;
17
+ }
11
18
 
12
- .sidebar {
13
- width: 220px;
14
- top: var(--header-height, 0);
15
- padding: 25px 0;
16
- position: sticky;
17
- flex-shrink: 0;
18
- align-self: flex-start;
19
- }
20
-
21
- @media (max-width: 992px) {
22
- .sidebar {
23
- order: 1;
24
- position: relative;
25
- top: initial;
26
- padding: 0 15px;
27
- margin-bottom: 20px;
28
- width: 100%;
29
- }
30
- }
31
-
32
- </style>
19
+ @media (max-width: 992px) {
20
+ .sidebar {
21
+ order: 1;
22
+ position: relative;
23
+ top: initial;
24
+ padding: 0 15px;
25
+ margin-bottom: 20px;
26
+ width: 100%;
27
+ }
28
+ }
29
+ </style>
@@ -1,23 +1,26 @@
1
- /** @typedef {typeof __propDef.props} SidebarProps */
2
- /** @typedef {typeof __propDef.events} SidebarEvents */
3
- /** @typedef {typeof __propDef.slots} SidebarSlots */
4
- export default class Sidebar extends SvelteComponent<{
1
+ export default Sidebar;
2
+ type Sidebar = SvelteComponent<{
5
3
  [x: string]: never;
6
4
  }, {
7
5
  [evt: string]: CustomEvent<any>;
8
- }, {}> {
9
- }
10
- export type SidebarProps = typeof __propDef.props;
11
- export type SidebarEvents = typeof __propDef.events;
12
- export type SidebarSlots = typeof __propDef.slots;
13
- import { SvelteComponent } from "svelte";
14
- declare const __propDef: {
15
- props: {
16
- [x: string]: never;
17
- };
18
- events: {
19
- [evt: string]: CustomEvent<any>;
20
- };
21
- slots: {};
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
22
8
  };
23
- export {};
9
+ declare const Sidebar: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -1,58 +1,69 @@
1
- <script>import { afterNavigate } from "$app/navigation";
2
- import { onMount } from "svelte";
3
- import tocbot from "tocbot";
4
- import Loader from "../../components/Loader/Loader.svelte";
5
- import { IconCaretDown, IconCaretRight } from "@hyvor/icons";
6
- import Button from "../../components/Button/Button.svelte";
7
- let tocElement;
8
- onMount(() => {
9
- tocbot.init({
10
- // @ts-ignore
11
- tocElement,
12
- contentSelector: ".docs .content-wrap",
13
- headingSelector: "h2, h3, h4, h5, h6",
14
- orderedList: false,
15
- hasInnerContainers: true,
16
- headingsOffset: 75,
17
- scrollSmooth: true,
18
- scrollSmoothOffset: -75
19
- });
20
- });
21
- afterNavigate(() => {
22
- tocbot.refresh();
23
- });
24
- let mobileShown = false;
25
- function handleMobileClick(e) {
26
- e.stopPropagation();
27
- if (!mobileShown) {
28
- tocElement.style.display = "block";
29
- mobileShown = true;
30
- } else {
31
- tocElement.style.display = "none";
32
- mobileShown = false;
33
- }
34
- }
35
- </script>
1
+ <script lang="ts">
2
+ import { afterNavigate } from '$app/navigation';
3
+ import { onMount } from 'svelte';
36
4
 
37
- <div class="wrap hds-box">
5
+ // @ts-ignore
6
+ import tocbot from 'tocbot';
7
+
8
+ import Loader from '../../components/Loader/Loader.svelte';
9
+ import { IconCaretDown, IconCaretRight } from '@hyvor/icons';
10
+ import Button from '../../components/Button/Button.svelte';
11
+
12
+ let tocElement: HTMLDivElement | undefined = $state();
13
+
14
+ onMount(() => {
15
+ tocbot.init({
16
+ // @ts-ignore
17
+ tocElement: tocElement,
18
+ contentSelector: '.docs .content-wrap',
19
+ headingSelector: 'h2, h3, h4, h5, h6',
20
+ orderedList: false,
21
+ hasInnerContainers: true,
22
+ headingsOffset: 75,
23
+ scrollSmooth: true,
24
+ scrollSmoothOffset: -75
25
+ });
26
+ });
38
27
 
39
- <div class="mobile">
40
- <Button color="input" on:click={handleMobileClick}>
41
- Table of Contents
42
- <svelte:fragment slot="end">
43
- {#if mobileShown}
44
- <IconCaretDown size={14} />
45
- {:else}
46
- <IconCaretRight size={14} />
47
- {/if}
48
- </svelte:fragment>
49
- </Button>
50
- </div>
28
+ afterNavigate(() => {
29
+ tocbot.refresh();
30
+ });
51
31
 
52
- <div class="toc-wrap" bind:this={tocElement}>
53
- <Loader block padding={30} size="small" />
54
- </div>
32
+ let mobileShown = $state(false);
55
33
 
34
+ function handleMobileClick(e: any) {
35
+ if (!tocElement) {
36
+ return;
37
+ }
38
+
39
+ e.stopPropagation();
40
+ if (!mobileShown) {
41
+ tocElement.style.display = 'block';
42
+ mobileShown = true;
43
+ } else {
44
+ tocElement.style.display = 'none';
45
+ mobileShown = false;
46
+ }
47
+ }
48
+ </script>
49
+
50
+ <div class="wrap hds-box">
51
+ <div class="mobile">
52
+ <Button color="input" on:click={handleMobileClick}>
53
+ Table of Contents
54
+ {#snippet end()}
55
+ {#if mobileShown}
56
+ <IconCaretDown size={14} />
57
+ {:else}
58
+ <IconCaretRight size={14} />
59
+ {/if}
60
+ {/snippet}
61
+ </Button>
62
+ </div>
63
+
64
+ <div class="toc-wrap" bind:this={tocElement}>
65
+ <Loader block padding={30} size="small" />
66
+ </div>
56
67
  </div>
57
68
 
58
69
  <style>.wrap {
@@ -63,9 +74,6 @@ function handleMobileClick(e) {
63
74
  align-self: flex-start;
64
75
  overflow-y: auto;
65
76
  }
66
- .toc-wrap :global(&.toc) {
67
- overflow-y: auto;
68
- }
69
77
  .toc-wrap :global(> .toc-list) {
70
78
  overflow: hidden;
71
79
  position: relative;
@@ -112,7 +120,7 @@ function handleMobileClick(e) {
112
120
  font-weight: 700;
113
121
  }
114
122
  .toc-wrap :global(.toc-link::before) {
115
- background-color: #EEE;
123
+ background-color: #eee;
116
124
  content: " ";
117
125
  display: inline-block;
118
126
  height: inherit;
@@ -146,4 +154,4 @@ function handleMobileClick(e) {
146
154
  :global(.is-active-link::before) {
147
155
  background-color: #eee !important;
148
156
  }
149
- }</style>
157
+ }</style>
@@ -1,14 +1,3 @@
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 TocProps = typeof __propDef.props;
10
- export type TocEvents = typeof __propDef.events;
11
- export type TocSlots = typeof __propDef.slots;
12
- export default class Toc extends SvelteComponent<TocProps, TocEvents, TocSlots> {
13
- }
14
- export {};
1
+ declare const Toc: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type Toc = ReturnType<typeof Toc>;
3
+ export default Toc;
@@ -1,14 +1,21 @@
1
- <script>import FeatureSectionTitle from "./DocumentTitle.svelte";
2
- export let title;
3
- export let subtitle;
1
+ <script lang="ts">
2
+ import FeatureSectionTitle from './DocumentTitle.svelte';
3
+
4
+ interface Props {
5
+ title: string;
6
+ subtitle: string;
7
+ children?: import('svelte').Snippet;
8
+ }
9
+
10
+ let { title, subtitle, children }: Props = $props();
4
11
  </script>
5
12
 
6
13
  <section>
7
- <div class="hds-container container">
8
- <FeatureSectionTitle {title} />
9
- <div class="date">{subtitle}</div>
10
- <content><slot /></content>
11
- </div>
14
+ <div class="hds-container container">
15
+ <FeatureSectionTitle {title} />
16
+ <div class="date">{subtitle}</div>
17
+ <content>{@render children?.()}</content>
18
+ </div>
12
19
  </section>
13
20
 
14
21
  <style>* {
@@ -1,19 +1,7 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- title: string;
5
- subtitle: string;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type DocumentProps = typeof __propDef.props;
15
- export type DocumentEvents = typeof __propDef.events;
16
- export type DocumentSlots = typeof __propDef.slots;
17
- export default class Document extends SvelteComponent<DocumentProps, DocumentEvents, DocumentSlots> {
18
- }
19
- export {};
1
+ declare const Document: import("svelte").Component<{
2
+ title: string;
3
+ subtitle: string;
4
+ children?: import("svelte").Snippet;
5
+ }, {}, "">;
6
+ type Document = ReturnType<typeof Document>;
7
+ export default Document;
@@ -1,63 +1,74 @@
1
- <script>export let title;
2
- export let subtitle = void 0;
3
- export let icon = null;
4
- export let h2Style = void 0;
5
- export let wrapStyle = void 0;
1
+ <script lang="ts">
2
+ interface Props {
3
+ title: string;
4
+ subtitle?: string | undefined;
5
+ icon?: null | string;
6
+ h2Style?: string | undefined;
7
+ wrapStyle?: string | undefined;
8
+ }
9
+
10
+ let {
11
+ title,
12
+ subtitle = undefined,
13
+ icon = null,
14
+ h2Style = undefined,
15
+ wrapStyle = undefined
16
+ }: Props = $props();
6
17
  </script>
7
18
 
8
19
  <div class="wrap document-title" style={wrapStyle}>
9
- <h2 style={h2Style}>
10
- {title}
11
- {#if icon}
12
- <div class="img-wrap">
13
- <img src={icon} alt={title} />
14
- </div>
15
- {/if}
16
- </h2>
20
+ <h2 style={h2Style}>
21
+ {title}
22
+ {#if icon}
23
+ <div class="img-wrap">
24
+ <img src={icon} alt={title} />
25
+ </div>
26
+ {/if}
27
+ </h2>
17
28
 
18
- {#if subtitle}
19
- <h3>{@html subtitle}</h3>
20
- {/if}
29
+ {#if subtitle}
30
+ <h3>{@html subtitle}</h3>
31
+ {/if}
21
32
  </div>
22
33
 
23
34
  <style>
24
- .wrap {
25
- margin-top: 100px;
26
- }
27
- h2 {
28
- font-size: 38px;
29
- font-weight: 700;
30
- margin-bottom: 10px;
31
- margin-top: 20px;
32
- text-align: center;
33
- display: flex;
34
- align-items: center;
35
- justify-content: center;
36
- }
37
- h3 {
38
- font-size: 20px;
39
- width: 650px;
40
- max-width: 100%;
41
- margin: 0 auto;
42
- font-weight: normal;
43
- line-height: 1.4;
44
- text-align: center;
45
- }
46
- .img-wrap {
47
- text-align: center;
48
- margin-left: 20px;
49
- display: inline-flex;
50
- align-items: center;
51
- }
52
- img {
53
- width: 85px;
54
- height: 85px;
55
- }
35
+ .wrap {
36
+ margin-top: 100px;
37
+ }
38
+ h2 {
39
+ font-size: 38px;
40
+ font-weight: 700;
41
+ margin-bottom: 10px;
42
+ margin-top: 20px;
43
+ text-align: center;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ }
48
+ h3 {
49
+ font-size: 20px;
50
+ width: 650px;
51
+ max-width: 100%;
52
+ margin: 0 auto;
53
+ font-weight: normal;
54
+ line-height: 1.4;
55
+ text-align: center;
56
+ }
57
+ .img-wrap {
58
+ text-align: center;
59
+ margin-left: 20px;
60
+ display: inline-flex;
61
+ align-items: center;
62
+ }
63
+ img {
64
+ width: 85px;
65
+ height: 85px;
66
+ }
56
67
 
57
- @media (max-width: 992px) {
58
- h2 {
59
- flex-direction: column-reverse;
60
- gap: 15px;
61
- }
62
- }
68
+ @media (max-width: 992px) {
69
+ h2 {
70
+ flex-direction: column-reverse;
71
+ gap: 15px;
72
+ }
73
+ }
63
74
  </style>