@travelallfly/ui 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 CHANGED
@@ -1,3 +1,158 @@
1
- # Temporary Holding Version
1
+ # AllFly UI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The shared design system for AllFly apps: design tokens, a Tailwind preset and React components, with a Storybook to browse them. It implements the Figma file [AllFly Design System](https://www.figma.com/design/IctaOawIt0vNkTWvMfcEk7/AllFly-Design-System) (v1.0, light and dark themes).
4
+
5
+ Status: first scaffold. It contains the foundations and one draft component (Button), which exists to prove the pipeline end to end. Further components are on hold until the theme is locked with design. The first published version is 0.1.0.
6
+
7
+ ## Commands
8
+
9
+ | Command | What it does |
10
+ |---|---|
11
+ | `npm run storybook` | Storybook at http://localhost:6006 |
12
+ | `npm run build-storybook` | Static Storybook in `storybook-static/` |
13
+ | `npm run tokens` | Regenerate `src/tokens/tokens.css` from `src/tokens/tokens.ts` |
14
+ | `npm run changeset` | Describe a change for the next release |
15
+ | `npm run lint` | ESLint |
16
+ | `npm run typecheck` | TypeScript check |
17
+ | `npm run test-unit` | Unit tests |
18
+ | `npm run build` | Package build in `dist/` |
19
+ | `npm run test-consumers` | Build, pack and install the package into the Next and Vite fixtures, then build and check them |
20
+
21
+ ## Tokens
22
+
23
+ `src/tokens/tokens.ts` is the single source. Everything else is derived from it:
24
+
25
+ - `src/tokens/tokens.css`: CSS variables, generated by `npm run tokens`. A test fails if it is out of date.
26
+ - `src/tokens/tailwind-preset.ts`: Tailwind theme that points at those variables.
27
+ - The Foundations pages in Storybook.
28
+
29
+ Colours have two tiers, as in Figma. Primitives (`blue/500`) are the raw palette. Roles (`bg/action`) point at primitives. Components use roles only; primitives have CSS variables but no Tailwind classes.
30
+
31
+ ### Naming rule
32
+
33
+ A Tailwind class is the utility plus the Figma variable name, with `/` replaced by `-`.
34
+
35
+ | Figma | CSS variable | Tailwind class |
36
+ |---|---|---|
37
+ | `bg/action` | `--af-bg-action` | `bg-bg-action` |
38
+ | `text/primary` | `--af-text-primary` | `text-text-primary` |
39
+ | `border/default` | `--af-border-default` | `border-border-default` |
40
+ | `status/error/fill` | `--af-status-error-fill` | `bg-status-error-fill` |
41
+ | `travel/hotels/accent` | `--af-travel-hotels-accent` | `text-travel-hotels-accent` |
42
+ | `spacing/lg` | `--af-spacing-lg` | `p-spacing-lg` |
43
+ | `radius/xl` | `--af-radius-xl` | `rounded-radius-xl` |
44
+ | Raised | `--af-elevation-raised` | `shadow-elevation-raised` |
45
+ | Body strong | (none) | `type-body-strong` |
46
+
47
+ The group stays in the class name (`text-text-primary`, not `text-primary`) because Quest and Backoffice already define `text-primary`, `border`, `rounded-md` and similar with different values. Keeping the group means the preset can be added to either app without changing how any existing screen looks.
48
+
49
+ ### Dark theme
50
+
51
+ Every colour role has a light and a dark value. `tokens.css` sets the light values on `:root` and overrides the roles under a `dark` class, so an app switches theme by adding or removing `dark` on `<html>`. Components need no `dark:` classes. Primitives are the same in both themes.
52
+
53
+ Dark values live in `colorRolesDark` in `src/tokens/tokens.ts`. A value is either a primitive (`warm/900`), a primitive with an opacity (`warm/900@60`, used for the scrim) or a hex where Figma's dark mode uses a colour that has no swatch on the Foundations page.
54
+
55
+ "System" is not a third theme: the app resolves it to light or dark and applies that.
56
+
57
+ ### Where the values came from
58
+
59
+ - **Light roles, primitives, type, spacing, radius**: read from the layer names on the Figma Foundations page, which carry each token's name and value.
60
+ - **Dark roles**: Figma shows no labelled dark swatches. The values were read from the "Dark mode / Library check" page by comparing its Light and Dark frames pixel for pixel, so they are exact colours, but the role each belongs to is inferred from the component it appears on.
61
+ - **Focus ring**: measured on the same page (4px, action blue at 30%).
62
+
63
+ ### Values to confirm with design
64
+
65
+ - Dark values for `bg/scrim`, `border/selected` and the four `travel/*/accent` roles. They do not appear on the library check page and currently reuse the light value (or `border/focus` for `border/selected`). They are listed in `darkRolesUnverified` and marked in Storybook.
66
+ - Names for the dark-only colours, if Figma has primitives for them.
67
+ - The shadow values for `elevation/raised` and `elevation/floating`, in both themes.
68
+ - The letter spacing of the Eyebrow text style (currently 0.08em).
69
+ - Button padding and label weight.
70
+
71
+ Replace all of the above with an export of the Figma variables when one is available.
72
+
73
+ ## Using it in an app
74
+
75
+ The package is published publicly to npmjs.com as `@travelallfly/ui`, so installing it needs no token or `.npmrc`. The package used to be on GitHub Packages; remove any `@travelallfly:registry=https://npm.pkg.github.com` line from the app's `.npmrc`.
76
+
77
+ Install it and wire it up:
78
+
79
+ ```bash
80
+ npm install @travelallfly/ui
81
+ ```
82
+
83
+ ```ts
84
+ import allflyPreset from '@travelallfly/ui/tailwind-preset';
85
+
86
+ export default {
87
+ presets: [allflyPreset],
88
+ content: ['./app/**/*.{ts,tsx}', './node_modules/@travelallfly/ui/dist/**/*.js'],
89
+ };
90
+ ```
91
+
92
+ ```css
93
+ @import '@travelallfly/ui/tokens.css';
94
+ ```
95
+
96
+ ```tsx
97
+ import { Button } from '@travelallfly/ui';
98
+ import { buttonVariants, cn } from '@travelallfly/ui/utils';
99
+ ```
100
+
101
+ Components come from the package root, which is a client module (`"use client"`). `cn` and the variant helpers come from `/utils`, which has no directive, so Server Components can call them, for example `<Link className={buttonVariants({ variant: 'link' })}>`.
102
+
103
+ Always merge classes with the library's `cn`. It knows the token scales, so a caller's `px-4` replaces a component's `px-spacing-xl`; a stock `tailwind-merge` would keep both.
104
+
105
+ App configs can override Tailwind's core colours (Quest and Backoffice both replace `transparent` with an object, which removes `border-transparent`). Components must not depend on core colour classes; the Button test compiles its classes against such a config to catch this.
106
+
107
+ The app loads the fonts itself (Figtree, Instrument Serif, Geist Mono) and may override `--af-font-ui`, `--af-font-voice` and `--af-font-code` to match how it loads them, for example with `next/font`.
108
+
109
+ ## Releasing
110
+
111
+ Versions and the changelog are managed with [Changesets](https://changesets.dev).
112
+
113
+ 1. **In every pull request that changes what consumers get**, run `npm run changeset`, pick patch, minor or major, and describe the change. This adds a small file under `.changeset/`. A visual change that alters size or layout counts as breaking.
114
+ 2. **To cut a release**, run `npm run version-packages` on a branch. It turns the pending changesets into a version bump and a `CHANGELOG.md` entry. Open that as a pull request into `develop`.
115
+ 3. **When that pull request merges**, the Release workflow sees a version that is not in the registry, builds the package, publishes it to npmjs.com, pushes a `v<version>` tag and moves `master` to the released commit.
116
+
117
+ Publishing uses npm trusted publishing: the workflow proves its identity to npm with a GitHub OIDC token, and the package's npm settings trust only `travelallfly/allfly-ui` running `release.yml`. There is no npm token in the repository secrets.
118
+
119
+ Pushes to `develop` that do not change the version publish nothing. `master` therefore always points at the latest published release.
120
+
121
+ ## Adding a component
122
+
123
+ What Figma defines, and the order to build it in, is in [docs/component-inventory.md](docs/component-inventory.md).
124
+
125
+ 1. Find the component set in Figma and note its variants and states.
126
+ 2. Create `src/components/<name>/<name>.tsx`, using role classes only.
127
+ 3. Add `<name>.stories.tsx` with one story per Figma variant group, and the Figma guidance line as the description.
128
+ 4. Add `<name>.test.tsx` covering behaviour and that the element is locatable by role and name.
129
+ 5. Export it from `src/index.ts`.
130
+
131
+ ## CI
132
+
133
+ The workflows follow the same conventions as Quest and Backoffice.
134
+
135
+ - `pr-checks.yml` runs on every pull request: lint, typecheck, unit tests, package build and Storybook build, plus the consumer smoke test as a second job.
136
+ - `vulnerability-scan.yml` runs the shared weekly scan from `tools-cicd`, configured by `.github/vscan.toml`.
137
+ - `auto_assign.yml` assigns reviewers.
138
+ - `release.yml` publishes to npmjs.com when a new version lands on `develop` (see Releasing).
139
+
140
+ There are no deploy, hotfix or promote workflows, because this package is not deployed to an environment. The Release workflow takes their place: `develop` is the working branch and `master` is the latest release.
141
+
142
+ ## Consumer smoke test
143
+
144
+ `fixtures/next-app` (Next 16, React 19, Turbopack) and `fixtures/vite-app` (Vite 6, React 18) stand in for Quest and Backoffice. Their Tailwind configs copy the parts of the real apps' configs that can clash with this library: `transparent` replaced by an object, and their own `primary`, `border`, `rounded-md` and `font-sans`.
145
+
146
+ `npm run test-consumers` builds the package, packs it as npm would publish it, installs the tarball into each fixture and builds the fixture. It then checks that:
147
+
148
+ - the library's classes and token variables are in the built CSS, and the app's own classes still resolve to the app's values;
149
+ - every class on the prerendered Next page has a CSS rule;
150
+ - a Server Component can call `buttonVariants` and render `Button`;
151
+ - the Vite fixture typechecks against React 18 types, and the CommonJS entry points load and render under React 18.
152
+
153
+ When a new component is added, render it in both fixture pages so it is covered.
154
+
155
+ ## Open decisions
156
+
157
+ - Where Storybook is hosted, and whether pull requests get preview builds. It is not hosted yet.
158
+ - Whether the 46 icons in Figma are Lucide or a custom set.
@@ -0,0 +1,225 @@
1
+ // src/tokens/tokens.ts
2
+ var primitives = {
3
+ base: {
4
+ white: "#FFFFFF"
5
+ },
6
+ blue: {
7
+ 50: "#EAF3FF",
8
+ 100: "#C9D6EE",
9
+ 200: "#9CC4F8",
10
+ 300: "#7DB4F5",
11
+ 500: "#0770E3",
12
+ 600: "#055BBD",
13
+ 700: "#0A4794",
14
+ 900: "#0B1F4B"
15
+ },
16
+ warm: {
17
+ 0: "#FFFEFC",
18
+ 50: "#FBF8F3",
19
+ 75: "#F7F3EC",
20
+ 100: "#F3EEE6",
21
+ 200: "#E7E0D5",
22
+ 300: "#CFC6B8",
23
+ 400: "#A39A8C",
24
+ 600: "#6B655C",
25
+ 800: "#4A453E",
26
+ 900: "#1F1D1A"
27
+ },
28
+ sunrise: {
29
+ 50: "#FDEBE4",
30
+ 500: "#E8603C",
31
+ 700: "#B5411F"
32
+ },
33
+ marigold: {
34
+ 50: "#FDF3DC",
35
+ 100: "#FCEBB6",
36
+ 500: "#F2B035",
37
+ 800: "#7A4E00",
38
+ 900: "#4A3000"
39
+ },
40
+ palm: {
41
+ 50: "#E3F4EE",
42
+ 500: "#1A7A5E",
43
+ 700: "#14664F"
44
+ },
45
+ red: {
46
+ 50: "#FBE9E7",
47
+ 500: "#C93A3A",
48
+ 700: "#A12B2B",
49
+ 900: "#7A1F1F"
50
+ }
51
+ };
52
+ var colorRoles = {
53
+ bg: {
54
+ page: "warm/50",
55
+ surface: "warm/0",
56
+ sunken: "warm/100",
57
+ hover: "warm/75",
58
+ selected: "blue/50",
59
+ feature: "blue/900",
60
+ action: "blue/500",
61
+ "action-hover": "blue/600",
62
+ "action-pressed": "blue/700",
63
+ inverse: "warm/900",
64
+ scrim: "warm/900@60"
65
+ },
66
+ text: {
67
+ primary: "warm/900",
68
+ secondary: "warm/800",
69
+ muted: "warm/600",
70
+ link: "blue/600",
71
+ "on-action": "base/white",
72
+ "on-feature": "base/white",
73
+ "on-feature-muted": "blue/100",
74
+ "on-selected": "blue/700",
75
+ inverse: "warm/0"
76
+ },
77
+ border: {
78
+ default: "warm/200",
79
+ strong: "warm/300",
80
+ control: "warm/400",
81
+ focus: "blue/500",
82
+ selected: "blue/500",
83
+ ink: "warm/900"
84
+ },
85
+ status: {
86
+ success: { fill: "palm/50", text: "palm/700", border: "palm/500" },
87
+ info: { fill: "blue/50", text: "blue/700", border: "blue/200" },
88
+ caution: { fill: "marigold/100", text: "marigold/900", icon: "marigold/800", border: "marigold/500" },
89
+ error: { fill: "red/50", text: "red/900", strong: "red/700", border: "red/500" },
90
+ neutral: { fill: "warm/100", text: "warm/800", border: "warm/300" }
91
+ },
92
+ travel: {
93
+ flights: { tint: "blue/50", ink: "blue/700", accent: "blue/500" },
94
+ hotels: { tint: "sunrise/50", ink: "sunrise/700", accent: "sunrise/500" },
95
+ cars: { tint: "marigold/50", ink: "marigold/800", accent: "marigold/500" },
96
+ rail: { tint: "palm/50", ink: "palm/700", accent: "palm/500" }
97
+ }
98
+ };
99
+ var colorRolesDark = {
100
+ bg: {
101
+ page: "#151310",
102
+ surface: "warm/900",
103
+ sunken: "#2A2723",
104
+ hover: "#26231F",
105
+ selected: "#172A45",
106
+ feature: "blue/900",
107
+ action: "blue/500",
108
+ "action-hover": "blue/600",
109
+ "action-pressed": "blue/700",
110
+ inverse: "warm/100",
111
+ scrim: "warm/900@60"
112
+ },
113
+ text: {
114
+ primary: "warm/100",
115
+ secondary: "#D4CBBE",
116
+ muted: "#ABA294",
117
+ link: "blue/300",
118
+ "on-action": "base/white",
119
+ "on-feature": "base/white",
120
+ "on-feature-muted": "blue/100",
121
+ "on-selected": "blue/200",
122
+ inverse: "warm/900"
123
+ },
124
+ border: {
125
+ default: "#38342E",
126
+ strong: "#4F4941",
127
+ control: "#857C70",
128
+ focus: "blue/300",
129
+ selected: "blue/300",
130
+ ink: "warm/100"
131
+ },
132
+ status: {
133
+ success: { fill: "#13291F", text: "#86D3B2", border: "#3DB489" },
134
+ info: { fill: "#15243A", text: "#A9CBF7", border: "#2E4F7C" },
135
+ caution: { fill: "#2D2412", text: "#F5CB78", icon: "marigold/500", border: "#7A5A17" },
136
+ error: { fill: "#341A18", text: "#F6A8A0", strong: "#EE7A70", border: "#8A3530" },
137
+ neutral: { fill: "#2A2723", text: "#D4CBBE", border: "#4F4941" }
138
+ },
139
+ travel: {
140
+ flights: { tint: "#172A45", ink: "blue/200", accent: "blue/500" },
141
+ hotels: { tint: "#33201A", ink: "#F59A7C", accent: "sunrise/500" },
142
+ cars: { tint: "#2D2412", ink: "#F5C46A", accent: "marigold/500" },
143
+ rail: { tint: "#13291F", ink: "#7CCCAD", accent: "palm/500" }
144
+ }
145
+ };
146
+ var darkRolesUnverified = [
147
+ "bg/scrim",
148
+ "border/selected",
149
+ "travel/flights/accent",
150
+ "travel/hotels/accent",
151
+ "travel/cars/accent",
152
+ "travel/rail/accent"
153
+ ];
154
+ var spacing = {
155
+ xs: 4,
156
+ sm: 8,
157
+ md: 12,
158
+ lg: 16,
159
+ xl: 24,
160
+ "2xl": 32,
161
+ "3xl": 48,
162
+ "4xl": 64
163
+ };
164
+ var radius = {
165
+ xs: { value: 4, usage: "Checkboxes" },
166
+ sm: { value: 8, usage: "Tooltips, seats" },
167
+ md: { value: 12, usage: "Inputs, nav items" },
168
+ lg: { value: 16, usage: "Banners, toasts" },
169
+ xl: { value: 24, usage: "Cards" },
170
+ "2xl": { value: 32, usage: "Modals" },
171
+ full: { value: 9999, usage: "Buttons, chips" }
172
+ };
173
+ var elevation = {
174
+ raised: {
175
+ value: "0 1px 2px rgba(31, 29, 26, 0.06), 0 4px 12px rgba(31, 29, 26, 0.06)",
176
+ usage: "The booking card, popovers, the selected fare."
177
+ },
178
+ floating: {
179
+ value: "0 2px 6px rgba(31, 29, 26, 0.06), 0 12px 32px rgba(31, 29, 26, 0.14)",
180
+ usage: "Modals, menus and toasts, over the scrim."
181
+ },
182
+ focus: {
183
+ value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
184
+ usage: "Every interactive element on keyboard focus."
185
+ }
186
+ };
187
+ var fonts = {
188
+ ui: ['"Figtree Variable"', "Figtree", "ui-sans-serif", "system-ui", "sans-serif"],
189
+ voice: ['"Instrument Serif"', "ui-serif", "Georgia", "serif"],
190
+ code: ['"Geist Mono Variable"', '"Geist Mono"', "ui-monospace", "SFMono-Regular", "monospace"]
191
+ };
192
+ var typeStyles = {
193
+ display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
194
+ title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
195
+ heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
196
+ body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
197
+ "body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
198
+ label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
199
+ "label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
200
+ eyebrow: {
201
+ font: "ui",
202
+ size: 13,
203
+ lineHeight: 18,
204
+ weight: 600,
205
+ uppercase: true,
206
+ letterSpacing: "0.08em",
207
+ sample: "Flights \xB7 Shopping list"
208
+ },
209
+ voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
210
+ "voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
211
+ mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
212
+ "mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
213
+ };
214
+
215
+ export {
216
+ primitives,
217
+ colorRoles,
218
+ colorRolesDark,
219
+ darkRolesUnverified,
220
+ spacing,
221
+ radius,
222
+ elevation,
223
+ fonts,
224
+ typeStyles
225
+ };
@@ -0,0 +1,109 @@
1
+ import {
2
+ colorRoles,
3
+ colorRolesDark,
4
+ elevation,
5
+ fonts,
6
+ primitives,
7
+ radius,
8
+ spacing
9
+ } from "./chunk-55LHKHCP.js";
10
+
11
+ // src/tokens/css.ts
12
+ var prefix = "af";
13
+ function flattenRoles(tree, path = []) {
14
+ return Object.entries(tree).flatMap(([key, value]) => {
15
+ const next = [...path, key];
16
+ if (typeof value !== "string") return flattenRoles(value, next);
17
+ return [{ name: next.join("-"), figmaName: next.join("/"), group: next[0], ref: value }];
18
+ });
19
+ }
20
+ var roles = flattenRoles(colorRoles);
21
+ var darkRoles = flattenRoles(colorRolesDark);
22
+ var darkClass = "dark";
23
+ function darkRoleFor(name) {
24
+ const role = darkRoles.find((item) => item.name === name);
25
+ if (!role) throw new Error(`Role "${name}" has no dark value`);
26
+ return role;
27
+ }
28
+ function isHex(ref) {
29
+ return /^#[0-9A-F]{6}$/.test(ref);
30
+ }
31
+ function splitAlpha(ref) {
32
+ const [base, alpha] = ref.split("@");
33
+ if (alpha === void 0) return { base, alpha: null };
34
+ const percent = Number(alpha);
35
+ if (!Number.isInteger(percent) || percent < 1 || percent > 99) throw new Error(`Bad opacity in "${ref}"`);
36
+ return { base, alpha: percent };
37
+ }
38
+ function resolveColor(ref) {
39
+ const { base } = splitAlpha(ref);
40
+ return isHex(base) ? base : resolvePrimitive(base);
41
+ }
42
+ function colorValue(ref) {
43
+ const { base, alpha } = splitAlpha(ref);
44
+ resolveColor(ref);
45
+ const solid = isHex(base) ? base : cssVar(primitiveName(base));
46
+ return alpha === null ? solid : `color-mix(in srgb, ${solid} ${alpha}%, transparent)`;
47
+ }
48
+ function cssVarName(name) {
49
+ return `--${prefix}-${name}`;
50
+ }
51
+ function cssVar(name) {
52
+ return `var(${cssVarName(name)})`;
53
+ }
54
+ function primitiveName(ref) {
55
+ return ref.replace("/", "-");
56
+ }
57
+ function resolvePrimitive(ref) {
58
+ const [scale, step] = ref.split("/");
59
+ const steps = primitives[scale];
60
+ const value = steps?.[step];
61
+ if (!value) throw new Error(`Unknown primitive "${ref}"`);
62
+ return value;
63
+ }
64
+ function rem(px) {
65
+ return `${px / 16}rem`;
66
+ }
67
+ function renderTokensCss() {
68
+ const groups = [];
69
+ groups.push(
70
+ Object.entries(primitives).flatMap(
71
+ ([scale, steps]) => Object.entries(steps).map(([step, value]) => `${cssVarName(`${scale}-${step}`)}: ${value};`)
72
+ )
73
+ );
74
+ groups.push(roles.map((role) => `${cssVarName(role.name)}: ${colorValue(role.ref)};`));
75
+ groups.push(Object.entries(spacing).map(([key, px]) => `${cssVarName(`spacing-${key}`)}: ${rem(px)};`));
76
+ groups.push(Object.entries(radius).map(([key, item]) => `${cssVarName(`radius-${key}`)}: ${item.value}px;`));
77
+ groups.push(Object.entries(elevation).map(([key, item]) => `${cssVarName(`elevation-${key}`)}: ${item.value};`));
78
+ groups.push(Object.entries(fonts).map(([key, stack]) => `${cssVarName(`font-${key}`)}: ${stack.join(", ")};`));
79
+ const indent = (lines) => lines.map((line) => ` ${line}`).join("\n");
80
+ const body = [["color-scheme: light;"], ...groups].map(indent).join("\n\n");
81
+ const darkLines = roles.map((role) => ({ light: role, dark: darkRoleFor(role.name) })).filter(({ light, dark }) => light.ref !== dark.ref).map(({ dark }) => `${cssVarName(dark.name)}: ${colorValue(dark.ref)};`);
82
+ const darkBody = [["color-scheme: dark;"], darkLines].map(indent).join("\n\n");
83
+ return `:root {
84
+ ${body}
85
+ }
86
+
87
+ .${darkClass} {
88
+ ${darkBody}
89
+ }
90
+ `;
91
+ }
92
+
93
+ export {
94
+ prefix,
95
+ flattenRoles,
96
+ roles,
97
+ darkRoles,
98
+ darkClass,
99
+ darkRoleFor,
100
+ isHex,
101
+ splitAlpha,
102
+ resolveColor,
103
+ cssVarName,
104
+ cssVar,
105
+ primitiveName,
106
+ resolvePrimitive,
107
+ rem,
108
+ renderTokensCss
109
+ };