Core utilities and base functionality for PrimeVue UI component library
52
Quality
Pending
Does it follow best practices?
Impact
52%
1.15xAverage score across 10 eval scenarios
Foundation classes providing core functionality for PrimeVue components and directives. These classes handle theming, styling, PassThrough configuration, and lifecycle management.
Core Vue component providing fundamental PrimeVue component functionality including theming, styling, and PassThrough support.
declare const BaseComponent: DefineComponent<{
/** PassThrough configuration object */
pt?: Object;
/** PassThrough options */
ptOptions?: Object;
/** Enable unstyled mode */
unstyled?: Boolean;
/** Design token object */
dt?: Object;
}>;Component Methods:
interface BaseComponentMethods {
/**
* Get PassThrough configuration for a key
* @param key - Configuration key
* @param params - Additional parameters
* @returns PassThrough object
*/
ptm(key?: string, params?: object): any;
/**
* Get PassThrough configuration with inherited attributes
* @param key - Configuration key
* @param params - Additional parameters
* @returns PassThrough object with attributes
*/
ptmi(key?: string, params?: object): any;
/**
* Get PassThrough configuration from custom object
* @param obj - Custom object
* @param key - Configuration key
* @param params - Additional parameters
* @returns PassThrough object
*/
ptmo(obj?: object, key?: string, params?: object): any;
/**
* Get CSS classes for styling
* @param key - Style key
* @param params - Additional parameters
* @returns CSS class string or undefined
*/
cx(key?: string, params?: object): string | undefined;
/**
* Get inline styles
* @param key - Style key
* @param when - Condition for applying styles
* @param params - Additional parameters
* @returns Inline style array or undefined
*/
sx(key?: string, when?: boolean, params?: object): any[] | undefined;
}Computed Properties:
interface BaseComponentComputed {
/** Component ID */
readonly $id: string;
/** Current theme configuration */
readonly $theme: any;
/** Style configuration object */
readonly $style: any;
/** PrimeVue configuration */
readonly $primevueConfig: PrimeVueConfiguration;
/** Whether component is in unstyled mode */
readonly isUnstyled: boolean;
/** Component name */
readonly $name: string;
/** Component parameters for PassThrough */
readonly $params: object;
}Usage Examples:
// Extending BaseComponent
import BaseComponent from '@primevue/core/basecomponent';
export default {
name: 'MyComponent',
extends: BaseComponent,
template: `
<div v-bind="ptm('root')" :class="cx('root')">
<span v-bind="ptm('label')">{{ label }}</span>
</div>
`,
props: {
label: String
}
};
// Using PassThrough configuration
<MyComponent
:pt="{
root: { class: 'my-custom-class' },
label: { style: 'color: red' }
}"
/>Factory for creating Vue directives with PrimeVue functionality including styling, theming, and PassThrough support.
declare const BaseDirective: {
/**
* Create a directive with base PrimeVue functionality
* @param name - Directive name
* @param options - Directive options and methods
* @returns Vue directive object
*/
extend(name: string, options?: any): any;
};Directive Instance Methods:
interface DirectiveInstance {
/** Directive name */
readonly $name: string;
/** Host DOM element */
readonly $host: Element;
/** Vue directive binding */
readonly $binding: any;
/** Binding modifiers */
readonly $modifiers: object;
/** Binding value */
readonly $value: any;
/** PrimeVue configuration */
readonly $primevueConfig: PrimeVueConfiguration;
/**
* Get PassThrough configuration
* @param key - Configuration key
* @param params - Additional parameters
* @returns PassThrough object
*/
ptm(key?: string, params?: object): any;
/**
* Get PassThrough configuration from custom object
* @param obj - Custom object
* @param key - Configuration key
* @param params - Additional parameters
* @returns PassThrough object
*/
ptmo(obj?: object, key?: string, params?: object): any;
/**
* Get CSS classes
* @param key - Style key
* @param params - Additional parameters
* @returns CSS class string or undefined
*/
cx(key?: string, params?: object): string | undefined;
/**
* Get inline styles
* @param key - Style key
* @param when - Condition for applying styles
* @param params - Additional parameters
* @returns Inline style object or undefined
*/
sx(key?: string, when?: boolean, params?: object): any | undefined;
/**
* Check if directive is in unstyled mode
* @returns Boolean indicating unstyled state
*/
isUnstyled(): boolean;
/**
* Get current theme
* @returns Theme configuration
*/
theme(): any;
}Usage Examples:
import BaseDirective from '@primevue/core/basedirective';
// Create a custom directive
const MyDirective = BaseDirective.extend('mydirective', {
mounted(el, binding, vnode) {
const instance = el.$mydirective; // directive instance
// Use directive methods
el.className = instance.cx('root');
el.setAttribute('data-theme', instance.theme());
},
style: {
classes: {
root: 'my-directive-root'
}
}
});
// Register directive
app.directive('mydirective', MyDirective);
// Use in template
<div v-mydirective="{ value: 'test' }"></div>Base Vue component for editable content containers.
declare const BaseEditableHolder: DefineComponent<{}>;Base Vue component for input elements.
declare const BaseInput: DefineComponent<{}>;Core utility object for managing style loading state across components.
declare const Base: {
/**
* Get set of loaded style names
* @returns Set of loaded style names
*/
getLoadedStyleNames(): Set<string>;
/**
* Check if a style name is loaded
* @param name - Style name to check
* @returns Boolean indicating if style is loaded
*/
isStyleNameLoaded(name: string): boolean;
/**
* Mark a style name as loaded
* @param name - Style name to mark as loaded
*/
setLoadedStyleName(name: string): void;
/**
* Remove a style name from loaded set
* @param name - Style name to remove
*/
deleteLoadedStyleName(name: string): void;
/**
* Clear all loaded style names
*/
clearLoadedStyleNames(): void;
};Base styling functionality (re-exported from @primeuix/styled).
declare const BaseStyle: {
/**
* Load CSS styles
* @param options - Style options
*/
loadCSS(options?: any): void;
/**
* Load CSS content
* @param css - CSS content
* @param options - Load options
*/
load(css?: string, options?: any): void;
/**
* Load inline styles
* @param options - Style options
* @param content - Style content
*/
loadStyle(options?: any, content?: any): void;
/**
* Get common theme styles
* @returns Theme style object
*/
getCommonTheme?(): any;
};Base classes provide a comprehensive styling system:
// Individual imports (recommended)
import BaseComponent from '@primevue/core/basecomponent';
import BaseDirective from '@primevue/core/basedirective';
import Base from '@primevue/core/base';
import BaseStyle from '@primevue/core/base/style';
// Named imports from main package
import { BaseComponent, BaseDirective } from '@primevue/core';
// Style imports
import BaseComponentStyle from '@primevue/core/basecomponent/style';Install with Tessl CLI
npx tessl i tessl/npm-primevue--coreevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10