@turnipxenon/pineapple 3.0.0 → 3.1.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/dist/components/blog_template/BlogTemplate.svelte +1 -1
- package/dist/components/blog_template/BlogTemplate.svelte.d.ts +1 -1
- package/dist/components/blog_template/BlogTemplateInner.svelte +1 -1
- package/dist/components/blog_template/BlogTemplateInner.svelte.d.ts +1 -1
- package/dist/components/dialog_manager/DialogMangerInit.d.ts +1 -1
- package/dist/components/dialog_manager/IDialogManager.d.ts +1 -1
- package/dist/components/dialog_overlay/DialogOverlay.svelte +127 -17
- package/dist/components/layouts/SeaweedBaseLayout.svelte +0 -6
- package/dist/components/pineapple/PineappleBaseLayout.svelte +0 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/app.css +9 -14
- package/dist/ui/components/ModalBase.svelte +74 -74
- package/dist/ui/components/accordion/PinyaAccordion.svelte +20 -20
- package/dist/ui/components/accordion/PinyaAccordionItem.svelte +28 -28
- package/dist/ui/elements/CodeBlock/CodeBlock.svelte +64 -64
- package/dist/ui/elements/ImageIcon.svelte +53 -53
- package/dist/ui/elements/{pinya-card/component.svelte → PinyaCard/PinyaCard.svelte} +21 -20
- package/dist/ui/elements/PinyaCard/PinyaCard.svelte.d.ts +7 -0
- package/dist/ui/elements/PinyaCard/index.d.ts +2 -0
- package/dist/ui/elements/PinyaCard/index.js +2 -0
- package/dist/ui/elements/Placeholder.svelte +17 -17
- package/dist/ui/elements/TextLink.svelte +16 -16
- package/dist/ui/elements/index.d.ts +1 -1
- package/dist/ui/elements/index.js +1 -1
- package/dist/ui/elements/pinya-combobox/PinyaCombobox.svelte +34 -34
- package/dist/ui/elements/text-chip/TextChip.svelte +14 -14
- package/dist/{components/navigation_component → ui/modules/NavigationMenu}/NavigationControl.svelte +24 -20
- package/dist/{components/navigation_component/NavigationComponent.svelte → ui/modules/NavigationMenu/NavigationMenu.svelte} +69 -43
- package/dist/{components/navigation_component/NavigationComponent.svelte.d.ts → ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts} +6 -6
- package/dist/{components/navigation_component → ui/modules/NavigationMenu}/PageMeta.d.ts +4 -4
- package/dist/ui/modules/NavigationMenu/index.d.ts +2 -0
- package/dist/ui/modules/NavigationMenu/index.js +2 -0
- package/dist/ui/modules/index.d.ts +1 -1
- package/dist/ui/modules/index.js +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte +109 -109
- package/dist/ui/modules/modals/general-settings/LanguagePicker.svelte +42 -42
- package/dist/ui/modules/projects/Pengi.svelte +61 -61
- package/dist/ui/modules/projects/ThisWebpage.svelte +10 -8
- package/dist/ui/templates/PinyaPageLayout/runes.svelte.d.ts +2 -0
- package/dist/ui/{modules/seaweed → templates/SeaweedLayout}/ChumBucket.svelte +1 -1
- package/dist/ui/templates/SeaweedLayout/EntryGroup.svelte +65 -88
- package/dist/ui/templates/SeaweedLayout/ProjectComponentProps.d.ts +1 -0
- package/dist/ui/templates/SeaweedLayout/ProjectGroupConfig.svelte +316 -316
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.md +3 -3
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.svelte +278 -276
- package/dist/ui/templates/SeaweedLayout/props.d.ts +2 -2
- package/dist/ui/templates/confirmation-modal/component.svelte +46 -46
- package/package.json +1 -1
- package/src/lib/styles/app.css +9 -14
- package/dist/components/navigation_component/index.d.ts +0 -2
- package/dist/components/navigation_component/index.js +0 -3
- package/dist/ui/elements/pinya-card/component.svelte.d.ts +0 -7
- package/dist/ui/elements/pinya-card/index.d.ts +0 -2
- package/dist/ui/elements/pinya-card/index.js +0 -2
- package/dist/ui/modules/seaweed/index.d.ts +0 -3
- package/dist/ui/modules/seaweed/index.js +0 -4
- /package/dist/ui/elements/{pinya-card/props.d.ts → PinyaCard/PinyaCardProps.d.ts} +0 -0
- /package/dist/ui/elements/{pinya-card/props.js → PinyaCard/PinyaCardProps.js} +0 -0
- /package/dist/{components/navigation_component → ui/modules/NavigationMenu}/NavigationControl.svelte.d.ts +0 -0
- /package/dist/{components/navigation_component → ui/modules/NavigationMenu}/PageMeta.js +0 -0
- /package/dist/ui/{modules/seaweed → templates/SeaweedLayout}/ChumBucket.svelte.d.ts +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { enableBackground } from "../../store";
|
|
4
4
|
import { onDestroy, onMount } from "svelte";
|
|
5
5
|
import BlogTemplateInner from "./BlogTemplateInner.svelte";
|
|
6
|
-
import type { SimplePageMeta } from "
|
|
6
|
+
import type { SimplePageMeta } from "../../ui/modules/NavigationMenu/index";
|
|
7
7
|
import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
|
|
8
8
|
import { default as Card } from "../Card.svelte";
|
|
9
9
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IDialogManager } from "./IDialogManager";
|
|
2
|
-
export declare const getDialogManager: () => Promise<IDialogManager>;
|
|
2
|
+
export declare const getDialogManager: () => Promise<IDialogManager | undefined>;
|
|
@@ -13,7 +13,7 @@ export interface IDialogManager {
|
|
|
13
13
|
currentIndex: number;
|
|
14
14
|
previousTimestamp: number;
|
|
15
15
|
isDoneTransition: boolean;
|
|
16
|
-
currentPortrait: Writable<
|
|
16
|
+
currentPortrait: Writable<string>;
|
|
17
17
|
portraitMap: Map<string, any>;
|
|
18
18
|
currentState: DialogState;
|
|
19
19
|
currentReadableState: Writable<DialogState>;
|
|
@@ -4,9 +4,17 @@
|
|
|
4
4
|
import { DialogState } from "../../types/pineapple_fiber/DialogState";
|
|
5
5
|
import { getDialogManager } from "../dialog_manager/DialogMangerInit";
|
|
6
6
|
import type { IDialogManager } from "../dialog_manager/IDialogManager";
|
|
7
|
+
import PinyaCard from "../../ui/elements/PinyaCard/PinyaCard.svelte";
|
|
8
|
+
import { appState } from "../../ui/templates/index";
|
|
9
|
+
import CloseIcon from "../../assets/icons/close.svg";
|
|
10
|
+
import FABIcon from "../../assets/bg_tiled/bg_tiled_turnip.png";
|
|
11
|
+
import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
|
|
12
|
+
import { PinyaButton } from "../../ui/elements/index";
|
|
13
|
+
import { slide } from "svelte/transition";
|
|
7
14
|
|
|
8
15
|
let currentMessage = $state("");
|
|
9
16
|
let currentPortrait = $state(AresHappy);
|
|
17
|
+
let isMounted = $state(false);
|
|
10
18
|
|
|
11
19
|
let hidePercent = $state(100);
|
|
12
20
|
let isHidden = $state(true);
|
|
@@ -36,6 +44,7 @@
|
|
|
36
44
|
});
|
|
37
45
|
|
|
38
46
|
dialogManager.update(0);
|
|
47
|
+
isMounted = true;
|
|
39
48
|
});
|
|
40
49
|
|
|
41
50
|
});
|
|
@@ -44,6 +53,12 @@
|
|
|
44
53
|
dialogManager?.skipAnimation();
|
|
45
54
|
};
|
|
46
55
|
|
|
56
|
+
let enableDialogueOverlayValue = $state(true);
|
|
57
|
+
enableDialogueOverlay.subscribe((value) => {
|
|
58
|
+
enableDialogueOverlayValue = value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
enableDialogueOverlay.set(appState.enableDialogOnByDefault ?? false);
|
|
47
62
|
</script>
|
|
48
63
|
|
|
49
64
|
<div class="dialog-elements"
|
|
@@ -53,18 +68,64 @@
|
|
|
53
68
|
<div class="dialog-portrait-container">
|
|
54
69
|
<img src={currentPortrait} alt="Ares" class="dialog-portrait" />
|
|
55
70
|
</div>
|
|
56
|
-
<div
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
<div
|
|
72
|
+
tabindex="0"
|
|
73
|
+
role="button"
|
|
74
|
+
class="dialog-box"
|
|
75
|
+
onclick={onDialogClick}
|
|
76
|
+
onkeyup={(e) => {
|
|
77
|
+
if (e.key === 'j') {
|
|
78
|
+
onDialogClick()
|
|
79
|
+
; }
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<PinyaCard
|
|
83
|
+
widthClass=""
|
|
84
|
+
paddingClass=""
|
|
85
|
+
className="dialog-name"
|
|
86
|
+
>
|
|
87
|
+
<div>
|
|
88
|
+
<b class="fake-h1">Turnip</b>
|
|
89
|
+
</div>
|
|
90
|
+
</PinyaCard>
|
|
91
|
+
<PinyaCard
|
|
92
|
+
widthClass="w-full"
|
|
93
|
+
className="dialog-text"
|
|
94
|
+
>
|
|
61
95
|
<!-- Made for 140 characters, like the original tweets -->
|
|
62
96
|
{@html currentMessage}
|
|
63
|
-
</
|
|
97
|
+
</PinyaCard>
|
|
64
98
|
</div>
|
|
65
99
|
</div>
|
|
66
100
|
|
|
101
|
+
|
|
102
|
+
{#if appState.allowDialog && isMounted}
|
|
103
|
+
<div class="fab-container" in:slide>
|
|
104
|
+
<PinyaButton
|
|
105
|
+
classes="fab"
|
|
106
|
+
onclick={()=>{
|
|
107
|
+
getDialogManager().then(dm => dm.toggleDialogOverlay());
|
|
108
|
+
}}>
|
|
109
|
+
{#if (enableDialogueOverlayValue)}
|
|
110
|
+
<img class="turnip-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
|
|
111
|
+
{:else }
|
|
112
|
+
<img class="turnip-icon" src={FABIcon} alt="interactive floating action button represented as a turnip">
|
|
113
|
+
{/if}
|
|
114
|
+
</PinyaButton>
|
|
115
|
+
</div>
|
|
116
|
+
{/if}
|
|
117
|
+
|
|
67
118
|
<style>
|
|
119
|
+
:global(.dialog-text) {
|
|
120
|
+
height: 100%;
|
|
121
|
+
padding: 1.2lh 2rem 0.5lh;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:global(.dialog-box *,.dialog-name *) {
|
|
125
|
+
font-size: clamp(1em, 5vw, 1.3em);
|
|
126
|
+
line-height: 1.5em;
|
|
127
|
+
}
|
|
128
|
+
|
|
68
129
|
.dialog-elements {
|
|
69
130
|
position: fixed;
|
|
70
131
|
z-index: 10;
|
|
@@ -82,11 +143,6 @@
|
|
|
82
143
|
transform: translateY(var(--hidePercentHeight));
|
|
83
144
|
}
|
|
84
145
|
|
|
85
|
-
.dialog-box *,
|
|
86
|
-
.dialog-name * {
|
|
87
|
-
font-size: clamp(1em, 5vw, 1.3em);
|
|
88
|
-
line-height: 1.5em;
|
|
89
|
-
}
|
|
90
146
|
|
|
91
147
|
.dialog-padding :global(p) {
|
|
92
148
|
font-size: clamp(1em, 5vw, 1.3em) !important;
|
|
@@ -97,19 +153,18 @@
|
|
|
97
153
|
padding: clamp(1.5em, 5vw, 1.75em) clamp(0em, 5vw - 0.5em, 2em) 0;
|
|
98
154
|
}
|
|
99
155
|
|
|
100
|
-
.dialog-name {
|
|
101
|
-
padding-
|
|
102
|
-
padding-
|
|
103
|
-
padding-right: 4rem;
|
|
156
|
+
:global(.dialog-name) {
|
|
157
|
+
padding-left: 2rem;
|
|
158
|
+
padding-right: 2rem;
|
|
104
159
|
position: fixed;
|
|
105
160
|
}
|
|
106
161
|
|
|
107
|
-
.dialog-name:dir(ltr) {
|
|
162
|
+
:global(.dialog-name:dir(ltr)) {
|
|
108
163
|
/* for centering vertically */
|
|
109
164
|
transform: translateX(clamp(0em, 5vw - 0.5em, 1em)) translateY(-50%);
|
|
110
165
|
}
|
|
111
166
|
|
|
112
|
-
.dialog-name:dir(rtl) {
|
|
167
|
+
:global(.dialog-name:dir(rtl)) {
|
|
113
168
|
/* for centering vertically */
|
|
114
169
|
transform: translateX(calc(clamp(0em, 5vw - 0.5em, 1em) * -1)) translateY(-50%);
|
|
115
170
|
}
|
|
@@ -138,4 +193,59 @@
|
|
|
138
193
|
.dialog-portrait:dir(rtl) {
|
|
139
194
|
transform: scaleX(-1);
|
|
140
195
|
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
.dialog-box {
|
|
199
|
+
background-color: var(--color-surface-500);
|
|
200
|
+
position: fixed;
|
|
201
|
+
bottom: 0;
|
|
202
|
+
width: var(--dialog-box-width); /*75em + 4em padding*/
|
|
203
|
+
height: var(--dialog-box-height);
|
|
204
|
+
max-width: calc(100vw - ((var(--fab-margin) * 2) + 4em));
|
|
205
|
+
border-radius: 1rem;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.dark .dialog-box {
|
|
209
|
+
background-color: rgb(var(--color-surface-900) / 0.95);
|
|
210
|
+
--tw-ring-color: rgb(var(--color-text-400));
|
|
211
|
+
/*background-color: red;*/
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
:global(.fab) {
|
|
215
|
+
/*@apply btn preset-filled-tertiary-500;*/
|
|
216
|
+
background-color: var(--color-tertiary-500);
|
|
217
|
+
padding: 0.3rem;
|
|
218
|
+
width: 4em;
|
|
219
|
+
border-radius: 50%;
|
|
220
|
+
z-index: 100;
|
|
221
|
+
box-shadow: 3px 3px 3px var(--shadow-color);
|
|
222
|
+
margin-bottom: var(--fab-margin);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.fab-container {
|
|
226
|
+
position: fixed;
|
|
227
|
+
bottom: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.fab-container:dir(ltr) {
|
|
231
|
+
right: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.fab-container:dir(rtl) {
|
|
235
|
+
left: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:global(.fab > img) {
|
|
239
|
+
width: 100%;
|
|
240
|
+
filter: brightness(0) invert(1);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:global(.fab:dir(ltr)) {
|
|
244
|
+
margin-right: var(--fab-margin);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:global(.fab:dir(rtl)) {
|
|
248
|
+
margin-left: var(--fab-margin);
|
|
249
|
+
}
|
|
250
|
+
|
|
141
251
|
</style>
|
|
@@ -90,12 +90,6 @@
|
|
|
90
90
|
</div>
|
|
91
91
|
|
|
92
92
|
<style>
|
|
93
|
-
:root {
|
|
94
|
-
--dialog-start-pad: clamp(0em, 5vw, 2em);
|
|
95
|
-
--dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-start-pad) - var(--theme-border-base)));
|
|
96
|
-
--dialog-box-height: clamp(15em, 50vw, 18em);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
93
|
.default-page-container {
|
|
100
94
|
max-width: 2100px;
|
|
101
95
|
margin: 4em auto;
|
|
@@ -137,25 +137,6 @@
|
|
|
137
137
|
</div>
|
|
138
138
|
|
|
139
139
|
<style>
|
|
140
|
-
:root {
|
|
141
|
-
--dialog-start-pad: clamp(0em, 5vw, 2em);
|
|
142
|
-
--dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-start-pad) - var(--theme-border-base)));
|
|
143
|
-
--dialog-box-height: clamp(15em, 50vw, 18em);
|
|
144
|
-
|
|
145
|
-
/** FAB icon margin/position calculation origin:
|
|
146
|
-
Criteria:
|
|
147
|
-
- We want at mobile (360px) our margin to be at 1em (16px)
|
|
148
|
-
- We want at web (1960px) our margin to be at 2em (32px)
|
|
149
|
-
|
|
150
|
-
A useful scaling factor might vw. At 360px, 16px would be around 4.44vw (360/16).
|
|
151
|
-
At 360px: margin is at 16px or 1em.
|
|
152
|
-
At 1960px: 4.44vw is at 87px but that will be clamped to 32px or 2em.
|
|
153
|
-
The calculation implies that the natural point that the margin becomes 2em is clamped on
|
|
154
|
-
wider screens is at 727px.
|
|
155
|
-
*/
|
|
156
|
-
--fab-margin: clamp(1em, 4.44vw, 2em);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
140
|
/*todo*/
|
|
160
141
|
/*@apply flex justify-center items-center;*/
|
|
161
142
|
.default-page-container {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as PineappleLayoutBase } from "./components/pineapple/PineappleBaseLayout.svelte";
|
|
2
2
|
export * from "./components/index";
|
|
3
3
|
export * from "./components/overrideable_meta/index";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./ui/modules/NavigationMenu/index";
|
|
5
5
|
export * from "./types/api/index";
|
|
6
6
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
7
7
|
export * from "./components/dialog_manager/DialogManager";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { default as PineappleLayoutBase } from "./components/pineapple/PineappleBaseLayout.svelte";
|
|
3
3
|
export * from "./components/index";
|
|
4
4
|
export * from "./components/overrideable_meta/index";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./ui/modules/NavigationMenu/index";
|
|
6
6
|
export * from "./types/api/index";
|
|
7
7
|
export * from "./components/dialog_manager/DialogManagerStore";
|
|
8
8
|
export * from "./components/dialog_manager/DialogManager";
|
package/dist/styles/app.css
CHANGED
|
@@ -10,16 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
@custom-variant turnip (&:where([data-theme=turnip], [data-theme=turnip] *));
|
|
12
12
|
|
|
13
|
+
html {
|
|
14
|
+
--dialog-start-pad: clamp(0em, 5vw, 2em);
|
|
15
|
+
--dialog-box-width: min(calc(54em), calc(100vw - var(--dialog-start-pad) - 2px));
|
|
16
|
+
--dialog-box-height: clamp(15em, 50vw, 18em);
|
|
17
|
+
--fab-margin: 1rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
.footer-space {
|
|
14
21
|
width: 100%;
|
|
15
22
|
height: calc(var(--dialog-box-height) + 4em);
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
a.dialog-choice {
|
|
26
|
+
font-size: inherit;
|
|
19
27
|
cursor: url("$pkg/assets/icons/chat-cursor.svg"), auto;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
a.external-link {
|
|
31
|
+
font-size: inherit;
|
|
23
32
|
cursor: url("$pkg/assets/icons/external-link.svg"), auto;
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -37,20 +46,6 @@ a.external-link {
|
|
|
37
46
|
background: rgba(var(--color-secondary-500));
|
|
38
47
|
}
|
|
39
48
|
|
|
40
|
-
.dialog-box {
|
|
41
|
-
background-color: rgb(var(--color-surface-500) / 0.9);
|
|
42
|
-
position: fixed;
|
|
43
|
-
bottom: 0;
|
|
44
|
-
width: var(--dialog-box-width); /*75em + 4em padding*/
|
|
45
|
-
height: var(--dialog-box-height);
|
|
46
|
-
max-width: calc(100vw - ((var(--fab-margin) * 2) + 4em));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.dark .dialog-box {
|
|
50
|
-
background-color: rgb(var(--color-surface-900) / 0.95);
|
|
51
|
-
--tw-ring-color: rgb(var(--color-text-400));
|
|
52
|
-
/*background-color: red;*/
|
|
53
|
-
}
|
|
54
49
|
|
|
55
50
|
@layer base {
|
|
56
51
|
.game-link-section {
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { scale } from 'svelte/transition';
|
|
3
|
-
import { elasticOut } from 'svelte/easing';
|
|
4
|
-
|
|
5
|
-
import type { ModalProps } from 'svelte-modals';
|
|
6
|
-
|
|
7
|
-
import { onMount, type Snippet } from 'svelte';
|
|
8
|
-
import { PinyaCard } from '../elements';
|
|
9
|
-
|
|
10
|
-
// https://svelte-modals.mattjennin.gs/modal-components/props/#typescript
|
|
11
|
-
interface ModalBaseProps extends ModalProps {
|
|
12
|
-
children: Snippet,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
children,
|
|
17
|
-
isOpen,
|
|
18
|
-
close
|
|
19
|
-
}: ModalBaseProps = $props();
|
|
20
|
-
|
|
21
|
-
let container: HTMLDivElement;
|
|
22
|
-
onMount(() => {
|
|
23
|
-
const focusableElement = container.querySelector('input, select, textarea, button, object, a, area[href], [tabindex]');
|
|
24
|
-
if (focusableElement) {
|
|
25
|
-
(focusableElement as HTMLElement).focus();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
document.addEventListener('keydown', (e) => {
|
|
29
|
-
if (e.code === 'Escape') {
|
|
30
|
-
close();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
{#if isOpen}
|
|
37
|
-
<dialog aria-modal="true" in:scale|global={{
|
|
38
|
-
start: 0.95,
|
|
39
|
-
duration: 750,
|
|
40
|
-
easing: elasticOut,
|
|
41
|
-
opacity: 0.9
|
|
42
|
-
}}>
|
|
43
|
-
<div class="interactable" bind:this={container}>
|
|
44
|
-
<PinyaCard
|
|
45
|
-
widthClass="max-w-xl2"
|
|
46
|
-
paddingClass="pl-8 pr-8 pt-4 pb-8"
|
|
47
|
-
>
|
|
48
|
-
{@render children?.()}
|
|
49
|
-
</PinyaCard>
|
|
50
|
-
</div>
|
|
51
|
-
</dialog>
|
|
52
|
-
{/if}
|
|
53
|
-
|
|
54
|
-
<style>
|
|
55
|
-
dialog {
|
|
56
|
-
padding: 0;
|
|
57
|
-
background-color: transparent;
|
|
58
|
-
border-color: transparent;
|
|
59
|
-
z-index: 20;
|
|
60
|
-
position: fixed;
|
|
61
|
-
top: 0;
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 100%;
|
|
64
|
-
display: flex;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
align-items: center;
|
|
67
|
-
|
|
68
|
-
/* allow click-through to backdrop */
|
|
69
|
-
pointer-events: none;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.interactable {
|
|
73
|
-
pointer-events: auto;
|
|
74
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { scale } from 'svelte/transition';
|
|
3
|
+
import { elasticOut } from 'svelte/easing';
|
|
4
|
+
|
|
5
|
+
import type { ModalProps } from 'svelte-modals';
|
|
6
|
+
|
|
7
|
+
import { onMount, type Snippet } from 'svelte';
|
|
8
|
+
import { PinyaCard } from '../elements';
|
|
9
|
+
|
|
10
|
+
// https://svelte-modals.mattjennin.gs/modal-components/props/#typescript
|
|
11
|
+
interface ModalBaseProps extends ModalProps {
|
|
12
|
+
children: Snippet,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
children,
|
|
17
|
+
isOpen,
|
|
18
|
+
close
|
|
19
|
+
}: ModalBaseProps = $props();
|
|
20
|
+
|
|
21
|
+
let container: HTMLDivElement;
|
|
22
|
+
onMount(() => {
|
|
23
|
+
const focusableElement = container.querySelector('input, select, textarea, button, object, a, area[href], [tabindex]');
|
|
24
|
+
if (focusableElement) {
|
|
25
|
+
(focusableElement as HTMLElement).focus();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
document.addEventListener('keydown', (e) => {
|
|
29
|
+
if (e.code === 'Escape') {
|
|
30
|
+
close();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
{#if isOpen}
|
|
37
|
+
<dialog aria-modal="true" in:scale|global={{
|
|
38
|
+
start: 0.95,
|
|
39
|
+
duration: 750,
|
|
40
|
+
easing: elasticOut,
|
|
41
|
+
opacity: 0.9
|
|
42
|
+
}}>
|
|
43
|
+
<div class="interactable" bind:this={container}>
|
|
44
|
+
<PinyaCard
|
|
45
|
+
widthClass="max-w-xl2"
|
|
46
|
+
paddingClass="pl-8 pr-8 pt-4 pb-8"
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</PinyaCard>
|
|
50
|
+
</div>
|
|
51
|
+
</dialog>
|
|
52
|
+
{/if}
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
dialog {
|
|
56
|
+
padding: 0;
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
border-color: transparent;
|
|
59
|
+
z-index: 20;
|
|
60
|
+
position: fixed;
|
|
61
|
+
top: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
align-items: center;
|
|
67
|
+
|
|
68
|
+
/* allow click-through to backdrop */
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.interactable {
|
|
73
|
+
pointer-events: auto;
|
|
74
|
+
}
|
|
75
75
|
</style>
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Accordion } from "@skeletonlabs/skeleton-svelte";
|
|
3
|
-
import type { Snippet } from "svelte";
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
value = $bindable(),
|
|
7
|
-
children,
|
|
8
|
-
}: {
|
|
9
|
-
value: string[],
|
|
10
|
-
children: Snippet,
|
|
11
|
-
} = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<Accordion
|
|
15
|
-
classes="bg-primary-100 dark:bg-tertiary-900 dark:saturate-75"
|
|
16
|
-
{value}
|
|
17
|
-
onValueChange={(e) => (value = e.value)}
|
|
18
|
-
collapsible
|
|
19
|
-
>
|
|
20
|
-
{@render children()}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Accordion } from "@skeletonlabs/skeleton-svelte";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
value = $bindable(),
|
|
7
|
+
children,
|
|
8
|
+
}: {
|
|
9
|
+
value: string[],
|
|
10
|
+
children: Snippet,
|
|
11
|
+
} = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Accordion
|
|
15
|
+
classes="bg-primary-100 dark:bg-tertiary-900 dark:saturate-75"
|
|
16
|
+
{value}
|
|
17
|
+
onValueChange={(e) => (value = e.value)}
|
|
18
|
+
collapsible
|
|
19
|
+
>
|
|
20
|
+
{@render children()}
|
|
21
21
|
</Accordion>
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// noinspection ES6UnusedImports
|
|
3
|
-
import { Accordion } from "@skeletonlabs/skeleton-svelte";
|
|
4
|
-
import type { Snippet } from "svelte";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
value,
|
|
8
|
-
control: controlSnippet,
|
|
9
|
-
panel: panelSnippet,
|
|
10
|
-
}: {
|
|
11
|
-
value: string,
|
|
12
|
-
control: Snippet;
|
|
13
|
-
panel: Snippet;
|
|
14
|
-
} = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<Accordion.Item
|
|
18
|
-
{value}
|
|
19
|
-
controlHover="hover:bg-primary-500 dark:hover:bg-secondary-600"
|
|
20
|
-
>
|
|
21
|
-
<!-- Control -->
|
|
22
|
-
{#snippet control()}
|
|
23
|
-
{@render controlSnippet()}
|
|
24
|
-
{/snippet}
|
|
25
|
-
<!-- Panel -->
|
|
26
|
-
{#snippet panel()}
|
|
27
|
-
{@render panelSnippet()}
|
|
28
|
-
{/snippet}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// noinspection ES6UnusedImports
|
|
3
|
+
import { Accordion } from "@skeletonlabs/skeleton-svelte";
|
|
4
|
+
import type { Snippet } from "svelte";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
value,
|
|
8
|
+
control: controlSnippet,
|
|
9
|
+
panel: panelSnippet,
|
|
10
|
+
}: {
|
|
11
|
+
value: string,
|
|
12
|
+
control: Snippet;
|
|
13
|
+
panel: Snippet;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Accordion.Item
|
|
18
|
+
{value}
|
|
19
|
+
controlHover="hover:bg-primary-500 dark:hover:bg-secondary-600"
|
|
20
|
+
>
|
|
21
|
+
<!-- Control -->
|
|
22
|
+
{#snippet control()}
|
|
23
|
+
{@render controlSnippet()}
|
|
24
|
+
{/snippet}
|
|
25
|
+
<!-- Panel -->
|
|
26
|
+
{#snippet panel()}
|
|
27
|
+
{@render panelSnippet()}
|
|
28
|
+
{/snippet}
|
|
29
29
|
</Accordion.Item>
|