one
Version:
One is a React framework for web, iOS, and Android apps.
447 lines (446 loc) • 9.79 kB
text/typescript
// generated by bun run generate from the SwiftUI SDK and codegen/catalog.ts.
// edit the generator or catalog, then regenerate.
export type MenuOrder = 'automatic' | 'priority' | 'fixed'
export type Visibility = 'automatic' | 'visible' | 'hidden'
export type PickerStyle =
| 'wheel'
| 'inline'
| 'automatic'
| 'segmented'
| 'tabs'
| 'palette'
| 'navigationLink'
| 'menu'
export type DatePickerStyle = 'wheel' | 'automatic' | 'graphical' | 'compact'
export type ToggleStyle = 'button' | 'automatic' | 'switch'
export type MenuActionDismissBehavior = 'automatic' | 'enabled' | 'disabled'
export type TabViewStyle = 'sidebarAdaptable' | 'page' | 'tabBarOnly' | 'automatic'
export type ButtonRole = 'destructive' | 'cancel' | 'confirm' | 'close'
export type TabRole = 'search' | 'prominent'
export type TabPlacement = 'automatic' | 'pinned' | 'sidebarOnly'
export type AdaptableTabBarPlacement = 'automatic' | 'tabBar' | 'sidebar'
export type TabCustomizationBehavior = 'automatic' | 'reorderable' | 'disabled'
export type TabSectionExpansion = 'automatic' | 'expanded' | 'collapsed'
export type SpringLoadingBehavior = 'automatic' | 'enabled' | 'disabled'
export type ControlGroupStyle =
| 'palette'
| 'automatic'
| 'navigation'
| 'menu'
| 'compactMenu'
export type PrimitiveButtonStyle =
| 'automatic'
| 'glass'
| 'borderless'
| 'glassProminent'
| 'plain'
| 'bordered'
| 'borderedProminent'
export type ProgressViewStyle = 'linear' | 'circular' | 'automatic'
export type GaugeStyle =
| 'accessoryCircularCapacity'
| 'linearCapacity'
| 'accessoryLinear'
| 'accessoryLinearCapacity'
| 'automatic'
| 'accessoryCircular'
export type TextFieldStyle = 'automatic' | 'roundedBorder' | 'bordered' | 'plain'
export type SubmitLabel =
| 'done'
| 'go'
| 'send'
| 'join'
| 'route'
| 'search'
| 'return'
| 'next'
| 'continue'
export type TextInputAutocapitalization = 'never' | 'words' | 'sentences' | 'characters'
export type Axis = 'horizontal' | 'vertical'
export type Edge = 'top' | 'leading' | 'bottom' | 'trailing'
export type PresentationAdaptation =
| 'automatic'
| 'none'
| 'popover'
| 'sheet'
| 'fullScreenCover'
export type PresentationContentInteraction = 'automatic' | 'resizes' | 'scrolls'
export type ColorScheme = 'light' | 'dark'
export type DynamicTypeSize =
| 'xSmall'
| 'small'
| 'medium'
| 'large'
| 'xLarge'
| 'xxLarge'
| 'xxxLarge'
| 'accessibility1'
| 'accessibility2'
| 'accessibility3'
| 'accessibility4'
| 'accessibility5'
export type ControlSize = 'mini' | 'small' | 'regular' | 'large' | 'extraLarge'
export type SymbolRenderingMode = 'monochrome' | 'multicolor' | 'hierarchical' | 'palette'
export type SymbolVariants = 'none' | 'circle' | 'square' | 'rectangle' | 'fill' | 'slash'
export type ImageScale = 'small' | 'medium' | 'large'
export type PhotosPickerSelectionBehavior =
| 'default'
| 'ordered'
| 'continuous'
| 'continuousAndOrdered'
export type EncodingDisambiguationPolicy = 'automatic' | 'current' | 'compatible'
export type BackForwardNavigationGesturesBehavior = 'automatic' | 'enabled' | 'disabled'
export type MagnificationGesturesBehavior = 'automatic' | 'enabled' | 'disabled'
export type LinkPreviewBehavior = 'automatic' | 'enabled' | 'disabled'
export type ElementFullscreenBehavior = 'automatic' | 'enabled' | 'disabled'
export type ListStyle =
| 'automatic'
| 'sidebar'
| 'inset'
| 'grouped'
| 'insetGrouped'
| 'plain'
export type ToolbarItemPlacement =
| 'automatic'
| 'principal'
| 'navigation'
| 'primaryAction'
| 'secondaryAction'
| 'status'
| 'confirmationAction'
| 'cancellationAction'
| 'destructiveAction'
| 'keyboard'
| 'topBarLeading'
| 'topBarTrailing'
| 'topBarPinnedTrailing'
| 'navigationBarLeading'
| 'navigationBarTrailing'
| 'title'
| 'largeTitle'
| 'bottomBar'
| 'subtitle'
| 'largeSubtitle'
export type SpacerSizing = 'flexible' | 'fixed'
export type PayWithApplePayButtonStyle = 'white' | 'whiteOutline' | 'black' | 'automatic'
export type AddPassToWalletButtonStyle = 'black' | 'blackOutline'
export type PayWithApplePayButtonLabel =
| 'plain'
| 'buy'
| 'addMoney'
| 'book'
| 'checkout'
| 'continue'
| 'contribute'
| 'donate'
| 'inStore'
| 'order'
| 'reload'
| 'rent'
| 'setUp'
| 'subscribe'
| 'support'
| 'tip'
| 'topUp'
export const swiftUIValues = {
MenuOrder: {
automatic: 16,
priority: 16,
fixed: 16,
},
Visibility: {
automatic: 15,
visible: 15,
hidden: 15,
},
PickerStyle: {
wheel: 13,
inline: 14,
automatic: 13,
segmented: 13,
tabs: 27,
palette: 17,
navigationLink: 16,
menu: 14,
},
DatePickerStyle: {
wheel: 13,
automatic: 13,
graphical: 14,
compact: 14,
},
ToggleStyle: {
button: 15,
automatic: 13,
switch: 13,
},
MenuActionDismissBehavior: {
automatic: 16.4,
enabled: 16.4,
disabled: 16.4,
},
TabViewStyle: {
sidebarAdaptable: 18,
page: 14,
tabBarOnly: 18,
automatic: 14,
},
ButtonRole: {
destructive: 15,
cancel: 15,
confirm: 26,
close: 26,
},
TabRole: {
search: 18,
prominent: 27,
},
TabPlacement: {
automatic: 18,
pinned: 18,
sidebarOnly: 18,
},
AdaptableTabBarPlacement: {
automatic: 18,
tabBar: 18,
sidebar: 18,
},
TabCustomizationBehavior: {
automatic: 18,
reorderable: 18,
disabled: 18,
},
TabSectionExpansion: {
automatic: 27,
expanded: 27,
collapsed: 27,
},
SpringLoadingBehavior: {
automatic: 17,
enabled: 17,
disabled: 17,
},
ControlGroupStyle: {
palette: 17,
automatic: 15,
navigation: 15,
menu: 16.4,
compactMenu: 16.4,
},
PrimitiveButtonStyle: {
automatic: 13,
glass: 26,
borderless: 13,
glassProminent: 26,
plain: 13,
bordered: 15,
borderedProminent: 15,
},
ProgressViewStyle: {
linear: 14,
circular: 14,
automatic: 14,
},
GaugeStyle: {
accessoryCircularCapacity: 16,
linearCapacity: 16,
accessoryLinear: 16,
accessoryLinearCapacity: 16,
automatic: 16,
accessoryCircular: 16,
},
TextFieldStyle: {
automatic: 13,
roundedBorder: 13,
bordered: 27,
plain: 13,
},
SubmitLabel: {
done: 15,
go: 15,
send: 15,
join: 15,
route: 15,
search: 15,
return: 15,
next: 15,
continue: 15,
},
TextInputAutocapitalization: {
never: 15,
words: 15,
sentences: 15,
characters: 15,
},
Axis: {
horizontal: 13,
vertical: 13,
},
Edge: {
top: 13,
leading: 13,
bottom: 13,
trailing: 13,
},
PresentationAdaptation: {
automatic: 16.4,
none: 16.4,
popover: 16.4,
sheet: 16.4,
fullScreenCover: 16.4,
},
PresentationContentInteraction: {
automatic: 16.4,
resizes: 16.4,
scrolls: 16.4,
},
ColorScheme: {
light: 13,
dark: 13,
},
DynamicTypeSize: {
xSmall: 15,
small: 15,
medium: 15,
large: 15,
xLarge: 15,
xxLarge: 15,
xxxLarge: 15,
accessibility1: 15,
accessibility2: 15,
accessibility3: 15,
accessibility4: 15,
accessibility5: 15,
},
ControlSize: {
mini: 15,
small: 15,
regular: 15,
large: 15,
extraLarge: 17,
},
SymbolRenderingMode: {
monochrome: 15,
multicolor: 15,
hierarchical: 15,
palette: 15,
},
SymbolVariants: {
none: 15,
circle: 15,
square: 15,
rectangle: 15,
fill: 15,
slash: 15,
},
ImageScale: {
small: 13,
medium: 13,
large: 13,
},
PhotosPickerSelectionBehavior: {
default: 16,
ordered: 16,
continuous: 17,
continuousAndOrdered: 17,
},
EncodingDisambiguationPolicy: {
automatic: 16,
current: 16,
compatible: 16,
},
BackForwardNavigationGesturesBehavior: {
automatic: 26,
enabled: 26,
disabled: 26,
},
MagnificationGesturesBehavior: {
automatic: 26,
enabled: 26,
disabled: 26,
},
LinkPreviewBehavior: {
automatic: 26,
enabled: 26,
disabled: 26,
},
ElementFullscreenBehavior: {
automatic: 26,
enabled: 26,
disabled: 26,
},
ListStyle: {
automatic: 13,
sidebar: 14,
inset: 14,
grouped: 13,
insetGrouped: 14,
plain: 13,
},
ToolbarItemPlacement: {
automatic: 14,
principal: 14,
navigation: 14,
primaryAction: 14,
secondaryAction: 16,
status: 14,
confirmationAction: 14,
cancellationAction: 14,
destructiveAction: 14,
keyboard: 15,
topBarLeading: 14,
topBarTrailing: 14,
topBarPinnedTrailing: 27,
navigationBarLeading: 14,
navigationBarTrailing: 14,
title: 14,
largeTitle: 26,
bottomBar: 14,
subtitle: 26,
largeSubtitle: 26,
},
SpacerSizing: {
flexible: 26,
fixed: 26,
},
PayWithApplePayButtonStyle: {
white: 16,
whiteOutline: 16,
black: 16,
automatic: 16,
},
AddPassToWalletButtonStyle: {
black: 16,
blackOutline: 16,
},
PayWithApplePayButtonLabel: {
plain: 16,
buy: 16,
addMoney: 16,
book: 16,
checkout: 16,
continue: 16,
contribute: 16,
donate: 16,
inStore: 16,
order: 16,
reload: 16,
rent: 16,
setUp: 16,
subscribe: 16,
support: 16,
tip: 16,
topUp: 16,
},
} as const
export function assertSwiftUIValue(
type: keyof typeof swiftUIValues,
value: string,
iosVersion: number
) {
const values: Record<string, number> = swiftUIValues[type]
if (!Object.hasOwn(values, value))
throw new Error('Unknown SwiftUI ' + type + ': ' + value)
if (iosVersion < values[value])
throw new Error(type + '.' + value + ' requires iOS ' + values[value])
}