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.
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.
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.
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.
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.
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.
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.
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.
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.
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>
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>
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.
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.
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.
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.
* 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.
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.
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.
* 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.
* 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
* 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>
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>