@turnipxenon/pineapple 3.1.0-alpha.8 → 4.0.0-alpha.1
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/README.md +10 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/ui/elements/CodeBlock/CodeBlock.svelte +2 -1
- package/dist/ui/elements/CodeBlock/CodeBlockProps.d.ts +1 -1
- package/dist/ui/elements/index.d.ts +2 -1
- package/dist/ui/elements/index.js +2 -1
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte +3 -6
- package/dist/{components → ui/modules}/dialog_overlay/DialogOverlay.svelte +11 -10
- package/dist/ui/modules/index.d.ts +2 -0
- package/dist/ui/modules/index.js +2 -0
- package/dist/ui/templates/PinyaPageLayout/PinyaPageLayout.svelte +3 -2
- package/dist/{components → ui/templates}/blog_template/BlogTemplate.svelte +4 -4
- package/dist/{components → ui/templates}/blog_template/BlogTemplate.svelte.d.ts +1 -1
- package/dist/{components → ui/templates}/blog_template/BlogTemplateInner.svelte +1 -1
- package/dist/{components → ui/templates}/blog_template/BlogTemplateInner.svelte.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/Card.svelte +0 -64
- package/dist/components/Card.svelte.d.ts +0 -12
- package/dist/components/CarouselElement.svelte +0 -28
- package/dist/components/CarouselElement.svelte.d.ts +0 -8
- package/dist/components/LazyAsset.svelte +0 -124
- package/dist/components/LazyAsset.svelte.d.ts +0 -10
- package/dist/components/LazyAssetType.d.ts +0 -10
- package/dist/components/LazyAssetType.js +0 -12
- package/dist/components/OnElementVisbilityChanged.d.ts +0 -1
- package/dist/components/OnElementVisbilityChanged.js +0 -1
- package/dist/components/PineappleSlideToggle.svelte +0 -30
- package/dist/components/PineappleSlideToggle.svelte.d.ts +0 -10
- package/dist/components/RandomizedBackground.svelte +0 -87
- package/dist/components/RandomizedBackground.svelte.d.ts +0 -7
- package/dist/components/RandomizedImage.svelte +0 -44
- package/dist/components/RandomizedImage.svelte.d.ts +0 -7
- package/dist/components/StickyElement.svelte +0 -45
- package/dist/components/StickyElement.svelte.d.ts +0 -7
- package/dist/components/ToggleableContent.svelte +0 -95
- package/dist/components/ToggleableContent.svelte.d.ts +0 -8
- package/dist/components/ToggleableContentType.d.ts +0 -4
- package/dist/components/ToggleableContentType.js +0 -5
- package/dist/components/chip/Chip.svelte +0 -71
- package/dist/components/chip/Chip.svelte.d.ts +0 -8
- package/dist/components/combo_box/ComboBox.svelte +0 -17
- package/dist/components/combo_box/ComboBox.svelte.d.ts +0 -8
- package/dist/components/combo_box/ComboBoxWithButton.svelte +0 -29
- package/dist/components/combo_box/ComboBoxWithButton.svelte.d.ts +0 -9
- package/dist/components/combo_box/combo-box.postcss +0 -22
- package/dist/components/index.d.ts +0 -8
- package/dist/components/index.js +0 -9
- package/dist/components/layouts/LayoutConstants.d.ts +0 -1
- package/dist/components/layouts/LayoutConstants.js +0 -1
- package/dist/components/layouts/SeaweedBaseLayout.svelte +0 -115
- package/dist/components/layouts/SeaweedBaseLayout.svelte.d.ts +0 -9
- package/dist/components/pineapple/PineappleBaseLayout.svelte +0 -216
- package/dist/components/pineapple/PineappleBaseLayout.svelte.d.ts +0 -7
- package/dist/components/pineapple/toast/DefaultToastBody.d.ts +0 -8
- package/dist/components/pineapple/toast/DefaultToastBody.js +0 -1
- package/dist/components/pineapple/toast/DefaultToastBody.svelte +0 -46
- package/dist/components/pineapple/toast/DefaultToastBody.svelte.d.ts +0 -10
- package/dist/components/pineapple/toast/Toast.d.ts +0 -26
- package/dist/components/pineapple/toast/Toast.js +0 -37
- package/dist/components/pineapple/toast/Toast.svelte +0 -120
- package/dist/components/pineapple/toast/Toast.svelte.d.ts +0 -3
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.d.ts +0 -5
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.js +0 -1
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.svelte +0 -1
- package/dist/components/pineapple/toast/custom-toast/TestCustomToast.svelte.d.ts +0 -26
- /package/dist/{components → modules}/overrideable_meta/OverridableMeta.svelte +0 -0
- /package/dist/{components → modules}/overrideable_meta/OverridableMeta.svelte.d.ts +0 -0
- /package/dist/{components → modules}/overrideable_meta/OverridableMetaProps.d.ts +0 -0
- /package/dist/{components → modules}/overrideable_meta/OverridableMetaProps.js +0 -0
- /package/dist/{components → modules}/overrideable_meta/index.d.ts +0 -0
- /package/dist/{components → modules}/overrideable_meta/index.js +0 -0
- /package/dist/{components → ui/modules}/dialog_overlay/DialogOverlay.svelte.d.ts +0 -0
- /package/dist/{components → ui/templates}/blog_template/blog-template.css +0 -0
package/README.md
CHANGED
|
@@ -106,6 +106,16 @@ As a reference as to why we need to do above, we use the UI framework Skeleton,
|
|
|
106
106
|
|
|
107
107
|
TODO: if we are happy with our base, publish it to github and link the corresponding git commits here
|
|
108
108
|
|
|
109
|
+
7. Update to "@sveltejs/adapter-auto": "^4.0.0", we need node 22
|
|
110
|
+
8. Add alias in svelte.config
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
kit: {
|
|
114
|
+
alias: {
|
|
115
|
+
$pkg: path.resolve("./node_modules/@turnipxenon/pineapple/dist/lib")
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
109
119
|
|
|
110
120
|
## Local linking
|
|
111
121
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./components/index";
|
|
3
|
-
export * from "./components/overrideable_meta/index";
|
|
1
|
+
export * from "./modules/overrideable_meta/index";
|
|
4
2
|
export * from "./ui/modules/NavigationMenu/index";
|
|
5
3
|
export * from "./types/api/index";
|
|
6
4
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
@@ -11,4 +9,6 @@ export * from "./types/pineapple_fiber/DialogDetail";
|
|
|
11
9
|
export * from "./util/util";
|
|
12
10
|
export * from "./api/index";
|
|
13
11
|
export type { IDialogManager } from "./components/dialog_manager/IDialogManager";
|
|
12
|
+
export { default as BlogTemplate } from "./ui/templates/blog_template/BlogTemplate.svelte";
|
|
13
|
+
export { default as DialogOverlay } from "./ui/modules/dialog_overlay/DialogOverlay.svelte";
|
|
14
14
|
export { dialogManager } from "./components/dialog_manager/DialogManager";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// noinspection JSUnusedGlobalSymbols
|
|
2
|
-
export
|
|
3
|
-
export * from "./components/index";
|
|
4
|
-
export * from "./components/overrideable_meta/index";
|
|
2
|
+
export * from "./modules/overrideable_meta/index";
|
|
5
3
|
export * from "./ui/modules/NavigationMenu/index";
|
|
6
4
|
export * from "./types/api/index";
|
|
7
5
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
@@ -11,4 +9,6 @@ export * from "./types/pineapple_fiber/PortraitType";
|
|
|
11
9
|
export * from "./types/pineapple_fiber/DialogDetail";
|
|
12
10
|
export * from "./util/util";
|
|
13
11
|
export * from "./api/index";
|
|
12
|
+
export { default as BlogTemplate } from "./ui/templates/blog_template/BlogTemplate.svelte";
|
|
13
|
+
export { default as DialogOverlay } from "./ui/modules/dialog_overlay/DialogOverlay.svelte";
|
|
14
14
|
export { dialogManager } from "./components/dialog_manager/DialogManager";
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import js from "shiki/langs/javascript.mjs";
|
|
17
17
|
import ts from "shiki/langs/typescript.mjs";
|
|
18
18
|
import markdown from "shiki/langs/markdown.mjs";
|
|
19
|
+
import xml from "shiki/langs/xml.mjs";
|
|
19
20
|
|
|
20
21
|
// https://shiki.style/guide/sync-usage
|
|
21
22
|
const shiki = createHighlighterCoreSync({
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
// Implement your import theme.
|
|
24
25
|
themes: [themeLight, themeDark],
|
|
25
26
|
// Implement your imported and supported languages.
|
|
26
|
-
langs: [console, html, css, js, ts, markdown]
|
|
27
|
+
langs: [console, html, css, js, ts, markdown, xml]
|
|
27
28
|
});
|
|
28
29
|
</script>
|
|
29
30
|
|
|
@@ -7,6 +7,7 @@ export { default as TextLink } from "./TextLink.svelte";
|
|
|
7
7
|
export { default as ElementVisibilityDetector } from "./ElementVisibilityDetector.svelte";
|
|
8
8
|
export * from "./PinyaCard/index";
|
|
9
9
|
export * from "./WrapperProps";
|
|
10
|
-
export * from "./PinyaButton
|
|
10
|
+
export * from "./PinyaButton";
|
|
11
|
+
export * from "./PinyaAnchorButton";
|
|
11
12
|
export * from "./text-chip";
|
|
12
13
|
export * from "./CodeBlock";
|
|
@@ -9,6 +9,7 @@ export { default as TextLink } from "./TextLink.svelte";
|
|
|
9
9
|
export { default as ElementVisibilityDetector } from "./ElementVisibilityDetector.svelte";
|
|
10
10
|
export * from "./PinyaCard/index";
|
|
11
11
|
export * from "./WrapperProps";
|
|
12
|
-
export * from "./PinyaButton
|
|
12
|
+
export * from "./PinyaButton";
|
|
13
|
+
export * from "./PinyaAnchorButton";
|
|
13
14
|
export * from "./text-chip";
|
|
14
15
|
export * from "./CodeBlock";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import NavigationControl from "./NavigationControl.svelte";
|
|
3
3
|
import { parsePageMeta, type ParsePageMetaCompareFn } from "./PageMeta";
|
|
4
|
-
import { Card } from "../../../components/index";
|
|
5
4
|
import { PinyaCard } from "../../elements/index";
|
|
6
5
|
import { localizeHref } from "../../../paraglide/runtime.js";
|
|
7
6
|
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
<!-- all the misc routes-->
|
|
63
62
|
{#each visiblePages as pageMeta (pageMeta.title)}
|
|
64
63
|
{@const fullPath=`${parentSubpath}${pageMeta.relativeLink}`}
|
|
65
|
-
<a href={localizeHref(fullPath)} class="card-anchor">
|
|
64
|
+
<a href={localizeHref(fullPath)} class="card-anchor a-as-btn">
|
|
66
65
|
<PinyaCard
|
|
67
66
|
widthClass="w-full"
|
|
68
67
|
className="navigation-element"
|
|
@@ -89,11 +88,9 @@
|
|
|
89
88
|
{/each}
|
|
90
89
|
|
|
91
90
|
{#if visiblePages.length === 0}
|
|
92
|
-
<
|
|
93
|
-
{#snippet content()}
|
|
91
|
+
<PinyaCard>
|
|
94
92
|
<p class="default-card">Sorry, no content was found</p>
|
|
95
|
-
|
|
96
|
-
</Card>
|
|
93
|
+
</PinyaCard>
|
|
97
94
|
{/if}
|
|
98
95
|
</div>
|
|
99
96
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { slide } from "svelte/transition";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
4
|
|
|
5
|
-
import AresHappy from "
|
|
6
|
-
import { DialogState } from "
|
|
7
|
-
import { dialogManager } from "
|
|
8
|
-
import PinyaCard from "../../
|
|
9
|
-
import { appState } from "../../
|
|
10
|
-
import CloseIcon from "
|
|
11
|
-
import FABIcon from "
|
|
12
|
-
import { enableDialogueOverlay } from "
|
|
13
|
-
import PinyaButton from "../../
|
|
5
|
+
import AresHappy from "../../../assets/characters/ares/ares_happy.webp";
|
|
6
|
+
import { DialogState } from "../../../types/pineapple_fiber/DialogState";
|
|
7
|
+
import { dialogManager } from "../../../components/dialog_manager/DialogManager";
|
|
8
|
+
import PinyaCard from "../../elements/PinyaCard/PinyaCard.svelte";
|
|
9
|
+
import { appState } from "../../templates/index";
|
|
10
|
+
import CloseIcon from "../../../assets/icons/close.svg";
|
|
11
|
+
import FABIcon from "../../../assets/bg_tiled/bg_tiled_turnip.png";
|
|
12
|
+
import { enableDialogueOverlay } from "../../../components/dialog_manager/DialogManagerStore";
|
|
13
|
+
import PinyaButton from "../../elements/PinyaButton/PinyaButton.svelte";
|
|
14
14
|
|
|
15
15
|
let currentMessage = $state("");
|
|
16
16
|
let currentPortrait = $state(AresHappy);
|
|
@@ -199,7 +199,8 @@
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
:global(.fab) {
|
|
202
|
-
|
|
202
|
+
position: relative;
|
|
203
|
+
transform: scale3d(1, 1, 1.5);
|
|
203
204
|
background-color: var(--color-tertiary-500);
|
|
204
205
|
padding: 0.3rem;
|
|
205
206
|
width: clamp(2rem, 5vw, 4rem);
|
package/dist/ui/modules/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import GeneralSettingsModal from "../../modules/modals/general-settings/GeneralSettingsModal.svelte";
|
|
11
11
|
import { appState } from "./runes.svelte";
|
|
12
12
|
import { enableBackground } from "../../../store";
|
|
13
|
-
import DialogOverlay from "
|
|
13
|
+
import DialogOverlay from "../../modules/dialog_overlay/DialogOverlay.svelte";
|
|
14
14
|
|
|
15
15
|
let {
|
|
16
16
|
children,
|
|
@@ -70,13 +70,14 @@
|
|
|
70
70
|
{@render header('hidden shadow-none w-full')}
|
|
71
71
|
{@render header('fixed z-15 w-[105vw]')}
|
|
72
72
|
|
|
73
|
-
<DialogOverlay></DialogOverlay>
|
|
74
73
|
<RandomizedBackground enabled={$enableBackground} />
|
|
75
74
|
|
|
76
75
|
<div class="default-page-container">
|
|
77
76
|
{@render children?.()}
|
|
78
77
|
</div>
|
|
79
78
|
|
|
79
|
+
<DialogOverlay></DialogOverlay>
|
|
80
|
+
|
|
80
81
|
{#if footer}
|
|
81
82
|
{@render footer()}
|
|
82
83
|
{:else }
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "./blog-template.css";
|
|
3
3
|
import { onDestroy, onMount, type Snippet } from "svelte";
|
|
4
4
|
import BlogTemplateInner from "./BlogTemplateInner.svelte";
|
|
5
|
-
import type { SimplePageMeta } from "../../
|
|
6
|
-
import { enableDialogueOverlay } from "
|
|
7
|
-
import PinyaCard from "../../
|
|
8
|
-
import { appState } from "
|
|
5
|
+
import type { SimplePageMeta } from "../../modules/NavigationMenu/index";
|
|
6
|
+
import { enableDialogueOverlay } from "../../../components/dialog_manager/DialogManagerStore";
|
|
7
|
+
import PinyaCard from "../../elements/PinyaCard/PinyaCard.svelte";
|
|
8
|
+
import { appState } from "../index";
|
|
9
9
|
|
|
10
10
|
// grab page meta from the adjacent meta.json
|
|
11
11
|
interface Props {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./blog-template.css";
|
|
2
2
|
import { type Snippet } from "svelte";
|
|
3
|
-
import type { SimplePageMeta } from "../../
|
|
3
|
+
import type { SimplePageMeta } from "../../modules/NavigationMenu/index";
|
|
4
4
|
interface Props {
|
|
5
5
|
pageMeta: SimplePageMeta;
|
|
6
6
|
shouldFillWholePage?: boolean;
|
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { run } from 'svelte/legacy';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
margin?: string;
|
|
6
|
-
marginBottom?: string;
|
|
7
|
-
overrideStyle?: string;
|
|
8
|
-
includeDataNoSnippet?: boolean;
|
|
9
|
-
additionalClass?: string[];
|
|
10
|
-
turnOnLightModeBorder?: boolean;
|
|
11
|
-
content?: import('svelte').Snippet<[any]>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let {
|
|
15
|
-
margin = "0",
|
|
16
|
-
marginBottom = "2lh",
|
|
17
|
-
overrideStyle = "",
|
|
18
|
-
includeDataNoSnippet = true,
|
|
19
|
-
additionalClass = [],
|
|
20
|
-
turnOnLightModeBorder = true,
|
|
21
|
-
content
|
|
22
|
-
}: Props = $props();
|
|
23
|
-
|
|
24
|
-
// warning: don't forget the semi-colon when adding new style!
|
|
25
|
-
const style = `
|
|
26
|
-
--turnip-card-margin: ${margin};
|
|
27
|
-
--turnip-card-margin-bottom: ${marginBottom};
|
|
28
|
-
${overrideStyle};
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
if (!content) {
|
|
32
|
-
console.error("Missing content slot in card. No content will be displayed.");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const originalClasses = ["card", "turnip-card bg-surface-100 dark:bg-surface-900"].concat(additionalClass).join(" ");
|
|
36
|
-
let classes = $state(originalClasses.slice());
|
|
37
|
-
const toggleLightModeBorder = (turnOnLightModeBorder: boolean) => {
|
|
38
|
-
classes = originalClasses;
|
|
39
|
-
if (turnOnLightModeBorder) {
|
|
40
|
-
classes += " light-mode-border border-surface-600 border-2 dark:border-0";
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
run(() => {
|
|
44
|
-
toggleLightModeBorder(turnOnLightModeBorder);
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
{#if (includeDataNoSnippet)}
|
|
49
|
-
<div class={classes} style={style} data-nosnippet>
|
|
50
|
-
{@render content?.({ class: "card", })}
|
|
51
|
-
</div>
|
|
52
|
-
{:else }
|
|
53
|
-
<div class={classes} style={style}>
|
|
54
|
-
{@render content?.({ class: "card", })}
|
|
55
|
-
</div>
|
|
56
|
-
{/if}
|
|
57
|
-
|
|
58
|
-
<style>
|
|
59
|
-
.turnip-card {
|
|
60
|
-
margin: var(--turnip-card-margin);
|
|
61
|
-
margin-bottom: var(--turnip-card-margin-bottom);
|
|
62
|
-
border-radius: var(--theme-rounded-container);
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
margin?: string;
|
|
3
|
-
marginBottom?: string;
|
|
4
|
-
overrideStyle?: string;
|
|
5
|
-
includeDataNoSnippet?: boolean;
|
|
6
|
-
additionalClass?: string[];
|
|
7
|
-
turnOnLightModeBorder?: boolean;
|
|
8
|
-
content?: import('svelte').Snippet<[any]>;
|
|
9
|
-
}
|
|
10
|
-
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
11
|
-
type Card = ReturnType<typeof Card>;
|
|
12
|
-
export default Card;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import {fly, slide, scale} from "svelte/transition";
|
|
4
|
-
interface Props {
|
|
5
|
-
activeGameIndex: number;
|
|
6
|
-
selfIndex: number;
|
|
7
|
-
children?: import('svelte').Snippet;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let { activeGameIndex, selfIndex, children }: Props = $props();
|
|
11
|
-
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
{#if (activeGameIndex === selfIndex)}
|
|
15
|
-
<!--todo: make section consistent size for all-->
|
|
16
|
-
<section class="game-showcase"
|
|
17
|
-
in:fly={{x: '100%'}} out:fly={{x: '-100%'}}>
|
|
18
|
-
{@render children?.()}
|
|
19
|
-
</section>
|
|
20
|
-
{/if}
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
.game-showcase {
|
|
24
|
-
@apply snap-center rounded-container;
|
|
25
|
-
margin: auto;
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
activeGameIndex: number;
|
|
3
|
-
selfIndex: number;
|
|
4
|
-
children?: import('svelte').Snippet;
|
|
5
|
-
}
|
|
6
|
-
declare const CarouselElement: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type CarouselElement = ReturnType<typeof CarouselElement>;
|
|
8
|
-
export default CarouselElement;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {LazyAssetStatus, LazyAssetType} from "./LazyAssetType";
|
|
3
|
-
import BgTiledAres from "../assets/bg_tiled/bg_tiled_ares.png";
|
|
4
|
-
import {onMount} from "svelte";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// in pixels
|
|
8
|
-
|
|
9
|
-
// playsinline autoplay muted loop
|
|
10
|
-
// whatever your heart's content
|
|
11
|
-
interface Props {
|
|
12
|
-
src: string;
|
|
13
|
-
alt: string;
|
|
14
|
-
width: string;
|
|
15
|
-
height: string;
|
|
16
|
-
props?: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let {
|
|
20
|
-
src,
|
|
21
|
-
alt,
|
|
22
|
-
width,
|
|
23
|
-
height,
|
|
24
|
-
props = $bindable({})
|
|
25
|
-
}: Props = $props();
|
|
26
|
-
// todo: add size and alt text
|
|
27
|
-
|
|
28
|
-
props = {
|
|
29
|
-
...props,
|
|
30
|
-
alt,
|
|
31
|
-
width,
|
|
32
|
-
height
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// auto detect asset type
|
|
36
|
-
let extension = $state("");
|
|
37
|
-
const getAssetType = (): LazyAssetType => {
|
|
38
|
-
const srcArray = src.split(".");
|
|
39
|
-
extension = srcArray[srcArray.length - 1];
|
|
40
|
-
switch (extension) {
|
|
41
|
-
case "png":
|
|
42
|
-
case "webp":
|
|
43
|
-
case "gif":
|
|
44
|
-
case "jpg":
|
|
45
|
-
return LazyAssetType.Image;
|
|
46
|
-
case "ogg":
|
|
47
|
-
case "webm":
|
|
48
|
-
case "mp4":
|
|
49
|
-
return LazyAssetType.Video;
|
|
50
|
-
default:
|
|
51
|
-
console.log(`Unknown asset type for: ${src}`);
|
|
52
|
-
return LazyAssetType.Unknown;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
const assetType: LazyAssetType = getAssetType();
|
|
56
|
-
|
|
57
|
-
let actualSrc = $state("");
|
|
58
|
-
let status: LazyAssetStatus = $state(LazyAssetStatus.Loading);
|
|
59
|
-
|
|
60
|
-
onMount(async () => {
|
|
61
|
-
const path = src.includes("https://") ? src : `${window.location.origin}${src}`;
|
|
62
|
-
|
|
63
|
-
switch(assetType) {
|
|
64
|
-
case LazyAssetType.Image: {
|
|
65
|
-
const img = new Image();
|
|
66
|
-
img.onload = () => {
|
|
67
|
-
actualSrc = path;
|
|
68
|
-
status = LazyAssetStatus.Loaded;
|
|
69
|
-
}
|
|
70
|
-
img.src = path;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case LazyAssetType.Video: {
|
|
74
|
-
fetch(path)
|
|
75
|
-
.then(resp => resp.blob())
|
|
76
|
-
.then(blob => {
|
|
77
|
-
actualSrc = URL.createObjectURL(blob);
|
|
78
|
-
status = LazyAssetStatus.Loaded;
|
|
79
|
-
})
|
|
80
|
-
.catch(error => {
|
|
81
|
-
console.warn(error);
|
|
82
|
-
status = LazyAssetStatus.Error;
|
|
83
|
-
});
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case LazyAssetType.Unknown: {
|
|
87
|
-
console.warn("Unknown asset: ", path)
|
|
88
|
-
status = LazyAssetStatus.Error;
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
</script>
|
|
95
|
-
|
|
96
|
-
{#if status === LazyAssetStatus.Loaded}
|
|
97
|
-
{#if assetType === LazyAssetType.Image}
|
|
98
|
-
<img src={actualSrc} alt="Placeholder image" {...props} />
|
|
99
|
-
{:else if assetType === LazyAssetType.Video}
|
|
100
|
-
<video playsinline autoplay muted loop {...props} poster={BgTiledAres} style="object-fit: scale-down">
|
|
101
|
-
<source src={actualSrc} type={`video/${extension}`} />
|
|
102
|
-
Your browser does not support the video tag.
|
|
103
|
-
</video>
|
|
104
|
-
{:else}
|
|
105
|
-
<img src={actualSrc} alt="Placeholder image" />
|
|
106
|
-
{/if}
|
|
107
|
-
{:else}
|
|
108
|
-
<img class="rotate" src={BgTiledAres} {...props} style="object-fit: scale-down" />
|
|
109
|
-
{/if}
|
|
110
|
-
|
|
111
|
-
<style>
|
|
112
|
-
.rotate {
|
|
113
|
-
animation: rotation 4s infinite linear;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@keyframes rotation {
|
|
117
|
-
from {
|
|
118
|
-
transform: rotate(0deg);
|
|
119
|
-
}
|
|
120
|
-
to {
|
|
121
|
-
transform: rotate(359deg);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var LazyAssetType;
|
|
2
|
-
(function (LazyAssetType) {
|
|
3
|
-
LazyAssetType[LazyAssetType["Image"] = 0] = "Image";
|
|
4
|
-
LazyAssetType[LazyAssetType["Video"] = 1] = "Video";
|
|
5
|
-
LazyAssetType[LazyAssetType["Unknown"] = 2] = "Unknown";
|
|
6
|
-
})(LazyAssetType || (LazyAssetType = {}));
|
|
7
|
-
export var LazyAssetStatus;
|
|
8
|
-
(function (LazyAssetStatus) {
|
|
9
|
-
LazyAssetStatus[LazyAssetStatus["Loading"] = 0] = "Loading";
|
|
10
|
-
LazyAssetStatus[LazyAssetStatus["Loaded"] = 1] = "Loaded";
|
|
11
|
-
LazyAssetStatus[LazyAssetStatus["Error"] = 2] = "Error";
|
|
12
|
-
})(LazyAssetStatus || (LazyAssetStatus = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type OnElementVisibilityChanged = (isVisible: boolean) => void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import { Switch } from "@skeletonlabs/skeleton-svelte";
|
|
4
|
-
import type { Snippet } from "svelte";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
checked?: boolean;
|
|
8
|
-
name: string;
|
|
9
|
-
onChange?: (() => void);
|
|
10
|
-
children?: Snippet;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
checked = $bindable(false),
|
|
15
|
-
name,
|
|
16
|
-
onChange = undefined,
|
|
17
|
-
children = undefined,
|
|
18
|
-
}: Props = $props();
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<Switch name={name}
|
|
22
|
-
controlBase="bg-red-500"
|
|
23
|
-
checked={checked}
|
|
24
|
-
onCheckedChange={(e) => {
|
|
25
|
-
checked = e.checked;
|
|
26
|
-
onChange?.();
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{@render children?.()}
|
|
30
|
-
</Switch>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
|
-
interface Props {
|
|
3
|
-
checked?: boolean;
|
|
4
|
-
name: string;
|
|
5
|
-
onChange?: (() => void);
|
|
6
|
-
children?: Snippet;
|
|
7
|
-
}
|
|
8
|
-
declare const PineappleSlideToggle: import("svelte").Component<Props, {}, "checked">;
|
|
9
|
-
type PineappleSlideToggle = ReturnType<typeof PineappleSlideToggle>;
|
|
10
|
-
export default PineappleSlideToggle;
|