@egjs/flicking 4.5.0 → 4.6.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/TODO.md +3 -0
- package/declaration/Flicking.d.ts +8 -1
- package/declaration/camera/Camera.d.ts +2 -2
- package/declaration/control/StrictControl.d.ts +1 -0
- 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/dist/flicking-inline.css +45 -2
- package/dist/flicking-inline.min.css +1 -0
- package/dist/flicking.css +44 -2
- package/dist/flicking.esm.js +320 -171
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +320 -171
- 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.pkgd.js +320 -171
- 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 +14 -5
- 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 +3 -2
- package/src/control/StrictControl.ts +10 -0
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +92 -43
- package/css/flicking-inline.css +0 -38
- package/css/flicking.css +0 -28
- package/dist/flicking-inline.css.map +0 -1
- 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.1
|
|
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.0
|
|
|
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.0
|
|
|
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;
|
|
@@ -3512,6 +3541,21 @@ version: 4.5.0
|
|
|
3512
3541
|
};
|
|
3513
3542
|
return this;
|
|
3514
3543
|
};
|
|
3544
|
+
|
|
3545
|
+
__proto.moveToPanel = function (panel, options) {
|
|
3546
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3547
|
+
var flicking, camera, controller;
|
|
3548
|
+
return __generator(this, function (_a) {
|
|
3549
|
+
flicking = getFlickingAttached(this._flicking);
|
|
3550
|
+
camera = flicking.camera;
|
|
3551
|
+
controller = this._controller;
|
|
3552
|
+
controller.update(camera.controlParams);
|
|
3553
|
+
return [2
|
|
3554
|
+
/*return*/
|
|
3555
|
+
, _super.prototype.moveToPanel.call(this, panel, options)];
|
|
3556
|
+
});
|
|
3557
|
+
});
|
|
3558
|
+
};
|
|
3515
3559
|
/**
|
|
3516
3560
|
* Move {@link Camera} to the given position
|
|
3517
3561
|
* @ko {@link Camera}를 주어진 좌표로 이동합니다
|
|
@@ -4089,7 +4133,7 @@ version: 4.5.0
|
|
|
4089
4133
|
/*#__PURE__*/
|
|
4090
4134
|
function () {
|
|
4091
4135
|
/** */
|
|
4092
|
-
function Camera(_a) {
|
|
4136
|
+
function Camera(flicking, _a) {
|
|
4093
4137
|
var _this = this;
|
|
4094
4138
|
|
|
4095
4139
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
@@ -4129,7 +4173,7 @@ version: 4.5.0
|
|
|
4129
4173
|
_this._transform = transformName;
|
|
4130
4174
|
};
|
|
4131
4175
|
|
|
4132
|
-
this._flicking =
|
|
4176
|
+
this._flicking = flicking;
|
|
4133
4177
|
|
|
4134
4178
|
this._resetInternalValues(); // Options
|
|
4135
4179
|
|
|
@@ -4424,17 +4468,14 @@ version: 4.5.0
|
|
|
4424
4468
|
/**
|
|
4425
4469
|
* Initialize Camera
|
|
4426
4470
|
* @ko Camera를 초기화합니다
|
|
4427
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
4428
|
-
* @chainable
|
|
4429
4471
|
* @throws {FlickingError}
|
|
4430
4472
|
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
4431
4473
|
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
4432
4474
|
* @return {this}
|
|
4433
4475
|
*/
|
|
4434
4476
|
|
|
4435
|
-
__proto.init = function (
|
|
4436
|
-
this._flicking
|
|
4437
|
-
var viewportEl = flicking.viewport.element;
|
|
4477
|
+
__proto.init = function () {
|
|
4478
|
+
var viewportEl = this._flicking.viewport.element;
|
|
4438
4479
|
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
4439
4480
|
this._el = viewportEl.firstElementChild;
|
|
4440
4481
|
|
|
@@ -4452,8 +4493,6 @@ version: 4.5.0
|
|
|
4452
4493
|
|
|
4453
4494
|
|
|
4454
4495
|
__proto.destroy = function () {
|
|
4455
|
-
this._flicking = null;
|
|
4456
|
-
|
|
4457
4496
|
this._resetInternalValues();
|
|
4458
4497
|
|
|
4459
4498
|
return this;
|
|
@@ -4484,12 +4523,12 @@ version: 4.5.0
|
|
|
4484
4523
|
|
|
4485
4524
|
this._checkReachEnd(prevPos, pos);
|
|
4486
4525
|
|
|
4487
|
-
this.applyTransform();
|
|
4488
|
-
|
|
4489
4526
|
if (toggled) {
|
|
4490
4527
|
void flicking.renderer.render().then(function () {
|
|
4491
4528
|
_this.updateOffset();
|
|
4492
4529
|
});
|
|
4530
|
+
} else {
|
|
4531
|
+
this.applyTransform();
|
|
4493
4532
|
}
|
|
4494
4533
|
};
|
|
4495
4534
|
/**
|
|
@@ -4676,7 +4715,6 @@ version: 4.5.0
|
|
|
4676
4715
|
});
|
|
4677
4716
|
}
|
|
4678
4717
|
|
|
4679
|
-
this.updateOffset();
|
|
4680
4718
|
return this;
|
|
4681
4719
|
};
|
|
4682
4720
|
/**
|
|
@@ -4768,7 +4806,6 @@ version: 4.5.0
|
|
|
4768
4806
|
/**
|
|
4769
4807
|
* Apply "transform" style with the current position to camera element
|
|
4770
4808
|
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
4771
|
-
* @chainable
|
|
4772
4809
|
* @return {this}
|
|
4773
4810
|
*/
|
|
4774
4811
|
|
|
@@ -4776,6 +4813,8 @@ version: 4.5.0
|
|
|
4776
4813
|
__proto.applyTransform = function () {
|
|
4777
4814
|
var el = this._el;
|
|
4778
4815
|
var flicking = getFlickingAttached(this._flicking);
|
|
4816
|
+
var renderer = flicking.renderer;
|
|
4817
|
+
if (renderer.rendering) return this;
|
|
4779
4818
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4780
4819
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4781
4820
|
return this;
|
|
@@ -4961,7 +5000,8 @@ version: 4.5.0
|
|
|
4961
5000
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
4962
5001
|
strategy = _a.strategy;
|
|
4963
5002
|
this._flicking = null;
|
|
4964
|
-
this._panels = [];
|
|
5003
|
+
this._panels = [];
|
|
5004
|
+
this._rendering = false; // Bind options
|
|
4965
5005
|
|
|
4966
5006
|
this._align = align;
|
|
4967
5007
|
this._strategy = strategy;
|
|
@@ -4984,6 +5024,20 @@ version: 4.5.0
|
|
|
4984
5024
|
enumerable: false,
|
|
4985
5025
|
configurable: true
|
|
4986
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
|
+
});
|
|
4987
5041
|
Object.defineProperty(__proto, "panelCount", {
|
|
4988
5042
|
/**
|
|
4989
5043
|
* Count of panels
|
|
@@ -5115,6 +5169,25 @@ version: 4.5.0
|
|
|
5115
5169
|
|
|
5116
5170
|
|
|
5117
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 () {
|
|
5118
5191
|
var _this = this;
|
|
5119
5192
|
|
|
5120
5193
|
var items = [];
|
|
@@ -5125,7 +5198,6 @@ version: 4.5.0
|
|
|
5125
5198
|
|
|
5126
5199
|
var panels = this._panels;
|
|
5127
5200
|
var flicking = getFlickingAttached(this._flicking);
|
|
5128
|
-
var control = flicking.control;
|
|
5129
5201
|
var prevFirstPanel = panels[0];
|
|
5130
5202
|
var align = parsePanelAlign(this._align);
|
|
5131
5203
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -5165,27 +5237,6 @@ version: 4.5.0
|
|
|
5165
5237
|
});
|
|
5166
5238
|
return __spread(addedPanels, panelsInserted);
|
|
5167
5239
|
}, []);
|
|
5168
|
-
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
5169
|
-
|
|
5170
|
-
this._updateCameraAndControl();
|
|
5171
|
-
|
|
5172
|
-
void this.render(); // Move to the first panel added if no panels existed
|
|
5173
|
-
// FIXME: fix for animating case
|
|
5174
|
-
|
|
5175
|
-
if (allPanelsInserted.length > 0 && !control.animating) {
|
|
5176
|
-
void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
|
|
5177
|
-
duration: 0
|
|
5178
|
-
}).catch(function () {
|
|
5179
|
-
return void 0;
|
|
5180
|
-
});
|
|
5181
|
-
}
|
|
5182
|
-
|
|
5183
|
-
flicking.camera.updateOffset();
|
|
5184
|
-
flicking.trigger(new Component.ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5185
|
-
added: allPanelsInserted,
|
|
5186
|
-
removed: []
|
|
5187
|
-
}));
|
|
5188
|
-
this.checkPanelContentsReady(allPanelsInserted);
|
|
5189
5240
|
return allPanelsInserted;
|
|
5190
5241
|
};
|
|
5191
5242
|
/**
|
|
@@ -5202,6 +5253,25 @@ version: 4.5.0
|
|
|
5202
5253
|
|
|
5203
5254
|
|
|
5204
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 () {
|
|
5205
5275
|
var _this = this;
|
|
5206
5276
|
|
|
5207
5277
|
var items = [];
|
|
@@ -5212,10 +5282,8 @@ version: 4.5.0
|
|
|
5212
5282
|
|
|
5213
5283
|
var panels = this._panels;
|
|
5214
5284
|
var flicking = getFlickingAttached(this._flicking);
|
|
5215
|
-
var
|
|
5216
|
-
control = flicking.control;
|
|
5285
|
+
var control = flicking.control;
|
|
5217
5286
|
var activePanel = control.activePanel;
|
|
5218
|
-
var activeIndex = control.activeIndex;
|
|
5219
5287
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
5220
5288
|
var index = item.index,
|
|
5221
5289
|
deleteCount = item.deleteCount;
|
|
@@ -5243,33 +5311,61 @@ version: 4.5.0
|
|
|
5243
5311
|
}
|
|
5244
5312
|
|
|
5245
5313
|
return __spread(removed, panelsRemoved);
|
|
5246
|
-
}, []);
|
|
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
|
|
5247
5330
|
|
|
5248
5331
|
this._updateCameraAndControl();
|
|
5249
5332
|
|
|
5250
|
-
void this.render();
|
|
5333
|
+
void this.render();
|
|
5251
5334
|
|
|
5252
|
-
if (
|
|
5253
|
-
|
|
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;
|
|
5341
|
+
|
|
5342
|
+
if (targetIndex > panels.length - 1) {
|
|
5343
|
+
targetIndex = panels.length - 1;
|
|
5344
|
+
}
|
|
5254
5345
|
|
|
5255
|
-
|
|
5256
|
-
void control.moveToPanel(targetPanel, {
|
|
5346
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5257
5347
|
duration: 0
|
|
5258
5348
|
}).catch(function () {
|
|
5259
5349
|
return void 0;
|
|
5260
5350
|
});
|
|
5261
|
-
} else {
|
|
5262
|
-
// All panels removed
|
|
5263
|
-
camera.lookAt(0);
|
|
5264
5351
|
}
|
|
5352
|
+
} else {
|
|
5353
|
+
void control.moveToPanel(control.activePanel, {
|
|
5354
|
+
duration: 0
|
|
5355
|
+
}).catch(function () {
|
|
5356
|
+
return void 0;
|
|
5357
|
+
});
|
|
5265
5358
|
}
|
|
5266
5359
|
|
|
5267
5360
|
flicking.camera.updateOffset();
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
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
|
+
}
|
|
5273
5369
|
};
|
|
5274
5370
|
/**
|
|
5275
5371
|
* @internal
|
|
@@ -5314,6 +5410,7 @@ version: 4.5.0
|
|
|
5314
5410
|
});
|
|
5315
5411
|
if (!flicking.initialized) return;
|
|
5316
5412
|
camera.updateRange();
|
|
5413
|
+
camera.updateOffset();
|
|
5317
5414
|
camera.updateAnchors();
|
|
5318
5415
|
|
|
5319
5416
|
if (control.animating) ; else {
|
|
@@ -5347,6 +5444,7 @@ version: 4.5.0
|
|
|
5347
5444
|
var camera = flicking.camera,
|
|
5348
5445
|
control = flicking.control;
|
|
5349
5446
|
camera.updateRange();
|
|
5447
|
+
camera.updateOffset();
|
|
5350
5448
|
camera.updateAnchors();
|
|
5351
5449
|
camera.resetNeedPanelHistory();
|
|
5352
5450
|
control.updateInput();
|
|
@@ -6645,10 +6743,14 @@ version: 4.5.0
|
|
|
6645
6743
|
autoResize = _4 === void 0 ? true : _4,
|
|
6646
6744
|
_5 = _b.useResizeObserver,
|
|
6647
6745
|
useResizeObserver = _5 === void 0 ? true : _5,
|
|
6648
|
-
_6 = _b.
|
|
6649
|
-
|
|
6650
|
-
_7 = _b.
|
|
6651
|
-
|
|
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;
|
|
6652
6754
|
|
|
6653
6755
|
var _this = _super.call(this) || this; // Internal states
|
|
6654
6756
|
|
|
@@ -6684,6 +6786,8 @@ version: 4.5.0
|
|
|
6684
6786
|
_this._autoInit = autoInit;
|
|
6685
6787
|
_this._autoResize = autoResize;
|
|
6686
6788
|
_this._useResizeObserver = useResizeObserver;
|
|
6789
|
+
_this._resizeDebounce = resizeDebounce;
|
|
6790
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
6687
6791
|
_this._externalRenderer = externalRenderer;
|
|
6688
6792
|
_this._renderExternal = renderExternal; // Create core components
|
|
6689
6793
|
|
|
@@ -7532,6 +7636,38 @@ version: 4.5.0
|
|
|
7532
7636
|
enumerable: false,
|
|
7533
7637
|
configurable: true
|
|
7534
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
|
+
});
|
|
7535
7671
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
7536
7672
|
/**
|
|
7537
7673
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -7567,85 +7703,61 @@ version: 4.5.0
|
|
|
7567
7703
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
7568
7704
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
7569
7705
|
* @fires Flicking#ready
|
|
7570
|
-
* @return {
|
|
7706
|
+
* @return {Promise<void>}
|
|
7571
7707
|
*/
|
|
7572
7708
|
|
|
7573
7709
|
__proto.init = function () {
|
|
7574
|
-
|
|
7575
|
-
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
7576
|
-
|
|
7577
|
-
var _this = this;
|
|
7578
|
-
|
|
7579
|
-
return __generator(this, function (_a) {
|
|
7580
|
-
switch (_a.label) {
|
|
7581
|
-
case 0:
|
|
7582
|
-
if (this._initialized) return [2
|
|
7583
|
-
/*return*/
|
|
7584
|
-
];
|
|
7585
|
-
camera = this._camera;
|
|
7586
|
-
renderer = this._renderer;
|
|
7587
|
-
control = this._control;
|
|
7588
|
-
virtualManager = this._virtualManager;
|
|
7589
|
-
originalTrigger = this.trigger;
|
|
7590
|
-
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7591
|
-
camera.init(this);
|
|
7592
|
-
virtualManager.init();
|
|
7593
|
-
renderer.init(this);
|
|
7594
|
-
control.init(this);
|
|
7595
|
-
|
|
7596
|
-
if (preventEventsBeforeInit) {
|
|
7597
|
-
this.trigger = function () {
|
|
7598
|
-
return _this;
|
|
7599
|
-
};
|
|
7600
|
-
}
|
|
7601
|
-
|
|
7602
|
-
return [4
|
|
7603
|
-
/*yield*/
|
|
7604
|
-
, this.resize()];
|
|
7605
|
-
|
|
7606
|
-
case 1:
|
|
7607
|
-
_a.sent(); // Look at initial panel
|
|
7608
|
-
|
|
7710
|
+
var _this = this;
|
|
7609
7711
|
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
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
|
+
}
|
|
7613
7729
|
|
|
7614
|
-
|
|
7615
|
-
// Look at initial panel
|
|
7616
|
-
_a.sent();
|
|
7730
|
+
this._initialResize(); // Look at initial panel
|
|
7617
7731
|
|
|
7618
|
-
if (this._autoResize) {
|
|
7619
|
-
this._autoResizer.enable();
|
|
7620
|
-
}
|
|
7621
7732
|
|
|
7622
|
-
|
|
7623
|
-
control.controller.addPreventClickHandler();
|
|
7624
|
-
}
|
|
7733
|
+
this._moveToInitialPanel();
|
|
7625
7734
|
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7735
|
+
if (this._autoResize) {
|
|
7736
|
+
this._autoResizer.enable();
|
|
7737
|
+
}
|
|
7629
7738
|
|
|
7630
|
-
|
|
7739
|
+
if (this._preventClickOnDrag) {
|
|
7740
|
+
control.controller.addPreventClickHandler();
|
|
7741
|
+
}
|
|
7631
7742
|
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7743
|
+
if (this._disableOnInit) {
|
|
7744
|
+
this.disableInput();
|
|
7745
|
+
}
|
|
7635
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
|
+
});
|
|
7636
7753
|
|
|
7637
|
-
|
|
7754
|
+
_this._initialized = true;
|
|
7638
7755
|
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7756
|
+
if (preventEventsBeforeInit) {
|
|
7757
|
+
_this.trigger = originalTrigger;
|
|
7758
|
+
}
|
|
7642
7759
|
|
|
7643
|
-
|
|
7644
|
-
return [2
|
|
7645
|
-
/*return*/
|
|
7646
|
-
];
|
|
7647
|
-
}
|
|
7648
|
-
});
|
|
7760
|
+
_this.trigger(new Component.ComponentEvent(EVENTS.READY));
|
|
7649
7761
|
});
|
|
7650
7762
|
};
|
|
7651
7763
|
/**
|
|
@@ -8263,7 +8375,7 @@ version: 4.5.0
|
|
|
8263
8375
|
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
8264
8376
|
}
|
|
8265
8377
|
|
|
8266
|
-
return new Camera$1({
|
|
8378
|
+
return new Camera$1(this, {
|
|
8267
8379
|
align: this._align
|
|
8268
8380
|
});
|
|
8269
8381
|
};
|
|
@@ -8299,23 +8411,59 @@ version: 4.5.0
|
|
|
8299
8411
|
};
|
|
8300
8412
|
|
|
8301
8413
|
__proto._moveToInitialPanel = function () {
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
}
|
|
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
|
+
}));
|
|
8319
8467
|
};
|
|
8320
8468
|
/**
|
|
8321
8469
|
* Version info string
|
|
@@ -8329,7 +8477,7 @@ version: 4.5.0
|
|
|
8329
8477
|
*/
|
|
8330
8478
|
|
|
8331
8479
|
|
|
8332
|
-
Flicking.VERSION = "4.
|
|
8480
|
+
Flicking.VERSION = "4.6.1";
|
|
8333
8481
|
return Flicking;
|
|
8334
8482
|
}(Component);
|
|
8335
8483
|
|
|
@@ -8369,7 +8517,7 @@ version: 4.5.0
|
|
|
8369
8517
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
8370
8518
|
[Component.prototype, Flicking.prototype].forEach(function (proto) {
|
|
8371
8519
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
8372
|
-
return !prototype[name] &&
|
|
8520
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
8373
8521
|
}).forEach(function (name) {
|
|
8374
8522
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
8375
8523
|
|
|
@@ -8395,7 +8543,8 @@ version: 4.5.0
|
|
|
8395
8543
|
getterDescriptor.get = function () {
|
|
8396
8544
|
var _a;
|
|
8397
8545
|
|
|
8398
|
-
|
|
8546
|
+
var flicking = this[flickingName];
|
|
8547
|
+
return flicking && ((_a = descriptor.get) === null || _a === void 0 ? void 0 : _a.call(flicking));
|
|
8399
8548
|
};
|
|
8400
8549
|
}
|
|
8401
8550
|
|
|
@@ -8425,6 +8574,9 @@ version: 4.5.0
|
|
|
8425
8574
|
|
|
8426
8575
|
var prevList = __spread(diffResult.prevList);
|
|
8427
8576
|
|
|
8577
|
+
var added = [];
|
|
8578
|
+
var removed = [];
|
|
8579
|
+
|
|
8428
8580
|
if (diffResult.removed.length > 0) {
|
|
8429
8581
|
var endIdx_1 = -1;
|
|
8430
8582
|
var prevIdx_1 = -1;
|
|
@@ -8434,7 +8586,7 @@ version: 4.5.0
|
|
|
8434
8586
|
}
|
|
8435
8587
|
|
|
8436
8588
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
8437
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8589
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8438
8590
|
endIdx_1 = removedIdx;
|
|
8439
8591
|
prevIdx_1 = removedIdx;
|
|
8440
8592
|
} else {
|
|
@@ -8443,39 +8595,34 @@ version: 4.5.0
|
|
|
8443
8595
|
|
|
8444
8596
|
prevList.splice(removedIdx, 1);
|
|
8445
8597
|
});
|
|
8446
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8598
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8447
8599
|
}
|
|
8448
8600
|
|
|
8449
8601
|
diffResult.ordered.forEach(function (_a) {
|
|
8450
8602
|
var _b = __read(_a, 2),
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
var prevPanel = panels[prevIdx];
|
|
8455
|
-
var indexDiff = newIdx - prevIdx;
|
|
8456
|
-
|
|
8457
|
-
if (indexDiff > 0) {
|
|
8458
|
-
var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
|
|
8459
|
-
prevPanel.increaseIndex(indexDiff);
|
|
8460
|
-
middlePanels.forEach(function (panel) {
|
|
8461
|
-
return panel.decreaseIndex(1);
|
|
8462
|
-
});
|
|
8463
|
-
} else {
|
|
8464
|
-
var middlePanels = panels.slice(newIdx, prevIdx);
|
|
8465
|
-
prevPanel.decreaseIndex(-indexDiff);
|
|
8466
|
-
middlePanels.forEach(function (panel) {
|
|
8467
|
-
return panel.increaseIndex(1);
|
|
8468
|
-
});
|
|
8469
|
-
} // Update position
|
|
8470
|
-
|
|
8603
|
+
from = _b[0],
|
|
8604
|
+
to = _b[1];
|
|
8471
8605
|
|
|
8472
|
-
prevPanel.
|
|
8606
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
8607
|
+
panels.splice(to, 0, prevPanel);
|
|
8473
8608
|
});
|
|
8474
8609
|
|
|
8475
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
|
+
});
|
|
8476
8620
|
panels.sort(function (panel1, panel2) {
|
|
8477
8621
|
return panel1.index - panel2.index;
|
|
8478
8622
|
});
|
|
8623
|
+
panels.forEach(function (panel) {
|
|
8624
|
+
panel.updatePosition();
|
|
8625
|
+
});
|
|
8479
8626
|
}
|
|
8480
8627
|
|
|
8481
8628
|
if (diffResult.added.length > 0) {
|
|
@@ -8488,7 +8635,7 @@ version: 4.5.0
|
|
|
8488
8635
|
}
|
|
8489
8636
|
|
|
8490
8637
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
8491
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
8638
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
|
|
8492
8639
|
startIdx_1 = -1;
|
|
8493
8640
|
prevIdx_2 = -1;
|
|
8494
8641
|
} else {
|
|
@@ -8497,13 +8644,15 @@ version: 4.5.0
|
|
|
8497
8644
|
});
|
|
8498
8645
|
|
|
8499
8646
|
if (startIdx_1 >= 0) {
|
|
8500
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
8647
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
8501
8648
|
}
|
|
8502
8649
|
}
|
|
8650
|
+
|
|
8651
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8503
8652
|
});
|
|
8504
8653
|
|
|
8505
8654
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
8506
|
-
renderer.
|
|
8655
|
+
return renderer.batchInsertDefer.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
8507
8656
|
return {
|
|
8508
8657
|
index: index,
|
|
8509
8658
|
elements: [addedElements[elIdx]],
|
|
@@ -8514,7 +8663,7 @@ version: 4.5.0
|
|
|
8514
8663
|
|
|
8515
8664
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
8516
8665
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
8517
|
-
renderer.
|
|
8666
|
+
return renderer.batchRemoveDefer({
|
|
8518
8667
|
index: startIdx,
|
|
8519
8668
|
deleteCount: removed.length,
|
|
8520
8669
|
hasDOMInElements: false
|