@turnipxenon/pineapple 2.4.14 → 2.4.16

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.
Files changed (51) hide show
  1. package/.idea/workspace.xml +64 -49
  2. package/.svelte-kit/__package__/app.postcss +15 -1
  3. package/.svelte-kit/__package__/components/DialogOverlay.svelte +48 -47
  4. package/.svelte-kit/__package__/components/dialog_manager/DialogManager.d.ts +8 -3
  5. package/.svelte-kit/__package__/components/dialog_manager/DialogManager.js +35 -11
  6. package/.svelte-kit/__package__/components/dialog_manager/DialogManagerStore.js +1 -1
  7. package/.svelte-kit/__package__/components/layouts/SeaweedBaseLayout.svelte +2 -2
  8. package/.svelte-kit/__package__/components/pineapple/PineappleBaseLayout.svelte +20 -7
  9. package/.svelte-kit/__package__/components/pineapple/PineappleBaseLayout.svelte.d.ts +3 -1
  10. package/.svelte-kit/__package__/components/pineapple/toast/Toast.svelte +1 -0
  11. package/.svelte-kit/__package__/scripts/pineapple_fiber/PineappleFiberParser.d.ts +2 -0
  12. package/.svelte-kit/__package__/scripts/pineapple_fiber/PineappleFiberParser.js +137 -0
  13. package/.svelte-kit/__package__/scripts/pineapple_fiber/PineappleWeaver.js +3 -134
  14. package/.svelte-kit/__package__/types/pineapple_fiber/DialogState.d.ts +2 -1
  15. package/.svelte-kit/__package__/types/pineapple_fiber/DialogState.js +1 -0
  16. package/.svelte-kit/ambient.d.ts +2 -0
  17. package/.svelte-kit/generated/server/internal.js +1 -1
  18. package/dist/app.postcss +15 -1
  19. package/dist/components/DialogOverlay.svelte +48 -47
  20. package/dist/components/dialog_manager/DialogManager.d.ts +8 -3
  21. package/dist/components/dialog_manager/DialogManager.js +35 -11
  22. package/dist/components/dialog_manager/DialogManagerStore.js +1 -1
  23. package/dist/components/layouts/SeaweedBaseLayout.svelte +2 -2
  24. package/dist/components/pineapple/PineappleBaseLayout.svelte +20 -7
  25. package/dist/components/pineapple/PineappleBaseLayout.svelte.d.ts +3 -1
  26. package/dist/components/pineapple/toast/Toast.svelte +1 -0
  27. package/dist/scripts/pineapple_fiber/PineappleFiberParser.d.ts +2 -0
  28. package/dist/scripts/pineapple_fiber/PineappleFiberParser.js +137 -0
  29. package/dist/scripts/pineapple_fiber/PineappleWeaver.js +3 -134
  30. package/dist/types/pineapple_fiber/DialogState.d.ts +2 -1
  31. package/dist/types/pineapple_fiber/DialogState.js +1 -0
  32. package/package.json +1 -1
  33. package/src/lib/app.postcss +15 -1
  34. package/src/lib/components/DialogOverlay.svelte +56 -54
  35. package/src/lib/components/dialog_manager/DialogManager.ts +38 -12
  36. package/src/lib/components/dialog_manager/DialogManagerStore.ts +1 -1
  37. package/src/lib/components/layouts/SeaweedBaseLayout.svelte +2 -2
  38. package/src/lib/components/pineapple/PineappleBaseLayout.svelte +21 -6
  39. package/src/lib/components/pineapple/toast/Toast.svelte +1 -0
  40. package/src/lib/scripts/pineapple_fiber/PineappleFiberParser.ts +177 -0
  41. package/src/lib/scripts/pineapple_fiber/PineappleWeaver.ts +3 -176
  42. package/src/lib/types/pineapple_fiber/DialogState.ts +2 -1
  43. package/src/routes/(pineapple)/+page.svelte +2 -2
  44. package/src/routes/(pineapple)/pineapple/+page.svelte +19 -1
  45. package/src/routes/(pineapple)/pineapple/TestDialog.yarn +7 -0
  46. package/vite.config.ts +2 -1
  47. package/.svelte-kit/__package__/components/pineapple/overlay_manager/OverlayManager.d.ts +0 -0
  48. package/.svelte-kit/__package__/components/pineapple/overlay_manager/OverlayManager.js +0 -1
  49. package/dist/components/pineapple/overlay_manager/OverlayManager.d.ts +0 -0
  50. package/dist/components/pineapple/overlay_manager/OverlayManager.js +0 -1
  51. package/src/lib/components/pineapple/overlay_manager/OverlayManager.ts +0 -0
@@ -4,11 +4,8 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="accb6ba2-c343-4f84-ad30-6e2d71eceee5" name="Changes" comment="Add default PR template">
8
- <change afterPath="$PROJECT_DIR$/docs/OverlaySpec.md" afterDir="false" />
9
- <change afterPath="$PROJECT_DIR$/src/lib/components/pineapple/overlay_manager/OverlayManager.ts" afterDir="false" />
10
- <change beforePath="$PROJECT_DIR$/src/lib/components/Chip.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/components/Chip.svelte" afterDir="false" />
11
- <change beforePath="$PROJECT_DIR$/src/lib/components/pineapple/toast/Toast.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/components/pineapple/toast/Toast.svelte" afterDir="false" />
7
+ <list default="true" id="accb6ba2-c343-4f84-ad30-6e2d71eceee5" name="Changes" comment="Fix dialog layout to make it usable on hobby site">
8
+ <change beforePath="$PROJECT_DIR$/src/lib/components/pineapple/PineappleBaseLayout.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/src/lib/components/pineapple/PineappleBaseLayout.svelte" afterDir="false" />
12
9
  </list>
13
10
  <option name="SHOW_DIALOG" value="false" />
14
11
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -54,7 +51,12 @@
54
51
  </component>
55
52
  <component name="JsbtTreeLayoutManager">
56
53
  <layout place="tools.popupnpm">
57
- <scroll-view-position x="0" y="0" />
54
+ <scroll-view-position x="14" y="0" />
55
+ <selected-paths>
56
+ <path>
57
+ <id value="$PROJECT_DIR$/../speenus/package.json" />
58
+ </path>
59
+ </selected-paths>
58
60
  </layout>
59
61
  </component>
60
62
  <component name="MarkdownSettingsMigration">
@@ -82,7 +84,7 @@
82
84
  "WebServerToolWindowFactoryState": "false",
83
85
  "git-widget-placeholder": "turnip/fix",
84
86
  "ignore.virus.scanning.warn.message": "true",
85
- "last_opened_file_path": "C:/Users/Pumpkin/Projects/Web/pineapple/src/lib/components/pineapple/toast/custom-toast",
87
+ "last_opened_file_path": "C:/Users/Pumpkin/Projects/Web/pineapple/src/lib/scripts/pineapple_fiber",
86
88
  "node.js.detected.package.eslint": "true",
87
89
  "node.js.detected.package.tslint": "true",
88
90
  "node.js.selected.package.eslint": "(autodetect)",
@@ -102,11 +104,11 @@
102
104
  }]]></component>
103
105
  <component name="RecentsManager">
104
106
  <key name="CopyFile.RECENT_KEYS">
107
+ <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\scripts\pineapple_fiber" />
108
+ <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)\pineapple" />
105
109
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast\custom-toast" />
106
110
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast" />
107
111
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(pineapple)" />
108
- <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\(seaweed)" />
109
- <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\routes\portfolio" />
110
112
  </key>
111
113
  <key name="MoveFile.RECENT_KEYS">
112
114
  <recent name="C:\Users\Pumpkin\Projects\Web\pineapple\src\lib\components\pineapple\toast\custom-toast" />
@@ -201,39 +203,9 @@
201
203
  <workItem from="1710565588306" duration="339000" />
202
204
  <workItem from="1710566188907" duration="950000" />
203
205
  <workItem from="1710623596666" duration="2298000" />
204
- <workItem from="1710645881933" duration="7972000" />
205
- </task>
206
- <task id="LOCAL-00023" summary="Implement throwoway prototype for game showcase carousel">
207
- <option name="closed" value="true" />
208
- <created>1709835566776</created>
209
- <option name="number" value="00023" />
210
- <option name="presentableId" value="LOCAL-00023" />
211
- <option name="project" value="LOCAL" />
212
- <updated>1709835566776</updated>
213
- </task>
214
- <task id="LOCAL-00024" summary="Implement sticky element">
215
- <option name="closed" value="true" />
216
- <created>1709837150508</created>
217
- <option name="number" value="00024" />
218
- <option name="presentableId" value="LOCAL-00024" />
219
- <option name="project" value="LOCAL" />
220
- <updated>1709837150508</updated>
221
- </task>
222
- <task id="LOCAL-00025" summary="Fix upgraded vite package imports">
223
- <option name="closed" value="true" />
224
- <created>1709837649846</created>
225
- <option name="number" value="00025" />
226
- <option name="presentableId" value="LOCAL-00025" />
227
- <option name="project" value="LOCAL" />
228
- <updated>1709837649846</updated>
229
- </task>
230
- <task id="LOCAL-00026" summary="Implement base layout for portfolio">
231
- <option name="closed" value="true" />
232
- <created>1709854774552</created>
233
- <option name="number" value="00026" />
234
- <option name="presentableId" value="LOCAL-00026" />
235
- <option name="project" value="LOCAL" />
236
- <updated>1709854774553</updated>
206
+ <workItem from="1710645881933" duration="8776000" />
207
+ <workItem from="1710721345686" duration="2025000" />
208
+ <workItem from="1710724001847" duration="11948000" />
237
209
  </task>
238
210
  <task id="LOCAL-00027" summary="Implement experience section">
239
211
  <option name="closed" value="true" />
@@ -595,7 +567,39 @@
595
567
  <option name="project" value="LOCAL" />
596
568
  <updated>1710651695177</updated>
597
569
  </task>
598
- <option name="localTasksCounter" value="72" />
570
+ <task id="LOCAL-00072" summary="Fix chip in light mode">
571
+ <option name="closed" value="true" />
572
+ <created>1710654837283</created>
573
+ <option name="number" value="00072" />
574
+ <option name="presentableId" value="LOCAL-00072" />
575
+ <option name="project" value="LOCAL" />
576
+ <updated>1710654837283</updated>
577
+ </task>
578
+ <task id="LOCAL-00073" summary="2.4.14">
579
+ <option name="closed" value="true" />
580
+ <created>1710655474323</created>
581
+ <option name="number" value="00073" />
582
+ <option name="presentableId" value="LOCAL-00073" />
583
+ <option name="project" value="LOCAL" />
584
+ <updated>1710655474323</updated>
585
+ </task>
586
+ <task id="LOCAL-00074" summary="Run dialog parser in runtime">
587
+ <option name="closed" value="true" />
588
+ <created>1710731570794</created>
589
+ <option name="number" value="00074" />
590
+ <option name="presentableId" value="LOCAL-00074" />
591
+ <option name="project" value="LOCAL" />
592
+ <updated>1710731570794</updated>
593
+ </task>
594
+ <task id="LOCAL-00075" summary="Fix dialog layout to make it usable on hobby site">
595
+ <option name="closed" value="true" />
596
+ <created>1710739937750</created>
597
+ <option name="number" value="00075" />
598
+ <option name="presentableId" value="LOCAL-00075" />
599
+ <option name="project" value="LOCAL" />
600
+ <updated>1710739937750</updated>
601
+ </task>
602
+ <option name="localTasksCounter" value="76" />
599
603
  <servers />
600
604
  </component>
601
605
  <component name="TypeScriptGeneratedFilesManager">
@@ -633,7 +637,7 @@
633
637
  <entry key="branch">
634
638
  <value>
635
639
  <list>
636
- <option value="main" />
640
+ <option value="turnip/fix" />
637
641
  </list>
638
642
  </value>
639
643
  </entry>
@@ -653,10 +657,6 @@
653
657
  </option>
654
658
  </component>
655
659
  <component name="VcsManagerConfiguration">
656
- <MESSAGE value="Fix path for Seaweed" />
657
- <MESSAGE value="Move from dist to lib for package path" />
658
- <MESSAGE value="Add missing npm run package to allow dist generation" />
659
- <MESSAGE value="Remove postcss reference in non root layout" />
660
660
  <MESSAGE value="Add unique class for Card" />
661
661
  <MESSAGE value="Remove unnecessary files" />
662
662
  <MESSAGE value="Fix accordion rounded border missing" />
@@ -678,6 +678,21 @@
678
678
  <MESSAGE value="Adjust default toast body styling and add shadow to toast" />
679
679
  <MESSAGE value="Clean up todos" />
680
680
  <MESSAGE value="Add default PR template" />
681
- <option name="LAST_COMMIT_MESSAGE" value="Add default PR template" />
681
+ <MESSAGE value="Fix chip in light mode" />
682
+ <MESSAGE value="2.4.14" />
683
+ <MESSAGE value="Run dialog parser in runtime" />
684
+ <MESSAGE value="Fix dialog layout to make it usable on hobby site" />
685
+ <option name="LAST_COMMIT_MESSAGE" value="Fix dialog layout to make it usable on hobby site" />
686
+ </component>
687
+ <component name="XDebuggerManager">
688
+ <breakpoint-manager>
689
+ <breakpoints>
690
+ <line-breakpoint enabled="true" type="javascript">
691
+ <url>file://$PROJECT_DIR$/src/routes/(pineapple)/pineapple/+page.svelte</url>
692
+ <line>31</line>
693
+ <option name="timeStamp" value="1" />
694
+ </line-breakpoint>
695
+ </breakpoints>
696
+ </breakpoint-manager>
682
697
  </component>
683
698
  </project>
@@ -92,7 +92,7 @@ ul {
92
92
  .default-page-container {
93
93
  @apply flex justify-center items-center;
94
94
  margin-top: 4em;
95
- margin-left: clamp(1em, 15vw, 10em);
95
+ margin-left: 1em;
96
96
  margin-right: 1em;
97
97
  flex-direction: column;
98
98
  z-index: 0;
@@ -191,3 +191,17 @@ a:active {
191
191
  background: rgba(var(--color-secondary-500));
192
192
  }
193
193
 
194
+ .dialog-box {
195
+ background-color: rgb(var(--color-surface-500) / 0.9);
196
+ position: fixed;
197
+ bottom: 0;
198
+ width: var(--dialog-box-width); /*75em + 4em padding*/
199
+ height: var(--dialog-box-height);
200
+ max-width: calc(100vw - ((var(--fab-margin) * 2) + 4em));
201
+ }
202
+
203
+ .dark .dialog-box {
204
+ background-color: rgb(var(--color-surface-900) / 0.95);
205
+ --tw-ring-color: rgb(var(--color-text-400));
206
+ /*background-color: red;*/
207
+ }
@@ -1,6 +1,7 @@
1
1
  <script>import AresHappy from "../assets/characters/ares/ares_happy.webp";
2
2
  import { onMount } from "svelte";
3
3
  import { dialogManager } from "./dialog_manager/DialogManagerStore";
4
+ import { DialogState } from "../types/pineapple_fiber/DialogState";
4
5
  let currentMessage = "";
5
6
  dialogManager.currentMessage.subscribe((value) => {
6
7
  currentMessage = value;
@@ -15,15 +16,25 @@ onMount(() => {
15
16
  dialogManager.update(0);
16
17
  });
17
18
  let hidePercent = 100;
19
+ let isHidden = true;
18
20
  dialogManager.hidePercent.subscribe((value) => {
19
21
  hidePercent = value * 0.4;
22
+ isHidden = false;
23
+ });
24
+ dialogManager.currentReadableState.subscribe((value) => {
25
+ isHidden = value === DialogState.Invisible;
26
+ if (value === DialogState.Invisible) {
27
+ }
20
28
  });
21
29
  const onDialogClick = () => {
22
30
  dialogManager.skipAnimation();
23
31
  };
24
32
  </script>
25
33
 
26
- <div class="dialog-elements" style="--hidePercentWidth: -{hidePercent}vw; --hidePercentHeight: {hidePercent}vh">
34
+ <div class="dialog-elements"
35
+ hidden={isHidden}
36
+ style="--hidePercentWidth: -{hidePercent}vw;
37
+ --hidePercentHeight: {hidePercent}vh;">
27
38
  <img src={currentPortrait} alt="Ares" class="dialog-portrait" />
28
39
  <div class="card dialog-box variant-ghost-primary" on:click={onDialogClick}>
29
40
  <div class="card dialog-name">
@@ -37,59 +48,49 @@ const onDialogClick = () => {
37
48
  </div>
38
49
 
39
50
  <style>
40
- .dialog-elements {
41
- position: absolute;
42
- z-index: 10;
43
- }
44
-
45
- .dialog-elements > img {
46
- transform: translateX(var(--hidePercentWidth));
47
- }
48
-
49
- .dialog-elements > div {
50
- transform: translateY(var(--hidePercentHeight));
51
- }
51
+ .dialog-elements {
52
+ position: fixed;
53
+ z-index: 10;
54
+ }
52
55
 
53
- .dialog-box {
54
- background-color: rgb(var(--color-surface-500) / 0.9);
55
- position: fixed;
56
- bottom: 0;
57
- left: var(--dialog-left-pad);
56
+ .dialog-elements > img {
57
+ transform: translateX(var(--hidePercentWidth));
58
+ }
58
59
 
59
- width: var(--dialog-box-width); /*75em + 4em padding*/
60
- height: var(--dialog-box-height);
61
- }
60
+ .dialog-elements > div {
61
+ transform: translateY(var(--hidePercentHeight));
62
+ }
62
63
 
63
- .dialog-box *,
64
- .dialog-name * {
65
- font-size: clamp(1em, 5vw, 1.3em);
66
- line-height: 1.5em;
67
- }
64
+ .dialog-box *,
65
+ .dialog-name * {
66
+ font-size: clamp(1em, 5vw, 1.3em);
67
+ line-height: 1.5em;
68
+ }
68
69
 
69
- .dialog-padding :global(p) {
70
- font-size: clamp(1em, 5vw, 1.3em) !important;
71
- line-height: 1.5em !important;
72
- }
70
+ .dialog-padding :global(p) {
71
+ font-size: clamp(1em, 5vw, 1.3em) !important;
72
+ line-height: 1.5em !important;
73
+ }
73
74
 
74
- .dialog-padding {
75
- padding: clamp(1.5em, 5vw, 1.75em) clamp(0em, 5vw - 0.5em, 2em) 0;
76
- }
75
+ .dialog-padding {
76
+ padding: clamp(1.5em, 5vw, 1.75em) clamp(0em, 5vw - 0.5em, 2em) 0;
77
+ }
77
78
 
78
- .dialog-name {
79
- padding-left: 1rem;
80
- padding-right: 1rem;
81
- padding-top: 0.5rem;
82
- position: fixed;
79
+ .dialog-name {
80
+ padding-left: 1rem;
81
+ padding-right: 1rem;
82
+ padding-top: 0.5rem;
83
+ position: fixed;
83
84
 
84
- /* for centering vertically */
85
- transform: translateX(clamp(0em, 5vw - 0.5em, 1em)) translateY(-50%);
85
+ /* for centering vertically */
86
+ transform: translateX(clamp(0em, 5vw - 0.5em, 1em)) translateY(-50%);
86
87
  }
87
88
 
88
- .dialog-portrait {
89
- position: fixed;
90
- bottom: 0;
91
- left: clamp(-4rem, calc(5vw - 5em), 0rem);
92
- height: clamp(30rem, 75vw, 40rem);
93
- width: auto;
94
- }
89
+ .dialog-portrait {
90
+ position: fixed;
91
+ bottom: 0;
92
+ left: clamp(-4rem, calc(5vw - 5em), 0rem);
93
+ height: clamp(30rem, 75vw, 40rem);
94
+ width: auto;
95
+ }
95
96
  </style>
@@ -8,7 +8,7 @@ import { DialogProcessor } from "./DialogProcessor";
8
8
  export type OnSetDialogChoiceCallback = (newMessage: DialogDetail) => void;
9
9
  export declare class DialogManager {
10
10
  dialogMessageMap: Map<string, DialogDetail>;
11
- dialogMessageList: DialogDetail[];
11
+ currentDialogTree: DialogDetail[];
12
12
  fullCurrentMessage: string;
13
13
  currentMessageMeta: DialogDetail;
14
14
  currentMessage: import("svelte/store").Writable<string>;
@@ -18,12 +18,14 @@ export declare class DialogManager {
18
18
  currentPortrait: import("svelte/store").Writable<unknown>;
19
19
  portraitMap: Map<string, any>;
20
20
  currentState: DialogState;
21
+ currentReadableState: import("svelte/store").Writable<DialogState>;
21
22
  hidePercent: import("svelte/motion").Tweened<number>;
22
23
  skipNextActiveTime: number;
23
24
  dialogProcessor: DialogProcessor;
24
25
  _setDialogChoiceQueue: DialogDetail[];
25
26
  _setDialogChoiceMutex: boolean;
26
27
  onSetDialogListeners: OnSetDialogChoiceCallback[];
28
+ enableDialogueOverlayCache: boolean;
27
29
  constructor();
28
30
  /**
29
31
  * when users interact with the dialog, they can skip the transition like in a game
@@ -39,9 +41,9 @@ export declare class DialogManager {
39
41
  * sets the possible dialog that might appear on the Dialog UI
40
42
  * note that it overwrites the previous tree and does not append on it due to the possibility
41
43
  * of node name conflicts
42
- * @param newMessageList
44
+ * @param newDialogTree
43
45
  */
44
- setDialogTree: (newMessageList: DialogDetail[]) => void;
46
+ setDialogTree: (newDialogTree: DialogDetail[]) => void;
45
47
  /**
46
48
  * Remember to call this before SetDialogTree
47
49
  * and unsubscribe during onDestroy
@@ -74,4 +76,7 @@ export declare class DialogManager {
74
76
  * ISSUE #81 https://github.com/TurnipXenon/pineapple/issues/81
75
77
  */
76
78
  update: (timestamp: number) => void;
79
+ enableDialogOverlay(enable: boolean): void;
80
+ toggleDialogOverlay(): void;
81
+ parseAndSetDialogTree(dialogYarn: string): Promise<DialogDetail[]>;
77
82
  }
@@ -4,7 +4,7 @@
4
4
  import { writable } from "svelte/store";
5
5
  import { DialogState } from "../../types/pineapple_fiber/DialogState";
6
6
  import { tweened } from "svelte/motion";
7
- import { cubicOut } from "svelte/easing";
7
+ import { backOut } from "svelte/easing";
8
8
  import { PortraitType } from "../../types/pineapple_fiber/PortraitType";
9
9
  import AresHappy from "../../assets/characters/ares/ares_happy.webp";
10
10
  import AresBlushing from "../../assets/characters/ares/ares_blushing.webp";
@@ -17,10 +17,11 @@ import AresSurprised from "../../assets/characters/ares/ares_surprised.webp";
17
17
  import AresYay from "../../assets/characters/ares/ares_yay.webp";
18
18
  import { defaultDialogMessage, dialogVariableStore, enableDialogueOverlay, updateRate } from "./DialogManagerStore";
19
19
  import { DialogProcessor } from "./DialogProcessor";
20
+ import { parseYarn } from "../../scripts/pineapple_fiber/PineappleFiberParser";
20
21
  const shouldDebugYarn = false;
21
22
  export class DialogManager {
22
23
  dialogMessageMap = new Map();
23
- dialogMessageList = [];
24
+ currentDialogTree = [];
24
25
  fullCurrentMessage = defaultDialogMessage[0].textContent;
25
26
  currentMessageMeta = defaultDialogMessage[0];
26
27
  currentMessage = writable("");
@@ -30,9 +31,10 @@ export class DialogManager {
30
31
  currentPortrait = writable();
31
32
  portraitMap = new Map();
32
33
  currentState = DialogState.Visible;
34
+ currentReadableState = writable(this.currentState);
33
35
  hidePercent = tweened(100, {
34
36
  duration: 400,
35
- easing: cubicOut
37
+ easing: backOut
36
38
  }); // 100 = 100%
37
39
  skipNextActiveTime = 0;
38
40
  dialogProcessor = new DialogProcessor();
@@ -40,16 +42,23 @@ export class DialogManager {
40
42
  _setDialogChoiceQueue = [];
41
43
  _setDialogChoiceMutex = false;
42
44
  onSetDialogListeners = [];
45
+ enableDialogueOverlayCache = false;
43
46
  constructor() {
44
47
  enableDialogueOverlay.subscribe((value) => {
45
48
  // todo: investigate why we cant put setDialogDefault inside the then clause
46
49
  // ISSUE #82 https://github.com/TurnipXenon/pineapple/issues/82
50
+ this.enableDialogueOverlayCache = value;
47
51
  if (value) {
48
- this.hidePercent.set(0);
49
- this.setDialogToDefault();
52
+ this.hidePercent.set(0).then(() => {
53
+ this.currentState = DialogState.Visible;
54
+ this.currentReadableState.set(this.currentState);
55
+ });
50
56
  }
51
57
  else {
52
- this.hidePercent.set(100);
58
+ this.hidePercent.set(100).then(() => {
59
+ this.currentState = DialogState.Invisible;
60
+ this.currentReadableState.set(this.currentState);
61
+ });
53
62
  this.setDialogTree([{ textContent: "" }]);
54
63
  }
55
64
  });
@@ -78,12 +87,12 @@ export class DialogManager {
78
87
  * sets the possible dialog that might appear on the Dialog UI
79
88
  * note that it overwrites the previous tree and does not append on it due to the possibility
80
89
  * of node name conflicts
81
- * @param newMessageList
90
+ * @param newDialogTree
82
91
  */
83
- setDialogTree = (newMessageList) => {
84
- this.dialogMessageList = newMessageList;
92
+ setDialogTree = (newDialogTree) => {
93
+ this.currentDialogTree = newDialogTree;
85
94
  this.dialogMessageMap.clear();
86
- newMessageList.map((value) => {
95
+ newDialogTree.map((value) => {
87
96
  if (value.dialogId) {
88
97
  this.dialogMessageMap.set(value.dialogId, value);
89
98
  }
@@ -100,7 +109,7 @@ export class DialogManager {
100
109
  this.portraitMap.set(PortraitType.AresSurprised.toString(), AresSurprised);
101
110
  this.portraitMap.set(PortraitType.AresYay.toString(), AresYay);
102
111
  }
103
- this.setDialogChoice(newMessageList[0]);
112
+ this.setDialogChoice(newDialogTree[0]);
104
113
  };
105
114
  /**
106
115
  * Remember to call this before SetDialogTree
@@ -236,4 +245,19 @@ export class DialogManager {
236
245
  ++this.currentIndex;
237
246
  window.requestAnimationFrame(this.update);
238
247
  };
248
+ enableDialogOverlay(enable) {
249
+ enableDialogueOverlay.set(enable);
250
+ }
251
+ toggleDialogOverlay() {
252
+ enableDialogueOverlay.set(!this.enableDialogueOverlayCache);
253
+ }
254
+ ;
255
+ async parseAndSetDialogTree(dialogYarn) {
256
+ return parseYarn(dialogYarn)
257
+ .then((dialogTree) => {
258
+ console.log(dialogTree);
259
+ this.setDialogTree(dialogTree);
260
+ return dialogTree;
261
+ });
262
+ }
239
263
  }
@@ -26,7 +26,7 @@ export const updateRate = 40 / 1000; // *at least* 40ms per letter
26
26
  // todo: if we go through doing yarn to typescript, move this!
27
27
  export const defaultDialogMessage = [
28
28
  {
29
- textContent: `<p>Have you drank water? Or perhaps, you've checked out <a target="_blank" class="external-link" href="http://crouton.net">one of the best webpages</a> out there?`
29
+ textContent: `<p>I don't really have anything to say. Have you drank water? Or perhaps, you've checked out <a target="_blank" class="external-link" href="http://crouton.net">one of the best webpages</a> out there?`
30
30
  }
31
31
  ];
32
32
  /**
@@ -56,8 +56,8 @@ let shouldDisplaySocialIcons = writable(false);
56
56
 
57
57
  <style>
58
58
  :root {
59
- --dialog-left-pad: clamp(0em, 5vw, 2em);
60
- --dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-left-pad) - var(--theme-border-base)));
59
+ --dialog-start-pad: clamp(0em, 5vw, 2em);
60
+ --dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-start-pad) - var(--theme-border-base)));
61
61
  --dialog-box-height: clamp(15em, 50vw, 18em);
62
62
  }
63
63
 
@@ -1,11 +1,14 @@
1
- <script>import { AppBar, AppShell, autoModeWatcher, LightSwitch } from "@skeletonlabs/skeleton";
1
+ <script>export let showDialogByDefault = false;
2
+ import { AppBar, AppShell, autoModeWatcher, LightSwitch } from "@skeletonlabs/skeleton";
2
3
  import RandomizedBackground from "../RandomizedBackground.svelte";
3
4
  import { page } from "$app/stores";
4
5
  import { enableBackground } from "../../store";
5
6
  import AresLogo from "../../assets/characters/ares/ares_logo.webp";
6
7
  import FABIcon from "../../assets/placeholder/placeholder_circle.png";
7
- import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
8
+ import CloseIcon from "../../assets/icons/close.svg";
9
+ import { dialogManager, enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
8
10
  import Toast from "./toast/Toast.svelte";
11
+ import DialogOverlay from "../DialogOverlay.svelte";
9
12
  let pages = [];
10
13
  const updateBreadcrumb = (pathname) => {
11
14
  pages = [];
@@ -40,6 +43,7 @@ let enableDialogueOverlayValue = true;
40
43
  enableDialogueOverlay.subscribe((value) => {
41
44
  enableDialogueOverlayValue = value;
42
45
  });
46
+ enableDialogueOverlay.set(showDialogByDefault);
43
47
  </script>
44
48
 
45
49
  <!-- App Shell -->
@@ -49,9 +53,13 @@ enableDialogueOverlay.subscribe((value) => {
49
53
 
50
54
  <!--todo: turn off hidden when it's time-->
51
55
  <button type="button" class="fab" on:click={()=>{
52
- enableDialogueOverlay.set(!enableDialogueOverlayValue);
56
+ dialogManager.toggleDialogOverlay()
53
57
  }}>
54
- <img src={FABIcon} alt="interactive floating action button represented as a turnip">
58
+ {#if (enableDialogueOverlayValue)}
59
+ <img class="img-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
60
+ {:else }
61
+ <img src={FABIcon} alt="interactive floating action button represented as a turnip">
62
+ {/if}
55
63
  </button>
56
64
 
57
65
  <AppShell>
@@ -92,6 +100,8 @@ enableDialogueOverlay.subscribe((value) => {
92
100
 
93
101
  <Toast></Toast>
94
102
 
103
+ <DialogOverlay></DialogOverlay>
104
+
95
105
  <div class="default-page-container">
96
106
  <slot />
97
107
  <div class="footer-space" />
@@ -111,8 +121,8 @@ enableDialogueOverlay.subscribe((value) => {
111
121
 
112
122
  <style>
113
123
  :root {
114
- --dialog-left-pad: clamp(0em, 5vw, 2em);
115
- --dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-left-pad) - var(--theme-border-base)));
124
+ --dialog-start-pad: clamp(0em, 5vw, 2em);
125
+ --dialog-box-width: min(calc(50em + 4em), calc(100vw - var(--dialog-start-pad) - var(--theme-border-base)));
116
126
  --dialog-box-height: clamp(15em, 50vw, 18em);
117
127
 
118
128
  /** FAB icon margin/position calculation origin:
@@ -134,7 +144,6 @@ enableDialogueOverlay.subscribe((value) => {
134
144
  align-items: center;
135
145
  justify-content: center;
136
146
  margin-top: 4em;
137
- margin-left: clamp(1em, 15vw, 10em);
138
147
  margin-right: 1em;
139
148
  flex-direction: column;
140
149
  z-index: 0;
@@ -222,6 +231,10 @@ enableDialogueOverlay.subscribe((value) => {
222
231
  border-radius: 50%;
223
232
  }
224
233
 
234
+ .fab > img {
235
+ width: 100%;
236
+ }
237
+
225
238
  .fab:dir(ltr) {
226
239
  right: var(--fab-margin);
227
240
  }
@@ -1,6 +1,8 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
- props: Record<string, never>;
3
+ props: {
4
+ showDialogByDefault?: boolean | undefined;
5
+ };
4
6
  events: {
5
7
  [evt: string]: CustomEvent<any>;
6
8
  };
@@ -77,6 +77,7 @@ const dismissToast = () => {
77
77
  position: fixed;
78
78
  /* 12em = this component's margin (4em) + fab margin + width (8em) */
79
79
  max-width: calc(100vw - 12em);
80
+ z-index: 100;
80
81
  }
81
82
 
82
83
  .toast-positioner:dir(ltr) {
@@ -0,0 +1,2 @@
1
+ import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
2
+ export declare const parseYarn: (fileContent: string) => Promise<DialogDetail[]>;