@jztack/tokens 0.0.0-stage → 0.2.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 +71 -2
- package/dist/css/commonboard.css +269 -0
- package/dist/css/rentproof.css +269 -0
- package/dist/css/tabbie.css +277 -0
- package/dist/css/twjs.css +308 -0
- package/dist/css/wedding-ops.css +269 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/locale/my.d.ts +16 -0
- package/dist/locale/my.js +22 -0
- package/dist/palette/colors.d.ts +130 -0
- package/dist/palette/colors.js +129 -0
- package/dist/restyle.d.ts +38 -0
- package/dist/restyle.js +140 -0
- package/dist/semantic/contract.d.ts +118 -0
- package/dist/semantic/contract.js +148 -0
- package/dist/themes/commonboard.d.ts +13 -0
- package/dist/themes/commonboard.js +53 -0
- package/dist/themes/index.d.ts +10 -0
- package/dist/themes/index.js +15 -0
- package/dist/themes/rentproof.d.ts +2 -0
- package/dist/themes/rentproof.js +55 -0
- package/dist/themes/status-defaults.d.ts +11 -0
- package/dist/themes/status-defaults.js +29 -0
- package/dist/themes/tabbie.d.ts +2 -0
- package/dist/themes/tabbie.js +65 -0
- package/dist/themes/twjs.d.ts +19 -0
- package/dist/themes/twjs.js +83 -0
- package/dist/themes/wedding-ops.d.ts +18 -0
- package/dist/themes/wedding-ops.js +56 -0
- package/dist/tokens.css +472 -0
- package/package.json +31 -3
package/dist/restyle.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { localeOverrides } from './locale/my.js';
|
|
2
|
+
import { breakpoints, radii, spacing, typeRoles, } from './semantic/contract.js';
|
|
3
|
+
import { themes } from './themes/index.js';
|
|
4
|
+
/** Canonical color slot -> TWJS legacy key (DESIGN.md §3). */
|
|
5
|
+
const legacyColorAliases = {
|
|
6
|
+
background: 'mainBackground',
|
|
7
|
+
'background-secondary': 'secondaryBackground',
|
|
8
|
+
foreground: 'primaryText',
|
|
9
|
+
'foreground-secondary': 'secondaryText',
|
|
10
|
+
card: 'cardBackground',
|
|
11
|
+
primary: 'primaryButton',
|
|
12
|
+
'primary-foreground': 'primaryButtonText',
|
|
13
|
+
secondary: 'secondaryButton',
|
|
14
|
+
'secondary-foreground': 'secondaryButtonText',
|
|
15
|
+
accent: 'brand',
|
|
16
|
+
'accent-bg': 'brandBg',
|
|
17
|
+
'accent-border': 'brandBorder',
|
|
18
|
+
border: 'borderColor',
|
|
19
|
+
'border-strong': 'borderStrong',
|
|
20
|
+
'success-bg': 'successBg',
|
|
21
|
+
'success-foreground': 'successText',
|
|
22
|
+
'warning-bg': 'warningBg',
|
|
23
|
+
'warning-foreground': 'warningText',
|
|
24
|
+
'danger-bg': 'dangerBg',
|
|
25
|
+
'danger-foreground': 'dangerText',
|
|
26
|
+
'info-bg': 'infoBg',
|
|
27
|
+
'info-foreground': 'infoText',
|
|
28
|
+
};
|
|
29
|
+
/** Type-role color references, expressed in legacy restyle color keys. */
|
|
30
|
+
const legacyTypeColor = {
|
|
31
|
+
foreground: 'primaryText',
|
|
32
|
+
'foreground-secondary': 'secondaryText',
|
|
33
|
+
// TWJS's error variant points at its errorText key (= danger-foreground).
|
|
34
|
+
'danger-foreground': 'errorText',
|
|
35
|
+
};
|
|
36
|
+
const toCamel = (name) => name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
37
|
+
function buildColors(themeName, mode, colors) {
|
|
38
|
+
const out = { ...colors };
|
|
39
|
+
for (const [slot, legacy] of Object.entries(legacyColorAliases)) {
|
|
40
|
+
out[legacy] = colors[slot];
|
|
41
|
+
}
|
|
42
|
+
// Legacy keys TWJS code uses that sit outside the canonical alias table:
|
|
43
|
+
// errorText/errorBackground are its danger-foreground/danger-bg pair.
|
|
44
|
+
out.errorText = colors['danger-foreground'];
|
|
45
|
+
out.errorBackground = colors['danger-bg'];
|
|
46
|
+
out.transparent = 'transparent';
|
|
47
|
+
// TWJS's dark theme flips its `pureWhite` semantic to slate-100.
|
|
48
|
+
out.pureWhite = mode === 'dark' && themeName === 'twjs' ? '#f1f5f9' : '#ffffff';
|
|
49
|
+
const extras = themes[themeName]?.restyleExtras?.[mode];
|
|
50
|
+
if (extras)
|
|
51
|
+
Object.assign(out, extras);
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
function buildSpacing() {
|
|
55
|
+
const out = { ...spacing };
|
|
56
|
+
// Negatives are generated by the emitter, never stored (DESIGN.md §3).
|
|
57
|
+
for (const [key, value] of Object.entries(spacing)) {
|
|
58
|
+
if (value > 0)
|
|
59
|
+
out[`-${key}`] = -value;
|
|
60
|
+
}
|
|
61
|
+
// Legacy component tokens TWJS still references; `sm` (12) is the value
|
|
62
|
+
// inputAccessoryInset always held, inputVertical (10) has no scale step.
|
|
63
|
+
out.inputVertical = 10;
|
|
64
|
+
out.inputAccessoryInset = spacing.sm;
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
function buildRadii() {
|
|
68
|
+
return {
|
|
69
|
+
// Canonical keys
|
|
70
|
+
...radii,
|
|
71
|
+
// Legacy restyle keys (TWJS: s 4, m 8, l 12, xl 20, none 0)
|
|
72
|
+
none: 0,
|
|
73
|
+
s: radii.sm,
|
|
74
|
+
m: radii.md,
|
|
75
|
+
l: radii.lg,
|
|
76
|
+
xl: radii['2xl'],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function buildTextVariants() {
|
|
80
|
+
const out = {};
|
|
81
|
+
for (const [name, role] of Object.entries(typeRoles)) {
|
|
82
|
+
const variant = {
|
|
83
|
+
fontSize: role.fontSize,
|
|
84
|
+
lineHeight: role.lineHeight,
|
|
85
|
+
};
|
|
86
|
+
if (role.fontWeight !== undefined)
|
|
87
|
+
variant.fontWeight = role.fontWeight;
|
|
88
|
+
if (role.color !== undefined)
|
|
89
|
+
variant.color = legacyTypeColor[role.color];
|
|
90
|
+
if (role.textAlign !== undefined)
|
|
91
|
+
variant.textAlign = role.textAlign;
|
|
92
|
+
out[toCamel(name)] = variant;
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Build the restyle theme object for a theme. `mode` defaults to the first
|
|
98
|
+
* mode the theme declares. Throws for an unknown theme or a mode the theme
|
|
99
|
+
* does not declare (e.g. a light mode for dark-only Tabbie).
|
|
100
|
+
*/
|
|
101
|
+
export function createThemeData(themeName, mode) {
|
|
102
|
+
const theme = themes[themeName];
|
|
103
|
+
if (!theme)
|
|
104
|
+
throw new Error(`@jztack/tokens: unknown theme "${themeName}"`);
|
|
105
|
+
const resolvedMode = mode ?? Object.keys(theme.modes)[0];
|
|
106
|
+
const colors = theme.modes[resolvedMode];
|
|
107
|
+
if (!colors) {
|
|
108
|
+
throw new Error(`@jztack/tokens: theme "${themeName}" has no "${resolvedMode}" mode`);
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
colors: buildColors(themeName, resolvedMode, colors),
|
|
112
|
+
spacing: buildSpacing(),
|
|
113
|
+
borderRadii: buildRadii(),
|
|
114
|
+
breakpoints: { ...breakpoints },
|
|
115
|
+
textVariants: buildTextVariants(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Compose a locale override layer into a restyle theme — the counterpart of
|
|
120
|
+
* mobile-web's existing getThemeForLanguage(theme, lang). Unknown locales
|
|
121
|
+
* return the theme unchanged.
|
|
122
|
+
*/
|
|
123
|
+
export function getThemeForLocale(theme, locale) {
|
|
124
|
+
const override = localeOverrides[locale];
|
|
125
|
+
if (!override?.textVariants)
|
|
126
|
+
return theme;
|
|
127
|
+
const textVariants = { ...theme.textVariants };
|
|
128
|
+
for (const [name, partial] of Object.entries(override.textVariants)) {
|
|
129
|
+
const key = toCamel(name);
|
|
130
|
+
const base = textVariants[key];
|
|
131
|
+
if (!base || !partial)
|
|
132
|
+
continue;
|
|
133
|
+
textVariants[key] = {
|
|
134
|
+
...base,
|
|
135
|
+
...(partial.fontSize !== undefined ? { fontSize: partial.fontSize } : {}),
|
|
136
|
+
...(partial.lineHeight !== undefined ? { lineHeight: partial.lineHeight } : {}),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return { ...theme, textVariants };
|
|
140
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The semantic contract — the fixed set of role names every theme must fill.
|
|
3
|
+
* Components reference ONLY this layer. A theme missing a slot is a type
|
|
4
|
+
* error (see ThemeDefinition), not a runtime surprise.
|
|
5
|
+
*/
|
|
6
|
+
/** Canonical color slots (shadcn naming convention). */
|
|
7
|
+
export declare const colorSlots: readonly ['background', 'background-secondary', 'foreground', 'foreground-secondary', 'card', 'card-foreground', 'popover', 'popover-foreground', 'primary', 'primary-foreground', 'secondary', 'secondary-foreground', 'muted', 'muted-foreground', 'accent', 'accent-bg', 'accent-border', 'accent-foreground', 'destructive', 'destructive-foreground', 'border', 'border-strong', 'input', 'ring', 'success', 'success-bg', 'success-foreground', 'warning', 'warning-bg', 'warning-foreground', 'danger', 'danger-bg', 'danger-foreground', 'info', 'info-bg', 'info-foreground'];
|
|
8
|
+
export type ColorSlot = (typeof colorSlots)[number];
|
|
9
|
+
/** A complete assignment of every color slot. Alpha values are first-class. */
|
|
10
|
+
export type ColorSet = Record<ColorSlot, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Named 4pt spacing scale. This is TWJS's scale plus the two steps it was
|
|
13
|
+
* missing: `sm` 12 (which TWJS smuggled in as a component token) and `lg` 32.
|
|
14
|
+
* Negative values are an emitter concern and are never stored here.
|
|
15
|
+
*/
|
|
16
|
+
export declare const spacing: {
|
|
17
|
+
readonly none: 0;
|
|
18
|
+
readonly hairline: 1;
|
|
19
|
+
readonly xxs: 2;
|
|
20
|
+
readonly xs: 4;
|
|
21
|
+
readonly s: 8;
|
|
22
|
+
readonly sm: 12;
|
|
23
|
+
readonly m: 16;
|
|
24
|
+
readonly l: 24;
|
|
25
|
+
readonly lg: 32;
|
|
26
|
+
readonly xl: 40;
|
|
27
|
+
};
|
|
28
|
+
export type SpacingScale = typeof spacing;
|
|
29
|
+
export type SpacingKey = keyof SpacingScale;
|
|
30
|
+
/**
|
|
31
|
+
* Container scale — Tailwind v4's default `--container-*` values, verbatim
|
|
32
|
+
* (tailwindcss 4.3.5 theme.css). These are the stock meanings of the named
|
|
33
|
+
* sizes for the width utilities: `max-w-sm` is 24rem, not a spacing step.
|
|
34
|
+
*
|
|
35
|
+
* D1 (see DESIGN.md §3): the spacing scale above reuses four container
|
|
36
|
+
* names (`xs`, `sm`, `lg`, `xl`), and Tailwind resolves `max-w-*` /
|
|
37
|
+
* `w-*` / `min-w-*` against `--spacing` BEFORE `--container` — so the
|
|
38
|
+
* spacing keys shadowed the container scale. The CSS emitter therefore
|
|
39
|
+
* also emits this scale under the `--width-*`, `--min-width-*`, and
|
|
40
|
+
* `--max-width-*` namespaces, which those utilities resolve FIRST
|
|
41
|
+
* (verified in the installed tailwindcss source), restoring stock
|
|
42
|
+
* semantics without renaming any spacing key. The restyle/JS side never
|
|
43
|
+
* sees this scale: it is a CSS-resolution concern only.
|
|
44
|
+
*/
|
|
45
|
+
export declare const container: {
|
|
46
|
+
readonly '3xs': '16rem';
|
|
47
|
+
readonly '2xs': '18rem';
|
|
48
|
+
readonly xs: '20rem';
|
|
49
|
+
readonly sm: '24rem';
|
|
50
|
+
readonly md: '28rem';
|
|
51
|
+
readonly lg: '32rem';
|
|
52
|
+
readonly xl: '36rem';
|
|
53
|
+
readonly '2xl': '42rem';
|
|
54
|
+
readonly '3xl': '48rem';
|
|
55
|
+
readonly '4xl': '56rem';
|
|
56
|
+
readonly '5xl': '64rem';
|
|
57
|
+
readonly '6xl': '72rem';
|
|
58
|
+
readonly '7xl': '80rem';
|
|
59
|
+
};
|
|
60
|
+
export type ContainerScale = typeof container;
|
|
61
|
+
export type ContainerKey = keyof ContainerScale;
|
|
62
|
+
/** Radius scale (px). `full` is the pill radius. */
|
|
63
|
+
export declare const radii: {
|
|
64
|
+
readonly sm: 4;
|
|
65
|
+
readonly md: 8;
|
|
66
|
+
readonly lg: 12;
|
|
67
|
+
readonly xl: 16;
|
|
68
|
+
readonly '2xl': 20;
|
|
69
|
+
readonly full: 9999;
|
|
70
|
+
};
|
|
71
|
+
export type RadiiScale = typeof radii;
|
|
72
|
+
/** Breakpoints (px). `wide` doubles as the max container width. */
|
|
73
|
+
export declare const breakpoints: {
|
|
74
|
+
readonly phone: 0;
|
|
75
|
+
readonly tablet: 768;
|
|
76
|
+
readonly desktop: 1024;
|
|
77
|
+
readonly wide: 1440;
|
|
78
|
+
};
|
|
79
|
+
export type BreakpointScale = typeof breakpoints;
|
|
80
|
+
/** Color roles a type role may point at (a subset of the color contract). */
|
|
81
|
+
export type TypeColorRole = 'foreground' | 'foreground-secondary' | 'danger-foreground';
|
|
82
|
+
/** A composite type token: size + line-height + weight + color role. */
|
|
83
|
+
export interface TypeRole {
|
|
84
|
+
fontSize: number;
|
|
85
|
+
lineHeight: number;
|
|
86
|
+
fontWeight?: string;
|
|
87
|
+
color?: TypeColorRole;
|
|
88
|
+
textAlign?: 'center';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Type roles, named by role not by size. This is TWJS's textVariants set
|
|
92
|
+
* adopted as canonical (it is the more complete one) — including `defaults`,
|
|
93
|
+
* which restyle requires as its base variant.
|
|
94
|
+
*/
|
|
95
|
+
export declare const typeRoleNames: readonly ['header', 'title', 'subtitle', 'body', 'body-strong', 'body-secondary', 'button', 'badge', 'error', 'kpi', 'caption', 'defaults'];
|
|
96
|
+
export type TypeRoleName = (typeof typeRoleNames)[number];
|
|
97
|
+
export type TypeRoles = Record<TypeRoleName, TypeRole>;
|
|
98
|
+
/** Canonical type roles — verbatim from TWJS theme.ts textVariants. */
|
|
99
|
+
export declare const typeRoles: TypeRoles;
|
|
100
|
+
/**
|
|
101
|
+
* Font family — a web-only token. The restyle emitter omits it: RN uses the
|
|
102
|
+
* platform font (TWJS has no family token today).
|
|
103
|
+
*/
|
|
104
|
+
export declare const fontFamily: {
|
|
105
|
+
readonly sans: '"Geist Variable", sans-serif';
|
|
106
|
+
};
|
|
107
|
+
export type ThemeMode = 'light' | 'dark';
|
|
108
|
+
/**
|
|
109
|
+
* One app theme: explicit per-mode value sets over the contract. Dark values
|
|
110
|
+
* are never derived by transform. `restyleExtras` carries restyle-only color
|
|
111
|
+
* keys that have no canonical slot (e.g. TWJS's brandBg/brandBorder) so the
|
|
112
|
+
* restyle emitter can keep emitting them during the twin transition.
|
|
113
|
+
*/
|
|
114
|
+
export interface ThemeDefinition {
|
|
115
|
+
readonly name: string;
|
|
116
|
+
readonly modes: Partial<Record<ThemeMode, ColorSet>>;
|
|
117
|
+
readonly restyleExtras?: Partial<Record<ThemeMode, Record<string, string>>>;
|
|
118
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The semantic contract — the fixed set of role names every theme must fill.
|
|
3
|
+
* Components reference ONLY this layer. A theme missing a slot is a type
|
|
4
|
+
* error (see ThemeDefinition), not a runtime surprise.
|
|
5
|
+
*/
|
|
6
|
+
/** Canonical color slots (shadcn naming convention). */
|
|
7
|
+
export const colorSlots = [
|
|
8
|
+
'background',
|
|
9
|
+
'background-secondary',
|
|
10
|
+
'foreground',
|
|
11
|
+
'foreground-secondary',
|
|
12
|
+
'card',
|
|
13
|
+
'card-foreground',
|
|
14
|
+
'popover',
|
|
15
|
+
'popover-foreground',
|
|
16
|
+
'primary',
|
|
17
|
+
'primary-foreground',
|
|
18
|
+
'secondary',
|
|
19
|
+
'secondary-foreground',
|
|
20
|
+
'muted',
|
|
21
|
+
'muted-foreground',
|
|
22
|
+
'accent',
|
|
23
|
+
'accent-bg',
|
|
24
|
+
'accent-border',
|
|
25
|
+
'accent-foreground',
|
|
26
|
+
'destructive',
|
|
27
|
+
'destructive-foreground',
|
|
28
|
+
'border',
|
|
29
|
+
'border-strong',
|
|
30
|
+
'input',
|
|
31
|
+
'ring',
|
|
32
|
+
'success',
|
|
33
|
+
'success-bg',
|
|
34
|
+
'success-foreground',
|
|
35
|
+
'warning',
|
|
36
|
+
'warning-bg',
|
|
37
|
+
'warning-foreground',
|
|
38
|
+
'danger',
|
|
39
|
+
'danger-bg',
|
|
40
|
+
'danger-foreground',
|
|
41
|
+
'info',
|
|
42
|
+
'info-bg',
|
|
43
|
+
'info-foreground',
|
|
44
|
+
];
|
|
45
|
+
/**
|
|
46
|
+
* Named 4pt spacing scale. This is TWJS's scale plus the two steps it was
|
|
47
|
+
* missing: `sm` 12 (which TWJS smuggled in as a component token) and `lg` 32.
|
|
48
|
+
* Negative values are an emitter concern and are never stored here.
|
|
49
|
+
*/
|
|
50
|
+
export const spacing = {
|
|
51
|
+
none: 0,
|
|
52
|
+
hairline: 1,
|
|
53
|
+
xxs: 2,
|
|
54
|
+
xs: 4,
|
|
55
|
+
s: 8,
|
|
56
|
+
sm: 12,
|
|
57
|
+
m: 16,
|
|
58
|
+
l: 24,
|
|
59
|
+
lg: 32,
|
|
60
|
+
xl: 40,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Container scale — Tailwind v4's default `--container-*` values, verbatim
|
|
64
|
+
* (tailwindcss 4.3.5 theme.css). These are the stock meanings of the named
|
|
65
|
+
* sizes for the width utilities: `max-w-sm` is 24rem, not a spacing step.
|
|
66
|
+
*
|
|
67
|
+
* D1 (see DESIGN.md §3): the spacing scale above reuses four container
|
|
68
|
+
* names (`xs`, `sm`, `lg`, `xl`), and Tailwind resolves `max-w-*` /
|
|
69
|
+
* `w-*` / `min-w-*` against `--spacing` BEFORE `--container` — so the
|
|
70
|
+
* spacing keys shadowed the container scale. The CSS emitter therefore
|
|
71
|
+
* also emits this scale under the `--width-*`, `--min-width-*`, and
|
|
72
|
+
* `--max-width-*` namespaces, which those utilities resolve FIRST
|
|
73
|
+
* (verified in the installed tailwindcss source), restoring stock
|
|
74
|
+
* semantics without renaming any spacing key. The restyle/JS side never
|
|
75
|
+
* sees this scale: it is a CSS-resolution concern only.
|
|
76
|
+
*/
|
|
77
|
+
export const container = {
|
|
78
|
+
'3xs': '16rem',
|
|
79
|
+
'2xs': '18rem',
|
|
80
|
+
xs: '20rem',
|
|
81
|
+
sm: '24rem',
|
|
82
|
+
md: '28rem',
|
|
83
|
+
lg: '32rem',
|
|
84
|
+
xl: '36rem',
|
|
85
|
+
'2xl': '42rem',
|
|
86
|
+
'3xl': '48rem',
|
|
87
|
+
'4xl': '56rem',
|
|
88
|
+
'5xl': '64rem',
|
|
89
|
+
'6xl': '72rem',
|
|
90
|
+
'7xl': '80rem',
|
|
91
|
+
};
|
|
92
|
+
/** Radius scale (px). `full` is the pill radius. */
|
|
93
|
+
export const radii = {
|
|
94
|
+
sm: 4,
|
|
95
|
+
md: 8,
|
|
96
|
+
lg: 12,
|
|
97
|
+
xl: 16,
|
|
98
|
+
'2xl': 20,
|
|
99
|
+
full: 9999,
|
|
100
|
+
};
|
|
101
|
+
/** Breakpoints (px). `wide` doubles as the max container width. */
|
|
102
|
+
export const breakpoints = {
|
|
103
|
+
phone: 0,
|
|
104
|
+
tablet: 768,
|
|
105
|
+
desktop: 1024,
|
|
106
|
+
wide: 1440,
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Type roles, named by role not by size. This is TWJS's textVariants set
|
|
110
|
+
* adopted as canonical (it is the more complete one) — including `defaults`,
|
|
111
|
+
* which restyle requires as its base variant.
|
|
112
|
+
*/
|
|
113
|
+
export const typeRoleNames = [
|
|
114
|
+
'header',
|
|
115
|
+
'title',
|
|
116
|
+
'subtitle',
|
|
117
|
+
'body',
|
|
118
|
+
'body-strong',
|
|
119
|
+
'body-secondary',
|
|
120
|
+
'button',
|
|
121
|
+
'badge',
|
|
122
|
+
'error',
|
|
123
|
+
'kpi',
|
|
124
|
+
'caption',
|
|
125
|
+
'defaults',
|
|
126
|
+
];
|
|
127
|
+
/** Canonical type roles — verbatim from TWJS theme.ts textVariants. */
|
|
128
|
+
export const typeRoles = {
|
|
129
|
+
header: { fontSize: 28, lineHeight: 34, fontWeight: 'bold', color: 'foreground' },
|
|
130
|
+
title: { fontSize: 20, lineHeight: 26, fontWeight: '600', color: 'foreground' },
|
|
131
|
+
subtitle: { fontSize: 16, lineHeight: 22, fontWeight: '500', color: 'foreground-secondary' },
|
|
132
|
+
body: { fontSize: 15, lineHeight: 22, color: 'foreground' },
|
|
133
|
+
'body-strong': { fontSize: 15, lineHeight: 22, fontWeight: '700', color: 'foreground' },
|
|
134
|
+
'body-secondary': { fontSize: 13, lineHeight: 18, color: 'foreground-secondary' },
|
|
135
|
+
button: { fontSize: 15, lineHeight: 22, fontWeight: '600', textAlign: 'center' },
|
|
136
|
+
badge: { fontSize: 12, lineHeight: 18, fontWeight: '600', textAlign: 'center' },
|
|
137
|
+
error: { fontSize: 12, lineHeight: 16, color: 'danger-foreground' },
|
|
138
|
+
kpi: { fontSize: 28, lineHeight: 34, fontWeight: 'bold', color: 'foreground' },
|
|
139
|
+
caption: { fontSize: 11, lineHeight: 16, color: 'foreground-secondary' },
|
|
140
|
+
defaults: { fontSize: 15, lineHeight: 22, color: 'foreground' },
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Font family — a web-only token. The restyle emitter omits it: RN uses the
|
|
144
|
+
* platform font (TWJS has no family token today).
|
|
145
|
+
*/
|
|
146
|
+
export const fontFamily = {
|
|
147
|
+
sans: '"Geist Variable", sans-serif',
|
|
148
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ThemeDefinition } from '../semantic/contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* CommonBoard — light. Blue #1d4ed8 primary, slate neutrals, mapped from its
|
|
4
|
+
* current utility usage (bg-slate-100 body, blue-700 primary buttons copied
|
|
5
|
+
* inline, slate-300 input borders, blue-600 focus outline, blue-100 active
|
|
6
|
+
* nav pill).
|
|
7
|
+
*
|
|
8
|
+
* CONSTRUCTED slots (the app never expressed them; neutral defaults per
|
|
9
|
+
* DESIGN.md §4, flagged for review at adoption): background-secondary,
|
|
10
|
+
* popover, popover-foreground, secondary, muted, accent-foreground,
|
|
11
|
+
* destructive, border-strong, and the status triples (shared default).
|
|
12
|
+
*/
|
|
13
|
+
export declare const commonboard: ThemeDefinition;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { palette } from '../palette/colors.js';
|
|
2
|
+
import { lightStatus } from './status-defaults.js';
|
|
3
|
+
/**
|
|
4
|
+
* CommonBoard — light. Blue #1d4ed8 primary, slate neutrals, mapped from its
|
|
5
|
+
* current utility usage (bg-slate-100 body, blue-700 primary buttons copied
|
|
6
|
+
* inline, slate-300 input borders, blue-600 focus outline, blue-100 active
|
|
7
|
+
* nav pill).
|
|
8
|
+
*
|
|
9
|
+
* CONSTRUCTED slots (the app never expressed them; neutral defaults per
|
|
10
|
+
* DESIGN.md §4, flagged for review at adoption): background-secondary,
|
|
11
|
+
* popover, popover-foreground, secondary, muted, accent-foreground,
|
|
12
|
+
* destructive, border-strong, and the status triples (shared default).
|
|
13
|
+
*/
|
|
14
|
+
export const commonboard = {
|
|
15
|
+
name: 'commonboard',
|
|
16
|
+
modes: {
|
|
17
|
+
light: {
|
|
18
|
+
background: palette.slate[100],
|
|
19
|
+
'background-secondary': palette.slate[200], // CONSTRUCTED
|
|
20
|
+
foreground: palette.slate[900],
|
|
21
|
+
'foreground-secondary': palette.slate[500],
|
|
22
|
+
card: palette.white,
|
|
23
|
+
'card-foreground': palette.slate[900],
|
|
24
|
+
popover: palette.white, // CONSTRUCTED
|
|
25
|
+
'popover-foreground': palette.slate[900], // CONSTRUCTED
|
|
26
|
+
primary: palette.blue[700],
|
|
27
|
+
'primary-foreground': palette.white,
|
|
28
|
+
secondary: palette.slate[100], // CONSTRUCTED
|
|
29
|
+
'secondary-foreground': palette.slate[700],
|
|
30
|
+
muted: palette.slate[100], // CONSTRUCTED
|
|
31
|
+
// slate-600 (contrast correction, Dec 5, 2026): slate-500 on
|
|
32
|
+
// slate-100 measured 4.34:1 — below the 4.5:1 floor for the Badge
|
|
33
|
+
// neutral-subtle pairing (muted-foreground on muted at 12px).
|
|
34
|
+
// Slate-600 on slate-100 measures 6.92:1 (pinned in
|
|
35
|
+
// tests/contrast.test.ts). Constructed value — verify against the
|
|
36
|
+
// live app at adoption.
|
|
37
|
+
'muted-foreground': palette.slate[600],
|
|
38
|
+
accent: palette.blue[100],
|
|
39
|
+
// The subtle pair is the app's own blue Badge tone (ui.tsx):
|
|
40
|
+
// bg-blue-50 with a blue-600/20 inset ring.
|
|
41
|
+
'accent-bg': palette.blue[50],
|
|
42
|
+
'accent-border': 'rgba(37, 99, 235, 0.2)', // blue-600/20 — the Badge ring
|
|
43
|
+
'accent-foreground': palette.blue[800], // CONSTRUCTED
|
|
44
|
+
destructive: palette.red[600], // CONSTRUCTED
|
|
45
|
+
'destructive-foreground': palette.white,
|
|
46
|
+
border: palette.slate[300],
|
|
47
|
+
'border-strong': palette.slate[700], // CONSTRUCTED
|
|
48
|
+
input: palette.slate[300],
|
|
49
|
+
ring: palette.blue[600],
|
|
50
|
+
...lightStatus, // CONSTRUCTED (shared default)
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ThemeDefinition } from '../semantic/contract.js';
|
|
2
|
+
import { commonboard } from './commonboard.js';
|
|
3
|
+
import { rentproof } from './rentproof.js';
|
|
4
|
+
import { tabbie } from './tabbie.js';
|
|
5
|
+
import { twjs } from './twjs.js';
|
|
6
|
+
import { weddingOps } from './wedding-ops.js';
|
|
7
|
+
export { commonboard, rentproof, tabbie, twjs, weddingOps };
|
|
8
|
+
/** All themes, keyed by theme name (the `data-theme` value on web). */
|
|
9
|
+
export declare const themes: Record<string, ThemeDefinition>;
|
|
10
|
+
export declare const themeNames: string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { commonboard } from './commonboard.js';
|
|
2
|
+
import { rentproof } from './rentproof.js';
|
|
3
|
+
import { tabbie } from './tabbie.js';
|
|
4
|
+
import { twjs } from './twjs.js';
|
|
5
|
+
import { weddingOps } from './wedding-ops.js';
|
|
6
|
+
export { commonboard, rentproof, tabbie, twjs, weddingOps };
|
|
7
|
+
/** All themes, keyed by theme name (the `data-theme` value on web). */
|
|
8
|
+
export const themes = {
|
|
9
|
+
tabbie,
|
|
10
|
+
commonboard,
|
|
11
|
+
'wedding-ops': weddingOps,
|
|
12
|
+
rentproof,
|
|
13
|
+
twjs,
|
|
14
|
+
};
|
|
15
|
+
export const themeNames = Object.keys(themes);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { palette } from '../palette/colors.js';
|
|
2
|
+
import { lightStatus } from './status-defaults.js';
|
|
3
|
+
/**
|
|
4
|
+
* RentProof TH — light. Stone neutrals, deep teal brand. The brand values
|
|
5
|
+
* are the app's own existing tokens (--color-brand #075e6b, --color-brand-dark
|
|
6
|
+
* #054b55 in its index.css), extended to the full contract: brand is primary,
|
|
7
|
+
* brand-dark is the accent.
|
|
8
|
+
*
|
|
9
|
+
* CONSTRUCTED slots (neutral defaults per DESIGN.md §4, flagged for review
|
|
10
|
+
* at adoption): background-secondary, popover, popover-foreground,
|
|
11
|
+
* secondary, muted, accent-foreground, accent-bg, accent-border (a
|
|
12
|
+
* brand-tinted subtle pair — the app's Badge tones are status-only, so no
|
|
13
|
+
* brand pair exists to copy), destructive, destructive-foreground,
|
|
14
|
+
* border-strong, ring (the app's inputs have no focus styling today; brand
|
|
15
|
+
* is the natural ring), and the status triples (shared default).
|
|
16
|
+
*/
|
|
17
|
+
const brand = '#075e6b';
|
|
18
|
+
const brandDark = '#054b55';
|
|
19
|
+
export const rentproof = {
|
|
20
|
+
name: 'rentproof',
|
|
21
|
+
modes: {
|
|
22
|
+
light: {
|
|
23
|
+
background: palette.stone[50],
|
|
24
|
+
'background-secondary': palette.stone[100], // CONSTRUCTED
|
|
25
|
+
foreground: palette.stone[900],
|
|
26
|
+
'foreground-secondary': palette.stone[500],
|
|
27
|
+
card: palette.white,
|
|
28
|
+
'card-foreground': palette.stone[900],
|
|
29
|
+
popover: palette.white, // CONSTRUCTED
|
|
30
|
+
'popover-foreground': palette.stone[900], // CONSTRUCTED
|
|
31
|
+
primary: brand,
|
|
32
|
+
'primary-foreground': palette.white,
|
|
33
|
+
secondary: palette.stone[100], // CONSTRUCTED
|
|
34
|
+
'secondary-foreground': palette.stone[700],
|
|
35
|
+
muted: palette.stone[100], // CONSTRUCTED
|
|
36
|
+
// stone-600 (pilot correction, Dec 5, 2026): the app's dominant
|
|
37
|
+
// secondary text is stone-600, and stone-500 on stone-100 measured
|
|
38
|
+
// only ~4.4:1 — below the 4.5:1 floor for the Badge neutral-subtle
|
|
39
|
+
// pairing (muted-foreground on muted at 12px). Stone-600 on
|
|
40
|
+
// stone-100 measures 6.99:1 (pinned in tests/contrast.test.ts).
|
|
41
|
+
'muted-foreground': palette.stone[600],
|
|
42
|
+
accent: brandDark,
|
|
43
|
+
'accent-bg': 'rgba(7, 94, 107, 0.08)', // CONSTRUCTED — brand at 8%
|
|
44
|
+
'accent-border': 'rgba(7, 94, 107, 0.2)', // CONSTRUCTED — brand at 20%
|
|
45
|
+
'accent-foreground': palette.white, // CONSTRUCTED
|
|
46
|
+
destructive: palette.red[600], // CONSTRUCTED
|
|
47
|
+
'destructive-foreground': palette.white, // CONSTRUCTED
|
|
48
|
+
border: palette.stone[200],
|
|
49
|
+
'border-strong': palette.stone[700], // CONSTRUCTED
|
|
50
|
+
input: palette.stone[300],
|
|
51
|
+
ring: brand, // CONSTRUCTED
|
|
52
|
+
...lightStatus, // CONSTRUCTED (shared default)
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ColorSet } from '../semantic/contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Shared status triples (primary / bg / foreground per severity), taken from
|
|
4
|
+
* TWJS's status model — itself the Tailwind emerald/amber/red/sky
|
|
5
|
+
* 500/100/800 ramps in light mode and 300-level foregrounds on 12%-alpha
|
|
6
|
+
* backgrounds in dark mode. Fleet apps never expressed a full status system,
|
|
7
|
+
* so their themes adopt these as the neutral default (DESIGN.md §4).
|
|
8
|
+
*/
|
|
9
|
+
export type StatusSlots = Pick<ColorSet, 'success' | 'success-bg' | 'success-foreground' | 'warning' | 'warning-bg' | 'warning-foreground' | 'danger' | 'danger-bg' | 'danger-foreground' | 'info' | 'info-bg' | 'info-foreground'>;
|
|
10
|
+
export declare const lightStatus: StatusSlots;
|
|
11
|
+
export declare const darkStatus: StatusSlots;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { palette } from '../palette/colors.js';
|
|
2
|
+
export const lightStatus = {
|
|
3
|
+
success: palette.emerald[500],
|
|
4
|
+
'success-bg': palette.emerald[100],
|
|
5
|
+
'success-foreground': palette.emerald[800],
|
|
6
|
+
warning: palette.amber[500],
|
|
7
|
+
'warning-bg': palette.amber[100],
|
|
8
|
+
'warning-foreground': palette.amber[800],
|
|
9
|
+
danger: palette.red[500],
|
|
10
|
+
'danger-bg': palette.red[100],
|
|
11
|
+
'danger-foreground': palette.red[800],
|
|
12
|
+
info: palette.sky[600],
|
|
13
|
+
'info-bg': palette.sky[100],
|
|
14
|
+
'info-foreground': palette.sky[800],
|
|
15
|
+
};
|
|
16
|
+
export const darkStatus = {
|
|
17
|
+
success: palette.emerald[300],
|
|
18
|
+
'success-bg': 'rgba(16, 185, 129, 0.12)',
|
|
19
|
+
'success-foreground': palette.emerald[300],
|
|
20
|
+
warning: palette.amber[300],
|
|
21
|
+
'warning-bg': 'rgba(245, 158, 11, 0.12)',
|
|
22
|
+
'warning-foreground': palette.amber[300],
|
|
23
|
+
danger: palette.red[300],
|
|
24
|
+
'danger-bg': 'rgba(239, 68, 68, 0.12)',
|
|
25
|
+
'danger-foreground': palette.red[300],
|
|
26
|
+
info: palette.sky[300],
|
|
27
|
+
'info-bg': 'rgba(2, 132, 199, 0.12)',
|
|
28
|
+
'info-foreground': palette.sky[300],
|
|
29
|
+
};
|