Add Character Streaming text animation - #150
Open
Mahyar (Mac) McDonald (theontho) wants to merge 7 commits into
Open
Add Character Streaming text animation#150Mahyar (Mac) McDonald (theontho) wants to merge 7 commits into
Mahyar (Mac) McDonald (theontho) wants to merge 7 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace suffix fading with a one-grapheme attributed streaming pipeline, adaptive cadence, full platform transforms, selectable sample styles, and deterministic coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a649c2f7-fe53-4216-9f15-b5aa7237934a
Scope terminal withholding to the structural tail paragraph, preserve scheduler deadlines and fade completion, keep streaming measurement bounded, support live Reduce Motion changes, and align UIKit/AppKit transforms. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a649c2f7-fe53-4216-9f15-b5aa7237934a
Compare streamed replacements by exact UTF-16, clamp released offsets to grapheme boundaries, preserve Fade in attachment table cells, and update the public animation example. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a649c2f7-fe53-4216-9f15-b5aa7237934a
Preserve release cadence across drained queues, coalesce contextual glyph clusters, and render true bitmap blur before the sharp crossfade on UIKit and AppKit. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 78f1a116-c298-4c20-8669-dcded414d291
Mahyar (Mac) McDonald (theontho)
marked this pull request as ready for review
July 17, 2026 22:52
Copilot started reviewing on behalf of
Mahyar (Mac) McDonald (theontho)
July 17, 2026 22:53
View session
There was a problem hiding this comment.
Pull request overview
Adds a new explicit streamed-text animation API (.none, .fade, .characterStreaming) and implements character-by-character streaming using TextKit so streamed Markdown updates appear smoother while preserving attributed rendering, interaction, layout, and accessibility across iOS and macOS.
Changes:
- Replaces the previous boolean animation flag with
MarkdownRenderConfig.TextAnimationand updates builders/docs/sample to use the new API. - Implements Character Streaming state/scheduling and custom TextKit glyph rendering (rise/scale/blur→sharp/fade) for UIKit/AppKit paragraph views.
- Threads stream-completion and “tail branch” environment signals through the render tree so only the correct trailing paragraph withholds/drains the terminal grapheme, and adds/updates tests accordingly.
Show a summary per file
| File | Description |
|---|---|
| Sources/MarkdownText/Models/MarkdownRenderConfig.swift | Introduces TextAnimation enum and updates config initialization/defaults. |
| Sources/MarkdownText/Models/MarkdownRenderConfig+Builders.swift | Updates builder API to withTextAnimation and adjusts config propagation (needs follow-up fixes). |
| Sources/MarkdownText/UI/Paragraph/ParagraphAnimation.swift | Adds shared constants and core Character Streaming state/logic. |
| Sources/MarkdownText/UI/Paragraph/CharacterStreamingLayoutManager.swift | Adds custom layout manager to render per-glyph transforms including blur crossfade. |
| Sources/MarkdownText/UI/Paragraph/UIKit/ParagraphUIView.swift | Implements TextKit-driven fade/character-streaming in UITextView, plus reuse/animation lifecycle. |
| Sources/MarkdownText/UI/Paragraph/AppKit/ParagraphNSView.swift | Implements TextKit-driven fade/character-streaming in NSTextView. |
| Sources/MarkdownText/UI/Paragraph/UIKit/ParagraphView+iOS.swift | Wires environment (reduce motion/stream completion/tail) into UIKit paragraph view and updates size caching. |
| Sources/MarkdownText/UI/Paragraph/AppKit/ParagraphView+macOS.swift | Wires environment (reduce motion/stream completion/tail) into AppKit paragraph view and updates size caching. |
| Sources/MarkdownText/UI/Paragraph/ParagraphViewCache.swift | Extends caching to reuse views appropriate for character streaming support. |
| Sources/MarkdownText/UI/BlockView.swift | Propagates tail-branch environment down the renderable tree. |
| Sources/MarkdownText/UI/OrderedListView.swift | Propagates tail-branch environment through ordered list children. |
| Sources/MarkdownText/UI/UnorderedListView.swift | Propagates tail-branch environment through unordered list children. |
| Sources/MarkdownText/UI/DocumentView.swift | Resets view identity when animation mode changes; adds env keys for stream completion and tail-branch. |
| Sources/MarkdownText/StreamedMarkdownView.swift | Publishes and injects stream completion state into the environment. |
| Sources/MarkdownText/UI/TableView.swift | Refactors table cell rendering to route animation correctly, including attachment-specific behavior. |
| Tests/MarkdownTextTests/ParagraphAnimationTests.swift | New unit tests covering Character Streaming state, transforms, and invariants. |
| Tests/MarkdownTextTests/ParagraphViewTests.swift | Adds UIKit integration tests for character streaming, accessibility, sizing, and rendering metrics. |
| Tests/MarkdownTextTests/ParagraphNSViewTests.swift | Adds AppKit integration tests mirroring UIKit behavior. |
| Tests/MarkdownTextTests/CharacterStreamingRenderTestSupport.swift | Adds image-metrics helpers used by blur/alpha tests. |
| Tests/MarkdownTextTests/TableViewTests.swift | Adds mapping test for table attachment animation behavior. |
| README.md | Updates usage example to new withTextAnimation API. |
| Examples/SwiftStreamingMarkdownSample/* | Adds settings/UI to select streaming animation and makes Character Streaming the sample default. |
| Sources/MarkdownText/TextTransition/* | Removes prior SwiftUI text-transition-based fade implementation. |
Review details
- Files reviewed: 30/30 changed files
- Comments generated: 3
- Review effort level: Low
Settle detached paragraph animations, preserve image configuration across builders, and bound glyph blur rendering work with coherent per-release caches. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 78f1a116-c298-4c20-8669-dcded414d291
Mahyar (Mac) McDonald (theontho)
marked this pull request as draft
July 19, 2026 21:41
Character Streaming no longer uses the per-word animation utility, leaving it unreachable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 78f1a116-c298-4c20-8669-dcded414d291
Mahyar (Mac) McDonald (theontho)
marked this pull request as ready for review
July 19, 2026 22:18
Contributor
|
I'll take a look. The attached video has some noticeable rendering defects(for example, look at the baseline of "Heading", and the 3rd line's render position jittered during streaming) that could be relevant to the new layout. |
Contributor
|
Having Copilot to look for a simpler approach in #152 without entirely swapping to custom layout manager. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Screen.Recording.2026-07-17.at.9.36.35.AM.mov
Add Character Streaming as an explicit Markdown text-animation mode that smooths chunky server updates while preserving attributed rendering, interaction, layout, and accessibility.
.none,.fade, and.characterStreaming, without compatibility aliasesCloses #149
Validation
make lint— 137 files, 0 violationsParagraphAnimationTestsandParagraphViewTests— 39 tests passedParagraphAnimationTestsandParagraphNSViewTests— 31 tests passedmake test— 116 XCTest tests and 39 Swift Testing tests passedmake build-sample— succeededOSS readiness