@egjs/flicking 4.12.0-beta.9 → 4.12.1-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/declaration/CrossFlicking.d.ts +89 -76
- package/declaration/Flicking.d.ts +244 -244
- package/declaration/camera/Camera.d.ts +90 -90
- package/declaration/camera/index.d.ts +4 -4
- package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
- package/declaration/camera/mode/CameraMode.d.ts +20 -20
- package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
- package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
- package/declaration/camera/mode/index.d.ts +6 -6
- package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
- package/declaration/cfc/getRenderingPanels.d.ts +4 -4
- package/declaration/cfc/index.d.ts +5 -5
- package/declaration/cfc/sync.d.ts +4 -4
- package/declaration/cfc/withFlickingMethods.d.ts +2 -2
- package/declaration/const/axes.d.ts +8 -8
- package/declaration/const/error.d.ts +34 -34
- package/declaration/const/external.d.ts +54 -54
- package/declaration/control/AxesController.d.ts +44 -44
- package/declaration/control/Control.d.ts +45 -45
- package/declaration/control/FreeControl.d.ts +14 -14
- package/declaration/control/SnapControl.d.ts +16 -16
- package/declaration/control/StateMachine.d.ts +14 -14
- package/declaration/control/StrictControl.d.ts +20 -20
- package/declaration/control/index.d.ts +14 -14
- package/declaration/control/states/AnimatingState.d.ts +9 -9
- package/declaration/control/states/DisabledState.d.ts +9 -9
- package/declaration/control/states/DraggingState.d.ts +8 -8
- package/declaration/control/states/HoldingState.d.ts +10 -10
- package/declaration/control/states/IdleState.d.ts +9 -9
- package/declaration/control/states/State.d.ts +47 -47
- package/declaration/core/AnchorPoint.d.ts +15 -15
- package/declaration/core/AutoResizer.d.ts +16 -16
- package/declaration/core/FlickingError.d.ts +5 -5
- package/declaration/core/ResizeWatcher.d.ts +33 -33
- package/declaration/core/Viewport.d.ts +25 -25
- package/declaration/core/VirtualManager.d.ts +37 -37
- package/declaration/core/index.d.ts +6 -6
- package/declaration/core/panel/Panel.d.ts +89 -89
- package/declaration/core/panel/VirtualPanel.d.ts +19 -19
- package/declaration/core/panel/index.d.ts +5 -5
- package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
- package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
- package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
- package/declaration/core/panel/provider/index.d.ts +5 -5
- package/declaration/index.cjs.d.ts +3 -3
- package/declaration/index.d.ts +15 -15
- package/declaration/index.umd.d.ts +2 -2
- package/declaration/renderer/ExternalRenderer.d.ts +7 -7
- package/declaration/renderer/Renderer.d.ts +59 -59
- package/declaration/renderer/VanillaRenderer.d.ts +10 -10
- package/declaration/renderer/index.d.ts +6 -6
- package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
- package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
- package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
- package/declaration/renderer/strategy/index.d.ts +5 -5
- package/declaration/type/event.d.ts +88 -88
- package/declaration/type/external.d.ts +31 -31
- package/declaration/type/internal.d.ts +13 -13
- package/declaration/utils.d.ts +47 -47
- package/dist/flicking-inline.css +37 -0
- package/dist/flicking-inline.min.css +1 -0
- package/dist/flicking-inline.min.min.css +1 -0
- package/dist/flicking.cjs.js +33 -5
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.css +40 -0
- package/dist/flicking.esm.js +33 -5
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +33 -5
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.css +1 -0
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.min.min.css +1 -0
- package/dist/flicking.pkgd.js +783 -755
- 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 -6
- package/src/CrossFlicking.ts +32 -4
- package/src/Flicking.ts +1 -1
- package/src/control/states/HoldingState.ts +4 -0
- package/src/core/panel/Panel.ts +4 -0
- package/src/utils.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egjs/flicking",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1-beta.1",
|
|
4
4
|
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
|
|
5
5
|
"main": "dist/flicking.cjs.js",
|
|
6
6
|
"module": "dist/flicking.esm.js",
|
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
"types": "declaration/index.d.ts",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"start": "concurrently \"rollup -w --config ./rollup.config.dev.js\" \"http-serve\"",
|
|
15
|
-
"build": "run-s build:bundle build:declaration printsizes",
|
|
16
|
-
"build-react": "run-s build:bundle build:declaration && pvu --build=react-flicking",
|
|
15
|
+
"build": "run-s build:bundle build:declaration build:css printsizes",
|
|
17
16
|
"build:bundle": "rm -rf ./dist && rollup -c",
|
|
18
17
|
"build:declaration": "rm -rf ./declaration && tsc -p tsconfig.declaration.json",
|
|
19
18
|
"build:css": "run-s build:css-clear build:sass build:css-prefix build:css-min",
|
|
20
19
|
"build:css-clear": "rm -rf ./dist/*.css",
|
|
21
|
-
"build:sass": "
|
|
20
|
+
"build:sass": "sass sass/:dist/ --style=expanded --no-source-map && sass sass/flicking.sass dist/flicking.min.css --style=compressed --no-source-map && sass sass/flicking-inline.sass dist/flicking-inline.min.css --style=compressed --no-source-map",
|
|
22
21
|
"build:css-prefix": "postcss dist/*.css --replace --use autoprefixer --no-map",
|
|
23
22
|
"build:css-min": "postcss dist/*.css --ext .min.css --use postcss-clean -d dist/ --no-map",
|
|
24
23
|
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json",
|
|
@@ -115,7 +114,6 @@
|
|
|
115
114
|
"husky": "^1.3.1",
|
|
116
115
|
"jsdoc-to-mdx": "^1.1.2",
|
|
117
116
|
"karma-typescript-es6-transform": "^5.5.2",
|
|
118
|
-
"node-sass": "^7.0.1",
|
|
119
117
|
"npm-run-all": "^4.1.5",
|
|
120
118
|
"postcss-clean": "^1.2.2",
|
|
121
119
|
"postcss-cli": "^7.1.2",
|
|
@@ -130,6 +128,7 @@
|
|
|
130
128
|
"rollup-plugin-terser": "^7.0.2",
|
|
131
129
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
132
130
|
"rollup-plugin-visualizer": "^4.2.1",
|
|
131
|
+
"sass": "^1.79.3",
|
|
133
132
|
"sync-exec": "^0.6.2",
|
|
134
133
|
"ts-mock-imports": "^1.3.3",
|
|
135
134
|
"tsconfig-paths-webpack-plugin": "^3.5.1",
|
|
@@ -140,7 +139,7 @@
|
|
|
140
139
|
"typescript-transform-paths": "^2.2.3"
|
|
141
140
|
},
|
|
142
141
|
"dependencies": {
|
|
143
|
-
"@egjs/axes": "^3.9.
|
|
142
|
+
"@egjs/axes": "^3.9.1",
|
|
144
143
|
"@egjs/component": "^3.0.1",
|
|
145
144
|
"@egjs/imready": "^1.3.1",
|
|
146
145
|
"@egjs/list-differ": "^1.0.1"
|
package/src/CrossFlicking.ts
CHANGED
|
@@ -13,7 +13,9 @@ import {
|
|
|
13
13
|
MoveEndEvent,
|
|
14
14
|
MoveEvent,
|
|
15
15
|
MoveStartEvent,
|
|
16
|
-
|
|
16
|
+
RestoredEvent,
|
|
17
|
+
WillChangeEvent,
|
|
18
|
+
WillRestoreEvent
|
|
17
19
|
} from "./type/event";
|
|
18
20
|
import { LiteralUnion, ValueOf } from "./type/internal";
|
|
19
21
|
import { CLASS, EVENTS, MOVE_DIRECTION } from "./const/external";
|
|
@@ -26,7 +28,9 @@ export const SIDE_EVENTS = {
|
|
|
26
28
|
MOVE: "sideMove",
|
|
27
29
|
MOVE_END: "sideMoveEnd",
|
|
28
30
|
WILL_CHANGE: "sideWillChange",
|
|
29
|
-
CHANGED: "sideChanged"
|
|
31
|
+
CHANGED: "sideChanged",
|
|
32
|
+
WILL_RESTORE: "sideWillRestore",
|
|
33
|
+
RESTORED: "sideRestored"
|
|
30
34
|
} as const;
|
|
31
35
|
|
|
32
36
|
export type CrossFlickingEvent<T> = { mainIndex: number } & T;
|
|
@@ -39,6 +43,8 @@ export interface CrossFlickingEvents extends FlickingEvents {
|
|
|
39
43
|
[SIDE_EVENTS.MOVE_END]: CrossFlickingEvent<MoveEndEvent>;
|
|
40
44
|
[SIDE_EVENTS.WILL_CHANGE]: CrossFlickingEvent<WillChangeEvent>;
|
|
41
45
|
[SIDE_EVENTS.CHANGED]: CrossFlickingEvent<ChangedEvent>;
|
|
46
|
+
[SIDE_EVENTS.WILL_RESTORE]: CrossFlickingEvent<WillRestoreEvent>;
|
|
47
|
+
[SIDE_EVENTS.RESTORED]: CrossFlickingEvent<RestoredEvent>;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export interface CrossFlickingOptions extends FlickingOptions {
|
|
@@ -55,6 +61,14 @@ export interface SideState {
|
|
|
55
61
|
element: HTMLElement;
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
export interface CrossFlickingChangedEvent extends ChangedEvent {
|
|
65
|
+
sideIndex?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CrossFlickingWillChangeEvent extends WillChangeEvent {
|
|
69
|
+
sideIndex?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
export class CrossFlicking extends Flicking {
|
|
59
73
|
// Core components
|
|
60
74
|
private _sideFlicking: Flicking[];
|
|
@@ -68,6 +82,7 @@ export class CrossFlicking extends Flicking {
|
|
|
68
82
|
// Internal State
|
|
69
83
|
private _sideState: SideState[];
|
|
70
84
|
private _moveDirection: LiteralUnion<ValueOf<typeof MOVE_DIRECTION>> | null;
|
|
85
|
+
private _originalDragThreshold: number;
|
|
71
86
|
private _nextIndex: number;
|
|
72
87
|
|
|
73
88
|
// Components
|
|
@@ -75,6 +90,10 @@ export class CrossFlicking extends Flicking {
|
|
|
75
90
|
return this._sideFlicking;
|
|
76
91
|
}
|
|
77
92
|
|
|
93
|
+
public get sideIndex() {
|
|
94
|
+
return this._sideFlicking.map(i => i.index);
|
|
95
|
+
}
|
|
96
|
+
|
|
78
97
|
public get sideState() {
|
|
79
98
|
return this._sideState;
|
|
80
99
|
}
|
|
@@ -120,6 +139,7 @@ export class CrossFlicking extends Flicking {
|
|
|
120
139
|
// Internal states
|
|
121
140
|
this._moveDirection = null;
|
|
122
141
|
this._nextIndex = 0;
|
|
142
|
+
this._originalDragThreshold = this.dragThreshold;
|
|
123
143
|
|
|
124
144
|
// Bind options
|
|
125
145
|
this._sideOptions = sideOptions;
|
|
@@ -147,6 +167,9 @@ export class CrossFlicking extends Flicking {
|
|
|
147
167
|
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
|
|
148
168
|
this.on(EVENTS.MOVE, this._onHorizontalMove);
|
|
149
169
|
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
|
|
170
|
+
[EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach((event) => {
|
|
171
|
+
this.on(event, this._addSideIndex);
|
|
172
|
+
});
|
|
150
173
|
|
|
151
174
|
this._sideFlicking.forEach((flicking, mainIndex) => {
|
|
152
175
|
flicking.on(EVENTS.HOLD_START, this._onSideHoldStart);
|
|
@@ -331,9 +354,10 @@ export class CrossFlicking extends Flicking {
|
|
|
331
354
|
return;
|
|
332
355
|
}
|
|
333
356
|
|
|
357
|
+
const dragThreshold = this._originalDragThreshold;
|
|
334
358
|
const threshold = draggable
|
|
335
|
-
?
|
|
336
|
-
?
|
|
359
|
+
? dragThreshold && dragThreshold >= 10
|
|
360
|
+
? dragThreshold
|
|
337
361
|
: 10
|
|
338
362
|
: Infinity;
|
|
339
363
|
|
|
@@ -368,6 +392,10 @@ export class CrossFlicking extends Flicking {
|
|
|
368
392
|
});
|
|
369
393
|
};
|
|
370
394
|
|
|
395
|
+
private _addSideIndex = (e: ChangedEvent | WillChangeEvent): void => {
|
|
396
|
+
(e as CrossFlickingChangedEvent | CrossFlickingWillChangeEvent).sideIndex = this._sideFlicking[e.index].index;
|
|
397
|
+
};
|
|
398
|
+
|
|
371
399
|
private _onHorizontalHoldStart = (): void => {
|
|
372
400
|
this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
|
|
373
401
|
this._moveDirection = null;
|
package/src/Flicking.ts
CHANGED
|
@@ -1739,7 +1739,7 @@ class Flicking extends Component<FlickingEvents> {
|
|
|
1739
1739
|
if (!defaultPanel) return;
|
|
1740
1740
|
|
|
1741
1741
|
const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
|
|
1742
|
-
const initialPanel = (nearestAnchor && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
|
|
1742
|
+
const initialPanel = (nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index) ? nearestAnchor.panel : defaultPanel;
|
|
1743
1743
|
control.setActive(initialPanel, null, false);
|
|
1744
1744
|
|
|
1745
1745
|
if (!nearestAnchor) {
|
package/src/core/panel/Panel.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -262,6 +262,10 @@ export const setSize = (el: HTMLElement, { width, height }: Partial<{
|
|
|
262
262
|
width: number | string;
|
|
263
263
|
height: number | string;
|
|
264
264
|
}>) => {
|
|
265
|
+
if (!el) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
265
269
|
if (width != null) {
|
|
266
270
|
if (isString(width)) {
|
|
267
271
|
el.style.width = width;
|