@egjs/flicking 4.5.1 → 4.6.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/TODO.md +3 -0
- package/declaration/Flicking.d.ts +8 -1
- package/declaration/camera/Camera.d.ts +2 -2
- package/declaration/core/AutoResizer.d.ts +3 -0
- package/declaration/core/ResizeWatcher.d.ts +33 -0
- package/declaration/renderer/Renderer.d.ts +13 -0
- package/{css → dist/css}/flicking-inline.css +20 -13
- package/dist/css/flicking-inline.min.css +1 -0
- package/dist/css/flicking.css +44 -0
- package/dist/css/flicking.min.css +1 -0
- package/dist/flicking.esm.js +303 -170
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +303 -170
- 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 +303 -170
- 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 +13 -4
- package/sass/flicking-inline.sass +30 -0
- package/sass/flicking.sass +23 -0
- package/src/Flicking.ts +102 -21
- package/src/camera/Camera.ts +10 -14
- package/src/cfc/sync.ts +29 -23
- package/src/cfc/withFlickingMethods.ts +1 -1
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +92 -43
- package/css/flicking.css +0 -28
- package/dist/flicking-inline.css +0 -2
- package/dist/flicking-inline.css.map +0 -1
- package/dist/flicking.css +0 -2
- package/dist/flicking.css.map +0 -1
package/dist/flicking.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: 4.
|
|
7
|
+
version: 4.6.0
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
|
|
@@ -1014,6 +1014,33 @@ version: 4.5.1
|
|
|
1014
1014
|
var _this = this;
|
|
1015
1015
|
|
|
1016
1016
|
this._onResize = function () {
|
|
1017
|
+
var flicking = _this._flicking;
|
|
1018
|
+
var resizeDebounce = flicking.resizeDebounce;
|
|
1019
|
+
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
1020
|
+
|
|
1021
|
+
if (resizeDebounce <= 0) {
|
|
1022
|
+
void flicking.resize();
|
|
1023
|
+
} else {
|
|
1024
|
+
if (_this._maxResizeDebounceTimer <= 0) {
|
|
1025
|
+
if (maxResizeDebounce > 0 && maxResizeDebounce >= resizeDebounce) {
|
|
1026
|
+
_this._maxResizeDebounceTimer = window.setTimeout(_this._doScheduledResize, maxResizeDebounce);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
if (_this._resizeTimer > 0) {
|
|
1031
|
+
clearTimeout(_this._resizeTimer);
|
|
1032
|
+
_this._resizeTimer = 0;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
_this._resizeTimer = window.setTimeout(_this._doScheduledResize, resizeDebounce);
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
this._doScheduledResize = function () {
|
|
1040
|
+
clearTimeout(_this._resizeTimer);
|
|
1041
|
+
clearTimeout(_this._maxResizeDebounceTimer);
|
|
1042
|
+
_this._maxResizeDebounceTimer = -1;
|
|
1043
|
+
_this._resizeTimer = -1;
|
|
1017
1044
|
void _this._flicking.resize();
|
|
1018
1045
|
}; // eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1019
1046
|
|
|
@@ -1033,6 +1060,8 @@ version: 4.5.1
|
|
|
1033
1060
|
this._flicking = flicking;
|
|
1034
1061
|
this._enabled = false;
|
|
1035
1062
|
this._resizeObserver = null;
|
|
1063
|
+
this._resizeTimer = -1;
|
|
1064
|
+
this._maxResizeDebounceTimer = -1;
|
|
1036
1065
|
}
|
|
1037
1066
|
|
|
1038
1067
|
var __proto = AutoResizer.prototype;
|
|
@@ -4104,7 +4133,7 @@ version: 4.5.1
|
|
|
4104
4133
|
/*#__PURE__*/
|
|
4105
4134
|
function () {
|
|
4106
4135
|
/** */
|
|
4107
|
-
function Camera(_a) {
|
|
4136
|
+
function Camera(flicking, _a) {
|
|
4108
4137
|
var _this = this;
|
|
4109
4138
|
|
|
4110
4139
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
@@ -4144,7 +4173,7 @@ version: 4.5.1
|
|
|
4144
4173
|
_this._transform = transformName;
|
|
4145
4174
|
};
|
|
4146
4175
|
|
|
4147
|
-
this._flicking =
|
|
4176
|
+
this._flicking = flicking;
|
|
4148
4177
|
|
|
4149
4178
|
this._resetInternalValues(); // Options
|
|
4150
4179
|
|
|
@@ -4439,17 +4468,14 @@ version: 4.5.1
|
|
|
4439
4468
|
/**
|
|
4440
4469
|
* Initialize Camera
|
|
4441
4470
|
* @ko Camera를 초기화합니다
|
|
4442
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
4443
|
-
* @chainable
|
|
4444
4471
|
* @throws {FlickingError}
|
|
4445
4472
|
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
4446
4473
|
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
4447
4474
|
* @return {this}
|
|
4448
4475
|
*/
|
|
4449
4476
|
|
|
4450
|
-
__proto.init = function (
|
|
4451
|
-
this._flicking
|
|
4452
|
-
var viewportEl = flicking.viewport.element;
|
|
4477
|
+
__proto.init = function () {
|
|
4478
|
+
var viewportEl = this._flicking.viewport.element;
|
|
4453
4479
|
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
4454
4480
|
this._el = viewportEl.firstElementChild;
|
|
4455
4481
|
|
|
@@ -4467,8 +4493,6 @@ version: 4.5.1
|
|
|
4467
4493
|
|
|
4468
4494
|
|
|
4469
4495
|
__proto.destroy = function () {
|
|
4470
|
-
this._flicking = null;
|
|
4471
|
-
|
|
4472
4496
|
this._resetInternalValues();
|
|
4473
4497
|
|
|
4474
4498
|
return this;
|
|
@@ -4499,12 +4523,12 @@ version: 4.5.1
|
|
|
4499
4523
|
|
|
4500
4524
|
this._checkReachEnd(prevPos, pos);
|
|
4501
4525
|
|
|
4502
|
-
this.applyTransform();
|
|
4503
|
-
|
|
4504
4526
|
if (toggled) {
|
|
4505
4527
|
void flicking.renderer.render().then(function () {
|
|
4506
4528
|
_this.updateOffset();
|
|
4507
4529
|
});
|
|
4530
|
+
} else {
|
|
4531
|
+
this.applyTransform();
|
|
4508
4532
|
}
|
|
4509
4533
|
};
|
|
4510
4534
|
/**
|
|
@@ -4691,7 +4715,6 @@ version: 4.5.1
|
|
|
4691
4715
|
});
|
|
4692
4716
|
}
|
|
4693
4717
|
|
|
4694
|
-
this.updateOffset();
|
|
4695
4718
|
return this;
|
|
4696
4719
|
};
|
|
4697
4720
|
/**
|
|
@@ -4783,7 +4806,6 @@ version: 4.5.1
|
|
|
4783
4806
|
/**
|
|
4784
4807
|
* Apply "transform" style with the current position to camera element
|
|
4785
4808
|
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
4786
|
-
* @chainable
|
|
4787
4809
|
* @return {this}
|
|
4788
4810
|
*/
|
|
4789
4811
|
|
|
@@ -4791,6 +4813,8 @@ version: 4.5.1
|
|
|
4791
4813
|
__proto.applyTransform = function () {
|
|
4792
4814
|
var el = this._el;
|
|
4793
4815
|
var flicking = getFlickingAttached(this._flicking);
|
|
4816
|
+
var renderer = flicking.renderer;
|
|
4817
|
+
if (renderer.rendering) return this;
|
|
4794
4818
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4795
4819
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4796
4820
|
return this;
|
|
@@ -4976,7 +5000,8 @@ version: 4.5.1
|
|
|
4976
5000
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
4977
5001
|
strategy = _a.strategy;
|
|
4978
5002
|
this._flicking = null;
|
|
4979
|
-
this._panels = [];
|
|
5003
|
+
this._panels = [];
|
|
5004
|
+
this._rendering = false; // Bind options
|
|
4980
5005
|
|
|
4981
5006
|
this._align = align;
|
|
4982
5007
|
this._strategy = strategy;
|
|
@@ -4999,6 +5024,20 @@ version: 4.5.1
|
|
|
4999
5024
|
enumerable: false,
|
|
5000
5025
|
configurable: true
|
|
5001
5026
|
});
|
|
5027
|
+
Object.defineProperty(__proto, "rendering", {
|
|
5028
|
+
/**
|
|
5029
|
+
* A boolean value indicating whether rendering is in progress
|
|
5030
|
+
* @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
|
|
5031
|
+
* @type {boolean}
|
|
5032
|
+
* @readonly
|
|
5033
|
+
* @internal
|
|
5034
|
+
*/
|
|
5035
|
+
get: function () {
|
|
5036
|
+
return this._rendering;
|
|
5037
|
+
},
|
|
5038
|
+
enumerable: false,
|
|
5039
|
+
configurable: true
|
|
5040
|
+
});
|
|
5002
5041
|
Object.defineProperty(__proto, "panelCount", {
|
|
5003
5042
|
/**
|
|
5004
5043
|
* Count of panels
|
|
@@ -5130,6 +5169,25 @@ version: 4.5.1
|
|
|
5130
5169
|
|
|
5131
5170
|
|
|
5132
5171
|
__proto.batchInsert = function () {
|
|
5172
|
+
var items = [];
|
|
5173
|
+
|
|
5174
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5175
|
+
items[_i] = arguments[_i];
|
|
5176
|
+
}
|
|
5177
|
+
|
|
5178
|
+
var allPanelsInserted = this.batchInsertDefer.apply(this, __spread(items));
|
|
5179
|
+
if (allPanelsInserted.length <= 0) return [];
|
|
5180
|
+
this.updateAfterPanelChange(allPanelsInserted, []);
|
|
5181
|
+
return allPanelsInserted;
|
|
5182
|
+
};
|
|
5183
|
+
/**
|
|
5184
|
+
* Defers update
|
|
5185
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5186
|
+
* @internal
|
|
5187
|
+
*/
|
|
5188
|
+
|
|
5189
|
+
|
|
5190
|
+
__proto.batchInsertDefer = function () {
|
|
5133
5191
|
var _this = this;
|
|
5134
5192
|
|
|
5135
5193
|
var items = [];
|
|
@@ -5140,7 +5198,6 @@ version: 4.5.1
|
|
|
5140
5198
|
|
|
5141
5199
|
var panels = this._panels;
|
|
5142
5200
|
var flicking = getFlickingAttached(this._flicking);
|
|
5143
|
-
var control = flicking.control;
|
|
5144
5201
|
var prevFirstPanel = panels[0];
|
|
5145
5202
|
var align = parsePanelAlign(this._align);
|
|
5146
5203
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -5180,27 +5237,6 @@ version: 4.5.1
|
|
|
5180
5237
|
});
|
|
5181
5238
|
return __spread(addedPanels, panelsInserted);
|
|
5182
5239
|
}, []);
|
|
5183
|
-
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
5184
|
-
|
|
5185
|
-
this._updateCameraAndControl();
|
|
5186
|
-
|
|
5187
|
-
void this.render(); // Move to the first panel added if no panels existed
|
|
5188
|
-
// FIXME: fix for animating case
|
|
5189
|
-
|
|
5190
|
-
if (allPanelsInserted.length > 0 && !control.animating) {
|
|
5191
|
-
void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
|
|
5192
|
-
duration: 0
|
|
5193
|
-
}).catch(function () {
|
|
5194
|
-
return void 0;
|
|
5195
|
-
});
|
|
5196
|
-
}
|
|
5197
|
-
|
|
5198
|
-
flicking.camera.updateOffset();
|
|
5199
|
-
flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5200
|
-
added: allPanelsInserted,
|
|
5201
|
-
removed: []
|
|
5202
|
-
}));
|
|
5203
|
-
this.checkPanelContentsReady(allPanelsInserted);
|
|
5204
5240
|
return allPanelsInserted;
|
|
5205
5241
|
};
|
|
5206
5242
|
/**
|
|
@@ -5217,6 +5253,25 @@ version: 4.5.1
|
|
|
5217
5253
|
|
|
5218
5254
|
|
|
5219
5255
|
__proto.batchRemove = function () {
|
|
5256
|
+
var items = [];
|
|
5257
|
+
|
|
5258
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5259
|
+
items[_i] = arguments[_i];
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5262
|
+
var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread(items));
|
|
5263
|
+
if (allPanelsRemoved.length <= 0) return [];
|
|
5264
|
+
this.updateAfterPanelChange([], allPanelsRemoved);
|
|
5265
|
+
return allPanelsRemoved;
|
|
5266
|
+
};
|
|
5267
|
+
/**
|
|
5268
|
+
* Defers update
|
|
5269
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5270
|
+
* @internal
|
|
5271
|
+
*/
|
|
5272
|
+
|
|
5273
|
+
|
|
5274
|
+
__proto.batchRemoveDefer = function () {
|
|
5220
5275
|
var _this = this;
|
|
5221
5276
|
|
|
5222
5277
|
var items = [];
|
|
@@ -5227,10 +5282,8 @@ version: 4.5.1
|
|
|
5227
5282
|
|
|
5228
5283
|
var panels = this._panels;
|
|
5229
5284
|
var flicking = getFlickingAttached(this._flicking);
|
|
5230
|
-
var
|
|
5231
|
-
control = flicking.control;
|
|
5285
|
+
var control = flicking.control;
|
|
5232
5286
|
var activePanel = control.activePanel;
|
|
5233
|
-
var activeIndex = control.activeIndex;
|
|
5234
5287
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
5235
5288
|
var index = item.index,
|
|
5236
5289
|
deleteCount = item.deleteCount;
|
|
@@ -5258,33 +5311,61 @@ version: 4.5.1
|
|
|
5258
5311
|
}
|
|
5259
5312
|
|
|
5260
5313
|
return __spread(removed, panelsRemoved);
|
|
5261
|
-
}, []);
|
|
5314
|
+
}, []);
|
|
5315
|
+
return allPanelsRemoved;
|
|
5316
|
+
};
|
|
5317
|
+
/**
|
|
5318
|
+
* @internal
|
|
5319
|
+
*/
|
|
5320
|
+
|
|
5321
|
+
|
|
5322
|
+
__proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
|
|
5323
|
+
var _a;
|
|
5324
|
+
|
|
5325
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5326
|
+
var camera = flicking.camera,
|
|
5327
|
+
control = flicking.control;
|
|
5328
|
+
var panels = this._panels;
|
|
5329
|
+
var activePanel = control.activePanel; // Update camera & control
|
|
5262
5330
|
|
|
5263
5331
|
this._updateCameraAndControl();
|
|
5264
5332
|
|
|
5265
|
-
void this.render();
|
|
5333
|
+
void this.render();
|
|
5266
5334
|
|
|
5267
|
-
if (
|
|
5268
|
-
|
|
5335
|
+
if (!activePanel || activePanel.removed) {
|
|
5336
|
+
if (panels.length <= 0) {
|
|
5337
|
+
// All panels removed
|
|
5338
|
+
camera.lookAt(0);
|
|
5339
|
+
} else {
|
|
5340
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
5269
5341
|
|
|
5270
|
-
|
|
5271
|
-
|
|
5342
|
+
if (targetIndex > panels.length - 1) {
|
|
5343
|
+
targetIndex = panels.length - 1;
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5272
5347
|
duration: 0
|
|
5273
5348
|
}).catch(function () {
|
|
5274
5349
|
return void 0;
|
|
5275
5350
|
});
|
|
5276
|
-
} else {
|
|
5277
|
-
// All panels removed
|
|
5278
|
-
camera.lookAt(0);
|
|
5279
5351
|
}
|
|
5352
|
+
} else {
|
|
5353
|
+
void control.moveToPanel(control.activePanel, {
|
|
5354
|
+
duration: 0
|
|
5355
|
+
}).catch(function () {
|
|
5356
|
+
return void 0;
|
|
5357
|
+
});
|
|
5280
5358
|
}
|
|
5281
5359
|
|
|
5282
5360
|
flicking.camera.updateOffset();
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5361
|
+
|
|
5362
|
+
if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
|
|
5363
|
+
flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5364
|
+
added: panelsAdded,
|
|
5365
|
+
removed: panelsRemoved
|
|
5366
|
+
}));
|
|
5367
|
+
this.checkPanelContentsReady(__spread(panelsAdded, panelsRemoved));
|
|
5368
|
+
}
|
|
5288
5369
|
};
|
|
5289
5370
|
/**
|
|
5290
5371
|
* @internal
|
|
@@ -5329,6 +5410,7 @@ version: 4.5.1
|
|
|
5329
5410
|
});
|
|
5330
5411
|
if (!flicking.initialized) return;
|
|
5331
5412
|
camera.updateRange();
|
|
5413
|
+
camera.updateOffset();
|
|
5332
5414
|
camera.updateAnchors();
|
|
5333
5415
|
|
|
5334
5416
|
if (control.animating) ; else {
|
|
@@ -5362,6 +5444,7 @@ version: 4.5.1
|
|
|
5362
5444
|
var camera = flicking.camera,
|
|
5363
5445
|
control = flicking.control;
|
|
5364
5446
|
camera.updateRange();
|
|
5447
|
+
camera.updateOffset();
|
|
5365
5448
|
camera.updateAnchors();
|
|
5366
5449
|
camera.resetNeedPanelHistory();
|
|
5367
5450
|
control.updateInput();
|
|
@@ -6660,10 +6743,14 @@ version: 4.5.1
|
|
|
6660
6743
|
autoResize = _4 === void 0 ? true : _4,
|
|
6661
6744
|
_5 = _b.useResizeObserver,
|
|
6662
6745
|
useResizeObserver = _5 === void 0 ? true : _5,
|
|
6663
|
-
_6 = _b.
|
|
6664
|
-
|
|
6665
|
-
_7 = _b.
|
|
6666
|
-
|
|
6746
|
+
_6 = _b.resizeDebounce,
|
|
6747
|
+
resizeDebounce = _6 === void 0 ? 0 : _6,
|
|
6748
|
+
_7 = _b.maxResizeDebounce,
|
|
6749
|
+
maxResizeDebounce = _7 === void 0 ? 100 : _7,
|
|
6750
|
+
_8 = _b.externalRenderer,
|
|
6751
|
+
externalRenderer = _8 === void 0 ? null : _8,
|
|
6752
|
+
_9 = _b.renderExternal,
|
|
6753
|
+
renderExternal = _9 === void 0 ? null : _9;
|
|
6667
6754
|
|
|
6668
6755
|
var _this = _super.call(this) || this; // Internal states
|
|
6669
6756
|
|
|
@@ -6699,6 +6786,8 @@ version: 4.5.1
|
|
|
6699
6786
|
_this._autoInit = autoInit;
|
|
6700
6787
|
_this._autoResize = autoResize;
|
|
6701
6788
|
_this._useResizeObserver = useResizeObserver;
|
|
6789
|
+
_this._resizeDebounce = resizeDebounce;
|
|
6790
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
6702
6791
|
_this._externalRenderer = externalRenderer;
|
|
6703
6792
|
_this._renderExternal = renderExternal; // Create core components
|
|
6704
6793
|
|
|
@@ -7547,6 +7636,38 @@ version: 4.5.1
|
|
|
7547
7636
|
enumerable: false,
|
|
7548
7637
|
configurable: true
|
|
7549
7638
|
});
|
|
7639
|
+
Object.defineProperty(__proto, "resizeDebounce", {
|
|
7640
|
+
/**
|
|
7641
|
+
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
7642
|
+
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
7643
|
+
* This can increase performance by preventing `resize` being called too often.
|
|
7644
|
+
* @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
|
|
7645
|
+
* 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
|
|
7646
|
+
* 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
|
|
7647
|
+
* @type {number}
|
|
7648
|
+
* @default 0
|
|
7649
|
+
*/
|
|
7650
|
+
get: function () {
|
|
7651
|
+
return this._resizeDebounce;
|
|
7652
|
+
},
|
|
7653
|
+
enumerable: false,
|
|
7654
|
+
configurable: true
|
|
7655
|
+
});
|
|
7656
|
+
Object.defineProperty(__proto, "maxResizeDebounce", {
|
|
7657
|
+
/**
|
|
7658
|
+
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
7659
|
+
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
7660
|
+
* @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
|
|
7661
|
+
* 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
|
|
7662
|
+
* @type {number}
|
|
7663
|
+
* @default 100
|
|
7664
|
+
*/
|
|
7665
|
+
get: function () {
|
|
7666
|
+
return this._maxResizeDebounce;
|
|
7667
|
+
},
|
|
7668
|
+
enumerable: false,
|
|
7669
|
+
configurable: true
|
|
7670
|
+
});
|
|
7550
7671
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
7551
7672
|
/**
|
|
7552
7673
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -7582,85 +7703,61 @@ version: 4.5.1
|
|
|
7582
7703
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
7583
7704
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
7584
7705
|
* @fires Flicking#ready
|
|
7585
|
-
* @return {
|
|
7706
|
+
* @return {Promise<void>}
|
|
7586
7707
|
*/
|
|
7587
7708
|
|
|
7588
7709
|
__proto.init = function () {
|
|
7589
|
-
|
|
7590
|
-
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
7591
|
-
|
|
7592
|
-
var _this = this;
|
|
7593
|
-
|
|
7594
|
-
return __generator(this, function (_a) {
|
|
7595
|
-
switch (_a.label) {
|
|
7596
|
-
case 0:
|
|
7597
|
-
if (this._initialized) return [2
|
|
7598
|
-
/*return*/
|
|
7599
|
-
];
|
|
7600
|
-
camera = this._camera;
|
|
7601
|
-
renderer = this._renderer;
|
|
7602
|
-
control = this._control;
|
|
7603
|
-
virtualManager = this._virtualManager;
|
|
7604
|
-
originalTrigger = this.trigger;
|
|
7605
|
-
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7606
|
-
camera.init(this);
|
|
7607
|
-
virtualManager.init();
|
|
7608
|
-
renderer.init(this);
|
|
7609
|
-
control.init(this);
|
|
7610
|
-
|
|
7611
|
-
if (preventEventsBeforeInit) {
|
|
7612
|
-
this.trigger = function () {
|
|
7613
|
-
return _this;
|
|
7614
|
-
};
|
|
7615
|
-
}
|
|
7616
|
-
|
|
7617
|
-
return [4
|
|
7618
|
-
/*yield*/
|
|
7619
|
-
, this.resize()];
|
|
7620
|
-
|
|
7621
|
-
case 1:
|
|
7622
|
-
_a.sent(); // Look at initial panel
|
|
7623
|
-
|
|
7710
|
+
var _this = this;
|
|
7624
7711
|
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7712
|
+
if (this._initialized) return Promise.resolve();
|
|
7713
|
+
var camera = this._camera;
|
|
7714
|
+
var renderer = this._renderer;
|
|
7715
|
+
var control = this._control;
|
|
7716
|
+
var virtualManager = this._virtualManager;
|
|
7717
|
+
var originalTrigger = this.trigger;
|
|
7718
|
+
var preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7719
|
+
camera.init();
|
|
7720
|
+
virtualManager.init();
|
|
7721
|
+
renderer.init(this);
|
|
7722
|
+
control.init(this);
|
|
7723
|
+
|
|
7724
|
+
if (preventEventsBeforeInit) {
|
|
7725
|
+
this.trigger = function () {
|
|
7726
|
+
return _this;
|
|
7727
|
+
};
|
|
7728
|
+
}
|
|
7628
7729
|
|
|
7629
|
-
|
|
7630
|
-
// Look at initial panel
|
|
7631
|
-
_a.sent();
|
|
7730
|
+
this._initialResize(); // Look at initial panel
|
|
7632
7731
|
|
|
7633
|
-
if (this._autoResize) {
|
|
7634
|
-
this._autoResizer.enable();
|
|
7635
|
-
}
|
|
7636
7732
|
|
|
7637
|
-
|
|
7638
|
-
control.controller.addPreventClickHandler();
|
|
7639
|
-
}
|
|
7733
|
+
this._moveToInitialPanel();
|
|
7640
7734
|
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7735
|
+
if (this._autoResize) {
|
|
7736
|
+
this._autoResizer.enable();
|
|
7737
|
+
}
|
|
7644
7738
|
|
|
7645
|
-
|
|
7739
|
+
if (this._preventClickOnDrag) {
|
|
7740
|
+
control.controller.addPreventClickHandler();
|
|
7741
|
+
}
|
|
7646
7742
|
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7743
|
+
if (this._disableOnInit) {
|
|
7744
|
+
this.disableInput();
|
|
7745
|
+
}
|
|
7650
7746
|
|
|
7747
|
+
renderer.checkPanelContentsReady(renderer.panels);
|
|
7748
|
+
return renderer.render().then(function () {
|
|
7749
|
+
// Done initializing & emit ready event
|
|
7750
|
+
_this._plugins.forEach(function (plugin) {
|
|
7751
|
+
return plugin.init(_this);
|
|
7752
|
+
});
|
|
7651
7753
|
|
|
7652
|
-
|
|
7754
|
+
_this._initialized = true;
|
|
7653
7755
|
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7756
|
+
if (preventEventsBeforeInit) {
|
|
7757
|
+
_this.trigger = originalTrigger;
|
|
7758
|
+
}
|
|
7657
7759
|
|
|
7658
|
-
|
|
7659
|
-
return [2
|
|
7660
|
-
/*return*/
|
|
7661
|
-
];
|
|
7662
|
-
}
|
|
7663
|
-
});
|
|
7760
|
+
_this.trigger(new Component.ComponentEvent(EVENTS.READY));
|
|
7664
7761
|
});
|
|
7665
7762
|
};
|
|
7666
7763
|
/**
|
|
@@ -8278,7 +8375,7 @@ version: 4.5.1
|
|
|
8278
8375
|
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
8279
8376
|
}
|
|
8280
8377
|
|
|
8281
|
-
return new Camera$1({
|
|
8378
|
+
return new Camera$1(this, {
|
|
8282
8379
|
align: this._align
|
|
8283
8380
|
});
|
|
8284
8381
|
};
|
|
@@ -8314,23 +8411,59 @@ version: 4.5.1
|
|
|
8314
8411
|
};
|
|
8315
8412
|
|
|
8316
8413
|
__proto._moveToInitialPanel = function () {
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
}
|
|
8414
|
+
var renderer = this._renderer;
|
|
8415
|
+
var control = this._control;
|
|
8416
|
+
var camera = this._camera;
|
|
8417
|
+
var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
8418
|
+
if (!initialPanel) return;
|
|
8419
|
+
var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
|
|
8420
|
+
control.setActive(initialPanel, null, false);
|
|
8421
|
+
|
|
8422
|
+
if (!nearestAnchor) {
|
|
8423
|
+
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
|
|
8424
|
+
}
|
|
8425
|
+
|
|
8426
|
+
var position = initialPanel.position;
|
|
8427
|
+
|
|
8428
|
+
if (!camera.canReach(initialPanel)) {
|
|
8429
|
+
position = nearestAnchor.position;
|
|
8430
|
+
}
|
|
8431
|
+
|
|
8432
|
+
camera.lookAt(position);
|
|
8433
|
+
control.updateInput();
|
|
8434
|
+
camera.updateOffset();
|
|
8435
|
+
};
|
|
8436
|
+
|
|
8437
|
+
__proto._initialResize = function () {
|
|
8438
|
+
var viewport = this._viewport;
|
|
8439
|
+
var renderer = this._renderer;
|
|
8440
|
+
var camera = this._camera;
|
|
8441
|
+
var control = this._control;
|
|
8442
|
+
this.trigger(new Component.ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
8443
|
+
width: 0,
|
|
8444
|
+
height: 0,
|
|
8445
|
+
element: viewport.element
|
|
8446
|
+
}));
|
|
8447
|
+
viewport.resize();
|
|
8448
|
+
renderer.updatePanelSize();
|
|
8449
|
+
camera.updateAlignPos();
|
|
8450
|
+
camera.updateRange();
|
|
8451
|
+
camera.updateAnchors();
|
|
8452
|
+
camera.updateOffset();
|
|
8453
|
+
control.updateInput();
|
|
8454
|
+
var newWidth = viewport.width;
|
|
8455
|
+
var newHeight = viewport.height;
|
|
8456
|
+
var sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
8457
|
+
this.trigger(new Component.ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
8458
|
+
width: viewport.width,
|
|
8459
|
+
height: viewport.height,
|
|
8460
|
+
prev: {
|
|
8461
|
+
width: 0,
|
|
8462
|
+
height: 0
|
|
8463
|
+
},
|
|
8464
|
+
sizeChanged: sizeChanged,
|
|
8465
|
+
element: viewport.element
|
|
8466
|
+
}));
|
|
8334
8467
|
};
|
|
8335
8468
|
/**
|
|
8336
8469
|
* Version info string
|
|
@@ -8344,7 +8477,7 @@ version: 4.5.1
|
|
|
8344
8477
|
*/
|
|
8345
8478
|
|
|
8346
8479
|
|
|
8347
|
-
Flicking.VERSION = "4.
|
|
8480
|
+
Flicking.VERSION = "4.6.0";
|
|
8348
8481
|
return Flicking;
|
|
8349
8482
|
}(Component);
|
|
8350
8483
|
|
|
@@ -8384,7 +8517,7 @@ version: 4.5.1
|
|
|
8384
8517
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
8385
8518
|
[Component.prototype, Flicking.prototype].forEach(function (proto) {
|
|
8386
8519
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
8387
|
-
return !prototype[name] &&
|
|
8520
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
8388
8521
|
}).forEach(function (name) {
|
|
8389
8522
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
8390
8523
|
|
|
@@ -8441,6 +8574,9 @@ version: 4.5.1
|
|
|
8441
8574
|
|
|
8442
8575
|
var prevList = __spread(diffResult.prevList);
|
|
8443
8576
|
|
|
8577
|
+
var added = [];
|
|
8578
|
+
var removed = [];
|
|
8579
|
+
|
|
8444
8580
|
if (diffResult.removed.length > 0) {
|
|
8445
8581
|
var endIdx_1 = -1;
|
|
8446
8582
|
var prevIdx_1 = -1;
|
|
@@ -8450,7 +8586,7 @@ version: 4.5.1
|
|
|
8450
8586
|
}
|
|
8451
8587
|
|
|
8452
8588
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
8453
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8589
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8454
8590
|
endIdx_1 = removedIdx;
|
|
8455
8591
|
prevIdx_1 = removedIdx;
|
|
8456
8592
|
} else {
|
|
@@ -8459,39 +8595,34 @@ version: 4.5.1
|
|
|
8459
8595
|
|
|
8460
8596
|
prevList.splice(removedIdx, 1);
|
|
8461
8597
|
});
|
|
8462
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8598
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8463
8599
|
}
|
|
8464
8600
|
|
|
8465
8601
|
diffResult.ordered.forEach(function (_a) {
|
|
8466
8602
|
var _b = __read(_a, 2),
|
|
8467
|
-
|
|
8468
|
-
|
|
8603
|
+
from = _b[0],
|
|
8604
|
+
to = _b[1];
|
|
8469
8605
|
|
|
8470
|
-
var prevPanel = panels[
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
if (indexDiff > 0) {
|
|
8474
|
-
var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
|
|
8475
|
-
prevPanel.increaseIndex(indexDiff);
|
|
8476
|
-
middlePanels.forEach(function (panel) {
|
|
8477
|
-
return panel.decreaseIndex(1);
|
|
8478
|
-
});
|
|
8479
|
-
} else {
|
|
8480
|
-
var middlePanels = panels.slice(newIdx, prevIdx);
|
|
8481
|
-
prevPanel.decreaseIndex(-indexDiff);
|
|
8482
|
-
middlePanels.forEach(function (panel) {
|
|
8483
|
-
return panel.increaseIndex(1);
|
|
8484
|
-
});
|
|
8485
|
-
} // Update position
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
prevPanel.resize();
|
|
8606
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
8607
|
+
panels.splice(to, 0, prevPanel);
|
|
8489
8608
|
});
|
|
8490
8609
|
|
|
8491
8610
|
if (diffResult.ordered.length > 0) {
|
|
8611
|
+
panels.forEach(function (panel, idx) {
|
|
8612
|
+
var indexDiff = idx - panel.index;
|
|
8613
|
+
|
|
8614
|
+
if (indexDiff > 0) {
|
|
8615
|
+
panel.increaseIndex(indexDiff);
|
|
8616
|
+
} else {
|
|
8617
|
+
panel.decreaseIndex(-indexDiff);
|
|
8618
|
+
}
|
|
8619
|
+
});
|
|
8492
8620
|
panels.sort(function (panel1, panel2) {
|
|
8493
8621
|
return panel1.index - panel2.index;
|
|
8494
8622
|
});
|
|
8623
|
+
panels.forEach(function (panel) {
|
|
8624
|
+
panel.updatePosition();
|
|
8625
|
+
});
|
|
8495
8626
|
}
|
|
8496
8627
|
|
|
8497
8628
|
if (diffResult.added.length > 0) {
|
|
@@ -8504,7 +8635,7 @@ version: 4.5.1
|
|
|
8504
8635
|
}
|
|
8505
8636
|
|
|
8506
8637
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
8507
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
8638
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
|
|
8508
8639
|
startIdx_1 = -1;
|
|
8509
8640
|
prevIdx_2 = -1;
|
|
8510
8641
|
} else {
|
|
@@ -8513,13 +8644,15 @@ version: 4.5.1
|
|
|
8513
8644
|
});
|
|
8514
8645
|
|
|
8515
8646
|
if (startIdx_1 >= 0) {
|
|
8516
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
8647
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
8517
8648
|
}
|
|
8518
8649
|
}
|
|
8650
|
+
|
|
8651
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8519
8652
|
});
|
|
8520
8653
|
|
|
8521
8654
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
8522
|
-
renderer.
|
|
8655
|
+
return renderer.batchInsertDefer.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
8523
8656
|
return {
|
|
8524
8657
|
index: index,
|
|
8525
8658
|
elements: [addedElements[elIdx]],
|
|
@@ -8530,7 +8663,7 @@ version: 4.5.1
|
|
|
8530
8663
|
|
|
8531
8664
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
8532
8665
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
8533
|
-
renderer.
|
|
8666
|
+
return renderer.batchRemoveDefer({
|
|
8534
8667
|
index: startIdx,
|
|
8535
8668
|
deleteCount: removed.length,
|
|
8536
8669
|
hasDOMInElements: false
|