@vttforge/core / SheetMode
Type Alias: SheetMode
SheetMode =
"play"|"edit"
Play and edit modes for a sheet.
A sheet in play is read: the numbers, the buttons that roll, the tabs. A sheet in edit is written: every field open. Most systems end up with the two, and each writes the same toggle, the same class on the root, the same disabled on every input. This is that once.
Opt in with static MODES = { initial: 'play' } on a sheet built on one of the bases. Without it a sheet behaves as before: always in edit, no header control, no field touched.
What the opt-in gives:
- A header control, "Edit mode" in play and "Play mode" in edit, shown to users who can edit the document. Its action is
vttforgeToggleMode. sheet.mode,sheet.isEditMode,sheet.isPlayMode, andsheet.toggleMode(mode?), which re-renders.context.mode,context.isEditModeandcontext.isPlayModefor the templates.- The class
vttforge-mode-playorvttforge-mode-editon the sheet element after every render. - In play, every form field inside the window content is
disabled, except those inside an element that carriesdata-vttforge-edit-in-play. A roll button is not a form field; it keeps working.
The mode lives on the sheet instance, so it resets when the window is closed and opened again. That is what a player expects from a toggle, and it keeps the sheet out of the settings.