mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 03:49:11 +00:00
Merge branch 'look-fix/theme' into area/app-1
This commit is contained in:
@@ -508,12 +508,20 @@ impl PdfCraftApp {
|
||||
/// The app's root values for this frame: appearance mode, motion, interface scale and the
|
||||
/// interface language's direction. The one place the app's `RootEnv` is built.
|
||||
pub(crate) fn root_env(&self, ctx: &egui::Context) -> RootEnv {
|
||||
static SIZES: std::sync::OnceLock<Arc<craft::theme::AppSizes>> = std::sync::OnceLock::new();
|
||||
let sizes = SIZES.get_or_init(|| {
|
||||
let mut sizes = craft::theme::AppSizes::default();
|
||||
sizes.all.insert("typography.display.size".into(), craft::theme::SizeValue::Number(24.0));
|
||||
sizes.all.insert("typography.display.line_height".into(), craft::theme::SizeValue::Number(29.0));
|
||||
Arc::new(sizes)
|
||||
});
|
||||
let lang = i18n::Lang::from_pref(&self.language);
|
||||
let direction = if lang.rtl() { craft_i18n::Direction::Rtl } else { craft_i18n::Direction::Ltr };
|
||||
let system = craft::ui::runtime::env::system_text_scale(ctx).unwrap_or(1.0);
|
||||
let native = ctx.native_pixels_per_point().unwrap_or(1.0);
|
||||
let mut root =
|
||||
RootEnv::new().mode(self.theme_preference).direction(direction).scale(Scale::new(crate::ui_scale::zoom(self.ui_scale, system, native)));
|
||||
RootEnv::new().mode(self.theme_preference).density(craft::theme::Size::Comfortable).direction(direction).scale(Scale::new(crate::ui_scale::zoom(self.ui_scale, system, native)));
|
||||
root.sizes = Arc::clone(sizes);
|
||||
root.motion = self.animation_effects;
|
||||
// Today is the session's day, the one its date formats and Fill & Sign's Date tool use: the calendars ring it
|
||||
// and pick it.
|
||||
|
||||
@@ -51,7 +51,7 @@ pub(super) enum Notice {
|
||||
|
||||
/// One inline notice with the icon named `icon`.
|
||||
fn bar(tone: Tone, icon: &'static str, text: String) -> Bar<'static> {
|
||||
Bar::new(tone, text).layout(NoticeLayout::Inline).icon(NoticeIcon::Custom(IconId::new(icon).into()))
|
||||
Bar::new(tone, text).layout(NoticeLayout::Bar).icon(NoticeIcon::Custom(IconId::new(icon).into()))
|
||||
}
|
||||
|
||||
/// The notices above the pages, one after another: a file changed on disk first, then what a historical
|
||||
|
||||
@@ -524,8 +524,8 @@ impl Component for PageOverlays<'_> {
|
||||
[Tone::Neutral, Tone::Accent, Tone::Info, Tone::Good, Tone::Warn, Tone::Bad].into_iter().map(|tone| (tone, cx.tone(tone))).collect();
|
||||
PageOverlaysStyle {
|
||||
metrics: Metrics::new(),
|
||||
field_fill: cx.color(colors.status.info.bg),
|
||||
field_edge: cx.color(colors.status.info.border),
|
||||
field_fill: cx.color(colors.status.info.solid),
|
||||
field_edge: cx.color(colors.status.info.solid),
|
||||
required_edge: cx.color(colors.status.bad.solid),
|
||||
flash: cx.color(colors.accent.solid),
|
||||
tab_fill: cx.color(colors.accent.solid),
|
||||
@@ -595,7 +595,7 @@ impl PageOverlays<'_> {
|
||||
} else {
|
||||
(PaintShape::Rect(rect, CornerRadius::ZERO), PaintShape::Rect(rect, CornerRadius::ZERO))
|
||||
};
|
||||
draw.fill(&shape, style.field_fill);
|
||||
draw.faded(48.0 / 255.0, |draw| draw.fill(&shape, style.field_fill));
|
||||
draw.stroke(&outline, width, edge);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use craft::behavior::IconId;
|
||||
use craft::behavior::{DisplayOrder, ItemSource, SizeHint};
|
||||
use craft::keymap::CommandRef;
|
||||
use craft::theme::variant::Tone;
|
||||
use craft::theme::TypeRole;
|
||||
use craft::ui::buttons::{Button, IconButton};
|
||||
use craft::ui::contract::{ActivateOn, CollectionEvent, Pad, Props as _, Show as _, ShowCollection as _, ShowContainer as _, clicked};
|
||||
use craft::ui::display::{PictureSize, Text};
|
||||
@@ -118,7 +119,7 @@ pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||
.offers_new(false)
|
||||
.drop_hint(tl!("Files you open in PdfCraft appear here").to_string())
|
||||
.section(StartPlace::BeforeRecent, |ui, _| {
|
||||
let _ = Text::new(tl!("Welcome to PdfCraft").to_string()).show(ui);
|
||||
let _ = Text::new(tl!("Welcome to PdfCraft").to_string()).role(TypeRole::Display).show(ui);
|
||||
let _ = Text::new(tl!("An open-source PDF workbench — local, private, and scriptable.").to_string()).show(ui);
|
||||
if community_card {
|
||||
Stack::new().label(tl!("Join the ArtCraft community")).fill_width().surface(SurfaceKind::Raised).pad(Pad::Regular).show(
|
||||
@@ -126,7 +127,7 @@ pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||
|ui, _| {
|
||||
Row::new().show(ui, |ui, _| {
|
||||
brand::mark(ui, PictureSize::Thumb(ThumbSize::Medium));
|
||||
let _ = Text::new(tl!("Join the ArtCraft community").to_string()).show(ui);
|
||||
let _ = Text::new(tl!("Join the ArtCraft community").to_string()).role(TypeRole::Heading).show(ui);
|
||||
if clicked(&IconButton::new(IconId::new("x")).id_salt("community-close").label(tl!("Close")).show(ui)) {
|
||||
asked.borrow_mut().push(Asked::CloseCommunityCard);
|
||||
}
|
||||
@@ -143,9 +144,9 @@ pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||
},
|
||||
);
|
||||
}
|
||||
let _ = Text::new(tl!("Recommended tools").to_string()).show(ui);
|
||||
let _ = Text::new(tl!("Recommended tools").to_string()).role(TypeRole::Heading).show(ui);
|
||||
tool_grid(ui, tl!("Recommended tools"), &recommended, false, &asked);
|
||||
let _ = Text::new(tl!("Pinned Tools").to_string()).show(ui);
|
||||
let _ = Text::new(tl!("Pinned Tools").to_string()).role(TypeRole::Heading).show(ui);
|
||||
if Button::new(tl!("Pin a tool…").to_string()).id_salt("pin-a-tool").show(ui).clicks > 0 {
|
||||
asked.borrow_mut().push(Asked::PinTools);
|
||||
}
|
||||
@@ -156,7 +157,7 @@ pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
})
|
||||
.section(StartPlace::AfterSections, |ui, _| {
|
||||
let _ = Text::new(tl!("Privacy").to_string()).show(ui);
|
||||
let _ = Text::new(tl!("Privacy").to_string()).role(TypeRole::Heading).show(ui);
|
||||
let _ =
|
||||
Text::new(tl!("PdfCraft works offline. No telemetry, no account, and no cloud processing unless you add a provider.").to_string())
|
||||
.show(ui);
|
||||
|
||||
@@ -2,6 +2,8 @@ use craft::behavior::{DisplayOrder, IconId, ItemSource, Selection};
|
||||
use craft::ui::buttons::Button;
|
||||
use craft::ui::choice::{Checkbox, Segmented};
|
||||
use craft::ui::contract::{ActivateOn, Bind, CollectionEvent, Entry, Props as _, SelectMode, Show as _, ShowCollection as _, Sizing};
|
||||
use craft::ui::display::Badge;
|
||||
use craft::theme::{Variant, variant::{Emphasis, Tone}};
|
||||
use craft::ui::list::{HueTarget, List, ListRow, RowEvent, RowInk, TrailingFace, TrailingPart};
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::style::DataColor;
|
||||
@@ -140,7 +142,8 @@ fn item_row(g: &'static ToolGroup, item: &'static ToolItem) -> ListRow<'static>
|
||||
Availability::Planned(m) => m,
|
||||
Availability::Provider => "AI",
|
||||
};
|
||||
let row = ListRow::new(tl!(item.label).to_owned()).icon(IconSpec::svg(IconId::new(item.icon))).trailing(tl!(chip).to_owned());
|
||||
let badge = Badge::new(tl!(chip).to_owned()).variant(Variant::look(Emphasis::Soft, if ready { Tone::Good } else { Tone::Neutral }));
|
||||
let row = ListRow::new(tl!(item.label).to_owned()).icon(IconSpec::svg(IconId::new(item.icon))).trailing_field(badge, |_| {});
|
||||
if ready {
|
||||
row.hue(data_hue(g), HueTarget::Icon).tooltip(format!("{} — {}", tl!(item.label), item.command))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user