@egjs/flicking 4.15.0 → 4.16.0-beta.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.
- package/README.md +6 -175
- package/{declaration → dist}/CrossFlicking.d.ts +7 -2
- package/dist/Flicking.d.ts +1231 -0
- package/dist/camera/Camera.d.ts +324 -0
- package/{declaration → dist}/camera/mode/BoundCameraMode.d.ts +5 -4
- package/{declaration → dist}/camera/mode/CameraMode.d.ts +7 -6
- package/{declaration → dist}/camera/mode/CircularCameraMode.d.ts +9 -5
- package/{declaration → dist}/camera/mode/LinearCameraMode.d.ts +2 -4
- package/{declaration → dist}/cfc/getDefaultCameraTransform.d.ts +1 -1
- package/dist/cfc/withFlickingMethods.d.ts +15 -0
- package/{declaration/const/axes.d.ts → dist/constants/internal.d.ts} +8 -0
- package/dist/constants/values.d.ts +67 -0
- package/dist/control/AxesController.d.ts +186 -0
- package/dist/control/Control.d.ts +185 -0
- package/dist/control/FreeControl.d.ts +44 -0
- package/dist/control/SnapControl.d.ts +54 -0
- package/{declaration → dist}/control/StateMachine.d.ts +3 -0
- package/dist/control/StrictControl.d.ts +60 -0
- package/{declaration → dist}/control/states/AnimatingState.d.ts +12 -0
- package/{declaration → dist}/control/states/DisabledState.d.ts +12 -0
- package/{declaration → dist}/control/states/DraggingState.d.ts +12 -0
- package/{declaration → dist}/control/states/HoldingState.d.ts +12 -0
- package/{declaration → dist}/control/states/IdleState.d.ts +12 -0
- package/dist/control/states/State.d.ts +86 -0
- package/dist/core/AnchorPoint.d.ts +40 -0
- package/{declaration → dist}/core/AutoResizer.d.ts +6 -0
- package/dist/core/Viewport.d.ts +60 -0
- package/dist/core/VirtualManager.d.ts +84 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/panel/Panel.d.ts +298 -0
- package/dist/core/panel/VirtualPanel.d.ts +41 -0
- package/dist/core/panel/index.d.ts +5 -0
- package/{declaration → dist}/core/panel/provider/VanillaElementProvider.d.ts +3 -0
- package/{declaration → dist}/core/panel/provider/VirtualElementProvider.d.ts +3 -0
- package/dist/error/FlickingError.d.ts +25 -0
- package/dist/error/codes.d.ts +79 -0
- package/dist/error/groups.d.ts +94 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/types.d.ts +516 -0
- package/dist/event/groups.d.ts +40 -0
- package/dist/event/index.d.ts +3 -0
- package/dist/event/names.d.ts +47 -0
- package/dist/event/types.d.ts +318 -0
- package/dist/flicking.cjs.js +5559 -7791
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +5637 -7699
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +6722 -8893
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +1 -9
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +9661 -14086
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +1 -9
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/reactive/index.d.ts +126 -0
- package/{declaration → dist}/renderer/ExternalRenderer.d.ts +3 -0
- package/dist/renderer/Renderer.d.ts +215 -0
- package/{declaration → dist}/renderer/VanillaRenderer.d.ts +6 -0
- package/{declaration → dist}/renderer/strategy/NormalRenderingStrategy.d.ts +5 -2
- package/{declaration → dist}/renderer/strategy/RenderingStrategy.d.ts +4 -1
- package/dist/types/external.d.ts +58 -0
- package/dist/types/params.d.ts +10 -0
- package/{declaration → dist}/utils.d.ts +7 -7
- package/package.json +35 -162
- package/src/CrossFlicking.ts +68 -96
- package/src/Flicking.ts +1051 -972
- package/src/camera/Camera.ts +217 -206
- package/src/camera/index.ts +2 -6
- package/src/camera/mode/BoundCameraMode.ts +38 -27
- package/src/camera/mode/CameraMode.ts +14 -12
- package/src/camera/mode/CircularCameraMode.ts +24 -16
- package/src/camera/mode/LinearCameraMode.ts +3 -1
- package/src/camera/mode/index.ts +4 -10
- package/src/cfc/getDefaultCameraTransform.ts +9 -11
- package/src/cfc/getRenderingPanels.ts +2 -4
- package/src/cfc/index.ts +4 -9
- package/src/cfc/sync.ts +11 -5
- package/src/cfc/withFlickingMethods.ts +6 -7
- package/src/{const/axes.ts → constants/internal.ts} +1 -0
- package/src/constants/values.ts +78 -0
- package/src/control/AxesController.ts +119 -110
- package/src/control/Control.ts +147 -180
- package/src/control/FreeControl.ts +36 -60
- package/src/control/SnapControl.ts +64 -68
- package/src/control/StateMachine.ts +14 -11
- package/src/control/StrictControl.ts +58 -73
- package/src/control/index.ts +9 -12
- package/src/control/states/AnimatingState.ts +8 -11
- package/src/control/states/DisabledState.ts +0 -5
- package/src/control/states/DraggingState.ts +8 -12
- package/src/control/states/HoldingState.ts +10 -15
- package/src/control/states/IdleState.ts +1 -6
- package/src/control/states/State.ts +46 -85
- package/src/core/AnchorPoint.ts +25 -23
- package/src/core/AutoResizer.ts +6 -15
- package/src/core/ResizeWatcher.ts +17 -16
- package/src/core/Viewport.ts +35 -46
- package/src/core/VirtualManager.ts +48 -36
- package/src/core/index.ts +6 -9
- package/src/core/panel/Panel.ts +190 -185
- package/src/core/panel/VirtualPanel.ts +17 -21
- package/src/core/panel/index.ts +4 -9
- package/src/core/panel/provider/VanillaElementProvider.ts +6 -2
- package/src/core/panel/provider/VirtualElementProvider.ts +6 -2
- package/src/core/panel/provider/index.ts +2 -7
- package/src/{core → error}/FlickingError.ts +5 -7
- package/src/error/codes.ts +164 -0
- package/src/error/groups.ts +124 -0
- package/src/error/index.ts +9 -0
- package/src/error/types.ts +535 -0
- package/src/event/groups.ts +61 -0
- package/src/event/index.ts +8 -0
- package/src/event/names.ts +52 -0
- package/src/event/types.ts +355 -0
- package/src/index.ts +9 -11
- package/src/index.umd.ts +9 -3
- package/src/reactive/index.ts +39 -74
- package/src/renderer/Renderer.ts +170 -115
- package/src/renderer/VanillaRenderer.ts +12 -9
- package/src/renderer/index.ts +4 -9
- package/src/renderer/strategy/NormalRenderingStrategy.ts +26 -22
- package/src/renderer/strategy/RenderingStrategy.ts +2 -1
- package/src/renderer/strategy/VirtualRenderingStrategy.ts +20 -13
- package/src/renderer/strategy/index.ts +4 -9
- package/src/types/external.ts +72 -0
- package/src/{type → types}/internal.ts +2 -5
- package/src/types/params.ts +15 -0
- package/src/utils.ts +37 -32
- package/CONTRIBUTING.md +0 -59
- package/NOTICE +0 -31
- package/core-packages-link.js +0 -75
- package/debug/reactive/index.html +0 -240
- package/declaration/Flicking.d.ts +0 -264
- package/declaration/camera/Camera.d.ts +0 -90
- package/declaration/cfc/withFlickingMethods.d.ts +0 -2
- package/declaration/const/error.d.ts +0 -34
- package/declaration/const/external.d.ts +0 -54
- package/declaration/control/AxesController.d.ts +0 -45
- package/declaration/control/Control.d.ts +0 -45
- package/declaration/control/FreeControl.d.ts +0 -14
- package/declaration/control/SnapControl.d.ts +0 -16
- package/declaration/control/StrictControl.d.ts +0 -20
- package/declaration/control/states/State.d.ts +0 -47
- package/declaration/core/AnchorPoint.d.ts +0 -15
- package/declaration/core/FlickingError.d.ts +0 -5
- package/declaration/core/Viewport.d.ts +0 -25
- package/declaration/core/VirtualManager.d.ts +0 -37
- package/declaration/core/index.d.ts +0 -6
- package/declaration/core/panel/Panel.d.ts +0 -89
- package/declaration/core/panel/VirtualPanel.d.ts +0 -19
- package/declaration/core/panel/index.d.ts +0 -5
- package/declaration/index.d.ts +0 -16
- package/declaration/reactive/index.d.ts +0 -25
- package/declaration/renderer/Renderer.d.ts +0 -60
- package/declaration/type/event.d.ts +0 -88
- package/declaration/type/external.d.ts +0 -31
- package/jsconfig.json +0 -5
- package/jsdoc-to-mdx.json +0 -7
- package/rollup.config.demo.js +0 -24
- package/rollup.config.dev.js +0 -12
- package/rollup.config.js +0 -57
- package/src/const/error.ts +0 -64
- package/src/const/external.ts +0 -138
- package/src/type/event.ts +0 -315
- package/src/type/external.ts +0 -78
- package/tsconfig.declaration.json +0 -17
- package/tsconfig.eslint.json +0 -10
- package/tsconfig.json +0 -23
- package/{declaration → dist}/camera/index.d.ts +0 -0
- package/{declaration → dist}/camera/mode/index.d.ts +2 -2
- package/{declaration → dist}/cfc/getRenderingPanels.d.ts +0 -0
- package/{declaration → dist}/cfc/index.d.ts +3 -3
- package/{declaration → dist}/cfc/sync.d.ts +0 -0
- package/{declaration → dist}/control/index.d.ts +7 -7
- package/{declaration → dist}/core/ResizeWatcher.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/ElementProvider.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/index.d.ts +0 -0
- package/{declaration → dist}/index.cjs.d.ts +0 -0
- package/{declaration → dist}/index.umd.d.ts +0 -0
- package/{declaration → dist}/renderer/index.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/VirtualRenderingStrategy.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/index.d.ts +1 -1
- /package/{declaration/type → dist/types}/internal.d.ts +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import Axes, { OnRelease, PanInput } from "@egjs/axes";
|
|
2
|
+
import Flicking from "../Flicking";
|
|
3
|
+
import { ControlParams } from "../types/external";
|
|
4
|
+
import StateMachine from "./StateMachine";
|
|
5
|
+
import State from "./states/State";
|
|
6
|
+
/**
|
|
7
|
+
* A controller that handles the {@link https://naver.github.io/egjs-axes/ | @egjs/axes} events
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare class AxesController {
|
|
11
|
+
private _flicking;
|
|
12
|
+
private _axes;
|
|
13
|
+
private _panInput;
|
|
14
|
+
private _stateMachine;
|
|
15
|
+
private _animatingContext;
|
|
16
|
+
private _dragged;
|
|
17
|
+
/**
|
|
18
|
+
* An {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
19
|
+
* @see https://naver.github.io/egjs-axes/docs/api/Axes
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
get axes(): Axes | null;
|
|
23
|
+
/**
|
|
24
|
+
* An {@link https://naver.github.io/egjs-axes/docs/api/PanInput | PanInput} instance
|
|
25
|
+
* @see https://naver.github.io/egjs-axes/docs/api/PanInput
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
get panInput(): PanInput | null;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
get stateMachine(): StateMachine;
|
|
33
|
+
/**
|
|
34
|
+
* A activated {@link State} that shows the current status of the user input or the animation
|
|
35
|
+
*/
|
|
36
|
+
get state(): State;
|
|
37
|
+
/**
|
|
38
|
+
* A context of the current animation playing
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
get animatingContext(): {
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A current control parameters of the Axes instance
|
|
48
|
+
*/
|
|
49
|
+
get controlParams(): ControlParams;
|
|
50
|
+
/**
|
|
51
|
+
* A Boolean indicating whether the user input is enabled
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
get enabled(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Current position value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
get position(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Current range value in {@link https://naver.github.io/egjs-axes/docs/api/Axes | Axes} instance
|
|
62
|
+
* @readonly
|
|
63
|
+
*/
|
|
64
|
+
get range(): number[];
|
|
65
|
+
/**
|
|
66
|
+
* Actual bounce size(px)
|
|
67
|
+
* @readonly
|
|
68
|
+
*/
|
|
69
|
+
get bounce(): number[] | undefined;
|
|
70
|
+
constructor();
|
|
71
|
+
/**
|
|
72
|
+
* Initialize AxesController
|
|
73
|
+
* @remarks
|
|
74
|
+
* This method creates and configures the Axes and PanInput instances.
|
|
75
|
+
* @param flicking - An instance of {@link Flicking}
|
|
76
|
+
* @returns The current instance for method chaining
|
|
77
|
+
*/
|
|
78
|
+
init(flicking: Flicking): this;
|
|
79
|
+
/**
|
|
80
|
+
* Destroy AxesController and return to initial state
|
|
81
|
+
* @remarks
|
|
82
|
+
* This method destroys the Axes and PanInput instances and removes all event handlers.
|
|
83
|
+
*/
|
|
84
|
+
destroy(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Enable input from the user (mouse/touch)
|
|
87
|
+
* @remarks
|
|
88
|
+
* Enables the PanInput to receive user interactions.
|
|
89
|
+
* @returns The current instance for method chaining
|
|
90
|
+
*/
|
|
91
|
+
enable(): this;
|
|
92
|
+
/**
|
|
93
|
+
* Disable input from the user (mouse/touch)
|
|
94
|
+
* @remarks
|
|
95
|
+
* Disables the PanInput to ignore user interactions.
|
|
96
|
+
* @returns The current instance for method chaining
|
|
97
|
+
*/
|
|
98
|
+
disable(): this;
|
|
99
|
+
/**
|
|
100
|
+
* Releases ongoing user input (mouse/touch)
|
|
101
|
+
* @remarks
|
|
102
|
+
* Immediately releases the PanInput, simulating the user lifting their finger.
|
|
103
|
+
* @returns The current instance for method chaining
|
|
104
|
+
*/
|
|
105
|
+
release(): this;
|
|
106
|
+
/**
|
|
107
|
+
* Change the destination and duration of the animation currently playing
|
|
108
|
+
* @remarks
|
|
109
|
+
* This method updates the Axes animation target position and optionally the duration.
|
|
110
|
+
* @param position - A position to move
|
|
111
|
+
* @param duration - Duration of the animation (unit: ms)
|
|
112
|
+
* @returns The current instance for method chaining
|
|
113
|
+
*/
|
|
114
|
+
updateAnimation(position: number, duration?: number): this;
|
|
115
|
+
/**
|
|
116
|
+
* Stops the animation currently playing
|
|
117
|
+
* @remarks
|
|
118
|
+
* This method immediately stops the Axes animation at the current position.
|
|
119
|
+
* @returns The current instance for method chaining
|
|
120
|
+
*/
|
|
121
|
+
stopAnimation(): this;
|
|
122
|
+
/**
|
|
123
|
+
* Update {@link https://naver.github.io/egjs-axes/ | @egjs/axes}'s state
|
|
124
|
+
* @remarks
|
|
125
|
+
* This method synchronizes the Axes state with the given control parameters.
|
|
126
|
+
* @param controlParams - Control parameters
|
|
127
|
+
* @throws {@link InitializationErrors}
|
|
128
|
+
* @returns The current instance for method chaining
|
|
129
|
+
*/
|
|
130
|
+
update(controlParams: ControlParams): this;
|
|
131
|
+
/**
|
|
132
|
+
* Attach a handler to the camera element to prevent click events during animation
|
|
133
|
+
* @remarks
|
|
134
|
+
* This is used when {@link FlickingOptions.preventClickOnDrag | preventClickOnDrag} is enabled.
|
|
135
|
+
* @returns The current instance for method chaining
|
|
136
|
+
*/
|
|
137
|
+
addPreventClickHandler(): this;
|
|
138
|
+
/**
|
|
139
|
+
* Detach a handler to the camera element to prevent click events during animation
|
|
140
|
+
* @remarks
|
|
141
|
+
* This is used when {@link FlickingOptions.preventClickOnDrag | preventClickOnDrag} is disabled.
|
|
142
|
+
* @returns The current instance for method chaining
|
|
143
|
+
*/
|
|
144
|
+
removePreventClickHandler(): this;
|
|
145
|
+
/**
|
|
146
|
+
* Run Axes's {@link https://naver.github.io/egjs-axes/docs/api/Axes#setTo | setTo} using the given position
|
|
147
|
+
* @remarks
|
|
148
|
+
* If the target position equals the current position, the promise resolves immediately without animation.
|
|
149
|
+
* @param position - A position to move
|
|
150
|
+
* @param duration - Duration of the animation (unit: ms)
|
|
151
|
+
* @param axesEvent - If provided, it'll use its {@link https://naver.github.io/egjs-axes/docs/api/Axes#setTo | setTo} method instead
|
|
152
|
+
* @throws {@link MovementErrors}
|
|
153
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
154
|
+
*/
|
|
155
|
+
animateTo(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Returns the current axes position
|
|
158
|
+
*/
|
|
159
|
+
getCurrentPosition(): number;
|
|
160
|
+
updateDirection(): void;
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
* @privateRemarks
|
|
164
|
+
* Resets all internal values to their defaults. Called during construction and destruction.
|
|
165
|
+
*/
|
|
166
|
+
private _resetInternalValues;
|
|
167
|
+
/**
|
|
168
|
+
* @internal
|
|
169
|
+
* @privateRemarks
|
|
170
|
+
* Handles the Axes hold event to reset the dragged state.
|
|
171
|
+
*/
|
|
172
|
+
private _onAxesHold;
|
|
173
|
+
/**
|
|
174
|
+
* @internal
|
|
175
|
+
* @privateRemarks
|
|
176
|
+
* Handles the Axes change event to update the dragged state.
|
|
177
|
+
*/
|
|
178
|
+
private _onAxesChange;
|
|
179
|
+
/**
|
|
180
|
+
* @internal
|
|
181
|
+
* @privateRemarks
|
|
182
|
+
* Prevents click events when the user has dragged. Used for {@link FlickingOptions.preventClickOnDrag}.
|
|
183
|
+
*/
|
|
184
|
+
private _preventClickWhenDragged;
|
|
185
|
+
}
|
|
186
|
+
export default AxesController;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { OnRelease } from "@egjs/axes";
|
|
2
|
+
import { DIRECTION } from "../constants/values";
|
|
3
|
+
import AxesController from "../control/AxesController";
|
|
4
|
+
import Panel from "../core/panel/Panel";
|
|
5
|
+
import Flicking from "../Flicking";
|
|
6
|
+
import { ValueOf } from "../types/internal";
|
|
7
|
+
/**
|
|
8
|
+
* Parameters for {@link Control.moveToPanel}
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface MoveToPanelParams {
|
|
12
|
+
/** Duration of the animation (unit: ms) */
|
|
13
|
+
duration: number;
|
|
14
|
+
/** Direction to move, only available in the {@link Flicking.circular | circular} mode */
|
|
15
|
+
direction?: ValueOf<typeof DIRECTION>;
|
|
16
|
+
/** {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes} */
|
|
17
|
+
axesEvent?: OnRelease;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A component that manages inputs and animation of Flicking
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare abstract class Control {
|
|
24
|
+
protected _flicking: Flicking | null;
|
|
25
|
+
protected _controller: AxesController;
|
|
26
|
+
protected _activePanel: Panel | null;
|
|
27
|
+
protected _nextPanel: Panel | null;
|
|
28
|
+
/**
|
|
29
|
+
* A controller that handles the {@link https://naver.github.io/egjs-axes/ | @egjs/axes} events
|
|
30
|
+
* @readonly
|
|
31
|
+
*/
|
|
32
|
+
get controller(): AxesController;
|
|
33
|
+
/**
|
|
34
|
+
* Index number of the {@link Flicking.currentPanel | currentPanel}
|
|
35
|
+
* @defaultValue 0
|
|
36
|
+
* @readonly
|
|
37
|
+
*/
|
|
38
|
+
get activeIndex(): number;
|
|
39
|
+
/**
|
|
40
|
+
* An active panel
|
|
41
|
+
* @readonly
|
|
42
|
+
*/
|
|
43
|
+
get activePanel(): Panel | null;
|
|
44
|
+
/**
|
|
45
|
+
* Whether Flicking's animating
|
|
46
|
+
* @readonly
|
|
47
|
+
*/
|
|
48
|
+
get animating(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether user is clicking or touching
|
|
51
|
+
* @readonly
|
|
52
|
+
*/
|
|
53
|
+
get holding(): boolean;
|
|
54
|
+
constructor();
|
|
55
|
+
/**
|
|
56
|
+
* Move {@link Camera} to the given position
|
|
57
|
+
* @param position - The target position to move
|
|
58
|
+
* @param duration - Duration of the panel movement animation (unit: ms)
|
|
59
|
+
* @param axesEvent - {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes}
|
|
60
|
+
* @fires {@link MovementEvents}
|
|
61
|
+
* @throws {@link MovementErrors}
|
|
62
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
63
|
+
*/
|
|
64
|
+
abstract moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Initialize Control
|
|
67
|
+
* @remarks
|
|
68
|
+
* This method is called automatically during {@link Flicking.init}. It initializes the internal controller.
|
|
69
|
+
* @param flicking - An instance of {@link Flicking}
|
|
70
|
+
* @returns The current instance for method chaining
|
|
71
|
+
*/
|
|
72
|
+
init(flicking: Flicking): this;
|
|
73
|
+
/**
|
|
74
|
+
* Destroy Control and return to initial state
|
|
75
|
+
* @remarks
|
|
76
|
+
* This method destroys the internal controller and resets all internal values.
|
|
77
|
+
*/
|
|
78
|
+
destroy(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Enable input from the user (mouse/touch)
|
|
81
|
+
* @remarks
|
|
82
|
+
* This is a shorthand for `Flicking.enableInput`.
|
|
83
|
+
* @returns The current instance for method chaining
|
|
84
|
+
*/
|
|
85
|
+
enable(): this;
|
|
86
|
+
/**
|
|
87
|
+
* Disable input from the user (mouse/touch)
|
|
88
|
+
* @remarks
|
|
89
|
+
* This is a shorthand for `Flicking.disableInput`.
|
|
90
|
+
* @returns The current instance for method chaining
|
|
91
|
+
*/
|
|
92
|
+
disable(): this;
|
|
93
|
+
/**
|
|
94
|
+
* Releases ongoing user input (mouse/touch)
|
|
95
|
+
* @remarks
|
|
96
|
+
* This method immediately releases the user's input, similar to the user lifting their finger.
|
|
97
|
+
* @returns The current instance for method chaining
|
|
98
|
+
*/
|
|
99
|
+
release(): this;
|
|
100
|
+
/**
|
|
101
|
+
* Change the destination and duration of the animation currently playing
|
|
102
|
+
* @remarks
|
|
103
|
+
* This method does nothing if no animation is currently playing.
|
|
104
|
+
* @param panel - The target panel to move
|
|
105
|
+
* @param duration - Duration of the animation (unit: ms)
|
|
106
|
+
* @param direction - Direction to move, only available in the {@link Flicking.circular | circular} mode
|
|
107
|
+
* @throws {@link AnimationUpdateErrors}
|
|
108
|
+
* @returns The current instance for method chaining
|
|
109
|
+
*/
|
|
110
|
+
updateAnimation(panel: Panel, duration?: number, direction?: ValueOf<typeof DIRECTION>): this;
|
|
111
|
+
/**
|
|
112
|
+
* Stops the animation currently playing
|
|
113
|
+
* @remarks
|
|
114
|
+
* This method does nothing if no animation is currently playing.
|
|
115
|
+
* @returns The current instance for method chaining
|
|
116
|
+
*/
|
|
117
|
+
stopAnimation(): this;
|
|
118
|
+
/**
|
|
119
|
+
* Update position after resizing
|
|
120
|
+
* @remarks
|
|
121
|
+
* This method moves the camera to the active panel's position after a resize operation.
|
|
122
|
+
* @param progressInPanel - Previous camera's progress in active panel before resize
|
|
123
|
+
* @throws {@link InitializationErrors}
|
|
124
|
+
*/
|
|
125
|
+
updatePosition(progressInPanel: number): void;
|
|
126
|
+
/**
|
|
127
|
+
* Update {@link Control.controller | controller}'s state
|
|
128
|
+
* @remarks
|
|
129
|
+
* This method synchronizes the controller state with the current camera parameters.
|
|
130
|
+
* @returns The current instance for method chaining
|
|
131
|
+
*/
|
|
132
|
+
updateInput(): this;
|
|
133
|
+
/**
|
|
134
|
+
* Reset {@link Control.activePanel | activePanel} to `null`
|
|
135
|
+
* @remarks
|
|
136
|
+
* This method is called when the active panel is removed from the renderer.
|
|
137
|
+
* @returns The current instance for method chaining
|
|
138
|
+
*/
|
|
139
|
+
resetActive(): this;
|
|
140
|
+
/**
|
|
141
|
+
* Move {@link Camera} to the given panel
|
|
142
|
+
* @param panel - The target panel to move
|
|
143
|
+
* @param options - {@link MoveToPanelParams}
|
|
144
|
+
* @fires {@link MovementEvents}
|
|
145
|
+
* @throws {@link MovementErrors}
|
|
146
|
+
* @returns A Promise which will be resolved after reaching the target panel
|
|
147
|
+
*/
|
|
148
|
+
moveToPanel(panel: Panel, { duration, direction, axesEvent }: MoveToPanelParams): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
* @privateRemarks
|
|
152
|
+
* Sets the active panel and triggers {@link ChangedEvent} or {@link RestoredEvent} based on whether the panel changed.
|
|
153
|
+
*/
|
|
154
|
+
setActive(newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean): void;
|
|
155
|
+
/**
|
|
156
|
+
* @internal
|
|
157
|
+
* @privateRemarks
|
|
158
|
+
* Copies internal state from another Control instance. Used when changing moveType option.
|
|
159
|
+
*/
|
|
160
|
+
copy(control: Control): void;
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
* @privateRemarks
|
|
164
|
+
* Triggers {@link WillChangeEvent} or {@link WillRestoreEvent} based on whether the target panel differs from the active panel.
|
|
165
|
+
*/
|
|
166
|
+
protected _triggerIndexChangeEvent(panel: Panel, position: number, axesEvent?: OnRelease, direction?: ValueOf<typeof DIRECTION>): void;
|
|
167
|
+
/**
|
|
168
|
+
* @internal
|
|
169
|
+
* @privateRemarks
|
|
170
|
+
* Animates the camera to the target position and handles animation completion or interruption.
|
|
171
|
+
*/
|
|
172
|
+
protected _animateToPosition({ position, duration, newActivePanel, axesEvent }: {
|
|
173
|
+
position: number;
|
|
174
|
+
duration: number;
|
|
175
|
+
newActivePanel: Panel;
|
|
176
|
+
axesEvent?: OnRelease;
|
|
177
|
+
}): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* @internal
|
|
180
|
+
* @privateRemarks
|
|
181
|
+
* Calculates the target position for a panel, considering circular mode and direction constraints.
|
|
182
|
+
*/
|
|
183
|
+
private _getPosition;
|
|
184
|
+
}
|
|
185
|
+
export default Control;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OnRelease } from "@egjs/axes";
|
|
2
|
+
import Control from "./Control";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the {@link FreeControl}
|
|
5
|
+
*/
|
|
6
|
+
export interface FreeControlOptions {
|
|
7
|
+
/** Make scroll animation to stop at the start/end of the scroll area, not going out the bounce area */
|
|
8
|
+
stopAtEdge: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A {@link Control} that can be scrolled freely without alignment
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare class FreeControl extends Control {
|
|
15
|
+
private _stopAtEdge;
|
|
16
|
+
/**
|
|
17
|
+
* Make scroll animation to stop at the start/end of the scroll area, not going out the bounce area
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
*/
|
|
20
|
+
get stopAtEdge(): boolean;
|
|
21
|
+
set stopAtEdge(val: FreeControlOptions["stopAtEdge"]);
|
|
22
|
+
constructor(options?: Partial<FreeControlOptions>);
|
|
23
|
+
/**
|
|
24
|
+
* Update position after resizing
|
|
25
|
+
* @remarks
|
|
26
|
+
* Unlike the base Control, FreeControl preserves the progress within the panel instead of snapping to the panel position.
|
|
27
|
+
* @param progressInPanel - Previous camera's progress in active panel before resize
|
|
28
|
+
* @throws {@link InitializationErrors}
|
|
29
|
+
*/
|
|
30
|
+
updatePosition(progressInPanel: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Move {@link Camera} to the given position
|
|
33
|
+
* @remarks
|
|
34
|
+
* Unlike SnapControl, FreeControl moves to the exact position without snapping to panel boundaries.
|
|
35
|
+
* @param position - The target position to move
|
|
36
|
+
* @param duration - Duration of the panel movement animation (unit: ms)
|
|
37
|
+
* @param axesEvent - {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes}
|
|
38
|
+
* @fires {@link MovementEvents}
|
|
39
|
+
* @throws {@link MovementErrors}
|
|
40
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
41
|
+
*/
|
|
42
|
+
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export default FreeControl;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { OnRelease } from "@egjs/axes";
|
|
2
|
+
import Control from "./Control";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the {@link SnapControl}
|
|
5
|
+
*/
|
|
6
|
+
export interface SnapControlOptions {
|
|
7
|
+
/** Maximum number of panels can go after release */
|
|
8
|
+
count: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A {@link Control} that uses a release momentum to choose destination panel
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare class SnapControl extends Control {
|
|
15
|
+
private _count;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum number of panels can go after release
|
|
18
|
+
* @defaultValue Infinity
|
|
19
|
+
*/
|
|
20
|
+
get count(): number;
|
|
21
|
+
set count(val: SnapControlOptions["count"]);
|
|
22
|
+
constructor(options?: Partial<SnapControlOptions>);
|
|
23
|
+
/**
|
|
24
|
+
* Move {@link Camera} to the given position
|
|
25
|
+
* @remarks
|
|
26
|
+
* This method calculates the snap target based on the release momentum and threshold settings.
|
|
27
|
+
* @param position - The target position to move
|
|
28
|
+
* @param duration - Duration of the panel movement animation (unit: ms)
|
|
29
|
+
* @param axesEvent - {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes}
|
|
30
|
+
* @fires {@link MovementEvents}
|
|
31
|
+
* @throws {@link MovementErrors}
|
|
32
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
33
|
+
*/
|
|
34
|
+
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
* @privateRemarks
|
|
38
|
+
* Finds the anchor point to snap to based on the target position and count option.
|
|
39
|
+
*/
|
|
40
|
+
private _findSnappedAnchor;
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* @privateRemarks
|
|
44
|
+
* Finds the adjacent anchor point based on the movement direction.
|
|
45
|
+
*/
|
|
46
|
+
private _findAdjacentAnchor;
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
* @privateRemarks
|
|
50
|
+
* Calculates the snap threshold based on the panel size and alignment.
|
|
51
|
+
*/
|
|
52
|
+
private _calcSnapThreshold;
|
|
53
|
+
}
|
|
54
|
+
export default SnapControl;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { OnRelease } from "@egjs/axes";
|
|
2
|
+
import Panel from "../core/panel/Panel";
|
|
3
|
+
import Control, { MoveToPanelParams } from "./Control";
|
|
4
|
+
/**
|
|
5
|
+
* Options for the {@link StrictControl}
|
|
6
|
+
*/
|
|
7
|
+
export interface StrictControlOptions {
|
|
8
|
+
/** Maximum number of panels that can be moved at a time */
|
|
9
|
+
count: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A {@link Control} that allows you to select the maximum number of panels to move at a time
|
|
13
|
+
* @since 4.2.0
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
declare class StrictControl extends Control {
|
|
17
|
+
private _count;
|
|
18
|
+
private _indexRange;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of panels that can be moved at a time
|
|
21
|
+
* @defaultValue 1
|
|
22
|
+
*/
|
|
23
|
+
get count(): number;
|
|
24
|
+
set count(val: StrictControlOptions["count"]);
|
|
25
|
+
constructor(options?: Partial<StrictControlOptions>);
|
|
26
|
+
/**
|
|
27
|
+
* Destroy Control and return to initial state
|
|
28
|
+
* @remarks
|
|
29
|
+
* This method also resets the index range used for movement constraints.
|
|
30
|
+
*/
|
|
31
|
+
destroy(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Update {@link Control.controller | controller}'s state
|
|
34
|
+
* @remarks
|
|
35
|
+
* StrictControl limits the movement range based on the {@link StrictControlOptions.count | count} option.
|
|
36
|
+
* @returns The current instance for method chaining
|
|
37
|
+
*/
|
|
38
|
+
updateInput(): this;
|
|
39
|
+
moveToPanel(panel: Panel, options: MoveToPanelParams): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Move {@link Camera} to the given position
|
|
42
|
+
* @remarks
|
|
43
|
+
* StrictControl restricts movement to panels within the allowed index range based on the count option.
|
|
44
|
+
* @param position - The target position to move
|
|
45
|
+
* @param duration - Duration of the panel movement animation (unit: ms)
|
|
46
|
+
* @param axesEvent - {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes}
|
|
47
|
+
* @fires {@link MovementEvents}
|
|
48
|
+
* @throws {@link MovementErrors}
|
|
49
|
+
* @returns A Promise which will be resolved after reaching the target position
|
|
50
|
+
*/
|
|
51
|
+
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
52
|
+
setActive: (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
* @privateRemarks
|
|
56
|
+
* Resets the index range to default values.
|
|
57
|
+
*/
|
|
58
|
+
private _resetIndexRange;
|
|
59
|
+
}
|
|
60
|
+
export default StrictControl;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import State from "./State";
|
|
2
|
+
/**
|
|
3
|
+
* A state that activates when Flicking's animating by user input or method call
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
declare class AnimatingState extends State {
|
|
7
|
+
/**
|
|
8
|
+
* Whether user is clicking or touching
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
3
11
|
readonly holding = false;
|
|
12
|
+
/**
|
|
13
|
+
* Whether Flicking's animating
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
4
16
|
readonly animating = true;
|
|
5
17
|
onHold(ctx: Parameters<State["onHold"]>[0]): void;
|
|
6
18
|
onChange(ctx: Parameters<State["onChange"]>[0]): void;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import State from "./State";
|
|
2
|
+
/**
|
|
3
|
+
* A state that activates when Flicking is stopped by event's `stop` method
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
declare class DisabledState extends State {
|
|
7
|
+
/**
|
|
8
|
+
* Whether user is clicking or touching
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
3
11
|
readonly holding = false;
|
|
12
|
+
/**
|
|
13
|
+
* Whether Flicking's animating
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
4
16
|
readonly animating = true;
|
|
5
17
|
onAnimationEnd(ctx: Parameters<State["onAnimationEnd"]>[0]): void;
|
|
6
18
|
onChange(ctx: Parameters<State["onChange"]>[0]): void;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import State from "./State";
|
|
2
|
+
/**
|
|
3
|
+
* A state that activates when user's dragging the Flicking area
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
declare class DraggingState extends State {
|
|
7
|
+
/**
|
|
8
|
+
* Whether user is clicking or touching
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
3
11
|
readonly holding = true;
|
|
12
|
+
/**
|
|
13
|
+
* Whether Flicking's animating
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
4
16
|
readonly animating = true;
|
|
5
17
|
onChange(ctx: Parameters<State["onChange"]>[0]): void;
|
|
6
18
|
onRelease(ctx: Parameters<State["onRelease"]>[0]): void;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import State from "./State";
|
|
2
|
+
/**
|
|
3
|
+
* A state that activates when user's holding the Flicking area, but not moved a single pixel yet
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
declare class HoldingState extends State {
|
|
7
|
+
/**
|
|
8
|
+
* Whether user is clicking or touching
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
3
11
|
readonly holding = true;
|
|
12
|
+
/**
|
|
13
|
+
* Whether Flicking's animating
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
4
16
|
readonly animating = false;
|
|
5
17
|
private _releaseEvent;
|
|
6
18
|
onChange(ctx: Parameters<State["onChange"]>[0]): void;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import State from "./State";
|
|
2
|
+
/**
|
|
3
|
+
* A default state when there's no user input and no animation's playing
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
2
6
|
declare class IdleState extends State {
|
|
7
|
+
/**
|
|
8
|
+
* Whether user is clicking or touching
|
|
9
|
+
* @readonly
|
|
10
|
+
*/
|
|
3
11
|
readonly holding = false;
|
|
12
|
+
/**
|
|
13
|
+
* Whether Flicking's animating
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
4
16
|
readonly animating = false;
|
|
5
17
|
onEnter(): void;
|
|
6
18
|
onHold(ctx: Parameters<State["onHold"]>[0]): void;
|