@theredhead — Frontend Library - v0.2.1
    Preparing search index...

    State management service for the Theme Studio drawer.

    Loads the CSS token manifest, reads live computed values from the document root, tracks per-token overrides, and applies them in real time via document.documentElement.style.setProperty.

    Inject this wherever you need to open/close the studio or query its state.

    export class DevToolbar {
    private readonly studio = inject(ThemeStudioService);

    protected open(): void { this.studio.open(); }
    }
    Index

    Constructors

    Properties

    filter: WritableSignal<ThemeTokenFilter> = ...

    Active filter applied to the token list.

    filteredTokens: Signal<ThemeTokenState[]> = ...

    Tokens after the active filter is applied.

    isOpen: WritableSignal<boolean> = ...

    Whether the studio drawer is currently visible.

    loadError: WritableSignal<string | null> = ...

    Error message from the most recent manifest load attempt, or null.

    loading: WritableSignal<boolean> = ...

    Loading state for the manifest fetch.

    manifest: WritableSignal<ThemeTokenManifest | null> = ...

    Raw manifest loaded from JSON.

    modifiedTokens: Signal<ThemeTokenState[]> = ...

    Tokens that have been modified by the studio.

    sampleTokensOnly: WritableSignal<boolean> = ...

    Whether the token editor is limited to the selected sample's tokens.

    selectedSample: WritableSignal<ThemeStudioSample> = ...

    The live component sample currently shown in the canvas.

    tokens: WritableSignal<ThemeTokenState[]> = ...

    All tokens with their live computed values and any studio overrides.

    Methods

    • Close the studio drawer.

      Returns void

    • Export the current overrides as a CSS snippet that can be pasted into a stylesheet.

      Returns string

    • Export the current overrides as a JSON object ({ "--ui-accent": "#ff0000", ... }).

      Returns Record<string, string>

    • Import a set of overrides from a plain object. Only tokens present in the manifest are applied.

      Parameters

      • overrides: Record<string, string>

      Returns void

    • Open the studio drawer, loading the manifest if needed.

      Parameters

      • manifestUrl: string = "assets/css-token-manifest.json"

      Returns void

    • Reset all overrides and re-read computed values from the document.

      Returns void

    • Reset only overrides visible for the current sample.

      Returns void

    • Apply an override value to a token and update the live document. Pass null to reset the token to its original computed value.

      Parameters

      • tokenName: string
      • value: string | null

      Returns void

    • Toggle the component-focused token view.

      Parameters

      • value: boolean

      Returns void

    • Select the component sample shown by the studio canvas.

      Parameters

      Returns void

    • Toggle the studio drawer.

      Parameters

      • manifestUrl: string = "assets/css-token-manifest.json"

      Returns void

    • Return the current live value for a token, if it is loaded.

      Parameters

      • tokenName: string

      Returns string