narraleaf-react 0.1.2 → 0.1.3

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.
@@ -34,8 +34,8 @@ export type RawPosition = CommonPositionType | (Coord2DPosition & {
34
34
  xalign?: never;
35
35
  yalign?: never;
36
36
  }) | (AlignPosition & {
37
- x: never;
38
- y: never;
37
+ x?: never;
38
+ y?: never;
39
39
  });
40
40
  export type Unknown = typeof PositionUtils.Unknown;
41
41
  export type UnknownAble<T> = T | Unknown;
@@ -3,7 +3,7 @@ import type { DOMKeyframesDefinition } from "framer-motion";
3
3
  import { TransformDefinitions } from "./type";
4
4
  import Sequence = TransformDefinitions.Sequence;
5
5
  import SequenceProps = TransformDefinitions.SequenceProps;
6
- export type Transformers = "position" | "opacity" | "scale" | "rotation" | "display" | "src" | "backgroundColor" | "backgroundOpacity" | "transform" | "fontSize" | "fontColor";
6
+ export type Transformers = "position" | "opacity" | "scale" | "rotation" | "display" | "src" | "backgroundColor" | "backgroundOpacity" | "transform" | "fontColor";
7
7
  export type TransformHandler<T> = (value: T) => DOMKeyframesDefinition;
8
8
  export type TransformersMap = {
9
9
  "position": CommonDisplayable["position"];
@@ -15,7 +15,6 @@ export type TransformersMap = {
15
15
  "backgroundColor": Background["background"];
16
16
  "backgroundOpacity": number;
17
17
  "transform": TransformDefinitions.Types;
18
- "fontSize": number;
19
18
  "fontColor": color;
20
19
  };
21
20
  export declare class Transform<T extends TransformDefinitions.Types = object> {
@@ -4,6 +4,7 @@ import { ImageColor, ImageSrc } from "../../types";
4
4
  export type ElementProp<T extends Element = Element, U extends React.HTMLAttributes<T> = React.HTMLAttributes<T>> = React.JSX.IntrinsicAttributes & React.ClassAttributes<T> & React.HTMLAttributes<T> & U;
5
5
  export type ImgElementProp = ElementProp<HTMLImageElement, React.ImgHTMLAttributes<HTMLImageElement>>;
6
6
  export type SpanElementProp = ElementProp<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>;
7
+ export type DivElementProp = ElementProp<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>;
7
8
  export type CSSElementProp<T extends React.CSSProperties | DOMKeyframesDefinition> = ElementProp & {
8
9
  style: T;
9
10
  };
@@ -36,7 +36,13 @@ export type GameConfig = {
36
36
  * The minimum width and height of the player in pixels
37
37
  */
38
38
  minHeight: number;
39
+ /**
40
+ * Base width of the player in pixels, Image scale will be calculated based on this value
41
+ */
39
42
  width: number;
43
+ /**
44
+ * Base height of the player in pixels, Image scale will be calculated based on this value
45
+ */
40
46
  height: number;
41
47
  /**
42
48
  * When player presses one of these keys, the game will skip the current action
@@ -50,6 +56,10 @@ export type GameConfig = {
50
56
  * higher value means faster skipping.
51
57
  */
52
58
  skipInterval: number;
59
+ /**
60
+ * The interval in milliseconds between each ratio update.
61
+ */
62
+ ratioUpdateInterval: number;
53
63
  };
54
64
  elements: {
55
65
  say: {
@@ -66,6 +76,12 @@ export type GameConfig = {
66
76
  */
67
77
  textInterval: number;
68
78
  use: SayComponent;
79
+ /**
80
+ * If true, the game will scale the dialog to fit the screen
81
+ *
82
+ * Text will look smaller when this is enabled
83
+ */
84
+ useAspectScale: boolean;
69
85
  };
70
86
  img: {
71
87
  /**
@@ -86,6 +102,14 @@ export type GameConfig = {
86
102
  text: {
87
103
  allowSkipTransform: boolean;
88
104
  allowSkipTransition: boolean;
105
+ /**
106
+ * Base width of the dialog in pixels
107
+ */
108
+ width: number;
109
+ /**
110
+ * Base height of the dialog in pixels
111
+ */
112
+ height: number;
89
113
  };
90
114
  };
91
115
  elementStyles: {
@@ -94,6 +118,7 @@ export type GameConfig = {
94
118
  * Custom class for the say container
95
119
  * Ex: "rounded-md shadow-md" for rounded and shadowed container
96
120
  */
121
+ contentContainerClassName: string;
97
122
  containerClassName: string;
98
123
  nameTextClassName: string;
99
124
  textContainerClassName: string;
@@ -132,6 +157,7 @@ export type GameConfig = {
132
157
  debug: boolean;
133
158
  trace: boolean;
134
159
  };
160
+ inspector: boolean;
135
161
  };
136
162
  };
137
163
  export type GameSettings = {
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { ImgElementProp } from "../../../nlcore/elements/transition/type";
3
+ export default function AspectScaleImage({ props, onLoad, id, Ref, }: Readonly<{
4
+ props: Omit<ImgElementProp, "onLoad">;
5
+ onLoad: (event: React.SyntheticEvent<HTMLImageElement, Event>) => void;
6
+ id?: string;
7
+ Ref?: React.RefObject<HTMLImageElement>;
8
+ }>): React.JSX.Element;
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import { DivElementProp } from "../../nlcore/elements/transition/type";
3
+ type InspectStyle = {
4
+ border?: "solid" | "dashed" | "dotted";
5
+ borderWidth?: number;
6
+ color?: React.CSSProperties["color"];
7
+ };
8
+ declare function InspectDiv(props: Readonly<DivElementProp & {
9
+ children?: React.ReactNode;
10
+ tag?: string;
11
+ } & InspectStyle>): React.JSX.Element;
12
+ declare function InspectSpan(props: Readonly<DivElementProp & {
13
+ children?: React.ReactNode;
14
+ tag?: string;
15
+ } & InspectStyle>): React.JSX.Element;
16
+ declare function InspectImg(props: Readonly<DivElementProp & {
17
+ tag?: string;
18
+ } & InspectStyle>): React.JSX.Element;
19
+ declare function InspectButton(props: Readonly<DivElementProp & {
20
+ children?: React.ReactNode;
21
+ tag?: string;
22
+ } & InspectStyle>): React.JSX.Element;
23
+ declare function InspectFramerMotionDiv(props: Readonly<DivElementProp & {
24
+ children?: React.ReactNode;
25
+ tag?: string;
26
+ Ref?: React.RefObject<HTMLDivElement>;
27
+ } & InspectStyle>): React.JSX.Element;
28
+ declare const Inspect: {
29
+ Div: typeof InspectDiv;
30
+ Span: typeof InspectSpan;
31
+ Button: typeof InspectButton;
32
+ Img: typeof InspectImg;
33
+ mDiv: typeof InspectFramerMotionDiv;
34
+ };
35
+ export default Inspect;