debut des details de la page. Vu que c'est le troisieme (euh quatrieme?) composant, c'etait un peu plus rapide, mais heureusement que claude est la pour repasser derriere mes erreurs prcq en solo je n'y arriverais pas du tout!

This commit is contained in:
camille
2026-03-27 17:49:26 +01:00
parent 24e85c4471
commit 43589e583e
92 changed files with 12959 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var domToArray = require('bianco.dom-to-array');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var domToArray__default = /*#__PURE__*/_interopDefaultLegacy(domToArray);
/**
* Split a string into several items separed by spaces
* @param { string } l - events list
* @returns { Array } all the events detected
* @private
*/
const split = l => l.split(/\s/);
/**
* Set a listener for all the events received separated by spaces
* @param { HTMLElement|NodeList|Array } els - DOM node/s where the listeners will be bound
* @param { string } evList - list of events we want to bind or unbind space separated
* @param { Function } cb - listeners callback
* @param { string } method - either 'addEventListener' or 'removeEventListener'
* @param { Object } options - event options (capture, once and passive)
* @returns { undefined }
* @private
*/
function manageEvents(els, evList, cb, method, options) {
els = domToArray__default["default"](els);
split(evList).forEach((e) => {
els.forEach(el => el[method](e, cb, options || false));
});
}
/**
* Set a listener for all the events received separated by spaces
* @param { HTMLElement|Array } els - DOM node/s where the listeners will be bound
* @param { string } evList - list of events we want to bind space separated
* @param { Function } cb - listeners callback
* @param { Object } options - event options (capture, once and passive)
* @returns { HTMLElement|NodeList|Array } DOM node/s and first argument of the function
*/
function add(els, evList, cb, options) {
manageEvents(els, evList, cb, 'addEventListener', options);
return els
}
/**
* Set a listener using from a list of events triggering the callback only once
* @param { HTMLElement|Array } els - DOM node where the listeners will be bound
* @param { string } evList - list of events we want to bind space separated
* @param { Function } cb - listeners callback
* @param { Object } options - event options (capture, once and passive)
* @returns { HTMLElement|NodeList|Array } DOM node/s and first argument of the function
*/
function once(els, evList, cb, options) {
manageEvents(els, evList, cb, 'addEventListener', Object.assign(options || {}, { once: true }));
return els
}
/**
* Remove all the listeners for the events received separated by spaces
* @param { HTMLElement|Array } els - DOM node/s where the events will be unbind
* @param { string } evList - list of events we want unbind space separated
* @param { Function } cb - listeners callback
* @param { Object } options - event options (capture, once and passive)
* @returns { HTMLElement|NodeList|Array } DOM node/s and first argument of the function
*/
function remove(els, evList, cb, options) {
manageEvents(els, evList, cb, 'removeEventListener', options);
return els
}
var index_next = {
add,
once,
remove
};
exports.add = add;
exports["default"] = index_next;
exports.once = once;
exports.remove = remove;