@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.
- package/README.md +6 -175
- package/{declaration → dist}/CrossFlicking.d.ts +7 -2
- package/dist/Flicking.d.ts +1231 -0
- package/dist/camera/Camera.d.ts +324 -0
- package/{declaration → dist}/camera/mode/BoundCameraMode.d.ts +5 -4
- package/{declaration → dist}/camera/mode/CameraMode.d.ts +7 -6
- package/{declaration → dist}/camera/mode/CircularCameraMode.d.ts +9 -5
- package/{declaration → dist}/camera/mode/LinearCameraMode.d.ts +2 -4
- package/{declaration → dist}/cfc/getDefaultCameraTransform.d.ts +1 -1
- package/dist/cfc/withFlickingMethods.d.ts +15 -0
- package/{declaration/const/axes.d.ts → dist/constants/internal.d.ts} +8 -0
- package/dist/constants/values.d.ts +67 -0
- package/dist/control/AxesController.d.ts +186 -0
- package/dist/control/Control.d.ts +185 -0
- package/dist/control/FreeControl.d.ts +44 -0
- package/dist/control/SnapControl.d.ts +54 -0
- package/{declaration → dist}/control/StateMachine.d.ts +3 -0
- package/dist/control/StrictControl.d.ts +60 -0
- package/{declaration → dist}/control/states/AnimatingState.d.ts +12 -0
- package/{declaration → dist}/control/states/DisabledState.d.ts +12 -0
- package/{declaration → dist}/control/states/DraggingState.d.ts +12 -0
- package/{declaration → dist}/control/states/HoldingState.d.ts +12 -0
- package/{declaration → dist}/control/states/IdleState.d.ts +12 -0
- package/dist/control/states/State.d.ts +86 -0
- package/dist/core/AnchorPoint.d.ts +40 -0
- package/{declaration → dist}/core/AutoResizer.d.ts +6 -0
- package/dist/core/Viewport.d.ts +60 -0
- package/dist/core/VirtualManager.d.ts +84 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/panel/Panel.d.ts +298 -0
- package/dist/core/panel/VirtualPanel.d.ts +41 -0
- package/dist/core/panel/index.d.ts +5 -0
- package/{declaration → dist}/core/panel/provider/VanillaElementProvider.d.ts +3 -0
- package/{declaration → dist}/core/panel/provider/VirtualElementProvider.d.ts +3 -0
- package/dist/error/FlickingError.d.ts +25 -0
- package/dist/error/codes.d.ts +79 -0
- package/dist/error/groups.d.ts +94 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/types.d.ts +516 -0
- package/dist/event/groups.d.ts +40 -0
- package/dist/event/index.d.ts +3 -0
- package/dist/event/names.d.ts +47 -0
- package/dist/event/types.d.ts +318 -0
- package/dist/flicking.cjs.js +5560 -7784
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +5638 -7692
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +6722 -8885
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +1 -9
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +9661 -14078
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +1 -9
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/reactive/index.d.ts +126 -0
- package/{declaration → dist}/renderer/ExternalRenderer.d.ts +3 -0
- package/dist/renderer/Renderer.d.ts +215 -0
- package/{declaration → dist}/renderer/VanillaRenderer.d.ts +6 -0
- package/{declaration → dist}/renderer/strategy/NormalRenderingStrategy.d.ts +5 -2
- package/{declaration → dist}/renderer/strategy/RenderingStrategy.d.ts +4 -1
- package/dist/types/external.d.ts +58 -0
- package/dist/types/params.d.ts +10 -0
- package/{declaration → dist}/utils.d.ts +7 -7
- package/package.json +35 -162
- package/src/CrossFlicking.ts +68 -96
- package/src/Flicking.ts +1055 -972
- package/src/camera/Camera.ts +217 -206
- package/src/camera/index.ts +2 -6
- package/src/camera/mode/BoundCameraMode.ts +38 -27
- package/src/camera/mode/CameraMode.ts +14 -12
- package/src/camera/mode/CircularCameraMode.ts +24 -16
- package/src/camera/mode/LinearCameraMode.ts +3 -1
- package/src/camera/mode/index.ts +4 -10
- package/src/cfc/getDefaultCameraTransform.ts +9 -11
- package/src/cfc/getRenderingPanels.ts +2 -5
- package/src/cfc/index.ts +4 -9
- package/src/cfc/sync.ts +11 -5
- package/src/cfc/withFlickingMethods.ts +6 -7
- package/src/{const/axes.ts → constants/internal.ts} +1 -0
- package/src/constants/values.ts +78 -0
- package/src/control/AxesController.ts +119 -110
- package/src/control/Control.ts +147 -180
- package/src/control/FreeControl.ts +36 -60
- package/src/control/SnapControl.ts +64 -68
- package/src/control/StateMachine.ts +14 -11
- package/src/control/StrictControl.ts +58 -73
- package/src/control/index.ts +9 -12
- package/src/control/states/AnimatingState.ts +8 -11
- package/src/control/states/DisabledState.ts +0 -5
- package/src/control/states/DraggingState.ts +8 -12
- package/src/control/states/HoldingState.ts +10 -15
- package/src/control/states/IdleState.ts +1 -6
- package/src/control/states/State.ts +46 -85
- package/src/core/AnchorPoint.ts +25 -23
- package/src/core/AutoResizer.ts +6 -15
- package/src/core/ResizeWatcher.ts +17 -16
- package/src/core/Viewport.ts +35 -46
- package/src/core/VirtualManager.ts +48 -36
- package/src/core/index.ts +6 -9
- package/src/core/panel/Panel.ts +190 -185
- package/src/core/panel/VirtualPanel.ts +17 -21
- package/src/core/panel/index.ts +4 -9
- package/src/core/panel/provider/VanillaElementProvider.ts +6 -2
- package/src/core/panel/provider/VirtualElementProvider.ts +6 -2
- package/src/core/panel/provider/index.ts +2 -7
- package/src/{core → error}/FlickingError.ts +5 -7
- package/src/error/codes.ts +164 -0
- package/src/error/groups.ts +124 -0
- package/src/error/index.ts +9 -0
- package/src/error/types.ts +535 -0
- package/src/event/groups.ts +61 -0
- package/src/event/index.ts +8 -0
- package/src/event/names.ts +52 -0
- package/src/event/types.ts +355 -0
- package/src/index.ts +9 -11
- package/src/index.umd.ts +9 -3
- package/src/reactive/index.ts +39 -74
- package/src/renderer/Renderer.ts +177 -119
- package/src/renderer/VanillaRenderer.ts +13 -10
- package/src/renderer/index.ts +4 -9
- package/src/renderer/strategy/NormalRenderingStrategy.ts +26 -22
- package/src/renderer/strategy/RenderingStrategy.ts +2 -1
- package/src/renderer/strategy/VirtualRenderingStrategy.ts +20 -13
- package/src/renderer/strategy/index.ts +4 -9
- package/src/types/external.ts +72 -0
- package/src/{type → types}/internal.ts +2 -5
- package/src/types/params.ts +15 -0
- package/src/utils.ts +37 -32
- package/CONTRIBUTING.md +0 -59
- package/NOTICE +0 -31
- package/core-packages-link.js +0 -75
- package/debug/reactive/index.html +0 -240
- package/declaration/Flicking.d.ts +0 -264
- package/declaration/camera/Camera.d.ts +0 -90
- package/declaration/cfc/withFlickingMethods.d.ts +0 -2
- package/declaration/const/error.d.ts +0 -34
- package/declaration/const/external.d.ts +0 -54
- package/declaration/control/AxesController.d.ts +0 -45
- package/declaration/control/Control.d.ts +0 -45
- package/declaration/control/FreeControl.d.ts +0 -14
- package/declaration/control/SnapControl.d.ts +0 -16
- package/declaration/control/StrictControl.d.ts +0 -20
- package/declaration/control/states/State.d.ts +0 -47
- package/declaration/core/AnchorPoint.d.ts +0 -15
- package/declaration/core/FlickingError.d.ts +0 -5
- package/declaration/core/Viewport.d.ts +0 -25
- package/declaration/core/VirtualManager.d.ts +0 -37
- package/declaration/core/index.d.ts +0 -6
- package/declaration/core/panel/Panel.d.ts +0 -89
- package/declaration/core/panel/VirtualPanel.d.ts +0 -19
- package/declaration/core/panel/index.d.ts +0 -5
- package/declaration/index.d.ts +0 -16
- package/declaration/reactive/index.d.ts +0 -25
- package/declaration/renderer/Renderer.d.ts +0 -60
- package/declaration/type/event.d.ts +0 -88
- package/declaration/type/external.d.ts +0 -31
- package/jsconfig.json +0 -5
- package/jsdoc-to-mdx.json +0 -7
- package/rollup.config.demo.js +0 -24
- package/rollup.config.dev.js +0 -12
- package/rollup.config.js +0 -57
- package/src/const/error.ts +0 -64
- package/src/const/external.ts +0 -138
- package/src/type/event.ts +0 -315
- package/src/type/external.ts +0 -78
- package/tsconfig.declaration.json +0 -17
- package/tsconfig.eslint.json +0 -10
- package/tsconfig.json +0 -23
- package/{declaration → dist}/camera/index.d.ts +0 -0
- package/{declaration → dist}/camera/mode/index.d.ts +2 -2
- package/{declaration → dist}/cfc/getRenderingPanels.d.ts +0 -0
- package/{declaration → dist}/cfc/index.d.ts +3 -3
- package/{declaration → dist}/cfc/sync.d.ts +0 -0
- package/{declaration → dist}/control/index.d.ts +7 -7
- package/{declaration → dist}/core/ResizeWatcher.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/ElementProvider.d.ts +0 -0
- package/{declaration → dist}/core/panel/provider/index.d.ts +0 -0
- package/{declaration → dist}/index.cjs.d.ts +0 -0
- package/{declaration → dist}/index.umd.d.ts +0 -0
- package/{declaration → dist}/renderer/index.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/VirtualRenderingStrategy.d.ts +1 -1
- package/{declaration → dist}/renderer/strategy/index.d.ts +1 -1
- /package/{declaration/type → dist/types}/internal.d.ts +0 -0
|
@@ -2,14 +2,24 @@
|
|
|
2
2
|
* Copyright (c) 2015 NAVER Corp.
|
|
3
3
|
* egjs projects are licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
+
|
|
6
|
+
import { CLASS } from "../constants/values";
|
|
5
7
|
import Flicking from "../Flicking";
|
|
6
8
|
import { range } from "../utils";
|
|
7
|
-
import { CLASS } from "../const/external";
|
|
8
9
|
|
|
9
10
|
import VirtualPanel from "./panel/VirtualPanel";
|
|
10
11
|
|
|
12
|
+
export type PanelRenderCallback =
|
|
13
|
+
| ((
|
|
14
|
+
/** Virtual panel to render */
|
|
15
|
+
panel: VirtualPanel,
|
|
16
|
+
/** Index of the panel */
|
|
17
|
+
index: number
|
|
18
|
+
) => string)
|
|
19
|
+
| (() => string);
|
|
20
|
+
|
|
11
21
|
export interface VirtualOptions {
|
|
12
|
-
renderPanel:
|
|
22
|
+
renderPanel: PanelRenderCallback;
|
|
13
23
|
initialPanelCount: number;
|
|
14
24
|
cache?: boolean;
|
|
15
25
|
panelClass?: string;
|
|
@@ -21,55 +31,58 @@ export interface VirtualOptions {
|
|
|
21
31
|
class VirtualManager {
|
|
22
32
|
private _flicking: Flicking;
|
|
23
33
|
|
|
24
|
-
private _renderPanel:
|
|
34
|
+
private _renderPanel: PanelRenderCallback;
|
|
25
35
|
private _initialPanelCount: number;
|
|
26
36
|
private _cache: boolean;
|
|
27
37
|
private _panelClass: string;
|
|
28
38
|
|
|
29
39
|
private _elements: Array<{ nativeElement: HTMLElement; visible: boolean }>;
|
|
30
40
|
|
|
31
|
-
public get elements() {
|
|
41
|
+
public get elements() {
|
|
42
|
+
return this._elements;
|
|
43
|
+
}
|
|
32
44
|
|
|
33
45
|
// Options
|
|
34
46
|
/**
|
|
35
47
|
* A rendering function for the panel element's innerHTML
|
|
36
|
-
* @ko 패널 엘리먼트의 innerHTML을 렌더링하는 함수
|
|
37
|
-
* @type {function}
|
|
38
|
-
* @param {VirtualPanel} panel Instance of the panel<ko>패널 인스턴스</ko>
|
|
39
|
-
* @param {number} index Index of the panel<ko>패널 인덱스</ko>
|
|
40
|
-
* @default "() => {}"
|
|
41
48
|
*/
|
|
42
|
-
public get renderPanel() {
|
|
49
|
+
public get renderPanel(): PanelRenderCallback {
|
|
50
|
+
return this._renderPanel;
|
|
51
|
+
}
|
|
43
52
|
/**
|
|
44
53
|
* Initial panel count to render
|
|
45
|
-
* @ko 최초로 렌더링할 패널의 개수
|
|
46
54
|
* @readonly
|
|
47
|
-
* @
|
|
48
|
-
* @default -1
|
|
55
|
+
* @defaultValue -1
|
|
49
56
|
*/
|
|
50
|
-
public get initialPanelCount() {
|
|
57
|
+
public get initialPanelCount(): number {
|
|
58
|
+
return this._initialPanelCount;
|
|
59
|
+
}
|
|
51
60
|
/**
|
|
52
61
|
* Whether to cache rendered panel's innerHTML
|
|
53
|
-
* @
|
|
54
|
-
* @type {boolean}
|
|
55
|
-
* @default false
|
|
62
|
+
* @defaultValue false
|
|
56
63
|
*/
|
|
57
|
-
public get cache() {
|
|
64
|
+
public get cache(): boolean {
|
|
65
|
+
return this._cache;
|
|
66
|
+
}
|
|
58
67
|
/**
|
|
59
68
|
* The class name that will be applied to rendered panel elements
|
|
60
|
-
* @
|
|
61
|
-
* @type {string}
|
|
62
|
-
* @default "flicking-panel"
|
|
69
|
+
* @defaultValue "flicking-panel"
|
|
63
70
|
*/
|
|
64
|
-
public get panelClass() {
|
|
71
|
+
public get panelClass(): string {
|
|
72
|
+
return this._panelClass;
|
|
73
|
+
}
|
|
65
74
|
|
|
66
75
|
public set renderPanel(val: VirtualOptions["renderPanel"]) {
|
|
67
76
|
this._renderPanel = val;
|
|
68
77
|
this._flicking.renderer.panels.forEach((panel: VirtualPanel) => panel.uncacheRenderResult());
|
|
69
78
|
}
|
|
70
79
|
|
|
71
|
-
public set cache(val: NonNullable<VirtualOptions["cache"]>) {
|
|
72
|
-
|
|
80
|
+
public set cache(val: NonNullable<VirtualOptions["cache"]>) {
|
|
81
|
+
this._cache = val;
|
|
82
|
+
}
|
|
83
|
+
public set panelClass(val: NonNullable<VirtualOptions["panelClass"]>) {
|
|
84
|
+
this._panelClass = val;
|
|
85
|
+
}
|
|
73
86
|
|
|
74
87
|
public constructor(flicking: Flicking, options: VirtualOptions | null) {
|
|
75
88
|
this._flicking = flicking;
|
|
@@ -116,9 +129,8 @@ class VirtualManager {
|
|
|
116
129
|
|
|
117
130
|
/**
|
|
118
131
|
* Add new virtual panels at the end of the list
|
|
119
|
-
* @
|
|
120
|
-
* @
|
|
121
|
-
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
132
|
+
* @param count - The number of panels to add
|
|
133
|
+
* @returns The new panels added
|
|
122
134
|
*/
|
|
123
135
|
public append(count: number = 1): VirtualPanel[] {
|
|
124
136
|
const flicking = this._flicking;
|
|
@@ -128,9 +140,8 @@ class VirtualManager {
|
|
|
128
140
|
|
|
129
141
|
/**
|
|
130
142
|
* Add new virtual panels at the start of the list
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
133
|
-
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
143
|
+
* @param count - The number of panels to add
|
|
144
|
+
* @returns The new panels added
|
|
134
145
|
*/
|
|
135
146
|
public prepend(count: number = 1): VirtualPanel[] {
|
|
136
147
|
return this.insert(0, count);
|
|
@@ -138,9 +149,8 @@ class VirtualManager {
|
|
|
138
149
|
|
|
139
150
|
/**
|
|
140
151
|
* Add new virtual panels at the given index
|
|
141
|
-
* @
|
|
142
|
-
* @
|
|
143
|
-
* @returns {Array<VirtualPanel>} The new panels added<ko>새롭게 추가된 패널들</ko>
|
|
152
|
+
* @param count - The number of panels to add
|
|
153
|
+
* @returns The new panels added
|
|
144
154
|
*/
|
|
145
155
|
public insert(index: number, count: number = 1): VirtualPanel[] {
|
|
146
156
|
if (count <= 0) return [];
|
|
@@ -152,9 +162,8 @@ class VirtualManager {
|
|
|
152
162
|
|
|
153
163
|
/**
|
|
154
164
|
* Remove panels at the given index
|
|
155
|
-
* @
|
|
156
|
-
* @
|
|
157
|
-
* @returns {Array<VirtualPanel>} The panels removed<ko>삭제된 패널들</ko>
|
|
165
|
+
* @param count - The number of panels to remove
|
|
166
|
+
* @returns The panels removed
|
|
158
167
|
*/
|
|
159
168
|
public remove(index: number, count: number): VirtualPanel[] {
|
|
160
169
|
if (count <= 0) return [];
|
|
@@ -164,6 +173,9 @@ class VirtualManager {
|
|
|
164
173
|
return flicking.renderer.batchRemove({ index, deleteCount: count, hasDOMInElements: false }) as VirtualPanel[];
|
|
165
174
|
}
|
|
166
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
167
179
|
private _initVirtualElements() {
|
|
168
180
|
const flicking = this._flicking;
|
|
169
181
|
const cameraElement = flicking.camera.element;
|
package/src/core/index.ts
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
* Copyright (c) 2015 NAVER Corp.
|
|
3
3
|
* egjs projects are licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import FlickingError from "./FlickingError";
|
|
5
|
+
|
|
7
6
|
import AnchorPoint from "./AnchorPoint";
|
|
8
|
-
import
|
|
7
|
+
import Viewport, { ViewportPadding } from "./Viewport";
|
|
8
|
+
import VirtualManager, { PanelRenderCallback, VirtualOptions } from "./VirtualManager";
|
|
9
|
+
|
|
10
|
+
export { Viewport, AnchorPoint, VirtualManager };
|
|
9
11
|
|
|
10
|
-
export {
|
|
11
|
-
Viewport,
|
|
12
|
-
FlickingError,
|
|
13
|
-
AnchorPoint,
|
|
14
|
-
VirtualManager
|
|
15
|
-
};
|
|
12
|
+
export type { ViewportPadding, VirtualOptions, PanelRenderCallback };
|
|
16
13
|
|
|
17
14
|
export * from "./panel";
|