PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.8
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.8
1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 0.8.6 All 33 releases
desktop-mode / includes / render / shell.php

shell.php in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.8, at includes/render/shell.php

108 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * OpenStation — Shell markup injection.
4 *
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.
10 *
11 * Extracted from `render.php` during the architecture-0.8.1 PHP
12 * slicing (phase 6).
13 *
14 * @package OpenStation
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.os-active`
27 * selectors.
28 */
29 function openstation_render_shell() {
30 if ( ! openstation_is_shell_request() ) {
31 return;
32 }
33
34 /**
35 * Fires right before the desktop shell markup is rendered.
36 */
37 do_action( 'openstation_shell_before' );
38
39 // Stamp the user's admin color scheme onto the shell root so the
40 // variables.css per-scheme selectors kick in before first paint —
41 // doing this from JS on init() would show the default palette for a
42 // frame before swapping.
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' : '';
60 ?>
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' ); ?>">
62 <?php
63 /*
64 * Wallpaper layer — sits behind both the dock and the desktop
65 * area so a translucent dock bleeds through to the wallpaper
66 * (macOS pattern). Canvas-driven wallpapers mount their own
67 * DOM into this element; static CSS wallpapers just inherit
68 * the `--os-bg` custom property the shell sets at
69 * boot. Presentational only.
70 */
71 ?>
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">
85 <?php
86 /*
87 * Widget column — paints above the wallpaper but
88 * beneath windows (z-index 1 vs. windows at 100+).
89 * Hosted INSIDE `.os-area` so scrolling the
90 * area (not that we do today) would scroll widgets
91 * with it, and so the dock naturally frames
92 * it. Empty on first render — JS (`WidgetLayer`)
93 * populates it on boot.
94 */
95 ?>
96 <aside id="os-widgets" class="os-widgets" aria-label="<?php esc_attr_e( 'Widgets', 'desktop-mode' ); ?>"></aside>
97 </div>
98 </div>
99 </div>
100 <?php
101 /**
102 * Fires right after the desktop shell markup has rendered.
103 */
104 do_action( 'openstation_shell_after' );
105 }
106 add_action( 'in_admin_header', 'openstation_render_shell', 5 );
107
108