@turnipxenon/pineapple 5.2.2 → 5.3.0-alpha.2
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/assets/icons/cursor-chat.svg +46 -0
- package/dist/assets/icons/cursor-open-in-new.svg +8 -0
- package/dist/assets/icons/icon-open-in-new.svg +1 -0
- package/dist/components/dialog_manager/DialogManager.d.ts +8 -2
- package/dist/components/dialog_manager/DialogManager.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogManager.js +63 -11
- package/dist/components/dialog_manager/DialogManagerStore.d.ts +0 -3
- package/dist/components/dialog_manager/DialogManagerStore.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogManagerStore.js +1 -3
- package/dist/components/dialog_manager/DialogProcessor.d.ts.map +1 -1
- package/dist/components/dialog_manager/DialogProcessor.js +3 -2
- package/dist/components/dialog_manager/DialogUtils.js +2 -2
- package/dist/components/dialog_manager/IDialogManager.d.ts +4 -2
- package/dist/components/dialog_manager/IDialogManager.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.d.ts +2 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.js +4 -3
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.d.ts +2 -0
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.d.ts +4 -2
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.js +8 -6
- package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.js +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.js +1 -2
- package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.d.ts +2 -0
- package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/ElseIfNode.js +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.js +1 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.js +2 -3
- package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.js +2 -3
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.js +3 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +3 -2
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.d.ts.map +1 -1
- package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.js +2 -3
- package/dist/modules/parsnip/ParsnipBlockChildren.svelte +3 -0
- package/dist/modules/parsnip/ParsnipBlockChildren.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/ParsnipPhrasingChildren.svelte +15 -3
- package/dist/modules/parsnip/ParsnipPhrasingChildren.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte +111 -0
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte.d.ts +9 -0
- package/dist/modules/parsnip/external-images/ParsnipImage.svelte.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte +62 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte.d.ts +9 -0
- package/dist/modules/parsnip/external-images/ParsnipImageCollection.svelte.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts +8 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.d.ts.map +1 -0
- package/dist/modules/parsnip/external-images/externalImages.remote.js +50 -0
- package/dist/modules/parsnip/route-util/ParsnipBlog.svelte +2 -1
- package/dist/modules/parsnip/route-util/ParsnipBlog.svelte.d.ts.map +1 -1
- package/dist/modules/parsnip/route-util/slugPageServerLoad.d.ts.map +1 -1
- package/dist/modules/parsnip/route-util/slugPageServerLoad.js +21 -0
- package/dist/scripts/pineapple_fiber/PineappleFiberParser.d.ts.map +1 -1
- package/dist/scripts/pineapple_fiber/PineappleFiberParser.js +19 -0
- package/dist/scripts/pineapple_fiber/TutorialBroken.yarn +143 -0
- package/dist/styles/app.css +30 -2
- package/dist/test/DialogTestUtility.d.ts +8 -0
- package/dist/test/DialogTestUtility.d.ts.map +1 -0
- package/dist/test/DialogTestUtility.js +62 -0
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +2 -0
- package/dist/types/pineapple_fiber/DialogDetail.d.ts +1 -0
- package/dist/types/pineapple_fiber/DialogDetail.d.ts.map +1 -1
- package/dist/types/pineapple_fiber/DialogVariableStore.d.ts.map +1 -1
- package/dist/types/pineapple_fiber/DialogVariableStore.js +41 -13
- package/dist/ui/elements/TextLink.svelte +1 -1
- package/dist/ui/elements/index.d.ts +1 -0
- package/dist/ui/elements/index.d.ts.map +1 -1
- package/dist/ui/elements/index.js +1 -0
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte +41 -10
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte.d.ts +3 -1
- package/dist/ui/modules/NavigationMenu/NavigationControl.svelte.d.ts.map +1 -1
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte +131 -39
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts +3 -1
- package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte.d.ts.map +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte +21 -21
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte.d.ts +1 -1
- package/dist/ui/modules/modals/general-settings/GeneralSettingsModal.svelte.d.ts.map +1 -1
- package/dist/ui/modules/universal-overlay/DialogPanel.svelte +80 -6
- package/dist/ui/modules/universal-overlay/DialogPanel.svelte.d.ts.map +1 -1
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte +132 -75
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte.d.ts +4 -1
- package/dist/ui/modules/universal-overlay/SettingsPanel.svelte.d.ts.map +1 -1
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.svelte +0 -3
- package/dist/ui/templates/SeaweedLayout/SeaweedLayout.svelte.d.ts.map +1 -1
- package/dist/ui/templates/blog_template/BlogTemplate.svelte +7 -1
- package/dist/ui/templates/blog_template/BlogTemplateInner.svelte +33 -1
- package/dist/ui/templates/blog_template/BlogTemplateInner.svelte.d.ts.map +1 -1
- package/dist/ui/templates/index.d.ts +1 -0
- package/dist/ui/templates/index.d.ts.map +1 -1
- package/dist/ui/templates/index.js +2 -0
- package/dist/util/context/PineappleBaseContext.svelte +6 -2
- package/dist/util/context/PineappleBaseContext.svelte.d.ts.map +1 -1
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.d.ts +2 -0
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.d.ts.map +1 -1
- package/dist/util/context/pineappleBaseContextDefinitions.svelte.js +2 -0
- package/dist/util/localStore.svelte.d.ts +2 -0
- package/dist/util/localStore.svelte.d.ts.map +1 -1
- package/dist/util/localStore.svelte.js +2 -0
- package/dist/yarn/Tutorial.yarn +141 -0
- package/package.json +12 -7
- package/src/lib/styles/app.css +30 -2
- package/dist/assets/icons/chat-cursor.svg +0 -47
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
title: TutorialSetup
|
|
2
|
+
position: 50,-152
|
|
3
|
+
---
|
|
4
|
+
Portrait: AresNeutral
|
|
5
|
+
<<declare $tutorialReturnAddress = "" as string>>
|
|
6
|
+
===
|
|
7
|
+
title: TutorialStart
|
|
8
|
+
position: 50,31
|
|
9
|
+
---
|
|
10
|
+
Portrait: AresHappy
|
|
11
|
+
<p><b>Hello!</b> If you're here, I'm assuming you want to learn more how to use <i>conversations</i>.
|
|
12
|
+
This is a <i>dialog box</i>.</p>
|
|
13
|
+
<p>Texts within <i>dialog boxes</i> are <i>scrollable</i> so please <i>scroll</i> if this text overflows.</p>
|
|
14
|
+
<p>Below are <i>choices</i> you can <i>click</i>. Please <b>click</b> them to see what the next dialogs look like.</p>
|
|
15
|
+
|
|
16
|
+
<choice Continue>Click me to proceed to the next dialog</choice>
|
|
17
|
+
<ChoiceBreak>
|
|
18
|
+
|
|
19
|
+
-> Continue
|
|
20
|
+
<<jump TutorialStart2>>
|
|
21
|
+
-> NonConnectedJump
|
|
22
|
+
<<jump TutotialChoiceA>>
|
|
23
|
+
===
|
|
24
|
+
title: TutorialStart2
|
|
25
|
+
position: 51,244
|
|
26
|
+
---
|
|
27
|
+
Portrait: AresNeutral
|
|
28
|
+
<<unvisit TutorialChoiceA>>
|
|
29
|
+
<<unvisit TutorialChoiceB>>
|
|
30
|
+
<p>You can see that <i>choices</i> are indicated with this image <img src="/yarn/icon-chat.svg" alt="dialog-icon"/>.</p>
|
|
31
|
+
<p>Click any of the <choice TutorialMerge>links</choice> that proceed the image <img src="/yarn/icon-chat.svg" alt="dialog-icon"/>.</p>
|
|
32
|
+
|
|
33
|
+
<choice TutorialChoiceA>Let's go to tutorial A</choice> | <choice TutorialChoiceB>Let's go to tutorial B</choice>
|
|
34
|
+
<ChoiceBreak>
|
|
35
|
+
|
|
36
|
+
-> TutorialChoiceA
|
|
37
|
+
<<jump TutorialChoiceA>>
|
|
38
|
+
-> TutorialChoiceB
|
|
39
|
+
<<jump TutorialChoiceB>>
|
|
40
|
+
===
|
|
41
|
+
title: TutorialChoiceA
|
|
42
|
+
position: 316,535
|
|
43
|
+
---
|
|
44
|
+
Portrait: AresHappy
|
|
45
|
+
<p>Click anywhere in the <i>dialog box</i> to instantly make the text appear. Sometimes, you may want to speed up the text.</p>
|
|
46
|
+
<p>This is <i>dialog</i> for choice A!</p>
|
|
47
|
+
<<if visited("TutorialChoiceB")>>
|
|
48
|
+
<choice TutorialMerge>Continue</choice>
|
|
49
|
+
<<else>>
|
|
50
|
+
<choice TutorialChoiceB>Continue</choice>
|
|
51
|
+
<<endif>>
|
|
52
|
+
<ChoiceBreak>
|
|
53
|
+
|
|
54
|
+
-> TutorialChoiceB
|
|
55
|
+
<<jump TutorialChoiceB>>
|
|
56
|
+
-> TutorialMerge
|
|
57
|
+
<<jump TutorialMerge>>
|
|
58
|
+
===
|
|
59
|
+
title: TutorialChoiceB
|
|
60
|
+
position: -191,497
|
|
61
|
+
---
|
|
62
|
+
Portrait: AresYay
|
|
63
|
+
<p>Welcome to Choice B!</p>
|
|
64
|
+
<p>Sometimes, I'll post links in the dialog. You'll see that <i>external links</i> are proceeded with this image <img src="/yarn/icon-open-in-new.svg" alt="external link icon"/>.</p>
|
|
65
|
+
<p>Clicking any of these <i>external links</i> will send you to a new tab with the link. You can <b>hover</b> on the link, and watch on the <i>bottom corner left of your browser</i> to see where the <i>external link</i> will lead you to.</p>
|
|
66
|
+
<p><a target="_blank" class="external-link" href="http://crouton.net">Check out this external link!</a></p>
|
|
67
|
+
<<if visited("TutorialChoiceA")>>
|
|
68
|
+
<choice TutorialMerge>Continue</choice>
|
|
69
|
+
<<else>>
|
|
70
|
+
<choice TutorialChoiceA>Continue</choice>
|
|
71
|
+
<<endif>>
|
|
72
|
+
<ChoiceBreak>
|
|
73
|
+
|
|
74
|
+
-> TutorialChoiceA
|
|
75
|
+
<<jump TutorialChoiceA>>
|
|
76
|
+
-> TutorialMerge
|
|
77
|
+
<<jump TutorialMerge>>
|
|
78
|
+
===
|
|
79
|
+
title: TutorialMerge
|
|
80
|
+
---
|
|
81
|
+
Portrait: AresSurprised
|
|
82
|
+
<p>Just like opportunities and <i>external links</i>, <choice Continue>choices</choice> can appear anywhere!</p>
|
|
83
|
+
<p>It can appear <choice Continue>here</choice>, <choice Continue>there</choice>, and <choice Continue>everywhere!</choice></p>
|
|
84
|
+
<ChoiceBreak>
|
|
85
|
+
|
|
86
|
+
-> Continue
|
|
87
|
+
<<jump TutorialChoicesResult>>
|
|
88
|
+
===
|
|
89
|
+
title: TutorialChoicesResult
|
|
90
|
+
---
|
|
91
|
+
Portrait: AresDisappointed
|
|
92
|
+
<p>Just like life, I've sadly given you an illusion of <i>choice</i> since all those <i>choices</i> only lead to one outcome.
|
|
93
|
+
<i>This particular dialog.</i></p>
|
|
94
|
+
<choice Continue>Anyways...</choice>
|
|
95
|
+
<ChoiceBreak>
|
|
96
|
+
|
|
97
|
+
-> Continue
|
|
98
|
+
<<jump TutorialSettings>>
|
|
99
|
+
===
|
|
100
|
+
title: TutorialSettings
|
|
101
|
+
---
|
|
102
|
+
Portrait: AresMad
|
|
103
|
+
<p>Feel free to check out the <i>Settings</i> menu by clicking the iconic <i>gear icon</i> on this dialog or on the top right of the page. You can...</p>
|
|
104
|
+
<ul>
|
|
105
|
+
<li>Keep this pesky <i>dialog box</i> away all the time!</li>
|
|
106
|
+
<li>Make the <i>portrait</i> of this ugly character disappear!</li>
|
|
107
|
+
<li>Make the <i>text speed</i> faster</li>
|
|
108
|
+
<li>Disable <i>auto scroll</i></li>
|
|
109
|
+
</ul>
|
|
110
|
+
<br>
|
|
111
|
+
<choice Continue>One last thing...</choice>
|
|
112
|
+
<ChoiceBreak>
|
|
113
|
+
|
|
114
|
+
-> Continue
|
|
115
|
+
<<jump TutorialDialogToggle>>
|
|
116
|
+
===
|
|
117
|
+
title: TutorialDialogToggle
|
|
118
|
+
---
|
|
119
|
+
Portrait: AresNeutral
|
|
120
|
+
<p>You can toggle (open or close) the dialog by clicking the <img src="/yarn/icon-chat.svg" alt="dialog-icon"/> icon at the top right,
|
|
121
|
+
or click the close button on this <i>dialog box</i>.</p>
|
|
122
|
+
<p>Try it out! You won't lose progress of our conversation.</p>
|
|
123
|
+
<choice Continue>And...</choice>
|
|
124
|
+
<ChoiceBreak>
|
|
125
|
+
|
|
126
|
+
-> Continue
|
|
127
|
+
<<jump TutorialEnd>>
|
|
128
|
+
===
|
|
129
|
+
title: TutorialEnd
|
|
130
|
+
---
|
|
131
|
+
Portrait: AresLetsGo
|
|
132
|
+
<p>And that covers everything you need to know. <b>^^</b></p>
|
|
133
|
+
<<if $tutorialReturnAddress != "">>
|
|
134
|
+
<choice Return>Return</choice> |
|
|
135
|
+
<<endif>>
|
|
136
|
+
<choice Redo>Redo tutorial</choice>
|
|
137
|
+
<ChoiceBreak>
|
|
138
|
+
|
|
139
|
+
-> Return
|
|
140
|
+
<<jump {$tutorialReturnAddress}>>
|
|
141
|
+
-> Redo
|
|
142
|
+
<<jump TutorialStart>>
|
|
143
|
+
===
|
package/dist/styles/app.css
CHANGED
|
@@ -26,11 +26,39 @@ html {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
a.dialog-choice {
|
|
29
|
-
cursor: url("$pkg/assets/icons/chat
|
|
29
|
+
cursor: url("$pkg/assets/icons/cursor-chat.svg"), auto;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
&:before {
|
|
33
|
+
content: '';
|
|
34
|
+
display: inline-block;
|
|
35
|
+
width: 1.1em;
|
|
36
|
+
height: 1.1em;
|
|
37
|
+
mask: url("$pkg/assets/icons/icon-chat.svg") no-repeat center;
|
|
38
|
+
mask-size: contain;
|
|
39
|
+
background-color: currentColor;
|
|
40
|
+
vertical-align: middle;
|
|
41
|
+
position: relative;
|
|
42
|
+
top: -0.05lh;
|
|
43
|
+
margin-right: 0.2em;
|
|
44
|
+
}
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
a.external-link {
|
|
33
|
-
cursor: url("$pkg/assets/icons/
|
|
48
|
+
cursor: url("$pkg/assets/icons/cursor-open-in-new.svg"), auto;
|
|
49
|
+
|
|
50
|
+
&:after {
|
|
51
|
+
content: '';
|
|
52
|
+
display: inline-block;
|
|
53
|
+
width: 0.8em;
|
|
54
|
+
height: 0.8em;
|
|
55
|
+
mask: url("$pkg/assets/icons/icon-open-in-new.svg") no-repeat center;
|
|
56
|
+
mask-size: contain;
|
|
57
|
+
background-color: currentColor;
|
|
58
|
+
vertical-align: middle;
|
|
59
|
+
position: relative;
|
|
60
|
+
top: -0.1lh;
|
|
61
|
+
}
|
|
34
62
|
}
|
|
35
63
|
|
|
36
64
|
#toast-progress {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DialogManager } from "../components/dialog_manager/DialogManager";
|
|
2
|
+
export declare const DialogTestUtility: {
|
|
3
|
+
readonly describeBasicChecks: (yarnDialog: string, externalNodes?: string[]) => Promise<void>;
|
|
4
|
+
readonly assertDialogJump: (dialogManager: DialogManager, dialogId: string, expectedFutureDialogId?: string) => void;
|
|
5
|
+
readonly expectInvalidChoice: (dialogManager: DialogManager, invalidChoice: string | string[]) => void;
|
|
6
|
+
readonly expectValidChoice: (dialogManager: DialogManager, validChoice: string | string[]) => void;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=DialogTestUtility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogTestUtility.d.ts","sourceRoot":"","sources":["../../src/lib/test/DialogTestUtility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAG7E,eAAO,MAAM,iBAAiB;+CACW,MAAM,kBAAiB,MAAM,EAAE;+CA+BrC,aAAa,YAAY,MAAM,2BAA0B,MAAM;kDAW5D,aAAa,iBAAiB,MAAM,GAAG,MAAM,EAAE;gDAWjD,aAAa,eAAe,MAAM,GAAG,MAAM,EAAE;CASvE,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { DialogManager } from "../components/dialog_manager/DialogManager";
|
|
11
|
+
import { assert, expect, it } from "vitest";
|
|
12
|
+
export const DialogTestUtility = {
|
|
13
|
+
describeBasicChecks: (yarnDialog_1, ...args_1) => __awaiter(void 0, [yarnDialog_1, ...args_1], void 0, function* (yarnDialog, externalNodes = []) {
|
|
14
|
+
const dialogManager = new DialogManager();
|
|
15
|
+
const parsePromise = dialogManager.parseAndSetDialogTree(yarnDialog);
|
|
16
|
+
it("should pass basic check", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
yield expect(parsePromise).resolves.toEqual(expect.any(Array));
|
|
18
|
+
const dialogTree = yield parsePromise;
|
|
19
|
+
expect(dialogTree.length).toBeGreaterThan(0);
|
|
20
|
+
}));
|
|
21
|
+
const dialogTree = yield parsePromise;
|
|
22
|
+
dialogTree.forEach((dialog) => {
|
|
23
|
+
it(`should have no warnings for ${dialog.dialogId}`, () => {
|
|
24
|
+
var _a;
|
|
25
|
+
expect(dialog.warningList, (_a = dialog.warningList) === null || _a === void 0 ? void 0 : _a.join("\n")).toBeUndefined();
|
|
26
|
+
// regex get all:
|
|
27
|
+
// (?<=This is).*?(?=sentence)
|
|
28
|
+
//<a class="choice-Seal dialog-choice"
|
|
29
|
+
const regexArray = dialog.textContent.matchAll(/(?<=<a class="choice-).*?(?= dialog-choice)/g);
|
|
30
|
+
regexArray.forEach(rg => {
|
|
31
|
+
const targetId = rg[0];
|
|
32
|
+
expect(externalNodes.includes(targetId)
|
|
33
|
+
? true
|
|
34
|
+
: dialogTree.find(d => d.dialogId === targetId), `targetId ${targetId} not found`).not.toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}),
|
|
39
|
+
assertDialogJump: (dialogManager, dialogId, expectedFutureDialogId = "") => {
|
|
40
|
+
const expectedChoiceMarkup = `"choice-${dialogId} dialog-choice"`;
|
|
41
|
+
assert.include(dialogManager.fullCurrentMessage, expectedChoiceMarkup, `Missing dialog ID in current message: ${dialogId}`);
|
|
42
|
+
dialogManager.setDialogChoiceById(dialogId);
|
|
43
|
+
assert.equal(dialogManager.currentMessageMeta.dialogId, expectedFutureDialogId ? expectedFutureDialogId : dialogId, `Expected currentMessageMeta.dialogId to be ${expectedFutureDialogId ? expectedFutureDialogId : dialogId}`);
|
|
44
|
+
},
|
|
45
|
+
expectInvalidChoice: (dialogManager, invalidChoice) => {
|
|
46
|
+
if (typeof invalidChoice !== "string") {
|
|
47
|
+
invalidChoice.forEach(choice => DialogTestUtility.expectInvalidChoice(dialogManager, choice));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const expectedChoiceMarkup = `"choice-${invalidChoice} dialog-choice"`;
|
|
51
|
+
expect(dialogManager.fullCurrentMessage).not.toContain(expectedChoiceMarkup);
|
|
52
|
+
expect(dialogManager.currentMessageMeta.dialogId).not.toBe(invalidChoice);
|
|
53
|
+
},
|
|
54
|
+
expectValidChoice: (dialogManager, validChoice) => {
|
|
55
|
+
if (typeof validChoice !== "string") {
|
|
56
|
+
validChoice.forEach(choice => DialogTestUtility.expectValidChoice(dialogManager, choice));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const expectedChoiceMarkup = `"choice-${validChoice} dialog-choice"`;
|
|
60
|
+
expect(dialogManager.fullCurrentMessage).toContain(expectedChoiceMarkup);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,IAAI,EAAE,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogDetail.d.ts","sourceRoot":"","sources":["../../../src/lib/types/pineapple_fiber/DialogDetail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogDetail.d.ts","sourceRoot":"","sources":["../../../src/lib/types/pineapple_fiber/DialogDetail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAE5E,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogVariableStore.d.ts","sourceRoot":"","sources":["../../../src/lib/types/pineapple_fiber/DialogVariableStore.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DialogVariableStore.d.ts","sourceRoot":"","sources":["../../../src/lib/types/pineapple_fiber/DialogVariableStore.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;AA2BrC,eAAO,MAAM,iBAAiB,QAAO,cAoBpC,CAAC"}
|
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
import { browser } from "$app/environment";
|
|
4
|
+
const createInMemoryStore = () => {
|
|
5
|
+
const state = new Map();
|
|
6
|
+
return {
|
|
7
|
+
get length() {
|
|
8
|
+
return state.size;
|
|
9
|
+
},
|
|
10
|
+
setItem: (key, value) => {
|
|
11
|
+
state.set(key, value);
|
|
12
|
+
},
|
|
13
|
+
getItem: (key) => {
|
|
14
|
+
return state.has(key) ? state.get(key) : null;
|
|
15
|
+
},
|
|
16
|
+
clear: () => {
|
|
17
|
+
state.clear();
|
|
18
|
+
},
|
|
19
|
+
key: (index) => {
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = Array.from(state.keys())[index]) !== null && _a !== void 0 ? _a : null;
|
|
22
|
+
},
|
|
23
|
+
removeItem: (key) => {
|
|
24
|
+
state.delete(key);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
4
28
|
export const createNewMapStore = () => {
|
|
29
|
+
var _a;
|
|
30
|
+
const isVitest = Boolean((_a = import.meta.env) === null || _a === void 0 ? void 0 : _a.VITEST);
|
|
5
31
|
return browser
|
|
6
32
|
? localStorage
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
: isVitest
|
|
34
|
+
? createInMemoryStore()
|
|
35
|
+
: {
|
|
36
|
+
// dumb storage if not in browser
|
|
37
|
+
length: 0,
|
|
38
|
+
setItem: (key, value) => { },
|
|
39
|
+
getItem: (key) => {
|
|
40
|
+
return null;
|
|
41
|
+
},
|
|
42
|
+
clear: () => { },
|
|
43
|
+
key: (index) => {
|
|
44
|
+
return null;
|
|
45
|
+
},
|
|
46
|
+
removeItem: (key) => { }
|
|
47
|
+
};
|
|
20
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/elements/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/elements/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -10,24 +10,57 @@
|
|
|
10
10
|
currentIndex?: number;
|
|
11
11
|
contentLength: number;
|
|
12
12
|
pageSize: number;
|
|
13
|
+
selectedTags?: string[];
|
|
14
|
+
queryReady?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
let {
|
|
16
18
|
currentIndex = $bindable(0),
|
|
17
19
|
contentLength,
|
|
18
|
-
pageSize = $bindable()
|
|
20
|
+
pageSize = $bindable(),
|
|
21
|
+
selectedTags = $bindable([]),
|
|
22
|
+
queryReady = $bindable(false)
|
|
19
23
|
}: Props = $props();
|
|
20
24
|
|
|
25
|
+
const parseTags = (searchParams: URLSearchParams): string[] => {
|
|
26
|
+
const repeated = searchParams.getAll("tags");
|
|
27
|
+
const rawValues = repeated.length > 0 ? repeated : [searchParams.get("tags") ?? ""];
|
|
28
|
+
const seen = new Set<string>();
|
|
29
|
+
return rawValues.flatMap(value => value.split(","))
|
|
30
|
+
.map(tag => tag.trim())
|
|
31
|
+
.filter(tag => {
|
|
32
|
+
if (!tag) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const normalized = tag.toLocaleLowerCase();
|
|
36
|
+
if (seen.has(normalized)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
seen.add(normalized);
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const syncQuery = () => {
|
|
45
|
+
const query = new URLSearchParams(page.url.searchParams.toString());
|
|
46
|
+
query.set("index", currentIndex.toString());
|
|
47
|
+
query.set("pageSize", pageSize.toString());
|
|
48
|
+
query.delete("tags");
|
|
49
|
+
selectedTags.forEach(tag => query.append("tags", tag));
|
|
50
|
+
goto(`?${query.toString()}`, {
|
|
51
|
+
replaceState: true,
|
|
52
|
+
noScroll: true,
|
|
53
|
+
keepFocus: true
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
21
57
|
const movePage = (isNext: boolean) => {
|
|
22
58
|
if (isNext) {
|
|
23
59
|
currentIndex = currentIndex + 1;
|
|
24
60
|
} else {
|
|
25
61
|
currentIndex = currentIndex - 1;
|
|
26
62
|
}
|
|
27
|
-
|
|
28
|
-
const query = new URLSearchParams(page.url.searchParams.toString());
|
|
29
|
-
query.set("index", currentIndex.toString());
|
|
30
|
-
goto(`?${query.toString()}`);
|
|
63
|
+
syncQuery();
|
|
31
64
|
};
|
|
32
65
|
|
|
33
66
|
onMount(() => {
|
|
@@ -39,11 +72,9 @@
|
|
|
39
72
|
if (queryPageSize) {
|
|
40
73
|
pageSize = parseInt(queryPageSize) || 5;
|
|
41
74
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
query.set("pageSize", pageSize.toString());
|
|
46
|
-
goto(`?${query.toString()}`);
|
|
75
|
+
selectedTags = parseTags(page.url.searchParams);
|
|
76
|
+
queryReady = true;
|
|
77
|
+
syncQuery();
|
|
47
78
|
});
|
|
48
79
|
</script>
|
|
49
80
|
|
|
@@ -2,8 +2,10 @@ interface Props {
|
|
|
2
2
|
currentIndex?: number;
|
|
3
3
|
contentLength: number;
|
|
4
4
|
pageSize: number;
|
|
5
|
+
selectedTags?: string[];
|
|
6
|
+
queryReady?: boolean;
|
|
5
7
|
}
|
|
6
|
-
declare const NavigationControl: import("svelte").Component<Props, {}, "currentIndex" | "pageSize">;
|
|
8
|
+
declare const NavigationControl: import("svelte").Component<Props, {}, "currentIndex" | "pageSize" | "selectedTags" | "queryReady">;
|
|
7
9
|
type NavigationControl = ReturnType<typeof NavigationControl>;
|
|
8
10
|
export default NavigationControl;
|
|
9
11
|
//# sourceMappingURL=NavigationControl.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationControl.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/ui/modules/NavigationMenu/NavigationControl.svelte.ts"],"names":[],"mappings":"AASC,UAAU,KAAK;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"NavigationControl.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/ui/modules/NavigationMenu/NavigationControl.svelte.ts"],"names":[],"mappings":"AASC,UAAU,KAAK;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AA0FF,QAAA,MAAM,iBAAiB,oGAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|