@novely/solid-renderer 0.9.1 → 0.9.3-next

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,5 +1,6 @@
1
1
  import type { Renderer, RendererInit, RendererStore, ValidAction, CustomHandler, CustomHandlerGetResult, NovelyScreen } from '@novely/core';
2
2
  import type { JSX } from 'solid-js';
3
+ import type { MountableElement } from 'solid-js/web';
3
4
  interface StateCharacter {
4
5
  /**
5
6
  * `element.style`
@@ -114,7 +115,9 @@ type StateScreen = () => {
114
115
  unmount?(): void;
115
116
  };
116
117
  type StateScreens = Record<string, StateScreen>;
117
- type StateMainmenuItems = ((goto: (name: NovelyScreen | (string & Record<never, never>)) => void) => JSX.ButtonHTMLAttributes<HTMLButtonElement>)[];
118
+ type PossibleScreen = NovelyScreen | (string & Record<never, never>);
119
+ type StateMainmenuItem = (goto: (name: PossibleScreen) => void) => JSX.ButtonHTMLAttributes<HTMLButtonElement>;
120
+ type StateMainmenuItems = StateMainmenuItem[];
118
121
  interface State {
119
122
  background: string;
120
123
  characters: Record<string, StateCharacter>;
@@ -127,7 +130,7 @@ interface State {
127
130
  items: StateMainmenuItems;
128
131
  };
129
132
  text: StateText;
130
- screen: NovelyScreen | (string & Record<never, never>);
133
+ screen: PossibleScreen;
131
134
  exitPromptShown: boolean;
132
135
  }
133
136
  interface SolidRendererStore extends RendererStore {
@@ -150,12 +153,16 @@ interface CreateSolidRendererOptions {
150
153
  * @default true
151
154
  */
152
155
  skipTypewriterWhenGoingBack?: boolean;
156
+ /**
157
+ * Where Novely will be mounted
158
+ * @default document.body
159
+ */
160
+ target?: MountableElement;
153
161
  }
154
- declare const createSolidRenderer: ({ fullscreen, controls, skipTypewriterWhenGoingBack }?: CreateSolidRendererOptions) => {
162
+ declare const createSolidRenderer: ({ fullscreen, controls, skipTypewriterWhenGoingBack, target }?: CreateSolidRendererOptions) => {
155
163
  createRenderer(init: RendererInit): Renderer;
156
- Novely(props: Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'ref'>): JSX.Element;
157
164
  registerScreen(name: string, screen: StateScreen): void;
158
- registerMainmenuItem(fn: (goto: (name: NovelyScreen | (string & Record<never, never>)) => void) => JSX.ButtonHTMLAttributes<HTMLButtonElement>): void;
165
+ registerMainmenuItem(fn: StateMainmenuItem): void;
159
166
  };
160
167
  export { createSolidRenderer };
161
168
  export type { State, StateScreen, StateScreens, SolidRendererStore };
@@ -145,7 +145,7 @@
145
145
  .control-panel__button--auto-mode {
146
146
  display: none;
147
147
  }
148
- @media (orientation: portrait) and ((min-aspect-ratio: .26) or (max-aspect-ratio: .1)) {
148
+ @media (min-aspect-ratio: .26) or (max-aspect-ratio: .1) {
149
149
  .control-panel__button__icon {
150
150
  display: block;
151
151
  }
@@ -308,7 +308,7 @@
308
308
  max-width: 100%;
309
309
  max-height: 100%;
310
310
  }
311
- @media (orientation: portrait) {
311
+ @media (max-aspect-ratio: .8) {
312
312
  .action-dialog {
313
313
  bottom: 0;
314
314
  left: unset;
@@ -336,7 +336,7 @@
336
336
  height: 50vh !important;
337
337
  }
338
338
  }
339
- @media only screen and (orientation: landscape) and (pointer: coarse) {
339
+ @media only screen and (min-aspect-ratio: .8) and (pointer: coarse) {
340
340
  .action-dialog-content {
341
341
  text-shadow: none;
342
342
  font-size: 1.32rem;
@@ -397,7 +397,7 @@
397
397
  background: var(--novely-dialog-panel-label-background, #ffe9f3);
398
398
  color: var(--novely-dialog-panel-label-color, #000);
399
399
  }
400
- @media (orientation: portrait) {
400
+ @media (max-aspect-ratio: .8) {
401
401
  .dialog-panel {
402
402
  width: calc(100vw - .5rem);
403
403
  }
@@ -481,7 +481,7 @@
481
481
  display: grid;
482
482
  overflow: hidden;
483
483
  }
484
- @media (orientation: landscape) {
484
+ @media (min-aspect-ratio: .8) {
485
485
  .main-menu {
486
486
  justify-content: start;
487
487
  }
@@ -570,7 +570,7 @@
570
570
  display: flex;
571
571
  overflow: hidden;
572
572
  }
573
- @media (orientation: portrait) {
573
+ @media (max-aspect-ratio: .8) {
574
574
  .settings {
575
575
  flex-direction: column-reverse;
576
576
  }
@@ -580,7 +580,7 @@
580
580
  .settings__button {
581
581
  min-width: 30vw;
582
582
  }
583
- @media (orientation: portrait) {
583
+ @media (max-aspect-ratio: .8) {
584
584
  .settings__button {
585
585
  min-width: 80%;
586
586
  }
@@ -604,7 +604,7 @@
604
604
  display: flex;
605
605
  overflow: hidden;
606
606
  }
607
- @media (orientation: portrait) {
607
+ @media (max-aspect-ratio: .8) {
608
608
  .saves {
609
609
  flex-direction: column-reverse;
610
610
  }
@@ -626,7 +626,7 @@
626
626
  .saves__button-load__type {
627
627
  margin-left: 1rem;
628
628
  }
629
- @media (orientation: portrait) {
629
+ @media (max-aspect-ratio: .8) {
630
630
  .saves__button {
631
631
  min-width: 80%;
632
632
  }
@@ -695,7 +695,7 @@
695
695
  .saves__list-item {
696
696
  display: flex;
697
697
  }
698
- @media (orientation: portrait) {
698
+ @media (max-aspect-ratio: .8) {
699
699
  .saves__list {
700
700
  height: 100%;
701
701
  }
@@ -725,7 +725,7 @@
725
725
  }
726
726
 
727
727
  /* src/styles/saves/column/column.css */
728
- @media (orientation: portrait) {
728
+ @media (max-aspect-ratio: .8) {
729
729
  .saves__column {
730
730
  flex-flow: column wrap;
731
731
  justify-content: center;
package/dist/utils.d.ts CHANGED
@@ -10,4 +10,5 @@ declare const escape: (str: string) => string;
10
10
  declare const onKey: (cb: (event: KeyboardEvent) => void, ...keys: string[]) => (e: KeyboardEvent) => void;
11
11
  declare const toMedia: (media: 'portrait' | 'landscape' | (string & Record<never, never>)) => string;
12
12
  declare const findLast: <T>(array: T[], fn: (item: T) => boolean) => T | undefined;
13
- export { isCSSImage, canvasDrawImages, url, createImage, capitalize, escape, onKey, toMedia, findLast };
13
+ declare const simple: <T extends unknown[], R>(fn: (...args: T) => R) => (...args: T) => R;
14
+ export { isCSSImage, canvasDrawImages, url, createImage, capitalize, escape, onKey, toMedia, findLast, simple };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.9.1",
3
+ "version": "0.9.3-next",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "esbuild": "^0.19.2",
18
+ "esbuild-plugin-solid": "^0.5.0",
18
19
  "typescript": "^5.1.6"
19
20
  },
20
21
  "dependencies": {