Files
xenia-pos-local/packages/ui/tailwind-preset.js
T
bonaminandClaude Opus 5.5 294b769850 feat(manager): the setup wizard and the shell on v2; all of src on the v2 rules (platform-v2 step 6.14b)
- setup wizard (src/pages/setup): welcome (pick the language: the wizard switches at once), the owner's account, the venue
  (kind, name, staff language, time zone), an optional lock-screen PIN, finish -> sign in; English and Greek
- shell (src/shell): AppLayout (license banner in both languages, header, lock button, idle lock / sign-out), Sidebar on a
  new 'nav' token set in @xenia/ui (light + dark), ProfileDialog (name, username, password, 4-6 digit PIN), licenseContext;
  App.jsx loads the session and the setup state with react-query (no setState in effects); the header's dead search box gone
- Management -> Tables -> List (src/pages/tables, was TablesConfigTab): zones as tabs (drag to reorder), zone name / prefix /
  colour, add many numbered on, a table's name (6 chars) / zone / seats, twice-used names flagged, off / on / delete,
  pick several to move, rename in a series or delete (says how many failed)
- the old src/ui kit, layouts/, components/Sidebar + EditProfileModal, the 'primary' palette and the .btn/.card/.input classes deleted;
  NotificationBell / UserMenuButton on tokens; @xenia/ui: nav tokens, 'scrim' in the Tailwind preset
- v2.json paths = src (the guards cover all of it); npm run lint = eslint src; argsIgnorePattern for components in JSX
- tests: shell.test.mjs (3), e2e setup.mjs (new: a fresh install through the wizard in Greek to the overview, in run-all),
  manager.mjs 'tables list' (zone, 3 tables, rename series, profile PIN, rail tokens)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:01:23 +02:00

70 lines
3.9 KiB
JavaScript

// Tailwind 3 preset that maps the @xenia/ui tokens (src/tokens.css) to utilities.
//
// // tailwind.config.js
// import xenia from '@xenia/ui/tailwind-preset'
// export default { presets: [xenia], ... }
//
// It only ADDS names that Tailwind doesn't have (bg-surface, text-ink-2, rounded-control,
// shadow-overlay, text-body…), so an app's existing classes keep their meaning. Spacing
// needs nothing: --x-space-N equals Tailwind's default N (4 px steps).
// The app must also load the tokens: import '@xenia/ui/tokens.css' (or styles.css).
const c = name => `rgb(var(--x-${name}-rgb) / <alpha-value>)`
const BOARD = ['bg', 'rail', 'topbar', 'line', 'deep', 'ink', 'ink-2', 'ink-3', 'ink-4', 'tab-active', 'on-status', 'card', 'card-ink', 'card-ink-2', 'card-muted', 'card-soft', 'card-line', 'card-progress', 'card-done', 'note', 'note-ink', 'fresh', 'fresh-deep', 'warning', 'warning-deep', 'late', 'late-deep', 'done', 'done-deep', 'future', 'future-deep', 'future-glow', 'progress', 'fresh-soft', 'warning-soft', 'late-soft', 'progress-soft']
const tone = name => ({ DEFAULT: c(name), fg: c(`${name}-fg`), soft: c(`${name}-soft`), ink: c(`${name}-ink`) })
/** @type {import('tailwindcss').Config} */
export default {
// `dark:` follows the same attribute as the tokens: data-theme="dark", or "system" + OS dark mode
darkMode: ['variant', [
'&:is([data-theme="dark"] *)',
'@media (prefers-color-scheme: dark) { &:is([data-theme="system"] *) }',
]],
theme: {
extend: {
colors: {
canvas: c('canvas'),
scrim: c('scrim'), // behind dialogs and the lock screen (6.14b)
surface: { DEFAULT: c('surface'), 2: c('surface-2'), 3: c('surface-3') },
line: { DEFAULT: c('line'), strong: c('line-strong') },
ink: { DEFAULT: c('ink'), 2: c('ink-2'), 3: c('ink-3') },
accent: { DEFAULT: c('accent'), strong: c('accent-strong'), fg: c('accent-fg'), soft: c('accent-soft'), ink: c('accent-ink') },
success: tone('success'),
warning: tone('warning'),
danger: tone('danger'),
info: tone('info'),
// the board design language (kitchen display): bg-board-bg, text-board-ink-2, bg-board-late…
board: Object.fromEntries(BOARD.map(n => [n, c(`board-${n}`)])),
// the manager's navigation rail (6.14b): bg-nav-bg, text-nav-ink-2, bg-nav-active…
nav: Object.fromEntries(['bg', 'raised', 'active', 'line', 'ink', 'ink-2', 'ink-3', 'dot'].map(n => [n, c(`nav-${n}`)])),
},
fontSize: {
caption: ['var(--x-text-caption)', { lineHeight: 'var(--x-leading-caption)' }],
label: ['var(--x-text-label)', { lineHeight: 'var(--x-leading-label)' }],
body: ['var(--x-text-body)', { lineHeight: 'var(--x-leading-body)' }],
'body-lg': ['var(--x-text-body-lg)', { lineHeight: 'var(--x-leading-body-lg)' }],
title: ['var(--x-text-title)', { lineHeight: 'var(--x-leading-title)' }],
heading: ['var(--x-text-heading)', { lineHeight: 'var(--x-leading-heading)' }],
display: ['var(--x-text-display)', { lineHeight: 'var(--x-leading-display)' }],
},
borderRadius: {
control: 'var(--x-radius-control)',
card: 'var(--x-radius-card)',
dialog: 'var(--x-radius-dialog)',
'board-card': 'var(--x-board-radius-card)',
},
boxShadow: {
raised: 'var(--x-shadow-raised)',
popover: 'var(--x-shadow-popover)',
overlay: 'var(--x-shadow-overlay)',
focus: 'var(--x-focus-ring)',
},
minHeight: { control: 'var(--x-control-md)' },
height: { 'control-sm': 'var(--x-control-sm)', control: 'var(--x-control-md)', 'control-lg': 'var(--x-control-lg)' },
transitionDuration: { fast: 'var(--x-duration-fast)', base: 'var(--x-duration-base)' },
transitionTimingFunction: { xenia: 'var(--x-ease)' },
zIndex: { overlay: 'var(--x-z-overlay)', toast: 'var(--x-z-toast)', popover: 'var(--x-z-popover)' },
},
},
}