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: Boosts (New Boost, the editor, Zap, CSS/JS code, Library ▸ Boosts)
Victor415ff0e23446
diff --git a/Packages/CraCore/Sources/CraCore/Boost.swift b/Packages/CraCore/Sources/CraCore/Boost.swiftnew file mode 100644index 0000000..9979dd0--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/Boost.swift@@ -0,0 +1,112 @@+import Foundation++/// Arc's Boosts (Arc 1.172.1, its editor captured on 7 Nov 2026; docs/arc-parity.md "Boosts,+/// measured"): a site's own restyle, kept per host. The editor's controls, top to bottom: a colour+/// wheel (a tint: hue round the wheel, strength out from the middle), Invert lightness, Advanced+/// colour controls (Contrast, Brightness, Original Saturation, 0–100, 50 = as the site is), Reset+/// colours, a grid of 20 fonts, Size, Case, Zap (hide what you click) and Code (your own CSS and JS).+public struct Boost: Codable, Equatable, Identifiable, Sendable {+ public var id: UUID+ /// The site it applies to: a host, without "www.".+ public var host: String+ public var name: String+ public var enabled: Bool+ /// The tint: hue 0–1 round the wheel, strength 0–1 out from the middle (0: no tint).+ public var hue: Double+ public var strength: Double+ public var invert: Bool+ public var contrast: Double+ public var brightness: Double+ public var saturation: Double+ /// One of `fonts` by index, nil for the site's own.+ public var font: Int?+ /// Text size, 1 = the site's own.+ public var textScale: Double+ public var textCase: TextCase+ /// CSS selectors of what Zap hid.+ public var zapped: [String]+ public var css: String+ public var js: String++ public enum TextCase: String, Codable, CaseIterable, Sendable {+ case none, upper, lower, capitalize+ public var title: String {+ switch self {+ case .none: "As Is"+ case .upper: "UPPERCASE"+ case .lower: "lowercase"+ case .capitalize: "Title Case"+ }+ }+ }++ public init(id: UUID = UUID(), host: String, name: String = "My Boost") {+ self.id = id+ self.host = Self.siteHost(host)+ self.name = name+ enabled = true+ hue = 0; strength = 0; invert = false+ contrast = 50; brightness = 50; saturation = 50+ font = nil; textScale = 1; textCase = .none+ zapped = []; css = ""; js = ""+ }++ /// The 20 fonts of the editor's grid (Arc ships its own; these are the Mac's), 5 to a row.+ public static let fonts = [+ "-apple-system", "ui-rounded", "ui-serif", "ui-monospace", "Helvetica Neue",+ "Avenir Next", "Futura", "Gill Sans", "Optima", "Georgia",+ "Palatino", "Baskerville", "Didot", "American Typewriter", "Menlo",+ "Snell Roundhand", "Copperplate", "Chalkboard SE", "Rockwell", "Marker Felt",+ ]++ /// The host a boost is keyed by: lowercased, "www." dropped.+ public static func siteHost(_ host: String) -> String {+ let h = host.lowercased()+ return h.hasPrefix("www.") ? String(h.dropFirst(4)) : h+ }++ /// The boost for a page, if one applies: same host, or a subdomain of it.+ public static func applying(to url: String, from boosts: [Boost]) -> [Boost] {+ guard let host = URL(string: url)?.host.map(siteHost) else { return [] }+ return boosts.filter { $0.enabled && (host == $0.host || host.hasSuffix("." + $0.host)) }+ }++ /// Whether the editor's colour controls are at the site's own colours.+ public var colorsUntouched: Bool { strength == 0 && !invert && contrast == 50 && brightness == 50 && saturation == 50 }++ /// The stylesheet the page gets.+ public var stylesheet: String {+ var rules: [String] = []+ var filters: [String] = []+ if invert { filters.append("invert(1) hue-rotate(180deg)") }+ if strength > 0 {+ // A tint: the page washed toward the hue, as much as the handle is out from the middle.+ filters.append("sepia(\(fmt(strength)))")+ filters.append("hue-rotate(\(fmt(hue * 360 - 38))deg)")+ filters.append("saturate(\(fmt(1 + strength * 2)))")+ }+ if contrast != 50 { filters.append("contrast(\(fmt(contrast / 50)))") }+ if brightness != 50 { filters.append("brightness(\(fmt(brightness / 50)))") }+ if saturation != 50 { filters.append("saturate(\(fmt(saturation / 50)))") }+ if !filters.isEmpty {+ rules.append("html { filter: \(filters.joined(separator: " ")) !important; }")+ // Pictures and video keep their own colours under an inverted page.+ if invert { rules.append("img, video, picture, canvas, iframe, svg image { filter: invert(1) hue-rotate(180deg) !important; }") }+ }+ if let font, Self.fonts.indices.contains(font) {+ rules.append("body, body * { font-family: \"\(Self.fonts[font])\", sans-serif !important; }")+ }+ if textScale != 1 { rules.append("html { zoom: \(fmt(textScale)) !important; }") }+ switch textCase {+ case .none: break+ case .upper: rules.append("body, body * { text-transform: uppercase !important; }")+ case .lower: rules.append("body, body * { text-transform: lowercase !important; }")+ case .capitalize: rules.append("body, body * { text-transform: capitalize !important; }")+ }+ if !zapped.isEmpty { rules.append(zapped.joined(separator: ", ") + " { display: none !important; }") }+ if !css.isEmpty { rules.append(css) }+ return rules.joined(separator: "\n")+ }++ private func fmt(_ v: Double) -> String { String(format: "%.3g", v) }+}diff --git a/Packages/CraCore/Sources/CraCore/SidebarModel.swift b/Packages/CraCore/Sources/CraCore/SidebarModel.swiftindex cb85050..f6763bc 100644--- a/Packages/CraCore/Sources/CraCore/SidebarModel.swift+++ b/Packages/CraCore/Sources/CraCore/SidebarModel.swift@@ -532,6 +532,8 @@ public struct AppSettings: Codable, Equatable {public var allowAppleEventsJavaScript: Bool = false/// Arc's Settings ▸ Advanced "Allow window dragging from the top of webpages" (PageTopDrag), on by default.public var pageTopWindowDrag: Bool = true+ /// Arc's Settings ▸ Advanced "Enable Boosts on websites you visit", on by default.+ public var boostsEnabled: Bool = true/// Arc's searchSuggestEnabled: the command bar asks the search engine for suggestions/// as you type and fills its rows with them.public var searchSuggestions: Bool = true@@ -746,6 +748,7 @@ extension AppSettings {blockCookieBanners = try c.decodeIfPresent(Bool.self, forKey: .blockCookieBanners) ?? falseallowAppleEventsJavaScript = try c.decodeIfPresent(Bool.self, forKey: .allowAppleEventsJavaScript) ?? falsepageTopWindowDrag = try c.decodeIfPresent(Bool.self, forKey: .pageTopWindowDrag) ?? true+ boostsEnabled = try c.decodeIfPresent(Bool.self, forKey: .boostsEnabled) ?? truesearchSuggestions = try c.decodeIfPresent(Bool.self, forKey: .searchSuggestions) ?? trueshowSpaceHeaderOnSingleSpace = try c.decodeIfPresent(Bool.self, forKey: .showSpaceHeaderOnSingleSpace) ?? truesharedFavorites = try c.decodeIfPresent(Bool.self, forKey: .sharedFavorites) ?? falsediff --git a/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift b/Packages/CraCore/Tests/CraCoreTests/BoostTests.swiftnew file mode 100644index 0000000..30d78b3--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/BoostTests.swift@@ -0,0 +1,47 @@+import CraCore+import Testing++/// Arc's Boosts (Arc 1.172.1): per-site restyles from the editor's controls.+struct BoostTests {+ @Test func aNewBoostChangesNothing() {+ let b = Boost(host: "www.Example.com")+ #expect(b.host == "example.com" && b.name == "My Boost" && b.enabled)+ #expect(b.colorsUntouched && b.stylesheet.isEmpty)+ }++ @Test func appliesToItsSiteAndSubdomains() {+ let b = Boost(host: "example.com")+ var off = Boost(host: "other.org"); off.enabled = false+ #expect(Boost.applying(to: "https://www.example.com/a", from: [b, off]).map(\.id) == [b.id])+ #expect(Boost.applying(to: "https://docs.example.com/", from: [b]).count == 1)+ #expect(Boost.applying(to: "https://notexample.com/", from: [b]).isEmpty)+ #expect(Boost.applying(to: "https://other.org/", from: [off]).isEmpty, "a disabled boost does nothing")+ }++ @Test func eachControlWritesItsRule() {+ var b = Boost(host: "example.com")+ b.invert = true+ b.contrast = 75+ b.font = 2+ b.textCase = .upper+ b.zapped = [".ad", "#banner"]+ b.css = "h1 { color: red }"+ let css = b.stylesheet+ #expect(css.contains("invert(1) hue-rotate(180deg)") && css.contains("contrast(1.5)"))+ #expect(css.contains("img, video") , "pictures are flipped back under an inverted page")+ #expect(css.contains("\"ui-serif\"") && css.contains("uppercase"))+ #expect(css.contains(".ad, #banner { display: none !important; }") && css.hasSuffix("h1 { color: red }"))+ }++ @Test func aTintNeedsStrength() {+ var b = Boost(host: "example.com")+ b.hue = 0.5+ #expect(b.stylesheet.isEmpty, "a hue alone, with the handle in the middle, tints nothing")+ b.strength = 0.6+ #expect(b.stylesheet.contains("sepia(0.6)"))+ }++ @Test func twentyFontsFiveToARow() {+ #expect(Boost.fonts.count == 20 && Set(Boost.fonts).count == 20)+ }+}diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex fa52775..70039a3 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -70,6 +70,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {}return nil}+ // The Boost editor's All Boosts…: Library ▸ Boosts.+ NotificationCenter.default.addObserver(forName: .craShowBoostsLibrary, object: nil, queue: .main) { [weak self] _ in+ Task { @MainActor in self?.main.showLibrary(.boosts) }+ }NotificationCenter.default.addObserver(forName: .craKeyBindingsChanged, object: nil, queue: .main) { [weak self] _ inTask { @MainActor in self?.buildMenus() }}@@ -77,6 +81,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {if !store.settings.restoreWindows { store.keepOnlyActiveWindow() }// Before any page is made: an easel's tab opens its canvas.EaselBrowser.register()+ // Arc's Boosts: each page on a boosted site gets its boosts; an edit shows at once.+ BrowserManager.boostFor = { [store] url in+ guard store.settings.boostsEnabled else { return nil }+ let boosts = Boost.applying(to: url, from: BoostStore.shared.boosts)+ guard !boosts.isEmpty else { return nil }+ return (boosts.map(\.stylesheet).joined(separator: "\n"), boosts.map(\.js).filter { !$0.isEmpty }.joined(separator: ";\n"))+ }+ BoostStore.changed = { [weak self] host in for m in self?.mainWindows ?? [] { m.browsers.reapplyBoosts(host: host) } }mainWindows = store.prefs.windows.map { MainWindowController(app: self, session: $0) }followKeyWindow()// First launch: the default browser step and the import are the onboarding and@@ -886,6 +898,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {}return}+ // boostZap=1|0: Boost editor's Zap on or off for the open page.+ if let z = dict["boostZap"] { main.debugZap(z == "1"); return }// captureToEasel=1: the page's screenshot, then the capture menu's New Easel.if let how = dict["captureToEasel"] { main.debugCaptureToEasel(send: how == "send"); return }// settingsPane=max: Settings opened on that pane.@@ -1387,6 +1401,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {store.setExpanded(f.id, true)if isNew { LiveFolderManager.shared.refresh(f.id) }case "newSpace": main.showSpaceEditor(space: nil)+ case "newBoost": main.openBoostEditor()case "newEasel":guard !main.isIncognito else { break }let easel = Easel()@@ -1478,6 +1493,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {case "viewDownloads": main.showLibrary(.downloads)case "viewMedia": main.showLibrary(.media)case "viewEasels": main.showLibrary(.easels)+ case "viewBoosts": main.showLibrary(.boosts)case "goBack": main.currentBrowser?.goBack()case "goForward": main.currentBrowser?.goForward()case "pinTab": if let c = current, !main.isBlank { store.togglePinned(c) }@@ -1741,7 +1757,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {window.addItem(std("Minimize Window", #selector(NSWindow.performMiniaturize(_:)), "m"))window.addItem(std("Zoom", #selector(NSWindow.performZoom(_:))))window.addItem(.separator())- window.addItem(item("openLibrary")); window.addItem(item("viewDownloads")); window.addItem(item("viewEasels")); window.addItem(item("viewMedia"))+ window.addItem(item("openLibrary")); window.addItem(item("viewDownloads")); window.addItem(item("viewEasels")); window.addItem(item("viewMedia")); window.addItem(item("viewBoosts"))window.addItem(.separator())window.addItem(item("promoteLittleWindow")); window.addItem(item("littleWindowOpenInMenu")); window.addItem(item("closeLittleWindows"))window.addItem(.separator())diff --git a/Sources/Cra/App/KeyBindings.swift b/Sources/Cra/App/KeyBindings.swiftindex 50d105d..838f1b6 100644--- a/Sources/Cra/App/KeyBindings.swift+++ b/Sources/Cra/App/KeyBindings.swift@@ -139,6 +139,9 @@ final class KeyBindingRegistry {KeyAction(id: "newGitHubLiveFolder", name: "New GitHub Live Folder", section: .file, shortcuts: [],triggers: ["live folder", "pull requests", "github"]),KeyAction(id: "newSpace", name: "New Space…", section: .file, shortcuts: [], triggers: ["space"]),+ // Arc's command bar: New Boost, the open site's boost.+ KeyAction(id: "newBoost", name: "New Boost", section: .none, shortcuts: [], triggers: ["boost", "restyle", "zap"],+ symbol: "paintbrush.pointed"),// Arc: File ▸ New Easel ⌃⇧E.KeyAction(id: "newEasel", name: "New Easel", section: .file, shortcuts: [Shortcut("e", [.control, .shift])],triggers: ["easel", "whiteboard", "canvas", "draw"]),@@ -238,6 +241,8 @@ final class KeyBindingRegistry {// WindowKeyAction(id: "openLibrary", name: "Open Library…", section: .window, shortcuts: [Shortcut("l", cmdShift)], triggers: ["library"]),KeyAction(id: "viewDownloads", name: "View Downloads…", section: .window, shortcuts: [Shortcut("j", cmdShift)], triggers: ["downloads"]),+ // Arc: Window ▸ View Boosts….+ KeyAction(id: "viewBoosts", name: "View Boosts…", section: .window, shortcuts: [], triggers: ["boosts"]),// Arc: Window ▸ View Easels….KeyAction(id: "viewEasels", name: "View Easels…", section: .window, shortcuts: [], triggers: ["easels"]),// Arc: Window ▸ View Media….diff --git a/Sources/Cra/Services/BoostStore.swift b/Sources/Cra/Services/BoostStore.swiftnew file mode 100644index 0000000..05b0081--- /dev/null+++ b/Sources/Cra/Services/BoostStore.swift@@ -0,0 +1,43 @@+import Foundation+import Observation++/// Every Boost (Arc's per-site restyles), in boosts.json in the data folder.+@MainActor+@Observable+final class BoostStore {+ static let shared = BoostStore()+ @ObservationIgnored private let file = JSONStore<[Boost]>("boosts.json")+ private(set) var boosts: [Boost]++ private init() { boosts = file.load(or: { [] }) }++ func boost(_ id: UUID) -> Boost? { boosts.first { $0.id == id } }+ func boost(forHost host: String) -> Boost? { boosts.first { $0.host == Boost.siteHost(host) } }++ /// The site's boost, made when it has none (Arc's New Boost opens the one a site has).+ func boostForSite(of url: String) -> Boost? {+ guard let host = URL(string: url)?.host, url.hasPrefix("http") else { return nil }+ if let b = boost(forHost: host) { return b }+ let b = Boost(host: host)+ boosts.append(b)+ file.save(boosts)+ return b+ }++ func update(_ boost: Boost) {+ guard let i = boosts.firstIndex(where: { $0.id == boost.id }) else { return }+ boosts[i] = boost+ file.save(boosts)+ BoostStore.changed?(boost.host)+ }++ func delete(_ id: UUID) {+ let host = boost(id)?.host+ boosts.removeAll { $0.id == id }+ file.save(boosts)+ if let host { BoostStore.changed?(host) }+ }++ /// The pages on a host get their boost again (set by the app: BrowserManager re-applies).+ @ObservationIgnored static var changed: ((String) -> Void)?+}diff --git a/Sources/Cra/Services/BrowserManager.swift b/Sources/Cra/Services/BrowserManager.swiftindex 25cbb24..5dce0f0 100644--- a/Sources/Cra/Services/BrowserManager.swift+++ b/Sources/Cra/Services/BrowserManager.swift@@ -1092,6 +1092,7 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {if committed, id == visibleTabID { Perf.phase("firstPageCommitted") }if committed {shareTheme(id, with: browser)+ applyBoost(to: browser, clearing: false)if let css = store.cookieBannerCSS(item: id) { adopt(css, as: "__craCookieBanners", in: browser) }}delegate?.browserManagerDidUpdate(id)@@ -1106,6 +1107,26 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {adopt(css, as: "__craArcTheme", in: browser)}+ /// Arc's Boosts: the site's boost for this page (set by the app; BoostStore), nil for none.+ static var boostFor: ((String) -> (css: String, js: String)?)?++ /// The page's boost: its stylesheet adopted like the theme data, its script run in the page.+ /// An emptied boost clears what an earlier one adopted.+ func applyBoost(to browser: CraBrowser, clearing: Bool = true) {+ let boost = Self.boostFor?(browser.currentURL)+ // A new document has nothing adopted: no call unless there is a boost to put on it.+ guard boost != nil || clearing else { return }+ adopt(boost?.css ?? "", as: "__craBoost", in: browser)+ if let js = boost?.js, !js.isEmpty { browser.executeJavaScript(js) }+ }++ /// Every page on `host` gets its boost again (the editor's changes, live).+ func reapplyBoosts(host: String) {+ for rt in runtimes.values where URL(string: rt.browser.currentURL)?.host.map(Boost.siteHost).map({ $0 == host || $0.hasSuffix("." + host) }) == true {+ applyBoost(to: rt.browser)+ }+ }+/// A stylesheet adopted by the page's document from Cra's world, kept under `name` there so a/// later commit of the same document replaces it.private func adopt(_ css: String, as name: String, in browser: CraBrowser) {diff --git a/Sources/Cra/UI/Boosts/BoostEditor.swift b/Sources/Cra/UI/Boosts/BoostEditor.swiftnew file mode 100644index 0000000..659cfbb--- /dev/null+++ b/Sources/Cra/UI/Boosts/BoostEditor.swift@@ -0,0 +1,399 @@+import AppKit+import SwiftUI++/// Arc's Boost editor (Arc 1.172.1, captured 7 Nov 2026; docs/screenshots/arc-boost-*.png): a+/// 183 × 588 pt floating panel 10 pt in from the window's right edge and 215 pt down. Header: a grey+/// ✕ (Done), "My Boost ⌄" (Rename this Boost…, Shuffle, Reset all Edits, Delete this Boost, All+/// Boosts…), Undo. Then a 147 pt colour wheel, three 42 × 38 buttons (Invert lightness, Advanced+/// colour controls: Contrast, Brightness, Original Saturation; Reset to original colours), a white+/// card of 20 "Aa" fonts, Size and Case, Zap ⚡ and Code {} (which widens the panel to 480 pt with a+/// CSS / JS switch). Every change shows on the page at once.+@MainActor+final class BoostEditorController {+ static let shared = BoostEditorController()+ private var panel: NSPanel?+ private var model: BoostEditorModel?++ func open(_ boost: Boost, over window: NSWindow, zap: @escaping (Bool) -> Void) {+ close()+ let m = BoostEditorModel(boost: boost)+ m.zap = zap+ m.onClose = { [weak self] in self?.close() }+ m.onWidth = { [weak self] w in self?.resize(width: w) }+ let p = NSPanel(contentRect: .zero, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)+ p.isFloatingPanel = true+ p.level = .floating+ p.backgroundColor = .clear+ p.hasShadow = true+ p.isOpaque = false+ p.becomesKeyOnlyIfNeeded = true+ let host = FirstClickHostingView(rootView: BoostEditorView(model: m))+ host.sizingOptions = []+ p.contentView = host+ let f = window.frame+ p.setFrame(NSRect(x: f.maxX - 10 - 183, y: f.maxY - 215 - 588, width: 183, height: 588), display: false)+ window.addChildWindow(p, ordered: .above)+ p.orderFront(nil)+ panel = p+ model = m+ }++ func close() {+ model?.finishZap()+ if let panel { panel.parent?.removeChildWindow(panel); panel.orderOut(nil) }+ panel = nil+ model = nil+ }++ var isOpen: Bool { panel != nil }++ /// What Zap hid, into the boost being edited.+ func addZapped(_ selectors: [String]) {+ CraLog.note("zap kept \(selectors.count) selector\(selectors.count == 1 ? "" : "s")")+ guard let model, !selectors.isEmpty else { return }+ model.change { b in b.zapped += selectors.filter { !b.zapped.contains($0) } }+ }++ private func resize(width: CGFloat) {+ guard let panel else { return }+ var f = panel.frame+ f.origin.x = f.maxX - width+ f.size.width = width+ panel.setFrame(f, display: true, animate: true)+ }+}++@MainActor+@Observable+final class BoostEditorModel {+ var boost: Boost { didSet { if boost != oldValue { BoostStore.shared.update(boost) } } }+ var history: [Boost] = []+ var showingCode = false+ var codeIsJS = false+ var zapping = false+ @ObservationIgnored var zap: (Bool) -> Void = { _ in }+ @ObservationIgnored var onClose: () -> Void = {}+ @ObservationIgnored var onWidth: (CGFloat) -> Void = { _ in }++ init(boost: Boost) { self.boost = boost }++ /// One step of the editor, undoable.+ func change(_ edit: (inout Boost) -> Void) {+ history.append(boost)+ var b = boost+ edit(&b)+ boost = b+ }++ func undo() { if let last = history.popLast() { boost = last } }++ func shuffle() {+ change {+ $0.hue = Double.random(in: 0..<1)+ $0.strength = Double.random(in: 0.3...0.8)+ $0.font = Int.random(in: 0..<Boost.fonts.count)+ }+ }++ func resetAll() {+ change { b in+ let fresh = Boost(id: b.id, host: b.host, name: b.name)+ b = fresh+ }+ }++ func toggleZap() {+ zapping.toggle()+ zap(zapping)+ }++ func finishZap() { if zapping { zapping = false; zap(false) } }++ func setCode(_ on: Bool) {+ showingCode = on+ onWidth(on ? 480 : 183)+ }+}++private enum BoostStyle {+ static let panel = Color(red: 0.976, green: 0.976, blue: 0.984)+ static let button = Color(red: 0.91, green: 0.91, blue: 0.925)+ static let ink = Color(white: 0.2)+ static let secondary = Color(white: 0.55)+}++private struct BoostEditorView: View {+ @Bindable var model: BoostEditorModel+ @State private var showColors = false++ var body: some View {+ VStack(spacing: 0) {+ header+ Divider().opacity(0.4)+ if model.showingCode { code } else { controls }+ }+ .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()+ 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)+ }+ .buttonStyle(.plain).help("Done")+ Spacer(minLength: 0)+ }+ Menu {+ Button("Rename this Boost…") { rename() }+ Button("Shuffle") { model.shuffle() }+ Button("Reset all Edits") { model.resetAll() }+ Button("Delete this Boost") { delete() }+ Divider()+ Button("All Boosts…") { NotificationCenter.default.post(name: .craShowBoostsLibrary, object: nil) }+ } label: {+ HStack(spacing: 4) {+ Text(model.boost.name).font(.system(size: 14, weight: .semibold)).foregroundStyle(BoostStyle.ink).lineLimit(1)+ Image(systemName: "chevron.down").font(.system(size: 10, weight: .semibold)).foregroundStyle(BoostStyle.ink)+ }+ }+ .menuStyle(.button).buttonStyle(.plain).menuIndicator(.hidden).fixedSize()+ Spacer(minLength: 0)+ Button { model.undo() } label: {+ Image(systemName: "arrow.counterclockwise").font(.system(size: 14, weight: .semibold)).frame(width: 40, height: 40)+ }+ .buttonStyle(.plain).foregroundStyle(model.history.isEmpty ? Color(white: 0.75) : BoostStyle.ink).disabled(model.history.isEmpty).help("Undo")+ }+ .frame(height: 40)+ }++ private var controls: some View {+ VStack(spacing: 14) {+ ColorWheel(hue: model.boost.hue, strength: model.boost.strength) { h, s in+ model.change { $0.hue = h; $0.strength = s }+ }+ .frame(width: 147, height: 147)+ .padding(.top, 18)+ HStack(spacing: 10) {+ square("lightbulb", on: model.boost.invert, help: "Invert lightness") { model.change { $0.invert.toggle() } }+ square("slider.horizontal.3", on: showColors, help: "Advanced color controls") { showColors.toggle() }+ .popover(isPresented: $showColors, arrowEdge: .leading) { advanced }+ square("nosign", on: false, help: "Reset to original colors") {+ model.change { $0.hue = 0; $0.strength = 0; $0.invert = false; $0.contrast = 50; $0.brightness = 50; $0.saturation = 50 }+ }+ .opacity(model.boost.colorsUntouched ? 0.45 : 1)+ }+ fonts+ HStack(spacing: 9) {+ Menu {+ ForEach([0.8, 0.9, 1, 1.1, 1.25, 1.5], id: \.self) { s in+ Button(s == 1 ? "Original" : "\(Int(s * 100)) %") { model.change { $0.textScale = s } }+ }+ } label: { wide("Size", trailing: nil) }+ .menuStyle(.button).buttonStyle(.plain).menuIndicator(.hidden).help("Change text size")+ Menu {+ ForEach(Boost.TextCase.allCases, id: \.self) { c in Button(c.title) { model.change { $0.textCase = c } } }+ } label: { wide("Case", trailing: nil) }+ .menuStyle(.button).buttonStyle(.plain).menuIndicator(.hidden).help("Change text case")+ }+ .frame(width: 147)+ Button { model.toggleZap() } label: { wide("Zap", trailing: "bolt.fill", on: model.zapping) }.buttonStyle(.plain)+ .help("Click things on the page to hide them")+ Button { model.setCode(true) } label: { wide("Code", trailing: "curlybraces") }.buttonStyle(.plain)+ Spacer(minLength: 0)+ }+ .frame(width: 183)+ }++ private var advanced: some View {+ VStack(alignment: .leading, spacing: 10) {+ slider("Contrast", \.contrast)+ slider("Brightness", \.brightness)+ slider("Original Saturation", \.saturation)+ }+ .padding(18)+ .frame(width: 250)+ }++ private func slider(_ title: String, _ key: WritableKeyPath<Boost, Double>) -> some View {+ VStack(alignment: .leading, spacing: 6) {+ Text(title).font(.system(size: 13, weight: .medium))+ Slider(value: Binding(get: { model.boost[keyPath: key] }, set: { v in model.change { $0[keyPath: key] = v } }), in: 0...100)+ }+ }++ private var fonts: some View {+ let columns = Array(repeating: GridItem(.fixed(26), spacing: 1.5), count: 5)+ return LazyVGrid(columns: columns, spacing: 0) {+ ForEach(Boost.fonts.indices, id: \.self) { i in+ Button { model.change { $0.font = $0.font == i ? nil : i } } label: {+ Text("Aa").font(.custom(Boost.fonts[i] == "-apple-system" ? "Helvetica Neue" : Boost.fonts[i], size: 13))+ .foregroundStyle(model.boost.font == i ? Color.accentColor : BoostStyle.secondary)+ .frame(width: 26, height: 26)+ }+ .buttonStyle(.plain)+ }+ }+ .padding(.vertical, 8).padding(.horizontal, 5)+ .frame(width: 147)+ .background(RoundedRectangle(cornerRadius: 10, style: .continuous).fill(.white).shadow(color: .black.opacity(0.08), radius: 4, y: 1))+ }++ private func square(_ symbol: String, on: Bool, help: String, _ action: @escaping () -> Void) -> some View {+ Button(action: action) {+ Image(systemName: symbol).font(.system(size: 15))+ .foregroundStyle(on ? .white : BoostStyle.ink)+ .frame(width: 42, height: 38)+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(on ? BoostStyle.ink : BoostStyle.button))+ }+ .buttonStyle(.plain).help(help)+ }++ private func wide(_ title: String, trailing: String?, on: Bool = false) -> some View {+ HStack {+ Text(title).font(.system(size: 14, weight: .semibold))+ if let trailing { Spacer(); Image(systemName: trailing).font(.system(size: 13, weight: .semibold)) }+ }+ .foregroundStyle(on ? .white : BoostStyle.ink)+ .padding(.horizontal, 12)+ .frame(maxWidth: trailing == nil ? .infinity : 147, minHeight: 38)+ .frame(width: trailing == nil ? nil : 147)+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(on ? BoostStyle.ink : BoostStyle.button))+ }++ private var code: some View {+ VStack(spacing: 0) {+ CodeEditor(text: Binding(get: { model.codeIsJS ? model.boost.js : model.boost.css },+ set: { v in if model.codeIsJS { model.boost.js = v } else { model.boost.css = v } }))+ HStack { Spacer() }.frame(height: 60).background(BoostStyle.panel)+ }+ .frame(width: 480)+ }++ private func rename() {+ let alert = NSAlert()+ alert.messageText = "Rename this Boost"+ let field = NSTextField(string: model.boost.name)+ field.frame = NSRect(x: 0, y: 0, width: 220, height: 24)+ alert.accessoryView = field+ alert.addButton(withTitle: "Rename")+ alert.addButton(withTitle: "Cancel")+ if alert.runModal() == .alertFirstButtonReturn, !field.stringValue.isEmpty { model.change { $0.name = field.stringValue } }+ }++ private func delete() {+ let alert = NSAlert()+ alert.messageText = "Delete this Boost?"+ alert.informativeText = "Its changes to \(model.boost.host) go away."+ alert.addButton(withTitle: "Delete")+ alert.addButton(withTitle: "Cancel")+ alert.buttons.first?.hasDestructiveAction = true+ guard alert.runModal() == .alertFirstButtonReturn else { return }+ BoostStore.shared.delete(model.boost.id)+ model.onClose()+ }+}++/// Arc's colour wheel: a rounded square in a grey gradient frame, dotted inside; the big handle is+/// the tint (hue round the middle, strength out from it), the small one sits at the middle.+private struct ColorWheel: View {+ let hue: Double+ let strength: Double+ let set: (Double, Double) -> Void++ var body: some View {+ GeometryReader { geo in+ let size = geo.size.width, inner = size - 14, c = size / 2+ let angle = hue * 2 * .pi, r = strength * (inner / 2 - 18)+ let handle = CGPoint(x: c + cos(angle) * r, y: c - sin(angle) * r)+ ZStack {+ // Arc's frame: brushed metal, dark at the top left and right, light at the bottom.+ RoundedRectangle(cornerRadius: 26, style: .continuous)+ .fill(AngularGradient(colors: [Color(white: 0.55), Color(white: 0.25), Color(white: 0.45), Color(white: 0.85),+ Color(white: 0.95), Color(white: 0.7), Color(white: 0.55)], center: .center, angle: .degrees(180)))+ .overlay(strength > 0 ? RoundedRectangle(cornerRadius: 26, style: .continuous)+ .fill(Color(hue: hue, saturation: 0.5, brightness: 0.8).opacity(0.35)) : nil)+ RoundedRectangle(cornerRadius: 20, style: .continuous).fill(Color.white).padding(7)+ Canvas { ctx, s in+ for x in stride(from: 12.0, to: s.width - 12, by: 6) {+ for y in stride(from: 12.0, to: s.height - 12, by: 6) {+ ctx.fill(Path(ellipseIn: CGRect(x: x, y: y, width: 1, height: 1)), with: .color(.black.opacity(0.12)))+ }+ }+ }+ // Arc's second, smaller handle: the darker end of the tint, between the middle and the big one.+ Circle().fill(Color(white: 0.17)).frame(width: 22, height: 22).overlay(Circle().stroke(.white, lineWidth: 3)).shadow(radius: 1.5)+ .position(x: c + (handle.x - c) * 0.55 - 8, y: c + (handle.y - c) * 0.55 + 22)+ Circle().fill(strength > 0 ? Color(hue: hue, saturation: 0.6, brightness: 0.8) : Color(white: 0.45))+ .frame(width: 32, height: 32).overlay(Circle().stroke(.white, lineWidth: 3)).shadow(radius: 2)+ .position(handle)+ }+ .contentShape(Rectangle())+ .gesture(DragGesture(minimumDistance: 0).onChanged { g in+ let dx = g.location.x - c, dy = c - g.location.y+ var a = atan2(dy, dx) / (2 * .pi)+ if a < 0 { a += 1 }+ set(a, min(1, hypot(dx, dy) / (inner / 2 - 18)))+ })+ }+ }+}++/// The Code panel's editor: dark, monospaced, no smart quotes.+private struct CodeEditor: NSViewRepresentable {+ @Binding var text: String++ func makeNSView(context: Context) -> NSScrollView {+ let scroll = NSTextView.scrollableTextView()+ let tv = scroll.documentView as! NSTextView+ tv.font = .monospacedSystemFont(ofSize: 12, weight: .regular)+ tv.isAutomaticQuoteSubstitutionEnabled = false+ tv.isAutomaticDashSubstitutionEnabled = false+ tv.isAutomaticSpellingCorrectionEnabled = false+ tv.backgroundColor = NSColor(srgbRed: 0.13, green: 0.13, blue: 0.15, alpha: 1)+ tv.textColor = NSColor(white: 0.92, alpha: 1)+ tv.insertionPointColor = .white+ tv.textContainerInset = NSSize(width: 10, height: 10)+ tv.delegate = context.coordinator+ tv.string = text+ return scroll+ }++ func updateNSView(_ view: NSScrollView, context: Context) {+ let tv = view.documentView as! NSTextView+ if tv.string != text { tv.string = text }+ context.coordinator.text = $text+ }++ func makeCoordinator() -> Coordinator { Coordinator(text: $text) }++ final class Coordinator: NSObject, NSTextViewDelegate {+ var text: Binding<String>+ init(text: Binding<String>) { self.text = text }+ func textDidChange(_ n: Notification) { if let tv = n.object as? NSTextView { text.wrappedValue = tv.string } }+ }+}++/// The editor sits beside the page, which keeps the keyboard: its first click acts, as Arc's does.+private final class FirstClickHostingView<Content: View>: NSHostingView<Content> {+ override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }+}++extension Notification.Name {+ static let craShowBoostsLibrary = Notification.Name("craShowBoostsLibrary")+}diff --git a/Sources/Cra/UI/Settings/AdvancedPane.swift b/Sources/Cra/UI/Settings/AdvancedPane.swiftindex 6bbfe95..6d95994 100644--- a/Sources/Cra/UI/Settings/AdvancedPane.swift+++ b/Sources/Cra/UI/Settings/AdvancedPane.swift@@ -37,6 +37,8 @@ struct AdvancedPane: View {SettingsCheckbox(title: "Allow websites to get your theme data", isOn: $store.settings.shareThemeWithWebsites)// Arc: "Allow window dragging from the top of webpages" (with the toolbar hidden).SettingsCheckbox(title: "Allow window dragging from the top of webpages", isOn: $store.settings.pageTopWindowDrag)+ // Arc: "Enable Boosts on websites you visit".+ SettingsCheckbox(title: "Enable Boosts on websites you visit", isOn: $store.settings.boostsEnabled)}SettingsFormRow(label: "When quitting Cra:") {SettingsCheckbox(title: "Warn before quitting", isOn: $store.settings.warnBeforeQuitting)diff --git a/Sources/Cra/UI/Sidebar/LibraryView.swift b/Sources/Cra/UI/Sidebar/LibraryView.swiftindex 1dadc93..fbe93b5 100644--- a/Sources/Cra/UI/Sidebar/LibraryView.swift+++ b/Sources/Cra/UI/Sidebar/LibraryView.swift@@ -3,7 +3,7 @@ import SwiftUI/// The Library's pages Cra has, in the order of Arc's rail (which also lists Easels and Boosts).enum LibraryPage: String, CaseIterable {- case media, downloads, easels, spaces, archive+ case media, downloads, easels, spaces, boosts, archivevar title: String {switch self {@@ -11,6 +11,7 @@ enum LibraryPage: String, CaseIterable {case .downloads: "Downloads"case .easels: "Easels"case .spaces: "Spaces"+ case .boosts: "Boosts"case .archive: "Archived Tabs"}}@@ -20,6 +21,7 @@ enum LibraryPage: String, CaseIterable {case .downloads: "arrow.down.circle"case .easels: "pencil.and.scribble"case .spaces: "square.on.square"+ case .boosts: "paintbrush.pointed"case .archive: "archivebox"}}@@ -27,6 +29,7 @@ enum LibraryPage: String, CaseIterable {switch self {case .media: "photo.fill.on.rectangle.fill"case .easels: symbol+ case .boosts: "paintbrush.pointed.fill"default: symbol + ".fill"}}@@ -35,6 +38,7 @@ enum LibraryPage: String, CaseIterable {case .media: "Search Media…"case .downloads: "Search Downloads…"case .easels: "Search Easels…"+ case .boosts: "Search Boosts…"default: "Search Archive…"}}@@ -286,6 +290,7 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDatcase header(String)case media([MediaLibrary.File])case easel(id: UUID, title: String, edited: Date)+ case boost(Boost)case download(DownloadHistory.Entry)case archived(ArchivedItem)}@@ -379,6 +384,7 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDat_ = DownloadHistory.shared.entries_ = DownloadHistory.shared.thumbnails.count_ = MediaScanner.shared.files+ _ = BoostStore.shared.boosts_ = store.settings.mediaLibraryEnabled_ = store.settings.mediaFolders} onChange: { [weak self] in@@ -426,6 +432,13 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDat// Arc's empty Easels page: "Out of ideas!"empty.show(symbol: "pencil.and.scribble", title: all.isEmpty ? "Out of ideas!" : "No matches",detail: all.isEmpty ? "Choose File ▸ New Easel to create a new Easel." : nil)+ case .boosts:+ let all = BoostStore.shared.boosts+ let shown = needle.isEmpty ? all : all.filter { $0.name.lowercased().contains(needle) || $0.host.contains(needle) }+ out = shown.sorted { $0.host < $1.host }.map { .boost($0) }+ // Arc's empty Boosts page.+ empty.show(symbol: "paintbrush.pointed", title: all.isEmpty ? "Nothing Boosted Yet!" : "No matches",+ detail: all.isEmpty ? "Type “New Boost” in the command bar on any site to make your own." : nil)case .spaces:breakcase .archive:@@ -549,6 +562,8 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDatcase .archive:let store = storeMenuItems.add(menu, "Clear Archive", enabled: !store.archive.isEmpty) { store.clearArchive() }+ case .boosts:+ MenuItems.add(menu, "New Boost for This Site") { [weak self] in self?.actions.performAction("newBoost") }case .easels:MenuItems.add(menu, "New Easel") { [weak self] in self?.actions.performAction("newEasel") }case .spaces:@@ -574,6 +589,15 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDatv.identifier = .init("header")v.show(label, ink: colors.isDark ? .white : .black)return v+ case .boost(let b):+ let v = tableView.makeView(withIdentifier: .init("item"), owner: nil) as? LibraryItemCell ?? LibraryItemCell()+ v.identifier = .init("item")+ v.showBoost(b, colors: colors) { [store, actions] in+ // Opens the site, where the boost shows.+ _ = store.createTab(url: "https://\(b.host)/", select: true)+ actions.closeLibrary()+ }+ return vcase .easel(let id, let title, let edited):let v = tableView.makeView(withIdentifier: .init("item"), owner: nil) as? LibraryItemCell ?? LibraryItemCell()v.identifier = .init("item")@@ -618,6 +642,12 @@ extension LibraryListView: NSMenuDelegate {guard rows.indices.contains(row) else { return }switch rows[row] {case .header, .media, .easel: break+ case .boost(let b):+ var flipped = b+ flipped.enabled.toggle()+ MenuItems.add(menu, b.enabled ? "Disable Boost" : "Enable Boost") { BoostStore.shared.update(flipped) }+ menu.addItem(.separator())+ MenuItems.add(menu, "Delete Boost") { BoostStore.shared.delete(b.id) }case .archived(let e):let actions = actions, store = storeMenuItems.add(menu, "Restore") { actions.restoreArchived(e.id) }@@ -725,6 +755,24 @@ private final class LibraryItemCell: NSView, NSDraggingSource {apply(ink: ink)}+ /// A boost on Library ▸ Boosts: its name and site, dimmed while off.+ func showBoost(_ b: Boost, colors: SidebarColors, open: @escaping () -> Void) {+ self.colors = colors+ download = nil+ restore = open+ let ink: NSColor = colors.isDark ? .white : .black+ tile.layer?.contents = nil+ tile.layer?.backgroundColor = ink.withAlphaComponent(0.04).cgColor+ icon.isHidden = false+ icon.image = NSImage(systemSymbolName: "paintbrush.pointed", accessibilityDescription: "Boost")+ title.stringValue = b.name+ title.lineBreakMode = .byTruncatingTail+ detail.stringValue = b.host + (b.enabled ? "" : " · Off")+ tip?.text = b.host+ apply(ink: ink)+ alphaValue = b.enabled ? 1 : 0.55+ }+/// An easel on Library ▸ Easels: its glyph, its title, when it was last edited.func showEasel(title text: String, edited: Date, colors: SidebarColors, open: @escaping () -> Void) {self.colors = colorsdiff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swiftindex 8826704..2a6d405 100644--- a/Sources/Cra/UI/Windows/MainWindowController.swift+++ b/Sources/Cra/UI/Windows/MainWindowController.swift@@ -2799,6 +2799,46 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM}/// Arc's "Capture the full page": the whole document, beyond the viewport, as a PNG.+ // MARK: Boosts++ /// Arc's New Boost: the open site's boost (made if it has none) in the editor beside the page.+ func openBoostEditor() {+ guard let window, let url = selectedTabID.flatMap({ store.item($0)?.tab?.url }),+ let boost = BoostStore.shared.boostForSite(of: url) else { showToast("Boosts Work on Websites"); return }+ BoostEditorController.shared.open(boost, over: window) { [weak self] on in self?.setZapping(on) }+ }++ /// Zap: the page outlines what's under the pointer, and a click hides it and keeps a selector+ /// for it; when Zap ends the selectors go into the boost.+ /// Testing without the pointer (cra://debug?boostZap=1|0): Zap on or off, as its button does.+ func debugZap(_ on: Bool) { setZapping(on) }++ private func setZapping(_ on: Bool) {+ guard let b = currentBrowser else { return }+ if on { b.executeJavaScript(Self.zapScript); return }+ b.sendDevToolsMethod("Runtime.evaluate", params: #"{"expression":"(()=>{const z=window.__craZap;if(!z)return '[]';z.stop();return JSON.stringify(z.hidden)})()","returnByValue":true}"#) { result, _ in+ MainActor.assumeIsolated {+ let o = result.flatMap { try? JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any] }+ let text = (o?["result"] as? [String: Any])?["value"] as? String ?? "[]"+ let selectors = (try? JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String]) ?? []+ BoostEditorController.shared.addZapped(selectors)+ }+ }+ }++ static let zapScript = """+ (()=>{if(window.__craZap)return;const hidden=[];let over=null;+ const sel=e=>{if(e.id)return '#'+CSS.escape(e.id);const p=[];for(let n=e;n&&n.nodeType===1&&n!==document.body&&p.length<5;n=n.parentElement){+ if(n.id){p.unshift('#'+CSS.escape(n.id));break}let i=1;for(let s=n.previousElementSibling;s;s=s.previousElementSibling)if(s.tagName===n.tagName)i++;+ p.unshift(n.tagName.toLowerCase()+':nth-of-type('+i+')')}return (p[0]&&p[0][0]==='#'?'':'body > ')+p.join(' > ')};+ const mark=e=>{if(over)over.style.outline=over.__craOutline||'';over=e;if(e){e.__craOutline=e.style.outline;e.style.outline='2px solid #ff3b30'}};+ const page=t=>t===document.body||t===document.documentElement;+ const move=ev=>mark(page(ev.target)?null:ev.target);+ const click=ev=>{ev.preventDefault();ev.stopPropagation();const t=ev.target;if(page(t))return;mark(null);hidden.push(sel(t));t.style.display='none'};+ document.addEventListener('mouseover',move,true);document.addEventListener('click',click,true);+ window.__craZap={hidden,stop(){document.removeEventListener('mouseover',move,true);document.removeEventListener('click',click,true);mark(null);delete window.__craZap}}})()+ """+// MARK: Arc parity (docs/arc-parity.md)/// Arc's Window ▸ Stay On Top: the window floats over other apps' windows.diff --git a/Tests/BrowserManagerLifecycleTests.swift b/Tests/BrowserManagerLifecycleTests.swiftindex 345c631..50e3234 100644--- a/Tests/BrowserManagerLifecycleTests.swift+++ b/Tests/BrowserManagerLifecycleTests.swift@@ -366,6 +366,15 @@ enum BrowserManagerLifecycleTests {manager.browser(rt.browser, didChangeCommittedLoad: true)expect(themed() == before + 2 && rt.browser.lastIsolatedParams.contains("__craCookieBanners")&& rt.browser.lastIsolatedParams.contains("#onetrust-banner-sdk"), "blocking cookie banners hides them on every committed page")+ // Arc's Boosts: a committed page on a boosted site gets the boost's stylesheet and script.+ BrowserManager.boostFor = { url in url.contains("example.test") ? (css: "h1 { color: red }", js: "window.boosted = 1") : nil }+ store.settings.blockCookieBanners = false+ rt.browser.navigate(to: "https://example.test/themed")+ manager.browser(rt.browser, didChangeCommittedLoad: true)+ expect(rt.browser.replies.contains { $0.method == isolatedProbe } && rt.browser.lastIsolatedParams.contains("__craBoost")+ && rt.browser.lastIsolatedParams.contains("h1 { color: red }") && rt.browser.scripts.last == "window.boosted = 1",+ "a boosted site's page gets the boost's CSS and runs its script")+ BrowserManager.boostFor = nilmanager.closeAll()}diff --git a/Tests/BrowserManagerSupport/CraCEF.swift b/Tests/BrowserManagerSupport/CraCEF.swiftindex f941b33..e40d2c2 100644--- a/Tests/BrowserManagerSupport/CraCEF.swift+++ b/Tests/BrowserManagerSupport/CraCEF.swift@@ -74,6 +74,9 @@ open class CraBrowser {lastParams = paramsreplies.append((method, completion))}+ /// Scripts run in the page's own world (a Boost's JavaScript), in order.+ public private(set) var scripts: [String] = []+ public func executeJavaScript(_ script: String) { scripts.append(script) }public private(set) var lastIsolatedParams = ""/// Recorded as "<world>:Runtime.evaluate".public func evaluate(inIsolatedWorld world: String, params: String, completion: @escaping (String?, String?) -> Void) {diff --git a/Tests/Scenarios/boosts.scenario b/Tests/Scenarios/boosts.scenarionew file mode 100644index 0000000..35c1fba--- /dev/null+++ b/Tests/Scenarios/boosts.scenario@@ -0,0 +1,20 @@+# Arc's Boosts (Arc 1.172.1, docs/arc-parity.md "Boosts, measured"): a page on a boosted site gets the+# boost's stylesheet (its controls' rules and its own CSS) and runs its JavaScript.+budget rss=700 stalls50=10+seed boosts.json [{"id":"0E5B6E0A-5C3B-4F8D-9C55-4A7C5F2B9E11","host":"127.0.0.1","name":"Test Boost","enabled":true,"hue":0,"strength":0,"invert":false,"contrast":50,"brightness":50,"saturation":50,"textScale":1,"textCase":"upper","zapped":["#zapme"],"css":"body { background: rgb(1, 2, 3) !important; }","js":"window.boosted = 'yes'"}]+cra://open?url=${PAGE}?n=boosted+expect-log loaded 127\.0\.0\.1 \(HTTP 200\)+wait 1+cra://debug?cdp=Runtime.evaluate¶ms={"expression":"(()=>{const z=document.createElement('div');z.id='zapme';document.body.append(z);const b=getComputedStyle(document.body);return 'boost-'+b.backgroundColor+'-'+b.textTransform+'-'+getComputedStyle(z).display+'-'+window.boosted})()"}+expect-log Cra cdp Runtime.evaluate .*"value":"boost-rgb\(1, 2, 3\)-uppercase-none-yes"+# Zap: what a click hides is kept as a selector; a click on the page itself hides nothing.+cra://debug?cdp=Runtime.evaluate¶ms={"expression":"(()=>{const s=document.createElement('section');s.innerHTML='<p id=zz>x</p><span>y</span>';document.body.append(s);return 'ready'})()"}+expect-log Cra cdp Runtime.evaluate .*"value":"ready"+cra://action/newBoost+wait 1+cra://debug?boostZap=1+wait 1+cra://debug?cdp=Runtime.evaluate¶ms={"expression":"(()=>{document.body.click();document.getElementById('zz').click();return 'zz-'+getComputedStyle(document.getElementById('zz')).display+'-body-'+getComputedStyle(document.body).display})()"}+expect-log Cra cdp Runtime.evaluate .*"value":"zz-none-body-block"+cra://debug?boostZap=0+expect-log zap kept 1 selector$diff --git a/Tests/test-browser-manager.sh b/Tests/test-browser-manager.shindex fcd30ec..d3d1309 100755--- a/Tests/test-browser-manager.sh+++ b/Tests/test-browser-manager.sh@@ -12,7 +12,7 @@ xcrun swiftc -swift-version 5 -parse-as-library ${CRA_TEST_SWIFTC_FLAGS:-} -I "$-Xlinker -rpath -Xlinker "$TEST_DIR" \"$MANAGER_SOURCE" Sources/Cra/Services/NowPlaying.swift Sources/Cra/Services/PageScript.swift Sources/Cra/Services/Scheduler.swift Sources/Cra/Services/DevToolsToggle.swift Sources/Cra/Services/CraLog.swift Sources/Cra/Services/PageProbe.swift Sources/Cra/Services/Persistence.swift \Sources/Cra/Perf/Perf.swift Packages/CraCore/Sources/CraCore/Perf/*.swift Packages/CraCore/Sources/CraCore/ExtensionPageRetry.swift Packages/CraCore/Sources/CraCore/PermissionPrompt.swift Packages/CraCore/Sources/CraCore/TabSleepPolicy.swift Packages/CraCore/Sources/CraCore/ProtectedMedia.swift Sources/Cra/Services/WebKit/PageEngines.swift Tests/Support/ManualScheduler.swift Tests/BrowserManagerSupport/AppServices.swift \- Packages/CraCore/Sources/CraCore/DialogActions.swift Tests/BrowserManagerLifecycleTests.swift -o "$TEST_DIR/lifecycle-tests"+ Packages/CraCore/Sources/CraCore/DialogActions.swift Packages/CraCore/Sources/CraCore/Boost.swift Tests/BrowserManagerLifecycleTests.swift -o "$TEST_DIR/lifecycle-tests"# A data folder of its own: PageEngines keeps protected-media.json there, not in the real Cra's.CRA_DATA_DIR="$TEST_DIR/data" "$TEST_DIR/lifecycle-tests"[ -z "${CRA_TEST_KEEP:-}" ] || cp "$TEST_DIR/lifecycle-tests" "$CRA_TEST_KEEP/"diff --git a/docs/arc-parity.md b/docs/arc-parity.mdindex fbc6615..04d2274 100644--- a/docs/arc-parity.md+++ b/docs/arc-parity.md@@ -14,7 +14,7 @@ or Arc-only service), per CONTRIBUTING.md.| Arc feature | Where in Arc | Cra | Notes ||---|---|---|---|-| Boosts (per-site CSS/JS, colours, fonts, Zap) | URL bar ✎, Library ▸ Boosts, Settings ▸ Advanced "Enable Boosts" | missing | Biggest local feature still absent. |+| Boosts (per-site CSS/JS, colours, fonts, Zap) | URL bar ✎, Library ▸ Boosts, Settings ▸ Advanced "Enable Boosts" | done | New Boost (command bar), the editor (wheel, invert, contrast/brightness/saturation, 20 fonts, size, case, Zap, CSS/JS code), Library ▸ Boosts, Settings ▸ Advanced switch. Not built: the Code panel's eyedropper and hammer tools; the Boost Gallery and sharing are *skip* (arc.net). The colour wheel's recolouring is CSS filters, not Arc's own engine. || Easels | File ▸ New Easel ⌃⇧E, Library ▸ Easels | partial | File ▸ New Easel (⌃⇧E): canvas, title, Pointer/Image/Text/Ellipse/Rectangle/Arrow/Freehand, pictures by file, paste or drop, saved per easel. Library ▸ Easels and Window ▸ View Easels… done. The canvas shows the window's backdrop under a 50 % veil as in Arc. The toolbar strip above it takes the same veil. The capture menu's New Easel done. The capture menu's Send To… done too. The pill's + and − and Aa (Arc's four looks: bold, serif, wide, mono, in macOS's designs) work, on the title too; Duplicate (the toolbar's eighth button) done; sharing is *skip* (cloud). || Notes | File ▸ New Note ⌃⇧N, ⌃⌥N in split, Help ▸ Export Arc Notes | *skip* | Arc 1.172.1 no longer creates Notes: New Note is gone from the File menu and ⌃⇧N does nothing; only Help ▸ Export Arc Notes is left. || Library ▸ Media | Window ▸ View Media…, Library rail | done | Off until Show Media; ⋯ picks the folders (Cra has no captures folder). |@@ -86,7 +86,7 @@ gains "New Profile".| General | Previews Settings… (Block Cookie Banners done, under Privacy) || Profiles | "New documents" app (Arc's Notes/Easels); Privacy, Passwords, Credit Cards and Notifications done || Links | "Open Little Arc when clicking on links with ⌥⌘ held"; Archive Little Windows after done |-| Advanced | Shared Quotes (arc.net), Enable Boosts (the rest done) |+| Advanced | Shared Quotes (arc.net) (the rest done) || Icon | Cra has its own icon picker |## 5. Animations and styling@@ -126,6 +126,7 @@ in this sweep (Essential Shortcuts window, Library pages).measured live in Arc (names, #RRGGBBAA format, no trace in the page's markup) and fitted to thesemantic palette Arc stores per space.- Edit ▸ Find ▸ Use Selection to Find and Jump to Selection (⌘J).+- Boosts: New Boost, the editor, Zap, CSS/JS code, Library ▸ Boosts, Window ▸ View Boosts…, the Advanced switch.- Window dragging from the top of webpages (Victor's choice, 7 Nov: on, as in Arc).- AppleScript, Arc's dictionary (Victor's choice, 7 Nov: like Arc, JavaScript off by default).- Settings ▸ Privacy ▸ Block cookie banners (Arc's "Block Cookie Banners", off by default).@@ -146,9 +147,17 @@ in this sweep (Essential Shortcuts window, Library pages).tool sits on #716328 with 8 pt corners; glyphs in #FAEEC2 (foregroundPrimary). Bottom right: a 36 ptshare button (person.badge.plus), cloud sharing in Arc.+## Boosts, measured (Arc 1.172.1, Victor's Arc, 7 Nov 2026)++- The command bar's "New Boost" opens the editor for the open site: a 183 × 588 pt floating panel 10 pt in+ from the window's right edge and 215 pt down (AX `boostsEditor`). Header 40 pt: Done (grey ✕), "My Boost ⌄"+ (Rename this Boost…, Shuffle, Reset all Edits, Delete this Boost, All Boosts…), Undo. A 147 pt colour wheel in a+ brushed grey frame with two handles; Invert lightness, Advanced color controls (a popover: Contrast, Brightness,+ Original Saturation sliders) and Reset to original colors, 42 × 38 each; a white card of 20 "Aa" fonts (5 × 4,+ 26 pt cells); Size and Case (69 × 38); Zap ⚡ and Code {} (147 × 38). Code widens the panel to 480 pt: Back, a+ CSS / JS switch, a dark editor, an eyedropper and a hammer below. Delete asks "Delete this Boost?" in Arc's+ dialog. Reference captures: docs/screenshots/arc-boost-*.png.+## Left for later, and why-- Boosts: the offline Arc has no network and a local server is blocked in this session, so its Boost- editor couldn't be put on screen to copy. Needs a site in Arc (Victor's OK to run the real Arc, or- a localhost server).- Previews and Join Meeting: not started (they need a live Google session in Arc to measure).diff --git a/docs/screenshots/arc-boost-adv.png b/docs/screenshots/arc-boost-adv.pngnew file mode 100644index 0000000..6c58e5bBinary files /dev/null and b/docs/screenshots/arc-boost-adv.png differdiff --git a/docs/screenshots/arc-boost-code.png b/docs/screenshots/arc-boost-code.pngnew file mode 100644index 0000000..e6364d6Binary files /dev/null and b/docs/screenshots/arc-boost-code.png differdiff --git a/docs/screenshots/arc-boost-editor.png b/docs/screenshots/arc-boost-editor.pngnew file mode 100644index 0000000..b737465Binary files /dev/null and b/docs/screenshots/arc-boost-editor.png differdiff --git a/docs/screenshots/arc-boost-menu.png b/docs/screenshots/arc-boost-menu.pngnew file mode 100644index 0000000..371d230Binary files /dev/null and b/docs/screenshots/arc-boost-menu.png differ