Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/drawer.min.js.map |
{"version":3,"sources":["../src/drawer.js"],"names":["show","root","removeClass","attr","removeAttr","focus","PubSub","publish","DrawerEvents","DRAWER_SHOWN","hide","addClass","DRAWER_HIDDEN","isVisible","isHidden","hasClass","toggle","getDrawerRoot","contentRoot","closest","registerToggles","toggleElements","openTrigger","on","e","preventDefault","wasVisible","filter","index","element","target","contains"],"mappings":"kdAsBA,OACA,OACA,O,4lBAOMA,CAAAA,CAAI,CAAG,SAACC,CAAD,CAAU,CACnBA,CAAI,CAACC,WAAL,CAAiB,QAAjB,EACAD,CAAI,CAACE,IAAL,CAAU,eAAV,KACAF,CAAI,CAACG,UAAL,CAAgB,aAAhB,EACAH,CAAI,CAACI,KAAL,GAEAC,CAAM,CAACC,OAAP,CAAeC,UAAaC,YAA5B,CAA0CR,CAA1C,CACH,C,CAOKS,CAAI,CAAG,SAACT,CAAD,CAAU,CACnBA,CAAI,CAACU,QAAL,CAAc,QAAd,EACAV,CAAI,CAACE,IAAL,CAAU,eAAV,KACAF,CAAI,CAACE,IAAL,CAAU,aAAV,KACAG,CAAM,CAACC,OAAP,CAAeC,UAAaI,aAA5B,CAA2CX,CAA3C,CACH,C,CAQKY,CAAS,CAAG,SAACZ,CAAD,CAAU,CACxB,GAAIa,CAAAA,CAAQ,CAAGb,CAAI,CAACc,QAAL,CAAc,QAAd,CAAf,CACA,MAAO,CAACD,CACX,C,CAOKE,CAAM,CAAG,SAACf,CAAD,CAAU,CACrB,GAAIY,CAAS,CAACZ,CAAD,CAAb,CAAqB,CACjBS,CAAI,CAACT,CAAD,CACP,CAFD,IAEO,CACHD,CAAI,CAACC,CAAD,CACP,CACJ,C,CAsCKgB,CAAa,CAAG,SAACC,CAAD,CAAiB,CACnCA,CAAW,CAAG,cAAEA,CAAF,CAAd,CACA,MAAOA,CAAAA,CAAW,CAACC,OAAZ,CAAoB,qCAApB,CACV,C,WAEc,CACXT,IAAI,CAAEA,CADK,CAEXV,IAAI,CAAEA,CAFK,CAGXa,SAAS,CAAEA,CAHA,CAIXG,MAAM,CAAEA,CAJG,CAKXI,eAAe,CAxCK,QAAlBA,CAAAA,eAAkB,CAACnB,CAAD,CAAOoB,CAAP,CAA0B,CAC9C,GAAIC,CAAAA,CAAW,CAAG,IAAlB,CACAD,CAAc,CAAClB,IAAf,CAAoB,eAApB,CAAqCU,CAAS,CAACZ,CAAD,CAA9C,EAEAoB,CAAc,CAACE,EAAf,CAAkB,OAAlB,CAA2B,SAACC,CAAD,CAAO,CAC9BA,CAAC,CAACC,cAAF,GACA,GAAMC,CAAAA,CAAU,CAAGb,CAAS,CAACZ,CAAD,CAA5B,CACAe,CAAM,CAACf,CAAD,CAAN,CACAoB,CAAc,CAAClB,IAAf,CAAoB,eAApB,CAAqC,CAACuB,CAAtC,EAEA,GAAI,CAACA,CAAL,CAAiB,CAEbJ,CAAW,CAAGD,CAAc,CAACM,MAAf,CAAsB,SAACC,CAAD,CAAQC,CAAR,CAAoB,CACpD,MAAOA,CAAAA,CAAO,EAAIL,CAAC,CAACM,MAAb,EAAuBD,CAAO,CAACE,QAAR,CAAiBP,CAAC,CAACM,MAAnB,CACjC,CAFa,CAGjB,CALD,IAKO,IAAIR,CAAJ,CAAiB,CAGpBA,CAAW,CAACjB,KAAZ,GACAiB,CAAW,CAAG,IACjB,CACJ,CAjBD,CAkBH,CAac,CAMXL,aAAa,CAAEA,CANJ,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Controls the drawer.\n *\n * @module core/drawer\n * @copyright 2019 Jun Pataleta <jun@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport $ from 'jquery';\nimport * as PubSub from 'core/pubsub';\nimport DrawerEvents from 'core/drawer_events';\n\n/**\n * Show the drawer.\n *\n * @param {Object} root The drawer container.\n */\nconst show = (root) => {\n root.removeClass('hidden');\n root.attr('aria-expanded', true);\n root.removeAttr('aria-hidden');\n root.focus();\n\n PubSub.publish(DrawerEvents.DRAWER_SHOWN, root);\n};\n\n/**\n * Hide the drawer.\n *\n * @param {Object} root The drawer container.\n */\nconst hide = (root) => {\n root.addClass('hidden');\n root.attr('aria-expanded', false);\n root.attr('aria-hidden', true);\n PubSub.publish(DrawerEvents.DRAWER_HIDDEN, root);\n};\n\n/**\n * Check if the drawer is visible.\n *\n * @param {Object} root The drawer container.\n * @return {boolean}\n */\nconst isVisible = (root) => {\n let isHidden = root.hasClass('hidden');\n return !isHidden;\n};\n\n/**\n * Toggle the drawer visibility.\n *\n * @param {Object} root The drawer container.\n */\nconst toggle = (root) => {\n if (isVisible(root)) {\n hide(root);\n } else {\n show(root);\n }\n};\n\n/**\n * Add event listeners to toggle the drawer.\n *\n * @param {Object} root The drawer container.\n * @param {Object} toggleElements The toggle elements.\n */\nconst registerToggles = (root, toggleElements) => {\n let openTrigger = null;\n toggleElements.attr('aria-expanded', isVisible(root));\n\n toggleElements.on('click', (e) => {\n e.preventDefault();\n const wasVisible = isVisible(root);\n toggle(root);\n toggleElements.attr('aria-expanded', !wasVisible);\n\n if (!wasVisible) {\n // Remember which trigger element opened the drawer.\n openTrigger = toggleElements.filter((index, element) => {\n return element == e.target || element.contains(e.target);\n });\n } else if (openTrigger) {\n // The drawer has gone from open to close so we need to set the focus back\n // to the element that openend it.\n openTrigger.focus();\n openTrigger = null;\n }\n });\n};\n\n/**\n * Find the root element of the drawer based on the using the drawer content root's ID.\n *\n * @param {Object} contentRoot The drawer content's root element.\n * @returns {*|jQuery}\n */\nconst getDrawerRoot = (contentRoot) => {\n contentRoot = $(contentRoot);\n return contentRoot.closest('[data-region=\"right-hand-drawer\"]');\n};\n\nexport default {\n hide: hide,\n show: show,\n isVisible: isVisible,\n toggle: toggle,\n registerToggles: registerToggles,\n getDrawerRoot: getDrawerRoot\n};\n"],"file":"drawer.min.js"}