@egjs/flicking 4.12.0-beta.9 → 4.12.1-beta.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.
Files changed (84) hide show
  1. package/declaration/CrossFlicking.d.ts +89 -76
  2. package/declaration/Flicking.d.ts +244 -244
  3. package/declaration/camera/Camera.d.ts +90 -90
  4. package/declaration/camera/index.d.ts +4 -4
  5. package/declaration/camera/mode/BoundCameraMode.d.ts +13 -13
  6. package/declaration/camera/mode/CameraMode.d.ts +20 -20
  7. package/declaration/camera/mode/CircularCameraMode.d.ts +19 -19
  8. package/declaration/camera/mode/LinearCameraMode.d.ts +9 -9
  9. package/declaration/camera/mode/index.d.ts +6 -6
  10. package/declaration/cfc/getDefaultCameraTransform.d.ts +3 -3
  11. package/declaration/cfc/getRenderingPanels.d.ts +4 -4
  12. package/declaration/cfc/index.d.ts +5 -5
  13. package/declaration/cfc/sync.d.ts +4 -4
  14. package/declaration/cfc/withFlickingMethods.d.ts +2 -2
  15. package/declaration/const/axes.d.ts +8 -8
  16. package/declaration/const/error.d.ts +34 -34
  17. package/declaration/const/external.d.ts +54 -54
  18. package/declaration/control/AxesController.d.ts +44 -44
  19. package/declaration/control/Control.d.ts +45 -45
  20. package/declaration/control/FreeControl.d.ts +14 -14
  21. package/declaration/control/SnapControl.d.ts +16 -16
  22. package/declaration/control/StateMachine.d.ts +14 -14
  23. package/declaration/control/StrictControl.d.ts +20 -20
  24. package/declaration/control/index.d.ts +14 -14
  25. package/declaration/control/states/AnimatingState.d.ts +9 -9
  26. package/declaration/control/states/DisabledState.d.ts +9 -9
  27. package/declaration/control/states/DraggingState.d.ts +8 -8
  28. package/declaration/control/states/HoldingState.d.ts +10 -10
  29. package/declaration/control/states/IdleState.d.ts +9 -9
  30. package/declaration/control/states/State.d.ts +47 -47
  31. package/declaration/core/AnchorPoint.d.ts +15 -15
  32. package/declaration/core/AutoResizer.d.ts +16 -16
  33. package/declaration/core/FlickingError.d.ts +5 -5
  34. package/declaration/core/ResizeWatcher.d.ts +33 -33
  35. package/declaration/core/Viewport.d.ts +25 -25
  36. package/declaration/core/VirtualManager.d.ts +37 -37
  37. package/declaration/core/index.d.ts +6 -6
  38. package/declaration/core/panel/Panel.d.ts +89 -89
  39. package/declaration/core/panel/VirtualPanel.d.ts +19 -19
  40. package/declaration/core/panel/index.d.ts +5 -5
  41. package/declaration/core/panel/provider/ElementProvider.d.ts +8 -8
  42. package/declaration/core/panel/provider/VanillaElementProvider.d.ts +12 -12
  43. package/declaration/core/panel/provider/VirtualElementProvider.d.ts +15 -15
  44. package/declaration/core/panel/provider/index.d.ts +5 -5
  45. package/declaration/index.cjs.d.ts +3 -3
  46. package/declaration/index.d.ts +15 -15
  47. package/declaration/index.umd.d.ts +2 -2
  48. package/declaration/renderer/ExternalRenderer.d.ts +7 -7
  49. package/declaration/renderer/Renderer.d.ts +59 -59
  50. package/declaration/renderer/VanillaRenderer.d.ts +10 -10
  51. package/declaration/renderer/index.d.ts +6 -6
  52. package/declaration/renderer/strategy/NormalRenderingStrategy.d.ts +23 -23
  53. package/declaration/renderer/strategy/RenderingStrategy.d.ts +15 -15
  54. package/declaration/renderer/strategy/VirtualRenderingStrategy.d.ts +17 -17
  55. package/declaration/renderer/strategy/index.d.ts +5 -5
  56. package/declaration/type/event.d.ts +88 -88
  57. package/declaration/type/external.d.ts +31 -31
  58. package/declaration/type/internal.d.ts +13 -13
  59. package/declaration/utils.d.ts +47 -47
  60. package/dist/flicking-inline.css +37 -0
  61. package/dist/flicking-inline.min.css +1 -0
  62. package/dist/flicking-inline.min.min.css +1 -0
  63. package/dist/flicking.cjs.js +36 -6
  64. package/dist/flicking.cjs.js.map +1 -1
  65. package/dist/flicking.css +40 -0
  66. package/dist/flicking.esm.js +36 -6
  67. package/dist/flicking.esm.js.map +1 -1
  68. package/dist/flicking.js +36 -6
  69. package/dist/flicking.js.map +1 -1
  70. package/dist/flicking.min.css +1 -0
  71. package/dist/flicking.min.js +2 -2
  72. package/dist/flicking.min.js.map +1 -1
  73. package/dist/flicking.min.min.css +1 -0
  74. package/dist/flicking.pkgd.js +786 -756
  75. package/dist/flicking.pkgd.js.map +1 -1
  76. package/dist/flicking.pkgd.min.js +2 -2
  77. package/dist/flicking.pkgd.min.js.map +1 -1
  78. package/package.json +5 -6
  79. package/src/CrossFlicking.ts +32 -4
  80. package/src/Flicking.ts +1 -1
  81. package/src/control/SnapControl.ts +3 -1
  82. package/src/control/states/HoldingState.ts +4 -0
  83. package/src/core/panel/Panel.ts +4 -0
  84. package/src/utils.ts +4 -0
@@ -1,47 +1,47 @@
1
- import Flicking, { FlickingOptions } from "./Flicking";
2
- import { ALIGN, DIRECTION } from "./const/external";
3
- import { LiteralUnion, Merged, ValueOf } from "./type/internal";
4
- import { ElementLike } from "./type/external";
5
- export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>;
6
- export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement) => HTMLElement;
7
- export declare const checkExistence: (value: any, nameOnErrMsg: string) => void;
8
- export declare const clamp: (x: number, min: number, max: number) => number;
9
- export declare const getFlickingAttached: (val: Flicking | null) => Flicking;
10
- export declare const toArray: <T>(iterable: ArrayLike<T>) => T[];
11
- export declare const parseAlign: (align: LiteralUnion<ValueOf<typeof ALIGN>> | number, size: number) => number;
12
- export declare const parseBounce: (bounce: FlickingOptions["bounce"], size: number) => number[];
13
- export declare const parseArithmeticSize: (cssValue: number | string, base: number) => number | null;
14
- export declare const parseArithmeticExpression: (cssValue: number | string) => {
15
- percentage: number;
16
- absolute: number;
17
- } | null;
18
- export declare const parseCSSSizeValue: (val: string | number) => string;
19
- export declare const parsePanelAlign: (align: FlickingOptions["align"]) => string | number;
20
- export declare const getDirection: (start: number, end: number) => ValueOf<typeof DIRECTION>;
21
- export declare const parseElement: (element: ElementLike | ElementLike[]) => HTMLElement[];
22
- export declare const getMinusCompensatedIndex: (idx: number, max: number) => number;
23
- export declare const includes: <T>(array: T[], target: any) => target is T;
24
- export declare const isString: (val: any) => val is string;
25
- export declare const circulatePosition: (pos: number, min: number, max: number) => number;
26
- export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T;
27
- export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T;
28
- export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number;
29
- export declare const getProgress: (pos: number, prev: number, next: number) => number;
30
- export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration;
31
- export declare const setSize: (el: HTMLElement, { width, height }: Partial<{
32
- width: number | string;
33
- height: number | string;
34
- }>) => void;
35
- export declare const isBetween: (val: number, min: number, max: number) => boolean;
36
- export declare const circulateIndex: (index: number, max: number) => number;
37
- export declare const range: (end: number) => number[];
38
- export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOffset, style }: {
39
- el: HTMLElement;
40
- horizontal: boolean;
41
- useFractionalSize: boolean;
42
- useOffset: boolean;
43
- style: CSSStyleDeclaration;
44
- }) => number;
45
- export declare const setPrototypeOf: (o: any, proto: object) => any;
46
- export declare const camelize: (str: string) => string;
47
- export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;
1
+ import Flicking, { FlickingOptions } from "./Flicking";
2
+ import { ALIGN, DIRECTION } from "./const/external";
3
+ import { LiteralUnion, Merged, ValueOf } from "./type/internal";
4
+ import { ElementLike } from "./type/external";
5
+ export declare const merge: <From extends object, To extends object>(target: From, ...sources: To[]) => Merged<From, To>;
6
+ export declare const getElement: (el: HTMLElement | string | null, parent?: HTMLElement) => HTMLElement;
7
+ export declare const checkExistence: (value: any, nameOnErrMsg: string) => void;
8
+ export declare const clamp: (x: number, min: number, max: number) => number;
9
+ export declare const getFlickingAttached: (val: Flicking | null) => Flicking;
10
+ export declare const toArray: <T>(iterable: ArrayLike<T>) => T[];
11
+ export declare const parseAlign: (align: LiteralUnion<ValueOf<typeof ALIGN>> | number, size: number) => number;
12
+ export declare const parseBounce: (bounce: FlickingOptions["bounce"], size: number) => number[];
13
+ export declare const parseArithmeticSize: (cssValue: number | string, base: number) => number | null;
14
+ export declare const parseArithmeticExpression: (cssValue: number | string) => {
15
+ percentage: number;
16
+ absolute: number;
17
+ } | null;
18
+ export declare const parseCSSSizeValue: (val: string | number) => string;
19
+ export declare const parsePanelAlign: (align: FlickingOptions["align"]) => string | number;
20
+ export declare const getDirection: (start: number, end: number) => ValueOf<typeof DIRECTION>;
21
+ export declare const parseElement: (element: ElementLike | ElementLike[]) => HTMLElement[];
22
+ export declare const getMinusCompensatedIndex: (idx: number, max: number) => number;
23
+ export declare const includes: <T>(array: T[], target: any) => target is T;
24
+ export declare const isString: (val: any) => val is string;
25
+ export declare const circulatePosition: (pos: number, min: number, max: number) => number;
26
+ export declare const find: <T>(array: T[], checker: (val: T) => boolean) => T;
27
+ export declare const findRight: <T>(array: T[], checker: (val: T) => boolean) => T;
28
+ export declare const findIndex: <T>(array: T[], checker: (val: T) => boolean) => number;
29
+ export declare const getProgress: (pos: number, prev: number, next: number) => number;
30
+ export declare const getStyle: (el: HTMLElement) => CSSStyleDeclaration;
31
+ export declare const setSize: (el: HTMLElement, { width, height }: Partial<{
32
+ width: number | string;
33
+ height: number | string;
34
+ }>) => void;
35
+ export declare const isBetween: (val: number, min: number, max: number) => boolean;
36
+ export declare const circulateIndex: (index: number, max: number) => number;
37
+ export declare const range: (end: number) => number[];
38
+ export declare const getElementSize: ({ el, horizontal, useFractionalSize, useOffset, style }: {
39
+ el: HTMLElement;
40
+ horizontal: boolean;
41
+ useFractionalSize: boolean;
42
+ useOffset: boolean;
43
+ style: CSSStyleDeclaration;
44
+ }) => number;
45
+ export declare const setPrototypeOf: (o: any, proto: object) => any;
46
+ export declare const camelize: (str: string) => string;
47
+ export declare const getDataAttributes: (element: HTMLElement, attributePrefix: string) => Record<string, string>;
@@ -0,0 +1,37 @@
1
+ .flicking-viewport {
2
+ position: relative;
3
+ overflow: hidden;
4
+ }
5
+ .flicking-viewport:not(.vertical) {
6
+ width: 100%;
7
+ height: 100%;
8
+ }
9
+ .flicking-viewport.vertical, .flicking-viewport.vertical > .flicking-camera {
10
+ display: inline-block;
11
+ }
12
+ .flicking-viewport.vertical.middle > .flicking-camera > * {
13
+ vertical-align: middle;
14
+ }
15
+ .flicking-viewport.vertical.bottom > .flicking-camera > * {
16
+ vertical-align: bottom;
17
+ }
18
+ .flicking-viewport.vertical > .flicking-camera > * {
19
+ display: block;
20
+ }
21
+ .flicking-viewport.flicking-hidden > .flicking-camera > * {
22
+ visibility: hidden;
23
+ }
24
+
25
+ .flicking-camera {
26
+ width: 100%;
27
+ height: 100%;
28
+ position: relative;
29
+ z-index: 1;
30
+ white-space: nowrap;
31
+ will-change: transform;
32
+ }
33
+ .flicking-camera > * {
34
+ display: inline-block;
35
+ white-space: normal;
36
+ vertical-align: top;
37
+ }
@@ -0,0 +1 @@
1
+ .flicking-viewport{position:relative;overflow:hidden}.flicking-viewport:not(.vertical){width:100%;height:100%}.flicking-viewport.vertical,.flicking-viewport.vertical>.flicking-camera{display:inline-block}.flicking-viewport.vertical.middle>.flicking-camera>*{vertical-align:middle}.flicking-viewport.vertical.bottom>.flicking-camera>*{vertical-align:bottom}.flicking-viewport.vertical>.flicking-camera>*{display:block}.flicking-viewport.flicking-hidden>.flicking-camera>*{visibility:hidden}.flicking-camera{width:100%;height:100%;position:relative;z-index:1;white-space:nowrap;will-change:transform}.flicking-camera>*{display:inline-block;white-space:normal;vertical-align:top}
@@ -0,0 +1 @@
1
+ .flicking-viewport{position:relative;overflow:hidden}.flicking-viewport:not(.vertical){width:100%;height:100%}.flicking-viewport.vertical,.flicking-viewport.vertical>.flicking-camera{display:inline-block}.flicking-viewport.vertical.middle>.flicking-camera>*{vertical-align:middle}.flicking-viewport.vertical.bottom>.flicking-camera>*{vertical-align:bottom}.flicking-viewport.vertical>.flicking-camera>*{display:block}.flicking-viewport.flicking-hidden>.flicking-camera>*{visibility:hidden}.flicking-camera{width:100%;height:100%;position:relative;z-index:1;white-space:nowrap;will-change:transform}.flicking-camera>*{display:inline-block;white-space:normal;vertical-align:top}
@@ -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.12.0-beta.9
7
+ version: 4.12.1-beta.0
8
8
  */
9
9
  'use strict';
10
10
 
@@ -679,6 +679,9 @@ var getStyle = function (el) {
679
679
  var setSize = function (el, _a) {
680
680
  var width = _a.width,
681
681
  height = _a.height;
682
+ if (!el) {
683
+ return;
684
+ }
682
685
  if (width != null) {
683
686
  if (isString(width)) {
684
687
  el.style.width = width;
@@ -1592,6 +1595,9 @@ var HoldingState = /*#__PURE__*/function (_super) {
1592
1595
  axesEvent = ctx.axesEvent,
1593
1596
  transitTo = ctx.transitTo;
1594
1597
  var inputEvent = axesEvent.inputEvent;
1598
+ if (!inputEvent) {
1599
+ return;
1600
+ }
1595
1601
  var offset = flicking.horizontal ? inputEvent.offsetX : inputEvent.offsetY;
1596
1602
  var moveStartEvent = new Component.ComponentEvent(EVENTS.MOVE_START, {
1597
1603
  isTrusted: axesEvent.isTrusted,
@@ -2909,8 +2915,9 @@ var SnapControl = /*#__PURE__*/function (_super) {
2909
2915
  if (snapDelta >= snapThreshold && snapDelta > 0) {
2910
2916
  // Move to anchor at position
2911
2917
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
2912
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
2918
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
2913
2919
  // Move to the adjacent panel
2920
+ // console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
2914
2921
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
2915
2922
  } else {
2916
2923
  // Fallback to nearest panel from current camera
@@ -2985,6 +2992,7 @@ var SnapControl = /*#__PURE__*/function (_super) {
2985
2992
  return anchorIncludePosition;
2986
2993
  }
2987
2994
  }
2995
+ // console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
2988
2996
  var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
2989
2997
  return adjacentAnchor;
2990
2998
  };
@@ -5451,6 +5459,9 @@ var Panel = /*#__PURE__*/function () {
5451
5459
  var flicking = this._flicking;
5452
5460
  var horizontal = flicking.horizontal,
5453
5461
  useFractionalSize = flicking.useFractionalSize;
5462
+ if (!el) {
5463
+ return this;
5464
+ }
5454
5465
  if (cached) {
5455
5466
  this._size = cached.size;
5456
5467
  this._margin = __assign({}, cached.margin);
@@ -7858,7 +7869,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7858
7869
  var defaultPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
7859
7870
  if (!defaultPanel) return;
7860
7871
  var nearestAnchor = camera.findNearestAnchor(defaultPanel.position);
7861
- var initialPanel = nearestAnchor && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7872
+ var initialPanel = nearestAnchor && defaultPanel.position !== nearestAnchor.panel.position && defaultPanel.index !== nearestAnchor.panel.index ? nearestAnchor.panel : defaultPanel;
7862
7873
  control.setActive(initialPanel, null, false);
7863
7874
  if (!nearestAnchor) {
7864
7875
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
@@ -7912,7 +7923,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7912
7923
  * Flicking.VERSION; // ex) 4.0.0
7913
7924
  * ```
7914
7925
  */
7915
- Flicking.VERSION = "4.12.0-beta.9";
7926
+ Flicking.VERSION = "4.12.1-beta.0";
7916
7927
  return Flicking;
7917
7928
  }(Component);
7918
7929
 
@@ -7923,7 +7934,9 @@ var SIDE_EVENTS = {
7923
7934
  MOVE: "sideMove",
7924
7935
  MOVE_END: "sideMoveEnd",
7925
7936
  WILL_CHANGE: "sideWillChange",
7926
- CHANGED: "sideChanged"
7937
+ CHANGED: "sideChanged",
7938
+ WILL_RESTORE: "sideWillRestore",
7939
+ RESTORED: "sideRestored"
7927
7940
  };
7928
7941
  var CrossFlicking = /*#__PURE__*/function (_super) {
7929
7942
  __extends(CrossFlicking, _super);
@@ -7949,7 +7962,8 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
7949
7962
  if (!_this._disableSlideOnHold) {
7950
7963
  return;
7951
7964
  }
7952
- var threshold = draggable ? _this.dragThreshold && _this.dragThreshold >= 10 ? _this.dragThreshold : 10 : Infinity;
7965
+ var dragThreshold = _this._originalDragThreshold;
7966
+ var threshold = draggable ? dragThreshold && dragThreshold >= 10 ? dragThreshold : 10 : Infinity;
7953
7967
  if (direction === MOVE_DIRECTION.HORIZONTAL === _this.horizontal) {
7954
7968
  _this.dragThreshold = threshold;
7955
7969
  } else if (direction === MOVE_DIRECTION.VERTICAL === _this.horizontal) {
@@ -7980,6 +7994,9 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
7980
7994
  }
7981
7995
  });
7982
7996
  };
7997
+ _this._addSideIndex = function (e) {
7998
+ e.sideIndex = _this._sideFlicking[e.index].index;
7999
+ };
7983
8000
  _this._onHorizontalHoldStart = function () {
7984
8001
  _this._setDraggable(MOVE_DIRECTION.HORIZONTAL, true);
7985
8002
  _this._moveDirection = null;
@@ -8039,6 +8056,7 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8039
8056
  // Internal states
8040
8057
  _this._moveDirection = null;
8041
8058
  _this._nextIndex = 0;
8059
+ _this._originalDragThreshold = _this.dragThreshold;
8042
8060
  // Bind options
8043
8061
  _this._sideOptions = sideOptions;
8044
8062
  _this._preserveIndex = preserveIndex;
@@ -8055,6 +8073,15 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8055
8073
  enumerable: false,
8056
8074
  configurable: true
8057
8075
  });
8076
+ Object.defineProperty(__proto, "sideIndex", {
8077
+ get: function () {
8078
+ return this._sideFlicking.map(function (i) {
8079
+ return i.index;
8080
+ });
8081
+ },
8082
+ enumerable: false,
8083
+ configurable: true
8084
+ });
8058
8085
  Object.defineProperty(__proto, "sideState", {
8059
8086
  get: function () {
8060
8087
  return this._sideState;
@@ -8123,6 +8150,9 @@ var CrossFlicking = /*#__PURE__*/function (_super) {
8123
8150
  this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
8124
8151
  this.on(EVENTS.MOVE, this._onHorizontalMove);
8125
8152
  this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
8153
+ [EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach(function (event) {
8154
+ _this.on(event, _this._addSideIndex);
8155
+ });
8126
8156
  this._sideFlicking.forEach(function (flicking, mainIndex) {
8127
8157
  flicking.on(EVENTS.HOLD_START, _this._onSideHoldStart);
8128
8158
  flicking.on(EVENTS.MOVE, _this._onSideMove);