TP_JO2024/home/dist/dsfr.module.min.js

4 lines
101 KiB
JavaScript
Raw Normal View History

2024-03-27 17:19:37 +01:00
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
const e=new class{constructor(){this.modules={}}create(e){const t=new e;this.modules[t.type]=t}getModule(e){return this.modules[e]}add(e,t){this.modules[e].add(t)}remove(e,t){this.modules[e].remove(t)}get isActive(){return this._isActive}set isActive(e){if(e===this._isActive)return;this._isActive=e;const t=Object.keys(this.modules).map((e=>this.modules[e]));if(e)for(const e of t)e.activate();else for(const e of t)e.deactivate()}get isLegacy(){return this._isLegacy}set isLegacy(e){e!==this._isLegacy&&(this._isLegacy=e)}},t="fr",s="dsfr",i="@gouvfr",n="1.11.2";class r{constructor(e,t,s,i){switch(this.level=e,this.light=t,this.dark=s,i){case"warn":this.logger=console.warn;break;case"error":this.logger=console.error;break;default:this.logger=console.log}}log(...e){const t=new a(s);for(const s of e)t.add(s);this.print(t)}print(e){e.setColor(this.color),this.logger.apply(console,e.getMessage())}get color(){return window.matchMedia("(prefers-color-scheme: dark)").matches?this.dark:this.light}}class a{constructor(e){this.inputs=["%c"],this.styles=["font-family:Marianne","line-height: 1.5"],this.objects=[],e&&this.add(`${e} :`)}add(e){switch(typeof e){case"object":case"function":this.inputs.push("%o "),this.objects.push(e);break;default:this.inputs.push(`${e} `)}}setColor(e){this.styles.push(`color:${e}`)}getMessage(){return[this.inputs.join(""),this.styles.join(";"),...this.objects]}}const o={log:new r(0,"#616161","#989898"),debug:new r(1,"#000091","#8B8BFF"),info:new r(2,"#007c3b","#00ed70"),warn:new r(3,"#ba4500","#fa5c00","warn"),error:new r(4,"#D80600","#FF4641","error")};const h=new class{constructor(){this.level=2;for(const e in o){const t=o[e];this[e]=(...e)=>{this.level<=t.level&&t.log.apply(t,e)},this[e].print=t.print.bind(t)}}state(){const t=new a;t.add(e),this.log.print(t)}tree(){const t=e.getModule("stage");if(!t)return;const s=new a;this._branch(t.root,0,s),this.log.print(s)}_branch(e,t,s){let i="";if(t>0){let e="";for(let s=0;s<t;s++)e+=" ";i+=e+"└─ "}i+=`[${e.id}] ${e.html}`,s.add(i),s.add({"@":e}),s.add("\n");for(const n of e.children)i+=this._branch(n,t+1,s)}},c=e=>{"loading"!==document.readyState?window.requestAnimationFrame(e):document.addEventListener("DOMContentLoaded",e)},l={AUTO:"auto",MANUAL:"manual",RUNTIME:"runtime",LOADED:"loaded",VUE:"vue",ANGULAR:"angular",REACT:"react"};const d=new class{constructor(){this._mode=l.AUTO,this.isStarted=!1,this.starting=this.start.bind(this),this.preventManipulation=!1}configure(e={},t,s){this.startCallback=t;const i=e.production&&(!s||"false"!==s.production);switch(!0){case s&&!isNaN(s.level):h.level=Number(s.level);break;case s&&s.verbose&&("true"===s.verbose||1===s.verbose):h.level=0;break;case i:h.level=999;break;case e.verbose:h.level=0}h.info(`version ${n}`),this.mode=e.mode||l.AUTO}set mode(e){switch(e){case l.AUTO:this.preventManipulation=!1,t=this.starting,c(t);break;case l.LOADED:this.preventManipulation=!1,c(this.starting);break;case l.RUNTIME:this.preventManipulation=!1,this.start();break;case l.MANUAL:this.preventManipulation=!1;break;case l.VUE:case l.ANGULAR:case l.REACT:this.preventManipulation=!0;break;default:return void h.error("Illegal mode")}var t;this._mode=e,h.info(`mode set to ${e}`)}get mode(){return this._mode}start(){h.info("start"),this.startCallback()}};class u{constructor(){this._collection=[]}forEach(e){this._collection.forEach(e)}map(e){return this._collection.map(e)}get length(){return this._collection.length}add(e){return!(this._collection.indexOf(e)>-1)&&(this._collection.push(e),this.onAdd&&this.onAdd(),this.onPopulate&&1===this._collection.length&&this.onPopulate(),!0)}remove(e){const t=this._collection.indexOf(e);if(-1===t)return!1;this._collection.splice(t,1),this.onRemove&&this.onRemove(),this.onEmpty&&0===this._collection.length&&this.onEmpty()}execute(...e){for(const t of this._collection)t&&t.apply(null,e)}clear(){this._collection.length=0}clone(){const e=new u;return e._collection=this._collection.slice(),e}get collection(){return this._collection}}class g extends u{constructor(e){super(),this.type=e,this.isActive=!1}
//# sourceMappingURL=dsfr.module.min.js.map