duckylib 0.1.2 → 0.1.3
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/Button.svelte +109 -0
- package/dist/components/buttons/Button.svelte.d.ts +10 -0
- package/dist/components/containers/AgeConfirm.svelte +98 -0
- package/dist/components/containers/AgeConfirm.svelte.d.ts +7 -0
- package/dist/components/text/Text.svelte +27 -0
- package/dist/components/text/Text.svelte.d.ts +14 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { browser } from "$app/environment";
|
|
3
|
+
import { goto } from "$app/navigation";
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
import Heading from "../text/Heading.svelte";
|
|
6
|
+
import Text from "../text/Text.svelte"
|
|
7
|
+
import { getTheme } from "../../index.js";
|
|
8
|
+
|
|
9
|
+
interface ButtonProps {
|
|
10
|
+
label: string;
|
|
11
|
+
type?: "success" | "danger" | "primary" | "secondary";
|
|
12
|
+
onclick?: (e: MouseEvent) => void;
|
|
13
|
+
href?: string | null;
|
|
14
|
+
|
|
15
|
+
size?: "large" | "normal";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
label,
|
|
20
|
+
type = "secondary",
|
|
21
|
+
onclick = (e) => {
|
|
22
|
+
console.log(`Voided Mouse Event`, e.timeStamp);
|
|
23
|
+
},
|
|
24
|
+
href = null,
|
|
25
|
+
size = "normal"
|
|
26
|
+
}: ButtonProps = $props();
|
|
27
|
+
|
|
28
|
+
let systemMode = browser ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "dark";
|
|
29
|
+
let theme = $state(getTheme());
|
|
30
|
+
|
|
31
|
+
onMount(() => {
|
|
32
|
+
window.addEventListener("theme", (e: any) => {
|
|
33
|
+
theme = e.detail.theme;
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<button
|
|
39
|
+
data-theme="{theme === "system" ? systemMode : theme}"
|
|
40
|
+
class={type}
|
|
41
|
+
onclick={(e) => {
|
|
42
|
+
if (browser && href) {
|
|
43
|
+
goto(href);
|
|
44
|
+
} else if (browser) {
|
|
45
|
+
onclick(e);
|
|
46
|
+
}
|
|
47
|
+
}}><Heading size={size === "normal" ? 6 : 5} inheritColor={true}>{label}</Heading></button
|
|
48
|
+
>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
@import url("../../styles/globals.css");
|
|
53
|
+
|
|
54
|
+
button {
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
|
|
63
|
+
outline: none;
|
|
64
|
+
border: none;
|
|
65
|
+
|
|
66
|
+
padding: 0.66em 1.33em;
|
|
67
|
+
border-radius: var(--border-md);
|
|
68
|
+
background-color: var(--overlay-2);
|
|
69
|
+
color: var(--text);
|
|
70
|
+
|
|
71
|
+
font-size: 0.7em;
|
|
72
|
+
font-weight: 700;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
button:hover {
|
|
76
|
+
transition: all 0.2s;
|
|
77
|
+
transform: scale(1.02) translateY(1px);
|
|
78
|
+
filter: brightness(1.1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
button:not(:hover) {
|
|
82
|
+
transition: all 0.2s;
|
|
83
|
+
transform: scale(1) translateY(0);
|
|
84
|
+
filter: brightness(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.danger {
|
|
88
|
+
background-color: var(--maroon);
|
|
89
|
+
color: var(--base);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.primary {
|
|
93
|
+
background-color: var(--accent);
|
|
94
|
+
color: var(--base);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.secondary {
|
|
98
|
+
background-color: var(--overlay-0);
|
|
99
|
+
color: var(--base);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.success {
|
|
103
|
+
background-color: var(--green);
|
|
104
|
+
color: var(--base);
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* .success[data-theme="dark"] */
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ButtonProps {
|
|
2
|
+
label: string;
|
|
3
|
+
type?: "success" | "danger" | "primary" | "secondary";
|
|
4
|
+
onclick?: (e: MouseEvent) => void;
|
|
5
|
+
href?: string | null;
|
|
6
|
+
size?: "large" | "normal";
|
|
7
|
+
}
|
|
8
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "">;
|
|
9
|
+
type Button = ReturnType<typeof Button>;
|
|
10
|
+
export default Button;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAgeVerified } from "../../index.js";
|
|
3
|
+
import Heading from "../text/Heading.svelte";
|
|
4
|
+
import Column from "./Column.svelte";
|
|
5
|
+
import Text from "../text/Text.svelte"
|
|
6
|
+
import Row from "./Row.svelte";
|
|
7
|
+
import { onMount } from "svelte";
|
|
8
|
+
import Button from "../buttons/Button.svelte";
|
|
9
|
+
import { browser } from "$app/environment";
|
|
10
|
+
import Symbol from "../text/Symbol.svelte";
|
|
11
|
+
import { goto } from "$app/navigation";
|
|
12
|
+
|
|
13
|
+
interface AgeConfirmProps {
|
|
14
|
+
age?: number;
|
|
15
|
+
references?: ("substances" | "sexual")[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {age = 18, references = []}: AgeConfirmProps = $props();
|
|
19
|
+
|
|
20
|
+
const referenceMap = {
|
|
21
|
+
"substances": "Alcohol, Drugs, and Substance Abuse",
|
|
22
|
+
"sexual": "Sexual Content"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let ageVerified = $state(getAgeVerified());
|
|
26
|
+
|
|
27
|
+
let loaded = $state(false);
|
|
28
|
+
|
|
29
|
+
onMount(() => {
|
|
30
|
+
window.onscroll = (e) => {
|
|
31
|
+
if(!ageVerified) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
window.scrollTo({top: 0, behavior: "instant"})
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
loaded = true;
|
|
39
|
+
}, 5e2)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
function setAgeVerified(v: boolean) {
|
|
43
|
+
if(browser) {
|
|
44
|
+
window.localStorage.setItem("av", `${v}`)
|
|
45
|
+
|
|
46
|
+
window.location.reload();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if !ageVerified}
|
|
52
|
+
<div>
|
|
53
|
+
<Column marginLeftPx="auto" marginRightPx="auto" textWrap={true}>
|
|
54
|
+
<Column heightPx="fit" textWrap={true} widthPercent={95}>
|
|
55
|
+
{#if loaded}
|
|
56
|
+
<Symbol name="no_adult_content" sizePx={64} />
|
|
57
|
+
<Heading size={2} weight="boldest">{loaded ? `Are you ${age}+?` : ""}</Heading>
|
|
58
|
+
{#if references.length > 0}
|
|
59
|
+
<Heading size={4} weight="boldest">This site contains references to</Heading>
|
|
60
|
+
<ul style="text-align: left;">
|
|
61
|
+
{#each references.map(r => referenceMap[r]) as ref}
|
|
62
|
+
<Text><li>{loaded ? ref : ""}</li></Text>
|
|
63
|
+
{/each}
|
|
64
|
+
</ul>
|
|
65
|
+
{/if}
|
|
66
|
+
<Text weight="normal" classList={["italic"]}>{loaded ? `You must be at least ${age} years old to access this website.` : ""}</Text>
|
|
67
|
+
<Row>
|
|
68
|
+
<Button label="I am {age} or older" size="large" type="success" onclick={(e) => {setAgeVerified(true)}} />
|
|
69
|
+
<Button label="I am younger than {age}" size="large" type="danger" onclick={(e) => {setAgeVerified(false)}} />
|
|
70
|
+
</Row>
|
|
71
|
+
{/if}
|
|
72
|
+
</Column>
|
|
73
|
+
</Column>
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
76
|
+
|
|
77
|
+
<style>
|
|
78
|
+
@import url("../../styles/globals.css");
|
|
79
|
+
|
|
80
|
+
div {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 110%;
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
padding: 0.33em;
|
|
90
|
+
margin: 0;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
|
|
93
|
+
background-color: var(--base);
|
|
94
|
+
color: var(--text);
|
|
95
|
+
|
|
96
|
+
z-index: 1000;
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
|
|
4
|
+
interface TextProps {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
|
|
7
|
+
inheritColor?: boolean;
|
|
8
|
+
sizePx?: number;
|
|
9
|
+
|
|
10
|
+
hoverEffect?: boolean;
|
|
11
|
+
|
|
12
|
+
classList?: ("red" | "green" | "yellow" | "strike" | "italic")[];
|
|
13
|
+
weight?: "lightest" | "lighter" | "light" | "normal" | "semibold" | "bold" | "bolder" | "boldest" | "black";
|
|
14
|
+
monospace?: boolean;
|
|
15
|
+
size?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { children, inheritColor = false, sizePx = 24, classList = [], weight = "normal", monospace = false, size = 1 }: TextProps = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<p class="{classList.join(" ")} font-{monospace ? "mono-" : ""}{weight}" style="color: {inheritColor ? "inherit" : "var(--text)"};user-select:none;">{@render children()}</p>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
@import url("../../styles/globals.css");
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
interface TextProps {
|
|
3
|
+
children: Snippet;
|
|
4
|
+
inheritColor?: boolean;
|
|
5
|
+
sizePx?: number;
|
|
6
|
+
hoverEffect?: boolean;
|
|
7
|
+
classList?: ("red" | "green" | "yellow" | "strike" | "italic")[];
|
|
8
|
+
weight?: "lightest" | "lighter" | "light" | "normal" | "semibold" | "bold" | "bolder" | "boldest" | "black";
|
|
9
|
+
monospace?: boolean;
|
|
10
|
+
size?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
}
|
|
12
|
+
declare const Text: import("svelte").Component<TextProps, {}, "">;
|
|
13
|
+
type Text = ReturnType<typeof Text>;
|
|
14
|
+
export default Text;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export {default as LoginButton} from "./components/buttons/LoginButton.svelte";
|
|
2
2
|
export {default as ThemeButton} from "./components/buttons/ThemeButton.svelte";
|
|
3
|
+
export {default as Button} from "./components/buttons/Button.svelte";
|
|
3
4
|
export {default as UserToast} from "./components/buttons/UserToast.svelte";
|
|
4
5
|
export {default as InfoCard} from "./components/containers/cards/InfoCard.svelte";
|
|
5
6
|
export {default as LinkCard} from "./components/containers/cards/LinkCard.svelte";
|
|
@@ -11,6 +12,9 @@ export {default as Website} from "./components/containers/Website.svelte";
|
|
|
11
12
|
export {default as Markdown} from "./components/text/Markdown.svelte";
|
|
12
13
|
export {default as Typewriter} from "./components/text/Typewriter.svelte";
|
|
13
14
|
export {default as Heading} from "./components/text/Heading.svelte"
|
|
15
|
+
export {default as Text} from "./components/text/Text.svelte"
|
|
16
|
+
export {default as AgeConfirm} from "./components/containers/AgeConfirm.svelte"
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
export * from "./styles/globals.css"
|
|
16
20
|
export * from "./styles/fonts.css"
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { browser } from "$app/environment";
|
|
2
2
|
export { default as LoginButton } from "./components/buttons/LoginButton.svelte";
|
|
3
3
|
export { default as ThemeButton } from "./components/buttons/ThemeButton.svelte";
|
|
4
|
+
export { default as Button } from "./components/buttons/Button.svelte";
|
|
4
5
|
export { default as UserToast } from "./components/buttons/UserToast.svelte";
|
|
5
6
|
export { default as InfoCard } from "./components/containers/cards/InfoCard.svelte";
|
|
6
7
|
export { default as LinkCard } from "./components/containers/cards/LinkCard.svelte";
|
|
@@ -12,6 +13,8 @@ export { default as Website } from "./components/containers/Website.svelte";
|
|
|
12
13
|
export { default as Markdown } from "./components/text/Markdown.svelte";
|
|
13
14
|
export { default as Typewriter } from "./components/text/Typewriter.svelte";
|
|
14
15
|
export { default as Heading } from "./components/text/Heading.svelte";
|
|
16
|
+
export { default as Text } from "./components/text/Text.svelte";
|
|
17
|
+
export { default as AgeConfirm } from "./components/containers/AgeConfirm.svelte";
|
|
15
18
|
export * from "./styles/globals.css";
|
|
16
19
|
export * from "./styles/fonts.css";
|
|
17
20
|
export * from "./styles/emojis.css";
|
|
@@ -31,3 +34,18 @@ export function getTheme() {
|
|
|
31
34
|
return "dark";
|
|
32
35
|
}
|
|
33
36
|
}
|
|
37
|
+
export function getAgeVerified() {
|
|
38
|
+
if (browser) {
|
|
39
|
+
if (window.localStorage.getItem("av") !== null) {
|
|
40
|
+
let it = window.localStorage.getItem("av");
|
|
41
|
+
return it === "true";
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
window.localStorage.setItem("av", "false");
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|