Commit Graph
5619 Commits
Author SHA1 Message Date
Dylan M. Taylor 02c639c357 cms: share commented CUBE export layout 2026-11-15 11:40:59 +00:00
Dylan M. Taylor 4780f75080 Merge remote-tracking branch 'origin/main' into fix/avif-exif-hlg
# Conflicts:
#	Cargo.lock
2026-11-15 11:39:31 +00:00
Trevor Brown 6dfb580c08 cms: share annotated CUBE export and integer-depth precision
Port header and quantization behavior from PhotoCraft d62728aeae8b331f69ec6d283add3e59fc47924e, retaining compact write_cube behavior. Adaptation and shared tests by Dylan M. Taylor.
2026-11-15 06:39:11 -05:00
el-j ff61266d63 craft-audio: QOA (Quite OK Audio) decoder and encoder
Adds the qoa module behind the qoa, qoa-decode and qoa-encode features:
whole .qoa files, 16-bit, 1 to 8 channels. Streaming files are
unsupported. An ffmpeg oracle test checks that ffmpeg decodes our files
to exactly the samples our decoder returns.

Closes #1541
2026-11-15 12:38:57 +01:00
Dylan M. Taylor 26980ff331 Bound portable material detection 2026-11-15 11:38:06 +00:00
Dylan M. Taylor fe6b443acf Merge pull request #1505 from storytold/fix/svg-embedded-image-accounting
craft-svg: account for malformed embedded image data
2026-11-15 06:37:46 -05:00
Dylan M. Taylor 55b1d7f3c5 Merge pull request #1501 from storytold/extract/apng-container
craft-image-codecs: extract bounded APNG container assembly
2026-11-15 06:30:57 -05:00
Dylan M. Taylor 923ae70549 Reject duplicate manifest fields on write 2026-11-15 11:30:20 +00:00
Dylan M. Taylor 7dbfafa356 Share bounded portable material archives 2026-11-15 11:26:24 +00:00
Dylan M. Taylor 9d088c77ea Support buffered output from tiled AV1 encoder 2026-11-15 11:25:41 +00:00
Dylan M. Taylor dab6a8ea21 Flush delayed AV1 frames in HLG regression 2026-11-15 11:13:51 +00:00
keithcsqueensu 5a0caf286e craft-xlsx: .xlsb cell formulas, shared, array and dynamic arrays (ports of gridcraft#3810, #3818, #3821) (#1166)
craft-xlsx decodes `.xlsb` cell formulas, including shared, array and dynamic-array formulas, into the text an `.xlsx` file holds for them. Until now they were skipped and only their saved values kept. Part of #778.

Ported from storytold/gridcraft#3810, #3818 and #3821 (issue gridcraft#3806), my own series; the commits keep me (kiwi4boy) as their author. The three PRs are one series, each containing the one before.

## Commits

1. **The XLSB function table** (gridcraft#3810): `xlsb/ftab.rs`, [MS-XLSB] 2.5.98.10. It is craft-xls's table up to 379 (0x17B), which matches GridCraft's before the PR, plus the PR's 0x17C–0x1E4 entries (CUBE*, the Analysis ToolPak functions, IFERROR, COUNTIFS, SUMIFS, AVERAGEIF(S)). It is craft-xlsx's own copy, not shared with craft-xls: the formats follow separate specifications and their readers develop separately. They can share one table later once both settle.
2. **Cell formulas** (gridcraft#3818, with its two review fixes): `xlsb/formula.rs` is a BIFF12 decoder, separate from craft-xls's BIFF8 one, because nearly every operand differs. `xlsb/expr.rs` is a copy of craft-xls's expression tree and A1 printer, with `BinOp::precedence` added for grouping. A formula cell's `CellFormula.text` is in the file's spelling (`_xlfn.CONCAT`, `_xlpm.x`, no implicit `@`), and a `BrtCellMeta` before a cell sets `cell_metadata`, as `cm` does. The workbook's sheet links, supporting links and names are read with the workbook part, and `Package` keeps them for its sheets. A new `Limits::binary_formula_text` (128 MiB) bounds decoded text.
3. **Shared, array and dynamic-array formulas** (gridcraft#3821, with its review fixes): `PtgExp` cells, `BrtShrFmla` and `BrtArrFmla`. See the mapping below.
4. **A shared formula stops decoding copies once one is kept as its value**: a fix for CodeRabbit's finding that is still open on gridcraft#3821, so it isn't carried over.
5. **README**: what the decoder gives, what keeps its saved result, and the new limit.
6. **Review fixes**: 468 (0x1D4) is CONVERT. The specification's table has no row for it, but Excel writes CONVERT as `PtgFunc` 0x1D4. A shared formula's tokens are borrowed from the part instead of copied. A formula kept as its value loses its cell metadata.
7. **Review fixes, round 2**: a chain of strings joined with `&` is flattened only up to the decoder's depth bound (256 strings), so a balanced tree of thousands can't become a chain that overflows the stack when printed or dropped. A first cell whose range record never comes loses its cell metadata.
8. **Excel's spelling, from a second Excel round:**
   - Spaces and line breaks typed in a formula (`PtgAttrSpace`) are kept where `.xlsx` keeps them (`1 +  2`, `SUM( A1, B1 )`), and the text is trimmed as the `.xlsx` reader trims it.
   - A number is written out in full when that takes at most 21 characters without the sign, and in scientific notation otherwise (`100000000000000000000`, `1E+21`), as Excel writes it. The decoder switched at 1E+15 and 1E-9.
   - ISO.CEILING, ECMA.CEILING, NETWORKDAYS.INTL and WORKDAY.INTL are called through hidden `_xlfn.` names in `.xlsb`, but `.xlsx` spells them without the prefix.
9. **Macro sheets and spans over chart sheets:** a reference to an XLM macro sheet (`Macro1!$A$1`) is named, since macro sheets have cells. A 3-D span with a chart sheet between its ends is spelled by its ends, as `.xlsx` has it. An end with no cells still keeps the saved result.

## How it maps onto craft-xlsx's model

- A formula's text is what the `.xlsx` reader gives for the same formula. GridCraft's reading of that text stays in GridCraft: `fmla::from_file`, the implicit `@` on legacy formulas, its parser check, and Python-cell adoption.
- **Shared formulas:** every cell of the group gets `FormulaKind::Shared` with the group's `si` (counted per sheet), and the first cell also gets the range. Unlike `.xlsx`, where the other cells have empty text, each cell here gets its own text, decoded from the shared tokens at that cell. [MS-XLSB] defines it that way, with relative offsets that wrap around the grid. Shifting the first cell's text is not exact; the review of the GridCraft PR found that. `CellFormula.text`'s doc says so.
- **Arrays:** the first cell gets `FormulaKind::Array` and its range. The other cells keep their cached values and have no formula, as in `.xlsx`. A dynamic array also has its `cell_metadata`, even across a `BrtValueMeta` written in between. Clearing the other cells, and deciding from `fDynamic` whether to spill, is the consumer's call (gridcraft#3825).
- **Kept as values:** a formula that needs something the reader doesn't read keeps only its saved result, with a warning: user defined names (XLSB names aren't read yet), table references, other workbooks, `PY(index, …)` (code stored elsewhere in the package) and data tables. So do malformed tokens or records, and formulas past the allowance. A workbook whose links can't be read opens with values only, as before.

## Changed from the GridCraft PRs

- craft-xlsx's own function table, tree and printer, instead of GridCraft's formula crate and the table and helpers shared with its `.xls` decoder.
- A single-cell dynamic-array formula is read in commit 2, where #3818 left dynamic arrays to #3821: with `cell_metadata` there is nothing more to decide.
- The test of GridCraft's 8,192-character parser limit is replaced by one showing that a shared copy may be longer than its first cell. Tests that saved to `.xlsx` with GridCraft are dropped. The rest of the PRs' tests come along in `tests/xlsb.rs`, with craft-xlsx's model in the expectations.
- `Limits` gets a new public field, `binary_formula_text`. Code that builds `Limits` with `..Limits::default()` is unaffected.

## Checked against Excel

Excel saved the same workbook (`make_probe.ps1` in the GridCraft work: refs, 3-D refs, names, shared, CSE and dynamic arrays, newer functions, LET, a table, an external link, unions and intersections, array constants) as `.xlsb` and as `.xlsx`. Read through craft-xlsx, all 33 formulas this decodes from the `.xlsb` match the `.xlsx`: same text, kind, range and shared index, with the same cell metadata. The other 5 use tables, an external link or defined names, and keep their values with those warnings.

A second, wider round (commits 8 and 9) saved three more workbooks both ways:
- 487 functions Excel accepts on a worksheet: every name in the function table except 113 macro-sheet-only commands, and about 120 newer `_xlfn.` functions, LET, LAMBDA and its helpers, GROUPBY, the REGEX functions, `TRIMRANGE` and `A1:.A5`, IMAGE, RTD, CUBEVALUE and an add-in function;
- operators and precedence, unary and percent chains, unions, intersections, whole rows and columns, 3-D references and spans, quoted and cell-like sheet names, array constants, edge-magnitude numbers, a 255-character string, unicode, errors and missing arguments, legacy and dynamic-array `@`, references to a deleted sheet, column and row;
- 246 shared-formula cells, including relative references that wrap at the grid's edges, legacy array formulas, spills, spill references and a data table;
- 60 formulas typed with spaces and line breaks, and 62 number literals around Excel's switch to scientific notation.

Before commit 8, 725 formulas matched and 20 differed. Now 744 of the 745 match, with the same text, kind, range and cell metadata, and every non-first shared-formula cell matches Excel's own `Range.Formula`. The other one is a deleted column on a sheet named like a cell (`'S3'!#REF!`). That is #1330's: it prints the sheet before `#REF!`, which this PR doesn't. The spacing and number workbooks match in full. Two inline LAMBDA calls, an add-in call and a data table keep their saved results, as described above.

## Ran locally (own target directory)

- `cargo fmt -p craft-xlsx --check`: clean
- `cargo clippy -p craft-xlsx --all-targets --all-features -- -D warnings`: clean (and `cargo clippy --workspace --all-targets -- -D warnings` after commit 9)
- `cargo test -p craft-xlsx --all-features`: 74 pass, 0 fail (after commit 7); 76 after commit 9. No other workspace crate depends on craft-xlsx.
- The new tests fail without their commit's code: 5 of 6 for commit 3 (the sixth checks that unreadable shared formulas keep their values, which commit 2 already does), and 1 for commit 4. The tests for commits 8 and 9 fail without them.

## For the coordinator

Once this is merged, gridcraft#3810, #3818 and #3821 can be closed, each with a note like "Ported to craft-xlsx in storytold/craft-libs#1166; GridCraft gets it when it switches to craft-xlsx." GridCraft's remainder is the mapping. That means `from_file` and the implicit `@` (as for `.xlsx`), Python cells, clearing array cells, spilling dynamic arrays, the `xlsb-import.md` / `gaps.md` / `file-format-parity.md` notes and the engine's use of `read_xlsb_with`. I'll redo those against the switch.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Binary Excel workbooks now display decoded formula text in familiar spreadsheet notation, including shared and array formulas.
  * Shared-formula cells show formula text adjusted to their own cell references. Array-formula follower cells do not display separate formula text.
* **Bug Fixes**
  * When formulas cannot be decoded or exceed supported limits, cells retain their saved results; a warning may be provided.
* **Documentation**
  * Clarified formula display behavior and documented limits on formula text, token length, nesting depth, and array constants.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-15 12:11:39 +01:00
Dylan M. Taylor 2c7891db0e Adapt camera EXIF to shared TIFF and add bounded parity tests
Retain original contributor imports as authored commits. Reuse shared spans and writer, preserve field semantics, add text budget and differential controls.
2026-11-15 06:05:32 -05:00
Fabio Lussi ef3e23916f Carry PhotoCraft camera date and checked-bounds changes
Source: storytold/photocraft commit 1ccdac4c940ce43e2647f4c07fac1d61725e1f74
2026-11-15 06:05:32 -05:00
Brandon Thomas ec2b4976f5 Import original PhotoCraft camera EXIF module
Source: storytold/photocraft commit aa87012aab6d710b1e1d2ff1654a45e58c09d955
2026-11-15 06:05:32 -05:00
Dylan M. Taylor f29e82f1a7 Merge pull request #1467 from keithcsqueensu/rtf-writer-lookup-1466
craft-rtf: look up fonts, colours and authors through an index (#1466)
2026-11-15 06:03:00 -05:00
Dylan M. Taylor 390fe98b0d Merge pull request #1508 from storytold/codex/materialx-displacement-tiling
Preserve UV tiling from MaterialX displacement images
2026-11-15 06:02:13 -05:00
Dylan M. Taylor dd866b846c pcraft-format: validate tip inputs and zlib completion with parity tests 2026-11-15 05:58:40 -05:00
3401d0af8e pcraft-format: extract PhotoCraft brush tip envelope and samples
Port PhotoCraft preset_store.rs at 19aec5eb44131de44361189d64910e7b3e19e57c. Preserve original primary author and later codec contributions.

Co-authored-by: David Mann <daaavid.mann@gmail.com>

Co-authored-by: FinnNk <finnnk@gmail.com>
2026-11-15 05:58:00 -05:00
el-j 5628ad359d craft-image-codecs: Sun Raster image reader and writer
Adds Format::SunRaster: 1-, 8- (gray or colour-mapped), 24- and 32-bit
files, uncompressed or byte-encoded (RLE) on read, uncompressed on write.

Closes #1560
2026-11-15 11:49:53 +01:00
aiongg ebc8d95afd ui-canvas: the host's gesture keeps its button in its last pointer only 2026-11-15 10:47:36 +00:00
Dylan M. Taylor a8f2612c7c Test decoded HLG AVIF reference levels 2026-11-15 10:46:51 +00:00
aiongg 1b18c0b443 imaging select trials: injected input passes through the press arena as a hand's does
- marquee drag: the first move goes past the slop before the sub-pixel moves; the release elsewhere is a move there first
- lasso Alt clicks: Alt stays down across presses and releases, so the trial uses the hand's pointer and keyboard
- magnetic jump: the canvas is wide enough that the jump ends over it
- magnetic close on the start: the pointer reaches the start along the edge
2026-11-15 10:46:10 +00:00
el-j 2e3ff2162b craft-image-codecs: SGI image reader and writer
Adds Format::Sgi: 8- and 16-bit gray, gray+alpha, RGB and RGBA, verbatim
and run-length encoded on read, run-length encoded on write.
Palette-mapped files are reported as unsupported.

Closes #1559
2026-11-15 11:44:48 +01:00
aiongg c4e9efbe18 ui-canvas trials: Play's scripted line runs inside the shown document and the trial runs the injected steps to the end 2026-11-15 10:41:52 +00:00
Dylan M. Taylor 30b78d048a Preserve requested AVIF alpha quality 2026-11-15 10:41:10 +00:00
aiongg 6d76e1a994 color trials: the injected-move HUD trial imports ShowContainer for the canvas 2026-11-15 10:39:27 +00:00
Dylan M. Taylor 7581345a22 craft-update: do not self-update extracted nextest test binaries (#1503)
* fix(update): treat extracted nextest archives as development builds

* fix(update): match only binaries listed by bounded nextest inventory
2026-11-15 05:35:32 -05:00
Dylan M. Taylor 0f5b23b4de Merge pull request #1455 from storytold/pr-mailcraft-smime
feat: add craft-smime (S/MIME CMS/X.509/PKCS#12)
2026-11-15 05:34:46 -05:00
aiongg 83b8649a7d R76: tool-host injection rides the window host's injected lanes
ToolHost::inject hands each ToolInput to the window host's injected lane of the
canvas's viewport, one step per pass: presses, moves and releases as egui
pointer events (InjectedPointer), carrying the pen's reading, which the step's
pass reads in place of the tablet's; Hold/LetGo as steps with no event that the
lane holds (WindowHost::inject_hold, inject_let_go, injected_holds). The tool
reads its input from the canvas's press and the pass pointer as for a hand's,
so the Color HUD, hover and egui's button state see injected moves.

Held keys end where the lane drops input (withdrawal, focus loss, cancel, end
of the session). A held key's momentary command applies to the whole pass, as
the real key's does.

Removed: HostState.queued and injected_held, WindowHost::inject_pass and its
trial, the injected gesture path in the host (Active.injected, Run::injected,
pick_momentary), Momentary::press, ToolInput.clicks.

Trials: the injection trials run until injected_idle; new trials for a held
Space ended by a cancel, an injected pen reading, and the Color HUD picking at
an injected move.
2026-11-15 10:32:47 +00:00
aiongg e109644146 ui-canvas, draw: the fixture and trials that name their canvas import Props 2026-11-15 10:25:26 +00:00
aiongg 14d5ec609a cargo fmt 2026-11-15 10:23:21 +00:00
aiongg 144a157148 ui-canvas: a body names its canvas to the controls keyed by it; the canvas space's id stays internal (it exists only once the view settles) 2026-11-15 10:23:21 +00:00
Dylan M. Taylor 73149fe3e6 Preserve displacement image tiling in MaterialX 2026-11-15 10:20:02 +00:00
aiongg 69b10e5662 ui-contract trials: the gesture-note trial reads the dragger's id from its response 2026-11-15 10:18:10 +00:00
aiongg 6ece3ba5ce fwb1 review: Color HUD comment no longer claims ToolHost-injected moves stir the pass 2026-11-15 10:13:00 +00:00
aiongg 39835bdf73 fwb1 review: one key lookup for the key stage, binds_scoped and bound_around
Matcher::single matches one press without the double-press state; Matcher::press
builds on it. board.rs's KeyScopes (keymap + scopes around a chain -> Active ->
matcher) is the one lookup for the key stage, binds_scoped and bound_around,
which drop their own copies. bound_around reads the key through the viewport's
layout, routes the command as take_around does (Board::instance_around) and
returns it only when it resolves enabled (gate, modal, live); binds_scoped also
requires an enabled command. Fixture::gate sets the app gate in trials.
2026-11-15 10:13:00 +00:00
Dylan M. Taylor 2369c13f28 Merge remote-tracking branch 'origin/main' into HEAD 2026-11-15 10:12:11 +00:00
aiongg ab311ac3fa ui-contract: the in-place slot read hands its closure the slot or None, so a missing slot runs it once 2026-11-15 10:02:36 +00:00
aiongg abf606c36c fwb1 review: glossary rows for propose_with, gesture_note, hold/let_go, bound_around, Frames::over 2026-11-15 10:01:34 +00:00
aiongg cbb2138d0f fwb1 review: on_demand test removes its sparse file on drop 2026-11-15 10:01:34 +00:00
aiongg e2181367fe fwb1 review: propose_with sets the note only on an accepted proposal; gesture_note reads in place 2026-11-15 10:01:34 +00:00
aiongg 5ae2808984 fwb1 review: Show in Folder follows CAN_REVEAL as a command state 2026-11-15 10:01:34 +00:00
aiongg 80e4aa60d0 fwb1 review: file names keep their own names, only repeats are renamed 2026-11-15 10:01:34 +00:00
aiongg 692c7179ca ui-macros: derives look up the craft facade first and reach a renamed dependency by its name 2026-11-15 09:57:38 +00:00
Dylan M. Taylor 0c144b7d98 Merge pull request #1496 from storytold/fix/webp-animation-export
craft-webp: expose animated writer and avoid duplicate frame buffer
2026-11-15 04:45:59 -05:00
aiongg 993936f224 craft-imaging: LivePreview::settles_in, the time left until a preview settles (R25) 2026-11-15 09:45:03 +00:00
Dylan M. Taylor d594b6763b fix(svg): use normalized data URL error accounting 2026-11-15 04:32:18 -05:00
Dylan M. Taylor 586041bb68 fix(svg): preserve omission accounting on malformed data 2026-11-15 04:30:16 -05:00
aiongg cdd7b21702 ui-macros: derives name the framework through the facade when the app has no direct craft-ui dependency 2026-11-15 09:26:43 +00:00