import type { TailwindFeatureAttributes, } from '../../tailwind/attributes' import type { SelectorsAttributes, VariablesAttributes, } from '..' export type * from './options' export interface Preset { /** Preset ref. */ ref: string /** Preset title. */ title: string /** Preset description. */ description?: string /** JSON-encoded preset attributes. */ attrs: string /** Preset class names. */ cx: string /** Preset CSS using `.ska-preset-selector` selectors. */ css: string /** Preset (attrs) last modified. */ t?: number /** Compiler t when preset was last compiled. */ v?: number /** Preset's static CSS loading strategy. */ loading: | undefined | '' | 'default' // Preset's static CSS is loaded dynamically in the editor. | 'pre' // Preset's static CSS is pre-loaded with PHP, injected into editor settings (since dynamically loaded styles (via `useStyleOverride()`) aren't included in previews (such as patterns), this allows the preset's CSS to also be available there). | 'off' // Preset's static CSS is not loaded in the editor (for example ska-theme includes big presets for things like WC Single Product page, no reason to include that CSS in the block editor as the single product page is only rendered on the front end with a PHP template). /** Preset has default value. */ isDefault?: boolean /** ska-blocks version at the time of migration. */ __migrated?: string /** Old ID. */ __id?: number /** Old `${slug}Preset`. */ __option?: string } export type PresetSlug = string export type LegacyPresetSlug = string export type LegacyPresetID = number export type Presets = Record /** Presets applied to a block. */ export interface BlockPreset { id: PresetSlug | LegacyPresetSlug | LegacyPresetID isStatic?: boolean ref?: Preset['ref'] t?: Preset['t'] } /** Block presets that have IDs resolved to existing slugs. */ export interface ResolvedBlockPreset extends Omit { id: PresetSlug } /** Block attributes that a preset can contain. */ export type PresetBlockAttributes = TailwindFeatureAttributes & VariablesAttributes & SelectorsAttributes export interface LegacyPreset { id: number title: string attributes: Record classNames: string css: string } export type ManagedPresets = Record