@novely/solid-renderer 0.0.7 → 0.2.0

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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * These SVG icons are provided by Make Lemonade's Iconicicons (https://iconic.app/)
3
+ * under the "Do WTF You Want With" license.
4
+ */
5
+ import type { JSX } from 'solid-js';
6
+ type SVGProps = JSX.SvgSVGAttributes<SVGSVGElement>;
7
+ type IconProps = SVGProps & {
8
+ children: JSX.Element;
9
+ };
10
+ declare const Icon: {
11
+ (props: IconProps): JSX.Element;
12
+ Back(): JSX.Element;
13
+ Save(): JSX.Element;
14
+ Settings(): JSX.Element;
15
+ Exit(): JSX.Element;
16
+ };
17
+ export { Icon };
@@ -0,0 +1,3 @@
1
+ import type { TypewriterSpeed } from '@novely/core';
2
+ declare const TEXT_SPEED_MAP: Record<TypewriterSpeed, (() => number) | undefined>;
3
+ export { TEXT_SPEED_MAP };
@@ -5,7 +5,7 @@ interface DataContext {
5
5
  storeDataUpdate: (fn: (prev: StorageData) => StorageData) => void;
6
6
  options: RendererInit;
7
7
  renderer: Renderer;
8
- t: (key: BaseTranslationStrings) => string;
8
+ t: (key: BaseTranslationStrings | (string & {})) => string;
9
9
  }
10
10
  interface ProviderProps {
11
11
  storeData: Stored<StorageData>;
package/dist/index.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/renderer.tsx
2
- import { Switch, Match } from "solid-js";
2
+ import { Switch, Match, createEffect as createEffect3 } from "solid-js";
3
3
  import { createStore } from "solid-js/store";
4
4
 
5
5
  // src/utils.ts
@@ -31,6 +31,16 @@ var canvasDrawImages = (canvas = document.createElement("canvas"), ctx = canvas.
31
31
  var url = (str) => {
32
32
  return `url(${str})`;
33
33
  };
34
+ var escaped = {
35
+ '"': "&quot;",
36
+ "'": "&#39;",
37
+ "&": "&amp;",
38
+ "<": "&lt;",
39
+ ">": "&gt;"
40
+ };
41
+ var escape = (str) => {
42
+ return String(str).replace(/["'&<>]/g, (match) => escaped[match]);
43
+ };
34
44
 
35
45
  // src/context/index.tsx
36
46
  import { from, createContext, useContext } from "solid-js";
@@ -121,6 +131,29 @@ var Modal = (props) => {
121
131
  >{props.children}</div></Show>;
122
132
  };
123
133
 
134
+ // src/components/Icon.tsx
135
+ var Icon = (props) => {
136
+ return <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" {...props}>{props.children}</svg>;
137
+ };
138
+ Icon.Back = () => {
139
+ return <path d="m9.75 12 8.5-6.25v12.5L9.75 12ZM5.75 5.75v12.5" />;
140
+ };
141
+ Icon.Save = () => {
142
+ return <>
143
+ <path d="M6.75 19.25h10.5a2 2 0 0 0 2-2V9.828a2 2 0 0 0-.586-1.414l-3.078-3.078a2 2 0 0 0-1.414-.586H6.75a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2Z" />
144
+ <path d="M8.75 19v-3.25a1 1 0 0 1 1-1h4.5a1 1 0 0 1 1 1V19M8.75 5v3.25" />
145
+ </>;
146
+ };
147
+ Icon.Settings = () => {
148
+ return <>
149
+ <path d="M13.12 5.613a1 1 0 0 0-.991-.863h-.258a1 1 0 0 0-.99.863l-.087.632c-.056.403-.354.724-.732.874a5.225 5.225 0 0 0-.167.07c-.373.163-.81.15-1.136-.095l-.308-.23a1 1 0 0 0-1.307.092l-.188.188a1 1 0 0 0-.092 1.307l.23.308c.244.325.258.763.095 1.136a5.225 5.225 0 0 0-.07.167c-.15.378-.47.676-.874.732l-.632.087a1 1 0 0 0-.863.99v.258a1 1 0 0 0 .863.99l.632.087c.403.056.724.354.874.732l.07.167c.163.373.15.81-.095 1.136l-.23.308a1 1 0 0 0 .092 1.307l.188.188a1 1 0 0 0 1.307.093l.308-.231c.325-.244.763-.258 1.136-.095a5.4 5.4 0 0 0 .167.07c.378.15.676.47.732.874l.087.632a1 1 0 0 0 .99.863h.258a1 1 0 0 0 .99-.863l.087-.632c.056-.403.354-.724.732-.874a5.12 5.12 0 0 0 .167-.07c.373-.163.81-.15 1.136.095l.308.23a1 1 0 0 0 1.307-.092l.188-.188a1 1 0 0 0 .093-1.307l-.231-.308c-.244-.325-.258-.763-.095-1.136l.07-.167c.15-.378.47-.676.874-.732l.632-.087a1 1 0 0 0 .863-.99v-.258a1 1 0 0 0-.863-.99l-.632-.087c-.403-.056-.724-.354-.874-.732a5.168 5.168 0 0 0-.07-.167c-.163-.373-.15-.81.095-1.136l.23-.308a1 1 0 0 0-.092-1.307l-.188-.188a1 1 0 0 0-1.307-.092l-.308.23c-.325.244-.763.258-1.136.095a5.185 5.185 0 0 0-.167-.07c-.378-.15-.676-.47-.732-.874l-.087-.632Z" />
150
+ <path d="M13.25 12a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z" />
151
+ </>;
152
+ };
153
+ Icon.Exit = () => {
154
+ return <path d="m15.75 8.75 3.5 3.25-3.5 3.25M19 12h-8.25M15.25 4.75h-8.5a2 2 0 0 0-2 2v10.5a2 2 0 0 0 2 2h8.5" />;
155
+ };
156
+
124
157
  // ../typewriter/dist/index.js
125
158
  var defaultSpeed = () => {
126
159
  return Math.min(90 * Math.random() + 100, 90);
@@ -140,8 +173,12 @@ var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
140
173
  const nodes = collectTextNodes(node).map((child) => {
141
174
  const letters = [...child.textContent].map((char) => {
142
175
  const text2 = document.createElement("span");
143
- text2.textContent = char;
144
- text2.style.cssText = "opacity: 0;";
176
+ if (char === " ") {
177
+ text2.innerHTML = "&#8197;";
178
+ } else {
179
+ text2.textContent = char;
180
+ }
181
+ text2.style.opacity = "0";
145
182
  return text2;
146
183
  });
147
184
  child.replaceWith(...letters);
@@ -203,7 +240,7 @@ var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
203
240
  node.innerHTML = "";
204
241
  return end;
205
242
  }
206
- node.innerHTML = text;
243
+ node.innerHTML = text.replace(/ /gm, "&#8197;");
207
244
  end = true;
208
245
  return false;
209
246
  },
@@ -217,6 +254,14 @@ var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
217
254
  };
218
255
  };
219
256
 
257
+ // src/constants.ts
258
+ var TEXT_SPEED_MAP = {
259
+ "Slow": () => 120,
260
+ "Medium": () => 90,
261
+ "Fast": () => 60,
262
+ "Auto": void 0
263
+ };
264
+
220
265
  // src/screens/game.tsx
221
266
  var Game = (props) => {
222
267
  const data = useData();
@@ -242,6 +287,7 @@ var Game = (props) => {
242
287
  return;
243
288
  if (!text)
244
289
  return;
290
+ const speed = data.storeData().meta[1];
245
291
  writer = typewriter({
246
292
  node: element,
247
293
  text,
@@ -251,9 +297,7 @@ var Game = (props) => {
251
297
  untrack2(clearTypewriterEffect);
252
298
  }
253
299
  },
254
- speed() {
255
- return data.storeData().meta[1];
256
- }
300
+ speed: TEXT_SPEED_MAP[speed]
257
301
  });
258
302
  });
259
303
  const onChoicesButtonClick = ([disabled, i]) => {
@@ -313,7 +357,7 @@ var Game = (props) => {
313
357
  const [canvas] = canvasDrawImages(void 0, void 0, Object.values(image));
314
358
  return canvas;
315
359
  }}</Show2></div>
316
- <p class="action-dialog-content" ref={store.dialogRef}> </p>
360
+ <p class="action-dialog-content" ref={store.dialogRef} />
317
361
  </div>
318
362
  </div>
319
363
  <Modal
@@ -362,23 +406,32 @@ var Game = (props) => {
362
406
  </div>
363
407
  </div></Modal>
364
408
  <div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
365
- <div class="action-text" data-shown={Boolean(props.state.text.content)} ref={store.textRef} onClick={clearTypewriterEffect}> </div>
409
+ <div class="action-text" data-shown={Boolean(props.state.text.content)} onClick={clearTypewriterEffect}><span ref={store.textRef} /></div>
366
410
  <div class="control-panel">
367
411
  <button
368
412
  type="button"
369
413
  class="button control-panel__button"
414
+ title={data.t("GoBack")}
370
415
  onClick={data.options.back}
371
- >{data.t("GoBack")}</button>
416
+ >
417
+ <span class="control-panel__button__content">{data.t("GoBack")}</span>
418
+ <Icon class="control-panel__button__icon" children={Icon.Back()} />
419
+ </button>
372
420
  <button
373
421
  type="button"
374
422
  class="button control-panel__button"
423
+ title={data.t("DoSave")}
375
424
  onClick={() => {
376
425
  data.options.save(false, "manual");
377
426
  }}
378
- >{data.t("DoSave")}</button>
427
+ >
428
+ <span class="control-panel__button__content">{data.t("DoSave")}</span>
429
+ <Icon class="control-panel__button__icon" children={Icon.Save()} />
430
+ </button>
379
431
  <button
380
432
  type="button"
381
433
  class="button control-panel__button"
434
+ title={data.t(auto() ? "Stop" : "Auto")}
382
435
  onClick={() => {
383
436
  setAuto((prev) => !prev);
384
437
  }}
@@ -386,16 +439,24 @@ var Game = (props) => {
386
439
  <button
387
440
  type="button"
388
441
  class="button control-panel__button"
442
+ title={data.t("Settings")}
389
443
  onClick={() => {
390
444
  data.options.save(false, "auto");
391
445
  props.setState("screen", "settings");
392
446
  }}
393
- >{data.t("Settings")}</button>
447
+ >
448
+ <span class="control-panel__button__content">{data.t("Settings")}</span>
449
+ <Icon class="control-panel__button__icon" children={Icon.Settings()} />
450
+ </button>
394
451
  <button
395
452
  type="button"
396
453
  class="button control-panel__button"
454
+ title={data.t("Exit")}
397
455
  onClick={data.options.exit}
398
- >{data.t("Exit")}</button>
456
+ >
457
+ <span class="control-panel__button__content">{data.t("Exit")}</span>
458
+ <Icon class="control-panel__button__icon" children={Icon.Exit()} />
459
+ </button>
399
460
  </div>
400
461
  </div>;
401
462
  };
@@ -443,9 +504,14 @@ var Saves = (props) => {
443
504
  onClick={() => data.options.set(save)}
444
505
  >
445
506
  {stringDate}
446
- <span style={{ "margin-left": "1em" }}>{stringType}</span>
507
+ <span class="saves__button-load__type">{stringType}</span>
447
508
  </button>
448
- <button type="reset" class="button" aria-label={data.t("DeleteASaveFrom") + " " + stringDate} onClick={[removeSave, date]}><span>{data.t("Remove")}</span></button>
509
+ <button
510
+ type="reset"
511
+ class="button saves__button-reset"
512
+ aria-label={data.t("DeleteASaveFrom") + " " + stringDate}
513
+ onClick={[removeSave, date]}
514
+ ><span>{data.t("Remove")}</span></button>
449
515
  </li>;
450
516
  }}</For2></ol></Show3></div>
451
517
  </div>;
@@ -460,16 +526,14 @@ var Settings = (props) => {
460
526
  const languageNames = createMemo(() => new Intl.DisplayNames([language()], {
461
527
  type: "language"
462
528
  }));
463
- const onLanguageSelect = ({ currentTarget }) => {
464
- const selected = currentTarget.value;
529
+ const onLanguageSelect = ({ currentTarget: { value } }) => {
465
530
  data.storeDataUpdate((prev) => {
466
- return prev.meta[0] = selected, prev;
531
+ return prev.meta[0] = value, prev;
467
532
  });
468
533
  };
469
- const onSpeedSelect = ({ currentTarget }) => {
470
- const selected = +currentTarget.value;
534
+ const onSpeedSelect = ({ currentTarget: { value } }) => {
471
535
  data.storeDataUpdate((prev) => {
472
- return prev.meta[1] = selected, prev;
536
+ return prev.meta[1] = value, prev;
473
537
  });
474
538
  };
475
539
  const languageSelectID = createUniqueId();
@@ -486,7 +550,7 @@ var Settings = (props) => {
486
550
  </div>
487
551
  <div class="select">
488
552
  <label class="select__label" for={speedSelectID}>{data.t("TextSpeed")}</label>
489
- <select class="select__select" id={speedSelectID} onChange={onSpeedSelect}><For3 each={[90, 140, 190]}>{(speed) => <option value={speed} selected={speed === textSpeed()}>{speed}</option>}</For3></select>
553
+ <select class="select__select" id={speedSelectID} onChange={onSpeedSelect}><For3 each={["Slow", "Medium", "Fast", "Auto"]}>{(speed) => <option value={speed} selected={speed === textSpeed()}>{data.t("TextSpeed" + speed)}</option>}</For3></select>
490
554
  </div>
491
555
  </div>
492
556
  </div>;
@@ -503,7 +567,7 @@ var Loading = () => {
503
567
  };
504
568
 
505
569
  // src/renderer.tsx
506
- var createSolidRenderer = () => {
570
+ var createSolidRenderer = ({ fullscreen = false } = {}) => {
507
571
  const [state, setState] = createStore({
508
572
  background: "",
509
573
  characters: {},
@@ -555,22 +619,26 @@ var createSolidRenderer = () => {
555
619
  ctx,
556
620
  emotions: {},
557
621
  withEmotion(emotion) {
558
- const stored = store.characters[character].emotions[emotion];
622
+ const stored = this.emotions[emotion];
559
623
  const render = (...images) => {
560
624
  return () => {
561
625
  canvasDrawImages(canvas, ctx, images);
562
626
  };
563
627
  };
564
- if (stored)
565
- return render(..."head" in stored ? [stored.head, stored.left, stored.right] : [stored]);
628
+ if (stored) {
629
+ if (stored instanceof HTMLImageElement) {
630
+ return render(stored);
631
+ }
632
+ return render(...Object.values(stored));
633
+ }
566
634
  const emotionData = characters[character].emotions[emotion];
567
635
  if (typeof emotionData === "string") {
568
- return render(store.characters[character].emotions[emotion] = createImage(emotionData));
636
+ return render(this.emotions[emotion] = createImage(emotionData));
569
637
  }
570
638
  const head = createImage(emotionData.head);
571
639
  const left = createImage(emotionData.body.left);
572
640
  const right = createImage(emotionData.body.right);
573
- store.characters[character].emotions[emotion] = {
641
+ this.emotions[emotion] = {
574
642
  head,
575
643
  left,
576
644
  right
@@ -617,7 +685,8 @@ var createSolidRenderer = () => {
617
685
  },
618
686
  clear(goingBack) {
619
687
  return (resolve) => {
620
- setState("background", "#000");
688
+ if (!goingBack)
689
+ setState("background", "#000");
621
690
  setState("choices", { choices: [], visible: false, resolve: void 0, question: "" });
622
691
  setState("input", { element: void 0, question: "", visible: false });
623
692
  setState("dialog", { visible: false, content: "", name: "" });
@@ -637,11 +706,21 @@ var createSolidRenderer = () => {
637
706
  },
638
707
  input(question, onInput, setup) {
639
708
  return (resolve) => {
640
- const errorHandler = (value) => {
709
+ const error = (value) => {
641
710
  setState("input", { error: value });
642
711
  };
643
712
  const onInputHandler = (event) => {
644
- onInput({ input, event, error: errorHandler });
713
+ let value;
714
+ onInput({
715
+ input,
716
+ event,
717
+ error,
718
+ get value() {
719
+ if (value)
720
+ return value;
721
+ return value = escape(input.value);
722
+ }
723
+ });
645
724
  };
646
725
  const input = <input type="text" name="novely-input" required autocomplete="off" onInput={onInputHandler} />;
647
726
  if (setup)
@@ -719,7 +798,19 @@ var createSolidRenderer = () => {
719
798
  };
720
799
  },
721
800
  Novely(props) {
722
- return <div {...props} ref={root}><Provider storeData={options.$} options={options} renderer={renderer}><Switch fallback={<>No</>}>
801
+ createEffect3(() => {
802
+ const screen = state.screen;
803
+ if (fullscreen && document.fullscreenEnabled) {
804
+ if (screen === "game" && !document.fullscreenElement) {
805
+ document.documentElement.requestFullscreen().catch(() => {
806
+ });
807
+ } else if (screen === "mainmenu" && document.fullscreenElement && "exitFullscreen" in document) {
808
+ document.exitFullscreen().catch(() => {
809
+ });
810
+ }
811
+ }
812
+ });
813
+ return <div {...props} ref={root}><Provider storeData={options.$} options={options} renderer={renderer}><Switch>
723
814
  <Match when={state.screen === "game"}><Game state={state} setState={
724
815
  /* @once */
725
816
  setState
@@ -115,9 +115,16 @@ interface SolidRendererStore extends RendererStore {
115
115
  dialogRef?: HTMLParagraphElement;
116
116
  textRef?: HTMLParagraphElement;
117
117
  }
118
- declare const createSolidRenderer: () => {
118
+ interface CreateSolidRendererOptions {
119
+ /**
120
+ * Enter fullscreen mode when opening a game, exit when opening main-menu
121
+ * @default false
122
+ */
123
+ fullscreen?: boolean;
124
+ }
125
+ declare const createSolidRenderer: ({ fullscreen }?: CreateSolidRendererOptions) => {
119
126
  createRenderer(init: RendererInit): Renderer;
120
- Novely(props: Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element;
127
+ Novely(props: Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'ref'>): JSX.Element;
121
128
  };
122
129
  export { createSolidRenderer };
123
130
  export type { State, SolidRendererStore };
@@ -1,8 +1,8 @@
1
1
  /* src/styles/root/root.css */
2
2
  .root {
3
- height: 100vh;
4
3
  width: 100vw;
5
- font-size: 1em;
4
+ height: 100vh;
5
+ font-size: 1rem;
6
6
  font-family:
7
7
  ui-sans-serif,
8
8
  system-ui,
@@ -29,235 +29,14 @@
29
29
 
30
30
  /* src/styles/root/index.css */
31
31
 
32
- /* src/styles/main-menu/main-menu.css */
33
- .main-menu {
34
- overflow: hidden;
35
- background-image: var(--novely-main-menu-background-image);
36
- padding: 0 1em;
37
- display: grid;
38
- justify-content: start;
39
- align-content: center;
40
- }
41
-
42
- /* src/styles/main-menu/button/button.css */
43
- .main-menu__button {
44
- min-width: 30vw;
45
- }
46
-
47
- /* src/styles/main-menu/index.css */
48
-
49
- /* src/styles/loading/loading.css */
50
- .loading {
51
- overflow: hidden;
52
- background: black;
53
- display: flex;
54
- justify-content: center;
55
- align-items: center;
56
- }
57
-
58
- /* src/styles/loading/animation/animation.css */
59
- .loading__animation {
60
- display: inline-block;
61
- position: relative;
62
- width: 80px;
63
- height: 80px;
64
- }
65
- .loading__animation div {
66
- position: absolute;
67
- top: 33px;
68
- width: 13px;
69
- height: 13px;
70
- border-radius: 50%;
71
- background: #fff;
72
- animation-timing-function: cubic-bezier(0, 1, 1, 0);
73
- }
74
- .loading__animation div:nth-child(1) {
75
- left: 8px;
76
- animation: lds-ellipsis1 0.6s infinite;
77
- }
78
- .loading__animation div:nth-child(2) {
79
- left: 8px;
80
- animation: lds-ellipsis2 0.6s infinite;
81
- }
82
- .loading__animation div:nth-child(3) {
83
- left: 32px;
84
- animation: lds-ellipsis2 0.6s infinite;
85
- }
86
- .loading__animation div:nth-child(4) {
87
- left: 56px;
88
- animation: lds-ellipsis3 0.6s infinite;
89
- }
90
- @keyframes lds-ellipsis1 {
91
- 0% {
92
- transform: scale(0);
93
- }
94
- 100% {
95
- transform: scale(1);
96
- }
97
- }
98
- @keyframes lds-ellipsis3 {
99
- 0% {
100
- transform: scale(1);
101
- }
102
- 100% {
103
- transform: scale(0);
104
- }
105
- }
106
- @keyframes lds-ellipsis2 {
107
- 0% {
108
- transform: translate(0, 0);
109
- }
110
- 100% {
111
- transform: translate(24px, 0);
112
- }
113
- }
114
-
115
- /* src/styles/loading/index.css */
116
-
117
- /* src/styles/settings/settings.css */
118
- .settings {
119
- position: absolute;
120
- inset: 0;
121
- z-index: 1;
122
- padding: 0 1em;
123
- gap: 1em;
124
- overflow: hidden;
125
- background-image: var(--novely-settings-background-image);
126
- display: flex;
127
- }
128
- @media (orientation: portrait) {
129
- .settings {
130
- flex-direction: column-reverse;
131
- }
132
- }
133
-
134
- /* src/styles/settings/button/button.css */
135
- .settings__button {
136
- min-width: 30vw;
137
- }
138
- @media (orientation: portrait) {
139
- .settings__button {
140
- min-width: 80%;
141
- }
142
- }
143
-
144
- /* src/styles/settings/column/column.css */
145
- .settings__column {
146
- display: flex;
147
- align-items: center;
148
- justify-content: center;
149
- flex-direction: column;
150
- flex-wrap: wrap;
151
- }
152
-
153
- /* src/styles/settings/index.css */
154
-
155
- /* src/styles/saves/saves.css */
156
- .saves {
157
- position: absolute;
158
- inset: 0;
159
- z-index: 1;
160
- padding: 0 1em;
161
- gap: 1em;
162
- overflow: hidden;
163
- background-image: var(--novely-saves-background-image);
164
- display: flex;
165
- }
166
- @media (orientation: portrait) {
167
- .saves {
168
- flex-direction: column-reverse;
169
- }
170
- }
171
-
172
- /* src/styles/saves/button/button.css */
173
- .saves__button {
174
- min-width: 30vw;
175
- }
176
- .saves__button-load {
177
- width: 100%;
178
- touch-action: auto !important;
179
- }
180
- @media (orientation: portrait) {
181
- .saves__button {
182
- min-width: 80%;
183
- }
184
- }
185
-
186
- /* src/styles/saves/list/list.css */
187
- .saves__list-container {
188
- width: 100%;
189
- height: 100%;
190
- display: flex;
191
- align-items: center;
192
- justify-content: center;
193
- overflow: hidden;
194
- }
195
- .saves__list {
196
- width: 100%;
197
- height: 80%;
198
- padding: 0 1em;
199
- display: grid;
200
- align-content: flex-start;
201
- justify-content: center;
202
- justify-items: stretch;
203
- list-style: none;
204
- overflow-y: scroll;
205
- margin-block-start: 0;
206
- margin-block-end: 0;
207
- touch-action: auto !important;
208
- border-radius: var(--saves-list-border-radius, 14px);
209
- background-color: var(--saves-list-background-color, #ffffff57);
210
- }
211
- .saves__list::-webkit-scrollbar {
212
- width: 14px;
213
- }
214
- .saves__list::-webkit-scrollbar-track {
215
- background-color: #ffe9f3;
216
- border-radius: 7px;
217
- }
218
- .saves__list::-webkit-scrollbar-thumb {
219
- background-color: #ffc7df;
220
- border-radius: 7px;
221
- }
222
- .saves__list::-webkit-scrollbar-thumb:hover {
223
- background-color: #ffc6d8;
224
- }
225
- .saves__list:hover {
226
- scrollbar-color: #ffc6d8;
227
- }
228
- .saves__list-item {
229
- display: flex;
230
- }
231
- @media (orientation: portrait) {
232
- .saves__list {
233
- height: 100%;
234
- }
235
- .saves__list-container {
236
- margin-top: 1em;
237
- }
238
- }
239
-
240
- /* src/styles/saves/column/column.css */
241
- @media (orientation: portrait) {
242
- .saves__column {
243
- display: flex;
244
- align-items: center;
245
- justify-content: center;
246
- flex-direction: column;
247
- flex-wrap: wrap;
248
- }
249
- }
250
-
251
- /* src/styles/saves/index.css */
252
-
253
32
  /* src/styles/button/button.css */
254
33
  .button {
255
34
  background-color: var(--novely-button-background-color, #ffe9f3);
256
35
  border: 4px solid var(--novely-button-border-color, #ffc7df);
257
36
  color: var(--novely-button-color, #000);
258
- margin: 0.4em 0;
259
- padding: 0.4em;
260
- font-size: 1.02em;
37
+ margin: 0.4rem 0;
38
+ padding: 0.4rem;
39
+ font-size: 1.02rem;
261
40
  line-height: 1.2;
262
41
  cursor: pointer;
263
42
  user-select: none;
@@ -276,9 +55,8 @@
276
55
 
277
56
  /* src/styles/characters/characters.css */
278
57
  .characters {
279
- position: absolute;
280
- inset: 0;
281
- z-index: 1;
58
+ width: 100vw;
59
+ height: 100vh;
282
60
  overflow: hidden;
283
61
  display: flex;
284
62
  align-items: flex-end;
@@ -296,21 +74,38 @@
296
74
  /* src/styles/control-panel/control-panel.css */
297
75
  .control-panel {
298
76
  z-index: 23;
299
- position: absolute;
77
+ position: fixed;
300
78
  display: flex;
301
79
  justify-content: end;
302
- right: 0.4em;
303
- bottom: 0.4em;
80
+ right: 0.4rem;
81
+ bottom: 0.4rem;
304
82
  }
305
83
 
306
84
  /* src/styles/control-panel/button/button.css */
307
85
  .control-panel__button {
308
86
  border: 2px solid var(--novely-button-border-color, #ffc7df);
309
87
  margin: 0;
310
- padding: 0.2em 0.4em;
311
- font-size: 1em;
88
+ padding: 0.2rem 0.4rem;
89
+ font-size: 1rem;
312
90
  line-height: 1;
313
- height: 2em;
91
+ height: 2rem;
92
+ }
93
+ .control-panel__button__icon {
94
+ display: none;
95
+ }
96
+ @media (orientation: portrait) {
97
+ .control-panel__button__icon {
98
+ display: block;
99
+ }
100
+ .control-panel__button__content {
101
+ clip: rect(0 0 0 0);
102
+ clip-path: inset(50%);
103
+ height: 1px;
104
+ overflow: hidden;
105
+ position: absolute;
106
+ white-space: nowrap;
107
+ width: 1px;
108
+ }
314
109
  }
315
110
 
316
111
  /* src/styles/control-panel/index.css */
@@ -322,7 +117,8 @@
322
117
  z-index: 2;
323
118
  display: none;
324
119
  text-align: center;
325
- font-size: 1.5em;
120
+ font-size: 1.5rem;
121
+ user-select: none;
326
122
  }
327
123
  .action-text[data-shown=true] {
328
124
  display: flex;
@@ -334,6 +130,7 @@
334
130
  }
335
131
  .action-text[data-shown=true] > span {
336
132
  cursor: pointer;
133
+ user-select: none;
337
134
  }
338
135
 
339
136
  /* src/styles/action-text/index.css */
@@ -351,18 +148,18 @@
351
148
  background-color: var(--novely-select-background-color, #ffe9f3);
352
149
  border: 4px solid var(--novely-select-border-color, #ffc7df);
353
150
  color: var(--novely-select-color, #000);
354
- margin: 0.4em 0;
355
- padding: 0.4em;
356
- font-size: 1.02em;
151
+ margin: 0.4rem 0;
152
+ padding: 0.4rem;
153
+ font-size: 1.02rem;
357
154
  }
358
155
 
359
156
  /* src/styles/select/label/label.css */
360
157
  .select__label {
361
158
  background: var(--novely-select-label-background, #ffe9f3);
362
159
  color: var(--novely-select-color, #000);
363
- font-size: 1.02em;
364
- padding: 0.25em 0.5em;
365
- border-radius: 0.25em;
160
+ font-size: 1.02rem;
161
+ padding: 0.25rem 0.5rem;
162
+ border-radius: 0.25rem;
366
163
  }
367
164
 
368
165
  /* src/styles/select/index.css */
@@ -371,10 +168,10 @@
371
168
  .action-dialog {
372
169
  min-height: 26vh;
373
170
  width: 75%;
374
- position: absolute;
171
+ position: fixed;
375
172
  left: 50%;
376
173
  transform: translateX(-50%);
377
- bottom: 0.4em;
174
+ bottom: 0.4rem;
378
175
  z-index: 22;
379
176
  text-align: left;
380
177
  flex-direction: column;
@@ -396,7 +193,7 @@
396
193
  background-size: var(--novely-dialog-background-size, 100px 100px);
397
194
  display: flex;
398
195
  flex-wrap: nowrap;
399
- padding-bottom: 2.8em;
196
+ padding-bottom: 2.8rem;
400
197
  }
401
198
  .action-dialog-person {
402
199
  max-height: 25vh;
@@ -409,7 +206,7 @@
409
206
  margin: 0;
410
207
  }
411
208
  .action-dialog-name {
412
- font-size: 1.4375em;
209
+ font-size: 1.4375rem;
413
210
  line-height: 1.2;
414
211
  background: #ffffff;
415
212
  border-radius: 7px 7px 0 0;
@@ -420,7 +217,7 @@
420
217
  }
421
218
  .action-dialog-content {
422
219
  width: 100%;
423
- font-size: 2.2375em;
220
+ font-size: 2.2375rem;
424
221
  line-height: 1.2;
425
222
  text-shadow:
426
223
  1px 1px 0 black,
@@ -442,36 +239,35 @@
442
239
  transform: unset;
443
240
  }
444
241
  .action-dialog-name {
445
- font-size: 1.02em;
242
+ font-size: 1.02rem;
446
243
  }
447
244
  .action-dialog-content {
448
- font-size: 1.32em;
245
+ font-size: 1.32rem;
449
246
  }
450
247
  .action-dialog-container {
451
248
  border-radius: 14px 14px 0 0;
452
249
  }
453
- }
454
- @media only screen and (orientation: landscape) and (hover: none) and (pointer: coarse) {
455
250
  .action-dialog-content {
456
- font-size: 1.32em;
457
- line-height: 1.15;
251
+ text-shadow: none;
458
252
  }
459
253
  }
460
- @media only screen and (orientation: landscape) and (hover: hover) and (pointer: coarse) {
254
+ @media only screen and (orientation: landscape) and (pointer: coarse) {
461
255
  .action-dialog-content {
462
- font-size: 1.32em;
256
+ font-size: 1.32rem;
463
257
  line-height: 1.15;
464
258
  }
259
+ .action-dialog-content {
260
+ text-shadow: none;
261
+ }
465
262
  }
466
263
 
467
264
  /* src/styles/action-dialog/index.css */
468
265
 
469
266
  /* src/styles/dialog/dialog.css */
470
267
  .dialog {
471
- position: fixed;
268
+ position: absolute;
472
269
  inset: 0;
473
270
  z-index: 20;
474
- overflow-y: auto;
475
271
  }
476
272
  .dialog-container {
477
273
  min-height: 100vh;
@@ -490,25 +286,25 @@
490
286
  min-height: 40vh;
491
287
  min-width: 50vw;
492
288
  max-width: 100vw;
493
- padding-left: 0.25em;
494
- padding-right: 0.25em;
289
+ padding-left: 0.25rem;
290
+ padding-right: 0.25rem;
495
291
  display: flex;
496
292
  flex-direction: column;
497
293
  align-items: stretch;
498
294
  }
499
295
  .dialog-panel-label {
500
296
  user-select: none;
501
- font-size: 1.2375em;
297
+ font-size: 1.2375rem;
502
298
  }
503
299
  .dialog-panel-label[data-used=true] {
504
300
  background: var(--novely-dialog-panel-label-background, #ffe9f3);
505
301
  color: var(--novely-dialog-panel-label-color, #000);
506
- padding: 0.25em 0.5em;
507
- border-radius: 0.25em;
302
+ padding: 0.25rem 0.5rem;
303
+ border-radius: 0.25rem;
508
304
  }
509
305
  @media (orientation: portrait) {
510
306
  .dialog-panel {
511
- max-width: 95vw;
307
+ width: calc(100vw - 0.5rem);
512
308
  }
513
309
  }
514
310
 
@@ -520,12 +316,12 @@
520
316
  flex-direction: column;
521
317
  align-items: center;
522
318
  justify-content: center;
523
- font-size: 1.2375em;
319
+ font-size: 1.2375rem;
524
320
  width: 100%;
525
321
  }
526
322
  .input-dialog-label > span {
527
- margin: 0.4em 0;
528
- min-height: 1em;
323
+ margin: 0.4rem 0;
324
+ min-height: 1rem;
529
325
  min-height: 1lh;
530
326
  }
531
327
  .input-dialog-panel {
@@ -543,12 +339,245 @@
543
339
 
544
340
  /* src/styles/input-dialog/button/button.css */
545
341
  .dialog-input__button {
546
- font-size: 1.2375em;
547
- padding: 0.4em 0.6em;
342
+ font-size: 1.2375rem;
343
+ padding: 0.4rem 0.6rem;
548
344
  width: -moz-fit-content;
549
345
  width: fit-content;
550
346
  }
551
347
 
552
348
  /* src/styles/input-dialog/index.css */
553
349
 
350
+ /* src/styles/main-menu/main-menu.css */
351
+ .main-menu {
352
+ overflow: hidden;
353
+ background-image: var(--novely-main-menu-background-image);
354
+ padding: 0 1rem;
355
+ display: grid;
356
+ align-content: center;
357
+ }
358
+ @media (orientation: landscape) {
359
+ .main-menu {
360
+ justify-content: start;
361
+ }
362
+ }
363
+
364
+ /* src/styles/main-menu/button/button.css */
365
+ .main-menu__button {
366
+ min-width: 30vw;
367
+ }
368
+
369
+ /* src/styles/main-menu/index.css */
370
+
371
+ /* src/styles/loading/loading.css */
372
+ .loading {
373
+ overflow: hidden;
374
+ background: black;
375
+ display: flex;
376
+ justify-content: center;
377
+ align-items: center;
378
+ }
379
+
380
+ /* src/styles/loading/animation/animation.css */
381
+ .loading__animation {
382
+ display: inline-block;
383
+ position: relative;
384
+ width: 80px;
385
+ height: 80px;
386
+ }
387
+ .loading__animation div {
388
+ position: absolute;
389
+ top: 33px;
390
+ width: 13px;
391
+ height: 13px;
392
+ border-radius: 50%;
393
+ background: #fff;
394
+ animation-timing-function: cubic-bezier(0, 1, 1, 0);
395
+ }
396
+ .loading__animation div:nth-child(1) {
397
+ left: 8px;
398
+ animation: lds-ellipsis1 0.6s infinite;
399
+ }
400
+ .loading__animation div:nth-child(2) {
401
+ left: 8px;
402
+ animation: lds-ellipsis2 0.6s infinite;
403
+ }
404
+ .loading__animation div:nth-child(3) {
405
+ left: 32px;
406
+ animation: lds-ellipsis2 0.6s infinite;
407
+ }
408
+ .loading__animation div:nth-child(4) {
409
+ left: 56px;
410
+ animation: lds-ellipsis3 0.6s infinite;
411
+ }
412
+ @keyframes lds-ellipsis1 {
413
+ 0% {
414
+ transform: scale(0);
415
+ }
416
+ 100% {
417
+ transform: scale(1);
418
+ }
419
+ }
420
+ @keyframes lds-ellipsis3 {
421
+ 0% {
422
+ transform: scale(1);
423
+ }
424
+ 100% {
425
+ transform: scale(0);
426
+ }
427
+ }
428
+ @keyframes lds-ellipsis2 {
429
+ 0% {
430
+ transform: translate(0, 0);
431
+ }
432
+ 100% {
433
+ transform: translate(24px, 0);
434
+ }
435
+ }
436
+
437
+ /* src/styles/loading/index.css */
438
+
439
+ /* src/styles/settings/settings.css */
440
+ .settings {
441
+ padding: 0 1rem;
442
+ gap: 1rem;
443
+ overflow: hidden;
444
+ background-image: var(--novely-settings-background-image);
445
+ display: flex;
446
+ }
447
+ @media (orientation: portrait) {
448
+ .settings {
449
+ flex-direction: column-reverse;
450
+ }
451
+ }
452
+
453
+ /* src/styles/settings/button/button.css */
454
+ .settings__button {
455
+ min-width: 30vw;
456
+ }
457
+ @media (orientation: portrait) {
458
+ .settings__button {
459
+ min-width: 80%;
460
+ }
461
+ }
462
+
463
+ /* src/styles/settings/column/column.css */
464
+ .settings__column {
465
+ display: flex;
466
+ align-items: center;
467
+ justify-content: center;
468
+ flex-direction: column;
469
+ flex-wrap: wrap;
470
+ }
471
+
472
+ /* src/styles/settings/index.css */
473
+
474
+ /* src/styles/saves/saves.css */
475
+ .saves {
476
+ padding: 0 1rem;
477
+ gap: 1rem;
478
+ overflow: hidden;
479
+ background-image: var(--novely-saves-background-image);
480
+ display: flex;
481
+ }
482
+ @media (orientation: portrait) {
483
+ .saves {
484
+ flex-direction: column-reverse;
485
+ }
486
+ }
487
+
488
+ /* src/styles/saves/button/button.css */
489
+ .saves__button {
490
+ min-width: 30vw;
491
+ }
492
+ .saves__button-load {
493
+ width: 100%;
494
+ touch-action: auto !important;
495
+ }
496
+ .saves__button-load__type {
497
+ margin-left: 1rem;
498
+ }
499
+ @media (orientation: portrait) {
500
+ .saves__button {
501
+ min-width: 80%;
502
+ }
503
+ .saves__button-load {
504
+ margin-bottom: 0;
505
+ }
506
+ .saves__button-reset {
507
+ margin-top: 4px;
508
+ }
509
+ }
510
+
511
+ /* src/styles/saves/list/list.css */
512
+ .saves__list-container {
513
+ width: 100%;
514
+ height: 100%;
515
+ display: flex;
516
+ align-items: center;
517
+ justify-content: center;
518
+ overflow: hidden;
519
+ }
520
+ .saves__list {
521
+ width: 100%;
522
+ height: 80%;
523
+ padding: 0 1rem;
524
+ display: grid;
525
+ align-content: flex-start;
526
+ justify-content: center;
527
+ justify-items: stretch;
528
+ list-style: none;
529
+ overflow-y: scroll;
530
+ padding-inline-start: 0;
531
+ padding-inline-end: 0;
532
+ margin-block-start: 0;
533
+ margin-block-end: 0;
534
+ touch-action: auto !important;
535
+ border-radius: var(--saves-list-border-radius, 14px);
536
+ background-color: var(--saves-list-background-color, #ffffff57);
537
+ }
538
+ .saves__list::-webkit-scrollbar {
539
+ width: 14px;
540
+ }
541
+ .saves__list::-webkit-scrollbar-track {
542
+ background-color: #ffe9f3;
543
+ border-radius: 7px;
544
+ }
545
+ .saves__list::-webkit-scrollbar-thumb {
546
+ background-color: #ffc7df;
547
+ border-radius: 7px;
548
+ }
549
+ .saves__list::-webkit-scrollbar-thumb:hover {
550
+ background-color: #ffc6d8;
551
+ }
552
+ .saves__list:hover {
553
+ scrollbar-color: #ffc6d8;
554
+ }
555
+ .saves__list-item {
556
+ display: flex;
557
+ }
558
+ @media (orientation: portrait) {
559
+ .saves__list {
560
+ height: 100%;
561
+ }
562
+ .saves__list-container {
563
+ margin-top: 1rem;
564
+ }
565
+ .saves__list-item {
566
+ flex-direction: column;
567
+ }
568
+ }
569
+
570
+ /* src/styles/saves/column/column.css */
571
+ @media (orientation: portrait) {
572
+ .saves__column {
573
+ display: flex;
574
+ align-items: center;
575
+ justify-content: center;
576
+ flex-direction: column;
577
+ flex-wrap: wrap;
578
+ }
579
+ }
580
+
581
+ /* src/styles/saves/index.css */
582
+
554
583
  /* src/styles/index.css */
package/dist/utils.d.ts CHANGED
@@ -6,4 +6,5 @@ declare const createImage: (src: string) => HTMLImageElement;
6
6
  */
7
7
  declare const canvasDrawImages: (canvas: HTMLCanvasElement | undefined, ctx: CanvasRenderingContext2D | undefined, images: HTMLImageElement[]) => readonly [HTMLCanvasElement, CanvasRenderingContext2D];
8
8
  declare const url: <T extends string>(str: T) => `url(${T})`;
9
- export { isCSSImage, canvasDrawImages, url, createImage, capitalize };
9
+ declare const escape: (str: string) => string;
10
+ export { isCSSImage, canvasDrawImages, url, createImage, capitalize, escape };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.0.7",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"