@graupl/graupl 1.0.0-beta.25 → 1.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/dist/css/component/accordion.css +1 -1
- package/dist/css/component/accordion.css.map +1 -1
- package/dist/css/component/list.css +1 -1
- package/dist/css/component/list.css.map +1 -1
- package/dist/css/component.css +1 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +1 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/utilities/object.css +2 -0
- package/dist/css/utilities/object.css.map +1 -0
- package/dist/css/utilities/ratio.css +1 -1
- package/dist/css/utilities/ratio.css.map +1 -1
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/accordion.js +2 -2
- package/dist/js/accordion.js.map +1 -1
- package/dist/js/alert.js +2 -2
- package/dist/js/alert.js.map +1 -1
- package/dist/js/carousel.js +2 -2
- package/dist/js/carousel.js.map +1 -1
- package/dist/js/component/accordion.cjs.js +2 -2
- package/dist/js/component/accordion.cjs.js.map +1 -1
- package/dist/js/component/accordion.es.js +2 -2
- package/dist/js/component/accordion.es.js.map +1 -1
- package/dist/js/component/accordion.iife.js +2 -2
- package/dist/js/component/accordion.iife.js.map +1 -1
- package/dist/js/component/alert.cjs.js +2 -2
- package/dist/js/component/alert.cjs.js.map +1 -1
- package/dist/js/component/alert.es.js +2 -2
- package/dist/js/component/alert.es.js.map +1 -1
- package/dist/js/component/alert.iife.js +2 -2
- package/dist/js/component/alert.iife.js.map +1 -1
- package/dist/js/component/carousel.cjs.js +2 -2
- package/dist/js/component/carousel.cjs.js.map +1 -1
- package/dist/js/component/carousel.es.js +2 -2
- package/dist/js/component/carousel.es.js.map +1 -1
- package/dist/js/component/carousel.iife.js +2 -2
- package/dist/js/component/carousel.iife.js.map +1 -1
- package/dist/js/component/disclosure.cjs.js +2 -2
- package/dist/js/component/disclosure.cjs.js.map +1 -1
- package/dist/js/component/disclosure.es.js +2 -2
- package/dist/js/component/disclosure.es.js.map +1 -1
- package/dist/js/component/disclosure.iife.js +2 -2
- package/dist/js/component/disclosure.iife.js.map +1 -1
- package/dist/js/component/tabs.cjs.js +2 -2
- package/dist/js/component/tabs.cjs.js.map +1 -1
- package/dist/js/component/tabs.es.js +2 -2
- package/dist/js/component/tabs.es.js.map +1 -1
- package/dist/js/component/tabs.iife.js +2 -2
- package/dist/js/component/tabs.iife.js.map +1 -1
- package/dist/js/disclosure.js +2 -2
- package/dist/js/disclosure.js.map +1 -1
- package/dist/js/generator/accordion.cjs.js +2 -2
- package/dist/js/generator/accordion.cjs.js.map +1 -1
- package/dist/js/generator/accordion.es.js +2 -2
- package/dist/js/generator/accordion.es.js.map +1 -1
- package/dist/js/generator/accordion.iife.js +2 -2
- package/dist/js/generator/accordion.iife.js.map +1 -1
- package/dist/js/generator/alert.cjs.js +2 -2
- package/dist/js/generator/alert.cjs.js.map +1 -1
- package/dist/js/generator/alert.es.js +2 -2
- package/dist/js/generator/alert.es.js.map +1 -1
- package/dist/js/generator/alert.iife.js +2 -2
- package/dist/js/generator/alert.iife.js.map +1 -1
- package/dist/js/generator/carousel.cjs.js +2 -2
- package/dist/js/generator/carousel.cjs.js.map +1 -1
- package/dist/js/generator/carousel.es.js +2 -2
- package/dist/js/generator/carousel.es.js.map +1 -1
- package/dist/js/generator/carousel.iife.js +2 -2
- package/dist/js/generator/carousel.iife.js.map +1 -1
- package/dist/js/generator/disclosure.cjs.js +2 -2
- package/dist/js/generator/disclosure.cjs.js.map +1 -1
- package/dist/js/generator/disclosure.es.js +2 -2
- package/dist/js/generator/disclosure.es.js.map +1 -1
- package/dist/js/generator/disclosure.iife.js +2 -2
- package/dist/js/generator/disclosure.iife.js.map +1 -1
- package/dist/js/generator/tabs.cjs.js +2 -2
- package/dist/js/generator/tabs.cjs.js.map +1 -1
- package/dist/js/generator/tabs.es.js +2 -2
- package/dist/js/generator/tabs.es.js.map +1 -1
- package/dist/js/generator/tabs.iife.js +2 -2
- package/dist/js/generator/tabs.iife.js.map +1 -1
- package/dist/js/graupl.js +2 -8
- package/dist/js/graupl.js.map +1 -1
- package/dist/js/navigation.js +1 -1
- package/dist/js/navigation.js.map +1 -1
- package/dist/js/tabs.js +2 -2
- package/dist/js/tabs.js.map +1 -1
- package/package.json +2 -2
- package/scss/utilities/object.scss +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.iife.js","names":["isValidInstance","constructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","fn","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","isValidInstance","isValidClassList","isValidType","isValidState","isValidEvent","isTag","isQuerySelector","addClass","removeClass","keyPress","preventEvent","storage","TransactionalValue","Disclosure","_dom","controller","disclosure","content","_domLock","_selectors","_classes","open","close","transition","initialize","_durations","_focusState","_currentEvent","_open","_shouldOpen","_closeOnBlur","_breakpointWidth","_mediaQueryString","_mediaQueryList","_mediaQueryListEventCallback","event","matches","isOpen","preserveState","hasOpened","shouldOpen","_expandEvent","CustomEvent","bubbles","detail","_collapseEvent","_prefix","_key","_errors","constructor","disclosureElement","controllerElement","disclosureContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","autoOpen","mediaQuery","prefix","initializeClass","_validate","Error","errors","join","dom","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_handleResize","_setTransitionDurations","initializeStorage","pushToStorage","id","getAttribute","window","matchMedia","openQuery","_expand","emit","_collapse","requestAnimationFrame","error","console","selectors","value","focusState","currentEvent","committed","closeQuery","shouldFocus","check","key","htmlElementChecks","HTMLElement","status","push","message","querySelectors","querySelector","Object","keys","querySelectorChecks","classes","className","classListChecks","durations","durationName","durationChecks","prefixCheck","regenerate","Math","random","toString","replace","substring","setAttribute","style","setProperty","_setDOMElementType","elementType","base","overwrite","strict","includes","name","domElements","Array","from","querySelectorAll","filteredElements","filter","item","parentElement","isArray","_resetDOMElementType","transitionlass","setTimeout","removeAttribute","dispatchEvent","innert","addEventListener","relatedTarget","contains","button","toggle","document","target","force","commit","preview","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Disclosure","once","generate","options","context","document","disclosureSelector","controllerSelector","forEach","disclosureElement","disclosureOptions","dataset","grauplDisclosureOptions","JSON","parse","replace","targettedControllerSelector","id","controllerElement","console","warn","remove","initialize"],"sources":["../../../packages/core/src/js/validate.js","../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/storage.js","../../../packages/core/src/js/TransactionalValue.js","../../../packages/core/src/js/disclosure/Disclosure.js","../../../node_modules/@drupal/once/src/once.js","../../../packages/core/src/js/disclosure/generator.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific constructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} constructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(constructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof constructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${constructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document, fn = null) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n if (fn !== null) {\n return tabbableElements.filter(fn);\n } else {\n return tabbableElements;\n }\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\n *\n * Useful when you need to:\n * - Track in-progress edits and revert to the last saved state.\n * - Compare pending and committed states.\n * - Know if a value has changed since last commit.\n *\n * @example\n * // Managing a form field\n * const username = new TransactionalValue(\"Nick\");\n * username.value = \"NickDJM\";\n * if (username.isDirty) {\n * console.log(\"Unsaved changes detected\");\n * username.commit(); // saves the new value\n * }\n *\n * @example\n * // Reverting edits\n * const counter = new TransactionalValue(10);\n * counter.value = 15;\n * counter.reset(); // reverts to 10\n */\nexport class TransactionalValue {\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {{ equals?: function(*, *): boolean }} [options] - Optional config.\n * @param {function(*, *): boolean} [options.equals] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, options = {}) {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @private\n *\n * @type {function(*, *): boolean}\n */\n this._equals = options.equals || Object.is;\n\n /**\n * The current, editable value.\n *\n * @private\n *\n * @type {*}\n */\n this._current = initialValue;\n\n /**\n * The last committed (baseline) value.\n *\n * @private\n *\n * @type {*}\n */\n this._committed = initialValue;\n }\n\n /**\n * Gets the current editable value.\n *\n * @return {*} The current value.\n *\n * @see _current\n */\n get value() {\n return this._current;\n }\n\n /**\n * Sets the current editable value.\n *\n * @param {*} val - The new value.\n */\n set value(val) {\n this._current = val;\n }\n\n /**\n * Gets the last committed (baseline) value.\n *\n * @readonly\n *\n * @return {*} The last committed value.\n *\n * @see _committed\n */\n get committed() {\n return this._committed;\n }\n\n /**\n * Checks whether the current value differs from the committed one.\n *\n * @readonly\n *\n * @return {boolean} `true` if current and committed values differ.\n */\n get isDirty() {\n return !this._equals(this._current, this._committed);\n }\n\n /**\n * Commits the current value, setting it as the new baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n commit() {\n this._committed = this._current;\n return this;\n }\n\n /**\n * Resets the current value to the committed baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n reset() {\n this._current = this._committed;\n return this;\n }\n\n /**\n * Applies a functional update to the current value.\n *\n * @param {function(*): *} fn - A function that receives the previous value and returns the new one.\n * @return {TransactionalValue} The current instance.\n *\n * @example\n * const t = new TransactionalValue(1);\n * t.update(n => n + 1); // 2\n */\n update(fn) {\n this._current = fn(this._current);\n return this;\n }\n}\n","/**\n * @file\n * The Disclosure class.\n */\n\nimport {\n isValidInstance,\n isValidClassList,\n isValidType,\n isValidState,\n isValidEvent,\n isTag,\n isQuerySelector,\n} from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport storage from \"../storage.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\n\nclass Disclosure {\n /**\n * The DOM elements within the disclosure.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} controller - The disclosure toggle element.\n * @property {HTMLElement} disclosure - The disclosure element.\n * @property {HTMLElement} content - The disclosure content element.\n */\n _dom = {\n controller: null,\n disclosure: null,\n content: null,\n };\n\n /**\n * The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _domLock = [\"controller\", \"disclosure\"];\n\n /**\n * The query selectors used by the disclosure.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} content - The query selector for the disclosure content.\n */\n _selectors = {\n content: \"\",\n };\n\n /**\n * The classes to apply when the disclosure is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n *\n * @property {string|string[]} open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} close - The class(es) to apply when the disclousre is closed.\n * @property {string|string[]} tranistion - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the disclosure is initializing.\n */\n _classes = {\n open: \"show\",\n close: \"hide\",\n transition: \"transitioning\",\n initialize: \"initializing\",\n };\n\n /**\n * The duration times (in milliseconds) for various things throughout the disclosure.\n *\n * @protected\n *\n * @type {Object<number>}\n *\n * @property {number} transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} close - The duration time (in milliseconds) for the transition from open to closed states.\n */\n _durations = {\n transition: 5000,\n open: -1,\n close: -1,\n };\n\n /**\n * The current state of the disclosure's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * This last event triggered on the disclosure.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * The open state of the disclosure.\n *\n * @protected\n *\n * @type {TransactionalValue<boolean>}\n */\n _open = new TransactionalValue(false);\n\n /**\n * A value to force the disclosure open when the breakpoint width is passed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _shouldOpen = false;\n\n /**\n * Whether or not to close the disclosure when it loses focus in the DOM.\n *\n * @protected\n *\n * @type {boolean}\n */\n _closeOnBlur = false;\n\n /**\n * The width of the screen that the disclosure will automatically open/close itself.\n *\n * @protected\n *\n * @type {string}\n */\n _breakpointWidth = \"\";\n\n /**\n * The media query to use when automatically opening/closing the disclosure\n *\n * @type {string}\n */\n _mediaQueryString = \"\";\n\n /**\n * This MediaQueryList for the disclosure.\n *\n * @protected\n *\n * @type {MediaQueryList|null}\n */\n _mediaQueryList = null;\n\n /**\n * A callback for media query list events\n *\n * @protected\n *\n * @type {Function}\n *\n * @param {MediaQueryListEvent} event - The event.\n */\n _mediaQueryListEventCallback = (event) => {\n if (event.matches && this.isOpen) {\n this.close({ preserveState: true });\n } else if (\n !event.matches &&\n !this.isOpen &&\n (this.hasOpened || this.shouldOpen)\n ) {\n this.open();\n }\n };\n\n /**\n * The event that is triggered when the disclosure expands.\n *\n * @protected\n *\n * @event grauplDisclosureExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _expandEvent = new CustomEvent(\"grauplDisclosureExpand\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The event that is triggered when the disclosure collapses.\n *\n * @protected\n *\n * @event grauplDisclosureCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event.\n * @property {Object<Disclosure>} details - The details object containing the Disclosure itself.\n */\n _collapseEvent = new CustomEvent(\"grauplDisclosureCollapse\", {\n bubbles: true,\n detail: { disclosure: this },\n });\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the disclosure.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new `Disclosure`.\n *\n * @param {object} options - The options for generating the disclosure.\n * @param {HTMLElement} options.disclosureElement - The disclosure element in the DOM.\n * @param {HTMLElement} options.controllerElement - The disclosure toggle element in the DOM.\n * @param {string} [options.disclosureContentSelector = .disclosure-content] - The query selector string for the disclosure content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a disclosure is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a disclosure is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a disclosure is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 250] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {boolean} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {boolean} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.closeOnBlur = false] - Whether to close the disclosure when it loses focus in the dom.\n * @param {?string} [options.minWidth = \"\"] - The width of the screen that the disclosure will automatically open/close itself.\n * @param {boolean} [options.autoOpen = false] - Whether to automatically open when above the minWidth.\n * @param {?string} [options.mediaQuery = \"\"] - The media query to use when automatically opening/closing the disclosure.\n * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class to apply when a disclosure is initialzing.\n * @param {boolean} [options.initialize = false] - Whether to initialize the disclosure upon construction.\n */\n constructor({\n disclosureElement,\n controllerElement,\n disclosureContentSelector = \".disclosure-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 250,\n openDuration = -1,\n closeDuration = -1,\n closeOnBlur = false,\n minWidth = \"\",\n autoOpen = false,\n mediaQuery = \"\",\n prefix = \"graupl-\",\n initializeClass = \"initializing\",\n initialize = false,\n } = {}) {\n // Set the DOM elements.\n this._dom.disclosure = disclosureElement;\n this._dom.controller = controllerElement;\n\n // Set the DOM selectors.\n this._selectors.content = disclosureContentSelector;\n\n // Set the classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n this._classes.initialize = initializeClass || \"\";\n\n // Set the transition durations.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set close on blur.\n this._closeOnBlur = closeOnBlur;\n\n // Set collapse width and auto open functionality.\n this._breakpointWidth = minWidth || \"\";\n this._shouldOpen = autoOpen;\n this._mediaQueryString = mediaQuery || \"\";\n\n // Set the prefix.\n this._prefix = prefix;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the disclosure.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl Disclosure: cannot initialize disclosure. The following errors have been found:\\n - ${this.errors.join(\n \"\\n - \"\n )}`\n );\n }\n\n addClass(this._classes.initialize, this.dom.disclosure);\n\n // Set up the DOM.\n this._generateKey();\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n\n // Handle events.\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n this._handleResize();\n\n // Set the custom props.\n this._setTransitionDurations();\n\n // Set up the storage.\n storage.initializeStorage(\"disclosures\");\n storage.pushToStorage(\"disclosures\", this.dom.disclosure.id, this);\n\n if (\n this.dom.controller.getAttribute(\"aria-expanded\") === \"true\" ||\n (this.shouldOpen && window.matchMedia(this.openQuery).matches)\n ) {\n this._expand({ emit: false, transition: false });\n } else {\n this._collapse({ emit: false, transition: false });\n }\n\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.disclosure);\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n /**\n * The DOM elements within the disclosure.\n *\n * @readonly\n *\n * @type {Object<HTMLElement>}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the disclosure.\n *\n * @readonly\n *\n * @type {Object<string>}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The class(es) to apply when the disclosure is open.\n *\n * @type {string|string[]}\n *\n * @see _classes.open\n */\n get openClass() {\n return this._classes.open;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._classes.open !== value) {\n this._classes.open = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.close\n */\n get closeClass() {\n return this._classes.close;\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._classes.close !== value) {\n this._classes.close = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.transition\n */\n get transitionClass() {\n return this._classes.transition;\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._classes.transition !== value) {\n this._classes.transition = value;\n }\n }\n\n /**\n * The class(es) to apply to the shelf when the disclosure is initializing.\n *\n * @type {string|string[]}\n *\n * @see _classes\n */\n get initializeClass() {\n return this._classes.initialize;\n }\n\n set initializeClass(value) {\n isValidClassList({ initializeClass: value });\n\n if (this._classes.initialize !== value) {\n this._classes.initialize = value;\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * Setting this value will also set the --graupl-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.transition\n */\n get transitionDuration() {\n return this._durations.transition;\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.transition !== value) {\n this._durations.transition = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-open-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n if (this._durations.open === -1) return this.transitionDuration;\n\n return this._durations.open;\n }\n\n set openDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.open !== value) {\n this._durations.open = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-close-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n if (this._durations.close === -1) return this.transitionDuration;\n\n return this._durations.close;\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { value });\n\n if (this._durations.close !== value) {\n this._durations.close = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The width of the screen that the disclosure will automatically open/close itself.\n *\n * @type {string}\n *\n * @see _breakpointWidth\n */\n get minWidth() {\n return this._breakpointWidth;\n }\n\n set minWidth(value) {\n isValidType(\"string\", { value });\n\n if (this._breakpointWidth !== value) {\n this._breakpointWidth = value;\n }\n }\n\n /**\n * The media query to use when automatically opening/closing the disclosure.\n *\n * @type {string}\n *\n * @see _mediaQueryString\n */\n get mediaQuery() {\n if (this._mediaQueryString !== \"\") {\n return this._mediaQueryString;\n }\n\n return `(width <= ${this._breakpointWidth})`;\n }\n\n set mediaQuery(value) {\n isValidType(\"string\", { value });\n\n if (this._mediaQueryString !== value) {\n this._mediaQueryString = value;\n }\n }\n\n /**\n * Whether to close the disclosure when it loses focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _closeOnBlur\n */\n get closeOnBlur() {\n return this._closeOnBlur;\n }\n\n set closeOnBlur(value) {\n isValidType(\"boolean\", { value });\n\n if (this._closeOnBlur !== value) {\n this._closeOnBlur = value;\n }\n }\n\n /**\n * The current state of the disclosure's focus.\n *\n * @type {string}\n *\n * @see _focusState\n */\n get focusState() {\n return this._focusState;\n }\n\n set focusState(value) {\n isValidState({ value });\n\n if (this._focusState !== value) {\n this._focusState = value;\n }\n }\n\n /**\n * The last event triggered on the disclosure.\n *\n * @type {string}\n *\n * @see _currentEvent\n */\n get currentEvent() {\n return this._currentEvent;\n }\n\n set currentEvent(value) {\n isValidEvent({ value });\n\n if (this._currentEvent !== value) {\n this._currentEvent = value;\n }\n }\n\n /**\n * The prefix to use for CSS custom properties.\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n set prefix(value) {\n isValidType(\"string\", { value });\n\n if (this._prefix !== value) {\n this._prefix = value;\n this._setTransitionDurations();\n }\n }\n\n /**\n * The open state of the disclosure.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get isOpen() {\n return this._open.value;\n }\n\n /**\n * The open state of the disclosure that the user specifically triggered.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get hasOpened() {\n return this._open.committed;\n }\n\n /**\n * A value to force opening reguardless of user interaction.\n *\n * @type {boolean}\n *\n * @see _shouldOpen\n */\n get shouldOpen() {\n return this._shouldOpen;\n }\n\n set shouldOpen(value) {\n isValidType(\"boolean\", { value });\n\n if (this._shouldOpen !== value) {\n this._shouldOpen = value;\n }\n }\n\n /**\n * A media query for when the disclosure should open.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get openQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width > ${this.minWidth}px)`;\n }\n\n /**\n * A media query for when the disclosure should close.\n *\n * Will return an empty string if no min width is set.\n *\n * @readonly\n *\n * @type {string}\n */\n get closeQuery() {\n if (this.minWidth === -1) {\n return \"\";\n }\n\n return `(width <= ${this.minWidth}px)`;\n }\n\n /**\n * A flag to check if the disclosure's focus methods should _actually_ move the focus in the DOM.\n *\n * This will be `false` unless any of the following criteria are met:\n * - The disclosure's current event is \"keyboard\".\n *\n * @readonly\n *\n * @type {boolean}\n */\n get shouldFocus() {\n let check = false;\n\n if (this.currentEvent === \"keyboard\") {\n check = true;\n }\n\n return check;\n }\n\n /**\n * The key used to generate IDs throughout the disclosure.\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * An array of error messages generated by the disclosure.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n /**\n * Validates all aspects on the disclosure to ensure proper functionality.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n let check = true;\n\n // HTML element checks.\n const htmlElementChecks = isValidInstance(HTMLElement, {\n disclosureElement: this._dom.disclosure,\n controllerElement: this._dom.controller,\n });\n\n if (!htmlElementChecks.status) {\n this._errors.push(htmlElementChecks.error.message);\n check = false;\n }\n\n // Query selector checks.\n const querySelectors = {};\n\n for (const querySelector of Object.keys(this._selectors)) {\n querySelectors[`${querySelector}Selector`] =\n this._selectors[querySelector];\n }\n\n const querySelectorChecks = isQuerySelector(querySelectors);\n\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n check = false;\n }\n\n // Class list checks.\n const classes = {};\n\n for (const className of Object.keys(this._classes)) {\n if (this._classes[className] === \"\") {\n continue;\n }\n\n classes[`${className}Class`] = this._classes[className];\n }\n\n const classListChecks = isValidClassList(classes);\n\n if (!classListChecks.status) {\n this._errors.push(classListChecks.error.message);\n check = false;\n }\n\n // Duration checks.\n const durations = {};\n\n for (const durationName of Object.keys(this._durations)) {\n durations[`${durationName}Duration`] = this._durations[durationName];\n }\n\n const durationChecks = isValidType(\"number\", durations);\n\n if (!durationChecks.status) {\n this._errors.push(durationChecks.error.message);\n check = false;\n }\n\n // Prefix check.\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n check = false;\n }\n\n return check;\n }\n\n /**\n * Generates a key for the tabs.\n *\n * @param {Object<boolean>} [options = {}] - Options for generating the key.\n * @param {boolean} [options.regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey({ regenerate = false } = {}) {\n if (this.key === \"\" || regenerate) {\n this._key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets the IDs of the disclosure and it's controller if they do not already exist.\n *\n * The generated IDs use the key and follow the format:\n * - disclosure: `disclosure-${key}`\n * - controller: `disclosure-controller-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.disclosure.id = this.dom.disclosure.id || `disclosure-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `disclosure-controller-${this.key}`;\n }\n\n /**\n * Sets the ARIA attributes on the disclosure and its controller.\n *\n * The first steps are to ensure that the controlled has `aria-expanded` set to \"false\"\n * if it's not already explicity set to \"true\".\n *\n * Then, set the `aria-controls` attribute on the controller to the disclosure's ID.\n *\n * Finally, ensure the controller element has a role of \"button\" if it is not a native button element.\n *\n * @protected\n */\n _setAriaAttributes() {\n // If the controller element doesn't have aria-expanded set to true, set it to false.\n if (this.dom.controller.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute on the controller to the disclosure's ID.\n this.dom.controller.setAttribute(\"aria-controls\", this.dom.disclosure.id);\n\n // If the controller element is not a button, set its role to button.\n if (!isTag(\"button\", { controller: this.dom.controller })) {\n this.dom.controller.setAttribute(\"role\", \"button\");\n }\n }\n\n /**\n * Sets the transition durations of the disclosure as a CSS custom properties.\n *\n * The custom properties are:\n * - `--graupl-disclosure-transition-duration`,\n * - `--graupl-disclosure-open-transition-duration`, and\n * - `--graupl-disclosure-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the disclosure's prefix value.\n *\n * @protected\n */\n _setTransitionDurations() {\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Sets DOM elements.\n *\n * Elements listed in _domLock cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {Object<HTMLElement,boolean>} [options = {}] - The options for setting the DOM element type.\n * @param {HTMLElement} [options.base = this.dom.disclosure] - The element used as the base for the querySelector.\n * @param {boolean} [options.overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [options.strict = true] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { base = this.dom.disclosure, overwrite = true, strict = true } = {}\n ) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType.`\n );\n }\n\n if (base !== this.dom.disclosure) isValidInstance(HTMLElement, { base });\n\n // Get the all elements matching the selector in the base.\n const domElements = Array.from(\n base.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so only direct children of the base are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === base : true\n );\n\n if (overwrite) {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n } else {\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Resets DOM elements.\n *\n * Elements listed in _domLock cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n if (typeof this.selectors[elementType] === \"string\") {\n if (this._domLock.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n } else {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n }\n\n /**\n * Sets all DOM elements within the disclosure.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"content\");\n this._setDOMElementType(\"content\");\n }\n\n /**\n * Expands the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"true\", adds the\n * open class to the disclosure, and removes the closed class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureExpand\n *\n * @param {Object<boolean>} [options = {}] - Options for expanding the disclosure.\n * @param {boolean} [options.emit = true] - Emit the expand event once expanded.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _expand({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the close class,\n // add the open class, and finally remove the transition class.\n if (transition && this.transitionlass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n }, this.openDuration);\n });\n });\n });\n } else {\n // Add the open class\n addClass(this.openClass, this.dom.disclosure);\n\n // Remove the close class.\n removeClass(this.closeClass, this.dom.disclosure);\n }\n\n this.dom.content.removeAttribute(\"inert\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._expandEvent);\n }\n }\n\n /**\n * Collapses the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"false\", adds the\n * close class to the disclosure, and removes the open class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureCollapse\n *\n * @param {Object<boolean>} [options = {}] - Options for collapsing the disclosure.\n * @param {boolean} [options.emit = true] - Emit the collapse event once collapsed.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _collapse({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the open class,\n // add the close class, and finally remove the transition class.\n if (transition && this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n\n this.dom.content.innert = true;\n }, this.closeDuration);\n });\n });\n });\n } else {\n // Add the close class\n addClass(this.closeClass, this.dom.disclosure);\n\n // Remove the open class.\n removeClass(this.openClass, this.dom.disclosure);\n }\n\n this.dom.content.setAttribute(\"inert\", \"true\");\n\n if (emit) {\n this.dom.controller.dispatchEvent(this._collapseEvent);\n }\n }\n\n _handleResize() {\n if (this._breakpointWidth === \"\") {\n return;\n }\n\n this._mediaQueryList = window.matchMedia(this.mediaQuery);\n this._mediaQueryList.addEventListener(\n \"change\",\n this._mediaQueryListEventCallback\n );\n this._mediaQueryListEventCallback(this._mediaQueryList);\n }\n\n /**\n * Handles focus events throughout the disclosure.\n *\n * - Adds a `focusout` listener to the disclosure so when the disclosure loses focus it will close.\n */\n _handleFocus() {\n this.dom.disclosure.addEventListener(\"focusout\", (event) => {\n if (\n !this.closeOnBlur ||\n this.currentEvent !== \"keyboard\" ||\n event.relatedTarget === null ||\n this.dom.disclosure.contains(event.relatedTarget) ||\n this.dom.controller === event.relatedTarget\n ) {\n return;\n }\n\n this.close();\n });\n }\n\n /**\n * Handles click events throughout the disclosure.\n *\n * - Adds a `pointerup` listener to the controller that toggles the disclosure.\n * - Adds a `pointerup` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this.dom.controller.addEventListener(\"pointerup\", (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n preventEvent(event);\n this.toggle();\n });\n\n document.addEventListener(\"pointerup\", (event) => {\n if (this.focusState !== \"self\" || !this.closeOnBlur) return;\n\n this.currentEvent = \"mouse\";\n\n if (\n !this.dom.disclosure.contains(event.target) &&\n this.dom.controller !== event.target\n ) {\n this.close();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the disclosure.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - Adds a `keydown` listener to the disclosure.\n * - Blocks propagation on \"Escape\" keys.\n */\n _handleKeydown() {\n this.dom.controller.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keydown\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Handles keyup events throughout the disclosure.\n *\n * - Adds a `keyup` listener to the controller.\n * - Toggles the disclosure on \"Space\" and \"Enter\" keys.\n * - Adds a `keyup` listener to the disclosure.\n * - Closes the disclosure on \"Escape\" keys.\n */\n _handleKeyup() {\n this.dom.controller.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggle();\n\n preventEvent(event);\n\n break;\n }\n });\n\n this.dom.disclosure.addEventListener(\"keyup\", (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n this.close();\n\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Opens the disclosure.\n *\n * Sets the disclosure's focus state to \"self\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for opening the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n open({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Opens the disclosure without entering it.\n *\n * Sets the disclosure's focus state to \"none\", calls expand, and sets isOpen to `true`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for previewing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the preview action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n preview({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Closes the disclosure.\n *\n * Sets the disclosure's focus state to \"none\", calls collapse, and sets isOpen to `false`.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for closing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n close({ force = false, preserveState = false } = {}) {\n if (!this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Collapse the disclosure.\n this._collapse();\n\n // Set the open state.\n this._open.value = false;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Toggles the open state of the disclosure.\n *\n * @public\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open or close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n toggle({ force = false, preserveState = false } = {}) {\n if (this.isOpen) {\n this.close({ force, preserveState });\n } else {\n this.open({ force, preserveState });\n }\n }\n}\n\nexport default Disclosure;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Disclosure from \"./Disclosure.js\";\nimport once from \"@drupal/once\";\n\nconst generate = ({\n options = {},\n context = document,\n disclosureSelector = \".disclosure\",\n controllerSelector = \".disclosure-toggle\",\n} = {}) => {\n once(\"graupl-disclosure-generator\", disclosureSelector, context).forEach(\n (disclosureElement) => {\n const disclosureOptions = disclosureElement.dataset\n .grauplDisclosureOptions\n ? JSON.parse(\n disclosureElement.dataset.grauplDisclosureOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n const targettedControllerSelector = `${controllerSelector}[data-graupl-disclosure-target=\"${disclosureElement.id}\"]`;\n const [controllerElement] = once(\n \"graupl-disclosure-generator\",\n targettedControllerSelector,\n context\n );\n\n if (!controllerElement) {\n console.warn(\n `No controller found for disclosure with ID \"${disclosureElement.id}\". Please ensure there is an element with the selector \"${targettedControllerSelector}\".`\n );\n\n once.remove(\"graupl-disclosure-generator\", disclosureElement);\n\n return;\n }\n\n new Disclosure({\n disclosureElement,\n controllerElement,\n initialize: true,\n ...options,\n ...disclosureOptions,\n });\n }\n );\n};\n\nexport default generate;\n"],"x_google_ignoreList":[6],"mappings":"oCAeA,SAAgBA,EAAgBC,EAAaC,EAAU,CACrD,GAAI,CACF,GAAI,OAAOA,GAAa,SAAU,CAChC,MAAMC,EAAe,OAAOD,EAE5B,MAAM,IAAIE,UACR,qEAAqED,CAAAA,UAAY,EAIrF,UAAWE,KAAOH,EAChB,GAAI,EAAEA,EAASG,CAAAA,YAAgBJ,GAAc,CAC3C,MAAMK,EAAc,OAAOJ,EAASG,CAAAA,EACpC,MAAM,IAAID,UACR,GAAGC,CAAAA,2BAA8BJ,EAAYM,IAAAA,MAAUD,CAAAA,UAAW,EAKxE,MAAO,CACLE,OAAQ,GACRC,MAAO,YAEFA,EAAO,CACd,MAAO,CACLD,OAAQ,GACRC,MAAAA,IAoBN,SAAgBC,EAAYC,EAAMC,EAAQ,CACxC,GAAI,CACF,GAAI,OAAOA,GAAW,SAAU,CAC9B,MAAMC,EAAa,OAAOD,EAE1B,MAAM,IAAIR,UACR,+DAA+DS,CAAAA,UAAU,EAI7E,UAAWR,KAAOO,EAAQ,CACxB,MAAME,EAAY,OAAOF,EAAOP,CAAAA,EAEhC,GAAIS,IAAcH,EAChB,MAAM,IAAIP,UAAU,GAAGC,CAAAA,cAAiBM,CAAAA,MAAUG,CAAAA,UAAS,EAI/D,MAAO,CACLN,OAAQ,GACRC,MAAO,YAEFA,EAAO,CACd,MAAO,CACLD,OAAQ,GACRC,MAAAA,IAgBN,SAAgBM,EAAgBH,EAAQ,CACtC,GAAI,CACF,GAAI,OAAOA,GAAW,SAA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,OAGF,IAAIT,EAAW,CACbS,kBAAAA,EACAS,kBAAAA,EACAI,WAAY,GACZ,GAAGnB,EACH,GAAGO,EACJ"}
|
|
1
|
+
{"version":3,"file":"disclosure.iife.js","names":["isValidInstance","constructor","elements","elementsType","TypeError","key","elementType","name","status","error","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidHoverType","validTypes","includes","join","isTag","tagName","HTMLElement","tag","toLowerCase","check","isValidState","validStates","isValidEvent","validEvents","addClass","className","element","length","classList","add","removeClass","remove","selectAllFocusableElements","context","document","fn","querySelector","elements","Array","from","querySelectorAll","tabbableElements","filter","check","getAttribute","selectFirstFocusableElement","selectLastFocusableElement","selectNextFocusableElement","index","indexOf","selectPreviousFocusableElement","keyPress","event","key","keyCode","keys","Enter","Space","Escape","ArrowUp","ArrowRight","ArrowDown","ArrowLeft","Home","End","Tab","Object","find","preventEvent","preventDefault","stopPropagation","TransactionalValue","constructor","initialValue","options","_equals","equals","Object","is","_current","_committed","value","val","committed","isDirty","commit","reset","update","fn","isValidType","initializeStorage","type","window","Graupl","getStorage","setStorage","data","clearStorage","pushToStorage","key","value","getFromStorage","removeFromStorage","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","storage","Component","_dom","_protectedDOMElements","_selectors","_elements","_classes","initialize","_durations","_delays","_focusState","_currentEvent","_breakpoint","_mediaQueryString","_mediaQueryList","_mediaQueryListEventCallback","event","matches","_intervals","_timeouts","_listeners","_events","_prefix","_key","_storageKey","_id","_valid","_errors","constructor","prefix","key","initializeClass","_validate","Error","name","errors","join","_generateKey","error","console","init","dom","selectors","elements","classes","durations","delays","intervals","timeouts","listeners","events","value","focusState","currentEvent","breakpoint","mediaQuery","Object","keys","length","domElements","domKey","Array","isArray","forEach","element","index","domChecks","HTMLElement","push","message","querySelectors","querySelector","querySelectorChecks","className","classListChecks","status","durationName","durationChecks","delayName","delayChecks","keyCheck","prefixCheck","regenerate","Math","random","toString","replace","substring","_setIds","_setAriaAttributes","_setCustomProps","_setDOMElementType","elementType","context","overwrite","strict","includes","from","querySelectorAll","filteredElements","filter","item","parentElement","_resetDOMElementType","_setDOMElements","_createChildElements","_handleMediaMatch","_breakpointWidth","window","matchMedia","addEventListener","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_store","initializeStorage","pushToStorage","_unstore","removeFromStorage","_setInterval","callback","delay","scope","_clearInterval","setInterval","clearInterval","_setTimeout","_clearTimeout","setTimeout","clearTimeout","_dispatchEvent","eventType","dispatchEvent","_addEventListener","type","listener","options","_removeEventListener","removeEventListener","indexOf","splice","_removeEventListeners","dispose","isValidClassList","isValidType","isTag","addClass","removeClass","keyPress","preventEvent","TransactionalValue","Component","Disclosure","_dom","controller","disclosure","content","_protectedDOMElements","_selectors","_classes","open","close","transition","initialize","_durations","_open","_shouldOpen","_closeOnBlur","_mediaQueryListEventCallback","event","matches","isOpen","preserveState","hasOpened","shouldOpen","_storageKey","_events","expand","CustomEvent","bubbles","detail","collapse","constructor","disclosureElement","controllerElement","disclosureContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","autoOpen","mediaQuery","prefix","key","initializeClass","_breakpoint","_mediaQueryString","dom","_setDOMElements","_setIds","_setAriaAttributes","_setCustomProps","_handleMediaMatch","_handleFocus","_handleClick","_handleKeydown","_handleKeyup","_store","getAttribute","window","matchMedia","_expand","emit","_collapse","error","console","requestAnimationFrame","value","breakpoint","committed","shouldFocus","check","currentEvent","_validate","booleans","booleanChecks","_errors","push","message","_valid","id","_id","setAttribute","style","setProperty","_resetDOMElementType","_setDOMElementType","context","transitionlass","setTimeout","removeAttribute","_dispatchEvent","innert","_addEventListener","relatedTarget","contains","button","toggle","document","focusState","target","force","commit","preview","wsRE","attrName","doc","document","attr","element","op","value","attrSelector","id","TypeError","test","RangeError","checkElement","itemToCheck","Element","getElements","selector","context","elements","Document","DocumentFragment","querySelectorAll","Array","prototype","slice","call","filterAndModify","apply","filter","selected","matches","updateAttribute","add","remove","result","trim","split","forEach","item","indexOf","push","attribute","join","once","find","Disclosure","once","generate","options","context","document","disclosureSelector","controllerSelector","forEach","disclosureElement","disclosureOptions","dataset","grauplDisclosureOptions","JSON","parse","replace","targettedControllerSelector","id","controllerElement","console","warn","remove","initialize"],"sources":["../../../packages/core/src/js/validate.js","../../../packages/core/src/js/domHelpers.js","../../../packages/core/src/js/eventHandlers.js","../../../packages/core/src/js/TransactionalValue.js","../../../packages/core/src/js/storage.js","../../../packages/core/src/js/Component.js","../../../packages/core/src/js/disclosure/Disclosure.js","../../../node_modules/@drupal/once/src/once.js","../../../packages/core/src/js/disclosure/generator.js"],"sourcesContent":["/**\n * Check to see if the provided elements have a specific constructor.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking instanceof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {object} constructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidInstance(constructor, elements) {\n try {\n if (typeof elements !== \"object\") {\n const elementsType = typeof elements;\n\n throw new TypeError(\n `Elements given to isValidInstance() must be inside of an object. \"${elementsType}\" given.`\n );\n }\n\n for (const key in elements) {\n if (!(elements[key] instanceof constructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${constructor.name}. \"${elementType}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are of a specific type.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * This is essentially just a wrapper function around checking typeof with\n * more descriptive error message to help debugging.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} type - The type to check for.\n * @param {object} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidType(type, values) {\n try {\n if (typeof values !== \"object\") {\n const valuesType = typeof values;\n\n throw new TypeError(\n `Values given to isValidType() must be inside of an object. \"${valuesType}\" given.`\n );\n }\n\n for (const key in values) {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(`${key} must be a ${type}. \"${valueType}\" given.`);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided values are valid query selectors.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isQuerySelector(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isQuerySelector() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n try {\n if (values[key] === null) {\n throw new Error();\n }\n\n document.querySelector(values[key]);\n } catch {\n throw new TypeError(\n `${key} must be a valid query selector. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided value is either a string or an array of strings.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string, string[]>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidClassList(values) {\n try {\n if (typeof values !== \"object\" || Array.isArray(values)) {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidClassList() must be inside of an object. \"${type}\" given.`\n );\n }\n\n for (const key in values) {\n const type = typeof values[key];\n\n if (type !== \"string\") {\n if (Array.isArray(values[key])) {\n values[key].forEach((value) => {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `${key} must be a string or an array of strings. An array containing non-strings given.`\n );\n }\n });\n } else {\n throw new TypeError(\n `${key} must be a string or an array of strings. \"${type}\" given.`\n );\n }\n } else {\n const obj = {};\n obj[key] = values[key];\n\n isQuerySelector(obj);\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid hover types.\n *\n * Available types are: `\"off\"`, `\"on\"`, and `\"dynamic\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidHoverType(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidHoverType() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validTypes = [\"off\", \"on\", \"dynamic\"];\n\n for (const key in values) {\n if (!validTypes.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validTypes.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Checks to see if the provided elements are using a specific tag.\n *\n * The elements must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `true` if the check is successful.\n *\n * @param {string} tagName - The name of the tag.\n * @param {Object<HTMLElement>} elements - The element(s) to check.\n * @return {boolean} - The result of the check.\n */\nexport function isTag(tagName, elements) {\n if (\n isValidType(\"string\", { tagName }).status &&\n isValidInstance(HTMLElement, elements).status\n ) {\n const tag = tagName.toLowerCase();\n let check = true;\n\n for (const key in elements) {\n if (elements[key].tagName.toLowerCase() !== tag) check = false;\n }\n\n return check;\n } else {\n return false;\n }\n}\n\n/**\n * Check to see if the provided values are valid focus states for a menu.\n *\n * Available states are: `\"none\"`, `\"self\"`, and `\"child\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidState(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidState() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validStates = [\"none\", \"self\", \"child\"];\n\n for (const key in values) {\n if (!validStates.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validStates.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n\n/**\n * Check to see if the provided values are valid event types for a menu.\n *\n * Available events are: `\"none\"`, `\"mouse\"`, `\"keyboard\"`, and `\"character\"`.\n *\n * The values must be provided inside of an object\n * so the variable name can be retrieved in case of errors.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Object<string>} values - The value(s) to check.\n * @return {Object<boolean, string>} - The result of the check.\n */\nexport function isValidEvent(values) {\n try {\n if (typeof values !== \"object\") {\n const type = typeof values;\n\n throw new TypeError(\n `Values given to isValidEvent() must be inside of an object. \"${type}\" given.`\n );\n }\n\n const validEvents = [\"none\", \"mouse\", \"keyboard\", \"character\"];\n\n for (const key in values) {\n if (!validEvents.includes(values[key])) {\n throw new TypeError(\n `${key} must be one of the following values: ${validEvents.join(\n \", \"\n )}. \"${values[key]}\" given.`\n );\n }\n }\n\n return {\n status: true,\n error: null,\n };\n } catch (error) {\n return {\n status: false,\n error,\n };\n }\n}\n","/**\n * Add a class or array of classes to an element.\n *\n * @param {string|string[]} className - The class or classes to add.\n * @param {HTMLElement} element - The element to add the class to.\n */\nexport function addClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.add(className);\n } else {\n element.classList.add(...className);\n }\n}\n\n/**\n * Remove a class or array of classes from an element.\n *\n * @param {string|string[]} className - The class or classes to remove.\n * @param {HTMLElement} element - The element to remove the class from.\n */\nexport function removeClass(className, element) {\n // Gracefully handle empty strings or arrays.\n if (className === \"\" || className.length === 0) {\n return;\n }\n\n if (typeof className === \"string\") {\n element.classList.remove(className);\n } else {\n element.classList.remove(...className);\n }\n}\n\n/**\n * Select all focusable elements within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement[]} - An array of focusable elements.\n */\nexport function selectAllFocusableElements(context = document, fn = null) {\n const querySelector =\n \"a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),[tabindex]\";\n const elements = Array.from(context.querySelectorAll(querySelector));\n\n const tabbableElements = elements.filter((element) => {\n let check = true;\n\n if (element.getAttribute(\"tabindex\") === \"-1\") check = false;\n\n return check;\n });\n\n if (fn !== null) {\n return tabbableElements.filter(fn);\n } else {\n return tabbableElements;\n }\n}\n\n/**\n * Select the first focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The first focusable element or false if none found.\n */\nexport function selectFirstFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[0] || false;\n}\n\n/**\n * Select the last focusable element within a given context.\n *\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The last focusable element or false if none found.\n */\nexport function selectLastFocusableElement(context = document, fn = null) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n\n return tabbableElements[tabbableElements.length - 1] || false;\n}\n\n/**\n * Select the next focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The next focusable element or false if none found.\n */\nexport function selectNextFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === tabbableElements.length - 1\n ? false\n : tabbableElements[index + 1];\n}\n\n/**\n * Select the previous focusable element relative to the given element within a context.\n *\n * @param {HTMLElement} element - The reference element.\n * @param {HTMLElement} [context = document] - The context in which to search for focusable elements.\n * @param {?function(HTMLElement): boolean} [fn = null] - An optional addition filter function to process out focusable elements.\n * @return {HTMLElement|boolean} - The previous focusable element or false if none found.\n */\nexport function selectPreviousFocusableElement(\n element,\n context = document,\n fn = null\n) {\n const tabbableElements = selectAllFocusableElements(context, fn);\n const index = tabbableElements.indexOf(element);\n\n return index === 0 ? false : tabbableElements[index - 1];\n}\n","/**\n * Retrieves the pressed key from an event.\n *\n * @param {KeyboardEvent} event - The keyboard event.\n * @return {string} - The name of the key or an empty string.\n */\nexport function keyPress(event) {\n try {\n // Use event.key or event.keyCode to support older browsers.\n const key = event.key || event.keyCode;\n const keys = {\n Enter: key === \"Enter\" || key === 13,\n Space: key === \" \" || key === \"Spacebar\" || key === 32,\n Escape: key === \"Escape\" || key === \"Esc\" || key === 27,\n ArrowUp: key === \"ArrowUp\" || key === \"Up\" || key === 38,\n ArrowRight: key === \"ArrowRight\" || key === \"Right\" || key === 39,\n ArrowDown: key === \"ArrowDown\" || key === \"Down\" || key === 40,\n ArrowLeft: key === \"ArrowLeft\" || key === \"Left\" || key === 37,\n Home: key === \"Home\" || key === 36,\n End: key === \"End\" || key === 35,\n Tab: key === \"Tab\" || key === 9,\n };\n\n return Object.keys(keys).find((key) => keys[key] === true) || \"\";\n } catch {\n // Return an empty string if something goes wrong.\n return \"\";\n }\n}\n\n/**\n * Stops an event from taking action.\n *\n * @param {Event} event - The event.\n */\nexport function preventEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\n","/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\n *\n * Useful when you need to:\n * - Track in-progress edits and revert to the last saved state.\n * - Compare pending and committed states.\n * - Know if a value has changed since last commit.\n *\n * @example\n * // Managing a form field\n * const username = new TransactionalValue(\"Nick\");\n * username.value = \"NickDJM\";\n * if (username.isDirty) {\n * console.log(\"Unsaved changes detected\");\n * username.commit(); // saves the new value\n * }\n *\n * @example\n * // Reverting edits\n * const counter = new TransactionalValue(10);\n * counter.value = 15;\n * counter.reset(); // reverts to 10\n */\nexport class TransactionalValue {\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {{ equals?: function(*, *): boolean }} [options] - Optional config.\n * @param {function(*, *): boolean} [options.equals] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, options = {}) {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @private\n *\n * @type {function(*, *): boolean}\n */\n this._equals = options.equals || Object.is;\n\n /**\n * The current, editable value.\n *\n * @private\n *\n * @type {*}\n */\n this._current = initialValue;\n\n /**\n * The last committed (baseline) value.\n *\n * @private\n *\n * @type {*}\n */\n this._committed = initialValue;\n }\n\n /**\n * Gets the current editable value.\n *\n * @return {*} The current value.\n *\n * @see _current\n */\n get value() {\n return this._current;\n }\n\n /**\n * Sets the current editable value.\n *\n * @param {*} val - The new value.\n */\n set value(val) {\n this._current = val;\n }\n\n /**\n * Gets the last committed (baseline) value.\n *\n * @readonly\n *\n * @return {*} The last committed value.\n *\n * @see _committed\n */\n get committed() {\n return this._committed;\n }\n\n /**\n * Checks whether the current value differs from the committed one.\n *\n * @readonly\n *\n * @return {boolean} `true` if current and committed values differ.\n */\n get isDirty() {\n return !this._equals(this._current, this._committed);\n }\n\n /**\n * Commits the current value, setting it as the new baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n commit() {\n this._committed = this._current;\n return this;\n }\n\n /**\n * Resets the current value to the committed baseline.\n *\n * @return {TransactionalValue} The current instance.\n */\n reset() {\n this._current = this._committed;\n return this;\n }\n\n /**\n * Applies a functional update to the current value.\n *\n * @param {function(*): *} fn - A function that receives the previous value and returns the new one.\n * @return {TransactionalValue} The current instance.\n *\n * @example\n * const t = new TransactionalValue(1);\n * t.update(n => n + 1); // 2\n */\n update(fn) {\n this._current = fn(this._current);\n return this;\n }\n}\n","/**\n * @file\n * Provides a system to get and store Graupl data in the browser.\n */\n\nimport { isValidType } from \"./validate.js\";\n\n/**\n * Initializes the storage system.\n *\n * @param {?string} [type = null] - The type of storage to initialize.\n */\nexport function initializeStorage(type = null) {\n window.Graupl = window.Graupl || {};\n\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = window.Graupl[type] || {};\n }\n}\n\n/**\n * Get the storage object.\n *\n * @param {?string} type - The type of storage to get.\n * @return {object} - The storage object.\n */\nexport function getStorage(type = null) {\n if (isValidType(\"string\", { type })) {\n return window.Graupl[type];\n }\n\n return window.Graupl;\n}\n\n/**\n * Set the storage object of a given type.\n *\n * @param {string} type - The type of storage to set.\n * @param {object} data - The data to set.\n */\nexport function setStorage(type, data = {}) {\n if (isValidType(\"string\", { type }) && isValidType(\"object\", { data })) {\n window.Graupl[type] = data;\n }\n}\n\n/**\n * Clear the storage object of a given type.\n *\n * @param {string} type - The type of storage to clear.\n */\nexport function clearStorage(type) {\n if (isValidType(\"string\", { type })) {\n window.Graupl[type] = {};\n }\n}\n\n/**\n * Push a value to the storage object.\n *\n * @param {string} type - The type of storage to push to.\n * @param {string} key - The key to use for the value.\n * @param {*} value - The value to store.\n */\nexport function pushToStorage(type, key, value) {\n if (isValidType(\"string\", { type, key })) {\n window.Graupl[type][key] = value;\n }\n}\n\n/**\n * Get a value from the storage object.\n *\n * @param {string }type - The type of storage to get from.\n * @param {string }key - The key to get the value from.\n * @return {*} - The value from the storage object.\n */\nexport function getFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n return window.Graupl[type][key];\n }\n\n return null;\n}\n\n/**\n * Remove a value from the storage object.\n *\n * @param {string} type - The type of storage to remove from.\n * @param {string} key - The key to remove the value from.\n */\nexport function removeFromStorage(type, key) {\n if (isValidType(\"string\", { type, key })) {\n delete window.Graupl[type][key];\n }\n}\n\nexport default {\n initializeStorage,\n getStorage,\n setStorage,\n clearStorage,\n pushToStorage,\n getFromStorage,\n removeFromStorage,\n};\n","/**\n * @file\n * A generic component class.\n */\n\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n} from \"./validate.js\";\nimport storage from \"./storage.js\";\n\nclass Component {\n /**\n * The DOM elements within the component.\n *\n * @protected\n *\n * @type {Object<HTMLElement, HTMLElement[]>}\n */\n _dom = {};\n\n /**\n * The DOM elements within the component that cannot be reset or generated by the component itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _protectedDOMElements = [];\n\n /**\n * The query selectors used by the component.\n *\n * @protected\n *\n * @type {Object<string>}\n */\n _selectors = {};\n\n /**\n * The instantiated elements within the component.\n *\n * @protected\n *\n * @type {object}\n */\n _elements = {};\n\n /**\n * The CSS classes to apply when the component is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n *\n * @\n */\n _classes = {\n initialize: \"\",\n };\n\n /**\n * The duration times (in milliseconds) for various aspects throughout the component.\n *\n * @protected\n *\n * @type {Object<number>}\n */\n _durations = {};\n\n /**\n * The delay times (in milliseconds) for various aspects throughout the component.\n *\n * @protected\n *\n * @type {Object<number>}\n */\n _delays = {};\n\n /**\n * The current state of the component's focus.\n *\n * @protected\n *\n * @type {string}\n */\n _focusState = \"none\";\n\n /**\n * The last type of event triggered within the component.\n *\n * @protected\n *\n * @type {string}\n */\n _currentEvent = \"none\";\n\n /**\n * The breakoint that the component will call media query list events.\n *\n * @protected\n *\n * @type {string}\n */\n _breakpoint = \"\";\n\n /**\n * The media query to use to trigger media query list events.\n *\n * @type {string}\n */\n _mediaQueryString = \"\";\n\n /**\n * This MediaQueryList for the component.\n *\n * @protected\n *\n * @type {MediaQueryList|null}\n */\n _mediaQueryList = null;\n\n /**\n * A callback for media query list events.\n *\n * @protected\n *\n * @type {Function}\n *\n * @param {MediaQueryListEvent} event - The event.\n */\n _mediaQueryListEventCallback = (event) => {\n // Add functionality to handle media matches.\n if (event.matches) {\n // Do something.\n } else {\n // Do something else.\n }\n };\n\n /**\n * Intervals throughout the component.\n *\n * @protected\n *\n * @type {Object<Function>}\n */\n _intervals = {};\n\n /**\n * Timeouts throughout the component.\n *\n * @protected\n *\n * @type {Object<Function>}\n */\n _timeouts = {};\n\n /**\n * Event listeners throughout the component.\n *\n * @protected\n *\n * @type {object[]}\n */\n _listeners = [];\n\n /**\n * Custom events that can be triggered throughout the component.\n *\n * @protected\n *\n * @type {Object<CustomEvent>}\n */\n _events = {};\n\n /**\n * The prefix used for CSS custom properties and attributes.\n *\n * @protected\n *\n * @type {string}\n */\n _prefix = \"graupl-\";\n\n /**\n * The key used to generate IDs throughout the component.\n *\n * @protected\n *\n * @type {string}\n */\n _key = \"\";\n\n /**\n * The key used for storage.\n *\n * @protected\n *\n * @type {string}\n */\n _storageKey = \"components\";\n\n /**\n * The main ID of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _id = \"\";\n\n /**\n * The validity state of the component.\n *\n * @protected\n *\n * @type {boolean}\n */\n _valid = true;\n\n /**\n * The errors found throughout the component.\n *\n * @protected\n *\n * @type {string[]}\n */\n _errors = [];\n\n /**\n * Constructs a new component.\n *\n * @param {object} [options = {}] - The options for generating the component.\n * @param {?string} [options.prefix = graupl-] - The prefix used for CSS custom properties and attributes.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the component.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class(es) to apply when the component is initializing.\n */\n constructor({\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n } = {}) {\n // Set the classes.\n this._classes.initialize = initializeClass || \"\";\n\n // Set the prefix and key.\n this._prefix = prefix || \"\";\n this._key = key || \"\";\n }\n\n /**\n * Initialize the component.\n */\n initialize() {\n try {\n if (!this._validate()) {\n throw new Error(\n `Graupl ${this.constructor.name}: Cannot initialize component. The following errors have been found:\\n - ${this.errors.join(\"\\n - \")}`\n );\n }\n\n this._generateKey();\n } catch (error) {\n console.error(error);\n }\n }\n init() {\n this.initialize();\n }\n\n /**\n * The DOM elements within the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _dom\n */\n get dom() {\n return this._dom;\n }\n\n /**\n * The query selectors used by the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _selectors\n */\n get selectors() {\n return this._selectors;\n }\n\n /**\n * The instantiated elements within the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _elements\n */\n get elements() {\n return this._elements;\n }\n\n /**\n * The CSS classes to apply when the component is in various states.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _classes\n */\n get classes() {\n return this._classes;\n }\n\n /**\n * The duration times (in milliseconds) for various aspects throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _durations\n */\n get durations() {\n return this._durations;\n }\n\n /**\n * The delay times (in milliseconds) for various aspects throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _delays\n */\n get delays() {\n return this._delays;\n }\n\n /**\n * Intervals throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _intervals\n */\n get intervals() {\n return this._intervals;\n }\n\n /**\n * Timeouts throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _timeouts\n */\n get timeouts() {\n return this._timeouts;\n }\n\n /**\n * Event listeners throughout the component.\n *\n * @readonly\n *\n * @type {object[]}\n *\n * @see _listeners\n */\n get listeners() {\n return this._listeners;\n }\n\n /**\n * Custom events that can be triggered throughout the component.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _events\n */\n get events() {\n return this._events;\n }\n\n /**\n * The class(es) to apply when the component is initializing.\n *\n * @type {string|string[]}\n *\n * @see _classes.initialize\n */\n get initializeClass() {\n return this._classes.initialize;\n }\n\n set initializeClass(value) {\n isValidClassList({ initializeClass: value });\n\n if (this._classes.initialize !== value) {\n this._classes.initialize = value;\n }\n }\n\n /**\n * The current state of the component's focus.\n *\n * @type {string}\n *\n * @see _focusState\n */\n get focusState() {\n return this._focusState;\n }\n\n set focusState(value) {\n isValidState({ focusState: value });\n\n if (this._focusState !== value) {\n this._focusState = value;\n }\n }\n\n /**\n * The last type of event triggered within the component.\n *\n * @type {string}\n *\n * @see _currentEvent\n */\n get currentEvent() {\n return this._currentEvent;\n }\n\n set currentEvent(value) {\n isValidEvent({ currentEvent: value });\n\n if (this._currentEvent !== value) {\n this._currentEvent = value;\n }\n }\n\n /**\n * The breakoint that the component will call media query list events.\n *\n * @type {string}\n *\n * @see _breakpoint\n */\n get breakpoint() {\n return this._breakpoint;\n }\n\n set breakpoint(value) {\n isValidType(\"string\", { breakpoint: value });\n\n if (this._breakpoint !== value) {\n this._breakpoint = value;\n }\n }\n\n /**\n * The media query to use to trigger media query list events.\n *\n * @type {string}\n *\n * @see _mediaQueryString\n */\n get mediaQuery() {\n if (this._mediaQueryString !== \"\") {\n return this._mediaQueryString;\n }\n\n return `(width <= ${this._breakpoint})`;\n }\n\n set mediaQuery(value) {\n isValidType(\"string\", { mediaQuery: value });\n\n if (this._mediaQueryString !== value) {\n this._mediaQueryString = value;\n }\n }\n\n /**\n * The prefix used for CSS custom properties and attributes.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _prefix\n */\n get prefix() {\n return this._prefix;\n }\n\n /**\n * The key used to generate IDs throughout the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _key\n */\n get key() {\n return this._key;\n }\n\n /**\n * An array to hold error messages.\n *\n * @readonly\n *\n * @type {string[]}\n *\n * @see _errors\n */\n get errors() {\n return this._errors;\n }\n\n /**\n * Validates all aspects of the component to ensure proper functionality.\n *\n * Keys are altered to match the arguments passed in during creation where possible.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation checks.\n */\n _validate() {\n // DOM checks.\n if (Object.keys(this._dom).length > 0) {\n const domElements = {};\n\n // Loop through and add \"Element\" to the end of each key in _dom.\n for (const domKey of Object.keys(this._dom)) {\n // If we're dealing with an array, we need to check each element in the array.\n if (Array.isArray(this._dom[domKey])) {\n this._dom[domKey].forEach((element, index) => {\n domElements[`${domKey}Element[${index}]`] = element;\n });\n }\n\n domElements[`${domKey}Element`] = this._dom[domKey];\n }\n\n // Check the DOM elements.\n const domChecks = isValidInstance(HTMLElement, domElements);\n\n // Handle DOM check failure.\n if (!domChecks) {\n this._errors.push(domChecks.message);\n this._valid = false;\n }\n }\n\n // Query selector checks.\n if (Object.keys(this._selectors).length > 0) {\n const querySelectors = {};\n\n // Loop through and add \"Selector\" to the end of each key in _selectors.\n for (const querySelector of Object.keys(this._selectors)) {\n querySelectors[`${querySelector}Selector`] =\n this._selectors[querySelector];\n }\n\n // Check the query selectors.\n const querySelectorChecks = isQuerySelector(querySelectors);\n\n // Handle query selector check failure.\n if (!querySelectorChecks) {\n this._errors.push(querySelectorChecks.message);\n this._valid = false;\n }\n }\n\n // Class list checks.\n if (Object.keys(this._classes).length > 0) {\n const classes = {};\n\n // Loop through and add \"Class\" to the end of each key in _classes.\n for (const className of Object.keys(this._classes)) {\n if (this._classes[className] === \"\") {\n continue;\n }\n\n classes[`${className}Class`] = this._classes[className];\n }\n\n // Check the class lists.\n const classListChecks = isValidClassList(classes);\n\n // Handle class list check failure.\n if (!classListChecks.status) {\n this._errors.push(classListChecks.error.message);\n this._valid = false;\n }\n }\n\n // Duration checks.\n if (Object.keys(this._durations).length > 0) {\n const durations = {};\n\n // Loop through and add \"Duration\" to the end of each key in _durations.\n for (const durationName of Object.keys(this._durations)) {\n durations[`${durationName}Duration`] = this._durations[durationName];\n }\n\n // Check the durations.\n const durationChecks = isValidType(\"number\", durations);\n\n // Handle duration check failure.\n if (!durationChecks.status) {\n this._errors.push(durationChecks.error.message);\n this._valid = false;\n }\n }\n\n // Delay checks.\n if (Object.keys(this.delays).length > 0) {\n const delays = {};\n\n // Loop through and add \"Delay\" to the end of each key in delays.\n for (const delayName of Object.keys(this.delays)) {\n delays[`${delayName}Delay`] = this.delays[delayName];\n }\n\n // Check the delays.\n const delayChecks = isValidType(\"number\", delays);\n\n // Handle delay check failure.\n if (!delayChecks.status) {\n this._errors.push(delayChecks.error.message);\n this._valid = false;\n }\n }\n\n // Key check.\n if (this._key !== \"\") {\n // Check the key.\n const keyCheck = isValidType(\"string\", { key: this._key });\n\n // Handle key check failure.\n if (!keyCheck.status) {\n this._errors.push(keyCheck.error.message);\n this._valid = false;\n }\n }\n\n // Prefix check.\n if (this._prefix !== \"\") {\n const prefixCheck = isValidType(\"string\", { prefix: this._prefix });\n\n if (!prefixCheck.status) {\n this._errors.push(prefixCheck.error.message);\n this._valid = false;\n }\n }\n\n return this._valid;\n }\n\n /**\n * Generates a key for the component.\n *\n * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.\n */\n _generateKey(regenerate = false) {\n if (this._key === \"\" || regenerate) {\n this._key = Math.random()\n .toString(36)\n .replace(/[^a-z]+/g, \"\")\n .substring(0, 10);\n }\n }\n\n /**\n * Sets IDs throughout the component.\n */\n _setIds() {\n // Add functionality to set IDs throughout the component.\n }\n\n /**\n * Sets ARIA attributes throughout the component.\n */\n _setAriaAttributes() {\n // Add functionality to set attributes throughout the component.\n }\n\n /**\n * Sets custom props throughout the component.\n */\n _setCustomProps() {\n // Add functionality to set custom props throughout the component.\n }\n\n /**\n * Sets DOM elements throughout the component.\n *\n * Elements listed in _protectedDOMElements cannot be set using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to populate.\n * @param {Object<HTMLElement,boolean>} [options = {}] - The options for setting the DOM element type.\n * @param {HTMLElement} [options.context] - The element used as the base context for the querySelector.\n * @param {boolean} [options.overwrite = true] - A flag to set if the existing elements will be overwritten.\n * @param {boolean} [options.strict = true] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { context, overwrite = true, strict = true } = {}\n ) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n\n // Make sure the element type can actually be set through this method.\n if (this._protectedDOMElements.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be set through _setDOMElementType because it is a protected element.`\n );\n }\n\n // Make sure the context element is actually an HTMLELement.\n isValidInstance(HTMLElement, { context });\n\n // Get the all elements matching the selector in the context.\n const domElements = Array.from(\n context.querySelectorAll(this.selectors[elementType])\n );\n\n // Filter the elements so if `strict` is true, only direct children of the context are kept.\n const filteredElements = domElements.filter((item) =>\n strict ? item.parentElement === context : true\n );\n\n if (Array.isArray(this._dom[elementType])) {\n if (overwrite) {\n this._dom[elementType] = filteredElements;\n } else {\n this._dom[elementType] = [\n ...this._dom[elementType],\n ...filteredElements,\n ];\n }\n } else {\n this._dom[elementType] = filteredElements[0] || null;\n }\n }\n\n /**\n * Resets DOM elements throughout the component.\n *\n * Elements listed in _protectedDOMElements cannot be reset using this method.\n *\n * @protected\n *\n * @param {string} elementType - The type of element to clear.\n */\n _resetDOMElementType(elementType) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" is not a valid element type.`\n );\n }\n\n // Make sure the element type can actually be reset through this method.\n if (this._protectedDOMElements.includes(elementType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${elementType}\" element cannot be reset through _resetDOMElementType because it is a protected element.`\n );\n }\n\n if (Array.isArray(this._dom[elementType])) {\n this._dom[elementType] = [];\n } else {\n this._dom[elementType] = null;\n }\n }\n\n /**\n * Sets all DOM elements throughout the component.\n *\n * Utilizes _setDOMElementType and _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n // Add functionality to set DOM Elements throughout the component.\n }\n\n /**\n * Creates and initializes child elements throughout the component.\n *\n * @protected\n */\n _createChildElements() {\n // Add functionality to handle creating child elements throughout the component.\n }\n\n /**\n * Handles media match events throughout the component.\n *\n * @protected\n */\n _handleMediaMatch() {\n if (this._breakpointWidth === \"\") {\n return;\n }\n\n this._mediaQueryList = window.matchMedia(this.mediaQuery);\n this._mediaQueryList.addEventListener(\n \"change\",\n this._mediaQueryListEventCallback\n );\n this._mediaQueryListEventCallback(this._mediaQueryList);\n }\n\n /**\n * Handles focus events through the component.\n *\n * @protected\n */\n _handleFocus() {\n // Add functionality to handle focus events throughout the component.\n }\n\n /**\n * Handles click events through the component.\n *\n * @protected\n */\n _handleClick() {\n // Add functionality to handle click events throughout the component.\n }\n\n /**\n * Handles keydown events through the component.\n *\n * @protected\n */\n _handleKeydown() {\n // Add functionality to handle keydown events throughout the component.\n }\n\n /**\n * Handles keyup events through the component.\n *\n * @protected\n */\n _handleKeyup() {\n // Add functionality to handle keyup events throughout the component.\n }\n\n /**\n * Stores the component into the global Graupl storage object.\n *\n * @protected\n */\n _store() {\n // Set up the storage.\n storage.initializeStorage(this._storageKey);\n storage.pushToStorage(\n this._storageKey,\n this._id !== \"\" ? this._id : this._key,\n this\n );\n }\n\n /**\n * Removes the component from the global Graupl storage object.\n *\n * @protected\n */\n _unstore() {\n storage.removeFromStorage(\n this._storageKey,\n this._id !== \"\" ? this._id : this._key\n );\n }\n\n /**\n * Sets an interval within the component.\n *\n * @protected\n *\n * @param {Function} [callback] - The callback function.\n * @param {number} [delay] - The time (in milliseconds) of the delay.\n * @param {string} [scope = _default] - The scope of the interval (used to store the interval in _intervals).\n */\n _setInterval(callback, delay, scope = \"_default\") {\n this._clearInterval(scope);\n\n this._intervals[scope] = setInterval(callback, delay);\n }\n\n /**\n * Clears the interval within the component.\n *\n * @protected\n *\n * @param {string} [scope = _default] - The scope of the interval (used to get the interval from _intervals).\n */\n _clearInterval(scope = \"_default\") {\n clearInterval(this._intervals[scope]);\n }\n\n /**\n * Sets a timeout within the component.\n *\n * @protected\n *\n * @param {Function} [callback] - The callback function.\n * @param {number} [delay] - The time (in milliseconds) of the delay.\n * @param {string} [scope = _default] - The scope of the timeout (used to store the timeout in _timeouts).\n */\n _setTimeout(callback, delay, scope = \"_default\") {\n this._clearTimeout(scope);\n\n this._timeouts[scope] = setTimeout(callback, delay);\n }\n\n /**\n * Clears the timeout within the component.\n *\n * @protected\n *\n * @param {string} [scope = _default] - The scope of the timeout (used to get the timeout from _timeouts).\n */\n _clearTimeout(scope = \"_default\") {\n clearTimeout(this._timeouts[scope]);\n }\n\n /**\n * Dispatch a custom event on an element in the DOM.\n *\n * @param {string} eventType - The type of the event to dispatch.\n * @param {HTMLElement} element - The element to dispatch the event on.\n */\n _dispatchEvent(eventType, element) {\n // Make sure the event type exists.\n if (!Object.keys(this.events).includes(eventType)) {\n throw new Error(\n `Graupl ${this.constructor.name}: \"${eventType}\" is not a valid event type.`\n );\n }\n\n // Make sure the element is actually an HTML Element.\n isValidInstance(HTMLElement, { element });\n\n // Dispatch the event.\n element.dispatchEvent(this.events[eventType]);\n }\n\n /**\n * Add an event listener to an element and register it within the component.\n *\n * @param {string} type - The type of event to listen for.\n * @param {HTMLElement} element - The element to add the listener to.\n * @param {Function} listener - The listener callback.\n * @param {object|boolean} [options = {}] - Options to pass to the listener.\n */\n _addEventListener(type, element, listener, options = {}) {\n // Add the listener.\n element.addEventListener(type, listener, options);\n\n // Store it in the component.\n this._listeners.push({\n type,\n element,\n listener,\n options,\n });\n }\n\n /**\n * Remove an event listener to an element and unregister it within the component.\n *\n * @param {string} type - The type of event to listen for.\n * @param {HTMLElement} element - The element to add the listener to.\n * @param {Function} listener - The listener callback.\n * @param {object|boolean} [options = {}] - Options to pass to the listener.\n */\n _removeEventListener(type, element, listener, options = {}) {\n // Remove the listener.\n element.removeEventListener(type, listener, options);\n\n // Remove it from the component storage.\n const index = this._listeners.indexOf({\n type,\n element,\n listener,\n options,\n });\n\n if (index !== -1) {\n this._listeners.splice(index);\n }\n }\n\n /**\n * Removes all event listeners registered in the component.\n *\n * @protected\n */\n _removeEventListeners() {\n this._listeners.forEach(({ type, element, listener, options }) => {\n this._removeEventListener(type, element, listener, options);\n });\n }\n\n /**\n * Disposes of the current instantiated component.\n *\n * Removes all event listeners and delete's the object.\n */\n dispose() {\n this._removeEventListeners();\n this._unstore();\n\n delete this;\n }\n}\n\nexport default Component;\n","/**\n * @file\n * The Disclosure class.\n */\n\nimport { isValidClassList, isValidType, isTag } from \"../validate.js\";\nimport { addClass, removeClass } from \"../domHelpers.js\";\nimport { keyPress, preventEvent } from \"../eventHandlers.js\";\nimport { TransactionalValue } from \"../TransactionalValue.js\";\nimport Component from \"../Component.js\";\n\nclass Disclosure extends Component {\n /**\n * The DOM elements within the disclosure.\n *\n * @protected\n *\n * @type {Object<HTMLElement>}\n *\n * @property {HTMLElement} controller - The disclosure toggle element.\n * @property {HTMLElement} disclosure - The disclosure element.\n * @property {HTMLElement} content - The disclosure content element.\n */\n _dom = {\n controller: null,\n disclosure: null,\n content: null,\n };\n\n /**\n * The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n *\n * @protected\n *\n * @type {string[]}\n */\n _protectedDOMElements = [\"controller\", \"disclosure\"];\n\n /**\n * The query selectors used by the disclosure.\n *\n * @protected\n *\n * @type {Object<string>}\n *\n * @property {string} content - The query selector for the disclosure content.\n */\n _selectors = {\n content: \"\",\n };\n\n /**\n * The CSS classes to apply when the disclosure is in various states.\n *\n * @protected\n *\n * @type {Object<string, string[]>}\n *\n * @property {string|string[]} open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} close - The class(es) to apply when the disclousre is closed.\n * @property {string|string[]} tranistion - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} initialize - The class(es) to apply when the disclosure is initializing.\n */\n _classes = {\n open: \"show\",\n close: \"hide\",\n transition: \"transitioning\",\n initialize: \"initializing\",\n };\n\n /**\n * The duration times (in milliseconds) for variouse aspects throughout the disclosure.\n *\n * @protected\n *\n * @type {Object<number>}\n *\n * @property {number} transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} close - The duration time (in milliseconds) for the transition from open to closed states.\n */\n _durations = {\n transition: 5000,\n open: -1,\n close: -1,\n };\n\n /**\n * The open state of the disclosure.\n *\n * @protected\n *\n * @type {TransactionalValue<boolean>}\n */\n _open = new TransactionalValue(false);\n\n /**\n * A value to force the disclosure open when the breakpoint width is passed.\n *\n * @protected\n *\n * @type {boolean}\n */\n _shouldOpen = false;\n\n /**\n * Whether or not to close the disclosure when it loses focus in the DOM.\n *\n * @protected\n *\n * @type {boolean}\n */\n _closeOnBlur = false;\n\n /**\n * A callback for media query list events.\n *\n * @protected\n *\n * @type {Function}\n *\n * @param {MediaQueryListEvent} event - The event.\n */\n _mediaQueryListEventCallback = (event) => {\n if (event.matches && this.isOpen) {\n this.close({ preserveState: true });\n } else if (\n !event.matches &&\n !this.isOpen &&\n (this.hasOpened || this.shouldOpen)\n ) {\n this.open();\n }\n };\n\n /**\n * The key used for storage.\n *\n * @protected\n *\n * @type {string}\n */\n _storageKey = \"disclosures\";\n\n /**\n * Custom events that can be triggered throughout the disclosure.\n *\n * @protected\n *\n * @type {Object<CustomEvent>}\n */\n _events = {\n /**\n * The event that is triggered when the disclosure is shown.\n *\n * @event grauplDisclosureExpand\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event\n * @property {Object<Disclosure>} detail - The details object containing the disclosure itself.\n * @property {Disclosure} detail.disclosure - The disclosure.\n */\n expand: new CustomEvent(\"grauplDisclosureExpand\", {\n bubbles: true,\n detail: {\n disclosure: this,\n },\n }),\n /**\n * The event that is triggered when the disclosure is hidden.\n *\n * @event grauplDisclosureCollapse\n *\n * @type {CustomEvent}\n *\n * @property {boolean} bubbles - A flag to bubble the event\n * @property {Object<Disclosure>} detail - The details object containing the disclosure itself.\n * @property {Disclosure} detail.disclosure - The disclosure.\n */\n collapse: new CustomEvent(\"grauplDisclosureCollapse\", {\n bubbles: true,\n detail: {\n disclosure: this,\n },\n }),\n };\n\n /**\n * Constructs a new `Disclosure`.\n *\n * @param {object} [options = {}] - The options for generating the disclosure.\n * @param {HTMLElement} options.disclosureElement - The disclosure element in the DOM.\n * @param {HTMLElement} options.controllerElement - The disclosure toggle element in the DOM.\n * @param {string} [options.disclosureContentSelector = .disclosure-content] - The query selector string for the disclosure content.\n * @param {?(string|string[])} [options.openClass = show] - The class to apply when a disclosure is \"open\".\n * @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a disclosure is \"closed\".\n * @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a disclosure is transitioning between \"open\" and \"closed\" states.\n * @param {number} [options.transitionDuration = 250] - The duration of the transition between \"open\" and \"closed\" states (in milliseconds).\n * @param {boolean} [options.openDuration = -1] - The duration of the transition from \"closed\" to \"open\" states (in milliseconds).\n * @param {boolean} [options.closeDuration = -1] - The duration of the transition from \"open\" to \"closed\" states (in milliseconds).\n * @param {boolean} [options.closeOnBlur = false] - Whether to close the disclosure when it loses focus in the dom.\n * @param {?string} [options.minWidth = \"\"] - The width of the screen that the disclosure will automatically open/close itself.\n * @param {boolean} [options.autoOpen = false] - Whether to automatically open when above the minWidth.\n * @param {?string} [options.mediaQuery = \"\"] - The media query to use when automatically opening/closing the disclosure.\n * @param {?string} [options.prefix = graupl-] - The prefix used for CSS custom properties and attributes.\n * @param {?string} [options.key = null] - The key used to generate IDs throughout the disclosure.\n * @param {?(string|string[])} [options.initializeClass = initializing] - The class(es) to apply when the disclosure is initializing.\n * @param {boolean} [options.initialize = false] - A flag to initialize the disclosure immediately upon creation.\n */\n constructor({\n disclosureElement,\n controllerElement,\n disclosureContentSelector = \".disclosure-content\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 250,\n openDuration = -1,\n closeDuration = -1,\n closeOnBlur = false,\n minWidth = \"\",\n autoOpen = false,\n mediaQuery = \"\",\n prefix = \"graupl-\",\n key = null,\n initializeClass = \"initializing\",\n initialize = false,\n } = {}) {\n super({\n prefix,\n key,\n initializeClass,\n });\n\n // Set the DOM elements.\n this._dom.disclosure = disclosureElement;\n this._dom.controller = controllerElement;\n\n // Set the DOM selectors.\n this._selectors.content = disclosureContentSelector;\n\n // Set the classes.\n this._classes.open = openClass || \"\";\n this._classes.close = closeClass || \"\";\n this._classes.transition = transitionClass || \"\";\n\n // Set the durations.\n this._durations.transition = transitionDuration;\n this._durations.open = openDuration;\n this._durations.close = closeDuration;\n\n // Set close on blur.\n this._closeOnBlur = closeOnBlur;\n\n // Set collapse width and auto open functionality.\n this._breakpoint = minWidth || \"\";\n this._shouldOpen = autoOpen;\n this._mediaQueryString = mediaQuery || \"\";\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initializes the disclosure.\n */\n initialize() {\n try {\n // Add the initialization class.\n addClass(this._classes.initialize, this.dom.disclosure);\n\n super.initialize();\n\n // Set up the DOM.\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n this._setCustomProps();\n\n // Handle events.\n this._handleMediaMatch();\n this._handleFocus();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n // Store the component.\n this._store();\n\n // Handle auto-opening disclsoures with aria-expanded set to true or\n // those that _should_ open.\n if (\n this.dom.controller.getAttribute(\"aria-expanded\") === \"true\" ||\n (this.shouldOpen && window.matchMedia(this.mediaQuery).matches)\n ) {\n this._expand({ emit: false, transition: false });\n } else {\n this._collapse({ emit: false, transition: false });\n }\n } catch (error) {\n console.error(error);\n } finally {\n // Remove the initialization class.\n requestAnimationFrame(() => {\n removeClass(this._classes.initialize, this.dom.disclosure);\n });\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is open.\n *\n * @type {string|string[]}\n *\n * @see _classes.open\n */\n get openClass() {\n return this._classes.open;\n }\n\n set openClass(value) {\n isValidClassList({ openClass: value });\n\n if (this._classes.open !== value) {\n this._classes.open = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.close\n */\n get closeClass() {\n return this._classes.close;\n }\n\n set closeClass(value) {\n isValidClassList({ closeClass: value });\n\n if (this._classes.close !== value) {\n this._classes.close = value;\n }\n }\n\n /**\n * The class(es) to apply when the disclosure is transitioning between open and closed.\n *\n * @type {string|string[]}\n *\n * @see _classes.transition\n */\n get transitionClass() {\n return this._classes.transition;\n }\n\n set transitionClass(value) {\n isValidClassList({ transitionClass: value });\n\n if (this._classes.transition !== value) {\n this._classes.transition = value;\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition between open and closed states.\n *\n * Setting this value will also set the --graupl-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.transition\n */\n get transitionDuration() {\n return this._durations.transition;\n }\n\n set transitionDuration(value) {\n isValidType(\"number\", { transitionDuration: value });\n\n if (this._durations.transition !== value) {\n this._durations.transition = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from closed to open states.\n *\n * If openDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-open-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.open\n */\n get openDuration() {\n if (this._durations.open === -1) return this.transitionDuration;\n\n return this._durations.open;\n }\n\n set openDuration(value) {\n isValidType(\"number\", { openDuration: value });\n\n if (this._durations.open !== value) {\n this._durations.open = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The duration time (in milliseconds) for the transition from open to closed states.\n *\n * If closeDuration is set to -1, the transitionDuration value will be used instead.\n *\n * Setting this value will also set the --graupl-close-transition-duration CSS custom property on the disclosure.\n *\n * @type {number}\n *\n * @see _durations.close\n */\n get closeDuration() {\n if (this._durations.close === -1) return this.transitionDuration;\n\n return this._durations.close;\n }\n\n set closeDuration(value) {\n isValidType(\"number\", { closeDuration: value });\n\n if (this._durations.close !== value) {\n this._durations.close = value;\n this._setCustomProps();\n }\n }\n\n /**\n * The width of the screen that the disclosure will automatically open/close itself.\n *\n * This is just an alias for the generic \"breakpoint\" used in all components.\n *\n * @type {string}\n *\n * @see breakpoint\n */\n get minWidth() {\n return this.breakpoint;\n }\n\n set minWidth(value) {\n this.breakpoint = value;\n }\n\n /**\n * Whether to close the disclosure when it loses focus in the DOM.\n *\n * @type {boolean}\n *\n * @see _closeOnBlur\n */\n get closeOnBlur() {\n return this._closeOnBlur;\n }\n\n set closeOnBlur(value) {\n isValidType(\"boolean\", { closeOnBlur: value });\n\n if (this._closeOnBlur !== value) {\n this._closeOnBlur = value;\n }\n }\n\n /**\n * The open state of the disclosure.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get isOpen() {\n return this._open.value;\n }\n\n /**\n * The open state of the disclosure that the user specifically triggered.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _open\n */\n get hasOpened() {\n return this._open.committed;\n }\n\n /**\n * A value to force opening reguardless of user interaction.\n *\n * @type {boolean}\n *\n * @see _shouldOpen\n */\n get shouldOpen() {\n return this._shouldOpen;\n }\n\n set shouldOpen(value) {\n isValidType(\"boolean\", { shouldOpen: value });\n\n if (this._shouldOpen !== value) {\n this._shouldOpen = value;\n }\n }\n\n /**\n * A flag to check if the disclosure's focus methods should _actually_ move the focus in the DOM.\n *\n * This will be `false` unless any of the following criteria are met:\n * - The disclosure's current event is \"keyboard\".\n *\n * @readonly\n *\n * @type {boolean}\n */\n get shouldFocus() {\n let check = false;\n\n if (this.currentEvent === \"keyboard\") {\n check = true;\n }\n\n return check;\n }\n\n /**\n * Validates all aspects of the disclosure to ensure proper functionality.\n *\n * Keys are altered to match the arguments passed in during creation where possible.\n *\n * @protected\n *\n * @return {boolean} - The result of the validation.\n */\n _validate() {\n super._validate();\n\n // Boolean checks.\n const booleans = {\n closeOnBlur: this._closeOnBlur,\n autoOpen: this._shouldOpen,\n };\n\n // Check the booleans.\n const booleanChecks = isValidType(\"boolean\", booleans);\n\n // Handle boolean check failure.\n if (!booleanChecks) {\n this._errors.push(booleanChecks.message);\n this._valid = false;\n }\n\n return this._valid;\n }\n\n /**\n * Sets the IDs throughout the disclosure.\n *\n * The generated IDs use the key and follow the format:\n * - disclosure: `disclosure-${key}`\n * - controller: `disclosure-controller-${key}`\n *\n * @protected\n */\n _setIds() {\n this.dom.disclosure.id = this.dom.disclosure.id || `disclosure-${this.key}`;\n this.dom.controller.id =\n this.dom.controller.id || `disclosure-controller-${this.key}`;\n\n this._id = this.dom.disclosure.id;\n }\n\n /**\n * Sets ARIA attributes throughout the disclosure.\n *\n * The first steps are to ensure that the controlled has `aria-expanded` set to \"false\"\n * if it's not already explicity set to \"true\".\n *\n * Then, set the `aria-controls` attribute on the controller to the disclosure's ID.\n *\n * Finally, ensure the controller element has a role of \"button\" if it is not a native button element.\n *\n * @protected\n */\n _setAriaAttributes() {\n // If the controller element doesn't have aria-expanded set to true, set it to false.\n if (this.dom.controller.getAttribute(\"aria-expanded\") !== \"true\") {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n }\n\n // Set the aria-controls attribute on the controller to the disclosure's ID.\n this.dom.controller.setAttribute(\"aria-controls\", this.dom.disclosure.id);\n\n // If the controller element is not a button, set its role to button.\n if (!isTag(\"button\", { controller: this.dom.controller })) {\n this.dom.controller.setAttribute(\"role\", \"button\");\n }\n }\n\n /**\n * Sets custom props throughout the disclosure.\n *\n * The custom properties are:\n * - `--graupl-disclosure-transition-duration`,\n * - `--graupl-disclosure-open-transition-duration`, and\n * - `--graupl-disclosure-close-transition-duration`.\n *\n * The prefix of `graupl-` can be changed by setting the disclosure's prefix value.\n *\n * @protected\n */\n _setCustomProps() {\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-transition-duration`,\n `${this.transitionDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-open-transition-duration`,\n `${this.openDuration}ms`\n );\n\n this.dom.disclosure.style.setProperty(\n `--${this.prefix}disclosure-close-transition-duration`,\n `${this.closeDuration}ms`\n );\n }\n\n /**\n * Sets all DOM elements within the disclosure.\n *\n * Utilizes _setDOMElementType and\n * _resetDOMElementType.\n *\n * @protected\n */\n _setDOMElements() {\n this._resetDOMElementType(\"content\");\n this._setDOMElementType(\"content\", { context: this.dom.disclosure });\n }\n\n /**\n * Expands the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"true\", adds the\n * open class to the disclosure, and removes the closed class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureExpand\n *\n * @param {Object<boolean>} [options = {}] - Options for expanding the disclosure.\n * @param {boolean} [options.emit = true] - Emit the expand event once expanded.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _expand({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"true\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the close class,\n // add the open class, and finally remove the transition class.\n if (transition && this.transitionlass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n }, this.openDuration);\n });\n });\n });\n } else {\n // Add the open class\n addClass(this.openClass, this.dom.disclosure);\n\n // Remove the close class.\n removeClass(this.closeClass, this.dom.disclosure);\n }\n\n this.dom.content.removeAttribute(\"inert\");\n\n if (emit) {\n this._dispatchEvent(\"expand\", this.dom.controller);\n }\n }\n\n /**\n * Collapses the disclosure.\n *\n * Sets the controller's `aria-expanded` to \"false\", adds the\n * close class to the disclosure, and removes the open class from the disclosure.\n *\n * @protected\n *\n * @fires grauplDisclosureCollapse\n *\n * @param {Object<boolean>} [options = {}] - Options for collapsing the disclosure.\n * @param {boolean} [options.emit = true] - Emit the collapse event once collapsed.\n * @param {boolean} [options.transition = true] - Respect the transition class.\n */\n _collapse({ emit = true, transition = true } = {}) {\n this.dom.controller.setAttribute(\"aria-expanded\", \"false\");\n\n // If we're dealing with transition classes, then we need to utilize\n // requestAnimationFrame to add the transition class, remove the open class,\n // add the close class, and finally remove the transition class.\n if (transition && this.transitionClass !== \"\") {\n addClass(this.transitionClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n removeClass(this.openClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n addClass(this.closeClass, this.dom.disclosure);\n\n requestAnimationFrame(() => {\n setTimeout(() => {\n removeClass(this.transitionClass, this.dom.disclosure);\n\n this.dom.content.innert = true;\n }, this.closeDuration);\n });\n });\n });\n } else {\n // Add the close class\n addClass(this.closeClass, this.dom.disclosure);\n\n // Remove the open class.\n removeClass(this.openClass, this.dom.disclosure);\n }\n\n this.dom.content.setAttribute(\"inert\", \"true\");\n\n if (emit) {\n this._dispatchEvent(\"collapse\", this.dom.controller);\n }\n }\n\n /**\n * Handles focus events throughout the disclosure.\n *\n * - Adds a `focusout` listener to the disclosure so when the disclosure loses focus it will close.\n */\n _handleFocus() {\n this._addEventListener(\"focusout\", this.dom.disclosure, (event) => {\n if (\n !this.closeOnBlur ||\n this.currentEvent !== \"keyboard\" ||\n event.relatedTarget === null ||\n this.dom.disclosure.contains(event.relatedTarget) ||\n this.dom.controller === event.relatedTarget\n ) {\n return;\n }\n\n this.close();\n });\n }\n\n /**\n * Handles click events throughout the disclosure.\n *\n * - Adds a `pointerup` listener to the controller that toggles the disclosure.\n * - Adds a `pointerup` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this._addEventListener(\"pointerup\", this.dom.controller, (event) => {\n this.currentEvent = \"mouse\";\n\n if (event.button !== 0) return;\n\n preventEvent(event);\n this.toggle();\n });\n\n this._addEventListener(\"pointerup\", document, (event) => {\n if (this.focusState !== \"self\" || !this.closeOnBlur) return;\n\n this.currentEvent = \"mouse\";\n\n if (\n !this.dom.disclosure.contains(event.target) &&\n this.dom.controller !== event.target\n ) {\n this.close();\n }\n });\n }\n\n /**\n * Handles keydown events throughout the disclosure.\n *\n * This method exists to assist the _handleKeyup method.\n *\n * - Adds a `keydown` listener to the controller.\n * - Blocks propagation on \"Space\" and \"Enter\" keys.\n * - Adds a `keydown` listener to the disclosure.\n * - Blocks propagation on \"Escape\" keys.\n */\n _handleKeydown() {\n this._addEventListener(\"keydown\", this.dom.controller, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n preventEvent(event);\n\n break;\n }\n });\n\n this._addEventListener(\"keydown\", this.dom.disclosure, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Handles keyup events throughout the disclosure.\n *\n * - Adds a `keyup` listener to the controller.\n * - Toggles the disclosure on \"Space\" and \"Enter\" keys.\n * - Adds a `keyup` listener to the disclosure.\n * - Closes the disclosure on \"Escape\" keys.\n */\n _handleKeyup() {\n this._addEventListener(\"keyup\", this.dom.controller, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Space\":\n case \"Enter\":\n this.toggle();\n\n preventEvent(event);\n\n break;\n }\n });\n\n this._addEventListener(\"keyup\", this.dom.disclosure, (event) => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n switch (key) {\n case \"Escape\":\n this.close();\n\n preventEvent(event);\n\n break;\n }\n });\n }\n\n /**\n * Opens the disclosure.\n *\n * Sets the disclosure's focus state to \"self\", calls expand, and sets isOpen to `true`.\n *\n * @param {Object<boolean>} [options = {}] - Options for opening the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n open({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Opens the disclosure without entering it.\n *\n * Sets the disclosure's focus state to \"none\", calls expand, and sets isOpen to `true`.\n *\n * @param {Object<boolean>} [options = {}] - Options for previewing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the preview action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n preview({ force = false, preserveState = false } = {}) {\n if (this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Expand the disclosure.\n this._expand();\n\n // Set the open state.\n this._open.value = true;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Closes the disclosure.\n *\n * Sets the disclosure's focus state to \"none\", calls collapse, and sets isOpen to `false`.\n *\n * @param {Object<boolean>} [options = {}] - Options for closing the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n close({ force = false, preserveState = false } = {}) {\n if (!this.isOpen && !force) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Collapse the disclosure.\n this._collapse();\n\n // Set the open state.\n this._open.value = false;\n\n if (!preserveState) {\n this._open.commit();\n }\n }\n\n /**\n * Toggles the open state of the disclosure.\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the open or close action.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n toggle({ force = false, preserveState = false } = {}) {\n if (this.isOpen) {\n this.close({ force, preserveState });\n } else {\n this.open({ force, preserveState });\n }\n }\n}\n\nexport default Disclosure;\n","/**\n * Mark DOM elements as processed to prevent multiple initializations.\n *\n * @module @drupal/once\n *\n * @example <!-- Use as a module -->\n * <script type=\"module\">\n * import once from 'https://unpkg.com/@drupal/once/src/once.js';\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n *\n * @example <!-- Use as a regular script -->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * const elements = once('my-once-id', 'div');\n * // Initialize elements.\n * elements.forEach(el => el.innerHTML = 'processed');\n * </script>\n * @example <!-- Using a single element as input-->\n * <script src=\"https://unpkg.com/@drupal/once\"></script>\n * <script>\n * // once methods always return an array, to simplify the use with a single\n * // element use destructuring or the shift method.\n * const [myElement] = once('my-once-id', document.body);\n * const myElement = once('my-once-id', document.body).shift();\n * </script>\n */\n\n/**\n * Illegal spaces in ids.\n *\n * @private\n *\n * @type {RegExp}\n */\nconst wsRE = /[\\11\\12\\14\\15\\40]+/;\n\n/**\n * Name of the HTML attribute containing an element's once ids.\n *\n * @private\n *\n * @type {string}\n */\nconst attrName = 'data-once';\n\n/**\n * Shortcut to access the html element.\n *\n * @private\n *\n * @type {HTMLElement}\n */\nconst doc = document;\n\n/**\n * Helper to access element attributes.\n *\n * @private\n *\n * @param {Element} element\n * The Element to access the data-once attribute from.\n * @param {string} op\n * The action to take on the element.\n * @param {string} [value]\n * Optional value for setAttribute.\n *\n * @return {string|undefined|null|boolean}\n * Result of the attribute method.\n */\nfunction attr(element, op, value) {\n return element[`${op}Attribute`](attrName, value);\n}\n\n/**\n * Return the attribute selector.\n *\n * @private\n *\n * @param {string} id\n * The id passed by a call to a once() function.\n *\n * @return {string}\n * The full CSS attribute selector.\n *\n * @throws {TypeError|RangeError}\n */\nfunction attrSelector(id) {\n // Verify the validity of the once id.\n if (typeof id !== 'string') {\n throw new TypeError('once ID must be a string');\n }\n if (id === '' || wsRE.test(id)) {\n throw new RangeError('once ID must not be empty or contain spaces');\n }\n // The id is valid, return the full CSS selector.\n return `[${attrName}~=\"${id}\"]`;\n}\n\n/**\n * Verifies that an item is an instance of Element.\n *\n * This function is used during filtering to ensure only DOM elements are\n * processed. once() makes use of get/setAttribute, which are methods\n * inherited from the Element object, so only of Element can be used.\n *\n * @private\n *\n * @param {*} itemToCheck\n * The item to check.\n *\n * @return {boolean}\n * True if the item is an instance of Element\n *\n * @throws {TypeError}\n */\nfunction checkElement(itemToCheck) {\n if (!(itemToCheck instanceof Element)) {\n throw new TypeError('The element must be an instance of Element');\n }\n return true;\n}\n\n/**\n * Process arguments, query the DOM if necessary.\n *\n * @private\n *\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array with the processed Id and the list of elements to process.\n */\nfunction getElements(selector, context = doc) {\n // Assume selector is an array-like value.\n let elements = selector;\n\n // If selector is null it is most likely because of a call to querySelector\n // that didn't return a result.\n if (selector === null) {\n elements = [];\n }\n // The selector is undefined, error out.\n else if (!selector) {\n throw new TypeError('Selector must not be empty');\n }\n // Context doesn't implement querySelectorAll, error out.\n else if (\n !(\n context instanceof Document ||\n context instanceof DocumentFragment ||\n context instanceof Element\n )\n ) {\n throw new TypeError(\n 'Context must be an object of type \"Document\", \"DocumentFragment\", or \"Element\".',\n );\n }\n // This is a selector, query the elements.\n else if (typeof selector === 'string') {\n elements = context.querySelectorAll(selector);\n }\n // This is a single element.\n else if (selector instanceof Element) {\n elements = [selector];\n }\n\n // Make sure an array is returned and not a NodeList or an Array-like object.\n return Array.prototype.slice.call(elements);\n}\n\n/**\n * A helper for applying DOM changes to a filtered set of elements.\n *\n * This makes it possible to filter items that are not instances of Element,\n * then modify their DOM attributes in a single array traversal.\n *\n * @private\n *\n * @param {string} selector\n * A CSS selector to check against to each element in the array.\n * @param {Array.<Element>} elements\n * A NodeList or array of elements passed by a call to a once() function.\n * @param {function} [apply]\n * An optional function to apply on all matched elements.\n *\n * @return {Array.<Element>}\n * The array of elements that match the CSS selector.\n */\nfunction filterAndModify(selector, elements, apply) {\n return elements.filter((element) => {\n const selected = checkElement(element) && element.matches(selector);\n if (selected && apply) {\n apply(element);\n }\n return selected;\n });\n}\n\n/**\n * Add or remove an item from a list of once values.\n *\n * This function removes duplicates while adding or removing a once id in a\n * single array traversal.\n *\n * @private\n *\n * @param {Element} element\n * A space separated string of once ids from a data-drupal-once attribute.\n * @param {string} [add]\n * The once id to add to the list of values.\n * @param {string} [remove]\n * The once id to remove from the list of values.\n *\n * @return {undefined}\n * Nothing to return this is a callback in a foreach.\n */\nfunction updateAttribute(element, { add, remove }) {\n const result = [];\n if (attr(element, 'has')) {\n attr(element, 'get')\n .trim()\n .split(wsRE)\n .forEach((item) => {\n if (result.indexOf(item) < 0 && item !== remove) {\n result.push(item);\n }\n });\n }\n if (add) {\n result.push(add);\n }\n const attribute = result.join(' ');\n attr(element, attribute === '' ? 'remove' : 'set', attribute);\n}\n\n/**\n * Ensures a JavaScript callback is only executed once on a set of elements.\n *\n * Filters a NodeList or array of elements, removing those already processed\n * by a callback with a given id.\n * This method adds a `data-once` attribute on DOM elements. The value of\n * this attribute identifies if a given callback has been executed on that\n * element.\n *\n * @global\n *\n * @example <caption>Basic usage</caption>\n * const elements = once('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once('my-once-id', document.querySelector('#some-id'));\n * @example <caption>Using a single element</caption>\n * // Once always returns an array, even when passing a single element. Some\n * // forms that can be used to keep code readable.\n * // Destructuring:\n * const [myElement] = once('my-once-id', document.body);\n * // By changing the resulting array, es5 compatible.\n * const myElement = once('my-once-id', document.body).shift();\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements.\n * @param {Document|DocumentFragment|Element} [context=document]\n * An element or document object to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * An array of elements that have not yet been processed by a once call\n * with a given id.\n */\nfunction once(id, selector, context) {\n return filterAndModify(\n `:not(${attrSelector(id)})`,\n getElements(selector, context),\n (element) => updateAttribute(element, { add: id }),\n );\n}\n\n/**\n * Removes a once id from an element's data-drupal-once attribute value.\n *\n * If a once id is removed from an element's data-drupal-once attribute value,\n * the JavaScript callback associated with that id can be executed on that\n * element again.\n *\n * @method once.remove\n *\n * @example <caption>Basic usage</caption>\n * const elements = once.remove('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.remove('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.remove('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.remove('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.remove('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.remove('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of a once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that had been processed by the provided id,\n * and are now able to be processed again.\n */\nonce.remove = (id, selector, context) => {\n return filterAndModify(\n attrSelector(id),\n getElements(selector, context),\n (element) => updateAttribute(element, { remove: id }),\n );\n};\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Behaves like {@link once} and {@link once.remove} without changing the DOM.\n * To select all DOM nodes processed by a given id, use {@link once.find}.\n *\n * @method once.filter\n *\n * @example <caption>Basic usage</caption>\n * const filteredElements = once.filter('my-once-id', '[data-myelement]');\n * @example <caption>Input parameters accepted</caption>\n * // NodeList.\n * once.filter('my-once-id', document.querySelectorAll('[data-myelement]'));\n * // Array or Array-like of Element.\n * once.filter('my-once-id', jQuery('[data-myelement]'));\n * // A CSS selector without a context.\n * once.filter('my-once-id', '[data-myelement]');\n * // A CSS selector with a context.\n * once.filter('my-once-id', '[data-myelement]', document.head);\n * // Single Element.\n * once.filter('my-once-id', document.querySelector('#some-id'));\n *\n * @param {string} id\n * The id of the once call.\n * @param {NodeList|Array.<Element>|Element|string} selector\n * A NodeList or array of elements to remove the once id from.\n * @param {Document|Element} [context=document]\n * An element to use as context for querySelectorAll.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.filter = (id, selector, context) =>\n filterAndModify(attrSelector(id), getElements(selector, context));\n\n/**\n * Finds elements that have been processed by a given once id.\n *\n * Query the 'context' element for elements that already have the\n * corresponding once id value.\n *\n * @method once.find\n *\n * @example <caption>Basic usage</caption>\n * const oncedElements = once.find('my-once-id');\n * @example <caption>Input parameters accepted</caption>\n * // Call without parameters, return all elements with a `data-once` attribute.\n * once.find();\n * // Call without a context.\n * once.find('my-once-id');\n * // Call with a context.\n * once.find('my-once-id', document.head);\n *\n * @param {string} [id]\n * The id of the once call.\n * @param {Document|DocumentFragment|Element} [context=document]\n * Scope of the search for matching elements.\n *\n * @return {Array.<Element>}\n * A filtered array of elements that have already been processed by the\n * provided once id.\n */\nonce.find = (id, context) =>\n getElements(!id ? `[${attrName}]` : attrSelector(id), context);\n\nexport default once;\n","import Disclosure from \"./Disclosure.js\";\nimport once from \"@drupal/once\";\n\nconst generate = ({\n options = {},\n context = document,\n disclosureSelector = \".disclosure\",\n controllerSelector = \".disclosure-toggle\",\n} = {}) => {\n once(\"graupl-disclosure-generator\", disclosureSelector, context).forEach(\n (disclosureElement) => {\n const disclosureOptions = disclosureElement.dataset\n .grauplDisclosureOptions\n ? JSON.parse(\n disclosureElement.dataset.grauplDisclosureOptions.replace(/'/g, '\"')\n ) || {}\n : {};\n\n const targettedControllerSelector = `${controllerSelector}[data-graupl-disclosure-target=\"${disclosureElement.id}\"]`;\n const [controllerElement] = once(\n \"graupl-disclosure-generator\",\n targettedControllerSelector,\n context\n );\n\n if (!controllerElement) {\n console.warn(\n `No controller found for disclosure with ID \"${disclosureElement.id}\". Please ensure there is an element with the selector \"${targettedControllerSelector}\".`\n );\n\n once.remove(\"graupl-disclosure-generator\", disclosureElement);\n\n return;\n }\n\n new Disclosure({\n disclosureElement,\n controllerElement,\n initialize: true,\n ...options,\n ...discl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