@novely/solid-renderer 0.0.0-alpha.6 → 0.0.0-alpha.8

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/README.md CHANGED
@@ -78,6 +78,9 @@ render(
78
78
  | `--novely-button-hover-background-color` | `#ffffff` |
79
79
  | `--novely-button-hover-border-color` | `#ffc6d8` |
80
80
  | `--novely-button-hover-color` | `#ffb7a2` |
81
+ | `--novely-select-background-color` | `#ffe9f3` |
82
+ | `--novely-select-border-color` | `#ffc7df` |
83
+ | `--novely-select-color` | `#000000` |
81
84
  | `--novely-dialog-color` | `#ffffff` |
82
85
  | `--novely-dialog-border-color` | `#ffffff` |
83
86
  | `--novely-dialog-border-radius` | `14px` |
package/dist/index.css CHANGED
@@ -21,6 +21,9 @@
21
21
  Noto Color Emoji;
22
22
  font-size: 1em;
23
23
  }
24
+ .n-root * {
25
+ box-sizing: border-box;
26
+ }
24
27
 
25
28
  /* esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-built */
26
29
  .n-button {
@@ -31,7 +34,7 @@
31
34
  user-select: none;
32
35
  margin: .4em 0;
33
36
  padding: .4em;
34
- font-size: 1.8375em;
37
+ font-size: 1.02em;
35
38
  line-height: 1.2;
36
39
  }
37
40
  .n-button:hover {
@@ -49,21 +52,22 @@
49
52
  padding: .4em .6em;
50
53
  font-size: 1.2375em;
51
54
  }
52
- .n-buttonChoices {
53
- font-size: 1.02em;
54
- }
55
55
  .n-buttonMainMenu,
56
56
  .n-buttonSaves {
57
57
  width: 100%;
58
- font-size: 1.02em;
59
58
  }
60
59
  .n-buttonSavesDelete {
61
60
  margin-left: 1em;
62
- font-size: 1.02em;
63
61
  }
64
62
  .n-buttonSettings {
65
63
  width: 100%;
66
- font-size: 1.02em;
64
+ }
65
+ .n-buttonControlPanel {
66
+ border: 2px solid var(--novely-button-border-color, #ffc7df);
67
+ margin: 0;
68
+ padding: .2em .4em;
69
+ font-size: 1em;
70
+ line-height: 1;
67
71
  }
68
72
 
69
73
  /* esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-built */
@@ -82,8 +86,7 @@
82
86
 
83
87
  /* esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-built */
84
88
  .n-dialog {
85
- min-height: 25vh;
86
- max-height: 30vh;
89
+ min-height: 26vh;
87
90
  width: 75%;
88
91
  z-index: 22;
89
92
  text-align: left;
@@ -98,8 +101,7 @@
98
101
  }
99
102
  .n-dialogContainer {
100
103
  height: 100%;
101
- min-height: 14.5vh;
102
- max-height: 25vh;
104
+ min-height: 18vh;
103
105
  color: var(--novely-dialog-color, #fff);
104
106
  border: 3px solid var(--novely-dialog-border-color, #fff);
105
107
  border-radius: var(--novely-dialog-border-radius, 14px);
@@ -108,16 +110,17 @@
108
110
  background-color: var(--novely-dialog-background-color, #f092b4d8);
109
111
  background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
110
112
  background-size: var(--novely-dialog-background-size, 100px 100px);
111
- grid-template-rows: auto 1fr;
112
- grid-template-columns: 10vmax 1fr;
113
+ flex-grow: 1;
114
+ grid-template-areas: "n-pers n-text" "n-pers n-text" "n-cont n-cont";
113
115
  display: grid;
114
116
  }
115
117
  .n-dialogPerson {
116
118
  max-height: 25vh;
117
119
  max-width: 25vw;
120
+ grid-area: n-pers;
118
121
  }
119
122
  .n-dialogContainerWithPerson[data-no-person=true] {
120
- display: block;
123
+ grid-template-areas: "n-text n-text" "n-text n-text" "n-cont n-cont";
121
124
  }
122
125
  .n-dialogContainerWithPerson[data-no-person=true] > .n-dialogPerson {
123
126
  display: none;
@@ -141,10 +144,11 @@
141
144
  .n-dialogContent {
142
145
  width: 100%;
143
146
  text-shadow:
144
- 1px 0 #000,
145
- 0 1px #000,
146
- -1px 0 #000,
147
- 0 -1px #000;
147
+ 1px 1px #000,
148
+ -1px -1px #000,
149
+ 1px -1px #000,
150
+ -1px 1px #000;
151
+ grid-area: n-text;
148
152
  font-size: 2.2375em;
149
153
  line-height: 1.2;
150
154
  }
@@ -241,9 +245,14 @@
241
245
  flex-direction: column;
242
246
  justify-content: center;
243
247
  align-items: center;
244
- padding-left: 1em;
248
+ padding: 0 1em;
245
249
  display: flex;
246
250
  }
251
+ @media (max-width: 768px) {
252
+ .n-mainMenu > .n-controls {
253
+ width: 100%;
254
+ }
255
+ }
247
256
 
248
257
  /* esbuild-css-modules-plugin-namespace:./src/styles/saves.module.css?esbuild-css-modules-plugin-built */
249
258
  .n-saves {
@@ -259,30 +268,43 @@
259
268
  height: 100%;
260
269
  flex-direction: column;
261
270
  align-items: center;
262
- padding-left: 1em;
271
+ padding: 0 1em;
263
272
  display: flex;
264
273
  }
265
274
  .n-saves > .n-list {
266
275
  width: 100%;
267
276
  height: 100%;
268
277
  flex-direction: column;
269
- flex: 1 1 0;
270
- justify-content: center;
271
278
  align-items: center;
272
- padding-left: 1em;
279
+ padding: 0 1em;
273
280
  list-style: none;
274
281
  display: flex;
282
+ overflow-y: scroll;
275
283
  }
276
284
  .n-saves > .n-list > li {
277
285
  display: flex;
278
286
  }
287
+ @media (max-width: 768px) {
288
+ .n-saves {
289
+ flex-direction: column;
290
+ }
291
+ .n-saves > .n-controls {
292
+ width: auto;
293
+ height: auto;
294
+ }
295
+ .n-saves > .n-list {
296
+ height: auto;
297
+ }
298
+ }
279
299
 
280
300
  /* esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-built */
281
301
  .n-controlPanel {
282
- z-index: 23;
283
- position: absolute;
284
- bottom: .4em;
285
- right: 0;
302
+ grid-area: n-cont;
303
+ justify-content: end;
304
+ place-self: end;
305
+ margin-bottom: .4em;
306
+ margin-right: .4em;
307
+ display: flex;
286
308
  }
287
309
 
288
310
  /* esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-built */
@@ -314,6 +336,23 @@
314
336
  list-style: none;
315
337
  display: flex;
316
338
  }
339
+ .n-settings .n-select {
340
+ flex-direction: column;
341
+ align-items: start;
342
+ display: flex;
343
+ }
344
+ .n-settings .n-select > select {
345
+ background-color: var(--novely-select-background-color, #ffe9f3);
346
+ border: 4px solid var(--novely-select-border-color, #ffc7df);
347
+ color: var(--novely-select-color, #000);
348
+ margin: .4em 0;
349
+ padding: .4em;
350
+ font-size: 1.02em;
351
+ }
352
+ .n-settings .n-select > label {
353
+ color: var(--novely-select-color, #000);
354
+ font-size: 1.42em;
355
+ }
317
356
 
318
357
  /* esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-built */
319
358
  .n-loading {
@@ -381,3 +420,14 @@
381
420
  transform: translate(24px);
382
421
  }
383
422
  }
423
+
424
+ /* esbuild-css-modules-plugin-namespace:./src/styles/fullscreenText.module.css?esbuild-css-modules-plugin-built */
425
+ .n-fullscreenText {
426
+ z-index: 2;
427
+ text-align: center;
428
+ justify-content: center;
429
+ align-items: center;
430
+ display: flex;
431
+ position: absolute;
432
+ inset: 0;
433
+ }
package/dist/index.jsx CHANGED
@@ -87,13 +87,13 @@ var M = (h, d, c) => {
87
87
  var root_module_default = { "root": "n-root" };
88
88
 
89
89
  // esbuild-css-modules-plugin-namespace:./src/styles/button.module.css?esbuild-css-modules-plugin-building
90
- var button_module_default = { "button": "n-button", "buttonChoices": "n-buttonChoices", "buttonInputDialogPanel": "n-buttonInputDialogPanel", "buttonMainMenu": "n-buttonMainMenu", "buttonSaves": "n-buttonSaves", "buttonSavesDelete": "n-buttonSavesDelete", "buttonSettings": "n-buttonSettings" };
90
+ var button_module_default = { "button": "n-button", "buttonControlPanel": "n-buttonControlPanel", "buttonInputDialogPanel": "n-buttonInputDialogPanel", "buttonMainMenu": "n-buttonMainMenu", "buttonSaves": "n-buttonSaves", "buttonSavesDelete": "n-buttonSavesDelete", "buttonSettings": "n-buttonSettings" };
91
91
 
92
92
  // esbuild-css-modules-plugin-namespace:./src/styles/characters.module.css?esbuild-css-modules-plugin-building
93
93
  var characters_module_default = { "characters": "n-characters" };
94
94
 
95
95
  // esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-building
96
- var dialog_module_default = { "dialog": "n-dialog", "dialogContainer": "n-dialogContainer", "dialogContainerWithPerson": "n-dialogContainerWithPerson", "dialogContent": "n-dialogContent", "dialogName": "n-dialogName", "dialogPerson": "n-dialogPerson" };
96
+ var dialog_module_default = { "cont": "n-cont", "dialog": "n-dialog", "dialogContainer": "n-dialogContainer", "dialogContainerWithPerson": "n-dialogContainerWithPerson", "dialogContent": "n-dialogContent", "dialogName": "n-dialogName", "dialogPerson": "n-dialogPerson", "pers": "n-pers", "text": "n-text" };
97
97
 
98
98
  // esbuild-css-modules-plugin-namespace:./src/styles/headlessDialog.module.css?esbuild-css-modules-plugin-building
99
99
  var headlessDialog_module_default = { "headlessDialog": "n-headlessDialog", "headlessDialogContainer": "n-headlessDialogContainer", "headlessDialogFix": "n-headlessDialogFix", "headlessDialogPanel": "n-headlessDialogPanel", "inputDialogLabel": "n-inputDialogLabel", "inputDialogPanel": "n-inputDialogPanel" };
@@ -105,16 +105,19 @@ var mainMenu_module_default = { "controls": "n-controls", "mainMenu": "n-mainMen
105
105
  var saves_module_default = { "controls": "n-controls", "list": "n-list", "saves": "n-saves" };
106
106
 
107
107
  // esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-building
108
- var controlPanel_module_default = { "controlPanel": "n-controlPanel" };
108
+ var controlPanel_module_default = { "cont": "n-cont", "controlPanel": "n-controlPanel" };
109
109
 
110
110
  // esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-building
111
- var settings_module_default = { "content": "n-content", "controls": "n-controls", "settings": "n-settings" };
111
+ var settings_module_default = { "content": "n-content", "controls": "n-controls", "select": "n-select", "settings": "n-settings" };
112
112
 
113
113
  // esbuild-css-modules-plugin-namespace:./src/styles/loading.module.css?esbuild-css-modules-plugin-building
114
114
  var loading_module_default = { "ldsEllipsis": "n-lds-ellipsis", "ldsEllipsis1": "n-lds-ellipsis1", "ldsEllipsis2": "n-lds-ellipsis2", "ldsEllipsis3": "n-lds-ellipsis3", "loading": "n-loading" };
115
115
 
116
+ // esbuild-css-modules-plugin-namespace:./src/styles/fullscreenText.module.css?esbuild-css-modules-plugin-building
117
+ var fullscreenText_module_default = { "fullscreenText": "n-fullscreenText" };
118
+
116
119
  // src/styles/styles.ts
117
- Object.assign(root_module_default, button_module_default, characters_module_default, dialog_module_default, headlessDialog_module_default, mainMenu_module_default, saves_module_default, controlPanel_module_default, settings_module_default, loading_module_default);
120
+ Object.assign(root_module_default, button_module_default, characters_module_default, dialog_module_default, headlessDialog_module_default, mainMenu_module_default, saves_module_default, controlPanel_module_default, settings_module_default, loading_module_default, fullscreenText_module_default);
118
121
 
119
122
  // src/screens/game.tsx
120
123
  var Game = (props) => {
@@ -126,14 +129,17 @@ var Game = (props) => {
126
129
  return { "background-image": is ? url(props.state.background) : "", "background-color": is ? void 0 : props.state.background };
127
130
  });
128
131
  const [auto, setAuto] = createSignal(false);
132
+ const getCurrentContent = () => {
133
+ const state = props.state;
134
+ return [state.dialog.content, state.text.content];
135
+ };
129
136
  createEffect(() => {
130
- if (props.state && store.dialogRef) {
131
- writer?.destroy();
132
- writer = M(store.dialogRef, props.state.dialog.content, () => {
133
- if (auto())
134
- onDialogClick();
135
- });
136
- }
137
+ const [dialog, text] = getCurrentContent();
138
+ writer?.destroy();
139
+ writer = M(dialog ? store.dialogRef : store.textRef, dialog || text, () => {
140
+ if (auto())
141
+ clearTypewriterEffect();
142
+ });
137
143
  });
138
144
  const onChoicesButtonClick = ([disabled, i]) => {
139
145
  if (disabled)
@@ -142,10 +148,15 @@ var Game = (props) => {
142
148
  setState("choices", { choices: [], visible: false, resolve: void 0 });
143
149
  resolve?.(i);
144
150
  };
145
- const onDialogClick = () => {
151
+ const clearTypewriterEffect = () => {
146
152
  if (writer && writer.end()) {
147
- const resolve = props.state.dialog.resolve;
148
- setState("dialog", { content: "", character: void 0, emotion: void 0, visible: false, resolve: void 0 });
153
+ const resolve = props.state.dialog.resolve || props.state.text.resolve;
154
+ const [dialog, text] = getCurrentContent();
155
+ if (dialog) {
156
+ setState("dialog", { content: "", character: void 0, emotion: void 0, visible: false, resolve: void 0 });
157
+ } else if (text) {
158
+ setState("text", { content: "", resolve: void 0 });
159
+ }
149
160
  resolve?.();
150
161
  }
151
162
  };
@@ -172,7 +183,7 @@ var Game = (props) => {
172
183
  <div
173
184
  class={root_module_default.dialog}
174
185
  style={{ display: props.state.dialog.visible ? "flex" : "none" }}
175
- onClick={onDialogClick}
186
+ onClick={clearTypewriterEffect}
176
187
  >
177
188
  {() => {
178
189
  const character = () => props.state.dialog.character;
@@ -209,6 +220,46 @@ var Game = (props) => {
209
220
  return canvas;
210
221
  }}</Show></div>
211
222
  <p class={root_module_default.dialogContent} ref={store.dialogRef}> </p>
223
+ <div class={root_module_default.controlPanel}>
224
+ <button
225
+ type="button"
226
+ class={join(root_module_default.button, root_module_default.buttonControlPanel)}
227
+ onClick={() => {
228
+ data.options.stack.back();
229
+ data.options.restore(data.options.stack.value);
230
+ }}
231
+ >{data.t("GoBack")}</button>
232
+ <button
233
+ type="button"
234
+ class={join(root_module_default.button, root_module_default.buttonControlPanel)}
235
+ onClick={() => {
236
+ data.options.save(false, "manual");
237
+ }}
238
+ >{data.t("DoSave")}</button>
239
+ <button
240
+ type="button"
241
+ class={join(root_module_default.button, root_module_default.buttonControlPanel)}
242
+ onClick={() => {
243
+ setAuto((prev) => !prev);
244
+ }}
245
+ >{data.t(auto() ? "Stop" : "Auto")}</button>
246
+ <button
247
+ type="button"
248
+ class={join(root_module_default.button, root_module_default.buttonControlPanel)}
249
+ onClick={() => {
250
+ data.options.save(false, "auto");
251
+ props.setState("screen", "settings");
252
+ }}
253
+ >{data.t("Settings")}</button>
254
+ <button
255
+ type="button"
256
+ class={join(root_module_default.button, root_module_default.buttonControlPanel)}
257
+ onClick={() => {
258
+ data.options.stack.clear();
259
+ props.setState("screen", "mainmenu");
260
+ }}
261
+ >{data.t("Exit")}</button>
262
+ </div>
212
263
  </div>
213
264
  </div>
214
265
  <Dialog
@@ -251,42 +302,7 @@ var Game = (props) => {
251
302
  </DialogPanel>
252
303
  </div></Dialog>
253
304
  <div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
254
- <div class={root_module_default.controlPanel}>
255
- <button
256
- type="button"
257
- onClick={() => {
258
- data.options.stack.back();
259
- data.options.restore(data.options.stack.value);
260
- }}
261
- >{data.t("GoBack")}</button>
262
- <button
263
- type="button"
264
- onClick={() => {
265
- data.options.save(false, "manual");
266
- }}
267
- >{data.t("DoSave")}</button>
268
- <button
269
- type="button"
270
- onClick={() => {
271
- setAuto((prev) => !prev);
272
- }}
273
- >{data.t(auto() ? "Auto" : "Stop")}</button>
274
- <button
275
- type="button"
276
- onClick={() => {
277
- data.options.save(false, "auto").then(() => {
278
- props.setState("screen", "settings");
279
- });
280
- }}
281
- >{data.t("Settings")}</button>
282
- <button
283
- type="button"
284
- onClick={() => {
285
- data.options.stack.clear();
286
- props.setState("screen", "mainmenu");
287
- }}
288
- >{data.t("Exit")}</button>
289
- </div>
305
+ <div class={root_module_default.fullscreenText} data-fullscreen-text-shown={Boolean(props.state.text.content)} onClick={clearTypewriterEffect}><p ref={store.textRef}> </p></div>
290
306
  </div>;
291
307
  };
292
308
 
@@ -378,10 +394,10 @@ var Settings = (props) => {
378
394
  const languageNames = new Intl.DisplayNames([language()], {
379
395
  type: "language"
380
396
  });
381
- return <div class={root_module_default.content}>
397
+ return <div class={root_module_default.content}><div class={root_module_default.select}>
382
398
  <label for={id}>{data.t("Language")}</label>
383
399
  <select id={id} onChange={onSelect}><For3 each={data.options.languages}>{(lang) => <option value={lang} selected={lang === language()}>{capitalize(languageNames.of(lang) || lang)}</option>}</For3></select>
384
- </div>;
400
+ </div></div>;
385
401
  }}</Show3>
386
402
  </div>;
387
403
  };
@@ -419,6 +435,9 @@ var createSolidRenderer = () => {
419
435
  error: "",
420
436
  visible: false
421
437
  },
438
+ text: {
439
+ content: ""
440
+ },
422
441
  layers: {},
423
442
  screen: "mainmenu"
424
443
  });
@@ -586,6 +605,9 @@ var createSolidRenderer = () => {
586
605
  result ? result.then(resolve) : resolve();
587
606
  return result;
588
607
  },
608
+ text(content, resolve) {
609
+ setState("text", { content, resolve });
610
+ },
589
611
  store,
590
612
  ui: {
591
613
  showScreen(name) {
@@ -77,6 +77,16 @@ interface StateInput {
77
77
  */
78
78
  error: string;
79
79
  }
80
+ interface StateText {
81
+ /**
82
+ * Текст
83
+ */
84
+ content: string;
85
+ /**
86
+ * Функция `resolve`
87
+ */
88
+ resolve?: () => void;
89
+ }
80
90
  type StateLayers = Record<string, {
81
91
  value: CustomHandlerGetResult;
82
92
  fn: CustomHandler;
@@ -90,10 +100,12 @@ interface State {
90
100
  choices: StateChoices;
91
101
  input: StateInput;
92
102
  layers: StateLayers;
103
+ text: StateText;
93
104
  screen: "mainmenu" | "game" | "saves" | "settings" | 'loading';
94
105
  }
95
106
  interface SolidRendererStore extends RendererStore {
96
107
  dialogRef?: HTMLParagraphElement;
108
+ textRef?: HTMLParagraphElement;
97
109
  }
98
110
  declare const createSolidRenderer: () => {
99
111
  createRenderer(init: RendererInit): Renderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.0.0-alpha.6",
3
+ "version": "0.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"