Command
Encapsulate a request as an object, via CSS variables driven by inputs or state checkboxes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Triggered Directives
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
/* The command is encapsulated in a hidden checkbox */
.hidden-trigger {
display: none;
}
/* Executing the command triggers a state change in siblings */
#toggle-invisibility:checked ~ .target-ward {
opacity: 0;
pointer-events: none;
transform: scale(0.9);
transition: all 0.5s ease-out;
}
Also known as the “checkbox hack”, the Command pattern stores user input state entirely within the DOM and CSS, firing off elaborate transitions and visibility toggles without a single script being executed.
Runic Tags:
#css
#checkbox-hack
#state
#design-patterns