@turnipxenon/pineapple 3.0.0 → 3.1.0-alpha.10
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 +103 -0
- package/dist/components/RandomizedBackground.svelte +4 -0
- package/dist/components/RandomizedBackground.svelte.d.ts +1 -0
- package/dist/components/blog_template/BlogTemplate.svelte +15 -18
- package/dist/components/blog_template/BlogTemplate.svelte.d.ts +3 -2
- 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/DialogManager.d.ts +3 -2
- package/dist/components/dialog_manager/DialogManager.js +6 -4
- package/dist/components/dialog_manager/DialogProcessor.d.ts +4 -2
- package/dist/components/dialog_manager/DialogProcessor.js +23 -18
- package/dist/components/dialog_manager/IDialogManager.d.ts +1 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts +2 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +4 -5
- package/dist/components/dialog_overlay/DialogOverlay.svelte +149 -51
- package/dist/components/layouts/SeaweedBaseLayout.svelte +0 -6
- package/dist/components/pineapple/PineappleBaseLayout.svelte +3 -23
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/scripts/pineapple_fiber/PineappleWeaver.js +1 -2
- package/dist/styles/app.css +11 -14
- package/dist/styles/turnip-theme.css +17 -7
- package/dist/ui/components/ModalBase.svelte +74 -74
- package/dist/ui/components/SocialSection.svelte +2 -1
- package/dist/ui/components/accordion/PinyaAccordion.svelte +20 -20
- package/dist/ui/components/accordion/PinyaAccordionItem.svelte +28 -28
- package/dist/ui/components/randomized-background/RandomizedBackground.svelte +9 -1
- package/dist/ui/elements/CodeBlock/CodeBlock.svelte +65 -64
- package/dist/ui/elements/CodeBlock/CodeBlockProps.d.ts +1 -1
- package/dist/ui/elements/ImageIcon.svelte +53 -53
- package/dist/ui/elements/ImageIcon.svelte.d.ts +1 -1
- package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButton.svelte +25 -0
- package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButton.svelte.d.ts +4 -0
- package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButtonProps.d.ts +4 -0
- package/dist/ui/elements/PinyaAnchorButton/index.d.ts +2 -0
- package/dist/ui/elements/PinyaAnchorButton/index.js +2 -0
- package/dist/ui/elements/PinyaButton/PinyaButton.svelte +8 -31
- package/dist/ui/elements/PinyaButton/PinyaButton.svelte.d.ts +1 -1
- package/dist/ui/elements/PinyaButton/PinyaButtonProps.d.ts +4 -14
- package/dist/ui/elements/PinyaButton/PinyaButtonProps.js +1 -6
- package/dist/ui/elements/PinyaButtonCommon/ButtonVariant.d.ts +5 -0
- package/dist/ui/elements/PinyaButtonCommon/ButtonVariant.js +6 -0
- package/dist/ui/elements/PinyaButtonCommon/PinyaButtonCommonProps.d.ts +8 -0
- package/dist/ui/elements/PinyaButtonCommon/PinyaButtonCommonProps.js +2 -0
- package/dist/ui/elements/PinyaButtonCommon/createButtonClass.d.ts +2 -0
- package/dist/ui/elements/PinyaButtonCommon/createButtonClass.js +31 -0
- package/dist/ui/elements/PinyaButtonCommon/index.d.ts +3 -0
- package/dist/ui/elements/PinyaButtonCommon/index.js +3 -0
- package/dist/ui/elements/PinyaCard/PinyaCard.svelte +30 -0
- package/dist/ui/elements/PinyaCard/PinyaCard.svelte.d.ts +7 -0
- package/dist/ui/elements/{pinya-card/props.d.ts → PinyaCard/PinyaCardProps.d.ts} +1 -0
- package/dist/ui/elements/PinyaCard/PinyaCardProps.js +1 -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 +7 -5
- package/dist/ui/elements/index.js +9 -5
- 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/Hepcat.svelte +1 -1
- package/dist/ui/modules/projects/Pengi.svelte +61 -61
- package/dist/ui/modules/projects/Soulwork.svelte +1 -1
- package/dist/ui/modules/projects/ThisWebpage.svelte +11 -9
- package/dist/ui/templates/PinyaPageLayout/PinyaPageLayout.svelte +7 -3
- package/dist/ui/templates/PinyaPageLayout/runes.svelte.d.ts +3 -0
- package/dist/ui/templates/PinyaPageLayout/runes.svelte.js +1 -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 +11 -14
- package/dist/components/dialog_manager/DialogMangerInit.d.ts +0 -2
- package/dist/components/dialog_manager/DialogMangerInit.js +0 -21
- 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 +0 -21
- 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.js → PinyaAnchorButton/PinyaAnchorButtonProps.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
package/README.md
CHANGED
|
@@ -26,3 +26,106 @@ yarn build
|
|
|
26
26
|
You can preview the production build with `yarn preview`.
|
|
27
27
|
|
|
28
28
|
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Installation as a package
|
|
32
|
+
|
|
33
|
+
TODO: If you're curious how to install this on a fresh package or a package not using Skeleton, you can ask me to document the steps but I haven't explored that since I'm focused in migrating my projects. It should just be installing Skeleton v3 and then seeing the steps below.
|
|
34
|
+
|
|
35
|
+
## Migration from v2 to v3
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn add @turnipxenon2/pineapple
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Manual steps**
|
|
42
|
+
|
|
43
|
+
We still have to do some manual set up to our project to make it work.
|
|
44
|
+
|
|
45
|
+
1. Follow these steps here: https://www.skeleton.dev/docs/get-started/migrate-from-v2
|
|
46
|
+
|
|
47
|
+
2. **Configure Tailwind.** Open your global stylesheet in `/src/styles/app.css` and add the following imports:
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
@import 'tailwindcss';
|
|
51
|
+
@import "@skeletonlabs/skeleton";
|
|
52
|
+
@import "@skeletonlabs/skeleton/optional/presets";
|
|
53
|
+
@import "@skeletonlabs/skeleton/themes/legacy";
|
|
54
|
+
@import '../../../node_modules/@turnipxenon/pineapple/dist/styles/app.css';
|
|
55
|
+
@import '../../../node_modules/@turnipxenon/pineapple/dist/styles/turnip-theme.css';
|
|
56
|
+
|
|
57
|
+
@source "../../../node_modules/@skeletonlabs/skeleton-svelte/dist";
|
|
58
|
+
@source '../../../node_modules/@turnipxenon/pineapple/dist/';
|
|
59
|
+
|
|
60
|
+
@plugin '@tailwindcss/forms';
|
|
61
|
+
@plugin '@tailwindcss/typography';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. **Set Active Theme.** Open /src/app.html, then set the data-theme attribute on the HTML tag to define the active theme.
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<html lang="en" data-theme="turnip">
|
|
68
|
+
...
|
|
69
|
+
</html>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. We have to setup +layout.svelte to and import some dependencies
|
|
73
|
+
|
|
74
|
+
As a reference as to why we need to do above, we use the UI framework Skeleton, which has the same setup. But, we have to make some modifications to make our project and Skeleton to work as a package.
|
|
75
|
+
|
|
76
|
+
**Reference**
|
|
77
|
+
|
|
78
|
+
- https://next.skeleton.dev/docs/get-started/installation/sveltekit
|
|
79
|
+
- https://inlang.com/m/gerre34r/library-inlang-paraglideJs/sveltekit
|
|
80
|
+
|
|
81
|
+
- Just use skeleton or use the base project?
|
|
82
|
+
|
|
83
|
+
**Current steps how to use this package in another project**
|
|
84
|
+
|
|
85
|
+
1. Create using Skeleton: https://next.skeleton.dev/docs/get-started/installation/sveltekit
|
|
86
|
+
2. Follow instructions and skeleton UI package
|
|
87
|
+
3. Install pineapple
|
|
88
|
+
4. Set up ModeWatcher and Modals, primarily in +layout.svelte
|
|
89
|
+
5. Set up ParaglideJS internationalization (beta not SvelteKit)
|
|
90
|
+
6. Add this to `+layout.svelte`
|
|
91
|
+
|
|
92
|
+
```sveltehtml
|
|
93
|
+
<script lang="ts">
|
|
94
|
+
import { PinyaPageLayout, PinyaBase } from '@turnipxenon/pineapple/templates';
|
|
95
|
+
import '../app.css';
|
|
96
|
+
|
|
97
|
+
let { children } = $props();
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<PinyaBase>
|
|
101
|
+
<PinyaPageLayout>
|
|
102
|
+
{@render children()}
|
|
103
|
+
</PinyaPageLayout>
|
|
104
|
+
</PinyaBase>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
TODO: if we are happy with our base, publish it to github and link the corresponding git commits here
|
|
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
|
+
```
|
|
119
|
+
|
|
120
|
+
## Local linking
|
|
121
|
+
|
|
122
|
+
1. In pineapple, run `yarn link`
|
|
123
|
+
2. In seaweed2, run `yarn unlink @turnipxenon/pineapple`
|
|
124
|
+
|
|
125
|
+
**To unlink:**
|
|
126
|
+
|
|
127
|
+
1. In seaweed2, run `yarn unlink @turnipxenon/pineapple`
|
|
128
|
+
2. In pineapple, run `yarn unlink`
|
|
129
|
+
3. **If unlinking, remember to restart PC cause Windows symlinking is tricky**
|
|
130
|
+
|
|
131
|
+
To reinstall a single package: `yarn add @turnipxenon/pineapple --no-package-lock --no-save`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import "./blog-template.css";
|
|
3
|
-
import {
|
|
4
|
-
import { onDestroy, onMount } from "svelte";
|
|
3
|
+
import { onDestroy, onMount, type Snippet } from "svelte";
|
|
5
4
|
import BlogTemplateInner from "./BlogTemplateInner.svelte";
|
|
6
|
-
import type { SimplePageMeta } from "
|
|
5
|
+
import type { SimplePageMeta } from "../../ui/modules/NavigationMenu/index";
|
|
7
6
|
import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
|
|
8
|
-
import
|
|
7
|
+
import PinyaCard from "../../ui/elements/PinyaCard/PinyaCard.svelte";
|
|
8
|
+
import { appState } from "../../ui/templates/index";
|
|
9
9
|
|
|
10
10
|
// grab page meta from the adjacent meta.json
|
|
11
11
|
interface Props {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
shouldFillWholePage?: boolean;
|
|
14
14
|
shouldEnableDialogOverlay?: boolean;
|
|
15
15
|
includeDataNoSnippet?: boolean;
|
|
16
|
-
children?:
|
|
16
|
+
children?: Snippet;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
let {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
children
|
|
25
25
|
}: Props = $props();
|
|
26
26
|
|
|
27
|
-
enableBackground.set(!shouldFillWholePage);
|
|
28
27
|
let initialDialogState = false;
|
|
29
28
|
|
|
30
29
|
onMount(() => {
|
|
@@ -33,10 +32,11 @@
|
|
|
33
32
|
});
|
|
34
33
|
|
|
35
34
|
onDestroy(() => {
|
|
36
|
-
|
|
35
|
+
appState.bgOpacity = 1;
|
|
37
36
|
enableDialogueOverlay.set(initialDialogState);
|
|
38
37
|
});
|
|
39
38
|
|
|
39
|
+
appState.bgOpacity = shouldFillWholePage ? 0.2 : 1;
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
{#if shouldFillWholePage}
|
|
@@ -46,21 +46,18 @@
|
|
|
46
46
|
</BlogTemplateInner>
|
|
47
47
|
</div>
|
|
48
48
|
{:else}
|
|
49
|
-
<
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</BlogTemplateInner>
|
|
55
|
-
</div>
|
|
56
|
-
{/snippet}
|
|
57
|
-
</Card>
|
|
49
|
+
<PinyaCard {includeDataNoSnippet} widthClass="max-w-4xl">
|
|
50
|
+
<BlogTemplateInner pageMeta={pageMeta}>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</BlogTemplateInner>
|
|
53
|
+
</PinyaCard>
|
|
58
54
|
{/if}
|
|
59
55
|
|
|
60
56
|
<style>
|
|
61
57
|
.whole-page {
|
|
62
|
-
height:
|
|
58
|
+
height: 100vh;
|
|
63
59
|
width: 100%;
|
|
64
|
-
|
|
60
|
+
padding-right: 2em;
|
|
61
|
+
padding-left: 2em;
|
|
65
62
|
}
|
|
66
63
|
</style>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "./blog-template.css";
|
|
2
|
-
import type
|
|
2
|
+
import { type Snippet } from "svelte";
|
|
3
|
+
import type { SimplePageMeta } from "../../ui/modules/NavigationMenu/index";
|
|
3
4
|
interface Props {
|
|
4
5
|
pageMeta: SimplePageMeta;
|
|
5
6
|
shouldFillWholePage?: boolean;
|
|
6
7
|
shouldEnableDialogOverlay?: boolean;
|
|
7
8
|
includeDataNoSnippet?: boolean;
|
|
8
|
-
children?:
|
|
9
|
+
children?: Snippet;
|
|
9
10
|
}
|
|
10
11
|
declare const BlogTemplate: import("svelte").Component<Props, {}, "">;
|
|
11
12
|
type BlogTemplate = ReturnType<typeof BlogTemplate>;
|
|
@@ -15,8 +15,8 @@ export declare class DialogManager implements IDialogManager {
|
|
|
15
15
|
currentIndex: number;
|
|
16
16
|
previousTimestamp: number;
|
|
17
17
|
isDoneTransition: boolean;
|
|
18
|
-
currentPortrait: import("svelte/store").Writable<
|
|
19
|
-
portraitMap: Map<string,
|
|
18
|
+
currentPortrait: import("svelte/store").Writable<string>;
|
|
19
|
+
portraitMap: Map<string, string>;
|
|
20
20
|
currentState: DialogState;
|
|
21
21
|
currentReadableState: import("svelte/store").Writable<DialogState>;
|
|
22
22
|
hidePercent: import("svelte/motion").Tweened<number>;
|
|
@@ -80,3 +80,4 @@ export declare class DialogManager implements IDialogManager {
|
|
|
80
80
|
toggleDialogOverlay(): void;
|
|
81
81
|
parseAndSetDialogTree(dialogYarn: string): Promise<DialogDetail[]>;
|
|
82
82
|
}
|
|
83
|
+
export declare const dialogManager: DialogManager;
|
|
@@ -28,7 +28,7 @@ export class DialogManager {
|
|
|
28
28
|
currentIndex = 0;
|
|
29
29
|
previousTimestamp = 0;
|
|
30
30
|
isDoneTransition = false;
|
|
31
|
-
currentPortrait = writable();
|
|
31
|
+
currentPortrait = writable("");
|
|
32
32
|
portraitMap = new Map();
|
|
33
33
|
currentState = DialogState.Visible;
|
|
34
34
|
currentReadableState = writable(this.currentState);
|
|
@@ -37,13 +37,14 @@ export class DialogManager {
|
|
|
37
37
|
easing: backOut
|
|
38
38
|
}); // 100 = 100%
|
|
39
39
|
skipNextActiveTime = 0;
|
|
40
|
-
dialogProcessor
|
|
40
|
+
dialogProcessor;
|
|
41
41
|
// for queueing actions
|
|
42
42
|
_setDialogChoiceQueue = [];
|
|
43
43
|
_setDialogChoiceMutex = false;
|
|
44
44
|
onSetDialogListeners = [];
|
|
45
45
|
enableDialogueOverlayCache = false;
|
|
46
46
|
constructor() {
|
|
47
|
+
this.dialogProcessor = new DialogProcessor(this);
|
|
47
48
|
enableDialogueOverlay.subscribe((value) => {
|
|
48
49
|
// todo: investigate why we cant put setDialogDefault inside the then clause
|
|
49
50
|
// ISSUE #82 https://github.com/TurnipXenon/pineapple/issues/82
|
|
@@ -162,7 +163,7 @@ export class DialogManager {
|
|
|
162
163
|
// set the portrait
|
|
163
164
|
let portraitValue = AresHappy;
|
|
164
165
|
if (this.currentMessageMeta.portraitType) {
|
|
165
|
-
portraitValue = this.portraitMap.get(this.currentMessageMeta.portraitType);
|
|
166
|
+
portraitValue = this.portraitMap.get(this.currentMessageMeta.portraitType ?? AresHappy);
|
|
166
167
|
}
|
|
167
168
|
if (portraitValue) {
|
|
168
169
|
this.currentPortrait.update(() => portraitValue);
|
|
@@ -212,7 +213,7 @@ export class DialogManager {
|
|
|
212
213
|
if (!this.isDoneTransition && this.currentIndex > this.fullCurrentMessage.length) {
|
|
213
214
|
const elementList = document.getElementsByClassName("dialog-choice");
|
|
214
215
|
for (const el of elementList) {
|
|
215
|
-
el.addEventListener("click", (
|
|
216
|
+
el.addEventListener("click", () => {
|
|
216
217
|
// todo: make more robust; for now we're assuming first class is our choice
|
|
217
218
|
const choice = el.classList[0].split("-")[1];
|
|
218
219
|
this.setDialogChoice(this.dialogMessageMap.get(choice));
|
|
@@ -261,3 +262,4 @@ export class DialogManager {
|
|
|
261
262
|
});
|
|
262
263
|
}
|
|
263
264
|
}
|
|
265
|
+
export const dialogManager = new DialogManager();
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
|
|
2
|
-
import {
|
|
2
|
+
import type { IDialogManager } from "../..";
|
|
3
3
|
/**
|
|
4
4
|
* DialogProcessor processes dialogs
|
|
5
5
|
*/
|
|
6
6
|
export declare class DialogProcessor {
|
|
7
|
-
|
|
7
|
+
private readonly dialogManager;
|
|
8
|
+
private processingTree;
|
|
9
|
+
constructor(dialogManager: IDialogManager);
|
|
8
10
|
/**
|
|
9
11
|
* process the dialog line by line and return a presentable string
|
|
10
12
|
* @param dialogDetail
|
|
@@ -17,24 +17,29 @@ import { UnvisitCommand } from "./behavior_tree/line_processors/commands/Unvisit
|
|
|
17
17
|
* DialogProcessor processes dialogs
|
|
18
18
|
*/
|
|
19
19
|
export class DialogProcessor {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
dialogManager;
|
|
21
|
+
processingTree;
|
|
22
|
+
constructor(dialogManager) {
|
|
23
|
+
this.dialogManager = dialogManager;
|
|
24
|
+
this.processingTree = new LineSelectorNode([
|
|
25
|
+
/*region comment based formats*/
|
|
26
|
+
new IgnoreJumpNode(), // must be prioritized above line comment node
|
|
27
|
+
new LineCommentNode(),
|
|
28
|
+
/*endregion commend based formats*/
|
|
29
|
+
new EndIfNode(),
|
|
30
|
+
new ElseIfNode(),
|
|
31
|
+
new ElseNode(),
|
|
32
|
+
new IfNode(),
|
|
33
|
+
new IgnoreGuardNode(),
|
|
34
|
+
/*region commands*/
|
|
35
|
+
new SetVariableNode(),
|
|
36
|
+
new DeclareCommand(),
|
|
37
|
+
new JumpCommand(this.dialogManager),
|
|
38
|
+
new UnvisitCommand(),
|
|
39
|
+
/*endregion commands*/
|
|
40
|
+
new NormalLineProcessorNode()
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
38
43
|
/**
|
|
39
44
|
* process the dialog line by line and return a presentable string
|
|
40
45
|
* @param dialogDetail
|
|
@@ -7,13 +7,12 @@ import type { OnSetDialogChoiceCallback } from "./DialogManager";
|
|
|
7
7
|
export interface IDialogManager {
|
|
8
8
|
dialogMessageMap: Map<string, DialogDetail>;
|
|
9
9
|
currentDialogTree: DialogDetail[];
|
|
10
|
-
fullCurrentMessage: string;
|
|
11
10
|
currentMessageMeta: DialogDetail;
|
|
12
11
|
currentMessage: Writable<string>;
|
|
13
12
|
currentIndex: number;
|
|
14
13
|
previousTimestamp: number;
|
|
15
14
|
isDoneTransition: boolean;
|
|
16
|
-
currentPortrait: Writable<
|
|
15
|
+
currentPortrait: Writable<string>;
|
|
17
16
|
portraitMap: Map<string, any>;
|
|
18
17
|
currentState: DialogState;
|
|
19
18
|
currentReadableState: Writable<DialogState>;
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { SetVariableNode } from "../SetVariableNode";
|
|
|
5
5
|
import type { IDialogManager } from "../../../IDialogManager";
|
|
6
6
|
export declare class JumpCommand implements LineBehaviorNode {
|
|
7
7
|
setVariableNode: SetVariableNode;
|
|
8
|
-
dialogManager:
|
|
9
|
-
constructor();
|
|
8
|
+
dialogManager: IDialogManager;
|
|
9
|
+
constructor(dialogManager: IDialogManager);
|
|
10
10
|
process(nodeArgs: LineNodeArguments): LineBehaviorResult;
|
|
11
11
|
}
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { BehaviorStatus } from "../../core/BehaviorStatus";
|
|
2
2
|
import { SetVariableNode } from "../SetVariableNode";
|
|
3
3
|
import { btreeUtils } from "../../core/BTreeUtils";
|
|
4
|
-
import { getDialogManager } from "../../../DialogMangerInit";
|
|
5
4
|
export class JumpCommand {
|
|
6
5
|
setVariableNode = new SetVariableNode();
|
|
7
|
-
dialogManager
|
|
8
|
-
constructor() {
|
|
9
|
-
|
|
6
|
+
dialogManager;
|
|
7
|
+
constructor(dialogManager) {
|
|
8
|
+
this.dialogManager = dialogManager;
|
|
10
9
|
}
|
|
11
10
|
process(nodeArgs) {
|
|
12
11
|
if (this.dialogManager === undefined) {
|
|
13
|
-
console.warn(
|
|
12
|
+
console.warn("Dialog Manger not yet initialized");
|
|
14
13
|
return {
|
|
15
14
|
renderedLine: "",
|
|
16
15
|
nextState: nodeArgs.initState,
|
|
@@ -1,42 +1,48 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { slide } from "svelte/transition";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
|
+
|
|
5
|
+
import AresHappy from "../../assets/characters/ares/ares_happy.webp";
|
|
4
6
|
import { DialogState } from "../../types/pineapple_fiber/DialogState";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
+
import { dialogManager } from "../dialog_manager/DialogManager";
|
|
8
|
+
import PinyaCard from "../../ui/elements/PinyaCard/PinyaCard.svelte";
|
|
9
|
+
import { appState } from "../../ui/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 "../dialog_manager/DialogManagerStore";
|
|
13
|
+
import PinyaButton from "../../ui/elements/PinyaButton/PinyaButton.svelte";
|
|
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);
|
|
13
|
-
let dialogManager: IDialogManager | undefined = $state(undefined);
|
|
14
21
|
onMount(() => {
|
|
15
|
-
getDialogManager()
|
|
16
|
-
.then(dm => {
|
|
17
|
-
dialogManager = dm;
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
dialogManager.currentMessage.subscribe((value) => {
|
|
24
|
+
currentMessage = value;
|
|
25
|
+
});
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
dialogManager.currentPortrait.subscribe((value) => {
|
|
28
|
+
console.log("sub value", value);
|
|
29
|
+
if (value) {
|
|
30
|
+
currentPortrait = value;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
dialogManager.hidePercent.subscribe((value) => {
|
|
35
|
+
hidePercent = value * 0.4;
|
|
36
|
+
isHidden = false;
|
|
37
|
+
});
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
dialogManager.currentReadableState.subscribe((value) => {
|
|
40
|
+
isHidden = value === DialogState.Invisible;
|
|
41
|
+
});
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
console.log("CAlling update");
|
|
44
|
+
dialogManager.update(0);
|
|
45
|
+
isMounted = true;
|
|
40
46
|
|
|
41
47
|
});
|
|
42
48
|
|
|
@@ -44,6 +50,12 @@
|
|
|
44
50
|
dialogManager?.skipAnimation();
|
|
45
51
|
};
|
|
46
52
|
|
|
53
|
+
let enableDialogueOverlayValue = $state(true);
|
|
54
|
+
enableDialogueOverlay.subscribe((value) => {
|
|
55
|
+
enableDialogueOverlayValue = value;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
enableDialogueOverlay.set(appState.enableDialogOnByDefault ?? false);
|
|
47
59
|
</script>
|
|
48
60
|
|
|
49
61
|
<div class="dialog-elements"
|
|
@@ -53,18 +65,63 @@
|
|
|
53
65
|
<div class="dialog-portrait-container">
|
|
54
66
|
<img src={currentPortrait} alt="Ares" class="dialog-portrait" />
|
|
55
67
|
</div>
|
|
56
|
-
<div
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
<div
|
|
69
|
+
tabindex="0"
|
|
70
|
+
role="button"
|
|
71
|
+
class="dialog-box"
|
|
72
|
+
onclick={onDialogClick}
|
|
73
|
+
onkeyup={(e) => {
|
|
74
|
+
if (e.key === 'j') {
|
|
75
|
+
onDialogClick()
|
|
76
|
+
; }
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<PinyaCard
|
|
80
|
+
widthClass=""
|
|
81
|
+
paddingClass=""
|
|
82
|
+
className="dialog-name"
|
|
83
|
+
>
|
|
84
|
+
<div class="fake-h1">Turnip</div>
|
|
85
|
+
</PinyaCard>
|
|
86
|
+
<PinyaCard
|
|
87
|
+
widthClass="w-full"
|
|
88
|
+
className="dialog-text"
|
|
89
|
+
colorClass=""
|
|
90
|
+
flexClass=""
|
|
91
|
+
>
|
|
61
92
|
<!-- Made for 140 characters, like the original tweets -->
|
|
62
93
|
{@html currentMessage}
|
|
63
|
-
</
|
|
94
|
+
</PinyaCard>
|
|
64
95
|
</div>
|
|
65
96
|
</div>
|
|
66
97
|
|
|
98
|
+
|
|
99
|
+
{#if appState.allowDialog && isMounted}
|
|
100
|
+
<div class="fab-container" transition:slide>
|
|
101
|
+
<PinyaButton
|
|
102
|
+
classes="fab"
|
|
103
|
+
onclick={()=>{dialogManager.toggleDialogOverlay();}}
|
|
104
|
+
>
|
|
105
|
+
{#if (enableDialogueOverlayValue)}
|
|
106
|
+
<img class="turnip-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
|
|
107
|
+
{:else }
|
|
108
|
+
<img class="turnip-icon" src={FABIcon} alt="interactive floating action button represented as a turnip">
|
|
109
|
+
{/if}
|
|
110
|
+
</PinyaButton>
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
113
|
+
|
|
67
114
|
<style>
|
|
115
|
+
:global(.dialog-text) {
|
|
116
|
+
height: 100%;
|
|
117
|
+
padding: 0.8lh 2rem 0.5lh;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:global(.dialog-text) {
|
|
121
|
+
font-size: clamp(1rem, 3vw, 1.75rem);
|
|
122
|
+
line-height: calc(clamp(1rem, 3vw, 1.75rem) * 1.5);
|
|
123
|
+
}
|
|
124
|
+
|
|
68
125
|
.dialog-elements {
|
|
69
126
|
position: fixed;
|
|
70
127
|
z-index: 10;
|
|
@@ -82,34 +139,18 @@
|
|
|
82
139
|
transform: translateY(var(--hidePercentHeight));
|
|
83
140
|
}
|
|
84
141
|
|
|
85
|
-
.dialog-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
line-height: 1.5em;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.dialog-padding :global(p) {
|
|
92
|
-
font-size: clamp(1em, 5vw, 1.3em) !important;
|
|
93
|
-
line-height: 1.5em !important;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.dialog-padding {
|
|
97
|
-
padding: clamp(1.5em, 5vw, 1.75em) clamp(0em, 5vw - 0.5em, 2em) 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.dialog-name {
|
|
101
|
-
padding-top: 2rem;
|
|
102
|
-
padding-left: 4rem;
|
|
103
|
-
padding-right: 4rem;
|
|
142
|
+
:global(.dialog-name) {
|
|
143
|
+
padding-left: 2rem;
|
|
144
|
+
padding-right: 2rem;
|
|
104
145
|
position: fixed;
|
|
105
146
|
}
|
|
106
147
|
|
|
107
|
-
.dialog-name:dir(ltr) {
|
|
148
|
+
:global(.dialog-name:dir(ltr)) {
|
|
108
149
|
/* for centering vertically */
|
|
109
150
|
transform: translateX(clamp(0em, 5vw - 0.5em, 1em)) translateY(-50%);
|
|
110
151
|
}
|
|
111
152
|
|
|
112
|
-
.dialog-name:dir(rtl) {
|
|
153
|
+
:global(.dialog-name:dir(rtl)) {
|
|
113
154
|
/* for centering vertically */
|
|
114
155
|
transform: translateX(calc(clamp(0em, 5vw - 0.5em, 1em) * -1)) translateY(-50%);
|
|
115
156
|
}
|
|
@@ -138,4 +179,61 @@
|
|
|
138
179
|
.dialog-portrait:dir(rtl) {
|
|
139
180
|
transform: scaleX(-1);
|
|
140
181
|
}
|
|
182
|
+
|
|
183
|
+
:global(html) {
|
|
184
|
+
--bg-dialog: rgba(255, 247, 225, 0.9);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:global(html.dark) {
|
|
188
|
+
--bg-dialog: rgba(76, 71, 59, 0.9);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.dialog-box {
|
|
192
|
+
background-color: var(--bg-dialog);
|
|
193
|
+
position: fixed;
|
|
194
|
+
bottom: 0;
|
|
195
|
+
width: var(--dialog-box-width); /*75em + 4em padding*/
|
|
196
|
+
height: var(--dialog-box-height);
|
|
197
|
+
max-width: calc(100vw - ((var(--fab-margin) * 3) + (clamp(2rem, 5vw, 4rem))));
|
|
198
|
+
border-radius: 1rem;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:global(.fab) {
|
|
202
|
+
position: relative;
|
|
203
|
+
transform: scale3d(1, 1, 1.5);
|
|
204
|
+
background-color: var(--color-tertiary-500);
|
|
205
|
+
padding: 0.3rem;
|
|
206
|
+
width: clamp(2rem, 5vw, 4rem);
|
|
207
|
+
border-radius: 50%;
|
|
208
|
+
z-index: 100;
|
|
209
|
+
box-shadow: 3px 3px 3px var(--shadow-color);
|
|
210
|
+
margin-bottom: var(--fab-margin);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.fab-container {
|
|
214
|
+
position: fixed;
|
|
215
|
+
bottom: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.fab-container:dir(ltr) {
|
|
219
|
+
right: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.fab-container:dir(rtl) {
|
|
223
|
+
left: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
:global(.fab > img) {
|
|
227
|
+
width: 100%;
|
|
228
|
+
filter: brightness(0) invert(1);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
:global(.fab:dir(ltr)) {
|
|
232
|
+
margin-right: var(--fab-margin);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:global(.fab:dir(rtl)) {
|
|
236
|
+
margin-left: var(--fab-margin);
|
|
237
|
+
}
|
|
238
|
+
|
|
141
239
|
</style>
|