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's ••• on the space header and its space menu (#40) (#58)
Victor Kildahl2f211dcec6ce
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex 6467c35..716648b 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -619,7 +619,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {case "closeSplitPane", "separateFromSplit", "flipSplitOrientation":return store.selectedTabID.flatMap { store.splitContaining($0) } != nilcase "addSplitView": return store.selectedTabID != nil- case "editSpace", "deleteSpace", "nextSpace", "previousSpace": return !main.isIncognito+ case "editSpace", "deleteSpace", "nextSpace", "previousSpace", "manageSpaces": return !main.isIncognitocase "closeLittleWindows": return !littleWindows.isEmptydefault: break}@@ -747,6 +747,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {case "newSpace": main.showSpaceEditor(space: nil)case "editSpace": if !main.isIncognito { main.showSpaceEditor(space: store.focusedSpace) }case "deleteSpace": if !main.isIncognito { confirmDeleteSpace(store.focusedSpace) }+ case "manageSpaces": if !main.isIncognito { main.showManageSpaces() }case "closeTab":// Arc: "Close current tab or window".if current != nil { main.closeCurrentTab() } else { main.window?.performClose(nil) }@@ -840,8 +841,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {return}let a = NSAlert()- a.messageText = "Delete “\(space.title)”?"- a.informativeText = "Its tabs move to the archive, where you can restore them."+ // Arc 1.171's copy (WindowsData+CloseItems).+ a.messageText = "Delete your \(space.title) Space?"+ a.informativeText = "This will archive all the tabs and folders inside it."a.addButton(withTitle: "Delete")a.addButton(withTitle: "Cancel")a.alertStyle = .warning@@ -961,7 +963,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {let spaces = NSMenu(title: "Spaces")spaces.addItem(item("nextSpace")); spaces.addItem(item("previousSpace"))spaces.addItem(.separator())- spaces.addItem(item("editSpace")); spaces.addItem(item("deleteSpace"))+ spaces.addItem(item("editSpace")); spaces.addItem(item("deleteSpace")); spaces.addItem(item("manageSpaces"))spaces.addItem(.separator())for n in 1...9 { spaces.addItem(item("space\(n)")) }menubar.addItem(submenu: spaces, title: "Spaces")diff --git a/Sources/Cra/App/KeyBindings.swift b/Sources/Cra/App/KeyBindings.swiftindex e54fb6f..5a198aa 100644--- a/Sources/Cra/App/KeyBindings.swift+++ b/Sources/Cra/App/KeyBindings.swift@@ -209,6 +209,7 @@ final class KeyBindingRegistry {KeyAction(id: "previousSpace", name: "Previous Space", section: .spaces, shortcuts: [Shortcut(Shortcut.left, cmdOpt)], inCommandBar: false),KeyAction(id: "editSpace", name: "Edit Space…", section: .spaces, shortcuts: [], triggers: ["theme", "color", "emoji", "edit space"]),KeyAction(id: "deleteSpace", name: "Delete Space…", section: .spaces, shortcuts: [], triggers: ["delete space", "remove space"]),+ KeyAction(id: "manageSpaces", name: "Manage Spaces…", section: .spaces, shortcuts: [], triggers: ["manage spaces", "reorder spaces"]),// TabsKeyAction(id: "pinTab", name: "Pin/Unpin Tab", section: .tabs, shortcuts: [Shortcut("d", cmd)], triggers: ["pin", "unpin"]),KeyAction(id: "nextTab", name: "Next Tab", section: .tabs, shortcuts: [Shortcut(Shortcut.down, cmdOpt)], inCommandBar: false),diff --git a/Sources/Cra/Model/SidebarModel.swift b/Sources/Cra/Model/SidebarModel.swiftindex 4f97e1c..a00db57 100644--- a/Sources/Cra/Model/SidebarModel.swift+++ b/Sources/Cra/Model/SidebarModel.swift@@ -282,6 +282,8 @@ struct Space: Identifiable, Codable, Equatable {var createdAt: Date/// The profile its pages load in (Arc: SpaceModel.profile); nil is the Default profile.var profileID: UUID?+ /// An SF Symbol from the Icon tab of Arc's icon picker, shown instead of `emoji` (then empty).+ var symbol: String? = nil}/// Arc's Profiles: logins, cookies, site storage and Chromium's own data kept apart@@ -635,6 +637,7 @@ extension Space {todayContainerID = try c.decode(UUID.self, forKey: .todayContainerID)createdAt = try c.decode(Date.self, forKey: .createdAt)profileID = try c.decodeIfPresent(UUID.self, forKey: .profileID)+ symbol = try c.decodeIfPresent(String.self, forKey: .symbol)}}diff --git a/Sources/Cra/Services/SidebarStore.swift b/Sources/Cra/Services/SidebarStore.swiftindex 64356ca..e7cf99e 100644--- a/Sources/Cra/Services/SidebarStore.swift+++ b/Sources/Cra/Services/SidebarStore.swift@@ -1336,6 +1336,25 @@ final class SidebarStore {touch()}+ /// Arc's "Export “<space>” into Folder": the space's favorites, pinned and Today items go into+ /// a folder named after it at the top of the target's pinned list, then the space is deleted+ /// (Arc logs it as "Space turned into folder"). Live folders fill themselves, so they go with it.+ @discardableResult+ func exportSpace(_ id: UUID, intoFolderIn target: UUID) -> SidebarItem? {+ guard id != target, let space = spaces[id], let dest = spaces[target], spaceOrder.count > 1 else { return nil }+ let folder = createFolder(named: space.title, in: dest.pinnedContainerID, index: 0)+ let moving = [space.favoritesContainerID, space.pinnedContainerID, space.todayContainerID]+ .flatMap { children(of: $0) }+ .filter { !$0.isLiveFolder }+ .map(\.id)+ moveItems(moving, to: folder.id, index: nil)+ var windows = prefs.windows+ for i in windows.indices where windows[i].focusedSpaceID == id { windows[i].focusedSpaceID = target }+ prefs.windows = windows+ deleteSpace(id)+ return items[folder.id]+ }+// MARK: Profilesfunc profile(_ id: UUID?) -> BrowserProfile? { id.flatMap { p in profiles.first { $0.id == p } } }diff --git a/Sources/Cra/UI/Settings/ShortcutsPane.swift b/Sources/Cra/UI/Settings/ShortcutsPane.swiftindex 7443f0a..24a1e1a 100644--- a/Sources/Cra/UI/Settings/ShortcutsPane.swift+++ b/Sources/Cra/UI/Settings/ShortcutsPane.swift@@ -288,6 +288,7 @@ enum ShortcutDescriptions {"previousSpace": "Switch to the previous space.","editSpace": "Change the space’s name, emoji and theme.","deleteSpace": "Delete the current space.",+ "manageSpaces": "Open the Library’s Spaces page: every space side by side, to reorder or edit them.","pinTab": "Pin the tab or unpin it.","nextTab": "Switch to the next tab.","previousTab": "Switch to the previous tab.",diff --git a/Sources/Cra/UI/Sidebar/EmojiCatalog+Data.swift b/Sources/Cra/UI/Sidebar/EmojiCatalog+Data.swiftnew file mode 100644index 0000000..796ab47--- /dev/null+++ b/Sources/Cra/UI/Sidebar/EmojiCatalog+Data.swift@@ -0,0 +1,1893 @@+// Generated by scripts/make-emoji-catalog.py from Unicode emoji-test.txt 17.0 (emoji up to 15.0). Do not edit.++extension EmojiCatalog {+ /// Category, then one "<emoji> <name>" per line.+ static let data: [(String, String)] = [+ ("smileys", """+😀 grinning face+😃 grinning face with big eyes+😄 grinning face with smiling eyes+😁 beaming face with smiling eyes+😆 grinning squinting face+😅 grinning face with sweat+🤣 rolling on the floor laughing+😂 face with tears of joy+🙂 slightly smiling face+🙃 upside-down face+🫠 melting face+😉 winking face+😊 smiling face with smiling eyes+😇 smiling face with halo+🥰 smiling face with hearts+😍 smiling face with heart-eyes+🤩 star-struck+😘 face blowing a kiss+😗 kissing face+☺️ smiling face+😚 kissing face with closed eyes+😙 kissing face with smiling eyes+🥲 smiling face with tear+😋 face savoring food+😛 face with tongue+😜 winking face with tongue+🤪 zany face+😝 squinting face with tongue+🤑 money-mouth face+🤗 smiling face with open hands+🤭 face with hand over mouth+🫢 face with open eyes and hand over mouth+🫣 face with peeking eye+🤫 shushing face+🤔 thinking face+🫡 saluting face+🤐 zipper-mouth face+🤨 face with raised eyebrow+😐 neutral face+😑 expressionless face+😶 face without mouth+🫥 dotted line face+😶🌫️ face in clouds+😏 smirking face+😒 unamused face+🙄 face with rolling eyes+😬 grimacing face+😮💨 face exhaling+🤥 lying face+🫨 shaking face+😌 relieved face+😔 pensive face+😪 sleepy face+🤤 drooling face+😴 sleeping face+😷 face with medical mask+🤒 face with thermometer+🤕 face with head-bandage+🤢 nauseated face+🤮 face vomiting+🤧 sneezing face+🥵 hot face+🥶 cold face+🥴 woozy face+😵 face with crossed-out eyes+😵💫 face with spiral eyes+🤯 exploding head+🤠 cowboy hat face+🥳 partying face+🥸 disguised face+😎 smiling face with sunglasses+🤓 nerd face+🧐 face with monocle+😕 confused face+🫤 face with diagonal mouth+😟 worried face+🙁 slightly frowning face+☹️ frowning face+😮 face with open mouth+😯 hushed face+😲 astonished face+😳 flushed face+🥺 pleading face+🥹 face holding back tears+😦 frowning face with open mouth+😧 anguished face+😨 fearful face+😰 anxious face with sweat+😥 sad but relieved face+😢 crying face+😭 loudly crying face+😱 face screaming in fear+😖 confounded face+😣 persevering face+😞 disappointed face+😓 downcast face with sweat+😩 weary face+😫 tired face+🥱 yawning face+😤 face with steam from nose+😡 enraged face+😠 angry face+🤬 face with symbols on mouth+😈 smiling face with horns+👿 angry face with horns+💀 skull+☠️ skull and crossbones+💩 pile of poo+🤡 clown face+👹 ogre+👺 goblin+👻 ghost+👽 alien+👾 alien monster+🤖 robot+😺 grinning cat+😸 grinning cat with smiling eyes+😹 cat with tears of joy+😻 smiling cat with heart-eyes+😼 cat with wry smile+😽 kissing cat+🙀 weary cat+😿 crying cat+😾 pouting cat+🙈 see-no-evil monkey+🙉 hear-no-evil monkey+🙊 speak-no-evil monkey+💌 love letter+💘 heart with arrow+💝 heart with ribbon+💖 sparkling heart+💗 growing heart+💓 beating heart+💞 revolving hearts+💕 two hearts+💟 heart decoration+❣️ heart exclamation+💔 broken heart+❤️🔥 heart on fire+❤️🩹 mending heart+❤️ red heart+🩷 pink heart+🧡 orange heart+💛 yellow heart+💚 green heart+💙 blue heart+🩵 light blue heart+💜 purple heart+🤎 brown heart+🖤 black heart+🩶 grey heart+🤍 white heart+💋 kiss mark+💯 hundred points+💢 anger symbol+💥 collision+💫 dizzy+💦 sweat droplets+💨 dashing away+🕳️ hole+💬 speech balloon+👁️🗨️ eye in speech bubble+🗨️ left speech bubble+🗯️ right anger bubble+💭 thought balloon+💤 ZZZ+👋 waving hand+🤚 raised back of hand+🖐️ hand with fingers splayed+✋ raised hand+🖖 vulcan salute+🫱 rightwards hand+🫲 leftwards hand+🫳 palm down hand+🫴 palm up hand+🫷 leftwards pushing hand+🫸 rightwards pushing hand+👌 OK hand+🤌 pinched fingers+🤏 pinching hand+✌️ victory hand+🤞 crossed fingers+🫰 hand with index finger and thumb crossed+🤟 love-you gesture+🤘 sign of the horns+🤙 call me hand+👈 backhand index pointing left+👉 backhand index pointing right+👆 backhand index pointing up+🖕 middle finger+👇 backhand index pointing down+☝️ index pointing up+🫵 index pointing at the viewer+👍 thumbs up+👎 thumbs down+✊ raised fist+👊 oncoming fist+🤛 left-facing fist+🤜 right-facing fist+👏 clapping hands+🙌 raising hands+🫶 heart hands+👐 open hands+🤲 palms up together+🤝 handshake+🙏 folded hands+✍️ writing hand+💅 nail polish+🤳 selfie+💪 flexed biceps+🦾 mechanical arm+🦿 mechanical leg+🦵 leg+🦶 foot+👂 ear+🦻 ear with hearing aid+👃 nose+🧠 brain+🫀 anatomical heart+🫁 lungs+🦷 tooth+🦴 bone+👀 eyes+👁️ eye+👅 tongue+👄 mouth+🫦 biting lip+👶 baby+🧒 child+👦 boy+👧 girl+🧑 person+👱 person: blond hair+👨 man+🧔 person: beard+🧔♂️ man: beard+🧔♀️ woman: beard+👨🦰 man: red hair+👨🦱 man: curly hair+👨🦳 man: white hair+👨🦲 man: bald+👩 woman+👩🦰 woman: red hair+🧑🦰 person: red hair+👩🦱 woman: curly hair+🧑🦱 person: curly hair+👩🦳 woman: white hair+🧑🦳 person: white hair+👩🦲 woman: bald+🧑🦲 person: bald+👱♀️ woman: blond hair+👱♂️ man: blond hair+🧓 older person+👴 old man+👵 old woman+🙍 person frowning+🙍♂️ man frowning+🙍♀️ woman frowning+🙎 person pouting+🙎♂️ man pouting+🙎♀️ woman pouting+🙅 person gesturing NO+🙅♂️ man gesturing NO+🙅♀️ woman gesturing NO+🙆 person gesturing OK+🙆♂️ man gesturing OK+🙆♀️ woman gesturing OK+💁 person tipping hand+💁♂️ man tipping hand+💁♀️ woman tipping hand+🙋 person raising hand+🙋♂️ man raising hand+🙋♀️ woman raising hand+🧏 deaf person+🧏♂️ deaf man+🧏♀️ deaf woman+🙇 person bowing+🙇♂️ man bowing+🙇♀️ woman bowing+🤦 person facepalming+🤦♂️ man facepalming+🤦♀️ woman facepalming+🤷 person shrugging+🤷♂️ man shrugging+🤷♀️ woman shrugging+🧑⚕️ health worker+👨⚕️ man health worker+👩⚕️ woman health worker+🧑🎓 student+👨🎓 man student+👩🎓 woman student+🧑🏫 teacher+👨🏫 man teacher+👩🏫 woman teacher+🧑⚖️ judge+👨⚖️ man judge+👩⚖️ woman judge+🧑🌾 farmer+👨🌾 man farmer+👩🌾 woman farmer+🧑🍳 cook+👨🍳 man cook+👩🍳 woman cook+🧑🔧 mechanic+👨🔧 man mechanic+👩🔧 woman mechanic+🧑🏭 factory worker+👨🏭 man factory worker+👩🏭 woman factory worker+🧑💼 office worker+👨💼 man office worker+👩💼 woman office worker+🧑🔬 scientist+👨🔬 man scientist+👩🔬 woman scientist+🧑💻 technologist+👨💻 man technologist+👩💻 woman technologist+🧑🎤 singer+👨🎤 man singer+👩🎤 woman singer+🧑🎨 artist+👨🎨 man artist+👩🎨 woman artist+🧑✈️ pilot+👨✈️ man pilot+👩✈️ woman pilot+🧑🚀 astronaut+👨🚀 man astronaut+👩🚀 woman astronaut+🧑🚒 firefighter+👨🚒 man firefighter+👩🚒 woman firefighter+👮 police officer+👮♂️ man police officer+👮♀️ woman police officer+🕵️ detective+🕵️♂️ man detective+🕵️♀️ woman detective+💂 guard+💂♂️ man guard+💂♀️ woman guard+🥷 ninja+👷 construction worker+👷♂️ man construction worker+👷♀️ woman construction worker+🫅 person with crown+🤴 prince+👸 princess+👳 person wearing turban+👳♂️ man wearing turban+👳♀️ woman wearing turban+👲 person with skullcap+🧕 woman with headscarf+🤵 person in tuxedo+🤵♂️ man in tuxedo+🤵♀️ woman in tuxedo+👰 person with veil+👰♂️ man with veil+👰♀️ woman with veil+🤰 pregnant woman+🫃 pregnant man+🫄 pregnant person+🤱 breast-feeding+👩🍼 woman feeding baby+👨🍼 man feeding baby+🧑🍼 person feeding baby+👼 baby angel+🎅 Santa Claus+🤶 Mrs. Claus+🧑🎄 Mx Claus+🦸 superhero+🦸♂️ man superhero+🦸♀️ woman superhero+🦹 supervillain+🦹♂️ man supervillain+🦹♀️ woman supervillain+🧙 mage+🧙♂️ man mage+🧙♀️ woman mage+🧚 fairy+🧚♂️ man fairy+🧚♀️ woman fairy+🧛 vampire+🧛♂️ man vampire+🧛♀️ woman vampire+🧜 merperson+🧜♂️ merman+🧜♀️ mermaid+🧝 elf+🧝♂️ man elf+🧝♀️ woman elf+🧞 genie+🧞♂️ man genie+🧞♀️ woman genie+🧟 zombie+🧟♂️ man zombie+🧟♀️ woman zombie+🧌 troll+💆 person getting massage+💆♂️ man getting massage+💆♀️ woman getting massage+💇 person getting haircut+💇♂️ man getting haircut+💇♀️ woman getting haircut+🚶 person walking+🚶♂️ man walking+🚶♀️ woman walking+🧍 person standing+🧍♂️ man standing+🧍♀️ woman standing+🧎 person kneeling+🧎♂️ man kneeling+🧎♀️ woman kneeling+🧑🦯 person with white cane+👨🦯 man with white cane+👩🦯 woman with white cane+🧑🦼 person in motorized wheelchair+👨🦼 man in motorized wheelchair+👩🦼 woman in motorized wheelchair+🧑🦽 person in manual wheelchair+👨🦽 man in manual wheelchair+👩🦽 woman in manual wheelchair+🏃 person running+🏃♂️ man running+🏃♀️ woman running+💃 woman dancing+🕺 man dancing+🕴️ person in suit levitating+👯 people with bunny ears+👯♂️ men with bunny ears+👯♀️ women with bunny ears+🧖 person in steamy room+🧖♂️ man in steamy room+🧖♀️ woman in steamy room+🧗 person climbing+🧗♂️ man climbing+🧗♀️ woman climbing+🤺 person fencing+🏇 horse racing+⛷️ skier+🏂 snowboarder+🏌️ person golfing+🏌️♂️ man golfing+🏌️♀️ woman golfing+🏄 person surfing+🏄♂️ man surfing+🏄♀️ woman surfing+🚣 person rowing boat+🚣♂️ man rowing boat+🚣♀️ woman rowing boat+🏊 person swimming+🏊♂️ man swimming+🏊♀️ woman swimming+⛹️ person bouncing ball+⛹️♂️ man bouncing ball+⛹️♀️ woman bouncing ball+🏋️ person lifting weights+🏋️♂️ man lifting weights+🏋️♀️ woman lifting weights+🚴 person biking+🚴♂️ man biking+🚴♀️ woman biking+🚵 person mountain biking+🚵♂️ man mountain biking+🚵♀️ woman mountain biking+🤸 person cartwheeling+🤸♂️ man cartwheeling+🤸♀️ woman cartwheeling+🤼 people wrestling+🤼♂️ men wrestling+🤼♀️ women wrestling+🤽 person playing water polo+🤽♂️ man playing water polo+🤽♀️ woman playing water polo+🤾 person playing handball+🤾♂️ man playing handball+🤾♀️ woman playing handball+🤹 person juggling+🤹♂️ man juggling+🤹♀️ woman juggling+🧘 person in lotus position+🧘♂️ man in lotus position+🧘♀️ woman in lotus position+🛀 person taking bath+🛌 person in bed+🧑🤝🧑 people holding hands+👭 women holding hands+👫 woman and man holding hands+👬 men holding hands+💏 kiss+👩❤️💋👨 kiss: woman, man+👨❤️💋👨 kiss: man, man+👩❤️💋👩 kiss: woman, woman+💑 couple with heart+👩❤️👨 couple with heart: woman, man+👨❤️👨 couple with heart: man, man+👩❤️👩 couple with heart: woman, woman+👨👩👦 family: man, woman, boy+👨👩👧 family: man, woman, girl+👨👩👧👦 family: man, woman, girl, boy+👨👩👦👦 family: man, woman, boy, boy+👨👩👧👧 family: man, woman, girl, girl+👨👨👦 family: man, man, boy+👨👨👧 family: man, man, girl+👨👨👧👦 family: man, man, girl, boy+👨👨👦👦 family: man, man, boy, boy+👨👨👧👧 family: man, man, girl, girl+👩👩👦 family: woman, woman, boy+👩👩👧 family: woman, woman, girl+👩👩👧👦 family: woman, woman, girl, boy+👩👩👦👦 family: woman, woman, boy, boy+👩👩👧👧 family: woman, woman, girl, girl+👨👦 family: man, boy+👨👦👦 family: man, boy, boy+👨👧 family: man, girl+👨👧👦 family: man, girl, boy+👨👧👧 family: man, girl, girl+👩👦 family: woman, boy+👩👦👦 family: woman, boy, boy+👩👧 family: woman, girl+👩👧👦 family: woman, girl, boy+👩👧👧 family: woman, girl, girl+🗣️ speaking head+👤 bust in silhouette+👥 busts in silhouette+🫂 people hugging+👪 family+👣 footprints+"""),+ ("nature", """+🐵 monkey face+🐒 monkey+🦍 gorilla+🦧 orangutan+🐶 dog face+🐕 dog+🦮 guide dog+🐕🦺 service dog+🐩 poodle+🐺 wolf+🦊 fox+🦝 raccoon+🐱 cat face+🐈 cat+🐈⬛ black cat+🦁 lion+🐯 tiger face+🐅 tiger+🐆 leopard+🐴 horse face+🫎 moose+🫏 donkey+🐎 horse+🦄 unicorn+🦓 zebra+🦌 deer+🦬 bison+🐮 cow face+🐂 ox+🐃 water buffalo+🐄 cow+🐷 pig face+🐖 pig+🐗 boar+🐽 pig nose+🐏 ram+🐑 ewe+🐐 goat+🐪 camel+🐫 two-hump camel+🦙 llama+🦒 giraffe+🐘 elephant+🦣 mammoth+🦏 rhinoceros+🦛 hippopotamus+🐭 mouse face+🐁 mouse+🐀 rat+🐹 hamster+🐰 rabbit face+🐇 rabbit+🐿️ chipmunk+🦫 beaver+🦔 hedgehog+🦇 bat+🐻 bear+🐻❄️ polar bear+🐨 koala+🐼 panda+🦥 sloth+🦦 otter+🦨 skunk+🦘 kangaroo+🦡 badger+🐾 paw prints+🦃 turkey+🐔 chicken+🐓 rooster+🐣 hatching chick+🐤 baby chick+🐥 front-facing baby chick+🐦 bird+🐧 penguin+🕊️ dove+🦅 eagle+🦆 duck+🦢 swan+🦉 owl+🦤 dodo+🪶 feather+🦩 flamingo+🦚 peacock+🦜 parrot+🪽 wing+🐦⬛ black bird+🪿 goose+🐸 frog+🐊 crocodile+🐢 turtle+🦎 lizard+🐍 snake+🐲 dragon face+🐉 dragon+🦕 sauropod+🦖 T-Rex+🐳 spouting whale+🐋 whale+🐬 dolphin+🦭 seal+🐟 fish+🐠 tropical fish+🐡 blowfish+🦈 shark+🐙 octopus+🐚 spiral shell+🪸 coral+🪼 jellyfish+🦀 crab+🦞 lobster+🦐 shrimp+🦑 squid+🦪 oyster+🐌 snail+🦋 butterfly+🐛 bug+🐜 ant+🐝 honeybee+🪲 beetle+🐞 lady beetle+🦗 cricket+🪳 cockroach+🕷️ spider+🕸️ spider web+🦂 scorpion+🦟 mosquito+🪰 fly+🪱 worm+🦠 microbe+💐 bouquet+🌸 cherry blossom+💮 white flower+🪷 lotus+🏵️ rosette+🌹 rose+🥀 wilted flower+🌺 hibiscus+🌻 sunflower+🌼 blossom+🌷 tulip+🪻 hyacinth+🌱 seedling+🪴 potted plant+🌲 evergreen tree+🌳 deciduous tree+🌴 palm tree+🌵 cactus+🌾 sheaf of rice+🌿 herb+☘️ shamrock+🍀 four leaf clover+🍁 maple leaf+🍂 fallen leaf+🍃 leaf fluttering in wind+🪹 empty nest+🪺 nest with eggs+🍄 mushroom+"""),+ ("food", """+🍇 grapes+🍈 melon+🍉 watermelon+🍊 tangerine+🍋 lemon+🍌 banana+🍍 pineapple+🥭 mango+🍎 red apple+🍏 green apple+🍐 pear+🍑 peach+🍒 cherries+🍓 strawberry+🫐 blueberries+🥝 kiwi fruit+🍅 tomato+🫒 olive+🥥 coconut+🥑 avocado+🍆 eggplant+🥔 potato+🥕 carrot+🌽 ear of corn+🌶️ hot pepper+🫑 bell pepper+🥒 cucumber+🥬 leafy green+🥦 broccoli+🧄 garlic+🧅 onion+🥜 peanuts+🫘 beans+🌰 chestnut+🫚 ginger root+🫛 pea pod+🍞 bread+🥐 croissant+🥖 baguette bread+🫓 flatbread+🥨 pretzel+🥯 bagel+🥞 pancakes+🧇 waffle+🧀 cheese wedge+🍖 meat on bone+🍗 poultry leg+🥩 cut of meat+🥓 bacon+🍔 hamburger+🍟 french fries+🍕 pizza+🌭 hot dog+🥪 sandwich+🌮 taco+🌯 burrito+🫔 tamale+🥙 stuffed flatbread+🧆 falafel+🥚 egg+🍳 cooking+🥘 shallow pan of food+🍲 pot of food+🫕 fondue+🥣 bowl with spoon+🥗 green salad+🍿 popcorn+🧈 butter+🧂 salt+🥫 canned food+🍱 bento box+🍘 rice cracker+🍙 rice ball+🍚 cooked rice+🍛 curry rice+🍜 steaming bowl+🍝 spaghetti+🍠 roasted sweet potato+🍢 oden+🍣 sushi+🍤 fried shrimp+🍥 fish cake with swirl+🥮 moon cake+🍡 dango+🥟 dumpling+🥠 fortune cookie+🥡 takeout box+🍦 soft ice cream+🍧 shaved ice+🍨 ice cream+🍩 doughnut+🍪 cookie+🎂 birthday cake+🍰 shortcake+🧁 cupcake+🥧 pie+🍫 chocolate bar+🍬 candy+🍭 lollipop+🍮 custard+🍯 honey pot+🍼 baby bottle+🥛 glass of milk+☕ hot beverage+🫖 teapot+🍵 teacup without handle+🍶 sake+🍾 bottle with popping cork+🍷 wine glass+🍸 cocktail glass+🍹 tropical drink+🍺 beer mug+🍻 clinking beer mugs+🥂 clinking glasses+🥃 tumbler glass+🫗 pouring liquid+🥤 cup with straw+🧋 bubble tea+🧃 beverage box+🧉 mate+🧊 ice+🥢 chopsticks+🍽️ fork and knife with plate+🍴 fork and knife+🥄 spoon+🔪 kitchen knife+🫙 jar+🏺 amphora+"""),+ ("activities", """+🎃 jack-o-lantern+🎄 Christmas tree+🎆 fireworks+🎇 sparkler+🧨 firecracker+✨ sparkles+🎈 balloon+🎉 party popper+🎊 confetti ball+🎋 tanabata tree+🎍 pine decoration+🎎 Japanese dolls+🎏 carp streamer+🎐 wind chime+🎑 moon viewing ceremony+🧧 red envelope+🎀 ribbon+🎁 wrapped gift+🎗️ reminder ribbon+🎟️ admission tickets+🎫 ticket+🎖️ military medal+🏆 trophy+🏅 sports medal+🥇 1st place medal+🥈 2nd place medal+🥉 3rd place medal+⚽ soccer ball+⚾ baseball+🥎 softball+🏀 basketball+🏐 volleyball+🏈 american football+🏉 rugby football+🎾 tennis+🥏 flying disc+🎳 bowling+🏏 cricket game+🏑 field hockey+🏒 ice hockey+🥍 lacrosse+🏓 ping pong+🏸 badminton+🥊 boxing glove+🥋 martial arts uniform+🥅 goal net+⛳ flag in hole+⛸️ ice skate+🎣 fishing pole+🤿 diving mask+🎽 running shirt+🎿 skis+🛷 sled+🥌 curling stone+🎯 bullseye+🪀 yo-yo+🪁 kite+🔫 water pistol+🎱 pool 8 ball+🔮 crystal ball+🪄 magic wand+🎮 video game+🕹️ joystick+🎰 slot machine+🎲 game die+🧩 puzzle piece+🧸 teddy bear+🪅 piñata+🪩 mirror ball+🪆 nesting dolls+♠️ spade suit+♥️ heart suit+♦️ diamond suit+♣️ club suit+♟️ chess pawn+🃏 joker+🀄 mahjong red dragon+🎴 flower playing cards+🎭 performing arts+🖼️ framed picture+🎨 artist palette+🧵 thread+🪡 sewing needle+🧶 yarn+🪢 knot+"""),+ ("travel", """+🌍 globe showing Europe-Africa+🌎 globe showing Americas+🌏 globe showing Asia-Australia+🌐 globe with meridians+🗺️ world map+🗾 map of Japan+🧭 compass+🏔️ snow-capped mountain+⛰️ mountain+🌋 volcano+🗻 mount fuji+🏕️ camping+🏖️ beach with umbrella+🏜️ desert+🏝️ desert island+🏞️ national park+🏟️ stadium+🏛️ classical building+🏗️ building construction+🧱 brick+🪨 rock+🪵 wood+🛖 hut+🏘️ houses+🏚️ derelict house+🏠 house+🏡 house with garden+🏢 office building+🏣 Japanese post office+🏤 post office+🏥 hospital+🏦 bank+🏨 hotel+🏩 love hotel+🏪 convenience store+🏫 school+🏬 department store+🏭 factory+🏯 Japanese castle+🏰 castle+💒 wedding+🗼 Tokyo tower+🗽 Statue of Liberty+⛪ church+🕌 mosque+🛕 hindu temple+🕍 synagogue+⛩️ shinto shrine+🕋 kaaba+⛲ fountain+⛺ tent+🌁 foggy+🌃 night with stars+🏙️ cityscape+🌄 sunrise over mountains+🌅 sunrise+🌆 cityscape at dusk+🌇 sunset+🌉 bridge at night+♨️ hot springs+🎠 carousel horse+🛝 playground slide+🎡 ferris wheel+🎢 roller coaster+💈 barber pole+🎪 circus tent+🚂 locomotive+🚃 railway car+🚄 high-speed train+🚅 bullet train+🚆 train+🚇 metro+🚈 light rail+🚉 station+🚊 tram+🚝 monorail+🚞 mountain railway+🚋 tram car+🚌 bus+🚍 oncoming bus+🚎 trolleybus+🚐 minibus+🚑 ambulance+🚒 fire engine+🚓 police car+🚔 oncoming police car+🚕 taxi+🚖 oncoming taxi+🚗 automobile+🚘 oncoming automobile+🚙 sport utility vehicle+🛻 pickup truck+🚚 delivery truck+🚛 articulated lorry+🚜 tractor+🏎️ racing car+🏍️ motorcycle+🛵 motor scooter+🦽 manual wheelchair+🦼 motorized wheelchair+🛺 auto rickshaw+🚲 bicycle+🛴 kick scooter+🛹 skateboard+🛼 roller skate+🚏 bus stop+🛣️ motorway+🛤️ railway track+🛢️ oil drum+⛽ fuel pump+🛞 wheel+🚨 police car light+🚥 horizontal traffic light+🚦 vertical traffic light+🛑 stop sign+🚧 construction+⚓ anchor+🛟 ring buoy+⛵ sailboat+🛶 canoe+🚤 speedboat+🛳️ passenger ship+⛴️ ferry+🛥️ motor boat+🚢 ship+✈️ airplane+🛩️ small airplane+🛫 airplane departure+🛬 airplane arrival+🪂 parachute+💺 seat+🚁 helicopter+🚟 suspension railway+🚠 mountain cableway+🚡 aerial tramway+🛰️ satellite+🚀 rocket+🛸 flying saucer+🛎️ bellhop bell+🧳 luggage+⌛ hourglass done+⏳ hourglass not done+⌚ watch+⏰ alarm clock+⏱️ stopwatch+⏲️ timer clock+🕰️ mantelpiece clock+🕛 twelve o’clock+🕧 twelve-thirty+🕐 one o’clock+🕜 one-thirty+🕑 two o’clock+🕝 two-thirty+🕒 three o’clock+🕞 three-thirty+🕓 four o’clock+🕟 four-thirty+🕔 five o’clock+🕠 five-thirty+🕕 six o’clock+🕡 six-thirty+🕖 seven o’clock+🕢 seven-thirty+🕗 eight o’clock+🕣 eight-thirty+🕘 nine o’clock+🕤 nine-thirty+🕙 ten o’clock+🕥 ten-thirty+🕚 eleven o’clock+🕦 eleven-thirty+🌑 new moon+🌒 waxing crescent moon+🌓 first quarter moon+🌔 waxing gibbous moon+🌕 full moon+🌖 waning gibbous moon+🌗 last quarter moon+🌘 waning crescent moon+🌙 crescent moon+🌚 new moon face+🌛 first quarter moon face+🌜 last quarter moon face+🌡️ thermometer+☀️ sun+🌝 full moon face+🌞 sun with face+🪐 ringed planet+⭐ star+🌟 glowing star+🌠 shooting star+🌌 milky way+☁️ cloud+⛅ sun behind cloud+⛈️ cloud with lightning and rain+🌤️ sun behind small cloud+🌥️ sun behind large cloud+🌦️ sun behind rain cloud+🌧️ cloud with rain+🌨️ cloud with snow+🌩️ cloud with lightning+🌪️ tornado+🌫️ fog+🌬️ wind face+🌀 cyclone+🌈 rainbow+🌂 closed umbrella+☂️ umbrella+☔ umbrella with rain drops+⛱️ umbrella on ground+⚡ high voltage+❄️ snowflake+☃️ snowman+⛄ snowman without snow+☄️ comet+🔥 fire+💧 droplet+🌊 water wave+"""),+ ("objects", """+👓 glasses+🕶️ sunglasses+🥽 goggles+🥼 lab coat+🦺 safety vest+👔 necktie+👕 t-shirt+👖 jeans+🧣 scarf+🧤 gloves+🧥 coat+🧦 socks+👗 dress+👘 kimono+🥻 sari+🩱 one-piece swimsuit+🩲 briefs+🩳 shorts+👙 bikini+👚 woman’s clothes+🪭 folding hand fan+👛 purse+👜 handbag+👝 clutch bag+🛍️ shopping bags+🎒 backpack+🩴 thong sandal+👞 man’s shoe+👟 running shoe+🥾 hiking boot+🥿 flat shoe+👠 high-heeled shoe+👡 woman’s sandal+🩰 ballet shoes+👢 woman’s boot+🪮 hair pick+👑 crown+👒 woman’s hat+🎩 top hat+🎓 graduation cap+🧢 billed cap+🪖 military helmet+⛑️ rescue worker’s helmet+📿 prayer beads+💄 lipstick+💍 ring+💎 gem stone+🔇 muted speaker+🔈 speaker low volume+🔉 speaker medium volume+🔊 speaker high volume+📢 loudspeaker+📣 megaphone+📯 postal horn+🔔 bell+🔕 bell with slash+🎼 musical score+🎵 musical note+🎶 musical notes+🎙️ studio microphone+🎚️ level slider+🎛️ control knobs+🎤 microphone+🎧 headphone+📻 radio+🎷 saxophone+🎺 trumpet+🪗 accordion+🎸 guitar+🎹 musical keyboard+🎻 violin+🪕 banjo+🥁 drum+🪘 long drum+🪇 maracas+🪈 flute+📱 mobile phone+📲 mobile phone with arrow+☎️ telephone+📞 telephone receiver+📟 pager+📠 fax machine+🔋 battery+🪫 low battery+🔌 electric plug+💻 laptop+🖥️ desktop computer+🖨️ printer+⌨️ keyboard+🖱️ computer mouse+🖲️ trackball+💽 computer disk+💾 floppy disk+💿 optical disk+📀 dvd+🧮 abacus+🎥 movie camera+🎞️ film frames+📽️ film projector+🎬 clapper board+📺 television+📷 camera+📸 camera with flash+📹 video camera+📼 videocassette+🔍 magnifying glass tilted left+🔎 magnifying glass tilted right+🕯️ candle+💡 light bulb+🔦 flashlight+🏮 red paper lantern+🪔 diya lamp+📔 notebook with decorative cover+📕 closed book+📖 open book+📗 green book+📘 blue book+📙 orange book+📚 books+📓 notebook+📒 ledger+📃 page with curl+📜 scroll+📄 page facing up+📰 newspaper+🗞️ rolled-up newspaper+📑 bookmark tabs+🔖 bookmark+🏷️ label+🪙 coin+💰 money bag+💴 yen banknote+💵 dollar banknote+💶 euro banknote+💷 pound banknote+💸 money with wings+💳 credit card+🧾 receipt+💹 chart increasing with yen+✉️ envelope+📨 incoming envelope+📩 envelope with arrow+📤 outbox tray+📥 inbox tray+📦 package+📫 closed mailbox with raised flag+📪 closed mailbox with lowered flag+📬 open mailbox with raised flag+📭 open mailbox with lowered flag+📮 postbox+🗳️ ballot box with ballot+✏️ pencil+✒️ black nib+🖋️ fountain pen+🖊️ pen+🖌️ paintbrush+🖍️ crayon+📝 memo+💼 briefcase+📁 file folder+📂 open file folder+🗂️ card index dividers+📅 calendar+📆 tear-off calendar+🗒️ spiral notepad+🗓️ spiral calendar+📇 card index+📈 chart increasing+📉 chart decreasing+📊 bar chart+📋 clipboard+📌 pushpin+📍 round pushpin+📎 paperclip+🖇️ linked paperclips+📏 straight ruler+📐 triangular ruler+✂️ scissors+🗃️ card file box+🗄️ file cabinet+🗑️ wastebasket+🔒 locked+🔓 unlocked+🔏 locked with pen+🔐 locked with key+🔑 key+🗝️ old key+🔨 hammer+🪓 axe+⛏️ pick+⚒️ hammer and pick+🛠️ hammer and wrench+🗡️ dagger+⚔️ crossed swords+💣 bomb+🪃 boomerang+🏹 bow and arrow+🛡️ shield+🪚 carpentry saw+🔧 wrench+🪛 screwdriver+🔩 nut and bolt+⚙️ gear+🗜️ clamp+⚖️ balance scale+🦯 white cane+🔗 link+⛓️ chains+🪝 hook+🧰 toolbox+🧲 magnet+🪜 ladder+⚗️ alembic+🧪 test tube+🧫 petri dish+🧬 dna+🔬 microscope+🔭 telescope+📡 satellite antenna+💉 syringe+🩸 drop of blood+💊 pill+🩹 adhesive bandage+🩼 crutch+🩺 stethoscope+🩻 x-ray+🚪 door+🛗 elevator+🪞 mirror+🪟 window+🛏️ bed+🛋️ couch and lamp+🪑 chair+🚽 toilet+🪠 plunger+🚿 shower+🛁 bathtub+🪤 mouse trap+🪒 razor+🧴 lotion bottle+🧷 safety pin+🧹 broom+🧺 basket+🧻 roll of paper+🪣 bucket+🧼 soap+🫧 bubbles+🪥 toothbrush+🧽 sponge+🧯 fire extinguisher+🛒 shopping cart+🚬 cigarette+⚰️ coffin+🪦 headstone+⚱️ funeral urn+🧿 nazar amulet+🪬 hamsa+🗿 moai+🪧 placard+🪪 identification card+"""),+ ("symbols", """+🏧 ATM sign+🚮 litter in bin sign+🚰 potable water+♿ wheelchair symbol+🚹 men’s room+🚺 women’s room+🚻 restroom+🚼 baby symbol+🚾 water closet+🛂 passport control+🛃 customs+🛄 baggage claim+🛅 left luggage+⚠️ warning+🚸 children crossing+⛔ no entry+🚫 prohibited+🚳 no bicycles+🚭 no smoking+🚯 no littering+🚱 non-potable water+🚷 no pedestrians+📵 no mobile phones+🔞 no one under eighteen+☢️ radioactive+☣️ biohazard+⬆️ up arrow+↗️ up-right arrow+➡️ right arrow+↘️ down-right arrow+⬇️ down arrow+↙️ down-left arrow+⬅️ left arrow+↖️ up-left arrow+↕️ up-down arrow+↔️ left-right arrow+↩️ right arrow curving left+↪️ left arrow curving right+⤴️ right arrow curving up+⤵️ right arrow curving down+🔃 clockwise vertical arrows+🔄 counterclockwise arrows button+🔙 BACK arrow+🔚 END arrow+🔛 ON! arrow+🔜 SOON arrow+🔝 TOP arrow+🛐 place of worship+⚛️ atom symbol+🕉️ om+✡️ star of David+☸️ wheel of dharma+☯️ yin yang+✝️ latin cross+☦️ orthodox cross+☪️ star and crescent+☮️ peace symbol+🕎 menorah+🔯 dotted six-pointed star+🪯 khanda+♈ Aries+♉ Taurus+♊ Gemini+♋ Cancer+♌ Leo+♍ Virgo+♎ Libra+♏ Scorpio+♐ Sagittarius+♑ Capricorn+♒ Aquarius+♓ Pisces+⛎ Ophiuchus+🔀 shuffle tracks button+🔁 repeat button+🔂 repeat single button+▶️ play button+⏩ fast-forward button+⏭️ next track button+⏯️ play or pause button+◀️ reverse button+⏪ fast reverse button+⏮️ last track button+🔼 upwards button+⏫ fast up button+🔽 downwards button+⏬ fast down button+⏸️ pause button+⏹️ stop button+⏺️ record button+⏏️ eject button+🎦 cinema+🔅 dim button+🔆 bright button+📶 antenna bars+🛜 wireless+📳 vibration mode+📴 mobile phone off+♀️ female sign+♂️ male sign+⚧️ transgender symbol+✖️ multiply+➕ plus+➖ minus+➗ divide+🟰 heavy equals sign+♾️ infinity+‼️ double exclamation mark+⁉️ exclamation question mark+❓ red question mark+❔ white question mark+❕ white exclamation mark+❗ red exclamation mark+〰️ wavy dash+💱 currency exchange+💲 heavy dollar sign+⚕️ medical symbol+♻️ recycling symbol+⚜️ fleur-de-lis+🔱 trident emblem+📛 name badge+🔰 Japanese symbol for beginner+⭕ hollow red circle+✅ check mark button+☑️ check box with check+✔️ check mark+❌ cross mark+❎ cross mark button+➰ curly loop+➿ double curly loop+〽️ part alternation mark+✳️ eight-spoked asterisk+✴️ eight-pointed star+❇️ sparkle+©️ copyright+®️ registered+™️ trade mark+#️⃣ keycap: #+*️⃣ keycap: *+0️⃣ keycap: 0+1️⃣ keycap: 1+2️⃣ keycap: 2+3️⃣ keycap: 3+4️⃣ keycap: 4+5️⃣ keycap: 5+6️⃣ keycap: 6+7️⃣ keycap: 7+8️⃣ keycap: 8+9️⃣ keycap: 9+🔟 keycap: 10+🔠 input latin uppercase+🔡 input latin lowercase+🔢 input numbers+🔣 input symbols+🔤 input latin letters+🅰️ A button (blood type)+🆎 AB button (blood type)+🅱️ B button (blood type)+🆑 CL button+🆒 COOL button+🆓 FREE button+ℹ️ information+🆔 ID button+Ⓜ️ circled M+🆕 NEW button+🆖 NG button+🅾️ O button (blood type)+🆗 OK button+🅿️ P button+🆘 SOS button+🆙 UP! button+🆚 VS button+🈁 Japanese “here” button+🈂️ Japanese “service charge” button+🈷️ Japanese “monthly amount” button+🈶 Japanese “not free of charge” button+🈯 Japanese “reserved” button+🉐 Japanese “bargain” button+🈹 Japanese “discount” button+🈚 Japanese “free of charge” button+🈲 Japanese “prohibited” button+🉑 Japanese “acceptable” button+🈸 Japanese “application” button+🈴 Japanese “passing grade” button+🈳 Japanese “vacancy” button+㊗️ Japanese “congratulations” button+㊙️ Japanese “secret” button+🈺 Japanese “open for business” button+🈵 Japanese “no vacancy” button+🔴 red circle+🟠 orange circle+🟡 yellow circle+🟢 green circle+🔵 blue circle+🟣 purple circle+🟤 brown circle+⚫ black circle+⚪ white circle+🟥 red square+🟧 orange square+🟨 yellow square+🟩 green square+🟦 blue square+🟪 purple square+🟫 brown square+⬛ black large square+⬜ white large square+◼️ black medium square+◻️ white medium square+◾ black medium-small square+◽ white medium-small square+▪️ black small square+▫️ white small square+🔶 large orange diamond+🔷 large blue diamond+🔸 small orange diamond+🔹 small blue diamond+🔺 red triangle pointed up+🔻 red triangle pointed down+💠 diamond with a dot+🔘 radio button+🔳 white square button+🔲 black square button+"""),+ ("flags", """+🏁 chequered flag+🚩 triangular flag+🎌 crossed flags+🏴 black flag+🏳️ white flag+🏳️🌈 rainbow flag+🏳️⚧️ transgender flag+🏴☠️ pirate flag+🇦🇨 flag: Ascension Island+🇦🇩 flag: Andorra+🇦🇪 flag: United Arab Emirates+🇦🇫 flag: Afghanistan+🇦🇬 flag: Antigua & Barbuda+🇦🇮 flag: Anguilla+🇦🇱 flag: Albania+🇦🇲 flag: Armenia+🇦🇴 flag: Angola+🇦🇶 flag: Antarctica+🇦🇷 flag: Argentina+🇦🇸 flag: American Samoa+🇦🇹 flag: Austria+🇦🇺 flag: Australia+🇦🇼 flag: Aruba+🇦🇽 flag: Åland Islands+🇦🇿 flag: Azerbaijan+🇧🇦 flag: Bosnia & Herzegovina+🇧🇧 flag: Barbados+🇧🇩 flag: Bangladesh+🇧🇪 flag: Belgium+🇧🇫 flag: Burkina Faso+🇧🇬 flag: Bulgaria+🇧🇭 flag: Bahrain+🇧🇮 flag: Burundi+🇧🇯 flag: Benin+🇧🇱 flag: St. Barthélemy+🇧🇲 flag: Bermuda+🇧🇳 flag: Brunei+🇧🇴 flag: Bolivia+🇧🇶 flag: Caribbean Netherlands+🇧🇷 flag: Brazil+🇧🇸 flag: Bahamas+🇧🇹 flag: Bhutan+🇧🇻 flag: Bouvet Island+🇧🇼 flag: Botswana+🇧🇾 flag: Belarus+🇧🇿 flag: Belize+🇨🇦 flag: Canada+🇨🇨 flag: Cocos (Keeling) Islands+🇨🇩 flag: Congo - Kinshasa+🇨🇫 flag: Central African Republic+🇨🇬 flag: Congo - Brazzaville+🇨🇭 flag: Switzerland+🇨🇮 flag: Côte d’Ivoire+🇨🇰 flag: Cook Islands+🇨🇱 flag: Chile+🇨🇲 flag: Cameroon+🇨🇳 flag: China+🇨🇴 flag: Colombia+🇨🇵 flag: Clipperton Island+🇨🇷 flag: Costa Rica+🇨🇺 flag: Cuba+🇨🇻 flag: Cape Verde+🇨🇼 flag: Curaçao+🇨🇽 flag: Christmas Island+🇨🇾 flag: Cyprus+🇨🇿 flag: Czechia+🇩🇪 flag: Germany+🇩🇬 flag: Diego Garcia+🇩🇯 flag: Djibouti+🇩🇰 flag: Denmark+🇩🇲 flag: Dominica+🇩🇴 flag: Dominican Republic+🇩🇿 flag: Algeria+🇪🇦 flag: Ceuta & Melilla+🇪🇨 flag: Ecuador+🇪🇪 flag: Estonia+🇪🇬 flag: Egypt+🇪🇭 flag: Western Sahara+🇪🇷 flag: Eritrea+🇪🇸 flag: Spain+🇪🇹 flag: Ethiopia+🇪🇺 flag: European Union+🇫🇮 flag: Finland+🇫🇯 flag: Fiji+🇫🇰 flag: Falkland Islands+🇫🇲 flag: Micronesia+🇫🇴 flag: Faroe Islands+🇫🇷 flag: France+🇬🇦 flag: Gabon+🇬🇧 flag: United Kingdom+🇬🇩 flag: Grenada+🇬🇪 flag: Georgia+🇬🇫 flag: French Guiana+🇬🇬 flag: Guernsey+🇬🇭 flag: Ghana+🇬🇮 flag: Gibraltar+🇬🇱 flag: Greenland+🇬🇲 flag: Gambia+🇬🇳 flag: Guinea+🇬🇵 flag: Guadeloupe+🇬🇶 flag: Equatorial Guinea+🇬🇷 flag: Greece+🇬🇸 flag: South Georgia & South Sandwich Islands+🇬🇹 flag: Guatemala+🇬🇺 flag: Guam+🇬🇼 flag: Guinea-Bissau+🇬🇾 flag: Guyana+🇭🇰 flag: Hong Kong SAR China+🇭🇲 flag: Heard & McDonald Islands+🇭🇳 flag: Honduras+🇭🇷 flag: Croatia+🇭🇹 flag: Haiti+🇭🇺 flag: Hungary+🇮🇨 flag: Canary Islands+🇮🇩 flag: Indonesia+🇮🇪 flag: Ireland+🇮🇱 flag: Israel+🇮🇲 flag: Isle of Man+🇮🇳 flag: India+🇮🇴 flag: British Indian Ocean Territory+🇮🇶 flag: Iraq+🇮🇷 flag: Iran+🇮🇸 flag: Iceland+🇮🇹 flag: Italy+🇯🇪 flag: Jersey+🇯🇲 flag: Jamaica+🇯🇴 flag: Jordan+🇯🇵 flag: Japan+🇰🇪 flag: Kenya+🇰🇬 flag: Kyrgyzstan+🇰🇭 flag: Cambodia+🇰🇮 flag: Kiribati+🇰🇲 flag: Comoros+🇰🇳 flag: St. Kitts & Nevis+🇰🇵 flag: North Korea+🇰🇷 flag: South Korea+🇰🇼 flag: Kuwait+🇰🇾 flag: Cayman Islands+🇰🇿 flag: Kazakhstan+🇱🇦 flag: Laos+🇱🇧 flag: Lebanon+🇱🇨 flag: St. Lucia+🇱🇮 flag: Liechtenstein+🇱🇰 flag: Sri Lanka+🇱🇷 flag: Liberia+🇱🇸 flag: Lesotho+🇱🇹 flag: Lithuania+🇱🇺 flag: Luxembourg+🇱🇻 flag: Latvia+🇱🇾 flag: Libya+🇲🇦 flag: Morocco+🇲🇨 flag: Monaco+🇲🇩 flag: Moldova+🇲🇪 flag: Montenegro+🇲🇫 flag: St. Martin+🇲🇬 flag: Madagascar+🇲🇭 flag: Marshall Islands+🇲🇰 flag: North Macedonia+🇲🇱 flag: Mali+🇲🇲 flag: Myanmar (Burma)+🇲🇳 flag: Mongolia+🇲🇴 flag: Macao SAR China+🇲🇵 flag: Northern Mariana Islands+🇲🇶 flag: Martinique+🇲🇷 flag: Mauritania+🇲🇸 flag: Montserrat+🇲🇹 flag: Malta+🇲🇺 flag: Mauritius+🇲🇻 flag: Maldives+🇲🇼 flag: Malawi+🇲🇽 flag: Mexico+🇲🇾 flag: Malaysia+🇲🇿 flag: Mozambique+🇳🇦 flag: Namibia+🇳🇨 flag: New Caledonia+🇳🇪 flag: Niger+🇳🇫 flag: Norfolk Island+🇳🇬 flag: Nigeria+🇳🇮 flag: Nicaragua+🇳🇱 flag: Netherlands+🇳🇴 flag: Norway+🇳🇵 flag: Nepal+🇳🇷 flag: Nauru+🇳🇺 flag: Niue+🇳🇿 flag: New Zealand+🇴🇲 flag: Oman+🇵🇦 flag: Panama+🇵🇪 flag: Peru+🇵🇫 flag: French Polynesia+🇵🇬 flag: Papua New Guinea+🇵🇭 flag: Philippines+🇵🇰 flag: Pakistan+🇵🇱 flag: Poland+🇵🇲 flag: St. Pierre & Miquelon+🇵🇳 flag: Pitcairn Islands+🇵🇷 flag: Puerto Rico+🇵🇸 flag: Palestinian Territories+🇵🇹 flag: Portugal+🇵🇼 flag: Palau+🇵🇾 flag: Paraguay+🇶🇦 flag: Qatar+🇷🇪 flag: Réunion+🇷🇴 flag: Romania+🇷🇸 flag: Serbia+🇷🇺 flag: Russia+🇷🇼 flag: Rwanda+🇸🇦 flag: Saudi Arabia+🇸🇧 flag: Solomon Islands+🇸🇨 flag: Seychelles+🇸🇩 flag: Sudan+🇸🇪 flag: Sweden+🇸🇬 flag: Singapore+🇸🇭 flag: St. Helena+🇸🇮 flag: Slovenia+🇸🇯 flag: Svalbard & Jan Mayen+🇸🇰 flag: Slovakia+🇸🇱 flag: Sierra Leone+🇸🇲 flag: San Marino+🇸🇳 flag: Senegal+🇸🇴 flag: Somalia+🇸🇷 flag: Suriname+🇸🇸 flag: South Sudan+🇸🇹 flag: São Tomé & Príncipe+🇸🇻 flag: El Salvador+🇸🇽 flag: Sint Maarten+🇸🇾 flag: Syria+🇸🇿 flag: Eswatini+🇹🇦 flag: Tristan da Cunha+🇹🇨 flag: Turks & Caicos Islands+🇹🇩 flag: Chad+🇹🇫 flag: French Southern Territories+🇹🇬 flag: Togo+🇹🇭 flag: Thailand+🇹🇯 flag: Tajikistan+🇹🇰 flag: Tokelau+🇹🇱 flag: Timor-Leste+🇹🇲 flag: Turkmenistan+🇹🇳 flag: Tunisia+🇹🇴 flag: Tonga+🇹🇷 flag: Türkiye+🇹🇹 flag: Trinidad & Tobago+🇹🇻 flag: Tuvalu+🇹🇼 flag: Taiwan+🇹🇿 flag: Tanzania+🇺🇦 flag: Ukraine+🇺🇬 flag: Uganda+🇺🇲 flag: U.S. Outlying Islands+🇺🇳 flag: United Nations+🇺🇸 flag: United States+🇺🇾 flag: Uruguay+🇺🇿 flag: Uzbekistan+🇻🇦 flag: Vatican City+🇻🇨 flag: St. Vincent & Grenadines+🇻🇪 flag: Venezuela+🇻🇬 flag: British Virgin Islands+🇻🇮 flag: U.S. Virgin Islands+🇻🇳 flag: Vietnam+🇻🇺 flag: Vanuatu+🇼🇫 flag: Wallis & Futuna+🇼🇸 flag: Samoa+🇽🇰 flag: Kosovo+🇾🇪 flag: Yemen+🇾🇹 flag: Mayotte+🇿🇦 flag: South Africa+🇿🇲 flag: Zambia+🇿🇼 flag: Zimbabwe+🏴 flag: England+🏴 flag: Scotland+🏴 flag: Wales+"""),+ ]+}diff --git a/Sources/Cra/UI/Sidebar/EmojiCatalog.swift b/Sources/Cra/UI/Sidebar/EmojiCatalog.swiftnew file mode 100644index 0000000..a1617fd--- /dev/null+++ b/Sources/Cra/UI/Sidebar/EmojiCatalog.swift@@ -0,0 +1,39 @@+import AppKit++/// The emoji in the space icon picker, in Unicode's order and grouped like the category bar of+/// Arc's picker (EmojiCatalog+Data.swift is generated by scripts/make-emoji-catalog.py).+enum EmojiCatalog {+ struct Entry: Hashable {+ let emoji: String+ let name: String+ }++ struct Category: Identifiable {+ let id: String+ /// The glyph in the picker's bottom bar.+ let symbol: String+ let entries: [Entry]+ }++ private static let symbols = [+ "smileys": "face.smiling", "nature": "sun.max", "food": "mug", "activities": "rosette",+ "travel": "box.truck", "objects": "gift", "symbols": "heart", "flags": "flag",+ ]++ /// Emoji 15.0 and older (the catalog's cut-off) all draw on macOS 14, Cra's oldest.+ static let categories: [Category] = data.map { key, text in+ let entries = text.split(separator: "\n").compactMap { line -> Entry? in+ guard let space = line.firstIndex(of: " ") else { return nil }+ return Entry(emoji: String(line[..<space]), name: String(line[line.index(after: space)...]))+ }+ return Category(id: key, symbol: symbols[key] ?? "circle", entries: entries)+ }++ static let all: [Entry] = categories.flatMap(\.entries)++ static func search(_ query: String) -> [Entry] {+ let words = query.lowercased().split(separator: " ")+ guard !words.isEmpty else { return [] }+ return all.filter { e in words.allSatisfy { e.name.contains($0) } }+ }+}diff --git a/Sources/Cra/UI/Sidebar/LibraryView.swift b/Sources/Cra/UI/Sidebar/LibraryView.swiftindex e7e9363..aeb26ed 100644--- a/Sources/Cra/UI/Sidebar/LibraryView.swift+++ b/Sources/Cra/UI/Sidebar/LibraryView.swift@@ -1,12 +1,24 @@import AppKit-/// The Library's pages Cra has (Arc's rail also lists Media, Easels, Spaces and Boosts).+/// The Library's pages Cra has, in the order of Arc's rail (which also lists Media, Easels and Boosts).enum LibraryPage: String, CaseIterable {- case downloads, archive+ case downloads, spaces, archive- var title: String { self == .downloads ? "Downloads" : "Archived Tabs" }- var symbol: String { self == .downloads ? "arrow.down.circle" : "archivebox" }- var selectedSymbol: String { self == .downloads ? "arrow.down.circle.fill" : "archivebox.fill" }+ var title: String {+ switch self {+ case .downloads: "Downloads"+ case .spaces: "Spaces"+ case .archive: "Archived Tabs"+ }+ }+ var symbol: String {+ switch self {+ case .downloads: "arrow.down.circle"+ case .spaces: "square.on.square"+ case .archive: "archivebox"+ }+ }+ var selectedSymbol: String { symbol + ".fill" }var searchPrompt: String { self == .downloads ? "Search Downloads…" : "Search Archive…" }}@@ -40,13 +52,17 @@ final class LibraryView: NSView {private let favicons: FaviconCacheprivate let rail = LibraryRailView()private let list: LibraryListView+ private let ui: SidebarUIState+ /// The Spaces page (Manage Spaces…) shows every space instead of a list.+ private var spaces: SpacesManagerView?var page: LibraryPage { didSet { if page != oldValue { pageChanged() } } }var palette: SpacePalette { didSet { apply() } }- init(page: LibraryPage, palette: SpacePalette, store: SidebarStore, actions: SidebarActions, favicons: FaviconCache) {+ init(page: LibraryPage, palette: SpacePalette, store: SidebarStore, ui: SidebarUIState, actions: SidebarActions, favicons: FaviconCache) {self.page = pageself.palette = paletteself.store = store+ self.ui = uiself.actions = actionsself.favicons = faviconslist = LibraryListView(page: page, store: store, actions: actions, favicons: favicons)@@ -66,7 +82,18 @@ final class LibraryView: NSView {private func pageChanged() {rail.show(page: page)- list.page = page+ if page == .spaces {+ if spaces == nil {+ let v = SpacesManagerView(store: store, ui: ui, actions: actions, favicons: favicons)+ addSubview(v)+ spaces = v+ }+ } else {+ list.page = page+ }+ list.isHidden = page == .spaces+ spaces?.isHidden = page != .spaces+ needsLayout = true}private func apply() {@@ -85,6 +112,7 @@ final class LibraryView: NSView {super.layout()rail.frame = NSRect(x: 0, y: 0, width: LibraryMetrics.rail, height: bounds.height)list.frame = NSRect(x: LibraryMetrics.rail, y: 0, width: max(0, bounds.width - LibraryMetrics.rail), height: bounds.height)+ spaces?.frame = list.frame}}@@ -346,6 +374,8 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDat}empty.show(symbol: "arrow.down.circle", title: all.isEmpty ? "Nothing here yet!" : "No matches",detail: all.isEmpty ? "Files you download show up here." : nil)+ case .spaces:+ breakcase .archive:let shown = needle.isEmpty ? store.archive : store.archive.filter {$0.item.displayTitle.lowercased().contains(needle) || ($0.item.tab?.url.lowercased().contains(needle) ?? false)@@ -432,6 +462,8 @@ private final class LibraryListView: NSView, NSTextFieldDelegate, NSTableViewDatcase .archive:let store = storeMenuItems.add(menu, "Clear Archive", enabled: !store.archive.isEmpty) { store.clearArchive() }+ case .spaces:+ return}menu.popUp(positioning: nil, at: NSPoint(x: menuButton.frame.minX, y: menuButton.frame.maxY + 4), in: self)}diff --git a/Sources/Cra/UI/Sidebar/List/SidebarView.swift b/Sources/Cra/UI/Sidebar/List/SidebarView.swiftindex e9fdf83..c4ed191 100644--- a/Sources/Cra/UI/Sidebar/List/SidebarView.swift+++ b/Sources/Cra/UI/Sidebar/List/SidebarView.swift@@ -104,7 +104,7 @@ final class SidebarView: NSView {shownLibrary = pageif let page {let host = libraryHost ?? {- let h = LibraryView(page: page, palette: palette, store: store, actions: actions, favicons: favicons)+ let h = LibraryView(page: page, palette: palette, store: store, ui: ui, actions: actions, favicons: favicons)addSubview(h)libraryHost = hreturn h@@ -574,7 +574,7 @@ final class SpaceDockView: NSView {addSubview(c)return c}()- c.show(emoji: s.emoji, title: s.title)+ c.show(emoji: s.emoji, symbol: s.symbol, title: s.title)}order = idsrefreshCells()@@ -763,6 +763,9 @@ final class SpaceCellView: NSView, ArcTooltipTarget {private let ui: SidebarUIStateprivate let emoji = NSTextField.sidebarLabel(size: 13)private let emojiHolder = NSView()+ /// An Icon-tab glyph (Space.symbol) in the emoji's place.+ private let symbol = NSImageView()+ private var symbolName: String?private var title = ""private var selected = falseprivate var colors = SidebarColors()@@ -791,8 +794,14 @@ final class SpaceCellView: NSView, ArcTooltipTarget {override func hitTest(_ point: NSPoint) -> NSView? { nil }- func show(emoji text: String, title: String) {+ func show(emoji text: String, symbol name: String?, title: String) {emoji.stringValue = text+ if symbolName != name {+ symbolName = name+ symbol.image = name.flatMap { NSImage(systemSymbolName: $0, accessibilityDescription: nil) }+ symbol.isHidden = name == nil+ if symbol.superview == nil { symbol.imageScaling = .scaleNone; emojiHolder.addSubview(symbol) }+ }self.title = titlesetAccessibilityLabel(title)needsLayout = true@@ -803,6 +812,7 @@ final class SpaceCellView: NSView, ArcTooltipTarget {self.colors = colorslit = selected || hovered || pressedemojiHolder.alphaValue = lit ? 1 : 0.45+ symbol.contentTintColor = colors.textPrimaryemojiHolder.layer?.filters = lit ? nil : [CIFilter(name: "CIColorControls", parameters: ["inputSaturation": 0.2])!]refreshFill(hovered || pressed)}@@ -822,6 +832,8 @@ final class SpaceCellView: NSView, ArcTooltipTarget {if emoji.font?.pointSize != size { emoji.font = .systemFont(ofSize: size) }let h = emoji.intrinsicContentSize.heightemoji.frame = NSRect(x: 0, y: (bounds.height - h) / 2, width: bounds.width, height: h)+ symbol.frame = bounds+ symbol.symbolConfiguration = .init(pointSize: size - 2, weight: .medium)}override func accessibilityPerformPress() -> Bool {diff --git a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swiftindex 0bf86d9..76b325e 100644--- a/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift+++ b/Sources/Cra/UI/Sidebar/List/SpaceColumnView.swift@@ -22,7 +22,7 @@ final class SpaceColumnView: NSView {self.actions = actionsself.favicons = faviconsfavorites = FavoritesGridView(spaceID: spaceID, store: store, ui: ui, actions: actions, favicons: favicons)- header = SpaceHeaderView(spaceID: spaceID, store: store, actions: actions)+ header = SpaceHeaderView(spaceID: spaceID, store: store, ui: ui, actions: actions)list = SpaceListView(spaceID: spaceID, store: store, ui: ui, actions: actions, favicons: favicons)super.init(frame: .zero)favorites.onHeightChange = { [weak self] animated in self?.relayout(animated: animated) }@@ -53,9 +53,9 @@ final class SpaceColumnView: NSView {/// Arc 1.171 (one space, live, 31 Oct) places everything under the favorites from the tiles'/// bottom, or with no favorites from the URL field's (the column starts 8 pt under it, where- /// the first tile's top goes): the header's 36 pt hover fill 8 pt below (Arc 1.171, 1 Nov), the- /// divider line 54.5 pt below. With the header hidden the line is 18.5 pt under the tiles,- /// 15.5 pt under the URL field.+ /// the first tile's top goes): the header's hover fill 8–44 pt below, 8 pt in from both+ /// sides like the tiles (measured 1 Nov), the divider line 54.5 pt below. With the header+ /// hidden the line is 18.5 pt under the tiles, 15.5 pt under the URL field.private func place(animated: Bool) {let w = bounds.widthlet fh = favorites.height(forWidth: w - 16)@@ -72,39 +72,51 @@ final class SpaceColumnView: NSView {// MARK: - Space header-/// The space's emoji and name. Arc 1.171 (live, 1 Nov): a click anywhere but the ••• collapses or-/// expands the pinned tabs; on hover the row fills, a chevron takes the emoji's place and a •••-/// button opens the space menu; collapsed, the chevron stays and points right.-final class SpaceHeaderView: NSView {+/// The space's emoji and name. Arc 1.171 (live, 1 Nov): a click collapses or expands the pinned+/// tabs; on hover the fill comes in, the chevron takes the icon's place and the ••• button+/// (sidebarSpaceEditButton) shows at the trailing edge, all in one frame. The ••• and a+/// right-click open the same space menu at the pointer. Collapsed, the chevron stays and points right.+final class SpaceHeaderView: NSView, NSTextFieldDelegate {private let spaceID: UUIDprivate let store: SidebarStore+ private let ui: SidebarUIStateprivate let actions: SidebarActionsprivate let emoji = NSTextField.sidebarLabel(size: 14)private let title = NSTextField.sidebarLabel(size: 13, weight: .semibold)+ /// An Icon-tab glyph in the emoji's place.+ private let symbol = NSImageView()private let chevron = NSImageView()- private var more: SidebarGlyphButton!+ private lazy var more = SidebarGlyphButton(symbol: "ellipsis", size: 24, height: 24, iconSize: 13, weight: .semibold, help: "", colors: colors) { [weak self] in+ self?.showMenu(NSApp.currentEvent)+ }+ /// Rename Space…: the name turns into a field and the ••• into Arc's "Done".+ private let done = NSTextField.sidebarLabel(size: 10, weight: .semibold)+ private var renameField: NSTextField?private var hovering = false { didSet { if hovering != oldValue { refresh() } } }+ /// Arc keeps the hover look while the space menu is open.+ private var menuOpen = false { didSet { if menuOpen != oldValue { refresh() } } }private var collapsed = falseprivate var colors = SidebarColors()private var syncQueued = false/// The column lays out again when Arc's single-space mode hides or shows the header.var onHiddenChange: (() -> Void)?- init(spaceID: UUID, store: SidebarStore, actions: SidebarActions) {+ init(spaceID: UUID, store: SidebarStore, ui: SidebarUIState, actions: SidebarActions) {self.spaceID = spaceIDself.store = store+ self.ui = uiself.actions = actionssuper.init(frame: .zero)wantsLayer = truelayer?.cornerRadius = 12- // Pixel-fitted to Arc's 2x capture (chevron.down 12.5 bold, ellipsis 13 semibold).+ // Pixel-fitted to Arc's 2x capture (chevron.down 12.5 bold, ellipsis 13 semibold; #57).chevron.image = SidebarSymbols.image("chevron.down", size: 12.5, weight: .bold)chevron.imageScaling = .scaleNonechevron.wantsLayer = true- more = SidebarGlyphButton(symbol: "ellipsis", size: 24, height: 24, iconSize: 13, weight: .semibold, help: "", colors: colors) { [weak self] in- self?.showMenu()- }- for v in [emoji, title, chevron, more!] as [NSView] { addSubview(v) }+ done.stringValue = "Done"+ done.isHidden = true+ symbol.imageScaling = .scaleNone+ for v in [emoji, symbol, title, chevron, more, done] { addSubview(v) }sync()}@@ -120,6 +132,7 @@ final class SpaceHeaderView: NSView {withObservationTracking {guard let space = store.space(spaceID) else { return }emoji.stringValue = space.emoji+ symbol.image = space.symbol.flatMap { SidebarSymbols.image($0, size: 13, weight: .medium) }title.stringValue = space.titlecolors = SidebarColors(space.theme.palette)collapsed = store.isPinnedCollapsed(spaceID)@@ -140,18 +153,23 @@ final class SpaceHeaderView: NSView {}private func refresh() {+ let lit = hovering || menuOpen || renameField != nil// Arc's dark header title is dimmer than its other secondary text (white 0.45, 1 Nov).title.textColor = colors.isDark ? NSColor.white.withAlphaComponent(0.45) : colors.textSecondary+ done.textColor = colors.textTertiarychevron.contentTintColor = colors.textSecondary- let showsChevron = collapsed || hovering- chevron.isHidden = !showsChevron- emoji.isHidden = showsChevron- more.colors = colorsmore.tint = colors.textSecondary- more.isHidden = !hovering+ let showsChevron = lit || collapsed+ chevron.alphaValue = showsChevron ? 1 : 0+ emoji.alphaValue = showsChevron ? 0 : 1+ symbol.alphaValue = showsChevron ? 0 : 1+ symbol.contentTintColor = colors.textSecondary+ more.colors = colors+ more.isHidden = !lit || renameField != nil+ done.isHidden = renameField == nil// Arc's dark header fill is white 0.10, a little lighter than its rows' (1 Nov).let fill = colors.isDark ? NSColor.white.withAlphaComponent(0.1) : colors.hoverFill- layer?.backgroundColor = (hovering ? fill : .clear).cgColor+ layer?.backgroundColor = (lit ? fill : .clear).cgColorneedsLayout = true}@@ -169,38 +187,38 @@ final class SpaceHeaderView: NSView {layer.add(turn, forKey: "turn")}- private func showMenu() {- guard let event = NSApp.currentEvent, let menu = spaceMenu() else { return }- more.highlighted = true- NSMenu.popUpContextMenu(menu, with: event, for: more)- more.highlighted = false- }-+ /// Arc 1.171, 2x captures (1 Nov): a 14.5 pt emoji centred in the icon's 26 pt box 5 pt in (its+ /// line box sits 0.75 pt low), the chevron (13 pt semibold) in the icon's place, the name (13 pt+ /// semibold) 36 pt in, the ••• (24 pt fill in a 26 pt frame) centred 18.5 pt from the trailing edge.+ /// The name stops 2 pt before that frame, or 8.5 pt from the edge while the button is hidden.override func layout() {super.layout()- let h = bounds.height- // Arc centres the emoji and the chevron on the tab rows' favicon column (25.75 pt in from- // the sidebar edge, 17.75 pt into this view) and starts the title on their title column.- // The emoji is drawn ~0.5 pt right of that and ~1.25 pt above the label's centre.- let slot: CGFloat = 17.75+ let h = bounds.height, w = bounds.widthlet es = emoji.intrinsicContentSizelet ew = emoji.attributedStringValue.size().width- emoji.frame = NSRect(x: slot + 0.5 - ew / 2 - SidebarText.inset, y: (h - es.height) / 2 - 1.25, width: ew + 2 * SidebarText.inset, height: es.height)+ emoji.frame = NSRect(x: 18.25 - ew / 2 - SidebarText.inset, y: (h - es.height) / 2 - 1.25, width: ew + 2 * SidebarText.inset, height: es.height)+ symbol.frame = iconRect// Turned right, Arc's chevron sits a little higher than chevron.down turned about its centre.- let (cx, cy): (CGFloat, CGFloat) = collapsed ? (slot + 0.75, h / 2 - 0.25) : (slot + 0.5, h / 2 + 0.5)+ let (cx, cy): (CGFloat, CGFloat) = collapsed ? (18.5, h / 2 - 0.25) : (18.25, h / 2 + 0.5)chevron.frame = NSRect(x: cx - 10, y: cy - 10, width: 20, height: 20)chevron.layer?.anchorPoint = CGPoint(x: 0.5, y: 0.5)chevron.layer?.position = CGPoint(x: chevron.frame.midX, y: chevron.frame.midY)chevron.layer?.setAffineTransform(CGAffineTransform(rotationAngle: angle(collapsed: collapsed)))- // The ••• button's 24 pt square sits 6 pt in from the row's right end; its dots draw- // half a point left of and below the square's centre.- more.frame = NSRect(x: bounds.width - 30.5, y: (h - 24) / 2 + 0.5, width: 24, height: 24)+ more.frame = NSRect(x: w - 18.5 - 12, y: (h - 24) / 2 + 0.5, width: 24, height: 24)+ let dw = ceil(done.attributedStringValue.size().width) + 2 * SidebarText.inset+ let dh = done.intrinsicContentSize.height+ done.frame = NSRect(x: w - 5.5 - dw + SidebarText.inset, y: (h - dh) / 2, width: dw, height: dh)let x: CGFloat = 36- let tw = min(ceil(title.attributedStringValue.size().width), max(0, more.frame.minX - 8 - x))+ let end = renameField != nil ? done.frame.minX - 6 : (more.isHidden ? w - 8.5 : w - 18.5 - 13 - 2)let th = title.intrinsicContentSize.height+ let tw = min(ceil(title.attributedStringValue.size().width), max(0, end - x))title.frame = NSRect(x: x - SidebarText.inset, y: (h - th) / 2, width: tw + 2 * SidebarText.inset, height: th)+ renameField?.frame = NSRect(x: x - SidebarText.inset, y: (h - th) / 2, width: max(0, end - x) + 2 * SidebarText.inset, height: th)}+ /// The icon's 26 pt box: Change Space Icon… points its popover at it.+ var iconRect: NSRect { NSRect(x: 5, y: (bounds.height - 26) / 2, width: 26, height: 26) }+override func updateTrackingAreas() {super.updateTrackingAreas()for t in trackingAreas where t.owner === self { removeTrackingArea(t) }@@ -211,30 +229,142 @@ final class SpaceHeaderView: NSView {override func mouseExited(with event: NSEvent) { hovering = false }override func mouseDown(with event: NSEvent) {}override func mouseUp(with event: NSEvent) {- if bounds.contains(convert(event.locationInWindow, from: nil)) { store.togglePinnedCollapsed(spaceID) }+ let p = convert(event.locationInWindow, from: nil)+ guard bounds.contains(p) else { return }+ if renameField != nil {+ if done.frame.insetBy(dx: -6, dy: -6).contains(p) { commitRename() }+ return+ }+ store.togglePinnedCollapsed(spaceID)+ }++ override func menu(for event: NSEvent) -> NSMenu? {+ renameField == nil ? makeSpaceMenu() : nil+ }++ /// The ••• opens the menu where it was clicked, as a right-click does (Arc pops it up at the+ /// pointer, not under the button). The button acts on mouse-up, and a context menu needs a+ /// mouse-down to place itself, so it gets one at the same point.+ private func showMenu(_ event: NSEvent?) {+ guard let event, let m = makeSpaceMenu(),+ let down = NSEvent.mouseEvent(with: .rightMouseDown, location: event.locationInWindow, modifierFlags: [],+ timestamp: event.timestamp, windowNumber: event.windowNumber, context: nil,+ eventNumber: 0, clickCount: 1, pressure: 1) else { return }+ menuOpen = true+ NSMenu.popUpContextMenu(m, with: down, for: self)+ menuOpen = false+ if let w = window { hovering = bounds.contains(convert(w.mouseLocationOutsideOfEventStream, from: nil)) }+ }++ override func willOpenMenu(_ menu: NSMenu, with event: NSEvent) { menuOpen = true }+ override func didCloseMenu(_ menu: NSMenu, with event: NSEvent?) {+ menuOpen = false+ if let w = window { hovering = bounds.contains(convert(w.mouseLocationOutsideOfEventStream, from: nil)) }+ }++ private func makeSpaceMenu() -> NSMenu? {+ SpaceMenu.make(spaceID: spaceID, store: store, ui: ui, actions: actions, anchor: self) { [weak self] in self?.beginRename() }+ }++ // MARK: Rename (Arc: isEditingSpaceHeader, "Sidebar space header done button")++ func beginRename() {+ guard renameField == nil, let space = store.space(spaceID) else { return }+ let f = NSTextField(string: space.title)+ f.isBordered = false+ f.drawsBackground = false+ f.focusRingType = .none+ f.font = title.font+ f.textColor = colors.textPrimary+ f.delegate = self+ f.cell?.isScrollable = true+ renameField = f+ addSubview(f)+ title.isHidden = true+ refresh()+ DispatchQueue.main.async { [weak self, weak f] in+ guard let f, let w = self?.window else { return }+ w.makeFirstResponder(f)+ f.currentEditor()?.selectAll(nil)+ }+ }++ private func endRename() {+ guard let f = renameField else { return }+ renameField = nil+ f.delegate = nil+ if let w = window, let editor = f.currentEditor(), w.firstResponder === editor { w.makeFirstResponder(nil) }+ f.removeFromSuperview()+ title.isHidden = false+ if let w = window { hovering = bounds.contains(convert(w.mouseLocationOutsideOfEventStream, from: nil)) }+ refresh()}- override func menu(for event: NSEvent) -> NSMenu? { spaceMenu() }+ private func commitRename() {+ guard let f = renameField, var space = store.space(spaceID) else { return }+ let name = f.stringValue.trimmingCharacters(in: .whitespacesAndNewlines)+ endRename()+ guard !name.isEmpty, name != space.title else { return }+ space.title = name+ store.updateSpace(space)+ }- private func spaceMenu() -> NSMenu? {- guard let space = store.space(spaceID) else { return nil }- let store = self.store, actions = self.actions, id = spaceID+ func control(_ control: NSControl, textView: NSTextView, doCommandBy sel: Selector) -> Bool {+ if sel == #selector(NSResponder.cancelOperation(_:)) { endRename(); return true }+ if sel == #selector(NSResponder.insertNewline(_:)) { commitRename(); return true }+ return false+ }++ func controlTextDidEndEditing(_ obj: Notification) { commitRename() }+}++/// Arc 1.171's space menu (SpaceMenu.swift), item for item, for the space header's ••• and+/// right-click and the Library's Spaces page. "Share Space…" is left out: it publishes the space+/// through Arc's servers.+@MainActor+enum SpaceMenu {+ static func make(spaceID id: UUID, store: SidebarStore, ui: SidebarUIState, actions: SidebarActions, anchor: NSView,+ rename: @escaping () -> Void) -> NSMenu? {+ guard let space = store.space(id) else { return nil }let m = NSMenu()m.autoenablesItems = false- MenuItems.add(m, collapsed ? "Expand Pinned Tabs" : "Collapse Pinned Tabs") { store.togglePinnedCollapsed(id) }+ MenuItems.add(m, "Change Space Icon…") { [weak anchor] in if let anchor { actions.changeSpaceIcon(space, anchor) } }+ MenuItems.add(m, "Rename Space…", rename)+ MenuItems.add(m, "Edit Theme Color…") { actions.editSpaceTheme(space) }+ let profiles = MenuItems.submenu(m, "Set Profile")+ MenuItems.add(profiles, "Default", on: space.profileID == nil) { store.setProfile(nil, forSpace: id) }+ for p in store.profiles {+ MenuItems.add(profiles, p.name, on: space.profileID == p.id) { store.setProfile(p.id, forSpace: id) }+ }+ profiles.addItem(.separator())+ MenuItems.add(profiles, "New Profile…") { actions.newProfile(id) }+ m.addItem(.separator())+ MenuItems.add(m, "New Folder") {+ ui.renamingID = store.createFolder(named: "New Folder", in: space.pinnedContainerID, index: 0).id+ }+ let live = MenuItems.submenu(m, "Live Folders")+ let github = store.liveFolder(.github, inSpace: id)+ MenuItems.add(live, "GitHub", on: github != nil) {+ if let github {+ SidebarMenus.confirmDeleteLiveFolder(github, store: store)+ } else if let f = store.createLiveFolder(.github, inSpace: id) {+ store.setExpanded(f.id, true)+ LiveFolderManager.shared.refresh(f.id)+ }+ }+ m.addItem(.separator())+ let export = MenuItems.submenu(m, "Export “\(space.title)” into Folder")+ for s in store.orderedSpaces {+ MenuItems.add(export, s.title, enabled: s.id != id) { store.exportSpace(id, intoFolderIn: s.id) }+ }+ m.addItem(.separator())+ MenuItems.add(m, "Manage Spaces…") { actions.manageSpaces() }// Arc offers this only while there is one space; Show Space Header brings it back.if store.orderedSpaces.count == 1 {MenuItems.add(m, "Hide Space Header") { store.settings.showSpaceHeaderOnSingleSpace = false }}m.addItem(.separator())- MenuItems.add(m, "Edit Space…") { actions.editSpace(space) }- MenuItems.add(m, "New Folder") { actions.performAction("newFolder") }- MenuItems.add(m, "New GitHub Live Folder", enabled: store.liveFolder(.github, inSpace: id) == nil) { actions.performAction("newGitHubLiveFolder") }- m.addItem(.separator())- MenuItems.add(m, "Clear Today") { store.clearToday(id) }- m.addItem(.separator())- MenuItems.add(m, "New Space…") { actions.editSpace(nil) }- MenuItems.add(m, "Delete Space…") { actions.performAction("deleteSpace") }+ MenuItems.add(m, "Delete Space") { actions.deleteSpace(space) }return m}}diff --git a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift b/Sources/Cra/UI/Sidebar/List/SpaceListView.swiftindex 69128ce..ec35bfa 100644--- a/Sources/Cra/UI/Sidebar/List/SpaceListView.swift+++ b/Sources/Cra/UI/Sidebar/List/SpaceListView.swift@@ -92,6 +92,9 @@ final class SpaceListView: NSView, NSDraggingSource {for l in all.allObjects where l.ui === ui { l.refreshHover() }}+ /// Arc's Spaces page lists a space's tabs without the New Tab row.+ var showsNewTab = true { didSet { if showsNewTab != oldValue { scheduleSync() } } }+init(spaceID: UUID, store: SidebarStore, ui: SidebarUIState, actions: SidebarActions, favicons: FaviconCache) {self.spaceID = spaceIDself.store = store@@ -288,11 +291,11 @@ final class SpaceListView: NSView, NSDraggingSource {let todayKids = store.item(space.todayContainerID)?.children ?? []out.append(Row(key: .divider, content: .divider(hasToday: !todayKids.isEmpty)))let atTop = store.settings.newTabButtonAtTop- if atTop { out.append(Row(key: .newTab, content: .newTab)) }+ if atTop && showsNewTab { out.append(Row(key: .newTab, content: .newTab)) }for item in store.children(of: space.todayContainerID) {add(item, depth: 0, pinned: false, parent: space.todayContainerID, index: todayKids.firstIndex(of: item.id) ?? 0)}- if !atTop { out.append(Row(key: .newTab, content: .newTab)) }+ if !atTop && showsNewTab { out.append(Row(key: .newTab, content: .newTab)) }return Built(rows: out, pinnedCount: pinnedCount, palette: palette,highlightPinned: section == .pinned && !pinnedItems.isEmpty, highlightToday: section == .today,line: drop?.line)diff --git a/Sources/Cra/UI/Sidebar/SpaceIconPicker.swift b/Sources/Cra/UI/Sidebar/SpaceIconPicker.swiftnew file mode 100644index 0000000..d40fec8--- /dev/null+++ b/Sources/Cra/UI/Sidebar/SpaceIconPicker.swift@@ -0,0 +1,165 @@+import AppKit+import SwiftUI++/// Arc 1.171's space icon picker (SpaceIconPickerState): a popover under the header's icon with+/// Emoji / Icon tabs and a trash button, a search field, an 8-wide grid that opens on the current+/// emoji's row, and a category bar. Measured from 2x captures (1 Nov): content 272 × 272 pt,+/// cells on a 31 pt pitch, the current emoji on a 27.5 pt rounded tile.+struct SpaceIconPicker: View {+ let current: String+ let currentSymbol: String?+ let onPick: (String) -> Void+ let onPickSymbol: (String) -> Void+ let onRemove: () -> Void++ @State private var tab = 0+ @State private var query = ""+ @State private var hovered: String?+ @FocusState private var searchFocused: Bool++ private let columns = Array(repeating: GridItem(.fixed(31), spacing: 0), count: 8)++ var body: some View {+ VStack(spacing: 0) {+ HStack(spacing: 14) {+ Picker("", selection: $tab) {+ Text("Emoji").tag(0)+ Text("Icon").tag(1)+ }+ .pickerStyle(.segmented)+ .labelsHidden()+ .frame(width: 105)+ Button(action: onRemove) {+ Image(systemName: "trash").font(.system(size: 14, weight: .regular))+ }+ .buttonStyle(.plain)+ .foregroundStyle(.primary)+ .help("Remove Icon")+ }+ .padding(.top, 13.5)+ if tab == 0 {+ HStack(spacing: 5) {+ Image(systemName: "magnifyingglass").font(.system(size: 13, weight: .medium)).foregroundStyle(.secondary)+ TextField("Search", text: $query).textFieldStyle(.plain).font(.system(size: 13)).focused($searchFocused)+ }+ .padding(.horizontal, 8)+ .frame(height: 27)+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(Color.primary.opacity(0.07)))+ .overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)+ .strokeBorder(Color.accentColor.opacity(searchFocused ? 0.75 : 0), lineWidth: 3))+ .padding(.horizontal, 8)+ .padding(.top, 9.5)+ emojiGrid+ } else {+ SpaceSymbolGrid(current: currentSymbol, onPick: onPickSymbol)+ }+ }+ .frame(width: 272, height: 272)+ .onAppear {+ tab = currentSymbol == nil ? 0 : 1+ searchFocused = true+ }+ }++ private var emojiGrid: some View {+ VStack(spacing: 0) {+ ScrollViewReader { proxy in+ ScrollView {+ LazyVGrid(columns: columns, spacing: 0) {+ if query.isEmpty {+ // One run across the categories, as in Arc (its 🐦 opens in the second column).+ ForEach(EmojiCatalog.all, id: \.self) { e in cell(e).id(e.emoji) }+ } else {+ ForEach(EmojiCatalog.search(query), id: \.self) { e in cell(e) }+ }+ }+ .padding(.horizontal, 11)+ }+ .padding(.top, 8.5)+ .onAppear { proxy.scrollTo(rowAnchor(current), anchor: .top) }+ Divider().padding(.horizontal, 11)+ HStack(spacing: 0) {+ ForEach(EmojiCatalog.categories) { c in+ Button {+ query = ""+ proxy.scrollTo(c.entries.first?.emoji, anchor: .top)+ } label: {+ Image(systemName: c.symbol).font(.system(size: 13)).frame(width: 31, height: 30)+ }+ .buttonStyle(.plain)+ .foregroundStyle(.secondary)+ }+ }+ .padding(.bottom, 4)+ }+ }+ }++ private func cell(_ e: EmojiCatalog.Entry) -> some View {+ Text(e.emoji)+ .font(.system(size: 21))+ .frame(width: 31, height: 31.5)+ .background(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(Color.primary.opacity(e.emoji == current ? 0.16 : hovered == e.emoji ? 0.08 : 0))+ .frame(width: 27.5, height: 27.5)+ )+ .contentShape(Rectangle())+ .onHover { hovered = $0 ? e.emoji : (hovered == e.emoji ? nil : hovered) }+ .onTapGesture { onPick(e.emoji) }+ .help(e.name)+ }++ /// The grid opens with the current emoji's row at the top; rows are 8 wide, so that is the+ /// first emoji of its row.+ private func rowAnchor(_ emoji: String) -> String? {+ guard let i = EmojiCatalog.all.firstIndex(where: { $0.emoji == emoji }) else { return nil }+ return EmojiCatalog.all[i - i % 8].emoji+ }+}++/// The Icon tab: Arc's 56 glyphs in its order (7 rows of 8, no search). Most are SF Symbols in+/// Arc too; its planet, pizza and skull have no SF Symbol and get the nearest one.+struct SpaceSymbolGrid: View {+ let current: String?+ let onPick: (String) -> Void+ @State private var hovered: String?++ static let symbols = [+ "star.fill", "bookmark.fill", "heart.fill", "flag.fill", "bolt.fill", "triangle.fill", "asterisk", "bell.fill",+ "lightbulb.fill", "triangle.circle.fill", "square.grid.2x2.fill", "circle.grid.3x3.fill", "square.stack.3d.up.fill",+ "cylinder.split.1x2.fill", "archivebox.fill", "square.on.square.fill",+ "folder.fill", "tray.full.fill", "calendar", "envelope.fill", "checkmark.square.fill", "doc.fill", "book.fill",+ "ellipsis.bubble.fill",+ "person.2.fill", "apple.terminal.fill", "wrench.and.screwdriver.fill", "square.fill", "oval.portrait.fill",+ "circle.fill", "moon.fill", "sun.max.fill",+ "globe.americas.fill", "leaf.fill", "cloud.fill", "pawprint.fill", "basket.fill", "gift.fill", "bed.double.fill",+ "fork.knife",+ "dumbbell.fill", "airplane", "music.note", "paintpalette.fill", "video.fill", "bandage.fill",+ "chevron.left.forwardslash.chevron.right", "baseball.fill",+ "cloud", "map.fill", "flame.fill", "birthday.cake.fill", "theatermasks.fill", "scroll.fill", "hand.thumbsup.fill",+ "tram.fill",+ ]++ var body: some View {+ LazyVGrid(columns: Array(repeating: GridItem(.fixed(31), spacing: 0), count: 8), spacing: 0) {+ ForEach(Self.symbols, id: \.self) { name in+ Image(systemName: name)+ .font(.system(size: 13, weight: .medium))+ .foregroundStyle(.primary)+ .frame(width: 31, height: 31)+ .background(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(Color.primary.opacity(name == current ? 0.16 : hovered == name ? 0.1 : 0))+ .frame(width: 29, height: 29)+ )+ .contentShape(Rectangle())+ .onHover { hovered = $0 ? name : (hovered == name ? nil : hovered) }+ .onTapGesture { onPick(name) }+ }+ }+ .padding(.horizontal, 11)+ .padding(.top, 11)+ .frame(maxHeight: .infinity, alignment: .top)+ }+}diff --git a/Sources/Cra/UI/Sidebar/SpacesManagerView.swift b/Sources/Cra/UI/Sidebar/SpacesManagerView.swiftnew file mode 100644index 0000000..e6f27bd--- /dev/null+++ b/Sources/Cra/UI/Sidebar/SpacesManagerView.swift@@ -0,0 +1,270 @@+import AppKit++/// Arc 1.171's Library ▸ Spaces, which "Manage Spaces…" opens (spaceManager). Measured from a 2x+/// capture of Arc's window (1 Nov): every space is a 240 pt card in its own theme, 24 pt apart,+/// starting 27 pt right of the rail, 48 pt below the window top and above its bottom. A card has+/// the space's icon, name and a brush (Edit Theme Color…) on a row 25 pt down, its pinned and+/// Today lists from 64 pt down, and a move handle and a ••• menu 21 pt above its bottom. A blue ++/// (New Space) sits 34 pt after the last card, centred.+enum SpacesManagerMetrics {+ static let card: CGFloat = 240+ static let gap: CGFloat = 24+ static let lead: CGFloat = 27+ static let inset: CGFloat = 48+ static let plus: CGFloat = 29+ static let plusGap: CGFloat = 34+ static let trail: CGFloat = 37.5++ /// The Library's width on this page: Arc widens the sidebar to fit every card.+ static func width(spaces n: Int) -> CGFloat {+ LibraryMetrics.rail + lead + CGFloat(n) * card + CGFloat(max(0, n - 1)) * gap + plusGap + plus + trail+ }+}++@MainActor+final class SpacesManagerView: NSView {+ private let store: SidebarStore+ private let ui: SidebarUIState+ private let actions: SidebarActions+ private let favicons: FaviconCache+ private let scroll = NSScrollView()+ private let document = FlippedView()+ private var cards: [UUID: SpaceManagerCard] = [:]+ private var order: [UUID] = []+ private lazy var plus: NSButton = {+ let b = NSButton(image: SidebarSymbols.image("plus", size: 14, weight: .bold) ?? NSImage(), target: self, action: #selector(newSpace))+ b.isBordered = false+ b.wantsLayer = true+ b.layer?.cornerRadius = SpacesManagerMetrics.plus / 2+ b.layer?.backgroundColor = NSColor(hex: "#2147F5").cgColor+ b.contentTintColor = .white+ b.toolTip = "New Space"+ b.setAccessibilityLabel("New Space")+ return b+ }()++ init(store: SidebarStore, ui: SidebarUIState, actions: SidebarActions, favicons: FaviconCache) {+ self.store = store+ self.ui = ui+ self.actions = actions+ self.favicons = favicons+ super.init(frame: .zero)+ scroll.drawsBackground = false+ // The window's full-size content would otherwise push the cards down by the title bar.+ scroll.automaticallyAdjustsContentInsets = false+ scroll.contentInsets = NSEdgeInsetsZero+ scroll.hasHorizontalScroller = true+ scroll.hasVerticalScroller = false+ scroll.autohidesScrollers = true+ scroll.horizontalScrollElasticity = .allowed+ scroll.verticalScrollElasticity = .none+ scroll.documentView = document+ addSubview(scroll)+ document.addSubview(plus)+ sync()+ }++ required init?(coder: NSCoder) { fatalError() }++ override var isFlipped: Bool { true }++ private func sync() {+ let ids = withObservationTracking { store.orderedSpaces.filter { !store.isIncognito(space: $0.id) }.map(\.id) } onChange: { [weak self] in+ Task { @MainActor in self?.sync() }+ }+ for id in cards.keys where !ids.contains(id) { cards.removeValue(forKey: id)?.removeFromSuperview() }+ for id in ids where cards[id] == nil {+ let c = SpaceManagerCard(spaceID: id, store: store, ui: ui, actions: actions, favicons: favicons)+ c.onMove = { [weak self] dx in self?.drag(id, by: dx) }+ c.onMoveEnd = { [weak self] in self?.drop(id) }+ cards[id] = c+ document.addSubview(c)+ }+ order = ids+ needsLayout = true+ }++ @objc private func newSpace() { actions.editSpace(nil) }++ private var dragging: (id: UUID, dx: CGFloat)?++ private func drag(_ id: UUID, by dx: CGFloat) {+ dragging = (id, dx)+ if let c = cards[id] { document.addSubview(c, positioned: .above, relativeTo: nil) }+ needsLayout = true+ layoutSubtreeIfNeeded()+ }++ /// Where the dragged card's centre is, among the others, is its new place.+ private func drop(_ id: UUID) {+ guard let d = dragging, let from = order.firstIndex(of: id) else { return }+ dragging = nil+ let pitch = SpacesManagerMetrics.card + SpacesManagerMetrics.gap+ let to = min(max(0, from + Int((d.dx / pitch).rounded())), order.count - 1)+ if to != from, let target = store.spaceOrder.firstIndex(of: order[to]) { store.moveSpace(id, to: target) }+ NSAnimationContext.runAnimationGroup { ctx in+ ctx.duration = 0.15+ ctx.allowsImplicitAnimation = true+ needsLayout = true+ layoutSubtreeIfNeeded()+ }+ }++ override func layout() {+ super.layout()+ typealias M = SpacesManagerMetrics+ scroll.frame = bounds+ let h = bounds.height+ let cardH = max(0, h - 2 * M.inset)+ var x = M.lead+ for id in order {+ let dx = dragging?.id == id ? dragging?.dx ?? 0 : 0+ cards[id]?.frame = NSRect(x: x + dx, y: M.inset, width: M.card, height: cardH)+ x += M.card + M.gap+ }+ x += M.plusGap - M.gap+ plus.frame = NSRect(x: x, y: (h - M.plus) / 2, width: M.plus, height: M.plus)+ document.frame = NSRect(x: 0, y: 0, width: x + M.plus + M.trail, height: h)+ }+}++/// One space's card: its theme behind its header row, tab list and footer.+@MainActor+private final class SpaceManagerCard: NSView {+ private let spaceID: UUID+ private let store: SidebarStore+ private let ui: SidebarUIState+ private let actions: SidebarActions+ private let background: PaletteBackgroundView+ private let emoji = NSTextField.sidebarLabel(size: 14.5)+ private let symbol = NSImageView()+ private let title = NSTextField.sidebarLabel(size: 13, weight: .semibold)+ private let list: SpaceListView+ private lazy var brush = SidebarGlyphButton(symbol: "paintbrush.pointed.fill", size: 26, iconSize: 13, help: "Edit Theme Color",+ colors: colors) { [weak self] in+ guard let self, let s = self.store.space(self.spaceID) else { return }+ self.actions.editSpaceTheme(s)+ }+ /// Dragging it carries the card along the row; where it is let go is the space's new place.+ private let move = SpaceMoveHandle()+ var onMove: ((CGFloat) -> Void)?+ var onMoveEnd: (() -> Void)?+ private lazy var more = SidebarGlyphButton(symbol: "ellipsis", size: 26, iconSize: 13, help: "", colors: colors) { [weak self] in+ self?.showMenu()+ }+ private var colors = SidebarColors()++ init(spaceID: UUID, store: SidebarStore, ui: SidebarUIState, actions: SidebarActions, favicons: FaviconCache) {+ self.spaceID = spaceID+ self.store = store+ self.ui = ui+ self.actions = actions+ let palette = store.space(spaceID)?.theme.palette ?? SpaceTheme.presets[0].palette+ background = PaletteBackgroundView(palette: palette)+ list = SpaceListView(spaceID: spaceID, store: store, ui: ui, actions: actions, favicons: favicons)+ list.showsNewTab = false+ super.init(frame: .zero)+ move.onDrag = { [weak self] dx in self?.onMove?(dx) }+ move.onEnd = { [weak self] in self?.onMoveEnd?() }+ wantsLayer = true+ layer?.cornerRadius = 14+ layer?.cornerCurve = .continuous+ layer?.masksToBounds = true+ symbol.imageScaling = .scaleNone+ for v in [background, emoji, symbol, title, list, brush, move, more] as [NSView] { addSubview(v) }+ sync()+ }++ required init?(coder: NSCoder) { fatalError() }++ override var isFlipped: Bool { true }++ private func sync() {+ withObservationTracking {+ guard let s = store.space(spaceID) else { return }+ emoji.stringValue = s.emoji+ symbol.image = s.symbol.flatMap { SidebarSymbols.image($0, size: 13, weight: .medium) }+ title.stringValue = s.title+ background.palette = s.theme.palette+ colors = SidebarColors(s.theme.palette)+ } onChange: { [weak self] in+ Task { @MainActor in self?.sync() }+ }+ title.textColor = colors.textSecondary+ symbol.contentTintColor = colors.textSecondary+ for b in [brush, more] { b.colors = colors }+ move.tint = colors.isDark ? NSColor.white.withAlphaComponent(0.55) : colors.glyph+ needsLayout = true+ }++ private func showMenu() {+ guard let event = NSApp.currentEvent,+ let down = NSEvent.mouseEvent(with: .rightMouseDown, location: event.locationInWindow, modifierFlags: [],+ timestamp: event.timestamp, windowNumber: event.windowNumber, context: nil,+ eventNumber: 0, clickCount: 1, pressure: 1),+ let m = SpaceMenu.make(spaceID: spaceID, store: store, ui: ui, actions: actions, anchor: self, rename: {}) else { return }+ NSMenu.popUpContextMenu(m, with: down, for: self)+ }++ override func menu(for event: NSEvent) -> NSMenu? {+ SpaceMenu.make(spaceID: spaceID, store: store, ui: ui, actions: actions, anchor: self, rename: {})+ }++ override func layout() {+ super.layout()+ let w = bounds.width, h = bounds.height+ background.frame = bounds+ let es = emoji.intrinsicContentSize+ let ew = ceil(emoji.attributedStringValue.size().width)+ emoji.frame = NSRect(x: 25.5 - ew / 2 - SidebarText.inset, y: 25 - es.height / 2, width: ew + 2 * SidebarText.inset, height: es.height)+ symbol.frame = NSRect(x: 12.5, y: 12, width: 26, height: 26)+ let th = title.intrinsicContentSize.height+ title.frame = NSRect(x: 44 - SidebarText.inset, y: 25 - th / 2, width: max(0, 213 - 13 - 44) + 2 * SidebarText.inset, height: th)+ brush.frame = NSRect(x: 213 - 13, y: 12, width: 26, height: 26)+ // The first pinned row is centred 64 pt down: rows are 41 pt, 3 pt into the list.+ list.frame = NSRect(x: 0, y: 40.5, width: w, height: max(0, h - 40.5 - 42))+ move.frame = NSRect(x: 22 - 13, y: h - 21 - 13, width: 26, height: 26)+ more.frame = NSRect(x: 217.5 - 13, y: h - 21 - 13, width: 26, height: 26)+ }+}++/// The card's move handle (Arc's four-way arrow): reports how far it has been dragged.+private final class SpaceMoveHandle: NSView {+ var onDrag: (CGFloat) -> Void = { _ in }+ var onEnd: () -> Void = {}+ var tint: NSColor = .secondaryLabelColor { didSet { glyph.contentTintColor = tint } }+ private let glyph = NSImageView()+ private var start: CGFloat?++ override init(frame: NSRect) {+ super.init(frame: frame)+ glyph.image = SidebarSymbols.image("arrow.up.and.down.and.arrow.left.and.right", size: 13, weight: .medium)+ glyph.imageScaling = .scaleNone+ glyph.autoresizingMask = [.width, .height]+ addSubview(glyph)+ setAccessibilityLabel("Move Space")+ }++ required init?(coder: NSCoder) { fatalError() }++ override func layout() {+ super.layout()+ glyph.frame = bounds+ }++ override var mouseDownCanMoveWindow: Bool { false }+ override func resetCursorRects() { addCursorRect(bounds, cursor: .openHand) }+ override func mouseDown(with event: NSEvent) {+ start = event.locationInWindow.x+ NSCursor.closedHand.push()+ }+ override func mouseDragged(with event: NSEvent) {+ if let start { onDrag(event.locationInWindow.x - start) }+ }+ override func mouseUp(with event: NSEvent) {+ guard start != nil else { return }+ start = nil+ NSCursor.pop()+ onEnd()+ }+}diff --git a/Sources/Cra/UI/SidebarUIState.swift b/Sources/Cra/UI/SidebarUIState.swiftindex a43f71e..cc01482 100644--- a/Sources/Cra/UI/SidebarUIState.swift+++ b/Sources/Cra/UI/SidebarUIState.swift@@ -187,6 +187,13 @@ final class SidebarActions {var goForward: () -> Void = {}var reload: () -> Void = {}var editSpace: (Space?) -> Void = { _ in }+ /// Arc's space menu: the icon picker under the header, the theme editor, a new profile for+ /// the space, the Library's Spaces page, and deleting this space (not the focused one).+ var changeSpaceIcon: (Space, NSView) -> Void = { _, _ in }+ var editSpaceTheme: (Space) -> Void = { _ in }+ var newProfile: (UUID) -> Void = { _ in }+ var manageSpaces: () -> Void = {}+ var deleteSpace: (Space) -> Void = { _ in }var toggleSidebar: () -> Void = {}var toggleLibrary: () -> Void = {}/// The Library in the sidebar: open it on a page, leave it, restore an archived tab from it.diff --git a/Sources/Cra/UI/Windows/LittleWindowController.swift b/Sources/Cra/UI/Windows/LittleWindowController.swiftindex 6e66eec..bdc2ba5 100644--- a/Sources/Cra/UI/Windows/LittleWindowController.swift+++ b/Sources/Cra/UI/Windows/LittleWindowController.swift@@ -1327,6 +1327,13 @@ final class LittleSpacesPopup: NSView, NSTextFieldDelegate {emoji.alignment = .centeremoji.frame = NSRect(x: -SidebarText.inset, y: (40 - 25) / 2, width: 40 + 2 * SidebarText.inset, height: 25)tile.addSubview(emoji)+ if let name = s.symbol {+ let glyph = NSImageView(frame: NSRect(x: 0, y: 0, width: 40, height: 40))+ glyph.image = SidebarSymbols.image(name, size: 17, weight: .medium)+ glyph.imageScaling = .scaleNone+ glyph.contentTintColor = .white+ tile.addSubview(glyph)+ }row.addSubview(tile)let title = NSTextField.sidebarLabel(size: 15, weight: .semibold)title.stringValue = s.titlediff --git a/Sources/Cra/UI/Windows/MainWindowController+SpaceMenu.swift b/Sources/Cra/UI/Windows/MainWindowController+SpaceMenu.swiftnew file mode 100644index 0000000..c55fad7--- /dev/null+++ b/Sources/Cra/UI/Windows/MainWindowController+SpaceMenu.swift@@ -0,0 +1,116 @@+import AppKit+import SwiftUI++/// What Arc's space menu opens (the header's ••• and its right-click menu).+extension MainWindowController {+ /// Change Space Icon…: Arc's picker in a popover pointing up at the header's icon.+ func showSpaceIconPicker(space: Space, anchor: NSView) {+ let popover = NSPopover()+ popover.behavior = .transient+ popover.appearance = NSAppearance(named: space.theme.palette.isDark ? .darkAqua : .aqua)+ let id = space.id, store = self.store+ let set: (String, String?) -> Void = { [weak popover] emoji, symbol in+ guard var s = store.space(id) else { return }+ s.emoji = emoji+ s.symbol = symbol+ store.updateSpace(s)+ popover?.performClose(nil)+ }+ let picker = SpaceIconPicker(current: space.emoji, currentSymbol: space.symbol, onPick: { set($0, nil) },+ onPickSymbol: { set("", $0) }, onRemove: { set("", nil) })+ // A fixed size: NSPopover placed itself for the hosting view's first, larger size and then+ // shrank toward its bottom-left corner, which left it 52 pt low with the arrow off-centre.+ let host = NSHostingController(rootView: picker)+ host.sizingOptions = []+ host.preferredContentSize = NSSize(width: 272, height: 272)+ popover.contentViewController = host+ popover.contentSize = NSSize(width: 272, height: 272)+ guard let content = anchor.window?.contentView else { return }+ var rect = anchor.convert((anchor as? SpaceHeaderView)?.iconRect ?? anchor.bounds, to: content)+ // Arc's arrow tip sits a point higher, at the icon box's last row.+ rect.origin.y += content.isFlipped ? -1 : 1+ popover.show(relativeTo: rect, of: content, preferredEdge: content.isFlipped ? .maxY : .minY)+ }++ /// Edit Theme Color…: Arc's editor in a panel against the sidebar's edge at the window's top,+ /// applying every change at once. Escape or a click outside closes it.+ func showSpaceStyleEditor(space: Space) {+ guard let window else { return }+ if let open = window.childWindows?.first(where: { $0 is StyleEditorPanel }) { open.close() }+ let store = self.store, id = space.id+ let editor = SpaceStyleEditor(theme: space.theme) { theme in+ guard var s = store.space(id) else { return }+ s.theme = theme+ store.updateSpace(s)+ }+ // The card sits 12 pt into its 382 × 534 pt window (19 pt above the bottom), room for the shadow.+ let size = NSSize(width: 382, height: 534)+ let x = (window.frame.minX + (shell.sidebarVisible ? shell.sidebarWidth : 0)).rounded()+ let panel = StyleEditorPanel(contentRect: NSRect(x: x, y: window.frame.maxY - size.height, width: size.width, height: size.height))+ let host = NSHostingView(rootView: editor.shadow(color: .black.opacity(0.3), radius: 10, y: 4)+ .padding(.top, 12).padding(.horizontal, 13.5).padding(.bottom, 19))+ host.sizingOptions = []+ panel.contentView = host+ window.addChildWindow(panel, ordered: .above)+ panel.makeKeyAndOrderFront(nil)+ }+ /// Set Profile ▸ New Profile…: Arc's dialog over the dimmed window; Next makes the profile and+ /// moves the space into it (pages already open reload in it, BrowserManager).+ func showNewProfileDialog(forSpace id: UUID) {+ guard let window, window.childWindows?.contains(where: { $0 is DialogOverlayWindow }) != true else { return }+ var overlay: DialogOverlayWindow?+ let close = { [weak window] in+ guard let o = overlay else { return }+ window?.removeChildWindow(o)+ o.orderOut(nil)+ overlay = nil+ window?.makeKey()+ }+ let store = self.store+ let dialog = NewProfileDialog(onCreate: { name in+ store.setProfile(store.createProfile(name: name).id, forSpace: id)+ close()+ }, onCancel: close)+ let o = DialogOverlayWindow(over: window, content: dialog)+ overlay = o+ window.addChildWindow(o, ordered: .above)+ o.makeKeyAndOrderFront(nil)+ }+ /// Manage Spaces…: the Library on its Spaces page, every space side by side.+ func showManageSpaces() { showLibrary(.spaces) }+}++/// The theme editor's window: borderless and see-through around its card; closes on Escape or a+/// click anywhere else in the app.+final class StyleEditorPanel: NSPanel {+ private var monitor: Any?++ init(contentRect: NSRect) {+ super.init(contentRect: contentRect, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)+ isOpaque = false+ backgroundColor = .clear+ hasShadow = false+ isReleasedWhenClosed = false+ monitor = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown, .keyDown]) { [weak self] e in+ guard let self else { return e }+ if e.type == .keyDown {+ // Escape closes it wherever the key goes (SwiftUI keeps it from cancelOperation).+ guard e.keyCode == 53 else { return e }+ self.close()+ return nil+ }+ if e.window !== self { self.close() }+ return e+ }+ }++ override var canBecomeKey: Bool { true }+ override func cancelOperation(_ sender: Any?) { close() }++ override func close() {+ if let monitor { NSEvent.removeMonitor(monitor) }+ monitor = nil+ parent?.removeChildWindow(self)+ super.close()+ }+}diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swiftindex 06125ca..0a01e48 100644--- a/Sources/Cra/UI/Windows/MainWindowController.swift+++ b/Sources/Cra/UI/Windows/MainWindowController.swift@@ -202,6 +202,11 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMb.isLoading ? b.stopLoading() : b.reload()}sidebarActions.editSpace = { [weak self] s in self?.showSpaceEditor(space: s) }+ sidebarActions.changeSpaceIcon = { [weak self] s, anchor in self?.showSpaceIconPicker(space: s, anchor: anchor) }+ sidebarActions.editSpaceTheme = { [weak self] s in self?.showSpaceStyleEditor(space: s) }+ sidebarActions.newProfile = { [weak self] id in self?.showNewProfileDialog(forSpace: id) }+ sidebarActions.manageSpaces = { [weak self] in self?.showManageSpaces() }+ sidebarActions.deleteSpace = { [weak self] s in self?.app.confirmDeleteSpace(s) }sidebarActions.toggleSidebar = { [weak self] in self?.toggleSidebar() }sidebarActions.toggleLibrary = { [weak self] in self?.toggleLibrary() }sidebarActions.showLibrary = { [weak self] page in self?.showLibrary(page) }@@ -367,7 +372,7 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM}if CGFloat(store.prefs.sidebarWidth) != lastSidebarWidth {lastSidebarWidth = CGFloat(store.prefs.sidebarWidth)- shell.sidebarWidth = lastSidebarWidth + (sidebarUI.libraryPage != nil ? LibraryMetrics.extraWidth : 0)+ shell.sidebarWidth = sidebarUI.libraryPage.map { libraryWidth($0) } ?? lastSidebarWidth}}@@ -1384,12 +1389,17 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMfunc showLibrary(_ page: LibraryPage) {sidebarUI.lastLibraryPage = pagelet opening = sidebarUI.libraryPage == nil+ let resize = !opening && sidebarUI.libraryPage.map(libraryWidth) != libraryWidth(page)withAnimation(.easeOut(duration: 0.05)) { sidebarUI.libraryPage = page }+ if resize {+ shell.sidebarWidth = libraryWidth(page)+ shell.animateSidebar(visible: true, floating: false, fullscreen: shell.contentFullscreen, width: shell.sidebarWidth, duration: 0.1)+ }guard opening else { return }sidebarUI.downloadsListOpen = falsecommandBar.close()shell.sidebarResizable = false- let width = CGFloat(store.prefs.sidebarWidth) + LibraryMetrics.extraWidth+ let width = libraryWidth(page)if sidebarVisible {shell.sidebarWidth = widthshell.animateSidebar(visible: true, floating: false, fullscreen: shell.contentFullscreen, width: width)@@ -1402,6 +1412,16 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserMwindow?.makeKey()}+ /// The sidebar's width with the Library in it: 70 pt wider for the rail, or on the Spaces page+ /// wide enough for every space's card (Arc), leaving the page at least 320 pt.+ private func libraryWidth(_ page: LibraryPage) -> CGFloat {+ let base = CGFloat(store.prefs.sidebarWidth) + LibraryMetrics.extraWidth+ guard page == .spaces else { return base }+ let n = store.orderedSpaces.filter { !store.isIncognito(space: $0.id) }.count+ let room = (window?.frame.width ?? 1280) - 320+ return max(base, min(SpacesManagerMetrics.width(spaces: n), room))+ }+func closeLibrary() {guard sidebarUI.libraryPage != nil else { return }withAnimation(.easeOut(duration: 0.1)) { sidebarUI.libraryPage = nil }diff --git a/Sources/Cra/UI/Windows/NewProfileDialog.swift b/Sources/Cra/UI/Windows/NewProfileDialog.swiftnew file mode 100644index 0000000..507ad1d--- /dev/null+++ b/Sources/Cra/UI/Windows/NewProfileDialog.swift@@ -0,0 +1,161 @@+import AppKit+import SwiftUI++/// Arc 1.171's "Create a new Profile" dialog (Set Profile ▸ New Profile…), measured from a 2x+/// capture (1 Nov): a 450 × 426 pt navy card centred on the window, which dims behind it.+struct NewProfileDialog: View {+ let onCreate: (String) -> Void+ let onCancel: () -> Void+ @State private var name = ""+ @FocusState private var focused: Bool++ private static let card = Color(hex: "#161C2F")+ private static let body = Color(hex: "#B8B9C4")+ private var trimmed: String { name.trimmingCharacters(in: .whitespaces) }++ var body: some View {+ VStack(alignment: .leading, spacing: 0) {+ ProfileAvatar().padding(.top, 38.5)+ Text("Create a new Profile")+ .font(.system(size: 17.5, weight: .semibold))+ .foregroundStyle(.white)+ .padding(.top, 19)+ Text("Profiles make your Spaces truly separate — with their own history, saved passwords, extensions, and other browsing data. No more flipping between work and personal accounts!")+ .font(.system(size: 14))+ .lineSpacing(0.7)+ .foregroundStyle(Self.body)+ .fixedSize(horizontal: false, vertical: true)+ // Arc's text column runs 2.5 pt past the field and buttons.+ .frame(width: 375.5, alignment: .leading)+ .padding(.top, 12)+ Text("What do you want to call this Profile?")+ .font(.system(size: 14))+ .foregroundStyle(Self.body)+ .padding(.top, 20)+ TextField("", text: $name, prompt: Text("Personal").foregroundStyle(Color(hex: "#9699A1")))+ .textFieldStyle(.plain)+ .font(.system(size: 14))+ .foregroundStyle(.white)+ .focused($focused)+ .onSubmit { if !trimmed.isEmpty { onCreate(trimmed) } }+ .padding(.horizontal, 12.5)+ .frame(height: 49)+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).strokeBorder(Color(hex: "#23293B"), lineWidth: 1))+ .padding(.top, 7)+ HStack(spacing: 4) {+ Image(systemName: "clock.arrow.2.circlepath").font(.system(size: 11, weight: .semibold))+ Text("Profiles are ") + Text("not synced").bold() + Text(" between computers.")+ }+ .font(.system(size: 11))+ .foregroundStyle(Color(hex: "#8F929E"))+ .padding(.top, 4)+ HStack(spacing: 8.5) {+ Spacer()+ DialogButton(title: "Cancel", key: "ESC", enabled: true, primary: false, action: onCancel)+ .keyboardShortcut(.cancelAction)+ DialogButton(title: "Next", key: "↩", enabled: !trimmed.isEmpty, primary: true) { onCreate(trimmed) }+ }+ .padding(.top, 27)+ Spacer(minLength: 0)+ }+ .padding(.horizontal, 38.5)+ .frame(width: 450, height: 426)+ .background(Self.card, in: RoundedRectangle(cornerRadius: 24, style: .continuous))+ .environment(\.colorScheme, .dark)+ .onAppear { focused = true }+ }+}++/// Arc's dialog button: a label and its key in a small badge.+private struct DialogButton: View {+ let title: String+ let key: String+ let enabled: Bool+ let primary: Bool+ let action: () -> Void++ var body: some View {+ Button(action: action) {+ HStack(spacing: 9) {+ Text(title).font(.system(size: 13, weight: .medium))+ .foregroundStyle(enabled ? Color(hex: "#EBEBEF") : Color(hex: "#5B5C7F"))+ Text(key).font(.system(size: key == "↩" ? 13 : 11, weight: .bold))+ .foregroundStyle(enabled ? Color(hex: "#B7B7DD") : Color(hex: "#5F6193"))+ .frame(minWidth: 27, minHeight: 19)+ .padding(.horizontal, key == "↩" ? 0 : 2)+ .background(RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(primary ? Color(hex: enabled ? "#4E4C9A" : "#222469") : Color(hex: "#4E4C77")))+ }+ .padding(.leading, 12.5)+ .padding(.trailing, 12)+ .frame(height: 37)+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill(primary ? Color(hex: enabled ? "#3B3C8F" : "#1C1D4C") : Color(hex: "#302F60"))+ )+ .overlay(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .strokeBorder(primary ? (enabled ? Color(hex: "#6362A9") : .clear) : Color(hex: "#6362A9"), lineWidth: 1)+ )+ }+ .buttonStyle(.plain)+ .disabled(!enabled)+ }+}++/// Arc's profile glyph: a lavender smiley in a dashed ring with a green plus badge.+private struct ProfileAvatar: View {+ var body: some View {+ ZStack(alignment: .bottomTrailing) {+ ZStack {+ Circle().strokeBorder(Color(hex: "#6262A3").opacity(0.45), style: StrokeStyle(lineWidth: 1, dash: [2, 2]))+ .frame(width: 61, height: 61)+ Circle().fill(Color(hex: "#30305D")).frame(width: 54, height: 54)+ Circle().strokeBorder(Color(hex: "#6262A3"), lineWidth: 3).frame(width: 54, height: 54)+ VStack(spacing: 7) {+ HStack(spacing: 9) {+ Capsule().fill(Color(hex: "#C4C4DC")).frame(width: 4.5, height: 13)+ Capsule().fill(Color(hex: "#C4C4DC")).frame(width: 4.5, height: 13)+ }+ SmileArc().stroke(Color(hex: "#C4C4DC"), style: StrokeStyle(lineWidth: 4.5, lineCap: .round))+ .frame(width: 26, height: 6)+ }+ .offset(y: 1)+ }+ ZStack {+ Circle().fill(Color(hex: "#5DA642")).frame(width: 17, height: 17)+ Image(systemName: "plus").font(.system(size: 10, weight: .heavy)).foregroundStyle(.white)+ }+ .overlay(Circle().strokeBorder(Color(hex: "#161C2F"), lineWidth: 1.5))+ .offset(x: 1, y: 1)+ }+ .frame(width: 61, height: 61)+ }+}++private struct SmileArc: Shape {+ func path(in r: CGRect) -> Path {+ var p = Path()+ p.move(to: CGPoint(x: r.minX, y: r.minY))+ p.addQuadCurve(to: CGPoint(x: r.maxX, y: r.minY), control: CGPoint(x: r.midX, y: r.maxY + r.height))+ return p+ }+}++/// A borderless window over the main window: Arc's dim plus the dialog, and keys for its field.+final class DialogOverlayWindow: NSWindow {+ override var canBecomeKey: Bool { true }++ convenience init<Content: View>(over parent: NSWindow, content: Content) {+ self.init(contentRect: parent.frame, styleMask: [.borderless], backing: .buffered, defer: false)+ isOpaque = false+ backgroundColor = .clear+ hasShadow = false+ let root = ZStack {+ // Arc darkens the window to about 35% under its dialogs (sampled on 1 Nov).+ Color(white: 0.1).opacity(0.65)+ content.shadow(color: .black.opacity(0.35), radius: 24, y: 8)+ }+ contentView = NSHostingView(rootView: root)+ }+}diff --git a/Sources/Cra/UI/Windows/SpaceStyleEditor.swift b/Sources/Cra/UI/Windows/SpaceStyleEditor.swiftnew file mode 100644index 0000000..03fb823--- /dev/null+++ b/Sources/Cra/UI/Windows/SpaceStyleEditor.swift@@ -0,0 +1,270 @@+import AppKit+import SwiftUI++/// Arc 1.171's theme editor (SpaceStyleEditor), which Edit Theme Color… opens beside the+/// sidebar. Measured from 2x captures of an offline Arc (1 Nov): a 355 × 503 pt panel, the window+/// behind it darkened by ~58%; a 340 pt dotted colour pad with Auto / Light / Dark on top and − / ++/// (one to three colours) at the bottom; nine swatches between paging arrows (single colours, then+/// two-colour gradients); a wave slider for the intensity and a dotted dial for the grain. Every+/// change shows in the space at once.+struct SpaceStyleEditor: View {+ @State var theme: SpaceTheme+ let onChange: (SpaceTheme) -> Void++ static let swatchPages: [[[String]]] = [+ ["#F1EAE5", "#E69FBA", "#9E749B", "#E1686F", "#EF8C62", "#F2D66D", "#73E59C", "#7FB8D6", "#666786"].map { [$0] },+ [["#DCD2CF", "#C6BBBC"], ["#D397A2", "#BC89A8"], ["#976B86", "#7D617C"], ["#D07E6A", "#BA7087"], ["#DDA361", "#C88274"],+ ["#CACB6A", "#BB8F61"], ["#71CAAD", "#76B789"], ["#7B8FC2", "#7093A3"], ["#6F5F7F", "#646172"]],+ ]+ @State private var swatchPage = 0++ var body: some View {+ VStack(spacing: 0) {+ ColorPad(theme: $theme)+ .frame(width: 340, height: 340)+ .padding(.top, 9)+ HStack(spacing: 0) {+ pageArrow("chevron.left", to: swatchPage - 1)+ HStack(spacing: 5.5) {+ ForEach(Self.swatchPages[swatchPage], id: \.self) { colors in+ Circle()+ .fill(LinearGradient(colors: colors.map { Color(hex: $0) }, startPoint: .topLeading, endPoint: .bottomTrailing))+ .frame(width: 24, height: 24)+ .contentShape(Circle())+ .onTapGesture {+ theme.colors = colors+ theme.accent = colors.first+ }+ }+ }+ pageArrow("chevron.right", to: swatchPage + 1)+ }+ .padding(.top, 16.75)+ HStack(spacing: 0) {+ WaveSlider(value: $theme.intensity).frame(width: 224, height: 50)+ Spacer(minLength: 0)+ GrainDial(value: $theme.noise).frame(width: 70, height: 70)+ }+ .frame(height: 70)+ .padding(.leading, 17)+ .padding(.trailing, 23)+ .padding(.top, 22)+ Spacer(minLength: 0)+ }+ .frame(width: 355, height: 503)+ // The space's own theme, darkened ~58% (Arc: #CDC2A5 behind → #554F37).+ .background(+ ZStack {+ SpaceBackground(palette: theme.palette)+ Color.black.opacity(0.58)+ }+ .clipShape(RoundedRectangle(cornerRadius: 22, style: .continuous))+ )+ .environment(\.colorScheme, .dark)+ .onChange(of: theme) { _, t in onChange(t) }+ }++ private func pageArrow(_ symbol: String, to page: Int) -> some View {+ let ok = Self.swatchPages.indices.contains(page)+ return Button { if ok { swatchPage = page } } label: {+ Image(systemName: symbol).font(.system(size: 15, weight: .medium)).frame(width: 36, height: 30)+ }+ .buttonStyle(.plain)+ .foregroundStyle(.white.opacity(ok ? 0.55 : 0.2))+ }+}++/// The dotted pad, a colour wheel: a handle's angle (clockwise from three o'clock) is its hue and its+/// distance from the centre its saturation (full at 153 pt), brightness 0.95. A second and third+/// colour follow the first 40° either side; dragging any handle turns the set.+private struct ColorPad: View {+ @Binding var theme: SpaceTheme+ private static let reach: CGFloat = 153+ private static let spread: CGFloat = 40++ var body: some View {+ GeometryReader { geo in+ let size = geo.size+ let centre = CGPoint(x: size.width / 2, y: size.height / 2)+ ZStack {+ RoundedRectangle(cornerRadius: 8, style: .continuous).fill(.white.opacity(0.04))+ Canvas { ctx, s in+ var p = Path()+ for x in stride(from: 4.0, to: s.width, by: 4) {+ for y in stride(from: 4.0, to: s.height, by: 4) { p.addEllipse(in: CGRect(x: x - 0.5, y: y - 0.5, width: 1, height: 1)) }+ }+ ctx.fill(p, with: .color(.white.opacity(0.12)))+ }+ .clipShape(RoundedRectangle(cornerRadius: 8, style: .continuous))+ .contentShape(Rectangle())+ // Arc: pressing anywhere on the pad brings the main colour there, and it follows the drag.+ .gesture(DragGesture(minimumDistance: 0).onChanged { g in place(handle: 0, at: g.location, centre: centre) })+ if theme.colors.isEmpty {+ Text("Tap to pick a color for this space")+ .font(.system(size: 13, weight: .semibold))+ .foregroundStyle(.white.opacity(0.85))+ .allowsHitTesting(false)+ }+ ForEach(Array(theme.colors.prefix(3).enumerated()), id: \.offset) { i, hex in+ let main = i == 0+ Circle()+ .fill(Color(hex: hex))+ .overlay(Circle().strokeBorder(.white, lineWidth: main ? 4.5 : 2.5))+ .shadow(color: .black.opacity(0.25), radius: 3, y: 1)+ .frame(width: main ? 44 : 27, height: main ? 44 : 27)+ .position(Self.point(for: hex, centre: centre))+ .gesture(DragGesture(minimumDistance: 0).onChanged { g in place(handle: i, at: g.location, centre: centre) })+ }+ VStack {+ AppearanceToggles(appearance: $theme.appearance).padding(.top, 24)+ Spacer()+ HStack(spacing: 16) {+ padButton("minus", enabled: theme.colors.count > 1) { theme.colors.removeLast() }+ padButton("plus", enabled: !theme.colors.isEmpty && theme.colors.count < 3) { addColor() }+ }+ .padding(.bottom, 20)+ }+ }+ }+ }++ private func padButton(_ symbol: String, enabled: Bool, action: @escaping () -> Void) -> some View {+ Button(action: action) {+ Image(systemName: symbol).font(.system(size: 15, weight: .medium)).frame(width: 24, height: 24)+ }+ .buttonStyle(.plain)+ .foregroundStyle(.white.opacity(enabled ? 0.55 : 0.18))+ .disabled(!enabled)+ }++ /// Handle `i` goes under the pointer; the others keep their place around it.+ private func place(handle i: Int, at p: CGPoint, centre c: CGPoint) {+ let dx = p.x - c.x, dy = p.y - c.y+ var angle = atan2(dy, dx) * 180 / .pi - Self.offset(i)+ angle = (angle.truncatingRemainder(dividingBy: 360) + 360).truncatingRemainder(dividingBy: 360)+ let sat = min(1, hypot(dx, dy) / Self.reach)+ let count = max(1, theme.colors.count)+ theme.colors = (0..<count).map { Self.hex(hue: angle + Self.offset($0), saturation: sat) }+ theme.accent = theme.colors.first+ }++ private func addColor() {+ guard let first = theme.colors.first else { return }+ let (h, s) = Self.wheel(first)+ theme.colors.append(Self.hex(hue: h + Self.offset(theme.colors.count), saturation: s))+ }++ private static func offset(_ i: Int) -> CGFloat { i == 0 ? 0 : (i == 1 ? spread : -spread) }++ private static func hex(hue: CGFloat, saturation: CGFloat) -> String {+ let h = (hue.truncatingRemainder(dividingBy: 360) + 360).truncatingRemainder(dividingBy: 360) / 360+ return Color(nsColor: NSColor(hue: h, saturation: saturation, brightness: 0.95, alpha: 1)).hexString+ }++ private static func wheel(_ hex: String) -> (CGFloat, CGFloat) {+ let c = NSColor(Color(hex: hex)).usingColorSpace(.sRGB) ?? .gray+ return (c.hueComponent * 360, c.saturationComponent)+ }++ static func point(for hex: String, centre c: CGPoint) -> CGPoint {+ let (h, s) = wheel(hex)+ let a = h * .pi / 180, r = s * reach+ return CGPoint(x: c.x + r * cos(a), y: c.y + r * sin(a))+ }+}++/// Auto (sparkles), Light (sun) and Dark (moon) over the pad; the chosen one on a 32 pt tile.+private struct AppearanceToggles: View {+ @Binding var appearance: String++ var body: some View {+ HStack(spacing: 7.5) {+ toggle("auto", symbol: "sparkles")+ toggle("light", symbol: "sun.max.fill")+ toggle("dark", symbol: "moon.stars.fill")+ }+ }++ private func toggle(_ value: String, symbol: String) -> some View {+ Button { appearance = value } label: {+ Image(systemName: symbol)+ .font(.system(size: 15, weight: .medium))+ .frame(width: 32, height: 32)+ .background(RoundedRectangle(cornerRadius: 8, style: .continuous).fill(.white.opacity(appearance == value ? 0.12 : 0)))+ }+ .buttonStyle(.plain)+ .foregroundStyle(.white.opacity(appearance == value ? 0.8 : 0.55))+ }+}++/// The intensity: a wave over a 15 pt track with a white 16 × 46.5 pt thumb; the wave grows with the+/// value and is bright up to the thumb, faint after it.+private struct WaveSlider: View {+ @Binding var value: Double++ var body: some View {+ GeometryReader { geo in+ let w = geo.size.width, h = geo.size.height+ let x = 8 + (w - 16) * value+ let wave = Path { p in+ let amp = 3 + (h / 2 - 12) * value+ for px in stride(from: 8.0, through: w - 8, by: 1) {+ let y = h / 2 - amp * sin((px - 8) / (w - 16) * CGFloat.pi * 14)+ px == 8 ? p.move(to: CGPoint(x: px, y: y)) : p.addLine(to: CGPoint(x: px, y: y))+ }+ }+ let style = StrokeStyle(lineWidth: 4.5, lineCap: .round, lineJoin: .round)+ ZStack(alignment: .leading) {+ Capsule().fill(.white.opacity(0.1)).frame(height: 15)+ wave.stroke(.white.opacity(0.25), style: style)+ wave.stroke(.white.opacity(0.75), style: style).mask(Rectangle().frame(width: x).frame(maxWidth: .infinity, alignment: .leading))+ Capsule().fill(.white).frame(width: 16, height: 46.5).position(x: x, y: h / 2)+ }+ .contentShape(Rectangle())+ .gesture(DragGesture(minimumDistance: 0).onChanged { g in value = min(max((g.location.x - 8) / (w - 16), 0), 1) })+ }+ }+}++/// The grain: a dark disc showing it, a ring of dots lit from twelve o'clock round to a white knob;+/// turning the knob sets the value.+private struct GrainDial: View {+ @Binding var value: Double+ private let count = 24++ var body: some View {+ GeometryReader { geo in+ let c = CGPoint(x: geo.size.width / 2, y: geo.size.height / 2)+ let knob = value * 2 * .pi - .pi / 2+ ZStack {+ ForEach(0..<count, id: \.self) { i in+ let a = Double(i) / Double(count) * 2 * .pi - .pi / 2+ Circle()+ .fill(.white.opacity(Double(i) / Double(count) <= value ? 0.55 : 0.18))+ .frame(width: 3.5, height: 3.5)+ .position(x: c.x + 34 * cos(a), y: c.y + 34 * sin(a))+ }+ Circle().fill(.black.opacity(0.12)).overlay(NoiseDisc(amount: value)).clipShape(Circle())+ .overlay(Circle().strokeBorder(.white.opacity(0.12), lineWidth: 1))+ .frame(width: 41, height: 41)+ Capsule().fill(.white).frame(width: 4.5, height: 12)+ .rotationEffect(.radians(knob + .pi / 2))+ .position(x: c.x + 31 * cos(knob), y: c.y + 31 * sin(knob))+ }+ .contentShape(Circle())+ .gesture(DragGesture(minimumDistance: 0).onChanged { g in+ var a = atan2(g.location.y - c.y, g.location.x - c.x) + .pi / 2+ if a < 0 { a += 2 * .pi }+ value = a / (2 * .pi)+ })+ }+ }+}++/// The dial's face: the theme's grain texture at the chosen strength.+private struct NoiseDisc: View {+ let amount: Double+ var body: some View {+ Rectangle().fill(ImagePaint(image: Image(nsImage: NoiseTexture.image), scale: 0.5)).opacity(0.15 + 0.6 * amount)+ }+}diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 9b7db0b..4d4eda8 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -668,6 +668,38 @@ Observed live on a throwaway Today split (example.com | example.org), archived a- [O] Arc lists a matching command above the typed row in general: "sett" → Settings, "new" → Add Split View,"clear" in a main window → Clear Unpinned Tabs. Pages/history follow a confidence rule not reproduced.+### Space header ••• and the space menu (Arc 1.171, live, 1 Nov, issue #40)+- [O] Header hover: the row's geometry, glyphs and colours are under "Space header row" (#39) below, and Cra+ follows those. Here also: `sidebarSpaceEditButton` (AX "More", 2×26 pt until hovered, then 26×26) is the •••,+ centred 18.5 pt from the fill's trailing edge on a 24 pt hover tile; fill, chevron and button appear in one+ frame, no fade. An Icon-tab glyph sits in the emoji's 26 pt box 5 pt in.+- [O] The ••• and a right-click on the header open the same menu, as a context menu at the pointer (a click+ at 683,150 put the menu window at 684,144): Change Space Icon…, Rename Space…, Edit Theme Color…, Set Profile ▸+ (profiles, ✓ on the space's, then New Profile…) | New Folder, Live Folders ▸ (GitHub ✓ when present) |+ Share Space…, Export “<name>” into Folder ▸ (every space, its own disabled) | Manage Spaces… | Delete Space.+ The header keeps its hover look while the menu is open. Cra leaves out Share Space… (Arc's servers).+- [O] Rename Space…: the name turns into a selected text field and the ••• into a grey "Done" (10 pt semibold,+ `Sidebar space header done button`, 32×26). Export … into Folder deletes the space afterwards+ (`completeDeleteSpace`, "Space turned into folder"). Delete alert: "Delete your <name> Space?" / "This will+ archive all the tabs and folders inside it."+- [O] Change Space Icon…: an NSPopover (298 × 298 window, 272 pt content) under the icon, arrow up: Emoji | Icon+ segmented (105 × 23) and a trash button; a 254 × 27 search field; an 8-wide grid on a 31 pt pitch opening on+ the current emoji's row, the current emoji on a 27.5 pt tile; a hairline and 8 category glyphs. The Icon tab+ has no search: 56 white glyphs, 7 rows of 8, a 29 pt hover tile.+- [O] Set Profile ▸ New Profile…: Arc's own 450 × 426 dialog (#161C2F, ~24 pt corners) centred on the window,+ which dims to about (25,25,25) at 65%: profile glyph, "Create a new Profile" (17.5 pt), the "Profiles make+ your Spaces truly separate…" copy (14 pt, 18 pt lines), "What do you want to call this Profile?", a 49 pt+ field (placeholder "Personal"), "Profiles are **not synced** between computers.", Cancel `ESC` / Next `↩`.+- [O] Manage Spaces…: the Library on its Spaces page (`spaceManager`): one 240 pt card per space in its own+ theme, 24 pt apart, 27 pt after the rail, 48 pt from the window's top and bottom; the icon, name and a brush+ on a row 25 pt down, the pinned/Today list from 64 pt (no New Tab row), a move handle and ••• 21 pt above the+ bottom; a 29 pt blue + 34 pt after the last card. The sidebar widens to fit (744.5 pt for two spaces).+- [O] Edit Theme Color…: SpaceStyleEditor in a 382 × 534 window against the sidebar's edge at the window top+ (card 355 × 503, 14 pt in): a 340 pt dotted pad with Auto/Light/Dark (sparkles/sun/moon, the chosen one on a+ 32 pt tile) and −/+, "Tap to pick a color for this space" while it has none; nine 24 pt swatches 29.5 pt apart+ between arrows (#F1EAE5 #E69FBA #9E749B #E1686F #EF8C62 #F2D66D #73E59C #7FB8D6 #666786); a 224 × 15 pt wave+ slider and a dotted dial.+### One space (Arc 1.171, static)- [O strings] Defaults key `showSpaceHeaderOnSingleUnnamedSpaces` (+ `…DidChange` action); the space contextmenu has "Show Space Header" / "Hide Space Header" ("Menu item to toggle space header visibility").diff --git a/scripts/make-emoji-catalog.py b/scripts/make-emoji-catalog.pynew file mode 100755index 0000000..45d7d14--- /dev/null+++ b/scripts/make-emoji-catalog.py@@ -0,0 +1,60 @@+#!/usr/bin/env python3+"""Writes Sources/Cra/UI/Sidebar/EmojiCatalog+Data.swift from Unicode's emoji-test.txt.++ scripts/make-emoji-catalog.py <path to emoji-test.txt>++Keeps fully-qualified emoji up to Emoji 15.0 (the set Arc 1.171's picker shows) without skin-tone+variants, in Unicode's order, grouped like the category bar of Arc's space icon picker (People & Body+joins Smileys, Component is dropped).+"""+import sys++GROUPS = [+ ("smileys", ["Smileys & Emotion", "People & Body"]),+ ("nature", ["Animals & Nature"]),+ ("food", ["Food & Drink"]),+ ("activities", ["Activities"]),+ ("travel", ["Travel & Places"]),+ ("objects", ["Objects"]),+ ("symbols", ["Symbols"]),+ ("flags", ["Flags"]),+]+TONES = {0x1F3FB, 0x1F3FC, 0x1F3FD, 0x1F3FE, 0x1F3FF}+MAX_VERSION = 15.0++src = sys.argv[1]+version = "?"+by_group = {}+group = None+for line in open(src, encoding="utf-8"):+ if line.startswith("# Version:"):+ version = line.split(":", 1)[1].strip()+ if line.startswith("# group:"):+ group = line.split(":", 1)[1].strip()+ continue+ if not line.strip() or line.startswith("#") or "; fully-qualified" not in line:+ continue+ codes, rest = line.split(";", 1)+ cps = [int(c, 16) for c in codes.split()]+ if TONES & set(cps):+ continue+ emoji, name = rest.split("#", 1)[1].strip().split(" ", 1)+ tag, name = name.split(" ", 1) # "E15.0 grinning face"+ if float(tag[1:]) > MAX_VERSION:+ continue+ by_group.setdefault(group, []).append((emoji, name.replace("\\", "").replace('"', "")))++out = [+ "// Generated by scripts/make-emoji-catalog.py from Unicode emoji-test.txt %s (emoji up to %s). Do not edit." % (version, MAX_VERSION),+ "",+ "extension EmojiCatalog {",+ " /// Category, then one \"<emoji> <name>\" per line.",+ " static let data: [(String, String)] = [",+]+for key, names in GROUPS:+ rows = [f"{e} {n}" for g in names for e, n in by_group.get(g, [])]+ body = "\n".join(rows)+ out.append(f' ("{key}", """\n{body}\n"""),')+out += [" ]", "}", ""]+open("Sources/Cra/UI/Sidebar/EmojiCatalog+Data.swift", "w", encoding="utf-8").write("\n".join(out))+print({k: sum(len(by_group.get(g, [])) for g in v) for k, v in GROUPS})