@novely/solid-renderer 0.34.0 → 0.34.1-beta.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.
@@ -0,0 +1,8 @@
1
+ import type { JSX, VoidComponent } from 'solid-js';
2
+ type NativeCanvasProps = JSX.CanvasHTMLAttributes<HTMLCanvasElement>;
3
+ type CanvasProps = Omit<NativeCanvasProps, 'ref'> & {
4
+ resize?: boolean;
5
+ render: (canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D) => void;
6
+ };
7
+ declare const Canvas: VoidComponent<CanvasProps>;
8
+ export { Canvas };
@@ -6,3 +6,4 @@ export { Modal } from './Modal';
6
6
  export { Save } from './Save';
7
7
  export { createTypewriter } from './Typewriter';
8
8
  export { createRootComponent } from './Root';
9
+ export { Canvas } from './Canvas';
package/dist/index.jsx CHANGED
@@ -3179,6 +3179,63 @@ function mergeProps(...sources) {
3179
3179
  }
3180
3180
  return target;
3181
3181
  }
3182
+ function splitProps(props, ...keys2) {
3183
+ if ($PROXY in props) {
3184
+ const blocked = new Set(keys2.length > 1 ? keys2.flat() : keys2[0]);
3185
+ const res = keys2.map((k) => {
3186
+ return new Proxy(
3187
+ {
3188
+ get(property) {
3189
+ return k.includes(property) ? props[property] : void 0;
3190
+ },
3191
+ has(property) {
3192
+ return k.includes(property) && property in props;
3193
+ },
3194
+ keys() {
3195
+ return k.filter((property) => property in props);
3196
+ }
3197
+ },
3198
+ propTraps
3199
+ );
3200
+ });
3201
+ res.push(
3202
+ new Proxy(
3203
+ {
3204
+ get(property) {
3205
+ return blocked.has(property) ? void 0 : props[property];
3206
+ },
3207
+ has(property) {
3208
+ return blocked.has(property) ? false : property in props;
3209
+ },
3210
+ keys() {
3211
+ return Object.keys(props).filter((k) => !blocked.has(k));
3212
+ }
3213
+ },
3214
+ propTraps
3215
+ )
3216
+ );
3217
+ return res;
3218
+ }
3219
+ const otherObject = {};
3220
+ const objects = keys2.map(() => ({}));
3221
+ for (const propName of Object.getOwnPropertyNames(props)) {
3222
+ const desc = Object.getOwnPropertyDescriptor(props, propName);
3223
+ const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
3224
+ let blocked = false;
3225
+ let objectIndex = 0;
3226
+ for (const k of keys2) {
3227
+ if (k.includes(propName)) {
3228
+ blocked = true;
3229
+ isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
3230
+ }
3231
+ ++objectIndex;
3232
+ }
3233
+ if (!blocked) {
3234
+ isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
3235
+ }
3236
+ }
3237
+ return [...objects, otherObject];
3238
+ }
3182
3239
  var counter = 0;
3183
3240
  function createUniqueId() {
3184
3241
  const ctx = sharedConfig.context;
@@ -4989,6 +5046,26 @@ var createImage = (src) => {
4989
5046
  });
4990
5047
  return img;
4991
5048
  };
5049
+ var imageLoaded = (image) => {
5050
+ const { promise, resolve } = Promise.withResolvers();
5051
+ if (image.complete && image.naturalHeight !== 0) {
5052
+ return resolve(true);
5053
+ }
5054
+ image.addEventListener("load", async () => {
5055
+ if (image.decode) {
5056
+ await image.decode().catch(() => {
5057
+ });
5058
+ }
5059
+ resolve(true);
5060
+ });
5061
+ image.addEventListener("abort", () => {
5062
+ resolve(false);
5063
+ });
5064
+ image.addEventListener("error", () => {
5065
+ resolve(false);
5066
+ });
5067
+ return promise;
5068
+ };
4992
5069
  var createCanvas = () => {
4993
5070
  return document.createElement("canvas");
4994
5071
  };
@@ -5660,27 +5737,7 @@ var Save = (props) => {
5660
5737
  }, 1e3);
5661
5738
  try {
5662
5739
  await options.preview(props.save, KEY);
5663
- const background = useContextState(KEY).get().background.background;
5664
- if (!background || !isCSSImage(background)) {
5665
- return previewDone();
5666
- }
5667
- if (PRELOADED_IMAGE_MAP.has(background)) {
5668
- return previewDone();
5669
- }
5670
- const backgroundElement = context.root.querySelector("img.background");
5671
- if (!backgroundElement) {
5672
- return previewDone();
5673
- }
5674
- if (backgroundElement.complete && backgroundElement.naturalHeight !== 0) {
5675
- return previewDone();
5676
- }
5677
- const onLoadingStatusChange = () => {
5678
- backgroundElement.removeEventListener("load", onLoadingStatusChange);
5679
- backgroundElement.removeEventListener("error", onLoadingStatusChange);
5680
- previewDone();
5681
- };
5682
- backgroundElement.addEventListener("load", onLoadingStatusChange);
5683
- backgroundElement.addEventListener("error", onLoadingStatusChange);
5740
+ return previewDone();
5684
5741
  } catch {
5685
5742
  return previewDone();
5686
5743
  }
@@ -5994,6 +6051,53 @@ var createTypewriter = ({
5994
6051
  };
5995
6052
  };
5996
6053
 
6054
+ // src/components/Canvas.tsx
6055
+ var _tmpl$19 = /* @__PURE__ */ template(`<canvas>`);
6056
+ var Canvas = (props) => {
6057
+ const [local, rest] = splitProps(props, ["resize", "render"]);
6058
+ const [canvas, setCanvas] = createSignal();
6059
+ const ctx = createMemo(() => canvas()?.getContext("2d"));
6060
+ createEffect(() => {
6061
+ const canvasElement = canvas();
6062
+ const canvasContext = ctx();
6063
+ if (canvasElement && canvasContext) {
6064
+ try {
6065
+ local.render(canvasElement, canvasContext);
6066
+ } catch {
6067
+ }
6068
+ }
6069
+ });
6070
+ const onResize = () => {
6071
+ if (!local.resize)
6072
+ return;
6073
+ const canvasElement = untrack(canvas);
6074
+ const canvasContext = untrack(ctx);
6075
+ if (canvasElement) {
6076
+ canvasElement.width = window.innerWidth * devicePixelRatio;
6077
+ canvasElement.height = window.innerHeight * devicePixelRatio;
6078
+ if (canvasContext) {
6079
+ untrack(() => {
6080
+ try {
6081
+ local.render(canvasElement, canvasContext);
6082
+ } catch {
6083
+ }
6084
+ });
6085
+ }
6086
+ }
6087
+ };
6088
+ onMount(onResize);
6089
+ addEventListener("resize", onResize);
6090
+ onCleanup(() => {
6091
+ removeEventListener("resize", onResize);
6092
+ });
6093
+ return (() => {
6094
+ const _el$ = _tmpl$19();
6095
+ use(setCanvas, _el$);
6096
+ spread(_el$, rest, false, false);
6097
+ return _el$;
6098
+ })();
6099
+ };
6100
+
5997
6101
  // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.17/node_modules/@solid-primitives/destructure/dist/index.js
5998
6102
  var isReactiveObject = (value) => typeof value === "object" && value !== null;
5999
6103
  function createProxyCache(obj, get) {
@@ -6040,7 +6144,7 @@ function destructure(source, options) {
6040
6144
  }
6041
6145
 
6042
6146
  // src/screens/game.tsx
6043
- var _tmpl$19 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
6147
+ var _tmpl$20 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
6044
6148
  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">`);
6045
6149
  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">`);
6046
6150
  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">`);
@@ -6049,8 +6153,7 @@ var _tmpl$62 = /* @__PURE__ */ template(`<span class="control-panel-container-fi
6049
6153
  var _tmpl$72 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
6050
6154
  var _tmpl$82 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
6051
6155
  var _tmpl$92 = /* @__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">`);
6052
- var _tmpl$102 = /* @__PURE__ */ template(`<div class="background">`);
6053
- var _tmpl$112 = /* @__PURE__ */ template(`<button type="button" class="button">`);
6156
+ var _tmpl$102 = /* @__PURE__ */ template(`<button type="button" class="button">`);
6054
6157
  var Game = (props) => {
6055
6158
  const data = useData();
6056
6159
  const {
@@ -6127,14 +6230,6 @@ var Game = (props) => {
6127
6230
  setControlPanelMenuExpanded(false);
6128
6231
  }
6129
6232
  });
6130
- const bg = () => {
6131
- const bg2 = background().background;
6132
- const isImage = isCSSImage(bg2);
6133
- return {
6134
- "background-image": isImage ? bg2 : void 0,
6135
- "background-color": isImage ? void 0 : bg2
6136
- };
6137
- };
6138
6233
  const charactersCount = createMemo(() => {
6139
6234
  return Object.values(characters()).reduce((acc, c) => {
6140
6235
  if (c && c.visible) {
@@ -6145,33 +6240,28 @@ var Game = (props) => {
6145
6240
  });
6146
6241
  return (() => {
6147
6242
  const _el$ = _tmpl$92(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$6 = _el$4.firstChild, _el$26 = _el$3.nextSibling, _el$27 = _el$26.nextSibling;
6148
- insert(_el$, createComponent(Show, {
6149
- get when() {
6150
- return bg()["background-image"];
6151
- },
6152
- get fallback() {
6153
- return (() => {
6154
- const _el$33 = _tmpl$102();
6155
- createRenderEffect((_$p) => style(_el$33, bg(), _$p));
6156
- return _el$33;
6157
- })();
6158
- },
6159
- keyed: true,
6160
- children: (src) => {
6161
- let img = PRELOADED_IMAGE_MAP.get(src);
6162
- if (img) {
6163
- const image = img.isConnected ? img.cloneNode(true) : img;
6164
- return Object.assign(image, {
6165
- className: "background"
6166
- });
6243
+ insert(_el$, createComponent(Canvas, {
6244
+ "class": "background",
6245
+ resize: false,
6246
+ render: async (canvas, ctx) => {
6247
+ const bg = background().background;
6248
+ const isColor = !isCSSImage(bg);
6249
+ if (isColor) {
6250
+ ctx.fillStyle = bg;
6251
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
6252
+ } else {
6253
+ const img = PRELOADED_IMAGE_MAP.get(bg) || createImage(bg);
6254
+ await imageLoaded(img);
6255
+ if (!PRELOADED_IMAGE_MAP.has(bg)) {
6256
+ PRELOADED_IMAGE_MAP.set(bg, img);
6257
+ }
6258
+ if (bg !== background().background) {
6259
+ return;
6260
+ }
6261
+ canvas.width = img.width;
6262
+ canvas.height = img.height;
6263
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
6167
6264
  }
6168
- img = createImage(src);
6169
- img.addEventListener("load", () => {
6170
- PRELOADED_IMAGE_MAP.set(src, img);
6171
- });
6172
- return Object.assign(img, {
6173
- className: "background"
6174
- });
6175
6265
  }
6176
6266
  }), _el$2);
6177
6267
  setAttribute(_el$2, "data-characters", true);
@@ -6213,7 +6303,7 @@ var Game = (props) => {
6213
6303
  return dialog().miniature.emotion;
6214
6304
  },
6215
6305
  get children() {
6216
- const _el$5 = _tmpl$19();
6306
+ const _el$5 = _tmpl$20();
6217
6307
  insert(_el$5, createComponent(Show, {
6218
6308
  get when() {
6219
6309
  return dialog().miniature.emotion;
@@ -6269,12 +6359,12 @@ var Game = (props) => {
6269
6359
  const disabled = !active;
6270
6360
  const index = i();
6271
6361
  return (() => {
6272
- const _el$34 = _tmpl$112();
6273
- _el$34.$$click = onChoicesButtonClick;
6274
- _el$34.$$clickData = [disabled, index];
6275
- setAttribute(_el$34, "aria-disabled", disabled);
6276
- insert(_el$34, text2);
6277
- return _el$34;
6362
+ const _el$33 = _tmpl$102();
6363
+ _el$33.$$click = onChoicesButtonClick;
6364
+ _el$33.$$clickData = [disabled, index];
6365
+ setAttribute(_el$33, "aria-disabled", disabled);
6366
+ insert(_el$33, text2);
6367
+ return _el$33;
6278
6368
  })();
6279
6369
  }
6280
6370
  }), null);
@@ -6460,18 +6550,18 @@ var Game = (props) => {
6460
6550
  delegateEvents(["click", "keydown"]);
6461
6551
 
6462
6552
  // src/screens/loading.tsx
6463
- var _tmpl$20 = /* @__PURE__ */ template(`<div class="loading"><div class="loading__animation"><div></div><div></div><div></div><div>`);
6553
+ var _tmpl$21 = /* @__PURE__ */ template(`<div class="loading"><div class="loading__animation"><div></div><div></div><div></div><div>`);
6464
6554
  var Loading = (props) => {
6465
6555
  return (() => {
6466
- const _el$ = _tmpl$20();
6556
+ const _el$ = _tmpl$21();
6467
6557
  createRenderEffect(() => _el$.classList.toggle("overlay", !!props.overlay));
6468
6558
  return _el$;
6469
6559
  })();
6470
6560
  };
6471
6561
 
6472
6562
  // src/screens/mainmenu.tsx
6473
- var _tmpl$21 = /* @__PURE__ */ template(`<div class="main-menu"><div class="main-menu__controls"><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text">`);
6474
- var _tmpl$26 = /* @__PURE__ */ template(`<button>`);
6563
+ var _tmpl$26 = /* @__PURE__ */ template(`<div class="main-menu"><div class="main-menu__controls"><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text"></span></button><button type="button" class="button main-menu__button"><span class="main-menu__button__text">`);
6564
+ var _tmpl$27 = /* @__PURE__ */ template(`<button>`);
6475
6565
  var MainMenu = () => {
6476
6566
  const {
6477
6567
  t,
@@ -6488,7 +6578,7 @@ var MainMenu = () => {
6488
6578
  $rendererState.mutate((s) => s.screen, screen);
6489
6579
  });
6490
6580
  return (() => {
6491
- const _el$ = _tmpl$21(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$10 = _el$9.firstChild;
6581
+ const _el$ = _tmpl$26(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$10 = _el$9.firstChild;
6492
6582
  _el$3.$$click = () => {
6493
6583
  options.newGame();
6494
6584
  };
@@ -6527,7 +6617,7 @@ var MainMenu = () => {
6527
6617
  return rendererStore().mainmenu;
6528
6618
  },
6529
6619
  children: (item) => (() => {
6530
- const _el$11 = _tmpl$26();
6620
+ const _el$11 = _tmpl$27();
6531
6621
  spread(_el$11, mergeProps(() => item(goto)), false, false);
6532
6622
  return _el$11;
6533
6623
  })()
@@ -6539,8 +6629,8 @@ var MainMenu = () => {
6539
6629
  delegateEvents(["click"]);
6540
6630
 
6541
6631
  // src/screens/saves.tsx
6542
- var _tmpl$27 = /* @__PURE__ */ template(`<ol class="saves__list">`);
6543
- var _tmpl$28 = /* @__PURE__ */ template(`<div class="saves"><div class="saves__controls"><button type="button" class="button saves__button"></button></div><div class="saves__list-container">`);
6632
+ var _tmpl$28 = /* @__PURE__ */ template(`<ol class="saves__list">`);
6633
+ var _tmpl$29 = /* @__PURE__ */ template(`<div class="saves"><div class="saves__controls"><button type="button" class="button saves__button"></button></div><div class="saves__list-container">`);
6544
6634
  var _tmpl$35 = /* @__PURE__ */ template(`<div class="saves__list saves__list--empty">`);
6545
6635
  var Saves = () => {
6546
6636
  const {
@@ -6612,7 +6702,7 @@ var Saves = () => {
6612
6702
  return !targets.every((item) => completed.includes(item));
6613
6703
  };
6614
6704
  return (() => {
6615
- const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
6705
+ const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
6616
6706
  _el$3.$$click = () => {
6617
6707
  $rendererState.setKey("screen", "mainmenu");
6618
6708
  };
@@ -6629,7 +6719,7 @@ var Saves = () => {
6629
6719
  })();
6630
6720
  },
6631
6721
  get children() {
6632
- const _el$5 = _tmpl$27();
6722
+ const _el$5 = _tmpl$28();
6633
6723
  use(setList, _el$5);
6634
6724
  insert(_el$5, createComponent(For, {
6635
6725
  get each() {
@@ -6660,7 +6750,7 @@ var Saves = () => {
6660
6750
  delegateEvents(["click"]);
6661
6751
 
6662
6752
  // src/screens/settings.tsx
6663
- var _tmpl$29 = /* @__PURE__ */ template(`<div class="root settings"><div class="settings__controls"><button type="button" class="button settings__button"></button><button type="button" class="button settings__button"></button></div><div class="settings__options"><div><div class="select"><label class="select__label"><span class="select__label__icon"></span> </label><select class="select__select"></select></div><div class="select"><label class="select__label"><span class="select__label__icon"></span> </label><select class="select__select"></select></div></div><div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01"></div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01"></div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01">`);
6753
+ var _tmpl$30 = /* @__PURE__ */ template(`<div class="root settings"><div class="settings__controls"><button type="button" class="button settings__button"></button><button type="button" class="button settings__button"></button></div><div class="settings__options"><div><div class="select"><label class="select__label"><span class="select__label__icon"></span> </label><select class="select__select"></select></div><div class="select"><label class="select__label"><span class="select__label__icon"></span> </label><select class="select__select"></select></div></div><div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01"></div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01"></div><div class="range"><label class="range__label"><span class="range__label__icon"></span> </label><input class="range__range" type="range" min="0" max="1" step="0.01">`);
6664
6754
  var _tmpl$210 = /* @__PURE__ */ template(`<option>`);
6665
6755
  var Settings = (props) => {
6666
6756
  const {
@@ -6712,7 +6802,7 @@ var Settings = (props) => {
6712
6802
  const soundVolumeSelectID = createUniqueId();
6713
6803
  const voiceVolumeSelectID = createUniqueId();
6714
6804
  return (() => {
6715
- const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.firstChild, _el$10 = _el$9.nextSibling, _el$11 = _el$8.nextSibling, _el$12 = _el$7.nextSibling, _el$13 = _el$12.firstChild, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$13.nextSibling, _el$17 = _el$6.nextSibling, _el$18 = _el$17.firstChild, _el$19 = _el$18.firstChild, _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$19.nextSibling, _el$23 = _el$18.nextSibling, _el$24 = _el$23.firstChild, _el$25 = _el$24.firstChild, _el$26 = _el$25.nextSibling, _el$27 = _el$24.nextSibling, _el$28 = _el$23.nextSibling, _el$29 = _el$28.firstChild, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$29.nextSibling;
6805
+ const _el$ = _tmpl$30(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.firstChild, _el$10 = _el$9.nextSibling, _el$11 = _el$8.nextSibling, _el$12 = _el$7.nextSibling, _el$13 = _el$12.firstChild, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$13.nextSibling, _el$17 = _el$6.nextSibling, _el$18 = _el$17.firstChild, _el$19 = _el$18.firstChild, _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$19.nextSibling, _el$23 = _el$18.nextSibling, _el$24 = _el$23.firstChild, _el$25 = _el$24.firstChild, _el$26 = _el$25.nextSibling, _el$27 = _el$24.nextSibling, _el$28 = _el$23.nextSibling, _el$29 = _el$28.firstChild, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$29.nextSibling;
6716
6806
  _el$3.$$click = () => {
6717
6807
  $rendererState.setKey("screen", "mainmenu");
6718
6808
  };
@@ -6792,7 +6882,7 @@ var Settings = (props) => {
6792
6882
  delegateEvents(["click"]);
6793
6883
 
6794
6884
  // src/components/Root.tsx
6795
- var _tmpl$30 = /* @__PURE__ */ template(`<div class="root">`);
6885
+ var _tmpl$31 = /* @__PURE__ */ template(`<div class="root">`);
6796
6886
  var createRootComponent = ({
6797
6887
  $rendererState,
6798
6888
  $contextState,
@@ -6827,7 +6917,7 @@ var createRootComponent = ({
6827
6917
  emitter.emit("screen:change", currentScreen);
6828
6918
  });
6829
6919
  return (() => {
6830
- const _el$ = _tmpl$30();
6920
+ const _el$ = _tmpl$31();
6831
6921
  const _ref$ = setRoot;
6832
6922
  typeof _ref$ === "function" ? use(_ref$, _el$) : setRoot = _el$;
6833
6923
  insert(_el$, createComponent(Provider, {
@@ -7026,7 +7116,7 @@ var hideImage = (source, params = {}) => {
7026
7116
  };
7027
7117
 
7028
7118
  // src/renderer.tsx
7029
- var _tmpl$31 = /* @__PURE__ */ template(`<canvas>`);
7119
+ var _tmpl$36 = /* @__PURE__ */ template(`<canvas>`);
7030
7120
  var {
7031
7121
  preloadAudioBlocking
7032
7122
  } = createAudioMisc();
@@ -7076,7 +7166,7 @@ var createSolidRenderer = ({
7076
7166
  return chars[character];
7077
7167
  }
7078
7168
  const canvas = (() => {
7079
- const _el$ = _tmpl$31();
7169
+ const _el$ = _tmpl$36();
7080
7170
  setAttribute(_el$, "data-character", character);
7081
7171
  return _el$;
7082
7172
  })();
@@ -715,9 +715,6 @@ input[name=novely-input][type=password] {
715
715
  object-fit: cover;
716
716
  object-position: 50% 50%;
717
717
  z-index: 1;
718
- background-position: center;
719
- background-repeat: no-repeat;
720
- background-size: cover;
721
718
  width: 100vw;
722
719
  height: 100vh;
723
720
  position: fixed;
package/dist/utils.d.ts CHANGED
@@ -6,6 +6,7 @@ declare const findLast: <T>(array: T[], fn: (this: T[], item: T, index: number,
6
6
  declare const capitalize: (str: string) => string;
7
7
  declare const isCSSImage: (str: string) => boolean;
8
8
  declare const createImage: (src: string) => HTMLImageElement;
9
+ declare const imageLoaded: (image: HTMLImageElement) => void | Promise<boolean>;
9
10
  /**
10
11
  * Draws passed `images` array on a `canvas`
11
12
  */
@@ -19,4 +20,4 @@ declare const getDocumentStyles: () => string;
19
20
  * @param fn Function that needed to run no more than one time
20
21
  */
21
22
  declare const once: (fn: () => void) => () => void;
22
- export { isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, findLast, simple, getDocumentStyles, once };
23
+ export { isCSSImage, canvasDrawImages, url, createImage, capitalize, onKey, findLast, simple, getDocumentStyles, once, imageLoaded };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.34.0",
3
+ "version": "0.34.1-beta.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"