@egjs/flicking 4.15.0 → 4.16.0-beta.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/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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Flicking from "./Flicking";
|
|
2
|
+
export * from "./CrossFlicking";
|
|
3
|
+
export * from "./CrossFlicking";
|
|
4
|
+
export * from "./camera";
|
|
5
|
+
export * from "./cfc";
|
|
6
|
+
export * from "./constants/values";
|
|
7
|
+
export * from "./control";
|
|
8
|
+
export * from "./core";
|
|
9
|
+
export * from "./error";
|
|
10
|
+
export * from "./event";
|
|
11
|
+
export * from "./Flicking";
|
|
12
|
+
export * from "./reactive";
|
|
13
|
+
export * from "./renderer";
|
|
14
|
+
export * from "./types/external";
|
|
15
|
+
export * from "./utils";
|
|
16
|
+
export default Flicking;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ReactiveObject, ReactiveSetupAdapter } from "@cfcs/core";
|
|
2
|
+
import Flicking from "../Flicking";
|
|
3
|
+
/**
|
|
4
|
+
* Reactive object type that combines state and methods for Flicking
|
|
5
|
+
* @remarks
|
|
6
|
+
* This type provides reactive state properties and methods that automatically update
|
|
7
|
+
* when the Flicking instance state changes.
|
|
8
|
+
* @see {@link https://naver.github.io/egjs-flicking/Demos#reactive-api-demo}
|
|
9
|
+
* @example
|
|
10
|
+
* ```jsx
|
|
11
|
+
* const flickingRef = React.useRef(null);
|
|
12
|
+
* const {
|
|
13
|
+
* progress
|
|
14
|
+
* } = useFlickingReactiveAPI(flickingRef);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare type FlickingReactiveObject = ReactiveObject<FlickingReactiveState & FlickingReactiveMethod>;
|
|
18
|
+
/**
|
|
19
|
+
* Reactive state properties for Flicking
|
|
20
|
+
*/
|
|
21
|
+
export interface FlickingReactiveState {
|
|
22
|
+
/** Whether Flicking has reached the first panel */
|
|
23
|
+
isReachStart: boolean;
|
|
24
|
+
/** Whether Flicking has reached the last panel */
|
|
25
|
+
isReachEnd: boolean;
|
|
26
|
+
/** Total number of panels */
|
|
27
|
+
totalPanelCount: number;
|
|
28
|
+
/** Current active panel index */
|
|
29
|
+
currentPanelIndex: number;
|
|
30
|
+
/** Overall scroll progress percentage (0-100) */
|
|
31
|
+
progress: number;
|
|
32
|
+
/** Panel progress with decimal values */
|
|
33
|
+
indexProgress: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Reactive methods for Flicking
|
|
37
|
+
*/
|
|
38
|
+
export interface FlickingReactiveMethod {
|
|
39
|
+
/**
|
|
40
|
+
* Move to a specific panel index
|
|
41
|
+
* @param i - Target panel index
|
|
42
|
+
* @returns Promise that resolves when movement is complete
|
|
43
|
+
*/
|
|
44
|
+
moveTo: (i: number) => Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Data required for reactive API setup
|
|
48
|
+
*/
|
|
49
|
+
export interface FlickingReactiveData {
|
|
50
|
+
/** Flicking instance to connect */
|
|
51
|
+
flicking?: Flicking;
|
|
52
|
+
/** Flicking options used for initialization */
|
|
53
|
+
options?: FlickingReactiveAPIOptions;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for Flicking reactive API that help optimize initial rendering in SSR scenarios
|
|
57
|
+
* @remarks
|
|
58
|
+
* These options allow you to set initial state values before the Flicking instance is fully initialized,
|
|
59
|
+
* preventing unnecessary re-renders when the actual Flicking state is applied.
|
|
60
|
+
* @example
|
|
61
|
+
* ```js
|
|
62
|
+
* const options = {
|
|
63
|
+
* defaultIndex: 2,
|
|
64
|
+
* totalPanelCount: 5
|
|
65
|
+
* };
|
|
66
|
+
* const reactiveObj = connectFlickingReactiveAPI(flicking, options);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export interface FlickingReactiveAPIOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Initial panel index to start with. This sets the currentPanelIndex and indexProgress initial values.
|
|
72
|
+
* @remarks
|
|
73
|
+
* Also affects isReachStart and isReachEnd initial value setting.
|
|
74
|
+
* @defaultValue 0
|
|
75
|
+
*/
|
|
76
|
+
defaultIndex?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Total number of panels in the Flicking instance. This sets the totalPanelCount initial value
|
|
79
|
+
* @remarks
|
|
80
|
+
* Helps prevent layout shifts during SSR hydration.
|
|
81
|
+
* @defaultValue 0
|
|
82
|
+
*/
|
|
83
|
+
totalPanelCount?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Internal reactive API adapter for Flicking that manages state and event listeners
|
|
87
|
+
* @remarks
|
|
88
|
+
* This adapter is used internally by framework-specific packages (react-flicking, vue-flicking, etc.)
|
|
89
|
+
* to provide reactive API support. Users rarely need to use this directly.
|
|
90
|
+
* @param onInit - Callback when reactive object is initialized
|
|
91
|
+
* @param onDestroy - Callback when reactive object is destroyed
|
|
92
|
+
* @param setMethods - Function to set available methods
|
|
93
|
+
* @returns Reactive object with Flicking state and methods
|
|
94
|
+
*/
|
|
95
|
+
declare const flickingReactiveAPIAdapter: ReactiveSetupAdapter<FlickingReactiveObject, FlickingReactiveState, "moveTo", FlickingReactiveData>;
|
|
96
|
+
/**
|
|
97
|
+
* Connect Flicking instance to reactive API
|
|
98
|
+
* @param flicking - Flicking instance to connect
|
|
99
|
+
* @param options - Flicking options
|
|
100
|
+
* @returns Reactive object with Flicking state and methods
|
|
101
|
+
* @example
|
|
102
|
+
* ```js
|
|
103
|
+
* import Flicking, { connectFlickingReactiveAPI } from "@egjs/flicking";
|
|
104
|
+
*
|
|
105
|
+
* const flicking = new Flicking("#el");
|
|
106
|
+
* const reactiveObj = connectFlickingReactiveAPI(flicking);
|
|
107
|
+
*
|
|
108
|
+
* // Access reactive state
|
|
109
|
+
* console.log("Current panel:", reactiveObj.currentPanelIndex);
|
|
110
|
+
* console.log("Progress:", reactiveObj.progress + "%");
|
|
111
|
+
* console.log("Is at start:", reactiveObj.isReachStart);
|
|
112
|
+
* console.log("Is at end:", reactiveObj.isReachEnd);
|
|
113
|
+
* console.log("Total panels:", reactiveObj.totalPanelCount);
|
|
114
|
+
* console.log("Index progress:", reactiveObj.indexProgress);
|
|
115
|
+
*
|
|
116
|
+
* // Subscribe to state changes
|
|
117
|
+
* reactiveObj.subscribe("currentPanelIndex", (nextValue) => {
|
|
118
|
+
* console.log("Panel changed to:", nextValue);
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Use reactive methods
|
|
122
|
+
* reactiveObj.moveTo(2); // Move to third panel
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare const connectFlickingReactiveAPI: (flicking: Flicking, options?: FlickingReactiveAPIOptions | undefined) => FlickingReactiveObject;
|
|
126
|
+
export { flickingReactiveAPIAdapter, connectFlickingReactiveAPI };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import Panel from "../core/panel/Panel";
|
|
2
2
|
import Renderer from "./Renderer";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
3
6
|
declare abstract class ExternalRenderer extends Renderer {
|
|
4
7
|
protected _removePanelElements(panels: Panel[]): void;
|
|
5
8
|
protected _removeAllChildsFromCamera(): void;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import Panel, { PanelOptions } from "../core/panel/Panel";
|
|
2
|
+
import Flicking, { FlickingOptions } from "../Flicking";
|
|
3
|
+
import RenderingStrategy from "./strategy/RenderingStrategy";
|
|
4
|
+
/**
|
|
5
|
+
* Options for creating a {@link Renderer}
|
|
6
|
+
*/
|
|
7
|
+
export interface RendererOptions {
|
|
8
|
+
/** An {@link Flicking.align | align} value that will be applied to all panels */
|
|
9
|
+
align?: FlickingOptions["align"];
|
|
10
|
+
/** An instance of RenderingStrategy(internal module) */
|
|
11
|
+
strategy: RenderingStrategy;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parameters for {@link Renderer.batchInsert}
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface BatchInsertParams {
|
|
18
|
+
/** Index to insert new panels at */
|
|
19
|
+
index: number;
|
|
20
|
+
/** An array of element or framework component with element in it */
|
|
21
|
+
elements: any[];
|
|
22
|
+
/** Whether it contains actual DOM elements. If set to true, renderer will add them to the camera element */
|
|
23
|
+
hasDOMInElements: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parameters for {@link Renderer.batchRemove}
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export interface BatchRemoveParams {
|
|
30
|
+
/** Index of panel to remove */
|
|
31
|
+
index: number;
|
|
32
|
+
/** Number of panels to remove from index */
|
|
33
|
+
deleteCount: number;
|
|
34
|
+
/** Whether it contains actual DOM elements. If set to true, renderer will remove them from the camera element */
|
|
35
|
+
hasDOMInElements: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A component that manages {@link Panel} and its elements
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
declare abstract class Renderer {
|
|
42
|
+
protected _flicking: Flicking | null;
|
|
43
|
+
protected _panels: Panel[];
|
|
44
|
+
protected _rendering: boolean;
|
|
45
|
+
protected _align: NonNullable<RendererOptions["align"]>;
|
|
46
|
+
protected _strategy: RendererOptions["strategy"];
|
|
47
|
+
/**
|
|
48
|
+
* Array of panels
|
|
49
|
+
* @readonly
|
|
50
|
+
* @see Panel
|
|
51
|
+
*/
|
|
52
|
+
get panels(): Panel[];
|
|
53
|
+
/**
|
|
54
|
+
* A boolean value indicating whether rendering is in progress
|
|
55
|
+
* @readonly
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
get rendering(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Count of panels
|
|
61
|
+
* @readonly
|
|
62
|
+
*/
|
|
63
|
+
get panelCount(): number;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
get strategy(): RendererOptions["strategy"];
|
|
68
|
+
/**
|
|
69
|
+
* A {@link Panel}'s {@link Panel.align | align} value that applied to all panels
|
|
70
|
+
*/
|
|
71
|
+
get align(): NonNullable<RendererOptions["align"]>;
|
|
72
|
+
set align(val: NonNullable<RendererOptions["align"]>);
|
|
73
|
+
/**
|
|
74
|
+
* @param options - {@link RendererOptions}
|
|
75
|
+
*/
|
|
76
|
+
constructor(options: RendererOptions);
|
|
77
|
+
/**
|
|
78
|
+
* Render panel elements inside the camera element
|
|
79
|
+
* @remarks
|
|
80
|
+
* This method updates the DOM to reflect the current panel state.
|
|
81
|
+
* @returns A Promise that resolves when rendering is complete
|
|
82
|
+
*/
|
|
83
|
+
abstract render(): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
* @privateRemarks
|
|
87
|
+
* Collects panel elements from the camera element and creates Panel instances.
|
|
88
|
+
*/
|
|
89
|
+
protected abstract _collectPanels(): void;
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
* @privateRemarks
|
|
93
|
+
* Creates a Panel instance from an element with the given options.
|
|
94
|
+
*/
|
|
95
|
+
protected abstract _createPanel(el: any, options: Omit<PanelOptions, "elementProvider">): Panel;
|
|
96
|
+
/**
|
|
97
|
+
* Initialize Renderer
|
|
98
|
+
* @remarks
|
|
99
|
+
* This method is called automatically during {@link Flicking.init}. It collects existing panel elements.
|
|
100
|
+
* @param flicking - An instance of {@link Flicking}
|
|
101
|
+
* @returns The current instance for method chaining
|
|
102
|
+
*/
|
|
103
|
+
init(flicking: Flicking): this;
|
|
104
|
+
/**
|
|
105
|
+
* Destroy Renderer and return to initial state
|
|
106
|
+
* @remarks
|
|
107
|
+
* This method clears all panel references and resets the internal state.
|
|
108
|
+
*/
|
|
109
|
+
destroy(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Return the {@link Panel} at the given index. `null` if it doesn't exist.
|
|
112
|
+
* @remarks
|
|
113
|
+
* This is equivalent to accessing `Flicking.panels[index]`.
|
|
114
|
+
* @param index - Index of the panel to get
|
|
115
|
+
* @returns Panel at the given index
|
|
116
|
+
* @see Panel
|
|
117
|
+
*/
|
|
118
|
+
getPanel(index: number): Panel | null;
|
|
119
|
+
forceRenderAllPanels(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Return Rendered Panels
|
|
122
|
+
* @returns Rendered Panels
|
|
123
|
+
*/
|
|
124
|
+
getRenderedPanels(): Panel[];
|
|
125
|
+
/**
|
|
126
|
+
* Update all panel sizes
|
|
127
|
+
* @returns The current instance for method chaining
|
|
128
|
+
*/
|
|
129
|
+
updatePanelSize(): this;
|
|
130
|
+
/**
|
|
131
|
+
* Insert new panels at given index
|
|
132
|
+
* @remarks
|
|
133
|
+
* This will increase index of panels after by the number of panels added.
|
|
134
|
+
* @param items - An array of {@link BatchInsertParams}
|
|
135
|
+
* @throws {@link DOMManipulationErrors}
|
|
136
|
+
* @returns An array of inserted panels
|
|
137
|
+
*/
|
|
138
|
+
batchInsert(...items: BatchInsertParams[]): Panel[];
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
* @privateRemarks
|
|
142
|
+
* Defers update. Camera position & others will be updated after calling updateAfterPanelChange.
|
|
143
|
+
*/
|
|
144
|
+
batchInsertDefer(...items: BatchInsertParams[]): Panel[];
|
|
145
|
+
/**
|
|
146
|
+
* Remove the panel at the given index
|
|
147
|
+
* @remarks
|
|
148
|
+
* This will decrease index of panels after by the number of panels removed.
|
|
149
|
+
* @param items - An array of {@link BatchRemoveParams}
|
|
150
|
+
* @throws {@link DOMManipulationErrors}
|
|
151
|
+
* @returns An array of removed panels
|
|
152
|
+
*/
|
|
153
|
+
batchRemove(...items: BatchRemoveParams[]): Panel[];
|
|
154
|
+
/**
|
|
155
|
+
* @internal
|
|
156
|
+
* @privateRemarks
|
|
157
|
+
* Defers update. Camera position & others will be updated after calling updateAfterPanelChange.
|
|
158
|
+
*/
|
|
159
|
+
batchRemoveDefer(...items: BatchRemoveParams[]): Panel[];
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
* @privateRemarks
|
|
163
|
+
* Updates camera, control, and triggers {@link PanelChangeEvent} after panels are added or removed.
|
|
164
|
+
*/
|
|
165
|
+
updateAfterPanelChange(panelsAdded: Panel[], panelsRemoved: Panel[]): void;
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
* @privateRemarks
|
|
169
|
+
* Checks if panel contents (images/videos) are ready and triggers resize when loaded.
|
|
170
|
+
*/
|
|
171
|
+
checkPanelContentsReady(checkingPanels: Panel[]): void;
|
|
172
|
+
/**
|
|
173
|
+
* @internal
|
|
174
|
+
* @privateRemarks
|
|
175
|
+
* Updates camera range, anchors, and control input after panel changes.
|
|
176
|
+
*/
|
|
177
|
+
protected _updateCameraAndControl(): void;
|
|
178
|
+
/**
|
|
179
|
+
* @internal
|
|
180
|
+
* @privateRemarks
|
|
181
|
+
* Marks only visible panels for rendering when {@link FlickingOptions.renderOnlyVisible | renderOnlyVisible} is enabled.
|
|
182
|
+
*/
|
|
183
|
+
protected _showOnlyVisiblePanels(flicking: Flicking): void;
|
|
184
|
+
/**
|
|
185
|
+
* @internal
|
|
186
|
+
* @privateRemarks
|
|
187
|
+
* Calculates and applies panel sizes when {@link FlickingOptions.panelsPerView | panelsPerView} is enabled.
|
|
188
|
+
*/
|
|
189
|
+
protected _updatePanelSizeByGrid(referencePanel: Panel, panels: Panel[]): void;
|
|
190
|
+
/**
|
|
191
|
+
* @internal
|
|
192
|
+
* @privateRemarks
|
|
193
|
+
* Removes all child elements from the camera element.
|
|
194
|
+
*/
|
|
195
|
+
protected _removeAllChildsFromCamera(): void;
|
|
196
|
+
/**
|
|
197
|
+
* @internal
|
|
198
|
+
* @privateRemarks
|
|
199
|
+
* Inserts panel elements into the camera element at the specified position.
|
|
200
|
+
*/
|
|
201
|
+
protected _insertPanelElements(panels: Panel[], nextSibling?: Panel | null): void;
|
|
202
|
+
/**
|
|
203
|
+
* @internal
|
|
204
|
+
* @privateRemarks
|
|
205
|
+
* Removes panel elements from the camera element.
|
|
206
|
+
*/
|
|
207
|
+
protected _removePanelElements(panels: Panel[]): void;
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
* @privateRemarks
|
|
211
|
+
* Called after rendering to apply the camera transform.
|
|
212
|
+
*/
|
|
213
|
+
protected _afterRender(): void;
|
|
214
|
+
}
|
|
215
|
+
export default Renderer;
|
|
@@ -4,7 +4,13 @@ declare class VanillaRenderer extends Renderer {
|
|
|
4
4
|
render(): Promise<void>;
|
|
5
5
|
protected _collectPanels(): void;
|
|
6
6
|
protected _createPanel(el: HTMLElement, options: Omit<PanelOptions, "elementProvider">): Panel;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
private _resetPanelElementOrder;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
8
14
|
private _removeAllTextNodes;
|
|
9
15
|
}
|
|
10
16
|
export default VanillaRenderer;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Flicking from "../../Flicking";
|
|
2
1
|
import Panel, { PanelOptions } from "../../core/panel/Panel";
|
|
3
2
|
import ElementProvider from "../../core/panel/provider/ElementProvider";
|
|
3
|
+
import Flicking from "../../Flicking";
|
|
4
4
|
import RenderingStrategy from "./RenderingStrategy";
|
|
5
5
|
export interface NormalRenderingStrategyOptions {
|
|
6
6
|
providerCtor: new (...args: any) => ElementProvider;
|
|
7
7
|
}
|
|
8
8
|
declare class NormalRenderingStrategy implements RenderingStrategy {
|
|
9
9
|
private _providerCtor;
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(options: NormalRenderingStrategyOptions);
|
|
11
11
|
renderPanels(): void;
|
|
12
12
|
getRenderingIndexesByOrder(flicking: Flicking): number[];
|
|
13
13
|
getRenderingElementsByOrder(flicking: Flicking): HTMLElement[];
|
|
@@ -18,6 +18,9 @@ declare class NormalRenderingStrategy implements RenderingStrategy {
|
|
|
18
18
|
width: number | string;
|
|
19
19
|
height: number | string;
|
|
20
20
|
}>): void;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
21
24
|
private _showOnlyVisiblePanels;
|
|
22
25
|
}
|
|
23
26
|
export default NormalRenderingStrategy;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import Flicking from "../../Flicking";
|
|
2
1
|
import Panel, { PanelOptions } from "../../core/panel/Panel";
|
|
2
|
+
import Flicking from "../../Flicking";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
3
6
|
interface RenderingStrategy {
|
|
4
7
|
renderPanels(flicking: Flicking): void;
|
|
5
8
|
getRenderingIndexesByOrder(flicking: Flicking): number[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MOVE_TYPE } from "../constants/values";
|
|
2
|
+
import { FreeControlOptions, SnapControlOptions, StrictControlOptions } from "../control";
|
|
3
|
+
import Flicking from "../Flicking";
|
|
4
|
+
import { ValueOf } from "./internal";
|
|
5
|
+
/**
|
|
6
|
+
* HTML `string` of single/mutiple HTMLElement, or an instance of `HTMLElement`
|
|
7
|
+
*/
|
|
8
|
+
export declare type ElementLike = string | HTMLElement;
|
|
9
|
+
/**
|
|
10
|
+
* Flicking Plugin
|
|
11
|
+
*/
|
|
12
|
+
export interface Plugin {
|
|
13
|
+
/** Initialize the plugin */
|
|
14
|
+
init(flicking: Flicking): void;
|
|
15
|
+
/** Destroy plugin and detach all events binded */
|
|
16
|
+
destroy(): void;
|
|
17
|
+
/** Update plugin to match current Flicking's status */
|
|
18
|
+
update(flicking: Flicking): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Flicking Status returned by {@link Flicking.getStatus}
|
|
22
|
+
*/
|
|
23
|
+
export interface Status {
|
|
24
|
+
/** An index of the active panel */
|
|
25
|
+
index?: number;
|
|
26
|
+
/** A info to restore camera {@link Camera.position | position} */
|
|
27
|
+
position?: {
|
|
28
|
+
/** An index of the panel camera is located at */
|
|
29
|
+
panel: number;
|
|
30
|
+
/** A progress of the camera position inside the panel */
|
|
31
|
+
progressInPanel: number;
|
|
32
|
+
};
|
|
33
|
+
/** An offset to visible panel's original index. This value is available only when `visiblePanelsOnly` is `true` */
|
|
34
|
+
visibleOffset?: number;
|
|
35
|
+
/** A data array of panels */
|
|
36
|
+
panels: Array<{
|
|
37
|
+
/** An index of the panel */
|
|
38
|
+
index: number;
|
|
39
|
+
/** An `outerHTML` of the panel element */
|
|
40
|
+
html?: string;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
export declare type MoveTypeOptions<T extends ValueOf<typeof MOVE_TYPE>> = T extends typeof MOVE_TYPE.SNAP ? [T] | [T, Partial<SnapControlOptions>] : T extends typeof MOVE_TYPE.FREE_SCROLL ? [T] | [T, Partial<FreeControlOptions>] : T extends typeof MOVE_TYPE.STRICT ? [T] | [T, Partial<StrictControlOptions>] : [T];
|
|
44
|
+
/**
|
|
45
|
+
* A current parameters of the Camera for updating {@link AxesController}
|
|
46
|
+
* @readonly
|
|
47
|
+
*/
|
|
48
|
+
export interface ControlParams {
|
|
49
|
+
/** A moveable range for Camera */
|
|
50
|
+
range: {
|
|
51
|
+
min: number;
|
|
52
|
+
max: number;
|
|
53
|
+
};
|
|
54
|
+
/** Current camera position */
|
|
55
|
+
position: number;
|
|
56
|
+
/** A Boolean indicating whether the {@link Flicking.circular | circular} option is enabled */
|
|
57
|
+
circular: boolean;
|
|
58
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ALIGN, DIRECTION } from "./constants/values";
|
|
1
2
|
import Flicking, { FlickingOptions } from "./Flicking";
|
|
2
|
-
import {
|
|
3
|
-
import { LiteralUnion, Merged, ValueOf } from "./
|
|
4
|
-
import { ElementLike } from "./type/external";
|
|
3
|
+
import { ElementLike } from "./types/external";
|
|
4
|
+
import { LiteralUnion, Merged, ValueOf } from "./types/internal";
|
|
5
5
|
export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>;
|
|
6
|
-
export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement) => HTMLElement;
|
|
6
|
+
export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement | undefined) => HTMLElement;
|
|
7
7
|
export declare const checkExistence: (value: any, nameOnErrMsg: string) => void;
|
|
8
8
|
export declare const clamp: (x: number, min: number, max: number) => number;
|
|
9
9
|
export declare const getFlickingAttached: (val: Flicking | null) => Flicking;
|
|
@@ -23,8 +23,8 @@ export declare const getMinusCompensatedIndex: (idx: number, max: number) => num
|
|
|
23
23
|
export declare const includes: <T>(array: T[], target: any) => target is T;
|
|
24
24
|
export declare const isString: (val: any) => val is string;
|
|
25
25
|
export declare const circulatePosition: (pos: number, min: number, max: number) => number;
|
|
26
|
-
export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
27
|
-
export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T;
|
|
26
|
+
export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T | null;
|
|
27
|
+
export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T | null;
|
|
28
28
|
export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number;
|
|
29
29
|
export declare const getProgress: (pos: number, prev: number, next: number) => number;
|
|
30
30
|
export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration;
|
|
@@ -42,6 +42,6 @@ export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOf
|
|
|
42
42
|
useOffset: boolean;
|
|
43
43
|
style: CSSStyleDeclaration;
|
|
44
44
|
}) => number;
|
|
45
|
-
export declare const setPrototypeOf: (o: any, proto: object) => any;
|
|
45
|
+
export declare const setPrototypeOf: (o: any, proto: object | null) => any;
|
|
46
46
|
export declare const camelize: (str: string) => string;
|
|
47
47
|
export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;
|