{"version":3,"sources":["webpack:///scripts/plugin--collapsible--f5b2059c4dc5954e868b.js","webpack:///./project/client/src/core/plugins/jquery__collapsible/collapsible.js"],"names":["webpackJsonp","/tool/node_modules/babel-loader/lib/index.js??ref--7-0!/tool/node_modules/eslint-loader/index.js!/tool/project/client/src/core/plugins/jquery__collapsible/collapsible.js","module","exports","__webpack_require__","_classCallCheck","instance","Constructor","TypeError","getJSONValue","stringValue","JSON","parse","error","Object","defineProperty","value","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_debug","Collapsible","obj","__esModule","element","options","this","scopes","document","contentSelectorIsId","contentSelector","contentSelectorScope","button","buttonSelector","querySelector","content","collapseWith","collapsedClass","toggleMethod","toggleWithClass","toggleWithHidden","attributeObserver","MutationObserver","onAttributeChange","bind","init","watch","hidden","doCollapse","undefined","open","isCollapsed","addEventListener","toggle","observe","attributes","setAttribute","classList","add","remove","selfClosing","close","openedEvent","CustomEvent","bubbles","cancelable","dispatchEvent","mutationList","observer","filter","mutation","type","attributeName","startsWith","forEach","onOpenChanged","dataset","collapsibleOpen","DEFAULTS","default"],"mappings":"AAAAA,cAAc,wBAERC,4KACA,SAAUC,EAAQC,EAASC,GAEjC,YAeA,SAASC,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCChBhH,QAASC,GAAaC,GACrB,IACC,MAAOC,MAAKC,MAAMF,GACjB,MAAMG,GACP,MAAOH,IDATI,OAAOC,eAAeZ,EAAS,cAC9Ba,OAAO,GAGR,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMZ,OAAOC,eAAeI,EAAQI,EAAWI,IAAKJ,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"scripts/plugin--collapsible--f5b2059c4dc5954e868b.js","sourcesContent":["webpackJsonp([\"plugin--collapsible\"],{\n\n/***/ \"/tool/node_modules/babel-loader/lib/index.js??ref--7-0!/tool/node_modules/eslint-loader/index.js!/tool/project/client/src/core/plugins/jquery__collapsible/collapsible.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _debug = __webpack_require__(\"/tool/node_modules/babel-loader/lib/index.js??ref--7-0!/tool/node_modules/eslint-loader/index.js!/tool/node_modules/debug/src/browser.js\");\n\nvar _debug2 = _interopRequireDefault(_debug);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// const log = debug(`plugins/${PLUGIN_NAME}`);\n\nfunction getJSONValue(stringValue) {\n\ttry {\n\t\treturn JSON.parse(stringValue);\n\t} catch (error) {\n\t\treturn stringValue;\n\t}\n}\n\n// TODO\n// - update data-collapsible-open value on toggle\n\n\nvar Collapsible = function () {\n\tfunction Collapsible(element, options) {\n\t\t_classCallCheck(this, Collapsible);\n\n\t\tthis.element = element;\n\t\tthis.options = options;\n\n\t\tvar scopes = {\n\t\t\tdocument: document,\n\t\t\telement: this.element\n\t\t};\n\n\t\t//\tLook for the content element within this element or elsewhere\n\t\tvar contentSelectorIsId = this.options.contentSelector && this.options.contentSelector[0] === '#';\n\n\t\tif (contentSelectorIsId) {\n\t\t\tthis.contentSelectorScope = scopes['document'];\n\t\t} else {\n\t\t\tthis.contentSelectorScope = scopes[this.options.contentSelectorScope] ? scopes[this.options.contentSelectorScope] : scopes['element'];\n\t\t}\n\n\t\t// if no button is specified perhaps this is the button\n\t\tthis.button = this.options.buttonSelector ? this.element.querySelector(this.options.buttonSelector) : this.element;\n\n\t\t// Content is optional\n\t\t//\twe may be toggling with CSS based on aria-expanded button attr\n\t\tthis.content = this.options.contentSelector && this.contentSelectorScope.querySelector(this.options.contentSelector);\n\t\tthis.collapseWith = this.options.collapsedClass ? 'class' : 'hidden';\n\t\tthis.collapsedClass = this.options.collapsedClass;\n\n\t\t//\tUnused but perhaps sometime useful methods\n\t\t// this.wasCollapsed =\n\t\t// \tthis.collapseWith === 'class'\n\t\t// \t\t? this.hasToggleClass\n\t\t// \t\t: this.hasToggleHidden;\n\n\t\tthis.toggleMethod = this.collapseWith === 'class' ? this.toggleWithClass : this.toggleWithHidden;\n\n\t\tthis.attributeObserver = new MutationObserver(this.onAttributeChange.bind(this));\n\n\t\tthis.init();\n\t\tthis.watch();\n\t}\n\n\t_createClass(Collapsible, [{\n\t\tkey: 'init',\n\t\tvalue: function init() {\n\t\t\t// component enabled - show the button\n\t\t\tthis.button.hidden = false;\n\n\t\t\t// Determine initial collapse state\n\t\t\t//\tif set open option determines init state\n\t\t\tvar doCollapse = this.options.open !== undefined ? !this.options.open : true;\n\n\t\t\tthis.toggleMethod(doCollapse);\n\t\t\tthis.isCollapsed = doCollapse;\n\t\t}\n\t}, {\n\t\tkey: 'watch',\n\t\tvalue: function watch() {\n\t\t\tthis.button.addEventListener('click', this.toggle.bind(this));\n\t\t\tthis.attributeObserver.observe(this.element, { attributes: true });\n\t\t}\n\n\t\t//\tUnused but perhaps sometime useful methods\n\t\t// hasToggleClass() {\n\t\t// \tif (!this.content) {\n\t\t// \t\treturn false;\n\t\t// \t}\n\t\t// \treturn this.content.classList.contains(this.collapsedClass);\n\t\t// }\n\n\t\t// hasToggleHidden() {\n\t\t// \tif (!this.content) {\n\t\t// \t\treturn false;\n\t\t// \t}\n\t\t// \treturn this.content.hidden;\n\t\t// }\n\n\t}, {\n\t\tkey: 'toggleWithHidden',\n\t\tvalue: function toggleWithHidden(doCollapse) {\n\t\t\tthis.button.setAttribute('aria-expanded', !doCollapse);\n\n\t\t\tif (!this.content) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.content.hidden = doCollapse;\n\t\t}\n\t}, {\n\t\tkey: 'toggleWithClass',\n\t\tvalue: function toggleWithClass(doCollapse) {\n\t\t\tthis.button.setAttribute('aria-expanded', !doCollapse);\n\n\t\t\tif (!this.content) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (doCollapse) {\n\t\t\t\tthis.content.classList.add(this.collapsedClass);\n\t\t\t} else {\n\t\t\t\tthis.content.classList.remove(this.collapsedClass);\n\t\t\t}\n\t\t}\n\n\t\t// button click handler\n\n\t}, {\n\t\tkey: 'toggle',\n\t\tvalue: function toggle() {\n\t\t\tif (!this.options.selfClosing && !this.isCollapsed) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tvar handler = this.isCollapsed ? this.open.bind(this) : this.close.bind(this);\n\t\t\thandler();\n\t\t}\n\t}, {\n\t\tkey: 'open',\n\t\tvalue: function open() {\n\t\t\tthis.toggleMethod(false);\n\t\t\tthis.isCollapsed = false;\n\n\t\t\tvar openedEvent = new CustomEvent(\"collapsible_opened\", {\n\t\t\t\tbubbles: false,\n\t\t\t\tcancelable: true\n\t\t\t});\n\t\t\tthis.element.dispatchEvent(openedEvent);\n\t\t}\n\t}, {\n\t\tkey: 'close',\n\t\tvalue: function close() {\n\t\t\tthis.toggleMethod(true);\n\t\t\tthis.isCollapsed = true;\n\t\t}\n\t}, {\n\t\tkey: 'onAttributeChange',\n\t\tvalue: function onAttributeChange(mutationList, observer) {\n\t\t\tmutationList.filter(function (mutation) {\n\t\t\t\treturn mutation.type === 'attributes' && mutation.attributeName.startsWith('data-collapsible-open');\n\t\t\t}).forEach(this.onOpenChanged.bind(this));\n\t\t}\n\t}, {\n\t\tkey: 'onOpenChanged',\n\t\tvalue: function onOpenChanged(mutation) {\n\t\t\tvar doCollapse = !getJSONValue(this.element.dataset.collapsibleOpen);\n\t\t\tif (this.isCollapsed !== doCollapse) {\n\t\t\t\tthis.toggleMethod(doCollapse);\n\t\t\t\tthis.isCollapsed = doCollapse;\n\t\t\t}\n\t\t}\n\t}]);\n\n\treturn Collapsible;\n}();\n\nCollapsible.DEFAULTS = {\n\tselfClosing: true\n};\n\nexports.default = Collapsible;\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// scripts/plugin--collapsible--f5b2059c4dc5954e868b.js","import debug from 'debug';\r\n\r\n// const log = debug(`plugins/${PLUGIN_NAME}`);\r\n\r\nfunction getJSONValue(stringValue) {\r\n\ttry {\r\n\t\treturn JSON.parse(stringValue);\r\n\t} catch(error) {\r\n\t\treturn stringValue;\r\n\t}\r\n}\r\n\r\n// TODO\r\n// - update data-collapsible-open value on toggle\r\n\r\n\r\n\r\nclass Collapsible {\r\n\tconstructor(element, options) {\r\n\t\tthis.element = element;\r\n\t\tthis.options = options;\r\n\r\n\t\tconst scopes = {\r\n\t\t\tdocument: document,\r\n\t\t\telement: this.element\r\n\t\t};\r\n\r\n\t\t//\tLook for the content element within this element or elsewhere\r\n\t\tconst contentSelectorIsId =\r\n\t\t\tthis.options.contentSelector &&\r\n\t\t\tthis.options.contentSelector[0] === '#';\r\n\r\n\t\tif (contentSelectorIsId) {\r\n\t\t\tthis.contentSelectorScope = scopes['document'];\r\n\t\t} else {\r\n\t\t\tthis.contentSelectorScope = scopes[\r\n\t\t\t\tthis.options.contentSelectorScope\r\n\t\t\t]\r\n\t\t\t\t? scopes[this.options.contentSelectorScope]\r\n\t\t\t\t: scopes['element'];\r\n\t\t}\r\n\r\n\t\t// if no button is specified perhaps this is the button\r\n\t\tthis.button = this.options.buttonSelector\r\n\t\t\t? this.element.querySelector(this.options.buttonSelector)\r\n\t\t\t: this.element;\r\n\r\n\t\t// Content is optional\r\n\t\t//\twe may be toggling with CSS based on aria-expanded button attr\r\n\t\tthis.content =\r\n\t\t\tthis.options.contentSelector &&\r\n\t\t\tthis.contentSelectorScope.querySelector(\r\n\t\t\t\tthis.options.contentSelector\r\n\t\t\t);\r\n\t\tthis.collapseWith = this.options.collapsedClass ? 'class' : 'hidden';\r\n\t\tthis.collapsedClass = this.options.collapsedClass;\r\n\r\n\t\t//\tUnused but perhaps sometime useful methods\r\n\t\t// this.wasCollapsed =\r\n\t\t// \tthis.collapseWith === 'class'\r\n\t\t// \t\t? this.hasToggleClass\r\n\t\t// \t\t: this.hasToggleHidden;\r\n\r\n\t\tthis.toggleMethod =\r\n\t\t\tthis.collapseWith === 'class'\r\n\t\t\t\t? this.toggleWithClass\r\n\t\t\t\t: this.toggleWithHidden;\r\n\r\n\t\tthis.attributeObserver = new MutationObserver(\r\n\t\t\tthis.onAttributeChange.bind(this)\r\n\t\t);\r\n\r\n\t\tthis.init();\r\n\t\tthis.watch();\r\n\t}\r\n\r\n\tinit() {\r\n\t\t// component enabled - show the button\r\n\t\tthis.button.hidden = false;\r\n\r\n\t\t// Determine initial collapse state\r\n\t\t//\tif set open option determines init state\r\n\t\tvar doCollapse =\r\n\t\t\tthis.options.open !== undefined ? !this.options.open : true;\r\n\r\n\t\tthis.toggleMethod(doCollapse);\r\n\t\tthis.isCollapsed = doCollapse;\r\n\t}\r\n\r\n\twatch() {\r\n\t\tthis.button.addEventListener('click', this.toggle.bind(this));\r\n\t\tthis.attributeObserver.observe(this.element, { attributes: true });\r\n\t}\r\n\r\n\t//\tUnused but perhaps sometime useful methods\r\n\t// hasToggleClass() {\r\n\t// \tif (!this.content) {\r\n\t// \t\treturn false;\r\n\t// \t}\r\n\t// \treturn this.content.classList.contains(this.collapsedClass);\r\n\t// }\r\n\r\n\t// hasToggleHidden() {\r\n\t// \tif (!this.content) {\r\n\t// \t\treturn false;\r\n\t// \t}\r\n\t// \treturn this.content.hidden;\r\n\t// }\r\n\r\n\ttoggleWithHidden(doCollapse) {\r\n\t\tthis.button.setAttribute('aria-expanded', !doCollapse);\r\n\r\n\t\tif (!this.content) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tthis.content.hidden = doCollapse;\r\n\t}\r\n\r\n\ttoggleWithClass(doCollapse) {\r\n\t\tthis.button.setAttribute('aria-expanded', !doCollapse);\r\n\r\n\t\tif (!this.content) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (doCollapse) {\r\n\t\t\tthis.content.classList.add(this.collapsedClass);\r\n\t\t} else {\r\n\t\t\tthis.content.classList.remove(this.collapsedClass);\r\n\t\t}\r\n\t}\r\n\r\n\t// button click handler\r\n\ttoggle() {\r\n\t\tif (!this.options.selfClosing && !this.isCollapsed) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst handler = this.isCollapsed\r\n\t\t\t? this.open.bind(this)\r\n\t\t\t: this.close.bind(this);\r\n\t\thandler();\r\n\t}\r\n\r\n\topen() {\r\n\t\tthis.toggleMethod(false);\r\n\t\tthis.isCollapsed = false;\r\n\r\n\t\tconst openedEvent = new CustomEvent(\r\n\t\t\t\"collapsible_opened\", {\r\n\t\t\tbubbles: false,\r\n\t\t\tcancelable: true\r\n\t\t});\r\n\t\tthis.element.dispatchEvent(openedEvent);\r\n\t}\r\n\r\n\tclose() {\r\n\t\tthis.toggleMethod(true);\r\n\t\tthis.isCollapsed = true;\r\n\t}\r\n\r\n\tonAttributeChange(mutationList, observer) {\r\n\t\tmutationList\r\n\t\t\t.filter(mutation => {\r\n\t\t\t\treturn (\r\n\t\t\t\t\tmutation.type === 'attributes' &&\r\n\t\t\t\t\tmutation.attributeName.startsWith('data-collapsible-open')\r\n\t\t\t\t);\r\n\t\t\t})\r\n\t\t\t.forEach(this.onOpenChanged.bind(this));\r\n\t}\r\n\r\n\tonOpenChanged(mutation) {\r\n\t\tconst doCollapse = !getJSONValue(this.element.dataset.collapsibleOpen);\r\n\t\tif (this.isCollapsed !== doCollapse) {\r\n\t\t\tthis.toggleMethod(doCollapse);\r\n\t\t\tthis.isCollapsed = doCollapse;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nCollapsible.DEFAULTS = {\r\n\tselfClosing: true\r\n};\r\n\r\nexport default Collapsible;\r\n\n\n\n// WEBPACK FOOTER //\n// ./project/client/src/core/plugins/jquery__collapsible/collapsible.js"],"sourceRoot":""}