| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Desktop Mode — Built-in wallpaper presets. | |
| 3 | + * OpenStation — Built-in wallpaper presets. | |
| 4 | 4 | * |
| 5 | 5 | * The built-in wallpapers that ship with the plugin — five gradient / |
| 6 | 6 | * solid CSS presets plus the Animated WordPress Logo canvas wallpaper — |
| 7 | 7 | * each registered through the same public API third-party plugins use |
| 8 | - * (`desktop_mode_register_wallpaper()`). Dogfooding the registration | |
| 8 | + * (`openstation_register_wallpaper()`). Dogfooding the registration | |
| 9 | 9 | * surface for the built-ins is how we discover whether the API is |
| 10 | 10 | * expressive enough for plugin authors — if we couldn't describe our |
| 11 | 11 | * own presets through it, the API is broken. |
| 12 | 12 | * |
| @@ -13,12 +13,11 @@ | ||
| 13 | 13 | * Hooked on `init` priority 5 so the presets land in the registry |
| 14 | 14 | * before the shell config is built (shell render runs on |
| 15 | 15 | * `admin_enqueue_scripts`, which fires after `init`), and before any |
| 16 | 16 | * late third-party plugin that wants to react via the |
| 17 | - * `desktop_mode_wallpaper_registered` action. | |
| 17 | + * `openstation_wallpaper_registered` action. | |
| 18 | 18 | * |
| 19 | - * @package WPDesktopMode | |
| 20 | - * @since 0.5.0 | |
| 19 | + * @package OpenStation | |
| 21 | 20 | */ |
| 22 | 21 | |
| 23 | 22 | defined( 'ABSPATH' ) || exit; |
| 24 | 23 | |
| @@ -24,12 +23,67 @@ | ||
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * Registers the built-in wallpapers: five gradient / solid CSS presets |
| 27 | 26 | * plus the Animated WordPress Logo canvas wallpaper. |
| 28 | - * | |
| 29 | - * @since 0.5.0 | |
| 30 | 27 | */ |
| 31 | -function desktop_mode_register_builtin_wallpapers() { | |
| 28 | +function openstation_register_builtin_wallpapers() { | |
| 29 | + /* | |
| 30 | + * The four brand surfaces, straight from the OpenStation brand | |
| 31 | + * guidelines. Registered as `css` wallpapers pointing at the | |
| 32 | + * vector artwork the plugin ships: an SVG scales to any desk at | |
| 33 | + * any DPI for a few kilobytes, which no raster wallpaper can do. | |
| 34 | + * | |
| 35 | + * `cover` on a 3:2 artboard, `center` so the composition's focal | |
| 36 | + * point survives a crop on either axis, `fixed` so the desk does | |
| 37 | + * not shift under a window drag. | |
| 38 | + * | |
| 39 | + * Galaxy is the default desk — see the `wallpaper` default in | |
| 40 | + * `openstation_default_os_settings()`. | |
| 41 | + */ | |
| 42 | + $brand = array( | |
| 43 | + array( | |
| 44 | + 'id' => 'galaxy', | |
| 45 | + 'label' => __( 'Galaxy', 'desktop-mode' ), | |
| 46 | + 'file' => 'galaxy.svg', | |
| 47 | + 'description' => __( 'The station seen from outside: a Void sky with soft Nebula glows and a Starlight starfield drifting through it.', 'desktop-mode' ), | |
| 48 | + ), | |
| 49 | + array( | |
| 50 | + 'id' => 'space', | |
| 51 | + 'label' => __( 'Space', 'desktop-mode' ), | |
| 52 | + 'file' => 'space.svg', | |
| 53 | + 'description' => __( 'Deep space, quietly. One long gradient from near-black to a faint violet horizon — the calmest desk in the set, and the one that asks least of your eyes.', 'desktop-mode' ), | |
| 54 | + ), | |
| 55 | + array( | |
| 56 | + 'id' => 'holomesh', | |
| 57 | + 'label' => __( 'Holomesh', 'desktop-mode' ), | |
| 58 | + 'file' => 'holomesh.svg', | |
| 59 | + 'description' => __( 'The holographic mesh: lavender, pink, cyan and mint pooling into each other like light through a prism.', 'desktop-mode' ), | |
| 60 | + ), | |
| 61 | + array( | |
| 62 | + 'id' => 'pulsemesh', | |
| 63 | + 'label' => __( 'Pulsemesh', 'desktop-mode' ), | |
| 64 | + 'file' => 'pulsemesh.svg', | |
| 65 | + 'description' => __( 'The pulsar mesh: magenta and violet burning through a white core, the brightest surface the brand has.', 'desktop-mode' ), | |
| 66 | + ), | |
| 67 | + ); | |
| 68 | + | |
| 69 | + foreach ( $brand as $wallpaper ) { | |
| 70 | + $css = 'url( ' . OPENSTATION_URL . 'assets/wallpapers/' . $wallpaper['file'] . ' ) center center / cover no-repeat fixed'; | |
| 71 | + openstation_register_wallpaper( | |
| 72 | + $wallpaper['id'], | |
| 73 | + array( | |
| 74 | + 'label' => $wallpaper['label'], | |
| 75 | + 'type' => 'css', | |
| 76 | + // The swatch is the same artwork, sized to the chip rather | |
| 77 | + // than the desk: `cover` on a 40px square would crop to a | |
| 78 | + // meaningless corner of the composition. | |
| 79 | + 'preview' => 'url( ' . OPENSTATION_URL . 'assets/wallpapers/' . $wallpaper['file'] . ' ) center center / cover no-repeat', | |
| 80 | + 'value' => $css, | |
| 81 | + 'description' => $wallpaper['description'], | |
| 82 | + ) | |
| 83 | + ); | |
| 84 | + } | |
| 85 | + | |
| 32 | 86 | $presets = array( |
| 33 | 87 | array( |
| 34 | 88 | 'id' => 'dark', |
| 35 | 89 | 'label' => __( 'Graphite', 'desktop-mode' ), |
| @@ -62,30 +116,36 @@ | ||
| 62 | 116 | ), |
| 63 | 117 | ); |
| 64 | 118 | |
| 65 | 119 | foreach ( $presets as $preset ) { |
| 66 | - desktop_mode_register_wallpaper( $preset['id'], array( | |
| 67 | - 'label' => $preset['label'], | |
| 68 | - 'preview' => $preset['value'], | |
| 69 | - 'value' => $preset['value'], | |
| 70 | - 'type' => 'css', | |
| 71 | - 'description' => $preset['description'], | |
| 72 | - ) ); | |
| 120 | + openstation_register_wallpaper( | |
| 121 | + $preset['id'], | |
| 122 | + array( | |
| 123 | + 'label' => $preset['label'], | |
| 124 | + 'preview' => $preset['value'], | |
| 125 | + 'value' => $preset['value'], | |
| 126 | + 'type' => 'css', | |
| 127 | + 'description' => $preset['description'], | |
| 128 | + ) | |
| 129 | + ); | |
| 73 | 130 | } |
| 74 | 131 | |
| 75 | 132 | // Animated WordPress Logo — built-in PixiJS canvas wallpaper. |
| 76 | - // Moved out of `desktop.min.js` in 0.8.4. Same registration | |
| 133 | + // Moved out of `desktop.min.js`. Same registration | |
| 77 | 134 | // surface third-party canvas wallpapers use: `script` is an |
| 78 | 135 | // enqueued handle (registered in `includes/assets.php`); the |
| 79 | 136 | // shell's wallpaper sync injects its URL when the wallpaper |
| 80 | 137 | // def is needed (selected, or shown in the OS Settings picker). |
| 81 | - desktop_mode_register_wallpaper( 'wp-animated-logo', array( | |
| 82 | - 'label' => __( 'Animated WordPress Logo', 'desktop-mode' ), | |
| 83 | - 'preview' => 'radial-gradient(circle at 50% 50%, #1e3a8a 0%, #0b0f25 100%)', | |
| 84 | - 'type' => 'canvas', | |
| 85 | - 'script' => 'desktop-mode-animated-logo-wallpaper', | |
| 86 | - 'description' => __( 'Thousands of luminous particles holding the shape of the WordPress W. Sweep your cursor through and they scatter like sand, then drift home again.', 'desktop-mode' ), | |
| 87 | - ) ); | |
| 138 | + openstation_register_wallpaper( | |
| 139 | + 'wp-animated-logo', | |
| 140 | + array( | |
| 141 | + 'label' => __( 'Animated WordPress Logo', 'desktop-mode' ), | |
| 142 | + 'preview' => 'radial-gradient(circle at 50% 50%, #1e3a8a 0%, #0b0f25 100%)', | |
| 143 | + 'type' => 'canvas', | |
| 144 | + 'script' => 'os-animated-logo-wallpaper', | |
| 145 | + 'description' => __( 'Thousands of luminous particles holding the shape of the WordPress W. Sweep your cursor through and they scatter like sand, then drift home again.', 'desktop-mode' ), | |
| 146 | + ) | |
| 147 | + ); | |
| 88 | 148 | |
| 89 | 149 | // Snow — built-in PixiJS canvas wallpaper. The preview gradient |
| 90 | 150 | // must match the default backdrop the JS side paints behind the |
| 91 | 151 | // canvas (`backdropCss()` in `src/plugins/snow-wallpaper/settings.ts`) |
| @@ -93,13 +153,16 @@ | ||
| 93 | 153 | // loaded, so a mismatch would show one sky in the picker and a |
| 94 | 154 | // different one once selected. First built-in wallpaper with a |
| 95 | 155 | // `renderConfig` settings dialog (wind, snowflake count, flake |
| 96 | 156 | // size, background colour). |
| 97 | - desktop_mode_register_wallpaper( 'wp-snow', array( | |
| 98 | - 'label' => __( 'Snow', 'desktop-mode' ), | |
| 99 | - 'preview' => 'linear-gradient(180deg, #0c1a36 0%, #1d355e 55%, #425d8a 100%)', | |
| 100 | - 'type' => 'canvas', | |
| 101 | - 'script' => 'desktop-mode-snow-wallpaper', | |
| 102 | - 'description' => __( 'Snow falling over a midnight sky. Flakes settle on the top edge of every window, pile into little drifts, then quietly melt away. Open the wallpaper settings to tune the wind, the snowfall, the flake size, and the colour of the night.', 'desktop-mode' ), | |
| 103 | - ) ); | |
| 157 | + openstation_register_wallpaper( | |
| 158 | + 'wp-snow', | |
| 159 | + array( | |
| 160 | + 'label' => __( 'Snow', 'desktop-mode' ), | |
| 161 | + 'preview' => 'linear-gradient(180deg, #0c1a36 0%, #1d355e 55%, #425d8a 100%)', | |
| 162 | + 'type' => 'canvas', | |
| 163 | + 'script' => 'os-snow-wallpaper', | |
| 164 | + 'description' => __( 'Snow falling over a midnight sky. Flakes settle on the top edge of every window, pile into little drifts, then quietly melt away. Open the wallpaper settings to tune the wind, the snowfall, the flake size, and the colour of the night.', 'desktop-mode' ), | |
| 165 | + ) | |
| 166 | + ); | |
| 104 | 167 | } |
| 105 | -add_action( 'init', 'desktop_mode_register_builtin_wallpapers', 5 ); | |
| 168 | +add_action( 'init', 'openstation_register_builtin_wallpapers', 5 ); | |