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.4.0 to 1.0.0

demo/multiple.html

18

dist/accordion.js

@@ -11,5 +11,5 @@ (function (global, factory) {

factory(mod.exports);
global.accordion = mod.exports;
global.Accordion = mod.exports;
}
})(this, function (_exports) {
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
"use strict";

@@ -20,6 +20,8 @@

});
_exports.default = void 0;
_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; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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; }

@@ -33,5 +35,3 @@

var Accordion =
/*#__PURE__*/
function () {
var Accordion = /*#__PURE__*/function () {
/**

@@ -41,4 +41,2 @@ * Create a new Accordion instance

* @param {Object} el DOM Element
*
* @return {Object} Accordion instance
*/

@@ -157,3 +155,3 @@ function Accordion(el) {

_exports.default = Accordion;
_exports["default"] = Accordion;
});

@@ -1,12 +0,10 @@

(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(){/**
(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}})("undefined"==typeof globalThis?"undefined"==typeof self?this:self:globalThis,function(a){"use strict";function b(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function c(a){for(var c,e=1;e<arguments.length;e++)c=null==arguments[e]?{}:arguments[e],e%2?b(Object(c),!0).forEach(function(b){d(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):b(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))});return a}function d(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(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 g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),a}Object.defineProperty(a,"__esModule",{value:!0}),a["default"]=void 0;var h=/*#__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}/**
*/function a(b){var d=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e(this,a),this.settings=c({headSelector:"[data-title]",bodySelector:"[data-content]",hiddenClass:"is--hidden",activeClass:"is--active"},d),this.el=b,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}/**
*/return g(a,[{key:"bind",value:function bind(){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

@@ -17,14 +15,14 @@ *

* @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}/**
*/},{key:"setHeight",value:function setHeight(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}/**
*/},{key:"toggle",value:function toggle(){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}/**
*/},{key:"close",value:function close(){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});
*/},{key:"open",value:function open(){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"]=h});
{
"name": "@three11/accordion",
"version": "0.4.0",
"version": "1.0.0",
"description": "Front-end Accordion widget using max-height",

@@ -44,17 +44,8 @@ "main": "dist/accordion.js",

"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"
"@babel/cli": "7.14.3",
"@babel/core": "7.14.3",
"@babel/plugin-transform-modules-umd": "7.14.0",
"@babel/preset-env": "7.14.2",
"babel-minify": "0.5.1"
}
}

@@ -6,4 +6,2 @@ export default class Accordion {

* @param {Object} el DOM Element
*
* @return {Object} Accordion instance
*/

@@ -10,0 +8,0 @@ constructor(el, options = {}) {

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