@novely/solid-renderer 0.0.6 → 0.1.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 };
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,32 +131,127 @@ 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
- var b = () => Math.min(90 * Math.random() + 100, 90);
126
- var v = ({ node: N, text: m, ended: c, speed: T = b }) => {
127
- let e = document.createElement("span");
128
- e.innerHTML = m;
129
- let l = (t, M) => {
130
- let d = [];
131
- return t.childNodes.forEach((s) => {
132
- s.nodeName === "#text" && (d.push(s), M && (s.textContent = "")), d.push(...l(s, M));
133
- }), d;
134
- }, u = l(e.cloneNode(true), false).map((t) => [...t.textContent]), q = l(e, true);
135
- N.appendChild(e);
136
- let n = 0, a = 0, r = false, p, i = () => {
137
- p = requestAnimationFrame(x);
138
- }, o = () => {
139
- cancelAnimationFrame(p);
140
- }, f = 0, h = 0, x = (t) => {
141
- t >= h + f ? (h = t, f = T(), C()) : r ? o() : i();
142
- }, C = () => {
143
- u[n]?.length > a ? (q[n].textContent += u[n][a++], i()) : n++ < u.length ? (a = 0, i()) : (r = true, o(), c && c());
158
+ var defaultSpeed = () => {
159
+ return Math.min(90 * Math.random() + 100, 90);
160
+ };
161
+ var collectTextNodes = (el) => {
162
+ const items = [];
163
+ el.childNodes.forEach((child) => {
164
+ if (child.nodeName === "#text")
165
+ items.push(child);
166
+ else
167
+ items.push(...collectTextNodes(child));
168
+ });
169
+ return items;
170
+ };
171
+ var typewriter = ({ node, text, ended, speed = defaultSpeed }) => {
172
+ node.innerHTML = text;
173
+ const nodes = collectTextNodes(node).map((child) => {
174
+ const letters = [...child.textContent].map((char) => {
175
+ const text2 = document.createElement("span");
176
+ if (char === " ") {
177
+ text2.innerHTML = "&#8197;";
178
+ } else {
179
+ text2.textContent = char;
180
+ }
181
+ text2.style.opacity = "0";
182
+ return text2;
183
+ });
184
+ child.replaceWith(...letters);
185
+ return letters;
186
+ });
187
+ let current = 0;
188
+ let pos = 0;
189
+ let end = false;
190
+ let frame;
191
+ const enqueue = () => {
192
+ frame = requestAnimationFrame(queue);
193
+ };
194
+ const dequeue = () => {
195
+ cancelAnimationFrame(frame);
196
+ };
197
+ let timeout = 0;
198
+ let start = 0;
199
+ let container;
200
+ const queue = (time) => {
201
+ if (time >= start + timeout) {
202
+ start = time;
203
+ timeout = speed();
204
+ process();
205
+ } else if (!end) {
206
+ enqueue();
207
+ } else {
208
+ dequeue();
209
+ }
210
+ };
211
+ const process = () => {
212
+ const block = nodes[current];
213
+ if (block?.length > pos) {
214
+ const span = block[pos];
215
+ const text2 = span.textContent;
216
+ if (pos++ === 0) {
217
+ span.replaceWith(container = document.createTextNode(text2));
218
+ } else {
219
+ container.textContent += text2;
220
+ span.remove();
221
+ }
222
+ enqueue();
223
+ } else if (current++ < nodes.length) {
224
+ pos = 0;
225
+ enqueue();
226
+ } else {
227
+ end = true;
228
+ dequeue();
229
+ ended && ended();
230
+ }
231
+ };
232
+ process();
233
+ return {
234
+ /**
235
+ * End
236
+ */
237
+ end() {
238
+ dequeue();
239
+ if (end) {
240
+ node.innerHTML = "";
241
+ return end;
242
+ }
243
+ node.innerHTML = text.replace(/ /gm, "&#8197;");
244
+ end = true;
245
+ return false;
246
+ },
247
+ /**
248
+ * Destroy
249
+ */
250
+ destroy() {
251
+ dequeue();
252
+ node.innerHTML = "";
253
+ }
144
254
  };
145
- return C(), { end() {
146
- return o(), r ? (e.remove(), true) : (e.innerHTML = m, r = true, false);
147
- }, destroy() {
148
- o(), e.remove();
149
- } };
150
255
  };
151
256
 
152
257
  // src/screens/game.tsx
@@ -172,7 +277,9 @@ var Game = (props) => {
172
277
  writer?.destroy();
173
278
  if (!element)
174
279
  return;
175
- writer = v({
280
+ if (!text)
281
+ return;
282
+ writer = typewriter({
176
283
  node: element,
177
284
  text,
178
285
  ended() {
@@ -243,7 +350,7 @@ var Game = (props) => {
243
350
  const [canvas] = canvasDrawImages(void 0, void 0, Object.values(image));
244
351
  return canvas;
245
352
  }}</Show2></div>
246
- <p class="action-dialog-content" ref={store.dialogRef}> </p>
353
+ <p class="action-dialog-content" ref={store.dialogRef} />
247
354
  </div>
248
355
  </div>
249
356
  <Modal
@@ -292,26 +399,32 @@ var Game = (props) => {
292
399
  </div>
293
400
  </div></Modal>
294
401
  <div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
295
- <div class="action-text" data-shown={Boolean(props.state.text.content)} ref={store.textRef} onClick={clearTypewriterEffect}> </div>
402
+ <div class="action-text" data-shown={Boolean(props.state.text.content)} onClick={clearTypewriterEffect}><span ref={store.textRef} /></div>
296
403
  <div class="control-panel">
297
404
  <button
298
405
  type="button"
299
406
  class="button control-panel__button"
300
- onClick={() => {
301
- data.options.stack.back();
302
- data.options.restore(data.options.stack.value);
303
- }}
304
- >{data.t("GoBack")}</button>
407
+ title={data.t("GoBack")}
408
+ onClick={data.options.back}
409
+ >
410
+ <span class="control-panel__button__content">{data.t("GoBack")}</span>
411
+ <Icon class="control-panel__button__icon" children={Icon.Back()} />
412
+ </button>
305
413
  <button
306
414
  type="button"
307
415
  class="button control-panel__button"
416
+ title={data.t("DoSave")}
308
417
  onClick={() => {
309
418
  data.options.save(false, "manual");
310
419
  }}
311
- >{data.t("DoSave")}</button>
420
+ >
421
+ <span class="control-panel__button__content">{data.t("DoSave")}</span>
422
+ <Icon class="control-panel__button__icon" children={Icon.Save()} />
423
+ </button>
312
424
  <button
313
425
  type="button"
314
426
  class="button control-panel__button"
427
+ title={data.t(auto() ? "Stop" : "Auto")}
315
428
  onClick={() => {
316
429
  setAuto((prev) => !prev);
317
430
  }}
@@ -319,16 +432,24 @@ var Game = (props) => {
319
432
  <button
320
433
  type="button"
321
434
  class="button control-panel__button"
435
+ title={data.t("Settings")}
322
436
  onClick={() => {
323
437
  data.options.save(false, "auto");
324
438
  props.setState("screen", "settings");
325
439
  }}
326
- >{data.t("Settings")}</button>
440
+ >
441
+ <span class="control-panel__button__content">{data.t("Settings")}</span>
442
+ <Icon class="control-panel__button__icon" children={Icon.Settings()} />
443
+ </button>
327
444
  <button
328
445
  type="button"
329
446
  class="button control-panel__button"
447
+ title={data.t("Exit")}
330
448
  onClick={data.options.exit}
331
- >{data.t("Exit")}</button>
449
+ >
450
+ <span class="control-panel__button__content">{data.t("Exit")}</span>
451
+ <Icon class="control-panel__button__icon" children={Icon.Exit()} />
452
+ </button>
332
453
  </div>
333
454
  </div>;
334
455
  };
@@ -376,9 +497,14 @@ var Saves = (props) => {
376
497
  onClick={() => data.options.set(save)}
377
498
  >
378
499
  {stringDate}
379
- <span style={{ "margin-left": "1em" }}>{stringType}</span>
500
+ <span class="saves__button-load__type">{stringType}</span>
380
501
  </button>
381
- <button type="reset" class="button" aria-label={data.t("DeleteASaveFrom") + " " + stringDate} onClick={[removeSave, date]}><span>{data.t("Remove")}</span></button>
502
+ <button
503
+ type="reset"
504
+ class="button saves__button-reset"
505
+ aria-label={data.t("DeleteASaveFrom") + " " + stringDate}
506
+ onClick={[removeSave, date]}
507
+ ><span>{data.t("Remove")}</span></button>
382
508
  </li>;
383
509
  }}</For2></ol></Show3></div>
384
510
  </div>;
@@ -436,7 +562,7 @@ var Loading = () => {
436
562
  };
437
563
 
438
564
  // src/renderer.tsx
439
- var createSolidRenderer = () => {
565
+ var createSolidRenderer = ({ fullscreen = false } = {}) => {
440
566
  const [state, setState] = createStore({
441
567
  background: "",
442
568
  characters: {},
@@ -488,22 +614,26 @@ var createSolidRenderer = () => {
488
614
  ctx,
489
615
  emotions: {},
490
616
  withEmotion(emotion) {
491
- const stored = store.characters[character].emotions[emotion];
617
+ const stored = this.emotions[emotion];
492
618
  const render = (...images) => {
493
619
  return () => {
494
620
  canvasDrawImages(canvas, ctx, images);
495
621
  };
496
622
  };
497
- if (stored)
498
- return render(..."head" in stored ? [stored.head, stored.left, stored.right] : [stored]);
623
+ if (stored) {
624
+ if (stored instanceof HTMLImageElement) {
625
+ return render(stored);
626
+ }
627
+ return render(...Object.values(stored));
628
+ }
499
629
  const emotionData = characters[character].emotions[emotion];
500
630
  if (typeof emotionData === "string") {
501
- return render(store.characters[character].emotions[emotion] = createImage(emotionData));
631
+ return render(this.emotions[emotion] = createImage(emotionData));
502
632
  }
503
633
  const head = createImage(emotionData.head);
504
634
  const left = createImage(emotionData.body.left);
505
635
  const right = createImage(emotionData.body.right);
506
- store.characters[character].emotions[emotion] = {
636
+ this.emotions[emotion] = {
507
637
  head,
508
638
  left,
509
639
  right
@@ -550,7 +680,8 @@ var createSolidRenderer = () => {
550
680
  },
551
681
  clear(goingBack) {
552
682
  return (resolve) => {
553
- setState("background", "#000");
683
+ if (!goingBack)
684
+ setState("background", "#000");
554
685
  setState("choices", { choices: [], visible: false, resolve: void 0, question: "" });
555
686
  setState("input", { element: void 0, question: "", visible: false });
556
687
  setState("dialog", { visible: false, content: "", name: "" });
@@ -570,11 +701,21 @@ var createSolidRenderer = () => {
570
701
  },
571
702
  input(question, onInput, setup) {
572
703
  return (resolve) => {
573
- const errorHandler = (value) => {
704
+ const error = (value) => {
574
705
  setState("input", { error: value });
575
706
  };
576
707
  const onInputHandler = (event) => {
577
- onInput({ input, event, error: errorHandler });
708
+ let value;
709
+ onInput({
710
+ input,
711
+ event,
712
+ error,
713
+ get value() {
714
+ if (value)
715
+ return value;
716
+ return value = escape(input.value);
717
+ }
718
+ });
578
719
  };
579
720
  const input = <input type="text" name="novely-input" required autocomplete="off" onInput={onInputHandler} />;
580
721
  if (setup)
@@ -652,7 +793,19 @@ var createSolidRenderer = () => {
652
793
  };
653
794
  },
654
795
  Novely(props) {
655
- return <div {...props} ref={root}><Provider storeData={options.$} options={options} renderer={renderer}><Switch fallback={<>No</>}>
796
+ createEffect3(() => {
797
+ const screen = state.screen;
798
+ if (fullscreen && document.fullscreenEnabled) {
799
+ if (screen === "game" && !document.fullscreenElement) {
800
+ document.documentElement.requestFullscreen().catch(() => {
801
+ });
802
+ } else if (screen === "mainmenu" && document.fullscreenElement && "exitFullscreen" in document) {
803
+ document.exitFullscreen().catch(() => {
804
+ });
805
+ }
806
+ }
807
+ });
808
+ return <div {...props} ref={root}><Provider storeData={options.$} options={options} renderer={renderer}><Switch>
656
809
  <Match when={state.screen === "game"}><Game state={state} setState={
657
810
  /* @once */
658
811
  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;
@@ -394,17 +191,13 @@
394
191
  background-color: var(--novely-dialog-background-color, #f092b4d8);
395
192
  background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
396
193
  background-size: var(--novely-dialog-background-size, 100px 100px);
397
- display: grid;
398
- grid-template-areas: "pers text" "pers text";
399
- padding-bottom: 2.8em;
400
- }
401
- .action-dialog-container[data-no-person=true] {
402
- grid-template-areas: "text text" "text text";
194
+ display: flex;
195
+ flex-wrap: nowrap;
196
+ padding-bottom: 2.8rem;
403
197
  }
404
198
  .action-dialog-person {
405
199
  max-height: 25vh;
406
200
  max-width: 25vw;
407
- grid-area: pers;
408
201
  }
409
202
  .action-dialog-name,
410
203
  .action-dialog-content {
@@ -413,7 +206,7 @@
413
206
  margin: 0;
414
207
  }
415
208
  .action-dialog-name {
416
- font-size: 1.4375em;
209
+ font-size: 1.4375rem;
417
210
  line-height: 1.2;
418
211
  background: #ffffff;
419
212
  border-radius: 7px 7px 0 0;
@@ -423,10 +216,9 @@
423
216
  box-shadow: 1px 1px 3px #00000042;
424
217
  }
425
218
  .action-dialog-content {
426
- font-size: 2.2375em;
427
- line-height: 1.2;
428
219
  width: 100%;
429
- grid-area: text;
220
+ font-size: 2.2375rem;
221
+ line-height: 1.2;
430
222
  text-shadow:
431
223
  1px 1px 0 black,
432
224
  -1px -1px 0 black,
@@ -435,7 +227,9 @@
435
227
  }
436
228
  .action-dialog-person > canvas,
437
229
  .action-dialog-person > img {
438
- height: 100%;
230
+ max-height: 100%;
231
+ max-width: 100%;
232
+ object-fit: contain;
439
233
  }
440
234
  @media (orientation: portrait) {
441
235
  .action-dialog {
@@ -445,36 +239,35 @@
445
239
  transform: unset;
446
240
  }
447
241
  .action-dialog-name {
448
- font-size: 1.02em;
242
+ font-size: 1.02rem;
449
243
  }
450
244
  .action-dialog-content {
451
- font-size: 1.32em;
245
+ font-size: 1.32rem;
452
246
  }
453
247
  .action-dialog-container {
454
248
  border-radius: 14px 14px 0 0;
455
249
  }
456
- }
457
- @media only screen and (orientation: landscape) and (hover: none) and (pointer: coarse) {
458
250
  .action-dialog-content {
459
- font-size: 1.32em;
460
- line-height: 1.15;
251
+ text-shadow: none;
461
252
  }
462
253
  }
463
- @media only screen and (orientation: landscape) and (hover: hover) and (pointer: coarse) {
254
+ @media only screen and (orientation: landscape) and (pointer: coarse) {
464
255
  .action-dialog-content {
465
- font-size: 1.32em;
256
+ font-size: 1.32rem;
466
257
  line-height: 1.15;
467
258
  }
259
+ .action-dialog-content {
260
+ text-shadow: none;
261
+ }
468
262
  }
469
263
 
470
264
  /* src/styles/action-dialog/index.css */
471
265
 
472
266
  /* src/styles/dialog/dialog.css */
473
267
  .dialog {
474
- position: fixed;
268
+ position: absolute;
475
269
  inset: 0;
476
270
  z-index: 20;
477
- overflow-y: auto;
478
271
  }
479
272
  .dialog-container {
480
273
  min-height: 100vh;
@@ -493,25 +286,25 @@
493
286
  min-height: 40vh;
494
287
  min-width: 50vw;
495
288
  max-width: 100vw;
496
- padding-left: 0.25em;
497
- padding-right: 0.25em;
289
+ padding-left: 0.25rem;
290
+ padding-right: 0.25rem;
498
291
  display: flex;
499
292
  flex-direction: column;
500
293
  align-items: stretch;
501
294
  }
502
295
  .dialog-panel-label {
503
296
  user-select: none;
504
- font-size: 1.2375em;
297
+ font-size: 1.2375rem;
505
298
  }
506
299
  .dialog-panel-label[data-used=true] {
507
300
  background: var(--novely-dialog-panel-label-background, #ffe9f3);
508
301
  color: var(--novely-dialog-panel-label-color, #000);
509
- padding: 0.25em 0.5em;
510
- border-radius: 0.25em;
302
+ padding: 0.25rem 0.5rem;
303
+ border-radius: 0.25rem;
511
304
  }
512
305
  @media (orientation: portrait) {
513
306
  .dialog-panel {
514
- max-width: 95vw;
307
+ width: calc(100vw - 0.5rem);
515
308
  }
516
309
  }
517
310
 
@@ -523,12 +316,12 @@
523
316
  flex-direction: column;
524
317
  align-items: center;
525
318
  justify-content: center;
526
- font-size: 1.2375em;
319
+ font-size: 1.2375rem;
527
320
  width: 100%;
528
321
  }
529
322
  .input-dialog-label > span {
530
- margin: 0.4em 0;
531
- min-height: 1em;
323
+ margin: 0.4rem 0;
324
+ min-height: 1rem;
532
325
  min-height: 1lh;
533
326
  }
534
327
  .input-dialog-panel {
@@ -546,12 +339,245 @@
546
339
 
547
340
  /* src/styles/input-dialog/button/button.css */
548
341
  .dialog-input__button {
549
- font-size: 1.2375em;
550
- padding: 0.4em 0.6em;
342
+ font-size: 1.2375rem;
343
+ padding: 0.4rem 0.6rem;
551
344
  width: -moz-fit-content;
552
345
  width: fit-content;
553
346
  }
554
347
 
555
348
  /* src/styles/input-dialog/index.css */
556
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
+
557
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.6",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"