TP_JO2024/home/dist/scheme/scheme.module.js.map

1 line
14 KiB
Text
Raw Permalink Normal View History

2024-03-27 17:19:37 +01:00
{"version":3,"file":"scheme.module.js","sources":["../../.config/config.js","../../src/core/api.js","../../src/scheme/script/scheme/scheme-value.js","../../src/scheme/script/scheme/scheme-attribute.js","../../src/scheme/script/scheme/scheme-theme.js","../../src/scheme/script/scheme/scheme-emission.js","../../src/scheme/script/scheme/scheme-event.js","../../src/scheme/script/scheme/scheme.js","../../src/scheme/script/scheme/scheme-selector.js","../../src/scheme/index.js","../../src/scheme/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","export const SchemeValue = {\n SYSTEM: 'system',\n LIGHT: 'light',\n DARK: 'dark'\n};\n","import api from '../../api';\n\nexport const SchemeAttribute = {\n THEME: api.internals.ns.attr('theme'),\n SCHEME: api.internals.ns.attr('scheme'),\n TRANSITION: api.internals.ns.attr('transition')\n};\n","export const SchemeTheme = {\n LIGHT: 'light',\n DARK: 'dark'\n};\n","import api from '../../api';\n\nexport const SchemeEmission = {\n SCHEME: api.internals.ns.emission('scheme', 'scheme'),\n THEME: api.internals.ns.emission('scheme', 'theme'),\n ASK: api.internals.ns.emission('scheme', 'ask')\n};\n","import api from '../../api.js';\n\nconst SchemeEvent = {\n SCHEME: api.internals.ns.event('scheme'),\n THEME: api.internals.ns.event('theme')\n};\n\nexport { SchemeEvent };\n","import api from '../../api.js';\nimport { SchemeValue } from './scheme-value.js';\nimport { SchemeAttribute } from './scheme-attribute.js';\nimport { SchemeTheme } from './scheme-theme.js';\nimport { SchemeEmission } from './scheme-emission.js';\nimport { SchemeEvent } from './scheme-event.js';\n\nclass Scheme extends api.core.Instance {\n constructor () {\n super(false);\n }\n\n static get instanceClassName () {\n return 'Scheme';\n }\n\n init () {\n this.changing = this.change.bind(this);\n\n if (this.hasAttribute(SchemeAttribute.TRANSITION)) {\n this.removeAttribute(SchemeAttribute.TRANSITION);\n this.request(this.restoreTransition.bind(this));\n }\n\n const scheme = api.internals.support.supportLocalStorage() ? localStorage.getItem('scheme') : '';\n const schemeAttr = this.getAttribute(SchemeAttribute.SCHEME);\n\n switch (scheme) {\n case SchemeValue.DARK:\n case SchemeValue.LIGHT:\n case SchemeValue.SYSTEM:\n this.scheme = scheme;\n break;\n\n default:\n switch (schemeAttr) {\n case SchemeValue.DARK:\n this.scheme = SchemeValue.DARK;\n break;\n\n case SchemeValue.LIGHT:\n this.scheme = SchemeValue.LIGHT;\n break;\n\n default:\n this.scheme = SchemeValue.SYSTEM;\n }\n }\n\n this.addAscent(SchemeEmission.ASK, this.ask.bind(this));\n this.addAscent(SchemeEmission.SCHEME, this.apply.bind(this));\n }\n\n get proxy () {\n const scope = this;\n\n const proxyAccessors = {\n get scheme () {\n return scope.scheme;\n },\n set scheme (value) {\n scope.scheme = value;\n }\n };\n\n return api.internals.property.completeAssign(super.proxy, proxyAccessors);\n }\n\n restoreTransition () {\n this.setAttribute(SchemeAttribute.TRANSITION, '');\n }\n\n ask () {\n this.descend(SchemeEmission.SCHEME, this.scheme);\n }\n\n apply (value) {\n this.scheme = value;\n }\n\n get scheme () {\n return this._scheme;\n }\n\n set scheme (value) {\n if (this._scheme === value) return;\n this._scheme = value;\n switch (value) {\n case SchemeValue.SYSTEM:\n this.listenPreferences();\n break;\n\n case SchemeValue.DARK:\n this.unlistenPreferences();\n this.theme = SchemeTheme.DARK;\n break;\n\n case SchemeValue.LIGHT:\n this.unlistenPreferences();\n this.theme = SchemeTheme.LIGHT;\n break;\n\n