@novely/solid-renderer 0.38.0 → 0.40.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,9 +1,10 @@
1
1
  import type { Component } from 'solid-js';
2
2
  import type { Renderer, RendererInit } from '@novely/core';
3
3
  import type { Emitter } from '../emitter';
4
- import type { RendererStateStore, ContextStateStore, DeepAtom } from '@novely/renderer-toolkit';
4
+ import type { RendererStateStore, DeepAtom } from '@novely/renderer-toolkit';
5
5
  import type { EmitterEventsMap, RendererStoreExtension, SettingsIcons } from '../types';
6
6
  import type { Context } from '@novely/core';
7
+ import type { IContextState } from '../context-state';
7
8
  type CreateRootComponentOpts = {
8
9
  setRoot: (root: HTMLDivElement) => void;
9
10
  renderer: Renderer;
@@ -15,7 +16,7 @@ type CreateRootComponentOpts = {
15
16
  showAudioSettings: boolean;
16
17
  rendererContext: Context;
17
18
  coreOptions: RendererInit<any, any>;
18
- $contextState: DeepAtom<ContextStateStore<Record<PropertyKey, unknown>>>;
19
+ $contextState: IContextState;
19
20
  $rendererState: DeepAtom<RendererStateStore<RendererStoreExtension>>;
20
21
  };
21
22
  declare const createRootComponent: ({ $rendererState, $contextState, coreOptions, setRoot, renderer, showAudioSettings, fullscreen, emitter, controls, skipTypewriterWhenGoingBack, settingsIcons, rendererContext }: CreateRootComponentOpts) => Component;
@@ -1,2 +1,6 @@
1
- declare const useContextState: (id: string) => import("@novely/renderer-toolkit").DeepAtom<import("@novely/renderer-toolkit").ContextState>, removeContextState: (id: string) => void;
1
+ declare const useContextState: (id: string) => import("@novely/renderer-toolkit").DeepAtom<import("@novely/renderer-toolkit").ContextStateStore<{
2
+ images: Record<string, HTMLImageElement | undefined>;
3
+ }>>, removeContextState: (id: string) => void;
4
+ type IContextState = ReturnType<typeof useContextState>;
2
5
  export { useContextState, removeContextState };
6
+ export type { IContextState };
@@ -4,7 +4,6 @@ type ShowImageParams = {
4
4
  in?: string;
5
5
  class?: string;
6
6
  style?: string;
7
- position?: string;
8
7
  await?: boolean;
9
8
  };
10
9
  declare const showImage: (source: string, params?: ShowImageParams) => ValidAction;
package/dist/index.jsx CHANGED
@@ -623,19 +623,6 @@ function createProvider(id, options) {
623
623
  return res;
624
624
  };
625
625
  }
626
- function from(producer) {
627
- const [s, set] = createSignal(void 0, {
628
- equals: false
629
- });
630
- if ("subscribe" in producer) {
631
- const unsub = producer.subscribe((v) => set(() => v));
632
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
633
- } else {
634
- const clean2 = producer(set);
635
- onCleanup(clean2);
636
- }
637
- return s;
638
- }
639
626
  var FALLBACK = Symbol("fallback");
640
627
  function dispose(d) {
641
628
  for (let i = 0; i < d.length; i++) d[i]();
@@ -2882,6 +2869,7 @@ var handleInputAction = ($contextState, options, context, label, onInput, setup,
2882
2869
  const input = document.createElement("input");
2883
2870
  input.setAttribute("type", "text");
2884
2871
  input.setAttribute("name", "novely-input");
2872
+ input.setAttribute("id", "novely-input");
2885
2873
  input.setAttribute("required", "true");
2886
2874
  input.setAttribute("autocomplete", "off");
2887
2875
  !context.meta.preview && input.addEventListener("input", onInputHandler);
@@ -2935,7 +2923,11 @@ var createEmitter = () => {
2935
2923
  };
2936
2924
 
2937
2925
  // src/context-state.ts
2938
- var { useContextState, removeContextState } = createContextStateRoot();
2926
+ var { useContextState, removeContextState } = createContextStateRoot(() => {
2927
+ return {
2928
+ images: {}
2929
+ };
2930
+ });
2939
2931
 
2940
2932
  // src/shared.ts
2941
2933
  var PRELOADED_IMAGE_MAP = /* @__PURE__ */ new Map();
@@ -3079,6 +3071,13 @@ var createRetrieved = (fn) => {
3079
3071
  return value;
3080
3072
  };
3081
3073
  };
3074
+ var from = (producer) => {
3075
+ const [s, set] = createSignal(producer.get(), {
3076
+ equals: false
3077
+ });
3078
+ onCleanup(producer.subscribe(set));
3079
+ return s;
3080
+ };
3082
3081
 
3083
3082
  // src/hooks/useMedia.ts
3084
3083
  var useMedia = (media) => {
@@ -4145,27 +4144,19 @@ function destructure(source, options) {
4145
4144
  // src/screens/game.tsx
4146
4145
  var _tmpl$27 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
4147
4146
  var _tmpl$28 = /* @__PURE__ */ template(`<span class="dialog-label">`);
4148
- var _tmpl$34 = /* @__PURE__ */ template(`<label for="novely-input" class="input-dialog-label"><span class="input-dialog-label-text">`);
4149
- var _tmpl$44 = /* @__PURE__ */ template(`<span class="input-dialog-label-text input-dialog-label__error" aria-live="polite" aria-atomic="true">`);
4150
- var _tmpl$53 = /* @__PURE__ */ template(`<button type="submit" class="button dialog-input__button">`);
4151
- var _tmpl$62 = /* @__PURE__ */ template(`<div class="exit-dialog-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
4152
- var _tmpl$72 = /* @__PURE__ */ template(`<button type="button" class="button control-panel__button">`);
4153
- var _tmpl$82 = /* @__PURE__ */ template(`<span class="control-panel-container-fix" aria-hidden="true">&#8203;`);
4154
- var _tmpl$92 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
4155
- var _tmpl$102 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
4156
- var _tmpl$112 = /* @__PURE__ */ template(`<div><div class="characters"></div><div class="action-dialog"><div class="action-dialog-container" role="button" tabindex="0"><div class="action-dialog-content"></div></div></div><div></div><div class="action-text" role="button" tabindex="0">`);
4157
- var _tmpl$122 = /* @__PURE__ */ template(`<button type="button" class="button">`);
4147
+ var _tmpl$34 = /* @__PURE__ */ template(`<div class="choice-dialog__choices">`);
4148
+ var _tmpl$44 = /* @__PURE__ */ template(`<label for="novely-input" class="input-dialog__text input-dialog__label">`);
4149
+ var _tmpl$53 = /* @__PURE__ */ template(`<span class="input-dialog__text input-dialog__error" aria-live="polite" aria-atomic="true">`);
4150
+ var _tmpl$62 = /* @__PURE__ */ template(`<button type="submit" class="button dialog-input__button">`);
4151
+ var _tmpl$72 = /* @__PURE__ */ template(`<div class="exit-dialog-buttons"><button type="button" class="button"></button><button type="button" class="button">`);
4152
+ var _tmpl$82 = /* @__PURE__ */ template(`<button type="button" class="button control-panel__button">`);
4153
+ var _tmpl$92 = /* @__PURE__ */ template(`<span class="control-panel-container-fix" aria-hidden="true">&#8203;`);
4154
+ var _tmpl$102 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
4155
+ var _tmpl$112 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
4156
+ var _tmpl$122 = /* @__PURE__ */ template(`<div><div class="characters"></div><div class="action-dialog"><div class="action-dialog-container" role="button" tabindex="0"><div class="action-dialog-content"></div></div></div><div></div><div class="action-text" role="button" tabindex="0"></div><div class="action-image">`);
4157
+ var _tmpl$132 = /* @__PURE__ */ template(`<button type="button" class="button choice-dialog__choice"><span>`);
4158
4158
  var Game = (props) => {
4159
4159
  const data = useData();
4160
- const {
4161
- $contextState
4162
- } = props;
4163
- const contextState = () => {
4164
- const accessor = from($contextState);
4165
- return () => {
4166
- return accessor();
4167
- };
4168
- };
4169
4160
  const {
4170
4161
  text,
4171
4162
  dialog,
@@ -4173,8 +4164,9 @@ var Game = (props) => {
4173
4164
  choice,
4174
4165
  input,
4175
4166
  background,
4176
- custom
4177
- } = destructure(contextState());
4167
+ custom,
4168
+ images
4169
+ } = destructure(from(props.$contextState));
4178
4170
  const rendererState = from(data.$rendererState);
4179
4171
  const exitPromptShown = () => rendererState().exitPromptShown;
4180
4172
  const {
@@ -4237,8 +4229,11 @@ var Game = (props) => {
4237
4229
  return acc;
4238
4230
  }, 0);
4239
4231
  });
4232
+ createEffect(() => {
4233
+ console.log(images());
4234
+ });
4240
4235
  return (() => {
4241
- const _el$ = _tmpl$112(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$6 = _el$4.firstChild, _el$16 = _el$3.nextSibling, _el$17 = _el$16.nextSibling;
4236
+ const _el$ = _tmpl$122(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$6 = _el$4.firstChild, _el$16 = _el$3.nextSibling, _el$17 = _el$16.nextSibling, _el$23 = _el$17.nextSibling;
4242
4237
  insert(_el$, createComponent(Canvas, {
4243
4238
  "class": "background",
4244
4239
  resize: false,
@@ -4363,23 +4358,45 @@ var Game = (props) => {
4363
4358
  _v$2: void 0
4364
4359
  });
4365
4360
  return _el$7;
4366
- })(), createComponent(For, {
4367
- get each() {
4368
- return choice().choices;
4369
- },
4370
- children: ([text2, active], i) => {
4371
- const disabled = !active;
4372
- const index = i();
4373
- return (() => {
4374
- const _el$23 = _tmpl$122();
4375
- _el$23.$$click = onChoicesButtonClick;
4376
- _el$23.$$clickData = [disabled, index];
4377
- setAttribute(_el$23, "aria-disabled", disabled);
4378
- insert(_el$23, text2);
4379
- return _el$23;
4380
- })();
4381
- }
4382
- })];
4361
+ })(), (() => {
4362
+ const _el$8 = _tmpl$34();
4363
+ insert(_el$8, createComponent(For, {
4364
+ get each() {
4365
+ return choice().choices;
4366
+ },
4367
+ children: ([text2, active, visible, image], i) => {
4368
+ const disabled = !active;
4369
+ const index = i();
4370
+ return createComponent(Show, {
4371
+ when: visible,
4372
+ get children() {
4373
+ const _el$24 = _tmpl$132(), _el$25 = _el$24.firstChild;
4374
+ _el$24.$$click = onChoicesButtonClick;
4375
+ _el$24.$$clickData = [disabled, index];
4376
+ setAttribute(_el$24, "aria-disabled", disabled);
4377
+ insert(_el$25, text2);
4378
+ insert(_el$24, createComponent(Show, {
4379
+ when: image !== "",
4380
+ get children() {
4381
+ return createComponent(Canvas, {
4382
+ "class": "choice-dialog__choice-image",
4383
+ resize: false,
4384
+ render: async (canvas, ctx) => {
4385
+ const img = await imagePreloadWithCaching(image);
4386
+ canvas.width = img.width;
4387
+ canvas.height = img.height;
4388
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
4389
+ }
4390
+ });
4391
+ }
4392
+ }), null);
4393
+ return _el$24;
4394
+ }
4395
+ });
4396
+ }
4397
+ }));
4398
+ return _el$8;
4399
+ })()];
4383
4400
  }
4384
4401
  }), _el$16);
4385
4402
  insert(_el$, createComponent(Modal, {
@@ -4392,16 +4409,15 @@ var Game = (props) => {
4392
4409
  trapFocus: () => !props.isPreview && !exitPromptShown(),
4393
4410
  get children() {
4394
4411
  return [(() => {
4395
- const _el$8 = _tmpl$34(), _el$9 = _el$8.firstChild;
4412
+ const _el$9 = _tmpl$44();
4396
4413
  insert(_el$9, () => input().label);
4397
- insert(_el$8, () => input().element, null);
4398
- return _el$8;
4399
- })(), (() => {
4400
- const _el$10 = _tmpl$44();
4414
+ return _el$9;
4415
+ })(), createMemo(() => input().element), (() => {
4416
+ const _el$10 = _tmpl$53();
4401
4417
  insert(_el$10, () => input().error);
4402
4418
  return _el$10;
4403
4419
  })(), (() => {
4404
- const _el$11 = _tmpl$53();
4420
+ const _el$11 = _tmpl$62();
4405
4421
  _el$11.$$click = onInputButtonClick;
4406
4422
  insert(_el$11, () => data.t("Sumbit"));
4407
4423
  createRenderEffect(() => setAttribute(_el$11, "aria-disabled", Boolean(input().error)));
@@ -4420,7 +4436,7 @@ var Game = (props) => {
4420
4436
  insert(_el$12, () => data.t("ExitDialogWarning"));
4421
4437
  return _el$12;
4422
4438
  })(), (() => {
4423
- const _el$13 = _tmpl$62(), _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
4439
+ const _el$13 = _tmpl$72(), _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
4424
4440
  _el$14.$$click = () => {
4425
4441
  data.$rendererState.setKey("exitPromptShown", false);
4426
4442
  };
@@ -4467,7 +4483,7 @@ var Game = (props) => {
4467
4483
  return !props.isPreview;
4468
4484
  },
4469
4485
  get children() {
4470
- const _el$18 = _tmpl$102(), _el$22 = _el$18.firstChild;
4486
+ const _el$18 = _tmpl$112(), _el$22 = _el$18.firstChild;
4471
4487
  insert(_el$18, createComponent(Show, {
4472
4488
  get when() {
4473
4489
  return data.media.hyperWide();
@@ -4478,7 +4494,7 @@ var Game = (props) => {
4478
4494
  return !controlPanelMenuExpanded();
4479
4495
  },
4480
4496
  get children() {
4481
- const _el$19 = _tmpl$72();
4497
+ const _el$19 = _tmpl$82();
4482
4498
  _el$19.$$click = () => {
4483
4499
  setControlPanelMenuExpanded((prev) => !prev);
4484
4500
  };
@@ -4507,7 +4523,7 @@ var Game = (props) => {
4507
4523
  return createMemo(() => !!(data.media.hyperWide() && controlPanelMenuExpanded()))() && !exitPromptShown();
4508
4524
  },
4509
4525
  get children() {
4510
- return [_tmpl$82(), _tmpl$92()];
4526
+ return [_tmpl$92(), _tmpl$102()];
4511
4527
  }
4512
4528
  }), _el$22);
4513
4529
  use((element) => {
@@ -4540,7 +4556,13 @@ var Game = (props) => {
4540
4556
  });
4541
4557
  return _el$18;
4542
4558
  }
4543
- }), null);
4559
+ }), _el$23);
4560
+ insert(_el$23, createComponent(For, {
4561
+ get each() {
4562
+ return Object.values(images());
4563
+ },
4564
+ children: (image) => image
4565
+ }));
4544
4566
  createRenderEffect((_p$) => {
4545
4567
  const _v$7 = `${props.className || ""} game`, _v$8 = !!props.isPreview, _v$9 = charactersCount(), _v$10 = !!dialog().visible, _v$11 = !dialog().visible, _v$12 = !(dialog().miniature.character && dialog().miniature.emotion), _v$13 = !dialog().content, _v$14 = !!props.isPreview, _v$15 = !!Boolean(text().content), _v$16 = !text().content;
4546
4568
  _v$7 !== _p$._v$7 && className(_el$, _p$._v$7 = _v$7);
@@ -5049,42 +5071,39 @@ var createRootComponent = ({
5049
5071
  // src/custom-actions/show-hide-image.ts
5050
5072
  var SHOW_IMAGE = Symbol();
5051
5073
  var showImage = (source, params = {}) => {
5052
- const handler = ({ getDomNodes, clear, flags, data, rendererContext }) => {
5074
+ const handler = ({ contextKey, clear, flags, data, rendererContext }) => {
5075
+ const ctx = useContextState(contextKey);
5053
5076
  const { promise, resolve } = Promise.withResolvers();
5054
- const { element } = getDomNodes(true);
5055
- {
5056
- element.style.cssText += `position: fixed; inset: 0;`;
5057
- element.style.zIndex = String(params.z || 1);
5058
- }
5059
5077
  const image = document.createElement("img");
5060
5078
  {
5061
5079
  image.src = source;
5062
- image.className = params.class || "";
5080
+ image.className = "action-image__image " + (params.class || "");
5063
5081
  image.style.cssText = params.style || "";
5064
- image.style.cssText += `object-fit: cover; object-position: ${params.position || "50% 50%"}; width: 100vw; height: 100vh;`;
5082
+ image.style.setProperty("--z-index", String(params.z || 1));
5065
5083
  }
5066
- element.appendChild(image);
5084
+ ctx.mutate((s) => s.images[source], image);
5085
+ const inClasses = (params.in || "").split(" ");
5067
5086
  data({
5068
5087
  image,
5069
- in: params.in
5088
+ inClasses
5070
5089
  });
5071
5090
  let clearAnimation = noop;
5072
5091
  if (params.in && !flags.preview) {
5073
- const classes = params.in.split(" ");
5074
- image.classList.add(...classes);
5092
+ image.classList.add(...inClasses);
5093
+ if (params.await) {
5094
+ rendererContext.clearBlockingActions(void 0);
5095
+ }
5075
5096
  clearAnimation = () => {
5076
- image.classList.remove(...classes);
5077
- if (params.await) {
5078
- rendererContext.clearBlockingActions(void 0);
5079
- resolve();
5080
- }
5097
+ image.classList.remove(...inClasses);
5098
+ resolve();
5081
5099
  };
5082
5100
  image.addEventListener("animationend", clearAnimation, { once: true });
5101
+ } else {
5102
+ resolve();
5083
5103
  }
5084
5104
  clear(() => {
5085
5105
  data({});
5086
5106
  clearAnimation();
5087
- image.remove();
5088
5107
  });
5089
5108
  if (!params.await) {
5090
5109
  resolve();
@@ -5100,39 +5119,41 @@ var showImage = (source, params = {}) => {
5100
5119
  return ["custom", handler];
5101
5120
  };
5102
5121
  var hideImage = (source, params = {}) => {
5103
- const handler = async ({ data, rendererContext }) => {
5122
+ const handler = async ({ data, rendererContext, contextKey, flags }) => {
5123
+ const ctx = useContextState(contextKey);
5104
5124
  const { promise, resolve } = Promise.withResolvers();
5105
- const { image, in: inClasses } = data();
5125
+ const done = () => {
5126
+ ctx.mutate((s) => s.images[source], void 0);
5127
+ resolve();
5128
+ };
5129
+ const { image, inClasses } = data();
5106
5130
  if (!image) {
5107
5131
  resolve();
5108
5132
  return promise;
5109
5133
  }
5110
5134
  if (inClasses) {
5111
- const classes = inClasses.split(" ");
5112
- image.classList.remove(...classes);
5135
+ image.classList.remove(...inClasses);
5113
5136
  }
5114
- if (params.out) {
5137
+ if (params.out && !flags.preview) {
5115
5138
  const classes = params.out.split(" ");
5116
5139
  image.classList.add(...classes);
5140
+ rendererContext.clearBlockingActions(void 0);
5117
5141
  const onAnimationEnd = () => {
5118
5142
  image.classList.remove(...classes);
5119
- if (params.await) {
5120
- rendererContext.clearBlockingActions(void 0);
5121
- resolve();
5122
- }
5143
+ done();
5123
5144
  };
5124
5145
  image.addEventListener("animationend", onAnimationEnd, { once: true });
5125
5146
  if (!params.await) {
5126
- resolve();
5147
+ done();
5127
5148
  }
5128
5149
  } else {
5129
- resolve();
5150
+ done();
5130
5151
  }
5131
5152
  return promise;
5132
5153
  };
5133
5154
  handler.id = SHOW_IMAGE;
5134
5155
  handler.key = source;
5135
- handler.assets = [source];
5156
+ handler.assets = [];
5136
5157
  handler.skipOnRestore = (getNext) => {
5137
5158
  return getNext().some(([name, fn]) => name === "custom" && fn.key === source);
5138
5159
  };
@@ -26,7 +26,6 @@ declare const createSolidRenderer: ({ fullscreen, controls, skipTypewriterWhenGo
26
26
  in?: string;
27
27
  class?: string;
28
28
  style?: string;
29
- position?: string;
30
29
  await?: boolean;
31
30
  }) => import("@novely/core").ValidAction;
32
31
  hideImage: (source: string, params?: {
@@ -1,10 +1,10 @@
1
1
  import type { Context } from '@novely/core';
2
2
  import type { VoidComponent } from 'solid-js';
3
3
  import type { SolidRendererStore } from '../renderer';
4
- import type { ContextStateStore, DeepAtom } from '@novely/renderer-toolkit';
4
+ import type { IContextState } from '../context-state';
5
5
  interface GameProps {
6
6
  context: Context;
7
- $contextState: DeepAtom<ContextStateStore<Record<PropertyKey, unknown>>>;
7
+ $contextState: IContextState;
8
8
  store: SolidRendererStore;
9
9
  controls: 'inside' | 'outside';
10
10
  skipTypewriterWhenGoingBack: boolean;
@@ -566,6 +566,28 @@
566
566
 
567
567
  /* src/styles/action-dialog/index.css */
568
568
 
569
+ /* src/styles/custom-actions/image/image.css */
570
+ .action-image {
571
+ z-index: 1;
572
+ position: fixed;
573
+ top: 0;
574
+ bottom: 0;
575
+ left: 0;
576
+ right: 0;
577
+ }
578
+ .action-image__image {
579
+ z-index: var(--z-index, 1);
580
+ object-fit: cover;
581
+ object-position: 50% 50%;
582
+ width: 100vw;
583
+ height: 100vh;
584
+ position: absolute;
585
+ }
586
+
587
+ /* src/styles/custom-actions/image/index.css */
588
+
589
+ /* src/styles/custom-actions/index.css */
590
+
569
591
  /* src/styles/dialog/dialog.css */
570
592
  .dialog {
571
593
  z-index: 25;
@@ -614,18 +636,34 @@
614
636
  border: none;
615
637
  }
616
638
 
617
- /* src/styles/choice-dialog/index.css */
618
-
619
- /* src/styles/input-dialog/input-dialog.css */
620
- .input-dialog-label {
639
+ /* src/styles/choice-dialog/choices.css */
640
+ .choice-dialog__choices {
621
641
  flex-direction: column;
622
- justify-content: center;
623
- align-items: center;
624
642
  width: 100%;
625
- font-size: 1.2375rem;
643
+ height: 100%;
626
644
  display: flex;
627
645
  }
628
- .input-dialog-label-text {
646
+ .choice-dialog__choices:has(.choice-dialog__choice-image) {
647
+ flex-direction: row;
648
+ gap: .5rem;
649
+ }
650
+ .choice-dialog__choice {
651
+ flex-direction: column;
652
+ align-items: center;
653
+ display: flex;
654
+ }
655
+ .choice-dialog__choice:has(.choice-dialog__choice-image) {
656
+ flex-grow: 1;
657
+ }
658
+ .choice-dialog__choice-image {
659
+ max-width: 25vw;
660
+ max-height: 25vh;
661
+ }
662
+
663
+ /* src/styles/choice-dialog/index.css */
664
+
665
+ /* src/styles/input-dialog/input-dialog.css */
666
+ .input-dialog__text {
629
667
  min-height: 1rem;
630
668
  -webkit-tap-highlight-color: #0000;
631
669
  -webkit-tap-highlight-color: transparent;
@@ -636,23 +674,13 @@
636
674
  margin: .4rem 0;
637
675
  font-size: 1.2375rem;
638
676
  }
639
- .input-dialog-label > input {
640
- min-width: min(10rem, 100%);
641
- max-width: 100%;
642
- }
643
- .input-dialog-label:has(input[type=checkbox]) {
644
- flex-direction: row;
645
- gap: 1.25rem;
646
- }
647
- .input-dialog-label:has(input[type=checkbox]) .input-dialog-label-text {
677
+ .input-dialog__label {
648
678
  width: auto;
679
+ margin-bottom: .6rem;
649
680
  }
650
- .input-dialog-label > input[type=checkbox] {
651
- min-width: unset;
652
- }
653
- .input-dialog-label__error {
654
- min-height: 2rem;
655
- min-height: 2lh;
681
+ .input-dialog__error {
682
+ min-height: 1rem;
683
+ min-height: 1lh;
656
684
  }
657
685
  .input-dialog {
658
686
  color: var(--novely-input-dialog-color, #fff);
@@ -668,10 +696,10 @@
668
696
  min-width: 35vw;
669
697
  }
670
698
  @media (max-aspect-ratio: .8) {
671
- .input-dialog-label-text {
699
+ .input-dialog__text {
672
700
  width: calc(100vw - .5rem);
673
701
  }
674
- .input-dialog-label__error {
702
+ .input-dialog__error {
675
703
  min-height: 3rem;
676
704
  min-height: 3lh;
677
705
  }
@@ -681,6 +709,8 @@
681
709
  input[name=novely-input] {
682
710
  border: none;
683
711
  border-radius: .25rem;
712
+ min-width: min(10rem, 100%);
713
+ max-width: 100%;
684
714
  padding: .25rem;
685
715
  display: block;
686
716
  position: relative;
@@ -689,6 +719,16 @@ input[name=novely-input][type=text],
689
719
  input[name=novely-input][type=number],
690
720
  input[name=novely-input][type=password] {
691
721
  box-shadow: 0 0 0 var(--input-box-shadow-spread-radius, .15rem) var(--novely-input-border-color, #ffc7df);
722
+ outline-offset: var(--input-box-shadow-spread-radius, .15rem);
723
+ }
724
+ input[name=novely-input][type=checkbox] {
725
+ min-width: unset;
726
+ }
727
+ @supports ((-webkit-appearance: none)) {
728
+ input[name=novely-input][type=number] {
729
+ -webkit-appearance: textfield;
730
+ appearance: textfield;
731
+ }
692
732
  }
693
733
 
694
734
  /* src/styles/input-dialog/button/button.css */
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Atom } from '@novely/renderer-toolkit';
2
+ import type { Stored } from '@novely/core';
1
3
  declare const capitalize: (str: string) => string;
2
4
  declare const isCSSImage: (str: string) => boolean;
3
5
  declare const createImage: (src: string) => HTMLImageElement;
@@ -28,4 +30,8 @@ declare const getDocumentStyles: () => string;
28
30
  */
29
31
  declare const once: (fn: () => void) => () => void;
30
32
  declare const createRetrieved: <T>(fn: () => T) => () => T;
31
- export { createRetrieved, isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, simple, getDocumentStyles, once, imageLoaded, imagePreloadWithCaching, imagePreloadWithCachingNotComplete };
33
+ /**
34
+ * Like solid-js's from, but has initial value
35
+ */
36
+ declare const from: <T>(producer: Atom<T> | Stored<T>) => import("solid-js").Accessor<T>;
37
+ export { createRetrieved, isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, simple, getDocumentStyles, once, imageLoaded, imagePreloadWithCaching, imagePreloadWithCachingNotComplete, from };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -19,8 +19,8 @@
19
19
  "clsx": "^2.1.1",
20
20
  "solid-js": "1.8.21",
21
21
  "solid-transition-group": "^0.2.3",
22
- "@novely/core": "0.40.0",
23
- "@novely/renderer-toolkit": "0.9.0",
22
+ "@novely/core": "0.44.0",
23
+ "@novely/renderer-toolkit": "0.10.0",
24
24
  "@novely/typewriter": "0.5.1"
25
25
  },
26
26
  "peerDependencies": {