duckylib 0.1.5 → 0.1.7

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.
@@ -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(--overlay-2);
108
- color: var(--base);
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(--base);
132
+ color: var(--text);
119
133
  }
120
134
  }
121
135
  }
122
136
 
123
137
  .btn-light:not(.icon_only) {
124
- color: var(--surface-0);
138
+ color: var(--yellow);
139
+ & {
140
+ p {
141
+ color: var(--text);
142
+ }
143
+ }
125
144
  }
126
145
  </style>
@@ -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: 110%;
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: 1000;
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: 2000;
67
+ z-index: 5000;
61
68
  }
62
69
  </style>
@@ -1,3 +1,5 @@
1
- declare const Loading: import("svelte").Component<Record<string, never>, {}, "">;
1
+ declare const Loading: import("svelte").Component<{
2
+ children: any;
3
+ }, {}, "">;
2
4
  type Loading = ReturnType<typeof Loading>;
3
5
  export default Loading;
@@ -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(getTheme());
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
- /* position: absolute; */
104
- /* left: 5%; */
105
- /* bottom: 0.33em; */
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;
@@ -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;
@@ -294,6 +294,7 @@
294
294
  showBar = false;
295
295
  showInput = false;
296
296
  searching = false;
297
+ closeResults();
297
298
  }
298
299
  }}
299
300
  >
package/dist/index.d.ts CHANGED
@@ -0,0 +1,41 @@
1
+ import { browser } from "$app/environment";
2
+ import type {Auth} from "./types.ts"
3
+
4
+ export {default as LoginButton} from "./components/buttons/LoginButton.svelte";
5
+ export {default as ThemeButton} from "./components/buttons/ThemeButton.svelte";
6
+ export {default as Button} from "./components/buttons/Button.svelte";
7
+ export {default as UserToast} from "./components/buttons/UserToast.svelte";
8
+
9
+ export {default as InfoCard} from "./components/containers/cards/InfoCard.svelte";
10
+ export {default as ButtonCard} from "./components/containers/cards/ButtonCard.svelte";
11
+
12
+ export {default as Footer} from "./components/containers/navigation/Footer.svelte";
13
+ export {default as Header} from "./components/containers/navigation/Header.svelte";
14
+ export {default as SearchBar} from "./components/containers/navigation/SearchBar.svelte"
15
+
16
+ export {default as AgeConfirm} from "./components/containers/AgeConfirm.svelte"
17
+ export {default as Column} from "./components/containers/Column.svelte";
18
+ export {default as Row} from "./components/containers/Row.svelte";
19
+ export {default as Website} from "./components/containers/Website.svelte";
20
+ export {default as HorizontalRule} from "./components/containers/HorizontalRule.svelte";
21
+
22
+ export {default as Markdown} from "./components/text/Markdown.svelte";
23
+ export {default as Typewriter} from "./components/text/Typewriter.svelte";
24
+ export {default as Heading} from "./components/text/Heading.svelte";
25
+ export {default as Text} from "./components/text/Text.svelte";
26
+ export {default as Code} from "./components/text/Code.svelte";
27
+
28
+ export * from "./types.ts"
29
+ export * from "./styles/globals.css"
30
+ export * from "./styles/fonts.css"
31
+ export * from "./styles/emojis.css"
32
+ export * from "./styles/icons.css"
33
+ export * from "./styles/theme.css"
34
+
35
+ export declare function getTheme(): "dark" | "light" | "system"
36
+
37
+ export declare function getAgeVerified(): boolean
38
+
39
+ export declare function getUserData(): Auth.User | null
40
+
41
+ export declare function setUserData(user: Auth.User): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "duckylib",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",