Merge branch 'area/app-1' into look-fix/layout

This commit is contained in:
Dylan M. Taylor committed 2026-11-21 14:02:35 -05:00
commit 4bf84b2ea7
8 files changed
+27 -14

No files matched your search

+12 -1
View File
@@ -508,12 +508,23 @@ 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)));
if let Ok(theme) = craft::theme::ThemeId::parse("craft.graphite") {
root.set_theme(theme);
}
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.
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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);
}
}
+6 -5
View File
@@ -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);
+4 -1
View File
@@ -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 {
@@ -364,7 +364,7 @@ fn box_controls(
PicturePaper::new(paper_quad, placed.rect).show_at(ui, body.rect);
let full = matrix_corners(xf, info, page, image.matrix).map(|p| view.to_doc(p));
let map = affine_between(quad, to);
let _ = TransformPreview::new(tl!("Picture"), textures).map(PreviewMap::Quad(full.map(map))).show_at(ui, body.rect);
let _ = TransformPreview::new(tl!("Picture"), textures).map(PreviewMap::Quad(full.map(map))).clip_quad(to).show_at(ui, body.rect);
edit
}
-1
View File
@@ -7100,7 +7100,6 @@ fn cropped_image_corner_resize_keeps_opposite_corner_and_scales_crop() {
/// While a corner is dragged, the image's pixels are drawn in the blue frame, not left at their
/// old size until release (#1671).
#[ignore = "known gap of the egui-to-craft port: see docs/port-known-gaps.md"]
#[test]
fn image_pixels_follow_the_frame_while_a_corner_is_dragged() {
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 1100.0)).build_eframe(|cc| {
-1
View File
@@ -7,7 +7,6 @@ fixed. Framework items (F-n) are in the port workspace's follow-up list.
|---|---|---|
| `comments::a_double_click_on_a_replace_text_opens_its_one_window` | the group's window doesn't open on the double-click | the comment part receives the first press and release; the second press reaches the comment canvas tool with click count two |
| `content::added_picture_resizes_repeatedly_and_drags_back_from_out_of_bounds_without_smear` | edge texels smear across the out-of-bounds half | texture sampling/clamping of the cached picture while dragged out of the page |
| `editing::image_pixels_follow_the_frame_while_a_corner_is_dragged` | the frame does not follow the grip during a corner drag | F-126: frame and pixels read different passes; the frame assertion currently fails first |
| `editing::paragraph_edges_and_frames_are_caught_without_aiming_for_the_hairline` | a click off the text doesn't apply the typing | F-115 follow-up: the edge band and the click-off rule overlap |
| `marks::the_preview_shows_the_page_the_range_selects_under_the_marks` | the stamp preview doesn't show the selected page | F-161: the preview overlay's clip is inverted and its geometry a pass behind |
| `panel_snapshots::every_panel_matches_its_snapshot` | all 11 accessibility-tree snapshots differ after updating the dock queries | L-298 defers pixel snapshots; these text snapshots need separate review |