TP_JO2024/home/dist/component/toggle/toggle.module.min.js.map

1 line
4.2 KiB
Text
Raw Normal View History

2024-03-27 17:19:37 +01:00
{"version":3,"file":"toggle.module.min.js","sources":["../../../.config/config.js","../../../src/core/api.js","../../../src/component/toggle/script/toggle/toggle-input.js","../../../src/component/toggle/script/toggle/toggle-status-label.js","../../../src/component/toggle/script/toggle/toggle-selector.js","../../../src/component/toggle/index.js","../../../src/component/toggle/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\nclass ToggleInput extends api.core.Instance {\n static get instanceClassName () {\n return 'ToggleInput';\n }\n\n get isChecked () {\n return this.node.checked;\n }\n}\n\nexport { ToggleInput };\n","import api from '../../api.js';\nimport { ToggleInput } from './toggle-input.js';\n\nclass ToggleStatusLabel extends api.core.Instance {\n static get instanceClassName () {\n return 'ToggleStatusLabel';\n }\n\n init () {\n this.register(`input[id=\"${this.getAttribute('for')}\"]`, ToggleInput);\n this.update();\n this.isSwappingFont = true;\n }\n\n get proxy () {\n const scope = this;\n return Object.assign(super.proxy, {\n update: scope.update.bind(scope)\n });\n }\n\n get input () {\n return this.getRegisteredInstances('ToggleInput')[0];\n }\n\n update () {\n this.node.style.removeProperty('--toggle-status-width');\n const checked = this.input.isChecked;\n\n const style = getComputedStyle(this.node, ':before');\n let maxWidth = parseFloat(style.width);\n this.input.node.checked = !checked;\n\n const style2 = getComputedStyle(this.node, ':before');\n const width = parseFloat(style2.width);\n if (width > maxWidth) maxWidth = width;\n this.input.node.checked = checked;\n\n this.node.style.setProperty('--toggle-status-width', (maxWidth / 16) + 'rem');\n }\n\n swapFont (families) {\n this.update();\n }\n}\n\nexport { ToggleStatusLabel };\n","import api from '../../api.js';\n\nexport const ToggleSelector = {\n STATUS_LABEL: `${api.internals.ns.selector('toggle__label')}${api.internals.ns.attr.selector('checked-label')}${api.internals.ns.attr.selector('unchecked-label')}`\n};\n","import api from './api.js';\nimport { ToggleStatusLabel } from './script/toggle/toggle-status-label.js';\nimport { ToggleSelector } from './script/toggle/toggle-selector.js';\n// import { ToggleInput } from './script/toggle/toggle-input.js';\n\napi.toggle = {\n ToggleStatusLabel: ToggleStatusLabel,\n ToggleSelector: ToggleSelector\n};\n\nexport default api;\n","import api from './index.js';\n\napi.internals.register(api.toggle.ToggleSelector.STATUS_LABEL, api.toggle.ToggleStatusLabel);\n\nexport default api;\n"],"names":["api","window","ToggleInput","core","Instance","instanceClassName","isChecked","this","node","checked","ToggleStatusLabel","init","register","getAttribute","update","isSwappingFont","proxy","Object","assign","super","bind","input","getRegisteredInstances","style","removeProperty","getComputedStyle","maxWidth","parseFloat","width","style2","setProperty","swapFont","families","ToggleSelector","STATUS_LABEL","internals","ns","selector","attr","toggle"],"mappings":";AAAA,MCCMA,EAAMC,OAAuB,KCCnC,MAAMC,UAAoBF,EAAIG,KAAKC,SACtBC,+BACT,MAAO,cAGLC,gBACF,OAAOC,KAAKC,KAAKC,SCLrB,MAAMC,UAA0BV,EAAIG,KAAKC,SAC5BC,+BACT,MAAO,oBAGTM,OACEJ,KAAKK,SAAS,aAAaL,KAAKM,aAAa,WAAYX,GACzDK,KAAKO,SACLP,KAAKQ,gBAAiB,EAGpBC,YAEF,OAAOC,OAAOC,OAAOC,MAAMH,MAAO,CAChCF,OAFYP,KAEEO,OAAOM,KAFTb,QAMZc,YACF,OAAOd,KAAKe,uBAAuB,eAAe,GAGpDR,SACEP,KAAKC,KAAKe,MAAMC,eAAe,yBAC/B,MAAMf,EAAUF,KAAKc,MAAMf,UAErBiB,EAAQE,iBAAiBlB,KAAKC,KAAM,WAC1C,IAAIkB,EAAWC,WAAWJ,EAAMK,OAChCrB,KAAKc,MAAMb,KAAKC,SAAWA,EAE3B,MAAMoB,EAASJ,iBAAiBlB,KAAKC,KAAM,WACrCoB,EAAQD,WAAWE,EAAOD,OAC5BA,EAAQF,IAAUA,EAAWE,GACjCrB,KAAKc,MAAMb,KAAKC,QAAUA,EAE1BF,KAAKC,KAAKe,MAAMO,YAAY,wBAA0BJ,EAAW,GAAM,OAGzEK,SAAUC,GACRzB,KAAKO,UCxCF,MAAMmB,EAAiB,CAC5BC