Skip to content

Style Preset Manager

window.lcards.core.stylePresetManager — Central registry of named style presets for buttons, sliders, and elbows.


Overview

StylePresetManager stores named preset objects loaded from packs. When a card config declares preset: lozenge, the manager resolves the full style definition so the card never needs to hard-code shape geometry or default sizes.


File

src/core/presets/StylePresetManager.js


Preset Namespacing

Presets are keyed by type.name, e.g. button.lozenge, slider.pills, elbow.header_left. The card type is always implicit from the registering pack.


Pack Registration

Packs contributed through style_presets:

javascript
export const BUTTONS_PACK = {
  style_presets: {
    button: {
      lozenge: {
        shape: 'lozenge',
        height: 40,
        border_radius: 20,
        // ...
      },
      bullet: { shape: 'bullet', ... },
      pill:   { shape: 'pill',   ... },
    }
  }
};

Public API

MethodReturnsDescription
getPreset(type, name)Object|nullFull preset definition, or null if not found
getPresetIds(type)string[]All preset names for an overlay type
getAvailablePresets(type)Object[]Preset objects with metadata for a type
getDebugInfo()ObjectStats snapshot: pack count, cache size, presets by type
javascript
const spm = window.lcards.core.stylePresetManager

// Get a preset definition
const preset = spm.getPreset('button', 'lozenge')

// List what's available
spm.getPresetIds('button')   // ['lozenge', 'bullet', 'capped', ...]

Card config style always merges on top of the preset, so any field can be overridden per-card.


Console Access

javascript
window.lcards.debug.singleton('stylePresetManager')
// → { type: 'StylePresetManager', initialized: true, packCount: 3, cacheSize: 24 }
javascript
const spm = window.lcards.core.stylePresetManager

spm.getPresetIds('button')       // available button presets
spm.getPreset('slider', 'pills') // full preset config object
spm.getAvailablePresets('elbow') // all elbow presets with metadata

Built-in Presets

TypePresets
buttonlozenge, bullet, capped, outline, pill, text, icon
sliderpills, gauge
elbowheader_left, header_right, footer_left, footer_right

See Also