@turnipxenon/pineapple 3.1.0-alpha.1 → 3.1.0-alpha.11

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 (59) 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 +14 -17
  5. package/dist/components/blog_template/BlogTemplate.svelte.d.ts +2 -1
  6. package/dist/components/dialog_manager/DialogManager.d.ts +3 -2
  7. package/dist/components/dialog_manager/DialogManager.js +6 -4
  8. package/dist/components/dialog_manager/DialogProcessor.d.ts +4 -2
  9. package/dist/components/dialog_manager/DialogProcessor.js +23 -18
  10. package/dist/components/dialog_manager/IDialogManager.d.ts +0 -1
  11. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.d.ts +2 -2
  12. package/dist/components/dialog_manager/behavior_tree/line_processors/commands/JumpCommand.js +4 -5
  13. package/dist/components/dialog_overlay/DialogOverlay.svelte +47 -59
  14. package/dist/components/pineapple/PineappleBaseLayout.svelte +3 -4
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/scripts/pineapple_fiber/PineappleWeaver.js +1 -2
  18. package/dist/styles/app.css +4 -2
  19. package/dist/styles/turnip-theme.css +17 -7
  20. package/dist/ui/components/SocialSection.svelte +2 -1
  21. package/dist/ui/components/randomized-background/RandomizedBackground.svelte +9 -1
  22. package/dist/ui/elements/CodeBlock/CodeBlock.svelte +2 -1
  23. package/dist/ui/elements/CodeBlock/CodeBlockProps.d.ts +1 -1
  24. package/dist/ui/elements/ImageIcon.svelte +2 -2
  25. package/dist/ui/elements/ImageIcon.svelte.d.ts +1 -1
  26. package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButton.svelte +25 -0
  27. package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButton.svelte.d.ts +4 -0
  28. package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButtonProps.d.ts +4 -0
  29. package/dist/ui/elements/PinyaAnchorButton/PinyaAnchorButtonProps.js +1 -0
  30. package/dist/ui/elements/PinyaAnchorButton/index.d.ts +2 -0
  31. package/dist/ui/elements/PinyaAnchorButton/index.js +2 -0
  32. package/dist/ui/elements/PinyaButton/PinyaButton.svelte +8 -31
  33. package/dist/ui/elements/PinyaButton/PinyaButton.svelte.d.ts +1 -1
  34. package/dist/ui/elements/PinyaButton/PinyaButtonProps.d.ts +4 -14
  35. package/dist/ui/elements/PinyaButton/PinyaButtonProps.js +1 -6
  36. package/dist/ui/elements/PinyaButtonCommon/ButtonVariant.d.ts +5 -0
  37. package/dist/ui/elements/PinyaButtonCommon/ButtonVariant.js +6 -0
  38. package/dist/ui/elements/PinyaButtonCommon/PinyaButtonCommonProps.d.ts +8 -0
  39. package/dist/ui/elements/PinyaButtonCommon/PinyaButtonCommonProps.js +2 -0
  40. package/dist/ui/elements/PinyaButtonCommon/createButtonClass.d.ts +2 -0
  41. package/dist/ui/elements/PinyaButtonCommon/createButtonClass.js +31 -0
  42. package/dist/ui/elements/PinyaButtonCommon/index.d.ts +3 -0
  43. package/dist/ui/elements/PinyaButtonCommon/index.js +3 -0
  44. package/dist/ui/elements/PinyaCard/PinyaCard.svelte +14 -6
  45. package/dist/ui/elements/PinyaCard/PinyaCardProps.d.ts +1 -0
  46. package/dist/ui/elements/index.d.ts +6 -4
  47. package/dist/ui/elements/index.js +8 -4
  48. package/dist/ui/modules/NavigationMenu/NavigationMenu.svelte +1 -1
  49. package/dist/ui/modules/projects/Hepcat.svelte +1 -1
  50. package/dist/ui/modules/projects/Pengi.svelte +1 -1
  51. package/dist/ui/modules/projects/Soulwork.svelte +1 -1
  52. package/dist/ui/modules/projects/ThisWebpage.svelte +1 -1
  53. package/dist/ui/templates/PinyaPageLayout/PinyaPageLayout.svelte +7 -3
  54. package/dist/ui/templates/PinyaPageLayout/runes.svelte.d.ts +1 -0
  55. package/dist/ui/templates/PinyaPageLayout/runes.svelte.js +1 -0
  56. package/package.json +1 -1
  57. package/src/lib/styles/app.css +4 -2
  58. package/dist/components/dialog_manager/DialogMangerInit.d.ts +0 -2
  59. package/dist/components/dialog_manager/DialogMangerInit.js +0 -21
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
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 Snippet } from "svelte";
2
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>;
@@ -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,7 +7,6 @@ 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;
@@ -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,16 +1,16 @@
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";
7
8
  import PinyaCard from "../../ui/elements/PinyaCard/PinyaCard.svelte";
8
9
  import { appState } from "../../ui/templates/index";
9
10
  import CloseIcon from "../../assets/icons/close.svg";
10
11
  import FABIcon from "../../assets/bg_tiled/bg_tiled_turnip.png";
11
12
  import { enableDialogueOverlay } from "../dialog_manager/DialogManagerStore";
12
- import { PinyaButton } from "../../ui/elements/index";
13
- import { slide } from "svelte/transition";
13
+ import PinyaButton from "../../ui/elements/PinyaButton/PinyaButton.svelte";
14
14
 
15
15
  let currentMessage = $state("");
16
16
  let currentPortrait = $state(AresHappy);
@@ -18,34 +18,31 @@
18
18
 
19
19
  let hidePercent = $state(100);
20
20
  let isHidden = $state(true);
21
- let dialogManager: IDialogManager | undefined = $state(undefined);
22
21
  onMount(() => {
23
- getDialogManager()
24
- .then(dm => {
25
- dialogManager = dm;
26
22
 
27
- dialogManager.currentMessage.subscribe((value) => {
28
- currentMessage = value;
29
- });
23
+ dialogManager.currentMessage.subscribe((value) => {
24
+ currentMessage = value;
25
+ });
30
26
 
31
- dialogManager.currentPortrait.subscribe((value) => {
32
- if (value) {
33
- currentPortrait = value;
34
- }
35
- });
27
+ dialogManager.currentPortrait.subscribe((value) => {
28
+ console.log("sub value", value);
29
+ if (value) {
30
+ currentPortrait = value;
31
+ }
32
+ });
36
33
 
37
- dialogManager.hidePercent.subscribe((value) => {
38
- hidePercent = value * 0.4;
39
- isHidden = false;
40
- });
34
+ dialogManager.hidePercent.subscribe((value) => {
35
+ hidePercent = value * 0.4;
36
+ isHidden = false;
37
+ });
41
38
 
42
- dialogManager.currentReadableState.subscribe((value) => {
43
- isHidden = value === DialogState.Invisible;
44
- });
39
+ dialogManager.currentReadableState.subscribe((value) => {
40
+ isHidden = value === DialogState.Invisible;
41
+ });
45
42
 
46
- dialogManager.update(0);
47
- isMounted = true;
48
- });
43
+ console.log("CAlling update");
44
+ dialogManager.update(0);
45
+ isMounted = true;
49
46
 
50
47
  });
51
48
 
@@ -84,13 +81,13 @@
84
81
  paddingClass=""
85
82
  className="dialog-name"
86
83
  >
87
- <div>
88
- <b class="fake-h1">Turnip</b>
89
- </div>
84
+ <div class="fake-h1">Turnip</div>
90
85
  </PinyaCard>
91
86
  <PinyaCard
92
87
  widthClass="w-full"
93
88
  className="dialog-text"
89
+ colorClass=""
90
+ flexClass=""
94
91
  >
95
92
  <!-- Made for 140 characters, like the original tweets -->
96
93
  {@html currentMessage}
@@ -100,12 +97,11 @@
100
97
 
101
98
 
102
99
  {#if appState.allowDialog && isMounted}
103
- <div class="fab-container" in:slide>
100
+ <div class="fab-container" transition:slide>
104
101
  <PinyaButton
105
102
  classes="fab"
106
- onclick={()=>{
107
- getDialogManager().then(dm => dm.toggleDialogOverlay());
108
- }}>
103
+ onclick={()=>{dialogManager.toggleDialogOverlay();}}
104
+ >
109
105
  {#if (enableDialogueOverlayValue)}
110
106
  <img class="turnip-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
111
107
  {:else }
@@ -118,12 +114,12 @@
118
114
  <style>
119
115
  :global(.dialog-text) {
120
116
  height: 100%;
121
- padding: 1.2lh 2rem 0.5lh;
117
+ padding: 0.8lh 2rem 0.5lh;
122
118
  }
123
119
 
124
- :global(.dialog-box *,.dialog-name *) {
125
- font-size: clamp(1em, 5vw, 1.3em);
126
- line-height: 1.5em;
120
+ :global(.dialog-text) {
121
+ font-size: clamp(1rem, 3vw, 1.75rem);
122
+ line-height: calc(clamp(1rem, 3vw, 1.75rem) * 1.5);
127
123
  }
128
124
 
129
125
  .dialog-elements {
@@ -143,16 +139,6 @@
143
139
  transform: translateY(var(--hidePercentHeight));
144
140
  }
145
141
 
146
-
147
- .dialog-padding :global(p) {
148
- font-size: clamp(1em, 5vw, 1.3em) !important;
149
- line-height: 1.5em !important;
150
- }
151
-
152
- .dialog-padding {
153
- padding: clamp(1.5em, 5vw, 1.75em) clamp(0em, 5vw - 0.5em, 2em) 0;
154
- }
155
-
156
142
  :global(.dialog-name) {
157
143
  padding-left: 2rem;
158
144
  padding-right: 2rem;
@@ -194,28 +180,30 @@
194
180
  transform: scaleX(-1);
195
181
  }
196
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
+ }
197
190
 
198
191
  .dialog-box {
199
- background-color: var(--color-surface-500);
192
+ background-color: var(--bg-dialog);
200
193
  position: fixed;
201
194
  bottom: 0;
202
195
  width: var(--dialog-box-width); /*75em + 4em padding*/
203
196
  height: var(--dialog-box-height);
204
- max-width: calc(100vw - ((var(--fab-margin) * 2) + 4em));
197
+ max-width: calc(100vw - ((var(--fab-margin) * 3) + (clamp(2rem, 5vw, 4rem))));
205
198
  border-radius: 1rem;
206
199
  }
207
200
 
208
- .dark .dialog-box {
209
- background-color: rgb(var(--color-surface-900) / 0.95);
210
- --tw-ring-color: rgb(var(--color-text-400));
211
- /*background-color: red;*/
212
- }
213
-
214
201
  :global(.fab) {
215
- /*@apply btn preset-filled-tertiary-500;*/
202
+ position: relative;
203
+ transform: scale3d(1, 1, 1.5);
216
204
  background-color: var(--color-tertiary-500);
217
205
  padding: 0.3rem;
218
- width: 4em;
206
+ width: clamp(2rem, 5vw, 4rem);
219
207
  border-radius: 50%;
220
208
  z-index: 100;
221
209
  box-shadow: 3px 3px 3px var(--shadow-color);
@@ -224,7 +212,7 @@
224
212
 
225
213
  .fab-container {
226
214
  position: fixed;
227
- bottom: 0;
215
+ bottom: 0;
228
216
  }
229
217
 
230
218
  .fab-container:dir(ltr) {
@@ -20,7 +20,7 @@
20
20
  import Toast from "./toast/Toast.svelte";
21
21
  import DialogOverlay from "../dialog_overlay/DialogOverlay.svelte";
22
22
  import { fade } from "svelte/transition";
23
- import { getDialogManager } from "../dialog_manager/DialogMangerInit";
23
+ import { dialogManager } from "../dialog_manager/DialogManager";
24
24
 
25
25
  interface Props {
26
26
  showDialogByDefault?: boolean;
@@ -77,7 +77,7 @@
77
77
 
78
78
  <!--todo: turn off hidden when it's time-->
79
79
  <button class="fab" onclick={()=>{
80
- getDialogManager().then(dm => dm.toggleDialogOverlay());
80
+ dialogManager.toggleDialogOverlay();
81
81
  }}>
82
82
  {#if (enableDialogueOverlayValue)}
83
83
  <img class="turnip-icon" src={CloseIcon} alt="interactive floating action button represented as a turnip">
@@ -189,9 +189,8 @@
189
189
  }
190
190
 
191
191
  .fab {
192
- /*@apply btn preset-filled-tertiary-500;*/
192
+ position: fixed;
193
193
  padding: 0;
194
- position: fixed;
195
194
  bottom: var(--fab-margin);
196
195
  width: 4em;
197
196
  border-radius: 50%;
package/dist/index.d.ts CHANGED
@@ -11,4 +11,4 @@ export * from "./types/pineapple_fiber/DialogDetail";
11
11
  export * from "./util/util";
12
12
  export * from "./api/index";
13
13
  export type { IDialogManager } from "./components/dialog_manager/IDialogManager";
14
- export { getDialogManager } from "./components/dialog_manager/DialogMangerInit";
14
+ export { dialogManager } from "./components/dialog_manager/DialogManager";
package/dist/index.js CHANGED
@@ -11,4 +11,4 @@ export * from "./types/pineapple_fiber/PortraitType";
11
11
  export * from "./types/pineapple_fiber/DialogDetail";
12
12
  export * from "./util/util";
13
13
  export * from "./api/index";
14
- export { getDialogManager } from "./components/dialog_manager/DialogMangerInit";
14
+ export { dialogManager } from "./components/dialog_manager/DialogManager";
@@ -44,8 +44,7 @@ const pineappleWeaverRun = () => {
44
44
  const template = `// this file was generated by PineappleWeaver.ts
45
45
  // do not edit!
46
46
 
47
- import type { DialogDetail } from "@turnipxenon/pineapple";
48
- import { dialogManager, PortraitType } from "@turnipxenon/pineapple";
47
+ import { type DialogDetail, dialogManager, PortraitType } from "@turnipxenon/pineapple";
49
48
 
50
49
  class _${fileName}Yarn {
51
50
  dialogList: DialogDetail[] = [
@@ -22,13 +22,15 @@ html {
22
22
  height: calc(var(--dialog-box-height) + 4em);
23
23
  }
24
24
 
25
- a.dialog-choice {
25
+ .dialog-box a, .dialog-box b, .dialog-box i {
26
26
  font-size: inherit;
27
+ }
28
+
29
+ a.dialog-choice {
27
30
  cursor: url("$pkg/assets/icons/chat-cursor.svg"), auto;
28
31
  }
29
32
 
30
33
  a.external-link {
31
- font-size: inherit;
32
34
  cursor: url("$pkg/assets/icons/external-link.svg"), auto;
33
35
  }
34
36