@novely/solid-renderer 0.30.1 → 0.31.0

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.
@@ -1,3 +1,5 @@
1
1
  import type { TypewriterSpeed } from '@novely/core';
2
+ import type { SettingsIcons } from './types';
2
3
  declare const TEXT_SPEED_MAP: Record<TypewriterSpeed, (() => number) | undefined>;
3
- export { TEXT_SPEED_MAP };
4
+ declare const settingsIcons: SettingsIcons;
5
+ export { TEXT_SPEED_MAP, settingsIcons };
package/dist/index.jsx CHANGED
@@ -4761,6 +4761,10 @@ var handleClearAction = ($rendererState, $contextState, context, keep, keepChara
4761
4761
  }
4762
4762
  );
4763
4763
  }
4764
+ const inputCleanup = $contextState.get().input.cleanup;
4765
+ if (inputCleanup) {
4766
+ inputCleanup();
4767
+ }
4764
4768
  if (!keep.has("input")) {
4765
4769
  $contextState.mutate(
4766
4770
  (s) => s.input,
@@ -4931,7 +4935,6 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
4931
4935
  input.setAttribute("required", "true");
4932
4936
  input.setAttribute("autocomplete", "off");
4933
4937
  !context.meta.preview && input.addEventListener("input", onInputHandler);
4934
- setup(input, (callback) => $contextState.mutate((s) => s.input.cleanup, () => callback));
4935
4938
  $contextState.mutate(
4936
4939
  (s) => s.input,
4937
4940
  {
@@ -4939,6 +4942,7 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
4939
4942
  label,
4940
4943
  error: "",
4941
4944
  visible: true,
4945
+ cleanup: setup(input) || noop,
4942
4946
  resolve
4943
4947
  }
4944
4948
  );
@@ -5917,6 +5921,16 @@ var TEXT_SPEED_MAP = {
5917
5921
  Fast: () => 60,
5918
5922
  Auto: void 0
5919
5923
  };
5924
+ var svg = (children2) => {
5925
+ return `<svg width="24" height="24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">${children2}</svg>`;
5926
+ };
5927
+ var settingsIcons = {
5928
+ language: svg('<circle cx="12" cy="12" r="7.25" /><path d="M15.25 12c0 4.5-2.007 7.25-3.25 7.25-1.243 0-3.25-2.75-3.25-7.25S10.757 4.75 12 4.75c1.243 0 3.25 2.75 3.25 7.25ZM5 12h14" />'),
5929
+ typewriter_speed: svg('<path d="M4.75 17.25 8 6.75l3.25 10.5M6 14.25h4M19.25 14.5a2.75 2.75 0 1 1-5.5 0 2.75 2.75 0 0 1 5.5 0ZM19.25 11.75v5.5" />'),
5930
+ music_volume: svg('<circle cx="7" cy="17" r="2.25" /><path d="M9.25 17V6.75a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2V14"/><circle cx="17" cy="14" r="2.25" />'),
5931
+ sound_volume: svg('<path d="M15.75 10.75s.5.484.5 1.25-.5 1.25-.5 1.25M17.75 7.75s1.5 1.25 1.5 4.249c0 2.998-1.5 4.25-1.5 4.25M13.25 4.75l-4.75 4H5.75a1 1 0 0 0-1 1v4.5a1 1 0 0 0 1 1H8.5l4.75 4V4.75Z"/>'),
5932
+ voice_volume: svg('<path d="M5.75 19.25v-.509a2 2 0 0 1 1.588-1.957l1.521-.32a1.752 1.752 0 0 0 1.391-1.714m8 4.5v-.509a2 2 0 0 0-1.588-1.957l-1.521-.32a1.751 1.751 0 0 1-1.391-1.714m-3.905-.467c-1.255-1.27-2.23-3.138-2.08-4.947C7.977 6.808 9.035 4.75 12 4.75c2.963 0 4.022 2.058 4.233 4.586.156 1.865-.706 3.792-2.017 5.062-1.234 1.197-3.161 1.109-4.37-.115Z"/>')
5933
+ };
5920
5934
 
5921
5935
  // src/components/Typewriter.tsx
5922
5936
  var _tmpl$18 = /* @__PURE__ */ template(`<span>`);
@@ -6034,7 +6048,7 @@ function destructure(source, options) {
6034
6048
  // src/screens/game.tsx
6035
6049
  var _tmpl$19 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
6036
6050
  var _tmpl$25 = /* @__PURE__ */ template(`<div class="dialog-container"><span class="dialog-fix" aria-hidden="true">&#8203;</span><div class="dialog-panel"><span class="dialog-panel-label">`);
6037
- var _tmpl$34 = /* @__PURE__ */ template(`<div class="dialog-container"><span class="dialog-fix" aria-hidden="true">&#8203;</span><div class="dialog-panel input-dialog-panel"><label for="novely-input" class="input-dialog-label"><span></span><span aria-live="polite" aria-atomic="true"></span></label><button type="submit" class="button dialog-input__button">`);
6051
+ var _tmpl$34 = /* @__PURE__ */ template(`<div class="dialog-container"><span class="dialog-fix" aria-hidden="true">&#8203;</span><div class="dialog-panel input-dialog-panel"><label for="novely-input" class="input-dialog-label"><span class="input-dialog-label-text"></span></label><span class="input-dialog-label-text input-dialog-label__error" aria-live="polite" aria-atomic="true"></span><button type="submit" class="button dialog-input__button">`);
6038
6052
  var _tmpl$44 = /* @__PURE__ */ template(`<div class="dialog-container"><span class="dialog-fix" aria-hidden="true">&#8203;</span><div class="dialog-backdrop"></div><div class="dialog-panel exit-dialog-panel"><span class="dialog-panel-label"></span><div class="exit-dialog-panel-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
6039
6053
  var _tmpl$53 = /* @__PURE__ */ template(`<button type="button" class="button control-panel__button">`);
6040
6054
  var _tmpl$62 = /* @__PURE__ */ template(`<span class="control-panel-container-fix" aria-hidden="true">&#8203;`);
@@ -6285,9 +6299,9 @@ var Game = (props) => {
6285
6299
  isOpen: () => input().visible,
6286
6300
  trapFocus: () => !props.isPreview && !rendererState().exitPromptShown,
6287
6301
  get children() {
6288
- const _el$11 = _tmpl$34(), _el$12 = _el$11.firstChild, _el$13 = _el$12.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.firstChild, _el$16 = _el$15.nextSibling, _el$17 = _el$14.nextSibling;
6302
+ const _el$11 = _tmpl$34(), _el$12 = _el$11.firstChild, _el$13 = _el$12.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.firstChild, _el$16 = _el$14.nextSibling, _el$17 = _el$16.nextSibling;
6289
6303
  insert(_el$15, () => input().label);
6290
- insert(_el$14, () => input().element, _el$16);
6304
+ insert(_el$14, () => input().element, null);
6291
6305
  insert(_el$16, () => input().error);
6292
6306
  _el$17.$$click = onInputButtonClick;
6293
6307
  insert(_el$17, () => data.t("Sumbit"));
@@ -6795,7 +6809,7 @@ var createRootComponent = ({
6795
6809
  emitter,
6796
6810
  controls,
6797
6811
  skipTypewriterWhenGoingBack,
6798
- settingsIcons,
6812
+ settingsIcons: settingsIcons2,
6799
6813
  rendererContext
6800
6814
  }) => {
6801
6815
  const Root = () => {
@@ -6877,7 +6891,7 @@ var createRootComponent = ({
6877
6891
  },
6878
6892
  get children() {
6879
6893
  return createComponent(Settings, {
6880
- icons: settingsIcons
6894
+ icons: settingsIcons2
6881
6895
  });
6882
6896
  }
6883
6897
  })];
@@ -6935,13 +6949,7 @@ var createSolidRenderer = ({
6935
6949
  controls = "outside",
6936
6950
  skipTypewriterWhenGoingBack = true,
6937
6951
  target = document.body,
6938
- settingsIcons = {
6939
- language: "🌎",
6940
- typewriter_speed: "⚡",
6941
- music_volume: "🎵",
6942
- sound_volume: "🔊",
6943
- voice_volume: "🗣️"
6944
- }
6952
+ settingsIcons: settingsIcons2 = settingsIcons
6945
6953
  } = {}) => {
6946
6954
  const emitter = createEmitter();
6947
6955
  const $rendererState = createRendererState({
@@ -7161,7 +7169,7 @@ var createSolidRenderer = ({
7161
7169
  emitter,
7162
7170
  controls,
7163
7171
  skipTypewriterWhenGoingBack,
7164
- settingsIcons,
7172
+ settingsIcons: settingsIcons2,
7165
7173
  rendererContext: renderer.getContext(options.mainContextKey),
7166
7174
  coreOptions: options,
7167
7175
  $rendererState,
@@ -610,18 +610,35 @@
610
610
  font-size: 1.2375rem;
611
611
  display: flex;
612
612
  }
613
- .input-dialog-label > span {
613
+ .input-dialog-label-text {
614
614
  min-height: 1rem;
615
615
  -webkit-tap-highlight-color: #0000;
616
616
  -webkit-tap-highlight-color: transparent;
617
617
  -webkit-touch-callout: none;
618
+ text-align: center;
619
+ width: 40vw;
618
620
  min-height: 1lh;
619
621
  margin: .4rem 0;
622
+ font-size: 1.2375rem;
620
623
  }
621
624
  .input-dialog-label > input {
622
625
  min-width: min(10rem, 100%);
623
626
  max-width: 100%;
624
627
  }
628
+ .input-dialog-label:has(input[type=checkbox]) {
629
+ flex-direction: row;
630
+ gap: 1.25rem;
631
+ }
632
+ .input-dialog-label:has(input[type=checkbox]) .input-dialog-label-text {
633
+ width: auto;
634
+ }
635
+ .input-dialog-label > input[type=checkbox] {
636
+ min-width: unset;
637
+ }
638
+ .input-dialog-label__error {
639
+ min-height: 2rem;
640
+ min-height: 2lh;
641
+ }
625
642
  .input-dialog-panel {
626
643
  color: var(--novely-input-dialog-color, #fff);
627
644
  border: var(--novely-input-dialog-border-width, .18rem) solid var(--novely-input-dialog-border-color, #fff);
@@ -633,6 +650,30 @@
633
650
  background-size: var(--novely-input-dialog-background-size, 6.25rem 6.25rem);
634
651
  justify-content: center;
635
652
  align-items: center;
653
+ min-width: 35vw;
654
+ }
655
+ @media (max-aspect-ratio: .8) {
656
+ .input-dialog-label-text {
657
+ width: calc(100vw - .5rem);
658
+ }
659
+ .input-dialog-label__error {
660
+ min-height: 3rem;
661
+ min-height: 3lh;
662
+ }
663
+ }
664
+
665
+ /* src/styles/input-dialog/input/input.css */
666
+ input[name=novely-input] {
667
+ border: none;
668
+ border-radius: .25rem;
669
+ padding: .25rem;
670
+ display: block;
671
+ position: relative;
672
+ }
673
+ input[name=novely-input][type=text],
674
+ input[name=novely-input][type=number],
675
+ input[name=novely-input][type=password] {
676
+ box-shadow: 0 0 0 var(--input-box-shadow-spread-radius, .15rem) var(--novely-input-border-color, #ffc7df);
636
677
  }
637
678
 
638
679
  /* src/styles/input-dialog/button/button.css */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.30.1",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,8 +19,8 @@
19
19
  "retrieved": "^0.1.0",
20
20
  "solid-js": "1.8.17",
21
21
  "solid-transition-group": "^0.2.3",
22
- "@novely/core": "0.33.1",
23
- "@novely/renderer-toolkit": "0.4.0",
22
+ "@novely/core": "0.34.0",
23
+ "@novely/renderer-toolkit": "0.5.0",
24
24
  "@novely/typewriter": "0.5.1"
25
25
  },
26
26
  "peerDependencies": {