@egjs/flicking 4.4.1 → 4.5.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 +0 -1
- package/declaration/Flicking.d.ts +8 -2
- package/declaration/camera/Camera.d.ts +26 -24
- 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/external.d.ts +4 -0
- package/declaration/control/StrictControl.d.ts +1 -0
- package/declaration/type/external.d.ts +1 -3
- package/dist/flicking.esm.js +1205 -1093
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +1208 -1095
- 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 +1208 -1095
- 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 +5 -4
- package/src/Flicking.ts +26 -15
- package/src/camera/Camera.ts +156 -71
- 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 +9 -4
- package/src/cfc/withFlickingMethods.ts +2 -1
- package/src/const/external.ts +12 -0
- package/src/control/StrictControl.ts +10 -0
- package/declaration/camera/BoundCamera.d.ts +0 -9
- package/declaration/camera/CircularCamera.d.ts +0 -37
- package/declaration/camera/LinearCamera.d.ts +0 -5
- package/src/camera/CircularCamera.ts +0 -268
- package/src/camera/LinearCamera.ts +0 -35
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>
|
|
@@ -5,7 +5,7 @@ import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
|
|
|
5
5
|
import { Control } from "./control";
|
|
6
6
|
import { Camera } from "./camera";
|
|
7
7
|
import { Renderer, ExternalRenderer, RendererOptions } from "./renderer";
|
|
8
|
-
import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION } from "./const/external";
|
|
8
|
+
import { EVENTS, ALIGN, MOVE_TYPE, DIRECTION, CIRCULAR_FALLBACK } from "./const/external";
|
|
9
9
|
import { HoldStartEvent, HoldEndEvent, MoveStartEvent, SelectEvent, MoveEvent, MoveEndEvent, WillChangeEvent, WillRestoreEvent, NeedPanelEvent, VisibleChangeEvent, ReachEdgeEvent, ReadyEvent, AfterResizeEvent, BeforeResizeEvent, ChangedEvent, RestoredEvent, PanelChangeEvent } from "./type/event";
|
|
10
10
|
import { LiteralUnion, ValueOf } from "./type/internal";
|
|
11
11
|
import { ElementLike, Plugin, Status, MoveTypeOptions } from "./type/external";
|
|
@@ -36,6 +36,7 @@ export interface FlickingOptions {
|
|
|
36
36
|
defaultIndex: number;
|
|
37
37
|
horizontal: boolean;
|
|
38
38
|
circular: boolean;
|
|
39
|
+
circularFallback: LiteralUnion<ValueOf<typeof CIRCULAR_FALLBACK>>;
|
|
39
40
|
bound: boolean;
|
|
40
41
|
adaptive: boolean;
|
|
41
42
|
panelsPerView: number;
|
|
@@ -77,6 +78,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
77
78
|
private _defaultIndex;
|
|
78
79
|
private _horizontal;
|
|
79
80
|
private _circular;
|
|
81
|
+
private _circularFallback;
|
|
80
82
|
private _bound;
|
|
81
83
|
private _adaptive;
|
|
82
84
|
private _panelsPerView;
|
|
@@ -124,6 +126,10 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
124
126
|
get defaultIndex(): FlickingOptions["defaultIndex"];
|
|
125
127
|
get horizontal(): FlickingOptions["horizontal"];
|
|
126
128
|
get circular(): FlickingOptions["circular"];
|
|
129
|
+
get circularFallback(): LiteralUnion<ValueOf<{
|
|
130
|
+
readonly LINEAR: "linear";
|
|
131
|
+
readonly BOUND: "bound";
|
|
132
|
+
}>, string>;
|
|
127
133
|
get bound(): FlickingOptions["bound"];
|
|
128
134
|
get adaptive(): FlickingOptions["adaptive"];
|
|
129
135
|
get panelsPerView(): FlickingOptions["panelsPerView"];
|
|
@@ -177,7 +183,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
177
183
|
set renderOnlyVisible(val: FlickingOptions["renderOnlyVisible"]);
|
|
178
184
|
set autoResize(val: FlickingOptions["autoResize"]);
|
|
179
185
|
set useResizeObserver(val: FlickingOptions["useResizeObserver"]);
|
|
180
|
-
constructor(root: HTMLElement | string, { align, defaultIndex, horizontal, circular, 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>);
|
|
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>);
|
|
181
187
|
init(): Promise<void>;
|
|
182
188
|
destroy(): void;
|
|
183
189
|
prev(duration?: number): Promise<void>;
|
|
@@ -1,32 +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;
|
|
26
24
|
get children(): HTMLElement[];
|
|
27
25
|
get position(): number;
|
|
28
26
|
get alignPosition(): number;
|
|
29
27
|
get offset(): number;
|
|
28
|
+
get circularEnabled(): boolean;
|
|
29
|
+
get mode(): CameraMode;
|
|
30
30
|
get range(): {
|
|
31
31
|
min: number;
|
|
32
32
|
max: number;
|
|
@@ -52,7 +52,6 @@ declare abstract class Camera {
|
|
|
52
52
|
get align(): FlickingOptions["align"];
|
|
53
53
|
set align(val: FlickingOptions["align"]);
|
|
54
54
|
constructor({ align }?: Partial<CameraOptions>);
|
|
55
|
-
abstract updateRange(): this;
|
|
56
55
|
init(flicking: Flicking): this;
|
|
57
56
|
destroy(): this;
|
|
58
57
|
lookAt(pos: number): void;
|
|
@@ -65,16 +64,19 @@ declare abstract class Camera {
|
|
|
65
64
|
clampToReachablePosition(position: number): number;
|
|
66
65
|
canReach(panel: Panel): boolean;
|
|
67
66
|
canSee(panel: Panel): boolean;
|
|
67
|
+
updateRange(): this;
|
|
68
68
|
updateAlignPos(): this;
|
|
69
69
|
updateAnchors(): this;
|
|
70
70
|
updateAdaptiveHeight(): void;
|
|
71
71
|
updateOffset(): this;
|
|
72
72
|
resetNeedPanelHistory(): this;
|
|
73
73
|
applyTransform(): this;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
private _resetInternalValues;
|
|
75
|
+
private _refreshVisiblePanels;
|
|
76
|
+
private _checkNeedPanel;
|
|
77
|
+
private _checkReachEnd;
|
|
78
|
+
private _checkTranslateSupport;
|
|
79
|
+
private _updateMode;
|
|
80
|
+
private _togglePanels;
|
|
79
81
|
}
|
|
80
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 };
|
|
@@ -12,6 +12,7 @@ declare class StrictControl extends Control {
|
|
|
12
12
|
constructor({ count }?: Partial<StrictControlOptions>);
|
|
13
13
|
destroy(): void;
|
|
14
14
|
updateInput(): this;
|
|
15
|
+
moveToPanel(panel: Panel, options: Parameters<Control["moveToPanel"]>[1]): Promise<void>;
|
|
15
16
|
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
|
|
16
17
|
setActive: (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => void;
|
|
17
18
|
private _resetIndexRange;
|
|
@@ -20,9 +20,7 @@ export interface Status {
|
|
|
20
20
|
html?: string;
|
|
21
21
|
}>;
|
|
22
22
|
}
|
|
23
|
-
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>] : [
|
|
24
|
-
T
|
|
25
|
-
];
|
|
23
|
+
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];
|
|
26
24
|
export interface ControlParams {
|
|
27
25
|
range: {
|
|
28
26
|
min: number;
|