@turnipxenon/pineapple 1.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/package.json +20 -13
  2. package/src/lib/app.postcss +106 -47
  3. package/src/lib/assets/icons/bitbucket-icon.svg +1 -0
  4. package/src/lib/assets/icons/github-mark.svg +1 -0
  5. package/src/lib/assets/icons/link-icon.svg +1 -0
  6. package/src/lib/assets/icons/linkedin.svg +1 -0
  7. package/src/lib/assets/icons/mail.svg +1 -0
  8. package/src/lib/assets/others/seaweed-showcase.mp4 +0 -0
  9. package/src/lib/assets/others/weaver-footage.gif +0 -0
  10. package/src/lib/assets/others/window-set.png +0 -0
  11. package/src/lib/assets/placeholder/placeholder_circle.png +0 -0
  12. package/src/lib/components/Card.svelte +24 -0
  13. package/src/lib/components/CarouselElement.svelte +23 -0
  14. package/src/lib/components/Chip.svelte +12 -0
  15. package/src/lib/components/ElementVisbilityDetector.svelte +22 -0
  16. package/src/lib/components/OnElementVisbilityChanged.ts +1 -0
  17. package/src/lib/components/RandomizedBackground.svelte +6 -4
  18. package/src/lib/components/RandomizedImage.svelte +23 -14
  19. package/src/lib/components/StickyElement.svelte +40 -0
  20. package/src/lib/components/ToggleableContent.svelte +86 -0
  21. package/src/lib/components/ToggleableContentType.ts +4 -0
  22. package/src/lib/components/layouts/LayoutConstants.ts +1 -0
  23. package/src/lib/components/{PineappleBaseLayout.svelte → layouts/PineappleBaseLayout.svelte} +73 -71
  24. package/src/lib/components/layouts/SeaweedBaseLayout.svelte +109 -0
  25. package/src/lib/consts.ts +2 -0
  26. package/src/lib/index.ts +2 -1
  27. package/src/lib/styles/global.css +1 -0
  28. package/src/lib/template/SeaweedTemplate.svelte +873 -0
  29. package/src/lib/theme.postcss +114 -105
  30. package/src/lib/util/create_go_to_function.ts +5 -0
  31. package/src/routes/+layout.svelte +15 -19
  32. package/src/routes/+page.svelte +9 -12
  33. package/src/routes/personal/+layout.svelte +23 -0
  34. package/src/routes/personal/+page.svelte +37 -0
  35. package/src/routes/portfolio/+page.server.ts +44 -0
  36. package/src/routes/portfolio/+page.svelte +19 -0
  37. package/src/routes/portfolio/SocialSection.svelte +93 -0
  38. package/src/routes/portfolio/actual/+page.svelte +10 -0
  39. package/dist/app.postcss +0 -94
  40. package/dist/assets/bg_tiled/bg_tiled_ares.png +0 -0
  41. package/dist/assets/bg_tiled/bg_tiled_corn.png +0 -0
  42. package/dist/assets/bg_tiled/bg_tiled_pineapple.png +0 -0
  43. package/dist/assets/bg_tiled/bg_tiled_reinhard.png +0 -0
  44. package/dist/assets/bg_tiled/bg_tiled_tomato.png +0 -0
  45. package/dist/assets/bg_tiled/bg_tiled_turnip.png +0 -0
  46. package/dist/assets/characters/ares/ares_blushing.webp +0 -0
  47. package/dist/assets/characters/ares/ares_disappointed.webp +0 -0
  48. package/dist/assets/characters/ares/ares_happy.webp +0 -0
  49. package/dist/assets/characters/ares/ares_lets_go.webp +0 -0
  50. package/dist/assets/characters/ares/ares_logo.webp +0 -0
  51. package/dist/assets/characters/ares/ares_mad.webp +0 -0
  52. package/dist/assets/characters/ares/ares_neutral.webp +0 -0
  53. package/dist/assets/characters/ares/ares_slightly_mad.webp +0 -0
  54. package/dist/assets/characters/ares/ares_surprised.webp +0 -0
  55. package/dist/assets/characters/ares/ares_yay.webp +0 -0
  56. package/dist/assets/game_dev/footage-chef-wings.gif +0 -0
  57. package/dist/assets/game_dev/footage-depreciation.webm +0 -0
  58. package/dist/assets/game_dev/footage-thinking-of-flowers.webm +0 -0
  59. package/dist/assets/game_dev/screenshot-game-jam-mama.png +0 -0
  60. package/dist/assets/game_dev/screenshot-string-hop.png +0 -0
  61. package/dist/assets/game_dev/screenshot-wet-ass-road.png +0 -0
  62. package/dist/assets/temp/background-image.jpg +0 -0
  63. package/dist/assets/temp/bitbucket-logo.png +0 -0
  64. package/dist/assets/temp/github-logo.png +0 -0
  65. package/dist/assets/temp/header-hep-cat.mp4 +0 -0
  66. package/dist/assets/temp/header-hep-cat.ogg +0 -0
  67. package/dist/assets/temp/header-hep-cat.webm +0 -0
  68. package/dist/assets/temp/header-pengi.mp4 +0 -0
  69. package/dist/assets/temp/header-pengi.webm +0 -0
  70. package/dist/assets/temp/header-soulwork.mp4 +0 -0
  71. package/dist/assets/temp/header-soulwork.ogg +0 -0
  72. package/dist/assets/temp/header-soulwork.webm +0 -0
  73. package/dist/components/DialogOverlay.svelte +0 -93
  74. package/dist/components/DialogOverlay.svelte.d.ts +0 -14
  75. package/dist/components/LazyAsset.svelte +0 -96
  76. package/dist/components/LazyAsset.svelte.d.ts +0 -20
  77. package/dist/components/LazyAssetType.d.ts +0 -10
  78. package/dist/components/LazyAssetType.js +0 -12
  79. package/dist/components/PineappleBaseLayout.svelte +0 -186
  80. package/dist/components/PineappleBaseLayout.svelte.d.ts +0 -19
  81. package/dist/components/RandomizedBackground.svelte +0 -62
  82. package/dist/components/RandomizedBackground.svelte.d.ts +0 -16
  83. package/dist/components/RandomizedImage.svelte +0 -29
  84. package/dist/components/RandomizedImage.svelte.d.ts +0 -17
  85. package/dist/components/dialog_manager/DialogManager.d.ts +0 -77
  86. package/dist/components/dialog_manager/DialogManager.js +0 -239
  87. package/dist/components/dialog_manager/DialogManagerStore.d.ts +0 -41
  88. package/dist/components/dialog_manager/DialogManagerStore.js +0 -45
  89. package/dist/components/dialog_manager/DialogProcessor.d.ts +0 -13
  90. package/dist/components/dialog_manager/DialogProcessor.js +0 -62
  91. package/dist/components/dialog_manager/DialogUtils.d.ts +0 -5
  92. package/dist/components/dialog_manager/DialogUtils.js +0 -8
  93. package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.d.ts +0 -15
  94. package/dist/components/dialog_manager/behavior_tree/core/BTreeUtils.js +0 -34
  95. package/dist/components/dialog_manager/behavior_tree/core/BaseBehaviorResult.d.ts +0 -4
  96. package/dist/components/dialog_manager/behavior_tree/core/BaseBehaviorResult.js +0 -1
  97. package/dist/components/dialog_manager/behavior_tree/core/BehaviorNode.d.ts +0 -3
  98. package/dist/components/dialog_manager/behavior_tree/core/BehaviorNode.js +0 -1
  99. package/dist/components/dialog_manager/behavior_tree/core/BehaviorStatus.d.ts +0 -5
  100. package/dist/components/dialog_manager/behavior_tree/core/BehaviorStatus.js +0 -6
  101. package/dist/components/dialog_manager/behavior_tree/core/SelectorNode.d.ts +0 -12
  102. package/dist/components/dialog_manager/behavior_tree/core/SelectorNode.js +0 -22
  103. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.d.ts +0 -5
  104. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionArguments.js +0 -1
  105. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionBehaviorNode.d.ts +0 -4
  106. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionBehaviorNode.js +0 -1
  107. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.d.ts +0 -15
  108. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionEvaluator.js +0 -220
  109. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionResult.d.ts +0 -5
  110. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionResult.js +0 -1
  111. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionSelectorNode.d.ts +0 -8
  112. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionSelectorNode.js +0 -15
  113. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionState.d.ts +0 -3
  114. package/dist/components/dialog_manager/behavior_tree/expression/ExpressionState.js +0 -1
  115. package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.d.ts +0 -10
  116. package/dist/components/dialog_manager/behavior_tree/expression/OperandNode.js +0 -15
  117. package/dist/components/dialog_manager/behavior_tree/expression/OperatorNode.d.ts +0 -11
  118. package/dist/components/dialog_manager/behavior_tree/expression/OperatorNode.js +0 -30
  119. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandExpressionNode.d.ts +0 -6
  120. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandExpressionNode.js +0 -21
  121. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandLogicNode.d.ts +0 -9
  122. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandLogicNode.js +0 -19
  123. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandMap.d.ts +0 -9
  124. package/dist/components/dialog_manager/behavior_tree/expression/commands/CommandMap.js +0 -18
  125. package/dist/components/dialog_manager/behavior_tree/expression/commands/RandomRangeCommand.d.ts +0 -15
  126. package/dist/components/dialog_manager/behavior_tree/expression/commands/RandomRangeCommand.js +0 -24
  127. package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCommand.d.ts +0 -20
  128. package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCommand.js +0 -32
  129. package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.d.ts +0 -13
  130. package/dist/components/dialog_manager/behavior_tree/expression/commands/VisitedCountCommand.js +0 -25
  131. package/dist/components/dialog_manager/behavior_tree/expression/operators/AndOperator.d.ts +0 -7
  132. package/dist/components/dialog_manager/behavior_tree/expression/operators/AndOperator.js +0 -15
  133. package/dist/components/dialog_manager/behavior_tree/expression/operators/EqualityOperator.d.ts +0 -7
  134. package/dist/components/dialog_manager/behavior_tree/expression/operators/EqualityOperator.js +0 -14
  135. package/dist/components/dialog_manager/behavior_tree/expression/operators/GreaterThanEqualOperator.d.ts +0 -7
  136. package/dist/components/dialog_manager/behavior_tree/expression/operators/GreaterThanEqualOperator.js +0 -12
  137. package/dist/components/dialog_manager/behavior_tree/expression/operators/GreaterThanOperator.d.ts +0 -7
  138. package/dist/components/dialog_manager/behavior_tree/expression/operators/GreaterThanOperator.js +0 -12
  139. package/dist/components/dialog_manager/behavior_tree/expression/operators/InequalityOperator.d.ts +0 -7
  140. package/dist/components/dialog_manager/behavior_tree/expression/operators/InequalityOperator.js +0 -12
  141. package/dist/components/dialog_manager/behavior_tree/expression/operators/LessThanEqualOperator.d.ts +0 -7
  142. package/dist/components/dialog_manager/behavior_tree/expression/operators/LessThanEqualOperator.js +0 -12
  143. package/dist/components/dialog_manager/behavior_tree/expression/operators/LessThanOperator.d.ts +0 -7
  144. package/dist/components/dialog_manager/behavior_tree/expression/operators/LessThanOperator.js +0 -12
  145. package/dist/components/dialog_manager/behavior_tree/expression/operators/NegationOperator.d.ts +0 -7
  146. package/dist/components/dialog_manager/behavior_tree/expression/operators/NegationOperator.js +0 -13
  147. package/dist/components/dialog_manager/behavior_tree/expression/operators/OperatorLogicNode.d.ts +0 -17
  148. package/dist/components/dialog_manager/behavior_tree/expression/operators/OperatorLogicNode.js +0 -32
  149. package/dist/components/dialog_manager/behavior_tree/expression/operators/OperatorMap.d.ts +0 -9
  150. package/dist/components/dialog_manager/behavior_tree/expression/operators/OperatorMap.js +0 -47
  151. package/dist/components/dialog_manager/behavior_tree/expression/operators/OrOperator.d.ts +0 -7
  152. package/dist/components/dialog_manager/behavior_tree/expression/operators/OrOperator.js +0 -13
  153. package/dist/components/dialog_manager/behavior_tree/expression/operators/XorOperator.d.ts +0 -7
  154. package/dist/components/dialog_manager/behavior_tree/expression/operators/XorOperator.js +0 -17
  155. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/DivisionOperator.d.ts +0 -7
  156. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/DivisionOperator.js +0 -14
  157. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/MinusOperator.d.ts +0 -7
  158. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/MinusOperator.js +0 -14
  159. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/MultiplicationOperator.d.ts +0 -7
  160. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/MultiplicationOperator.js +0 -12
  161. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/PlusOperator.d.ts +0 -7
  162. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/PlusOperator.js +0 -14
  163. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/RemainderDivisionOperator.d.ts +0 -7
  164. package/dist/components/dialog_manager/behavior_tree/expression/operators/arithmetic/RemainderDivisionOperator.js +0 -14
  165. package/dist/components/dialog_manager/behavior_tree/line_core/LineBehaviorNode.d.ts +0 -4
  166. package/dist/components/dialog_manager/behavior_tree/line_core/LineBehaviorNode.js +0 -1
  167. package/dist/components/dialog_manager/behavior_tree/line_core/LineBehaviorResult.d.ts +0 -6
  168. package/dist/components/dialog_manager/behavior_tree/line_core/LineBehaviorResult.js +0 -1
  169. package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.d.ts +0 -6
  170. package/dist/components/dialog_manager/behavior_tree/line_core/LineNodeArguments.js +0 -1
  171. package/dist/components/dialog_manager/behavior_tree/line_core/LineSelectorNode.d.ts +0 -8
  172. package/dist/components/dialog_manager/behavior_tree/line_core/LineSelectorNode.js +0 -15
  173. package/dist/components/dialog_manager/behavior_tree/line_processors/BehaviorState.d.ts +0 -5
  174. package/dist/components/dialog_manager/behavior_tree/line_processors/BehaviorState.js +0 -5
  175. package/dist/components/dialog_manager/behavior_tree/line_processors/ElseIfNode.d.ts +0 -11
  176. package/dist/components/dialog_manager/behavior_tree/line_processors/ElseIfNode.js +0 -53
  177. package/dist/components/dialog_manager/behavior_tree/line_processors/ElseNode.d.ts +0 -11
  178. package/dist/components/dialog_manager/behavior_tree/line_processors/ElseNode.js +0 -49
  179. package/dist/components/dialog_manager/behavior_tree/line_processors/EndIfNode.d.ts +0 -11
  180. package/dist/components/dialog_manager/behavior_tree/line_processors/EndIfNode.js +0 -23
  181. package/dist/components/dialog_manager/behavior_tree/line_processors/IfMode.d.ts +0 -6
  182. package/dist/components/dialog_manager/behavior_tree/line_processors/IfMode.js +0 -8
  183. package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.d.ts +0 -12
  184. package/dist/components/dialog_manager/behavior_tree/line_processors/IfNode.js +0 -43
  185. package/dist/components/dialog_manager/behavior_tree/line_processors/IgnoreGuardNode.d.ts +0 -11
  186. package/dist/components/dialog_manager/behavior_tree/line_processors/IgnoreGuardNode.js +0 -25
  187. package/dist/components/dialog_manager/behavior_tree/line_processors/IgnoreJumpNode.d.ts +0 -6
  188. package/dist/components/dialog_manager/behavior_tree/line_processors/IgnoreJumpNode.js +0 -18
  189. package/dist/components/dialog_manager/behavior_tree/line_processors/LineCommentNode.d.ts +0 -6
  190. package/dist/components/dialog_manager/behavior_tree/line_processors/LineCommentNode.js +0 -17
  191. package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.d.ts +0 -10
  192. package/dist/components/dialog_manager/behavior_tree/line_processors/NormalLineProcessorNode.js +0 -38
  193. package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.d.ts +0 -11
  194. package/dist/components/dialog_manager/behavior_tree/line_processors/SetVariableNode.js +0 -31
  195. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.d.ts +0 -8
  196. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/DeclareCommand.js +0 -39
  197. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts +0 -8
  198. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +0 -40
  199. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.d.ts +0 -9
  200. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/UnvisitCommand.js +0 -28
  201. package/dist/index.d.ts +0 -8
  202. package/dist/index.js +0 -8
  203. package/dist/scripts/SetDefaultEnvironment.d.ts +0 -1
  204. package/dist/scripts/SetDefaultEnvironment.js +0 -41
  205. package/dist/scripts/pineapple_fiber/PineappleWeaver.d.ts +0 -9
  206. package/dist/scripts/pineapple_fiber/PineappleWeaver.js +0 -201
  207. package/dist/scripts/util/FileManagement.d.ts +0 -7
  208. package/dist/scripts/util/FileManagement.js +0 -35
  209. package/dist/scripts/util/ManualCheck.d.ts +0 -1
  210. package/dist/scripts/util/ManualCheck.js +0 -28
  211. package/dist/scripts/util/ManualCheckRun.d.ts +0 -1
  212. package/dist/scripts/util/ManualCheckRun.js +0 -6
  213. package/dist/store.d.ts +0 -17
  214. package/dist/store.js +0 -17
  215. package/dist/styles/DefaultGridContainer.css +0 -61
  216. package/dist/theme.postcss +0 -107
  217. package/dist/types/BlogBlurbMeta.d.ts +0 -11
  218. package/dist/types/BlogBlurbMeta.js +0 -16
  219. package/dist/types/BreadcrumbData.d.ts +0 -4
  220. package/dist/types/BreadcrumbData.js +0 -1
  221. package/dist/types/pineapple_fiber/DialogDetail.d.ts +0 -6
  222. package/dist/types/pineapple_fiber/DialogDetail.js +0 -1
  223. package/dist/types/pineapple_fiber/DialogState.d.ts +0 -5
  224. package/dist/types/pineapple_fiber/DialogState.js +0 -6
  225. package/dist/types/pineapple_fiber/DialogVariableStore.d.ts +0 -2
  226. package/dist/types/pineapple_fiber/DialogVariableStore.js +0 -20
  227. package/dist/types/pineapple_fiber/PortraitType.d.ts +0 -11
  228. package/dist/types/pineapple_fiber/PortraitType.js +0 -12
  229. package/dist/util/stable_random.d.ts +0 -2
  230. package/dist/util/stable_random.js +0 -15
  231. package/src/lib/assets/icons/chat_cursor.svg +0 -47
  232. package/src/lib/assets/icons/external_link.svg +0 -50
  233. package/static/default-card.png +0 -0
  234. package/static/favicon.png +0 -0
  235. /package/{dist/assets/icons/chat_cursor.svg → src/lib/assets/icons/chat-cursor.svg} +0 -0
  236. /package/{dist/assets/icons/external_link.svg → src/lib/assets/icons/external-link.svg} +0 -0
@@ -1,77 +0,0 @@
1
- /**
2
- * DialogManager is the object we want to interact with in Svelte
3
- */
4
- /// <reference types="svelte" />
5
- import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
6
- import { DialogState } from "../../types/pineapple_fiber/DialogState";
7
- import { DialogProcessor } from "./DialogProcessor";
8
- export type OnSetDialogChoiceCallback = (newMessage: DialogDetail) => void;
9
- export declare class DialogManager {
10
- dialogMessageMap: Map<string, DialogDetail>;
11
- dialogMessageList: DialogDetail[];
12
- fullCurrentMessage: string;
13
- currentMessageMeta: DialogDetail;
14
- currentMessage: import("svelte/store").Writable<string>;
15
- currentIndex: number;
16
- previousTimestamp: number;
17
- isDoneTransition: boolean;
18
- currentPortrait: import("svelte/store").Writable<unknown>;
19
- portraitMap: Map<string, any>;
20
- currentState: DialogState;
21
- hidePercent: import("svelte/motion").Tweened<number>;
22
- skipNextActiveTime: number;
23
- dialogProcessor: DialogProcessor;
24
- _setDialogChoiceQueue: DialogDetail[];
25
- _setDialogChoiceMutex: boolean;
26
- onSetDialogListeners: OnSetDialogChoiceCallback[];
27
- constructor();
28
- /**
29
- * when users interact with the dialog, they can skip the transition like in a game
30
- * note that there is a cool down to this, check out skipNextActiveTime
31
- */
32
- skipAnimation: () => void;
33
- /**
34
- * hides or shows the dialog UI
35
- * @param shouldEnable
36
- */
37
- enableDialog: (shouldEnable: boolean) => void;
38
- /**
39
- * sets the possible dialog that might appear on the Dialog UI
40
- * note that it overwrites the previous tree and does not append on it due to the possibility
41
- * of node name conflicts
42
- * @param newMessageList
43
- */
44
- setDialogTree: (newMessageList: DialogDetail[]) => void;
45
- /**
46
- * Remember to call this before SetDialogTree
47
- * and unsubscribe during onDestroy
48
- * @param callback
49
- */
50
- subscribeToSetDialogChoice: (callback: OnSetDialogChoiceCallback) => void;
51
- /**
52
- * Remember to call this during onDestroy
53
- * @param callback
54
- * todo: double check if this works???
55
- */
56
- unsubscribeToSetDialogChoice: (callback: OnSetDialogChoiceCallback) => void;
57
- /**
58
- * Sets the next dialog to show depending on which special choice a href link the user
59
- * has interacted with
60
- * @param newMessage
61
- *
62
- * you can listen to this!
63
- */
64
- setDialogChoice: (newMessage: DialogDetail | undefined) => void;
65
- _setDialogChoice: () => void;
66
- setDialogToDefault: () => void;
67
- /**
68
- * updates the information and detail frame by frame
69
- * you can think of this like the main game loop
70
- *
71
- * @param timestamp
72
- *
73
- * todo: this might be too big we might want to refactor this method for better readability
74
- * ISSUE #81 https://github.com/TurnipXenon/pineapple/issues/81
75
- */
76
- update: (timestamp: number) => void;
77
- }
@@ -1,239 +0,0 @@
1
- /**
2
- * DialogManager is the object we want to interact with in Svelte
3
- */
4
- import { writable } from "svelte/store";
5
- import { DialogState } from "../../types/pineapple_fiber/DialogState";
6
- import { tweened } from "svelte/motion";
7
- import { cubicOut } from "svelte/easing";
8
- import { PortraitType } from "../../types/pineapple_fiber/PortraitType";
9
- import AresHappy from "../../assets/characters/ares/ares_happy.webp";
10
- import AresBlushing from "../../assets/characters/ares/ares_blushing.webp";
11
- import AresDisappointed from "../../assets/characters/ares/ares_disappointed.webp";
12
- import AresLetsGo from "../../assets/characters/ares/ares_lets_go.webp";
13
- import AresMad from "../../assets/characters/ares/ares_mad.webp";
14
- import AresNeutral from "../../assets/characters/ares/ares_neutral.webp";
15
- import AresSlightlyMad from "../../assets/characters/ares/ares_slightly_mad.webp";
16
- import AresSurprised from "../../assets/characters/ares/ares_surprised.webp";
17
- import AresYay from "../../assets/characters/ares/ares_yay.webp";
18
- import { defaultDialogMessage, dialogVariableStore, enableDialogueOverlay, updateRate } from "./DialogManagerStore";
19
- import { DialogProcessor } from "./DialogProcessor";
20
- const shouldDebugYarn = false;
21
- export class DialogManager {
22
- dialogMessageMap = new Map();
23
- dialogMessageList = [];
24
- fullCurrentMessage = defaultDialogMessage[0].textContent;
25
- currentMessageMeta = defaultDialogMessage[0];
26
- currentMessage = writable("");
27
- currentIndex = 0;
28
- previousTimestamp = 0;
29
- isDoneTransition = false;
30
- currentPortrait = writable();
31
- portraitMap = new Map();
32
- currentState = DialogState.Visible;
33
- hidePercent = tweened(100, {
34
- duration: 400,
35
- easing: cubicOut
36
- }); // 100 = 100%
37
- skipNextActiveTime = 0;
38
- dialogProcessor = new DialogProcessor();
39
- // for queueing actions
40
- _setDialogChoiceQueue = [];
41
- _setDialogChoiceMutex = false;
42
- onSetDialogListeners = [];
43
- constructor() {
44
- enableDialogueOverlay.subscribe((value) => {
45
- // todo: investigate why we cant put setDialogDefault inside the then clause
46
- // ISSUE #82 https://github.com/TurnipXenon/pineapple/issues/82
47
- if (value) {
48
- this.hidePercent.set(0);
49
- this.setDialogToDefault();
50
- }
51
- else {
52
- this.hidePercent.set(100);
53
- this.setDialogTree([{ textContent: "" }]);
54
- }
55
- });
56
- }
57
- /**
58
- * when users interact with the dialog, they can skip the transition like in a game
59
- * note that there is a cool down to this, check out skipNextActiveTime
60
- */
61
- skipAnimation = () => {
62
- if (this.previousTimestamp > this.skipNextActiveTime &&
63
- this.currentState == DialogState.Visible &&
64
- !this.isDoneTransition // crucial for dynamic links!
65
- ) {
66
- this.currentIndex = this.fullCurrentMessage.length - 1;
67
- this.currentMessage.update(() => this.fullCurrentMessage.slice(0, this.currentIndex));
68
- }
69
- };
70
- /**
71
- * hides or shows the dialog UI
72
- * @param shouldEnable
73
- */
74
- enableDialog = (shouldEnable) => {
75
- enableDialogueOverlay.update(() => shouldEnable);
76
- };
77
- /**
78
- * sets the possible dialog that might appear on the Dialog UI
79
- * note that it overwrites the previous tree and does not append on it due to the possibility
80
- * of node name conflicts
81
- * @param newMessageList
82
- */
83
- setDialogTree = (newMessageList) => {
84
- this.dialogMessageList = newMessageList;
85
- this.dialogMessageMap.clear();
86
- newMessageList.map((value) => {
87
- if (value.dialogId) {
88
- this.dialogMessageMap.set(value.dialogId, value);
89
- }
90
- });
91
- // lazy load map
92
- if (this.portraitMap.size == 0) {
93
- this.portraitMap.set(PortraitType.AresHappy.toString(), AresHappy);
94
- this.portraitMap.set(PortraitType.AresBlushing.toString(), AresBlushing);
95
- this.portraitMap.set(PortraitType.AresDisappointed.toString(), AresDisappointed);
96
- this.portraitMap.set(PortraitType.AresLetsGo.toString(), AresLetsGo);
97
- this.portraitMap.set(PortraitType.AresMad.toString(), AresMad);
98
- this.portraitMap.set(PortraitType.AresNeutral.toString(), AresNeutral);
99
- this.portraitMap.set(PortraitType.AresSlightlyMad.toString(), AresSlightlyMad);
100
- this.portraitMap.set(PortraitType.AresSurprised.toString(), AresSurprised);
101
- this.portraitMap.set(PortraitType.AresYay.toString(), AresYay);
102
- }
103
- this.setDialogChoice(newMessageList[0]);
104
- };
105
- /**
106
- * Remember to call this before SetDialogTree
107
- * and unsubscribe during onDestroy
108
- * @param callback
109
- */
110
- subscribeToSetDialogChoice = (callback) => {
111
- this.onSetDialogListeners.push(callback);
112
- };
113
- /**
114
- * Remember to call this during onDestroy
115
- * @param callback
116
- * todo: double check if this works???
117
- */
118
- unsubscribeToSetDialogChoice = (callback) => {
119
- // from: https://stackoverflow.com/a/5767357/17836168
120
- const index = this.onSetDialogListeners.indexOf(callback);
121
- if (index > -1) {
122
- // only splice array when item is found
123
- this.onSetDialogListeners.splice(index, 1); // 2nd parameter means remove one item only
124
- }
125
- };
126
- /**
127
- * Sets the next dialog to show depending on which special choice a href link the user
128
- * has interacted with
129
- * @param newMessage
130
- *
131
- * you can listen to this!
132
- */
133
- setDialogChoice = (newMessage) => {
134
- if (!newMessage || !newMessage.textContent) {
135
- return;
136
- }
137
- this._setDialogChoiceQueue.push(newMessage);
138
- if (!this._setDialogChoiceMutex) {
139
- this._setDialogChoiceMutex = true; // not a true mutex but this will do
140
- this._setDialogChoice();
141
- }
142
- };
143
- _setDialogChoice = () => {
144
- const newMessage = this._setDialogChoiceQueue.shift();
145
- if (newMessage === undefined) {
146
- this._setDialogChoiceMutex = false; // set it free!
147
- this.onSetDialogListeners.forEach((listener) => {
148
- listener(this.currentMessageMeta);
149
- });
150
- return;
151
- }
152
- this.currentMessageMeta = newMessage;
153
- // set the portrait
154
- let portraitValue = AresHappy;
155
- if (this.currentMessageMeta.portraitType) {
156
- portraitValue = this.portraitMap.get(this.currentMessageMeta.portraitType);
157
- }
158
- if (portraitValue) {
159
- this.currentPortrait.update(() => portraitValue);
160
- }
161
- // process the dialogue here line-by-line
162
- this.fullCurrentMessage = this.dialogProcessor.processDialog(this.currentMessageMeta);
163
- this.currentMessage.update(() => "");
164
- this.currentIndex = 0;
165
- this.skipNextActiveTime = this.previousTimestamp + 1000; // guard
166
- this.isDoneTransition = false; // must be after the guard
167
- if (shouldDebugYarn) {
168
- console.info(`Currently processing node: ${this.currentMessageMeta.dialogId}`);
169
- }
170
- // save that we visited AND processed the node
171
- if (this.currentMessageMeta.dialogId) {
172
- const key = `+${this.currentMessageMeta.dialogId}`;
173
- const value = Number(dialogVariableStore.getItem(key));
174
- if (isNaN(value)) {
175
- dialogVariableStore.setItem(key, "1");
176
- }
177
- else {
178
- dialogVariableStore.setItem(key, `${value + 1}`);
179
- }
180
- }
181
- // reloop this to process all messages
182
- this._setDialogChoice();
183
- };
184
- setDialogToDefault = () => {
185
- this.setDialogTree(defaultDialogMessage);
186
- };
187
- /**
188
- * updates the information and detail frame by frame
189
- * you can think of this like the main game loop
190
- *
191
- * @param timestamp
192
- *
193
- * todo: this might be too big we might want to refactor this method for better readability
194
- * ISSUE #81 https://github.com/TurnipXenon/pineapple/issues/81
195
- */
196
- update = (timestamp) => {
197
- if (this.currentState == DialogState.Invisible || this.currentState == DialogState.Busy) {
198
- window.requestAnimationFrame(this.update);
199
- return;
200
- }
201
- // if visible
202
- // text transition loop
203
- if (!this.isDoneTransition && this.currentIndex > this.fullCurrentMessage.length) {
204
- const elementList = document.getElementsByClassName("dialog-choice");
205
- for (const el of elementList) {
206
- el.addEventListener("click", (event) => {
207
- // todo: make more robust; for now we're assuming first class is our choice
208
- const choice = el.classList[0].split("-")[1];
209
- this.setDialogChoice(this.dialogMessageMap.get(choice));
210
- });
211
- }
212
- this.isDoneTransition = true;
213
- }
214
- // guard: skip if done or if not yet time to update
215
- if (this.currentIndex > this.fullCurrentMessage.length ||
216
- this.previousTimestamp + updateRate > timestamp) {
217
- window.requestAnimationFrame(this.update);
218
- return;
219
- }
220
- this.previousTimestamp = timestamp;
221
- // check if valid text
222
- // there is an assumption that previous character is valid
223
- // let validCharacterIndex = this.currentLength - 1;
224
- // validCharacterIndex++;
225
- // the code above is just to show you how it looks like but let's assume
226
- // that currentLength = validCharacter + 1
227
- while (this.fullCurrentMessage[this.currentIndex] == "<" &&
228
- this.currentIndex + 1 < this.fullCurrentMessage.length) {
229
- // find valid character, trap with closing
230
- this.currentIndex = this.fullCurrentMessage.indexOf(">", this.currentIndex) + 1;
231
- // normalize
232
- this.currentIndex = Math.min(this.currentIndex, this.fullCurrentMessage.length - 1);
233
- }
234
- this.currentMessage.update(() => this.fullCurrentMessage.slice(0, this.currentIndex));
235
- // increment
236
- ++this.currentIndex;
237
- window.requestAnimationFrame(this.update);
238
- };
239
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * DialogManagerStore is for variables that will be used as a Svelte store
3
- * or is saved in local storage
4
- */
5
- /// <reference types="svelte" />
6
- import type { DialogMapStore } from "../../types/pineapple_fiber/DialogVariableStore";
7
- import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
8
- import { DialogManager } from "./DialogManager";
9
- /**
10
- * Enables the dialogue overlay
11
- *
12
- * @example
13
- * When updating to false, remember to restore the value to true, our default value, onDestroy.
14
- * Avoid async to prevent weird flashes of updates!
15
- * ```
16
- * import {enableDialogueOverlay} from "../../store.ts";
17
- * enableDialogueOverlay.update(() => false);
18
- *
19
- * onDestroy(() => {
20
- * enableDialogueOverlay.update(() => true);
21
- * });
22
- * ```
23
- */
24
- export declare const enableDialogueOverlay: import("svelte/store").Writable<boolean>;
25
- export declare const dialogVariableStore: DialogMapStore;
26
- export declare const updateRate: number;
27
- export declare const defaultDialogMessage: DialogDetail[];
28
- /**
29
- * strictly must be declared last! or you might receive a weird error that looks like:
30
- *
31
- * 2:04:21 AM [vite] Error when evaluating SSR module /src/lib/components/dialog_manager/DialogManagerStore.ts:
32
- * |- TypeError: Cannot read properties of undefined (reading '0')
33
- * at <instance_members_initializer> (/src/lib/components/dialog_manager/DialogManager.ts:38:67)
34
- * at new DialogManager (/src/lib/components/dialog_manager/DialogManager.ts:53:14)
35
- * at eval (/src/lib/components/dialog_manager/DialogManagerStore.ts:15:23)
36
- * at async instantiateModule (file:///C:/Users/Pumpkin/Projects/Web/pineapple/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:54360:9)
37
- *
38
- * what this means is that one member of dialogManager cannot be initialized. in our case, it was the
39
- * defaultDialogMessage not yet being initialized
40
- */
41
- export declare const dialogManager: DialogManager;
@@ -1,45 +0,0 @@
1
- /**
2
- * DialogManagerStore is for variables that will be used as a Svelte store
3
- * or is saved in local storage
4
- */
5
- import { createNewMapStore } from "../../types/pineapple_fiber/DialogVariableStore";
6
- import { writable } from "svelte/store";
7
- import { DialogManager } from "./DialogManager";
8
- /**
9
- * Enables the dialogue overlay
10
- *
11
- * @example
12
- * When updating to false, remember to restore the value to true, our default value, onDestroy.
13
- * Avoid async to prevent weird flashes of updates!
14
- * ```
15
- * import {enableDialogueOverlay} from "../../store.ts";
16
- * enableDialogueOverlay.update(() => false);
17
- *
18
- * onDestroy(() => {
19
- * enableDialogueOverlay.update(() => true);
20
- * });
21
- * ```
22
- */
23
- export const enableDialogueOverlay = writable(true);
24
- export const dialogVariableStore = createNewMapStore();
25
- export const updateRate = 40 / 1000; // *at least* 40ms per letter
26
- // todo: if we go through doing yarn to typescript, move this!
27
- export const defaultDialogMessage = [
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?`
30
- }
31
- ];
32
- /**
33
- * strictly must be declared last! or you might receive a weird error that looks like:
34
- *
35
- * 2:04:21 AM [vite] Error when evaluating SSR module /src/lib/components/dialog_manager/DialogManagerStore.ts:
36
- * |- TypeError: Cannot read properties of undefined (reading '0')
37
- * at <instance_members_initializer> (/src/lib/components/dialog_manager/DialogManager.ts:38:67)
38
- * at new DialogManager (/src/lib/components/dialog_manager/DialogManager.ts:53:14)
39
- * at eval (/src/lib/components/dialog_manager/DialogManagerStore.ts:15:23)
40
- * at async instantiateModule (file:///C:/Users/Pumpkin/Projects/Web/pineapple/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:54360:9)
41
- *
42
- * what this means is that one member of dialogManager cannot be initialized. in our case, it was the
43
- * defaultDialogMessage not yet being initialized
44
- */
45
- export const dialogManager = new DialogManager();
@@ -1,13 +0,0 @@
1
- import type { DialogDetail } from "../../types/pineapple_fiber/DialogDetail";
2
- import { LineSelectorNode } from "./behavior_tree/line_core/LineSelectorNode";
3
- /**
4
- * DialogProcessor processes dialogs
5
- */
6
- export declare class DialogProcessor {
7
- processingTree: LineSelectorNode;
8
- /**
9
- * process the dialog line by line and return a presentable string
10
- * @param dialogDetail
11
- */
12
- processDialog: (dialogDetail: DialogDetail) => string;
13
- }
@@ -1,62 +0,0 @@
1
- import { BehaviorState } from "./behavior_tree/line_processors/BehaviorState";
2
- import { IfNode } from "./behavior_tree/line_processors/IfNode";
3
- import { EndIfNode } from "./behavior_tree/line_processors/EndIfNode";
4
- import { ElseNode } from "./behavior_tree/line_processors/ElseNode";
5
- import { ElseIfNode } from "./behavior_tree/line_processors/ElseIfNode";
6
- import { SetVariableNode } from "./behavior_tree/line_processors/SetVariableNode";
7
- import { IgnoreGuardNode } from "./behavior_tree/line_processors/IgnoreGuardNode";
8
- import { NormalLineProcessorNode } from "./behavior_tree/line_processors/NormalLineProcessorNode";
9
- import { LineSelectorNode } from "./behavior_tree/line_core/LineSelectorNode";
10
- import { browser } from "$app/environment";
11
- import { LineCommentNode } from "./behavior_tree/line_processors/LineCommentNode";
12
- import { DeclareCommand } from "./behavior_tree/line_processors/commands/DeclareCommand";
13
- import { JumpCommand } from "./behavior_tree/line_processors/commands/JumpCommand";
14
- import { IgnoreJumpNode } from "./behavior_tree/line_processors/IgnoreJumpNode";
15
- import { UnvisitCommand } from "./behavior_tree/line_processors/commands/UnvisitCommand";
16
- /**
17
- * DialogProcessor processes dialogs
18
- */
19
- export class DialogProcessor {
20
- processingTree = new LineSelectorNode([
21
- /*region comment based formats*/
22
- new IgnoreJumpNode(), // must be prioritized above line comment node
23
- new LineCommentNode(),
24
- /*endregion commend based formats*/
25
- new EndIfNode(),
26
- new ElseIfNode(),
27
- new ElseNode(),
28
- new IfNode(),
29
- new IgnoreGuardNode(),
30
- /*region commands*/
31
- new SetVariableNode(),
32
- new DeclareCommand(),
33
- new JumpCommand(),
34
- new UnvisitCommand(),
35
- /*endregion commands*/
36
- new NormalLineProcessorNode()
37
- ]);
38
- /**
39
- * process the dialog line by line and return a presentable string
40
- * @param dialogDetail
41
- */
42
- processDialog = (dialogDetail) => {
43
- if (!browser) {
44
- return ""; // don't process any line in the server
45
- }
46
- let currentState = new BehaviorState();
47
- // split each yarn line
48
- return dialogDetail.textContent
49
- .trim()
50
- .split("\n")
51
- .map((line_, index) => {
52
- const result = this.processingTree.process({
53
- initState: currentState,
54
- line: line_.trim(),
55
- lineIndex: index
56
- });
57
- currentState = result.nextState;
58
- return result.renderedLine;
59
- })
60
- .join("\n"); // combine all processed lines
61
- };
62
- }
@@ -1,5 +0,0 @@
1
- declare class _DialogUtils {
2
- isNodeVisited: (dialogId: string) => boolean;
3
- }
4
- export declare const DialogUtils: _DialogUtils;
5
- export {};
@@ -1,8 +0,0 @@
1
- import { dialogVariableStore } from "./DialogManagerStore";
2
- class _DialogUtils {
3
- isNodeVisited = (dialogId) => {
4
- const value = Number(dialogVariableStore.getItem(`+${dialogId}`));
5
- return !isNaN(value) && value > 0;
6
- };
7
- }
8
- export const DialogUtils = new _DialogUtils();
@@ -1,15 +0,0 @@
1
- declare class BTreeUtils {
2
- /**
3
- * peek the top of a stack object with the assumption it's not an empty stack
4
- * todo: add possible protection like an assertion
5
- * @param stack
6
- * @return top of the stack
7
- */
8
- peek: <T>(stack: T[]) => T;
9
- removeQuotes: (value: string) => string;
10
- simplifyToken: (oldToken: string) => string;
11
- isTrue: (value: string) => boolean;
12
- isFalse: (value: string) => boolean;
13
- }
14
- export declare const btreeUtils: BTreeUtils;
15
- export {};
@@ -1,34 +0,0 @@
1
- class BTreeUtils {
2
- /**
3
- * peek the top of a stack object with the assumption it's not an empty stack
4
- * todo: add possible protection like an assertion
5
- * @param stack
6
- * @return top of the stack
7
- */
8
- peek = (stack) => {
9
- return stack[stack.length - 1];
10
- };
11
- removeQuotes = (value) => {
12
- return value
13
- .replace(/^"/, "") // remove possible " at the start: https://stackoverflow.com/a/2182602
14
- .replace(/"$/, ""); // remove possible " at the end: https://stackoverflow.com/a/12249011
15
- };
16
- simplifyToken = (oldToken) => {
17
- if (oldToken[0] == "$") {
18
- const value = localStorage.getItem(oldToken);
19
- if (value) {
20
- return value;
21
- }
22
- console.error(`Value obtained in local storage false: ${oldToken}`);
23
- return "";
24
- }
25
- return btreeUtils.removeQuotes(oldToken);
26
- };
27
- isTrue = (value) => {
28
- return value.trim().toLowerCase() === "true";
29
- };
30
- isFalse = (value) => {
31
- return value.trim().toLowerCase() === "false";
32
- };
33
- }
34
- export const btreeUtils = new BTreeUtils();
@@ -1,4 +0,0 @@
1
- import type { BehaviorStatus } from "./BehaviorStatus";
2
- export interface BaseBehaviorResult {
3
- status: BehaviorStatus;
4
- }
@@ -1,3 +0,0 @@
1
- export interface BehaviorNode<Argument, Result> {
2
- process: (nodeArgs: Argument) => Result;
3
- }
@@ -1,5 +0,0 @@
1
- export declare enum BehaviorStatus {
2
- Running = 0,
3
- Success = 1,
4
- Failure = 2
5
- }
@@ -1,6 +0,0 @@
1
- export var BehaviorStatus;
2
- (function (BehaviorStatus) {
3
- BehaviorStatus[BehaviorStatus["Running"] = 0] = "Running";
4
- BehaviorStatus[BehaviorStatus["Success"] = 1] = "Success";
5
- BehaviorStatus[BehaviorStatus["Failure"] = 2] = "Failure";
6
- })(BehaviorStatus || (BehaviorStatus = {}));
@@ -1,12 +0,0 @@
1
- import type { BehaviorNode } from "./BehaviorNode";
2
- import type { BaseBehaviorResult } from "./BaseBehaviorResult";
3
- /**
4
- * Selector is a composite behavior node where it tries to process everything until it
5
- * finds a non-failing node
6
- */
7
- export declare abstract class SelectorNode<Argument, Result extends BaseBehaviorResult> implements BehaviorNode<Argument, Result> {
8
- nodeList: BehaviorNode<Argument, Result>[];
9
- abstract defaultResult: () => Result;
10
- protected constructor(nodeList: BehaviorNode<Argument, Result>[]);
11
- process(nodeArgs: Argument): Result;
12
- }
@@ -1,22 +0,0 @@
1
- import { BehaviorStatus } from "./BehaviorStatus";
2
- /**
3
- * Selector is a composite behavior node where it tries to process everything until it
4
- * finds a non-failing node
5
- */
6
- export class SelectorNode {
7
- nodeList;
8
- constructor(nodeList) {
9
- this.nodeList = nodeList;
10
- }
11
- process(nodeArgs) {
12
- let finalResult = this.defaultResult();
13
- for (const node of this.nodeList) {
14
- const currentResult = node.process(nodeArgs);
15
- if (currentResult.status !== BehaviorStatus.Failure) {
16
- finalResult = currentResult;
17
- break;
18
- }
19
- }
20
- return finalResult;
21
- }
22
- }
@@ -1,5 +0,0 @@
1
- import type { ExpressionState } from "./ExpressionState";
2
- export interface ExpressionArguments {
3
- token: string;
4
- initState: ExpressionState;
5
- }
@@ -1,4 +0,0 @@
1
- import type { BehaviorNode } from "../core/BehaviorNode";
2
- import type { ExpressionArguments } from "./ExpressionArguments";
3
- import type { ExpressionResult } from "./ExpressionResult";
4
- export type ExpressionBehaviorNode = BehaviorNode<ExpressionArguments, ExpressionResult>;
@@ -1,15 +0,0 @@
1
- import { ExpressionSelectorNode } from "./ExpressionSelectorNode";
2
- declare class ExpressionEvaluator {
3
- evaluatorTree: ExpressionSelectorNode;
4
- isNumeric: (str: string) => boolean;
5
- getPrecedence: (token: string) => number;
6
- evaluateFreeform: (line: string, prefix: string) => string[];
7
- /**
8
- * evaluates a yarn if or elseif statement
9
- * @param line is the current line being evaluated
10
- * @param prefix is either "<<if" or "<<elseif"
11
- */
12
- evaluate: (line: string, prefix: string) => boolean;
13
- }
14
- export declare const expressionEvaluator: ExpressionEvaluator;
15
- export {};