@hyvor/design 0.0.51 → 0.0.52
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.
- package/dist/components/Base/Base.svelte +5 -1
- package/dist/components/Base/Base.svelte.d.ts +3 -1
- package/dist/components/ColorPicker/ColorPicker.svelte +5 -15
- package/dist/marketing/Docs/Content/Content.svelte +10 -0
- package/dist/marketing/Docs/Docs.svelte +10 -4
- package/dist/marketing/Docs/Nav/Nav.svelte +121 -20
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte +32 -0
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +23 -0
- package/dist/marketing/Docs/Toc.svelte +140 -15
- package/dist/marketing/Header/Header.svelte +8 -0
- package/package.json +3 -2
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import DarkProvider from "./../Dark/DarkProvider.svelte";
|
|
3
3
|
import "../../index.js";
|
|
4
4
|
import ToastProvider from "../Toast/ToastProvider.svelte";
|
|
5
|
+
export let dark = false;
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
8
|
<div id="base">
|
|
8
9
|
<slot />
|
|
9
10
|
</div>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
{#if dark}
|
|
13
|
+
<DarkProvider />
|
|
14
|
+
{/if}
|
|
15
|
+
|
|
12
16
|
<ToastProvider />
|
|
13
17
|
<ConfirmModalProvider />
|
|
@@ -14,7 +14,7 @@ function handleClose() {
|
|
|
14
14
|
}
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<span>
|
|
17
|
+
<span class="color-picker">
|
|
18
18
|
<button
|
|
19
19
|
style:width="{size}px"
|
|
20
20
|
style:height="{size}px"
|
|
@@ -23,7 +23,8 @@ function handleClose() {
|
|
|
23
23
|
></button>
|
|
24
24
|
|
|
25
25
|
{#if show}
|
|
26
|
-
<div
|
|
26
|
+
<div
|
|
27
|
+
class="color-picker-wrap"
|
|
27
28
|
use:clickOutside={{
|
|
28
29
|
callback: () => handleClose(),
|
|
29
30
|
}}
|
|
@@ -39,30 +40,19 @@ function handleClose() {
|
|
|
39
40
|
{/if}
|
|
40
41
|
</span>
|
|
41
42
|
|
|
42
|
-
<!-- <span>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<input
|
|
46
|
-
type="color"
|
|
47
|
-
bind:value={color}
|
|
48
|
-
bind:this={inputEl}
|
|
49
|
-
|
|
50
|
-
on:change
|
|
51
|
-
on:input
|
|
52
|
-
/>
|
|
53
|
-
</span> -->
|
|
54
|
-
|
|
55
43
|
<style>
|
|
56
44
|
span {
|
|
57
45
|
position: relative;
|
|
58
46
|
}
|
|
59
47
|
button {
|
|
60
48
|
border-radius: 50%;
|
|
49
|
+
border: 1px solid var(--border);
|
|
61
50
|
}
|
|
62
51
|
div {
|
|
63
52
|
position: absolute;
|
|
64
53
|
left: 0;
|
|
65
54
|
top: 100%;
|
|
66
55
|
width: 0;
|
|
56
|
+
z-index: 1000;
|
|
67
57
|
}
|
|
68
58
|
</style>
|
|
@@ -132,4 +132,14 @@ content :global(h5 a:not(.heading-anchor-link)),
|
|
|
132
132
|
content :global(h6 a:not(.heading-anchor-link)) {
|
|
133
133
|
text-decoration: none;
|
|
134
134
|
color: inherit;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@media (max-width: 992px) {
|
|
138
|
+
.content-wrap {
|
|
139
|
+
padding-top: 0;
|
|
140
|
+
order: 2;
|
|
141
|
+
}
|
|
142
|
+
content {
|
|
143
|
+
padding: 20px 25px;
|
|
144
|
+
}
|
|
135
145
|
}</style>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import Sidebar from "./Sidebar/Sidebar.svelte";
|
|
4
3
|
</script>
|
|
5
4
|
<div class="docs">
|
|
6
5
|
|
|
7
6
|
<slot name="nav" />
|
|
8
7
|
<slot name="content" />
|
|
9
|
-
<
|
|
10
|
-
|
|
8
|
+
<Sidebar />
|
|
11
9
|
</div>
|
|
12
10
|
|
|
13
11
|
<style>
|
|
@@ -22,4 +20,12 @@
|
|
|
22
20
|
/* min-height: calc(100vh - var(--header-height)); */
|
|
23
21
|
}
|
|
24
22
|
|
|
23
|
+
|
|
24
|
+
@media (max-width: 992px) {
|
|
25
|
+
.docs {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
</style>
|
|
@@ -1,30 +1,131 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import { afterNavigate, onNavigate } from "$app/navigation";
|
|
2
|
+
import { page } from "$app/stores";
|
|
3
|
+
import { IconList } from "@hyvor/icons";
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
import { clickOutside } from "../../../components/index.js";
|
|
6
|
+
let navEl;
|
|
7
|
+
let active = null;
|
|
8
|
+
function setActive() {
|
|
9
|
+
const activeEl = navEl?.querySelector("a.active");
|
|
10
|
+
if (!activeEl || !(activeEl instanceof HTMLElement)) {
|
|
11
|
+
active = null;
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const category = activeEl.closest(".nav-category")?.querySelector(".name")?.innerText || null;
|
|
15
|
+
active = {
|
|
16
|
+
name: activeEl.innerText,
|
|
17
|
+
category
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
onMount(() => {
|
|
21
|
+
setActive();
|
|
22
|
+
});
|
|
23
|
+
afterNavigate(() => {
|
|
24
|
+
setActive();
|
|
25
|
+
hideNavOnMobile();
|
|
26
|
+
});
|
|
27
|
+
let mobileNavShown = false;
|
|
28
|
+
function handleMobileClick(e) {
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
if (navEl.style.display !== "block") {
|
|
31
|
+
navEl.style.display = "block";
|
|
32
|
+
mobileNavShown = true;
|
|
33
|
+
} else {
|
|
34
|
+
navEl.style.display = "none";
|
|
35
|
+
mobileNavShown = false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function handleNavOutsideClick() {
|
|
39
|
+
if (mobileNavShown) {
|
|
40
|
+
navEl.style.display = "none";
|
|
41
|
+
mobileNavShown = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function hideNavOnMobile() {
|
|
45
|
+
if (window.innerWidth < 992) {
|
|
46
|
+
navEl.style.display = "none";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
2
49
|
</script>
|
|
3
50
|
|
|
4
51
|
<div class="docs-nav">
|
|
5
52
|
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
53
|
+
{#if active}
|
|
54
|
+
<button class="mobile hds-box" on:click={handleMobileClick}>
|
|
55
|
+
<div class="left">
|
|
56
|
+
{#if active.category}
|
|
57
|
+
<span class="category">{active.category}</span> »
|
|
58
|
+
{/if}
|
|
59
|
+
<span class="name">{active.name}</span>
|
|
60
|
+
</div>
|
|
61
|
+
<IconList size={18} />
|
|
62
|
+
</button>
|
|
63
|
+
{/if}
|
|
9
64
|
|
|
65
|
+
<nav
|
|
66
|
+
class="hds-box nav-inner"
|
|
67
|
+
bind:this={navEl}
|
|
68
|
+
use:clickOutside={{
|
|
69
|
+
callback: handleNavOutsideClick
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<slot />
|
|
73
|
+
</nav>
|
|
10
74
|
</div>
|
|
11
75
|
|
|
12
|
-
<style
|
|
76
|
+
<style>.docs-nav {
|
|
77
|
+
width: 220px;
|
|
78
|
+
top: var(--header-height, 0);
|
|
79
|
+
padding: 25px 0;
|
|
80
|
+
position: sticky;
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
align-self: flex-start;
|
|
83
|
+
max-height: calc(100vh - var(--header-height));
|
|
84
|
+
}
|
|
13
85
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
align-self: flex-start;
|
|
21
|
-
max-height: calc(100vh - var(--header-height));
|
|
22
|
-
}
|
|
86
|
+
nav {
|
|
87
|
+
padding: 15px 0;
|
|
88
|
+
overflow-y: auto;
|
|
89
|
+
max-height: calc(100vh - var(--header-height) - 50px);
|
|
90
|
+
}
|
|
23
91
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
92
|
+
.mobile {
|
|
93
|
+
display: none;
|
|
94
|
+
padding: 10px 20px;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
.mobile:hover {
|
|
98
|
+
background-color: var(--hover);
|
|
99
|
+
}
|
|
100
|
+
.mobile .left {
|
|
101
|
+
flex: 1;
|
|
102
|
+
}
|
|
29
103
|
|
|
30
|
-
|
|
104
|
+
@media (max-width: 992px) {
|
|
105
|
+
.mobile {
|
|
106
|
+
display: flex;
|
|
107
|
+
width: 100%;
|
|
108
|
+
text-align: left;
|
|
109
|
+
}
|
|
110
|
+
.nav-inner {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
.docs-nav {
|
|
114
|
+
width: 100%;
|
|
115
|
+
position: relative;
|
|
116
|
+
top: 0;
|
|
117
|
+
padding: 0 15px;
|
|
118
|
+
margin: 20px 0;
|
|
119
|
+
max-height: initial;
|
|
120
|
+
order: 1;
|
|
121
|
+
}
|
|
122
|
+
nav {
|
|
123
|
+
padding: 0;
|
|
124
|
+
max-height: initial;
|
|
125
|
+
position: absolute;
|
|
126
|
+
width: calc(100% - 30px);
|
|
127
|
+
margin-top: 10px;
|
|
128
|
+
max-height: 500px;
|
|
129
|
+
z-index: 100;
|
|
130
|
+
}
|
|
131
|
+
}</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Toc from "../Toc.svelte";
|
|
3
|
+
|
|
4
|
+
</script>
|
|
5
|
+
<div class="sidebar">
|
|
6
|
+
<Toc />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
|
|
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>
|
|
@@ -0,0 +1,23 @@
|
|
|
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<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[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: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,23 +1,148 @@
|
|
|
1
|
-
<script>import
|
|
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
|
+
});
|
|
19
|
+
});
|
|
20
|
+
afterNavigate(() => {
|
|
21
|
+
tocbot.refresh();
|
|
22
|
+
});
|
|
23
|
+
let mobileShown = false;
|
|
24
|
+
function handleMobileClick(e) {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
if (!mobileShown) {
|
|
27
|
+
tocElement.style.display = "block";
|
|
28
|
+
mobileShown = true;
|
|
29
|
+
} else {
|
|
30
|
+
tocElement.style.display = "none";
|
|
31
|
+
mobileShown = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
2
34
|
</script>
|
|
3
35
|
|
|
4
|
-
<div class="
|
|
36
|
+
<div class="wrap hds-box">
|
|
5
37
|
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
38
|
+
<div class="mobile">
|
|
39
|
+
<Button color="input" on:click={handleMobileClick}>
|
|
40
|
+
Table of Contents
|
|
41
|
+
<svelte:fragment slot="end">
|
|
42
|
+
{#if mobileShown}
|
|
43
|
+
<IconCaretDown size={14} />
|
|
44
|
+
{:else}
|
|
45
|
+
<IconCaretRight size={14} />
|
|
46
|
+
{/if}
|
|
47
|
+
</svelte:fragment>
|
|
48
|
+
</Button>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="toc-wrap" bind:this={tocElement}>
|
|
52
|
+
<Loader block padding={30} size="small" />
|
|
53
|
+
</div>
|
|
9
54
|
|
|
10
55
|
</div>
|
|
11
56
|
|
|
12
|
-
<style
|
|
57
|
+
<style>.wrap {
|
|
58
|
+
padding: 25px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.toc-wrap {
|
|
62
|
+
align-self: flex-start;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
}
|
|
65
|
+
.toc-wrap :global(&.toc) {
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
}
|
|
68
|
+
.toc-wrap :global(> .toc-list) {
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
position: relative;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
position: relative;
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding-left: 15px;
|
|
75
|
+
}
|
|
76
|
+
.toc-wrap :global(> .toc-list) :global(li) {
|
|
77
|
+
list-style: none;
|
|
78
|
+
}
|
|
79
|
+
.toc-wrap :global(.js-toc) {
|
|
80
|
+
overflow-y: hidden;
|
|
81
|
+
}
|
|
82
|
+
.toc-wrap :global(.toc-list) {
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding-left: 15px;
|
|
85
|
+
}
|
|
86
|
+
.toc-wrap :global(.toc-list) :global(li) {
|
|
87
|
+
list-style: none;
|
|
88
|
+
}
|
|
89
|
+
.toc-wrap :global(a.toc-link) {
|
|
90
|
+
color: currentColor;
|
|
91
|
+
height: 100%;
|
|
92
|
+
display: inline-block;
|
|
93
|
+
padding: 3px 0;
|
|
94
|
+
}
|
|
95
|
+
.toc-wrap :global(a.toc-link):hover {
|
|
96
|
+
text-decoration: underline;
|
|
97
|
+
}
|
|
98
|
+
.toc-wrap :global(.is-collapsible) {
|
|
99
|
+
max-height: 1000px;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
transition: all 300ms ease-in-out;
|
|
102
|
+
}
|
|
103
|
+
.toc-wrap :global(.is-collapsed) {
|
|
104
|
+
max-height: 0;
|
|
105
|
+
}
|
|
106
|
+
.toc-wrap :global(.is-position-fixed) {
|
|
107
|
+
position: fixed !important;
|
|
108
|
+
top: 0;
|
|
109
|
+
}
|
|
110
|
+
.toc-wrap :global(.is-active-link) {
|
|
111
|
+
font-weight: 700;
|
|
112
|
+
}
|
|
113
|
+
.toc-wrap :global(.toc-link::before) {
|
|
114
|
+
background-color: #EEE;
|
|
115
|
+
content: " ";
|
|
116
|
+
display: inline-block;
|
|
117
|
+
height: inherit;
|
|
118
|
+
left: 0;
|
|
119
|
+
margin-top: -1px;
|
|
120
|
+
position: absolute;
|
|
121
|
+
width: 2px;
|
|
122
|
+
}
|
|
123
|
+
.toc-wrap :global(.is-active-link::before) {
|
|
124
|
+
background-color: var(--accent);
|
|
125
|
+
}
|
|
13
126
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
padding: 25px 0;
|
|
18
|
-
position: sticky;
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
align-self: flex-start;
|
|
21
|
-
}
|
|
127
|
+
.mobile {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
22
130
|
|
|
23
|
-
|
|
131
|
+
@media (max-width: 992px) {
|
|
132
|
+
.wrap {
|
|
133
|
+
padding: 10px 15px;
|
|
134
|
+
}
|
|
135
|
+
.mobile {
|
|
136
|
+
display: block;
|
|
137
|
+
}
|
|
138
|
+
.toc-wrap {
|
|
139
|
+
display: none;
|
|
140
|
+
margin-top: 15px;
|
|
141
|
+
}
|
|
142
|
+
:global(.is-active-link) {
|
|
143
|
+
font-weight: normal !important;
|
|
144
|
+
}
|
|
145
|
+
:global(.is-active-link::before) {
|
|
146
|
+
background-color: #eee !important;
|
|
147
|
+
}
|
|
148
|
+
}</style>
|
|
@@ -195,4 +195,12 @@ header :global(nav) {
|
|
|
195
195
|
|
|
196
196
|
.mobile-content :global(.button) {
|
|
197
197
|
display: flex;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
Scroll padding top is used to prevent the content from being hidden behind the header
|
|
202
|
+
https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-padding-top
|
|
203
|
+
*/
|
|
204
|
+
:global(html) {
|
|
205
|
+
scroll-padding-top: calc(var(--header-height) + 20px);
|
|
198
206
|
}</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyvor/design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"scripts": {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"@fontsource/readex-pro": "^5.0.8",
|
|
48
48
|
"@hyvor/icons": "^0.0.3",
|
|
49
49
|
"highlight.js": "^11.9.0",
|
|
50
|
-
"svelte-awesome-color-picker": "^3.0.4"
|
|
50
|
+
"svelte-awesome-color-picker": "^3.0.4",
|
|
51
|
+
"tocbot": "^4.25.0"
|
|
51
52
|
},
|
|
52
53
|
"type": "module",
|
|
53
54
|
"publishConfig": {
|