@graupl/core 1.0.0-beta.43 → 1.0.0-beta.44

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.
Files changed (41) hide show
  1. package/dist/js/accordion.js.map +1 -1
  2. package/dist/js/alert.js +1 -1
  3. package/dist/js/alert.js.map +1 -1
  4. package/dist/js/component/accordion.cjs.js.map +1 -1
  5. package/dist/js/component/accordion.es.js.map +1 -1
  6. package/dist/js/component/accordion.iife.js.map +1 -1
  7. package/dist/js/component/alert.cjs.js +1 -1
  8. package/dist/js/component/alert.cjs.js.map +1 -1
  9. package/dist/js/component/alert.es.js +1 -1
  10. package/dist/js/component/alert.es.js.map +1 -1
  11. package/dist/js/component/alert.iife.js +1 -1
  12. package/dist/js/component/alert.iife.js.map +1 -1
  13. package/dist/js/component/disclosure.cjs.js +2 -2
  14. package/dist/js/component/disclosure.cjs.js.map +1 -1
  15. package/dist/js/component/disclosure.es.js +2 -2
  16. package/dist/js/component/disclosure.es.js.map +1 -1
  17. package/dist/js/component/disclosure.iife.js +2 -2
  18. package/dist/js/component/disclosure.iife.js.map +1 -1
  19. package/dist/js/disclosure.js +2 -2
  20. package/dist/js/disclosure.js.map +1 -1
  21. package/dist/js/generator/accordion.cjs.js.map +1 -1
  22. package/dist/js/generator/accordion.es.js.map +1 -1
  23. package/dist/js/generator/accordion.iife.js.map +1 -1
  24. package/dist/js/generator/alert.cjs.js +1 -1
  25. package/dist/js/generator/alert.cjs.js.map +1 -1
  26. package/dist/js/generator/alert.es.js +1 -1
  27. package/dist/js/generator/alert.es.js.map +1 -1
  28. package/dist/js/generator/alert.iife.js +1 -1
  29. package/dist/js/generator/alert.iife.js.map +1 -1
  30. package/dist/js/generator/disclosure.cjs.js +2 -2
  31. package/dist/js/generator/disclosure.cjs.js.map +1 -1
  32. package/dist/js/generator/disclosure.es.js +2 -2
  33. package/dist/js/generator/disclosure.es.js.map +1 -1
  34. package/dist/js/generator/disclosure.iife.js +2 -2
  35. package/dist/js/generator/disclosure.iife.js.map +1 -1
  36. package/dist/js/graupl.js +2 -2
  37. package/dist/js/graupl.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/js/accordion/AccordionItem.js +2 -2
  40. package/src/js/alert/Alert.js +3 -3
  41. package/src/js/disclosure/Disclosure.js +497 -42
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure.es.js","names":["isValidInstance","contructor","elements","shouldThrow","result","status","errors","elementsType","TypeError","key","elementType","name","error","push","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidState","validStates","includes","join","isValidEvent","validEvents","isValidHoverType","validTypes","isTag","tagName","HTMLElement","tag","toLowerCase","isValidEventType","eventType","component","Object","prototype","hasOwnProperty","call","events","constructor","keys","hasValidRootDOMElement","_dom","_rootDOMElement","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","Character","isNaN","match","Tab","Asterisk","Object","find","preventEvent","preventDefault","stopPropagation","TransactionalValue","_equals","Object","is","_current","_committed","constructor","initialValue","equals","value","val","committed","isDirty","commit","reset","update","fn","isValidType","isValidInstance","StorageManager","_scope","_type","_storage","_crush","constructor","scope","type","crush","initialize","window","storage","shouldThrow","status","get","key","typeCheck","Error","message","keyCheck","set","data","dataCheck","clear","dispose","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","isValidEventType","hasValidRootDOMElement","StorageManager","addClass","removeClass","Component","_dom","_rootDOMElement","_protectedDOMElements","_selectors","_elements","_classes","initialize","_durations","_delays","_focusState","_currentEvent","_breakpoint","_mediaQueryString","_mediaQueryList","_mediaQueryListEventCallback","event","matches","_intervals","_timeouts","_listeners","_events","CustomEvent","detail","component","preinitialize","postinitialize","validate","prevalidate","postvalidate","_prefix","_key","_name","_storageKey","_shouldStore","_id","_valid","_initialized","_errors","constructor","prefix","key","initializeClass","_validate","Error","name","errors","map","error","message","join","rootDOMElement","_dispatchEvent","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_setCustomProps","_createChildElements","_handleMediaMatch","_handleFocus","_handleHover","_handleClick","_handleKeydown","_handleKeyup","_store","console","init","dom","document","documentElement","selectors","elements","classes","durations","delays","intervals","timeouts","listeners","events","value","focusState","currentEvent","shouldFocus","check","breakpoint","mediaQuery","id","isValid","isInitialized","rootDOMElementCheck","shouldThrow","status","Object","keys","length","domElements","domKey","Array","isArray","forEach","element","index","domChecks","HTMLElement","querySelectors","querySelector","querySelectorChecks","className","classListChecks","durationName","durationChecks","delayName","delayChecks","strings","elementType","stringChecks","regenerate","Math","random","toString","replace","substring","_setDOMElementType","context","overwrite","strict","includes","from","querySelectorAll","filteredElements","filter","item","parentElement","_resetDOMElementType","window","matchMedia","_addEventListener","storage","GrauplStorage","scope","set","type","data","_unstore","clear","_setInterval","callback","delay","_clearInterval","setInterval","clearInterval","_clearIntervals","_setTimeout","_clearTimeout","setTimeout","clearTimeout","_clearTimeouts","_registerEvent","bubbles","eventName","charAt","toUpperCase","slice","eventType","dispatchEvent","listener","options","addEventListener","push","_removeEventListener","removeEventListener","registeredListener","i","JSON","stringify","splice","_removeEventListeners","focus","blur","dispose","isValidClassList","isValidType","isTag","addClass","removeClass","keyPress","preventEvent","TransactionalValue","Component","Disclosure","_rootDOMElement","_protectedDOMElements","_open","_shouldOpen","_closeOnBlur","_storageKey","_name","_mediaQueryListEventCallback","event","matches","isOpen","close","preserveState","hasOpened","shouldOpen","open","constructor","disclosureElement","controllerElement","disclosureContentSelector","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","autoOpen","mediaQuery","prefix","key","initializeClass","initialize","_dom","disclosure","controller","_selectors","content","_classes","transition","_durations","_breakpoint","_mediaQueryString","_registerEvent","detail","_addEventListener","rootDOMElement","dom","getAttribute","window","matchMedia","_expand","emit","_collapse","booleans","booleanChecks","shouldThrow","status","_errors","errors","_valid","value","_setCustomProps","breakpoint","committed","_setIds","id","_id","_setAriaAttributes","setAttribute","style","setProperty","_setDOMElements","_resetDOMElementType","_setDOMElementType","context","transitionlass","requestAnimationFrame","setTimeout","removeAttribute","_dispatchEvent","innert","_handleFocus","currentEvent","relatedTarget","contains","_handleClick","button","toggle","document","focusState","target","_handleKeydown","_handleKeyup","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":["../../../src/js/validate.js","../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/TransactionalValue.js","../../../src/js/storage/StorageManager.js","../../../src/js/Component.js","../../../src/js/disclosure/Disclosure.js","../../../../../node_modules/@drupal/once/src/once.js","../../../src/js/disclosure/generator.js"],"sourcesContent":["/**\n * @file\n * Validation helper functions.\n */\n\n/* global Component */\n\n/**\n * Check to see if the provided elements have a specific contructor.\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} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidInstance(\n contructor,\n elements,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidType(type, values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(\n `${key} must be a ${type}. \"${valueType}\" given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isQuerySelector(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidClassList(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidState(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEvent(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided values are valid hover types for a menu.\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidHoverType(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 `{ status: 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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isTag(tagName, elements, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (\n isValidType(\"string\", { tagName }, { shouldThrow: true }).status &&\n isValidInstance(HTMLElement, elements, { shouldThrow: true }).status\n ) {\n const tag = tagName.toLowerCase();\n\n for (const key in elements) {\n try {\n if (elements[key].tagName.toLowerCase() !== tag) {\n throw new TypeError(\n `${key} must be a <${tag}> element. <${elements[\n key\n ].tagName.toLowerCase()}> given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided event type is valid for dispatching.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} eventType - The event type to check.\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEventType(\n eventType,\n component,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (!Object.prototype.hasOwnProperty.call(component.events, eventType)) {\n throw new TypeError(\n `Event type \"${eventType}\" is not valid for ${component.constructor.name}. Valid event types are: \"${Object.keys(component.events).join('\", ')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the component has a valid root DOM element.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow=true] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function hasValidRootDOMElement(component, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n // Check to make sure the root DOM element exists in _dom.\n if (\n !Object.prototype.hasOwnProperty.call(\n component._dom,\n component._rootDOMElement\n )\n ) {\n throw new Error(\n `The root DOM element \"${component._rootDOMElement}\" does not exist in the ${component.constructor.name}'s _dom property. It must be one of the following: \"${Object.keys(\n component._dom\n ).join('\", \"')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 Character: isNaN(key) && !!key.match(/^[a-zA-Z]{1}$/),\n Tab: key === \"Tab\" || key === 9,\n Asterisk: key === \"*\" || key === 56,\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 utility class for managing transactional values.\n */\n\n/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\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 */\nclass TransactionalValue {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @protected\n *\n * @type {function(*, *): boolean}\n */\n _equals = Object.is;\n\n /**\n * The current, editable value.\n *\n * @protected\n *\n * @type {*}\n */\n _current;\n\n /**\n * The last committed (baseline) value.\n *\n * @protected\n *\n * @type {*}\n */\n _committed;\n\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {object} [options = {}] - Options for configuring the instance.\n * @param {function(*, *): boolean} [options.equals = Object.is] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, { equals = Object.is } = {}) {\n this._equals = equals || Object.is;\n this._current = initialValue;\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 value.\n *\n * @readonly\n *\n * @type {*}\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 * Will be `true` if the values are different, `false` otherwise.\n *\n * @readonly\n *\n * @type {boolean}\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\nexport default TransactionalValue;\n","/**\n * @file\n * Provides a system to get and store data in the browser.\n */\n\nimport { isValidType, isValidInstance } from \"../validate.js\";\n\n/**\n * Class representing a storage system.\n */\nclass StorageManager {\n /**\n * The scope of the storage.\n *\n * @protected\n *\n * @type {string}\n */\n _scope;\n\n /**\n * The type of storage.\n *\n * @protected\n *\n * @type {string}\n */\n _type = \"_default\";\n\n /**\n * The storage object.\n *\n * @protected\n *\n * @type {object}\n */\n _storage = {};\n\n /**\n * Whether to crush the storage instance if it already exists.\n *\n * @protected\n *\n * @type {boolean}\n */\n _crush = false;\n\n /**\n * Creates a Storage instance.\n *\n * @param {object} [options = {}] - The options for the storage.\n * @param {string} options.scope - The scope of the storage.\n * @param {?string} [options.type = null] - The type of storage.\n * @param {boolean} [options.crush = false] - Whether to crush the storage instance if it already exists.\n * @param {boolean} [options.initialize = true] - Whether to initialize the storage.\n */\n constructor({ scope, type = null, crush = false, initialize = true } = {}) {\n this._scope = scope;\n this._type = type || \"_default\";\n this._crush = crush;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initialize the storage.\n */\n initialize() {\n // Try to make sure the storage instance won't crush other instances of StorageManager with the same scope.\n try {\n if (!this._crush && typeof window[this.scope] !== \"undefined\") {\n if (\n isValidInstance(\n StorageManager,\n { storage: window[this.scope] },\n { shouldThrow: false }\n ).status ||\n (typeof window[this.scope].storage !== \"undefined\" &&\n typeof window[this.scope].scope !== \"undefined\" &&\n typeof window[this.scope].type !== \"undefined\")\n ) {\n this._storage = window[this.scope].storage;\n }\n }\n } catch {\n // Do nothing.\n } finally {\n window[this.scope] = this;\n }\n }\n\n /**\n * The scope of the storage.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _scope\n */\n get scope() {\n return this._scope;\n }\n\n /**\n * The type of storage.\n *\n * @type {string}\n *\n * @see _type\n */\n get type() {\n return this._type;\n }\n\n set type(type) {\n if (isValidType(\"string\", { type })) {\n this._type = type;\n }\n }\n\n /**\n * The storage object.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _storage\n */\n get storage() {\n return this._storage;\n }\n\n /**\n * Get the storage object.\n *\n * @param {object} [options = {}] - The options for getting the storage.\n * @param {string} [options.type = this.type] - The type of storage to get.\n * @param {?string} [options.key = null] - The key to get the value from.\n * @return {object} - The storage object.\n */\n get({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!this.storage[type]) {\n throw new Error(\n `StorageManager (${this.scope}): Type \"${type}\" is not initialized.`\n );\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n return this.storage[type][key];\n }\n\n return this.storage[type];\n }\n\n /**\n * Set the storage object.\n *\n * @param {object} [options = {}] - The options for setting the storage.\n * @param {string} [options.type = this.type] - The type of storage to set.\n * @param {?string} [options.key = null] - The key to set the value to.\n * @param {object} [options.data = {}] - The data to set.\n */\n set({ type = this.type, key = null, data = {} } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n const dataCheck = isValidType(\"object\", { data });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!dataCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${dataCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n if (!this._storage[type]) {\n this._storage[type] = {};\n }\n\n this._storage[type][key] = data;\n } else {\n this._storage[type] = data;\n }\n }\n\n /**\n * Remove a value from the storage object.\n *\n * @param {object} [options = {}] - The options for removing from storage.\n * @param {string} [options.type = this.type] - The type of storage to remove from.\n * @param {?string} [options.key = null] - The key to remove the value from.\n */\n clear({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n delete this.storage[type][key];\n } else {\n delete this.storage[type];\n }\n }\n\n dispose() {\n delete this._storage;\n delete this;\n }\n}\n\nexport default StorageManager;\n","/**\n * @file\n * A generic component class.\n */\n\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n isValidEventType,\n hasValidRootDOMElement,\n} from \"./validate.js\";\nimport StorageManager from \"./storage/StorageManager.js\";\nimport { addClass, removeClass } from \"./domHelpers.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 root DOM element of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _rootDOMElement = \"\";\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 _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 initialize: new CustomEvent(\"grauplComponentInitialize\", {\n detail: { component: this },\n }),\n preinitialize: new CustomEvent(\"grauplComponentPreinitialize\", {\n detail: { component: this },\n }),\n postinitialize: new CustomEvent(\"grauplComponentPostinitialize\", {\n detail: { component: this },\n }),\n validate: new CustomEvent(\"grauplComponentValidate\", {\n detail: { component: this },\n }),\n prevalidate: new CustomEvent(\"grauplComponentPrevalidate\", {\n detail: { component: this },\n }),\n postvalidate: new CustomEvent(\"grauplComponentPostvalidate\", {\n detail: { component: this },\n }),\n };\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 component name of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _name = \"Component\";\n\n /**\n * The key used for storage.\n *\n * @protected\n *\n * @type {string}\n */\n _storageKey = \"components\";\n\n /**\n * A flag to check if the component should be stored in the StorageManager.\n */\n _shouldStore = true;\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 initialized state of the component.\n *\n * @protected\n *\n * @type {boolean}\n */\n _initialized = false;\n\n /**\n * The errors found throughout the component.\n *\n * @protected\n *\n * @type {Error[]}\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.name}: Cannot initialize component. The following errors have been found:\\n - ${this.errors\n .map((error) => error.message)\n .join(\"\\n - \")}`\n );\n }\n\n addClass(this.initializeClass, this.rootDOMElement);\n\n this._dispatchEvent(\"preinitialize\", this.rootDOMElement);\n\n // Generate the key.\n this._generateKey();\n\n // Set up the DOM.\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n this._setCustomProps();\n\n // Set up child elements.\n this._createChildElements();\n\n // Handle events.\n this._handleMediaMatch();\n this._handleFocus();\n this._handleHover();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n this._dispatchEvent(\"initialize\", this.rootDOMElement);\n\n // Store the component.\n this._store();\n\n removeClass(this.initializeClass, this.rootDOMElement);\n\n this._initialized = true;\n\n this._dispatchEvent(\"postinitialize\", this.rootDOMElement);\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 root DOM element of the component.\n *\n * @readonly\n *\n * @type {HTMLElement}\n *\n * @see _rootDOMElement\n */\n get rootDOMElement() {\n return this._dom[this._rootDOMElement] || document.documentElement;\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 {Error[]}\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 * 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 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 if (this._breakpoint === \"\") {\n return \"\";\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 * The component name of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _name\n */\n get name() {\n return this._name;\n }\n\n /**\n * The main ID of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _id\n */\n get id() {\n return this._id;\n }\n\n /**\n * The validity state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _valid\n */\n get isValid() {\n return this._valid;\n }\n\n /**\n * The initialized state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _initialized\n */\n get isInitialized() {\n return this._initialized;\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 this._dispatchEvent(\"prevalidate\", this.rootDOMElement);\n\n // _rootDOMElement check.\n const rootDOMElementCheck = hasValidRootDOMElement(this, {\n shouldThrow: false,\n });\n\n // Handle _rootDOMElement check failure.\n if (!rootDOMElementCheck.status) {\n this._errors = [...this._errors, ...rootDOMElementCheck.errors];\n this._valid = false;\n }\n\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 } else if (this._dom[domKey] !== null) {\n domElements[`${domKey}Element`] = this._dom[domKey];\n }\n }\n\n // Check the DOM elements.\n const domChecks = isValidInstance(HTMLElement, domElements, {\n shouldThrow: false,\n });\n\n // Handle DOM check failure.\n if (!domChecks.status) {\n this._errors = [...this._errors, ...domChecks.errors];\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 shouldThrow: false,\n });\n\n // Handle query selector check failure.\n if (!querySelectorChecks.status) {\n this._errors = [...this._errors, ...querySelectorChecks.errors];\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, { shouldThrow: false });\n\n // Handle class list check failure.\n if (!classListChecks.status) {\n this._errors = [...this._errors, ...classListChecks.errors];\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 shouldThrow: false,\n });\n\n // Handle duration check failure.\n if (!durationChecks.status) {\n this._errors = [...this._errors, ...durationChecks.errors];\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, { shouldThrow: false });\n\n // Handle delay check failure.\n if (!delayChecks.status) {\n this._errors = [...this._errors, ...delayChecks.errors];\n this._valid = false;\n }\n }\n\n // String checks.\n const strings = {\n _storageKey: this._storageKey,\n key: this._key,\n prefix: this._prefix,\n mediaQuery: this._mediaQueryString,\n breakpoint: this._breakpoint,\n };\n\n this._protectedDOMElements.forEach((elementType) => {\n strings[`_protectedDOMElementType[${elementType}]`] = elementType;\n });\n // Check the strings.\n const stringChecks = isValidType(\"string\", strings, { shouldThrow: false });\n\n // Handle string check failure.\n if (!stringChecks.status) {\n this._errors = [...this._errors, ...stringChecks.errors];\n this._valid = false;\n }\n\n this._dispatchEvent(\"validate\", this.rootDOMElement);\n\n this._dispatchEvent(\"postvalidate\", this.rootDOMElement);\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 = false] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { context, overwrite = true, strict = false } = {}\n ) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.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 (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.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.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 (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.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.mediaQuery === \"\") {\n return;\n }\n\n this._mediaQueryList = window.matchMedia(this.mediaQuery);\n this._addEventListener(\n \"change\",\n this._mediaQueryList,\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 hover events through the component.\n *\n * @protected\n */\n _handleHover() {\n // Add functionality to handle hover 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 // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n // Set up the storage.\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n new StorageManager({ scope: \"GrauplStorage\" });\n }\n\n // Store the menu\n window.GrauplStorage.set({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\n data: this,\n });\n }\n\n /**\n * Removes the component from the global Graupl storage object.\n *\n * @protected\n */\n _unstore() {\n // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n return;\n }\n\n window.GrauplStorage.clear({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\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 an 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 * Clears all intervals within the component.\n *\n * @protected\n */\n _clearIntervals() {\n for (const scope of Object.keys(this._intervals)) {\n this._clearInterval(scope);\n }\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 a 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 * Clears all timeouts within the component.\n *\n * @protected\n */\n _clearTimeouts() {\n for (const scope of Object.keys(this._timeouts)) {\n this._clearTimeout(scope);\n }\n }\n\n /**\n * Registers a new event type within the component.\n *\n * @protected\n *\n * @param {string} name - The name of the new event type.\n * @param {object} [options = {}] - The options for the new event type.\n * @param {boolean} [options.bubbles = true] - A flag to set if the event bubbles.\n * @param {object} [options.detail = {}] - Additional details to include in the event.\n */\n _registerEvent(name, { bubbles = true, detail = {} } = {}) {\n isValidType(\"string\", { name });\n isValidType(\"boolean\", { bubbles });\n isValidType(\"object\", { detail });\n\n const eventName = `graupl${this.name}${name.charAt(0).toUpperCase()}${name.slice(\n 1\n )}`;\n\n this._events[name] = new CustomEvent(eventName, {\n bubbles,\n detail: { component: this, ...detail },\n });\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 isValidEventType(eventType, this);\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 from an element and unregister it within the component.\n *\n * @param {string} type - The type of event to remove.\n * @param {HTMLElement} element - The element to remove the listener from.\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 // Find the listener in the component's listener storage.\n let index = -1;\n\n this._listeners.forEach((registeredListener, i) => {\n if (\n registeredListener.type === type &&\n registeredListener.element === element &&\n registeredListener.listener === listener &&\n JSON.stringify(registeredListener.options) === JSON.stringify(options)\n ) {\n index = i;\n }\n });\n\n // Remove it from the component's listener storage.\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Removes all event listeners registered in the component.\n *\n * This can be filtered by type and/or element.\n *\n * @protected\n *\n * @param {object} [options = {}] - Options for removing listeners.\n * @param {?string} [options.type = null] - The type of event to remove. If null, all types are removed.\n * @param {?HTMLElement} [options.element = null] - The element to remove listeners from. If null, all elements are removed.\n */\n _removeEventListeners({ type = null, element = null } = {}) {\n const listeners = [...this._listeners];\n\n listeners.forEach((listener) => {\n if (type !== null && listener.type !== type) return;\n if (element !== null && listener.element !== element) return;\n\n this._removeEventListener(\n listener.type,\n listener.element,\n listener.listener,\n listener.options\n );\n });\n }\n\n /**\n * Focus the component.\n *\n * Sets the components's focus state to \"self\" and\n * focusses the component if the component's shouldFocus\n * value is `true`.\n */\n focus() {\n this.focusState = \"self\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.focus();\n }\n }\n\n /**\n * Unfocus the component.\n *\n * Sets the component's focus state to \"none\"\n * and blurs the component if the component's shouldFocus\n * value is `true`.\n */\n blur() {\n this.focusState = \"none\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.blur();\n }\n }\n\n /**\n * Disposes of the current instantiated component.\n *\n * Removes all timeouts and event listeners, removes the component from the global storage, and delete's the object.\n */\n dispose() {\n this._clearIntervals();\n this._clearTimeouts();\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\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\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\n/**\n * The Disclosure component.\n *\n * @extends Component\n *\n * Protected fields are documented below.\n *\n * @property {Object<HTMLElement>} _dom - The DOM elements within the disclosure.\n * @property {HTMLElement} _dom.controller - The disclosure controller element.\n * @property {HTMLElement} _dom.disclosure - The disclosure element.\n * @property {HTMLElement} _dom.content - The disclosure content element.\n * @property {string} _rootDOMElement - The root DOM element of the disclosure.\n * @property {string[]} _protectedDOMElements - The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n * @property {Object<string>} _selectors - The query selectors used by the disclosure.\n * @property {string} _selectors.content - The query selector for the disclosure content.\n * @property {Object<string, string[]>} _classes - The CSS classes to apply when the disclosure is in various states.\n * @property {string|string[]} _classes.open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} _classes.close - The class(es) to apply when the disclosure is closed.\n * @property {string|string[]} _classes.transition - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} _classes.initialize - The class(es) to apply when the disclosure is initializing.\n * @property {Object<number>} _durations - The duration times (in milliseconds) for various aspects throughout the disclosure.\n * @property {number} _durations.transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} _durations.open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} _durations.close - The duration time (in milliseconds) for the transition from open to closed states.\n * @property {TransactionalValue<boolean>} _open - The open state of the disclosure.\n * @property {boolean} _shouldOpen - A value to force the disclosure open when the breakpoint width is passed.\n * @property {boolean} _closeOnBlur - Whether to close the disclosure when it loses focus in the DOM.\n * @property {Function} _mediaQueryListEventCallback - The callback for media query list events.\n * @property {string} _storageKey - The key used for storage.\n * @property {boolean} _shouldStore - A flag to check if the component should be stored in the StorageManager.\n * @property {Object<CustomEvent>} _events - Custom events that can be triggered throughout the disclosure.\n * @property {grauplDisclosureExpand} _events.expand - The event triggered when the disclosure is expanded.\n * @property {grauplDisclosureCollapse} _events.collapse - The event triggered when the disclosure is collapsed.\n * @property {Object<object>} _elements - The instantiated elements within the disclosure.\n * @property {Object<number>} _delays - The delay times (in milliseconds) for various aspects throughout the disclosure.\n * @property {string} _focusState - The current state of the disclosure's focus.\n * @property {string} _currentEvent - The last type of event triggered within the disclosure.\n * @property {string} _breakpoint - The breakpoint that the disclosure will call media query list events.\n * @property {string} _mediaQueryString - The media query to use to trigger media query list events.\n * @property {MediaQueryList|null} _mediaQueryList - The MediaQueryList for the disclosure.\n * @property {Object<Function>} _intervals - Intervals throughout the disclosure.\n * @property {Object<Function>} _timeouts - Timeouts throughout the disclosure.\n * @property {object[]} _listeners - Event listeners throughout the disclosure.\n * @property {string} _prefix - The prefix used for CSS custom properties and attributes.\n * @property {string} _key - The key used to generate IDs throughout the disclosure.\n * @property {string} _name - The component name of the disclosure.\n * @property {string} _id - The main ID of the disclosure.\n * @property {boolean} _valid - The validity state of the disclosure.\n * @property {boolean} _initialized - The initialized state of the disclosure.\n * @property {string[]} _errors - The errors found throughout the disclosure.\n */\nclass Disclosure extends Component {\n _rootDOMElement = \"disclosure\";\n _protectedDOMElements = [\"controller\"];\n _open = new TransactionalValue(false);\n _shouldOpen = false;\n _closeOnBlur = false;\n _storageKey = \"disclosures\";\n _name = \"Disclosure\";\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 * 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 // Register custom events.\n this._registerEvent(\"expand\", { detail: { disclosure: this } });\n this._registerEvent(\"collapse\", { detail: { disclosure: this } });\n\n // Set up custom initialization.\n this._addEventListener(\n \"grauplComponentInitialize\",\n this.rootDOMElement,\n () => {\n // Handle auto-opening disclosures 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 }\n );\n\n // Set up custom validation.\n this._addEventListener(\n \"grauplComponentValidate\",\n this.rootDOMElement,\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 shouldThrow: false,\n });\n\n // Handle boolean check failure.\n if (!booleanChecks.status) {\n this._errors = [...this._errors, ...booleanChecks.errors];\n this._valid = false;\n }\n }\n );\n\n if (initialize) {\n this.initialize();\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 regardless 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 * 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 controller has `aria-expanded` set to \"false\"\n * if it's not already explicitly 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 (\n !isTag(\n \"button\",\n { controller: this.dom.controller },\n { shouldThrow: false }\n ).status\n ) {\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 `click` listener to the controller that toggles the disclosure.\n * - Adds a `click` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this._addEventListener(\"click\", 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(\"click\", 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 ...disclosureOptions,\n });\n }\n );\n};\n\nexport default generate;\n"],"x_google_ignoreList":[7],"mappings":"AAwBA,SAAgBA,EACdC,EACA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,EAAKV,OAAAA,CAAUzB,EAAIQ,EAAUC,IACpBS,EACLnB,EAAaC,CAAAA,EACbO,EAAYC,EAAUC,CAAAA,EACrBb,GAAY2B,EAAgB3B,EAAS,CAAE6B,OAAQzB,CAAAA,CAAI,CACtD,EAoCFmC,EAAKf,OAAAA,CAAUpB,EAAIQ,EAAUC,IAC3BS,EAAgBnB,EAAaC,CAAAA,EAAKO,EAAYC,EAAUC,CAAAA,CAAQ,EA6BlE0B,EAAKC,KAAAA,CAAQpC,EAAIS,IACfF,EAAaP,EAAuBD,EAAaC,CAAAA,EAA/B,IAAIR,CAAAA,IAAgCiB,CAAAA,EC3YxD,MAAM8B,EAAAA,CAAY,CAChBC,QAAAA,EAAU,CAAA,EACVC,QAAAA,EAAUC,SACVC,mBAAAA,EAAqB,cACrBC,mBAAAA,EAAqB,oBAAA,EACnB,CAAA,IAAO,CACTN,EAAK,8BAA+BK,EAAoBF,CAAAA,EAASI,QAC9DC,GAAsB,CACrB,MAAMC,EAAoBD,EAAkBE,QACzCC,wBACCC,KAAKC,MACHL,EAAkBE,QAAQC,wBAAwBG,QAAQ,KAAM,GAAA,CAClE,GAAK,CAAA,EACL,CAAA,EAEEC,EAA8B,GAAGT,CAAAA,mCAAqDE,EAAkBQ,EAAAA,KACxG,CAACC,CAAAA,EAAqBjB,EAC1B,8BACAe,EACAZ,CAAAA,EAGF,GAAI,CAACc,EAAmB,CACtBC,QAAQC,KACN,+CAA+CX,EAAkBQ,EAAAA,2DAA6DD,CAAAA,IAA2B,EAG3Jf,EAAKoB,OAAO,8BAA+BZ,CAAAA,EAE3C,OAGF,IAAIT,EAAW,CACbS,kBAAAA,EACAS,kBAAAA,EACAI,WAAY,GACZ,GAAGnB,EACH,GAAGO,EACJ"}
1
+ {"version":3,"file":"disclosure.es.js","names":["isValidInstance","contructor","elements","shouldThrow","result","status","errors","elementsType","TypeError","key","elementType","name","error","push","isValidType","type","values","valuesType","valueType","isQuerySelector","Error","document","querySelector","isValidClassList","Array","isArray","forEach","value","obj","isValidState","validStates","includes","join","isValidEvent","validEvents","isValidHoverType","validTypes","isTag","tagName","HTMLElement","tag","toLowerCase","isValidEventType","eventType","component","Object","prototype","hasOwnProperty","call","events","constructor","keys","hasValidRootDOMElement","_dom","_rootDOMElement","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","Character","isNaN","match","Tab","Asterisk","Object","find","preventEvent","preventDefault","stopPropagation","TransactionalValue","_equals","Object","is","_current","_committed","constructor","initialValue","equals","value","val","committed","isDirty","commit","reset","update","fn","isValidType","isValidInstance","StorageManager","_scope","_type","_storage","_crush","constructor","scope","type","crush","initialize","window","storage","shouldThrow","status","get","key","typeCheck","Error","message","keyCheck","set","data","dataCheck","clear","dispose","isValidInstance","isValidType","isValidClassList","isQuerySelector","isValidState","isValidEvent","isValidEventType","hasValidRootDOMElement","StorageManager","addClass","removeClass","Component","_dom","_rootDOMElement","_protectedDOMElements","_selectors","_elements","_classes","initialize","_durations","_delays","_focusState","_currentEvent","_breakpoint","_mediaQueryString","_mediaQueryList","_mediaQueryListEventCallback","event","matches","_intervals","_timeouts","_listeners","_events","CustomEvent","detail","component","preinitialize","postinitialize","validate","prevalidate","postvalidate","_prefix","_key","_name","_storageKey","_shouldStore","_id","_valid","_initialized","_errors","constructor","prefix","key","initializeClass","_validate","Error","name","errors","map","error","message","join","rootDOMElement","_dispatchEvent","_generateKey","_setDOMElements","_setIds","_setAriaAttributes","_setCustomProps","_createChildElements","_handleMediaMatch","_handleFocus","_handleHover","_handleClick","_handleKeydown","_handleKeyup","_store","console","init","dom","document","documentElement","selectors","elements","classes","durations","delays","intervals","timeouts","listeners","events","value","focusState","currentEvent","shouldFocus","check","breakpoint","mediaQuery","id","isValid","isInitialized","rootDOMElementCheck","shouldThrow","status","Object","keys","length","domElements","domKey","Array","isArray","forEach","element","index","domChecks","HTMLElement","querySelectors","querySelector","querySelectorChecks","className","classListChecks","durationName","durationChecks","delayName","delayChecks","strings","elementType","stringChecks","regenerate","Math","random","toString","replace","substring","_setDOMElementType","context","overwrite","strict","includes","from","querySelectorAll","filteredElements","filter","item","parentElement","_resetDOMElementType","window","matchMedia","_addEventListener","storage","GrauplStorage","scope","set","type","data","_unstore","clear","_setInterval","callback","delay","_clearInterval","setInterval","clearInterval","_clearIntervals","_setTimeout","_clearTimeout","setTimeout","clearTimeout","_clearTimeouts","_registerEvent","bubbles","eventName","charAt","toUpperCase","slice","eventType","dispatchEvent","listener","options","addEventListener","push","_removeEventListener","removeEventListener","registeredListener","i","JSON","stringify","splice","_removeEventListeners","focus","blur","dispose","isValidClassList","isValidType","isTag","addClass","removeClass","keyPress","preventEvent","TransactionalValue","Component","Disclosure","_rootDOMElement","_protectedDOMElements","_open","_openInsideBreakpoint","_openOutsideBreakpoint","_closeInsideBreakpoint","_closeOutsideBreakpoint","_lockInsideBreakpoint","_lockOutsideBreakpoint","_unlockInsideBreakpoint","_unlockOutsideBreakpoint","_locked","_shouldOpen","_closeOnBlur","_storageKey","_name","_mediaQueryListEventCallback","event","matches","unlockInsideBreakpoint","unlock","isOpen","closeInsideBreakpoint","isLocked","close","preserveState","openInsideBreakpoint","open","lockInsideBreakpoint","lock","unlockOutsideBreakpoint","closeOutsideBreakpoint","openOutsideBreakpoint","lockOutsideBreakpoint","constructor","disclosureElement","controllerElement","disclosureContentSelector","lockedClass","unlockedClass","openClass","closeClass","transitionClass","transitionDuration","openDuration","closeDuration","closeOnBlur","minWidth","breakpoint","autoOpen","locked","mediaQuery","prefix","key","initializeClass","initialize","_dom","disclosure","controller","_selectors","content","_classes","unlocked","transition","_durations","console","warn","_breakpoint","_mediaQueryString","_registerEvent","detail","_addEventListener","rootDOMElement","dom","getAttribute","window","matchMedia","booleans","value","booleanChecks","shouldThrow","status","_errors","errors","_valid","_setCustomProps","hasOpened","committed","shouldOpen","shouldBeLocked","_setIds","id","_id","_setAriaAttributes","setAttribute","style","setProperty","_setDOMElements","_resetDOMElementType","_setDOMElementType","context","_reveal","emit","isInitialized","transitionlass","requestAnimationFrame","setTimeout","removeAttribute","_dispatchEvent","_conceal","innert","_lock","_unlock","_handleFocus","currentEvent","relatedTarget","contains","_handleClick","button","toggle","document","focusState","target","_handleKeydown","_handleKeyup","force","commit","preview","toggleLock","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":["../../../src/js/validate.js","../../../src/js/domHelpers.js","../../../src/js/eventHandlers.js","../../../src/js/TransactionalValue.js","../../../src/js/storage/StorageManager.js","../../../src/js/Component.js","../../../src/js/disclosure/Disclosure.js","../../../../../node_modules/@drupal/once/src/once.js","../../../src/js/disclosure/generator.js"],"sourcesContent":["/**\n * @file\n * Validation helper functions.\n */\n\n/* global Component */\n\n/**\n * Check to see if the provided elements have a specific contructor.\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} contructor - The constructor to check for.\n * @param {object} elements - The element(s) to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidInstance(\n contructor,\n elements,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\n if (!(elements[key] instanceof contructor)) {\n const elementType = typeof elements[key];\n throw new TypeError(\n `${key} must be an instance of ${contructor.name}. \"${elementType}\" given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidType(type, values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\n const valueType = typeof values[key];\n\n if (valueType !== type) {\n throw new TypeError(\n `${key} must be a ${type}. \"${valueType}\" given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isQuerySelector(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidClassList(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidState(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEvent(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided values are valid hover types for a menu.\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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidHoverType(values, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\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 try {\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 } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 `{ status: 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 * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isTag(tagName, elements, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (\n isValidType(\"string\", { tagName }, { shouldThrow: true }).status &&\n isValidInstance(HTMLElement, elements, { shouldThrow: true }).status\n ) {\n const tag = tagName.toLowerCase();\n\n for (const key in elements) {\n try {\n if (elements[key].tagName.toLowerCase() !== tag) {\n throw new TypeError(\n `${key} must be a <${tag}> element. <${elements[\n key\n ].tagName.toLowerCase()}> given.`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n }\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the provided event type is valid for dispatching.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {string} eventType - The event type to check.\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow = true ] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function isValidEventType(\n eventType,\n component,\n { shouldThrow = true } = {}\n) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n if (!Object.prototype.hasOwnProperty.call(component.events, eventType)) {\n throw new TypeError(\n `Event type \"${eventType}\" is not valid for ${component.constructor.name}. Valid event types are: \"${Object.keys(component.events).join('\", ')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\n}\n\n/**\n * Check to see if the component has a valid root DOM element.\n *\n * Will return `{ status: true }` if the check is successful.\n *\n * @param {Component} component - The component to check.\n * @param {object} [options = {}] - Additional options.\n * @param {boolean} [options.shouldThrow=true] - Whether to throw on error or return it.\n * @return {Object<boolean, Error[]>} - The result of the check.\n */\nexport function hasValidRootDOMElement(component, { shouldThrow = true } = {}) {\n const result = {\n status: true,\n errors: [],\n };\n\n try {\n // Check to make sure the root DOM element exists in _dom.\n if (\n !Object.prototype.hasOwnProperty.call(\n component._dom,\n component._rootDOMElement\n )\n ) {\n throw new Error(\n `The root DOM element \"${component._rootDOMElement}\" does not exist in the ${component.constructor.name}'s _dom property. It must be one of the following: \"${Object.keys(\n component._dom\n ).join('\", \"')}\".`\n );\n }\n } catch (error) {\n result.status = false;\n result.errors.push(error);\n }\n\n if (shouldThrow && !result.status) {\n throw result.errors[0];\n }\n\n return result;\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 Character: isNaN(key) && !!key.match(/^[a-zA-Z]{1}$/),\n Tab: key === \"Tab\" || key === 9,\n Asterisk: key === \"*\" || key === 56,\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 utility class for managing transactional values.\n */\n\n/**\n * A utility class that maintains a \"current\" value and a \"committed\" value.\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 */\nclass TransactionalValue {\n /**\n * A comparator function used to check equality between\n * the current and committed values.\n *\n * @protected\n *\n * @type {function(*, *): boolean}\n */\n _equals = Object.is;\n\n /**\n * The current, editable value.\n *\n * @protected\n *\n * @type {*}\n */\n _current;\n\n /**\n * The last committed (baseline) value.\n *\n * @protected\n *\n * @type {*}\n */\n _committed;\n\n /**\n * Creates a new TransactionalValue instance.\n *\n * @param {*} initialValue - The starting (and initially committed) value.\n * @param {object} [options = {}] - Options for configuring the instance.\n * @param {function(*, *): boolean} [options.equals = Object.is] - Custom equality comparator. Defaults to `Object.is`.\n */\n constructor(initialValue, { equals = Object.is } = {}) {\n this._equals = equals || Object.is;\n this._current = initialValue;\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 value.\n *\n * @readonly\n *\n * @type {*}\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 * Will be `true` if the values are different, `false` otherwise.\n *\n * @readonly\n *\n * @type {boolean}\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\nexport default TransactionalValue;\n","/**\n * @file\n * Provides a system to get and store data in the browser.\n */\n\nimport { isValidType, isValidInstance } from \"../validate.js\";\n\n/**\n * Class representing a storage system.\n */\nclass StorageManager {\n /**\n * The scope of the storage.\n *\n * @protected\n *\n * @type {string}\n */\n _scope;\n\n /**\n * The type of storage.\n *\n * @protected\n *\n * @type {string}\n */\n _type = \"_default\";\n\n /**\n * The storage object.\n *\n * @protected\n *\n * @type {object}\n */\n _storage = {};\n\n /**\n * Whether to crush the storage instance if it already exists.\n *\n * @protected\n *\n * @type {boolean}\n */\n _crush = false;\n\n /**\n * Creates a Storage instance.\n *\n * @param {object} [options = {}] - The options for the storage.\n * @param {string} options.scope - The scope of the storage.\n * @param {?string} [options.type = null] - The type of storage.\n * @param {boolean} [options.crush = false] - Whether to crush the storage instance if it already exists.\n * @param {boolean} [options.initialize = true] - Whether to initialize the storage.\n */\n constructor({ scope, type = null, crush = false, initialize = true } = {}) {\n this._scope = scope;\n this._type = type || \"_default\";\n this._crush = crush;\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * Initialize the storage.\n */\n initialize() {\n // Try to make sure the storage instance won't crush other instances of StorageManager with the same scope.\n try {\n if (!this._crush && typeof window[this.scope] !== \"undefined\") {\n if (\n isValidInstance(\n StorageManager,\n { storage: window[this.scope] },\n { shouldThrow: false }\n ).status ||\n (typeof window[this.scope].storage !== \"undefined\" &&\n typeof window[this.scope].scope !== \"undefined\" &&\n typeof window[this.scope].type !== \"undefined\")\n ) {\n this._storage = window[this.scope].storage;\n }\n }\n } catch {\n // Do nothing.\n } finally {\n window[this.scope] = this;\n }\n }\n\n /**\n * The scope of the storage.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _scope\n */\n get scope() {\n return this._scope;\n }\n\n /**\n * The type of storage.\n *\n * @type {string}\n *\n * @see _type\n */\n get type() {\n return this._type;\n }\n\n set type(type) {\n if (isValidType(\"string\", { type })) {\n this._type = type;\n }\n }\n\n /**\n * The storage object.\n *\n * @readonly\n *\n * @type {object}\n *\n * @see _storage\n */\n get storage() {\n return this._storage;\n }\n\n /**\n * Get the storage object.\n *\n * @param {object} [options = {}] - The options for getting the storage.\n * @param {string} [options.type = this.type] - The type of storage to get.\n * @param {?string} [options.key = null] - The key to get the value from.\n * @return {object} - The storage object.\n */\n get({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!this.storage[type]) {\n throw new Error(\n `StorageManager (${this.scope}): Type \"${type}\" is not initialized.`\n );\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n return this.storage[type][key];\n }\n\n return this.storage[type];\n }\n\n /**\n * Set the storage object.\n *\n * @param {object} [options = {}] - The options for setting the storage.\n * @param {string} [options.type = this.type] - The type of storage to set.\n * @param {?string} [options.key = null] - The key to set the value to.\n * @param {object} [options.data = {}] - The data to set.\n */\n set({ type = this.type, key = null, data = {} } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n const dataCheck = isValidType(\"object\", { data });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (!dataCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${dataCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n if (!this._storage[type]) {\n this._storage[type] = {};\n }\n\n this._storage[type][key] = data;\n } else {\n this._storage[type] = data;\n }\n }\n\n /**\n * Remove a value from the storage object.\n *\n * @param {object} [options = {}] - The options for removing from storage.\n * @param {string} [options.type = this.type] - The type of storage to remove from.\n * @param {?string} [options.key = null] - The key to remove the value from.\n */\n clear({ type = this.type, key = null } = {}) {\n const typeCheck = isValidType(\"string\", { type });\n\n if (!typeCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${typeCheck.message}`);\n }\n\n if (key !== null) {\n const keyCheck = isValidType(\"string\", { key });\n\n if (!keyCheck.status) {\n throw new Error(`StorageManager (${this.scope}): ${keyCheck.message}`);\n }\n\n delete this.storage[type][key];\n } else {\n delete this.storage[type];\n }\n }\n\n dispose() {\n delete this._storage;\n delete this;\n }\n}\n\nexport default StorageManager;\n","/**\n * @file\n * A generic component class.\n */\n\nimport {\n isValidInstance,\n isValidType,\n isValidClassList,\n isQuerySelector,\n isValidState,\n isValidEvent,\n isValidEventType,\n hasValidRootDOMElement,\n} from \"./validate.js\";\nimport StorageManager from \"./storage/StorageManager.js\";\nimport { addClass, removeClass } from \"./domHelpers.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 root DOM element of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _rootDOMElement = \"\";\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 _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 initialize: new CustomEvent(\"grauplComponentInitialize\", {\n detail: { component: this },\n }),\n preinitialize: new CustomEvent(\"grauplComponentPreinitialize\", {\n detail: { component: this },\n }),\n postinitialize: new CustomEvent(\"grauplComponentPostinitialize\", {\n detail: { component: this },\n }),\n validate: new CustomEvent(\"grauplComponentValidate\", {\n detail: { component: this },\n }),\n prevalidate: new CustomEvent(\"grauplComponentPrevalidate\", {\n detail: { component: this },\n }),\n postvalidate: new CustomEvent(\"grauplComponentPostvalidate\", {\n detail: { component: this },\n }),\n };\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 component name of the component.\n *\n * @protected\n *\n * @type {string}\n */\n _name = \"Component\";\n\n /**\n * The key used for storage.\n *\n * @protected\n *\n * @type {string}\n */\n _storageKey = \"components\";\n\n /**\n * A flag to check if the component should be stored in the StorageManager.\n */\n _shouldStore = true;\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 initialized state of the component.\n *\n * @protected\n *\n * @type {boolean}\n */\n _initialized = false;\n\n /**\n * The errors found throughout the component.\n *\n * @protected\n *\n * @type {Error[]}\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.name}: Cannot initialize component. The following errors have been found:\\n - ${this.errors\n .map((error) => error.message)\n .join(\"\\n - \")}`\n );\n }\n\n addClass(this.initializeClass, this.rootDOMElement);\n\n this._dispatchEvent(\"preinitialize\", this.rootDOMElement);\n\n // Generate the key.\n this._generateKey();\n\n // Set up the DOM.\n this._setDOMElements();\n this._setIds();\n this._setAriaAttributes();\n this._setCustomProps();\n\n // Set up child elements.\n this._createChildElements();\n\n // Handle events.\n this._handleMediaMatch();\n this._handleFocus();\n this._handleHover();\n this._handleClick();\n this._handleKeydown();\n this._handleKeyup();\n\n this._dispatchEvent(\"initialize\", this.rootDOMElement);\n\n // Store the component.\n this._store();\n\n removeClass(this.initializeClass, this.rootDOMElement);\n\n this._initialized = true;\n\n this._dispatchEvent(\"postinitialize\", this.rootDOMElement);\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 root DOM element of the component.\n *\n * @readonly\n *\n * @type {HTMLElement}\n *\n * @see _rootDOMElement\n */\n get rootDOMElement() {\n return this._dom[this._rootDOMElement] || document.documentElement;\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 {Error[]}\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 * 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 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 if (this._breakpoint === \"\") {\n return \"\";\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 * The component name of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _name\n */\n get name() {\n return this._name;\n }\n\n /**\n * The main ID of the component.\n *\n * @readonly\n *\n * @type {string}\n *\n * @see _id\n */\n get id() {\n return this._id;\n }\n\n /**\n * The validity state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _valid\n */\n get isValid() {\n return this._valid;\n }\n\n /**\n * The initialized state of the component.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _initialized\n */\n get isInitialized() {\n return this._initialized;\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 this._dispatchEvent(\"prevalidate\", this.rootDOMElement);\n\n // _rootDOMElement check.\n const rootDOMElementCheck = hasValidRootDOMElement(this, {\n shouldThrow: false,\n });\n\n // Handle _rootDOMElement check failure.\n if (!rootDOMElementCheck.status) {\n this._errors = [...this._errors, ...rootDOMElementCheck.errors];\n this._valid = false;\n }\n\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 } else if (this._dom[domKey] !== null) {\n domElements[`${domKey}Element`] = this._dom[domKey];\n }\n }\n\n // Check the DOM elements.\n const domChecks = isValidInstance(HTMLElement, domElements, {\n shouldThrow: false,\n });\n\n // Handle DOM check failure.\n if (!domChecks.status) {\n this._errors = [...this._errors, ...domChecks.errors];\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 shouldThrow: false,\n });\n\n // Handle query selector check failure.\n if (!querySelectorChecks.status) {\n this._errors = [...this._errors, ...querySelectorChecks.errors];\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, { shouldThrow: false });\n\n // Handle class list check failure.\n if (!classListChecks.status) {\n this._errors = [...this._errors, ...classListChecks.errors];\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 shouldThrow: false,\n });\n\n // Handle duration check failure.\n if (!durationChecks.status) {\n this._errors = [...this._errors, ...durationChecks.errors];\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, { shouldThrow: false });\n\n // Handle delay check failure.\n if (!delayChecks.status) {\n this._errors = [...this._errors, ...delayChecks.errors];\n this._valid = false;\n }\n }\n\n // String checks.\n const strings = {\n _storageKey: this._storageKey,\n key: this._key,\n prefix: this._prefix,\n mediaQuery: this._mediaQueryString,\n breakpoint: this._breakpoint,\n };\n\n this._protectedDOMElements.forEach((elementType) => {\n strings[`_protectedDOMElementType[${elementType}]`] = elementType;\n });\n // Check the strings.\n const stringChecks = isValidType(\"string\", strings, { shouldThrow: false });\n\n // Handle string check failure.\n if (!stringChecks.status) {\n this._errors = [...this._errors, ...stringChecks.errors];\n this._valid = false;\n }\n\n this._dispatchEvent(\"validate\", this.rootDOMElement);\n\n this._dispatchEvent(\"postvalidate\", this.rootDOMElement);\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 = false] - A flag to set if the elements must be direct children of the base.\n */\n _setDOMElementType(\n elementType,\n { context, overwrite = true, strict = false } = {}\n ) {\n // Make sure the element type is valid.\n if (typeof this.selectors[elementType] !== \"string\") {\n throw new Error(\n `Graupl ${this.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 (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.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.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 (\n this._rootDOMElement === elementType ||\n this._protectedDOMElements.includes(elementType)\n ) {\n throw new Error(\n `Graupl ${this.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.mediaQuery === \"\") {\n return;\n }\n\n this._mediaQueryList = window.matchMedia(this.mediaQuery);\n this._addEventListener(\n \"change\",\n this._mediaQueryList,\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 hover events through the component.\n *\n * @protected\n */\n _handleHover() {\n // Add functionality to handle hover 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 // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n // Set up the storage.\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n new StorageManager({ scope: \"GrauplStorage\" });\n }\n\n // Store the menu\n window.GrauplStorage.set({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\n data: this,\n });\n }\n\n /**\n * Removes the component from the global Graupl storage object.\n *\n * @protected\n */\n _unstore() {\n // Make sure the component should be stored.\n if (!this._shouldStore) {\n return;\n }\n\n if (\n !isValidInstance(\n StorageManager,\n { storage: window.GrauplStorage },\n { shouldThrow: false }\n ).status\n ) {\n return;\n }\n\n window.GrauplStorage.clear({\n key: this.id !== \"\" ? this.id : this.key,\n type: this._storageKey,\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 an 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 * Clears all intervals within the component.\n *\n * @protected\n */\n _clearIntervals() {\n for (const scope of Object.keys(this._intervals)) {\n this._clearInterval(scope);\n }\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 a 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 * Clears all timeouts within the component.\n *\n * @protected\n */\n _clearTimeouts() {\n for (const scope of Object.keys(this._timeouts)) {\n this._clearTimeout(scope);\n }\n }\n\n /**\n * Registers a new event type within the component.\n *\n * @protected\n *\n * @param {string} name - The name of the new event type.\n * @param {object} [options = {}] - The options for the new event type.\n * @param {boolean} [options.bubbles = true] - A flag to set if the event bubbles.\n * @param {object} [options.detail = {}] - Additional details to include in the event.\n */\n _registerEvent(name, { bubbles = true, detail = {} } = {}) {\n isValidType(\"string\", { name });\n isValidType(\"boolean\", { bubbles });\n isValidType(\"object\", { detail });\n\n const eventName = `graupl${this.name}${name.charAt(0).toUpperCase()}${name.slice(\n 1\n )}`;\n\n this._events[name] = new CustomEvent(eventName, {\n bubbles,\n detail: { component: this, ...detail },\n });\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 isValidEventType(eventType, this);\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 from an element and unregister it within the component.\n *\n * @param {string} type - The type of event to remove.\n * @param {HTMLElement} element - The element to remove the listener from.\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 // Find the listener in the component's listener storage.\n let index = -1;\n\n this._listeners.forEach((registeredListener, i) => {\n if (\n registeredListener.type === type &&\n registeredListener.element === element &&\n registeredListener.listener === listener &&\n JSON.stringify(registeredListener.options) === JSON.stringify(options)\n ) {\n index = i;\n }\n });\n\n // Remove it from the component's listener storage.\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Removes all event listeners registered in the component.\n *\n * This can be filtered by type and/or element.\n *\n * @protected\n *\n * @param {object} [options = {}] - Options for removing listeners.\n * @param {?string} [options.type = null] - The type of event to remove. If null, all types are removed.\n * @param {?HTMLElement} [options.element = null] - The element to remove listeners from. If null, all elements are removed.\n */\n _removeEventListeners({ type = null, element = null } = {}) {\n const listeners = [...this._listeners];\n\n listeners.forEach((listener) => {\n if (type !== null && listener.type !== type) return;\n if (element !== null && listener.element !== element) return;\n\n this._removeEventListener(\n listener.type,\n listener.element,\n listener.listener,\n listener.options\n );\n });\n }\n\n /**\n * Focus the component.\n *\n * Sets the components's focus state to \"self\" and\n * focusses the component if the component's shouldFocus\n * value is `true`.\n */\n focus() {\n this.focusState = \"self\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.focus();\n }\n }\n\n /**\n * Unfocus the component.\n *\n * Sets the component's focus state to \"none\"\n * and blurs the component if the component's shouldFocus\n * value is `true`.\n */\n blur() {\n this.focusState = \"none\";\n\n if (this.shouldFocus) {\n this.rootDOMElement.blur();\n }\n }\n\n /**\n * Disposes of the current instantiated component.\n *\n * Removes all timeouts and event listeners, removes the component from the global storage, and delete's the object.\n */\n dispose() {\n this._clearIntervals();\n this._clearTimeouts();\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\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\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\n/**\n * The Disclosure component.\n *\n * @extends Component\n *\n * Protected fields are documented below.\n *\n * @property {Object<HTMLElement>} _dom - The DOM elements within the disclosure.\n * @property {HTMLElement} _dom.controller - The disclosure controller element.\n * @property {HTMLElement} _dom.disclosure - The disclosure element.\n * @property {HTMLElement} _dom.content - The disclosure content element.\n * @property {string} _rootDOMElement - The root DOM element of the disclosure.\n * @property {string[]} _protectedDOMElements - The DOM elements within the disclosure that cannot be reset or generated by the disclosure itself.\n * @property {Object<string>} _selectors - The query selectors used by the disclosure.\n * @property {string} _selectors.content - The query selector for the disclosure content.\n * @property {Object<string, string[]>} _classes - The CSS classes to apply when the disclosure is in various states.\n * @property {string|string[]} _classes.locked - The class(es) to apply when the disclosure is locked.\n * @property {string|string[]} _classes.unlocked - The class(es) to apply when the disclosure is unlocked.\n * @property {string|string[]} _classes.open - The class(es) to apply when the disclosure is open.\n * @property {string|string[]} _classes.close - The class(es) to apply when the disclosure is closed.\n * @property {string|string[]} _classes.transition - The class(es) to apply when the disclosure is transitioning between states.\n * @property {string|string[]} _classes.initialize - The class(es) to apply when the disclosure is initializing.\n * @property {Object<number>} _durations - The duration times (in milliseconds) for various aspects throughout the disclosure.\n * @property {number} _durations.transition - The duration time (in milliseconds) for the transition between open and closed states.\n * @property {number} _durations.open - The duration time (in milliseconds) for the transition from closed to open states.\n * @property {number} _durations.close - The duration time (in milliseconds) for the transition from open to closed states.\n * @property {TransactionalValue<boolean>} _open - The open state of the disclosure.\n * @property {boolean} _shouldOpen - A value to force the disclosure open when the breakpoint width is passed.\n * @property {boolean} _openInsideBreakpoint - A flag to open the disclosure when inside the breakpoint.\n * @property {boolean} _openOutsideBreakpoint - A flag to open the disclosure when outside the breakpoint.\n * @property {boolean} _closeInsideBreakpoint - A flag to close the disclosure when inside the breakpoint.\n * @property {boolean} _closeOutsideBreakpoint - A flag to close the disclosure when outside the breakpoint.\n * @property {boolean} _lockInsideBreakpoint - A flag to lock the disclosure in its current state when inside the breakpoint.\n * @property {boolean} _lockOutsideBreakpoint - A flag to lock the disclosure in its current state when outside the breakpoint.\n * @property {boolean} _unlockInsideBreakpoint - A flag to unlock the disclosure when inside the breakpoint.\n * @property {boolean} _unlockOutsideBreakpoint - A flag to unlock the disclosure when outside the breakpoint.\n * @property {TransactionalValue<boolean>} _locked - The locked state of the disclosure.\n * @property {boolean} _closeOnBlur - Whether to close the disclosure when it loses focus in the DOM.\n * @property {Function} _mediaQueryListEventCallback - The callback for media query list events.\n * @property {string} _storageKey - The key used for storage.\n * @property {boolean} _shouldStore - A flag to check if the component should be stored in the StorageManager.\n * @property {Object<CustomEvent>} _events - Custom events that can be triggered throughout the disclosure.\n * @property {grauplDisclosureExpand} _events.expand - The event triggered when the disclosure is expanded.\n * @property {grauplDisclosureCollapse} _events.collapse - The event triggered when the disclosure is collapsed.\n * @property {Object<object>} _elements - The instantiated elements within the disclosure.\n * @property {Object<number>} _delays - The delay times (in milliseconds) for various aspects throughout the disclosure.\n * @property {string} _focusState - The current state of the disclosure's focus.\n * @property {string} _currentEvent - The last type of event triggered within the disclosure.\n * @property {string} _breakpoint - The breakpoint that the disclosure will call media query list events.\n * @property {string} _mediaQueryString - The media query to use to trigger media query list events.\n * @property {MediaQueryList|null} _mediaQueryList - The MediaQueryList for the disclosure.\n * @property {Object<Function>} _intervals - Intervals throughout the disclosure.\n * @property {Object<Function>} _timeouts - Timeouts throughout the disclosure.\n * @property {object[]} _listeners - Event listeners throughout the disclosure.\n * @property {string} _prefix - The prefix used for CSS custom properties and attributes.\n * @property {string} _key - The key used to generate IDs throughout the disclosure.\n * @property {string} _name - The component name of the disclosure.\n * @property {string} _id - The main ID of the disclosure.\n * @property {boolean} _valid - The validity state of the disclosure.\n * @property {boolean} _initialized - The initialized state of the disclosure.\n * @property {string[]} _errors - The errors found throughout the disclosure.\n */\nclass Disclosure extends Component {\n _rootDOMElement = \"disclosure\";\n _protectedDOMElements = [\"controller\"];\n _open = new TransactionalValue(false);\n _openInsideBreakpoint = false;\n _openOutsideBreakpoint = false;\n _closeInsideBreakpoint = false;\n _closeOutsideBreakpoint = false;\n _lockInsideBreakpoint = false;\n _lockOutsideBreakpoint = false;\n _unlockInsideBreakpoint = false;\n _unlockOutsideBreakpoint = false;\n _locked = new TransactionalValue(false);\n _shouldOpen = false;\n _closeOnBlur = false;\n _storageKey = \"disclosures\";\n _name = \"Disclosure\";\n _mediaQueryListEventCallback = (event) => {\n if (event.matches) {\n if (this.unlockInsideBreakpoint) {\n this.unlock();\n }\n\n if (this.isOpen && this.closeInsideBreakpoint) {\n if (this.isLocked) {\n this.unlock();\n }\n this.close({ preserveState: true });\n } else if (!this.isOpen && this.openInsideBreakpoint) {\n if (this.isLocked) {\n this.unlock();\n }\n this.open();\n }\n\n if (this.lockInsideBreakpoint) {\n this.lock();\n }\n } else {\n if (this.unlockOutsideBreakpoint) {\n this.unlock();\n }\n\n if (this.isOpen && this.closeOutsideBreakpoint) {\n if (this.isLocked) {\n this.unlock();\n }\n this.close({ preserveState: true });\n } else if (!this.isOpen && this.openOutsideBreakpoint) {\n if (this.isLocked) {\n this.unlock();\n }\n this.open();\n }\n\n if (this.lockOutsideBreakpoint) {\n this.lock();\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.lockedClass = locked] - The class(es) to apply when the disclosure is locked.\n * @param {?(string|string[])} [options.unlockedClass = unlocked] - The class(es) to apply when the disclosure is unlocked.\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.breakpoint = \"\"] - The breakpoint that the disclosure will automatically open/close itself.\n * @param {boolean} [options.openInsideBreakpoint = false] - A flag to open the disclosure when inside the breakpoint.\n * @param {boolean} [options.openOutsideBreakpoint = false] - A flag to open the disclosure when outside the breakpoint.\n * @param {boolean} [options.closeInsideBreakpoint = false] - A flag to close the disclosure when inside the breakpoint.\n * @param {boolean} [options.closeOutsideBreakpoint = false] - A flag to close the disclosure when outside the breakpoint.\n * @param {boolean} [options.lockInsideBreakpoint = false] - A flag to lock the disclosure when inside the breakpoint.\n * @param {boolean} [options.lockOutsideBreakpoint = false] - A flag to lock the disclosure when outside the breakpoint.\n * @param {boolean} [options.unlockInsideBreakpoint = false] - A flag to unlock the disclosure when inside the breakpoint.\n * @param {boolean} [options.unlockOutsideBreakpoint = false] - A flag to unlock the disclosure when outside the breakpoint.\n * @param {boolean} [options.locked = false] - A flag to lock the disclosure in its current state.\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 lockedClass = \"locked\",\n unlockedClass = \"unlocked\",\n openClass = \"show\",\n closeClass = \"hide\",\n transitionClass = \"transitioning\",\n transitionDuration = 250,\n openDuration = -1,\n closeDuration = -1,\n closeOnBlur = false,\n minWidth = \"\",\n breakpoint = \"\",\n autoOpen = false,\n openInsideBreakpoint = false,\n openOutsideBreakpoint = false,\n closeInsideBreakpoint = false,\n closeOutsideBreakpoint = false,\n lockInsideBreakpoint = false,\n lockOutsideBreakpoint = false,\n unlockInsideBreakpoint = false,\n unlockOutsideBreakpoint = false,\n locked = 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.locked = lockedClass || \"\";\n this._classes.unlocked = unlockedClass || \"\";\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 // @todo Remove minWidth and autoOpen options in favor of breakpoint, openInsideBreakpoint, openOutsideBreakpoint, closeInsideBreakpoint, and closeOutsideBreakpoint options.\n if (minWidth !== \"\") {\n console.warn(\n \"`minWidth` is deprecated and will be removed in a future release. Please set `breakpoint` instead.\"\n );\n\n if (breakpoint === \"\") {\n breakpoint = minWidth;\n }\n }\n\n if (autoOpen && breakpoint !== \"\") {\n console.warn(\n \"`autoOpen` is deprecated and will be removed in a future release. Please set `openOutsideBreakpoint` and `closeInsideBreakpoint` to `true` instead.\"\n );\n\n openOutsideBreakpoint = autoOpen;\n closeInsideBreakpoint = autoOpen;\n }\n\n // Set collapse width and auto open functionality.\n this._breakpoint = breakpoint || \"\";\n this._shouldOpen = autoOpen;\n this._openInsideBreakpoint = openInsideBreakpoint;\n this._openOutsideBreakpoint = openOutsideBreakpoint;\n this._closeInsideBreakpoint = closeInsideBreakpoint;\n this._closeOutsideBreakpoint = closeOutsideBreakpoint;\n this._lockInsideBreakpoint = lockInsideBreakpoint;\n this._lockOutsideBreakpoint = lockOutsideBreakpoint;\n this._unlockInsideBreakpoint = unlockInsideBreakpoint;\n this._unlockOutsideBreakpoint = unlockOutsideBreakpoint;\n this._mediaQueryString = mediaQuery || \"\";\n\n // Set the lock state.\n this._locked = new TransactionalValue(locked);\n\n // Register custom events.\n this._registerEvent(\"expand\", { detail: { disclosure: this } });\n this._registerEvent(\"collapse\", { detail: { disclosure: this } });\n this._registerEvent(\"lock\", { detail: { disclosure: this } });\n this._registerEvent(\"unlock\", { detail: { disclosure: this } });\n\n // Set up custom initialization.\n this._addEventListener(\n \"grauplComponentInitialize\",\n this.rootDOMElement,\n () => {\n // Handle auto-opening disclosures with aria-expanded set to true or\n // those that _should_ open.\n if (\n this.dom.controller.getAttribute(\"aria-expanded\") === \"true\" ||\n (this.openOutsideBreakpoint &&\n !window.matchMedia(this.mediaQuery).matches) ||\n (this.openInsideBreakpoint &&\n window.matchMedia(this.mediaQuery).matches)\n ) {\n this.open();\n } else {\n this.close();\n }\n\n // Handle auto-locking disclosures that should be locked.\n if (\n this.isLocked ||\n (this.lockInsideBreakpoint &&\n window.matchMedia(this.mediaQuery).matches) ||\n (this.lockOutsideBreakpoint &&\n !window.matchMedia(this.mediaQuery).matches)\n ) {\n this.lock();\n }\n }\n );\n\n // Set up custom validation.\n this._addEventListener(\n \"grauplComponentValidate\",\n this.rootDOMElement,\n () => {\n // Boolean checks.\n const booleans = {\n closeOnBlur: this._closeOnBlur,\n openInsideBreakpoint: this._openInsideBreakpoint,\n openOutsideBreakpoint: this._openOutsideBreakpoint,\n closeInsideBreakpoint: this._closeInsideBreakpoint,\n closeOutsideBreakpoint: this._closeOutsideBreakpoint,\n lockInsideBreakpoint: this._lockInsideBreakpoint,\n lockOutsideBreakpoint: this._lockOutsideBreakpoint,\n unlockInsideBreakpoint: this._unlockInsideBreakpoint,\n unlockOutsideBreakpoint: this._unlockOutsideBreakpoint,\n locked: this._locked.value,\n };\n\n // Check the booleans.\n const booleanChecks = isValidType(\"boolean\", booleans, {\n shouldThrow: false,\n });\n\n // Handle boolean check failure.\n if (!booleanChecks.status) {\n this._errors = [...this._errors, ...booleanChecks.errors];\n this._valid = false;\n }\n }\n );\n\n if (initialize) {\n this.initialize();\n }\n }\n\n /**\n * The class(es) to apply to the disclosure.\n *\n * @type {string|string[]}\n *\n * @see _classes.locked\n */\n get lockedClass() {\n return this._classes.locked;\n }\n\n set lockedClass(value) {\n isValidClassList({ lockedClass: value });\n\n if (this._classes.locked !== value) {\n this._classes.locked = value;\n }\n }\n\n /**\n * The class(es) to apply to the disclosure.\n *\n * @type {string|string[]}\n *\n * @see _classes.unlocked\n */\n get unlockedClass() {\n return this._classes.unlocked;\n }\n\n set unlockedClass(value) {\n isValidClassList({ unlockedClass: value });\n\n if (this._classes.unlocked !== value) {\n this._classes.unlocked = value;\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 console.warn(\n \"`minWidth` is deprecated and will be removed in a future release. Please use `breakpoint` instead.\"\n );\n\n return this.breakpoint;\n }\n\n set minWidth(value) {\n console.warn(\n \"`minWidth` is deprecated and will be removed in a future release. Please use `breakpoint` instead.\"\n );\n\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 regardless of user interaction.\n *\n * @type {boolean}\n *\n * @see _shouldOpen\n */\n get shouldOpen() {\n console.warn(\n \"`shouldOpen` is deprecated and will be removed in a future release. Please use `openOutsideBreakpoint` and `closeInsideBreakpoint` instead.\"\n );\n\n return this._shouldOpen;\n }\n\n set shouldOpen(value) {\n console.warn(\n \"`shouldOpen` is deprecated and will be removed in a future release. Please use `openOutsideBreakpoint` and `closeInsideBreakpoint` instead.\"\n );\n\n isValidType(\"boolean\", { shouldOpen: value });\n\n if (this._shouldOpen !== value) {\n this._shouldOpen = value;\n }\n }\n\n /**\n * A flag to open the disclosure when inside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _openInsideBreakpoint\n */\n get openInsideBreakpoint() {\n return this._openInsideBreakpoint;\n }\n\n set openInsideBreakpoint(value) {\n isValidType(\"boolean\", { openInsideBreakpoint: value });\n\n if (this._openInsideBreakpoint !== value) {\n this._openInsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to open the disclosure when outside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _openOutsideBreakpoint\n */\n get openOutsideBreakpoint() {\n return this._openOutsideBreakpoint;\n }\n\n set openOutsideBreakpoint(value) {\n isValidType(\"boolean\", { openOutsideBreakpoint: value });\n\n if (this._openOutsideBreakpoint !== value) {\n this._openOutsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to close the disclosure when inside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _closeInsideBreakpoint\n */\n get closeInsideBreakpoint() {\n return this._closeInsideBreakpoint;\n }\n\n set closeInsideBreakpoint(value) {\n isValidType(\"boolean\", { closeInsideBreakpoint: value });\n\n if (this._closeInsideBreakpoint !== value) {\n this._closeInsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to close the disclosure when outside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _closeOutsideBreakpoint\n */\n get closeOutsideBreakpoint() {\n return this._closeOutsideBreakpoint;\n }\n\n set closeOutsideBreakpoint(value) {\n isValidType(\"boolean\", { closeOutsideBreakpoint: value });\n\n if (this._closeOutsideBreakpoint !== value) {\n this._closeOutsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to lock the disclosure in its current state when inside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _lockInsideBreakpoint\n */\n get lockInsideBreakpoint() {\n return this._lockInsideBreakpoint;\n }\n\n set lockInsideBreakpoint(value) {\n isValidType(\"boolean\", { lockInsideBreakpoint: value });\n\n if (this._lockInsideBreakpoint !== value) {\n this._lockInsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to lock the disclosure in its current state when outside the breakpoint.\n *\n * @type {boolean}\n *\n * @see _lockOutsideBreakpoint\n */\n get lockOutsideBreakpoint() {\n return this._lockOutsideBreakpoint;\n }\n\n set lockOutsideBreakpoint(value) {\n isValidType(\"boolean\", { lockOutsideBreakpoint: value });\n\n if (this._lockOutsideBreakpoint !== value) {\n this._lockOutsideBreakpoint = value;\n }\n }\n\n /**\n * A flag to indicate if the disclosure is locked.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _locked\n */\n get isLocked() {\n return this._locked.value;\n }\n\n /**\n * The committed lock preference for the disclosure.\n *\n * @readonly\n *\n * @type {boolean}\n *\n * @see _locked\n */\n get shouldBeLocked() {\n return this._locked.committed;\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 controller has `aria-expanded` set to \"false\"\n * if it's not already explicitly 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 (\n !isTag(\n \"button\",\n { controller: this.dom.controller },\n { shouldThrow: false }\n ).status\n ) {\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 = this.isInitialized] - Emit the expand event once expanded.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n */\n _reveal({ emit = this.isInitialized, transition = this.isInitialized } = {}) {\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 = this.isInitialized] - Emit the collapse event once collapsed.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n */\n _conceal({\n emit = this.isInitialized,\n transition = this.isInitialized,\n } = {}) {\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 * Applies the locked state styling and dispatches the lock event.\n *\n * @protected\n *\n * @param {Object<boolean>} [options = {}] - Options for the lock side effects.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the lock event.\n */\n _lock({ emit = this.isInitialized } = {}) {\n // Add the locked class\n addClass(this.lockedClass, this.dom.disclosure);\n\n // Remove the unlocked class.\n removeClass(this.unlockedClass, this.dom.disclosure);\n\n this.dom.controller.setAttribute(\"disabled\", \"true\");\n\n if (emit) {\n this._dispatchEvent(\"lock\", this.dom.disclosure);\n }\n }\n\n /**\n * Applies the unlocked state styling and dispatches the unlock event.\n *\n * @protected\n *\n * @param {Object<boolean>} [options = {}] - Options for the unlock side effects.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the unlock event.\n */\n _unlock({ emit = this.isInitialized } = {}) {\n // Add the unlocked class\n addClass(this.unlockedClass, this.dom.disclosure);\n\n // Remove the locked class.\n removeClass(this.lockedClass, this.dom.disclosure);\n\n this.dom.controller.removeAttribute(\"disabled\");\n\n if (emit) {\n this._dispatchEvent(\"unlock\", this.dom.disclosure);\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 `click` listener to the controller that toggles the disclosure.\n * - Adds a `click` listener to the `document` so if the user clicks outside the disclosure it will close.\n */\n _handleClick() {\n this._addEventListener(\"click\", 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(\"click\", 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.emit = this.isInitialized] - Whether to emit the expand event once opened.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n open({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n preserveState = false,\n } = {}) {\n if (this.isOpen && !force) return;\n if (this.isLocked) return;\n\n // Set the focus state.\n this.focusState = \"self\";\n\n // Expand the disclosure.\n this._reveal({ emit, transition });\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.emit = this.isInitialized] - Whether to emit the expand event once previewed.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n preview({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n preserveState = false,\n } = {}) {\n if (this.isOpen && !force) return;\n if (this.isLocked) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Expand the disclosure.\n this._reveal({ emit, transition });\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.emit = this.isInitialized] - Whether to emit the collapse event once closed.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n close({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n preserveState = false,\n } = {}) {\n if (!this.isOpen && !force) return;\n if (this.isLocked) return;\n\n // Set the focus state.\n this.focusState = \"none\";\n\n // Collapse the disclosure.\n this._conceal({ emit, transition });\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.emit = this.isInitialized] - Whether to emit the expand/collapse event once toggled.\n * @param {boolean} [options.transition = this.isInitialized] - Respect the transition class.\n * @param {boolean} [options.preserveState = false] - Whether to preserve the open state.\n */\n toggle({\n force = false,\n emit = this.isInitialized,\n transition = this.isInitialized,\n preserveState = false,\n } = {}) {\n if (this.isOpen) {\n this.close({ force, emit, transition, preserveState });\n } else {\n this.open({ force, emit, transition, preserveState });\n }\n }\n\n /**\n * Locks the disclosure.\n *\n * @param {Object<boolean>} [options = {}] - Options for locking the disclosure.\n * @param {boolean} [options.force = false] - Whether to force the lock action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the lock event.\n */\n lock({ force = false, emit = this.isInitialized } = {}) {\n // Only lock if the disclosure is unlocked.\n if (this.isLocked && !force) return;\n\n this._locked.value = true;\n this._lock({ emit });\n\n // Commit the locked preference.\n this._locked.commit();\n }\n\n /**\n * Unlocks the disclosure.\n *\n * @param {Object<boolean>} [options = {}] - Options for unlocking the disclosure.\n * @param {boolean} [options.force = true] - Whether to force the unlock action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the unlock event.\n */\n unlock({ force = false, emit = this.isInitialized } = {}) {\n // Only unlock if the disclosure is locked.\n if (!this.isLocked && !force) return;\n\n this._locked.value = false;\n this._unlock({ emit });\n\n this._locked.commit();\n }\n\n /**\n * Toggles the locked state of the disclosure.\n *\n * @param {Object<boolean>} [options = {}] - Options for toggling the lock state.\n * @param {boolean} [options.force = false] - Whether to force the toggle action.\n * @param {boolean} [options.emit = this.isInitialized] - Whether to emit the lock/unlock event.\n */\n toggleLock({ force = false, emit = this.isInitialized } = {}) {\n if (this.isLocked) {\n this.unlock({ force, emit });\n } else {\n this.lock({ force, emit });\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":[7],"mappings":"AAwBA,SAAgBA,EACdC,EACAC,EACA,CAAEC,YAAAA,EAAc,EAAA,EAAS,CAAA,EACzB,CACA,MAAMC,EAAS,CACbC,OAAQ,GACRC,OAAQ,CAAA,GAGV,GAAI,CACF,GAAI,OAAOJ,GAAa,SAAU,CAChC,MAAMK,EAAe,OAAOL,EAE5B,MAAM,IAAIM,UACR,qEAAqED,CAAAA,UAAY,EAIrF,UAAWE,KAAOP,EAChB,GAAI,CACF,GAAI,EAAEA,EAASO,CAAAA,YAAgBR,GAAa,CAC1C,MAAMS,EAAc,OAAOR,EAASO,CAAAA,EACpC,MAAM,IAAID,UACR,GAAGC,CAAAA,2BAA8BR,EAAWU,IAAAA,MAAUD,CAAAA,UAAW,SAG9DE,EAAO,CACdR,EAAOC,OAAS,GAChBD,EAAOE,OAAOO,KAAKD,CAAAA,SAGhBA,EAAO,CACdR,EAAOC,OAAS,GAChBD,EAAOE,OAAOO,KAAKD,CAAAA,EAGrB,GAAIT,GAAe,CAACC,EAAOC,OACzB,MAAMD,EAAOE,OAAO,CAAA,EAGtB,OAAOF,EAoBT,SAAgBU,EAAYC,EAAMC,EAAQ,CAAEb,YAAAA,EAAc,EAAA,EAAS,CAAA,EAAI,CACrE,MAAMC,EAAS,CACbC,OAAQ,GACRC,OAAQ,CAAA,GAGV,GAAI,CACF,GAAI,OAAOU,GAAW,SAAU,CAC9B,MAAMC,EA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