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

@three11/accordion

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@three11/accordion - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

341

dist/accordion.js

@@ -1,188 +0,62 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Accordion"] = factory();
else
root["Accordion"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.accordion = mod.exports;
}
})(this, function (_exports) {
"use strict";
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.default = void 0;
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Accordion =
/*#__PURE__*/
function () {
/**
* Create a new Accordion instance
*
* @param {Object} el DOM Element
*
* @return {Object} Accordion instance
*/
function Accordion(el) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Accordion);
this.settings = _objectSpread({
headSelector: '[data-title]',
bodySelector: '[data-content]',
hiddenClass: 'is--hidden',
activeClass: 'is--active'
}, options);
this.el = el;
this.head = this.el.querySelector(this.settings.headSelector);
this.body = this.el.querySelector(this.settings.bodySelector);
this.isOpen = false;
this.height = 0;
this.bind().close();
return this;
}
/**
* Bind event listeners
*
* @return {Object} Accordion instance
*/
_createClass(Accordion, [{
key: "bind",
value: function bind() {
var _this = this;
this.head.addEventListener('click', this.toggle.bind(this));
this.body.addEventListener('transitionend', function () {
if (!_this.isOpen) {
_this.el.classList.add(_this.settings.hiddenClass);
}
});
return this;
}
var Accordion =
/*#__PURE__*/
function () {
/**
* Set instance's height
* Create a new Accordion instance
*
* @param {Number} n
* @param {Object} el DOM Element
*
* @return {Object} Accordion instance
*/
function Accordion(el) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
}, {
key: "setHeight",
value: function setHeight(n) {
var _this2 = this;
_classCallCheck(this, Accordion);
setTimeout(function () {
_this2.body.style.maxHeight = "".concat(n, "px");
}, 1);
this.settings = _objectSpread({
headSelector: '[data-title]',
bodySelector: '[data-content]',
hiddenClass: 'is--hidden',
activeClass: 'is--active'
}, options);
this.el = el;
this.head = this.el.querySelector(this.settings.headSelector);
this.body = this.el.querySelector(this.settings.bodySelector);
this.isOpen = false;
this.height = 0;
this.bind().close();
return this;
}
/**
* Toggle state
* Bind event listeners
*

@@ -192,55 +66,90 @@ * @return {Object} Accordion instance

}, {
key: "toggle",
value: function toggle() {
this.height = this.body.scrollHeight;
if (this.isOpen) {
this.close();
} else {
this.open();
_createClass(Accordion, [{
key: "bind",
value: function bind() {
var _this = this;
this.head.addEventListener('click', this.toggle.bind(this));
this.body.addEventListener('transitionend', function () {
if (!_this.isOpen) {
_this.el.classList.add(_this.settings.hiddenClass);
}
});
return this;
}
/**
* Set instance's height
*
* @param {Number} n
*
* @return {Object} Accordion instance
*/
return this;
}
/**
* Close the accordion
*
* @return {Object} Accordion instance
*/
}, {
key: "setHeight",
value: function setHeight(n) {
var _this2 = this;
}, {
key: "close",
value: function close() {
this.isOpen = false;
this.el.classList.remove(this.settings.activeClass);
this.body.style.maxHeight = "".concat(this.height, "px");
this.setHeight(0);
return this;
}
/**
* Open the accordion
*
* @return {Object} Accordion instance
*/
setTimeout(function () {
_this2.body.style.maxHeight = "".concat(n, "px");
}, 1);
return this;
}
/**
* Toggle state
*
* @return {Object} Accordion instance
*/
}, {
key: "open",
value: function open() {
this.isOpen = true;
this.el.classList.add(this.settings.activeClass);
this.el.classList.remove(this.settings.hiddenClass);
this.body.style.maxHeight = "".concat(0, "px");
this.setHeight(this.height);
return this;
}
}]);
}, {
key: "toggle",
value: function toggle() {
this.height = this.body.scrollHeight;
return Accordion;
}();
if (this.isOpen) {
this.close();
} else {
this.open();
}
exports.default = Accordion;
return this;
}
/**
* Close the accordion
*
* @return {Object} Accordion instance
*/
/***/ })
/******/ ])["default"];
});
}, {
key: "close",
value: function close() {
this.isOpen = false;
this.el.classList.remove(this.settings.activeClass);
this.body.style.maxHeight = "".concat(this.height, "px");
this.setHeight(0);
return this;
}
/**
* Open the accordion
*
* @return {Object} Accordion instance
*/
}, {
key: "open",
value: function open() {
this.isOpen = true;
this.el.classList.add(this.settings.activeClass);
this.el.classList.remove(this.settings.hiddenClass);
this.body.style.maxHeight = "".concat(0, "px");
this.setHeight(this.height);
return this;
}
}]);
return Accordion;
}();
_exports.default = Accordion;
});

@@ -1,1 +0,29 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Accordion=t():e.Accordion=t()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.settings=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}({headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},n),this.el=t,this.head=this.el.querySelector(this.settings.headSelector),this.body=this.el.querySelector(this.settings.bodySelector),this.isOpen=!1,this.height=0,this.bind().close(),this}var t,n,o;return t=e,(n=[{key:"bind",value:function(){var e=this;return this.head.addEventListener("click",this.toggle.bind(this)),this.body.addEventListener("transitionend",function(){e.isOpen||e.el.classList.add(e.settings.hiddenClass)}),this}},{key:"setHeight",value:function(e){var t=this;return setTimeout(function(){t.body.style.maxHeight="".concat(e,"px")},1),this}},{key:"toggle",value:function(){return this.height=this.body.scrollHeight,this.isOpen?this.close():this.open(),this}},{key:"close",value:function(){return this.isOpen=!1,this.el.classList.remove(this.settings.activeClass),this.body.style.maxHeight="".concat(this.height,"px"),this.setHeight(0),this}},{key:"open",value:function(){return this.isOpen=!0,this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass),this.body.style.maxHeight="".concat(0,"px"),this.setHeight(this.height),this}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o}]).default});
(function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={exports:{}};b(c.exports),a.accordion=c.exports}})(this,function(a){"use strict";function b(a){for(var b=1;b<arguments.length;b++){var d=null==arguments[b]?{}:arguments[b],e=Object.keys(d);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(d).filter(function(a){return Object.getOwnPropertyDescriptor(d,a).enumerable}))),e.forEach(function(b){c(a,b,d[b])})}return a}function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function f(a,b,c){return b&&e(a.prototype,b),c&&e(a,c),a}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var g=/*#__PURE__*/function(){/**
* Create a new Accordion instance
*
* @param {Object} el DOM Element
*
* @return {Object} Accordion instance
*/function a(c){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return d(this,a),this.settings=b({headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},e),this.el=c,this.head=this.el.querySelector(this.settings.headSelector),this.body=this.el.querySelector(this.settings.bodySelector),this.isOpen=!1,this.height=0,this.bind().close(),this}/**
* Bind event listeners
*
* @return {Object} Accordion instance
*/return f(a,[{key:"bind",value:function b(){var a=this;return this.head.addEventListener("click",this.toggle.bind(this)),this.body.addEventListener("transitionend",function(){a.isOpen||a.el.classList.add(a.settings.hiddenClass)}),this}/**
* Set instance's height
*
* @param {Number} n
*
* @return {Object} Accordion instance
*/},{key:"setHeight",value:function c(a){var b=this;return setTimeout(function(){b.body.style.maxHeight="".concat(a,"px")},1),this}/**
* Toggle state
*
* @return {Object} Accordion instance
*/},{key:"toggle",value:function a(){return this.height=this.body.scrollHeight,this.isOpen?this.close():this.open(),this}/**
* Close the accordion
*
* @return {Object} Accordion instance
*/},{key:"close",value:function a(){return this.isOpen=!1,this.el.classList.remove(this.settings.activeClass),this.body.style.maxHeight="".concat(this.height,"px"),this.setHeight(0),this}/**
* Open the accordion
*
* @return {Object} Accordion instance
*/},{key:"open",value:function a(){return this.isOpen=!0,this.el.classList.add(this.settings.activeClass),this.el.classList.remove(this.settings.hiddenClass),this.body.style.maxHeight="".concat(0,"px"),this.setHeight(this.height),this}}]),a}();a.default=g});
{
"name": "@three11/accordion",
"version": "0.3.0",
"description": "Front-end Accordion widget using max-height",
"main": "dist/accordion.js",
"scripts": {
"build": "webpack"
},
"repository": {
"type": "git",
"url": "git+https://github.com/three11/accordion.git"
},
"keywords": ["Accordion", "Widget", "Front-End"],
"authors": [
{
"name": "Three 11 Ltd",
"email": "hello@three-11.com",
"role": "Developer"
},
{
"name": "Alexander Panayotov",
"email": "alexander.panayotov@gmail.com",
"role": "Developer"
},
{
"name": "Atanas Atanasov",
"email": "scriptex.bg@gmail.com",
"role": "Developer"
}
],
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/three11/accordion/issues"
},
"homepage": "https://github.com/three11/accordion#readme",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.52",
"@babel/core": "^7.0.0-beta.52",
"@babel/preset-env": "^7.0.0-beta.52",
"@babel/preset-stage-2": "^7.0.0-beta.52",
"babel-loader": "^8.0.0-beta",
"unminified-webpack-plugin": "^2.0.0",
"webpack": "^4.15.1",
"webpack-cli": "^3.0.8"
}
"name": "@three11/accordion",
"version": "0.4.0",
"description": "Front-end Accordion widget using max-height",
"main": "dist/accordion.js",
"style": "dist/accordion.css",
"scripts": {
"dist": "babel src/accordion.js --out-file dist/accordion.js",
"minify": "babel src/accordion.js --out-file dist/accordion.min.js --presets minify,@babel/env",
"build": "npm run dist && npm run minify"
},
"repository": {
"type": "git",
"url": "git+https://github.com/three11/accordion.git"
},
"keywords": [
"Accordion",
"Widget",
"Front-End"
],
"authors": [
{
"name": "Three 11 Ltd",
"email": "hello@three-11.com",
"role": "Developer"
},
{
"name": "Alexander Panayotov",
"email": "alexander.panayotov@gmail.com",
"role": "Developer"
},
{
"name": "Atanas Atanasov",
"email": "scriptex.bg@gmail.com",
"role": "Developer"
}
],
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/three11/accordion/issues"
},
"homepage": "https://github.com/three11/accordion#readme",
"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.2.3",
"@babel/plugin-proposal-decorators": "7.2.3",
"@babel/plugin-proposal-export-namespace-from": "7.2.0",
"@babel/plugin-proposal-function-sent": "7.2.0",
"@babel/plugin-proposal-json-strings": "7.2.0",
"@babel/plugin-proposal-numeric-separator": "7.2.0",
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"babel-loader": "8.0.5",
"@babel/preset-env": "7.2.3",
"babel-minify": "0.5.0"
}
}

@@ -1,18 +0,10 @@

[![GitHub stars](https://img.shields.io/github/stars/three11/accordion.svg?style=social&label=Stars)](https://github.com/three11/accordion)
[![GitHub forks](https://img.shields.io/github/forks/three11/accordion.svg?style=social&label=Fork)](https://github.com/three11/accordion/network#fork-destination-box)
[![GitHub release](https://img.shields.io/github/release/three11/accordion.svg)](https://github.com/three11/accordion/releases/latest)
[![GitHub issues](https://img.shields.io/github/issues/three11/accordion.svg)](https://github.com/three11/accordion/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/three11/accordion.svg)](https://github.com/three11/accordion/commits/master)
[![Github file size](https://img.shields.io/github/size/three11/accordion/dist/index.min.js.svg)](https://github.com/three11/accordion/)
[![Github file size](https://img.shields.io/github/size/three11/accordion/dist/accordion.min.js.svg)](https://github.com/three11/accordion/)
[![Build Status](https://travis-ci.org/three11/accordion.svg?branch=master)](https://travis-ci.org/three11/accordion)
[![npm](https://img.shields.io/npm/dt/@three11/accordion.svg)](https://www.npmjs.com/package/@three11/accordion)
[![npm](https://img.shields.io/npm/v/@three11/accordion.svg)](https://www.npmjs.com/package/@three11/accordion)
[![license](https://img.shields.io/github/license/three11/accordion.svg)](https://github.com/three11/accordion)
[![Analytics](https://ga-beacon.appspot.com/UA-83446952-1/github.com/three11/accordion/README.md)](https://github.com/three11/accordion/)
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/three11/accordion/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/three11/accordion/graphs/commit-activity)
[![Greenkeeper badge](https://badges.greenkeeper.io/three11/accordion.svg)](https://greenkeeper.io/)
[![ForTheBadge built-with-love](https://ForTheBadge.com/images/badges/built-with-love.svg)](https://github.com/three11/)
# Accordion

@@ -19,0 +11,0 @@

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