primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
128 lines (121 loc) • 4.62 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { css as css$1, dt, Theme } from '@primeuix/styled';
import { style } from '@primeuix/styles/base';
import { resolve, minifyCSS } from '@primeuix/utils';
import { UseStyle } from 'primeng/usestyle';
var base = {
_loadedStyleNames: new Set(),
getLoadedStyleNames() {
return this._loadedStyleNames;
},
isStyleNameLoaded(name) {
return this._loadedStyleNames.has(name);
},
setLoadedStyleName(name) {
this._loadedStyleNames.add(name);
},
deleteLoadedStyleName(name) {
this._loadedStyleNames.delete(name);
},
clearLoadedStyleNames() {
this._loadedStyleNames.clear();
}
};
const css = /*css*/ `
.p-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.p-hidden-accessible input,
.p-hidden-accessible select {
transform: scale(0);
}
.p-overflow-hidden {
overflow: hidden;
padding-right: dt('scrollbar.width');
}
`;
class BaseStyle {
name = 'base';
useStyle = inject(UseStyle);
theme = undefined;
css = undefined;
classes = {};
inlineStyles = {};
load = (style, options = {}, transform = (cs) => cs) => {
const computedStyle = transform(css$1 `${resolve(style, { dt })}`);
return computedStyle ? this.useStyle.use(minifyCSS(computedStyle), { name: this.name, ...options }) : {};
};
loadCSS = (options = {}) => {
return this.load(this.css, options);
};
loadTheme = (options = {}, style = '') => {
return this.load(this.theme, options, (computedStyle = '') => Theme.transformCSS(options.name || this.name, `${computedStyle}${css$1 `${style}`}`));
};
loadGlobalCSS = (options = {}) => {
return this.load(css, options);
};
loadGlobalTheme = (options = {}, style$1 = '') => {
return this.load(style, options, (computedStyle = '') => Theme.transformCSS(options.name || this.name, `${computedStyle}${css$1 `${style$1}`}`));
};
getCommonTheme = (params) => {
return Theme.getCommon(this.name, params);
};
getComponentTheme = (params) => {
return Theme.getComponent(this.name, params);
};
getDirectiveTheme = (params) => {
return Theme.getDirective(this.name, params);
};
getPresetTheme = (preset, selector, params) => {
return Theme.getCustomPreset(this.name, preset, selector, params);
};
getLayerOrderThemeCSS = () => {
return Theme.getLayerOrderCSS(this.name);
};
getStyleSheet = (extendedCSS = '', props = {}) => {
if (this.css) {
const _css = resolve(this.css, { dt });
const _style = minifyCSS(css$1 `${_css}${extendedCSS}`);
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
return `<style type="text/css" data-primeng-style-id="${this.name}" ${_props}>${_style}</style>`;
}
return '';
};
getCommonThemeStyleSheet = (params, props = {}) => {
return Theme.getCommonStyleSheet(this.name, params, props);
};
getThemeStyleSheet = (params, props = {}) => {
let css = [Theme.getStyleSheet(this.name, params, props)];
if (this.theme) {
const name = this.name === 'base' ? 'global-style' : `${this.name}-style`;
const _css = css$1 `${resolve(this.theme, { dt })}`;
const _style = minifyCSS(Theme.transformCSS(name, _css));
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
css.push(`<style type="text/css" data-primeng-style-id="${name}" ${_props}>${_style}</style>`);
}
return css.join('');
};
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseStyle, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseStyle, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: BaseStyle, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { base as Base, BaseStyle };
//# sourceMappingURL=primeng-base.mjs.map