You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Single Directory Components (SDC)** keep markup, styles, metadata, and logic together, making components clear, reusable, and Drupal-native.
8
15
***Vite** is chosen for speed, simplicity, and modern ESM workflows.
16
+
***Lit** provides a lightweight, reactive layer for Web Components. It ensures that complex UI logic remains fast and encapsulated, allowing for high interactivity with minimal overhead
9
17
***Storybook** is isolated by design to enforce clean, native, CMS-agnostic components.
|[Reveal](./components/00-base/01-primitives/reveal)|| experimental |✅|✅| provides a "reveal on scroll" animation for its content |
60
+
|[Focus Trap](./components/00-base/01-primitives/focus-trap)| v1.0.0 | stable ||| JS only component used by Drawer, Menu toggle |
16
61
17
62
## Quick Start
18
63
@@ -22,17 +67,25 @@ Install all dependencies
22
67
npm install
23
68
```
24
69
25
-
Starts the Vite development server
70
+
Develop common Drupal styles
26
71
27
72
```bash
28
73
npm run dev
29
74
```
30
-
75
+
Develop SDC components
76
+
```bash
77
+
npm run dev:sdc
78
+
```
31
79
Build SDC components and main style.css
32
80
33
81
```bash
34
82
npm run build
35
83
```
84
+
Run Storybook
85
+
```bash
86
+
npm run storybook
87
+
```
88
+
36
89
## Theme Renaming
37
90
This theme includes a migration script to safely change the theme's machine name. This is particularly useful when using this repository as a starter kit.
38
91
### What the script does:
@@ -57,60 +110,18 @@ Run the script:
57
110
```
58
111
Enter your new theme machine name (e.g., `my_awesome_theme`) when prompted.
59
112
60
-
## Theme Management
113
+
## Theme Light / Dark modes
61
114
62
115
This project implements a flexible theme system with native Dark Mode support.
63
116
64
117
### 1. Native System Support (Default)
65
118
The theme is **Auto-first** by design. Even without the toggler component, the site automatically inherits the user's OS preference via `prefers-color-scheme`. Dark mode CSS variables are active by default to ensure a seamless experience from the first visit.
66
119
67
120
### 2. Manual Theme Toggler
68
-
The `<wudo-theme-toggler>` Web Component allows users to manually override system settings.
121
+
The [Theme Toggler](./components/01-atoms/theme-toggler) Web Component allows users to manually override system settings.
69
122
***Tri-state Logic:** Cycles through **Auto** (System), **Dark**, and **Light** modes.
70
123
***Zero Flicker:** Applies `data-theme` to the `<html>` element instantly to prevent Layout Shift.
71
124
***Fully Localized:** All labels and ARIA attributes are passed from Drupal/Twig, making the component 100% translatable.
72
-
## Component Inventory
73
-
74
-
### Atoms
75
-
Fundamental building blocks that cannot be broken down further.
|[Drawer](./components/03-organisms/drawer)| experimental |**SDC + Web Component** - container component that functions as both off-canvas sidebars (menus, carts) and centered modal dialogs. |
104
-
|[Carousel](./components/03-organisms/carousel)| experimental |**SDC + Web Component** - a lightweight and accessible content slider |
105
-
|[Favorite](./components/03-organisms/favorite)| experimental |**SDC + Web Component + Lit** - Save to list (watchlist, favorites, etc.) |
|[Sticky Header](./components/00-base/01-primitives/sticky-header)| experimental |**SDC + Web Component** - adds "Smart Sticky" functionality to any header or navigation bar |
112
-
|[Reveal](./components/00-base/01-primitives/reveal)| experimental |**SDC + Web Component** - provides a "reveal on scroll" animation for its content |
113
-
|[Focus Trap](./components/00-base/01-primitives/focus-trap)| stable | JS only component used by Drawer, Menu toggle |
A robust, stack-based focus management system for Drupal themes. This system consists of a `FocusTrapManager` to handle multiple UI layers (like nested menus or modals) and a dynamic `FocusTrap` class to ensure keyboard accessibility (A11y).
3
+
4
+
## Key Features
5
+
***Stack-Based Logic:** Handles multiple overlapping components (e.g., a Mega Menu inside a Mobile Menu) without focus conflicts.
6
+
***Dynamic Discovery:** Recalculates focusable boundaries on every `Tab` press, making it perfect for menus with toggleable sub-sections.
7
+
***External Element Support:** Allows including elements outside the main container (like a toggle button) into the focus rotation.
8
+
***A11y Optimized:** Manages `aria-expanded` states, handles the `Escape` key via custom events, and prevents background scrolling.
9
+
10
+
### Used By
11
+
***Drawer:** For trapping focus within the drawer when it's open.
12
+
***Menu Toggle:** To manage focus within the menu and its toggle button, especially when the menu has nested items.
13
+
14
+
## FocusTrapManager (The Orchestrator)
15
+
The `FocusTrapManager` lives on the global window object and tracks all active traps in a stack.
0 commit comments