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.

Favorites: Arc's "Drag to add Favorites" card in a space with none (#157) (#162)

Victor Kildahle80b51bf98e6
diff --git a/Packages/CraCore/Sources/CraCore/SidebarModel.swift b/Packages/CraCore/Sources/CraCore/SidebarModel.swift
index e371d65..b2feaa2 100644
--- a/Packages/CraCore/Sources/CraCore/SidebarModel.swift
+++ b/Packages/CraCore/Sources/CraCore/SidebarModel.swift
@@ -532,6 +532,9 @@ public struct WindowPrefs: Codable, Equatable {
public var sidebarWidth: Double = 328
public var expandedFolders: Set<UUID> = []
public var collapsedPinnedSpaces: Set<UUID> = []
+ /// Arc's topAppsEmptyStateDismissedForProfiles: favorites containers whose empty-state card
+ /// ("Drag to add Favorites") was closed with its ×. It stays closed.
+ public var favoritesEmptyStateDismissed: Set<UUID> = []
/// Closed folders that keep tabs in sight (FolderPeek): folder → its peeked tabs.
public var peekedFolders: [UUID: [UUID]] = [:]
/// Open browser windows, restored at launch. Never empty.
@@ -547,10 +550,12 @@ public struct WindowPrefs: Codable, Equatable {
public var littleWindowSize: String?
public init(sidebarWidth: Double = 328, expandedFolders: Set<UUID> = [], collapsedPinnedSpaces: Set<UUID> = [],
- peekedFolders: [UUID: [UUID]] = [:], windows: [WindowSession] = [WindowSession()], littleWindowSize: String? = nil) {
+ favoritesEmptyStateDismissed: Set<UUID> = [], peekedFolders: [UUID: [UUID]] = [:],
+ windows: [WindowSession] = [WindowSession()], littleWindowSize: String? = nil) {
self.sidebarWidth = sidebarWidth
self.expandedFolders = expandedFolders
self.collapsedPinnedSpaces = collapsedPinnedSpaces
+ self.favoritesEmptyStateDismissed = favoritesEmptyStateDismissed
self.peekedFolders = peekedFolders
self.windows = windows
self.littleWindowSize = littleWindowSize
@@ -645,6 +650,7 @@ extension WindowPrefs {
sidebarWidth = try c.decodeIfPresent(Double.self, forKey: .sidebarWidth) ?? 328
expandedFolders = try c.decodeIfPresent(Set<UUID>.self, forKey: .expandedFolders) ?? []
collapsedPinnedSpaces = try c.decodeIfPresent(Set<UUID>.self, forKey: .collapsedPinnedSpaces) ?? []
+ favoritesEmptyStateDismissed = try c.decodeIfPresent(Set<UUID>.self, forKey: .favoritesEmptyStateDismissed) ?? []
peekedFolders = (try? c.decodeIfPresent([UUID: [UUID]].self, forKey: .peekedFolders)) ?? [:]
if let saved = try? c.decodeIfPresent([WindowSession].self, forKey: .windows), !saved.isEmpty {
windows = saved
diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/windows.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/windows.json
index 468b3d3..a538d83 100644
--- a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/windows.json
+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/windows.json
@@ -1,5 +1,6 @@
{
"sidebarWidth": 280, "expandedFolders": ["D0000000-0000-0000-0000-000000000002"], "collapsedPinnedSpaces": ["A0000000-0000-0000-0000-000000000002"],
+ "favoritesEmptyStateDismissed": ["B0000000-0000-0000-0000-000000000002"],
"peekedFolders": ["D0000000-0000-0000-0000-000000000005", ["D0000000-0000-0000-0000-000000000004"]],
"littleWindowSize": "{480, 640}",
"windows": [
diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows-legacy.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows-legacy.json
index 6b9c874..845121f 100644
--- a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows-legacy.json
+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows-legacy.json
@@ -4,6 +4,9 @@
],
"expandedFolders" : [
+ ],
+ "favoritesEmptyStateDismissed" : [
+
],
"sidebarWidth" : 300,
"windows" : [
diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows.json
index 6cf9dbe..46ab5ad 100644
--- a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows.json
+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/windows.json
@@ -5,6 +5,9 @@
"expandedFolders" : [
"D0000000-0000-0000-0000-000000000002"
],
+ "favoritesEmptyStateDismissed" : [
+ "B0000000-0000-0000-0000-000000000002"
+ ],
"littleWindowSize" : "{480, 640}",
"peekedFolders" : [
"D0000000-0000-0000-0000-000000000005",
diff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swift
index 9de7ab9..b74663e 100644
--- a/Sources/Cra/Services/SidebarStore.swift
+++ b/Sources/Cra/Services/SidebarStore.swift
@@ -1145,6 +1145,7 @@ final class SidebarStore {
private func notifyItemReaders(of old: WindowPrefs) {
for id in old.expandedFolders.symmetricDifference(prefs.expandedFolders) { items.notify(id) }
for id in old.collapsedPinnedSpaces.symmetricDifference(prefs.collapsedPinnedSpaces) { items.notify(id) }
+ for id in old.favoritesEmptyStateDismissed.symmetricDifference(prefs.favoritesEmptyStateDismissed) { items.notify(id) }
for id in Set(old.peekedFolders.keys).union(prefs.peekedFolders.keys) where old.peekedFolders[id] != prefs.peekedFolders[id] {
items.notify(id)
}
@@ -1179,6 +1180,16 @@ final class SidebarStore {
if prefs.collapsedPinnedSpaces.remove(spaceID) == nil { prefs.collapsedPinnedSpaces.insert(spaceID) }
}
+ /// Arc's topAppsEmptyStateDismissedForProfiles: the × on the empty Favorites card closes it
+ /// for that set of favorites, for good.
+ func isFavoritesEmptyStateDismissed(_ favoritesID: UUID) -> Bool {
+ items.observe(favoritesID)
+ return _prefs.favoritesEmptyStateDismissed.contains(favoritesID)
+ }
+ func dismissFavoritesEmptyState(_ favoritesID: UUID) {
+ prefs.favoritesEmptyStateDismissed.insert(favoritesID)
+ }
+
// MARK: Live folders
var liveFolders: [SidebarItem] { items.values.filter(\.isLiveFolder) }
diff --git a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
index b0b3717..3480025 100644
--- a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
+++ b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift
@@ -416,8 +416,9 @@ enum MenuItems {
// MARK: - Favorites
/// Arc's "top apps": a 4-wide grid of favorite tiles, 8 pt apart, and under it a strip that
-/// opens into "Add to Favorites" while a tab is dragged over it. Arc shares them between
-/// spaces; in Cra every space has its own.
+/// opens into "Add to Favorites" while a tab is dragged over it. With none, Arc's empty-state
+/// card stands in for the tiles until its × closes it. Arc shares them between spaces; in Cra
+/// every space has its own.
final class FavoritesGridView: NSView {
private let spaceID: UUID
let store: SidebarStore
@@ -428,6 +429,8 @@ final class FavoritesGridView: NSView {
private var tiles: [UUID: FavoriteTileView] = [:]
private var order: [UUID] = []
private let strip = FavoritesDropStrip()
+ private let card = FavoritesEmptyCard()
+ private var favoritesID: UUID?
private(set) var palette: SpacePalette?
private var syncQueued = false
@@ -444,7 +447,14 @@ final class FavoritesGridView: NSView {
return true
}
strip.onTargetChange = { [weak self] _ in self?.onHeightChange(true) }
+ card.onDrop = strip.onDrop
+ card.onDismiss = { [weak self] in
+ guard let self, let id = self.favoritesID else { return }
+ self.store.dismissFavoritesEmptyState(id)
+ }
+ card.isHidden = true
addSubview(strip)
+ addSubview(card)
sync()
}
@@ -456,9 +466,12 @@ final class FavoritesGridView: NSView {
syncQueued = false
var models: [(UUID, FavoriteTileModel)] = []
var palette: SpacePalette?
+ var dismissed = true
withObservationTracking {
guard let space = store.space(spaceID) else { return }
palette = space.theme.palette
+ favoritesID = space.favoritesContainerID
+ dismissed = store.isIncognito(space: spaceID) || store.isFavoritesEmptyStateDismissed(space.favoritesContainerID)
// A favorite split is one tile with a cell per pane (Arc: AppItem.childItems).
for item in store.children(of: space.favoritesContainerID) where item.isTab || item.isSplit {
let panes = item.isSplit ? store.children(of: item.id).filter(\.isTab) : [item]
@@ -484,7 +497,9 @@ final class FavoritesGridView: NSView {
}
self.palette = palette
let ids = models.map(\.0)
- let countChanged = ids.count != order.count
+ let showsCard = ids.isEmpty && !dismissed
+ // Arc drops the card and moves the list up in one frame, like a first tile coming in.
+ let countChanged = ids.count != order.count || showsCard == card.isHidden
for (id, t) in tiles where !ids.contains(id) {
t.removeFromSuperview()
tiles[id] = nil
@@ -499,8 +514,11 @@ final class FavoritesGridView: NSView {
if let palette { t.show(m, palette: palette) }
}
order = ids
- if let palette { strip.palette = palette }
+ if let palette { strip.palette = palette; card.palette = palette }
strip.hasFavorites = !ids.isEmpty
+ // The card takes the strip's drops while it shows.
+ strip.isHidden = showsCard
+ card.isHidden = !showsCard
needsLayout = true
if countChanged { onHeightChange(false) }
}
@@ -509,12 +527,15 @@ final class FavoritesGridView: NSView {
private func grid(forWidth w: CGFloat) -> FavoritesLayout { FavoritesLayout(count: order.count, width: w) }
func height(forWidth w: CGFloat) -> CGFloat {
- grid(forWidth: w).gridHeight + (order.isEmpty ? 0 : 4) + strip.height
+ if !card.isHidden { return FavoritesEmptyCard.height }
+ return grid(forWidth: w).gridHeight + (order.isEmpty ? 0 : 4) + strip.height
}
- /// Where the header and list are placed from: the tiles' bottom, the open "Add to Favorites"
- /// strip's while a tab is dragged over it, nil with no favorites.
+ /// Where the header and list are placed from: the tiles' bottom (the empty-state card's
+ /// while it stands in for them), the open "Add to Favorites" strip's while a tab is dragged
+ /// over it, nil with no favorites.
func tilesBottom(forWidth w: CGFloat) -> CGFloat? {
+ if !card.isHidden { return FavoritesEmptyCard.height }
if strip.targeted { return height(forWidth: w) }
return order.isEmpty ? nil : grid(forWidth: w).gridHeight
}
@@ -532,6 +553,7 @@ final class FavoritesGridView: NSView {
let grid = grid(forWidth: w)
for (i, id) in order.enumerated() { tiles[id]?.frame = grid.frame(at: i) }
strip.frame = NSRect(x: 0, y: grid.gridHeight + (order.isEmpty ? 0 : 4), width: w, height: strip.height)
+ card.frame = NSRect(x: 0, y: 0, width: w, height: FavoritesEmptyCard.height)
}
func moveFavorite(_ dragged: UUID, before target: UUID, after: Bool) {
@@ -546,13 +568,50 @@ final class FavoritesGridView: NSView {
}
}
-/// The drop strip under the grid: 6–8 pt of nothing, 36 pt "Add to Favorites" while targeted.
-final class FavoritesDropStrip: NSView {
+/// Takes a sidebar item dropped on it into the favorites: the strip under the grid, or the
+/// empty-state card in its place.
+class FavoritesDropTarget: NSView {
var onDrop: (UUID) -> Bool = { _ in false }
var onTargetChange: (Bool) -> Void = { _ in }
var palette: SpacePalette? { didSet { refresh() } }
- var hasFavorites = true
private(set) var targeted = false { didSet { if targeted != oldValue { refresh(); onTargetChange(targeted) } } }
+
+ override init(frame: NSRect) {
+ super.init(frame: frame)
+ wantsLayer = true
+ registerForDraggedTypes([.craSidebarItem])
+ }
+
+ required init?(coder: NSCoder) { fatalError() }
+
+ func refresh() {}
+
+ private func draggedID(_ info: NSDraggingInfo) -> UUID? {
+ guard let data = info.draggingPasteboard.data(forType: .craSidebarItem),
+ let d = try? JSONDecoder().decode(SidebarDragItem.self, from: data) else { return nil }
+ return d.id
+ }
+
+ override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
+ guard draggedID(sender) != nil else { return [] }
+ targeted = true
+ return sender.draggingSourceOperationMask.contains(.move) ? .move : .copy
+ }
+ override func draggingUpdated(_ sender: NSDraggingInfo) -> NSDragOperation {
+ draggedID(sender) == nil ? [] : (sender.draggingSourceOperationMask.contains(.move) ? .move : .copy)
+ }
+ override func draggingExited(_ sender: NSDraggingInfo?) { targeted = false }
+ override func draggingEnded(_ sender: NSDraggingInfo) { targeted = false }
+ override func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
+ targeted = false
+ guard let id = draggedID(sender) else { return false }
+ return onDrop(id)
+ }
+}
+
+/// The drop strip under the grid: 6–8 pt of nothing, 36 pt "Add to Favorites" while targeted.
+final class FavoritesDropStrip: FavoritesDropTarget {
+ var hasFavorites = true
private let border = CAShapeLayer()
private let label = NSTextField.sidebarLabel(size: 11, weight: .medium)
@@ -560,7 +619,6 @@ final class FavoritesDropStrip: NSView {
override init(frame: NSRect) {
super.init(frame: frame)
- wantsLayer = true
layer?.cornerRadius = 10
border.fillColor = nil
border.lineWidth = 1
@@ -569,13 +627,12 @@ final class FavoritesDropStrip: NSView {
label.stringValue = "Add to Favorites"
label.alignment = .center
addSubview(label)
- registerForDraggedTypes([.craSidebarItem])
refresh()
}
required init?(coder: NSCoder) { fatalError() }
- private func refresh() {
+ override func refresh() {
guard let p = palette else { return }
let colors = SidebarColors(p)
border.strokeColor = colors.textTertiary.withAlphaComponent(targeted ? 0.6 : 0).cgColor
@@ -591,28 +648,139 @@ final class FavoritesDropStrip: NSView {
let lh = label.intrinsicContentSize.height
label.frame = NSRect(x: 0, y: (bounds.height - lh) / 2, width: bounds.width, height: lh)
}
+}
- private func draggedID(_ info: NSDraggingInfo) -> UUID? {
- guard let data = info.draggingPasteboard.data(forType: .craSidebarItem),
- let d = try? JSONDecoder().decode(SidebarDragItem.self, from: data) else { return nil }
- return d.id
+/// Arc's empty Favorites (Arc 1.171, live, 3 Nov, #157): a card where the tiles go, a star badge,
+/// "Drag to add Favorites" and a line on what they are, in the space's own ink. It takes a dragged
+/// tab, and its × (sidebarFavoritesEmptyStateDismissButton) closes it for good. Measured at 2x:
+/// the fill sits where the first tile would (8 pt in, 12 pt corners) and is 93.5 pt tall; a 1 pt
+/// dashed line (5.5 on, 4.5 off) runs just outside it; the header goes 4 pt further down than
+/// under a row of tiles. No hover state; a tab dragged over it makes the line solid, lightens the
+/// fill and dims the rest to half.
+final class FavoritesEmptyCard: FavoritesDropTarget {
+ static let fillHeight: CGFloat = 93.5
+ /// Where the header is placed from, like the tiles' bottom.
+ static let height: CGFloat = fillHeight + 4
+ var onDismiss: () -> Void = {}
+ private let fill = CAShapeLayer()
+ private let border = CAShapeLayer()
+ private let content = FlippedView()
+ private let badge = NSImageView()
+ private let title = NSTextField.sidebarLabel(size: 13, weight: .semibold)
+ private let subtitle = NSTextField(wrappingLabelWithString: "")
+ private let close = FavoritesEmptyCardClose()
+
+ override init(frame: NSRect) {
+ super.init(frame: frame)
+ layer?.masksToBounds = false
+ fill.lineWidth = 0
+ border.fillColor = nil
+ border.lineWidth = 1
+ for l in [fill, border] {
+ l.actions = ["path": NSNull(), "fillColor": NSNull(), "strokeColor": NSNull(), "lineDashPattern": NSNull()]
+ layer?.addSublayer(l)
+ }
+ content.wantsLayer = true
+ badge.imageScaling = .scaleNone
+ badge.wantsLayer = true
+ badge.shadow = NSShadow()
+ title.stringValue = "Drag to add Favorites"
+ title.alignment = .center
+ subtitle.font = .systemFont(ofSize: 11)
+ subtitle.maximumNumberOfLines = 2
+ close.onPress = { [weak self] in self?.onDismiss() }
+ for v in [badge, title, subtitle, close] { content.addSubview(v) }
+ addSubview(content)
+ refresh()
}
- override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
- guard draggedID(sender) != nil else { return [] }
- targeted = true
- return sender.draggingSourceOperationMask.contains(.move) ? .move : .copy
+ required init?(coder: NSCoder) { fatalError() }
+
+ override var isFlipped: Bool { true }
+ override var mouseDownCanMoveWindow: Bool { false }
+
+ override func refresh() {
+ guard let p = palette else { return }
+ let dark = p.isDark
+ // Arc's badge is the darkest ink on a light theme (the toolbar's shade) and the brightest on
+ // a dark one; the star inside takes the other end, with a glow of its colour on dark themes.
+ let ink = NSColor(dark ? p.textPrimary : p.toolbarFill)
+ let star = NSColor(dark ? p.toolbarFill : p.folderFill)
+ let text = dark ? NSColor.white.withAlphaComponent(0.85) : NSColor(p.textPrimary)
+ let lighter = targeted ? 0.32 : 0.14
+ fill.fillColor = (dark ? NSColor.black.withAlphaComponent(targeted ? 0 : 0.135) : NSColor.white.withAlphaComponent(lighter)).cgColor
+ border.strokeColor = ink.withAlphaComponent(0.3).cgColor
+ border.lineDashPattern = targeted ? nil : [5.5, 4.5]
+ content.alphaValue = targeted ? 0.5 : 1
+ badge.image = NSImage(systemSymbolName: "star.circle.fill", accessibilityDescription: nil)?
+ .withSymbolConfiguration(NSImage.SymbolConfiguration(pointSize: 16, weight: .regular)
+ .applying(NSImage.SymbolConfiguration(paletteColors: [star, ink])))
+ badge.shadow?.shadowColor = dark ? star : .clear
+ badge.shadow?.shadowBlurRadius = 6
+ title.textColor = text
+ let para = NSMutableParagraphStyle()
+ para.alignment = .center
+ para.minimumLineHeight = 15
+ para.maximumLineHeight = 15
+ subtitle.attributedStringValue = NSAttributedString(string: "Favorites keep your most used sites and apps close",
+ attributes: [.font: NSFont.systemFont(ofSize: 11), .paragraphStyle: para,
+ .foregroundColor: text.withAlphaComponent(text.alphaComponent * 0.7)])
+ close.color = text.withAlphaComponent(text.alphaComponent * 0.7)
+ needsLayout = true
}
- override func draggingUpdated(_ sender: NSDraggingInfo) -> NSDragOperation {
- draggedID(sender) == nil ? [] : (sender.draggingSourceOperationMask.contains(.move) ? .move : .copy)
+
+ override func layout() {
+ super.layout()
+ let w = bounds.width
+ let card = NSRect(x: 0, y: 0, width: w, height: Self.fillHeight)
+ fill.frame = bounds
+ border.frame = bounds
+ fill.path = CGPath(roundedRect: card, cornerWidth: 12, cornerHeight: 12, transform: nil)
+ border.path = CGPath(roundedRect: card.insetBy(dx: -0.5, dy: -0.5), cornerWidth: 12.5, cornerHeight: 12.5, transform: nil)
+ content.frame = card
+ // Arc's centres and frames, from the fill's top-left: badge centre 19.75 pt down, title 33.5–49.5,
+ // subtitle 53–83 (two 15 pt lines, 150 pt wide), × centred 15 pt in from the top-right corner.
+ let b = badge.image?.size ?? NSSize(width: 16, height: 16)
+ badge.frame = NSRect(x: ((w - b.width) / 2).rounded(.down), y: (19.75 - b.height / 2).rounded(), width: b.width, height: b.height)
+ title.frame = NSRect(x: 10, y: 33.5, width: max(0, w - 20), height: 16)
+ let sw = min(150, max(0, w - 20))
+ subtitle.frame = NSRect(x: ((w - sw) / 2).rounded(), y: 53, width: sw, height: 30)
+ close.frame = NSRect(x: w - 15 - 7, y: 15 - 7, width: 14, height: 14)
}
- override func draggingExited(_ sender: NSDraggingInfo?) { targeted = false }
- override func draggingEnded(_ sender: NSDraggingInfo) { targeted = false }
- override func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
- targeted = false
- guard let id = draggedID(sender) else { return false }
- return onDrop(id)
+}
+
+/// The card's ×: a plain glyph in the subtitle's tone, no hover fill (Arc).
+final class FavoritesEmptyCardClose: NSView {
+ var onPress: () -> Void = {}
+ var color: NSColor = .labelColor { didSet { glyph.contentTintColor = color } }
+ private let glyph = NSImageView()
+
+ override init(frame: NSRect) {
+ super.init(frame: frame)
+ glyph.image = SidebarSymbols.image("xmark", size: 10, weight: .semibold)
+ glyph.imageScaling = .scaleNone
+ glyph.autoresizingMask = [.width, .height]
+ addSubview(glyph)
+ setAccessibilityElement(true)
+ setAccessibilityRole(.button)
+ setAccessibilityLabel("Dismiss")
+ setAccessibilityIdentifier("sidebarFavoritesEmptyStateDismissButton")
+ }
+
+ required init?(coder: NSCoder) { fatalError() }
+
+ override func layout() {
+ super.layout()
+ glyph.frame = bounds
+ }
+
+ override var mouseDownCanMoveWindow: Bool { false }
+ override func hitTest(_ point: NSPoint) -> NSView? { frame.contains(point) ? self : nil }
+ override func mouseDown(with event: NSEvent) {}
+ override func mouseUp(with event: NSEvent) {
+ if bounds.contains(convert(event.locationInWindow, from: nil)) { onPress() }
}
+ override func accessibilityPerformPress() -> Bool { onPress(); return true }
}
/// What a favorite tile shows: one page, or a split's panes. Arc keeps a split in its top apps as
diff --git a/Tests/StoreTests.swift b/Tests/StoreTests.swift
index 8ef7042..f171914 100644
--- a/Tests/StoreTests.swift
+++ b/Tests/StoreTests.swift
@@ -1,4 +1,5 @@
import Foundation
+import Observation
import SQLite3
/// The production store and the Arc importer, booted through AppComposition with a manual
@@ -31,6 +32,7 @@ enum StoreTests {
moveTabToSpace()
folderPeek()
closeSuccessor()
+ favoritesEmptyState()
print("Store: \(checks) checks passed")
}
@@ -414,6 +416,28 @@ enum StoreTests {
expect(store.integrityProblems().isEmpty, "and the sidebar stays sound")
}
+ /// Arc's "Drag to add Favorites" card (#157): its × closes it for that space's favorites only,
+ /// for good, and readers see the change.
+ @MainActor
+ private static func favoritesEmptyState() {
+ let store = AppComposition(clock: ManualScheduler()).store
+ let home = store.focusedSpaceID
+ let work = store.createSpace(title: "Work", emoji: "💼", focus: false).id
+ guard let homeFavorites = store.space(home)?.favoritesContainerID,
+ let workFavorites = store.space(work)?.favoritesContainerID else { return expect(false, "both spaces have favorites") }
+ expect(!store.isFavoritesEmptyStateDismissed(homeFavorites), "a space starts with the card")
+ final class Flag: @unchecked Sendable { var on = false }
+ let changed = Flag()
+ withObservationTracking { _ = store.isFavoritesEmptyStateDismissed(homeFavorites) } onChange: { changed.on = true }
+ store.dismissFavoritesEmptyState(homeFavorites)
+ expect(changed.on && store.isFavoritesEmptyStateDismissed(homeFavorites), "the × closes it, and the grid hears about it")
+ expect(!store.isFavoritesEmptyStateDismissed(workFavorites), "another space keeps its card")
+ store.saveAll()
+ let restored = AppComposition(clock: ManualScheduler()).store
+ expect(restored.isFavoritesEmptyStateDismissed(homeFavorites) && !restored.isFavoritesEmptyStateDismissed(workFavorites),
+ "and it stays closed after a relaunch")
+ }
+
/// Move Tab to Space N (#86) and the command bar's Move Tab to <space>, like Arc's "Move to
/// Today in <space>": the tab goes to the top of the other space's Today, the window follows
/// it there with the tab selected, and the space it left opens another tab.
diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.md
index 3fe39d2..e3a8076 100644
--- a/docs/arc-reverse-engineering.md
+++ b/docs/arc-reverse-engineering.md
@@ -804,6 +804,27 @@ Observed live on a throwaway Today split (example.com | example.org), archived a
combinations of header × pinned × favorites to the pixel (SpaceColumnView.place, SpaceListView.layoutRows).
Left: Arc's header title sits ~1 pt lower and reads slightly larger than Cra's (fixed 1 Nov: 13 pt semibold, header fill 36 pt).
+### Favorites empty state (Arc 1.171, live, 3 Nov, issue #157)
+- [O] Offline two-space Arc (fake home, no favorites), sidebar 228 and 300 pt, 2x window captures. A profile with
+ no favorites shows a card where the tiles go (AX: `sidebarFavoritesCollectionView` holds it, ×
+ `sidebarFavoritesEmptyStateDismissButton` "Dismiss"; closing writes `topAppsEmptyStateDismissedForProfiles`).
+- [O] Geometry, from the first tile's top-left (8 pt in): fill 93.5 pt tall, the column's width, circular 12 pt
+ corners; a 1 pt dashed line just outside it (5.5 on, 4.5 off). The space header sits 4 pt lower than under a
+ row of tiles. Badge: a 16.2 pt circle (`star.circle.fill` 16 pt) centred 19.75 pt down; title 13 pt semibold,
+ frame 33.5–49.5, 10 pt in from both sides; subtitle 11 pt, two 15 pt lines in a frame 150 pt wide at both sidebar
+ widths, from 53 pt; × (`xmark` 10 pt semibold) centred 15 pt in from the top-right corner.
+- [O] Tones: the subtitle and × are the title colour at 70%; the line is the badge colour at 30%. Light theme:
+ badge = the toolbar's dark theme shade, star = a cream, fill = white ~0.14 over the sidebar. Dark: badge ≈
+ white 0.92, star = a dark theme blue with a soft glow of its colour around the badge, fill = black ~0.135.
+- [O] No hover state on the card or the ×. A tab dragged over it: the line turns solid, the fill lightens
+ (white ~0.32 on the light theme), everything inside drops to 50%. A drop puts the tab in as the first tile; the
+ × hides the card. Both change the layout in one frame (60 fps recording), no slide.
+- [O] A multi-tab selection's menu has no Add to Favorites (Copy Links, Share 2 Items…, Change Icon…, Mute, Open
+ in Split View, Duplicate, Move to, New Folder with 2 Items, Archive Tabs…).
+- [?] Not measured: the drag-over fill on a dark theme, coloured dark themes (the star's colour there), 1x.
+- Cra: FavoritesEmptyCard, dismissed per favorites container (WindowPrefs.favoritesEmptyStateDismissed, since
+ Cra's favorites are per space). Badge, title, subtitle and × land within 1 px of Arc's at 2x.
+
### Space header row (Arc 1.171, live, 1 Nov, issue #39)
- [O] At rest: the space icon, then the title; nothing else. A space with an emoji shows it (the issue's
Arc screenshot had none, most likely a space without an icon). Hovered: the row fills (white 0.10 on