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

ctrly

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ctrly - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

dist/ctrly.mjs

18

dist/ctrly.js
/*!
* ctrly v0.6.0
* Copyright (c) 2018 Jan Sorgalla
* ctrly v0.7.0
* Copyright (c) 2018-2019 Jan Sorgalla
* License: MIT

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

typeof define === 'function' && define.amd ? define(factory) :
(global.ctrly = factory());
}(this, (function () { 'use strict';
(global = global || self, global.ctrly = factory());
}(this, function () { 'use strict';

@@ -553,3 +553,3 @@ function activeElement() {

var removeControlClick;
var removeControlKeypress;
var removeControlKeydown;
function init() {

@@ -563,3 +563,3 @@ if (!removeControlClick) {

});
removeControlKeypress = delegate(document, 'keypress', controlSelector, function (e, control) {
removeControlKeydown = delegate(document, 'keydown', controlSelector, function (e, control) {
if (keyCode(e) === 13

@@ -613,4 +613,4 @@ || keyCode(e) === 32

removeControlClick = null;
removeControlKeypress();
removeControlKeypress = null;
removeControlKeydown();
removeControlKeydown = null;
}

@@ -654,2 +654,2 @@ find(controlSelector).forEach(function (control) {

})));
}));
/*!
* ctrly v0.6.0
* Copyright (c) 2018 Jan Sorgalla
* ctrly v0.7.0
* Copyright (c) 2018-2019 Jan Sorgalla
* License: MIT
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ctrly=e()}(this,function(){"use strict";function m(){try{var t=document.activeElement;return t&&t.nodeName?t:document.body}catch(t){return document.body}}function r(t){for(var e=[];t&&t.parentNode&&1===t.parentNode.nodeType;)t=t.parentNode,e.push(t);return e}function y(t){var e,n;(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).restoreScrollPosition&&(n=r(t).map(function(t){return[t,t.scrollTop,t.scrollLeft]}),e=function(){n.forEach(function(t){t[0].scrollTop=t[1],t[0].scrollLeft=t[2]})});try{t.focus()}catch(t){}e&&e()}function A(t,e){if(!t)return!1;var n=t.matches||t.webkitMatchesSelector||t.msMatchesSelector;return"function"==typeof n&&n.call(t,e)}function g(t,e){if(!t)return null;if("function"==typeof t.closest)return t.closest(e);do{if(A(t,e))return t;t=t.parentNode}while(t&&1===t.nodeType);return null}function E(t,e){var n=1<arguments.length?e:document;return n&&"function"==typeof n.querySelectorAll?[].slice.call(n.querySelectorAll(t)):[]}var e,w=["a[href]","area[href]","input","select","textarea","button","iframe","object","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),o=/^(input|select|textarea|button|object)$/;function n(t){var e=t.nodeName.toLowerCase();if("area"===e)return function(t){var e=t.parentNode,n=e.name;if(!t.href||!n||"map"!==e.nodeName.toLowerCase())return!1;var r=E('img[usemap="#'.concat(n,'"]'));return 0<r.length&&a(r[0])}(t);if(t.disabled)return!1;if(o.test(e)){var n=g(t,"fieldset");if(n&&n.disabled)return!1}return a(t)}function x(t){var e=u(t);return n(t)&&0<=e}function i(t,e){var n=u(t,!0),r=u(e,!0);return n===r?2&t.compareDocumentPosition(e)?1:-1:n-r}function a(t){var e=getComputedStyle(t);return"hidden"!==e.visibility&&"collapse"!==e.visibility&&"none"!==e.display&&r(t).every(function(t){return"none"!==getComputedStyle(t).display})}function u(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=parseInt(t.getAttribute("tabindex"),10);return isNaN(n)?0:e&&n<0?0:n}function c(){if(e)return e;e={capture:!1,once:!1,passive:!1};var t={get capture(){return!(e.capture=!0)},get once(){return!(e.once=!0)},get passive(){return!(e.passive=!0)}};return window.addEventListener("test",t,t),window.removeEventListener("test",t,t),e}function L(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=c(),n=e.once,r=e.passive,o=e.capture;return n||r||o?(n||delete t.once,r||delete t.passive,o||delete t.capture,t):Boolean(t.capture)}function O(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{capture:!1};if(!e||"function"!=typeof e.addEventListener)return function(){};var o=n,i=function(){!function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{capture:!1};t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n,L(r))}(e,t,o,r)};return r.once&&!c().once&&(o=function(t){i(),n.call(e,t)}),e.addEventListener(t,o,L(r)),i}function C(t,e,n,r){var o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{capture:!1},i=!0===o.once;delete o.once;var a=O(t,e,function(t){var e=g(t.target,n);e&&(i&&a(),r.call(e,t,e))},o);return a}function N(t){return E(w,0<arguments.length?t:document).filter(x).sort(i)}var S={selector:"[data-ctrly]",context:null,focusTarget:!0,closeOnBlur:!0,closeOnEsc:!0,closeOnOutsideClick:!0,closeOnScroll:!1,trapFocus:!1,allowMultiple:!1,on:null,autoInit:!0};function k(t){return"which"in t?t.which:t.keyCode}function D(t){return E('[aria-controls="'.concat(t.id,'"]'))}function T(t){return document.getElementById(t.getAttribute("aria-controls")||t.getAttribute("data-ctrly"))}function j(t){t.removeAttribute("aria-pressed"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded")}var M=0;return function(){var n,e,r,t,o,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(n={},[S,i].forEach(function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}),n),u=a.selector,c=a.on||{},l={};function s(t,e){return("function"!=typeof c[e]||!1!==c[e](t))&&!1!==function(t,e){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!t||"function"!=typeof t.dispatchEvent)return!0;r.bubbles=r.bubbles||!1,r.cancelable=r.cancelable||!1,r.composed=r.composed||!1,r.detail=r.detail||null;try{n=new CustomEvent(e,r)}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(e,r.bubbles,r.cancelable,r.detail)}return t.dispatchEvent(n)}(t,"ctrly:".concat(e),{bubbles:!0,cancelable:!0})}function d(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(!t)return!1;if(!t.hasAttribute("data-ctrly-opened"))return!1;if(!s(t,"close"))return!1;var n=m(),r=l[t.id]||{},o=r.lastActiveElement,i=r.destroy;return delete l[t.id],i&&i(),D(t).forEach(function(t){"button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","false"),t.setAttribute("aria-expanded","false")}),t.removeAttribute("data-ctrly-opened"),t.setAttribute("aria-hidden","true"),t.removeAttribute("tabindex"),t.blur(),e&&o&&t.contains(n)&&y(o,{restoreScrollPosition:!0}),s(t,"closed"),t}function f(n){var t;E(u,(t=n,a.context?g(t,a.context):document)).forEach(function(t){var e=T(t);e&&e.id!==n.id&&d(e,!1)})}function p(t){var e=T(t);return e?!e.hasAttribute("data-ctrly-opened")&&!!s(e,"open")&&(l[e.id]={lastActiveElement:m(),destroy:function(t,i){var e=[];if(a.closeOnBlur&&!a.trapFocus&&e.push(O(document,"focusin",function(t){i.contains(t.target)||setTimeout(function(){d(i,!1)},0)},{capture:!0,passive:!0})),a.closeOnEsc&&e.push(O(document,"keydown",function(t){27===k(t)&&d(i)&&t.preventDefault()})),a.closeOnOutsideClick&&e.push(O(document,"click",function(t){1!==k(t)||i.contains(t.target)||g(t.target,u)||d(i)},{passive:!0})),a.closeOnScroll){var n=!1,r=function(){n=!0},o=function(){n=!1};e.push(O(i,"mouseenter",r,{passive:!0})),e.push(O(i,"mouseleave",o,{passive:!0})),e.push(O(i,"touchstart",r,{passive:!0})),e.push(O(i,"touchend",o,{passive:!0})),e.push(O(window,"scroll",function(){n||d(i)},{passive:!0}))}return a.trapFocus&&e.push(O(document,"keydown",function(t){if(9===k(t)){var e=N(i);if(!e[0])return t.preventDefault(),void y(i);var n=m(),r=e[0],o=e[e.length-1];if(t.shiftKey&&n===r)return t.preventDefault(),void y(o);t.shiftKey||n!==o||(y(r),t.preventDefault())}})),function(){for(;e.length;)e.shift().call()}}(0,e)},D(e).forEach(function(t){"button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","true"),t.setAttribute("aria-expanded","true")}),e.setAttribute("data-ctrly-opened",""),e.setAttribute("aria-hidden","false"),e.setAttribute("tabindex","-1"),s(e,"opened"),e):(j(t),!1)}function v(t,e){var n=T(e);n?"true"!==e.getAttribute("aria-expanded")?(a.allowMultiple||f(n),p(e),n&&(t.preventDefault(),a.focusTarget&&y(N(n)[0]||n),n.scrollTop=0,n.scrollLeft=0)):d(n)&&t.preventDefault():d(function(t){for(var e=t;e;){if(e.id&&l[e.id])return e;e=e.parentElement}}(e))&&t.preventDefault()}function b(){e||(e=C(document,"click",u,function(t,e){1===k(t)&&v(t,e)}),r=C(document,"keypress",u,function(t,e){13!==k(t)&&32!==k(t)||v(t,e)})),E(u).forEach(function(t){var e=T(t);if(e){var n;"button"!==t.tagName.toLowerCase()&&(t.hasAttribute("role")||t.setAttribute("role","button"),A(n=t,w)&&x(n)||t.setAttribute("tabindex","0")),t.setAttribute("aria-controls",e.id);var r=D(e).map(function(t){return t.id||t.setAttribute("id","ctrly-control-"+ ++M),t.id}),o=(e.getAttribute("aria-labelledby")||"").split(" ").concat(r).filter(function(t,e,n){return""!==t&&n.indexOf(t)===e});e.setAttribute("aria-labelledby",o.join(" ")),"true"===t.getAttribute("aria-expanded")||t.hasAttribute("data-ctrly-open")?p(t):("button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","false"),t.setAttribute("aria-expanded","false"),e.setAttribute("aria-hidden","true"),e.removeAttribute("tabindex"))}else j(t)})}function h(n){for(var t in n&&e&&(e(),e=null,r(),r=null),E(u).forEach(function(t){n&&j(t);var e=T(t);e&&(d(e,!1),n&&e.removeAttribute("aria-hidden"))}),l)Object.prototype.hasOwnProperty.call(l,t)&&(l[t].destroy(),delete l[t])}return a.autoInit&&(t=b,"complete"!==(o=document.readyState)&&"interactive"!==o?document.addEventListener("DOMContentLoaded",function(){t()},L({capture:!0,once:!0,passive:!0})):setTimeout(t,0)),{closeAll:function(){h(!1)},destroy:function(){h(!0)},init:b}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ctrly=e()}(this,(function(){"use strict";function t(){try{var t=document.activeElement;return t&&t.nodeName?t:document.body}catch(t){return document.body}}function e(t){for(var e=[];t&&t.parentNode&&1===t.parentNode.nodeType;)t=t.parentNode,e.push(t);return e}function n(t){var n;(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).restoreScrollPosition&&(n=function(t){var n=e(t).map((function(t){return[t,t.scrollTop,t.scrollLeft]}));return function(){n.forEach((function(t){t[0].scrollTop=t[1],t[0].scrollLeft=t[2]}))}}(t));try{t.focus()}catch(t){}n&&n()}function r(t,e){if(!t)return!1;var n=t.matches||t.webkitMatchesSelector||t.msMatchesSelector;return"function"==typeof n&&n.call(t,e)}function o(t,e){if(!t)return null;if("function"==typeof t.closest)return t.closest(e);do{if(r(t,e))return t;t=t.parentNode}while(t&&1===t.nodeType);return null}function i(t,e){var n=arguments.length>1?e:document;return n&&"function"==typeof n.querySelectorAll?[].slice.call(n.querySelectorAll(t)):[]}var a,u=["a[href]","area[href]","input","select","textarea","button","iframe","object","audio[controls]","video[controls]","[contenteditable]","[tabindex]"].join(","),c=/^(input|select|textarea|button|object)$/;function l(t){var e=t.nodeName.toLowerCase();if("area"===e)return function(t){var e=t.parentNode,n=e.name;if(!t.href||!n||"map"!==e.nodeName.toLowerCase())return!1;var r=i('img[usemap="#'.concat(n,'"]'));return r.length>0&&f(r[0])}(t);if(t.disabled)return!1;if(c.test(e)){var n=o(t,"fieldset");if(n&&n.disabled)return!1}return f(t)}function s(t){var e=p(t);return l(t)&&e>=0}function d(t,e){var n=p(t,!0),r=p(e,!0);return n===r?2&t.compareDocumentPosition(e)?1:-1:n-r}function f(t){var n=getComputedStyle(t);return"hidden"!==n.visibility&&"collapse"!==n.visibility&&"none"!==n.display&&e(t).every((function(t){return"none"!==getComputedStyle(t).display}))}function p(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=parseInt(t.getAttribute("tabindex"),10);return isNaN(n)?0:e&&n<0?0:n}function v(){if(a)return a;a={capture:!1,once:!1,passive:!1};var t={get capture(){return a.capture=!0,!1},get once(){return a.once=!0,!1},get passive(){return a.passive=!0,!1}};return window.addEventListener("test",t,t),window.removeEventListener("test",t,t),a}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=v(),n=e.once,r=e.passive,o=e.capture;return n||r||o?(n||delete t.once,r||delete t.passive,o||delete t.capture,t):Boolean(t.capture)}function h(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{capture:!1};if(!t||"function"!=typeof t.addEventListener)return function(){};var o=n,i=function(){!function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{capture:!1};t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n,b(r))}(t,e,o,r)};return r.once&&!v().once&&(o=function(e){i(),n.call(t,e)}),t.addEventListener(e,o,b(r)),i}function m(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{capture:!1},a=!0===i.once;delete i.once;var u=h(t,e,(function(t){var e=o(t.target,n);e&&(a&&u(),r.call(e,t,e))}),i);return u}function y(t){return i(u,arguments.length>0?t:document).filter(s).sort(d)}var A={selector:"[data-ctrly]",context:null,focusTarget:!0,closeOnBlur:!0,closeOnEsc:!0,closeOnOutsideClick:!0,closeOnScroll:!1,trapFocus:!1,allowMultiple:!1,on:null,autoInit:!0};function g(t){return"which"in t?t.which:t.keyCode}function E(t){return i('[aria-controls="'.concat(t.id,'"]'))}function w(t){return document.getElementById(t.getAttribute("aria-controls")||t.getAttribute("data-ctrly"))}function x(t){t.removeAttribute("aria-pressed"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-expanded")}var L=0;return function(){var e,a,c,l,d=function(t){var e={};return[A,t].forEach((function(t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})),e}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),f=d.selector,p=d.on||{},v={};function O(t,e){return("function"!=typeof p[e]||!1!==p[e](t))&&!1!==function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t||"function"!=typeof t.dispatchEvent)return!0;r.bubbles=r.bubbles||!1,r.cancelable=r.cancelable||!1,r.composed=r.composed||!1,r.detail=r.detail||null;try{n=new CustomEvent(e,r)}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(e,r.bubbles,r.cancelable,r.detail)}return t.dispatchEvent(n)}(t,"ctrly:".concat(e),{bubbles:!0,cancelable:!0})}function C(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return!1;if(!e.hasAttribute("data-ctrly-opened"))return!1;if(!O(e,"close"))return!1;var o=t(),i=v[e.id]||{},a=i.lastActiveElement,u=i.destroy;return delete v[e.id],u&&u(),E(e).forEach((function(t){"button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","false"),t.setAttribute("aria-expanded","false")})),e.removeAttribute("data-ctrly-opened"),e.setAttribute("aria-hidden","true"),e.removeAttribute("tabindex"),e.blur(),r&&a&&e.contains(o)&&n(a,{restoreScrollPosition:!0}),O(e,"closed"),e}function N(t){var e;i(f,(e=t,d.context?o(e,d.context):document)).forEach((function(e){var n=w(e);n&&n.id!==t.id&&C(n,!1)}))}function S(e,r){var i=[];if(d.closeOnBlur&&!d.trapFocus&&i.push(h(document,"focusin",(function(t){r.contains(t.target)||setTimeout((function(){C(r,!1)}),0)}),{capture:!0,passive:!0})),d.closeOnEsc&&i.push(h(document,"keydown",(function(t){27===g(t)&&C(r)&&t.preventDefault()}))),d.closeOnOutsideClick&&i.push(h(document,"click",(function(t){1!==g(t)||r.contains(t.target)||o(t.target,f)||C(r)}),{passive:!0})),d.closeOnScroll){var a=!1,u=function(){a=!0},c=function(){a=!1};i.push(h(r,"mouseenter",u,{passive:!0})),i.push(h(r,"mouseleave",c,{passive:!0})),i.push(h(r,"touchstart",u,{passive:!0})),i.push(h(r,"touchend",c,{passive:!0})),i.push(h(window,"scroll",(function(){a||C(r)}),{passive:!0}))}return d.trapFocus&&i.push(h(document,"keydown",(function(e){if(9===g(e)){var o=y(r);if(!o[0])return e.preventDefault(),void n(r);var i=t(),a=o[0],u=o[o.length-1];if(e.shiftKey&&i===a)return e.preventDefault(),void n(u);e.shiftKey||i!==u||(n(a),e.preventDefault())}}))),function(){for(;i.length;)i.shift().call()}}function k(e){var n=w(e);return n?!n.hasAttribute("data-ctrly-opened")&&(!!O(n,"open")&&(v[n.id]={lastActiveElement:t(),destroy:S(0,n)},E(n).forEach((function(t){"button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","true"),t.setAttribute("aria-expanded","true")})),n.setAttribute("data-ctrly-opened",""),n.setAttribute("aria-hidden","false"),n.setAttribute("tabindex","-1"),O(n,"opened"),n)):(x(e),!1)}function D(t,e){var r=w(e);r?"true"!==e.getAttribute("aria-expanded")?(d.allowMultiple||N(r),k(e),r&&(t.preventDefault(),d.focusTarget&&n(y(r)[0]||r),r.scrollTop=0,r.scrollLeft=0)):C(r)&&t.preventDefault():C(function(t){for(var e=t;e;){if(e.id&&v[e.id])return e;e=e.parentElement}}(e))&&t.preventDefault()}function T(){e||(e=m(document,"click",f,(function(t,e){1===g(t)&&D(t,e)})),a=m(document,"keydown",f,(function(t,e){13!==g(t)&&32!==g(t)||D(t,e)}))),i(f).forEach((function(t){var e=w(t);if(e){var n;"button"!==t.tagName.toLowerCase()&&(t.hasAttribute("role")||t.setAttribute("role","button"),r(n=t,u)&&s(n)||t.setAttribute("tabindex","0")),t.setAttribute("aria-controls",e.id);var o=E(e).map((function(t){return t.id||t.setAttribute("id","ctrly-control-"+ ++L),t.id})),i=(e.getAttribute("aria-labelledby")||"").split(" ").concat(o).filter((function(t,e,n){return""!==t&&n.indexOf(t)===e}));e.setAttribute("aria-labelledby",i.join(" ")),"true"===t.getAttribute("aria-expanded")||t.hasAttribute("data-ctrly-open")?k(t):("button"!==t.tagName.toLowerCase()&&t.setAttribute("aria-pressed","false"),t.setAttribute("aria-expanded","false"),e.setAttribute("aria-hidden","true"),e.removeAttribute("tabindex"))}else x(t)}))}function j(t){for(var n in t&&e&&(e(),e=null,a(),a=null),i(f).forEach((function(e){t&&x(e);var n=w(e);n&&(C(n,!1),t&&n.removeAttribute("aria-hidden"))})),v)Object.prototype.hasOwnProperty.call(v,n)&&(v[n].destroy(),delete v[n])}return d.autoInit&&(c=T,"complete"!==(l=document.readyState)&&"interactive"!==l?document.addEventListener("DOMContentLoaded",(function(){c()}),b({capture:!0,once:!0,passive:!0})):setTimeout(c,0)),{closeAll:function(){j(!1)},destroy:function(){j(!0)},init:T}}}));
{
"name": "ctrly",
"version": "0.6.0",
"version": "0.7.0",
"description": "Lightweight and dependency-free content toggling with a focus on accessibility.",

@@ -22,3 +22,3 @@ "repository": "git@github.com:jsor/ctrly.git",

"browser": "dist/ctrly.min.js",
"module": "dist/ctrly.esm.js",
"module": "dist/ctrly.mjs",
"files": [

@@ -37,2 +37,8 @@ "dist",

"space": 4,
"rules": {
"unicorn/prefer-dataset": "off",
"unicorn/prefer-node-append": "off",
"unicorn/prefer-node-remove": "off",
"unicorn/prefer-query-selector": "off"
},
"ignores": [

@@ -63,29 +69,29 @@ "examples/**/*.js",

"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/core": "^7.6.3",
"@babel/preset-env": "^7.6.3",
"@size-limit/preset-small-lib": "^2.1.6",
"browserstack-runner": "^0.9.0",
"chai": "^4.1.2",
"chai": "^4.2.0",
"domestique": "^1.6.0",
"karma": "^3.0.0",
"karma": "^4.3.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-coverage-istanbul-reporter": "^2.0.3",
"karma-firefox-launcher": "^1.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.1",
"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-firefox-launcher": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-rollup-preprocessor": "^6.0.1",
"mocha": "^5.2.0",
"rollup": "^0.65.2",
"rollup-plugin-babel": "^4.0.3",
"karma-rollup-preprocessor": "^7.0.0",
"mocha": "^6.2.1",
"rollup": "^1.23.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-clean": "^1.0.0",
"rollup-plugin-cleanup": "^3.0.0",
"rollup-plugin-commonjs": "^9.1.6",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-uglify": "^5.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.2",
"simulant": "^0.2.2",
"size-limit": "^0.20.0",
"xo": "^0.23.0"
"xo": "^0.25.3"
}
}

@@ -20,2 +20,4 @@ ctrly

**Demos**: [**Accordion**](https://sorgalla.com/ctrly/examples/accordion/) • [**Dropdown**](https://sorgalla.com/ctrly/examples/dropdown/) • [**Offcanvas**](https://sorgalla.com/ctrly/examples/offcanvas/)
Minified and gzipped, the total footprint weights about 2.8kB.

@@ -54,3 +56,4 @@

The control must have a `data-ctrly` which must contain the ID of the target.
The control must have a `data-ctrly` attribute which must contain the ID of the
target.

@@ -62,10 +65,2 @@ ```html

> The [specification](https://www.w3.org/TR/wai-aria-1.1/#aria-controls) also
allows a
[*ID reference list*](https://www.w3.org/TR/wai-aria-1.1/#valuetype_idref_list)
(a list of multiple, space-separated ID references) as value of the
`arial-controls` attribute.
This is **not** supported by ctrly and only a **single** ID reference is
allowed.
To initialize all controls, the `ctrly()` function must be called once.

@@ -77,6 +72,7 @@

ctrly then adds all required ARIA attributes, the `aria-controls` and
`aria-expanded` attributes to the control and the `aria-hidden` and
`aria-labelledby` to the target.
ctrly then adds all required ARIA attributes:
* The `aria-controls` and `aria-expanded` attributes to the control.
* The `aria-hidden` and `aria-labelledby` to the target.
If the control does not have an `id` attribute, ctrly will add an auto-generated

@@ -134,3 +130,3 @@ ID.

While is is highly recommended to use `<button>` elements as controls, ctrly
While it is highly recommended to use `<button>` elements as controls, ctrly
also supports other HTML elements.

@@ -293,3 +289,3 @@

ctrly({
closeOnScroll: false
focusTarget: false
});

@@ -373,3 +369,3 @@ ```

ctrly({
closeOnScroll: false
trapFocus: true
});

@@ -428,2 +424,5 @@ ```

More information about the event callbacks can be found in the
[Events section](#events).
### autoInit

@@ -447,5 +446,2 @@

More information about the event callbacks can be found in the
[Events section](#events).
Events

@@ -460,3 +456,3 @@ ------

2. Through DOM event listeners on the target element (the DOM event names are
prefixed with `ctrly:` eg. `ctrly:open`).
prefixed with `ctrly:`, eg. `ctrly:open`).

@@ -577,3 +573,3 @@ The following events are available.

Copyright (c) 2018 Jan Sorgalla.
Copyright (c) 2018-2019 Jan Sorgalla.
Released under the [MIT](LICENSE) license.

@@ -372,3 +372,3 @@ import {

let removeControlClick;
let removeControlKeypress;
let removeControlKeydown;

@@ -383,3 +383,3 @@ function init() {

removeControlKeypress = delegate(document, 'keypress', controlSelector, (e, control) => {
removeControlKeydown = delegate(document, 'keydown', controlSelector, (e, control) => {
if (

@@ -453,4 +453,4 @@ keyCode(e) === 13 /* Enter */ ||

removeControlClick = null;
removeControlKeypress();
removeControlKeypress = null;
removeControlKeydown();
removeControlKeydown = null;
}

@@ -457,0 +457,0 @@

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