@tonycodes-ui/mortar 0.20.0 → 0.22.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
@@ -77,16 +77,40 @@ Rendering differs between iOS versions, so the reference images are recorded on
77
77
 
78
78
  ## Jetpack Compose
79
79
 
80
- The library is in `native/android` (module `mortar`, package `codes.tony.mortar`) for Android 7.0 (API 24) and later. Until its Maven repository is chosen ([#95](https://github.com/tonycodes/mortar/issues/95)), build it into your local Maven repository with Gradle 8.11 and JDK 17:
80
+ The library is in `native/android` (module `mortar`, package `codes.tony.mortar`) for Android 7.0 (API 24) and later. Each Mortar release publishes it to [GitHub Packages](https://github.com/tonycodes/mortar/packages) at the npm package's version. GitHub's Maven registry asks for a token even for public packages, so add the repository in `settings.gradle.kts` with a GitHub username and a personal access token that has `read:packages`, kept out of source control (here in `~/.gradle/gradle.properties`):
81
81
 
82
- ```sh
83
- gradle -p native/android :mortar:publishToMavenLocal -Pversion=0.0.0-local
82
+ ```kotlin
83
+ dependencyResolutionManagement {
84
+ repositories {
85
+ google()
86
+ mavenCentral()
87
+ maven("https://maven.pkg.github.com/tonycodes/mortar") {
88
+ credentials {
89
+ username = providers.gradleProperty("gpr.user").get()
90
+ password = providers.gradleProperty("gpr.key").get()
91
+ }
92
+ }
93
+ }
94
+ }
84
95
  ```
85
96
 
97
+ Then the dependency, at the same version as `@tonycodes-ui/mortar`:
98
+
86
99
  ```kotlin
87
- implementation("codes.tony:mortar:0.0.0-local")
100
+ // The release that adds publishing (#95) is the first in GitHub Packages.
101
+ implementation("codes.tony:mortar:0.21.0")
88
102
  ```
89
103
 
104
+ To try unreleased changes, build the library into your local Maven repository with Gradle 8.11 and JDK 17 and depend on `0.0.0-local`:
105
+
106
+ ```sh
107
+ gradle -p native/android :mortar:publishToMavenLocal -Pversion=0.0.0-local
108
+ ```
109
+
110
+ ### Publishing
111
+
112
+ `.github/workflows/publish-android.yml` runs after each successful **Release package** run on main. It finds the release tag on the released commit (a run that released nothing leaves none), skips a version GitHub Packages already has, and publishes `codes.tony:mortar:<version>` with `gradle :mortar:publishReleasePublicationToGitHubPackagesRepository`. It publishes with the run's own `GITHUB_TOKEN` and `packages: write`, so no secret is stored, and it has no manual trigger, so a version is only published from its release. The release policy test (R-AR-17) keeps it that way: read-only contents, no ref writes, no secrets.
113
+
90
114
  Theme the app once near its root, then use the components:
91
115
 
92
116
  ```kotlin
@@ -111,6 +135,16 @@ The components and their parameters match the SwiftUI table above, with Compose
111
135
 
112
136
  `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.
113
137
 
138
+ ## For agents
139
+
140
+ A component with a native version names it in its manifest:
141
+
142
+ ```json
143
+ "platforms": { "swiftui": "MortarTextField", "compose": "MortarTextField" }
144
+ ```
145
+
146
+ `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.
147
+
114
148
  ## Brands
115
149
 
116
150
  `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.20.0",
3
+ "version": "0.22.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