@adelin-io/cli 0.0.0-stage → 0.1.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/README.md +76 -2
- package/authoring-release.json +174 -0
- package/package.json +30 -4
- package/runtime-integrity.json +9 -0
- package/scripts/adelin.mjs +7768 -0
- package/scripts/assemble-checkout.mjs +93 -0
- package/scripts/local-save.mjs +513 -0
- package/scripts/materialize.mjs +319 -0
- package/scripts/runtime.mjs +8950 -0
- package/scripts/typecheck.mjs +72 -0
- package/scripts/workspace-state.mjs +183 -0
- package/skill/README.md +77 -0
- package/skill/SKILL.md +100 -0
- package/skill/authoring/access.md +193 -0
- package/skill/authoring/analytics.md +20 -0
- package/skill/authoring/app-memory.md +128 -0
- package/skill/authoring/app-requirements.md +99 -0
- package/skill/authoring/app-structure.md +265 -0
- package/skill/authoring/assets.md +117 -0
- package/skill/authoring/auth.md +261 -0
- package/skill/authoring/content-binding.md +26 -0
- package/skill/authoring/i18n.md +184 -0
- package/skill/authoring/language.md +503 -0
- package/skill/authoring/local-workflow.md +1665 -0
- package/skill/authoring/offline/connectivity.md +50 -0
- package/skill/authoring/offline/example.md +102 -0
- package/skill/authoring/offline/history-sync.md +39 -0
- package/skill/authoring/offline/index.md +29 -0
- package/skill/authoring/offline/package-storage.md +37 -0
- package/skill/authoring/offline/platforms.md +35 -0
- package/skill/authoring/offline/startup-navigation.md +53 -0
- package/skill/authoring/platform-files.md +616 -0
- package/skill/authoring/player/casting.md +47 -0
- package/skill/authoring/player/controls.md +95 -0
- package/skill/authoring/player/downloads.md +90 -0
- package/skill/authoring/player/drm.md +31 -0
- package/skill/authoring/player/index.md +39 -0
- package/skill/authoring/player/live-dvr.md +33 -0
- package/skill/authoring/player/platforms.md +47 -0
- package/skill/authoring/player/playback.md +42 -0
- package/skill/authoring/player/tracks-subtitles.md +32 -0
- package/skill/authoring/profiles.md +213 -0
- package/skill/authoring/remote-keys.md +139 -0
- package/skill/authoring/search.md +27 -0
- package/skill/authoring/store.md +85 -0
- package/skill/authoring/tv-text-entry.md +146 -0
- package/skill/design/approved/README.md +14 -0
- package/skill/design/approved/vesper-phone-home.jpg +0 -0
- package/skill/design/approved/vesper-tv-detail.jpg +0 -0
- package/skill/design/approved/vesper-tv-home.jpg +0 -0
- package/skill/design/design-guide.md +610 -0
- package/skill/design/edge-to-edge.md +66 -0
- package/skill/design/icons.md +50 -0
- package/skill/design/responsive-layout.md +175 -0
- package/skill/design/safe-area.md +221 -0
- package/skill/design/streaming-playbook.md +131 -0
- package/skill/design/visual-review.md +150 -0
- package/skill/examples/README.md +24 -0
- package/skill/examples/cinema/DESIGN.md +58 -0
- package/skill/examples/cinema/app.tsx +17 -0
- package/skill/examples/cinema/assets/logo.png +0 -0
- package/skill/examples/cinema/components/Action.tsx +40 -0
- package/skill/examples/cinema/components/Action.tv.tsx +44 -0
- package/skill/examples/cinema/components/CatalogGrid.tsx +31 -0
- package/skill/examples/cinema/components/ContinueRail.tsx +98 -0
- package/skill/examples/cinema/components/Feedback.tsx +28 -0
- package/skill/examples/cinema/components/Field.tsx +41 -0
- package/skill/examples/cinema/components/LibraryRail.tsx +46 -0
- package/skill/examples/cinema/components/PlayAction.tsx +29 -0
- package/skill/examples/cinema/components/Root.tsx +59 -0
- package/skill/examples/cinema/components/Shell.tsx +70 -0
- package/skill/examples/cinema/components/Tab.tsx +22 -0
- package/skill/examples/cinema/components/TitleCard.tsx +68 -0
- package/skill/examples/cinema/components/TitleMeta.tsx +36 -0
- package/skill/examples/cinema/locales/en.ts +211 -0
- package/skill/examples/cinema/locales/lt.ts +211 -0
- package/skill/examples/cinema/preview/phone-home.jpg +0 -0
- package/skill/examples/cinema/preview/tv-detail.jpg +0 -0
- package/skill/examples/cinema/preview/tv-home.jpg +0 -0
- package/skill/examples/cinema/screens/portrait/Account.tsx +110 -0
- package/skill/examples/cinema/screens/portrait/Browse.tsx +73 -0
- package/skill/examples/cinema/screens/portrait/Detail.tsx +159 -0
- package/skill/examples/cinema/screens/portrait/Home.tsx +196 -0
- package/skill/examples/cinema/screens/portrait/Player.tsx +299 -0
- package/skill/examples/cinema/screens/portrait/Search.tsx +46 -0
- package/skill/examples/cinema/screens/portrait/Search.tv.tsx +55 -0
- package/skill/examples/cinema/screens/portrait/SignIn.tsx +101 -0
- package/skill/examples/cinema/screens/portrait/SignUp.tsx +106 -0
- package/skill/examples/cinema/store.tsx +132 -0
- package/skill/examples/cinema/theme.ts +32 -0
- package/skill/examples/documentary/DESIGN.md +33 -0
- package/skill/examples/documentary/app.tsx +17 -0
- package/skill/examples/documentary/components/Action.tsx +43 -0
- package/skill/examples/documentary/components/CatalogGrid.tsx +47 -0
- package/skill/examples/documentary/components/Feedback.tsx +27 -0
- package/skill/examples/documentary/components/Field.tsx +33 -0
- package/skill/examples/documentary/components/LibraryRail.tsx +47 -0
- package/skill/examples/documentary/components/Root.tsx +62 -0
- package/skill/examples/documentary/components/Shell.tsx +93 -0
- package/skill/examples/documentary/components/StoryCard.tsx +53 -0
- package/skill/examples/documentary/components/StoryMeta.tsx +22 -0
- package/skill/examples/documentary/preview/phone-home.jpg +0 -0
- package/skill/examples/documentary/preview/tv-detail.jpg +0 -0
- package/skill/examples/documentary/preview/tv-home.jpg +0 -0
- package/skill/examples/documentary/screens/portrait/Account.tsx +97 -0
- package/skill/examples/documentary/screens/portrait/Browse.tsx +71 -0
- package/skill/examples/documentary/screens/portrait/Detail.tsx +133 -0
- package/skill/examples/documentary/screens/portrait/Home.tsx +89 -0
- package/skill/examples/documentary/screens/portrait/Player.tsx +116 -0
- package/skill/examples/documentary/screens/portrait/Search.tsx +48 -0
- package/skill/examples/documentary/screens/portrait/SignIn.tsx +96 -0
- package/skill/examples/documentary/screens/portrait/SignUp.tsx +101 -0
- package/skill/examples/documentary/store.tsx +115 -0
- package/skill/examples/documentary/theme.ts +20 -0
- package/skill/examples/series/DESIGN.md +55 -0
- package/skill/examples/series/app.tsx +17 -0
- package/skill/examples/series/components/Action.tsx +42 -0
- package/skill/examples/series/components/CatalogGrid.tsx +43 -0
- package/skill/examples/series/components/ContinueRail.tsx +78 -0
- package/skill/examples/series/components/Feedback.tsx +26 -0
- package/skill/examples/series/components/Field.tsx +34 -0
- package/skill/examples/series/components/LibraryRail.tsx +38 -0
- package/skill/examples/series/components/OutcomeNote.tsx +28 -0
- package/skill/examples/series/components/PlayAction.tsx +29 -0
- package/skill/examples/series/components/RestoreAction.tsx +33 -0
- package/skill/examples/series/components/Root.tsx +75 -0
- package/skill/examples/series/components/SaveTitle.tsx +34 -0
- package/skill/examples/series/components/Shell.tsx +75 -0
- package/skill/examples/series/components/TitleCard.tsx +62 -0
- package/skill/examples/series/components/UnlockAction.tsx +10 -0
- package/skill/examples/series/preview/phone-home.jpg +0 -0
- package/skill/examples/series/preview/tv-detail.jpg +0 -0
- package/skill/examples/series/preview/tv-home.jpg +0 -0
- package/skill/examples/series/screens/portrait/Account.tsx +125 -0
- package/skill/examples/series/screens/portrait/Browse.tsx +61 -0
- package/skill/examples/series/screens/portrait/Detail.tsx +231 -0
- package/skill/examples/series/screens/portrait/Home.tsx +109 -0
- package/skill/examples/series/screens/portrait/MyList.tsx +44 -0
- package/skill/examples/series/screens/portrait/Plans.tsx +131 -0
- package/skill/examples/series/screens/portrait/Player.tsx +138 -0
- package/skill/examples/series/screens/portrait/Profiles.tsx +103 -0
- package/skill/examples/series/screens/portrait/Search.tsx +50 -0
- package/skill/examples/series/screens/portrait/SignIn.tsx +94 -0
- package/skill/examples/series/screens/portrait/SignUp.tsx +100 -0
- package/skill/examples/series/store.tsx +192 -0
- package/skill/examples/series/theme.ts +32 -0
- package/skill/guides/final-pricing-capabilities.md +13 -0
- package/skill/reference/api.md +842 -0
- package/skill/reference/components.md +1782 -0
- package/skill/reference/packages.md +24 -0
- package/skill/scripts/assemble-checkout.mjs +93 -0
- package/skill/scripts/local-save.mjs +513 -0
- package/skill/scripts/materialize.mjs +319 -0
- package/skill/scripts/workspace-state.mjs +183 -0
- package/types/adelin-access.d.ts +70 -0
- package/types/adelin-analytics.d.ts +5 -0
- package/types/adelin-assets.d.ts +26 -0
- package/types/adelin-auth.d.ts +37 -0
- package/types/adelin-content.d.ts +112 -0
- package/types/adelin-device.d.ts +195 -0
- package/types/adelin-downloads.d.ts +47 -0
- package/types/adelin-env.d.ts +8 -0
- package/types/adelin-globals.d.ts +19 -0
- package/types/adelin-i18n.d.ts +31 -0
- package/types/adelin-native-stack.d.ts +178 -0
- package/types/adelin-navigation.d.ts +264 -0
- package/types/adelin-profiles.d.ts +51 -0
- package/types/adelin-react.d.ts +49 -0
- package/types/adelin-reanimated.d.ts +376 -0
- package/types/adelin-storage.d.ts +9 -0
- package/types/adelin-store.d.ts +74 -0
- package/types/adelin-ui.d.ts +1518 -0
- package/types/adelin-utils.d.ts +7 -0
- package/types/adelin-worklets.d.ts +15 -0
- package/workspace-tsconfig.json +53 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Edge-to-edge app layout
|
|
2
|
+
|
|
3
|
+
This is the default visual layout policy for generated mobile apps. Read [safe-area.md](safe-area.md) for measured inset ownership, supported APIs and canvas units. A whole-screen SafeAreaView is an intentional bounded-layout option described there.
|
|
4
|
+
|
|
5
|
+
## Default composition
|
|
6
|
+
|
|
7
|
+
Paint the full window. Background colors, gradients, artwork, separators and scrolling content should continue behind system bars and display cutouts. Protect readable content and controls with measured insets; do not shrink the entire scene to the safe rectangle. A whole-screen SafeAreaView is an explicit bounded-layout choice, not the default for Home, Browse, Detail or Player.
|
|
8
|
+
|
|
9
|
+
Keep a ScrollView's viewport full-window. Put the initial and final safe clearance in `contentContainerStyle`, so the first item starts below the status area and the final item can settle above the home indicator while scrolling content travels behind those regions. Padding or margin on the outer viewport prevents that behavior. Fixed headers, bottom navigation and floating controls need their own inset owner and app-chrome clearance. Space already allocated by normal flow must not be counted again.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Screen, ScrollView, StyleSheet, Text, View, theme, useSafeAreaInsets } from '@adelin/ui';
|
|
13
|
+
|
|
14
|
+
export default function EdgeToEdge() {
|
|
15
|
+
const insets = useSafeAreaInsets();
|
|
16
|
+
return (
|
|
17
|
+
<Screen>
|
|
18
|
+
<View style={styles.page}>
|
|
19
|
+
<ScrollView
|
|
20
|
+
style={styles.scroll}
|
|
21
|
+
contentContainerStyle={[
|
|
22
|
+
styles.content,
|
|
23
|
+
{
|
|
24
|
+
paddingTop: insets.top + theme.spacing.lg,
|
|
25
|
+
paddingBottom: insets.bottom + theme.spacing.lg,
|
|
26
|
+
paddingLeft: insets.left + theme.spacing.md,
|
|
27
|
+
paddingRight: insets.right + theme.spacing.md,
|
|
28
|
+
},
|
|
29
|
+
]}
|
|
30
|
+
>
|
|
31
|
+
<Text style={styles.title}>Your library</Text>
|
|
32
|
+
</ScrollView>
|
|
33
|
+
</View>
|
|
34
|
+
</Screen>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const styles = StyleSheet.create({
|
|
39
|
+
page: { flex: 1, backgroundColor: theme.colors.background },
|
|
40
|
+
scroll: { flex: 1 },
|
|
41
|
+
content: { paddingVertical: theme.spacing.md },
|
|
42
|
+
title: { color: theme.colors.text, fontSize: 24 },
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This example has no authored app chrome. A real app must add its resolved header/tab/mini-player clearance at the shared owner. Use the actual layout's footprint; do not paste an invented status-bar height or a tab height from another app. Hook values are already Adelin canvas units and must not be rescaled.
|
|
47
|
+
|
|
48
|
+
## Chrome and media
|
|
49
|
+
|
|
50
|
+
- Extend a top bar's background into the status/cutout band, while insetting its title and actions. Use matching translucent or gradient protection when content scrolls behind it; keep system icons readable.
|
|
51
|
+
- Extend a bottom bar's background to the window edge. Inset its button row above the gesture band. A painted background must not terminate at the safe-area boundary and reveal an accidental black strip.
|
|
52
|
+
- For overlay chrome, keep the scroll viewport behind it and apply start/end content clearance once. For chrome in normal flow, its allocated size already clears the child. Do not claim that in-flow chrome permits scrolling behind it.
|
|
53
|
+
- Let hero artwork and video bleed to the edges; protect captions, close/back actions, transport controls and TV focus targets independently.
|
|
54
|
+
- Use `SafeAreaView` with explicit owned edges for controls where appropriate. Keep full-window backgrounds outside padded wrappers. Nested tiles and rows must not each add system insets.
|
|
55
|
+
|
|
56
|
+
## Stay inside Adelin's public contract
|
|
57
|
+
|
|
58
|
+
Use `@adelin/ui` APIs only. `contentContainerStyle`, physical SafeAreaView edge arrays and `useSafeAreaInsets()` are available. Android examples such as `clipToPadding=false`, native system-bar flags and upstream ScrollView automatic-inset props are platform implementation guidance, not new Adelin exports. Do not invent those props or directly import platform libraries. Report missing clipping, system-bar or chrome-measurement support as a runtime gap.
|
|
59
|
+
|
|
60
|
+
Insets do not explain every visible border. Compare a native screenshot with the streamed app region: letterboxing from a mismatched viewer aspect ratio and the external device bezel belong to the preview host. Do not compensate by removing safe insets, drawing outside the app root or hardcoding a notch height. If the native host itself supplies an opaque system band or a smaller app window, record that separately from authored layout.
|
|
61
|
+
|
|
62
|
+
## Visual acceptance
|
|
63
|
+
|
|
64
|
+
Inspect the top and bottom edges, both at rest and while scrolling. The background should remain continuous, the first/last content and fixed actions must remain reachable, and touch/drag targets must avoid system gestures. Check long content, empty states, keyboard, rotation and both landscape sides. Compiling this example does not prove an existing app has adopted the layout.
|
|
65
|
+
|
|
66
|
+
Sources: Android's [edge-to-edge design](https://developer.android.com/design/ui/mobile/guides/layout-and-content/edge-to-edge) describes full-window backgrounds and scrolling with protected critical UI. Its [Views implementation guide](https://developer.android.com/develop/ui/views/layout/edge-to-edge) explains inset-aware list padding and platform clipping behavior. Native system-bar configuration remains a runtime responsibility.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Icons
|
|
2
|
+
|
|
3
|
+
Use the `Icon` primitive with a verified Iconify ID:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Icon icon="ph:house" size={24} color="#ffffff" />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Call `search_icons` for the concept first. It returns actual catalog IDs,
|
|
10
|
+
license metadata and a public preview URL. Do not invent names or use a Pro account.
|
|
11
|
+
Phosphor (`ph`) is the default. Keep one family and one weight across an app;
|
|
12
|
+
use `-fill` for a selected state when useful. Lucide (`lucide`) and Material
|
|
13
|
+
Design Icons (`mdi`) are also available. Only the reviewed authoring catalog is
|
|
14
|
+
accepted. Brand/logo icons are excluded from Material Design Icons.
|
|
15
|
+
|
|
16
|
+
Reuse verified IDs wherever the same action appears. Resolve essential navigation
|
|
17
|
+
icons first and begin authoring after at most three searches. Find any remaining
|
|
18
|
+
decorative icons while implementing their screen; icon discovery must not delay
|
|
19
|
+
the first theme, shared components and screen implementation.
|
|
20
|
+
|
|
21
|
+
The descriptor stores the ID. The existing native and web Icon implementations
|
|
22
|
+
fetch that SVG directly from Iconify's public API and cache it for offline reuse. New icon choices do
|
|
23
|
+
not require a native build. Do not import icon packages, embed a font/catalog,
|
|
24
|
+
paste SVG into a descriptor, or use an external API URL as an icon name.
|
|
25
|
+
|
|
26
|
+
`size` uses logical units on phone/tablet/browser and scaled canvas units on TV. `color` recolors filled and stroked icons.
|
|
27
|
+
The `{ set: "ph", name: "house" }` form is also accepted. Plain Unicode glyphs
|
|
28
|
+
and existing image URIs still work. Font-family names such as `MaterialIcons`
|
|
29
|
+
are not catalog IDs; replace them with a searched Iconify ID.
|
|
30
|
+
|
|
31
|
+
Literal IDs in screens, reusable-component arguments and app navigation are
|
|
32
|
+
checked before persistence. Dynamic IDs are checked by the runtime loader.
|
|
33
|
+
Downloads reserve the icon's dimensions while loading, retry once, and show
|
|
34
|
+
`?` after a failure. Prefer meaningful text labels on actions and navigation.
|
|
35
|
+
|
|
36
|
+
## Navigation menus
|
|
37
|
+
|
|
38
|
+
Search for icons matching the existing menu labels, then pass regular and
|
|
39
|
+
filled IDs to the shared menu entry. Render the selected state with:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<Icon icon={active ? activeIcon : icon} size={18} color={iconColor} />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Keep the existing label, route, press handler, focus styling and accessibility
|
|
46
|
+
label. Replace the placeholder glyph within its existing footprint. Apply
|
|
47
|
+
the same icon choices to bottom tabs and side rails. After typecheck and build,
|
|
48
|
+
verify the saved descriptors and request a preview observation; report an
|
|
49
|
+
unavailable observation explicitly. New menu choices use descriptor refresh
|
|
50
|
+
and on-demand downloads, without rebuilding the native shell.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Responsive layouts and state
|
|
2
|
+
|
|
3
|
+
Read this before authoring a shell, tablet layout, or rotation/fold transition.
|
|
4
|
+
Read [safe-area.md](safe-area.md) and [edge-to-edge.md](edge-to-edge.md) for edge ownership.
|
|
5
|
+
|
|
6
|
+
## Share screens by default
|
|
7
|
+
|
|
8
|
+
Author shared routes as `screens/Home.tsx`, and reusable UI as
|
|
9
|
+
`components/*.tsx`. Phone, tablet and browser use the same screen by default.
|
|
10
|
+
The storage bucket still calls the shared version portrait; this is an internal
|
|
11
|
+
identity, not a layout constraint. `screens/landscape/Home.tsx` is an explicit
|
|
12
|
+
large-screen/TV override when the composition really differs. Edit the path
|
|
13
|
+
returned by materialize; do not create two paths for the same stored screen.
|
|
14
|
+
|
|
15
|
+
`useWindowDimensions` from `@adelin/ui` returns reactive authoring units:
|
|
16
|
+
points/dp/CSS pixels on phone, tablet and desktop web; normalized 960-wide
|
|
17
|
+
canvas units on TV. Width and height both update, including height-only
|
|
18
|
+
resizes. Never multiply these values or style sizes by pixel density.
|
|
19
|
+
Fractional dimensions and spacing are supported. Keep layout calculations in authoring
|
|
20
|
+
units and let the renderer round to physical pixels after scaling.
|
|
21
|
+
|
|
22
|
+
## Adaptive apps and proportional TV
|
|
23
|
+
|
|
24
|
+
Phone, tablet and browser have scale factor 1. A 16-unit font or 44-unit control
|
|
25
|
+
keeps its logical size when the window gets wider. Use extra space for more
|
|
26
|
+
columns, a navigation rail, or a detail pane. Use flexible widths, wrapping,
|
|
27
|
+
and bounded content (for example maxWidth 1280 with width '100%'); avoid fixed
|
|
28
|
+
960-wide roots and enlarging every font to fill a desktop monitor. Preserve
|
|
29
|
+
platform accessibility text sizing, browser zoom, safe areas and keyboard clearance.
|
|
30
|
+
|
|
31
|
+
Centralize layout decisions in a shared shell or reusable component. Starting
|
|
32
|
+
width classes are compact <600, medium 600–839, expanded >=840 logical units.
|
|
33
|
+
Check height separately: below 480, a landscape phone can be too short for a
|
|
34
|
+
permanent detail pane. These are useful defaults, not mandatory visual templates.
|
|
35
|
+
Use the actual app window, never the device name, isTablet, screen pixels, or
|
|
36
|
+
width >= height alone. Tablet split-screen and fold/unfold are window changes.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
const { width, height } = useWindowDimensions();
|
|
40
|
+
const expanded = width >= 840 && height >= 480;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Keep typography and spacing tokens shared between phone/tablet/web; 14–16 for
|
|
44
|
+
body text, 24–32 for headings and at least 44 for primary touch controls are
|
|
45
|
+
starting points. Do not reuse the 960×540 TV type scale directly in an adaptive app.
|
|
46
|
+
Choose sizes for the product and support long/localized text.
|
|
47
|
+
|
|
48
|
+
TV keeps proportional composition on a 960×540 reference canvas. The runtime
|
|
49
|
+
scales styles and icon sizes once from logical viewport width; native density
|
|
50
|
+
handles physical pixels. HD and UHD should have the same card count, relative
|
|
51
|
+
font sizes, margins and focus geometry. Use Platform.select TV styles where
|
|
52
|
+
necessary for remote navigation and viewing distance. A 4K output does not
|
|
53
|
+
mean a desktop-size layout. Bitmap/video assets may need higher resolution;
|
|
54
|
+
their quality must not alter layout geometry.
|
|
55
|
+
|
|
56
|
+
Use Platform.select inside StyleSheet.create for TV-specific styling; the
|
|
57
|
+
compiler currently refuses Platform reads in ordinary component expressions.
|
|
58
|
+
Use window classes for adaptive composition and keep the stateful content slot
|
|
59
|
+
stable. Browser hover/keyboard and TV focus/remote behavior belong inside reusable
|
|
60
|
+
controls. Optional platform files are resolved by the API at launch; read
|
|
61
|
+
[platform-files.md](../authoring/platform-files.md) for suffixes, fallback order and neutral imports. Use them
|
|
62
|
+
for actual platform differences, rather than duplicating adaptive layouts.
|
|
63
|
+
|
|
64
|
+
TV focus must follow the visual layout. A Screen root moves vertically through
|
|
65
|
+
its registered children; a row styled with flexDirection does not define a
|
|
66
|
+
horizontal focus group. Put a horizontal FocusGroup around a wide sidebar/body
|
|
67
|
+
pair, a vertical group around its navigation, and a horizontal group around
|
|
68
|
+
filter chips. When a row stacks into a column on narrow screens, switch its group from the
|
|
69
|
+
same condition: `direction={wide ? 'horizontal' : 'vertical'}`. Group card rows or grids with
|
|
70
|
+
the supported focus primitives.
|
|
71
|
+
Keep sibling source order consistent with the intended remote direction; CSS
|
|
72
|
+
row-reverse does not reverse focus traversal. Keep the content slot mounted when
|
|
73
|
+
changing a shared group's direction for a resized window.
|
|
74
|
+
|
|
75
|
+
Give every interactive TV target a visible focused state, distinct from its
|
|
76
|
+
selected state. Changing borderColor alone is ineffective without a border.
|
|
77
|
+
Validate remote movement from navigation into filters/cards, session details,
|
|
78
|
+
back navigation and offscreen actions; a rendered screenshot is not this proof.
|
|
79
|
+
|
|
80
|
+
Window adaptation does not provide hinge exclusion or posture. The generated
|
|
81
|
+
runtime currently exposes window size and safe areas, not native separating
|
|
82
|
+
hinge bounds. Never invent fold geometry or infer posture from aspect ratio.
|
|
83
|
+
Use the available window for reflow, and report when an app needs a native fold
|
|
84
|
+
geometry capability. Browser preview fold controls alone do not supply it.
|
|
85
|
+
|
|
86
|
+
Prefer the same descriptor and mounted tree for resizing. Do not download a
|
|
87
|
+
second screen, restart the app, change route keys, or recreate navigation just
|
|
88
|
+
because width and height changed. An iPad rotation is enough to exercise the
|
|
89
|
+
same resize behavior needed by a folding window. It does not prove hinge or
|
|
90
|
+
fold-posture support.
|
|
91
|
+
|
|
92
|
+
## Focus scrolling
|
|
93
|
+
|
|
94
|
+
Vertical TV scroll views and virtualized lists park focused content 80 authoring
|
|
95
|
+
units below the viewport top, clamped so the focused item fits and the page stays
|
|
96
|
+
inside its scroll range. Moving sideways in a visible row keeps its vertical
|
|
97
|
+
position. Horizontal lists reveal only the needed overflow; touch scrolling stays
|
|
98
|
+
native. `ScrollView` and `FlashList` accept a `viewportOffset` override.
|
|
99
|
+
|
|
100
|
+
TV focus scrolling animates in the runtime. Repeated remote input retargets the
|
|
101
|
+
current motion instead of starting competing animations. System reduced motion
|
|
102
|
+
uses immediate positioning. Use the scroll primitives rather than adding a second
|
|
103
|
+
animation around them; virtualized lists cancel motion before seeking an unmounted
|
|
104
|
+
item and resume focus alignment when it mounts.
|
|
105
|
+
|
|
106
|
+
FlashList measures its items and the final focus scale of nested tiles and buttons,
|
|
107
|
+
then reserves clearance inside the scroll viewport. Custom component wrappers do
|
|
108
|
+
not need to repeat a tile's `focusScale` on the list. Keep normal design spacing in
|
|
109
|
+
`contentContainerStyle`; avoid clipping wrappers around rails. `overflow: "visible"`
|
|
110
|
+
on a parent cannot reliably bypass a browser or native scroll viewport's clipping.
|
|
111
|
+
Explicit list `focusScale` remains available when the whole item needs clearance.
|
|
112
|
+
|
|
113
|
+
BillboardHero provides TV slide selectors: Down from the actions enters the selector
|
|
114
|
+
row, Left/Right selects a slide, Up returns to actions and Down continues to content.
|
|
115
|
+
The focused selector has a visible outline and pauses auto-advance until focus leaves.
|
|
116
|
+
`autoPlay` defaults to true with a six-second `autoPlayInterval`; keep authored copy
|
|
117
|
+
and actions bound to the current record through `onSlideChange`, as in the example.
|
|
118
|
+
|
|
119
|
+
Use `<ViewportOffsetScope viewportOffset={24}>…</ViewportOffsetScope>` from
|
|
120
|
+
`@adelin/ui` to override the vertical anchor for a subtree. The nearest scope wins,
|
|
121
|
+
including zero. This is a viewport-relative distance, not an absolute page position.
|
|
122
|
+
`<ScrollTarget y={0}>…</ScrollTarget>` takes precedence and returns the page to its
|
|
123
|
+
top when a hero control receives focus. Author all offsets in logical units; the
|
|
124
|
+
runtime scales them once for TV resolution. Keep row actions and their cards at
|
|
125
|
+
compatible offsets so moving between them does not bounce the page.
|
|
126
|
+
|
|
127
|
+
## Keep stateful content mounted
|
|
128
|
+
|
|
129
|
+
React preserves local state by component identity and its position in the tree.
|
|
130
|
+
A shared component name alone does not preserve state when its parents change.
|
|
131
|
+
These two branches remount `children` on every rotation:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
return wide
|
|
135
|
+
? <View><Sidebar /><View>{children}</View></View>
|
|
136
|
+
: <View>{children}<BottomBar /></View>;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Keep one content slot under the same parent. Change layout styles around it:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
return (
|
|
143
|
+
<View style={[styles.layout, wide && styles.wide]}>
|
|
144
|
+
<View style={styles.content}>{children}</View>
|
|
145
|
+
<View style={wide ? styles.sidebar : styles.bottomBar}>
|
|
146
|
+
<NavigationEntries rail={wide} />
|
|
147
|
+
</View>
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use `flexDirection: "row-reverse"` for a left sidebar when the stable content
|
|
153
|
+
slot is the first child, and a column for a bottom bar. Keep child indices and
|
|
154
|
+
keys stable. Changing a SafeAreaView into a View, moving the content under a
|
|
155
|
+
new wrapper, or keying a subtree by orientation also remounts it. Keep safe
|
|
156
|
+
area and edge owners stable while updating their measured clearance.
|
|
157
|
+
|
|
158
|
+
Conditionally render decorative chrome inside the navigation slot; keep forms,
|
|
159
|
+
players, scroll views, subscriptions, and the route's content outside those
|
|
160
|
+
branches. Do not move passwords into persistent storage to conceal a remount.
|
|
161
|
+
|
|
162
|
+
## Verify the transition
|
|
163
|
+
|
|
164
|
+
On the actual app, open a non-home route, enter unsent form text, and rotate the
|
|
165
|
+
iPad in both directions; resize browser width and height independently, and test tablet split-screen. Confirm the same session, route, form mode, text,
|
|
166
|
+
and scroll/content state remain. Inspect screenshots after settling and check
|
|
167
|
+
controls and keyboard clearance. A running stream or a dimension event alone
|
|
168
|
+
is insufficient. Descriptor edits can intentionally reset state during a full
|
|
169
|
+
refresh; an ordinary window resize must not.
|
|
170
|
+
|
|
171
|
+
For TV, compare the same app on HD/UHD logical viewport and density combinations.
|
|
172
|
+
Check typography, line wrapping, borders, icons, focus rings, scrolling and safe
|
|
173
|
+
areas. Compare geometry after normalizing screenshots to the same size; expect
|
|
174
|
+
sharper assets on higher-density output. A screenshot alone does not prove focus
|
|
175
|
+
or interaction behavior.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Safe areas and layout clearance for generated apps
|
|
2
|
+
|
|
3
|
+
Keep text, buttons, navigation, focus targets and the final scroll item clear of system UI. Backgrounds, artwork and video may extend to the window edges. Use one shared layout policy instead of independent offsets scattered across screens.
|
|
4
|
+
|
|
5
|
+
Current scope is LTR. RTL support is explicitly deferred; use physical edge names and do not promise RTL layout or logical-edge parity.
|
|
6
|
+
|
|
7
|
+
## 1. What agents can use today
|
|
8
|
+
|
|
9
|
+
Read the current public declarations before choosing an API. This document describes both available authoring tools and the intended calculation model; it does not add runtime exports.
|
|
10
|
+
|
|
11
|
+
| Capability | Current Adelin contract | Agent action |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `SafeAreaView` | Exported from `@adelin/ui`; native implementation uses `react-native-safe-area-context` | Protect the edges a bounded region owns; use a whole-screen wrapper only for an intentionally bounded layout |
|
|
14
|
+
| Per-edge `edges` / `mode` | Physical edge arrays and `padding` / `margin` modes are supported | Select only the edges this view owns; an empty array consumes none |
|
|
15
|
+
| `useSafeAreaInsets()` | Exported from `@adelin/ui`, returning reactive canvas-unit top/right/bottom/left values | Use for custom placement and clearance calculations; keep normal hook order |
|
|
16
|
+
| `SafeAreaProvider` | Runtime-owned, not a public authoring export | Do not add your own provider |
|
|
17
|
+
| `useNavigationClearance` | Not public | The model below is guidance for shared runtime support, not a callable API |
|
|
18
|
+
| Browser `SafeAreaView` | Consumes actual browser CSS safe-area measurements and updates on geometry changes | Use the same edge ownership as native; supported browser geometry is still required |
|
|
19
|
+
| `Screen`, `Stack.Screen` | The focus boundary and the stack registration; there is no navigation header | Do not assume they reserve space for authored chrome |
|
|
20
|
+
| Scroll adjustment props | `contentContainerStyle` is supported; upstream native inset adjustment props are not in the closed ScrollView contract | Stay within the public contract |
|
|
21
|
+
|
|
22
|
+
Author through `@adelin/*`, never direct `react-native-safe-area-context`, platform native APIs, arbitrary context, CSS environment strings or internal runtime hooks. SafeAreaView supports `edges={['top', 'right', 'bottom', 'left']}` and `mode="padding"` (both defaults), `mode="margin"`, and `edges={[]}`. Object-valued edge modes such as `{top: 'maximum'}` are not supported. Unsupported imports are a runtime capability gap, not something to work around with a guessed status-bar height.
|
|
23
|
+
|
|
24
|
+
The default full-window composition is in [edge-to-edge.md](edge-to-edge.md): paint behind
|
|
25
|
+
system UI and protect content with measured insets. For an intentionally bounded screen,
|
|
26
|
+
put its header, scroll viewport and in-flow footer in one `SafeAreaView`. Let ordinary flex
|
|
27
|
+
layout allocate the header/footer space. Shared tiles, buttons and nested lists should not
|
|
28
|
+
each add another safe-area wrapper.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { SafeAreaView, Screen, ScrollView, StyleSheet, Text, View, theme } from '@adelin/ui';
|
|
32
|
+
|
|
33
|
+
export default function Library() {
|
|
34
|
+
return (
|
|
35
|
+
<Screen>
|
|
36
|
+
<SafeAreaView style={styles.page}>
|
|
37
|
+
<View style={styles.header}><Text style={styles.title}>Library</Text></View>
|
|
38
|
+
<ScrollView style={styles.scroll} contentContainerStyle={styles.content}>
|
|
39
|
+
<Text style={styles.body}>Your library</Text>
|
|
40
|
+
</ScrollView>
|
|
41
|
+
</SafeAreaView>
|
|
42
|
+
</Screen>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
page: { flex: 1, backgroundColor: theme.colors.background },
|
|
48
|
+
header: { paddingHorizontal: theme.spacing.md, paddingVertical: theme.spacing.sm },
|
|
49
|
+
title: { color: theme.colors.text, fontSize: 18 },
|
|
50
|
+
scroll: { flex: 1 },
|
|
51
|
+
content: { padding: theme.spacing.md },
|
|
52
|
+
body: { color: theme.colors.text, fontSize: 12 },
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This demonstrates a bounded composition, not the default full-window treatment. Runtime
|
|
57
|
+
providers measure geometry without padding the app themselves. If a parent already owns an
|
|
58
|
+
edge, omit that edge here or use a `View`. A full-bleed background can be a sibling behind
|
|
59
|
+
protected content inside one full-window root `View`; keep interactive overlays inside that
|
|
60
|
+
root's bounds. Browser entry points opt into `viewport-fit=cover`; device/browser acceptance
|
|
61
|
+
is recorded separately from compilation.
|
|
62
|
+
|
|
63
|
+
## 2. Separate three kinds of space
|
|
64
|
+
|
|
65
|
+
**System insets** are device-reported distances from the provider's edges to unobstructed content: top, right, bottom and left. They can change with orientation, window size or system UI. They are physical edges, independent of language direction.
|
|
66
|
+
|
|
67
|
+
**App clearance** is space occupied by app chrome: a top bar, bottom tabs, left/right rail, floating menu or mini player. Whether it is already provided by flex layout matters more than its name.
|
|
68
|
+
|
|
69
|
+
**Design spacing** is intentional breathing room from theme tokens. It can vary between Home, catalog, details and player layouts. It is not the status-bar height or a device inset.
|
|
70
|
+
|
|
71
|
+
Keep these inputs separate until composing a layout. A theme margin cannot replace a notch inset; a system inset cannot replace the height of an app menu.
|
|
72
|
+
|
|
73
|
+
## 3. Assign one owner per edge and coordinate space
|
|
74
|
+
|
|
75
|
+
Before editing, inspect the app root, authored chrome, screen root and scroll container. Record which layer owns each edge. A screen with no overlays usually needs only the normal native pattern above.
|
|
76
|
+
|
|
77
|
+
| Layer | Responsibility |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| Runtime/native host | Safe-area provider geometry, system-bar policy and live inset delivery |
|
|
80
|
+
| App layout / shared chrome | Navigator footprint, floating gaps, menu visibility and overlay placement |
|
|
81
|
+
| Screen | Choose full-bleed versus protected content; add screen-specific design spacing |
|
|
82
|
+
| Scroll container | Clear overlays at the start/end and make the last item reachable |
|
|
83
|
+
| Reusable content component | Respect its supplied bounds; no implicit whole-screen safe area |
|
|
84
|
+
| Modal / Portal content | Determine its actual host bounds and inherited provider before choosing an owner |
|
|
85
|
+
|
|
86
|
+
Provider values are relative to the nearest provider, not automatically to a child. Moving a view below a header does not necessarily change the raw inset value it sees. Do not nest wrappers that consume the same provider edge twice. Native modal roots may require their own provider; runtime maintainers own that decision. A Portal preserving React context is not proof that its visible host has the same safe bounds.
|
|
87
|
+
|
|
88
|
+
If a header and footer take normal flex space, the remaining screen already excludes them. Do not also add their heights to the screen's padding. Conversely, an absolutely positioned header does not allocate space: interactive content under it needs explicit clearance.
|
|
89
|
+
|
|
90
|
+
## 4. Calculate the occupied bands
|
|
91
|
+
|
|
92
|
+
The following is a calculation specification for a shared layout helper, not paste-ready authored TSX. All quantities in a calculation must use the same root coordinate space and units.
|
|
93
|
+
|
|
94
|
+
For each edge, start with the system inset. An overlay contributes the distance from that edge to the overlay's far boundary. The required edge band is the union of these occupied distances:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
band(edge) = max(systemInset(edge), overlayFarBoundary1, overlayFarBoundary2, ...)
|
|
98
|
+
remaining(edge) = max(0, band(edge) - clearanceAlreadyProvidedByParent(edge))
|
|
99
|
+
contentPadding(edge) = remaining(edge) + designSpacing(edge)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Only subtract clearance that the parent actually provides in this coordinate space. Do not subtract a menu merely because it exists elsewhere in the tree. For overlapping edge overlays, take their furthest boundary rather than adding their heights. For controls deliberately stacked outside one another, their geometry contains the sum.
|
|
103
|
+
|
|
104
|
+
Example geometry when chrome is anchored *inside* the safe area:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
topBarBottom = safe.top + topFloatGap + topBarHeight
|
|
108
|
+
bottomTabsTopDistance = safe.bottom + bottomFloatGap + bottomTabHeight
|
|
109
|
+
leftRailRight = safe.left + leftFloatGap + leftRailWidth
|
|
110
|
+
rightRailLeftDistance = safe.right + rightFloatGap + rightRailWidth
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If an actual bar measurement already includes its system inset or float gap, do not add them again. A rail anchored to a camera/status column should contribute its measured far boundary, not a generic `width + gap` estimate.
|
|
114
|
+
|
|
115
|
+
Examples, in device logical units:
|
|
116
|
+
|
|
117
|
+
| Situation | Required clearance before design spacing |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| Status inset 24, top overlay height 56, gap 8 | 88 from the root top edge |
|
|
120
|
+
| Same header in normal flow inside a safe-area owner | 0 additional top clearance for its child viewport |
|
|
121
|
+
| Bottom inset 20, tabs height 48, gap 8 | 76 from root bottom |
|
|
122
|
+
| Mini player height 40 stacked above those tabs with gap 8 | 124 from root bottom |
|
|
123
|
+
| Two bottom overlays ending at 76 and 100 | 100, not 176 |
|
|
124
|
+
| Left inset 12, floating rail width 80, gap 8 | 100 from root left |
|
|
125
|
+
|
|
126
|
+
Prefer flex sizing for the remaining viewport. If explicit dimensions are needed, subtract the occupied left/right bands once from the root width, and top/bottom bands once from root height. Do not subtract them again from an already reduced child width. Keep physical safe-area edges separate from leading/trailing content alignment when applying RTL.
|
|
127
|
+
|
|
128
|
+
## 5. Keep device units separate from Adelin canvas units
|
|
129
|
+
|
|
130
|
+
TV scales numeric authored style dimensions through its renderer. Phone, tablet and browser
|
|
131
|
+
keep points, dp or CSS pixels at scale 1. Measured device insets come from a separate pipeline.
|
|
132
|
+
|
|
133
|
+
TV uses a 960×540 reference canvas. Device-reported safe-area distances are already in
|
|
134
|
+
native logical units; they are not artwork dimensions and must not be multiplied by the TV
|
|
135
|
+
scale again. Native `SafeAreaView` consumes its own insets outside that authored-style
|
|
136
|
+
calculation.
|
|
137
|
+
|
|
138
|
+
The public `useSafeAreaInsets()` hook returns **canvas units**: the interpreter divides each measured device inset by the current descriptor scale. This differs from the upstream native hook's device-unit contract. Authored style resolution then scales the complete canvas expression once. SafeAreaView applies raw measured insets after resolving authored styles, so its inset is not scaled twice. Do not multiply/divide hook results by the scale or pixel density yourself. Tests cover scale factors below, equal to and above 1; a correct-looking result at scale 1 can hide this error.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { useSafeAreaInsets, StyleSheet, View, theme } from '@adelin/ui';
|
|
142
|
+
|
|
143
|
+
export default function CustomControls() {
|
|
144
|
+
const insets = useSafeAreaInsets();
|
|
145
|
+
return <View style={[styles.controls, { paddingTop: insets.top + theme.spacing.md }]} />;
|
|
146
|
+
}
|
|
147
|
+
const styles = StyleSheet.create({ controls: { flex: 1 } });
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The custom container above owns its top edge. Do not also consume that edge with a parent SafeAreaView. Per-edge ownership also allows a full-width header to consume top/left/right while a sibling body consumes left/right/bottom. Each horizontal band is protected once within its own bounds.
|
|
151
|
+
|
|
152
|
+
Agents must not derive a fake safe inset from `useWindowDimensions`, the reference canvas, pixel density, screenshots or dashboard bezel dimensions. The streamed preview's display rotation changes presentation/input mapping; the native app still owns its safe-area layout.
|
|
153
|
+
|
|
154
|
+
The full hook object keeps its identity while its four canvas inset values are unchanged. Using `[insets]` as an effect or memo dependency is supported; unrelated component state must not create a fresh inset object or retrigger the effect.
|
|
155
|
+
|
|
156
|
+
## 6. Choose the pattern for the screen
|
|
157
|
+
|
|
158
|
+
### Ordinary catalog, settings and forms
|
|
159
|
+
|
|
160
|
+
Prefer one protected native layout with header/footer in normal flow. The list fills the remaining viewport. Add category spacing to the list's content container; do not also reserve in-flow header height. Reuse the same chrome composition across screens rather than compensating each screen separately.
|
|
161
|
+
|
|
162
|
+
### Full-bleed Home and detail heroes
|
|
163
|
+
|
|
164
|
+
Let images, video, gradients and background colors reach the edges. Protect logo, title, action buttons and navigation independently of that background. The hero's total visual height and the controls' safe position are separate quantities. If the hero starts below a protected header, its controls do not need that header offset again.
|
|
165
|
+
|
|
166
|
+
The first rail should derive its position from the actual hero/content arrangement. Do not add header clearance both to the hero container and to the rail below it. Select explicit physical `edges` for protected overlay containers instead of hardcoding an iPad margin. Custom inset arithmetic is available through the canvas-unit hook; navigator footprints still belong to the app's shared layout policy.
|
|
167
|
+
|
|
168
|
+
### Side navigation and floating rails
|
|
169
|
+
|
|
170
|
+
Reserve left and right independently. A left navigator's width belongs only on the left. A floating right rail can need trailing scroll padding even if the artwork extends underneath it. Reserve the actual resolved layout's footprint: a configured side menu that collapses into bottom tabs on phone must contribute bottom clearance there, not its desktop width.
|
|
171
|
+
|
|
172
|
+
### Players
|
|
173
|
+
|
|
174
|
+
Video can be full-bleed. Close/back buttons, captions, timeline and playback controls need protected positions, including both landscape sides. System-bar changes must update the inset source; do not force all insets to zero because the video is fullscreen. Keep focus rings and touch targets within the usable bounds.
|
|
175
|
+
|
|
176
|
+
### Modal, dialog and bottom sheet
|
|
177
|
+
|
|
178
|
+
The backdrop may cover the full window. Dialog controls need bounds appropriate to their actual host. A bottom sheet needs the home-indicator band once, plus its chosen design spacing. Do not automatically add a screen's tab-bar clearance to a modal that covers those tabs. Ensure absolute-positioned pressables remain inside their parent's hit-test bounds; visible overflow alone does not make them tappable.
|
|
179
|
+
|
|
180
|
+
## 7. Scrolling and keyboard ownership
|
|
181
|
+
|
|
182
|
+
Use `contentContainerStyle` for scrollable start/end spacing. A list that scrolls behind an overlay needs enough trailing content padding to bring its last item and focus target entirely clear. Padding only the first row or using a visual spacer outside the scroll content will not establish that guarantee.
|
|
183
|
+
|
|
184
|
+
Native automatic content-inset adjustments are a separate mechanism from safe-area wrappers and content padding. Maintain one deliberate policy when extending the runtime; do not stack automatic adjustment on top of the same manually consumed edge. Public Adelin ScrollView currently does not expose the upstream native adjustment controls, so agents must not pass them.
|
|
185
|
+
|
|
186
|
+
Safe-area insets exclude the software keyboard. Assign keyboard avoidance to one form/host owner; do not treat keyboard height as `safe.bottom` or add keyboard clearance twice. Where the keyboard and bottom chrome occupy overlapping regions, resolve their real geometry instead of summing every reported height.
|
|
187
|
+
|
|
188
|
+
## 8. React to the actual device and layout
|
|
189
|
+
|
|
190
|
+
Insets and available bounds must react to rotation, window resize, split view, native system-bar visibility, resolved navigator changes and visible floating controls. Compute shared clearance from subscribed inputs, not module-level values or imperative store getters called once during render. A memo is safe only when its dependencies include every input that affects geometry.
|
|
191
|
+
|
|
192
|
+
Do not assume landscape means `top = 0`, tablet means no status bar, or both landscape directions have symmetric side insets. Do not manually rotate reported native inset fields to match the dashboard video stream. Insets may arrive after the orientation/dimension event; avoid remounting the screen or resetting navigation merely to recalculate layout.
|
|
193
|
+
|
|
194
|
+
| Target | Policy |
|
|
195
|
+
| --- | --- |
|
|
196
|
+
| iOS phone / iPad | Use measured native edges in both orientations, including iPad status UI |
|
|
197
|
+
| Android phone / tablet | Respect the host's actual edge-to-edge/system-bar policy and gesture/button navigation |
|
|
198
|
+
| Desktop browser | Usually zero system bands, while authored chrome still has a footprint |
|
|
199
|
+
| Mobile browser / PWA | Consume measured CSS environment values; require a supporting browser and appropriate viewport policy |
|
|
200
|
+
| tvOS / Android TV / webOS / web TV | Separate system-safe geometry, any overscan policy and design margins; no mobile status-bar constants |
|
|
201
|
+
| Foldable / split window | Recompute usable regions; four edge insets alone cannot describe an interior hinge |
|
|
202
|
+
|
|
203
|
+
Do not implement your own global platform stubs.
|
|
204
|
+
|
|
205
|
+
## 9. Agent workflow and acceptance
|
|
206
|
+
|
|
207
|
+
1. Inspect the layout ancestors and public API. Identify system-edge ownership, chrome in flow versus overlay, and the units in use.
|
|
208
|
+
2. Choose ordinary protected content or full-bleed background with protected controls. Keep the policy shared across relevant screens.
|
|
209
|
+
3. Use SafeAreaView edge selection or the canvas-unit hook. For unavailable hinge/occlusion or navigator geometry, report the runtime gap and record a follow-up; do not fabricate APIs or device constants.
|
|
210
|
+
4. Typecheck and compile the complete affected workspace. Passing compilation proves the contract, not safe placement on a device.
|
|
211
|
+
5. Verify the rendered screen on representative targets. Check actual taps/focus as well as screenshots.
|
|
212
|
+
6. Record observed results separately from untested targets. Report anything you could not deliver to the builder in plain words.
|
|
213
|
+
|
|
214
|
+
Verification should include a notched phone, an iPad with visible status bar, both landscape directions, Android gesture/button navigation, browser/PWA and a TV target when supported. Check normal and empty/loading states, first/last scroll items, visible/hidden chrome, modal controls and the bottom action with a keyboard open. Rotate while preserving screen state. Check asymmetrical edges, changed window sizes and non-unit descriptor scales. RTL is excluded from current acceptance. These are acceptance cases, not a claim that all are currently supported or tested.
|
|
215
|
+
|
|
216
|
+
## References and follow-up boundary
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
Provider-relative inset semantics and keyboard separation are documented in [Safe Area Context usage](https://appandflow.github.io/react-native-safe-area-context/usage/). Its [inset hook reference](https://appandflow.github.io/react-native-safe-area-context/api/use-safe-area-insets/) describes asynchronous inset updates. [React Native ScrollView](https://reactnative.dev/docs/scrollview) describes content container padding and native automatic adjustments; only Adelin's closed subset is available to authored code.
|
|
220
|
+
|
|
221
|
+
The runtime now owns native/browser providers, and the public hook and edge props are supported through declarations, compiler, validation, printer and interpreter. Applying them to an already generated app requires editing that app's layout. Four safe-area edges do not describe an interior hinge or decide which content layout a resized/folded window should use.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Streaming playbook
|
|
2
|
+
|
|
3
|
+
Viewers already know how a streaming service works. Artwork fills the screen, rows of titles sit
|
|
4
|
+
under it, and the remote or thumb moves predictably. Build on those habits. An app earns its
|
|
5
|
+
identity inside these conventions, through the choices listed under "Where identity lives", not
|
|
6
|
+
by breaking them. Read this before the art direction in the [design guide](design-guide.md).
|
|
7
|
+
The [approved references](approved/README.md) show the quality bar.
|
|
8
|
+
|
|
9
|
+
The sizes below are ranges that work on the 960×540 TV canvas and on 375–430 wide phones. They
|
|
10
|
+
are starting points, not a template. A custom layout is welcome when it passes the hard rules
|
|
11
|
+
and the [visual review](visual-review.md).
|
|
12
|
+
|
|
13
|
+
Use the [new-app entry flow](design-guide.md#default-new-app-entry-flow) for public landing
|
|
14
|
+
and authentication screens. The content-browsing layout rules below apply to Home and the library.
|
|
15
|
+
|
|
16
|
+
## Hard rules
|
|
17
|
+
|
|
18
|
+
Every app keeps these. Each rule names a failure to avoid; how you avoid it is your choice.
|
|
19
|
+
|
|
20
|
+
1. **Artwork is the subject.** Never crop off a head, a face or the title lettering in the art,
|
|
21
|
+
never stretch an image, and never leave an empty or grey frame.
|
|
22
|
+
2. **Fill a frame with the art you have.** When the art matches the frame, use it as it is: a 16:9
|
|
23
|
+
backdrop for a wide hero, a poster for a tall card. When only another shape exists, show it
|
|
24
|
+
uncropped in its own shape and fill the rest of the frame with a blurred, enlarged copy of the
|
|
25
|
+
same image under a scrim, or with a theme gradient. With no art at all, design a deliberate
|
|
26
|
+
text-led treatment; never invent an image.
|
|
27
|
+
3. **Chrome sits over the art, not beside it.** Navigation and copy go over the image on a scrim.
|
|
28
|
+
Don't shrink or letterbox the hero to make room for bars.
|
|
29
|
+
4. **Home’s first viewport shows the hero and the start of a populated rail**, so viewers can see
|
|
30
|
+
there is more to browse.
|
|
31
|
+
5. **Text over art stays readable.** Put it on the scrim side, and check it over the brightest
|
|
32
|
+
and the busiest artwork in the library.
|
|
33
|
+
6. **Focus shows at once and never moves the layout.** The focused item is the clearest thing in
|
|
34
|
+
its area, over light and dark art alike.
|
|
35
|
+
7. **Navigation stays familiar.** On TV use top tabs or a side rail; on a phone, a bottom tab
|
|
36
|
+
bar. Back always returns to where the viewer came from.
|
|
37
|
+
|
|
38
|
+
## Proven layouts
|
|
39
|
+
|
|
40
|
+
Pick a pattern for each screen and combine them to suit the brief and the library.
|
|
41
|
+
|
|
42
|
+
### TV Home hero
|
|
43
|
+
|
|
44
|
+
| Pattern | Use it when | Proven shape |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| Full-bleed billboard | Featured titles have strong 16:9 backdrops | Art from the top-right, 70–100% of the width and 65–100% of the height. A left scrim runs from solid to clear by 40–55% of the width; a bottom scrim is clear to about half the height, then solid. Copy sits bottom-left, 480–560 wide, in a block 280–320 tall, so the first rail shows. |
|
|
47
|
+
| Focus-led backdrop | A large mixed library | The billboard frame, but the backdrop crossfades to the focused rail card once focus rests for 300–500 ms. Browsing previews titles without opening them. |
|
|
48
|
+
| Spotlight pager | A few featured titles | Billboard frame in a `Carousel`. The dots below page through the featured titles and show the position. It moves only when the viewer asks. |
|
|
49
|
+
| Split hero | Mostly posters, or mixed shapes | The art in its own shape on one side over a blurred fill of itself, with the copy on the other side. |
|
|
50
|
+
| Now live | A live channel or event service | What is on now, with its time slot and progress, then upcoming programmes. |
|
|
51
|
+
| Text-led | No usable artwork | A large title, a short description and a field of the accent colour, with real content in the rails. |
|
|
52
|
+
|
|
53
|
+
### Phone Home hero
|
|
54
|
+
|
|
55
|
+
| Pattern | Use it when | Proven shape |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Tall poster | Posters or strong portrait crops exist | Height 1.2–1.45 × the width, capped near 660. The wordmark sits on a top scrim; the copy and one action sit on a bottom scrim. |
|
|
58
|
+
| Wide card | Only backdrops exist | A 16:9 card under the wordmark, with copy and action below it. |
|
|
59
|
+
| Poster pager | Several featured titles | A `Carousel` of posters with `mode="parallax"`, the next one peeking in. |
|
|
60
|
+
|
|
61
|
+
### Navigation
|
|
62
|
+
|
|
63
|
+
- **TV top tabs:** up to five destinations. The wordmark sits on the left and the tabs float over
|
|
64
|
+
the art on a soft top scrim. The active tab is marked by weight or an underline.
|
|
65
|
+
- **TV side rail:** five or more destinations. Icons that expand with labels when the rail has focus.
|
|
66
|
+
- **Phone:** a bottom tab bar with four or five items. The top area stays transparent over the hero.
|
|
67
|
+
- **Wide browser:** follows the TV pattern the app chose, with pointer hover.
|
|
68
|
+
|
|
69
|
+
### Rails
|
|
70
|
+
|
|
71
|
+
| Rail | TV | Phone | Notes |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| Landscape 16:9 | 5–6 visible, cards 150–170 wide | about 1.6–2.2 visible | The default for mixed libraries. |
|
|
74
|
+
| Poster 2:3 | 7–8 visible, cards 100–115 wide | about 3.2 visible | For films and series with posters. |
|
|
75
|
+
| Continue watching | Landscape | Landscape | A progress line plus "S1 · E4 · 11 min left". |
|
|
76
|
+
| Ranked | Posters with a large numeral | Same | Only for a real ranking. |
|
|
77
|
+
| Feature row | 2–3 large cards with a line of description | One card per view | For a curated collection with something to say. |
|
|
78
|
+
|
|
79
|
+
- The next card always peeks at the edge.
|
|
80
|
+
- Space cards with margins of 8–12, never flex `gap`.
|
|
81
|
+
- One gutter for every heading and rail: about 48 on TV and 16 on a phone.
|
|
82
|
+
- Put the card title inside the image on a bottom scrim, or below it. Put it below when the
|
|
83
|
+
artwork has its own title lettering.
|
|
84
|
+
|
|
85
|
+
### Detail
|
|
86
|
+
|
|
87
|
+
| Pattern | Use it when |
|
|
88
|
+
|---|---|
|
|
89
|
+
| Full-bleed | Strong backdrops. Home's hero frame, taller and up to the full screen: title, metadata, a 2–3 line synopsis, then Play and secondary actions. Below come seasons and episodes, or "More like this". |
|
|
90
|
+
| Poster with info column | Posters only. The poster in its own shape on one side, with the information over a blurred fill. |
|
|
91
|
+
| Episode-led | Series viewers return to. Season tabs and the episode list take the first viewport, over the art behind a heavy scrim. |
|
|
92
|
+
|
|
93
|
+
### Search and Browse
|
|
94
|
+
|
|
95
|
+
- **Search:** a field and a results grid. On TV, put the keyboard beside the results. Show useful
|
|
96
|
+
defaults, such as all titles or popular ones, before the viewer types.
|
|
97
|
+
- **Browse:** filter tabs or chips, then a grid or collection rails.
|
|
98
|
+
|
|
99
|
+
## Motion
|
|
100
|
+
|
|
101
|
+
Pick one personality, then up to three moments that explain a change. Animate only opacity and
|
|
102
|
+
transform, never layout size. Focus never waits for an animation.
|
|
103
|
+
|
|
104
|
+
| Personality | Focus | Content change | Surfaces |
|
|
105
|
+
|---|---|---|---|
|
|
106
|
+
| Quiet | An edge or brightness change only, under 80 ms | Crossfade over 300–400 ms | Fade over 160–200 ms |
|
|
107
|
+
| Crisp | Edge at once, scale 1.04 over 120–150 ms | Crossfade over 200–250 ms | Fade and rise 8–16 over 180–220 ms |
|
|
108
|
+
| Lush | Edge at once, scale 1.06 over 180–200 ms | Crossfade over 400–600 ms | Fade and rise 16–24 over 240–300 ms |
|
|
109
|
+
|
|
110
|
+
Moments that have worked:
|
|
111
|
+
|
|
112
|
+
- **The backdrop follows focus:** crossfade after focus rests, so holding a direction key never
|
|
113
|
+
strobes the art.
|
|
114
|
+
- **Detail rises in:** the detail page fades in while rising slightly.
|
|
115
|
+
- **Saved to list:** the icon swaps and pulses once.
|
|
116
|
+
- **Rail settle:** the focused card stays aligned to the gutter while the rail scrolls.
|
|
117
|
+
|
|
118
|
+
Leave room for scale: neighbouring cards need enough margin that a scaled card never overlaps them.
|
|
119
|
+
|
|
120
|
+
## Where identity lives
|
|
121
|
+
|
|
122
|
+
Two apps built on the same patterns should be told apart at a glance by:
|
|
123
|
+
|
|
124
|
+
- the palette and accent, and where the accent appears;
|
|
125
|
+
- type character: weight, tracking, case and size contrast within the type scale;
|
|
126
|
+
- card shape: corner radius, edges and title placement;
|
|
127
|
+
- the focus treatment and the motion personality;
|
|
128
|
+
- the wordmark or logo and the rail heading style;
|
|
129
|
+
- the voice of the copy.
|
|
130
|
+
|
|
131
|
+
Spend the boldness on one of these and keep the rest quiet.
|