narraleaf-react 0.8.3 → 0.8.5

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.
@@ -83,7 +83,7 @@ export declare class Menu extends Actionable<any, Menu> {
83
83
  * ]);
84
84
  * ```
85
85
  */
86
- enableWhen(condition: Lambda<boolean> | LambdaHandler<boolean>, prompt: Sentence, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
86
+ enableWhen(condition: Lambda<boolean> | LambdaHandler<boolean>, prompt: Sentence | SentencePrompt, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
87
87
  /**
88
88
  * Add a choice, only show when the condition is true
89
89
  * @example
@@ -93,5 +93,5 @@ export declare class Menu extends Actionable<any, Menu> {
93
93
  * ]);
94
94
  * ```
95
95
  */
96
- showWhen(condition: Lambda<boolean> | LambdaHandler<boolean>, prompt: Sentence, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
96
+ showWhen(condition: Lambda<boolean> | LambdaHandler<boolean>, prompt: Sentence | SentencePrompt, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
97
97
  }
@@ -24,12 +24,28 @@ export declare class Persistent<T extends PersistentContent> extends Actionable<
24
24
  assign(value: Partial<T> | ((value: T) => Partial<T>)): ChainedPersistent<T>;
25
25
  /**
26
26
  * Determine whether the values are equal, can be used in {@link Condition}
27
+ * @example
28
+ * ```typescript
29
+ * persis.equals("id", persis.get("player_id"));
30
+ *
31
+ * // or
32
+ *
33
+ * persis.equals("id", (ctx) => ctx.storable.getNamespace("player").get("player_id"));
34
+ * ```
27
35
  */
28
- equals<K extends StringKeyOf<T>>(key: K, value: T[K] | ((value: T[K]) => T[K])): Lambda<boolean>;
36
+ equals<K extends StringKeyOf<T>>(key: K, value: T[K] | Lambda<T[K]> | LambdaHandler<T[K]>): Lambda<boolean>;
29
37
  /**
30
38
  * Determine whether the values aren't equal, can be used in {@link Condition}
39
+ * @example
40
+ * ```typescript
41
+ * persis.notEquals("id", persis.get("player_id"));
42
+ *
43
+ * // or
44
+ *
45
+ * persis.notEquals("id", (ctx) => ctx.storable.getNamespace("player").get("player_id"));
46
+ * ```
31
47
  */
32
- notEquals<K extends StringKeyOf<T>>(key: K, value: T[K] | ((value: T[K]) => T[K])): Lambda<boolean>;
48
+ notEquals<K extends StringKeyOf<T>>(key: K, value: T[K] | Lambda<T[K]> | LambdaHandler<T[K]>): Lambda<boolean>;
33
49
  /**
34
50
  * Determine whether the value is true, can be used in {@link Condition}
35
51
  */
@@ -1,16 +1,22 @@
1
1
  import { Game } from "../game";
2
+ import { LogicAction } from "../action/logicAction";
2
3
  import { Actionable } from "../action/actionable";
3
4
  import { GameState } from "../../player/gameState";
4
- import type { Storable } from "../elements/persistent/storable";
5
+ import { Chained, Proxied } from "../action/chain";
6
+ import type { Namespace, Storable } from "../elements/persistent/storable";
5
7
  import { LiveGame } from "../game/liveGame";
8
+ import { NameSpaceContent } from "./persistent/type";
9
+ export type NamespaceGetter = <T extends NameSpaceContent<keyof T>>(namespace: string) => Namespace<T>;
6
10
  export interface ScriptCtx {
7
11
  gameState: GameState;
8
12
  game: Game;
9
13
  liveGame: LiveGame;
10
14
  storable: Storable;
15
+ $: NamespaceGetter;
11
16
  }
12
17
  type ScriptRun = (ctx: ScriptCtx) => ScriptCleaner | void;
13
18
  export declare class Script extends Actionable<object> {
19
+ static execute(handler: ScriptRun): Proxied<Script, Chained<LogicAction.Actions>>;
14
20
  constructor(handler: ScriptRun);
15
21
  }
16
22
  export {};