@hyvor/design 1.1.12 → 1.1.14
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/HyvorBar/BarUser.svelte +22 -18
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +2 -0
- package/dist/components/HyvorBar/BarUserPicture.svelte +33 -0
- package/dist/components/HyvorBar/BarUserPicture.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte +9 -2
- package/dist/components/HyvorBar/HyvorBar.svelte +44 -11
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +11 -1
- package/dist/components/HyvorBar/bar.d.ts +4 -5
- package/dist/components/HyvorBar/bar.js +2 -2
- package/dist/marketing/Footer/Footer.svelte +7 -1
- package/dist/marketing/Footer/Footer.svelte.d.ts +1 -0
- package/dist/marketing/Footer/RecordVisit.svelte +17 -0
- package/dist/marketing/Footer/RecordVisit.svelte.d.ts +18 -0
- package/package.json +1 -1
|
@@ -3,23 +3,27 @@
|
|
|
3
3
|
import ActionListItem from '../ActionList/ActionListItem.svelte';
|
|
4
4
|
import Dropdown from '../Dropdown/Dropdown.svelte';
|
|
5
5
|
import IconBoxArrowUpRight from '@hyvor/icons/IconBoxArrowUpRight';
|
|
6
|
-
import { barUser } from './bar.js';
|
|
7
6
|
import BarUserPreview from './BarUserPreview.svelte';
|
|
7
|
+
import BarUserPicture from './BarUserPicture.svelte';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
instance: string;
|
|
11
|
+
logoutUrl?: string;
|
|
12
|
+
cloud: boolean;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
let {
|
|
15
|
+
let {
|
|
16
|
+
instance,
|
|
17
|
+
logoutUrl = `${instance}/account/logout`,
|
|
18
|
+
cloud,
|
|
19
|
+
}: Props = $props();
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
22
|
<div class="wrap">
|
|
17
23
|
<Dropdown align="end" width={325}>
|
|
18
24
|
{#snippet trigger()}
|
|
19
25
|
<button class="user-wrap">
|
|
20
|
-
|
|
21
|
-
<img class="user-picture" src={$barUser?.picture_url} alt={$barUser?.name} />
|
|
22
|
-
{/if}
|
|
26
|
+
<BarUserPicture />
|
|
23
27
|
</button>
|
|
24
28
|
{/snippet}
|
|
25
29
|
|
|
@@ -27,15 +31,19 @@
|
|
|
27
31
|
<ActionList>
|
|
28
32
|
<BarUserPreview />
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
{#if cloud}
|
|
35
|
+
<a href="{instance}/account" target="_blank">
|
|
36
|
+
<ActionListItem>
|
|
37
|
+
Manage Account
|
|
38
|
+
{#snippet end()}
|
|
39
|
+
<IconBoxArrowUpRight size={12} />
|
|
40
|
+
{/snippet}
|
|
41
|
+
</ActionListItem>
|
|
42
|
+
</a>
|
|
43
|
+
{/if}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<a href="{logoutUrl}">
|
|
39
47
|
<ActionListItem>Logout</ActionListItem>
|
|
40
48
|
</a>
|
|
41
49
|
</ActionList>
|
|
@@ -65,8 +73,4 @@
|
|
|
65
73
|
.user-wrap:hover {
|
|
66
74
|
box-shadow: 0 0 0 4px var(--input);
|
|
67
75
|
}
|
|
68
|
-
img {
|
|
69
|
-
width: 100%;
|
|
70
|
-
height: 100%;
|
|
71
|
-
}
|
|
72
76
|
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { barUser } from "./bar.js";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
{#if $barUser}
|
|
7
|
+
{#if $barUser.picture_url}
|
|
8
|
+
<img src={$barUser.picture_url} alt={$barUser.name} />
|
|
9
|
+
{:else}
|
|
10
|
+
<span class="user-placeholder">
|
|
11
|
+
{$barUser.name ? $barUser.name[0].toUpperCase() : '?'}
|
|
12
|
+
</span>
|
|
13
|
+
{/if}
|
|
14
|
+
{/if}
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
img {
|
|
18
|
+
width: 30px;
|
|
19
|
+
height: 30px;
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
}
|
|
22
|
+
.user-placeholder {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
width: 30px;
|
|
27
|
+
height: 30px;
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
color: var(--text);
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
background-color: var(--input);
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const BarUserPicture: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type BarUserPicture = InstanceType<typeof BarUserPicture>;
|
|
18
|
+
export default BarUserPicture;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { barUser } from './bar.js';
|
|
3
|
+
import BarUserPicture from './BarUserPicture.svelte';
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
6
|
{#if $barUser}
|
|
6
7
|
<div class="preview">
|
|
7
8
|
<div class="left">
|
|
8
|
-
<
|
|
9
|
+
<BarUserPicture />
|
|
9
10
|
</div>
|
|
10
11
|
<div class="right">
|
|
11
|
-
<div class="username"
|
|
12
|
+
<div class="username">
|
|
13
|
+
{#if $barUser.username}
|
|
14
|
+
@{$barUser.username}
|
|
15
|
+
{:else if $barUser.name}
|
|
16
|
+
{$barUser.name}
|
|
17
|
+
{/if}
|
|
18
|
+
</div>
|
|
12
19
|
<div class="email">{$barUser.email}</div>
|
|
13
20
|
</div>
|
|
14
21
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import BarProducts, { PRODUCTS } from './BarProducts.svelte';
|
|
5
5
|
import BarSupport from './BarSupport.svelte';
|
|
6
|
-
import {
|
|
6
|
+
import { barUser, initBar, setInstanceAndProduct, type BarConfig, type BarUser as BarUserType } from './bar.js';
|
|
7
7
|
import BarUpdates from './BarUpdates.svelte';
|
|
8
8
|
import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
|
|
9
9
|
import BarNotice from './Notice/BarNotice.svelte';
|
|
@@ -13,9 +13,31 @@
|
|
|
13
13
|
instance?: string;
|
|
14
14
|
product: string;
|
|
15
15
|
config?: Partial<BarConfig>;
|
|
16
|
+
|
|
17
|
+
// set a custom logo URL
|
|
18
|
+
// defaults to instance + '/api/public/logo/' + product + '.svg'
|
|
19
|
+
// recommended to use this for self-hostable products
|
|
20
|
+
logo?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether it is a HYVOR cloud-hosted product.
|
|
24
|
+
* If false, we will hide some features
|
|
25
|
+
*/
|
|
26
|
+
cloud?: boolean;
|
|
27
|
+
authOverride?: {
|
|
28
|
+
user: BarUserType | null;
|
|
29
|
+
logoutUrl: string;
|
|
30
|
+
}
|
|
16
31
|
}
|
|
17
32
|
|
|
18
|
-
let {
|
|
33
|
+
let {
|
|
34
|
+
instance = 'https://hyvor.com',
|
|
35
|
+
product,
|
|
36
|
+
logo = `${instance}/api/public/logo/${product}.svg`,
|
|
37
|
+
config = {},
|
|
38
|
+
cloud = true,
|
|
39
|
+
authOverride = undefined
|
|
40
|
+
}: Props = $props();
|
|
19
41
|
|
|
20
42
|
let mobileShow = $state(false);
|
|
21
43
|
|
|
@@ -41,7 +63,14 @@
|
|
|
41
63
|
|
|
42
64
|
onMount(() => {
|
|
43
65
|
setInstanceAndProduct(instance, product);
|
|
44
|
-
|
|
66
|
+
|
|
67
|
+
if (cloud) {
|
|
68
|
+
initBar();
|
|
69
|
+
} else {
|
|
70
|
+
if (authOverride) {
|
|
71
|
+
barUser.set(authOverride.user);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
45
74
|
});
|
|
46
75
|
|
|
47
76
|
function getName() {
|
|
@@ -59,7 +88,7 @@
|
|
|
59
88
|
<div class="left">
|
|
60
89
|
<a class="logo" href="/">
|
|
61
90
|
<img
|
|
62
|
-
src={
|
|
91
|
+
src={logo}
|
|
63
92
|
alt={product}
|
|
64
93
|
width="20"
|
|
65
94
|
height="20"
|
|
@@ -74,16 +103,20 @@
|
|
|
74
103
|
<BarNotice {instance} />
|
|
75
104
|
|
|
76
105
|
<div class="hidden-on-mobile">
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
{#if cloud}
|
|
107
|
+
<BarSupport config={configComplete} {product} mobile={mobileShow} />
|
|
108
|
+
<BarProducts {instance} mobile={mobileShow} />
|
|
109
|
+
<BarUpdates {instance} {product} />
|
|
110
|
+
{/if}
|
|
80
111
|
</div>
|
|
81
112
|
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
113
|
+
{#if cloud}
|
|
114
|
+
<div class="mobile">
|
|
115
|
+
<IconCaretDownFill />
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
85
118
|
|
|
86
|
-
<BarUser {instance} />
|
|
119
|
+
<BarUser {instance} logoutUrl={authOverride?.logoutUrl} {cloud} />
|
|
87
120
|
</div>
|
|
88
121
|
</div>
|
|
89
122
|
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { type BarConfig } from './bar.js';
|
|
1
|
+
import { type BarConfig, type BarUser as BarUserType } from './bar.js';
|
|
2
2
|
interface Props {
|
|
3
3
|
instance?: string;
|
|
4
4
|
product: string;
|
|
5
5
|
config?: Partial<BarConfig>;
|
|
6
|
+
logo?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether it is a HYVOR cloud-hosted product.
|
|
9
|
+
* If false, we will hide some features
|
|
10
|
+
*/
|
|
11
|
+
cloud?: boolean;
|
|
12
|
+
authOverride?: {
|
|
13
|
+
user: BarUserType | null;
|
|
14
|
+
logoutUrl: string;
|
|
15
|
+
};
|
|
6
16
|
}
|
|
7
17
|
declare const HyvorBar: import("svelte").Component<Props, {}, "">;
|
|
8
18
|
type HyvorBar = ReturnType<typeof HyvorBar>;
|
|
@@ -5,11 +5,11 @@ export interface BarConfig {
|
|
|
5
5
|
chat: boolean;
|
|
6
6
|
g2: string | null;
|
|
7
7
|
}
|
|
8
|
-
interface BarUser {
|
|
8
|
+
export interface BarUser {
|
|
9
9
|
name: string | null;
|
|
10
|
-
username
|
|
10
|
+
username?: string | null;
|
|
11
11
|
email: string;
|
|
12
|
-
picture_url: string;
|
|
12
|
+
picture_url: string | null;
|
|
13
13
|
}
|
|
14
14
|
export interface BarUpdate {
|
|
15
15
|
id: number;
|
|
@@ -34,7 +34,7 @@ export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
|
|
|
34
34
|
export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
|
|
35
35
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
36
36
|
export declare function setInstanceAndProduct(instance_: string, product_: string): void;
|
|
37
|
-
export declare function
|
|
37
|
+
export declare function initBar(): void;
|
|
38
38
|
export declare class UnreadUpdatesTimeLocalStorage {
|
|
39
39
|
static KEY: string;
|
|
40
40
|
static get(): number | null;
|
|
@@ -49,4 +49,3 @@ export declare const bar: {
|
|
|
49
49
|
*/
|
|
50
50
|
reload: () => void;
|
|
51
51
|
};
|
|
52
|
-
export {};
|
|
@@ -9,7 +9,7 @@ export function setInstanceAndProduct(instance_, product_) {
|
|
|
9
9
|
instance = instance_;
|
|
10
10
|
product = product_;
|
|
11
11
|
}
|
|
12
|
-
export function
|
|
12
|
+
export function initBar() {
|
|
13
13
|
const query = new URLSearchParams();
|
|
14
14
|
query.set('product', product);
|
|
15
15
|
const lastUnreadTime = UnreadUpdatesTimeLocalStorage.get();
|
|
@@ -90,6 +90,6 @@ export const bar = {
|
|
|
90
90
|
* This is useful to create after, for example, a user creates a new blog
|
|
91
91
|
*/
|
|
92
92
|
reload: () => {
|
|
93
|
-
|
|
93
|
+
initBar();
|
|
94
94
|
}
|
|
95
95
|
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import IconBluesky from '@hyvor/icons/IconBluesky';
|
|
15
15
|
import { SOCIAL_LINKS, type Socials } from '../social.js';
|
|
16
16
|
import Affiliate from '../Affiliate/Affiliate.svelte';
|
|
17
|
+
import RecordVisit from './RecordVisit.svelte';
|
|
17
18
|
|
|
18
19
|
const year = new Date().getFullYear();
|
|
19
20
|
|
|
@@ -22,13 +23,15 @@
|
|
|
22
23
|
social?: Partial<Socials>;
|
|
23
24
|
center?: import('svelte').Snippet;
|
|
24
25
|
affiliate?: boolean;
|
|
26
|
+
recordVisit?: boolean;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
let {
|
|
28
30
|
email = null,
|
|
29
31
|
social = $bindable({} as Record<string, string | null>),
|
|
30
32
|
center,
|
|
31
|
-
affiliate = true
|
|
33
|
+
affiliate = true,
|
|
34
|
+
recordVisit = true
|
|
32
35
|
}: Props = $props();
|
|
33
36
|
|
|
34
37
|
social = {
|
|
@@ -117,6 +120,9 @@
|
|
|
117
120
|
<Affiliate />
|
|
118
121
|
{/if}
|
|
119
122
|
|
|
123
|
+
{#if recordVisit}
|
|
124
|
+
<RecordVisit />
|
|
125
|
+
{/if}
|
|
120
126
|
</footer>
|
|
121
127
|
|
|
122
128
|
<style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { afterNavigate } from '$app/navigation';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
|
|
5
|
+
onMount(() => {
|
|
6
|
+
const coreUrl = `${location.protocol}//${location.hostname.split('.').slice(-2).join('.')}`;
|
|
7
|
+
const script = document.createElement('script');
|
|
8
|
+
script.src = coreUrl + '/js/visit.js';
|
|
9
|
+
script.async = true;
|
|
10
|
+
document.body.appendChild(script);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterNavigate(() => {
|
|
14
|
+
const event = new CustomEvent('svelte:navigated');
|
|
15
|
+
window.dispatchEvent(event);
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const RecordVisit: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type RecordVisit = InstanceType<typeof RecordVisit>;
|
|
18
|
+
export default RecordVisit;
|
package/package.json
CHANGED