@egjs/flicking 4.14.2-beta.1 → 4.14.2-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.14.2-beta.1",
3
+ "version": "4.14.2-beta.2",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.cjs.js",
6
6
  "module": "dist/flicking.esm.js",
package/src/Flicking.ts CHANGED
@@ -119,7 +119,7 @@ export interface FlickingOptions {
119
119
  threshold: number;
120
120
  dragThreshold: number;
121
121
  animationThreshold: number;
122
- useCSSOrderProperty: boolean;
122
+ useCSSOrder: boolean;
123
123
  interruptable: boolean;
124
124
  bounce: number | string | [number | string, number | string];
125
125
  iOSEdgeSwipeThreshold: number;
@@ -203,7 +203,7 @@ class Flicking extends Component<FlickingEvents> {
203
203
  private _threshold: FlickingOptions["threshold"];
204
204
  private _dragThreshold: FlickingOptions["dragThreshold"];
205
205
  private _animationThreshold: FlickingOptions["animationThreshold"];
206
- private _useCSSOrderProperty: FlickingOptions["useCSSOrderProperty"];
206
+ private _useCSSOrder: FlickingOptions["useCSSOrder"];
207
207
 
208
208
  private _interruptable: FlickingOptions["interruptable"];
209
209
  private _bounce: FlickingOptions["bounce"];
@@ -230,6 +230,7 @@ class Flicking extends Component<FlickingEvents> {
230
230
  private _initialized: boolean;
231
231
  private _plugins: Plugin[];
232
232
  private _isResizing: boolean;
233
+ private _scheduleResize = false;
233
234
 
234
235
  // Components
235
236
  /**
@@ -719,17 +720,18 @@ class Flicking extends Component<FlickingEvents> {
719
720
  return this._animationThreshold;
720
721
  }
721
722
  /**
722
- * When `circular` is used, the DOM order changes depending on the position. Using `useCSSOrderProperty` does not change the DOM order, but the `order` CSS property changes the order on the screen.
723
+ * Using `useCSSOrder` does not change the DOM order, but the `order` CSS property changes the order on the screen. (When `circular` is used, the DOM order changes depending on the position.)
723
724
  * When using `iframe`, you can prevent reloading when the DOM order changes.
724
- * @ko `circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다. `useCSSOrderProperty`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다.
725
+ * In svelte, CSS order is always used.
726
+ * @ko `useCSSOrder`를 사용하면 DOM의 순서는 변경되지 않지만 `order` css가 설정되면서 화면상 순서가 바뀐다. (`circular`를 사용한 경우 위치에 따라 DOM의 순서가 변경된다.)
725
727
  * `iframe`을 사용하는 경우 DOM의 순서가 변경되면서 reload가 되는 것을 막을 수 있다.
728
+ * svelte에서는 css order를 무조건 사용한다.
726
729
  * @type {boolean}
727
- * @requires `circular`
728
730
  * @default false
729
- * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrderProperty animationThreshold ( Options )}
731
+ * @see {@link https://naver.github.io/egjs-flicking/Options#useCSSOrder useCSSOrder ( Options )}
730
732
  */
731
- public get useCSSOrderProperty() {
732
- return this._useCSSOrderProperty;
733
+ public get useCSSOrder() {
734
+ return this._useCSSOrder;
733
735
  }
734
736
 
735
737
  /**
@@ -1148,8 +1150,8 @@ class Flicking extends Component<FlickingEvents> {
1148
1150
  public set animationThreshold(val: FlickingOptions["animationThreshold"]) {
1149
1151
  this._animationThreshold = val;
1150
1152
  }
1151
- public set useCSSOrderProperty(val: FlickingOptions["useCSSOrderProperty"]) {
1152
- this._useCSSOrderProperty = val;
1153
+ public set useCSSOrder(val: FlickingOptions["useCSSOrder"]) {
1154
+ this._useCSSOrder = val;
1153
1155
  }
1154
1156
 
1155
1157
  public set interruptable(val: FlickingOptions["interruptable"]) {
@@ -1327,7 +1329,7 @@ class Flicking extends Component<FlickingEvents> {
1327
1329
  renderExternal = null,
1328
1330
  optimizeSizeUpdate = false,
1329
1331
  animationThreshold = 0.5,
1330
- useCSSOrderProperty = false,
1332
+ useCSSOrder = false,
1331
1333
  }: Partial<FlickingOptions> = {}) {
1332
1334
  super();
1333
1335
 
@@ -1377,7 +1379,7 @@ class Flicking extends Component<FlickingEvents> {
1377
1379
  this._renderExternal = renderExternal;
1378
1380
  this._optimizeSizeUpdate = optimizeSizeUpdate;
1379
1381
  this._animationThreshold = animationThreshold;
1380
- this._useCSSOrderProperty = useCSSOrderProperty;
1382
+ this._useCSSOrder = useCSSOrder;
1381
1383
 
1382
1384
  // Create core components
1383
1385
  this._viewport = new Viewport(this, getElement(root));
@@ -1461,7 +1463,9 @@ class Flicking extends Component<FlickingEvents> {
1461
1463
 
1462
1464
  this._plugins.forEach((plugin) => plugin.destroy());
1463
1465
 
1466
+ this._scheduleResize = false;
1464
1467
  this._initialized = false;
1468
+ this._isResizing = false;
1465
1469
  }
1466
1470
 
1467
1471
  /**
@@ -1859,11 +1863,17 @@ class Flicking extends Component<FlickingEvents> {
1859
1863
  * @method
1860
1864
  * @fires Flicking#beforeResize
1861
1865
  * @fires Flicking#afterResize
1862
- * @return {this}
1866
+ * @return {boolean}
1863
1867
  */
1864
1868
  public async resize(): Promise<void> {
1865
- if (this._isResizing) return;
1866
-
1869
+ if (!this._initialized) {
1870
+ return;
1871
+ }
1872
+ if (this._isResizing) {
1873
+ this._scheduleResize = true;
1874
+ return;
1875
+ }
1876
+ this._scheduleResize = false;
1867
1877
  this._isResizing = true;
1868
1878
 
1869
1879
  const viewport = this._viewport;
@@ -1910,6 +1920,7 @@ class Flicking extends Component<FlickingEvents> {
1910
1920
  camera.updatePanelOrder();
1911
1921
  camera.updateOffset();
1912
1922
  await renderer.render();
1923
+
1913
1924
  if (!this._initialized) {
1914
1925
  return;
1915
1926
  }
@@ -1939,6 +1950,11 @@ class Flicking extends Component<FlickingEvents> {
1939
1950
  );
1940
1951
 
1941
1952
  this._isResizing = false;
1953
+
1954
+ if (this._scheduleResize) {
1955
+ this.resize();
1956
+ }
1957
+ return;
1942
1958
  }
1943
1959
 
1944
1960
  /**
@@ -2136,8 +2152,8 @@ class Flicking extends Component<FlickingEvents> {
2136
2152
  const nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
2137
2153
  const initialPanel =
2138
2154
  nearestAnchor &&
2139
- defaultPanel.position !== nearestAnchor.panel.position &&
2140
- defaultPanel.index !== nearestAnchor.panel.index
2155
+ defaultPanel.position !== nearestAnchor.panel.position &&
2156
+ defaultPanel.index !== nearestAnchor.panel.index
2141
2157
  ? nearestAnchor.panel
2142
2158
  : defaultPanel;
2143
2159
  control.setActive(initialPanel, null, false);
@@ -16,8 +16,8 @@ export default <T>(flicking: Flicking, diffResult: DiffResult<T>) => {
16
16
  .filter(panel => !removedPanels[panel.index]);
17
17
 
18
18
 
19
- if (!flicking.useCSSOrderProperty) {
20
- // useCSSOrderProperty를 사용하게 되는 경우 sort를 하지 않는다.
19
+ if (!flicking.useCSSOrder) {
20
+ // useCSSOrder를 사용하게 되는 경우 sort를 하지 않는다.
21
21
  renderingPanels.sort((panel1, panel2) => (panel1.position + panel1.offset) - (panel2.position + panel2.offset));
22
22
  }
23
23
 
@@ -566,8 +566,8 @@ abstract class Renderer {
566
566
 
567
567
  flicking.camera.applyTransform();
568
568
 
569
- if (flicking.useCSSOrderProperty) {
570
- // useCSSOrderProperty를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
569
+ if (flicking.useCSSOrder) {
570
+ // useCSSOrder를 사용하는 경우 DOM은 변화가 없지만 대신 CSS Order가 추가 된다.
571
571
  const panels = flicking.panels;
572
572
 
573
573
  this._strategy.getRenderingIndexesByOrder(flicking).forEach((domIndex, index) => {
@@ -43,8 +43,8 @@ class VanillaRenderer extends Renderer {
43
43
 
44
44
  let reversedElements: HTMLElement[] = [];
45
45
 
46
- if (flicking.useCSSOrderProperty) {
47
- // useCSSOrderProperty를 사용하는 경우 원본 그대로 렌더링
46
+ if (flicking.useCSSOrder) {
47
+ // useCSSOrder를 사용하는 경우 원본 그대로 렌더링
48
48
  reversedElements = this.getRenderedPanels().map(panel => panel.element).reverse();
49
49
  } else {
50
50
  reversedElements = this._strategy