@rowkit/tokens 0.4.0 → 1.0.0-beta.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/dist/shadow.d.ts CHANGED
@@ -1,29 +1,75 @@
1
1
  /**
2
- * Elevation shadows.
2
+ * Bevels, and the two structural shadows a data table needs.
3
3
  *
4
- * Each shadow mixes from `--color-shadow`, a semantic token, rather than
5
- * hardcoding a colour — so dark mode swaps the base to pure black by
6
- * repointing one variable.
4
+ * Windows 98 has no elevation. Depth is drawn with bevels: two 1px lines on
5
+ * each side of a box, light on the top-left and dark on the bottom-right for a
6
+ * raised surface, the other way round for a sunken one. Each bevel here is a
7
+ * stack of hard inset shadows — no blur, no spread — built from the four
8
+ * `bevel-*` colours, so the frame lives inside the box and never changes its
9
+ * size.
7
10
  *
8
- * Dark mode leans on surface lightness for elevation rather than on shadows.
9
- * A shadow is a darker region, and on a near-black page there is very little
10
- * headroom left to darken; the raised surface colour does the work instead.
11
+ * The first shadow in the list paints on top, so the 1px outer edge is listed
12
+ * before the 2px inner one it overlaps. The values match the effect styles in
13
+ * the Figma file one for one.
11
14
  */
12
15
  export declare const shadow: {
13
- /** No elevation. */
16
+ /** No bevel. */
14
17
  readonly none: "none";
15
- /** Hairline lift — sticky table headers, input focus. */
16
- readonly xs: "0 1px 2px 0 color-mix(in oklab, var(--color-shadow) 6%, transparent)";
17
- /** Resting cards. */
18
- readonly sm: "0 1px 3px 0 color-mix(in oklab, var(--color-shadow) 8%, transparent), 0 1px 2px -1px color-mix(in oklab, var(--color-shadow) 8%, transparent)";
19
- /** Dropdowns, popovers. */
20
- readonly md: "0 4px 6px -1px color-mix(in oklab, var(--color-shadow) 9%, transparent), 0 2px 4px -2px color-mix(in oklab, var(--color-shadow) 9%, transparent)";
21
- /** Menus over content. */
22
- readonly lg: "0 10px 15px -3px color-mix(in oklab, var(--color-shadow) 10%, transparent), 0 4px 6px -4px color-mix(in oklab, var(--color-shadow) 10%, transparent)";
23
- /** Modal dialogs. */
24
- readonly xl: "0 20px 25px -5px color-mix(in oklab, var(--color-shadow) 12%, transparent), 0 8px 10px -6px color-mix(in oklab, var(--color-shadow) 12%, transparent)";
25
- /** Horizontal-scroll affordance on a sticky table column. */
26
- readonly 'scroll-x': "12px 0 16px -8px color-mix(in oklab, var(--color-shadow) 22%, transparent)";
18
+ /** Buttons and raised panels. */
19
+ readonly raised: string;
20
+ /** A window's frame: like `raised`, with the bright white on the inner edge. */
21
+ readonly window: string;
22
+ /**
23
+ * The default button of a dialog: a 1px black frame around a raised bevel,
24
+ * so Enter's target is visible before anyone presses it.
25
+ */
26
+ readonly 'raised-default': string;
27
+ /** A button held down, or a toggle that is on. */
28
+ readonly pressed: string;
29
+ /** Text fields, lists and table bodies: the white well a value sits in. */
30
+ readonly sunken: string;
31
+ /** A thin sunken edge: status-bar sections, counters, Badge. */
32
+ readonly status: string;
33
+ /** An etched groove: group boxes and separators. */
34
+ readonly etched: string;
35
+ /** A thin raised edge: a flat toolbar button while hovered. */
36
+ readonly 'raised-thin': string;
37
+ /** A list dropped from a trigger. Windows 98 frames it with a border, not a shadow. */
38
+ readonly popover: "none";
39
+ /** A data table's frame: the sunken well its rows sit in. */
40
+ readonly table: string;
41
+ /** A data table's column header: a raised button. */
42
+ readonly header: string;
43
+ /** A window's caption button. */
44
+ readonly caption: string;
45
+ /** The strip of a status bar, behind its sections. */
46
+ readonly statusbar: "none";
47
+ /** The edge between a title bar and the window under it. */
48
+ readonly titlebar: "none";
49
+ /** A checked check box: the same sunken well as an unchecked one, in Windows 98. */
50
+ readonly checked: string;
51
+ /** A button inside a field while held, or while its list is open: pressed in, in Windows 98. */
52
+ readonly 'field-button-pressed': string;
53
+ /** A flat toolbar button that is latched on: pressed in, in Windows 98. */
54
+ readonly 'latched-ghost': string;
55
+ /** A checked check box in a selected table row: its usual well, in Windows 98. */
56
+ readonly 'checked-selected': string;
57
+ /** A toast's ✕: a caption button, raised, in Windows 98. */
58
+ readonly 'toast-close': string;
59
+ /**
60
+ * A pager's buttons: a raised command button, its focused frame, and pressed
61
+ * in while held or while it is the current page. Flat in a theme that draws
62
+ * the pager as a row of plain numbers.
63
+ */
64
+ readonly pager: string;
65
+ readonly 'pager-focus': string;
66
+ readonly 'pager-pressed': string;
67
+ /** A button inside a field: raised, in Windows 98. */
68
+ readonly 'field-button': string;
69
+ /** A scroll bar's thumb. */
70
+ readonly 'scroll-thumb': string;
71
+ /** The edge of a sticky table column while rows scroll under it. */
72
+ readonly 'scroll-x': "inset -1px 0 var(--color-bevel-shadow)";
27
73
  /**
28
74
  * The rule under a sticky table header, drawn as a shadow rather than a
29
75
  * border.
@@ -38,3 +84,13 @@ export declare const shadow: {
38
84
  };
39
85
  /** Names of every shadow token. */
40
86
  export type ShadowName = keyof typeof shadow;
87
+ /**
88
+ * Text shadows. One: the emboss that makes disabled text read as disabled
89
+ * rather than as faint — grey text with a white copy one pixel right and
90
+ * down. Windows 98 never fades a disabled control with opacity.
91
+ */
92
+ export declare const textShadow: {
93
+ readonly disabled: "1px 1px 0 var(--color-text-disabled-emboss)";
94
+ };
95
+ /** Names of every text shadow token. */
96
+ export type TextShadowName = keyof typeof textShadow;
package/dist/size.d.ts ADDED
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Component sizes: the heights, widths and insets a theme sets.
3
+ *
4
+ * Emitted into Tailwind's spacing namespace (`--spacing-control-md`), so every
5
+ * sizing utility reads them by name — `h-control-md`, `min-w-button-md`,
6
+ * `size-check`, `p-frame` — and a theme that changes a value changes every
7
+ * control drawn with it.
8
+ *
9
+ * The values here are Windows 98's, in CSS pixels: the sizes the Figma file
10
+ * draws at Large Fonts. They are pixels rather than rems on purpose. A bevel is
11
+ * drawn in whole pixels, and a control whose height scaled with the root font
12
+ * size would land on fractional pixels and blur its edges.
13
+ */
14
+ export declare const size: {
15
+ /** Control heights: buttons, fields, selects. Also the side of a square icon button's row. */
16
+ readonly 'control-xs': "21px";
17
+ readonly 'control-sm': "26px";
18
+ readonly 'control-md': "28px";
19
+ readonly 'control-lg': "33px";
20
+ /** Square icon buttons. A touch wider than the row they sit in, as Windows 98 drew them. */
21
+ readonly 'icon-xs': "25px";
22
+ readonly 'icon-sm': "27px";
23
+ readonly 'icon-md': "30px";
24
+ readonly 'icon-lg': "34px";
25
+ /** A button's minimum width, so a short label still makes a button worth aiming at. */
26
+ readonly 'button-min-xs': "3rem";
27
+ readonly 'button-min-sm': "4rem";
28
+ readonly 'button-min-md': "92px";
29
+ readonly 'button-min-lg': "108px";
30
+ /** A button's side padding. */
31
+ readonly 'button-px-xs': "0.375rem";
32
+ readonly 'button-px-sm': "0.5rem";
33
+ readonly 'button-px-md': "0.75rem";
34
+ readonly 'button-px-lg': "1rem";
35
+ /** A field's side padding, inside its edge. */
36
+ readonly 'field-px': "0.25rem";
37
+ readonly 'field-px-lg': "0.375rem";
38
+ /**
39
+ * A field's spacing: between label, control and message at each size, between
40
+ * a label and the control beside it, and between the error icon and its text.
41
+ */
42
+ readonly 'field-gap-sm': "0.25rem";
43
+ readonly 'field-gap-md': "0.375rem";
44
+ readonly 'field-gap-lg': "0.5rem";
45
+ readonly 'field-left-gap': "0.5rem";
46
+ readonly 'field-error-gap': "0.25rem";
47
+ /** The side of a checkbox's box, and of an option button. */
48
+ readonly check: "13px";
49
+ readonly radio: "12px";
50
+ /** Between a check box or option button and its label, and the label's own inset (where the dotted ring sits). */
51
+ readonly 'check-gap': "4px";
52
+ readonly 'check-label-px': "1px";
53
+ /** A window's or a dialog's title bar. */
54
+ readonly titlebar: "22px";
55
+ /** A caption button: minimise, maximise, close. */
56
+ readonly 'caption-w': "20px";
57
+ readonly 'caption-h': "18px";
58
+ /** The gap between caption buttons, and the extra space before the close button. */
59
+ readonly 'caption-gap': "0px";
60
+ readonly 'caption-close-gap': "2px";
61
+ /** A title bar's side padding. */
62
+ readonly 'titlebar-px': "2px";
63
+ /**
64
+ * Where a dialog's title starts and ends in its title bar, clear of the
65
+ * close button. Equal values centre it.
66
+ */
67
+ readonly 'title-inset-start': "4px";
68
+ readonly 'title-inset-end': "28px";
69
+ /**
70
+ * The frame between a window's edge and its content: the width of the bevel.
71
+ * A theme whose windows have no bevel sets it to zero.
72
+ */
73
+ readonly frame: "2px";
74
+ /**
75
+ * A dialog's insets: the side padding of its header, body and footer, the
76
+ * room above the first line, and above and below the footer's buttons.
77
+ */
78
+ readonly 'dialog-px': "0.75rem";
79
+ readonly 'dialog-pt': "0.75rem";
80
+ readonly 'dialog-footer-pt': "0.5rem";
81
+ readonly 'dialog-footer-pb': "0.75rem";
82
+ /** One option in a list: a select's, a menu's. */
83
+ readonly item: "22px";
84
+ /** An option's padding either side, the column its check mark sits in, the gap after it, and the mark. */
85
+ readonly 'item-pl': "2px";
86
+ readonly 'item-pr': "0.25rem";
87
+ readonly 'item-check': "12px";
88
+ readonly 'item-gap': "2px";
89
+ readonly 'item-check-glyph': "7px";
90
+ /** The inset around a dropped list's options, inside its border: 1px in Windows 98, as Figma draws it. */
91
+ readonly 'popover-inset': "1px";
92
+ /**
93
+ * A data table's side padding: a header cell's, around the 1px its label's
94
+ * focus ring takes, and a body cell's.
95
+ */
96
+ readonly 'table-header-px': "0.25rem";
97
+ readonly 'table-cell-px': "0.375rem";
98
+ /** Data table rows, and the header that matches them. */
99
+ readonly 'row-sm': "22px";
100
+ readonly 'row-md': "27px";
101
+ /** A select's drop arrows, and how far the down arrow tucks under an up arrow above it. */
102
+ readonly 'select-arrow': "8px";
103
+ readonly 'select-arrow-overlap': "0px";
104
+ /** «Loading…» and «No results found» in a dropped list: padding, and the gap after the busy glyph. */
105
+ readonly 'select-message-px': "6px";
106
+ readonly 'select-message-py': "6px";
107
+ readonly 'select-message-gap': "6px";
108
+ /** The strip around a searchable list's search box, and the space under it. */
109
+ readonly 'select-search-p': "2px";
110
+ readonly 'select-search-gap': "0px";
111
+ /**
112
+ * The buttons inside a number, date or select field: their height at each
113
+ * size, centred in the field as Figma draws them; how far they sit from the
114
+ * field's right edge; and the date field's glyph. A select's arrows sit
115
+ * `select-pr` in.
116
+ */
117
+ readonly 'field-button-h-sm': "17px";
118
+ readonly 'field-button-h': "19px";
119
+ readonly 'field-button-h-lg': "23px";
120
+ readonly 'field-button-pr': "2px";
121
+ readonly 'field-drop-icon': "8px";
122
+ readonly 'select-pr': "2px";
123
+ /** A filter bar's padding and the space between its items. */
124
+ readonly 'filter-bar-p': "0.25rem";
125
+ readonly 'filter-bar-gap': "0.25rem";
126
+ /** A filter chip's side padding, and its right padding beside the ✕. */
127
+ readonly 'chip-px': "0.375rem";
128
+ readonly 'chip-pr-remove': "0.125rem";
129
+ /** A toast's padding, the gap between its icon, text and ✕, and between its lines. */
130
+ readonly 'toast-py': "0.5rem";
131
+ readonly 'toast-pl': "0.5rem";
132
+ readonly 'toast-pr': "0.25rem";
133
+ readonly 'toast-gap': "0.5rem";
134
+ readonly 'toast-body-gap': "0.25rem";
135
+ /** A toast's status icon, and its ✕. */
136
+ readonly 'toast-icon': "16px";
137
+ readonly 'toast-close-w': "20px";
138
+ readonly 'toast-close-h': "18px";
139
+ /** A page number's side padding. */
140
+ readonly 'pager-px': "0.25rem";
141
+ /**
142
+ * A pager's arrows, the inset of the dotted focus ring round a page label,
143
+ * and how narrow a small page button may get (Windows 98 lets it hug its
144
+ * number; a theme can keep it square).
145
+ */
146
+ readonly 'pager-arrow': "8px";
147
+ readonly 'pager-focus-px': "1px";
148
+ readonly 'pager-min-sm': "0px";
149
+ /** A filter chip. */
150
+ readonly 'chip-sm': "23px";
151
+ readonly 'chip-md': "26px";
152
+ /** A badge's side padding. */
153
+ readonly 'badge-px-sm': "0.25rem";
154
+ readonly 'badge-px-md': "0.375rem";
155
+ /** The side of a badge's status dot. */
156
+ readonly 'badge-dot': "5px";
157
+ /** An empty view's padding at each size, and the gap between its icon and its text at `md` and `lg`. */
158
+ readonly 'empty-p-sm': "0.75rem";
159
+ readonly 'empty-p-md': "1.5rem";
160
+ readonly 'empty-p-lg': "1.5rem";
161
+ readonly 'empty-gap': "1rem";
162
+ /** A tooltip's padding. */
163
+ readonly 'tooltip-px': "0.25rem";
164
+ readonly 'tooltip-py': "1px";
165
+ /** A status bar. */
166
+ readonly statusbar: "27px";
167
+ /** A status bar's padding and the space between its sections; a section's side padding and the space inside it. */
168
+ readonly 'statusbar-px': "2px";
169
+ readonly 'statusbar-py': "2px";
170
+ readonly 'statusbar-gap': "2px";
171
+ readonly 'statusbar-section-px': "0.25rem";
172
+ readonly 'statusbar-section-gap': "0.25rem";
173
+ /** A progress bar: its height, the inset around the fill, and the fill. */
174
+ readonly progress: "18px";
175
+ readonly 'progress-inset': "2px";
176
+ readonly 'progress-fill': "12px";
177
+ /** One block of the fill, and the block plus the gap after it. Equal values draw a solid bar. */
178
+ readonly 'progress-block': "8px";
179
+ readonly 'progress-period': "10px";
180
+ /** The segment an indeterminate bar moves along the track: four blocks in Windows 98. */
181
+ readonly 'progress-segment': "38px";
182
+ /** A scroll bar's thickness, and the side of its arrow buttons (zero hides them). */
183
+ readonly scrollbar: "16px";
184
+ readonly 'scroll-button': "16px";
185
+ /** The space between the thumb and the edge of its track. */
186
+ readonly 'scroll-inset': "0px";
187
+ /** A group box: where its frame starts, the room above its content, and its legend's offset. */
188
+ readonly 'groupbox-top': "6px";
189
+ readonly 'groupbox-pt': "1rem";
190
+ readonly 'groupbox-legend-x': "0.5rem";
191
+ readonly 'groupbox-legend-px': "2px";
192
+ };
193
+ /** Names of every size token. */
194
+ export type SizeName = keyof typeof size;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Style switches: how a theme draws a state, beyond its colours and sizes.
3
+ *
4
+ * Windows 98 and a modern theme differ in more than values. One marks focus
5
+ * with a dotted rectangle around a button's label, the other with a ring
6
+ * around the whole button; one shifts a held button's label a pixel, the other
7
+ * darkens its face; one fills a latched toggle with a checker pattern. Each of
8
+ * those differences is a variable here, emitted as `--rk-<name>`, and the
9
+ * components are written against the variables. A theme sets them; no
10
+ * component knows which theme it is drawn in.
11
+ *
12
+ * They are not Tailwind theme tokens — nothing generates a utility from them —
13
+ * so they are declared on `:root` and read with arbitrary values
14
+ * (`pr-(--rk-press-shift)`) or by the utilities in `rowkit/styles`.
15
+ *
16
+ * The values here are Windows 98's.
17
+ */
18
+ export declare const style: {
19
+ /** The ring drawn around a control's label, inside it. Windows 98's dotted rectangle. */
20
+ readonly 'focus-label-width': "1px";
21
+ /** The ring drawn on the focused element itself — a row, a scrolling region, a toast. */
22
+ readonly 'focus-ring-width': "1px";
23
+ readonly 'focus-ring-style': "dotted";
24
+ /** The ring drawn around a control's edge, outside it. Windows 98 has none. */
25
+ readonly 'focus-outer-width': "0px";
26
+ readonly 'focus-outer-offset': "0px";
27
+ /** How far a held button's label moves down and right. */
28
+ readonly 'press-shift': "1px";
29
+ /** A brightness filter on a held caption button. `1` leaves it alone. */
30
+ readonly 'press-brightness': "1";
31
+ /** The pattern over a latched toggle and a scroll track. */
32
+ readonly 'dither-image': string;
33
+ /** The pattern of a loading placeholder, and how it moves. */
34
+ readonly 'loading-image': string;
35
+ readonly 'animate-loading': "rk-dither 800ms steps(1) infinite";
36
+ /**
37
+ * The busy mark in a loading button: Windows 98's hourglass stands still; a
38
+ * theme with a spinner glyph turns it.
39
+ */
40
+ readonly 'animate-busy': "none";
41
+ /**
42
+ * An indeterminate progress bar's segment travelling across the track.
43
+ * Windows 98 moves its four blocks one block every 100ms and starts again
44
+ * at the left; `ProgressBar` sets `--rk-progress-steps` to the number of
45
+ * steps that fit the track it measures.
46
+ */
47
+ readonly 'animate-progress': "rk-progress-march calc(var(--rk-progress-steps, 18) * 100ms) steps(var(--rk-progress-steps, 18)) infinite";
48
+ /** How long a control takes to change state. Windows 98 changes instantly. */
49
+ readonly 'duration-control': "0ms";
50
+ /** How a dialog, a list or a toast arrives. */
51
+ readonly 'animate-overlay-in': "none";
52
+ /** The light second line of an etched separator. Zero leaves a single line. */
53
+ readonly 'etch-width': "1px";
54
+ /** Where the caption buttons sit in the title bar: `0` after the title, `-1` before it. */
55
+ readonly 'caption-order': "0";
56
+ /** Where the close button sits among them: `0` last, `-1` first. */
57
+ readonly 'close-order': "0";
58
+ /** Whether a window shows its icon in the title bar: `flex`, or `none`. */
59
+ readonly 'titlebar-icon': "flex";
60
+ /** Where the title sits: `start`, or `center`. */
61
+ readonly 'titlebar-align': "start";
62
+ /** Space kept clear opposite the caption buttons, so a centred title is centred on the bar. */
63
+ readonly 'titlebar-balance': "0px";
64
+ /** The opacity of a caption button's glyph at rest; hovering the title bar shows it. */
65
+ readonly 'caption-glyph-opacity': "1";
66
+ /** The weight of a group box's legend. */
67
+ readonly 'legend-weight': "400";
68
+ /** The line under a link-styled button: `underline`, or `none`. */
69
+ readonly 'link-decoration': "underline";
70
+ /** The red frame inside an invalid field. Windows 98 marks it with the error icon only. */
71
+ readonly 'invalid-width': "0px";
72
+ /** Where a field's error icon sits beside a message that wraps: `center`, or `start`. */
73
+ readonly 'field-error-align': "center";
74
+ /** Whether a select's drop button shows an up arrow over its down arrow: `block`, or `none`. */
75
+ readonly 'select-up': "none";
76
+ /**
77
+ * The order of a dialog footer's buttons, written primary first: `row` keeps
78
+ * it, as Windows 98 does; `row-reverse` puts the primary button last.
79
+ */
80
+ readonly 'footer-direction': "row";
81
+ /**
82
+ * How an empty view lays out its icon and text: `row` puts the icon beside
83
+ * the text, `column` above it; `start` or `center` aligns the text.
84
+ */
85
+ readonly 'empty-direction': "row";
86
+ readonly 'empty-align': "start";
87
+ /** What a modal dialog lays over the page behind it. */
88
+ readonly 'overlay-bg': "transparent";
89
+ /** A backdrop filter behind a dropped list. */
90
+ readonly 'popover-backdrop': "none";
91
+ /**
92
+ * A dropped list's border. Windows 98 draws a black line; a theme that
93
+ * rings the list in its shadow (`--rk-shadow-popover`) sets it to zero.
94
+ */
95
+ readonly 'popover-border-width': "1px";
96
+ /** Whether a scroll bar has arrow buttons: `block`, or `none`. */
97
+ readonly 'scrollbar-buttons': "block";
98
+ /** A multiplier on small glyphs — a check mark, a caption glyph — for a theme whose glyphs are not pixel art. */
99
+ readonly 'glyph-scale': "1";
100
+ /**
101
+ * An option button drawn by CSS rather than by its pixels: how much of the
102
+ * well and the dot to paint (`0%` paints neither), the dot's radius and the
103
+ * edge's width.
104
+ */
105
+ readonly 'radio-fill': "0%";
106
+ readonly 'radio-dot-r': "0px";
107
+ readonly 'radio-edge': "0px";
108
+ /** `display` of a pixel icon's pixels. */
109
+ readonly 'icon-pixels': "inline";
110
+ /**
111
+ * Whether the glyphs mask the icons at all. `initial` makes every glyph mask
112
+ * invalid, so a Windows 98 icon has no mask and nothing of it is clipped;
113
+ * an empty value lets them through. It is prepended to each mask image.
114
+ */
115
+ readonly 'icon-glyphs': "initial";
116
+ /** The fill a theme's own glyph is painted in; transparent draws nothing. */
117
+ readonly 'icon-fill': "transparent";
118
+ /**
119
+ * The fills of the glyphs that keep a colour: status icons and folders.
120
+ * Transparent in Windows 98, whose pixel icons carry their own colours.
121
+ */
122
+ readonly 'icon-tone-danger': "transparent";
123
+ readonly 'icon-tone-warning': "transparent";
124
+ readonly 'icon-tone-info': "transparent";
125
+ readonly 'icon-tone-success': "transparent";
126
+ readonly 'icon-tone-folder': "transparent";
127
+ };
128
+ /** Names of every style switch. */
129
+ export type StyleName = keyof typeof style;
@@ -0,0 +1,69 @@
1
+ import { SemanticColorName } from '../color.js';
2
+ import { RadiusName } from '../radius.js';
3
+ import { ShadowName } from '../shadow.js';
4
+ import { SizeName } from '../size.js';
5
+ import { StyleName } from '../style.js';
6
+ import { modernFontSize } from './modern.js';
7
+ export { modernDarkColor, modernDarkShadow, modernFont, modernFontSize, modernFontWeight, modernLightColor, modernLightShadow, modernPalette, modernRadius, modernSize, modernStyle, } from './modern.js';
8
+ export type { ModernPaletteName } from './modern.js';
9
+ /** The themes rowkit ships. `win98` is the default: what `:root` carries. */
10
+ export declare const themeNames: readonly ["win98", "modern"];
11
+ export type ThemeName = (typeof themeNames)[number];
12
+ /** A theme as the stylesheet declares it: custom property name → value. */
13
+ export type ThemeVars = Record<`--${string}`, string>;
14
+ /**
15
+ * The name of every variable a theme may set: the keys of {@link win98Vars},
16
+ * spelled out so an editor completes them and a typo fails the type check.
17
+ */
18
+ export type ThemeTokenName = `--color-${SemanticColorName}` | `--rk-shadow-${ShadowName}` | `--spacing-${SizeName}` | `--radius-${Exclude<RadiusName, 'full'>}` | `--rk-${StyleName}` | '--font-sans' | '--font-mono' | `--text-${keyof typeof modernFontSize}` | `--text-${keyof typeof modernFontSize}--line-height` | '--font-weight-strong';
19
+ /** Values for some of a theme's variables, by name: what {@link defineTheme} takes. */
20
+ export type ThemeValues = Partial<Record<ThemeTokenName, string>>;
21
+ /**
22
+ * Windows 98, as variables: every value a theme may change, at its Windows 98
23
+ * value. Declared on `[data-theme="win98"]` as well as being the default, so a
24
+ * Windows 98 region inside a page in another theme is drawn in Windows 98.
25
+ */
26
+ export declare const win98Vars: ThemeVars;
27
+ /** The modern theme in its light scheme. */
28
+ export declare const modernLightVars: ThemeVars;
29
+ /** What the dark scheme changes on top of the light one. */
30
+ export declare const modernDarkVars: ThemeVars;
31
+ /** A theme of your own, for {@link defineTheme}. */
32
+ export interface ThemeDefinition {
33
+ /** Its name: the page switches to it with `data-theme="<name>"`. Lowercase, digits and dashes. */
34
+ name: string;
35
+ /**
36
+ * The theme it starts from. Every value it does not set comes from there,
37
+ * so a theme is as small as what it changes. Default `modern`.
38
+ */
39
+ extends?: ThemeName;
40
+ /** Values for the light scheme — for a theme without a dark one, its only scheme. */
41
+ light?: ThemeValues;
42
+ /**
43
+ * Values for the dark scheme, on top of the light ones. A theme built on
44
+ * `modern` inherits its dark scheme; set `dark: false` to have none.
45
+ */
46
+ dark?: ThemeValues | false;
47
+ }
48
+ /** A rule declaring a theme's values and its colour scheme. */
49
+ export declare function themeRule(selector: string, scheme: 'light' | 'dark', values: ThemeVars): string;
50
+ /**
51
+ * The stylesheet for a theme of your own.
52
+ *
53
+ * Every value is declared on the theme's element — the base theme's as well
54
+ * as yours — because a variable that uses `var()` is resolved where it is
55
+ * declared; that is also what lets themes nest. The dark scheme follows the
56
+ * system unless `data-color-scheme` on the same element fixes it, exactly as
57
+ * the modern theme's does.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * import { defineTheme } from '@rowkit/tokens'
62
+ *
63
+ * const css = defineTheme({
64
+ * name: 'acme',
65
+ * light: { '--color-control-primary': '#5b3df5', '--radius-md': '10px' },
66
+ * })
67
+ * ```
68
+ */
69
+ export declare function defineTheme(theme: ThemeDefinition): string;
@@ -0,0 +1,139 @@
1
+ import { SemanticColorName } from '../color.js';
2
+ import { RadiusName } from '../radius.js';
3
+ import { ShadowName } from '../shadow.js';
4
+ import { SizeName } from '../size.js';
5
+ import { StyleName } from '../style.js';
6
+ /**
7
+ * The modern theme: the look of a current desktop operating system. White and
8
+ * light-grey surfaces, a blue accent, rounded corners, soft shadows, a ring
9
+ * around the focused control and short transitions. Light and dark.
10
+ *
11
+ * Switched on with `data-theme="modern"` on any element, `<html>` included.
12
+ * The colour scheme follows the system unless `data-color-scheme="light"` or
13
+ * `"dark"` on the same element fixes it.
14
+ *
15
+ * The values follow the designer's Figma file, mode for mode.
16
+ */
17
+ /** The modern palette. Eight-digit values carry alpha. */
18
+ export declare const modernPalette: {
19
+ readonly white: "#ffffff";
20
+ readonly black: "#000000";
21
+ readonly transparent: "#00000000";
22
+ readonly 'gray-50': "#f9f9fb";
23
+ readonly 'gray-100': "#f5f5f7";
24
+ readonly 'gray-150': "#efeff2";
25
+ readonly 'gray-200': "#e8e8ed";
26
+ readonly 'gray-250': "#e0e0e5";
27
+ readonly 'gray-300': "#d2d2d7";
28
+ readonly 'gray-400': "#aeaeb2";
29
+ readonly 'gray-500': "#86868b";
30
+ readonly 'gray-600': "#6e6e73";
31
+ readonly 'gray-700': "#515154";
32
+ readonly 'gray-750': "#48484a";
33
+ readonly 'gray-800': "#3a3a3c";
34
+ readonly 'gray-850': "#2c2c2e";
35
+ readonly 'gray-900': "#1d1d1f";
36
+ readonly 'gray-925': "#1c1c1e";
37
+ readonly 'gray-950': "#161617";
38
+ readonly blue: "#0071e3";
39
+ readonly 'blue-hover': "#0068d6";
40
+ readonly 'blue-active': "#0062c4";
41
+ readonly 'blue-link': "#0066cc";
42
+ readonly 'blue-link-dark': "#2997ff";
43
+ readonly 'blue-subtle': "#e8f1fc";
44
+ readonly 'blue-subtle-dark': "#0f2a47";
45
+ readonly 'blue-text': "#0058b0";
46
+ readonly 'blue-text-dark': "#6cb4ff";
47
+ readonly 'blue-border': "#b3d1f5";
48
+ readonly 'blue-border-dark': "#1f4b7a";
49
+ readonly 'blue-ring': "#0071e3cc";
50
+ readonly 'blue-ring-dark': "#2997ffcc";
51
+ readonly green: "#1f7a35";
52
+ readonly 'green-hover': "#1a6a2e";
53
+ readonly 'green-subtle': "#e7f6eb";
54
+ readonly 'green-subtle-dark': "#12301b";
55
+ readonly 'green-text': "#1b6e31";
56
+ readonly 'green-text-dark': "#5fd47e";
57
+ readonly 'green-border': "#b4e2c0";
58
+ readonly 'green-border-dark': "#245c33";
59
+ readonly orange: "#ff9f0a";
60
+ readonly 'orange-hover': "#f59300";
61
+ readonly 'orange-subtle': "#fff4e0";
62
+ readonly 'orange-subtle-dark': "#3a2a0c";
63
+ readonly 'orange-text': "#8a4b00";
64
+ readonly 'orange-text-dark': "#ffbe5c";
65
+ readonly 'orange-border': "#ffd59a";
66
+ readonly 'orange-border-dark': "#6b4a12";
67
+ readonly red: "#d70015";
68
+ readonly 'red-hover': "#c00013";
69
+ readonly 'red-subtle': "#fdeaea";
70
+ readonly 'red-subtle-dark': "#3d1416";
71
+ readonly 'red-text': "#b0000f";
72
+ readonly 'red-text-dark': "#ffa0a4";
73
+ readonly 'red-border': "#f5b5b9";
74
+ readonly 'red-border-dark': "#7a2329";
75
+ readonly 'traffic-red': "#ff5f57";
76
+ readonly 'traffic-yellow': "#febc2e";
77
+ readonly 'traffic-green': "#28c840";
78
+ readonly 'ink-4': "#0000000a";
79
+ readonly 'ink-6': "#0000000f";
80
+ readonly 'ink-8': "#00000014";
81
+ readonly 'ink-10': "#0000001a";
82
+ readonly 'ink-12': "#0000001f";
83
+ readonly 'ink-15': "#00000026";
84
+ readonly 'ink-25': "#00000040";
85
+ readonly 'ink-50': "#00000080";
86
+ readonly 'light-4': "#ffffff0a";
87
+ readonly 'light-8': "#ffffff14";
88
+ readonly 'light-12': "#ffffff1f";
89
+ readonly 'light-16': "#ffffff29";
90
+ readonly 'light-25': "#ffffff40";
91
+ readonly 'light-50': "#ffffff80";
92
+ readonly 'glass-light': "#ffffffd9";
93
+ readonly 'glass-dark': "#323234e0";
94
+ readonly 'desktop-light': "#c7d3e6";
95
+ readonly 'desktop-dark': "#101014";
96
+ };
97
+ export type ModernPaletteName = keyof typeof modernPalette;
98
+ /** Semantic colours, light. Every semantic token is listed: the theme leaves nothing to Windows 98. */
99
+ export declare const modernLightColor: Record<SemanticColorName, string>;
100
+ /** Semantic colours, dark. */
101
+ export declare const modernDarkColor: Record<SemanticColorName, string>;
102
+ /** Shadows, light. Soft and outside the box, where Windows 98's bevels are hard and inside it. */
103
+ export declare const modernLightShadow: Record<ShadowName, string>;
104
+ /** Shadows, dark: edges drawn in light ink, because a dark shadow on a dark page shows nothing. */
105
+ export declare const modernDarkShadow: Record<ShadowName, string>;
106
+ /** Sizes. Roomier than Windows 98's, for a pointer and a finger alike. */
107
+ export declare const modernSize: Record<SizeName, string>;
108
+ /** Corner radii, set directly: each is a length here, not a multiple of `--radius`. */
109
+ export declare const modernRadius: Record<Exclude<RadiusName, 'full'>, string>;
110
+ /** Style switches. */
111
+ export declare const modernStyle: Record<StyleName, string>;
112
+ /** Typefaces: the platform's own. Nothing to load. */
113
+ export declare const modernFont: {
114
+ readonly sans: string;
115
+ readonly mono: string;
116
+ };
117
+ /** Type sizes that differ from Windows 98's. Size and line height, as in `fontSize`. */
118
+ export declare const modernFontSize: {
119
+ readonly ui: {
120
+ readonly size: "0.8125rem";
121
+ readonly lineHeight: "1.125rem";
122
+ };
123
+ readonly heading: {
124
+ readonly size: "0.9375rem";
125
+ readonly lineHeight: "1.25rem";
126
+ };
127
+ readonly mono: {
128
+ readonly size: "0.75rem";
129
+ readonly lineHeight: "1.125rem";
130
+ };
131
+ readonly 'doc-mono': {
132
+ readonly size: "0.875rem";
133
+ readonly lineHeight: "1.375rem";
134
+ };
135
+ };
136
+ /** Font weights that differ: emphasis is semibold. */
137
+ export declare const modernFontWeight: {
138
+ readonly strong: "600";
139
+ };