Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler Class Reference

Reads player-setting metadata and supported variable mappings from the configured source order. More...

Data Structures

class  Declaration
class  Value

Static Public Member Functions

static List< DeveloperThemeDefinition > Compile (ThemeSourceGraph graph, ISet< string > dependencies)
 Derives namespace records and adds actual artwork dependencies to the existing fingerprint inputs.
static bool TryUpdateAuthoredValues (ThemeSourceGraph graph, IReadOnlyDictionary< string, string > values, IReadOnlyDictionary< string, string > originals, out Dictionary< string, string > updated, out string error)
 Updates explicitly edited developer defaults at their original annotated value spans.

Static Public Attributes

const string ContractVersion = "WFWDevExt-annotation-first"
 Included in the existing dependency fingerprint whenever compilation semantics change.

Static Private Member Functions

static void AddDiagnostic (List< string > diagnostics, Declaration declaration, string message)
static List< DeveloperThemeDefinition > CompileCore (ThemeSourceGraph graph, ISet< string > dependencies)
static int End (string text, int start, char end)
static Dictionary< string, string > Expand (string property, string expression)
static InvalidDataException Failure (Declaration declaration, string message)
static void Parse (Value value, string property, Declaration declaration, ISet< string > dependencies)
static List< Declaration > Read (ThemeSourceGraph graph)
static float ReadBound (string text, Declaration declaration)
static void ReadMetadata (string comment, Declaration declaration)
static Value Resolve (Declaration consumer, string expression, List< Declaration > declarations, HashSet< string > seen, ISet< string > dependencies)
static bool ScopeApplies (string declaring, string consumer)

Detailed Description

Reads player-setting metadata and supported variable mappings from the configured source order.

METADATA FORMAT: inside /* WFW:BEGIN DEVELOPER ‍/ ... / WFW:END DEVELOPER ‍/, put a block comment immediately before the developer custom-property declaration. Each field MUST occupy its own line (LF or CRLF); commas do NOT separate metadata fields. The first nonempty line is WFWDevExt: namespace.key. Required: type (number, color, image). Numbers require unit: px, exactly one of min/min-exclusive, and max. Label/description are optional. Leading '' comment decoration is allowed. The USS declaration supplies the default value. Example block (each field below is a separate line):

/*
WFWDevExt: example.hotbar.width
type: number
unit: px
min-exclusive: 0
max: 4096
*&zwj;/
&ndash;demo-hotbar-width: 686px;

First annotated identity wins; later definitions warn without blocking Copy. Ordinary stylesheet declarations and suffixes are Unity's responsibility, not player-data validation. Only prepared settings/defaults and the fixed runtime mapping vocabulary are processed here.

REQUIRED MAINTENANCE BOUNDARY: this authoring and mapping behavior is accepted. Preserve it. Do not redesign the metadata format, add a general USS/CSS validator, infer defaults from competing consumers, or reinstate whole-Copy rejection for duplicate identities without an explicitly authorized change. Fix only the reported defect; do not rewrite developer styling to satisfy this reader.

HOW IT WORKS: the editor supplies the actual ordered ThemeSourceGraph for the selected theme and its configured application styling/imports. Read() extracts marked declarations and their following variable/default values from source text; there is no Demo-key lookup or preset palette. CompileCore() retains the first namespace/key identity, resolves its authored default and supported aliases, then associates supported var(...) consumers with that identity. Newly authored identities therefore become prepared settings without requiring a matching hardcoded C# field.

The declaration owns the exported default and explicit numeric bounds. Consumer properties supply application targets, not a second defaults authority. Optional label/description remain developer metadata; player overrides cannot supply selectors, setters, types or weaker bounds. Keep finite/type/bounds checks, bounded processing and existing asset/path security intact.

FIXED STYLING IS NOT AN EDITABLE SETTING: an unannotated literal such as border-width: 0 is not automatically exported as a developer value. General framework inline bindings can take precedence over such USS literals, so successful metadata Copy does not certify identical output for every unmarked styling rule. Do not silently add metadata or copy arbitrary CSS to hide this distinction.

This compiler prepares metadata and asset references; it does not build or mutate a native runtime stylesheet, apply live player values, or write developer USS files. Runtime application and player-file/image validation belong to their existing adapters. Image/cursor rendering and platform fidelity require their own verification; successful metadata preparation is not that proof.

Member Function Documentation

◆ AddDiagnostic()

void GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.AddDiagnostic ( List< string > diagnostics,
Declaration declaration,
string message )
inlinestaticprivate
Here is the caller graph for this function:

◆ Compile()

List< DeveloperThemeDefinition > GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Compile ( ThemeSourceGraph graph,
ISet< string > dependencies )
inlinestatic

Derives namespace records and adds actual artwork dependencies to the existing fingerprint inputs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompileCore()

List< DeveloperThemeDefinition > GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.CompileCore ( ThemeSourceGraph graph,
ISet< string > dependencies )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ End()

int GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.End ( string text,
int start,
char end )
inlinestaticprivate
Here is the caller graph for this function:

◆ Expand()

Dictionary< string, string > GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Expand ( string property,
string expression )
inlinestaticprivate
Here is the caller graph for this function:

◆ Failure()

InvalidDataException GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Failure ( Declaration declaration,
string message )
inlinestaticprivate
Here is the caller graph for this function:

◆ Parse()

void GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Parse ( Value value,
string property,
Declaration declaration,
ISet< string > dependencies )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

List< Declaration > GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Read ( ThemeSourceGraph graph)
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBound()

float GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.ReadBound ( string text,
Declaration declaration )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadMetadata()

void GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.ReadMetadata ( string comment,
Declaration declaration )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Resolve()

Value GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.Resolve ( Declaration consumer,
string expression,
List< Declaration > declarations,
HashSet< string > seen,
ISet< string > dependencies )
inlinestaticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScopeApplies()

bool GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.ScopeApplies ( string declaring,
string consumer )
inlinestaticprivate
Here is the caller graph for this function:

◆ TryUpdateAuthoredValues()

bool GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.TryUpdateAuthoredValues ( ThemeSourceGraph graph,
IReadOnlyDictionary< string, string > values,
IReadOnlyDictionary< string, string > originals,
out Dictionary< string, string > updated,
out string error )
inlinestatic

Updates explicitly edited developer defaults at their original annotated value spans.

Parameters
graphThe source graph read when the Studio form was loaded.
valuesChanged namespace.key identities and replacement USS values only.
originalsOriginal declaring source texts captured with that graph.
updatedOnly modified source texts, for the existing transactional writer.
errorSpecific metadata, type, bounds or source failure.
Returns
True when every requested identity is updated without replacing headers or selectors.

First annotated identity remains authoritative. Unchanged aliases and all unrelated declarations stay untouched. No source file, image or player data is written here.

ACCEPTED STUDIO CONTRACT: this uses the same metadata reader as runtime preparation, not a parallel Studio parser or another defaults authority. It returns only value-span edits for explicitly supplied identities; it never moves scoped declarations into :root, rewrites metadata headers, changes selectors, copies images or writes player files. The existing Studio transaction owns persistence, original-byte checks and failure recovery.

The user accepted the connected form and its simple workflow. Preserve the metadata format, first-identity handling and existing bounds/image rules. Further testing remains; that is not authorization for speculative hardening, schema changes or source reorganization. Make only a specifically authorized defect/requirement change and verify that change.

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ ContractVersion

const string GWG.WindowFramework.Editor.DeveloperThemeMappingCompiler.ContractVersion = "WFWDevExt-annotation-first"
static

Included in the existing dependency fingerprint whenever compilation semantics change.