oneslash-design-system 2.9.0 → 2.10.1

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 CHANGED
@@ -34,6 +34,17 @@ The package ships Tailwind class names, CSS variables and untranspiled `.jsx`. E
34
34
 
35
35
  Use class names that mean the same thing in Tailwind v3 and v4 inside components, since apps on both versions compile them.
36
36
 
37
+ ## Using the design system in a native app
38
+
39
+ The Swift package `OneSlashDesign` (iOS 26 and macOS 26 and later) is this repository: `https://github.com/oneSlash-app/design-system`.
40
+
41
+ 1. Add the package with Swift Package Manager (`.package(url: "https://github.com/oneSlash-app/design-system", from: "2.10.0")`) and the `OneSlashDesign` product to the target (`.product(name: "OneSlashDesign", package: "design-system")`; by URL the package identity is `design-system`), then `import OneSlashDesign`.
42
+ 2. In the app's asset catalog, define the `AccentColor` color set with an "Any Appearance" value and a "Dark" value, both sRGB, replacing the empty default Xcode creates. Take the two values from the chosen theme's `accent.main` row (light and dark columns) in the color table in [DESIGN.md](./dist/DESIGN.md). Name it as the app's global accent color (the `ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME` build setting, `AccentColor` by default in new Xcode projects). It is required: it tints controls, alerts and selection, and on macOS it yields to the user's system accent choice by design.
43
+ 3. Apply one theme at the scene root: `.odsTheme(.forest)`. It sets the text foreground styles, as fixed colors resolved for the current appearance, and no tint and no background.
44
+ 4. Read colors from `@Environment(\.odsTheme)`, for example `theme.background.default`, and use `ODSSpacing`, `ODSRadius`, `ODSDuration` and `Font.ods(_:)` for our own content views.
45
+
46
+ [DESIGN.md](./dist/DESIGN.md) has the rules for a "100% ODS" native app and the table that maps each web component to its native control. The Compose theme is not built yet.
47
+
37
48
  ## Building a page
38
49
 
39
50
  2.4.0 adds what a page needs on top of the components, so a page can be written with no markup of its own: `PageShell` (the column and the space between sections), `PageHeader`, `SectionIntro`, `FactsRow`, `NumberedRow`, `Surface` (a panel, or a sheet of `paper`), `Figure`, `LinkCard`, `Heading`, `Paragraph`, `List`, and the layout helpers `Stack`, `Cluster`, `Grid` and `PageSection` in `components/layout`. Spacing has steps up to `page` (160px), text widths are `max-w-measure-*`, and the column is `max-w-page`. A Button in a `Stack` stretches to the full width, so put it in a `Cluster`.
@@ -52,7 +63,7 @@ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
52
63
 
53
64
  ## Releasing
54
65
 
55
- Bump `version` in `package.json`, run `npm run build`, and merge to `main`. The Release workflow runs the tests and `npm run check:contrast`, then publishes to npm, creates the tag and GitHub Release with notes from the merged PR titles, and updates the docs site.
66
+ Bump `version` in `package.json`, run `npm run build`, and merge to `main`. The Release workflow runs the tests and `npm run check:contrast`, then publishes to npm, creates the tag and GitHub Release with notes from the merged PR titles, and updates the docs site. The same `v<version>` tag is the Swift package version.
56
67
 
57
68
  This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
58
69
 
package/dist/DESIGN.md ADDED
@@ -0,0 +1,278 @@
1
+ <!-- Generated from designTokens.js by scripts/build-tokens.js. Do not edit. -->
2
+ # oneSlash design system (ODS)
3
+
4
+ ODS is the oneSlash design system. One source, `designTokens.js`, defines every color, spacing step, radius and type role. The build turns it into CSS themes and Tailwind presets for the web, a Swift package for Apple apps, and `tokens.json` in the W3C design tokens format. The tables in this file are generated from the same source, so they match the tokens exactly.
5
+
6
+ ## Using ODS on the web
7
+
8
+ The package ships Tailwind class names, CSS variables and untranspiled `.jsx`. Each app compiles the components itself and picks one theme.
9
+
10
+ 1. Import one theme file from `oneslash-design-system/themes/`. It includes `tokens.css`.
11
+ - `default.css`: light and dark switched by a `.dark` class on `<html>`.
12
+ - `default-auto.css`: follows the OS (`.light` opts out of OS dark).
13
+ - `forest.css`, `clay.css`, `indigo.css`, `wine.css`: brand themes. Each has an `-auto` version.
14
+ 2. Tailwind v3: add `presets: [require("oneslash-design-system/tailwind")]`, or `oneslash-design-system/tailwind-auto` for OS-driven dark mode. Without the preset the components render unstyled.
15
+ 3. Tailwind v4: import `oneslash-design-system/theme.css` (or `theme-auto.css`), plus `typography.css` for the type scale.
16
+ 4. Next.js: set `transpilePackages: ["oneslash-design-system"]` in `next.config`.
17
+ 5. Make Tailwind scan the components: v3 `content` gets `./node_modules/oneslash-design-system/dist/**/*.{js,jsx}`; v4 CSS gets `@source "../node_modules/oneslash-design-system/dist/**/*.jsx";`.
18
+ 6. Load Inter and Fira Code. The package names them but does not ship them.
19
+
20
+ An app uses one theme. Do not switch themes at runtime.
21
+
22
+ ## Color tokens
23
+
24
+ Use one semantic name, never a hex value. Each name resolves to a light and a dark value, so the same name works in both modes. The table lists every color for the default theme and for each brand theme.
25
+
26
+ | Token | default light | default dark | forest light | forest dark | clay light | clay dark | indigo light | indigo dark | wine light | wine dark |
27
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
28
+ | text.primary | #000000 | #eeeeee | #1C2213 | #D9E5C7 | #2B1F12 | #F2E2CE | #111A2E | #E3ECF5 | #2A1622 | #F2EDE4 |
29
+ | text.secondary | #686868 | #B0B0B0 | #515E3C | #9DAA85 | #6B5640 | #C2AD93 | #4A5670 | #A3B2C8 | #6A4A5C | #C2AAB6 |
30
+ | text.disabled | #9E9E9E | #6D6D6D | #8A9670 | #6D7956 | #A8957C | #7A6A57 | #8F99AD | #637089 | #A68B99 | #7D6672 |
31
+ | text.contrast | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 |
32
+ | accent.main | #EEAE03 | #FFCD29 | #1C2213 | #E7ECDA | #D9B26A | #F2D57E | #204F8C | #C2E0F2 | #8C2668 | #E2B4CC |
33
+ | accent.dark | #CE8602 | #CE8602 | #2A331E | #D6DEC3 | #B8904A | #D9B26A | #162D59 | #9FC6E3 | #6E1D52 | #BF93A8 |
34
+ | accent.light | #FFDD43 | #FFDD43 | #3A472B | #F2F5EA | #F2D57E | #F7E4A8 | #548DBF | #DCEEF8 | #A66086 | #F0D2E1 |
35
+ | accent.contrast | #000000 | #000000 | #E7ECDA | #1C2213 | #2B1F12 | #2B1F12 | #FFFFFF | #162D59 | #F2EDE4 | #2C1A26 |
36
+ | primary.main | #454545 | #D5D5D5 | #454545 | #D5D5D5 | #454545 | #D5D5D5 | #454545 | #D5D5D5 | #454545 | #D5D5D5 |
37
+ | primary.dark | #262626 | #E9E9E9 | #262626 | #E9E9E9 | #262626 | #E9E9E9 | #262626 | #E9E9E9 | #262626 | #E9E9E9 |
38
+ | primary.light | #888888 | #9A9A9A | #888888 | #9A9A9A | #888888 | #9A9A9A | #888888 | #9A9A9A | #888888 | #9A9A9A |
39
+ | primary.contrast | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 | #ffffff | #000000 |
40
+ | secondary.main | #B0B0B0 | #4F4F4F | #6E7A5A | #6E7A5A | #CDB49A | #5C4630 | #B4C6DC | #344566 | #D5BCC8 | #4E3346 |
41
+ | secondary.dark | #888888 | #454545 | #5D6849 | #5D6849 | #B89A7C | #4D3A27 | #8EA6C4 | #2B3A57 | #BF93A8 | #43293C |
42
+ | secondary.light | #D1D1D1 | #6D6D6D | #828D6B | #828D6B | #E2D1BE | #75593D | #CFDCEA | #44587F | #E6D4DC | #634257 |
43
+ | secondary.contrast | #000000 | #eeeeee | #FFFFFF | #FFFFFF | #2B1F12 | #F2E2CE | #111A2E | #E3ECF5 | #2A1622 | #F2EDE4 |
44
+ | error.main | #D32F2F | #E74C4C | #D32F2F | #E74C4C | #D32F2F | #E74C4C | #D32F2F | #E74C4C | #D32F2F | #E74C4C |
45
+ | error.dark | #A82121 | #B22323 | #A82121 | #B22323 | #A82121 | #B22323 | #A82121 | #B22323 | #A82121 | #B22323 |
46
+ | error.light | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 | #F27777 |
47
+ | error.alertBg | #F2C4C4 | #5C1A1A | #F2C4C4 | #5C1A1A | #F2C4C4 | #5C1A1A | #F2C4C4 | #5C1A1A | #F2C4C4 | #5C1A1A |
48
+ | error.contrast | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 |
49
+ | error.fill | #A82121 | #E74C4C | #A82121 | #E74C4C | #A82121 | #E74C4C | #A82121 | #E74C4C | #A82121 | #E74C4C |
50
+ | error.onFill | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 |
51
+ | error.text | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 |
52
+ | error.textHover | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 | #A82121 | #F27777 |
53
+ | error.tint | #F27777 | #B22323 | #F27777 | #B22323 | #F27777 | #B22323 | #F27777 | #B22323 | #F27777 | #B22323 |
54
+ | warning.main | #EF6C00 | #FF8C0A | #EF6C00 | #FF8C0A | #EF6C00 | #FF8C0A | #EF6C00 | #FF8C0A | #EF6C00 | #FF8C0A |
55
+ | warning.dark | #A84600 | #CC5302 | #A84600 | #CC5302 | #A84600 | #CC5302 | #A84600 | #CC5302 | #A84600 | #CC5302 |
56
+ | warning.light | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 | #FFA732 |
57
+ | warning.alertBg | #F5D5B0 | #5C2E0A | #F5D5B0 | #5C2E0A | #F5D5B0 | #5C2E0A | #F5D5B0 | #5C2E0A | #F5D5B0 | #5C2E0A |
58
+ | warning.contrast | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
59
+ | warning.fill | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A |
60
+ | warning.onFill | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 |
61
+ | warning.text | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A | #A84600 | #FF8C0A |
62
+ | warning.textHover | #A84600 | #FFA732 | #A84600 | #FFA732 | #A84600 | #FFA732 | #A84600 | #FFA732 | #A84600 | #FFA732 |
63
+ | warning.tint | #FFA732 | #CC5302 | #FFA732 | #CC5302 | #FFA732 | #CC5302 | #FFA732 | #CC5302 | #FFA732 | #CC5302 |
64
+ | info.main | #0087D4 | #00AFFF | #0087D4 | #00AFFF | #0087D4 | #00AFFF | #0087D4 | #00AFFF | #0087D4 | #00AFFF |
65
+ | info.dark | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB | #006BAB |
66
+ | info.light | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF | #2CC1FF |
67
+ | info.alertBg | #B8D9F0 | #0A3A5C | #B8D9F0 | #0A3A5C | #B8D9F0 | #0A3A5C | #B8D9F0 | #0A3A5C | #B8D9F0 | #0A3A5C |
68
+ | info.contrast | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
69
+ | info.fill | #006BAB | #00AFFF | #006BAB | #00AFFF | #006BAB | #00AFFF | #006BAB | #00AFFF | #006BAB | #00AFFF |
70
+ | info.onFill | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 |
71
+ | info.text | #006BAB | #00AFFF | #0068A3 | #00AFFF | #0068A3 | #00AFFF | #006BAB | #00AFFF | #006BAB | #00AFFF |
72
+ | info.textHover | #006BAB | #2CC1FF | #0068A3 | #2CC1FF | #0068A3 | #2CC1FF | #006BAB | #2CC1FF | #006BAB | #2CC1FF |
73
+ | info.tint | #2CC1FF | #006BAB | #2CC1FF | #006BAB | #2CC1FF | #006BAB | #2CC1FF | #006BAB | #2CC1FF | #006BAB |
74
+ | success.main | #328736 | #42A547 | #328736 | #42A547 | #328736 | #42A547 | #328736 | #42A547 | #328736 | #42A547 |
75
+ | success.dark | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D | #2A6B2D |
76
+ | success.light | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B | #67C16B |
77
+ | success.alertBg | #C4E2C5 | #1A4A1D | #C4E2C5 | #1A4A1D | #C4E2C5 | #1A4A1D | #C4E2C5 | #1A4A1D | #C4E2C5 | #1A4A1D |
78
+ | success.contrast | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
79
+ | success.fill | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 |
80
+ | success.onFill | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 | #FFFFFF | #000000 |
81
+ | success.text | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 | #2A6B2D | #42A547 |
82
+ | success.textHover | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B |
83
+ | success.tint | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D | #67C16B | #2A6B2D |
84
+ | background.default | #e8e8e8 | #262626 | #D9E5C7 | #1C2213 | #EDE0CC | #2A2119 | #DDE6F0 | #141C2E | #EEE4E4 | #2A1F28 |
85
+ | background.accent100 | #f1f1f1 | #333333 | #E2ECD4 | #27301B | #F2E8D9 | #362A1F | #E6EDF5 | #1C263B | #F3EBEA | #352833 |
86
+ | background.accent200 | #f7f7f7 | #454545 | #EBF1E0 | #364228 | #F7F0E6 | #45362A | #EEF3F9 | #29354D | #F7F2F0 | #453541 |
87
+ | background.accent300 | #FFFFFF | #4F4F4F | #F4F7EC | #424F34 | #FCF8F2 | #514034 | #F7F9FC | #33405A | #FCF9F7 | #51404D |
88
+ | background.elevated | #e8e8e8 | #333333 | #D9E5C7 | #27301B | #EDE0CC | #362A1F | #DDE6F0 | #1C263B | #EEE4E4 | #352833 |
89
+ | background.overlay | #FFFFFF | #333333 | #F4F7EC | #27301B | #FCF8F2 | #362A1F | #F7F9FC | #1C263B | #FCF9F7 | #352833 |
90
+ | background.panel | #f1f1f1 | #333333 | #E2ECD4 | #27301B | #F2E8D9 | #362A1F | #E6EDF5 | #1C263B | #F3EBEA | #352833 |
91
+ | background.row | #f7f7f7 | #333333 | #EBF1E0 | #27301B | #F7F0E6 | #362A1F | #EEF3F9 | #1C263B | #F7F2F0 | #352833 |
92
+ | background.paper | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
93
+ | action.active | #888888 | #171717 | #888888 | #171717 | #888888 | #171717 | #888888 | #171717 | #888888 | #171717 |
94
+ | action.hover | #F3F3F3 | #3D3D3D | #F3F3F3 | #3D3D3D | #F3F3F3 | #3D3D3D | #F3F3F3 | #3D3D3D | #F3F3F3 | #3D3D3D |
95
+ | action.selected | #E3E3E3 | #4E4E4E | #E3E3E3 | #4E4E4E | #E3E3E3 | #4E4E4E | #E3E3E3 | #4E4E4E | #E3E3E3 | #4E4E4E |
96
+ | action.disabledBackground | #D1D1D1 | #3C3C3C | #D1D1D1 | #3C3C3C | #D1D1D1 | #3C3C3C | #D1D1D1 | #3C3C3C | #D1D1D1 | #3C3C3C |
97
+ | action.disabled | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 |
98
+ | actionBackground.enabled | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
99
+ | actionBackground.hovered | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
100
+ | actionBackground.selected | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF | #FFFFFF |
101
+ | actionBackground.disabled | #EEEEEE | #383838 | #EEEEEE | #383838 | #EEEEEE | #383838 | #EEEEEE | #383838 | #EEEEEE | #383838 |
102
+ | actionOutlinedBorder.enabled | #888888 | #7B7B7B | #888888 | #7B7B7B | #888888 | #7B7B7B | #888888 | #7B7B7B | #888888 | #7B7B7B |
103
+ | actionOutlinedBorder.hovered | #CDCDCD | #2F2F2F | #CDCDCD | #2F2F2F | #CDCDCD | #2F2F2F | #CDCDCD | #2F2F2F | #CDCDCD | #2F2F2F |
104
+ | actionOutlinedBorder.selected | #E8E8E8 | #404040 | #E8E8E8 | #404040 | #E8E8E8 | #404040 | #E8E8E8 | #404040 | #E8E8E8 | #404040 |
105
+ | actionOutlinedBorder.disabled | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 | #B0B0B0 | #383838 |
106
+ | misc.divider | #D1D1D1 | #404040 | #D1D1D1 | #404040 | #D1D1D1 | #404040 | #D1D1D1 | #404040 | #D1D1D1 | #404040 |
107
+ | misc.scrim | #000000 | #000000 | #000000 | #000000 | #000000 | #000000 | #000000 | #000000 | #000000 | #000000 |
108
+ | misc.tooltipBg | #4F4F4F | #FFFFFF | #424F34 | #F4F7EC | #514034 | #FCF8F2 | #33405A | #F7F9FC | #51404D | #FCF9F7 |
109
+ | misc.tooltipText | #eeeeee | #000000 | #D9E5C7 | #1C2213 | #F2E2CE | #2B1F12 | #E3ECF5 | #111A2E | #F2EDE4 | #2A1622 |
110
+
111
+ ## Spacing
112
+
113
+ | Token | Value |
114
+ | --- | --- |
115
+ | small | 4px |
116
+ | medium | 8px |
117
+ | large | 16px |
118
+ | xlarge | 24px |
119
+ | xxlarge | 32px |
120
+ | huge | 48px |
121
+ | giant | 64px |
122
+ | section | 128px |
123
+ | page | 160px |
124
+
125
+ ## Radius
126
+
127
+ | Token | Value |
128
+ | --- | --- |
129
+ | inline | 2px |
130
+ | control | 8px |
131
+ | container | 12px |
132
+ | full | 9999px |
133
+
134
+ ## Typography
135
+
136
+ On the web, type roles use Inter (`font-inter`) and Fira Code (`font-mono`, with the `code` role for code, identifiers and type names).
137
+
138
+ | Role | Size | Weight | Line height | Letter spacing |
139
+ | --- | --- | --- | --- | --- |
140
+ | h1 | 96px | 400 | 115px | -1.5px |
141
+ | h2 | 60px | 400 | 72px | -0.5px |
142
+ | h3 | 48px | 400 | 58px | 0px |
143
+ | h4 | 34px | 400 | 41px | 0.3px |
144
+ | h5 | 24px | 400 | 29px | 0px |
145
+ | h6 | 20px | 400 | 30px | 0.2px |
146
+ | subtitle1 | 16px | 400 | 24px | 0.2px |
147
+ | subtitle2 | 14px | 400 | 21px | 0.1px |
148
+ | body1 | 16px | 400 | 24px | 0.2px |
149
+ | body2 | 14px | 400 | 21px | 0.2px |
150
+ | caption | 12px | 400 | 18px | 0.5px |
151
+ | code | 14px | 300 | 21px | 0px |
152
+
153
+ ## Native platforms
154
+
155
+ ### What "100% ODS" means on a native platform
156
+
157
+ - Every control, bar, sheet, menu and material is the platform's own, in its standard style.
158
+ - Every color, spacing, radius or type value that is not the platform's comes from a generated ODS token. Nothing is typed by hand in the app.
159
+ - ODS does not re-draw Button, TextField, Modal and the other web components natively. It ships tokens, a mapping table, and the few parts the platform does not have.
160
+
161
+ ### The OS-update rules
162
+
163
+ These rules keep an app working and current-looking when the user updates their OS, without a new release. They apply to ODS's native code and to any app that claims "100% ODS".
164
+
165
+ 1. Public, documented API only. No private API, no view introspection libraries, no reaching into UIKit or AppKit view hierarchies to restyle system views, no `UIAppearance` proxies for bars.
166
+ 2. System controls keep their standard styles. No custom `ButtonStyle`, `TextFieldStyle`, `ToggleStyle` and the like on controls that have a system style. Choose among the system's styles and roles instead.
167
+ 3. Chrome is the system's. Navigation bars, toolbars, tab bars, sidebars, sheets, popovers, menus, alerts and the keyboard are not given backgrounds, borders, shadows or fixed sizes. Liquid Glass picks its color up from the content behind it.
168
+ 4. A theme enters only through documented theming hooks: the accent color, content backgrounds, foreground styles, list row backgrounds, and the colors of our own content views.
169
+ 5. No fixed system metrics. No hard-coded bar heights, safe-area numbers, control heights or corner radii for system containers.
170
+ 6. System type. Text styles (`.body`, `.caption`, and so on) with Dynamic Type; no fixed point sizes.
171
+ 7. System icons. SF Symbols on Apple, Material Symbols on Android.
172
+ 8. Colors are dynamic. Each color resolves for light and dark from one name, so the system can switch it; no branching on color scheme in views.
173
+ 9. Build with the current SDK and check each summer's beta before it ships.
174
+
175
+ The modifier's three root text levels are resolved from those dynamic colors for the current appearance and re-resolved when it changes.
176
+
177
+ Where a rule and the theme's look conflict, the rule wins and the conflict is reported to the owner.
178
+
179
+ ### Where a theme's colors go in an Apple app
180
+
181
+ | Area | Treatment |
182
+ |---|---|
183
+ | Accent | `accent.main` as the app accent color, from the app's `AccentColor` asset |
184
+ | Screen and window content background | `background.default` |
185
+ | Raised content (cards, message bubbles, grouped rows) | `background.accent100` to `accent300`, as on the web |
186
+ | Text | `text.primary` as the root foreground style; `text.secondary` and `text.disabled` for the lower levels |
187
+ | Dividers in our own views | `misc.divider` |
188
+ | Status (error, warning, info, success) | the status tokens, replacing `Color.red`, `systemGreen` and the like |
189
+ | Bars, toolbars, tab bar, sidebar material, menus, alerts, keyboard | untouched |
190
+ | Sheets and popovers | system presentation material; their content may use the theme's text and status colors |
191
+
192
+ Spacing and radius tokens apply to our own content views. System containers (lists, forms, grouped sections) keep system metrics.
193
+
194
+ ### Adopting the Swift package
195
+
196
+ Platforms: iOS 26 and macOS 26 and later.
197
+
198
+ 1. Add the package with Swift Package Manager: `.package(url: "https://github.com/oneSlash-app/design-system", from: "2.10.0")`. Add the `OneSlashDesign` product to the target. By URL the package identity is `design-system`, so a manifest writes `.product(name: "OneSlashDesign", package: "design-system")`.
199
+ 2. `import OneSlashDesign`.
200
+ 3. In the app's asset catalog, define the `AccentColor` color set with an "Any Appearance" value and a "Dark" value, both sRGB, replacing the empty default Xcode creates. Take the two values from the chosen theme's `accent.main` row in the color table above (its light and dark columns). Name it as the app's global accent color (the `ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME` build setting, `AccentColor` by default in new Xcode projects). This is required: the package sets no tint, so this asset is what tints controls, alerts and selection. On macOS it yields to the user's system accent choice, by design.
201
+ 4. Apply one theme at the scene root: `.odsTheme(.forest)`. The themes are `ODSTheme.default`, `.forest`, `.clay`, `.indigo` and `.wine`. The modifier sets the `odsTheme` environment value and the primary, secondary and tertiary foreground styles from the theme's text colors. It sets no tint and no background. The foreground styles are fixed colors, resolved for the current appearance and resolved again when it changes: system toolbars and menus resolve a dynamic root color without the window's appearance, which draws dark glyphs on a dark toolbar. Under the modifier, text-like controls (borderless buttons, links) take `text.primary`, not the accent; to give one the accent, apply `.foregroundStyle(.tint)` to it (the tint is the `AccentColor` asset). `text.disabled` is the tertiary level, so `.foregroundStyle(.tertiary)` is the disabled text color. Apply `.odsToolbarMenuLabel()` to the label of a toolbar `Menu`: without it, an iPhone toolbar menu draws its label white in both appearances. Menu item icons take `text.primary`.
202
+ 5. Read the theme with `@Environment(\.odsTheme) private var theme` for backgrounds and status colors, for example `theme.background.default` and `theme.error.main`. Each color has the same group and key names as the color table above.
203
+ 6. Spacing, radius and motion are constants for our own content views: `ODSSpacing`, `ODSRadius` and `ODSDuration` (in seconds).
204
+ 7. Fonts: `Font.ods(_ role: ODSTextRole)` returns the system text style for a type role. See the type roles table below. Native apps use the system fonts with Dynamic Type; Inter and Fira Code stay on the web.
205
+
206
+ Limits to know:
207
+
208
+ - The package cannot set or check the accent: it is the app's `AccentColor` asset, which the app keeps equal to its theme's `accent.main`.
209
+ - The root text levels are fixed for the environment at the point `.odsTheme` is applied. A subtree or presentation that overrides the color scheme does not re-resolve them, so apply `.odsTheme` again inside it.
210
+ - Each scene needs its own `.odsTheme`, for example a macOS `Settings` scene as well as the main window.
211
+ - For motion, prefer the platform's springs. Use `ODSDuration` only for our own content views.
212
+
213
+ ### Type roles
214
+
215
+ ODS type roles map to system text styles, so they keep Dynamic Type. No font files ship with the native packages.
216
+
217
+ | ODS role | Web size | System text style |
218
+ | --- | --- | --- |
219
+ | h1 | 96px | `largeTitle` |
220
+ | h2 | 60px | `largeTitle` |
221
+ | h3 | 48px | `title` |
222
+ | h4 | 34px | `title2` |
223
+ | h5 | 24px | `title3` |
224
+ | h6 | 20px | `headline` |
225
+ | subtitle1 | 16px | `body` |
226
+ | subtitle2 | 14px | `subheadline` |
227
+ | body1 | 16px | `body` |
228
+ | body2 | 14px | `subheadline` |
229
+ | caption | 12px | `caption` |
230
+ | code | 14px | `callout.monospaced` |
231
+
232
+ ### Component mapping
233
+
234
+ For each web component, the table gives the native control to use. System controls keep their standard styles; ODS supplies only tokens. "ODS part (planned)" means ODS will provide the part and does not yet. "Not applicable: web page pattern" means the web component has no native counterpart; use the note.
235
+
236
+ | ODS | SwiftUI | Compose | Note |
237
+ | --- | --- | --- | --- |
238
+ | alert | ODS part (planned) | ODS part (planned) | Until then: SwiftUI `.alert` for messages that need a decision; Compose `Snackbar` in a `SnackbarHost` for toasts. |
239
+ | button | `Button` with `.borderedProminent` or `.glassProminent` for accent, `.bordered` for primary | `Button`, `OutlinedButton` | Tertiary and text-only: `.borderless` / `TextButton`. A prominent button's system label is white; on themes whose accent is light (default, clay) that fails contrast in light mode, so set the label's `.foregroundStyle(theme.accent.contrast)`. Forest, indigo and wine pass as is. |
240
+ | checkBox | `Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS) | `Checkbox` | |
241
+ | emptyBox | ODS part (planned) | ODS part (planned) | Until then: SwiftUI `ContentUnavailableView`; Compose a centered `Icon` and `Text` in a `Column`. |
242
+ | factsRow | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `LabeledContent` rows in a `Form` / `ListItem` rows. |
243
+ | figure | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: an `Image` with a caption `Text` in the caption text style. |
244
+ | heading | `Text` with the type role's text style and `.accessibilityAddTraits(.isHeader)` | `Text` with the type role's `MaterialTheme.typography` style and `Modifier.semantics { heading() }` | |
245
+ | icon | `Image(systemName:)` (SF Symbols) | Material Symbols | |
246
+ | iconButton | `Button` with a `Label` and `.labelStyle(.iconOnly)` | `IconButton` | |
247
+ | layout | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `VStack` / `HStack` / `Grid`; Compose `Column` / `Row` / `LazyVerticalGrid`. |
248
+ | line | `Divider` | `HorizontalDivider`, `VerticalDivider` | |
249
+ | link | `Link` | `Text` with a `LinkAnnotation.Url` in its `AnnotatedString` | |
250
+ | linkCard | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `NavigationLink` row in a `List` / a clickable `ListItem`. |
251
+ | list | `List` | `LazyColumn` of `ListItem` | A short bulleted passage inside text stays `Text` lines. |
252
+ | loadingScreen | `ProgressView` | `CircularProgressIndicator` | |
253
+ | menu | `Menu` or `.contextMenu` | `DropdownMenu` | |
254
+ | menuItem | `Button` inside a `Menu` | `DropdownMenuItem` | In a sidebar: a `List` row / `NavigationDrawerItem`. |
255
+ | modal | `.sheet` or `.alert` | `ModalBottomSheet` or `AlertDialog` | `ModalBottomSheet` needs `@OptIn(ExperimentalMaterial3Api::class)`. |
256
+ | navigation | `NavigationSplitView` with a sidebar `List` | `NavigationRail` or `ModalNavigationDrawer` with `NavigationDrawerItem` | |
257
+ | numberedRow | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: rows of a `List` / `ListItem`s. |
258
+ | pageHeader | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `.navigationTitle` / `TopAppBar`. |
259
+ | pageShell | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `NavigationStack` / `Scaffold`. |
260
+ | paragraph | `Text` with `.font(.body)` | `Text` with `MaterialTheme.typography.bodyLarge` | |
261
+ | popover | `.popover` | `DropdownMenu` | Larger anchored content on Android: `ModalBottomSheet`. |
262
+ | radioGroup | `Picker` (`.inline` on iOS, `.radioGroup` on macOS) | `RadioButton`s in a `Column` with `Modifier.selectableGroup()` | |
263
+ | sectionIntro | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Section` header in a `List` or `Form` / a heading `Text`. |
264
+ | select | `Picker` or `Menu` | `ExposedDropdownMenuBox` | |
265
+ | surface | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Form` section or `GroupBox` / `Card`. |
266
+ | tab | `TabView` or segmented `Picker` | `PrimaryTabRow` | One `Tab` inside `TabView` or one segment / one `Tab`. `TabRow` is deprecated in Material 3. |
267
+ | tableCell | A `TableColumn` content view | `Text` in a `Row` with `Modifier.weight` | Material 3 has no table. |
268
+ | tableContainer | `Table` | `LazyColumn` of `Row`s | Material 3 has no table. A compact-width iPhone `Table` shows only its first column. |
269
+ | tableHeader | The `Table` column headers (`TableColumn` titles) | A header `Row` as the first `LazyColumn` item | Material 3 has no table. |
270
+ | tableHeaderCell | A `TableColumn` title | `Text` in the header `Row` | Material 3 has no table. |
271
+ | tableRow | `TableRow` | `Row` | Material 3 has no table. |
272
+ | tabsContainer | `TabView` or segmented `Picker` | `PrimaryTabRow` | `TabRow` is deprecated in Material 3. |
273
+ | tag | ODS part (planned) | ODS part (planned) | Until then: SwiftUI `.badge` for counts, else a `Label`; Compose `AssistChip` or `FilterChip`. |
274
+ | textarea | `TextField(_:text:axis: .vertical)` or `TextEditor` | `OutlinedTextField` with `minLines` | |
275
+ | textField | `TextField` (`SecureField` for passwords) | `OutlinedTextField` or `TextField` | |
276
+ | timeStamp | `Text(_:style:)` (`.relative`) or `Text(_:format:)` (`.dateTime`) | `Text` with `DateUtils.getRelativeTimeSpanString` or `DateTimeFormatter.ofLocalizedDateTime` | |
277
+ | tooltip | `.help` | `TooltipBox` | `.help` shows on pointer hover only. `TooltipBox` needs `@OptIn(ExperimentalMaterial3Api::class)`. |
278
+ | userImage | ODS part (planned) | ODS part (planned) | Until then: SwiftUI `AsyncImage` clipped to a `Circle`, `person.crop.circle` placeholder; Compose `Image` clipped to `CircleShape`, `account_circle` placeholder. |
@@ -6,7 +6,7 @@ var bgClassMap = {
6
6
  warning: 'bg-warning-alertBg',
7
7
  info: 'bg-info-alertBg',
8
8
  success: 'bg-success-alertBg',
9
- default: 'bg-secondary-light',
9
+ default: 'bg-secondary-main',
10
10
  };
11
11
  var AUTO_DISMISS_MS = 5000;
12
12
  var EXIT_MS = 150;
@@ -62,10 +62,12 @@ export default function Alert(_a) {
62
62
  if (!shouldRender)
63
63
  return null;
64
64
  var bgClasses = (_b = bgClassMap[type]) !== null && _b !== void 0 ? _b : bgClassMap.default;
65
+ // The default alert sits on secondary.main, whose label is secondary.contrast; the status backgrounds take text.primary
66
+ var textClasses = bgClasses === bgClassMap.default ? 'text-secondary-contrast' : 'text-fg-primary';
65
67
  var alertContent = (<div
66
68
  // Errors interrupt screen readers; everything else is announced politely
67
69
  role={type === 'error' ? 'alert' : 'status'} onMouseEnter={function () { return setIsPaused(true); }} onMouseLeave={function () { return setIsPaused(false); }} onFocus={function () { return setIsPaused(true); }} onBlur={function () { return setIsPaused(false); }} className={"flex ".concat(secondMessage ? 'items-start' : 'items-center', " justify-between w-full p-2 rounded-control transition-[opacity,transform] ").concat(isVisible ? motionClasses.enter : motionClasses.exit, " motion-reduce:transition-none ").concat(bgClasses, " ").concat(isVisible ? 'opacity-100 translate-y-0' : variant === 'toast' ? 'opacity-0 -translate-y-[calc(100%+1rem)]' : 'opacity-0', " ").concat(variant === 'toast' ? 'max-w-md pointer-events-auto' : '')}>
68
- <div className="flex items-start gap-2 text-fg-primary">
70
+ <div className={"flex items-start gap-2 ".concat(textClasses)}>
69
71
  {/* With two lines, nudge the text so its first line centers on the close button */}
70
72
  <div className={"flex flex-col text-left ".concat(secondMessage && showCloseButton ? 'pt-[3px]' : '')}>
71
73
  <span className="text-body2">{message}</span>
@@ -2,12 +2,13 @@
2
2
  import React from 'react';
3
3
  import { icons } from 'lucide-react';
4
4
  import { focusRing, pressFeedbackAny, stateTransition } from './sharedStyles';
5
- // Filled tags use the status `fill` with `onFill` text; text-only tags use the status `text` token.
5
+ // Filled tags use the status `fill` with `onFill` text (the default tag: `secondary.main` with
6
+ // `secondary.contrast`); text-only tags use the status `text` token.
6
7
  // Each pair is checked at 4.5:1 by `npm run check:contrast`.
7
8
  var colorConfig = {
8
9
  default: {
9
- bg: 'bg-secondary-light',
10
- text: 'text-fg-primary',
10
+ bg: 'bg-secondary-main',
11
+ text: 'text-secondary-contrast',
11
12
  textOnly: 'text-fg-secondary',
12
13
  border: 'border-misc-divider',
13
14
  dot: 'bg-fg-secondary',
@@ -98,6 +98,7 @@ declare const defaultSets: {
98
98
  elevated: string;
99
99
  overlay: string;
100
100
  panel: string;
101
+ row: string;
101
102
  paper: string;
102
103
  default: string;
103
104
  accent100: string;
@@ -252,6 +253,7 @@ declare const defaultSets: {
252
253
  elevated: string;
253
254
  overlay: string;
254
255
  panel: string;
256
+ row: string;
255
257
  paper: string;
256
258
  default: string;
257
259
  accent100: string;
@@ -408,6 +410,7 @@ declare const forestSets: {
408
410
  elevated: string;
409
411
  overlay: string;
410
412
  panel: string;
413
+ row: string;
411
414
  paper: string;
412
415
  default: string;
413
416
  accent100: string;
@@ -562,6 +565,7 @@ declare const forestSets: {
562
565
  elevated: string;
563
566
  overlay: string;
564
567
  panel: string;
568
+ row: string;
565
569
  paper: string;
566
570
  default: string;
567
571
  accent100: string;
@@ -721,6 +725,7 @@ export declare namespace themes {
721
725
  elevated: string;
722
726
  overlay: string;
723
727
  panel: string;
728
+ row: string;
724
729
  paper: string;
725
730
  default: string;
726
731
  accent100: string;
@@ -875,6 +880,7 @@ export declare namespace themes {
875
880
  elevated: string;
876
881
  overlay: string;
877
882
  panel: string;
883
+ row: string;
878
884
  paper: string;
879
885
  default: string;
880
886
  accent100: string;
@@ -1031,6 +1037,7 @@ export declare namespace themes {
1031
1037
  elevated: string;
1032
1038
  overlay: string;
1033
1039
  panel: string;
1040
+ row: string;
1034
1041
  paper: string;
1035
1042
  default: string;
1036
1043
  accent100: string;
@@ -1185,6 +1192,7 @@ export declare namespace themes {
1185
1192
  elevated: string;
1186
1193
  overlay: string;
1187
1194
  panel: string;
1195
+ row: string;
1188
1196
  paper: string;
1189
1197
  default: string;
1190
1198
  accent100: string;
@@ -1341,6 +1349,7 @@ export declare namespace themes {
1341
1349
  elevated: string;
1342
1350
  overlay: string;
1343
1351
  panel: string;
1352
+ row: string;
1344
1353
  paper: string;
1345
1354
  default: string;
1346
1355
  accent100: string;
@@ -1495,6 +1504,7 @@ export declare namespace themes {
1495
1504
  elevated: string;
1496
1505
  overlay: string;
1497
1506
  panel: string;
1507
+ row: string;
1498
1508
  paper: string;
1499
1509
  default: string;
1500
1510
  accent100: string;
@@ -340,7 +340,10 @@ function withSemanticKeys(set, mode) {
340
340
  secondary: __assign(__assign({}, set.secondary), { contrast: set.text.primary }), background: __assign(__assign({}, set.background), { elevated: isLight ? set.background.default : set.background.accent100, overlay: isLight ? set.background.accent300 : set.background.accent100,
341
341
  // The surface a panel of content sits on, and a sheet of paper that stays
342
342
  // light in dark mode, for scans, drawings and specimens drawn in black.
343
- panel: set.background.accent100, paper: '#FFFFFF' }), error: status(set.error, true), warning: status(set.warning, false), info: status(set.info, false), success: status(set.success, false) });
343
+ panel: set.background.accent100,
344
+ // Opaque rows of a grouped list: they sit on `default` and stay readable in dark,
345
+ // where accent200 would leave secondary and error text under 4.5:1.
346
+ row: isLight ? set.background.accent200 : set.background.accent100, paper: '#FFFFFF' }), error: status(set.error, true), warning: status(set.warning, false), info: status(set.info, false), success: status(set.success, false) });
344
347
  }
345
348
  // Forest: the default set with these values replaced (group by group).
346
349
  /**