| 1 |
<?php |
| 2 |
/** |
| 3 |
* Desktop Mode — Shell markup injection. |
| 4 |
* |
| 5 |
* Emits the `<div id="desktop-mode-shell">…</div>` skeleton at |
| 6 |
* `in_admin_header @ 5`. The shell floats on top of the classic |
| 7 |
* admin via `position: fixed`; the body class added by |
| 8 |
* `body-classes.php` triggers the CSS that hides classic chrome. |
| 9 |
* |
| 10 |
* Extracted from `render.php` during the architecture-0.8.1 PHP |
| 11 |
* slicing (phase 6). |
| 12 |
* |
| 13 |
* @package Desktop_Mode |
| 14 |
* @since 0.8.1 |
| 15 |
*/ |
| 16 |
|
| 17 |
defined( 'ABSPATH' ) || exit; |
| 18 |
|
| 19 |
|
| 20 |
/** |
| 21 |
* Injects the desktop shell markup into the admin page. |
| 22 |
* |
| 23 |
* Runs on `in_admin_header` at priority 5 so the shell renders right |
| 24 |
* after the classic admin bar but before the page content. The shell |
| 25 |
* floats above the classic layout via `position: fixed` in CSS; the |
| 26 |
* classic sidebar, body, and footer are hidden with `body.desktop-mode-active` |
| 27 |
* selectors. |
| 28 |
* |
| 29 |
* @since 0.1.0 |
| 30 |
*/ |
| 31 |
function desktop_mode_render_shell() { |
| 32 |
if ( desktop_mode_is_chromeless_request() || ! desktop_mode_is_enabled() || desktop_mode_is_classic_request() ) { |
| 33 |
return; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Fires right before the desktop shell markup is rendered. |
| 38 |
* |
| 39 |
* @since 0.1.0 |
| 40 |
*/ |
| 41 |
do_action( 'desktop_mode_shell_before' ); |
| 42 |
|
| 43 |
// Stamp the user's admin color scheme onto the shell root so the |
| 44 |
// variables.css per-scheme selectors kick in before first paint — |
| 45 |
// doing this from JS on init() would show the default palette for a |
| 46 |
// frame before swapping. |
| 47 |
$scheme = sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 48 |
?> |
| 49 |
<div id="desktop-mode-shell" class="desktop-mode-shell" data-desktop-mode-scheme="<?php echo esc_attr( $scheme ); ?>" role="application" aria-label="<?php esc_attr_e( 'Desktop shell', 'desktop-mode' ); ?>"> |
| 50 |
<?php |
| 51 |
/* |
| 52 |
* Wallpaper layer — sits behind both the dock and the desktop |
| 53 |
* area so a translucent dock bleeds through to the wallpaper |
| 54 |
* (macOS pattern). Canvas-driven wallpapers mount their own |
| 55 |
* DOM into this element; static CSS wallpapers just inherit |
| 56 |
* the `--desktop-mode-bg` custom property the shell sets at |
| 57 |
* boot. Presentational only. |
| 58 |
*/ |
| 59 |
?> |
| 60 |
<div id="desktop-mode-wallpaper" class="desktop-mode-wallpaper" aria-hidden="true"></div> |
| 61 |
<div class="desktop-mode-shell__body"> |
| 62 |
<nav id="desktop-mode-dock" class="desktop-mode-dock" role="toolbar" aria-label="<?php esc_attr_e( 'Admin navigation', 'desktop-mode' ); ?>"></nav> |
| 63 |
<div id="desktop-mode-area" class="desktop-mode-area desktop-mode-area--with-dock desktop-mode-area--booting"> |
| 64 |
<?php |
| 65 |
/* |
| 66 |
* Widget column — paints above the wallpaper but |
| 67 |
* beneath windows (z-index 1 vs. windows at 100+). |
| 68 |
* Hosted INSIDE `.desktop-mode-area` so scrolling the |
| 69 |
* area (not that we do today) would scroll widgets |
| 70 |
* with it, and so the dock naturally frames |
| 71 |
* it. Empty on first render — JS (`WidgetLayer`) |
| 72 |
* populates it on boot. |
| 73 |
*/ |
| 74 |
?> |
| 75 |
<aside id="desktop-mode-widgets" class="desktop-mode-widgets" aria-label="<?php esc_attr_e( 'Widgets', 'desktop-mode' ); ?>"></aside> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
<?php |
| 80 |
/** |
| 81 |
* Fires right after the desktop shell markup has rendered. |
| 82 |
* |
| 83 |
* @since 0.1.0 |
| 84 |
*/ |
| 85 |
do_action( 'desktop_mode_shell_after' ); |
| 86 |
} |
| 87 |
add_action( 'in_admin_header', 'desktop_mode_render_shell', 5 ); |
| 88 |
|
| 89 |
|