@egjs/flicking 4.14.2-beta.2 → 4.16.0-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 (185) hide show
  1. package/README.md +6 -175
  2. package/{declaration → dist}/CrossFlicking.d.ts +7 -2
  3. package/dist/Flicking.d.ts +1231 -0
  4. package/dist/camera/Camera.d.ts +324 -0
  5. package/{declaration → dist}/camera/mode/BoundCameraMode.d.ts +5 -4
  6. package/{declaration → dist}/camera/mode/CameraMode.d.ts +7 -6
  7. package/{declaration → dist}/camera/mode/CircularCameraMode.d.ts +9 -5
  8. package/{declaration → dist}/camera/mode/LinearCameraMode.d.ts +2 -4
  9. package/{declaration → dist}/cfc/getDefaultCameraTransform.d.ts +1 -1
  10. package/dist/cfc/withFlickingMethods.d.ts +15 -0
  11. package/{declaration/const/axes.d.ts → dist/constants/internal.d.ts} +8 -0
  12. package/dist/constants/values.d.ts +67 -0
  13. package/dist/control/AxesController.d.ts +186 -0
  14. package/dist/control/Control.d.ts +185 -0
  15. package/dist/control/FreeControl.d.ts +44 -0
  16. package/dist/control/SnapControl.d.ts +54 -0
  17. package/{declaration → dist}/control/StateMachine.d.ts +3 -0
  18. package/dist/control/StrictControl.d.ts +60 -0
  19. package/{declaration → dist}/control/states/AnimatingState.d.ts +12 -0
  20. package/{declaration → dist}/control/states/DisabledState.d.ts +12 -0
  21. package/{declaration → dist}/control/states/DraggingState.d.ts +12 -0
  22. package/{declaration → dist}/control/states/HoldingState.d.ts +12 -0
  23. package/{declaration → dist}/control/states/IdleState.d.ts +12 -0
  24. package/dist/control/states/State.d.ts +86 -0
  25. package/dist/core/AnchorPoint.d.ts +40 -0
  26. package/{declaration → dist}/core/AutoResizer.d.ts +6 -0
  27. package/dist/core/Viewport.d.ts +60 -0
  28. package/dist/core/VirtualManager.d.ts +84 -0
  29. package/dist/core/index.d.ts +6 -0
  30. package/dist/core/panel/Panel.d.ts +298 -0
  31. package/dist/core/panel/VirtualPanel.d.ts +41 -0
  32. package/dist/core/panel/index.d.ts +5 -0
  33. package/{declaration → dist}/core/panel/provider/VanillaElementProvider.d.ts +3 -0
  34. package/{declaration → dist}/core/panel/provider/VirtualElementProvider.d.ts +3 -0
  35. package/dist/error/FlickingError.d.ts +25 -0
  36. package/dist/error/codes.d.ts +79 -0
  37. package/dist/error/groups.d.ts +94 -0
  38. package/dist/error/index.d.ts +4 -0
  39. package/dist/error/types.d.ts +516 -0
  40. package/dist/event/groups.d.ts +40 -0
  41. package/dist/event/index.d.ts +3 -0
  42. package/dist/event/names.d.ts +47 -0
  43. package/dist/event/types.d.ts +318 -0
  44. package/dist/flicking.cjs.js +5560 -7784
  45. package/dist/flicking.cjs.js.map +1 -1
  46. package/dist/flicking.esm.js +5638 -7692
  47. package/dist/flicking.esm.js.map +1 -1
  48. package/dist/flicking.js +6722 -8885
  49. package/dist/flicking.js.map +1 -1
  50. package/dist/flicking.min.js +1 -9
  51. package/dist/flicking.min.js.map +1 -1
  52. package/dist/flicking.pkgd.js +9661 -14078
  53. package/dist/flicking.pkgd.js.map +1 -1
  54. package/dist/flicking.pkgd.min.js +1 -9
  55. package/dist/flicking.pkgd.min.js.map +1 -1
  56. package/dist/index.d.ts +16 -0
  57. package/dist/reactive/index.d.ts +126 -0
  58. package/{declaration → dist}/renderer/ExternalRenderer.d.ts +3 -0
  59. package/dist/renderer/Renderer.d.ts +215 -0
  60. package/{declaration → dist}/renderer/VanillaRenderer.d.ts +6 -0
  61. package/{declaration → dist}/renderer/strategy/NormalRenderingStrategy.d.ts +5 -2
  62. package/{declaration → dist}/renderer/strategy/RenderingStrategy.d.ts +4 -1
  63. package/dist/types/external.d.ts +58 -0
  64. package/dist/types/params.d.ts +10 -0
  65. package/{declaration → dist}/utils.d.ts +7 -7
  66. package/package.json +35 -162
  67. package/src/CrossFlicking.ts +68 -96
  68. package/src/Flicking.ts +1055 -972
  69. package/src/camera/Camera.ts +217 -206
  70. package/src/camera/index.ts +2 -6
  71. package/src/camera/mode/BoundCameraMode.ts +38 -27
  72. package/src/camera/mode/CameraMode.ts +14 -12
  73. package/src/camera/mode/CircularCameraMode.ts +24 -16
  74. package/src/camera/mode/LinearCameraMode.ts +3 -1
  75. package/src/camera/mode/index.ts +4 -10
  76. package/src/cfc/getDefaultCameraTransform.ts +9 -11
  77. package/src/cfc/getRenderingPanels.ts +2 -5
  78. package/src/cfc/index.ts +4 -9
  79. package/src/cfc/sync.ts +11 -5
  80. package/src/cfc/withFlickingMethods.ts +6 -7
  81. package/src/{const/axes.ts → constants/internal.ts} +1 -0
  82. package/src/constants/values.ts +78 -0
  83. package/src/control/AxesController.ts +119 -110
  84. package/src/control/Control.ts +147 -180
  85. package/src/control/FreeControl.ts +36 -60
  86. package/src/control/SnapControl.ts +64 -68
  87. package/src/control/StateMachine.ts +14 -11
  88. package/src/control/StrictControl.ts +58 -73
  89. package/src/control/index.ts +9 -12
  90. package/src/control/states/AnimatingState.ts +8 -11
  91. package/src/control/states/DisabledState.ts +0 -5
  92. package/src/control/states/DraggingState.ts +8 -12
  93. package/src/control/states/HoldingState.ts +10 -15
  94. package/src/control/states/IdleState.ts +1 -6
  95. package/src/control/states/State.ts +46 -85
  96. package/src/core/AnchorPoint.ts +25 -23
  97. package/src/core/AutoResizer.ts +6 -15
  98. package/src/core/ResizeWatcher.ts +17 -16
  99. package/src/core/Viewport.ts +35 -46
  100. package/src/core/VirtualManager.ts +48 -36
  101. package/src/core/index.ts +6 -9
  102. package/src/core/panel/Panel.ts +190 -185
  103. package/src/core/panel/VirtualPanel.ts +17 -21
  104. package/src/core/panel/index.ts +4 -9
  105. package/src/core/panel/provider/VanillaElementProvider.ts +6 -2
  106. package/src/core/panel/provider/VirtualElementProvider.ts +6 -2
  107. package/src/core/panel/provider/index.ts +2 -7
  108. package/src/{core → error}/FlickingError.ts +5 -7
  109. package/src/error/codes.ts +164 -0
  110. package/src/error/groups.ts +124 -0
  111. package/src/error/index.ts +9 -0
  112. package/src/error/types.ts +535 -0
  113. package/src/event/groups.ts +61 -0
  114. package/src/event/index.ts +8 -0
  115. package/src/event/names.ts +52 -0
  116. package/src/event/types.ts +355 -0
  117. package/src/index.ts +9 -11
  118. package/src/index.umd.ts +9 -3
  119. package/src/reactive/index.ts +39 -74
  120. package/src/renderer/Renderer.ts +177 -119
  121. package/src/renderer/VanillaRenderer.ts +13 -10
  122. package/src/renderer/index.ts +4 -9
  123. package/src/renderer/strategy/NormalRenderingStrategy.ts +26 -22
  124. package/src/renderer/strategy/RenderingStrategy.ts +2 -1
  125. package/src/renderer/strategy/VirtualRenderingStrategy.ts +20 -13
  126. package/src/renderer/strategy/index.ts +4 -9
  127. package/src/types/external.ts +72 -0
  128. package/src/{type → types}/internal.ts +2 -5
  129. package/src/types/params.ts +15 -0
  130. package/src/utils.ts +37 -32
  131. package/CONTRIBUTING.md +0 -59
  132. package/NOTICE +0 -31
  133. package/core-packages-link.js +0 -75
  134. package/debug/reactive/index.html +0 -240
  135. package/declaration/Flicking.d.ts +0 -264
  136. package/declaration/camera/Camera.d.ts +0 -90
  137. package/declaration/cfc/withFlickingMethods.d.ts +0 -2
  138. package/declaration/const/error.d.ts +0 -34
  139. package/declaration/const/external.d.ts +0 -54
  140. package/declaration/control/AxesController.d.ts +0 -45
  141. package/declaration/control/Control.d.ts +0 -45
  142. package/declaration/control/FreeControl.d.ts +0 -14
  143. package/declaration/control/SnapControl.d.ts +0 -16
  144. package/declaration/control/StrictControl.d.ts +0 -20
  145. package/declaration/control/states/State.d.ts +0 -47
  146. package/declaration/core/AnchorPoint.d.ts +0 -15
  147. package/declaration/core/FlickingError.d.ts +0 -5
  148. package/declaration/core/Viewport.d.ts +0 -25
  149. package/declaration/core/VirtualManager.d.ts +0 -37
  150. package/declaration/core/index.d.ts +0 -6
  151. package/declaration/core/panel/Panel.d.ts +0 -89
  152. package/declaration/core/panel/VirtualPanel.d.ts +0 -19
  153. package/declaration/core/panel/index.d.ts +0 -5
  154. package/declaration/index.d.ts +0 -16
  155. package/declaration/reactive/index.d.ts +0 -25
  156. package/declaration/renderer/Renderer.d.ts +0 -60
  157. package/declaration/type/event.d.ts +0 -88
  158. package/declaration/type/external.d.ts +0 -31
  159. package/jsconfig.json +0 -5
  160. package/jsdoc-to-mdx.json +0 -7
  161. package/rollup.config.demo.js +0 -24
  162. package/rollup.config.dev.js +0 -12
  163. package/rollup.config.js +0 -57
  164. package/src/const/error.ts +0 -64
  165. package/src/const/external.ts +0 -138
  166. package/src/type/event.ts +0 -315
  167. package/src/type/external.ts +0 -78
  168. package/tsconfig.declaration.json +0 -17
  169. package/tsconfig.eslint.json +0 -10
  170. package/tsconfig.json +0 -23
  171. package/{declaration → dist}/camera/index.d.ts +0 -0
  172. package/{declaration → dist}/camera/mode/index.d.ts +2 -2
  173. package/{declaration → dist}/cfc/getRenderingPanels.d.ts +0 -0
  174. package/{declaration → dist}/cfc/index.d.ts +3 -3
  175. package/{declaration → dist}/cfc/sync.d.ts +0 -0
  176. package/{declaration → dist}/control/index.d.ts +7 -7
  177. package/{declaration → dist}/core/ResizeWatcher.d.ts +0 -0
  178. package/{declaration → dist}/core/panel/provider/ElementProvider.d.ts +0 -0
  179. package/{declaration → dist}/core/panel/provider/index.d.ts +0 -0
  180. package/{declaration → dist}/index.cjs.d.ts +0 -0
  181. package/{declaration → dist}/index.umd.d.ts +0 -0
  182. package/{declaration → dist}/renderer/index.d.ts +1 -1
  183. package/{declaration → dist}/renderer/strategy/VirtualRenderingStrategy.d.ts +1 -1
  184. package/{declaration → dist}/renderer/strategy/index.d.ts +1 -1
  185. /package/{declaration/type → dist/types}/internal.d.ts +0 -0
package/package.json CHANGED
@@ -1,163 +1,36 @@
1
1
  {
2
- "name": "@egjs/flicking",
3
- "version": "4.14.2-beta.2",
4
- "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
- "main": "dist/flicking.cjs.js",
6
- "module": "dist/flicking.esm.js",
7
- "sideEffects": [
8
- "**/*.css",
9
- "**/*.sass"
10
- ],
11
- "es2015": "dist/flicking.esm.js",
12
- "types": "declaration/index.d.ts",
13
- "scripts": {
14
- "start": "concurrently \"rollup -w --config ./rollup.config.dev.js\" \"http-serve\"",
15
- "build": "run-s build:bundle build:declaration build:css printsizes",
16
- "build:bundle": "rm -rf ./dist && rollup -c",
17
- "build:declaration": "rm -rf ./declaration && tsc -p tsconfig.declaration.json",
18
- "build:css": "run-s build:css-clear build:sass build:css-prefix build:css-min",
19
- "build:css-clear": "rm -rf ./dist/*.css",
20
- "build:sass": "sass sass/:dist/ --style=expanded --no-source-map && sass sass/flicking.sass dist/flicking.min.css --style=compressed --no-source-map && sass sass/flicking-inline.sass dist/flicking-inline.min.css --style=compressed --no-source-map",
21
- "build:css-prefix": "postcss dist/*.css --replace --use autoprefixer --no-map",
22
- "build:css-min": "postcss dist/*.css --ext .min.css --use postcss-clean -d dist/ --no-map",
23
- "declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json",
24
- "css": "postcss css/*.css --use autoprefixer postcss-clean -d dist/ -m",
25
- "printsizes": "print-sizes ./dist --exclude=\\.map",
26
- "test": "npm run test --prefix test/unit",
27
- "test:chrome": "npm run test:chrome --prefix test/unit",
28
- "test:cfc": "npm run test --prefix test/cfc",
29
- "lint": "eslint src/**/*.ts",
30
- "lint:test": "eslint 'test/unit/**/*.ts'",
31
- "jsdoc": "jsdoc -c jsdoc.json",
32
- "jsdoc:watch": "npm-watch jsdoc",
33
- "docs:build": "jsdoc-to-mdx -c ./jsdoc-to-mdx.json",
34
- "docs:version": "node ./config/docs-version-up",
35
- "docs:release": "npm run docs:build && npm run docs:version && npm run build --prefix docs",
36
- "demo:prebuild-version": "cpx 'dist/**/*' docs/build/release/$npm_package_version/dist --clean",
37
- "demo:prebuild-latest": "cpx 'dist/**/*' docs/build/release/latest/dist --clean",
38
- "demo:deploy": "npm run docs:release && npm run build && npm run demo:prebuild-version && npm run demo:prebuild-latest && gh-pages -d docs/build/ --add --remote upstream",
39
- "demo:deploy-origin": "npm run docs:release && npm run build && npm run demo:prebuild-version && npm run demo:prebuild-latest && gh-pages -d docs/build/ --add --remote origin",
40
- "release": "release-helper upstream",
41
- "changelog": "node ./config/changelog.js",
42
- "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
43
- "packages": "npm run packages:update && npm run packages:build && npm run packages:publish",
44
- "packages:update": "pvu --update=react-flicking,ngx-flicking/projects/ngx-flicking,vue-flicking,vue3-flicking,svelte-flicking",
45
- "packages:build": "pvu --build=react-flicking,ngx-flicking,vue-flicking,vue3-flicking,svelte-flicking",
46
- "packages:publish": "pvu --publish=react-flicking,ngx-flicking/dist/ngx-flicking,vue-flicking,vue3-flicking,svelte-flicking"
47
- },
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/naver/egjs-flicking"
51
- },
52
- "author": {
53
- "name": "NAVER Corp."
54
- },
55
- "homepage": "https://naver.github.io/egjs-flicking/",
56
- "bugs": {
57
- "url": "https://github.com/naver/egjs-flicking/issues"
58
- },
59
- "license": "MIT",
60
- "browserslist": [
61
- "last 2 version",
62
- "ie 9-11",
63
- "not op_mini all"
64
- ],
65
- "keywords": [
66
- "carousel",
67
- "flicking",
68
- "slider",
69
- "mouse",
70
- "touch",
71
- "desktop",
72
- "mobile",
73
- "react",
74
- "vue",
75
- "angular",
76
- "preact",
77
- "gallery",
78
- "slideshow",
79
- "swipe",
80
- "egjs"
81
- ],
82
- "devDependencies": {
83
- "@babel/preset-env": "^7.16.0",
84
- "@daybrush/jsdoc": "^0.3.10",
85
- "@egjs/flicking-plugins": "^4.2.2",
86
- "@egjs/release-helper": "0.0.3",
87
- "@rollup/plugin-babel": "^5.3.0",
88
- "@rollup/plugin-commonjs": "^11.1.0",
89
- "@rollup/plugin-node-resolve": "^7.1.3",
90
- "@rollup/plugin-replace": "^2.4.1",
91
- "@types/fs-extra": "^9.0.11",
92
- "@types/node": "^14.14.35",
93
- "@types/resize-observer-browser": "^0.1.6",
94
- "@typescript-eslint/eslint-plugin": "^4.18.0",
95
- "@typescript-eslint/eslint-plugin-tslint": "^4.18.0",
96
- "@typescript-eslint/parser": "^4.18.0",
97
- "autoprefixer": "^9.8.8",
98
- "babel-loader": "^8.2.2",
99
- "babel-preset-env": "^1.7.0",
100
- "concurrently": "^6.0.0",
101
- "core-js": "^3.9.1",
102
- "coveralls": "^3.0.2",
103
- "cpx": "^1.5.0",
104
- "egjs-jsdoc-template": "^1.4.4",
105
- "eslint": "^7.22.0",
106
- "eslint-plugin-import": "^2.22.1",
107
- "eslint-plugin-jsdoc": "^30.7.9",
108
- "eslint-plugin-prefer-arrow": "^1.2.3",
109
- "fs-extra": "^7.0.1",
110
- "gh-pages": "^2.0.1",
111
- "hammer-simulator": "0.0.1",
112
- "html-to-react": "^1.4.5",
113
- "http-serve": "^1.0.1",
114
- "husky": "^1.3.1",
115
- "jsdoc-to-mdx": "^1.1.2",
116
- "karma-typescript-es6-transform": "^5.5.2",
117
- "npm-run-all": "^4.1.5",
118
- "postcss-clean": "^1.2.2",
119
- "postcss-cli": "^7.1.2",
120
- "print-coveralls": "^1.2.2",
121
- "print-sizes": "0.0.3",
122
- "pvu": "^0.6.1",
123
- "rollup": "^2.41.5",
124
- "rollup-plugin-livereload": "^1.3.0",
125
- "rollup-plugin-postcss": "^3.1.3",
126
- "rollup-plugin-prototype-minify": "^1.1.0",
127
- "rollup-plugin-serve": "^1.1.0",
128
- "rollup-plugin-terser": "^7.0.2",
129
- "rollup-plugin-typescript2": "^0.36.0",
130
- "rollup-plugin-visualizer": "^4.2.1",
131
- "sass": "^1.79.3",
132
- "sync-exec": "^0.6.2",
133
- "ts-mock-imports": "^1.3.3",
134
- "tsconfig-paths-webpack-plugin": "^3.5.1",
135
- "tslib": "^2.1.0",
136
- "tslint": "^5.12.1",
137
- "ttypescript": "^1.5.12",
138
- "typescript": "^3.9.10",
139
- "typescript-transform-paths": "^2.2.3"
140
- },
141
- "dependencies": {
142
- "@cfcs/core": "^0.1.0",
143
- "@egjs/axes": "^3.9.1",
144
- "@egjs/component": "^3.0.1",
145
- "@egjs/imready": "^1.3.1",
146
- "@egjs/list-differ": "^1.0.1"
147
- },
148
- "husky": {
149
- "hooks": {
150
- "commit-msg": "node config/validate-commit-msg.js",
151
- "pre-push": "npm run lint"
152
- }
153
- },
154
- "watch": {
155
- "jsdoc": {
156
- "patterns": [
157
- "src"
158
- ],
159
- "extensions": "ts",
160
- "runOnChangeOnly": false
161
- }
162
- }
163
- }
2
+ "name": "@egjs/flicking",
3
+ "version": "4.16.0-beta.0",
4
+ "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
+ "main": "dist/flicking.cjs.js",
6
+ "module": "dist/flicking.esm.js",
7
+ "es2015": "dist/flicking.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "dependencies": {
10
+ "@cfcs/core": "^0.1.0",
11
+ "@egjs/axes": "^3.9.1",
12
+ "@egjs/component": "^3.0.2",
13
+ "@egjs/imready": "^1.1.1",
14
+ "@egjs/list-differ": "^1.0.1"
15
+ },
16
+ "sideEffects": [
17
+ "**/*.css",
18
+ "**/*.sass"
19
+ ],
20
+ "scripts": {
21
+ "dev": "vite --config vite.dev.config.ts",
22
+ "dev:preview": "vite --config vite.dev.config.ts --mode production",
23
+ "build": "run-s build:bundle build:css build:declaration printsizes",
24
+ "build:bundle": "rm -rf ./dist && run-s build:bundle:common build:bundle:umd",
25
+ "build:bundle:common": "vite build",
26
+ "build:bundle:umd": "concurrently \"VITE_BUILD_FORMAT=umd vite build\" \"VITE_BUILD_FORMAT=umd VITE_MINIFY=true vite build\" \"VITE_BUILD_FORMAT=umd VITE_RESOLVE=true vite build\" \"VITE_BUILD_FORMAT=umd VITE_RESOLVE=true VITE_MINIFY=true vite build\"",
27
+ "build:css": "run-s build:css-clear build:sass build:css-prefix build:css-min",
28
+ "build:css-clear": "rm -rf ./dist/*.css",
29
+ "build:sass": "sass sass/:dist/ --style=expanded --no-source-map && sass sass/flicking.sass dist/flicking.min.css --style=compressed --no-source-map && sass sass/flicking-inline.sass dist/flicking-inline.min.css --style=compressed --no-source-map",
30
+ "build:css-prefix": "postcss dist/*.css --replace --use autoprefixer --no-map",
31
+ "build:css-min": "postcss dist/*.css --ext .min.css --use postcss-clean -d dist/ --no-map",
32
+ "build:declaration": "tsc -p tsconfig.declaration.json",
33
+ "css": "postcss css/*.css --use autoprefixer postcss-clean -d dist/ -m",
34
+ "printsizes": "print-sizes ./dist --exclude=\\.map"
35
+ }
36
+ }
@@ -4,10 +4,11 @@
4
4
  */
5
5
  import { ComponentEvent } from "@egjs/component";
6
6
  import { EventKey } from "@egjs/component/declaration/types";
7
-
8
- import Flicking, { FlickingEvents, FlickingOptions } from "./Flicking";
7
+ import { CLASS, MOVE_DIRECTION } from "./constants/values";
8
+ import { EVENTS } from "./event/names";
9
9
  import {
10
10
  ChangedEvent,
11
+ FlickingEvents,
11
12
  HoldEndEvent,
12
13
  HoldStartEvent,
13
14
  MoveEndEvent,
@@ -16,9 +17,9 @@ import {
16
17
  RestoredEvent,
17
18
  WillChangeEvent,
18
19
  WillRestoreEvent
19
- } from "./type/event";
20
- import { LiteralUnion, ValueOf } from "./type/internal";
21
- import { CLASS, EVENTS, MOVE_DIRECTION } from "./const/external";
20
+ } from "./event/types";
21
+ import Flicking, { FlickingOptions } from "./Flicking";
22
+ import { LiteralUnion, ValueOf } from "./types/internal";
22
23
  import { getDataAttributes, includes, toArray } from "./utils";
23
24
 
24
25
  export const SIDE_EVENTS = {
@@ -69,6 +70,11 @@ export interface CrossFlickingWillChangeEvent extends WillChangeEvent {
69
70
  sideIndex?: number;
70
71
  }
71
72
 
73
+ /**
74
+ * A preset for cross-directional carousel that combines horizontal and vertical Flicking instances
75
+ * @since 4.12.0
76
+ * @public
77
+ */
72
78
  export class CrossFlicking extends Flicking {
73
79
  // Core components
74
80
  private _sideFlicking: Flicking[];
@@ -99,13 +105,21 @@ export class CrossFlicking extends Flicking {
99
105
  }
100
106
 
101
107
  // Options Getter
102
- public get sideOptions() { return this._sideOptions; }
108
+ public get sideOptions() {
109
+ return this._sideOptions;
110
+ }
103
111
 
104
- public get preserveIndex() { return this._preserveIndex; }
112
+ public get preserveIndex() {
113
+ return this._preserveIndex;
114
+ }
105
115
 
106
- public get disableSlideOnHold() { return this._disableSlideOnHold; }
116
+ public get disableSlideOnHold() {
117
+ return this._disableSlideOnHold;
118
+ }
107
119
 
108
- public get disableIndexSync() { return this._disableIndexSync; }
120
+ public get disableIndexSync() {
121
+ return this._disableIndexSync;
122
+ }
109
123
 
110
124
  // Options Setter
111
125
  public set sideOptions(val: CrossFlickingOptions["sideOptions"]) {
@@ -124,17 +138,9 @@ export class CrossFlicking extends Flicking {
124
138
  this._disableIndexSync = val;
125
139
  }
126
140
 
127
- public constructor(
128
- root: HTMLElement | string,
129
- options: Partial<CrossFlickingOptions>
130
- ) {
141
+ public constructor(root: HTMLElement | string, options: Partial<CrossFlickingOptions>) {
131
142
  super(root, options);
132
- const {
133
- sideOptions = {},
134
- preserveIndex = true,
135
- disableSlideOnHold = true,
136
- disableIndexSync = false
137
- } = options;
143
+ const { sideOptions = {}, preserveIndex = true, disableSlideOnHold = true, disableIndexSync = false } = options;
138
144
 
139
145
  // Internal states
140
146
  this._moveDirection = null;
@@ -157,7 +163,7 @@ export class CrossFlicking extends Flicking {
157
163
  }
158
164
 
159
165
  public destroy(): void {
160
- this._sideFlicking.forEach((flicking) => {
166
+ this._sideFlicking.forEach(flicking => {
161
167
  flicking.destroy();
162
168
  });
163
169
  super.destroy();
@@ -167,7 +173,7 @@ export class CrossFlicking extends Flicking {
167
173
  this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
168
174
  this.on(EVENTS.MOVE, this._onHorizontalMove);
169
175
  this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
170
- [EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach((event) => {
176
+ [EVENTS.CHANGED, EVENTS.WILL_CHANGE].forEach(event => {
171
177
  this.on(event, this._addSideIndex);
172
178
  });
173
179
 
@@ -178,7 +184,7 @@ export class CrossFlicking extends Flicking {
178
184
  flicking.on(EVENTS.CHANGED, this._onSideChanged);
179
185
 
180
186
  Object.keys(SIDE_EVENTS).forEach((name: EventKey<FlickingEvents>) => {
181
- flicking.on(EVENTS[name], (event) => {
187
+ flicking.on(EVENTS[name], event => {
182
188
  this.trigger(
183
189
  new ComponentEvent(SIDE_EVENTS[name], {
184
190
  mainIndex,
@@ -194,10 +200,7 @@ export class CrossFlicking extends Flicking {
194
200
  const viewportEl = this.element;
195
201
  const cameraEl = this.camera.element;
196
202
  const panels = toArray(cameraEl.children) as HTMLElement[];
197
- const isCrossStructure = getDataAttributes(
198
- viewportEl,
199
- "data-cross-"
200
- ).structure;
203
+ const isCrossStructure = getDataAttributes(viewportEl, "data-cross-").structure;
201
204
  let sideState: SideState[] = [];
202
205
 
203
206
  if (!isCrossStructure) {
@@ -229,16 +232,14 @@ export class CrossFlicking extends Flicking {
229
232
  sideState.forEach((state, i) => {
230
233
  const panel = this.camera.children[i];
231
234
  sidePanels += state.element.innerHTML;
232
- Array.from(panel.attributes).forEach((attribute) =>
233
- panel.removeAttribute(attribute.name)
234
- );
235
+ Array.from(panel.attributes).forEach(attribute => panel.removeAttribute(attribute.name));
235
236
  });
236
237
 
237
238
  sideCamera.innerHTML = sidePanels;
238
239
 
239
240
  sideState.forEach((_, i) => {
240
241
  const panel = this.camera.children[i];
241
- [CLASS.VIEWPORT, CLASS.VERTICAL].forEach((className) => {
242
+ [CLASS.VIEWPORT, CLASS.VERTICAL].forEach(className => {
242
243
  if (!panel.classList.contains(className)) {
243
244
  panel.classList.add(className);
244
245
  }
@@ -249,13 +250,11 @@ export class CrossFlicking extends Flicking {
249
250
  this.element.setAttribute("data-cross-structure", "true");
250
251
  }
251
252
 
252
- private _getGroupFromAttribute(
253
- panels: HTMLElement[]
254
- ): Record<string, HTMLElement[]> {
253
+ private _getGroupFromAttribute(panels: HTMLElement[]): Record<string, HTMLElement[]> {
255
254
  const groupKeys: string[] = [];
256
255
  const groupPanels: Record<string, HTMLElement[]> = {};
257
256
 
258
- panels.forEach((panel) => {
257
+ panels.forEach(panel => {
259
258
  const groupKey = getDataAttributes(panel, "data-cross-").groupkey;
260
259
  if (groupKey && !includes(groupKeys, groupKey)) {
261
260
  groupKeys.push(groupKey);
@@ -268,49 +267,38 @@ export class CrossFlicking extends Flicking {
268
267
  return groupPanels;
269
268
  }
270
269
 
271
- private _getSideStateFromGroup(
272
- groupPanels: Record<string, HTMLElement[]>
273
- ): SideState[] {
274
- return Object.keys(groupPanels).reduce(
275
- (state: SideState[], key: string) => {
276
- const start = state.length ? +state[state.length - 1].end + 1 : 0;
277
- const element = groupPanels[key].reduce(
278
- (el: HTMLElement, panel: HTMLElement) => {
279
- el.innerHTML += panel.outerHTML;
280
- return el;
281
- },
282
- document.createElement("div")
283
- );
284
- return [
285
- ...state,
286
- {
287
- key,
288
- start,
289
- end: start + groupPanels[key].length - 1,
290
- element: element
291
- }
292
- ];
293
- },
294
- []
295
- );
270
+ private _getSideStateFromGroup(groupPanels: Record<string, HTMLElement[]>): SideState[] {
271
+ return Object.keys(groupPanels).reduce((state: SideState[], key: string) => {
272
+ const start = state.length ? +state[state.length - 1].end + 1 : 0;
273
+ const element = groupPanels[key].reduce((el: HTMLElement, panel: HTMLElement) => {
274
+ el.innerHTML += panel.outerHTML;
275
+ return el;
276
+ }, document.createElement("div"));
277
+ return [
278
+ ...state,
279
+ {
280
+ key,
281
+ start,
282
+ end: start + groupPanels[key].length - 1,
283
+ element: element
284
+ }
285
+ ];
286
+ }, []);
296
287
  }
297
288
 
298
289
  private _getSideStateFromPanels(panels: HTMLElement[]): SideState[] {
299
- return panels.reduce(
300
- (state: SideState[], panel: HTMLElement, i: number) => {
301
- const start = state.length ? +state[state.length - 1].end + 1 : 0;
302
- return [
303
- ...state,
304
- {
305
- key: i.toString(),
306
- start,
307
- end: start + panel.children.length - 1,
308
- element: panel
309
- }
310
- ];
311
- },
312
- []
313
- );
290
+ return panels.reduce((state: SideState[], panel: HTMLElement, i: number) => {
291
+ const start = state.length ? +state[state.length - 1].end + 1 : 0;
292
+ return [
293
+ ...state,
294
+ {
295
+ key: i.toString(),
296
+ start,
297
+ end: start + panel.children.length - 1,
298
+ element: panel
299
+ }
300
+ ];
301
+ }, []);
314
302
  }
315
303
 
316
304
  private _getSideStateFromCrossStructure(panels: HTMLElement[]): SideState[] {
@@ -346,25 +334,18 @@ export class CrossFlicking extends Flicking {
346
334
  });
347
335
  };
348
336
 
349
- private _setDraggable = (
350
- direction: ValueOf<typeof MOVE_DIRECTION>,
351
- draggable: boolean
352
- ): void => {
337
+ private _setDraggable = (direction: ValueOf<typeof MOVE_DIRECTION>, draggable: boolean): void => {
353
338
  if (!this._disableSlideOnHold) {
354
339
  return;
355
340
  }
356
341
 
357
342
  const dragThreshold = this._originalDragThreshold;
358
- const threshold = draggable
359
- ? dragThreshold && dragThreshold >= 10
360
- ? dragThreshold
361
- : 10
362
- : Infinity;
343
+ const threshold = draggable ? (dragThreshold && dragThreshold >= 10 ? dragThreshold : 10) : Infinity;
363
344
 
364
345
  if ((direction === MOVE_DIRECTION.HORIZONTAL) === this.horizontal) {
365
346
  this.dragThreshold = threshold;
366
347
  } else if ((direction === MOVE_DIRECTION.VERTICAL) === this.horizontal) {
367
- this._sideFlicking.forEach((child) => {
348
+ this._sideFlicking.forEach(child => {
368
349
  child.dragThreshold = threshold;
369
350
  });
370
351
  }
@@ -412,10 +393,7 @@ export class CrossFlicking extends Flicking {
412
393
  const visiblePanels = this.visiblePanels;
413
394
 
414
395
  if (visiblePanels.length > 1) {
415
- this._nextIndex =
416
- e.direction === "NEXT"
417
- ? visiblePanels[1].index
418
- : visiblePanels[0].index;
396
+ this._nextIndex = e.direction === "NEXT" ? visiblePanels[1].index : visiblePanels[0].index;
419
397
  } else {
420
398
  this._nextIndex = visiblePanels[0].index;
421
399
  }
@@ -427,10 +405,7 @@ export class CrossFlicking extends Flicking {
427
405
  requestAnimationFrame(() => this._setPreviousSideIndex());
428
406
 
429
407
  if (e.isTrusted) {
430
- this._syncToCategory(
431
- this._sideFlicking[this._nextIndex].index,
432
- this._nextIndex
433
- );
408
+ this._syncToCategory(this._sideFlicking[this._nextIndex].index, this._nextIndex);
434
409
  }
435
410
  };
436
411
 
@@ -454,10 +429,7 @@ export class CrossFlicking extends Flicking {
454
429
  private _onSideChanged = (e: ChangedEvent): void => {
455
430
  // If this.visiblePanels.length >= 2, it means that horizontal flicking is being dragged.
456
431
  // In this case, syncToCategory in _onHorizontalMoveEnd will fire after moving finishes, so we don't fire it here.
457
- if (
458
- this.visiblePanels.length < 2 &&
459
- this._sideFlicking[this.index] === e.currentTarget
460
- ) {
432
+ if (this.visiblePanels.length < 2 && this._sideFlicking[this.index] === e.currentTarget) {
461
433
  this._syncToCategory(e.index, this.index);
462
434
  }
463
435
  };