Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Arc parity: the Boost editor's motion and code header, measured in Arc

Victor8878058e2189
diff --git a/Packages/CraCore/Sources/CraCore/Boost.swift b/Packages/CraCore/Sources/CraCore/Boost.swift
index 9979dd0..2be1562 100644
--- a/Packages/CraCore/Sources/CraCore/Boost.swift
+++ b/Packages/CraCore/Sources/CraCore/Boost.swift
@@ -110,3 +110,23 @@ public struct Boost: Codable, Equatable, Identifiable, Sendable {
private func fmt(_ v: Double) -> String { String(format: "%.3g", v) }
}
+
+/// How Arc 1.172.1's Boost editor moves (60 fps screen recordings of Victor's Arc, 7 Nov 2026).
+/// Opening: the panel is there at 85 % on the first frame and grows to full size in 0.28 s about
+/// the middle of its right edge, with no fade. Closing: gone from one frame to the next. Code
+/// widens it (183 → 480 pt, the left edge moving) in 0.35 s; Back narrows it in 0.13 s. All three
+/// follow an ease-out close to quadratic.
+public enum BoostEditorMotion {
+ public static let openScale = 0.85
+ public static let openDuration = 0.28
+ public static let widenDuration = 0.35
+ public static let narrowDuration = 0.13
+ /// The quadratic ease-out as a cubic Bézier's control points (x1, y1, x2, y2).
+ public static let easeOut = (0.25, 0.46, 0.45, 0.94)
+ /// The panel's anchor while it grows, in its own unit square from the bottom left.
+ public static let openAnchor = (x: 1.0, y: 0.5)
+
+ public static func resizeDuration(fromWidth old: Double, to new: Double) -> Double {
+ new == old ? 0 : new > old ? widenDuration : narrowDuration
+ }
+}
diff --git a/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift b/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift
index 30d78b3..2b6e34e 100644
--- a/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift
+++ b/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift
@@ -45,3 +45,17 @@ struct BoostTests {
#expect(Boost.fonts.count == 20 && Set(Boost.fonts).count == 20)
}
}
+
+/// Arc's Boost editor motion, from 60 fps recordings of Arc 1.172.1.
+struct BoostEditorMotionTests {
+ @Test func opensByGrowingFromItsRightEdge() {
+ #expect(BoostEditorMotion.openScale == 0.85 && BoostEditorMotion.openDuration == 0.28)
+ #expect(BoostEditorMotion.openAnchor.x == 1 && BoostEditorMotion.openAnchor.y == 0.5)
+ }
+
+ @Test func codeWidensSlowlyAndBackNarrowsQuickly() {
+ #expect(BoostEditorMotion.resizeDuration(fromWidth: 183, to: 480) == 0.35)
+ #expect(BoostEditorMotion.resizeDuration(fromWidth: 480, to: 183) == 0.13)
+ #expect(BoostEditorMotion.resizeDuration(fromWidth: 183, to: 183) == 0)
+ }
+}
diff --git a/Sources/Cra/UI/Boosts/BoostEditor.swift b/Sources/Cra/UI/Boosts/BoostEditor.swift
index c976ab6..078424e 100644
--- a/Sources/Cra/UI/Boosts/BoostEditor.swift
+++ b/Sources/Cra/UI/Boosts/BoostEditor.swift
@@ -47,6 +47,46 @@ final class BoostEditorController {
p.orderFront(nil)
panel = p
model = m
+ growIn(p, host)
+ }
+
+ private static var easeOut: CAMediaTimingFunction {
+ let (x1, y1, x2, y2) = BoostEditorMotion.easeOut
+ return CAMediaTimingFunction(controlPoints: Float(x1), Float(y1), Float(x2), Float(y2))
+ }
+
+ /// Arc's opening (BoostEditorMotion): drawn at 85 % and grown to full size about the middle of
+ /// its right edge. The window's shadow can't scale, so the content carries one meanwhile.
+ private func growIn(_ panel: NSPanel, _ view: NSView) {
+ view.wantsLayer = true
+ guard let layer = view.layer, !NSWorkspace.shared.accessibilityDisplayShouldReduceMotion else { return }
+ let b = view.bounds
+ let s = BoostEditorMotion.openScale
+ // The layer scales about its anchor point; move the pivot to the right edge's middle.
+ let dx = b.width * (BoostEditorMotion.openAnchor.x - layer.anchorPoint.x)
+ let dy = b.height * (BoostEditorMotion.openAnchor.y - layer.anchorPoint.y)
+ var t = CATransform3DMakeTranslation(dx, dy, 0)
+ t = CATransform3DScale(t, s, s, 1)
+ t = CATransform3DTranslate(t, -dx, -dy, 0)
+ panel.hasShadow = false
+ layer.shadowPath = CGPath(roundedRect: b, cornerWidth: 12, cornerHeight: 12, transform: nil)
+ layer.shadowColor = NSColor.black.cgColor
+ layer.shadowOpacity = 0.25
+ layer.shadowRadius = 10
+ layer.shadowOffset = CGSize(width: 0, height: -3)
+ CATransaction.begin()
+ CATransaction.setCompletionBlock { [weak panel, weak layer] in
+ layer?.shadowOpacity = 0
+ panel?.hasShadow = true
+ panel?.invalidateShadow()
+ }
+ let a = CABasicAnimation(keyPath: "transform")
+ a.fromValue = NSValue(caTransform3D: t)
+ a.toValue = NSValue(caTransform3D: CATransform3DIdentity)
+ a.duration = BoostEditorMotion.openDuration
+ a.timingFunction = Self.easeOut
+ layer.add(a, forKey: "craBoostGrow")
+ CATransaction.commit()
}
func close() {
@@ -75,9 +115,16 @@ final class BoostEditorController {
private func resize(width: CGFloat) {
guard let panel else { return }
var f = panel.frame
+ let duration = BoostEditorMotion.resizeDuration(fromWidth: f.width, to: width)
f.origin.x = f.maxX - width
f.size.width = width
- panel.setFrame(f, display: true, animate: true)
+ // Arc: Code widens the panel in 0.35 s, Back narrows it in 0.13 s, both easing out.
+ guard duration > 0, !NSWorkspace.shared.accessibilityDisplayShouldReduceMotion else { panel.setFrame(f, display: true); return }
+ NSAnimationContext.runAnimationGroup { ctx in
+ ctx.duration = duration
+ ctx.timingFunction = Self.easeOut
+ panel.animator().setFrame(f, display: true)
+ }
}
}
@@ -168,33 +215,46 @@ private struct BoostEditorView: View {
Divider().opacity(0.4)
if model.showingCode { code } else { controls }
}
+ // Arc lays the panel out at its final width and keeps it centred while the window
+ // widens or narrows, so both sides are clipped meanwhile.
+ .frame(width: model.showingCode ? 480 : 183)
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.background(RoundedRectangle(cornerRadius: 12, style: .continuous).fill(BoostStyle.panel))
.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
.environment(\.colorScheme, .light)
}
- private var header: some View {
- HStack(spacing: 0) {
- if model.showingCode {
- Button { model.setCode(false) } label: {
- Label("Back", systemImage: "arrow.left").font(.system(size: 13, weight: .semibold))
- }
- .buttonStyle(.plain).foregroundStyle(BoostStyle.ink).padding(.leading, 10)
- Spacer()
+ /// The code panel's header is only Back and the CSS / JS switch, centred (Arc 1.172.1).
+ @ViewBuilder private var header: some View {
+ if model.showingCode {
+ ZStack {
Picker("", selection: $model.codeIsJS) {
Text("CSS").tag(false)
Text("JS").tag(true)
}
.pickerStyle(.segmented).labelsHidden().frame(width: 92)
- Spacer()
- } else {
- Button { model.onClose() } label: {
- Image(systemName: "xmark.circle.fill").font(.system(size: 18)).foregroundStyle(Color(white: 0.6))
- .frame(width: 40, height: 40)
+ HStack {
+ Button { model.setCode(false) } label: {
+ Label("Back", systemImage: "arrow.left").font(.system(size: 13, weight: .semibold))
+ }
+ .buttonStyle(.plain).foregroundStyle(BoostStyle.ink).padding(.leading, 10)
+ Spacer()
}
- .buttonStyle(.plain).help("Done")
- Spacer(minLength: 0)
}
+ .frame(height: 40)
+ } else {
+ boostHeader
+ }
+ }
+
+ private var boostHeader: some View {
+ HStack(spacing: 0) {
+ Button { model.onClose() } label: {
+ Image(systemName: "xmark.circle.fill").font(.system(size: 18)).foregroundStyle(Color(white: 0.6))
+ .frame(width: 40, height: 40)
+ }
+ .buttonStyle(.plain).help("Done")
+ Spacer(minLength: 0)
Menu {
Button("Rename this Boost…") { rename() }
Button("Shuffle") { model.shuffle() }
diff --git a/docs/arc-parity.md b/docs/arc-parity.md
index b6eb6c1..f68d7c6 100644
--- a/docs/arc-parity.md
+++ b/docs/arc-parity.md
@@ -94,6 +94,13 @@ gains "New Profile".
- Command bar (⌘T / File ▸ New Tab…), 7 Nov 2026, 57 fps region recordings of both apps: Arc's bar is
there complete from one frame to the next, no fade or scale; Cra's too. Matches.
+- Boost editor, 7 Nov 2026, 60 fps recordings of both apps (BoostEditorMotion): Arc draws the panel at
+ 85 % on its first frame and grows it to full size in 0.28 s about the middle of its right edge, no fade;
+ it closes from one frame to the next. Code widens it 183 → 480 pt in 0.35 s with the 480 pt layout
+ centred and clipped on both sides meanwhile; Back narrows it in 0.13 s. Ease-out throughout. Cra
+ matches after this sweep (it had no opening animation and resized with AppKit's default). Arc's code
+ header is only Back and a centred CSS / JS switch; Cra had the boost's name and Undo there too.
+
Not re-measured in this sweep: earlier sessions measured the sidebar, command bar, split view,
Peek, Little Arc, PiP, folders, space dock, Library swipe, dialogs, toasts and toolbar against Arc
(docs/arc-reverse-engineering.md). New surfaces built from this list are matched to captures taken