PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.12
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.12
1.1.12 1.1.11 1.1.10 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 All 36 releases
← All changes | includes/assets.php +245 -243 0.9.8 → 1.1.12 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 - * Desktop Mode asset registration.
3 + * OpenStation asset registration.
4 4 *
5 - * Registers all desktop-mode CSS and JS handles with WordPress so they can
5 + * Registers all openstation CSS and JS handles with WordPress so they can
6 6 * be enqueued from anywhere in the plugin (or by third parties).
7 7 *
8 - * @package WPDesktopMode
8 + * @package OpenStation
9 9 */
10 10
11 11 defined( 'ABSPATH' ) || exit;
12 12
@@ -20,10 +20,10 @@
20 20 * @param string $relative Stylesheet path relative to the plugin dir.
21 21 * @param string $fallback Version to use when the file is missing.
22 22 * @return string Version string.
23 23 */
24 -function desktop_mode_css_subtree_version( $relative, $fallback ) {
25 - $root = DESKTOP_MODE_DIR . $relative;
24 +function openstation_css_subtree_version( $relative, $fallback ) {
25 + $root = OPENSTATION_DIR . $relative;
26 26 if ( ! file_exists( $root ) ) {
27 27 return (string) $fallback;
28 28 }
29 29 $max = (int) filemtime( $root );
@@ -48,16 +48,16 @@
48 48 return (string) $max;
49 49 }
50 50
51 51 /**
52 - * Registers the desktop mode CSS and JS handles.
52 + * Registers the OpenStation CSS and JS handles.
53 53 */
54 -function desktop_mode_register_assets() {
55 - $version = DESKTOP_MODE_VERSION;
56 - $suffix = desktop_mode_asset_suffix();
54 +function openstation_register_assets() {
55 + $version = OPENSTATION_VERSION;
56 + $suffix = openstation_asset_suffix();
57 57
58 58 // `filemtime`-stamped version for built bundles. The plugin-wide
59 - // `DESKTOP_MODE_VERSION` is bumped per release, but the bundles
59 + // `OPENSTATION_VERSION` is bumped per release, but the bundles
60 60 // iterate faster — without a per-file mtime stamp, two clients
61 61 // loading the same `?ver=…` URL can be served different bytes
62 62 // (whichever build was on disk at upload time). Stamping with the
63 63 // file's modification time guarantees the URL changes whenever the
@@ -64,13 +64,12 @@
64 64 // file does, so "is my fix deployed?" is answerable from the
65 65 // network tab. Falls back to `$version` when the file is missing
66 66 // (test envs that import this file before the build runs).
67 67 $built_version = static function ( $relative ) use ( $version ) {
68 - $path = DESKTOP_MODE_DIR . $relative;
68 + $path = OPENSTATION_DIR . $relative;
69 69 return file_exists( $path ) ? (string) filemtime( $path ) : $version;
70 70 };
71 71
72 -
73 72 // Styles.
74 73 // `filemtime`-stamped, NOT the plugin-wide `$version`. This file
75 74 // is the token catalogue every other sheet resolves `var()`s
76 75 // against, and it changes whenever the palette does — which is a
@@ -78,35 +77,36 @@
78 77 // stamp the browser holds the old palette until a hard reload,
79 78 // and the symptom is maddening: a themed shell where some
80 79 // surfaces update and others don't.
81 80 wp_register_style(
82 - 'desktop-mode-variables',
83 - DESKTOP_MODE_URL . 'assets/css/variables.css',
81 + 'os-variables',
82 + OPENSTATION_URL . 'assets/css/variables.css',
84 83 array(),
85 84 $built_version( 'assets/css/variables.css' )
86 85 );
87 86 // `filemtime`-stamped so the `<link rel="stylesheet">` URL matches the
88 87 // `<link rel="preload" as="style">` hint emitted by
89 - // `desktop_mode_print_preload_hints()` (which stamps with filemtime).
88 + // `openstation_print_preload_hints()` (which stamps with filemtime).
90 89 // Registering this with the plain `$version` instead produced two
91 90 // different `?ver=` query strings for the same file, so the browser
92 91 // never matched the preload to the stylesheet and logged "preloaded
93 92 // but not used within a few seconds from the window's load event".
94 93 wp_register_style(
95 - 'desktop-mode',
96 - DESKTOP_MODE_URL . 'assets/css/desktop.css',
97 - array( 'desktop-mode-variables' ),
94 + 'openstation',
95 + OPENSTATION_URL . 'assets/css/desktop.css',
96 + array( 'os-variables' ),
98 97 $built_version( 'assets/css/desktop.css' )
99 98 );
99 +
100 100 /*
101 101 * Window styles — one handle per sheet, chained by dependency.
102 102 *
103 103 * These used to be `@import url( … )`ed from `windows.css` under
104 - * the single `desktop-mode-windows` handle. That was a standing
104 + * the single `os-windows` handle. That was a standing
105 105 * cache bug: an `@import` URL carries no `?ver=`, so a changed
106 106 * sub-sheet had no URL for the browser to invalidate. Stamping the
107 107 * PARENT with the subtree's max mtime (which is what
108 - * `desktop_mode_css_subtree_version()` was for) made the browser
108 + * `openstation_css_subtree_version()` was for) made the browser
109 109 * re-fetch `windows.css` and then request each sub-sheet at an
110 110 * unchanged URL — free to be served from its heuristic cache. The
111 111 * result was edits not landing until a hard refresh, and rules
112 112 * being relocated into `windows.css` purely to dodge it.
@@ -116,31 +116,32 @@
116 116 *
117 117 * THE DEPENDENCY CHAIN IS LOAD-BEARING. WordPress prints
118 118 * dependencies before dependents, so chaining each sheet to the
119 119 * previous one reproduces the order the `@import` block had, and
120 - * `desktop-mode-windows` (which depends on the last link) still
120 + * `os-windows` (which depends on the last link) still
121 121 * prints after them and still wins ties:
122 122 *
123 123 * window-chrome → window-states → effects → window-links
124 124 * → windows
125 125 *
126 - * `window-overview` and `os-settings` are deliberately NOT in this
127 - * chain — they are registered below, after `desktop-mode-windows`,
128 - * so they can load deferred. Adding a sheet here means splicing it
129 - * into the chain, not appending an unrelated dependency: order is
130 - * the contract.
126 + * `window-overview` is deliberately NOT in this chain — it is
127 + * registered below, after `os-windows`, so it can load deferred.
128 + * Adding a sheet here means splicing it into the chain, not
129 + * appending an unrelated dependency: order is the contract.
130 + * (The Preferences window's sheet is not here at all: it rides
131 + * the `apps/os-settings/` app as a first-open companion style.)
131 132 */
132 133 $window_sheets = array(
133 - 'desktop-mode-window-chrome' => 'assets/css/window-chrome.css',
134 - 'desktop-mode-window-states' => 'assets/css/window-states.css',
135 - 'desktop-mode-effects' => 'assets/css/effects.css',
136 - 'desktop-mode-window-links' => 'assets/css/window-links.css',
134 + 'os-window-chrome' => 'assets/css/window-chrome.css',
135 + 'os-window-states' => 'assets/css/window-states.css',
136 + 'os-effects' => 'assets/css/effects.css',
137 + 'os-window-links' => 'assets/css/window-links.css',
137 138 );
138 - $previous = array( 'desktop-mode-variables', 'dashicons' );
139 + $previous = array( 'os-variables', 'dashicons' );
139 140 foreach ( $window_sheets as $handle => $relative ) {
140 141 wp_register_style(
141 142 $handle,
142 - DESKTOP_MODE_URL . $relative,
143 + OPENSTATION_URL . $relative,
143 144 $previous,
144 145 $built_version( $relative )
145 146 );
146 147 $previous = array( $handle );
@@ -149,43 +150,90 @@
149 150 // Entry point. Depends on the tail of the chain above, so
150 151 // enqueuing this one handle still pulls in every critical window
151 152 // sheet — the behaviour callers had when they were `@import`s.
152 153 wp_register_style(
153 - 'desktop-mode-windows',
154 - DESKTOP_MODE_URL . 'assets/css/windows.css',
154 + 'os-windows',
155 + OPENSTATION_URL . 'assets/css/windows.css',
155 156 $previous,
156 157 $built_version( 'assets/css/windows.css' )
157 158 );
158 - // These two load DEFERRED (see `desktop_mode_defer_non_critical_styles()`):
159 - // the UI they style — the OS Settings panel and the window
160 - // overview — is lazy-loaded JS that can never be on screen at
161 - // first paint, so ~47 KB of CSS has no business blocking render.
162 - // They depend on `desktop-mode-windows` so they print after it,
163 - // preserving the cascade position they had as `@import`s.
159 + // Loads DEFERRED (see `openstation_defer_non_critical_styles()`):
160 + // the UI it styles — the window overview — is lazy-loaded JS that
161 + // can never be on screen at first paint, so its CSS has no
162 + // business blocking render. It depends on `os-windows` so it
163 + // prints after it, preserving the cascade position it had as an
164 + // `@import`.
164 165 wp_register_style(
165 - 'desktop-mode-window-overview',
166 - DESKTOP_MODE_URL . 'assets/css/window-overview.css',
167 - array( 'desktop-mode-windows' ),
166 + 'os-window-overview',
167 + OPENSTATION_URL . 'assets/css/window-overview.css',
168 + array( 'os-windows' ),
168 169 $built_version( 'assets/css/window-overview.css' )
169 170 );
171 + // Solo mode — one window, no desk around it. Loads last so it can
172 + // hide surfaces the sheets above declared, and only enqueues on a
173 + // solo request, so a normal shell never pays for it.
170 174 wp_register_style(
171 - 'desktop-mode-os-settings',
172 - DESKTOP_MODE_URL . 'assets/css/os-settings.css',
173 - array( 'desktop-mode-windows' ),
174 - $built_version( 'assets/css/os-settings.css' )
175 + 'os-solo',
176 + OPENSTATION_URL . 'assets/css/solo.css',
177 + array( 'os-windows' ),
178 + $built_version( 'assets/css/solo.css' )
175 179 );
176 180 wp_register_style(
177 - 'desktop-mode-dock',
178 - DESKTOP_MODE_URL . 'assets/css/dock.css',
179 - array( 'desktop-mode-variables', 'dashicons' ),
181 + 'os-dock',
182 + OPENSTATION_URL . 'assets/css/dock.css',
183 + array( 'os-variables', 'dashicons' ),
180 184 $built_version( 'assets/css/dock.css' )
181 185 );
182 186 wp_register_style(
183 - 'desktop-mode-dock-peek',
184 - DESKTOP_MODE_URL . 'assets/css/dock-peek.css',
185 - array( 'desktop-mode-dock' ),
187 + 'os-dock-peek',
188 + OPENSTATION_URL . 'assets/css/dock-peek.css',
189 + array( 'os-dock' ),
186 190 $built_version( 'assets/css/dock-peek.css' )
187 191 );
192 + // The phone layer. Every rule is scoped to
193 + // `html[data-os-mode="mobile"]`, so the sheet is inert on a
194 + // desktop and the first paint on a phone is already right (the
195 + // head stamp writes the attribute before any stylesheet applies).
196 + // Depends on the dock and window sheets because it overrides them.
197 + wp_register_style(
198 + 'os-mobile',
199 + OPENSTATION_URL . 'assets/css/mobile.css',
200 + array( 'os-variables', 'dashicons', 'os-dock', 'os-windows' ),
201 + $built_version( 'assets/css/mobile.css' )
202 + );
203 + // The workspace wizard. Scoped to `.os-workspace-wizard`, so it is
204 + // inert until the user opens it from the overview bar's `+` or a
205 + // tile's Edit. Those controls are styled with the rest of the bar
206 + // in `window-overview.css`.
207 + wp_register_style(
208 + 'os-workspaces',
209 + OPENSTATION_URL . 'assets/css/workspaces.css',
210 + array( 'os-variables', 'dashicons' ),
211 + $built_version( 'assets/css/workspaces.css' )
212 + );
213 + // Keyboard-shortcuts window. Scoped to `.os-shortcuts`, so it is
214 + // inert until the System menu opens the window, and unconditional
215 + // for the same reason the layout sheet is: the window can be
216 + // opened at any moment and a deferred sheet would paint it raw.
217 + wp_register_style(
218 + 'os-shortcuts',
219 + OPENSTATION_URL . 'assets/css/shortcuts.css',
220 + array( 'os-variables' ),
221 + $built_version( 'assets/css/shortcuts.css' )
222 + );
223 + // The OpenStation desktop layout — the core/plugin seam on the rail
224 + // plus the constellation hover-submenu flyout. Both surfaces are
225 + // scoped (`[data-os-layout="openstation"]` / `.os-constellation`),
226 + // so the sheet is inert in every other layout and is loaded
227 + // unconditionally rather than gated on the user's current pick:
228 + // the layout is switchable live from OpenStation Preferences, and a
229 + // conditional enqueue would leave the first switch unstyled.
230 + wp_register_style(
231 + 'os-openstation-layout',
232 + OPENSTATION_URL . 'assets/css/openstation-layout.css',
233 + array( 'os-dock' ),
234 + $built_version( 'assets/css/openstation-layout.css' )
235 + );
188 236 // `filemtime`-stamped — the chromeless overrides iterate faster
189 237 // than the plugin-wide version bumps (per-page compat shims and
190 238 // page-title-action exceptions land in patches), and a stale
191 239 // cached copy means the user sees yesterday's rules. Without the
@@ -191,11 +239,11 @@
191 239 // cached copy means the user sees yesterday's rules. Without the
192 240 // stamp, the browser keeps `?ver=0.8.1` valid for the whole
193 241 // release cycle.
194 242 wp_register_style(
195 - 'desktop-mode-chromeless',
196 - DESKTOP_MODE_URL . 'assets/css/chromeless.css',
197 - array( 'desktop-mode' ),
243 + 'os-chromeless',
244 + OPENSTATION_URL . 'assets/css/chromeless.css',
245 + array( 'openstation' ),
198 246 $built_version( 'assets/css/chromeless.css' )
199 247 );
200 248
201 249 // `filemtime`-stamped — the AI assistant surface (error states,
@@ -204,17 +252,17 @@
204 252 // valid for the whole release cycle and the user keeps seeing
205 253 // yesterday's CSS even after a hard reload.
206 254 wp_register_style(
207 255 'desktop-mode-ai-assistant',
208 - DESKTOP_MODE_URL . 'assets/css/ai-assistant.css',
209 - array( 'desktop-mode-variables' ),
256 + OPENSTATION_URL . 'assets/css/ai-assistant.css',
257 + array( 'os-variables' ),
210 258 $built_version( 'assets/css/ai-assistant.css' )
211 259 );
212 260
213 261 wp_register_style(
214 262 'desktop-mode-bug-report',
215 - DESKTOP_MODE_URL . 'assets/css/bug-report.css',
216 - array( 'desktop-mode-variables' ),
263 + OPENSTATION_URL . 'assets/css/bug-report.css',
264 + array( 'os-variables' ),
217 265 $built_version( 'assets/css/bug-report.css' )
218 266 );
219 267
220 268 // `filemtime` instead of the plugin-wide `$version` for the
@@ -219,55 +267,25 @@
219 267
220 268 // `filemtime` instead of the plugin-wide `$version` for the
221 269 // recycle-bin CSS — this file iterates faster than the bundle
222 270 // and we never want a stale CSS cache to mask a real fix.
223 - $recycle_bin_css = DESKTOP_MODE_DIR . 'assets/css/recycle-bin.css';
271 + $recycle_bin_css = OPENSTATION_DIR . 'assets/css/recycle-bin.css';
224 272 wp_register_style(
225 273 'desktop-mode-recycle-bin',
226 - DESKTOP_MODE_URL . 'assets/css/recycle-bin.css',
227 - array( 'desktop-mode-variables', 'dashicons' ),
274 + OPENSTATION_URL . 'assets/css/recycle-bin.css',
275 + array( 'os-variables', 'dashicons' ),
228 276 file_exists( $recycle_bin_css ) ? (string) filemtime( $recycle_bin_css ) : $version
229 277 );
230 278
231 - // `filemtime` for the native Posts window CSS — same rationale as
232 - // the recycle-bin CSS: bundle iterates faster than the plugin
233 - // version and stale caches are worse than the cost of a 304.
234 - $posts_window_css = DESKTOP_MODE_DIR . 'assets/css/posts-window.css';
235 - wp_register_style(
236 - 'desktop-mode-posts-window',
237 - DESKTOP_MODE_URL . 'assets/css/posts-window.css',
238 - array( 'desktop-mode-variables', 'dashicons' ),
239 - file_exists( $posts_window_css ) ? (string) filemtime( $posts_window_css ) : $version
240 - );
241 -
242 - // Native Plugins window CSS — same `filemtime`-cache-bust posture
243 - // as the Posts/Recycle Bin styles.
244 - $plugins_window_css = DESKTOP_MODE_DIR . 'assets/css/plugins-window.css';
245 - wp_register_style(
246 - 'desktop-mode-plugins-window',
247 - DESKTOP_MODE_URL . 'assets/css/plugins-window.css',
248 - array( 'desktop-mode-variables', 'dashicons' ),
249 - file_exists( $plugins_window_css ) ? (string) filemtime( $plugins_window_css ) : $version
250 - );
251 -
252 - // Native Comments window CSS — same `filemtime` posture.
253 - $comments_window_css = DESKTOP_MODE_DIR . 'assets/css/comments-window.css';
254 - wp_register_style(
255 - 'desktop-mode-comments-window',
256 - DESKTOP_MODE_URL . 'assets/css/comments-window.css',
257 - array( 'desktop-mode-variables', 'dashicons' ),
258 - file_exists( $comments_window_css ) ? (string) filemtime( $comments_window_css ) : $version
259 - );
260 -
261 279 // Files-on-the-Desktop tile + layer styles. `filemtime` for the
262 - // same reason as the recycle-bin / posts-window CSS: this file
280 + // same reason as the recycle-bin CSS: this file
263 281 // iterates faster than the plugin version, and a stale cache
264 282 // would mask a real fix.
265 - $desktop_files_css = DESKTOP_MODE_DIR . 'assets/css/desktop-files.css';
283 + $desktop_files_css = OPENSTATION_DIR . 'assets/css/desktop-files.css';
266 284 wp_register_style(
267 - 'desktop-mode-files',
268 - DESKTOP_MODE_URL . 'assets/css/desktop-files.css',
269 - array( 'desktop-mode-variables', 'dashicons' ),
285 + 'os-files',
286 + OPENSTATION_URL . 'assets/css/desktop-files.css',
287 + array( 'os-variables', 'dashicons' ),
270 288 file_exists( $desktop_files_css ) ? (string) filemtime( $desktop_files_css ) : $version
271 289 );
272 290
273 291 // Games hub window (launcher grid, scoreboard, challenges) +
@@ -272,41 +290,58 @@
272 290
273 291 // Games hub window (launcher grid, scoreboard, challenges) +
274 292 // per-game styles. Same `filemtime` cache-bust posture as the
275 293 // other fast-iterating feature stylesheets.
276 - $games_css = DESKTOP_MODE_DIR . 'assets/css/games.css';
294 + $games_css = OPENSTATION_DIR . 'assets/css/games.css';
277 295 wp_register_style(
278 296 'desktop-mode-games',
279 - DESKTOP_MODE_URL . 'assets/css/games.css',
280 - array( 'desktop-mode-variables', 'dashicons' ),
297 + OPENSTATION_URL . 'assets/css/games.css',
298 + array( 'os-variables', 'dashicons' ),
281 299 file_exists( $games_css ) ? (string) filemtime( $games_css ) : $version
282 300 );
283 - $game_inkfall_css = DESKTOP_MODE_DIR . 'assets/css/game-inkfall.css';
301 + $game_inkfall_css = OPENSTATION_DIR . 'assets/css/game-inkfall.css';
284 302 wp_register_style(
285 - 'desktop-mode-game-inkfall',
286 - DESKTOP_MODE_URL . 'assets/css/game-inkfall.css',
287 - array( 'desktop-mode-variables' ),
303 + 'os-game-inkfall',
304 + OPENSTATION_URL . 'assets/css/game-inkfall.css',
305 + array( 'os-variables' ),
288 306 file_exists( $game_inkfall_css ) ? (string) filemtime( $game_inkfall_css ) : $version
289 307 );
290 - $game_alphabet_soup_css = DESKTOP_MODE_DIR . 'assets/css/game-alphabet-soup.css';
308 + $game_alphabet_soup_css = OPENSTATION_DIR . 'assets/css/game-alphabet-soup.css';
291 309 wp_register_style(
292 - 'desktop-mode-game-alphabet-soup',
293 - DESKTOP_MODE_URL . 'assets/css/game-alphabet-soup.css',
294 - array( 'desktop-mode-variables' ),
310 + 'os-game-alphabet-soup',
311 + OPENSTATION_URL . 'assets/css/game-alphabet-soup.css',
312 + array( 'os-variables' ),
295 313 file_exists( $game_alphabet_soup_css ) ? (string) filemtime( $game_alphabet_soup_css ) : $version
296 314 );
297 315
298 316 // Pinned-notes layer styles (paper, pushpin, pastel tokens, pin
299 317 // animations). Same `filemtime` cache-bust posture as the other
300 - // fast-iterating feature stylesheets above.
301 - $notes_css = DESKTOP_MODE_DIR . 'assets/css/notes.css';
318 + // fast-iterating feature stylesheets above. Depends on `os-files`
319 + // because a pinned note dresses the canonical `.os-file-tile`
320 + // chrome — anything that restyles a tile has to print after the
321 + // file that declares one.
322 + $notes_css = OPENSTATION_DIR . 'assets/css/notes.css';
302 323 wp_register_style(
303 - 'desktop-mode-notes',
304 - DESKTOP_MODE_URL . 'assets/css/notes.css',
305 - array( 'desktop-mode-variables', 'dashicons' ),
324 + 'os-notes',
325 + OPENSTATION_URL . 'assets/css/notes.css',
326 + array( 'os-variables', 'dashicons', 'os-files' ),
306 327 file_exists( $notes_css ) ? (string) filemtime( $notes_css ) : $version
307 328 );
308 329
330 + // Announcement-dialog styles (scrim, hero card, buttons). Registered
331 + // always, enqueued only for a user who is actually owed the
332 + // announcement — see the gate in `openstation_enqueue_assets()`. It
333 + // is not lazy-loaded on top of that: on the one boot where it does
334 + // go out, the dialog opens from the main bundle a second later, and
335 + // a fetch racing that would show an unstyled card.
336 + $announce_css = OPENSTATION_DIR . 'assets/css/announce.css';
337 + wp_register_style(
338 + 'os-announce',
339 + OPENSTATION_URL . 'assets/css/announce.css',
340 + array( 'os-variables' ),
341 + file_exists( $announce_css ) ? (string) filemtime( $announce_css ) : $version
342 + );
343 +
309 344 // Scripts.
310 345 //
311 346 // `wp-hooks` — the shell exposes a WordPress-style filter/action
312 347 // API (`window.wp.hooks`) to third-party plugins.
@@ -315,10 +350,10 @@
315 350 // lookups. Both handles are core-shipped but only pre-enqueued
316 351 // when Gutenberg-adjacent deps pull them in, so we list them
317 352 // explicitly to guarantee load order.
318 353 wp_register_script(
319 - 'desktop-mode',
320 - DESKTOP_MODE_URL . 'assets/js/desktop' . $suffix . '.js',
354 + 'openstation',
355 + OPENSTATION_URL . 'assets/js/desktop' . $suffix . '.js',
321 356 // `heartbeat` + `jquery` — the recycle-bin badge module
322 357 // (loaded as part of this bundle) opts into the WordPress
323 358 // Heartbeat API so the count tile / desktop-icon badge
324 359 // stays in sync even when the bin window is closed.
@@ -326,9 +361,9 @@
326 361 $built_version( 'assets/js/desktop' . $suffix . '.js' ),
327 362 // Footer + defer: the shell boots on DOMContentLoaded anyway,
328 363 // so deferring frees the parser instead of blocking at the
329 364 // footer print point. Both inline payloads attached to this
330 - // handle (`__desktopModeMenuCommands`, the jazz-quote version
365 + // handle (`__openStationMenuCommands`, the jazz-quote version
331 366 // stamp) are `'before'`-position, which WP keeps as blocking
332 367 // inline ahead of a deferred tag — order is preserved. On WP
333 368 // < 6.3 the array collapses to a truthy `$in_footer`, same as
334 369 // before.
@@ -337,10 +372,10 @@
337 372 'strategy' => 'defer',
338 373 )
339 374 );
340 375
341 - // `desktop-mode-iframe-bridge` — opt-in iframe-side bridge that
342 - // provides `wp.desktop.iframe.publish/subscribe/onConnection/
376 + // `os-iframe-bridge` — opt-in iframe-side bridge that
377 + // provides `wp.os.iframe.publish/subscribe/onConnection/
343 378 // requestConnection` to any same-origin iframe that enqueues it.
344 379 // Same code is also injected inline by the chromeless bridge
345 380 // (so chromeless wp-admin pages don't need a separate enqueue)
346 381 // and auto-injected when a native window opts in via
@@ -346,19 +381,60 @@
346 381 // and auto-injected when a native window opts in via
347 382 // `iframeContent: { bridge: true }`. Plugins targeting their
348 383 // own iframe pages just enqueue this handle.
349 384 wp_register_script(
350 - 'desktop-mode-iframe-bridge',
351 - DESKTOP_MODE_URL . 'assets/js/iframe-bridge' . $suffix . '.js',
385 + 'os-iframe-bridge',
386 + OPENSTATION_URL . 'assets/js/iframe-bridge' . $suffix . '.js',
352 387 array(),
353 388 $built_version( 'assets/js/iframe-bridge' . $suffix . '.js' ),
354 389 true
355 390 );
356 391
357 - // `desktop-mode-gutenberg-drop-receiver` — iframe-side bundle
392 + // `os-deactivation-feedback` — the dialog that asks one optional
393 + // question when an admin deactivates OpenStation. Enqueued on
394 + // `plugins.php` (classic, chromeless and network admin) by
395 + // `includes/feedback/deactivation.php`, and lazy-loaded by the
396 + // native Plugins app from its config block. Plain DOM on purpose:
397 + // the classic screen has no `<os-*>` kit.
398 + wp_register_script(
399 + 'os-deactivation-feedback',
400 + OPENSTATION_URL . 'assets/js/deactivation-feedback' . $suffix . '.js',
401 + array( 'wp-i18n' ),
402 + $built_version( 'assets/js/deactivation-feedback' . $suffix . '.js' ),
403 + true
404 + );
405 + wp_set_script_translations(
406 + 'os-deactivation-feedback',
407 + 'desktop-mode',
408 + OPENSTATION_DIR . 'languages'
409 + );
410 + $feedback_css = OPENSTATION_DIR . 'assets/css/deactivation-feedback.css';
411 + wp_register_style(
412 + 'os-deactivation-feedback',
413 + OPENSTATION_URL . 'assets/css/deactivation-feedback.css',
414 + array(),
415 + file_exists( $feedback_css ) ? (string) filemtime( $feedback_css ) : $version
416 + );
417 +
418 + // `os-chromeless-bridge` — the iframe side of every window,
419 + // enqueued on `admin_footer` by
420 + // `openstation_chromeless_bridge_script()` with its per-request
421 + // data attached as a `before` inline block. Registered here (not
422 + // there) so the handle exists before the enqueue and so the asset
423 + // guard's OPENSTATION_URL snapshot protects it like every other
424 + // bundle of ours.
425 + wp_register_script(
426 + 'os-chromeless-bridge',
427 + OPENSTATION_URL . 'assets/js/chromeless-bridge' . $suffix . '.js',
428 + array(),
429 + $built_version( 'assets/js/chromeless-bridge' . $suffix . '.js' ),
430 + true
431 + );
432 +
433 + // `os-gutenberg-drop-receiver` — iframe-side bundle
358 434 // enqueued only on the Block Editor screens (`post.php` /
359 - // `post-new.php`) for desktop-mode users. Listens for
360 - // `desktop-mode-drop` postMessages from the parent shell (see
435 + // `post-new.php`) for openstation users. Listens for
436 + // `os-drop` postMessages from the parent shell (see
361 437 // `src/drag/iframe-drop-targets.ts`) and inserts the matching
362 438 // Gutenberg block via `wp.data.dispatch('core/block-editor')`.
363 439 // Depends on `wp-blocks` + `wp-data` so the editor stores are
364 440 // guaranteed enqueued before the receiver runs its first message
@@ -363,49 +439,32 @@
363 439 // Depends on `wp-blocks` + `wp-data` so the editor stores are
364 440 // guaranteed enqueued before the receiver runs its first message
365 441 // handler.
366 442 wp_register_script(
367 - 'desktop-mode-gutenberg-drop-receiver',
368 - DESKTOP_MODE_URL . 'assets/js/gutenberg-drop-receiver' . $suffix . '.js',
443 + 'os-gutenberg-drop-receiver',
444 + OPENSTATION_URL . 'assets/js/gutenberg-drop-receiver' . $suffix . '.js',
369 445 array( 'wp-blocks', 'wp-data' ),
370 446 $built_version( 'assets/js/gutenberg-drop-receiver' . $suffix . '.js' ),
371 447 true
372 448 );
373 449
374 - // `desktop-mode-recycle-bin` — small bundle for the Recycle Bin
375 - // native window. Lazy-loaded by the native-window sync the first
376 - // time the bin opens; registers a render callback on
377 - // `window.desktopModeNativeWindows['desktop-mode-recycle-bin']`.
378 - $recycle_bin_js = DESKTOP_MODE_DIR . 'assets/js/recycle-bin' . $suffix . '.js';
379 - wp_register_script(
380 - 'desktop-mode-recycle-bin',
381 - DESKTOP_MODE_URL . 'assets/js/recycle-bin' . $suffix . '.js',
382 - // `heartbeat` + `jquery` — the bin opts in to the WordPress
383 - // Heartbeat API while its window is open as the catch-all
384 - // real-time channel for deletes that don't render an admin
385 - // footer (REST/AJAX/other tabs/WP-CLI). See
386 - // `src/recycle-bin/realtime.ts` for the subscriber.
387 - array( 'wp-i18n', 'heartbeat', 'jquery' ),
388 - file_exists( $recycle_bin_js ) ? (string) filemtime( $recycle_bin_js ) : $version,
389 - true
390 - );
391 - wp_set_script_translations(
392 - 'desktop-mode-recycle-bin',
393 - 'desktop-mode',
394 - DESKTOP_MODE_DIR . 'languages'
395 - );
450 + // The Recycle Bin window is an App Framework app (`apps/trash/`);
451 + // its client view rides the app-bundle pipeline, so no dedicated
452 + // script handle. The `desktop-mode-recycle-bin` STYLE handle above
453 + // stays — the drag-to-trash drop-target highlight must be present
454 + // at boot (dropping on the closed bin's dock tile), not window-open.
396 455
397 456 // `desktop-mode-games` — bundle for the Games hub native window
398 457 // (launcher grid, scoreboard, challenges client). Lazy-loaded by
399 458 // the native-window sync the first time the hub opens; registers a
400 459 // render callback on
401 - // `window.desktopModeNativeWindows['desktop-mode-games']`.
460 + // `window.openStationNativeWindows['desktop-mode-games']`.
402 461 // `heartbeat` + `jquery` — the challenges client rides the
403 462 // WordPress Heartbeat bus for live delivery.
404 - $games_js = DESKTOP_MODE_DIR . 'assets/js/games' . $suffix . '.js';
463 + $games_js = OPENSTATION_DIR . 'assets/js/games' . $suffix . '.js';
405 464 wp_register_script(
406 465 'desktop-mode-games',
407 - DESKTOP_MODE_URL . 'assets/js/games' . $suffix . '.js',
466 + OPENSTATION_URL . 'assets/js/games' . $suffix . '.js',
408 467 array( 'wp-i18n', 'heartbeat', 'jquery' ),
409 468 file_exists( $games_js ) ? (string) filemtime( $games_js ) : $version,
410 469 true
411 470 );
@@ -411,120 +470,63 @@
411 470 );
412 471 wp_set_script_translations(
413 472 'desktop-mode-games',
414 473 'desktop-mode',
415 - DESKTOP_MODE_DIR . 'languages'
474 + OPENSTATION_DIR . 'languages'
416 475 );
417 476
418 - // `desktop-mode-game-inkfall` — the Inkfall game bundle. Loaded
477 + // `os-game-inkfall` — the Inkfall game bundle. Loaded
419 478 // lazily by the games framework on first launch; publishes the
420 - // game def on `window.desktopModeGames.inkfall`.
421 - $game_inkfall_js = DESKTOP_MODE_DIR . 'assets/js/game-inkfall' . $suffix . '.js';
479 + // game def on `window.openStationGames.inkfall`.
480 + $game_inkfall_js = OPENSTATION_DIR . 'assets/js/game-inkfall' . $suffix . '.js';
422 481 wp_register_script(
423 - 'desktop-mode-game-inkfall',
424 - DESKTOP_MODE_URL . 'assets/js/game-inkfall' . $suffix . '.js',
482 + 'os-game-inkfall',
483 + OPENSTATION_URL . 'assets/js/game-inkfall' . $suffix . '.js',
425 484 array( 'wp-i18n' ),
426 485 file_exists( $game_inkfall_js ) ? (string) filemtime( $game_inkfall_js ) : $version,
427 486 true
428 487 );
429 488 wp_set_script_translations(
430 - 'desktop-mode-game-inkfall',
489 + 'os-game-inkfall',
431 490 'desktop-mode',
432 - DESKTOP_MODE_DIR . 'languages'
491 + OPENSTATION_DIR . 'languages'
433 492 );
434 493
435 - // `desktop-mode-game-alphabet-soup` — the Alphabet Soup game
494 + // `os-game-alphabet-soup` — the Alphabet Soup game
436 495 // bundle. Loaded lazily by the games framework on first launch;
437 496 // publishes the game def on
438 - // `window.desktopModeGames['alphabet-soup']`.
439 - $game_alphabet_soup_js = DESKTOP_MODE_DIR . 'assets/js/game-alphabet-soup' . $suffix . '.js';
497 + // `window.openStationGames['alphabet-soup']`.
498 + $game_alphabet_soup_js = OPENSTATION_DIR . 'assets/js/game-alphabet-soup' . $suffix . '.js';
440 499 wp_register_script(
441 - 'desktop-mode-game-alphabet-soup',
442 - DESKTOP_MODE_URL . 'assets/js/game-alphabet-soup' . $suffix . '.js',
500 + 'os-game-alphabet-soup',
501 + OPENSTATION_URL . 'assets/js/game-alphabet-soup' . $suffix . '.js',
443 502 array( 'wp-i18n' ),
444 503 file_exists( $game_alphabet_soup_js ) ? (string) filemtime( $game_alphabet_soup_js ) : $version,
445 504 true
446 505 );
447 506 wp_set_script_translations(
448 - 'desktop-mode-game-alphabet-soup',
507 + 'os-game-alphabet-soup',
449 508 'desktop-mode',
450 - DESKTOP_MODE_DIR . 'languages'
509 + OPENSTATION_DIR . 'languages'
451 510 );
452 511
453 - // `desktop-mode-posts-window` — small bundle for the native Posts
454 - // window. Lazy-loaded by the native-window sync the first time the
455 - // window opens (via the dock-click swap when the user opts in);
456 - // registers a render callback on
457 - // `window.desktopModeNativeWindows['desktop-mode-posts']`.
458 - $posts_window_js = DESKTOP_MODE_DIR . 'assets/js/posts-window' . $suffix . '.js';
459 - wp_register_script(
460 - 'desktop-mode-posts-window',
461 - DESKTOP_MODE_URL . 'assets/js/posts-window' . $suffix . '.js',
462 - array( 'wp-i18n' ),
463 - file_exists( $posts_window_js ) ? (string) filemtime( $posts_window_js ) : $version,
464 - true
465 - );
466 - wp_set_script_translations(
467 - 'desktop-mode-posts-window',
468 - 'desktop-mode',
469 - DESKTOP_MODE_DIR . 'languages'
470 - );
471 -
472 - // `desktop-mode-plugins-window` — small bundle for the native
473 - // Plugins window. Lazy-loaded by the native-window sync the first
474 - // time the window opens (via the dock-click swap when the user
475 - // opts in); registers a render callback on
476 - // `window.desktopModeNativeWindows['desktop-mode-plugins']`.
477 - $plugins_window_js = DESKTOP_MODE_DIR . 'assets/js/plugins-window' . $suffix . '.js';
478 - wp_register_script(
479 - 'desktop-mode-plugins-window',
480 - DESKTOP_MODE_URL . 'assets/js/plugins-window' . $suffix . '.js',
481 - array( 'wp-i18n' ),
482 - file_exists( $plugins_window_js ) ? (string) filemtime( $plugins_window_js ) : $version,
483 - true
484 - );
485 - wp_set_script_translations(
486 - 'desktop-mode-plugins-window',
487 - 'desktop-mode',
488 - DESKTOP_MODE_DIR . 'languages'
489 - );
490 -
491 - // `desktop-mode-comments-window` — small bundle for the native
492 - // Comments window. Lazy-loaded by the native-window sync the first
493 - // time the window opens (via the dock-click swap when the user
494 - // opts in); registers a render callback on
495 - // `window.desktopModeNativeWindows['desktop-mode-comments']`.
496 - $comments_window_js = DESKTOP_MODE_DIR . 'assets/js/comments-window' . $suffix . '.js';
497 - wp_register_script(
498 - 'desktop-mode-comments-window',
499 - DESKTOP_MODE_URL . 'assets/js/comments-window' . $suffix . '.js',
500 - array( 'wp-i18n' ),
501 - file_exists( $comments_window_js ) ? (string) filemtime( $comments_window_js ) : $version,
502 - true
503 - );
504 - wp_set_script_translations(
505 - 'desktop-mode-comments-window',
506 - 'desktop-mode',
507 - DESKTOP_MODE_DIR . 'languages'
508 - );
509 -
510 - // `desktop-mode-animated-logo-wallpaper` — built-in PixiJS canvas
512 + // `os-animated-logo-wallpaper` — built-in PixiJS canvas
511 513 // wallpaper, moved out of `desktop.min.js`. The wallpaper
512 514 // `server-sync` loads this handle when the user selects the
513 515 // `wp-animated-logo` wallpaper (or opens OS Settings → Wallpaper
514 516 // and the picker pulls every registered canvas def in). The
515 517 // bundle's only side effect is publishing the `WallpaperDef` on
516 - // `window.desktopModeWallpapers['wp-animated-logo']`.
517 - $animated_logo_js = DESKTOP_MODE_DIR . 'assets/js/animated-logo-wallpaper' . $suffix . '.js';
518 + // `window.openStationWallpapers['wp-animated-logo']`.
519 + $animated_logo_js = OPENSTATION_DIR . 'assets/js/animated-logo-wallpaper' . $suffix . '.js';
518 520 wp_register_script(
519 - 'desktop-mode-animated-logo-wallpaper',
520 - DESKTOP_MODE_URL . 'assets/js/animated-logo-wallpaper' . $suffix . '.js',
521 + 'os-animated-logo-wallpaper',
522 + OPENSTATION_URL . 'assets/js/animated-logo-wallpaper' . $suffix . '.js',
521 523 array( 'wp-hooks' ),
522 524 file_exists( $animated_logo_js ) ? (string) filemtime( $animated_logo_js ) : $version,
523 525 true
524 526 );
525 527
526 - // `desktop-mode-snow-wallpaper` — built-in PixiJS canvas
528 + // `os-snow-wallpaper` — built-in PixiJS canvas
527 529 // wallpaper: snowfall that accumulates on window tops and melts
528 530 // away. Same lazy-load path as the animated logo: the wallpaper
529 531 // `server-sync` injects this handle when the user selects the
530 532 // `wp-snow` wallpaper (or opens OS Settings → Wallpaper and the
@@ -529,32 +531,32 @@
529 531 // `server-sync` injects this handle when the user selects the
530 532 // `wp-snow` wallpaper (or opens OS Settings → Wallpaper and the
531 533 // picker pulls the def in). The bundle's only side effect is
532 534 // publishing the `WallpaperDef` on
533 - // `window.desktopModeWallpapers['wp-snow']`.
534 - $snow_js = DESKTOP_MODE_DIR . 'assets/js/snow-wallpaper' . $suffix . '.js';
535 + // `window.openStationWallpapers['wp-snow']`.
536 + $snow_js = OPENSTATION_DIR . 'assets/js/snow-wallpaper' . $suffix . '.js';
535 537 wp_register_script(
536 - 'desktop-mode-snow-wallpaper',
537 - DESKTOP_MODE_URL . 'assets/js/snow-wallpaper' . $suffix . '.js',
538 + 'os-snow-wallpaper',
539 + OPENSTATION_URL . 'assets/js/snow-wallpaper' . $suffix . '.js',
538 540 array( 'wp-hooks', 'wp-i18n' ),
539 541 file_exists( $snow_js ) ? (string) filemtime( $snow_js ) : $version,
540 542 true
541 543 );
542 544 wp_set_script_translations(
543 - 'desktop-mode-snow-wallpaper',
545 + 'os-snow-wallpaper',
544 546 'desktop-mode',
545 - DESKTOP_MODE_DIR . 'languages'
547 + OPENSTATION_DIR . 'languages'
546 548 );
547 549
548 550 // `desktop-mode-ai-assistant` — AI Copilot spotlight overlay,
549 551 // moved out of `desktop.min.js`. The main bundle ships a
550 - // stub matching the public `wp.desktop.ai` contract; the stub
552 + // stub matching the public `wp.os.ai` contract; the stub
551 553 // `<script>`-injects this handle the first time the user opens
552 554 // the assistant (Cmd+K or admin-bar button).
553 - $ai_assistant_js = DESKTOP_MODE_DIR . 'assets/js/ai-assistant' . $suffix . '.js';
555 + $ai_assistant_js = OPENSTATION_DIR . 'assets/js/ai-assistant' . $suffix . '.js';
554 556 wp_register_script(
555 557 'desktop-mode-ai-assistant',
556 - DESKTOP_MODE_URL . 'assets/js/ai-assistant' . $suffix . '.js',
558 + OPENSTATION_URL . 'assets/js/ai-assistant' . $suffix . '.js',
557 559 array( 'wp-hooks', 'wp-i18n' ),
558 560 file_exists( $ai_assistant_js ) ? (string) filemtime( $ai_assistant_js ) : $version,
559 561 true
560 562 );
@@ -560,19 +562,19 @@
560 562 );
561 563 wp_set_script_translations(
562 564 'desktop-mode-ai-assistant',
563 565 'desktop-mode',
564 - DESKTOP_MODE_DIR . 'languages'
566 + OPENSTATION_DIR . 'languages'
565 567 );
566 568
567 569 // Wire the translation bundle to this script handle. WP looks
568 - // for `languages/desktop-mode-{locale}-desktop-mode.json` and
570 + // for `languages/os-{locale}-os.json` and
569 571 // injects its `locale_data` into `wp.i18n` just before the
570 572 // script runs — so every `__()` call resolves to the right
571 573 // language without any runtime fetch.
572 574 wp_set_script_translations(
575 + 'openstation',
573 576 'desktop-mode',
574 - 'desktop-mode',
575 - DESKTOP_MODE_DIR . 'languages'
577 + OPENSTATION_DIR . 'languages'
576 578 );
577 579 }
578 -add_action( 'init', 'desktop_mode_register_assets' );
580 +add_action( 'init', 'openstation_register_assets' );