narraleaf-react 0.5.0 → 0.6.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.
Files changed (145) hide show
  1. package/dist/game/nlcore/action/action.d.ts +29 -24
  2. package/dist/game/nlcore/action/actionHistory.d.ts +48 -39
  3. package/dist/game/nlcore/action/actionTypes.d.ts +142 -142
  4. package/dist/game/nlcore/action/actionable.d.ts +5 -5
  5. package/dist/game/nlcore/action/actions/characterAction.d.ts +19 -17
  6. package/dist/game/nlcore/action/actions/conditionAction.d.ts +26 -17
  7. package/dist/game/nlcore/action/actions/controlAction.d.ts +26 -38
  8. package/dist/game/nlcore/action/actions/displayableAction.d.ts +26 -22
  9. package/dist/game/nlcore/action/actions/imageAction.d.ts +25 -23
  10. package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -13
  11. package/dist/game/nlcore/action/actions/menuAction.d.ts +21 -16
  12. package/dist/game/nlcore/action/actions/persistentAction.d.ts +17 -13
  13. package/dist/game/nlcore/action/actions/sceneAction.d.ts +47 -44
  14. package/dist/game/nlcore/action/actions/scriptAction.d.ts +14 -10
  15. package/dist/game/nlcore/action/actions/soundAction.d.ts +20 -18
  16. package/dist/game/nlcore/action/actions/storyAction.d.ts +8 -8
  17. package/dist/game/nlcore/action/actions/textAction.d.ts +16 -14
  18. package/dist/game/nlcore/action/actions/videoAction.d.ts +26 -22
  19. package/dist/game/nlcore/action/actions.d.ts +20 -13
  20. package/dist/game/nlcore/action/baseElement.d.ts +2 -2
  21. package/dist/game/nlcore/action/chain.d.ts +17 -17
  22. package/dist/game/nlcore/action/constructable.d.ts +5 -5
  23. package/dist/game/nlcore/action/gameHistory.d.ts +32 -32
  24. package/dist/game/nlcore/action/logicAction.d.ts +52 -52
  25. package/dist/game/nlcore/action/serviceAction.d.ts +24 -11
  26. package/dist/game/nlcore/action/srcManager.d.ts +47 -47
  27. package/dist/game/nlcore/action/stackModel.d.ts +106 -0
  28. package/dist/game/nlcore/action/tree/actionTree.d.ts +56 -56
  29. package/dist/game/nlcore/common/Utils.d.ts +25 -25
  30. package/dist/game/nlcore/common/core.d.ts +8 -8
  31. package/dist/game/nlcore/common/elements.d.ts +19 -19
  32. package/dist/game/nlcore/common/game.d.ts +8 -7
  33. package/dist/game/nlcore/common/player.d.ts +7 -7
  34. package/dist/game/nlcore/common/position.d.ts +2 -2
  35. package/dist/game/nlcore/common/transition.d.ts +6 -6
  36. package/dist/game/nlcore/common/types.d.ts +9 -9
  37. package/dist/game/nlcore/elements/character/pause.d.ts +8 -8
  38. package/dist/game/nlcore/elements/character/sentence.d.ts +25 -25
  39. package/dist/game/nlcore/elements/character/word.d.ts +18 -18
  40. package/dist/game/nlcore/elements/character.d.ts +56 -52
  41. package/dist/game/nlcore/elements/condition.d.ts +20 -20
  42. package/dist/game/nlcore/elements/control.d.ts +76 -76
  43. package/dist/game/nlcore/elements/displayable/displayable.d.ts +76 -76
  44. package/dist/game/nlcore/elements/displayable/image.d.ts +102 -102
  45. package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
  46. package/dist/game/nlcore/elements/layer.d.ts +33 -33
  47. package/dist/game/nlcore/elements/menu.d.ts +45 -45
  48. package/dist/game/nlcore/elements/persistent/storable.d.ts +24 -24
  49. package/dist/game/nlcore/elements/persistent/type.d.ts +3 -3
  50. package/dist/game/nlcore/elements/persistent.d.ts +86 -86
  51. package/dist/game/nlcore/elements/scene.d.ts +76 -76
  52. package/dist/game/nlcore/elements/script.d.ts +16 -16
  53. package/dist/game/nlcore/elements/service.d.ts +59 -59
  54. package/dist/game/nlcore/elements/sound.d.ts +89 -89
  55. package/dist/game/nlcore/elements/story.d.ts +92 -78
  56. package/dist/game/nlcore/elements/transform/position.d.ts +99 -103
  57. package/dist/game/nlcore/elements/transform/transform.d.ts +119 -119
  58. package/dist/game/nlcore/elements/transform/type.d.ts +32 -32
  59. package/dist/game/nlcore/elements/transition/transition.d.ts +29 -29
  60. package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -20
  61. package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +17 -17
  62. package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +20 -20
  63. package/dist/game/nlcore/elements/transition/transitions/image/imageTransition.d.ts +28 -28
  64. package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +13 -13
  65. package/dist/game/nlcore/elements/transition/transitions/text/textTransition.d.ts +10 -10
  66. package/dist/game/nlcore/elements/transition/type.d.ts +51 -51
  67. package/dist/game/nlcore/elements/type.d.ts +16 -16
  68. package/dist/game/nlcore/elements/video.d.ts +23 -23
  69. package/dist/game/nlcore/game/liveGame.d.ts +148 -138
  70. package/dist/game/nlcore/game/plugin/plugin.d.ts +16 -16
  71. package/dist/game/nlcore/game/preference.d.ts +32 -32
  72. package/dist/game/nlcore/game.d.ts +79 -116
  73. package/dist/game/nlcore/gameTypes.d.ts +439 -337
  74. package/dist/game/nlcore/types.d.ts +67 -67
  75. package/dist/game/player/Tasks.d.ts +125 -106
  76. package/dist/game/player/elements/Player.d.ts +4 -4
  77. package/dist/game/player/elements/displayable/Displayable.d.ts +1 -1
  78. package/dist/game/player/elements/displayable/Displayables.d.ts +1 -1
  79. package/dist/game/player/elements/displayable/Text.d.ts +1 -1
  80. package/dist/game/player/elements/displayable/type.d.ts +1 -1
  81. package/dist/game/player/elements/elements.d.ts +8 -8
  82. package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
  83. package/dist/game/player/elements/image/Image.d.ts +3 -3
  84. package/dist/game/player/elements/menu/PlayerMenu.d.ts +3 -3
  85. package/dist/game/player/elements/menu/UIMenu/Item.d.ts +12 -12
  86. package/dist/game/player/elements/menu/UIMenu/Menu.d.ts +6 -6
  87. package/dist/game/player/elements/menu/UIMenu/context.d.ts +23 -23
  88. package/dist/game/player/elements/menu/type.d.ts +16 -16
  89. package/dist/game/player/elements/notification/Notifications.d.ts +3 -3
  90. package/dist/game/player/elements/notification/PlayerNotification.d.ts +4 -4
  91. package/dist/game/player/elements/notification/context.d.ts +11 -11
  92. package/dist/game/player/elements/notification/type.d.ts +18 -19
  93. package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -1
  94. package/dist/game/player/elements/player/Layer.d.ts +8 -8
  95. package/dist/game/player/elements/player/PreferenceUpdateAnnouncer.d.ts +4 -4
  96. package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -4
  97. package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -1
  98. package/dist/game/player/elements/preload/Preload.d.ts +1 -1
  99. package/dist/game/player/elements/say/Dialog.d.ts +13 -13
  100. package/dist/game/player/elements/say/Nametag.d.ts +2 -2
  101. package/dist/game/player/elements/say/Sentence.d.ts +37 -37
  102. package/dist/game/player/elements/say/UIDialog.d.ts +72 -71
  103. package/dist/game/player/elements/say/context.d.ts +4 -4
  104. package/dist/game/player/elements/say/type.d.ts +53 -53
  105. package/dist/game/player/elements/say/useDialog.d.ts +18 -18
  106. package/dist/game/player/elements/scene/Scene.d.ts +1 -1
  107. package/dist/game/player/elements/type.d.ts +53 -53
  108. package/dist/game/player/elements/video/video.d.ts +1 -1
  109. package/dist/game/player/gameState.d.ts +193 -191
  110. package/dist/game/player/gameState.type.d.ts +1 -1
  111. package/dist/game/player/guard.d.ts +24 -24
  112. package/dist/game/player/lib/AspectRatio.d.ts +7 -7
  113. package/dist/game/player/lib/AudioManager.d.ts +50 -50
  114. package/dist/game/player/lib/Cursor.d.ts +6 -6
  115. package/dist/game/player/lib/ErrorBoundary.d.ts +24 -24
  116. package/dist/game/player/lib/ErrorFallback.d.ts +5 -5
  117. package/dist/game/player/lib/ImageCacheManager.d.ts +26 -26
  118. package/dist/game/player/lib/Inspect.d.ts +36 -36
  119. package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +4 -4
  120. package/dist/game/player/lib/PageRouter/Page.d.ts +9 -9
  121. package/dist/game/player/lib/PageRouter/PageRouter.d.ts +27 -27
  122. package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
  123. package/dist/game/player/lib/PageRouter/router.d.ts +28 -23
  124. package/dist/game/player/lib/PlayerFrames.d.ts +10 -10
  125. package/dist/game/player/lib/Preloaded.d.ts +48 -48
  126. package/dist/game/player/lib/flush.d.ts +5 -5
  127. package/dist/game/player/lib/isolated.d.ts +7 -7
  128. package/dist/game/player/lib/notification.d.ts +47 -47
  129. package/dist/game/player/lib/preferences.d.ts +8 -8
  130. package/dist/game/player/lib/useElementVisibility.d.ts +5 -5
  131. package/dist/game/player/lib/useExposeState.d.ts +10 -10
  132. package/dist/game/player/lib/useLiveGame.d.ts +1 -1
  133. package/dist/game/player/libElements.d.ts +12 -12
  134. package/dist/game/player/provider/game-state.d.ts +24 -24
  135. package/dist/game/player/provider/preloaded.d.ts +1 -1
  136. package/dist/game/player/provider/providers.d.ts +7 -7
  137. package/dist/game/player/provider/ratio.d.ts +1 -1
  138. package/dist/game/player/type.d.ts +68 -68
  139. package/dist/index.d.ts +3 -3
  140. package/dist/main.js +43 -45
  141. package/dist/util/config.d.ts +37 -37
  142. package/dist/util/data.d.ts +346 -309
  143. package/dist/util/logger.d.ts +21 -21
  144. package/dist/util/singleton.d.ts +5 -5
  145. package/package.json +5 -3
@@ -1,78 +1,92 @@
1
- import { Constructable } from "../action/constructable";
2
- import { Scene } from "../elements/scene";
3
- import { SceneAction } from "../action/actions/sceneAction";
4
- import { Persistent, PersistentContent } from "../elements/persistent";
5
- import { Service } from "../elements/service";
6
- export declare enum Origins {
7
- topLeft = "top left",
8
- topRight = "top right",
9
- bottomLeft = "bottom left",
10
- bottomRight = "bottom right"
11
- }
12
- export interface IStoryConfig {
13
- origin: Origins;
14
- }
15
- export declare class Story extends Constructable<SceneAction<"scene:action">, Story> {
16
- constructor(name: string, config?: IStoryConfig);
17
- /**
18
- * Set the entry scene of the story
19
- * @example
20
- * ```typescript
21
- * const story = new Story("story");
22
- * const scene = new Scene("scene");
23
- * story.entry(scene); // The story will start from this scene
24
- * ```
25
- */
26
- entry(scene: Scene): this;
27
- /**
28
- * Register a scene to the story
29
- * @example
30
- * ```typescript
31
- * // register a scene
32
- * const story = new Story("story");
33
- * const scene1 = new Scene("scene1");
34
- * const scene2 = new Scene("scene2");
35
- *
36
- * story.register(scene1); // Register scene1
37
- *
38
- * scene2.action([
39
- * scene2.jump("scene1") // Jump to scene1
40
- * ]);
41
- * ```
42
- */
43
- registerScene(name: string, scene: Scene): this;
44
- registerScene(scene: Scene): this;
45
- /**
46
- * Register a Persistent to the story
47
- *
48
- * You can't use a Persistent that isn't registered to the story
49
- */
50
- registerPersistent(persistent: Persistent<any>): this;
51
- /**
52
- * Create a Persistent and register it to the story
53
- * @example
54
- * ```typescript
55
- * const persistent = story.createPersistent("playerData", {
56
- * name: "persistent",
57
- * });
58
- *
59
- * // is equivalent to
60
- * const persistent = new Persistent("playerData", {
61
- * name: "persistent",
62
- * });
63
- * story.registerPersistent(persistent);
64
- * ```
65
- */
66
- createPersistent<T extends PersistentContent>(namespace: string, defaultContent: T): Persistent<T>;
67
- /**
68
- * Register a Service to the story
69
- *
70
- * **Note**: service name should be unique
71
- */
72
- registerService(name: string, service: Service): this;
73
- /**
74
- * Get a registered service, throw an error if the service isn't found
75
- */
76
- getService<T extends Service>(name: string): T;
77
- getScene(name: string | Scene, assert?: false): Scene | null;
78
- }
1
+ import { Constructable } from "../action/constructable";
2
+ import { Scene } from "../elements/scene";
3
+ import { SceneAction } from "../action/actions/sceneAction";
4
+ import { Persistent, PersistentContent } from "../elements/persistent";
5
+ import { Service } from "../elements/service";
6
+ export declare enum Origins {
7
+ topLeft = "top left",
8
+ topRight = "top right",
9
+ bottomLeft = "bottom left",
10
+ bottomRight = "bottom right"
11
+ }
12
+ export interface IStoryConfig {
13
+ origin: Origins;
14
+ }
15
+ export declare class Story extends Constructable<SceneAction<"scene:action">, Story> {
16
+ constructor(name: string, config?: IStoryConfig);
17
+ /**
18
+ * Set the entry scene of the story
19
+ * @example
20
+ * ```typescript
21
+ * const story = new Story("story");
22
+ * const scene = new Scene("scene");
23
+ * story.entry(scene); // The story will start from this scene
24
+ * ```
25
+ */
26
+ entry(scene: Scene): this;
27
+ /**
28
+ * Register a scene to the story
29
+ * @example
30
+ * ```typescript
31
+ * // register a scene
32
+ * const story = new Story("story");
33
+ * const scene1 = new Scene("scene1");
34
+ * const scene2 = new Scene("scene2");
35
+ *
36
+ * story.register(scene1); // Register scene1
37
+ *
38
+ * scene2.action([
39
+ * scene2.jump("scene1") // Jump to scene1
40
+ * ]);
41
+ * ```
42
+ */
43
+ registerScene(name: string, scene: Scene): this;
44
+ registerScene(scene: Scene): this;
45
+ /**
46
+ * Register a Persistent to the story
47
+ *
48
+ * You can't use a Persistent that isn't registered to the story
49
+ */
50
+ registerPersistent(persistent: Persistent<any>): this;
51
+ /**
52
+ * Create a Persistent and register it to the story
53
+ * @example
54
+ * ```typescript
55
+ * const persistent = story.createPersistent("playerData", {
56
+ * name: "persistent",
57
+ * });
58
+ *
59
+ * // is equivalent to
60
+ * const persistent = new Persistent("playerData", {
61
+ * name: "persistent",
62
+ * });
63
+ * story.registerPersistent(persistent);
64
+ * ```
65
+ */
66
+ createPersistent<T extends PersistentContent>(namespace: string, defaultContent: T): Persistent<T>;
67
+ /**
68
+ * Register a Service to the story
69
+ *
70
+ * **Note**: service name should be unique
71
+ */
72
+ registerService(name: string, service: Service): this;
73
+ /**
74
+ * Get a registered service, throw an error if the service isn't found
75
+ */
76
+ getService<T extends Service>(name: string): T;
77
+ /**
78
+ * Returns a 64-bit hash of the story
79
+ *
80
+ * The hash is calculated by the stringified story.
81
+ *
82
+ * If `strict` is true, the hash will be calculated by the stringified story with strict mode.
83
+ *
84
+ * In strict mode, the hash will be calculated
85
+ * - With all the Lambda functions stringified (If the lambda function is changed, the hash will be different)
86
+ *
87
+ * However, the hash is **not** calculated with the text content of the story.
88
+ */
89
+ hash(strict?: boolean): string;
90
+ stringify(strict?: boolean): string;
91
+ getScene(name: string | Scene, assert?: false): Scene | null;
92
+ }
@@ -1,103 +1,99 @@
1
- export declare enum CommonPositionType {
2
- Left = "left",
3
- Center = "center",
4
- Right = "right"
5
- }
6
- export declare const CommonPositions: {
7
- left: `${number}%`;
8
- center: `${number}%`;
9
- right: `${number}%`;
10
- };
11
- export interface IPosition {
12
- toCSS(): D2Position;
13
- }
14
- export type Coord2DPosition = {
15
- x: number | `${"-" | ""}${number}%`;
16
- y: number | `${"-" | ""}${number}%`;
17
- } & Partial<OffsetPosition>;
18
- export type AlignPosition = {
19
- xalign: number;
20
- yalign: number;
21
- } & Partial<OffsetPosition>;
22
- export type OffsetPosition = {
23
- xoffset: number;
24
- yoffset: number;
25
- };
26
- export type RawPosition = CommonPositionType | (Partial<Coord2DPosition> & {
27
- xalign?: never;
28
- yalign?: never;
29
- }) | (Partial<AlignPosition> & {
30
- x?: never;
31
- y?: never;
32
- });
33
- type Unknown = typeof PositionUtils.Unknown;
34
- type UnknownAble<T> = T | Unknown;
35
- export declare class CommonPosition implements IPosition {
36
- static Positions: typeof CommonPositionType;
37
- static isCommonPositionType(arg: any): arg is CommonPosition;
38
- readonly position: CommonPositionType;
39
- /**
40
- * Create a new CommonPosition instance
41
- * @example
42
- * ```ts
43
- * new CommonPosition(CommonPosition.Positions.Center);
44
- * new CommonPosition("center");
45
- * ```
46
- */
47
- constructor(position: CommonPositionType);
48
- toCSS(): D2Position;
49
- }
50
- export declare class Coord2D implements IPosition {
51
- static isCoord2DPosition(arg: any): arg is Coord2D;
52
- static fromCommonPosition(position: CommonPosition): Coord2D;
53
- static fromAlignPosition(position: Partial<AlignPosition>): Coord2D;
54
- static merge(a: Coord2D, b: Coord2D): Coord2D;
55
- readonly x: UnknownAble<Coord2DPosition["x"]>;
56
- readonly y: UnknownAble<Coord2DPosition["y"]>;
57
- readonly xoffset: UnknownAble<number>;
58
- readonly yoffset: UnknownAble<number>;
59
- /**
60
- * Create a new Coord2D instance
61
- * @example
62
- * ```ts
63
- * new Coord2D("50%", "50%");
64
- * new Coord2D({x: 1280, y: "50%"});
65
- * new Coord2D({x: 1280, y: "-50%", xoffset: 10, yoffset: 20});
66
- * ```
67
- */
68
- constructor(arg0: {
69
- x?: UnknownAble<Coord2DPosition["x"]>;
70
- y?: UnknownAble<Coord2DPosition["y"]>;
71
- xoffset?: UnknownAble<number>;
72
- yoffset?: UnknownAble<number>;
73
- });
74
- constructor(x: UnknownAble<Coord2DPosition["x"]>, y: UnknownAble<Coord2DPosition["y"]>);
75
- check(): void;
76
- toCSS(): D2Position<Coord2DPosition["x"], Coord2DPosition["y"]>;
77
- }
78
- export declare class Align implements IPosition {
79
- static isAlignPosition(arg: any): arg is AlignPosition;
80
- readonly xalign: UnknownAble<number>;
81
- readonly yalign: UnknownAble<number>;
82
- readonly xoffset: UnknownAble<number>;
83
- readonly yoffset: UnknownAble<number>;
84
- /**
85
- * Create a new Align instance
86
- * @example
87
- * ```ts
88
- * new Align(0.5, 0.5);
89
- * new Align({xalign: 0.25, yalign: 0.5});
90
- * new Align({xalign: 0.25, yalign: 0.5, xoffset: 10, yoffset: 20});
91
- * ```
92
- */
93
- constructor(xalign?: UnknownAble<number>, yalign?: UnknownAble<number>);
94
- constructor(arg0: {
95
- xalign?: UnknownAble<number>;
96
- yalign?: UnknownAble<number>;
97
- xoffset?: UnknownAble<number>;
98
- yoffset?: UnknownAble<number>;
99
- });
100
- check(): void;
101
- toCSS(): D2Position;
102
- }
103
- export {};
1
+ export declare enum CommonPositionType {
2
+ Left = "left",
3
+ Center = "center",
4
+ Right = "right"
5
+ }
6
+ export declare const CommonPositions: { [key in CommonPositionType]: `${number}%`; };
7
+ export interface IPosition {
8
+ toCSS(): D2Position;
9
+ }
10
+ export type Coord2DPosition = {
11
+ x: number | `${"-" | ""}${number}%`;
12
+ y: number | `${"-" | ""}${number}%`;
13
+ } & Partial<OffsetPosition>;
14
+ export type AlignPosition = {
15
+ xalign: number;
16
+ yalign: number;
17
+ } & Partial<OffsetPosition>;
18
+ export type OffsetPosition = {
19
+ xoffset: number;
20
+ yoffset: number;
21
+ };
22
+ export type RawPosition = CommonPositionType | (Partial<Coord2DPosition> & {
23
+ xalign?: never;
24
+ yalign?: never;
25
+ }) | (Partial<AlignPosition> & {
26
+ x?: never;
27
+ y?: never;
28
+ });
29
+ type Unknown = typeof PositionUtils.Unknown;
30
+ type UnknownAble<T> = T | Unknown;
31
+ export declare class CommonPosition implements IPosition {
32
+ static Positions: typeof CommonPositionType;
33
+ static isCommonPositionType(arg: any): arg is CommonPosition;
34
+ readonly position: CommonPositionType;
35
+ /**
36
+ * Create a new CommonPosition instance
37
+ * @example
38
+ * ```ts
39
+ * new CommonPosition(CommonPosition.Positions.Center);
40
+ * new CommonPosition("center");
41
+ * ```
42
+ */
43
+ constructor(position: CommonPositionType);
44
+ toCSS(): D2Position;
45
+ }
46
+ export declare class Coord2D implements IPosition {
47
+ static isCoord2DPosition(arg: any): arg is Coord2D;
48
+ static fromCommonPosition(position: CommonPosition): Coord2D;
49
+ static fromAlignPosition(position: Partial<AlignPosition>): Coord2D;
50
+ static merge(a: Coord2D, b: Coord2D): Coord2D;
51
+ readonly x: UnknownAble<Coord2DPosition["x"]>;
52
+ readonly y: UnknownAble<Coord2DPosition["y"]>;
53
+ readonly xoffset: UnknownAble<number>;
54
+ readonly yoffset: UnknownAble<number>;
55
+ /**
56
+ * Create a new Coord2D instance
57
+ * @example
58
+ * ```ts
59
+ * new Coord2D("50%", "50%");
60
+ * new Coord2D({x: 1280, y: "50%"});
61
+ * new Coord2D({x: 1280, y: "-50%", xoffset: 10, yoffset: 20});
62
+ * ```
63
+ */
64
+ constructor(arg0: {
65
+ x?: UnknownAble<Coord2DPosition["x"]>;
66
+ y?: UnknownAble<Coord2DPosition["y"]>;
67
+ xoffset?: UnknownAble<number>;
68
+ yoffset?: UnknownAble<number>;
69
+ });
70
+ constructor(x: UnknownAble<Coord2DPosition["x"]>, y: UnknownAble<Coord2DPosition["y"]>);
71
+ check(): void;
72
+ toCSS(): D2Position<Coord2DPosition["x"], Coord2DPosition["y"]>;
73
+ }
74
+ export declare class Align implements IPosition {
75
+ static isAlignPosition(arg: any): arg is AlignPosition;
76
+ readonly xalign: UnknownAble<number>;
77
+ readonly yalign: UnknownAble<number>;
78
+ readonly xoffset: UnknownAble<number>;
79
+ readonly yoffset: UnknownAble<number>;
80
+ /**
81
+ * Create a new Align instance
82
+ * @example
83
+ * ```ts
84
+ * new Align(0.5, 0.5);
85
+ * new Align({xalign: 0.25, yalign: 0.5});
86
+ * new Align({xalign: 0.25, yalign: 0.5, xoffset: 10, yoffset: 20});
87
+ * ```
88
+ */
89
+ constructor(xalign?: UnknownAble<number>, yalign?: UnknownAble<number>);
90
+ constructor(arg0: {
91
+ xalign?: UnknownAble<number>;
92
+ yalign?: UnknownAble<number>;
93
+ xoffset?: UnknownAble<number>;
94
+ yoffset?: UnknownAble<number>;
95
+ });
96
+ check(): void;
97
+ toCSS(): D2Position;
98
+ }
99
+ export {};
@@ -1,119 +1,119 @@
1
- import React from "react";
2
- import type { CommonDisplayableConfig } from "../../types";
3
- import type { DOMKeyframesDefinition } from "motion";
4
- import { TransformDefinitions } from "./type";
5
- import { CSSProps } from "../../elements/transition/type";
6
- export type Transformers = "position" | "opacity" | "scale" | "rotation" | "display" | "src" | "backgroundColor" | "backgroundOpacity" | "transform" | "fontColor";
7
- export type TransformHandler<T> = (value: T) => DOMKeyframesDefinition;
8
- type OverwriteMap = {
9
- transform: React.CSSProperties["transform"];
10
- scale: React.CSSProperties["scale"];
11
- overwrite: CSSProps;
12
- };
13
- export type OverwriteDefinition = {
14
- [K in keyof OverwriteMap]?: OverwriteHandler<OverwriteMap[K]>;
15
- };
16
- type OverwriteHandler<T> = (value: Partial<TransformDefinitions.Types>) => T;
17
- export declare class Transform<T extends TransformDefinitions.Types = CommonDisplayableConfig> {
18
- /**
19
- * Apply transform immediately
20
- */
21
- static immediate<T extends TransformDefinitions.Types>(props: TransformDefinitions.SequenceProps<T>): Transform<T>;
22
- /**
23
- * Go to the left side of the stage
24
- */
25
- static left(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
26
- /**
27
- * Go to the right side of the stage
28
- */
29
- static right(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
30
- /**
31
- * Go to the center of the stage
32
- */
33
- static center(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
34
- /**
35
- * Create a new transform with the given config. The sequences will be empty.
36
- * @param config - The config for the transform.
37
- * @returns A new transform with the given config.
38
- */
39
- static create<T extends TransformDefinitions.Types = CommonDisplayableConfig>(config?: Partial<TransformDefinitions.TransformConfig>): Transform<T>;
40
- /**
41
- * @example
42
- * ```ts
43
- * const transform = new Transform<ImageTransformProps>({
44
- * opacity: 1,
45
- * position: "center"
46
- * }, {
47
- * duration: 0,
48
- * ease: "linear"
49
- * });
50
- * ```
51
- */
52
- constructor(sequences: TransformDefinitions.Sequence<T>[], transformConfig?: Partial<TransformDefinitions.TransformConfig>);
53
- constructor(props: TransformDefinitions.SequenceProps<T>, options?: Partial<TransformDefinitions.CommonTransformProps>);
54
- /**
55
- * Create a new transform that repeats {@link n} x current repeat count times.
56
- * @example
57
- * ```ts
58
- * transform
59
- * .repeat(2)
60
- * .repeat(3)
61
- * // repeat 6 times
62
- * ```
63
- */
64
- repeat(n: number): Transform<T>;
65
- /**
66
- * Copy the current transform.
67
- * @returns {Transform<T>} A new transform with the same sequences and config.
68
- */
69
- copy(): Transform<T>;
70
- /**
71
- * Commits all staged changes to the transform sequence.
72
- * This method will create a new sequence from all pending changes that have been staged via chained methods.
73
- * If there are no staged changes, this method will return the current instance without modification.
74
- * After committing, the staged changes array will be cleared.
75
- * @returns {this} The current Transform i nstance for method chaining
76
- * @example
77
- * ```ts
78
- * transform
79
- * .position({ x: 100, y: 100 })
80
- * .opacity(1).commit() // will create a new sequence with opacity 1 and position x: 100, y: 100
81
- * .position({ x: 200, y: 200 })
82
- * .opacity(0).commit({ duration: 1000 }) // will create a new sequence with opacity 0 and position x: 200, y: 200 with a duration of 1 second
83
- * ```
84
- *
85
- * **Note**: The staged changes will be committed before animation starts to ensure the latest changes are applied.
86
- */
87
- commit(options?: Partial<TransformDefinitions.SequenceOptions>): this;
88
- /**
89
- * Scale the current staging sequence.
90
- * @param {number} scale - The scale of the transform.
91
- * @returns {this} The current Transform instance for method chaining.
92
- */
93
- scale(scale: TransformDefinitions.Types["scale"]): this;
94
- /**
95
- * Rotate the current staging sequence.
96
- * @param {number} rotation - The rotation of the transform.
97
- * @returns {this} The current Transform instance for method chaining.
98
- */
99
- rotation(rotation: TransformDefinitions.Types["rotation"]): this;
100
- /**
101
- * Set the position of the current staging sequence.
102
- * @param {number} position - The position of the transform.
103
- * @returns {this} The current Transform instance for method chaining.
104
- */
105
- position(position: TransformDefinitions.Types["position"]): this;
106
- /**
107
- * Set the opacity of the current staging sequence.
108
- * @param {number} opacity - The opacity of the transform.
109
- * @returns {this} The current Transform instance for method chaining.
110
- */
111
- opacity(opacity: TransformDefinitions.Types["opacity"]): this;
112
- /**
113
- * Set the font color of the current staging sequence.
114
- * @param {string} fontColor - The font color of the transform.
115
- * @returns {this} The current Transform instance for method chaining.
116
- */
117
- fontColor(fontColor: TransformDefinitions.Types["fontColor"]): this;
118
- }
119
- export {};
1
+ import React from "react";
2
+ import type { CommonDisplayableConfig } from "../../types";
3
+ import type { DOMKeyframesDefinition } from "motion";
4
+ import { TransformDefinitions } from "./type";
5
+ import { CSSProps } from "../../elements/transition/type";
6
+ export type Transformers = "position" | "opacity" | "scale" | "rotation" | "display" | "src" | "backgroundColor" | "backgroundOpacity" | "transform" | "fontColor";
7
+ export type TransformHandler<T> = (value: T) => DOMKeyframesDefinition;
8
+ type OverwriteMap = {
9
+ transform: React.CSSProperties["transform"];
10
+ scale: React.CSSProperties["scale"];
11
+ overwrite: CSSProps;
12
+ };
13
+ export type OverwriteDefinition = {
14
+ [K in keyof OverwriteMap]?: OverwriteHandler<OverwriteMap[K]>;
15
+ };
16
+ type OverwriteHandler<T> = (value: Partial<TransformDefinitions.Types>) => T;
17
+ export declare class Transform<T extends TransformDefinitions.Types = CommonDisplayableConfig> {
18
+ /**
19
+ * Apply transform immediately
20
+ */
21
+ static immediate<T extends TransformDefinitions.Types>(props: TransformDefinitions.SequenceProps<T>): Transform<T>;
22
+ /**
23
+ * Go to the left side of the stage
24
+ */
25
+ static left(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
26
+ /**
27
+ * Go to the right side of the stage
28
+ */
29
+ static right(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
30
+ /**
31
+ * Go to the center of the stage
32
+ */
33
+ static center(duration: number, easing?: TransformDefinitions.EasingDefinition): Transform<TransformDefinitions.ImageTransformProps>;
34
+ /**
35
+ * Create a new transform with the given config. The sequences will be empty.
36
+ * @param config - The config for the transform.
37
+ * @returns A new transform with the given config.
38
+ */
39
+ static create<T extends TransformDefinitions.Types = CommonDisplayableConfig>(config?: Partial<TransformDefinitions.TransformConfig>): Transform<T>;
40
+ /**
41
+ * @example
42
+ * ```ts
43
+ * const transform = new Transform<ImageTransformProps>({
44
+ * opacity: 1,
45
+ * position: "center"
46
+ * }, {
47
+ * duration: 0,
48
+ * ease: "linear"
49
+ * });
50
+ * ```
51
+ */
52
+ constructor(sequences: TransformDefinitions.Sequence<T>[], transformConfig?: Partial<TransformDefinitions.TransformConfig>);
53
+ constructor(props: TransformDefinitions.SequenceProps<T>, options?: Partial<TransformDefinitions.CommonTransformProps>);
54
+ /**
55
+ * Create a new transform that repeats {@link n} x current repeat count times.
56
+ * @example
57
+ * ```ts
58
+ * transform
59
+ * .repeat(2)
60
+ * .repeat(3)
61
+ * // repeat 6 times
62
+ * ```
63
+ */
64
+ repeat(n: number): Transform<T>;
65
+ /**
66
+ * Copy the current transform.
67
+ * @returns {Transform<T>} A new transform with the same sequences and config.
68
+ */
69
+ copy(): Transform<T>;
70
+ /**
71
+ * Commits all staged changes to the transform sequence.
72
+ * This method will create a new sequence from all pending changes that have been staged via chained methods.
73
+ * If there are no staged changes, this method will return the current instance without modification.
74
+ * After committing, the staged changes array will be cleared.
75
+ * @returns {this} The current Transform i nstance for method chaining
76
+ * @example
77
+ * ```ts
78
+ * transform
79
+ * .position({ x: 100, y: 100 })
80
+ * .opacity(1).commit() // will create a new sequence with opacity 1 and position x: 100, y: 100
81
+ * .position({ x: 200, y: 200 })
82
+ * .opacity(0).commit({ duration: 1000 }) // will create a new sequence with opacity 0 and position x: 200, y: 200 with a duration of 1 second
83
+ * ```
84
+ *
85
+ * **Note**: The staged changes will be committed before animation starts to ensure the latest changes are applied.
86
+ */
87
+ commit(options?: Partial<TransformDefinitions.SequenceOptions>): this;
88
+ /**
89
+ * Scale the current staging sequence.
90
+ * @param {number} scale - The scale of the transform.
91
+ * @returns {this} The current Transform instance for method chaining.
92
+ */
93
+ scale(scale: TransformDefinitions.Types["scale"]): this;
94
+ /**
95
+ * Rotate the current staging sequence.
96
+ * @param {number} rotation - The rotation of the transform.
97
+ * @returns {this} The current Transform instance for method chaining.
98
+ */
99
+ rotation(rotation: TransformDefinitions.Types["rotation"]): this;
100
+ /**
101
+ * Set the position of the current staging sequence.
102
+ * @param {number} position - The position of the transform.
103
+ * @returns {this} The current Transform instance for method chaining.
104
+ */
105
+ position(position: TransformDefinitions.Types["position"]): this;
106
+ /**
107
+ * Set the opacity of the current staging sequence.
108
+ * @param {number} opacity - The opacity of the transform.
109
+ * @returns {this} The current Transform instance for method chaining.
110
+ */
111
+ opacity(opacity: TransformDefinitions.Types["opacity"]): this;
112
+ /**
113
+ * Set the font color of the current staging sequence.
114
+ * @param {string} fontColor - The font color of the transform.
115
+ * @returns {this} The current Transform instance for method chaining.
116
+ */
117
+ fontColor(fontColor: TransformDefinitions.Types["fontColor"]): this;
118
+ }
119
+ export {};