@novely/solid-renderer 0.0.0-alpha.7 → 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/dist/index.css CHANGED
@@ -86,8 +86,7 @@
86
86
 
87
87
  /* esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-built */
88
88
  .n-dialog {
89
- min-height: 25vh;
90
- max-height: 30vh;
89
+ min-height: 26vh;
91
90
  width: 75%;
92
91
  z-index: 22;
93
92
  text-align: left;
@@ -102,8 +101,7 @@
102
101
  }
103
102
  .n-dialogContainer {
104
103
  height: 100%;
105
- min-height: 14.5vh;
106
- max-height: 25vh;
104
+ min-height: 18vh;
107
105
  color: var(--novely-dialog-color, #fff);
108
106
  border: 3px solid var(--novely-dialog-border-color, #fff);
109
107
  border-radius: var(--novely-dialog-border-radius, 14px);
@@ -112,16 +110,17 @@
112
110
  background-color: var(--novely-dialog-background-color, #f092b4d8);
113
111
  background-position: var(--novely-dialog-background-position, 0 0, 50px 50px);
114
112
  background-size: var(--novely-dialog-background-size, 100px 100px);
115
- grid-template-rows: auto 1fr;
116
- 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";
117
115
  display: grid;
118
116
  }
119
117
  .n-dialogPerson {
120
118
  max-height: 25vh;
121
119
  max-width: 25vw;
120
+ grid-area: n-pers;
122
121
  }
123
122
  .n-dialogContainerWithPerson[data-no-person=true] {
124
- display: block;
123
+ grid-template-areas: "n-text n-text" "n-text n-text" "n-cont n-cont";
125
124
  }
126
125
  .n-dialogContainerWithPerson[data-no-person=true] > .n-dialogPerson {
127
126
  display: none;
@@ -145,10 +144,11 @@
145
144
  .n-dialogContent {
146
145
  width: 100%;
147
146
  text-shadow:
148
- 1px 0 #000,
149
- 0 1px #000,
150
- -1px 0 #000,
151
- 0 -1px #000;
147
+ 1px 1px #000,
148
+ -1px -1px #000,
149
+ 1px -1px #000,
150
+ -1px 1px #000;
151
+ grid-area: n-text;
152
152
  font-size: 2.2375em;
153
153
  line-height: 1.2;
154
154
  }
@@ -245,9 +245,14 @@
245
245
  flex-direction: column;
246
246
  justify-content: center;
247
247
  align-items: center;
248
- padding-left: 1em;
248
+ padding: 0 1em;
249
249
  display: flex;
250
250
  }
251
+ @media (max-width: 768px) {
252
+ .n-mainMenu > .n-controls {
253
+ width: 100%;
254
+ }
255
+ }
251
256
 
252
257
  /* esbuild-css-modules-plugin-namespace:./src/styles/saves.module.css?esbuild-css-modules-plugin-built */
253
258
  .n-saves {
@@ -294,10 +299,12 @@
294
299
 
295
300
  /* esbuild-css-modules-plugin-namespace:./src/styles/controlPanel.module.css?esbuild-css-modules-plugin-built */
296
301
  .n-controlPanel {
297
- z-index: 23;
298
- position: absolute;
299
- bottom: .4em;
300
- right: .4em;
302
+ grid-area: n-cont;
303
+ justify-content: end;
304
+ place-self: end;
305
+ margin-bottom: .4em;
306
+ margin-right: .4em;
307
+ display: flex;
301
308
  }
302
309
 
303
310
  /* esbuild-css-modules-plugin-namespace:./src/styles/settings.module.css?esbuild-css-modules-plugin-built */
@@ -413,3 +420,14 @@
413
420
  transform: translate(24px);
414
421
  }
415
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
@@ -93,7 +93,7 @@ var button_module_default = { "button": "n-button", "buttonControlPanel": "n-but
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,7 +105,7 @@ 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
111
  var settings_module_default = { "content": "n-content", "controls": "n-controls", "select": "n-select", "settings": "n-settings" };
@@ -113,8 +113,11 @@ var settings_module_default = { "content": "n-content", "controls": "n-controls"
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,62 +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
- classList={{
258
- [root_module_default.button]: true,
259
- [root_module_default.buttonControlPanel]: true
260
- }}
261
- onClick={() => {
262
- data.options.stack.back();
263
- data.options.restore(data.options.stack.value);
264
- }}
265
- >{data.t("GoBack")}</button>
266
- <button
267
- type="button"
268
- classList={{
269
- [root_module_default.button]: true,
270
- [root_module_default.buttonControlPanel]: true
271
- }}
272
- onClick={() => {
273
- data.options.save(false, "manual");
274
- }}
275
- >{data.t("DoSave")}</button>
276
- <button
277
- type="button"
278
- classList={{
279
- [root_module_default.button]: true,
280
- [root_module_default.buttonControlPanel]: true
281
- }}
282
- onClick={() => {
283
- setAuto((prev) => !prev);
284
- }}
285
- >{data.t(auto() ? "Stop" : "Auto")}</button>
286
- <button
287
- type="button"
288
- classList={{
289
- [root_module_default.button]: true,
290
- [root_module_default.buttonControlPanel]: true
291
- }}
292
- onClick={() => {
293
- data.options.save(false, "auto").then(() => {
294
- props.setState("screen", "settings");
295
- });
296
- }}
297
- >{data.t("Settings")}</button>
298
- <button
299
- type="button"
300
- classList={{
301
- [root_module_default.button]: true,
302
- [root_module_default.buttonControlPanel]: true
303
- }}
304
- onClick={() => {
305
- data.options.stack.clear();
306
- props.setState("screen", "mainmenu");
307
- }}
308
- >{data.t("Exit")}</button>
309
- </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>
310
306
  </div>;
311
307
  };
312
308
 
@@ -439,6 +435,9 @@ var createSolidRenderer = () => {
439
435
  error: "",
440
436
  visible: false
441
437
  },
438
+ text: {
439
+ content: ""
440
+ },
442
441
  layers: {},
443
442
  screen: "mainmenu"
444
443
  });
@@ -606,6 +605,9 @@ var createSolidRenderer = () => {
606
605
  result ? result.then(resolve) : resolve();
607
606
  return result;
608
607
  },
608
+ text(content, resolve) {
609
+ setState("text", { content, resolve });
610
+ },
609
611
  store,
610
612
  ui: {
611
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.7",
3
+ "version": "0.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"