@turnipxenon/pineapple 3.0.0 → 3.1.0-alpha.10

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