narraleaf-react 0.3.0 → 0.3.1-alpha.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.
@@ -7,6 +7,12 @@ import { Sentence, SentencePrompt, SentenceUserConfig, SingleWord } from "../ele
7
7
  export type CharacterConfig = {
8
8
  color: Color;
9
9
  };
10
+ export interface Character {
11
+ (content: string, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
12
+ (content: Sentence): Proxied<Character, Chained<LogicAction.Actions>>;
13
+ (content: SentencePrompt, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
14
+ (texts: TemplateStringsArray, ...words: SingleWord[]): Proxied<Character, Chained<LogicAction.Actions>>;
15
+ }
10
16
  export declare class Character extends Actionable<CharacterStateData, Character> {
11
17
  constructor(name: string | null, config?: DeepPartial<CharacterConfig>);
12
18
  /**
@@ -38,4 +44,8 @@ export declare class Character extends Actionable<CharacterStateData, Character>
38
44
  say(content: SentencePrompt, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
39
45
  say(texts: TemplateStringsArray, ...words: SingleWord[]): Proxied<Character, Chained<LogicAction.Actions>>;
40
46
  setName(name: string): Proxied<Character, Chained<LogicAction.Actions>>;
47
+ apply(content: string, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
48
+ apply(content: Sentence): Proxied<Character, Chained<LogicAction.Actions>>;
49
+ apply(content: SentencePrompt, config?: SentenceUserConfig): Proxied<Character, Chained<LogicAction.Actions>>;
50
+ apply(texts: TemplateStringsArray, ...words: SingleWord[]): Proxied<Character, Chained<LogicAction.Actions>>;
41
51
  }
@@ -12,6 +12,7 @@ export interface SavedGame {
12
12
  meta: {
13
13
  created: number;
14
14
  updated: number;
15
+ id: string;
15
16
  };
16
17
  game: {
17
18
  store: {
@@ -2,4 +2,4 @@ import "client-only";
2
2
  import "@player/lib/styles/style.css";
3
3
  import { PlayerProps } from "../elements/type";
4
4
  import React from "react";
5
- export default function Player({ story, width, height, className, onReady, onEnd, children, router, }: Readonly<PlayerProps>): React.JSX.Element;
5
+ export default function Player({ story, width, height, className, onReady, onEnd, children, }: Readonly<PlayerProps>): React.JSX.Element;
@@ -7,7 +7,6 @@ import { Game } from "../../nlcore/game";
7
7
  import { GameState } from "../gameState";
8
8
  import { Storable } from "../../nlcore/elements/persistent/storable";
9
9
  import { LiveGame } from "../../nlcore/game/liveGame";
10
- import { Router } from "../lib/PageRouter/router";
11
10
  export type Components<T extends Record<string, any>> = (props: Readonly<T>) => React.JSX.Element;
12
11
  export type SayComponent = Components<SayElementProps>;
13
12
  export type MenuComponent = Components<MenuElementProps>;
@@ -40,5 +39,4 @@ export interface PlayerProps {
40
39
  */
41
40
  onEnd?: (ctx: PlayerEventContext) => void;
42
41
  children?: React.ReactNode;
43
- router?: Router;
44
42
  }
@@ -1,8 +1,6 @@
1
1
  import React from "react";
2
- import { Router } from "../../lib/PageRouter/router";
3
2
  type PageRouterProps = Readonly<{
4
3
  children?: React.ReactNode;
5
- router?: Router;
6
4
  }>;
7
5
  /**
8
6
  * Page Router for NarraLeaf-React
@@ -25,5 +23,5 @@ type PageRouterProps = Readonly<{
25
23
  * </PageRouter>
26
24
  * ```
27
25
  */
28
- export declare function PageRouter({ children, router, }: PageRouterProps): React.JSX.Element | null;
26
+ export declare function PageRouter({ children, }: PageRouterProps): React.JSX.Element | null;
29
27
  export {};
@@ -1,10 +1,23 @@
1
- type RouterHookResult = Router;
2
1
  export declare class Router {
3
2
  getCurrentId(): string | null;
3
+ /**
4
+ * Push a new page id to the router history
5
+ */
4
6
  push(id: string): this;
7
+ /**
8
+ * Go back to the previous page id in the router history
9
+ */
5
10
  back(): this;
11
+ /**
12
+ * Go forward to the next page id in the router history
13
+ */
6
14
  forward(): this;
15
+ /**
16
+ * Clear the current page id and history
17
+ *
18
+ * All pages will be removed from the stage
19
+ */
20
+ clear(): this;
7
21
  cleanHistory(): this;
8
22
  }
9
- export declare function useRouter(defaultId?: string): RouterHookResult;
10
- export {};
23
+ export declare function useRouter(): Router;