UNPKG

@studiometa/js-toolkit

Version:

A set of useful little bits of JavaScript to boost your project! 🚀

40 lines (39 loc) • 1.04 kB
import { ResponsiveOptionsManager } from "../Base/managers/ResponsiveOptionsManager.js"; import { isDefined, isObject } from "../utils/index.js"; function withResponsiveOptions(BaseClass, { responsiveOptions = [] } = {}) { class WithResponsiveOptions extends BaseClass { /** * Configure responsive options. */ get __config() { const config = super.__config; const options = config.options; for (const option of responsiveOptions) { if (isDefined(options[option])) { const oldOption = options[option]; options[option] = { type: isObject(oldOption) ? oldOption.type : oldOption, responsive: true }; } } return config; } /** * Get managers. */ get __managers() { return { ...super.__managers, OptionsManager: ResponsiveOptionsManager }; } } return WithResponsiveOptions; } export { withResponsiveOptions }; //# sourceMappingURL=withResponsiveOptions.js.map