@novely/solid-renderer 0.34.0 → 0.34.1-beta.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.
@@ -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,22 @@ 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", () => {
5055
+ resolve(true);
5056
+ });
5057
+ image.addEventListener("abort", () => {
5058
+ resolve(false);
5059
+ });
5060
+ image.addEventListener("error", () => {
5061
+ resolve(false);
5062
+ });
5063
+ return promise;
5064
+ };
4992
5065
  var createCanvas = () => {
4993
5066
  return document.createElement("canvas");
4994
5067
  };
@@ -5660,27 +5733,7 @@ var Save = (props) => {
5660
5733
  }, 1e3);
5661
5734
  try {
5662
5735
  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);
5736
+ return previewDone();
5684
5737
  } catch {
5685
5738
  return previewDone();
5686
5739
  }
@@ -5994,6 +6047,53 @@ var createTypewriter = ({
5994
6047
  };
5995
6048
  };
5996
6049
 
6050
+ // src/components/Canvas.tsx
6051
+ var _tmpl$19 = /* @__PURE__ */ template(`<canvas>`);
6052
+ var Canvas = (props) => {
6053
+ const [local, rest] = splitProps(props, ["resize", "render"]);
6054
+ const [canvas, setCanvas] = createSignal();
6055
+ const ctx = createMemo(() => canvas()?.getContext("2d"));
6056
+ createEffect(() => {
6057
+ const canvasElement = canvas();
6058
+ const canvasContext = ctx();
6059
+ if (canvasElement && canvasContext) {
6060
+ try {
6061
+ local.render(canvasElement, canvasContext);
6062
+ } catch {
6063
+ }
6064
+ }
6065
+ });
6066
+ const onResize = () => {
6067
+ if (!local.resize)
6068
+ return;
6069
+ const canvasElement = untrack(canvas);
6070
+ const canvasContext = untrack(ctx);
6071
+ if (canvasElement) {
6072
+ canvasElement.width = window.innerWidth * devicePixelRatio;
6073
+ canvasElement.height = window.innerHeight * devicePixelRatio;
6074
+ if (canvasContext) {
6075
+ untrack(() => {
6076
+ try {
6077
+ local.render(canvasElement, canvasContext);
6078
+ } catch {
6079
+ }
6080
+ });
6081
+ }
6082
+ }
6083
+ };
6084
+ onMount(onResize);
6085
+ addEventListener("resize", onResize);
6086
+ onCleanup(() => {
6087
+ removeEventListener("resize", onResize);
6088
+ });
6089
+ return (() => {
6090
+ const _el$ = _tmpl$19();
6091
+ use(setCanvas, _el$);
6092
+ spread(_el$, rest, false, false);
6093
+ return _el$;
6094
+ })();
6095
+ };
6096
+
5997
6097
  // ../../node_modules/.pnpm/@solid-primitives+destructure@0.1.17_solid-js@1.8.17/node_modules/@solid-primitives/destructure/dist/index.js
5998
6098
  var isReactiveObject = (value) => typeof value === "object" && value !== null;
5999
6099
  function createProxyCache(obj, get) {
@@ -6040,7 +6140,7 @@ function destructure(source, options) {
6040
6140
  }
6041
6141
 
6042
6142
  // src/screens/game.tsx
6043
- var _tmpl$19 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
6143
+ var _tmpl$20 = /* @__PURE__ */ template(`<div class="action-dialog-person">`);
6044
6144
  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
6145
  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
6146
  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 +6149,7 @@ var _tmpl$62 = /* @__PURE__ */ template(`<span class="control-panel-container-fi
6049
6149
  var _tmpl$72 = /* @__PURE__ */ template(`<div class="control-panel-container-backdrop">`);
6050
6150
  var _tmpl$82 = /* @__PURE__ */ template(`<div class="control-panel"><div role="menubar" class="control-panel-container">`);
6051
6151
  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">`);
6152
+ var _tmpl$102 = /* @__PURE__ */ template(`<button type="button" class="button">`);
6054
6153
  var Game = (props) => {
6055
6154
  const data = useData();
6056
6155
  const {
@@ -6127,14 +6226,6 @@ var Game = (props) => {
6127
6226
  setControlPanelMenuExpanded(false);
6128
6227
  }
6129
6228
  });
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
6229
  const charactersCount = createMemo(() => {
6139
6230
  return Object.values(characters()).reduce((acc, c) => {
6140
6231
  if (c && c.visible) {
@@ -6145,33 +6236,28 @@ var Game = (props) => {
6145
6236
  });
6146
6237
  return (() => {
6147
6238
  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
- });
6239
+ insert(_el$, createComponent(Canvas, {
6240
+ "class": "background",
6241
+ resize: false,
6242
+ render: async (canvas, ctx) => {
6243
+ const bg = background().background;
6244
+ const isColor = !isCSSImage(bg);
6245
+ if (isColor) {
6246
+ ctx.fillStyle = bg;
6247
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
6248
+ } else {
6249
+ const img = PRELOADED_IMAGE_MAP.get(bg) || createImage(bg);
6250
+ await imageLoaded(img);
6251
+ if (!PRELOADED_IMAGE_MAP.has(bg)) {
6252
+ PRELOADED_IMAGE_MAP.set(bg, img);
6253
+ }
6254
+ if (bg !== background().background) {
6255
+ return;
6256
+ }
6257
+ canvas.width = img.width;
6258
+ canvas.height = img.height;
6259
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
6167
6260
  }
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
6261
  }
6176
6262
  }), _el$2);
6177
6263
  setAttribute(_el$2, "data-characters", true);
@@ -6213,7 +6299,7 @@ var Game = (props) => {
6213
6299
  return dialog().miniature.emotion;
6214
6300
  },
6215
6301
  get children() {
6216
- const _el$5 = _tmpl$19();
6302
+ const _el$5 = _tmpl$20();
6217
6303
  insert(_el$5, createComponent(Show, {
6218
6304
  get when() {
6219
6305
  return dialog().miniature.emotion;
@@ -6269,12 +6355,12 @@ var Game = (props) => {
6269
6355
  const disabled = !active;
6270
6356
  const index = i();
6271
6357
  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;
6358
+ const _el$33 = _tmpl$102();
6359
+ _el$33.$$click = onChoicesButtonClick;
6360
+ _el$33.$$clickData = [disabled, index];
6361
+ setAttribute(_el$33, "aria-disabled", disabled);
6362
+ insert(_el$33, text2);
6363
+ return _el$33;
6278
6364
  })();
6279
6365
  }
6280
6366
  }), null);
@@ -6460,18 +6546,18 @@ var Game = (props) => {
6460
6546
  delegateEvents(["click", "keydown"]);
6461
6547
 
6462
6548
  // src/screens/loading.tsx
6463
- var _tmpl$20 = /* @__PURE__ */ template(`<div class="loading"><div class="loading__animation"><div></div><div></div><div></div><div>`);
6549
+ var _tmpl$21 = /* @__PURE__ */ template(`<div class="loading"><div class="loading__animation"><div></div><div></div><div></div><div>`);
6464
6550
  var Loading = (props) => {
6465
6551
  return (() => {
6466
- const _el$ = _tmpl$20();
6552
+ const _el$ = _tmpl$21();
6467
6553
  createRenderEffect(() => _el$.classList.toggle("overlay", !!props.overlay));
6468
6554
  return _el$;
6469
6555
  })();
6470
6556
  };
6471
6557
 
6472
6558
  // 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>`);
6559
+ 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">`);
6560
+ var _tmpl$27 = /* @__PURE__ */ template(`<button>`);
6475
6561
  var MainMenu = () => {
6476
6562
  const {
6477
6563
  t,
@@ -6488,7 +6574,7 @@ var MainMenu = () => {
6488
6574
  $rendererState.mutate((s) => s.screen, screen);
6489
6575
  });
6490
6576
  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;
6577
+ 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
6578
  _el$3.$$click = () => {
6493
6579
  options.newGame();
6494
6580
  };
@@ -6527,7 +6613,7 @@ var MainMenu = () => {
6527
6613
  return rendererStore().mainmenu;
6528
6614
  },
6529
6615
  children: (item) => (() => {
6530
- const _el$11 = _tmpl$26();
6616
+ const _el$11 = _tmpl$27();
6531
6617
  spread(_el$11, mergeProps(() => item(goto)), false, false);
6532
6618
  return _el$11;
6533
6619
  })()
@@ -6539,8 +6625,8 @@ var MainMenu = () => {
6539
6625
  delegateEvents(["click"]);
6540
6626
 
6541
6627
  // 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">`);
6628
+ var _tmpl$28 = /* @__PURE__ */ template(`<ol class="saves__list">`);
6629
+ 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
6630
  var _tmpl$35 = /* @__PURE__ */ template(`<div class="saves__list saves__list--empty">`);
6545
6631
  var Saves = () => {
6546
6632
  const {
@@ -6612,7 +6698,7 @@ var Saves = () => {
6612
6698
  return !targets.every((item) => completed.includes(item));
6613
6699
  };
6614
6700
  return (() => {
6615
- const _el$ = _tmpl$28(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
6701
+ const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
6616
6702
  _el$3.$$click = () => {
6617
6703
  $rendererState.setKey("screen", "mainmenu");
6618
6704
  };
@@ -6629,7 +6715,7 @@ var Saves = () => {
6629
6715
  })();
6630
6716
  },
6631
6717
  get children() {
6632
- const _el$5 = _tmpl$27();
6718
+ const _el$5 = _tmpl$28();
6633
6719
  use(setList, _el$5);
6634
6720
  insert(_el$5, createComponent(For, {
6635
6721
  get each() {
@@ -6660,7 +6746,7 @@ var Saves = () => {
6660
6746
  delegateEvents(["click"]);
6661
6747
 
6662
6748
  // 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">`);
6749
+ 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
6750
  var _tmpl$210 = /* @__PURE__ */ template(`<option>`);
6665
6751
  var Settings = (props) => {
6666
6752
  const {
@@ -6712,7 +6798,7 @@ var Settings = (props) => {
6712
6798
  const soundVolumeSelectID = createUniqueId();
6713
6799
  const voiceVolumeSelectID = createUniqueId();
6714
6800
  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;
6801
+ 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
6802
  _el$3.$$click = () => {
6717
6803
  $rendererState.setKey("screen", "mainmenu");
6718
6804
  };
@@ -6792,7 +6878,7 @@ var Settings = (props) => {
6792
6878
  delegateEvents(["click"]);
6793
6879
 
6794
6880
  // src/components/Root.tsx
6795
- var _tmpl$30 = /* @__PURE__ */ template(`<div class="root">`);
6881
+ var _tmpl$31 = /* @__PURE__ */ template(`<div class="root">`);
6796
6882
  var createRootComponent = ({
6797
6883
  $rendererState,
6798
6884
  $contextState,
@@ -6827,7 +6913,7 @@ var createRootComponent = ({
6827
6913
  emitter.emit("screen:change", currentScreen);
6828
6914
  });
6829
6915
  return (() => {
6830
- const _el$ = _tmpl$30();
6916
+ const _el$ = _tmpl$31();
6831
6917
  const _ref$ = setRoot;
6832
6918
  typeof _ref$ === "function" ? use(_ref$, _el$) : setRoot = _el$;
6833
6919
  insert(_el$, createComponent(Provider, {
@@ -7026,7 +7112,7 @@ var hideImage = (source, params = {}) => {
7026
7112
  };
7027
7113
 
7028
7114
  // src/renderer.tsx
7029
- var _tmpl$31 = /* @__PURE__ */ template(`<canvas>`);
7115
+ var _tmpl$36 = /* @__PURE__ */ template(`<canvas>`);
7030
7116
  var {
7031
7117
  preloadAudioBlocking
7032
7118
  } = createAudioMisc();
@@ -7076,7 +7162,7 @@ var createSolidRenderer = ({
7076
7162
  return chars[character];
7077
7163
  }
7078
7164
  const canvas = (() => {
7079
- const _el$ = _tmpl$31();
7165
+ const _el$ = _tmpl$36();
7080
7166
  setAttribute(_el$, "data-character", character);
7081
7167
  return _el$;
7082
7168
  })();
@@ -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.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"