@tonycodes-ui/mortar 0.20.0 → 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/CHANGELOG.md +2 -2
- package/catalog.json +179 -119
- package/cli/data.mjs +5 -0
- package/cli/mcp.mjs +1 -1
- package/cli/packet.mjs +51 -0
- package/dist/agent-data.json +1 -1
- package/docs/agents.md +2 -1
- package/docs/native.md +10 -0
- package/package.json +1 -1
- package/skills/mortar/SKILL.md +3 -2
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
|
@@ -111,6 +111,16 @@ The components and their parameters match the SwiftUI table above, with Compose
|
|
|
111
111
|
|
|
112
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.
|
|
113
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
|
+
|
|
114
124
|
## Brands
|
|
115
125
|
|
|
116
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
package/skills/mortar/SKILL.md
CHANGED
|
@@ -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. **
|
|
17
|
-
6. **
|
|
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
|
|