class

Egui::Ecss::Session

Inherits Reference < Object

The live debug session: owns the document, mirrors every edit into the Context (class rules → StyleSheet#rule, element overrides → Context#set_id_style) and reloads the file when it changes on disk (Context#begin_frame). Nothing is written to disk automatically — saving is explicit, the inspector header's «Сохранить» button (#flush(force: true)). Started by Sokol.run in debug builds via .enable; the app opts in with the enable_ecss macro.

Constructors

enable(ctx : Context, app_id : String) : Session
Source
new(ctx : Egui::Context, path : String)
Source

Instance methods

clear_element(id : Id) : Nil

The Element tab's "Reset all": every state, every key.

Source
flush(force : Bool = false) : Nil

Write the document to disk. The ONLY caller is the inspector header's «Сохранить» button (force: true) — recording an edit (#record_* / #unset_*) just marks the document dirty; the file stays untouched until the user saves.

Source
path
Source
poll

Hot reload: stat the file; an mtime/size change since the last load/write replays the journal backwards (removing keys deleted from the file) and applies the fresh document.

Source
reapply

A theme swap replaced the whole StyleSheet — bring the class rules over to the new sheet (element overrides live on the Context and survive, re-applying them is an idempotent no-op).

Source
record_class(selector : String, key : String, value : StyleValue) : Nil

One class-rule edit (selector "button" / "button:hover"): applied to the stylesheet, recorded into the document, file marked dirty — flushed to disk at the end of the frame.

Source
record_element(id : Id, name : String | Nil, key : String, value : StyleValue, state : String | Nil = nil) : Nil
Source
unset_class(selector : String, key : String) : Nil

One class-rule key removal; a no-op on the file when the key was never part of the diff (un-setting an app-defined rule).

Source
unset_element(id : Id, key : String, state : String | Nil = nil) : Nil
Source