1 line
No EOL
9.2 KiB
Text
1 line
No EOL
9.2 KiB
Text
{"version":3,"file":"header.nomodule.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/header/script/header/header-selector.js","../../../src/component/header/script/header/header-links.js","../../../src/component/header/script/header/header-modal.js","../../../src/component/header/index.js","../../../src/component/header/main.js"],"sourcesContent":["const config = {\r\n prefix: 'fr',\r\n namespace: 'dsfr',\r\n organisation: '@gouvfr',\r\n version: '1.11.2'\r\n};\r\n\r\nexport default config;\r\n","import config from './config.js';\nconst api = window[config.namespace];\nexport default api;\n","import api from '../../api.js';\n\nexport const HeaderSelector = {\n HEADER: api.internals.ns.selector('header'),\n TOOLS_LINKS: api.internals.ns.selector('header__tools-links'),\n MENU_LINKS: api.internals.ns.selector('header__menu-links'),\n BUTTONS: `${api.internals.ns.selector('header__tools-links')} ${api.internals.ns.selector('btns-group')}, ${api.internals.ns.selector('header__tools-links')} ${api.internals.ns.selector('links-group')}`,\n MODALS: `${api.internals.ns.selector('header__search')}${api.internals.ns.selector('modal')}, ${api.internals.ns.selector('header__menu')}${api.internals.ns.selector('modal')}`\n};\n","import api from '../../api.js';\nimport { HeaderSelector } from './header-selector.js';\n\nclass HeaderLinks extends api.core.Instance {\n static get instanceClassName () {\n return 'HeaderLinks';\n }\n\n init () {\n const header = this.queryParentSelector(HeaderSelector.HEADER);\n this.toolsLinks = header.querySelector(HeaderSelector.TOOLS_LINKS);\n this.menuLinks = header.querySelector(HeaderSelector.MENU_LINKS);\n const copySuffix = '-mobile';\n\n const toolsHtml = this.toolsLinks.innerHTML.replace(/ +/g, ' ');\n const menuHtml = this.menuLinks.innerHTML.replace(/ +/g, ' ');\n // Pour éviter de dupliquer des id, on ajoute un suffixe aux id et aria-controls duppliqués.\n let toolsHtmlIdList = toolsHtml.match(/id=\"(.*?)\"/gm) || [];\n\n // on a besoin d'échapper les backslash dans la chaine de caractère\n // eslint-disable-next-line no-useless-escape\n toolsHtmlIdList = toolsHtmlIdList.map(element => element.replace('id=\\\"', '').replace('\\\"', ''));\n\n const toolsHtmlAriaControlList = toolsHtml.match(/aria-controls=\"(.*?)\"/gm);\n let toolsHtmlDuplicateId = toolsHtml.replace(/id=\"(.*?)\"/gm, 'id=\"$1' + copySuffix + '\"');\n if (toolsHtmlAriaControlList) {\n for (const element of toolsHtmlAriaControlList) {\n const ariaControlsValue = element.replace('aria-controls=\"', '').replace('\"', '');\n if (toolsHtmlIdList.includes(ariaControlsValue)) {\n toolsHtmlDuplicateId = toolsHtmlDuplicateId.replace(`aria-controls=\"${ariaControlsValue}\"`, `aria-controls=\"${ariaControlsValue + copySuffix}\"`);\n };\n }\n }\n\n if (toolsHtmlDuplicateId === menuHtml) return;\n\n switch (api.mode) {\n case api.Modes.ANGULAR:\n case api.Modes.REACT:\n case api.Modes.VUE:\n this.warn(`header__tools-links content is different from header__menu-links content.\nAs you're using a dynamic framework, you should handle duplication of this content yourself, please refer to documentation:\n${api.header.doc}`);\n break;\n\n default:\n this.menuLinks.innerHTML = toolsHtmlDuplicateId;\n }\n }\n}\n\nexport { HeaderLinks };\n","import api from '../../api.js';\n\nclass HeaderModal extends api.core.Instance {\n static get instanceClassName () {\n return 'HeaderModal';\n }\n\n init () {\n this.isResizing = true;\n }\n\n resize () {\n if (this.isBreakpoint(api.core.Breakpoints.LG)) this.deactivateModal();\n else this.activateModal();\n }\n\n activateModal () {\n const modal = this.element.getInstance('Modal');\n if (!modal) return;\n modal.isEnabled = true;\n this.listenClick({ capture: true });\n }\n\n deactivateModal () {\n const modal = this.element.getInstance('Modal');\n if (!modal) return;\n modal.conceal();\n modal.isEnabled = false;\n this.unlistenClick({ capture: true });\n }\n\n handleClick (e) {\n if (e.target.matches('a, button') && !e.target.matches('[aria-controls]') && !e.target.matches(api.core.DisclosureSelector.PREVENT_CONCEAL)) {\n const modal = this.element.getInstance('Modal');\n modal.conceal();\n }\n }\n}\n\nexport { HeaderModal };\n","import api from './api.js';\nimport { HeaderLinks } from './script/header/header-links.js';\nimport { HeaderModal } from './script/header/header-modal.js';\nimport { HeaderSelector } from './script/header/header-selector.js';\n\napi.header = {\n HeaderLinks: HeaderLinks,\n HeaderModal: HeaderModal,\n HeaderSelector: HeaderSelector,\n doc: 'https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/en-tete'\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.header.HeaderSelector.TOOLS_LINKS, api.header.HeaderLinks);\napi.internals.register(api.header.HeaderSelector.MODALS, api.header.HeaderModal);\n\nexport default api;\n"],"names":["const","let"],"mappings":";;;;;EAAAA,IAAM,MAAM,GAAG;EACf,EAAE,MAAM,EAAE,IAAI;EACd,EAAE,SAAS,EAAE,MAAM;EACnB,EAAE,YAAY,EAAE,SAAS;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,CAAC;;ECJDA,IAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;;ECC7BA,IAAM,cAAc,GAAG;EAC9B,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;EAC7C,EAAE,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;EAC/D,EAAE,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;EAC7D,EAAE,OAAO,IAAK,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,YAAK,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAC,WAAK,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,EAAC,UAAI,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,GAAG;EAC5M,EAAE,MAAM,SAAK,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,MAAI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