@novely/solid-renderer 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +6 -0
- package/dist/index.jsx +219 -179
- package/dist/screens/index.d.ts +6 -0
- package/dist/styles/index.css +5 -8
- package/dist/utils.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.jsx
CHANGED
|
@@ -48,6 +48,20 @@ var onKey = (cb, ...keys) => {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
+
var toMedia = (media) => {
|
|
52
|
+
if (media === "portrait" || media === "landscape") {
|
|
53
|
+
return `(orientation: ${media})`;
|
|
54
|
+
}
|
|
55
|
+
return media;
|
|
56
|
+
};
|
|
57
|
+
var findLast = (array, fn) => {
|
|
58
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
59
|
+
if (fn(array[i])) {
|
|
60
|
+
return array[i];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
};
|
|
51
65
|
|
|
52
66
|
// src/context/index.tsx
|
|
53
67
|
import { from, createContext, useContext, Show } from "solid-js";
|
|
@@ -89,8 +103,114 @@ var useData = () => {
|
|
|
89
103
|
return useContext(Context);
|
|
90
104
|
};
|
|
91
105
|
|
|
106
|
+
// src/screens/custom-screen.tsx
|
|
107
|
+
import { createEffect, createSignal as createSignal2, Show as Show2 } from "solid-js";
|
|
108
|
+
var CustomScreen = (props) => {
|
|
109
|
+
const [dom, setDOM] = createSignal2(null);
|
|
110
|
+
let unmount;
|
|
111
|
+
createEffect(() => {
|
|
112
|
+
if (unmount)
|
|
113
|
+
unmount();
|
|
114
|
+
if (props.state.screen in props.state.screens) {
|
|
115
|
+
const current = props.state.screens[props.state.screen]();
|
|
116
|
+
setDOM(current.mount());
|
|
117
|
+
unmount = current.unmount;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
setDOM(null);
|
|
121
|
+
unmount = void 0;
|
|
122
|
+
});
|
|
123
|
+
const onClick = ({ target }) => {
|
|
124
|
+
if (target instanceof HTMLElement && target.dataset.novelyGoto) {
|
|
125
|
+
props.setState("screen", target.dataset.novelyGoto);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return <Show2 when={dom()}><div class="root custom" onClick={onClick}>{dom()}</div></Show2>;
|
|
129
|
+
};
|
|
130
|
+
|
|
92
131
|
// src/screens/game.tsx
|
|
93
|
-
import { createSignal as
|
|
132
|
+
import { createSignal as createSignal4, untrack as untrack3, For, Show as Show5, createUniqueId, createEffect as createEffect4 } from "solid-js";
|
|
133
|
+
|
|
134
|
+
// src/components/Character.tsx
|
|
135
|
+
import { setAttribute, effect } from "solid-js/web";
|
|
136
|
+
var Character = (props) => {
|
|
137
|
+
const canvas = () => props.characters[props.character].canvas;
|
|
138
|
+
effect(() => setAttribute(canvas(), "style", props.data.style));
|
|
139
|
+
return <>{canvas()}</>;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/components/ControlPanelButtons.tsx
|
|
143
|
+
import { Show as Show3 } from "solid-js";
|
|
144
|
+
var ControlPanelButtons = (props) => {
|
|
145
|
+
const data = useData();
|
|
146
|
+
return <>
|
|
147
|
+
<button
|
|
148
|
+
role="menuitem"
|
|
149
|
+
type="button"
|
|
150
|
+
class="button control-panel__button"
|
|
151
|
+
title={data.t("GoBack")}
|
|
152
|
+
onClick={data.options.back}
|
|
153
|
+
>
|
|
154
|
+
<span class="control-panel__button__content">{data.t("GoBack")}</span>
|
|
155
|
+
<Icon class="control-panel__button__icon" children={Icon.Back()} />
|
|
156
|
+
</button>
|
|
157
|
+
<button
|
|
158
|
+
role="menuitem"
|
|
159
|
+
type="button"
|
|
160
|
+
class="button control-panel__button"
|
|
161
|
+
title={data.t("DoSave")}
|
|
162
|
+
onClick={() => {
|
|
163
|
+
data.options.save(false, "manual");
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
<span class="control-panel__button__content">{data.t("DoSave")}</span>
|
|
167
|
+
<Icon class="control-panel__button__icon" children={Icon.Save()} />
|
|
168
|
+
</button>
|
|
169
|
+
<button
|
|
170
|
+
role="menuitem"
|
|
171
|
+
type="button"
|
|
172
|
+
class="button control-panel__button control-panel__button--auto-mode"
|
|
173
|
+
title={data.t(props.auto() ? "Stop" : "Auto")}
|
|
174
|
+
onClick={() => {
|
|
175
|
+
props.setAuto((prev) => !prev);
|
|
176
|
+
}}
|
|
177
|
+
>{data.t(props.auto() ? "Stop" : "Auto")}</button>
|
|
178
|
+
<button
|
|
179
|
+
role="menuitem"
|
|
180
|
+
type="button"
|
|
181
|
+
class="button control-panel__button"
|
|
182
|
+
title={data.t("Settings")}
|
|
183
|
+
onClick={() => {
|
|
184
|
+
data.options.save(false, "auto");
|
|
185
|
+
props.openSettings();
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
<span class="control-panel__button__content">{data.t("Settings")}</span>
|
|
189
|
+
<Icon class="control-panel__button__icon" children={Icon.Settings()} />
|
|
190
|
+
</button>
|
|
191
|
+
<button
|
|
192
|
+
role="menuitem"
|
|
193
|
+
type="button"
|
|
194
|
+
class="button control-panel__button"
|
|
195
|
+
title={data.t("Exit")}
|
|
196
|
+
onClick={() => {
|
|
197
|
+
data.options.exit();
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<span class="control-panel__button__content">{data.t("Exit")}</span>
|
|
201
|
+
<Icon class="control-panel__button__icon" children={Icon.Exit()} />
|
|
202
|
+
</button>
|
|
203
|
+
<Show3 when={data.media.hyperWide()}><button
|
|
204
|
+
role="menuitem"
|
|
205
|
+
type="button"
|
|
206
|
+
class="button control-panel__button"
|
|
207
|
+
title={data.t("CloseMenu")}
|
|
208
|
+
onClick={() => {
|
|
209
|
+
props.closeDropdown();
|
|
210
|
+
}}
|
|
211
|
+
><Icon children={Icon.Close()} /></button></Show3>
|
|
212
|
+
</>;
|
|
213
|
+
};
|
|
94
214
|
|
|
95
215
|
// src/components/DialogName.tsx
|
|
96
216
|
var DialogName = (props) => {
|
|
@@ -109,16 +229,47 @@ var DialogName = (props) => {
|
|
|
109
229
|
>{props.name || <> </>}</span>;
|
|
110
230
|
};
|
|
111
231
|
|
|
112
|
-
// src/components/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
232
|
+
// src/components/Icon.tsx
|
|
233
|
+
var Icon = (props) => {
|
|
234
|
+
return <svg
|
|
235
|
+
width="24"
|
|
236
|
+
height="24"
|
|
237
|
+
viewBox="0 0 24 24"
|
|
238
|
+
fill="none"
|
|
239
|
+
stroke="currentColor"
|
|
240
|
+
stroke-linecap="round"
|
|
241
|
+
stroke-linejoin="round"
|
|
242
|
+
stroke-width="1.5"
|
|
243
|
+
{...props}
|
|
244
|
+
>{props.children}</svg>;
|
|
245
|
+
};
|
|
246
|
+
Icon.Back = () => {
|
|
247
|
+
return <path d="m9.75 12 8.5-6.25v12.5L9.75 12ZM5.75 5.75v12.5" />;
|
|
248
|
+
};
|
|
249
|
+
Icon.Save = () => {
|
|
250
|
+
return <>
|
|
251
|
+
<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" />
|
|
252
|
+
<path d="M8.75 19v-3.25a1 1 0 0 1 1-1h4.5a1 1 0 0 1 1 1V19M8.75 5v3.25" />
|
|
253
|
+
</>;
|
|
254
|
+
};
|
|
255
|
+
Icon.Settings = () => {
|
|
256
|
+
return <>
|
|
257
|
+
<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" />
|
|
258
|
+
<path d="M13.25 12a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z" />
|
|
259
|
+
</>;
|
|
260
|
+
};
|
|
261
|
+
Icon.Exit = () => {
|
|
262
|
+
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" />;
|
|
263
|
+
};
|
|
264
|
+
Icon.Menu = () => {
|
|
265
|
+
return <path d="M4.75 5.75h14.5M4.75 18.25h14.5M4.75 12h14.5" />;
|
|
266
|
+
};
|
|
267
|
+
Icon.Close = () => {
|
|
268
|
+
return <path d="m17.25 6.75-10.5 10.5M6.75 6.75l10.5 10.5" />;
|
|
118
269
|
};
|
|
119
270
|
|
|
120
271
|
// src/components/Modal.tsx
|
|
121
|
-
import { untrack, createEffect, on, onCleanup as onCleanup3, Show as
|
|
272
|
+
import { untrack, createEffect as createEffect2, on, onCleanup as onCleanup3, Show as Show4 } from "solid-js";
|
|
122
273
|
|
|
123
274
|
// src/actions.ts
|
|
124
275
|
import { onCleanup as onCleanup2 } from "solid-js";
|
|
@@ -154,10 +305,10 @@ var Modal = (props) => {
|
|
|
154
305
|
props.setIsOpen && props.setIsOpen(false);
|
|
155
306
|
props.onClose && untrack(props.onClose);
|
|
156
307
|
};
|
|
157
|
-
|
|
308
|
+
createEffect2(on(props.isOpen, (isOpen) => isOpen && props.onClose && untrack(props.onClose), { defer: true }));
|
|
158
309
|
addEventListener("keydown", handleKeydown);
|
|
159
310
|
onCleanup3(() => removeEventListener("keydown", handleKeydown));
|
|
160
|
-
return <
|
|
311
|
+
return <Show4 when={props.isOpen()}><div
|
|
161
312
|
role="dialog"
|
|
162
313
|
class="dialog"
|
|
163
314
|
aria-modal={true}
|
|
@@ -165,50 +316,11 @@ var Modal = (props) => {
|
|
|
165
316
|
modalWindow = element;
|
|
166
317
|
clickOutside(element, close);
|
|
167
318
|
}}
|
|
168
|
-
>{props.children}</div></
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
// src/components/Icon.tsx
|
|
172
|
-
var Icon = (props) => {
|
|
173
|
-
return <svg
|
|
174
|
-
width="24"
|
|
175
|
-
height="24"
|
|
176
|
-
viewBox="0 0 24 24"
|
|
177
|
-
fill="none"
|
|
178
|
-
stroke="currentColor"
|
|
179
|
-
stroke-linecap="round"
|
|
180
|
-
stroke-linejoin="round"
|
|
181
|
-
stroke-width="1.5"
|
|
182
|
-
{...props}
|
|
183
|
-
>{props.children}</svg>;
|
|
184
|
-
};
|
|
185
|
-
Icon.Back = () => {
|
|
186
|
-
return <path d="m9.75 12 8.5-6.25v12.5L9.75 12ZM5.75 5.75v12.5" />;
|
|
187
|
-
};
|
|
188
|
-
Icon.Save = () => {
|
|
189
|
-
return <>
|
|
190
|
-
<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" />
|
|
191
|
-
<path d="M8.75 19v-3.25a1 1 0 0 1 1-1h4.5a1 1 0 0 1 1 1V19M8.75 5v3.25" />
|
|
192
|
-
</>;
|
|
193
|
-
};
|
|
194
|
-
Icon.Settings = () => {
|
|
195
|
-
return <>
|
|
196
|
-
<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" />
|
|
197
|
-
<path d="M13.25 12a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z" />
|
|
198
|
-
</>;
|
|
199
|
-
};
|
|
200
|
-
Icon.Exit = () => {
|
|
201
|
-
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" />;
|
|
202
|
-
};
|
|
203
|
-
Icon.Menu = () => {
|
|
204
|
-
return <path d="M4.75 5.75h14.5M4.75 18.25h14.5M4.75 12h14.5" />;
|
|
205
|
-
};
|
|
206
|
-
Icon.Close = () => {
|
|
207
|
-
return <path d="m17.25 6.75-10.5 10.5M6.75 6.75l10.5 10.5" />;
|
|
319
|
+
>{props.children}</div></Show4>;
|
|
208
320
|
};
|
|
209
321
|
|
|
210
322
|
// src/components/Typewriter.tsx
|
|
211
|
-
import { untrack as untrack2, createEffect as
|
|
323
|
+
import { untrack as untrack2, createEffect as createEffect3, onCleanup as onCleanup4, createSignal as createSignal3 } from "solid-js";
|
|
212
324
|
|
|
213
325
|
// ../typewriter/dist/index.js
|
|
214
326
|
var defaultSpeed = () => {
|
|
@@ -334,10 +446,10 @@ var PRM = matchMedia("(prefers-reduced-motion: reduce)");
|
|
|
334
446
|
var createTypewriter = ({ resolve }) => {
|
|
335
447
|
let bypassed = false;
|
|
336
448
|
let typewriter2;
|
|
337
|
-
const [state, setState] =
|
|
449
|
+
const [state, setState] = createSignal3("idle");
|
|
338
450
|
const Typewriter = (props) => {
|
|
339
451
|
let node;
|
|
340
|
-
|
|
452
|
+
createEffect3(() => {
|
|
341
453
|
const text = props.content;
|
|
342
454
|
typewriter2?.destroy();
|
|
343
455
|
setState("idle");
|
|
@@ -388,79 +500,6 @@ var createTypewriter = ({ resolve }) => {
|
|
|
388
500
|
};
|
|
389
501
|
};
|
|
390
502
|
|
|
391
|
-
// src/components/ControlPanelButtons.tsx
|
|
392
|
-
import { Show as Show3 } from "solid-js";
|
|
393
|
-
var ControlPanelButtons = (props) => {
|
|
394
|
-
const data = useData();
|
|
395
|
-
return <>
|
|
396
|
-
<button
|
|
397
|
-
role="menuitem"
|
|
398
|
-
type="button"
|
|
399
|
-
class="button control-panel__button"
|
|
400
|
-
title={data.t("GoBack")}
|
|
401
|
-
onClick={data.options.back}
|
|
402
|
-
>
|
|
403
|
-
<span class="control-panel__button__content">{data.t("GoBack")}</span>
|
|
404
|
-
<Icon class="control-panel__button__icon" children={Icon.Back()} />
|
|
405
|
-
</button>
|
|
406
|
-
<button
|
|
407
|
-
role="menuitem"
|
|
408
|
-
type="button"
|
|
409
|
-
class="button control-panel__button"
|
|
410
|
-
title={data.t("DoSave")}
|
|
411
|
-
onClick={() => {
|
|
412
|
-
data.options.save(false, "manual");
|
|
413
|
-
}}
|
|
414
|
-
>
|
|
415
|
-
<span class="control-panel__button__content">{data.t("DoSave")}</span>
|
|
416
|
-
<Icon class="control-panel__button__icon" children={Icon.Save()} />
|
|
417
|
-
</button>
|
|
418
|
-
<button
|
|
419
|
-
role="menuitem"
|
|
420
|
-
type="button"
|
|
421
|
-
class="button control-panel__button control-panel__button--auto-mode"
|
|
422
|
-
title={data.t(props.auto() ? "Stop" : "Auto")}
|
|
423
|
-
onClick={() => {
|
|
424
|
-
props.setAuto((prev) => !prev);
|
|
425
|
-
}}
|
|
426
|
-
>{data.t(props.auto() ? "Stop" : "Auto")}</button>
|
|
427
|
-
<button
|
|
428
|
-
role="menuitem"
|
|
429
|
-
type="button"
|
|
430
|
-
class="button control-panel__button"
|
|
431
|
-
title={data.t("Settings")}
|
|
432
|
-
onClick={() => {
|
|
433
|
-
data.options.save(false, "auto");
|
|
434
|
-
props.openSettings();
|
|
435
|
-
}}
|
|
436
|
-
>
|
|
437
|
-
<span class="control-panel__button__content">{data.t("Settings")}</span>
|
|
438
|
-
<Icon class="control-panel__button__icon" children={Icon.Settings()} />
|
|
439
|
-
</button>
|
|
440
|
-
<button
|
|
441
|
-
role="menuitem"
|
|
442
|
-
type="button"
|
|
443
|
-
class="button control-panel__button"
|
|
444
|
-
title={data.t("Exit")}
|
|
445
|
-
onClick={() => {
|
|
446
|
-
data.options.exit();
|
|
447
|
-
}}
|
|
448
|
-
>
|
|
449
|
-
<span class="control-panel__button__content">{data.t("Exit")}</span>
|
|
450
|
-
<Icon class="control-panel__button__icon" children={Icon.Exit()} />
|
|
451
|
-
</button>
|
|
452
|
-
<Show3 when={data.media.hyperWide()}><button
|
|
453
|
-
role="menuitem"
|
|
454
|
-
type="button"
|
|
455
|
-
class="button control-panel__button"
|
|
456
|
-
title={data.t("CloseMenu")}
|
|
457
|
-
onClick={() => {
|
|
458
|
-
props.closeDropdown();
|
|
459
|
-
}}
|
|
460
|
-
><Icon children={Icon.Close()} /></button></Show3>
|
|
461
|
-
</>;
|
|
462
|
-
};
|
|
463
|
-
|
|
464
503
|
// src/screens/game.tsx
|
|
465
504
|
var Game = (props) => {
|
|
466
505
|
const data = useData();
|
|
@@ -472,7 +511,7 @@ var Game = (props) => {
|
|
|
472
511
|
"background-color": is ? void 0 : props.state.background
|
|
473
512
|
};
|
|
474
513
|
};
|
|
475
|
-
const [auto, setAuto] =
|
|
514
|
+
const [auto, setAuto] = createSignal4(false);
|
|
476
515
|
const onChoicesButtonClick = ([disabled, i]) => {
|
|
477
516
|
if (disabled)
|
|
478
517
|
return;
|
|
@@ -536,14 +575,14 @@ var Game = (props) => {
|
|
|
536
575
|
}
|
|
537
576
|
});
|
|
538
577
|
const controlPanelMenuID = createUniqueId();
|
|
539
|
-
const [controlPanelMenuExpanded, setControlPanelMenuExpanded] =
|
|
540
|
-
|
|
578
|
+
const [controlPanelMenuExpanded, setControlPanelMenuExpanded] = createSignal4(false);
|
|
579
|
+
createEffect4(() => {
|
|
541
580
|
if (!data.media.hyperWide()) {
|
|
542
581
|
setControlPanelMenuExpanded(false);
|
|
543
582
|
}
|
|
544
583
|
});
|
|
545
584
|
return <div class="root game" style={background()}>
|
|
546
|
-
<div data-characters={true} class="characters"><For each={Object.entries(props.state.characters)}>{([character, data2]) => <
|
|
585
|
+
<div data-characters={true} class="characters"><For each={Object.entries(props.state.characters)}>{([character, data2]) => <Show5 when={data2.visible}><Character character={character} data={data2} characters={store.characters} /></Show5>}</For></div>
|
|
547
586
|
<div
|
|
548
587
|
class="action-dialog"
|
|
549
588
|
classList={{
|
|
@@ -566,7 +605,7 @@ var Game = (props) => {
|
|
|
566
605
|
onKeyPress={onKey(DialogWriter.clear, "Enter")}
|
|
567
606
|
onKeyDown={onKey(DialogWriter.clear, " ")}
|
|
568
607
|
>
|
|
569
|
-
<div class="action-dialog-person"><
|
|
608
|
+
<div class="action-dialog-person"><Show5 when={props.state.dialog.emotion} keyed>{(emotion) => {
|
|
570
609
|
const character = props.state.dialog.character;
|
|
571
610
|
if (!character)
|
|
572
611
|
return null;
|
|
@@ -578,7 +617,7 @@ var Game = (props) => {
|
|
|
578
617
|
return image;
|
|
579
618
|
const [canvas] = canvasDrawImages(void 0, void 0, Object.values(image));
|
|
580
619
|
return canvas;
|
|
581
|
-
}}</
|
|
620
|
+
}}</Show5></div>
|
|
582
621
|
<div class="action-dialog-content"><DialogWriter.Typewriter
|
|
583
622
|
attributes={{
|
|
584
623
|
title: DialogWriter.state() === "idle" ? void 0 : data.t(DialogWriter.state() === "processing" ? "CompleteText" : "GoForward")
|
|
@@ -671,9 +710,9 @@ var Game = (props) => {
|
|
|
671
710
|
<div
|
|
672
711
|
class="control-panel"
|
|
673
712
|
>
|
|
674
|
-
<
|
|
713
|
+
<Show5
|
|
675
714
|
when={data.media.hyperWide()}
|
|
676
|
-
><
|
|
715
|
+
><Show5
|
|
677
716
|
when={!controlPanelMenuExpanded()}
|
|
678
717
|
><button
|
|
679
718
|
type="button"
|
|
@@ -684,11 +723,11 @@ var Game = (props) => {
|
|
|
684
723
|
onClick={() => {
|
|
685
724
|
setControlPanelMenuExpanded((prev) => !prev);
|
|
686
725
|
}}
|
|
687
|
-
><Icon children={Icon.Menu()} /></button></
|
|
688
|
-
<
|
|
726
|
+
><Icon children={Icon.Menu()} /></button></Show5></Show5>
|
|
727
|
+
<Show5 when={data.media.hyperWide() && controlPanelMenuExpanded() && !props.state.exitPromptShown}>
|
|
689
728
|
<span class="control-panel-container-fix" aria-hidden="true"></span>
|
|
690
729
|
<div class="control-panel-container-backdrop" />
|
|
691
|
-
</
|
|
730
|
+
</Show5>
|
|
692
731
|
<div
|
|
693
732
|
role="menubar"
|
|
694
733
|
id={controlPanelMenuID}
|
|
@@ -719,8 +758,18 @@ var Game = (props) => {
|
|
|
719
758
|
</div>;
|
|
720
759
|
};
|
|
721
760
|
|
|
761
|
+
// src/screens/loading.tsx
|
|
762
|
+
var Loading = () => {
|
|
763
|
+
return <div class="root loading"><div class="loading__animation">
|
|
764
|
+
<div />
|
|
765
|
+
<div />
|
|
766
|
+
<div />
|
|
767
|
+
<div />
|
|
768
|
+
</div></div>;
|
|
769
|
+
};
|
|
770
|
+
|
|
722
771
|
// src/screens/mainmenu.tsx
|
|
723
|
-
import { For as For2, Show as
|
|
772
|
+
import { For as For2, Show as Show6 } from "solid-js";
|
|
724
773
|
var MainMenu = (props) => {
|
|
725
774
|
const data = useData();
|
|
726
775
|
const language = () => data.storeData().meta[0];
|
|
@@ -732,12 +781,12 @@ var MainMenu = (props) => {
|
|
|
732
781
|
<button type="button" class="button main-menu__button" onClick={() => data.options.restore()}>{data.t("LoadSave")}</button>
|
|
733
782
|
<button type="button" class="button main-menu__button" onClick={() => props.setState("screen", "saves")}>{data.t("Saves")}</button>
|
|
734
783
|
<button type="button" class="button main-menu__button" onClick={() => props.setState("screen", "settings")}>{data.t("Settings")}</button>
|
|
735
|
-
<
|
|
784
|
+
<Show6 when={language()} keyed>{(_) => <For2 each={props.state.mainmenu.items}>{(item) => <button {...item(goto)} />}</For2>}</Show6>
|
|
736
785
|
</div>;
|
|
737
786
|
};
|
|
738
787
|
|
|
739
788
|
// src/screens/saves.tsx
|
|
740
|
-
import { Show as
|
|
789
|
+
import { Show as Show7, For as For3 } from "solid-js";
|
|
741
790
|
var Saves = (props) => {
|
|
742
791
|
const data = useData();
|
|
743
792
|
const saves = () => data.storeData().saves;
|
|
@@ -750,7 +799,7 @@ var Saves = (props) => {
|
|
|
750
799
|
};
|
|
751
800
|
return <div class="root saves">
|
|
752
801
|
<div class="saves__column"><button type="button" class="button saves__button" onClick={() => props.setState("screen", "mainmenu")}>{data.t("GoBack")}</button></div>
|
|
753
|
-
<div class="saves__list-container"><
|
|
802
|
+
<div class="saves__list-container"><Show7
|
|
754
803
|
when={saves().length > 0}
|
|
755
804
|
fallback={<div class="saves__list saves__list--empty">{data.t("NoSaves")}</div>}
|
|
756
805
|
><ol class="saves__list"><For3 each={saves()}>{(save) => {
|
|
@@ -784,7 +833,7 @@ var Saves = (props) => {
|
|
|
784
833
|
onClick={[removeSave, date]}
|
|
785
834
|
><span>{data.t("Remove")}</span></button>
|
|
786
835
|
</li>;
|
|
787
|
-
}}</For3></ol></
|
|
836
|
+
}}</For3></ol></Show7></div>
|
|
788
837
|
</div>;
|
|
789
838
|
};
|
|
790
839
|
|
|
@@ -829,41 +878,6 @@ var Settings = (props) => {
|
|
|
829
878
|
</div>;
|
|
830
879
|
};
|
|
831
880
|
|
|
832
|
-
// src/screens/loading.tsx
|
|
833
|
-
var Loading = () => {
|
|
834
|
-
return <div class="root loading"><div class="loading__animation">
|
|
835
|
-
<div />
|
|
836
|
-
<div />
|
|
837
|
-
<div />
|
|
838
|
-
<div />
|
|
839
|
-
</div></div>;
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
// src/screens/custom-screen.tsx
|
|
843
|
-
import { createEffect as createEffect4, createSignal as createSignal4, Show as Show7 } from "solid-js";
|
|
844
|
-
var CustomScreen = (props) => {
|
|
845
|
-
const [dom, setDOM] = createSignal4(null);
|
|
846
|
-
let unmount;
|
|
847
|
-
createEffect4(() => {
|
|
848
|
-
if (unmount)
|
|
849
|
-
unmount();
|
|
850
|
-
if (props.state.screen in props.state.screens) {
|
|
851
|
-
const current = props.state.screens[props.state.screen]();
|
|
852
|
-
setDOM(current.mount());
|
|
853
|
-
unmount = current.unmount;
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
setDOM(null);
|
|
857
|
-
unmount = void 0;
|
|
858
|
-
});
|
|
859
|
-
const onClick = ({ target }) => {
|
|
860
|
-
if (target instanceof HTMLElement && target.dataset.novelyGoto) {
|
|
861
|
-
props.setState("screen", target.dataset.novelyGoto);
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
return <Show7 when={dom()}><div class="root custom" onClick={onClick}>{dom()}</div></Show7>;
|
|
865
|
-
};
|
|
866
|
-
|
|
867
881
|
// src/renderer.tsx
|
|
868
882
|
var createSolidRenderer = ({ fullscreen = false, controls = "outside", skipTypewriterWhenGoingBack = true } = {}) => {
|
|
869
883
|
const [state, setState] = createStore({
|
|
@@ -907,12 +921,37 @@ var createSolidRenderer = ({ fullscreen = false, controls = "outside", skipTypew
|
|
|
907
921
|
let renderer;
|
|
908
922
|
let options;
|
|
909
923
|
let root;
|
|
924
|
+
let currentBackground;
|
|
910
925
|
return {
|
|
911
926
|
createRenderer(init) {
|
|
912
927
|
options = init, characters = init.characters;
|
|
913
928
|
return renderer = {
|
|
914
929
|
background(background) {
|
|
915
|
-
|
|
930
|
+
currentBackground = background;
|
|
931
|
+
if (typeof background === "string") {
|
|
932
|
+
setState("background", background);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
for (const [key, value] of Object.entries(background)) {
|
|
936
|
+
delete background[key];
|
|
937
|
+
background[toMedia(key)] = value;
|
|
938
|
+
}
|
|
939
|
+
const mediaQueries = Object.keys(background).map((media) => matchMedia(media));
|
|
940
|
+
const handle = () => {
|
|
941
|
+
if (currentBackground !== background) {
|
|
942
|
+
for (const mq of mediaQueries) {
|
|
943
|
+
mq.onchange = null;
|
|
944
|
+
}
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
const last = findLast(mediaQueries, ({ matches }) => matches);
|
|
948
|
+
const bg = last ? background[last.media] : "";
|
|
949
|
+
setState("background", bg);
|
|
950
|
+
};
|
|
951
|
+
for (const mq of mediaQueries) {
|
|
952
|
+
mq.onchange = handle;
|
|
953
|
+
}
|
|
954
|
+
handle();
|
|
916
955
|
},
|
|
917
956
|
character(character) {
|
|
918
957
|
if (store.characters[character])
|
|
@@ -1053,10 +1092,11 @@ var createSolidRenderer = ({ fullscreen = false, controls = "outside", skipTypew
|
|
|
1053
1092
|
});
|
|
1054
1093
|
};
|
|
1055
1094
|
const input = <input type="text" name="novely-input" required autocomplete="off" onInput={onInputHandler} />;
|
|
1056
|
-
if (setup)
|
|
1095
|
+
if (setup) {
|
|
1057
1096
|
setup(input, (callback) => {
|
|
1058
1097
|
setState("input", { cleanup: callback });
|
|
1059
1098
|
});
|
|
1099
|
+
}
|
|
1060
1100
|
setState("input", {
|
|
1061
1101
|
element: input,
|
|
1062
1102
|
question,
|
package/dist/styles/index.css
CHANGED
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
width: 100%;
|
|
96
96
|
display: flex;
|
|
97
97
|
}
|
|
98
|
-
.control-panel-container--center {
|
|
98
|
+
.control-panel-container--center:not(.control-panel-container--wide-open) {
|
|
99
99
|
bottom: calc(var(--novely-dialog-border-width, 3px) + .4rem);
|
|
100
100
|
justify-content: center;
|
|
101
|
-
|
|
101
|
+
position: fixed;
|
|
102
102
|
left: 50%;
|
|
103
103
|
right: 50%;
|
|
104
104
|
transform: translateX(-50%);
|
|
@@ -129,26 +129,23 @@
|
|
|
129
129
|
height: 100vh;
|
|
130
130
|
display: inline-block;
|
|
131
131
|
}
|
|
132
|
-
@media (orientation: portrait) {
|
|
133
|
-
.control-panel-container--center {
|
|
134
|
-
width: 75%;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
132
|
|
|
138
133
|
/* src/styles/control-panel/button/button.css */
|
|
139
134
|
.control-panel__button {
|
|
140
135
|
border: 2px solid var(--novely-button-border-color, #ffc7df);
|
|
136
|
+
justify-content: center;
|
|
141
137
|
height: 2rem;
|
|
142
138
|
margin: 0;
|
|
143
139
|
padding: .2rem .4rem;
|
|
144
140
|
font-size: 1rem;
|
|
145
141
|
line-height: 1;
|
|
142
|
+
display: flex;
|
|
146
143
|
}
|
|
147
144
|
.control-panel__button__icon,
|
|
148
145
|
.control-panel__button--auto-mode {
|
|
149
146
|
display: none;
|
|
150
147
|
}
|
|
151
|
-
@media (orientation: portrait) and (min-aspect-ratio: .26) {
|
|
148
|
+
@media (orientation: portrait) and ((min-aspect-ratio: .26) or (max-aspect-ratio: .1)) {
|
|
152
149
|
.control-panel__button__icon {
|
|
153
150
|
display: block;
|
|
154
151
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ declare const canvasDrawImages: (canvas: HTMLCanvasElement | undefined, ctx: Can
|
|
|
8
8
|
declare const url: <T extends string>(str: T) => `url(${T})`;
|
|
9
9
|
declare const escape: (str: string) => string;
|
|
10
10
|
declare const onKey: (cb: (event: KeyboardEvent) => void, ...keys: string[]) => (e: KeyboardEvent) => void;
|
|
11
|
-
|
|
11
|
+
declare const toMedia: (media: 'portrait' | 'landscape' | (string & Record<never, never>)) => string;
|
|
12
|
+
declare const findLast: <T>(array: T[], fn: (item: T) => boolean) => T | undefined;
|
|
13
|
+
export { isCSSImage, canvasDrawImages, url, createImage, capitalize, escape, onKey, toMedia, findLast };
|