@hyvor/design 1.0.13 → 1.1.1
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 +28 -16
- package/dist/components/HyvorBar/HyvorBar.svelte +8 -18
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +2 -2
- package/dist/components/HyvorBar/bar.d.ts +2 -3
- 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 +3 -0
- package/dist/components/index.js +3 -0
- package/dist/marketing/Footer/Footer.svelte +14 -18
- package/dist/marketing/Footer/Footer.svelte.d.ts +3 -3
- package/dist/marketing/Header/Header.svelte +3 -1
- package/dist/marketing/Header/Header.svelte.d.ts +1 -0
- package/dist/marketing/social.d.ts +9 -0
- package/dist/marketing/social.js +8 -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';
|
|
@@ -15,6 +16,8 @@
|
|
|
15
16
|
import type { BarConfig, BarProduct } from './bar.js';
|
|
16
17
|
import G2 from './img/G2.svelte';
|
|
17
18
|
import Trustpilot from './img/Trustpilot.svelte';
|
|
19
|
+
import { SOCIAL_LINKS } from '../../marketing/social.js';
|
|
20
|
+
import IconTwitterX from '@hyvor/icons/IconTwitterX';
|
|
18
21
|
|
|
19
22
|
let supportDropdown = $state(false);
|
|
20
23
|
|
|
@@ -114,7 +117,7 @@
|
|
|
114
117
|
{/if}
|
|
115
118
|
|
|
116
119
|
<ActionListGroup title="Social">
|
|
117
|
-
<a href=
|
|
120
|
+
<a href={SOCIAL_LINKS.discord} target="_blank">
|
|
118
121
|
<ActionListItem>
|
|
119
122
|
Discord
|
|
120
123
|
{#snippet start()}
|
|
@@ -125,20 +128,29 @@
|
|
|
125
128
|
{/snippet}
|
|
126
129
|
</ActionListItem>
|
|
127
130
|
</a>
|
|
128
|
-
{
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
<a href={SOCIAL_LINKS.blueksy} target="_blank">
|
|
132
|
+
<ActionListItem>
|
|
133
|
+
Bluesky
|
|
134
|
+
{#snippet start()}
|
|
135
|
+
<IconBluesky />
|
|
136
|
+
{/snippet}
|
|
137
|
+
{#snippet end()}
|
|
138
|
+
<IconBoxArrowUpRight size={12} />
|
|
139
|
+
{/snippet}
|
|
140
|
+
</ActionListItem>
|
|
141
|
+
</a>
|
|
142
|
+
<a href={SOCIAL_LINKS.x} target="_blank">
|
|
143
|
+
<ActionListItem>
|
|
144
|
+
Twitter
|
|
145
|
+
{#snippet start()}
|
|
146
|
+
<IconTwitterX />
|
|
147
|
+
{/snippet}
|
|
148
|
+
{#snippet end()}
|
|
149
|
+
<IconBoxArrowUpRight size={12} />
|
|
150
|
+
{/snippet}
|
|
151
|
+
</ActionListItem>
|
|
152
|
+
</a>
|
|
153
|
+
<a href={SOCIAL_LINKS.linkedin} target="_blank">
|
|
142
154
|
<ActionListItem>
|
|
143
155
|
Linkedin
|
|
144
156
|
{#snippet start()}
|
|
@@ -6,15 +6,12 @@
|
|
|
6
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
|
|
|
@@ -47,24 +44,12 @@
|
|
|
47
44
|
loadBarUser();
|
|
48
45
|
});
|
|
49
46
|
|
|
50
|
-
function getLogo() {
|
|
51
|
-
if (product === 'talk') {
|
|
52
|
-
return LogoTalk;
|
|
53
|
-
} else if (product === 'blogs') {
|
|
54
|
-
return LogoBlogs;
|
|
55
|
-
} else {
|
|
56
|
-
return LogoCore;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
47
|
function getName() {
|
|
61
48
|
if (config.name) {
|
|
62
49
|
return config.name;
|
|
63
50
|
}
|
|
64
51
|
return (PRODUCTS as any)[product]?.name || 'HYVOR';
|
|
65
52
|
}
|
|
66
|
-
|
|
67
|
-
const LogoComponent = getLogo();
|
|
68
53
|
</script>
|
|
69
54
|
|
|
70
55
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
@@ -73,7 +58,12 @@
|
|
|
73
58
|
<div class="inner hds-box">
|
|
74
59
|
<div class="left">
|
|
75
60
|
<a class="logo" href="/">
|
|
76
|
-
<
|
|
61
|
+
<img
|
|
62
|
+
src={instance + '/api/public/logo/' + product + '.svg'}
|
|
63
|
+
alt={product}
|
|
64
|
+
width="20"
|
|
65
|
+
height="20"
|
|
66
|
+
/>
|
|
77
67
|
<span class="name">
|
|
78
68
|
{getName()}
|
|
79
69
|
</span>
|
|
@@ -85,7 +75,7 @@
|
|
|
85
75
|
|
|
86
76
|
<div class="hidden-on-mobile">
|
|
87
77
|
<BarSupport config={configComplete} {product} mobile={mobileShow} />
|
|
88
|
-
<BarProducts mobile={mobileShow} />
|
|
78
|
+
<BarProducts {instance} mobile={mobileShow} />
|
|
89
79
|
<BarUpdates {instance} {product} />
|
|
90
80
|
</div>
|
|
91
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,9 +1,8 @@
|
|
|
1
|
-
export type BarProduct =
|
|
1
|
+
export type BarProduct = string | 'core';
|
|
2
2
|
export interface BarConfig {
|
|
3
3
|
name: string | null;
|
|
4
4
|
docs: boolean;
|
|
5
5
|
chat: boolean;
|
|
6
|
-
twitter: string | null;
|
|
7
6
|
g2: string | null;
|
|
8
7
|
}
|
|
9
8
|
interface BarUser {
|
|
@@ -34,7 +33,7 @@ export declare const barUser: import("svelte/store").Writable<BarUser | null>;
|
|
|
34
33
|
export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
|
|
35
34
|
export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
|
|
36
35
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
37
|
-
export declare function setInstanceAndProduct(instance_: string, product_:
|
|
36
|
+
export declare function setInstanceAndProduct(instance_: string, product_: string): void;
|
|
38
37
|
export declare function loadBarUser(): void;
|
|
39
38
|
export declare class UnreadUpdatesTimeLocalStorage {
|
|
40
39
|
static KEY: string;
|
|
@@ -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;
|