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.
- package/dist/game/nlcore/action/action.d.ts +29 -24
- package/dist/game/nlcore/action/actionHistory.d.ts +48 -39
- package/dist/game/nlcore/action/actionTypes.d.ts +142 -142
- package/dist/game/nlcore/action/actionable.d.ts +5 -5
- package/dist/game/nlcore/action/actions/characterAction.d.ts +19 -17
- package/dist/game/nlcore/action/actions/conditionAction.d.ts +26 -17
- package/dist/game/nlcore/action/actions/controlAction.d.ts +26 -38
- package/dist/game/nlcore/action/actions/displayableAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions/imageAction.d.ts +25 -23
- package/dist/game/nlcore/action/actions/layerAction.d.ts +16 -13
- package/dist/game/nlcore/action/actions/menuAction.d.ts +21 -16
- package/dist/game/nlcore/action/actions/persistentAction.d.ts +17 -13
- package/dist/game/nlcore/action/actions/sceneAction.d.ts +47 -44
- package/dist/game/nlcore/action/actions/scriptAction.d.ts +14 -10
- package/dist/game/nlcore/action/actions/soundAction.d.ts +20 -18
- package/dist/game/nlcore/action/actions/storyAction.d.ts +8 -8
- package/dist/game/nlcore/action/actions/textAction.d.ts +16 -14
- package/dist/game/nlcore/action/actions/videoAction.d.ts +26 -22
- package/dist/game/nlcore/action/actions.d.ts +20 -13
- package/dist/game/nlcore/action/baseElement.d.ts +2 -2
- package/dist/game/nlcore/action/chain.d.ts +17 -17
- package/dist/game/nlcore/action/constructable.d.ts +5 -5
- package/dist/game/nlcore/action/gameHistory.d.ts +32 -32
- package/dist/game/nlcore/action/logicAction.d.ts +52 -52
- package/dist/game/nlcore/action/serviceAction.d.ts +24 -11
- package/dist/game/nlcore/action/srcManager.d.ts +47 -47
- package/dist/game/nlcore/action/stackModel.d.ts +106 -0
- package/dist/game/nlcore/action/tree/actionTree.d.ts +56 -56
- package/dist/game/nlcore/common/Utils.d.ts +25 -25
- package/dist/game/nlcore/common/core.d.ts +8 -8
- package/dist/game/nlcore/common/elements.d.ts +19 -19
- package/dist/game/nlcore/common/game.d.ts +8 -7
- package/dist/game/nlcore/common/player.d.ts +7 -7
- package/dist/game/nlcore/common/position.d.ts +2 -2
- package/dist/game/nlcore/common/transition.d.ts +6 -6
- package/dist/game/nlcore/common/types.d.ts +9 -9
- package/dist/game/nlcore/elements/character/pause.d.ts +8 -8
- package/dist/game/nlcore/elements/character/sentence.d.ts +25 -25
- package/dist/game/nlcore/elements/character/word.d.ts +18 -18
- package/dist/game/nlcore/elements/character.d.ts +56 -52
- package/dist/game/nlcore/elements/condition.d.ts +20 -20
- package/dist/game/nlcore/elements/control.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +76 -76
- package/dist/game/nlcore/elements/displayable/image.d.ts +102 -102
- package/dist/game/nlcore/elements/displayable/text.d.ts +74 -74
- package/dist/game/nlcore/elements/layer.d.ts +33 -33
- package/dist/game/nlcore/elements/menu.d.ts +45 -45
- package/dist/game/nlcore/elements/persistent/storable.d.ts +24 -24
- package/dist/game/nlcore/elements/persistent/type.d.ts +3 -3
- package/dist/game/nlcore/elements/persistent.d.ts +86 -86
- package/dist/game/nlcore/elements/scene.d.ts +76 -76
- package/dist/game/nlcore/elements/script.d.ts +16 -16
- package/dist/game/nlcore/elements/service.d.ts +59 -59
- package/dist/game/nlcore/elements/sound.d.ts +89 -89
- package/dist/game/nlcore/elements/story.d.ts +92 -78
- package/dist/game/nlcore/elements/transform/position.d.ts +99 -103
- package/dist/game/nlcore/elements/transform/transform.d.ts +119 -119
- package/dist/game/nlcore/elements/transform/type.d.ts +32 -32
- package/dist/game/nlcore/elements/transition/transition.d.ts +29 -29
- package/dist/game/nlcore/elements/transition/transitions/image/darkness.d.ts +20 -20
- package/dist/game/nlcore/elements/transition/transitions/image/dissolve.d.ts +17 -17
- package/dist/game/nlcore/elements/transition/transitions/image/fadeIn.d.ts +20 -20
- package/dist/game/nlcore/elements/transition/transitions/image/imageTransition.d.ts +28 -28
- package/dist/game/nlcore/elements/transition/transitions/text/fontSize.d.ts +13 -13
- package/dist/game/nlcore/elements/transition/transitions/text/textTransition.d.ts +10 -10
- package/dist/game/nlcore/elements/transition/type.d.ts +51 -51
- package/dist/game/nlcore/elements/type.d.ts +16 -16
- package/dist/game/nlcore/elements/video.d.ts +23 -23
- package/dist/game/nlcore/game/liveGame.d.ts +148 -138
- package/dist/game/nlcore/game/plugin/plugin.d.ts +16 -16
- package/dist/game/nlcore/game/preference.d.ts +32 -32
- package/dist/game/nlcore/game.d.ts +79 -116
- package/dist/game/nlcore/gameTypes.d.ts +439 -337
- package/dist/game/nlcore/types.d.ts +67 -67
- package/dist/game/player/Tasks.d.ts +125 -106
- package/dist/game/player/elements/Player.d.ts +4 -4
- package/dist/game/player/elements/displayable/Displayable.d.ts +1 -1
- package/dist/game/player/elements/displayable/Displayables.d.ts +1 -1
- package/dist/game/player/elements/displayable/Text.d.ts +1 -1
- package/dist/game/player/elements/displayable/type.d.ts +1 -1
- package/dist/game/player/elements/elements.d.ts +8 -8
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -1
- package/dist/game/player/elements/image/Image.d.ts +3 -3
- package/dist/game/player/elements/menu/PlayerMenu.d.ts +3 -3
- package/dist/game/player/elements/menu/UIMenu/Item.d.ts +12 -12
- package/dist/game/player/elements/menu/UIMenu/Menu.d.ts +6 -6
- package/dist/game/player/elements/menu/UIMenu/context.d.ts +23 -23
- package/dist/game/player/elements/menu/type.d.ts +16 -16
- package/dist/game/player/elements/notification/Notifications.d.ts +3 -3
- package/dist/game/player/elements/notification/PlayerNotification.d.ts +4 -4
- package/dist/game/player/elements/notification/context.d.ts +11 -11
- package/dist/game/player/elements/notification/type.d.ts +18 -19
- package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/player/Layer.d.ts +8 -8
- package/dist/game/player/elements/player/PreferenceUpdateAnnouncer.d.ts +4 -4
- package/dist/game/player/elements/player/RenderEventAnnoucer.d.ts +4 -4
- package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -1
- package/dist/game/player/elements/preload/Preload.d.ts +1 -1
- package/dist/game/player/elements/say/Dialog.d.ts +13 -13
- package/dist/game/player/elements/say/Nametag.d.ts +2 -2
- package/dist/game/player/elements/say/Sentence.d.ts +37 -37
- package/dist/game/player/elements/say/UIDialog.d.ts +72 -71
- package/dist/game/player/elements/say/context.d.ts +4 -4
- package/dist/game/player/elements/say/type.d.ts +53 -53
- package/dist/game/player/elements/say/useDialog.d.ts +18 -18
- package/dist/game/player/elements/scene/Scene.d.ts +1 -1
- package/dist/game/player/elements/type.d.ts +53 -53
- package/dist/game/player/elements/video/video.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +193 -191
- package/dist/game/player/gameState.type.d.ts +1 -1
- package/dist/game/player/guard.d.ts +24 -24
- package/dist/game/player/lib/AspectRatio.d.ts +7 -7
- package/dist/game/player/lib/AudioManager.d.ts +50 -50
- package/dist/game/player/lib/Cursor.d.ts +6 -6
- package/dist/game/player/lib/ErrorBoundary.d.ts +24 -24
- package/dist/game/player/lib/ErrorFallback.d.ts +5 -5
- package/dist/game/player/lib/ImageCacheManager.d.ts +26 -26
- package/dist/game/player/lib/Inspect.d.ts +36 -36
- package/dist/game/player/lib/PageRouter/AnimatePresence.d.ts +4 -4
- package/dist/game/player/lib/PageRouter/Page.d.ts +9 -9
- package/dist/game/player/lib/PageRouter/PageRouter.d.ts +27 -27
- package/dist/game/player/lib/PageRouter/Stage.d.ts +6 -6
- package/dist/game/player/lib/PageRouter/router.d.ts +28 -23
- package/dist/game/player/lib/PlayerFrames.d.ts +10 -10
- package/dist/game/player/lib/Preloaded.d.ts +48 -48
- package/dist/game/player/lib/flush.d.ts +5 -5
- package/dist/game/player/lib/isolated.d.ts +7 -7
- package/dist/game/player/lib/notification.d.ts +47 -47
- package/dist/game/player/lib/preferences.d.ts +8 -8
- package/dist/game/player/lib/useElementVisibility.d.ts +5 -5
- package/dist/game/player/lib/useExposeState.d.ts +10 -10
- package/dist/game/player/lib/useLiveGame.d.ts +1 -1
- package/dist/game/player/libElements.d.ts +12 -12
- package/dist/game/player/provider/game-state.d.ts +24 -24
- package/dist/game/player/provider/preloaded.d.ts +1 -1
- package/dist/game/player/provider/providers.d.ts +7 -7
- package/dist/game/player/provider/ratio.d.ts +1 -1
- package/dist/game/player/type.d.ts +68 -68
- package/dist/index.d.ts +3 -3
- package/dist/main.js +43 -45
- package/dist/util/config.d.ts +37 -37
- package/dist/util/data.d.ts +346 -309
- package/dist/util/logger.d.ts +21 -21
- package/dist/util/singleton.d.ts +5 -5
- 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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} & Partial<OffsetPosition>;
|
|
18
|
-
export type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* ```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* ```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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 {};
|