@@ -4632,6 +4632,53 @@ declare namespace Tiled {
46324632 const Zstandard : CompressionMethod ;
46334633}
46344634
4635+
4636+ /**
4637+ * Provides access to session-specific settings. The session stores
4638+ * per-project preferences like last-used tile sizes, open files, and
4639+ * file states.
4640+ *
4641+ * Values are accessed by their string key (e.g. `"map.tileWidth"`).
4642+ *
4643+ * @since 1.12
4644+ */
4645+ interface Session {
4646+ /**
4647+ * Path to the current session file.
4648+ */
4649+ readonly fileName : string ;
4650+
4651+ /**
4652+ * Returns the session value for the given key, or `defaultValue` if
4653+ * the key is not set.
4654+ */
4655+ get ( key : string , defaultValue ?: any ) : any ;
4656+
4657+ /**
4658+ * Sets the session value for the given key.
4659+ */
4660+ set ( key : string , value : any ) : void ;
4661+
4662+ /**
4663+ * Returns whether the given key is present in the session.
4664+ */
4665+ isSet ( key : string ) : boolean ;
4666+
4667+ /**
4668+ * Returns the per-file state for the given file name.
4669+ */
4670+ fileState ( fileName : string ) : { [ key : string ] : any } ;
4671+
4672+ /**
4673+ * Sets the per-file state for the given file name.
4674+ */
4675+ setFileState ( fileName : string , fileState : { [ key : string ] : any } ) : void ;
4676+
4677+ /**
4678+ * Sets a single value in the per-file state for the given file name.
4679+ */
4680+ setFileStateValue ( fileName : string , name : string , value : any ) : void ;
4681+ }
46354682/**
46364683 * The `tiled` module is the main entry point and provides properties,
46374684 * functions and signals which are documented below.
@@ -4767,6 +4814,18 @@ declare namespace tiled {
47674814 */
47684815 export const tilesetEditor : TilesetEditor ;
47694816
4817+ /**
4818+ * Provides access to the current session, allowing scripts to read and
4819+ * write session-specific settings like last-used tile size.
4820+ *
4821+ * In command-line mode (`--evaluate`), no session may be available. In
4822+ * that case, methods return safe defaults (empty strings, default
4823+ * values, etc.).
4824+ *
4825+ * @since 1.12
4826+ */
4827+ export const session : Session ;
4828+
47704829 /**
47714830 * This function can be used to trigger any registered action. This
47724831 * includes most actions you would normally trigger through the menu or
0 commit comments