@hyvor/design 1.0.12 → 1.1.0
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/BoxShadowPicker/BoxShadowPicker.svelte +148 -0
- package/dist/components/BoxShadowPicker/BoxShadowPicker.svelte.d.ts +10 -0
- package/dist/components/BoxShadowPicker/ShadowPreviewBox.svelte +25 -0
- package/dist/components/BoxShadowPicker/ShadowPreviewBox.svelte.d.ts +7 -0
- package/dist/components/ColorPicker/ColorPicker.svelte +10 -2
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +3 -0
- package/dist/components/Dark/DarkProvider.svelte +1 -1
- package/dist/components/HyvorBar/BarProducts.svelte +16 -7
- package/dist/components/HyvorBar/BarSupport.svelte +15 -3
- package/dist/components/HyvorBar/HyvorBar.svelte +11 -20
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +2 -2
- package/dist/components/HyvorBar/bar.d.ts +11 -2
- package/dist/components/HyvorBar/bar.js +18 -1
- package/dist/components/Internationalization/InternationalizationProvider.svelte +3 -2
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +1 -0
- package/dist/components/Internationalization/LanguageToggle.svelte +19 -8
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +1 -0
- package/dist/components/Internationalization/i18n.d.ts +9 -4
- package/dist/components/Internationalization/i18n.js +53 -10
- package/dist/components/NavLink/NavLink.svelte +4 -0
- package/dist/components/Slider/Slider.svelte +13 -2
- package/dist/components/Slider/Slider.svelte.d.ts +2 -0
- package/dist/components/Usage/Usage.svelte +126 -0
- package/dist/components/Usage/Usage.svelte.d.ts +12 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/marketing/Footer/Footer.svelte +2 -3
- package/dist/marketing/Header/Header.svelte +3 -1
- package/dist/marketing/Header/Header.svelte.d.ts +1 -0
- package/dist/stores/dark.d.ts +1 -0
- package/dist/stores/dark.js +4 -3
- package/dist/variables.scss +1 -1
- package/package.json +2 -2
- package/dist/marketing/Logo/LogoBlogs.svelte +0 -46
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +0 -6
- package/dist/marketing/Logo/LogoCore.svelte +0 -46
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +0 -6
- package/dist/marketing/Logo/LogoTalk.svelte +0 -32
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +0 -6
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ColorPicker from '../ColorPicker/ColorPicker.svelte';
|
|
3
|
+
import Divider from '../Divider/Divider.svelte';
|
|
4
|
+
import Dropdown from '../Dropdown/Dropdown.svelte';
|
|
5
|
+
import Slider from '../Slider/Slider.svelte';
|
|
6
|
+
import SplitControl from '../SplitControl/SplitControl.svelte';
|
|
7
|
+
import Tooltip from '../Tooltip/Tooltip.svelte';
|
|
8
|
+
import ShadowPreviewBox from './ShadowPreviewBox.svelte';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
value: string;
|
|
12
|
+
previewSize?: number;
|
|
13
|
+
oninput?: (value: string) => void;
|
|
14
|
+
align?: 'start' | 'center' | 'end';
|
|
15
|
+
position?: 'left' | 'right' | 'bottom' | 'top';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
value = $bindable(),
|
|
20
|
+
previewSize = 40,
|
|
21
|
+
oninput,
|
|
22
|
+
align = 'center',
|
|
23
|
+
position = 'bottom'
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
let shadowState = $state(parseBoxShadow(value));
|
|
27
|
+
|
|
28
|
+
function parseBoxShadow(value: string) {
|
|
29
|
+
const regex = /(-?\d+px)\s+(-?\d+px)\s+(\d+px)\s+(\d+px)\s+(#[0-9a-fA-F]{8}|\#[0-9a-fA-F]{6})/;
|
|
30
|
+
|
|
31
|
+
const match = value.match(regex);
|
|
32
|
+
|
|
33
|
+
if (match) {
|
|
34
|
+
return {
|
|
35
|
+
xOffset: parseInt(match[1]),
|
|
36
|
+
yOffset: parseInt(match[2]),
|
|
37
|
+
blur: parseInt(match[3]),
|
|
38
|
+
spread: parseInt(match[4]),
|
|
39
|
+
color: match[5]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
xOffset: 0,
|
|
45
|
+
yOffset: 0,
|
|
46
|
+
blur: 0,
|
|
47
|
+
spread: 0,
|
|
48
|
+
color: '#00000011'
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let cssValue = $derived.by(() => {
|
|
53
|
+
const { xOffset, yOffset, blur, spread, color } = shadowState;
|
|
54
|
+
const val = `${xOffset}px ${yOffset}px ${blur}px ${spread}px ${color}`;
|
|
55
|
+
return val;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function handleInput() {
|
|
59
|
+
value = cssValue;
|
|
60
|
+
if (oninput) {
|
|
61
|
+
oninput(value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function valuePxFormat(value: number) {
|
|
66
|
+
return value + 'px';
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<Dropdown {align} {position} width={500}>
|
|
71
|
+
{#snippet trigger()}
|
|
72
|
+
<Tooltip text="Click to edit box shadow">
|
|
73
|
+
<button>
|
|
74
|
+
<ShadowPreviewBox boxShadow={cssValue} size={previewSize} />
|
|
75
|
+
</button>
|
|
76
|
+
</Tooltip>
|
|
77
|
+
{/snippet}
|
|
78
|
+
|
|
79
|
+
{#snippet content()}
|
|
80
|
+
<div class="shadow-preview">
|
|
81
|
+
<ShadowPreviewBox boxShadow={cssValue} size={100} />
|
|
82
|
+
<div class="css-value">
|
|
83
|
+
{cssValue}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<Divider margin={15} />
|
|
88
|
+
|
|
89
|
+
<SplitControl label="X Offset">
|
|
90
|
+
<Slider
|
|
91
|
+
bind:value={shadowState.xOffset}
|
|
92
|
+
min={-40}
|
|
93
|
+
max={40}
|
|
94
|
+
step={1}
|
|
95
|
+
valueFormat={valuePxFormat}
|
|
96
|
+
onchange={handleInput}
|
|
97
|
+
/>
|
|
98
|
+
</SplitControl>
|
|
99
|
+
<SplitControl label="Y Offset">
|
|
100
|
+
<Slider
|
|
101
|
+
bind:value={shadowState.yOffset}
|
|
102
|
+
min={-40}
|
|
103
|
+
max={40}
|
|
104
|
+
step={1}
|
|
105
|
+
valueFormat={valuePxFormat}
|
|
106
|
+
onchange={handleInput}
|
|
107
|
+
/>
|
|
108
|
+
</SplitControl>
|
|
109
|
+
<SplitControl label="Blur">
|
|
110
|
+
<Slider
|
|
111
|
+
bind:value={shadowState.blur}
|
|
112
|
+
min={0}
|
|
113
|
+
max={20}
|
|
114
|
+
step={1}
|
|
115
|
+
valueFormat={valuePxFormat}
|
|
116
|
+
onchange={handleInput}
|
|
117
|
+
/>
|
|
118
|
+
</SplitControl>
|
|
119
|
+
<SplitControl label="Spread">
|
|
120
|
+
<Slider
|
|
121
|
+
bind:value={shadowState.spread}
|
|
122
|
+
min={0}
|
|
123
|
+
max={20}
|
|
124
|
+
step={1}
|
|
125
|
+
valueFormat={valuePxFormat}
|
|
126
|
+
onchange={handleInput}
|
|
127
|
+
/>
|
|
128
|
+
</SplitControl>
|
|
129
|
+
<SplitControl label="Color">
|
|
130
|
+
<ColorPicker bind:color={shadowState.color} alpha oninput={handleInput} />
|
|
131
|
+
</SplitControl>
|
|
132
|
+
{/snippet}
|
|
133
|
+
</Dropdown>
|
|
134
|
+
|
|
135
|
+
<style>
|
|
136
|
+
.shadow-preview {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
padding: 15px;
|
|
142
|
+
}
|
|
143
|
+
.css-value {
|
|
144
|
+
font-size: 12px;
|
|
145
|
+
color: var(--text-light);
|
|
146
|
+
margin-top: 15px;
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value: string;
|
|
3
|
+
previewSize?: number;
|
|
4
|
+
oninput?: (value: string) => void;
|
|
5
|
+
align?: 'start' | 'center' | 'end';
|
|
6
|
+
position?: 'left' | 'right' | 'bottom' | 'top';
|
|
7
|
+
}
|
|
8
|
+
declare const BoxShadowPicker: import("svelte").Component<Props, {}, "value">;
|
|
9
|
+
type BoxShadowPicker = ReturnType<typeof BoxShadowPicker>;
|
|
10
|
+
export default BoxShadowPicker;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { boxShadow, size = 60 }: { boxShadow: string; size?: number } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="wrap" style="width: {size}px; height: {size}px;">
|
|
6
|
+
<div
|
|
7
|
+
class="box"
|
|
8
|
+
style="box-shadow: {boxShadow}; width: {(size * 3) / 5}px; height: {(size * 3) / 5}px;"
|
|
9
|
+
></div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
.wrap {
|
|
14
|
+
background-color: var(--input);
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
.box {
|
|
22
|
+
background-color: #fff;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -8,13 +8,19 @@
|
|
|
8
8
|
size?: number;
|
|
9
9
|
show?: boolean;
|
|
10
10
|
'aria-label'?: string;
|
|
11
|
+
alpha?: boolean;
|
|
12
|
+
oninput?: (color: string) => void;
|
|
13
|
+
onchange?: (color: string) => void;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
let {
|
|
14
17
|
color = $bindable('#000000'),
|
|
15
18
|
size = 30,
|
|
16
19
|
show = $bindable(false),
|
|
17
|
-
'aria-label': ariaLabel = ''
|
|
20
|
+
'aria-label': ariaLabel = '',
|
|
21
|
+
alpha = false,
|
|
22
|
+
oninput,
|
|
23
|
+
onchange
|
|
18
24
|
}: Props = $props();
|
|
19
25
|
|
|
20
26
|
const dispatch = createEventDispatcher<{
|
|
@@ -24,10 +30,12 @@
|
|
|
24
30
|
|
|
25
31
|
function handleInput() {
|
|
26
32
|
dispatch('input', color);
|
|
33
|
+
oninput?.(color);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
function handleClose() {
|
|
30
37
|
dispatch('change', color);
|
|
38
|
+
onchange?.(color);
|
|
31
39
|
show = false;
|
|
32
40
|
}
|
|
33
41
|
</script>
|
|
@@ -58,7 +66,7 @@
|
|
|
58
66
|
bind:hex={color}
|
|
59
67
|
--input-size={size + 'px'}
|
|
60
68
|
isDialog={false}
|
|
61
|
-
isAlpha={
|
|
69
|
+
isAlpha={alpha}
|
|
62
70
|
on:input={handleInput}
|
|
63
71
|
/>
|
|
64
72
|
</div>
|
|
@@ -4,6 +4,9 @@ interface Props {
|
|
|
4
4
|
size?: number;
|
|
5
5
|
show?: boolean;
|
|
6
6
|
'aria-label'?: string;
|
|
7
|
+
alpha?: boolean;
|
|
8
|
+
oninput?: (color: string) => void;
|
|
9
|
+
onchange?: (color: string) => void;
|
|
7
10
|
}
|
|
8
11
|
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> {
|
|
9
12
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<script>
|
|
12
12
|
// to prevent white screen on page load
|
|
13
13
|
// until the dark mode is initialized from the store
|
|
14
|
-
const isDarkMode = !!localStorage.getItem(
|
|
14
|
+
const isDarkMode = !!localStorage.getItem("hds-dark");
|
|
15
15
|
if (isDarkMode) {
|
|
16
16
|
document.documentElement.classList.add('dark');
|
|
17
17
|
}
|
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
const PRODUCTS = {
|
|
3
3
|
talk: {
|
|
4
4
|
name: 'Hyvor Talk',
|
|
5
|
-
logo:
|
|
5
|
+
logo: undefined,
|
|
6
6
|
url: 'talk.hyvor.com',
|
|
7
|
-
description: '
|
|
7
|
+
description: 'Commenting Platform'
|
|
8
8
|
},
|
|
9
9
|
blogs: {
|
|
10
10
|
name: 'Hyvor Blogs',
|
|
11
|
-
logo:
|
|
11
|
+
logo: undefined,
|
|
12
12
|
url: 'blogs.hyvor.com',
|
|
13
13
|
description: 'Blogging Platform'
|
|
14
14
|
},
|
|
15
|
+
post: {
|
|
16
|
+
name: 'Hyvor Post',
|
|
17
|
+
url: 'post.hyvor.com',
|
|
18
|
+
logo: undefined,
|
|
19
|
+
description: 'Newsletter Platform',
|
|
20
|
+
},
|
|
15
21
|
fortguard: {
|
|
16
22
|
name: 'FortGuard',
|
|
17
23
|
logo: LogoFortguard,
|
|
@@ -23,18 +29,17 @@
|
|
|
23
29
|
</script>
|
|
24
30
|
|
|
25
31
|
<script lang="ts">
|
|
26
|
-
import LogoBlogs from '../../marketing/Logo/LogoBlogs.svelte';
|
|
27
32
|
import LogoFortguard from '../../marketing/Logo/LogoFortguard.svelte';
|
|
28
|
-
import LogoTalk from '../../marketing/Logo/LogoTalk.svelte';
|
|
29
33
|
import { ActionList, ActionListItem, Button, Dropdown } from '../index.js';
|
|
30
34
|
import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
|
|
31
35
|
import IconBoxArrowUpRight from '@hyvor/icons/IconBoxArrowUpRight';
|
|
32
36
|
|
|
33
37
|
interface Props {
|
|
34
38
|
mobile?: boolean;
|
|
39
|
+
instance: string;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
let { mobile = false }: Props = $props();
|
|
42
|
+
let { mobile = false, instance }: Props = $props();
|
|
38
43
|
</script>
|
|
39
44
|
|
|
40
45
|
<Dropdown align={mobile ? 'center' : 'end'} width={325}>
|
|
@@ -58,7 +63,11 @@
|
|
|
58
63
|
</div>
|
|
59
64
|
{/snippet}
|
|
60
65
|
{#snippet start()}
|
|
61
|
-
|
|
66
|
+
{#if product.logo}
|
|
67
|
+
<product.logo size={20} />
|
|
68
|
+
{:else}
|
|
69
|
+
<img src={instance + "/api/public/logo/" + key + ".svg"} alt={product.name} width="20" height="20" />
|
|
70
|
+
{/if}
|
|
62
71
|
{/snippet}
|
|
63
72
|
{#snippet end()}
|
|
64
73
|
<IconBoxArrowUpRight size={12} />
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import IconInfoCircle from '@hyvor/icons/IconInfoCircle';
|
|
8
8
|
import IconFileEarmark from '@hyvor/icons/IconFileEarmark';
|
|
9
9
|
import IconChatDots from '@hyvor/icons/IconChatDots';
|
|
10
|
-
import
|
|
10
|
+
import IconBluesky from '@hyvor/icons/IconBluesky';
|
|
11
|
+
import IconTwitter from '@hyvor/icons/IconTwitter';
|
|
11
12
|
import IconLinkedin from '@hyvor/icons/IconLinkedin';
|
|
12
13
|
|
|
13
14
|
import ActionListGroup from '../ActionList/ActionListGroup.svelte';
|
|
@@ -125,12 +126,23 @@
|
|
|
125
126
|
{/snippet}
|
|
126
127
|
</ActionListItem>
|
|
127
128
|
</a>
|
|
129
|
+
<a href="https://bsky.app/profile/hyvor.bsky.social" target="_blank">
|
|
130
|
+
<ActionListItem>
|
|
131
|
+
Bluesky
|
|
132
|
+
{#snippet start()}
|
|
133
|
+
<IconBluesky />
|
|
134
|
+
{/snippet}
|
|
135
|
+
{#snippet end()}
|
|
136
|
+
<IconBoxArrowUpRight size={12} />
|
|
137
|
+
{/snippet}
|
|
138
|
+
</ActionListItem>
|
|
139
|
+
</a>
|
|
128
140
|
{#if config.twitter}
|
|
129
141
|
<a href={config.twitter} target="_blank">
|
|
130
142
|
<ActionListItem>
|
|
131
|
-
Twitter
|
|
143
|
+
X (Twitter)
|
|
132
144
|
{#snippet start()}
|
|
133
|
-
<
|
|
145
|
+
<IconTwitter />
|
|
134
146
|
{/snippet}
|
|
135
147
|
{#snippet end()}
|
|
136
148
|
<IconBoxArrowUpRight size={12} />
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import BarProducts, { PRODUCTS } from './BarProducts.svelte';
|
|
5
5
|
import BarSupport from './BarSupport.svelte';
|
|
6
|
-
import { loadBarUser, type BarConfig, type BarProduct } from './bar.js';
|
|
6
|
+
import { loadBarUser, setInstanceAndProduct, type BarConfig, type BarProduct } from './bar.js';
|
|
7
7
|
import BarUpdates from './BarUpdates.svelte';
|
|
8
8
|
import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
|
|
9
|
-
import LogoTalk from '../../marketing/Logo/LogoTalk.svelte';
|
|
10
|
-
import LogoBlogs from '../../marketing/Logo/LogoBlogs.svelte';
|
|
11
|
-
import LogoCore from '../../marketing/Logo/LogoCore.svelte';
|
|
12
9
|
import BarNotice from './Notice/BarNotice.svelte';
|
|
13
10
|
import BarLicense from './Notice/BarLicense.svelte';
|
|
14
11
|
|
|
15
12
|
interface Props {
|
|
16
13
|
instance?: string;
|
|
17
|
-
product:
|
|
14
|
+
product: string;
|
|
18
15
|
config?: Partial<BarConfig>;
|
|
19
16
|
}
|
|
20
17
|
|
|
@@ -43,27 +40,16 @@
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
onMount(() => {
|
|
46
|
-
|
|
43
|
+
setInstanceAndProduct(instance, product);
|
|
44
|
+
loadBarUser();
|
|
47
45
|
});
|
|
48
46
|
|
|
49
|
-
function getLogo() {
|
|
50
|
-
if (product === 'talk') {
|
|
51
|
-
return LogoTalk;
|
|
52
|
-
} else if (product === 'blogs') {
|
|
53
|
-
return LogoBlogs;
|
|
54
|
-
} else {
|
|
55
|
-
return LogoCore;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
47
|
function getName() {
|
|
60
48
|
if (config.name) {
|
|
61
49
|
return config.name;
|
|
62
50
|
}
|
|
63
51
|
return (PRODUCTS as any)[product]?.name || 'HYVOR';
|
|
64
52
|
}
|
|
65
|
-
|
|
66
|
-
const LogoComponent = getLogo();
|
|
67
53
|
</script>
|
|
68
54
|
|
|
69
55
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
@@ -72,7 +58,12 @@
|
|
|
72
58
|
<div class="inner hds-box">
|
|
73
59
|
<div class="left">
|
|
74
60
|
<a class="logo" href="/">
|
|
75
|
-
<
|
|
61
|
+
<img
|
|
62
|
+
src={instance + '/api/public/logo/' + product + '.svg'}
|
|
63
|
+
alt={product}
|
|
64
|
+
width="20"
|
|
65
|
+
height="20"
|
|
66
|
+
/>
|
|
76
67
|
<span class="name">
|
|
77
68
|
{getName()}
|
|
78
69
|
</span>
|
|
@@ -84,7 +75,7 @@
|
|
|
84
75
|
|
|
85
76
|
<div class="hidden-on-mobile">
|
|
86
77
|
<BarSupport config={configComplete} {product} mobile={mobileShow} />
|
|
87
|
-
<BarProducts mobile={mobileShow} />
|
|
78
|
+
<BarProducts {instance} mobile={mobileShow} />
|
|
88
79
|
<BarUpdates {instance} {product} />
|
|
89
80
|
</div>
|
|
90
81
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type BarConfig
|
|
1
|
+
import { type BarConfig } from './bar.js';
|
|
2
2
|
interface Props {
|
|
3
3
|
instance?: string;
|
|
4
|
-
product:
|
|
4
|
+
product: string;
|
|
5
5
|
config?: Partial<BarConfig>;
|
|
6
6
|
}
|
|
7
7
|
declare const HyvorBar: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type BarProduct =
|
|
1
|
+
export type BarProduct = string | 'core';
|
|
2
2
|
export interface BarConfig {
|
|
3
3
|
name: string | null;
|
|
4
4
|
docs: boolean;
|
|
@@ -34,11 +34,20 @@ export declare const barUser: import("svelte/store").Writable<BarUser | null>;
|
|
|
34
34
|
export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
|
|
35
35
|
export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
|
|
36
36
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
37
|
-
export declare function
|
|
37
|
+
export declare function setInstanceAndProduct(instance_: string, product_: string): void;
|
|
38
|
+
export declare function loadBarUser(): void;
|
|
38
39
|
export declare class UnreadUpdatesTimeLocalStorage {
|
|
39
40
|
static KEY: string;
|
|
40
41
|
static get(): number | null;
|
|
41
42
|
static set(value: string): void;
|
|
42
43
|
static setNow(): void;
|
|
43
44
|
}
|
|
45
|
+
export declare const bar: {
|
|
46
|
+
/**
|
|
47
|
+
* Refetches data like user info, unread updates, billing data, etc.
|
|
48
|
+
* But does not show a loader
|
|
49
|
+
* This is useful to create after, for example, a user creates a new blog
|
|
50
|
+
*/
|
|
51
|
+
reload: () => void;
|
|
52
|
+
};
|
|
44
53
|
export {};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
|
+
let instance = '';
|
|
3
|
+
let product = 'core';
|
|
2
4
|
export const barUser = writable(null);
|
|
3
5
|
export const barUnreadUpdates = writable(0);
|
|
4
6
|
export const barLicense = writable(null);
|
|
5
7
|
export const barHasFailedInvoices = writable(false);
|
|
6
|
-
export function
|
|
8
|
+
export function setInstanceAndProduct(instance_, product_) {
|
|
9
|
+
instance = instance_;
|
|
10
|
+
product = product_;
|
|
11
|
+
}
|
|
12
|
+
export function loadBarUser() {
|
|
7
13
|
const query = new URLSearchParams();
|
|
8
14
|
query.set('product', product);
|
|
9
15
|
const lastUnreadTime = UnreadUpdatesTimeLocalStorage.get();
|
|
@@ -76,3 +82,14 @@ class BarLocalStorage {
|
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
}
|
|
85
|
+
// exported to be used from outside
|
|
86
|
+
export const bar = {
|
|
87
|
+
/**
|
|
88
|
+
* Refetches data like user info, unread updates, billing data, etc.
|
|
89
|
+
* But does not show a loader
|
|
90
|
+
* This is useful to create after, for example, a user creates a new blog
|
|
91
|
+
*/
|
|
92
|
+
reload: () => {
|
|
93
|
+
loadBarUser();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
languages: Language[];
|
|
7
|
+
forceLanguage?: string;
|
|
7
8
|
children?: import('svelte').Snippet;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
let { languages, children }: Props = $props();
|
|
11
|
-
const i18n = new InternationalizationService(languages);
|
|
11
|
+
let { languages, forceLanguage, children }: Props = $props();
|
|
12
|
+
const i18n = new InternationalizationService(languages, forceLanguage);
|
|
12
13
|
const locale = i18n.locale;
|
|
13
14
|
setContext('i18n', i18n);
|
|
14
15
|
</script>
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import { type Language, type InternationalizationService } from './i18n.js';
|
|
6
6
|
import ActionList from '../ActionList/ActionList.svelte';
|
|
7
7
|
import ActionListItem from '../ActionList/ActionListItem.svelte';
|
|
8
|
-
import Text from '../Text/Text.svelte';
|
|
9
8
|
import IconCaretDown from '@hyvor/icons/IconCaretDown';
|
|
10
9
|
import IconButton from '../IconButton/IconButton.svelte';
|
|
10
|
+
import { get } from 'svelte/store';
|
|
11
|
+
import { goto } from '$app/navigation';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
13
14
|
position?: ComponentProps<typeof Dropdown>['position'];
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
caret?: Component;
|
|
16
17
|
icon?: boolean;
|
|
17
18
|
size?: 'medium' | 'small';
|
|
19
|
+
staticPage?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
let {
|
|
@@ -22,7 +24,8 @@
|
|
|
22
24
|
align = 'start',
|
|
23
25
|
caret = IconCaretDown,
|
|
24
26
|
icon = false,
|
|
25
|
-
size = 'medium'
|
|
27
|
+
size = 'medium',
|
|
28
|
+
staticPage = false
|
|
26
29
|
}: Props = $props();
|
|
27
30
|
|
|
28
31
|
const i18n = getContext<InternationalizationService>('i18n');
|
|
@@ -31,8 +34,20 @@
|
|
|
31
34
|
let show = $state(false);
|
|
32
35
|
|
|
33
36
|
function handleClick(language: Language) {
|
|
34
|
-
i18n.setLocale(language.code);
|
|
35
37
|
show = false;
|
|
38
|
+
|
|
39
|
+
if (staticPage) {
|
|
40
|
+
const currentLocale = get(i18n.locale);
|
|
41
|
+
|
|
42
|
+
if (language.code === currentLocale) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const url = new URL(window.location.href);
|
|
46
|
+
url.pathname = url.pathname.replace(`/${currentLocale}`, `/${language.code}`);
|
|
47
|
+
goto(url.toString());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
i18n.setLocale(language.code);
|
|
36
51
|
}
|
|
37
52
|
</script>
|
|
38
53
|
|
|
@@ -68,9 +83,6 @@
|
|
|
68
83
|
<span class="name">
|
|
69
84
|
{language.name}
|
|
70
85
|
</span>
|
|
71
|
-
<Text small light>
|
|
72
|
-
{language.region}
|
|
73
|
-
</Text>
|
|
74
86
|
</ActionListItem>
|
|
75
87
|
{/each}
|
|
76
88
|
</ActionList>
|
|
@@ -80,7 +92,6 @@
|
|
|
80
92
|
|
|
81
93
|
<style>
|
|
82
94
|
.flag {
|
|
83
|
-
margin-right:
|
|
84
|
-
font-size: 20px;
|
|
95
|
+
margin-right: 3px;
|
|
85
96
|
}
|
|
86
97
|
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Readable, type Writable } from 'svelte/store';
|
|
2
2
|
import T from './T.svelte';
|
|
3
3
|
import type { ToDotPaths, I18nStrings, PrimitiveType } from './types.js';
|
|
4
|
-
export type i18nLoaderType = () => Promise<any
|
|
4
|
+
export type i18nLoaderType = () => Promise<Record<string, any>>;
|
|
5
|
+
export declare const LOCALE_LOCAL_STORAGE_KEY = "hds-language";
|
|
5
6
|
interface LanguageBase {
|
|
6
7
|
name: string;
|
|
7
8
|
flag: string;
|
|
8
|
-
region: string;
|
|
9
9
|
code: string;
|
|
10
10
|
default?: boolean;
|
|
11
11
|
}
|
|
@@ -14,6 +14,7 @@ interface LanguageWithStrings extends LanguageBase {
|
|
|
14
14
|
}
|
|
15
15
|
interface LanguageWithLoader extends LanguageBase {
|
|
16
16
|
loader: i18nLoaderType;
|
|
17
|
+
strings?: Record<string, any>;
|
|
17
18
|
}
|
|
18
19
|
export type Language = LanguageWithStrings | LanguageWithLoader;
|
|
19
20
|
export declare class InternationalizationService<StringsT extends I18nStrings = I18nStrings> {
|
|
@@ -23,13 +24,17 @@ export declare class InternationalizationService<StringsT extends I18nStrings =
|
|
|
23
24
|
strings: Writable<{}>;
|
|
24
25
|
stringsCache: Map<string, Record<string, any>>;
|
|
25
26
|
defaultStrings: Record<string, any>;
|
|
26
|
-
constructor(languages: Language[]);
|
|
27
|
+
constructor(languages: Language[], forceLanguage?: string);
|
|
28
|
+
static getLocaleFromLocalStorage(): string | null;
|
|
29
|
+
private setLocaleOnLocalStorage;
|
|
27
30
|
setStrings(code: string): void;
|
|
28
|
-
setLocale(code: string): void
|
|
31
|
+
setLocale(code: string): Promise<void>;
|
|
32
|
+
getLocale(): string;
|
|
29
33
|
register(language: Language): void;
|
|
30
34
|
found(code: string): boolean;
|
|
31
35
|
languageByCode(code: string): LanguageWithLoader | undefined;
|
|
32
36
|
t(key: ToDotPaths<StringsT>, params?: Record<string, PrimitiveType>): string;
|
|
37
|
+
static getClosestLanguageCode(code: string, availableCodes: string[]): string | null;
|
|
33
38
|
T: typeof T<StringsT>;
|
|
34
39
|
}
|
|
35
40
|
export declare function getStringByKey(messages: Record<string, any>, key: string): string | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { deepmerge } from 'deepmerge-ts';
|
|
2
|
-
import { writable, derived } from 'svelte/store';
|
|
2
|
+
import { writable, derived, get } from 'svelte/store';
|
|
3
3
|
import { t } from './t.js';
|
|
4
4
|
import T from './T.svelte';
|
|
5
|
+
export const LOCALE_LOCAL_STORAGE_KEY = 'hds-language';
|
|
5
6
|
export class InternationalizationService {
|
|
6
7
|
languages = [];
|
|
7
8
|
locale;
|
|
@@ -9,7 +10,7 @@ export class InternationalizationService {
|
|
|
9
10
|
strings = writable({});
|
|
10
11
|
stringsCache = new Map();
|
|
11
12
|
defaultStrings;
|
|
12
|
-
constructor(languages) {
|
|
13
|
+
constructor(languages, forceLanguage) {
|
|
13
14
|
const defaultLanguage = languages.find((l) => l.default);
|
|
14
15
|
if (!defaultLanguage) {
|
|
15
16
|
throw new Error('Default language not found');
|
|
@@ -26,6 +27,28 @@ export class InternationalizationService {
|
|
|
26
27
|
for (const language of languages) {
|
|
27
28
|
this.register(language);
|
|
28
29
|
}
|
|
30
|
+
const localeStorageLocale = InternationalizationService.getLocaleFromLocalStorage();
|
|
31
|
+
const browserLocale = InternationalizationService.getClosestLanguageCode(navigator.language, this.languages.map((l) => l.code));
|
|
32
|
+
if (forceLanguage) {
|
|
33
|
+
this.setLocale(forceLanguage);
|
|
34
|
+
}
|
|
35
|
+
else if (localeStorageLocale) {
|
|
36
|
+
this.setLocale(localeStorageLocale);
|
|
37
|
+
}
|
|
38
|
+
else if (browserLocale) {
|
|
39
|
+
this.setLocale(browserLocale);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
static getLocaleFromLocalStorage() {
|
|
43
|
+
if (typeof window !== 'undefined') {
|
|
44
|
+
return localStorage.getItem(LOCALE_LOCAL_STORAGE_KEY);
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
setLocaleOnLocalStorage(code) {
|
|
49
|
+
if (typeof window !== 'undefined') {
|
|
50
|
+
localStorage.setItem(LOCALE_LOCAL_STORAGE_KEY, code);
|
|
51
|
+
}
|
|
29
52
|
}
|
|
30
53
|
setStrings(code) {
|
|
31
54
|
const defaultStrings = this.defaultStrings;
|
|
@@ -33,20 +56,28 @@ export class InternationalizationService {
|
|
|
33
56
|
const merged = deepmerge(defaultStrings, strings);
|
|
34
57
|
this.strings.set(merged);
|
|
35
58
|
}
|
|
36
|
-
setLocale(code) {
|
|
59
|
+
async setLocale(code) {
|
|
37
60
|
if (this.stringsCache.has(code)) {
|
|
38
61
|
this.setStrings(code);
|
|
39
62
|
this.locale.set(code);
|
|
40
63
|
}
|
|
41
64
|
else {
|
|
42
|
-
this.languageByCode(code)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
const language = this.languageByCode(code);
|
|
66
|
+
if (!language) {
|
|
67
|
+
throw new Error(`Language with code ${code} not found`);
|
|
68
|
+
}
|
|
69
|
+
let strings = language.strings;
|
|
70
|
+
if (!strings) {
|
|
71
|
+
strings = await language.loader();
|
|
72
|
+
}
|
|
73
|
+
this.stringsCache.set(code, strings);
|
|
74
|
+
this.setStrings(code);
|
|
75
|
+
this.locale.set(code);
|
|
49
76
|
}
|
|
77
|
+
this.setLocaleOnLocalStorage(code);
|
|
78
|
+
}
|
|
79
|
+
getLocale() {
|
|
80
|
+
return get(this.locale);
|
|
50
81
|
}
|
|
51
82
|
register(language) {
|
|
52
83
|
this.languages.push({
|
|
@@ -65,6 +96,18 @@ export class InternationalizationService {
|
|
|
65
96
|
t(key, params = {}) {
|
|
66
97
|
return t(key, params, this);
|
|
67
98
|
}
|
|
99
|
+
static getClosestLanguageCode(code, availableCodes) {
|
|
100
|
+
if (availableCodes.includes(code)) {
|
|
101
|
+
return code;
|
|
102
|
+
}
|
|
103
|
+
const codeLanguagePart = code.split('-')[0];
|
|
104
|
+
for (const availableCode of availableCodes) {
|
|
105
|
+
if (availableCode.split('-')[0] === codeLanguagePart) {
|
|
106
|
+
return availableCode;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
68
111
|
T = T;
|
|
69
112
|
}
|
|
70
113
|
export function getStringByKey(messages, key) {
|
|
@@ -8,9 +8,19 @@
|
|
|
8
8
|
step?: number;
|
|
9
9
|
// export let disabled = false;
|
|
10
10
|
dots?: boolean;
|
|
11
|
+
onchange?: (value: number) => void;
|
|
12
|
+
valueFormat?: (value: number) => string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
let {
|
|
15
|
+
let {
|
|
16
|
+
min,
|
|
17
|
+
max,
|
|
18
|
+
value = $bindable(),
|
|
19
|
+
step = 1,
|
|
20
|
+
dots = false,
|
|
21
|
+
onchange,
|
|
22
|
+
valueFormat = (val) => val.toString()
|
|
23
|
+
}: Props = $props();
|
|
14
24
|
|
|
15
25
|
const dispatch = createEventDispatcher<{
|
|
16
26
|
change: number;
|
|
@@ -75,6 +85,7 @@
|
|
|
75
85
|
const newValue = min + (x / width) * (max - min);
|
|
76
86
|
value = toStep(newValue);
|
|
77
87
|
dispatch('change', value);
|
|
88
|
+
onchange?.(value);
|
|
78
89
|
}
|
|
79
90
|
</script>
|
|
80
91
|
|
|
@@ -90,7 +101,7 @@
|
|
|
90
101
|
<div class="progress" style="width: {progress}%"></div>
|
|
91
102
|
<button class="handle" style="left: {progress}%">
|
|
92
103
|
<span class="tip">
|
|
93
|
-
{value}
|
|
104
|
+
{valueFormat(value)}
|
|
94
105
|
</span>
|
|
95
106
|
</button>
|
|
96
107
|
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value: number;
|
|
5
5
|
step?: number;
|
|
6
6
|
dots?: boolean;
|
|
7
|
+
onchange?: (value: number) => void;
|
|
8
|
+
valueFormat?: (value: number) => string;
|
|
7
9
|
}
|
|
8
10
|
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> {
|
|
9
11
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
// import byteFormatter from '../../../lib/helper/byte-formatter';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
name: string;
|
|
7
|
+
current: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
bytes?: boolean;
|
|
10
|
+
warningPercentage?: number;
|
|
11
|
+
dangerPercentage?: number;
|
|
12
|
+
notIncludedText?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
name,
|
|
17
|
+
current,
|
|
18
|
+
limit,
|
|
19
|
+
bytes = false,
|
|
20
|
+
warningPercentage = 85,
|
|
21
|
+
dangerPercentage = 95,
|
|
22
|
+
notIncludedText = 'Your license does not include this feature.'
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
let width = $state('0%');
|
|
26
|
+
let percentage = $derived(Math.min(limit === 0 ? 100 : (current / limit) * 100, 100));
|
|
27
|
+
|
|
28
|
+
onMount(() => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
width = percentage + '%';
|
|
31
|
+
}, 200);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
function byteFormatter(bytes: number) {
|
|
35
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
36
|
+
if (bytes == 0) return '0 Bytes';
|
|
37
|
+
const i = parseInt(String(Math.floor(Math.log(bytes) / Math.log(1000))));
|
|
38
|
+
return Math.round(bytes / Math.pow(1000, i)) + ' ' + sizes[i];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getReadableValue(num: number) {
|
|
42
|
+
if (bytes) {
|
|
43
|
+
return byteFormatter(num);
|
|
44
|
+
}
|
|
45
|
+
return num.toLocaleString();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let color = $derived.by(() => {
|
|
49
|
+
if (percentage >= dangerPercentage) {
|
|
50
|
+
return 'var(--red-dark)';
|
|
51
|
+
} else if (percentage >= warningPercentage) {
|
|
52
|
+
return 'var(--orange-dark)';
|
|
53
|
+
} else {
|
|
54
|
+
return 'var(--accent)';
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<div class="usage-bar">
|
|
60
|
+
<div class="usage-bar-top">
|
|
61
|
+
<div class="usage-name">
|
|
62
|
+
{name}
|
|
63
|
+
</div>
|
|
64
|
+
{#if limit > 0}
|
|
65
|
+
<div class="usage-number">
|
|
66
|
+
<span class="usage-now" style:color={color === 'var(--accent)' ? 'var(--text)' : color}
|
|
67
|
+
>{getReadableValue(current)}</span
|
|
68
|
+
>
|
|
69
|
+
<span class="usage-full">/ {getReadableValue(limit)}</span>
|
|
70
|
+
</div>
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{#if limit === 0}
|
|
75
|
+
<div class="feature-not-included">{notIncludedText}</div>
|
|
76
|
+
{:else}
|
|
77
|
+
<div class="usage-bar-bar">
|
|
78
|
+
<div class="usage-bar-fill" style:width style:background={color}></div>
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<style>.usage-bar-top {
|
|
84
|
+
display: flex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.usage-name {
|
|
88
|
+
flex: 1;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.usage-now {
|
|
93
|
+
margin-right: 4px;
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.usage-full {
|
|
98
|
+
color: var(--text-light);
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.usage-bar-bar {
|
|
103
|
+
margin: 6px 0 15px;
|
|
104
|
+
width: 100%;
|
|
105
|
+
height: 15px;
|
|
106
|
+
background: var(--accent-light);
|
|
107
|
+
border-radius: 20px;
|
|
108
|
+
position: relative;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.usage-bar-fill {
|
|
113
|
+
position: absolute;
|
|
114
|
+
left: 0;
|
|
115
|
+
top: 0;
|
|
116
|
+
height: 100%;
|
|
117
|
+
background: var(--accent);
|
|
118
|
+
border-radius: 20px;
|
|
119
|
+
transition: 0.3s width ease-out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.feature-not-included {
|
|
123
|
+
color: var(--text-light);
|
|
124
|
+
font-size: 12px;
|
|
125
|
+
margin: 5px 0 15px;
|
|
126
|
+
}</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
name: string;
|
|
3
|
+
current: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
bytes?: boolean;
|
|
6
|
+
warningPercentage?: number;
|
|
7
|
+
dangerPercentage?: number;
|
|
8
|
+
notIncludedText?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Usage: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Usage = ReturnType<typeof Usage>;
|
|
12
|
+
export default Usage;
|
|
@@ -7,10 +7,12 @@ export { default as Base } from './Base/Base.svelte';
|
|
|
7
7
|
export { default as Box } from './Box/Box.svelte';
|
|
8
8
|
export { default as Button } from './Button/Button.svelte';
|
|
9
9
|
export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
|
|
10
|
+
export { default as BoxShadowPicker } from './BoxShadowPicker/BoxShadowPicker.svelte';
|
|
10
11
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
11
12
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
12
13
|
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
13
14
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
15
|
+
export { default as DarkProvider } from './Dark/DarkProvider.svelte';
|
|
14
16
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
|
15
17
|
export { default as Dropdown } from './Dropdown/Dropdown.svelte';
|
|
16
18
|
export { default as Divider } from './Divider/Divider.svelte';
|
|
@@ -20,6 +22,7 @@ export { default as InputGroup } from './FormControl/InputGroup.svelte';
|
|
|
20
22
|
export { default as Label } from './FormControl/Label.svelte';
|
|
21
23
|
export { default as Validation } from './FormControl/Validation.svelte';
|
|
22
24
|
export { default as HyvorBar } from './HyvorBar/HyvorBar.svelte';
|
|
25
|
+
export { bar as hyvorBar } from './HyvorBar/bar.js';
|
|
23
26
|
export { default as IconButton } from './IconButton/IconButton.svelte';
|
|
24
27
|
export { default as Link } from './Link/Link.svelte';
|
|
25
28
|
export { default as Loader } from './Loader/Loader.svelte';
|
|
@@ -42,6 +45,7 @@ export { default as Text } from './Text/Text.svelte';
|
|
|
42
45
|
export { default as TextInput } from './TextInput/TextInput.svelte';
|
|
43
46
|
export { default as toast } from './Toast/toast.js';
|
|
44
47
|
export { default as Tooltip } from './Tooltip/Tooltip.svelte';
|
|
48
|
+
export { default as Usage } from './Usage/Usage.svelte';
|
|
45
49
|
export { default as IconMessage } from './IconMessage/IconMessage.svelte';
|
|
46
50
|
export { clickOutside } from './directives/clickOutside.js';
|
|
47
51
|
export { default as InternationalizationProvider } from './Internationalization/InternationalizationProvider.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -7,10 +7,12 @@ export { default as Base } from './Base/Base.svelte';
|
|
|
7
7
|
export { default as Box } from './Box/Box.svelte';
|
|
8
8
|
export { default as Button } from './Button/Button.svelte';
|
|
9
9
|
export { default as ButtonGroup } from './Button/ButtonGroup.svelte';
|
|
10
|
+
export { default as BoxShadowPicker } from './BoxShadowPicker/BoxShadowPicker.svelte';
|
|
10
11
|
export { default as Callout } from './Callout/Callout.svelte';
|
|
11
12
|
export { default as Checkbox } from './Checkbox/Checkbox.svelte';
|
|
12
13
|
export { default as CodeBlock } from './CodeBlock/CodeBlock.svelte';
|
|
13
14
|
export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
|
|
15
|
+
export { default as DarkProvider } from './Dark/DarkProvider.svelte';
|
|
14
16
|
export { default as DarkToggle } from './Dark/DarkToggle.svelte';
|
|
15
17
|
export { default as Dropdown } from './Dropdown/Dropdown.svelte';
|
|
16
18
|
export { default as Divider } from './Divider/Divider.svelte';
|
|
@@ -20,6 +22,7 @@ export { default as InputGroup } from './FormControl/InputGroup.svelte';
|
|
|
20
22
|
export { default as Label } from './FormControl/Label.svelte';
|
|
21
23
|
export { default as Validation } from './FormControl/Validation.svelte';
|
|
22
24
|
export { default as HyvorBar } from './HyvorBar/HyvorBar.svelte';
|
|
25
|
+
export { bar as hyvorBar } from './HyvorBar/bar.js';
|
|
23
26
|
export { default as IconButton } from './IconButton/IconButton.svelte';
|
|
24
27
|
export { default as Link } from './Link/Link.svelte';
|
|
25
28
|
export { default as Loader } from './Loader/Loader.svelte';
|
|
@@ -42,6 +45,7 @@ export { default as Text } from './Text/Text.svelte';
|
|
|
42
45
|
export { default as TextInput } from './TextInput/TextInput.svelte';
|
|
43
46
|
export { default as toast } from './Toast/toast.js';
|
|
44
47
|
export { default as Tooltip } from './Tooltip/Tooltip.svelte';
|
|
48
|
+
export { default as Usage } from './Usage/Usage.svelte';
|
|
45
49
|
export { default as IconMessage } from './IconMessage/IconMessage.svelte';
|
|
46
50
|
// directives
|
|
47
51
|
export { clickOutside } from './directives/clickOutside.js';
|
|
@@ -89,15 +89,14 @@
|
|
|
89
89
|
<a href={social.youtube} target="_blank" rel="nofollow"><IconYoutube /></a>
|
|
90
90
|
{/if}
|
|
91
91
|
{#if social.linkedin}
|
|
92
|
-
<a href={social.linkedin} target="_blank" rel="nofollow"><IconLinkedin /></a
|
|
93
|
-
>
|
|
92
|
+
<a href={social.linkedin} target="_blank" rel="nofollow"><IconLinkedin /></a>
|
|
94
93
|
{/if}
|
|
95
94
|
</div>
|
|
96
95
|
</div>
|
|
97
96
|
|
|
98
97
|
<div class="footer-top-right">
|
|
99
98
|
<span class="language-toggle-wrap">
|
|
100
|
-
<LanguageToggle />
|
|
99
|
+
<LanguageToggle align="end" position="top" staticPage />
|
|
101
100
|
</span>
|
|
102
101
|
</div>
|
|
103
102
|
</div>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
interface Props {
|
|
9
9
|
logo: string;
|
|
10
10
|
name?: string;
|
|
11
|
+
href?: string;
|
|
11
12
|
subName?: undefined | string;
|
|
12
13
|
darkToggle?: boolean;
|
|
13
14
|
center?: import('svelte').Snippet;
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
let {
|
|
18
19
|
logo,
|
|
19
20
|
name = 'HYVOR',
|
|
21
|
+
href = '/',
|
|
20
22
|
subName = undefined,
|
|
21
23
|
darkToggle = true,
|
|
22
24
|
center,
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
<header>
|
|
28
30
|
<Container as="nav">
|
|
29
31
|
<div class="nav-start">
|
|
30
|
-
<a class="nav-brand" href
|
|
32
|
+
<a class="nav-brand" {href}>
|
|
31
33
|
<img src={logo} alt="Hyvor Logo" width="30" height="30" />
|
|
32
34
|
<span class="brand-product">
|
|
33
35
|
<span class="brand">{name}</span>
|
package/dist/stores/dark.d.ts
CHANGED
package/dist/stores/dark.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
2
|
export const dark = writable(false);
|
|
3
|
+
export const DARK_LOCAL_STORAGE_KEY = 'hds-dark';
|
|
3
4
|
export function setInitialState() {
|
|
4
5
|
const isDark = isDarkScheme();
|
|
5
6
|
if (isDark) {
|
|
@@ -8,16 +9,16 @@ export function setInitialState() {
|
|
|
8
9
|
dark.subscribe((isDark) => {
|
|
9
10
|
if (isDark) {
|
|
10
11
|
document.documentElement.classList.add('dark');
|
|
11
|
-
window.localStorage.setItem(
|
|
12
|
+
window.localStorage.setItem(DARK_LOCAL_STORAGE_KEY, 'true');
|
|
12
13
|
}
|
|
13
14
|
else {
|
|
14
15
|
document.documentElement.classList.remove('dark');
|
|
15
|
-
window.localStorage.removeItem(
|
|
16
|
+
window.localStorage.removeItem(DARK_LOCAL_STORAGE_KEY);
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
function isDarkScheme() {
|
|
20
|
-
const localStorageData = window.localStorage.getItem(
|
|
21
|
+
const localStorageData = window.localStorage.getItem(DARK_LOCAL_STORAGE_KEY);
|
|
21
22
|
if (localStorageData) {
|
|
22
23
|
return !!localStorageData;
|
|
23
24
|
}
|
package/dist/variables.scss
CHANGED
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@fontsource/readex-pro": "^5.0.8",
|
|
51
|
-
"@hyvor/icons": "^1.1.
|
|
51
|
+
"@hyvor/icons": "^1.1.1",
|
|
52
52
|
"deepmerge-ts": "^5.1.0",
|
|
53
53
|
"highlight.js": "^11.9.0",
|
|
54
54
|
"intl-messageformat": "^10.5.11",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"version": "1.0
|
|
62
|
+
"version": "1.1.0"
|
|
63
63
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
size?: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
let { size = 40 }: Props = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<svg width={size} height={size} viewBox="0 0 132.29166 132.29167" version="1.1">
|
|
10
|
-
<g id="layer1">
|
|
11
|
-
<g id="g1067">
|
|
12
|
-
<rect
|
|
13
|
-
style="mix-blend-mode:normal;fill:#f1e8e8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:7.15826;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
14
|
-
id="rect1001"
|
|
15
|
-
width="77.870262"
|
|
16
|
-
height="123.57672"
|
|
17
|
-
x="26.535261"
|
|
18
|
-
y="5.0260782"
|
|
19
|
-
ry="38.935131"
|
|
20
|
-
transform="rotate(-0.58211807)"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
id="path1003"
|
|
24
|
-
style="mix-blend-mode:normal;fill:#896c6b;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:7.15826;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
25
|
-
d="m 105.07895,65.75026 0.23219,22.852048 C 105.53028,110.17126 88.342531,127.71185 66.773582,127.931 45.204632,128.15014 27.664036,110.96239 27.44489,89.393446 L 27.212709,66.541399 Z"
|
|
26
|
-
/>
|
|
27
|
-
<g id="g1011" transform="matrix(1.0727824,0,0,1.0727824,-4.7282157,-11.786447)">
|
|
28
|
-
<path
|
|
29
|
-
id="path1005"
|
|
30
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
31
|
-
d="m 59.684412,40.713463 c 0,-2.381274 -3.065933,-4.311677 -6.847956,-4.311677 -3.782022,0 -6.847956,1.930403 -6.847956,4.311677"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
id="path1007"
|
|
35
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
36
|
-
d="m 86.142762,40.713463 c 0,-2.381274 -3.065933,-4.311677 -6.847956,-4.311677 -3.782022,0 -6.847956,1.930403 -6.847956,4.311677"
|
|
37
|
-
/>
|
|
38
|
-
<path
|
|
39
|
-
id="path1009"
|
|
40
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
41
|
-
d="m 72.699971,55.496735 c 0,2.381274 -3.065933,4.311677 -6.847956,4.311677 -3.782022,0 -6.847956,-1.930403 -6.847956,-4.311677"
|
|
42
|
-
/>
|
|
43
|
-
</g>
|
|
44
|
-
</g>
|
|
45
|
-
</g>
|
|
46
|
-
</svg>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
size?: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
let { size = 40 }: Props = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<svg width={size} height={size} viewBox="0 0 500 500" version="1.1">
|
|
10
|
-
<g id="layer1">
|
|
11
|
-
<g id="g5140" transform="translate(-986.41349,-538.31731)">
|
|
12
|
-
<rect
|
|
13
|
-
style="mix-blend-mode:normal;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:27.0548;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
14
|
-
id="rect1001"
|
|
15
|
-
width="294.31281"
|
|
16
|
-
height="467.06161"
|
|
17
|
-
x="1081.1842"
|
|
18
|
-
y="567.30737"
|
|
19
|
-
ry="147.1564"
|
|
20
|
-
transform="rotate(-0.582118)"
|
|
21
|
-
/>
|
|
22
|
-
<path
|
|
23
|
-
id="path1003"
|
|
24
|
-
style="mix-blend-mode:normal;fill:#666666;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:27.0548;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
25
|
-
d="m 1383.5623,786.82223 0.8775,86.36995 c 0.8283,81.52045 -64.1333,147.81562 -145.6537,148.64392 -81.5205,0.8282 -147.8157,-64.13337 -148.6439,-145.65379 l -0.8776,-86.36995 z"
|
|
26
|
-
/>
|
|
27
|
-
<g id="g1011" transform="matrix(4.0546107,0,0,4.0546107,968.54304,493.77011)">
|
|
28
|
-
<path
|
|
29
|
-
id="path1005"
|
|
30
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
31
|
-
d="m 59.684412,40.713463 c 0,-2.381274 -3.065933,-4.311677 -6.847956,-4.311677 -3.782022,0 -6.847956,1.930403 -6.847956,4.311677"
|
|
32
|
-
/>
|
|
33
|
-
<path
|
|
34
|
-
id="path1007"
|
|
35
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
36
|
-
d="m 86.142762,40.713463 c 0,-2.381274 -3.065933,-4.311677 -6.847956,-4.311677 -3.782022,0 -6.847956,1.930403 -6.847956,4.311677"
|
|
37
|
-
/>
|
|
38
|
-
<path
|
|
39
|
-
id="path1009"
|
|
40
|
-
style="fill:none;stroke:#000000;stroke-width:6.19866;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
|
|
41
|
-
d="m 72.699971,55.496735 c 0,2.381274 -3.065933,4.311677 -6.847956,4.311677 -3.782022,0 -6.847956,-1.930403 -6.847956,-4.311677"
|
|
42
|
-
/>
|
|
43
|
-
</g>
|
|
44
|
-
</g>
|
|
45
|
-
</g>
|
|
46
|
-
</svg>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
size?: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
let { size = 40 }: Props = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 132.292 132.292"
|
|
10
|
-
><g stroke-width="7.158" stroke="#000" fill-rule="evenodd"
|
|
11
|
-
><rect
|
|
12
|
-
width="77.87"
|
|
13
|
-
height="123.577"
|
|
14
|
-
x="26.535"
|
|
15
|
-
y="5.026"
|
|
16
|
-
ry="38.935"
|
|
17
|
-
transform="rotate(359.418)"
|
|
18
|
-
fill="#fff3d3"
|
|
19
|
-
/><path
|
|
20
|
-
d="M105.079 65.75l.232 22.852c.219 21.569-16.969 39.11-38.538 39.329s-39.11-16.969-39.329-38.538l-.232-22.852z"
|
|
21
|
-
fill="#ffd969"
|
|
22
|
-
/></g
|
|
23
|
-
><path
|
|
24
|
-
d="M59.3 31.89c0-2.555-3.289-4.625-7.346-4.625s-7.346 2.071-7.346 4.625m43.076 0c0-2.555-3.289-4.625-7.346-4.625s-7.346 2.071-7.346 4.625m.271 15.859c0 2.555-3.289 4.625-7.346 4.625s-7.346-2.071-7.346-4.625"
|
|
25
|
-
stroke="#000"
|
|
26
|
-
paint-order="stroke fill markers"
|
|
27
|
-
fill="none"
|
|
28
|
-
stroke-linecap="round"
|
|
29
|
-
stroke-linejoin="round"
|
|
30
|
-
stroke-width="6.65"
|
|
31
|
-
/></svg
|
|
32
|
-
>
|