index.ts (2592B)
1 import { build_theme_layout_variables, with_prefix } from "../tokens.js"; 2 import type { 3 IosHeightTokenKey, 4 IosWidthTokenKey, 5 TailwindThemeConfig, 6 ThemeLayoutEntry, 7 ThemeLayoutParam 8 } from "../types.js"; 9 10 const ios_height_tokens: Record<IosHeightTokenKey, string> = { 11 nav_tabs_ios0: "80px", 12 nav_tabs_ios1: "120px", 13 nav_page_toolbar_ios0: "72px", 14 nav_page_toolbar_ios1: "120px", 15 nav_page_header_ios0: "62px", 16 nav_page_header_ios1: "62px", 17 lo_bottom_button_ios0: "90px", 18 lo_bottom_button_ios1: "112px", 19 lo_view_main_ios0: "22rem", 20 lo_view_main_ios1: "28rem" 21 }; 22 23 const ios_width_tokens: Record<IosWidthTokenKey, string> = { 24 lo_ios0: "340px", 25 lo_ios1: "345px", 26 lo_textdesc_ios0: "312px", 27 lo_textdesc_ios1: "312px", 28 lo_line_entry_ios0: "349px", 29 lo_line_entry_ios1: "378px" 30 }; 31 32 const dimension_tokens: ThemeLayoutEntry = { 33 ios0: "340px", 34 ios1: "345px" 35 }; 36 37 const base_spacing_tokens: ThemeLayoutEntry = { 38 line: "1px", 39 edge: "2px" 40 }; 41 42 const height_scale: ThemeLayoutEntry = { 43 ...ios_height_tokens, 44 ...dimension_tokens, 45 line: "46px", 46 line_button: "3.25rem", 47 touch_guide: "3.4rem", 48 entry_line: "48px", 49 bold_button: "4.25rem" 50 }; 51 52 const width_scale: ThemeLayoutEntry = { 53 ...ios_width_tokens, 54 ...dimension_tokens, 55 trellis_value: "180px", 56 trellis_display: "286px" 57 }; 58 59 const dimension_scale: ThemeLayoutEntry = { 60 ...dimension_tokens 61 }; 62 63 const min_height_scale: ThemeLayoutEntry = { 64 ...height_scale 65 }; 66 67 const max_height_scale: ThemeLayoutEntry = { 68 ...height_scale 69 }; 70 71 const min_width_scale: ThemeLayoutEntry = { 72 ...width_scale 73 }; 74 75 const max_width_scale: ThemeLayoutEntry = { 76 ...width_scale 77 }; 78 79 const padding_scale: ThemeLayoutEntry = { 80 ...with_prefix("h_", height_scale), 81 ...with_prefix("w_", width_scale), 82 ...with_prefix("dim_", dimension_scale) 83 }; 84 85 const translate_scale: ThemeLayoutEntry = { 86 ...with_prefix("h_", height_scale), 87 ...with_prefix("w_", width_scale) 88 }; 89 90 const spacing_scale: ThemeLayoutEntry = { 91 ...base_spacing_tokens, 92 ...with_prefix("dim_", dimension_scale) 93 }; 94 95 const app_theme_config: TailwindThemeConfig = { 96 height: height_scale, 97 width: width_scale, 98 min_height: min_height_scale, 99 max_height: max_height_scale, 100 min_width: min_width_scale, 101 max_width: max_width_scale, 102 padding: padding_scale, 103 translate: translate_scale, 104 spacing: spacing_scale 105 }; 106 107 export const theme_app_layout: ThemeLayoutParam = { 108 variables: build_theme_layout_variables(app_theme_config) 109 };