1 line
4.3 KiB
Text
1 line
4.3 KiB
Text
|
{"version":3,"file":"toggle.nomodule.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":["const","api","window","ToggleInput","staticAccessors","instanceClassName","prototypeAccessors","isChecked","this","node","checked","core","Instance","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":";yBAAAA,ICCMC,EAAMC,OAAuB,KCC7BC,6NACJC,EAAWC,iCACT,MAAO,eAGTC,EAAIC,yBACF,OAAOC,KAAKC,KAAKC,gFANKT,EAAIU,KAAKC,UCC7BC,iPACJT,EAAWC,iCACT,MAAO,iCAGTS,gBACEN,KAAKO,sBAAsBP,KAAKQ,aAAa,YAAYb,GACzDK,KAAKS,SACLT,KAAKU,gBAAiB,GAGxBZ,EAAIa,qBAEF,OAAOC,OAAOC,iBAAOC,YAAMH,MAAO,CAChCF,OAFYT,KAEES,OAAOM,KAFTf,SAMhBF,EAAIkB,qBACF,OAAOhB,KAAKiB,uBAAuB,eAAe,gBAGpDR,kBACET,KAAKC,KAAKiB,MAAMC,eAAe,yBAC/B3B,IAAMU,EAAUF,KAAKgB,MAAMjB,UAErBmB,EAAQE,iBAAiBpB,KAAKC,KAAM,WACtCoB,EAAWC,WAAWJ,EAAMK,OAChCvB,KAAKgB,MAAMf,KAAKC,SAAWA,EAE3BV,IAAMgC,EAASJ,iBAAiBpB,KAAKC,KAAM,WACrCsB,EAAQD,WAAWE,EAAOD,OAC5BA,EAAQF,IAAUA,EAAWE,GACjCvB,KAAKgB,MAAMf,KAAKC,QAAUA,EAE1BF,KAAKC,KAAKiB,MAAMO,YAAY,wBAA0B
|