@rdlabo/ionic-theme-ios27 1.2.0-beta.pr242.sha99c4a2ec4d6a → 1.2.0-beta.pr246.sha237333ceac21
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/README.md +8 -7
- package/dist/css/ionic-theme-ios27.css +1 -1
- package/dist/css/vertical-bars.css +1 -1
- package/dist/native/components/ion-buttons.js +1 -1
- package/dist/native/components/ion-buttons.js.map +1 -1
- package/dist/native/components/ion-menu-button.d.ts +2 -1
- package/dist/native/components/ion-menu-button.d.ts.map +1 -1
- package/dist/native/components/ion-menu-button.js +2 -2
- package/dist/native/components/ion-menu-button.js.map +1 -1
- package/dist/native/definitions.d.ts +1 -0
- package/dist/native/definitions.d.ts.map +1 -1
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js +4 -3
- package/dist/native/index.js.map +1 -1
- package/dist/native/prehide.js +2 -0
- package/dist/native/prehide.js.map +1 -1
- package/dist/native/shared/candidate.d.ts +1 -0
- package/dist/native/shared/candidate.d.ts.map +1 -1
- package/dist/native/shared/candidate.js +7 -2
- package/dist/native/shared/candidate.js.map +1 -1
- package/dist/native/shared/dom.d.ts +1 -1
- package/dist/native/shared/dom.js +4 -4
- package/dist/native/shared/dom.js.map +1 -1
- package/docs/features.md +2 -2
- package/docs/iphone-duo-with-original-theme.md +20 -18
- package/docs/iphone-duo.md +11 -158
- package/docs/native-ui-shell.md +15 -13
- package/docs/special-markup.md +4 -2
- package/docs/vertical-bars.md +283 -0
- package/package.json +2 -2
- package/src/native/components/ion-buttons.ts +1 -1
- package/src/native/components/ion-menu-button.ts +3 -2
- package/src/native/definitions.ts +14 -6
- package/src/native/index.ts +5 -3
- package/src/native/prehide.ts +3 -1
- package/src/native/shared/candidate.ts +21 -2
- package/src/native/shared/dom.ts +4 -4
- package/src/styles/vertical-bars.scss +3 -2
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Vertical Bars (preview)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Vertical Bars (preview)
|
|
6
|
+
|
|
7
|
+
Vertical Bars moves eligible Ionic navigation and actions into a side rail while keeping the original components as the source of labels, icons and behavior. It works with this theme or an existing Ionic theme, independently of hinge posture and the full Native UI Shell.
|
|
8
|
+
|
|
9
|
+
Use this page for layout, control eligibility, native button appearance and the runtime API. For device events and split panes, see [iPhone Duo support](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/iphone-duo). For a step-by-step browser preview and native setup, start with [iPhone Duo with your existing theme](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/iphone-duo-with-original-theme).
|
|
10
|
+
|
|
11
|
+
Available in `1.2.0` as a **preview** feature. APIs and supported behavior may change.
|
|
12
|
+
|
|
13
|
+
## Enable Vertical Bars
|
|
14
|
+
|
|
15
|
+
Load the opt-in stylesheet:
|
|
16
|
+
|
|
17
|
+
```scss
|
|
18
|
+
@use '@rdlabo/ionic-theme-ios27/dist/css/vertical-bars.css';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
After `ion-app` is mounted, start one runtime:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { enableVerticalControlArea } from '@rdlabo/ionic-theme-ios27/vertical-bars';
|
|
25
|
+
|
|
26
|
+
const rail = await enableVerticalControlArea();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add the layout class below for browser simulation, or [apply device placement](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/iphone-duo#project-controls-into-the-rail) for an iPhone Duo. The application owns placement and cleanup: call `await rail.destroy()` when its owner is disposed. If you already use `enableNativeUIShell()`, keep that runtime; it includes Vertical Bars. Do not start both.
|
|
30
|
+
|
|
31
|
+
The `/vertical-bars` entry point requires `@capacitor/core`, including in browser builds. CSS-only use needs no runtime. For native setup and navigation transitions, follow the [existing-theme guide](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/iphone-duo-with-original-theme).
|
|
32
|
+
|
|
33
|
+
On supported Capacitor iOS, eligible controls use native SwiftUI rendering. Web, Android and unavailable native projection use Web clones. A browser preview can verify layout and actions, but cannot compare native button appearance.
|
|
34
|
+
|
|
35
|
+
## Reserve the vertical rail
|
|
36
|
+
|
|
37
|
+
Add `.ios-theme-vertical-bars` to `ion-app` to reserve the rail region on the physical right, or add `.ios-theme-vertical-bars-left` as well to use the physical left:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<ion-app class="ios-theme-vertical-bars">...</ion-app>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The classes are physical — `-left` always means the physical left edge — because CSS and the native renderer work in physical coordinates. `setVerticalControlAreaPlacement` applies the logical `verticalBarEdge` reported by the device plugin and resolves it through the document's direction, so an RTL app does not need its own conversion.
|
|
44
|
+
|
|
45
|
+
For Chrome development, no native plugin is needed — the class alone reserves `80px` to simulate iPhone Duo. When `setVerticalControlAreaPlacement` receives `{ edge, nativeEdge, inset }`, the inset replaces the fallback width, even when it is less than `80px`. Override `--ios-theme-vertical-bars-safe-area-left` or `--ios-theme-vertical-bars-safe-area-right` when simulating a different layout.
|
|
46
|
+
|
|
47
|
+
This keeps routers and component backgrounds full-viewport. `ion-content` moves its scroll foreground, `ion-toolbar` moves its container foreground, and `ion-fab` adjusts only when placed beside the system UI. The corresponding Ionic safe-area variable is reset inside those foreground components so descendants do not add the inset again.
|
|
48
|
+
|
|
49
|
+
`ion-modal` applies the same foreground correction when its visible dialog spans the viewport width. With the Vertical Control Area runtime enabled, the topmost full-width modal also projects eligible toolbar buttons into its own rail; centered dialogs keep their toolbar buttons and receive no page-rail inset. This includes full-width sheet modals: their rail follows the visible sheet bounds as the breakpoint changes. Eligibility follows the visible dialog width, not the hinge posture or modal type. `ion-menu` and `ion-popover` are handled as separate surfaces: their internal foreground components do not receive the main-page conversion and retain Ionic's standard safe-area handling. A menu presented beside the system UI keeps Ionic's full-viewport animation host and offsets only its visible container by the corresponding inset; a menu from the opposite side is unchanged. Left and right remain physical coordinates in RTL, while Ionic's `side="start"` and `side="end"` values remain logical.
|
|
50
|
+
|
|
51
|
+
The mode is component-mode independent: an app can keep Ionic `mode: 'md'` on iOS and still enable Vertical Bars. No component needs `mode="ios"`.
|
|
52
|
+
|
|
53
|
+
## Native rendering
|
|
54
|
+
|
|
55
|
+
On supported iOS versions, adding `.ios-theme-vertical-bars` changes only controls that the system relocates into the physical side rail. Native UI Shell presents eligible tabs, back navigation, menu buttons, and toolbar actions through a SwiftUI `TabView` and toolbar once the class is applied. When the OS reports a rail edge — on iPhone Duo linked against iOS 27.1 or later — it must agree with the applied placement; a disagreeing report keeps the rail on the Web. Older toolchains that cannot report an edge trust the DOM placement directly. SwiftUI owns their adaptive placement and Liquid Glass appearance; Ionic remains the source of labels, icons, selected/disabled state, routing, form submission, and click handlers.
|
|
56
|
+
|
|
57
|
+
The SwiftUI surface is clipped and hit-tested to the system rail. Web content remains visible and interactive outside that physical region. The runtime optimistically updates tab selection before forwarding the action to the original `ion-tab-button`, using the same event and stale-revision protection as the other native controls. Overlay layout follows the [rail reservation rules](#reserve-the-vertical-rail).
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Toolbar actions
|
|
61
|
+
|
|
62
|
+
A standard `ion-back-button` can project from outside a fixed toolbar, including routed content or a persistent app shell. `ion-menu-button` and other toolbar actions require a fixed toolbar.
|
|
63
|
+
|
|
64
|
+
An `ion-button` moves into the rail when it contains an `ion-icon` or SVG with `slot="icon-only"`. The button must be in a fixed `ion-toolbar` directly inside `ion-header` or `ion-footer`, outside scrolling `ion-content`.
|
|
65
|
+
|
|
66
|
+
| Icon markup | Placement |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `slot="icon-only"` | Vertical rail |
|
|
69
|
+
| `slot="start"`, `slot="end"`, or no slot | Original horizontal toolbar |
|
|
70
|
+
| No icon | Original horizontal toolbar |
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<ion-header>
|
|
74
|
+
<ion-toolbar>
|
|
75
|
+
<ion-buttons slot="end">
|
|
76
|
+
<ion-button aria-label="Done">
|
|
77
|
+
<ion-icon name="checkmark-outline" slot="icon-only"></ion-icon>
|
|
78
|
+
</ion-button>
|
|
79
|
+
</ion-buttons>
|
|
80
|
+
</ion-toolbar>
|
|
81
|
+
</ion-header>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
All fills (`default`, `clear`, `solid`, and `outline`) and Ionic colors follow this placement rule. Keep accessible names and the original click or form-submit handlers on the source buttons. `type="submit"` and `.button-submit` do not select a different placement.
|
|
85
|
+
|
|
86
|
+
The rule applies to individual buttons and buttons inside `ion-buttons`, on ordinary pages and in the topmost full-width modal. Centered modals, menus, and popovers keep their own toolbar layout. Add `.ios-theme-horizontal-only` to a group or individual button to keep it horizontal. Placement is chosen when a routed page enters; changing an existing button's content or icon slot does not move it between the toolbar and rail until the page leaves and re-enters.
|
|
87
|
+
|
|
88
|
+
### Choose button appearance
|
|
89
|
+
|
|
90
|
+
`buttonProjection` and the local projection settings below are available in `1.2.0`.
|
|
91
|
+
|
|
92
|
+
For native vertical `ion-button` and `ion-menu-button` actions, choose who controls appearance:
|
|
93
|
+
|
|
94
|
+
| `buttonProjection` | Appearance |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `'system'` (default) | SwiftUI styles the buttons and tints their icons. Ionic fill, colors and borders are not applied. |
|
|
97
|
+
| `'source'` | Projects the supported Ionic fill and computed colors described in [Source fill rules](#source-fill-rules). |
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const rail = await enableVerticalControlArea({ buttonProjection: 'source' });
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Both `enableVerticalControlArea()` and `enableNativeUIShell()` accept the option. Use one runtime, and destroy it before restarting with different options. Either mode preserves actions, disabled state and grouping. These appearance settings do not affect horizontal controls, source elements or Web fallback clones, so compare the native appearance on supported iOS.
|
|
104
|
+
|
|
105
|
+
**Migration from the experimental releases:** the default changes from source styling to `system`. Set `buttonProjection: 'source'` to retain the previous projection behavior.
|
|
106
|
+
|
|
107
|
+
### Override individual buttons or groups
|
|
108
|
+
|
|
109
|
+
Use `data-projection` for local exceptions. Existing classes remain supported:
|
|
110
|
+
|
|
111
|
+
| Attribute | Equivalent class |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `data-projection="source"` | `ios-theme-projection-source` |
|
|
114
|
+
| `data-projection="system"` | `ios-theme-projection-system` |
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<ion-buttons data-projection="source">
|
|
118
|
+
<ion-button fill="solid" aria-label="Add">
|
|
119
|
+
<ion-icon name="add-outline" slot="icon-only"></ion-icon>
|
|
120
|
+
</ion-button>
|
|
121
|
+
<ion-button data-projection="system" aria-label="Search">
|
|
122
|
+
<ion-icon name="search-outline" slot="icon-only"></ion-icon>
|
|
123
|
+
</ion-button>
|
|
124
|
+
</ion-buttons>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The first matching setting wins:
|
|
128
|
+
|
|
129
|
+
1. The button's local setting.
|
|
130
|
+
2. Its nearest `ion-buttons` local setting.
|
|
131
|
+
3. The startup `buttonProjection` option, or `system` if omitted.
|
|
132
|
+
|
|
133
|
+
On the same element, a valid `data-projection` value takes precedence over the classes. Empty or unknown values are ignored. Without a valid attribute, `system` wins if both classes are present. Removing an attribute falls back to the element's classes, then the next level above. Attribute and class changes apply without restarting the runtime; grouping and placement stay unchanged.
|
|
134
|
+
|
|
135
|
+
Only native vertical `ion-button` and `ion-menu-button` actions interpret these settings. Other ancestors, back buttons, tabs and FABs do not. They do not change Web styling. To keep a control or subtree on the Web entirely, use [`data-shell="disabled"`](https://docs.rdlabo.dev/projects/ionic-theme-ios27/docs/native-ui-shell#supported-markup).
|
|
136
|
+
|
|
137
|
+
### Source fill rules
|
|
138
|
+
|
|
139
|
+
For an `ion-button` resolved to `source`, fill is chosen separately from the projection mode:
|
|
140
|
+
|
|
141
|
+
| Button | Effective fill |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| Explicit `fill="clear"`, `"solid"` or `"outline"` | The explicit value |
|
|
144
|
+
| Omitted fill or `fill="default"` inside `ion-buttons` | `clear` |
|
|
145
|
+
| Omitted fill or `fill="default"` outside `ion-buttons` | `buttonDefaultFill` |
|
|
146
|
+
|
|
147
|
+
`buttonDefaultFill` accepts only `'solid'` or `null`; omission is equivalent to `null`. Use `'solid'` for Ionic's default button design, or `null` for this theme's default glass design. It applies to every button resolved to `source`, including a local exception under a global `system` setting.
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
// Keep system styling globally; local source buttons use Ionic's default fill.
|
|
151
|
+
const rail = await enableVerticalControlArea({ buttonDefaultFill: 'solid' });
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<!-- In a fixed toolbar, outside ion-buttons: omitted fill resolves to solid. -->
|
|
156
|
+
<ion-button data-projection="source" aria-label="Add">
|
|
157
|
+
<ion-icon name="add-outline" slot="icon-only"></ion-icon>
|
|
158
|
+
</ion-button>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
| Effective fill | Native appearance in `source` mode |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `clear` | Icon color, without a glass background; CSS backgrounds are ignored |
|
|
164
|
+
| `solid` | Computed background color tints a prominent glass button |
|
|
165
|
+
| `outline` | Computed border color and width, with native glass |
|
|
166
|
+
| `null` | Native glass with source icon colors |
|
|
167
|
+
|
|
168
|
+
Inside `ion-buttons`, explicitly set `fill="solid"` to project a background; `buttonDefaultFill: 'solid'` does not override the group's clear default. Native Liquid Glass tinting can differ from the CSS color, especially for translucent backgrounds. With the iOS theme, ordinary `ion-buttons` retain group projection; `ion-buttons.ios-theme-disabled` projects eligible buttons individually. Local projection settings do not change that grouping rule.
|
|
169
|
+
|
|
170
|
+
## Tab bar
|
|
171
|
+
|
|
172
|
+
When the app contains `ion-tabs`, its tab bar moves into the reserved region and uses the native Duo edge spacing; the Ionic `slot` value does not select a different position. Without native projection, the stable Web rail is icon-only, matching the native resting presentation. While the user presses and drags across that rail, every icon-and-label tab reveals its label so the pending destination stays identifiable. The Web tab bar receives pointer input in the simulated system region. Native tabs and a restored Web tab bar fade in over 180ms; disappearance remains immediate. Reduced motion disables this fade. Use `ion-menu` when navigation should become a sidebar; this mode does not convert tabs into a menu. Web clones also work when no `ion-tabs` exists. Disabling the mode or leaving the page removes the native ownership or Web clones and restores their sources. Override `--ios-theme-vertical-bars-toolbar-top` when the simulated system controls use a different vertical layout.
|
|
173
|
+
|
|
174
|
+
## Vertical Control Area API
|
|
175
|
+
|
|
176
|
+
The generated reference below documents the handle returned by `enableVerticalControlArea()`.
|
|
177
|
+
|
|
178
|
+
<docgen-index>
|
|
179
|
+
|
|
180
|
+
* [`setPlacement(...)`](#setplacement)
|
|
181
|
+
* [`getStatus()`](#getstatus)
|
|
182
|
+
* [`suspend()`](#suspend)
|
|
183
|
+
* [`destroy()`](#destroy)
|
|
184
|
+
* [Interfaces](#interfaces)
|
|
185
|
+
* [Type Aliases](#type-aliases)
|
|
186
|
+
|
|
187
|
+
</docgen-index>
|
|
188
|
+
|
|
189
|
+
<docgen-api>
|
|
190
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
191
|
+
|
|
192
|
+
### setPlacement(...)
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
setPlacement(placement: VerticalBarEdge | VerticalBarPlacement, rtl?: boolean | undefined) => void
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Applies the application's chosen placement to both Web and native controls.
|
|
199
|
+
|
|
200
|
+
| Param | Type |
|
|
201
|
+
| --------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| **`placement`** | <code><a href="#verticalbaredge">VerticalBarEdge</a> \| <a href="#verticalbarplacement">VerticalBarPlacement</a></code> |
|
|
203
|
+
| **`rtl`** | <code>boolean</code> |
|
|
204
|
+
|
|
205
|
+
--------------------
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
### getStatus()
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
getStatus() => NativeUIShellStatus
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Returns the current Web/native projection state.
|
|
215
|
+
|
|
216
|
+
**Returns:** <code><a href="#nativeuishellstatus">NativeUIShellStatus</a></code>
|
|
217
|
+
|
|
218
|
+
--------------------
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
### suspend()
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
suspend() => Promise<NativeUIShellSuspension>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Restores projected controls to the Web until the returned lease is resumed.
|
|
228
|
+
|
|
229
|
+
**Returns:** <code>Promise<<a href="#nativeuishellsuspension">NativeUIShellSuspension</a>></code>
|
|
230
|
+
|
|
231
|
+
--------------------
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
### destroy()
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
destroy() => Promise<void>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Stops synchronization, restores Web controls and releases native resources.
|
|
241
|
+
|
|
242
|
+
--------------------
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
### Interfaces
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
#### VerticalBarPlacement
|
|
249
|
+
|
|
250
|
+
| Prop | Type | Description |
|
|
251
|
+
| ---------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
252
|
+
| **`edge`** | <code><a href="#verticalbaredge">VerticalBarEdge</a></code> | |
|
|
253
|
+
| **`inset`** | <code>number</code> | Explicit rail width in CSS pixels; omitted to use the stylesheet's safe-area rules. |
|
|
254
|
+
| **`nativeEdge`** | <code><a href="#verticalbaredge">VerticalBarEdge</a></code> | Native logical edge reported by the application's device plugin. Null or an unregistered edge uses a Web rail in verticalBarsOnly mode, or the ordinary Native UI Shell layout otherwise. Omission keeps the last supplied value. |
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
#### NativeUIShellStatus
|
|
258
|
+
|
|
259
|
+
| Prop | Type |
|
|
260
|
+
| --------------- | ------------------------------------------- |
|
|
261
|
+
| **`state`** | <code>'native' \| 'stopped' \| 'web'</code> |
|
|
262
|
+
| **`projected`** | <code>number</code> |
|
|
263
|
+
| **`updates`** | <code>number</code> |
|
|
264
|
+
| **`reason`** | <code>string</code> |
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
#### NativeUIShellSuspension
|
|
268
|
+
|
|
269
|
+
| Method | Signature | Description |
|
|
270
|
+
| ---------- | ---------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
271
|
+
| **resume** | () => Promise<void> | Releases this suspension. Native projection resumes after all active suspensions are released. |
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
### Type Aliases
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
#### VerticalBarEdge
|
|
278
|
+
|
|
279
|
+
Logical edge in the reading direction, matching UIVerticalBarEdge and capacitor-foldable.
|
|
280
|
+
|
|
281
|
+
<code>'leading' | 'trailing' | null</code>
|
|
282
|
+
|
|
283
|
+
</docgen-api>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdlabo/ionic-theme-ios27",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.0-beta.
|
|
4
|
+
"version": "1.2.0-beta.pr246.sha237333ceac21",
|
|
5
5
|
"description": "iOS27 Theme for Ionic Framework",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"prebuild:css": "rdlabo-copy-structured-list src/styles/utils/structured-list.scss",
|
|
36
36
|
"build:css": "rm -rf dist/css && sass src/styles:dist/css --style=compressed --no-source-map",
|
|
37
37
|
"build:ts": "tsc --noEmit && rdlabo-build-theme",
|
|
38
|
-
"docgen": "docgen --project tsconfig.docgen.json --api NativeUIShellHandle --output-readme docs/native-ui-shell.md && docgen --project tsconfig.docgen.json --api VerticalControlAreaHandle --output-readme docs/
|
|
38
|
+
"docgen": "docgen --project tsconfig.docgen.json --api NativeUIShellHandle --output-readme docs/native-ui-shell.md && docgen --project tsconfig.docgen.json --api VerticalControlAreaHandle --output-readme docs/vertical-bars.md",
|
|
39
39
|
"build:demo": "npm run build && cd demo && npm install && npm run build -- --configuration=production",
|
|
40
40
|
"lint": "prettier --check \"./**/*.{scss,ts}\" && prettier --parser angular --check \"./**/*.html\"",
|
|
41
41
|
"fmt": "prettier --write \"./**/*.{scss,ts}\" && prettier --parser angular --write \"./**/*.html\"",
|
|
@@ -11,7 +11,7 @@ export const tracksMotion = true;
|
|
|
11
11
|
export const read = (element: HTMLElement, id: Identify, options: VerticalControlAreaOptions = {}): Candidate | undefined => {
|
|
12
12
|
if (!inFixedToolbar(element)) return;
|
|
13
13
|
let children = childElements(element);
|
|
14
|
-
if (children.length === 1) return menuButton.read(element, id);
|
|
14
|
+
if (children.length === 1) return menuButton.read(element, id, options);
|
|
15
15
|
const verticalBars =
|
|
16
16
|
!element.closest('ion-menu, ion-popover') && modalUsesVerticalBars(element) && !!element.closest('ion-app.ios-theme-vertical-bars');
|
|
17
17
|
if (verticalBars && !isVerticalBarsToolbarGroup(element)) return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createCandidate, appendItem } from '../shared/candidate';
|
|
2
2
|
import type { Candidate, Identify } from '../shared/candidate';
|
|
3
|
+
import type { VerticalControlAreaOptions } from '../definitions';
|
|
3
4
|
import { childElements, inFixedToolbar } from '../shared/dom';
|
|
4
5
|
|
|
5
6
|
export const tag = 'ion-menu-button';
|
|
@@ -13,11 +14,11 @@ export const append = (candidate: Candidate, button: HTMLIonMenuButtonElement, i
|
|
|
13
14
|
return !!content && !!appendItem(candidate, button, id, content);
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
export const read = (group: HTMLElement, id: Identify): Candidate | undefined => {
|
|
17
|
+
export const read = (group: HTMLElement, id: Identify, options: VerticalControlAreaOptions = {}): Candidate | undefined => {
|
|
17
18
|
const children = group.matches('ion-buttons') ? childElements(group) : [];
|
|
18
19
|
if (!inFixedToolbar(group) || children.length !== 1) return;
|
|
19
20
|
const button = children[0];
|
|
20
21
|
if (!button?.matches(`${tag}${group.closest('ion-app.ios-theme-vertical-bars') ? '' : '.ios'}`)) return;
|
|
21
|
-
const candidate = createCandidate(group, tag, id);
|
|
22
|
+
const candidate = createCandidate(group, tag, id, options);
|
|
22
23
|
return append(candidate, button as HTMLIonMenuButtonElement, id) ? candidate : undefined;
|
|
23
24
|
};
|
|
@@ -11,12 +11,20 @@ export interface NativeUIShellStatus {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface VerticalControlAreaOptions {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
/** Appearance of native vertical ion-button and ion-menu-button actions.
|
|
15
|
+
* `system` (default) uses SwiftUI styling and template icons; `source` projects supported Ionic fill and colors.
|
|
16
|
+
* Local data-projection="source|system" or ios-theme-projection-source / ios-theme-projection-system take precedence:
|
|
17
|
+
* the button itself, then its nearest ion-buttons, then this option. On the same element, a valid attribute wins;
|
|
18
|
+
* otherwise system wins if both classes are present. Invalid attribute values are ignored.
|
|
19
|
+
* Local settings update live; removing them restores inheritance. Actions, disabled state and grouping are preserved.
|
|
20
|
+
* Does not affect back buttons, tabs, FABs, horizontal controls, source elements or Web clones.
|
|
21
|
+
*/
|
|
22
|
+
buttonProjection?: 'source' | 'system';
|
|
23
|
+
/** Default fill for native vertical ion-button actions resolved to `source`, including local overrides.
|
|
24
|
+
* Use `solid` for Ionic's default design, or `null` (also the omitted default) for the iOS theme's glass design.
|
|
25
|
+
* Applies when fill is omitted or `default`, outside ion-buttons. Inside ion-buttons the default is clear.
|
|
26
|
+
* Explicit clear, solid and outline take precedence; clear and outline cannot be configured as defaults.
|
|
27
|
+
* Source elements and Web clones are unchanged.
|
|
20
28
|
*/
|
|
21
29
|
buttonDefaultFill?: 'solid' | null;
|
|
22
30
|
}
|
package/src/native/index.ts
CHANGED
|
@@ -164,12 +164,12 @@ export const setVerticalControlAreaPlacement = (placement: VerticalBarEdge | Ver
|
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Call once after ion-app is mounted. Ionic markup remains the source of truth.
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* This default affects native vertical projection only; explicit button fills win.
|
|
167
|
+
* Native vertical buttons default to SwiftUI appearance.
|
|
168
|
+
* See VerticalControlAreaOptions for source styling and local overrides.
|
|
170
169
|
*/
|
|
171
170
|
export const enableVerticalControlArea = async (options: VerticalControlAreaOptions = {}): Promise<VerticalControlAreaHandle> => {
|
|
172
171
|
const handle = await enableNativeUIShell({
|
|
172
|
+
buttonProjection: options.buttonProjection,
|
|
173
173
|
buttonDefaultFill: options.buttonDefaultFill,
|
|
174
174
|
controls: { tabs: true, toolbar: true },
|
|
175
175
|
verticalBarsOnly: true,
|
|
@@ -199,6 +199,8 @@ export const enableNativeUIShell = (options: NativeUIShellOptions = {}): Promise
|
|
|
199
199
|
const controls = options.controls;
|
|
200
200
|
const configuration = JSON.stringify([
|
|
201
201
|
options.verticalBarsOnly === true,
|
|
202
|
+
options.buttonProjection ?? 'system',
|
|
203
|
+
// Local source overrides can use this even when the startup projection is system.
|
|
202
204
|
options.buttonDefaultFill ?? null,
|
|
203
205
|
...(['tabs', 'toolbar', 'segment', 'fab'] as const).map((component) => !controls || controls[component] === true),
|
|
204
206
|
]);
|
package/src/native/prehide.ts
CHANGED
|
@@ -74,6 +74,8 @@ export const prehideVerticalBarsToolbarSources = (doc: Document): { suspend: ()
|
|
|
74
74
|
};
|
|
75
75
|
const sources = scope.matches('ion-back-button') ? [scope] : Array.from(scope.querySelectorAll<HTMLElement>(sourceSelector));
|
|
76
76
|
sources.forEach((element) => {
|
|
77
|
+
// Shell opt-out is temporary; decide initial placement once it is lifted.
|
|
78
|
+
if (isShellDisabled(element)) return;
|
|
77
79
|
if (!modalUsesVerticalBars(element) || element.closest(overlays) || (scope.matches('.ion-page') && routedPage(element) !== scope))
|
|
78
80
|
return;
|
|
79
81
|
if (element.matches('ion-buttons')) {
|
|
@@ -228,7 +230,7 @@ export const prehideVerticalBarsToolbarSources = (doc: Document): { suspend: ()
|
|
|
228
230
|
childList: true,
|
|
229
231
|
attributes: true,
|
|
230
232
|
attributeOldValue: true,
|
|
231
|
-
attributeFilter: ['class', 'hidden', 'inert', 'icon', 'color'],
|
|
233
|
+
attributeFilter: ['class', 'data-shell', 'hidden', 'inert', 'icon', 'color'],
|
|
232
234
|
});
|
|
233
235
|
return {
|
|
234
236
|
suspend: () => {
|
|
@@ -3,6 +3,7 @@ import { frame, isDark, isVerticalBarsSource, text, visible } from './dom';
|
|
|
3
3
|
import { iconSource } from './icons';
|
|
4
4
|
|
|
5
5
|
export interface Candidate {
|
|
6
|
+
buttonProjection?: VerticalControlAreaOptions['buttonProjection'];
|
|
6
7
|
buttonDefaultFill?: VerticalControlAreaOptions['buttonDefaultFill'];
|
|
7
8
|
element: HTMLElement;
|
|
8
9
|
sources?: HTMLElement[];
|
|
@@ -24,6 +25,7 @@ export const createCandidate = (
|
|
|
24
25
|
const style = getComputedStyle(element);
|
|
25
26
|
return {
|
|
26
27
|
element,
|
|
28
|
+
buttonProjection: options.buttonProjection,
|
|
27
29
|
buttonDefaultFill: options.buttonDefaultFill,
|
|
28
30
|
control: {
|
|
29
31
|
id: id(element),
|
|
@@ -62,11 +64,27 @@ export const appendItem = (
|
|
|
62
64
|
const badge = child.querySelector<HTMLElement>('ion-badge');
|
|
63
65
|
const badgeStyle = badge && visible(badge) ? getComputedStyle(badge) : undefined;
|
|
64
66
|
const sourceFill = (child as HTMLIonButtonElement).fill;
|
|
67
|
+
const projectionOwner = [child, child.closest('ion-buttons')].find((element) =>
|
|
68
|
+
element?.matches('[data-projection="source"], [data-projection="system"], .ios-theme-projection-source, .ios-theme-projection-system'),
|
|
69
|
+
);
|
|
70
|
+
const attributeProjection = projectionOwner?.getAttribute('data-projection');
|
|
71
|
+
const projection =
|
|
72
|
+
attributeProjection === 'source' || attributeProjection === 'system'
|
|
73
|
+
? attributeProjection
|
|
74
|
+
: projectionOwner
|
|
75
|
+
? projectionOwner.classList.contains('ios-theme-projection-system')
|
|
76
|
+
? 'system'
|
|
77
|
+
: 'source'
|
|
78
|
+
: candidate.buttonProjection;
|
|
79
|
+
const systemButton = projection !== 'source' && isVerticalBarsSource(child) && child.matches('ion-button, ion-menu-button');
|
|
65
80
|
// Ionic defaults buttons inside ion-buttons to clear, even when the app defaults to solid.
|
|
66
81
|
const defaultFill = child.closest('ion-buttons') ? 'clear' : candidate.buttonDefaultFill;
|
|
67
82
|
const fill = !sourceFill || sourceFill === 'default' ? defaultFill : sourceFill;
|
|
68
83
|
const buttonFill =
|
|
69
|
-
|
|
84
|
+
!systemButton &&
|
|
85
|
+
isVerticalBarsSource(child) &&
|
|
86
|
+
child.matches('ion-button') &&
|
|
87
|
+
(fill === 'clear' || fill === 'solid' || fill === 'outline')
|
|
70
88
|
? fill
|
|
71
89
|
: undefined;
|
|
72
90
|
const outline = buttonFill === 'outline' ? getComputedStyle(native ?? child) : undefined;
|
|
@@ -86,7 +104,8 @@ export const appendItem = (
|
|
|
86
104
|
selected: !!(child as ItemElement).selected,
|
|
87
105
|
fontSize: parseFloat(labelStyle.fontSize),
|
|
88
106
|
fontWeight: parseInt(labelStyle.fontWeight, 10) || 400,
|
|
89
|
-
color: getComputedStyle(native ?? child).color,
|
|
107
|
+
color: systemButton ? 'currentColor' : getComputedStyle(native ?? child).color,
|
|
108
|
+
iconTemplate: systemButton ? true : undefined,
|
|
90
109
|
buttonFill,
|
|
91
110
|
backgroundColor: buttonFill === 'solid' ? getComputedStyle(native ?? child).backgroundColor : undefined,
|
|
92
111
|
borderColor: outline?.borderTopColor,
|
package/src/native/shared/dom.ts
CHANGED
|
@@ -52,7 +52,7 @@ export const isDark = (style: CSSStyleDeclaration): boolean => {
|
|
|
52
52
|
const background = style.getPropertyValue('--ion-background-color-rgb').match(/\d+/g)?.slice(0, 3).map(Number);
|
|
53
53
|
return !!background && background.length === 3 && background[0] * 0.2126 + background[1] * 0.7152 + background[2] * 0.0722 < 128;
|
|
54
54
|
};
|
|
55
|
-
const permanentlyExcluded = '.
|
|
55
|
+
const permanentlyExcluded = '.ios-theme-disabled, .ios26-disabled, .ion-cloned-element, [hidden], [inert]';
|
|
56
56
|
export const excluded = `${permanentlyExcluded}, .ion-page-hidden, .ion-page-invisible`;
|
|
57
57
|
const enteringPages = new WeakSet<HTMLElement>();
|
|
58
58
|
export const setVerticalBarsEnteringPage = (page: HTMLElement, entering: boolean): void => {
|
|
@@ -88,8 +88,8 @@ export const createVerticalBarsPageState = () => {
|
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
const disabledButtonGroup = 'ion-buttons:is(.
|
|
92
|
-
const shellDisabledSelector = '.ios-theme-shell-disabled';
|
|
91
|
+
const disabledButtonGroup = 'ion-buttons:is(.ios-theme-disabled, .ios26-disabled)';
|
|
92
|
+
const shellDisabledSelector = '.ios-theme-shell-disabled, [data-shell="disabled"]';
|
|
93
93
|
|
|
94
94
|
export const isDisabledButtonGroupChild = (element: HTMLElement): boolean =>
|
|
95
95
|
element.matches('ion-button') && element.parentElement?.matches(disabledButtonGroup) === true;
|
|
@@ -188,7 +188,7 @@ export const isVerticalBarsToolbarGroup = (element: HTMLElement): boolean => {
|
|
|
188
188
|
return (
|
|
189
189
|
element.matches('ion-buttons') &&
|
|
190
190
|
verticalBarsOwned(element) &&
|
|
191
|
-
!element.matches('.
|
|
191
|
+
!element.matches('.ios-theme-disabled, .ios26-disabled') &&
|
|
192
192
|
!isShellDisabled(element)
|
|
193
193
|
);
|
|
194
194
|
};
|
|
@@ -283,7 +283,8 @@ html.ios-theme-native-ui-shell-prehide
|
|
|
283
283
|
[icon],
|
|
284
284
|
[color],
|
|
285
285
|
.ios-theme-vertical-bars-back-web-owned,
|
|
286
|
-
.
|
|
286
|
+
.ios-theme-shell-disabled,
|
|
287
|
+
[data-shell='disabled'],
|
|
287
288
|
.ios-theme-disabled,
|
|
288
289
|
.ios26-disabled,
|
|
289
290
|
.ios-theme-vertical-bars-back-button-projection
|
|
@@ -296,7 +297,7 @@ html.ios-theme-native-ui-shell-prehide
|
|
|
296
297
|
ion-footer[collapse] *,
|
|
297
298
|
ion-buttons.ios-theme-horizontal-only *,
|
|
298
299
|
.ios-theme-shell-disabled *,
|
|
299
|
-
|
|
300
|
+
[data-shell='disabled'] *,
|
|
300
301
|
.ios-theme-disabled *,
|
|
301
302
|
.ios26-disabled *
|
|
302
303
|
)
|