TP_JO2024/home/dist/component/navigation/navigation.module.min.js.map
2024-03-27 17:19:37 +01:00

1 line
No EOL
11 KiB
Text

{"version":3,"file":"navigation.module.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/navigation/script/navigation/navigation-selector.js","../../../src/component/navigation/script/navigation/navigation-item.js","../../../src/component/navigation/script/navigation/navigation-mouse-position.js","../../../src/component/navigation/script/navigation/navigation.js","../../../src/component/navigation/index.js","../../../src/component/navigation/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\nconst ITEM = api.internals.ns.selector('nav__item');\nconst COLLAPSE = api.internals.ns.selector('collapse');\n\nexport const NavigationSelector = {\n NAVIGATION: api.internals.ns.selector('nav'),\n COLLAPSE: `${ITEM} > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}):not(${COLLAPSE}) > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}):not(${COLLAPSE}) > *:not(${ITEM}):not(${COLLAPSE}) > ${COLLAPSE}`,\n COLLAPSE_LEGACY: `${ITEM} ${COLLAPSE}`,\n ITEM: ITEM,\n ITEM_RIGHT: `${ITEM}--align-right`,\n MENU: api.internals.ns.selector('menu'),\n BUTTON: api.internals.ns.selector('nav__btn'),\n TRANSLATE_BUTTON: api.internals.ns.selector('translate__btn')\n};\n","import api from '../../api.js';\nimport { NavigationSelector } from './navigation-selector.js';\n\nclass NavigationItem extends api.core.Instance {\n constructor () {\n super();\n this._isRightAligned = false;\n }\n\n static get instanceClassName () {\n return 'NavigationItem';\n }\n\n init () {\n this.addAscent(api.core.DisclosureEmission.ADDED, this.calculate.bind(this));\n this.addAscent(api.core.DisclosureEmission.REMOVED, this.calculate.bind(this));\n this.isResizing = true;\n this.calculate();\n }\n\n resize () {\n this.calculate();\n }\n\n calculate () {\n const collapse = this.element.getDescendantInstances(api.core.Collapse.instanceClassName, null, true)[0];\n if (collapse && this.isBreakpoint(api.core.Breakpoints.LG) && collapse.element.node.matches(NavigationSelector.MENU)) {\n const right = this.element.node.parentElement.getBoundingClientRect().right; // todo: ne fonctionne que si la nav fait 100% du container\n const width = collapse.element.node.getBoundingClientRect().width;\n const left = this.element.node.getBoundingClientRect().left;\n this.isRightAligned = left + width > right;\n } else this.isRightAligned = false;\n }\n\n get isRightAligned () {\n return this._isRightAligned;\n }\n\n set isRightAligned (value) {\n if (this._isRightAligned === value) return;\n this._isRightAligned = value;\n if (value) api.internals.dom.addClass(this.element.node, NavigationSelector.ITEM_RIGHT);\n else api.internals.dom.removeClass(this.element.node, NavigationSelector.ITEM_RIGHT);\n }\n\n get collapsePrimary () {\n const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && (button.hasClass(NavigationSelector.BUTTON) || button.hasClass(NavigationSelector.TRANSLATE_BUTTON)));\n return buttons[0];\n }\n}\n\nexport { NavigationItem };\n","export const NavigationMousePosition = {\n NONE: -1,\n INSIDE: 0,\n OUTSIDE: 1\n};\n","import api from '../../api.js';\nimport { NavigationSelector } from './navigation-selector.js';\nimport { NavigationMousePosition } from './navigation-mouse-position.js';\n\nclass Navigation extends api.core.CollapsesGroup {\n static get instanceClassName () {\n return 'Navigation';\n }\n\n init () {\n super.init();\n this.clicked = false;\n this.out = false;\n this.addEmission(api.core.RootEmission.CLICK, this._handleRootClick.bind(this));\n this.listen('mousedown', this.handleMouseDown.bind(this));\n this.listenClick({ capture: true });\n this.isResizing = true;\n }\n\n validate (member) {\n return super.validate(member) && member.element.node.matches(api.internals.legacy.isLegacy ? NavigationSelector.COLLAPSE_LEGACY : NavigationSelector.COLLAPSE);\n }\n\n handleMouseDown (e) {\n if (!this.isBreakpoint(api.core.Breakpoints.LG) || this.index === -1 || !this.current) return;\n this.position = this.current.node.contains(e.target) ? NavigationMousePosition.INSIDE : NavigationMousePosition.OUTSIDE;\n this.requestPosition();\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 this.index = -1;\n }\n }\n\n _handleRootClick (target) {\n if (!this.isBreakpoint(api.core.Breakpoints.LG)) return;\n if (!this.node.contains(target)) {\n this.out = true;\n this.requestPosition();\n }\n }\n\n requestPosition () {\n if (this.isRequesting) return;\n this.isRequesting = true;\n this.request(this.getPosition.bind(this));\n }\n\n getPosition () {\n if (this.out) {\n switch (this.position) {\n case NavigationMousePosition.OUTSIDE:\n this.index = -1;\n break;\n\n case NavigationMousePosition.INSIDE:\n if (this.current && !this.current.node.contains(document.activeElement)) this.current.focus();\n break;\n\n default:\n if (this.index > -1 && !this.current.hasFocus) this.index = -1;\n }\n }\n\n this.request(this.requested.bind(this));\n }\n\n requested () {\n this.position = NavigationMousePosition.NONE;\n this.out = false;\n this.isRequesting = false;\n }\n\n get index () { return super.index; }\n\n set index (value) {\n if (value === -1 && this.current && this.current.hasFocus) this.current.focus();\n super.index = value;\n }\n\n get canUngroup () {\n return !this.isBreakpoint(api.core.Breakpoints.LG);\n }\n\n resize () {\n this.update();\n }\n}\n\nexport { Navigation };\n","import api from './api.js';\nimport { NavigationItem } from './script/navigation/navigation-item.js';\nimport { Navigation } from './script/navigation/navigation.js';\nimport { NavigationSelector } from './script/navigation/navigation-selector.js';\nimport { NavigationMousePosition } from './script/navigation/navigation-mouse-position.js';\n\napi.navigation = {\n Navigation: Navigation,\n NavigationItem: NavigationItem,\n NavigationMousePosition: NavigationMousePosition,\n NavigationSelector: NavigationSelector\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.navigation.NavigationSelector.NAVIGATION, api.navigation.Navigation);\napi.internals.register(api.navigation.NavigationSelector.ITEM, api.navigation.NavigationItem);\n\nexport default api;\n"],"names":["api","window","ITEM","internals","ns","selector","COLLAPSE","NavigationSelector","NAVIGATION","COLLAPSE_LEGACY","ITEM_RIGHT","MENU","BUTTON","TRANSLATE_BUTTON","NavigationItem","core","Instance","constructor","super","this","_isRightAligned","instanceClassName","init","addAscent","DisclosureEmission","ADDED","calculate","bind","REMOVED","isResizing","resize","collapse","element","getDescendantInstances","Collapse","isBreakpoint","Breakpoints","LG","node","matches","right","parentElement","getBoundingClientRect","width","left","isRightAligned","value","dom","addClass","removeClass","collapsePrimary","children","map","child","getInstance","filter","button","hasClass","NavigationMousePosition","NONE","INSIDE","OUTSIDE","Navigation","CollapsesGroup","clicked","out","addEmission","RootEmission","CLICK","_handleRootClick","listen","handleMouseDown","listenClick","capture","validate","member","legacy","isLegacy","e","index","current","position","contains","target","requestPosition","handleClick","DisclosureSelector","PREVENT_CONCEAL","isRequesting","request","getPosition","document","activeElement","focus","hasFocus","requested","canUngroup","update","navigation","register"],"mappings":";AAAA,MCCMA,EAAMC,OAAuB,KCC7BC,EAAOF,EAAIG,UAAUC,GAAGC,SAAS,aACjCC,EAAWN,EAAIG,UAAUC,GAAGC,SAAS,YAE9BE,EAAqB,CAChCC,WAAYR,EAAIG,UAAUC,GAAGC,SAAS,OACtCC,SAAU,GAAGJ,OAAUI,MAAaJ,aAAgBA,UAAaI,QAAeA,MAAaJ,aAAgBA,UAAaI,cAAqBJ,UAAaI,QAAeA,IAC3KG,gBAAiB,GAAGP,KAAQI,IAC5BJ,KAAMA,EACNQ,WAAY,GAAGR,iBACfS,KAAMX,EAAIG,UAAUC,GAAGC,SAAS,QAChCO,OAAQZ,EAAIG,UAAUC,GAAGC,SAAS,YAClCQ,iBAAkBb,EAAIG,UAAUC,GAAGC,SAAS,mBCV9C,MAAMS,UAAuBd,EAAIe,KAAKC,SACpCC,cACEC,QACAC,KAAKC,iBAAkB,EAGdC,+BACT,MAAO,iBAGTC,OACEH,KAAKI,UAAUvB,EAAIe,KAAKS,mBAAmBC,MAAON,KAAKO,UAAUC,KAAKR,OACtEA,KAAKI,UAAUvB,EAAIe,KAAKS,mBAAmBI,QAAST,KAAKO,UAAUC,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