@turnipxenon/pineapple 2.4.13 → 2.4.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/.idea/discord.xml +1 -1
- package/.idea/workspace.xml +125 -110
- package/.svelte-kit/__package__/app.postcss +28 -2
- package/.svelte-kit/__package__/assets/icons/close.svg +1 -0
- package/.svelte-kit/__package__/components/Card.svelte +1 -1
- package/.svelte-kit/__package__/components/Chip.svelte +1 -0
- package/.svelte-kit/__package__/components/{layouts → pineapple}/PineappleBaseLayout.svelte +48 -24
- package/.svelte-kit/__package__/components/pineapple/overlay_manager/OverlayManager.d.ts +0 -0
- package/.svelte-kit/__package__/components/pineapple/overlay_manager/OverlayManager.js +1 -0
- package/.svelte-kit/__package__/components/pineapple/toast/DefaultToastBody.d.ts +8 -0
- package/.svelte-kit/__package__/components/pineapple/toast/DefaultToastBody.js +1 -0
- package/.svelte-kit/__package__/components/pineapple/toast/DefaultToastBody.svelte +48 -0
- package/.svelte-kit/__package__/components/pineapple/toast/DefaultToastBody.svelte.d.ts +20 -0
- package/.svelte-kit/__package__/components/pineapple/toast/Toast.d.ts +27 -0
- package/.svelte-kit/__package__/components/pineapple/toast/Toast.js +37 -0
- package/.svelte-kit/__package__/components/pineapple/toast/Toast.svelte +89 -0
- package/.svelte-kit/__package__/components/pineapple/toast/Toast.svelte.d.ts +14 -0
- package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.d.ts +5 -0
- package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.js +1 -0
- package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.svelte +1 -0
- package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.svelte.d.ts +23 -0
- package/.svelte-kit/__package__/index.d.ts +1 -1
- package/.svelte-kit/__package__/index.js +1 -1
- package/.svelte-kit/generated/client/app.js +1 -1
- package/.svelte-kit/generated/client/nodes/5.js +1 -1
- package/.svelte-kit/generated/server/internal.js +1 -1
- package/.svelte-kit/types/route_meta_data.json +1 -1
- package/.svelte-kit/types/src/routes/$types.d.ts +1 -1
- package/.svelte-kit/types/src/routes/(pineapple)/$types.d.ts +1 -1
- package/.svelte-kit/types/src/routes/(pineapple)/{personal → pineapple}/$types.d.ts +1 -1
- package/dist/app.postcss +28 -2
- package/dist/assets/icons/close.svg +1 -0
- package/dist/components/Card.svelte +1 -1
- package/dist/components/Chip.svelte +1 -0
- package/dist/components/{layouts → pineapple}/PineappleBaseLayout.svelte +48 -24
- package/dist/components/pineapple/overlay_manager/OverlayManager.d.ts +0 -0
- package/dist/components/pineapple/overlay_manager/OverlayManager.js +1 -0
- package/dist/components/pineapple/toast/DefaultToastBody.d.ts +8 -0
- package/dist/components/pineapple/toast/DefaultToastBody.js +1 -0
- package/dist/components/pineapple/toast/DefaultToastBody.svelte +48 -0
- package/dist/components/pineapple/toast/DefaultToastBody.svelte.d.ts +20 -0
- package/dist/components/pineapple/toast/Toast.d.ts +27 -0
- package/dist/components/pineapple/toast/Toast.js +37 -0
- package/dist/components/pineapple/toast/Toast.svelte +89 -0
- package/dist/components/pineapple/toast/Toast.svelte.d.ts +14 -0
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.d.ts +5 -0
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.js +1 -0
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.svelte +1 -0
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.svelte.d.ts +23 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/docs/OverlaySpec.md +23 -0
- package/docs/pull_request_template.md +34 -0
- package/package.json +1 -1
- package/src/lib/app.postcss +28 -2
- package/src/lib/assets/icons/close.svg +1 -0
- package/src/lib/components/Card.svelte +1 -1
- package/src/lib/components/Chip.svelte +1 -0
- package/src/lib/components/pineapple/PineappleBaseLayout.svelte +207 -0
- package/src/lib/components/pineapple/overlay_manager/OverlayManager.ts +0 -0
- package/src/lib/components/pineapple/toast/DefaultToastBody.svelte +43 -0
- package/src/lib/components/pineapple/toast/DefaultToastBody.ts +10 -0
- package/src/lib/components/pineapple/toast/Toast.svelte +113 -0
- package/src/lib/components/pineapple/toast/Toast.ts +57 -0
- package/src/lib/components/pineapple/toast/custom-toast/TestCustomToast.svelte +1 -0
- package/src/lib/components/pineapple/toast/custom-toast/TestCustomToast.ts +6 -0
- package/src/lib/index.ts +1 -1
- package/src/routes/(pineapple)/+layout.svelte +1 -1
- package/src/routes/(pineapple)/+page.svelte +2 -2
- package/src/routes/(pineapple)/pineapple/+page.svelte +44 -0
- package/src/lib/components/layouts/PineappleBaseLayout.svelte +0 -182
- package/src/routes/(pineapple)/personal/+page.svelte +0 -37
- /package/.svelte-kit/__package__/components/{layouts → pineapple}/PineappleBaseLayout.svelte.d.ts +0 -0
- /package/dist/components/{layouts → pineapple}/PineappleBaseLayout.svelte.d.ts +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
|
+
import DefaultToastBody from "./DefaultToastBody.svelte";
|
|
3
|
+
/**
|
|
4
|
+
* Default toast duration is 5 seconds
|
|
5
|
+
*/
|
|
6
|
+
export const DefaultToastParamsDuration = 5000;
|
|
7
|
+
/**
|
|
8
|
+
* todo: do not call directly documentation
|
|
9
|
+
*/
|
|
10
|
+
export const activeToast = writable();
|
|
11
|
+
export const toastQueue = [];
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param newToast
|
|
15
|
+
*/
|
|
16
|
+
export const showComponentInToast = (newToast) => {
|
|
17
|
+
// todo: queue component
|
|
18
|
+
activeToast.update((currentToast) => {
|
|
19
|
+
if (currentToast !== undefined) {
|
|
20
|
+
toastQueue.push(newToast);
|
|
21
|
+
return currentToast;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return newToast;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export const showTextInToast = (message) => {
|
|
29
|
+
showComponentInToast({
|
|
30
|
+
componentAndProps: {
|
|
31
|
+
component: DefaultToastBody,
|
|
32
|
+
props: {
|
|
33
|
+
message
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script>import {
|
|
2
|
+
activeToast,
|
|
3
|
+
DefaultToastParamsDuration,
|
|
4
|
+
toastQueue
|
|
5
|
+
} from "./Toast";
|
|
6
|
+
import {} from "svelte";
|
|
7
|
+
import Card from "../../Card.svelte";
|
|
8
|
+
import { spring, tweened } from "svelte/motion";
|
|
9
|
+
let localComponent;
|
|
10
|
+
let localProps;
|
|
11
|
+
const HIDDEN_VALUE = -15;
|
|
12
|
+
const SHOWN_VALUE = 0;
|
|
13
|
+
const progress = tweened(0, { duration: DefaultToastParamsDuration });
|
|
14
|
+
const position = spring(HIDDEN_VALUE);
|
|
15
|
+
position.damping = 0.4;
|
|
16
|
+
let isDismissed = false;
|
|
17
|
+
let shouldEnableButton = false;
|
|
18
|
+
const onToastDisappear = () => {
|
|
19
|
+
localComponent = void 0;
|
|
20
|
+
activeToast.update(() => {
|
|
21
|
+
if (toastQueue.length === 0) {
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
return toastQueue.shift();
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
activeToast.subscribe((params) => {
|
|
28
|
+
if (!params) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (params.componentAndProps?.component === localComponent) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
localComponent = params.componentAndProps.component;
|
|
35
|
+
localProps = params.componentAndProps.props;
|
|
36
|
+
progress.set(0, { duration: 0 }).then(() => {
|
|
37
|
+
position.set(SHOWN_VALUE).then(() => {
|
|
38
|
+
shouldEnableButton = true;
|
|
39
|
+
progress.set(100, { delay: 500, duration: params.duration ?? DefaultToastParamsDuration }).then(() => {
|
|
40
|
+
shouldEnableButton = false;
|
|
41
|
+
if (isDismissed) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
position.set(HIDDEN_VALUE).then(onToastDisappear);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
const dismissToast = () => {
|
|
50
|
+
shouldEnableButton = false;
|
|
51
|
+
isDismissed = true;
|
|
52
|
+
position.set(HIDDEN_VALUE).then(onToastDisappear);
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
{#if (localComponent !== undefined)}
|
|
57
|
+
<div class="toast-positioner" style={`bottom: ${$position}lh;`}>
|
|
58
|
+
<!-- todo: adjust shadow to be more dynamic or transparent -->
|
|
59
|
+
<Card marginBottom="1lh" overrideStyle="box-shadow: 3px 3px 3px var(--shadow-color);">
|
|
60
|
+
<div slot="content">
|
|
61
|
+
{#if (localProps !== undefined)}
|
|
62
|
+
<svelte:component this={localComponent}
|
|
63
|
+
props={localProps}
|
|
64
|
+
dismissToastCallback={dismissToast}
|
|
65
|
+
shouldEnableButton={shouldEnableButton} />
|
|
66
|
+
{:else }
|
|
67
|
+
<svelte:component this={localComponent} />
|
|
68
|
+
{/if}
|
|
69
|
+
<progress id="toast-progress" value={$progress/100}></progress>
|
|
70
|
+
</div>
|
|
71
|
+
</Card>
|
|
72
|
+
</div>
|
|
73
|
+
{/if}
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.toast-positioner {
|
|
77
|
+
position: fixed;
|
|
78
|
+
/* 12em = this component's margin (4em) + fab margin + width (8em) */
|
|
79
|
+
max-width: calc(100vw - 12em);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.toast-positioner:dir(ltr) {
|
|
83
|
+
left: 2em;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.toast-positioner:dir(rtl) {
|
|
87
|
+
right: 2em;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type ToastProps = typeof __propDef.props;
|
|
10
|
+
export type ToastEvents = typeof __propDef.events;
|
|
11
|
+
export type ToastSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Toast extends SvelteComponent<ToastProps, ToastEvents, ToastSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import TestCustomToast from "./TestCustomToast.svelte";
|
package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.svelte
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Testing bad custom card</h1>
|
package/.svelte-kit/__package__/components/pineapple/toast/custom-toast/TestCustomToast.svelte.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} TestCustomToastProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} TestCustomToastEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} TestCustomToastSlots */
|
|
4
|
+
export default class TestCustomToast extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type TestCustomToastProps = typeof __propDef.props;
|
|
11
|
+
export type TestCustomToastEvents = typeof __propDef.events;
|
|
12
|
+
export type TestCustomToastSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as PineappleLayoutBase } from "./components/
|
|
1
|
+
export { default as PineappleLayoutBase } from "./components/pineapple/PineappleBaseLayout.svelte";
|
|
2
2
|
export { default as SeaweedTemplate } from "./template/SeaweedTemplate.svelte";
|
|
3
3
|
export { default as LazyAsset } from "./components/LazyAsset.svelte";
|
|
4
4
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as PineappleLayoutBase } from "./components/
|
|
1
|
+
export { default as PineappleLayoutBase } from "./components/pineapple/PineappleBaseLayout.svelte";
|
|
2
2
|
export { default as SeaweedTemplate } from "./template/SeaweedTemplate.svelte";
|
|
3
3
|
export { default as LazyAsset } from "./components/LazyAsset.svelte";
|
|
4
4
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as component } from "../../../../src/routes/(pineapple)/
|
|
1
|
+
export { default as component } from "../../../../src/routes/(pineapple)/pineapple/+page.svelte";
|
|
@@ -21,7 +21,7 @@ export const options = {
|
|
|
21
21
|
app: ({ head, body, assets, nonce, env }) => "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width\" />\n\t\t" + head + "\n\t</head>\n\n\t<body data-sveltekit-preload-data=\"hover\" data-theme=\"crimson\">\n\t\t<div style=\"display: contents\" class=\"h-full overflow-hidden\">" + body + "</div>\n\t</body>\n</html>\n",
|
|
22
22
|
error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
|
|
23
23
|
},
|
|
24
|
-
version_hash: "
|
|
24
|
+
version_hash: "3q1q8i"
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export async function get_hooks() {
|
|
@@ -11,7 +11,7 @@ type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Pa
|
|
|
11
11
|
type EnsureDefined<T> = T extends null | undefined ? {} : T;
|
|
12
12
|
type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
|
|
13
13
|
export type Snapshot<T = any> = Kit.Snapshot<T>;
|
|
14
|
-
type LayoutRouteId = RouteId | "/(pineapple)" | "/(pineapple)/
|
|
14
|
+
type LayoutRouteId = RouteId | "/(pineapple)" | "/(pineapple)/pineapple" | "/(seaweed)/portfolio" | "/(seaweed)/portfolio/actual" | null
|
|
15
15
|
type LayoutParams = RouteParams & { }
|
|
16
16
|
type LayoutParentData = EnsureDefined<{}>;
|
|
17
17
|
|
|
@@ -12,7 +12,7 @@ type EnsureDefined<T> = T extends null | undefined ? {} : T;
|
|
|
12
12
|
type OptionalUnion<U extends Record<string, any>, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
|
|
13
13
|
export type Snapshot<T = any> = Kit.Snapshot<T>;
|
|
14
14
|
type PageParentData = Omit<EnsureDefined<import('../$types.js').LayoutData>, keyof LayoutData> & EnsureDefined<LayoutData>;
|
|
15
|
-
type LayoutRouteId = RouteId | "/(pineapple)" | "/(pineapple)/
|
|
15
|
+
type LayoutRouteId = RouteId | "/(pineapple)" | "/(pineapple)/pineapple"
|
|
16
16
|
type LayoutParams = RouteParams & { }
|
|
17
17
|
type LayoutParentData = EnsureDefined<import('../$types.js').LayoutData>;
|
|
18
18
|
|
|
@@ -4,7 +4,7 @@ type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
type MatcherParam<M> = M extends (param : string) => param is infer U ? U extends string ? U : string : string;
|
|
6
6
|
type RouteParams = { };
|
|
7
|
-
type RouteId = '/(pineapple)/
|
|
7
|
+
type RouteId = '/(pineapple)/pineapple';
|
|
8
8
|
type MaybeWithVoid<T> = {} extends T ? T | void : T;
|
|
9
9
|
export type RequiredKeys<T> = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];
|
|
10
10
|
type OutputDataShape<T> = MaybeWithVoid<Omit<App.PageData, RequiredKeys<T>> & Partial<Pick<App.PageData, keyof T & keyof App.PageData>> & Record<string, any>>
|
package/dist/app.postcss
CHANGED
|
@@ -41,11 +41,11 @@ html, body {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/* todo: add some hues to the icon that should be in sync with primary and make them not pure darkness */
|
|
44
|
-
.turnip-button > img {
|
|
44
|
+
.turnip-button > img, .img-icon {
|
|
45
45
|
filter: grayscale(100%) brightness(0%) invert(25%);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.dark .turnip-button > img {
|
|
48
|
+
.dark .turnip-button > img, .dark .img-icon {
|
|
49
49
|
filter: grayscale(100%) brightness(0%) invert(100%);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -164,4 +164,30 @@ a:active {
|
|
|
164
164
|
.accordion-item {
|
|
165
165
|
@apply variant-filled-primary rounded-md;
|
|
166
166
|
}
|
|
167
|
+
|
|
167
168
|
/* endregion Accordion css for handling missing styles in package */
|
|
169
|
+
|
|
170
|
+
:root {
|
|
171
|
+
--shadow-color: rgba(91, 79, 54, 0.5);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* todo: adjust shadow for each component + change depending on dark mode or not */
|
|
175
|
+
.fab, #shell-header {
|
|
176
|
+
box-shadow: 3px 3px 3px var(--shadow-color);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#toast-progress {
|
|
180
|
+
position: relative;
|
|
181
|
+
top: 5px;
|
|
182
|
+
left: 6px;
|
|
183
|
+
width: calc(100% - 12px);
|
|
184
|
+
border-radius: 8px;
|
|
185
|
+
background: transparent;
|
|
186
|
+
height: 10px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
#toast-progress::-moz-progress-bar {
|
|
190
|
+
/*background-color: red;*/
|
|
191
|
+
background: rgba(var(--color-secondary-500));
|
|
192
|
+
}
|
|
193
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import RandomizedBackground from "../RandomizedBackground.svelte";
|
|
3
3
|
import { page } from "$app/stores";
|
|
4
4
|
import { enableBackground } from "../../store";
|
|
5
|
-
import DialogOverlay from "../DialogOverlay.svelte";
|
|
6
5
|
import AresLogo from "../../assets/characters/ares/ares_logo.webp";
|
|
7
6
|
import FABIcon from "../../assets/placeholder/placeholder_circle.png";
|
|
8
7
|
import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
|
|
8
|
+
import Toast from "./toast/Toast.svelte";
|
|
9
9
|
let pages = [];
|
|
10
10
|
const updateBreadcrumb = (pathname) => {
|
|
11
11
|
pages = [];
|
|
@@ -57,15 +57,18 @@ enableDialogueOverlay.subscribe((value) => {
|
|
|
57
57
|
<AppShell>
|
|
58
58
|
<svelte:fragment slot="header">
|
|
59
59
|
<!-- App Bar -->
|
|
60
|
-
<AppBar
|
|
60
|
+
<AppBar
|
|
61
|
+
background="app-shell-token"
|
|
62
|
+
slotDefault="place-content-start"
|
|
63
|
+
slotTrail="place-content-end">
|
|
61
64
|
<svelte:fragment slot="lead">
|
|
62
65
|
<!--TODO: add logo or something for the lead in layout-->
|
|
63
66
|
<img
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
alt="Ares's head titled towards the left with his tongue out and winking"
|
|
68
|
+
class="ares-logo"
|
|
69
|
+
src={AresLogo}
|
|
67
70
|
/>
|
|
68
|
-
<span class="mr-2"/>
|
|
71
|
+
<span class="mr-2" />
|
|
69
72
|
<ol class="breadcrumb">
|
|
70
73
|
{#each pages as crumb, i}
|
|
71
74
|
{#if i < pages.length - 1}
|
|
@@ -80,24 +83,30 @@ enableDialogueOverlay.subscribe((value) => {
|
|
|
80
83
|
</ol>
|
|
81
84
|
</svelte:fragment>
|
|
82
85
|
<svelte:fragment slot="trail">
|
|
83
|
-
<LightSwitch bgLight="bg-surface-400"/>
|
|
86
|
+
<LightSwitch bgLight="bg-surface-400" />
|
|
84
87
|
</svelte:fragment>
|
|
85
88
|
</AppBar>
|
|
86
89
|
</svelte:fragment>
|
|
87
90
|
|
|
88
|
-
<RandomizedBackground enable={enableBackgroundValue}/>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<slot
|
|
100
|
-
|
|
91
|
+
<RandomizedBackground enable={enableBackgroundValue} />
|
|
92
|
+
|
|
93
|
+
<Toast></Toast>
|
|
94
|
+
|
|
95
|
+
<div class="default-page-container">
|
|
96
|
+
<slot />
|
|
97
|
+
<div class="footer-space" />
|
|
98
|
+
</div>
|
|
99
|
+
<!--{#if enableDialogueOverlayValue}-->
|
|
100
|
+
<!-- <!– Page Route Content –>-->
|
|
101
|
+
<!-- <div class="default-page-container">-->
|
|
102
|
+
<!-- <slot />-->
|
|
103
|
+
<!-- <div class="footer-space" />-->
|
|
104
|
+
<!-- </div>-->
|
|
105
|
+
<!-- <DialogOverlay />-->
|
|
106
|
+
<!--{:else}-->
|
|
107
|
+
<!-- <DialogOverlay />-->
|
|
108
|
+
<!-- <slot />-->
|
|
109
|
+
<!--{/if}-->
|
|
101
110
|
</AppShell>
|
|
102
111
|
|
|
103
112
|
<style>
|
|
@@ -105,6 +114,19 @@ enableDialogueOverlay.subscribe((value) => {
|
|
|
105
114
|
--dialog-left-pad: clamp(0em, 5vw, 2em);
|
|
106
115
|
--dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-left-pad) - var(--theme-border-base)));
|
|
107
116
|
--dialog-box-height: clamp(15em, 50vw, 18em);
|
|
117
|
+
|
|
118
|
+
/** FAB icon margin/position calculation origin:
|
|
119
|
+
Criteria:
|
|
120
|
+
- We want at mobile (360px) our margin to be at 1em (16px)
|
|
121
|
+
- We want at web (1960px) our margin to be at 2em (32px)
|
|
122
|
+
|
|
123
|
+
A useful scaling factor might vw. At 360px, 16px would be around 4.44vw (360/16).
|
|
124
|
+
At 360px: margin is at 16px or 1em.
|
|
125
|
+
At 1960px: 4.44vw is at 87px but that will be clamped to 32px or 2em.
|
|
126
|
+
The calculation implies that the natural point that the margin becomes 2em is clamped on
|
|
127
|
+
wider screens is at 727px.
|
|
128
|
+
*/
|
|
129
|
+
--fab-margin: clamp(1em, 4.44vw, 2em);
|
|
108
130
|
}
|
|
109
131
|
|
|
110
132
|
.default-page-container {
|
|
@@ -194,15 +216,17 @@ enableDialogueOverlay.subscribe((value) => {
|
|
|
194
216
|
}
|
|
195
217
|
|
|
196
218
|
.fab {
|
|
197
|
-
|
|
198
|
-
|
|
219
|
+
position: fixed;
|
|
220
|
+
bottom: var(--fab-margin);
|
|
221
|
+
width: 4em;
|
|
222
|
+
border-radius: 50%;
|
|
199
223
|
}
|
|
200
224
|
|
|
201
225
|
.fab:dir(ltr) {
|
|
202
|
-
|
|
226
|
+
right: var(--fab-margin);
|
|
203
227
|
}
|
|
204
228
|
|
|
205
229
|
.fab:dir(rtl) {
|
|
206
|
-
|
|
230
|
+
left: var(--fab-margin);
|
|
207
231
|
}
|
|
208
232
|
</style>
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import DefaultToastBody from "./DefaultToastBody.svelte";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>import CloseIcon from "../../../assets/icons/close.svg";
|
|
2
|
+
export let props;
|
|
3
|
+
export let dismissToastCallback;
|
|
4
|
+
export let shouldEnableButton = false;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div class="body-container">
|
|
8
|
+
<!-- todo: support markdown? -->
|
|
9
|
+
<button class="btn"
|
|
10
|
+
disabled={!shouldEnableButton}
|
|
11
|
+
on:click={dismissToastCallback}>
|
|
12
|
+
<img class="img-icon" src={CloseIcon} alt="close button">
|
|
13
|
+
</button>
|
|
14
|
+
<div class="text-container">
|
|
15
|
+
<span>{props.message}</span>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
.body-container {
|
|
21
|
+
display: flex;
|
|
22
|
+
gap: 1em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.text-container {
|
|
26
|
+
margin-top: 0.25lh;
|
|
27
|
+
margin-right: 1em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.text-container:dir(rtl) {
|
|
31
|
+
margin-left: 1em;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.btn {
|
|
35
|
+
--tw-bg-opacity: 1;
|
|
36
|
+
background-color: rgb(var(--color-surface-100) / var(--tw-bg-opacity));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:is(.dark .btn) {
|
|
40
|
+
--tw-bg-opacity: 1;
|
|
41
|
+
background-color: rgb(var(--color-surface-900) / var(--tw-bg-opacity));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.btn {
|
|
45
|
+
border-radius: 8px;
|
|
46
|
+
padding: 0.5em;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Props } from "./DefaultToastBody";
|
|
3
|
+
import type { DismissToastCallback } from "./Toast";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
props: Props;
|
|
7
|
+
dismissToastCallback: DismissToastCallback | undefined;
|
|
8
|
+
shouldEnableButton?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type DefaultToastBodyProps = typeof __propDef.props;
|
|
16
|
+
export type DefaultToastBodyEvents = typeof __propDef.events;
|
|
17
|
+
export type DefaultToastBodySlots = typeof __propDef.slots;
|
|
18
|
+
export default class DefaultToastBody extends SvelteComponent<DefaultToastBodyProps, DefaultToastBodyEvents, DefaultToastBodySlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { DefaultToastPair } from "./DefaultToastBody";
|
|
3
|
+
import type { TestCustomToastPair } from "./custom-toast/TestCustomToast";
|
|
4
|
+
/**
|
|
5
|
+
* Default toast duration is 5 seconds
|
|
6
|
+
*/
|
|
7
|
+
export declare const DefaultToastParamsDuration = 5000;
|
|
8
|
+
export type CustomToastPairs = DefaultToastPair | TestCustomToastPair;
|
|
9
|
+
export type DismissToastCallback = () => void;
|
|
10
|
+
export interface ToastParams {
|
|
11
|
+
componentAndProps: CustomToastPairs;
|
|
12
|
+
/**
|
|
13
|
+
* Time in millisecond. If undefined, defaults to DefaultToastParamsDuration
|
|
14
|
+
*/
|
|
15
|
+
duration?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* todo: do not call directly documentation
|
|
19
|
+
*/
|
|
20
|
+
export declare const activeToast: import("svelte/store").Writable<ToastParams | undefined>;
|
|
21
|
+
export declare const toastQueue: ToastParams[];
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param newToast
|
|
25
|
+
*/
|
|
26
|
+
export declare const showComponentInToast: (newToast: ToastParams) => void;
|
|
27
|
+
export declare const showTextInToast: (message: string) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
|
+
import DefaultToastBody from "./DefaultToastBody.svelte";
|
|
3
|
+
/**
|
|
4
|
+
* Default toast duration is 5 seconds
|
|
5
|
+
*/
|
|
6
|
+
export const DefaultToastParamsDuration = 5000;
|
|
7
|
+
/**
|
|
8
|
+
* todo: do not call directly documentation
|
|
9
|
+
*/
|
|
10
|
+
export const activeToast = writable();
|
|
11
|
+
export const toastQueue = [];
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param newToast
|
|
15
|
+
*/
|
|
16
|
+
export const showComponentInToast = (newToast) => {
|
|
17
|
+
// todo: queue component
|
|
18
|
+
activeToast.update((currentToast) => {
|
|
19
|
+
if (currentToast !== undefined) {
|
|
20
|
+
toastQueue.push(newToast);
|
|
21
|
+
return currentToast;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return newToast;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export const showTextInToast = (message) => {
|
|
29
|
+
showComponentInToast({
|
|
30
|
+
componentAndProps: {
|
|
31
|
+
component: DefaultToastBody,
|
|
32
|
+
props: {
|
|
33
|
+
message
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|