Docs native S2a: the new chrome on the spacing scale; inspector rows meet its edges
- DocsSpacing mirrors Fiesta's --rst-sp-1…6 (4, 8, 12, 16, 24, 40) and the title area, header pills, callouts and inspector use it (AGENTS.md, Spacing). The two values off the scale say why: the subtitle's 1pt under the title, and the segmented well's 2pt inset. - The inspector's font pop-up is the same stretching pop-up as Style and Size (families still in their own faces): the old one hugged its widest name, so the size field ran past the panel's content edge and Style sat apart from the row under it. Both rows now meet the panel's 12pt content edges on either side, in ar, ru and at 1000pt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+39
−14
native/apple/Sources/DocsKit/DocsDesk.swift+13 −0native/apple/Sources/DocsKit/DocsDocumentHeader.swift+8 −6native/apple/Sources/DocsKit/DocsFormatInspector.swift+17 −7native/apple/Sources/DocsKit/DocsSubtitle.swift+1 −1
diff --git a/native/apple/Sources/DocsKit/DocsDesk.swift b/native/apple/Sources/DocsKit/DocsDesk.swift| index 7a83e0e..9c255be 100644 |
| --- a/native/apple/Sources/DocsKit/DocsDesk.swift |
| +++ b/native/apple/Sources/DocsKit/DocsDesk.swift |
| @@ -132,3 +132,16 @@ extension NativeDocumentTextView { |
| } |
| } |
| #endif |
| + |
| +/// Fiesta's spacing scale in points (`--rst-sp-1` … `--rst-sp-6`: 4, 8, 12, |
| +/// 16, 24, 40), so the native chrome keeps the web's rhythm (AGENTS.md, |
| +/// "Spacing", Paul 2026-11-22: no ad-hoc spacing). Anything off the scale |
| +/// says why where it is written (`spacing-allow:`). |
| +enum DocsSpacing { |
| + static let sp1: CGFloat = 4 |
| + static let sp2: CGFloat = 8 |
| + static let sp3: CGFloat = 12 |
| + static let sp4: CGFloat = 16 |
| + static let sp5: CGFloat = 24 |
| + static let sp6: CGFloat = 40 |
| +} |
diff --git a/native/apple/Sources/DocsKit/DocsDocumentHeader.swift b/native/apple/Sources/DocsKit/DocsDocumentHeader.swift| index 794816d..4acbf3b 100644 |
| --- a/native/apple/Sources/DocsKit/DocsDocumentHeader.swift |
| +++ b/native/apple/Sources/DocsKit/DocsDocumentHeader.swift |
| @@ -26,6 +26,8 @@ enum DocsInspectorState { |
| let finishRename: () -> Void |
| var body: some View { |
| + // spacing-allow: the subtitle sits on the title's descender, as a |
| + // window title and subtitle do; a step of the scale would split them. |
| VStack(alignment: .leading, spacing: 1) { |
| title |
| DocsSubtitleView(model: model, team: team) |
| @@ -117,7 +119,7 @@ enum DocsInspectorState { |
| let projection = model.projection |
| HStack(spacing: 0) { |
| button("docs.editor.toolbar.undo", icon: "arrow.uturn.backward", op: "undo", enabled: projection?.canUndo == true) |
| - Rectangle().fill(OficinaPalette.line).frame(width: 1, height: 14) |
| + Rectangle().fill(OficinaPalette.line).frame(width: 1, height: DocsSpacing.sp3) |
| button("docs.editor.toolbar.redo", icon: "arrow.uturn.forward", op: "redo", enabled: projection?.canRedo == true) |
| } |
| .background(Capsule().fill(OficinaPalette.sunk)) |
| @@ -160,7 +162,7 @@ struct DocsPillStyle: ButtonStyle { |
| .font(.system(size: 13, weight: .semibold)) |
| .lineLimit(1) |
| .fixedSize() |
| - .padding(.horizontal, 14) |
| + .padding(.horizontal, DocsSpacing.sp3) |
| .frame(height: 28) |
| .foregroundStyle(kind == .filled ? OficinaPalette.onAccent : kind == .toggledOn ? accent : OficinaPalette.text) |
| .background { |
| @@ -189,7 +191,7 @@ struct DocsPillStyle: ButtonStyle { |
| /// The account flow, as Settings' Sign in… opens it (the home window). |
| var signIn: () -> Void = {} |
| var body: some View { |
| - VStack(spacing: 8) { |
| + VStack(spacing: DocsSpacing.sp2) { |
| // §6 rows 5 and 6: the session ended. Typing still reaches the |
| // outbox; signing in sends it. |
| if model.access != .unavailable, case .needsSignIn(let pending) = model.syncStatus { |
| @@ -214,17 +216,17 @@ struct DocsPillStyle: ButtonStyle { |
| } |
| } |
| } |
| - .padding(.top, 12) |
| + .padding(.top, DocsSpacing.sp3) |
| .frame(maxWidth: 560) |
| } |
| private func callout<Actions: View>(_ text: Text, negative: Bool, @ViewBuilder actions: () -> Actions) -> some View { |
| - HStack(spacing: 12) { |
| + HStack(spacing: DocsSpacing.sp3) { |
| text.font(.callout).foregroundStyle(negative ? OficinaPalette.negative : OficinaPalette.text) |
| .fixedSize(horizontal: false, vertical: true) |
| Spacer(minLength: 8) |
| actions().controlSize(.small) |
| } |
| - .padding(.horizontal, 14).padding(.vertical, 10) |
| + .padding(.horizontal, DocsSpacing.sp3).padding(.vertical, DocsSpacing.sp2) |
| .background(RoundedRectangle(cornerRadius: 10).fill(negative ? OficinaPalette.negativeSoft : OficinaPalette.surface)) |
| .overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(OficinaPalette.line, lineWidth: 1)) |
| .shadow(color: .black.opacity(0.08), radius: 8, y: 3) |
diff --git a/native/apple/Sources/DocsKit/DocsFormatInspector.swift b/native/apple/Sources/DocsKit/DocsFormatInspector.swift| index 731f0f8..d8e7059 100644 |
| --- a/native/apple/Sources/DocsKit/DocsFormatInspector.swift |
| +++ b/native/apple/Sources/DocsKit/DocsFormatInspector.swift |
| @@ -30,12 +30,11 @@ import SwiftUI |
| var body: some View { |
| let actions = self.actions |
| let selection = currentSelection ?? settledSelection |
| - VStack(alignment: .leading, spacing: 14) { |
| + VStack(alignment: .leading, spacing: DocsSpacing.sp4) { |
| section("docs.editor.toolbar.group.style") { |
| stylePicker(selection) |
| - HStack(spacing: 6) { |
| - DocsFontPopUp(selected: selection.font) { actions.setFont($0) } |
| - .frame(maxWidth: .infinity) |
| + HStack(spacing: DocsSpacing.sp2) { |
| + fontPicker(selection) |
| sizePicker(selection).frame(width: 64) |
| } |
| } |
| @@ -67,7 +66,7 @@ import SwiftUI |
| ]) |
| } |
| } |
| - .padding(12) |
| + .padding(DocsSpacing.sp3) |
| .frame(width: DocsDeskLayout.inspectorWidth, alignment: .leading) |
| .background { panel } |
| .overlay { |
| @@ -99,7 +98,7 @@ import SwiftUI |
| } |
| private func section<Content: View>(_ key: String, @ViewBuilder content: () -> Content) -> some View { |
| - VStack(alignment: .leading, spacing: 6) { |
| + VStack(alignment: .leading, spacing: DocsSpacing.sp2) { |
| Text(LocalizedStringKey(key), bundle: DocsResources.bundle) |
| .font(.system(size: 11, weight: .semibold)) |
| .foregroundStyle(OficinaPalette.textMuted) |
| @@ -127,6 +126,15 @@ import SwiftUI |
| .frame(maxWidth: .infinity) |
| } |
| + /// Families in their own faces (spec §1), stretching to the column the |
| + /// size leaves: a pop-up that hugs its widest name ran past the panel. |
| + private func fontPicker(_ selection: DocumentToolbarSelection) -> some View { |
| + let strings = DocsStrings(locale: locale) |
| + return DocsPopUp(entries: DocsFontPicker.entries.map { .init(id: $0.key, title: $0.name, font: $0.font) }, |
| + selected: selection.font, label: strings("native.font"), identifier: "docs.font-picker") { actions.setFont($0) } |
| + .frame(minWidth: 0, maxWidth: .infinity) |
| + } |
| + |
| private func sizePicker(_ selection: DocumentToolbarSelection) -> some View { |
| let strings = DocsStrings(locale: locale) |
| return DocsPopUp(entries: Self.sizes.map { .init(id: String($0), title: $0.formatted(.number.locale(locale)), font: nil) }, |
| @@ -197,6 +205,8 @@ struct DocsSegmentedRow: View { |
| let items: [Item] |
| var body: some View { |
| let accent = OficinaPalette.accent(.docs) |
| + // spacing-allow: the joined buttons share one well, 2pt apart, as the |
| + // web inspector's segmented rows. |
| HStack(spacing: 2) { |
| ForEach(items) { item in |
| Button(action: item.action) { |
| @@ -217,7 +227,7 @@ struct DocsSegmentedRow: View { |
| .accessibilityAddTraits(item.on ? .isSelected : []) |
| } |
| } |
| - .padding(2) |
| + .padding(2) // spacing-allow: the well's inset around its joined buttons |
| .frame(height: 28) |
| .background(RoundedRectangle(cornerRadius: 8).fill(OficinaPalette.sunk)) |
| } |
diff --git a/native/apple/Sources/DocsKit/DocsSubtitle.swift b/native/apple/Sources/DocsKit/DocsSubtitle.swift| index a9875a2..6e5b603 100644 |
| --- a/native/apple/Sources/DocsKit/DocsSubtitle.swift |
| +++ b/native/apple/Sources/DocsKit/DocsSubtitle.swift |
| @@ -186,7 +186,7 @@ struct DocsSubtitleLine: View { |
| let strings: DocsStrings |
| var body: some View { |
| let text = strings.subtitle(team: team, row: row) |
| - HStack(spacing: 4) { |
| + HStack(spacing: DocsSpacing.sp1) { |
| if row == .viewOnly { Image(systemName: "eye").font(.system(size: 9, weight: .semibold)) } |
| Text(verbatim: text.isEmpty ? " " : text) |
| .lineLimit(1) |