| @@ -250,8 +250,11 @@ | ||
| 250 | 250 | 'scriptBefore' => $payload['before'], |
| 251 | 251 | 'scriptAfter' => $payload['after'], |
| 252 | 252 | 'scriptL10n' => $payload['l10n'], |
| 253 | 253 | 'scriptTranslations' => $payload['translations'], |
| 254 | + // The handle's dependency closure, replayed before the bundle | |
| 255 | + // on its lazy load — see `openstation_resolve_script_dependencies()`. | |
| 256 | + 'scriptDeps' => openstation_resolve_script_dependencies( $handle ), | |
| 254 | 257 | ); |
| 255 | 258 | } |
| 256 | 259 | return $out; |
| 257 | 260 | } |
| @@ -256,24 +259,23 @@ | ||
| 256 | 259 | return $out; |
| 257 | 260 | } |
| 258 | 261 | |
| 259 | 262 | |
| 260 | -/** | |
| 261 | - * Enqueue plugin-registered wallpaper scripts on the shell page | |
| 262 | - * so wallpapers active at boot time have their defs available | |
| 263 | - * without any dynamic-load roundtrip. | |
| 263 | +/* | |
| 264 | + * Wallpaper scripts are NOT enqueued here, and that is deliberate. | |
| 265 | + * | |
| 266 | + * A canvas wallpaper's bundle IS the wallpaper — Living Tree is 58 KB | |
| 267 | + * of PixiJS scene, Snow is 42 KB — and this file used to | |
| 268 | + * `wp_enqueue_script()` every registered one on every admin page, so | |
| 269 | + * that every user downloaded and parsed every wallpaper in the | |
| 270 | + * install including the ones they were not wearing. The metadata in | |
| 271 | + * the boot payload (label, preview swatch, description) is enough for | |
| 272 | + * the shell to register a stub and paint a picker tile without any of | |
| 273 | + * it. | |
| 274 | + * | |
| 275 | + * The bundle arrives when something needs the callbacks: the shell | |
| 276 | + * hydrates the user's ACTIVE wallpaper during the boot sync, and the | |
| 277 | + * wallpaper picker hydrates the rest when it opens. See | |
| 278 | + * `src/wallpapers/lazy.ts`. `scriptUrl` in the payload (built above) | |
| 279 | + * is what makes that possible; nothing else on the PHP side is | |
| 280 | + * involved. | |
| 264 | 281 | */ |
| 265 | -function openstation_enqueue_desktop_wallpaper_scripts() { | |
| 266 | - if ( ! openstation_is_enabled() || openstation_is_chromeless_request() || openstation_is_classic_request() ) { | |
| 267 | - return; | |
| 268 | - } | |
| 269 | - $registry = openstation_desktop_wallpaper_registry(); | |
| 270 | - if ( ! is_array( $registry ) ) { | |
| 271 | - return; | |
| 272 | - } | |
| 273 | - foreach ( $registry as $entry ) { | |
| 274 | - if ( ! empty( $entry['script'] ) ) { | |
| 275 | - wp_enqueue_script( $entry['script'] ); | |
| 276 | - } | |
| 277 | - } | |
| 278 | -} | |
| 279 | -add_action( 'admin_enqueue_scripts', 'openstation_enqueue_desktop_wallpaper_scripts', 20 ); | |