@egjs/flicking 4.3.1 → 4.5.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 +1 -2
- package/declaration/Flicking.d.ts +30 -12
- package/declaration/camera/Camera.d.ts +29 -26
- package/declaration/camera/index.d.ts +2 -4
- package/declaration/camera/mode/BoundCameraMode.d.ts +13 -0
- package/declaration/camera/mode/CameraMode.d.ts +19 -0
- package/declaration/camera/mode/CircularCameraMode.d.ts +18 -0
- package/declaration/camera/mode/LinearCameraMode.d.ts +9 -0
- package/declaration/camera/mode/index.d.ts +6 -0
- package/declaration/const/error.d.ts +3 -1
- package/declaration/const/external.d.ts +9 -0
- package/declaration/core/AutoResizer.d.ts +13 -0
- package/declaration/core/VirtualManager.d.ts +37 -0
- package/declaration/core/index.d.ts +2 -1
- package/declaration/core/panel/Panel.d.ts +13 -7
- package/declaration/core/panel/VirtualPanel.d.ts +19 -0
- package/declaration/core/panel/index.d.ts +4 -4
- package/declaration/core/panel/provider/ElementProvider.d.ts +8 -0
- package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -0
- package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -0
- package/declaration/core/panel/provider/index.d.ts +5 -0
- package/declaration/index.d.ts +11 -1
- package/declaration/renderer/ExternalRenderer.d.ts +1 -1
- package/declaration/renderer/Renderer.d.ts +17 -12
- package/declaration/renderer/VanillaRenderer.d.ts +2 -7
- package/declaration/renderer/index.d.ts +1 -0
- package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -0
- package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -0
- package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -0
- package/declaration/renderer/strategy/index.d.ts +5 -0
- package/declaration/type/external.d.ts +1 -3
- package/declaration/utils.d.ts +7 -1
- package/dist/flicking.esm.js +2526 -1475
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +2561 -1485
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +9006 -8312
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +12 -24
- package/src/Flicking.ts +172 -45
- package/src/camera/Camera.ts +201 -93
- package/src/camera/index.ts +3 -7
- package/src/camera/{BoundCamera.ts → mode/BoundCameraMode.ts} +46 -43
- package/src/camera/mode/CameraMode.ts +77 -0
- package/src/camera/mode/CircularCameraMode.ts +171 -0
- package/src/camera/mode/LinearCameraMode.ts +23 -0
- package/src/camera/mode/index.ts +14 -0
- package/src/cfc/sync.ts +10 -5
- package/src/const/error.ts +6 -3
- package/src/const/external.ts +18 -0
- package/src/control/AxesController.ts +11 -6
- package/src/control/Control.ts +6 -6
- package/src/control/FreeControl.ts +2 -2
- package/src/control/SnapControl.ts +3 -3
- package/src/control/StrictControl.ts +2 -2
- package/src/core/AutoResizer.ts +81 -0
- package/src/core/Viewport.ts +4 -4
- package/src/core/VirtualManager.ts +188 -0
- package/src/core/index.ts +3 -1
- package/src/core/panel/Panel.ts +54 -34
- package/src/core/panel/VirtualPanel.ts +110 -0
- package/src/core/panel/index.ts +5 -7
- package/src/core/panel/provider/ElementProvider.ts +14 -0
- package/src/core/panel/provider/VanillaElementProvider.ts +45 -0
- package/src/core/panel/provider/VirtualElementProvider.ts +48 -0
- package/src/core/panel/provider/index.ts +16 -0
- package/src/index.ts +12 -1
- package/src/index.umd.ts +2 -0
- package/src/renderer/ExternalRenderer.ts +7 -7
- package/src/renderer/Renderer.ts +106 -65
- package/src/renderer/VanillaRenderer.ts +28 -86
- package/src/renderer/index.ts +2 -0
- package/src/renderer/strategy/NormalRenderingStrategy.ts +106 -0
- package/src/renderer/strategy/RenderingStrategy.ts +21 -0
- package/src/renderer/strategy/VirtualRenderingStrategy.ts +110 -0
- package/src/renderer/strategy/index.ts +17 -0
- package/src/utils.ts +36 -2
- package/declaration/camera/BoundCamera.d.ts +0 -9
- package/declaration/camera/CircularCamera.d.ts +0 -36
- package/declaration/camera/LinearCamera.d.ts +0 -5
- package/declaration/core/panel/ElementPanel.d.ts +0 -14
- package/declaration/core/panel/ExternalPanel.d.ts +0 -9
- package/declaration/exports.d.ts +0 -10
- package/src/camera/CircularCamera.ts +0 -269
- package/src/camera/LinearCamera.ts +0 -35
- package/src/core/panel/ElementPanel.ts +0 -52
- package/src/core/panel/ExternalPanel.ts +0 -32
- package/src/exports.ts +0 -16
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
<p align="center" style="line-height: 2;">
|
|
7
7
|
<a href="https://www.npmjs.com/package/@egjs/flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/flicking.svg?style=flat-square&color=007acc&label=version&logo=NPM" alt="version" /></a>
|
|
8
8
|
<a href="https://www.npmjs.com/package/@egjs/flicking" target="_blank"><img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/@egjs/flicking.svg?style=flat-square&label=%F0%9F%92%BE%20gzipped&color=007acc" /></a>
|
|
9
|
-
<a href="https://travis-ci.org/naver/egjs-flicking" target="_blank"><img alt="Travis (.org)" src="https://img.shields.io/travis/naver/egjs-flicking.svg?style=flat-square&label=build&logo=travis%20ci" /></a>
|
|
10
9
|
<a href="https://coveralls.io/github/naver/egjs-flicking?branch=master&style=flat-square" target="_blank"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/naver/egjs-flicking.svg?style=flat-square&label=%E2%9C%85%20coverage" /></a>
|
|
11
10
|
<a href="https://deepscan.io/dashboard#view=project&tid=3998&pid=5802&bid=46086"><img src="https://deepscan.io/api/teams/3998/projects/5802/branches/46086/badge/grade.svg" alt="DeepScan grade" /></a>
|
|
12
11
|
</p>
|
|
@@ -131,7 +130,7 @@ var flicking = new Flicking("#my-flicking", { circular: true });
|
|
|
131
130
|
|[**@egjs/vue-flicking**](https://github.com/naver/egjs-flicking/blob/master/packages/vue-flicking/README.md)|<a href="https://www.npmjs.com/package/@egjs/vue-flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/vue-flicking.svg?style=flat-square&color=42b883&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-flicking/img/icons/vue.svg" valign="middle" alt="Vue.js" /> [Vue.js@2](https://vuejs.org/v2/guide/index.html) port of @egjs/flicking|
|
|
132
131
|
|[**@egjs/vue3-flicking**](https://github.com/naver/egjs-flicking/blob/master/packages/vue3-flicking/README.md)|<a href="https://www.npmjs.com/package/@egjs/vue3-flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/vue3-flicking.svg?style=flat-square&color=42b883&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-flicking/img/icons/vue.svg" valign="middle" alt="Vue.js" /> [Vue.js@3](https://v3.vuejs.org/) port of @egjs/flicking|
|
|
133
132
|
|[**@egjs/preact-flicking**](https://github.com/naver/egjs-flicking/blob/master/packages/preact-flicking/README.md)|<a href="https://www.npmjs.com/package/@egjs/preact-flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/preact-flicking.svg?style=flat-square&color=673ab8&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-flicking/img/icons/preact.svg" valign="middle" alt="Preact" /> [Preact](https://preactjs.com/guide/v10/getting-started) port of @egjs/flicking|
|
|
134
|
-
|[**@egjs/svelte-flicking**](https://github.com/naver/egjs-flicking/blob/master/packages/svelte-flicking/README.md)|<a href="https://www.npmjs.com/package/@egjs/svelte-flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/svelte-flicking.svg?style=flat-square&color=FF3E00&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-flicking/
|
|
133
|
+
|[**@egjs/svelte-flicking**](https://github.com/naver/egjs-flicking/blob/master/packages/svelte-flicking/README.md)|<a href="https://www.npmjs.com/package/@egjs/svelte-flicking" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/svelte-flicking.svg?style=flat-square&color=FF3E00&label=%F0%9F%94%96" alt="version" /></a>|<img width="15" src="https://naver.github.io/egjs-flicking/img/icons/svelte.svg" valign="middle" alt="Svelte" /> [Svelte](https://svelte.dev/) port of @egjs/flicking|
|
|
135
134
|
|
|
136
135
|
## 🌐 Supported Browsers
|
|
137
136
|
|<img width="20" src="https://simpleicons.org/icons/internetexplorer.svg" alt="IE" />|<img width="20" src="https://simpleicons.org/icons/googlechrome.svg" alt="Chrome" />|<img width="20" src="https://simpleicons.org/icons/firefoxbrowser.svg" alt="Firefox" />|<img width="20" src="https://simpleicons.org/icons/safari.svg" alt="Safari" />|<img width="20" src="https://simpleicons.org/icons/apple.svg" alt="iOS" />|<img width="20" src="https://simpleicons.org/icons/android.svg" alt="Android" />|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import Component from "@egjs/component";
|
|
2
2
|
import Viewport from "./core/Viewport";
|
|
3
3
|
import { Panel } from "./core/panel";
|
|
4
|
+
import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
|
|
4
5
|
import { Control } from "./control";
|
|
5
6
|
import { Camera } from "./camera";
|
|
6
|
-
import { Renderer, ExternalRenderer } from "./renderer";
|
|
7
|
-
import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION } from "./const/external";
|
|
7
|
+
import { Renderer, ExternalRenderer, RendererOptions } from "./renderer";
|
|
8
|
+
import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION, CIRCULAR_FALLBACK } from "./const/external";
|
|
8
9
|
import { HoldStartEvent, HoldEndEvent, MoveStartEvent, SelectEvent, MoveEvent, MoveEndEvent, WillChangeEvent, WillRestoreEvent, NeedPanelEvent, VisibleChangeEvent, ReachEdgeEvent, ReadyEvent, AfterResizeEvent, BeforeResizeEvent, ChangedEvent, RestoredEvent, PanelChangeEvent } from "./type/event";
|
|
9
10
|
import { LiteralUnion, ValueOf } from "./type/internal";
|
|
10
11
|
import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external";
|
|
@@ -35,6 +36,7 @@ export interface FlickingOptions {
|
|
|
35
36
|
defaultIndex: number;
|
|
36
37
|
horizontal: boolean;
|
|
37
38
|
circular: boolean;
|
|
39
|
+
circularFallback: LiteralUnion<ValueOf<typeof CIRCULAR_FALLBACK>>;
|
|
38
40
|
bound: boolean;
|
|
39
41
|
adaptive: boolean;
|
|
40
42
|
panelsPerView: number;
|
|
@@ -54,30 +56,35 @@ export interface FlickingOptions {
|
|
|
54
56
|
preventClickOnDrag: boolean;
|
|
55
57
|
disableOnInit: boolean;
|
|
56
58
|
renderOnlyVisible: boolean;
|
|
59
|
+
virtual: VirtualOptions | null;
|
|
57
60
|
autoInit: boolean;
|
|
58
61
|
autoResize: boolean;
|
|
62
|
+
useResizeObserver: boolean;
|
|
63
|
+
externalRenderer: ExternalRenderer | null;
|
|
59
64
|
renderExternal: {
|
|
60
|
-
renderer:
|
|
61
|
-
rendererOptions:
|
|
62
|
-
[key: string]: any;
|
|
63
|
-
};
|
|
65
|
+
renderer: new (options: RendererOptions) => ExternalRenderer;
|
|
66
|
+
rendererOptions: RendererOptions;
|
|
64
67
|
} | null;
|
|
65
68
|
}
|
|
66
69
|
declare class Flicking extends Component<FlickingEvents> {
|
|
67
70
|
static VERSION: string;
|
|
68
71
|
private _viewport;
|
|
72
|
+
private _autoResizer;
|
|
69
73
|
private _camera;
|
|
70
74
|
private _control;
|
|
71
75
|
private _renderer;
|
|
76
|
+
private _virtualManager;
|
|
72
77
|
private _align;
|
|
73
78
|
private _defaultIndex;
|
|
74
79
|
private _horizontal;
|
|
75
80
|
private _circular;
|
|
81
|
+
private _circularFallback;
|
|
76
82
|
private _bound;
|
|
77
83
|
private _adaptive;
|
|
78
84
|
private _panelsPerView;
|
|
79
85
|
private _noPanelStyleOverride;
|
|
80
86
|
private _resizeOnContentsReady;
|
|
87
|
+
private _virtual;
|
|
81
88
|
private _needPanelThreshold;
|
|
82
89
|
private _preventEventsBeforeInit;
|
|
83
90
|
private _deceleration;
|
|
@@ -92,8 +99,10 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
92
99
|
private _preventClickOnDrag;
|
|
93
100
|
private _disableOnInit;
|
|
94
101
|
private _renderOnlyVisible;
|
|
95
|
-
private _autoResize;
|
|
96
102
|
private _autoInit;
|
|
103
|
+
private _autoResize;
|
|
104
|
+
private _useResizeObserver;
|
|
105
|
+
private _externalRenderer;
|
|
97
106
|
private _renderExternal;
|
|
98
107
|
private _initialized;
|
|
99
108
|
private _plugins;
|
|
@@ -103,6 +112,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
103
112
|
get viewport(): Viewport;
|
|
104
113
|
get initialized(): boolean;
|
|
105
114
|
get circularEnabled(): boolean;
|
|
115
|
+
get virtualEnabled(): boolean;
|
|
106
116
|
get index(): number;
|
|
107
117
|
get element(): HTMLElement;
|
|
108
118
|
get currentPanel(): Panel;
|
|
@@ -116,6 +126,10 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
116
126
|
get defaultIndex(): FlickingOptions["defaultIndex"];
|
|
117
127
|
get horizontal(): FlickingOptions["horizontal"];
|
|
118
128
|
get circular(): FlickingOptions["circular"];
|
|
129
|
+
get circularFallback(): LiteralUnion<ValueOf<{
|
|
130
|
+
readonly LINEAR: "linear";
|
|
131
|
+
readonly BOUND: "bound";
|
|
132
|
+
}>, string>;
|
|
119
133
|
get bound(): FlickingOptions["bound"];
|
|
120
134
|
get adaptive(): FlickingOptions["adaptive"];
|
|
121
135
|
get panelsPerView(): FlickingOptions["panelsPerView"];
|
|
@@ -135,13 +149,14 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
135
149
|
get preventClickOnDrag(): FlickingOptions["preventClickOnDrag"];
|
|
136
150
|
get disableOnInit(): FlickingOptions["disableOnInit"];
|
|
137
151
|
get renderOnlyVisible(): FlickingOptions["renderOnlyVisible"];
|
|
152
|
+
get virtual(): VirtualManager;
|
|
138
153
|
get autoInit(): boolean;
|
|
139
154
|
get autoResize(): FlickingOptions["autoResize"];
|
|
155
|
+
get useResizeObserver(): FlickingOptions["useResizeObserver"];
|
|
156
|
+
get externalRenderer(): ExternalRenderer;
|
|
140
157
|
get renderExternal(): {
|
|
141
|
-
renderer:
|
|
142
|
-
rendererOptions:
|
|
143
|
-
[key: string]: any;
|
|
144
|
-
};
|
|
158
|
+
renderer: new (options: RendererOptions) => ExternalRenderer;
|
|
159
|
+
rendererOptions: RendererOptions;
|
|
145
160
|
};
|
|
146
161
|
set align(val: FlickingOptions["align"]);
|
|
147
162
|
set defaultIndex(val: FlickingOptions["defaultIndex"]);
|
|
@@ -167,7 +182,8 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
167
182
|
set disableOnInit(val: FlickingOptions["disableOnInit"]);
|
|
168
183
|
set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]);
|
|
169
184
|
set autoResize(val: FlickingOptions["autoResize"]);
|
|
170
|
-
|
|
185
|
+
set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
|
|
186
|
+
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, circularFallback, bound, adaptive, panelsPerView, noPanelStyleOverride, resizeOnContentsReady, needPanelThreshold, preventEventsBeforeInit, deceleration, duration, easing, inputType, moveType, threshold, interruptable, bounce, iOSEdgeSwipeThreshold, preventClickOnDrag, disableOnInit, renderOnlyVisible, virtual, autoInit, autoResize, useResizeObserver, externalRenderer, renderExternal }?: Partial<FlickingOptions>);
|
|
171
187
|
init(): Promise<void>;
|
|
172
188
|
destroy(): void;
|
|
173
189
|
prev(duration?: number): Promise<void>;
|
|
@@ -193,6 +209,8 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
193
209
|
private _createControl;
|
|
194
210
|
private _createCamera;
|
|
195
211
|
private _createRenderer;
|
|
212
|
+
private _createExternalRenderer;
|
|
213
|
+
private _createVanillaRenderer;
|
|
196
214
|
private _moveToInitialPanel;
|
|
197
215
|
}
|
|
198
216
|
export default Flicking;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import Flicking, { FlickingOptions } from "../Flicking";
|
|
2
2
|
import Panel from "../core/panel/Panel";
|
|
3
3
|
import AnchorPoint from "../core/AnchorPoint";
|
|
4
|
+
import { CameraMode } from "./mode";
|
|
4
5
|
export interface CameraOptions {
|
|
5
6
|
align: FlickingOptions["align"];
|
|
6
7
|
}
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
prev: boolean;
|
|
23
|
-
next: boolean;
|
|
24
|
-
};
|
|
8
|
+
declare class Camera {
|
|
9
|
+
private _align;
|
|
10
|
+
private _flicking;
|
|
11
|
+
private _mode;
|
|
12
|
+
private _el;
|
|
13
|
+
private _transform;
|
|
14
|
+
private _position;
|
|
15
|
+
private _alignPos;
|
|
16
|
+
private _offset;
|
|
17
|
+
private _circularOffset;
|
|
18
|
+
private _circularEnabled;
|
|
19
|
+
private _range;
|
|
20
|
+
private _visiblePanels;
|
|
21
|
+
private _anchors;
|
|
22
|
+
private _needPanelTriggered;
|
|
25
23
|
get element(): HTMLElement;
|
|
24
|
+
get children(): HTMLElement[];
|
|
26
25
|
get position(): number;
|
|
27
26
|
get alignPosition(): number;
|
|
28
27
|
get offset(): number;
|
|
28
|
+
get circularEnabled(): boolean;
|
|
29
|
+
get mode(): CameraMode;
|
|
29
30
|
get range(): {
|
|
30
31
|
min: number;
|
|
31
32
|
max: number;
|
|
@@ -51,7 +52,6 @@ declare abstract class Camera {
|
|
|
51
52
|
get align(): FlickingOptions["align"];
|
|
52
53
|
set align(val: FlickingOptions["align"]);
|
|
53
54
|
constructor({ align }?: Partial<CameraOptions>);
|
|
54
|
-
abstract updateRange(): this;
|
|
55
55
|
init(flicking: Flicking): this;
|
|
56
56
|
destroy(): this;
|
|
57
57
|
lookAt(pos: number): void;
|
|
@@ -64,16 +64,19 @@ declare abstract class Camera {
|
|
|
64
64
|
clampToReachablePosition(position: number): number;
|
|
65
65
|
canReach(panel: Panel): boolean;
|
|
66
66
|
canSee(panel: Panel): boolean;
|
|
67
|
+
updateRange(): this;
|
|
67
68
|
updateAlignPos(): this;
|
|
68
69
|
updateAnchors(): this;
|
|
69
70
|
updateAdaptiveHeight(): void;
|
|
70
|
-
updateOffset():
|
|
71
|
+
updateOffset(): this;
|
|
71
72
|
resetNeedPanelHistory(): this;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
applyTransform(): this;
|
|
74
|
+
private _resetInternalValues;
|
|
75
|
+
private _refreshVisiblePanels;
|
|
76
|
+
private _checkNeedPanel;
|
|
77
|
+
private _checkReachEnd;
|
|
78
|
+
private _checkTranslateSupport;
|
|
79
|
+
private _updateMode;
|
|
80
|
+
private _togglePanels;
|
|
78
81
|
}
|
|
79
82
|
export default Camera;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import Camera, { CameraOptions } from "./Camera";
|
|
2
|
-
|
|
3
|
-
import CircularCamera from "./CircularCamera";
|
|
4
|
-
import BoundCamera from "./BoundCamera";
|
|
5
|
-
export { Camera, LinearCamera, CircularCamera, BoundCamera };
|
|
2
|
+
export { Camera };
|
|
6
3
|
export type { CameraOptions };
|
|
4
|
+
export * from "./mode";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
2
|
+
import CameraMode from "./CameraMode";
|
|
3
|
+
declare class BoundCameraMode extends CameraMode {
|
|
4
|
+
checkAvailability(): boolean;
|
|
5
|
+
getRange(): {
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
};
|
|
9
|
+
getAnchors(): AnchorPoint[];
|
|
10
|
+
findAnchorIncludePosition(position: number): AnchorPoint | null;
|
|
11
|
+
private _findNearestPanel;
|
|
12
|
+
}
|
|
13
|
+
export default BoundCameraMode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Flicking from "../../Flicking";
|
|
2
|
+
import Panel from "../../core/panel/Panel";
|
|
3
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
4
|
+
declare abstract class CameraMode {
|
|
5
|
+
protected _flicking: Flicking;
|
|
6
|
+
constructor(flicking: Flicking);
|
|
7
|
+
abstract checkAvailability(): boolean;
|
|
8
|
+
abstract getRange(): {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
};
|
|
12
|
+
getAnchors(): AnchorPoint[];
|
|
13
|
+
findAnchorIncludePosition(position: number): AnchorPoint | null;
|
|
14
|
+
clampToReachablePosition(position: number): number;
|
|
15
|
+
getCircularOffset(): number;
|
|
16
|
+
canReach(panel: Panel): boolean;
|
|
17
|
+
canSee(panel: Panel): boolean;
|
|
18
|
+
}
|
|
19
|
+
export default CameraMode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Panel from "../../core/panel/Panel";
|
|
2
|
+
import AnchorPoint from "../../core/AnchorPoint";
|
|
3
|
+
import CameraMode from "./CameraMode";
|
|
4
|
+
declare class CircularCameraMode extends CameraMode {
|
|
5
|
+
checkAvailability(): boolean;
|
|
6
|
+
getRange(): {
|
|
7
|
+
min: number;
|
|
8
|
+
max: number;
|
|
9
|
+
};
|
|
10
|
+
getAnchors(): AnchorPoint[];
|
|
11
|
+
findAnchorIncludePosition(position: number): AnchorPoint | null;
|
|
12
|
+
getCircularOffset(): number;
|
|
13
|
+
clampToReachablePosition(position: number): number;
|
|
14
|
+
canReach(panel: Panel): boolean;
|
|
15
|
+
canSee(panel: Panel): boolean;
|
|
16
|
+
private _calcPanelAreaSum;
|
|
17
|
+
}
|
|
18
|
+
export default CircularCameraMode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import CameraMode from "./CameraMode";
|
|
2
|
+
import LinearCameraMode from "./LinearCameraMode";
|
|
3
|
+
import CircularCameraMode from "./CircularCameraMode";
|
|
4
|
+
import BoundCameraMode from "./BoundCameraMode";
|
|
5
|
+
export { LinearCameraMode, CircularCameraMode, BoundCameraMode };
|
|
6
|
+
export type { CameraMode };
|
|
@@ -13,12 +13,13 @@ export declare const CODE: {
|
|
|
13
13
|
readonly NOT_ALLOWED_IN_FRAMEWORK: 11;
|
|
14
14
|
readonly NOT_INITIALIZED: 12;
|
|
15
15
|
readonly NO_ACTIVE: 13;
|
|
16
|
+
readonly NOT_ALLOWED_IN_VIRTUAL: 14;
|
|
16
17
|
};
|
|
17
18
|
export declare const MESSAGE: {
|
|
18
19
|
readonly WRONG_TYPE: (wrongVal: any, correctTypes: string[]) => string;
|
|
19
20
|
readonly ELEMENT_NOT_FOUND: (selector: string) => string;
|
|
20
21
|
readonly VAL_MUST_NOT_NULL: (val: any, name: string) => string;
|
|
21
|
-
readonly NOT_ATTACHED_TO_FLICKING: (
|
|
22
|
+
readonly NOT_ATTACHED_TO_FLICKING: "This module is not attached to the Flicking instance. \"init()\" should be called first.";
|
|
22
23
|
readonly WRONG_OPTION: (optionName: string, val: any) => string;
|
|
23
24
|
readonly INDEX_OUT_OF_RANGE: (val: number, min: number, max: number) => string;
|
|
24
25
|
readonly POSITION_NOT_REACHABLE: (position: number) => string;
|
|
@@ -29,4 +30,5 @@ export declare const MESSAGE: {
|
|
|
29
30
|
readonly NOT_ALLOWED_IN_FRAMEWORK: "This behavior is not allowed in the frameworks like React, Vue, or Angular.";
|
|
30
31
|
readonly NOT_INITIALIZED: "Flicking is not initialized yet, call init() first.";
|
|
31
32
|
readonly NO_ACTIVE: "There's no active panel that Flicking has selected. This may be due to the absence of any panels.";
|
|
33
|
+
readonly NOT_ALLOWED_IN_VIRTUAL: "This behavior is not allowed when the virtual option is enabled";
|
|
32
34
|
};
|
|
@@ -33,3 +33,12 @@ export declare const MOVE_TYPE: {
|
|
|
33
33
|
readonly FREE_SCROLL: "freeScroll";
|
|
34
34
|
readonly STRICT: "strict";
|
|
35
35
|
};
|
|
36
|
+
export declare const CLASS: {
|
|
37
|
+
VERTICAL: string;
|
|
38
|
+
HIDDEN: string;
|
|
39
|
+
DEFAULT_VIRTUAL: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const CIRCULAR_FALLBACK: {
|
|
42
|
+
readonly LINEAR: "linear";
|
|
43
|
+
readonly BOUND: "bound";
|
|
44
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Flicking from "../Flicking";
|
|
2
|
+
declare class AutoResizer {
|
|
3
|
+
private _flicking;
|
|
4
|
+
private _enabled;
|
|
5
|
+
private _resizeObserver;
|
|
6
|
+
get enabled(): boolean;
|
|
7
|
+
constructor(flicking: Flicking);
|
|
8
|
+
enable(): this;
|
|
9
|
+
disable(): this;
|
|
10
|
+
private _onResize;
|
|
11
|
+
private _skipFirstResize;
|
|
12
|
+
}
|
|
13
|
+
export default AutoResizer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Flicking from "../Flicking";
|
|
2
|
+
import VirtualPanel from "./panel/VirtualPanel";
|
|
3
|
+
export interface VirtualOptions {
|
|
4
|
+
renderPanel: (panel: VirtualPanel, index: number) => string;
|
|
5
|
+
initialPanelCount: number;
|
|
6
|
+
cache?: boolean;
|
|
7
|
+
panelClass?: string;
|
|
8
|
+
}
|
|
9
|
+
declare class VirtualManager {
|
|
10
|
+
private _flicking;
|
|
11
|
+
private _renderPanel;
|
|
12
|
+
private _initialPanelCount;
|
|
13
|
+
private _cache;
|
|
14
|
+
private _panelClass;
|
|
15
|
+
private _elements;
|
|
16
|
+
get elements(): {
|
|
17
|
+
nativeElement: HTMLElement;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
get renderPanel(): VirtualOptions["renderPanel"];
|
|
21
|
+
get initialPanelCount(): number;
|
|
22
|
+
get cache(): NonNullable<VirtualOptions["cache"]>;
|
|
23
|
+
get panelClass(): NonNullable<VirtualOptions["panelClass"]>;
|
|
24
|
+
set renderPanel(val: VirtualOptions["renderPanel"]);
|
|
25
|
+
set cache(val: NonNullable<VirtualOptions["cache"]>);
|
|
26
|
+
set panelClass(val: NonNullable<VirtualOptions["panelClass"]>);
|
|
27
|
+
constructor(flicking: Flicking, options: VirtualOptions | null);
|
|
28
|
+
init(): void;
|
|
29
|
+
show(index: number): void;
|
|
30
|
+
hide(index: number): void;
|
|
31
|
+
append(count?: number): VirtualPanel[];
|
|
32
|
+
prepend(count?: number): VirtualPanel[];
|
|
33
|
+
insert(index: number, count?: number): VirtualPanel[];
|
|
34
|
+
remove(index: number, count: number): VirtualPanel[];
|
|
35
|
+
private _initVirtualElements;
|
|
36
|
+
}
|
|
37
|
+
export default VirtualManager;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Viewport from "./Viewport";
|
|
2
2
|
import FlickingError from "./FlickingError";
|
|
3
3
|
import AnchorPoint from "./AnchorPoint";
|
|
4
|
-
|
|
4
|
+
import VirtualManager from "./VirtualManager";
|
|
5
|
+
export { Viewport, FlickingError, AnchorPoint, VirtualManager };
|
|
5
6
|
export * from "./panel";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import Flicking from "../../Flicking";
|
|
2
2
|
import { ALIGN, DIRECTION } from "../../const/external";
|
|
3
3
|
import { LiteralUnion, ValueOf } from "../../type/internal";
|
|
4
|
+
import ElementProvider from "./provider/ElementProvider";
|
|
4
5
|
export interface PanelOptions {
|
|
5
6
|
index: number;
|
|
6
7
|
align: LiteralUnion<ValueOf<typeof ALIGN>> | number;
|
|
7
8
|
flicking: Flicking;
|
|
9
|
+
elementProvider: ElementProvider;
|
|
8
10
|
}
|
|
9
|
-
declare
|
|
11
|
+
declare class Panel {
|
|
10
12
|
protected _flicking: Flicking;
|
|
13
|
+
protected _elProvider: ElementProvider;
|
|
11
14
|
protected _index: number;
|
|
12
15
|
protected _pos: number;
|
|
13
16
|
protected _size: number;
|
|
@@ -17,13 +20,15 @@ declare abstract class Panel {
|
|
|
17
20
|
next: number;
|
|
18
21
|
};
|
|
19
22
|
protected _alignPos: number;
|
|
23
|
+
protected _rendered: boolean;
|
|
20
24
|
protected _removed: boolean;
|
|
21
25
|
protected _loading: boolean;
|
|
22
26
|
protected _toggleDirection: ValueOf<typeof DIRECTION>;
|
|
23
27
|
protected _toggled: boolean;
|
|
24
28
|
protected _togglePosition: number;
|
|
25
29
|
protected _align: PanelOptions["align"];
|
|
26
|
-
|
|
30
|
+
get element(): HTMLElement;
|
|
31
|
+
get elementProvider(): ElementProvider;
|
|
27
32
|
get index(): number;
|
|
28
33
|
get position(): number;
|
|
29
34
|
get size(): number;
|
|
@@ -35,8 +40,8 @@ declare abstract class Panel {
|
|
|
35
40
|
};
|
|
36
41
|
get alignPosition(): number;
|
|
37
42
|
get removed(): boolean;
|
|
43
|
+
get rendered(): boolean;
|
|
38
44
|
get loading(): boolean;
|
|
39
|
-
abstract get rendered(): any;
|
|
40
45
|
get range(): {
|
|
41
46
|
min: number;
|
|
42
47
|
max: number;
|
|
@@ -50,9 +55,9 @@ declare abstract class Panel {
|
|
|
50
55
|
set loading(val: boolean);
|
|
51
56
|
get align(): PanelOptions["align"];
|
|
52
57
|
set align(val: PanelOptions["align"]);
|
|
53
|
-
constructor({ index, align, flicking }: PanelOptions);
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
constructor({ index, align, flicking, elementProvider }: PanelOptions);
|
|
59
|
+
markForShow(): void;
|
|
60
|
+
markForHide(): void;
|
|
56
61
|
resize(cached?: {
|
|
57
62
|
size: number;
|
|
58
63
|
height: number;
|
|
@@ -61,7 +66,7 @@ declare abstract class Panel {
|
|
|
61
66
|
next: number;
|
|
62
67
|
};
|
|
63
68
|
}): this;
|
|
64
|
-
setSize(
|
|
69
|
+
setSize(size: Partial<{
|
|
65
70
|
width: number | string;
|
|
66
71
|
height: number | string;
|
|
67
72
|
}>): this;
|
|
@@ -69,6 +74,7 @@ declare abstract class Panel {
|
|
|
69
74
|
destroy(): void;
|
|
70
75
|
includePosition(pos: number, includeMargin?: boolean): boolean;
|
|
71
76
|
includeRange(min: number, max: number, includeMargin?: boolean): boolean;
|
|
77
|
+
isVisibleOnRange(min: number, max: number): boolean;
|
|
72
78
|
focus(duration?: number): Promise<void>;
|
|
73
79
|
prev(): Panel | null;
|
|
74
80
|
next(): Panel | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Panel, { PanelOptions } from "./Panel";
|
|
2
|
+
import VirtualElementProvider from "./provider/VirtualElementProvider";
|
|
3
|
+
interface VirtualPanelOptions extends PanelOptions {
|
|
4
|
+
elementProvider: VirtualElementProvider;
|
|
5
|
+
}
|
|
6
|
+
declare class VirtualPanel extends Panel {
|
|
7
|
+
protected _elProvider: VirtualElementProvider;
|
|
8
|
+
protected _cachedInnerHTML: string | null;
|
|
9
|
+
get element(): HTMLElement;
|
|
10
|
+
get cachedInnerHTML(): string;
|
|
11
|
+
get elementIndex(): number;
|
|
12
|
+
constructor(options: VirtualPanelOptions);
|
|
13
|
+
cacheRenderResult(result: string): void;
|
|
14
|
+
uncacheRenderResult(): void;
|
|
15
|
+
render(): void;
|
|
16
|
+
increaseIndex(val: number): this;
|
|
17
|
+
decreaseIndex(val: number): this;
|
|
18
|
+
}
|
|
19
|
+
export default VirtualPanel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Panel, { PanelOptions } from "./Panel";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export { Panel,
|
|
5
|
-
export type { PanelOptions
|
|
2
|
+
import VirtualPanel from "./VirtualPanel";
|
|
3
|
+
export * from "./provider";
|
|
4
|
+
export { Panel, VirtualPanel };
|
|
5
|
+
export type { PanelOptions };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Flicking from "../../../Flicking";
|
|
2
|
+
import ElementProvider from "./ElementProvider";
|
|
3
|
+
declare class VanillaElementProvider implements ElementProvider {
|
|
4
|
+
private _element;
|
|
5
|
+
private _rendered;
|
|
6
|
+
get element(): HTMLElement;
|
|
7
|
+
get rendered(): boolean;
|
|
8
|
+
constructor(element: HTMLElement);
|
|
9
|
+
show(flicking: Flicking): void;
|
|
10
|
+
hide(flicking: Flicking): void;
|
|
11
|
+
}
|
|
12
|
+
export default VanillaElementProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Flicking from "../../../Flicking";
|
|
2
|
+
import VirtualPanel from "../VirtualPanel";
|
|
3
|
+
import ElementProvider from "./ElementProvider";
|
|
4
|
+
declare class VirtualElementProvider implements ElementProvider {
|
|
5
|
+
private _flicking;
|
|
6
|
+
private _panel;
|
|
7
|
+
get element(): HTMLElement;
|
|
8
|
+
get rendered(): boolean;
|
|
9
|
+
private get _virtualElement();
|
|
10
|
+
constructor(flicking: Flicking);
|
|
11
|
+
init(panel: VirtualPanel): void;
|
|
12
|
+
show(): void;
|
|
13
|
+
hide(): void;
|
|
14
|
+
}
|
|
15
|
+
export default VirtualElementProvider;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ElementProvider from "./ElementProvider";
|
|
2
|
+
import VanillaElementProvider from "./VanillaElementProvider";
|
|
3
|
+
import VirtualElementProvider from "./VirtualElementProvider";
|
|
4
|
+
export { VanillaElementProvider, VirtualElementProvider };
|
|
5
|
+
export type { ElementProvider };
|
package/declaration/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import Flicking from "./Flicking";
|
|
2
|
-
|
|
2
|
+
import type { FlickingOptions, FlickingEvents } from "./Flicking";
|
|
3
|
+
export * from "./core";
|
|
4
|
+
export * from "./camera";
|
|
5
|
+
export * from "./control";
|
|
6
|
+
export * from "./renderer";
|
|
7
|
+
export * from "./const/external";
|
|
8
|
+
export * from "./cfc";
|
|
9
|
+
export * from "./utils";
|
|
10
|
+
export * from "./type/event";
|
|
11
|
+
export * from "./type/external";
|
|
12
|
+
export type { FlickingOptions, FlickingEvents };
|
|
3
13
|
export default Flicking;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Panel from "../core/panel/Panel";
|
|
2
2
|
import Renderer from "./Renderer";
|
|
3
3
|
declare abstract class ExternalRenderer extends Renderer {
|
|
4
|
-
protected _insertPanelElements(panels: Panel[], nextSibling: Panel | null): void;
|
|
5
4
|
protected _removePanelElements(panels: Panel[]): void;
|
|
5
|
+
protected _removeAllChildsFromCamera(): void;
|
|
6
6
|
}
|
|
7
7
|
export default ExternalRenderer;
|