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 code panel's eyedropper and hammer

Victor5da196fe8e6b
diff --git a/Packages/CraCore/Sources/CraCore/BoostPicker.swift b/Packages/CraCore/Sources/CraCore/BoostPicker.swift
new file mode 100644
index 0000000..8b48592
--- /dev/null
+++ b/Packages/CraCore/Sources/CraCore/BoostPicker.swift
@@ -0,0 +1,103 @@
+import CoreGraphics
+import Foundation
+
+/// The Boost code panel's eyedropper (Arc 1.172.1: "Show Selector Picker" / "Hide Selector
+/// Picker"; its menu after a click: "Copy selector for this", "Copy selector for related", "Zap
+/// all related elements"). While it's on, the page outlines the element under the pointer and the
+/// ones like it; a click is held for Cra (which polls `takeExpression`) and opens that menu.
+///
+/// The script is Cra's own: "this" is the shortest selector that matches only the element,
+/// "related" the most specific one that matches it and 2 to 100 others like it.
+public enum BoostPicker {
+ public struct Pick: Equatable, Decodable, Sendable {
+ /// Matches only the clicked element.
+ public var this: String
+ /// Matches it and others like it; equal to `this` when nothing is like it.
+ public var related: String
+ public var relatedCount: Int
+ /// The click in CSS pixels from the viewport's top left, and the viewport's width.
+ public var x: Double
+ public var y: Double
+ public var viewportWidth: Double
+
+ public init(this: String, related: String, relatedCount: Int, x: Double, y: Double, viewportWidth: Double) {
+ (self.this, self.related, self.relatedCount) = (this, related, relatedCount)
+ (self.x, self.y, self.viewportWidth) = (x, y, viewportWidth)
+ }
+
+ /// "Copy selector for related" and "Zap all related elements" need something related.
+ public var hasRelated: Bool { relatedCount > 1 && related != this }
+
+ /// Where the click was in a page view `width` points wide, from its top left.
+ public func point(inViewWidth width: Double) -> CGPoint {
+ let scale = viewportWidth > 0 ? width / viewportWidth : 1
+ return CGPoint(x: x * scale, y: y * scale)
+ }
+ }
+
+ public enum Action: String, CaseIterable, Sendable {
+ case copyThis, copyRelated, zapRelated
+
+ public var title: String {
+ switch self {
+ case .copyThis: "Copy selector for this"
+ case .copyRelated: "Copy selector for related"
+ case .zapRelated: "Zap all related elements"
+ }
+ }
+
+ public func isEnabled(for pick: Pick) -> Bool { self == .copyThis || pick.hasRelated }
+
+ /// The selector the action copies or zaps.
+ public func selector(for pick: Pick) -> String { self == .copyThis ? pick.this : pick.related }
+ }
+
+ /// The pick JSON `takeExpression` returned; nil for "" (no click yet) or anything else.
+ public static func parse(_ json: String) -> Pick? {
+ guard !json.isEmpty else { return nil }
+ return try? JSONDecoder().decode(Pick.self, from: Data(json.utf8))
+ }
+
+ /// Turns the picker on (once per page).
+ public static let script = """
+ (()=>{if(window.__craPick)return;
+ const esc=CSS.escape,ok=c=>/^[A-Za-z_-][\\w-]*$/.test(c)&&c.length<=32&&(c.match(/\\d/g)||[]).length<=2;
+ const count=s=>{try{return document.querySelectorAll(s).length}catch(e){return 0}};
+ const page=e=>!e||e===document.body||e===document.documentElement;
+ const part=e=>e.tagName.toLowerCase()+[...e.classList].filter(ok).map(c=>'.'+esc(c)).join('');
+ const idOf=e=>e.id&&ok(e.id)&&count('#'+esc(e.id))===1?'#'+esc(e.id):null;
+ const thisSel=e=>{const id=idOf(e);if(id)return id;if(count(part(e))===1)return part(e);const p=[];
+ for(let n=e;n&&!page(n);n=n.parentElement){const nid=idOf(n);if(nid){p.unshift(nid);break}
+ const same=n.parentElement?[...n.parentElement.children].filter(x=>x.tagName===n.tagName):[n];
+ p.unshift(part(n)+(same.length>1?':nth-of-type('+(same.indexOf(n)+1)+')':''));const s=p.join(' > ');if(count(s)===1)return s}
+ return p.join(' > ')||part(e)};
+ const relSel=e=>{const t=e.tagName.toLowerCase(),own=part(e),c=[own],par=e.parentElement;
+ const ps=page(par)?null:(idOf(par)||part(par));if(ps)c.push(ps+' > '+own);
+ for(const k of [...e.classList].filter(ok))c.push(t+'.'+esc(k));if(ps)c.push(ps+' > '+t);
+ for(const s of c){const n=count(s);if(n>1&&n<=100)return [s,n]}return [thisSel(e),1]};
+ const box=document.createElement('div');box.style.cssText='position:fixed;inset:0;pointer-events:none;z-index:2147483647';
+ document.documentElement.append(box);let over=null,held=null,shown=null;
+ const draw=()=>{box.replaceChildren();if(!over)return;const [rs]=relSel(over);let all=[];try{all=[...document.querySelectorAll(rs)]}catch(e){}
+ if(!all.includes(over))all.push(over);for(const el of all.slice(0,101)){const r=el.getBoundingClientRect(),d=document.createElement('div'),me=el===over;
+ d.style.cssText='position:fixed;box-sizing:border-box;border-radius:3px;left:'+r.left+'px;top:'+r.top+'px;width:'+r.width+'px;height:'+r.height+'px;'+
+ (me?'border:2px solid #ff6a3d;background:rgba(255,106,61,.18)':'border:1.5px dashed #ff6a3d;background:rgba(255,106,61,.08)');box.append(d)}};
+ const move=ev=>{if(held)return;const t=page(ev.target)?null:ev.target;if(t!==over){over=t;draw()}};
+ const stop=ev=>{if(ev.target===box||page(ev.target))return;ev.preventDefault();ev.stopPropagation();ev.stopImmediatePropagation()};
+ const click=ev=>{stop(ev);if(held||page(ev.target))return;over=ev.target;draw();const [r,n]=relSel(over);
+ held={this:thisSel(over),related:r,relatedCount:n,x:ev.clientX,y:ev.clientY,viewportWidth:innerWidth}};
+ const redraw=()=>{if(over)draw()};
+ for(const t of ['pointerdown','mousedown','pointerup','mouseup'])document.addEventListener(t,stop,true);
+ document.addEventListener('mouseover',move,true);document.addEventListener('click',click,true);addEventListener('scroll',redraw,true);
+ window.__craPick={take(){if(!held||shown===held)return '';shown=held;return JSON.stringify(held)},
+ resume(){held=null;shown=null},
+ stop(){for(const t of ['pointerdown','mousedown','pointerup','mouseup'])document.removeEventListener(t,stop,true);
+ document.removeEventListener('mouseover',move,true);document.removeEventListener('click',click,true);removeEventListener('scroll',redraw,true);
+ box.remove();delete window.__craPick}}})()
+ """
+
+ /// The held click as JSON, once; "" when there's none.
+ public static let takeExpression = "window.__craPick?window.__craPick.take():''"
+ /// After the menu: outline and click again.
+ public static let resumeExpression = "window.__craPick&&window.__craPick.resume()"
+ public static let stopExpression = "window.__craPick&&window.__craPick.stop()"
+}
diff --git a/Packages/CraCore/Tests/CraCoreTests/BoostPickerTests.swift b/Packages/CraCore/Tests/CraCoreTests/BoostPickerTests.swift
new file mode 100644
index 0000000..f5e7874
--- /dev/null
+++ b/Packages/CraCore/Tests/CraCoreTests/BoostPickerTests.swift
@@ -0,0 +1,35 @@
+import CoreGraphics
+import CraCore
+import Testing
+
+/// The Boost code panel's eyedropper (Arc 1.172.1's selector picker).
+struct BoostPickerTests {
+ @Test func readsTheHeldClick() throws {
+ let json = ##"{"this":"#a","related":"li.item","relatedCount":3,"x":40,"y":10,"viewportWidth":800}"##
+ let pick = try #require(BoostPicker.parse(json))
+ #expect(pick == BoostPicker.Pick(this: "#a", related: "li.item", relatedCount: 3, x: 40, y: 10, viewportWidth: 800))
+ #expect(BoostPicker.parse("") == nil, "no click yet")
+ #expect(BoostPicker.parse("null") == nil)
+ }
+
+ @Test func arcsMenuInArcsOrder() {
+ #expect(BoostPicker.Action.allCases.map(\.title) == ["Copy selector for this", "Copy selector for related", "Zap all related elements"])
+ }
+
+ @Test func relatedNeedsSomethingLikeIt() {
+ let alone = BoostPicker.Pick(this: "#solo", related: "#solo", relatedCount: 1, x: 0, y: 0, viewportWidth: 100)
+ let many = BoostPicker.Pick(this: "#a", related: "li.item", relatedCount: 3, x: 0, y: 0, viewportWidth: 100)
+ #expect(BoostPicker.Action.allCases.map { $0.isEnabled(for: alone) } == [true, false, false])
+ #expect(BoostPicker.Action.allCases.allSatisfy { $0.isEnabled(for: many) })
+ #expect(BoostPicker.Action.copyThis.selector(for: many) == "#a")
+ #expect(BoostPicker.Action.zapRelated.selector(for: many) == "li.item")
+ }
+
+ @Test func theMenuOpensWhereTheClickWas() {
+ // A page zoomed to 125 %: 800 CSS px across a 1000 pt view.
+ let pick = BoostPicker.Pick(this: "a", related: "a", relatedCount: 1, x: 80, y: 40, viewportWidth: 800)
+ #expect(pick.point(inViewWidth: 1000) == CGPoint(x: 100, y: 50))
+ let unknown = BoostPicker.Pick(this: "a", related: "a", relatedCount: 1, x: 80, y: 40, viewportWidth: 0)
+ #expect(unknown.point(inViewWidth: 1000) == CGPoint(x: 80, y: 40))
+ }
+}
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swift
index 4bcad47..d8b334a 100644
--- a/Sources/Cra/App/AppDelegate.swift
+++ b/Sources/Cra/App/AppDelegate.swift
@@ -902,6 +902,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
if let n = dict["gmailPreview"].flatMap(Int.init), let w = main.window { GmailPreviewCard.shared.demo(unread: n, in: w); 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 }
+ // boostPick=1|0|copyThis|copyRelated|zapRelated: the code panel's eyedropper on (the
+ // menu answered with that action) or off.
+ if let p = dict["boostPick"] { main.debugPick(p); 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.
diff --git a/Sources/Cra/UI/Boosts/BoostEditor.swift b/Sources/Cra/UI/Boosts/BoostEditor.swift
index 659cfbb..c976ab6 100644
--- a/Sources/Cra/UI/Boosts/BoostEditor.swift
+++ b/Sources/Cra/UI/Boosts/BoostEditor.swift
@@ -7,17 +7,28 @@ import SwiftUI
/// 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.
+/// CSS / JS switch; under the code, the eyedropper (Show Selector Picker), the hammer (Show
+/// Developer Tools) and, for JavaScript, Refresh this Page). 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) {
+ /// What the editor does to the page beside it.
+ struct PageActions {
+ var zap: (Bool) -> Void
+ var pick: (Bool) -> Void
+ var toggleDevTools: () -> Void
+ var devToolsOpen: () -> Bool
+ var reload: () -> Void
+ }
+
+ func open(_ boost: Boost, over window: NSWindow, page: PageActions) {
close()
let m = BoostEditorModel(boost: boost)
- m.zap = zap
+ m.page = page
+ m.devToolsOpen = page.devToolsOpen()
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)
@@ -40,6 +51,7 @@ final class BoostEditorController {
func close() {
model?.finishZap()
+ model?.finishPicking()
if let panel { panel.parent?.removeChildWindow(panel); panel.orderOut(nil) }
panel = nil
model = nil
@@ -47,6 +59,12 @@ final class BoostEditorController {
var isOpen: Bool { panel != nil }
+ /// The picker ends (its page went to the back).
+ func stopPicking() { model?.finishPicking() }
+
+ /// DevTools opened or closed (the hammer, ⌥⌘I or their own close button).
+ func devToolsChanged() { if let model { model.devToolsOpen = model.page.devToolsOpen() } }
+
/// What Zap hid, into the boost being edited.
func addZapped(_ selectors: [String]) {
CraLog.note("zap kept \(selectors.count) selector\(selectors.count == 1 ? "" : "s")")
@@ -71,7 +89,9 @@ final class BoostEditorModel {
var showingCode = false
var codeIsJS = false
var zapping = false
- @ObservationIgnored var zap: (Bool) -> Void = { _ in }
+ var picking = false
+ var devToolsOpen = false
+ @ObservationIgnored var page = BoostEditorController.PageActions(zap: { _ in }, pick: { _ in }, toggleDevTools: {}, devToolsOpen: { false }, reload: {})
@ObservationIgnored var onClose: () -> Void = {}
@ObservationIgnored var onWidth: (CGFloat) -> Void = { _ in }
@@ -103,13 +123,29 @@ final class BoostEditorModel {
}
func toggleZap() {
+ finishPicking()
zapping.toggle()
- zap(zapping)
+ page.zap(zapping)
}
- func finishZap() { if zapping { zapping = false; zap(false) } }
+ func finishZap() { if zapping { zapping = false; page.zap(false) } }
+
+ /// The eyedropper: outline elements on the page; a click offers their selectors.
+ func togglePicker() {
+ finishZap()
+ picking.toggle()
+ page.pick(picking)
+ }
+
+ func finishPicking() { if picking { picking = false; page.pick(false) } }
+
+ func toggleDevTools() {
+ page.toggleDevTools()
+ devToolsOpen.toggle()
+ }
func setCode(_ on: Bool) {
+ if !on { finishPicking() }
showingCode = on
onWidth(on ? 480 : 183)
}
@@ -254,14 +290,14 @@ private struct BoostEditorView: View {
.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 {
+ private func square(_ symbol: String, on: Bool, help: String, size: CGFloat = 42, _ 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)
+ .frame(width: size, height: 38)
.background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(on ? BoostStyle.ink : BoostStyle.button))
}
- .buttonStyle(.plain).help(help)
+ .buttonStyle(.plain).help(help).accessibilityLabel(help)
}
private func wide(_ title: String, trailing: String?, on: Bool = false) -> some View {
@@ -280,7 +316,21 @@ private struct BoostEditorView: 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)
+ // Arc: 38 pt squares 15 pt in, in a 69 pt strip under the 479 pt editor.
+ HStack(spacing: 10) {
+ square("eyedropper", on: model.picking, help: model.picking ? "Hide Selector Picker" : "Show Selector Picker", size: 38) {
+ model.togglePicker()
+ }
+ square("hammer", on: model.devToolsOpen, help: model.devToolsOpen ? "Hide Developer Tools" : "Show Developer Tools", size: 38) {
+ model.toggleDevTools()
+ }
+ if model.codeIsJS {
+ square("arrow.clockwise", on: false, help: "Refresh this Page", size: 38) { model.page.reload() }
+ }
+ Spacer()
+ }
+ .padding(.horizontal, 15)
+ .frame(height: 69).background(BoostStyle.panel)
}
.frame(width: 480)
}
diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swift
index 2a6d405..28b13d4 100644
--- a/Sources/Cra/UI/Windows/MainWindowController.swift
+++ b/Sources/Cra/UI/Windows/MainWindowController.swift
@@ -1280,6 +1280,7 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM
/// over the placeholder it reports. Alloy pages keep the shell's own split with CEF's
/// window on the right, for the focused tab only.
func browserManagerDevToolsChanged() {
+ BoostEditorController.shared.devToolsChanged()
guard let window else { return }
let visible = browsers.visibleDevToolsWindow
let shown = browsers.visibleDevToolsWindows
@@ -2805,7 +2806,82 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM
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) }
+ BoostEditorController.shared.open(boost, over: window, page: .init(
+ zap: { [weak self] on in self?.setZapping(on) },
+ pick: { [weak self] on in self?.setPicking(on) },
+ toggleDevTools: { [weak self] in self?.browsers.runDevTools(.toggle) },
+ devToolsOpen: { [weak self] in self?.browsers.visibleTabHasDevTools ?? false },
+ reload: { [weak self] in self?.currentBrowser?.reload() }))
+ }
+
+ /// The code panel's eyedropper (BoostPicker): the page outlines the element under the pointer
+ /// and the ones like it, and holds a click; Cra polls for it and offers Arc's menu there. The
+ /// poll puts the picker back after a navigation.
+ /// Testing without the pointer (cra://debug?boostPick=1|0|copyThis|copyRelated|zapRelated):
+ /// on (answering the menu with that action) or off.
+ func debugPick(_ value: String) {
+ pickAnswer = BoostPicker.Action(rawValue: value)
+ setPicking(value != "0")
+ }
+
+ private func setPicking(_ on: Bool) {
+ pickTimer?.invalidate()
+ pickTimer = nil
+ pickBrowser?.executeJavaScript(BoostPicker.stopExpression)
+ pickBrowser = nil
+ guard on, let b = currentBrowser else { return }
+ pickBrowser = b
+ b.executeJavaScript(BoostPicker.script)
+ let t = Timer(timeInterval: 0.15, repeats: true) { [weak self] _ in MainActor.assumeIsolated { self?.pollPick() } }
+ RunLoop.main.add(t, forMode: .common)
+ pickTimer = t
+ }
+
+ private func pollPick() {
+ guard let b = pickBrowser else { return }
+ guard b === currentBrowser else { setPicking(false); BoostEditorController.shared.stopPicking(); return }
+ let expression = BoostPicker.script + ";" + BoostPicker.takeExpression
+ guard let data = try? JSONSerialization.data(withJSONObject: ["expression": expression, "returnByValue": true]),
+ let params = String(data: data, encoding: .utf8) else { return }
+ b.sendDevToolsMethod("Runtime.evaluate", params: params) { [weak self, weak b] result, _ in
+ MainActor.assumeIsolated {
+ let o = result.flatMap { try? JSONSerialization.jsonObject(with: Data($0.utf8)) as? [String: Any] }
+ guard let self, let b, b === self.pickBrowser,
+ let pick = BoostPicker.parse((o?["result"] as? [String: Any])?["value"] as? String ?? "") else { return }
+ self.offerPick(pick, on: b)
+ }
+ }
+ }
+
+ /// Arc's menu after a click with the picker: copy this element's selector, or the related
+ /// ones', or zap them all.
+ private func offerPick(_ pick: BoostPicker.Pick, on b: CraBrowser) {
+ CraLog.note("boost pick this=\(pick.this) related=\(pick.related) (\(pick.relatedCount))")
+ defer { b.executeJavaScript(BoostPicker.resumeExpression) }
+ if let answer = pickAnswer { runPick(answer, pick); return }
+ let menu = NSMenu()
+ menu.autoenablesItems = false
+ for action in BoostPicker.Action.allCases {
+ let item = BlockMenuItem(title: action.title) { [weak self] in self?.runPick(action, pick) }
+ item.isEnabled = action.isEnabled(for: pick)
+ menu.addItem(item)
+ }
+ let view = b.containerView
+ let p = pick.point(inViewWidth: view.bounds.width)
+ menu.popUp(positioning: nil, at: NSPoint(x: p.x, y: view.isFlipped ? p.y : view.bounds.height - p.y), in: view)
+ }
+
+ private func runPick(_ action: BoostPicker.Action, _ pick: BoostPicker.Pick) {
+ guard action.isEnabled(for: pick) else { return }
+ let selector = action.selector(for: pick)
+ switch action {
+ case .copyThis, .copyRelated:
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(selector, forType: .string)
+ CraLog.note("boost pick copied \(selector)")
+ case .zapRelated:
+ BoostEditorController.shared.addZapped([selector])
+ }
}
/// Zap: the page outlines what's under the pointer, and a click hides it and keeps a selector
@@ -2826,6 +2902,10 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM
}
}
+ private var pickTimer: Timer?
+ private weak var pickBrowser: CraBrowser?
+ private var pickAnswer: BoostPicker.Action?
+
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){
diff --git a/Tests/Scenarios/boosts.scenario b/Tests/Scenarios/boosts.scenario
index 35c1fba..5bcbeb6 100644
--- a/Tests/Scenarios/boosts.scenario
+++ b/Tests/Scenarios/boosts.scenario
@@ -18,3 +18,22 @@ cra://debug?cdp=Runtime.evaluate&params={"expression":"(()=>{document.body.click
expect-log Cra cdp Runtime.evaluate .*"value":"zz-none-body-block"
cra://debug?boostZap=0
expect-log zap kept 1 selector$
+# The code panel's eyedropper (BoostPicker): a click is held, and Arc's menu copies the selector for the
+# element or zaps it and the ones like it.
+cra://debug?cdp=Runtime.evaluate&params={"expression":"(()=>{const u=document.createElement('ul');u.className='list';u.innerHTML='<li class=item>a</li><li class=item id=second>b</li><li class=item>c</li>';document.body.append(u);window.pickClick=()=>{const e=document.getElementById('second'),r=e.getBoundingClientRect();return e.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,clientX:r.left+2,clientY:r.top+2}))};return 'list'})()"}
+expect-log Cra cdp Runtime.evaluate .*"value":"list"
+cra://debug?boostPick=copyThis
+wait 1
+cra://debug?cdp=Runtime.evaluate&params={"expression":"'followed-'+window.pickClick()"}
+expect-log Cra cdp Runtime.evaluate .*"value":"followed-false"
+expect-log boost pick this=#second related=li\.item \(3\)
+expect-log boost pick copied #second$
+cra://debug?boostPick=zapRelated
+wait 1
+cra://debug?cdp=Runtime.evaluate&params={"expression":"(window.pickClick(),'zap-sent')"}
+expect-log Cra cdp Runtime.evaluate .*"value":"zap-sent"
+expect-log boost pick this=#second
+wait 1
+cra://debug?cdp=Runtime.evaluate&params={"expression":"'items-'+[...document.querySelectorAll('li.item')].map(e=>getComputedStyle(e).display).join(',')"}
+expect-log Cra cdp Runtime.evaluate .*"value":"items-none,none,none"
+cra://debug?boostPick=0
diff --git a/docs/arc-parity.md b/docs/arc-parity.md
index e47afed..b6eb6c1 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" | 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. |
+| 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. The Code panel's eyedropper (selector picker: outlines the element and the ones like it, then Copy selector for this / for related, Zap all related elements), hammer (Show / Hide Developer Tools) and, for JS, Refresh this Page. 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). |
@@ -156,7 +156,11 @@ in this sweep (Essential Shortcuts window, Library pages).
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
+ CSS / JS switch, a dark editor (479 pt; in 1.172.1 an arc:// page that only says "Internal debugging pages are
+ currently disabled"), and a 69 pt strip with 38 pt tools 15 pt in. From Arc's binary: the eyedropper is "Show /
+ Hide Selector Picker" (ARC_BoostsEditor.bundle's SelectorPicker.js ranks selectors for the element under the pointer;
+ after a click, "Copy selector for this", "Copy selector for related", "Zap all related elements"), the hammer "Show /
+ Hide Developer Tools", and an arrow.clockwise "Refresh this Page" (Cra shows it for JS, which runs on load). Delete asks "Delete this Boost?" in Arc's
dialog. Reference captures: docs/screenshots/arc-boost-*.png.
## Left for later, and why