@egjs/vue3-flicking 4.3.0 → 4.4.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/declaration/Flicking.d.ts +4 -101
- package/declaration/FlickingProps.d.ts +38 -0
- package/declaration/VueElementProvider.d.ts +12 -0
- package/declaration/VuePanel.d.ts +5 -7
- package/declaration/VueRenderer.d.ts +2 -3
- package/declaration/index.d.ts +1 -1
- package/declaration/types.d.ts +44 -0
- package/dist/flicking.cjs.js +296 -282
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +298 -284
- package/dist/flicking.esm.js.map +1 -1
- package/package.json +5 -6
- package/src/Flicking.ts +174 -128
- package/src/FlickingProps.ts +42 -0
- package/src/VueElementProvider.ts +37 -0
- package/src/VuePanel.ts +17 -14
- package/src/VueRenderer.ts +36 -23
- package/src/index.ts +1 -1
- package/src/shims-vue.d.ts +5 -5
- package/src/types.ts +75 -0
- package/declaration/VuePanelComponent.d.ts +0 -6
- package/src/VuePanelComponent.ts +0 -14
package/src/VueRenderer.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015 NAVER Corp.
|
|
3
|
+
* egjs projects are licensed under the MIT license
|
|
4
|
+
*/
|
|
5
|
+
import {
|
|
6
|
+
ExternalRenderer,
|
|
7
|
+
getFlickingAttached,
|
|
8
|
+
PanelOptions,
|
|
9
|
+
RendererOptions
|
|
10
|
+
} from "@egjs/flicking";
|
|
2
11
|
|
|
3
12
|
import VueFlicking from "./Flicking";
|
|
4
13
|
import VuePanel from "./VuePanel";
|
|
5
|
-
import VuePanelComponent from "./VuePanelComponent";
|
|
6
14
|
|
|
7
15
|
export interface VueRendererOptions extends RendererOptions {
|
|
8
16
|
vueFlicking: VueFlicking;
|
|
@@ -10,7 +18,7 @@ export interface VueRendererOptions extends RendererOptions {
|
|
|
10
18
|
|
|
11
19
|
class VueRenderer extends ExternalRenderer {
|
|
12
20
|
// Internal States
|
|
13
|
-
|
|
21
|
+
private _vueFlicking: VueFlicking;
|
|
14
22
|
|
|
15
23
|
public constructor(options: VueRendererOptions) {
|
|
16
24
|
super(options);
|
|
@@ -18,37 +26,42 @@ class VueRenderer extends ExternalRenderer {
|
|
|
18
26
|
this._vueFlicking = options.vueFlicking;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
22
29
|
public async render() {
|
|
23
|
-
const flicking = this._flicking;
|
|
30
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
31
|
+
const vueFlicking = this._vueFlicking;
|
|
32
|
+
const strategy = this._strategy;
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
strategy.updateRenderingPanels(flicking);
|
|
35
|
+
strategy.renderPanels(flicking);
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
return new Promise<void>((resolve) => {
|
|
38
|
+
vueFlicking.renderEmitter.once("render", resolve);
|
|
39
|
+
vueFlicking.$forceUpdate();
|
|
40
|
+
});
|
|
29
41
|
}
|
|
30
42
|
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
32
43
|
public async forceRenderAllPanels() {
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
const vueFlicking = this._vueFlicking;
|
|
45
|
+
|
|
46
|
+
await super.forceRenderAllPanels();
|
|
47
|
+
|
|
48
|
+
return new Promise<void>((resolve) => {
|
|
49
|
+
vueFlicking.renderEmitter.once("render", resolve);
|
|
50
|
+
vueFlicking.$forceUpdate();
|
|
51
|
+
});
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
protected _collectPanels() {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
index,
|
|
45
|
-
align,
|
|
46
|
-
externalComponent: panelComponent
|
|
47
|
-
}));
|
|
55
|
+
const flicking = getFlickingAttached(this._flicking);
|
|
56
|
+
const vueFlicking = this._vueFlicking;
|
|
57
|
+
const childRefs = vueFlicking.$refs;
|
|
58
|
+
const vuePanels: any[] = Object.keys(childRefs).map(refKey => childRefs[refKey]);
|
|
59
|
+
|
|
60
|
+
this._panels = this._strategy.collectPanels(flicking, vuePanels);
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
protected _createPanel(externalComponent:
|
|
51
|
-
return
|
|
63
|
+
protected _createPanel(externalComponent: VuePanel, options: PanelOptions) {
|
|
64
|
+
return this._strategy.createPanel(externalComponent, options);
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
|
package/src/index.ts
CHANGED
package/src/shims-vue.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
declare module
|
|
3
|
-
import type { DefineComponent } from
|
|
4
|
-
const component: DefineComponent<{}, {}, any
|
|
5
|
-
export default component
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
+
declare module "*.vue" {
|
|
3
|
+
import type { DefineComponent } from "vue";
|
|
4
|
+
const component: DefineComponent<{}, {}, any>;
|
|
5
|
+
export default component;
|
|
6
6
|
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ComponentOptionsMixin, DefineComponent, VNode } from "vue";
|
|
2
|
+
import VanillaFlicking, {
|
|
3
|
+
Plugin,
|
|
4
|
+
Status,
|
|
5
|
+
FlickingOptions,
|
|
6
|
+
FlickingEvents
|
|
7
|
+
} from "@egjs/flicking";
|
|
8
|
+
import Component from "@egjs/component";
|
|
9
|
+
import ListDiffer, { DiffResult } from "@egjs/list-differ";
|
|
10
|
+
|
|
11
|
+
import FlickingProps from "./FlickingProps";
|
|
12
|
+
|
|
13
|
+
export interface FlickingData {
|
|
14
|
+
renderEmitter: Component<{ render: void }>;
|
|
15
|
+
vanillaFlicking: VanillaFlicking;
|
|
16
|
+
pluginsDiffer: ListDiffer<Plugin>;
|
|
17
|
+
slotDiffer: ListDiffer<VNode>;
|
|
18
|
+
diffResult: DiffResult<VNode> | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type VueFlickingEmits = {
|
|
22
|
+
[key in keyof FlickingEvents]: (evt: FlickingEvents[key]) => any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
26
|
+
export type VueFlicking = DefineComponent<
|
|
27
|
+
typeof FlickingProps,
|
|
28
|
+
// RawBindings
|
|
29
|
+
unknown,
|
|
30
|
+
// Data
|
|
31
|
+
FlickingData,
|
|
32
|
+
// Computed
|
|
33
|
+
{},
|
|
34
|
+
// Methods
|
|
35
|
+
{},
|
|
36
|
+
// Mixin
|
|
37
|
+
ComponentOptionsMixin,
|
|
38
|
+
// Extends
|
|
39
|
+
ComponentOptionsMixin,
|
|
40
|
+
// Emits
|
|
41
|
+
VueFlickingEmits,
|
|
42
|
+
string,
|
|
43
|
+
// Public Props
|
|
44
|
+
import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps,
|
|
45
|
+
// Props
|
|
46
|
+
Readonly<{
|
|
47
|
+
viewportTag?: unknown;
|
|
48
|
+
cameraTag?: unknown;
|
|
49
|
+
hideBeforeInit?: unknown;
|
|
50
|
+
firstPanelSize?: unknown;
|
|
51
|
+
options?: unknown;
|
|
52
|
+
plugins?: unknown;
|
|
53
|
+
status?: unknown;
|
|
54
|
+
} & {
|
|
55
|
+
viewportTag: string;
|
|
56
|
+
cameraTag: string;
|
|
57
|
+
hideBeforeInit: boolean;
|
|
58
|
+
options: Partial<FlickingOptions>;
|
|
59
|
+
plugins: Plugin[];
|
|
60
|
+
} & {
|
|
61
|
+
firstPanelSize?: string;
|
|
62
|
+
status?: Status;
|
|
63
|
+
} & {
|
|
64
|
+
[K in keyof VueFlickingEmits as `on${Capitalize<K>}`]?: VueFlickingEmits[K];
|
|
65
|
+
}>,
|
|
66
|
+
// Defaults
|
|
67
|
+
{
|
|
68
|
+
viewportTag: string;
|
|
69
|
+
cameraTag: string;
|
|
70
|
+
hideBeforeInit: boolean;
|
|
71
|
+
options: Partial<FlickingOptions>;
|
|
72
|
+
plugins: Plugin[];
|
|
73
|
+
}
|
|
74
|
+
>;
|
|
75
|
+
/* eslint-enable @typescript-eslint/indent */
|
package/src/VuePanelComponent.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Vue } from "vue-class-component";
|
|
3
|
-
|
|
4
|
-
class VuePanelComponent extends Vue {
|
|
5
|
-
public hide: boolean = false;
|
|
6
|
-
|
|
7
|
-
public render() {
|
|
8
|
-
if (this.hide || !this.$slots.default) return;
|
|
9
|
-
|
|
10
|
-
return this.$slots.default() as any;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default VuePanelComponent;
|