| 1 |
|
- |
use std::path::Path;
|
| 2 |
|
- |
|
| 3 |
|
- |
/// Write the geometry layer `makeover-geometry` defines into
|
| 4 |
|
- |
/// `frontend/css/geometry.css`, which `index.html` links ahead of the
|
| 5 |
|
- |
/// stylesheet.
|
| 6 |
|
- |
///
|
| 7 |
|
- |
/// Baked at build time rather than applied from `themes.js` the way the intent
|
| 8 |
|
- |
/// layer is, because geometry never changes at runtime: no theme may touch it,
|
| 9 |
|
- |
/// so there is nothing to re-apply and no second pass over `:root` to pay for
|
| 10 |
|
- |
/// on load.
|
| 11 |
|
- |
///
|
| 12 |
|
- |
/// The touch preset hangs off `@media (hover: none)` rather than off the
|
| 13 |
|
- |
/// 768px breakpoint. Density is about who is operating the app, not how wide
|
| 14 |
|
- |
/// the window is: a narrow window on a desktop still has a pointer in it, and
|
| 15 |
|
- |
/// a tablet at full width still has a finger. BB happens to already have a
|
| 16 |
|
- |
/// `hover: none` block for exactly this reason, so the presets land where the
|
| 17 |
|
- |
/// existing touch overrides already live.
|
| 18 |
|
- |
///
|
| 19 |
|
- |
/// The file is generated, and gitignored.
|
| 20 |
|
- |
fn materialize_geometry() {
|
| 21 |
|
- |
use makeover_geometry::{Density, gap_css_overrides, geometry_css_vars};
|
| 22 |
|
- |
|
| 23 |
|
- |
let mut css = String::from(
|
| 24 |
|
- |
"/* Generated by build.rs from makeover-geometry. Do not edit.\n \
|
| 25 |
|
- |
Spacing is named by relationship, not by size. Every token here is\n \
|
| 26 |
|
- |
invariant by construction -- the crate exists because none of it may\n \
|
| 27 |
|
- |
vary by theme -- which is why they carry no per-line `invariant`\n \
|
| 28 |
|
- |
marker the way the :root tokens in styles.css do. */\n",
|
| 29 |
|
- |
);
|
| 30 |
|
- |
css.push_str(&geometry_css_vars(Density::Pointer));
|
| 31 |
|
- |
css.push_str("\n@media (hover: none) {\n");
|
| 32 |
|
- |
for line in gap_css_overrides(":root", Density::Touch).lines() {
|
| 33 |
|
- |
css.push_str(" ");
|
| 34 |
|
- |
css.push_str(line);
|
| 35 |
|
- |
css.push('\n');
|
| 36 |
|
- |
}
|
| 37 |
|
- |
css.push_str("}\n");
|
| 38 |
|
- |
|
| 39 |
|
- |
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
| 40 |
|
- |
.join("frontend")
|
| 41 |
|
- |
.join("css")
|
| 42 |
|
- |
.join("geometry.css");
|
| 43 |
|
- |
std::fs::write(path, css).expect("write geometry.css");
|
| 44 |
|
- |
}
|
| 45 |
|
- |
|
| 46 |
1 |
|
fn main() {
|
| 47 |
|
- |
// themes/ and frontend/css/layout.css. Both were written out here until
|
| 48 |
|
- |
// they had a second identical copy in the other Tauri app; they live in
|
| 49 |
|
- |
// makeover-build now. The geometry emitter below stays local, because the
|
| 50 |
|
- |
// two apps genuinely disagree about how the touch preset is selected.
|
| 51 |
|
- |
makeover_build::tauri_frontend(env!("CARGO_MANIFEST_DIR"), &makeover_build::Emit::default());
|
| 52 |
|
- |
materialize_geometry();
|
|
2 |
+ |
// All three generated files: themes/, geometry.css, layout.css. The
|
|
3 |
+ |
// geometry emitter moved out too once density selection was settled:
|
|
4 |
+ |
// touch is a capability, so it hangs off (hover: none), (pointer: coarse)
|
|
5 |
+ |
// rather than a user-agent string or a breakpoint.
|
|
6 |
+ |
makeover_build::tauri_frontend(
|
|
7 |
+ |
env!("CARGO_MANIFEST_DIR"),
|
|
8 |
+ |
&makeover_build::Emit::default(),
|
|
9 |
+ |
None,
|
|
10 |
+ |
);
|
| 53 |
11 |
|
tauri_build::build();
|
| 54 |
12 |
|
}
|