publish: the public projection begins here
This is a projection, not a development branch. The tree above was constructed from the internal source named below under a manifest that decides which paths may leave, then scanned as a whole tree rather than as a series of patches, and only then published. Public history starts here because the history before it was not admissible, and neither was the tree. What used to stand in this repository included a rescue copy of another machine, a directory of phone handoffs, deployment wired to one house, and a submodule pointing at a forge no stranger can reach. None of that was ever the product. It stays in the private forge, which is allowed to hold the whole working organism, and this is what was deliberately sent out instead. Three mechanisms produced this tree, in decreasing order of trust. A top-level path the manifest does not name never arrives at all, which is the one that catches directories nobody has thought of yet. Named internal files inside admitted roots are dropped. A short, reviewed table replaces deployment defaults that a public build must not carry -- an endpoint aimed at one LAN, a VPN profile belonging to one phone, packaging built from one checkout path. Everything after this commit is an ordinary publication with the same three trailers, so a force push stops being routine and starts meaning that something deliberate happened. The trailers bind the projection to its source without pretending the public SHA is the private one: same lineage, different tree, and the record says so. Source-Sha: 8f27b1e76a8fef560a336aba18e6990713ff1047 Policy-Sha: 6b261d2f3e6e1fb19874846ba4bb1dfe15565d25b8618c1c1afba0419c101d27 Tree-Digest: 18ec3563c5e5ef9a414993a9f6734b251ff9ed3cd56eebdd6cac01e45c6e3067
This commit is contained in:
commit
8f42fc953d
1476 changed files with 238455 additions and 0 deletions
145
examples/demo.rs
Normal file
145
examples/demo.rs
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
//! Demo of sexy terminal UI effects
|
||||
//! Run with: cargo run --example demo
|
||||
|
||||
use crossterm::{
|
||||
cursor::{Hide, MoveTo, Show},
|
||||
execute,
|
||||
style::{Color, ResetColor, SetForegroundColor},
|
||||
terminal::{Clear, ClearType},
|
||||
};
|
||||
use std::io::{self, Write};
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::time::sleep;
|
||||
|
||||
pub struct Animator {
|
||||
start_time: Instant,
|
||||
}
|
||||
|
||||
impl Animator {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
start_time: Instant::now(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn breathe(&self, speed_ms: u64) -> f32 {
|
||||
let elapsed = self.start_time.elapsed().as_millis() as f64;
|
||||
let cycle = (elapsed / speed_ms as f64) * 2.0 * std::f64::consts::PI;
|
||||
((cycle.sin() + 1.0) / 2.0) as f32
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn typewrite(text: &str, wpm: u64) {
|
||||
let delay_ms = 60000 / (wpm * 5);
|
||||
for ch in text.chars() {
|
||||
print!("{}", ch);
|
||||
io::stdout().flush().unwrap();
|
||||
sleep(Duration::from_millis(delay_ms)).await;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gradient(text: &str, start_hue: f32) -> String {
|
||||
text.chars()
|
||||
.enumerate()
|
||||
.map(|(i, ch)| {
|
||||
let hue = (start_hue + i as f32 * 3.0) % 360.0;
|
||||
let (r, g, b) = hsl_to_rgb(hue, 0.8, 0.6);
|
||||
format!("\x1b[38;2;{};{};{}m{}\x1b[0m", r, g, b, ch)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn hsl_to_rgb(h: f32, s: f32, l: f32) -> (u8, u8, u8) {
|
||||
let c = (1.0 - (2.0 * l - 1.0).abs()) * s;
|
||||
let x = c * (1.0 - ((h / 60.0) % 2.0 - 1.0).abs());
|
||||
let m = l - c / 2.0;
|
||||
let (r1, g1, b1) = match h {
|
||||
_ if h < 60.0 => (c, x, 0.0),
|
||||
_ if h < 120.0 => (x, c, 0.0),
|
||||
_ if h < 180.0 => (0.0, c, x),
|
||||
_ if h < 240.0 => (0.0, x, c),
|
||||
_ if h < 300.0 => (x, 0.0, c),
|
||||
_ => (c, 0.0, x),
|
||||
};
|
||||
(
|
||||
((r1 + m) * 255.0) as u8,
|
||||
((g1 + m) * 255.0) as u8,
|
||||
((b1 + m) * 255.0) as u8,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn breathing_color(base: (u8, u8, u8), intensity: f32) -> (u8, u8, u8) {
|
||||
let factor = 0.8 + (intensity * 0.4);
|
||||
(
|
||||
(base.0 as f32 * factor).min(255.0) as u8,
|
||||
(base.1 as f32 * factor).min(255.0) as u8,
|
||||
(base.2 as f32 * factor).min(255.0) as u8,
|
||||
)
|
||||
}
|
||||
|
||||
pub const SPINNER: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
||||
pub const WAVE: &[&str] = &[
|
||||
"▁", "▂", "▃", "▄", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▄", "▃", "▂",
|
||||
];
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let mut stdout = io::stdout();
|
||||
|
||||
execute!(stdout, Hide, Clear(ClearType::All)).unwrap();
|
||||
|
||||
let animator = Animator::new();
|
||||
|
||||
// Demo 1: Gradient
|
||||
execute!(stdout, MoveTo(5, 2)).unwrap();
|
||||
println!("{}", gradient("✨ Souveraine ✨", 30.0));
|
||||
|
||||
// Demo 2: Typing
|
||||
execute!(stdout, MoveTo(5, 4)).unwrap();
|
||||
print!("Ani: ");
|
||||
io::stdout().flush().unwrap();
|
||||
typewrite("Color and pop!", 100).await;
|
||||
println!();
|
||||
|
||||
// Demo 3: Breathing heart
|
||||
execute!(stdout, MoveTo(5, 6)).unwrap();
|
||||
print!("Breathing: ");
|
||||
for _ in 0..20 {
|
||||
let breathe = animator.breathe(500);
|
||||
let (r, g, b) = breathing_color((255, 100, 200), breathe);
|
||||
execute!(stdout, SetForegroundColor(Color::Rgb { r, g, b })).unwrap();
|
||||
print!("♥");
|
||||
io::stdout().flush().unwrap();
|
||||
sleep(Duration::from_millis(50)).await;
|
||||
execute!(stdout, MoveTo(16, 6)).unwrap();
|
||||
}
|
||||
|
||||
execute!(stdout, ResetColor).unwrap();
|
||||
println!();
|
||||
|
||||
// Demo 4: Spinner
|
||||
execute!(stdout, MoveTo(5, 8)).unwrap();
|
||||
print!("Loading: ");
|
||||
for i in 0..20 {
|
||||
execute!(
|
||||
stdout,
|
||||
SetForegroundColor(Color::Rgb {
|
||||
r: 100,
|
||||
g: 200,
|
||||
b: 255
|
||||
})
|
||||
)
|
||||
.unwrap();
|
||||
print!("{}", SPINNER[i % SPINNER.len()]);
|
||||
io::stdout().flush().unwrap();
|
||||
sleep(Duration::from_millis(80)).await;
|
||||
execute!(stdout, MoveTo(14, 8)).unwrap();
|
||||
}
|
||||
|
||||
execute!(stdout, ResetColor).unwrap();
|
||||
println!(" ✓");
|
||||
|
||||
// Cleanup
|
||||
execute!(stdout, Show, ResetColor).unwrap();
|
||||
println!("\n✨ Demo complete! ✨");
|
||||
}
|
||||
Loading…
Reference in a new issue