duckylib 0.1.6 → 0.1.8
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/buttons/LoginButton.svelte +4 -5
- package/dist/components/buttons/LoginButton.svelte.d.ts +1 -0
- package/dist/components/buttons/ThemeButton.svelte +24 -5
- package/dist/components/buttons/UserToast.svelte +3 -2
- package/dist/components/buttons/UserToast.svelte.d.ts +1 -0
- package/dist/components/containers/AgeConfirm.svelte +6 -5
- package/dist/components/containers/AgeConfirm.svelte.d.ts +1 -0
- package/dist/components/containers/Loading.svelte +8 -1
- package/dist/components/containers/Loading.svelte.d.ts +3 -1
- package/dist/components/containers/Website.svelte +2 -1
- package/dist/components/containers/navigation/Footer.svelte +4 -3
- package/dist/components/containers/navigation/Header.svelte +9 -5
- package/dist/components/containers/navigation/Header.svelte.d.ts +3 -1
- package/dist/components/containers/navigation/SearchBar.svelte +1 -0
- package/package.json +1 -1
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
interface LoginButtonProps {
|
|
5
5
|
label?: string;
|
|
6
6
|
withIcon?: boolean;
|
|
7
|
+
|
|
8
|
+
onlogin?: () => Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
let {label = "Log In", withIcon = true}: LoginButtonProps = $props();
|
|
11
|
+
let {label = "Log In", withIcon = true, onlogin}: LoginButtonProps = $props();
|
|
10
12
|
|
|
11
|
-
function login() {
|
|
12
|
-
console.log("login")
|
|
13
|
-
}
|
|
14
13
|
</script>
|
|
15
14
|
|
|
16
|
-
<button onclick={
|
|
15
|
+
<button onclick={async () => await onlogin}>
|
|
17
16
|
{#if withIcon}<Symbol name="account_circle" inheritColor={true} sizePx={20} hoverEffect={false} />{/if}
|
|
18
17
|
<p class="font-bold">{label}</p>
|
|
19
18
|
</button>
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
if(browser) {
|
|
34
34
|
themes.filter(t => t !== (theme === "system" ? systemMode : theme)).forEach(t => document.body.classList.remove(t))
|
|
35
35
|
document.body.classList.add(theme === "system" ? systemMode : theme)
|
|
36
|
+
|
|
37
|
+
window.addEventListener("theme", (e: any) => {
|
|
38
|
+
theme = e.detail.theme;
|
|
39
|
+
})
|
|
36
40
|
}
|
|
37
41
|
})
|
|
38
42
|
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
outline: none;
|
|
81
85
|
border: none;
|
|
82
86
|
|
|
83
|
-
color: var(--text);
|
|
87
|
+
/* color: var(--text); */
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
.icon_only {
|
|
@@ -104,23 +108,38 @@
|
|
|
104
108
|
.with_text {
|
|
105
109
|
padding: 0.2em 0.66em;
|
|
106
110
|
border-radius: var(--border-md);
|
|
107
|
-
background-color: var(--
|
|
108
|
-
color: var(--
|
|
111
|
+
background-color: var(--crust);
|
|
112
|
+
color: var(--text);
|
|
109
113
|
gap: 0.66em;
|
|
110
114
|
|
|
111
115
|
font-size: 1em;
|
|
116
|
+
border: 2px solid var(--mantle);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.btn-dark:not(.icon_only)[data-theme="system"] {
|
|
120
|
+
color: var(--teal);
|
|
121
|
+
& {
|
|
122
|
+
p {
|
|
123
|
+
color: var(--text);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
.btn-dark:not(.icon_only):not([data-theme="system"]) {
|
|
115
129
|
color: var(--yellow);
|
|
116
130
|
& {
|
|
117
131
|
p {
|
|
118
|
-
color: var(--
|
|
132
|
+
color: var(--text);
|
|
119
133
|
}
|
|
120
134
|
}
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
.btn-light:not(.icon_only) {
|
|
124
|
-
color: var(--
|
|
138
|
+
color: var(--yellow);
|
|
139
|
+
& {
|
|
140
|
+
p {
|
|
141
|
+
color: var(--text);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
125
144
|
}
|
|
126
145
|
</style>
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
interface UserToastProps {
|
|
13
13
|
user: Auth.User;
|
|
14
|
+
onlogout?: () => Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
let { user }: UserToastProps = $props();
|
|
17
|
+
let { user, onlogout }: UserToastProps = $props();
|
|
17
18
|
|
|
18
19
|
let showContextMenu = $state(false);
|
|
19
20
|
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
<contextentry
|
|
70
71
|
data-disabled="false"
|
|
71
72
|
id="log-out"
|
|
72
|
-
onclick={(
|
|
73
|
+
onclick={async () => await onlogout}
|
|
73
74
|
>
|
|
74
75
|
<span class="material-symbols-outlined">logout</span>
|
|
75
76
|
<red>Log Out</red>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import Column from "./Column.svelte";
|
|
5
5
|
import Text from "../text/Text.svelte"
|
|
6
6
|
import Row from "./Row.svelte";
|
|
7
|
-
import { onMount } from "svelte";
|
|
7
|
+
import { onMount, type Snippet } from "svelte";
|
|
8
8
|
import Button from "../buttons/Button.svelte";
|
|
9
9
|
import { browser } from "$app/environment";
|
|
10
10
|
import Symbol from "../text/Symbol.svelte";
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
interface AgeConfirmProps {
|
|
14
14
|
age?: number;
|
|
15
15
|
references?: ("substances" | "sexual" | "death" | "sh")[];
|
|
16
|
+
onDenial: (e: MouseEvent) => Promise<void>;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
let {age = 18, references = []}: AgeConfirmProps = $props();
|
|
19
|
+
let {age = 18, references = [], onDenial}: AgeConfirmProps = $props();
|
|
19
20
|
|
|
20
21
|
const referenceMap = {
|
|
21
22
|
"substances": "Alcohol, Drugs, and Substance Abuse",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
<Text weight="normal" classList={["italic"]}>{loaded ? `You must be at least ${age} years old to access this website.` : ""}</Text>
|
|
69
70
|
<Row>
|
|
70
71
|
<Button label="I am {age} or older" size="large" type="success" onclick={(e) => {setAgeVerified(true)}} />
|
|
71
|
-
<Button label="I am younger than {age}" size="large" type="danger" onclick={(e) => {setAgeVerified(false)}} />
|
|
72
|
+
<Button label="I am younger than {age}" size="large" type="danger" onclick={(e) => {setAgeVerified(false); onDenial(e);}} />
|
|
72
73
|
</Row>
|
|
73
74
|
{/if}
|
|
74
75
|
</Column>
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
left: 0;
|
|
86
87
|
|
|
87
88
|
width: 100%;
|
|
88
|
-
height:
|
|
89
|
+
height: 120%;
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
padding: 0.33em;
|
|
@@ -95,6 +96,6 @@
|
|
|
95
96
|
background-color: var(--base);
|
|
96
97
|
color: var(--text);
|
|
97
98
|
|
|
98
|
-
z-index:
|
|
99
|
+
z-index: 4000;
|
|
99
100
|
}
|
|
100
101
|
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface AgeConfirmProps {
|
|
2
2
|
age?: number;
|
|
3
3
|
references?: ("substances" | "sexual" | "death" | "sh")[];
|
|
4
|
+
onDenial: (e: MouseEvent) => Promise<void>;
|
|
4
5
|
}
|
|
5
6
|
declare const AgeConfirm: import("svelte").Component<AgeConfirmProps, {}, "">;
|
|
6
7
|
type AgeConfirm = ReturnType<typeof AgeConfirm>;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
let loaded = $state(false);
|
|
10
10
|
|
|
11
11
|
onMount(() => {
|
|
12
|
+
if(!loaded) window.scrollTo({top: 0, behavior: "instant"})
|
|
13
|
+
|
|
12
14
|
window.onscroll = (e) => {
|
|
13
15
|
if(!loaded) {
|
|
14
16
|
e.preventDefault();
|
|
@@ -22,6 +24,8 @@
|
|
|
22
24
|
}, 7e2)
|
|
23
25
|
})
|
|
24
26
|
|
|
27
|
+
let { children } = $props();
|
|
28
|
+
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
31
|
{#if !loaded}
|
|
@@ -36,6 +40,9 @@
|
|
|
36
40
|
</Column>
|
|
37
41
|
</Column>
|
|
38
42
|
</div>
|
|
43
|
+
|
|
44
|
+
{:else}
|
|
45
|
+
{@render children()}
|
|
39
46
|
{/if}
|
|
40
47
|
|
|
41
48
|
<style>
|
|
@@ -57,6 +64,6 @@
|
|
|
57
64
|
background-color: var(--base);
|
|
58
65
|
color: var(--text);
|
|
59
66
|
|
|
60
|
-
z-index:
|
|
67
|
+
z-index: 5000;
|
|
61
68
|
}
|
|
62
69
|
</style>
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
let systemMode = browser ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "dark";
|
|
17
17
|
|
|
18
|
-
let theme = $state(
|
|
18
|
+
let theme = $state("dark");
|
|
19
19
|
|
|
20
20
|
let w = $state(0)
|
|
21
21
|
let h = $state(0);
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
onMount(() => {
|
|
25
|
+
theme = getTheme();
|
|
25
26
|
if(browser) {
|
|
26
27
|
w = window.outerWidth
|
|
27
28
|
h = window.outerHeight
|
|
@@ -100,15 +100,16 @@
|
|
|
100
100
|
@import url("../../../styles/globals.css");
|
|
101
101
|
|
|
102
102
|
div {
|
|
103
|
-
|
|
104
|
-
/* left:
|
|
105
|
-
|
|
103
|
+
position: sticky;
|
|
104
|
+
/* left: 0;
|
|
105
|
+
bottom: 0; */
|
|
106
106
|
|
|
107
107
|
box-sizing: border-box;
|
|
108
108
|
padding: 0 0.66em;
|
|
109
109
|
margin-top: 3em;
|
|
110
110
|
/* margin-left: auto;
|
|
111
111
|
margin-right: auto; */
|
|
112
|
+
margin-bottom: 0.66em;
|
|
112
113
|
|
|
113
114
|
width: 90%;
|
|
114
115
|
height: 2.33em;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { PUBLIC_MOBILE_SIZE_PX, PUBLIC_TABLET_SIZE_PX } from "$env/static/public";
|
|
13
13
|
import SearchBar, { type QueryMapKeys, type SearchResult } from "./SearchBar.svelte";
|
|
14
14
|
|
|
15
|
-
interface HeaderNavigation {
|
|
15
|
+
export interface HeaderNavigation {
|
|
16
16
|
label: string;
|
|
17
17
|
pathname: string;
|
|
18
18
|
symbol: string;
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
defaultNav?: boolean;
|
|
39
39
|
|
|
40
40
|
authFeatures?: boolean;
|
|
41
|
+
onlogin?: (() => Promise<void>) | null;
|
|
42
|
+
onlogout?: (() => Promise<void>) | null;
|
|
41
43
|
|
|
42
44
|
nav?: HeaderNavigation[];
|
|
43
45
|
}
|
|
@@ -68,6 +70,8 @@
|
|
|
68
70
|
label = "",
|
|
69
71
|
|
|
70
72
|
authFeatures = false,
|
|
73
|
+
onlogin = null,
|
|
74
|
+
onlogout = null,
|
|
71
75
|
|
|
72
76
|
nav = [],
|
|
73
77
|
}: HeaderProps = $props();
|
|
@@ -160,10 +164,10 @@
|
|
|
160
164
|
{#if authFeatures}
|
|
161
165
|
<Row widthPx="fit">
|
|
162
166
|
|
|
163
|
-
{#if user !== null}
|
|
164
|
-
<UserToast {user} />
|
|
165
|
-
{:else}
|
|
166
|
-
<LoginButton label="Log in to Join" />
|
|
167
|
+
{#if user !== null && onlogout}
|
|
168
|
+
<UserToast {user} {onlogout} />
|
|
169
|
+
{:else if onlogin}
|
|
170
|
+
<LoginButton {onlogin} label="Log in to Join" />
|
|
167
171
|
{/if}
|
|
168
172
|
</Row>
|
|
169
173
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from "svelte";
|
|
2
2
|
import { type QueryMapKeys, type SearchResult } from "./SearchBar.svelte";
|
|
3
|
-
interface HeaderNavigation {
|
|
3
|
+
export interface HeaderNavigation {
|
|
4
4
|
label: string;
|
|
5
5
|
pathname: string;
|
|
6
6
|
symbol: string;
|
|
@@ -22,6 +22,8 @@ interface HeaderProps {
|
|
|
22
22
|
searchQueryDataKey?: string;
|
|
23
23
|
defaultNav?: boolean;
|
|
24
24
|
authFeatures?: boolean;
|
|
25
|
+
onlogin?: (() => Promise<void>) | null;
|
|
26
|
+
onlogout?: (() => Promise<void>) | null;
|
|
25
27
|
nav?: HeaderNavigation[];
|
|
26
28
|
}
|
|
27
29
|
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|