Refine native mockup controls and composer for r5
70 files changed,
+849
−120
docs/native/r5/index.md+69 −0docs/native/r5/iphone-connections-dark.pngbinarydocs/native/r5/iphone-connections-light.pngbinarydocs/native/r5/iphone-contra-dark.pngbinarydocs/native/r5/iphone-contra-light.pngbinarydocs/native/r5/iphone-conversation-attachment-dark.pngbinarydocs/native/r5/iphone-conversation-attachment-light.pngbinarydocs/native/r5/iphone-conversation-dark.pngbinarydocs/native/r5/iphone-conversation-draft-dark.pngbinarydocs/native/r5/iphone-conversation-draft-light.pngbinarydocs/native/r5/iphone-conversation-error-dark.pngbinarydocs/native/r5/iphone-conversation-error-light.pngbinarydocs/native/r5/iphone-conversation-light.pngbinarydocs/native/r5/iphone-conversation-uploading-dark.pngbinarydocs/native/r5/iphone-conversation-uploading-light.pngbinarydocs/native/r5/iphone-copy-hold-dark.pngbinarydocs/native/r5/iphone-copy-hold-light.pngbinarydocs/native/r5/iphone-exploration-dark.pngbinarydocs/native/r5/iphone-exploration-light.pngbinarydocs/native/r5/iphone-needs-accessibility-dark.pngbinarydocs/native/r5/iphone-needs-accessibility-light.pngbinarydocs/native/r5/iphone-needs-dark.pngbinarydocs/native/r5/iphone-needs-light.pngbinarydocs/native/r5/iphone-notification-answered-dark.pngbinarydocs/native/r5/iphone-notification-answered-light.pngbinarydocs/native/r5/iphone-notification-compact-dark.pngbinarydocs/native/r5/iphone-notification-compact-light.pngbinarydocs/native/r5/iphone-notification-dark.pngbinarydocs/native/r5/iphone-notification-light.pngbinarydocs/native/r5/iphone-research-dark.pngbinarydocs/native/r5/iphone-research-light.pngbinarydocs/native/r5/iphone-task-dark.pngbinarydocs/native/r5/iphone-task-light.pngbinarydocs/native/r5/iphone-tasks-dark.pngbinarydocs/native/r5/iphone-tasks-light.pngbinarydocs/native/r5/iphone-team-dark.pngbinarydocs/native/r5/iphone-team-light.pngbinarydocs/native/r5/iphone-teams-dark.pngbinarydocs/native/r5/iphone-teams-light.pngbinarydocs/native/r5/iphone-usage-concept-dark.pngbinarydocs/native/r5/iphone-usage-concept-light.pngbinarydocs/native/r5/mac-composer-states-dark.pngbinarydocs/native/r5/mac-composer-states-light.pngbinarydocs/native/r5/mac-main-dark.pngbinarydocs/native/r5/mac-main-light.pngbinarydocs/native/r5/mac-menu-dark.pngbinarydocs/native/r5/mac-menu-light.pngbinarydocs/native/r5/mac-notification-answered-dark.pngbinarydocs/native/r5/mac-notification-answered-light.pngbinarydocs/native/r5/mac-notification-compact-dark.pngbinarydocs/native/r5/mac-notification-compact-light.pngbinarydocs/native/r5/mac-notification-dark.pngbinarydocs/native/r5/mac-notification-light.pngbinarynative/mockups/.gitignore+3 −0native/mockups/EquipoCore/Sources/EquipoCore/Composer.swift+55 −0native/mockups/EquipoCore/Tests/EquipoCoreTests/ComposerTests.swift+44 −0native/mockups/EquipoMockups.xcodeproj/project.pbxproj+59 −15native/mockups/Mac/ComposerVerification.swift+80 −0native/mockups/Mac/EquipoMacApp.swift+7 −0native/mockups/Mac/MacPanels.swift+1 −1native/mockups/Mac/NativeComposer.swift+220 −0native/mockups/Mac/NativeTranscript.swift+25 −43native/mockups/Shared/Components.swift+11 −22native/mockups/Shared/Controls.swift+89 −0native/mockups/Shared/Theme.swift+13 −6native/mockups/iOS/EquipoPhoneApp.swift+17 −13native/mockups/iOS/PhoneComposer.swift+81 −0native/mockups/scripts/check-composer-mutations.py+30 −0native/mockups/scripts/generate-project.py+1 −1native/mockups/scripts/studio.sh+44 −19
CI passed — run details
diff --git a/docs/native/r5/index.md b/docs/native/r5/index.md| new file mode 100644 |
| index 00000000..58356aca |
| --- /dev/null |
| +++ b/docs/native/r5/index.md |
| @@ -0,0 +1,69 @@ |
| +# Equipo native, revision 5 |
| + |
| +R5 follows the web's current buttons and composer. The native project remains at [native/mockups](../../../native/mockups/). All copy and data remain placeholders. Attachment selection, upload and posting states use fixtures; no files are read or uploaded, and no message is sent to a live instance. |
| + |
| +## Before and after |
| + |
| +| Change | R4 | R5 | |
| +| --- | --- | --- | |
| +| Answer choices | [Uneven purple capsules](../r4/iphone-notification-dark.png) | [Equal-width, neutral buttons](iphone-notification-dark.png) | |
| +| Mac composer | [Plain field and permanent Send button](../r4/mac-main-dark.png) | [Round + and Message pill](mac-main-dark.png), [send and attachment states](mac-composer-states-dark.png) | |
| +| iPhone conversation | [Clipped incoming text](../r4/iphone-conversation-dark.png) | [Unclipped text and web-style composer](iphone-conversation-dark.png) | |
| +| Primary and secondary actions | [Uniform purple actions](../r4/iphone-exploration-dark.png) | [One primary, quiet alternatives](iphone-exploration-dark.png) | |
| + |
| +The composer grows to six lines, then scrolls. Send appears for non-whitespace text or an attachment that has not failed. Sending clears the draft; uploads remain pending, and follow-ups can be queued while the coordinator thinks. On Mac, Enter sends and Shift+Enter inserts a line. The empty composer has no send control in the keyboard or accessibility order. |
| + |
| +The iPhone clipping came from applying a rounded clip directly to the incoming text. Only padded outgoing bubbles are clipped now. Incoming text keeps a small horizontal inset for glyph edges. |
| + |
| +## Button audit |
| + |
| +| Controls covered | R5 treatment | |
| +| --- | --- | |
| +| Conversation, task, Needs you, notification and menu-bar answers | Shared equal-width choice grid; neutral text and faces; stacked choices at large accessibility text sizes. Mac transcript choices also have equal widths. | |
| +| Build this / Keep exploring / Leave it here | Same size and shape; only Build this is prominent, as on the web. | |
| +| Open preview, Expand to answer, Continue without Copy, Mark urgent, Open Contra, Open Equipo | Consistent secondary controls. No added primary emphasis. | |
| +| Show the conversation | Quiet action with an explicit hit region. | |
| +| Task and team navigation, project picker, toolbar navigation | Native navigation controls remain quiet. Standalone links and Research disclosure have 44-point phone targets. | |
| +| Mac sidebar | Quiet selection rows, with no primary fill on ordinary actions. | |
| +| Composer +, send, attachment removal | Native controls with 44-point hit regions. The send arrow occupies a 32-point circle within its target. | |
| + |
| +SwiftUI uses standard bordered/bordered-prominent styles and ControlSize; AppKit uses standard control sizes and bezels, with SF Symbols for the composer icon buttons. The colors come from the web day theme, replacing r4's purple action styling. The web's decorative hairline borders remain subtle. Text clears 4.5:1; meaningful icons clear 3:1. The tested primary-label minimum is 5.26:1 and the placeholder minimum is 5.27:1. |
| + |
| +Measured capture checks enforce equal answer widths, at most one primary action per phone screen, a 44-point phone hit minimum and a 32-point Mac content-button minimum. macOS's standard large SwiftUI button initially measured 28 points, so its label now has enough height to meet 32. System-owned navigation and menu-bar chrome retain platform behavior. |
| + |
| +Source of truth: [composer template](../../../internal/equipo/templates/chat.html), [composer CSS](../../../internal/equipo/static/equipo.css), [composer behavior](../../../internal/equipo/static/chat-compose.js), [streaming send behavior](../../../internal/equipo/static/chat-stream.js), [attachments](../../../internal/equipo/static/chat-attach.js), and [web control tokens](../../../internal/equipo/static/theme.css). The current streaming composer stays editable during thinking; the older non-streaming submit lock was not copied into it. |
| + |
| +## Captures |
| + |
| +Every r4 capture has an r5 counterpart. There are 52 PNGs: all existing views, additional composer states and large text in both appearances. Phone images come from an iPhone 17 simulator running iOS 27.2; Mac images use the app's offscreen native-view capture. Xcode 27.2 built both targets. R4 remains unchanged. |
| + |
| +| View | Light | Dark | |
| +| --- | --- | --- | |
| +| Mac main window | [Light](mac-main-light.png) | [Dark](mac-main-dark.png) | |
| +| Mac menu bar | [Light](mac-menu-light.png) | [Dark](mac-menu-dark.png) | |
| +| Mac compact notification | [Light](mac-notification-compact-light.png) | [Dark](mac-notification-compact-dark.png) | |
| +| Mac expanded notification | [Light](mac-notification-light.png) | [Dark](mac-notification-dark.png) | |
| +| Mac answer receipt | [Light](mac-notification-answered-light.png) | [Dark](mac-notification-answered-dark.png) | |
| +| iPhone Teams | [Light](iphone-teams-light.png) | [Dark](iphone-teams-dark.png) | |
| +| iPhone team index | [Light](iphone-team-light.png) | [Dark](iphone-team-dark.png) | |
| +| iPhone conversation | [Light](iphone-conversation-light.png) | [Dark](iphone-conversation-dark.png) | |
| +| iPhone Tasks | [Light](iphone-tasks-light.png) | [Dark](iphone-tasks-dark.png) | |
| +| iPhone task | [Light](iphone-task-light.png) | [Dark](iphone-task-dark.png) | |
| +| iPhone Needs you | [Light](iphone-needs-light.png) | [Dark](iphone-needs-dark.png) | |
| +| iPhone compact notification | [Light](iphone-notification-compact-light.png) | [Dark](iphone-notification-compact-dark.png) | |
| +| iPhone expanded notification | [Light](iphone-notification-light.png) | [Dark](iphone-notification-dark.png) | |
| +| iPhone answer receipt | [Light](iphone-notification-answered-light.png) | [Dark](iphone-notification-answered-dark.png) | |
| +| iPhone Connections & Usage | [Light](iphone-connections-light.png) | [Dark](iphone-connections-dark.png) | |
| +| Exploration concept | [Light](iphone-exploration-light.png) | [Dark](iphone-exploration-dark.png) | |
| +| Research concept | [Light](iphone-research-light.png) | [Dark](iphone-research-dark.png) | |
| +| Usage concept | [Light](iphone-usage-concept-light.png) | [Dark](iphone-usage-concept-dark.png) | |
| +| Copy budget-hold concept | [Light](iphone-copy-hold-light.png) | [Dark](iphone-copy-hold-dark.png) | |
| +| Contra concept | [Light](iphone-contra-light.png) | [Dark](iphone-contra-dark.png) | |
| +| iPhone draft and send | [Light](iphone-conversation-draft-light.png) | [Dark](iphone-conversation-draft-dark.png) | |
| +| iPhone attachment | [Light](iphone-conversation-attachment-light.png) | [Dark](iphone-conversation-attachment-dark.png) | |
| +| iPhone uploading | [Light](iphone-conversation-uploading-light.png) | [Dark](iphone-conversation-uploading-dark.png) | |
| +| iPhone upload error | [Light](iphone-conversation-error-light.png) | [Dark](iphone-conversation-error-dark.png) | |
| +| Mac composer states and add menu | [Light](mac-composer-states-light.png) | [Dark](mac-composer-states-dark.png) | |
| +| iPhone large text | [Light](iphone-needs-accessibility-light.png) | [Dark](iphone-needs-accessibility-dark.png) | |
| + |
| +Run `bash scripts/studio.sh` only after syncing into `~/.cache/equipo-native-r4/build` on the Studio. The script builds both apps, verifies the AppKit composer, captures each appearance and checks rendered button measurements. Its simulator uses a private device set inside that scratch directory and is deleted on exit. API limitations and the web-led sync proposal remain as described in [r4](../r4/index.md) and the [sync proposal](../sync-proposal.md). |
diff --git a/docs/native/r5/iphone-connections-dark.png b/docs/native/r5/iphone-connections-dark.png| new file mode 100644 |
| index 00000000..1ba169ae |
| Binary files /dev/null and b/docs/native/r5/iphone-connections-dark.png differ |
diff --git a/docs/native/r5/iphone-connections-light.png b/docs/native/r5/iphone-connections-light.png| new file mode 100644 |
| index 00000000..3abbab4b |
| Binary files /dev/null and b/docs/native/r5/iphone-connections-light.png differ |
diff --git a/docs/native/r5/iphone-contra-dark.png b/docs/native/r5/iphone-contra-dark.png| new file mode 100644 |
| index 00000000..91c5cd30 |
| Binary files /dev/null and b/docs/native/r5/iphone-contra-dark.png differ |
diff --git a/docs/native/r5/iphone-contra-light.png b/docs/native/r5/iphone-contra-light.png| new file mode 100644 |
| index 00000000..1b22144f |
| Binary files /dev/null and b/docs/native/r5/iphone-contra-light.png differ |
diff --git a/docs/native/r5/iphone-conversation-attachment-dark.png b/docs/native/r5/iphone-conversation-attachment-dark.png| new file mode 100644 |
| index 00000000..db0b39ce |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-attachment-dark.png differ |
diff --git a/docs/native/r5/iphone-conversation-attachment-light.png b/docs/native/r5/iphone-conversation-attachment-light.png| new file mode 100644 |
| index 00000000..644709f2 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-attachment-light.png differ |
diff --git a/docs/native/r5/iphone-conversation-dark.png b/docs/native/r5/iphone-conversation-dark.png| new file mode 100644 |
| index 00000000..e86a9125 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-dark.png differ |
diff --git a/docs/native/r5/iphone-conversation-draft-dark.png b/docs/native/r5/iphone-conversation-draft-dark.png| new file mode 100644 |
| index 00000000..4fdba529 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-draft-dark.png differ |
diff --git a/docs/native/r5/iphone-conversation-draft-light.png b/docs/native/r5/iphone-conversation-draft-light.png| new file mode 100644 |
| index 00000000..14407cee |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-draft-light.png differ |
diff --git a/docs/native/r5/iphone-conversation-error-dark.png b/docs/native/r5/iphone-conversation-error-dark.png| new file mode 100644 |
| index 00000000..62015ac5 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-error-dark.png differ |
diff --git a/docs/native/r5/iphone-conversation-error-light.png b/docs/native/r5/iphone-conversation-error-light.png| new file mode 100644 |
| index 00000000..caebf9cb |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-error-light.png differ |
diff --git a/docs/native/r5/iphone-conversation-light.png b/docs/native/r5/iphone-conversation-light.png| new file mode 100644 |
| index 00000000..06835f54 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-light.png differ |
diff --git a/docs/native/r5/iphone-conversation-uploading-dark.png b/docs/native/r5/iphone-conversation-uploading-dark.png| new file mode 100644 |
| index 00000000..bd07eb33 |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-uploading-dark.png differ |
diff --git a/docs/native/r5/iphone-conversation-uploading-light.png b/docs/native/r5/iphone-conversation-uploading-light.png| new file mode 100644 |
| index 00000000..801cfdeb |
| Binary files /dev/null and b/docs/native/r5/iphone-conversation-uploading-light.png differ |
diff --git a/docs/native/r5/iphone-copy-hold-dark.png b/docs/native/r5/iphone-copy-hold-dark.png| new file mode 100644 |
| index 00000000..d0e0f92e |
| Binary files /dev/null and b/docs/native/r5/iphone-copy-hold-dark.png differ |
diff --git a/docs/native/r5/iphone-copy-hold-light.png b/docs/native/r5/iphone-copy-hold-light.png| new file mode 100644 |
| index 00000000..2ceb0367 |
| Binary files /dev/null and b/docs/native/r5/iphone-copy-hold-light.png differ |
diff --git a/docs/native/r5/iphone-exploration-dark.png b/docs/native/r5/iphone-exploration-dark.png| new file mode 100644 |
| index 00000000..3e1ce646 |
| Binary files /dev/null and b/docs/native/r5/iphone-exploration-dark.png differ |
diff --git a/docs/native/r5/iphone-exploration-light.png b/docs/native/r5/iphone-exploration-light.png| new file mode 100644 |
| index 00000000..d3bb2784 |
| Binary files /dev/null and b/docs/native/r5/iphone-exploration-light.png differ |
diff --git a/docs/native/r5/iphone-needs-accessibility-dark.png b/docs/native/r5/iphone-needs-accessibility-dark.png| new file mode 100644 |
| index 00000000..55dac2aa |
| Binary files /dev/null and b/docs/native/r5/iphone-needs-accessibility-dark.png differ |
diff --git a/docs/native/r5/iphone-needs-accessibility-light.png b/docs/native/r5/iphone-needs-accessibility-light.png| new file mode 100644 |
| index 00000000..8a6c67f8 |
| Binary files /dev/null and b/docs/native/r5/iphone-needs-accessibility-light.png differ |
diff --git a/docs/native/r5/iphone-needs-dark.png b/docs/native/r5/iphone-needs-dark.png| new file mode 100644 |
| index 00000000..55d40647 |
| Binary files /dev/null and b/docs/native/r5/iphone-needs-dark.png differ |
diff --git a/docs/native/r5/iphone-needs-light.png b/docs/native/r5/iphone-needs-light.png| new file mode 100644 |
| index 00000000..df24689e |
| Binary files /dev/null and b/docs/native/r5/iphone-needs-light.png differ |
diff --git a/docs/native/r5/iphone-notification-answered-dark.png b/docs/native/r5/iphone-notification-answered-dark.png| new file mode 100644 |
| index 00000000..28c9bbb8 |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-answered-dark.png differ |
diff --git a/docs/native/r5/iphone-notification-answered-light.png b/docs/native/r5/iphone-notification-answered-light.png| new file mode 100644 |
| index 00000000..e9ceb156 |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-answered-light.png differ |
diff --git a/docs/native/r5/iphone-notification-compact-dark.png b/docs/native/r5/iphone-notification-compact-dark.png| new file mode 100644 |
| index 00000000..0fba4dc5 |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-compact-dark.png differ |
diff --git a/docs/native/r5/iphone-notification-compact-light.png b/docs/native/r5/iphone-notification-compact-light.png| new file mode 100644 |
| index 00000000..71babbfd |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-compact-light.png differ |
diff --git a/docs/native/r5/iphone-notification-dark.png b/docs/native/r5/iphone-notification-dark.png| new file mode 100644 |
| index 00000000..9d3eca5d |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-dark.png differ |
diff --git a/docs/native/r5/iphone-notification-light.png b/docs/native/r5/iphone-notification-light.png| new file mode 100644 |
| index 00000000..8d752efe |
| Binary files /dev/null and b/docs/native/r5/iphone-notification-light.png differ |
diff --git a/docs/native/r5/iphone-research-dark.png b/docs/native/r5/iphone-research-dark.png| new file mode 100644 |
| index 00000000..941421e5 |
| Binary files /dev/null and b/docs/native/r5/iphone-research-dark.png differ |
diff --git a/docs/native/r5/iphone-research-light.png b/docs/native/r5/iphone-research-light.png| new file mode 100644 |
| index 00000000..ba141296 |
| Binary files /dev/null and b/docs/native/r5/iphone-research-light.png differ |
diff --git a/docs/native/r5/iphone-task-dark.png b/docs/native/r5/iphone-task-dark.png| new file mode 100644 |
| index 00000000..b56c3160 |
| Binary files /dev/null and b/docs/native/r5/iphone-task-dark.png differ |
diff --git a/docs/native/r5/iphone-task-light.png b/docs/native/r5/iphone-task-light.png| new file mode 100644 |
| index 00000000..6d1148bf |
| Binary files /dev/null and b/docs/native/r5/iphone-task-light.png differ |
diff --git a/docs/native/r5/iphone-tasks-dark.png b/docs/native/r5/iphone-tasks-dark.png| new file mode 100644 |
| index 00000000..80d37f0a |
| Binary files /dev/null and b/docs/native/r5/iphone-tasks-dark.png differ |
diff --git a/docs/native/r5/iphone-tasks-light.png b/docs/native/r5/iphone-tasks-light.png| new file mode 100644 |
| index 00000000..23b5ff2f |
| Binary files /dev/null and b/docs/native/r5/iphone-tasks-light.png differ |
diff --git a/docs/native/r5/iphone-team-dark.png b/docs/native/r5/iphone-team-dark.png| new file mode 100644 |
| index 00000000..409b0b51 |
| Binary files /dev/null and b/docs/native/r5/iphone-team-dark.png differ |
diff --git a/docs/native/r5/iphone-team-light.png b/docs/native/r5/iphone-team-light.png| new file mode 100644 |
| index 00000000..3f69c462 |
| Binary files /dev/null and b/docs/native/r5/iphone-team-light.png differ |
diff --git a/docs/native/r5/iphone-teams-dark.png b/docs/native/r5/iphone-teams-dark.png| new file mode 100644 |
| index 00000000..78aab5ea |
| Binary files /dev/null and b/docs/native/r5/iphone-teams-dark.png differ |
diff --git a/docs/native/r5/iphone-teams-light.png b/docs/native/r5/iphone-teams-light.png| new file mode 100644 |
| index 00000000..c0eff2df |
| Binary files /dev/null and b/docs/native/r5/iphone-teams-light.png differ |
diff --git a/docs/native/r5/iphone-usage-concept-dark.png b/docs/native/r5/iphone-usage-concept-dark.png| new file mode 100644 |
| index 00000000..10ef1b08 |
| Binary files /dev/null and b/docs/native/r5/iphone-usage-concept-dark.png differ |
diff --git a/docs/native/r5/iphone-usage-concept-light.png b/docs/native/r5/iphone-usage-concept-light.png| new file mode 100644 |
| index 00000000..0aa0081e |
| Binary files /dev/null and b/docs/native/r5/iphone-usage-concept-light.png differ |
diff --git a/docs/native/r5/mac-composer-states-dark.png b/docs/native/r5/mac-composer-states-dark.png| new file mode 100644 |
| index 00000000..1efdb915 |
| Binary files /dev/null and b/docs/native/r5/mac-composer-states-dark.png differ |
diff --git a/docs/native/r5/mac-composer-states-light.png b/docs/native/r5/mac-composer-states-light.png| new file mode 100644 |
| index 00000000..08ecbd96 |
| Binary files /dev/null and b/docs/native/r5/mac-composer-states-light.png differ |
diff --git a/docs/native/r5/mac-main-dark.png b/docs/native/r5/mac-main-dark.png| new file mode 100644 |
| index 00000000..e5c63f6c |
| Binary files /dev/null and b/docs/native/r5/mac-main-dark.png differ |
diff --git a/docs/native/r5/mac-main-light.png b/docs/native/r5/mac-main-light.png| new file mode 100644 |
| index 00000000..cb5aaf53 |
| Binary files /dev/null and b/docs/native/r5/mac-main-light.png differ |
diff --git a/docs/native/r5/mac-menu-dark.png b/docs/native/r5/mac-menu-dark.png| new file mode 100644 |
| index 00000000..4805a184 |
| Binary files /dev/null and b/docs/native/r5/mac-menu-dark.png differ |
diff --git a/docs/native/r5/mac-menu-light.png b/docs/native/r5/mac-menu-light.png| new file mode 100644 |
| index 00000000..6f99e936 |
| Binary files /dev/null and b/docs/native/r5/mac-menu-light.png differ |
diff --git a/docs/native/r5/mac-notification-answered-dark.png b/docs/native/r5/mac-notification-answered-dark.png| new file mode 100644 |
| index 00000000..a34bf890 |
| Binary files /dev/null and b/docs/native/r5/mac-notification-answered-dark.png differ |
diff --git a/docs/native/r5/mac-notification-answered-light.png b/docs/native/r5/mac-notification-answered-light.png| new file mode 100644 |
| index 00000000..188a02c2 |
| Binary files /dev/null and b/docs/native/r5/mac-notification-answered-light.png differ |
diff --git a/docs/native/r5/mac-notification-compact-dark.png b/docs/native/r5/mac-notification-compact-dark.png| new file mode 100644 |
| index 00000000..2edb4254 |
| Binary files /dev/null and b/docs/native/r5/mac-notification-compact-dark.png differ |
diff --git a/docs/native/r5/mac-notification-compact-light.png b/docs/native/r5/mac-notification-compact-light.png| new file mode 100644 |
| index 00000000..6d195fa4 |
| Binary files /dev/null and b/docs/native/r5/mac-notification-compact-light.png differ |
diff --git a/docs/native/r5/mac-notification-dark.png b/docs/native/r5/mac-notification-dark.png| new file mode 100644 |
| index 00000000..f0ba4a5d |
| Binary files /dev/null and b/docs/native/r5/mac-notification-dark.png differ |
diff --git a/docs/native/r5/mac-notification-light.png b/docs/native/r5/mac-notification-light.png| new file mode 100644 |
| index 00000000..c28faab1 |
| Binary files /dev/null and b/docs/native/r5/mac-notification-light.png differ |
diff --git a/native/mockups/.gitignore b/native/mockups/.gitignore| index 47951142..43633b95 100644 |
| --- a/native/mockups/.gitignore |
| +++ b/native/mockups/.gitignore |
| @@ -5,3 +5,6 @@ SourcePackages/ |
| Captures/ |
| *.xcuserstate |
| xcuserdata/ |
| +CoreTests/ |
| +SimulatorDevices/ |
| +*.log |
diff --git a/native/mockups/EquipoCore/Sources/EquipoCore/Composer.swift b/native/mockups/EquipoCore/Sources/EquipoCore/Composer.swift| new file mode 100644 |
| index 00000000..dd66b8bd |
| --- /dev/null |
| +++ b/native/mockups/EquipoCore/Sources/EquipoCore/Composer.swift |
| @@ -0,0 +1,55 @@ |
| +import Foundation |
| + |
| +public struct DraftAttachment: Identifiable, Equatable { |
| + public enum State: String { case uploading, ready, failed } |
| + public let id: UUID |
| + public var name: String |
| + public var state: State |
| + public init(name: String, state: State = .ready) { |
| + self.id = UUID(); self.name = name; self.state = state |
| + } |
| +} |
| +public struct PendingMessage { |
| + public let text: String |
| + public let attachments: [DraftAttachment] |
| + public let queued: Bool |
| + public var waitingForUploads: Bool { attachments.contains { $0.state == .uploading } } |
| +} |
| +public struct ComposerDraft { |
| + public var text: String |
| + public var attachments: [DraftAttachment] |
| + public var thinking = false |
| + public init(text: String = "", attachments: [DraftAttachment] = []) { |
| + self.text = text; self.attachments = attachments |
| + } |
| + public var canSend: Bool { |
| + !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || attachments.contains { $0.state != .failed } |
| + } |
| + public mutating func take() -> PendingMessage? { |
| + guard canSend else { return nil } |
| + let message = PendingMessage(text: text.trimmingCharacters(in: .whitespacesAndNewlines), attachments: attachments.filter { $0.state != .failed }, queued: thinking) |
| + text = ""; attachments = [] |
| + return message |
| + } |
| +} |
| + |
| +// Values transcribed from the web's theme.css and composer rules in equipo.css. |
| +public enum WebControls { |
| + public static let touchTarget = 44.0 |
| + public static let pointerTarget = 32.0 |
| + public static func text(_ dark: Bool) -> UInt32 { dark ? 0xEDEDF0 : 0x18181B } |
| + public static func face(_ dark: Bool) -> UInt32 { dark ? 0x141518 : 0xFFFFFF } |
| + public static func placeholder(_ dark: Bool) -> UInt32 { dark ? 0x8C8C96 : 0x6B6B75 } |
| + public static func primary(_ dark: Bool) -> UInt32 { dark ? 0x2F61E8 : 0x2257DF } |
| + public static func contrast(_ first: UInt32, _ second: UInt32) -> Double { |
| + func luminance(_ hex: UInt32) -> Double { |
| + let rgb = [16, 8, 0].map { shift -> Double in |
| + let value = Double((hex >> shift) & 255) / 255 |
| + return value <= 0.04045 ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4) |
| + } |
| + return rgb[0] * 0.2126 + rgb[1] * 0.7152 + rgb[2] * 0.0722 |
| + } |
| + let a = luminance(first), b = luminance(second) |
| + return (max(a, b) + 0.05) / (min(a, b) + 0.05) |
| + } |
| +} |
diff --git a/native/mockups/EquipoCore/Tests/EquipoCoreTests/ComposerTests.swift b/native/mockups/EquipoCore/Tests/EquipoCoreTests/ComposerTests.swift| new file mode 100644 |
| index 00000000..61e66e2b |
| --- /dev/null |
| +++ b/native/mockups/EquipoCore/Tests/EquipoCoreTests/ComposerTests.swift |
| @@ -0,0 +1,44 @@ |
| +import XCTest |
| +@testable import EquipoCore |
| + |
| +final class ComposerTests: XCTestCase { |
| + func testSendRequiresWordsOrUsableAttachment() { |
| + var draft = ComposerDraft() |
| + XCTAssertFalse(draft.canSend) |
| + draft.text = " \n " |
| + XCTAssertFalse(draft.canSend) |
| + draft.attachments = [DraftAttachment(name: "invoice.pdf", state: .failed)] |
| + XCTAssertFalse(draft.canSend) |
| + draft.attachments[0].state = .uploading |
| + XCTAssertTrue(draft.canSend) |
| + } |
| + func testSendClearsDraftAndKeepsNextMessageEditable() { |
| + var draft = ComposerDraft(text: " Check the invoice ") |
| + draft.thinking = true |
| + let sent = draft.take() |
| + XCTAssertEqual(sent?.text, "Check the invoice") |
| + XCTAssertEqual(sent?.queued, true) |
| + XCTAssertFalse(draft.canSend) |
| + draft.text = "Another detail" |
| + XCTAssertTrue(draft.canSend) |
| + } |
| + func testFailedAttachmentsAreNotSubmitted() { |
| + var draft = ComposerDraft(attachments: [DraftAttachment(name: "bad.pdf", state: .failed), DraftAttachment(name: "invoice.pdf", state: .ready)]) |
| + XCTAssertEqual(draft.take()?.attachments.map(\.name), ["invoice.pdf"]) |
| + XCTAssertTrue(draft.attachments.isEmpty) |
| + } |
| + func testUploadRemainsPendingBeforePosting() { |
| + var draft = ComposerDraft(attachments: [DraftAttachment(name: "invoice.pdf", state: .uploading)]) |
| + let message = draft.take() |
| + XCTAssertEqual(message?.waitingForUploads, true) |
| + } |
| + func testWebHitTargetsAndContrast() { |
| + XCTAssertEqual(WebControls.touchTarget, 44) |
| + XCTAssertGreaterThanOrEqual(WebControls.pointerTarget, 32) |
| + for dark in [false, true] { |
| + XCTAssertGreaterThanOrEqual(WebControls.contrast(WebControls.text(dark), WebControls.face(dark)), 4.5) |
| + XCTAssertGreaterThanOrEqual(WebControls.contrast(WebControls.placeholder(dark), WebControls.face(dark)), 4.5) |
| + XCTAssertGreaterThanOrEqual(WebControls.contrast(0xFFFFFF, WebControls.primary(dark)), 4.5) |
| + } |
| + } |
| +} |
diff --git a/native/mockups/EquipoMockups.xcodeproj/project.pbxproj b/native/mockups/EquipoMockups.xcodeproj/project.pbxproj| index 5f4c1982..9cd6b5c1 100644 |
| --- a/native/mockups/EquipoMockups.xcodeproj/project.pbxproj |
| +++ b/native/mockups/EquipoMockups.xcodeproj/project.pbxproj |
| @@ -12,6 +12,12 @@ |
| "path" = "Shared/Components.swift"; |
| "sourceTree" = "<group>"; |
| }; |
| +"3319F20BF681E39D436EDC7B" = { |
| +"isa" = "PBXFileReference"; |
| +"lastKnownFileType" = "sourcecode.swift"; |
| +"path" = "Shared/Controls.swift"; |
| +"sourceTree" = "<group>"; |
| +}; |
| "4C88AE69E2BF7A63C18FC8DC" = { |
| "isa" = "PBXFileReference"; |
| "lastKnownFileType" = "sourcecode.swift"; |
| @@ -24,6 +30,18 @@ |
| "path" = "iOS/EquipoPhoneApp.swift"; |
| "sourceTree" = "<group>"; |
| }; |
| +"020BE231A412CB119E1E74E2" = { |
| +"isa" = "PBXFileReference"; |
| +"lastKnownFileType" = "sourcecode.swift"; |
| +"path" = "iOS/PhoneComposer.swift"; |
| +"sourceTree" = "<group>"; |
| +}; |
| +"E8CB03EBFAA1DFCF0BED4217" = { |
| +"isa" = "PBXFileReference"; |
| +"lastKnownFileType" = "sourcecode.swift"; |
| +"path" = "Mac/ComposerVerification.swift"; |
| +"sourceTree" = "<group>"; |
| +}; |
| "310624EC755027929E86A63C" = { |
| "isa" = "PBXFileReference"; |
| "lastKnownFileType" = "sourcecode.swift"; |
| @@ -36,6 +54,12 @@ |
| "path" = "Mac/MacPanels.swift"; |
| "sourceTree" = "<group>"; |
| }; |
| +"7A0ED739212444D1C1406197" = { |
| +"isa" = "PBXFileReference"; |
| +"lastKnownFileType" = "sourcecode.swift"; |
| +"path" = "Mac/NativeComposer.swift"; |
| +"sourceTree" = "<group>"; |
| +}; |
| "8AD34A7A0B76F4C31697F39A" = { |
| "isa" = "PBXFileReference"; |
| "lastKnownFileType" = "sourcecode.swift"; |
| @@ -65,6 +89,10 @@ |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "9A32F360C8C381165C453B09"; |
| }; |
| +"DC5FECF8FD1FF144FFD93F77" = { |
| +"isa" = "PBXBuildFile"; |
| +"fileRef" = "3319F20BF681E39D436EDC7B"; |
| +}; |
| "6343DE7DFCD06C16BAC44A8C" = { |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "4C88AE69E2BF7A63C18FC8DC"; |
| @@ -73,10 +101,14 @@ |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "77D3D48B196F4CA8E45B435F"; |
| }; |
| +"0CC7A79F58EEDFC73C0DC724" = { |
| +"isa" = "PBXBuildFile"; |
| +"fileRef" = "020BE231A412CB119E1E74E2"; |
| +}; |
| "C25567FF6C745D91FC82DCAA" = { |
| "isa" = "PBXSourcesBuildPhase"; |
| "buildActionMask" = 2147483647; |
| -"files" = ("3B681A9FC64AB7C81A713615", "6343DE7DFCD06C16BAC44A8C", "BD7FFD04441E90C1615CB9FF"); |
| +"files" = ("3B681A9FC64AB7C81A713615", "DC5FECF8FD1FF144FFD93F77", "6343DE7DFCD06C16BAC44A8C", "BD7FFD04441E90C1615CB9FF", "0CC7A79F58EEDFC73C0DC724"); |
| "runOnlyForDeploymentPostprocessing" = 0; |
| }; |
| "B5240689BD1A36088B8B12CF" = { |
| @@ -100,9 +132,9 @@ |
| "GENERATE_INFOPLIST_FILE" = "YES"; |
| "CODE_SIGNING_ALLOWED" = "NO"; |
| "SDKROOT" = "iphoneos"; |
| -"MARKETING_VERSION" = "0.4"; |
| -"CURRENT_PROJECT_VERSION" = "4"; |
| -"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R4"; |
| +"MARKETING_VERSION" = "0.5"; |
| +"CURRENT_PROJECT_VERSION" = "5"; |
| +"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R5"; |
| "ENABLE_USER_SCRIPT_SANDBOXING" = "YES"; |
| "IPHONEOS_DEPLOYMENT_TARGET" = "17.0"; |
| "TARGETED_DEVICE_FAMILY" = "1"; |
| @@ -124,9 +156,9 @@ |
| "GENERATE_INFOPLIST_FILE" = "YES"; |
| "CODE_SIGNING_ALLOWED" = "NO"; |
| "SDKROOT" = "iphoneos"; |
| -"MARKETING_VERSION" = "0.4"; |
| -"CURRENT_PROJECT_VERSION" = "4"; |
| -"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R4"; |
| +"MARKETING_VERSION" = "0.5"; |
| +"CURRENT_PROJECT_VERSION" = "5"; |
| +"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R5"; |
| "ENABLE_USER_SCRIPT_SANDBOXING" = "YES"; |
| "IPHONEOS_DEPLOYMENT_TARGET" = "17.0"; |
| "TARGETED_DEVICE_FAMILY" = "1"; |
| @@ -176,10 +208,18 @@ |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "9A32F360C8C381165C453B09"; |
| }; |
| +"876CE2DA62D1E42CE9C74556" = { |
| +"isa" = "PBXBuildFile"; |
| +"fileRef" = "3319F20BF681E39D436EDC7B"; |
| +}; |
| "157DBD90D3BA7E416FDF7DF2" = { |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "4C88AE69E2BF7A63C18FC8DC"; |
| }; |
| +"271BD9F5A481364BCDB2DA7B" = { |
| +"isa" = "PBXBuildFile"; |
| +"fileRef" = "E8CB03EBFAA1DFCF0BED4217"; |
| +}; |
| "84B5E38A4644C046B498A36D" = { |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "310624EC755027929E86A63C"; |
| @@ -188,6 +228,10 @@ |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "0BF32EF05DC119C2AF6FDCF2"; |
| }; |
| +"1F4D89A8682A68FCCF1A209B" = { |
| +"isa" = "PBXBuildFile"; |
| +"fileRef" = "7A0ED739212444D1C1406197"; |
| +}; |
| "9CF224D8099DAEA88A7879D8" = { |
| "isa" = "PBXBuildFile"; |
| "fileRef" = "8AD34A7A0B76F4C31697F39A"; |
| @@ -195,7 +239,7 @@ |
| "970DDFB7275054EB69197FD9" = { |
| "isa" = "PBXSourcesBuildPhase"; |
| "buildActionMask" = 2147483647; |
| -"files" = ("9EC2DCD4EF73C1F55E3711A4", "157DBD90D3BA7E416FDF7DF2", "84B5E38A4644C046B498A36D", "6528FBE13898B654F6FA2B99", "9CF224D8099DAEA88A7879D8"); |
| +"files" = ("9EC2DCD4EF73C1F55E3711A4", "876CE2DA62D1E42CE9C74556", "157DBD90D3BA7E416FDF7DF2", "271BD9F5A481364BCDB2DA7B", "84B5E38A4644C046B498A36D", "6528FBE13898B654F6FA2B99", "1F4D89A8682A68FCCF1A209B", "9CF224D8099DAEA88A7879D8"); |
| "runOnlyForDeploymentPostprocessing" = 0; |
| }; |
| "FC5C63BDA68734DFDE79CC76" = { |
| @@ -219,9 +263,9 @@ |
| "GENERATE_INFOPLIST_FILE" = "YES"; |
| "CODE_SIGNING_ALLOWED" = "NO"; |
| "SDKROOT" = "macosx"; |
| -"MARKETING_VERSION" = "0.4"; |
| -"CURRENT_PROJECT_VERSION" = "4"; |
| -"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R4"; |
| +"MARKETING_VERSION" = "0.5"; |
| +"CURRENT_PROJECT_VERSION" = "5"; |
| +"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R5"; |
| "ENABLE_USER_SCRIPT_SANDBOXING" = "YES"; |
| "MACOSX_DEPLOYMENT_TARGET" = "14.0"; |
| "SUPPORTED_PLATFORMS" = "macosx"; |
| @@ -239,9 +283,9 @@ |
| "GENERATE_INFOPLIST_FILE" = "YES"; |
| "CODE_SIGNING_ALLOWED" = "NO"; |
| "SDKROOT" = "macosx"; |
| -"MARKETING_VERSION" = "0.4"; |
| -"CURRENT_PROJECT_VERSION" = "4"; |
| -"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R4"; |
| +"MARKETING_VERSION" = "0.5"; |
| +"CURRENT_PROJECT_VERSION" = "5"; |
| +"INFOPLIST_KEY_CFBundleDisplayName" = "Equipo R5"; |
| "ENABLE_USER_SCRIPT_SANDBOXING" = "YES"; |
| "MACOSX_DEPLOYMENT_TARGET" = "14.0"; |
| "SUPPORTED_PLATFORMS" = "macosx"; |
| @@ -276,7 +320,7 @@ |
| }; |
| "325F10A6957A34D66CB8C0E4" = { |
| "isa" = "PBXGroup"; |
| -"children" = ("9A32F360C8C381165C453B09", "4C88AE69E2BF7A63C18FC8DC", "77D3D48B196F4CA8E45B435F", "310624EC755027929E86A63C", "0BF32EF05DC119C2AF6FDCF2", "8AD34A7A0B76F4C31697F39A", "FBDC4F23F93125BBEEAE800C"); |
| +"children" = ("9A32F360C8C381165C453B09", "3319F20BF681E39D436EDC7B", "4C88AE69E2BF7A63C18FC8DC", "77D3D48B196F4CA8E45B435F", "020BE231A412CB119E1E74E2", "E8CB03EBFAA1DFCF0BED4217", "310624EC755027929E86A63C", "0BF32EF05DC119C2AF6FDCF2", "7A0ED739212444D1C1406197", "8AD34A7A0B76F4C31697F39A", "FBDC4F23F93125BBEEAE800C"); |
| "sourceTree" = "<group>"; |
| }; |
| "89E1FD6268CC0F221A2BE178" = { |
diff --git a/native/mockups/Mac/ComposerVerification.swift b/native/mockups/Mac/ComposerVerification.swift| new file mode 100644 |
| index 00000000..bc8737b8 |
| --- /dev/null |
| +++ b/native/mockups/Mac/ComposerVerification.swift |
| @@ -0,0 +1,80 @@ |
| +import AppKit |
| +import EquipoCore |
| + |
| +extension EquipoMacApp { |
| + func verifyComposer() { |
| + let window = NSWindow(contentRect: NSRect(x: -20000, y: -20000, width: 680, height: 360), styleMask: .borderless, backing: .buffered, defer: false) |
| + let composer = NativeComposer() |
| + window.contentView = composer |
| + composer.frame = NSRect(x: 0, y: 0, width: 680, height: 360) |
| + composer.layoutSubtreeIfNeeded() |
| + precondition(composer.send.isHidden, "Empty draft exposed send") |
| + precondition(composer.plus.frame.size == NSSize(width: 44, height: 44), "Plus target") |
| + precondition(composer.desiredHeight == 44, "Empty height: \(composer.desiredHeight)") |
| + composer.setText(" \n ") |
| + precondition(composer.send.isHidden, "Whitespace exposed send") |
| + composer.setText("Check the invoice") |
| + precondition(!composer.send.isHidden, "Text did not expose send") |
| + precondition(composer.send.frame.size == NSSize(width: 44, height: 44), "Send target") |
| + var received: [PendingMessage] = [] |
| + composer.onSend = { received.append($0) } |
| + composer.draft.thinking = true |
| + precondition(composer.editor.isEditable, "Thinking locked the editor") |
| + composer.send.performClick(nil) |
| + precondition(received.count == 1 && received[0].queued && composer.editor.string.isEmpty && composer.send.isHidden, "Send did not clear and queue") |
| + composer.addAttachment("invoice.pdf", state: .failed) |
| + precondition(composer.send.isHidden, "Failed upload exposed send") |
| + let remove = composer.chips.subviews[0].subviews.compactMap { $0 as? NSButton }.first! |
| + precondition(remove.frame.width >= 44 && remove.frame.height >= 44, "Attachment remove target") |
| + remove.performClick(nil) |
| + precondition(composer.draft.attachments.isEmpty, "Remove did not remove attachment") |
| + composer.addAttachment("invoice.pdf", state: .uploading) |
| + precondition(!composer.send.isHidden, "Uploading file did not expose send") |
| + composer.submit() |
| + precondition(received.last?.attachments.count == 1 && composer.draft.attachments.isEmpty, "Attachment transfer failed") |
| + composer.configure("multiline") |
| + precondition(composer.desiredHeight > 44 && composer.desiredHeight <= 164, "Field did not grow to six lines") |
| + precondition(composer.textScroll.hasVerticalScroller, "Seventh line does not scroll") |
| + composer.setText("Keyboard send") |
| + let enter = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: [], timestamp: 0, windowNumber: window.windowNumber, context: nil, characters: "\r", charactersIgnoringModifiers: "\r", isARepeat: false, keyCode: 36)! |
| + composer.editor.keyDown(with: enter) |
| + precondition(received.last?.text == "Keyboard send", "Return did not send") |
| + composer.setText("Keyboard newline") |
| + window.makeFirstResponder(composer.editor) |
| + composer.editor.setSelectedRange(NSRange(location: composer.editor.string.utf16.count, length: 0)) |
| + let shiftEnter = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: .shift, timestamp: 0, windowNumber: window.windowNumber, context: nil, characters: "\r", charactersIgnoringModifiers: "\r", isARepeat: false, keyCode: 36)! |
| + composer.editor.keyDown(with: shiftEnter) |
| + precondition(composer.editor.string.contains("\n"), "Shift Return did not insert newline") |
| + let conversation = NativeTranscript(store: store) |
| + precondition(conversation.composer.draft.thinking, "Conversation activity did not queue follow-ups") |
| + window.contentView = nil |
| + print("AppKit composer: 18 interaction and layout checks passed") |
| + } |
| +} |
| + |
| +final class ComposerGallery: NSView { |
| + override var isFlipped: Bool { true } |
| + init() { |
| + super.init(frame: NSRect(x: 0, y: 0, width: 820, height: 1380)) |
| + var y: CGFloat = 26 |
| + for (title, state) in [("Empty", ""), ("Text: send appears", "text"), ("Six lines, then scroll", "multiline"), ("Attachment ready", "attachment"), ("Uploading: send waits for the file", "uploading"), ("Failed upload: no send without words", "error"), ("Thinking: another message can be queued", "thinking"), ("Posting: the next draft stays editable", "sending")] { |
| + let label = NSTextField(labelWithString: title) |
| + label.font = .systemFont(ofSize: 13, weight: .semibold); label.textColor = .webText |
| + label.frame = NSRect(x: 28, y: y, width: 760, height: 22); addSubview(label) |
| + y += 32 |
| + let composer = NativeComposer() |
| + composer.frame = NSRect(x: 28, y: y, width: 764, height: 44) |
| + addSubview(composer) |
| + composer.configure(state); composer.layoutSubtreeIfNeeded() |
| + composer.frame.size.height = composer.desiredHeight |
| + y += composer.desiredHeight + 28 |
| + } |
| + let menuOwner = NativeComposer() |
| + let menu = menuOwner.attachmentMenuContent() |
| + menu.frame = NSRect(x: 28, y: y, width: 220, height: 104) |
| + addSubview(menu) |
| + frame.size.height = y + 130 |
| + } |
| + required init?(coder: NSCoder) { fatalError() } |
| + override func draw(_ dirtyRect: NSRect) { NSColor.webBackground.setFill(); bounds.fill() } |
| +} |
diff --git a/native/mockups/Mac/EquipoMacApp.swift b/native/mockups/Mac/EquipoMacApp.swift| index d04e9c3b..e3408f4b 100644 |
| --- a/native/mockups/Mac/EquipoMacApp.swift |
| +++ b/native/mockups/Mac/EquipoMacApp.swift |
| @@ -40,6 +40,11 @@ final class EquipoMacApp: NSObject, NSApplicationDelegate { |
| } |
| func applicationDidFinishLaunching(_ notification: Notification) { |
| let args = ProcessInfo.processInfo.arguments |
| + if args.contains("--verify") { |
| + NSApp.setActivationPolicy(.prohibited) |
| + DispatchQueue.main.async { self.verifyComposer(); NSApp.terminate(nil) } |
| + return |
| + } |
| if let i = args.firstIndex(of: "--snapshots"), args.indices.contains(i + 1) { |
| NSApp.setActivationPolicy(.prohibited) |
| DispatchQueue.main.async { self.snapshots(to: args[i + 1]); NSApp.terminate(nil) } |
| @@ -80,6 +85,8 @@ final class EquipoMacApp: NSObject, NSApplicationDelegate { |
| let appearance = NSAppearance(named: dark ? .darkAqua : .aqua)! |
| NSApp.appearance = appearance |
| let theme = dark ? "dark" : "light" |
| + let gallery = ComposerGallery() |
| + capture(gallery, size: gallery.frame.size, appearance: appearance, path: directory + "/mac-composer-states-\(theme).png") |
| capture(MainContent(store: store), size: NSSize(width: 1400, height: 900), appearance: appearance, path: directory + "/mac-main-\(theme).png") |
| capture(host(rootView: MenuBarPanel(store: store)), size: NSSize(width: 410, height: 520), appearance: appearance, path: directory + "/mac-menu-\(theme).png") |
| capture(host(rootView: NotificationAnswerView(store: store, answer: nil, compact: true)), size: NSSize(width: 440, height: 570), appearance: appearance, path: directory + "/mac-notification-compact-\(theme).png") |
diff --git a/native/mockups/Mac/MacPanels.swift b/native/mockups/Mac/MacPanels.swift| index d3ecbbf4..7479bf88 100644 |
| --- a/native/mockups/Mac/MacPanels.swift |
| +++ b/native/mockups/Mac/MacPanels.swift |
| @@ -88,7 +88,7 @@ struct MenuBarPanel: View { |
| QuestionCard(question: store.question, answer: $answer) |
| Divider() |
| HStack { Text("2 tasks in progress").foregroundStyle(Palette.secondary); Spacer(); Image(systemName: "arrow.up.right") }.font(.subheadline) |
| - Button("Open Equipo") { NSApp.windows.first(where: { $0.title == "Equipo" })?.makeKeyAndOrderFront(nil) }.buttonStyle(.bordered) |
| + EquipoButton(title: "Open Equipo") { NSApp.windows.first(where: { $0.title == "Equipo" })?.makeKeyAndOrderFront(nil) } |
| Spacer(minLength: 0) |
| }.padding(22).background(Palette.background).tint(Palette.accent) |
| } |
diff --git a/native/mockups/Mac/NativeComposer.swift b/native/mockups/Mac/NativeComposer.swift| new file mode 100644 |
| index 00000000..3e85c2e4 |
| --- /dev/null |
| +++ b/native/mockups/Mac/NativeComposer.swift |
| @@ -0,0 +1,220 @@ |
| +import AppKit |
| +import EquipoCore |
| + |
| +extension NSColor { |
| + static func web(_ light: UInt32, _ dark: UInt32) -> NSColor { |
| + NSColor(name: nil) { appearance in |
| + let value = appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua ? dark : light |
| + return NSColor(srgbRed: Double((value >> 16) & 255) / 255, green: Double((value >> 8) & 255) / 255, blue: Double(value & 255) / 255, alpha: 1) |
| + } |
| + } |
| + static let webText = web(WebControls.text(false), WebControls.text(true)) |
| + static let webFace = web(WebControls.face(false), WebControls.face(true)) |
| + static let webPlaceholder = web(WebControls.placeholder(false), WebControls.placeholder(true)) |
| + static let webPrimary = web(WebControls.primary(false), WebControls.primary(true)) |
| + static let webBorder = web(0xD0D4DC, 0x343843) |
| + static let webBackground = web(0xFBFBFC, 0x0C0D0F) |
| +} |
| + |
| +final class ComposerEditor: NSTextView { |
| + var onSubmit: (() -> Void)? |
| + override func draw(_ dirtyRect: NSRect) { |
| + super.draw(dirtyRect) |
| + if string.isEmpty { |
| + ("Message" as NSString).draw(at: NSPoint(x: 18, y: 1), withAttributes: [.font: NSFont.systemFont(ofSize: 16), .foregroundColor: NSColor.webPlaceholder]) |
| + } |
| + } |
| + override func didChangeText() { super.didChangeText(); needsDisplay = true } |
| + override func keyDown(with event: NSEvent) { |
| + if (event.keyCode == 36 || event.keyCode == 76) && !event.modifierFlags.contains(.shift) && !hasMarkedText() { |
| + onSubmit?() |
| + } else { super.keyDown(with: event) } |
| + } |
| +} |
| +final class ComposerPill: NSView { |
| + override var isFlipped: Bool { true } |
| + override func draw(_ dirtyRect: NSRect) { |
| + let path = NSBezierPath(roundedRect: bounds.insetBy(dx: 0.5, dy: 0.5), xRadius: 22, yRadius: 22) |
| + NSColor.webFace.setFill(); path.fill() |
| + let focused = window?.firstResponder is ComposerEditor |
| + (focused ? NSColor.webBorder.blended(withFraction: 0.10, of: .webText)! : NSColor.webBorder).setStroke() |
| + path.lineWidth = 1; path.stroke() |
| + } |
| +} |
| +final class NativeComposer: NSView, NSTextViewDelegate { |
| + override var isFlipped: Bool { true } |
| + let editor = ComposerEditor() |
| + let plus = ActionButton("") {} |
| + let send = ActionButton("") {} |
| + let pill = ComposerPill() |
| + let textScroll = NSScrollView() |
| + let chips = FlippedView() |
| + var draft = ComposerDraft() |
| + var onSend: ((PendingMessage) -> Void)? |
| + var onHeightChange: (() -> Void)? |
| + private var popover: NSPopover? |
| + private(set) var desiredHeight: CGFloat = 44 |
| + private var updating = false |
| + init() { |
| + super.init(frame: .zero) |
| + addSubview(plus); addSubview(pill) |
| + pill.addSubview(chips); pill.addSubview(textScroll); pill.addSubview(send) |
| + textScroll.documentView = editor |
| + textScroll.drawsBackground = false |
| + textScroll.hasVerticalScroller = false |
| + textScroll.borderType = .noBorder |
| + editor.isRichText = false; editor.drawsBackground = false |
| + editor.font = .systemFont(ofSize: 16) |
| + editor.textColor = .webText |
| + editor.insertionPointColor = .webText |
| + editor.textContainerInset = NSSize(width: 18, height: 0) |
| + editor.textContainer?.lineFragmentPadding = 0 |
| + editor.isVerticallyResizable = true |
| + editor.isHorizontallyResizable = false |
| + editor.textContainer?.widthTracksTextView = true |
| + editor.delegate = self |
| + let paragraph = NSMutableParagraphStyle() |
| + paragraph.minimumLineHeight = 24; paragraph.maximumLineHeight = 24 |
| + editor.defaultParagraphStyle = paragraph |
| + editor.typingAttributes = [.font: NSFont.systemFont(ofSize: 16), .paragraphStyle: paragraph, .foregroundColor: NSColor.webText] |
| + editor.setAccessibilityLabel("Message") |
| + plus.bezelStyle = .circular; plus.controlSize = .large |
| + plus.image = NSImage(systemSymbolName: "plus", accessibilityDescription: "Add attachment") |
| + plus.imagePosition = .imageOnly; plus.contentTintColor = .webPlaceholder |
| + plus.setAccessibilityLabel("Add attachment") |
| + plus.actionBlock = { [weak self] in self?.showMenu() } |
| + send.bezelStyle = .circular; send.controlSize = .large |
| + send.isBordered = false |
| + let sendConfiguration = NSImage.SymbolConfiguration(paletteColors: [.white, .webPrimary]).applying(NSImage.SymbolConfiguration(pointSize: 32, weight: .regular)) |
| + send.image = NSImage(systemSymbolName: "arrow.up.circle.fill", accessibilityDescription: "Send")?.withSymbolConfiguration(sendConfiguration) |
| + send.imageScaling = .scaleNone |
| + send.imagePosition = .imageOnly |
| + send.setAccessibilityLabel("Send") |
| + send.actionBlock = { [weak self] in self?.submit() } |
| + editor.onSubmit = { [weak self] in self?.submit() } |
| + refresh() |
| + } |
| + required init?(coder: NSCoder) { fatalError() } |
| + func textDidChange(_ notification: Notification) { |
| + draft.text = editor.string |
| + refresh() |
| + } |
| + func textDidBeginEditing(_ notification: Notification) { pill.needsDisplay = true } |
| + func textDidEndEditing(_ notification: Notification) { pill.needsDisplay = true } |
| + func setText(_ text: String) { |
| + draft.text = text; editor.string = text; editor.needsDisplay = true; refresh() |
| + } |
| + func submit() { |
| + guard let message = draft.take() else { return } |
| + editor.string = ""; editor.needsDisplay = true |
| + rebuildChips(); refresh(); onSend?(message) |
| + window?.makeFirstResponder(editor) |
| + } |
| + func addAttachment(_ name: String, state: DraftAttachment.State = .ready) { |
| + guard draft.attachments.count < 5 else { return } |
| + draft.attachments.append(DraftAttachment(name: name, state: state)) |
| + popover?.close(); rebuildChips(); refresh() |
| + } |
| + func attachmentMenuContent() -> NSView { |
| + let view = FlippedView(frame: NSRect(x: 0, y: 0, width: 220, height: 104)) |
| + for (index, item) in [("Photo or image", "photo"), ("File", "doc")].enumerated() { |
| + let button = ActionButton(item.0) { [weak self] in self?.addAttachment(index == 0 ? "preview.png" : "invoice.pdf") } |
| + button.bezelStyle = .smallSquare; button.controlSize = .large |
| + button.attributedTitle = NSAttributedString(string: item.0, attributes: [.font: NSFont.systemFont(ofSize: 14), .foregroundColor: NSColor.webText]) |
| + button.alignment = .left |
| + button.image = NSImage(systemSymbolName: item.1, accessibilityDescription: nil) |
| + button.imagePosition = .imageLeading |
| + button.frame = NSRect(x: 8, y: 8 + index * 44, width: 204, height: 44) |
| + view.addSubview(button) |
| + } |
| + return view |
| + } |
| + func showMenu() { |
| + let controller = NSViewController(); controller.view = attachmentMenuContent() |
| + let menu = NSPopover(); menu.behavior = .transient |
| + menu.contentViewController = controller; menu.contentSize = NSSize(width: 220, height: 104) |
| + popover = menu; menu.show(relativeTo: plus.bounds, of: plus, preferredEdge: .minY) |
| + } |
| + func configure(_ state: String) { |
| + switch state { |
| + case "text": setText("Can you check this invoice?") |
| + case "multiline": setText("Check the VAT calculation.\nKeep the invoice wording.\nCompare the tax totals.\nRun the invoice tests.\nReview the PDF layout.\nThen show me the result.\nThis seventh line scrolls.") |
| + case "attachment": addAttachment("invoice.pdf"); setText("Check this invoice.") |
| + case "uploading": addAttachment("invoice.pdf", state: .uploading) |
| + case "error": addAttachment("invoice.pdf", state: .failed) |
| + case "thinking": draft.thinking = true; setText("One more detail for the invoice.") |
| + default: break |
| + } |
| + } |
| + func refresh() { |
| + send.isHidden = !draft.canSend |
| + needsLayout = true |
| + layoutSubtreeIfNeeded() |
| + } |
| + override func layout() { |
| + super.layout() |
| + guard !updating, bounds.width > 80 else { return } |
| + updating = true |
| + let pillWidth = bounds.width - 56 |
| + let editorWidth = pillWidth - 44 |
| + editor.frame.size.width = editorWidth |
| + editor.textContainer?.containerSize = NSSize(width: max(1, editorWidth - 36), height: .greatestFiniteMagnitude) |
| + editor.layoutManager?.ensureLayout(for: editor.textContainer!) |
| + let used = editor.layoutManager?.usedRect(for: editor.textContainer!).height ?? 24 |
| + let contentHeight = max(24, ceil(used)) |
| + let textHeight = min(164, contentHeight + 20) |
| + let columns = max(1, Int((pillWidth - 24) / 220)) |
| + let rows = Int(ceil(Double(draft.attachments.count) / Double(columns))) |
| + let chipHeight: CGFloat = rows == 0 ? 0 : CGFloat(rows) * 72 + 8 |
| + let height = textHeight + chipHeight |
| + plus.frame = NSRect(x: 0, y: height - 44, width: 44, height: 44) |
| + pill.frame = NSRect(x: 56, y: 0, width: pillWidth, height: height) |
| + chips.frame = NSRect(x: 12, y: 12, width: pillWidth - 24, height: max(0, chipHeight - 20)) |
| + textScroll.frame = NSRect(x: 0, y: chipHeight + 10, width: editorWidth, height: textHeight - 20) |
| + editor.frame.size = NSSize(width: editorWidth, height: contentHeight) |
| + textScroll.hasVerticalScroller = contentHeight > 144 |
| + send.frame = NSRect(x: pillWidth - 44, y: height - 44, width: 44, height: 44) |
| + chips.subviews.enumerated().forEach { index, chip in chip.frame = NSRect(x: CGFloat(index % columns) * 220, y: CGFloat(index / columns) * 72, width: min(208, pillWidth - 24), height: 60) } |
| + let changed = desiredHeight != height |
| + desiredHeight = height |
| + updating = false |
| + if changed { onHeightChange?() } |
| + } |
| + private func rebuildChips() { |
| + chips.subviews.forEach { $0.removeFromSuperview() } |
| + for attachment in draft.attachments { |
| + let chip = AttachmentChipView(failed: attachment.state == .failed) |
| + let label = NSTextField(labelWithString: attachment.name) |
| + label.font = .systemFont(ofSize: 13); label.textColor = .webText |
| + label.frame = NSRect(x: 12, y: 8, width: 148, height: 18) |
| + chip.addSubview(label) |
| + let note = NSTextField(labelWithString: attachment.state == .failed ? "Could not upload. Try again." : attachment.state == .uploading ? "Uploading…" : "PDF · 24 KB") |
| + note.font = .systemFont(ofSize: 11); note.textColor = attachment.state == .failed ? .web(0xB91C1C, 0xF79AA0) : .webPlaceholder |
| + note.frame = NSRect(x: 12, y: 29, width: 170, height: 17); chip.addSubview(note) |
| + let remove = ActionButton("") { [weak self] in |
| + self?.draft.attachments.removeAll { $0.id == attachment.id }; self?.rebuildChips(); self?.refresh() |
| + } |
| + remove.bezelStyle = .circular; remove.controlSize = .large; remove.isBordered = false |
| + remove.image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "Remove \(attachment.name)")?.withSymbolConfiguration(NSImage.SymbolConfiguration(pointSize: 12, weight: .medium)) |
| + remove.imagePosition = .imageOnly; remove.setAccessibilityLabel("Remove \(attachment.name)") |
| + remove.frame = NSRect(x: 164, y: 0, width: 44, height: 44); chip.addSubview(remove) |
| + if attachment.state == .uploading { |
| + let progress = NSProgressIndicator(frame: NSRect(x: 12, y: 51, width: 184, height: 4)) |
| + progress.isIndeterminate = false; progress.doubleValue = 45; chip.addSubview(progress) |
| + } |
| + chips.addSubview(chip) |
| + } |
| + } |
| +} |
| + |
| +final class AttachmentChipView: NSView { |
| + override var isFlipped: Bool { true } |
| + let failed: Bool |
| + init(failed: Bool) { self.failed = failed; super.init(frame: .zero) } |
| + required init?(coder: NSCoder) { fatalError() } |
| + override func draw(_ dirtyRect: NSRect) { |
| + let path = NSBezierPath(roundedRect: bounds.insetBy(dx: 0.5, dy: 0.5), xRadius: 10, yRadius: 10) |
| + (failed ? NSColor.web(0xFEE2E2, 0x331819) : NSColor.web(0xF3F3F5, 0x18191D)).setFill(); path.fill() |
| + NSColor.webBorder.setStroke(); path.lineWidth = 1; path.stroke() |
| + } |
| +} |
diff --git a/native/mockups/Mac/NativeTranscript.swift b/native/mockups/Mac/NativeTranscript.swift| index c78030a5..ae2d5e9d 100644 |
| --- a/native/mockups/Mac/NativeTranscript.swift |
| +++ b/native/mockups/Mac/NativeTranscript.swift |
| @@ -7,7 +7,10 @@ final class ActionButton: NSButton { |
| super.init(frame: .zero) |
| self.title = title |
| self.actionBlock = action |
| - bezelStyle = .rounded |
| + bezelStyle = .smallSquare |
| + controlSize = .large |
| + font = .systemFont(ofSize: 14) |
| + contentTintColor = .webText |
| target = self |
| self.action = #selector(performAction) |
| } |
| @@ -15,29 +18,13 @@ final class ActionButton: NSButton { |
| @objc private func performAction() { actionBlock?() } |
| } |
| final class FlippedView: NSView { override var isFlipped: Bool { true } } |
| -final class ComposerTextView: NSTextView { |
| - override func draw(_ dirtyRect: NSRect) { |
| - super.draw(dirtyRect) |
| - if string.isEmpty { |
| - ("Message your coordinator" as NSString).draw(at: NSPoint(x: 14, y: 14), withAttributes: [ |
| - .font: NSFont.systemFont(ofSize: 14), .foregroundColor: NSColor.secondaryLabelColor |
| - ]) |
| - } |
| - } |
| - override func didChangeText() { super.didChangeText(); needsDisplay = true } |
| -} |
| - |
| -private let transcriptAccent = NSColor(name: nil) { appearance in |
| - appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua |
| - ? NSColor(srgbRed: 0.74, green: 0.64, blue: 0.96, alpha: 1) |
| - : NSColor(srgbRed: 0.41, green: 0.25, blue: 0.74, alpha: 1) |
| -} |
| +private let transcriptAccent = NSColor.web(0x1F56D6, 0x7AA2FF) |
| final class NativeTranscript: NSView { |
| override var isFlipped: Bool { true } |
| private let store: MockStore |
| private let scroll = NSScrollView() |
| private let document = FlippedView() |
| - private let composer = ComposerTextView() |
| + let composer = NativeComposer() |
| private var answer: String? |
| private var transcriptOpen = false |
| private var localMessages: [String] = [] |
| @@ -50,33 +37,25 @@ final class NativeTranscript: NSView { |
| scroll.hasVerticalScroller = true |
| scroll.drawsBackground = false |
| addSubview(scroll) |
| - composer.font = .systemFont(ofSize: 14) |
| - composer.isRichText = false |
| - composer.textContainerInset = NSSize(width: 10, height: 12) |
| - composer.string = "" |
| - composer.setAccessibilityLabel("Message your coordinator") |
| - composer.wantsLayer = true |
| - composer.layer?.cornerRadius = 10 |
| addSubview(composer) |
| - let send = ActionButton("Send") { [weak self] in |
| - guard let self, !self.composer.string.isEmpty else { return } |
| - self.localMessages.append(self.composer.string) |
| - self.composer.string = "" |
| + // This fixture already has an active coordinator turn. |
| + composer.draft.thinking = true |
| + composer.onHeightChange = { [weak self] in self?.needsLayout = true } |
| + composer.onSend = { [weak self] message in |
| + guard let self else { return } |
| + let files = message.attachments.map(\.name).joined(separator: ", ") |
| + self.localMessages.append(message.text + (files.isEmpty ? "" : "\n" + files) + (message.waitingForUploads ? "\nUploading…" : message.queued ? "\nWaiting its turn" : "")) |
| self.rebuild() |
| } |
| - send.identifier = NSUserInterfaceItemIdentifier("send") |
| - addSubview(send) |
| + |
| } |
| required init?(coder: NSCoder) { fatalError() } |
| override func layout() { |
| super.layout() |
| - layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor |
| - scroll.frame = NSRect(x: 0, y: 68, width: bounds.width, height: bounds.height - 158) |
| - composer.frame = NSRect(x: 28, y: bounds.height - 75, width: bounds.width - 122, height: 51) |
| - composer.backgroundColor = .controlBackgroundColor |
| - composer.layer?.borderColor = NSColor.separatorColor.cgColor |
| - composer.layer?.borderWidth = 0.5 |
| - subviews.first(where: { $0.identifier?.rawValue == "send" })?.frame = NSRect(x: bounds.width - 84, y: bounds.height - 66, width: 62, height: 32) |
| + layer?.backgroundColor = NSColor.webBackground.cgColor |
| + let height = composer.desiredHeight |
| + composer.frame = NSRect(x: 28, y: bounds.height - height - 20, width: bounds.width - 56, height: height) |
| + scroll.frame = NSRect(x: 0, y: 68, width: bounds.width, height: bounds.height - height - 112) |
| if contentWidth != bounds.width { contentWidth = bounds.width; rebuild() } |
| } |
| override func draw(_ dirtyRect: NSRect) { |
| @@ -86,7 +65,7 @@ final class NativeTranscript: NSView { |
| ("Your coordinator" as NSString).draw(at: NSPoint(x: bounds.width - 139, y: 26), withAttributes: [.font: NSFont.systemFont(ofSize: 12), .foregroundColor: NSColor.secondaryLabelColor]) |
| NSColor.separatorColor.setFill() |
| NSRect(x: 0, y: 67, width: bounds.width, height: 0.5).fill() |
| - NSRect(x: 0, y: bounds.height - 90, width: bounds.width, height: 0.5).fill() |
| + |
| } |
| func rebuild() { |
| @@ -118,10 +97,13 @@ final class NativeTranscript: NSView { |
| text("Yesterday, 12 November", size: 13, weight: .semibold, x: 44, inset: 24) |
| text("2 finished · 1 decision · 1 still open", size: 12, color: .secondaryLabelColor, x: 44, inset: 24) |
| let transcript = ActionButton(transcriptOpen ? "Hide the conversation" : "Show the conversation") { [weak self] in self?.transcriptOpen.toggle(); self?.rebuild() } |
| - transcript.bezelStyle = .rounded |
| - transcript.frame = NSRect(x: 42, y: y, width: 183, height: 26) |
| + transcript.bezelStyle = .smallSquare |
| + transcript.isBordered = false |
| + transcript.alignment = .left |
| + transcript.attributedTitle = NSAttributedString(string: transcript.title, attributes: [.font: NSFont.systemFont(ofSize: 14), .foregroundColor: transcriptAccent]) |
| + transcript.frame = NSRect(x: 42, y: y, width: 192, height: 32) |
| document.addSubview(transcript) |
| - y += 36 |
| + y += 42 |
| if transcriptOpen { text("You chose the shorter setup. Engineering will investigate it next.", size: 13, x: 44, inset: 24) } |
| panel(start: dayStart, end: y) |
| y += 26 |
diff --git a/native/mockups/Shared/Components.swift b/native/mockups/Shared/Components.swift| index 2d358c4a..440851e7 100644 |
| --- a/native/mockups/Shared/Components.swift |
| +++ b/native/mockups/Shared/Components.swift |
| @@ -36,13 +36,7 @@ struct QuestionCard: View { |
| .font(.subheadline).foregroundStyle(Palette.accent) |
| QuietLabel(text: "Saved in this preview. No answer was sent.") |
| } else { |
| - HStack(spacing: 12) { |
| - ForEach(question.options ?? []) { option in |
| - Button(option.label) { answer = option.label } |
| - .buttonStyle(.bordered).controlSize(.large) |
| - .disabled(!question.canSubmit(currentRevision: 7)) |
| - } |
| - } |
| + AnswerChoices(question: question) { answer = $0 } |
| } |
| } |
| } |
| @@ -79,8 +73,7 @@ struct RollupCard: View { |
| Image(systemName: "chevron.down").font(.caption) |
| } |
| QuietLabel(text: "2 finished · 1 decision · 1 still open") |
| - Button(expanded ? "Hide the conversation" : "Show the conversation") { expanded.toggle() } |
| - .font(.subheadline) |
| + QuietAction(title: expanded ? "Hide the conversation" : "Show the conversation") { expanded.toggle() } |
| if expanded { Text("You chose the shorter setup. Engineering will investigate it next.").font(.subheadline) } |
| } |
| } |
| @@ -108,13 +101,9 @@ struct NotificationAnswerView: View { |
| Label("Answered: \(answer)", systemImage: "checkmark.circle.fill").foregroundStyle(Palette.accent) |
| QuietLabel(text: "Saved in this preview. No answer was sent.") |
| } else if compact && !expanded { |
| - Button("Expand to answer") { expanded = true }.buttonStyle(.bordered).controlSize(.large) |
| + EquipoButton(title: "Expand to answer") { expanded = true } |
| } else { |
| - HStack(spacing: 12) { |
| - ForEach(store.question.options ?? []) { option in |
| - Button(option.label) { answer = option.label }.buttonStyle(.bordered).controlSize(.large) |
| - } |
| - } |
| + AnswerChoices(question: store.question) { answer = $0 } |
| Label("Unlock to answer", systemImage: "lock").font(.footnote).foregroundStyle(Palette.secondary) |
| } |
| } |
| @@ -156,7 +145,7 @@ struct ConnectionsContent: View { |
| }.font(.subheadline) |
| QuietLabel(text: "Configured limits. Remaining budget and reset times are not available in the person API.") |
| NavigationLink(value: "usage-concept") { |
| - Label("Preview web Usage parity", systemImage: "arrow.up.right") |
| + Label("Preview web Usage parity", systemImage: "arrow.up.right").frame(minHeight: 44, alignment: .leading) |
| }.font(.subheadline) |
| } |
| } |
| @@ -174,13 +163,13 @@ struct WebConceptView: View { |
| Panel { |
| Label("Preview ready", systemImage: "macwindow").font(.headline) |
| Text("Two steps instead of five. Connect a runner, then choose your first project.") |
| - Button("Open preview") { choice = "Preview selected" }.buttonStyle(.bordered) |
| + EquipoButton(title: "Open preview") { choice = "Preview selected" } |
| } |
| Panel(tinted: true) { |
| Text("What next?").font(.headline) |
| Text("Keep exploring, build this direction, or leave it here.") |
| ForEach(["Build this", "Keep exploring", "Leave it here"], id: \.self) { text in |
| - Button(text) { choice = text }.buttonStyle(.bordered).controlSize(.large) |
| + EquipoButton(title: text, primary: text == "Build this", expanded: true) { choice = text } |
| } |
| } |
| QuietLabel(text: "An exploration ends at its preview. Building requires a new decision.") |
| @@ -190,7 +179,7 @@ struct WebConceptView: View { |
| Panel(tinted: true) { |
| Text("Copy cannot start").font(.headline) |
| Text("There is not enough room in this task’s token allowance to review the changed wording.") |
| - Button("Continue without Copy") { choice = "Continued in this preview. Checks and Review can resume." }.buttonStyle(.bordered).controlSize(.large) |
| + EquipoButton(title: "Continue without Copy") { choice = "Continued in this preview. Checks and Review can resume." } |
| } |
| Text("Only the task creator can continue. This applies to the current candidate and leaves its wording unaccepted.") |
| QuietLabel(text: "The release copy gate still applies. This is a separate budget-hold scenario, not a way to skip an open question.") |
| @@ -208,7 +197,7 @@ struct WebConceptView: View { |
| Text("Still unknown").font(.headline) |
| Text("Whether shared calendars need an administrator’s approval.") |
| } |
| - DisclosureGroup("Fetch log and kept images") { QuietLabel(text: "Two pages read. No images kept.") } |
| + DisclosureGroup { QuietLabel(text: "Two pages read. No images kept.") } label: { Text("Fetch log and kept images").frame(minHeight: 44, alignment: .leading) } |
| } else if screen == "usage-concept" { |
| Text("Usage").font(.title2.weight(.semibold)) |
| Panel { |
| @@ -226,7 +215,7 @@ struct WebConceptView: View { |
| Text("Check sign-in recovery").font(.headline) |
| QuietLabel(text: "Woodstar · Engineering") |
| Text("The preferred connection is near its limit. Equipo recommends waiting.") |
| - Button("Mark urgent") { choice = "Marked urgent in this preview" }.buttonStyle(.bordered) |
| + EquipoButton(title: "Mark urgent") { choice = "Marked urgent in this preview" } |
| } |
| QuietLabel(text: "Illustrative provider readings. These fields and the priority action need an API addition.") |
| } else { |
| @@ -235,7 +224,7 @@ struct WebConceptView: View { |
| Label("Contra", systemImage: "key.horizontal").font(.headline) |
| Text("Engineering needs a deployment credential.") |
| QuietLabel(text: "Equipo · Preview environment") |
| - Button("Open Contra") { choice = "Secure handoff selected" }.buttonStyle(.bordered).controlSize(.large) |
| + EquipoButton(title: "Open Contra") { choice = "Secure handoff selected" } |
| } |
| Text("Enter the secret in Contra. Keep it out of the conversation and notification.") |
| QuietLabel(text: "Proposed interaction only. No Contra contract or secret-request endpoint exists in this checkout.") |
diff --git a/native/mockups/Shared/Controls.swift b/native/mockups/Shared/Controls.swift| new file mode 100644 |
| index 00000000..7c0b7b13 |
| --- /dev/null |
| +++ b/native/mockups/Shared/Controls.swift |
| @@ -0,0 +1,89 @@ |
| +import SwiftUI |
| +import EquipoCore |
| + |
| +struct EquipoButton: View { |
| + let title: String |
| + var primary = false |
| + var expanded = false |
| + let action: () -> Void |
| + var body: some View { |
| + Group { |
| + if primary { button.buttonStyle(.borderedProminent) } |
| + else { button.buttonStyle(.bordered) } |
| + } |
| + .controlSize(.large) |
| + .buttonBorderShape(.roundedRectangle(radius: 4)) |
| + .tint(primary ? Palette.primaryFill : Palette.controlFace) |
| + .foregroundStyle(primary ? Color.white : Palette.controlText) |
| + .overlay(RoundedRectangle(cornerRadius: 4).stroke(primary ? Palette.primaryFill : Palette.controlBorder, lineWidth: 1).allowsHitTesting(false)) |
| + .modifier(ControlMeasurement(title: title, primary: primary)) |
| + } |
| + private var button: some View { |
| + Button(action: action) { |
| + Text(title).font(.body.weight(.medium)) |
| + .frame(maxWidth: expanded ? .infinity : nil, minHeight: 20) |
| + .fixedSize(horizontal: false, vertical: true) |
| + } |
| + } |
| +} |
| +struct AnswerChoices: View { |
| + let question: Question |
| + let onAnswer: (String) -> Void |
| + @Environment(\.dynamicTypeSize) private var typeSize |
| + var body: some View { |
| + let columns = typeSize.isAccessibilitySize ? 1 : min(2, max(1, question.options?.count ?? 1)) |
| + LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 10), count: columns), spacing: 10) { |
| + ForEach(question.options ?? []) { option in |
| + EquipoButton(title: option.label, expanded: true) { onAnswer(option.label) } |
| + .disabled(!question.canSubmit(currentRevision: 7)) |
| + } |
| + } |
| + } |
| +} |
| +struct QuietAction: View { |
| + let title: String |
| + let action: () -> Void |
| + var body: some View { |
| + Button(action: action) { |
| + Text(title).font(.subheadline).foregroundStyle(Palette.accent) |
| + .frame(minHeight: target).contentShape(Rectangle()) |
| + }.buttonStyle(.borderless).controlSize(.regular) |
| + } |
| + private var target: CGFloat { |
| + #if os(iOS) |
| + return WebControls.touchTarget |
| + #else |
| + return WebControls.pointerTarget |
| + #endif |
| + } |
| +} |
| + |
| +struct ControlMeasurement: ViewModifier { |
| + let title: String |
| + let primary: Bool |
| + func body(content: Content) -> some View { |
| + content.background(GeometryReader { proxy in |
| + Color.clear.onAppear { record(proxy.size) } |
| + .onChange(of: proxy.size) { _, size in record(size) } |
| + }) |
| + } |
| + private func record(_ size: CGSize) { |
| + guard size.width > 0 else { return } |
| + let args = ProcessInfo.processInfo.arguments |
| + let url: URL |
| + #if os(iOS) |
| + guard args.contains("--screen") else { return } |
| + url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("control-measurements.json") |
| + #else |
| + guard let index = args.firstIndex(of: "--snapshots"), args.indices.contains(index + 1) else { return } |
| + url = URL(fileURLWithPath: args[index + 1]).appendingPathComponent("mac-control-measurements.json") |
| + #endif |
| + ControlMeasurements.values[title] = ["width": size.width, "height": size.height, "primary": primary] |
| + if let data = try? JSONSerialization.data(withJSONObject: ControlMeasurements.values, options: .sortedKeys) { |
| + try? data.write(to: url, options: .atomic) |
| + } |
| + } |
| +} |
| +private enum ControlMeasurements { |
| + static var values: [String: [String: Any]] = [:] |
| +} |
diff --git a/native/mockups/Shared/Theme.swift b/native/mockups/Shared/Theme.swift| index 9243ea89..a717a24b 100644 |
| --- a/native/mockups/Shared/Theme.swift |
| +++ b/native/mockups/Shared/Theme.swift |
| @@ -7,12 +7,19 @@ import UIKit |
| #endif |
| enum Palette { |
| - static let accent = Color(light: 0x6941BD, dark: 0xBDA2F5) |
| - static let background = Color(light: 0xF7F7F8, dark: 0x101216) |
| - static let surface = Color(light: 0xFFFFFF, dark: 0x1B1D23) |
| - static let soft = Color(light: 0xF1ECF9, dark: 0x292335) |
| - static let border = Color(light: 0xDDDEE3, dark: 0x383B44) |
| - static let secondary = Color(light: 0x616572, dark: 0xA8ABB7) |
| + static let negative = Color(light: 0xB91C1C, dark: 0xF79AA0) |
| + static let negativeBackground = Color(light: 0xFEE2E2, dark: 0x331819) |
| + static let controlFace = Color(light: WebControls.face(false), dark: WebControls.face(true)) |
| + static let controlText = Color(light: WebControls.text(false), dark: WebControls.text(true)) |
| + static let placeholder = Color(light: WebControls.placeholder(false), dark: WebControls.placeholder(true)) |
| + static let primaryFill = Color(light: WebControls.primary(false), dark: WebControls.primary(true)) |
| + static let controlBorder = Color(light: 0xD0D4DC, dark: 0x343843) |
| + static let accent = Color(light: 0x1F56D6, dark: 0x7AA2FF) |
| + static let background = Color(light: 0xFBFBFC, dark: 0x0C0D0F) |
| + static let surface = Color(light: 0xFFFFFF, dark: 0x141518) |
| + static let soft = Color(light: 0xECF1FF, dark: 0x16234A) |
| + static let border = Color(light: 0xE6E6EA, dark: 0x26282E) |
| + static let secondary = Color(light: 0x52525C, dark: 0xA1A1AA) |
| } |
| extension Color { |
| init(light: UInt32, dark: UInt32) { |
diff --git a/native/mockups/iOS/EquipoPhoneApp.swift b/native/mockups/iOS/EquipoPhoneApp.swift| index 49b2882b..cb3a0b03 100644 |
| --- a/native/mockups/iOS/EquipoPhoneApp.swift |
| +++ b/native/mockups/iOS/EquipoPhoneApp.swift |
| @@ -59,6 +59,7 @@ struct PhoneRoot: View { |
| switch screen { |
| case "team": TeamIndex(store: store) |
| case "conversation": PhoneConversation(store: store) |
| + case "conversation-draft", "conversation-attachment", "conversation-uploading", "conversation-error": PhoneConversation(store: store, composerState: String(screen.dropFirst(13))) |
| case "tasks": PhoneTasks(store: store) |
| case "task": PhoneTask(store: store, task: store.tasks[0]) |
| case "needs": PhoneNeeds(store: store) |
| @@ -108,7 +109,7 @@ struct TeamIndex: View { |
| struct PhoneConversation: View { |
| let store: MockStore |
| @State private var answer: String? |
| - @State private var message = "" |
| + var composerState = "" |
| @State private var sent: [String] = [] |
| var body: some View { |
| ScrollView { |
| @@ -120,10 +121,15 @@ struct PhoneConversation: View { |
| if item.author_kind != "person" { |
| Label("Coordinator", systemImage: "sparkle").font(.subheadline.weight(.semibold)).foregroundStyle(Palette.accent) |
| } |
| - Text(item.body).font(.body).fixedSize(horizontal: false, vertical: true) |
| - .padding(item.author_kind == "person" ? 14 : 0) |
| - .background(item.author_kind == "person" ? Palette.soft : Color.clear) |
| - .clipShape(RoundedRectangle(cornerRadius: 16)) |
| + if item.author_kind == "person" { |
| + Text(item.body).font(.body).fixedSize(horizontal: false, vertical: true) |
| + .padding(14).background(Palette.soft) |
| + .clipShape(RoundedRectangle(cornerRadius: 16)) |
| + } else { |
| + Text(item.body).font(.body).fixedSize(horizontal: false, vertical: true) |
| + .frame(maxWidth: .infinity, alignment: .leading) |
| + .padding(.horizontal, 2) |
| + } |
| }.frame(maxWidth: .infinity, alignment: item.author_kind == "person" ? .trailing : .leading) |
| } |
| QuestionCard(question: store.question, answer: $answer) |
| @@ -135,12 +141,10 @@ struct PhoneConversation: View { |
| } |
| .background(Palette.background) |
| .safeAreaInset(edge: .bottom) { |
| - HStack(spacing: 12) { |
| - TextField("Message your coordinator", text: $message, axis: .vertical).lineLimit(1...4) |
| - Button { if !message.isEmpty { sent.append(message); message = "" } } label: { |
| - Image(systemName: "arrow.up.circle.fill").font(.title).frame(width: 44, height: 44) |
| - }.accessibilityLabel("Send preview message") |
| - }.padding(.horizontal, 18).padding(.vertical, 7).background(.bar) |
| + PhoneComposer(state: composerState) { message in |
| + let files = message.attachments.map(\.name).joined(separator: ", ") |
| + sent.append(message.text + (files.isEmpty ? "" : "\n" + files) + (message.waitingForUploads ? "\nUploading…" : message.queued ? "\nWaiting its turn" : "")) |
| + } |
| } |
| .navigationTitle("Conversation").navigationBarTitleDisplayMode(.inline) |
| .toolbar { ToolbarItem(placement: .topBarTrailing) { NavigationLink(value: "needs") { Image(systemName: "hand.raised") }.accessibilityLabel("Needs you") } } |
| @@ -188,7 +192,7 @@ struct PhoneTask: View { |
| if task.needs_you { QuestionCard(question: store.question, answer: $answer) } |
| Text("Steps").font(.headline) |
| StepsView(task: task) |
| - NavigationLink("Preview a Copy budget hold", value: "copy-hold") |
| + NavigationLink(value: "copy-hold") { Text("Preview a Copy budget hold").frame(minHeight: 44, alignment: .leading) } |
| }.padding(20) |
| }.background(Palette.background).navigationTitle("Task").navigationBarTitleDisplayMode(.inline) |
| @@ -207,7 +211,7 @@ struct PhoneNeeds: View { |
| Label("Equipo", systemImage: "folder").font(.subheadline).foregroundStyle(Palette.secondary) |
| } |
| QuestionCard(question: store.question, answer: $answer) |
| - NavigationLink(value: "task") { Label("Open task and steps", systemImage: "arrow.right") } |
| + NavigationLink(value: "task") { Label("Open task and steps", systemImage: "arrow.right").frame(minHeight: 44, alignment: .leading) } |
| Divider() |
| QuietLabel(text: "Work that is running or waiting for a runner stays in Tasks.") |
| }.padding(20) |
diff --git a/native/mockups/iOS/PhoneComposer.swift b/native/mockups/iOS/PhoneComposer.swift| new file mode 100644 |
| index 00000000..7490c28f |
| --- /dev/null |
| +++ b/native/mockups/iOS/PhoneComposer.swift |
| @@ -0,0 +1,81 @@ |
| +import SwiftUI |
| +import EquipoCore |
| + |
| +struct PhoneComposer: View { |
| + @State private var draft: ComposerDraft |
| + let onSend: (PendingMessage) -> Void |
| + init(state: String = "", onSend: @escaping (PendingMessage) -> Void) { |
| + var value = ComposerDraft() |
| + value.thinking = true |
| + switch state { |
| + case "draft": value.text = "Can you check this invoice?" |
| + case "attachment": value.text = "Check this invoice."; value.attachments = [DraftAttachment(name: "invoice.pdf")] |
| + case "uploading": value.attachments = [DraftAttachment(name: "invoice.pdf", state: .uploading)] |
| + case "error": value.attachments = [DraftAttachment(name: "invoice.pdf", state: .failed)] |
| + default: break |
| + } |
| + _draft = State(initialValue: value) |
| + self.onSend = onSend |
| + } |
| + var body: some View { |
| + HStack(alignment: .bottom, spacing: 12) { |
| + Menu { |
| + Button("Photo or image", systemImage: "photo") { add("preview.png") } |
| + Button("File", systemImage: "doc") { add("invoice.pdf") } |
| + } label: { |
| + Image(systemName: "plus").font(.system(size: 20)) |
| + .foregroundStyle(Palette.secondary) |
| + .frame(width: 44, height: 44) |
| + .background(Palette.surface, in: Circle()) |
| + .overlay(Circle().stroke(Palette.controlBorder, lineWidth: 1)) |
| + }.controlSize(.large).accessibilityLabel("Add attachment").modifier(ControlMeasurement(title: "Add attachment", primary: false)) |
| + VStack(alignment: .leading, spacing: 0) { |
| + if !draft.attachments.isEmpty { |
| + VStack(spacing: 8) { |
| + ForEach(draft.attachments) { attachment in |
| + HStack(spacing: 10) { |
| + Image(systemName: attachment.name.hasSuffix("png") ? "photo" : "doc").foregroundStyle(Palette.secondary) |
| + VStack(alignment: .leading, spacing: 3) { |
| + Text(attachment.name).font(.subheadline).lineLimit(1) |
| + Text(attachment.state == .failed ? "Could not upload. Try again." : attachment.state == .uploading ? "Uploading…" : "PDF · 24 KB") |
| + .font(.caption).foregroundStyle(attachment.state == .failed ? Palette.negative : Palette.secondary) |
| + if attachment.state == .uploading { ProgressView(value: 0.45).tint(Palette.accent) } |
| + } |
| + Spacer(minLength: 0) |
| + Button { draft.attachments.removeAll { $0.id == attachment.id } } label: { |
| + Image(systemName: "xmark").font(.body).foregroundStyle(Palette.secondary).frame(width: 44, height: 44) |
| + }.buttonStyle(.plain).controlSize(.large).accessibilityLabel("Remove \(attachment.name)").modifier(ControlMeasurement(title: "Remove attachment", primary: false)) |
| + }.padding(.leading, 12).padding(.vertical, 6) |
| + .background(attachment.state == .failed ? Palette.negativeBackground : Palette.background, in: RoundedRectangle(cornerRadius: 10)) |
| + .overlay(RoundedRectangle(cornerRadius: 10).stroke(Palette.border, lineWidth: 1)) |
| + } |
| + }.padding(12).padding(.bottom, 2) |
| + } |
| + HStack(alignment: .bottom, spacing: 0) { |
| + TextField("", text: $draft.text, prompt: Text("Message").foregroundColor(Palette.placeholder), axis: .vertical) |
| + .font(.body).foregroundStyle(Palette.controlText) |
| + .lineLimit(1...6) |
| + .padding(.leading, 18).padding(.vertical, 10) |
| + .frame(minHeight: 44) |
| + .accessibilityLabel("Message") |
| + if draft.canSend { |
| + Button { |
| + if let message = draft.take() { onSend(message) } |
| + } label: { |
| + Image(systemName: "arrow.up").font(.system(size: 18, weight: .semibold)) |
| + .foregroundStyle(.white).frame(width: 32, height: 32) |
| + .background(Palette.primaryFill, in: Circle()) |
| + .frame(width: 44, height: 44).contentShape(Circle()) |
| + }.buttonStyle(.plain).controlSize(.large).accessibilityLabel("Send").modifier(ControlMeasurement(title: "Send", primary: true)) |
| + } else { Color.clear.frame(width: 44, height: 44).accessibilityHidden(true) } |
| + } |
| + } |
| + .background(Palette.surface, in: RoundedRectangle(cornerRadius: 22)) |
| + .overlay(RoundedRectangle(cornerRadius: 22).stroke(Palette.controlBorder, lineWidth: 1)) |
| + }.padding(.horizontal, 16).padding(.vertical, 12).background(Palette.background) |
| + } |
| + private func add(_ name: String) { |
| + guard draft.attachments.count < 5 else { return } |
| + draft.attachments.append(DraftAttachment(name: name)) |
| + } |
| +} |
diff --git a/native/mockups/scripts/check-composer-mutations.py b/native/mockups/scripts/check-composer-mutations.py| new file mode 100644 |
| index 00000000..fc95146f |
| --- /dev/null |
| +++ b/native/mockups/scripts/check-composer-mutations.py |
| @@ -0,0 +1,30 @@ |
| +#!/usr/bin/env python3 |
| +from pathlib import Path |
| +import subprocess |
| +root = Path(__file__).resolve().parents[1] |
| +path = root / 'EquipoCore/Sources/EquipoCore/Composer.swift' |
| +original = path.read_text() |
| +cases = [ |
| + ('upload-wait', 'attachments.contains { $0.state == .uploading }', 'false', 'testUploadRemainsPendingBeforePosting'), |
| + ('whitespace', '!text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty', '!text.isEmpty', 'testSendRequiresWordsOrUsableAttachment'), |
| + ('failed-upload', 'attachments.contains { $0.state != .failed }', '!attachments.isEmpty', 'testSendRequiresWordsOrUsableAttachment'), |
| + ('draft-clear', 'text = ""; attachments = []', 'attachments = []', 'testSendClearsDraftAndKeepsNextMessageEditable'), |
| + ('thinking-queue', 'queued: thinking', 'queued: false', 'testSendClearsDraftAndKeepsNextMessageEditable'), |
| + ('failed-file-filter', 'attachments.filter { $0.state != .failed }', 'attachments', 'testFailedAttachmentsAreNotSubmitted'), |
| + ('hit-target', 'touchTarget = 44.0', 'touchTarget = 32.0', 'testWebHitTargetsAndContrast'), |
| + ('primary-contrast', 'dark ? 0x2F61E8 : 0x2257DF', 'dark ? 0xBDA2F5 : 0x2257DF', 'testWebHitTargetsAndContrast'), |
| +] |
| +try: |
| + for name, old, new, test in cases: |
| + assert old in original |
| + path.write_text(original.replace(old, new)) |
| + run = subprocess.run(['swift', 'test', '--package-path', str(root/'EquipoCore'), '--scratch-path', str(root/'CoreTests'), '--filter', test], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| + (root/('mutation-'+name+'.log')).write_bytes(run.stdout) |
| + assert run.returncode and b'XCTAssert' in run.stdout, name |
| + print('Caught mutation: '+name, flush=True) |
| +finally: |
| + path.write_text(original) |
| +run = subprocess.run(['swift', 'test', '--package-path', str(root/'EquipoCore'), '--scratch-path', str(root/'CoreTests')], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| +(root/'composer-tests-final.log').write_bytes(run.stdout) |
| +assert run.returncode == 0 |
| +print('Restored: all core tests pass') |
diff --git a/native/mockups/scripts/generate-project.py b/native/mockups/scripts/generate-project.py| index 6e104cea..36f92967 100644 |
| --- a/native/mockups/scripts/generate-project.py |
| +++ b/native/mockups/scripts/generate-project.py |
| @@ -30,7 +30,7 @@ for name,folder,sdk in [('EquipoPhone','iOS','iphoneos'),('EquipoMac','Mac','mac |
| sources=add(name+'sources',isa='PBXSourcesBuildPhase',buildActionMask=2147483647,files=sourceids,runOnlyForDeploymentPostprocessing=0) |
| frameworks=add(name+'frameworks',isa='PBXFrameworksBuildPhase',buildActionMask=2147483647,files=[framework],runOnlyForDeploymentPostprocessing=0) |
| resources=add(name+'resources',isa='PBXResourcesBuildPhase',buildActionMask=2147483647,files=[],runOnlyForDeploymentPostprocessing=0) |
| - settings=dict(PRODUCT_NAME='$(TARGET_NAME)',PRODUCT_BUNDLE_IDENTIFIER='net.oficina.equipo.r4.'+folder.lower(),SWIFT_VERSION='5.0',GENERATE_INFOPLIST_FILE='YES',CODE_SIGNING_ALLOWED='NO',SDKROOT=sdk,MARKETING_VERSION='0.4',CURRENT_PROJECT_VERSION='4',INFOPLIST_KEY_CFBundleDisplayName='Equipo R4',ENABLE_USER_SCRIPT_SANDBOXING='YES') |
| + settings=dict(PRODUCT_NAME='$(TARGET_NAME)',PRODUCT_BUNDLE_IDENTIFIER='net.oficina.equipo.r4.'+folder.lower(),SWIFT_VERSION='5.0',GENERATE_INFOPLIST_FILE='YES',CODE_SIGNING_ALLOWED='NO',SDKROOT=sdk,MARKETING_VERSION='0.5',CURRENT_PROJECT_VERSION='5',INFOPLIST_KEY_CFBundleDisplayName='Equipo R5',ENABLE_USER_SCRIPT_SANDBOXING='YES') |
| if folder=='iOS':settings.update(IPHONEOS_DEPLOYMENT_TARGET='17.0',TARGETED_DEVICE_FAMILY='1',SUPPORTED_PLATFORMS='iphoneos iphonesimulator',INFOPLIST_KEY_UILaunchScreen_Generation='YES',INFOPLIST_KEY_UIApplicationSceneManifest_Generation='YES',INFOPLIST_KEY_UISupportedInterfaceOrientations='UIInterfaceOrientationPortrait') |
| else:settings.update(MACOSX_DEPLOYMENT_TARGET='14.0',SUPPORTED_PLATFORMS='macosx') |
| targets.append(add(name,isa='PBXNativeTarget',buildConfigurationList=configs(name,settings),buildPhases=[sources,frameworks,resources],buildRules=[],dependencies=[],name=name,productName=name,productReference=product,productType='com.apple.product-type.application',packageProductDependencies=[dep])) |
diff --git a/native/mockups/scripts/studio.sh b/native/mockups/scripts/studio.sh| index 8e5f7874..7d149c84 100755 |
| --- a/native/mockups/scripts/studio.sh |
| +++ b/native/mockups/scripts/studio.sh |
| @@ -6,11 +6,13 @@ if [ "$PWD" != "$HOME/.cache/equipo-native-r4/build" ]; then |
| exit 1 |
| fi |
| sim='' |
| +simctl() { xcrun simctl --set "$PWD/SimulatorDevices" "$@"; } |
| +mkdir -p SimulatorDevices |
| cleanup() { |
| if [ -n "$sim" ]; then |
| - xcrun simctl terminate "$sim" net.oficina.equipo.r4.ios >/dev/null 2>&1 || true |
| - xcrun simctl shutdown "$sim" >/dev/null 2>&1 || true |
| - xcrun simctl delete "$sim" |
| + simctl terminate "$sim" net.oficina.equipo.r4.ios >/dev/null 2>&1 || true |
| + simctl shutdown "$sim" >/dev/null 2>&1 || true |
| + simctl delete "$sim" |
| fi |
| } |
| trap cleanup EXIT |
| @@ -21,27 +23,50 @@ if [ "${R4_CAPTURE_ONLY:-0}" != 1 ]; then |
| xcodebuild -project EquipoMockups.xcodeproj -scheme EquipoPhone -configuration Debug -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath DerivedData/Phone -clonedSourcePackagesDirPath SourcePackages -resultBundlePath "phone-$stamp.xcresult" ARCHS=arm64 CODE_SIGNING_ALLOWED=NO build > phone-build.log 2>&1 |
| fi |
| mkdir -p Captures |
| +DerivedData/Mac/Build/Products/Debug/EquipoMac.app/Contents/MacOS/EquipoMac --verify > composer-checks.log 2>&1 |
| DerivedData/Mac/Build/Products/Debug/EquipoMac.app/Contents/MacOS/EquipoMac --snapshots "$PWD/Captures" > snapshots.log 2>&1 |
| -if xcrun simctl list devices -j | python3 -c 'import json,sys; sys.exit(0 if any(d["name"]=="equipo-r4" for ds in json.load(sys.stdin)["devices"].values() for d in ds) else 1)'; then |
| +python3 - <<'PYTEST' |
| +import json |
| +controls = json.load(open('Captures/mac-control-measurements.json')) |
| +assert all(v['height'] >= 32 for v in controls.values()), controls |
| +assert abs(controls['VAT']['width'] - controls['Sales tax']['width']) < 1, controls |
| +PYTEST |
| +if simctl list devices -j | python3 -c 'import json,sys; sys.exit(0 if any(d["name"]=="equipo-r4" for ds in json.load(sys.stdin)["devices"].values() for d in ds) else 1)'; then |
| echo 'An equipo-r4 simulator already exists; leave it untouched.' >&2 |
| exit 1 |
| fi |
| -sim=$(xcrun simctl create equipo-r4 com.apple.CoreSimulator.SimDeviceType.iPhone-17 com.apple.CoreSimulator.SimRuntime.iOS-27-2) |
| -xcrun simctl boot "$sim" |
| -xcrun simctl bootstatus "$sim" -b > simulator-boot.log 2>&1 |
| -xcrun simctl status_bar "$sim" override --time '9:41' --dataNetwork wifi --wifiMode active --wifiBars 3 --batteryState charged --batteryLevel 100 |
| -xcrun simctl install "$sim" DerivedData/Phone/Build/Products/Debug-iphonesimulator/EquipoPhone.app |
| +sim=$(simctl create equipo-r4 com.apple.CoreSimulator.SimDeviceType.iPhone-17 com.apple.CoreSimulator.SimRuntime.iOS-27-2) |
| +simctl boot "$sim" |
| +simctl bootstatus "$sim" -b > simulator-boot.log 2>&1 |
| +simctl status_bar "$sim" override --time '9:41' --dataNetwork wifi --wifiMode active --wifiBars 3 --batteryState charged --batteryLevel 100 |
| +simctl install "$sim" DerivedData/Phone/Build/Products/Debug-iphonesimulator/EquipoPhone.app |
| for theme in light dark; do |
| - xcrun simctl ui "$sim" appearance "$theme" |
| - for screen in teams team conversation tasks task needs connections notification-compact notification notification-answered exploration research usage-concept contra copy-hold; do |
| - xcrun simctl terminate "$sim" net.oficina.equipo.r4.ios >/dev/null 2>&1 || true |
| - xcrun simctl launch "$sim" net.oficina.equipo.r4.ios --screen "$screen" --theme "$theme" >/dev/null |
| - sleep 6 |
| - xcrun simctl io "$sim" screenshot "Captures/iphone-$screen-$theme.png" >/dev/null 2>&1 |
| + simctl ui "$sim" appearance "$theme" |
| + for screen in teams team conversation conversation-draft conversation-attachment conversation-uploading conversation-error tasks task needs connections notification-compact notification notification-answered exploration research usage-concept contra copy-hold; do |
| + simctl terminate "$sim" net.oficina.equipo.r4.ios >/dev/null 2>&1 || true |
| + simctl launch "$sim" net.oficina.equipo.r4.ios --screen "$screen" --theme "$theme" >/dev/null |
| + sleep 3 |
| + simctl io "$sim" screenshot "Captures/iphone-$screen-$theme.png" >/dev/null 2>&1 |
| + container=$(simctl get_app_container "$sim" net.oficina.equipo.r4.ios data) |
| + if [ -f "$container/Documents/control-measurements.json" ]; then |
| + cp "$container/Documents/control-measurements.json" "Captures/iphone-$screen-$theme-controls.json" |
| + python3 - "$container/Documents/control-measurements.json" <<'PYTEST' |
| +import json, sys |
| +controls = json.load(open(sys.argv[1])) |
| +assert all(v['height'] >= 44 for v in controls.values()), controls |
| +if 'VAT' in controls and 'Sales tax' in controls: |
| + assert abs(controls['VAT']['width'] - controls['Sales tax']['width']) < 1, controls |
| +assert sum(v['primary'] for v in controls.values()) <= 1, controls |
| +PYTEST |
| + unlink "$container/Documents/control-measurements.json" |
| + fi |
| done |
| done |
| # Extra evidence of reflow; the baseline screens above keep the system default. |
| -xcrun simctl ui "$sim" content_size accessibility-large |
| -xcrun simctl launch --terminate-running-process "$sim" net.oficina.equipo.r4.ios --screen needs --theme dark >/dev/null |
| -sleep 3 |
| -xcrun simctl io "$sim" screenshot Captures/iphone-needs-accessibility-dark.png >/dev/null 2>&1 |
| +simctl ui "$sim" content_size accessibility-large |
| +for theme in light dark; do |
| + simctl ui "$sim" appearance "$theme" |
| + simctl launch --terminate-running-process "$sim" net.oficina.equipo.r4.ios --screen needs --theme "$theme" >/dev/null |
| + sleep 3 |
| + simctl io "$sim" screenshot "Captures/iphone-needs-accessibility-$theme.png" >/dev/null 2>&1 |
| +done |