1 line
No EOL
5.4 KiB
Text
1 line
No EOL
5.4 KiB
Text
{"version":3,"file":"breadcrumb.nomodule.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js","../../../src/component/breadcrumb/script/breadcrumb/breadcrumb.js","../../../src/component/breadcrumb/index.js","../../../src/component/breadcrumb/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 BreadcrumbSelector = {\n BREADCRUMB: api.internals.ns.selector('breadcrumb'),\n BUTTON: api.internals.ns.selector('breadcrumb__button')\n};\n","import api from '../../api.js';\nimport { BreadcrumbSelector } from './breadcrumb-selector.js';\n\nclass Breadcrumb extends api.core.Instance {\n constructor () {\n super();\n this.count = 0;\n this.focusing = this.focus.bind(this);\n }\n\n static get instanceClassName () {\n return 'Breadcrumb';\n }\n\n init () {\n this.getCollapse();\n this.isResizing = true;\n }\n\n get proxy () {\n const scope = this;\n return Object.assign(super.proxy, {\n focus: scope.focus.bind(scope),\n disclose: scope.collapse.disclose.bind(scope.collapse)\n });\n }\n\n getCollapse () {\n const collapse = this.collapse;\n if (collapse) {\n collapse.listen(api.core.DisclosureEvent.DISCLOSE, this.focusing);\n } else {\n this.addAscent(api.core.DisclosureEmission.ADDED, this.getCollapse.bind(this));\n }\n }\n\n resize () {\n const collapse = this.collapse;\n const links = this.links;\n if (!collapse || !links.length) return;\n\n if (this.isBreakpoint(api.core.Breakpoints.MD)) {\n if (collapse.buttonHasFocus) links[0].focus();\n } else {\n if (links.indexOf(document.activeElement) > -1) collapse.focus();\n }\n }\n\n get links () {\n return [...this.querySelectorAll('a[href]')];\n }\n\n get collapse () {\n return this.element.getDescendantInstances(api.core.Collapse.instanceClassName, null, true)[0];\n }\n\n focus () {\n this.count = 0;\n this._focus();\n }\n\n _focus () {\n const link = this.links[0];\n if (!link) return;\n link.focus();\n this.request(this.verify.bind(this));\n }\n\n verify () {\n this.count++;\n if (this.count > 100) return;\n const link = this.links[0];\n if (!link) return;\n if (document.activeElement !== link) this._focus();\n }\n\n get collapsePrimary () {\n const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && button.hasClass(BreadcrumbSelector.BUTTON));\n return buttons[0];\n }\n}\n\nexport { Breadcrumb };\n","import api from './api.js';\nimport { Breadcrumb } from './script/breadcrumb/breadcrumb.js';\nimport { BreadcrumbSelector } from './script/breadcrumb/breadcrumb-selector.js';\n\napi.breadcrumb = {\n BreadcrumbSelector: BreadcrumbSelector,\n Breadcrumb: Breadcrumb\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.breadcrumb.BreadcrumbSelector.BREADCRUMB, api.breadcrumb.Breadcrumb);\n\nexport default api;\n"],"names":["const","api","window","BreadcrumbSelector","BREADCRUMB","internals","ns","selector","BUTTON","Breadcrumb","super","this","count","focusing","focus","bind","staticAccessors","instanceClassName","init","getCollapse","isResizing","prototypeAccessors","proxy","scope","Object","assign","disclose","collapse","listen","core","DisclosureEvent","DISCLOSE","addAscent","DisclosureEmission","ADDED","resize","links","length","isBreakpoint","Breakpoints","MD","buttonHasFocus","indexOf","document","activeElement","querySelectorAll","element","getDescendantInstances","Collapse","_focus","link","request","verify","collapsePrimary","children","map","child","getInstance","filter","button","hasClass","Instance","breadcrumb","register"],"mappings":";yBAAAA,ICCMC,EAAMC,OAAuB,KCCtBC,EAAqB,CAChCC,WAAYH,EAAII,UAAUC,GAAGC,SAAS,cACtCC,OAAQP,EAAII,UAAUC,GAAGC,SAAS,uBCD9BE,cACJ,aACEC,aACAC,KAAKC,MAAQ,EACbD,KAAKE,SAAWF,KAAKG,MAAMC,KAAKJ,iQAGlCK,EAAWC,iCACT,MAAO,0BAGTC,gBACEP,KAAKQ,cACLR,KAAKS,YAAa,GAGpBC,EAAIC,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