@egjs/flicking 4.13.2-beta.0 → 4.14.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/core-packages-link.js +75 -0
- package/debug/reactive/index.html +240 -0
- package/declaration/Flicking.d.ts +12 -1
- package/declaration/control/Control.d.ts +1 -1
- package/declaration/core/AutoResizer.d.ts +5 -0
- package/declaration/index.d.ts +1 -0
- package/declaration/reactive/index.d.ts +25 -0
- package/dist/flicking.cjs.js +399 -33
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +393 -31
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +403 -35
- 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 +727 -49
- 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 +3 -2
- package/src/Flicking.ts +522 -153
- package/src/camera/mode/CameraMode.ts +2 -1
- package/src/control/Control.ts +1 -1
- package/src/control/SnapControl.ts +1 -8
- package/src/core/AutoResizer.ts +110 -11
- package/src/index.ts +1 -0
- package/src/index.umd.ts +2 -0
- package/src/reactive/index.ts +326 -0
- package/src/renderer/Renderer.ts +13 -0
- package/src/utils.ts +6 -1
package/dist/flicking.pkgd.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.14.0
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -1089,11 +1089,14 @@ version: 4.13.2-beta.0
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return -1;
|
|
1091
1091
|
};
|
|
1092
|
-
var getProgress = function (pos, prev, next) {
|
|
1092
|
+
var getProgress$1 = function (pos, prev, next) {
|
|
1093
1093
|
return (pos - prev) / (next - prev);
|
|
1094
1094
|
};
|
|
1095
1095
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1096
1096
|
var getStyle = function (el) {
|
|
1097
|
+
if (!el) {
|
|
1098
|
+
return {};
|
|
1099
|
+
}
|
|
1097
1100
|
return window.getComputedStyle(el) || el.currentStyle;
|
|
1098
1101
|
};
|
|
1099
1102
|
var setSize = function (el, _a) {
|
|
@@ -1207,7 +1210,7 @@ version: 4.13.2-beta.0
|
|
|
1207
1210
|
find: find$1,
|
|
1208
1211
|
findRight: findRight,
|
|
1209
1212
|
findIndex: findIndex,
|
|
1210
|
-
getProgress: getProgress,
|
|
1213
|
+
getProgress: getProgress$1,
|
|
1211
1214
|
getStyle: getStyle,
|
|
1212
1215
|
setSize: setSize,
|
|
1213
1216
|
isBetween: isBetween,
|
|
@@ -1401,13 +1404,59 @@ version: 4.13.2-beta.0
|
|
|
1401
1404
|
return Viewport;
|
|
1402
1405
|
}();
|
|
1403
1406
|
|
|
1407
|
+
/*
|
|
1408
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
1409
|
+
* egjs projects are licensed under the MIT license
|
|
1410
|
+
*/
|
|
1411
|
+
/**
|
|
1412
|
+
* A component that detects size change and trigger resize method when the autoResize option is used
|
|
1413
|
+
* @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
|
|
1414
|
+
*/
|
|
1404
1415
|
var AutoResizer = /*#__PURE__*/function () {
|
|
1405
1416
|
function AutoResizer(flicking) {
|
|
1406
1417
|
var _this = this;
|
|
1407
|
-
this.
|
|
1418
|
+
this._onResizeWrapper = function () {
|
|
1419
|
+
_this._onResize([]);
|
|
1420
|
+
};
|
|
1421
|
+
this._onResize = function (entries) {
|
|
1408
1422
|
var flicking = _this._flicking;
|
|
1409
1423
|
var resizeDebounce = flicking.resizeDebounce;
|
|
1410
1424
|
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
1425
|
+
var resizedViewportElement = flicking.element;
|
|
1426
|
+
// 현재 구현에서 리사이즈 옵저빙 대상은 패널과 뷰포트 2개만 존재.
|
|
1427
|
+
// 아래는 뷰포트만 변경되었을 때 동작해야하는 로직이 있으므로 아래와 같이 조건문을 건다.
|
|
1428
|
+
// 패널 쪽에서는 리사이즈 감지에 resizeObserver를 사용하지 않는 경우가 없으므로 이 조건은 곧 뷰포트만 리사이즈가 된 경우를 의미한다.
|
|
1429
|
+
var isResizedViewportOnly = entries.find(function (e) {
|
|
1430
|
+
return e.target === flicking.element;
|
|
1431
|
+
}) && entries.length === 1;
|
|
1432
|
+
// 참고: resizeObserver를 사용하지 않은 경우에는 entries.length가 0으로 오는데 이 경우에는 그냥 항상 리사이즈가 진행되도록 한다.
|
|
1433
|
+
// (vw, vh 등을 사용하는 경우 이상 동작이 발생할 여지가 있기 때문이다)
|
|
1434
|
+
if (isResizedViewportOnly) {
|
|
1435
|
+
// resize 이벤트가 발생했으나 이전과 width, height의 변화가 없다면 이후 로직을 진행하지 않는다.
|
|
1436
|
+
var beforeSize = {
|
|
1437
|
+
width: flicking.viewport.width,
|
|
1438
|
+
height: flicking.viewport.height
|
|
1439
|
+
};
|
|
1440
|
+
var afterSize = {
|
|
1441
|
+
width: getElementSize({
|
|
1442
|
+
el: resizedViewportElement,
|
|
1443
|
+
horizontal: true,
|
|
1444
|
+
useFractionalSize: _this._flicking.useFractionalSize,
|
|
1445
|
+
useOffset: false,
|
|
1446
|
+
style: getStyle(resizedViewportElement)
|
|
1447
|
+
}),
|
|
1448
|
+
height: getElementSize({
|
|
1449
|
+
el: resizedViewportElement,
|
|
1450
|
+
horizontal: false,
|
|
1451
|
+
useFractionalSize: _this._flicking.useFractionalSize,
|
|
1452
|
+
useOffset: false,
|
|
1453
|
+
style: getStyle(resizedViewportElement)
|
|
1454
|
+
})
|
|
1455
|
+
};
|
|
1456
|
+
if (beforeSize.height === afterSize.height && beforeSize.width === afterSize.width) {
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1411
1460
|
if (resizeDebounce <= 0) {
|
|
1412
1461
|
void flicking.resize();
|
|
1413
1462
|
} else {
|
|
@@ -1433,12 +1482,12 @@ version: 4.13.2-beta.0
|
|
|
1433
1482
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1434
1483
|
this._skipFirstResize = function () {
|
|
1435
1484
|
var isFirstResize = true;
|
|
1436
|
-
return function () {
|
|
1485
|
+
return function (entries) {
|
|
1437
1486
|
if (isFirstResize) {
|
|
1438
1487
|
isFirstResize = false;
|
|
1439
1488
|
return;
|
|
1440
1489
|
}
|
|
1441
|
-
_this._onResize();
|
|
1490
|
+
_this._onResize(entries);
|
|
1442
1491
|
};
|
|
1443
1492
|
}();
|
|
1444
1493
|
this._flicking = flicking;
|
|
@@ -1464,14 +1513,46 @@ version: 4.13.2-beta.0
|
|
|
1464
1513
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1465
1514
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1466
1515
|
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
|
|
1467
|
-
resizeObserver.observe(flicking.viewport.element);
|
|
1468
1516
|
this._resizeObserver = resizeObserver;
|
|
1517
|
+
this.observe(flicking.viewport.element);
|
|
1518
|
+
if (flicking.observePanelResize) {
|
|
1519
|
+
this.observePanels();
|
|
1520
|
+
}
|
|
1469
1521
|
} else {
|
|
1470
|
-
window.addEventListener("resize", this.
|
|
1522
|
+
window.addEventListener("resize", this._onResizeWrapper);
|
|
1471
1523
|
}
|
|
1472
1524
|
this._enabled = true;
|
|
1473
1525
|
return this;
|
|
1474
1526
|
};
|
|
1527
|
+
__proto.observePanels = function () {
|
|
1528
|
+
var _this = this;
|
|
1529
|
+
this._flicking.panels.forEach(function (panel) {
|
|
1530
|
+
_this.observe(panel.element);
|
|
1531
|
+
});
|
|
1532
|
+
return this;
|
|
1533
|
+
};
|
|
1534
|
+
__proto.unobservePanels = function () {
|
|
1535
|
+
var _this = this;
|
|
1536
|
+
this._flicking.panels.forEach(function (panel) {
|
|
1537
|
+
_this.unobserve(panel.element);
|
|
1538
|
+
});
|
|
1539
|
+
return this;
|
|
1540
|
+
};
|
|
1541
|
+
__proto.observe = function (element) {
|
|
1542
|
+
var resizeObserver = this._resizeObserver;
|
|
1543
|
+
if (!resizeObserver) return this;
|
|
1544
|
+
resizeObserver.observe(element);
|
|
1545
|
+
return this;
|
|
1546
|
+
};
|
|
1547
|
+
__proto.unobserve = function (element) {
|
|
1548
|
+
var resizeObserver = this._resizeObserver;
|
|
1549
|
+
if (!resizeObserver) return this;
|
|
1550
|
+
resizeObserver.unobserve(element);
|
|
1551
|
+
if (this._flicking.observePanelResize) {
|
|
1552
|
+
this.unobservePanels();
|
|
1553
|
+
}
|
|
1554
|
+
return this;
|
|
1555
|
+
};
|
|
1475
1556
|
__proto.disable = function () {
|
|
1476
1557
|
if (!this._enabled) return this;
|
|
1477
1558
|
var resizeObserver = this._resizeObserver;
|
|
@@ -1479,7 +1560,7 @@ version: 4.13.2-beta.0
|
|
|
1479
1560
|
resizeObserver.disconnect();
|
|
1480
1561
|
this._resizeObserver = null;
|
|
1481
1562
|
} else {
|
|
1482
|
-
window.removeEventListener("resize", this.
|
|
1563
|
+
window.removeEventListener("resize", this._onResizeWrapper);
|
|
1483
1564
|
}
|
|
1484
1565
|
this._enabled = false;
|
|
1485
1566
|
return this;
|
|
@@ -2171,6 +2252,20 @@ version: 4.13.2-beta.0
|
|
|
2171
2252
|
function keys(obj) {
|
|
2172
2253
|
return Object.keys(obj);
|
|
2173
2254
|
}
|
|
2255
|
+
/**
|
|
2256
|
+
* @hidden
|
|
2257
|
+
*/
|
|
2258
|
+
|
|
2259
|
+
function isObject(val) {
|
|
2260
|
+
return typeof val === "object";
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* @hidden
|
|
2264
|
+
*/
|
|
2265
|
+
|
|
2266
|
+
function isFunction(val) {
|
|
2267
|
+
return typeof val === "function";
|
|
2268
|
+
}
|
|
2174
2269
|
|
|
2175
2270
|
/**
|
|
2176
2271
|
* cfcs
|
|
@@ -2220,6 +2315,15 @@ version: 4.13.2-beta.0
|
|
|
2220
2315
|
|
|
2221
2316
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2222
2317
|
}
|
|
2318
|
+
function __spreadArray(to, from, pack) {
|
|
2319
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2320
|
+
if (ar || !(i in from)) {
|
|
2321
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2322
|
+
ar[i] = from[i];
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2326
|
+
}
|
|
2223
2327
|
|
|
2224
2328
|
/**
|
|
2225
2329
|
* cfcs
|
|
@@ -2548,6 +2652,56 @@ version: 4.13.2-beta.0
|
|
|
2548
2652
|
var prototype = Constructor.prototype;
|
|
2549
2653
|
injectReactiveSubscribe(prototype);
|
|
2550
2654
|
}
|
|
2655
|
+
|
|
2656
|
+
/**
|
|
2657
|
+
* cfcs
|
|
2658
|
+
* Copyright (c) 2022-present NAVER Corp.
|
|
2659
|
+
* MIT license
|
|
2660
|
+
*/
|
|
2661
|
+
|
|
2662
|
+
function makeReactiveObject(setup, all) {
|
|
2663
|
+
var result = isFunction(setup) ? setup() : setup;
|
|
2664
|
+
var reactiveObject = {};
|
|
2665
|
+
defineObservers(reactiveObject);
|
|
2666
|
+
keys(result).forEach(function (name) {
|
|
2667
|
+
var value = result[name];
|
|
2668
|
+
|
|
2669
|
+
if (isObserver(value)) {
|
|
2670
|
+
setObserver(reactiveObject, name, value);
|
|
2671
|
+
} else {
|
|
2672
|
+
setObserver(reactiveObject, name, observe(value));
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
Observe(name)(reactiveObject, name);
|
|
2676
|
+
});
|
|
2677
|
+
injectReactiveSubscribe(reactiveObject);
|
|
2678
|
+
return reactiveObject;
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* @description Make the return value of the corresponding object or function a reactive object.
|
|
2682
|
+
* @category Reactive
|
|
2683
|
+
* @param setup - The target object or function to which reactive is applied
|
|
2684
|
+
* @returns Makes all values into reactive objects.
|
|
2685
|
+
* @example
|
|
2686
|
+
* ```ts
|
|
2687
|
+
* import { reactive } from "@cfcs/core";
|
|
2688
|
+
*
|
|
2689
|
+
* const obj = reactive({
|
|
2690
|
+
* value1: 1,
|
|
2691
|
+
* value2: 2,
|
|
2692
|
+
* });
|
|
2693
|
+
*
|
|
2694
|
+
* obj.subscribe("value1", value1 => {
|
|
2695
|
+
* console.log(value1);
|
|
2696
|
+
* });
|
|
2697
|
+
* obj.value1 = 2;
|
|
2698
|
+
* ```
|
|
2699
|
+
*/
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
function reactive(setup) {
|
|
2703
|
+
return makeReactiveObject(setup);
|
|
2704
|
+
}
|
|
2551
2705
|
/**
|
|
2552
2706
|
* @description Creates a mutable ref object. You can access the `.current` value and detect the value change through `.subscribe`.
|
|
2553
2707
|
* @category Reactive
|
|
@@ -2575,6 +2729,37 @@ version: 4.13.2-beta.0
|
|
|
2575
2729
|
function computed(computedCallback) {
|
|
2576
2730
|
return new ComputedObserver(computedCallback);
|
|
2577
2731
|
}
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* cfcs
|
|
2735
|
+
* Copyright (c) 2022-present NAVER Corp.
|
|
2736
|
+
* MIT license
|
|
2737
|
+
*/
|
|
2738
|
+
/**
|
|
2739
|
+
* @hidden
|
|
2740
|
+
*/
|
|
2741
|
+
|
|
2742
|
+
function withReactiveMethods(ref, methods) {
|
|
2743
|
+
var obj = {};
|
|
2744
|
+
|
|
2745
|
+
if (!methods) {
|
|
2746
|
+
return obj;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
methods.forEach(function (name) {
|
|
2750
|
+
obj[name] = function () {
|
|
2751
|
+
var args = [];
|
|
2752
|
+
|
|
2753
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2754
|
+
args[_i] = arguments[_i];
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
var current = ref.current || ref.value;
|
|
2758
|
+
return current[name].apply(current, args);
|
|
2759
|
+
};
|
|
2760
|
+
});
|
|
2761
|
+
return obj;
|
|
2762
|
+
}
|
|
2578
2763
|
/**
|
|
2579
2764
|
* @hidden
|
|
2580
2765
|
*/
|
|
@@ -2628,6 +2813,227 @@ version: 4.13.2-beta.0
|
|
|
2628
2813
|
|
|
2629
2814
|
return observers[name];
|
|
2630
2815
|
}
|
|
2816
|
+
/**
|
|
2817
|
+
* @hidden
|
|
2818
|
+
*/
|
|
2819
|
+
|
|
2820
|
+
function setObserver(instance, name, observer) {
|
|
2821
|
+
var observers = getObservers(instance);
|
|
2822
|
+
observers[name] = observer;
|
|
2823
|
+
}
|
|
2824
|
+
/**
|
|
2825
|
+
* @description Whether that object is an observer instance
|
|
2826
|
+
* @category Reactive
|
|
2827
|
+
*/
|
|
2828
|
+
|
|
2829
|
+
function isObserver(val) {
|
|
2830
|
+
return val && isObject(val) && "current" in val && "subscribe" in val && "unsubscribe" in val;
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
/**
|
|
2834
|
+
* @category Reactive
|
|
2835
|
+
* @hidden
|
|
2836
|
+
*/
|
|
2837
|
+
|
|
2838
|
+
function adaptReactive(adapter, props) {
|
|
2839
|
+
var objectAdapter = isFunction(adapter) ? {
|
|
2840
|
+
setup: adapter
|
|
2841
|
+
} : adapter;
|
|
2842
|
+
|
|
2843
|
+
function getProps() {
|
|
2844
|
+
var _a, _b, _c, _d, _e;
|
|
2845
|
+
|
|
2846
|
+
return (_e = (_c = (_a = props === null || props === void 0 ? void 0 : props()) !== null && _a !== void 0 ? _a : (_b = objectAdapter.props) === null || _b === void 0 ? void 0 : _b.call(objectAdapter)) !== null && _c !== void 0 ? _c : (_d = objectAdapter.data) === null || _d === void 0 ? void 0 : _d.call(objectAdapter)) !== null && _e !== void 0 ? _e : {};
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
var eventEmitter = new Component();
|
|
2850
|
+
var mountedHooks = [];
|
|
2851
|
+
var initHooks = [];
|
|
2852
|
+
var destroyHooks = [];
|
|
2853
|
+
var onHooks = [];
|
|
2854
|
+
var instanceRef = {
|
|
2855
|
+
current: null
|
|
2856
|
+
};
|
|
2857
|
+
var offHooksList = [];
|
|
2858
|
+
var initialState = null;
|
|
2859
|
+
var eventNames = [];
|
|
2860
|
+
var methodNames = [];
|
|
2861
|
+
|
|
2862
|
+
var onMounted = function (callback) {
|
|
2863
|
+
mountedHooks.push(callback);
|
|
2864
|
+
};
|
|
2865
|
+
|
|
2866
|
+
var onInit = function (callback) {
|
|
2867
|
+
initHooks.push(callback);
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
var onDestroy = function (callback) {
|
|
2871
|
+
destroyHooks.push(callback);
|
|
2872
|
+
};
|
|
2873
|
+
|
|
2874
|
+
var on = function (callback) {
|
|
2875
|
+
onHooks.push(callback);
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
var emit = function (eventName) {
|
|
2879
|
+
var params = [];
|
|
2880
|
+
|
|
2881
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2882
|
+
params[_i - 1] = arguments[_i];
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
eventEmitter.trigger.apply(eventEmitter, __spreadArray([eventName], params, false));
|
|
2886
|
+
};
|
|
2887
|
+
|
|
2888
|
+
var setInitialState = function (state) {
|
|
2889
|
+
initialState = state;
|
|
2890
|
+
};
|
|
2891
|
+
|
|
2892
|
+
var setEvents = function (events) {
|
|
2893
|
+
eventNames = events;
|
|
2894
|
+
};
|
|
2895
|
+
|
|
2896
|
+
var setMethods = function (methods) {
|
|
2897
|
+
methodNames = methods;
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
if (objectAdapter.setup) {
|
|
2901
|
+
instanceRef.current = objectAdapter.setup({
|
|
2902
|
+
getProps: getProps,
|
|
2903
|
+
setInitialState: setInitialState,
|
|
2904
|
+
setEvents: setEvents,
|
|
2905
|
+
setMethods: setMethods,
|
|
2906
|
+
onMounted: onMounted,
|
|
2907
|
+
onDestroy: onDestroy,
|
|
2908
|
+
onInit: onInit,
|
|
2909
|
+
emit: emit,
|
|
2910
|
+
on: on
|
|
2911
|
+
}) || null;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
if (objectAdapter.created) {
|
|
2915
|
+
instanceRef.current = objectAdapter.created(getProps()) || null;
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
if (objectAdapter.events) {
|
|
2919
|
+
setEvents(objectAdapter.events);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
if (objectAdapter.state) {
|
|
2923
|
+
setInitialState(objectAdapter.state);
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
if (objectAdapter.methods) {
|
|
2927
|
+
setMethods(objectAdapter.methods);
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
if (objectAdapter.mounted) {
|
|
2931
|
+
onMounted(objectAdapter.mounted);
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
if (objectAdapter.destroy) {
|
|
2935
|
+
destroyHooks.push(objectAdapter.destroy);
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
if (objectAdapter.init) {
|
|
2939
|
+
initHooks.push(objectAdapter.init);
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
if (objectAdapter.on) {
|
|
2943
|
+
onHooks.push(function (instance, eventName, listener) {
|
|
2944
|
+
var off = objectAdapter.on(instance, eventName, listener);
|
|
2945
|
+
return function () {
|
|
2946
|
+
var _a;
|
|
2947
|
+
|
|
2948
|
+
off && off();
|
|
2949
|
+
(_a = objectAdapter.off) === null || _a === void 0 ? void 0 : _a.call(objectAdapter, instance, eventName, listener);
|
|
2950
|
+
};
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
return {
|
|
2955
|
+
events: function () {
|
|
2956
|
+
return eventNames;
|
|
2957
|
+
},
|
|
2958
|
+
state: function () {
|
|
2959
|
+
var inst = instanceRef.current;
|
|
2960
|
+
|
|
2961
|
+
if (initialState) {
|
|
2962
|
+
return initialState;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
if (inst) {
|
|
2966
|
+
var observers_1 = getObservers(inst);
|
|
2967
|
+
setInitialState(keys(observers_1).reduce(function (prev, cur) {
|
|
2968
|
+
prev[cur] = observers_1[cur].current;
|
|
2969
|
+
return prev;
|
|
2970
|
+
}, {}));
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
return initialState || {};
|
|
2974
|
+
},
|
|
2975
|
+
instance: function () {
|
|
2976
|
+
return instanceRef.current;
|
|
2977
|
+
},
|
|
2978
|
+
mounted: function () {
|
|
2979
|
+
var props = getProps();
|
|
2980
|
+
mountedHooks.forEach(function (hook) {
|
|
2981
|
+
instanceRef.current = hook(props, instanceRef.current) || instanceRef.current;
|
|
2982
|
+
});
|
|
2983
|
+
},
|
|
2984
|
+
init: function () {
|
|
2985
|
+
// on events
|
|
2986
|
+
var instance = instanceRef.current;
|
|
2987
|
+
var props = getProps();
|
|
2988
|
+
offHooksList = eventNames.map(function (eventName) {
|
|
2989
|
+
var listener = function () {
|
|
2990
|
+
var _a;
|
|
2991
|
+
|
|
2992
|
+
var params = [];
|
|
2993
|
+
|
|
2994
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2995
|
+
params[_i] = arguments[_i];
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
(_a = eventEmitter).trigger.apply(_a, __spreadArray([eventName], params, false));
|
|
2999
|
+
};
|
|
3000
|
+
|
|
3001
|
+
var instance = instanceRef.current;
|
|
3002
|
+
return onHooks.map(function (hook) {
|
|
3003
|
+
return hook(instance, eventName, listener);
|
|
3004
|
+
}).filter(Boolean);
|
|
3005
|
+
}); // init
|
|
3006
|
+
|
|
3007
|
+
initHooks.forEach(function (hook) {
|
|
3008
|
+
hook(instance, props);
|
|
3009
|
+
});
|
|
3010
|
+
},
|
|
3011
|
+
destroy: function () {
|
|
3012
|
+
// off events
|
|
3013
|
+
offHooksList.forEach(function (offHooks) {
|
|
3014
|
+
offHooks.forEach(function (hook) {
|
|
3015
|
+
hook();
|
|
3016
|
+
});
|
|
3017
|
+
}); // destroy
|
|
3018
|
+
|
|
3019
|
+
eventEmitter.off();
|
|
3020
|
+
var instance = instanceRef.current;
|
|
3021
|
+
var props = getProps();
|
|
3022
|
+
destroyHooks.forEach(function (hook) {
|
|
3023
|
+
hook(instance, props);
|
|
3024
|
+
});
|
|
3025
|
+
},
|
|
3026
|
+
methods: function () {
|
|
3027
|
+
return withReactiveMethods(instanceRef, methodNames);
|
|
3028
|
+
},
|
|
3029
|
+
on: function (eventName, listener) {
|
|
3030
|
+
eventEmitter.on(eventName, listener);
|
|
3031
|
+
},
|
|
3032
|
+
off: function (eventName, listener) {
|
|
3033
|
+
eventEmitter.off(eventName, listener);
|
|
3034
|
+
}
|
|
3035
|
+
};
|
|
3036
|
+
}
|
|
2631
3037
|
|
|
2632
3038
|
/**
|
|
2633
3039
|
* cfcs
|
|
@@ -2698,7 +3104,7 @@ version: 4.13.2-beta.0
|
|
|
2698
3104
|
license: MIT
|
|
2699
3105
|
author: NAVER Corp.
|
|
2700
3106
|
repository: https://github.com/naver/egjs-axes
|
|
2701
|
-
version: 3.9.
|
|
3107
|
+
version: 3.9.1
|
|
2702
3108
|
*/
|
|
2703
3109
|
|
|
2704
3110
|
/*! *****************************************************************************
|
|
@@ -3624,19 +4030,6 @@ version: 4.13.2-beta.0
|
|
|
3624
4030
|
var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;
|
|
3625
4031
|
var velocityX = prevEvent ? prevEvent.velocityX : 0;
|
|
3626
4032
|
var velocityY = prevEvent ? prevEvent.velocityY : 0;
|
|
3627
|
-
var directionX = prevEvent ? prevEvent.directionX : 1;
|
|
3628
|
-
var directionY = prevEvent ? prevEvent.directionY : 1;
|
|
3629
|
-
// If offset is 0, it inherits the direction of the previous event.
|
|
3630
|
-
if (offsetX > 0) {
|
|
3631
|
-
directionX = 1;
|
|
3632
|
-
} else if (offsetX < 0) {
|
|
3633
|
-
directionX = -1;
|
|
3634
|
-
}
|
|
3635
|
-
if (offsetY > 0) {
|
|
3636
|
-
directionY = 1;
|
|
3637
|
-
} else if (offsetY < 0) {
|
|
3638
|
-
directionY = -1;
|
|
3639
|
-
}
|
|
3640
4033
|
if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {
|
|
3641
4034
|
if (latestInterval) {
|
|
3642
4035
|
_a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1];
|
|
@@ -3656,8 +4049,6 @@ version: 4.13.2-beta.0
|
|
|
3656
4049
|
deltaY: deltaY,
|
|
3657
4050
|
offsetX: offsetX,
|
|
3658
4051
|
offsetY: offsetY,
|
|
3659
|
-
directionX: directionX,
|
|
3660
|
-
directionY: directionY,
|
|
3661
4052
|
velocityX: velocityX,
|
|
3662
4053
|
velocityY: velocityY,
|
|
3663
4054
|
preventSystemEvent: true
|
|
@@ -5121,7 +5512,7 @@ version: 4.13.2-beta.0
|
|
|
5121
5512
|
* eg.Axes.VERSION; // ex) 3.3.3
|
|
5122
5513
|
* ```
|
|
5123
5514
|
*/
|
|
5124
|
-
Axes.VERSION = "3.9.
|
|
5515
|
+
Axes.VERSION = "3.9.1";
|
|
5125
5516
|
/* eslint-enable */
|
|
5126
5517
|
/**
|
|
5127
5518
|
* @name TRANSFORM
|
|
@@ -5472,7 +5863,7 @@ version: 4.13.2-beta.0
|
|
|
5472
5863
|
this._detachWindowEvent(activeEvent);
|
|
5473
5864
|
clearTimeout(this._rightEdgeTimer);
|
|
5474
5865
|
var prevEvent = activeEvent.prevEvent;
|
|
5475
|
-
var velocity = this._isOverThreshold ? this._getOffset([Math.abs(prevEvent.velocityX) * prevEvent.
|
|
5866
|
+
var velocity = this._isOverThreshold ? this._getOffset([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]) : [0, 0];
|
|
5476
5867
|
activeEvent.onRelease();
|
|
5477
5868
|
this._observer.release(this, prevEvent, velocity);
|
|
5478
5869
|
};
|
|
@@ -7143,11 +7534,7 @@ version: 4.13.2-beta.0
|
|
|
7143
7534
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
7144
7535
|
// Move to anchor at position
|
|
7145
7536
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
7146
|
-
|
|
7147
|
-
// const nextPosition = this._getPosition(targetPanel, DIRECTION.NEXT);
|
|
7148
|
-
// const prevPosition = this._getPosition(targetPanel, DIRECTION.PREV);
|
|
7149
|
-
// targetPosition = Math.abs(camera.position - nextPosition) < Math.abs(camera.position - prevPosition) ? nextPosition : prevPosition;
|
|
7150
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
|
|
7537
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
7151
7538
|
// Move to the adjacent panel
|
|
7152
7539
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
7153
7540
|
} else {
|
|
@@ -7175,7 +7562,6 @@ version: 4.13.2-beta.0
|
|
|
7175
7562
|
if (!anchorAtCamera || !anchorAtPosition) {
|
|
7176
7563
|
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
|
|
7177
7564
|
}
|
|
7178
|
-
// console.log("_findSnappedAnchor", anchorAtPosition);
|
|
7179
7565
|
if (!isFinite(count)) {
|
|
7180
7566
|
return anchorAtPosition;
|
|
7181
7567
|
}
|
|
@@ -7617,7 +8003,10 @@ version: 4.13.2-beta.0
|
|
|
7617
8003
|
};
|
|
7618
8004
|
__proto.findAnchorIncludePosition = function (position) {
|
|
7619
8005
|
var anchors = this._flicking.camera.anchorPoints;
|
|
7620
|
-
|
|
8006
|
+
var anchorsIncludingPosition = anchors.filter(function (anchor) {
|
|
8007
|
+
return anchor.panel.includePosition(position, true);
|
|
8008
|
+
});
|
|
8009
|
+
return anchorsIncludingPosition.reduce(function (nearest, anchor) {
|
|
7621
8010
|
if (!nearest) return anchor;
|
|
7622
8011
|
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
7623
8012
|
}, null);
|
|
@@ -8282,7 +8671,7 @@ version: 4.13.2-beta.0
|
|
|
8282
8671
|
if (prevPosition > panelPos) {
|
|
8283
8672
|
prevPosition -= rangeDiff;
|
|
8284
8673
|
}
|
|
8285
|
-
return nearestPanel.index - 1 + getProgress(position, prevPosition, panelPos);
|
|
8674
|
+
return nearestPanel.index - 1 + getProgress$1(position, prevPosition, panelPos);
|
|
8286
8675
|
} else {
|
|
8287
8676
|
var nextPanel = nearestPanel.next();
|
|
8288
8677
|
var nextPosition = nextPanel ? nextPanel.position + nextPanel.offset : nextRange + bounceSize[1];
|
|
@@ -8290,7 +8679,7 @@ version: 4.13.2-beta.0
|
|
|
8290
8679
|
if (nextPosition < panelPos) {
|
|
8291
8680
|
nextPosition += rangeDiff;
|
|
8292
8681
|
}
|
|
8293
|
-
return nearestPanel.index + getProgress(position, panelPos, nextPosition);
|
|
8682
|
+
return nearestPanel.index + getProgress$1(position, panelPos, nextPosition);
|
|
8294
8683
|
}
|
|
8295
8684
|
},
|
|
8296
8685
|
enumerable: false,
|
|
@@ -9956,6 +10345,18 @@ version: 4.13.2-beta.0
|
|
|
9956
10345
|
var activePanel = control.activePanel;
|
|
9957
10346
|
// Update camera & control
|
|
9958
10347
|
this._updateCameraAndControl();
|
|
10348
|
+
if (flicking.autoResize && flicking.useResizeObserver) {
|
|
10349
|
+
panelsAdded.forEach(function (panel) {
|
|
10350
|
+
if (panel.element) {
|
|
10351
|
+
flicking.autoResizer.observe(panel.element);
|
|
10352
|
+
}
|
|
10353
|
+
});
|
|
10354
|
+
panelsRemoved.forEach(function (panel) {
|
|
10355
|
+
if (panel.element) {
|
|
10356
|
+
flicking.autoResizer.unobserve(panel.element);
|
|
10357
|
+
}
|
|
10358
|
+
});
|
|
10359
|
+
}
|
|
9959
10360
|
void this.render();
|
|
9960
10361
|
if (!flicking.animating) {
|
|
9961
10362
|
if (!activePanel || activePanel.removed) {
|
|
@@ -10504,10 +10905,10 @@ version: 4.13.2-beta.0
|
|
|
10504
10905
|
}
|
|
10505
10906
|
if (camPos < position) {
|
|
10506
10907
|
var disappearPosNext = position + (camera.size - camera.alignPosition) + alignPosition;
|
|
10507
|
-
return -getProgress(camPos, position, disappearPosNext);
|
|
10908
|
+
return -getProgress$1(camPos, position, disappearPosNext);
|
|
10508
10909
|
} else {
|
|
10509
10910
|
var disappearPosPrev = position - (camera.alignPosition + this._size - alignPosition);
|
|
10510
|
-
return 1 - getProgress(camPos, disappearPosPrev, position);
|
|
10911
|
+
return 1 - getProgress$1(camPos, disappearPosPrev, position);
|
|
10511
10912
|
}
|
|
10512
10913
|
},
|
|
10513
10914
|
enumerable: false,
|
|
@@ -11247,18 +11648,23 @@ version: 4.13.2-beta.0
|
|
|
11247
11648
|
useResizeObserver = _9 === void 0 ? true : _9,
|
|
11248
11649
|
_10 = _b.resizeDebounce,
|
|
11249
11650
|
resizeDebounce = _10 === void 0 ? 0 : _10,
|
|
11250
|
-
_11 = _b.
|
|
11251
|
-
|
|
11252
|
-
_12 = _b.
|
|
11253
|
-
|
|
11254
|
-
_13 = _b.
|
|
11255
|
-
|
|
11256
|
-
_14 = _b.
|
|
11257
|
-
|
|
11651
|
+
_11 = _b.observePanelResize,
|
|
11652
|
+
observePanelResize = _11 === void 0 ? false : _11,
|
|
11653
|
+
_12 = _b.maxResizeDebounce,
|
|
11654
|
+
maxResizeDebounce = _12 === void 0 ? 100 : _12,
|
|
11655
|
+
_13 = _b.useFractionalSize,
|
|
11656
|
+
useFractionalSize = _13 === void 0 ? false : _13,
|
|
11657
|
+
_14 = _b.externalRenderer,
|
|
11658
|
+
externalRenderer = _14 === void 0 ? null : _14,
|
|
11659
|
+
_15 = _b.renderExternal,
|
|
11660
|
+
renderExternal = _15 === void 0 ? null : _15,
|
|
11661
|
+
_16 = _b.optimizeSizeUpdate,
|
|
11662
|
+
optimizeSizeUpdate = _16 === void 0 ? false : _16;
|
|
11258
11663
|
var _this = _super.call(this) || this;
|
|
11259
11664
|
// Internal states
|
|
11260
11665
|
_this._initialized = false;
|
|
11261
11666
|
_this._plugins = [];
|
|
11667
|
+
_this._isResizing = false;
|
|
11262
11668
|
// Bind options
|
|
11263
11669
|
_this._align = align;
|
|
11264
11670
|
_this._defaultIndex = defaultIndex;
|
|
@@ -11294,9 +11700,11 @@ version: 4.13.2-beta.0
|
|
|
11294
11700
|
_this._useResizeObserver = useResizeObserver;
|
|
11295
11701
|
_this._resizeDebounce = resizeDebounce;
|
|
11296
11702
|
_this._maxResizeDebounce = maxResizeDebounce;
|
|
11703
|
+
_this._observePanelResize = observePanelResize;
|
|
11297
11704
|
_this._useFractionalSize = useFractionalSize;
|
|
11298
11705
|
_this._externalRenderer = externalRenderer;
|
|
11299
11706
|
_this._renderExternal = renderExternal;
|
|
11707
|
+
_this._optimizeSizeUpdate = optimizeSizeUpdate;
|
|
11300
11708
|
// Create core components
|
|
11301
11709
|
_this._viewport = new Viewport(_this, getElement(root));
|
|
11302
11710
|
_this._autoResizer = new AutoResizer(_this);
|
|
@@ -11377,6 +11785,19 @@ version: 4.13.2-beta.0
|
|
|
11377
11785
|
enumerable: false,
|
|
11378
11786
|
configurable: true
|
|
11379
11787
|
});
|
|
11788
|
+
Object.defineProperty(__proto, "autoResizer", {
|
|
11789
|
+
/**
|
|
11790
|
+
* {@link AutoResizer} instance of the Flicking
|
|
11791
|
+
* @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
|
|
11792
|
+
* @internal
|
|
11793
|
+
* @readonly
|
|
11794
|
+
*/
|
|
11795
|
+
get: function () {
|
|
11796
|
+
return this._autoResizer;
|
|
11797
|
+
},
|
|
11798
|
+
enumerable: false,
|
|
11799
|
+
configurable: true
|
|
11800
|
+
});
|
|
11380
11801
|
Object.defineProperty(__proto, "initialized", {
|
|
11381
11802
|
// Internal States
|
|
11382
11803
|
/**
|
|
@@ -12250,6 +12671,9 @@ version: 4.13.2-beta.0
|
|
|
12250
12671
|
// OTHERS
|
|
12251
12672
|
set: function (val) {
|
|
12252
12673
|
this._autoResize = val;
|
|
12674
|
+
if (!this._initialized) {
|
|
12675
|
+
return;
|
|
12676
|
+
}
|
|
12253
12677
|
if (val) {
|
|
12254
12678
|
this._autoResizer.enable();
|
|
12255
12679
|
} else {
|
|
@@ -12272,13 +12696,38 @@ version: 4.13.2-beta.0
|
|
|
12272
12696
|
},
|
|
12273
12697
|
set: function (val) {
|
|
12274
12698
|
this._useResizeObserver = val;
|
|
12275
|
-
if (this._autoResize) {
|
|
12699
|
+
if (this._initialized && this._autoResize) {
|
|
12276
12700
|
this._autoResizer.enable();
|
|
12277
12701
|
}
|
|
12278
12702
|
},
|
|
12279
12703
|
enumerable: false,
|
|
12280
12704
|
configurable: true
|
|
12281
12705
|
});
|
|
12706
|
+
Object.defineProperty(__proto, "observePanelResize", {
|
|
12707
|
+
/**
|
|
12708
|
+
* Whether to use {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver} to observe the size of the panel element
|
|
12709
|
+
* This is only available when `useResizeObserver` is enabled.
|
|
12710
|
+
* This option garantees that the resize event is triggered when the size of the panel element is changed.
|
|
12711
|
+
* @ko 이 옵션을 활성화할 경우, {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver}를 사용하여 패널 엘리먼트의 크기를 추적합니다.
|
|
12712
|
+
* 이 옵션은 `useResizeObserver` 옵션이 활성화된 경우에만 사용할 수 있습니다.
|
|
12713
|
+
* 이 옵션은 패널 엘리먼트의 크기가 변경될 경우 resize 이벤트가 발생하도록 보장합니다.
|
|
12714
|
+
*/
|
|
12715
|
+
get: function () {
|
|
12716
|
+
return this._observePanelResize;
|
|
12717
|
+
},
|
|
12718
|
+
set: function (val) {
|
|
12719
|
+
this._observePanelResize = val;
|
|
12720
|
+
if (this._initialized && this._autoResize) {
|
|
12721
|
+
if (val) {
|
|
12722
|
+
this._autoResizer.observePanels();
|
|
12723
|
+
} else {
|
|
12724
|
+
this._autoResizer.unobservePanels();
|
|
12725
|
+
}
|
|
12726
|
+
}
|
|
12727
|
+
},
|
|
12728
|
+
enumerable: false,
|
|
12729
|
+
configurable: true
|
|
12730
|
+
});
|
|
12282
12731
|
Object.defineProperty(__proto, "resizeDebounce", {
|
|
12283
12732
|
/**
|
|
12284
12733
|
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
@@ -12360,6 +12809,30 @@ version: 4.13.2-beta.0
|
|
|
12360
12809
|
enumerable: false,
|
|
12361
12810
|
configurable: true
|
|
12362
12811
|
});
|
|
12812
|
+
Object.defineProperty(__proto, "optimizeSizeUpdate", {
|
|
12813
|
+
/**
|
|
12814
|
+
* This option works only when autoResize is set to true.
|
|
12815
|
+
* By default, autoResize listens to changes in both the viewport's width and height, updating all panel sizes accordingly.
|
|
12816
|
+
* When optimizeSizeUpdate is enabled, the update behavior is optimized based on the flicking direction:
|
|
12817
|
+
* If direction is "horizontal", only changes in width will trigger panel size updates.
|
|
12818
|
+
* If direction is "vertical", only changes in height will do so.
|
|
12819
|
+
* This option is useful when panel heights vary and unwanted flickering occurs due to frequent size recalculations during flicking. Enabling optimizeSizeUpdate prevents unnecessary updates and helps maintain visual stability.
|
|
12820
|
+
* @ko optimizeSizeUpdate는 autoResize가 true일 때만 동작합니다.
|
|
12821
|
+
* 기본적으로 autoResize는 뷰포트의 width와 height 변화를 모두 감지하여 패널들의 사이즈를 업데이트합니다.
|
|
12822
|
+
* 이 옵션을 활성화하면 플리킹 방향에 따라 필요한 차원(horizontal → width, vertical → height)에 대해서만 사이즈를 업데이트합니다.
|
|
12823
|
+
* 내부 패널의 높이가 서로 다를 때, 플리킹 중 과도한 리사이징으로 인한 깜빡임 현상을 줄이는 데 유용합니다.
|
|
12824
|
+
* @type {boolean}
|
|
12825
|
+
* @default false
|
|
12826
|
+
*/
|
|
12827
|
+
get: function () {
|
|
12828
|
+
return this._optimizeSizeUpdate;
|
|
12829
|
+
},
|
|
12830
|
+
set: function (val) {
|
|
12831
|
+
this._optimizeSizeUpdate = val;
|
|
12832
|
+
},
|
|
12833
|
+
enumerable: false,
|
|
12834
|
+
configurable: true
|
|
12835
|
+
});
|
|
12363
12836
|
/**
|
|
12364
12837
|
* Initialize Flicking and move to the default index
|
|
12365
12838
|
* This is automatically called on Flicking's constructor when `autoInit` is true(default)
|
|
@@ -12798,6 +13271,8 @@ version: 4.13.2-beta.0
|
|
|
12798
13271
|
return __generator(this, function (_a) {
|
|
12799
13272
|
switch (_a.label) {
|
|
12800
13273
|
case 0:
|
|
13274
|
+
if (this._isResizing) return [2 /*return*/];
|
|
13275
|
+
this._isResizing = true;
|
|
12801
13276
|
viewport = this._viewport;
|
|
12802
13277
|
renderer = this._renderer;
|
|
12803
13278
|
camera = this._camera;
|
|
@@ -12812,9 +13287,20 @@ version: 4.13.2-beta.0
|
|
|
12812
13287
|
element: viewport.element
|
|
12813
13288
|
}));
|
|
12814
13289
|
viewport.resize();
|
|
13290
|
+
if (!this._optimizeSizeUpdate) return [3 /*break*/, 3];
|
|
13291
|
+
if (!(this.horizontal && viewport.width !== prevWidth || !this.horizontal && viewport.height !== prevHeight)) return [3 /*break*/, 2];
|
|
12815
13292
|
return [4 /*yield*/, renderer.forceRenderAllPanels()];
|
|
12816
13293
|
case 1:
|
|
13294
|
+
_a.sent();
|
|
13295
|
+
_a.label = 2;
|
|
13296
|
+
case 2:
|
|
13297
|
+
return [3 /*break*/, 5];
|
|
13298
|
+
case 3:
|
|
13299
|
+
return [4 /*yield*/, renderer.forceRenderAllPanels()];
|
|
13300
|
+
case 4:
|
|
12817
13301
|
_a.sent(); // Render all panel elements, to update sizes
|
|
13302
|
+
_a.label = 5;
|
|
13303
|
+
case 5:
|
|
12818
13304
|
if (!this._initialized) {
|
|
12819
13305
|
return [2 /*return*/];
|
|
12820
13306
|
}
|
|
@@ -12827,7 +13313,7 @@ version: 4.13.2-beta.0
|
|
|
12827
13313
|
camera.updatePanelOrder();
|
|
12828
13314
|
camera.updateOffset();
|
|
12829
13315
|
return [4 /*yield*/, renderer.render()];
|
|
12830
|
-
case
|
|
13316
|
+
case 6:
|
|
12831
13317
|
_a.sent();
|
|
12832
13318
|
if (!this._initialized) {
|
|
12833
13319
|
return [2 /*return*/];
|
|
@@ -12850,6 +13336,7 @@ version: 4.13.2-beta.0
|
|
|
12850
13336
|
sizeChanged: sizeChanged,
|
|
12851
13337
|
element: viewport.element
|
|
12852
13338
|
}));
|
|
13339
|
+
this._isResizing = false;
|
|
12853
13340
|
return [2 /*return*/];
|
|
12854
13341
|
}
|
|
12855
13342
|
});
|
|
@@ -13069,7 +13556,7 @@ version: 4.13.2-beta.0
|
|
|
13069
13556
|
* Flicking.VERSION; // ex) 4.0.0
|
|
13070
13557
|
* ```
|
|
13071
13558
|
*/
|
|
13072
|
-
Flicking.VERSION = "4.
|
|
13559
|
+
Flicking.VERSION = "4.14.0";
|
|
13073
13560
|
return Flicking;
|
|
13074
13561
|
}(Component);
|
|
13075
13562
|
|
|
@@ -13656,6 +14143,196 @@ version: 4.13.2-beta.0
|
|
|
13656
14143
|
getDefaultCameraTransform: getDefaultCameraTransform
|
|
13657
14144
|
};
|
|
13658
14145
|
|
|
14146
|
+
// Check if Flicking has reached the first panel
|
|
14147
|
+
var getIsReachStart = function (flicking) {
|
|
14148
|
+
return !flicking.circular && flicking.index === 0;
|
|
14149
|
+
};
|
|
14150
|
+
// Check if Flicking has reached the last panel
|
|
14151
|
+
var getIsReachEnd = function (flicking) {
|
|
14152
|
+
return !flicking.circular && flicking.index === flicking.panelCount - 1;
|
|
14153
|
+
};
|
|
14154
|
+
// Get the total number of panels
|
|
14155
|
+
var getTotalPanelCount = function (flicking) {
|
|
14156
|
+
return flicking.panelCount;
|
|
14157
|
+
};
|
|
14158
|
+
// Get the current active panel index
|
|
14159
|
+
var getCurrentPanelIndex = function (flicking) {
|
|
14160
|
+
return flicking.index;
|
|
14161
|
+
};
|
|
14162
|
+
// Calculate the overall scroll progress percentage based on the current camera position
|
|
14163
|
+
var getProgress = function (flicking) {
|
|
14164
|
+
var cam = flicking.camera;
|
|
14165
|
+
var progressRatio = (cam.position - cam.range.min) / (cam.range.max - cam.range.min);
|
|
14166
|
+
var percent = Math.min(Math.max(progressRatio, 0), 1) * 100;
|
|
14167
|
+
return percent;
|
|
14168
|
+
};
|
|
14169
|
+
// Calculate the progress between panels including decimal values
|
|
14170
|
+
var getIndexProgress = function (flicking) {
|
|
14171
|
+
var cam = flicking.camera;
|
|
14172
|
+
var anchorPoints = cam.anchorPoints;
|
|
14173
|
+
var length = anchorPoints.length;
|
|
14174
|
+
var cameraPosition = cam.position;
|
|
14175
|
+
var isCircular = flicking.circularEnabled;
|
|
14176
|
+
var indexProgress = 0;
|
|
14177
|
+
var _a = cam.range,
|
|
14178
|
+
min = _a.min,
|
|
14179
|
+
max = _a.max;
|
|
14180
|
+
var firstAnchorPoint = anchorPoints[0];
|
|
14181
|
+
var lastAnchorPoint = anchorPoints[length - 1];
|
|
14182
|
+
var distanceLastToFirst = max - lastAnchorPoint.position + (firstAnchorPoint.position - min);
|
|
14183
|
+
anchorPoints.some(function (anchorPoint, index) {
|
|
14184
|
+
var anchorPosition = anchorPoint.position;
|
|
14185
|
+
var nextAnchorPoint = anchorPoints[index + 1];
|
|
14186
|
+
if (index === 0 && cameraPosition <= anchorPosition) {
|
|
14187
|
+
if (isCircular) {
|
|
14188
|
+
indexProgress = (cameraPosition - anchorPosition) / distanceLastToFirst;
|
|
14189
|
+
} else {
|
|
14190
|
+
indexProgress = (cameraPosition - anchorPosition) / anchorPoint.panel.size;
|
|
14191
|
+
}
|
|
14192
|
+
} else if (index === length - 1 && cameraPosition >= anchorPosition) {
|
|
14193
|
+
if (isCircular) {
|
|
14194
|
+
indexProgress = index + (cameraPosition - anchorPosition) / distanceLastToFirst;
|
|
14195
|
+
} else {
|
|
14196
|
+
indexProgress = index + (cameraPosition - anchorPosition) / anchorPoint.panel.size;
|
|
14197
|
+
}
|
|
14198
|
+
} else if (nextAnchorPoint && anchorPosition <= cameraPosition && cameraPosition <= nextAnchorPoint.position) {
|
|
14199
|
+
indexProgress = index + (cameraPosition - anchorPosition) / (nextAnchorPoint.position - anchorPosition);
|
|
14200
|
+
} else {
|
|
14201
|
+
return false;
|
|
14202
|
+
}
|
|
14203
|
+
return true;
|
|
14204
|
+
});
|
|
14205
|
+
return indexProgress;
|
|
14206
|
+
};
|
|
14207
|
+
/**
|
|
14208
|
+
* Internal reactive API adapter for Flicking that manages state and event listeners
|
|
14209
|
+
* This adapter is used internally by framework-specific packages (react-flicking, vue-flicking, etc.)
|
|
14210
|
+
* to provide reactive API support. Users rarely need to use this directly.
|
|
14211
|
+
* @ko Flicking의 상태와 이벤트 리스너를 관리하는 내부 반응형 API 어댑터
|
|
14212
|
+
* 이 어댑터는 react-flicking, vue-flicking 등의 프레임워크별 패키지에서 내부적으로 사용되어
|
|
14213
|
+
* 반응형 API 지원을 제공합니다. 사용자가 직접 사용할 일은 거의 없습니다.
|
|
14214
|
+
* @param onInit - Callback when reactive object is initialized<ko>반응형 객체가 초기화될 때 호출되는 콜백</ko>
|
|
14215
|
+
* @param onDestroy - Callback when reactive object is destroyed<ko>반응형 객체가 파괴될 때 호출되는 콜백</ko>
|
|
14216
|
+
* @param setMethods - Function to set available methods<ko>사용 가능한 메서드를 설정하는 함수</ko>
|
|
14217
|
+
* @returns Reactive object with Flicking state and methods<ko>Flicking 상태와 메서드를 포함한 반응형 객체</ko>
|
|
14218
|
+
*/
|
|
14219
|
+
var flickingReactiveAPIAdapter = function (_a) {
|
|
14220
|
+
var _b, _c, _d;
|
|
14221
|
+
var onInit = _a.onInit,
|
|
14222
|
+
onDestroy = _a.onDestroy,
|
|
14223
|
+
setMethods = _a.setMethods,
|
|
14224
|
+
getProps = _a.getProps;
|
|
14225
|
+
var flicking;
|
|
14226
|
+
// Move to a specific panel index
|
|
14227
|
+
var moveTo = function (i) {
|
|
14228
|
+
if (flicking == null) {
|
|
14229
|
+
return Promise.reject(new Error("Flicking instance is not available"));
|
|
14230
|
+
}
|
|
14231
|
+
if (flicking === null || flicking === void 0 ? void 0 : flicking.animating) {
|
|
14232
|
+
return Promise.resolve();
|
|
14233
|
+
}
|
|
14234
|
+
return flicking.moveTo(i);
|
|
14235
|
+
};
|
|
14236
|
+
setMethods(["moveTo"]);
|
|
14237
|
+
var options = getProps().options;
|
|
14238
|
+
// options를 고려하지 않고 초기값을 설정해도 동작에는 아무런 문제가 없으나, 이 시점의 초기값과 컴포넌트 init 단계에서의 초기값이 다르면 화면 리렌더링이 발생할 수 있으므로
|
|
14239
|
+
// 이렇게 미리 옵션을 통해서 예측할 수 있는 부분들은 맞춰둔다.
|
|
14240
|
+
var reactiveObj = reactive({
|
|
14241
|
+
isReachStart: (options === null || options === void 0 ? void 0 : options.defaultIndex) ? (options === null || options === void 0 ? void 0 : options.defaultIndex) === 0 : true,
|
|
14242
|
+
isReachEnd: (options === null || options === void 0 ? void 0 : options.totalPanelCount) && (options === null || options === void 0 ? void 0 : options.defaultIndex) ? options.defaultIndex === options.totalPanelCount - 1 : false,
|
|
14243
|
+
totalPanelCount: (_b = options === null || options === void 0 ? void 0 : options.totalPanelCount) !== null && _b !== void 0 ? _b : 0,
|
|
14244
|
+
currentPanelIndex: (_c = options === null || options === void 0 ? void 0 : options.defaultIndex) !== null && _c !== void 0 ? _c : 0,
|
|
14245
|
+
progress: 0,
|
|
14246
|
+
indexProgress: (_d = options === null || options === void 0 ? void 0 : options.defaultIndex) !== null && _d !== void 0 ? _d : 0,
|
|
14247
|
+
moveTo: moveTo
|
|
14248
|
+
});
|
|
14249
|
+
// Update state when panel changes
|
|
14250
|
+
var onChanged = function () {
|
|
14251
|
+
if (flicking === undefined) return;
|
|
14252
|
+
reactiveObj.isReachStart = getIsReachStart(flicking);
|
|
14253
|
+
reactiveObj.isReachEnd = getIsReachEnd(flicking);
|
|
14254
|
+
reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
|
|
14255
|
+
};
|
|
14256
|
+
// Update state when panel count changes
|
|
14257
|
+
var onPanelChange = function () {
|
|
14258
|
+
if (flicking === undefined) return;
|
|
14259
|
+
onChanged();
|
|
14260
|
+
reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
|
|
14261
|
+
};
|
|
14262
|
+
// Update progress when camera moves
|
|
14263
|
+
var onMove = function () {
|
|
14264
|
+
if (flicking === undefined) return;
|
|
14265
|
+
reactiveObj.progress = getProgress(flicking);
|
|
14266
|
+
reactiveObj.indexProgress = getIndexProgress(flicking);
|
|
14267
|
+
};
|
|
14268
|
+
onInit(function (inst, data) {
|
|
14269
|
+
flicking = data.flicking;
|
|
14270
|
+
if (flicking === undefined) return;
|
|
14271
|
+
reactiveObj.isReachStart = getIsReachStart(flicking);
|
|
14272
|
+
reactiveObj.isReachEnd = getIsReachEnd(flicking);
|
|
14273
|
+
reactiveObj.currentPanelIndex = getCurrentPanelIndex(flicking);
|
|
14274
|
+
reactiveObj.progress = getProgress(flicking);
|
|
14275
|
+
reactiveObj.totalPanelCount = getTotalPanelCount(flicking);
|
|
14276
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.on("changed", onChanged);
|
|
14277
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.on("panelChange", onPanelChange);
|
|
14278
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.on("move", onMove);
|
|
14279
|
+
});
|
|
14280
|
+
onDestroy(function () {
|
|
14281
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.off("changed", onChanged);
|
|
14282
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.off("panelChange", onPanelChange);
|
|
14283
|
+
flicking === null || flicking === void 0 ? void 0 : flicking.off("move", onMove);
|
|
14284
|
+
});
|
|
14285
|
+
return reactiveObj;
|
|
14286
|
+
};
|
|
14287
|
+
/**
|
|
14288
|
+
* Connect Flicking instance to reactive API
|
|
14289
|
+
* @ko Flicking 인스턴스를 반응형 API에 연결합니다
|
|
14290
|
+
* @param {Flicking} flicking - Flicking instance to connect<ko>연결할 Flicking 인스턴스</ko>
|
|
14291
|
+
* @param {FlickingReactiveAPIOptions} [options] - Flicking options<ko>Flicking 옵션</ko>
|
|
14292
|
+
* @returns {FlickingReactiveObject} Reactive object with Flicking state and methods<ko>Flicking 상태와 메서드를 포함한 반응형 객체</ko>
|
|
14293
|
+
* @example
|
|
14294
|
+
* ```js
|
|
14295
|
+
* import Flicking, { connectFlickingReactiveAPI } from "@egjs/flicking";
|
|
14296
|
+
*
|
|
14297
|
+
* const flicking = new Flicking("#el");
|
|
14298
|
+
* const reactiveObj = connectFlickingReactiveAPI(flicking);
|
|
14299
|
+
*
|
|
14300
|
+
* // Access reactive state
|
|
14301
|
+
* console.log("Current panel:", reactiveObj.currentPanelIndex);
|
|
14302
|
+
* console.log("Progress:", reactiveObj.progress + "%");
|
|
14303
|
+
* console.log("Is at start:", reactiveObj.isReachStart);
|
|
14304
|
+
* console.log("Is at end:", reactiveObj.isReachEnd);
|
|
14305
|
+
* console.log("Total panels:", reactiveObj.totalPanelCount);
|
|
14306
|
+
* console.log("Index progress:", reactiveObj.indexProgress);
|
|
14307
|
+
*
|
|
14308
|
+
* // Subscribe to state changes
|
|
14309
|
+
* reactiveObj.subscribe("currentPanelIndex", (nextValue) => {
|
|
14310
|
+
* console.log("Panel changed to:", nextValue);
|
|
14311
|
+
* });
|
|
14312
|
+
*
|
|
14313
|
+
* // Use reactive methods
|
|
14314
|
+
* reactiveObj.moveTo(2); // Move to third panel
|
|
14315
|
+
* ```
|
|
14316
|
+
*/
|
|
14317
|
+
var connectFlickingReactiveAPI = function (flicking, options) {
|
|
14318
|
+
var obj = adaptReactive(flickingReactiveAPIAdapter, function () {
|
|
14319
|
+
return {
|
|
14320
|
+
flicking: flicking,
|
|
14321
|
+
options: options
|
|
14322
|
+
};
|
|
14323
|
+
});
|
|
14324
|
+
obj.mounted();
|
|
14325
|
+
var instance = obj.instance();
|
|
14326
|
+
obj.init();
|
|
14327
|
+
return instance;
|
|
14328
|
+
};
|
|
14329
|
+
|
|
14330
|
+
var FlickingReactiveAPI = {
|
|
14331
|
+
__proto__: null,
|
|
14332
|
+
flickingReactiveAPIAdapter: flickingReactiveAPIAdapter,
|
|
14333
|
+
connectFlickingReactiveAPI: connectFlickingReactiveAPI
|
|
14334
|
+
};
|
|
14335
|
+
|
|
13659
14336
|
/*
|
|
13660
14337
|
* Copyright (c) 2015 NAVER Corp.
|
|
13661
14338
|
* egjs projects are licensed under the MIT license
|
|
@@ -13668,6 +14345,7 @@ version: 4.13.2-beta.0
|
|
|
13668
14345
|
merge(Flicking, CFC);
|
|
13669
14346
|
merge(Flicking, Utils);
|
|
13670
14347
|
merge(Flicking, CrossFlicking$1);
|
|
14348
|
+
merge(Flicking, FlickingReactiveAPI);
|
|
13671
14349
|
|
|
13672
14350
|
return Flicking;
|
|
13673
14351
|
|