Index

mmo-element-doc

1 symbol · generated 30 Sep 2026

element

mmo-element-doc

mmo-element-doc.jhs:1

Documents any .jhs custom element, from the element itself.

<mmo-element-doc element></mmo-element-doc>
Extends
CustomShadowElement
Every element compiled by `MMO\client\JHSCompiler` carries its own documentation: `documentation()` returns what its jsdoc declared (`@attr`, `@css`, `@slot`, methods, getters) and its shadow root says which slots it really has. This element reads both, so a documentation page is one tag and never goes stale -- what is written in the element is what the page shows. On top of the reference it renders a configurator: pick attributes, classes and slot contents, see the element react, and copy the html it produced. ```html <mmo-element-doc element="mmo-icon"> <script type="application/json" slot="preset"> {"attributes": {"name": {"values": ["house", "gear"], "value": "house"}}, "classes": ["l"], "slots": {"": "Label"}} &lt;/script> </mmo-element-doc> ```

Index

elementthe tag name to document (mmo-icon).
tag readonly accessor
constructor()
init()
load()Re-read the documented element and rebuild the page.
read(tag)Read the documentation of an element: what its jsdoc declared, plus the slots its shadow root actually has -- a slot nobody documented is still a slot, and hiding it would be a lie.
readPreset()Read the configurator's starting point from the preset slot.
reset()Put the configurator back to what the preset asks for.
cycleGround()Show the preview on the next ground: what looks right on white can vanish on ink.
renderConfig()Build one control per attribute, class and slot.
renderGroup(parent, title, rows)Add one titled group of rows to the configurator, unless it would be empty.
row(toggle, name, field, description)One line of the configurator: a switch, a name, a field and what it is for.
update()Rebuild the preview from the current configuration, and the html that would produce it.
html(tag, attributes, content)Write the configured element out as a page would: attributes in order, slotted children one per line, nothing the reader would have to delete.
copy()Copy the generated html.
renderReference()Build the reference tables, in the order a reader needs them.
table(parent, title, head, rows)Add one reference table, unless the element has nothing to put in it.
clean(text)jsdoc writes @attr name - what it does: the dash is a separator, not part of the sentence.
value(value)Render a default value for the reference: an em dash when there is none.
preseta <script type="application/json"> giving the configurator its starting point: attributes (per name: value, values to offer, type), classes already on, slots with their starting conte…
(default)anything to show under the reference, for a page that has more to say.
.compacthide the configurator and show the preview and the reference only

Attributes1

element

mmo-element-doc.jhs

the tag name to document (mmo-icon). Changing it re-reads everything.

element

Properties1

Methods17

load()

mmo-element-doc.jhs:104

Re-read the documented element and rebuild the page. Called on init and whenever the element attribute changes.

load()
returnsvoid

read(tag)

mmo-element-doc.jhs:129

Read the documentation of an element: what its jsdoc declared, plus the slots its shadow root actually has -- a slot nobody documented is still a slot, and hiding it would be a lie.

read(tag)
tagstring
returns?object

readPreset()

mmo-element-doc.jhs:155

Read the configurator's starting point from the preset slot.

readPreset()
returnsobjectthe preset slot's json, or an empty preset

cycleGround()

mmo-element-doc.jhs:200

Show the preview on the next ground: what looks right on white can vanish on ink.

cycleGround()
returnsvoid

renderGroup(parent, title, rows)

mmo-element-doc.jhs:259

Add one titled group of rows to the configurator, unless it would be empty.

renderGroup(parent, title, rows)
parentHTMLElement
titlestring
rowsArray
returnsvoid

row(toggle, name, field, description)

mmo-element-doc.jhs:274

One line of the configurator: a switch, a name, a field and what it is for.

row(toggle, name, field, description)
toggle?HTMLElement
namestring
field?HTMLElement
descriptionstring
returnsHTMLElement

update()

mmo-element-doc.jhs:290

Rebuild the preview from the current configuration, and the html that would produce it.

update()
returnsvoid

html(tag, attributes, content)

mmo-element-doc.jhs:322

Write the configured element out as a page would: attributes in order, slotted children one per line, nothing the reader would have to delete.

html(tag, attributes, content)
tagstring
attributesNamedNodeMap
contentstring
returnsstringthe html of the configured element, as a page would write it

renderReference()

mmo-element-doc.jhs:350

Build the reference tables, in the order a reader needs them. @return {void}

renderReference()

table(parent, title, head, rows)

mmo-element-doc.jhs:382

Add one reference table, unless the element has nothing to put in it.

table(parent, title, head, rows)
parentHTMLElement
titlestring
headArray<string>
rowsArray<Array<string>>
returnsvoid

clean(text)

mmo-element-doc.jhs:405

jsdoc writes @attr name - what it does: the dash is a separator, not part of the sentence.

clean(text)
text?string
returnsstring

value(value)

mmo-element-doc.jhs:414

Render a default value for the reference: an em dash when there is none.

value(value)
value*
returnsstring

Slots2

preset

mmo-element-doc.jhs

a <script type="application/json"> giving the configurator its starting point: attributes (per name: value, values to offer, type), classes already on, slots with their starting content, and ground (surface, bg or ink).

<slot name="preset">

(default)

mmo-element-doc.jhs

anything to show under the reference, for a page that has more to say.

<slot>

CSS hooks1

.compact

mmo-element-doc.jhs

hide the configurator and show the preview and the reference only

.compact