| @@ -1,18 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Desktop Mode — Shell markup injection. | |
| 3 | + * OpenStation — Shell markup injection. | |
| 4 | 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. | |
| 5 | + * Emits the `<div id="os-shell">…</div>` skeleton at | |
| 6 | + * `in_admin_header @ 5` on the shell screen (`includes/shell-screen.php`). | |
| 7 | + * The shell floats on top of the admin document via `position: fixed`; | |
| 8 | + * the body class added by `body-classes.php` triggers the CSS that | |
| 9 | + * hides classic chrome. | |
| 9 | 10 | * |
| 10 | 11 | * Extracted from `render.php` during the architecture-0.8.1 PHP |
| 11 | 12 | * slicing (phase 6). |
| 12 | 13 | * |
| 13 | - * @package Desktop_Mode | |
| 14 | - * @since 0.8.1 | |
| 14 | + * @package OpenStation | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | defined( 'ABSPATH' ) || exit; |
| 18 | 18 | |
| @@ -22,24 +22,20 @@ | ||
| 22 | 22 | * |
| 23 | 23 | * Runs on `in_admin_header` at priority 5 so the shell renders right |
| 24 | 24 | * after the classic admin bar but before the page content. The shell |
| 25 | 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` | |
| 26 | + * classic sidebar, body, and footer are hidden with `body.os-active` | |
| 27 | 27 | * selectors. |
| 28 | - * | |
| 29 | - * @since 0.1.0 | |
| 30 | 28 | */ |
| 31 | -function desktop_mode_render_shell() { | |
| 32 | - if ( desktop_mode_is_chromeless_request() || ! desktop_mode_is_enabled() || desktop_mode_is_classic_request() ) { | |
| 29 | +function openstation_render_shell() { | |
| 30 | + if ( ! openstation_is_shell_request() ) { | |
| 33 | 31 | return; |
| 34 | 32 | } |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * Fires right before the desktop shell markup is rendered. |
| 38 | - * | |
| 39 | - * @since 0.1.0 | |
| 40 | 36 | */ |
| 41 | - do_action( 'desktop_mode_shell_before' ); | |
| 37 | + do_action( 'openstation_shell_before' ); | |
| 42 | 38 | |
| 43 | 39 | // Stamp the user's admin color scheme onto the shell root so the |
| 44 | 40 | // variables.css per-scheme selectors kick in before first paint — |
| 45 | 41 | // doing this from JS on init() would show the default palette for a |
| @@ -44,10 +40,26 @@ | ||
| 44 | 40 | // variables.css per-scheme selectors kick in before first paint — |
| 45 | 41 | // doing this from JS on init() would show the default palette for a |
| 46 | 42 | // frame before swapping. |
| 47 | 43 | $scheme = sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 44 | + | |
| 45 | + // Same reasoning for the active desktop theme: the compiled | |
| 46 | + // theme stylesheet keys off this attribute, so stamping it | |
| 47 | + // server-side means the first paint is already themed. Setting | |
| 48 | + // it from `applyDesktopTheme()` on boot would flash the default | |
| 49 | + // palette for a frame. Empty string when the user is on the | |
| 50 | + // system default (and nothing else about themes runs at all). | |
| 51 | + $desktop_theme = function_exists( 'openstation_active_desktop_theme_slug' ) | |
| 52 | + ? openstation_active_desktop_theme_slug() | |
| 53 | + : ''; | |
| 54 | + | |
| 55 | + // A shell asked to boot into overview (a switch from another site's | |
| 56 | + // switcher) arrives with its desk hidden until overview is up, so the | |
| 57 | + // desk slides in as one piece instead of the bare desk flashing first. | |
| 58 | + // See `src/multisite/instance-transition.ts`. | |
| 59 | + $arriving = openstation_shell_lands_in_overview() ? ' os-shell--arriving' : ''; | |
| 48 | 60 | ?> |
| 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' ); ?>"> | |
| 61 | + <div id="os-shell" class="os-shell<?php echo esc_attr( $arriving ); ?>" data-os-scheme="<?php echo esc_attr( $scheme ); ?>"<?php echo '' !== $desktop_theme ? ' data-os-desktop-theme="' . esc_attr( $desktop_theme ) . '"' : ''; ?> role="application" aria-label="<?php esc_attr_e( 'Desktop shell', 'desktop-mode' ); ?>"> | |
| 50 | 62 | <?php |
| 51 | 63 | /* |
| 52 | 64 | * Wallpaper layer — sits behind both the dock and the desktop |
| 53 | 65 | * area so a translucent dock bleeds through to the wallpaper |
| @@ -52,21 +64,30 @@ | ||
| 52 | 64 | * Wallpaper layer — sits behind both the dock and the desktop |
| 53 | 65 | * area so a translucent dock bleeds through to the wallpaper |
| 54 | 66 | * (macOS pattern). Canvas-driven wallpapers mount their own |
| 55 | 67 | * DOM into this element; static CSS wallpapers just inherit |
| 56 | - * the `--desktop-mode-bg` custom property the shell sets at | |
| 68 | + * the `--os-bg` custom property the shell sets at | |
| 57 | 69 | * boot. Presentational only. |
| 58 | 70 | */ |
| 59 | 71 | ?> |
| 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"> | |
| 72 | + <div id="os-wallpaper" class="os-wallpaper" aria-hidden="true"></div> | |
| 73 | + <div class="os-shell__body"> | |
| 74 | + <?php | |
| 75 | + /* | |
| 76 | + * `data-os-dock-behavior` is stamped here, not only by the | |
| 77 | + * shell's apply pass, so a `dynamic` dock is folded from the | |
| 78 | + * first paint instead of flashing on screen and folding once | |
| 79 | + * the JS lands. The Split layout's sidebar is synthesised by | |
| 80 | + * JS and stamped there. | |
| 81 | + */ | |
| 82 | + ?> | |
| 83 | + <nav id="os-dock" class="os-dock" role="toolbar" aria-label="<?php esc_attr_e( 'Admin navigation', 'desktop-mode' ); ?>" data-os-dock-behavior="<?php echo esc_attr( openstation_get_dock_behavior() ); ?>"></nav> | |
| 84 | + <div id="os-area" class="os-area os-area--with-dock os-area--booting"> | |
| 64 | 85 | <?php |
| 65 | 86 | /* |
| 66 | 87 | * Widget column — paints above the wallpaper but |
| 67 | 88 | * beneath windows (z-index 1 vs. windows at 100+). |
| 68 | - * Hosted INSIDE `.desktop-mode-area` so scrolling the | |
| 89 | + * Hosted INSIDE `.os-area` so scrolling the | |
| 69 | 90 | * area (not that we do today) would scroll widgets |
| 70 | 91 | * with it, and so the dock naturally frames |
| 71 | 92 | * it. Empty on first render — JS (`WidgetLayer`) |
| 72 | 93 | * populates it on boot. |
| @@ -71,9 +92,9 @@ | ||
| 71 | 92 | * it. Empty on first render — JS (`WidgetLayer`) |
| 72 | 93 | * populates it on boot. |
| 73 | 94 | */ |
| 74 | 95 | ?> |
| 75 | - <aside id="desktop-mode-widgets" class="desktop-mode-widgets" aria-label="<?php esc_attr_e( 'Widgets', 'desktop-mode' ); ?>"></aside> | |
| 96 | + <aside id="os-widgets" class="os-widgets" aria-label="<?php esc_attr_e( 'Widgets', 'desktop-mode' ); ?>"></aside> | |
| 76 | 97 | </div> |
| 77 | 98 | </div> |
| 78 | 99 | </div> |
| 79 | 100 | <?php |
| @@ -78,11 +99,9 @@ | ||
| 78 | 99 | </div> |
| 79 | 100 | <?php |
| 80 | 101 | /** |
| 81 | 102 | * Fires right after the desktop shell markup has rendered. |
| 82 | - * | |
| 83 | - * @since 0.1.0 | |
| 84 | 103 | */ |
| 85 | - do_action( 'desktop_mode_shell_after' ); | |
| 104 | + do_action( 'openstation_shell_after' ); | |
| 86 | 105 | } |
| 87 | -add_action( 'in_admin_header', 'desktop_mode_render_shell', 5 ); | |
| 106 | +add_action( 'in_admin_header', 'openstation_render_shell', 5 ); | |
| 88 | 107 | |