Commit Graph
5897 Commits
Author SHA1 Message Date
aiongg 9bfa2c751b Command resolution only on change
Each kept resolution holds the key of what it read: the state's revision,
the gate's key and answer, a shared generation (keymap and catalog, scope
parents, instances and their liveness, modal facts) and, when read, the
focus generation, the focused stop's edits and a layer's or menu's vantage.
A reader whose key holds gets the kept Arc<ResolvedCommand>; the wake at
the start of a pass walks only when an input moved. CommandGate is a fn
plus props, asked once per command per key. App-scope states come from a
held Tracked<CommandStates>. resolve and resolve_command return
Arc<ResolvedCommand>. Under testing, every 100th pass compares every kept
resolution with a full one; count_resolve counts new, repeated and checked
resolutions.
2026-11-19 10:33:55 +00:00
aiongg fc8f48ff96 Command board: maps for instances, modal roots and shown readers; node facts after the node check; chord texts from the keymap build 2026-11-19 08:05:00 +00:00
aiongg 972a86af65 Keep the counters in pass-local state; mark Settle non_exhaustive 2026-11-19 08:05:00 +00:00
aiongg ce3513f84a Gate the counters on the testing feature 2026-11-19 08:05:00 +00:00
aiongg d06fd33dfb Add count-trial counters for settling, text layout and measure asks, and an idle-frame trial 2026-11-19 08:05:00 +00:00
aiongg 3a815c9657 ui-contract: MemoProps, MemoKey, Stateless and the MemoProps derive
MemoProps keys every input of a memoized view. The derive builds on the
plain-data field check, with #[memo_props(hash = "reason")] for foreign
plain types and #[memo_props(stateless)] for the type parameter of a
Stateless callback, which no fn item implements MemoProps for: the shared
check takes an optional per-parameter escape beside the field escape, and
PlainData passes none. FitKeep derives Hash.
2026-11-19 08:04:49 +00:00
aiongg ee0798cda0 craft: facade features table from the member manifests; PlainData derive reaches craft-tracked through contract 2026-11-19 08:04:36 +00:00
aiongg 02b3ea4a34 craft-ui: bind_tracked! binds several fields of one Tracked at once
bind_tracked!(doc => title, style.size) splits the Tracked into its value and
its write count (a Cell over the count) and gives each field path its own
write-through binding, so the borrow checker rejects overlapping paths. A
binding moves the count at each write that changes its field; making and
reading bindings every pass leaves the revision. Bind::tracked, Field, Place,
Projection and field! are gone: this is the one way to bind a tracked field.
2026-11-19 07:00:52 +00:00
aiongg c0df034524 ui-macros: plain-data check bounds type parameters and checks every field
The impl bounds each type parameter by the derive's trait, and every field is
checked under those bounds, so a generic recursive type derives without
overflowing and a Cell<T> field fails at the derive, naming the field. A field
type written with Self is checked as the type itself. The escape is an Escape
{ attr, keyword } parsed by escaped(), and the check item is a separate output a
derive may leave out. A direct craft-tracked dependency is preferred over the
facade when finding the crate path.
2026-11-19 06:57:03 +00:00
aiongg b083a40316 craft-tracked: Tracked<T>, PlainData and its derive, field! and Bind::tracked
Tracked<T> owns its value, a process-unique source id and a write count. Deref
reads; DerefMut, edit and a Field's writes move the count, and a clone is a new
source. T must be PlainData, a marker with no implementation for interior
mutability, raw pointers, dyn objects or closures, so no write can bypass the
count. #[derive(PlainData)] in ui-macros checks every field through a field-check
helper the plain-data derives share; #[plain_data(assume = "reason")] skips one
field of a foreign plain type.

field!(a.b) builds a read and a write projection from a field path only.
Bind::tracked(&mut t, field!(a.b)) reads through the read projection and moves
the revision only when an edit changes the field.
2026-11-19 06:47:09 +00:00
aiongg 98b1810f8f Merge pull request #2320 from aiongg/stack-command-defs
ui-macros: CommandSet::defs builds each command in its own function
2026-11-18 22:41:15 -05:00
aiongg ee151c5758 Merge pull request #2319 from aiongg/docs-no-pr-cache
docs workflow: pull requests do not save a dependency cache
2026-11-18 22:41:03 -05:00
aiongg 9f234ae3ec Merge pull request #2299 from aiongg/next-sync-1118
Sync main into next (18 Nov)
2026-11-18 22:14:22 -05:00
aiongg 16e50264ca ui-macros: CommandSet::defs builds each command in its own function
The derive pushed every variant's definition inline, so one frame held a CommandDef temporary per variant (175 KB for the largest set in PhotoCraft at opt-level 0). Each variant is now a non-capturing closure in a table of function pointers, and defs loops over the table.
2026-11-19 02:27:44 +00:00
aiongg 3b4f5079e4 docs workflow: pull requests do not save a dependency cache 2026-11-19 02:23:06 +00:00
David Mann 815e6a2389 Merge pull request #2283 from davidmann4/anchor/12708-edit-existing
Add Anchor: select and edit existing anchors and handles (photocraft#12708)
2026-11-19 03:22:06 +01:00
aiongg 147e122d8e Merge remote-tracking branch 'upstream/next' into next-sync-1118 2026-11-19 01:56:16 +00:00
aiongg 43bf8e87bc Revert "Lazy::show_or: the first child takes room only when it shows, so a dock group's extent is the same run or replayed"
This reverts commit 4f3b9e8594.
2026-11-19 01:56:16 +00:00
aiongg 4f3b9e8594 Lazy::show_or: the first child takes room only when it shows, so a dock group's extent is the same run or replayed
A host view that leaves its group to the dock left an empty scope in the
settling view's Ui, which moved the group below it. The view's extent then
differed between a run of the group and a replay of it, and the pointer over
one tab ran every group again.
2026-11-19 01:47:46 +00:00
aiongg b013967b02 Sync fixes: main's JXL capability test, settling layer through runtime::egui 2026-11-19 01:35:39 +00:00
David Mann 93e68f35a1 Merge remote-tracking branch 'origin/next' into anchor/12708-edit-existing
# Conflicts:
#	crates/draw/src/ui/pen/bezier/mod.rs
#	crates/draw/tests/it/bezier.rs
2026-11-19 02:31:29 +01:00
David Mann ad32b91d50 Merge pull request #2284 from davidmann4/anchor/12709-alt-subpath
Add Anchor: Alt selects or copies the whole subpath (photocraft#12709)
2026-11-19 02:15:12 +01:00
David Mann 117389d4a1 Merge pull request #2306 from davidmann4/fix/next-red-dock-settle
Lazy::show_or: a view that leaves its room takes none (next is red since #2273)
2026-11-19 02:14:53 +01:00
aiongg 9d599676d1 Sync fix: name private items in public docs as code, not links 2026-11-19 00:48:51 +00:00
aiongg f6532f9835 Sync fix: keep main's uri_decode import in the glTF tests 2026-11-19 00:32:21 +00:00
aiongg 7086f23162 Sync fixes: restore the rust-cache lock entries, drop a duplicate import, format 2026-11-19 00:27:45 +00:00
David Mann 15fee07c8d Merge branch 'fix/next-red-dock-settle' into HEAD 2026-11-19 00:56:30 +01:00
David Mann 7fcf44cb93 Merge branch 'fix/next-red-dock-settle' into HEAD 2026-11-19 00:56:29 +01:00
David Mann b5b1300783 Lazy::show_or: a view that leaves its room takes none
next has been red since #2273 on two counts, both in the dock's settling
host view (3bcc5bec4):

- design-lint: contract/lazy.rs named `egui::LayerId` for the run's
  layer. The run now holds the runtime's `Layer`, the type `Place` and
  `replay::close` already use.
- hovering_a_tab_runs_only_its_group: the dock ran its host view in a
  `scope_builder`, which takes room and item spacing in the Lazy's
  child even when the host leaves the group to the dock. A replayed
  group then sat 4 points lower in flow than a group that ran, so the
  child's extent changed whenever a hovered group ran, layout memory
  asked for a discard pass, and that pass ran every group (5 runs
  where 1 is expected).

`show_or` now runs `add` in a child `Ui` that takes room only when it
returns `Some`, so `otherwise` takes the same place whether it runs or
replays.
2026-11-19 00:55:45 +01:00
aiongg e8e713ee26 Merge storytold main into next (18 Nov sync)
Merges main at 3b8e426a26.

- crates/ui: main's e-sign dialog (crates/ui/src/esign) moves to craft-cloud-ui beside the
  share dialog, behind craft-cloud-ui's esign feature; craft-ui forwards `esign` and
  re-exports the module.
- crates/proof: main's can_suggest_cased goes to affix/check.rs and its tests to
  affix/tests.rs (next split affix.rs); French wiring in lib.rs.
- crates/svg: main's validated resolver and raster validation stay under tree-render, which
  now also enables gif and image-webp; the shared image-codec helpers are gated on tree.
- craft-ai-agents: main's rev (craft-ai-integrations main), one entry.
- crates/craft: facade dependencies, features and re-exports for main's new crates.
2026-11-18 23:07:38 +00:00
David Mann 04ba41419b Merge pull request #2242 from ljkx/fix/15540-dialog-first-field-selected
Dialogs: a dialog that opens on a text field selects its text (photocraft#15540)
2026-11-18 23:27:59 +01:00
Dylan M. Taylor 3b8e426a26 feat(exr): add f32/f16 RGBA writer, compression modes, and chromaticities (#2281) 2026-11-18 17:20:52 -05:00
David MannandClaude Opus 5.5 4d78bb2de2 Add Anchor: Alt selects or copies the whole subpath
In the reference application Alt does not turn Add Anchor Point into
Delete Anchor Point: an Alt click on a segment selects every anchor of
its subpath and adds nothing, an Alt drag moves a copy of the subpath
(the copy ends up selected), an Alt click on an anchor deletes nothing,
and the cursor is the arrow with a plus.

The overlay now does the same under Add Anchor, reusing Direct
Selection's Alt segment press (`PathEdit::DuplicateSubpath`, or the
subpath itself on a path that takes no copies). Delete Anchor with Alt
still adds an anchor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 23:03:09 +01:00
David MannandClaude Opus 5.5 0274c3e5a0 Add Anchor: select and edit existing anchors and handles
In the reference application the Add Anchor Point tool edits the
anchors and handles a path already has as Direct Selection does; only
a press on a segment adds an anchor. The overlay took a press on an
anchor and did nothing with it, and never took a handle.

Under Add Anchor a press on an anchor now selects and drags it as
Direct does (Shift adds to the selection), a press on a shown handle
drags it (Alt moves it alone), and a click on empty canvas deselects
the anchors and keeps the path. Alt on an anchor is still Delete
Anchor's click, and a click on a segment still adds an anchor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:59:49 +01:00
Dylan M. Taylor 010702ee9b chore: sync Cargo.lock with workspace (#2279) 2026-11-18 16:37:32 -05:00
Dylan M. Taylorandtexjer 6c034902b2 craft-develop: extract spline, curve, and lut modules from LightCraft (#587) (#2274)
Co-authored-by: texjer <texjer@gmail.com>
2026-11-18 16:30:48 -05:00
FredApps bba249ecbf Merge pull request #2270 from FredApps/fix/786-psd-tagged-descriptor-prefix
psd: add bounded recovering descriptor-block prefixes
2026-11-19 04:28:10 +07:00
aiongg 18ffc07519 Merge pull request #2273 from aiongg/frame-cost
Frame cost: shown-chord table, settling host views, one gate answer per frame
2026-11-18 16:19:20 -05:00
Dylan M. Taylor 816f745c02 Merge pull request #2023 from el-j/feat/video-mjpeg-frame
craft-video: Motion JPEG frames convert to VideoFrame (#1231)
2026-11-18 16:11:50 -05:00
aiongg e79a3ed16e TransformBox: trial that a frame run twice reports each drag move once
A frame's second pass runs the box's update again with the press still
held at the same point. The proposal it makes equals the one the first
pass reported, and the gesture reports an equal proposal only once, so a
host that applies each Update applies it once per move. The trial runs
a drag with every frame run twice and counts the updates.
2026-11-18 20:59:41 +00:00
aiongg 0392fc439d Commands: the gate answers each command once per frame
The board asked the app's gate again for every resolution: each reader
of a command, the measuring and the real run of each component, and the
re-resolution of every shown reader at the start of each pass. The gate
is a snapshot of what the app knew before the frame, so the board keeps
its answers for the frame and asks once per command. CommandRef::key_text
gives the key without allocating for a command without parameters; the
keymap's lookups and the board's answers use it.
2026-11-18 20:59:41 +00:00
aiongg 3bcc5bec46 Dock: a host view settles under its panel's content version
DockPanels::group_view ran in every pass, while the dock's own groups
settle their bodies under DockPanels::content. A host view now runs in a
settling Lazy under the shown panel's content version, the group's
panels and its shown tab, and repaints its last run while they hold.

Lazy::show_or carries the host's answer: the view runs first, and where
the host leaves the group to the dock, the dock's group shows in the
same child and that run is not kept, so the next pass asks the host
again. The run-count trial checks that a settled frame runs neither the
view nor the versioned body.
2026-11-18 20:59:41 +00:00
aiongg a23d8c68c6 Menu bar: one MenuHelp constructor, over a function that lists the entries
MenuHelp had two constructors, one over a list the caller built every
frame and one over a function the bar calls only while the Help menu is
open. Only the second keeps closed menus from paying for the list, so it
is the one constructor: MenuHelp::new takes the function.
2026-11-18 20:59:16 +00:00
.CooCoo b130ac1fa4 image-codecs: find the JPEG-LS frame header past 64 segments, and add detect_prefix (#2178)
* image-codecs: find the JPEG-LS frame header past 64 segments, and add detect_prefix

detect walked at most 64 marker segments looking for the SOF55 frame
header, so a JPEG-LS file with more segments before its frame header,
such as an ICC profile split over 255 APP2 segments, was reported as
JPEG. The walk now runs until it reaches a frame or scan header or the
end of the bytes. Each step moves forward at least one byte, so the walk
takes at most one step per byte.

detect also reported JPEG for a buffer that ended before the frame
header, which is what a caller that reads only the start of a file
passes. The new detect_prefix returns Detection::NeedBytes(n) in that
case, with the length the next step reads, and otherwise the answer
detect gives. The doc comment on detect now says that it needs the bytes
up to the frame header.

* image-codecs: walk each JPEG marker segment once when detecting in steps

detect_prefix walks the marker segments from the SOI on every call, so a
caller that reads exactly the length each Detection::NeedBytes asks for
walks the earlier segments again on each call. Over a file with many
small segments before its frame header, the total walk grows with the
square of the segment count.

The new PrefixDetector keeps the offset of the marker where its last
walk stopped and starts the next walk there. Its detect gives the same
answer and asks for the same lengths as detect_prefix, and
detect_prefix now runs a single step of a new PrefixDetector.

* image-codecs: read past a JPEG-LS restart interval segment and stop at FF 00

The JPEG-LS frame walk treated a DRI segment before the SOF55 frame header
as the end of the walk, so a file with one was detected and decoded as
JPEG. DRI now takes the length-prefixed path. The decoder accepts a 2-, 3-
or 4-byte interval of 0, reports a nonzero interval as unsupported, and
rejects other segment sizes as malformed.

`FF 00` after the SOI is a stuffed zero, not a marker, so the walk now ends
there instead of asking for a length field.

A PrefixDetector whose walk stopped at another frame header answers JPEG
for bytes that start with `FF D8 FF`, without walking from the SOI again.

* image-codecs: apply the JPEG-LS restart interval in effect at each scan

A later DRI with an interval of 0 turns restarts off again, and an
interval of at least the frame height puts a non-interleaved scan in
one interval with no restart marker. Both decode again. A nonzero
interval shorter than the frame height is still unsupported.

* image-codecs: reject a restart marker after a JPEG-LS scan of one interval

A restart marker comes only between two restart intervals. When the
interval in effect is at least the frame height, the scan is one
interval, so a restart marker after it, with or without fill bytes
before it, is now an error instead of being skipped.

Adds a test that a PrefixDetector starts each call at the marker where
its previous walk stopped.
2026-11-18 15:52:55 -05:00
.CooCoo 37724ad48d craft-image-codecs: lossy WebP encoding no longer copies the luma plane for every macroblock (#1975)
The VP8 encoder cloned the whole luma reconstruction before each
macroblock's B_PRED trial and restored it when a whole-block mode won,
so encoding P pixels copied about P^2/256 bytes. The trial writes only
the current macroblock, and the whole-block path writes every pixel of
that macroblock again without reading the trial's values, so the copy
and the restore are removed.

The output is byte-identical: a new test pins the SHA-256 of ten
encoded files (1x1 to 640x480, sizes that are not multiples of 16,
qualities 10 to 95) taken before the change, and decodes each with
image-webp. An ignored test prints encode times for 512 to 4096
squares; in release on one machine, 4096x4096 took 162.9 s before and
1.36 s after.
2026-11-18 15:51:10 -05:00
aiongg 57ecf973e1 Keymap: shown chords from a table built when the bindings change
Keymap::shown_chord ran a lookup for each single-press binding of the
command, and Board::resolve calls it for every command it resolves, so
each frame repeated those lookups for every command row, tool and button.
The keymap works out each command's shown chord when it is built and
whenever its bindings change, and shown_chord reads the table. The lookup
and the table share one ranking (Keymap::winners), which replaces the
separate press_runs copy of it.
2026-11-18 20:43:24 +00:00
Kevin Joseph 041bafa259 craft-docx: keep a table style's w:tblInd on read and save (#2196)
* craft-docx: keep a table style's w:tblInd on read and save

A table style's own indent was dropped on read, so it was gone on save.
pandoc's Table style sets it to 0, and Word for Mac places a table whose
style chain sets no indent about 5.4 pt further right than one set to 0.

craft-wordmodel gains TableStyleParts::indent, merged through basedOn.
The reader takes a dxa indent (nil is 0; pct and auto set none) and the
writer emits it in schema order, 0 included.

Part of storytold/wordcraft#5767.

* craft-docx: a table style's w:tblInd without w:w is 0

CT_TblWidth's w:w defaults to 0, so the style resets a based-on style's
indent instead of inheriting it. The test helper now fails when a saved
style is missing rather than matching an empty string.

* craft-docx: the tblInd override test checks the base sets an indent

Without it the test would pass if the reader dropped the base style's
indent, since there would be nothing to override.
2026-11-18 15:35:42 -05:00
Kevin Joseph 0c3793eadd craft-docx: theme font slots survive a save (#2197)
* craft-docx: theme font slots survive a save

w:rFonts' w:eastAsiaTheme and w:cstheme slots are kept on read and written
back. Word picks the East Asian and complex-script fonts through them, so
dropping them changed which font Word used for East Asian punctuation and
its line breaks. The Latin slots (w:asciiTheme, w:hAnsiTheme) are kept when
the run's font came from them and written back only while they still name
that font in the document's theme, so a font chosen later is not hidden.

craft-wordmodel: a one-byte ThemeFont and CharProps font_ascii_theme,
font_hansi_theme, font_ea_theme and font_cs_theme. Overlaying a named font
without its slot clears the slot; minus keeps a slot whose font stays.

Ported from storytold/wordcraft#5772.

* craft-docx: keep the theme's East Asian and script fonts; exact slot replacement

The saved theme wrote empty a:ea and a:cs faces and no per-script fonts, so
a kept w:eastAsiaTheme or w:cstheme slot named no font in Word. The reader
now keeps the theme's ea, cs and a:font script entries (THEME_FONTS) and
the writer puts them back.

craft-wordmodel: a named font replaces both Latin slots with its own, so a
patch with one slot no longer leaves the other stale. minus keeps a font
equal to the base's when its slots differ, so a font that clears the
base's slots still clears them when overlaid. latin_slot compares the
theme face without cloning it.

* craft-docx: theme fonts keep faces and scripts apart; limit only usable scripts

THEME_FONTS lines now say whether they hold a default face (a:ea, a:cs) or a
per-script font, so an a:font script="cs" is no longer written back as the
a:cs face. The 256-entry limit applies to usable per-script fonts only, so
empty default faces no longer push the last one out.

A test pins down Latin slots that name different faces: the model has one
Latin font, so only the slot that still names it is written.

* craft-docx: a long theme script id never pushes out one font resolution uses

The kept per-script fonts count script ids of 8 characters or fewer (the
ones font resolution takes) and longer ones (language tags such as
zh-Hant-TW) apart, 256 each, so a long one can't use up the place of a
mapping resolution keeps.

* craft-docx: THEME_FONTS names both per-script caps
2026-11-18 15:35:36 -05:00
Kevin JosephandNghiathan13 6242f65262 craft-docx: a table border without w:sz is width 0, and ODT and RTF keep it (#2203)
* craft-docx: a DOCX border without w:sz is an eighth of a point

* craft-docx: a table border without w:sz is width 0, and ODT and RTF keep it

A table, cell or table-style border without w:sz gives the same output in
Word as w:sz="0" and takes no room; read as half a point, rows below a
pandoc table's header rule moved down half a point. PropCtx::table_borders
now reads it as 0, as PropCtx::borders does since #1488.

ODT and RTF have no border that is drawn and takes no room, so a drawn
width-0 cell side is written at Border::THINNEST instead of being dropped.
Where two ODT cells share an edge, a line with a width wins over a width-0
one, whichever cell states it.

Table half of storytold/wordcraft#5764.

---------

Co-authored-by: Nghiathan13 <201675788+Nghiathan13@users.noreply.github.com>
2026-11-18 15:35:29 -05:00
ARCandARC 1846851756 fix(docx): a VML shape whose v:stroke is off or fully transparent has no outline (#2226)
The VML reader took a shape's outline from its stroked and strokecolor
attributes only, so a v:stroke child with on="f" or opacity="0" was
ignored and the shape got a black 0.75 pt outline. Google Docs writes
its horizontal rules this way (a 0.05 pt v:rect with a transparent
stroke): Word shows nothing, and after a save every rule became a
visible line.

Each stroke property (on, color, opacity, endcap) now resolves as Word
does: the shape's own v:stroke, then the shape's attribute (stroked,
strokecolor), then the same two on its shapetype. A fully transparent
line is kept as a shape without an outline, and freeforms take the
resolved opacity, inherited ones included. Opacity is read in all three
forms a file can use (0, 0% and 65536ths such as 0f).

Moved from storytold/wordcraft#3829, where it was reviewed, now that
the DOCX reader lives here.

Co-authored-by: ARC <261443955+arc-uri-el@users.noreply.github.com>
2026-11-18 15:35:22 -05:00