Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@egjs/flicking

Package Overview
Dependencies
Maintainers
0
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@egjs/flicking - npm Package Compare versions

Comparing version 4.12.0-beta.1 to 4.12.0-beta.2

2

declaration/const/external.d.ts

@@ -37,2 +37,4 @@ export { CODE as ERROR_CODE } from "./error";

export declare const CLASS: {
VIEWPORT: string;
CAMERA: string;
VERTICAL: string;

@@ -39,0 +41,0 @@ HIDDEN: string;

@@ -18,5 +18,10 @@ import Flicking, { FlickingOptions } from "./Flicking";

private _nextIndex;
get verticalFlicking(): Flicking[];
get verticalState(): VerticalState[];
get verticalOptions(): FlickingOptions;
constructor(root: HTMLElement | string, { verticalOptions }?: Partial<CrossFlickingOptions>);
init(): Promise<void>;
private _addComponentEvents;
private _createVerticalState;
private _createVerticalFlicking;
private _syncToCategory;

@@ -23,0 +28,0 @@ private _onHorizontalHoldStart;

2

package.json
{
"name": "@egjs/flicking",
"version": "4.12.0-beta.1",
"version": "4.12.0-beta.2",
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",

@@ -5,0 +5,0 @@ "main": "dist/flicking.cjs.js",

@@ -97,2 +97,4 @@ /*

export const CLASS = {
VIEWPORT: "flicking-viewport",
CAMERA: "flicking-camera",
VERTICAL: "vertical",

@@ -99,0 +101,0 @@ HIDDEN: "flicking-hidden",

@@ -9,3 +9,4 @@ /*

import { LiteralUnion, ValueOf } from "./type/internal";
import { EVENTS, MOVE_DIRECTION } from "./const/external";
import { CLASS, EVENTS, MOVE_DIRECTION } from "./const/external";
import { getElement, toArray } from "./utils";

@@ -63,3 +64,2 @@ /**

private _verticalState: VerticalState[];
private _moveDirection: LiteralUnion<ValueOf<typeof MOVE_DIRECTION>> | null;

@@ -70,2 +70,25 @@ private _nextIndex: number;

/**
* {@link Control} instance of the Flicking
* @ko 현재 Flicking에 활성화된 {@link Control} 인스턴스
* @type {Control}
* @default SnapControl
* @readonly
* @see Control
* @see SnapControl
* @see FreeControl
*/
public get verticalFlicking() { return this._verticalFlicking; }
// Internal States
/**
* Whether Flicking's {@link Flicking#init init()} is called.
* This is `true` when {@link Flicking#init init()} is called, and is `false` after calling {@link Flicking#destroy destroy()}.
* @ko Flicking의 {@link Flicking#init init()}이 호출되었는지를 나타내는 멤버 변수.
* 이 값은 {@link Flicking#init init()}이 호출되었으면 `true`로 변하고, {@link Flicking#destroy destroy()}호출 이후에 다시 `false`로 변경됩니다.
* @type {boolean}
* @default false
* @readonly
*/
public get verticalState() { return this._verticalState; }
// Options Getter
/**
* Change active panel index on mouse/touch hold while animating.

@@ -84,3 +107,2 @@ * `index` of the `willChange`/`willRestore` event will be used as new index.

// Options Setter
// UI / LAYOUT
// public set align(val: FlickingOptions["align"]) {

@@ -96,4 +118,6 @@ // this._align = val;

const horizontalPanels = toArray(getElement(root).children[0].children) as HTMLElement[];
// Internal states
this._verticalState = [];
this._verticalState = this._createVerticalState(horizontalPanels);
this._moveDirection = null;

@@ -106,3 +130,3 @@ this._nextIndex = 0;

// Create core components
// this._viewport = new Viewport(this, getElement(root));
this._verticalFlicking = this._createVerticalFlicking(horizontalPanels);
}

@@ -119,42 +143,62 @@

public init(): Promise<void> {
return super.init().then(() => {
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
// camera.children들에 대해 갯수 세기
let verticalPanels = ``;
this._verticalState = this.camera.children.reduce(
(state: VerticalState[], child: HTMLElement) => {
const start = state.length ? +state[state.length - 1].end + 1 : 0;
verticalPanels += child.children[0].innerHTML;
return [
...state,
{
start,
end: start + child.children[0].children.length - 1,
element: child,
},
];
},
[]
);
this.camera.children.forEach((child) => {
child.children[0].innerHTML = verticalPanels;
return super.init().then(() => this._addComponentEvents());
}
private _addComponentEvents(): void {
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
this.on(EVENTS.MOVE, this._onHorizontalMove);
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
this._verticalFlicking.forEach((flicking) => {
flicking.on(EVENTS.HOLD_START, this._onVerticalHoldStart);
flicking.on(EVENTS.MOVE, this._onVerticalMove);
flicking.on(EVENTS.MOVE_END, this._onVerticalMoveEnd);
flicking.on(EVENTS.CHANGED, this._onVerticalChanged);
});
}
private _createVerticalState(panels: HTMLElement[]): VerticalState[] {
// data-index로 분류하기 전에 임시로 모든 children에 대해 vertical flicking으로 해보자.
// panels에 data-attributes가 붙어있을 때와 안 붙어있을 때를 다르게 처리
// 붙어있다면 가상의 viewport들을 index 갯수만큼 만들어줘야 한다
let verticalPanels = "";
const verticalState = panels.reduce(
(state: VerticalState[], panel: HTMLElement) => {
const start = state.length ? +state[state.length - 1].end + 1 : 0;
verticalPanels += panel.innerHTML;
return [
...state,
{
start,
end: start + panel.children.length - 1,
element: panel
}
];
},
[]
);
const verticalCamera = document.createElement("div");
verticalCamera.classList.add(CLASS.CAMERA);
verticalCamera.innerHTML = verticalPanels;
panels.forEach((panel) => {
[CLASS.VIEWPORT, CLASS.VERTICAL].forEach((className) => {
if (!panel.classList.contains(className)) {
panel.classList.add(className);
}
});
this._verticalFlicking = this.camera.children.map((child, i) => {
return new Flicking(child, {
...this.verticalOptions,
horizontal: false,
panelsPerView: 1,
defaultIndex: this._verticalState[i].start,
});
});
panel.innerHTML = verticalCamera.outerHTML;
});
this.on(EVENTS.HOLD_START, this._onHorizontalHoldStart);
this.on(EVENTS.MOVE, this._onHorizontalMove);
this.on(EVENTS.MOVE_END, this._onHorizontalMoveEnd);
return verticalState;
}
this._verticalFlicking.forEach((child) => {
child.on(EVENTS.HOLD_START, this._onVerticalHoldStart);
child.on(EVENTS.MOVE, this._onVerticalMove);
child.on(EVENTS.MOVE_END, this._onVerticalMoveEnd);
child.on(EVENTS.CHANGED, this._onVerticalChanged);
private _createVerticalFlicking(panels: HTMLElement[]): Flicking[] {
return panels.map((panel, i) => {
return new Flicking(panel, {
...this.verticalOptions,
horizontal: false,
panelsPerView: 1,
defaultIndex: this._verticalState[i].start
});

@@ -161,0 +205,0 @@ });

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc