@turnipxenon/pineapple 3.0.0-alpha.12 → 3.0.0-alpha.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/dist/components/blog_template/BlogTemplate.svelte +1 -1
- package/dist/components/dialog_manager/DialogManager.d.ts +1 -2
- package/dist/components/dialog_manager/DialogMangerInit.d.ts +15 -2
- package/dist/components/dialog_manager/DialogMangerInit.js +2 -8
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts +0 -3
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +3 -15
- package/dist/components/dialog_overlay/DialogOverlay.svelte +22 -31
- package/dist/components/pineapple/PineappleBaseLayout.svelte +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/ui/components/SocialSection.svelte +2 -1
- package/dist/ui/elements/pinya-button/component.svelte +1 -1
- package/package.json +2 -1
- package/dist/components/dialog_manager/IDialogManager.d.ts +0 -39
- package/dist/components/dialog_manager/IDialogManager.js +0 -4
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import BlogTemplateInner from "./BlogTemplateInner.svelte";
|
|
6
6
|
import type { SimplePageMeta } from "../navigation_component/index";
|
|
7
7
|
import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
|
|
8
|
-
import { Card } from "../
|
|
8
|
+
import { default as Card } from "../Card.svelte";
|
|
9
9
|
|
|
10
10
|
// grab page meta from the adjacent meta.json
|
|
11
11
|
interface Props {
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
|
|
5
5
|
import { DialogState } from "../../types/pineapple_fiber/DialogState";
|
|
6
6
|
import { DialogProcessor } from "./DialogProcessor";
|
|
7
|
-
import type { IDialogManager } from "./IDialogManager";
|
|
8
7
|
export type OnSetDialogChoiceCallback = (newMessage: DialogDetail) => void;
|
|
9
|
-
export declare class DialogManager
|
|
8
|
+
export declare class DialogManager {
|
|
10
9
|
dialogMessageMap: Map<string, DialogDetail>;
|
|
11
10
|
currentDialogTree: DialogDetail[];
|
|
12
11
|
fullCurrentMessage: string;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { DialogManager } from "./DialogManager";
|
|
2
|
+
/**
|
|
3
|
+
* strictly must be declared last! or you might receive a weird error that looks like:
|
|
4
|
+
*
|
|
5
|
+
* 2:04:21 AM [vite] Error when evaluating SSR module /src/lib/components/dialog_manager/DialogManagerStore.ts:
|
|
6
|
+
* |- TypeError: Cannot read properties of undefined (reading '0')
|
|
7
|
+
* at <instance_members_initializer> (/src/lib/components/dialog_manager/DialogManager.ts:38:67)
|
|
8
|
+
* at new DialogManager (/src/lib/components/dialog_manager/DialogManager.ts:53:14)
|
|
9
|
+
* at eval (/src/lib/components/dialog_manager/DialogManagerStore.ts:15:23)
|
|
10
|
+
* at async instantiateModule (file:///C:/Users/Pumpkin/Projects/Web/pineapple/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:54360:9)
|
|
11
|
+
*
|
|
12
|
+
* what this means is that one member of dialogManager cannot be initialized. in our case, it was the
|
|
13
|
+
* defaultDialogMessage not yet being initialized
|
|
14
|
+
*/
|
|
15
|
+
export declare const dialogManager: DialogManager;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DialogManager } from "./DialogManager";
|
|
1
2
|
/**
|
|
2
3
|
* strictly must be declared last! or you might receive a weird error that looks like:
|
|
3
4
|
*
|
|
@@ -11,11 +12,4 @@
|
|
|
11
12
|
* what this means is that one member of dialogManager cannot be initialized. in our case, it was the
|
|
12
13
|
* defaultDialogMessage not yet being initialized
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
-
export const getDialogManager = async () => {
|
|
16
|
-
if (_dialogManager === undefined) {
|
|
17
|
-
const dm = await import('./DialogManager');
|
|
18
|
-
_dialogManager = new dm.DialogManager();
|
|
19
|
-
}
|
|
20
|
-
return _dialogManager;
|
|
21
|
-
};
|
|
15
|
+
export const dialogManager = new DialogManager();
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts
CHANGED
|
@@ -2,10 +2,7 @@ import type { LineBehaviorNode } from "../../line_core/LineBehaviorNode";
|
|
|
2
2
|
import type { LineNodeArguments } from "../../line_core/LineNodeArguments";
|
|
3
3
|
import type { LineBehaviorResult } from "../../line_core/LineBehaviorResult";
|
|
4
4
|
import { SetVariableNode } from "../SetVariableNode";
|
|
5
|
-
import type { IDialogManager } from "../../../../..";
|
|
6
5
|
export declare class JumpCommand implements LineBehaviorNode {
|
|
7
6
|
setVariableNode: SetVariableNode;
|
|
8
|
-
dialogManager: undefined | IDialogManager;
|
|
9
|
-
constructor();
|
|
10
7
|
process(nodeArgs: LineNodeArguments): LineBehaviorResult;
|
|
11
8
|
}
|
package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { BehaviorStatus } from "../../core/BehaviorStatus";
|
|
2
2
|
import { SetVariableNode } from "../SetVariableNode";
|
|
3
3
|
import { btreeUtils } from "../../core/BTreeUtils";
|
|
4
|
-
import {
|
|
4
|
+
import { dialogManager } from "../../../DialogMangerInit";
|
|
5
5
|
export class JumpCommand {
|
|
6
6
|
setVariableNode = new SetVariableNode();
|
|
7
|
-
dialogManager = undefined;
|
|
8
|
-
constructor() {
|
|
9
|
-
getDialogManager().then(dm => this.dialogManager = dm);
|
|
10
|
-
}
|
|
11
7
|
process(nodeArgs) {
|
|
12
|
-
if (this.dialogManager === undefined) {
|
|
13
|
-
console.error('Dialog Manger not yet initialized');
|
|
14
|
-
return {
|
|
15
|
-
renderedLine: "",
|
|
16
|
-
nextState: nodeArgs.initState,
|
|
17
|
-
status: BehaviorStatus.Failure
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
8
|
if (!nodeArgs.line.startsWith("<<jump")) {
|
|
21
9
|
return {
|
|
22
10
|
renderedLine: "",
|
|
@@ -35,10 +23,10 @@ export class JumpCommand {
|
|
|
35
23
|
.slice("<<jump ".length, nodeArgs.line.length - ">>".length)
|
|
36
24
|
.replace(/^\{/, "") // remove possible " at the start: https://stackoverflow.com/a/2182602
|
|
37
25
|
.replace(/}$/, ""); // remove possible " at the end: https://stackoverflow.com/a/12249011;
|
|
38
|
-
const dialogChoice =
|
|
26
|
+
const dialogChoice = dialogManager.dialogMessageMap.get(btreeUtils.simplifyToken(choiceName));
|
|
39
27
|
if (dialogChoice !== undefined) {
|
|
40
28
|
// force choice
|
|
41
|
-
|
|
29
|
+
dialogManager.setDialogChoice(dialogChoice);
|
|
42
30
|
}
|
|
43
31
|
else {
|
|
44
32
|
console.error(`Unknown jump node at line ${nodeArgs.lineIndex + 1}: ${choiceName} or ${btreeUtils.simplifyToken(choiceName)}`);
|
|
@@ -2,46 +2,37 @@
|
|
|
2
2
|
import AresHappy from "../../assets/characters/ares/ares_happy.webp";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
4
|
import { DialogState } from "../../types/pineapple_fiber/DialogState";
|
|
5
|
-
import {
|
|
6
|
-
import type { IDialogManager } from "../dialog_manager/IDialogManager";
|
|
5
|
+
import { dialogManager } from "../dialog_manager/DialogMangerInit";
|
|
7
6
|
|
|
8
7
|
let currentMessage = $state("");
|
|
8
|
+
dialogManager.currentMessage.subscribe((value) => {
|
|
9
|
+
currentMessage = value;
|
|
10
|
+
});
|
|
11
|
+
|
|
9
12
|
let currentPortrait = $state(AresHappy);
|
|
13
|
+
dialogManager.currentPortrait.subscribe((value) => {
|
|
14
|
+
if (value) {
|
|
15
|
+
currentPortrait = value;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dialogManager.currentMessage.subscribe((value) => {
|
|
20
|
-
currentMessage = value;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
dialogManager.currentPortrait.subscribe((value) => {
|
|
24
|
-
if (value) {
|
|
25
|
-
currentPortrait = value;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
dialogManager.hidePercent.subscribe((value) => {
|
|
30
|
-
hidePercent = value * 0.4;
|
|
31
|
-
isHidden = false;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
dialogManager.currentReadableState.subscribe((value) => {
|
|
35
|
-
isHidden = value === DialogState.Invisible;
|
|
36
|
-
});
|
|
22
|
+
dialogManager.hidePercent.subscribe((value) => {
|
|
23
|
+
hidePercent = value * 0.4;
|
|
24
|
+
isHidden = false;
|
|
25
|
+
});
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
dialogManager.currentReadableState.subscribe((value) => {
|
|
28
|
+
isHidden = value === DialogState.Invisible;
|
|
29
|
+
});
|
|
40
30
|
|
|
31
|
+
dialogManager.update(0);
|
|
41
32
|
});
|
|
42
33
|
|
|
43
34
|
const onDialogClick = () => {
|
|
44
|
-
dialogManager
|
|
35
|
+
dialogManager.skipAnimation();
|
|
45
36
|
};
|
|
46
37
|
|
|
47
38
|
</script>
|
|
@@ -98,9 +89,9 @@
|
|
|
98
89
|
}
|
|
99
90
|
|
|
100
91
|
.dialog-name {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
padding-top: 2rem;
|
|
93
|
+
padding-left: 4rem;
|
|
94
|
+
padding-right: 4rem;
|
|
104
95
|
position: fixed;
|
|
105
96
|
}
|
|
106
97
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import Toast from "./toast/Toast.svelte";
|
|
21
21
|
import DialogOverlay from "../dialog_overlay/DialogOverlay.svelte";
|
|
22
22
|
import { fade } from "svelte/transition";
|
|
23
|
-
import {
|
|
23
|
+
import { dialogManager } from "../dialog_manager/DialogMangerInit";
|
|
24
24
|
|
|
25
25
|
interface Props {
|
|
26
26
|
showDialogByDefault?: boolean;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
|
|
78
78
|
<!--todo: turn off hidden when it's time-->
|
|
79
79
|
<button class="fab" onclick={()=>{
|
|
80
|
-
|
|
80
|
+
dialogManager.toggleDialogOverlay()
|
|
81
81
|
}}>
|
|
82
82
|
{#if (enableDialogueOverlayValue)}
|
|
83
83
|
<img class="turnip-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
|
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,4 @@ export * from "./types/pineapple_fiber/DialogDetail";
|
|
|
11
11
|
export * from "./util/util";
|
|
12
12
|
export * from "./api/index";
|
|
13
13
|
export * from "./template/seaweed/index";
|
|
14
|
-
export
|
|
15
|
-
export { getDialogManager } from "./components/dialog_manager/DialogMangerInit";
|
|
14
|
+
export { dialogManager } from "./components/dialog_manager/DialogMangerInit";
|
package/dist/index.js
CHANGED
|
@@ -12,4 +12,4 @@ export * from "./types/pineapple_fiber/DialogDetail";
|
|
|
12
12
|
export * from "./util/util";
|
|
13
13
|
export * from "./api/index";
|
|
14
14
|
export * from "./template/seaweed/index";
|
|
15
|
-
export {
|
|
15
|
+
export { dialogManager } from "./components/dialog_manager/DialogMangerInit";
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import MailIcon from "../../assets/icons/mail.svg";
|
|
6
6
|
import GithubIcon from "../../assets/icons/github-mark.svg";
|
|
7
7
|
import LinkedinIcon from "../../assets/icons/linkedin.svg";
|
|
8
|
-
import { ButtonVariant, ImageIcon, PinyaButton } from "../elements/index";
|
|
9
8
|
import { ItchLogoHotLink } from "../../consts";
|
|
9
|
+
import { ButtonVariant, PinyaButton } from "../elements/pinya-button/index";
|
|
10
|
+
import ImageIcon from "../elements/ImageIcon.svelte";
|
|
10
11
|
|
|
11
12
|
/** @type {{isSmallVersion?: boolean, email?: string, linkedinSlug?: string, isSlot?: boolean, allowLinkedIn?: boolean}} */
|
|
12
13
|
let {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turnipxenon/pineapple",
|
|
3
3
|
"description": "personal package for base styling for other personal projects",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.14",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
7
7
|
"build": "vite build && yarn package",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"eslint-config-prettier": "^10.0.1",
|
|
28
28
|
"eslint-plugin-svelte": "^3.0.0",
|
|
29
29
|
"globals": "^16.0.0",
|
|
30
|
+
"madge": "^8.0.0",
|
|
30
31
|
"prettier": "^3.4.2",
|
|
31
32
|
"prettier-plugin-svelte": "^3.3.3",
|
|
32
33
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
|
|
2
|
-
import { type Writable } from "svelte/store";
|
|
3
|
-
import { DialogState } from "../../types/pineapple_fiber/DialogState";
|
|
4
|
-
import { type Tweened } from "svelte/motion";
|
|
5
|
-
import { DialogProcessor } from "./DialogProcessor";
|
|
6
|
-
import type { OnSetDialogChoiceCallback } from "./DialogManager";
|
|
7
|
-
export interface IDialogManager {
|
|
8
|
-
dialogMessageMap: Map<string, DialogDetail>;
|
|
9
|
-
currentDialogTree: DialogDetail[];
|
|
10
|
-
fullCurrentMessage: string;
|
|
11
|
-
currentMessageMeta: DialogDetail;
|
|
12
|
-
currentMessage: Writable<string>;
|
|
13
|
-
currentIndex: number;
|
|
14
|
-
previousTimestamp: number;
|
|
15
|
-
isDoneTransition: boolean;
|
|
16
|
-
currentPortrait: Writable<unknown>;
|
|
17
|
-
portraitMap: Map<string, any>;
|
|
18
|
-
currentState: DialogState;
|
|
19
|
-
currentReadableState: Writable<DialogState>;
|
|
20
|
-
hidePercent: Tweened<number>;
|
|
21
|
-
skipNextActiveTime: number;
|
|
22
|
-
dialogProcessor: DialogProcessor;
|
|
23
|
-
_setDialogChoiceQueue: DialogDetail[];
|
|
24
|
-
_setDialogChoiceMutex: boolean;
|
|
25
|
-
onSetDialogListeners: OnSetDialogChoiceCallback[];
|
|
26
|
-
enableDialogueOverlayCache: boolean;
|
|
27
|
-
skipAnimation: () => void;
|
|
28
|
-
enableDialog: (shouldEnable: boolean) => void;
|
|
29
|
-
setDialogTree: (newDialogTree: DialogDetail[]) => void;
|
|
30
|
-
subscribeToSetDialogChoice: (callback: OnSetDialogChoiceCallback) => void;
|
|
31
|
-
unsubscribeToSetDialogChoice: (callback: OnSetDialogChoiceCallback) => void;
|
|
32
|
-
setDialogChoice: (newMessage: (DialogDetail | undefined)) => void;
|
|
33
|
-
_setDialogChoice: () => void;
|
|
34
|
-
setDialogToDefault: () => void;
|
|
35
|
-
update: (timestamp: number) => void;
|
|
36
|
-
enableDialogOverlay(enable: boolean): void;
|
|
37
|
-
toggleDialogOverlay(): void;
|
|
38
|
-
parseAndSetDialogTree(dialogYarn: string): Promise<DialogDetail[]>;
|
|
39
|
-
}
|