Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Support/DocsLabels.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public static function productName(): string
* Null when that version's tree has no versioning page — an unlinked
* label beats one that 404s.
*/
public static function versioningPolicyUrl(): ?string
public static function versioningPolicyUrl(string $fragment = 'version-labels'): ?string
{
return self::pageUrl('getting-started/versioning', 'version-labels');
return self::pageUrl('getting-started/versioning', $fragment);
}

public static function jumpUrl(): ?string
Expand Down
27 changes: 27 additions & 0 deletions config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@
],
],

/*
|--------------------------------------------------------------------------
| Separately Versioned Packages
|--------------------------------------------------------------------------
|
| Packages documented inside a platform's docs that ship on their own
| release line, keyed by the slug a label passes as `package`. Their labels
| name the package and are checked against the package's own released
| versions in the test suite, rather than the platform's.
|
| Labels at or below the baseline don't render. The baseline is whatever
| was current when the platform major shipped (mobile-ui 0.3.0 was current
| when nativephp/mobile 4.0.0 shipped), the same way x.0 never renders for
| the platform itself.
|
| Add the new entry here as part of shipping a release.
|
*/

'packages' => [
'mobile-ui' => [
'name' => 'nativephp/mobile-ui',
'baseline' => '0.3',
'released_versions' => ['0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7'],
],
],

/*
|--------------------------------------------------------------------------
| Jump
Expand Down
16 changes: 15 additions & 1 deletion resources/views/components/docs/version-badge.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'changed' => null,
'deprecated' => null,
'removed' => null,
'package' => null,
])

@php
Expand All @@ -22,9 +23,22 @@
// x.0 never renders — everything in a major's tree was there at x.0
// unless stated otherwise.
$minor = (int) (explode('.', (string) ($state['version'] ?? ''))[1] ?? 0);

// A package on its own release line (config('docs.packages')) is named in
// its labels. Its baseline was current when the platform major shipped, so
// labels at or below it never render, just like x.0. Neither does a
// package missing from the config.
$release = filled($package) ? (config('docs.packages')[$package] ?? null) : null;
@endphp

@if ($state && $minor > 0)
@if ($release && $state && version_compare($state['version'], $release['baseline']) > 0)
<x-docs.badge
:label="$state['prefix'].$package.' '.$state['version']"
:variant="$state['variant']"
:tooltip="$state['verb'].' '.$release['name'].' '.$state['version']"
:href="\App\Support\DocsLabels::versioningPolicyUrl($package.'-labels')"
/>
@elseif (blank($package) && $state && $minor > 0)
<x-docs.badge
:label="$state['prefix'].$state['version']"
:variant="$state['variant']"
Expand Down
1 change: 1 addition & 0 deletions resources/views/docs/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
:changed="$changed ?? null"
:deprecated="$deprecated ?? null"
:removed="$removed ?? null"
:package="$package ?? null"
/>

<x-docs.jump-badge
Expand Down
2 changes: 2 additions & 0 deletions resources/views/docs/mobile/4/edge-components/accordion.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Accordion
order: 90
package: mobile-ui
since: "0.4"
---

## Overview
Expand Down
6 changes: 4 additions & 2 deletions resources/views/docs/mobile/4/edge-components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Slot content is treated as plain text — nested tags are stripped and whitespac
in `config/native-ui.php`) — see [Theming](../digging-deeper/theming)
- `size` - `sm`, `md` (default), `lg`
- `icon` - A leading [icon](icon#icon-name-reference) name (optional)
- `ios-icon` / `android-icon` - Per-platform overrides for the leading icon: an [SF Symbol](icon#ios-sf-symbols)
- `ios-icon` / `android-icon` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for the leading icon: an [SF Symbol](icon#ios-sf-symbols)
name on iOS, a [Material Icon](icon#android-material-icons) name on Android. `icon` is the fallback on whichever
platform has no override — or skip it and declare only per-platform icons. `iosIcon` / `androidIcon` and the
`<native:icon>`-style `ios` / `android` are accepted as aliases
- `icon-trailing` - A trailing [icon](icon#icon-name-reference) name (optional)
- `ios-icon-trailing` / `android-icon-trailing` - Per-platform overrides for the trailing icon, mirroring
- `ios-icon-trailing` / `android-icon-trailing` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for the trailing icon, mirroring
`ios-icon` / `android-icon` (camelCase aliases accepted; no `ios` / `android` shorthand for this slot)
- `font` - Custom font for the label: a `resources/fonts/` file token or a config alias like `accent` (optional, string) — see [Text › Custom fonts](text#custom-fonts)
- `line-height` - Label line height as a multiplier of the font size (optional, float)
Expand Down Expand Up @@ -104,6 +104,8 @@ attributes are intentionally dropped before reaching the renderer.

### Platform icons

<x-docs.version-badge package="mobile-ui" since="0.4" />

When one shared name doesn't map well on both platforms, give each platform its own symbol — an
[SF Symbol](icon#ios-sf-symbols) name on iOS, a [Material Icon](icon#android-material-icons) name on Android:

Expand Down
2 changes: 1 addition & 1 deletion resources/views/docs/mobile/4/edge-components/chip.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fully rounded and can be adjusted with `rounded-*` classes.
- `label` - Chip text (optional, string). Can also be passed as the first argument to `make()`
- `selected` / `value` - Whether the chip is active (optional, boolean, default: `false`)
- `icon` - Leading [icon](icon#icon-name-reference) name (optional, string)
- `ios-icon` / `android-icon` - Per-platform overrides for the leading icon: an [SF Symbol](icon#ios-sf-symbols)
- `ios-icon` / `android-icon` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for the leading icon: an [SF Symbol](icon#ios-sf-symbols)
name on iOS, a [Material Icon](icon#android-material-icons) name on Android. `icon` is the fallback on whichever
platform has no override. Bound `:ios-icon` / `:android-icon` also accept
[enum cases](icon#typed-icon-enums); `iosIcon` / `androidIcon` and `ios` / `android` are accepted as aliases
Expand Down
2 changes: 2 additions & 0 deletions resources/views/docs/mobile/4/edge-components/pager.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Pager
order: 312
package: mobile-ui
since: "0.5"
---

## Overview
Expand Down
2 changes: 1 addition & 1 deletion resources/views/docs/mobile/4/edge-components/tab-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Here `currentTab` stands in for `public int $currentTab = 0;` on your component.

- `label` - Tab label (required, string). Can also be passed as the first argument to `make()`
- `icon` - Optional [icon](icon#icon-name-reference) name rendered above the label
- `ios-icon` / `android-icon` - Per-platform overrides for the tab icon: an [SF Symbol](icon#ios-sf-symbols) name
- `ios-icon` / `android-icon` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for the tab icon: an [SF Symbol](icon#ios-sf-symbols) name
on iOS, a [Material Icon](icon#android-material-icons) name on Android. `icon` is the fallback on whichever
platform has no override. Bound `:ios-icon` / `:android-icon` also accept
[enum cases](icon#typed-icon-enums); `iosIcon` / `androidIcon` and `ios` / `android` are accepted as aliases
Expand Down
20 changes: 13 additions & 7 deletions resources/views/docs/mobile/4/edge-components/text-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ All three variants accept the same shared prop set. The bare variant adds a `col
- `keyboard` - Keyboard hint string: `text` (default), `number`, `email`, `phone`, `url`, `decimal`, `password`,
`numberPassword`. On iOS `password` uses the standard keyboard; `secure` is the masking mechanism. The keyboard
type also decides capitalization and autocorrect — see [Capitalization](#capitalization)
- `autocapitalize` - Override that capitalization: `none`, `sentences`, `words`, or `characters` (HTML's
- `autocapitalize` <x-docs.version-badge package="mobile-ui" since="0.5" /> - Override that capitalization: `none`, `sentences`, `words`, or `characters` (HTML's
vocabulary). Leave it unset to let `keyboard` decide (optional, string)
- `secure` - Mask input for passwords (optional, boolean, default: `false`)
- `multiline` - Allow multiple lines (optional, boolean, default: `false`)
Expand All @@ -73,7 +73,7 @@ All three variants accept the same shared prop set. The bare variant adds a `col
- `sync-mode` - How change events dispatch back to your component: `live` (default), `blur`, or `debounce`. Usually
set via the `native:model` modifiers below, but accepted directly too
- `debounce-ms` - Milliseconds of inactivity before a `debounce` sync fires (optional, int, default: `300`)
- `selection-debounce-ms` - Coalescing window for `@selectionChange` events (optional, int, default: `150`). `0` or
- `selection-debounce-ms` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Coalescing window for `@selectionChange` events (optional, int, default: `150`). `0` or
less means the default; positive values are floored at one frame (16ms). See
[Caret and selection reporting](#caret-and-selection-reporting)

Expand All @@ -83,9 +83,9 @@ All three variants accept the same shared prop set. The bare variant adds a `col
- `suffix` - Text rendered after the input (optional, string)
- `leading-icon` - Icon name rendered at the start (optional, string)
- `trailing-icon` - Icon name rendered at the end (optional, string)
- `ios-leading-icon` / `android-leading-icon` - Per-platform overrides for `leading-icon` (optional). See
- `ios-leading-icon` / `android-leading-icon` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for `leading-icon` (optional). See
[Per-platform icons](#per-platform-icons)
- `ios-trailing-icon` / `android-trailing-icon` - Per-platform overrides for `trailing-icon` (optional)
- `ios-trailing-icon` / `android-trailing-icon` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Per-platform overrides for `trailing-icon` (optional)

### Typography

Expand All @@ -101,6 +101,8 @@ All three variants accept the same shared prop set. The bare variant adds a `col

## Capitalization

<x-docs.version-badge package="mobile-ui" since="0.5" />

Declaring a `keyboard` type carries its typing behaviour with it, not just the key layout. Fields whose content is
case-sensitive or non-alphabetic never capitalize, and never autocorrect:

Expand Down Expand Up @@ -140,7 +142,7 @@ own default, left as-is. Set `autocapitalize` explicitly when you need the two t

- `@change` - Component method called when the text changes. Receives the new value
- `@submit` - Component method called when the user submits (e.g. presses return). Receives the current value
- `@selectionChange` - Component method called when the caret moves or the selection changes. Receives the full
- `@selectionChange` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Component method called when the caret moves or the selection changes. Receives the full
current text plus the selection start and end offsets — see
[Caret and selection reporting](#caret-and-selection-reporting)

Expand Down Expand Up @@ -186,6 +188,8 @@ automatically, so the `@{{ $name }}` echo updates as you type.

## Caret and selection reporting

<x-docs.version-badge package="mobile-ui" since="0.4" />

`@selectionChange` reports caret position and text selection back to your component — for the cases where `@change`
alone can't tell you *where* the user is typing. The handler receives the full current text plus the selection range:

Expand Down Expand Up @@ -266,6 +270,8 @@ Caret and selection reporting requires `nativephp/mobile` 4.0+, which ships the

## Per-platform icons

<x-docs.version-badge package="mobile-ui" since="0.4" />

The shared `leading-icon` / `trailing-icon` names render the same icon on both platforms. When each platform should
show its own symbol, prefix the attribute with the platform — the same convention as
[`<native:button>`](button)'s `ios-icon`:
Expand Down Expand Up @@ -471,9 +477,9 @@ All three elements share the same fluent API (defined on `BaseTextInput`):
- `font(string $name)` - Custom font (file token or config alias)
- `a11yLabel(string $value)`, `a11yHint(string $value)`
- `syncMode(string $mode)`, `debounceMs(int $ms)`
- `selectionDebounceMs(int $ms)` - Coalescing window for `@selectionChange` events (150ms when unset; `0` or less
- `selectionDebounceMs(int $ms)` <x-docs.version-badge package="mobile-ui" since="0.4" /> - Coalescing window for `@selectionChange` events (150ms when unset; `0` or less
means the default, positive values floored at 16ms)
- `onChange(string $method)`, `onSubmit(string $method)`, `onSelectionChange(string $method)`
- `onChange(string $method)`, `onSubmit(string $method)`, `onSelectionChange(string $method)` <x-docs.version-badge package="mobile-ui" since="0.4" />

`BareTextInput` adds one method on top of the shared API:

Expand Down
10 changes: 6 additions & 4 deletions resources/views/docs/mobile/4/edge-components/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ and is available fluently as `->font('Inter-Bold')`.

### Downloading from Google Fonts

<x-docs.version-badge package="mobile-ui" changed="0.4" />

The `native:font` command downloads a [Google Fonts](https://fonts.google.com)
family into `resources/fonts/` and registers it in your config — no API key
needed:
Expand All @@ -99,9 +101,9 @@ whether one style should become the app-wide `default`. Google Fonts are
libre-licensed (OFL / Apache), so bundling them in your app is permitted.

- `--default` — make the downloaded font the app-wide `default` alias without asking
- `--force` — overwrite files that already exist in `resources/fonts/` (and skip the `--reset` confirmation)
- `--reset` — delete every font file in `resources/fonts/` and reset the config to `'default' => 'System'` (asks first)
- `--clear-cache` — clear the cached catalog (the family list is cached for 24 hours)
- `--force` <x-docs.version-badge package="mobile-ui" since="0.4" /> — overwrite files that already exist in `resources/fonts/` (and skip the `--reset` confirmation)
- `--reset` <x-docs.version-badge package="mobile-ui" since="0.4" /> — delete every font file in `resources/fonts/` and reset the config to `'default' => 'System'` (asks first)
- `--clear-cache` <x-docs.version-badge package="mobile-ui" since="0.4" /> — clear the cached catalog (the family list is cached for 24 hours)

Non-interactive runs (`--no-interaction`, CI) require the family argument,
download only Regular (400) — or the first listed style for families without
Expand Down Expand Up @@ -140,7 +142,7 @@ explicit `font-serif` / `font-mono` classes still win over it. Swapping a font
app-wide becomes a one-line config change; blades keep their semantic names.
Each alias must point directly at a file token (no alias-to-alias chaining).

`native:font` maintains this array for you — every downloaded style gets an
`native:font` <x-docs.version-badge package="mobile-ui" changed="0.4" /> maintains this array for you — every downloaded style gets an
entry, and the `--default` flag (or the prompt) sets `default`. Prefer aliases
over the older `font-family` theme token (which `fonts.default` supersedes when
both are set); `native:font --default` only falls back to writing `font-family`
Expand Down
24 changes: 24 additions & 0 deletions resources/views/docs/mobile/4/getting-started/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,30 @@ render on your phone when you scan a QR code. Where that's the case, you'll see:
These disappear on their own as Jump catches up. Pages carrying one don't offer the "Preview in Jump" QR code, since
scanning it wouldn't show you the component.

### mobile-ui labels

The [EDGE components](../edge-components/introduction) ship in `nativephp/mobile-ui`, which has its own version
numbers. Anything on those pages without a label has been there since mobile-ui 0.3, the release that shipped
alongside 4.0. Later additions and changes carry one of these labels:

| Label | Meaning |
|-------|---------|
| <x-docs.version-badge package="mobile-ui" since="0.6" /> | Added in that mobile-ui release. Upgrade mobile-ui to at least that version to use it |
| <x-docs.version-badge package="mobile-ui" changed="0.6" /> | Behaviour or signature changed in that release. Check it against what your app relies on before upgrading |
| <x-docs.version-badge package="mobile-ui" deprecated="0.6" /> | Still works, but slated for removal. Move off it when convenient |
| <x-docs.version-badge package="mobile-ui" removed="0.6" /> | Gone as of that release. Documented only so you know what replaced it |

Because mobile-ui is still on 0.x, Composer treats each minor release like a major one, so a `^0.5` constraint never
installs 0.6. Raise the constraint to pick up a newer release:

```shell
composer require nativephp/mobile-ui:^0.6
```

Then [rebuild your app](../plugins/using-plugins#rebuild-your-app), because the components' renderers are native code
compiled in at build time. Newer mobile-ui releases can need a newer `nativephp/mobile` too (0.5 and later need 4.5),
and Composer will say so.

## Your application versioning

Just because we're using semantic versioning for the `nativephp/mobile` package, doesn't mean your app must follow that
Expand Down
Loading
Loading