@tonycodes-ui/mortar 0.19.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/agents.md CHANGED
@@ -63,7 +63,7 @@ In a project without Mortar installed, `npx -y @tonycodes-ui/mortar mcp` downloa
63
63
  | `search_components` | `query`, optional `kit`, `category`, `limit` | Ranked components: name, kit, category, description, capabilities. |
64
64
  | `get_component` | `name` | The full contract: props with types, required flags and defaults; usage, avoid and accessibility notes; the components it renders; its `data-m-component` marker; tested states; page templates; a JSX example; the import line. |
65
65
  | `get_build_packet` | `components` and/or `brief` | The chosen components (for a brief, with the reason for each, starting from the purpose shell), their dependency closure, install, CSS and ThemeProvider setup, the import line, the design principles and API conventions, and matching page templates. |
66
- | `get_guide` | `topic` | A guide as markdown: `design`, `conventions`, `theming`, `auth-flows`, `email`, `migrating-0.6`, `contributing`, `testing` or `agents`. |
66
+ | `get_guide` | `topic` | A guide as markdown: `design`, `conventions`, `theming`, `auth-flows`, `email`, `native`, `migrating-0.6`, `contributing`, `testing` or `agents`. |
67
67
  | `list_kits` | none | Kits → categories → components, and the page templates. |
68
68
  | `audit_app` | `path` | A read-only audit of an application: findings with file, line, rule, message and a suggested fix. |
69
69
 
@@ -87,6 +87,7 @@ Add `--json` for machine-readable output. `mortar audit` exits with status 1 whe
87
87
  1. **Search.** Before writing UI, find what the kit already has: `search_components`, or `list_kits` to browse. Start from the purpose shell: `AppShell` for application screens, `MarketingHeader` (with `Footer`) for public pages, `DocsShell` for documentation and `AuthLayout` for sign-in and registration.
88
88
  2. **Packet.** Call `get_build_packet` with the components you picked, or with the brief. Compose from it: the contracts list every prop, and the page templates show complete page patterns to follow.
89
89
  3. **Compose.** Use named imports from `@tonycodes-ui/mortar` and the exact props and values in each contract. Keep product names, data, routes, permissions and actions in props and slots. Theme with `ThemeProvider` and tokens (`get_guide theming`). Never copy a component's source, wrap it repeatedly, or override `.m-*` classes or `[data-m-component]` in your CSS.
90
+ For an iOS, iPadOS or Android app, use the SwiftUI package and the Compose library (`get_guide native`). A component's contract names its native equivalent under `native`, and a packet for a native brief lists every component the native libraries have.
90
91
  4. **Audit.** Run `audit_app` (or `npx mortar audit`) and fix what it finds, then run the app's own typecheck and build. Verify in a browser: mobile and desktop, light and dark, keyboard and focus, and loading, empty and error states.
91
92
  5. **Contribute.** If a shared pattern is missing or a component is wrong, fix it in the kit, not in the app. Open a pull request at [github.com/tonycodes/mortar](https://github.com/tonycodes/mortar) following [CONTRIBUTING.md](../CONTRIBUTING.md) and [AGENTS.md](../AGENTS.md) (`get_guide contributing`). Maintainer review and CI decide what merges; agents never approve, merge or publish their own changes.
92
93
 
package/docs/native.md CHANGED
@@ -49,16 +49,23 @@ Button("Cancel", action: cancel).buttonStyle(.mortar(.ghost))
49
49
 
50
50
  A brand is a `MortarTheme`: its light and dark `MortarPalette`s, font family names (registered by the app) and density. Every component reads the palette that matches the colour scheme, and scales its text with Dynamic Type.
51
51
 
52
- | Component | Web equivalent | Notes |
53
- | ---------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
54
- | `MortarButton`, `.buttonStyle(.mortar(_:size:isLoading:))` | Button | `primary` (the default, as on the web), `secondary`, `ghost`, `danger`, `accent`; `sm`, `md`, `lg`; loading; SF Symbol, icon-only with the title as its accessible name. Medium is at least 44pt tall. |
55
- | `MortarBadge` | Badge | Tones `neutral`, `info`, `success`, `warning`, `danger`. |
56
- | `MortarCard` | Card | Title, description, header actions, footer, `compact` or `none` padding, `muted` tone. |
57
- | `MortarTextField` | Input | Label, prompt, hint, error, required marker, secure entry. VoiceOver reads the label as its name, then "required", the error and the hint. |
58
- | `MortarSwitch`, `.toggleStyle(.mortar)` | Switch | The whole row toggles; VoiceOver sees a standard switch. |
59
- | `MortarAvatar` | Avatar | Image URL with initials while loading or on failure, five sizes, circle or square, online or offline status, decorative. |
60
- | `MortarNotice` | Notice | Tone, message, actions, dismiss button, VoiceOver announcement. |
61
- | `MortarEmptyState` | EmptyState | SF Symbol, description, action, dashed, centred or leading. |
52
+ | Component | Web equivalent | Notes |
53
+ | ---------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
54
+ | `MortarButton`, `.buttonStyle(.mortar(_:size:isLoading:))` | Button | `primary` (the default, as on the web), `secondary`, `ghost`, `danger`, `accent`; `sm`, `md`, `lg`; loading; SF Symbol, icon-only with the title as its accessible name. Medium is at least 44pt tall. |
55
+ | `MortarBadge` | Badge | Tones `neutral`, `info`, `success`, `warning`, `danger`. |
56
+ | `MortarCard` | Card | Title, description, header actions, footer, `compact` or `none` padding, `muted` tone. |
57
+ | `MortarTextField` | Input | Label, prompt, hint, error, required marker, secure entry. VoiceOver reads the label as its name, then "required", the error and the hint. |
58
+ | `MortarSwitch`, `.toggleStyle(.mortar)` | Switch | The whole row toggles; VoiceOver sees a standard switch. |
59
+ | `MortarAvatar` | Avatar | Image URL with initials while loading or on failure, five sizes, circle or square, online or offline status, decorative. |
60
+ | `MortarNotice` | Notice | Tone, message, actions, dismiss button, VoiceOver announcement. |
61
+ | `MortarEmptyState` | EmptyState | SF Symbol, description, action, dashed, centred or leading. |
62
+ | `MortarCheckbox` | Checkbox | Label, description, error, required marker. The whole row toggles; VoiceOver reads a checkbox. |
63
+ | `MortarRadioGroup` | RadioGroup | Label, hint, error, options with descriptions and disabled options. |
64
+ | `MortarSegmentedControl` | SegmentedControl | A labelled set of segments; scrolls sideways when they don't fit. |
65
+ | `MortarProgressBar` | ProgressBar | Label, value and total, a value label (a percentage by default), a status tone. |
66
+ | `MortarDivider` | Divider | Optional label, soft line, spacing `none`, `sm`, `md` or `lg`. |
67
+ | `MortarStackedList` | StackedList | Rows with an avatar or SF Symbol, description, trailing text and an action; grouped under headings; chevrons. |
68
+ | `MortarAppShell` | AppShell | Top-level destinations: a tab bar on iPhone, a sidebar on iPad and Mac, each destination in its own navigation stack. |
62
69
 
63
70
  On both platforms the switch sits at the end of its row, after the label, as in iOS and Android settings; on the web it comes first.
64
71
 
@@ -92,17 +99,28 @@ setContent {
92
99
 
93
100
  A brand is a `MortarBrand`: its light and dark `MortarPalette`s, `FontFamily`s and density. `MortarTheme` follows the system's dark theme unless you pass `darkTheme`; components read `Mortar.palette` and `Mortar.brand`. Text sizes are in sp, so they follow the font scale.
94
101
 
95
- The components and their parameters match the SwiftUI table above, with Compose names: `MortarButton`, `MortarBadge`, `MortarCard`, `MortarTextField`, `MortarSwitch`, `MortarAvatar`, `MortarNotice` and `MortarEmptyState`. Differences:
102
+ The components and their parameters match the SwiftUI table above, with Compose names: `MortarButton`, `MortarBadge`, `MortarCard`, `MortarTextField`, `MortarSwitch`, `MortarAvatar`, `MortarNotice`, `MortarEmptyState`, `MortarCheckbox`, `MortarRadioGroup`, `MortarSegmentedControl`, `MortarProgressBar`, `MortarDivider`, `MortarStackedList` and `MortarAppShell`. Differences:
96
103
 
97
104
  - Medium controls and touch targets are 48dp, Material's minimum, instead of 44.
98
105
  - `MortarAvatar` takes a `Painter`: load the picture with your image library (Coil, Glide) and pass null while it loads or when it fails, to show the initials.
99
- - Icons are `ImageVector`s, such as `Icons.Filled.Share`.
106
+ - Icons are `ImageVector`s, such as `Icons.Filled.Share`; a `MortarStackedList` row leads with `MortarListLeading.Avatar` or `MortarListLeading.Icon`.
107
+ - `MortarAppShell` follows Android's window size classes: a bottom navigation bar under 600dp, a navigation rail to 840dp, and a sidebar with the brand name from 840dp.
100
108
  - `MortarNotice(announce = true)` is a live region: polite, or assertive for `Danger`.
101
109
 
102
110
  ### Snapshot tests
103
111
 
104
112
  `native/android/mortar/src/test` holds unit tests and [Paparazzi](https://github.com/cashapp/paparazzi) snapshots of each component on a Pixel 5 in light, dark and twice the font size, and a branded screen on a Pixel C tablet. Paparazzi renders on the JVM, without an emulator, so the references in `src/test/snapshots` match on any machine. The **Mortar for Compose** workflow runs `gradle :mortar:verifyPaparazziDebug` on every change to `native/android`. When it fails, it records what the code renders now and uploads the images as `mortar-compose-snapshots-<sha>` to review and commit. Locally, `gradle -p native/android :mortar:recordPaparazziDebug` does the same.
105
113
 
114
+ ## For agents
115
+
116
+ A component with a native version names it in its manifest:
117
+
118
+ ```json
119
+ "platforms": { "swiftui": "MortarTextField", "compose": "MortarTextField" }
120
+ ```
121
+
122
+ `get_component` shows it as `native`, with each import, and a build packet for a brief about an iOS, iPadOS or Android app adds this guide and a `native` section listing every component the libraries have. `tests/native.test.mjs` checks that each named view or composable exists, and that every public one is named by a manifest.
123
+
106
124
  ## Brands
107
125
 
108
126
  `nativeTheme(brand)` in `src/native-theme.ts` resolves a `BrandDefinition` to literal light and dark palettes the way `tokens.css` resolves it: omitted values keep the defaults or derive from primary, and `color-mix(in oklab, …)` tints are computed in JS. Brand colours must be literal and opaque (hex, `white`, `black`, `rgb()`, `hsl()`, `oklab()` or `oklch()`). Accents use the flat `accent`, not the gradient. Fonts become family names plus a generic family; the app bundles the fonts itself.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonycodes-ui/mortar",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "description": "Mortar: a shared design foundation, application and marketing UI for React and Tailwind.",
5
5
  "type": "module",
6
6
  "files": [
@@ -13,8 +13,9 @@ Mortar is an MIT React 19 + Tailwind 4 UI kit. Its agent tooling ships in the pa
13
13
  2. **Packet.** Call `get_build_packet` with the chosen components or the brief (`npx mortar packet <Name…> --json`, or `--brief "…"`). Start composing when the packet answers the brief; read extra source or guides only for a specific gap (`get_component`, `get_guide`).
14
14
  3. **Compose** following the defaults below.
15
15
  4. **Emails.** Build transactional emails from `@tonycodes-ui/mortar/email` (`get_guide email`), never from the app components.
16
- 5. **Audit.** Run `audit_app` on the application (`npx mortar audit`), fix every error and review the warnings, then rerun it with the app's build and typecheck.
17
- 6. **Verify** in a browser and report the actual results.
16
+ 5. **Native apps.** For iPhone, iPad and Android, use Mortar for SwiftUI and Mortar for Jetpack Compose (`get_guide native`): each component's contract names its native equivalent. Build what they don't have from the platform's own controls, styled with `MortarTokens`.
17
+ 6. **Audit.** Run `audit_app` on the application (`npx mortar audit`), fix every error and review the warnings, then rerun it with the app's build and typecheck.
18
+ 7. **Verify** in a browser and report the actual results.
18
19
 
19
20
  ## Defaults
20
21