@novely/solid-renderer 0.0.0-beta.2 → 0.0.0-beta.4

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
@@ -204,6 +204,10 @@
204
204
  align-items: stretch;
205
205
  display: flex;
206
206
  }
207
+ .n-headlessDialogPanelLabel {
208
+ user-select: none;
209
+ font-size: 1.2375em;
210
+ }
207
211
  @media (max-width: 768px) {
208
212
  .n-headlessDialogPanel {
209
213
  max-width: 95vw;
@@ -431,15 +435,17 @@
431
435
  text-align: center;
432
436
  justify-content: center;
433
437
  align-items: center;
434
- font-size: 1.2em;
435
- display: flex;
438
+ font-size: 1.5em;
439
+ display: none;
436
440
  position: absolute;
437
441
  inset: 0;
438
442
  }
439
443
  .n-fullscreenText[data-fullscreen-text-shown=true] {
440
- color: #fff;
441
- background: #000;
444
+ background: var(--novely-fullscreen-backgroun-color, #0000004d);
445
+ text-shadow: var(--novely-fullscreen-text-shadow, 2px 2px 4px #00000080);
446
+ color: var(--novely-fullscreen-text-color, white);
447
+ display: flex;
442
448
  }
443
- .n-fullscreenText[data-fullscreen-text-shown=true] > p {
449
+ .n-fullscreenText[data-fullscreen-text-shown=true] > span {
444
450
  cursor: pointer;
445
451
  }
package/dist/index.jsx CHANGED
@@ -56,7 +56,7 @@ var useData = () => {
56
56
  };
57
57
 
58
58
  // src/screens/game.tsx
59
- import { createEffect as createEffect2, createSignal, For, Show } from "solid-js";
59
+ import { createEffect, createSignal, untrack, For, Show } from "solid-js";
60
60
 
61
61
  // esbuild-css-modules-plugin-namespace:./src/styles/root.module.css?esbuild-css-modules-plugin-building
62
62
  var root_module_default = { "root": "n-root" };
@@ -71,7 +71,7 @@ var characters_module_default = { "characters": "n-characters" };
71
71
  var dialog_module_default = { "dialog": "n-dialog", "dialogContainer": "n-dialogContainer", "dialogContainerWithPerson": "n-dialogContainerWithPerson", "dialogContent": "n-dialogContent", "dialogName": "n-dialogName", "dialogPerson": "n-dialogPerson", "pers": "n-pers", "text": "n-text" };
72
72
 
73
73
  // esbuild-css-modules-plugin-namespace:./src/styles/headlessDialog.module.css?esbuild-css-modules-plugin-building
74
- var headlessDialog_module_default = { "headlessDialog": "n-headlessDialog", "headlessDialogContainer": "n-headlessDialogContainer", "headlessDialogFix": "n-headlessDialogFix", "headlessDialogPanel": "n-headlessDialogPanel", "inputDialogLabel": "n-inputDialogLabel", "inputDialogPanel": "n-inputDialogPanel" };
74
+ var headlessDialog_module_default = { "headlessDialog": "n-headlessDialog", "headlessDialogContainer": "n-headlessDialogContainer", "headlessDialogFix": "n-headlessDialogFix", "headlessDialogPanel": "n-headlessDialogPanel", "headlessDialogPanelLabel": "n-headlessDialogPanelLabel", "inputDialogLabel": "n-inputDialogLabel", "inputDialogPanel": "n-inputDialogPanel" };
75
75
 
76
76
  // esbuild-css-modules-plugin-namespace:./src/styles/mainMenu.module.css?esbuild-css-modules-plugin-building
77
77
  var mainMenu_module_default = { "controls": "n-controls", "mainMenu": "n-mainMenu" };
@@ -112,16 +112,11 @@ var DialogName = (props) => {
112
112
  };
113
113
 
114
114
  // src/components/Character.tsx
115
- import { createEffect } from "solid-js";
115
+ import { setAttribute, effect } from "solid-js/web";
116
116
  var Character = (props) => {
117
117
  const canvas = () => props.characters[props.character].canvas;
118
- createEffect(() => {
119
- void canvas().offsetWidth;
120
- if (props.data.className)
121
- canvas().classList.value = props.data.className;
122
- if (props.data.style)
123
- canvas().style.cssText = props.data.style;
124
- });
118
+ effect(() => setAttribute(canvas(), "class", props.data.className));
119
+ effect(() => setAttribute(canvas(), "style", props.data.style));
125
120
  return canvas();
126
121
  };
127
122
 
@@ -166,12 +161,12 @@ var Game = (props) => {
166
161
  const state = props.state;
167
162
  return [state.dialog.content, state.text.content];
168
163
  };
169
- createEffect2(() => {
164
+ createEffect(() => {
170
165
  const [dialog, text] = getCurrentContent();
171
166
  writer?.destroy();
172
167
  writer = M(dialog ? store.dialogRef : store.textRef, dialog || text, () => {
173
168
  if (auto())
174
- clearTypewriterEffect();
169
+ untrack(clearTypewriterEffect);
175
170
  });
176
171
  });
177
172
  const onChoicesButtonClick = ([disabled, i]) => {
@@ -240,7 +235,7 @@ var Game = (props) => {
240
235
  aria-hidden="true"
241
236
  >​</span>
242
237
  <DialogPanel class={root_module_default.headlessDialogPanel}>
243
- <p aria-hidden={!props.state.choices.question}>{props.state.choices.question || <>ᅠ</>}</p>
238
+ <span aria-hidden={!props.state.choices.question} class={root_module_default.headlessDialogPanelLabel}>{props.state.choices.question || <>ᅠ</>}</span>
244
239
  <For each={props.state.choices.choices}>{([text, _, active], i) => {
245
240
  const disabled = active ? !active() : false;
246
241
  const index = i();
@@ -275,7 +270,7 @@ var Game = (props) => {
275
270
  </DialogPanel>
276
271
  </div></Dialog>
277
272
  <div data-custom={true}><For each={layers()}>{(value) => value.dom}</For></div>
278
- <div class={root_module_default.fullscreenText} data-fullscreen-text-shown={Boolean(props.state.text.content)} onClick={clearTypewriterEffect}><p ref={store.textRef}> </p></div>
273
+ <div class={root_module_default.fullscreenText} data-fullscreen-text-shown={Boolean(props.state.text.content)} ref={store.textRef} onClick={clearTypewriterEffect}> </div>
279
274
  <div class={root_module_default.controlPanel}>
280
275
  <button
281
276
  type="button"
@@ -505,7 +500,12 @@ var createSolidRenderer = () => {
505
500
  },
506
501
  append(className, style) {
507
502
  clearTimeout(state.characters[character]?.timeoutId);
508
- setState("characters", character, { className, style, visible: true });
503
+ if (className === state.characters[character]?.className) {
504
+ setState("characters", character, { className: "" });
505
+ }
506
+ setTimeout(() => {
507
+ setState("characters", character, { className, style, visible: true });
508
+ }, 4);
509
509
  },
510
510
  remove(className, style, duration) {
511
511
  return (resolve) => {
@@ -567,16 +567,17 @@ var createSolidRenderer = () => {
567
567
  if (stored && stored.element.src.endsWith(source))
568
568
  return stored.element.currentTime = 0, stored;
569
569
  const element = new Audio(source);
570
+ const onClick = () => {
571
+ removeEventListener("click", onClick), element.play();
572
+ };
570
573
  const handle = {
571
574
  element,
572
575
  pause: element.pause,
573
576
  play() {
574
- const onClick = () => {
575
- removeEventListener("click", onClick), element.play();
576
- };
577
577
  addEventListener("click", onClick);
578
578
  },
579
579
  stop() {
580
+ removeEventListener("click", onClick);
580
581
  element.pause();
581
582
  element.currentTime = 0;
582
583
  }
@@ -591,18 +592,18 @@ var createSolidRenderer = () => {
591
592
  let clear = () => {
592
593
  };
593
594
  let store2 = {};
594
- const topLevelClear = () => {
595
+ const clearManager = () => {
595
596
  clear(), setState("layers", id, void 0);
596
597
  };
597
598
  const element = insert ? <div id={id} /> : null;
598
599
  setState("layers", id, {
599
600
  fn,
600
601
  dom: element,
601
- clear: topLevelClear,
602
+ clear: clearManager,
602
603
  value: {
603
604
  root,
604
605
  element,
605
- delete: topLevelClear,
606
+ delete: clearManager,
606
607
  data(data) {
607
608
  return data ? store2 = data : store2;
608
609
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.0.0-beta.2",
3
+ "version": "0.0.0-beta.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"