@egjs/flicking 3.8.4 → 3.9.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/declaration/Flicking.d.ts +2 -1
- package/declaration/components/AutoResizer.d.ts +12 -0
- package/declaration/types.d.ts +1 -0
- package/dist/flicking.esm.js +87 -18
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +87 -18
- 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 +87 -18
- 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/doc/eg.Flicking.html +102 -39
- package/doc/global.html +1 -1
- package/doc/index.html +1 -1
- package/doc/node_modules_@egjs_component_src_Component.ts.html +1 -1
- package/doc/src_Flicking.ts.html +9 -16
- package/doc/src_types.ts.html +2 -1
- package/docs/build/release/3.9.0/dist/flicking.esm.js +5124 -0
- package/docs/build/release/3.9.0/dist/flicking.esm.js.map +1 -0
- package/docs/build/release/3.9.0/dist/flicking.js +5131 -0
- package/docs/build/release/3.9.0/dist/flicking.js.map +1 -0
- package/docs/build/release/3.9.0/dist/flicking.min.js +10 -0
- package/docs/build/release/3.9.0/dist/flicking.min.js.map +1 -0
- package/docs/build/release/3.9.0/dist/flicking.pkgd.js +11460 -0
- package/docs/build/release/3.9.0/dist/flicking.pkgd.js.map +1 -0
- package/docs/build/release/3.9.0/dist/flicking.pkgd.min.js +10 -0
- package/docs/build/release/3.9.0/dist/flicking.pkgd.min.js.map +1 -0
- package/package.json +5 -2
- package/rollup.config.development.js +26 -0
- package/src/Flicking.ts +8 -15
- package/src/components/AutoResizer.ts +80 -0
- package/src/components/Viewport.ts +7 -2
- package/src/consts.ts +1 -0
- package/src/types.ts +1 -0
- package/tsconfig.test.json +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Component from "@egjs/component";
|
|
2
|
-
import { FlickingOptions, FlickingEvent, Direction, EventType, FlickingPanel, FlickingStatus, Plugin, ElementLike, DestroyOption, BeforeSyncResult, SyncResult, ChangeEvent, SelectEvent, NeedPanelEvent, VisibleChangeEvent, ContentErrorEvent } from "./types";
|
|
3
2
|
import { DiffResult } from "@egjs/list-differ";
|
|
3
|
+
import { FlickingOptions, FlickingEvent, Direction, EventType, FlickingPanel, FlickingStatus, Plugin, ElementLike, DestroyOption, BeforeSyncResult, SyncResult, ChangeEvent, SelectEvent, NeedPanelEvent, VisibleChangeEvent, ContentErrorEvent } from "./types";
|
|
4
4
|
declare class Flicking extends Component<{
|
|
5
5
|
holdStart: FlickingEvent;
|
|
6
6
|
holdEnd: FlickingEvent;
|
|
@@ -20,6 +20,7 @@ declare class Flicking extends Component<{
|
|
|
20
20
|
options: FlickingOptions;
|
|
21
21
|
private wrapper;
|
|
22
22
|
private viewport;
|
|
23
|
+
private autoResizer;
|
|
23
24
|
private contentsReadyChecker;
|
|
24
25
|
private eventContext;
|
|
25
26
|
private isPanelChangedAtBeforeSync;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Flicking from "../Flicking";
|
|
2
|
+
declare class AutoResizer {
|
|
3
|
+
private flicking;
|
|
4
|
+
private enabled;
|
|
5
|
+
private resizeObserver;
|
|
6
|
+
private skipFirstResize;
|
|
7
|
+
constructor(flicking: Flicking);
|
|
8
|
+
enable(): this;
|
|
9
|
+
disable(): this;
|
|
10
|
+
private onResize;
|
|
11
|
+
}
|
|
12
|
+
export default AutoResizer;
|
package/declaration/types.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface FlickingOptions {
|
|
|
40
40
|
iOSEdgeSwipeThreshold: number;
|
|
41
41
|
resizeOnContentsReady: boolean;
|
|
42
42
|
collectStatistics: boolean;
|
|
43
|
+
useResizeObserver: boolean;
|
|
43
44
|
}
|
|
44
45
|
export declare type MoveTypeObjectOption = MoveTypeSnapOption | MoveTypeFreeScrollOption;
|
|
45
46
|
export declare type MoveTypeStringOption = MoveTypeObjectOption["type"];
|
package/dist/flicking.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ name: @egjs/flicking
|
|
|
4
4
|
license: MIT
|
|
5
5
|
author: NAVER Corp.
|
|
6
6
|
repository: https://github.com/naver/egjs-flicking
|
|
7
|
-
version: 3.
|
|
7
|
+
version: 3.9.0
|
|
8
8
|
*/
|
|
9
9
|
import Component from '@egjs/component';
|
|
10
10
|
import ImReady from '@egjs/imready';
|
|
@@ -113,7 +113,8 @@ var DEFAULT_OPTIONS = {
|
|
|
113
113
|
renderExternal: false,
|
|
114
114
|
resizeOnContentsReady: false,
|
|
115
115
|
iOSEdgeSwipeThreshold: 30,
|
|
116
|
-
collectStatistics: true
|
|
116
|
+
collectStatistics: true,
|
|
117
|
+
useResizeObserver: true
|
|
117
118
|
};
|
|
118
119
|
var DEFAULT_VIEWPORT_CSS = {
|
|
119
120
|
position: "relative",
|
|
@@ -2512,7 +2513,12 @@ function () {
|
|
|
2512
2513
|
__proto.disable = function () {
|
|
2513
2514
|
if (this.panInput) {
|
|
2514
2515
|
this.panInput.destroy();
|
|
2515
|
-
this.panInput = null;
|
|
2516
|
+
this.panInput = null; // Refresh Axes instance
|
|
2517
|
+
|
|
2518
|
+
this.axes.destroy();
|
|
2519
|
+
this.setAxesInstance();
|
|
2520
|
+
this.updateScrollArea();
|
|
2521
|
+
this.updateAxesPosition(this.state.position);
|
|
2516
2522
|
this.stateMachine.transitTo(STATE_TYPE.IDLE);
|
|
2517
2523
|
}
|
|
2518
2524
|
};
|
|
@@ -3211,6 +3217,7 @@ function () {
|
|
|
3211
3217
|
this.applyCSSValue();
|
|
3212
3218
|
this.setMoveType();
|
|
3213
3219
|
this.setAxesInstance();
|
|
3220
|
+
this.createPanInput();
|
|
3214
3221
|
this.refreshPanels();
|
|
3215
3222
|
this.setDefaultPanel();
|
|
3216
3223
|
this.resize();
|
|
@@ -3322,7 +3329,6 @@ function () {
|
|
|
3322
3329
|
deceleration: options.deceleration,
|
|
3323
3330
|
interruptable: true
|
|
3324
3331
|
});
|
|
3325
|
-
this.createPanInput();
|
|
3326
3332
|
};
|
|
3327
3333
|
|
|
3328
3334
|
__proto.refreshPanels = function () {
|
|
@@ -4039,6 +4045,77 @@ function () {
|
|
|
4039
4045
|
return Viewport;
|
|
4040
4046
|
}();
|
|
4041
4047
|
|
|
4048
|
+
var AutoResizer =
|
|
4049
|
+
/*#__PURE__*/
|
|
4050
|
+
function () {
|
|
4051
|
+
function AutoResizer(flicking) {
|
|
4052
|
+
var _this = this;
|
|
4053
|
+
|
|
4054
|
+
this.skipFirstResize = function () {
|
|
4055
|
+
var isFirstResize = true;
|
|
4056
|
+
return function () {
|
|
4057
|
+
if (isFirstResize) {
|
|
4058
|
+
isFirstResize = false;
|
|
4059
|
+
return;
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
_this.onResize();
|
|
4063
|
+
};
|
|
4064
|
+
}();
|
|
4065
|
+
|
|
4066
|
+
this.onResize = function () {
|
|
4067
|
+
_this.flicking.resize();
|
|
4068
|
+
};
|
|
4069
|
+
|
|
4070
|
+
this.flicking = flicking;
|
|
4071
|
+
this.enabled = false;
|
|
4072
|
+
this.resizeObserver = null;
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
var __proto = AutoResizer.prototype;
|
|
4076
|
+
|
|
4077
|
+
__proto.enable = function () {
|
|
4078
|
+
var flicking = this.flicking;
|
|
4079
|
+
|
|
4080
|
+
if (this.enabled) {
|
|
4081
|
+
this.disable();
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
if (flicking.options.useResizeObserver && !!window.ResizeObserver) {
|
|
4085
|
+
var flickingEl = flicking.getElement();
|
|
4086
|
+
var viewportSizeNot0 = flickingEl.clientWidth !== 0 || flickingEl.clientHeight !== 0;
|
|
4087
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this.skipFirstResize) : new ResizeObserver(this.onResize);
|
|
4088
|
+
resizeObserver.observe(flickingEl);
|
|
4089
|
+
this.resizeObserver = resizeObserver;
|
|
4090
|
+
} else {
|
|
4091
|
+
window.addEventListener("resize", this.onResize);
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
this.enabled = true;
|
|
4095
|
+
return this;
|
|
4096
|
+
};
|
|
4097
|
+
|
|
4098
|
+
__proto.disable = function () {
|
|
4099
|
+
if (!this.enabled) {
|
|
4100
|
+
return this;
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
var resizeObserver = this.resizeObserver;
|
|
4104
|
+
|
|
4105
|
+
if (resizeObserver) {
|
|
4106
|
+
resizeObserver.disconnect();
|
|
4107
|
+
this.resizeObserver = null;
|
|
4108
|
+
} else {
|
|
4109
|
+
window.removeEventListener("resize", this.onResize);
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
this.enabled = false;
|
|
4113
|
+
return this;
|
|
4114
|
+
};
|
|
4115
|
+
|
|
4116
|
+
return AutoResizer;
|
|
4117
|
+
}();
|
|
4118
|
+
|
|
4042
4119
|
/**
|
|
4043
4120
|
* Copyright (c) 2015 NAVER Corp.
|
|
4044
4121
|
* egjs projects are licensed under the MIT license
|
|
@@ -4088,6 +4165,7 @@ function (_super) {
|
|
|
4088
4165
|
* @param {boolean} [options.isConstantSize=false] Whether all panels have a constant size that won't be changed after resize. Enabling this option can increase performance while recalculating panel size.<ko>모든 패널의 크기가 불변인지의 여부. 이 옵션을 'true'로 설정하면 패널 크기 재설정시에 성능을 높일 수 있다.</ko>
|
|
4089
4166
|
* @param {boolean} [options.renderExternal=false] Whether to use external rendering. It will delegate DOM manipulation and can synchronize the rendered state by calling `sync()` method. You can use this option to use in frameworks like React, Vue, Angular, which has its states and rendering methods.<ko>외부 렌더링을 사용할 지의 여부. 이 옵션을 사용시 렌더링을 외부에 위임할 수 있고, `sync()`를 호출하여 그 상태를 동기화할 수 있다. 이 옵션을 사용하여, React, Vue, Angular 등 자체적인 상태와 렌더링 방법을 갖는 프레임워크에 대응할 수 있다.</ko>
|
|
4090
4167
|
* @param {boolean} [options.resizeOnContentsReady=false] Whether to resize the Flicking after the image/video elements inside viewport are ready.<br/>Use this property to prevent wrong Flicking layout caused by dynamic image / video sizes.<ko>Flicking 내부의 이미지 / 비디오 엘리먼트들이 전부 로드되었을 때 Flicking의 크기를 재계산하기 위한 옵션.<br/>이미지 / 비디오 크기가 고정 크기가 아닐 경우 사용하여 레이아웃이 잘못되는 것을 방지할 수 있다.</ko>
|
|
4168
|
+
* @param {boolean} [options.useResizeObserver=true] Whether to listen {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}'s event instead of Window's {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} event when using the `autoResize` option<ko>autoResize 옵션 사용시 {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}의 이벤트를 Window객체의 {@link https://developer.mozilla.org/ko/docs/Web/API/Window/resize_event resize} 이벤트 대신 수신할지 여부를 설정합니다</ko>
|
|
4091
4169
|
* @param {boolean} [options.collectStatistics=true] Whether to collect statistics on how you are using `Flicking`. These statistical data do not contain any personal information and are used only as a basis for the development of a user-friendly product.<ko>어떻게 `Flicking`을 사용하고 있는지에 대한 통계 수집 여부를 나타낸다. 이 통계자료는 개인정보를 포함하고 있지 않으며 오직 사용자 친화적인 제품으로 발전시키기 위한 근거자료로서 활용한다.</ko>
|
|
4092
4170
|
*/
|
|
4093
4171
|
|
|
@@ -4255,18 +4333,13 @@ function (_super) {
|
|
|
4255
4333
|
|
|
4256
4334
|
|
|
4257
4335
|
_this.viewport = new Viewport(_this, _this.options, _this.triggerEvent);
|
|
4336
|
+
_this.autoResizer = new AutoResizer(_this);
|
|
4258
4337
|
|
|
4259
4338
|
_this.listenInput();
|
|
4260
4339
|
|
|
4261
4340
|
_this.listenResize();
|
|
4262
4341
|
|
|
4263
|
-
return _this;
|
|
4264
|
-
// sendEvent(
|
|
4265
|
-
// "usage",
|
|
4266
|
-
// "options",
|
|
4267
|
-
// options,
|
|
4268
|
-
// );
|
|
4269
|
-
// }
|
|
4342
|
+
return _this;
|
|
4270
4343
|
}
|
|
4271
4344
|
/**
|
|
4272
4345
|
* Move to the previous panel if it exists.
|
|
@@ -4600,11 +4673,7 @@ function (_super) {
|
|
|
4600
4673
|
}
|
|
4601
4674
|
|
|
4602
4675
|
this.off();
|
|
4603
|
-
|
|
4604
|
-
if (this.options.autoResize) {
|
|
4605
|
-
window.removeEventListener("resize", this.resize);
|
|
4606
|
-
}
|
|
4607
|
-
|
|
4676
|
+
this.autoResizer.disable();
|
|
4608
4677
|
this.viewport.destroy(option);
|
|
4609
4678
|
(_a = this.contentsReadyChecker) === null || _a === void 0 ? void 0 : _a.destroy(); // release resources
|
|
4610
4679
|
|
|
@@ -4976,7 +5045,7 @@ function (_super) {
|
|
|
4976
5045
|
var options = this.options;
|
|
4977
5046
|
|
|
4978
5047
|
if (options.autoResize) {
|
|
4979
|
-
|
|
5048
|
+
this.autoResizer.enable();
|
|
4980
5049
|
}
|
|
4981
5050
|
|
|
4982
5051
|
if (options.resizeOnContentsReady) {
|
|
@@ -5016,7 +5085,7 @@ function (_super) {
|
|
|
5016
5085
|
*/
|
|
5017
5086
|
|
|
5018
5087
|
|
|
5019
|
-
Flicking.VERSION = "3.
|
|
5088
|
+
Flicking.VERSION = "3.9.0";
|
|
5020
5089
|
/**
|
|
5021
5090
|
* Direction constant - "PREV" or "NEXT"
|
|
5022
5091
|
* @ko 방향 상수 - "PREV" 또는 "NEXT"
|