-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Comparing changes
Open a pull request
base repository: Cocoanetics/DTCoreText
base: 2.0.0
head repository: Cocoanetics/DTCoreText
compare: 2.1.0
- 16 commits
- 43 files changed
- 2 contributors
Commits on Jun 11, 2026
-
Add HTML table support with NSTextTable-compatible model, layout and …
…round-trip Implements the full table pipeline for issue #1317, designed so the model can be swapped for the native NSTextBlock/NSTextTable/NSTextTableBlock classes when they arrive in UIKit with iOS 27: Model - Extend TextBlock (DTTextBlock) to the full NSTextBlock API: six dimensions with absolute/percentage value types, per-layer/per-edge widths, per-edge border colors and vertical alignment. The existing padding/backgroundColor convenience API keeps working; NSCoding stays readable by older versions. - Add TextTable and TextTableBlock mirroring their NS counterparts with identical enum raw values (verified against AppKit by parity tests). - TextTable/TextTableBlock compare by identity like the NS classes. This is load-bearing: Foundation uniques value-equal attribute dictionaries across attributed strings, so value equality bled shared instances between documents (covered by a concurrency stress test). - TextBlockConverter converts DT <-> NS losslessly on macOS, preserving instance identity; it is the swap point for iOS 27. - Border styles (solid/dashed/dotted/double) as a documented DT extension; NSTextBlock only models width and color. Parsing - table/tr/td/th/thead/tbody/tfoot/caption/col(group) produce the exact structure the macOS HTML importer produces (verified structurally against the live system importer): one paragraph run per cell, shared table and cell block instances, outermost-first nesting, no placeholder blocks for rowspan-covered positions, caption as centered paragraph outside the grid. - Maps colspan/rowspan, cellpadding/cellspacing, border, bgcolor on table/row/cell, valign, col widths, and CSS: per-edge borders with styles, 1-4 value border lists, thin/medium/thick, padding, width/min/max-width (percentages preserved), vertical-align, border-collapse, empty-cells, table-layout. Layout - CoreTextLayoutFrame lays out tables as grids: automatic column sizing (explicit widths win, natural widths propagate recursively out of nested tables, leftover width goes to flexible columns), fixed layout, rowspan- aware row heights, vertical alignment including true first-baseline alignment per the NSTextBlock documentation, justified cell text, and recursive nested tables. Flow continues below the table. - Backgrounds and per-edge borders draw from grid-computed cell frames in correct stacking order; dashed/dotted/double styles render. - border-collapse resolves boundaries to the wider border so collapsed tables draw a single-line grid (pixel-verified). - Block-run grouping switched from isEqual to instance identity, matching the system semantics; CoreTextParagraphStyle.textBlocks is now typed. Writing & SwiftUI - HTMLWriter emits table/tr/td with colspan/rowspan and inline CSS for widths, backgrounds, borders (incl. styles), padding and vertical-align; structure and styling round-trip through the parser, nested tables incl. - DTTextBlocksKey is a typed [TextBlock] AttributedString key; tables keep shared-instance identity through AttributedString and back. Docs, demo and verification - DocC article documents the empirically determined macOS representation (reproducible dump tool in Tools/TableInvestigation) and the DT layer. - Four demo app pages: Tables, Alignment, Widths, Borders. - 296 tests in 30 suites on macOS, 288 in 29 on the iOS simulator; render previews are written as PNGs on both platforms for visual inspection. - Fixes a pre-existing test race that mutated the shared default stylesheet. Closes #1317 except the iOS 27 SDK hookup, which waits on the SDK. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for de96898 - Browse repository at this point
Copy the full SHA de96898View commit details -
Paginate tables row by row in finite-height frames
The table layout path consumed the entire table range without checking the frame's maximum Y, so visibleStringRange() reported clipped rows as fitted and continuation frames skipped them. Tables now consume only the leading rows that fit within the frame: the consumed range is cut at the first cell of the first excluded row, the partial table draws without a bottom edge, and the remaining rows lay out as a grid in the continuation frame. A table that does not fit at all moves entirely to the next frame, and a frame that starts with a table taller than itself still consumes the first row so pagination always progresses (mirroring how a single oversized line behaves). Addresses the review feedback on PR #1318. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1201599 - Browse repository at this point
Copy the full SHA 1201599View commit details -
The Swift workflow still only triggered on the v2 branch, a leftover from the Swift migration that was merged into develop with #1316 — so pushes to develop and PRs targeting it ran no CI at all. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for bb2886a - Browse repository at this point
Copy the full SHA bb2886aView commit details -
Silence Sendable warnings on macOS CI
Restate @unchecked Sendable on TextTable and TextTableBlock (required for subclasses of a Sendable class) and move TextBlock's conformance onto the class declaration. Check the header font through the NSAttributedString conversion instead of the typed font subscript, whose NSFont/UIFont value type has an unavailable Sendable conformance. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 04f59b9 - Browse repository at this point
Copy the full SHA 04f59b9View commit details -
Merge pull request #1318 from Cocoanetics/claude/strange-mahavira-0c8954
Add HTML table support with NSTextTable-compatible model, layout and round-trip
Configuration menu - View commit details
-
Copy full SHA for a39bfb6 - Browse repository at this point
Copy the full SHA a39bfb6View commit details -
Support float:left/right for images and blocks with text wrapping
CSS float was parsed into DTHTMLElementFloatStyle but never used; floated images were forced to be their own block as a workaround. Floats are now laid out for real: - Floated content is marked with DTFloatStyleAttribute (plus DTFloatWidthAttribute for an explicit CSS width) and taken out of the normal flow during line building in CoreTextLayoutFrame. - A floated image becomes a box at the left/right content edge; a floated block (div, span, table) becomes a shrink-to-fit or fixed-width column laid out via the table cell flow, including its backgrounds and borders. - Text lines vertically intersecting a float region are narrowed and re-typeset until the assumed insets match the line's real extent; several floats on one side stack next to each other and move down when there is no room, and a float that does not fit a finite frame moves to the continuation frame. - The clear property (left/right/both) makes paragraphs and floats start below earlier floated content, via DTClearFloatsAttribute. - HTMLWriter round-trips floats: floated attachments get a wrapping span with the float style, floated block ranges become a div with float and width, and clear is emitted on paragraph styles. - New Floats.html demo snippet and a FloatLayoutTests suite covering attribute emission, wrap geometry, side-by-side floats, shrink-to-fit, clear, frame height, pagination and writer round-trips. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 552db60 - Browse repository at this point
Copy the full SHA 552db60View commit details
Commits on Jun 12, 2026
-
Honor line limits when floats are present
Float lines inflated typesetLines.count past the strict-equality truncation checks, so numberOfLines (and the lines-fitting retry) never fired after a leading float. Line limits now count only lines of the normal flow — floated content is out of the flow, like in CSS — and the checks tolerate jumps (>= instead of ==). The lines-fitting retry also captures the flow line count so a rebuild cannot recurse with a zero limit when only float lines exist. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4297325 - Browse repository at this point
Copy the full SHA 4297325View commit details -
Bridge text blocks and tables to the native UIKit classes on iOS 27
UIKit publishes NSTextBlock/NSTextTable/NSTextTableBlock with the iOS 27 SDK (Xcode 27, Swift 6.4), so TextBlockConverter now compiles there too: the same identity-preserving conversion as on macOS, plus attributed-string level methods that move the DTTextBlocks attribute onto native NSParagraphStyle.textBlocks (and back), so DTCoreText output can be handed straight to TextKit. Verified on the iOS 27 simulator: TextKit 1 lays out and renders the converted tables natively, and the system HTML reader and writer round-trip them. The 27 SDKs also change the AppKit text block enums from NSUInteger to NSInteger raw types; the converter and the AppKit parity tests now bridge raw values with numericCast so they compile with both Xcode 26 and 27. Also routes tvOS through the UIKit branch for CSS shadow offsets, fixing the tvOS build. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 507eac4 - Browse repository at this point
Copy the full SHA 507eac4View commit details -
Install the iOS simulator runtime on CI when the image lacks it
The macos-latest image only ships simulator runtimes for its default Xcode; after pinning Xcode 26.0 the test job found no iOS devices at all. Download the platform when no iPhone simulator is available before testing. Also clarify in the UIKit parity suite why the raw-value test needs no availability guard (the text block enums are available since iOS 6 in the 27 SDK; only the converter and per-edge accessors are 27-only). Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 708f5ab - Browse repository at this point
Copy the full SHA 708f5abView commit details -
Merge pull request #1319 from Cocoanetics/claude/blissful-bohr-9a9390
Support float:left/right for images and blocks with text wrapping
Configuration menu - View commit details
-
Copy full SHA for 1195831 - Browse repository at this point
Copy the full SHA 1195831View commit details -
Merge pull request #1320 from Cocoanetics/claude/heuristic-yalow-2d02b3
Bridge text blocks and tables to the native UIKit classes on iOS 27
Configuration menu - View commit details
-
Copy full SHA for a1023df - Browse repository at this point
Copy the full SHA a1023dfView commit details -
Support CSS border-spacing on tables
The parser only honored the legacy cellspacing attribute; the border-spacing property was ignored from any source, even though default.css declared it, and the writer never emitted cell spacing, so it was lost on every HTML round trip. - Parse border-spacing (one- and two-value forms) from the cascade, with browser precedence: border-collapse:collapse forces zero, CSS beats the cellspacing attribute, falling back to the 0.5pt margin importer default. Margins are now tracked per axis so asymmetric spacing lays out correctly. - Emit border-spacing on the table tag when the cells' margins differ from the default, so cellspacing/border-spacing survives writing. - Remove the dead border-spacing declaration from default.css: with the property now honored, the merged cascade would let it override every cellspacing attribute and the Apple-parity 0.5pt default. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c88dc9b - Browse repository at this point
Copy the full SHA c88dc9bView commit details -
Merge pull request #1321 from Cocoanetics/claude/lucid-montalcini-ae993c
Support CSS border-spacing on tables
Configuration menu - View commit details
-
Copy full SHA for 2497b97 - Browse repository at this point
Copy the full SHA 2497b97View commit details -
Depend only on XMLKit: drop SwiftText and the DocC plugin
DTCoreText only ever imported the HTMLParser module, which now lives in its own package (Cocoanetics/XMLKit, extracted from SwiftText with history). Depending on the HTMLParser product directly drops SwiftText, swift-markdown and swift-cmark from the graph, and no traits are needed anymore. swift-docc-plugin is gone too: Swift Package Index injects the plugin automatically when building hosted documentation (.spi.yml), Xcode builds the DocC catalog natively, and CI never generates docs. With it go SymbolKit and swift-argument-parser. Resolved dependencies shrink from five packages to one: xmlkit 1.0.1. Co-Authored-By: Claude Fable 5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4625810 - Browse repository at this point
Copy the full SHA 4625810View commit details -
Merge pull request #1322 from Cocoanetics/claude/gracious-austin-8b9b35
Depend only on XMLKit: drop SwiftText and the DocC plugin
Configuration menu - View commit details
-
Copy full SHA for 1575919 - Browse repository at this point
Copy the full SHA 1575919View commit details
Commits on Jun 13, 2026
-
CI: run on main after develop->main rename
Point push/pull_request triggers at main. Drop the v2 trigger; that branch no longer exists on the remote. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 870447c - Browse repository at this point
Copy the full SHA 870447cView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 2.0.0...2.1.0