mmo-theme-config
1 symbol · generated 5 Oct 2026
mmo-theme-config
mmo-theme-config.jhs:1The theme configurator: every value the theme's .scs token sources declare, editable, previewed live, and written back as Simple CSS.
- Extends
- CustomShadowElement
Index
| source | the token source whose groups are shown (the tab), ex: tokens, dark. | |
| section | the group of that source to open on; empty opens on all of them | |
| filter | what the search box holds; a row matches on its name, its custom property, the expression it carries or the value that expression produces | |
| PREVIEW_DELAY static | how long a keystroke waits before the candidate theme is compiled | |
| PREVIEW_ID static | the id of the <style> this element hangs the previewed theme from, in the document's head | |
| ViewDefault static readonly accessor | ||
| constructor() | ||
| init() | ||
| mountSample() | Put the sample where the document's stylesheet can paint it. | |
| readScheme() | Read the scheme the page is really showing, so the switch says what is on screen. | |
| setScheme(scheme) | Show the theme's other half. | |
| toggleSample() | Fold the sample away, for a screen that is all rows. | |
| toggleLive() | Stop (or resume) showing the theme being edited. | |
| toggleOnly() | Show only what changed and what follows it, or everything again. | |
| disconnectedCallback() | Drop the previewed theme when the element goes away: it lives in the document, not in this root. | |
| request(path, method, overrides) | Call one of the theme routes. | |
| load() | Read the model and the stored configuration. | |
| save() | Store the configuration, regenerate the theme and recompile the stylesheet. | |
| resetAll() | Drop every override, on the server: the theme goes back to what its sources declare. | |
| revert() | Throw away what is not saved and read the stored configuration again. | |
| preview() | Compile the candidate theme and show it, writing nothing. | |
| setPayload(data) | Render a payload: the sections, their entries, and where the configuration is written. | |
| readEntry(entry) | One model entry, as this element renders it. | |
| applyFilter() | Show the sections of the chosen source, and inside them the rows the filter keeps. | |
| selectSource(namespace) | Show the source whose tab was clicked, on its own first group. | |
| selectSection(key) | Show one group, or all of them. | |
| firstGroup(source) | ||
| message(state, text) | ||
| collect() | The overrides to send: every row that no longer says what its source says. | |
| countDirty() | Count the rows that differ from their source, for the badge on the apply button. | |
| touch() | A row was typed in: count it, and compile the candidate theme once the typing stops. | |
| pick(view, event) | Write the colour a picker was moved to into the row's own value. | |
| revertEntry(view) | Put back the expression the source declares for one row. | |
| setResolved(resolved, overrides) | Show what the server really compiled each row to, and what that change implied. | |
| markRows() | Stamp, on every row, what happened to it. | |
| countStates() | Say, next to the buttons, how many values were changed and how many followed them. | |
| batch(fn) | Run a bulk update of the view as one. | |
| showPreview(css) | Hang the previewed token layer in the document's head. | |
| clearPreview(pending) | Remove the previewed theme, so the page goes back to the stylesheet it really loaded. | |
| reloadStylesheet(url) | Point the document's stylesheet at the css that was just compiled. | |
| ToHex(value) static | Read any css colour as the #rrggbb a native colour picker takes. | |
| (default) | the sample the preview paints. |
Attributes3
source
mmo-theme-config.jhsthe token source whose groups are shown (the tab), ex: tokens, dark. Empty opens on the first source the server answers with.
source=""
section
mmo-theme-config.jhsthe group of that source to open on; empty opens on all of them
section=""
filter
mmo-theme-config.jhswhat the search box holds; a row matches on its name, its custom property, the expression it carries or the value that expression produces
filter=""
Constants2
PREVIEW_DELAY
staticmmo-theme-config.jhs:362how long a keystroke waits before the candidate theme is compiled
PREVIEW_ID
staticmmo-theme-config.jhs:364the id of the <style> this element hangs the previewed theme from, in the document's head
Properties1
ViewDefault
staticreadonlyaccessormmo-theme-config.jhs:379Methods35
constructor()
mmo-theme-config.jhs:366init()
mmo-theme-config.jhs:387mountSample()
mmo-theme-config.jhs:416Put the sample where the document's stylesheet can paint it.
readScheme()
mmo-theme-config.jhs:429Read the scheme the page is really showing, so the switch says what is on screen.
setScheme(scheme)
mmo-theme-config.jhs:442Show the theme's other half.
| scheme | string | - light or dark |
toggleSample()
mmo-theme-config.jhs:450Fold the sample away, for a screen that is all rows.
toggleLive()
mmo-theme-config.jhs:460Stop (or resume) showing the theme being edited.
toggleOnly()
mmo-theme-config.jhs:469Show only what changed and what follows it, or everything again.
disconnectedCallback()
mmo-theme-config.jhs:474Drop the previewed theme when the element goes away: it lives in the document, not in this root.
request(path, method, overrides)
mmo-theme-config.jhs:495Call one of the theme routes.
| path | string | - themeConfig or themePreview |
| method = 'GET' | string | - GET, PUT, POST or DELETE |
| overrides = null | ?object | - the configuration to send, when the route takes one |
| returns | Promise | the route's payload |
load()
mmo-theme-config.jhs:513Read the model and the stored configuration.
save()
mmo-theme-config.jhs:524Store the configuration, regenerate the theme and recompile the stylesheet.
| returns | Promise |
resetAll()
mmo-theme-config.jhs:539Drop every override, on the server: the theme goes back to what its sources declare.
revert()
mmo-theme-config.jhs:552Throw away what is not saved and read the stored configuration again.
preview()
mmo-theme-config.jhs:561Compile the candidate theme and show it, writing nothing.
| returns | Promise |
setPayload(data)
mmo-theme-config.jhs:582Render a payload: the sections, their entries, and where the configuration is written.
| data | object | - what a theme route answered |
readEntry(entry)
mmo-theme-config.jhs:636One model entry, as this element renders it.
| entry | object | - an entry of the payload |
| returns | object |
applyFilter()
mmo-theme-config.jhs:665Show the sections of the chosen source, and inside them the rows the filter keeps.
selectSource(namespace)
mmo-theme-config.jhs:713Show the source whose tab was clicked, on its own first group.
| namespace | string | - a source's namespace, which is its file name |
selectSection(key)
mmo-theme-config.jhs:726Show one group, or all of them.
| key | string | - a section key, or '' for every group of the source |
firstGroup(source)
mmo-theme-config.jhs:738| source = null | ?string | - the source to look in, defaulting to the one on screen |
| returns | string | the key of its first group that has something to edit -- the compiler's own settings are a group too, and landing on a locked row says nothing |
message(state, text)
mmo-theme-config.jhs:749| state | string | - busy, ok, error, or empty for nothing at all |
| text | string | - what to say next to the buttons |
collect()
mmo-theme-config.jhs:764The overrides to send: every row that no longer says what its source says.
| returns | object | entry key => expression |
countDirty()
mmo-theme-config.jhs:778Count the rows that differ from their source, for the badge on the apply button.
touch()
mmo-theme-config.jhs:785A row was typed in: count it, and compile the candidate theme once the typing stops.
pick(view, event)
mmo-theme-config.jhs:803Write the colour a picker was moved to into the row's own value.
| view | MMO.elements.View | - the row's view |
| event | Event | - the event the picker fired |
revertEntry(view)
mmo-theme-config.jhs:814Put back the expression the source declares for one row.
| view | MMO.elements.View | - the row's view |
setResolved(resolved, overrides)
mmo-theme-config.jhs:829Show what the server really compiled each row to, and what that change implied.
| resolved | object | - entry key => the value the compiler produced |
| overrides | object | - what was sent |
markRows()
mmo-theme-config.jhs:860Stamp, on every row, what happened to it.
countStates()
mmo-theme-config.jhs:872Say, next to the buttons, how many values were changed and how many followed them.
batch(fn)
mmo-theme-config.jhs:895Run a bulk update of the view as one.
| fn | Function | - the writes to run |
showPreview(css)
mmo-theme-config.jhs:911Hang the previewed token layer in the document's head.
| css | string | - the compiled token layer |
clearPreview(pending)
mmo-theme-config.jhs:931Remove the previewed theme, so the page goes back to the stylesheet it really loaded.
| pending = true | boolean | - false to leave a compilation that is already on its way alone, which is what the live toggle wants: it hides the preview, it does not cancel it |
reloadStylesheet(url)
mmo-theme-config.jhs:948Point the document's stylesheet at the css that was just compiled.
| url | string | - the stylesheet's url, with its cache buster |
| returns | boolean | false when the document links no such stylesheet |
ToHex(value)
staticmmo-theme-config.jhs:971Read any css colour as the #rrggbb a native colour picker takes.
| value | string | - a css colour, ex: #EEF3FF, rgba(13, 18, 27, .55), rebeccapurple |
| returns | string | the colour as #rrggbb, or an empty string |
Slots1
(default)
mmo-theme-config.jhsthe sample the preview paints. A page that provides none gets the one this element ships.
<slot>