@novely/solid-renderer 0.0.0-beta.4 → 0.0.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/index.css CHANGED
@@ -1,9 +1,9 @@
1
1
  /* esbuild-css-modules-plugin-namespace:./src/styles/root.module.css?esbuild-css-modules-plugin-built */
2
2
  .n-root {
3
- height: 100vh;
4
3
  background-position: center;
5
4
  background-repeat: no-repeat;
6
5
  background-size: cover;
6
+ height: 100vh;
7
7
  font-family:
8
8
  ui-sans-serif,
9
9
  system-ui,
@@ -47,7 +47,6 @@
47
47
  opacity: .9;
48
48
  }
49
49
  .n-buttonInputDialogPanel {
50
- width: -moz-fit-content;
51
50
  width: fit-content;
52
51
  padding: .4em .6em;
53
52
  font-size: 1.2375em;
@@ -87,22 +86,20 @@
87
86
 
88
87
  /* esbuild-css-modules-plugin-namespace:./src/styles/dialog.module.css?esbuild-css-modules-plugin-built */
89
88
  .n-dialog {
90
- min-height: 26vh;
91
- width: 75%;
92
89
  z-index: 22;
93
90
  text-align: left;
94
91
  cursor: default;
95
92
  user-select: none;
96
93
  flex-direction: column;
97
94
  justify-content: flex-end;
95
+ width: 75%;
96
+ min-height: 26vh;
98
97
  position: absolute;
99
98
  bottom: .4em;
100
99
  left: 50%;
101
100
  transform: translateX(-50%);
102
101
  }
103
102
  .n-dialogContainer {
104
- height: 100%;
105
- min-height: 18vh;
106
103
  color: var(--novely-dialog-color, #fff);
107
104
  border: 3px solid var(--novely-dialog-border-color, #fff);
108
105
  border-radius: var(--novely-dialog-border-radius, 14px);
@@ -113,13 +110,15 @@
113
110
  background-size: var(--novely-dialog-background-size, 100px 100px);
114
111
  flex-grow: 1;
115
112
  grid-template-areas: "n-pers n-text" "n-pers n-text";
113
+ height: 100%;
114
+ min-height: 18vh;
116
115
  padding-bottom: 2.8em;
117
116
  display: grid;
118
117
  }
119
118
  .n-dialogPerson {
120
- max-height: 25vh;
121
- max-width: 25vw;
122
119
  grid-area: n-pers;
120
+ max-width: 25vw;
121
+ max-height: 25vh;
123
122
  }
124
123
  .n-dialogContainerWithPerson[data-no-person=true] {
125
124
  grid-template-areas: "n-text n-text" "n-text n-text";
@@ -134,23 +133,22 @@
134
133
  display: block;
135
134
  }
136
135
  .n-dialogName {
137
- width: -moz-fit-content;
138
- width: fit-content;
139
136
  background: #fff;
140
137
  border-radius: 7px 7px 0 0;
138
+ width: fit-content;
141
139
  margin-left: 5vmin;
142
140
  font-size: 1.4375em;
143
141
  line-height: 1.2;
144
142
  box-shadow: 1px 1px 3px #00000042;
145
143
  }
146
144
  .n-dialogContent {
147
- width: 100%;
148
145
  text-shadow:
149
146
  1px 1px #000,
150
147
  -1px -1px #000,
151
148
  1px -1px #000,
152
149
  -1px 1px #000;
153
150
  grid-area: n-text;
151
+ width: 100%;
154
152
  font-size: 2.2375em;
155
153
  line-height: 1.2;
156
154
  }
@@ -158,12 +156,12 @@
158
156
  .n-dialogPerson > img {
159
157
  height: 100%;
160
158
  }
161
- @media (max-width: 768px) {
159
+ @media (width <= 768px) {
162
160
  .n-dialog {
163
- width: 100%;
164
161
  bottom: 0;
165
162
  left: unset;
166
163
  transform: unset;
164
+ width: 100%;
167
165
  }
168
166
  .n-dialogName {
169
167
  font-size: 1.02em;
@@ -184,45 +182,44 @@
184
182
  overflow-y: auto;
185
183
  }
186
184
  .n-headlessDialogContainer {
187
- min-height: 100vh;
188
185
  justify-content: center;
189
186
  align-items: center;
187
+ min-height: 100vh;
190
188
  display: flex;
191
189
  }
192
190
  .n-headlessDialogFix {
193
- height: 100vh;
194
191
  vertical-align: middle;
192
+ height: 100vh;
195
193
  display: inline-block;
196
194
  }
197
195
  .n-headlessDialogPanel {
198
196
  text-align: left;
199
197
  z-index: 21;
198
+ flex-direction: column;
199
+ align-items: stretch;
200
200
  width: 100%;
201
201
  max-width: 40vw;
202
202
  min-height: 40vh;
203
- flex-direction: column;
204
- align-items: stretch;
205
203
  display: flex;
206
204
  }
207
205
  .n-headlessDialogPanelLabel {
208
206
  user-select: none;
209
207
  font-size: 1.2375em;
210
208
  }
211
- @media (max-width: 768px) {
209
+ @media (width <= 768px) {
212
210
  .n-headlessDialogPanel {
213
211
  max-width: 95vw;
214
212
  }
215
213
  }
216
214
  .n-inputDialogLabel {
217
- width: 100%;
218
215
  flex-direction: column;
219
216
  justify-content: center;
220
217
  align-items: center;
218
+ width: 100%;
221
219
  font-size: 1.2375em;
222
220
  display: flex;
223
221
  }
224
222
  .n-inputDialogLabel > span {
225
- min-height: 1em;
226
223
  min-height: 1lh;
227
224
  margin: .4em 0;
228
225
  }
@@ -248,15 +245,15 @@
248
245
  overflow: hidden;
249
246
  }
250
247
  .n-mainMenu > .n-controls {
251
- width: 30vw;
252
- height: 100%;
253
248
  flex-direction: column;
254
249
  justify-content: center;
255
250
  align-items: center;
251
+ width: 30vw;
252
+ height: 100%;
256
253
  padding: 0 1em;
257
254
  display: flex;
258
255
  }
259
- @media (max-width: 768px) {
256
+ @media (width <= 768px) {
260
257
  .n-mainMenu > .n-controls {
261
258
  width: 100%;
262
259
  }
@@ -272,18 +269,18 @@
272
269
  overflow: hidden;
273
270
  }
274
271
  .n-saves > .n-controls {
275
- width: 30vw;
276
- height: 100%;
277
272
  flex-direction: column;
278
273
  align-items: center;
274
+ width: 30vw;
275
+ height: 100%;
279
276
  padding: 0 1em;
280
277
  display: flex;
281
278
  }
282
279
  .n-saves > .n-list {
283
- width: 100%;
284
- height: 100%;
285
280
  flex-direction: column;
286
281
  align-items: center;
282
+ width: 100%;
283
+ height: 100%;
287
284
  padding: 0 1em;
288
285
  list-style: none;
289
286
  display: flex;
@@ -292,7 +289,7 @@
292
289
  .n-saves > .n-list > li {
293
290
  display: flex;
294
291
  }
295
- @media (max-width: 768px) {
292
+ @media (width <= 768px) {
296
293
  .n-saves {
297
294
  flex-direction: column;
298
295
  }
@@ -325,21 +322,21 @@
325
322
  overflow: hidden;
326
323
  }
327
324
  .n-settings .n-controls {
328
- width: 30vw;
329
- height: 100%;
330
325
  flex-direction: column;
331
326
  justify-content: center;
332
327
  align-items: center;
328
+ width: 30vw;
329
+ height: 100%;
333
330
  padding-left: 1em;
334
331
  display: flex;
335
332
  }
336
333
  .n-content {
337
- width: 100%;
338
- height: 100%;
339
334
  flex-direction: column;
340
335
  flex: 1 1 0;
341
336
  justify-content: center;
342
- align-items: center;
337
+ align-items: start;
338
+ width: 100%;
339
+ height: 100%;
343
340
  padding-left: 1em;
344
341
  list-style: none;
345
342
  display: flex;
@@ -380,15 +377,15 @@
380
377
  position: relative;
381
378
  }
382
379
  .n-lds-ellipsis div {
383
- width: 13px;
384
- height: 13px;
385
380
  background: #fff;
386
381
  border-radius: 50%;
382
+ width: 13px;
383
+ height: 13px;
387
384
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
388
385
  position: absolute;
389
386
  top: 33px;
390
387
  }
391
- .n-lds-ellipsis div:nth-child(1) {
388
+ .n-lds-ellipsis div:first-child {
392
389
  animation: .6s infinite n-lds-ellipsis1;
393
390
  left: 8px;
394
391
  }
package/dist/index.jsx CHANGED
@@ -124,24 +124,23 @@ var Character = (props) => {
124
124
  import { Dialog, DialogPanel } from "solid-headless";
125
125
 
126
126
  // ../typewriter/dist/index.js
127
- var C = () => Math.min(100 * Math.random() + 100, 140);
128
- var M = (h, d, c) => {
127
+ var M = (h, m, c, T = () => Math.min(90 * Math.random() + 100, 90)) => {
129
128
  let p, e = document.createElement("span");
130
- e.innerHTML = d;
131
- let o = (m, f) => {
132
- let a = [];
133
- return m.childNodes.forEach((n) => {
134
- n.nodeName === "#text" && (a.push(n), f && (n.textContent = "")), a.push(...o(n, f));
135
- }), a;
136
- }, r = o(e.cloneNode(true), false).map((m) => [...m.textContent]), T = o(e, true);
129
+ e.innerHTML = m;
130
+ let o = (a, f) => {
131
+ let d = [];
132
+ return a.childNodes.forEach((n) => {
133
+ n.nodeName === "#text" && (d.push(n), f && (n.textContent = "")), d.push(...o(n, f));
134
+ }), d;
135
+ }, r = o(e.cloneNode(true), false).map((a) => [...a.textContent]), C = o(e, true);
137
136
  h.appendChild(e);
138
137
  let t = 0, s = 0, l = false, i = () => {
139
138
  clearTimeout(p);
140
139
  }, u = () => {
141
- r[t]?.length > s ? (T[t].textContent += r[t][s++], setTimeout(u, C())) : t++ < r.length ? (s = 0, u()) : (l = true, c && (p = setTimeout(c, 790)));
140
+ r[t]?.length > s ? (C[t].textContent += r[t][s++], setTimeout(u, T())) : t++ < r.length ? (s = 0, u()) : (l = true, c && (p = setTimeout(c, 790)));
142
141
  };
143
142
  return u(), { end() {
144
- return l ? (i(), e.remove(), true) : (i(), e.innerHTML = d, l = true, false);
143
+ return l ? (i(), e.remove(), true) : (i(), e.innerHTML = m, l = true, false);
145
144
  }, destroy() {
146
145
  i(), e.remove();
147
146
  } };
@@ -164,10 +163,17 @@ var Game = (props) => {
164
163
  createEffect(() => {
165
164
  const [dialog, text] = getCurrentContent();
166
165
  writer?.destroy();
167
- writer = M(dialog ? store.dialogRef : store.textRef, dialog || text, () => {
168
- if (auto())
169
- untrack(clearTypewriterEffect);
170
- });
166
+ writer = M(
167
+ dialog ? store.dialogRef : store.textRef,
168
+ dialog || text,
169
+ () => {
170
+ if (auto())
171
+ untrack(clearTypewriterEffect);
172
+ },
173
+ () => {
174
+ return data.storeData().meta[1];
175
+ }
176
+ );
171
177
  });
172
178
  const onChoicesButtonClick = ([disabled, i]) => {
173
179
  if (disabled)
@@ -376,20 +382,26 @@ var Saves = (props) => {
376
382
  };
377
383
 
378
384
  // src/screens/settings.tsx
379
- import { Show as Show3, For as For3, createUniqueId, createMemo } from "solid-js";
385
+ import { For as For3, createUniqueId, createMemo } from "solid-js";
380
386
  var Settings = (props) => {
381
387
  const data = useData();
382
- const saves = () => data.storeData().saves;
383
388
  const language = () => data.storeData().meta[0];
389
+ const textSpeed = () => data.storeData().meta[1];
384
390
  const languageNames = createMemo(() => new Intl.DisplayNames([language()], {
385
391
  type: "language"
386
392
  }));
387
- const onSelect = ({ currentTarget }) => {
393
+ const onLanguageSelect = ({ currentTarget }) => {
388
394
  const selected = currentTarget.value;
389
395
  data.storeDataUpdate((prev) => {
390
396
  return prev.meta[0] = selected, prev;
391
397
  });
392
398
  };
399
+ const onSpeedSelect = ({ currentTarget }) => {
400
+ const selected = +currentTarget.value;
401
+ data.storeDataUpdate((prev) => {
402
+ return prev.meta[1] = selected, prev;
403
+ });
404
+ };
393
405
  const id = createUniqueId();
394
406
  return <div
395
407
  classList={{
@@ -401,10 +413,16 @@ var Settings = (props) => {
401
413
  <button type="button" class={join(root_module_default.button, root_module_default.buttonSettings)} onClick={() => props.setState("screen", "mainmenu")}>{data.t("HomeScreen")}</button>
402
414
  <button type="button" class={join(root_module_default.button, root_module_default.buttonSettings)} onClick={() => data.options.restore()}>{data.t("ToTheGame")}</button>
403
415
  </div>
404
- <Show3 when={saves()} fallback={data.t("NoSaves")}><div class={root_module_default.content}><div class={root_module_default.select}>
405
- <label for={id}>{data.t("Language")}</label>
406
- <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>
407
- </div></div></Show3>
416
+ <div class={root_module_default.content}>
417
+ <div class={root_module_default.select}>
418
+ <label for={id}>{data.t("Language")}</label>
419
+ <select id={id} onChange={onLanguageSelect}><For3 each={data.options.languages}>{(lang) => <option value={lang} selected={lang === language()}>{capitalize(languageNames().of(lang) || lang)}</option>}</For3></select>
420
+ </div>
421
+ <div class={root_module_default.select}>
422
+ <label for={id}>{data.t("TextSpeed")}</label>
423
+ <select id={id} onChange={onSpeedSelect}><For3 each={[90, 140, 190]}>{(speed) => <option value={speed} selected={speed === textSpeed()}>{speed}</option>}</For3></select>
424
+ </div>
425
+ </div>
408
426
  </div>;
409
427
  };
410
428
 
@@ -498,17 +516,25 @@ var createSolidRenderer = () => {
498
516
  };
499
517
  return render(head, left, right);
500
518
  },
501
- append(className, style) {
519
+ append(className, style, restoring) {
502
520
  clearTimeout(state.characters[character]?.timeoutId);
503
521
  if (className === state.characters[character]?.className) {
504
522
  setState("characters", character, { className: "" });
505
523
  }
506
- setTimeout(() => {
524
+ const show = () => {
507
525
  setState("characters", character, { className, style, visible: true });
508
- }, 4);
526
+ };
527
+ if (restoring)
528
+ return show();
529
+ setTimeout(show, 4);
509
530
  },
510
531
  remove(className, style, duration) {
511
- return (resolve) => {
532
+ return (resolve, restoring) => {
533
+ if (restoring) {
534
+ setState("characters", character, { visible: false });
535
+ resolve();
536
+ return;
537
+ }
512
538
  const timeoutId = setTimeout(() => {
513
539
  setState("characters", character, { visible: false });
514
540
  resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.0.0-beta.4",
3
+ "version": "0.0.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,13 +14,13 @@
14
14
  "build": "node ./build.js && tsc"
15
15
  },
16
16
  "devDependencies": {
17
- "esbuild": "^0.16.3",
17
+ "esbuild": "^0.16.17",
18
18
  "esbuild-css-modules-plugin": "^2.7.1",
19
19
  "typescript": "^4.9.5"
20
20
  },
21
21
  "dependencies": {
22
- "@novely/core": "*",
23
- "@novely/typewriter": "*",
22
+ "@novely/core": "workspace:*",
23
+ "@novely/typewriter": "^0.1.0",
24
24
  "solid-headless": "^0.13.1",
25
25
  "solid-js": "1.7.3"
26
26
  },