Skip to content

Commit 6f09fcc

Browse files
Merge main into fix/issue-16534
2 parents 1c7322e + 43879d9 commit 6f09fcc

207 files changed

Lines changed: 6322 additions & 2347 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release-desktop.yml‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,13 @@ jobs:
253253
if [[ "${{ inputs.version }}" =~ -nightly\.[0-9]{8}\.[0-9]+$ ]]; then brand=nightly; fi
254254
node scripts/apply-web-brand-assets.ts "$brand" apps/server/dist/client
255255
256-
# The single-executable is built with a Node that supports --build-sea
257-
# (25.7+); the repo itself stays on the engines.node version. A native
258-
# build injects into the runner's own Node; a Windows target downloads its
259-
# node.exe.
256+
# Setup Vite+ selects the exact engines.node version from package.json.
257+
# Native builds embed that executable; cross-target builds download the
258+
# same version for their target.
260259
- name: Build CLI single-executable
261260
if: inputs.cli_archive
262261
shell: bash
263262
env:
264-
# The exact version, not a major: vp downloads it from nodejs.org/dist on
265-
# the runner, and only exact versions have a dist directory. Keep in
266-
# step with SEA_NODE_VERSION in apps/server/vite.config.ts.
267-
VP_NODE_VERSION: "26.8.2"
268263
# The executable bundles the server again, so it needs the same stamp
269264
# as release.yml's JS bundle.
270265
T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && inputs.release_channel || 'dev' }}

‎.pnpmfile.cjs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
// Release scripts stage their own installs with explicit architectures.
66
module.exports = {
77
hooks: {
8+
// `typescript` is @tsc-rs/typescript (the catalog entry). Its npm version (0.8.x) is outside
9+
// vite-plus-core's typescript peer range, so pnpm gave the vite-plus that @effect/vitest
10+
// imports apps/marketing's [email protected] instead, and tests loaded a second vitest.
11+
readPackage(pkg) {
12+
if (pkg.name === "@voidzero-dev/vite-plus-core" && pkg.peerDependencies?.typescript) {
13+
pkg.peerDependencies.typescript = "*";
14+
}
15+
return pkg;
16+
},
817
updateConfig(config) {
918
// oxlint-disable-next-line t3code/no-global-process-runtime -- pnpm loads this file before any Effect runtime exists.
1019
if (process.platform !== "win32") return config;

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
100100

101101
- Before you push, run `vp run check:changed`. It runs CI's fast checks for changed files: format, lint, knip, typecheck of affected packages and dependents, and tests beside changes. CI still runs the full test suites.
102102
- While you iterate, run `vp test run <files>`. For big files, add `-t "<name>"`.
103-
- Do not use `npx tsc`. Use `vp run typecheck`; it uses tsc-rs, which is 3x faster.
103+
- Use `vp run typecheck`, not `npx tsc`; it caches per package. Both run tsc-rs (`typescript` is the `@tsc-rs/typescript` drop-in).
104104
- Run `node -e` snippets from `apps/server` or the owning package. `effect` does not resolve from the repo root.
105105
- Test meaningful logic or observable behavior. Do not render components to static markup to assert props or attributes, or add tests that merely assert callback wiring or mirror the implementation.
106106
- **Do not run repo-wide checks.** No `vp check`, no `vp run -r test`, no `vp run -r typecheck` unless I ask. CI owns the full suite.

‎apps/desktop/vite.config.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export default defineConfig({
4343
dependsOn: ["t3#build"],
4444
cache: false,
4545
},
46-
// tsc-rs rewrites the tsbuildinfo it reads, which keeps a task out of the cache.
46+
// tsc (tsc-rs) rewrites the tsbuildinfo it reads, which keeps a task out of the cache.
4747
typecheck: {
48-
command: "tsc-rs --noEmit",
48+
command: "tsc --noEmit",
4949
cache: { input: [{ auto: true }, "!*.tsbuildinfo"] },
5050
},
5151
},
-765 KB
Binary file not shown.
769 KB
Binary file not shown.

‎apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift‎

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private struct ComposerTokenPayload: Decodable {
1313
let end: Int
1414
}
1515

16-
private struct ComposerSelectionPayload: Decodable {
16+
private struct ComposerSelectionPayload: Decodable, Equatable {
1717
let start: Int
1818
let end: Int
1919
}
@@ -449,6 +449,9 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
449449
private var tokensNeedRebuild = false
450450
private var chipsNeedMeasuredWidth = false
451451
private var hasDeferredForcedRebuild = false
452+
private var pendingContentOffset: CGPoint?
453+
private var needsSelectionReveal = false
454+
private var selectionBeforeFocusingTap: (selection: ComposerSelectionPayload, value: String)?
452455

453456
let onComposerChange = EventDispatcher()
454457
let onComposerSelectionChange = EventDispatcher()
@@ -520,6 +523,12 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
520523
@objc private func openContext(_ recognizer: UITapGestureRecognizer) {
521524
guard let (index, attachment) = contextAttachment(at: recognizer.location(in: textView)) else {
522525
textView.becomeFirstResponder()
526+
if selectionBeforeFocusingTap != nil {
527+
// UIKit places the caret from its own tap recognizer during this same touch.
528+
DispatchQueue.main.async { [weak self] in
529+
self?.restoreSelectionBeforeFocusingTap()
530+
}
531+
}
523532
return
524533
}
525534
openContext(index: index, attachment: attachment)
@@ -558,7 +567,11 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
558567
}
559568

560569
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
561-
true
570+
// The collapsed editor only shows the draft's first line, so a tap that expands an
571+
// overflowing draft returns to the caret it was left at instead of moving it there.
572+
let collapsedOverflow = !textView.isFirstResponder && !textView.isScrollEnabled && draftOverflowsBounds()
573+
selectionBeforeFocusingTap = collapsedOverflow ? (sourceSelection(), value) : nil
574+
return true
562575
}
563576

564577
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
@@ -583,11 +596,27 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
583596

584597
public override func layoutSubviews() {
585598
super.layoutSubviews()
599+
let previousSize = textView.bounds.size
586600
textView.frame = bounds
587601
if chipsNeedMeasuredWidth, bounds.width > 0 {
588602
chipsNeedMeasuredWidth = false
589603
applyControlledDocument(force: true)
590604
}
605+
if textView.isScrollEnabled, bounds.width > 0, bounds.height > 0 {
606+
textView.layoutIfNeeded()
607+
if let offset = pendingContentOffset {
608+
let minY = -textView.adjustedContentInset.top
609+
let maxY = max(minY, textView.contentSize.height - bounds.height + textView.adjustedContentInset.bottom)
610+
textView.setContentOffset(CGPoint(x: offset.x, y: min(maxY, max(minY, offset.y))), animated: false)
611+
pendingContentOffset = nil
612+
}
613+
if needsSelectionReveal || (previousSize != bounds.size && textView.isFirstResponder) {
614+
needsSelectionReveal = false
615+
if let selection = textView.selectedTextRange {
616+
textView.scrollRectToVisible(textView.caretRect(for: selection.end), animated: false)
617+
}
618+
}
619+
}
591620
let placeholderX = textView.textContainerInset.left + textView.textContainer.lineFragmentPadding
592621
let placeholderY = textView.textContainerInset.top
593622
let placeholderWidth = max(
@@ -632,10 +661,12 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
632661
tokens = decode([ComposerTokenPayload].self, from: document.tokensJson) ?? []
633662
tokensNeedRebuild = true
634663
}
664+
let previousSelection = sourceSelection()
635665
value = document.value
636666
requestedSelection = document.selection
637667
applyControlledDocument(force: tokensNeedRebuild)
638668
applyRequestedSelection()
669+
cancelFocusingTapRestoreIfSelectionMoved(from: previousSelection)
639670
if tokensMatchCurrentValue() {
640671
tokensNeedRebuild = false
641672
}
@@ -694,7 +725,16 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
694725
}
695726

696727
func setScrollEnabled(_ scrollEnabled: Bool) {
728+
guard textView.isScrollEnabled != scrollEnabled else { return }
729+
if !scrollEnabled {
730+
// Disabling scrolling discards UITextView's offset. Restore it after
731+
// expansion has laid out the text, regardless of prop update order.
732+
pendingContentOffset = pendingContentOffset ?? textView.contentOffset
733+
}
697734
textView.isScrollEnabled = scrollEnabled
735+
if scrollEnabled {
736+
revealSelectionAfterLayout()
737+
}
698738
}
699739

700740
func setAutoFocus(_ autoFocus: Bool) {
@@ -738,8 +778,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
738778
}
739779

740780
func setSelection(start: Int, end: Int) {
781+
let previousSelection = sourceSelection()
741782
requestedSelection = ComposerSelectionPayload(start: start, end: end)
742783
applyRequestedSelection()
784+
cancelFocusingTapRestoreIfSelectionMoved(from: previousSelection)
743785
}
744786

745787
public func textViewDidChange(_ textView: UITextView) {
@@ -811,6 +853,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
811853
}
812854

813855
public func textViewDidBeginEditing(_ textView: UITextView) {
856+
revealSelectionAfterLayout()
814857
onComposerFocus()
815858
}
816859

@@ -836,13 +879,21 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
836879
hasDeferredForcedRebuild = false
837880

838881
let previousSelection = sourceSelection()
882+
if textView.isScrollEnabled {
883+
pendingContentOffset = pendingContentOffset ?? textView.contentOffset
884+
}
839885
isApplyingControlledValue = true
840886
textView.attributedText = makeAttributedDocument()
841887
let targetSelection = requestedSelection ?? previousSelection
842888
requestedSelection = nil
843889
textView.selectedRange = displayRange(for: targetSelection)
844890
restoreBaseTypingAttributes()
845891
isApplyingControlledValue = false
892+
if currentSource != value || previousSelection.start != targetSelection.start || previousSelection.end != targetSelection.end {
893+
revealSelectionAfterLayout()
894+
} else {
895+
setNeedsLayout()
896+
}
846897
updatePlaceholderVisibility()
847898
emitContentSizeIfNeeded()
848899
}
@@ -1053,6 +1104,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
10531104
return
10541105
}
10551106
value = textView.serializedText()
1107+
revealSelectionAfterLayout()
10561108
let selection = sourceSelection()
10571109
nativeEventCount += 1
10581110
onComposerChange([
@@ -1122,6 +1174,40 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
11221174
isApplyingControlledValue = true
11231175
textView.selectedRange = nextRange
11241176
isApplyingControlledValue = false
1177+
revealSelectionAfterLayout()
1178+
}
1179+
1180+
private func restoreSelectionBeforeFocusingTap() {
1181+
guard let snapshot = selectionBeforeFocusingTap else {
1182+
return
1183+
}
1184+
selectionBeforeFocusingTap = nil
1185+
// A draft that changed during the touch, such as a transcript landing, owns the caret now.
1186+
guard textView.isFirstResponder, textView.markedTextRange == nil, value == snapshot.value else {
1187+
return
1188+
}
1189+
let range = displayRange(for: snapshot.selection)
1190+
guard !NSEqualRanges(range, textView.selectedRange) else {
1191+
return
1192+
}
1193+
textView.selectedRange = range
1194+
revealSelectionAfterLayout()
1195+
}
1196+
1197+
private func cancelFocusingTapRestoreIfSelectionMoved(from previousSelection: ComposerSelectionPayload) {
1198+
if sourceSelection() != previousSelection {
1199+
selectionBeforeFocusingTap = nil
1200+
}
1201+
}
1202+
1203+
private func draftOverflowsBounds() -> Bool {
1204+
let size = textView.sizeThatFits(CGSize(width: textView.bounds.width, height: .greatestFiniteMagnitude))
1205+
return size.height > textView.bounds.height + 1
1206+
}
1207+
1208+
private func revealSelectionAfterLayout() {
1209+
needsSelectionReveal = true
1210+
setNeedsLayout()
11251211
}
11261212

11271213
private func updatePlaceholderVisibility() {

‎apps/mobile/modules/t3-native-controls/ios/T3LayoutMetricsView.swift‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ final class T3LayoutMetricsView: ExpoView {
6969
}
7070
var verticalBarEdge = "none"
7171
var regions: [[String: Any]] = []
72+
var bottomBarInset: CGFloat?
7273
#if canImport(UIKit, _version: 9127.0.85)
7374
if #available(iOS 27.1, *) {
7475
let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
@@ -77,6 +78,8 @@ final class T3LayoutMetricsView: ExpoView {
7778
case .trailing: verticalBarEdge = rtl ? "left" : "right"
7879
default: break
7980
}
81+
// Where UIKit floats a bar as tall as the app's bottom controls, level with its tab bar.
82+
bottomBarInset = edgeInsets(for: .bar(onEdge: UIRectEdge.bottom, extent: 48)).bottom
8083
for kind in [UIView.ReservedRegion.Kind.division, .occlusion] {
8184
for region in reservedRegions(kind: kind) where region.isActive {
8285
let frame = region.frame.intersection(bounds)
@@ -90,7 +93,7 @@ final class T3LayoutMetricsView: ExpoView {
9093
}
9194
}
9295
#endif
93-
let metrics: [String: Any] = [
96+
var metrics: [String: Any] = [
9497
"width": bounds.width, "height": bounds.height,
9598
"hasHinge": hasHinge,
9699
"horizontalSizeClass": traitCollection.horizontalSizeClass == .regular ? "regular" : "compact",
@@ -101,6 +104,7 @@ final class T3LayoutMetricsView: ExpoView {
101104
],
102105
"reservedRegions": regions,
103106
]
107+
metrics["bottomBarInset"] = bottomBarInset
104108
let next = metrics as NSDictionary
105109
guard lastMetrics?.isEqual(next) != true else { return }
106110
lastMetrics = next

‎apps/mobile/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"measure-renders": "node scripts/measure-renders.mts",
4646
"generate": "node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON scripts/generate-uniwind-themes.mts",
4747
"test": "vp test run --project unit --project react",
48-
"typecheck": "tsc-rs --noEmit"
48+
"typecheck": "tsc --noEmit"
4949
},
5050
"dependencies": {
5151
"@clerk/expo": "catalog:",
@@ -134,7 +134,7 @@
134134
"react-native-pdf-jsi": "5.0.0",
135135
"react-native-reanimated": "4.7.1",
136136
"react-native-safe-area-context": "~5.10.1",
137-
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.30.tgz",
137+
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.36.tgz",
138138
"react-native-shiki-engine": "^0.3.12",
139139
"react-native-svg": "15.16.0",
140140
"react-native-webview": "14.0.1",

0 commit comments

Comments
 (0)