1 line
5.1 KiB
Text
1 line
5.1 KiB
Text
|
{"version":3,"file":"toggle.nomodule.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","super","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;;ECCpC,IAAM,WAAW;;;;;;;;;;;;IACf,gBAAW,oCAAqB;EAClC,IAAI,OAAO,aAAa,CAAC;EACzB,IAAG;AACH;EACA,EAAE,mBAAI,4BAAa;EACnB,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;EAC7B;;;;;;IAP0B,GAAG,CAAC,IAAI,CAAC;;ECCnC,IAAM,iBAAiB;;;;;;;;;;;;IACrB,gBAAW,oCAAqB;EAClC,IAAI,OAAO,mBAAmB,CAAC;EAC/B,IAAG;AACH;EACA,8BAAE,wBAAQ;EACV,IAAI,IAAI,CAAC,QAAQ,mBAAc,IAAI,CAAC,YAAY,CAAC,KAAK,EAAC,WAAM,WAAW,CAAC,CAAC;EAC1E,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;EAClB,IAAI,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;EAC/B,IAAG;AACH;EACA,EAAE,mBAAI,wBAAS;EACf,IAAIA,IAAM,KAAK,GAAG,IAAI,CAAC;EACvB,IAAI,OAAO,MAAM,CAAC,WAAM,OAACC,oBAAK,CAAC,K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